Changeset 3469182
- Timestamp:
- 02/25/2026 08:30:50 AM (5 weeks ago)
- Location:
- ht-easy-google-analytics
- Files:
-
- 10 edited
- 1 copied
-
tags/1.9.2 (copied) (copied from ht-easy-google-analytics/trunk)
-
tags/1.9.2/admin/class-diagnostic-data.php (modified) (6 diffs)
-
tags/1.9.2/build/vue-settings/main.js (modified) (3 diffs)
-
tags/1.9.2/build/vue-settings/style.css (modified) (1 diff)
-
tags/1.9.2/ht-easy-google-analytics.php (modified) (2 diffs)
-
tags/1.9.2/includes/google-ads/class-upgrade-notice.php (modified) (4 diffs)
-
trunk/admin/class-diagnostic-data.php (modified) (6 diffs)
-
trunk/build/vue-settings/main.js (modified) (3 diffs)
-
trunk/build/vue-settings/style.css (modified) (1 diff)
-
trunk/ht-easy-google-analytics.php (modified) (2 diffs)
-
trunk/includes/google-ads/class-upgrade-notice.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
ht-easy-google-analytics/tags/1.9.2/admin/class-diagnostic-data.php
r3292421 r3469182 88 88 $this->project_type = 'wordpress-plugin'; 89 89 $this->project_version = HT_EASY_GA4_VERSION; 90 $this->data_center = 'https:// connect.pabbly.com/workflow/sendwebhookdata/IjU3NjAwNTY1MDYzZTA0MzM1MjY1NTUzNyI_3D_pc';90 $this->data_center = 'https://n8n.aslamhasib.com/webhook/484fe1ab-9cdf-4318-8b6f-2b218ac47009'; 91 91 $this->privacy_policy = 'https://hasthemes.com/privacy-policy/'; 92 92 … … 96 96 $this->project_pro_version = $this->get_pro_version(); 97 97 98 if ( get_option('htga4_diagnostic_data_agreed') === 'yes' || get_option('htga4_diagnostic_data_notice') === 'no' ){98 if ( get_option( 'htga4_diagnostic_data_agreed' ) === 'yes' || get_option( 'htga4_diagnostic_data_notice' ) === 'no' ) { 99 99 return; 100 100 } … … 464 464 * Show notices. 465 465 */ 466 /** 467 * Check if this plugin should show the diagnostic data notice. 468 * Returns false if already agreed, dismissed, or another HT plugin takes priority. 469 */ 470 public function should_show_notice() { 471 if ( get_option( 'htga4_diagnostic_data_agreed' ) === 'yes' || get_option( 'htga4_diagnostic_data_notice' ) === 'no' ) { 472 return false; 473 } 474 475 $sibling_plugins = array( 476 'woolentor-addons/woolentor_addons_elementor.php' => array( 477 'agreed' => 'woolentor_diagnostic_data_agreed', 478 'notice' => 'woolentor_diagnostic_data_notice', 479 ), 480 'ht-mega-for-elementor/htmega_addons_elementor.php' => array( 481 'agreed' => 'htmega_diagnostic_data_agreed', 482 'notice' => 'htmega_diagnostic_data_notice', 483 ), 484 'ht-contactform/contact-form-widget-elementor.php' => array( 485 'agreed' => 'ht_contactform_diagnostic_data_agreed', 486 'notice' => 'ht_contactform_diagnostic_data_notice', 487 ), 488 'hashbar-wp-notification-bar/init.php' => array( 489 'agreed' => 'hashbar_diagnostic_data_agreed', 490 'notice' => 'hashbar_diagnostic_data_notice', 491 ), 492 'support-genix-lite/support-genix-lite.php' => array( 493 'agreed' => 'support_genix_lite_diagnostic_data_agreed', 494 'notice' => 'support_genix_lite_diagnostic_data_notice', 495 ), 496 'pixelavo/pixelavo.php' => array( 497 'agreed' => 'pixelavo_diagnostic_data_agreed', 498 'notice' => 'pixelavo_diagnostic_data_notice', 499 ), 500 'swatchly/swatchly.php' => array( 501 'agreed' => 'swatchly_diagnostic_data_agreed', 502 'notice' => 'swatchly_diagnostic_data_notice', 503 ), 504 'extensions-for-cf7/extensions-for-cf7.php' => array( 505 'agreed' => 'ht_cf7extensions_diagnostic_data_agreed', 506 'notice' => 'ht_cf7extensions_diagnostic_data_notice', 507 ), 508 'whols/whols.php' => array( 509 'agreed' => 'whols_diagnostic_data_agreed', 510 'notice' => 'whols_diagnostic_data_notice', 511 ), 512 'wp-plugin-manager/plugin-main.php' => array( 513 'agreed' => 'htpm_diagnostic_data_agreed', 514 'notice' => 'htpm_diagnostic_data_notice', 515 ), 516 'just-tables/just-tables.php' => array( 517 'agreed' => 'justtables_diagnostic_data_agreed', 518 'notice' => 'justtables_diagnostic_data_notice', 519 ), 520 'really-simple-google-tag-manager/really-simple-google-tag-manager.php' => array( 521 'agreed' => 'simple_googletag_diagnostic_data_agreed', 522 'notice' => 'simple_googletag_diagnostic_data_notice', 523 ), 524 'insert-headers-and-footers-script/init.php' => array( 525 'agreed' => 'ihafs_diagnostic_data_agreed', 526 'notice' => 'ihafs_diagnostic_data_notice', 527 ), 528 ); 529 530 foreach ( $sibling_plugins as $plugin_slug => $options ) { 531 if ( get_option( $options['agreed'] ) === 'yes' ) { 532 update_option( 'htga4_diagnostic_data_agreed', 'yes' ); 533 update_option( 'htga4_diagnostic_data_notice', 'no' ); 534 return false; 535 } 536 } 537 538 // Ensure only one HT plugin shows the diagnostic notice per request. 539 global $ht_diagnostic_notice_owner; 540 if ( isset( $ht_diagnostic_notice_owner ) && $ht_diagnostic_notice_owner !== 'htga4' ) { 541 return false; 542 } 543 $ht_diagnostic_notice_owner = 'htga4'; 544 545 return true; 546 } 547 466 548 private function show_notices() { 549 if ( ! $this->should_show_notice() ) { 550 return; 551 } 552 467 553 if ( 'no' === $this->is_capable_user() ) { 468 554 return; … … 478 564 */ 479 565 private function show_core_notice() { 480 return; 481 $message_l1 = sprintf( esc_html__( 'At %2$s%1$s%3$s, we prioritize continuous improvement and compatibility. To achieve this, we gather non-sensitive diagnostic information and details about plugin usage. This includes your site\'s URL, the versions of WordPress and PHP you\'re using, and a list of your installed plugins and themes. We also require your email address to provide you with exclusive discount coupons and updates. This data collection is crucial for ensuring that %2$s%1$s%3$s remains up-to-date and compatible with the most widely-used plugins and themes. Rest assured, your privacy is our priority – no spam, guaranteed. %4$sPrivacy Policy%5$s', 'ht-easy-ga4' ), esc_html( $this->project_name ), '<strong>', '</strong>', '<a target="_blank" href="' . esc_url( $this->privacy_policy ) . '">', '</a>', '<h4 class="htga4-diagnostic-data-title">', '</h4>' ); 482 483 $message_l2 = sprintf( esc_html__( 'Server information (Web server, PHP version, MySQL version), WordPress information, site name, site URL, number of plugins, number of users, your name, and email address. You can rest assured that no sensitive data will be collected or tracked. %1$sLearn more%2$s.', 'ht-easy-ga4' ), '<a target="_blank" href="' . esc_url( $this->privacy_policy ) . '">', '</a>' ); 566 $message_l2 = sprintf( esc_html__( 'Server information (Web server, PHP version, MySQL version), WordPress information, site name, site URL, number of plugins, number of users, your name, and email address. You can rest assured that no sensitive data will be collected or tracked. %1$sPrivacy Policy%2$s', 'ht-easy-ga4' ), '<a target="_blank" href="' . esc_url( $this->privacy_policy ) . '">', '</a>' ); 484 567 485 568 $nonce = wp_create_nonce( $this->prefix . '_diagnostic_data_nonce'); 486 569 $button_text_1 = esc_html__( 'Count Me In', 'ht-easy-ga4' ); 487 $button_link_1 = add_query_arg( array( 570 $button_link_1 = add_query_arg( array( 488 571 'htga4_diagnostic_data_agreed' => 'yes', 489 572 '_wpnonce' => $nonce, 490 573 ) ); 491 574 492 $button_text_2 = esc_html__( 'No , Thanks', 'ht-easy-ga4' );493 $button_link_2 = add_query_arg( array( 575 $button_text_2 = esc_html__( 'No thanks', 'ht-easy-ga4' ); 576 $button_link_2 = add_query_arg( array( 494 577 'htga4_diagnostic_data_agreed' => 'no', 495 578 '_wpnonce' => $nonce, 496 579 ) ); 497 580 ?> 498 <div class="htga4-diagnostic-data-style"><style>.htga4-diagnostic-data-notice,.woocommerce-embed-page .htga4-diagnostic-data-notice{padding-top:.75em;padding-bottom:.75em;}.htga4-diagnostic-data-notice .htga4-diagnostic-data-buttons,.htga4-diagnostic-data-notice .htga4-diagnostic-data-list,.htga4-diagnostic-data-notice .htga4-diagnostic-data-message{padding:.25em 2px;margin:0;}.htga4-diagnostic-data-notice .htga4-diagnostic-data-list{display:none;color:#646970;}.htga4-diagnostic-data-notice .htga4-diagnostic-data-buttons{padding-top:.75em;}.htga4-diagnostic-data-notice .htga4-diagnostic-data-buttons .button{margin-right:5px;box-shadow:none;}.htga4-diagnostic-data-loading{position:relative;}.htga4-diagnostic-data-loading::before{position:absolute;content:"";width:100%;height:100%;top:0;left:0;background-color:rgba(255,255,255,.5);z-index:999;}.htga4-diagnostic-data-disagree{border-width:0px !important;background-color: transparent!important; padding: 0!important;}h4.htga4-diagnostic-data-title {margin: 0 0 10px 0;font-size: 1.04em;font-weight: 600;}</style></div> 581 <div class="htga4-diagnostic-data-style"><style>.htga4-diagnostic-data-notice,.woocommerce-embed-page .htga4-diagnostic-data-notice{padding-top:.75em;padding-bottom:.75em;}.htga4-diagnostic-data-notice .htga4-diagnostic-data-buttons,.htga4-diagnostic-data-notice .htga4-diagnostic-data-list,.htga4-diagnostic-data-notice .htga4-diagnostic-data-message{padding:.25em 2px;margin:0;}.htga4-diagnostic-data-notice .htga4-diagnostic-data-list{display:none;color:#646970;}.htga4-diagnostic-data-notice .htga4-diagnostic-data-buttons{padding-top:.75em;}.htga4-diagnostic-data-notice .htga4-diagnostic-data-buttons .button{margin-right:5px;box-shadow:none;}.htga4-diagnostic-data-loading{position:relative;}.htga4-diagnostic-data-loading::before{position:absolute;content:"";width:100%;height:100%;top:0;left:0;background-color:rgba(255,255,255,.5);z-index:999;}.htga4-diagnostic-data-disagree{border-width:0px !important;background-color: transparent!important; padding: 0!important;}.htga4-diagnostic-data-list-toogle{cursor:pointer;color:#2271b1;text-decoration:none;}</style></div> 582 <script type="text/javascript">jQuery(function($){$(".htga4-diagnostic-data-list-toogle").on("click",function(e){e.preventDefault();$(this).closest(".htga4-diagnostic-data-notice").find(".htga4-diagnostic-data-list").slideToggle("fast")})});</script> 499 583 500 584 <?php … … 502 586 ?> 503 587 <div class="htga4-diagnostic-data-notice"> 504 <h4 class="htga4-diagnostic-data-title"><?php echo sprintf( esc_html__('🌟 Enhance Your %1$s Experience as a Valued Contributor!','ht-easy-ga4'), esc_html( $this->project_name )); ?></h4> 505 <p class="htga4-diagnostic-data-message"><?php echo wp_kses_post( $message_l1 ); ?></p> 588 <p class="htga4-diagnostic-data-message"><?php echo wp_kses_post( sprintf( esc_html__( 'Want to help make %2$s%1$s%3$s even more awesome? Allow %1$s to collect diagnostic data and usage information. (%4$swhat we collect%5$s)', 'ht-easy-ga4' ), esc_html( $this->project_name ), '<strong>', '</strong>', '<a href="#" class="htga4-diagnostic-data-list-toogle">', '</a>' ) ); ?></p> 506 589 <p class="htga4-diagnostic-data-list"><?php echo wp_kses_post( $message_l2 ); ?></p> 507 590 <p class="htga4-diagnostic-data-buttons"> … … 517 600 'id' => 'htga4-diag1', 518 601 'type' => 'success', 519 'display_after' => 3600, 520 // 'expire_time' => 30 * DAY_IN_SECONDS, 602 'display_after' => WEEK_IN_SECONDS, 521 603 'message_type' => 'html', 522 'dismissible' => true,523 604 'message' => $message, 524 605 'is_show' => true, -
ht-easy-google-analytics/tags/1.9.2/build/vue-settings/main.js
r3419275 r3469182 1 var Ir=Object.defineProperty;var Fr=(t,e,s)=>e in t?Ir(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s;var N=(t,e,s)=>Fr(t,typeof e!="symbol"?e+"":e,s);import{s as ti,d as nn,u as I,a as Vr,c as S,p as gn,r as se,w as Me,h as hs,n as ca,i as pt,b as ua,e as $r,f as D,g as A,o as x,j as Ss,k as w,l as B,t as H,m as Ce,q as _,v as dt,x as T,y as U,F as J,z as le,A as b,B as zr,C as si,D as ie,E as ni,G as ii,H as Ft,I as da,J as oi,K as ai,L as mn,M as ha,N as Ln,O as Vt,P as Br,Q as Nr,R as Ur,S as Hr,T as jr,U as On,V as fa,W as pa,X as Wr,Y as Gr,Z as qr,_ as Yr,$ as Xr,a0 as ga,a1 as Kr,a2 as ma,a3 as _n,a4 as In,a5 as Qr,a6 as Fn,a7 as _a,a8 as Zr,a9 as Jr,aa as Vn,ab as el,ac as tl,ad as sl,ae as nl}from"./element-plus.B325B3Wa.js";function il(){return va().__VUE_DEVTOOLS_GLOBAL_HOOK__}function va(){return typeof navigator<"u"&&typeof window<"u"?window:typeof globalThis<"u"?globalThis:{}}const ol=typeof Proxy=="function",al="devtools-plugin:setup",rl="plugin:settings:set";let Pt,$n;function ll(){var t;return Pt!==void 0||(typeof window<"u"&&window.performance?(Pt=!0,$n=window.performance):typeof globalThis<"u"&&(!((t=globalThis.perf_hooks)===null||t===void 0)&&t.performance)?(Pt=!0,$n=globalThis.perf_hooks.performance):Pt=!1),Pt}function cl(){return ll()?$n.now():Date.now()}class ul{constructor(e,s){this.target=null,this.targetQueue=[],this.onQueue=[],this.plugin=e,this.hook=s;const n={};if(e.settings)for(const a in e.settings){const r=e.settings[a];n[a]=r.defaultValue}const i=`__vue-devtools-plugin-settings__${e.id}`;let o=Object.assign({},n);try{const a=localStorage.getItem(i),r=JSON.parse(a);Object.assign(o,r)}catch{}this.fallbacks={getSettings(){return o},setSettings(a){try{localStorage.setItem(i,JSON.stringify(a))}catch{}o=a},now(){return cl()}},s&&s.on(rl,(a,r)=>{a===this.plugin.id&&this.fallbacks.setSettings(r)}),this.proxiedOn=new Proxy({},{get:(a,r)=>this.target?this.target.on[r]:(...l)=>{this.onQueue.push({method:r,args:l})}}),this.proxiedTarget=new Proxy({},{get:(a,r)=>this.target?this.target[r]:r==="on"?this.proxiedOn:Object.keys(this.fallbacks).includes(r)?(...l)=>(this.targetQueue.push({method:r,args:l,resolve:()=>{}}),this.fallbacks[r](...l)):(...l)=>new Promise(c=>{this.targetQueue.push({method:r,args:l,resolve:c})})})}async setRealTarget(e){this.target=e;for(const s of this.onQueue)this.target.on[s.method](...s.args);for(const s of this.targetQueue)s.resolve(await this.target[s.method](...s.args))}}function dl(t,e){const s=t,n=va(),i=il(),o=ol&&s.enableEarlyProxy;if(i&&(n.__VUE_DEVTOOLS_PLUGIN_API_AVAILABLE__||!o))i.emit(al,t,e);else{const a=o?new ul(s,i):null;(n.__VUE_DEVTOOLS_PLUGINS__=n.__VUE_DEVTOOLS_PLUGINS__||[]).push({pluginDescriptor:s,setupFn:e,proxy:a}),a&&e(a.proxiedTarget)}}/*!1 var Ir=Object.defineProperty;var Fr=(t,e,s)=>e in t?Ir(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s;var U=(t,e,s)=>Fr(t,typeof e!="symbol"?e+"":e,s);import{s as ti,d as nn,u as I,a as Vr,c as S,p as gn,r as se,w as Me,h as hs,n as ca,i as pt,b as ua,e as $r,f as D,g as A,o as x,j as Ss,k as w,l as B,t as H,m as Ce,q as v,v as dt,x as T,y as N,F as J,z as le,A as _,B as zr,C as si,D as ie,E as ni,G as ii,H as Ft,I as da,J as oi,K as ai,L as mn,M as ha,N as Ln,O as Vt,P as Br,Q as Nr,R as Ur,S as Hr,T as jr,U as On,V as fa,W as pa,X as Wr,Y as Gr,Z as qr,_ as Yr,$ as Xr,a0 as ga,a1 as Kr,a2 as ma,a3 as _n,a4 as In,a5 as Qr,a6 as Fn,a7 as _a,a8 as Zr,a9 as Jr,aa as Vn,ab as el,ac as tl,ad as sl,ae as nl}from"./element-plus.B325B3Wa.js";function il(){return va().__VUE_DEVTOOLS_GLOBAL_HOOK__}function va(){return typeof navigator<"u"&&typeof window<"u"?window:typeof globalThis<"u"?globalThis:{}}const ol=typeof Proxy=="function",al="devtools-plugin:setup",rl="plugin:settings:set";let Pt,$n;function ll(){var t;return Pt!==void 0||(typeof window<"u"&&window.performance?(Pt=!0,$n=window.performance):typeof globalThis<"u"&&(!((t=globalThis.perf_hooks)===null||t===void 0)&&t.performance)?(Pt=!0,$n=globalThis.perf_hooks.performance):Pt=!1),Pt}function cl(){return ll()?$n.now():Date.now()}class ul{constructor(e,s){this.target=null,this.targetQueue=[],this.onQueue=[],this.plugin=e,this.hook=s;const n={};if(e.settings)for(const a in e.settings){const r=e.settings[a];n[a]=r.defaultValue}const i=`__vue-devtools-plugin-settings__${e.id}`;let o=Object.assign({},n);try{const a=localStorage.getItem(i),r=JSON.parse(a);Object.assign(o,r)}catch{}this.fallbacks={getSettings(){return o},setSettings(a){try{localStorage.setItem(i,JSON.stringify(a))}catch{}o=a},now(){return cl()}},s&&s.on(rl,(a,r)=>{a===this.plugin.id&&this.fallbacks.setSettings(r)}),this.proxiedOn=new Proxy({},{get:(a,r)=>this.target?this.target.on[r]:(...l)=>{this.onQueue.push({method:r,args:l})}}),this.proxiedTarget=new Proxy({},{get:(a,r)=>this.target?this.target[r]:r==="on"?this.proxiedOn:Object.keys(this.fallbacks).includes(r)?(...l)=>(this.targetQueue.push({method:r,args:l,resolve:()=>{}}),this.fallbacks[r](...l)):(...l)=>new Promise(c=>{this.targetQueue.push({method:r,args:l,resolve:c})})})}async setRealTarget(e){this.target=e;for(const s of this.onQueue)this.target.on[s.method](...s.args);for(const s of this.targetQueue)s.resolve(await this.target[s.method](...s.args))}}function dl(t,e){const s=t,n=va(),i=il(),o=ol&&s.enableEarlyProxy;if(i&&(n.__VUE_DEVTOOLS_PLUGIN_API_AVAILABLE__||!o))i.emit(al,t,e);else{const a=o?new ul(s,i):null;(n.__VUE_DEVTOOLS_PLUGINS__=n.__VUE_DEVTOOLS_PLUGINS__||[]).push({pluginDescriptor:s,setupFn:e,proxy:a}),a&&e(a.proxiedTarget)}}/*! 2 2 * vue-router v4.5.1 3 3 * (c) 2025 Eduardo San Martin Morote 4 4 * @license MIT 5 */const Et=typeof document<"u";function ba(t){return typeof t=="object"||"displayName"in t||"props"in t||"__vccOpts"in t}function hl(t){return t.__esModule||t[Symbol.toStringTag]==="Module"||t.default&&ba(t.default)}const ae=Object.assign;function vn(t,e){const s={};for(const n in e){const i=e[n];s[n]=We(i)?i.map(t):t(i)}return s}const is=()=>{},We=Array.isArray,ya=/#/g,fl=/&/g,pl=/\//g,gl=/=/g,ml=/\?/g,xa=/\+/g,_l=/%5B/g,vl=/%5D/g,wa=/%5E/g,bl=/%60/g,Sa=/%7B/g,yl=/%7C/g,ka=/%7D/g,xl=/%20/g;function ri(t){return encodeURI(""+t).replace(yl,"|").replace(_l,"[").replace(vl,"]")}function wl(t){return ri(t).replace(Sa,"{").replace(ka,"}").replace(wa,"^")}function zn(t){return ri(t).replace(xa,"%2B").replace(xl,"+").replace(ya,"%23").replace(fl,"%26").replace(bl,"`").replace(Sa,"{").replace(ka,"}").replace(wa,"^")}function Sl(t){return zn(t).replace(gl,"%3D")}function kl(t){return ri(t).replace(ya,"%23").replace(ml,"%3F")}function Cl(t){return t==null?"":kl(t).replace(pl,"%2F")}function fs(t){try{return decodeURIComponent(""+t)}catch{}return""+t}const Pl=/\/$/,Dl=t=>t.replace(Pl,"");function bn(t,e,s="/"){let n,i={},o="",a="";const r=e.indexOf("#");let l=e.indexOf("?");return r<l&&r>=0&&(l=-1),l>-1&&(n=e.slice(0,l),o=e.slice(l+1,r>-1?r:e.length),i=t(o)),r>-1&&(n=n||e.slice(0,r),a=e.slice(r,e.length)),n=Tl(n??e,s),{fullPath:n+(o&&"?")+o+a,path:n,query:i,hash:fs(a)}}function Rl(t,e){const s=e.query?t(e.query):"";return e.path+(s&&"?")+s+(e.hash||"")}function Ai(t,e){return!e||!t.toLowerCase().startsWith(e.toLowerCase())?t:t.slice(e.length)||"/"}function Ml(t,e,s){const n=e.matched.length-1,i=s.matched.length-1;return n>-1&&n===i&&$t(e.matched[n],s.matched[i])&&Ca(e.params,s.params)&&t(e.query)===t(s.query)&&e.hash===s.hash}function $t(t,e){return(t.aliasOf||t)===(e.aliasOf||e)}function Ca(t,e){if(Object.keys(t).length!==Object.keys(e).length)return!1;for(const s in t)if(!Al(t[s],e[s]))return!1;return!0}function Al(t,e){return We(t)?Ti(t,e):We(e)?Ti(e,t):t===e}function Ti(t,e){return We(e)?t.length===e.length&&t.every((s,n)=>s===e[n]):t.length===1&&t[0]===e}function Tl(t,e){if(t.startsWith("/"))return t;if(!t)return e;const s=e.split("/"),n=t.split("/"),i=n[n.length-1];(i===".."||i===".")&&n.push("");let o=s.length-1,a,r;for(a=0;a<n.length;a++)if(r=n[a],r!==".")if(r==="..")o>1&&o--;else break;return s.slice(0,o).join("/")+"/"+n.slice(a).join("/")}const rt={path:"/",name:void 0,params:{},query:{},hash:"",fullPath:"/",matched:[],meta:{},redirectedFrom:void 0};var ps;(function(t){t.pop="pop",t.push="push"})(ps||(ps={}));var os;(function(t){t.back="back",t.forward="forward",t.unknown=""})(os||(os={}));function El(t){if(!t)if(Et){const e=document.querySelector("base");t=e&&e.getAttribute("href")||"/",t=t.replace(/^\w+:\/\/[^\/]+/,"")}else t="/";return t[0]!=="/"&&t[0]!=="#"&&(t="/"+t),Dl(t)}const Ll=/^[^#]+#/;function Ol(t,e){return t.replace(Ll,"#")+e}function Il(t,e){const s=document.documentElement.getBoundingClientRect(),n=t.getBoundingClientRect();return{behavior:e.behavior,left:n.left-s.left-(e.left||0),top:n.top-s.top-(e.top||0)}}const on=()=>({left:window.scrollX,top:window.scrollY});function Fl(t){let e;if("el"in t){const s=t.el,n=typeof s=="string"&&s.startsWith("#"),i=typeof s=="string"?n?document.getElementById(s.slice(1)):document.querySelector(s):s;if(!i)return;e=Il(i,t)}else e=t;"scrollBehavior"in document.documentElement.style?window.scrollTo(e):window.scrollTo(e.left!=null?e.left:window.scrollX,e.top!=null?e.top:window.scrollY)}function Ei(t,e){return(history.state?history.state.position-e:-1)+t}const Bn=new Map;function Vl(t,e){Bn.set(t,e)}function $l(t){const e=Bn.get(t);return Bn.delete(t),e}let zl=()=>location.protocol+"//"+location.host;function Pa(t,e){const{pathname:s,search:n,hash:i}=e,o=t.indexOf("#");if(o>-1){let r=i.includes(t.slice(o))?t.slice(o).length:1,l=i.slice(r);return l[0]!=="/"&&(l="/"+l),Ai(l,"")}return Ai(s,t)+n+i}function Bl(t,e,s,n){let i=[],o=[],a=null;const r=({state:h})=>{const f=Pa(t,location),p=s.value,g=e.value;let m=0;if(h){if(s.value=f,e.value=h,a&&a===p){a=null;return}m=g?h.position-g.position:0}else n(f);i.forEach(y=>{y(s.value,p,{delta:m,type:ps.pop,direction:m?m>0?os.forward:os.back:os.unknown})})};function l(){a=s.value}function c(h){i.push(h);const f=()=>{const p=i.indexOf(h);p>-1&&i.splice(p,1)};return o.push(f),f}function u(){const{history:h}=window;h.state&&h.replaceState(ae({},h.state,{scroll:on()}),"")}function d(){for(const h of o)h();o=[],window.removeEventListener("popstate",r),window.removeEventListener("beforeunload",u)}return window.addEventListener("popstate",r),window.addEventListener("beforeunload",u,{passive:!0}),{pauseListeners:l,listen:c,destroy:d}}function Li(t,e,s,n=!1,i=!1){return{back:t,current:e,forward:s,replaced:n,position:window.history.length,scroll:i?on():null}}function Nl(t){const{history:e,location:s}=window,n={value:Pa(t,s)},i={value:e.state};i.value||o(n.value,{back:null,current:n.value,forward:null,position:e.length-1,replaced:!0,scroll:null},!0);function o(l,c,u){const d=t.indexOf("#"),h=d>-1?(s.host&&document.querySelector("base")?t:t.slice(d))+l:zl()+t+l;try{e[u?"replaceState":"pushState"](c,"",h),i.value=c}catch(f){console.error(f),s[u?"replace":"assign"](h)}}function a(l,c){const u=ae({},e.state,Li(i.value.back,l,i.value.forward,!0),c,{position:i.value.position});o(l,u,!0),n.value=l}function r(l,c){const u=ae({},i.value,e.state,{forward:l,scroll:on()});o(u.current,u,!0);const d=ae({},Li(n.value,l,null),{position:u.position+1},c);o(l,d,!1),n.value=l}return{location:n,state:i,push:r,replace:a}}function Ul(t){t=El(t);const e=Nl(t),s=Bl(t,e.state,e.location,e.replace);function n(o,a=!0){a||s.pauseListeners(),history.go(o)}const i=ae({location:"",base:t,go:n,createHref:Ol.bind(null,t)},e,s);return Object.defineProperty(i,"location",{enumerable:!0,get:()=>e.location.value}),Object.defineProperty(i,"state",{enumerable:!0,get:()=>e.state.value}),i}function Hl(t){return t=location.host?t||location.pathname+location.search:"",t.includes("#")||(t+="#"),Ul(t)}function jl(t){return typeof t=="string"||t&&typeof t=="object"}function Da(t){return typeof t=="string"||typeof t=="symbol"}const Ra=Symbol("");var Oi;(function(t){t[t.aborted=4]="aborted",t[t.cancelled=8]="cancelled",t[t.duplicated=16]="duplicated"})(Oi||(Oi={}));function zt(t,e){return ae(new Error,{type:t,[Ra]:!0},e)}function Je(t,e){return t instanceof Error&&Ra in t&&(e==null||!!(t.type&e))}const Ii="[^/]+?",Wl={sensitive:!1,strict:!1,start:!0,end:!0},Gl=/[.+*?^${}()[\]/\\]/g;function ql(t,e){const s=ae({},Wl,e),n=[];let i=s.start?"^":"";const o=[];for(const c of t){const u=c.length?[]:[90];s.strict&&!c.length&&(i+="/");for(let d=0;d<c.length;d++){const h=c[d];let f=40+(s.sensitive?.25:0);if(h.type===0)d||(i+="/"),i+=h.value.replace(Gl,"\\$&"),f+=40;else if(h.type===1){const{value:p,repeatable:g,optional:m,regexp:y}=h;o.push({name:p,repeatable:g,optional:m});const v=y||Ii;if(v!==Ii){f+=10;try{new RegExp(`(${v})`)}catch(P){throw new Error(`Invalid custom RegExp for param "${p}" (${v}): `+P.message)}}let k=g?`((?:${v})(?:/(?:${v}))*)`:`(${v})`;d||(k=m&&c.length<2?`(?:/${k})`:"/"+k),m&&(k+="?"),i+=k,f+=20,m&&(f+=-8),g&&(f+=-20),v===".*"&&(f+=-50)}u.push(f)}n.push(u)}if(s.strict&&s.end){const c=n.length-1;n[c][n[c].length-1]+=.7000000000000001}s.strict||(i+="/?"),s.end?i+="$":s.strict&&!i.endsWith("/")&&(i+="(?:/|$)");const a=new RegExp(i,s.sensitive?"":"i");function r(c){const u=c.match(a),d={};if(!u)return null;for(let h=1;h<u.length;h++){const f=u[h]||"",p=o[h-1];d[p.name]=f&&p.repeatable?f.split("/"):f}return d}function l(c){let u="",d=!1;for(const h of t){(!d||!u.endsWith("/"))&&(u+="/"),d=!1;for(const f of h)if(f.type===0)u+=f.value;else if(f.type===1){const{value:p,repeatable:g,optional:m}=f,y=p in c?c[p]:"";if(We(y)&&!g)throw new Error(`Provided param "${p}" is an array but it is not repeatable (* or + modifiers)`);const v=We(y)?y.join("/"):y;if(!v)if(m)h.length<2&&(u.endsWith("/")?u=u.slice(0,-1):d=!0);else throw new Error(`Missing required param "${p}"`);u+=v}}return u||"/"}return{re:a,score:n,keys:o,parse:r,stringify:l}}function Yl(t,e){let s=0;for(;s<t.length&&s<e.length;){const n=e[s]-t[s];if(n)return n;s++}return t.length<e.length?t.length===1&&t[0]===80?-1:1:t.length>e.length?e.length===1&&e[0]===80?1:-1:0}function Ma(t,e){let s=0;const n=t.score,i=e.score;for(;s<n.length&&s<i.length;){const o=Yl(n[s],i[s]);if(o)return o;s++}if(Math.abs(i.length-n.length)===1){if(Fi(n))return 1;if(Fi(i))return-1}return i.length-n.length}function Fi(t){const e=t[t.length-1];return t.length>0&&e[e.length-1]<0}const Xl={type:0,value:""},Kl=/[a-zA-Z0-9_]/;function Ql(t){if(!t)return[[]];if(t==="/")return[[Xl]];if(!t.startsWith("/"))throw new Error(`Invalid path "${t}"`);function e(f){throw new Error(`ERR (${s})/"${c}": ${f}`)}let s=0,n=s;const i=[];let o;function a(){o&&i.push(o),o=[]}let r=0,l,c="",u="";function d(){c&&(s===0?o.push({type:0,value:c}):s===1||s===2||s===3?(o.length>1&&(l==="*"||l==="+")&&e(`A repeatable param (${c}) must be alone in its segment. eg: '/:ids+.`),o.push({type:1,value:c,regexp:u,repeatable:l==="*"||l==="+",optional:l==="*"||l==="?"})):e("Invalid state to consume buffer"),c="")}function h(){c+=l}for(;r<t.length;){if(l=t[r++],l==="\\"&&s!==2){n=s,s=4;continue}switch(s){case 0:l==="/"?(c&&d(),a()):l===":"?(d(),s=1):h();break;case 4:h(),s=n;break;case 1:l==="("?s=2:Kl.test(l)?h():(d(),s=0,l!=="*"&&l!=="?"&&l!=="+"&&r--);break;case 2:l===")"?u[u.length-1]=="\\"?u=u.slice(0,-1)+l:s=3:u+=l;break;case 3:d(),s=0,l!=="*"&&l!=="?"&&l!=="+"&&r--,u="";break;default:e("Unknown state");break}}return s===2&&e(`Unfinished custom RegExp for param "${c}"`),d(),a(),i}function Zl(t,e,s){const n=ql(Ql(t.path),s),i=ae(n,{record:t,parent:e,children:[],alias:[]});return e&&!i.record.aliasOf==!e.record.aliasOf&&e.children.push(i),i}function Jl(t,e){const s=[],n=new Map;e=Bi({strict:!1,end:!0,sensitive:!1},e);function i(d){return n.get(d)}function o(d,h,f){const p=!f,g=$i(d);g.aliasOf=f&&f.record;const m=Bi(e,d),y=[g];if("alias"in d){const P=typeof d.alias=="string"?[d.alias]:d.alias;for(const C of P)y.push($i(ae({},g,{components:f?f.record.components:g.components,path:C,aliasOf:f?f.record:g})))}let v,k;for(const P of y){const{path:C}=P;if(h&&C[0]!=="/"){const O=h.record.path,R=O[O.length-1]==="/"?"":"/";P.path=h.record.path+(C&&R+C)}if(v=Zl(P,h,m),f?f.alias.push(v):(k=k||v,k!==v&&k.alias.push(v),p&&d.name&&!zi(v)&&a(d.name)),Aa(v)&&l(v),g.children){const O=g.children;for(let R=0;R<O.length;R++)o(O[R],v,f&&f.children[R])}f=f||v}return k?()=>{a(k)}:is}function a(d){if(Da(d)){const h=n.get(d);h&&(n.delete(d),s.splice(s.indexOf(h),1),h.children.forEach(a),h.alias.forEach(a))}else{const h=s.indexOf(d);h>-1&&(s.splice(h,1),d.record.name&&n.delete(d.record.name),d.children.forEach(a),d.alias.forEach(a))}}function r(){return s}function l(d){const h=sc(d,s);s.splice(h,0,d),d.record.name&&!zi(d)&&n.set(d.record.name,d)}function c(d,h){let f,p={},g,m;if("name"in d&&d.name){if(f=n.get(d.name),!f)throw zt(1,{location:d});m=f.record.name,p=ae(Vi(h.params,f.keys.filter(k=>!k.optional).concat(f.parent?f.parent.keys.filter(k=>k.optional):[]).map(k=>k.name)),d.params&&Vi(d.params,f.keys.map(k=>k.name))),g=f.stringify(p)}else if(d.path!=null)g=d.path,f=s.find(k=>k.re.test(g)),f&&(p=f.parse(g),m=f.record.name);else{if(f=h.name?n.get(h.name):s.find(k=>k.re.test(h.path)),!f)throw zt(1,{location:d,currentLocation:h});m=f.record.name,p=ae({},h.params,d.params),g=f.stringify(p)}const y=[];let v=f;for(;v;)y.unshift(v.record),v=v.parent;return{name:m,path:g,params:p,matched:y,meta:tc(y)}}t.forEach(d=>o(d));function u(){s.length=0,n.clear()}return{addRoute:o,resolve:c,removeRoute:a,clearRoutes:u,getRoutes:r,getRecordMatcher:i}}function Vi(t,e){const s={};for(const n of e)n in t&&(s[n]=t[n]);return s}function $i(t){const e={path:t.path,redirect:t.redirect,name:t.name,meta:t.meta||{},aliasOf:t.aliasOf,beforeEnter:t.beforeEnter,props:ec(t),children:t.children||[],instances:{},leaveGuards:new Set,updateGuards:new Set,enterCallbacks:{},components:"components"in t?t.components||null:t.component&&{default:t.component}};return Object.defineProperty(e,"mods",{value:{}}),e}function ec(t){const e={},s=t.props||!1;if("component"in t)e.default=s;else for(const n in t.components)e[n]=typeof s=="object"?s[n]:s;return e}function zi(t){for(;t;){if(t.record.aliasOf)return!0;t=t.parent}return!1}function tc(t){return t.reduce((e,s)=>ae(e,s.meta),{})}function Bi(t,e){const s={};for(const n in t)s[n]=n in e?e[n]:t[n];return s}function sc(t,e){let s=0,n=e.length;for(;s!==n;){const o=s+n>>1;Ma(t,e[o])<0?n=o:s=o+1}const i=nc(t);return i&&(n=e.lastIndexOf(i,n-1)),n}function nc(t){let e=t;for(;e=e.parent;)if(Aa(e)&&Ma(t,e)===0)return e}function Aa({record:t}){return!!(t.name||t.components&&Object.keys(t.components).length||t.redirect)}function ic(t){const e={};if(t===""||t==="?")return e;const n=(t[0]==="?"?t.slice(1):t).split("&");for(let i=0;i<n.length;++i){const o=n[i].replace(xa," "),a=o.indexOf("="),r=fs(a<0?o:o.slice(0,a)),l=a<0?null:fs(o.slice(a+1));if(r in e){let c=e[r];We(c)||(c=e[r]=[c]),c.push(l)}else e[r]=l}return e}function Ni(t){let e="";for(let s in t){const n=t[s];if(s=Sl(s),n==null){n!==void 0&&(e+=(e.length?"&":"")+s);continue}(We(n)?n.map(o=>o&&zn(o)):[n&&zn(n)]).forEach(o=>{o!==void 0&&(e+=(e.length?"&":"")+s,o!=null&&(e+="="+o))})}return e}function oc(t){const e={};for(const s in t){const n=t[s];n!==void 0&&(e[s]=We(n)?n.map(i=>i==null?null:""+i):n==null?n:""+n)}return e}const ac=Symbol(""),Ui=Symbol(""),an=Symbol(""),li=Symbol(""),Nn=Symbol("");function Gt(){let t=[];function e(n){return t.push(n),()=>{const i=t.indexOf(n);i>-1&&t.splice(i,1)}}function s(){t=[]}return{add:e,list:()=>t.slice(),reset:s}}function ut(t,e,s,n,i,o=a=>a()){const a=n&&(n.enterCallbacks[i]=n.enterCallbacks[i]||[]);return()=>new Promise((r,l)=>{const c=h=>{h===!1?l(zt(4,{from:s,to:e})):h instanceof Error?l(h):jl(h)?l(zt(2,{from:e,to:h})):(a&&n.enterCallbacks[i]===a&&typeof h=="function"&&a.push(h),r())},u=o(()=>t.call(n&&n.instances[i],e,s,c));let d=Promise.resolve(u);t.length<3&&(d=d.then(c)),d.catch(h=>l(h))})}function yn(t,e,s,n,i=o=>o()){const o=[];for(const a of t)for(const r in a.components){let l=a.components[r];if(!(e!=="beforeRouteEnter"&&!a.instances[r]))if(ba(l)){const u=(l.__vccOpts||l)[e];u&&o.push(ut(u,s,n,a,r,i))}else{let c=l();o.push(()=>c.then(u=>{if(!u)throw new Error(`Couldn't resolve component "${r}" at "${a.path}"`);const d=hl(u)?u.default:u;a.mods[r]=u,a.components[r]=d;const f=(d.__vccOpts||d)[e];return f&&ut(f,s,n,a,r,i)()}))}}return o}function Hi(t){const e=pt(an),s=pt(li),n=S(()=>{const l=I(t.to);return e.resolve(l)}),i=S(()=>{const{matched:l}=n.value,{length:c}=l,u=l[c-1],d=s.matched;if(!u||!d.length)return-1;const h=d.findIndex($t.bind(null,u));if(h>-1)return h;const f=ji(l[c-2]);return c>1&&ji(u)===f&&d[d.length-1].path!==f?d.findIndex($t.bind(null,l[c-2])):h}),o=S(()=>i.value>-1&&dc(s.params,n.value.params)),a=S(()=>i.value>-1&&i.value===s.matched.length-1&&Ca(s.params,n.value.params));function r(l={}){if(uc(l)){const c=e[I(t.replace)?"replace":"push"](I(t.to)).catch(is);return t.viewTransition&&typeof document<"u"&&"startViewTransition"in document&&document.startViewTransition(()=>c),c}return Promise.resolve()}return{route:n,href:S(()=>n.value.href),isActive:o,isExactActive:a,navigate:r}}function rc(t){return t.length===1?t[0]:t}const lc=nn({name:"RouterLink",compatConfig:{MODE:3},props:{to:{type:[String,Object],required:!0},replace:Boolean,activeClass:String,exactActiveClass:String,custom:Boolean,ariaCurrentValue:{type:String,default:"page"},viewTransition:Boolean},useLink:Hi,setup(t,{slots:e}){const s=ua(Hi(t)),{options:n}=pt(an),i=S(()=>({[Wi(t.activeClass,n.linkActiveClass,"router-link-active")]:s.isActive,[Wi(t.exactActiveClass,n.linkExactActiveClass,"router-link-exact-active")]:s.isExactActive}));return()=>{const o=e.default&&rc(e.default(s));return t.custom?o:hs("a",{"aria-current":s.isExactActive?t.ariaCurrentValue:null,href:s.href,onClick:s.navigate,class:i.value},o)}}}),cc=lc;function uc(t){if(!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)&&!t.defaultPrevented&&!(t.button!==void 0&&t.button!==0)){if(t.currentTarget&&t.currentTarget.getAttribute){const e=t.currentTarget.getAttribute("target");if(/\b_blank\b/i.test(e))return}return t.preventDefault&&t.preventDefault(),!0}}function dc(t,e){for(const s in e){const n=e[s],i=t[s];if(typeof n=="string"){if(n!==i)return!1}else if(!We(i)||i.length!==n.length||n.some((o,a)=>o!==i[a]))return!1}return!0}function ji(t){return t?t.aliasOf?t.aliasOf.path:t.path:""}const Wi=(t,e,s)=>t??e??s,hc=nn({name:"RouterView",inheritAttrs:!1,props:{name:{type:String,default:"default"},route:Object},compatConfig:{MODE:3},setup(t,{attrs:e,slots:s}){const n=pt(Nn),i=S(()=>t.route||n.value),o=pt(Ui,0),a=S(()=>{let c=I(o);const{matched:u}=i.value;let d;for(;(d=u[c])&&!d.components;)c++;return c}),r=S(()=>i.value.matched[a.value]);gn(Ui,S(()=>a.value+1)),gn(ac,r),gn(Nn,i);const l=se();return Me(()=>[l.value,r.value,t.name],([c,u,d],[h,f,p])=>{u&&(u.instances[d]=c,f&&f!==u&&c&&c===h&&(u.leaveGuards.size||(u.leaveGuards=f.leaveGuards),u.updateGuards.size||(u.updateGuards=f.updateGuards))),c&&u&&(!f||!$t(u,f)||!h)&&(u.enterCallbacks[d]||[]).forEach(g=>g(c))},{flush:"post"}),()=>{const c=i.value,u=t.name,d=r.value,h=d&&d.components[u];if(!h)return Gi(s.default,{Component:h,route:c});const f=d.props[u],p=f?f===!0?c.params:typeof f=="function"?f(c):f:null,m=hs(h,ae({},p,e,{onVnodeUnmounted:y=>{y.component.isUnmounted&&(d.instances[u]=null)},ref:l}));return Gi(s.default,{Component:m,route:c})||m}}});function Gi(t,e){if(!t)return null;const s=t(e);return s.length===1?s[0]:s}const fc=hc;function pc(t){const e=Jl(t.routes,t),s=t.parseQuery||ic,n=t.stringifyQuery||Ni,i=t.history,o=Gt(),a=Gt(),r=Gt(),l=ti(rt);let c=rt;Et&&t.scrollBehavior&&"scrollRestoration"in history&&(history.scrollRestoration="manual");const u=vn.bind(null,M=>""+M),d=vn.bind(null,Cl),h=vn.bind(null,fs);function f(M,V){let $,q;return Da(M)?($=e.getRecordMatcher(M),q=V):q=M,e.addRoute(q,$)}function p(M){const V=e.getRecordMatcher(M);V&&e.removeRoute(V)}function g(){return e.getRoutes().map(M=>M.record)}function m(M){return!!e.getRecordMatcher(M)}function y(M,V){if(V=ae({},V||l.value),typeof M=="string"){const K=bn(s,M,V.path),ve=e.resolve({path:K.path},V),Wt=i.createHref(K.fullPath);return ae(K,ve,{params:h(ve.params),hash:fs(K.hash),redirectedFrom:void 0,href:Wt})}let $;if(M.path!=null)$=ae({},M,{path:bn(s,M.path,V.path).path});else{const K=ae({},M.params);for(const ve in K)K[ve]==null&&delete K[ve];$=ae({},M,{params:d(K)}),V.params=d(V.params)}const q=e.resolve($,V),ue=M.hash||"";q.params=u(h(q.params));const _e=Rl(n,ae({},M,{hash:wl(ue),path:q.path})),te=i.createHref(_e);return ae({fullPath:_e,hash:ue,query:n===Ni?oc(M.query):M.query||{}},q,{redirectedFrom:void 0,href:te})}function v(M){return typeof M=="string"?bn(s,M,l.value.path):ae({},M)}function k(M,V){if(c!==M)return zt(8,{from:V,to:M})}function P(M){return R(M)}function C(M){return P(ae(v(M),{replace:!0}))}function O(M){const V=M.matched[M.matched.length-1];if(V&&V.redirect){const{redirect:$}=V;let q=typeof $=="function"?$(M):$;return typeof q=="string"&&(q=q.includes("?")||q.includes("#")?q=v(q):{path:q},q.params={}),ae({query:M.query,hash:M.hash,params:q.path!=null?{}:M.params},q)}}function R(M,V){const $=c=y(M),q=l.value,ue=M.state,_e=M.force,te=M.replace===!0,K=O($);if(K)return R(ae(v(K),{state:typeof K=="object"?ae({},ue,K.state):ue,force:_e,replace:te}),V||$);const ve=$;ve.redirectedFrom=V;let Wt;return!_e&&Ml(n,q,$)&&(Wt=zt(16,{to:ve,from:q}),Ze(q,q,!0,!1)),(Wt?Promise.resolve(Wt):j(ve,q)).catch(Te=>Je(Te)?Je(Te,2)?Te:Fe(Te):ye(Te,ve,q)).then(Te=>{if(Te){if(Je(Te,2))return R(ae({replace:te},v(Te.to),{state:typeof Te.to=="object"?ae({},ue,Te.to.state):ue,force:_e}),V||ve)}else Te=L(ve,q,!0,te,ue);return G(ve,q,Te),Te})}function E(M,V){const $=k(M,V);return $?Promise.reject($):Promise.resolve()}function z(M){const V=Ae.values().next().value;return V&&typeof V.runWithContext=="function"?V.runWithContext(M):M()}function j(M,V){let $;const[q,ue,_e]=gc(M,V);$=yn(q.reverse(),"beforeRouteLeave",M,V);for(const K of q)K.leaveGuards.forEach(ve=>{$.push(ut(ve,M,V))});const te=E.bind(null,M,V);return $.push(te),W($).then(()=>{$=[];for(const K of o.list())$.push(ut(K,M,V));return $.push(te),W($)}).then(()=>{$=yn(ue,"beforeRouteUpdate",M,V);for(const K of ue)K.updateGuards.forEach(ve=>{$.push(ut(ve,M,V))});return $.push(te),W($)}).then(()=>{$=[];for(const K of _e)if(K.beforeEnter)if(We(K.beforeEnter))for(const ve of K.beforeEnter)$.push(ut(ve,M,V));else $.push(ut(K.beforeEnter,M,V));return $.push(te),W($)}).then(()=>(M.matched.forEach(K=>K.enterCallbacks={}),$=yn(_e,"beforeRouteEnter",M,V,z),$.push(te),W($))).then(()=>{$=[];for(const K of a.list())$.push(ut(K,M,V));return $.push(te),W($)}).catch(K=>Je(K,8)?K:Promise.reject(K))}function G(M,V,$){r.list().forEach(q=>z(()=>q(M,V,$)))}function L(M,V,$,q,ue){const _e=k(M,V);if(_e)return _e;const te=V===rt,K=Et?history.state:{};$&&(q||te?i.replace(M.fullPath,ae({scroll:te&&K&&K.scroll},ue)):i.push(M.fullPath,ue)),l.value=M,Ze(M,V,$,te),Fe()}let F;function he(){F||(F=i.listen((M,V,$)=>{if(!qe.listening)return;const q=y(M),ue=O(q);if(ue){R(ae(ue,{replace:!0,force:!0}),q).catch(is);return}c=q;const _e=l.value;Et&&Vl(Ei(_e.fullPath,$.delta),on()),j(q,_e).catch(te=>Je(te,12)?te:Je(te,2)?(R(ae(v(te.to),{force:!0}),q).then(K=>{Je(K,20)&&!$.delta&&$.type===ps.pop&&i.go(-1,!1)}).catch(is),Promise.reject()):($.delta&&i.go(-$.delta,!1),ye(te,q,_e))).then(te=>{te=te||L(q,_e,!1),te&&($.delta&&!Je(te,8)?i.go(-$.delta,!1):$.type===ps.pop&&Je(te,20)&&i.go(-1,!1)),G(q,_e,te)}).catch(is)}))}let Y=Gt(),Q=Gt(),Z;function ye(M,V,$){Fe(M);const q=Q.list();return q.length?q.forEach(ue=>ue(M,V,$)):console.error(M),Promise.reject(M)}function ce(){return Z&&l.value!==rt?Promise.resolve():new Promise((M,V)=>{Y.add([M,V])})}function Fe(M){return Z||(Z=!M,he(),Y.list().forEach(([V,$])=>M?$(M):V()),Y.reset()),M}function Ze(M,V,$,q){const{scrollBehavior:ue}=t;if(!Et||!ue)return Promise.resolve();const _e=!$&&$l(Ei(M.fullPath,0))||(q||!$)&&history.state&&history.state.scroll||null;return ca().then(()=>ue(M,V,_e)).then(te=>te&&Fl(te)).catch(te=>ye(te,M,V))}const $e=M=>i.go(M);let He;const Ae=new Set,qe={currentRoute:l,listening:!0,addRoute:f,removeRoute:p,clearRoutes:e.clearRoutes,hasRoute:m,getRoutes:g,resolve:y,options:t,push:P,replace:C,go:$e,back:()=>$e(-1),forward:()=>$e(1),beforeEach:o.add,beforeResolve:a.add,afterEach:r.add,onError:Q.add,isReady:ce,install(M){const V=this;M.component("RouterLink",cc),M.component("RouterView",fc),M.config.globalProperties.$router=V,Object.defineProperty(M.config.globalProperties,"$route",{enumerable:!0,get:()=>I(l)}),Et&&!He&&l.value===rt&&(He=!0,P(i.location).catch(ue=>{}));const $={};for(const ue in rt)Object.defineProperty($,ue,{get:()=>l.value[ue],enumerable:!0});M.provide(an,V),M.provide(li,Vr($)),M.provide(Nn,l);const q=M.unmount;Ae.add(M),M.unmount=function(){Ae.delete(M),Ae.size<1&&(c=rt,F&&F(),F=null,l.value=rt,He=!1,Z=!1),q()}}};function W(M){return M.reduce((V,$)=>V.then(()=>z($)),Promise.resolve())}return qe}function gc(t,e){const s=[],n=[],i=[],o=Math.max(e.matched.length,t.matched.length);for(let a=0;a<o;a++){const r=e.matched[a];r&&(t.matched.find(c=>$t(c,r))?n.push(r):s.push(r));const l=t.matched[a];l&&(e.matched.find(c=>$t(c,l))||i.push(l))}return[s,n,i]}function rn(){return pt(an)}function Ve(t){return pt(li)}/*!5 */const Et=typeof document<"u";function ba(t){return typeof t=="object"||"displayName"in t||"props"in t||"__vccOpts"in t}function hl(t){return t.__esModule||t[Symbol.toStringTag]==="Module"||t.default&&ba(t.default)}const ae=Object.assign;function vn(t,e){const s={};for(const n in e){const i=e[n];s[n]=We(i)?i.map(t):t(i)}return s}const is=()=>{},We=Array.isArray,ya=/#/g,fl=/&/g,pl=/\//g,gl=/=/g,ml=/\?/g,xa=/\+/g,_l=/%5B/g,vl=/%5D/g,wa=/%5E/g,bl=/%60/g,Sa=/%7B/g,yl=/%7C/g,ka=/%7D/g,xl=/%20/g;function ri(t){return encodeURI(""+t).replace(yl,"|").replace(_l,"[").replace(vl,"]")}function wl(t){return ri(t).replace(Sa,"{").replace(ka,"}").replace(wa,"^")}function zn(t){return ri(t).replace(xa,"%2B").replace(xl,"+").replace(ya,"%23").replace(fl,"%26").replace(bl,"`").replace(Sa,"{").replace(ka,"}").replace(wa,"^")}function Sl(t){return zn(t).replace(gl,"%3D")}function kl(t){return ri(t).replace(ya,"%23").replace(ml,"%3F")}function Cl(t){return t==null?"":kl(t).replace(pl,"%2F")}function fs(t){try{return decodeURIComponent(""+t)}catch{}return""+t}const Pl=/\/$/,Dl=t=>t.replace(Pl,"");function bn(t,e,s="/"){let n,i={},o="",a="";const r=e.indexOf("#");let l=e.indexOf("?");return r<l&&r>=0&&(l=-1),l>-1&&(n=e.slice(0,l),o=e.slice(l+1,r>-1?r:e.length),i=t(o)),r>-1&&(n=n||e.slice(0,r),a=e.slice(r,e.length)),n=Tl(n??e,s),{fullPath:n+(o&&"?")+o+a,path:n,query:i,hash:fs(a)}}function Rl(t,e){const s=e.query?t(e.query):"";return e.path+(s&&"?")+s+(e.hash||"")}function Ai(t,e){return!e||!t.toLowerCase().startsWith(e.toLowerCase())?t:t.slice(e.length)||"/"}function Ml(t,e,s){const n=e.matched.length-1,i=s.matched.length-1;return n>-1&&n===i&&$t(e.matched[n],s.matched[i])&&Ca(e.params,s.params)&&t(e.query)===t(s.query)&&e.hash===s.hash}function $t(t,e){return(t.aliasOf||t)===(e.aliasOf||e)}function Ca(t,e){if(Object.keys(t).length!==Object.keys(e).length)return!1;for(const s in t)if(!Al(t[s],e[s]))return!1;return!0}function Al(t,e){return We(t)?Ti(t,e):We(e)?Ti(e,t):t===e}function Ti(t,e){return We(e)?t.length===e.length&&t.every((s,n)=>s===e[n]):t.length===1&&t[0]===e}function Tl(t,e){if(t.startsWith("/"))return t;if(!t)return e;const s=e.split("/"),n=t.split("/"),i=n[n.length-1];(i===".."||i===".")&&n.push("");let o=s.length-1,a,r;for(a=0;a<n.length;a++)if(r=n[a],r!==".")if(r==="..")o>1&&o--;else break;return s.slice(0,o).join("/")+"/"+n.slice(a).join("/")}const rt={path:"/",name:void 0,params:{},query:{},hash:"",fullPath:"/",matched:[],meta:{},redirectedFrom:void 0};var ps;(function(t){t.pop="pop",t.push="push"})(ps||(ps={}));var os;(function(t){t.back="back",t.forward="forward",t.unknown=""})(os||(os={}));function El(t){if(!t)if(Et){const e=document.querySelector("base");t=e&&e.getAttribute("href")||"/",t=t.replace(/^\w+:\/\/[^\/]+/,"")}else t="/";return t[0]!=="/"&&t[0]!=="#"&&(t="/"+t),Dl(t)}const Ll=/^[^#]+#/;function Ol(t,e){return t.replace(Ll,"#")+e}function Il(t,e){const s=document.documentElement.getBoundingClientRect(),n=t.getBoundingClientRect();return{behavior:e.behavior,left:n.left-s.left-(e.left||0),top:n.top-s.top-(e.top||0)}}const on=()=>({left:window.scrollX,top:window.scrollY});function Fl(t){let e;if("el"in t){const s=t.el,n=typeof s=="string"&&s.startsWith("#"),i=typeof s=="string"?n?document.getElementById(s.slice(1)):document.querySelector(s):s;if(!i)return;e=Il(i,t)}else e=t;"scrollBehavior"in document.documentElement.style?window.scrollTo(e):window.scrollTo(e.left!=null?e.left:window.scrollX,e.top!=null?e.top:window.scrollY)}function Ei(t,e){return(history.state?history.state.position-e:-1)+t}const Bn=new Map;function Vl(t,e){Bn.set(t,e)}function $l(t){const e=Bn.get(t);return Bn.delete(t),e}let zl=()=>location.protocol+"//"+location.host;function Pa(t,e){const{pathname:s,search:n,hash:i}=e,o=t.indexOf("#");if(o>-1){let r=i.includes(t.slice(o))?t.slice(o).length:1,l=i.slice(r);return l[0]!=="/"&&(l="/"+l),Ai(l,"")}return Ai(s,t)+n+i}function Bl(t,e,s,n){let i=[],o=[],a=null;const r=({state:h})=>{const f=Pa(t,location),p=s.value,g=e.value;let m=0;if(h){if(s.value=f,e.value=h,a&&a===p){a=null;return}m=g?h.position-g.position:0}else n(f);i.forEach(y=>{y(s.value,p,{delta:m,type:ps.pop,direction:m?m>0?os.forward:os.back:os.unknown})})};function l(){a=s.value}function c(h){i.push(h);const f=()=>{const p=i.indexOf(h);p>-1&&i.splice(p,1)};return o.push(f),f}function u(){const{history:h}=window;h.state&&h.replaceState(ae({},h.state,{scroll:on()}),"")}function d(){for(const h of o)h();o=[],window.removeEventListener("popstate",r),window.removeEventListener("beforeunload",u)}return window.addEventListener("popstate",r),window.addEventListener("beforeunload",u,{passive:!0}),{pauseListeners:l,listen:c,destroy:d}}function Li(t,e,s,n=!1,i=!1){return{back:t,current:e,forward:s,replaced:n,position:window.history.length,scroll:i?on():null}}function Nl(t){const{history:e,location:s}=window,n={value:Pa(t,s)},i={value:e.state};i.value||o(n.value,{back:null,current:n.value,forward:null,position:e.length-1,replaced:!0,scroll:null},!0);function o(l,c,u){const d=t.indexOf("#"),h=d>-1?(s.host&&document.querySelector("base")?t:t.slice(d))+l:zl()+t+l;try{e[u?"replaceState":"pushState"](c,"",h),i.value=c}catch(f){console.error(f),s[u?"replace":"assign"](h)}}function a(l,c){const u=ae({},e.state,Li(i.value.back,l,i.value.forward,!0),c,{position:i.value.position});o(l,u,!0),n.value=l}function r(l,c){const u=ae({},i.value,e.state,{forward:l,scroll:on()});o(u.current,u,!0);const d=ae({},Li(n.value,l,null),{position:u.position+1},c);o(l,d,!1),n.value=l}return{location:n,state:i,push:r,replace:a}}function Ul(t){t=El(t);const e=Nl(t),s=Bl(t,e.state,e.location,e.replace);function n(o,a=!0){a||s.pauseListeners(),history.go(o)}const i=ae({location:"",base:t,go:n,createHref:Ol.bind(null,t)},e,s);return Object.defineProperty(i,"location",{enumerable:!0,get:()=>e.location.value}),Object.defineProperty(i,"state",{enumerable:!0,get:()=>e.state.value}),i}function Hl(t){return t=location.host?t||location.pathname+location.search:"",t.includes("#")||(t+="#"),Ul(t)}function jl(t){return typeof t=="string"||t&&typeof t=="object"}function Da(t){return typeof t=="string"||typeof t=="symbol"}const Ra=Symbol("");var Oi;(function(t){t[t.aborted=4]="aborted",t[t.cancelled=8]="cancelled",t[t.duplicated=16]="duplicated"})(Oi||(Oi={}));function zt(t,e){return ae(new Error,{type:t,[Ra]:!0},e)}function Je(t,e){return t instanceof Error&&Ra in t&&(e==null||!!(t.type&e))}const Ii="[^/]+?",Wl={sensitive:!1,strict:!1,start:!0,end:!0},Gl=/[.+*?^${}()[\]/\\]/g;function ql(t,e){const s=ae({},Wl,e),n=[];let i=s.start?"^":"";const o=[];for(const c of t){const u=c.length?[]:[90];s.strict&&!c.length&&(i+="/");for(let d=0;d<c.length;d++){const h=c[d];let f=40+(s.sensitive?.25:0);if(h.type===0)d||(i+="/"),i+=h.value.replace(Gl,"\\$&"),f+=40;else if(h.type===1){const{value:p,repeatable:g,optional:m,regexp:y}=h;o.push({name:p,repeatable:g,optional:m});const b=y||Ii;if(b!==Ii){f+=10;try{new RegExp(`(${b})`)}catch(P){throw new Error(`Invalid custom RegExp for param "${p}" (${b}): `+P.message)}}let k=g?`((?:${b})(?:/(?:${b}))*)`:`(${b})`;d||(k=m&&c.length<2?`(?:/${k})`:"/"+k),m&&(k+="?"),i+=k,f+=20,m&&(f+=-8),g&&(f+=-20),b===".*"&&(f+=-50)}u.push(f)}n.push(u)}if(s.strict&&s.end){const c=n.length-1;n[c][n[c].length-1]+=.7000000000000001}s.strict||(i+="/?"),s.end?i+="$":s.strict&&!i.endsWith("/")&&(i+="(?:/|$)");const a=new RegExp(i,s.sensitive?"":"i");function r(c){const u=c.match(a),d={};if(!u)return null;for(let h=1;h<u.length;h++){const f=u[h]||"",p=o[h-1];d[p.name]=f&&p.repeatable?f.split("/"):f}return d}function l(c){let u="",d=!1;for(const h of t){(!d||!u.endsWith("/"))&&(u+="/"),d=!1;for(const f of h)if(f.type===0)u+=f.value;else if(f.type===1){const{value:p,repeatable:g,optional:m}=f,y=p in c?c[p]:"";if(We(y)&&!g)throw new Error(`Provided param "${p}" is an array but it is not repeatable (* or + modifiers)`);const b=We(y)?y.join("/"):y;if(!b)if(m)h.length<2&&(u.endsWith("/")?u=u.slice(0,-1):d=!0);else throw new Error(`Missing required param "${p}"`);u+=b}}return u||"/"}return{re:a,score:n,keys:o,parse:r,stringify:l}}function Yl(t,e){let s=0;for(;s<t.length&&s<e.length;){const n=e[s]-t[s];if(n)return n;s++}return t.length<e.length?t.length===1&&t[0]===80?-1:1:t.length>e.length?e.length===1&&e[0]===80?1:-1:0}function Ma(t,e){let s=0;const n=t.score,i=e.score;for(;s<n.length&&s<i.length;){const o=Yl(n[s],i[s]);if(o)return o;s++}if(Math.abs(i.length-n.length)===1){if(Fi(n))return 1;if(Fi(i))return-1}return i.length-n.length}function Fi(t){const e=t[t.length-1];return t.length>0&&e[e.length-1]<0}const Xl={type:0,value:""},Kl=/[a-zA-Z0-9_]/;function Ql(t){if(!t)return[[]];if(t==="/")return[[Xl]];if(!t.startsWith("/"))throw new Error(`Invalid path "${t}"`);function e(f){throw new Error(`ERR (${s})/"${c}": ${f}`)}let s=0,n=s;const i=[];let o;function a(){o&&i.push(o),o=[]}let r=0,l,c="",u="";function d(){c&&(s===0?o.push({type:0,value:c}):s===1||s===2||s===3?(o.length>1&&(l==="*"||l==="+")&&e(`A repeatable param (${c}) must be alone in its segment. eg: '/:ids+.`),o.push({type:1,value:c,regexp:u,repeatable:l==="*"||l==="+",optional:l==="*"||l==="?"})):e("Invalid state to consume buffer"),c="")}function h(){c+=l}for(;r<t.length;){if(l=t[r++],l==="\\"&&s!==2){n=s,s=4;continue}switch(s){case 0:l==="/"?(c&&d(),a()):l===":"?(d(),s=1):h();break;case 4:h(),s=n;break;case 1:l==="("?s=2:Kl.test(l)?h():(d(),s=0,l!=="*"&&l!=="?"&&l!=="+"&&r--);break;case 2:l===")"?u[u.length-1]=="\\"?u=u.slice(0,-1)+l:s=3:u+=l;break;case 3:d(),s=0,l!=="*"&&l!=="?"&&l!=="+"&&r--,u="";break;default:e("Unknown state");break}}return s===2&&e(`Unfinished custom RegExp for param "${c}"`),d(),a(),i}function Zl(t,e,s){const n=ql(Ql(t.path),s),i=ae(n,{record:t,parent:e,children:[],alias:[]});return e&&!i.record.aliasOf==!e.record.aliasOf&&e.children.push(i),i}function Jl(t,e){const s=[],n=new Map;e=Bi({strict:!1,end:!0,sensitive:!1},e);function i(d){return n.get(d)}function o(d,h,f){const p=!f,g=$i(d);g.aliasOf=f&&f.record;const m=Bi(e,d),y=[g];if("alias"in d){const P=typeof d.alias=="string"?[d.alias]:d.alias;for(const C of P)y.push($i(ae({},g,{components:f?f.record.components:g.components,path:C,aliasOf:f?f.record:g})))}let b,k;for(const P of y){const{path:C}=P;if(h&&C[0]!=="/"){const O=h.record.path,R=O[O.length-1]==="/"?"":"/";P.path=h.record.path+(C&&R+C)}if(b=Zl(P,h,m),f?f.alias.push(b):(k=k||b,k!==b&&k.alias.push(b),p&&d.name&&!zi(b)&&a(d.name)),Aa(b)&&l(b),g.children){const O=g.children;for(let R=0;R<O.length;R++)o(O[R],b,f&&f.children[R])}f=f||b}return k?()=>{a(k)}:is}function a(d){if(Da(d)){const h=n.get(d);h&&(n.delete(d),s.splice(s.indexOf(h),1),h.children.forEach(a),h.alias.forEach(a))}else{const h=s.indexOf(d);h>-1&&(s.splice(h,1),d.record.name&&n.delete(d.record.name),d.children.forEach(a),d.alias.forEach(a))}}function r(){return s}function l(d){const h=sc(d,s);s.splice(h,0,d),d.record.name&&!zi(d)&&n.set(d.record.name,d)}function c(d,h){let f,p={},g,m;if("name"in d&&d.name){if(f=n.get(d.name),!f)throw zt(1,{location:d});m=f.record.name,p=ae(Vi(h.params,f.keys.filter(k=>!k.optional).concat(f.parent?f.parent.keys.filter(k=>k.optional):[]).map(k=>k.name)),d.params&&Vi(d.params,f.keys.map(k=>k.name))),g=f.stringify(p)}else if(d.path!=null)g=d.path,f=s.find(k=>k.re.test(g)),f&&(p=f.parse(g),m=f.record.name);else{if(f=h.name?n.get(h.name):s.find(k=>k.re.test(h.path)),!f)throw zt(1,{location:d,currentLocation:h});m=f.record.name,p=ae({},h.params,d.params),g=f.stringify(p)}const y=[];let b=f;for(;b;)y.unshift(b.record),b=b.parent;return{name:m,path:g,params:p,matched:y,meta:tc(y)}}t.forEach(d=>o(d));function u(){s.length=0,n.clear()}return{addRoute:o,resolve:c,removeRoute:a,clearRoutes:u,getRoutes:r,getRecordMatcher:i}}function Vi(t,e){const s={};for(const n of e)n in t&&(s[n]=t[n]);return s}function $i(t){const e={path:t.path,redirect:t.redirect,name:t.name,meta:t.meta||{},aliasOf:t.aliasOf,beforeEnter:t.beforeEnter,props:ec(t),children:t.children||[],instances:{},leaveGuards:new Set,updateGuards:new Set,enterCallbacks:{},components:"components"in t?t.components||null:t.component&&{default:t.component}};return Object.defineProperty(e,"mods",{value:{}}),e}function ec(t){const e={},s=t.props||!1;if("component"in t)e.default=s;else for(const n in t.components)e[n]=typeof s=="object"?s[n]:s;return e}function zi(t){for(;t;){if(t.record.aliasOf)return!0;t=t.parent}return!1}function tc(t){return t.reduce((e,s)=>ae(e,s.meta),{})}function Bi(t,e){const s={};for(const n in t)s[n]=n in e?e[n]:t[n];return s}function sc(t,e){let s=0,n=e.length;for(;s!==n;){const o=s+n>>1;Ma(t,e[o])<0?n=o:s=o+1}const i=nc(t);return i&&(n=e.lastIndexOf(i,n-1)),n}function nc(t){let e=t;for(;e=e.parent;)if(Aa(e)&&Ma(t,e)===0)return e}function Aa({record:t}){return!!(t.name||t.components&&Object.keys(t.components).length||t.redirect)}function ic(t){const e={};if(t===""||t==="?")return e;const n=(t[0]==="?"?t.slice(1):t).split("&");for(let i=0;i<n.length;++i){const o=n[i].replace(xa," "),a=o.indexOf("="),r=fs(a<0?o:o.slice(0,a)),l=a<0?null:fs(o.slice(a+1));if(r in e){let c=e[r];We(c)||(c=e[r]=[c]),c.push(l)}else e[r]=l}return e}function Ni(t){let e="";for(let s in t){const n=t[s];if(s=Sl(s),n==null){n!==void 0&&(e+=(e.length?"&":"")+s);continue}(We(n)?n.map(o=>o&&zn(o)):[n&&zn(n)]).forEach(o=>{o!==void 0&&(e+=(e.length?"&":"")+s,o!=null&&(e+="="+o))})}return e}function oc(t){const e={};for(const s in t){const n=t[s];n!==void 0&&(e[s]=We(n)?n.map(i=>i==null?null:""+i):n==null?n:""+n)}return e}const ac=Symbol(""),Ui=Symbol(""),an=Symbol(""),li=Symbol(""),Nn=Symbol("");function Gt(){let t=[];function e(n){return t.push(n),()=>{const i=t.indexOf(n);i>-1&&t.splice(i,1)}}function s(){t=[]}return{add:e,list:()=>t.slice(),reset:s}}function ut(t,e,s,n,i,o=a=>a()){const a=n&&(n.enterCallbacks[i]=n.enterCallbacks[i]||[]);return()=>new Promise((r,l)=>{const c=h=>{h===!1?l(zt(4,{from:s,to:e})):h instanceof Error?l(h):jl(h)?l(zt(2,{from:e,to:h})):(a&&n.enterCallbacks[i]===a&&typeof h=="function"&&a.push(h),r())},u=o(()=>t.call(n&&n.instances[i],e,s,c));let d=Promise.resolve(u);t.length<3&&(d=d.then(c)),d.catch(h=>l(h))})}function yn(t,e,s,n,i=o=>o()){const o=[];for(const a of t)for(const r in a.components){let l=a.components[r];if(!(e!=="beforeRouteEnter"&&!a.instances[r]))if(ba(l)){const u=(l.__vccOpts||l)[e];u&&o.push(ut(u,s,n,a,r,i))}else{let c=l();o.push(()=>c.then(u=>{if(!u)throw new Error(`Couldn't resolve component "${r}" at "${a.path}"`);const d=hl(u)?u.default:u;a.mods[r]=u,a.components[r]=d;const f=(d.__vccOpts||d)[e];return f&&ut(f,s,n,a,r,i)()}))}}return o}function Hi(t){const e=pt(an),s=pt(li),n=S(()=>{const l=I(t.to);return e.resolve(l)}),i=S(()=>{const{matched:l}=n.value,{length:c}=l,u=l[c-1],d=s.matched;if(!u||!d.length)return-1;const h=d.findIndex($t.bind(null,u));if(h>-1)return h;const f=ji(l[c-2]);return c>1&&ji(u)===f&&d[d.length-1].path!==f?d.findIndex($t.bind(null,l[c-2])):h}),o=S(()=>i.value>-1&&dc(s.params,n.value.params)),a=S(()=>i.value>-1&&i.value===s.matched.length-1&&Ca(s.params,n.value.params));function r(l={}){if(uc(l)){const c=e[I(t.replace)?"replace":"push"](I(t.to)).catch(is);return t.viewTransition&&typeof document<"u"&&"startViewTransition"in document&&document.startViewTransition(()=>c),c}return Promise.resolve()}return{route:n,href:S(()=>n.value.href),isActive:o,isExactActive:a,navigate:r}}function rc(t){return t.length===1?t[0]:t}const lc=nn({name:"RouterLink",compatConfig:{MODE:3},props:{to:{type:[String,Object],required:!0},replace:Boolean,activeClass:String,exactActiveClass:String,custom:Boolean,ariaCurrentValue:{type:String,default:"page"},viewTransition:Boolean},useLink:Hi,setup(t,{slots:e}){const s=ua(Hi(t)),{options:n}=pt(an),i=S(()=>({[Wi(t.activeClass,n.linkActiveClass,"router-link-active")]:s.isActive,[Wi(t.exactActiveClass,n.linkExactActiveClass,"router-link-exact-active")]:s.isExactActive}));return()=>{const o=e.default&&rc(e.default(s));return t.custom?o:hs("a",{"aria-current":s.isExactActive?t.ariaCurrentValue:null,href:s.href,onClick:s.navigate,class:i.value},o)}}}),cc=lc;function uc(t){if(!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)&&!t.defaultPrevented&&!(t.button!==void 0&&t.button!==0)){if(t.currentTarget&&t.currentTarget.getAttribute){const e=t.currentTarget.getAttribute("target");if(/\b_blank\b/i.test(e))return}return t.preventDefault&&t.preventDefault(),!0}}function dc(t,e){for(const s in e){const n=e[s],i=t[s];if(typeof n=="string"){if(n!==i)return!1}else if(!We(i)||i.length!==n.length||n.some((o,a)=>o!==i[a]))return!1}return!0}function ji(t){return t?t.aliasOf?t.aliasOf.path:t.path:""}const Wi=(t,e,s)=>t??e??s,hc=nn({name:"RouterView",inheritAttrs:!1,props:{name:{type:String,default:"default"},route:Object},compatConfig:{MODE:3},setup(t,{attrs:e,slots:s}){const n=pt(Nn),i=S(()=>t.route||n.value),o=pt(Ui,0),a=S(()=>{let c=I(o);const{matched:u}=i.value;let d;for(;(d=u[c])&&!d.components;)c++;return c}),r=S(()=>i.value.matched[a.value]);gn(Ui,S(()=>a.value+1)),gn(ac,r),gn(Nn,i);const l=se();return Me(()=>[l.value,r.value,t.name],([c,u,d],[h,f,p])=>{u&&(u.instances[d]=c,f&&f!==u&&c&&c===h&&(u.leaveGuards.size||(u.leaveGuards=f.leaveGuards),u.updateGuards.size||(u.updateGuards=f.updateGuards))),c&&u&&(!f||!$t(u,f)||!h)&&(u.enterCallbacks[d]||[]).forEach(g=>g(c))},{flush:"post"}),()=>{const c=i.value,u=t.name,d=r.value,h=d&&d.components[u];if(!h)return Gi(s.default,{Component:h,route:c});const f=d.props[u],p=f?f===!0?c.params:typeof f=="function"?f(c):f:null,m=hs(h,ae({},p,e,{onVnodeUnmounted:y=>{y.component.isUnmounted&&(d.instances[u]=null)},ref:l}));return Gi(s.default,{Component:m,route:c})||m}}});function Gi(t,e){if(!t)return null;const s=t(e);return s.length===1?s[0]:s}const fc=hc;function pc(t){const e=Jl(t.routes,t),s=t.parseQuery||ic,n=t.stringifyQuery||Ni,i=t.history,o=Gt(),a=Gt(),r=Gt(),l=ti(rt);let c=rt;Et&&t.scrollBehavior&&"scrollRestoration"in history&&(history.scrollRestoration="manual");const u=vn.bind(null,M=>""+M),d=vn.bind(null,Cl),h=vn.bind(null,fs);function f(M,V){let $,q;return Da(M)?($=e.getRecordMatcher(M),q=V):q=M,e.addRoute(q,$)}function p(M){const V=e.getRecordMatcher(M);V&&e.removeRoute(V)}function g(){return e.getRoutes().map(M=>M.record)}function m(M){return!!e.getRecordMatcher(M)}function y(M,V){if(V=ae({},V||l.value),typeof M=="string"){const K=bn(s,M,V.path),ve=e.resolve({path:K.path},V),Wt=i.createHref(K.fullPath);return ae(K,ve,{params:h(ve.params),hash:fs(K.hash),redirectedFrom:void 0,href:Wt})}let $;if(M.path!=null)$=ae({},M,{path:bn(s,M.path,V.path).path});else{const K=ae({},M.params);for(const ve in K)K[ve]==null&&delete K[ve];$=ae({},M,{params:d(K)}),V.params=d(V.params)}const q=e.resolve($,V),ue=M.hash||"";q.params=u(h(q.params));const _e=Rl(n,ae({},M,{hash:wl(ue),path:q.path})),te=i.createHref(_e);return ae({fullPath:_e,hash:ue,query:n===Ni?oc(M.query):M.query||{}},q,{redirectedFrom:void 0,href:te})}function b(M){return typeof M=="string"?bn(s,M,l.value.path):ae({},M)}function k(M,V){if(c!==M)return zt(8,{from:V,to:M})}function P(M){return R(M)}function C(M){return P(ae(b(M),{replace:!0}))}function O(M){const V=M.matched[M.matched.length-1];if(V&&V.redirect){const{redirect:$}=V;let q=typeof $=="function"?$(M):$;return typeof q=="string"&&(q=q.includes("?")||q.includes("#")?q=b(q):{path:q},q.params={}),ae({query:M.query,hash:M.hash,params:q.path!=null?{}:M.params},q)}}function R(M,V){const $=c=y(M),q=l.value,ue=M.state,_e=M.force,te=M.replace===!0,K=O($);if(K)return R(ae(b(K),{state:typeof K=="object"?ae({},ue,K.state):ue,force:_e,replace:te}),V||$);const ve=$;ve.redirectedFrom=V;let Wt;return!_e&&Ml(n,q,$)&&(Wt=zt(16,{to:ve,from:q}),Ze(q,q,!0,!1)),(Wt?Promise.resolve(Wt):j(ve,q)).catch(Te=>Je(Te)?Je(Te,2)?Te:Fe(Te):ye(Te,ve,q)).then(Te=>{if(Te){if(Je(Te,2))return R(ae({replace:te},b(Te.to),{state:typeof Te.to=="object"?ae({},ue,Te.to.state):ue,force:_e}),V||ve)}else Te=L(ve,q,!0,te,ue);return G(ve,q,Te),Te})}function E(M,V){const $=k(M,V);return $?Promise.reject($):Promise.resolve()}function z(M){const V=Ae.values().next().value;return V&&typeof V.runWithContext=="function"?V.runWithContext(M):M()}function j(M,V){let $;const[q,ue,_e]=gc(M,V);$=yn(q.reverse(),"beforeRouteLeave",M,V);for(const K of q)K.leaveGuards.forEach(ve=>{$.push(ut(ve,M,V))});const te=E.bind(null,M,V);return $.push(te),W($).then(()=>{$=[];for(const K of o.list())$.push(ut(K,M,V));return $.push(te),W($)}).then(()=>{$=yn(ue,"beforeRouteUpdate",M,V);for(const K of ue)K.updateGuards.forEach(ve=>{$.push(ut(ve,M,V))});return $.push(te),W($)}).then(()=>{$=[];for(const K of _e)if(K.beforeEnter)if(We(K.beforeEnter))for(const ve of K.beforeEnter)$.push(ut(ve,M,V));else $.push(ut(K.beforeEnter,M,V));return $.push(te),W($)}).then(()=>(M.matched.forEach(K=>K.enterCallbacks={}),$=yn(_e,"beforeRouteEnter",M,V,z),$.push(te),W($))).then(()=>{$=[];for(const K of a.list())$.push(ut(K,M,V));return $.push(te),W($)}).catch(K=>Je(K,8)?K:Promise.reject(K))}function G(M,V,$){r.list().forEach(q=>z(()=>q(M,V,$)))}function L(M,V,$,q,ue){const _e=k(M,V);if(_e)return _e;const te=V===rt,K=Et?history.state:{};$&&(q||te?i.replace(M.fullPath,ae({scroll:te&&K&&K.scroll},ue)):i.push(M.fullPath,ue)),l.value=M,Ze(M,V,$,te),Fe()}let F;function he(){F||(F=i.listen((M,V,$)=>{if(!qe.listening)return;const q=y(M),ue=O(q);if(ue){R(ae(ue,{replace:!0,force:!0}),q).catch(is);return}c=q;const _e=l.value;Et&&Vl(Ei(_e.fullPath,$.delta),on()),j(q,_e).catch(te=>Je(te,12)?te:Je(te,2)?(R(ae(b(te.to),{force:!0}),q).then(K=>{Je(K,20)&&!$.delta&&$.type===ps.pop&&i.go(-1,!1)}).catch(is),Promise.reject()):($.delta&&i.go(-$.delta,!1),ye(te,q,_e))).then(te=>{te=te||L(q,_e,!1),te&&($.delta&&!Je(te,8)?i.go(-$.delta,!1):$.type===ps.pop&&Je(te,20)&&i.go(-1,!1)),G(q,_e,te)}).catch(is)}))}let Y=Gt(),Q=Gt(),Z;function ye(M,V,$){Fe(M);const q=Q.list();return q.length?q.forEach(ue=>ue(M,V,$)):console.error(M),Promise.reject(M)}function ce(){return Z&&l.value!==rt?Promise.resolve():new Promise((M,V)=>{Y.add([M,V])})}function Fe(M){return Z||(Z=!M,he(),Y.list().forEach(([V,$])=>M?$(M):V()),Y.reset()),M}function Ze(M,V,$,q){const{scrollBehavior:ue}=t;if(!Et||!ue)return Promise.resolve();const _e=!$&&$l(Ei(M.fullPath,0))||(q||!$)&&history.state&&history.state.scroll||null;return ca().then(()=>ue(M,V,_e)).then(te=>te&&Fl(te)).catch(te=>ye(te,M,V))}const $e=M=>i.go(M);let He;const Ae=new Set,qe={currentRoute:l,listening:!0,addRoute:f,removeRoute:p,clearRoutes:e.clearRoutes,hasRoute:m,getRoutes:g,resolve:y,options:t,push:P,replace:C,go:$e,back:()=>$e(-1),forward:()=>$e(1),beforeEach:o.add,beforeResolve:a.add,afterEach:r.add,onError:Q.add,isReady:ce,install(M){const V=this;M.component("RouterLink",cc),M.component("RouterView",fc),M.config.globalProperties.$router=V,Object.defineProperty(M.config.globalProperties,"$route",{enumerable:!0,get:()=>I(l)}),Et&&!He&&l.value===rt&&(He=!0,P(i.location).catch(ue=>{}));const $={};for(const ue in rt)Object.defineProperty($,ue,{get:()=>l.value[ue],enumerable:!0});M.provide(an,V),M.provide(li,Vr($)),M.provide(Nn,l);const q=M.unmount;Ae.add(M),M.unmount=function(){Ae.delete(M),Ae.size<1&&(c=rt,F&&F(),F=null,l.value=rt,He=!1,Z=!1),q()}}};function W(M){return M.reduce((V,$)=>V.then(()=>z($)),Promise.resolve())}return qe}function gc(t,e){const s=[],n=[],i=[],o=Math.max(e.matched.length,t.matched.length);for(let a=0;a<o;a++){const r=e.matched[a];r&&(t.matched.find(c=>$t(c,r))?n.push(r):s.push(r));const l=t.matched[a];l&&(e.matched.find(c=>$t(c,l))||i.push(l))}return[s,n,i]}function rn(){return pt(an)}function Ve(t){return pt(li)}/*! 6 6 * vuex v4.1.0 7 7 * (c) 2022 Evan You 8 8 * @license MIT 9 */var Ta="store";function X(t){return t===void 0&&(t=null),pt(t!==null?t:Ta)}function Ht(t,e){Object.keys(t).forEach(function(s){return e(t[s],s)})}function mc(t){return t!==null&&typeof t=="object"}function _c(t){return t&&typeof t.then=="function"}function vc(t,e){return function(){return t(e)}}function Ea(t,e,s){return e.indexOf(t)<0&&(s&&s.prepend?e.unshift(t):e.push(t)),function(){var n=e.indexOf(t);n>-1&&e.splice(n,1)}}function La(t,e){t._actions=Object.create(null),t._mutations=Object.create(null),t._wrappedGetters=Object.create(null),t._modulesNamespaceMap=Object.create(null);var s=t.state;ln(t,s,[],t._modules.root,!0),ci(t,s,e)}function ci(t,e,s){var n=t._state,i=t._scope;t.getters={},t._makeLocalGettersCache=Object.create(null);var o=t._wrappedGetters,a={},r={},l=$r(!0);l.run(function(){Ht(o,function(c,u){a[u]=vc(c,t),r[u]=S(function(){return a[u]()}),Object.defineProperty(t.getters,u,{get:function(){return r[u].value},enumerable:!0})})}),t._state=ua({data:e}),t._scope=l,t.strict&&Sc(t),n&&s&&t._withCommit(function(){n.data=null}),i&&i.stop()}function ln(t,e,s,n,i){var o=!s.length,a=t._modules.getNamespace(s);if(n.namespaced&&(t._modulesNamespaceMap[a],t._modulesNamespaceMap[a]=n),!o&&!i){var r=ui(e,s.slice(0,-1)),l=s[s.length-1];t._withCommit(function(){r[l]=n.state})}var c=n.context=bc(t,a,s);n.forEachMutation(function(u,d){var h=a+d;yc(t,h,u,c)}),n.forEachAction(function(u,d){var h=u.root?d:a+d,f=u.handler||u;xc(t,h,f,c)}),n.forEachGetter(function(u,d){var h=a+d;wc(t,h,u,c)}),n.forEachChild(function(u,d){ln(t,e,s.concat(d),u,i)})}function bc(t,e,s){var n=e==="",i={dispatch:n?t.dispatch:function(o,a,r){var l=Gs(o,a,r),c=l.payload,u=l.options,d=l.type;return(!u||!u.root)&&(d=e+d),t.dispatch(d,c)},commit:n?t.commit:function(o,a,r){var l=Gs(o,a,r),c=l.payload,u=l.options,d=l.type;(!u||!u.root)&&(d=e+d),t.commit(d,c,u)}};return Object.defineProperties(i,{getters:{get:n?function(){return t.getters}:function(){return Oa(t,e)}},state:{get:function(){return ui(t.state,s)}}}),i}function Oa(t,e){if(!t._makeLocalGettersCache[e]){var s={},n=e.length;Object.keys(t.getters).forEach(function(i){if(i.slice(0,n)===e){var o=i.slice(n);Object.defineProperty(s,o,{get:function(){return t.getters[i]},enumerable:!0})}}),t._makeLocalGettersCache[e]=s}return t._makeLocalGettersCache[e]}function yc(t,e,s,n){var i=t._mutations[e]||(t._mutations[e]=[]);i.push(function(a){s.call(t,n.state,a)})}function xc(t,e,s,n){var i=t._actions[e]||(t._actions[e]=[]);i.push(function(a){var r=s.call(t,{dispatch:n.dispatch,commit:n.commit,getters:n.getters,state:n.state,rootGetters:t.getters,rootState:t.state},a);return _c(r)||(r=Promise.resolve(r)),t._devtoolHook?r.catch(function(l){throw t._devtoolHook.emit("vuex:error",l),l}):r})}function wc(t,e,s,n){t._wrappedGetters[e]||(t._wrappedGetters[e]=function(o){return s(n.state,n.getters,o.state,o.getters)})}function Sc(t){Me(function(){return t._state.data},function(){},{deep:!0,flush:"sync"})}function ui(t,e){return e.reduce(function(s,n){return s[n]},t)}function Gs(t,e,s){return mc(t)&&t.type&&(s=e,e=t,t=t.type),{type:t,payload:e,options:s}}var kc="vuex bindings",qi="vuex:mutations",xn="vuex:actions",Dt="vuex",Cc=0;function Pc(t,e){dl({id:"org.vuejs.vuex",app:t,label:"Vuex",homepage:"https://next.vuex.vuejs.org/",logo:"https://vuejs.org/images/icons/favicon-96x96.png",packageName:"vuex",componentStateTypes:[kc]},function(s){s.addTimelineLayer({id:qi,label:"Vuex Mutations",color:Yi}),s.addTimelineLayer({id:xn,label:"Vuex Actions",color:Yi}),s.addInspector({id:Dt,label:"Vuex",icon:"storage",treeFilterPlaceholder:"Filter stores..."}),s.on.getInspectorTree(function(n){if(n.app===t&&n.inspectorId===Dt)if(n.filter){var i=[];$a(i,e._modules.root,n.filter,""),n.rootNodes=i}else n.rootNodes=[Va(e._modules.root,"")]}),s.on.getInspectorState(function(n){if(n.app===t&&n.inspectorId===Dt){var i=n.nodeId;Oa(e,i),n.state=Mc(Tc(e._modules,i),i==="root"?e.getters:e._makeLocalGettersCache,i)}}),s.on.editInspectorState(function(n){if(n.app===t&&n.inspectorId===Dt){var i=n.nodeId,o=n.path;i!=="root"&&(o=i.split("/").filter(Boolean).concat(o)),e._withCommit(function(){n.set(e._state.data,o,n.state.value)})}}),e.subscribe(function(n,i){var o={};n.payload&&(o.payload=n.payload),o.state=i,s.notifyComponentUpdate(),s.sendInspectorTree(Dt),s.sendInspectorState(Dt),s.addTimelineEvent({layerId:qi,event:{time:Date.now(),title:n.type,data:o}})}),e.subscribeAction({before:function(n,i){var o={};n.payload&&(o.payload=n.payload),n._id=Cc++,n._time=Date.now(),o.state=i,s.addTimelineEvent({layerId:xn,event:{time:n._time,title:n.type,groupId:n._id,subtitle:"start",data:o}})},after:function(n,i){var o={},a=Date.now()-n._time;o.duration={_custom:{type:"duration",display:a+"ms",tooltip:"Action duration",value:a}},n.payload&&(o.payload=n.payload),o.state=i,s.addTimelineEvent({layerId:xn,event:{time:Date.now(),title:n.type,groupId:n._id,subtitle:"end",data:o}})}})})}var Yi=8702998,Dc=6710886,Rc=16777215,Ia={label:"namespaced",textColor:Rc,backgroundColor:Dc};function Fa(t){return t&&t!=="root"?t.split("/").slice(-2,-1)[0]:"Root"}function Va(t,e){return{id:e||"root",label:Fa(e),tags:t.namespaced?[Ia]:[],children:Object.keys(t._children).map(function(s){return Va(t._children[s],e+s+"/")})}}function $a(t,e,s,n){n.includes(s)&&t.push({id:n||"root",label:n.endsWith("/")?n.slice(0,n.length-1):n||"Root",tags:e.namespaced?[Ia]:[]}),Object.keys(e._children).forEach(function(i){$a(t,e._children[i],s,n+i+"/")})}function Mc(t,e,s){e=s==="root"?e:e[s];var n=Object.keys(e),i={state:Object.keys(t.state).map(function(a){return{key:a,editable:!0,value:t.state[a]}})};if(n.length){var o=Ac(e);i.getters=Object.keys(o).map(function(a){return{key:a.endsWith("/")?Fa(a):a,editable:!1,value:Un(function(){return o[a]})}})}return i}function Ac(t){var e={};return Object.keys(t).forEach(function(s){var n=s.split("/");if(n.length>1){var i=e,o=n.pop();n.forEach(function(a){i[a]||(i[a]={_custom:{value:{},display:a,tooltip:"Module",abstract:!0}}),i=i[a]._custom.value}),i[o]=Un(function(){return t[s]})}else e[s]=Un(function(){return t[s]})}),e}function Tc(t,e){var s=e.split("/").filter(function(n){return n});return s.reduce(function(n,i,o){var a=n[i];if(!a)throw new Error('Missing module "'+i+'" for path "'+e+'".');return o===s.length-1?a:a._children},e==="root"?t:t.root._children)}function Un(t){try{return t()}catch(e){return e}}var Ge=function(e,s){this.runtime=s,this._children=Object.create(null),this._rawModule=e;var n=e.state;this.state=(typeof n=="function"?n():n)||{}},za={namespaced:{configurable:!0}};za.namespaced.get=function(){return!!this._rawModule.namespaced};Ge.prototype.addChild=function(e,s){this._children[e]=s};Ge.prototype.removeChild=function(e){delete this._children[e]};Ge.prototype.getChild=function(e){return this._children[e]};Ge.prototype.hasChild=function(e){return e in this._children};Ge.prototype.update=function(e){this._rawModule.namespaced=e.namespaced,e.actions&&(this._rawModule.actions=e.actions),e.mutations&&(this._rawModule.mutations=e.mutations),e.getters&&(this._rawModule.getters=e.getters)};Ge.prototype.forEachChild=function(e){Ht(this._children,e)};Ge.prototype.forEachGetter=function(e){this._rawModule.getters&&Ht(this._rawModule.getters,e)};Ge.prototype.forEachAction=function(e){this._rawModule.actions&&Ht(this._rawModule.actions,e)};Ge.prototype.forEachMutation=function(e){this._rawModule.mutations&&Ht(this._rawModule.mutations,e)};Object.defineProperties(Ge.prototype,za);var kt=function(e){this.register([],e,!1)};kt.prototype.get=function(e){return e.reduce(function(s,n){return s.getChild(n)},this.root)};kt.prototype.getNamespace=function(e){var s=this.root;return e.reduce(function(n,i){return s=s.getChild(i),n+(s.namespaced?i+"/":"")},"")};kt.prototype.update=function(e){Ba([],this.root,e)};kt.prototype.register=function(e,s,n){var i=this;n===void 0&&(n=!0);var o=new Ge(s,n);if(e.length===0)this.root=o;else{var a=this.get(e.slice(0,-1));a.addChild(e[e.length-1],o)}s.modules&&Ht(s.modules,function(r,l){i.register(e.concat(l),r,n)})};kt.prototype.unregister=function(e){var s=this.get(e.slice(0,-1)),n=e[e.length-1],i=s.getChild(n);i&&i.runtime&&s.removeChild(n)};kt.prototype.isRegistered=function(e){var s=this.get(e.slice(0,-1)),n=e[e.length-1];return s?s.hasChild(n):!1};function Ba(t,e,s){if(e.update(s),s.modules)for(var n in s.modules){if(!e.getChild(n))return;Ba(t.concat(n),e.getChild(n),s.modules[n])}}function Ec(t){return new Ie(t)}var Ie=function(e){var s=this;e===void 0&&(e={});var n=e.plugins;n===void 0&&(n=[]);var i=e.strict;i===void 0&&(i=!1);var o=e.devtools;this._committing=!1,this._actions=Object.create(null),this._actionSubscribers=[],this._mutations=Object.create(null),this._wrappedGetters=Object.create(null),this._modules=new kt(e),this._modulesNamespaceMap=Object.create(null),this._subscribers=[],this._makeLocalGettersCache=Object.create(null),this._scope=null,this._devtools=o;var a=this,r=this,l=r.dispatch,c=r.commit;this.dispatch=function(h,f){return l.call(a,h,f)},this.commit=function(h,f,p){return c.call(a,h,f,p)},this.strict=i;var u=this._modules.root.state;ln(this,u,[],this._modules.root),ci(this,u),n.forEach(function(d){return d(s)})},di={state:{configurable:!0}};Ie.prototype.install=function(e,s){e.provide(s||Ta,this),e.config.globalProperties.$store=this;var n=this._devtools!==void 0?this._devtools:!1;n&&Pc(e,this)};di.state.get=function(){return this._state.data};di.state.set=function(t){};Ie.prototype.commit=function(e,s,n){var i=this,o=Gs(e,s,n),a=o.type,r=o.payload,l={type:a,payload:r},c=this._mutations[a];c&&(this._withCommit(function(){c.forEach(function(d){d(r)})}),this._subscribers.slice().forEach(function(u){return u(l,i.state)}))};Ie.prototype.dispatch=function(e,s){var n=this,i=Gs(e,s),o=i.type,a=i.payload,r={type:o,payload:a},l=this._actions[o];if(l){try{this._actionSubscribers.slice().filter(function(u){return u.before}).forEach(function(u){return u.before(r,n.state)})}catch{}var c=l.length>1?Promise.all(l.map(function(u){return u(a)})):l[0](a);return new Promise(function(u,d){c.then(function(h){try{n._actionSubscribers.filter(function(f){return f.after}).forEach(function(f){return f.after(r,n.state)})}catch{}u(h)},function(h){try{n._actionSubscribers.filter(function(f){return f.error}).forEach(function(f){return f.error(r,n.state,h)})}catch{}d(h)})})}};Ie.prototype.subscribe=function(e,s){return Ea(e,this._subscribers,s)};Ie.prototype.subscribeAction=function(e,s){var n=typeof e=="function"?{before:e}:e;return Ea(n,this._actionSubscribers,s)};Ie.prototype.watch=function(e,s,n){var i=this;return Me(function(){return e(i.state,i.getters)},s,Object.assign({},n))};Ie.prototype.replaceState=function(e){var s=this;this._withCommit(function(){s._state.data=e})};Ie.prototype.registerModule=function(e,s,n){n===void 0&&(n={}),typeof e=="string"&&(e=[e]),this._modules.register(e,s),ln(this,this.state,e,this._modules.get(e),n.preserveState),ci(this,this.state)};Ie.prototype.unregisterModule=function(e){var s=this;typeof e=="string"&&(e=[e]),this._modules.unregister(e),this._withCommit(function(){var n=ui(s.state,e.slice(0,-1));delete n[e[e.length-1]]}),La(this)};Ie.prototype.hasModule=function(e){return typeof e=="string"&&(e=[e]),this._modules.isRegistered(e)};Ie.prototype.hotUpdate=function(e){this._modules.update(e),La(this,!0)};Ie.prototype._withCommit=function(e){var s=this._committing;this._committing=!0,e(),this._committing=s};Object.defineProperties(Ie.prototype,di);const Lc={__name:"TextField",props:{fieldSchema:{type:Object,required:!0},modelValue:{required:!0},disabled:{type:Boolean,default:!1}},emits:["update:modelValue"],setup(t,{emit:e}){const s=t,n=e,i=S({get(){return s.modelValue},set(r){if(s.fieldSchema.type==="number"){let l=Number(r);if(l<0){const c=o.value??0,u=a.value??Number.MAX_SAFE_INTEGER;l=Math.min(Math.abs(l),u),l=Math.max(l,c),r=l.toString()}}n("update:modelValue",r)}}),o=S(()=>{var r;return((r=s.fieldSchema.attributes)==null?void 0:r.min)??void 0}),a=S(()=>{var r;return((r=s.fieldSchema.attributes)==null?void 0:r.max)??void 0});return(r,l)=>{const c=D("el-input");return x(),A(c,{modelValue:i.value,"onUpdate:modelValue":l[0]||(l[0]=u=>i.value=u),type:t.fieldSchema.type==="textarea"?"textarea":t.fieldSchema.type,min:o.value,max:a.value,placeholder:t.fieldSchema.placeholder,disabled:s.disabled},Ss({_:2},[t.fieldSchema.suffix?{name:"suffix",fn:w(()=>[B(H(t.fieldSchema.suffix),1)]),key:"0"}:void 0]),1032,["modelValue","type","min","max","placeholder","disabled"])}}},ne=(t,e)=>{const s=t.__vccOpts||t;for(const[n,i]of e)s[n]=i;return s},Oc={__name:"SelectField",props:{fieldSchema:{type:Object,required:!0},modelValue:{default:""}},emits:["update:modelValue"],setup(t,{emit:e}){var m;const s=X(),n=se(""),i=y=>{y||(n.value="")},o=t,a=e;!o.fieldSchema.is_pro&&!((m=o.fieldSchema.class)!=null&&m.includes("htga4-pro-field-opacity"))&&(o.fieldSchema.options==="roles"?s.dispatch("fetchRoles"):o.fieldSchema.options==="accounts"&&s.dispatch("fetchAccounts"));const r=S(()=>s.getters.getRoles),l=S(()=>s.getters.getAccounts),c=S(()=>s.getters.getProperties),u=S(()=>s.getters.getDataStreams),d=S(()=>s.getters.getMeasurementProtocolSecrets),h=S(()=>s.state.isLoading),f=S(()=>{if(!h.value)return!1;const y=o.fieldSchema.options;return y==="accounts"?Object.keys(l.value).length===0:y==="properties"?Object.keys(c.value).length===0&&s.state.settings.account:y==="data_streams"?Object.keys(u.value).length===0&&s.state.settings.property:y==="measurement_protocol_secrets"?Object.keys(d.value).length===0&&s.state.settings.data_stream_id:y==="roles"?Object.keys(r.value).length===0:!1}),p=S(()=>{if(!n.value)return l.value;const y=n.value.toLowerCase(), v={};for(const[k,P]of Object.entries(l.value))P.toLowerCase().includes(y)&&(v[k]=P);return v});Me(()=>o.modelValue,(y,v)=>{if(o.fieldSchema.options==="accounts"&&y){if(y===v)return;v&&(s.commit("updateSetting",{key:"property",value:""}),s.commit("updateSetting",{key:"data_stream_id",value:""})),s.dispatch("fetchProperties",{forceRefresh:!0})}}),Me(()=>o.modelValue,(y,v)=>{if(o.fieldSchema.options==="properties"&&y){if(y===v)return;v&&(s.commit("updateSetting",{key:"data_stream_id",value:""}),s.commit("updateSetting",{key:"measurement_id",value:""})),s.dispatch("fetchDataStreams",{forceRefresh:!0})}}),Me(()=>o.modelValue,(y,v)=>{if(o.fieldSchema.options==="data_streams"&&y){if(y===v)return;const k=s.state.settings;k.auth_google&&k.auth_google!==""&&(s.dispatch("fetchAndPopulateMeasurementId"),v&&s.commit("updateSetting",{key:"measurement_protocol_api_secret",value:""}),s.dispatch("fetchMeasurementProtocolSecrets",{forceRefresh:!0}))}});const g=S({get(){return o.modelValue},set(y){a("update:modelValue",y)}});return Ce(()=>{if(o.fieldSchema.options==="data_streams"&&o.modelValue){const y=s.state.settings,v=y.auth_google&&y.auth_google!=="",k=y.measurement_id||"";v&&!k&&s.dispatch("fetchAndPopulateMeasurementId")}}),(y,v)=>{const k=D("el-input"),P=D("el-option"),C=D("el-option-group"),O=D("el-select");return x(),A(O,{modelValue:g.value,"onUpdate:modelValue":v[3]||(v[3]=R=>g.value=R),placeholder:t.fieldSchema.placeholder||"Select an option",loading:f.value,multiple:t.fieldSchema.multiple||!1,"empty-values":[null,void 0],onVisibleChange:i},Ss({default:w(()=>[typeof t.fieldSchema.options=="object"?(x(!0),T(J,{key:0},le(t.fieldSchema.options,(R,E)=>(x(),T(J,{key:E},[typeof R=="string"?(x(),A(P,{key:0,label:R,value:E},null,8,["label","value"])):(x(),A(C,{key:1,label:E},{label:w(()=>[b("span",null,H(E),1)]),default:w(()=>[(x(!0),T(J,null,le(R,(z,j)=>(x(),A(P,{key:j,label:z,value:j},null,8,["label","value"]))),128))]),_:2},1032,["label"]))],64))),128)):U("",!0),t.fieldSchema.options==="roles"?(x(!0),T(J,{key:1},le(r.value,(R,E)=>(x(),A(P,{key:E,label:R,value:E},null,8,["label","value"]))),128)):U("",!0),t.fieldSchema.options==="accounts"?(x(!0),T(J,{key:2},le(p.value,(R,E)=>(x(),A(P,{key:E,label:R,value:E},null,8,["label","value"]))),128)):U("",!0),t.fieldSchema.options==="properties"?(x(!0),T(J,{key:3},le(c.value,(R,E)=>(x(),A(P,{key:E,label:R,value:E},null,8,["label","value"]))),128)):U("",!0),t.fieldSchema.options==="data_streams"?(x(!0),T(J,{key:4},le(u.value,(R,E)=>(x(),A(P,{key:E,label:R,value:E},null,8,["label","value"]))),128)):U("",!0),t.fieldSchema.options==="measurement_protocol_secrets"?(x(!0),T(J,{key:5},le(d.value,(R,E)=>(x(),A(P,{key:E,label:R,value:E},null,8,["label","value"]))),128)):U("",!0)]),_:2},[t.fieldSchema.searchable?{name:"header",fn:w(()=>[_(k,{modelValue:n.value,"onUpdate:modelValue":v[0]||(v[0]=R=>n.value=R),placeholder:"Type to search...",clearable:"",size:"small",class:"select-search-input",onClick:v[1]||(v[1]=dt(()=>{},["stop"])),onKeydown:v[2]||(v[2]=dt(()=>{},["stop"]))},null,8,["modelValue"])]),key:"0"}:void 0]),1032,["modelValue","placeholder","loading","multiple"])}}},Ic=ne(Oc,[["__scopeId","data-v-157b8ac0"]]),Fc={__name:"ColorField",props:{fieldSchema:{type:Object,required:!0},modelValue:{required:!0}},emits:["update:modelValue"],setup(t,{emit:e}){const s=t,n=e,i=a=>{if(!a){n("update:modelValue","");return}n("update:modelValue",a)},o=S({get(){return s.modelValue},set(a){n("update:modelValue",a)}});return(a,r)=>{const l=D("el-color-picker");return x(),A(l,{modelValue:o.value,"onUpdate:modelValue":r[0]||(r[0]=c=>o.value=c),"show-alpha":"",onActiveChange:i},null,8,["modelValue"])}}},Vc={__name:"CheckboxField",props:{fieldSchema:{type:Object,required:!0},modelValue:{required:!0}},emits:["update:modelValue"],setup(t,{emit:e}){const s=t,n=e,i=S({get(){return s.fieldSchema.options?Array.isArray(s.modelValue)?s.modelValue:s.modelValue?s.modelValue.split(","):[]:s.modelValue==="1"||s.modelValue===1},set(o){s.fieldSchema.options?n("update:modelValue",Array.isArray(o)?o.join(","):o):n("update:modelValue",o?"1":"0")}});return(o,a)=>{const r=D("el-checkbox"),l=D("el-checkbox-group");return t.fieldSchema.options?(x(),A(l,{key:0,modelValue:i.value,"onUpdate:modelValue":a[0]||(a[0]=c=>i.value=c)},{default:w(()=>[(x(!0),T(J,null,le(t.fieldSchema.options,(c,u)=>(x(),A(r,{key:u,label:u,size:"medium"},{default:w(()=>[B(H(c),1)]),_:2},1032,["label"]))),128))]),_:1},8,["modelValue"])):(x(),A(r,{key:1,size:"medium",modelValue:i.value,"onUpdate:modelValue":a[1]||(a[1]=c=>i.value=c),label:t.fieldSchema.label},null,8,["modelValue","label"]))}}},$c={__name:"SwitchField",props:{fieldSchema:{type:Object,required:!0},modelValue:{required:!0}},emits:["update:modelValue"],setup(t,{emit:e}){const s=t,n=e,i=S({get(){return Number(s.modelValue)},set(o){n("update:modelValue",String(o))}});return(o,a)=>{const r=D("el-switch");return x(),A(r,{modelValue:i.value,"onUpdate:modelValue":a[0]||(a[0]=l=>i.value=l),"inline-prompt":"","active-text":t.fieldSchema.label||"Yes","inactive-text":t.fieldSchema.label||"No","active-value":1,"inactive-value":0,"active-icon":I(si),"inactive-icon":I(zr)},null,8,["modelValue","active-text","inactive-text","active-icon","inactive-icon"])}}},zc={__name:"RadioField",props:{fieldSchema:{type:Object,required:!0},modelValue:{required:!0}},emits:["update:modelValue"],setup(t,{emit:e}){const s=t,n=e,i=S({get(){return s.modelValue},set(o){n("update:modelValue",o)}});return(o,a)=>{const r=D("el-radio"),l=D("el-radio-group");return x(),A(l,{modelValue:i.value,"onUpdate:modelValue":a[0]||(a[0]=c=>i.value=c)},{default:w(()=>[(x(!0),T(J,null,le(t.fieldSchema.options,(c,u)=>(x(),A(r,{key:u,value:u},{default:w(()=>[B(H(c),1)]),_:2},1032,["value"]))),128))]),_:1},8,["modelValue"])}}},Bc={class:"htga4-tabbed-field"},Nc={class:"tab-content"},Uc={__name:"TabbedField",props:{modelValue:{type:Object,default:()=>({})},fieldSchema:{type:Object,required:!0}},emits:["update:modelValue"],setup(t,{emit:e}){const s=t,n=e,i=se("0"),o=se({});return Me(()=>s.modelValue,a=>{o.value={...a}},{immediate:!0,deep:!0}),Me(o,a=>{n("update:modelValue",a)},{deep:!0}),(a,r)=>{const l=D("el-tab-pane"),c=D("el-tabs");return x(),T("div",Bc,[_(c,{modelValue:i.value,"onUpdate:modelValue":r[0]||(r[0]=u=>i.value=u)},{default:w(()=>[(x(!0),T(J,null,le(t.fieldSchema.tabs,(u,d)=>(x(),A(l,{key:d,name:d.toString()},{label:w(()=>[u.icon?(x(),T("i",{key:0,class:ie(u.icon)},null,2)):U("",!0),b("span",null,H(u.title),1)]),default:w(()=>[b("div",Nc,[(x(!0),T(J,null,le(u.fields,h=>(x(),A(we,{key:h.id,modelValue:o.value[h.id],"onUpdate:modelValue":f=>o.value[h.id]=f,fieldSchema:h},null,8,["modelValue","onUpdate:modelValue","fieldSchema"]))),128))])]),_:2},1032,["name"]))),128))]),_:1},8,["modelValue"])])}}},Hc={class:"htga4-editor-field"},jc={class:"htga4-editor-tabs"},Wc={class:"htga4-editor-container"},Gc=["value"],qc={__name:"EditorField",props:{fieldSchema:{type:Object,required:!0},modelValue:{required:!0}},emits:["update:modelValue"],setup(t,{emit:e}){const s={height:200,skin:"lightgray",theme:"modern",menubar:!1,statusbar:!1,branding:!1,plugins:"charmap colorpicker hr lists paste tabfocus textcolor fullscreen wordpress wpautoresize wpeditimage wpemoji wpgallery wplink wptextpattern",toolbar1:"formatselect bold italic bullist numlist blockquote alignleft aligncenter alignright link unlink wp_more wp_adv dfw",toolbar2:"strikethrough hr forecolor pastetext removeformat charmap outdent indent undo redo wp_help",force_br_newlines:!0,force_p_newlines:!1,forced_root_block:""},n=t,i=e,o=se(!1),a=se(null);let r=null;const l=S(()=>n.modelValue||""),c=()=>{if(o.value){const f=a.value.value.replace(/\n/g,"<br>");i("update:modelValue",f),o.value=!1,h()}},u=()=>{if(!o.value){const f=((r==null?void 0:r.getContent())||"").replace(/<br\s*\/?>/g,`10 `);r==null||r.destroy(),r=null,a.value.value=f,i("update:modelValue",f),o.value=!0}},d=f=>{i("update:modelValue",f.target.value)},h=()=>{if(!window.tinymce||!a.value||o.value)return;const p={...window.wp.editor.getDefaultSettings().tinymce,...s,target:a.value,setup:g=>{r=g,g.on("change",m=>{i("update:modelValue",g.getContent())}),g.on("init",()=>{var y;const m=((y=n.modelValue)==null?void 0:y.replace(/\n/g,"<br>"))||"";g.setContent(m)})}};window.tinymce.init(p)};return Me(()=>n.modelValue,f=>{if(r&&r.getContent()!==f){const p=f==null?void 0:f.replace(/\n/g,"<br>");r.setContent(p||"")}}),Ce(()=>{h()}),ni(()=>{r&&r.destroy()}),(f,p)=>(x(),T("div",Hc,[ b("div",jc,[b("button",{type:"button",class:ie(["htga4-editor-tab-btn",{active:!o.value}]),onClick:c}," Visual ",2),b("button",{type:"button",class:ie(["htga4-editor-tab-btn",{active:o.value}]),onClick:u}," Text ",2)]),b("div",Wc,[b("textarea",{ref_key:"editorRef",ref:a,value:l.value,class:"htga4-editor-height",style:ii({visibility:o.value?"visible":"hidden"}),onInput:d},null,44,Gc)])]))}},Yc=["innerHTML"],Xc={__name:"HelpTooltip",props:{content:{type:String,required:!0},useHtml:{type:Boolean,default:!0},placement:{type:String,default:"bottom-start"},effect:{type:String,default:"dark"},hideAfter:{type:Number,default:0},trigger:{type:String,default:"hover"},enterable:{type:Boolean,default:!1}},setup(t){return(e,s)=>{const n=D("el-icon"),i=D("el-tooltip");return x(),A(i,{placement:t.placement,content:t.useHtml?null:t.content,effect:t.effect,"hide-after":t.hideAfter,trigger:t.trigger,enterable:t.enterable},Ss({default:w(()=>[Ft(e.$slots,"default",{},()=>[_(n,{class:"tooltip-icon"},{default:w(()=>[_(I(da))]),_:1})],!0)]),_:2},[t.useHtml?{name:"content",fn:w(()=>[b("div",{innerHTML:t.content},null,8,Yc)]),key:"0"}:void 0]),1032,["placement","content","effect","hide-after","trigger","enterable"])}}},as=ne(Xc,[["__scopeId","data-v-3399916d"]]),Kc=["value"],Qc={key:0,class:"htga4-copy-to-clipboard__icon"},Zc={key:0,xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24"},Jc={key:1,xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24"},eu={class:"htga4-copy-to-clipboard__text"},tu={__name:"CopyToClipboard",props:{content:{type:String,required:!0},buttonText:{type:String,default:"Copy"},width:{type:String,default:"100%"},showIcon:{type:Boolean,default:!0}},setup(t){const e=t,s=se(!1),n=se(null),i=S(()=>({width:e.width})),{content:o}=e,a=()=>{navigator.clipboard.writeText(e.content).then(()=>{s.value=!0,setTimeout(()=>{s.value=!1},2e3)})},r=()=>{n.value&&n.value.select()};return(l,c)=>{const u=D("el-button");return x(),T("div",{class:"htga4-copy-to-clipboard",style:ii(i.value)},[b("input",{class:"htga4-copy-to-clipboard__content htga4-monospace",value:I(o),readonly:"",onClick:r,ref_key:"inputRef",ref:n},null,8,Kc),_(u,{class:"htga4-copy-to-clipboard__button",onClick:dt(a,["stop"]),type:s.value?"success":"primary",size:"medium"},{default:w(()=>[t.showIcon?(x(),T("span",Qc,[s.value?(x(),T("svg",Jc,c[1]||(c[1]=[b("path",{fill:"currentColor",d:"M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"},null,-1)]))):(x(),T("svg",Zc,c[0]||(c[0]=[b("path",{fill:"currentColor",d:"M20,2H10C8.9,2 8,2.9 8,4V8H4C2.9,8 2,8.9 2,10V20C2,21.1 2.9,22 4,22H14C15.1,22 16,21.1 16,20V16H20C21.1,16 22,15.1 22,14V4C22,2.9 21.1,2 20,2M14,20H4V10H14V20M20,14H16V10C16,8.9 15.1,8 14,8H10V4H20V14Z"},null,-1)])))])):U("",!0),b("span",eu,H(s.value?"Copied!":t.buttonText),1)]),_:1},8,["type"])],4)}}},su=ne(tu,[["__scopeId","data-v-263acba2"]]),nu={__name:"ClipboardField",props:{fieldSchema:{type:Object,required:!0},modelValue:{required:!0}},emits:["update:modelValue"],setup(t,{emit:e}){const s=t,n=e,i=S({get(){return s.modelValue},set(o){n("update:modelValue",o)}});return(o,a)=>(x(),A(su,{content:i.value,width:"320px"},null,8,["content"]))}},iu={class:"htga4-auth-button-field"},ou={class:"htga4-auth-button-wrapper"},au=["href"],ru=["href"],lu={__name:"AuthButton",props:{modelValue:{type:String,default:""},fieldSchema:{type:Object,required:!0}},setup(t){var a;const e=X(),s=S(()=>e.getters.isAuthenticated),n=S(()=>e.state.email),i=se(((a=window.htga4Settings)==null?void 0:a.loginUrl)||""),o=S(()=>{const r=window.location.href.split("#")[0];return r+(r.includes("?")?"&htga4_logout=yes":"?htga4_logout=yes")});return(r,l)=>{const c=D("el-form-item");return x(),T("div",iu,[_(c,null,{default:w(()=>[b("div",ou,[s.value?(x(),T("a",{key:1,class:"el-button el-button--large",href:o.value},H((t.fieldSchema.logout_text||"Logout (%s)").replace("%s",n.value)),9,ru)):(x(),T("a",{key:0,class:"htga4-google-button",href:i.value,target:"_blank"},H(t.fieldSchema.button_text||"Sign in with Google"),9,au))])]),_:1})])}}},cu=ne(lu,[["__scopeId","data-v-05b1270d"]]),uu=["value"],du={__name:"HiddenField",props:{modelValue:{required:!0},fieldSchema:{type:Object,required:!0}},emits:["update:modelValue"],setup(t){return(e,s)=>(x(),T("input",{type:"hidden",value:t.modelValue,onInput:s[0]||(s[0]=n=>e.$emit("update:modelValue",n.target.value))},null,40,uu))}},ks={__name:"InfoAlert",props:{type:{type:String,default:"info"},centered:{type:Boolean,default:!1}},setup(t){return(e,s)=>{const n=D("el-alert");return x(),A(n,{class:ie(["htga4-alert",`htga4-alert-${t.type}`,{"htga4-text-center":t.centered}]),closable:!1},{default:w(()=>[Ft(e.$slots,"default")]),_:3},8,["class"])}}},hu=["innerHTML"],fu={__name:"InfoField",props:{modelValue:{required:!0},fieldSchema:{type:Object,required:!0}},setup(t){return(e,s)=>(x(),A(ks,{type:t.fieldSchema.alert_type||"info",centered:t.fieldSchema.centered||!1},{default:w(()=>[b("div",{class:"htga4-info-field-content",innerHTML:t.fieldSchema.content},null,8,hu)]),_:1},8,["type","centered"]))}},pu=ne(fu,[["__scopeId","data-v-a454f23f"]]),gu={key:0,class:"htga4-woocommerce-requirement"},mu={__name:"WooCommerceRequirementField",props:{modelValue:{required:!0},fieldSchema:{type:Object,required:!0}},setup(t){const e=S(()=>window.htga4Settings&&window.htga4Settings.isWoocommerceInstalled==="1"),s=S(()=>window.htga4Settings&&window.htga4Settings.isWoocommerceActive==="1"),n=S(()=>!e.value||!s.value);return(i,o)=>n.value?(x(),T("div",gu,[_(ks,{type:"warning"},{default:w(()=>o[0]||(o[0]=[b("div",{class:"htga4-woocommerce-requirement__content"},[b("strong",null,"WooCommerce Required:"),B(" E-Commerce events tracking requires the WooCommerce plugin to be installed and activated. ")],-1)])),_:1})])):U("",!0)}},_u=ne(mu,[["__scopeId","data-v-9a3d06fe"]]),vu=()=>{const t=(s,n)=>{var a;if(s.type==="hidden")return!1;if(!s.condition)return!0;let i=s.condition;i instanceof Array||(i=[i]);const o={"!=":(r,l)=>r!=l,"!==":(r,l)=>r!==l,"==":(r,l)=>r==l,"===":(r,l)=>r===l,">=":(r,l)=>r>=l,">":(r,l)=>r>l,"<":(r,l)=>r<l,"<=":(r,l)=>r<=l,any:(r,l)=>l.split(",").map(u=>u.trim()).includes(r),"not-any":(r,l)=>!l.split(",").map(u=>u.trim()).includes(r)};for(let r=0;r<i.length;r++){const l=i[r];let c=l.operator||"!=",u=!0;if((a=l==null?void 0:l.key)!=null&&a.includes("|")){const d=l.key.split("|"),h=c.split("|"),f=l.value.split("|");if(d.forEach((p,g)=>{const m=h[g]||h[0],y=f[g]||f[0];o[m](n[p],y)||(u=!1)}),u)return!0}else if(o[c](n[l.key],l.value))return!0}return!1};return{maybeShowField:t,evaluateComplexConditions:(s,n)=>!s||!s.length?!0:s.some(i=>i.type==="AND"?i.rules.every(o=>t({condition:[o]},n)):i.rules.some(o=>t({condition:[o]},n)))}},bu=["innerHTML"],yu={__name:"FormInput",props:{fieldSchema:{type:Object,required:!0},modelValue:{required:!0},context:{type:Object,required:!1},showLabel:{type:Boolean,default:!0}},emits:["update:modelValue"],setup(t,{emit:e}){const s=X(),n=t,i=e,{maybeShowField:o}=vu(),a=f=>{f.target.closest(".htga4-pro-field-opacity")&&(s.commit("setDisplayProModal",!0),f.preventDefault(),f.stopPropagation())},r=f=>{let p=s.state.settings;return n.context&&(p={...n.context}),o(f,p)},l=S({get(){return n.modelValue},set(f){i("update:modelValue",f)}}),c=S(()=>{var f;if(n.fieldSchema.is_pro||(f=n.fieldSchema.class)!=null&&f.includes("htga4-pro-field-opacity"))return!0;if(n.fieldSchema.id==="measurement_id"){const p=s.state.settings;if(p.auth_google&&p.auth_google!=="")return!0}if(n.fieldSchema.id==="measurement_protocol_api_secret"&&n.fieldSchema.type==="text"){const p=s.state.settings,g=p.auth_google&&p.auth_google!=="",m=p.property&&p.property!=="",y=p.data_stream_id&&p.data_stream_id!=="";if(g&&m&&y)return!0}return!1}),u=S(()=>{let f=n.fieldSchema.class?n.fieldSchema.class.split(" "):[];return c.value&&n.fieldSchema.is_pro&&!f.includes("htga4-pro-field-opacity")&&f.push("htga4-pro-field-opacity"),f}),d=S(()=>n.fieldSchema.label_position||"left"),h=S(()=>n.showLabel&&!!n.fieldSchema.title);return Me(()=>n.modelValue,f=>{f!==l.value&&(l.value=f)},{deep:!0}),(f,p)=>{const g=D("el-tag"),m=D("el-text"),y=D("el-form-item");return x(),T(J,null,[t.fieldSchema.is_pro?(x(),A(g,{key:0,type:"danger",round:"",size:"small"},{default:w(()=>p[13]||(p[13]=[B("Pro")])),_:1})):U("",!0),oi(_(y,{class:ie(["htga4-form-item",u.value,"htga4-input-"+t.fieldSchema.type]),size:"large",onClick:a,"label-position":d.value},Ss({default:w(()=>[["text","number","email","textarea"].includes(t.fieldSchema.type)?(x(),A(Lc,{key:0,modelValue:l.value,"onUpdate:modelValue":p[0]||(p[0]=v=>l.value=v),fieldSchema:t.fieldSchema,disabled:c.value},null,8,["modelValue","fieldSchema","disabled"])):U("",!0),t.fieldSchema.type==="select"?(x(),A(Ic,{key:1,modelValue:l.value,"onUpdate:modelValue":p[1]||(p[1]=v=>l.value=v),fieldSchema:t.fieldSchema,disabled:c.value},null,8,["modelValue","fieldSchema","disabled"])):U("",!0),t.fieldSchema.type==="color"?(x(),A(Fc,{key:2,modelValue:l.value,"onUpdate:modelValue":p[2]||(p[2]=v=>l.value=v),fieldSchema:t.fieldSchema,disabled:c.value},null,8,["modelValue","fieldSchema","disabled"])):U("",!0),t.fieldSchema.type==="checkbox"?(x(),A(Vc,{key:3,modelValue:l.value,"onUpdate:modelValue":p[3]||(p[3]=v=>l.value=v),fieldSchema:t.fieldSchema,disabled:c.value},null,8,["modelValue","fieldSchema","disabled"])):U("",!0),t.fieldSchema.type==="switch"?(x(),A($c,{key:4,modelValue:l.value,"onUpdate:modelValue":p[4]||(p[4]=v=>l.value=v),fieldSchema:t.fieldSchema,disabled:c.value},null,8,["modelValue","fieldSchema","disabled"])):U("",!0),t.fieldSchema.type==="auth_button"?(x(),A(cu,{key:5,modelValue:l.value,"onUpdate:modelValue":p[5]||(p[5]=v=>l.value=v),fieldSchema:t.fieldSchema},null,8,["modelValue","fieldSchema"])):U("",!0),t.fieldSchema.type==="radio"?(x(),A(zc,{key:6,modelValue:l.value,"onUpdate:modelValue":p[6]||(p[6]=v=>l.value=v),fieldSchema:t.fieldSchema,disabled:c.value},null,8,["modelValue","fieldSchema","disabled"])):U("",!0),t.fieldSchema.type==="tabbed"?(x(),A(Uc,{key:7,modelValue:l.value,"onUpdate:modelValue":p[7]||(p[7]=v=>l.value=v),fieldSchema:t.fieldSchema,disabled:c.value},null,8,["modelValue","fieldSchema","disabled"])):U("",!0),t.fieldSchema.type==="wp_editor"?(x(),A(qc,{key:8,modelValue:l.value,"onUpdate:modelValue":p[8]||(p[8]=v=>l.value=v),fieldSchema:t.fieldSchema,disabled:c.value},null,8,["modelValue","fieldSchema","disabled"])):U("",!0),t.fieldSchema.type==="clipboard"?(x(),A(nu,{key:9,modelValue:l.value,"onUpdate:modelValue":p[9]||(p[9]=v=>l.value=v),fieldSchema:t.fieldSchema,disabled:c.value},null,8,["modelValue","fieldSchema","disabled"])):U("",!0),t.fieldSchema.type==="hidden"?(x(),A(du,{key:10,modelValue:l.value,"onUpdate:modelValue":p[10]||(p[10]=v=>l.value=v),fieldSchema:t.fieldSchema},null,8,["modelValue","fieldSchema"])):U("",!0),t.fieldSchema.type==="info"?(x(),A(pu,{key:11,modelValue:l.value,"onUpdate:modelValue":p[11]||(p[11]=v=>l.value=v),fieldSchema:t.fieldSchema},null,8,["modelValue","fieldSchema"])):U("",!0),t.fieldSchema.type==="woocommerce_requirement"?(x(),A(_u,{key:12,modelValue:l.value,"onUpdate:modelValue":p[12]||(p[12]=v=>l.value=v),fieldSchema:t.fieldSchema},null,8,["modelValue","fieldSchema"])):U("",!0),t.fieldSchema.desc?(x(),T("span",{key:13,class:"htga4-input-desc",innerHTML:t.fieldSchema.desc},null,8,bu)):U("",!0)]),_:2},[h.value?{name:"label",fn:w(()=>[_(m,{class:"mx-1"},{default:w(()=>[B(H(t.fieldSchema.title),1)]),_:1}),t.fieldSchema.help?(x(),A(as,{key:0,content:t.fieldSchema.help,placement:"bottom-start","use-html":!0},null,8,["content"])):U("",!0)]),key:"0"}:void 0]),1032,["class","label-position"]),[[ai,r(n.fieldSchema)]])],64)}}},we=ne(yu,[["__scopeId","data-v-7bbb36b7"]]),Se=(t,e)=>{const s=e.split(".");let n=window.htga4SettingsSchema[t].fields;for(let i=0;i<s.length;i++){const o=s[i];if(n.fields&&n.fields[o])n=n.fields[o];else if(n[o])n=n[o];else return null}return n},xu={class:"general-settings"},Ps="general_route",wu={__name:"General",setup(t){const e=window.htga4SettingsSchema[Ps],s=Object.keys(e.fields),n=X(),i=S(()=>n.state.settings);S(()=>n.state);const o=a=>{const r=Se(Ps,a);return(r==null?void 0:r.id)||a};return(a,r)=>{const l=D("el-text"),c=D("SettingsCard"),u=D("el-form");return x(),T("div",xu,[_(u,{model:i.value,"label-width":"auto"},{default:w(()=>[_(ks,null,{default:w(()=>[_(l,null,{default:w(()=>[r[1]||(r[1]=B("To access analytical reports within your WordPress dashboard, you need to connect / authenticate with your Google Analytics account. ")),r[2]||(r[2]=b("br",null,null,-1)),_(l,{type:"warning"},{default:w(()=>r[0]||(r[0]=[B("If you don't need to access the reports within the dashboard, manually insert your GA4 tracking ID below.")])),_:1})]),_:1})]),_:1}),_(c,null,{default:w(()=>[(x(!0),T(J,null,le(a.ecommerceEvents,d=>(x(),A(we,{key:d,modelValue:i.value[d],"onUpdate:modelValue":h=>i.value[d]=h,fieldSchema:I(Se)(Ps,d)},null,8,["modelValue","onUpdate:modelValue","fieldSchema"]))),128))]),_:1}),(x(!0),T(J,null,le(I(s),d=>(x(),A(we,{key:d,modelValue:i.value[o(d)],"onUpdate:modelValue":h=>i.value[o(d)]=h,fieldSchema:I(Se)(Ps,d)},null,8,["modelValue","onUpdate:modelValue","fieldSchema"]))),128))]),_:1},8,["model"])])}}},Su={class:"htga4-card-header"},qs={__name:"SettingsCard",props:{title:{type:String,required:!1}},setup(t){const e=t,s=S(()=>!!e.title);return(n,i)=>{const o=D("el-card");return x(),A(o,{class:"htga4-settings-card"},Ss({default:w(()=>[Ft(n.$slots,"default")]),_:2},[s.value?{name:"header",fn:w(()=>[b("div",Su,[b("span",null,H(t.title),1)])]),key:"0"}:void 0]),1024)}}},ku={class:"general-settings"},Xi="events-tracking_route",Cu={__name:"EventsTracking",setup(t){const e=X(),s=S(()=>e.state.settings),n=window.htga4SettingsSchema[Xi],i=n.sections,o=S(()=>{const a=[];return Object.keys(i).forEach(r=>{let l={},c=[];l.title=n.sections[r].title,c=Object.values(n.fields).filter(u=>u.section==r),l.fields=c.map(u=>u.id),a.push(l)}),a});return(a,r)=>{const l=D("el-form");return x(),T("div",ku,[_(l,{model:s.value,"label-width":"auto"},{default:w(()=>[(x(!0),T(J,null,le(o.value,(c,u)=>(x(),A(qs,{key:u,title:c.title},{default:w(()=>[(x(!0),T(J,null,le(c.fields,d=>(x(),A(we,{key:d,modelValue:s.value[d],"onUpdate:modelValue":h=>s.value[d]=h,fieldSchema:I(Se)(Xi,d)},null,8,["modelValue","onUpdate:modelValue","fieldSchema"]))),128))]),_:2},1032,["title"]))),128))]),_:1},8,["model"])])}}},Pu={class:"custom-events-manager"},Du={class:"custom-events-list"},Ru={class:"custom-event-card"},Mu={class:"custom-event-content"},Au={class:"custom-event-label"},Tu={class:"custom-event-actions"},Eu={key:0,class:"upgrade-prompt"},Lu={class:"upgrade-content"},Ou=["id"],Iu={key:0,class:"custom-events-drawer-content"},Fu={class:"drawer-card-title"},Vu={class:"drawer-card-title"},$u={class:"drawer-card-title"},zu={key:0},Bu={key:1,class:"advanced-parameters"},Nu={key:0,class:"empty-state"},Uu={key:1,class:"parameters-accordion"},Hu={class:"collapse-header"},ju={class:"parameter-title"},Wu={class:"parameter-number"},Gu={class:"parameter-key"},qu={class:"collapse-actions"},Yu={class:"parameter-content"},Xu={class:"parameter-field"},Ku={class:"parameter-field"},Qu={class:"parameter-field"},Zu={class:"add-parameter-section"},Ju={class:"custom-events-drawer-footer"},je="custom-events_route",ed={__name:"CustomEvents",setup(t){const e=X(),s=S({get(){return e.state.settings},set(L){e.commit("updateSettings",L)}}),n=window.htga4SettingsSchema[je],i=se(!1),o=se(null),a=se(!1),r=se(null),l=se([]),c=se(!1),u={pdf_download:"a[href$='.pdf']",zip_download:"a[href$='.zip']",doc_download:"a[href$='.docx']",all_file_downloads:"a[href$='.pdf'], a[href$='.zip'], a[href$='.docx']",external_link:"a[href^='http']:not([href*='yourdomain.com'])",affiliate_link:"a[href*='?ref=']",email_click:"a[href^='mailto:']",phone_click:"a[href^='tel:']",add_to_cart:".add_to_cart_button",checkout_button:".checkout-button, #checkout",signup_button:".subscribe-btn, .newsletter-submit",video_play:".video-play, .ytp-play-button",reveal_coupon:".reveal-coupon",faq_toggle:".faq-question, .accordion-header"},d={name:[{required:!0,message:"Event name is required",trigger:"blur"}],event_name:[{required:!0,message:"GA4 event name is required",trigger:"blur"},{pattern:/^[a-z0-9_]+$/,message:"Event name must be in snake_case format",trigger:"blur"}],trigger_value:[{required:!0,message:"Trigger target is required",trigger:"blur"}]},h=S(()=>o.value!==null?s.value.custom_events[o.value]:null),f=S(()=>{var L;return((L=window.htga4Settings)==null?void 0:L.isProActive)==="1"}),p=S(()=>{var L;return((L=s.value.custom_events)==null?void 0:L.length)||0}),g=()=>{if(!f.value&&p.value>=2){c.value=!0;return}c.value=!1;const L={id:"custom_event_"+Date.now(),active:0,name:"",event_name:"",trigger_type:"click",trigger_value:"",trigger_preset:"",parameter_mode:"simple",event_category:"",event_label:"",event_value:1,parameters:[]};Array.isArray(s.value.custom_events)||(s.value.custom_events=[]),o.value=s.value.custom_events.length,s.value.custom_events.push(L),i.value=!0},m=L=>{o.value=L,i.value=!0;const F=s.value.custom_events[L];F&&!F.parameter_mode&&(F.parameter_mode="simple")},y=L=>{Array.isArray(s.value.custom_events)||(s.value.custom_events=[]),s.value.custom_events.splice(L,1)[0];const F=s.value.custom_events.filter((he,Y,Q)=>Q.findIndex(Z=>Z.id===he.id)===Y);s.value.custom_events=F,p.value<2&&(c.value=!1)},v=()=>{o.value=null,i.value=!1},k=L=>{L&&u[L]&&(h.value.trigger_value=u[L])},P=()=>{h.value.parameters||(h.value.parameters=[]),h.value.parameters.push({param_key:"",param_value_type:"static_text",param_value:""});const L=h.value.parameters.length-1;l.value=[L]},C=L=>{h.value.parameters.splice(L,1)},O=L=>{switch(L){case"static_text":return"e.g: engagement, conversion";case"dynamic_click_text":return"Will use clicked element text";case"dynamic_href_filename":return"Will extract filename from href";case"dynamic_page_url":return"Will use current page URL";case"dynamic_form_id":return"Will use form ID or name";case"dynamic_data_attribute":return"e.g: data-location, data-type";case"dynamic_closest_section":return"Will use closest section class";default:return"Enter value or attribute name"}},R=L=>{switch(L){case"static_text":return"Enter a fixed value that will be sent with every event";case"dynamic_click_text":return"Automatically captures the text content of the clicked element";case"dynamic_href_filename":return"Extracts the filename from the href attribute of clicked links";case"dynamic_page_url":return"Uses the current page URL when the event fires";case"dynamic_form_id":return"Captures the ID or name attribute of the submitted form";case"dynamic_data_attribute":return"Specify which data-* attribute to extract (e.g., data-location)";case"dynamic_closest_section":return"Finds the nearest section element and uses its class name";default:return"Select a value type to see description"}},E=L=>{switch(L){case"click":return"Enter a CSS selector to target specific elements that users can click (e.g., buttons, links, form elements). Use presets above for common scenarios.";case"form_submit":return"Enter a CSS selector to target specific forms that users can submit (e.g., contact forms, newsletter signups, checkout forms). Use presets above for common scenarios.";case"page_view":return"Enter a URL pattern to track when users visit specific pages or sections of your website (e.g., /contact, /checkout, /download/*). Use wildcards (*) for dynamic URLs.";default:return"Enter a CSS selector or URL pattern to define when this event should be triggered. Use presets above for common scenarios."}},z=L=>{switch(L){case"click":return'e.g., .cta-button, #newsletter-form, a[href*="download"]';case"form_submit":return'e.g., #contact-form, .newsletter-form, form[name="signup"]';case"page_view":return"e.g., /contact, /checkout, /download/*";default:return"e.g., .cta-button, #newsletter-form, /download"}};Me(()=>{var L;return(L=h.value)==null?void 0:L.trigger_type},(L,F)=>{var he,Y,Q;if(L&&h.value){const Z=window.htga4SettingsSchema["custom-events_route"];(Q=(Y=(he=Z==null?void 0:Z.fields)==null?void 0:he.custom_events)==null?void 0:Y.fields)!=null&&Q.trigger_value&&(Z.fields.custom_events.fields.trigger_value.desc=E(L),Z.fields.custom_events.fields.trigger_value.placeholder=z(L)),F&&L!==F&&(h.value.trigger_value="")}},{immediate:!0});const j=async()=>{try{await r.value.validate(),a.value=!0;try{await e.dispatch("saveSettings"),Vt.success({message:"Custom event saved successfully",offset:40})}catch{Vt.error({message:"Failed to save custom event",offset:40})}finally{a.value=!1}}catch(L){console.log("Validation failed:",L)}},G=()=>{var L;(L=window.htga4Settings)!=null&&L.proUrl&&window.open(window.htga4Settings.proUrl,"_blank")};return(L,F)=>{const he=D("el-tag"),Y=D("el-button"),Q=D("el-card"),Z=D("el-empty"),ye=D("el-input"),ce=D("el-option"),Fe=D("el-option-group"),Ze=D("el-select"),$e=D("el-collapse-item"),He=D("el-collapse"),Ae=D("el-form"),qe=D("el-drawer");return x(),T("div",Pu,[b("div",Du,[(x(!0),T(J,null,le(s.value.custom_events,(W,M)=>(x(),T("div",{key:W.id,class:"custom-event-item"},[b("div",Ru,[b("div",Mu,[b("span",Au,[B(H(W.name)+" ",1),_(he,{size:"small",type:Number(W.active)===1?"success":"info",class:"status-tag"},{default:w(()=>[B(H(Number(W.active)===1?"Enabled":"Disabled"),1)]),_:2},1032,["type"])])]),b("div",Tu,[_(Y,{type:"primary",icon:I(ha),circle:"",size:"small",onClick:V=>m(M)},null,8,["icon","onClick"]),_(Y,{type:"danger",icon:I(Ln),circle:"",size:"small",onClick:V=>y(M)},null,8,["icon","onClick"])])])]))),128))]),_(Y,{type:"primary",onClick:g,icon:I(mn)},{default:w(()=>[B(H(I(n).texts.add_new),1)]),_:1},8,["icon"]),c.value?(x(),T("div",Eu,[_(ks,{type:"warning"},{default:w(()=>[b("div",Lu,[F[13]||(F[13]=b("h4",null,"Unlock Unlimited Custom Events",-1)),F[14]||(F[14]=b("p",null,"You've reached the 2-event limit in the free version. Upgrade to Pro for unlimited custom events, advanced analytics, and premium support. Start tracking everything that matters to your business.",-1)),_(Y,{type:"primary",size:"medium",onClick:G},{default:w(()=>F[12]||(F[12]=[B(" Upgrade to Pro ")])),_:1})])]),_:1})])):U("",!0),_(qe,{modelValue:i.value,"onUpdate:modelValue":F[11]||(F[11]=W=>i.value=W),title:h.value?"Edit Event":"New Event",size:"900","before-close":v},{header:w(({close:W,titleId:M,titleClass:V})=>[b("h2",{id:M,class:ie(V)},H(h.value?"Edit Event":"New Event"),11,Ou)]),default:w(()=>[h.value?(x(),T("div",Iu,[_(Ae,{ref_key:"eventForm",ref:r,model:h.value,rules:d,"label-width":"auto"},{default:w(()=>[_(Q,{shadow:"always",class:"settings-card"},{header:w(()=>[b("span",Fu,H(I(n).texts.basic_settings),1)]),default:w(()=>[_(we,{modelValue:h.value.active,"onUpdate:modelValue":F[0]||(F[0]=W=>h.value.active=W),fieldSchema:I(Se)(je,"custom_events.active"),context:h.value},null,8,["modelValue","fieldSchema","context"]),_(we,{modelValue:h.value.name,"onUpdate:modelValue":F[1]||(F[1]=W=>h.value.name=W),fieldSchema:I(Se)(je,"custom_events.name"),context:h.value},null,8,["modelValue","fieldSchema","context"]),_(we,{modelValue:h.value.event_name,"onUpdate:modelValue":F[2]||(F[2]=W=>h.value.event_name=W),fieldSchema:I(Se)(je,"custom_events.event_name"),context:h.value},null,8,["modelValue","fieldSchema","context"])]),_:1}),_(Q,{shadow:"always",class:"settings-card"},{header:w(()=>[b("span",Vu,H(I(n).texts.trigger_settings),1)]),default:w(()=>[_(we,{modelValue:h.value.trigger_type,"onUpdate:modelValue":F[3]||(F[3]=W=>h.value.trigger_type=W),fieldSchema:I(Se)(je,"custom_events.trigger_type"),context:h.value},null,8,["modelValue","fieldSchema","context"]),_(we,{modelValue:h.value.trigger_preset,"onUpdate:modelValue":[F[4]||(F[4]=W=>h.value.trigger_preset=W),k],fieldSchema:I(Se)(je,"custom_events.trigger_preset"),context:h.value},null,8,["modelValue","fieldSchema","context"]),(x(),A(we,{modelValue:h.value.trigger_value,"onUpdate:modelValue":F[5]||(F[5]=W=>h.value.trigger_value=W),fieldSchema:I(Se)(je,"custom_events.trigger_value"),context:h.value,key:`trigger-value-${h.value.trigger_type}`},null,8,["modelValue","fieldSchema","context"]))]),_:1}),_(Q,{shadow:"always",class:"settings-card"},{header:w(()=>[b("span",$u,H(I(n).texts.event_parameters),1)]),default:w(()=>[_(we,{modelValue:h.value.parameter_mode,"onUpdate:modelValue":F[6]||(F[6]=W=>h.value.parameter_mode=W),fieldSchema:I(Se)(je,"custom_events.parameter_mode"),context:h.value},null,8,["modelValue","fieldSchema","context"]),h.value&&(h.value.parameter_mode==="simple"||!h.value.parameter_mode)?(x(),T("div",zu,[_(we,{modelValue:h.value.event_category,"onUpdate:modelValue":F[7]||(F[7]=W=>h.value.event_category=W),fieldSchema:I(Se)(je,"custom_events.event_category"),context:h.value},null,8,["modelValue","fieldSchema","context"]),_(we,{modelValue:h.value.event_label,"onUpdate:modelValue":F[8]||(F[8]=W=>h.value.event_label=W),fieldSchema:I(Se)(je,"custom_events.event_label"),context:h.value},null,8,["modelValue","fieldSchema","context"]),_(we,{modelValue:h.value.event_value,"onUpdate:modelValue":F[9]||(F[9]=W=>h.value.event_value=W),fieldSchema:I(Se)(je,"custom_events.event_value"),context:h.value},null,8,["modelValue","fieldSchema","context"])])):h.value&&h.value.parameter_mode==="advanced"?(x(),T("div",Bu,[!h.value.parameters||h.value.parameters.length===0?(x(),T("div",Nu,[_(Z,{description:"No parameters added yet","image-size":80},{default:w(()=>[_(Y,{type:"primary",onClick:P,icon:I(mn)},{default:w(()=>F[15]||(F[15]=[B(" Add Your First Parameter ")])),_:1},8,["icon"])]),_:1})])):(x(),T("div",Uu,[_(He,{modelValue:l.value,"onUpdate:modelValue":F[10]||(F[10]=W=>l.value=W),accordion:""},{default:w(()=>[(x(!0),T(J,null,le(h.value.parameters,(W,M)=>(x(),A($e,{key:M,name:M,class:"parameter-collapse-item"},{title:w(()=>[b("div",Hu,[b("span",ju,[b("span",Wu,"#"+H(M+1),1),b("span",Gu,H(W.param_key||"Unnamed Parameter"),1)]),b("div",qu,[_(Y,{type:"danger",icon:I(Ln),circle:"",size:"small",onClick:dt(V=>C(M),["stop"]),class:"remove-btn"},null,8,["icon","onClick"])])])]),default:w(()=>[b("div",Yu,[b("div",Xu,[b("label",null,[F[16]||(F[16]=B(" Parameter Key ")),_(as,{content:"• The name of the parameter that will be sent to GA4 <br>• e.g., event_category, cta_text, page_title",placement:"top",effect:"dark"})]),_(ye,{modelValue:W.param_key,"onUpdate:modelValue":V=>W.param_key=V,placeholder:"e.g: event_category, cta_text",clearable:"",size:"small"},null,8,["modelValue","onUpdate:modelValue"])]),b("div",Ku,[b("label",null,[F[17]||(F[17]=B(" Value Type ")),_(as,{content:"• Choose how the parameter value will be determined <br>• static text or dynamically extracted from the page",placement:"top",effect:"dark"})]),_(Ze,{modelValue:W.param_value_type,"onUpdate:modelValue":V=>W.param_value_type=V,placeholder:"Select value type",style:{width:"100%"},size:"medium"},{default:w(()=>[_(Fe,{label:"Static Values"},{default:w(()=>[_(ce,{label:"Static Text",value:"static_text"})]),_:1}),_(Fe,{label:"Dynamic Values"},{default:w(()=>[_(ce,{label:"Clicked Element Text",value:"dynamic_click_text"}),_(ce,{label:"File Name from Href",value:"dynamic_href_filename"}),_(ce,{label:"Current Page URL",value:"dynamic_page_url"}),_(ce,{label:"Form ID",value:"dynamic_form_id"}),_(ce,{label:"Data Attribute",value:"dynamic_data_attribute"}),_(ce,{label:"Closest Section",value:"dynamic_closest_section"})]),_:1})]),_:2},1032,["modelValue","onUpdate:modelValue"])]),b("div",Qu,[b("label",null,[F[18]||(F[18]=B(" Parameter Value ")),_(as,{content:R(W.param_value_type),placement:"top",effect:"dark"},null,8,["content"])]),_(ye,{modelValue:W.param_value,"onUpdate:modelValue":V=>W.param_value=V,placeholder:O(W.param_value_type),clearable:"",size:"small"},null,8,["modelValue","onUpdate:modelValue","placeholder"])])])]),_:2},1032,["name"]))),128))]),_:1},8,["modelValue"])])),b("div",Zu,[_(Y,{onClick:P,icon:I(mn),type:"primary",plain:"",size:"large"},{default:w(()=>F[19]||(F[19]=[B(" Add Parameter ")])),_:1},8,["icon"])])])):U("",!0)]),_:1})]),_:1},8,["model"])])):U("",!0)]),footer:w(()=>[b("div",Ju,[_(Y,{onClick:v,disabled:a.value},{default:w(()=>[B(H(I(n).texts.cancel),1)]),_:1},8,["disabled"]),_(Y,{type:"primary",onClick:j,loading:a.value},{default:w(()=>[B(H(I(n).texts.save),1)]),_:1},8,["loading"])])]),_:1},8,["modelValue","title"])])}}},td=ne(ed,[["__scopeId","data-v-f9039c2d"]]),sd={class:"cookie-notice-settings"},wn="cookie_notice_route",nd={__name:"CookieNotice",setup(t){Br(r=>({89205138:s.value.cookie_notice_enabled==!0?"block":"none",ebf5ac80:s.value.cookie_notice_banner_bg_color||"#0099ff","7ebdb578":s.value.cookie_notice_banner_text_color||"#ffffff","0004b1d1":s.value.cookie_notice_privacy_link_color||"#ffffff","41861a3c":s.value.cookie_notice_accept_bg_color||"#ffffff","08ca9394":s.value.cookie_notice_accept_text_color||"#000000","1a4b3645":s.value.cookie_notice_decline_bg_color||"transparent","0186072c":s.value.cookie_notice_decline_text_color||"#ffffff"}));const e=X(),s=S(()=>e.state.settings),n=window.htga4SettingsSchema[wn],i=n.sections;S(()=>{var r;return((r=window==null?void 0:window.htga4_cookie_notice_params)==null?void 0:r.notice_html)??""});const o=S(()=>Object.values(n.fields).filter(r=>!r.section).map(r=>r.id));Me(()=>s.value,()=>{},{deep:!0});const a=S(()=>{const r=[];return Object.keys(i).forEach(l=>{let c={};c.title=n.sections[l].title,c.description=n.sections[l].description;const u=Object.values(n.fields).filter(d=>d.section===l);c.fields=u.map(d=>d.id),r.push(c)}),r});return S(()=>({banner:{backgroundColor:s.value.cookie_notice_banner_bg_color||"#0099ff",color:s.value.cookie_notice_banner_text_color||"#ffffff",padding:"15px",display:"flex",justifyContent:"space-between",alignItems:"center",flexWrap:"wrap",gap:"10px"},text:{color:s.value.cookie_notice_banner_text_color||"#ffffff"},privacyLink:{color:s.value.cookie_notice_privacy_link_color||"#ffffff",marginLeft:"5px",textDecoration:"underline"},acceptBtn:{backgroundColor:s.value.cookie_notice_accept_bg_color||"#ffffff",color:s.value.cookie_notice_accept_text_color||"#000000",border:"none",padding:"8px 16px",borderRadius:"4px",cursor:"pointer",marginLeft:"10px"},declineBtn:{backgroundColor:s.value.cookie_notice_decline_bg_color||"transparent",color:s.value.cookie_notice_decline_text_color||"#ffffff",border:"1px solid "+(s.value.cookie_notice_decline_text_color||"#ffffff"),padding:"8px 16px",borderRadius:"4px",cursor:"pointer"}})),(r,l)=>{const c=D("el-form");return x(),T("div",sd,[_(c,{model:s.value,"label-width":"auto"},{default:w(()=>[_(qs,null,{default:w(()=>[(x(!0),T(J,null,le(o.value,u=>(x(),A(we,{key:u,modelValue:s.value[u],"onUpdate:modelValue":d=>s.value[u]=d,fieldSchema:I(Se)(wn,u)},null,8,["modelValue","onUpdate:modelValue","fieldSchema"]))),128))]),_:1}),(x(!0),T(J,null,le(a.value,(u,d)=>(x(),A(qs,{key:d,title:u.title,description:u.description},{default:w(()=>[(x(!0),T(J,null,le(u.fields,h=>(x(),A(we,{key:h,modelValue:s.value[h],"onUpdate:modelValue":f=>s.value[h]=f,fieldSchema:I(Se)(wn,h)},null,8,["modelValue","onUpdate:modelValue","fieldSchema"]))),128))]),_:2},1032,["title","description"]))),128))]),_:1},8,["model"])])}}},id=ne(nd,[["__scopeId","data-v-61fc8878"]]),od={class:"tools-settings"},Ki="tools_route",ad={__name:"Tools",setup(t){const e=window.htga4SettingsSchema[Ki],s=Object.keys(e.fields),n=X(),i=S(()=>n.state.settings);return(o,a)=>{const r=D("el-form");return x(),T("div",od,[_(r,{model:i.value,"label-width":"auto"},{default:w(()=>[(x(!0),T(J,null,le(I(s),l=>(x(),A(we,{key:l,modelValue:i.value[l],"onUpdate:modelValue":c=>i.value[l]=c,fieldSchema:I(Se)(Ki,l)},null,8,["modelValue","onUpdate:modelValue","fieldSchema"]))),128))]),_:1},8,["model"])])}}},rd={class:"htga4-settings-section"},ld={class:"htga4-cache-info"},cd={class:"htga4-cache-info__intro"},ud={class:"htga4-cache-info__details"},dd={class:"htga4-cache-info__column"},hd={class:"htga4-cache-info__list"},fd={class:"htga4-cache-info__column"},pd={class:"htga4-cache-info__list"},gd={class:"htga4-cache-management"},md={__name:"Cache",setup(t){const e=se(!1),s=se(!1),n=se({text:"",type:"success"}),i=(a,r="success")=>{n.value={text:a,type:r}},o=async()=>{var a;e.value=!0;try{const r=`${window.htga4Settings.apiBaseURL}htga4/v1/tools/clear-cache`,l=await fetch(r,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":(a=window.htga4Settings)==null?void 0:a.nonce}});if(!l.ok)throw new Error(`API request failed: ${l.statusText}`);const c=await l.json();if(c.success)i(c.message||"Cache cleared successfully!","success"),s.value=!0;else throw new Error(c.message||"Failed to clear cache.")}catch(r){console.error("Cache clearing error:",r),i(r.message||"An error occurred while clearing cache.","error")}finally{e.value=!1}};return(a,r)=>{const l=D("el-icon"),c=D("el-button");return x(),T("div",rd,[r[10]||(r[10]=b("h2",{style:{"margin-top":"0"}},"Cache Management",-1)),b("div",ld,[b("div",cd,[_(l,{class:"htga4-cache-info__icon"},{default:w(()=>[_(I(da))]),_:1}),r[0]||(r[0]=b("p",null,"Google Analytics data is cached to improve performance and reduce API requests. If you are experiencing data synchronization issues, you can clear the cache to fetch fresh data from Google Analytics.",-1))]),b("div",ud,[b("div",dd,[r[4]||(r[4]=b("h3",null,"Cached Data Types",-1)),b("ul",hd,[b("li",null,[_(l,null,{default:w(()=>[_(I(Nr))]),_:1}),r[1]||(r[1]=b("div",null,[b("strong",null,"Reports"),b("p",null,"Standard reports, ecommerce reports, and realtime reports")],-1))]),b("li",null,[_(l,null,{default:w(()=>[_(I(Ur))]),_:1}),r[2]||(r[2]=b("div",null,[b("strong",null,"Account Data"),b("p",null,"GA4 accounts, properties, and data streams information")],-1))]),b("li",null,[_(l,null,{default:w(()=>[_(I(Hr))]),_:1}),r[3]||(r[3]=b("div",null,[b("strong",null,"User Data"),b("p",null,"User informations")],-1))])])]),b("div",fd,[r[8]||(r[8]=b("h3",null,"When to Clear Cache",-1)),b("ul",pd,[b("li",null,[_(l,null,{default:w(()=>[_(I(jr))]),_:1}),r[5]||(r[5]=b("p",null,"When data shown in reports appears outdated",-1))]),b("li",null,[_(l,null,{default:w(()=>[_(I(On))]),_:1}),r[6]||(r[6]=b("p",null,"After making changes to your Google Analytics setup",-1))]),b("li",null,[_(l,null,{default:w(()=>[_(I(fa))]),_:1}),r[7]||(r[7]=b("p",null,"If the force refresh option in reports is not resolving issues",-1))])])])])]),b("div",gd,[_(c,{type:"primary",size:"large",loading:e.value,onClick:o,disabled:e.value||s.value,icon:I(Ln)},{default:w(()=>r[9]||(r[9]=[B(" Clear Cache ")])),_:1},8,["loading","disabled","icon"]),n.value.text?(x(),A(ks,{key:0,type:n.value.type,class:"htga4-cache-message"},{default:w(()=>[B(H(n.value.text),1)]),_:1},8,["type"])):U("",!0)])])}}},Qi=`${htga4Settings.apiBaseURL}htga4/v1`,_d=()=>{var t;return{"Content-Type":"application/json","X-WP-Nonce":(t=window.htga4Settings)==null?void 0:t.nonce}},ke=async(t,e={})=>{try{let s=t;t&&!t.startsWith("http")&&(s=`${Qi}${t.startsWith("/")?t:"/"+t}`),t||(s=Qi);const n=await fetch(s,{...e,headers:{..._d(),...e.headers}});if(!n.ok)throw new Error(`API request failed: ${n.statusText}`);return await n.json()}catch(s){throw console.error("API request error:",s),s}},vd={getSettings:()=>ke("/settings"),updateSettings:t=>ke("/settings",{method:"POST",body:JSON.stringify(t)})},bd={getRoles:()=>ke("/roles")},yd={getAccounts:(t=!1)=>{const e=new URLSearchParams;t&&e.append("force_refresh","1");let s="/accounts";return e.toString()&&(s=`${s}?${e.toString()}`),ke(s)},getProperties:(t,e=!1)=>{if(!t)return Promise.resolve({});const s=new URLSearchParams;e&&s.append("force_refresh","1");let n=`/properties/${t}`;return s.toString()&&(n=`${n}?${s.toString()}`),ke(n)},getDataStreams:(t,e=!1)=>{if(!t)return Promise.resolve({});const s=new URLSearchParams;e&&s.append("force_refresh","1");let n=`/datastreams/${t}`;return s.toString()&&(n=`${n}?${s.toString()}`),ke(n)},getMeasurementProtocolSecrets:(t,e,s=!1)=>{if(!t||!e)return Promise.resolve({});const n=new URLSearchParams;s&&n.append("force_refresh","1");let i=`/measurement-protocol-secrets/${t}/${e}`;return n.toString()&&(i=`${i}?${n.toString()}`),ke(i)}},xd={fetchStandardReports:async({startDate:t=null,endDate:e=null,forceRefresh:s=!1}={})=>{try{const n=new URLSearchParams;t&&e&&(n.append("date_from",Ys(t)),n.append("date_to",Ys(e))),s&&n.append("force_refresh","1");let i="/reports/standard";return n.toString()&&(i=`${i}?${n.toString()}`),await ke(i)}catch(n){throw console.error("Error loading standard reports data:",n),n}}},wd={fetchEcommerceReports:async({startDate:t=null,endDate:e=null,forceRefresh:s=!1}={})=>{try{const n=new URLSearchParams;t&&e&&(n.append("date_from",Ys(t)),n.append("date_to",Ys(e))),s&&n.append("force_refresh","1");let i="/reports/ecommerce";return n.toString()&&(i=`${i}?${n.toString()}`),await ke(i)}catch(n){throw console.error("Error loading ecommerce reports data:",n),n}}},Sd={fetchRealtimeReports:async(t=!1)=>{try{const e=new URLSearchParams;t&&e.append("force_refresh","1");let s="/reports/realtime";return e.toString()&&(s=`${s}?${e.toString()}`),await ke(s)}catch(e){throw console.error("Error loading realtime reports data:",e),e}}},kd={getUserInfo:(t=!1)=>{let e="/userinfo";return t&&(e=`${e}?force_refresh=1`),ke(e)}},Cd={getDataStream:(t,e,s=!1)=>{const n=new URLSearchParams;n.append("property_id",t),n.append("stream_id",e),s&&n.append("force_refresh","1");let i="/datastream";return n.toString()&&(i=`${i}?${n.toString()}`),ke(i)}},Ys=t=>t?(typeof t=="string"?new Date(t):t).toISOString().split("T")[0]:"",Pd={getSettings:()=>ke("/google-ads/settings"),updateSettings:t=>ke("/google-ads/settings",{method:"POST",body:JSON.stringify(t)}),testConversion:()=>ke("/google-ads/test",{method:"POST"})},Le={settings:vd,roles:bd,ga4:yd,standard:xd,ecommerce:wd,realtime:Sd,user:kd,dataStream:Cd,googleAds:Pd,get:t=>ke(t),post:(t,e)=>ke(t,{method:"POST",body:e?JSON.stringify(e):void 0})},Dd={name:"GoogleAdsSettings",components:{SettingsCard:qs},setup(){const t=X(),e=se(null),s=se(!1),n=se(!1),i=se(["1"]),o=S({get(){var P,C,O,R,E,z,j,G,L,F,he;const v=((P=t.state.settings)==null?void 0:P.google_ads)||{},k=v.conversion_labels||{};return{enabled:v.enabled||!1,conversion_id:v.conversion_id||"",excluded_roles:"excluded_roles"in v?v.excluded_roles:["administrator"],conversion_labels:{purchase:{enabled:((C=k.purchase)==null?void 0:C.enabled)||!1,label:((O=k.purchase)==null?void 0:O.label)||""},add_to_cart:{enabled:((R=k.add_to_cart)==null?void 0:R.enabled)||!1,label:((E=k.add_to_cart)==null?void 0:E.label)||""},checkout:{enabled:((z=k.checkout)==null?void 0:z.enabled)||!1,label:((j=k.checkout)==null?void 0:j.label)||""},view_product:{enabled:((G=k.view_product)==null?void 0:G.enabled)||!1,label:((L=k.view_product)==null?void 0:L.label)||""},view_category:{enabled:((F=k.view_category)==null?void 0:F.enabled)||!1,label:((he=k.view_category)==null?void 0:he.label)||""}}}},set(v){t.commit("updateSettings",{google_ads:v})}}),a=S(()=>({conversion_id:o.value.enabled?[{required:!0,message:"Please enter your Conversion ID",trigger:"blur"},{pattern:/^[0-9]{9,10}$/,message:"Conversion ID must be 9-10 digits",trigger:"blur"}]:[]})),r=se({show:!1,type:"",message:""}),l=S(()=>{var v;return((v=window.htga4Settings)==null?void 0:v.isProActive)==="1"}),c=[{key:"purchase",icon:"el-icon-shopping-cart-2",title:"Purchase Event",placeholder:"e.g., AbCdEfGhIjKl",description:"Track when customers complete a purchase",isPro:!1},{key:"add_to_cart",icon:"el-icon-shopping-bag-1",title:"Add to Cart Event",placeholder:"e.g., XyZ123456789",description:"Track when customers add products to their cart",isPro:!0},{key:"checkout",icon:"el-icon-tickets",title:"Checkout Event",placeholder:"e.g., DeF456789012",description:"Track when customers initiate checkout process",isPro:!0},{key:"view_product",icon:"el-icon-view",title:"View Product Event",placeholder:"e.g., GhI345678901",description:"Track when customers view product pages",isPro:!0},{key:"view_category",icon:"el-icon-folder-opened",title:"View Category Event",placeholder:"e.g., JkL567890123",description:"Track when customers view category pages",isPro:!0}],u=S(()=>{const v=o.value.conversion_labels&&Object.values(o.value.conversion_labels).some(k=>k.enabled&&k.label&&k.label.trim()!=="");return{hasConversionId:!!o.value.conversion_id,hasConversionLabel:v,isEnabled:o.value.enabled}}),d=S(()=>u.value.hasConversionId?u.value.hasConversionLabel?u.value.isEnabled?3:2:1:0),h=S(()=>u.value.hasConversionId&&u.value.hasConversionLabel&&u.value.isEnabled),f=(v,k)=>{const P={...o.value,[v]:k};t.commit("updateSettings",{google_ads:P}),console.log(`Updated ${v}:`,k)},p=(v,k,P)=>{const C={...o.value,conversion_labels:{...o.value.conversion_labels,[v]:{...o.value.conversion_labels[v],[k]:P}}};t.commit("updateSettings",{google_ads:C}),console.log(`Updated conversion_labels.${v}.${k}:`,P)};return Me(()=>t.state.isSaving,async v=>{if(v&&e.value){if(console.log("Google Ads - Saving form data:",o.value),!o.value.enabled){t.commit("updateSettings",{google_ads:o.value});return}try{await e.value.validate()&&t.commit("updateSettings",{google_ads:o.value})}catch(k){console.error("Validation failed:",k),t.commit("updateSettings",{google_ads:o.value})}}}),{settingsForm:e,formData:o,rules:a,saving:s,testing:n,testResult:r,setupStatus:u,currentStep:d,isSetupComplete:h,activeStep:i,conversionEvents:c,isProActive:l,testConversion:async()=>{try{n.value=!0,r.value.show=!1,console.log("Testing conversion with settings:",o.value);const v=await Le.post("/google-ads/test");if(console.log("Test response:",v),v.tracking_code)try{if(window.gtag){const k=v.tracking_code.match(/gtag\('event',\s*'conversion',\s*({[^}]+})\)/);if(k){const P=new Function("return "+k[1])();window.gtag("event","conversion",P),console.log("Test conversion sent to Google Ads:",P),r.value={show:!0,type:"success",message:"Test conversion sent successfully! Check your Google Ads account in a few minutes."}}else throw new Error("Invalid tracking code format")}else r.value={show:!0,type:"warning",message:"Google Ads tracking script not found on this page. Please ensure Google Ads tracking is enabled and visit your frontend site to test."}}catch(k){console.error("Failed to execute tracking code:",k),r.value={show:!0,type:"error",message:"Failed to send test conversion. Please check your settings and try again."}}else r.value={show:!0,type:"success",message:v.message||"Test conversion prepared."}}catch(v){console.error("Test conversion error:",v);let k="Test failed";v.message&&(k=v.message),r.value={show:!0,type:"error",message:k}}finally{n.value=!1}},updateFormField:f,updateConversionLabel:p,openProUpgrade:()=>{var v;(v=window.htga4Settings)!=null&&v.proUrl&&window.open(window.htga4Settings.proUrl,"_blank")},handleProFieldClick:(v,k)=>{k.isPro&&!l.value&&(t.commit("setDisplayProModal",!0),v.preventDefault(),v.stopPropagation())}}}},Rd={class:"htga4-google-ads-settings"},Md={class:"setup-status"},Ad={key:0},Td={key:1},Ed={key:0},Ld={key:1},Od={class:"step-details"},Id={style:{display:"flex","align-items":"center",gap:"10px"}},Fd={style:{display:"flex","align-items":"center","justify-content":"space-between",width:"100%",gap:"10px"}},Vd={class:"event-title-wrapper"},$d={key:0},zd={class:"form-help"},Bd={class:"test-conversion-section"};function Nd(t,e,s,n,i,o){const a=D("el-alert"),r=D("el-card"),l=D("el-step"),c=D("el-steps"),u=D("el-collapse-item"),d=D("el-collapse"),h=D("el-switch"),f=D("el-form-item"),p=D("el-col"),g=D("el-input"),m=D("el-checkbox"),y=D("el-checkbox-group"),v=D("el-row"),k=D("SettingsCard"),P=D("el-tag"),C=D("el-form"),O=D("el-button");return x(),T("div",Rd,[n.isSetupComplete?U("",!0):(x(),A(r,{key:0,class:"status-card",shadow:"never"},{default:w(()=>[b("div",Md,[_(a,{type:n.setupStatus.hasConversionId?"success":"warning",closable:!1},{title:w(()=>[n.setupStatus.hasConversionId?(x(),T("span",Td,e[5]||(e[5]=[b("i",{class:"el-icon-success"},null,-1),B(" Almost Done! ")]))):(x(),T("span",Ad,e[4]||(e[4]=[b("i",{class:"el-icon-warning"},null,-1),B(" Setup Required ")])))]),default:w(()=>[n.setupStatus.hasConversionId?(x(),T("div",Ld," Add your conversion label to start tracking conversions ")):(x(),T("div",Ed," Follow the steps below to configure Google Ads conversion tracking "))]),_:1},8,["type"])])]),_:1})),n.isSetupComplete?U("",!0):(x(),A(r,{key:1,class:"setup-steps-card",shadow:"never"},{header:w(()=>e[6]||(e[6]=[b("h3",null,"Setup Instructions",-1)])),default:w(()=>[_(c,{active:n.currentStep,"finish-status":"success","align-center":""},{default:w(()=>[_(l,{title:"Get Conversion ID",description:"From Google Ads account"}),_(l,{title:"Find Conversion Label",description:"From conversion tag"}),_(l,{title:"Configure Settings",description:"Enter details below"}),_(l,{title:"Test & Verify",description:"Confirm tracking works"})]),_:1},8,["active"]),b("div",Od,[_(d,{modelValue:n.activeStep,"onUpdate:modelValue":e[0]||(e[0]=R=>n.activeStep=R)},{default:w(()=>[_(u,{title:"Step 1: Get Your Conversion ID",name:"1"},{default:w(()=>e[7]||(e[7]=[b("ol",null,[b("li",null,[B("Log in to your "),b("a",{href:"https://ads.google.com",target:"_blank"},"Google Ads account")]),b("li",null,[B("Navigate to "),b("strong",null,"Tools & Settings > Conversions")]),b("li",null,"Click on your purchase conversion (or create one)"),b("li",null,[B("Find the "),b("strong",null,"Conversion ID"),B(" (9-10 digits)")]),b("li",null,"Copy and paste it in the field below")],-1)])),_:1}),_(u,{title:"Step 2: Find Your Conversion Label",name:"2"},{default:w(()=>e[8]||(e[8]=[b("ol",null,[b("li",null,"In the conversion details page"),b("li",null,[B("Click on "),b("strong",null,"Tag setup")]),b("li",null,[B("Choose "),b("strong",null,"Install the tag yourself")]),b("li",null,[B("In the Global site tag, find: "),b("code",null,"send_to: 'AW-123456789/AbCdEfGhIjKl'")]),b("li",null,[B("Copy the part after the slash (e.g., "),b("code",null,"AbCdEfGhIjKl"),B(")")])],-1)])),_:1})]),_:1},8,["modelValue"])])]),_:1})),_(C,{ref:"settingsForm",model:n.formData,rules:n.rules,"label-position":"top"},{default:w(()=>[_(k,{title:"Basic Configuration",icon:"el-icon-setting"},{default:w(()=>[_(v,{gutter:20},{default:w(()=>[_(p,{span:24},{default:w(()=>[_(f,{label:"Enable Google Ads Tracking",prop:"enabled"},{default:w(()=>[b("div",Id,[_(h,{"model-value":n.formData.enabled,"onUpdate:modelValue":e[1]||(e[1]=R=>n.updateFormField("enabled",R))},null,8,["model-value"]),e[9]||(e[9]=b("span",null,"Enable or disable Google Ads conversion tracking",-1))])]),_:1})]),_:1}),_(p,{span:24},{default:w(()=>[_(f,{label:"Conversion ID",prop:"conversion_id",required:""},{default:w(()=>[_(g,{"model-value":n.formData.conversion_id,"onUpdate:modelValue":e[2]||(e[2]=R=>n.updateFormField("conversion_id",R)),placeholder:"e.g., 123456789",maxlength:"10","show-word-limit":""},null,8,["model-value"]),e[10]||(e[10]=b("div",{class:"form-help"},[B(" Your Google Ads Conversion ID (9-10 digits, without AW- prefix) "),b("a",{href:"https://support.google.com/google-ads/answer/7548399",target:"_blank"},[b("i",{class:"el-icon-question"}),B(" Where to find this? ")])],-1))]),_:1})]),_:1}),_(p,{span:24},{default:w(()=>[_(f,{label:"Exclude User Roles"},{default:w(()=>[_(y,{"model-value":n.formData.excluded_roles,"onUpdate:modelValue":e[3]||(e[3]=R=>n.updateFormField("excluded_roles",R))},{default:w(()=>[_(m,{label:"administrator"},{default:w(()=>e[11]||(e[11]=[B("Administrator")])),_:1}),_(m,{label:"editor"},{default:w(()=>e[12]||(e[12]=[B("Editor")])),_:1}),_(m,{label:"author"},{default:w(()=>e[13]||(e[13]=[B("Author")])),_:1}),_(m,{label:"contributor"},{default:w(()=>e[14]||(e[14]=[B("Contributor")])),_:1})]),_:1},8,["model-value"]),e[15]||(e[15]=b("div",{class:"form-help"}," Exclude specific user roles from tracking ",-1))]),_:1})]),_:1})]),_:1})]),_:1}),_(k,{title:"Conversion Events",icon:"el-icon-data-line"},{default:w(()=>[e[17]||(e[17]=b("div",{class:"form-help",style:{"margin-bottom":"20px"}}," Enable specific conversion events and set their unique conversion labels from Google Ads. ",-1)),(x(!0),T(J,null,le(n.conversionEvents,R=>(x(),A(v,{key:R.key,class:ie(["conversion-event-row",{"htga4-pro-field-opacity":R.isPro&&!n.isProActive}]),onClick:E=>n.handleProFieldClick(E,R)},{default:w(()=>[_(p,{span:24},{default:w(()=>[_(f,{style:{"margin-bottom":"0"}},{label:w(()=>{var E,z;return[b("div",Fd,[b("div",Vd,[B(H(R.title)+" ",1),R.isPro&&!n.isProActive?(x(),A(P,{key:0,type:"danger",round:"",size:"small"},{default:w(()=>e[16]||(e[16]=[B("Pro")])),_:1})):U("",!0)]),_(h,{"model-value":(z=(E=n.formData.conversion_labels)==null?void 0:E[R.key])==null?void 0:z.enabled,"onUpdate:modelValue":j=>n.updateConversionLabel(R.key,"enabled",j),disabled:R.isPro&&!n.isProActive},null,8,["model-value","onUpdate:modelValue","disabled"])])]}),default:w(()=>{var E,z;return[(z=(E=n.formData.conversion_labels)==null?void 0:E[R.key])!=null&&z.enabled?(x(),T("div",$d,[_(f,{label:"Conversion Label",style:{"margin-bottom":"0"}},{default:w(()=>{var j,G;return[_(g,{"model-value":(G=(j=n.formData.conversion_labels)==null?void 0:j[R.key])==null?void 0:G.label,"onUpdate:modelValue":L=>n.updateConversionLabel(R.key,"label",L),placeholder:R.placeholder,disabled:R.isPro&&!n.isProActive,maxlength:"20"},null,8,["model-value","onUpdate:modelValue","placeholder","disabled"])]}),_:2},1024),b("div",zd,H(R.description),1)])):U("",!0)]}),_:2},1024)]),_:2},1024)]),_:2},1032,["class","onClick"]))),128))]),_:1})]),_:1},8,["model","rules"]),b("div",Bd,[_(O,{type:"success",loading:n.testing,disabled:!n.setupStatus.hasConversionId||!n.setupStatus.hasConversionLabel,onClick:n.testConversion},{default:w(()=>e[18]||(e[18]=[b("i",{class:"el-icon-video-play"},null,-1),B(" Test Conversion Tracking ")])),_:1},8,["loading","disabled","onClick"]),n.testResult.show?(x(),T("span",{key:0,class:ie(["test-result",n.testResult.type])},H(n.testResult.message),3)):U("",!0)])])}const Ud=ne(Dd,[["render",Nd],["__scopeId","data-v-a581c237"]]),Hd={class:"htga4-content-footer"},jd={__name:"ContentFooter",setup(t){const e=X(),s=Ve(),n=S(()=>e.state.isSaving),i=S(()=>!(["/settings/cache"].includes(s.path)||s.meta&&s.meta.hideFooterSaveButton)),o=async()=>{try{await e.dispatch("saveSettings"),Vt.success({message:"Settings saved successfully",offset:40,duration:3e3,showClose:!0})}catch(a){console.log(a),Vt.error({message:"Failed to save settings",offset:40,duration:3e3,showClose:!0})}};return(a,r)=>{const l=D("el-button");return oi((x(),T("div",Hd,[_(l,{type:"primary",onClick:o,loading:n.value},{default:w(()=>r[0]||(r[0]=[B("Save Changes")])),_:1},8,["loading"])],512)),[[ai,i.value]])}}},Wd={class:"htga4-content-header"},Gd={class:"htga4-content-header-left"},qd={class:"htga4-page-title"},Yd={class:"htga4-header-actions"},Xd={__name:"ContentHeader",setup(t){const e=X(),s=Ve(),n=S(()=>e.state.isSaving),i=S(()=>!(["/settings/tools","/settings/cache"].includes(s.path)||s.meta&&s.meta.hideHeaderSaveButton)),o=S(()=>!![].includes(s.path)),a=S(()=>{let l="",c="Settings";return l=s.path.replace("/settings/",""),l!=""?l=l+"_route":l="root_route",window.htga4SettingsSchema[l]!==void 0&&(c=window.htga4SettingsSchema[l].title),c}),r=async()=>{try{await e.dispatch("saveSettings"),Vt.success({message:"Settings saved successfully",offset:40,duration:3e3,showClose:!0})}catch(l){console.log(l),Vt.error({message:"Failed to save settings",offset:40,duration:3e3,showClose:!0})}};return(l,c)=>{const u=D("el-button");return x(),T("div",Wd,[b("div",Gd,[b("h2",qd,H(a.value),1)]),b("div",Yd,[oi(_(u,{type:"primary",onClick:r,disabled:o.value,loading:n.value},{default:w(()=>c[0]||(c[0]=[B("Save Changes")])),_:1},8,["disabled","loading"]),[[ai,i.value]])])])}}},Kd={__name:"Menu",setup(t){const e=Ve(),s=window.htga4Settings.menu,n=S(()=>e.path==="/settings/general"||e.path==="/settings"?"/settings/general":e.path),i=o=>({"/":On,"events-tracking":Xr,"custom-events":ha,"google-ads":Yr,"cookie-notice":qr,tools:Gr,cache:Wr})[o]||On;return(o,a)=>{const r=D("el-icon"),l=D("el-text"),c=D("el-menu-item"),u=D("el-menu");return x(),A(u,{class:"htga4-menu","background-color":"#fff","default-active":n.value,router:""},{default:w(()=>[(x(!0),T(J,null,le(I(s),(d,h)=>(x(),T(J,{key:h},[d.items?U("",!0):(x(),A(c,{key:0,index:h==="/"?"/settings/general":"/settings/"+h},{default:w(()=>[_(r,{size:"large"},{default:w(()=>[(x(),A(pa(i(h))))]),_:2},1024),_(l,{size:"large"},{default:w(()=>[B(H(d.title),1)]),_:2},1024)]),_:2},1032,["index"]))],64))),128))]),_:1},8,["default-active"])}}},Qd=ne(Kd,[["__scopeId","data-v-35d2711f"]]),Zd={class:"htga4-content-body"},Jd={__name:"Settings",setup(t){const e=X();return S(()=>e.state.isLoading),Ce(()=>{const s=new Event("hashchange",{bubbles:!0});window.dispatchEvent(s)}),(s,n)=>{const i=D("el-aside"),o=D("router-view"),a=D("el-main"),r=D("el-container");return x(),A(r,{class:"htga4-main-container"},{default:w(()=>[_(i,{width:"310px",class:"htga4-app-sidebar"},{default:w(()=>[_(Qd)]),_:1}),_(a,{class:"htga4-main-content"},{default:w(()=>[_(Xd),b("div",Zd,[_(o)]),_(jd)]),_:1})]),_:1})}}},eh={};function th(t,e){const s=D("router-view");return x(),T("div",null,[_(s)])}const sh=ne(eh,[["render",th]]);function nh(){const t=X(),e=se(!1),s=se("last30days"),n=se([]),i=se([]),o=se("last30days"),a=S(()=>{if(n.value&&n.value.length===2){const g=new Date(n.value[0]),m=new Date(n.value[1]);return`${g.toLocaleDateString()} - ${m.toLocaleDateString()}`}return"Select date range"}),r=S(()=>{switch(s.value){case"today":return"Today";case"yesterday":return"Yesterday";case"last7days":return"Last 7 days";case"last30days":return"Last 30 days";case"last90days":return"Last 90 days";case"last365days":return"Last 365 days";case"lastMonth":return"Last month";case"last12months":return"Last 12 months";case"lastYear":return"Last year";case"custom":return"Custom Range";default:return"Custom Range"}}),l=g=>{if(!g||!g.length||!g[0]||!g[1])return"All time";try{const m=new Date(g[0]),y=new Date(g[1]),v={month:"short",day:"numeric"};return`${m.toLocaleDateString("en-US",v)} - ${y.toLocaleDateString("en-US",v)}`}catch(m){return console.error("Error formatting date range:",m),"All time"}},c=g=>g>new Date,u=g=>{s.value=g;const m=new Date;let y=new Date(m),v;switch(g){case"today":v=new Date(m);break;case"yesterday":v=new Date(m),v.setDate(m.getDate()-1),y.setDate(m.getDate()-1);break;case"last7days":v=new Date(m),v.setDate(m.getDate()-6);break;case"last30days":v=new Date(m),v.setDate(m.getDate()-29);break;case"last90days":v=new Date(m),v.setDate(m.getDate()-89);break;case"last365days":v=new Date(m),v.setDate(m.getDate()-364);break;case"lastMonth":v=new Date(m.getFullYear(),m.getMonth()-1,1),y=new Date(m.getFullYear(),m.getMonth(),0);break;case"last12months":v=new Date(m),v.setMonth(m.getMonth()-11),v.setDate(1),y.setDate(m.getDate());break;case"lastYear":v=new Date(m.getFullYear()-1,0,1),y=new Date(m.getFullYear()-1,11,31);break;default:v=new Date(m),v.setDate(m.getDate()-29)}t.commit("setStartDate",v.toISOString().split("T")[0]),t.commit("setEndDate",y.toISOString().split("T")[0]),n.value=[v,y],t.commit("setDateRange",{0:v,1:y})},d=()=>{i.value=[...n.value],o.value=s.value,e.value=!0},h=()=>{n.value=[...i.value],s.value=o.value,e.value=!1},f=()=>{e.value=!1,i.value=[...n.value],o.value=s.value},p=(g,m)=>{g=new Date(g),m=new Date(m),g.setHours(0,0,0,0),m.setHours(0,0,0,0);const y=new Date;if(y.setHours(0,0,0,0),g.getTime()===y.getTime()&&m.getTime()===y.getTime())return s.value="today",!0;const v=new Date(y);if(v.setDate(y.getDate()-1),g.getTime()===v.getTime()&&m.getTime()===v.getTime())return s.value="yesterday",!0;const k=new Date(y);if(k.setDate(y.getDate()-6),g.getTime()===k.getTime()&&m.getTime()===y.getTime())return s.value="last7days",!0;const P=new Date(y);if(P.setDate(y.getDate()-29),g.getTime()===P.getTime()&&m.getTime()===y.getTime())return s.value="last30days",!0;const C=new Date(y);if(C.setDate(y.getDate()-89),g.getTime()===C.getTime()&&m.getTime()===y.getTime())return s.value="last90days",!0;const O=new Date(y);if(O.setDate(y.getDate()-364),g.getTime()===O.getTime()&&m.getTime()===y.getTime())return s.value="last365days",!0;const R=new Date(y.getFullYear(),y.getMonth()-1,1),E=new Date(y.getFullYear(),y.getMonth(),0);if(g.getTime()===R.getTime()&&m.getTime()===E.getTime())return s.value="lastMonth",!0;const z=new Date(y);if(z.setMonth(y.getMonth()-11),z.setDate(1),g.getTime()===z.getTime()&&m.getTime()===y.getTime())return s.value="last12months",!0;const j=new Date(y.getFullYear()-1,0,1),G=new Date(y.getFullYear()-1,11,31);return g.getTime()===j.getTime()&&m.getTime()===G.getTime()?(s.value="lastYear",!0):!1};return u("last30days"),{dateRange:n,datePreset:s,datePopoverVisible:e,selectedDateRangeText:a,datePresetName:r,selectPreset:u,openDatePopover:d,cancelDateSelection:h,applyDateFilter:f,checkIfDateRangeMatchesPreset:p,formatDateRangeLabel:l,disableFutureDates:c}}const ih={class:"htga4-date-picker"},oh={class:"htga4-date-picker__preset-name"},ah={class:"htga4-date-picker__range-text"},rh={class:"htga4-date-picker__content"},lh={class:"htga4-date-picker__calendar"},ch={class:"htga4-date-picker__presets"},uh={class:"htga4-date-picker__footer"},dh={__name:"DateRangePicker",props:{dateRange:{type:Array,default:()=>[]},datePreset:{type:String,default:"last30days"},datePopoverVisible:{type:Boolean,default:!1},selectedDateRangeText:{type:String,default:""},datePresetName:{type:String,default:"Last 30 days"}},emits:["update:dateRange","update:datePreset","update:datePopoverVisible","openDatePopover","cancelDateSelection","applyDateFilter","selectPreset"],setup(t,{emit:e}){const s=t,n=e,i=S({get:()=>s.dateRange,set:f=>n("update:dateRange",f)}),o=S({get:()=>s.datePreset,set:f=>n("update:datePreset",f)}),a=()=>{n("openDatePopover")},r=()=>{n("cancelDateSelection"),setTimeout(()=>{var f;(f=document.querySelector(".htga4-date-picker__button"))==null||f.focus()},50)},l=()=>{n("applyDateFilter"),setTimeout(()=>{var f;(f=document.querySelector(".htga4-date-picker__button"))==null||f.focus()},50)},c=f=>{o.value=f,n("selectPreset",f)},u=f=>f>new Date,d=()=>{setTimeout(()=>{var f;(f=document.querySelector(".htga4-date-picker__button"))==null||f.focus()},50)},h=f=>{if(s.datePopoverVisible){const p=document.querySelector(".htga4-date-picker__popover"),g=document.querySelector(".htga4-date-picker__button");p&&g&&!p.contains(f.target)&&!g.contains(f.target)&&!f.target.closest(".el-picker-panel")&&n("cancelDateSelection")}};return Ce(()=>{document.addEventListener("click",h)}),ga(()=>{document.removeEventListener("click",h)}),(f,p)=>{const g=D("el-icon"),m=D("el-date-picker"),y=D("el-col"),v=D("el-row"),k=D("el-button"),P=D("el-popover");return x(),T("div",ih,[_(P,{placement:"bottom",width:430,trigger:"manual","hide-after":0,teleported:!0,visible:t.datePopoverVisible,onClick:p[12]||(p[12]=dt(()=>{},["stop"])),onHide:d},{reference:w(()=>[b("div",{class:"htga4-date-picker__button",onClick:dt(a,["stop"]),tabindex:"0",role:"button","aria-haspopup":"true","aria-expanded":"datePopoverVisible"},[_(g,{class:"htga4-date-picker__calendar-icon"},{default:w(()=>[_(I(Kr))]),_:1}),p[13]||(p[13]=b("div",{class:"htga4-date-picker__separator"},null,-1)),b("div",oh,H(t.datePresetName),1),p[14]||(p[14]=b("div",{class:"htga4-date-picker__separator"},null,-1)),b("code",ah,H(t.selectedDateRangeText),1),_(g,{class:"htga4-date-picker__dropdown-icon"},{default:w(()=>[_(I(ma))]),_:1})])]),default:w(()=>[b("div",{class:"htga4-date-picker__popover",onClick:p[11]||(p[11]=dt(()=>{},["stop"]))},[b("div",rh,[b("div",lh,[_(m,{modelValue:i.value,"onUpdate:modelValue":p[0]||(p[0]=C=>i.value=C),type:"daterange","range-separator":"To","start-placeholder":"Start date","end-placeholder":"End date","disabled-date":u,onClick:p[1]||(p[1]=dt(()=>{},["stop"])),"popper-options":{modifiers:[{name:"preventOverflow",options:{boundary:"viewport"}}]}},null,8,["modelValue"])]),b("div",ch,[p[15]||(p[15]=b("h3",null,"Presets",-1)),_(v,{gutter:20},{default:w(()=>[_(y,{span:12},{default:w(()=>[b("div",{class:ie(["htga4-date-picker__preset-item",{"htga4-date-picker__preset-item--active":o.value==="today"}]),onClick:p[2]||(p[2]=C=>c("today"))}," Today ",2),b("div",{class:ie(["htga4-date-picker__preset-item",{"htga4-date-picker__preset-item--active":o.value==="yesterday"}]),onClick:p[3]||(p[3]=C=>c("yesterday"))}," Yesterday ",2),b("div",{class:ie(["htga4-date-picker__preset-item",{"htga4-date-picker__preset-item--active":o.value==="lastMonth"}]),onClick:p[4]||(p[4]=C=>c("lastMonth"))}," Last month ",2),b("div",{class:ie(["htga4-date-picker__preset-item",{"htga4-date-picker__preset-item--active":o.value==="last12months"}]),onClick:p[5]||(p[5]=C=>c("last12months"))}," Last 12 months ",2),b("div",{class:ie(["htga4-date-picker__preset-item",{"htga4-date-picker__preset-item--active":o.value==="lastYear"}]),onClick:p[6]||(p[6]=C=>c("lastYear"))}," Last year ",2)]),_:1}),_(y,{span:12},{default:w(()=>[b("div",{class:ie(["htga4-date-picker__preset-item",{"htga4-date-picker__preset-item--active":o.value==="last7days"}]),onClick:p[7]||(p[7]=C=>c("last7days"))}," Last 7 days ",2),b("div",{class:ie(["htga4-date-picker__preset-item",{"htga4-date-picker__preset-item--active":o.value==="last30days"}]),onClick:p[8]||(p[8]=C=>c("last30days"))}," Last 30 days ",2),b("div",{class:ie(["htga4-date-picker__preset-item",{"htga4-date-picker__preset-item--active":o.value==="last90days"}]),onClick:p[9]||(p[9]=C=>c("last90days"))}," Last 90 days ",2),b("div",{class:ie(["htga4-date-picker__preset-item",{"htga4-date-picker__preset-item--active":o.value==="last365days"}]),onClick:p[10]||(p[10]=C=>c("last365days"))}," Last 365 days ",2)]),_:1})]),_:1})]),b("div",uh,[_(k,{onClick:r},{default:w(()=>p[16]||(p[16]=[B("Cancel")])),_:1}),_(k,{type:"primary",onClick:l},{default:w(()=>p[17]||(p[17]=[B("Update")])),_:1})])])])]),_:1},8,["visible"])])}}},hh=ne(dh,[["__scopeId","data-v-94e6146f"]]),fh={class:"htga4-date-controls"},ph={__name:"DateControls",emits:["data-loaded"],setup(t,{expose:e,emit:s}){const n=rn(),i=X(),{dateRange:o,datePreset:a,datePopoverVisible:r,selectedDateRangeText:l,datePresetName:c,selectPreset:u,openDatePopover:d,cancelDateSelection:h,applyDateFilter:f,checkIfDateRangeMatchesPreset:p}=nh();Me(o,v=>{v&&v.length===2?p(v[0],v[1])||(a.value="custom"):(!v||v.length===0)&&u("last30days")});const g=S(()=>n.currentRoute.value.name),m=()=>{f();const v=k=>k.toISOString().split("T")[0];i.commit("setStartDate",v(new Date(o.value[0]))),i.commit("setEndDate",v(new Date(o.value[1]))),i.commit("setDateRange",{0:o.value[0],1:o.value[1]}),g.value==="ecommerce"?i.dispatch("fetchEcommerceReports",{startDate:i.state.startDate,endDate:i.state.endDate}):g.value==="standard"&&i.dispatch("fetchStandardReports",{startDate:i.state.startDate,endDate:i.state.endDate})};return e({initialize:async()=>{u("last30days")}}),(v,k)=>(x(),T("div",fh,[_(hh,{"date-range":I(o),"onUpdate:dateRange":k[0]||(k[0]=P=>_n(o)?o.value=P:null),"date-preset":I(a),"onUpdate:datePreset":k[1]||(k[1]=P=>_n(a)?a.value=P:null),"date-popover-visible":I(r),"onUpdate:datePopoverVisible":k[2]||(k[2]=P=>_n(r)?r.value=P:null),"selected-date-range-text":I(l),"date-preset-name":I(c),onOpenDatePopover:I(d),onCancelDateSelection:I(h),onApplyDateFilter:m,onSelectPreset:I(u)},null,8,["date-range","date-preset","date-popover-visible","selected-date-range-text","date-preset-name","onOpenDatePopover","onCancelDateSelection","onSelectPreset"])]))}},gh=ne(ph,[["__scopeId","data-v-dfed0296"]]),mh={class:"htga4-sync-button"},_h={__name:"SyncButton",props:{label:{type:String,default:"Sync"},size:{type:String,default:"medium"}},emits:["sync-complete"],setup(t,{emit:e}){const s=t,n=e,i=X(),o=rn(),a=se(!1),r=S(()=>o.currentRoute.value.name),l=async()=>{try{a.value=!0;const c=!0;r.value==="ecommerce"?await i.dispatch("fetchEcommerceReports",{startDate:i.state.startDate,endDate:i.state.endDate,forceRefresh:c}):r.value==="realtime"?await i.dispatch("fetchRealtimeReports",c):await i.dispatch("fetchStandardReports",{startDate:i.state.startDate,endDate:i.state.endDate,forceRefresh:c}),In({message:"Data refreshed successfully",type:"success",offset:40}),n("sync-complete")}catch(c){In({message:"Failed to refresh data: "+(c.message||"Unknown error"),type:"error",offset:40}),i.state.environmentType==="development"&&console.error("Sync error:",c)}finally{a.value=!1}};return(c,u)=>{const d=D("el-button");return x(),T("div",mh,[_(as,{content:"* Force refresh data (clears cache) <br>* Data is cached for 1 hour",placement:"top"},{default:w(()=>[_(d,{class:"htga4-sync-button__button",icon:I(fa),type:"primary",size:s.size,loading:a.value,onClick:l},{default:w(()=>[B(H(t.label),1)]),_:1},8,["icon","size","loading"])]),_:1})])}}},Na=ne(_h,[["__scopeId","data-v-d810285f"]]),vh={key:0,class:"htga4-user-card__skeleton"},bh={class:"htga4-user-card__content"},yh={class:"htga4-user-card__thumb"},xh={class:"htga4-user-card__info",style:{width:"140px"}},wh={key:1,class:"htga4-user-card__content"},Sh={class:"htga4-user-card__thumb"},kh=["src"],Ch={class:"htga4-user-card__info"},Ph={class:"htga4-user-card__name"},Dh={class:"htga4-user-card__email"},Rh={class:"htga4-user-card__property"},Mh={__name:"UserProfileCard",setup(t){const e=X(),s=S(()=>e.state.userProfile),n=S(()=>{var a;return((a=e.state.dataStream)==null?void 0:a.displayName)||""}),i=S(()=>{var a,r;return((r=(a=e.state.dataStream)==null?void 0:a.webStreamData)==null?void 0:r.measurementId)||""}),o=S(()=>e.state.loading);return(a,r)=>{const l=D("el-skeleton-item"),c=D("el-skeleton"),u=D("el-card");return x(),A(u,{class:"htga4-user-card","body-style":{padding:"0"},shadow:"never"},{default:w(()=>[o.value?(x(),T("div",vh,[_(c,{style:{width:"100%"},animated:""},{template:w(()=>[b("div",bh,[b("div",yh,[_(l,{variant:"circle",style:{width:"50px",height:"50px"}})]),b("div",xh,[_(l,{variant:"p",style:{width:"50%"}}),_(l,{variant:"p",style:{width:"60%"}}),_(l,{variant:"p",style:{width:"70%"}})])])]),_:1})])):(x(),T("div",wh,[b("div",Sh,[b("img",{src:s.value.profileImage,alt:"User profile"},null,8,kh)]),b("div",Ch,[b("h3",Ph,H(s.value.name),1),b("p",Dh,H(s.value.email),1),b("p",Rh,H(n.value)+" <"+H(i.value)+">",1)])]))]),_:1})}}},Ua=ne(Mh,[["__scopeId","data-v-0ea4092e"]]),Ah={class:"htga4-report-header"},Th={class:"htga4-report-header__controls"},Eh={__name:"ReportHeader",emits:["analytics-data-updated"],setup(t,{expose:e,emit:s}){const n=rn(),i=S(()=>!n.currentRoute.value.path.includes("real-time")),o=se(null),a=s,r=()=>{a("analytics-data-updated")};return e({initialize:async()=>{await o.value.initialize()}}),(l,c)=>(x(),T("div",Ah,[_(Ua),b("div",Th,[_(Na,{onSyncComplete:c[0]||(c[0]=u=>a("data-loaded"))}),i.value?(x(),A(gh,{key:0,ref_key:"dateControlsRef",ref:o,onDataUpdated:r},null,512)):U("",!0)])]))}},Ha=ne(Eh,[["__scopeId","data-v-f6e590ae"]]);/*!9 */var Ta="store";function X(t){return t===void 0&&(t=null),pt(t!==null?t:Ta)}function Ht(t,e){Object.keys(t).forEach(function(s){return e(t[s],s)})}function mc(t){return t!==null&&typeof t=="object"}function _c(t){return t&&typeof t.then=="function"}function vc(t,e){return function(){return t(e)}}function Ea(t,e,s){return e.indexOf(t)<0&&(s&&s.prepend?e.unshift(t):e.push(t)),function(){var n=e.indexOf(t);n>-1&&e.splice(n,1)}}function La(t,e){t._actions=Object.create(null),t._mutations=Object.create(null),t._wrappedGetters=Object.create(null),t._modulesNamespaceMap=Object.create(null);var s=t.state;ln(t,s,[],t._modules.root,!0),ci(t,s,e)}function ci(t,e,s){var n=t._state,i=t._scope;t.getters={},t._makeLocalGettersCache=Object.create(null);var o=t._wrappedGetters,a={},r={},l=$r(!0);l.run(function(){Ht(o,function(c,u){a[u]=vc(c,t),r[u]=S(function(){return a[u]()}),Object.defineProperty(t.getters,u,{get:function(){return r[u].value},enumerable:!0})})}),t._state=ua({data:e}),t._scope=l,t.strict&&Sc(t),n&&s&&t._withCommit(function(){n.data=null}),i&&i.stop()}function ln(t,e,s,n,i){var o=!s.length,a=t._modules.getNamespace(s);if(n.namespaced&&(t._modulesNamespaceMap[a],t._modulesNamespaceMap[a]=n),!o&&!i){var r=ui(e,s.slice(0,-1)),l=s[s.length-1];t._withCommit(function(){r[l]=n.state})}var c=n.context=bc(t,a,s);n.forEachMutation(function(u,d){var h=a+d;yc(t,h,u,c)}),n.forEachAction(function(u,d){var h=u.root?d:a+d,f=u.handler||u;xc(t,h,f,c)}),n.forEachGetter(function(u,d){var h=a+d;wc(t,h,u,c)}),n.forEachChild(function(u,d){ln(t,e,s.concat(d),u,i)})}function bc(t,e,s){var n=e==="",i={dispatch:n?t.dispatch:function(o,a,r){var l=Gs(o,a,r),c=l.payload,u=l.options,d=l.type;return(!u||!u.root)&&(d=e+d),t.dispatch(d,c)},commit:n?t.commit:function(o,a,r){var l=Gs(o,a,r),c=l.payload,u=l.options,d=l.type;(!u||!u.root)&&(d=e+d),t.commit(d,c,u)}};return Object.defineProperties(i,{getters:{get:n?function(){return t.getters}:function(){return Oa(t,e)}},state:{get:function(){return ui(t.state,s)}}}),i}function Oa(t,e){if(!t._makeLocalGettersCache[e]){var s={},n=e.length;Object.keys(t.getters).forEach(function(i){if(i.slice(0,n)===e){var o=i.slice(n);Object.defineProperty(s,o,{get:function(){return t.getters[i]},enumerable:!0})}}),t._makeLocalGettersCache[e]=s}return t._makeLocalGettersCache[e]}function yc(t,e,s,n){var i=t._mutations[e]||(t._mutations[e]=[]);i.push(function(a){s.call(t,n.state,a)})}function xc(t,e,s,n){var i=t._actions[e]||(t._actions[e]=[]);i.push(function(a){var r=s.call(t,{dispatch:n.dispatch,commit:n.commit,getters:n.getters,state:n.state,rootGetters:t.getters,rootState:t.state},a);return _c(r)||(r=Promise.resolve(r)),t._devtoolHook?r.catch(function(l){throw t._devtoolHook.emit("vuex:error",l),l}):r})}function wc(t,e,s,n){t._wrappedGetters[e]||(t._wrappedGetters[e]=function(o){return s(n.state,n.getters,o.state,o.getters)})}function Sc(t){Me(function(){return t._state.data},function(){},{deep:!0,flush:"sync"})}function ui(t,e){return e.reduce(function(s,n){return s[n]},t)}function Gs(t,e,s){return mc(t)&&t.type&&(s=e,e=t,t=t.type),{type:t,payload:e,options:s}}var kc="vuex bindings",qi="vuex:mutations",xn="vuex:actions",Dt="vuex",Cc=0;function Pc(t,e){dl({id:"org.vuejs.vuex",app:t,label:"Vuex",homepage:"https://next.vuex.vuejs.org/",logo:"https://vuejs.org/images/icons/favicon-96x96.png",packageName:"vuex",componentStateTypes:[kc]},function(s){s.addTimelineLayer({id:qi,label:"Vuex Mutations",color:Yi}),s.addTimelineLayer({id:xn,label:"Vuex Actions",color:Yi}),s.addInspector({id:Dt,label:"Vuex",icon:"storage",treeFilterPlaceholder:"Filter stores..."}),s.on.getInspectorTree(function(n){if(n.app===t&&n.inspectorId===Dt)if(n.filter){var i=[];$a(i,e._modules.root,n.filter,""),n.rootNodes=i}else n.rootNodes=[Va(e._modules.root,"")]}),s.on.getInspectorState(function(n){if(n.app===t&&n.inspectorId===Dt){var i=n.nodeId;Oa(e,i),n.state=Mc(Tc(e._modules,i),i==="root"?e.getters:e._makeLocalGettersCache,i)}}),s.on.editInspectorState(function(n){if(n.app===t&&n.inspectorId===Dt){var i=n.nodeId,o=n.path;i!=="root"&&(o=i.split("/").filter(Boolean).concat(o)),e._withCommit(function(){n.set(e._state.data,o,n.state.value)})}}),e.subscribe(function(n,i){var o={};n.payload&&(o.payload=n.payload),o.state=i,s.notifyComponentUpdate(),s.sendInspectorTree(Dt),s.sendInspectorState(Dt),s.addTimelineEvent({layerId:qi,event:{time:Date.now(),title:n.type,data:o}})}),e.subscribeAction({before:function(n,i){var o={};n.payload&&(o.payload=n.payload),n._id=Cc++,n._time=Date.now(),o.state=i,s.addTimelineEvent({layerId:xn,event:{time:n._time,title:n.type,groupId:n._id,subtitle:"start",data:o}})},after:function(n,i){var o={},a=Date.now()-n._time;o.duration={_custom:{type:"duration",display:a+"ms",tooltip:"Action duration",value:a}},n.payload&&(o.payload=n.payload),o.state=i,s.addTimelineEvent({layerId:xn,event:{time:Date.now(),title:n.type,groupId:n._id,subtitle:"end",data:o}})}})})}var Yi=8702998,Dc=6710886,Rc=16777215,Ia={label:"namespaced",textColor:Rc,backgroundColor:Dc};function Fa(t){return t&&t!=="root"?t.split("/").slice(-2,-1)[0]:"Root"}function Va(t,e){return{id:e||"root",label:Fa(e),tags:t.namespaced?[Ia]:[],children:Object.keys(t._children).map(function(s){return Va(t._children[s],e+s+"/")})}}function $a(t,e,s,n){n.includes(s)&&t.push({id:n||"root",label:n.endsWith("/")?n.slice(0,n.length-1):n||"Root",tags:e.namespaced?[Ia]:[]}),Object.keys(e._children).forEach(function(i){$a(t,e._children[i],s,n+i+"/")})}function Mc(t,e,s){e=s==="root"?e:e[s];var n=Object.keys(e),i={state:Object.keys(t.state).map(function(a){return{key:a,editable:!0,value:t.state[a]}})};if(n.length){var o=Ac(e);i.getters=Object.keys(o).map(function(a){return{key:a.endsWith("/")?Fa(a):a,editable:!1,value:Un(function(){return o[a]})}})}return i}function Ac(t){var e={};return Object.keys(t).forEach(function(s){var n=s.split("/");if(n.length>1){var i=e,o=n.pop();n.forEach(function(a){i[a]||(i[a]={_custom:{value:{},display:a,tooltip:"Module",abstract:!0}}),i=i[a]._custom.value}),i[o]=Un(function(){return t[s]})}else e[s]=Un(function(){return t[s]})}),e}function Tc(t,e){var s=e.split("/").filter(function(n){return n});return s.reduce(function(n,i,o){var a=n[i];if(!a)throw new Error('Missing module "'+i+'" for path "'+e+'".');return o===s.length-1?a:a._children},e==="root"?t:t.root._children)}function Un(t){try{return t()}catch(e){return e}}var Ge=function(e,s){this.runtime=s,this._children=Object.create(null),this._rawModule=e;var n=e.state;this.state=(typeof n=="function"?n():n)||{}},za={namespaced:{configurable:!0}};za.namespaced.get=function(){return!!this._rawModule.namespaced};Ge.prototype.addChild=function(e,s){this._children[e]=s};Ge.prototype.removeChild=function(e){delete this._children[e]};Ge.prototype.getChild=function(e){return this._children[e]};Ge.prototype.hasChild=function(e){return e in this._children};Ge.prototype.update=function(e){this._rawModule.namespaced=e.namespaced,e.actions&&(this._rawModule.actions=e.actions),e.mutations&&(this._rawModule.mutations=e.mutations),e.getters&&(this._rawModule.getters=e.getters)};Ge.prototype.forEachChild=function(e){Ht(this._children,e)};Ge.prototype.forEachGetter=function(e){this._rawModule.getters&&Ht(this._rawModule.getters,e)};Ge.prototype.forEachAction=function(e){this._rawModule.actions&&Ht(this._rawModule.actions,e)};Ge.prototype.forEachMutation=function(e){this._rawModule.mutations&&Ht(this._rawModule.mutations,e)};Object.defineProperties(Ge.prototype,za);var kt=function(e){this.register([],e,!1)};kt.prototype.get=function(e){return e.reduce(function(s,n){return s.getChild(n)},this.root)};kt.prototype.getNamespace=function(e){var s=this.root;return e.reduce(function(n,i){return s=s.getChild(i),n+(s.namespaced?i+"/":"")},"")};kt.prototype.update=function(e){Ba([],this.root,e)};kt.prototype.register=function(e,s,n){var i=this;n===void 0&&(n=!0);var o=new Ge(s,n);if(e.length===0)this.root=o;else{var a=this.get(e.slice(0,-1));a.addChild(e[e.length-1],o)}s.modules&&Ht(s.modules,function(r,l){i.register(e.concat(l),r,n)})};kt.prototype.unregister=function(e){var s=this.get(e.slice(0,-1)),n=e[e.length-1],i=s.getChild(n);i&&i.runtime&&s.removeChild(n)};kt.prototype.isRegistered=function(e){var s=this.get(e.slice(0,-1)),n=e[e.length-1];return s?s.hasChild(n):!1};function Ba(t,e,s){if(e.update(s),s.modules)for(var n in s.modules){if(!e.getChild(n))return;Ba(t.concat(n),e.getChild(n),s.modules[n])}}function Ec(t){return new Ie(t)}var Ie=function(e){var s=this;e===void 0&&(e={});var n=e.plugins;n===void 0&&(n=[]);var i=e.strict;i===void 0&&(i=!1);var o=e.devtools;this._committing=!1,this._actions=Object.create(null),this._actionSubscribers=[],this._mutations=Object.create(null),this._wrappedGetters=Object.create(null),this._modules=new kt(e),this._modulesNamespaceMap=Object.create(null),this._subscribers=[],this._makeLocalGettersCache=Object.create(null),this._scope=null,this._devtools=o;var a=this,r=this,l=r.dispatch,c=r.commit;this.dispatch=function(h,f){return l.call(a,h,f)},this.commit=function(h,f,p){return c.call(a,h,f,p)},this.strict=i;var u=this._modules.root.state;ln(this,u,[],this._modules.root),ci(this,u),n.forEach(function(d){return d(s)})},di={state:{configurable:!0}};Ie.prototype.install=function(e,s){e.provide(s||Ta,this),e.config.globalProperties.$store=this;var n=this._devtools!==void 0?this._devtools:!1;n&&Pc(e,this)};di.state.get=function(){return this._state.data};di.state.set=function(t){};Ie.prototype.commit=function(e,s,n){var i=this,o=Gs(e,s,n),a=o.type,r=o.payload,l={type:a,payload:r},c=this._mutations[a];c&&(this._withCommit(function(){c.forEach(function(d){d(r)})}),this._subscribers.slice().forEach(function(u){return u(l,i.state)}))};Ie.prototype.dispatch=function(e,s){var n=this,i=Gs(e,s),o=i.type,a=i.payload,r={type:o,payload:a},l=this._actions[o];if(l){try{this._actionSubscribers.slice().filter(function(u){return u.before}).forEach(function(u){return u.before(r,n.state)})}catch{}var c=l.length>1?Promise.all(l.map(function(u){return u(a)})):l[0](a);return new Promise(function(u,d){c.then(function(h){try{n._actionSubscribers.filter(function(f){return f.after}).forEach(function(f){return f.after(r,n.state)})}catch{}u(h)},function(h){try{n._actionSubscribers.filter(function(f){return f.error}).forEach(function(f){return f.error(r,n.state,h)})}catch{}d(h)})})}};Ie.prototype.subscribe=function(e,s){return Ea(e,this._subscribers,s)};Ie.prototype.subscribeAction=function(e,s){var n=typeof e=="function"?{before:e}:e;return Ea(n,this._actionSubscribers,s)};Ie.prototype.watch=function(e,s,n){var i=this;return Me(function(){return e(i.state,i.getters)},s,Object.assign({},n))};Ie.prototype.replaceState=function(e){var s=this;this._withCommit(function(){s._state.data=e})};Ie.prototype.registerModule=function(e,s,n){n===void 0&&(n={}),typeof e=="string"&&(e=[e]),this._modules.register(e,s),ln(this,this.state,e,this._modules.get(e),n.preserveState),ci(this,this.state)};Ie.prototype.unregisterModule=function(e){var s=this;typeof e=="string"&&(e=[e]),this._modules.unregister(e),this._withCommit(function(){var n=ui(s.state,e.slice(0,-1));delete n[e[e.length-1]]}),La(this)};Ie.prototype.hasModule=function(e){return typeof e=="string"&&(e=[e]),this._modules.isRegistered(e)};Ie.prototype.hotUpdate=function(e){this._modules.update(e),La(this,!0)};Ie.prototype._withCommit=function(e){var s=this._committing;this._committing=!0,e(),this._committing=s};Object.defineProperties(Ie.prototype,di);const Lc={__name:"TextField",props:{fieldSchema:{type:Object,required:!0},modelValue:{required:!0},disabled:{type:Boolean,default:!1}},emits:["update:modelValue"],setup(t,{emit:e}){const s=t,n=e,i=S({get(){return s.modelValue},set(r){if(s.fieldSchema.type==="number"){let l=Number(r);if(l<0){const c=o.value??0,u=a.value??Number.MAX_SAFE_INTEGER;l=Math.min(Math.abs(l),u),l=Math.max(l,c),r=l.toString()}}n("update:modelValue",r)}}),o=S(()=>{var r;return((r=s.fieldSchema.attributes)==null?void 0:r.min)??void 0}),a=S(()=>{var r;return((r=s.fieldSchema.attributes)==null?void 0:r.max)??void 0});return(r,l)=>{const c=D("el-input");return x(),A(c,{modelValue:i.value,"onUpdate:modelValue":l[0]||(l[0]=u=>i.value=u),type:t.fieldSchema.type==="textarea"?"textarea":t.fieldSchema.type,min:o.value,max:a.value,placeholder:t.fieldSchema.placeholder,disabled:s.disabled},Ss({_:2},[t.fieldSchema.suffix?{name:"suffix",fn:w(()=>[B(H(t.fieldSchema.suffix),1)]),key:"0"}:void 0]),1032,["modelValue","type","min","max","placeholder","disabled"])}}},ne=(t,e)=>{const s=t.__vccOpts||t;for(const[n,i]of e)s[n]=i;return s},Oc={__name:"SelectField",props:{fieldSchema:{type:Object,required:!0},modelValue:{default:""}},emits:["update:modelValue"],setup(t,{emit:e}){var m;const s=X(),n=se(""),i=y=>{y||(n.value="")},o=t,a=e;!o.fieldSchema.is_pro&&!((m=o.fieldSchema.class)!=null&&m.includes("htga4-pro-field-opacity"))&&(o.fieldSchema.options==="roles"?s.dispatch("fetchRoles"):o.fieldSchema.options==="accounts"&&s.dispatch("fetchAccounts"));const r=S(()=>s.getters.getRoles),l=S(()=>s.getters.getAccounts),c=S(()=>s.getters.getProperties),u=S(()=>s.getters.getDataStreams),d=S(()=>s.getters.getMeasurementProtocolSecrets),h=S(()=>s.state.isLoading),f=S(()=>{if(!h.value)return!1;const y=o.fieldSchema.options;return y==="accounts"?Object.keys(l.value).length===0:y==="properties"?Object.keys(c.value).length===0&&s.state.settings.account:y==="data_streams"?Object.keys(u.value).length===0&&s.state.settings.property:y==="measurement_protocol_secrets"?Object.keys(d.value).length===0&&s.state.settings.data_stream_id:y==="roles"?Object.keys(r.value).length===0:!1}),p=S(()=>{if(!n.value)return l.value;const y=n.value.toLowerCase(),b={};for(const[k,P]of Object.entries(l.value))P.toLowerCase().includes(y)&&(b[k]=P);return b});Me(()=>o.modelValue,(y,b)=>{if(o.fieldSchema.options==="accounts"&&y){if(y===b)return;b&&(s.commit("updateSetting",{key:"property",value:""}),s.commit("updateSetting",{key:"data_stream_id",value:""})),s.dispatch("fetchProperties",{forceRefresh:!0})}}),Me(()=>o.modelValue,(y,b)=>{if(o.fieldSchema.options==="properties"&&y){if(y===b)return;b&&(s.commit("updateSetting",{key:"data_stream_id",value:""}),s.commit("updateSetting",{key:"measurement_id",value:""})),s.dispatch("fetchDataStreams",{forceRefresh:!0})}}),Me(()=>o.modelValue,(y,b)=>{if(o.fieldSchema.options==="data_streams"&&y){if(y===b)return;const k=s.state.settings;k.auth_google&&k.auth_google!==""&&(s.dispatch("fetchAndPopulateMeasurementId"),b&&s.commit("updateSetting",{key:"measurement_protocol_api_secret",value:""}),s.dispatch("fetchMeasurementProtocolSecrets",{forceRefresh:!0}))}});const g=S({get(){return o.modelValue},set(y){a("update:modelValue",y)}});return Ce(()=>{if(o.fieldSchema.options==="data_streams"&&o.modelValue){const y=s.state.settings,b=y.auth_google&&y.auth_google!=="",k=y.measurement_id||"";b&&!k&&s.dispatch("fetchAndPopulateMeasurementId")}}),(y,b)=>{const k=D("el-input"),P=D("el-option"),C=D("el-option-group"),O=D("el-select");return x(),A(O,{modelValue:g.value,"onUpdate:modelValue":b[3]||(b[3]=R=>g.value=R),placeholder:t.fieldSchema.placeholder||"Select an option",loading:f.value,multiple:t.fieldSchema.multiple||!1,"empty-values":[null,void 0],onVisibleChange:i},Ss({default:w(()=>[typeof t.fieldSchema.options=="object"?(x(!0),T(J,{key:0},le(t.fieldSchema.options,(R,E)=>(x(),T(J,{key:E},[typeof R=="string"?(x(),A(P,{key:0,label:R,value:E},null,8,["label","value"])):(x(),A(C,{key:1,label:E},{label:w(()=>[_("span",null,H(E),1)]),default:w(()=>[(x(!0),T(J,null,le(R,(z,j)=>(x(),A(P,{key:j,label:z,value:j},null,8,["label","value"]))),128))]),_:2},1032,["label"]))],64))),128)):N("",!0),t.fieldSchema.options==="roles"?(x(!0),T(J,{key:1},le(r.value,(R,E)=>(x(),A(P,{key:E,label:R,value:E},null,8,["label","value"]))),128)):N("",!0),t.fieldSchema.options==="accounts"?(x(!0),T(J,{key:2},le(p.value,(R,E)=>(x(),A(P,{key:E,label:R,value:E},null,8,["label","value"]))),128)):N("",!0),t.fieldSchema.options==="properties"?(x(!0),T(J,{key:3},le(c.value,(R,E)=>(x(),A(P,{key:E,label:R,value:E},null,8,["label","value"]))),128)):N("",!0),t.fieldSchema.options==="data_streams"?(x(!0),T(J,{key:4},le(u.value,(R,E)=>(x(),A(P,{key:E,label:R,value:E},null,8,["label","value"]))),128)):N("",!0),t.fieldSchema.options==="measurement_protocol_secrets"?(x(!0),T(J,{key:5},le(d.value,(R,E)=>(x(),A(P,{key:E,label:R,value:E},null,8,["label","value"]))),128)):N("",!0)]),_:2},[t.fieldSchema.searchable?{name:"header",fn:w(()=>[v(k,{modelValue:n.value,"onUpdate:modelValue":b[0]||(b[0]=R=>n.value=R),placeholder:"Type to search...",clearable:"",size:"small",class:"select-search-input",onClick:b[1]||(b[1]=dt(()=>{},["stop"])),onKeydown:b[2]||(b[2]=dt(()=>{},["stop"]))},null,8,["modelValue"])]),key:"0"}:void 0]),1032,["modelValue","placeholder","loading","multiple"])}}},Ic=ne(Oc,[["__scopeId","data-v-157b8ac0"]]),Fc={__name:"ColorField",props:{fieldSchema:{type:Object,required:!0},modelValue:{required:!0}},emits:["update:modelValue"],setup(t,{emit:e}){const s=t,n=e,i=a=>{if(!a){n("update:modelValue","");return}n("update:modelValue",a)},o=S({get(){return s.modelValue},set(a){n("update:modelValue",a)}});return(a,r)=>{const l=D("el-color-picker");return x(),A(l,{modelValue:o.value,"onUpdate:modelValue":r[0]||(r[0]=c=>o.value=c),"show-alpha":"",onActiveChange:i},null,8,["modelValue"])}}},Vc={__name:"CheckboxField",props:{fieldSchema:{type:Object,required:!0},modelValue:{required:!0}},emits:["update:modelValue"],setup(t,{emit:e}){const s=t,n=e,i=S({get(){return s.fieldSchema.options?Array.isArray(s.modelValue)?s.modelValue:s.modelValue?s.modelValue.split(","):[]:s.modelValue==="1"||s.modelValue===1},set(o){s.fieldSchema.options?n("update:modelValue",Array.isArray(o)?o.join(","):o):n("update:modelValue",o?"1":"0")}});return(o,a)=>{const r=D("el-checkbox"),l=D("el-checkbox-group");return t.fieldSchema.options?(x(),A(l,{key:0,modelValue:i.value,"onUpdate:modelValue":a[0]||(a[0]=c=>i.value=c)},{default:w(()=>[(x(!0),T(J,null,le(t.fieldSchema.options,(c,u)=>(x(),A(r,{key:u,label:u,size:"medium"},{default:w(()=>[B(H(c),1)]),_:2},1032,["label"]))),128))]),_:1},8,["modelValue"])):(x(),A(r,{key:1,size:"medium",modelValue:i.value,"onUpdate:modelValue":a[1]||(a[1]=c=>i.value=c),label:t.fieldSchema.label},null,8,["modelValue","label"]))}}},$c={__name:"SwitchField",props:{fieldSchema:{type:Object,required:!0},modelValue:{required:!0}},emits:["update:modelValue"],setup(t,{emit:e}){const s=t,n=e,i=S({get(){return Number(s.modelValue)},set(o){n("update:modelValue",String(o))}});return(o,a)=>{const r=D("el-switch");return x(),A(r,{modelValue:i.value,"onUpdate:modelValue":a[0]||(a[0]=l=>i.value=l),"inline-prompt":"","active-text":t.fieldSchema.label||"Yes","inactive-text":t.fieldSchema.label||"No","active-value":1,"inactive-value":0,"active-icon":I(si),"inactive-icon":I(zr)},null,8,["modelValue","active-text","inactive-text","active-icon","inactive-icon"])}}},zc={__name:"RadioField",props:{fieldSchema:{type:Object,required:!0},modelValue:{required:!0}},emits:["update:modelValue"],setup(t,{emit:e}){const s=t,n=e,i=S({get(){return s.modelValue},set(o){n("update:modelValue",o)}});return(o,a)=>{const r=D("el-radio"),l=D("el-radio-group");return x(),A(l,{modelValue:i.value,"onUpdate:modelValue":a[0]||(a[0]=c=>i.value=c)},{default:w(()=>[(x(!0),T(J,null,le(t.fieldSchema.options,(c,u)=>(x(),A(r,{key:u,value:u},{default:w(()=>[B(H(c),1)]),_:2},1032,["value"]))),128))]),_:1},8,["modelValue"])}}},Bc={class:"htga4-tabbed-field"},Nc={class:"tab-content"},Uc={__name:"TabbedField",props:{modelValue:{type:Object,default:()=>({})},fieldSchema:{type:Object,required:!0}},emits:["update:modelValue"],setup(t,{emit:e}){const s=t,n=e,i=se("0"),o=se({});return Me(()=>s.modelValue,a=>{o.value={...a}},{immediate:!0,deep:!0}),Me(o,a=>{n("update:modelValue",a)},{deep:!0}),(a,r)=>{const l=D("el-tab-pane"),c=D("el-tabs");return x(),T("div",Bc,[v(c,{modelValue:i.value,"onUpdate:modelValue":r[0]||(r[0]=u=>i.value=u)},{default:w(()=>[(x(!0),T(J,null,le(t.fieldSchema.tabs,(u,d)=>(x(),A(l,{key:d,name:d.toString()},{label:w(()=>[u.icon?(x(),T("i",{key:0,class:ie(u.icon)},null,2)):N("",!0),_("span",null,H(u.title),1)]),default:w(()=>[_("div",Nc,[(x(!0),T(J,null,le(u.fields,h=>(x(),A(we,{key:h.id,modelValue:o.value[h.id],"onUpdate:modelValue":f=>o.value[h.id]=f,fieldSchema:h},null,8,["modelValue","onUpdate:modelValue","fieldSchema"]))),128))])]),_:2},1032,["name"]))),128))]),_:1},8,["modelValue"])])}}},Hc={class:"htga4-editor-field"},jc={class:"htga4-editor-tabs"},Wc={class:"htga4-editor-container"},Gc=["value"],qc={__name:"EditorField",props:{fieldSchema:{type:Object,required:!0},modelValue:{required:!0}},emits:["update:modelValue"],setup(t,{emit:e}){const s={height:200,skin:"lightgray",theme:"modern",menubar:!1,statusbar:!1,branding:!1,plugins:"charmap colorpicker hr lists paste tabfocus textcolor fullscreen wordpress wpautoresize wpeditimage wpemoji wpgallery wplink wptextpattern",toolbar1:"formatselect bold italic bullist numlist blockquote alignleft aligncenter alignright link unlink wp_more wp_adv dfw",toolbar2:"strikethrough hr forecolor pastetext removeformat charmap outdent indent undo redo wp_help",force_br_newlines:!0,force_p_newlines:!1,forced_root_block:""},n=t,i=e,o=se(!1),a=se(null);let r=null;const l=S(()=>n.modelValue||""),c=()=>{if(o.value){const f=a.value.value.replace(/\n/g,"<br>");i("update:modelValue",f),o.value=!1,h()}},u=()=>{if(!o.value){const f=((r==null?void 0:r.getContent())||"").replace(/<br\s*\/?>/g,` 10 `);r==null||r.destroy(),r=null,a.value.value=f,i("update:modelValue",f),o.value=!0}},d=f=>{i("update:modelValue",f.target.value)},h=()=>{if(!window.tinymce||!a.value||o.value)return;const p={...window.wp.editor.getDefaultSettings().tinymce,...s,target:a.value,setup:g=>{r=g,g.on("change",m=>{i("update:modelValue",g.getContent())}),g.on("init",()=>{var y;const m=((y=n.modelValue)==null?void 0:y.replace(/\n/g,"<br>"))||"";g.setContent(m)})}};window.tinymce.init(p)};return Me(()=>n.modelValue,f=>{if(r&&r.getContent()!==f){const p=f==null?void 0:f.replace(/\n/g,"<br>");r.setContent(p||"")}}),Ce(()=>{h()}),ni(()=>{r&&r.destroy()}),(f,p)=>(x(),T("div",Hc,[_("div",jc,[_("button",{type:"button",class:ie(["htga4-editor-tab-btn",{active:!o.value}]),onClick:c}," Visual ",2),_("button",{type:"button",class:ie(["htga4-editor-tab-btn",{active:o.value}]),onClick:u}," Text ",2)]),_("div",Wc,[_("textarea",{ref_key:"editorRef",ref:a,value:l.value,class:"htga4-editor-height",style:ii({visibility:o.value?"visible":"hidden"}),onInput:d},null,44,Gc)])]))}},Yc=["innerHTML"],Xc={__name:"HelpTooltip",props:{content:{type:String,required:!0},useHtml:{type:Boolean,default:!0},placement:{type:String,default:"bottom-start"},effect:{type:String,default:"dark"},hideAfter:{type:Number,default:0},trigger:{type:String,default:"hover"},enterable:{type:Boolean,default:!1}},setup(t){return(e,s)=>{const n=D("el-icon"),i=D("el-tooltip");return x(),A(i,{placement:t.placement,content:t.useHtml?null:t.content,effect:t.effect,"hide-after":t.hideAfter,trigger:t.trigger,enterable:t.enterable},Ss({default:w(()=>[Ft(e.$slots,"default",{},()=>[v(n,{class:"tooltip-icon"},{default:w(()=>[v(I(da))]),_:1})],!0)]),_:2},[t.useHtml?{name:"content",fn:w(()=>[_("div",{innerHTML:t.content},null,8,Yc)]),key:"0"}:void 0]),1032,["placement","content","effect","hide-after","trigger","enterable"])}}},as=ne(Xc,[["__scopeId","data-v-3399916d"]]),Kc=["value"],Qc={key:0,class:"htga4-copy-to-clipboard__icon"},Zc={key:0,xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24"},Jc={key:1,xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24"},eu={class:"htga4-copy-to-clipboard__text"},tu={__name:"CopyToClipboard",props:{content:{type:String,required:!0},buttonText:{type:String,default:"Copy"},width:{type:String,default:"100%"},showIcon:{type:Boolean,default:!0}},setup(t){const e=t,s=se(!1),n=se(null),i=S(()=>({width:e.width})),{content:o}=e,a=()=>{navigator.clipboard.writeText(e.content).then(()=>{s.value=!0,setTimeout(()=>{s.value=!1},2e3)})},r=()=>{n.value&&n.value.select()};return(l,c)=>{const u=D("el-button");return x(),T("div",{class:"htga4-copy-to-clipboard",style:ii(i.value)},[_("input",{class:"htga4-copy-to-clipboard__content htga4-monospace",value:I(o),readonly:"",onClick:r,ref_key:"inputRef",ref:n},null,8,Kc),v(u,{class:"htga4-copy-to-clipboard__button",onClick:dt(a,["stop"]),type:s.value?"success":"primary",size:"medium"},{default:w(()=>[t.showIcon?(x(),T("span",Qc,[s.value?(x(),T("svg",Jc,c[1]||(c[1]=[_("path",{fill:"currentColor",d:"M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"},null,-1)]))):(x(),T("svg",Zc,c[0]||(c[0]=[_("path",{fill:"currentColor",d:"M20,2H10C8.9,2 8,2.9 8,4V8H4C2.9,8 2,8.9 2,10V20C2,21.1 2.9,22 4,22H14C15.1,22 16,21.1 16,20V16H20C21.1,16 22,15.1 22,14V4C22,2.9 21.1,2 20,2M14,20H4V10H14V20M20,14H16V10C16,8.9 15.1,8 14,8H10V4H20V14Z"},null,-1)])))])):N("",!0),_("span",eu,H(s.value?"Copied!":t.buttonText),1)]),_:1},8,["type"])],4)}}},su=ne(tu,[["__scopeId","data-v-263acba2"]]),nu={__name:"ClipboardField",props:{fieldSchema:{type:Object,required:!0},modelValue:{required:!0}},emits:["update:modelValue"],setup(t,{emit:e}){const s=t,n=e,i=S({get(){return s.modelValue},set(o){n("update:modelValue",o)}});return(o,a)=>(x(),A(su,{content:i.value,width:"320px"},null,8,["content"]))}},iu={class:"htga4-auth-button-field"},ou={class:"htga4-auth-button-wrapper"},au=["href"],ru=["href"],lu={__name:"AuthButton",props:{modelValue:{type:String,default:""},fieldSchema:{type:Object,required:!0}},setup(t){var a;const e=X(),s=S(()=>e.getters.isAuthenticated),n=S(()=>e.state.email),i=se(((a=window.htga4Settings)==null?void 0:a.loginUrl)||""),o=S(()=>{const r=window.location.href.split("#")[0];return r+(r.includes("?")?"&htga4_logout=yes":"?htga4_logout=yes")});return(r,l)=>{const c=D("el-form-item");return x(),T("div",iu,[v(c,null,{default:w(()=>[_("div",ou,[s.value?(x(),T("a",{key:1,class:"el-button el-button--large",href:o.value},H((t.fieldSchema.logout_text||"Logout (%s)").replace("%s",n.value)),9,ru)):(x(),T("a",{key:0,class:"htga4-google-button",href:i.value,target:"_blank"},H(t.fieldSchema.button_text||"Sign in with Google"),9,au))])]),_:1})])}}},cu=ne(lu,[["__scopeId","data-v-05b1270d"]]),uu=["value"],du={__name:"HiddenField",props:{modelValue:{required:!0},fieldSchema:{type:Object,required:!0}},emits:["update:modelValue"],setup(t){return(e,s)=>(x(),T("input",{type:"hidden",value:t.modelValue,onInput:s[0]||(s[0]=n=>e.$emit("update:modelValue",n.target.value))},null,40,uu))}},ks={__name:"InfoAlert",props:{type:{type:String,default:"info"},centered:{type:Boolean,default:!1}},setup(t){return(e,s)=>{const n=D("el-alert");return x(),A(n,{class:ie(["htga4-alert",`htga4-alert-${t.type}`,{"htga4-text-center":t.centered}]),closable:!1},{default:w(()=>[Ft(e.$slots,"default")]),_:3},8,["class"])}}},hu=["innerHTML"],fu={__name:"InfoField",props:{modelValue:{required:!0},fieldSchema:{type:Object,required:!0}},setup(t){return(e,s)=>(x(),A(ks,{type:t.fieldSchema.alert_type||"info",centered:t.fieldSchema.centered||!1},{default:w(()=>[_("div",{class:"htga4-info-field-content",innerHTML:t.fieldSchema.content},null,8,hu)]),_:1},8,["type","centered"]))}},pu=ne(fu,[["__scopeId","data-v-a454f23f"]]),gu={key:0,class:"htga4-woocommerce-requirement"},mu={__name:"WooCommerceRequirementField",props:{modelValue:{required:!0},fieldSchema:{type:Object,required:!0}},setup(t){const e=S(()=>window.htga4Settings&&window.htga4Settings.isWoocommerceInstalled==="1"),s=S(()=>window.htga4Settings&&window.htga4Settings.isWoocommerceActive==="1"),n=S(()=>!e.value||!s.value);return(i,o)=>n.value?(x(),T("div",gu,[v(ks,{type:"warning"},{default:w(()=>o[0]||(o[0]=[_("div",{class:"htga4-woocommerce-requirement__content"},[_("strong",null,"WooCommerce Required:"),B(" E-Commerce events tracking requires the WooCommerce plugin to be installed and activated. ")],-1)])),_:1})])):N("",!0)}},_u=ne(mu,[["__scopeId","data-v-9a3d06fe"]]),vu=()=>{const t=(s,n)=>{var a;if(s.type==="hidden")return!1;if(!s.condition)return!0;let i=s.condition;i instanceof Array||(i=[i]);const o={"!=":(r,l)=>r!=l,"!==":(r,l)=>r!==l,"==":(r,l)=>r==l,"===":(r,l)=>r===l,">=":(r,l)=>r>=l,">":(r,l)=>r>l,"<":(r,l)=>r<l,"<=":(r,l)=>r<=l,any:(r,l)=>l.split(",").map(u=>u.trim()).includes(r),"not-any":(r,l)=>!l.split(",").map(u=>u.trim()).includes(r)};for(let r=0;r<i.length;r++){const l=i[r];let c=l.operator||"!=",u=!0;if((a=l==null?void 0:l.key)!=null&&a.includes("|")){const d=l.key.split("|"),h=c.split("|"),f=l.value.split("|");if(d.forEach((p,g)=>{const m=h[g]||h[0],y=f[g]||f[0];o[m](n[p],y)||(u=!1)}),u)return!0}else if(o[c](n[l.key],l.value))return!0}return!1};return{maybeShowField:t,evaluateComplexConditions:(s,n)=>!s||!s.length?!0:s.some(i=>i.type==="AND"?i.rules.every(o=>t({condition:[o]},n)):i.rules.some(o=>t({condition:[o]},n)))}},bu=["innerHTML"],yu={__name:"FormInput",props:{fieldSchema:{type:Object,required:!0},modelValue:{required:!0},context:{type:Object,required:!1},showLabel:{type:Boolean,default:!0}},emits:["update:modelValue"],setup(t,{emit:e}){const s=X(),n=t,i=e,{maybeShowField:o}=vu(),a=f=>{f.target.closest(".htga4-pro-field-opacity")&&(s.commit("setDisplayProModal",!0),f.preventDefault(),f.stopPropagation())},r=f=>{let p=s.state.settings;return n.context&&(p={...n.context}),o(f,p)},l=S({get(){return n.modelValue},set(f){i("update:modelValue",f)}}),c=S(()=>{var f;if(n.fieldSchema.is_pro||(f=n.fieldSchema.class)!=null&&f.includes("htga4-pro-field-opacity"))return!0;if(n.fieldSchema.id==="measurement_id"){const p=s.state.settings;if(p.auth_google&&p.auth_google!=="")return!0}if(n.fieldSchema.id==="measurement_protocol_api_secret"&&n.fieldSchema.type==="text"){const p=s.state.settings,g=p.auth_google&&p.auth_google!=="",m=p.property&&p.property!=="",y=p.data_stream_id&&p.data_stream_id!=="";if(g&&m&&y)return!0}return!1}),u=S(()=>{let f=n.fieldSchema.class?n.fieldSchema.class.split(" "):[];return c.value&&n.fieldSchema.is_pro&&!f.includes("htga4-pro-field-opacity")&&f.push("htga4-pro-field-opacity"),f}),d=S(()=>n.fieldSchema.label_position||"left"),h=S(()=>n.showLabel&&!!n.fieldSchema.title);return Me(()=>n.modelValue,f=>{f!==l.value&&(l.value=f)},{deep:!0}),(f,p)=>{const g=D("el-tag"),m=D("el-text"),y=D("el-form-item");return x(),T(J,null,[t.fieldSchema.is_pro?(x(),A(g,{key:0,type:"danger",round:"",size:"small"},{default:w(()=>p[13]||(p[13]=[B("Pro")])),_:1})):N("",!0),oi(v(y,{class:ie(["htga4-form-item",u.value,"htga4-input-"+t.fieldSchema.type]),size:"large",onClick:a,"label-position":d.value},Ss({default:w(()=>[["text","number","email","textarea"].includes(t.fieldSchema.type)?(x(),A(Lc,{key:0,modelValue:l.value,"onUpdate:modelValue":p[0]||(p[0]=b=>l.value=b),fieldSchema:t.fieldSchema,disabled:c.value},null,8,["modelValue","fieldSchema","disabled"])):N("",!0),t.fieldSchema.type==="select"?(x(),A(Ic,{key:1,modelValue:l.value,"onUpdate:modelValue":p[1]||(p[1]=b=>l.value=b),fieldSchema:t.fieldSchema,disabled:c.value},null,8,["modelValue","fieldSchema","disabled"])):N("",!0),t.fieldSchema.type==="color"?(x(),A(Fc,{key:2,modelValue:l.value,"onUpdate:modelValue":p[2]||(p[2]=b=>l.value=b),fieldSchema:t.fieldSchema,disabled:c.value},null,8,["modelValue","fieldSchema","disabled"])):N("",!0),t.fieldSchema.type==="checkbox"?(x(),A(Vc,{key:3,modelValue:l.value,"onUpdate:modelValue":p[3]||(p[3]=b=>l.value=b),fieldSchema:t.fieldSchema,disabled:c.value},null,8,["modelValue","fieldSchema","disabled"])):N("",!0),t.fieldSchema.type==="switch"?(x(),A($c,{key:4,modelValue:l.value,"onUpdate:modelValue":p[4]||(p[4]=b=>l.value=b),fieldSchema:t.fieldSchema,disabled:c.value},null,8,["modelValue","fieldSchema","disabled"])):N("",!0),t.fieldSchema.type==="auth_button"?(x(),A(cu,{key:5,modelValue:l.value,"onUpdate:modelValue":p[5]||(p[5]=b=>l.value=b),fieldSchema:t.fieldSchema},null,8,["modelValue","fieldSchema"])):N("",!0),t.fieldSchema.type==="radio"?(x(),A(zc,{key:6,modelValue:l.value,"onUpdate:modelValue":p[6]||(p[6]=b=>l.value=b),fieldSchema:t.fieldSchema,disabled:c.value},null,8,["modelValue","fieldSchema","disabled"])):N("",!0),t.fieldSchema.type==="tabbed"?(x(),A(Uc,{key:7,modelValue:l.value,"onUpdate:modelValue":p[7]||(p[7]=b=>l.value=b),fieldSchema:t.fieldSchema,disabled:c.value},null,8,["modelValue","fieldSchema","disabled"])):N("",!0),t.fieldSchema.type==="wp_editor"?(x(),A(qc,{key:8,modelValue:l.value,"onUpdate:modelValue":p[8]||(p[8]=b=>l.value=b),fieldSchema:t.fieldSchema,disabled:c.value},null,8,["modelValue","fieldSchema","disabled"])):N("",!0),t.fieldSchema.type==="clipboard"?(x(),A(nu,{key:9,modelValue:l.value,"onUpdate:modelValue":p[9]||(p[9]=b=>l.value=b),fieldSchema:t.fieldSchema,disabled:c.value},null,8,["modelValue","fieldSchema","disabled"])):N("",!0),t.fieldSchema.type==="hidden"?(x(),A(du,{key:10,modelValue:l.value,"onUpdate:modelValue":p[10]||(p[10]=b=>l.value=b),fieldSchema:t.fieldSchema},null,8,["modelValue","fieldSchema"])):N("",!0),t.fieldSchema.type==="info"?(x(),A(pu,{key:11,modelValue:l.value,"onUpdate:modelValue":p[11]||(p[11]=b=>l.value=b),fieldSchema:t.fieldSchema},null,8,["modelValue","fieldSchema"])):N("",!0),t.fieldSchema.type==="woocommerce_requirement"?(x(),A(_u,{key:12,modelValue:l.value,"onUpdate:modelValue":p[12]||(p[12]=b=>l.value=b),fieldSchema:t.fieldSchema},null,8,["modelValue","fieldSchema"])):N("",!0),t.fieldSchema.desc?(x(),T("span",{key:13,class:"htga4-input-desc",innerHTML:t.fieldSchema.desc},null,8,bu)):N("",!0)]),_:2},[h.value?{name:"label",fn:w(()=>[v(m,{class:"mx-1"},{default:w(()=>[B(H(t.fieldSchema.title),1)]),_:1}),t.fieldSchema.help?(x(),A(as,{key:0,content:t.fieldSchema.help,placement:"bottom-start","use-html":!0},null,8,["content"])):N("",!0)]),key:"0"}:void 0]),1032,["class","label-position"]),[[ai,r(n.fieldSchema)]])],64)}}},we=ne(yu,[["__scopeId","data-v-7bbb36b7"]]),Se=(t,e)=>{const s=e.split(".");let n=window.htga4SettingsSchema[t].fields;for(let i=0;i<s.length;i++){const o=s[i];if(n.fields&&n.fields[o])n=n.fields[o];else if(n[o])n=n[o];else return null}return n},xu={class:"general-settings"},Ps="general_route",wu={__name:"General",setup(t){const e=window.htga4SettingsSchema[Ps],s=Object.keys(e.fields),n=X(),i=S(()=>n.state.settings);S(()=>n.state);const o=a=>{const r=Se(Ps,a);return(r==null?void 0:r.id)||a};return(a,r)=>{const l=D("el-text"),c=D("SettingsCard"),u=D("el-form");return x(),T("div",xu,[v(u,{model:i.value,"label-width":"auto"},{default:w(()=>[v(ks,null,{default:w(()=>[v(l,null,{default:w(()=>[r[1]||(r[1]=B("To access analytical reports within your WordPress dashboard, you need to connect / authenticate with your Google Analytics account. ")),r[2]||(r[2]=_("br",null,null,-1)),v(l,{type:"warning"},{default:w(()=>r[0]||(r[0]=[B("If you don't need to access the reports within the dashboard, manually insert your GA4 tracking ID below.")])),_:1})]),_:1})]),_:1}),v(c,null,{default:w(()=>[(x(!0),T(J,null,le(a.ecommerceEvents,d=>(x(),A(we,{key:d,modelValue:i.value[d],"onUpdate:modelValue":h=>i.value[d]=h,fieldSchema:I(Se)(Ps,d)},null,8,["modelValue","onUpdate:modelValue","fieldSchema"]))),128))]),_:1}),(x(!0),T(J,null,le(I(s),d=>(x(),A(we,{key:d,modelValue:i.value[o(d)],"onUpdate:modelValue":h=>i.value[o(d)]=h,fieldSchema:I(Se)(Ps,d)},null,8,["modelValue","onUpdate:modelValue","fieldSchema"]))),128))]),_:1},8,["model"])])}}},Su={class:"htga4-card-header"},qs={__name:"SettingsCard",props:{title:{type:String,required:!1}},setup(t){const e=t,s=S(()=>!!e.title);return(n,i)=>{const o=D("el-card");return x(),A(o,{class:"htga4-settings-card"},Ss({default:w(()=>[Ft(n.$slots,"default")]),_:2},[s.value?{name:"header",fn:w(()=>[_("div",Su,[_("span",null,H(t.title),1)])]),key:"0"}:void 0]),1024)}}},ku={class:"general-settings"},Xi="events-tracking_route",Cu={__name:"EventsTracking",setup(t){const e=X(),s=S(()=>e.state.settings),n=window.htga4SettingsSchema[Xi],i=n.sections,o=S(()=>{const a=[];return Object.keys(i).forEach(r=>{let l={},c=[];l.title=n.sections[r].title,c=Object.values(n.fields).filter(u=>u.section==r),l.fields=c.map(u=>u.id),a.push(l)}),a});return(a,r)=>{const l=D("el-form");return x(),T("div",ku,[v(l,{model:s.value,"label-width":"auto"},{default:w(()=>[(x(!0),T(J,null,le(o.value,(c,u)=>(x(),A(qs,{key:u,title:c.title},{default:w(()=>[(x(!0),T(J,null,le(c.fields,d=>(x(),A(we,{key:d,modelValue:s.value[d],"onUpdate:modelValue":h=>s.value[d]=h,fieldSchema:I(Se)(Xi,d)},null,8,["modelValue","onUpdate:modelValue","fieldSchema"]))),128))]),_:2},1032,["title"]))),128))]),_:1},8,["model"])])}}},Pu={class:"custom-events-manager"},Du={class:"custom-events-list"},Ru={class:"custom-event-card"},Mu={class:"custom-event-content"},Au={class:"custom-event-label"},Tu={class:"custom-event-actions"},Eu={key:0,class:"upgrade-prompt"},Lu={class:"upgrade-content"},Ou=["id"],Iu={key:0,class:"custom-events-drawer-content"},Fu={class:"drawer-card-title"},Vu={class:"drawer-card-title"},$u={class:"drawer-card-title"},zu={key:0},Bu={key:1,class:"advanced-parameters"},Nu={key:0,class:"empty-state"},Uu={key:1,class:"parameters-accordion"},Hu={class:"collapse-header"},ju={class:"parameter-title"},Wu={class:"parameter-number"},Gu={class:"parameter-key"},qu={class:"collapse-actions"},Yu={class:"parameter-content"},Xu={class:"parameter-field"},Ku={class:"parameter-field"},Qu={class:"parameter-field"},Zu={class:"add-parameter-section"},Ju={class:"custom-events-drawer-footer"},je="custom-events_route",ed={__name:"CustomEvents",setup(t){const e=X(),s=S({get(){return e.state.settings},set(L){e.commit("updateSettings",L)}}),n=window.htga4SettingsSchema[je],i=se(!1),o=se(null),a=se(!1),r=se(null),l=se([]),c=se(!1),u={pdf_download:"a[href$='.pdf']",zip_download:"a[href$='.zip']",doc_download:"a[href$='.docx']",all_file_downloads:"a[href$='.pdf'], a[href$='.zip'], a[href$='.docx']",external_link:"a[href^='http']:not([href*='yourdomain.com'])",affiliate_link:"a[href*='?ref=']",email_click:"a[href^='mailto:']",phone_click:"a[href^='tel:']",add_to_cart:".add_to_cart_button",checkout_button:".checkout-button, #checkout",signup_button:".subscribe-btn, .newsletter-submit",video_play:".video-play, .ytp-play-button",reveal_coupon:".reveal-coupon",faq_toggle:".faq-question, .accordion-header"},d={name:[{required:!0,message:"Event name is required",trigger:"blur"}],event_name:[{required:!0,message:"GA4 event name is required",trigger:"blur"},{pattern:/^[a-z0-9_]+$/,message:"Event name must be in snake_case format",trigger:"blur"}],trigger_value:[{required:!0,message:"Trigger target is required",trigger:"blur"}]},h=S(()=>o.value!==null?s.value.custom_events[o.value]:null),f=S(()=>{var L;return((L=window.htga4Settings)==null?void 0:L.isProActive)==="1"}),p=S(()=>{var L;return((L=s.value.custom_events)==null?void 0:L.length)||0}),g=()=>{if(!f.value&&p.value>=2){c.value=!0;return}c.value=!1;const L={id:"custom_event_"+Date.now(),active:0,name:"",event_name:"",trigger_type:"click",trigger_value:"",trigger_preset:"",parameter_mode:"simple",event_category:"",event_label:"",event_value:1,parameters:[]};Array.isArray(s.value.custom_events)||(s.value.custom_events=[]),o.value=s.value.custom_events.length,s.value.custom_events.push(L),i.value=!0},m=L=>{o.value=L,i.value=!0;const F=s.value.custom_events[L];F&&!F.parameter_mode&&(F.parameter_mode="simple")},y=L=>{Array.isArray(s.value.custom_events)||(s.value.custom_events=[]),s.value.custom_events.splice(L,1)[0];const F=s.value.custom_events.filter((he,Y,Q)=>Q.findIndex(Z=>Z.id===he.id)===Y);s.value.custom_events=F,p.value<2&&(c.value=!1)},b=()=>{o.value=null,i.value=!1},k=L=>{L&&u[L]&&(h.value.trigger_value=u[L])},P=()=>{h.value.parameters||(h.value.parameters=[]),h.value.parameters.push({param_key:"",param_value_type:"static_text",param_value:""});const L=h.value.parameters.length-1;l.value=[L]},C=L=>{h.value.parameters.splice(L,1)},O=L=>{switch(L){case"static_text":return"e.g: engagement, conversion";case"dynamic_click_text":return"Will use clicked element text";case"dynamic_href_filename":return"Will extract filename from href";case"dynamic_page_url":return"Will use current page URL";case"dynamic_form_id":return"Will use form ID or name";case"dynamic_data_attribute":return"e.g: data-location, data-type";case"dynamic_closest_section":return"Will use closest section class";default:return"Enter value or attribute name"}},R=L=>{switch(L){case"static_text":return"Enter a fixed value that will be sent with every event";case"dynamic_click_text":return"Automatically captures the text content of the clicked element";case"dynamic_href_filename":return"Extracts the filename from the href attribute of clicked links";case"dynamic_page_url":return"Uses the current page URL when the event fires";case"dynamic_form_id":return"Captures the ID or name attribute of the submitted form";case"dynamic_data_attribute":return"Specify which data-* attribute to extract (e.g., data-location)";case"dynamic_closest_section":return"Finds the nearest section element and uses its class name";default:return"Select a value type to see description"}},E=L=>{switch(L){case"click":return"Enter a CSS selector to target specific elements that users can click (e.g., buttons, links, form elements). Use presets above for common scenarios.";case"form_submit":return"Enter a CSS selector to target specific forms that users can submit (e.g., contact forms, newsletter signups, checkout forms). Use presets above for common scenarios.";case"page_view":return"Enter a URL pattern to track when users visit specific pages or sections of your website (e.g., /contact, /checkout, /download/*). Use wildcards (*) for dynamic URLs.";default:return"Enter a CSS selector or URL pattern to define when this event should be triggered. Use presets above for common scenarios."}},z=L=>{switch(L){case"click":return'e.g., .cta-button, #newsletter-form, a[href*="download"]';case"form_submit":return'e.g., #contact-form, .newsletter-form, form[name="signup"]';case"page_view":return"e.g., /contact, /checkout, /download/*";default:return"e.g., .cta-button, #newsletter-form, /download"}};Me(()=>{var L;return(L=h.value)==null?void 0:L.trigger_type},(L,F)=>{var he,Y,Q;if(L&&h.value){const Z=window.htga4SettingsSchema["custom-events_route"];(Q=(Y=(he=Z==null?void 0:Z.fields)==null?void 0:he.custom_events)==null?void 0:Y.fields)!=null&&Q.trigger_value&&(Z.fields.custom_events.fields.trigger_value.desc=E(L),Z.fields.custom_events.fields.trigger_value.placeholder=z(L)),F&&L!==F&&(h.value.trigger_value="")}},{immediate:!0});const j=async()=>{try{await r.value.validate(),a.value=!0;try{await e.dispatch("saveSettings"),Vt.success({message:"Custom event saved successfully",offset:40})}catch{Vt.error({message:"Failed to save custom event",offset:40})}finally{a.value=!1}}catch(L){console.log("Validation failed:",L)}},G=()=>{var L;(L=window.htga4Settings)!=null&&L.proUrl&&window.open(window.htga4Settings.proUrl,"_blank")};return(L,F)=>{const he=D("el-tag"),Y=D("el-button"),Q=D("el-card"),Z=D("el-empty"),ye=D("el-input"),ce=D("el-option"),Fe=D("el-option-group"),Ze=D("el-select"),$e=D("el-collapse-item"),He=D("el-collapse"),Ae=D("el-form"),qe=D("el-drawer");return x(),T("div",Pu,[_("div",Du,[(x(!0),T(J,null,le(s.value.custom_events,(W,M)=>(x(),T("div",{key:W.id,class:"custom-event-item"},[_("div",Ru,[_("div",Mu,[_("span",Au,[B(H(W.name)+" ",1),v(he,{size:"small",type:Number(W.active)===1?"success":"info",class:"status-tag"},{default:w(()=>[B(H(Number(W.active)===1?"Enabled":"Disabled"),1)]),_:2},1032,["type"])])]),_("div",Tu,[v(Y,{type:"primary",icon:I(ha),circle:"",size:"small",onClick:V=>m(M)},null,8,["icon","onClick"]),v(Y,{type:"danger",icon:I(Ln),circle:"",size:"small",onClick:V=>y(M)},null,8,["icon","onClick"])])])]))),128))]),v(Y,{type:"primary",onClick:g,icon:I(mn)},{default:w(()=>[B(H(I(n).texts.add_new),1)]),_:1},8,["icon"]),c.value?(x(),T("div",Eu,[v(ks,{type:"warning"},{default:w(()=>[_("div",Lu,[F[13]||(F[13]=_("h4",null,"Unlock Unlimited Custom Events",-1)),F[14]||(F[14]=_("p",null,"You've reached the 2-event limit in the free version. Upgrade to Pro for unlimited custom events, advanced analytics, and premium support. Start tracking everything that matters to your business.",-1)),v(Y,{type:"primary",size:"medium",onClick:G},{default:w(()=>F[12]||(F[12]=[B(" Upgrade to Pro ")])),_:1})])]),_:1})])):N("",!0),v(qe,{modelValue:i.value,"onUpdate:modelValue":F[11]||(F[11]=W=>i.value=W),title:h.value?"Edit Event":"New Event",size:"900","before-close":b},{header:w(({close:W,titleId:M,titleClass:V})=>[_("h2",{id:M,class:ie(V)},H(h.value?"Edit Event":"New Event"),11,Ou)]),default:w(()=>[h.value?(x(),T("div",Iu,[v(Ae,{ref_key:"eventForm",ref:r,model:h.value,rules:d,"label-width":"auto"},{default:w(()=>[v(Q,{shadow:"always",class:"settings-card"},{header:w(()=>[_("span",Fu,H(I(n).texts.basic_settings),1)]),default:w(()=>[v(we,{modelValue:h.value.active,"onUpdate:modelValue":F[0]||(F[0]=W=>h.value.active=W),fieldSchema:I(Se)(je,"custom_events.active"),context:h.value},null,8,["modelValue","fieldSchema","context"]),v(we,{modelValue:h.value.name,"onUpdate:modelValue":F[1]||(F[1]=W=>h.value.name=W),fieldSchema:I(Se)(je,"custom_events.name"),context:h.value},null,8,["modelValue","fieldSchema","context"]),v(we,{modelValue:h.value.event_name,"onUpdate:modelValue":F[2]||(F[2]=W=>h.value.event_name=W),fieldSchema:I(Se)(je,"custom_events.event_name"),context:h.value},null,8,["modelValue","fieldSchema","context"])]),_:1}),v(Q,{shadow:"always",class:"settings-card"},{header:w(()=>[_("span",Vu,H(I(n).texts.trigger_settings),1)]),default:w(()=>[v(we,{modelValue:h.value.trigger_type,"onUpdate:modelValue":F[3]||(F[3]=W=>h.value.trigger_type=W),fieldSchema:I(Se)(je,"custom_events.trigger_type"),context:h.value},null,8,["modelValue","fieldSchema","context"]),v(we,{modelValue:h.value.trigger_preset,"onUpdate:modelValue":[F[4]||(F[4]=W=>h.value.trigger_preset=W),k],fieldSchema:I(Se)(je,"custom_events.trigger_preset"),context:h.value},null,8,["modelValue","fieldSchema","context"]),(x(),A(we,{modelValue:h.value.trigger_value,"onUpdate:modelValue":F[5]||(F[5]=W=>h.value.trigger_value=W),fieldSchema:I(Se)(je,"custom_events.trigger_value"),context:h.value,key:`trigger-value-${h.value.trigger_type}`},null,8,["modelValue","fieldSchema","context"]))]),_:1}),v(Q,{shadow:"always",class:"settings-card"},{header:w(()=>[_("span",$u,H(I(n).texts.event_parameters),1)]),default:w(()=>[v(we,{modelValue:h.value.parameter_mode,"onUpdate:modelValue":F[6]||(F[6]=W=>h.value.parameter_mode=W),fieldSchema:I(Se)(je,"custom_events.parameter_mode"),context:h.value},null,8,["modelValue","fieldSchema","context"]),h.value&&(h.value.parameter_mode==="simple"||!h.value.parameter_mode)?(x(),T("div",zu,[v(we,{modelValue:h.value.event_category,"onUpdate:modelValue":F[7]||(F[7]=W=>h.value.event_category=W),fieldSchema:I(Se)(je,"custom_events.event_category"),context:h.value},null,8,["modelValue","fieldSchema","context"]),v(we,{modelValue:h.value.event_label,"onUpdate:modelValue":F[8]||(F[8]=W=>h.value.event_label=W),fieldSchema:I(Se)(je,"custom_events.event_label"),context:h.value},null,8,["modelValue","fieldSchema","context"]),v(we,{modelValue:h.value.event_value,"onUpdate:modelValue":F[9]||(F[9]=W=>h.value.event_value=W),fieldSchema:I(Se)(je,"custom_events.event_value"),context:h.value},null,8,["modelValue","fieldSchema","context"])])):h.value&&h.value.parameter_mode==="advanced"?(x(),T("div",Bu,[!h.value.parameters||h.value.parameters.length===0?(x(),T("div",Nu,[v(Z,{description:"No parameters added yet","image-size":80},{default:w(()=>[v(Y,{type:"primary",onClick:P,icon:I(mn)},{default:w(()=>F[15]||(F[15]=[B(" Add Your First Parameter ")])),_:1},8,["icon"])]),_:1})])):(x(),T("div",Uu,[v(He,{modelValue:l.value,"onUpdate:modelValue":F[10]||(F[10]=W=>l.value=W),accordion:""},{default:w(()=>[(x(!0),T(J,null,le(h.value.parameters,(W,M)=>(x(),A($e,{key:M,name:M,class:"parameter-collapse-item"},{title:w(()=>[_("div",Hu,[_("span",ju,[_("span",Wu,"#"+H(M+1),1),_("span",Gu,H(W.param_key||"Unnamed Parameter"),1)]),_("div",qu,[v(Y,{type:"danger",icon:I(Ln),circle:"",size:"small",onClick:dt(V=>C(M),["stop"]),class:"remove-btn"},null,8,["icon","onClick"])])])]),default:w(()=>[_("div",Yu,[_("div",Xu,[_("label",null,[F[16]||(F[16]=B(" Parameter Key ")),v(as,{content:"• The name of the parameter that will be sent to GA4 <br>• e.g., event_category, cta_text, page_title",placement:"top",effect:"dark"})]),v(ye,{modelValue:W.param_key,"onUpdate:modelValue":V=>W.param_key=V,placeholder:"e.g: event_category, cta_text",clearable:"",size:"small"},null,8,["modelValue","onUpdate:modelValue"])]),_("div",Ku,[_("label",null,[F[17]||(F[17]=B(" Value Type ")),v(as,{content:"• Choose how the parameter value will be determined <br>• static text or dynamically extracted from the page",placement:"top",effect:"dark"})]),v(Ze,{modelValue:W.param_value_type,"onUpdate:modelValue":V=>W.param_value_type=V,placeholder:"Select value type",style:{width:"100%"},size:"medium"},{default:w(()=>[v(Fe,{label:"Static Values"},{default:w(()=>[v(ce,{label:"Static Text",value:"static_text"})]),_:1}),v(Fe,{label:"Dynamic Values"},{default:w(()=>[v(ce,{label:"Clicked Element Text",value:"dynamic_click_text"}),v(ce,{label:"File Name from Href",value:"dynamic_href_filename"}),v(ce,{label:"Current Page URL",value:"dynamic_page_url"}),v(ce,{label:"Form ID",value:"dynamic_form_id"}),v(ce,{label:"Data Attribute",value:"dynamic_data_attribute"}),v(ce,{label:"Closest Section",value:"dynamic_closest_section"})]),_:1})]),_:2},1032,["modelValue","onUpdate:modelValue"])]),_("div",Qu,[_("label",null,[F[18]||(F[18]=B(" Parameter Value ")),v(as,{content:R(W.param_value_type),placement:"top",effect:"dark"},null,8,["content"])]),v(ye,{modelValue:W.param_value,"onUpdate:modelValue":V=>W.param_value=V,placeholder:O(W.param_value_type),clearable:"",size:"small"},null,8,["modelValue","onUpdate:modelValue","placeholder"])])])]),_:2},1032,["name"]))),128))]),_:1},8,["modelValue"])])),_("div",Zu,[v(Y,{onClick:P,icon:I(mn),type:"primary",plain:"",size:"large"},{default:w(()=>F[19]||(F[19]=[B(" Add Parameter ")])),_:1},8,["icon"])])])):N("",!0)]),_:1})]),_:1},8,["model"])])):N("",!0)]),footer:w(()=>[_("div",Ju,[v(Y,{onClick:b,disabled:a.value},{default:w(()=>[B(H(I(n).texts.cancel),1)]),_:1},8,["disabled"]),v(Y,{type:"primary",onClick:j,loading:a.value},{default:w(()=>[B(H(I(n).texts.save),1)]),_:1},8,["loading"])])]),_:1},8,["modelValue","title"])])}}},td=ne(ed,[["__scopeId","data-v-f9039c2d"]]),sd={class:"cookie-notice-settings"},wn="cookie_notice_route",nd={__name:"CookieNotice",setup(t){Br(r=>({89205138:s.value.cookie_notice_enabled==!0?"block":"none",ebf5ac80:s.value.cookie_notice_banner_bg_color||"#0099ff","7ebdb578":s.value.cookie_notice_banner_text_color||"#ffffff","0004b1d1":s.value.cookie_notice_privacy_link_color||"#ffffff","41861a3c":s.value.cookie_notice_accept_bg_color||"#ffffff","08ca9394":s.value.cookie_notice_accept_text_color||"#000000","1a4b3645":s.value.cookie_notice_decline_bg_color||"transparent","0186072c":s.value.cookie_notice_decline_text_color||"#ffffff"}));const e=X(),s=S(()=>e.state.settings),n=window.htga4SettingsSchema[wn],i=n.sections;S(()=>{var r;return((r=window==null?void 0:window.htga4_cookie_notice_params)==null?void 0:r.notice_html)??""});const o=S(()=>Object.values(n.fields).filter(r=>!r.section).map(r=>r.id));Me(()=>s.value,()=>{},{deep:!0});const a=S(()=>{const r=[];return Object.keys(i).forEach(l=>{let c={};c.title=n.sections[l].title,c.description=n.sections[l].description;const u=Object.values(n.fields).filter(d=>d.section===l);c.fields=u.map(d=>d.id),r.push(c)}),r});return S(()=>({banner:{backgroundColor:s.value.cookie_notice_banner_bg_color||"#0099ff",color:s.value.cookie_notice_banner_text_color||"#ffffff",padding:"15px",display:"flex",justifyContent:"space-between",alignItems:"center",flexWrap:"wrap",gap:"10px"},text:{color:s.value.cookie_notice_banner_text_color||"#ffffff"},privacyLink:{color:s.value.cookie_notice_privacy_link_color||"#ffffff",marginLeft:"5px",textDecoration:"underline"},acceptBtn:{backgroundColor:s.value.cookie_notice_accept_bg_color||"#ffffff",color:s.value.cookie_notice_accept_text_color||"#000000",border:"none",padding:"8px 16px",borderRadius:"4px",cursor:"pointer",marginLeft:"10px"},declineBtn:{backgroundColor:s.value.cookie_notice_decline_bg_color||"transparent",color:s.value.cookie_notice_decline_text_color||"#ffffff",border:"1px solid "+(s.value.cookie_notice_decline_text_color||"#ffffff"),padding:"8px 16px",borderRadius:"4px",cursor:"pointer"}})),(r,l)=>{const c=D("el-form");return x(),T("div",sd,[v(c,{model:s.value,"label-width":"auto"},{default:w(()=>[v(qs,null,{default:w(()=>[(x(!0),T(J,null,le(o.value,u=>(x(),A(we,{key:u,modelValue:s.value[u],"onUpdate:modelValue":d=>s.value[u]=d,fieldSchema:I(Se)(wn,u)},null,8,["modelValue","onUpdate:modelValue","fieldSchema"]))),128))]),_:1}),(x(!0),T(J,null,le(a.value,(u,d)=>(x(),A(qs,{key:d,title:u.title,description:u.description},{default:w(()=>[(x(!0),T(J,null,le(u.fields,h=>(x(),A(we,{key:h,modelValue:s.value[h],"onUpdate:modelValue":f=>s.value[h]=f,fieldSchema:I(Se)(wn,h)},null,8,["modelValue","onUpdate:modelValue","fieldSchema"]))),128))]),_:2},1032,["title","description"]))),128))]),_:1},8,["model"])])}}},id=ne(nd,[["__scopeId","data-v-61fc8878"]]),od={class:"tools-settings"},Ki="tools_route",ad={__name:"Tools",setup(t){const e=window.htga4SettingsSchema[Ki],s=Object.keys(e.fields),n=X(),i=S(()=>n.state.settings);return(o,a)=>{const r=D("el-form");return x(),T("div",od,[v(r,{model:i.value,"label-width":"auto"},{default:w(()=>[(x(!0),T(J,null,le(I(s),l=>(x(),A(we,{key:l,modelValue:i.value[l],"onUpdate:modelValue":c=>i.value[l]=c,fieldSchema:I(Se)(Ki,l)},null,8,["modelValue","onUpdate:modelValue","fieldSchema"]))),128))]),_:1},8,["model"])])}}},rd={class:"htga4-settings-section"},ld={class:"htga4-cache-info"},cd={class:"htga4-cache-info__intro"},ud={class:"htga4-cache-info__details"},dd={class:"htga4-cache-info__column"},hd={class:"htga4-cache-info__list"},fd={class:"htga4-cache-info__column"},pd={class:"htga4-cache-info__list"},gd={class:"htga4-cache-management"},md={__name:"Cache",setup(t){const e=se(!1),s=se(!1),n=se({text:"",type:"success"}),i=(a,r="success")=>{n.value={text:a,type:r}},o=async()=>{var a;e.value=!0;try{const r=`${window.htga4Settings.apiBaseURL}htga4/v1/tools/clear-cache`,l=await fetch(r,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":(a=window.htga4Settings)==null?void 0:a.nonce}});if(!l.ok)throw new Error(`API request failed: ${l.statusText}`);const c=await l.json();if(c.success)i(c.message||"Cache cleared successfully!","success"),s.value=!0;else throw new Error(c.message||"Failed to clear cache.")}catch(r){console.error("Cache clearing error:",r),i(r.message||"An error occurred while clearing cache.","error")}finally{e.value=!1}};return(a,r)=>{const l=D("el-icon"),c=D("el-button");return x(),T("div",rd,[r[10]||(r[10]=_("h2",{style:{"margin-top":"0"}},"Cache Management",-1)),_("div",ld,[_("div",cd,[v(l,{class:"htga4-cache-info__icon"},{default:w(()=>[v(I(da))]),_:1}),r[0]||(r[0]=_("p",null,"Google Analytics data is cached to improve performance and reduce API requests. If you are experiencing data synchronization issues, you can clear the cache to fetch fresh data from Google Analytics.",-1))]),_("div",ud,[_("div",dd,[r[4]||(r[4]=_("h3",null,"Cached Data Types",-1)),_("ul",hd,[_("li",null,[v(l,null,{default:w(()=>[v(I(Nr))]),_:1}),r[1]||(r[1]=_("div",null,[_("strong",null,"Reports"),_("p",null,"Standard reports, ecommerce reports, and realtime reports")],-1))]),_("li",null,[v(l,null,{default:w(()=>[v(I(Ur))]),_:1}),r[2]||(r[2]=_("div",null,[_("strong",null,"Account Data"),_("p",null,"GA4 accounts, properties, and data streams information")],-1))]),_("li",null,[v(l,null,{default:w(()=>[v(I(Hr))]),_:1}),r[3]||(r[3]=_("div",null,[_("strong",null,"User Data"),_("p",null,"User informations")],-1))])])]),_("div",fd,[r[8]||(r[8]=_("h3",null,"When to Clear Cache",-1)),_("ul",pd,[_("li",null,[v(l,null,{default:w(()=>[v(I(jr))]),_:1}),r[5]||(r[5]=_("p",null,"When data shown in reports appears outdated",-1))]),_("li",null,[v(l,null,{default:w(()=>[v(I(On))]),_:1}),r[6]||(r[6]=_("p",null,"After making changes to your Google Analytics setup",-1))]),_("li",null,[v(l,null,{default:w(()=>[v(I(fa))]),_:1}),r[7]||(r[7]=_("p",null,"If the force refresh option in reports is not resolving issues",-1))])])])])]),_("div",gd,[v(c,{type:"primary",size:"large",loading:e.value,onClick:o,disabled:e.value||s.value,icon:I(Ln)},{default:w(()=>r[9]||(r[9]=[B(" Clear Cache ")])),_:1},8,["loading","disabled","icon"]),n.value.text?(x(),A(ks,{key:0,type:n.value.type,class:"htga4-cache-message"},{default:w(()=>[B(H(n.value.text),1)]),_:1},8,["type"])):N("",!0)])])}}},Qi=`${htga4Settings.apiBaseURL}htga4/v1`,_d=()=>{var t;return{"Content-Type":"application/json","X-WP-Nonce":(t=window.htga4Settings)==null?void 0:t.nonce}},ke=async(t,e={})=>{try{let s=t;t&&!t.startsWith("http")&&(s=`${Qi}${t.startsWith("/")?t:"/"+t}`),t||(s=Qi);const n=await fetch(s,{...e,headers:{..._d(),...e.headers}});if(!n.ok)throw new Error(`API request failed: ${n.statusText}`);return await n.json()}catch(s){throw console.error("API request error:",s),s}},vd={getSettings:()=>ke("/settings"),updateSettings:t=>ke("/settings",{method:"POST",body:JSON.stringify(t)})},bd={getRoles:()=>ke("/roles")},yd={getAccounts:(t=!1)=>{const e=new URLSearchParams;t&&e.append("force_refresh","1");let s="/accounts";return e.toString()&&(s=`${s}?${e.toString()}`),ke(s)},getProperties:(t,e=!1)=>{if(!t)return Promise.resolve({});const s=new URLSearchParams;e&&s.append("force_refresh","1");let n=`/properties/${t}`;return s.toString()&&(n=`${n}?${s.toString()}`),ke(n)},getDataStreams:(t,e=!1)=>{if(!t)return Promise.resolve({});const s=new URLSearchParams;e&&s.append("force_refresh","1");let n=`/datastreams/${t}`;return s.toString()&&(n=`${n}?${s.toString()}`),ke(n)},getMeasurementProtocolSecrets:(t,e,s=!1)=>{if(!t||!e)return Promise.resolve({});const n=new URLSearchParams;s&&n.append("force_refresh","1");let i=`/measurement-protocol-secrets/${t}/${e}`;return n.toString()&&(i=`${i}?${n.toString()}`),ke(i)}},xd={fetchStandardReports:async({startDate:t=null,endDate:e=null,forceRefresh:s=!1}={})=>{try{const n=new URLSearchParams;t&&e&&(n.append("date_from",Ys(t)),n.append("date_to",Ys(e))),s&&n.append("force_refresh","1");let i="/reports/standard";return n.toString()&&(i=`${i}?${n.toString()}`),await ke(i)}catch(n){throw console.error("Error loading standard reports data:",n),n}}},wd={fetchEcommerceReports:async({startDate:t=null,endDate:e=null,forceRefresh:s=!1}={})=>{try{const n=new URLSearchParams;t&&e&&(n.append("date_from",Ys(t)),n.append("date_to",Ys(e))),s&&n.append("force_refresh","1");let i="/reports/ecommerce";return n.toString()&&(i=`${i}?${n.toString()}`),await ke(i)}catch(n){throw console.error("Error loading ecommerce reports data:",n),n}}},Sd={fetchRealtimeReports:async(t=!1)=>{try{const e=new URLSearchParams;t&&e.append("force_refresh","1");let s="/reports/realtime";return e.toString()&&(s=`${s}?${e.toString()}`),await ke(s)}catch(e){throw console.error("Error loading realtime reports data:",e),e}}},kd={getUserInfo:(t=!1)=>{let e="/userinfo";return t&&(e=`${e}?force_refresh=1`),ke(e)}},Cd={getDataStream:(t,e,s=!1)=>{const n=new URLSearchParams;n.append("property_id",t),n.append("stream_id",e),s&&n.append("force_refresh","1");let i="/datastream";return n.toString()&&(i=`${i}?${n.toString()}`),ke(i)}},Ys=t=>t?(typeof t=="string"?new Date(t):t).toISOString().split("T")[0]:"",Pd={getSettings:()=>ke("/google-ads/settings"),updateSettings:t=>ke("/google-ads/settings",{method:"POST",body:JSON.stringify(t)}),testConversion:()=>ke("/google-ads/test",{method:"POST"})},Le={settings:vd,roles:bd,ga4:yd,standard:xd,ecommerce:wd,realtime:Sd,user:kd,dataStream:Cd,googleAds:Pd,get:t=>ke(t),post:(t,e)=>ke(t,{method:"POST",body:e?JSON.stringify(e):void 0})},Dd={name:"GoogleAdsSettings",components:{SettingsCard:qs},setup(){const t=X(),e=se(null),s=se(!1),n=se(!1),i=se(["1"]),o=S({get(){var P,C,O,R,E,z,j,G,L,F,he;const b=((P=t.state.settings)==null?void 0:P.google_ads)||{},k=b.conversion_labels||{};return{enabled:b.enabled||!1,conversion_id:b.conversion_id||"",excluded_roles:"excluded_roles"in b?b.excluded_roles:["administrator"],conversion_labels:{purchase:{enabled:((C=k.purchase)==null?void 0:C.enabled)||!1,label:((O=k.purchase)==null?void 0:O.label)||""},add_to_cart:{enabled:((R=k.add_to_cart)==null?void 0:R.enabled)||!1,label:((E=k.add_to_cart)==null?void 0:E.label)||""},checkout:{enabled:((z=k.checkout)==null?void 0:z.enabled)||!1,label:((j=k.checkout)==null?void 0:j.label)||""},view_product:{enabled:((G=k.view_product)==null?void 0:G.enabled)||!1,label:((L=k.view_product)==null?void 0:L.label)||""},view_category:{enabled:((F=k.view_category)==null?void 0:F.enabled)||!1,label:((he=k.view_category)==null?void 0:he.label)||""}}}},set(b){t.commit("updateSettings",{google_ads:b})}}),a=S(()=>({conversion_id:o.value.enabled?[{required:!0,message:"Please enter your Conversion ID",trigger:"blur"},{pattern:/^[0-9]{9,10}$/,message:"Conversion ID must be 9-10 digits",trigger:"blur"}]:[]})),r=se({show:!1,type:"",message:""}),l=S(()=>{var b;return((b=window.htga4Settings)==null?void 0:b.isProActive)==="1"}),c=[{key:"purchase",icon:"el-icon-shopping-cart-2",title:"Purchase Event",placeholder:"e.g., AbCdEfGhIjKl",description:"Track when customers complete a purchase",isPro:!1},{key:"add_to_cart",icon:"el-icon-shopping-bag-1",title:"Add to Cart Event",placeholder:"e.g., XyZ123456789",description:"Track when customers add products to their cart",isPro:!0},{key:"checkout",icon:"el-icon-tickets",title:"Checkout Event",placeholder:"e.g., DeF456789012",description:"Track when customers initiate checkout process",isPro:!0},{key:"view_product",icon:"el-icon-view",title:"View Product Event",placeholder:"e.g., GhI345678901",description:"Track when customers view product pages",isPro:!0},{key:"view_category",icon:"el-icon-folder-opened",title:"View Category Event",placeholder:"e.g., JkL567890123",description:"Track when customers view category pages",isPro:!0}],u=S(()=>{const b=o.value.conversion_labels&&Object.values(o.value.conversion_labels).some(k=>k.enabled&&k.label&&k.label.trim()!=="");return{hasConversionId:!!o.value.conversion_id,hasConversionLabel:b,isEnabled:o.value.enabled}}),d=S(()=>u.value.isEnabled?u.value.hasConversionId?u.value.hasConversionLabel?3:2:1:0),h=S(()=>u.value.hasConversionId&&u.value.hasConversionLabel&&u.value.isEnabled),f=(b,k)=>{const P={...o.value,[b]:k};t.commit("updateSettings",{google_ads:P}),console.log(`Updated ${b}:`,k)},p=(b,k,P)=>{const C={...o.value,conversion_labels:{...o.value.conversion_labels,[b]:{...o.value.conversion_labels[b],[k]:P}}};t.commit("updateSettings",{google_ads:C}),console.log(`Updated conversion_labels.${b}.${k}:`,P)};return Me(()=>t.state.isSaving,async b=>{if(b&&e.value){if(console.log("Google Ads - Saving form data:",o.value),!o.value.enabled){t.commit("updateSettings",{google_ads:o.value});return}try{await e.value.validate()&&t.commit("updateSettings",{google_ads:o.value})}catch(k){console.error("Validation failed:",k),t.commit("updateSettings",{google_ads:o.value})}}}),{settingsForm:e,formData:o,rules:a,saving:s,testing:n,testResult:r,setupStatus:u,currentStep:d,isSetupComplete:h,activeStep:i,conversionEvents:c,isProActive:l,testConversion:async()=>{try{n.value=!0,r.value.show=!1,console.log("Testing conversion with settings:",o.value);const b=await Le.post("/google-ads/test");if(console.log("Test response:",b),b.tracking_code)try{if(window.gtag){const k=b.tracking_code.match(/gtag\('event',\s*'conversion',\s*({[^}]+})\)/);if(k){const P=new Function("return "+k[1])();window.gtag("event","conversion",P),console.log("Test conversion sent to Google Ads:",P),r.value={show:!0,type:"success",message:"Test conversion sent successfully! Check your Google Ads account in a few minutes."}}else throw new Error("Invalid tracking code format")}else r.value={show:!0,type:"warning",message:"Google Ads tracking script not found on this page. Please ensure Google Ads tracking is enabled and visit your frontend site to test."}}catch(k){console.error("Failed to execute tracking code:",k),r.value={show:!0,type:"error",message:"Failed to send test conversion. Please check your settings and try again."}}else r.value={show:!0,type:"success",message:b.message||"Test conversion prepared."}}catch(b){console.error("Test conversion error:",b);let k="Test failed";b.message&&(k=b.message),r.value={show:!0,type:"error",message:k}}finally{n.value=!1}},updateFormField:f,updateConversionLabel:p,openProUpgrade:()=>{var b;(b=window.htga4Settings)!=null&&b.proUrl&&window.open(window.htga4Settings.proUrl,"_blank")},handleProFieldClick:(b,k)=>{k.isPro&&!l.value&&(t.commit("setDisplayProModal",!0),b.preventDefault(),b.stopPropagation())}}}},Rd={class:"htga4-google-ads-settings"},Md={class:"setup-status"},Ad={key:0},Td={key:1},Ed={key:0},Ld={key:1},Od={class:"step-details"},Id={style:{display:"flex","align-items":"center",gap:"10px"}},Fd={style:{display:"flex","align-items":"center","justify-content":"space-between",width:"100%",gap:"10px"}},Vd={class:"event-title-wrapper"},$d={key:0},zd={class:"form-help"},Bd={class:"test-conversion-section"};function Nd(t,e,s,n,i,o){const a=D("el-alert"),r=D("el-card"),l=D("el-step"),c=D("el-steps"),u=D("el-collapse-item"),d=D("el-collapse"),h=D("el-switch"),f=D("el-form-item"),p=D("el-col"),g=D("el-input"),m=D("el-checkbox"),y=D("el-checkbox-group"),b=D("el-row"),k=D("SettingsCard"),P=D("el-tag"),C=D("el-form"),O=D("el-button");return x(),T("div",Rd,[n.isSetupComplete?N("",!0):(x(),A(r,{key:0,class:"status-card",shadow:"never"},{default:w(()=>[_("div",Md,[v(a,{type:n.currentStep>=1?"success":"warning",closable:!1},{title:w(()=>[n.currentStep===0?(x(),T("span",Ad,e[4]||(e[4]=[_("i",{class:"el-icon-warning"},null,-1),B(" Setup Required ")]))):(x(),T("span",Td,e[5]||(e[5]=[_("i",{class:"el-icon-success"},null,-1),B(" Almost Done! ")])))]),default:w(()=>[n.currentStep===0?(x(),T("div",Ed," Enable Google Ads tracking to get started ")):(x(),T("div",Ld," Follow the remaining steps below to complete your setup "))]),_:1},8,["type"])])]),_:1})),n.isSetupComplete?N("",!0):(x(),A(r,{key:1,class:"setup-steps-card",shadow:"never"},{header:w(()=>e[6]||(e[6]=[_("h3",null,"Setup Instructions",-1)])),default:w(()=>[v(c,{active:n.currentStep,"finish-status":"success","align-center":""},{default:w(()=>[v(l,{title:"Enable Tracking",description:"Turn on Google Ads tracking"}),v(l,{title:"Add Conversion ID",description:"From Google Ads account"}),v(l,{title:"Add Conversion Label",description:"Enable and label an event"}),v(l,{title:"Test & Verify",description:"Confirm tracking works"})]),_:1},8,["active"]),_("div",Od,[v(d,{modelValue:n.activeStep,"onUpdate:modelValue":e[0]||(e[0]=R=>n.activeStep=R)},{default:w(()=>[v(u,{title:"Step 1: Enable Tracking",name:"1"},{default:w(()=>e[7]||(e[7]=[_("ol",null,[_("li",null,[B("In the "),_("strong",null,"Basic Configuration"),B(" section below, toggle "),_("strong",null,"Enable Google Ads Tracking"),B(" on")])],-1)])),_:1}),v(u,{title:"Step 2: Add Your Conversion ID",name:"2"},{default:w(()=>e[8]||(e[8]=[_("ol",null,[_("li",null,[B("Log in to your "),_("a",{href:"https://ads.google.com",target:"_blank"},"Google Ads account")]),_("li",null,[B("Navigate to "),_("strong",null,"Tools & Settings > Conversions")]),_("li",null,"Click on your purchase conversion (or create one)"),_("li",null,[B("Find the "),_("strong",null,"Conversion ID"),B(" (9-10 digits)")]),_("li",null,"Copy and paste it in the field below")],-1)])),_:1}),v(u,{title:"Step 3: Add Your Conversion Label",name:"3"},{default:w(()=>e[9]||(e[9]=[_("ol",null,[_("li",null,[B("In the "),_("strong",null,"Conversion Events"),B(" section below, enable at least one event")]),_("li",null,[B("In the conversion details page of your Google Ads account, click "),_("strong",null,"Tag setup")]),_("li",null,[B("Choose "),_("strong",null,"Install the tag yourself")]),_("li",null,[B("In the Global site tag, find: "),_("code",null,"send_to: 'AW-123456789/AbCdEfGhIjKl'")]),_("li",null,[B("Copy the part after the slash (e.g., "),_("code",null,"AbCdEfGhIjKl"),B(") and paste it as the conversion label")])],-1)])),_:1})]),_:1},8,["modelValue"])])]),_:1})),v(C,{ref:"settingsForm",model:n.formData,rules:n.rules,"label-position":"top"},{default:w(()=>[v(k,{title:"Basic Configuration",icon:"el-icon-setting"},{default:w(()=>[v(b,{gutter:20},{default:w(()=>[v(p,{span:24},{default:w(()=>[v(f,{label:"Enable Google Ads Tracking",prop:"enabled"},{default:w(()=>[_("div",Id,[v(h,{"model-value":n.formData.enabled,"onUpdate:modelValue":e[1]||(e[1]=R=>n.updateFormField("enabled",R))},null,8,["model-value"]),e[10]||(e[10]=_("span",null,"Enable or disable Google Ads conversion tracking",-1))])]),_:1})]),_:1}),n.formData.enabled?(x(),A(p,{key:0,span:24},{default:w(()=>[v(f,{label:"Conversion ID",prop:"conversion_id",required:""},{default:w(()=>[v(g,{"model-value":n.formData.conversion_id,"onUpdate:modelValue":e[2]||(e[2]=R=>n.updateFormField("conversion_id",R)),placeholder:"e.g., 123456789",maxlength:"10","show-word-limit":""},null,8,["model-value"]),e[11]||(e[11]=_("div",{class:"form-help"},[B(" Your Google Ads Conversion ID (9-10 digits, without AW- prefix) "),_("a",{href:"https://support.google.com/google-ads/answer/7548399",target:"_blank"},[_("i",{class:"el-icon-question"}),B(" Where to find this? ")])],-1))]),_:1})]),_:1})):N("",!0),n.formData.enabled?(x(),A(p,{key:1,span:24},{default:w(()=>[v(f,{label:"Exclude User Roles"},{default:w(()=>[v(y,{"model-value":n.formData.excluded_roles,"onUpdate:modelValue":e[3]||(e[3]=R=>n.updateFormField("excluded_roles",R))},{default:w(()=>[v(m,{label:"administrator"},{default:w(()=>e[12]||(e[12]=[B("Administrator")])),_:1}),v(m,{label:"editor"},{default:w(()=>e[13]||(e[13]=[B("Editor")])),_:1}),v(m,{label:"author"},{default:w(()=>e[14]||(e[14]=[B("Author")])),_:1}),v(m,{label:"contributor"},{default:w(()=>e[15]||(e[15]=[B("Contributor")])),_:1})]),_:1},8,["model-value"]),e[16]||(e[16]=_("div",{class:"form-help"}," Exclude specific user roles from tracking ",-1))]),_:1})]),_:1})):N("",!0)]),_:1})]),_:1}),v(k,{title:"Conversion Events",icon:"el-icon-data-line"},{default:w(()=>[e[18]||(e[18]=_("div",{class:"form-help",style:{"margin-bottom":"20px"}}," Enable specific conversion events and set their unique conversion labels from Google Ads. ",-1)),(x(!0),T(J,null,le(n.conversionEvents,R=>(x(),A(b,{key:R.key,class:ie(["conversion-event-row",{"htga4-pro-field-opacity":R.isPro&&!n.isProActive}]),onClick:E=>n.handleProFieldClick(E,R)},{default:w(()=>[v(p,{span:24},{default:w(()=>[v(f,{style:{"margin-bottom":"0"}},{label:w(()=>{var E,z;return[_("div",Fd,[_("div",Vd,[B(H(R.title)+" ",1),R.isPro&&!n.isProActive?(x(),A(P,{key:0,type:"danger",round:"",size:"small"},{default:w(()=>e[17]||(e[17]=[B("Pro")])),_:1})):N("",!0)]),v(h,{"model-value":(z=(E=n.formData.conversion_labels)==null?void 0:E[R.key])==null?void 0:z.enabled,"onUpdate:modelValue":j=>n.updateConversionLabel(R.key,"enabled",j),disabled:R.isPro&&!n.isProActive},null,8,["model-value","onUpdate:modelValue","disabled"])])]}),default:w(()=>{var E,z;return[(z=(E=n.formData.conversion_labels)==null?void 0:E[R.key])!=null&&z.enabled?(x(),T("div",$d,[v(f,{label:"Conversion Label",style:{"margin-bottom":"0"}},{default:w(()=>{var j,G;return[v(g,{"model-value":(G=(j=n.formData.conversion_labels)==null?void 0:j[R.key])==null?void 0:G.label,"onUpdate:modelValue":L=>n.updateConversionLabel(R.key,"label",L),placeholder:R.placeholder,disabled:R.isPro&&!n.isProActive,maxlength:"20"},null,8,["model-value","onUpdate:modelValue","placeholder","disabled"])]}),_:2},1024),_("div",zd,H(R.description),1)])):N("",!0)]}),_:2},1024)]),_:2},1024)]),_:2},1032,["class","onClick"]))),128))]),_:1})]),_:1},8,["model","rules"]),_("div",Bd,[v(O,{type:"success",loading:n.testing,disabled:!n.setupStatus.hasConversionId||!n.setupStatus.hasConversionLabel,onClick:n.testConversion},{default:w(()=>e[19]||(e[19]=[_("i",{class:"el-icon-video-play"},null,-1),B(" Test Conversion Tracking ")])),_:1},8,["loading","disabled","onClick"]),n.testResult.show?(x(),T("span",{key:0,class:ie(["test-result",n.testResult.type])},H(n.testResult.message),3)):N("",!0)])])}const Ud=ne(Dd,[["render",Nd],["__scopeId","data-v-dbe46927"]]),Hd={class:"htga4-content-footer"},jd={__name:"ContentFooter",setup(t){const e=X(),s=Ve(),n=S(()=>e.state.isSaving),i=S(()=>!(["/settings/cache"].includes(s.path)||s.meta&&s.meta.hideFooterSaveButton)),o=async()=>{try{await e.dispatch("saveSettings"),Vt.success({message:"Settings saved successfully",offset:40,duration:3e3,showClose:!0})}catch(a){console.log(a),Vt.error({message:"Failed to save settings",offset:40,duration:3e3,showClose:!0})}};return(a,r)=>{const l=D("el-button");return oi((x(),T("div",Hd,[v(l,{type:"primary",onClick:o,loading:n.value},{default:w(()=>r[0]||(r[0]=[B("Save Changes")])),_:1},8,["loading"])],512)),[[ai,i.value]])}}},Wd={class:"htga4-content-header"},Gd={class:"htga4-content-header-left"},qd={class:"htga4-page-title"},Yd={class:"htga4-header-actions"},Xd={__name:"ContentHeader",setup(t){const e=X(),s=Ve(),n=S(()=>e.state.isSaving),i=S(()=>!(["/settings/tools","/settings/cache"].includes(s.path)||s.meta&&s.meta.hideHeaderSaveButton)),o=S(()=>!![].includes(s.path)),a=S(()=>{let l="",c="Settings";return l=s.path.replace("/settings/",""),l!=""?l=l+"_route":l="root_route",window.htga4SettingsSchema[l]!==void 0&&(c=window.htga4SettingsSchema[l].title),c}),r=async()=>{try{await e.dispatch("saveSettings"),Vt.success({message:"Settings saved successfully",offset:40,duration:3e3,showClose:!0})}catch(l){console.log(l),Vt.error({message:"Failed to save settings",offset:40,duration:3e3,showClose:!0})}};return(l,c)=>{const u=D("el-button");return x(),T("div",Wd,[_("div",Gd,[_("h2",qd,H(a.value),1)]),_("div",Yd,[oi(v(u,{type:"primary",onClick:r,disabled:o.value,loading:n.value},{default:w(()=>c[0]||(c[0]=[B("Save Changes")])),_:1},8,["disabled","loading"]),[[ai,i.value]])])])}}},Kd={__name:"Menu",setup(t){const e=Ve(),s=window.htga4Settings.menu,n=S(()=>e.path==="/settings/general"||e.path==="/settings"?"/settings/general":e.path),i=o=>({"/":On,"events-tracking":Xr,"custom-events":ha,"google-ads":Yr,"cookie-notice":qr,tools:Gr,cache:Wr})[o]||On;return(o,a)=>{const r=D("el-icon"),l=D("el-text"),c=D("el-menu-item"),u=D("el-menu");return x(),A(u,{class:"htga4-menu","background-color":"#fff","default-active":n.value,router:""},{default:w(()=>[(x(!0),T(J,null,le(I(s),(d,h)=>(x(),T(J,{key:h},[d.items?N("",!0):(x(),A(c,{key:0,index:h==="/"?"/settings/general":"/settings/"+h},{default:w(()=>[v(r,{size:"large"},{default:w(()=>[(x(),A(pa(i(h))))]),_:2},1024),v(l,{size:"large"},{default:w(()=>[B(H(d.title),1)]),_:2},1024)]),_:2},1032,["index"]))],64))),128))]),_:1},8,["default-active"])}}},Qd=ne(Kd,[["__scopeId","data-v-35d2711f"]]),Zd={class:"htga4-content-body"},Jd={__name:"Settings",setup(t){const e=X();return S(()=>e.state.isLoading),Ce(()=>{const s=new Event("hashchange",{bubbles:!0});window.dispatchEvent(s)}),(s,n)=>{const i=D("el-aside"),o=D("router-view"),a=D("el-main"),r=D("el-container");return x(),A(r,{class:"htga4-main-container"},{default:w(()=>[v(i,{width:"310px",class:"htga4-app-sidebar"},{default:w(()=>[v(Qd)]),_:1}),v(a,{class:"htga4-main-content"},{default:w(()=>[v(Xd),_("div",Zd,[v(o)]),v(jd)]),_:1})]),_:1})}}},eh={};function th(t,e){const s=D("router-view");return x(),T("div",null,[v(s)])}const sh=ne(eh,[["render",th]]);function nh(){const t=X(),e=se(!1),s=se("last30days"),n=se([]),i=se([]),o=se("last30days"),a=S(()=>{if(n.value&&n.value.length===2){const g=new Date(n.value[0]),m=new Date(n.value[1]);return`${g.toLocaleDateString()} - ${m.toLocaleDateString()}`}return"Select date range"}),r=S(()=>{switch(s.value){case"today":return"Today";case"yesterday":return"Yesterday";case"last7days":return"Last 7 days";case"last30days":return"Last 30 days";case"last90days":return"Last 90 days";case"last365days":return"Last 365 days";case"lastMonth":return"Last month";case"last12months":return"Last 12 months";case"lastYear":return"Last year";case"custom":return"Custom Range";default:return"Custom Range"}}),l=g=>{if(!g||!g.length||!g[0]||!g[1])return"All time";try{const m=new Date(g[0]),y=new Date(g[1]),b={month:"short",day:"numeric"};return`${m.toLocaleDateString("en-US",b)} - ${y.toLocaleDateString("en-US",b)}`}catch(m){return console.error("Error formatting date range:",m),"All time"}},c=g=>g>new Date,u=g=>{s.value=g;const m=new Date;let y=new Date(m),b;switch(g){case"today":b=new Date(m);break;case"yesterday":b=new Date(m),b.setDate(m.getDate()-1),y.setDate(m.getDate()-1);break;case"last7days":b=new Date(m),b.setDate(m.getDate()-6);break;case"last30days":b=new Date(m),b.setDate(m.getDate()-29);break;case"last90days":b=new Date(m),b.setDate(m.getDate()-89);break;case"last365days":b=new Date(m),b.setDate(m.getDate()-364);break;case"lastMonth":b=new Date(m.getFullYear(),m.getMonth()-1,1),y=new Date(m.getFullYear(),m.getMonth(),0);break;case"last12months":b=new Date(m),b.setMonth(m.getMonth()-11),b.setDate(1),y.setDate(m.getDate());break;case"lastYear":b=new Date(m.getFullYear()-1,0,1),y=new Date(m.getFullYear()-1,11,31);break;default:b=new Date(m),b.setDate(m.getDate()-29)}t.commit("setStartDate",b.toISOString().split("T")[0]),t.commit("setEndDate",y.toISOString().split("T")[0]),n.value=[b,y],t.commit("setDateRange",{0:b,1:y})},d=()=>{i.value=[...n.value],o.value=s.value,e.value=!0},h=()=>{n.value=[...i.value],s.value=o.value,e.value=!1},f=()=>{e.value=!1,i.value=[...n.value],o.value=s.value},p=(g,m)=>{g=new Date(g),m=new Date(m),g.setHours(0,0,0,0),m.setHours(0,0,0,0);const y=new Date;if(y.setHours(0,0,0,0),g.getTime()===y.getTime()&&m.getTime()===y.getTime())return s.value="today",!0;const b=new Date(y);if(b.setDate(y.getDate()-1),g.getTime()===b.getTime()&&m.getTime()===b.getTime())return s.value="yesterday",!0;const k=new Date(y);if(k.setDate(y.getDate()-6),g.getTime()===k.getTime()&&m.getTime()===y.getTime())return s.value="last7days",!0;const P=new Date(y);if(P.setDate(y.getDate()-29),g.getTime()===P.getTime()&&m.getTime()===y.getTime())return s.value="last30days",!0;const C=new Date(y);if(C.setDate(y.getDate()-89),g.getTime()===C.getTime()&&m.getTime()===y.getTime())return s.value="last90days",!0;const O=new Date(y);if(O.setDate(y.getDate()-364),g.getTime()===O.getTime()&&m.getTime()===y.getTime())return s.value="last365days",!0;const R=new Date(y.getFullYear(),y.getMonth()-1,1),E=new Date(y.getFullYear(),y.getMonth(),0);if(g.getTime()===R.getTime()&&m.getTime()===E.getTime())return s.value="lastMonth",!0;const z=new Date(y);if(z.setMonth(y.getMonth()-11),z.setDate(1),g.getTime()===z.getTime()&&m.getTime()===y.getTime())return s.value="last12months",!0;const j=new Date(y.getFullYear()-1,0,1),G=new Date(y.getFullYear()-1,11,31);return g.getTime()===j.getTime()&&m.getTime()===G.getTime()?(s.value="lastYear",!0):!1};return u("last30days"),{dateRange:n,datePreset:s,datePopoverVisible:e,selectedDateRangeText:a,datePresetName:r,selectPreset:u,openDatePopover:d,cancelDateSelection:h,applyDateFilter:f,checkIfDateRangeMatchesPreset:p,formatDateRangeLabel:l,disableFutureDates:c}}const ih={class:"htga4-date-picker"},oh={class:"htga4-date-picker__preset-name"},ah={class:"htga4-date-picker__range-text"},rh={class:"htga4-date-picker__content"},lh={class:"htga4-date-picker__calendar"},ch={class:"htga4-date-picker__presets"},uh={class:"htga4-date-picker__footer"},dh={__name:"DateRangePicker",props:{dateRange:{type:Array,default:()=>[]},datePreset:{type:String,default:"last30days"},datePopoverVisible:{type:Boolean,default:!1},selectedDateRangeText:{type:String,default:""},datePresetName:{type:String,default:"Last 30 days"}},emits:["update:dateRange","update:datePreset","update:datePopoverVisible","openDatePopover","cancelDateSelection","applyDateFilter","selectPreset"],setup(t,{emit:e}){const s=t,n=e,i=S({get:()=>s.dateRange,set:f=>n("update:dateRange",f)}),o=S({get:()=>s.datePreset,set:f=>n("update:datePreset",f)}),a=()=>{n("openDatePopover")},r=()=>{n("cancelDateSelection"),setTimeout(()=>{var f;(f=document.querySelector(".htga4-date-picker__button"))==null||f.focus()},50)},l=()=>{n("applyDateFilter"),setTimeout(()=>{var f;(f=document.querySelector(".htga4-date-picker__button"))==null||f.focus()},50)},c=f=>{o.value=f,n("selectPreset",f)},u=f=>f>new Date,d=()=>{setTimeout(()=>{var f;(f=document.querySelector(".htga4-date-picker__button"))==null||f.focus()},50)},h=f=>{if(s.datePopoverVisible){const p=document.querySelector(".htga4-date-picker__popover"),g=document.querySelector(".htga4-date-picker__button");p&&g&&!p.contains(f.target)&&!g.contains(f.target)&&!f.target.closest(".el-picker-panel")&&n("cancelDateSelection")}};return Ce(()=>{document.addEventListener("click",h)}),ga(()=>{document.removeEventListener("click",h)}),(f,p)=>{const g=D("el-icon"),m=D("el-date-picker"),y=D("el-col"),b=D("el-row"),k=D("el-button"),P=D("el-popover");return x(),T("div",ih,[v(P,{placement:"bottom",width:430,trigger:"manual","hide-after":0,teleported:!0,visible:t.datePopoverVisible,onClick:p[12]||(p[12]=dt(()=>{},["stop"])),onHide:d},{reference:w(()=>[_("div",{class:"htga4-date-picker__button",onClick:dt(a,["stop"]),tabindex:"0",role:"button","aria-haspopup":"true","aria-expanded":"datePopoverVisible"},[v(g,{class:"htga4-date-picker__calendar-icon"},{default:w(()=>[v(I(Kr))]),_:1}),p[13]||(p[13]=_("div",{class:"htga4-date-picker__separator"},null,-1)),_("div",oh,H(t.datePresetName),1),p[14]||(p[14]=_("div",{class:"htga4-date-picker__separator"},null,-1)),_("code",ah,H(t.selectedDateRangeText),1),v(g,{class:"htga4-date-picker__dropdown-icon"},{default:w(()=>[v(I(ma))]),_:1})])]),default:w(()=>[_("div",{class:"htga4-date-picker__popover",onClick:p[11]||(p[11]=dt(()=>{},["stop"]))},[_("div",rh,[_("div",lh,[v(m,{modelValue:i.value,"onUpdate:modelValue":p[0]||(p[0]=C=>i.value=C),type:"daterange","range-separator":"To","start-placeholder":"Start date","end-placeholder":"End date","disabled-date":u,onClick:p[1]||(p[1]=dt(()=>{},["stop"])),"popper-options":{modifiers:[{name:"preventOverflow",options:{boundary:"viewport"}}]}},null,8,["modelValue"])]),_("div",ch,[p[15]||(p[15]=_("h3",null,"Presets",-1)),v(b,{gutter:20},{default:w(()=>[v(y,{span:12},{default:w(()=>[_("div",{class:ie(["htga4-date-picker__preset-item",{"htga4-date-picker__preset-item--active":o.value==="today"}]),onClick:p[2]||(p[2]=C=>c("today"))}," Today ",2),_("div",{class:ie(["htga4-date-picker__preset-item",{"htga4-date-picker__preset-item--active":o.value==="yesterday"}]),onClick:p[3]||(p[3]=C=>c("yesterday"))}," Yesterday ",2),_("div",{class:ie(["htga4-date-picker__preset-item",{"htga4-date-picker__preset-item--active":o.value==="lastMonth"}]),onClick:p[4]||(p[4]=C=>c("lastMonth"))}," Last month ",2),_("div",{class:ie(["htga4-date-picker__preset-item",{"htga4-date-picker__preset-item--active":o.value==="last12months"}]),onClick:p[5]||(p[5]=C=>c("last12months"))}," Last 12 months ",2),_("div",{class:ie(["htga4-date-picker__preset-item",{"htga4-date-picker__preset-item--active":o.value==="lastYear"}]),onClick:p[6]||(p[6]=C=>c("lastYear"))}," Last year ",2)]),_:1}),v(y,{span:12},{default:w(()=>[_("div",{class:ie(["htga4-date-picker__preset-item",{"htga4-date-picker__preset-item--active":o.value==="last7days"}]),onClick:p[7]||(p[7]=C=>c("last7days"))}," Last 7 days ",2),_("div",{class:ie(["htga4-date-picker__preset-item",{"htga4-date-picker__preset-item--active":o.value==="last30days"}]),onClick:p[8]||(p[8]=C=>c("last30days"))}," Last 30 days ",2),_("div",{class:ie(["htga4-date-picker__preset-item",{"htga4-date-picker__preset-item--active":o.value==="last90days"}]),onClick:p[9]||(p[9]=C=>c("last90days"))}," Last 90 days ",2),_("div",{class:ie(["htga4-date-picker__preset-item",{"htga4-date-picker__preset-item--active":o.value==="last365days"}]),onClick:p[10]||(p[10]=C=>c("last365days"))}," Last 365 days ",2)]),_:1})]),_:1})]),_("div",uh,[v(k,{onClick:r},{default:w(()=>p[16]||(p[16]=[B("Cancel")])),_:1}),v(k,{type:"primary",onClick:l},{default:w(()=>p[17]||(p[17]=[B("Update")])),_:1})])])])]),_:1},8,["visible"])])}}},hh=ne(dh,[["__scopeId","data-v-94e6146f"]]),fh={class:"htga4-date-controls"},ph={__name:"DateControls",emits:["data-loaded"],setup(t,{expose:e,emit:s}){const n=rn(),i=X(),{dateRange:o,datePreset:a,datePopoverVisible:r,selectedDateRangeText:l,datePresetName:c,selectPreset:u,openDatePopover:d,cancelDateSelection:h,applyDateFilter:f,checkIfDateRangeMatchesPreset:p}=nh();Me(o,b=>{b&&b.length===2?p(b[0],b[1])||(a.value="custom"):(!b||b.length===0)&&u("last30days")});const g=S(()=>n.currentRoute.value.name),m=()=>{f();const b=k=>k.toISOString().split("T")[0];i.commit("setStartDate",b(new Date(o.value[0]))),i.commit("setEndDate",b(new Date(o.value[1]))),i.commit("setDateRange",{0:o.value[0],1:o.value[1]}),g.value==="ecommerce"?i.dispatch("fetchEcommerceReports",{startDate:i.state.startDate,endDate:i.state.endDate}):g.value==="standard"&&i.dispatch("fetchStandardReports",{startDate:i.state.startDate,endDate:i.state.endDate})};return e({initialize:async()=>{u("last30days")}}),(b,k)=>(x(),T("div",fh,[v(hh,{"date-range":I(o),"onUpdate:dateRange":k[0]||(k[0]=P=>_n(o)?o.value=P:null),"date-preset":I(a),"onUpdate:datePreset":k[1]||(k[1]=P=>_n(a)?a.value=P:null),"date-popover-visible":I(r),"onUpdate:datePopoverVisible":k[2]||(k[2]=P=>_n(r)?r.value=P:null),"selected-date-range-text":I(l),"date-preset-name":I(c),onOpenDatePopover:I(d),onCancelDateSelection:I(h),onApplyDateFilter:m,onSelectPreset:I(u)},null,8,["date-range","date-preset","date-popover-visible","selected-date-range-text","date-preset-name","onOpenDatePopover","onCancelDateSelection","onSelectPreset"])]))}},gh=ne(ph,[["__scopeId","data-v-dfed0296"]]),mh={class:"htga4-sync-button"},_h={__name:"SyncButton",props:{label:{type:String,default:"Sync"},size:{type:String,default:"medium"}},emits:["sync-complete"],setup(t,{emit:e}){const s=t,n=e,i=X(),o=rn(),a=se(!1),r=S(()=>o.currentRoute.value.name),l=async()=>{try{a.value=!0;const c=!0;r.value==="ecommerce"?await i.dispatch("fetchEcommerceReports",{startDate:i.state.startDate,endDate:i.state.endDate,forceRefresh:c}):r.value==="realtime"?await i.dispatch("fetchRealtimeReports",c):await i.dispatch("fetchStandardReports",{startDate:i.state.startDate,endDate:i.state.endDate,forceRefresh:c}),In({message:"Data refreshed successfully",type:"success",offset:40}),n("sync-complete")}catch(c){In({message:"Failed to refresh data: "+(c.message||"Unknown error"),type:"error",offset:40}),i.state.environmentType==="development"&&console.error("Sync error:",c)}finally{a.value=!1}};return(c,u)=>{const d=D("el-button");return x(),T("div",mh,[v(as,{content:"* Force refresh data (clears cache) <br>* Data is cached for 1 hour",placement:"top"},{default:w(()=>[v(d,{class:"htga4-sync-button__button",icon:I(fa),type:"primary",size:s.size,loading:a.value,onClick:l},{default:w(()=>[B(H(t.label),1)]),_:1},8,["icon","size","loading"])]),_:1})])}}},Na=ne(_h,[["__scopeId","data-v-d810285f"]]),vh={key:0,class:"htga4-user-card__skeleton"},bh={class:"htga4-user-card__content"},yh={class:"htga4-user-card__thumb"},xh={class:"htga4-user-card__info",style:{width:"140px"}},wh={key:1,class:"htga4-user-card__content"},Sh={class:"htga4-user-card__thumb"},kh=["src"],Ch={class:"htga4-user-card__info"},Ph={class:"htga4-user-card__name"},Dh={class:"htga4-user-card__email"},Rh={class:"htga4-user-card__property"},Mh={__name:"UserProfileCard",setup(t){const e=X(),s=S(()=>e.state.userProfile),n=S(()=>{var a;return((a=e.state.dataStream)==null?void 0:a.displayName)||""}),i=S(()=>{var a,r;return((r=(a=e.state.dataStream)==null?void 0:a.webStreamData)==null?void 0:r.measurementId)||""}),o=S(()=>e.state.loading);return(a,r)=>{const l=D("el-skeleton-item"),c=D("el-skeleton"),u=D("el-card");return x(),A(u,{class:"htga4-user-card","body-style":{padding:"0"},shadow:"never"},{default:w(()=>[o.value?(x(),T("div",vh,[v(c,{style:{width:"100%"},animated:""},{template:w(()=>[_("div",bh,[_("div",yh,[v(l,{variant:"circle",style:{width:"50px",height:"50px"}})]),_("div",xh,[v(l,{variant:"p",style:{width:"50%"}}),v(l,{variant:"p",style:{width:"60%"}}),v(l,{variant:"p",style:{width:"70%"}})])])]),_:1})])):(x(),T("div",wh,[_("div",Sh,[_("img",{src:s.value.profileImage,alt:"User profile"},null,8,kh)]),_("div",Ch,[_("h3",Ph,H(s.value.name),1),_("p",Dh,H(s.value.email),1),_("p",Rh,H(n.value)+" <"+H(i.value)+">",1)])]))]),_:1})}}},Ua=ne(Mh,[["__scopeId","data-v-0ea4092e"]]),Ah={class:"htga4-report-header"},Th={class:"htga4-report-header__controls"},Eh={__name:"ReportHeader",emits:["analytics-data-updated"],setup(t,{expose:e,emit:s}){const n=rn(),i=S(()=>!n.currentRoute.value.path.includes("real-time")),o=se(null),a=s,r=()=>{a("analytics-data-updated")};return e({initialize:async()=>{await o.value.initialize()}}),(l,c)=>(x(),T("div",Ah,[v(Ua),_("div",Th,[v(Na,{onSyncComplete:c[0]||(c[0]=u=>a("data-loaded"))}),i.value?(x(),A(gh,{key:0,ref_key:"dateControlsRef",ref:o,onDataUpdated:r},null,512)):N("",!0)])]))}},Ha=ne(Eh,[["__scopeId","data-v-f6e590ae"]]);/*! 11 11 * @kurkle/color v0.3.4 12 12 * https://github.com/kurkle/color#readme … … 18 18 * (c) 2025 Chart.js Contributors 19 19 * Released under the MIT License 20 */function et(){}const tf=(()=>{let t=0;return()=>t++})();function de(t){return t==null}function xe(t){if(Array.isArray&&Array.isArray(t))return!0;const e=Object.prototype.toString.call(t);return e.slice(0,7)==="[object"&&e.slice(-6)==="Array]"}function oe(t){return t!==null&&Object.prototype.toString.call(t)==="[object Object]"}function Ne(t){return(typeof t=="number"||t instanceof Number)&&isFinite(+t)}function Ye(t,e){return Ne(t)?t:e}function ee(t,e){return typeof t>"u"?e:t}const sf=(t,e)=>typeof t=="string"&&t.endsWith("%")?parseFloat(t)/100:+t/e,qa=(t,e)=>typeof t=="string"&&t.endsWith("%")?parseFloat(t)/100*e:+t;function fe(t,e,s){if(t&&typeof t.call=="function")return t.apply(s,e)}function re(t,e,s,n){let i,o,a;if(xe(t))for(o=t.length,i=0;i<o;i++)e.call(s,t[i],i);else if(oe(t))for(a=Object.keys(t),o=a.length,i=0;i<o;i++)e.call(s,t[a[i]],a[i])}function Xs(t,e){let s,n,i,o;if(!t||!e||t.length!==e.length)return!1;for(s=0,n=t.length;s<n;++s)if(i=t[s],o=e[s],i.datasetIndex!==o.datasetIndex||i.index!==o.index)return!1;return!0}function Ks(t){if(xe(t))return t.map(Ks);if(oe(t)){const e=Object.create(null),s=Object.keys(t),n=s.length;let i=0;for(;i<n;++i)e[s[i]]=Ks(t[s[i]]);return e}return t}function Ya(t){return["__proto__","prototype","constructor"].indexOf(t)===-1}function nf(t,e,s,n){if(!Ya(t))return;const i=e[t],o=s[t];oe(i)&&oe(o)?ms(i,o,n):e[t]=Ks(o)}function ms(t,e,s){const n=xe(e)?e:[e],i=n.length;if(!oe(t))return t;s=s||{};const o=s.merger||nf;let a;for(let r=0;r<i;++r){if(a=n[r],!oe(a))continue;const l=Object.keys(a);for(let c=0,u=l.length;c<u;++c)o(l[c],t,a,s)}return t}function rs(t,e){return ms(t,e,{merger:of})}function of(t,e,s){if(!Ya(t))return;const n=e[t],i=s[t];oe(n)&&oe(i)?rs(n,i):Object.prototype.hasOwnProperty.call(e,t)||(e[t]=Ks(i))}const so={"":t=>t,x:t=>t.x,y:t=>t.y};function af(t){const e=t.split("."),s=[];let n="";for(const i of e)n+=i,n.endsWith("\\")?n=n.slice(0,-1)+".":(s.push(n),n="");return s}function rf(t){const e=af(t);return s=>{for(const n of e){if(n==="")break;s=s&&s[n]}return s}}function _s(t,e){return(so[e]||(so[e]=rf(e)))(t)}function gi(t){return t.charAt(0).toUpperCase()+t.slice(1)}const Qs=t=>typeof t<"u",gt=t=>typeof t=="function",no=(t,e)=>{if(t.size!==e.size)return!1;for(const s of t)if(!e.has(s))return!1;return!0};function lf(t){return t.type==="mouseup"||t.type==="click"||t.type==="contextmenu"}const ge=Math.PI,pe=2*ge,cf=pe+ge,Zs=Number.POSITIVE_INFINITY,uf=ge/180,be=ge/2,mt=ge/4,io=ge*2/3,Xa=Math.log10,Bt=Math.sign;function ls(t,e,s){return Math.abs(t-e)<s}function oo(t){const e=Math.round(t);t=ls(t,e,t/1e3)?e:t;const s=Math.pow(10,Math.floor(Xa(t))),n=t/s;return(n<=1?1:n<=2?2:n<=5?5:10)*s}function df(t){const e=[],s=Math.sqrt(t);let n;for(n=1;n<s;n++)t%n===0&&(e.push(n),e.push(t/n));return s===(s|0)&&e.push(s),e.sort((i,o)=>i-o).pop(),e}function hf(t){return typeof t=="symbol"||typeof t=="object"&&t!==null&&!(Symbol.toPrimitive in t||"toString"in t||"valueOf"in t)}function vs(t){return!hf(t)&&!isNaN(parseFloat(t))&&isFinite(t)}function ff(t,e){const s=Math.round(t);return s-e<=t&&s+e>=t}function pf(t,e,s){let n,i,o;for(n=0,i=t.length;n<i;n++)o=t[n][s],isNaN(o)||(e.min=Math.min(e.min,o),e.max=Math.max(e.max,o))}function it(t){return t*(ge/180)}function gf(t){return t*(180/ge)}function ao(t){if(!Ne(t))return;let e=1,s=0;for(;Math.round(t*e)/e!==t;)e*=10,s++;return s}function Ka(t,e){const s=e.x-t.x,n=e.y-t.y,i=Math.sqrt(s*s+n*n);let o=Math.atan2(n,s);return o<-.5*ge&&(o+=pe),{angle:o,distance:i}}function jn(t,e){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function mf(t,e){return(t-e+cf)%pe-ge}function ct(t){return(t%pe+pe)%pe}function bs(t,e,s,n){const i=ct(t),o=ct(e),a=ct(s),r=ct(o-i),l=ct(a-i),c=ct(i-o),u=ct(i-a);return i===o||i===a||n&&o===a||r>l&&c<u}function Re(t,e,s){return Math.max(e,Math.min(s,t))}function _f(t){return Re(t,-32768,32767)}function Lt(t,e,s,n=1e-6){return t>=Math.min(e,s)-n&&t<=Math.max(e,s)+n}function mi(t,e,s){s=s||(a=>t[a]<e);let n=t.length-1,i=0,o;for(;n-i>1;)o=i+n>>1,s(o)?i=o:n=o;return{lo:i,hi:n}}const xt=(t,e,s,n)=>mi(t,s,n?i=>{const o=t[i][e];return o<s||o===s&&t[i+1][e]===s}:i=>t[i][e]<s),vf=(t,e,s)=>mi(t,s,n=>t[n][e]>=s);function bf(t,e,s){let n=0,i=t.length;for(;n<i&&t[n]<e;)n++;for(;i>n&&t[i-1]>s;)i--;return n>0||i<t.length?t.slice(n,i):t}const Qa=["push","pop","shift","splice","unshift"];function yf(t,e){if(t._chartjs){t._chartjs.listeners.push(e);return}Object.defineProperty(t,"_chartjs",{configurable:!0,enumerable:!1,value:{listeners:[e]}}),Qa.forEach(s=>{const n="_onData"+gi(s),i=t[s];Object.defineProperty(t,s,{configurable:!0,enumerable:!1,value(...o){const a=i.apply(this,o);return t._chartjs.listeners.forEach(r=>{typeof r[n]=="function"&&r[n](...o)}),a}})})}function ro(t,e){const s=t._chartjs;if(!s)return;const n=s.listeners,i=n.indexOf(e);i!==-1&&n.splice(i,1),!(n.length>0)&&(Qa.forEach(o=>{delete t[o]}),delete t._chartjs)}function xf(t){const e=new Set(t);return e.size===t.length?t:Array.from(e)}const Za=function(){return typeof window>"u"?function(t){return t()}:window.requestAnimationFrame}();function Ja(t,e){let s=[],n=!1;return function(...i){s=i,n||(n=!0,Za.call(window,()=>{n=!1,t.apply(e,s)}))}}function wf(t,e){let s;return function(...n){return e?(clearTimeout(s),s=setTimeout(t,e,n)):t.apply(this,n),e}}const _i=t=>t==="start"?"left":t==="end"?"right":"center",Pe=(t,e,s)=>t==="start"?e:t==="end"?s:(e+s)/2,Sf=(t,e,s,n)=>t===(n?"left":"right")?s:t==="center"?(e+s)/2:e;function kf(t,e,s){const n=e.length;let i=0,o=n;if(t._sorted){const{iScale:a,vScale:r,_parsed:l}=t,c=t.dataset&&t.dataset.options?t.dataset.options.spanGaps:null,u=a.axis,{min:d,max:h,minDefined:f,maxDefined:p}=a.getUserBounds();if(f){if(i=Math.min(xt(l,u,d).lo,s?n:xt(e,u,a.getPixelForValue(d)).lo),c){const g=l.slice(0,i+1).reverse().findIndex(m=>!de(m[r.axis]));i-=Math.max(0,g)}i=Re(i,0,n-1)}if(p){let g=Math.max(xt(l,a.axis,h,!0).hi+1,s?0:xt(e,u,a.getPixelForValue(h),!0).hi+1);if(c){const m=l.slice(g-1).findIndex(y=>!de(y[r.axis]));g+=Math.max(0,m)}o=Re(g,i,n)-i}else o=n-i}return{start:i,count:o}}function Cf(t){const{xScale:e,yScale:s,_scaleRanges:n}=t,i={xmin:e.min,xmax:e.max,ymin:s.min,ymax:s.max};if(!n)return t._scaleRanges=i,!0;const o=n.xmin!==e.min||n.xmax!==e.max||n.ymin!==s.min||n.ymax!==s.max;return Object.assign(n,i),o}const As=t=>t===0||t===1,lo=(t,e,s)=>-(Math.pow(2,10*(t-=1))*Math.sin((t-e)*pe/s)),co=(t,e,s)=>Math.pow(2,-10*t)*Math.sin((t-e)*pe/s)+1,cs={linear:t=>t,easeInQuad:t=>t*t,easeOutQuad:t=>-t*(t-2),easeInOutQuad:t=>(t/=.5)<1?.5*t*t:-.5*(--t*(t-2)-1),easeInCubic:t=>t*t*t,easeOutCubic:t=>(t-=1)*t*t+1,easeInOutCubic:t=>(t/=.5)<1?.5*t*t*t:.5*((t-=2)*t*t+2),easeInQuart:t=>t*t*t*t,easeOutQuart:t=>-((t-=1)*t*t*t-1),easeInOutQuart:t=>(t/=.5)<1?.5*t*t*t*t:-.5*((t-=2)*t*t*t-2),easeInQuint:t=>t*t*t*t*t,easeOutQuint:t=>(t-=1)*t*t*t*t+1,easeInOutQuint:t=>(t/=.5)<1?.5*t*t*t*t*t:.5*((t-=2)*t*t*t*t+2),easeInSine:t=>-Math.cos(t*be)+1,easeOutSine:t=>Math.sin(t*be),easeInOutSine:t=>-.5*(Math.cos(ge*t)-1),easeInExpo:t=>t===0?0:Math.pow(2,10*(t-1)),easeOutExpo:t=>t===1?1:-Math.pow(2,-10*t)+1,easeInOutExpo:t=>As(t)?t:t<.5?.5*Math.pow(2,10*(t*2-1)):.5*(-Math.pow(2,-10*(t*2-1))+2),easeInCirc:t=>t>=1?t:-(Math.sqrt(1-t*t)-1),easeOutCirc:t=>Math.sqrt(1-(t-=1)*t),easeInOutCirc:t=>(t/=.5)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1),easeInElastic:t=>As(t)?t:lo(t,.075,.3),easeOutElastic:t=>As(t)?t:co(t,.075,.3),easeInOutElastic(t){return As(t)?t:t<.5?.5*lo(t*2,.1125,.45):.5+.5*co(t*2-1,.1125,.45)},easeInBack(t){return t*t*((1.70158+1)*t-1.70158)},easeOutBack(t){return(t-=1)*t*((1.70158+1)*t+1.70158)+1},easeInOutBack(t){let e=1.70158;return(t/=.5)<1?.5*(t*t*(((e*=1.525)+1)*t-e)):.5*((t-=2)*t*(((e*=1.525)+1)*t+e)+2)},easeInBounce:t=>1-cs.easeOutBounce(1-t),easeOutBounce(t){return t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375},easeInOutBounce:t=>t<.5?cs.easeInBounce(t*2)*.5:cs.easeOutBounce(t*2-1)*.5+.5};function vi(t){if(t&&typeof t=="object"){const e=t.toString();return e==="[object CanvasPattern]"||e==="[object CanvasGradient]"}return!1}function uo(t){return vi(t)?t:new gs(t)}function kn(t){return vi(t)?t:new gs(t).saturate(.5).darken(.1).hexString()}const Pf=["x","y","borderWidth","radius","tension"],Df=["color","borderColor","backgroundColor"];function Rf(t){t.set("animation",{delay:void 0,duration:1e3,easing:"easeOutQuart",fn:void 0,from:void 0,loop:void 0,to:void 0,type:void 0}),t.describe("animation",{_fallback:!1,_indexable:!1,_scriptable:e=>e!=="onProgress"&&e!=="onComplete"&&e!=="fn"}),t.set("animations",{colors:{type:"color",properties:Df},numbers:{type:"number",properties:Pf}}),t.describe("animations",{_fallback:"animation"}),t.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:e=>e|0}}}})}function Mf(t){t.set("layout",{autoPadding:!0,padding:{top:0,right:0,bottom:0,left:0}})}const ho=new Map;function Af(t,e){e=e||{};const s=t+JSON.stringify(e);let n=ho.get(s);return n||(n=new Intl.NumberFormat(t,e),ho.set(s,n)),n}function bi(t,e,s){return Af(e,s).format(t)}const Tf={values(t){return xe(t)?t:""+t},numeric(t,e,s){if(t===0)return"0";const n=this.chart.options.locale;let i,o=t;if(s.length>1){const c=Math.max(Math.abs(s[0].value),Math.abs(s[s.length-1].value));(c<1e-4||c>1e15)&&(i="scientific"),o=Ef(t,s)}const a=Xa(Math.abs(o)),r=isNaN(a)?1:Math.max(Math.min(-1*Math.floor(a),20),0),l={notation:i,minimumFractionDigits:r,maximumFractionDigits:r};return Object.assign(l,this.options.ticks.format),bi(t,n,l)}};function Ef(t,e){let s=e.length>3?e[2].value-e[1].value:e[1].value-e[0].value;return Math.abs(s)>=1&&t!==Math.floor(t)&&(s=t-Math.floor(t)),s}var er={formatters:Tf};function Lf(t){t.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:(e,s)=>s.lineWidth,tickColor:(e,s)=>s.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:er.formatters.values,minor:{},major:{},align:"center",crossAlign:"near",showLabelBackdrop:!1,backdropColor:"rgba(255, 255, 255, 0.75)",backdropPadding:2}}),t.route("scale.ticks","color","","color"),t.route("scale.grid","color","","borderColor"),t.route("scale.border","color","","borderColor"),t.route("scale.title","color","","color"),t.describe("scale",{_fallback:!1,_scriptable:e=>!e.startsWith("before")&&!e.startsWith("after")&&e!=="callback"&&e!=="parser",_indexable:e=>e!=="borderDash"&&e!=="tickBorderDash"&&e!=="dash"}),t.describe("scales",{_fallback:"scale"}),t.describe("scale.ticks",{_scriptable:e=>e!=="backdropPadding"&&e!=="callback",_indexable:e=>e!=="backdropPadding"})}const St=Object.create(null),Wn=Object.create(null);function us(t,e){if(!e)return t;const s=e.split(".");for(let n=0,i=s.length;n<i;++n){const o=s[n];t=t[o]||(t[o]=Object.create(null))}return t}function Cn(t,e,s){return typeof e=="string"?ms(us(t,e),s):ms(us(t,""),e)}class Of{constructor(e,s){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=n=>n.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=(n,i)=>kn(i.backgroundColor),this.hoverBorderColor=(n,i)=>kn(i.borderColor),this.hoverColor=(n,i)=>kn(i.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(e),this.apply(s)}set(e,s){return Cn(this,e,s)}get(e){return us(this,e)}describe(e,s){return Cn(Wn,e,s)}override(e,s){return Cn(St,e,s)}route(e,s,n,i){const o=us(this,e),a=us(this,n),r="_"+s;Object.defineProperties(o,{[r]:{value:o[s],writable:!0},[s]:{enumerable:!0,get(){const l=this[r],c=a[i];return oe(l)?Object.assign({},c,l):ee(l,c)},set(l){this[r]=l}}})}apply(e){e.forEach(s=>s(this))}}var me=new Of({_scriptable:t=>!t.startsWith("on"),_indexable:t=>t!=="events",hover:{_fallback:"interaction"},interaction:{_scriptable:!1,_indexable:!1}},[Rf,Mf,Lf]);function If(t){return!t||de(t.size)||de(t.family)?null:(t.style?t.style+" ":"")+(t.weight?t.weight+" ":"")+t.size+"px "+t.family}function fo(t,e,s,n,i){let o=e[i];return o||(o=e[i]=t.measureText(i).width,s.push(i)),o>n&&(n=o),n}function _t(t,e,s){const n=t.currentDevicePixelRatio,i=s!==0?Math.max(s/2,.5):0;return Math.round((e-i)*n)/n+i}function po(t,e){!e&&!t||(e=e||t.getContext("2d"),e.save(),e.resetTransform(),e.clearRect(0,0,t.width,t.height),e.restore())}function Gn(t,e,s,n){tr(t,e,s,n,null)}function tr(t,e,s,n,i){let o,a,r,l,c,u,d,h;const f=e.pointStyle,p=e.rotation,g=e.radius;let m=(p||0)*uf;if(f&&typeof f=="object"&&(o=f.toString(),o==="[object HTMLImageElement]"||o==="[object HTMLCanvasElement]")){t.save(),t.translate(s,n),t.rotate(m),t.drawImage(f,-f.width/2,-f.height/2,f.width,f.height),t.restore();return}if(!(isNaN(g)||g<=0)){switch(t.beginPath(),f){default:i?t.ellipse(s,n,i/2,g,0,0,pe):t.arc(s,n,g,0,pe),t.closePath();break;case"triangle":u=i?i/2:g,t.moveTo(s+Math.sin(m)*u,n-Math.cos(m)*g),m+=io,t.lineTo(s+Math.sin(m)*u,n-Math.cos(m)*g),m+=io,t.lineTo(s+Math.sin(m)*u,n-Math.cos(m)*g),t.closePath();break;case"rectRounded":c=g*.516,l=g-c,a=Math.cos(m+mt)*l,d=Math.cos(m+mt)*(i?i/2-c:l),r=Math.sin(m+mt)*l,h=Math.sin(m+mt)*(i?i/2-c:l),t.arc(s-d,n-r,c,m-ge,m-be),t.arc(s+h,n-a,c,m-be,m),t.arc(s+d,n+r,c,m,m+be),t.arc(s-h,n+a,c,m+be,m+ge),t.closePath();break;case"rect":if(!p){l=Math.SQRT1_2*g,u=i?i/2:l,t.rect(s-u,n-l,2*u,2*l);break}m+=mt;case"rectRot":d=Math.cos(m)*(i?i/2:g),a=Math.cos(m)*g,r=Math.sin(m)*g,h=Math.sin(m)*(i?i/2:g),t.moveTo(s-d,n-r),t.lineTo(s+h,n-a),t.lineTo(s+d,n+r),t.lineTo(s-h,n+a),t.closePath();break;case"crossRot":m+=mt;case"cross":d=Math.cos(m)*(i?i/2:g),a=Math.cos(m)*g,r=Math.sin(m)*g,h=Math.sin(m)*(i?i/2:g),t.moveTo(s-d,n-r),t.lineTo(s+d,n+r),t.moveTo(s+h,n-a),t.lineTo(s-h,n+a);break;case"star":d=Math.cos(m)*(i?i/2:g),a=Math.cos(m)*g,r=Math.sin(m)*g,h=Math.sin(m)*(i?i/2:g),t.moveTo(s-d,n-r),t.lineTo(s+d,n+r),t.moveTo(s+h,n-a),t.lineTo(s-h,n+a),m+=mt,d=Math.cos(m)*(i?i/2:g),a=Math.cos(m)*g,r=Math.sin(m)*g,h=Math.sin(m)*(i?i/2:g),t.moveTo(s-d,n-r),t.lineTo(s+d,n+r),t.moveTo(s+h,n-a),t.lineTo(s-h,n+a);break;case"line":a=i?i/2:Math.cos(m)*g,r=Math.sin(m)*g,t.moveTo(s-a,n-r),t.lineTo(s+a,n+r);break;case"dash":t.moveTo(s,n),t.lineTo(s+Math.cos(m)*(i?i/2:g),n+Math.sin(m)*g);break;case!1:t.closePath();break}t.fill(),e.borderWidth>0&&t.stroke()}}function ys(t,e,s){return s=s||.5,!e||t&&t.x>e.left-s&&t.x<e.right+s&&t.y>e.top-s&&t.y<e.bottom+s}function yi(t,e){t.save(),t.beginPath(),t.rect(e.left,e.top,e.right-e.left,e.bottom-e.top),t.clip()}function xi(t){t.restore()}function Ff(t,e,s,n,i){if(!e)return t.lineTo(s.x,s.y);if(i==="middle"){const o=(e.x+s.x)/2;t.lineTo(o,e.y),t.lineTo(o,s.y)}else i==="after"!=!!n?t.lineTo(e.x,s.y):t.lineTo(s.x,e.y);t.lineTo(s.x,s.y)}function Vf(t,e,s,n){if(!e)return t.lineTo(s.x,s.y);t.bezierCurveTo(n?e.cp1x:e.cp2x,n?e.cp1y:e.cp2y,n?s.cp2x:s.cp1x,n?s.cp2y:s.cp1y,s.x,s.y)}function $f(t,e){e.translation&&t.translate(e.translation[0],e.translation[1]),de(e.rotation)||t.rotate(e.rotation),e.color&&(t.fillStyle=e.color),e.textAlign&&(t.textAlign=e.textAlign),e.textBaseline&&(t.textBaseline=e.textBaseline)}function zf(t,e,s,n,i){if(i.strikethrough||i.underline){const o=t.measureText(n),a=e-o.actualBoundingBoxLeft,r=e+o.actualBoundingBoxRight,l=s-o.actualBoundingBoxAscent,c=s+o.actualBoundingBoxDescent,u=i.strikethrough?(l+c)/2:c;t.strokeStyle=t.fillStyle,t.beginPath(),t.lineWidth=i.decorationWidth||2,t.moveTo(a,u),t.lineTo(r,u),t.stroke()}}function Bf(t,e){const s=t.fillStyle;t.fillStyle=e.color,t.fillRect(e.left,e.top,e.width,e.height),t.fillStyle=s}function xs(t,e,s,n,i,o={}){const a=xe(e)?e:[e],r=o.strokeWidth>0&&o.strokeColor!=="";let l,c;for(t.save(),t.font=i.string,$f(t,o),l=0;l<a.length;++l)c=a[l],o.backdrop&&Bf(t,o.backdrop),r&&(o.strokeColor&&(t.strokeStyle=o.strokeColor),de(o.strokeWidth)||(t.lineWidth=o.strokeWidth),t.strokeText(c,s,n,o.maxWidth)),t.fillText(c,s,n,o.maxWidth),zf(t,s,n,c,o),n+=Number(i.lineHeight);t.restore()}function qn(t,e){const{x:s,y:n,w:i,h:o,radius:a}=e;t.arc(s+a.topLeft,n+a.topLeft,a.topLeft,1.5*ge,ge,!0),t.lineTo(s,n+o-a.bottomLeft),t.arc(s+a.bottomLeft,n+o-a.bottomLeft,a.bottomLeft,ge,be,!0),t.lineTo(s+i-a.bottomRight,n+o),t.arc(s+i-a.bottomRight,n+o-a.bottomRight,a.bottomRight,be,0,!0),t.lineTo(s+i,n+a.topRight),t.arc(s+i-a.topRight,n+a.topRight,a.topRight,0,-be,!0),t.lineTo(s+a.topLeft,n)}const Nf=/^(normal|(\d+(?:\.\d+)?)(px|em|%)?)$/,Uf=/^(normal|italic|initial|inherit|unset|(oblique( -?[0-9]?[0-9]deg)?))$/;function Hf(t,e){const s=(""+t).match(Nf);if(!s||s[1]==="normal")return e*1.2;switch(t=+s[2],s[3]){case"px":return t;case"%":t/=100;break}return e*t}const jf=t=>+t||0;function wi(t,e){const s={},n=oe(e),i=n?Object.keys(e):e,o=oe(t)?n?a=>ee(t[a],t[e[a]]):a=>t[a]:()=>t;for(const a of i)s[a]=jf(o(a));return s}function Wf(t){return wi(t,{top:"y",right:"x",bottom:"y",left:"x"})}function ds(t){return wi(t,["topLeft","topRight","bottomLeft","bottomRight"])}function Ue(t){const e=Wf(t);return e.width=e.left+e.right,e.height=e.top+e.bottom,e}function De(t,e){t=t||{},e=e||me.font;let s=ee(t.size,e.size);typeof s=="string"&&(s=parseInt(s,10));let n=ee(t.style,e.style);n&&!(""+n).match(Uf)&&(console.warn('Invalid font style specified: "'+n+'"'),n=void 0);const i={family:ee(t.family,e.family),lineHeight:Hf(ee(t.lineHeight,e.lineHeight),s),size:s,style:n,weight:ee(t.weight,e.weight),string:""};return i.string=If(i),i}function Ts(t,e,s,n){let i,o,a;for(i=0,o=t.length;i<o;++i)if(a=t[i],a!==void 0&&a!==void 0)return a}function Gf(t,e,s){const{min:n,max:i}=t,o=qa(e,(i-n)/2),a=(r,l)=>s&&r===0?0:r+l;return{min:a(n,-Math.abs(o)),max:a(i,o)}}function Ct(t,e){return Object.assign(Object.create(t),e)}function Si(t,e=[""],s,n,i=()=>t[0]){const o=s||t;typeof n>"u"&&(n=or("_fallback",t));const a={[Symbol.toStringTag]:"Object",_cacheable:!0,_scopes:t,_rootScopes:o,_fallback:n,_getTarget:i,override:r=>Si([r,...t],e,o,n)};return new Proxy(a,{deleteProperty(r,l){return delete r[l],delete r._keys,delete t[0][l],!0},get(r,l){return nr(r,l,()=>ep(l,e,t,r))},getOwnPropertyDescriptor(r,l){return Reflect.getOwnPropertyDescriptor(r._scopes[0],l)},getPrototypeOf(){return Reflect.getPrototypeOf(t[0])},has(r,l){return mo(r).includes(l)},ownKeys(r){return mo(r)},set(r,l,c){const u=r._storage||(r._storage=i());return r[l]=u[l]=c,delete r._keys,!0}})}function Nt(t,e,s,n){const i={_cacheable:!1,_proxy:t,_context:e,_subProxy:s,_stack:new Set,_descriptors:sr(t,n),setContext:o=>Nt(t,o,s,n),override:o=>Nt(t.override(o),e,s,n)};return new Proxy(i,{deleteProperty(o,a){return delete o[a],delete t[a],!0},get(o,a,r){return nr(o,a,()=>Yf(o,a,r))},getOwnPropertyDescriptor(o,a){return o._descriptors.allKeys?Reflect.has(t,a)?{enumerable:!0,configurable:!0}:void 0:Reflect.getOwnPropertyDescriptor(t,a)},getPrototypeOf(){return Reflect.getPrototypeOf(t)},has(o,a){return Reflect.has(t,a)},ownKeys(){return Reflect.ownKeys(t)},set(o,a,r){return t[a]=r,delete o[a],!0}})}function sr(t,e={scriptable:!0,indexable:!0}){const{_scriptable:s=e.scriptable,_indexable:n=e.indexable,_allKeys:i=e.allKeys}=t;return{allKeys:i,scriptable:s,indexable:n,isScriptable:gt(s)?s:()=>s,isIndexable:gt(n)?n:()=>n}}const qf=(t,e)=>t?t+gi(e):e,ki=(t,e)=>oe(e)&&t!=="adapters"&&(Object.getPrototypeOf(e)===null||e.constructor===Object);function nr(t,e,s){if(Object.prototype.hasOwnProperty.call(t,e)||e==="constructor")return t[e];const n=s();return t[e]=n,n}function Yf(t,e,s){const{_proxy:n,_context:i,_subProxy:o,_descriptors:a}=t;let r=n[e];return gt(r)&&a.isScriptable(e)&&(r=Xf(e,r,t,s)),xe(r)&&r.length&&(r=Kf(e,r,t,a.isIndexable)),ki(e,r)&&(r=Nt(r,i,o&&o[e],a)),r}function Xf(t,e,s,n){const{_proxy:i,_context:o,_subProxy:a,_stack:r}=s;if(r.has(t))throw new Error("Recursion detected: "+Array.from(r).join("->")+"->"+t);r.add(t);let l=e(o,a||n);return r.delete(t),ki(t,l)&&(l=Ci(i._scopes,i,t,l)),l}function Kf(t,e,s,n){const{_proxy:i,_context:o,_subProxy:a,_descriptors:r}=s;if(typeof o.index<"u"&&n(t))return e[o.index%e.length];if(oe(e[0])){const l=e,c=i._scopes.filter(u=>u!==l);e=[];for(const u of l){const d=Ci(c,i,t,u);e.push(Nt(d,o,a&&a[t],r))}}return e}function ir(t,e,s){return gt(t)?t(e,s):t}const Qf=(t,e)=>t===!0?e:typeof t=="string"?_s(e,t):void 0;function Zf(t,e,s,n,i){for(const o of e){const a=Qf(s,o);if(a){t.add(a);const r=ir(a._fallback,s,i);if(typeof r<"u"&&r!==s&&r!==n)return r}else if(a===!1&&typeof n<"u"&&s!==n)return null}return!1}function Ci(t,e,s,n){const i=e._rootScopes,o=ir(e._fallback,s,n),a=[...t,...i],r=new Set;r.add(n);let l=go(r,a,s,o||s,n);return l===null||typeof o<"u"&&o!==s&&(l=go(r,a,o,l,n),l===null)?!1:Si(Array.from(r),[""],i,o,()=>Jf(e,s,n))}function go(t,e,s,n,i){for(;s;)s=Zf(t,e,s,n,i);return s}function Jf(t,e,s){const n=t._getTarget();e in n||(n[e]={});const i=n[e];return xe(i)&&oe(s)?s:i||{}}function ep(t,e,s,n){let i;for(const o of e)if(i=or(qf(o,t),s),typeof i<"u")return ki(t,i)?Ci(s,n,t,i):i}function or(t,e){for(const s of e){if(!s)continue;const n=s[t];if(typeof n<"u")return n}}function mo(t){let e=t._keys;return e||(e=t._keys=tp(t._scopes)),e}function tp(t){const e=new Set;for(const s of t)for(const n of Object.keys(s).filter(i=>!i.startsWith("_")))e.add(n);return Array.from(e)}const sp=Number.EPSILON||1e-14,Ut=(t,e)=>e<t.length&&!t[e].skip&&t[e],ar=t=>t==="x"?"y":"x";function np(t,e,s,n){const i=t.skip?e:t,o=e,a=s.skip?e:s,r=jn(o,i),l=jn(a,o);let c=r/(r+l),u=l/(r+l);c=isNaN(c)?0:c,u=isNaN(u)?0:u;const d=n*c,h=n*u;return{previous:{x:o.x-d*(a.x-i.x),y:o.y-d*(a.y-i.y)},next:{x:o.x+h*(a.x-i.x),y:o.y+h*(a.y-i.y)}}}function ip(t,e,s){const n=t.length;let i,o,a,r,l,c=Ut(t,0);for(let u=0;u<n-1;++u)if(l=c,c=Ut(t,u+1),!(!l||!c)){if(ls(e[u],0,sp)){s[u]=s[u+1]=0;continue}i=s[u]/e[u],o=s[u+1]/e[u],r=Math.pow(i,2)+Math.pow(o,2),!(r<=9)&&(a=3/Math.sqrt(r),s[u]=i*a*e[u],s[u+1]=o*a*e[u])}}function op(t,e,s="x"){const n=ar(s),i=t.length;let o,a,r,l=Ut(t,0);for(let c=0;c<i;++c){if(a=r,r=l,l=Ut(t,c+1),!r)continue;const u=r[s],d=r[n];a&&(o=(u-a[s])/3,r[`cp1${s}`]=u-o,r[`cp1${n}`]=d-o*e[c]),l&&(o=(l[s]-u)/3,r[`cp2${s}`]=u+o,r[`cp2${n}`]=d+o*e[c])}}function ap(t,e="x"){const s=ar(e),n=t.length,i=Array(n).fill(0),o=Array(n);let a,r,l,c=Ut(t,0);for(a=0;a<n;++a)if(r=l,l=c,c=Ut(t,a+1),!!l){if(c){const u=c[e]-l[e];i[a]=u!==0?(c[s]-l[s])/u:0}o[a]=r?c?Bt(i[a-1])!==Bt(i[a])?0:(i[a-1]+i[a])/2:i[a-1]:i[a]}ip(t,i,o),op(t,o,e)}function Es(t,e,s){return Math.max(Math.min(t,s),e)}function rp(t,e){let s,n,i,o,a,r=ys(t[0],e);for(s=0,n=t.length;s<n;++s)a=o,o=r,r=s<n-1&&ys(t[s+1],e),o&&(i=t[s],a&&(i.cp1x=Es(i.cp1x,e.left,e.right),i.cp1y=Es(i.cp1y,e.top,e.bottom)),r&&(i.cp2x=Es(i.cp2x,e.left,e.right),i.cp2y=Es(i.cp2y,e.top,e.bottom)))}function lp(t,e,s,n,i){let o,a,r,l;if(e.spanGaps&&(t=t.filter(c=>!c.skip)),e.cubicInterpolationMode==="monotone")ap(t,i);else{let c=n?t[t.length-1]:t[0];for(o=0,a=t.length;o<a;++o)r=t[o],l=np(c,r,t[Math.min(o+1,a-(n?0:1))%a],e.tension),r.cp1x=l.previous.x,r.cp1y=l.previous.y,r.cp2x=l.next.x,r.cp2y=l.next.y,c=r}e.capBezierPoints&&rp(t,s)}function Pi(){return typeof window<"u"&&typeof document<"u"}function Di(t){let e=t.parentNode;return e&&e.toString()==="[object ShadowRoot]"&&(e=e.host),e}function Js(t,e,s){let n;return typeof t=="string"?(n=parseInt(t,10),t.indexOf("%")!==-1&&(n=n/100*e.parentNode[s])):n=t,n}const cn=t=>t.ownerDocument.defaultView.getComputedStyle(t,null);function cp(t,e){return cn(t).getPropertyValue(e)}const up=["top","right","bottom","left"];function wt(t,e,s){const n={};s=s?"-"+s:"";for(let i=0;i<4;i++){const o=up[i];n[o]=parseFloat(t[e+"-"+o+s])||0}return n.width=n.left+n.right,n.height=n.top+n.bottom,n}const dp=(t,e,s)=>(t>0||e>0)&&(!s||!s.shadowRoot);function hp(t,e){const s=t.touches,n=s&&s.length?s[0]:t,{offsetX:i,offsetY:o}=n;let a=!1,r,l;if(dp(i,o,t.target))r=i,l=o;else{const c=e.getBoundingClientRect();r=n.clientX-c.left,l=n.clientY-c.top,a=!0}return{x:r,y:l,box:a}}function bt(t,e){if("native"in t)return t;const{canvas:s,currentDevicePixelRatio:n}=e,i=cn(s),o=i.boxSizing==="border-box",a=wt(i,"padding"),r=wt(i,"border","width"),{x:l,y:c,box:u}=hp(t,s),d=a.left+(u&&r.left),h=a.top+(u&&r.top);let{width:f,height:p}=e;return o&&(f-=a.width+r.width,p-=a.height+r.height),{x:Math.round((l-d)/f*s.width/n),y:Math.round((c-h)/p*s.height/n)}}function fp(t,e,s){let n,i;if(e===void 0||s===void 0){const o=t&&Di(t);if(!o)e=t.clientWidth,s=t.clientHeight;else{const a=o.getBoundingClientRect(),r=cn(o),l=wt(r,"border","width"),c=wt(r,"padding");e=a.width-c.width-l.width,s=a.height-c.height-l.height,n=Js(r.maxWidth,o,"clientWidth"),i=Js(r.maxHeight,o,"clientHeight")}}return{width:e,height:s,maxWidth:n||Zs,maxHeight:i||Zs}}const Ls=t=>Math.round(t*10)/10;function pp(t,e,s,n){const i=cn(t),o=wt(i,"margin"),a=Js(i.maxWidth,t,"clientWidth")||Zs,r=Js(i.maxHeight,t,"clientHeight")||Zs,l=fp(t,e,s);let{width:c,height:u}=l;if(i.boxSizing==="content-box"){const h=wt(i,"border","width"),f=wt(i,"padding");c-=f.width+h.width,u-=f.height+h.height}return c=Math.max(0,c-o.width),u=Math.max(0,n?c/n:u-o.height),c=Ls(Math.min(c,a,l.maxWidth)),u=Ls(Math.min(u,r,l.maxHeight)),c&&!u&&(u=Ls(c/2)),(e!==void 0||s!==void 0)&&n&&l.height&&u>l.height&&(u=l.height,c=Ls(Math.floor(u*n))),{width:c,height:u}}function _o(t,e,s){const n=e||1,i=Math.floor(t.height*n),o=Math.floor(t.width*n);t.height=Math.floor(t.height),t.width=Math.floor(t.width);const a=t.canvas;return a.style&&(s||!a.style.height&&!a.style.width)&&(a.style.height=`${t.height}px`,a.style.width=`${t.width}px`),t.currentDevicePixelRatio!==n||a.height!==i||a.width!==o?(t.currentDevicePixelRatio=n,a.height=i,a.width=o,t.ctx.setTransform(n,0,0,n,0,0),!0):!1}const gp=function(){let t=!1;try{const e={get passive(){return t=!0,!1}};Pi()&&(window.addEventListener("test",null,e),window.removeEventListener("test",null,e))}catch{}return t}();function vo(t,e){const s=cp(t,e),n=s&&s.match(/^(\d+)(\.\d+)?px$/);return n?+n[1]:void 0}function yt(t,e,s,n){return{x:t.x+s*(e.x-t.x),y:t.y+s*(e.y-t.y)}}function mp(t,e,s,n){return{x:t.x+s*(e.x-t.x),y:n==="middle"?s<.5?t.y:e.y:n==="after"?s<1?t.y:e.y:s>0?e.y:t.y}}function _p(t,e,s,n){const i={x:t.cp2x,y:t.cp2y},o={x:e.cp1x,y:e.cp1y},a=yt(t,i,s),r=yt(i,o,s),l=yt(o,e,s),c=yt(a,r,s),u=yt(r,l,s);return yt(c,u,s)}const vp=function(t,e){return{x(s){return t+t+e-s},setWidth(s){e=s},textAlign(s){return s==="center"?s:s==="right"?"left":"right"},xPlus(s,n){return s-n},leftForLtr(s,n){return s-n}}},bp=function(){return{x(t){return t},setWidth(t){},textAlign(t){return t},xPlus(t,e){return t+e},leftForLtr(t,e){return t}}};function Ot(t,e,s){return t?vp(e,s):bp()}function rr(t,e){let s,n;(e==="ltr"||e==="rtl")&&(s=t.canvas.style,n=[s.getPropertyValue("direction"),s.getPropertyPriority("direction")],s.setProperty("direction",e,"important"),t.prevTextDirection=n)}function lr(t,e){e!==void 0&&(delete t.prevTextDirection,t.canvas.style.setProperty("direction",e[0],e[1]))}function cr(t){return t==="angle"?{between:bs,compare:mf,normalize:ct}:{between:Lt,compare:(e,s)=>e-s,normalize:e=>e}}function bo({start:t,end:e,count:s,loop:n,style:i}){return{start:t%s,end:e%s,loop:n&&(e-t+1)%s===0,style:i}}function yp(t,e,s){const{property:n,start:i,end:o}=s,{between:a,normalize:r}=cr(n),l=e.length;let{start:c,end:u,loop:d}=t,h,f;if(d){for(c+=l,u+=l,h=0,f=l;h<f&&a(r(e[c%l][n]),i,o);++h)c--,u--;c%=l,u%=l}return u<c&&(u+=l),{start:c,end:u,loop:d,style:t.style}}function xp(t,e,s){if(!s)return[t];const{property:n,start:i,end:o}=s,a=e.length,{compare:r,between:l,normalize:c}=cr(n),{start:u,end:d,loop:h,style:f}=yp(t,e,s),p=[];let g=!1,m=null,y, v,k;const P=()=>l(i,k,y)&&r(i,k)!==0,C=()=>r(o,y)===0||l(o,k,y),O=()=>g||P(),R=()=>!g||C();for(let E=u,z=u;E<=d;++E)v=e[E%a],!v.skip&&(y=c(v[n]),y!==k&&(g=l(y,i,o),m===null&&O()&&(m=r(y,i)===0?E:z),m!==null&&R()&&(p.push(bo({start:m,end:E,loop:h,count:a,style:f})),m=null),z=E,k=y));return m!==null&&p.push(bo({start:m,end:d,loop:h,count:a,style:f})),p}function wp(t,e){const s=[],n=t.segments;for(let i=0;i<n.length;i++){const o=xp(n[i],t.points,e);o.length&&s.push(...o)}return s}function Sp(t,e,s,n){let i=0,o=e-1;if(s&&!n)for(;i<e&&!t[i].skip;)i++;for(;i<e&&t[i].skip;)i++;for(i%=e,s&&(o+=i);o>i&&t[o%e].skip;)o--;return o%=e,{start:i,end:o}}function kp(t,e,s,n){const i=t.length,o=[];let a=e,r=t[e],l;for(l=e+1;l<=s;++l){const c=t[l%i];c.skip||c.stop?r.skip||(n=!1,o.push({start:e%i,end:(l-1)%i,loop:n}),e=a=c.stop?l:null):(a=l,r.skip&&(e=l)),r=c}return a!==null&&o.push({start:e%i,end:a%i,loop:n}),o}function Cp(t,e){const s=t.points,n=t.options.spanGaps,i=s.length;if(!i)return[];const o=!!t._loop,{start:a,end:r}=Sp(s,i,o,n);if(n===!0)return yo(t,[{start:a,end:r,loop:o}],s,e);const l=r<a?r+i:r,c=!!t._fullLoop&&a===0&&r===i-1;return yo(t,kp(s,a,l,c),s,e)}function yo(t,e,s,n){return!n||!n.setContext||!s?e:Pp(t,e,s,n)}function Pp(t,e,s,n){const i=t._chart.getContext(),o=xo(t.options),{_datasetIndex:a,options:{spanGaps:r}}=t,l=s.length,c=[];let u=o,d=e[0].start,h=d;function f(p,g,m,y){const v=r?-1:1;if(p!==g){for(p+=l;s[p%l].skip;)p-=v;for(;s[g%l].skip;)g+=v;p%l!==g%l&&(c.push({start:p%l,end:g%l,loop:m,style:y}),u=y,d=g%l)}}for(const p of e){d=r?d:p.start;let g=s[d%l],m;for(h=d+1;h<=p.end;h++){const y=s[h%l];m=xo(n.setContext(Ct(i,{type:"segment",p0:g,p1:y,p0DataIndex:(h-1)%l,p1DataIndex:h%l,datasetIndex:a}))),Dp(m,u)&&f(d,h-1,p.loop,u),g=y,u=m}d<h-1&&f(d,h-1,p.loop,u)}return c}function xo(t){return{backgroundColor:t.backgroundColor,borderCapStyle:t.borderCapStyle,borderDash:t.borderDash,borderDashOffset:t.borderDashOffset,borderJoinStyle:t.borderJoinStyle,borderWidth:t.borderWidth,borderColor:t.borderColor}}function Dp(t,e){if(!e)return!1;const s=[],n=function(i,o){return vi(o)?(s.includes(o)||s.push(o),s.indexOf(o)):o};return JSON.stringify(t,n)!==JSON.stringify(e,n)}function Os(t,e,s){return t.options.clip?t[s]:e[s]}function Rp(t,e){const{xScale:s,yScale:n}=t;return s&&n?{left:Os(s,e,"left"),right:Os(s,e,"right"),top:Os(n,e,"top"),bottom:Os(n,e,"bottom")}:e}function Mp(t,e){const s=e._clip;if(s.disabled)return!1;const n=Rp(e,t.chartArea);return{left:s.left===!1?0:n.left-(s.left===!0?0:s.left),right:s.right===!1?t.width:n.right+(s.right===!0?0:s.right),top:s.top===!1?0:n.top-(s.top===!0?0:s.top),bottom:s.bottom===!1?t.height:n.bottom+(s.bottom===!0?0:s.bottom)}}/*!20 */function et(){}const tf=(()=>{let t=0;return()=>t++})();function de(t){return t==null}function xe(t){if(Array.isArray&&Array.isArray(t))return!0;const e=Object.prototype.toString.call(t);return e.slice(0,7)==="[object"&&e.slice(-6)==="Array]"}function oe(t){return t!==null&&Object.prototype.toString.call(t)==="[object Object]"}function Ne(t){return(typeof t=="number"||t instanceof Number)&&isFinite(+t)}function Ye(t,e){return Ne(t)?t:e}function ee(t,e){return typeof t>"u"?e:t}const sf=(t,e)=>typeof t=="string"&&t.endsWith("%")?parseFloat(t)/100:+t/e,qa=(t,e)=>typeof t=="string"&&t.endsWith("%")?parseFloat(t)/100*e:+t;function fe(t,e,s){if(t&&typeof t.call=="function")return t.apply(s,e)}function re(t,e,s,n){let i,o,a;if(xe(t))for(o=t.length,i=0;i<o;i++)e.call(s,t[i],i);else if(oe(t))for(a=Object.keys(t),o=a.length,i=0;i<o;i++)e.call(s,t[a[i]],a[i])}function Xs(t,e){let s,n,i,o;if(!t||!e||t.length!==e.length)return!1;for(s=0,n=t.length;s<n;++s)if(i=t[s],o=e[s],i.datasetIndex!==o.datasetIndex||i.index!==o.index)return!1;return!0}function Ks(t){if(xe(t))return t.map(Ks);if(oe(t)){const e=Object.create(null),s=Object.keys(t),n=s.length;let i=0;for(;i<n;++i)e[s[i]]=Ks(t[s[i]]);return e}return t}function Ya(t){return["__proto__","prototype","constructor"].indexOf(t)===-1}function nf(t,e,s,n){if(!Ya(t))return;const i=e[t],o=s[t];oe(i)&&oe(o)?ms(i,o,n):e[t]=Ks(o)}function ms(t,e,s){const n=xe(e)?e:[e],i=n.length;if(!oe(t))return t;s=s||{};const o=s.merger||nf;let a;for(let r=0;r<i;++r){if(a=n[r],!oe(a))continue;const l=Object.keys(a);for(let c=0,u=l.length;c<u;++c)o(l[c],t,a,s)}return t}function rs(t,e){return ms(t,e,{merger:of})}function of(t,e,s){if(!Ya(t))return;const n=e[t],i=s[t];oe(n)&&oe(i)?rs(n,i):Object.prototype.hasOwnProperty.call(e,t)||(e[t]=Ks(i))}const so={"":t=>t,x:t=>t.x,y:t=>t.y};function af(t){const e=t.split("."),s=[];let n="";for(const i of e)n+=i,n.endsWith("\\")?n=n.slice(0,-1)+".":(s.push(n),n="");return s}function rf(t){const e=af(t);return s=>{for(const n of e){if(n==="")break;s=s&&s[n]}return s}}function _s(t,e){return(so[e]||(so[e]=rf(e)))(t)}function gi(t){return t.charAt(0).toUpperCase()+t.slice(1)}const Qs=t=>typeof t<"u",gt=t=>typeof t=="function",no=(t,e)=>{if(t.size!==e.size)return!1;for(const s of t)if(!e.has(s))return!1;return!0};function lf(t){return t.type==="mouseup"||t.type==="click"||t.type==="contextmenu"}const ge=Math.PI,pe=2*ge,cf=pe+ge,Zs=Number.POSITIVE_INFINITY,uf=ge/180,be=ge/2,mt=ge/4,io=ge*2/3,Xa=Math.log10,Bt=Math.sign;function ls(t,e,s){return Math.abs(t-e)<s}function oo(t){const e=Math.round(t);t=ls(t,e,t/1e3)?e:t;const s=Math.pow(10,Math.floor(Xa(t))),n=t/s;return(n<=1?1:n<=2?2:n<=5?5:10)*s}function df(t){const e=[],s=Math.sqrt(t);let n;for(n=1;n<s;n++)t%n===0&&(e.push(n),e.push(t/n));return s===(s|0)&&e.push(s),e.sort((i,o)=>i-o).pop(),e}function hf(t){return typeof t=="symbol"||typeof t=="object"&&t!==null&&!(Symbol.toPrimitive in t||"toString"in t||"valueOf"in t)}function vs(t){return!hf(t)&&!isNaN(parseFloat(t))&&isFinite(t)}function ff(t,e){const s=Math.round(t);return s-e<=t&&s+e>=t}function pf(t,e,s){let n,i,o;for(n=0,i=t.length;n<i;n++)o=t[n][s],isNaN(o)||(e.min=Math.min(e.min,o),e.max=Math.max(e.max,o))}function it(t){return t*(ge/180)}function gf(t){return t*(180/ge)}function ao(t){if(!Ne(t))return;let e=1,s=0;for(;Math.round(t*e)/e!==t;)e*=10,s++;return s}function Ka(t,e){const s=e.x-t.x,n=e.y-t.y,i=Math.sqrt(s*s+n*n);let o=Math.atan2(n,s);return o<-.5*ge&&(o+=pe),{angle:o,distance:i}}function jn(t,e){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function mf(t,e){return(t-e+cf)%pe-ge}function ct(t){return(t%pe+pe)%pe}function bs(t,e,s,n){const i=ct(t),o=ct(e),a=ct(s),r=ct(o-i),l=ct(a-i),c=ct(i-o),u=ct(i-a);return i===o||i===a||n&&o===a||r>l&&c<u}function Re(t,e,s){return Math.max(e,Math.min(s,t))}function _f(t){return Re(t,-32768,32767)}function Lt(t,e,s,n=1e-6){return t>=Math.min(e,s)-n&&t<=Math.max(e,s)+n}function mi(t,e,s){s=s||(a=>t[a]<e);let n=t.length-1,i=0,o;for(;n-i>1;)o=i+n>>1,s(o)?i=o:n=o;return{lo:i,hi:n}}const xt=(t,e,s,n)=>mi(t,s,n?i=>{const o=t[i][e];return o<s||o===s&&t[i+1][e]===s}:i=>t[i][e]<s),vf=(t,e,s)=>mi(t,s,n=>t[n][e]>=s);function bf(t,e,s){let n=0,i=t.length;for(;n<i&&t[n]<e;)n++;for(;i>n&&t[i-1]>s;)i--;return n>0||i<t.length?t.slice(n,i):t}const Qa=["push","pop","shift","splice","unshift"];function yf(t,e){if(t._chartjs){t._chartjs.listeners.push(e);return}Object.defineProperty(t,"_chartjs",{configurable:!0,enumerable:!1,value:{listeners:[e]}}),Qa.forEach(s=>{const n="_onData"+gi(s),i=t[s];Object.defineProperty(t,s,{configurable:!0,enumerable:!1,value(...o){const a=i.apply(this,o);return t._chartjs.listeners.forEach(r=>{typeof r[n]=="function"&&r[n](...o)}),a}})})}function ro(t,e){const s=t._chartjs;if(!s)return;const n=s.listeners,i=n.indexOf(e);i!==-1&&n.splice(i,1),!(n.length>0)&&(Qa.forEach(o=>{delete t[o]}),delete t._chartjs)}function xf(t){const e=new Set(t);return e.size===t.length?t:Array.from(e)}const Za=function(){return typeof window>"u"?function(t){return t()}:window.requestAnimationFrame}();function Ja(t,e){let s=[],n=!1;return function(...i){s=i,n||(n=!0,Za.call(window,()=>{n=!1,t.apply(e,s)}))}}function wf(t,e){let s;return function(...n){return e?(clearTimeout(s),s=setTimeout(t,e,n)):t.apply(this,n),e}}const _i=t=>t==="start"?"left":t==="end"?"right":"center",Pe=(t,e,s)=>t==="start"?e:t==="end"?s:(e+s)/2,Sf=(t,e,s,n)=>t===(n?"left":"right")?s:t==="center"?(e+s)/2:e;function kf(t,e,s){const n=e.length;let i=0,o=n;if(t._sorted){const{iScale:a,vScale:r,_parsed:l}=t,c=t.dataset&&t.dataset.options?t.dataset.options.spanGaps:null,u=a.axis,{min:d,max:h,minDefined:f,maxDefined:p}=a.getUserBounds();if(f){if(i=Math.min(xt(l,u,d).lo,s?n:xt(e,u,a.getPixelForValue(d)).lo),c){const g=l.slice(0,i+1).reverse().findIndex(m=>!de(m[r.axis]));i-=Math.max(0,g)}i=Re(i,0,n-1)}if(p){let g=Math.max(xt(l,a.axis,h,!0).hi+1,s?0:xt(e,u,a.getPixelForValue(h),!0).hi+1);if(c){const m=l.slice(g-1).findIndex(y=>!de(y[r.axis]));g+=Math.max(0,m)}o=Re(g,i,n)-i}else o=n-i}return{start:i,count:o}}function Cf(t){const{xScale:e,yScale:s,_scaleRanges:n}=t,i={xmin:e.min,xmax:e.max,ymin:s.min,ymax:s.max};if(!n)return t._scaleRanges=i,!0;const o=n.xmin!==e.min||n.xmax!==e.max||n.ymin!==s.min||n.ymax!==s.max;return Object.assign(n,i),o}const As=t=>t===0||t===1,lo=(t,e,s)=>-(Math.pow(2,10*(t-=1))*Math.sin((t-e)*pe/s)),co=(t,e,s)=>Math.pow(2,-10*t)*Math.sin((t-e)*pe/s)+1,cs={linear:t=>t,easeInQuad:t=>t*t,easeOutQuad:t=>-t*(t-2),easeInOutQuad:t=>(t/=.5)<1?.5*t*t:-.5*(--t*(t-2)-1),easeInCubic:t=>t*t*t,easeOutCubic:t=>(t-=1)*t*t+1,easeInOutCubic:t=>(t/=.5)<1?.5*t*t*t:.5*((t-=2)*t*t+2),easeInQuart:t=>t*t*t*t,easeOutQuart:t=>-((t-=1)*t*t*t-1),easeInOutQuart:t=>(t/=.5)<1?.5*t*t*t*t:-.5*((t-=2)*t*t*t-2),easeInQuint:t=>t*t*t*t*t,easeOutQuint:t=>(t-=1)*t*t*t*t+1,easeInOutQuint:t=>(t/=.5)<1?.5*t*t*t*t*t:.5*((t-=2)*t*t*t*t+2),easeInSine:t=>-Math.cos(t*be)+1,easeOutSine:t=>Math.sin(t*be),easeInOutSine:t=>-.5*(Math.cos(ge*t)-1),easeInExpo:t=>t===0?0:Math.pow(2,10*(t-1)),easeOutExpo:t=>t===1?1:-Math.pow(2,-10*t)+1,easeInOutExpo:t=>As(t)?t:t<.5?.5*Math.pow(2,10*(t*2-1)):.5*(-Math.pow(2,-10*(t*2-1))+2),easeInCirc:t=>t>=1?t:-(Math.sqrt(1-t*t)-1),easeOutCirc:t=>Math.sqrt(1-(t-=1)*t),easeInOutCirc:t=>(t/=.5)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1),easeInElastic:t=>As(t)?t:lo(t,.075,.3),easeOutElastic:t=>As(t)?t:co(t,.075,.3),easeInOutElastic(t){return As(t)?t:t<.5?.5*lo(t*2,.1125,.45):.5+.5*co(t*2-1,.1125,.45)},easeInBack(t){return t*t*((1.70158+1)*t-1.70158)},easeOutBack(t){return(t-=1)*t*((1.70158+1)*t+1.70158)+1},easeInOutBack(t){let e=1.70158;return(t/=.5)<1?.5*(t*t*(((e*=1.525)+1)*t-e)):.5*((t-=2)*t*(((e*=1.525)+1)*t+e)+2)},easeInBounce:t=>1-cs.easeOutBounce(1-t),easeOutBounce(t){return t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375},easeInOutBounce:t=>t<.5?cs.easeInBounce(t*2)*.5:cs.easeOutBounce(t*2-1)*.5+.5};function vi(t){if(t&&typeof t=="object"){const e=t.toString();return e==="[object CanvasPattern]"||e==="[object CanvasGradient]"}return!1}function uo(t){return vi(t)?t:new gs(t)}function kn(t){return vi(t)?t:new gs(t).saturate(.5).darken(.1).hexString()}const Pf=["x","y","borderWidth","radius","tension"],Df=["color","borderColor","backgroundColor"];function Rf(t){t.set("animation",{delay:void 0,duration:1e3,easing:"easeOutQuart",fn:void 0,from:void 0,loop:void 0,to:void 0,type:void 0}),t.describe("animation",{_fallback:!1,_indexable:!1,_scriptable:e=>e!=="onProgress"&&e!=="onComplete"&&e!=="fn"}),t.set("animations",{colors:{type:"color",properties:Df},numbers:{type:"number",properties:Pf}}),t.describe("animations",{_fallback:"animation"}),t.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:e=>e|0}}}})}function Mf(t){t.set("layout",{autoPadding:!0,padding:{top:0,right:0,bottom:0,left:0}})}const ho=new Map;function Af(t,e){e=e||{};const s=t+JSON.stringify(e);let n=ho.get(s);return n||(n=new Intl.NumberFormat(t,e),ho.set(s,n)),n}function bi(t,e,s){return Af(e,s).format(t)}const Tf={values(t){return xe(t)?t:""+t},numeric(t,e,s){if(t===0)return"0";const n=this.chart.options.locale;let i,o=t;if(s.length>1){const c=Math.max(Math.abs(s[0].value),Math.abs(s[s.length-1].value));(c<1e-4||c>1e15)&&(i="scientific"),o=Ef(t,s)}const a=Xa(Math.abs(o)),r=isNaN(a)?1:Math.max(Math.min(-1*Math.floor(a),20),0),l={notation:i,minimumFractionDigits:r,maximumFractionDigits:r};return Object.assign(l,this.options.ticks.format),bi(t,n,l)}};function Ef(t,e){let s=e.length>3?e[2].value-e[1].value:e[1].value-e[0].value;return Math.abs(s)>=1&&t!==Math.floor(t)&&(s=t-Math.floor(t)),s}var er={formatters:Tf};function Lf(t){t.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:(e,s)=>s.lineWidth,tickColor:(e,s)=>s.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:er.formatters.values,minor:{},major:{},align:"center",crossAlign:"near",showLabelBackdrop:!1,backdropColor:"rgba(255, 255, 255, 0.75)",backdropPadding:2}}),t.route("scale.ticks","color","","color"),t.route("scale.grid","color","","borderColor"),t.route("scale.border","color","","borderColor"),t.route("scale.title","color","","color"),t.describe("scale",{_fallback:!1,_scriptable:e=>!e.startsWith("before")&&!e.startsWith("after")&&e!=="callback"&&e!=="parser",_indexable:e=>e!=="borderDash"&&e!=="tickBorderDash"&&e!=="dash"}),t.describe("scales",{_fallback:"scale"}),t.describe("scale.ticks",{_scriptable:e=>e!=="backdropPadding"&&e!=="callback",_indexable:e=>e!=="backdropPadding"})}const St=Object.create(null),Wn=Object.create(null);function us(t,e){if(!e)return t;const s=e.split(".");for(let n=0,i=s.length;n<i;++n){const o=s[n];t=t[o]||(t[o]=Object.create(null))}return t}function Cn(t,e,s){return typeof e=="string"?ms(us(t,e),s):ms(us(t,""),e)}class Of{constructor(e,s){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=n=>n.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=(n,i)=>kn(i.backgroundColor),this.hoverBorderColor=(n,i)=>kn(i.borderColor),this.hoverColor=(n,i)=>kn(i.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(e),this.apply(s)}set(e,s){return Cn(this,e,s)}get(e){return us(this,e)}describe(e,s){return Cn(Wn,e,s)}override(e,s){return Cn(St,e,s)}route(e,s,n,i){const o=us(this,e),a=us(this,n),r="_"+s;Object.defineProperties(o,{[r]:{value:o[s],writable:!0},[s]:{enumerable:!0,get(){const l=this[r],c=a[i];return oe(l)?Object.assign({},c,l):ee(l,c)},set(l){this[r]=l}}})}apply(e){e.forEach(s=>s(this))}}var me=new Of({_scriptable:t=>!t.startsWith("on"),_indexable:t=>t!=="events",hover:{_fallback:"interaction"},interaction:{_scriptable:!1,_indexable:!1}},[Rf,Mf,Lf]);function If(t){return!t||de(t.size)||de(t.family)?null:(t.style?t.style+" ":"")+(t.weight?t.weight+" ":"")+t.size+"px "+t.family}function fo(t,e,s,n,i){let o=e[i];return o||(o=e[i]=t.measureText(i).width,s.push(i)),o>n&&(n=o),n}function _t(t,e,s){const n=t.currentDevicePixelRatio,i=s!==0?Math.max(s/2,.5):0;return Math.round((e-i)*n)/n+i}function po(t,e){!e&&!t||(e=e||t.getContext("2d"),e.save(),e.resetTransform(),e.clearRect(0,0,t.width,t.height),e.restore())}function Gn(t,e,s,n){tr(t,e,s,n,null)}function tr(t,e,s,n,i){let o,a,r,l,c,u,d,h;const f=e.pointStyle,p=e.rotation,g=e.radius;let m=(p||0)*uf;if(f&&typeof f=="object"&&(o=f.toString(),o==="[object HTMLImageElement]"||o==="[object HTMLCanvasElement]")){t.save(),t.translate(s,n),t.rotate(m),t.drawImage(f,-f.width/2,-f.height/2,f.width,f.height),t.restore();return}if(!(isNaN(g)||g<=0)){switch(t.beginPath(),f){default:i?t.ellipse(s,n,i/2,g,0,0,pe):t.arc(s,n,g,0,pe),t.closePath();break;case"triangle":u=i?i/2:g,t.moveTo(s+Math.sin(m)*u,n-Math.cos(m)*g),m+=io,t.lineTo(s+Math.sin(m)*u,n-Math.cos(m)*g),m+=io,t.lineTo(s+Math.sin(m)*u,n-Math.cos(m)*g),t.closePath();break;case"rectRounded":c=g*.516,l=g-c,a=Math.cos(m+mt)*l,d=Math.cos(m+mt)*(i?i/2-c:l),r=Math.sin(m+mt)*l,h=Math.sin(m+mt)*(i?i/2-c:l),t.arc(s-d,n-r,c,m-ge,m-be),t.arc(s+h,n-a,c,m-be,m),t.arc(s+d,n+r,c,m,m+be),t.arc(s-h,n+a,c,m+be,m+ge),t.closePath();break;case"rect":if(!p){l=Math.SQRT1_2*g,u=i?i/2:l,t.rect(s-u,n-l,2*u,2*l);break}m+=mt;case"rectRot":d=Math.cos(m)*(i?i/2:g),a=Math.cos(m)*g,r=Math.sin(m)*g,h=Math.sin(m)*(i?i/2:g),t.moveTo(s-d,n-r),t.lineTo(s+h,n-a),t.lineTo(s+d,n+r),t.lineTo(s-h,n+a),t.closePath();break;case"crossRot":m+=mt;case"cross":d=Math.cos(m)*(i?i/2:g),a=Math.cos(m)*g,r=Math.sin(m)*g,h=Math.sin(m)*(i?i/2:g),t.moveTo(s-d,n-r),t.lineTo(s+d,n+r),t.moveTo(s+h,n-a),t.lineTo(s-h,n+a);break;case"star":d=Math.cos(m)*(i?i/2:g),a=Math.cos(m)*g,r=Math.sin(m)*g,h=Math.sin(m)*(i?i/2:g),t.moveTo(s-d,n-r),t.lineTo(s+d,n+r),t.moveTo(s+h,n-a),t.lineTo(s-h,n+a),m+=mt,d=Math.cos(m)*(i?i/2:g),a=Math.cos(m)*g,r=Math.sin(m)*g,h=Math.sin(m)*(i?i/2:g),t.moveTo(s-d,n-r),t.lineTo(s+d,n+r),t.moveTo(s+h,n-a),t.lineTo(s-h,n+a);break;case"line":a=i?i/2:Math.cos(m)*g,r=Math.sin(m)*g,t.moveTo(s-a,n-r),t.lineTo(s+a,n+r);break;case"dash":t.moveTo(s,n),t.lineTo(s+Math.cos(m)*(i?i/2:g),n+Math.sin(m)*g);break;case!1:t.closePath();break}t.fill(),e.borderWidth>0&&t.stroke()}}function ys(t,e,s){return s=s||.5,!e||t&&t.x>e.left-s&&t.x<e.right+s&&t.y>e.top-s&&t.y<e.bottom+s}function yi(t,e){t.save(),t.beginPath(),t.rect(e.left,e.top,e.right-e.left,e.bottom-e.top),t.clip()}function xi(t){t.restore()}function Ff(t,e,s,n,i){if(!e)return t.lineTo(s.x,s.y);if(i==="middle"){const o=(e.x+s.x)/2;t.lineTo(o,e.y),t.lineTo(o,s.y)}else i==="after"!=!!n?t.lineTo(e.x,s.y):t.lineTo(s.x,e.y);t.lineTo(s.x,s.y)}function Vf(t,e,s,n){if(!e)return t.lineTo(s.x,s.y);t.bezierCurveTo(n?e.cp1x:e.cp2x,n?e.cp1y:e.cp2y,n?s.cp2x:s.cp1x,n?s.cp2y:s.cp1y,s.x,s.y)}function $f(t,e){e.translation&&t.translate(e.translation[0],e.translation[1]),de(e.rotation)||t.rotate(e.rotation),e.color&&(t.fillStyle=e.color),e.textAlign&&(t.textAlign=e.textAlign),e.textBaseline&&(t.textBaseline=e.textBaseline)}function zf(t,e,s,n,i){if(i.strikethrough||i.underline){const o=t.measureText(n),a=e-o.actualBoundingBoxLeft,r=e+o.actualBoundingBoxRight,l=s-o.actualBoundingBoxAscent,c=s+o.actualBoundingBoxDescent,u=i.strikethrough?(l+c)/2:c;t.strokeStyle=t.fillStyle,t.beginPath(),t.lineWidth=i.decorationWidth||2,t.moveTo(a,u),t.lineTo(r,u),t.stroke()}}function Bf(t,e){const s=t.fillStyle;t.fillStyle=e.color,t.fillRect(e.left,e.top,e.width,e.height),t.fillStyle=s}function xs(t,e,s,n,i,o={}){const a=xe(e)?e:[e],r=o.strokeWidth>0&&o.strokeColor!=="";let l,c;for(t.save(),t.font=i.string,$f(t,o),l=0;l<a.length;++l)c=a[l],o.backdrop&&Bf(t,o.backdrop),r&&(o.strokeColor&&(t.strokeStyle=o.strokeColor),de(o.strokeWidth)||(t.lineWidth=o.strokeWidth),t.strokeText(c,s,n,o.maxWidth)),t.fillText(c,s,n,o.maxWidth),zf(t,s,n,c,o),n+=Number(i.lineHeight);t.restore()}function qn(t,e){const{x:s,y:n,w:i,h:o,radius:a}=e;t.arc(s+a.topLeft,n+a.topLeft,a.topLeft,1.5*ge,ge,!0),t.lineTo(s,n+o-a.bottomLeft),t.arc(s+a.bottomLeft,n+o-a.bottomLeft,a.bottomLeft,ge,be,!0),t.lineTo(s+i-a.bottomRight,n+o),t.arc(s+i-a.bottomRight,n+o-a.bottomRight,a.bottomRight,be,0,!0),t.lineTo(s+i,n+a.topRight),t.arc(s+i-a.topRight,n+a.topRight,a.topRight,0,-be,!0),t.lineTo(s+a.topLeft,n)}const Nf=/^(normal|(\d+(?:\.\d+)?)(px|em|%)?)$/,Uf=/^(normal|italic|initial|inherit|unset|(oblique( -?[0-9]?[0-9]deg)?))$/;function Hf(t,e){const s=(""+t).match(Nf);if(!s||s[1]==="normal")return e*1.2;switch(t=+s[2],s[3]){case"px":return t;case"%":t/=100;break}return e*t}const jf=t=>+t||0;function wi(t,e){const s={},n=oe(e),i=n?Object.keys(e):e,o=oe(t)?n?a=>ee(t[a],t[e[a]]):a=>t[a]:()=>t;for(const a of i)s[a]=jf(o(a));return s}function Wf(t){return wi(t,{top:"y",right:"x",bottom:"y",left:"x"})}function ds(t){return wi(t,["topLeft","topRight","bottomLeft","bottomRight"])}function Ue(t){const e=Wf(t);return e.width=e.left+e.right,e.height=e.top+e.bottom,e}function De(t,e){t=t||{},e=e||me.font;let s=ee(t.size,e.size);typeof s=="string"&&(s=parseInt(s,10));let n=ee(t.style,e.style);n&&!(""+n).match(Uf)&&(console.warn('Invalid font style specified: "'+n+'"'),n=void 0);const i={family:ee(t.family,e.family),lineHeight:Hf(ee(t.lineHeight,e.lineHeight),s),size:s,style:n,weight:ee(t.weight,e.weight),string:""};return i.string=If(i),i}function Ts(t,e,s,n){let i,o,a;for(i=0,o=t.length;i<o;++i)if(a=t[i],a!==void 0&&a!==void 0)return a}function Gf(t,e,s){const{min:n,max:i}=t,o=qa(e,(i-n)/2),a=(r,l)=>s&&r===0?0:r+l;return{min:a(n,-Math.abs(o)),max:a(i,o)}}function Ct(t,e){return Object.assign(Object.create(t),e)}function Si(t,e=[""],s,n,i=()=>t[0]){const o=s||t;typeof n>"u"&&(n=or("_fallback",t));const a={[Symbol.toStringTag]:"Object",_cacheable:!0,_scopes:t,_rootScopes:o,_fallback:n,_getTarget:i,override:r=>Si([r,...t],e,o,n)};return new Proxy(a,{deleteProperty(r,l){return delete r[l],delete r._keys,delete t[0][l],!0},get(r,l){return nr(r,l,()=>ep(l,e,t,r))},getOwnPropertyDescriptor(r,l){return Reflect.getOwnPropertyDescriptor(r._scopes[0],l)},getPrototypeOf(){return Reflect.getPrototypeOf(t[0])},has(r,l){return mo(r).includes(l)},ownKeys(r){return mo(r)},set(r,l,c){const u=r._storage||(r._storage=i());return r[l]=u[l]=c,delete r._keys,!0}})}function Nt(t,e,s,n){const i={_cacheable:!1,_proxy:t,_context:e,_subProxy:s,_stack:new Set,_descriptors:sr(t,n),setContext:o=>Nt(t,o,s,n),override:o=>Nt(t.override(o),e,s,n)};return new Proxy(i,{deleteProperty(o,a){return delete o[a],delete t[a],!0},get(o,a,r){return nr(o,a,()=>Yf(o,a,r))},getOwnPropertyDescriptor(o,a){return o._descriptors.allKeys?Reflect.has(t,a)?{enumerable:!0,configurable:!0}:void 0:Reflect.getOwnPropertyDescriptor(t,a)},getPrototypeOf(){return Reflect.getPrototypeOf(t)},has(o,a){return Reflect.has(t,a)},ownKeys(){return Reflect.ownKeys(t)},set(o,a,r){return t[a]=r,delete o[a],!0}})}function sr(t,e={scriptable:!0,indexable:!0}){const{_scriptable:s=e.scriptable,_indexable:n=e.indexable,_allKeys:i=e.allKeys}=t;return{allKeys:i,scriptable:s,indexable:n,isScriptable:gt(s)?s:()=>s,isIndexable:gt(n)?n:()=>n}}const qf=(t,e)=>t?t+gi(e):e,ki=(t,e)=>oe(e)&&t!=="adapters"&&(Object.getPrototypeOf(e)===null||e.constructor===Object);function nr(t,e,s){if(Object.prototype.hasOwnProperty.call(t,e)||e==="constructor")return t[e];const n=s();return t[e]=n,n}function Yf(t,e,s){const{_proxy:n,_context:i,_subProxy:o,_descriptors:a}=t;let r=n[e];return gt(r)&&a.isScriptable(e)&&(r=Xf(e,r,t,s)),xe(r)&&r.length&&(r=Kf(e,r,t,a.isIndexable)),ki(e,r)&&(r=Nt(r,i,o&&o[e],a)),r}function Xf(t,e,s,n){const{_proxy:i,_context:o,_subProxy:a,_stack:r}=s;if(r.has(t))throw new Error("Recursion detected: "+Array.from(r).join("->")+"->"+t);r.add(t);let l=e(o,a||n);return r.delete(t),ki(t,l)&&(l=Ci(i._scopes,i,t,l)),l}function Kf(t,e,s,n){const{_proxy:i,_context:o,_subProxy:a,_descriptors:r}=s;if(typeof o.index<"u"&&n(t))return e[o.index%e.length];if(oe(e[0])){const l=e,c=i._scopes.filter(u=>u!==l);e=[];for(const u of l){const d=Ci(c,i,t,u);e.push(Nt(d,o,a&&a[t],r))}}return e}function ir(t,e,s){return gt(t)?t(e,s):t}const Qf=(t,e)=>t===!0?e:typeof t=="string"?_s(e,t):void 0;function Zf(t,e,s,n,i){for(const o of e){const a=Qf(s,o);if(a){t.add(a);const r=ir(a._fallback,s,i);if(typeof r<"u"&&r!==s&&r!==n)return r}else if(a===!1&&typeof n<"u"&&s!==n)return null}return!1}function Ci(t,e,s,n){const i=e._rootScopes,o=ir(e._fallback,s,n),a=[...t,...i],r=new Set;r.add(n);let l=go(r,a,s,o||s,n);return l===null||typeof o<"u"&&o!==s&&(l=go(r,a,o,l,n),l===null)?!1:Si(Array.from(r),[""],i,o,()=>Jf(e,s,n))}function go(t,e,s,n,i){for(;s;)s=Zf(t,e,s,n,i);return s}function Jf(t,e,s){const n=t._getTarget();e in n||(n[e]={});const i=n[e];return xe(i)&&oe(s)?s:i||{}}function ep(t,e,s,n){let i;for(const o of e)if(i=or(qf(o,t),s),typeof i<"u")return ki(t,i)?Ci(s,n,t,i):i}function or(t,e){for(const s of e){if(!s)continue;const n=s[t];if(typeof n<"u")return n}}function mo(t){let e=t._keys;return e||(e=t._keys=tp(t._scopes)),e}function tp(t){const e=new Set;for(const s of t)for(const n of Object.keys(s).filter(i=>!i.startsWith("_")))e.add(n);return Array.from(e)}const sp=Number.EPSILON||1e-14,Ut=(t,e)=>e<t.length&&!t[e].skip&&t[e],ar=t=>t==="x"?"y":"x";function np(t,e,s,n){const i=t.skip?e:t,o=e,a=s.skip?e:s,r=jn(o,i),l=jn(a,o);let c=r/(r+l),u=l/(r+l);c=isNaN(c)?0:c,u=isNaN(u)?0:u;const d=n*c,h=n*u;return{previous:{x:o.x-d*(a.x-i.x),y:o.y-d*(a.y-i.y)},next:{x:o.x+h*(a.x-i.x),y:o.y+h*(a.y-i.y)}}}function ip(t,e,s){const n=t.length;let i,o,a,r,l,c=Ut(t,0);for(let u=0;u<n-1;++u)if(l=c,c=Ut(t,u+1),!(!l||!c)){if(ls(e[u],0,sp)){s[u]=s[u+1]=0;continue}i=s[u]/e[u],o=s[u+1]/e[u],r=Math.pow(i,2)+Math.pow(o,2),!(r<=9)&&(a=3/Math.sqrt(r),s[u]=i*a*e[u],s[u+1]=o*a*e[u])}}function op(t,e,s="x"){const n=ar(s),i=t.length;let o,a,r,l=Ut(t,0);for(let c=0;c<i;++c){if(a=r,r=l,l=Ut(t,c+1),!r)continue;const u=r[s],d=r[n];a&&(o=(u-a[s])/3,r[`cp1${s}`]=u-o,r[`cp1${n}`]=d-o*e[c]),l&&(o=(l[s]-u)/3,r[`cp2${s}`]=u+o,r[`cp2${n}`]=d+o*e[c])}}function ap(t,e="x"){const s=ar(e),n=t.length,i=Array(n).fill(0),o=Array(n);let a,r,l,c=Ut(t,0);for(a=0;a<n;++a)if(r=l,l=c,c=Ut(t,a+1),!!l){if(c){const u=c[e]-l[e];i[a]=u!==0?(c[s]-l[s])/u:0}o[a]=r?c?Bt(i[a-1])!==Bt(i[a])?0:(i[a-1]+i[a])/2:i[a-1]:i[a]}ip(t,i,o),op(t,o,e)}function Es(t,e,s){return Math.max(Math.min(t,s),e)}function rp(t,e){let s,n,i,o,a,r=ys(t[0],e);for(s=0,n=t.length;s<n;++s)a=o,o=r,r=s<n-1&&ys(t[s+1],e),o&&(i=t[s],a&&(i.cp1x=Es(i.cp1x,e.left,e.right),i.cp1y=Es(i.cp1y,e.top,e.bottom)),r&&(i.cp2x=Es(i.cp2x,e.left,e.right),i.cp2y=Es(i.cp2y,e.top,e.bottom)))}function lp(t,e,s,n,i){let o,a,r,l;if(e.spanGaps&&(t=t.filter(c=>!c.skip)),e.cubicInterpolationMode==="monotone")ap(t,i);else{let c=n?t[t.length-1]:t[0];for(o=0,a=t.length;o<a;++o)r=t[o],l=np(c,r,t[Math.min(o+1,a-(n?0:1))%a],e.tension),r.cp1x=l.previous.x,r.cp1y=l.previous.y,r.cp2x=l.next.x,r.cp2y=l.next.y,c=r}e.capBezierPoints&&rp(t,s)}function Pi(){return typeof window<"u"&&typeof document<"u"}function Di(t){let e=t.parentNode;return e&&e.toString()==="[object ShadowRoot]"&&(e=e.host),e}function Js(t,e,s){let n;return typeof t=="string"?(n=parseInt(t,10),t.indexOf("%")!==-1&&(n=n/100*e.parentNode[s])):n=t,n}const cn=t=>t.ownerDocument.defaultView.getComputedStyle(t,null);function cp(t,e){return cn(t).getPropertyValue(e)}const up=["top","right","bottom","left"];function wt(t,e,s){const n={};s=s?"-"+s:"";for(let i=0;i<4;i++){const o=up[i];n[o]=parseFloat(t[e+"-"+o+s])||0}return n.width=n.left+n.right,n.height=n.top+n.bottom,n}const dp=(t,e,s)=>(t>0||e>0)&&(!s||!s.shadowRoot);function hp(t,e){const s=t.touches,n=s&&s.length?s[0]:t,{offsetX:i,offsetY:o}=n;let a=!1,r,l;if(dp(i,o,t.target))r=i,l=o;else{const c=e.getBoundingClientRect();r=n.clientX-c.left,l=n.clientY-c.top,a=!0}return{x:r,y:l,box:a}}function bt(t,e){if("native"in t)return t;const{canvas:s,currentDevicePixelRatio:n}=e,i=cn(s),o=i.boxSizing==="border-box",a=wt(i,"padding"),r=wt(i,"border","width"),{x:l,y:c,box:u}=hp(t,s),d=a.left+(u&&r.left),h=a.top+(u&&r.top);let{width:f,height:p}=e;return o&&(f-=a.width+r.width,p-=a.height+r.height),{x:Math.round((l-d)/f*s.width/n),y:Math.round((c-h)/p*s.height/n)}}function fp(t,e,s){let n,i;if(e===void 0||s===void 0){const o=t&&Di(t);if(!o)e=t.clientWidth,s=t.clientHeight;else{const a=o.getBoundingClientRect(),r=cn(o),l=wt(r,"border","width"),c=wt(r,"padding");e=a.width-c.width-l.width,s=a.height-c.height-l.height,n=Js(r.maxWidth,o,"clientWidth"),i=Js(r.maxHeight,o,"clientHeight")}}return{width:e,height:s,maxWidth:n||Zs,maxHeight:i||Zs}}const Ls=t=>Math.round(t*10)/10;function pp(t,e,s,n){const i=cn(t),o=wt(i,"margin"),a=Js(i.maxWidth,t,"clientWidth")||Zs,r=Js(i.maxHeight,t,"clientHeight")||Zs,l=fp(t,e,s);let{width:c,height:u}=l;if(i.boxSizing==="content-box"){const h=wt(i,"border","width"),f=wt(i,"padding");c-=f.width+h.width,u-=f.height+h.height}return c=Math.max(0,c-o.width),u=Math.max(0,n?c/n:u-o.height),c=Ls(Math.min(c,a,l.maxWidth)),u=Ls(Math.min(u,r,l.maxHeight)),c&&!u&&(u=Ls(c/2)),(e!==void 0||s!==void 0)&&n&&l.height&&u>l.height&&(u=l.height,c=Ls(Math.floor(u*n))),{width:c,height:u}}function _o(t,e,s){const n=e||1,i=Math.floor(t.height*n),o=Math.floor(t.width*n);t.height=Math.floor(t.height),t.width=Math.floor(t.width);const a=t.canvas;return a.style&&(s||!a.style.height&&!a.style.width)&&(a.style.height=`${t.height}px`,a.style.width=`${t.width}px`),t.currentDevicePixelRatio!==n||a.height!==i||a.width!==o?(t.currentDevicePixelRatio=n,a.height=i,a.width=o,t.ctx.setTransform(n,0,0,n,0,0),!0):!1}const gp=function(){let t=!1;try{const e={get passive(){return t=!0,!1}};Pi()&&(window.addEventListener("test",null,e),window.removeEventListener("test",null,e))}catch{}return t}();function vo(t,e){const s=cp(t,e),n=s&&s.match(/^(\d+)(\.\d+)?px$/);return n?+n[1]:void 0}function yt(t,e,s,n){return{x:t.x+s*(e.x-t.x),y:t.y+s*(e.y-t.y)}}function mp(t,e,s,n){return{x:t.x+s*(e.x-t.x),y:n==="middle"?s<.5?t.y:e.y:n==="after"?s<1?t.y:e.y:s>0?e.y:t.y}}function _p(t,e,s,n){const i={x:t.cp2x,y:t.cp2y},o={x:e.cp1x,y:e.cp1y},a=yt(t,i,s),r=yt(i,o,s),l=yt(o,e,s),c=yt(a,r,s),u=yt(r,l,s);return yt(c,u,s)}const vp=function(t,e){return{x(s){return t+t+e-s},setWidth(s){e=s},textAlign(s){return s==="center"?s:s==="right"?"left":"right"},xPlus(s,n){return s-n},leftForLtr(s,n){return s-n}}},bp=function(){return{x(t){return t},setWidth(t){},textAlign(t){return t},xPlus(t,e){return t+e},leftForLtr(t,e){return t}}};function Ot(t,e,s){return t?vp(e,s):bp()}function rr(t,e){let s,n;(e==="ltr"||e==="rtl")&&(s=t.canvas.style,n=[s.getPropertyValue("direction"),s.getPropertyPriority("direction")],s.setProperty("direction",e,"important"),t.prevTextDirection=n)}function lr(t,e){e!==void 0&&(delete t.prevTextDirection,t.canvas.style.setProperty("direction",e[0],e[1]))}function cr(t){return t==="angle"?{between:bs,compare:mf,normalize:ct}:{between:Lt,compare:(e,s)=>e-s,normalize:e=>e}}function bo({start:t,end:e,count:s,loop:n,style:i}){return{start:t%s,end:e%s,loop:n&&(e-t+1)%s===0,style:i}}function yp(t,e,s){const{property:n,start:i,end:o}=s,{between:a,normalize:r}=cr(n),l=e.length;let{start:c,end:u,loop:d}=t,h,f;if(d){for(c+=l,u+=l,h=0,f=l;h<f&&a(r(e[c%l][n]),i,o);++h)c--,u--;c%=l,u%=l}return u<c&&(u+=l),{start:c,end:u,loop:d,style:t.style}}function xp(t,e,s){if(!s)return[t];const{property:n,start:i,end:o}=s,a=e.length,{compare:r,between:l,normalize:c}=cr(n),{start:u,end:d,loop:h,style:f}=yp(t,e,s),p=[];let g=!1,m=null,y,b,k;const P=()=>l(i,k,y)&&r(i,k)!==0,C=()=>r(o,y)===0||l(o,k,y),O=()=>g||P(),R=()=>!g||C();for(let E=u,z=u;E<=d;++E)b=e[E%a],!b.skip&&(y=c(b[n]),y!==k&&(g=l(y,i,o),m===null&&O()&&(m=r(y,i)===0?E:z),m!==null&&R()&&(p.push(bo({start:m,end:E,loop:h,count:a,style:f})),m=null),z=E,k=y));return m!==null&&p.push(bo({start:m,end:d,loop:h,count:a,style:f})),p}function wp(t,e){const s=[],n=t.segments;for(let i=0;i<n.length;i++){const o=xp(n[i],t.points,e);o.length&&s.push(...o)}return s}function Sp(t,e,s,n){let i=0,o=e-1;if(s&&!n)for(;i<e&&!t[i].skip;)i++;for(;i<e&&t[i].skip;)i++;for(i%=e,s&&(o+=i);o>i&&t[o%e].skip;)o--;return o%=e,{start:i,end:o}}function kp(t,e,s,n){const i=t.length,o=[];let a=e,r=t[e],l;for(l=e+1;l<=s;++l){const c=t[l%i];c.skip||c.stop?r.skip||(n=!1,o.push({start:e%i,end:(l-1)%i,loop:n}),e=a=c.stop?l:null):(a=l,r.skip&&(e=l)),r=c}return a!==null&&o.push({start:e%i,end:a%i,loop:n}),o}function Cp(t,e){const s=t.points,n=t.options.spanGaps,i=s.length;if(!i)return[];const o=!!t._loop,{start:a,end:r}=Sp(s,i,o,n);if(n===!0)return yo(t,[{start:a,end:r,loop:o}],s,e);const l=r<a?r+i:r,c=!!t._fullLoop&&a===0&&r===i-1;return yo(t,kp(s,a,l,c),s,e)}function yo(t,e,s,n){return!n||!n.setContext||!s?e:Pp(t,e,s,n)}function Pp(t,e,s,n){const i=t._chart.getContext(),o=xo(t.options),{_datasetIndex:a,options:{spanGaps:r}}=t,l=s.length,c=[];let u=o,d=e[0].start,h=d;function f(p,g,m,y){const b=r?-1:1;if(p!==g){for(p+=l;s[p%l].skip;)p-=b;for(;s[g%l].skip;)g+=b;p%l!==g%l&&(c.push({start:p%l,end:g%l,loop:m,style:y}),u=y,d=g%l)}}for(const p of e){d=r?d:p.start;let g=s[d%l],m;for(h=d+1;h<=p.end;h++){const y=s[h%l];m=xo(n.setContext(Ct(i,{type:"segment",p0:g,p1:y,p0DataIndex:(h-1)%l,p1DataIndex:h%l,datasetIndex:a}))),Dp(m,u)&&f(d,h-1,p.loop,u),g=y,u=m}d<h-1&&f(d,h-1,p.loop,u)}return c}function xo(t){return{backgroundColor:t.backgroundColor,borderCapStyle:t.borderCapStyle,borderDash:t.borderDash,borderDashOffset:t.borderDashOffset,borderJoinStyle:t.borderJoinStyle,borderWidth:t.borderWidth,borderColor:t.borderColor}}function Dp(t,e){if(!e)return!1;const s=[],n=function(i,o){return vi(o)?(s.includes(o)||s.push(o),s.indexOf(o)):o};return JSON.stringify(t,n)!==JSON.stringify(e,n)}function Os(t,e,s){return t.options.clip?t[s]:e[s]}function Rp(t,e){const{xScale:s,yScale:n}=t;return s&&n?{left:Os(s,e,"left"),right:Os(s,e,"right"),top:Os(n,e,"top"),bottom:Os(n,e,"bottom")}:e}function Mp(t,e){const s=e._clip;if(s.disabled)return!1;const n=Rp(e,t.chartArea);return{left:s.left===!1?0:n.left-(s.left===!0?0:s.left),right:s.right===!1?t.width:n.right+(s.right===!0?0:s.right),top:s.top===!1?0:n.top-(s.top===!0?0:s.top),bottom:s.bottom===!1?t.height:n.bottom+(s.bottom===!0?0:s.bottom)}}/*! 21 21 * Chart.js v4.4.9 22 22 * https://www.chartjs.org 23 23 * (c) 2025 Chart.js Contributors 24 24 * Released under the MIT License 25 */class Ap{constructor(){this._request=null,this._charts=new Map,this._running=!1,this._lastDate=void 0}_notify(e,s,n,i){const o=s.listeners[i],a=s.duration;o.forEach(r=>r({chart:e,initial:s.initial,numSteps:a,currentStep:Math.min(n-s.start,a)}))}_refresh(){this._request||(this._running=!0,this._request=Za.call(window,()=>{this._update(),this._request=null,this._running&&this._refresh()}))}_update(e=Date.now()){let s=0;this._charts.forEach((n,i)=>{if(!n.running||!n.items.length)return;const o=n.items;let a=o.length-1,r=!1,l;for(;a>=0;--a)l=o[a],l._active?(l._total>n.duration&&(n.duration=l._total),l.tick(e),r=!0):(o[a]=o[o.length-1],o.pop());r&&(i.draw(),this._notify(i,n,e,"progress")),o.length||(n.running=!1,this._notify(i,n,e,"complete"),n.initial=!1),s+=o.length}),this._lastDate=e,s===0&&(this._running=!1)}_getAnims(e){const s=this._charts;let n=s.get(e);return n||(n={running:!1,initial:!0,items:[],listeners:{complete:[],progress:[]}},s.set(e,n)),n}listen(e,s,n){this._getAnims(e).listeners[s].push(n)}add(e,s){!s||!s.length||this._getAnims(e).items.push(...s)}has(e){return this._getAnims(e).items.length>0}start(e){const s=this._charts.get(e);s&&(s.running=!0,s.start=Date.now(),s.duration=s.items.reduce((n,i)=>Math.max(n,i._duration),0),this._refresh())}running(e){if(!this._running)return!1;const s=this._charts.get(e);return!(!s||!s.running||!s.items.length)}stop(e){const s=this._charts.get(e);if(!s||!s.items.length)return;const n=s.items;let i=n.length-1;for(;i>=0;--i)n[i].cancel();s.items=[],this._notify(e,s,Date.now(),"complete")}remove(e){return this._charts.delete(e)}}var tt=new Ap;const wo="transparent",Tp={boolean(t,e,s){return s>.5?e:t},color(t,e,s){const n=uo(t||wo),i=n.valid&&uo(e||wo);return i&&i.valid?i.mix(n,s).hexString():e},number(t,e,s){return t+(e-t)*s}};class Ep{constructor(e,s,n,i){const o=s[n];i=Ts([e.to,i,o,e.from]);const a=Ts([e.from,o,i]);this._active=!0,this._fn=e.fn||Tp[e.type||typeof a],this._easing=cs[e.easing]||cs.linear,this._start=Math.floor(Date.now()+(e.delay||0)),this._duration=this._total=Math.floor(e.duration),this._loop=!!e.loop,this._target=s,this._prop=n,this._from=a,this._to=i,this._promises=void 0}active(){return this._active}update(e,s,n){if(this._active){this._notify(!1);const i=this._target[this._prop],o=n-this._start,a=this._duration-o;this._start=n,this._duration=Math.floor(Math.max(a,e.duration)),this._total+=o,this._loop=!!e.loop,this._to=Ts([e.to,s,i,e.from]),this._from=Ts([e.from,i,s])}}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(e){const s=e-this._start,n=this._duration,i=this._prop,o=this._from,a=this._loop,r=this._to;let l;if(this._active=o!==r&&(a||s<n),!this._active){this._target[i]=r,this._notify(!0);return}if(s<0){this._target[i]=o;return}l=s/n%2,l=a&&l>1?2-l:l,l=this._easing(Math.min(1,Math.max(0,l))),this._target[i]=this._fn(o,r,l)}wait(){const e=this._promises||(this._promises=[]);return new Promise((s,n)=>{e.push({res:s,rej:n})})}_notify(e){const s=e?"res":"rej",n=this._promises||[];for(let i=0;i<n.length;i++)n[i][s]()}}class ur{constructor(e,s){this._chart=e,this._properties=new Map,this.configure(s)}configure(e){if(!oe(e))return;const s=Object.keys(me.animation),n=this._properties;Object.getOwnPropertyNames(e).forEach(i=>{const o=e[i];if(!oe(o))return;const a={};for(const r of s)a[r]=o[r];(xe(o.properties)&&o.properties||[i]).forEach(r=>{(r===i||!n.has(r))&&n.set(r,a)})})}_animateOptions(e,s){const n=s.options,i=Op(e,n);if(!i)return[];const o=this._createAnimations(i,n);return n.$shared&&Lp(e.options.$animations,n).then(()=>{e.options=n},()=>{}),o}_createAnimations(e,s){const n=this._properties,i=[],o=e.$animations||(e.$animations={}),a=Object.keys(s),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"){i.push(...this._animateOptions(e,s));continue}const u=s[c];let d=o[c];const h=n.get(c);if(d)if(h&&d.active()){d.update(h,u,r);continue}else d.cancel();if(!h||!h.duration){e[c]=u;continue}o[c]=d=new Ep(h,e,c,u),i.push(d)}return i}update(e,s){if(this._properties.size===0){Object.assign(e,s);return}const n=this._createAnimations(e,s);if(n.length)return tt.add(this._chart,n),!0}}function Lp(t,e){const s=[],n=Object.keys(e);for(let i=0;i<n.length;i++){const o=t[n[i]];o&&o.active()&&s.push(o.wait())}return Promise.all(s)}function Op(t,e){if(!e)return;let s=t.options;if(!s){t.options=e;return}return s.$shared&&(t.options=s=Object.assign({},s,{$shared:!1,$animations:{}})),s}function So(t,e){const s=t&&t.options||{},n=s.reverse,i=s.min===void 0?e:0,o=s.max===void 0?e:0;return{start:n?o:i,end:n?i:o}}function Ip(t,e,s){if(s===!1)return!1;const n=So(t,s),i=So(e,s);return{top:i.end,right:n.end,bottom:i.start,left:n.start}}function Fp(t){let e,s,n,i;return oe(t)?(e=t.top,s=t.right,n=t.bottom,i=t.left):e=s=n=i=t,{top:e,right:s,bottom:n,left:i,disabled:t===!1}}function dr(t,e){const s=[],n=t._getSortedDatasetMetas(e);let i,o;for(i=0,o=n.length;i<o;++i)s.push(n[i].index);return s}function ko(t,e,s,n={}){const i=t.keys,o=n.mode==="single";let a,r,l,c;if(e===null)return;let u=!1;for(a=0,r=i.length;a<r;++a){if(l=+i[a],l===s){if(u=!0,n.all)continue;break}c=t.values[l],Ne(c)&&(o||e===0||Bt(e)===Bt(c))&&(e+=c)}return!u&&!n.all?0:e}function Vp(t,e){const{iScale:s,vScale:n}=e,i=s.axis==="x"?"x":"y",o=n.axis==="x"?"x":"y",a=Object.keys(t),r=new Array(a.length);let l,c,u;for(l=0,c=a.length;l<c;++l)u=a[l],r[l]={[i]:u,[o]:t[u]};return r}function Pn(t,e){const s=t&&t.options.stacked;return s||s===void 0&&e.stack!==void 0}function $p(t,e,s){return`${t.id}.${e.id}.${s.stack||s.type}`}function zp(t){const{min:e,max:s,minDefined:n,maxDefined:i}=t.getUserBounds();return{min:n?e:Number.NEGATIVE_INFINITY,max:i?s:Number.POSITIVE_INFINITY}}function Bp(t,e,s){const n=t[e]||(t[e]={});return n[s]||(n[s]={})}function Co(t,e,s,n){for(const i of e.getMatchingVisibleMetas(n).reverse()){const o=t[i.index];if(s&&o>0||!s&&o<0)return i.index}return null}function Po(t,e){const{chart:s,_cachedMeta:n}=t,i=s._stacks||(s._stacks={}),{iScale:o,vScale:a,index:r}=n,l=o.axis,c=a.axis,u=$p(o,a,n),d=e.length;let h;for(let f=0;f<d;++f){const p=e[f],{[l]:g,[c]:m}=p,y=p._stacks||(p._stacks={});h=y[c]=Bp(i,u,g),h[r]=m,h._top=Co(h,a,!0,n.type),h._bottom=Co(h,a,!1,n.type);const v=h._visualValues||(h._visualValues={});v[r]=m}}function Dn(t,e){const s=t.scales;return Object.keys(s).filter(n=>s[n].axis===e).shift()}function Np(t,e){return Ct(t,{active:!1,dataset:void 0,datasetIndex:e,index:e,mode:"default",type:"dataset"})}function Up(t,e,s){return Ct(t,{active:!1,dataIndex:e,parsed:void 0,raw:void 0,element:s,index:e,mode:"default",type:"data"})}function qt(t,e){const s=t.controller.index,n=t.vScale&&t.vScale.axis;if(n){e=e||t._parsed;for(const i of e){const o=i._stacks;if(!o||o[n]===void 0||o[n][s]===void 0)return;delete o[n][s],o[n]._visualValues!==void 0&&o[n]._visualValues[s]!==void 0&&delete o[n]._visualValues[s]}}}const Rn=t=>t==="reset"||t==="none",Do=(t,e)=>e?t:Object.assign({},t),Hp=(t,e,s)=>t&&!e.hidden&&e._stacked&&{keys:dr(s,!0),values:null};class It{constructor(e,s){this.chart=e,this._ctx=e.ctx,this.index=s,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 e=this._cachedMeta;this.configure(),this.linkScales(),e._stacked=Pn(e.vScale,e),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(e){this.index!==e&&qt(this._cachedMeta),this.index=e}linkScales(){const e=this.chart,s=this._cachedMeta,n=this.getDataset(),i=(d,h,f,p)=>d==="x"?h:d==="r"?p:f,o=s.xAxisID=ee(n.xAxisID,Dn(e,"x")),a=s.yAxisID=ee(n.yAxisID,Dn(e,"y")),r=s.rAxisID=ee(n.rAxisID,Dn(e,"r")),l=s.indexAxis,c=s.iAxisID=i(l,o,a,r),u=s.vAxisID=i(l,a,o,r);s.xScale=this.getScaleForId(o),s.yScale=this.getScaleForId(a),s.rScale=this.getScaleForId(r),s.iScale=this.getScaleForId(c),s.vScale=this.getScaleForId(u)}getDataset(){return this.chart.data.datasets[this.index]}getMeta(){return this.chart.getDatasetMeta(this.index)}getScaleForId(e){return this.chart.scales[e]}_getOtherScale(e){const s=this._cachedMeta;return e===s.iScale?s.vScale:s.iScale}reset(){this._update("reset")}_destroy(){const e=this._cachedMeta;this._data&&ro(this._data,this),e._stacked&&qt(e)}_dataCheck(){const e=this.getDataset(),s=e.data||(e.data=[]),n=this._data;if(oe(s)){const i=this._cachedMeta;this._data=Vp(s,i)}else if(n!==s){if(n){ro(n,this);const i=this._cachedMeta;qt(i),i._parsed=[]}s&&Object.isExtensible(s)&&yf(s,this),this._syncList=[],this._data=s}}addElements(){const e=this._cachedMeta;this._dataCheck(),this.datasetElementType&&(e.dataset=new this.datasetElementType)}buildOrUpdateElements(e){const s=this._cachedMeta,n=this.getDataset();let i=!1;this._dataCheck();const o=s._stacked;s._stacked=Pn(s.vScale,s),s.stack!==n.stack&&(i=!0,qt(s),s.stack=n.stack),this._resyncElements(e),(i||o!==s._stacked)&&(Po(this,s._parsed),s._stacked=Pn(s.vScale,s))}configure(){const e=this.chart.config,s=e.datasetScopeKeys(this._type),n=e.getOptionScopes(this.getDataset(),s,!0);this.options=e.createResolver(n,this.getContext()),this._parsing=this.options.parsing,this._cachedDataOpts={}}parse(e,s){const{_cachedMeta:n,_data:i}=this,{iScale:o,_stacked:a}=n,r=o.axis;let l=e===0&&s===i.length?!0:n._sorted,c=e>0&&n._parsed[e-1],u,d,h;if(this._parsing===!1)n._parsed=i,n._sorted=!0,h=i;else{xe(i[e])?h=this.parseArrayData(n,i,e,s):oe(i[e])?h=this.parseObjectData(n,i,e,s):h=this.parsePrimitiveData(n,i,e,s);const f=()=>d[r]===null||c&&d[r]<c[r];for(u=0;u<s;++u)n._parsed[u+e]=d=h[u],l&&(f()&&(l=!1),c=d);n._sorted=l}a&&Po(this,h)}parsePrimitiveData(e,s,n,i){const{iScale:o,vScale:a}=e,r=o.axis,l=a.axis,c=o.getLabels(),u=o===a,d=new Array(i);let h,f,p;for(h=0,f=i;h<f;++h)p=h+n,d[h]={[r]:u||o.parse(c[p],p),[l]:a.parse(s[p],p)};return d}parseArrayData(e,s,n,i){const{xScale:o,yScale:a}=e,r=new Array(i);let l,c,u,d;for(l=0,c=i;l<c;++l)u=l+n,d=s[u],r[l]={x:o.parse(d[0],u),y:a.parse(d[1],u)};return r}parseObjectData(e,s,n,i){const{xScale:o,yScale:a}=e,{xAxisKey:r="x",yAxisKey:l="y"}=this._parsing,c=new Array(i);let u,d,h,f;for(u=0,d=i;u<d;++u)h=u+n,f=s[h],c[u]={x:o.parse(_s(f,r),h),y:a.parse(_s(f,l),h)};return c}getParsed(e){return this._cachedMeta._parsed[e]}getDataElement(e){return this._cachedMeta.data[e]}applyStack(e,s,n){const i=this.chart,o=this._cachedMeta,a=s[e.axis],r={keys:dr(i,!0),values:s._stacks[e.axis]._visualValues};return ko(r,a,o.index,{mode:n})}updateRangeFromParsed(e,s,n,i){const o=n[s.axis];let a=o===null?NaN:o;const r=i&&n._stacks[s.axis];i&&r&&(i.values=r,a=ko(i,o,this._cachedMeta.index)),e.min=Math.min(e.min,a),e.max=Math.max(e.max,a)}getMinMax(e,s){const n=this._cachedMeta,i=n._parsed,o=n._sorted&&e===n.iScale,a=i.length,r=this._getOtherScale(e),l=Hp(s,n,this.chart),c={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY},{min:u,max:d}=zp(r);let h,f;function p(){f=i[h];const g=f[r.axis];return!Ne(f[e.axis])||u>g||d<g}for(h=0;h<a&&!(!p()&&(this.updateRangeFromParsed(c,e,f,l),o));++h);if(o){for(h=a-1;h>=0;--h)if(!p()){this.updateRangeFromParsed(c,e,f,l);break}}return c}getAllParsedValues(e){const s=this._cachedMeta._parsed,n=[];let i,o,a;for(i=0,o=s.length;i<o;++i)a=s[i][e.axis],Ne(a)&&n.push(a);return n}getMaxOverflow(){return!1}getLabelAndValue(e){const s=this._cachedMeta,n=s.iScale,i=s.vScale,o=this.getParsed(e);return{label:n?""+n.getLabelForValue(o[n.axis]):"",value:i?""+i.getLabelForValue(o[i.axis]):""}}_update(e){const s=this._cachedMeta;this.update(e||"default"),s._clip=Fp(ee(this.options.clip,Ip(s.xScale,s.yScale,this.getMaxOverflow())))}update(e){}draw(){const e=this._ctx,s=this.chart,n=this._cachedMeta,i=n.data||[],o=s.chartArea,a=[],r=this._drawStart||0,l=this._drawCount||i.length-r,c=this.options.drawActiveElementsOnTop;let u;for(n.dataset&&n.dataset.draw(e,o,r,l),u=r;u<r+l;++u){const d=i[u];d.hidden||(d.active&&c?a.push(d):d.draw(e,o))}for(u=0;u<a.length;++u)a[u].draw(e,o)}getStyle(e,s){const n=s?"active":"default";return e===void 0&&this._cachedMeta.dataset?this.resolveDatasetElementOptions(n):this.resolveDataElementOptions(e||0,n)}getContext(e,s,n){const i=this.getDataset();let o;if(e>=0&&e<this._cachedMeta.data.length){const a=this._cachedMeta.data[e];o=a.$context||(a.$context=Up(this.getContext(),e,a)),o.parsed=this.getParsed(e),o.raw=i.data[e],o.index=o.dataIndex=e}else o=this.$context||(this.$context=Np(this.chart.getContext(),this.index)),o.dataset=i,o.index=o.datasetIndex=this.index;return o.active=!!s,o.mode=n,o}resolveDatasetElementOptions(e){return this._resolveElementOptions(this.datasetElementType.id,e)}resolveDataElementOptions(e,s){return this._resolveElementOptions(this.dataElementType.id,s,e)}_resolveElementOptions(e,s="default",n){const i=s==="active",o=this._cachedDataOpts,a=e+"-"+s,r=o[a],l=this.enableOptionSharing&&Qs(n);if(r)return Do(r,l);const c=this.chart.config,u=c.datasetElementScopeKeys(this._type,e),d=i?[`${e}Hover`,"hover",e,""]:[e,""],h=c.getOptionScopes(this.getDataset(),u),f=Object.keys(me.elements[e]),p=()=>this.getContext(n,i,s),g=c.resolveNamedOptions(h,f,p,d);return g.$shared&&(g.$shared=l,o[a]=Object.freeze(Do(g,l))),g}_resolveAnimations(e,s,n){const i=this.chart,o=this._cachedDataOpts,a=`animation-${s}`,r=o[a];if(r)return r;let l;if(i.options.animation!==!1){const u=this.chart.config,d=u.datasetAnimationScopeKeys(this._type,s),h=u.getOptionScopes(this.getDataset(),d);l=u.createResolver(h,this.getContext(e,n,s))}const c=new ur(i,l&&l.animations);return l&&l._cacheable&&(o[a]=Object.freeze(c)),c}getSharedOptions(e){if(e.$shared)return this._sharedOptions||(this._sharedOptions=Object.assign({},e))}includeOptions(e,s){return!s||Rn(e)||this.chart._animationsDisabled}_getSharedOptions(e,s){const n=this.resolveDataElementOptions(e,s),i=this._sharedOptions,o=this.getSharedOptions(n),a=this.includeOptions(s,o)||o!==i;return this.updateSharedOptions(o,s,n),{sharedOptions:o,includeOptions:a}}updateElement(e,s,n,i){Rn(i)?Object.assign(e,n):this._resolveAnimations(s,i).update(e,n)}updateSharedOptions(e,s,n){e&&!Rn(s)&&this._resolveAnimations(void 0,s).update(e,n)}_setStyle(e,s,n,i){e.active=i;const o=this.getStyle(s,i);this._resolveAnimations(s,n,i).update(e,{options:!i&&this.getSharedOptions(o)||o})}removeHoverStyle(e,s,n){this._setStyle(e,n,"active",!1)}setHoverStyle(e,s,n){this._setStyle(e,n,"active",!0)}_removeDatasetHoverStyle(){const e=this._cachedMeta.dataset;e&&this._setStyle(e,void 0,"active",!1)}_setDatasetHoverStyle(){const e=this._cachedMeta.dataset;e&&this._setStyle(e,void 0,"active",!0)}_resyncElements(e){const s=this._data,n=this._cachedMeta.data;for(const[r,l,c]of this._syncList)this[r](l,c);this._syncList=[];const i=n.length,o=s.length,a=Math.min(o,i);a&&this.parse(0,a),o>i?this._insertElements(i,o-i,e):o<i&&this._removeElements(o,i-o)}_insertElements(e,s,n=!0){const i=this._cachedMeta,o=i.data,a=e+s;let r;const l=c=>{for(c.length+=s,r=c.length-1;r>=a;r--)c[r]=c[r-s]};for(l(o),r=e;r<a;++r)o[r]=new this.dataElementType;this._parsing&&l(i._parsed),this.parse(e,s),n&&this.updateElements(o,e,s,"reset")}updateElements(e,s,n,i){}_removeElements(e,s){const n=this._cachedMeta;if(this._parsing){const i=n._parsed.splice(e,s);n._stacked&&qt(n,i)}n.data.splice(e,s)}_sync(e){if(this._parsing)this._syncList.push(e);else{const[s,n,i]=e;this[s](n,i)}this.chart._dataChanges.push([this.index,...e])}_onDataPush(){const e=arguments.length;this._sync(["_insertElements",this.getDataset().data.length-e,e])}_onDataPop(){this._sync(["_removeElements",this._cachedMeta.data.length-1,1])}_onDataShift(){this._sync(["_removeElements",0,1])}_onDataSplice(e,s){s&&this._sync(["_removeElements",e,s]);const n=arguments.length-2;n&&this._sync(["_insertElements",e,n])}_onDataUnshift(){this._sync(["_insertElements",0,arguments.length])}}N(It,"defaults",{}),N(It,"datasetElementType",null),N(It,"dataElementType",null);function jp(t,e,s){let n=1,i=1,o=0,a=0;if(e<pe){const r=t,l=r+e,c=Math.cos(r),u=Math.sin(r),d=Math.cos(l),h=Math.sin(l),f=(k,P,C)=>bs(k,r,l,!0)?1:Math.max(P,P*s,C,C*s),p=(k,P,C)=>bs(k,r,l,!0)?-1:Math.min(P,P*s,C,C*s),g=f(0,c,d),m=f(be,u,h),y=p(ge,c,d),v=p(ge+be,u,h);n=(g-y)/2,i=(m-v)/2,o=-(g+y)/2,a=-(m+v)/2}return{ratioX:n,ratioY:i,offsetX:o,offsetY:a}}class Jt extends It{constructor(e,s){super(e,s),this.enableOptionSharing=!0,this.innerRadius=void 0,this.outerRadius=void 0,this.offsetX=void 0,this.offsetY=void 0}linkScales(){}parse(e,s){const n=this.getDataset().data,i=this._cachedMeta;if(this._parsing===!1)i._parsed=n;else{let o=l=>+n[l];if(oe(n[e])){const{key:l="value"}=this._parsing;o=c=>+_s(n[c],l)}let a,r;for(a=e,r=e+s;a<r;++a)i._parsed[a]=o(a)}}_getRotation(){return it(this.options.rotation-90)}_getCircumference(){return it(this.options.circumference)}_getRotationExtents(){let e=pe,s=-pe;for(let n=0;n<this.chart.data.datasets.length;++n)if(this.chart.isDatasetVisible(n)&&this.chart.getDatasetMeta(n).type===this._type){const i=this.chart.getDatasetMeta(n).controller,o=i._getRotation(),a=i._getCircumference();e=Math.min(e,o),s=Math.max(s,o+a)}return{rotation:e,circumference:s-e}}update(e){const s=this.chart,{chartArea:n}=s,i=this._cachedMeta,o=i.data,a=this.getMaxBorderWidth()+this.getMaxOffset(o)+this.options.spacing,r=Math.max((Math.min(n.width,n.height)-a)/2,0),l=Math.min(sf(this.options.cutout,r),1),c=this._getRingWeight(this.index),{circumference:u,rotation:d}=this._getRotationExtents(),{ratioX:h,ratioY:f,offsetX:p,offsetY:g}=jp(d,u,l),m=(n.width-a)/h,y=(n.height-a)/f,v=Math.max(Math.min(m,y)/2,0),k=qa(this.options.radius,v),P=Math.max(k*l,0),C=(k-P)/this._getVisibleDatasetWeightTotal();this.offsetX=p*k,this.offsetY=g*k,i.total=this.calculateTotal(),this.outerRadius=k-C*this._getRingWeightOffset(this.index),this.innerRadius=Math.max(this.outerRadius-C*c,0),this.updateElements(o,0,o.length,e)}_circumference(e,s){const n=this.options,i=this._cachedMeta,o=this._getCircumference();return s&&n.animation.animateRotate||!this.chart.getDataVisibility(e)||i._parsed[e]===null||i.data[e].hidden?0:this.calculateCircumference(i._parsed[e]*o/pe)}updateElements(e,s,n,i){const o=i==="reset",a=this.chart,r=a.chartArea,c=a.options.animation,u=(r.left+r.right)/2,d=(r.top+r.bottom)/2,h=o&&c.animateScale,f=h?0:this.innerRadius,p=h?0:this.outerRadius,{sharedOptions:g,includeOptions:m}=this._getSharedOptions(s,i);let y=this._getRotation(),v;for(v=0;v<s;++v)y+=this._circumference(v,o);for(v=s;v<s+n;++v){const k=this._circumference(v,o),P=e[v],C={x:u+this.offsetX,y:d+this.offsetY,startAngle:y,endAngle:y+k,circumference:k,outerRadius:p,innerRadius:f};m&&(C.options=g||this.resolveDataElementOptions(v,P.active?"active":i)),y+=k,this.updateElement(P,v,C,i)}}calculateTotal(){const e=this._cachedMeta,s=e.data;let n=0,i;for(i=0;i<s.length;i++){const o=e._parsed[i];o!==null&&!isNaN(o)&&this.chart.getDataVisibility(i)&&!s[i].hidden&&(n+=Math.abs(o))}return n}calculateCircumference(e){const s=this._cachedMeta.total;return s>0&&!isNaN(e)?pe*(Math.abs(e)/s):0}getLabelAndValue(e){const s=this._cachedMeta,n=this.chart,i=n.data.labels||[],o=bi(s._parsed[e],n.options.locale);return{label:i[e]||"",value:o}}getMaxBorderWidth(e){let s=0;const n=this.chart;let i,o,a,r,l;if(!e){for(i=0,o=n.data.datasets.length;i<o;++i)if(n.isDatasetVisible(i)){a=n.getDatasetMeta(i),e=a.data,r=a.controller;break}}if(!e)return 0;for(i=0,o=e.length;i<o;++i)l=r.resolveDataElementOptions(i),l.borderAlign!=="inner"&&(s=Math.max(s,l.borderWidth||0,l.hoverBorderWidth||0));return s}getMaxOffset(e){let s=0;for(let n=0,i=e.length;n<i;++n){const o=this.resolveDataElementOptions(n);s=Math.max(s,o.offset||0,o.hoverOffset||0)}return s}_getRingWeightOffset(e){let s=0;for(let n=0;n<e;++n)this.chart.isDatasetVisible(n)&&(s+=this._getRingWeight(n));return s}_getRingWeight(e){return Math.max(ee(this.chart.data.datasets[e].weight,1),0)}_getVisibleDatasetWeightTotal(){return this._getRingWeightOffset(this.chart.data.datasets.length)||1}}N(Jt,"id","doughnut"),N(Jt,"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"}),N(Jt,"descriptors",{_scriptable:e=>e!=="spacing",_indexable:e=>e!=="spacing"&&!e.startsWith("borderDash")&&!e.startsWith("hoverBorderDash")}),N(Jt,"overrides",{aspectRatio:1,plugins:{legend:{labels:{generateLabels(e){const s=e.data;if(s.labels.length&&s.datasets.length){const{labels:{pointStyle:n,color:i}}=e.legend.options;return s.labels.map((o,a)=>{const l=e.getDatasetMeta(0).controller.getStyle(a);return{text:o,fillStyle:l.backgroundColor,strokeStyle:l.borderColor,fontColor:i,lineWidth:l.borderWidth,pointStyle:n,hidden:!e.getDataVisibility(a),index:a}})}return[]}},onClick(e,s,n){n.chart.toggleDataVisibility(s.index),n.chart.update()}}}});class Us extends It{initialize(){this.enableOptionSharing=!0,this.supportsDecimation=!0,super.initialize()}update(e){const s=this._cachedMeta,{dataset:n,data:i=[],_dataset:o}=s,a=this.chart._animationsDisabled;let{start:r,count:l}=kf(s,i,a);this._drawStart=r,this._drawCount=l,Cf(s)&&(r=0,l=i.length),n._chart=this.chart,n._datasetIndex=this.index,n._decimated=!!o._decimated,n.points=i;const c=this.resolveDatasetElementOptions(e);this.options.showLine||(c.borderWidth=0),c.segment=this.options.segment,this.updateElement(n,void 0,{animated:!a,options:c},e),this.updateElements(i,r,l,e)}updateElements(e,s,n,i){const o=i==="reset",{iScale:a,vScale:r,_stacked:l,_dataset:c}=this._cachedMeta,{sharedOptions:u,includeOptions:d}=this._getSharedOptions(s,i),h=a.axis,f=r.axis,{spanGaps:p,segment:g}=this.options,m=vs(p)?p:Number.POSITIVE_INFINITY,y=this.chart._animationsDisabled||o||i==="none",v=s+n,k=e.length;let P=s>0&&this.getParsed(s-1);for(let C=0;C<k;++C){const O=e[C],R=y?O:{};if(C<s||C>=v){R.skip=!0;continue}const E=this.getParsed(C),z=de(E[f]),j=R[h]=a.getPixelForValue(E[h],C),G=R[f]=o||z?r.getBasePixel():r.getPixelForValue(l?this.applyStack(r,E,l):E[f],C);R.skip=isNaN(j)||isNaN(G)||z,R.stop=C>0&&Math.abs(E[h]-P[h])>m,g&&(R.parsed=E,R.raw=c.data[C]),d&&(R.options=u||this.resolveDataElementOptions(C,O.active?"active":i)),y||this.updateElement(O,C,R,i),P=E}}getMaxOverflow(){const e=this._cachedMeta,s=e.dataset,n=s.options&&s.options.borderWidth||0,i=e.data||[];if(!i.length)return n;const o=i[0].size(this.resolveDataElementOptions(0)),a=i[i.length-1].size(this.resolveDataElementOptions(i.length-1));return Math.max(n,o,a)/2}draw(){const e=this._cachedMeta;e.dataset.updateControlPoints(this.chart.chartArea,e.iScale.axis),super.draw()}}N(Us,"id","line"),N(Us,"defaults",{datasetElementType:"line",dataElementType:"point",showLine:!0,spanGaps:!1}),N(Us,"overrides",{scales:{_index_:{type:"category"},_value_:{type:"linear"}}});class Yn extends Jt{}N(Yn,"id","pie"),N(Yn,"defaults",{cutout:0,rotation:0,circumference:360,radius:"100%"});function vt(){throw new Error("This method is not implemented: Check that a complete date adapter is provided.")}class Ri{constructor(e){N(this,"options");this.options=e||{}}static override(e){Object.assign(Ri.prototype,e)}init(){}formats(){return vt()}parse(){return vt()}format(){return vt()}add(){return vt()}diff(){return vt()}startOf(){return vt()}endOf(){return vt()}}var Wp={_date:Ri};function Gp(t,e,s,n){const{controller:i,data:o,_sorted:a}=t,r=i._cachedMeta.iScale,l=t.dataset&&t.dataset.options?t.dataset.options.spanGaps:null;if(r&&e===r.axis&&e!=="r"&&a&&o.length){const c=r._reversePixels?vf:xt;if(n){if(i._sharedOptions){const u=o[0],d=typeof u.getRange=="function"&&u.getRange(e);if(d){const h=c(o,e,s-d),f=c(o,e,s+d);return{lo:h.lo,hi:f.hi}}}}else{const u=c(o,e,s);if(l){const{vScale:d}=i._cachedMeta,{_parsed:h}=t,f=h.slice(0,u.lo+1).reverse().findIndex(g=>!de(g[d.axis]));u.lo-=Math.max(0,f);const p=h.slice(u.hi).findIndex(g=>!de(g[d.axis]));u.hi+=Math.max(0,p)}return u}}return{lo:0,hi:o.length-1}}function un(t,e,s,n,i){const o=t.getSortedVisibleDatasetMetas(),a=s[e];for(let r=0,l=o.length;r<l;++r){const{index:c,data:u}=o[r],{lo:d,hi:h}=Gp(o[r],e,a,i);for(let f=d;f<=h;++f){const p=u[f];p.skip||n(p,c,f)}}}function qp(t){const e=t.indexOf("x")!==-1,s=t.indexOf("y")!==-1;return function(n,i){const o=e?Math.abs(n.x-i.x):0,a=s?Math.abs(n.y-i.y):0;return Math.sqrt(Math.pow(o,2)+Math.pow(a,2))}}function Mn(t,e,s,n,i){const o=[];return!i&&!t.isPointInArea(e)||un(t,s,e,function(r,l,c){!i&&!ys(r,t.chartArea,0)||r.inRange(e.x,e.y,n)&&o.push({element:r,datasetIndex:l,index:c})},!0),o}function Yp(t,e,s,n){let i=[];function o(a,r,l){const{startAngle:c,endAngle:u}=a.getProps(["startAngle","endAngle"],n),{angle:d}=Ka(a,{x:e.x,y:e.y});bs(d,c,u)&&i.push({element:a,datasetIndex:r,index:l})}return un(t,s,e,o),i}function Xp(t,e,s,n,i,o){let a=[];const r=qp(s);let l=Number.POSITIVE_INFINITY;function c(u,d,h){const f=u.inRange(e.x,e.y,i);if(n&&!f)return;const p=u.getCenterPoint(i);if(!(!!o||t.isPointInArea(p))&&!f)return;const m=r(e,p);m<l?(a=[{element:u,datasetIndex:d,index:h}],l=m):m===l&&a.push({element:u,datasetIndex:d,index:h})}return un(t,s,e,c),a}function An(t,e,s,n,i,o){return!o&&!t.isPointInArea(e)?[]:s==="r"&&!n?Yp(t,e,s,i):Xp(t,e,s,n,i,o)}function Ro(t,e,s,n,i){const o=[],a=s==="x"?"inXRange":"inYRange";let r=!1;return un(t,s,e,(l,c,u)=>{l[a]&&l[a](e[s],i)&&(o.push({element:l,datasetIndex:c,index:u}),r=r||l.inRange(e.x,e.y,i))}),n&&!r?[]:o}var Kp={modes:{index(t,e,s,n){const i=bt(e,t),o=s.axis||"x",a=s.includeInvisible||!1,r=s.intersect?Mn(t,i,o,n,a):An(t,i,o,!1,n,a),l=[];return r.length?(t.getSortedVisibleDatasetMetas().forEach(c=>{const u=r[0].index,d=c.data[u];d&&!d.skip&&l.push({element:d,datasetIndex:c.index,index:u})}),l):[]},dataset(t,e,s,n){const i=bt(e,t),o=s.axis||"xy",a=s.includeInvisible||!1;let r=s.intersect?Mn(t,i,o,n,a):An(t,i,o,!1,n,a);if(r.length>0){const l=r[0].datasetIndex,c=t.getDatasetMeta(l).data;r=[];for(let u=0;u<c.length;++u)r.push({element:c[u],datasetIndex:l,index:u})}return r},point(t,e,s,n){const i=bt(e,t),o=s.axis||"xy",a=s.includeInvisible||!1;return Mn(t,i,o,n,a)},nearest(t,e,s,n){const i=bt(e,t),o=s.axis||"xy",a=s.includeInvisible||!1;return An(t,i,o,s.intersect,n,a)},x(t,e,s,n){const i=bt(e,t);return Ro(t,i,"x",s.intersect,n)},y(t,e,s,n){const i=bt(e,t);return Ro(t,i,"y",s.intersect,n)}}};const hr=["left","top","right","bottom"];function Yt(t,e){return t.filter(s=>s.pos===e)}function Mo(t,e){return t.filter(s=>hr.indexOf(s.pos)===-1&&s.box.axis===e)}function Xt(t,e){return t.sort((s,n)=>{const i=e?n:s,o=e?s:n;return i.weight===o.weight?i.index-o.index:i.weight-o.weight})}function Qp(t){const e=[];let s,n,i,o,a,r;for(s=0,n=(t||[]).length;s<n;++s)i=t[s],{position:o,options:{stack:a,stackWeight:r=1}}=i,e.push({index:s,box:i,pos:o,horizontal:i.isHorizontal(),weight:i.weight,stack:a&&o+a,stackWeight:r});return e}function Zp(t){const e={};for(const s of t){const{stack:n,pos:i,stackWeight:o}=s;if(!n||!hr.includes(i))continue;const a=e[n]||(e[n]={count:0,placed:0,weight:0,size:0});a.count++,a.weight+=o}return e}function Jp(t,e){const s=Zp(t),{vBoxMaxWidth:n,hBoxMaxHeight:i}=e;let o,a,r;for(o=0,a=t.length;o<a;++o){r=t[o];const{fullSize:l}=r.box,c=s[r.stack],u=c&&r.stackWeight/c.weight;r.horizontal?(r.width=u?u*n:l&&e.availableWidth,r.height=i):(r.width=n,r.height=u?u*i:l&&e.availableHeight)}return s}function eg(t){const e=Qp(t),s=Xt(e.filter(c=>c.box.fullSize),!0),n=Xt(Yt(e,"left"),!0),i=Xt(Yt(e,"right")),o=Xt(Yt(e,"top"),!0),a=Xt(Yt(e,"bottom")),r=Mo(e,"x"),l=Mo(e,"y");return{fullSize:s,leftAndTop:n.concat(o),rightAndBottom:i.concat(l).concat(a).concat(r),chartArea:Yt(e,"chartArea"),vertical:n.concat(i).concat(l),horizontal:o.concat(a).concat(r)}}function Ao(t,e,s,n){return Math.max(t[s],e[s])+Math.max(t[n],e[n])}function fr(t,e){t.top=Math.max(t.top,e.top),t.left=Math.max(t.left,e.left),t.bottom=Math.max(t.bottom,e.bottom),t.right=Math.max(t.right,e.right)}function tg(t,e,s,n){const{pos:i,box:o}=s,a=t.maxPadding;if(!oe(i)){s.size&&(t[i]-=s.size);const d=n[s.stack]||{size:0,count:1};d.size=Math.max(d.size,s.horizontal?o.height:o.width),s.size=d.size/d.count,t[i]+=s.size}o.getPadding&&fr(a,o.getPadding());const r=Math.max(0,e.outerWidth-Ao(a,t,"left","right")),l=Math.max(0,e.outerHeight-Ao(a,t,"top","bottom")),c=r!==t.w,u=l!==t.h;return t.w=r,t.h=l,s.horizontal?{same:c,other:u}:{same:u,other:c}}function sg(t){const e=t.maxPadding;function s(n){const i=Math.max(e[n]-t[n],0);return t[n]+=i,i}t.y+=s("top"),t.x+=s("left"),s("right"),s("bottom")}function ng(t,e){const s=e.maxPadding;function n(i){const o={left:0,top:0,right:0,bottom:0};return i.forEach(a=>{o[a]=Math.max(e[a],s[a])}),o}return n(t?["left","right"]:["top","bottom"])}function es(t,e,s,n){const i=[];let o,a,r,l,c,u;for(o=0,a=t.length,c=0;o<a;++o){r=t[o],l=r.box,l.update(r.width||e.w,r.height||e.h,ng(r.horizontal,e));const{same:d,other:h}=tg(e,s,r,n);c|=d&&i.length,u=u||h,l.fullSize||i.push(r)}return c&&es(i,e,s,n)||u}function Is(t,e,s,n,i){t.top=s,t.left=e,t.right=e+n,t.bottom=s+i,t.width=n,t.height=i}function To(t,e,s,n){const i=s.padding;let{x:o,y:a}=e;for(const r of t){const l=r.box,c=n[r.stack]||{placed:0,weight:1},u=r.stackWeight/c.weight||1;if(r.horizontal){const d=e.w*u,h=c.size||l.height;Qs(c.start)&&(a=c.start),l.fullSize?Is(l,i.left,a,s.outerWidth-i.right-i.left,h):Is(l,e.left+c.placed,a,d,h),c.start=a,c.placed+=d,a=l.bottom}else{const d=e.h*u,h=c.size||l.width;Qs(c.start)&&(o=c.start),l.fullSize?Is(l,o,i.top,h,s.outerHeight-i.bottom-i.top):Is(l,o,e.top+c.placed,h,d),c.start=o,c.placed+=d,o=l.right}}e.x=o,e.y=a}var Be={addBox(t,e){t.boxes||(t.boxes=[]),e.fullSize=e.fullSize||!1,e.position=e.position||"top",e.weight=e.weight||0,e._layers=e._layers||function(){return[{z:0,draw(s){e.draw(s)}}]},t.boxes.push(e)},removeBox(t,e){const s=t.boxes?t.boxes.indexOf(e):-1;s!==-1&&t.boxes.splice(s,1)},configure(t,e,s){e.fullSize=s.fullSize,e.position=s.position,e.weight=s.weight},update(t,e,s,n){if(!t)return;const i=Ue(t.options.layout.padding),o=Math.max(e-i.width,0),a=Math.max(s-i.height,0),r=eg(t.boxes),l=r.vertical,c=r.horizontal;re(t.boxes,g=>{typeof g.beforeLayout=="function"&&g.beforeLayout()});const u=l.reduce((g,m)=>m.box.options&&m.box.options.display===!1?g:g+1,0)||1,d=Object.freeze({outerWidth:e,outerHeight:s,padding:i,availableWidth:o,availableHeight:a,vBoxMaxWidth:o/2/u,hBoxMaxHeight:a/2}),h=Object.assign({},i);fr(h,Ue(n));const f=Object.assign({maxPadding:h,w:o,h:a,x:i.left,y:i.top},i),p=Jp(l.concat(c),d);es(r.fullSize,f,d,p),es(l,f,d,p),es(c,f,d,p)&&es(l,f,d,p),sg(f),To(r.leftAndTop,f,d,p),f.x+=f.w,f.y+=f.h,To(r.rightAndBottom,f,d,p),t.chartArea={left:f.left,top:f.top,right:f.left+f.w,bottom:f.top+f.h,height:f.h,width:f.w},re(r.chartArea,g=>{const m=g.box;Object.assign(m,t.chartArea),m.update(f.w,f.h,{left:0,top:0,right:0,bottom:0})})}};class pr{acquireContext(e,s){}releaseContext(e){return!1}addEventListener(e,s,n){}removeEventListener(e,s,n){}getDevicePixelRatio(){return 1}getMaximumSize(e,s,n,i){return s=Math.max(0,s||e.width),n=n||e.height,{width:s,height:Math.max(0,i?Math.floor(s/i):n)}}isAttached(e){return!0}updateConfig(e){}}class ig extends pr{acquireContext(e){return e&&e.getContext&&e.getContext("2d")||null}updateConfig(e){e.options.animation=!1}}const Hs="$chartjs",og={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},Eo=t=>t===null||t==="";function ag(t,e){const s=t.style,n=t.getAttribute("height"),i=t.getAttribute("width");if(t[Hs]={initial:{height:n,width:i,style:{display:s.display,height:s.height,width:s.width}}},s.display=s.display||"block",s.boxSizing=s.boxSizing||"border-box",Eo(i)){const o=vo(t,"width");o!==void 0&&(t.width=o)}if(Eo(n))if(t.style.height==="")t.height=t.width/(e||2);else{const o=vo(t,"height");o!==void 0&&(t.height=o)}return t}const gr=gp?{passive:!0}:!1;function rg(t,e,s){t&&t.addEventListener(e,s,gr)}function lg(t,e,s){t&&t.canvas&&t.canvas.removeEventListener(e,s,gr)}function cg(t,e){const s=og[t.type]||t.type,{x:n,y:i}=bt(t,e);return{type:s,chart:e,native:t,x:n!==void 0?n:null,y:i!==void 0?i:null}}function en(t,e){for(const s of t)if(s===e||s.contains(e))return!0}function ug(t,e,s){const n=t.canvas,i=new MutationObserver(o=>{let a=!1;for(const r of o)a=a||en(r.addedNodes,n),a=a&&!en(r.removedNodes,n);a&&s()});return i.observe(document,{childList:!0,subtree:!0}),i}function dg(t,e,s){const n=t.canvas,i=new MutationObserver(o=>{let a=!1;for(const r of o)a=a||en(r.removedNodes,n),a=a&&!en(r.addedNodes,n);a&&s()});return i.observe(document,{childList:!0,subtree:!0}),i}const ws=new Map;let Lo=0;function mr(){const t=window.devicePixelRatio;t!==Lo&&(Lo=t,ws.forEach((e,s)=>{s.currentDevicePixelRatio!==t&&e()}))}function hg(t,e){ws.size||window.addEventListener("resize",mr),ws.set(t,e)}function fg(t){ws.delete(t),ws.size||window.removeEventListener("resize",mr)}function pg(t,e,s){const n=t.canvas,i=n&&Di(n);if(!i)return;const o=Ja((r,l)=>{const c=i.clientWidth;s(r,l),c<i.clientWidth&&s()},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(i),hg(t,o),a}function Tn(t,e,s){s&&s.disconnect(),e==="resize"&&fg(t)}function gg(t,e,s){const n=t.canvas,i=Ja(o=>{t.ctx!==null&&s(cg(o,t))},t);return rg(n,e,i),i}class mg extends pr{acquireContext(e,s){const n=e&&e.getContext&&e.getContext("2d");return n&&n.canvas===e?(ag(e,s),n):null}releaseContext(e){const s=e.canvas;if(!s[Hs])return!1;const n=s[Hs].initial;["height","width"].forEach(o=>{const a=n[o];de(a)?s.removeAttribute(o):s.setAttribute(o,a)});const i=n.style||{};return Object.keys(i).forEach(o=>{s.style[o]=i[o]}),s.width=s.width,delete s[Hs],!0}addEventListener(e,s,n){this.removeEventListener(e,s);const i=e.$proxies||(e.$proxies={}),a={attach:ug,detach:dg,resize:pg}[s]||gg;i[s]=a(e,s,n)}removeEventListener(e,s){const n=e.$proxies||(e.$proxies={}),i=n[s];if(!i)return;({attach:Tn,detach:Tn,resize:Tn}[s]||lg)(e,s,i),n[s]=void 0}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(e,s,n,i){return pp(e,s,n,i)}isAttached(e){const s=e&&Di(e);return!!(s&&s.isConnected)}}function _g(t){return!Pi()||typeof OffscreenCanvas<"u"&&t instanceof OffscreenCanvas?ig:mg}class Qe{constructor(){N(this,"x");N(this,"y");N(this,"active",!1);N(this,"options");N(this,"$animations")}tooltipPosition(e){const{x:s,y:n}=this.getProps(["x","y"],e);return{x:s,y:n}}hasValue(){return vs(this.x)&&vs(this.y)}getProps(e,s){const n=this.$animations;if(!s||!n)return this;const i={};return e.forEach(o=>{i[o]=n[o]&&n[o].active()?n[o]._to:this[o]}),i}}N(Qe,"defaults",{}),N(Qe,"defaultRoutes");function vg(t,e){const s=t.options.ticks,n=bg(t),i=Math.min(s.maxTicksLimit||n,n),o=s.major.enabled?xg(e):[],a=o.length,r=o[0],l=o[a-1],c=[];if(a>i)return wg(e,c,o,a/i),c;const u=yg(o,e,i);if(a>0){let d,h;const f=a>1?Math.round((l-r)/(a-1)):null;for(Fs(e,c,u,de(f)?0:r-f,r),d=0,h=a-1;d<h;d++)Fs(e,c,u,o[d],o[d+1]);return Fs(e,c,u,l,de(f)?e.length:l+f),c}return Fs(e,c,u),c}function bg(t){const e=t.options.offset,s=t._tickSize(),n=t._length/s+(e?0:1),i=t._maxLength/s;return Math.floor(Math.min(n,i))}function yg(t,e,s){const n=Sg(t),i=e.length/s;if(!n)return Math.max(i,1);const o=df(n);for(let a=0,r=o.length-1;a<r;a++){const l=o[a];if(l>i)return l}return Math.max(i,1)}function xg(t){const e=[];let s,n;for(s=0,n=t.length;s<n;s++)t[s].major&&e.push(s);return e}function wg(t,e,s,n){let i=0,o=s[0],a;for(n=Math.ceil(n),a=0;a<t.length;a++)a===o&&(e.push(t[a]),i++,o=s[i*n])}function Fs(t,e,s,n,i){const o=ee(n,0),a=Math.min(ee(i,t.length),t.length);let r=0,l,c,u;for(s=Math.ceil(s),i&&(l=i-n,s=l/Math.floor(l/s)),u=o;u<0;)r++,u=Math.round(o+r*s);for(c=Math.max(o,0);c<a;c++)c===u&&(e.push(t[c]),r++,u=Math.round(o+r*s))}function Sg(t){const e=t.length;let s,n;if(e<2)return!1;for(n=t[0],s=1;s<e;++s)if(t[s]-t[s-1]!==n)return!1;return n}const kg=t=>t==="left"?"right":t==="right"?"left":t,Oo=(t,e,s)=>e==="top"||e==="left"?t[e]+s:t[e]-s,Io=(t,e)=>Math.min(e||t,t);function Fo(t,e){const s=[],n=t.length/e,i=t.length;let o=0;for(;o<i;o+=n)s.push(t[Math.floor(o)]);return s}function Cg(t,e,s){const n=t.ticks.length,i=Math.min(e,n-1),o=t._startPixel,a=t._endPixel,r=1e-6;let l=t.getPixelForTick(i),c;if(!(s&&(n===1?c=Math.max(l-o,a-l):e===0?c=(t.getPixelForTick(1)-l)/2:c=(l-t.getPixelForTick(i-1))/2,l+=i<e?c:-c,l<o-r||l>a+r)))return l}function Pg(t,e){re(t,s=>{const n=s.gc,i=n.length/2;let o;if(i>e){for(o=0;o<i;++o)delete s.data[n[o]];n.splice(0,i)}})}function Kt(t){return t.drawTicks?t.tickLength:0}function Vo(t,e){if(!t.display)return 0;const s=De(t.font,e),n=Ue(t.padding);return(xe(t.text)?t.text.length:1)*s.lineHeight+n.height}function Dg(t,e){return Ct(t,{scale:e,type:"scale"})}function Rg(t,e,s){return Ct(t,{tick:s,index:e,type:"tick"})}function Mg(t,e,s){let n=_i(t);return(s&&e!=="right"||!s&&e==="right")&&(n=kg(n)),n}function Ag(t,e,s,n){const{top:i,left:o,bottom:a,right:r,chart:l}=t,{chartArea:c,scales:u}=l;let d=0,h,f,p;const g=a-i,m=r-o;if(t.isHorizontal()){if(f=Pe(n,o,r),oe(s)){const y=Object.keys(s)[0],v=s[y];p=u[y].getPixelForValue(v)+g-e}else s==="center"?p=(c.bottom+c.top)/2+g-e:p=Oo(t,s,e);h=r-o}else{if(oe(s)){const y=Object.keys(s)[0],v=s[y];f=u[y].getPixelForValue(v)-m+e}else s==="center"?f=(c.left+c.right)/2-m+e:f=Oo(t,s,e);p=Pe(n,a,i),d=s==="left"?-be:be}return{titleX:f,titleY:p,maxWidth:h,rotation:d}}class jt extends Qe{constructor(e){super(),this.id=e.id,this.type=e.type,this.options=void 0,this.ctx=e.ctx,this.chart=e.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(e){this.options=e.setContext(this.getContext()),this.axis=e.axis,this._userMin=this.parse(e.min),this._userMax=this.parse(e.max),this._suggestedMin=this.parse(e.suggestedMin),this._suggestedMax=this.parse(e.suggestedMax)}parse(e,s){return e}getUserBounds(){let{_userMin:e,_userMax:s,_suggestedMin:n,_suggestedMax:i}=this;return e=Ye(e,Number.POSITIVE_INFINITY),s=Ye(s,Number.NEGATIVE_INFINITY),n=Ye(n,Number.POSITIVE_INFINITY),i=Ye(i,Number.NEGATIVE_INFINITY),{min:Ye(e,n),max:Ye(s,i),minDefined:Ne(e),maxDefined:Ne(s)}}getMinMax(e){let{min:s,max:n,minDefined:i,maxDefined:o}=this.getUserBounds(),a;if(i&&o)return{min:s,max:n};const r=this.getMatchingVisibleMetas();for(let l=0,c=r.length;l<c;++l)a=r[l].controller.getMinMax(this,e),i||(s=Math.min(s,a.min)),o||(n=Math.max(n,a.max));return s=o&&s>n?n:s,n=i&&s>n?s:n,{min:Ye(s,Ye(n,s)),max:Ye(n,Ye(s,n))}}getPadding(){return{left:this.paddingLeft||0,top:this.paddingTop||0,right:this.paddingRight||0,bottom:this.paddingBottom||0}}getTicks(){return this.ticks}getLabels(){const e=this.chart.data;return this.options.labels||(this.isHorizontal()?e.xLabels:e.yLabels)||e.labels||[]}getLabelItems(e=this.chart.chartArea){return this._labelItems||(this._labelItems=this._computeLabelItems(e))}beforeLayout(){this._cache={},this._dataLimitsCached=!1}beforeUpdate(){fe(this.options.beforeUpdate,[this])}update(e,s,n){const{beginAtZero:i,grace:o,ticks:a}=this.options,r=a.sampleSize;this.beforeUpdate(),this.maxWidth=e,this.maxHeight=s,this._margins=n=Object.assign({left:0,right:0,top:0,bottom:0},n),this.ticks=null,this._labelSizes=null,this._gridLineItems=null,this._labelItems=null,this.beforeSetDimensions(),this.setDimensions(),this.afterSetDimensions(),this._maxLength=this.isHorizontal()?this.width+n.left+n.right:this.height+n.top+n.bottom,this._dataLimitsCached||(this.beforeDataLimits(),this.determineDataLimits(),this.afterDataLimits(),this._range=Gf(this,o,i),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();const l=r<this.ticks.length;this._convertTicksToLabels(l?Fo(this.ticks,r):this.ticks),this.configure(),this.beforeCalculateLabelRotation(),this.calculateLabelRotation(),this.afterCalculateLabelRotation(),a.display&&(a.autoSkip||a.source==="auto")&&(this.ticks=vg(this,this.ticks),this._labelSizes=null,this.afterAutoSkip()),l&&this._convertTicksToLabels(this.ticks),this.beforeFit(),this.fit(),this.afterFit(),this.afterUpdate()}configure(){let e=this.options.reverse,s,n;this.isHorizontal()?(s=this.left,n=this.right):(s=this.top,n=this.bottom,e=!e),this._startPixel=s,this._endPixel=n,this._reversePixels=e,this._length=n-s,this._alignToPixels=this.options.alignToPixels}afterUpdate(){fe(this.options.afterUpdate,[this])}beforeSetDimensions(){fe(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(){fe(this.options.afterSetDimensions,[this])}_callHooks(e){this.chart.notifyPlugins(e,this.getContext()),fe(this.options[e],[this])}beforeDataLimits(){this._callHooks("beforeDataLimits")}determineDataLimits(){}afterDataLimits(){this._callHooks("afterDataLimits")}beforeBuildTicks(){this._callHooks("beforeBuildTicks")}buildTicks(){return[]}afterBuildTicks(){this._callHooks("afterBuildTicks")}beforeTickToLabelConversion(){fe(this.options.beforeTickToLabelConversion,[this])}generateTickLabels(e){const s=this.options.ticks;let n,i,o;for(n=0,i=e.length;n<i;n++)o=e[n],o.label=fe(s.callback,[o.value,n,e],this)}afterTickToLabelConversion(){fe(this.options.afterTickToLabelConversion,[this])}beforeCalculateLabelRotation(){fe(this.options.beforeCalculateLabelRotation,[this])}calculateLabelRotation(){const e=this.options,s=e.ticks,n=Io(this.ticks.length,e.ticks.maxTicksLimit),i=s.minRotation||0,o=s.maxRotation;let a=i,r,l,c;if(!this._isVisible()||!s.display||i>=o||n<=1||!this.isHorizontal()){this.labelRotation=i;return}const u=this._getLabelSizes(),d=u.widest.width,h=u.highest.height,f=Re(this.chart.width-d,0,this.maxWidth);r=e.offset?this.maxWidth/n:f/(n-1),d+6>r&&(r=f/(n-(e.offset?.5:1)),l=this.maxHeight-Kt(e.grid)-s.padding-Vo(e.title,this.chart.options.font),c=Math.sqrt(d*d+h*h),a=gf(Math.min(Math.asin(Re((u.highest.height+6)/r,-1,1)),Math.asin(Re(l/c,-1,1))-Math.asin(Re(h/c,-1,1)))),a=Math.max(i,Math.min(o,a))),this.labelRotation=a}afterCalculateLabelRotation(){fe(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){fe(this.options.beforeFit,[this])}fit(){const e={width:0,height:0},{chart:s,options:{ticks:n,title:i,grid:o}}=this,a=this._isVisible(),r=this.isHorizontal();if(a){const l=Vo(i,s.options.font);if(r?(e.width=this.maxWidth,e.height=Kt(o)+l):(e.height=this.maxHeight,e.width=Kt(o)+l),n.display&&this.ticks.length){const{first:c,last:u,widest:d,highest:h}=this._getLabelSizes(),f=n.padding*2,p=it(this.labelRotation),g=Math.cos(p),m=Math.sin(p);if(r){const y=n.mirror?0:m*d.width+g*h.height;e.height=Math.min(this.maxHeight,e.height+y+f)}else{const y=n.mirror?0:g*d.width+m*h.height;e.width=Math.min(this.maxWidth,e.width+y+f)}this._calculatePadding(c,u,m,g)}}this._handleMargins(),r?(this.width=this._length=s.width-this._margins.left-this._margins.right,this.height=e.height):(this.width=e.width,this.height=this._length=s.height-this._margins.top-this._margins.bottom)}_calculatePadding(e,s,n,i){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,d=this.right-this.getPixelForTick(this.ticks.length-1);let h=0,f=0;l?c?(h=i*e.width,f=n*s.height):(h=n*e.height,f=i*s.width):o==="start"?f=s.width:o==="end"?h=e.width:o!=="inner"&&(h=e.width/2,f=s.width/2),this.paddingLeft=Math.max((h-u+a)*this.width/(this.width-u),0),this.paddingRight=Math.max((f-d+a)*this.width/(this.width-d),0)}else{let u=s.height/2,d=e.height/2;o==="start"?(u=0,d=e.height):o==="end"&&(u=s.height,d=0),this.paddingTop=u+a,this.paddingBottom=d+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(){fe(this.options.afterFit,[this])}isHorizontal(){const{axis:e,position:s}=this.options;return s==="top"||s==="bottom"||e==="x"}isFullSize(){return this.options.fullSize}_convertTicksToLabels(e){this.beforeTickToLabelConversion(),this.generateTickLabels(e);let s,n;for(s=0,n=e.length;s<n;s++)de(e[s].label)&&(e.splice(s,1),n--,s--);this.afterTickToLabelConversion()}_getLabelSizes(){let e=this._labelSizes;if(!e){const s=this.options.ticks.sampleSize;let n=this.ticks;s<n.length&&(n=Fo(n,s)),this._labelSizes=e=this._computeLabelSizes(n,n.length,this.options.ticks.maxTicksLimit)}return e}_computeLabelSizes(e,s,n){const{ctx:i,_longestTextCache:o}=this,a=[],r=[],l=Math.floor(s/Io(s,n));let c=0,u=0,d,h,f,p,g,m,y,v,k,P,C;for(d=0;d<s;d+=l){if(p=e[d].label,g=this._resolveTickFontOptions(d),i.font=m=g.string,y=o[m]=o[m]||{data:{},gc:[]},v=g.lineHeight,k=P=0,!de(p)&&!xe(p))k=fo(i,y.data,y.gc,k,p),P=v;else if(xe(p))for(h=0,f=p.length;h<f;++h)C=p[h],!de(C)&&!xe(C)&&(k=fo(i,y.data,y.gc,k,C),P+=v);a.push(k),r.push(P),c=Math.max(k,c),u=Math.max(P,u)}Pg(o,s);const O=a.indexOf(c),R=r.indexOf(u),E=z=>({width:a[z]||0,height:r[z]||0});return{first:E(0),last:E(s-1),widest:E(O),highest:E(R),widths:a,heights:r}}getLabelForValue(e){return e}getPixelForValue(e,s){return NaN}getValueForPixel(e){}getPixelForTick(e){const s=this.ticks;return e<0||e>s.length-1?null:this.getPixelForValue(s[e].value)}getPixelForDecimal(e){this._reversePixels&&(e=1-e);const s=this._startPixel+e*this._length;return _f(this._alignToPixels?_t(this.chart,s,0):s)}getDecimalForPixel(e){const s=(e-this._startPixel)/this._length;return this._reversePixels?1-s:s}getBasePixel(){return this.getPixelForValue(this.getBaseValue())}getBaseValue(){const{min:e,max:s}=this;return e<0&&s<0?s:e>0&&s>0?e:0}getContext(e){const s=this.ticks||[];if(e>=0&&e<s.length){const n=s[e];return n.$context||(n.$context=Rg(this.getContext(),e,n))}return this.$context||(this.$context=Dg(this.chart.getContext(),this))}_tickSize(){const e=this.options.ticks,s=it(this.labelRotation),n=Math.abs(Math.cos(s)),i=Math.abs(Math.sin(s)),o=this._getLabelSizes(),a=e.autoSkipPadding||0,r=o?o.widest.width+a:0,l=o?o.highest.height+a:0;return this.isHorizontal()?l*n>r*i?r/n:l/i:l*i<r*n?l/n:r/i}_isVisible(){const e=this.options.display;return e!=="auto"?!!e:this.getMatchingVisibleMetas().length>0}_computeGridLineItems(e){const s=this.axis,n=this.chart,i=this.options,{grid:o,position:a,border:r}=i,l=o.offset,c=this.isHorizontal(),d=this.ticks.length+(l?1:0),h=Kt(o),f=[],p=r.setContext(this.getContext()),g=p.display?p.width:0,m=g/2,y=function(Q){return _t(n,Q,g)};let v,k,P,C,O,R,E,z,j,G,L,F;if(a==="top")v=y(this.bottom),R=this.bottom-h,z=v-m,G=y(e.top)+m,F=e.bottom;else if(a==="bottom")v=y(this.top),G=e.top,F=y(e.bottom)-m,R=v+m,z=this.top+h;else if(a==="left")v=y(this.right),O=this.right-h,E=v-m,j=y(e.left)+m,L=e.right;else if(a==="right")v=y(this.left),j=e.left,L=y(e.right)-m,O=v+m,E=this.left+h;else if(s==="x"){if(a==="center")v=y((e.top+e.bottom)/2+.5);else if(oe(a)){const Q=Object.keys(a)[0],Z=a[Q];v=y(this.chart.scales[Q].getPixelForValue(Z))}G=e.top,F=e.bottom,R=v+m,z=R+h}else if(s==="y"){if(a==="center")v=y((e.left+e.right)/2);else if(oe(a)){const Q=Object.keys(a)[0],Z=a[Q];v=y(this.chart.scales[Q].getPixelForValue(Z))}O=v-m,E=O-h,j=e.left,L=e.right}const he=ee(i.ticks.maxTicksLimit,d),Y=Math.max(1,Math.ceil(d/he));for(k=0;k<d;k+=Y){const Q=this.getContext(k),Z=o.setContext(Q),ye=r.setContext(Q),ce=Z.lineWidth,Fe=Z.color,Ze=ye.dash||[],$e=ye.dashOffset,He=Z.tickWidth,Ae=Z.tickColor,qe=Z.tickBorderDash||[],W=Z.tickBorderDashOffset;P=Cg(this,k,l),P!==void 0&&(C=_t(n,P,ce),c?O=E=j=L=C:R=z=G=F=C,f.push({tx1:O,ty1:R,tx2:E,ty2:z,x1:j,y1:G,x2:L,y2:F,width:ce,color:Fe,borderDash:Ze,borderDashOffset:$e,tickWidth:He,tickColor:Ae,tickBorderDash:qe,tickBorderDashOffset:W}))}return this._ticksLength=d,this._borderValue=v,f}_computeLabelItems(e){const s=this.axis,n=this.options,{position:i,ticks:o}=n,a=this.isHorizontal(),r=this.ticks,{align:l,crossAlign:c,padding:u,mirror:d}=o,h=Kt(n.grid),f=h+u,p=d?-u:f,g=-it(this.labelRotation),m=[];let y,v,k,P,C,O,R,E,z,j,G,L,F="middle";if(i==="top")O=this.bottom-p,R=this._getXAxisLabelAlignment();else if(i==="bottom")O=this.top+p,R=this._getXAxisLabelAlignment();else if(i==="left"){const Y=this._getYAxisLabelAlignment(h);R=Y.textAlign,C=Y.x}else if(i==="right"){const Y=this._getYAxisLabelAlignment(h);R=Y.textAlign,C=Y.x}else if(s==="x"){if(i==="center")O=(e.top+e.bottom)/2+f;else if(oe(i)){const Y=Object.keys(i)[0],Q=i[Y];O=this.chart.scales[Y].getPixelForValue(Q)+f}R=this._getXAxisLabelAlignment()}else if(s==="y"){if(i==="center")C=(e.left+e.right)/2-f;else if(oe(i)){const Y=Object.keys(i)[0],Q=i[Y];C=this.chart.scales[Y].getPixelForValue(Q)}R=this._getYAxisLabelAlignment(h).textAlign}s==="y"&&(l==="start"?F="top":l==="end"&&(F="bottom"));const he=this._getLabelSizes();for(y=0,v=r.length;y<v;++y){k=r[y],P=k.label;const Y=o.setContext(this.getContext(y));E=this.getPixelForTick(y)+o.labelOffset,z=this._resolveTickFontOptions(y),j=z.lineHeight,G=xe(P)?P.length:1;const Q=G/2,Z=Y.color,ye=Y.textStrokeColor,ce=Y.textStrokeWidth;let Fe=R;a?(C=E,R==="inner"&&(y===v-1?Fe=this.options.reverse?"left":"right":y===0?Fe=this.options.reverse?"right":"left":Fe="center"),i==="top"?c==="near"||g!==0?L=-G*j+j/2:c==="center"?L=-he.highest.height/2-Q*j+j:L=-he.highest.height+j/2:c==="near"||g!==0?L=j/2:c==="center"?L=he.highest.height/2-Q*j:L=he.highest.height-G*j,d&&(L*=-1),g!==0&&!Y.showLabelBackdrop&&(C+=j/2*Math.sin(g))):(O=E,L=(1-G)*j/2);let Ze;if(Y.showLabelBackdrop){const $e=Ue(Y.backdropPadding),He=he.heights[y],Ae=he.widths[y];let qe=L-$e.top,W=0-$e.left;switch(F){case"middle":qe-=He/2;break;case"bottom":qe-=He;break}switch(R){case"center":W-=Ae/2;break;case"right":W-=Ae;break;case"inner":y===v-1?W-=Ae:y>0&&(W-=Ae/2);break}Ze={left:W,top:qe,width:Ae+$e.width,height:He+$e.height,color:Y.backdropColor}}m.push({label:P,font:z,textOffset:L,options:{rotation:g,color:Z,strokeColor:ye,strokeWidth:ce,textAlign:Fe,textBaseline:F,translation:[C,O],backdrop:Ze}})}return m}_getXAxisLabelAlignment(){const{position:e,ticks:s}=this.options;if(-it(this.labelRotation))return e==="top"?"left":"right";let i="center";return s.align==="start"?i="left":s.align==="end"?i="right":s.align==="inner"&&(i="inner"),i}_getYAxisLabelAlignment(e){const{position:s,ticks:{crossAlign:n,mirror:i,padding:o}}=this.options,a=this._getLabelSizes(),r=e+o,l=a.widest.width;let c,u;return s==="left"?i?(u=this.right+o,n==="near"?c="left":n==="center"?(c="center",u+=l/2):(c="right",u+=l)):(u=this.right-r,n==="near"?c="right":n==="center"?(c="center",u-=l/2):(c="left",u=this.left)):s==="right"?i?(u=this.left+o,n==="near"?c="right":n==="center"?(c="center",u-=l/2):(c="left",u-=l)):(u=this.left+r,n==="near"?c="left":n==="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 e=this.chart,s=this.options.position;if(s==="left"||s==="right")return{top:0,left:this.left,bottom:e.height,right:this.right};if(s==="top"||s==="bottom")return{top:this.top,left:0,bottom:this.bottom,right:e.width}}drawBackground(){const{ctx:e,options:{backgroundColor:s},left:n,top:i,width:o,height:a}=this;s&&(e.save(),e.fillStyle=s,e.fillRect(n,i,o,a),e.restore())}getLineWidthForValue(e){const s=this.options.grid;if(!this._isVisible()||!s.display)return 0;const i=this.ticks.findIndex(o=>o.value===e);return i>=0?s.setContext(this.getContext(i)).lineWidth:0}drawGrid(e){const s=this.options.grid,n=this.ctx,i=this._gridLineItems||(this._gridLineItems=this._computeGridLineItems(e));let o,a;const r=(l,c,u)=>{!u.width||!u.color||(n.save(),n.lineWidth=u.width,n.strokeStyle=u.color,n.setLineDash(u.borderDash||[]),n.lineDashOffset=u.borderDashOffset,n.beginPath(),n.moveTo(l.x,l.y),n.lineTo(c.x,c.y),n.stroke(),n.restore())};if(s.display)for(o=0,a=i.length;o<a;++o){const l=i[o];s.drawOnChartArea&&r({x:l.x1,y:l.y1},{x:l.x2,y:l.y2},l),s.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:e,ctx:s,options:{border:n,grid:i}}=this,o=n.setContext(this.getContext()),a=n.display?o.width:0;if(!a)return;const r=i.setContext(this.getContext(0)).lineWidth,l=this._borderValue;let c,u,d,h;this.isHorizontal()?(c=_t(e,this.left,a)-a/2,u=_t(e,this.right,r)+r/2,d=h=l):(d=_t(e,this.top,a)-a/2,h=_t(e,this.bottom,r)+r/2,c=u=l),s.save(),s.lineWidth=o.width,s.strokeStyle=o.color,s.beginPath(),s.moveTo(c,d),s.lineTo(u,h),s.stroke(),s.restore()}drawLabels(e){if(!this.options.ticks.display)return;const n=this.ctx,i=this._computeLabelArea();i&&yi(n,i);const o=this.getLabelItems(e);for(const a of o){const r=a.options,l=a.font,c=a.label,u=a.textOffset;xs(n,c,0,u,l,r)}i&&xi(n)}drawTitle(){const{ctx:e,options:{position:s,title:n,reverse:i}}=this;if(!n.display)return;const o=De(n.font),a=Ue(n.padding),r=n.align;let l=o.lineHeight/2;s==="bottom"||s==="center"||oe(s)?(l+=a.bottom,xe(n.text)&&(l+=o.lineHeight*(n.text.length-1))):l+=a.top;const{titleX:c,titleY:u,maxWidth:d,rotation:h}=Ag(this,l,s,r);xs(e,n.text,0,0,o,{color:n.color,maxWidth:d,rotation:h,textAlign:Mg(r,s,i),textBaseline:"middle",translation:[c,u]})}draw(e){this._isVisible()&&(this.drawBackground(),this.drawGrid(e),this.drawBorder(),this.drawTitle(),this.drawLabels(e))}_layers(){const e=this.options,s=e.ticks&&e.ticks.z||0,n=ee(e.grid&&e.grid.z,-1),i=ee(e.border&&e.border.z,0);return!this._isVisible()||this.draw!==jt.prototype.draw?[{z:s,draw:o=>{this.draw(o)}}]:[{z:n,draw:o=>{this.drawBackground(),this.drawGrid(o),this.drawTitle()}},{z:i,draw:()=>{this.drawBorder()}},{z:s,draw:o=>{this.drawLabels(o)}}]}getMatchingVisibleMetas(e){const s=this.chart.getSortedVisibleDatasetMetas(),n=this.axis+"AxisID",i=[];let o,a;for(o=0,a=s.length;o<a;++o){const r=s[o];r[n]===this.id&&(!e||r.type===e)&&i.push(r)}return i}_resolveTickFontOptions(e){const s=this.options.ticks.setContext(this.getContext(e));return De(s.font)}_maxDigits(){const e=this._resolveTickFontOptions(0).lineHeight;return(this.isHorizontal()?this.width:this.height)/e}}class Vs{constructor(e,s,n){this.type=e,this.scope=s,this.override=n,this.items=Object.create(null)}isForType(e){return Object.prototype.isPrototypeOf.call(this.type.prototype,e.prototype)}register(e){const s=Object.getPrototypeOf(e);let n;Lg(s)&&(n=this.register(s));const i=this.items,o=e.id,a=this.scope+"."+o;if(!o)throw new Error("class does not have id: "+e);return o in i||(i[o]=e,Tg(e,a,n),this.override&&me.override(e.id,e.overrides)),a}get(e){return this.items[e]}unregister(e){const s=this.items,n=e.id,i=this.scope;n in s&&delete s[n],i&&n in me[i]&&(delete me[i][n],this.override&&delete St[n])}}function Tg(t,e,s){const n=ms(Object.create(null),[s?me.get(s):{},me.get(e),t.defaults]);me.set(e,n),t.defaultRoutes&&Eg(e,t.defaultRoutes),t.descriptors&&me.describe(e,t.descriptors)}function Eg(t,e){Object.keys(e).forEach(s=>{const n=s.split("."),i=n.pop(),o=[t].concat(n).join("."),a=e[s].split("."),r=a.pop(),l=a.join(".");me.route(o,i,l,r)})}function Lg(t){return"id"in t&&"defaults"in t}class Og{constructor(){this.controllers=new Vs(It,"datasets",!0),this.elements=new Vs(Qe,"elements"),this.plugins=new Vs(Object,"plugins"),this.scales=new Vs(jt,"scales"),this._typedRegistries=[this.controllers,this.scales,this.elements]}add(...e){this._each("register",e)}remove(...e){this._each("unregister",e)}addControllers(...e){this._each("register",e,this.controllers)}addElements(...e){this._each("register",e,this.elements)}addPlugins(...e){this._each("register",e,this.plugins)}addScales(...e){this._each("register",e,this.scales)}getController(e){return this._get(e,this.controllers,"controller")}getElement(e){return this._get(e,this.elements,"element")}getPlugin(e){return this._get(e,this.plugins,"plugin")}getScale(e){return this._get(e,this.scales,"scale")}removeControllers(...e){this._each("unregister",e,this.controllers)}removeElements(...e){this._each("unregister",e,this.elements)}removePlugins(...e){this._each("unregister",e,this.plugins)}removeScales(...e){this._each("unregister",e,this.scales)}_each(e,s,n){[...s].forEach(i=>{const o=n||this._getRegistryForType(i);n||o.isForType(i)||o===this.plugins&&i.id?this._exec(e,o,i):re(i,a=>{const r=n||this._getRegistryForType(a);this._exec(e,r,a)})})}_exec(e,s,n){const i=gi(e);fe(n["before"+i],[],n),s[e](n),fe(n["after"+i],[],n)}_getRegistryForType(e){for(let s=0;s<this._typedRegistries.length;s++){const n=this._typedRegistries[s];if(n.isForType(e))return n}return this.plugins}_get(e,s,n){const i=s.get(e);if(i===void 0)throw new Error('"'+e+'" is not a registered '+n+".");return i}}var Ke=new Og;class Ig{constructor(){this._init=[]}notify(e,s,n,i){s==="beforeInit"&&(this._init=this._createDescriptors(e,!0),this._notify(this._init,e,"install"));const o=i?this._descriptors(e).filter(i):this._descriptors(e),a=this._notify(o,e,s,n);return s==="afterDestroy"&&(this._notify(o,e,"stop"),this._notify(this._init,e,"uninstall")),a}_notify(e,s,n,i){i=i||{};for(const o of e){const a=o.plugin,r=a[n],l=[s,i,o.options];if(fe(r,l,a)===!1&&i.cancelable)return!1}return!0}invalidate(){de(this._cache)||(this._oldCache=this._cache,this._cache=void 0)}_descriptors(e){if(this._cache)return this._cache;const s=this._cache=this._createDescriptors(e);return this._notifyStateChanges(e),s}_createDescriptors(e,s){const n=e&&e.config,i=ee(n.options&&n.options.plugins,{}),o=Fg(n);return i===!1&&!s?[]:$g(e,o,i,s)}_notifyStateChanges(e){const s=this._oldCache||[],n=this._cache,i=(o,a)=>o.filter(r=>!a.some(l=>r.plugin.id===l.plugin.id));this._notify(i(s,n),e,"stop"),this._notify(i(n,s),e,"start")}}function Fg(t){const e={},s=[],n=Object.keys(Ke.plugins.items);for(let o=0;o<n.length;o++)s.push(Ke.getPlugin(n[o]));const i=t.plugins||[];for(let o=0;o<i.length;o++){const a=i[o];s.indexOf(a)===-1&&(s.push(a),e[a.id]=!0)}return{plugins:s,localIds:e}}function Vg(t,e){return!e&&t===!1?null:t===!0?{}:t}function $g(t,{plugins:e,localIds:s},n,i){const o=[],a=t.getContext();for(const r of e){const l=r.id,c=Vg(n[l],i);c!==null&&o.push({plugin:r,options:zg(t.config,{plugin:r,local:s[l]},c,a)})}return o}function zg(t,{plugin:e,local:s},n,i){const o=t.pluginScopeKeys(e),a=t.getOptionScopes(n,o);return s&&e.defaults&&a.push(e.defaults),t.createResolver(a,i,[""],{scriptable:!1,indexable:!1,allKeys:!0})}function Xn(t,e){const s=me.datasets[t]||{};return((e.datasets||{})[t]||{}).indexAxis||e.indexAxis||s.indexAxis||"x"}function Bg(t,e){let s=t;return t==="_index_"?s=e:t==="_value_"&&(s=e==="x"?"y":"x"),s}function Ng(t,e){return t===e?"_index_":"_value_"}function $o(t){if(t==="x"||t==="y"||t==="r")return t}function Ug(t){if(t==="top"||t==="bottom")return"x";if(t==="left"||t==="right")return"y"}function Kn(t,...e){if($o(t))return t;for(const s of e){const n=s.axis||Ug(s.position)||t.length>1&&$o(t[0].toLowerCase());if(n)return n}throw new Error(`Cannot determine type of '${t}' axis. Please provide 'axis' or 'position' option.`)}function zo(t,e,s){if(s[e+"AxisID"]===t)return{axis:e}}function Hg(t,e){if(e.data&&e.data.datasets){const s=e.data.datasets.filter(n=>n.xAxisID===t||n.yAxisID===t);if(s.length)return zo(t,"x",s[0])||zo(t,"y",s[0])}return{}}function jg(t,e){const s=St[t.type]||{scales:{}},n=e.scales||{},i=Xn(t.type,e),o=Object.create(null);return Object.keys(n).forEach(a=>{const r=n[a];if(!oe(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=Kn(a,r,Hg(a,t),me.scales[r.type]),c=Ng(l,i),u=s.scales||{};o[a]=rs(Object.create(null),[{axis:l},r,u[l],u[c]])}),t.data.datasets.forEach(a=>{const r=a.type||t.type,l=a.indexAxis||Xn(r,e),u=(St[r]||{}).scales||{};Object.keys(u).forEach(d=>{const h=Bg(d,l),f=a[h+"AxisID"]||h;o[f]=o[f]||Object.create(null),rs(o[f],[{axis:h},n[f],u[d]])})}),Object.keys(o).forEach(a=>{const r=o[a];rs(r,[me.scales[r.type],me.scale])}),o}function _r(t){const e=t.options||(t.options={});e.plugins=ee(e.plugins,{}),e.scales=jg(t,e)}function vr(t){return t=t||{},t.datasets=t.datasets||[],t.labels=t.labels||[],t}function Wg(t){return t=t||{},t.data=vr(t.data),_r(t),t}const Bo=new Map,br=new Set;function $s(t,e){let s=Bo.get(t);return s||(s=e(),Bo.set(t,s),br.add(s)),s}const Qt=(t,e,s)=>{const n=_s(e,s);n!==void 0&&t.add(n)};class Gg{constructor(e){this._config=Wg(e),this._scopeCache=new Map,this._resolverCache=new Map}get platform(){return this._config.platform}get type(){return this._config.type}set type(e){this._config.type=e}get data(){return this._config.data}set data(e){this._config.data=vr(e)}get options(){return this._config.options}set options(e){this._config.options=e}get plugins(){return this._config.plugins}update(){const e=this._config;this.clearCache(),_r(e)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(e){return $s(e,()=>[[`datasets.${e}`,""]])}datasetAnimationScopeKeys(e,s){return $s(`${e}.transition.${s}`,()=>[[`datasets.${e}.transitions.${s}`,`transitions.${s}`],[`datasets.${e}`,""]])}datasetElementScopeKeys(e,s){return $s(`${e}-${s}`,()=>[[`datasets.${e}.elements.${s}`,`datasets.${e}`,`elements.${s}`,""]])}pluginScopeKeys(e){const s=e.id,n=this.type;return $s(`${n}-plugin-${s}`,()=>[[`plugins.${s}`,...e.additionalOptionScopes||[]]])}_cachedScopes(e,s){const n=this._scopeCache;let i=n.get(e);return(!i||s)&&(i=new Map,n.set(e,i)),i}getOptionScopes(e,s,n){const{options:i,type:o}=this,a=this._cachedScopes(e,n),r=a.get(s);if(r)return r;const l=new Set;s.forEach(u=>{e&&(l.add(e),u.forEach(d=>Qt(l,e,d))),u.forEach(d=>Qt(l,i,d)),u.forEach(d=>Qt(l,St[o]||{},d)),u.forEach(d=>Qt(l,me,d)),u.forEach(d=>Qt(l,Wn,d))});const c=Array.from(l);return c.length===0&&c.push(Object.create(null)),br.has(s)&&a.set(s,c),c}chartOptionScopes(){const{options:e,type:s}=this;return[e,St[s]||{},me.datasets[s]||{},{type:s},me,Wn]}resolveNamedOptions(e,s,n,i=[""]){const o={$shared:!0},{resolver:a,subPrefixes:r}=No(this._resolverCache,e,i);let l=a;if(Yg(a,s)){o.$shared=!1,n=gt(n)?n():n;const c=this.createResolver(e,n,r);l=Nt(a,n,c)}for(const c of s)o[c]=l[c];return o}createResolver(e,s,n=[""],i){const{resolver:o}=No(this._resolverCache,e,n);return oe(s)?Nt(o,s,void 0,i):o}}function No(t,e,s){let n=t.get(e);n||(n=new Map,t.set(e,n));const i=s.join();let o=n.get(i);return o||(o={resolver:Si(e,s),subPrefixes:s.filter(r=>!r.toLowerCase().includes("hover"))},n.set(i,o)),o}const qg=t=>oe(t)&&Object.getOwnPropertyNames(t).some(e=>gt(t[e]));function Yg(t,e){const{isScriptable:s,isIndexable:n}=sr(t);for(const i of e){const o=s(i),a=n(i),r=(a||o)&&t[i];if(o&&(gt(r)||qg(r))||a&&xe(r))return!0}return!1}var Xg="4.4.9";const Kg=["top","bottom","left","right","chartArea"];function Uo(t,e){return t==="top"||t==="bottom"||Kg.indexOf(t)===-1&&e==="x"}function Ho(t,e){return function(s,n){return s[t]===n[t]?s[e]-n[e]:s[t]-n[t]}}function jo(t){const e=t.chart,s=e.options.animation;e.notifyPlugins("afterRender"),fe(s&&s.onComplete,[t],e)}function Qg(t){const e=t.chart,s=e.options.animation;fe(s&&s.onProgress,[t],e)}function yr(t){return Pi()&&typeof t=="string"?t=document.getElementById(t):t&&t.length&&(t=t[0]),t&&t.canvas&&(t=t.canvas),t}const js={},Wo=t=>{const e=yr(t);return Object.values(js).filter(s=>s.canvas===e).pop()};function Zg(t,e,s){const n=Object.keys(t);for(const i of n){const o=+i;if(o>=e){const a=t[i];delete t[i],(s>0||o>e)&&(t[o+s]=a)}}}function Jg(t,e,s,n){return!s||t.type==="mouseout"?null:n?e:t}var lt;let dn=(lt=class{static register(...e){Ke.add(...e),Go()}static unregister(...e){Ke.remove(...e),Go()}constructor(e,s){const n=this.config=new Gg(s),i=yr(e),o=Wo(i);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=n.createResolver(n.chartOptionScopes(),this.getContext());this.platform=new(n.platform||_g(i)),this.platform.updateConfig(n);const r=this.platform.acquireContext(i,a.aspectRatio),l=r&&r.canvas,c=l&&l.height,u=l&&l.width;if(this.id=tf(),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 Ig,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=wf(d=>this.update(d),a.resizeDelay||0),this._dataChanges=[],js[this.id]=this,!r||!l){console.error("Failed to create chart: can't acquire context from the given item");return}tt.listen(this,"complete",jo),tt.listen(this,"progress",Qg),this._initialize(),this.attached&&this.update()}get aspectRatio(){const{options:{aspectRatio:e,maintainAspectRatio:s},width:n,height:i,_aspectRatio:o}=this;return de(e)?s&&o?o:i?n/i:null:e}get data(){return this.config.data}set data(e){this.config.data=e}get options(){return this._options}set options(e){this.config.options=e}get registry(){return Ke}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():_o(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return po(this.canvas,this.ctx),this}stop(){return tt.stop(this),this}resize(e,s){tt.running(this)?this._resizeBeforeDraw={width:e,height:s}:this._resize(e,s)}_resize(e,s){const n=this.options,i=this.canvas,o=n.maintainAspectRatio&&this.aspectRatio,a=this.platform.getMaximumSize(i,e,s,o),r=n.devicePixelRatio||this.platform.getDevicePixelRatio(),l=this.width?"resize":"attach";this.width=a.width,this.height=a.height,this._aspectRatio=this.aspectRatio,_o(this,r,!0)&&(this.notifyPlugins("resize",{size:a}),fe(n.onResize,[this,a],this),this.attached&&this._doResize(l)&&this.render())}ensureScalesHaveIDs(){const s=this.options.scales||{};re(s,(n,i)=>{n.id=i})}buildOrUpdateScales(){const e=this.options,s=e.scales,n=this.scales,i=Object.keys(n).reduce((a,r)=>(a[r]=!1,a),{});let o=[];s&&(o=o.concat(Object.keys(s).map(a=>{const r=s[a],l=Kn(a,r),c=l==="r",u=l==="x";return{options:r,dposition:c?"chartArea":u?"bottom":"left",dtype:c?"radialLinear":u?"category":"linear"}}))),re(o,a=>{const r=a.options,l=r.id,c=Kn(l,r),u=ee(r.type,a.dtype);(r.position===void 0||Uo(r.position,c)!==Uo(a.dposition))&&(r.position=a.dposition),i[l]=!0;let d=null;if(l in n&&n[l].type===u)d=n[l];else{const h=Ke.getScale(u);d=new h({id:l,type:u,ctx:this.ctx,chart:this}),n[d.id]=d}d.init(r,e)}),re(i,(a,r)=>{a||delete n[r]}),re(n,a=>{Be.configure(this,a,a.options),Be.addBox(this,a)})}_updateMetasets(){const e=this._metasets,s=this.data.datasets.length,n=e.length;if(e.sort((i,o)=>i.index-o.index),n>s){for(let i=s;i<n;++i)this._destroyDatasetMeta(i);e.splice(s,n-s)}this._sortedMetasets=e.slice(0).sort(Ho("order","index"))}_removeUnreferencedMetasets(){const{_metasets:e,data:{datasets:s}}=this;e.length>s.length&&delete this._stacks,e.forEach((n,i)=>{s.filter(o=>o===n._dataset).length===0&&this._destroyDatasetMeta(i)})}buildOrUpdateControllers(){const e=[],s=this.data.datasets;let n,i;for(this._removeUnreferencedMetasets(),n=0,i=s.length;n<i;n++){const o=s[n];let a=this.getDatasetMeta(n);const r=o.type||this.config.type;if(a.type&&a.type!==r&&(this._destroyDatasetMeta(n),a=this.getDatasetMeta(n)),a.type=r,a.indexAxis=o.indexAxis||Xn(r,this.options),a.order=o.order||0,a.index=n,a.label=""+o.label,a.visible=this.isDatasetVisible(n),a.controller)a.controller.updateIndex(n),a.controller.linkScales();else{const l=Ke.getController(r),{datasetElementType:c,dataElementType:u}=me.datasets[r];Object.assign(l,{dataElementType:Ke.getElement(u),datasetElementType:c&&Ke.getElement(c)}),a.controller=new l(this,n),e.push(a.controller)}}return this._updateMetasets(),e}_resetElements(){re(this.data.datasets,(e,s)=>{this.getDatasetMeta(s).controller.reset()},this)}reset(){this._resetElements(),this.notifyPlugins("reset")}update(e){const s=this.config;s.update();const n=this._options=s.createResolver(s.chartOptionScopes(),this.getContext()),i=this._animationsDisabled=!n.animation;if(this._updateScales(),this._checkEventBindings(),this._updateHiddenIndices(),this._plugins.invalidate(),this.notifyPlugins("beforeUpdate",{mode:e,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:d}=this.getDatasetMeta(c),h=!i&&o.indexOf(d)===-1;d.buildOrUpdateElements(h),a=Math.max(+d.getMaxOverflow(),a)}a=this._minPadding=n.layout.autoPadding?a:0,this._updateLayout(a),i||re(o,c=>{c.reset()}),this._updateDatasets(e),this.notifyPlugins("afterUpdate",{mode:e}),this._layers.sort(Ho("z","_idx"));const{_active:r,_lastEvent:l}=this;l?this._eventHandler(l,!0):r.length&&this._updateHoverStyles(r,r,!0),this.render()}_updateScales(){re(this.scales,e=>{Be.removeBox(this,e)}),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){const e=this.options,s=new Set(Object.keys(this._listeners)),n=new Set(e.events);(!no(s,n)||!!this._responsiveListeners!==e.responsive)&&(this.unbindEvents(),this.bindEvents())}_updateHiddenIndices(){const{_hiddenIndices:e}=this,s=this._getUniformDataChanges()||[];for(const{method:n,start:i,count:o}of s){const a=n==="_removeElements"?-o:o;Zg(e,i,a)}}_getUniformDataChanges(){const e=this._dataChanges;if(!e||!e.length)return;this._dataChanges=[];const s=this.data.datasets.length,n=o=>new Set(e.filter(a=>a[0]===o).map((a,r)=>r+","+a.splice(1).join(","))),i=n(0);for(let o=1;o<s;o++)if(!no(i,n(o)))return;return Array.from(i).map(o=>o.split(",")).map(o=>({method:o[1],start:+o[2],count:+o[3]}))}_updateLayout(e){if(this.notifyPlugins("beforeLayout",{cancelable:!0})===!1)return;Be.update(this,this.width,this.height,e);const s=this.chartArea,n=s.width<=0||s.height<=0;this._layers=[],re(this.boxes,i=>{n&&i.position==="chartArea"||(i.configure&&i.configure(),this._layers.push(...i._layers()))},this),this._layers.forEach((i,o)=>{i._idx=o}),this.notifyPlugins("afterLayout")}_updateDatasets(e){if(this.notifyPlugins("beforeDatasetsUpdate",{mode:e,cancelable:!0})!==!1){for(let s=0,n=this.data.datasets.length;s<n;++s)this.getDatasetMeta(s).controller.configure();for(let s=0,n=this.data.datasets.length;s<n;++s)this._updateDataset(s,gt(e)?e({datasetIndex:s}):e);this.notifyPlugins("afterDatasetsUpdate",{mode:e})}}_updateDataset(e,s){const n=this.getDatasetMeta(e),i={meta:n,index:e,mode:s,cancelable:!0};this.notifyPlugins("beforeDatasetUpdate",i)!==!1&&(n.controller._update(s),i.cancelable=!1,this.notifyPlugins("afterDatasetUpdate",i))}render(){this.notifyPlugins("beforeRender",{cancelable:!0})!==!1&&(tt.has(this)?this.attached&&!tt.running(this)&&tt.start(this):(this.draw(),jo({chart:this})))}draw(){let e;if(this._resizeBeforeDraw){const{width:n,height:i}=this._resizeBeforeDraw;this._resizeBeforeDraw=null,this._resize(n,i)}if(this.clear(),this.width<=0||this.height<=0||this.notifyPlugins("beforeDraw",{cancelable:!0})===!1)return;const s=this._layers;for(e=0;e<s.length&&s[e].z<=0;++e)s[e].draw(this.chartArea);for(this._drawDatasets();e<s.length;++e)s[e].draw(this.chartArea);this.notifyPlugins("afterDraw")}_getSortedDatasetMetas(e){const s=this._sortedMetasets,n=[];let i,o;for(i=0,o=s.length;i<o;++i){const a=s[i];(!e||a.visible)&&n.push(a)}return n}getSortedVisibleDatasetMetas(){return this._getSortedDatasetMetas(!0)}_drawDatasets(){if(this.notifyPlugins("beforeDatasetsDraw",{cancelable:!0})===!1)return;const e=this.getSortedVisibleDatasetMetas();for(let s=e.length-1;s>=0;--s)this._drawDataset(e[s]);this.notifyPlugins("afterDatasetsDraw")}_drawDataset(e){const s=this.ctx,n={meta:e,index:e.index,cancelable:!0},i=Mp(this,e);this.notifyPlugins("beforeDatasetDraw",n)!==!1&&(i&&yi(s,i),e.controller.draw(),i&&xi(s),n.cancelable=!1,this.notifyPlugins("afterDatasetDraw",n))}isPointInArea(e){return ys(e,this.chartArea,this._minPadding)}getElementsAtEventForMode(e,s,n,i){const o=Kp.modes[s];return typeof o=="function"?o(this,e,n,i):[]}getDatasetMeta(e){const s=this.data.datasets[e],n=this._metasets;let i=n.filter(o=>o&&o._dataset===s).pop();return i||(i={type:null,data:[],dataset:null,controller:null,hidden:null,xAxisID:null,yAxisID:null,order:s&&s.order||0,index:e,_dataset:s,_parsed:[],_sorted:!1},n.push(i)),i}getContext(){return this.$context||(this.$context=Ct(null,{chart:this,type:"chart"}))}getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(e){const s=this.data.datasets[e];if(!s)return!1;const n=this.getDatasetMeta(e);return typeof n.hidden=="boolean"?!n.hidden:!s.hidden}setDatasetVisibility(e,s){const n=this.getDatasetMeta(e);n.hidden=!s}toggleDataVisibility(e){this._hiddenIndices[e]=!this._hiddenIndices[e]}getDataVisibility(e){return!this._hiddenIndices[e]}_updateVisibility(e,s,n){const i=n?"show":"hide",o=this.getDatasetMeta(e),a=o.controller._resolveAnimations(void 0,i);Qs(s)?(o.data[s].hidden=!n,this.update()):(this.setDatasetVisibility(e,n),a.update(o,{visible:n}),this.update(r=>r.datasetIndex===e?i:void 0))}hide(e,s){this._updateVisibility(e,s,!1)}show(e,s){this._updateVisibility(e,s,!0)}_destroyDatasetMeta(e){const s=this._metasets[e];s&&s.controller&&s.controller._destroy(),delete this._metasets[e]}_stop(){let e,s;for(this.stop(),tt.remove(this),e=0,s=this.data.datasets.length;e<s;++e)this._destroyDatasetMeta(e)}destroy(){this.notifyPlugins("beforeDestroy");const{canvas:e,ctx:s}=this;this._stop(),this.config.clearCache(),e&&(this.unbindEvents(),po(e,s),this.platform.releaseContext(s),this.canvas=null,this.ctx=null),delete js[this.id],this.notifyPlugins("afterDestroy")}toBase64Image(...e){return this.canvas.toDataURL(...e)}bindEvents(){this.bindUserEvents(),this.options.responsive?this.bindResponsiveEvents():this.attached=!0}bindUserEvents(){const e=this._listeners,s=this.platform,n=(o,a)=>{s.addEventListener(this,o,a),e[o]=a},i=(o,a,r)=>{o.offsetX=a,o.offsetY=r,this._eventHandler(o)};re(this.options.events,o=>n(o,i))}bindResponsiveEvents(){this._responsiveListeners||(this._responsiveListeners={});const e=this._responsiveListeners,s=this.platform,n=(l,c)=>{s.addEventListener(this,l,c),e[l]=c},i=(l,c)=>{e[l]&&(s.removeEventListener(this,l,c),delete e[l])},o=(l,c)=>{this.canvas&&this.resize(l,c)};let a;const r=()=>{i("attach",r),this.attached=!0,this.resize(),n("resize",o),n("detach",a)};a=()=>{this.attached=!1,i("resize",o),this._stop(),this._resize(0,0),n("attach",r)},s.isAttached(this.canvas)?r():a()}unbindEvents(){re(this._listeners,(e,s)=>{this.platform.removeEventListener(this,s,e)}),this._listeners={},re(this._responsiveListeners,(e,s)=>{this.platform.removeEventListener(this,s,e)}),this._responsiveListeners=void 0}updateHoverStyle(e,s,n){const i=n?"set":"remove";let o,a,r,l;for(s==="dataset"&&(o=this.getDatasetMeta(e[0].datasetIndex),o.controller["_"+i+"DatasetHoverStyle"]()),r=0,l=e.length;r<l;++r){a=e[r];const c=a&&this.getDatasetMeta(a.datasetIndex).controller;c&&c[i+"HoverStyle"](a.element,a.datasetIndex,a.index)}}getActiveElements(){return this._active||[]}setActiveElements(e){const s=this._active||[],n=e.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}});!Xs(n,s)&&(this._active=n,this._lastEvent=null,this._updateHoverStyles(n,s))}notifyPlugins(e,s,n){return this._plugins.notify(this,e,s,n)}isPluginEnabled(e){return this._plugins._cache.filter(s=>s.plugin.id===e).length===1}_updateHoverStyles(e,s,n){const i=this.options.hover,o=(l,c)=>l.filter(u=>!c.some(d=>u.datasetIndex===d.datasetIndex&&u.index===d.index)),a=o(s,e),r=n?e:o(e,s);a.length&&this.updateHoverStyle(a,i.mode,!1),r.length&&i.mode&&this.updateHoverStyle(r,i.mode,!0)}_eventHandler(e,s){const n={event:e,replay:s,cancelable:!0,inChartArea:this.isPointInArea(e)},i=a=>(a.options.events||this.options.events).includes(e.native.type);if(this.notifyPlugins("beforeEvent",n,i)===!1)return;const o=this._handleEvent(e,s,n.inChartArea);return n.cancelable=!1,this.notifyPlugins("afterEvent",n,i),(o||n.changed)&&this.render(),this}_handleEvent(e,s,n){const{_active:i=[],options:o}=this,a=s,r=this._getActiveElements(e,i,n,a),l=lf(e),c=Jg(e,this._lastEvent,n,l);n&&(this._lastEvent=null,fe(o.onHover,[e,r,this],this),l&&fe(o.onClick,[e,r,this],this));const u=!Xs(r,i);return(u||s)&&(this._active=r,this._updateHoverStyles(r,i,s)),this._lastEvent=c,u}_getActiveElements(e,s,n,i){if(e.type==="mouseout")return[];if(!n)return s;const o=this.options.hover;return this.getElementsAtEventForMode(e,o.mode,o,i)}},N(lt,"defaults",me),N(lt,"instances",js),N(lt,"overrides",St),N(lt,"registry",Ke),N(lt,"version",Xg),N(lt,"getChart",Wo),lt);function Go(){return re(dn.instances,t=>t._plugins.invalidate())}function em(t,e,s){const{startAngle:n,pixelMargin:i,x:o,y:a,outerRadius:r,innerRadius:l}=e;let c=i/r;t.beginPath(),t.arc(o,a,r,n-c,s+c),l>i?(c=i/l,t.arc(o,a,l,s+c,n-c,!0)):t.arc(o,a,i,s+be,n-be),t.closePath(),t.clip()}function tm(t){return wi(t,["outerStart","outerEnd","innerStart","innerEnd"])}function sm(t,e,s,n){const i=tm(t.options.borderRadius),o=(s-e)/2,a=Math.min(o,n*e/2),r=l=>{const c=(s-Math.min(o,l))*n/2;return Re(l,0,Math.min(o,c))};return{outerStart:r(i.outerStart),outerEnd:r(i.outerEnd),innerStart:Re(i.innerStart,0,a),innerEnd:Re(i.innerEnd,0,a)}}function Mt(t,e,s,n){return{x:s+t*Math.cos(e),y:n+t*Math.sin(e)}}function tn(t,e,s,n,i,o){const{x:a,y:r,startAngle:l,pixelMargin:c,innerRadius:u}=e,d=Math.max(e.outerRadius+n+s-c,0),h=u>0?u+n+s+c:0;let f=0;const p=i-l;if(n){const Y=u>0?u-n:0,Q=d>0?d-n:0,Z=(Y+Q)/2,ye=Z!==0?p*Z/(Z+n):p;f=(p-ye)/2}const g=Math.max(.001,p*d-s/ge)/d,m=(p-g)/2,y=l+m+f,v=i-m-f,{outerStart:k,outerEnd:P,innerStart:C,innerEnd:O}=sm(e,h,d,v-y),R=d-k,E=d-P,z=y+k/R,j=v-P/E,G=h+C,L=h+O,F=y+C/G,he=v-O/L;if(t.beginPath(),o){const Y=(z+j)/2;if(t.arc(a,r,d,z,Y),t.arc(a,r,d,Y,j),P>0){const ce=Mt(E,j,a,r);t.arc(ce.x,ce.y,P,j,v+be)}const Q=Mt(L,v,a,r);if(t.lineTo(Q.x,Q.y),O>0){const ce=Mt(L,he,a,r);t.arc(ce.x,ce.y,O,v+be,he+Math.PI)}const Z=(v-O/h+(y+C/h))/2;if(t.arc(a,r,h,v-O/h,Z,!0),t.arc(a,r,h,Z,y+C/h,!0),C>0){const ce=Mt(G,F,a,r);t.arc(ce.x,ce.y,C,F+Math.PI,y-be)}const ye=Mt(R,y,a,r);if(t.lineTo(ye.x,ye.y),k>0){const ce=Mt(R,z,a,r);t.arc(ce.x,ce.y,k,y-be,z)}}else{t.moveTo(a,r);const Y=Math.cos(z)*d+a,Q=Math.sin(z)*d+r;t.lineTo(Y,Q);const Z=Math.cos(j)*d+a,ye=Math.sin(j)*d+r;t.lineTo(Z,ye)}t.closePath()}function nm(t,e,s,n,i){const{fullCircles:o,startAngle:a,circumference:r}=e;let l=e.endAngle;if(o){tn(t,e,s,n,l,i);for(let c=0;c<o;++c)t.fill();isNaN(r)||(l=a+(r%pe||pe))}return tn(t,e,s,n,l,i),t.fill(),l}function im(t,e,s,n,i){const{fullCircles:o,startAngle:a,circumference:r,options:l}=e,{borderWidth:c,borderJoinStyle:u,borderDash:d,borderDashOffset:h}=l,f=l.borderAlign==="inner";if(!c)return;t.setLineDash(d||[]),t.lineDashOffset=h,f?(t.lineWidth=c*2,t.lineJoin=u||"round"):(t.lineWidth=c,t.lineJoin=u||"bevel");let p=e.endAngle;if(o){tn(t,e,s,n,p,i);for(let g=0;g<o;++g)t.stroke();isNaN(r)||(p=a+(r%pe||pe))}f&&em(t,e,p),o||(tn(t,e,s,n,p,i),t.stroke())}class ts extends Qe{constructor(s){super();N(this,"circumference");N(this,"endAngle");N(this,"fullCircles");N(this,"innerRadius");N(this,"outerRadius");N(this,"pixelMargin");N(this,"startAngle");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,s&&Object.assign(this,s)}inRange(s,n,i){const o=this.getProps(["x","y"],i),{angle:a,distance:r}=Ka(o,{x:s,y:n}),{startAngle:l,endAngle:c,innerRadius:u,outerRadius:d,circumference:h}=this.getProps(["startAngle","endAngle","innerRadius","outerRadius","circumference"],i),f=(this.options.spacing+this.options.borderWidth)/2,p=ee(h,c-l),g=bs(a,l,c)&&l!==c,m=p>=pe||g,y=Lt(r,u+f,d+f);return m&&y}getCenterPoint(s){const{x:n,y:i,startAngle:o,endAngle:a,innerRadius:r,outerRadius:l}=this.getProps(["x","y","startAngle","endAngle","innerRadius","outerRadius"],s),{offset:c,spacing:u}=this.options,d=(o+a)/2,h=(r+l+u+c)/2;return{x:n+Math.cos(d)*h,y:i+Math.sin(d)*h}}tooltipPosition(s){return this.getCenterPoint(s)}draw(s){const{options:n,circumference:i}=this,o=(n.offset||0)/4,a=(n.spacing||0)/2,r=n.circular;if(this.pixelMargin=n.borderAlign==="inner"?.33:0,this.fullCircles=i>pe?Math.floor(i/pe):0,i===0||this.innerRadius<0||this.outerRadius<0)return;s.save();const l=(this.startAngle+this.endAngle)/2;s.translate(Math.cos(l)*o,Math.sin(l)*o);const c=1-Math.sin(Math.min(ge,i||0)),u=o*c;s.fillStyle=n.backgroundColor,s.strokeStyle=n.borderColor,nm(s,this,u,a,r),im(s,this,u,a,r),s.restore()}}N(ts,"id","arc"),N(ts,"defaults",{borderAlign:"center",borderColor:"#fff",borderDash:[],borderDashOffset:0,borderJoinStyle:void 0,borderRadius:0,borderWidth:2,offset:0,spacing:0,angle:void 0,circular:!0}),N(ts,"defaultRoutes",{backgroundColor:"backgroundColor"}),N(ts,"descriptors",{_scriptable:!0,_indexable:s=>s!=="borderDash"});function xr(t,e,s=e){t.lineCap=ee(s.borderCapStyle,e.borderCapStyle),t.setLineDash(ee(s.borderDash,e.borderDash)),t.lineDashOffset=ee(s.borderDashOffset,e.borderDashOffset),t.lineJoin=ee(s.borderJoinStyle,e.borderJoinStyle),t.lineWidth=ee(s.borderWidth,e.borderWidth),t.strokeStyle=ee(s.borderColor,e.borderColor)}function om(t,e,s){t.lineTo(s.x,s.y)}function am(t){return t.stepped?Ff:t.tension||t.cubicInterpolationMode==="monotone"?Vf:om}function wr(t,e,s={}){const n=t.length,{start:i=0,end:o=n-1}=s,{start:a,end:r}=e,l=Math.max(i,a),c=Math.min(o,r),u=i<a&&o<a||i>r&&o>r;return{count:n,start:l,loop:e.loop,ilen:c<l&&!u?n+c-l:c-l}}function rm(t,e,s,n){const{points:i,options:o}=e,{count:a,start:r,loop:l,ilen:c}=wr(i,s,n),u=am(o);let{move:d=!0,reverse:h}=n||{},f,p,g;for(f=0;f<=c;++f)p=i[(r+(h?c-f:f))%a],!p.skip&&(d?(t.moveTo(p.x,p.y),d=!1):u(t,g,p,h,o.stepped),g=p);return l&&(p=i[(r+(h?c:0))%a],u(t,g,p,h,o.stepped)),!!l}function lm(t,e,s,n){const i=e.points,{count:o,start:a,ilen:r}=wr(i,s,n),{move:l=!0,reverse:c}=n||{};let u=0,d=0,h,f,p,g,m,y;const v=P=>(a+(c?r-P:P))%o,k=()=>{g!==m&&(t.lineTo(u,m),t.lineTo(u,g),t.lineTo(u,y))};for(l&&(f=i[v(0)],t.moveTo(f.x,f.y)),h=0;h<=r;++h){if(f=i[v(h)],f.skip)continue;const P=f.x,C=f.y,O=P|0;O===p?(C<g?g=C:C>m&&(m=C),u=(d*u+P)/++d):(k(),t.lineTo(P,C),p=O,d=0,g=m=C),y=C}k()}function Qn(t){const e=t.options,s=e.borderDash&&e.borderDash.length;return!t._decimated&&!t._loop&&!e.tension&&e.cubicInterpolationMode!=="monotone"&&!e.stepped&&!s?lm:rm}function cm(t){return t.stepped?mp:t.tension||t.cubicInterpolationMode==="monotone"?_p:yt}function um(t,e,s,n){let i=e._path;i||(i=e._path=new Path2D,e.path(i,s,n)&&i.closePath()),xr(t,e.options),t.stroke(i)}function dm(t,e,s,n){const{segments:i,options:o}=e,a=Qn(e);for(const r of i)xr(t,o,r.style),t.beginPath(),a(t,e,r,{start:s,end:s+n-1})&&t.closePath(),t.stroke()}const hm=typeof Path2D=="function";function fm(t,e,s,n){hm&&!e.options.segment?um(t,e,s,n):dm(t,e,s,n)}class ss extends Qe{constructor(e){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,e&&Object.assign(this,e)}updateControlPoints(e,s){const n=this.options;if((n.tension||n.cubicInterpolationMode==="monotone")&&!n.stepped&&!this._pointsUpdated){const i=n.spanGaps?this._loop:this._fullLoop;lp(this._points,n,e,i,s),this._pointsUpdated=!0}}set points(e){this._points=e,delete this._segments,delete this._path,this._pointsUpdated=!1}get points(){return this._points}get segments(){return this._segments||(this._segments=Cp(this,this.options.segment))}first(){const e=this.segments,s=this.points;return e.length&&s[e[0].start]}last(){const e=this.segments,s=this.points,n=e.length;return n&&s[e[n-1].end]}interpolate(e,s){const n=this.options,i=e[s],o=this.points,a=wp(this,{property:s,start:i,end:i});if(!a.length)return;const r=[],l=cm(n);let c,u;for(c=0,u=a.length;c<u;++c){const{start:d,end:h}=a[c],f=o[d],p=o[h];if(f===p){r.push(f);continue}const g=Math.abs((i-f[s])/(p[s]-f[s])),m=l(f,p,g,n.stepped);m[s]=e[s],r.push(m)}return r.length===1?r[0]:r}pathSegment(e,s,n){return Qn(this)(e,this,s,n)}path(e,s,n){const i=this.segments,o=Qn(this);let a=this._loop;s=s||0,n=n||this.points.length-s;for(const r of i)a&=o(e,this,r,{start:s,end:s+n-1});return!!a}draw(e,s,n,i){const o=this.options||{};(this.points||[]).length&&o.borderWidth&&(e.save(),fm(e,this,n,i),e.restore()),this.animated&&(this._pointsUpdated=!1,this._path=void 0)}}N(ss,"id","line"),N(ss,"defaults",{borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderWidth:3,capBezierPoints:!0,cubicInterpolationMode:"default",fill:!1,spanGaps:!1,stepped:!1,tension:0}),N(ss,"defaultRoutes",{backgroundColor:"backgroundColor",borderColor:"borderColor"}),N(ss,"descriptors",{_scriptable:!0,_indexable:e=>e!=="borderDash"&&e!=="fill"});function qo(t,e,s,n){const i=t.options,{[s]:o}=t.getProps([s],n);return Math.abs(e-o)<i.radius+i.hitRadius}class Ws extends Qe{constructor(s){super();N(this,"parsed");N(this,"skip");N(this,"stop");this.options=void 0,this.parsed=void 0,this.skip=void 0,this.stop=void 0,s&&Object.assign(this,s)}inRange(s,n,i){const o=this.options,{x:a,y:r}=this.getProps(["x","y"],i);return Math.pow(s-a,2)+Math.pow(n-r,2)<Math.pow(o.hitRadius+o.radius,2)}inXRange(s,n){return qo(this,s,"x",n)}inYRange(s,n){return qo(this,s,"y",n)}getCenterPoint(s){const{x:n,y:i}=this.getProps(["x","y"],s);return{x:n,y:i}}size(s){s=s||this.options||{};let n=s.radius||0;n=Math.max(n,n&&s.hoverRadius||0);const i=n&&s.borderWidth||0;return(n+i)*2}draw(s,n){const i=this.options;this.skip||i.radius<.1||!ys(this,n,this.size(i)/2)||(s.strokeStyle=i.borderColor,s.lineWidth=i.borderWidth,s.fillStyle=i.backgroundColor,Gn(s,i,this.x,this.y))}getRange(){const s=this.options||{};return s.radius+s.hitRadius}}N(Ws,"id","point"),N(Ws,"defaults",{borderWidth:1,hitRadius:1,hoverBorderWidth:1,hoverRadius:4,pointStyle:"circle",radius:3,rotation:0}),N(Ws,"defaultRoutes",{backgroundColor:"backgroundColor",borderColor:"borderColor"});const Yo=(t,e)=>{let{boxHeight:s=e,boxWidth:n=e}=t;return t.usePointStyle&&(s=Math.min(s,e),n=t.pointStyleWidth||Math.min(n,e)),{boxWidth:n,boxHeight:s,itemHeight:Math.max(e,s)}},pm=(t,e)=>t!==null&&e!==null&&t.datasetIndex===e.datasetIndex&&t.index===e.index;class Xo extends Qe{constructor(e){super(),this._added=!1,this.legendHitBoxes=[],this._hoveredItem=null,this.doughnutMode=!1,this.chart=e.chart,this.options=e.options,this.ctx=e.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(e,s,n){this.maxWidth=e,this.maxHeight=s,this._margins=n,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 e=this.options.labels||{};let s=fe(e.generateLabels,[this.chart],this)||[];e.filter&&(s=s.filter(n=>e.filter(n,this.chart.data))),e.sort&&(s=s.sort((n,i)=>e.sort(n,i,this.chart.data))),this.options.reverse&&s.reverse(),this.legendItems=s}fit(){const{options:e,ctx:s}=this;if(!e.display){this.width=this.height=0;return}const n=e.labels,i=De(n.font),o=i.size,a=this._computeTitleHeight(),{boxWidth:r,itemHeight:l}=Yo(n,o);let c,u;s.font=i.string,this.isHorizontal()?(c=this.maxWidth,u=this._fitRows(a,o,r,l)+10):(u=this.maxHeight,c=this._fitCols(a,i,r,l)+10),this.width=Math.min(c,e.maxWidth||this.maxWidth),this.height=Math.min(u,e.maxHeight||this.maxHeight)}_fitRows(e,s,n,i){const{ctx:o,maxWidth:a,options:{labels:{padding:r}}}=this,l=this.legendHitBoxes=[],c=this.lineWidths=[0],u=i+r;let d=e;o.textAlign="left",o.textBaseline="middle";let h=-1,f=-u;return this.legendItems.forEach((p,g)=>{const m=n+s/2+o.measureText(p.text).width;(g===0||c[c.length-1]+m+2*r>a)&&(d+=u,c[c.length-(g>0?0:1)]=0,f+=u,h++),l[g]={left:0,top:f,row:h,width:m,height:i},c[c.length-1]+=m+r}),d}_fitCols(e,s,n,i){const{ctx:o,maxHeight:a,options:{labels:{padding:r}}}=this,l=this.legendHitBoxes=[],c=this.columnSizes=[],u=a-e;let d=r,h=0,f=0,p=0,g=0;return this.legendItems.forEach((m,y)=>{const{itemWidth:v,itemHeight:k}=gm(n,s,o,m,i);y>0&&f+k+2*r>u&&(d+=h+r,c.push({width:h,height:f}),p+=h+r,g++,h=f=0),l[y]={left:p,top:f,col:g,width:v,height:k},h=Math.max(h,v),f+=k+r}),d+=h,c.push({width:h,height:f}),d}adjustHitBoxes(){if(!this.options.display)return;const e=this._computeTitleHeight(),{legendHitBoxes:s,options:{align:n,labels:{padding:i},rtl:o}}=this,a=Ot(o,this.left,this.width);if(this.isHorizontal()){let r=0,l=Pe(n,this.left+i,this.right-this.lineWidths[r]);for(const c of s)r!==c.row&&(r=c.row,l=Pe(n,this.left+i,this.right-this.lineWidths[r])),c.top+=this.top+e+i,c.left=a.leftForLtr(a.x(l),c.width),l+=c.width+i}else{let r=0,l=Pe(n,this.top+e+i,this.bottom-this.columnSizes[r].height);for(const c of s)c.col!==r&&(r=c.col,l=Pe(n,this.top+e+i,this.bottom-this.columnSizes[r].height)),c.top=l,c.left+=this.left+i,c.left=a.leftForLtr(a.x(c.left),c.width),l+=c.height+i}}isHorizontal(){return this.options.position==="top"||this.options.position==="bottom"}draw(){if(this.options.display){const e=this.ctx;yi(e,this),this._draw(),xi(e)}}_draw(){const{options:e,columnSizes:s,lineWidths:n,ctx:i}=this,{align:o,labels:a}=e,r=me.color,l=Ot(e.rtl,this.left,this.width),c=De(a.font),{padding:u}=a,d=c.size,h=d/2;let f;this.drawTitle(),i.textAlign=l.textAlign("left"),i.textBaseline="middle",i.lineWidth=.5,i.font=c.string;const{boxWidth:p,boxHeight:g,itemHeight:m}=Yo(a,d),y=function(O,R,E){if(isNaN(p)||p<=0||isNaN(g)||g<0)return;i.save();const z=ee(E.lineWidth,1);if(i.fillStyle=ee(E.fillStyle,r),i.lineCap=ee(E.lineCap,"butt"),i.lineDashOffset=ee(E.lineDashOffset,0),i.lineJoin=ee(E.lineJoin,"miter"),i.lineWidth=z,i.strokeStyle=ee(E.strokeStyle,r),i.setLineDash(ee(E.lineDash,[])),a.usePointStyle){const j={radius:g*Math.SQRT2/2,pointStyle:E.pointStyle,rotation:E.rotation,borderWidth:z},G=l.xPlus(O,p/2),L=R+h;tr(i,j,G,L,a.pointStyleWidth&&p)}else{const j=R+Math.max((d-g)/2,0),G=l.leftForLtr(O,p),L=ds(E.borderRadius);i.beginPath(),Object.values(L).some(F=>F!==0)?qn(i,{x:G,y:j,w:p,h:g,radius:L}):i.rect(G,j,p,g),i.fill(),z!==0&&i.stroke()}i.restore()},v=function(O,R,E){xs(i,E.text,O,R+m/2,c,{strikethrough:E.hidden,textAlign:l.textAlign(E.textAlign)})},k=this.isHorizontal(),P=this._computeTitleHeight();k?f={x:Pe(o,this.left+u,this.right-n[0]),y:this.top+u+P,line:0}:f={x:this.left+u,y:Pe(o,this.top+P+u,this.bottom-s[0].height),line:0},rr(this.ctx,e.textDirection);const C=m+u;this.legendItems.forEach((O,R)=>{i.strokeStyle=O.fontColor,i.fillStyle=O.fontColor;const E=i.measureText(O.text).width,z=l.textAlign(O.textAlign||(O.textAlign=a.textAlign)),j=p+h+E;let G=f.x,L=f.y;l.setWidth(this.width),k?R>0&&G+j+u>this.right&&(L=f.y+=C,f.line++,G=f.x=Pe(o,this.left+u,this.right-n[f.line])):R>0&&L+C>this.bottom&&(G=f.x=G+s[f.line].width+u,f.line++,L=f.y=Pe(o,this.top+P+u,this.bottom-s[f.line].height));const F=l.x(G);if(y(F,L,O),G=Sf(z,G+p+h,k?G+j:this.right,e.rtl),v(l.x(G),L,O),k)f.x+=j+u;else if(typeof O.text!="string"){const he=c.lineHeight;f.y+=Sr(O,he)+u}else f.y+=C}),lr(this.ctx,e.textDirection)}drawTitle(){const e=this.options,s=e.title,n=De(s.font),i=Ue(s.padding);if(!s.display)return;const o=Ot(e.rtl,this.left,this.width),a=this.ctx,r=s.position,l=n.size/2,c=i.top+l;let u,d=this.left,h=this.width;if(this.isHorizontal())h=Math.max(...this.lineWidths),u=this.top+c,d=Pe(e.align,d,this.right-h);else{const p=this.columnSizes.reduce((g,m)=>Math.max(g,m.height),0);u=c+Pe(e.align,this.top,this.bottom-p-e.labels.padding-this._computeTitleHeight())}const f=Pe(r,d,d+h);a.textAlign=o.textAlign(_i(r)),a.textBaseline="middle",a.strokeStyle=s.color,a.fillStyle=s.color,a.font=n.string,xs(a,s.text,f,u,n)}_computeTitleHeight(){const e=this.options.title,s=De(e.font),n=Ue(e.padding);return e.display?s.lineHeight+n.height:0}_getLegendItemAt(e,s){let n,i,o;if(Lt(e,this.left,this.right)&&Lt(s,this.top,this.bottom)){for(o=this.legendHitBoxes,n=0;n<o.length;++n)if(i=o[n],Lt(e,i.left,i.left+i.width)&&Lt(s,i.top,i.top+i.height))return this.legendItems[n]}return null}handleEvent(e){const s=this.options;if(!vm(e.type,s))return;const n=this._getLegendItemAt(e.x,e.y);if(e.type==="mousemove"||e.type==="mouseout"){const i=this._hoveredItem,o=pm(i,n);i&&!o&&fe(s.onLeave,[e,i,this],this),this._hoveredItem=n,n&&!o&&fe(s.onHover,[e,n,this],this)}else n&&fe(s.onClick,[e,n,this],this)}}function gm(t,e,s,n,i){const o=mm(n,t,e,s),a=_m(i,n,e.lineHeight);return{itemWidth:o,itemHeight:a}}function mm(t,e,s,n){let i=t.text;return i&&typeof i!="string"&&(i=i.reduce((o,a)=>o.length>a.length?o:a)),e+s.size/2+n.measureText(i).width}function _m(t,e,s){let n=t;return typeof e.text!="string"&&(n=Sr(e,s)),n}function Sr(t,e){const s=t.text?t.text.length:0;return e*s}function vm(t,e){return!!((t==="mousemove"||t==="mouseout")&&(e.onHover||e.onLeave)||e.onClick&&(t==="click"||t==="mouseup"))}var bm={id:"legend",_element:Xo,start(t,e,s){const n=t.legend=new Xo({ctx:t.ctx,options:s,chart:t});Be.configure(t,n,s),Be.addBox(t,n)},stop(t){Be.removeBox(t,t.legend),delete t.legend},beforeUpdate(t,e,s){const n=t.legend;Be.configure(t,n,s),n.options=s},afterUpdate(t){const e=t.legend;e.buildLabels(),e.adjustHitBoxes()},afterEvent(t,e){e.replay||t.legend.handleEvent(e.event)},defaults:{display:!0,position:"top",align:"center",fullSize:!0,reverse:!1,weight:1e3,onClick(t,e,s){const n=e.datasetIndex,i=s.chart;i.isDatasetVisible(n)?(i.hide(n),e.hidden=!0):(i.show(n),e.hidden=!1)},onHover:null,onLeave:null,labels:{color:t=>t.chart.options.color,boxWidth:40,padding:10,generateLabels(t){const e=t.data.datasets,{labels:{usePointStyle:s,pointStyle:n,textAlign:i,color:o,useBorderRadius:a,borderRadius:r}}=t.legend.options;return t._getSortedDatasetMetas().map(l=>{const c=l.controller.getStyle(s?0:void 0),u=Ue(c.borderWidth);return{text:e[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:n||c.pointStyle,rotation:c.rotation,textAlign:i||c.textAlign,borderRadius:a&&(r||c.borderRadius),datasetIndex:l.index}},this)}},title:{color:t=>t.chart.options.color,display:!1,position:"center",text:""}},descriptors:{_scriptable:t=>!t.startsWith("on"),labels:{_scriptable:t=>!["generateLabels","filter","sort"].includes(t)}}};class kr extends Qe{constructor(e){super(),this.chart=e.chart,this.options=e.options,this.ctx=e.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(e,s){const n=this.options;if(this.left=0,this.top=0,!n.display){this.width=this.height=this.right=this.bottom=0;return}this.width=this.right=e,this.height=this.bottom=s;const i=xe(n.text)?n.text.length:1;this._padding=Ue(n.padding);const o=i*De(n.font).lineHeight+this._padding.height;this.isHorizontal()?this.height=o:this.width=o}isHorizontal(){const e=this.options.position;return e==="top"||e==="bottom"}_drawArgs(e){const{top:s,left:n,bottom:i,right:o,options:a}=this,r=a.align;let l=0,c,u,d;return this.isHorizontal()?(u=Pe(r,n,o),d=s+e,c=o-n):(a.position==="left"?(u=n+e,d=Pe(r,i,s),l=ge*-.5):(u=o-e,d=Pe(r,s,i),l=ge*.5),c=i-s),{titleX:u,titleY:d,maxWidth:c,rotation:l}}draw(){const e=this.ctx,s=this.options;if(!s.display)return;const n=De(s.font),o=n.lineHeight/2+this._padding.top,{titleX:a,titleY:r,maxWidth:l,rotation:c}=this._drawArgs(o);xs(e,s.text,0,0,n,{color:s.color,maxWidth:l,rotation:c,textAlign:_i(s.align),textBaseline:"middle",translation:[a,r]})}}function ym(t,e){const s=new kr({ctx:t.ctx,options:e,chart:t});Be.configure(t,s,e),Be.addBox(t,s),t.titleBlock=s}var xm={id:"title",_element:kr,start(t,e,s){ym(t,s)},stop(t){const e=t.titleBlock;Be.removeBox(t,e),delete t.titleBlock},beforeUpdate(t,e,s){const n=t.titleBlock;Be.configure(t,n,s),n.options=s},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 ns={average(t){if(!t.length)return!1;let e,s,n=new Set,i=0,o=0;for(e=0,s=t.length;e<s;++e){const r=t[e].element;if(r&&r.hasValue()){const l=r.tooltipPosition();n.add(l.x),i+=l.y,++o}}return o===0||n.size===0?!1:{x:[...n].reduce((r,l)=>r+l)/n.size,y:i/o}},nearest(t,e){if(!t.length)return!1;let s=e.x,n=e.y,i=Number.POSITIVE_INFINITY,o,a,r;for(o=0,a=t.length;o<a;++o){const l=t[o].element;if(l&&l.hasValue()){const c=l.getCenterPoint(),u=jn(e,c);u<i&&(i=u,r=l)}}if(r){const l=r.tooltipPosition();s=l.x,n=l.y}return{x:s,y:n}}};function Xe(t,e){return e&&(xe(e)?Array.prototype.push.apply(t,e):t.push(e)),t}function st(t){return(typeof t=="string"||t instanceof String)&&t.indexOf(`25 */class Ap{constructor(){this._request=null,this._charts=new Map,this._running=!1,this._lastDate=void 0}_notify(e,s,n,i){const o=s.listeners[i],a=s.duration;o.forEach(r=>r({chart:e,initial:s.initial,numSteps:a,currentStep:Math.min(n-s.start,a)}))}_refresh(){this._request||(this._running=!0,this._request=Za.call(window,()=>{this._update(),this._request=null,this._running&&this._refresh()}))}_update(e=Date.now()){let s=0;this._charts.forEach((n,i)=>{if(!n.running||!n.items.length)return;const o=n.items;let a=o.length-1,r=!1,l;for(;a>=0;--a)l=o[a],l._active?(l._total>n.duration&&(n.duration=l._total),l.tick(e),r=!0):(o[a]=o[o.length-1],o.pop());r&&(i.draw(),this._notify(i,n,e,"progress")),o.length||(n.running=!1,this._notify(i,n,e,"complete"),n.initial=!1),s+=o.length}),this._lastDate=e,s===0&&(this._running=!1)}_getAnims(e){const s=this._charts;let n=s.get(e);return n||(n={running:!1,initial:!0,items:[],listeners:{complete:[],progress:[]}},s.set(e,n)),n}listen(e,s,n){this._getAnims(e).listeners[s].push(n)}add(e,s){!s||!s.length||this._getAnims(e).items.push(...s)}has(e){return this._getAnims(e).items.length>0}start(e){const s=this._charts.get(e);s&&(s.running=!0,s.start=Date.now(),s.duration=s.items.reduce((n,i)=>Math.max(n,i._duration),0),this._refresh())}running(e){if(!this._running)return!1;const s=this._charts.get(e);return!(!s||!s.running||!s.items.length)}stop(e){const s=this._charts.get(e);if(!s||!s.items.length)return;const n=s.items;let i=n.length-1;for(;i>=0;--i)n[i].cancel();s.items=[],this._notify(e,s,Date.now(),"complete")}remove(e){return this._charts.delete(e)}}var tt=new Ap;const wo="transparent",Tp={boolean(t,e,s){return s>.5?e:t},color(t,e,s){const n=uo(t||wo),i=n.valid&&uo(e||wo);return i&&i.valid?i.mix(n,s).hexString():e},number(t,e,s){return t+(e-t)*s}};class Ep{constructor(e,s,n,i){const o=s[n];i=Ts([e.to,i,o,e.from]);const a=Ts([e.from,o,i]);this._active=!0,this._fn=e.fn||Tp[e.type||typeof a],this._easing=cs[e.easing]||cs.linear,this._start=Math.floor(Date.now()+(e.delay||0)),this._duration=this._total=Math.floor(e.duration),this._loop=!!e.loop,this._target=s,this._prop=n,this._from=a,this._to=i,this._promises=void 0}active(){return this._active}update(e,s,n){if(this._active){this._notify(!1);const i=this._target[this._prop],o=n-this._start,a=this._duration-o;this._start=n,this._duration=Math.floor(Math.max(a,e.duration)),this._total+=o,this._loop=!!e.loop,this._to=Ts([e.to,s,i,e.from]),this._from=Ts([e.from,i,s])}}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(e){const s=e-this._start,n=this._duration,i=this._prop,o=this._from,a=this._loop,r=this._to;let l;if(this._active=o!==r&&(a||s<n),!this._active){this._target[i]=r,this._notify(!0);return}if(s<0){this._target[i]=o;return}l=s/n%2,l=a&&l>1?2-l:l,l=this._easing(Math.min(1,Math.max(0,l))),this._target[i]=this._fn(o,r,l)}wait(){const e=this._promises||(this._promises=[]);return new Promise((s,n)=>{e.push({res:s,rej:n})})}_notify(e){const s=e?"res":"rej",n=this._promises||[];for(let i=0;i<n.length;i++)n[i][s]()}}class ur{constructor(e,s){this._chart=e,this._properties=new Map,this.configure(s)}configure(e){if(!oe(e))return;const s=Object.keys(me.animation),n=this._properties;Object.getOwnPropertyNames(e).forEach(i=>{const o=e[i];if(!oe(o))return;const a={};for(const r of s)a[r]=o[r];(xe(o.properties)&&o.properties||[i]).forEach(r=>{(r===i||!n.has(r))&&n.set(r,a)})})}_animateOptions(e,s){const n=s.options,i=Op(e,n);if(!i)return[];const o=this._createAnimations(i,n);return n.$shared&&Lp(e.options.$animations,n).then(()=>{e.options=n},()=>{}),o}_createAnimations(e,s){const n=this._properties,i=[],o=e.$animations||(e.$animations={}),a=Object.keys(s),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"){i.push(...this._animateOptions(e,s));continue}const u=s[c];let d=o[c];const h=n.get(c);if(d)if(h&&d.active()){d.update(h,u,r);continue}else d.cancel();if(!h||!h.duration){e[c]=u;continue}o[c]=d=new Ep(h,e,c,u),i.push(d)}return i}update(e,s){if(this._properties.size===0){Object.assign(e,s);return}const n=this._createAnimations(e,s);if(n.length)return tt.add(this._chart,n),!0}}function Lp(t,e){const s=[],n=Object.keys(e);for(let i=0;i<n.length;i++){const o=t[n[i]];o&&o.active()&&s.push(o.wait())}return Promise.all(s)}function Op(t,e){if(!e)return;let s=t.options;if(!s){t.options=e;return}return s.$shared&&(t.options=s=Object.assign({},s,{$shared:!1,$animations:{}})),s}function So(t,e){const s=t&&t.options||{},n=s.reverse,i=s.min===void 0?e:0,o=s.max===void 0?e:0;return{start:n?o:i,end:n?i:o}}function Ip(t,e,s){if(s===!1)return!1;const n=So(t,s),i=So(e,s);return{top:i.end,right:n.end,bottom:i.start,left:n.start}}function Fp(t){let e,s,n,i;return oe(t)?(e=t.top,s=t.right,n=t.bottom,i=t.left):e=s=n=i=t,{top:e,right:s,bottom:n,left:i,disabled:t===!1}}function dr(t,e){const s=[],n=t._getSortedDatasetMetas(e);let i,o;for(i=0,o=n.length;i<o;++i)s.push(n[i].index);return s}function ko(t,e,s,n={}){const i=t.keys,o=n.mode==="single";let a,r,l,c;if(e===null)return;let u=!1;for(a=0,r=i.length;a<r;++a){if(l=+i[a],l===s){if(u=!0,n.all)continue;break}c=t.values[l],Ne(c)&&(o||e===0||Bt(e)===Bt(c))&&(e+=c)}return!u&&!n.all?0:e}function Vp(t,e){const{iScale:s,vScale:n}=e,i=s.axis==="x"?"x":"y",o=n.axis==="x"?"x":"y",a=Object.keys(t),r=new Array(a.length);let l,c,u;for(l=0,c=a.length;l<c;++l)u=a[l],r[l]={[i]:u,[o]:t[u]};return r}function Pn(t,e){const s=t&&t.options.stacked;return s||s===void 0&&e.stack!==void 0}function $p(t,e,s){return`${t.id}.${e.id}.${s.stack||s.type}`}function zp(t){const{min:e,max:s,minDefined:n,maxDefined:i}=t.getUserBounds();return{min:n?e:Number.NEGATIVE_INFINITY,max:i?s:Number.POSITIVE_INFINITY}}function Bp(t,e,s){const n=t[e]||(t[e]={});return n[s]||(n[s]={})}function Co(t,e,s,n){for(const i of e.getMatchingVisibleMetas(n).reverse()){const o=t[i.index];if(s&&o>0||!s&&o<0)return i.index}return null}function Po(t,e){const{chart:s,_cachedMeta:n}=t,i=s._stacks||(s._stacks={}),{iScale:o,vScale:a,index:r}=n,l=o.axis,c=a.axis,u=$p(o,a,n),d=e.length;let h;for(let f=0;f<d;++f){const p=e[f],{[l]:g,[c]:m}=p,y=p._stacks||(p._stacks={});h=y[c]=Bp(i,u,g),h[r]=m,h._top=Co(h,a,!0,n.type),h._bottom=Co(h,a,!1,n.type);const b=h._visualValues||(h._visualValues={});b[r]=m}}function Dn(t,e){const s=t.scales;return Object.keys(s).filter(n=>s[n].axis===e).shift()}function Np(t,e){return Ct(t,{active:!1,dataset:void 0,datasetIndex:e,index:e,mode:"default",type:"dataset"})}function Up(t,e,s){return Ct(t,{active:!1,dataIndex:e,parsed:void 0,raw:void 0,element:s,index:e,mode:"default",type:"data"})}function qt(t,e){const s=t.controller.index,n=t.vScale&&t.vScale.axis;if(n){e=e||t._parsed;for(const i of e){const o=i._stacks;if(!o||o[n]===void 0||o[n][s]===void 0)return;delete o[n][s],o[n]._visualValues!==void 0&&o[n]._visualValues[s]!==void 0&&delete o[n]._visualValues[s]}}}const Rn=t=>t==="reset"||t==="none",Do=(t,e)=>e?t:Object.assign({},t),Hp=(t,e,s)=>t&&!e.hidden&&e._stacked&&{keys:dr(s,!0),values:null};class It{constructor(e,s){this.chart=e,this._ctx=e.ctx,this.index=s,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 e=this._cachedMeta;this.configure(),this.linkScales(),e._stacked=Pn(e.vScale,e),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(e){this.index!==e&&qt(this._cachedMeta),this.index=e}linkScales(){const e=this.chart,s=this._cachedMeta,n=this.getDataset(),i=(d,h,f,p)=>d==="x"?h:d==="r"?p:f,o=s.xAxisID=ee(n.xAxisID,Dn(e,"x")),a=s.yAxisID=ee(n.yAxisID,Dn(e,"y")),r=s.rAxisID=ee(n.rAxisID,Dn(e,"r")),l=s.indexAxis,c=s.iAxisID=i(l,o,a,r),u=s.vAxisID=i(l,a,o,r);s.xScale=this.getScaleForId(o),s.yScale=this.getScaleForId(a),s.rScale=this.getScaleForId(r),s.iScale=this.getScaleForId(c),s.vScale=this.getScaleForId(u)}getDataset(){return this.chart.data.datasets[this.index]}getMeta(){return this.chart.getDatasetMeta(this.index)}getScaleForId(e){return this.chart.scales[e]}_getOtherScale(e){const s=this._cachedMeta;return e===s.iScale?s.vScale:s.iScale}reset(){this._update("reset")}_destroy(){const e=this._cachedMeta;this._data&&ro(this._data,this),e._stacked&&qt(e)}_dataCheck(){const e=this.getDataset(),s=e.data||(e.data=[]),n=this._data;if(oe(s)){const i=this._cachedMeta;this._data=Vp(s,i)}else if(n!==s){if(n){ro(n,this);const i=this._cachedMeta;qt(i),i._parsed=[]}s&&Object.isExtensible(s)&&yf(s,this),this._syncList=[],this._data=s}}addElements(){const e=this._cachedMeta;this._dataCheck(),this.datasetElementType&&(e.dataset=new this.datasetElementType)}buildOrUpdateElements(e){const s=this._cachedMeta,n=this.getDataset();let i=!1;this._dataCheck();const o=s._stacked;s._stacked=Pn(s.vScale,s),s.stack!==n.stack&&(i=!0,qt(s),s.stack=n.stack),this._resyncElements(e),(i||o!==s._stacked)&&(Po(this,s._parsed),s._stacked=Pn(s.vScale,s))}configure(){const e=this.chart.config,s=e.datasetScopeKeys(this._type),n=e.getOptionScopes(this.getDataset(),s,!0);this.options=e.createResolver(n,this.getContext()),this._parsing=this.options.parsing,this._cachedDataOpts={}}parse(e,s){const{_cachedMeta:n,_data:i}=this,{iScale:o,_stacked:a}=n,r=o.axis;let l=e===0&&s===i.length?!0:n._sorted,c=e>0&&n._parsed[e-1],u,d,h;if(this._parsing===!1)n._parsed=i,n._sorted=!0,h=i;else{xe(i[e])?h=this.parseArrayData(n,i,e,s):oe(i[e])?h=this.parseObjectData(n,i,e,s):h=this.parsePrimitiveData(n,i,e,s);const f=()=>d[r]===null||c&&d[r]<c[r];for(u=0;u<s;++u)n._parsed[u+e]=d=h[u],l&&(f()&&(l=!1),c=d);n._sorted=l}a&&Po(this,h)}parsePrimitiveData(e,s,n,i){const{iScale:o,vScale:a}=e,r=o.axis,l=a.axis,c=o.getLabels(),u=o===a,d=new Array(i);let h,f,p;for(h=0,f=i;h<f;++h)p=h+n,d[h]={[r]:u||o.parse(c[p],p),[l]:a.parse(s[p],p)};return d}parseArrayData(e,s,n,i){const{xScale:o,yScale:a}=e,r=new Array(i);let l,c,u,d;for(l=0,c=i;l<c;++l)u=l+n,d=s[u],r[l]={x:o.parse(d[0],u),y:a.parse(d[1],u)};return r}parseObjectData(e,s,n,i){const{xScale:o,yScale:a}=e,{xAxisKey:r="x",yAxisKey:l="y"}=this._parsing,c=new Array(i);let u,d,h,f;for(u=0,d=i;u<d;++u)h=u+n,f=s[h],c[u]={x:o.parse(_s(f,r),h),y:a.parse(_s(f,l),h)};return c}getParsed(e){return this._cachedMeta._parsed[e]}getDataElement(e){return this._cachedMeta.data[e]}applyStack(e,s,n){const i=this.chart,o=this._cachedMeta,a=s[e.axis],r={keys:dr(i,!0),values:s._stacks[e.axis]._visualValues};return ko(r,a,o.index,{mode:n})}updateRangeFromParsed(e,s,n,i){const o=n[s.axis];let a=o===null?NaN:o;const r=i&&n._stacks[s.axis];i&&r&&(i.values=r,a=ko(i,o,this._cachedMeta.index)),e.min=Math.min(e.min,a),e.max=Math.max(e.max,a)}getMinMax(e,s){const n=this._cachedMeta,i=n._parsed,o=n._sorted&&e===n.iScale,a=i.length,r=this._getOtherScale(e),l=Hp(s,n,this.chart),c={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY},{min:u,max:d}=zp(r);let h,f;function p(){f=i[h];const g=f[r.axis];return!Ne(f[e.axis])||u>g||d<g}for(h=0;h<a&&!(!p()&&(this.updateRangeFromParsed(c,e,f,l),o));++h);if(o){for(h=a-1;h>=0;--h)if(!p()){this.updateRangeFromParsed(c,e,f,l);break}}return c}getAllParsedValues(e){const s=this._cachedMeta._parsed,n=[];let i,o,a;for(i=0,o=s.length;i<o;++i)a=s[i][e.axis],Ne(a)&&n.push(a);return n}getMaxOverflow(){return!1}getLabelAndValue(e){const s=this._cachedMeta,n=s.iScale,i=s.vScale,o=this.getParsed(e);return{label:n?""+n.getLabelForValue(o[n.axis]):"",value:i?""+i.getLabelForValue(o[i.axis]):""}}_update(e){const s=this._cachedMeta;this.update(e||"default"),s._clip=Fp(ee(this.options.clip,Ip(s.xScale,s.yScale,this.getMaxOverflow())))}update(e){}draw(){const e=this._ctx,s=this.chart,n=this._cachedMeta,i=n.data||[],o=s.chartArea,a=[],r=this._drawStart||0,l=this._drawCount||i.length-r,c=this.options.drawActiveElementsOnTop;let u;for(n.dataset&&n.dataset.draw(e,o,r,l),u=r;u<r+l;++u){const d=i[u];d.hidden||(d.active&&c?a.push(d):d.draw(e,o))}for(u=0;u<a.length;++u)a[u].draw(e,o)}getStyle(e,s){const n=s?"active":"default";return e===void 0&&this._cachedMeta.dataset?this.resolveDatasetElementOptions(n):this.resolveDataElementOptions(e||0,n)}getContext(e,s,n){const i=this.getDataset();let o;if(e>=0&&e<this._cachedMeta.data.length){const a=this._cachedMeta.data[e];o=a.$context||(a.$context=Up(this.getContext(),e,a)),o.parsed=this.getParsed(e),o.raw=i.data[e],o.index=o.dataIndex=e}else o=this.$context||(this.$context=Np(this.chart.getContext(),this.index)),o.dataset=i,o.index=o.datasetIndex=this.index;return o.active=!!s,o.mode=n,o}resolveDatasetElementOptions(e){return this._resolveElementOptions(this.datasetElementType.id,e)}resolveDataElementOptions(e,s){return this._resolveElementOptions(this.dataElementType.id,s,e)}_resolveElementOptions(e,s="default",n){const i=s==="active",o=this._cachedDataOpts,a=e+"-"+s,r=o[a],l=this.enableOptionSharing&&Qs(n);if(r)return Do(r,l);const c=this.chart.config,u=c.datasetElementScopeKeys(this._type,e),d=i?[`${e}Hover`,"hover",e,""]:[e,""],h=c.getOptionScopes(this.getDataset(),u),f=Object.keys(me.elements[e]),p=()=>this.getContext(n,i,s),g=c.resolveNamedOptions(h,f,p,d);return g.$shared&&(g.$shared=l,o[a]=Object.freeze(Do(g,l))),g}_resolveAnimations(e,s,n){const i=this.chart,o=this._cachedDataOpts,a=`animation-${s}`,r=o[a];if(r)return r;let l;if(i.options.animation!==!1){const u=this.chart.config,d=u.datasetAnimationScopeKeys(this._type,s),h=u.getOptionScopes(this.getDataset(),d);l=u.createResolver(h,this.getContext(e,n,s))}const c=new ur(i,l&&l.animations);return l&&l._cacheable&&(o[a]=Object.freeze(c)),c}getSharedOptions(e){if(e.$shared)return this._sharedOptions||(this._sharedOptions=Object.assign({},e))}includeOptions(e,s){return!s||Rn(e)||this.chart._animationsDisabled}_getSharedOptions(e,s){const n=this.resolveDataElementOptions(e,s),i=this._sharedOptions,o=this.getSharedOptions(n),a=this.includeOptions(s,o)||o!==i;return this.updateSharedOptions(o,s,n),{sharedOptions:o,includeOptions:a}}updateElement(e,s,n,i){Rn(i)?Object.assign(e,n):this._resolveAnimations(s,i).update(e,n)}updateSharedOptions(e,s,n){e&&!Rn(s)&&this._resolveAnimations(void 0,s).update(e,n)}_setStyle(e,s,n,i){e.active=i;const o=this.getStyle(s,i);this._resolveAnimations(s,n,i).update(e,{options:!i&&this.getSharedOptions(o)||o})}removeHoverStyle(e,s,n){this._setStyle(e,n,"active",!1)}setHoverStyle(e,s,n){this._setStyle(e,n,"active",!0)}_removeDatasetHoverStyle(){const e=this._cachedMeta.dataset;e&&this._setStyle(e,void 0,"active",!1)}_setDatasetHoverStyle(){const e=this._cachedMeta.dataset;e&&this._setStyle(e,void 0,"active",!0)}_resyncElements(e){const s=this._data,n=this._cachedMeta.data;for(const[r,l,c]of this._syncList)this[r](l,c);this._syncList=[];const i=n.length,o=s.length,a=Math.min(o,i);a&&this.parse(0,a),o>i?this._insertElements(i,o-i,e):o<i&&this._removeElements(o,i-o)}_insertElements(e,s,n=!0){const i=this._cachedMeta,o=i.data,a=e+s;let r;const l=c=>{for(c.length+=s,r=c.length-1;r>=a;r--)c[r]=c[r-s]};for(l(o),r=e;r<a;++r)o[r]=new this.dataElementType;this._parsing&&l(i._parsed),this.parse(e,s),n&&this.updateElements(o,e,s,"reset")}updateElements(e,s,n,i){}_removeElements(e,s){const n=this._cachedMeta;if(this._parsing){const i=n._parsed.splice(e,s);n._stacked&&qt(n,i)}n.data.splice(e,s)}_sync(e){if(this._parsing)this._syncList.push(e);else{const[s,n,i]=e;this[s](n,i)}this.chart._dataChanges.push([this.index,...e])}_onDataPush(){const e=arguments.length;this._sync(["_insertElements",this.getDataset().data.length-e,e])}_onDataPop(){this._sync(["_removeElements",this._cachedMeta.data.length-1,1])}_onDataShift(){this._sync(["_removeElements",0,1])}_onDataSplice(e,s){s&&this._sync(["_removeElements",e,s]);const n=arguments.length-2;n&&this._sync(["_insertElements",e,n])}_onDataUnshift(){this._sync(["_insertElements",0,arguments.length])}}U(It,"defaults",{}),U(It,"datasetElementType",null),U(It,"dataElementType",null);function jp(t,e,s){let n=1,i=1,o=0,a=0;if(e<pe){const r=t,l=r+e,c=Math.cos(r),u=Math.sin(r),d=Math.cos(l),h=Math.sin(l),f=(k,P,C)=>bs(k,r,l,!0)?1:Math.max(P,P*s,C,C*s),p=(k,P,C)=>bs(k,r,l,!0)?-1:Math.min(P,P*s,C,C*s),g=f(0,c,d),m=f(be,u,h),y=p(ge,c,d),b=p(ge+be,u,h);n=(g-y)/2,i=(m-b)/2,o=-(g+y)/2,a=-(m+b)/2}return{ratioX:n,ratioY:i,offsetX:o,offsetY:a}}class Jt extends It{constructor(e,s){super(e,s),this.enableOptionSharing=!0,this.innerRadius=void 0,this.outerRadius=void 0,this.offsetX=void 0,this.offsetY=void 0}linkScales(){}parse(e,s){const n=this.getDataset().data,i=this._cachedMeta;if(this._parsing===!1)i._parsed=n;else{let o=l=>+n[l];if(oe(n[e])){const{key:l="value"}=this._parsing;o=c=>+_s(n[c],l)}let a,r;for(a=e,r=e+s;a<r;++a)i._parsed[a]=o(a)}}_getRotation(){return it(this.options.rotation-90)}_getCircumference(){return it(this.options.circumference)}_getRotationExtents(){let e=pe,s=-pe;for(let n=0;n<this.chart.data.datasets.length;++n)if(this.chart.isDatasetVisible(n)&&this.chart.getDatasetMeta(n).type===this._type){const i=this.chart.getDatasetMeta(n).controller,o=i._getRotation(),a=i._getCircumference();e=Math.min(e,o),s=Math.max(s,o+a)}return{rotation:e,circumference:s-e}}update(e){const s=this.chart,{chartArea:n}=s,i=this._cachedMeta,o=i.data,a=this.getMaxBorderWidth()+this.getMaxOffset(o)+this.options.spacing,r=Math.max((Math.min(n.width,n.height)-a)/2,0),l=Math.min(sf(this.options.cutout,r),1),c=this._getRingWeight(this.index),{circumference:u,rotation:d}=this._getRotationExtents(),{ratioX:h,ratioY:f,offsetX:p,offsetY:g}=jp(d,u,l),m=(n.width-a)/h,y=(n.height-a)/f,b=Math.max(Math.min(m,y)/2,0),k=qa(this.options.radius,b),P=Math.max(k*l,0),C=(k-P)/this._getVisibleDatasetWeightTotal();this.offsetX=p*k,this.offsetY=g*k,i.total=this.calculateTotal(),this.outerRadius=k-C*this._getRingWeightOffset(this.index),this.innerRadius=Math.max(this.outerRadius-C*c,0),this.updateElements(o,0,o.length,e)}_circumference(e,s){const n=this.options,i=this._cachedMeta,o=this._getCircumference();return s&&n.animation.animateRotate||!this.chart.getDataVisibility(e)||i._parsed[e]===null||i.data[e].hidden?0:this.calculateCircumference(i._parsed[e]*o/pe)}updateElements(e,s,n,i){const o=i==="reset",a=this.chart,r=a.chartArea,c=a.options.animation,u=(r.left+r.right)/2,d=(r.top+r.bottom)/2,h=o&&c.animateScale,f=h?0:this.innerRadius,p=h?0:this.outerRadius,{sharedOptions:g,includeOptions:m}=this._getSharedOptions(s,i);let y=this._getRotation(),b;for(b=0;b<s;++b)y+=this._circumference(b,o);for(b=s;b<s+n;++b){const k=this._circumference(b,o),P=e[b],C={x:u+this.offsetX,y:d+this.offsetY,startAngle:y,endAngle:y+k,circumference:k,outerRadius:p,innerRadius:f};m&&(C.options=g||this.resolveDataElementOptions(b,P.active?"active":i)),y+=k,this.updateElement(P,b,C,i)}}calculateTotal(){const e=this._cachedMeta,s=e.data;let n=0,i;for(i=0;i<s.length;i++){const o=e._parsed[i];o!==null&&!isNaN(o)&&this.chart.getDataVisibility(i)&&!s[i].hidden&&(n+=Math.abs(o))}return n}calculateCircumference(e){const s=this._cachedMeta.total;return s>0&&!isNaN(e)?pe*(Math.abs(e)/s):0}getLabelAndValue(e){const s=this._cachedMeta,n=this.chart,i=n.data.labels||[],o=bi(s._parsed[e],n.options.locale);return{label:i[e]||"",value:o}}getMaxBorderWidth(e){let s=0;const n=this.chart;let i,o,a,r,l;if(!e){for(i=0,o=n.data.datasets.length;i<o;++i)if(n.isDatasetVisible(i)){a=n.getDatasetMeta(i),e=a.data,r=a.controller;break}}if(!e)return 0;for(i=0,o=e.length;i<o;++i)l=r.resolveDataElementOptions(i),l.borderAlign!=="inner"&&(s=Math.max(s,l.borderWidth||0,l.hoverBorderWidth||0));return s}getMaxOffset(e){let s=0;for(let n=0,i=e.length;n<i;++n){const o=this.resolveDataElementOptions(n);s=Math.max(s,o.offset||0,o.hoverOffset||0)}return s}_getRingWeightOffset(e){let s=0;for(let n=0;n<e;++n)this.chart.isDatasetVisible(n)&&(s+=this._getRingWeight(n));return s}_getRingWeight(e){return Math.max(ee(this.chart.data.datasets[e].weight,1),0)}_getVisibleDatasetWeightTotal(){return this._getRingWeightOffset(this.chart.data.datasets.length)||1}}U(Jt,"id","doughnut"),U(Jt,"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"}),U(Jt,"descriptors",{_scriptable:e=>e!=="spacing",_indexable:e=>e!=="spacing"&&!e.startsWith("borderDash")&&!e.startsWith("hoverBorderDash")}),U(Jt,"overrides",{aspectRatio:1,plugins:{legend:{labels:{generateLabels(e){const s=e.data;if(s.labels.length&&s.datasets.length){const{labels:{pointStyle:n,color:i}}=e.legend.options;return s.labels.map((o,a)=>{const l=e.getDatasetMeta(0).controller.getStyle(a);return{text:o,fillStyle:l.backgroundColor,strokeStyle:l.borderColor,fontColor:i,lineWidth:l.borderWidth,pointStyle:n,hidden:!e.getDataVisibility(a),index:a}})}return[]}},onClick(e,s,n){n.chart.toggleDataVisibility(s.index),n.chart.update()}}}});class Us extends It{initialize(){this.enableOptionSharing=!0,this.supportsDecimation=!0,super.initialize()}update(e){const s=this._cachedMeta,{dataset:n,data:i=[],_dataset:o}=s,a=this.chart._animationsDisabled;let{start:r,count:l}=kf(s,i,a);this._drawStart=r,this._drawCount=l,Cf(s)&&(r=0,l=i.length),n._chart=this.chart,n._datasetIndex=this.index,n._decimated=!!o._decimated,n.points=i;const c=this.resolveDatasetElementOptions(e);this.options.showLine||(c.borderWidth=0),c.segment=this.options.segment,this.updateElement(n,void 0,{animated:!a,options:c},e),this.updateElements(i,r,l,e)}updateElements(e,s,n,i){const o=i==="reset",{iScale:a,vScale:r,_stacked:l,_dataset:c}=this._cachedMeta,{sharedOptions:u,includeOptions:d}=this._getSharedOptions(s,i),h=a.axis,f=r.axis,{spanGaps:p,segment:g}=this.options,m=vs(p)?p:Number.POSITIVE_INFINITY,y=this.chart._animationsDisabled||o||i==="none",b=s+n,k=e.length;let P=s>0&&this.getParsed(s-1);for(let C=0;C<k;++C){const O=e[C],R=y?O:{};if(C<s||C>=b){R.skip=!0;continue}const E=this.getParsed(C),z=de(E[f]),j=R[h]=a.getPixelForValue(E[h],C),G=R[f]=o||z?r.getBasePixel():r.getPixelForValue(l?this.applyStack(r,E,l):E[f],C);R.skip=isNaN(j)||isNaN(G)||z,R.stop=C>0&&Math.abs(E[h]-P[h])>m,g&&(R.parsed=E,R.raw=c.data[C]),d&&(R.options=u||this.resolveDataElementOptions(C,O.active?"active":i)),y||this.updateElement(O,C,R,i),P=E}}getMaxOverflow(){const e=this._cachedMeta,s=e.dataset,n=s.options&&s.options.borderWidth||0,i=e.data||[];if(!i.length)return n;const o=i[0].size(this.resolveDataElementOptions(0)),a=i[i.length-1].size(this.resolveDataElementOptions(i.length-1));return Math.max(n,o,a)/2}draw(){const e=this._cachedMeta;e.dataset.updateControlPoints(this.chart.chartArea,e.iScale.axis),super.draw()}}U(Us,"id","line"),U(Us,"defaults",{datasetElementType:"line",dataElementType:"point",showLine:!0,spanGaps:!1}),U(Us,"overrides",{scales:{_index_:{type:"category"},_value_:{type:"linear"}}});class Yn extends Jt{}U(Yn,"id","pie"),U(Yn,"defaults",{cutout:0,rotation:0,circumference:360,radius:"100%"});function vt(){throw new Error("This method is not implemented: Check that a complete date adapter is provided.")}class Ri{constructor(e){U(this,"options");this.options=e||{}}static override(e){Object.assign(Ri.prototype,e)}init(){}formats(){return vt()}parse(){return vt()}format(){return vt()}add(){return vt()}diff(){return vt()}startOf(){return vt()}endOf(){return vt()}}var Wp={_date:Ri};function Gp(t,e,s,n){const{controller:i,data:o,_sorted:a}=t,r=i._cachedMeta.iScale,l=t.dataset&&t.dataset.options?t.dataset.options.spanGaps:null;if(r&&e===r.axis&&e!=="r"&&a&&o.length){const c=r._reversePixels?vf:xt;if(n){if(i._sharedOptions){const u=o[0],d=typeof u.getRange=="function"&&u.getRange(e);if(d){const h=c(o,e,s-d),f=c(o,e,s+d);return{lo:h.lo,hi:f.hi}}}}else{const u=c(o,e,s);if(l){const{vScale:d}=i._cachedMeta,{_parsed:h}=t,f=h.slice(0,u.lo+1).reverse().findIndex(g=>!de(g[d.axis]));u.lo-=Math.max(0,f);const p=h.slice(u.hi).findIndex(g=>!de(g[d.axis]));u.hi+=Math.max(0,p)}return u}}return{lo:0,hi:o.length-1}}function un(t,e,s,n,i){const o=t.getSortedVisibleDatasetMetas(),a=s[e];for(let r=0,l=o.length;r<l;++r){const{index:c,data:u}=o[r],{lo:d,hi:h}=Gp(o[r],e,a,i);for(let f=d;f<=h;++f){const p=u[f];p.skip||n(p,c,f)}}}function qp(t){const e=t.indexOf("x")!==-1,s=t.indexOf("y")!==-1;return function(n,i){const o=e?Math.abs(n.x-i.x):0,a=s?Math.abs(n.y-i.y):0;return Math.sqrt(Math.pow(o,2)+Math.pow(a,2))}}function Mn(t,e,s,n,i){const o=[];return!i&&!t.isPointInArea(e)||un(t,s,e,function(r,l,c){!i&&!ys(r,t.chartArea,0)||r.inRange(e.x,e.y,n)&&o.push({element:r,datasetIndex:l,index:c})},!0),o}function Yp(t,e,s,n){let i=[];function o(a,r,l){const{startAngle:c,endAngle:u}=a.getProps(["startAngle","endAngle"],n),{angle:d}=Ka(a,{x:e.x,y:e.y});bs(d,c,u)&&i.push({element:a,datasetIndex:r,index:l})}return un(t,s,e,o),i}function Xp(t,e,s,n,i,o){let a=[];const r=qp(s);let l=Number.POSITIVE_INFINITY;function c(u,d,h){const f=u.inRange(e.x,e.y,i);if(n&&!f)return;const p=u.getCenterPoint(i);if(!(!!o||t.isPointInArea(p))&&!f)return;const m=r(e,p);m<l?(a=[{element:u,datasetIndex:d,index:h}],l=m):m===l&&a.push({element:u,datasetIndex:d,index:h})}return un(t,s,e,c),a}function An(t,e,s,n,i,o){return!o&&!t.isPointInArea(e)?[]:s==="r"&&!n?Yp(t,e,s,i):Xp(t,e,s,n,i,o)}function Ro(t,e,s,n,i){const o=[],a=s==="x"?"inXRange":"inYRange";let r=!1;return un(t,s,e,(l,c,u)=>{l[a]&&l[a](e[s],i)&&(o.push({element:l,datasetIndex:c,index:u}),r=r||l.inRange(e.x,e.y,i))}),n&&!r?[]:o}var Kp={modes:{index(t,e,s,n){const i=bt(e,t),o=s.axis||"x",a=s.includeInvisible||!1,r=s.intersect?Mn(t,i,o,n,a):An(t,i,o,!1,n,a),l=[];return r.length?(t.getSortedVisibleDatasetMetas().forEach(c=>{const u=r[0].index,d=c.data[u];d&&!d.skip&&l.push({element:d,datasetIndex:c.index,index:u})}),l):[]},dataset(t,e,s,n){const i=bt(e,t),o=s.axis||"xy",a=s.includeInvisible||!1;let r=s.intersect?Mn(t,i,o,n,a):An(t,i,o,!1,n,a);if(r.length>0){const l=r[0].datasetIndex,c=t.getDatasetMeta(l).data;r=[];for(let u=0;u<c.length;++u)r.push({element:c[u],datasetIndex:l,index:u})}return r},point(t,e,s,n){const i=bt(e,t),o=s.axis||"xy",a=s.includeInvisible||!1;return Mn(t,i,o,n,a)},nearest(t,e,s,n){const i=bt(e,t),o=s.axis||"xy",a=s.includeInvisible||!1;return An(t,i,o,s.intersect,n,a)},x(t,e,s,n){const i=bt(e,t);return Ro(t,i,"x",s.intersect,n)},y(t,e,s,n){const i=bt(e,t);return Ro(t,i,"y",s.intersect,n)}}};const hr=["left","top","right","bottom"];function Yt(t,e){return t.filter(s=>s.pos===e)}function Mo(t,e){return t.filter(s=>hr.indexOf(s.pos)===-1&&s.box.axis===e)}function Xt(t,e){return t.sort((s,n)=>{const i=e?n:s,o=e?s:n;return i.weight===o.weight?i.index-o.index:i.weight-o.weight})}function Qp(t){const e=[];let s,n,i,o,a,r;for(s=0,n=(t||[]).length;s<n;++s)i=t[s],{position:o,options:{stack:a,stackWeight:r=1}}=i,e.push({index:s,box:i,pos:o,horizontal:i.isHorizontal(),weight:i.weight,stack:a&&o+a,stackWeight:r});return e}function Zp(t){const e={};for(const s of t){const{stack:n,pos:i,stackWeight:o}=s;if(!n||!hr.includes(i))continue;const a=e[n]||(e[n]={count:0,placed:0,weight:0,size:0});a.count++,a.weight+=o}return e}function Jp(t,e){const s=Zp(t),{vBoxMaxWidth:n,hBoxMaxHeight:i}=e;let o,a,r;for(o=0,a=t.length;o<a;++o){r=t[o];const{fullSize:l}=r.box,c=s[r.stack],u=c&&r.stackWeight/c.weight;r.horizontal?(r.width=u?u*n:l&&e.availableWidth,r.height=i):(r.width=n,r.height=u?u*i:l&&e.availableHeight)}return s}function eg(t){const e=Qp(t),s=Xt(e.filter(c=>c.box.fullSize),!0),n=Xt(Yt(e,"left"),!0),i=Xt(Yt(e,"right")),o=Xt(Yt(e,"top"),!0),a=Xt(Yt(e,"bottom")),r=Mo(e,"x"),l=Mo(e,"y");return{fullSize:s,leftAndTop:n.concat(o),rightAndBottom:i.concat(l).concat(a).concat(r),chartArea:Yt(e,"chartArea"),vertical:n.concat(i).concat(l),horizontal:o.concat(a).concat(r)}}function Ao(t,e,s,n){return Math.max(t[s],e[s])+Math.max(t[n],e[n])}function fr(t,e){t.top=Math.max(t.top,e.top),t.left=Math.max(t.left,e.left),t.bottom=Math.max(t.bottom,e.bottom),t.right=Math.max(t.right,e.right)}function tg(t,e,s,n){const{pos:i,box:o}=s,a=t.maxPadding;if(!oe(i)){s.size&&(t[i]-=s.size);const d=n[s.stack]||{size:0,count:1};d.size=Math.max(d.size,s.horizontal?o.height:o.width),s.size=d.size/d.count,t[i]+=s.size}o.getPadding&&fr(a,o.getPadding());const r=Math.max(0,e.outerWidth-Ao(a,t,"left","right")),l=Math.max(0,e.outerHeight-Ao(a,t,"top","bottom")),c=r!==t.w,u=l!==t.h;return t.w=r,t.h=l,s.horizontal?{same:c,other:u}:{same:u,other:c}}function sg(t){const e=t.maxPadding;function s(n){const i=Math.max(e[n]-t[n],0);return t[n]+=i,i}t.y+=s("top"),t.x+=s("left"),s("right"),s("bottom")}function ng(t,e){const s=e.maxPadding;function n(i){const o={left:0,top:0,right:0,bottom:0};return i.forEach(a=>{o[a]=Math.max(e[a],s[a])}),o}return n(t?["left","right"]:["top","bottom"])}function es(t,e,s,n){const i=[];let o,a,r,l,c,u;for(o=0,a=t.length,c=0;o<a;++o){r=t[o],l=r.box,l.update(r.width||e.w,r.height||e.h,ng(r.horizontal,e));const{same:d,other:h}=tg(e,s,r,n);c|=d&&i.length,u=u||h,l.fullSize||i.push(r)}return c&&es(i,e,s,n)||u}function Is(t,e,s,n,i){t.top=s,t.left=e,t.right=e+n,t.bottom=s+i,t.width=n,t.height=i}function To(t,e,s,n){const i=s.padding;let{x:o,y:a}=e;for(const r of t){const l=r.box,c=n[r.stack]||{placed:0,weight:1},u=r.stackWeight/c.weight||1;if(r.horizontal){const d=e.w*u,h=c.size||l.height;Qs(c.start)&&(a=c.start),l.fullSize?Is(l,i.left,a,s.outerWidth-i.right-i.left,h):Is(l,e.left+c.placed,a,d,h),c.start=a,c.placed+=d,a=l.bottom}else{const d=e.h*u,h=c.size||l.width;Qs(c.start)&&(o=c.start),l.fullSize?Is(l,o,i.top,h,s.outerHeight-i.bottom-i.top):Is(l,o,e.top+c.placed,h,d),c.start=o,c.placed+=d,o=l.right}}e.x=o,e.y=a}var Be={addBox(t,e){t.boxes||(t.boxes=[]),e.fullSize=e.fullSize||!1,e.position=e.position||"top",e.weight=e.weight||0,e._layers=e._layers||function(){return[{z:0,draw(s){e.draw(s)}}]},t.boxes.push(e)},removeBox(t,e){const s=t.boxes?t.boxes.indexOf(e):-1;s!==-1&&t.boxes.splice(s,1)},configure(t,e,s){e.fullSize=s.fullSize,e.position=s.position,e.weight=s.weight},update(t,e,s,n){if(!t)return;const i=Ue(t.options.layout.padding),o=Math.max(e-i.width,0),a=Math.max(s-i.height,0),r=eg(t.boxes),l=r.vertical,c=r.horizontal;re(t.boxes,g=>{typeof g.beforeLayout=="function"&&g.beforeLayout()});const u=l.reduce((g,m)=>m.box.options&&m.box.options.display===!1?g:g+1,0)||1,d=Object.freeze({outerWidth:e,outerHeight:s,padding:i,availableWidth:o,availableHeight:a,vBoxMaxWidth:o/2/u,hBoxMaxHeight:a/2}),h=Object.assign({},i);fr(h,Ue(n));const f=Object.assign({maxPadding:h,w:o,h:a,x:i.left,y:i.top},i),p=Jp(l.concat(c),d);es(r.fullSize,f,d,p),es(l,f,d,p),es(c,f,d,p)&&es(l,f,d,p),sg(f),To(r.leftAndTop,f,d,p),f.x+=f.w,f.y+=f.h,To(r.rightAndBottom,f,d,p),t.chartArea={left:f.left,top:f.top,right:f.left+f.w,bottom:f.top+f.h,height:f.h,width:f.w},re(r.chartArea,g=>{const m=g.box;Object.assign(m,t.chartArea),m.update(f.w,f.h,{left:0,top:0,right:0,bottom:0})})}};class pr{acquireContext(e,s){}releaseContext(e){return!1}addEventListener(e,s,n){}removeEventListener(e,s,n){}getDevicePixelRatio(){return 1}getMaximumSize(e,s,n,i){return s=Math.max(0,s||e.width),n=n||e.height,{width:s,height:Math.max(0,i?Math.floor(s/i):n)}}isAttached(e){return!0}updateConfig(e){}}class ig extends pr{acquireContext(e){return e&&e.getContext&&e.getContext("2d")||null}updateConfig(e){e.options.animation=!1}}const Hs="$chartjs",og={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},Eo=t=>t===null||t==="";function ag(t,e){const s=t.style,n=t.getAttribute("height"),i=t.getAttribute("width");if(t[Hs]={initial:{height:n,width:i,style:{display:s.display,height:s.height,width:s.width}}},s.display=s.display||"block",s.boxSizing=s.boxSizing||"border-box",Eo(i)){const o=vo(t,"width");o!==void 0&&(t.width=o)}if(Eo(n))if(t.style.height==="")t.height=t.width/(e||2);else{const o=vo(t,"height");o!==void 0&&(t.height=o)}return t}const gr=gp?{passive:!0}:!1;function rg(t,e,s){t&&t.addEventListener(e,s,gr)}function lg(t,e,s){t&&t.canvas&&t.canvas.removeEventListener(e,s,gr)}function cg(t,e){const s=og[t.type]||t.type,{x:n,y:i}=bt(t,e);return{type:s,chart:e,native:t,x:n!==void 0?n:null,y:i!==void 0?i:null}}function en(t,e){for(const s of t)if(s===e||s.contains(e))return!0}function ug(t,e,s){const n=t.canvas,i=new MutationObserver(o=>{let a=!1;for(const r of o)a=a||en(r.addedNodes,n),a=a&&!en(r.removedNodes,n);a&&s()});return i.observe(document,{childList:!0,subtree:!0}),i}function dg(t,e,s){const n=t.canvas,i=new MutationObserver(o=>{let a=!1;for(const r of o)a=a||en(r.removedNodes,n),a=a&&!en(r.addedNodes,n);a&&s()});return i.observe(document,{childList:!0,subtree:!0}),i}const ws=new Map;let Lo=0;function mr(){const t=window.devicePixelRatio;t!==Lo&&(Lo=t,ws.forEach((e,s)=>{s.currentDevicePixelRatio!==t&&e()}))}function hg(t,e){ws.size||window.addEventListener("resize",mr),ws.set(t,e)}function fg(t){ws.delete(t),ws.size||window.removeEventListener("resize",mr)}function pg(t,e,s){const n=t.canvas,i=n&&Di(n);if(!i)return;const o=Ja((r,l)=>{const c=i.clientWidth;s(r,l),c<i.clientWidth&&s()},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(i),hg(t,o),a}function Tn(t,e,s){s&&s.disconnect(),e==="resize"&&fg(t)}function gg(t,e,s){const n=t.canvas,i=Ja(o=>{t.ctx!==null&&s(cg(o,t))},t);return rg(n,e,i),i}class mg extends pr{acquireContext(e,s){const n=e&&e.getContext&&e.getContext("2d");return n&&n.canvas===e?(ag(e,s),n):null}releaseContext(e){const s=e.canvas;if(!s[Hs])return!1;const n=s[Hs].initial;["height","width"].forEach(o=>{const a=n[o];de(a)?s.removeAttribute(o):s.setAttribute(o,a)});const i=n.style||{};return Object.keys(i).forEach(o=>{s.style[o]=i[o]}),s.width=s.width,delete s[Hs],!0}addEventListener(e,s,n){this.removeEventListener(e,s);const i=e.$proxies||(e.$proxies={}),a={attach:ug,detach:dg,resize:pg}[s]||gg;i[s]=a(e,s,n)}removeEventListener(e,s){const n=e.$proxies||(e.$proxies={}),i=n[s];if(!i)return;({attach:Tn,detach:Tn,resize:Tn}[s]||lg)(e,s,i),n[s]=void 0}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(e,s,n,i){return pp(e,s,n,i)}isAttached(e){const s=e&&Di(e);return!!(s&&s.isConnected)}}function _g(t){return!Pi()||typeof OffscreenCanvas<"u"&&t instanceof OffscreenCanvas?ig:mg}class Qe{constructor(){U(this,"x");U(this,"y");U(this,"active",!1);U(this,"options");U(this,"$animations")}tooltipPosition(e){const{x:s,y:n}=this.getProps(["x","y"],e);return{x:s,y:n}}hasValue(){return vs(this.x)&&vs(this.y)}getProps(e,s){const n=this.$animations;if(!s||!n)return this;const i={};return e.forEach(o=>{i[o]=n[o]&&n[o].active()?n[o]._to:this[o]}),i}}U(Qe,"defaults",{}),U(Qe,"defaultRoutes");function vg(t,e){const s=t.options.ticks,n=bg(t),i=Math.min(s.maxTicksLimit||n,n),o=s.major.enabled?xg(e):[],a=o.length,r=o[0],l=o[a-1],c=[];if(a>i)return wg(e,c,o,a/i),c;const u=yg(o,e,i);if(a>0){let d,h;const f=a>1?Math.round((l-r)/(a-1)):null;for(Fs(e,c,u,de(f)?0:r-f,r),d=0,h=a-1;d<h;d++)Fs(e,c,u,o[d],o[d+1]);return Fs(e,c,u,l,de(f)?e.length:l+f),c}return Fs(e,c,u),c}function bg(t){const e=t.options.offset,s=t._tickSize(),n=t._length/s+(e?0:1),i=t._maxLength/s;return Math.floor(Math.min(n,i))}function yg(t,e,s){const n=Sg(t),i=e.length/s;if(!n)return Math.max(i,1);const o=df(n);for(let a=0,r=o.length-1;a<r;a++){const l=o[a];if(l>i)return l}return Math.max(i,1)}function xg(t){const e=[];let s,n;for(s=0,n=t.length;s<n;s++)t[s].major&&e.push(s);return e}function wg(t,e,s,n){let i=0,o=s[0],a;for(n=Math.ceil(n),a=0;a<t.length;a++)a===o&&(e.push(t[a]),i++,o=s[i*n])}function Fs(t,e,s,n,i){const o=ee(n,0),a=Math.min(ee(i,t.length),t.length);let r=0,l,c,u;for(s=Math.ceil(s),i&&(l=i-n,s=l/Math.floor(l/s)),u=o;u<0;)r++,u=Math.round(o+r*s);for(c=Math.max(o,0);c<a;c++)c===u&&(e.push(t[c]),r++,u=Math.round(o+r*s))}function Sg(t){const e=t.length;let s,n;if(e<2)return!1;for(n=t[0],s=1;s<e;++s)if(t[s]-t[s-1]!==n)return!1;return n}const kg=t=>t==="left"?"right":t==="right"?"left":t,Oo=(t,e,s)=>e==="top"||e==="left"?t[e]+s:t[e]-s,Io=(t,e)=>Math.min(e||t,t);function Fo(t,e){const s=[],n=t.length/e,i=t.length;let o=0;for(;o<i;o+=n)s.push(t[Math.floor(o)]);return s}function Cg(t,e,s){const n=t.ticks.length,i=Math.min(e,n-1),o=t._startPixel,a=t._endPixel,r=1e-6;let l=t.getPixelForTick(i),c;if(!(s&&(n===1?c=Math.max(l-o,a-l):e===0?c=(t.getPixelForTick(1)-l)/2:c=(l-t.getPixelForTick(i-1))/2,l+=i<e?c:-c,l<o-r||l>a+r)))return l}function Pg(t,e){re(t,s=>{const n=s.gc,i=n.length/2;let o;if(i>e){for(o=0;o<i;++o)delete s.data[n[o]];n.splice(0,i)}})}function Kt(t){return t.drawTicks?t.tickLength:0}function Vo(t,e){if(!t.display)return 0;const s=De(t.font,e),n=Ue(t.padding);return(xe(t.text)?t.text.length:1)*s.lineHeight+n.height}function Dg(t,e){return Ct(t,{scale:e,type:"scale"})}function Rg(t,e,s){return Ct(t,{tick:s,index:e,type:"tick"})}function Mg(t,e,s){let n=_i(t);return(s&&e!=="right"||!s&&e==="right")&&(n=kg(n)),n}function Ag(t,e,s,n){const{top:i,left:o,bottom:a,right:r,chart:l}=t,{chartArea:c,scales:u}=l;let d=0,h,f,p;const g=a-i,m=r-o;if(t.isHorizontal()){if(f=Pe(n,o,r),oe(s)){const y=Object.keys(s)[0],b=s[y];p=u[y].getPixelForValue(b)+g-e}else s==="center"?p=(c.bottom+c.top)/2+g-e:p=Oo(t,s,e);h=r-o}else{if(oe(s)){const y=Object.keys(s)[0],b=s[y];f=u[y].getPixelForValue(b)-m+e}else s==="center"?f=(c.left+c.right)/2-m+e:f=Oo(t,s,e);p=Pe(n,a,i),d=s==="left"?-be:be}return{titleX:f,titleY:p,maxWidth:h,rotation:d}}class jt extends Qe{constructor(e){super(),this.id=e.id,this.type=e.type,this.options=void 0,this.ctx=e.ctx,this.chart=e.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(e){this.options=e.setContext(this.getContext()),this.axis=e.axis,this._userMin=this.parse(e.min),this._userMax=this.parse(e.max),this._suggestedMin=this.parse(e.suggestedMin),this._suggestedMax=this.parse(e.suggestedMax)}parse(e,s){return e}getUserBounds(){let{_userMin:e,_userMax:s,_suggestedMin:n,_suggestedMax:i}=this;return e=Ye(e,Number.POSITIVE_INFINITY),s=Ye(s,Number.NEGATIVE_INFINITY),n=Ye(n,Number.POSITIVE_INFINITY),i=Ye(i,Number.NEGATIVE_INFINITY),{min:Ye(e,n),max:Ye(s,i),minDefined:Ne(e),maxDefined:Ne(s)}}getMinMax(e){let{min:s,max:n,minDefined:i,maxDefined:o}=this.getUserBounds(),a;if(i&&o)return{min:s,max:n};const r=this.getMatchingVisibleMetas();for(let l=0,c=r.length;l<c;++l)a=r[l].controller.getMinMax(this,e),i||(s=Math.min(s,a.min)),o||(n=Math.max(n,a.max));return s=o&&s>n?n:s,n=i&&s>n?s:n,{min:Ye(s,Ye(n,s)),max:Ye(n,Ye(s,n))}}getPadding(){return{left:this.paddingLeft||0,top:this.paddingTop||0,right:this.paddingRight||0,bottom:this.paddingBottom||0}}getTicks(){return this.ticks}getLabels(){const e=this.chart.data;return this.options.labels||(this.isHorizontal()?e.xLabels:e.yLabels)||e.labels||[]}getLabelItems(e=this.chart.chartArea){return this._labelItems||(this._labelItems=this._computeLabelItems(e))}beforeLayout(){this._cache={},this._dataLimitsCached=!1}beforeUpdate(){fe(this.options.beforeUpdate,[this])}update(e,s,n){const{beginAtZero:i,grace:o,ticks:a}=this.options,r=a.sampleSize;this.beforeUpdate(),this.maxWidth=e,this.maxHeight=s,this._margins=n=Object.assign({left:0,right:0,top:0,bottom:0},n),this.ticks=null,this._labelSizes=null,this._gridLineItems=null,this._labelItems=null,this.beforeSetDimensions(),this.setDimensions(),this.afterSetDimensions(),this._maxLength=this.isHorizontal()?this.width+n.left+n.right:this.height+n.top+n.bottom,this._dataLimitsCached||(this.beforeDataLimits(),this.determineDataLimits(),this.afterDataLimits(),this._range=Gf(this,o,i),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();const l=r<this.ticks.length;this._convertTicksToLabels(l?Fo(this.ticks,r):this.ticks),this.configure(),this.beforeCalculateLabelRotation(),this.calculateLabelRotation(),this.afterCalculateLabelRotation(),a.display&&(a.autoSkip||a.source==="auto")&&(this.ticks=vg(this,this.ticks),this._labelSizes=null,this.afterAutoSkip()),l&&this._convertTicksToLabels(this.ticks),this.beforeFit(),this.fit(),this.afterFit(),this.afterUpdate()}configure(){let e=this.options.reverse,s,n;this.isHorizontal()?(s=this.left,n=this.right):(s=this.top,n=this.bottom,e=!e),this._startPixel=s,this._endPixel=n,this._reversePixels=e,this._length=n-s,this._alignToPixels=this.options.alignToPixels}afterUpdate(){fe(this.options.afterUpdate,[this])}beforeSetDimensions(){fe(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(){fe(this.options.afterSetDimensions,[this])}_callHooks(e){this.chart.notifyPlugins(e,this.getContext()),fe(this.options[e],[this])}beforeDataLimits(){this._callHooks("beforeDataLimits")}determineDataLimits(){}afterDataLimits(){this._callHooks("afterDataLimits")}beforeBuildTicks(){this._callHooks("beforeBuildTicks")}buildTicks(){return[]}afterBuildTicks(){this._callHooks("afterBuildTicks")}beforeTickToLabelConversion(){fe(this.options.beforeTickToLabelConversion,[this])}generateTickLabels(e){const s=this.options.ticks;let n,i,o;for(n=0,i=e.length;n<i;n++)o=e[n],o.label=fe(s.callback,[o.value,n,e],this)}afterTickToLabelConversion(){fe(this.options.afterTickToLabelConversion,[this])}beforeCalculateLabelRotation(){fe(this.options.beforeCalculateLabelRotation,[this])}calculateLabelRotation(){const e=this.options,s=e.ticks,n=Io(this.ticks.length,e.ticks.maxTicksLimit),i=s.minRotation||0,o=s.maxRotation;let a=i,r,l,c;if(!this._isVisible()||!s.display||i>=o||n<=1||!this.isHorizontal()){this.labelRotation=i;return}const u=this._getLabelSizes(),d=u.widest.width,h=u.highest.height,f=Re(this.chart.width-d,0,this.maxWidth);r=e.offset?this.maxWidth/n:f/(n-1),d+6>r&&(r=f/(n-(e.offset?.5:1)),l=this.maxHeight-Kt(e.grid)-s.padding-Vo(e.title,this.chart.options.font),c=Math.sqrt(d*d+h*h),a=gf(Math.min(Math.asin(Re((u.highest.height+6)/r,-1,1)),Math.asin(Re(l/c,-1,1))-Math.asin(Re(h/c,-1,1)))),a=Math.max(i,Math.min(o,a))),this.labelRotation=a}afterCalculateLabelRotation(){fe(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){fe(this.options.beforeFit,[this])}fit(){const e={width:0,height:0},{chart:s,options:{ticks:n,title:i,grid:o}}=this,a=this._isVisible(),r=this.isHorizontal();if(a){const l=Vo(i,s.options.font);if(r?(e.width=this.maxWidth,e.height=Kt(o)+l):(e.height=this.maxHeight,e.width=Kt(o)+l),n.display&&this.ticks.length){const{first:c,last:u,widest:d,highest:h}=this._getLabelSizes(),f=n.padding*2,p=it(this.labelRotation),g=Math.cos(p),m=Math.sin(p);if(r){const y=n.mirror?0:m*d.width+g*h.height;e.height=Math.min(this.maxHeight,e.height+y+f)}else{const y=n.mirror?0:g*d.width+m*h.height;e.width=Math.min(this.maxWidth,e.width+y+f)}this._calculatePadding(c,u,m,g)}}this._handleMargins(),r?(this.width=this._length=s.width-this._margins.left-this._margins.right,this.height=e.height):(this.width=e.width,this.height=this._length=s.height-this._margins.top-this._margins.bottom)}_calculatePadding(e,s,n,i){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,d=this.right-this.getPixelForTick(this.ticks.length-1);let h=0,f=0;l?c?(h=i*e.width,f=n*s.height):(h=n*e.height,f=i*s.width):o==="start"?f=s.width:o==="end"?h=e.width:o!=="inner"&&(h=e.width/2,f=s.width/2),this.paddingLeft=Math.max((h-u+a)*this.width/(this.width-u),0),this.paddingRight=Math.max((f-d+a)*this.width/(this.width-d),0)}else{let u=s.height/2,d=e.height/2;o==="start"?(u=0,d=e.height):o==="end"&&(u=s.height,d=0),this.paddingTop=u+a,this.paddingBottom=d+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(){fe(this.options.afterFit,[this])}isHorizontal(){const{axis:e,position:s}=this.options;return s==="top"||s==="bottom"||e==="x"}isFullSize(){return this.options.fullSize}_convertTicksToLabels(e){this.beforeTickToLabelConversion(),this.generateTickLabels(e);let s,n;for(s=0,n=e.length;s<n;s++)de(e[s].label)&&(e.splice(s,1),n--,s--);this.afterTickToLabelConversion()}_getLabelSizes(){let e=this._labelSizes;if(!e){const s=this.options.ticks.sampleSize;let n=this.ticks;s<n.length&&(n=Fo(n,s)),this._labelSizes=e=this._computeLabelSizes(n,n.length,this.options.ticks.maxTicksLimit)}return e}_computeLabelSizes(e,s,n){const{ctx:i,_longestTextCache:o}=this,a=[],r=[],l=Math.floor(s/Io(s,n));let c=0,u=0,d,h,f,p,g,m,y,b,k,P,C;for(d=0;d<s;d+=l){if(p=e[d].label,g=this._resolveTickFontOptions(d),i.font=m=g.string,y=o[m]=o[m]||{data:{},gc:[]},b=g.lineHeight,k=P=0,!de(p)&&!xe(p))k=fo(i,y.data,y.gc,k,p),P=b;else if(xe(p))for(h=0,f=p.length;h<f;++h)C=p[h],!de(C)&&!xe(C)&&(k=fo(i,y.data,y.gc,k,C),P+=b);a.push(k),r.push(P),c=Math.max(k,c),u=Math.max(P,u)}Pg(o,s);const O=a.indexOf(c),R=r.indexOf(u),E=z=>({width:a[z]||0,height:r[z]||0});return{first:E(0),last:E(s-1),widest:E(O),highest:E(R),widths:a,heights:r}}getLabelForValue(e){return e}getPixelForValue(e,s){return NaN}getValueForPixel(e){}getPixelForTick(e){const s=this.ticks;return e<0||e>s.length-1?null:this.getPixelForValue(s[e].value)}getPixelForDecimal(e){this._reversePixels&&(e=1-e);const s=this._startPixel+e*this._length;return _f(this._alignToPixels?_t(this.chart,s,0):s)}getDecimalForPixel(e){const s=(e-this._startPixel)/this._length;return this._reversePixels?1-s:s}getBasePixel(){return this.getPixelForValue(this.getBaseValue())}getBaseValue(){const{min:e,max:s}=this;return e<0&&s<0?s:e>0&&s>0?e:0}getContext(e){const s=this.ticks||[];if(e>=0&&e<s.length){const n=s[e];return n.$context||(n.$context=Rg(this.getContext(),e,n))}return this.$context||(this.$context=Dg(this.chart.getContext(),this))}_tickSize(){const e=this.options.ticks,s=it(this.labelRotation),n=Math.abs(Math.cos(s)),i=Math.abs(Math.sin(s)),o=this._getLabelSizes(),a=e.autoSkipPadding||0,r=o?o.widest.width+a:0,l=o?o.highest.height+a:0;return this.isHorizontal()?l*n>r*i?r/n:l/i:l*i<r*n?l/n:r/i}_isVisible(){const e=this.options.display;return e!=="auto"?!!e:this.getMatchingVisibleMetas().length>0}_computeGridLineItems(e){const s=this.axis,n=this.chart,i=this.options,{grid:o,position:a,border:r}=i,l=o.offset,c=this.isHorizontal(),d=this.ticks.length+(l?1:0),h=Kt(o),f=[],p=r.setContext(this.getContext()),g=p.display?p.width:0,m=g/2,y=function(Q){return _t(n,Q,g)};let b,k,P,C,O,R,E,z,j,G,L,F;if(a==="top")b=y(this.bottom),R=this.bottom-h,z=b-m,G=y(e.top)+m,F=e.bottom;else if(a==="bottom")b=y(this.top),G=e.top,F=y(e.bottom)-m,R=b+m,z=this.top+h;else if(a==="left")b=y(this.right),O=this.right-h,E=b-m,j=y(e.left)+m,L=e.right;else if(a==="right")b=y(this.left),j=e.left,L=y(e.right)-m,O=b+m,E=this.left+h;else if(s==="x"){if(a==="center")b=y((e.top+e.bottom)/2+.5);else if(oe(a)){const Q=Object.keys(a)[0],Z=a[Q];b=y(this.chart.scales[Q].getPixelForValue(Z))}G=e.top,F=e.bottom,R=b+m,z=R+h}else if(s==="y"){if(a==="center")b=y((e.left+e.right)/2);else if(oe(a)){const Q=Object.keys(a)[0],Z=a[Q];b=y(this.chart.scales[Q].getPixelForValue(Z))}O=b-m,E=O-h,j=e.left,L=e.right}const he=ee(i.ticks.maxTicksLimit,d),Y=Math.max(1,Math.ceil(d/he));for(k=0;k<d;k+=Y){const Q=this.getContext(k),Z=o.setContext(Q),ye=r.setContext(Q),ce=Z.lineWidth,Fe=Z.color,Ze=ye.dash||[],$e=ye.dashOffset,He=Z.tickWidth,Ae=Z.tickColor,qe=Z.tickBorderDash||[],W=Z.tickBorderDashOffset;P=Cg(this,k,l),P!==void 0&&(C=_t(n,P,ce),c?O=E=j=L=C:R=z=G=F=C,f.push({tx1:O,ty1:R,tx2:E,ty2:z,x1:j,y1:G,x2:L,y2:F,width:ce,color:Fe,borderDash:Ze,borderDashOffset:$e,tickWidth:He,tickColor:Ae,tickBorderDash:qe,tickBorderDashOffset:W}))}return this._ticksLength=d,this._borderValue=b,f}_computeLabelItems(e){const s=this.axis,n=this.options,{position:i,ticks:o}=n,a=this.isHorizontal(),r=this.ticks,{align:l,crossAlign:c,padding:u,mirror:d}=o,h=Kt(n.grid),f=h+u,p=d?-u:f,g=-it(this.labelRotation),m=[];let y,b,k,P,C,O,R,E,z,j,G,L,F="middle";if(i==="top")O=this.bottom-p,R=this._getXAxisLabelAlignment();else if(i==="bottom")O=this.top+p,R=this._getXAxisLabelAlignment();else if(i==="left"){const Y=this._getYAxisLabelAlignment(h);R=Y.textAlign,C=Y.x}else if(i==="right"){const Y=this._getYAxisLabelAlignment(h);R=Y.textAlign,C=Y.x}else if(s==="x"){if(i==="center")O=(e.top+e.bottom)/2+f;else if(oe(i)){const Y=Object.keys(i)[0],Q=i[Y];O=this.chart.scales[Y].getPixelForValue(Q)+f}R=this._getXAxisLabelAlignment()}else if(s==="y"){if(i==="center")C=(e.left+e.right)/2-f;else if(oe(i)){const Y=Object.keys(i)[0],Q=i[Y];C=this.chart.scales[Y].getPixelForValue(Q)}R=this._getYAxisLabelAlignment(h).textAlign}s==="y"&&(l==="start"?F="top":l==="end"&&(F="bottom"));const he=this._getLabelSizes();for(y=0,b=r.length;y<b;++y){k=r[y],P=k.label;const Y=o.setContext(this.getContext(y));E=this.getPixelForTick(y)+o.labelOffset,z=this._resolveTickFontOptions(y),j=z.lineHeight,G=xe(P)?P.length:1;const Q=G/2,Z=Y.color,ye=Y.textStrokeColor,ce=Y.textStrokeWidth;let Fe=R;a?(C=E,R==="inner"&&(y===b-1?Fe=this.options.reverse?"left":"right":y===0?Fe=this.options.reverse?"right":"left":Fe="center"),i==="top"?c==="near"||g!==0?L=-G*j+j/2:c==="center"?L=-he.highest.height/2-Q*j+j:L=-he.highest.height+j/2:c==="near"||g!==0?L=j/2:c==="center"?L=he.highest.height/2-Q*j:L=he.highest.height-G*j,d&&(L*=-1),g!==0&&!Y.showLabelBackdrop&&(C+=j/2*Math.sin(g))):(O=E,L=(1-G)*j/2);let Ze;if(Y.showLabelBackdrop){const $e=Ue(Y.backdropPadding),He=he.heights[y],Ae=he.widths[y];let qe=L-$e.top,W=0-$e.left;switch(F){case"middle":qe-=He/2;break;case"bottom":qe-=He;break}switch(R){case"center":W-=Ae/2;break;case"right":W-=Ae;break;case"inner":y===b-1?W-=Ae:y>0&&(W-=Ae/2);break}Ze={left:W,top:qe,width:Ae+$e.width,height:He+$e.height,color:Y.backdropColor}}m.push({label:P,font:z,textOffset:L,options:{rotation:g,color:Z,strokeColor:ye,strokeWidth:ce,textAlign:Fe,textBaseline:F,translation:[C,O],backdrop:Ze}})}return m}_getXAxisLabelAlignment(){const{position:e,ticks:s}=this.options;if(-it(this.labelRotation))return e==="top"?"left":"right";let i="center";return s.align==="start"?i="left":s.align==="end"?i="right":s.align==="inner"&&(i="inner"),i}_getYAxisLabelAlignment(e){const{position:s,ticks:{crossAlign:n,mirror:i,padding:o}}=this.options,a=this._getLabelSizes(),r=e+o,l=a.widest.width;let c,u;return s==="left"?i?(u=this.right+o,n==="near"?c="left":n==="center"?(c="center",u+=l/2):(c="right",u+=l)):(u=this.right-r,n==="near"?c="right":n==="center"?(c="center",u-=l/2):(c="left",u=this.left)):s==="right"?i?(u=this.left+o,n==="near"?c="right":n==="center"?(c="center",u-=l/2):(c="left",u-=l)):(u=this.left+r,n==="near"?c="left":n==="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 e=this.chart,s=this.options.position;if(s==="left"||s==="right")return{top:0,left:this.left,bottom:e.height,right:this.right};if(s==="top"||s==="bottom")return{top:this.top,left:0,bottom:this.bottom,right:e.width}}drawBackground(){const{ctx:e,options:{backgroundColor:s},left:n,top:i,width:o,height:a}=this;s&&(e.save(),e.fillStyle=s,e.fillRect(n,i,o,a),e.restore())}getLineWidthForValue(e){const s=this.options.grid;if(!this._isVisible()||!s.display)return 0;const i=this.ticks.findIndex(o=>o.value===e);return i>=0?s.setContext(this.getContext(i)).lineWidth:0}drawGrid(e){const s=this.options.grid,n=this.ctx,i=this._gridLineItems||(this._gridLineItems=this._computeGridLineItems(e));let o,a;const r=(l,c,u)=>{!u.width||!u.color||(n.save(),n.lineWidth=u.width,n.strokeStyle=u.color,n.setLineDash(u.borderDash||[]),n.lineDashOffset=u.borderDashOffset,n.beginPath(),n.moveTo(l.x,l.y),n.lineTo(c.x,c.y),n.stroke(),n.restore())};if(s.display)for(o=0,a=i.length;o<a;++o){const l=i[o];s.drawOnChartArea&&r({x:l.x1,y:l.y1},{x:l.x2,y:l.y2},l),s.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:e,ctx:s,options:{border:n,grid:i}}=this,o=n.setContext(this.getContext()),a=n.display?o.width:0;if(!a)return;const r=i.setContext(this.getContext(0)).lineWidth,l=this._borderValue;let c,u,d,h;this.isHorizontal()?(c=_t(e,this.left,a)-a/2,u=_t(e,this.right,r)+r/2,d=h=l):(d=_t(e,this.top,a)-a/2,h=_t(e,this.bottom,r)+r/2,c=u=l),s.save(),s.lineWidth=o.width,s.strokeStyle=o.color,s.beginPath(),s.moveTo(c,d),s.lineTo(u,h),s.stroke(),s.restore()}drawLabels(e){if(!this.options.ticks.display)return;const n=this.ctx,i=this._computeLabelArea();i&&yi(n,i);const o=this.getLabelItems(e);for(const a of o){const r=a.options,l=a.font,c=a.label,u=a.textOffset;xs(n,c,0,u,l,r)}i&&xi(n)}drawTitle(){const{ctx:e,options:{position:s,title:n,reverse:i}}=this;if(!n.display)return;const o=De(n.font),a=Ue(n.padding),r=n.align;let l=o.lineHeight/2;s==="bottom"||s==="center"||oe(s)?(l+=a.bottom,xe(n.text)&&(l+=o.lineHeight*(n.text.length-1))):l+=a.top;const{titleX:c,titleY:u,maxWidth:d,rotation:h}=Ag(this,l,s,r);xs(e,n.text,0,0,o,{color:n.color,maxWidth:d,rotation:h,textAlign:Mg(r,s,i),textBaseline:"middle",translation:[c,u]})}draw(e){this._isVisible()&&(this.drawBackground(),this.drawGrid(e),this.drawBorder(),this.drawTitle(),this.drawLabels(e))}_layers(){const e=this.options,s=e.ticks&&e.ticks.z||0,n=ee(e.grid&&e.grid.z,-1),i=ee(e.border&&e.border.z,0);return!this._isVisible()||this.draw!==jt.prototype.draw?[{z:s,draw:o=>{this.draw(o)}}]:[{z:n,draw:o=>{this.drawBackground(),this.drawGrid(o),this.drawTitle()}},{z:i,draw:()=>{this.drawBorder()}},{z:s,draw:o=>{this.drawLabels(o)}}]}getMatchingVisibleMetas(e){const s=this.chart.getSortedVisibleDatasetMetas(),n=this.axis+"AxisID",i=[];let o,a;for(o=0,a=s.length;o<a;++o){const r=s[o];r[n]===this.id&&(!e||r.type===e)&&i.push(r)}return i}_resolveTickFontOptions(e){const s=this.options.ticks.setContext(this.getContext(e));return De(s.font)}_maxDigits(){const e=this._resolveTickFontOptions(0).lineHeight;return(this.isHorizontal()?this.width:this.height)/e}}class Vs{constructor(e,s,n){this.type=e,this.scope=s,this.override=n,this.items=Object.create(null)}isForType(e){return Object.prototype.isPrototypeOf.call(this.type.prototype,e.prototype)}register(e){const s=Object.getPrototypeOf(e);let n;Lg(s)&&(n=this.register(s));const i=this.items,o=e.id,a=this.scope+"."+o;if(!o)throw new Error("class does not have id: "+e);return o in i||(i[o]=e,Tg(e,a,n),this.override&&me.override(e.id,e.overrides)),a}get(e){return this.items[e]}unregister(e){const s=this.items,n=e.id,i=this.scope;n in s&&delete s[n],i&&n in me[i]&&(delete me[i][n],this.override&&delete St[n])}}function Tg(t,e,s){const n=ms(Object.create(null),[s?me.get(s):{},me.get(e),t.defaults]);me.set(e,n),t.defaultRoutes&&Eg(e,t.defaultRoutes),t.descriptors&&me.describe(e,t.descriptors)}function Eg(t,e){Object.keys(e).forEach(s=>{const n=s.split("."),i=n.pop(),o=[t].concat(n).join("."),a=e[s].split("."),r=a.pop(),l=a.join(".");me.route(o,i,l,r)})}function Lg(t){return"id"in t&&"defaults"in t}class Og{constructor(){this.controllers=new Vs(It,"datasets",!0),this.elements=new Vs(Qe,"elements"),this.plugins=new Vs(Object,"plugins"),this.scales=new Vs(jt,"scales"),this._typedRegistries=[this.controllers,this.scales,this.elements]}add(...e){this._each("register",e)}remove(...e){this._each("unregister",e)}addControllers(...e){this._each("register",e,this.controllers)}addElements(...e){this._each("register",e,this.elements)}addPlugins(...e){this._each("register",e,this.plugins)}addScales(...e){this._each("register",e,this.scales)}getController(e){return this._get(e,this.controllers,"controller")}getElement(e){return this._get(e,this.elements,"element")}getPlugin(e){return this._get(e,this.plugins,"plugin")}getScale(e){return this._get(e,this.scales,"scale")}removeControllers(...e){this._each("unregister",e,this.controllers)}removeElements(...e){this._each("unregister",e,this.elements)}removePlugins(...e){this._each("unregister",e,this.plugins)}removeScales(...e){this._each("unregister",e,this.scales)}_each(e,s,n){[...s].forEach(i=>{const o=n||this._getRegistryForType(i);n||o.isForType(i)||o===this.plugins&&i.id?this._exec(e,o,i):re(i,a=>{const r=n||this._getRegistryForType(a);this._exec(e,r,a)})})}_exec(e,s,n){const i=gi(e);fe(n["before"+i],[],n),s[e](n),fe(n["after"+i],[],n)}_getRegistryForType(e){for(let s=0;s<this._typedRegistries.length;s++){const n=this._typedRegistries[s];if(n.isForType(e))return n}return this.plugins}_get(e,s,n){const i=s.get(e);if(i===void 0)throw new Error('"'+e+'" is not a registered '+n+".");return i}}var Ke=new Og;class Ig{constructor(){this._init=[]}notify(e,s,n,i){s==="beforeInit"&&(this._init=this._createDescriptors(e,!0),this._notify(this._init,e,"install"));const o=i?this._descriptors(e).filter(i):this._descriptors(e),a=this._notify(o,e,s,n);return s==="afterDestroy"&&(this._notify(o,e,"stop"),this._notify(this._init,e,"uninstall")),a}_notify(e,s,n,i){i=i||{};for(const o of e){const a=o.plugin,r=a[n],l=[s,i,o.options];if(fe(r,l,a)===!1&&i.cancelable)return!1}return!0}invalidate(){de(this._cache)||(this._oldCache=this._cache,this._cache=void 0)}_descriptors(e){if(this._cache)return this._cache;const s=this._cache=this._createDescriptors(e);return this._notifyStateChanges(e),s}_createDescriptors(e,s){const n=e&&e.config,i=ee(n.options&&n.options.plugins,{}),o=Fg(n);return i===!1&&!s?[]:$g(e,o,i,s)}_notifyStateChanges(e){const s=this._oldCache||[],n=this._cache,i=(o,a)=>o.filter(r=>!a.some(l=>r.plugin.id===l.plugin.id));this._notify(i(s,n),e,"stop"),this._notify(i(n,s),e,"start")}}function Fg(t){const e={},s=[],n=Object.keys(Ke.plugins.items);for(let o=0;o<n.length;o++)s.push(Ke.getPlugin(n[o]));const i=t.plugins||[];for(let o=0;o<i.length;o++){const a=i[o];s.indexOf(a)===-1&&(s.push(a),e[a.id]=!0)}return{plugins:s,localIds:e}}function Vg(t,e){return!e&&t===!1?null:t===!0?{}:t}function $g(t,{plugins:e,localIds:s},n,i){const o=[],a=t.getContext();for(const r of e){const l=r.id,c=Vg(n[l],i);c!==null&&o.push({plugin:r,options:zg(t.config,{plugin:r,local:s[l]},c,a)})}return o}function zg(t,{plugin:e,local:s},n,i){const o=t.pluginScopeKeys(e),a=t.getOptionScopes(n,o);return s&&e.defaults&&a.push(e.defaults),t.createResolver(a,i,[""],{scriptable:!1,indexable:!1,allKeys:!0})}function Xn(t,e){const s=me.datasets[t]||{};return((e.datasets||{})[t]||{}).indexAxis||e.indexAxis||s.indexAxis||"x"}function Bg(t,e){let s=t;return t==="_index_"?s=e:t==="_value_"&&(s=e==="x"?"y":"x"),s}function Ng(t,e){return t===e?"_index_":"_value_"}function $o(t){if(t==="x"||t==="y"||t==="r")return t}function Ug(t){if(t==="top"||t==="bottom")return"x";if(t==="left"||t==="right")return"y"}function Kn(t,...e){if($o(t))return t;for(const s of e){const n=s.axis||Ug(s.position)||t.length>1&&$o(t[0].toLowerCase());if(n)return n}throw new Error(`Cannot determine type of '${t}' axis. Please provide 'axis' or 'position' option.`)}function zo(t,e,s){if(s[e+"AxisID"]===t)return{axis:e}}function Hg(t,e){if(e.data&&e.data.datasets){const s=e.data.datasets.filter(n=>n.xAxisID===t||n.yAxisID===t);if(s.length)return zo(t,"x",s[0])||zo(t,"y",s[0])}return{}}function jg(t,e){const s=St[t.type]||{scales:{}},n=e.scales||{},i=Xn(t.type,e),o=Object.create(null);return Object.keys(n).forEach(a=>{const r=n[a];if(!oe(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=Kn(a,r,Hg(a,t),me.scales[r.type]),c=Ng(l,i),u=s.scales||{};o[a]=rs(Object.create(null),[{axis:l},r,u[l],u[c]])}),t.data.datasets.forEach(a=>{const r=a.type||t.type,l=a.indexAxis||Xn(r,e),u=(St[r]||{}).scales||{};Object.keys(u).forEach(d=>{const h=Bg(d,l),f=a[h+"AxisID"]||h;o[f]=o[f]||Object.create(null),rs(o[f],[{axis:h},n[f],u[d]])})}),Object.keys(o).forEach(a=>{const r=o[a];rs(r,[me.scales[r.type],me.scale])}),o}function _r(t){const e=t.options||(t.options={});e.plugins=ee(e.plugins,{}),e.scales=jg(t,e)}function vr(t){return t=t||{},t.datasets=t.datasets||[],t.labels=t.labels||[],t}function Wg(t){return t=t||{},t.data=vr(t.data),_r(t),t}const Bo=new Map,br=new Set;function $s(t,e){let s=Bo.get(t);return s||(s=e(),Bo.set(t,s),br.add(s)),s}const Qt=(t,e,s)=>{const n=_s(e,s);n!==void 0&&t.add(n)};class Gg{constructor(e){this._config=Wg(e),this._scopeCache=new Map,this._resolverCache=new Map}get platform(){return this._config.platform}get type(){return this._config.type}set type(e){this._config.type=e}get data(){return this._config.data}set data(e){this._config.data=vr(e)}get options(){return this._config.options}set options(e){this._config.options=e}get plugins(){return this._config.plugins}update(){const e=this._config;this.clearCache(),_r(e)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(e){return $s(e,()=>[[`datasets.${e}`,""]])}datasetAnimationScopeKeys(e,s){return $s(`${e}.transition.${s}`,()=>[[`datasets.${e}.transitions.${s}`,`transitions.${s}`],[`datasets.${e}`,""]])}datasetElementScopeKeys(e,s){return $s(`${e}-${s}`,()=>[[`datasets.${e}.elements.${s}`,`datasets.${e}`,`elements.${s}`,""]])}pluginScopeKeys(e){const s=e.id,n=this.type;return $s(`${n}-plugin-${s}`,()=>[[`plugins.${s}`,...e.additionalOptionScopes||[]]])}_cachedScopes(e,s){const n=this._scopeCache;let i=n.get(e);return(!i||s)&&(i=new Map,n.set(e,i)),i}getOptionScopes(e,s,n){const{options:i,type:o}=this,a=this._cachedScopes(e,n),r=a.get(s);if(r)return r;const l=new Set;s.forEach(u=>{e&&(l.add(e),u.forEach(d=>Qt(l,e,d))),u.forEach(d=>Qt(l,i,d)),u.forEach(d=>Qt(l,St[o]||{},d)),u.forEach(d=>Qt(l,me,d)),u.forEach(d=>Qt(l,Wn,d))});const c=Array.from(l);return c.length===0&&c.push(Object.create(null)),br.has(s)&&a.set(s,c),c}chartOptionScopes(){const{options:e,type:s}=this;return[e,St[s]||{},me.datasets[s]||{},{type:s},me,Wn]}resolveNamedOptions(e,s,n,i=[""]){const o={$shared:!0},{resolver:a,subPrefixes:r}=No(this._resolverCache,e,i);let l=a;if(Yg(a,s)){o.$shared=!1,n=gt(n)?n():n;const c=this.createResolver(e,n,r);l=Nt(a,n,c)}for(const c of s)o[c]=l[c];return o}createResolver(e,s,n=[""],i){const{resolver:o}=No(this._resolverCache,e,n);return oe(s)?Nt(o,s,void 0,i):o}}function No(t,e,s){let n=t.get(e);n||(n=new Map,t.set(e,n));const i=s.join();let o=n.get(i);return o||(o={resolver:Si(e,s),subPrefixes:s.filter(r=>!r.toLowerCase().includes("hover"))},n.set(i,o)),o}const qg=t=>oe(t)&&Object.getOwnPropertyNames(t).some(e=>gt(t[e]));function Yg(t,e){const{isScriptable:s,isIndexable:n}=sr(t);for(const i of e){const o=s(i),a=n(i),r=(a||o)&&t[i];if(o&&(gt(r)||qg(r))||a&&xe(r))return!0}return!1}var Xg="4.4.9";const Kg=["top","bottom","left","right","chartArea"];function Uo(t,e){return t==="top"||t==="bottom"||Kg.indexOf(t)===-1&&e==="x"}function Ho(t,e){return function(s,n){return s[t]===n[t]?s[e]-n[e]:s[t]-n[t]}}function jo(t){const e=t.chart,s=e.options.animation;e.notifyPlugins("afterRender"),fe(s&&s.onComplete,[t],e)}function Qg(t){const e=t.chart,s=e.options.animation;fe(s&&s.onProgress,[t],e)}function yr(t){return Pi()&&typeof t=="string"?t=document.getElementById(t):t&&t.length&&(t=t[0]),t&&t.canvas&&(t=t.canvas),t}const js={},Wo=t=>{const e=yr(t);return Object.values(js).filter(s=>s.canvas===e).pop()};function Zg(t,e,s){const n=Object.keys(t);for(const i of n){const o=+i;if(o>=e){const a=t[i];delete t[i],(s>0||o>e)&&(t[o+s]=a)}}}function Jg(t,e,s,n){return!s||t.type==="mouseout"?null:n?e:t}var lt;let dn=(lt=class{static register(...e){Ke.add(...e),Go()}static unregister(...e){Ke.remove(...e),Go()}constructor(e,s){const n=this.config=new Gg(s),i=yr(e),o=Wo(i);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=n.createResolver(n.chartOptionScopes(),this.getContext());this.platform=new(n.platform||_g(i)),this.platform.updateConfig(n);const r=this.platform.acquireContext(i,a.aspectRatio),l=r&&r.canvas,c=l&&l.height,u=l&&l.width;if(this.id=tf(),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 Ig,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=wf(d=>this.update(d),a.resizeDelay||0),this._dataChanges=[],js[this.id]=this,!r||!l){console.error("Failed to create chart: can't acquire context from the given item");return}tt.listen(this,"complete",jo),tt.listen(this,"progress",Qg),this._initialize(),this.attached&&this.update()}get aspectRatio(){const{options:{aspectRatio:e,maintainAspectRatio:s},width:n,height:i,_aspectRatio:o}=this;return de(e)?s&&o?o:i?n/i:null:e}get data(){return this.config.data}set data(e){this.config.data=e}get options(){return this._options}set options(e){this.config.options=e}get registry(){return Ke}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():_o(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return po(this.canvas,this.ctx),this}stop(){return tt.stop(this),this}resize(e,s){tt.running(this)?this._resizeBeforeDraw={width:e,height:s}:this._resize(e,s)}_resize(e,s){const n=this.options,i=this.canvas,o=n.maintainAspectRatio&&this.aspectRatio,a=this.platform.getMaximumSize(i,e,s,o),r=n.devicePixelRatio||this.platform.getDevicePixelRatio(),l=this.width?"resize":"attach";this.width=a.width,this.height=a.height,this._aspectRatio=this.aspectRatio,_o(this,r,!0)&&(this.notifyPlugins("resize",{size:a}),fe(n.onResize,[this,a],this),this.attached&&this._doResize(l)&&this.render())}ensureScalesHaveIDs(){const s=this.options.scales||{};re(s,(n,i)=>{n.id=i})}buildOrUpdateScales(){const e=this.options,s=e.scales,n=this.scales,i=Object.keys(n).reduce((a,r)=>(a[r]=!1,a),{});let o=[];s&&(o=o.concat(Object.keys(s).map(a=>{const r=s[a],l=Kn(a,r),c=l==="r",u=l==="x";return{options:r,dposition:c?"chartArea":u?"bottom":"left",dtype:c?"radialLinear":u?"category":"linear"}}))),re(o,a=>{const r=a.options,l=r.id,c=Kn(l,r),u=ee(r.type,a.dtype);(r.position===void 0||Uo(r.position,c)!==Uo(a.dposition))&&(r.position=a.dposition),i[l]=!0;let d=null;if(l in n&&n[l].type===u)d=n[l];else{const h=Ke.getScale(u);d=new h({id:l,type:u,ctx:this.ctx,chart:this}),n[d.id]=d}d.init(r,e)}),re(i,(a,r)=>{a||delete n[r]}),re(n,a=>{Be.configure(this,a,a.options),Be.addBox(this,a)})}_updateMetasets(){const e=this._metasets,s=this.data.datasets.length,n=e.length;if(e.sort((i,o)=>i.index-o.index),n>s){for(let i=s;i<n;++i)this._destroyDatasetMeta(i);e.splice(s,n-s)}this._sortedMetasets=e.slice(0).sort(Ho("order","index"))}_removeUnreferencedMetasets(){const{_metasets:e,data:{datasets:s}}=this;e.length>s.length&&delete this._stacks,e.forEach((n,i)=>{s.filter(o=>o===n._dataset).length===0&&this._destroyDatasetMeta(i)})}buildOrUpdateControllers(){const e=[],s=this.data.datasets;let n,i;for(this._removeUnreferencedMetasets(),n=0,i=s.length;n<i;n++){const o=s[n];let a=this.getDatasetMeta(n);const r=o.type||this.config.type;if(a.type&&a.type!==r&&(this._destroyDatasetMeta(n),a=this.getDatasetMeta(n)),a.type=r,a.indexAxis=o.indexAxis||Xn(r,this.options),a.order=o.order||0,a.index=n,a.label=""+o.label,a.visible=this.isDatasetVisible(n),a.controller)a.controller.updateIndex(n),a.controller.linkScales();else{const l=Ke.getController(r),{datasetElementType:c,dataElementType:u}=me.datasets[r];Object.assign(l,{dataElementType:Ke.getElement(u),datasetElementType:c&&Ke.getElement(c)}),a.controller=new l(this,n),e.push(a.controller)}}return this._updateMetasets(),e}_resetElements(){re(this.data.datasets,(e,s)=>{this.getDatasetMeta(s).controller.reset()},this)}reset(){this._resetElements(),this.notifyPlugins("reset")}update(e){const s=this.config;s.update();const n=this._options=s.createResolver(s.chartOptionScopes(),this.getContext()),i=this._animationsDisabled=!n.animation;if(this._updateScales(),this._checkEventBindings(),this._updateHiddenIndices(),this._plugins.invalidate(),this.notifyPlugins("beforeUpdate",{mode:e,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:d}=this.getDatasetMeta(c),h=!i&&o.indexOf(d)===-1;d.buildOrUpdateElements(h),a=Math.max(+d.getMaxOverflow(),a)}a=this._minPadding=n.layout.autoPadding?a:0,this._updateLayout(a),i||re(o,c=>{c.reset()}),this._updateDatasets(e),this.notifyPlugins("afterUpdate",{mode:e}),this._layers.sort(Ho("z","_idx"));const{_active:r,_lastEvent:l}=this;l?this._eventHandler(l,!0):r.length&&this._updateHoverStyles(r,r,!0),this.render()}_updateScales(){re(this.scales,e=>{Be.removeBox(this,e)}),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){const e=this.options,s=new Set(Object.keys(this._listeners)),n=new Set(e.events);(!no(s,n)||!!this._responsiveListeners!==e.responsive)&&(this.unbindEvents(),this.bindEvents())}_updateHiddenIndices(){const{_hiddenIndices:e}=this,s=this._getUniformDataChanges()||[];for(const{method:n,start:i,count:o}of s){const a=n==="_removeElements"?-o:o;Zg(e,i,a)}}_getUniformDataChanges(){const e=this._dataChanges;if(!e||!e.length)return;this._dataChanges=[];const s=this.data.datasets.length,n=o=>new Set(e.filter(a=>a[0]===o).map((a,r)=>r+","+a.splice(1).join(","))),i=n(0);for(let o=1;o<s;o++)if(!no(i,n(o)))return;return Array.from(i).map(o=>o.split(",")).map(o=>({method:o[1],start:+o[2],count:+o[3]}))}_updateLayout(e){if(this.notifyPlugins("beforeLayout",{cancelable:!0})===!1)return;Be.update(this,this.width,this.height,e);const s=this.chartArea,n=s.width<=0||s.height<=0;this._layers=[],re(this.boxes,i=>{n&&i.position==="chartArea"||(i.configure&&i.configure(),this._layers.push(...i._layers()))},this),this._layers.forEach((i,o)=>{i._idx=o}),this.notifyPlugins("afterLayout")}_updateDatasets(e){if(this.notifyPlugins("beforeDatasetsUpdate",{mode:e,cancelable:!0})!==!1){for(let s=0,n=this.data.datasets.length;s<n;++s)this.getDatasetMeta(s).controller.configure();for(let s=0,n=this.data.datasets.length;s<n;++s)this._updateDataset(s,gt(e)?e({datasetIndex:s}):e);this.notifyPlugins("afterDatasetsUpdate",{mode:e})}}_updateDataset(e,s){const n=this.getDatasetMeta(e),i={meta:n,index:e,mode:s,cancelable:!0};this.notifyPlugins("beforeDatasetUpdate",i)!==!1&&(n.controller._update(s),i.cancelable=!1,this.notifyPlugins("afterDatasetUpdate",i))}render(){this.notifyPlugins("beforeRender",{cancelable:!0})!==!1&&(tt.has(this)?this.attached&&!tt.running(this)&&tt.start(this):(this.draw(),jo({chart:this})))}draw(){let e;if(this._resizeBeforeDraw){const{width:n,height:i}=this._resizeBeforeDraw;this._resizeBeforeDraw=null,this._resize(n,i)}if(this.clear(),this.width<=0||this.height<=0||this.notifyPlugins("beforeDraw",{cancelable:!0})===!1)return;const s=this._layers;for(e=0;e<s.length&&s[e].z<=0;++e)s[e].draw(this.chartArea);for(this._drawDatasets();e<s.length;++e)s[e].draw(this.chartArea);this.notifyPlugins("afterDraw")}_getSortedDatasetMetas(e){const s=this._sortedMetasets,n=[];let i,o;for(i=0,o=s.length;i<o;++i){const a=s[i];(!e||a.visible)&&n.push(a)}return n}getSortedVisibleDatasetMetas(){return this._getSortedDatasetMetas(!0)}_drawDatasets(){if(this.notifyPlugins("beforeDatasetsDraw",{cancelable:!0})===!1)return;const e=this.getSortedVisibleDatasetMetas();for(let s=e.length-1;s>=0;--s)this._drawDataset(e[s]);this.notifyPlugins("afterDatasetsDraw")}_drawDataset(e){const s=this.ctx,n={meta:e,index:e.index,cancelable:!0},i=Mp(this,e);this.notifyPlugins("beforeDatasetDraw",n)!==!1&&(i&&yi(s,i),e.controller.draw(),i&&xi(s),n.cancelable=!1,this.notifyPlugins("afterDatasetDraw",n))}isPointInArea(e){return ys(e,this.chartArea,this._minPadding)}getElementsAtEventForMode(e,s,n,i){const o=Kp.modes[s];return typeof o=="function"?o(this,e,n,i):[]}getDatasetMeta(e){const s=this.data.datasets[e],n=this._metasets;let i=n.filter(o=>o&&o._dataset===s).pop();return i||(i={type:null,data:[],dataset:null,controller:null,hidden:null,xAxisID:null,yAxisID:null,order:s&&s.order||0,index:e,_dataset:s,_parsed:[],_sorted:!1},n.push(i)),i}getContext(){return this.$context||(this.$context=Ct(null,{chart:this,type:"chart"}))}getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(e){const s=this.data.datasets[e];if(!s)return!1;const n=this.getDatasetMeta(e);return typeof n.hidden=="boolean"?!n.hidden:!s.hidden}setDatasetVisibility(e,s){const n=this.getDatasetMeta(e);n.hidden=!s}toggleDataVisibility(e){this._hiddenIndices[e]=!this._hiddenIndices[e]}getDataVisibility(e){return!this._hiddenIndices[e]}_updateVisibility(e,s,n){const i=n?"show":"hide",o=this.getDatasetMeta(e),a=o.controller._resolveAnimations(void 0,i);Qs(s)?(o.data[s].hidden=!n,this.update()):(this.setDatasetVisibility(e,n),a.update(o,{visible:n}),this.update(r=>r.datasetIndex===e?i:void 0))}hide(e,s){this._updateVisibility(e,s,!1)}show(e,s){this._updateVisibility(e,s,!0)}_destroyDatasetMeta(e){const s=this._metasets[e];s&&s.controller&&s.controller._destroy(),delete this._metasets[e]}_stop(){let e,s;for(this.stop(),tt.remove(this),e=0,s=this.data.datasets.length;e<s;++e)this._destroyDatasetMeta(e)}destroy(){this.notifyPlugins("beforeDestroy");const{canvas:e,ctx:s}=this;this._stop(),this.config.clearCache(),e&&(this.unbindEvents(),po(e,s),this.platform.releaseContext(s),this.canvas=null,this.ctx=null),delete js[this.id],this.notifyPlugins("afterDestroy")}toBase64Image(...e){return this.canvas.toDataURL(...e)}bindEvents(){this.bindUserEvents(),this.options.responsive?this.bindResponsiveEvents():this.attached=!0}bindUserEvents(){const e=this._listeners,s=this.platform,n=(o,a)=>{s.addEventListener(this,o,a),e[o]=a},i=(o,a,r)=>{o.offsetX=a,o.offsetY=r,this._eventHandler(o)};re(this.options.events,o=>n(o,i))}bindResponsiveEvents(){this._responsiveListeners||(this._responsiveListeners={});const e=this._responsiveListeners,s=this.platform,n=(l,c)=>{s.addEventListener(this,l,c),e[l]=c},i=(l,c)=>{e[l]&&(s.removeEventListener(this,l,c),delete e[l])},o=(l,c)=>{this.canvas&&this.resize(l,c)};let a;const r=()=>{i("attach",r),this.attached=!0,this.resize(),n("resize",o),n("detach",a)};a=()=>{this.attached=!1,i("resize",o),this._stop(),this._resize(0,0),n("attach",r)},s.isAttached(this.canvas)?r():a()}unbindEvents(){re(this._listeners,(e,s)=>{this.platform.removeEventListener(this,s,e)}),this._listeners={},re(this._responsiveListeners,(e,s)=>{this.platform.removeEventListener(this,s,e)}),this._responsiveListeners=void 0}updateHoverStyle(e,s,n){const i=n?"set":"remove";let o,a,r,l;for(s==="dataset"&&(o=this.getDatasetMeta(e[0].datasetIndex),o.controller["_"+i+"DatasetHoverStyle"]()),r=0,l=e.length;r<l;++r){a=e[r];const c=a&&this.getDatasetMeta(a.datasetIndex).controller;c&&c[i+"HoverStyle"](a.element,a.datasetIndex,a.index)}}getActiveElements(){return this._active||[]}setActiveElements(e){const s=this._active||[],n=e.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}});!Xs(n,s)&&(this._active=n,this._lastEvent=null,this._updateHoverStyles(n,s))}notifyPlugins(e,s,n){return this._plugins.notify(this,e,s,n)}isPluginEnabled(e){return this._plugins._cache.filter(s=>s.plugin.id===e).length===1}_updateHoverStyles(e,s,n){const i=this.options.hover,o=(l,c)=>l.filter(u=>!c.some(d=>u.datasetIndex===d.datasetIndex&&u.index===d.index)),a=o(s,e),r=n?e:o(e,s);a.length&&this.updateHoverStyle(a,i.mode,!1),r.length&&i.mode&&this.updateHoverStyle(r,i.mode,!0)}_eventHandler(e,s){const n={event:e,replay:s,cancelable:!0,inChartArea:this.isPointInArea(e)},i=a=>(a.options.events||this.options.events).includes(e.native.type);if(this.notifyPlugins("beforeEvent",n,i)===!1)return;const o=this._handleEvent(e,s,n.inChartArea);return n.cancelable=!1,this.notifyPlugins("afterEvent",n,i),(o||n.changed)&&this.render(),this}_handleEvent(e,s,n){const{_active:i=[],options:o}=this,a=s,r=this._getActiveElements(e,i,n,a),l=lf(e),c=Jg(e,this._lastEvent,n,l);n&&(this._lastEvent=null,fe(o.onHover,[e,r,this],this),l&&fe(o.onClick,[e,r,this],this));const u=!Xs(r,i);return(u||s)&&(this._active=r,this._updateHoverStyles(r,i,s)),this._lastEvent=c,u}_getActiveElements(e,s,n,i){if(e.type==="mouseout")return[];if(!n)return s;const o=this.options.hover;return this.getElementsAtEventForMode(e,o.mode,o,i)}},U(lt,"defaults",me),U(lt,"instances",js),U(lt,"overrides",St),U(lt,"registry",Ke),U(lt,"version",Xg),U(lt,"getChart",Wo),lt);function Go(){return re(dn.instances,t=>t._plugins.invalidate())}function em(t,e,s){const{startAngle:n,pixelMargin:i,x:o,y:a,outerRadius:r,innerRadius:l}=e;let c=i/r;t.beginPath(),t.arc(o,a,r,n-c,s+c),l>i?(c=i/l,t.arc(o,a,l,s+c,n-c,!0)):t.arc(o,a,i,s+be,n-be),t.closePath(),t.clip()}function tm(t){return wi(t,["outerStart","outerEnd","innerStart","innerEnd"])}function sm(t,e,s,n){const i=tm(t.options.borderRadius),o=(s-e)/2,a=Math.min(o,n*e/2),r=l=>{const c=(s-Math.min(o,l))*n/2;return Re(l,0,Math.min(o,c))};return{outerStart:r(i.outerStart),outerEnd:r(i.outerEnd),innerStart:Re(i.innerStart,0,a),innerEnd:Re(i.innerEnd,0,a)}}function Mt(t,e,s,n){return{x:s+t*Math.cos(e),y:n+t*Math.sin(e)}}function tn(t,e,s,n,i,o){const{x:a,y:r,startAngle:l,pixelMargin:c,innerRadius:u}=e,d=Math.max(e.outerRadius+n+s-c,0),h=u>0?u+n+s+c:0;let f=0;const p=i-l;if(n){const Y=u>0?u-n:0,Q=d>0?d-n:0,Z=(Y+Q)/2,ye=Z!==0?p*Z/(Z+n):p;f=(p-ye)/2}const g=Math.max(.001,p*d-s/ge)/d,m=(p-g)/2,y=l+m+f,b=i-m-f,{outerStart:k,outerEnd:P,innerStart:C,innerEnd:O}=sm(e,h,d,b-y),R=d-k,E=d-P,z=y+k/R,j=b-P/E,G=h+C,L=h+O,F=y+C/G,he=b-O/L;if(t.beginPath(),o){const Y=(z+j)/2;if(t.arc(a,r,d,z,Y),t.arc(a,r,d,Y,j),P>0){const ce=Mt(E,j,a,r);t.arc(ce.x,ce.y,P,j,b+be)}const Q=Mt(L,b,a,r);if(t.lineTo(Q.x,Q.y),O>0){const ce=Mt(L,he,a,r);t.arc(ce.x,ce.y,O,b+be,he+Math.PI)}const Z=(b-O/h+(y+C/h))/2;if(t.arc(a,r,h,b-O/h,Z,!0),t.arc(a,r,h,Z,y+C/h,!0),C>0){const ce=Mt(G,F,a,r);t.arc(ce.x,ce.y,C,F+Math.PI,y-be)}const ye=Mt(R,y,a,r);if(t.lineTo(ye.x,ye.y),k>0){const ce=Mt(R,z,a,r);t.arc(ce.x,ce.y,k,y-be,z)}}else{t.moveTo(a,r);const Y=Math.cos(z)*d+a,Q=Math.sin(z)*d+r;t.lineTo(Y,Q);const Z=Math.cos(j)*d+a,ye=Math.sin(j)*d+r;t.lineTo(Z,ye)}t.closePath()}function nm(t,e,s,n,i){const{fullCircles:o,startAngle:a,circumference:r}=e;let l=e.endAngle;if(o){tn(t,e,s,n,l,i);for(let c=0;c<o;++c)t.fill();isNaN(r)||(l=a+(r%pe||pe))}return tn(t,e,s,n,l,i),t.fill(),l}function im(t,e,s,n,i){const{fullCircles:o,startAngle:a,circumference:r,options:l}=e,{borderWidth:c,borderJoinStyle:u,borderDash:d,borderDashOffset:h}=l,f=l.borderAlign==="inner";if(!c)return;t.setLineDash(d||[]),t.lineDashOffset=h,f?(t.lineWidth=c*2,t.lineJoin=u||"round"):(t.lineWidth=c,t.lineJoin=u||"bevel");let p=e.endAngle;if(o){tn(t,e,s,n,p,i);for(let g=0;g<o;++g)t.stroke();isNaN(r)||(p=a+(r%pe||pe))}f&&em(t,e,p),o||(tn(t,e,s,n,p,i),t.stroke())}class ts extends Qe{constructor(s){super();U(this,"circumference");U(this,"endAngle");U(this,"fullCircles");U(this,"innerRadius");U(this,"outerRadius");U(this,"pixelMargin");U(this,"startAngle");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,s&&Object.assign(this,s)}inRange(s,n,i){const o=this.getProps(["x","y"],i),{angle:a,distance:r}=Ka(o,{x:s,y:n}),{startAngle:l,endAngle:c,innerRadius:u,outerRadius:d,circumference:h}=this.getProps(["startAngle","endAngle","innerRadius","outerRadius","circumference"],i),f=(this.options.spacing+this.options.borderWidth)/2,p=ee(h,c-l),g=bs(a,l,c)&&l!==c,m=p>=pe||g,y=Lt(r,u+f,d+f);return m&&y}getCenterPoint(s){const{x:n,y:i,startAngle:o,endAngle:a,innerRadius:r,outerRadius:l}=this.getProps(["x","y","startAngle","endAngle","innerRadius","outerRadius"],s),{offset:c,spacing:u}=this.options,d=(o+a)/2,h=(r+l+u+c)/2;return{x:n+Math.cos(d)*h,y:i+Math.sin(d)*h}}tooltipPosition(s){return this.getCenterPoint(s)}draw(s){const{options:n,circumference:i}=this,o=(n.offset||0)/4,a=(n.spacing||0)/2,r=n.circular;if(this.pixelMargin=n.borderAlign==="inner"?.33:0,this.fullCircles=i>pe?Math.floor(i/pe):0,i===0||this.innerRadius<0||this.outerRadius<0)return;s.save();const l=(this.startAngle+this.endAngle)/2;s.translate(Math.cos(l)*o,Math.sin(l)*o);const c=1-Math.sin(Math.min(ge,i||0)),u=o*c;s.fillStyle=n.backgroundColor,s.strokeStyle=n.borderColor,nm(s,this,u,a,r),im(s,this,u,a,r),s.restore()}}U(ts,"id","arc"),U(ts,"defaults",{borderAlign:"center",borderColor:"#fff",borderDash:[],borderDashOffset:0,borderJoinStyle:void 0,borderRadius:0,borderWidth:2,offset:0,spacing:0,angle:void 0,circular:!0}),U(ts,"defaultRoutes",{backgroundColor:"backgroundColor"}),U(ts,"descriptors",{_scriptable:!0,_indexable:s=>s!=="borderDash"});function xr(t,e,s=e){t.lineCap=ee(s.borderCapStyle,e.borderCapStyle),t.setLineDash(ee(s.borderDash,e.borderDash)),t.lineDashOffset=ee(s.borderDashOffset,e.borderDashOffset),t.lineJoin=ee(s.borderJoinStyle,e.borderJoinStyle),t.lineWidth=ee(s.borderWidth,e.borderWidth),t.strokeStyle=ee(s.borderColor,e.borderColor)}function om(t,e,s){t.lineTo(s.x,s.y)}function am(t){return t.stepped?Ff:t.tension||t.cubicInterpolationMode==="monotone"?Vf:om}function wr(t,e,s={}){const n=t.length,{start:i=0,end:o=n-1}=s,{start:a,end:r}=e,l=Math.max(i,a),c=Math.min(o,r),u=i<a&&o<a||i>r&&o>r;return{count:n,start:l,loop:e.loop,ilen:c<l&&!u?n+c-l:c-l}}function rm(t,e,s,n){const{points:i,options:o}=e,{count:a,start:r,loop:l,ilen:c}=wr(i,s,n),u=am(o);let{move:d=!0,reverse:h}=n||{},f,p,g;for(f=0;f<=c;++f)p=i[(r+(h?c-f:f))%a],!p.skip&&(d?(t.moveTo(p.x,p.y),d=!1):u(t,g,p,h,o.stepped),g=p);return l&&(p=i[(r+(h?c:0))%a],u(t,g,p,h,o.stepped)),!!l}function lm(t,e,s,n){const i=e.points,{count:o,start:a,ilen:r}=wr(i,s,n),{move:l=!0,reverse:c}=n||{};let u=0,d=0,h,f,p,g,m,y;const b=P=>(a+(c?r-P:P))%o,k=()=>{g!==m&&(t.lineTo(u,m),t.lineTo(u,g),t.lineTo(u,y))};for(l&&(f=i[b(0)],t.moveTo(f.x,f.y)),h=0;h<=r;++h){if(f=i[b(h)],f.skip)continue;const P=f.x,C=f.y,O=P|0;O===p?(C<g?g=C:C>m&&(m=C),u=(d*u+P)/++d):(k(),t.lineTo(P,C),p=O,d=0,g=m=C),y=C}k()}function Qn(t){const e=t.options,s=e.borderDash&&e.borderDash.length;return!t._decimated&&!t._loop&&!e.tension&&e.cubicInterpolationMode!=="monotone"&&!e.stepped&&!s?lm:rm}function cm(t){return t.stepped?mp:t.tension||t.cubicInterpolationMode==="monotone"?_p:yt}function um(t,e,s,n){let i=e._path;i||(i=e._path=new Path2D,e.path(i,s,n)&&i.closePath()),xr(t,e.options),t.stroke(i)}function dm(t,e,s,n){const{segments:i,options:o}=e,a=Qn(e);for(const r of i)xr(t,o,r.style),t.beginPath(),a(t,e,r,{start:s,end:s+n-1})&&t.closePath(),t.stroke()}const hm=typeof Path2D=="function";function fm(t,e,s,n){hm&&!e.options.segment?um(t,e,s,n):dm(t,e,s,n)}class ss extends Qe{constructor(e){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,e&&Object.assign(this,e)}updateControlPoints(e,s){const n=this.options;if((n.tension||n.cubicInterpolationMode==="monotone")&&!n.stepped&&!this._pointsUpdated){const i=n.spanGaps?this._loop:this._fullLoop;lp(this._points,n,e,i,s),this._pointsUpdated=!0}}set points(e){this._points=e,delete this._segments,delete this._path,this._pointsUpdated=!1}get points(){return this._points}get segments(){return this._segments||(this._segments=Cp(this,this.options.segment))}first(){const e=this.segments,s=this.points;return e.length&&s[e[0].start]}last(){const e=this.segments,s=this.points,n=e.length;return n&&s[e[n-1].end]}interpolate(e,s){const n=this.options,i=e[s],o=this.points,a=wp(this,{property:s,start:i,end:i});if(!a.length)return;const r=[],l=cm(n);let c,u;for(c=0,u=a.length;c<u;++c){const{start:d,end:h}=a[c],f=o[d],p=o[h];if(f===p){r.push(f);continue}const g=Math.abs((i-f[s])/(p[s]-f[s])),m=l(f,p,g,n.stepped);m[s]=e[s],r.push(m)}return r.length===1?r[0]:r}pathSegment(e,s,n){return Qn(this)(e,this,s,n)}path(e,s,n){const i=this.segments,o=Qn(this);let a=this._loop;s=s||0,n=n||this.points.length-s;for(const r of i)a&=o(e,this,r,{start:s,end:s+n-1});return!!a}draw(e,s,n,i){const o=this.options||{};(this.points||[]).length&&o.borderWidth&&(e.save(),fm(e,this,n,i),e.restore()),this.animated&&(this._pointsUpdated=!1,this._path=void 0)}}U(ss,"id","line"),U(ss,"defaults",{borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderWidth:3,capBezierPoints:!0,cubicInterpolationMode:"default",fill:!1,spanGaps:!1,stepped:!1,tension:0}),U(ss,"defaultRoutes",{backgroundColor:"backgroundColor",borderColor:"borderColor"}),U(ss,"descriptors",{_scriptable:!0,_indexable:e=>e!=="borderDash"&&e!=="fill"});function qo(t,e,s,n){const i=t.options,{[s]:o}=t.getProps([s],n);return Math.abs(e-o)<i.radius+i.hitRadius}class Ws extends Qe{constructor(s){super();U(this,"parsed");U(this,"skip");U(this,"stop");this.options=void 0,this.parsed=void 0,this.skip=void 0,this.stop=void 0,s&&Object.assign(this,s)}inRange(s,n,i){const o=this.options,{x:a,y:r}=this.getProps(["x","y"],i);return Math.pow(s-a,2)+Math.pow(n-r,2)<Math.pow(o.hitRadius+o.radius,2)}inXRange(s,n){return qo(this,s,"x",n)}inYRange(s,n){return qo(this,s,"y",n)}getCenterPoint(s){const{x:n,y:i}=this.getProps(["x","y"],s);return{x:n,y:i}}size(s){s=s||this.options||{};let n=s.radius||0;n=Math.max(n,n&&s.hoverRadius||0);const i=n&&s.borderWidth||0;return(n+i)*2}draw(s,n){const i=this.options;this.skip||i.radius<.1||!ys(this,n,this.size(i)/2)||(s.strokeStyle=i.borderColor,s.lineWidth=i.borderWidth,s.fillStyle=i.backgroundColor,Gn(s,i,this.x,this.y))}getRange(){const s=this.options||{};return s.radius+s.hitRadius}}U(Ws,"id","point"),U(Ws,"defaults",{borderWidth:1,hitRadius:1,hoverBorderWidth:1,hoverRadius:4,pointStyle:"circle",radius:3,rotation:0}),U(Ws,"defaultRoutes",{backgroundColor:"backgroundColor",borderColor:"borderColor"});const Yo=(t,e)=>{let{boxHeight:s=e,boxWidth:n=e}=t;return t.usePointStyle&&(s=Math.min(s,e),n=t.pointStyleWidth||Math.min(n,e)),{boxWidth:n,boxHeight:s,itemHeight:Math.max(e,s)}},pm=(t,e)=>t!==null&&e!==null&&t.datasetIndex===e.datasetIndex&&t.index===e.index;class Xo extends Qe{constructor(e){super(),this._added=!1,this.legendHitBoxes=[],this._hoveredItem=null,this.doughnutMode=!1,this.chart=e.chart,this.options=e.options,this.ctx=e.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(e,s,n){this.maxWidth=e,this.maxHeight=s,this._margins=n,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 e=this.options.labels||{};let s=fe(e.generateLabels,[this.chart],this)||[];e.filter&&(s=s.filter(n=>e.filter(n,this.chart.data))),e.sort&&(s=s.sort((n,i)=>e.sort(n,i,this.chart.data))),this.options.reverse&&s.reverse(),this.legendItems=s}fit(){const{options:e,ctx:s}=this;if(!e.display){this.width=this.height=0;return}const n=e.labels,i=De(n.font),o=i.size,a=this._computeTitleHeight(),{boxWidth:r,itemHeight:l}=Yo(n,o);let c,u;s.font=i.string,this.isHorizontal()?(c=this.maxWidth,u=this._fitRows(a,o,r,l)+10):(u=this.maxHeight,c=this._fitCols(a,i,r,l)+10),this.width=Math.min(c,e.maxWidth||this.maxWidth),this.height=Math.min(u,e.maxHeight||this.maxHeight)}_fitRows(e,s,n,i){const{ctx:o,maxWidth:a,options:{labels:{padding:r}}}=this,l=this.legendHitBoxes=[],c=this.lineWidths=[0],u=i+r;let d=e;o.textAlign="left",o.textBaseline="middle";let h=-1,f=-u;return this.legendItems.forEach((p,g)=>{const m=n+s/2+o.measureText(p.text).width;(g===0||c[c.length-1]+m+2*r>a)&&(d+=u,c[c.length-(g>0?0:1)]=0,f+=u,h++),l[g]={left:0,top:f,row:h,width:m,height:i},c[c.length-1]+=m+r}),d}_fitCols(e,s,n,i){const{ctx:o,maxHeight:a,options:{labels:{padding:r}}}=this,l=this.legendHitBoxes=[],c=this.columnSizes=[],u=a-e;let d=r,h=0,f=0,p=0,g=0;return this.legendItems.forEach((m,y)=>{const{itemWidth:b,itemHeight:k}=gm(n,s,o,m,i);y>0&&f+k+2*r>u&&(d+=h+r,c.push({width:h,height:f}),p+=h+r,g++,h=f=0),l[y]={left:p,top:f,col:g,width:b,height:k},h=Math.max(h,b),f+=k+r}),d+=h,c.push({width:h,height:f}),d}adjustHitBoxes(){if(!this.options.display)return;const e=this._computeTitleHeight(),{legendHitBoxes:s,options:{align:n,labels:{padding:i},rtl:o}}=this,a=Ot(o,this.left,this.width);if(this.isHorizontal()){let r=0,l=Pe(n,this.left+i,this.right-this.lineWidths[r]);for(const c of s)r!==c.row&&(r=c.row,l=Pe(n,this.left+i,this.right-this.lineWidths[r])),c.top+=this.top+e+i,c.left=a.leftForLtr(a.x(l),c.width),l+=c.width+i}else{let r=0,l=Pe(n,this.top+e+i,this.bottom-this.columnSizes[r].height);for(const c of s)c.col!==r&&(r=c.col,l=Pe(n,this.top+e+i,this.bottom-this.columnSizes[r].height)),c.top=l,c.left+=this.left+i,c.left=a.leftForLtr(a.x(c.left),c.width),l+=c.height+i}}isHorizontal(){return this.options.position==="top"||this.options.position==="bottom"}draw(){if(this.options.display){const e=this.ctx;yi(e,this),this._draw(),xi(e)}}_draw(){const{options:e,columnSizes:s,lineWidths:n,ctx:i}=this,{align:o,labels:a}=e,r=me.color,l=Ot(e.rtl,this.left,this.width),c=De(a.font),{padding:u}=a,d=c.size,h=d/2;let f;this.drawTitle(),i.textAlign=l.textAlign("left"),i.textBaseline="middle",i.lineWidth=.5,i.font=c.string;const{boxWidth:p,boxHeight:g,itemHeight:m}=Yo(a,d),y=function(O,R,E){if(isNaN(p)||p<=0||isNaN(g)||g<0)return;i.save();const z=ee(E.lineWidth,1);if(i.fillStyle=ee(E.fillStyle,r),i.lineCap=ee(E.lineCap,"butt"),i.lineDashOffset=ee(E.lineDashOffset,0),i.lineJoin=ee(E.lineJoin,"miter"),i.lineWidth=z,i.strokeStyle=ee(E.strokeStyle,r),i.setLineDash(ee(E.lineDash,[])),a.usePointStyle){const j={radius:g*Math.SQRT2/2,pointStyle:E.pointStyle,rotation:E.rotation,borderWidth:z},G=l.xPlus(O,p/2),L=R+h;tr(i,j,G,L,a.pointStyleWidth&&p)}else{const j=R+Math.max((d-g)/2,0),G=l.leftForLtr(O,p),L=ds(E.borderRadius);i.beginPath(),Object.values(L).some(F=>F!==0)?qn(i,{x:G,y:j,w:p,h:g,radius:L}):i.rect(G,j,p,g),i.fill(),z!==0&&i.stroke()}i.restore()},b=function(O,R,E){xs(i,E.text,O,R+m/2,c,{strikethrough:E.hidden,textAlign:l.textAlign(E.textAlign)})},k=this.isHorizontal(),P=this._computeTitleHeight();k?f={x:Pe(o,this.left+u,this.right-n[0]),y:this.top+u+P,line:0}:f={x:this.left+u,y:Pe(o,this.top+P+u,this.bottom-s[0].height),line:0},rr(this.ctx,e.textDirection);const C=m+u;this.legendItems.forEach((O,R)=>{i.strokeStyle=O.fontColor,i.fillStyle=O.fontColor;const E=i.measureText(O.text).width,z=l.textAlign(O.textAlign||(O.textAlign=a.textAlign)),j=p+h+E;let G=f.x,L=f.y;l.setWidth(this.width),k?R>0&&G+j+u>this.right&&(L=f.y+=C,f.line++,G=f.x=Pe(o,this.left+u,this.right-n[f.line])):R>0&&L+C>this.bottom&&(G=f.x=G+s[f.line].width+u,f.line++,L=f.y=Pe(o,this.top+P+u,this.bottom-s[f.line].height));const F=l.x(G);if(y(F,L,O),G=Sf(z,G+p+h,k?G+j:this.right,e.rtl),b(l.x(G),L,O),k)f.x+=j+u;else if(typeof O.text!="string"){const he=c.lineHeight;f.y+=Sr(O,he)+u}else f.y+=C}),lr(this.ctx,e.textDirection)}drawTitle(){const e=this.options,s=e.title,n=De(s.font),i=Ue(s.padding);if(!s.display)return;const o=Ot(e.rtl,this.left,this.width),a=this.ctx,r=s.position,l=n.size/2,c=i.top+l;let u,d=this.left,h=this.width;if(this.isHorizontal())h=Math.max(...this.lineWidths),u=this.top+c,d=Pe(e.align,d,this.right-h);else{const p=this.columnSizes.reduce((g,m)=>Math.max(g,m.height),0);u=c+Pe(e.align,this.top,this.bottom-p-e.labels.padding-this._computeTitleHeight())}const f=Pe(r,d,d+h);a.textAlign=o.textAlign(_i(r)),a.textBaseline="middle",a.strokeStyle=s.color,a.fillStyle=s.color,a.font=n.string,xs(a,s.text,f,u,n)}_computeTitleHeight(){const e=this.options.title,s=De(e.font),n=Ue(e.padding);return e.display?s.lineHeight+n.height:0}_getLegendItemAt(e,s){let n,i,o;if(Lt(e,this.left,this.right)&&Lt(s,this.top,this.bottom)){for(o=this.legendHitBoxes,n=0;n<o.length;++n)if(i=o[n],Lt(e,i.left,i.left+i.width)&&Lt(s,i.top,i.top+i.height))return this.legendItems[n]}return null}handleEvent(e){const s=this.options;if(!vm(e.type,s))return;const n=this._getLegendItemAt(e.x,e.y);if(e.type==="mousemove"||e.type==="mouseout"){const i=this._hoveredItem,o=pm(i,n);i&&!o&&fe(s.onLeave,[e,i,this],this),this._hoveredItem=n,n&&!o&&fe(s.onHover,[e,n,this],this)}else n&&fe(s.onClick,[e,n,this],this)}}function gm(t,e,s,n,i){const o=mm(n,t,e,s),a=_m(i,n,e.lineHeight);return{itemWidth:o,itemHeight:a}}function mm(t,e,s,n){let i=t.text;return i&&typeof i!="string"&&(i=i.reduce((o,a)=>o.length>a.length?o:a)),e+s.size/2+n.measureText(i).width}function _m(t,e,s){let n=t;return typeof e.text!="string"&&(n=Sr(e,s)),n}function Sr(t,e){const s=t.text?t.text.length:0;return e*s}function vm(t,e){return!!((t==="mousemove"||t==="mouseout")&&(e.onHover||e.onLeave)||e.onClick&&(t==="click"||t==="mouseup"))}var bm={id:"legend",_element:Xo,start(t,e,s){const n=t.legend=new Xo({ctx:t.ctx,options:s,chart:t});Be.configure(t,n,s),Be.addBox(t,n)},stop(t){Be.removeBox(t,t.legend),delete t.legend},beforeUpdate(t,e,s){const n=t.legend;Be.configure(t,n,s),n.options=s},afterUpdate(t){const e=t.legend;e.buildLabels(),e.adjustHitBoxes()},afterEvent(t,e){e.replay||t.legend.handleEvent(e.event)},defaults:{display:!0,position:"top",align:"center",fullSize:!0,reverse:!1,weight:1e3,onClick(t,e,s){const n=e.datasetIndex,i=s.chart;i.isDatasetVisible(n)?(i.hide(n),e.hidden=!0):(i.show(n),e.hidden=!1)},onHover:null,onLeave:null,labels:{color:t=>t.chart.options.color,boxWidth:40,padding:10,generateLabels(t){const e=t.data.datasets,{labels:{usePointStyle:s,pointStyle:n,textAlign:i,color:o,useBorderRadius:a,borderRadius:r}}=t.legend.options;return t._getSortedDatasetMetas().map(l=>{const c=l.controller.getStyle(s?0:void 0),u=Ue(c.borderWidth);return{text:e[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:n||c.pointStyle,rotation:c.rotation,textAlign:i||c.textAlign,borderRadius:a&&(r||c.borderRadius),datasetIndex:l.index}},this)}},title:{color:t=>t.chart.options.color,display:!1,position:"center",text:""}},descriptors:{_scriptable:t=>!t.startsWith("on"),labels:{_scriptable:t=>!["generateLabels","filter","sort"].includes(t)}}};class kr extends Qe{constructor(e){super(),this.chart=e.chart,this.options=e.options,this.ctx=e.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(e,s){const n=this.options;if(this.left=0,this.top=0,!n.display){this.width=this.height=this.right=this.bottom=0;return}this.width=this.right=e,this.height=this.bottom=s;const i=xe(n.text)?n.text.length:1;this._padding=Ue(n.padding);const o=i*De(n.font).lineHeight+this._padding.height;this.isHorizontal()?this.height=o:this.width=o}isHorizontal(){const e=this.options.position;return e==="top"||e==="bottom"}_drawArgs(e){const{top:s,left:n,bottom:i,right:o,options:a}=this,r=a.align;let l=0,c,u,d;return this.isHorizontal()?(u=Pe(r,n,o),d=s+e,c=o-n):(a.position==="left"?(u=n+e,d=Pe(r,i,s),l=ge*-.5):(u=o-e,d=Pe(r,s,i),l=ge*.5),c=i-s),{titleX:u,titleY:d,maxWidth:c,rotation:l}}draw(){const e=this.ctx,s=this.options;if(!s.display)return;const n=De(s.font),o=n.lineHeight/2+this._padding.top,{titleX:a,titleY:r,maxWidth:l,rotation:c}=this._drawArgs(o);xs(e,s.text,0,0,n,{color:s.color,maxWidth:l,rotation:c,textAlign:_i(s.align),textBaseline:"middle",translation:[a,r]})}}function ym(t,e){const s=new kr({ctx:t.ctx,options:e,chart:t});Be.configure(t,s,e),Be.addBox(t,s),t.titleBlock=s}var xm={id:"title",_element:kr,start(t,e,s){ym(t,s)},stop(t){const e=t.titleBlock;Be.removeBox(t,e),delete t.titleBlock},beforeUpdate(t,e,s){const n=t.titleBlock;Be.configure(t,n,s),n.options=s},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 ns={average(t){if(!t.length)return!1;let e,s,n=new Set,i=0,o=0;for(e=0,s=t.length;e<s;++e){const r=t[e].element;if(r&&r.hasValue()){const l=r.tooltipPosition();n.add(l.x),i+=l.y,++o}}return o===0||n.size===0?!1:{x:[...n].reduce((r,l)=>r+l)/n.size,y:i/o}},nearest(t,e){if(!t.length)return!1;let s=e.x,n=e.y,i=Number.POSITIVE_INFINITY,o,a,r;for(o=0,a=t.length;o<a;++o){const l=t[o].element;if(l&&l.hasValue()){const c=l.getCenterPoint(),u=jn(e,c);u<i&&(i=u,r=l)}}if(r){const l=r.tooltipPosition();s=l.x,n=l.y}return{x:s,y:n}}};function Xe(t,e){return e&&(xe(e)?Array.prototype.push.apply(t,e):t.push(e)),t}function st(t){return(typeof t=="string"||t instanceof String)&&t.indexOf(` 26 26 `)>-1?t.split(` 27 `):t}function wm(t,e){const{element:s,datasetIndex:n,index:i}=e,o=t.getDatasetMeta(n).controller,{label:a,value:r}=o.getLabelAndValue(i);return{chart:t,label:a,parsed:o.getParsed(i),raw:t.data.datasets[n].data[i],formattedValue:r,dataset:o.getDataset(),dataIndex:i,datasetIndex:n,element:s}}function Ko(t,e){const s=t.chart.ctx,{body:n,footer:i,title:o}=t,{boxWidth:a,boxHeight:r}=e,l=De(e.bodyFont),c=De(e.titleFont),u=De(e.footerFont),d=o.length,h=i.length,f=n.length,p=Ue(e.padding);let g=p.height,m=0,y=n.reduce((P,C)=>P+C.before.length+C.lines.length+C.after.length,0);if(y+=t.beforeBody.length+t.afterBody.length,d&&(g+=d*c.lineHeight+(d-1)*e.titleSpacing+e.titleMarginBottom),y){const P=e.displayColors?Math.max(r,l.lineHeight):l.lineHeight;g+=f*P+(y-f)*l.lineHeight+(y-1)*e.bodySpacing}h&&(g+=e.footerMarginTop+h*u.lineHeight+(h-1)*e.footerSpacing);let v=0;const k=function(P){m=Math.max(m,s.measureText(P).width+v)};return s.save(),s.font=c.string,re(t.title,k),s.font=l.string,re(t.beforeBody.concat(t.afterBody),k),v=e.displayColors?a+2+e.boxPadding:0,re(n,P=>{re(P.before,k),re(P.lines,k),re(P.after,k)}),v=0,s.font=u.string,re(t.footer,k),s.restore(),m+=p.width,{width:m,height:g}}function Sm(t,e){const{y:s,height:n}=e;return s<n/2?"top":s>t.height-n/2?"bottom":"center"}function km(t,e,s,n){const{x:i,width:o}=n,a=s.caretSize+s.caretPadding;if(t==="left"&&i+o+a>e.width||t==="right"&&i-o-a<0)return!0}function Cm(t,e,s,n){const{x:i,width:o}=s,{width:a,chartArea:{left:r,right:l}}=t;let c="center";return n==="center"?c=i<=(r+l)/2?"left":"right":i<=o/2?c="left":i>=a-o/2&&(c="right"),km(c,t,e,s)&&(c="center"),c}function Qo(t,e,s){const n=s.yAlign||e.yAlign||Sm(t,s);return{xAlign:s.xAlign||e.xAlign||Cm(t,e,s,n),yAlign:n}}function Pm(t,e){let{x:s,width:n}=t;return e==="right"?s-=n:e==="center"&&(s-=n/2),s}function Dm(t,e,s){let{y:n,height:i}=t;return e==="top"?n+=s:e==="bottom"?n-=i+s:n-=i/2,n}function Zo(t,e,s,n){const{caretSize:i,caretPadding:o,cornerRadius:a}=t,{xAlign:r,yAlign:l}=s,c=i+o,{topLeft:u,topRight:d,bottomLeft:h,bottomRight:f}=ds(a);let p=Pm(e,r);const g=Dm(e,l,c);return l==="center"?r==="left"?p+=c:r==="right"&&(p-=c):r==="left"?p-=Math.max(u,h)+i:r==="right"&&(p+=Math.max(d,f)+i),{x:Re(p,0,n.width-e.width),y:Re(g,0,n.height-e.height)}}function zs(t,e,s){const n=Ue(s.padding);return e==="center"?t.x+t.width/2:e==="right"?t.x+t.width-n.right:t.x+n.left}function Jo(t){return Xe([],st(t))}function Rm(t,e,s){return Ct(t,{tooltip:e,tooltipItems:s,type:"tooltip"})}function ea(t,e){const s=e&&e.dataset&&e.dataset.tooltip&&e.dataset.tooltip.callbacks;return s?t.override(s):t}const Cr={beforeTitle:et,title(t){if(t.length>0){const e=t[0],s=e.chart.data.labels,n=s?s.length:0;if(this&&this.options&&this.options.mode==="dataset")return e.dataset.label||"";if(e.label)return e.label;if(n>0&&e.dataIndex<n)return s[e.dataIndex]}return""},afterTitle:et,beforeBody:et,beforeLabel:et,label(t){if(this&&this.options&&this.options.mode==="dataset")return t.label+": "+t.formattedValue||t.formattedValue;let e=t.dataset.label||"";e&&(e+=": ");const s=t.formattedValue;return de(s)||(e+=s),e},labelColor(t){const s=t.chart.getDatasetMeta(t.datasetIndex).controller.getStyle(t.dataIndex);return{borderColor:s.borderColor,backgroundColor:s.backgroundColor,borderWidth:s.borderWidth,borderDash:s.borderDash,borderDashOffset:s.borderDashOffset,borderRadius:0}},labelTextColor(){return this.options.bodyColor},labelPointStyle(t){const s=t.chart.getDatasetMeta(t.datasetIndex).controller.getStyle(t.dataIndex);return{pointStyle:s.pointStyle,rotation:s.rotation}},afterLabel:et,afterBody:et,beforeFooter:et,footer:et,afterFooter:et};function Ee(t,e,s,n){const i=t[e].call(s,n);return typeof i>"u"?Cr[e].call(s,n):i}class Zn extends Qe{constructor(e){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=e.chart,this.options=e.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(e){this.options=e,this._cachedAnimations=void 0,this.$context=void 0}_resolveAnimations(){const e=this._cachedAnimations;if(e)return e;const s=this.chart,n=this.options.setContext(this.getContext()),i=n.enabled&&s.options.animation&&n.animations,o=new ur(this.chart,i);return i._cacheable&&(this._cachedAnimations=Object.freeze(o)),o}getContext(){return this.$context||(this.$context=Rm(this.chart.getContext(),this,this._tooltipItems))}getTitle(e,s){const{callbacks:n}=s,i=Ee(n,"beforeTitle",this,e),o=Ee(n,"title",this,e),a=Ee(n,"afterTitle",this,e);let r=[];return r=Xe(r,st(i)),r=Xe(r,st(o)),r=Xe(r,st(a)),r}getBeforeBody(e,s){return Jo(Ee(s.callbacks,"beforeBody",this,e))}getBody(e,s){const{callbacks:n}=s,i=[];return re(e,o=>{const a={before:[],lines:[],after:[]},r=ea(n,o);Xe(a.before,st(Ee(r,"beforeLabel",this,o))),Xe(a.lines,Ee(r,"label",this,o)),Xe(a.after,st(Ee(r,"afterLabel",this,o))),i.push(a)}),i}getAfterBody(e,s){return Jo(Ee(s.callbacks,"afterBody",this,e))}getFooter(e,s){const{callbacks:n}=s,i=Ee(n,"beforeFooter",this,e),o=Ee(n,"footer",this,e),a=Ee(n,"afterFooter",this,e);let r=[];return r=Xe(r,st(i)),r=Xe(r,st(o)),r=Xe(r,st(a)),r}_createItems(e){const s=this._active,n=this.chart.data,i=[],o=[],a=[];let r=[],l,c;for(l=0,c=s.length;l<c;++l)r.push(wm(this.chart,s[l]));return e.filter&&(r=r.filter((u,d,h)=>e.filter(u,d,h,n))),e.itemSort&&(r=r.sort((u,d)=>e.itemSort(u,d,n))),re(r,u=>{const d=ea(e.callbacks,u);i.push(Ee(d,"labelColor",this,u)),o.push(Ee(d,"labelPointStyle",this,u)),a.push(Ee(d,"labelTextColor",this,u))}),this.labelColors=i,this.labelPointStyles=o,this.labelTextColors=a,this.dataPoints=r,r}update(e,s){const n=this.options.setContext(this.getContext()),i=this._active;let o,a=[];if(!i.length)this.opacity!==0&&(o={opacity:0});else{const r=ns[n.position].call(this,i,this._eventPosition);a=this._createItems(n),this.title=this.getTitle(a,n),this.beforeBody=this.getBeforeBody(a,n),this.body=this.getBody(a,n),this.afterBody=this.getAfterBody(a,n),this.footer=this.getFooter(a,n);const l=this._size=Ko(this,n),c=Object.assign({},r,l),u=Qo(this.chart,n,c),d=Zo(n,c,u,this.chart);this.xAlign=u.xAlign,this.yAlign=u.yAlign,o={opacity:1,x:d.x,y:d.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),e&&n.external&&n.external.call(this,{chart:this.chart,tooltip:this,replay:s})}drawCaret(e,s,n,i){const o=this.getCaretPosition(e,n,i);s.lineTo(o.x1,o.y1),s.lineTo(o.x2,o.y2),s.lineTo(o.x3,o.y3)}getCaretPosition(e,s,n){const{xAlign:i,yAlign:o}=this,{caretSize:a,cornerRadius:r}=n,{topLeft:l,topRight:c,bottomLeft:u,bottomRight:d}=ds(r),{x:h,y:f}=e,{width:p,height:g}=s;let m,y,v,k,P,C;return o==="center"?(P=f+g/2,i==="left"?(m=h,y=m-a,k=P+a,C=P-a):(m=h+p,y=m+a,k=P-a,C=P+a),v=m):(i==="left"?y=h+Math.max(l,u)+a:i==="right"?y=h+p-Math.max(c,d)-a:y=this.caretX,o==="top"?(k=f,P=k-a,m=y-a,v=y+a):(k=f+g,P=k+a,m=y+a,v=y-a),C=k),{x1:m,x2:y,x3:v,y1:k,y2:P,y3:C}}drawTitle(e,s,n){const i=this.title,o=i.length;let a,r,l;if(o){const c=Ot(n.rtl,this.x,this.width);for(e.x=zs(this,n.titleAlign,n),s.textAlign=c.textAlign(n.titleAlign),s.textBaseline="middle",a=De(n.titleFont),r=n.titleSpacing,s.fillStyle=n.titleColor,s.font=a.string,l=0;l<o;++l)s.fillText(i[l],c.x(e.x),e.y+a.lineHeight/2),e.y+=a.lineHeight+r,l+1===o&&(e.y+=n.titleMarginBottom-r)}}_drawColorBox(e,s,n,i,o){const a=this.labelColors[n],r=this.labelPointStyles[n],{boxHeight:l,boxWidth:c}=o,u=De(o.bodyFont),d=zs(this,"left",o),h=i.x(d),f=l<u.lineHeight?(u.lineHeight-l)/2:0,p=s.y+f;if(o.usePointStyle){const g={radius:Math.min(c,l)/2,pointStyle:r.pointStyle,rotation:r.rotation,borderWidth:1},m=i.leftForLtr(h,c)+c/2,y=p+l/2;e.strokeStyle=o.multiKeyBackground,e.fillStyle=o.multiKeyBackground,Gn(e,g,m,y),e.strokeStyle=a.borderColor,e.fillStyle=a.backgroundColor,Gn(e,g,m,y)}else{e.lineWidth=oe(a.borderWidth)?Math.max(...Object.values(a.borderWidth)):a.borderWidth||1,e.strokeStyle=a.borderColor,e.setLineDash(a.borderDash||[]),e.lineDashOffset=a.borderDashOffset||0;const g=i.leftForLtr(h,c),m=i.leftForLtr(i.xPlus(h,1),c-2),y=ds(a.borderRadius);Object.values(y).some(v=>v!==0)?(e.beginPath(),e.fillStyle=o.multiKeyBackground,qn(e,{x:g,y:p,w:c,h:l,radius:y}),e.fill(),e.stroke(),e.fillStyle=a.backgroundColor,e.beginPath(),qn(e,{x:m,y:p+1,w:c-2,h:l-2,radius:y}),e.fill()):(e.fillStyle=o.multiKeyBackground,e.fillRect(g,p,c,l),e.strokeRect(g,p,c,l),e.fillStyle=a.backgroundColor,e.fillRect(m,p+1,c-2,l-2))}e.fillStyle=this.labelTextColors[n]}drawBody(e,s,n){const{body:i}=this,{bodySpacing:o,bodyAlign:a,displayColors:r,boxHeight:l,boxWidth:c,boxPadding:u}=n,d=De(n.bodyFont);let h=d.lineHeight,f=0;const p=Ot(n.rtl,this.x,this.width),g=function(E){s.fillText(E,p.x(e.x+f),e.y+h/2),e.y+=h+o},m=p.textAlign(a);let y,v,k,P,C,O,R;for(s.textAlign=a,s.textBaseline="middle",s.font=d.string,e.x=zs(this,m,n),s.fillStyle=n.bodyColor,re(this.beforeBody,g),f=r&&m!=="right"?a==="center"?c/2+u:c+2+u:0,P=0,O=i.length;P<O;++P){for(y=i[P],v=this.labelTextColors[P],s.fillStyle=v,re(y.before,g),k=y.lines,r&&k.length&&(this._drawColorBox(s,e,P,p,n),h=Math.max(d.lineHeight,l)),C=0,R=k.length;C<R;++C)g(k[C]),h=d.lineHeight;re(y.after,g)}f=0,h=d.lineHeight,re(this.afterBody,g),e.y-=o}drawFooter(e,s,n){const i=this.footer,o=i.length;let a,r;if(o){const l=Ot(n.rtl,this.x,this.width);for(e.x=zs(this,n.footerAlign,n),e.y+=n.footerMarginTop,s.textAlign=l.textAlign(n.footerAlign),s.textBaseline="middle",a=De(n.footerFont),s.fillStyle=n.footerColor,s.font=a.string,r=0;r<o;++r)s.fillText(i[r],l.x(e.x),e.y+a.lineHeight/2),e.y+=a.lineHeight+n.footerSpacing}}drawBackground(e,s,n,i){const{xAlign:o,yAlign:a}=this,{x:r,y:l}=e,{width:c,height:u}=n,{topLeft:d,topRight:h,bottomLeft:f,bottomRight:p}=ds(i.cornerRadius);s.fillStyle=i.backgroundColor,s.strokeStyle=i.borderColor,s.lineWidth=i.borderWidth,s.beginPath(),s.moveTo(r+d,l),a==="top"&&this.drawCaret(e,s,n,i),s.lineTo(r+c-h,l),s.quadraticCurveTo(r+c,l,r+c,l+h),a==="center"&&o==="right"&&this.drawCaret(e,s,n,i),s.lineTo(r+c,l+u-p),s.quadraticCurveTo(r+c,l+u,r+c-p,l+u),a==="bottom"&&this.drawCaret(e,s,n,i),s.lineTo(r+f,l+u),s.quadraticCurveTo(r,l+u,r,l+u-f),a==="center"&&o==="left"&&this.drawCaret(e,s,n,i),s.lineTo(r,l+d),s.quadraticCurveTo(r,l,r+d,l),s.closePath(),s.fill(),i.borderWidth>0&&s.stroke()}_updateAnimationTarget(e){const s=this.chart,n=this.$animations,i=n&&n.x,o=n&&n.y;if(i||o){const a=ns[e.position].call(this,this._active,this._eventPosition);if(!a)return;const r=this._size=Ko(this,e),l=Object.assign({},a,this._size),c=Qo(s,e,l),u=Zo(e,l,c,s);(i._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(e){const s=this.options.setContext(this.getContext());let n=this.opacity;if(!n)return;this._updateAnimationTarget(s);const i={width:this.width,height:this.height},o={x:this.x,y:this.y};n=Math.abs(n)<.001?0:n;const a=Ue(s.padding),r=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;s.enabled&&r&&(e.save(),e.globalAlpha=n,this.drawBackground(o,e,i,s),rr(e,s.textDirection),o.y+=a.top,this.drawTitle(o,e,s),this.drawBody(o,e,s),this.drawFooter(o,e,s),lr(e,s.textDirection),e.restore())}getActiveElements(){return this._active||[]}setActiveElements(e,s){const n=this._active,i=e.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=!Xs(n,i),a=this._positionChanged(i,s);(o||a)&&(this._active=i,this._eventPosition=s,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(e,s,n=!0){if(s&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;const i=this.options,o=this._active||[],a=this._getActiveElements(e,o,s,n),r=this._positionChanged(a,e),l=s||!Xs(a,o)||r;return l&&(this._active=a,(i.enabled||i.external)&&(this._eventPosition={x:e.x,y:e.y},this.update(!0,s))),l}_getActiveElements(e,s,n,i){const o=this.options;if(e.type==="mouseout")return[];if(!i)return s.filter(r=>this.chart.data.datasets[r.datasetIndex]&&this.chart.getDatasetMeta(r.datasetIndex).controller.getParsed(r.index)!==void 0);const a=this.chart.getElementsAtEventForMode(e,o.mode,o,n);return o.reverse&&a.reverse(),a}_positionChanged(e,s){const{caretX:n,caretY:i,options:o}=this,a=ns[o.position].call(this,e,s);return a!==!1&&(n!==a.x||i!==a.y)}}N(Zn,"positioners",ns);var Mm={id:"tooltip",_element:Zn,positioners:ns,afterInit(t,e,s){s&&(t.tooltip=new Zn({chart:t,options:s}))},beforeUpdate(t,e,s){t.tooltip&&t.tooltip.initialize(s)},reset(t,e,s){t.tooltip&&t.tooltip.initialize(s)},afterDraw(t){const e=t.tooltip;if(e&&e._willRender()){const s={tooltip:e};if(t.notifyPlugins("beforeTooltipDraw",{...s,cancelable:!0})===!1)return;e.draw(t.ctx),t.notifyPlugins("afterTooltipDraw",s)}},afterEvent(t,e){if(t.tooltip){const s=e.replay;t.tooltip.handleEvent(e.event,s,e.inChartArea)&&(e.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:(t,e)=>e.bodyFont.size,boxWidth:(t,e)=>e.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:Cr},defaultRoutes:{bodyFont:"font",footerFont:"font",titleFont:"font"},descriptors:{_scriptable:t=>t!=="filter"&&t!=="itemSort"&&t!=="external",_indexable:!1,callbacks:{_scriptable:!1,_indexable:!1},animation:{_fallback:!1},animations:{_fallback:"animation"}},additionalOptionScopes:["interaction"]};const Am=(t,e,s,n)=>(typeof e=="string"?(s=t.push(e)-1,n.unshift({index:s,label:e})):isNaN(e)&&(s=null),s);function Tm(t,e,s,n){const i=t.indexOf(e);if(i===-1)return Am(t,e,s,n);const o=t.lastIndexOf(e);return i!==o?s:i}const Em=(t,e)=>t===null?null:Re(Math.round(t),0,e);function ta(t){const e=this.getLabels();return t>=0&&t<e.length?e[t]:t}class Jn extends jt{constructor(e){super(e),this._startValue=void 0,this._valueRange=0,this._addedLabels=[]}init(e){const s=this._addedLabels;if(s.length){const n=this.getLabels();for(const{index:i,label:o}of s)n[i]===o&&n.splice(i,1);this._addedLabels=[]}super.init(e)}parse(e,s){if(de(e))return null;const n=this.getLabels();return s=isFinite(s)&&n[s]===e?s:Tm(n,e,ee(s,e),this._addedLabels),Em(s,n.length-1)}determineDataLimits(){const{minDefined:e,maxDefined:s}=this.getUserBounds();let{min:n,max:i}=this.getMinMax(!0);this.options.bounds==="ticks"&&(e||(n=0),s||(i=this.getLabels().length-1)),this.min=n,this.max=i}buildTicks(){const e=this.min,s=this.max,n=this.options.offset,i=[];let o=this.getLabels();o=e===0&&s===o.length-1?o:o.slice(e,s+1),this._valueRange=Math.max(o.length-(n?0:1),1),this._startValue=this.min-(n?.5:0);for(let a=e;a<=s;a++)i.push({value:a});return i}getLabelForValue(e){return ta.call(this,e)}configure(){super.configure(),this.isHorizontal()||(this._reversePixels=!this._reversePixels)}getPixelForValue(e){return typeof e!="number"&&(e=this.parse(e)),e===null?NaN:this.getPixelForDecimal((e-this._startValue)/this._valueRange)}getPixelForTick(e){const s=this.ticks;return e<0||e>s.length-1?null:this.getPixelForValue(s[e].value)}getValueForPixel(e){return Math.round(this._startValue+this.getDecimalForPixel(e)*this._valueRange)}getBasePixel(){return this.bottom}}N(Jn,"id","category"),N(Jn,"defaults",{ticks:{callback:ta}});function Lm(t,e){const s=[],{bounds:i,step:o,min:a,max:r,precision:l,count:c,maxTicks:u,maxDigits:d,includeBounds:h}=t,f=o||1,p=u-1,{min:g,max:m}=e,y=!de(a),v=!de(r),k=!de(c),P=(m-g)/(d+1);let C=oo((m-g)/p/f)*f,O,R,E,z;if(C<1e-14&&!y&&!v)return[{value:g},{value:m}];z=Math.ceil(m/C)-Math.floor(g/C),z>p&&(C=oo(z*C/p/f)*f),de(l)||(O=Math.pow(10,l),C=Math.ceil(C*O)/O),i==="ticks"?(R=Math.floor(g/C)*C,E=Math.ceil(m/C)*C):(R=g,E=m),y&&v&&o&&ff((r-a)/o,C/1e3)?(z=Math.round(Math.min((r-a)/C,u)),C=(r-a)/z,R=a,E=r):k?(R=y?a:R,E=v?r:E,z=c-1,C=(E-R)/z):(z=(E-R)/C,ls(z,Math.round(z),C/1e3)?z=Math.round(z):z=Math.ceil(z));const j=Math.max(ao(C),ao(R));O=Math.pow(10,de(l)?j:l),R=Math.round(R*O)/O,E=Math.round(E*O)/O;let G=0;for(y&&(h&&R!==a?(s.push({value:a}),R<a&&G++,ls(Math.round((R+G*C)*O)/O,a,sa(a,P,t))&&G++):R<a&&G++);G<z;++G){const L=Math.round((R+G*C)*O)/O;if(v&&L>r)break;s.push({value:L})}return v&&h&&E!==r?s.length&&ls(s[s.length-1].value,r,sa(r,P,t))?s[s.length-1].value=r:s.push({value:r}):(!v||E===r)&&s.push({value:E}),s}function sa(t,e,{horizontal:s,minRotation:n}){const i=it(n),o=(s?Math.sin(i):Math.cos(i))||.001,a=.75*e*(""+t).length;return Math.min(e/o,a)}class Om extends jt{constructor(e){super(e),this.start=void 0,this.end=void 0,this._startValue=void 0,this._endValue=void 0,this._valueRange=0}parse(e,s){return de(e)||(typeof e=="number"||e instanceof Number)&&!isFinite(+e)?null:+e}handleTickRangeOptions(){const{beginAtZero:e}=this.options,{minDefined:s,maxDefined:n}=this.getUserBounds();let{min:i,max:o}=this;const a=l=>i=s?i:l,r=l=>o=n?o:l;if(e){const l=Bt(i),c=Bt(o);l<0&&c<0?r(0):l>0&&c>0&&a(0)}if(i===o){let l=o===0?1:Math.abs(o*.05);r(o+l),e||a(i-l)}this.min=i,this.max=o}getTickLimit(){const e=this.options.ticks;let{maxTicksLimit:s,stepSize:n}=e,i;return n?(i=Math.ceil(this.max/n)-Math.floor(this.min/n)+1,i>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${n} would result generating up to ${i} ticks. Limiting to 1000.`),i=1e3)):(i=this.computeTickLimit(),s=s||11),s&&(i=Math.min(s,i)),i}computeTickLimit(){return Number.POSITIVE_INFINITY}buildTicks(){const e=this.options,s=e.ticks;let n=this.getTickLimit();n=Math.max(2,n);const i={maxTicks:n,bounds:e.bounds,min:e.min,max:e.max,precision:s.precision,step:s.stepSize,count:s.count,maxDigits:this._maxDigits(),horizontal:this.isHorizontal(),minRotation:s.minRotation||0,includeBounds:s.includeBounds!==!1},o=this._range||this,a=Lm(i,o);return e.bounds==="ticks"&&pf(a,this,"value"),e.reverse?(a.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),a}configure(){const e=this.ticks;let s=this.min,n=this.max;if(super.configure(),this.options.offset&&e.length){const i=(n-s)/Math.max(e.length-1,1)/2;s-=i,n+=i}this._startValue=s,this._endValue=n,this._valueRange=n-s}getLabelForValue(e){return bi(e,this.chart.options.locale,this.options.ticks.format)}}class ei extends Om{determineDataLimits(){const{min:e,max:s}=this.getMinMax(!0);this.min=Ne(e)?e:0,this.max=Ne(s)?s:1,this.handleTickRangeOptions()}computeTickLimit(){const e=this.isHorizontal(),s=e?this.width:this.height,n=it(this.options.ticks.minRotation),i=(e?Math.sin(n):Math.cos(n))||.001,o=this._resolveTickFontOptions(0);return Math.ceil(s/Math.min(40,o.lineHeight/i))}getPixelForValue(e){return e===null?NaN:this.getPixelForDecimal((e-this._startValue)/this._valueRange)}getValueForPixel(e){return this._startValue+this.getDecimalForPixel(e)*this._valueRange}}N(ei,"id","linear"),N(ei,"defaults",{ticks:{callback:er.formatters.numeric}});const hn={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}},Oe=Object.keys(hn);function na(t,e){return t-e}function ia(t,e){if(de(e))return null;const s=t._adapter,{parser:n,round:i,isoWeekday:o}=t._parseOpts;let a=e;return typeof n=="function"&&(a=n(a)),Ne(a)||(a=typeof n=="string"?s.parse(a,n):s.parse(a)),a===null?null:(i&&(a=i==="week"&&(vs(o)||o===!0)?s.startOf(a,"isoWeek",o):s.startOf(a,i)),+a)}function oa(t,e,s,n){const i=Oe.length;for(let o=Oe.indexOf(t);o<i-1;++o){const a=hn[Oe[o]],r=a.steps?a.steps:Number.MAX_SAFE_INTEGER;if(a.common&&Math.ceil((s-e)/(r*a.size))<=n)return Oe[o]}return Oe[i-1]}function Im(t,e,s,n,i){for(let o=Oe.length-1;o>=Oe.indexOf(s);o--){const a=Oe[o];if(hn[a].common&&t._adapter.diff(i,n,a)>=e-1)return a}return Oe[s?Oe.indexOf(s):0]}function Fm(t){for(let e=Oe.indexOf(t)+1,s=Oe.length;e<s;++e)if(hn[Oe[e]].common)return Oe[e]}function aa(t,e,s){if(!s)t[e]=!0;else if(s.length){const{lo:n,hi:i}=mi(s,e),o=s[n]>=e?s[n]:s[i];t[o]=!0}}function Vm(t,e,s,n){const i=t._adapter,o=+i.startOf(e[0].value,n),a=e[e.length-1].value;let r,l;for(r=o;r<=a;r=+i.add(r,1,n))l=s[r],l>=0&&(e[l].major=!0);return e}function ra(t,e,s){const n=[],i={},o=e.length;let a,r;for(a=0;a<o;++a)r=e[a],i[r]=a,n.push({value:r,major:!1});return o===0||!s?n:Vm(t,n,i,s)}class sn extends jt{constructor(e){super(e),this._cache={data:[],labels:[],all:[]},this._unit="day",this._majorUnit=void 0,this._offsets={},this._normalized=!1,this._parseOpts=void 0}init(e,s={}){const n=e.time||(e.time={}),i=this._adapter=new Wp._date(e.adapters.date);i.init(s),rs(n.displayFormats,i.formats()),this._parseOpts={parser:n.parser,round:n.round,isoWeekday:n.isoWeekday},super.init(e),this._normalized=s.normalized}parse(e,s){return e===void 0?null:ia(this,e)}beforeLayout(){super.beforeLayout(),this._cache={data:[],labels:[],all:[]}}determineDataLimits(){const e=this.options,s=this._adapter,n=e.time.unit||"day";let{min:i,max:o,minDefined:a,maxDefined:r}=this.getUserBounds();function l(c){!a&&!isNaN(c.min)&&(i=Math.min(i,c.min)),!r&&!isNaN(c.max)&&(o=Math.max(o,c.max))}(!a||!r)&&(l(this._getLabelBounds()),(e.bounds!=="ticks"||e.ticks.source!=="labels")&&l(this.getMinMax(!1))),i=Ne(i)&&!isNaN(i)?i:+s.startOf(Date.now(),n),o=Ne(o)&&!isNaN(o)?o:+s.endOf(Date.now(),n)+1,this.min=Math.min(i,o-1),this.max=Math.max(i+1,o)}_getLabelBounds(){const e=this.getLabelTimestamps();let s=Number.POSITIVE_INFINITY,n=Number.NEGATIVE_INFINITY;return e.length&&(s=e[0],n=e[e.length-1]),{min:s,max:n}}buildTicks(){const e=this.options,s=e.time,n=e.ticks,i=n.source==="labels"?this.getLabelTimestamps():this._generate();e.bounds==="ticks"&&i.length&&(this.min=this._userMin||i[0],this.max=this._userMax||i[i.length-1]);const o=this.min,a=this.max,r=bf(i,o,a);return this._unit=s.unit||(n.autoSkip?oa(s.minUnit,this.min,this.max,this._getLabelCapacity(o)):Im(this,r.length,s.minUnit,this.min,this.max)),this._majorUnit=!n.major.enabled||this._unit==="year"?void 0:Fm(this._unit),this.initOffsets(i),e.reverse&&r.reverse(),ra(this,r,this._majorUnit)}afterAutoSkip(){this.options.offsetAfterAutoskip&&this.initOffsets(this.ticks.map(e=>+e.value))}initOffsets(e=[]){let s=0,n=0,i,o;this.options.offset&&e.length&&(i=this.getDecimalForValue(e[0]),e.length===1?s=1-i:s=(this.getDecimalForValue(e[1])-i)/2,o=this.getDecimalForValue(e[e.length-1]),e.length===1?n=o:n=(o-this.getDecimalForValue(e[e.length-2]))/2);const a=e.length<3?.5:.25;s=Re(s,0,a),n=Re(n,0,a),this._offsets={start:s,end:n,factor:1/(s+1+n)}}_generate(){const e=this._adapter,s=this.min,n=this.max,i=this.options,o=i.time,a=o.unit||oa(o.minUnit,s,n,this._getLabelCapacity(s)),r=ee(i.ticks.stepSize,1),l=a==="week"?o.isoWeekday:!1,c=vs(l)||l===!0,u={};let d=s,h,f;if(c&&(d=+e.startOf(d,"isoWeek",l)),d=+e.startOf(d,c?"day":a),e.diff(n,s,a)>1e5*r)throw new Error(s+" and "+n+" are too far apart with stepSize of "+r+" "+a);const p=i.ticks.source==="data"&&this.getDataTimestamps();for(h=d,f=0;h<n;h=+e.add(h,r,a),f++)aa(u,h,p);return(h===n||i.bounds==="ticks"||f===1)&&aa(u,h,p),Object.keys(u).sort(na).map(g=>+g)}getLabelForValue(e){const s=this._adapter,n=this.options.time;return n.tooltipFormat?s.format(e,n.tooltipFormat):s.format(e,n.displayFormats.datetime)}format(e,s){const i=this.options.time.displayFormats,o=this._unit,a=s||i[o];return this._adapter.format(e,a)}_tickFormatFunction(e,s,n,i){const o=this.options,a=o.ticks.callback;if(a)return fe(a,[e,s,n],this);const r=o.time.displayFormats,l=this._unit,c=this._majorUnit,u=l&&r[l],d=c&&r[c],h=n[s],f=c&&d&&h&&h.major;return this._adapter.format(e,i||(f?d:u))}generateTickLabels(e){let s,n,i;for(s=0,n=e.length;s<n;++s)i=e[s],i.label=this._tickFormatFunction(i.value,s,e)}getDecimalForValue(e){return e===null?NaN:(e-this.min)/(this.max-this.min)}getPixelForValue(e){const s=this._offsets,n=this.getDecimalForValue(e);return this.getPixelForDecimal((s.start+n)*s.factor)}getValueForPixel(e){const s=this._offsets,n=this.getDecimalForPixel(e)/s.factor-s.end;return this.min+n*(this.max-this.min)}_getLabelSize(e){const s=this.options.ticks,n=this.ctx.measureText(e).width,i=it(this.isHorizontal()?s.maxRotation:s.minRotation),o=Math.cos(i),a=Math.sin(i),r=this._resolveTickFontOptions(0).size;return{w:n*o+r*a,h:n*a+r*o}}_getLabelCapacity(e){const s=this.options.time,n=s.displayFormats,i=n[s.unit]||n.millisecond,o=this._tickFormatFunction(e,0,ra(this,[e],this._majorUnit),i),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 e=this._cache.data||[],s,n;if(e.length)return e;const i=this.getMatchingVisibleMetas();if(this._normalized&&i.length)return this._cache.data=i[0].controller.getAllParsedValues(this);for(s=0,n=i.length;s<n;++s)e=e.concat(i[s].controller.getAllParsedValues(this));return this._cache.data=this.normalize(e)}getLabelTimestamps(){const e=this._cache.labels||[];let s,n;if(e.length)return e;const i=this.getLabels();for(s=0,n=i.length;s<n;++s)e.push(ia(this,i[s]));return this._cache.labels=this._normalized?e:this.normalize(e)}normalize(e){return xf(e.sort(na))}}N(sn,"id","time"),N(sn,"defaults",{bounds:"data",adapters:{},time:{parser:!1,unit:!1,round:!1,isoWeekday:!1,minUnit:"millisecond",displayFormats:{}},ticks:{source:"auto",callback:!1,major:{enabled:!1}}});function Bs(t,e,s){let n=0,i=t.length-1,o,a,r,l;s?(e>=t[n].pos&&e<=t[i].pos&&({lo:n,hi:i}=xt(t,"pos",e)),{pos:o,time:r}=t[n],{pos:a,time:l}=t[i]):(e>=t[n].time&&e<=t[i].time&&({lo:n,hi:i}=xt(t,"time",e)),{time:o,pos:r}=t[n],{time:a,pos:l}=t[i]);const c=a-o;return c?r+(l-r)*(e-o)/c:r}class la extends sn{constructor(e){super(e),this._table=[],this._minPos=void 0,this._tableRange=void 0}initOffsets(){const e=this._getTimestampsForTable(),s=this._table=this.buildLookupTable(e);this._minPos=Bs(s,this.min),this._tableRange=Bs(s,this.max)-this._minPos,super.initOffsets(e)}buildLookupTable(e){const{min:s,max:n}=this,i=[],o=[];let a,r,l,c,u;for(a=0,r=e.length;a<r;++a)c=e[a],c>=s&&c<=n&&i.push(c);if(i.length<2)return[{time:s,pos:0},{time:n,pos:1}];for(a=0,r=i.length;a<r;++a)u=i[a+1],l=i[a-1],c=i[a],Math.round((u+l)/2)!==c&&o.push({time:c,pos:a/(r-1)});return o}_generate(){const e=this.min,s=this.max;let n=super.getDataTimestamps();return(!n.includes(e)||!n.length)&&n.splice(0,0,e),(!n.includes(s)||n.length===1)&&n.push(s),n.sort((i,o)=>i-o)}_getTimestampsForTable(){let e=this._cache.all||[];if(e.length)return e;const s=this.getDataTimestamps(),n=this.getLabelTimestamps();return s.length&&n.length?e=this.normalize(s.concat(n)):e=s.length?s:n,e=this._cache.all=e,e}getDecimalForValue(e){return(Bs(this._table,e)-this._minPos)/this._tableRange}getValueForPixel(e){const s=this._offsets,n=this.getDecimalForPixel(e)/s.factor-s.end;return Bs(this._table,n*this._tableRange+this._minPos,!0)}}N(la,"id","timeseries"),N(la,"defaults",sn.defaults);const Pr={data:{type:Object,required:!0},options:{type:Object,default:()=>({})},plugins:{type:Array,default:()=>[]},datasetIdKey:{type:String,default:"label"},updateMode:{type:String,default:void 0}},$m={ariaLabel:{type:String},ariaDescribedby:{type:String}},zm={type:{type:String,required:!0},destroyDelay:{type:Number,default:0},...Pr,...$m},Bm=Qr[0]==="2"?(t,e)=>Object.assign(t,{attrs:e}):(t,e)=>Object.assign(t,e);function At(t){return _a(t)?Fn(t):t}function Nm(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:t;return _a(e)?new Proxy(t,{}):t}function Um(t,e){const s=t.options;s&&e&&Object.assign(s,e)}function Dr(t,e){t.labels=e}function Rr(t,e,s){const n=[];t.datasets=e.map(i=>{const o=t.datasets.find(a=>a[s]===i[s]);return!o||!i.data||n.includes(o)?{...i}:(n.push(o),Object.assign(o,i),o)})}function Hm(t,e){const s={labels:[],datasets:[]};return Dr(s,t.labels),Rr(s,t.datasets,e),s}const jm=nn({props:zm,setup(t,e){let{expose:s,slots:n}=e;const i=se(null),o=ti(null);s({chart:o});const a=()=>{if(!i.value)return;const{type:c,data:u,options:d,plugins:h,datasetIdKey:f}=t,p=Hm(u,f),g=Nm(p,u);o.value=new dn(i.value,{type:c,data:g,options:{...d},plugins:h})},r=()=>{const c=Fn(o.value);c&&(t.destroyDelay>0?setTimeout(()=>{c.destroy(),o.value=null},t.destroyDelay):(c.destroy(),o.value=null))},l=c=>{c.update(t.updateMode)};return Ce(a),ga(r),Me([()=>t.options,()=>t.data],(c,u)=>{let[d,h]=c,[f,p]=u;const g=Fn(o.value);if(!g)return;let m=!1;if(d){const y=At(d),v=At(f);y&&y!==v&&(Um(g,y),m=!0)}if(h){const y=At(h.labels),v=At(p.labels),k=At(h.datasets),P=At(p.datasets);y!==v&&(Dr(g.config.data,y),m=!0),k&&k!==P&&(Rr(g.config.data,k,t.datasetIdKey),m=!0)}m&&ca(()=>{l(g)})},{deep:!0}),()=>hs("canvas",{role:"img",ariaLabel:t.ariaLabel,ariaDescribedby:t.ariaDescribedby,ref:i},[hs("p",{},[n.default?n.default():""])])}});function Mr(t,e){return dn.register(e),nn({props:Pr,setup(s,n){let{expose:i}=n;const o=ti(null),a=r=>{o.value=r==null?void 0:r.chart};return i({chart:o}),()=>hs(jm,Bm({ref:a},{type:t,...s}))}})}const Wm=Mr("line",Us),Gm=Mr("pie",Yn),qm={class:"htga4-date-range-subtitle"},Ym={__name:"DateRangeSubtitle",setup(t){const e=X(),s=S(()=>e.state.dateRange),n=S(()=>{const i=s.value;if(!i)return"-";let o,a;try{if(Array.isArray(i))o=new Date(i[0]),a=new Date(i[1]);else if(i[0]&&i[1])o=new Date(i[0]),a=new Date(i[1]);else if(i.startDate&&i.endDate)o=new Date(i.startDate),a=new Date(i.endDate);else return"-";if(isNaN(o.getTime())||isNaN(a.getTime()))return"-";const r={month:"short",day:"numeric"};return`${o.toLocaleDateString("en-US",r)} - ${a.toLocaleDateString("en-US",r)}`}catch{return"-"}});return(i,o)=>(x(),T("span",qm,H(n.value),1))}},Xm=ne(Ym,[["__scopeId","data-v-9eceb655"]]),Km={class:"htga4-report-card-header"},Qm={class:"htga4-report-card-header__title-container"},Zm={class:"htga4-report-card-header__title-content"},Jm={class:"htga4-report-card-header__title"},e_={class:"htga4-report-card-header__value"},t_={class:"htga4-report-card-header__right"},s_={__name:"ReportCardHeader",props:{title:{type:String,required:!0},value:{type:[String,Number],default:null},showGrowth:{type:Boolean,default:!1},growthPercentage:{type:Number,default:0},showDateRange:{type:Boolean,default:!0},isInverse:{type:Boolean,default:!1}},setup(t){const e=Ve(),s=t,n=S(()=>e.path.includes("/realtime")||e.name==="realtime"),i=S(()=>{if(s.isInverse){if(s.growthPercentage<0)return"htga4-report-card-header__trend--positive";if(s.growthPercentage>0)return"htga4-report-card-header__trend--negative"}else{if(s.growthPercentage>0)return"htga4-report-card-header__trend--positive";if(s.growthPercentage<0)return"htga4-report-card-header__trend--negative"}return""});return(o,a)=>{const r=D("el-icon");return x(),T("div",Km,[b("div",Qm,[b("div",Zm,[b("span",Jm,H(t.title),1),t.showDateRange&&!n.value?(x(),A(Xm,{key:0})):U("",!0)]),t.value?(x(),T(J,{key:0},[a[0]||(a[0]=b("span",{class:"htga4-report-card-header__separator"},null,-1)),b("span",e_,H(t.value),1)],64)):U("",!0),Ft(o.$slots,"title-addon",{},void 0,!0)]),b("div",t_,[t.showGrowth?(x(),T("div",{key:0,class:ie(["htga4-report-card-header__trend",i.value])},[_(r,null,{default:w(()=>[t.growthPercentage>0?(x(),A(I(Zr),{key:0})):t.growthPercentage<0?(x(),A(I(ma),{key:1})):U("",!0)]),_:1}),b("span",null,H(Math.abs(t.growthPercentage).toFixed(1))+"%",1)],2)):U("",!0),Ft(o.$slots,"right",{},void 0,!0)])])}}},Ar=ne(s_,[["__scopeId","data-v-e37ab623"]]),n_={class:"htga4-chart__body"},i_={class:"htga4-chart__wrapper"},o_={key:0,class:"htga4-chart__loading"},a_={key:0,class:"htga4-chart__legend"},r_={class:"htga4-chart__legend-label"},l_={__name:"BaseChart",props:{chartType:{type:String,default:"line",validator:t=>["line","pie"].includes(t)},title:{type:String,required:!0},value:{type:[Number,String],required:!0},growthPercentage:{type:Number,default:0},showGrowth:{type:Boolean,default:!0},showLegend:{type:Boolean,default:!0},chartData:{type:Object,required:!0},isLoading:{type:Boolean,default:!1},metricLabel:{type:String,default:"Value"},isInverse:{type:Boolean,default:!1}},setup(t){const e=Ve(),s=S(()=>e.path.includes("/realtime")||e.name==="realtime"),n=S(()=>e.path.includes("/standard")||e.name==="standard"),i=S(()=>e.path.includes("/ecommerce")||e.name==="ecommerce");dn.register(Jn,ei,ss,Ws,ts,xm,Mm,bm);const o=t;S(()=>o.growthPercentage>0?"htga4-growth-positive":"htga4-growth-negative");const a=(h=!0,f=h?"#2196F3":"#9E9E9E")=>({label:h?"Current Period":"Previous Period",borderColor:f,backgroundColor:`${f}1A`,borderWidth:2,pointRadius:h?4:0,pointBackgroundColor:f,borderDash:h?[]:[5,5],tension:.4,fill:!1}),r=S(()=>{var f,p;if(!o.chartData||!o.chartData.datasets||!Array.isArray(o.chartData.datasets))return["doughnut","pie"].includes(o.chartType)?{labels:[],datasets:[{data:[],backgroundColor:[],borderColor:[],borderWidth:1}]}:{labels:[],datasets:[{...a(!0),data:[]},{...a(!1),data:[]}]};const h=o.chartData;return o.chartType==="pie"?h:{labels:h.labels||[],datasets:[{...a(!0),data:Array.isArray((f=h.datasets[0])==null?void 0:f.data)?h.datasets[0].data:[]},{...a(!1),data:Array.isArray((p=h.datasets[1])==null?void 0:p.data)?h.datasets[1].data:[]}]}}),l={responsive:!0,maintainAspectRatio:!1,plugins:{legend:{display:!1},title:{display:!1},tooltip:{backgroundColor:"rgba(255, 255, 255, 0.9)",titleColor:"#333",bodyColor:"#666",borderColor:"#ddd",borderWidth:1,padding:10,boxPadding:5,callbacks:{label:h=>`${o.metricLabel}: ${h.raw}`}}}},c={...l,scales:{y:{beginAtZero:!0,grid:{drawBorder:!1,color:"rgba(0, 0, 0, 0.05)"},ticks:{font:{size:11},color:"#666"}},x:{grid:{display:!1},ticks:{maxRotation:45,minRotation:45,font:{size:10},color:"#666"}}},elements:{line:{tension:.4}}},u={...l,plugins:{...l.plugins,tooltip:{...l.plugins.tooltip,callbacks:{label:h=>{const f=h.label||"",p=h.raw||0,g=h.chart.data.datasets[0].data.reduce((y,v)=>y+v,0),m=Math.round(p/g*100);return`${f}: ${p} (${m}%)`}}}}},d=S(()=>o.chartType==="line"?c:o.chartType==="pie"?u:l);return(h,f)=>{const p=D("el-skeleton"),g=D("el-card");return x(),A(g,{class:"htga4-chart","body-style":{padding:"0px"}},{header:w(()=>[_(Ar,{title:t.title,value:t.value,"show-growth":t.showGrowth,"growth-percentage":t.growthPercentage,"is-inverse":t.isInverse},null,8,["title","value","show-growth","growth-percentage","is-inverse"])]),default:w(()=>[b("div",n_,[b("div",i_,[t.isLoading&&(!n.value&&!i.value||!r.value||!r.value.labels||r.value.labels.length===0)?(x(),T("div",o_,[_(p,{rows:5,animated:""})])):t.chartType==="line"?(x(),A(I(Wm),{key:1,data:r.value,options:d.value,height:"300"},null,8,["data","options"])):t.chartType==="pie"?(x(),A(I(Gm),{key:2,data:r.value,options:d.value,height:"300"},null,8,["data","options"])):U("",!0)]),t.showLegend?(x(),T("div",a_,[t.chartType==="pie"&&r.value&&r.value.datasets&&r.value.datasets[0]?(x(!0),T(J,{key:0},le(r.value.labels,(m,y)=>(x(),T("div",{key:y,class:"htga4-chart__legend-item"},[b("span",{class:"htga4-chart__legend-color",style:ii({backgroundColor:r.value.datasets[0].backgroundColor[y]})},null,4),b("span",r_,H(m),1)]))),128)):s.value?U("",!0):(x(),T(J,{key:1},[f[0]||(f[0]=b("div",{class:"htga4-chart__legend-item htga4-chart__legend-item--current"},[b("span",{class:"htga4-chart__legend-color",style:{"background-color":"#2196F3"}}),b("span",{class:"htga4-chart__legend-label"},"Current Period")],-1)),f[1]||(f[1]=b("div",{class:"htga4-chart__legend-item htga4-chart__legend-item--previous"},[b("span",{class:"htga4-chart__legend-color",style:{"background-color":"#9E9E9E"}}),b("span",{class:"htga4-chart__legend-label"},"Previous Period")],-1))],64))])):U("",!0)])]),_:1})}}},ot=ne(l_,[["__scopeId","data-v-f2f8c0ba"]]),c_={__name:"Session",setup(t){const e=X(),s=S(()=>e.getters.isLoading),n=S(()=>e.getters.sessionCurrentTotal),i=S(()=>e.getters.sessionGrowthPercentage),o=S(()=>e.getters.sessionChartData);return(a,r)=>(x(),A(ot,{title:"Sessions",value:n.value,growthPercentage:i.value,chartData:o.value,isLoading:s.value,metricLabel:"Sessions"},null,8,["value","growthPercentage","chartData","isLoading"]))}},u_={__name:"Pageview",setup(t){const e=X(),s=S(()=>e.getters.isLoading),n=S(()=>e.getters.pageviewCurrentTotal),i=S(()=>e.getters.pageviewGrowthPercentage),o=S(()=>e.getters.pageviewChartData);return(a,r)=>(x(),A(ot,{title:"Pageviews",value:n.value,growthPercentage:i.value,chartData:o.value,isLoading:s.value,metricLabel:"Pageviews"},null,8,["value","growthPercentage","chartData","isLoading"]))}},d_={__name:"BounceRate",setup(t){const e=X(),s=S(()=>e.getters.isLoading),n=S(()=>e.getters.bounceRateCurrentAverage),i=S(()=>e.getters.bounceRateGrowthPercentage),o=S(()=>e.getters.bounceRateChartData),a=S(()=>{const r=Number(n.value)*100;return`${Math.round(r)}%`});return(r,l)=>(x(),A(ot,{title:"Bounce Rate",value:a.value,growthPercentage:i.value,chartData:o.value,isLoading:s.value,metricLabel:"Bounce Rate","is-inverse":!0},null,8,["value","growthPercentage","chartData","isLoading"]))}},h_={key:0,class:"htga4-table__skeleton"},f_={__name:"BaseTable",props:{title:{type:String,required:!0},tableData:{type:Array,default:()=>[]},keyField:{type:String,required:!0},autoGenerateColumns:{type:Boolean,default:!0},excludeFields:{type:Array,default:()=>[]},keyLabel:{type:String,default:"Name"},isLoading:{type:Boolean,default:!1}},setup(t){const e=Ve(),s=S(()=>e.path.includes("/standard")||e.name==="standard"),n=S(()=>e.path.includes("/ecommerce")||e.name==="ecommerce"),i=(c,u="number")=>{if(c==null)return"-";switch(u){case"currency":return new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:2,maximumFractionDigits:2}).format(c);case"percentage":return new Intl.NumberFormat("en-US",{style:"percent",minimumFractionDigits:1,maximumFractionDigits:1}).format(c/100);case"number":default:return new Intl.NumberFormat("en-US").format(Math.round(c*100)/100)}},o=()=>"number",a=c=>c.replace(/([A-Z])/g," $1").replace(/_/g," ").replace(/^\w/,u=>u.toUpperCase()).trim(),r=t,l=S(()=>{if(!r.tableData||r.tableData.length===0)return[];const c=r.tableData[0],u=[],d=[r.keyField,...r.excludeFields];for(const[h,f]of Object.entries(c)){if(d.includes(h))continue;const p=o(),g=a(h);let m="120";g.length>10&&(m="190"),u.push({prop:h,label:g,type:p,width:m,sortable:!0})}return u});return(c,u)=>{const d=D("el-skeleton"),h=D("el-table-column"),f=D("el-table"),p=D("el-card");return x(),A(p,{class:"htga4-table"},{header:w(()=>[_(Ar,{title:t.title},null,8,["title"])]),default:w(()=>[t.isLoading&&(!s.value&&!n.value||!t.tableData||t.tableData.length===0)?(x(),T("div",h_,[_(d,{rows:5,animated:""})])):(x(),A(f,{key:1,data:t.tableData,style:{width:"100%"},"show-header":!0,size:"default",stripe:""},{default:w(()=>[_(h,{prop:t.keyField,label:t.keyLabel,"min-width":"180"},null,8,["prop","label"]),c.valueField?(x(),A(h,{key:0,prop:c.valueField,label:c.valueLabel,width:"120",align:"right"},{default:w(g=>[B(H(i(g.row[c.valueField],c.valueType)),1)]),_:1},8,["prop","label"])):t.autoGenerateColumns&&t.tableData.length>0?(x(!0),T(J,{key:1},le(l.value,g=>(x(),A(h,{key:g.prop,prop:g.prop,label:g.label,width:g.width||"120",align:g.align||"right",sortable:g.sortable},{default:w(m=>[B(H(i(m.row[g.prop],g.type)),1)]),_:2},1032,["prop","label","width","align","sortable"]))),128)):U("",!0),Ft(c.$slots,"additionalColumns",{},void 0,!0)]),_:3},8,["data"]))]),_:3})}}},at=ne(f_,[["__scopeId","data-v-d00562e6"]]),p_={__name:"TopPages",setup(t){const e=X(),s=S(()=>e.getters.isLoading),n=S(()=>e.state.standardReports.topPages||[]),i=S(()=>n.value.map(o=>({page:o.page||"Unknown Page",PageView:o.value||0})));return(o,a)=>(x(),A(at,{title:"Top Pages",tableData:i.value,keyField:"page",valueField:"value",keyLabel:"Page",valueLabel:"Views",isLoading:s.value},null,8,["tableData","isLoading"]))}},g_={__name:"TopReferrers",setup(t){const e=X(),s=S(()=>e.getters.isLoading);S(()=>e.state.standardReports.topReferrers||[]);const n=S(()=>e.state.standardReports.topReferrers||[]),i=S(()=>n.value.map(o=>({referrer:o.referrer||"Unknown Referrer",session:o.value||0})));return(o,a)=>(x(),A(at,{title:"Top Referrers",tableData:i.value,keyField:"referrer",valueField:"sessions",keyLabel:"Source",valueLabel:"Sessions",isLoading:s.value},null,8,["tableData","isLoading"]))}},m_={__name:"TopCountries",setup(t){const e=X(),s=S(()=>e.getters.isLoading),n=S(()=>e.state.standardReports.topCountries||[]),i=S(()=>n.value.map(o=>({country:o.country||"Unknown Country",session:o.value||0})));return(o,a)=>(x(),A(at,{title:"Top Countries",tableData:i.value,keyField:"country",valueField:"count",keyLabel:"Country",valueLabel:"Sessions",isLoading:s.value},null,8,["tableData","isLoading"]))}},__={__name:"UserTypes",setup(t){const e=X(),s=S(()=>e.getters.isLoading),n=S(()=>e.state.standardReports.userTypes),i=S(()=>{if(typeof n.value>"u")return{labels:[],datasets:[]};const o=[],a=[];return n.value.forEach(r=>{o.push(r.type),a.push(r.value)}),{labels:o,datasets:[{label:"User Types",data:a,backgroundColor:["#FF6384","#36A2EB","#FFCE56","#4BC0C0","#9966FF","#FF9F40","#FF6384","#36A2EB","#FFCE56","#4BC0C0","#9966FF","#FF9F40"]}]}});return(o,a)=>(x(),A(ot,{title:"User Types",chartData:i.value,isLoading:s.value,metricLabel:"Users",chartType:"pie",showGrowth:!1},null,8,["chartData","isLoading"]))}},v_={__name:"DeviceTypes",setup(t){const e=X(),s=S(()=>e.getters.isLoading),n=S(()=>e.getters.deviceTypesData);return(i,o)=>(x(),A(ot,{title:"Device Types",growthPercentage:0,chartData:n.value,isLoading:s.value,metricLabel:"Devices",chartType:"pie",showGrowth:!1},null,8,["chartData","isLoading"]))}};function fn(){const t=X(),e=S(()=>!!t.state.accessToken&&!!t.state.email),s=S(()=>!!t.state.email),n=S(()=>!!t.state.accessToken),i=S(()=>!!t.state.email&&!t.state.accessToken),o=S(()=>!!t.state.propertyId);return{hasFullAuthentication:e,hasEmail:s,hasAccessToken:n,hasEmailOnly:i,hasProperty:o}}const b_={key:0,class:"htga4-no-access-token"},y_={__name:"AuthNotice",setup(t){const e=rn(),{hasFullAuthentication:s}=fn(),n=()=>{e.push("/settings/general")};return(i,o)=>{const a=D("el-button"),r=D("el-alert");return I(s)?U("",!0):(x(),T("div",b_,[_(r,{title:"Authentication Required",type:"warning",description:"Authentication is required to view analytics reports. Please go to the settings page to connect your Google account.","show-icon":"",closable:!1,class:"htga4-no-access-token__alert"},{default:w(()=>[o[1]||(o[1]=b("p",{class:"htga4-no-access-token__message"}," Authentication is required to view analytics reports. Please connect your Google account in the settings page to access your data. ",-1)),_(a,{type:"primary",onClick:n,class:"htga4-no-access-token__button"},{default:w(()=>o[0]||(o[0]=[B(" Go to Settings ")])),_:1})]),_:1})]))}}},Mi=ne(y_,[["__scopeId","data-v-4d4b051a"]]),x_={class:"htga4-reports"},w_={__name:"Standard",setup(t){const{hasFullAuthentication:e}=fn(),s=X();S(()=>s.state.isLoading);const n=se(null),i=()=>{};return Ce(async()=>{await n.value.initialize(),await s.dispatch("fetchStandardReports",{dateRange:{start:n.value.startDate,end:n.value.endDate}});const o=new Event("hashchange",{bubbles:!0});window.dispatchEvent(o)}),(o,a)=>{const r=D("el-col"),l=D("el-row");return x(),T("div",x_,[I(e)?(x(),T(J,{key:0},[_(Ha,{ref_key:"reportHeaderRef",ref:n,onAnalyticsDataUpdated:i},null,512),_(l,{gutter:24,class:"htga4-reports__row"},{default:w(()=>[_(r,{span:8},{default:w(()=>[_(c_)]),_:1}),_(r,{span:8},{default:w(()=>[_(u_)]),_:1}),_(r,{span:8},{default:w(()=>[_(d_)]),_:1})]),_:1}),_(l,{gutter:24,class:"htga4-reports__row"},{default:w(()=>[_(r,{span:8},{default:w(()=>[_(p_)]),_:1}),_(r,{span:8},{default:w(()=>[_(g_)]),_:1}),_(r,{span:8},{default:w(()=>[_(m_)]),_:1})]),_:1}),_(l,{gutter:24,class:"htga4-reports__row"},{default:w(()=>[_(r,{span:8},{default:w(()=>[_(__)]),_:1}),_(r,{span:8},{default:w(()=>[_(v_)]),_:1})]),_:1})],64)):(x(),A(Mi,{key:1}))])}}},S_={class:"htga4-pro-promotion"},k_={class:"htga4-pro-promotion__content"},C_={class:"htga4-pro-promotion__title"},P_={class:"htga4-pro-promotion__description"},D_={class:"htga4-pro-promotion__features"},Tr={__name:"ProPromotion",props:{icon:{type:String,required:!0,validator:t=>["Trophy","Clock"].includes(t)},title:{type:String,required:!0},description:{type:String,required:!0},features:{type:Array,required:!0}},setup(t){const e=t,s=S(()=>({Trophy:Vn,Clock:Jr})[e.icon]||Vn),n=S(()=>window.htga4Settings.proAdvInfo.purchaseURL);return(i,o)=>{const a=D("el-icon"),r=D("el-button"),l=D("el-card");return x(),T("div",S_,[_(l,{class:"htga4-pro-promotion__card"},{default:w(()=>[b("div",k_,[_(a,{class:"htga4-pro-promotion__icon"},{default:w(()=>[(x(),A(pa(s.value)))]),_:1}),b("h2",C_,H(t.title),1),b("p",P_,H(t.description),1),b("div",D_,[o[0]||(o[0]=b("h3",null,"Premium Features Include:",-1)),b("ul",null,[(x(!0),T(J,null,le(t.features,(c,u)=>(x(),T("li",{key:u},[_(a,null,{default:w(()=>[_(I(si))]),_:1}),B(" "+H(c),1)]))),128))])]),_(r,{type:"primary",size:"large",tag:"a",href:n.value,target:"_blank",rel:"noopener noreferrer",class:"htga4-pro-promotion__button"},{default:w(()=>o[1]||(o[1]=[B(" Upgrade to Pro ")])),_:1},8,["href"])])]),_:1})])}}},R_={key:0,class:"htga4-metric-card__skeleton"},M_={class:"htga4-metric-card__header"},A_={class:"htga4-metric-card__icon"},T_={class:"htga4-metric-card__metrics"},E_={class:"htga4-metric-card__footer"},L_={key:1,class:"htga4-metric-card__content"},O_={class:"htga4-metric-card__metrics"},I_={class:"htga4-metric-card__value"},F_={__name:"ProductsViewed",setup(t){const e=X(),s=Ve(),n=S(()=>e.state.isLoading),i=S(()=>s.path.includes("/ecommerce")||s.name==="ecommerce"),o=S(()=>{var d;return((d=e.state.ecommerceReports.itemsViewed)==null?void 0:d.current)||0}),a=S(()=>{var d;return((d=e.state.ecommerceReports.itemsViewed)==null?void 0:d.previous)||0}),r=d=>new Intl.NumberFormat("en-US").format(d),l=S(()=>a.value?((o.value-a.value)/a.value*100).toFixed(1):0),c=S(()=>{const d="htga4-metric-card__growth";return parseFloat(l.value)>0?`${d} ${d}--positive`:parseFloat(l.value)<0?`${d} ${d}--negative`:d}),u=S(()=>parseFloat(l.value)>0?"el-icon-top":parseFloat(l.value)<0?"el-icon-bottom":"el-icon-d-arrow-right");return(d,h)=>{const f=D("el-skeleton-item"),p=D("el-card");return x(),A(p,{class:"htga4-metric-card"},{default:w(()=>[n.value&&(!i.value||!o.value)?(x(),T("div",R_,[b("div",M_,[_(f,{variant:"text",style:{width:"60%",height:"20px"}}),b("div",A_,[_(f,{variant:"circle",style:{width:"24px",height:"24px"}})])]),b("div",T_,[_(f,{variant:"h3",style:{width:"40%",height:"32px","margin-bottom":"8px"}}),_(f,{variant:"text",style:{width:"30%",height:"20px"}})]),b("div",E_,[_(f,{variant:"text",style:{width:"50%",height:"16px"}})])])):(x(),T("div",L_,[h[0]||(h[0]=b("div",{class:"htga4-metric-card__header"},[b("h3",{class:"htga4-metric-card__title"},"Products Viewed"),b("div",{class:"htga4-metric-card__icon"},[b("i",{class:"el-icon-view"})])],-1)),b("div",O_,[b("div",I_,H(r(o.value)),1),b("div",{class:ie(c.value)},[b("i",{class:ie(u.value)},null,2),b("span",null,H(l.value)+"%",1)],2)]),h[1]||(h[1]=b("div",{class:"htga4-metric-card__footer"},[b("p",{class:"htga4-metric-card__description"},"vs. previous period")],-1))]))]),_:1})}}},V_=ne(F_,[["__scopeId","data-v-6672985e"]]),$_={key:0,class:"htga4-metric-card__skeleton"},z_={class:"htga4-metric-card__header"},B_={class:"htga4-metric-card__icon"},N_={class:"htga4-metric-card__metrics"},U_={class:"htga4-metric-card__footer"},H_={key:1,class:"htga4-metric-card__content"},j_={class:"htga4-metric-card__metrics"},W_={class:"htga4-metric-card__value"},G_={__name:"ProductsAddedToCart",setup(t){const e=X(),s=Ve(),n=S(()=>e.state.isLoading),i=S(()=>s.path.includes("/ecommerce")||s.name==="ecommerce"),o=S(()=>{var d;return((d=e.state.ecommerceReports.itemsAddedToCart)==null?void 0:d.current)||0}),a=S(()=>{var d;return((d=e.state.ecommerceReports.itemsAddedToCart)==null?void 0:d.previous)||0}),r=d=>new Intl.NumberFormat("en-US").format(d),l=S(()=>a.value?((o.value-a.value)/a.value*100).toFixed(1):0),c=S(()=>{const d="htga4-metric-card__growth";return parseFloat(l.value)>0?`${d} ${d}--positive`:parseFloat(l.value)<0?`${d} ${d}--negative`:d}),u=S(()=>parseFloat(l.value)>0?"el-icon-top":parseFloat(l.value)<0?"el-icon-bottom":"el-icon-d-arrow-right");return(d,h)=>{const f=D("el-skeleton-item"),p=D("el-card");return x(),A(p,{class:"htga4-metric-card"},{default:w(()=>[n.value&&(!i.value||!o.value)?(x(),T("div",$_,[b("div",z_,[_(f,{variant:"text",style:{width:"60%",height:"20px"}}),b("div",B_,[_(f,{variant:"circle",style:{width:"24px",height:"24px"}})])]),b("div",N_,[_(f,{variant:"h3",style:{width:"40%",height:"32px","margin-bottom":"8px"}}),_(f,{variant:"text",style:{width:"30%",height:"20px"}})]),b("div",U_,[_(f,{variant:"text",style:{width:"50%",height:"16px"}})])])):(x(),T("div",H_,[h[0]||(h[0]=b("div",{class:"htga4-metric-card__header"},[b("h3",{class:"htga4-metric-card__title"},"Products Added to Cart"),b("div",{class:"htga4-metric-card__icon"},[b("i",{class:"el-icon-shopping-cart-full"})])],-1)),b("div",j_,[b("div",W_,H(r(o.value)),1),b("div",{class:ie(c.value)},[b("i",{class:ie(u.value)},null,2),b("span",null,H(l.value)+"%",1)],2)]),h[1]||(h[1]=b("div",{class:"htga4-metric-card__footer"},[b("p",{class:"htga4-metric-card__description"},"vs. previous period")],-1))]))]),_:1})}}},q_=ne(G_,[["__scopeId","data-v-4ce28bba"]]),Y_={key:0,class:"htga4-metric-card__skeleton"},X_={class:"htga4-metric-card__header"},K_={class:"htga4-metric-card__icon"},Q_={class:"htga4-metric-card__metrics"},Z_={class:"htga4-metric-card__footer"},J_={key:1,class:"htga4-metric-card__content"},ev={class:"htga4-metric-card__metrics"},tv={class:"htga4-metric-card__value"},sv={__name:"ProductsCheckedOut",setup(t){const e=X(),s=Ve(),n=S(()=>e.state.isLoading),i=S(()=>s.path.includes("/ecommerce")||s.name==="ecommerce"),o=S(()=>{var d;return((d=e.state.ecommerceReports.itemsCheckedOut)==null?void 0:d.current)||0}),a=S(()=>{var d;return((d=e.state.ecommerceReports.itemsCheckedOut)==null?void 0:d.previous)||0}),r=d=>new Intl.NumberFormat("en-US").format(d),l=S(()=>a.value?((o.value-a.value)/a.value*100).toFixed(1):0),c=S(()=>{const d="htga4-metric-card__growth";return parseFloat(l.value)>0?`${d} ${d}--positive`:parseFloat(l.value)<0?`${d} ${d}--negative`:d}),u=S(()=>parseFloat(l.value)>0?"el-icon-top":parseFloat(l.value)<0?"el-icon-bottom":"el-icon-d-arrow-right");return(d,h)=>{const f=D("el-skeleton-item"),p=D("el-card");return x(),A(p,{class:"htga4-metric-card"},{default:w(()=>[n.value&&(!i.value||!o.value)?(x(),T("div",Y_,[b("div",X_,[_(f,{variant:"text",style:{width:"60%",height:"20px"}}),b("div",K_,[_(f,{variant:"circle",style:{width:"24px",height:"24px"}})])]),b("div",Q_,[_(f,{variant:"h3",style:{width:"40%",height:"32px","margin-bottom":"8px"}}),_(f,{variant:"text",style:{width:"30%",height:"20px"}})]),b("div",Z_,[_(f,{variant:"text",style:{width:"50%",height:"16px"}})])])):(x(),T("div",J_,[h[0]||(h[0]=b("div",{class:"htga4-metric-card__header"},[b("h3",{class:"htga4-metric-card__title"},"Products Checked Out"),b("div",{class:"htga4-metric-card__icon"},[b("i",{class:"el-icon-document-checked"})])],-1)),b("div",ev,[b("div",tv,H(r(o.value)),1),b("div",{class:ie(c.value)},[b("i",{class:ie(u.value)},null,2),b("span",null,H(l.value)+"%",1)],2)]),h[1]||(h[1]=b("div",{class:"htga4-metric-card__footer"},[b("p",{class:"htga4-metric-card__description"},"vs. previous period")],-1))]))]),_:1})}}},nv=ne(sv,[["__scopeId","data-v-a47435ca"]]),iv={key:0,class:"htga4-metric-card__skeleton"},ov={class:"htga4-metric-card__header"},av={class:"htga4-metric-card__icon"},rv={class:"htga4-metric-card__metrics"},lv={class:"htga4-metric-card__footer"},cv={key:1,class:"htga4-metric-card__content"},uv={class:"htga4-metric-card__metrics"},dv={class:"htga4-metric-card__value"},hv={__name:"ProductsPurchased",setup(t){const e=X(),s=Ve(),n=S(()=>e.state.isLoading),i=S(()=>s.path.includes("/ecommerce")||s.name==="ecommerce"),o=S(()=>{var d;return((d=e.state.ecommerceReports.itemsPurchased)==null?void 0:d.current)||0}),a=S(()=>{var d;return((d=e.state.ecommerceReports.itemsPurchased)==null?void 0:d.previous)||0}),r=d=>new Intl.NumberFormat("en-US").format(d),l=S(()=>a.value?((o.value-a.value)/a.value*100).toFixed(1):0),c=S(()=>{const d="htga4-metric-card__growth";return parseFloat(l.value)>0?`${d} ${d}--positive`:parseFloat(l.value)<0?`${d} ${d}--negative`:d}),u=S(()=>parseFloat(l.value)>0?"el-icon-top":parseFloat(l.value)<0?"el-icon-bottom":"el-icon-d-arrow-right");return(d,h)=>{const f=D("el-skeleton-item"),p=D("el-card");return x(),A(p,{class:"htga4-metric-card"},{default:w(()=>[n.value&&(!i.value||!o.value)?(x(),T("div",iv,[b("div",ov,[_(f,{variant:"text",style:{width:"60%",height:"20px"}}),b("div",av,[_(f,{variant:"circle",style:{width:"24px",height:"24px"}})])]),b("div",rv,[_(f,{variant:"h3",style:{width:"40%",height:"32px","margin-bottom":"8px"}}),_(f,{variant:"text",style:{width:"30%",height:"20px"}})]),b("div",lv,[_(f,{variant:"text",style:{width:"50%",height:"16px"}})])])):(x(),T("div",cv,[h[0]||(h[0]=b("div",{class:"htga4-metric-card__header"},[b("h3",{class:"htga4-metric-card__title"},"Products Purchased"),b("div",{class:"htga4-metric-card__icon"},[b("i",{class:"el-icon-shopping-bag-1"})])],-1)),b("div",uv,[b("div",dv,H(r(o.value)),1),b("div",{class:ie(c.value)},[b("i",{class:ie(u.value)},null,2),b("span",null,H(l.value)+"%",1)],2)]),h[1]||(h[1]=b("div",{class:"htga4-metric-card__footer"},[b("p",{class:"htga4-metric-card__description"},"vs. previous period")],-1))]))]),_:1})}}},fv=ne(hv,[["__scopeId","data-v-acab68f2"]]),pv={__name:"Transactions",setup(t){const e=X(),s=S(()=>e.state.isLoading),n=S(()=>{var c,u;return{current:((c=e.state.ecommerceReports.transactions)==null?void 0:c.current_dataset)||[],previous:((u=e.state.ecommerceReports.transactions)==null?void 0:u.previous_dataset)||[]}}),i=S(()=>n.value.current.reduce((c,u)=>c+Number(u.value||0),0)),o=S(()=>n.value.previous.reduce((c,u)=>c+Number(u.value||0),0)),a=S(()=>o.value?(i.value-o.value)/o.value*100:0),r=c=>{if(c=String(c||""),!c||c.length<8)return"";try{const u=c.substring(0,4),d=c.substring(4,6),h=c.substring(6,8),f=new Date(`${u}-${d}-${h}`);return isNaN(f.getTime())?"":f.toLocaleDateString("en-US",{month:"short",day:"numeric"})}catch(u){return console.error("Error formatting date:",u),""}},l=S(()=>{const c=[...n.value.current].sort((h,f)=>{const p=String(h.date||""),g=String(f.date||"");return p.localeCompare(g)}),u=[...n.value.previous].sort((h,f)=>{const p=String(h.date||""),g=String(f.date||"");return p.localeCompare(g)});return{labels:c.map(h=>r(h.date)),datasets:[{label:"Current Period",data:c.map(h=>h.value)},{label:"Previous Period",data:u.map(h=>h.value)}]}});return(c,u)=>(x(),A(ot,{title:"Transactions",value:i.value,growthPercentage:a.value,chartData:l.value,isLoading:s.value,chartType:"line",metricLabel:"Transactions"},null,8,["value","growthPercentage","chartData","isLoading"]))}},gv={__name:"AveragePurchaseRevenue",setup(t){const e=X(),s=S(()=>e.state.isLoading),n=u=>new Intl.NumberFormat("en-US",{style:"decimal",minimumFractionDigits:2,maximumFractionDigits:2}).format(u),i=S(()=>{var u,d;return{current:((u=e.state.ecommerceReports.averagePurchaseRevenue)==null?void 0:u.current_dataset)||[],previous:((d=e.state.ecommerceReports.averagePurchaseRevenue)==null?void 0:d.previous_dataset)||[]}}),o=S(()=>{const u=i.value.current.map(d=>d.value||0);return u.length?u.reduce((d,h)=>d+Number(h||0),0)/u.length:0}),a=S(()=>{const u=i.value.previous.map(d=>Number(d.value||0));return u.length?u.reduce((d,h)=>d+Number(h||0),0)/u.length:0}),r=S(()=>a.value?(o.value-a.value)/a.value*100:0),l=u=>{if(u=String(u||""),!u||u.length<8)return"";try{const d=u.substring(0,4),h=u.substring(4,6),f=u.substring(6,8),p=new Date(`${d}-${h}-${f}`);return isNaN(p.getTime())?"":p.toLocaleDateString("en-US",{month:"short",day:"numeric"})}catch(d){return console.error("Error formatting date:",d),""}},c=S(()=>{const u=[...i.value.current].sort((f,p)=>{const g=String(f.date||""),m=String(p.date||"");return g.localeCompare(m)}),d=[...i.value.previous].sort((f,p)=>{const g=String(f.date||""),m=String(p.date||"");return g.localeCompare(m)});return{labels:u.map(f=>l(f.date)),datasets:[{label:"Current Period",data:u.map(f=>f.value)},{label:"Previous Period",data:d.map(f=>f.value)}]}});return(u,d)=>(x(),A(ot,{title:"Average Purchase Revenue",value:n(o.value),growthPercentage:r.value,chartData:c.value,isLoading:s.value,chartType:"line",metricLabel:"Average Value"},null,8,["value","growthPercentage","chartData","isLoading"]))}},mv={__name:"TotalPurchaseRevenue",setup(t){const e=X(),s=S(()=>e.state.isLoading),n=u=>new Intl.NumberFormat("en-US",{style:"decimal",minimumFractionDigits:2,maximumFractionDigits:2}).format(u),i=S(()=>{var u,d;return{current:((u=e.state.ecommerceReports.purchaseRevenue)==null?void 0:u.current_dataset)||[],previous:((d=e.state.ecommerceReports.purchaseRevenue)==null?void 0:d.previous_dataset)||[]}}),o=S(()=>i.value.current.reduce((u,d)=>u+Number(d.value||0),0)),a=S(()=>i.value.previous.reduce((u,d)=>u+Number(d.value||0),0)),r=S(()=>a.value?(o.value-a.value)/a.value*100:0),l=u=>{if(u=String(u||""),!u||u.length<8)return"";try{const d=u.substring(0,4),h=u.substring(4,6),f=u.substring(6,8),p=new Date(`${d}-${h}-${f}`);return isNaN(p.getTime())?"":p.toLocaleDateString("en-US",{month:"short",day:"numeric"})}catch(d){return console.error("Error formatting date:",d),""}},c=S(()=>{const u=[...i.value.current].sort((f,p)=>{const g=String(f.date||""),m=String(p.date||"");return g.localeCompare(m)}),d=[...i.value.previous].sort((f,p)=>{const g=String(f.date||""),m=String(p.date||"");return g.localeCompare(m)});return{labels:u.map(f=>l(f.date)),datasets:[{label:"Current Period",data:u.map(f=>f.value)},{label:"Previous Period",data:d.map(f=>f.value)}]}});return(u,d)=>(x(),A(ot,{title:"Total Purchase Revenue",value:n(o.value),growthPercentage:r.value,chartData:c.value,isLoading:s.value,chartType:"line",metricLabel:"Revenue"},null,8,["value","growthPercentage","chartData","isLoading"]))}},_v={__name:"TopProducts",setup(t){const e=X(),s=S(()=>e.getters.isLoading),n=S(()=>e.state.ecommerceReports.topProducts||[]),i=S(()=>n.value.map(o=>({product:o[6]||"Unknown Product",itemRevenue:o[0]||0,itemsPurchased:o[1]||0,itemsViewed:o[2]||0,itemsAddedToCart:o[3]||0,cartToView:o[4]||0,purchaseToView:o[5]||0})));return(o,a)=>(x(),A(at,{title:"Top Products",tableData:i.value,keyField:"product",keyLabel:"Product",isLoading:s.value,excludeFields:["id"]},null,8,["tableData","isLoading"]))}},vv={__name:"TopBrands",setup(t){const e=X(),s=S(()=>e.getters.isLoading),n=S(()=>e.state.ecommerceReports.topBrands||[]),i=S(()=>n.value.map(o=>({brand:o[3]||"Unknown Brand",itemRevenue:o[0]||0,itemsViewed:o[1]||0,itemsPurchased:o[2]||0})));return(o,a)=>(x(),A(at,{title:"Top Brands",tableData:i.value,keyField:"brand",keyLabel:"Brand",isLoading:s.value},null,8,["tableData","isLoading"]))}},bv={__name:"TopSources",setup(t){const e=X(),s=S(()=>e.getters.isLoading),n=S(()=>e.state.ecommerceReports.topReferrers||[]),i=S(()=>n.value.map(o=>({source:o[3]||"Unknown Source",itemRevenue:o[0]||0,itemsViewed:o[1]||0,itemsPurchased:o[2]||0})));return(o,a)=>(x(),A(at,{title:"Top Sources",tableData:i.value,keyField:"source",keyLabel:"Source",isLoading:s.value},null,8,["tableData","isLoading"]))}},yv={class:"htga4-reports"},xv={__name:"Ecommerce",setup(t){const e=X(),{hasFullAuthentication:s,hasEmailOnly:n}=fn(),i=S(()=>window.htga4Settings.isProActive);S(()=>window.htga4Settings.proAdvInfo),S(()=>e.state.isLoading);const o=se(null),a=()=>{};return Ce(async()=>{const r=new Event("hashchange",{bubbles:!0});window.dispatchEvent(r),i.value&&(await o.value.initialize(),e.dispatch("fetchEcommerceReports",{startDate:e.state.startDate,endDate:e.state.endDate}))}),(r,l)=>{const c=D("el-col"),u=D("el-row");return x(),T("div",yv,[i.value&&I(n)?(x(),A(Mi,{key:0})):U("",!0),i.value?U("",!0):(x(),A(Tr,{key:1,icon:"Trophy",title:"Unlock Ecommerce Reports",description:"Get detailed insights into your store's performance with our comprehensive Ecommerce Reports. Track product views, cart additions, checkouts, purchases, revenue, and more.",features:["E-commerce Reports","Revenue Analytics","Product Insights","Conversion Tracking","Shopping Behavior","Product Performance","And more..."]})),i.value&&I(s)?(x(),T(J,{key:2},[_(Ha,{ref_key:"reportHeaderRef",ref:o,onAnalyticsDataUpdated:a},null,512),_(u,{gutter:24,class:"htga4-reports__row"},{default:w(()=>[_(c,{span:8},{default:w(()=>[_(pv)]),_:1}),_(c,{span:8},{default:w(()=>[_(gv)]),_:1}),_(c,{span:8},{default:w(()=>[_(mv)]),_:1})]),_:1}),_(u,{gutter:24,class:"htga4-reports__row"},{default:w(()=>[_(c,{span:6},{default:w(()=>[_(V_)]),_:1}),_(c,{span:6},{default:w(()=>[_(q_)]),_:1}),_(c,{span:6},{default:w(()=>[_(nv)]),_:1}),_(c,{span:6},{default:w(()=>[_(fv)]),_:1})]),_:1}),_(u,{gutter:24,class:"htga4-reports__row"},{default:w(()=>[_(c,{span:24},{default:w(()=>[_(_v)]),_:1})]),_:1}),_(u,{gutter:24,class:"htga4-reports__row"},{default:w(()=>[_(c,{span:12},{default:w(()=>[_(vv)]),_:1}),_(c,{span:12},{default:w(()=>[_(bv)]),_:1})]),_:1})],64)):U("",!0)])}}},wv={class:"htga4-report-header"},Sv={class:"htga4-report-header__controls"},kv={__name:"ReportHeader2",emits:["analytics-data-updated"],setup(t,{expose:e,emit:s}){const n=s;return e({initialize:async()=>Promise.resolve()}),(i,o)=>(x(),T("div",wv,[_(Ua),b("div",Sv,[_(Na,{label:"Refresh",size:"large",onSyncComplete:o[0]||(o[0]=a=>n("data-loaded"))})])]))}},Cv=ne(kv,[["__scopeId","data-v-f17b859e"]]),Pv={__name:"PageViews",setup(t){const e=X(),s=S(()=>e.state.isLoading),n=S(()=>{var c;return((c=e.state.realtimeReports)==null?void 0:c.page_views)||[]}),i=S(()=>!n.value||!n.value.length?0:n.value.reduce((c,u)=>c+(u.value||0),0)),o=(c,u)=>{const d=u-c-1;return d===0?"Now":d===1?"1 min ago":`${d} mins ago`},a=S(()=>{if(!n.value||!n.value.length)return{labels:[],datasets:[{label:"Page Views",data:[]}]};const c=[...n.value].sort((h,f)=>h.date-f.date),u=c.length;return{labels:c.map((h,f)=>o(f,u)),datasets:[{label:"Page Views",data:c.map(h=>h.value)}]}});let r=null;const l=()=>{r=setInterval(()=>{},6e4)};return Ce(()=>{l()}),ni(()=>{r&&clearInterval(r)}),(c,u)=>(x(),A(ot,{title:"Page Views Per Minute",value:i.value,chartData:a.value,isLoading:s.value,showGrowth:!1,chartType:"line",metricLabel:"Page Views"},{subtitle:w(()=>u[0]||(u[0]=[b("div",{class:"htga4-pageviews__subtitle"}," Auto-refreshes every minute ",-1)])),_:1},8,["value","chartData","isLoading"]))}},Dv=ne(Pv,[["__scopeId","data-v-d046fc85"]]),Rv={key:0,class:"htga4-active-users__skeleton"},Mv={class:"htga4-active-users__content"},Av={class:"htga4-active-users__count-container"},Tv={class:"htga4-active-users__icon"},Ev={key:1,class:"htga4-active-users__content"},Lv={class:"htga4-active-users__count-container"},Ov={class:"htga4-active-users__count"},Iv={__name:"ActiveUsers",setup(t){const e=X(),s=S(()=>e.state.isLoading),n=S(()=>e.state.realtimeReports.active_users||0);let i=null;const o=()=>{i=setInterval(()=>{},6e4)};return Ce(()=>{o()}),ni(()=>{i&&clearInterval(i)}),(a,r)=>{const l=D("el-skeleton-item"),c=D("el-skeleton"),u=D("el-card");return x(),A(u,{class:"htga4-active-users"},{default:w(()=>[s.value?(x(),T("div",Rv,[_(c,{style:{width:"100%"},animated:""},{template:w(()=>[b("div",Mv,[_(l,{variant:"text",style:{width:"30%",height:"24px","margin-bottom":"20px"}}),b("div",Av,[_(l,{variant:"h1",style:{width:"40%",height:"60px"}})]),_(l,{variant:"text",style:{width:"60%",height:"20px","margin-bottom":"24px"}}),_(l,{variant:"text",style:{width:"80%",height:"36px"}}),b("div",Tv,[_(l,{variant:"circle",style:{width:"24px",height:"24px"}})])])]),_:1})])):(x(),T("div",Ev,[r[0]||(r[0]=b("h2",{class:"htga4-active-users__title"},"Currently",-1)),b("div",Lv,[b("span",Ov,H(n.value),1)]),r[1]||(r[1]=b("p",{class:"htga4-active-users__description"},"users are active on your store",-1)),r[2]||(r[2]=b("p",{class:"htga4-active-users__info"}," Users active in last 30 minutes on your store are displayed here. It will be automatically updated in every minute. ",-1)),r[3]||(r[3]=b("div",{class:"htga4-active-users__icon"},[b("i",{class:"el-icon-user"})],-1))]))]),_:1})}}},Fv=ne(Iv,[["__scopeId","data-v-a0c99988"]]),Vv={__name:"TopPages",setup(t){const e=X(),s=S(()=>e.state.isLoading),n=S(()=>{var o;return((o=e.state.realtimeReports)==null?void 0:o.top_pages)||[]}),i=()=>{const o=setInterval(()=>{},6e4);Ce(()=>()=>clearInterval(o))};return Ce(()=>{i()}),(o,a)=>(x(),A(at,{title:"Top Pages",tableData:n.value,keyField:"page",valueField:"views",keyLabel:"Page",valueLabel:"Views",valueType:"number",isLoading:s.value},null,8,["tableData","isLoading"]))}},$v={__name:"TopEvents",setup(t){const e=X(),s=S(()=>e.state.isLoading),n=S(()=>{var o;return((o=e.state.realtimeReports)==null?void 0:o.top_events)||[]}),i=()=>{const o=setInterval(()=>{},6e4);Ce(()=>()=>clearInterval(o))};return Ce(()=>{i()}),(o,a)=>(x(),A(at,{title:"Top Events",tableData:n.value,keyField:"event",valueField:"views",keyLabel:"Event",valueLabel:"Count",isLoading:s.value},null,8,["tableData","isLoading"]))}},zv={__name:"TopCountries",setup(t){const e=X(),s=S(()=>e.state.isLoading),n=S(()=>{var o;return((o=e.state.realtimeReports)==null?void 0:o.countries)||[]}),i=()=>{const o=setInterval(()=>{},6e4);Ce(()=>()=>clearInterval(o))};return Ce(()=>{i()}),(o,a)=>(x(),A(at,{title:"Top Countries",tableData:n.value,keyField:"country",valueField:"views",keyLabel:"Country",valueLabel:"Users",isLoading:s.value},null,8,["tableData","isLoading"]))}},Bv={class:"htga4-reports"},Nv={key:2},Uv={__name:"RealTime",setup(t){const e=X(),{hasFullAuthentication:s,hasEmailOnly:n}=fn(),i=window.htga4Settings.isProActive;S(()=>window.htga4Settings.proAdvInfo),S(()=>e.state.isLoading);const o=se(null),a=()=>{};return Ce(async()=>{const r=new Event("hashchange",{bubbles:!0});window.dispatchEvent(r),i&&(await o.value.initialize(),e.dispatch("fetchRealtimeReports"))}),(r,l)=>{const c=D("el-col"),u=D("el-row");return x(),T("div",Bv,[I(i)&&I(n)?(x(),A(Mi,{key:0})):U("",!0),I(i)?U("",!0):(x(),A(Tr,{key:1,icon:"Clock",title:"Unlock Realtime Reports",description:"Monitor your website's activity as it happens with our powerful Realtime Reports. See who's on your site right now, what pages they're viewing, and how they're interacting with your content.",features:["Live Visitor Count","Current Page Views","Active User Tracking","Real-time Events","Geographic Data","Traffic Sources","Conversion Monitoring","Device Breakdown","And more..."]})),I(i)&&I(s)?(x(),T("div",Nv,[_(Cv,{ref_key:"reportHeaderRef",ref:o,onAnalyticsDataUpdated:a},null,512),_(u,{gutter:24,class:"htga4-reports__row"},{default:w(()=>[_(c,{span:18},{default:w(()=>[_(Dv)]),_:1}),_(c,{span:6},{default:w(()=>[_(Fv)]),_:1})]),_:1}),_(u,{gutter:24,class:"htga4-reports__row"},{default:w(()=>[_(c,{span:8},{default:w(()=>[_(Vv)]),_:1}),_(c,{span:8},{default:w(()=>[_($v)]),_:1}),_(c,{span:8},{default:w(()=>[_(zv)]),_:1})]),_:1})])):U("",!0)])}}},pn=[{path:"",redirect:"/reports/standard"},{path:"standard",name:"standard",component:w_}],Er=[{path:"",redirect:"/settings/general"},{path:"general",name:"general",component:wu},{path:"events-tracking",name:"events-tracking",component:Cu},{path:"custom-events",name:"custom-events",component:td},{path:"google-ads",name:"google-ads",component:Ud},{path:"cookie-notice",name:"cookie-notice",component:id},{path:"tools",name:"tools",component:ad},{path:"cache",name:"cache",component:md}];pn.push({path:"ecommerce",name:"ecommerce",component:xv});pn.push({path:"realtime",name:"realtime",component:Uv});pn.push({path:":pathMatch(.*)*",redirect:"/reports/standard"});Er.push({path:":pathMatch(.*)*",redirect:"/settings/general"});const Hv=[{path:"/reports",component:sh,children:pn},{path:"/settings",component:Jd,children:Er},{path:"/",redirect:"/settings/general"},{path:"/:pathMatch(.*)*",redirect:"/"}],jv=pc({history:Hl(),routes:Hv}),Wv=()=>{var t,e,s;return{settings:{},users:[],roles:{},email:((t=window.htga4Settings)==null?void 0:t.email)||"",accessToken:((e=window.htga4Settings)==null?void 0:e.accessToken)||"",accounts:{},properties:{},dataStreams:{},measurementProtocolSecrets:{},userProfile:{},dataStream:{},dateRange:{},isLoading:!1,isSaving:!1,error:null,validationErrors:{},activeMenu:"general",formConfig:{labelPosition:"left"},displayProModal:!1,startDate:null,endDate:null,standardReports:{},ecommerceReports:{},realtimeReports:{},environmentType:((s=window.htga4Settings)==null?void 0:s.environmentType)||"development"}},Gv={setSettings(t,e){t.settings=e},updateSetting(t,{key:e,value:s}){t.settings={...t.settings,[e]:s}},updateSettings(t,e){t.settings={...t.settings,...e}},updateFormConfig(t,e){t.formConfig={...t.formConfig,...e}},setActiveMenu(t,e){t.activeMenu=e},setRoles(t,e){t.roles=e},setUsers(t,e){t.users=e},setPages(t,e){t.pages=e},setProducts(t,e){t.products=e},setProductCategories(t,e){t.productCategories=e},setCountries(t,e){t.countries=e},setPaymentGateways(t,e){t.paymentGateways=e},setAccounts(t,e){t.accounts=e},setProperties(t,e){t.properties=e},setDataStreams(t,e){t.dataStreams=e},setMeasurementProtocolSecrets(t,e){t.measurementProtocolSecrets=e},setLoading(t,e){t.isLoading=e},setSaving(t,e){t.isSaving=e},setError(t,e){t.error=e},setValidationErrors(t,e){t.validationErrors=e},setDisplayProModal(t,e){t.displayProModal=e},setStartDate(t,e){t.startDate=e},setEndDate(t,e){t.endDate=e},setStandardReports(t,e){t.standardReports=e},setEcommerceReports(t,e){t.ecommerceReports=e},setRealtimeReports(t,e){t.realtimeReports=e},setUserProfile(t,e){t.userProfile=e},setDataStream(t,e){t.dataStream=e},setDateRange(t,e){t.dateRange=e}},qv={updateActiveMenu({commit:t},e){t("setActiveMenu",e)},fetchSettings({commit:t,state:e}){var s;if(!Object.values(e.settings).length)return t("setLoading",!0),t("setError",null),t("setSettings",(s=window.htga4Settings)==null?void 0:s.defaultSettings),Le.settings.getSettings().then(n=>{var o;const i=el({},(o=window.htga4Settings)==null?void 0:o.defaultSettings,n);n.google_ads&&Array.isArray(n.google_ads.excluded_roles)&&(i.google_ads||(i.google_ads={}),i.google_ads.excluded_roles=n.google_ads.excluded_roles),t("setSettings",i)}).catch(n=>{throw t("setError",n.message),n}).finally(()=>{t("setLoading",!1)})},async saveSettings({commit:t,state:e}){t("setSaving",!0),t("setError",null),t("setValidationErrors",{});try{const s=await Le.settings.updateSettings(e.settings);e.environmentType==="development"&&console.log("Saved Settings:",s),t("setSettings",s)}catch(s){throw console.error("Error saving settings:",s),t("setError",s.message),s}finally{t("setSaving",!1)}},async fetchRoles({commit:t,state:e}){if(!Object.values(e.roles).length){t("setError",null);try{const s=await Le.roles.getRoles();e.environmentType==="development"&&console.log("Fetched Roles:",s),t("setRoles",s)}catch(s){throw console.error("Error fetching roles:",s),t("setError",s.message),s}finally{t("setLoading",!1)}}},async fetchAccounts({commit:t,state:e},s=!1){if(!Object.values(e.accounts).length){t("setError",null);try{const n=await Le.ga4.getAccounts(s);e.environmentType==="development"&&console.log("Fetched Accounts:",n),t("setAccounts",n)}catch(n){throw console.error("Error fetching accounts:",n),t("setError",n.message),n}finally{t("setLoading",!1)}}},async fetchProperties({commit:t,state:e},s=!1){const n=e.settings.account;if(n){t("setError",null),t("setLoading",!0);try{const i=await Le.ga4.getProperties(n,s);e.environmentType==="development"&&console.log("Fetched Properties:",i),t("setProperties",i)}catch(i){console.error("Error fetching properties:",i),t("setError",i.message)}finally{t("setLoading",!1)}}},async fetchDataStreams({commit:t,state:e},{forceRefresh:s=!1}={}){const n=e.settings.property;if(n){t("setError",null),t("setLoading",!0);try{const i=await Le.ga4.getDataStreams(n,s);e.environmentType==="development"&&console.log("Fetched Data Streams:",i),t("setDataStreams",i)}catch(i){t("setError",i.message)}finally{t("setLoading",!1)}}},async fetchMeasurementProtocolSecrets({commit:t,state:e},{forceRefresh:s=!1}={}){const n=e.settings.property,i=e.settings.data_stream_id;if(!(!n||!i)){t("setError",null),t("setLoading",!0);try{const o=await Le.ga4.getMeasurementProtocolSecrets(n,i,s);e.environmentType==="development"&&console.log("Fetched Measurement Protocol Secrets:",o),t("setMeasurementProtocolSecrets",o)}catch(o){console.error("Error fetching measurement protocol secrets:",o),t("setError",o.message)}finally{t("setLoading",!1)}}},async fetchStandardReports({commit:t,state:e},s={}){t("setLoading",!0),t("setError",null);try{let n=s.startDate||(s.dateRange?s.dateRange.start:null),i=s.endDate||(s.dateRange?s.dateRange.end:null);n=n||e.startDate,i=i||e.endDate;const o=await Le.standard.fetchStandardReports({startDate:n,endDate:i,forceRefresh:s.forceRefresh||!1});if(o&&o.error){t("setError",o.error.message);return}e.environmentType==="development"&&console.log("Fetched Standard Reports:",o),t("setStandardReports",o)}catch(n){console.error("Error fetching standard reports:",n),t("setError",n.message)}finally{t("setLoading",!1)}},async fetchEcommerceReports({commit:t,state:e},{startDate:s=null,endDate:n=null,forceRefresh:i=!1}={}){t("setLoading",!0),t("setError",null);try{const o=await Le.ecommerce.fetchEcommerceReports({startDate:s,endDate:n,forceRefresh:i});if(o&&o.error){console.error("API Error:",o.error);let a="";o.error.friendly_message?a=o.error.friendly_message:a=`Error: ${o.error.message}`,o.error.status&&(a+=`27 `):t}function wm(t,e){const{element:s,datasetIndex:n,index:i}=e,o=t.getDatasetMeta(n).controller,{label:a,value:r}=o.getLabelAndValue(i);return{chart:t,label:a,parsed:o.getParsed(i),raw:t.data.datasets[n].data[i],formattedValue:r,dataset:o.getDataset(),dataIndex:i,datasetIndex:n,element:s}}function Ko(t,e){const s=t.chart.ctx,{body:n,footer:i,title:o}=t,{boxWidth:a,boxHeight:r}=e,l=De(e.bodyFont),c=De(e.titleFont),u=De(e.footerFont),d=o.length,h=i.length,f=n.length,p=Ue(e.padding);let g=p.height,m=0,y=n.reduce((P,C)=>P+C.before.length+C.lines.length+C.after.length,0);if(y+=t.beforeBody.length+t.afterBody.length,d&&(g+=d*c.lineHeight+(d-1)*e.titleSpacing+e.titleMarginBottom),y){const P=e.displayColors?Math.max(r,l.lineHeight):l.lineHeight;g+=f*P+(y-f)*l.lineHeight+(y-1)*e.bodySpacing}h&&(g+=e.footerMarginTop+h*u.lineHeight+(h-1)*e.footerSpacing);let b=0;const k=function(P){m=Math.max(m,s.measureText(P).width+b)};return s.save(),s.font=c.string,re(t.title,k),s.font=l.string,re(t.beforeBody.concat(t.afterBody),k),b=e.displayColors?a+2+e.boxPadding:0,re(n,P=>{re(P.before,k),re(P.lines,k),re(P.after,k)}),b=0,s.font=u.string,re(t.footer,k),s.restore(),m+=p.width,{width:m,height:g}}function Sm(t,e){const{y:s,height:n}=e;return s<n/2?"top":s>t.height-n/2?"bottom":"center"}function km(t,e,s,n){const{x:i,width:o}=n,a=s.caretSize+s.caretPadding;if(t==="left"&&i+o+a>e.width||t==="right"&&i-o-a<0)return!0}function Cm(t,e,s,n){const{x:i,width:o}=s,{width:a,chartArea:{left:r,right:l}}=t;let c="center";return n==="center"?c=i<=(r+l)/2?"left":"right":i<=o/2?c="left":i>=a-o/2&&(c="right"),km(c,t,e,s)&&(c="center"),c}function Qo(t,e,s){const n=s.yAlign||e.yAlign||Sm(t,s);return{xAlign:s.xAlign||e.xAlign||Cm(t,e,s,n),yAlign:n}}function Pm(t,e){let{x:s,width:n}=t;return e==="right"?s-=n:e==="center"&&(s-=n/2),s}function Dm(t,e,s){let{y:n,height:i}=t;return e==="top"?n+=s:e==="bottom"?n-=i+s:n-=i/2,n}function Zo(t,e,s,n){const{caretSize:i,caretPadding:o,cornerRadius:a}=t,{xAlign:r,yAlign:l}=s,c=i+o,{topLeft:u,topRight:d,bottomLeft:h,bottomRight:f}=ds(a);let p=Pm(e,r);const g=Dm(e,l,c);return l==="center"?r==="left"?p+=c:r==="right"&&(p-=c):r==="left"?p-=Math.max(u,h)+i:r==="right"&&(p+=Math.max(d,f)+i),{x:Re(p,0,n.width-e.width),y:Re(g,0,n.height-e.height)}}function zs(t,e,s){const n=Ue(s.padding);return e==="center"?t.x+t.width/2:e==="right"?t.x+t.width-n.right:t.x+n.left}function Jo(t){return Xe([],st(t))}function Rm(t,e,s){return Ct(t,{tooltip:e,tooltipItems:s,type:"tooltip"})}function ea(t,e){const s=e&&e.dataset&&e.dataset.tooltip&&e.dataset.tooltip.callbacks;return s?t.override(s):t}const Cr={beforeTitle:et,title(t){if(t.length>0){const e=t[0],s=e.chart.data.labels,n=s?s.length:0;if(this&&this.options&&this.options.mode==="dataset")return e.dataset.label||"";if(e.label)return e.label;if(n>0&&e.dataIndex<n)return s[e.dataIndex]}return""},afterTitle:et,beforeBody:et,beforeLabel:et,label(t){if(this&&this.options&&this.options.mode==="dataset")return t.label+": "+t.formattedValue||t.formattedValue;let e=t.dataset.label||"";e&&(e+=": ");const s=t.formattedValue;return de(s)||(e+=s),e},labelColor(t){const s=t.chart.getDatasetMeta(t.datasetIndex).controller.getStyle(t.dataIndex);return{borderColor:s.borderColor,backgroundColor:s.backgroundColor,borderWidth:s.borderWidth,borderDash:s.borderDash,borderDashOffset:s.borderDashOffset,borderRadius:0}},labelTextColor(){return this.options.bodyColor},labelPointStyle(t){const s=t.chart.getDatasetMeta(t.datasetIndex).controller.getStyle(t.dataIndex);return{pointStyle:s.pointStyle,rotation:s.rotation}},afterLabel:et,afterBody:et,beforeFooter:et,footer:et,afterFooter:et};function Ee(t,e,s,n){const i=t[e].call(s,n);return typeof i>"u"?Cr[e].call(s,n):i}class Zn extends Qe{constructor(e){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=e.chart,this.options=e.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(e){this.options=e,this._cachedAnimations=void 0,this.$context=void 0}_resolveAnimations(){const e=this._cachedAnimations;if(e)return e;const s=this.chart,n=this.options.setContext(this.getContext()),i=n.enabled&&s.options.animation&&n.animations,o=new ur(this.chart,i);return i._cacheable&&(this._cachedAnimations=Object.freeze(o)),o}getContext(){return this.$context||(this.$context=Rm(this.chart.getContext(),this,this._tooltipItems))}getTitle(e,s){const{callbacks:n}=s,i=Ee(n,"beforeTitle",this,e),o=Ee(n,"title",this,e),a=Ee(n,"afterTitle",this,e);let r=[];return r=Xe(r,st(i)),r=Xe(r,st(o)),r=Xe(r,st(a)),r}getBeforeBody(e,s){return Jo(Ee(s.callbacks,"beforeBody",this,e))}getBody(e,s){const{callbacks:n}=s,i=[];return re(e,o=>{const a={before:[],lines:[],after:[]},r=ea(n,o);Xe(a.before,st(Ee(r,"beforeLabel",this,o))),Xe(a.lines,Ee(r,"label",this,o)),Xe(a.after,st(Ee(r,"afterLabel",this,o))),i.push(a)}),i}getAfterBody(e,s){return Jo(Ee(s.callbacks,"afterBody",this,e))}getFooter(e,s){const{callbacks:n}=s,i=Ee(n,"beforeFooter",this,e),o=Ee(n,"footer",this,e),a=Ee(n,"afterFooter",this,e);let r=[];return r=Xe(r,st(i)),r=Xe(r,st(o)),r=Xe(r,st(a)),r}_createItems(e){const s=this._active,n=this.chart.data,i=[],o=[],a=[];let r=[],l,c;for(l=0,c=s.length;l<c;++l)r.push(wm(this.chart,s[l]));return e.filter&&(r=r.filter((u,d,h)=>e.filter(u,d,h,n))),e.itemSort&&(r=r.sort((u,d)=>e.itemSort(u,d,n))),re(r,u=>{const d=ea(e.callbacks,u);i.push(Ee(d,"labelColor",this,u)),o.push(Ee(d,"labelPointStyle",this,u)),a.push(Ee(d,"labelTextColor",this,u))}),this.labelColors=i,this.labelPointStyles=o,this.labelTextColors=a,this.dataPoints=r,r}update(e,s){const n=this.options.setContext(this.getContext()),i=this._active;let o,a=[];if(!i.length)this.opacity!==0&&(o={opacity:0});else{const r=ns[n.position].call(this,i,this._eventPosition);a=this._createItems(n),this.title=this.getTitle(a,n),this.beforeBody=this.getBeforeBody(a,n),this.body=this.getBody(a,n),this.afterBody=this.getAfterBody(a,n),this.footer=this.getFooter(a,n);const l=this._size=Ko(this,n),c=Object.assign({},r,l),u=Qo(this.chart,n,c),d=Zo(n,c,u,this.chart);this.xAlign=u.xAlign,this.yAlign=u.yAlign,o={opacity:1,x:d.x,y:d.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),e&&n.external&&n.external.call(this,{chart:this.chart,tooltip:this,replay:s})}drawCaret(e,s,n,i){const o=this.getCaretPosition(e,n,i);s.lineTo(o.x1,o.y1),s.lineTo(o.x2,o.y2),s.lineTo(o.x3,o.y3)}getCaretPosition(e,s,n){const{xAlign:i,yAlign:o}=this,{caretSize:a,cornerRadius:r}=n,{topLeft:l,topRight:c,bottomLeft:u,bottomRight:d}=ds(r),{x:h,y:f}=e,{width:p,height:g}=s;let m,y,b,k,P,C;return o==="center"?(P=f+g/2,i==="left"?(m=h,y=m-a,k=P+a,C=P-a):(m=h+p,y=m+a,k=P-a,C=P+a),b=m):(i==="left"?y=h+Math.max(l,u)+a:i==="right"?y=h+p-Math.max(c,d)-a:y=this.caretX,o==="top"?(k=f,P=k-a,m=y-a,b=y+a):(k=f+g,P=k+a,m=y+a,b=y-a),C=k),{x1:m,x2:y,x3:b,y1:k,y2:P,y3:C}}drawTitle(e,s,n){const i=this.title,o=i.length;let a,r,l;if(o){const c=Ot(n.rtl,this.x,this.width);for(e.x=zs(this,n.titleAlign,n),s.textAlign=c.textAlign(n.titleAlign),s.textBaseline="middle",a=De(n.titleFont),r=n.titleSpacing,s.fillStyle=n.titleColor,s.font=a.string,l=0;l<o;++l)s.fillText(i[l],c.x(e.x),e.y+a.lineHeight/2),e.y+=a.lineHeight+r,l+1===o&&(e.y+=n.titleMarginBottom-r)}}_drawColorBox(e,s,n,i,o){const a=this.labelColors[n],r=this.labelPointStyles[n],{boxHeight:l,boxWidth:c}=o,u=De(o.bodyFont),d=zs(this,"left",o),h=i.x(d),f=l<u.lineHeight?(u.lineHeight-l)/2:0,p=s.y+f;if(o.usePointStyle){const g={radius:Math.min(c,l)/2,pointStyle:r.pointStyle,rotation:r.rotation,borderWidth:1},m=i.leftForLtr(h,c)+c/2,y=p+l/2;e.strokeStyle=o.multiKeyBackground,e.fillStyle=o.multiKeyBackground,Gn(e,g,m,y),e.strokeStyle=a.borderColor,e.fillStyle=a.backgroundColor,Gn(e,g,m,y)}else{e.lineWidth=oe(a.borderWidth)?Math.max(...Object.values(a.borderWidth)):a.borderWidth||1,e.strokeStyle=a.borderColor,e.setLineDash(a.borderDash||[]),e.lineDashOffset=a.borderDashOffset||0;const g=i.leftForLtr(h,c),m=i.leftForLtr(i.xPlus(h,1),c-2),y=ds(a.borderRadius);Object.values(y).some(b=>b!==0)?(e.beginPath(),e.fillStyle=o.multiKeyBackground,qn(e,{x:g,y:p,w:c,h:l,radius:y}),e.fill(),e.stroke(),e.fillStyle=a.backgroundColor,e.beginPath(),qn(e,{x:m,y:p+1,w:c-2,h:l-2,radius:y}),e.fill()):(e.fillStyle=o.multiKeyBackground,e.fillRect(g,p,c,l),e.strokeRect(g,p,c,l),e.fillStyle=a.backgroundColor,e.fillRect(m,p+1,c-2,l-2))}e.fillStyle=this.labelTextColors[n]}drawBody(e,s,n){const{body:i}=this,{bodySpacing:o,bodyAlign:a,displayColors:r,boxHeight:l,boxWidth:c,boxPadding:u}=n,d=De(n.bodyFont);let h=d.lineHeight,f=0;const p=Ot(n.rtl,this.x,this.width),g=function(E){s.fillText(E,p.x(e.x+f),e.y+h/2),e.y+=h+o},m=p.textAlign(a);let y,b,k,P,C,O,R;for(s.textAlign=a,s.textBaseline="middle",s.font=d.string,e.x=zs(this,m,n),s.fillStyle=n.bodyColor,re(this.beforeBody,g),f=r&&m!=="right"?a==="center"?c/2+u:c+2+u:0,P=0,O=i.length;P<O;++P){for(y=i[P],b=this.labelTextColors[P],s.fillStyle=b,re(y.before,g),k=y.lines,r&&k.length&&(this._drawColorBox(s,e,P,p,n),h=Math.max(d.lineHeight,l)),C=0,R=k.length;C<R;++C)g(k[C]),h=d.lineHeight;re(y.after,g)}f=0,h=d.lineHeight,re(this.afterBody,g),e.y-=o}drawFooter(e,s,n){const i=this.footer,o=i.length;let a,r;if(o){const l=Ot(n.rtl,this.x,this.width);for(e.x=zs(this,n.footerAlign,n),e.y+=n.footerMarginTop,s.textAlign=l.textAlign(n.footerAlign),s.textBaseline="middle",a=De(n.footerFont),s.fillStyle=n.footerColor,s.font=a.string,r=0;r<o;++r)s.fillText(i[r],l.x(e.x),e.y+a.lineHeight/2),e.y+=a.lineHeight+n.footerSpacing}}drawBackground(e,s,n,i){const{xAlign:o,yAlign:a}=this,{x:r,y:l}=e,{width:c,height:u}=n,{topLeft:d,topRight:h,bottomLeft:f,bottomRight:p}=ds(i.cornerRadius);s.fillStyle=i.backgroundColor,s.strokeStyle=i.borderColor,s.lineWidth=i.borderWidth,s.beginPath(),s.moveTo(r+d,l),a==="top"&&this.drawCaret(e,s,n,i),s.lineTo(r+c-h,l),s.quadraticCurveTo(r+c,l,r+c,l+h),a==="center"&&o==="right"&&this.drawCaret(e,s,n,i),s.lineTo(r+c,l+u-p),s.quadraticCurveTo(r+c,l+u,r+c-p,l+u),a==="bottom"&&this.drawCaret(e,s,n,i),s.lineTo(r+f,l+u),s.quadraticCurveTo(r,l+u,r,l+u-f),a==="center"&&o==="left"&&this.drawCaret(e,s,n,i),s.lineTo(r,l+d),s.quadraticCurveTo(r,l,r+d,l),s.closePath(),s.fill(),i.borderWidth>0&&s.stroke()}_updateAnimationTarget(e){const s=this.chart,n=this.$animations,i=n&&n.x,o=n&&n.y;if(i||o){const a=ns[e.position].call(this,this._active,this._eventPosition);if(!a)return;const r=this._size=Ko(this,e),l=Object.assign({},a,this._size),c=Qo(s,e,l),u=Zo(e,l,c,s);(i._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(e){const s=this.options.setContext(this.getContext());let n=this.opacity;if(!n)return;this._updateAnimationTarget(s);const i={width:this.width,height:this.height},o={x:this.x,y:this.y};n=Math.abs(n)<.001?0:n;const a=Ue(s.padding),r=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;s.enabled&&r&&(e.save(),e.globalAlpha=n,this.drawBackground(o,e,i,s),rr(e,s.textDirection),o.y+=a.top,this.drawTitle(o,e,s),this.drawBody(o,e,s),this.drawFooter(o,e,s),lr(e,s.textDirection),e.restore())}getActiveElements(){return this._active||[]}setActiveElements(e,s){const n=this._active,i=e.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=!Xs(n,i),a=this._positionChanged(i,s);(o||a)&&(this._active=i,this._eventPosition=s,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(e,s,n=!0){if(s&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;const i=this.options,o=this._active||[],a=this._getActiveElements(e,o,s,n),r=this._positionChanged(a,e),l=s||!Xs(a,o)||r;return l&&(this._active=a,(i.enabled||i.external)&&(this._eventPosition={x:e.x,y:e.y},this.update(!0,s))),l}_getActiveElements(e,s,n,i){const o=this.options;if(e.type==="mouseout")return[];if(!i)return s.filter(r=>this.chart.data.datasets[r.datasetIndex]&&this.chart.getDatasetMeta(r.datasetIndex).controller.getParsed(r.index)!==void 0);const a=this.chart.getElementsAtEventForMode(e,o.mode,o,n);return o.reverse&&a.reverse(),a}_positionChanged(e,s){const{caretX:n,caretY:i,options:o}=this,a=ns[o.position].call(this,e,s);return a!==!1&&(n!==a.x||i!==a.y)}}U(Zn,"positioners",ns);var Mm={id:"tooltip",_element:Zn,positioners:ns,afterInit(t,e,s){s&&(t.tooltip=new Zn({chart:t,options:s}))},beforeUpdate(t,e,s){t.tooltip&&t.tooltip.initialize(s)},reset(t,e,s){t.tooltip&&t.tooltip.initialize(s)},afterDraw(t){const e=t.tooltip;if(e&&e._willRender()){const s={tooltip:e};if(t.notifyPlugins("beforeTooltipDraw",{...s,cancelable:!0})===!1)return;e.draw(t.ctx),t.notifyPlugins("afterTooltipDraw",s)}},afterEvent(t,e){if(t.tooltip){const s=e.replay;t.tooltip.handleEvent(e.event,s,e.inChartArea)&&(e.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:(t,e)=>e.bodyFont.size,boxWidth:(t,e)=>e.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:Cr},defaultRoutes:{bodyFont:"font",footerFont:"font",titleFont:"font"},descriptors:{_scriptable:t=>t!=="filter"&&t!=="itemSort"&&t!=="external",_indexable:!1,callbacks:{_scriptable:!1,_indexable:!1},animation:{_fallback:!1},animations:{_fallback:"animation"}},additionalOptionScopes:["interaction"]};const Am=(t,e,s,n)=>(typeof e=="string"?(s=t.push(e)-1,n.unshift({index:s,label:e})):isNaN(e)&&(s=null),s);function Tm(t,e,s,n){const i=t.indexOf(e);if(i===-1)return Am(t,e,s,n);const o=t.lastIndexOf(e);return i!==o?s:i}const Em=(t,e)=>t===null?null:Re(Math.round(t),0,e);function ta(t){const e=this.getLabels();return t>=0&&t<e.length?e[t]:t}class Jn extends jt{constructor(e){super(e),this._startValue=void 0,this._valueRange=0,this._addedLabels=[]}init(e){const s=this._addedLabels;if(s.length){const n=this.getLabels();for(const{index:i,label:o}of s)n[i]===o&&n.splice(i,1);this._addedLabels=[]}super.init(e)}parse(e,s){if(de(e))return null;const n=this.getLabels();return s=isFinite(s)&&n[s]===e?s:Tm(n,e,ee(s,e),this._addedLabels),Em(s,n.length-1)}determineDataLimits(){const{minDefined:e,maxDefined:s}=this.getUserBounds();let{min:n,max:i}=this.getMinMax(!0);this.options.bounds==="ticks"&&(e||(n=0),s||(i=this.getLabels().length-1)),this.min=n,this.max=i}buildTicks(){const e=this.min,s=this.max,n=this.options.offset,i=[];let o=this.getLabels();o=e===0&&s===o.length-1?o:o.slice(e,s+1),this._valueRange=Math.max(o.length-(n?0:1),1),this._startValue=this.min-(n?.5:0);for(let a=e;a<=s;a++)i.push({value:a});return i}getLabelForValue(e){return ta.call(this,e)}configure(){super.configure(),this.isHorizontal()||(this._reversePixels=!this._reversePixels)}getPixelForValue(e){return typeof e!="number"&&(e=this.parse(e)),e===null?NaN:this.getPixelForDecimal((e-this._startValue)/this._valueRange)}getPixelForTick(e){const s=this.ticks;return e<0||e>s.length-1?null:this.getPixelForValue(s[e].value)}getValueForPixel(e){return Math.round(this._startValue+this.getDecimalForPixel(e)*this._valueRange)}getBasePixel(){return this.bottom}}U(Jn,"id","category"),U(Jn,"defaults",{ticks:{callback:ta}});function Lm(t,e){const s=[],{bounds:i,step:o,min:a,max:r,precision:l,count:c,maxTicks:u,maxDigits:d,includeBounds:h}=t,f=o||1,p=u-1,{min:g,max:m}=e,y=!de(a),b=!de(r),k=!de(c),P=(m-g)/(d+1);let C=oo((m-g)/p/f)*f,O,R,E,z;if(C<1e-14&&!y&&!b)return[{value:g},{value:m}];z=Math.ceil(m/C)-Math.floor(g/C),z>p&&(C=oo(z*C/p/f)*f),de(l)||(O=Math.pow(10,l),C=Math.ceil(C*O)/O),i==="ticks"?(R=Math.floor(g/C)*C,E=Math.ceil(m/C)*C):(R=g,E=m),y&&b&&o&&ff((r-a)/o,C/1e3)?(z=Math.round(Math.min((r-a)/C,u)),C=(r-a)/z,R=a,E=r):k?(R=y?a:R,E=b?r:E,z=c-1,C=(E-R)/z):(z=(E-R)/C,ls(z,Math.round(z),C/1e3)?z=Math.round(z):z=Math.ceil(z));const j=Math.max(ao(C),ao(R));O=Math.pow(10,de(l)?j:l),R=Math.round(R*O)/O,E=Math.round(E*O)/O;let G=0;for(y&&(h&&R!==a?(s.push({value:a}),R<a&&G++,ls(Math.round((R+G*C)*O)/O,a,sa(a,P,t))&&G++):R<a&&G++);G<z;++G){const L=Math.round((R+G*C)*O)/O;if(b&&L>r)break;s.push({value:L})}return b&&h&&E!==r?s.length&&ls(s[s.length-1].value,r,sa(r,P,t))?s[s.length-1].value=r:s.push({value:r}):(!b||E===r)&&s.push({value:E}),s}function sa(t,e,{horizontal:s,minRotation:n}){const i=it(n),o=(s?Math.sin(i):Math.cos(i))||.001,a=.75*e*(""+t).length;return Math.min(e/o,a)}class Om extends jt{constructor(e){super(e),this.start=void 0,this.end=void 0,this._startValue=void 0,this._endValue=void 0,this._valueRange=0}parse(e,s){return de(e)||(typeof e=="number"||e instanceof Number)&&!isFinite(+e)?null:+e}handleTickRangeOptions(){const{beginAtZero:e}=this.options,{minDefined:s,maxDefined:n}=this.getUserBounds();let{min:i,max:o}=this;const a=l=>i=s?i:l,r=l=>o=n?o:l;if(e){const l=Bt(i),c=Bt(o);l<0&&c<0?r(0):l>0&&c>0&&a(0)}if(i===o){let l=o===0?1:Math.abs(o*.05);r(o+l),e||a(i-l)}this.min=i,this.max=o}getTickLimit(){const e=this.options.ticks;let{maxTicksLimit:s,stepSize:n}=e,i;return n?(i=Math.ceil(this.max/n)-Math.floor(this.min/n)+1,i>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${n} would result generating up to ${i} ticks. Limiting to 1000.`),i=1e3)):(i=this.computeTickLimit(),s=s||11),s&&(i=Math.min(s,i)),i}computeTickLimit(){return Number.POSITIVE_INFINITY}buildTicks(){const e=this.options,s=e.ticks;let n=this.getTickLimit();n=Math.max(2,n);const i={maxTicks:n,bounds:e.bounds,min:e.min,max:e.max,precision:s.precision,step:s.stepSize,count:s.count,maxDigits:this._maxDigits(),horizontal:this.isHorizontal(),minRotation:s.minRotation||0,includeBounds:s.includeBounds!==!1},o=this._range||this,a=Lm(i,o);return e.bounds==="ticks"&&pf(a,this,"value"),e.reverse?(a.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),a}configure(){const e=this.ticks;let s=this.min,n=this.max;if(super.configure(),this.options.offset&&e.length){const i=(n-s)/Math.max(e.length-1,1)/2;s-=i,n+=i}this._startValue=s,this._endValue=n,this._valueRange=n-s}getLabelForValue(e){return bi(e,this.chart.options.locale,this.options.ticks.format)}}class ei extends Om{determineDataLimits(){const{min:e,max:s}=this.getMinMax(!0);this.min=Ne(e)?e:0,this.max=Ne(s)?s:1,this.handleTickRangeOptions()}computeTickLimit(){const e=this.isHorizontal(),s=e?this.width:this.height,n=it(this.options.ticks.minRotation),i=(e?Math.sin(n):Math.cos(n))||.001,o=this._resolveTickFontOptions(0);return Math.ceil(s/Math.min(40,o.lineHeight/i))}getPixelForValue(e){return e===null?NaN:this.getPixelForDecimal((e-this._startValue)/this._valueRange)}getValueForPixel(e){return this._startValue+this.getDecimalForPixel(e)*this._valueRange}}U(ei,"id","linear"),U(ei,"defaults",{ticks:{callback:er.formatters.numeric}});const hn={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}},Oe=Object.keys(hn);function na(t,e){return t-e}function ia(t,e){if(de(e))return null;const s=t._adapter,{parser:n,round:i,isoWeekday:o}=t._parseOpts;let a=e;return typeof n=="function"&&(a=n(a)),Ne(a)||(a=typeof n=="string"?s.parse(a,n):s.parse(a)),a===null?null:(i&&(a=i==="week"&&(vs(o)||o===!0)?s.startOf(a,"isoWeek",o):s.startOf(a,i)),+a)}function oa(t,e,s,n){const i=Oe.length;for(let o=Oe.indexOf(t);o<i-1;++o){const a=hn[Oe[o]],r=a.steps?a.steps:Number.MAX_SAFE_INTEGER;if(a.common&&Math.ceil((s-e)/(r*a.size))<=n)return Oe[o]}return Oe[i-1]}function Im(t,e,s,n,i){for(let o=Oe.length-1;o>=Oe.indexOf(s);o--){const a=Oe[o];if(hn[a].common&&t._adapter.diff(i,n,a)>=e-1)return a}return Oe[s?Oe.indexOf(s):0]}function Fm(t){for(let e=Oe.indexOf(t)+1,s=Oe.length;e<s;++e)if(hn[Oe[e]].common)return Oe[e]}function aa(t,e,s){if(!s)t[e]=!0;else if(s.length){const{lo:n,hi:i}=mi(s,e),o=s[n]>=e?s[n]:s[i];t[o]=!0}}function Vm(t,e,s,n){const i=t._adapter,o=+i.startOf(e[0].value,n),a=e[e.length-1].value;let r,l;for(r=o;r<=a;r=+i.add(r,1,n))l=s[r],l>=0&&(e[l].major=!0);return e}function ra(t,e,s){const n=[],i={},o=e.length;let a,r;for(a=0;a<o;++a)r=e[a],i[r]=a,n.push({value:r,major:!1});return o===0||!s?n:Vm(t,n,i,s)}class sn extends jt{constructor(e){super(e),this._cache={data:[],labels:[],all:[]},this._unit="day",this._majorUnit=void 0,this._offsets={},this._normalized=!1,this._parseOpts=void 0}init(e,s={}){const n=e.time||(e.time={}),i=this._adapter=new Wp._date(e.adapters.date);i.init(s),rs(n.displayFormats,i.formats()),this._parseOpts={parser:n.parser,round:n.round,isoWeekday:n.isoWeekday},super.init(e),this._normalized=s.normalized}parse(e,s){return e===void 0?null:ia(this,e)}beforeLayout(){super.beforeLayout(),this._cache={data:[],labels:[],all:[]}}determineDataLimits(){const e=this.options,s=this._adapter,n=e.time.unit||"day";let{min:i,max:o,minDefined:a,maxDefined:r}=this.getUserBounds();function l(c){!a&&!isNaN(c.min)&&(i=Math.min(i,c.min)),!r&&!isNaN(c.max)&&(o=Math.max(o,c.max))}(!a||!r)&&(l(this._getLabelBounds()),(e.bounds!=="ticks"||e.ticks.source!=="labels")&&l(this.getMinMax(!1))),i=Ne(i)&&!isNaN(i)?i:+s.startOf(Date.now(),n),o=Ne(o)&&!isNaN(o)?o:+s.endOf(Date.now(),n)+1,this.min=Math.min(i,o-1),this.max=Math.max(i+1,o)}_getLabelBounds(){const e=this.getLabelTimestamps();let s=Number.POSITIVE_INFINITY,n=Number.NEGATIVE_INFINITY;return e.length&&(s=e[0],n=e[e.length-1]),{min:s,max:n}}buildTicks(){const e=this.options,s=e.time,n=e.ticks,i=n.source==="labels"?this.getLabelTimestamps():this._generate();e.bounds==="ticks"&&i.length&&(this.min=this._userMin||i[0],this.max=this._userMax||i[i.length-1]);const o=this.min,a=this.max,r=bf(i,o,a);return this._unit=s.unit||(n.autoSkip?oa(s.minUnit,this.min,this.max,this._getLabelCapacity(o)):Im(this,r.length,s.minUnit,this.min,this.max)),this._majorUnit=!n.major.enabled||this._unit==="year"?void 0:Fm(this._unit),this.initOffsets(i),e.reverse&&r.reverse(),ra(this,r,this._majorUnit)}afterAutoSkip(){this.options.offsetAfterAutoskip&&this.initOffsets(this.ticks.map(e=>+e.value))}initOffsets(e=[]){let s=0,n=0,i,o;this.options.offset&&e.length&&(i=this.getDecimalForValue(e[0]),e.length===1?s=1-i:s=(this.getDecimalForValue(e[1])-i)/2,o=this.getDecimalForValue(e[e.length-1]),e.length===1?n=o:n=(o-this.getDecimalForValue(e[e.length-2]))/2);const a=e.length<3?.5:.25;s=Re(s,0,a),n=Re(n,0,a),this._offsets={start:s,end:n,factor:1/(s+1+n)}}_generate(){const e=this._adapter,s=this.min,n=this.max,i=this.options,o=i.time,a=o.unit||oa(o.minUnit,s,n,this._getLabelCapacity(s)),r=ee(i.ticks.stepSize,1),l=a==="week"?o.isoWeekday:!1,c=vs(l)||l===!0,u={};let d=s,h,f;if(c&&(d=+e.startOf(d,"isoWeek",l)),d=+e.startOf(d,c?"day":a),e.diff(n,s,a)>1e5*r)throw new Error(s+" and "+n+" are too far apart with stepSize of "+r+" "+a);const p=i.ticks.source==="data"&&this.getDataTimestamps();for(h=d,f=0;h<n;h=+e.add(h,r,a),f++)aa(u,h,p);return(h===n||i.bounds==="ticks"||f===1)&&aa(u,h,p),Object.keys(u).sort(na).map(g=>+g)}getLabelForValue(e){const s=this._adapter,n=this.options.time;return n.tooltipFormat?s.format(e,n.tooltipFormat):s.format(e,n.displayFormats.datetime)}format(e,s){const i=this.options.time.displayFormats,o=this._unit,a=s||i[o];return this._adapter.format(e,a)}_tickFormatFunction(e,s,n,i){const o=this.options,a=o.ticks.callback;if(a)return fe(a,[e,s,n],this);const r=o.time.displayFormats,l=this._unit,c=this._majorUnit,u=l&&r[l],d=c&&r[c],h=n[s],f=c&&d&&h&&h.major;return this._adapter.format(e,i||(f?d:u))}generateTickLabels(e){let s,n,i;for(s=0,n=e.length;s<n;++s)i=e[s],i.label=this._tickFormatFunction(i.value,s,e)}getDecimalForValue(e){return e===null?NaN:(e-this.min)/(this.max-this.min)}getPixelForValue(e){const s=this._offsets,n=this.getDecimalForValue(e);return this.getPixelForDecimal((s.start+n)*s.factor)}getValueForPixel(e){const s=this._offsets,n=this.getDecimalForPixel(e)/s.factor-s.end;return this.min+n*(this.max-this.min)}_getLabelSize(e){const s=this.options.ticks,n=this.ctx.measureText(e).width,i=it(this.isHorizontal()?s.maxRotation:s.minRotation),o=Math.cos(i),a=Math.sin(i),r=this._resolveTickFontOptions(0).size;return{w:n*o+r*a,h:n*a+r*o}}_getLabelCapacity(e){const s=this.options.time,n=s.displayFormats,i=n[s.unit]||n.millisecond,o=this._tickFormatFunction(e,0,ra(this,[e],this._majorUnit),i),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 e=this._cache.data||[],s,n;if(e.length)return e;const i=this.getMatchingVisibleMetas();if(this._normalized&&i.length)return this._cache.data=i[0].controller.getAllParsedValues(this);for(s=0,n=i.length;s<n;++s)e=e.concat(i[s].controller.getAllParsedValues(this));return this._cache.data=this.normalize(e)}getLabelTimestamps(){const e=this._cache.labels||[];let s,n;if(e.length)return e;const i=this.getLabels();for(s=0,n=i.length;s<n;++s)e.push(ia(this,i[s]));return this._cache.labels=this._normalized?e:this.normalize(e)}normalize(e){return xf(e.sort(na))}}U(sn,"id","time"),U(sn,"defaults",{bounds:"data",adapters:{},time:{parser:!1,unit:!1,round:!1,isoWeekday:!1,minUnit:"millisecond",displayFormats:{}},ticks:{source:"auto",callback:!1,major:{enabled:!1}}});function Bs(t,e,s){let n=0,i=t.length-1,o,a,r,l;s?(e>=t[n].pos&&e<=t[i].pos&&({lo:n,hi:i}=xt(t,"pos",e)),{pos:o,time:r}=t[n],{pos:a,time:l}=t[i]):(e>=t[n].time&&e<=t[i].time&&({lo:n,hi:i}=xt(t,"time",e)),{time:o,pos:r}=t[n],{time:a,pos:l}=t[i]);const c=a-o;return c?r+(l-r)*(e-o)/c:r}class la extends sn{constructor(e){super(e),this._table=[],this._minPos=void 0,this._tableRange=void 0}initOffsets(){const e=this._getTimestampsForTable(),s=this._table=this.buildLookupTable(e);this._minPos=Bs(s,this.min),this._tableRange=Bs(s,this.max)-this._minPos,super.initOffsets(e)}buildLookupTable(e){const{min:s,max:n}=this,i=[],o=[];let a,r,l,c,u;for(a=0,r=e.length;a<r;++a)c=e[a],c>=s&&c<=n&&i.push(c);if(i.length<2)return[{time:s,pos:0},{time:n,pos:1}];for(a=0,r=i.length;a<r;++a)u=i[a+1],l=i[a-1],c=i[a],Math.round((u+l)/2)!==c&&o.push({time:c,pos:a/(r-1)});return o}_generate(){const e=this.min,s=this.max;let n=super.getDataTimestamps();return(!n.includes(e)||!n.length)&&n.splice(0,0,e),(!n.includes(s)||n.length===1)&&n.push(s),n.sort((i,o)=>i-o)}_getTimestampsForTable(){let e=this._cache.all||[];if(e.length)return e;const s=this.getDataTimestamps(),n=this.getLabelTimestamps();return s.length&&n.length?e=this.normalize(s.concat(n)):e=s.length?s:n,e=this._cache.all=e,e}getDecimalForValue(e){return(Bs(this._table,e)-this._minPos)/this._tableRange}getValueForPixel(e){const s=this._offsets,n=this.getDecimalForPixel(e)/s.factor-s.end;return Bs(this._table,n*this._tableRange+this._minPos,!0)}}U(la,"id","timeseries"),U(la,"defaults",sn.defaults);const Pr={data:{type:Object,required:!0},options:{type:Object,default:()=>({})},plugins:{type:Array,default:()=>[]},datasetIdKey:{type:String,default:"label"},updateMode:{type:String,default:void 0}},$m={ariaLabel:{type:String},ariaDescribedby:{type:String}},zm={type:{type:String,required:!0},destroyDelay:{type:Number,default:0},...Pr,...$m},Bm=Qr[0]==="2"?(t,e)=>Object.assign(t,{attrs:e}):(t,e)=>Object.assign(t,e);function At(t){return _a(t)?Fn(t):t}function Nm(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:t;return _a(e)?new Proxy(t,{}):t}function Um(t,e){const s=t.options;s&&e&&Object.assign(s,e)}function Dr(t,e){t.labels=e}function Rr(t,e,s){const n=[];t.datasets=e.map(i=>{con