import{_ as pt,D as At,W as Ye,G as Lt,m as ut,f as $t,o as S,c as C,a as h,b as y,w as nt,k as K,p as rt,F as ct,r as Ot,t as F,j as T,h as gt,e as V,I as Oa,J as Aa,B as gs,E as Ss,d as st,n as it,g as j,q as U,K as ro,L as lo,M as Js,N as La,A as fi,O as Ta,P as Ks,Q as Ra,R as co,U as Ia,l as ho,T as gi,v as be,C as Xs,V as Gs,s as uo,X as Ms,u as Ea,H as Fa}from"./index.js";import{L as O}from"./localeText.js";import{d as Ut}from"./dayjs.min.js";import{b as Ba}from"./browser.js";import za from"./peerCreate.js";import{V as fo}from"./vue-datepicker.js";import"./wireguard.js";const Na={name:"peerSearch",components:{LocaleText:O},setup(){const s=At(),t=Ye();return{store:s,wireguardConfigurationStore:t}},props:{configuration:Object},data(){return{sort:{status:Lt("Status"),name:Lt("Name"),allowed_ip:Lt("Allowed IPs"),restricted:Lt("Restricted")},interval:{5e3:Lt("5 Seconds"),1e4:Lt("10 Seconds"),3e4:Lt("30 Seconds"),6e4:Lt("1 Minutes")},searchString:"",searchStringTimeout:void 0,showDisplaySettings:!1,showMoreSettings:!1}},methods:{debounce(){this.searchStringTimeout?(clearTimeout(this.searchStringTimeout),this.searchStringTimeout=setTimeout(()=>{this.wireguardConfigurationStore.searchString=this.searchString},300)):this.searchStringTimeout=setTimeout(()=>{this.wireguardConfigurationStore.searchString=this.searchString},300)},updateSort(s){ut("/api/updateDashboardConfigurationItem",{section:"Server",key:"dashboard_sort",value:s},t=>{t.status&&this.store.getConfiguration()})},updateRefreshInterval(s){ut("/api/updateDashboardConfigurationItem",{section:"Server",key:"dashboard_refresh_interval",value:s},t=>{t.status&&this.store.getConfiguration()})},downloadAllPeer(){$t(`/api/downloadAllPeers/${this.configuration.Name}`,{},s=>{console.log(s),window.wireguard.generateZipFiles(s,this.configuration.Name)})}},computed:{searchBarPlaceholder(){return Lt("Search Peers...")}}},Va={class:"mb-3"},ja={class:"d-flex gap-2 z-3 peerSearchContainer"},Wa={class:"mt-3 mt-md-0 flex-grow-1"},Ha=["placeholder"],Ua={key:0,class:"peerSettingContainer w-100 h-100 position-absolute top-0 start-0 overflow-y-scroll displayModal"},Ya={class:"container-md d-flex h-100 w-100"},Ja={class:"m-auto modal-dialog-centered dashboardModal"},Ka={class:"card rounded-3 shadow w-100"},Xa={class:"card-header bg-transparent d-flex align-items-center gap-2 border-0 p-4 pb-2"},Ga={class:"mb-0 fw-normal"},qa={class:"card-body px-4 pb-4 d-flex gap-3 flex-column"},Qa={class:"text-muted fw-bold mb-2"},Za={class:"list-group"},tr=["onClick"],er={class:"me-auto"},sr={key:0,class:"bi bi-check text-primary"},ir={class:"text-muted fw-bold mb-2"},nr={class:"list-group"},or=["onClick"],ar={class:"me-auto"},rr={key:0,class:"bi bi-check text-primary"},lr={key:0,class:"peerSettingContainer w-100 h-100 position-absolute top-0 start-0 overflow-y-scroll displayModal"},cr={class:"container-md d-flex h-100 w-100"},dr={class:"m-auto modal-dialog-centered dashboardModal"},hr={class:"card rounded-3 shadow w-100"},ur={class:"card-header bg-transparent d-flex align-items-center gap-2 border-0 p-4"},fr={class:"mb-0"},gr={class:"card-body px-4 pb-4 d-flex gap-3 flex-column pt-0"},pr={class:"text-muted fw-bold mb-2"},mr={class:"list-group"},br={class:"text-muted fw-bold mb-2"},_r={class:"list-group"};function xr(s,t,e,i,n,o){const a=V("LocaleText"),r=V("RouterLink");return S(),C("div",Va,[h("div",ja,[y(r,{to:"create",class:"text-decoration-none btn text-primary-emphasis bg-primary-subtle rounded-3 border-1 border-primary-subtle shadow-sm"},{default:nt(()=>[t[13]||(t[13]=h("i",{class:"bi bi-plus-lg me-2"},null,-1)),y(a,{t:"Peer"})]),_:1}),h("button",{class:"btn text-primary-emphasis bg-primary-subtle rounded-3 border-1 border-primary-subtle shadow-sm",onClick:t[0]||(t[0]=l=>this.downloadAllPeer())},[t[14]||(t[14]=h("i",{class:"bi bi-download me-2"},null,-1)),y(a,{t:"Download All"})]),h("div",Wa,[K(h("input",{class:"form-control rounded-3 bg-secondary-subtle border-1 border-secondary-subtle shadow-sm w-100",placeholder:o.searchBarPlaceholder,id:"searchPeers",onKeyup:t[1]||(t[1]=l=>this.debounce()),"onUpdate:modelValue":t[2]||(t[2]=l=>this.searchString=l)},null,40,Ha),[[rt,this.searchString]])]),h("button",{onClick:t[3]||(t[3]=l=>this.showDisplaySettings=!0),class:"btn text-secondary-emphasis bg-secondary-subtle rounded-3 border-1 border-secondary-subtle shadow-sm",type:"button","aria-expanded":"false"},[t[15]||(t[15]=h("i",{class:"bi bi-filter-circle me-2"},null,-1)),y(a,{t:"Display"})]),h("button",{class:"btn text-secondary-emphasis bg-secondary-subtle rounded-3 border-1 border-secondary-subtle shadow-sm",onClick:t[4]||(t[4]=l=>this.$emit("editConfiguration")),type:"button","aria-expanded":"false"},t[16]||(t[16]=[h("i",{class:"bi bi-gear-fill"},null,-1)])),h("button",{class:"btn text-secondary-emphasis bg-secondary-subtle rounded-3 border-1 border-secondary-subtle shadow-sm",onClick:t[5]||(t[5]=l=>this.showMoreSettings=!0),type:"button","aria-expanded":"false"},t[17]||(t[17]=[h("i",{class:"bi bi-three-dots"},null,-1)])),y(gt,{name:"zoom"},{default:nt(()=>[this.showDisplaySettings?(S(),C("div",Ua,[h("div",Ya,[h("div",Ja,[h("div",Ka,[h("div",Xa,[h("h4",Ga,[y(a,{t:"Display"})]),h("button",{type:"button",class:"btn-close ms-auto",onClick:t[6]||(t[6]=l=>this.showDisplaySettings=!1)})]),h("div",qa,[h("div",null,[h("p",Qa,[h("small",null,[y(a,{t:"Sort by"})])]),h("div",Za,[(S(!0),C(ct,null,Ot(this.sort,(l,c)=>(S(),C("a",{class:"list-group-item list-group-item-action d-flex",role:"button",onClick:d=>this.updateSort(c)},[h("span",er,F(l),1),i.store.Configuration.Server.dashboard_sort===c?(S(),C("i",sr)):T("",!0)],8,tr))),256))])]),h("div",null,[h("p",ir,[h("small",null,[y(a,{t:"Refresh Interval"})])]),h("div",nr,[(S(!0),C(ct,null,Ot(this.interval,(l,c)=>(S(),C("a",{class:"list-group-item list-group-item-action d-flex",role:"button",onClick:d=>this.updateRefreshInterval(c)},[h("span",ar,F(l),1),i.store.Configuration.Server.dashboard_refresh_interval===c?(S(),C("i",rr)):T("",!0)],8,or))),256))])])])])])])])):T("",!0)]),_:1}),y(gt,{name:"zoom"},{default:nt(()=>[this.showMoreSettings?(S(),C("div",lr,[h("div",cr,[h("div",dr,[h("div",hr,[h("div",ur,[h("h4",fr,[y(a,{t:"Other Settings"})]),h("button",{type:"button",class:"btn-close ms-auto",onClick:t[7]||(t[7]=l=>this.showMoreSettings=!1)})]),h("div",gr,[h("div",null,[h("p",pr,[h("small",null,[y(a,{t:"Peers"})])]),h("div",mr,[h("a",{class:"list-group-item list-group-item-action d-flex",role:"button",onClick:t[8]||(t[8]=l=>this.$emit("selectPeers"))},[y(a,{t:"Select Peers"})]),h("a",{class:"list-group-item list-group-item-action d-flex",role:"button",onClick:t[9]||(t[9]=l=>this.$emit("jobsAll"))},[y(a,{t:"Active Jobs"})]),h("a",{class:"list-group-item list-group-item-action d-flex",role:"button",onClick:t[10]||(t[10]=l=>this.$emit("jobLogs"))},[y(a,{t:"Logs"})])])]),h("div",null,[h("p",br,[h("small",null,[y(a,{t:"Configuration"})])]),h("div",_r,[h("a",{class:"list-group-item list-group-item-action d-flex",role:"button",onClick:t[11]||(t[11]=l=>this.$emit("backupRestore"))},[y(a,{t:"Backup & Restore"})]),h("a",{class:"list-group-item list-group-item-action d-flex text-danger fw-bold",role:"button",onClick:t[12]||(t[12]=l=>this.$emit("deleteConfiguration"))},[y(a,{t:"Delete Configuration"})])])])])])])])])):T("",!0)]),_:1})])])}const yr=pt(Na,[["render",xr],["__scopeId","data-v-162e14b9"]]);function vr(s){return Oa()?(Aa(s),!0):!1}function go(s){return typeof s=="function"?s():gs(s)}const po=typeof window<"u"&&typeof document<"u";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const wr=Object.prototype.toString,kr=s=>wr.call(s)==="[object Object]",hs=()=>{},Sr=Mr();function Mr(){var s,t;return po&&((s=window?.navigator)==null?void 0:s.userAgent)&&(/iP(?:ad|hone|od)/.test(window.navigator.userAgent)||((t=window?.navigator)==null?void 0:t.maxTouchPoints)>2&&/iPad|Macintosh/.test(window?.navigator.userAgent))}function Oe(s){var t;const e=go(s);return(t=e?.$el)!=null?t:e}const mo=po?window:void 0;function Ts(...s){let t,e,i,n;if(typeof s[0]=="string"||Array.isArray(s[0])?([e,i,n]=s,t=mo):[t,e,i,n]=s,!t)return hs;Array.isArray(e)||(e=[e]),Array.isArray(i)||(i=[i]);const o=[],a=()=>{o.forEach(d=>d()),o.length=0},r=(d,u,f,g)=>(d.addEventListener(u,f,g),()=>d.removeEventListener(u,f,g)),l=Ss(()=>[Oe(t),go(n)],([d,u])=>{if(a(),!d)return;const f=kr(u)?{...u}:u;o.push(...e.flatMap(g=>i.map(p=>r(d,g,p,f))))},{immediate:!0,flush:"post"}),c=()=>{l(),a()};return vr(c),c}let Li=!1;function Pr(s,t,e={}){const{window:i=mo,ignore:n=[],capture:o=!0,detectIframe:a=!1}=e;if(!i)return hs;Sr&&!Li&&(Li=!0,Array.from(i.document.body.children).forEach(f=>f.addEventListener("click",hs)),i.document.documentElement.addEventListener("click",hs));let r=!0;const l=f=>n.some(g=>{if(typeof g=="string")return Array.from(i.document.querySelectorAll(g)).some(p=>p===f.target||f.composedPath().includes(p));{const p=Oe(g);return p&&(f.target===p||f.composedPath().includes(p))}}),d=[Ts(i,"click",f=>{const g=Oe(s);if(!(!g||g===f.target||f.composedPath().includes(g))){if(f.detail===0&&(r=!l(f)),!r){r=!0;return}t(f)}},{passive:!0,capture:o}),Ts(i,"pointerdown",f=>{const g=Oe(s);r=!l(f)&&!!(g&&!f.composedPath().includes(g))},{passive:!0}),a&&Ts(i,"blur",f=>{setTimeout(()=>{var g;const p=Oe(s);((g=i.document.activeElement)==null?void 0:g.tagName)==="IFRAME"&&!p?.contains(i.document.activeElement)&&t(f)},0)})].filter(Boolean);return()=>d.forEach(f=>f())}const Cr={name:"peerSettingsDropdown",components:{LocaleText:O},setup(){return{dashboardStore:At()}},props:{Peer:Object},data(){return{deleteBtnDisabled:!1,restrictBtnDisabled:!1,allowAccessBtnDisabled:!1,confirmDelete:!1}},methods:{downloadPeer(){$t("/api/downloadPeer/"+this.$route.params.id,{id:this.Peer.id},s=>{if(s.status){const t=new Blob([s.data.file],{type:"text/plain"}),e=URL.createObjectURL(t),i=`${s.data.fileName}.conf`,n=document.createElement("a");n.href=e,n.download=i,n.click(),this.dashboardStore.newMessage("WGDashboard","Peer download started","success")}else this.dashboardStore.newMessage("Server",s.message,"danger")})},downloadQRCode(){$t("/api/downloadPeer/"+this.$route.params.id,{id:this.Peer.id},s=>{s.status?this.$emit("qrcode",s.data.file):this.dashboardStore.newMessage("Server",s.message,"danger")})},deletePeer(){this.deleteBtnDisabled=!0,ut(`/api/deletePeers/${this.$route.params.id}`,{peers:[this.Peer.id]},s=>{this.dashboardStore.newMessage("Server",s.message,s.status?"success":"danger"),this.$emit("refresh"),this.deleteBtnDisabled=!1})},restrictPeer(){this.restrictBtnDisabled=!0,ut(`/api/restrictPeers/${this.$route.params.id}`,{peers:[this.Peer.id]},s=>{this.dashboardStore.newMessage("Server",s.message,s.status?"success":"danger"),this.$emit("refresh"),this.restrictBtnDisabled=!1})},allowAccessPeer(){this.allowAccessBtnDisabled=!0,ut(`/api/allowAccessPeers/${this.$route.params.id}`,{peers:[this.Peer.id]},s=>{this.dashboardStore.newMessage("Server",s.message,s.status?"success":"danger"),this.$emit("refresh"),this.allowAccessBtnDisabled=!1})}}},Dr={class:"dropdown-menu mt-2 shadow-lg d-block rounded-3",style:{"max-width":"200px"}},$r={style:{"font-size":"0.8rem","padding-left":"var(--bs-dropdown-item-padding-x)","padding-right":"var(--bs-dropdown-item-padding-x)"}},Or={class:"text-body d-flex"},Ar={class:"ms-auto"},Lr={key:1},Tr={class:"w-100 dropdown-item text-muted",style:{"white-space":"break-spaces","font-size":"0.7rem"}},Rr={key:2,class:"d-flex",style:{"padding-left":"var(--bs-dropdown-item-padding-x)","padding-right":"var(--bs-dropdown-item-padding-x)"}},Ir={key:1,class:"confirmDelete"},Er={style:{"white-space":"break-spaces"},class:"mb-2 d-block fw-bold"},Fr={class:"d-flex w-100 gap-2"},Br=["disabled"],zr=["disabled"],Nr={key:1};function Vr(s,t,e,i,n,o){const a=V("LocaleText");return S(),C("ul",Dr,[this.Peer.restricted?(S(),C("li",Nr,[h("a",{class:it(["dropdown-item d-flex text-warning",{disabled:this.allowAccessBtnDisabled}]),onClick:t[9]||(t[9]=r=>this.allowAccessPeer()),role:"button"},[t[23]||(t[23]=h("i",{class:"me-auto bi bi-unlock"},null,-1)),this.allowAccessBtnDisabled?(S(),j(a,{key:1,t:"Allowing Access..."})):(S(),j(a,{key:0,t:"Allow Access"}))],2)])):(S(),C(ct,{key:0},[this.confirmDelete?(S(),C("li",Ir,[h("p",Er,[y(a,{t:"Are you sure to delete this peer?"})]),h("div",Fr,[h("button",{onClick:t[7]||(t[7]=r=>this.deletePeer()),disabled:this.deleteBtnDisabled,class:"flex-grow-1 ms-auto btn btn-sm bg-danger"},[y(a,{t:"Yes"})],8,Br),h("button",{disabled:this.deleteBtnDisabled,onClick:t[8]||(t[8]=r=>this.confirmDelete=!1),class:"flex-grow-1 btn btn-sm bg-secondary-subtle text-secondary-emphasis border border-secondary-subtle"},[y(a,{t:"No"})],8,zr)])])):(S(),C(ct,{key:0},[this.Peer.status==="running"?(S(),C(ct,{key:0},[h("li",$r,[h("span",Or,[t[10]||(t[10]=h("i",{class:"bi bi-box-arrow-in-right"},null,-1)),h("span",Ar,F(this.Peer.endpoint),1)])]),t[11]||(t[11]=h("li",null,[h("hr",{class:"dropdown-divider"})],-1))],64)):T("",!0),this.Peer.private_key?(S(),C("li",Rr,[h("a",{class:"dropdown-item text-center px-0 rounded-3",role:"button",onClick:t[0]||(t[0]=r=>this.downloadPeer())},t[12]||(t[12]=[h("i",{class:"me-auto bi bi-download"},null,-1)])),h("a",{class:"dropdown-item text-center px-0 rounded-3",role:"button",onClick:t[1]||(t[1]=r=>this.downloadQRCode())},t[13]||(t[13]=[h("i",{class:"me-auto bi bi-qr-code"},null,-1)])),h("a",{class:"dropdown-item text-center px-0 rounded-3",role:"button",onClick:t[2]||(t[2]=r=>this.$emit("share"))},t[14]||(t[14]=[h("i",{class:"me-auto bi bi-share"},null,-1)]))])):(S(),C("li",Lr,[h("small",Tr,[y(a,{t:"Download & QR Code is not available due to no private key set for this peer"})])])),t[21]||(t[21]=h("li",null,[h("hr",{class:"dropdown-divider"})],-1)),h("li",null,[h("a",{class:"dropdown-item d-flex",role:"button",onClick:t[3]||(t[3]=r=>this.$emit("setting"))},[t[15]||(t[15]=h("i",{class:"me-auto bi bi-pen"},null,-1)),t[16]||(t[16]=st()),y(a,{t:"Peer Settings"})])]),h("li",null,[h("a",{class:"dropdown-item d-flex",role:"button",onClick:t[4]||(t[4]=r=>this.$emit("jobs"))},[t[17]||(t[17]=h("i",{class:"me-auto bi bi-app-indicator"},null,-1)),t[18]||(t[18]=st()),y(a,{t:"Schedule Jobs"})])]),t[22]||(t[22]=h("li",null,[h("hr",{class:"dropdown-divider"})],-1)),h("li",null,[h("a",{class:it(["dropdown-item d-flex text-warning",{disabled:this.restrictBtnDisabled}]),onClick:t[5]||(t[5]=r=>this.restrictPeer()),role:"button"},[t[19]||(t[19]=h("i",{class:"me-auto bi bi-lock"},null,-1)),this.restrictBtnDisabled?(S(),j(a,{key:1,t:"Restricting..."})):(S(),j(a,{key:0,t:"Restrict Access"}))],2)]),h("li",null,[h("a",{class:it(["dropdown-item d-flex fw-bold text-danger",{disabled:this.deleteBtnDisabled}]),onClick:t[6]||(t[6]=r=>this.confirmDelete=!0),role:"button"},[t[20]||(t[20]=h("i",{class:"me-auto bi bi-trash"},null,-1)),this.deleteBtnDisabled?(S(),j(a,{key:1,t:"Deleting..."})):(S(),j(a,{key:0,t:"Delete"}))],2)])],64))],64))])}const jr=pt(Cr,[["render",Vr],["__scopeId","data-v-f8d25e4d"]]),Wr={name:"peer",components:{LocaleText:O,PeerSettingsDropdown:jr},props:{Peer:Object},data(){return{}},setup(){const s=U(null),t=U(!1);return Pr(s,e=>{t.value=!1}),{target:s,subMenuOpened:t}},computed:{getLatestHandshake(){return this.Peer.latest_handshake.includes(",")?this.Peer.latest_handshake.split(",")[0]:this.Peer.latest_handshake}}},Hr={key:0,class:"card-header bg-transparent d-flex align-items-center gap-2 border-0"},Ur={style:{"font-size":"0.8rem"},class:"ms-auto d-flex gap-2"},Yr={class:"text-primary"},Jr={class:"text-success"},Kr={key:0,class:"text-secondary"},Xr={key:1,class:"border-0 card-header bg-transparent text-warning fw-bold",style:{"font-size":"0.8rem"}},Gr={class:"card-body pt-1",style:{"font-size":"0.9rem"}},qr={class:"mb-1"},Qr={class:"text-muted"},Zr={class:"d-block"},tl={class:"text-muted"},el={class:"d-block"},sl={class:"d-flex align-items-end"};function il(s,t,e,i,n,o){const a=V("LocaleText"),r=V("PeerSettingsDropdown");return S(),C("div",{class:it(["card shadow-sm rounded-3 peerCard bg-transparent",{"border-warning":e.Peer.restricted}])},[h("div",null,[e.Peer.restricted?(S(),C("div",Xr,[t[11]||(t[11]=h("i",{class:"bi-lock-fill me-2"},null,-1)),y(a,{t:"Access Restricted"})])):(S(),C("div",Hr,[h("div",{class:it(["dot ms-0",{active:e.Peer.status==="running"}])},null,2),h("div",Ur,[h("span",Yr,[t[6]||(t[6]=h("i",{class:"bi bi-arrow-down"},null,-1)),h("strong",null,F((e.Peer.cumu_receive+e.Peer.total_receive).toFixed(4)),1),t[7]||(t[7]=st(" GB "))]),h("span",Jr,[t[8]||(t[8]=h("i",{class:"bi bi-arrow-up"},null,-1)),h("strong",null,F((e.Peer.cumu_sent+e.Peer.total_sent).toFixed(4)),1),t[9]||(t[9]=st(" GB "))]),e.Peer.latest_handshake!=="No Handshake"?(S(),C("span",Kr,[t[10]||(t[10]=h("i",{class:"bi bi-arrows-angle-contract"},null,-1)),st(" "+F(o.getLatestHandshake)+" ago ",1)])):T("",!0)])]))]),h("div",Gr,[h("h6",null,F(e.Peer.name?e.Peer.name:"Untitled Peer"),1),h("div",qr,[h("small",Qr,[y(a,{t:"Public Key"})]),h("small",Zr,[h("samp",null,F(e.Peer.id),1)])]),h("div",null,[h("small",tl,[y(a,{t:"Allowed IPs"})]),h("small",el,[h("samp",null,F(e.Peer.allowed_ip),1)])]),h("div",sl,[h("div",{class:it(["ms-auto px-2 rounded-3 subMenuBtn",{active:this.subMenuOpened}])},[h("a",{role:"button",class:"text-body",onClick:t[0]||(t[0]=l=>this.subMenuOpened=!0)},t[12]||(t[12]=[h("h5",{class:"mb-0"},[h("i",{class:"bi bi-three-dots"})],-1)])),y(gt,{name:"slide-fade"},{default:nt(()=>[this.subMenuOpened?(S(),j(r,{key:0,onQrcode:t[1]||(t[1]=l=>this.$emit("qrcode",l)),onSetting:t[2]||(t[2]=l=>this.$emit("setting")),onJobs:t[3]||(t[3]=l=>this.$emit("jobs")),onRefresh:t[4]||(t[4]=l=>this.$emit("refresh")),onShare:t[5]||(t[5]=l=>this.$emit("share")),Peer:e.Peer,ref:"target"},null,8,["Peer"])):T("",!0)]),_:1})],2)])])],2)}const nl=pt(Wr,[["render",il],["__scopeId","data-v-4b600874"]]);/*! * @kurkle/color v0.3.2 * https://github.com/kurkle/color#readme * (c) 2023 Jukka Kurkela * Released under the MIT License */function Je(s){return s+.5|0}const jt=(s,t,e)=>Math.max(Math.min(s,e),t);function Ae(s){return jt(Je(s*2.55),0,255)}function Yt(s){return jt(Je(s*255),0,255)}function Et(s){return jt(Je(s/2.55)/100,0,1)}function Ti(s){return jt(Je(s*100),0,100)}const vt={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,A:10,B:11,C:12,D:13,E:14,F:15,a:10,b:11,c:12,d:13,e:14,f:15},qs=[..."0123456789ABCDEF"],ol=s=>qs[s&15],al=s=>qs[(s&240)>>4]+qs[s&15],qe=s=>(s&240)>>4===(s&15),rl=s=>qe(s.r)&&qe(s.g)&&qe(s.b)&&qe(s.a);function ll(s){var t=s.length,e;return s[0]==="#"&&(t===4||t===5?e={r:255&vt[s[1]]*17,g:255&vt[s[2]]*17,b:255&vt[s[3]]*17,a:t===5?vt[s[4]]*17:255}:(t===7||t===9)&&(e={r:vt[s[1]]<<4|vt[s[2]],g:vt[s[3]]<<4|vt[s[4]],b:vt[s[5]]<<4|vt[s[6]],a:t===9?vt[s[7]]<<4|vt[s[8]]:255})),e}const cl=(s,t)=>s<255?t(s):"";function dl(s){var t=rl(s)?ol:al;return s?"#"+t(s.r)+t(s.g)+t(s.b)+cl(s.a,t):void 0}const hl=/^(hsla?|hwb|hsv)\(\s*([-+.e\d]+)(?:deg)?[\s,]+([-+.e\d]+)%[\s,]+([-+.e\d]+)%(?:[\s,]+([-+.e\d]+)(%)?)?\s*\)$/;function bo(s,t,e){const i=t*Math.min(e,1-e),n=(o,a=(o+s/30)%12)=>e-i*Math.max(Math.min(a-3,9-a,1),-1);return[n(0),n(8),n(4)]}function ul(s,t,e){const i=(n,o=(n+s/60)%6)=>e-e*t*Math.max(Math.min(o,4-o,1),0);return[i(5),i(3),i(1)]}function fl(s,t,e){const i=bo(s,1,.5);let n;for(t+e>1&&(n=1/(t+e),t*=n,e*=n),n=0;n<3;n++)i[n]*=1-t-e,i[n]+=t;return i}function gl(s,t,e,i,n){return s===n?(t-e)/i+(t.5?d/(2-o-a):d/(o+a),l=gl(e,i,n,d,o),l=l*60+.5),[l|0,c||0,r]}function mi(s,t,e,i){return(Array.isArray(t)?s(t[0],t[1],t[2]):s(t,e,i)).map(Yt)}function bi(s,t,e){return mi(bo,s,t,e)}function pl(s,t,e){return mi(fl,s,t,e)}function ml(s,t,e){return mi(ul,s,t,e)}function _o(s){return(s%360+360)%360}function bl(s){const t=hl.exec(s);let e=255,i;if(!t)return;t[5]!==i&&(e=t[6]?Ae(+t[5]):Yt(+t[5]));const n=_o(+t[2]),o=+t[3]/100,a=+t[4]/100;return t[1]==="hwb"?i=pl(n,o,a):t[1]==="hsv"?i=ml(n,o,a):i=bi(n,o,a),{r:i[0],g:i[1],b:i[2],a:e}}function _l(s,t){var e=pi(s);e[0]=_o(e[0]+t),e=bi(e),s.r=e[0],s.g=e[1],s.b=e[2]}function xl(s){if(!s)return;const t=pi(s),e=t[0],i=Ti(t[1]),n=Ti(t[2]);return s.a<255?`hsla(${e}, ${i}%, ${n}%, ${Et(s.a)})`:`hsl(${e}, ${i}%, ${n}%)`}const Ri={x:"dark",Z:"light",Y:"re",X:"blu",W:"gr",V:"medium",U:"slate",A:"ee",T:"ol",S:"or",B:"ra",C:"lateg",D:"ights",R:"in",Q:"turquois",E:"hi",P:"ro",O:"al",N:"le",M:"de",L:"yello",F:"en",K:"ch",G:"arks",H:"ea",I:"ightg",J:"wh"},Ii={OiceXe:"f0f8ff",antiquewEte:"faebd7",aqua:"ffff",aquamarRe:"7fffd4",azuY:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"0",blanKedOmond:"ffebcd",Xe:"ff",XeviTet:"8a2be2",bPwn:"a52a2a",burlywood:"deb887",caMtXe:"5f9ea0",KartYuse:"7fff00",KocTate:"d2691e",cSO:"ff7f50",cSnflowerXe:"6495ed",cSnsilk:"fff8dc",crimson:"dc143c",cyan:"ffff",xXe:"8b",xcyan:"8b8b",xgTMnPd:"b8860b",xWay:"a9a9a9",xgYF:"6400",xgYy:"a9a9a9",xkhaki:"bdb76b",xmagFta:"8b008b",xTivegYF:"556b2f",xSange:"ff8c00",xScEd:"9932cc",xYd:"8b0000",xsOmon:"e9967a",xsHgYF:"8fbc8f",xUXe:"483d8b",xUWay:"2f4f4f",xUgYy:"2f4f4f",xQe:"ced1",xviTet:"9400d3",dAppRk:"ff1493",dApskyXe:"bfff",dimWay:"696969",dimgYy:"696969",dodgerXe:"1e90ff",fiYbrick:"b22222",flSOwEte:"fffaf0",foYstWAn:"228b22",fuKsia:"ff00ff",gaRsbSo:"dcdcdc",ghostwEte:"f8f8ff",gTd:"ffd700",gTMnPd:"daa520",Way:"808080",gYF:"8000",gYFLw:"adff2f",gYy:"808080",honeyMw:"f0fff0",hotpRk:"ff69b4",RdianYd:"cd5c5c",Rdigo:"4b0082",ivSy:"fffff0",khaki:"f0e68c",lavFMr:"e6e6fa",lavFMrXsh:"fff0f5",lawngYF:"7cfc00",NmoncEffon:"fffacd",ZXe:"add8e6",ZcSO:"f08080",Zcyan:"e0ffff",ZgTMnPdLw:"fafad2",ZWay:"d3d3d3",ZgYF:"90ee90",ZgYy:"d3d3d3",ZpRk:"ffb6c1",ZsOmon:"ffa07a",ZsHgYF:"20b2aa",ZskyXe:"87cefa",ZUWay:"778899",ZUgYy:"778899",ZstAlXe:"b0c4de",ZLw:"ffffe0",lime:"ff00",limegYF:"32cd32",lRF:"faf0e6",magFta:"ff00ff",maPon:"800000",VaquamarRe:"66cdaa",VXe:"cd",VScEd:"ba55d3",VpurpN:"9370db",VsHgYF:"3cb371",VUXe:"7b68ee",VsprRggYF:"fa9a",VQe:"48d1cc",VviTetYd:"c71585",midnightXe:"191970",mRtcYam:"f5fffa",mistyPse:"ffe4e1",moccasR:"ffe4b5",navajowEte:"ffdead",navy:"80",Tdlace:"fdf5e6",Tive:"808000",TivedBb:"6b8e23",Sange:"ffa500",SangeYd:"ff4500",ScEd:"da70d6",pOegTMnPd:"eee8aa",pOegYF:"98fb98",pOeQe:"afeeee",pOeviTetYd:"db7093",papayawEp:"ffefd5",pHKpuff:"ffdab9",peru:"cd853f",pRk:"ffc0cb",plum:"dda0dd",powMrXe:"b0e0e6",purpN:"800080",YbeccapurpN:"663399",Yd:"ff0000",Psybrown:"bc8f8f",PyOXe:"4169e1",saddNbPwn:"8b4513",sOmon:"fa8072",sandybPwn:"f4a460",sHgYF:"2e8b57",sHshell:"fff5ee",siFna:"a0522d",silver:"c0c0c0",skyXe:"87ceeb",UXe:"6a5acd",UWay:"708090",UgYy:"708090",snow:"fffafa",sprRggYF:"ff7f",stAlXe:"4682b4",tan:"d2b48c",teO:"8080",tEstN:"d8bfd8",tomato:"ff6347",Qe:"40e0d0",viTet:"ee82ee",JHt:"f5deb3",wEte:"ffffff",wEtesmoke:"f5f5f5",Lw:"ffff00",LwgYF:"9acd32"};function yl(){const s={},t=Object.keys(Ii),e=Object.keys(Ri);let i,n,o,a,r;for(i=0;i>16&255,o>>8&255,o&255]}return s}let Qe;function vl(s){Qe||(Qe=yl(),Qe.transparent=[0,0,0,0]);const t=Qe[s.toLowerCase()];return t&&{r:t[0],g:t[1],b:t[2],a:t.length===4?t[3]:255}}const wl=/^rgba?\(\s*([-+.\d]+)(%)?[\s,]+([-+.e\d]+)(%)?[\s,]+([-+.e\d]+)(%)?(?:[\s,/]+([-+.e\d]+)(%)?)?\s*\)$/;function kl(s){const t=wl.exec(s);let e=255,i,n,o;if(t){if(t[7]!==i){const a=+t[7];e=t[8]?Ae(a):jt(a*255,0,255)}return i=+t[1],n=+t[3],o=+t[5],i=255&(t[2]?Ae(i):jt(i,0,255)),n=255&(t[4]?Ae(n):jt(n,0,255)),o=255&(t[6]?Ae(o):jt(o,0,255)),{r:i,g:n,b:o,a:e}}}function Sl(s){return s&&(s.a<255?`rgba(${s.r}, ${s.g}, ${s.b}, ${Et(s.a)})`:`rgb(${s.r}, ${s.g}, ${s.b})`)}const Rs=s=>s<=.0031308?s*12.92:Math.pow(s,1/2.4)*1.055-.055,ge=s=>s<=.04045?s/12.92:Math.pow((s+.055)/1.055,2.4);function Ml(s,t,e){const i=ge(Et(s.r)),n=ge(Et(s.g)),o=ge(Et(s.b));return{r:Yt(Rs(i+e*(ge(Et(t.r))-i))),g:Yt(Rs(n+e*(ge(Et(t.g))-n))),b:Yt(Rs(o+e*(ge(Et(t.b))-o))),a:s.a+e*(t.a-s.a)}}function Ze(s,t,e){if(s){let i=pi(s);i[t]=Math.max(0,Math.min(i[t]+i[t]*e,t===0?360:1)),i=bi(i),s.r=i[0],s.g=i[1],s.b=i[2]}}function xo(s,t){return s&&Object.assign(t||{},s)}function Ei(s){var t={r:0,g:0,b:0,a:255};return Array.isArray(s)?s.length>=3&&(t={r:s[0],g:s[1],b:s[2],a:255},s.length>3&&(t.a=Yt(s[3]))):(t=xo(s,{r:0,g:0,b:0,a:1}),t.a=Yt(t.a)),t}function Pl(s){return s.charAt(0)==="r"?kl(s):bl(s)}class ze{constructor(t){if(t instanceof ze)return t;const e=typeof t;let i;e==="object"?i=Ei(t):e==="string"&&(i=ll(t)||vl(t)||Pl(t)),this._rgb=i,this._valid=!!i}get valid(){return this._valid}get rgb(){var t=xo(this._rgb);return t&&(t.a=Et(t.a)),t}set rgb(t){this._rgb=Ei(t)}rgbString(){return this._valid?Sl(this._rgb):void 0}hexString(){return this._valid?dl(this._rgb):void 0}hslString(){return this._valid?xl(this._rgb):void 0}mix(t,e){if(t){const i=this.rgb,n=t.rgb;let o;const a=e===o?.5:e,r=2*a-1,l=i.a-n.a,c=((r*l===-1?r:(r+l)/(1+r*l))+1)/2;o=1-c,i.r=255&c*i.r+o*n.r+.5,i.g=255&c*i.g+o*n.g+.5,i.b=255&c*i.b+o*n.b+.5,i.a=a*i.a+(1-a)*n.a,this.rgb=i}return this}interpolate(t,e){return t&&(this._rgb=Ml(this._rgb,t._rgb,e)),this}clone(){return new ze(this.rgb)}alpha(t){return this._rgb.a=Yt(t),this}clearer(t){const e=this._rgb;return e.a*=1-t,this}greyscale(){const t=this._rgb,e=Je(t.r*.3+t.g*.59+t.b*.11);return t.r=t.g=t.b=e,this}opaquer(t){const e=this._rgb;return e.a*=1+t,this}negate(){const t=this._rgb;return t.r=255-t.r,t.g=255-t.g,t.b=255-t.b,this}lighten(t){return Ze(this._rgb,2,t),this}darken(t){return Ze(this._rgb,2,-t),this}saturate(t){return Ze(this._rgb,1,t),this}desaturate(t){return Ze(this._rgb,1,-t),this}rotate(t){return _l(this._rgb,t),this}}/*! * Chart.js v4.4.4 * https://www.chartjs.org * (c) 2024 Chart.js Contributors * Released under the MIT License */function Tt(){}const Cl=(()=>{let s=0;return()=>s++})();function N(s){return s===null||typeof s>"u"}function q(s){if(Array.isArray&&Array.isArray(s))return!0;const t=Object.prototype.toString.call(s);return t.slice(0,7)==="[object"&&t.slice(-6)==="Array]"}function B(s){return s!==null&&Object.prototype.toString.call(s)==="[object Object]"}function Q(s){return(typeof s=="number"||s instanceof Number)&&isFinite(+s)}function _t(s,t){return Q(s)?s:t}function I(s,t){return typeof s>"u"?t:s}const Dl=(s,t)=>typeof s=="string"&&s.endsWith("%")?parseFloat(s)/100:+s/t,yo=(s,t)=>typeof s=="string"&&s.endsWith("%")?parseFloat(s)/100*t:+s;function Y(s,t,e){if(s&&typeof s.call=="function")return s.apply(e,t)}function W(s,t,e,i){let n,o,a;if(q(s))for(o=s.length,n=0;ns,x:s=>s.x,y:s=>s.y};function Al(s){const t=s.split("."),e=[];let i="";for(const n of t)i+=n,i.endsWith("\\")?i=i.slice(0,-1)+".":(e.push(i),i="");return e}function Ll(s){const t=Al(s);return e=>{for(const i of t){if(i==="")break;e=e&&e[i]}return e}}function Jt(s,t){return(Fi[t]||(Fi[t]=Ll(t)))(s)}function _i(s){return s.charAt(0).toUpperCase()+s.slice(1)}const Ve=s=>typeof s<"u",Kt=s=>typeof s=="function",Bi=(s,t)=>{if(s.size!==t.size)return!1;for(const e of s)if(!t.has(e))return!1;return!0};function Tl(s){return s.type==="mouseup"||s.type==="click"||s.type==="contextmenu"}const G=Math.PI,X=2*G,Rl=X+G,bs=Number.POSITIVE_INFINITY,Il=G/180,et=G/2,te=G/4,zi=G*2/3,Wt=Math.log10,Dt=Math.sign;function Ee(s,t,e){return Math.abs(s-t)n-o).pop(),t}function xe(s){return!isNaN(parseFloat(s))&&isFinite(s)}function Fl(s,t){const e=Math.round(s);return e-t<=s&&e+t>=s}function wo(s,t,e){let i,n,o;for(i=0,n=s.length;il&&c=Math.min(t,e)-i&&s<=Math.max(t,e)+i}function yi(s,t,e){e=e||(a=>s[a]1;)o=n+i>>1,e(o)?n=o:i=o;return{lo:n,hi:i}}const Bt=(s,t,e,i)=>yi(s,e,i?n=>{const o=s[n][t];return os[n][t]yi(s,e,i=>s[i][t]>=e);function Vl(s,t,e){let i=0,n=s.length;for(;ii&&s[n-1]>e;)n--;return i>0||n{const i="_onData"+_i(e),n=s[e];Object.defineProperty(s,e,{configurable:!0,enumerable:!1,value(...o){const a=n.apply(this,o);return s._chartjs.listeners.forEach(r=>{typeof r[i]=="function"&&r[i](...o)}),a}})})}function ji(s,t){const e=s._chartjs;if(!e)return;const i=e.listeners,n=i.indexOf(t);n!==-1&&i.splice(n,1),!(i.length>0)&&(So.forEach(o=>{delete s[o]}),delete s._chartjs)}function Mo(s){const t=new Set(s);return t.size===s.length?s:Array.from(t)}const Po=function(){return typeof window>"u"?function(s){return s()}:window.requestAnimationFrame}();function Co(s,t){let e=[],i=!1;return function(...n){e=n,i||(i=!0,Po.call(window,()=>{i=!1,s.apply(t,e)}))}}function Wl(s,t){let e;return function(...i){return t?(clearTimeout(e),e=setTimeout(s,t,i)):s.apply(this,i),t}}const vi=s=>s==="start"?"left":s==="end"?"right":"center",ht=(s,t,e)=>s==="start"?t:s==="end"?e:(t+e)/2,Hl=(s,t,e,i)=>s===(i?"left":"right")?e:s==="center"?(t+e)/2:t;function Do(s,t,e){const i=t.length;let n=0,o=i;if(s._sorted){const{iScale:a,_parsed:r}=s,l=a.axis,{min:c,max:d,minDefined:u,maxDefined:f}=a.getUserBounds();u&&(n=lt(Math.min(Bt(r,l,c).lo,e?i:Bt(t,l,a.getPixelForValue(c)).lo),0,i-1)),f?o=lt(Math.max(Bt(r,a.axis,d,!0).hi+1,e?0:Bt(t,l,a.getPixelForValue(d),!0).hi+1),n,i)-n:o=i-n}return{start:n,count:o}}function $o(s){const{xScale:t,yScale:e,_scaleRanges:i}=s,n={xmin:t.min,xmax:t.max,ymin:e.min,ymax:e.max};if(!i)return s._scaleRanges=n,!0;const o=i.xmin!==t.min||i.xmax!==t.max||i.ymin!==e.min||i.ymax!==e.max;return Object.assign(i,n),o}const ts=s=>s===0||s===1,Wi=(s,t,e)=>-(Math.pow(2,10*(s-=1))*Math.sin((s-t)*X/e)),Hi=(s,t,e)=>Math.pow(2,-10*s)*Math.sin((s-t)*X/e)+1,Fe={linear:s=>s,easeInQuad:s=>s*s,easeOutQuad:s=>-s*(s-2),easeInOutQuad:s=>(s/=.5)<1?.5*s*s:-.5*(--s*(s-2)-1),easeInCubic:s=>s*s*s,easeOutCubic:s=>(s-=1)*s*s+1,easeInOutCubic:s=>(s/=.5)<1?.5*s*s*s:.5*((s-=2)*s*s+2),easeInQuart:s=>s*s*s*s,easeOutQuart:s=>-((s-=1)*s*s*s-1),easeInOutQuart:s=>(s/=.5)<1?.5*s*s*s*s:-.5*((s-=2)*s*s*s-2),easeInQuint:s=>s*s*s*s*s,easeOutQuint:s=>(s-=1)*s*s*s*s+1,easeInOutQuint:s=>(s/=.5)<1?.5*s*s*s*s*s:.5*((s-=2)*s*s*s*s+2),easeInSine:s=>-Math.cos(s*et)+1,easeOutSine:s=>Math.sin(s*et),easeInOutSine:s=>-.5*(Math.cos(G*s)-1),easeInExpo:s=>s===0?0:Math.pow(2,10*(s-1)),easeOutExpo:s=>s===1?1:-Math.pow(2,-10*s)+1,easeInOutExpo:s=>ts(s)?s:s<.5?.5*Math.pow(2,10*(s*2-1)):.5*(-Math.pow(2,-10*(s*2-1))+2),easeInCirc:s=>s>=1?s:-(Math.sqrt(1-s*s)-1),easeOutCirc:s=>Math.sqrt(1-(s-=1)*s),easeInOutCirc:s=>(s/=.5)<1?-.5*(Math.sqrt(1-s*s)-1):.5*(Math.sqrt(1-(s-=2)*s)+1),easeInElastic:s=>ts(s)?s:Wi(s,.075,.3),easeOutElastic:s=>ts(s)?s:Hi(s,.075,.3),easeInOutElastic(s){return ts(s)?s:s<.5?.5*Wi(s*2,.1125,.45):.5+.5*Hi(s*2-1,.1125,.45)},easeInBack(s){return s*s*((1.70158+1)*s-1.70158)},easeOutBack(s){return(s-=1)*s*((1.70158+1)*s+1.70158)+1},easeInOutBack(s){let t=1.70158;return(s/=.5)<1?.5*(s*s*(((t*=1.525)+1)*s-t)):.5*((s-=2)*s*(((t*=1.525)+1)*s+t)+2)},easeInBounce:s=>1-Fe.easeOutBounce(1-s),easeOutBounce(s){return s<1/2.75?7.5625*s*s:s<2/2.75?7.5625*(s-=1.5/2.75)*s+.75:s<2.5/2.75?7.5625*(s-=2.25/2.75)*s+.9375:7.5625*(s-=2.625/2.75)*s+.984375},easeInOutBounce:s=>s<.5?Fe.easeInBounce(s*2)*.5:Fe.easeOutBounce(s*2-1)*.5+.5};function wi(s){if(s&&typeof s=="object"){const t=s.toString();return t==="[object CanvasPattern]"||t==="[object CanvasGradient]"}return!1}function Ui(s){return wi(s)?s:new ze(s)}function Is(s){return wi(s)?s:new ze(s).saturate(.5).darken(.1).hexString()}const Ul=["x","y","borderWidth","radius","tension"],Yl=["color","borderColor","backgroundColor"];function Jl(s){s.set("animation",{delay:void 0,duration:1e3,easing:"easeOutQuart",fn:void 0,from:void 0,loop:void 0,to:void 0,type:void 0}),s.describe("animation",{_fallback:!1,_indexable:!1,_scriptable:t=>t!=="onProgress"&&t!=="onComplete"&&t!=="fn"}),s.set("animations",{colors:{type:"color",properties:Yl},numbers:{type:"number",properties:Ul}}),s.describe("animations",{_fallback:"animation"}),s.set("transitions",{active:{animation:{duration:400}},resize:{animation:{duration:0}},show:{animations:{colors:{from:"transparent"},visible:{type:"boolean",duration:0}}},hide:{animations:{colors:{to:"transparent"},visible:{type:"boolean",easing:"linear",fn:t=>t|0}}}})}function Kl(s){s.set("layout",{autoPadding:!0,padding:{top:0,right:0,bottom:0,left:0}})}const Yi=new Map;function Xl(s,t){t=t||{};const e=s+JSON.stringify(t);let i=Yi.get(e);return i||(i=new Intl.NumberFormat(s,t),Yi.set(e,i)),i}function Ke(s,t,e){return Xl(t,e).format(s)}const Oo={values(s){return q(s)?s:""+s},numeric(s,t,e){if(s===0)return"0";const i=this.chart.options.locale;let n,o=s;if(e.length>1){const c=Math.max(Math.abs(e[0].value),Math.abs(e[e.length-1].value));(c<1e-4||c>1e15)&&(n="scientific"),o=Gl(s,e)}const a=Wt(Math.abs(o)),r=isNaN(a)?1:Math.max(Math.min(-1*Math.floor(a),20),0),l={notation:n,minimumFractionDigits:r,maximumFractionDigits:r};return Object.assign(l,this.options.ticks.format),Ke(s,i,l)},logarithmic(s,t,e){if(s===0)return"0";const i=e[t].significand||s/Math.pow(10,Math.floor(Wt(s)));return[1,2,3,5,10,15].includes(i)||t>.8*e.length?Oo.numeric.call(this,s,t,e):""}};function Gl(s,t){let e=t.length>3?t[2].value-t[1].value:t[1].value-t[0].value;return Math.abs(e)>=1&&s!==Math.floor(s)&&(e=s-Math.floor(s)),e}var Ps={formatters:Oo};function ql(s){s.set("scale",{display:!0,offset:!1,reverse:!1,beginAtZero:!1,bounds:"ticks",clip:!0,grace:0,grid:{display:!0,lineWidth:1,drawOnChartArea:!0,drawTicks:!0,tickLength:8,tickWidth:(t,e)=>e.lineWidth,tickColor:(t,e)=>e.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:Ps.formatters.values,minor:{},major:{},align:"center",crossAlign:"near",showLabelBackdrop:!1,backdropColor:"rgba(255, 255, 255, 0.75)",backdropPadding:2}}),s.route("scale.ticks","color","","color"),s.route("scale.grid","color","","borderColor"),s.route("scale.border","color","","borderColor"),s.route("scale.title","color","","color"),s.describe("scale",{_fallback:!1,_scriptable:t=>!t.startsWith("before")&&!t.startsWith("after")&&t!=="callback"&&t!=="parser",_indexable:t=>t!=="borderDash"&&t!=="tickBorderDash"&&t!=="dash"}),s.describe("scales",{_fallback:"scale"}),s.describe("scale.ticks",{_scriptable:t=>t!=="backdropPadding"&&t!=="callback",_indexable:t=>t!=="backdropPadding"})}const ce=Object.create(null),Zs=Object.create(null);function Be(s,t){if(!t)return s;const e=t.split(".");for(let i=0,n=e.length;ii.chart.platform.getDevicePixelRatio(),this.elements={},this.events=["mousemove","mouseout","click","touchstart","touchmove"],this.font={family:"'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",size:12,style:"normal",lineHeight:1.2,weight:null},this.hover={},this.hoverBackgroundColor=(i,n)=>Is(n.backgroundColor),this.hoverBorderColor=(i,n)=>Is(n.borderColor),this.hoverColor=(i,n)=>Is(n.color),this.indexAxis="x",this.interaction={mode:"nearest",intersect:!0,includeInvisible:!1},this.maintainAspectRatio=!0,this.onHover=null,this.onClick=null,this.parsing=!0,this.plugins={},this.responsive=!0,this.scale=void 0,this.scales={},this.showLine=!0,this.drawActiveElementsOnTop=!0,this.describe(t),this.apply(e)}set(t,e){return Es(this,t,e)}get(t){return Be(this,t)}describe(t,e){return Es(Zs,t,e)}override(t,e){return Es(ce,t,e)}route(t,e,i,n){const o=Be(this,t),a=Be(this,i),r="_"+e;Object.defineProperties(o,{[r]:{value:o[e],writable:!0},[e]:{enumerable:!0,get(){const l=this[r],c=a[n];return B(l)?Object.assign({},c,l):I(l,c)},set(l){this[r]=l}}})}apply(t){t.forEach(e=>e(this))}}var Z=new Ql({_scriptable:s=>!s.startsWith("on"),_indexable:s=>s!=="events",hover:{_fallback:"interaction"},interaction:{_scriptable:!1,_indexable:!1}},[Jl,Kl,ql]);function Zl(s){return!s||N(s.size)||N(s.family)?null:(s.style?s.style+" ":"")+(s.weight?s.weight+" ":"")+s.size+"px "+s.family}function _s(s,t,e,i,n){let o=t[n];return o||(o=t[n]=s.measureText(n).width,e.push(n)),o>i&&(i=o),i}function tc(s,t,e,i){i=i||{};let n=i.data=i.data||{},o=i.garbageCollect=i.garbageCollect||[];i.font!==t&&(n=i.data={},o=i.garbageCollect=[],i.font=t),s.save(),s.font=t;let a=0;const r=e.length;let l,c,d,u,f;for(l=0;le.length){for(l=0;l0&&s.stroke()}}function zt(s,t,e){return e=e||.5,!t||s&&s.x>t.left-e&&s.xt.top-e&&s.y0&&o.strokeColor!=="";let l,c;for(s.save(),s.font=n.string,ic(s,o),l=0;l+s||0;function ki(s,t){const e={},i=B(t),n=i?Object.keys(t):t,o=B(s)?i?a=>I(s[a],s[t[a]]):a=>s[a]:()=>s;for(const a of n)e[a]=cc(o(a));return e}function Lo(s){return ki(s,{top:"y",right:"x",bottom:"y",left:"x"})}function re(s){return ki(s,["topLeft","topRight","bottomLeft","bottomRight"])}function ft(s){const t=Lo(s);return t.width=t.left+t.right,t.height=t.top+t.bottom,t}function ot(s,t){s=s||{},t=t||Z.font;let e=I(s.size,t.size);typeof e=="string"&&(e=parseInt(e,10));let i=I(s.style,t.style);i&&!(""+i).match(rc)&&(console.warn('Invalid font style specified: "'+i+'"'),i=void 0);const n={family:I(s.family,t.family),lineHeight:lc(I(s.lineHeight,t.lineHeight),e),size:e,style:i,weight:I(s.weight,t.weight),string:""};return n.string=Zl(n),n}function Le(s,t,e,i){let n,o,a;for(n=0,o=s.length;ne&&r===0?0:r+l;return{min:a(i,-Math.abs(o)),max:a(n,o)}}function Xt(s,t){return Object.assign(Object.create(s),t)}function Si(s,t=[""],e,i,n=()=>s[0]){const o=e||s;typeof i>"u"&&(i=Eo("_fallback",s));const a={[Symbol.toStringTag]:"Object",_cacheable:!0,_scopes:s,_rootScopes:o,_fallback:i,_getTarget:n,override:r=>Si([r,...s],t,o,i)};return new Proxy(a,{deleteProperty(r,l){return delete r[l],delete r._keys,delete s[0][l],!0},get(r,l){return Ro(r,l,()=>_c(l,t,s,r))},getOwnPropertyDescriptor(r,l){return Reflect.getOwnPropertyDescriptor(r._scopes[0],l)},getPrototypeOf(){return Reflect.getPrototypeOf(s[0])},has(r,l){return Xi(r).includes(l)},ownKeys(r){return Xi(r)},set(r,l,c){const d=r._storage||(r._storage=n());return r[l]=d[l]=c,delete r._keys,!0}})}function ye(s,t,e,i){const n={_cacheable:!1,_proxy:s,_context:t,_subProxy:e,_stack:new Set,_descriptors:To(s,i),setContext:o=>ye(s,o,e,i),override:o=>ye(s.override(o),t,e,i)};return new Proxy(n,{deleteProperty(o,a){return delete o[a],delete s[a],!0},get(o,a,r){return Ro(o,a,()=>uc(o,a,r))},getOwnPropertyDescriptor(o,a){return o._descriptors.allKeys?Reflect.has(s,a)?{enumerable:!0,configurable:!0}:void 0:Reflect.getOwnPropertyDescriptor(s,a)},getPrototypeOf(){return Reflect.getPrototypeOf(s)},has(o,a){return Reflect.has(s,a)},ownKeys(){return Reflect.ownKeys(s)},set(o,a,r){return s[a]=r,delete o[a],!0}})}function To(s,t={scriptable:!0,indexable:!0}){const{_scriptable:e=t.scriptable,_indexable:i=t.indexable,_allKeys:n=t.allKeys}=s;return{allKeys:n,scriptable:e,indexable:i,isScriptable:Kt(e)?e:()=>e,isIndexable:Kt(i)?i:()=>i}}const hc=(s,t)=>s?s+_i(t):t,Mi=(s,t)=>B(t)&&s!=="adapters"&&(Object.getPrototypeOf(t)===null||t.constructor===Object);function Ro(s,t,e){if(Object.prototype.hasOwnProperty.call(s,t)||t==="constructor")return s[t];const i=e();return s[t]=i,i}function uc(s,t,e){const{_proxy:i,_context:n,_subProxy:o,_descriptors:a}=s;let r=i[t];return Kt(r)&&a.isScriptable(t)&&(r=fc(t,r,s,e)),q(r)&&r.length&&(r=gc(t,r,s,a.isIndexable)),Mi(t,r)&&(r=ye(r,n,o&&o[t],a)),r}function fc(s,t,e,i){const{_proxy:n,_context:o,_subProxy:a,_stack:r}=e;if(r.has(s))throw new Error("Recursion detected: "+Array.from(r).join("->")+"->"+s);r.add(s);let l=t(o,a||i);return r.delete(s),Mi(s,l)&&(l=Pi(n._scopes,n,s,l)),l}function gc(s,t,e,i){const{_proxy:n,_context:o,_subProxy:a,_descriptors:r}=e;if(typeof o.index<"u"&&i(s))return t[o.index%t.length];if(B(t[0])){const l=t,c=n._scopes.filter(d=>d!==l);t=[];for(const d of l){const u=Pi(c,n,s,d);t.push(ye(u,o,a&&a[s],r))}}return t}function Io(s,t,e){return Kt(s)?s(t,e):s}const pc=(s,t)=>s===!0?t:typeof s=="string"?Jt(t,s):void 0;function mc(s,t,e,i,n){for(const o of t){const a=pc(e,o);if(a){s.add(a);const r=Io(a._fallback,e,n);if(typeof r<"u"&&r!==e&&r!==i)return r}else if(a===!1&&typeof i<"u"&&e!==i)return null}return!1}function Pi(s,t,e,i){const n=t._rootScopes,o=Io(t._fallback,e,i),a=[...s,...n],r=new Set;r.add(i);let l=Ki(r,a,e,o||e,i);return l===null||typeof o<"u"&&o!==e&&(l=Ki(r,a,o,l,i),l===null)?!1:Si(Array.from(r),[""],n,o,()=>bc(t,e,i))}function Ki(s,t,e,i,n){for(;e;)e=mc(s,t,e,i,n);return e}function bc(s,t,e){const i=s._getTarget();t in i||(i[t]={});const n=i[t];return q(n)&&B(e)?e:n||{}}function _c(s,t,e,i){let n;for(const o of t)if(n=Eo(hc(o,s),e),typeof n<"u")return Mi(s,n)?Pi(e,i,s,n):n}function Eo(s,t){for(const e of t){if(!e)continue;const i=e[s];if(typeof i<"u")return i}}function Xi(s){let t=s._keys;return t||(t=s._keys=xc(s._scopes)),t}function xc(s){const t=new Set;for(const e of s)for(const i of Object.keys(e).filter(n=>!n.startsWith("_")))t.add(i);return Array.from(t)}function Fo(s,t,e,i){const{iScale:n}=s,{key:o="r"}=this._parsing,a=new Array(i);let r,l,c,d;for(r=0,l=i;rts==="x"?"y":"x";function vc(s,t,e,i){const n=s.skip?t:s,o=t,a=e.skip?t:e,r=Qs(o,n),l=Qs(a,o);let c=r/(r+l),d=l/(r+l);c=isNaN(c)?0:c,d=isNaN(d)?0:d;const u=i*c,f=i*d;return{previous:{x:o.x-u*(a.x-n.x),y:o.y-u*(a.y-n.y)},next:{x:o.x+f*(a.x-n.x),y:o.y+f*(a.y-n.y)}}}function wc(s,t,e){const i=s.length;let n,o,a,r,l,c=ve(s,0);for(let d=0;d!c.skip)),t.cubicInterpolationMode==="monotone")Sc(s,n);else{let c=i?s[s.length-1]:s[0];for(o=0,a=s.length;os.ownerDocument.defaultView.getComputedStyle(s,null);function Cc(s,t){return $s(s).getPropertyValue(t)}const Dc=["top","right","bottom","left"];function le(s,t,e){const i={};e=e?"-"+e:"";for(let n=0;n<4;n++){const o=Dc[n];i[o]=parseFloat(s[t+"-"+o+e])||0}return i.width=i.left+i.right,i.height=i.top+i.bottom,i}const $c=(s,t,e)=>(s>0||t>0)&&(!e||!e.shadowRoot);function Oc(s,t){const e=s.touches,i=e&&e.length?e[0]:s,{offsetX:n,offsetY:o}=i;let a=!1,r,l;if($c(n,o,s.target))r=n,l=o;else{const c=t.getBoundingClientRect();r=i.clientX-c.left,l=i.clientY-c.top,a=!0}return{x:r,y:l,box:a}}function ne(s,t){if("native"in s)return s;const{canvas:e,currentDevicePixelRatio:i}=t,n=$s(e),o=n.boxSizing==="border-box",a=le(n,"padding"),r=le(n,"border","width"),{x:l,y:c,box:d}=Oc(s,e),u=a.left+(d&&r.left),f=a.top+(d&&r.top);let{width:g,height:p}=t;return o&&(g-=a.width+r.width,p-=a.height+r.height),{x:Math.round((l-u)/g*e.width/i),y:Math.round((c-f)/p*e.height/i)}}function Ac(s,t,e){let i,n;if(t===void 0||e===void 0){const o=s&&Di(s);if(!o)t=s.clientWidth,e=s.clientHeight;else{const a=o.getBoundingClientRect(),r=$s(o),l=le(r,"border","width"),c=le(r,"padding");t=a.width-c.width-l.width,e=a.height-c.height-l.height,i=xs(r.maxWidth,o,"clientWidth"),n=xs(r.maxHeight,o,"clientHeight")}}return{width:t,height:e,maxWidth:i||bs,maxHeight:n||bs}}const ss=s=>Math.round(s*10)/10;function Lc(s,t,e,i){const n=$s(s),o=le(n,"margin"),a=xs(n.maxWidth,s,"clientWidth")||bs,r=xs(n.maxHeight,s,"clientHeight")||bs,l=Ac(s,t,e);let{width:c,height:d}=l;if(n.boxSizing==="content-box"){const f=le(n,"border","width"),g=le(n,"padding");c-=g.width+f.width,d-=g.height+f.height}return c=Math.max(0,c-o.width),d=Math.max(0,i?c/i:d-o.height),c=ss(Math.min(c,a,l.maxWidth)),d=ss(Math.min(d,r,l.maxHeight)),c&&!d&&(d=ss(c/2)),(t!==void 0||e!==void 0)&&i&&l.height&&d>l.height&&(d=l.height,c=ss(Math.floor(d*i))),{width:c,height:d}}function Gi(s,t,e){const i=t||1,n=Math.floor(s.height*i),o=Math.floor(s.width*i);s.height=Math.floor(s.height),s.width=Math.floor(s.width);const a=s.canvas;return a.style&&(e||!a.style.height&&!a.style.width)&&(a.style.height=`${s.height}px`,a.style.width=`${s.width}px`),s.currentDevicePixelRatio!==i||a.height!==n||a.width!==o?(s.currentDevicePixelRatio=i,a.height=n,a.width=o,s.ctx.setTransform(i,0,0,i,0,0),!0):!1}const Tc=function(){let s=!1;try{const t={get passive(){return s=!0,!1}};Ci()&&(window.addEventListener("test",null,t),window.removeEventListener("test",null,t))}catch{}return s}();function qi(s,t){const e=Cc(s,t),i=e&&e.match(/^(\d+)(\.\d+)?px$/);return i?+i[1]:void 0}function oe(s,t,e,i){return{x:s.x+e*(t.x-s.x),y:s.y+e*(t.y-s.y)}}function Rc(s,t,e,i){return{x:s.x+e*(t.x-s.x),y:i==="middle"?e<.5?s.y:t.y:i==="after"?e<1?s.y:t.y:e>0?t.y:s.y}}function Ic(s,t,e,i){const n={x:s.cp2x,y:s.cp2y},o={x:t.cp1x,y:t.cp1y},a=oe(s,n,e),r=oe(n,o,e),l=oe(o,t,e),c=oe(a,r,e),d=oe(r,l,e);return oe(c,d,e)}const Ec=function(s,t){return{x(e){return s+s+t-e},setWidth(e){t=e},textAlign(e){return e==="center"?e:e==="right"?"left":"right"},xPlus(e,i){return e-i},leftForLtr(e,i){return e-i}}},Fc=function(){return{x(s){return s},setWidth(s){},textAlign(s){return s},xPlus(s,t){return s+t},leftForLtr(s,t){return s}}};function _e(s,t,e){return s?Ec(t,e):Fc()}function zo(s,t){let e,i;(t==="ltr"||t==="rtl")&&(e=s.canvas.style,i=[e.getPropertyValue("direction"),e.getPropertyPriority("direction")],e.setProperty("direction",t,"important"),s.prevTextDirection=i)}function No(s,t){t!==void 0&&(delete s.prevTextDirection,s.canvas.style.setProperty("direction",t[0],t[1]))}function Vo(s){return s==="angle"?{between:je,compare:Bl,normalize:xt}:{between:Ft,compare:(t,e)=>t-e,normalize:t=>t}}function Qi({start:s,end:t,count:e,loop:i,style:n}){return{start:s%e,end:t%e,loop:i&&(t-s+1)%e===0,style:n}}function Bc(s,t,e){const{property:i,start:n,end:o}=e,{between:a,normalize:r}=Vo(i),l=t.length;let{start:c,end:d,loop:u}=s,f,g;if(u){for(c+=l,d+=l,f=0,g=l;fl(n,k,_)&&r(n,k)!==0,x=()=>r(o,_)===0||l(o,k,_),M=()=>m||v(),P=()=>!m||x();for(let D=d,$=d;D<=u;++D)w=t[D%a],!w.skip&&(_=c(w[i]),_!==k&&(m=l(_,n,o),b===null&&M()&&(b=r(_,n)===0?D:$),b!==null&&P()&&(p.push(Qi({start:b,end:D,loop:f,count:a,style:g})),b=null),$=D,k=_));return b!==null&&p.push(Qi({start:b,end:u,loop:f,count:a,style:g})),p}function Wo(s,t){const e=[],i=s.segments;for(let n=0;nn&&s[o%t].skip;)o--;return o%=t,{start:n,end:o}}function Nc(s,t,e,i){const n=s.length,o=[];let a=t,r=s[t],l;for(l=t+1;l<=e;++l){const c=s[l%n];c.skip||c.stop?r.skip||(i=!1,o.push({start:t%n,end:(l-1)%n,loop:i}),t=a=c.stop?l:null):(a=l,r.skip&&(t=l)),r=c}return a!==null&&o.push({start:t%n,end:a%n,loop:i}),o}function Vc(s,t){const e=s.points,i=s.options.spanGaps,n=e.length;if(!n)return[];const o=!!s._loop,{start:a,end:r}=zc(e,n,o,i);if(i===!0)return Zi(s,[{start:a,end:r,loop:o}],e,t);const l=rr({chart:t,initial:e.initial,numSteps:a,currentStep:Math.min(i-e.start,a)}))}_refresh(){this._request||(this._running=!0,this._request=Po.call(window,()=>{this._update(),this._request=null,this._running&&this._refresh()}))}_update(t=Date.now()){let e=0;this._charts.forEach((i,n)=>{if(!i.running||!i.items.length)return;const o=i.items;let a=o.length-1,r=!1,l;for(;a>=0;--a)l=o[a],l._active?(l._total>i.duration&&(i.duration=l._total),l.tick(t),r=!0):(o[a]=o[o.length-1],o.pop());r&&(n.draw(),this._notify(n,i,t,"progress")),o.length||(i.running=!1,this._notify(n,i,t,"complete"),i.initial=!1),e+=o.length}),this._lastDate=t,e===0&&(this._running=!1)}_getAnims(t){const e=this._charts;let i=e.get(t);return i||(i={running:!1,initial:!0,items:[],listeners:{complete:[],progress:[]}},e.set(t,i)),i}listen(t,e,i){this._getAnims(t).listeners[e].push(i)}add(t,e){!e||!e.length||this._getAnims(t).items.push(...e)}has(t){return this._getAnims(t).items.length>0}start(t){const e=this._charts.get(t);e&&(e.running=!0,e.start=Date.now(),e.duration=e.items.reduce((i,n)=>Math.max(i,n._duration),0),this._refresh())}running(t){if(!this._running)return!1;const e=this._charts.get(t);return!(!e||!e.running||!e.items.length)}stop(t){const e=this._charts.get(t);if(!e||!e.items.length)return;const i=e.items;let n=i.length-1;for(;n>=0;--n)i[n].cancel();e.items=[],this._notify(t,e,Date.now(),"complete")}remove(t){return this._charts.delete(t)}}var Rt=new Hc;const en="transparent",Uc={boolean(s,t,e){return e>.5?t:s},color(s,t,e){const i=Ui(s||en),n=i.valid&&Ui(t||en);return n&&n.valid?n.mix(i,e).hexString():t},number(s,t,e){return s+(t-s)*e}};class Yc{constructor(t,e,i,n){const o=e[i];n=Le([t.to,n,o,t.from]);const a=Le([t.from,o,n]);this._active=!0,this._fn=t.fn||Uc[t.type||typeof a],this._easing=Fe[t.easing]||Fe.linear,this._start=Math.floor(Date.now()+(t.delay||0)),this._duration=this._total=Math.floor(t.duration),this._loop=!!t.loop,this._target=e,this._prop=i,this._from=a,this._to=n,this._promises=void 0}active(){return this._active}update(t,e,i){if(this._active){this._notify(!1);const n=this._target[this._prop],o=i-this._start,a=this._duration-o;this._start=i,this._duration=Math.floor(Math.max(a,t.duration)),this._total+=o,this._loop=!!t.loop,this._to=Le([t.to,e,n,t.from]),this._from=Le([t.from,n,e])}}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(t){const e=t-this._start,i=this._duration,n=this._prop,o=this._from,a=this._loop,r=this._to;let l;if(this._active=o!==r&&(a||e1?2-l:l,l=this._easing(Math.min(1,Math.max(0,l))),this._target[n]=this._fn(o,r,l)}wait(){const t=this._promises||(this._promises=[]);return new Promise((e,i)=>{t.push({res:e,rej:i})})}_notify(t){const e=t?"res":"rej",i=this._promises||[];for(let n=0;n{const o=t[n];if(!B(o))return;const a={};for(const r of e)a[r]=o[r];(q(o.properties)&&o.properties||[n]).forEach(r=>{(r===n||!i.has(r))&&i.set(r,a)})})}_animateOptions(t,e){const i=e.options,n=Kc(t,i);if(!n)return[];const o=this._createAnimations(n,i);return i.$shared&&Jc(t.options.$animations,i).then(()=>{t.options=i},()=>{}),o}_createAnimations(t,e){const i=this._properties,n=[],o=t.$animations||(t.$animations={}),a=Object.keys(e),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"){n.push(...this._animateOptions(t,e));continue}const d=e[c];let u=o[c];const f=i.get(c);if(u)if(f&&u.active()){u.update(f,d,r);continue}else u.cancel();if(!f||!f.duration){t[c]=d;continue}o[c]=u=new Yc(f,t,c,d),n.push(u)}return n}update(t,e){if(this._properties.size===0){Object.assign(t,e);return}const i=this._createAnimations(t,e);if(i.length)return Rt.add(this._chart,i),!0}}function Jc(s,t){const e=[],i=Object.keys(t);for(let n=0;n0||!e&&o<0)return n.index}return null}function rn(s,t){const{chart:e,_cachedMeta:i}=s,n=e._stacks||(e._stacks={}),{iScale:o,vScale:a,index:r}=i,l=o.axis,c=a.axis,d=Qc(o,a,i),u=t.length;let f;for(let g=0;ge[i].axis===t).shift()}function ed(s,t){return Xt(s,{active:!1,dataset:void 0,datasetIndex:t,index:t,mode:"default",type:"dataset"})}function sd(s,t,e){return Xt(s,{active:!1,dataIndex:t,parsed:void 0,raw:void 0,element:e,index:t,mode:"default",type:"data"})}function Me(s,t){const e=s.controller.index,i=s.vScale&&s.vScale.axis;if(i){t=t||s._parsed;for(const n of t){const o=n._stacks;if(!o||o[i]===void 0||o[i][e]===void 0)return;delete o[i][e],o[i]._visualValues!==void 0&&o[i]._visualValues[e]!==void 0&&delete o[i]._visualValues[e]}}}const Bs=s=>s==="reset"||s==="none",ln=(s,t)=>t?s:Object.assign({},s),id=(s,t,e)=>s&&!t.hidden&&t._stacked&&{keys:Uo(e,!0),values:null};class Gt{static defaults={};static datasetElementType=null;static dataElementType=null;constructor(t,e){this.chart=t,this._ctx=t.ctx,this.index=e,this._cachedDataOpts={},this._cachedMeta=this.getMeta(),this._type=this._cachedMeta.type,this.options=void 0,this._parsing=!1,this._data=void 0,this._objectData=void 0,this._sharedOptions=void 0,this._drawStart=void 0,this._drawCount=void 0,this.enableOptionSharing=!1,this.supportsDecimation=!1,this.$context=void 0,this._syncList=[],this.datasetElementType=new.target.datasetElementType,this.dataElementType=new.target.dataElementType,this.initialize()}initialize(){const t=this._cachedMeta;this.configure(),this.linkScales(),t._stacked=on(t.vScale,t),this.addElements(),this.options.fill&&!this.chart.isPluginEnabled("filler")&&console.warn("Tried to use the 'fill' option without the 'Filler' plugin enabled. Please import and register the 'Filler' plugin and make sure it is not disabled in the options")}updateIndex(t){this.index!==t&&Me(this._cachedMeta),this.index=t}linkScales(){const t=this.chart,e=this._cachedMeta,i=this.getDataset(),n=(u,f,g,p)=>u==="x"?f:u==="r"?p:g,o=e.xAxisID=I(i.xAxisID,Fs(t,"x")),a=e.yAxisID=I(i.yAxisID,Fs(t,"y")),r=e.rAxisID=I(i.rAxisID,Fs(t,"r")),l=e.indexAxis,c=e.iAxisID=n(l,o,a,r),d=e.vAxisID=n(l,a,o,r);e.xScale=this.getScaleForId(o),e.yScale=this.getScaleForId(a),e.rScale=this.getScaleForId(r),e.iScale=this.getScaleForId(c),e.vScale=this.getScaleForId(d)}getDataset(){return this.chart.data.datasets[this.index]}getMeta(){return this.chart.getDatasetMeta(this.index)}getScaleForId(t){return this.chart.scales[t]}_getOtherScale(t){const e=this._cachedMeta;return t===e.iScale?e.vScale:e.iScale}reset(){this._update("reset")}_destroy(){const t=this._cachedMeta;this._data&&ji(this._data,this),t._stacked&&Me(t)}_dataCheck(){const t=this.getDataset(),e=t.data||(t.data=[]),i=this._data;if(B(e)){const n=this._cachedMeta;this._data=qc(e,n)}else if(i!==e){if(i){ji(i,this);const n=this._cachedMeta;Me(n),n._parsed=[]}e&&Object.isExtensible(e)&&jl(e,this),this._syncList=[],this._data=e}}addElements(){const t=this._cachedMeta;this._dataCheck(),this.datasetElementType&&(t.dataset=new this.datasetElementType)}buildOrUpdateElements(t){const e=this._cachedMeta,i=this.getDataset();let n=!1;this._dataCheck();const o=e._stacked;e._stacked=on(e.vScale,e),e.stack!==i.stack&&(n=!0,Me(e),e.stack=i.stack),this._resyncElements(t),(n||o!==e._stacked)&&rn(this,e._parsed)}configure(){const t=this.chart.config,e=t.datasetScopeKeys(this._type),i=t.getOptionScopes(this.getDataset(),e,!0);this.options=t.createResolver(i,this.getContext()),this._parsing=this.options.parsing,this._cachedDataOpts={}}parse(t,e){const{_cachedMeta:i,_data:n}=this,{iScale:o,_stacked:a}=i,r=o.axis;let l=t===0&&e===n.length?!0:i._sorted,c=t>0&&i._parsed[t-1],d,u,f;if(this._parsing===!1)i._parsed=n,i._sorted=!0,f=n;else{q(n[t])?f=this.parseArrayData(i,n,t,e):B(n[t])?f=this.parseObjectData(i,n,t,e):f=this.parsePrimitiveData(i,n,t,e);const g=()=>u[r]===null||c&&u[r]m||u=0;--f)if(!p()){this.updateRangeFromParsed(c,t,g,l);break}}return c}getAllParsedValues(t){const e=this._cachedMeta._parsed,i=[];let n,o,a;for(n=0,o=e.length;n=0&&tthis.getContext(i,n,e),m=c.resolveNamedOptions(f,g,p,u);return m.$shared&&(m.$shared=l,o[a]=Object.freeze(ln(m,l))),m}_resolveAnimations(t,e,i){const n=this.chart,o=this._cachedDataOpts,a=`animation-${e}`,r=o[a];if(r)return r;let l;if(n.options.animation!==!1){const d=this.chart.config,u=d.datasetAnimationScopeKeys(this._type,e),f=d.getOptionScopes(this.getDataset(),u);l=d.createResolver(f,this.getContext(t,i,e))}const c=new Ho(n,l&&l.animations);return l&&l._cacheable&&(o[a]=Object.freeze(c)),c}getSharedOptions(t){if(t.$shared)return this._sharedOptions||(this._sharedOptions=Object.assign({},t))}includeOptions(t,e){return!e||Bs(t)||this.chart._animationsDisabled}_getSharedOptions(t,e){const i=this.resolveDataElementOptions(t,e),n=this._sharedOptions,o=this.getSharedOptions(i),a=this.includeOptions(e,o)||o!==n;return this.updateSharedOptions(o,e,i),{sharedOptions:o,includeOptions:a}}updateElement(t,e,i,n){Bs(n)?Object.assign(t,i):this._resolveAnimations(e,n).update(t,i)}updateSharedOptions(t,e,i){t&&!Bs(e)&&this._resolveAnimations(void 0,e).update(t,i)}_setStyle(t,e,i,n){t.active=n;const o=this.getStyle(e,n);this._resolveAnimations(e,i,n).update(t,{options:!n&&this.getSharedOptions(o)||o})}removeHoverStyle(t,e,i){this._setStyle(t,i,"active",!1)}setHoverStyle(t,e,i){this._setStyle(t,i,"active",!0)}_removeDatasetHoverStyle(){const t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!1)}_setDatasetHoverStyle(){const t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!0)}_resyncElements(t){const e=this._data,i=this._cachedMeta.data;for(const[r,l,c]of this._syncList)this[r](l,c);this._syncList=[];const n=i.length,o=e.length,a=Math.min(o,n);a&&this.parse(0,a),o>n?this._insertElements(n,o-n,t):o{for(c.length+=e,r=c.length-1;r>=a;r--)c[r]=c[r-e]};for(l(o),r=t;rn-o))}return s._cache.$bar}function od(s){const t=s.iScale,e=nd(t,s.type);let i=t._length,n,o,a,r;const l=()=>{a===32767||a===-32768||(Ve(r)&&(i=Math.min(i,Math.abs(a-r)||i)),r=a)};for(n=0,o=e.length;n0?n[s-1]:null,r=sMath.abs(r)&&(l=r,c=a),t[e.axis]=c,t._custom={barStart:l,barEnd:c,start:n,end:o,min:a,max:r}}function Yo(s,t,e,i){return q(s)?ld(s,t,e,i):t[e.axis]=e.parse(s,i),t}function cn(s,t,e,i){const n=s.iScale,o=s.vScale,a=n.getLabels(),r=n===o,l=[];let c,d,u,f;for(c=e,d=e+i;c=e?1:-1)}function dd(s){let t,e,i,n,o;return s.horizontal?(t=s.base>s.x,e="left",i="right"):(t=s.based.controller.options.grouped),o=i.options.stacked,a=[],r=this._cachedMeta.controller.getParsed(e),l=r&&r[i.axis],c=d=>{const u=d._parsed.find(g=>g[i.axis]===l),f=u&&u[d.vScale.axis];if(N(f)||isNaN(f))return!0};for(const d of n)if(!(e!==void 0&&c(d))&&((o===!1||a.indexOf(d.stack)===-1||o===void 0&&d.stack===void 0)&&a.push(d.stack),d.index===t))break;return a.length||a.push(void 0),a}_getStackCount(t){return this._getStacks(void 0,t).length}_getStackIndex(t,e,i){const n=this._getStacks(t,i),o=e!==void 0?n.indexOf(e):-1;return o===-1?n.length-1:o}_getRuler(){const t=this.options,e=this._cachedMeta,i=e.iScale,n=[];let o,a;for(o=0,a=e.data.length;o=0;--i)e=Math.max(e,t[i].size(this.resolveDataElementOptions(i))/2);return e>0&&e}getLabelAndValue(t){const e=this._cachedMeta,i=this.chart.data.labels||[],{xScale:n,yScale:o}=e,a=this.getParsed(t),r=n.getLabelForValue(a.x),l=o.getLabelForValue(a.y),c=a._custom;return{label:i[t]||"",value:"("+r+", "+l+(c?", "+c:"")+")"}}update(t){const e=this._cachedMeta.data;this.updateElements(e,0,e.length,t)}updateElements(t,e,i,n){const o=n==="reset",{iScale:a,vScale:r}=this._cachedMeta,{sharedOptions:l,includeOptions:c}=this._getSharedOptions(e,n),d=a.axis,u=r.axis;for(let f=e;fje(k,r,l,!0)?1:Math.max(v,v*e,x,x*e),p=(k,v,x)=>je(k,r,l,!0)?-1:Math.min(v,v*e,x,x*e),m=g(0,c,u),b=g(et,d,f),_=p(G,c,u),w=p(G+et,d,f);i=(m-_)/2,n=(b-w)/2,o=-(m+_)/2,a=-(b+w)/2}return{ratioX:i,ratioY:n,offsetX:o,offsetY:a}}class Ko extends Gt{static id="doughnut";static defaults={datasetElementType:!1,dataElementType:"arc",animation:{animateRotate:!0,animateScale:!1},animations:{numbers:{type:"number",properties:["circumference","endAngle","innerRadius","outerRadius","startAngle","x","y","offset","borderWidth","spacing"]}},cutout:"50%",rotation:0,circumference:360,radius:"100%",spacing:0,indexAxis:"r"};static descriptors={_scriptable:t=>t!=="spacing",_indexable:t=>t!=="spacing"&&!t.startsWith("borderDash")&&!t.startsWith("hoverBorderDash")};static overrides={aspectRatio:1,plugins:{legend:{labels:{generateLabels(t){const e=t.data;if(e.labels.length&&e.datasets.length){const{labels:{pointStyle:i,color:n}}=t.legend.options;return e.labels.map((o,a)=>{const l=t.getDatasetMeta(0).controller.getStyle(a);return{text:o,fillStyle:l.backgroundColor,strokeStyle:l.borderColor,fontColor:n,lineWidth:l.borderWidth,pointStyle:i,hidden:!t.getDataVisibility(a),index:a}})}return[]}},onClick(t,e,i){i.chart.toggleDataVisibility(e.index),i.chart.update()}}}};constructor(t,e){super(t,e),this.enableOptionSharing=!0,this.innerRadius=void 0,this.outerRadius=void 0,this.offsetX=void 0,this.offsetY=void 0}linkScales(){}parse(t,e){const i=this.getDataset().data,n=this._cachedMeta;if(this._parsing===!1)n._parsed=i;else{let o=l=>+i[l];if(B(i[t])){const{key:l="value"}=this._parsing;o=c=>+Jt(i[c],l)}let a,r;for(a=t,r=t+e;a0&&!isNaN(t)?X*(Math.abs(t)/e):0}getLabelAndValue(t){const e=this._cachedMeta,i=this.chart,n=i.data.labels||[],o=Ke(e._parsed[t],i.options.locale);return{label:n[t]||"",value:o}}getMaxBorderWidth(t){let e=0;const i=this.chart;let n,o,a,r,l;if(!t){for(n=0,o=i.data.datasets.length;n0&&this.getParsed(e-1);for(let x=0;x=w){P.skip=!0;continue}const D=this.getParsed(x),$=N(D[g]),R=P[f]=a.getPixelForValue(D[f],x),L=P[g]=o||$?r.getBasePixel():r.getPixelForValue(l?this.applyStack(r,D,l):D[g],x);P.skip=isNaN(R)||isNaN(L)||$,P.stop=x>0&&Math.abs(D[f]-v[f])>b,m&&(P.parsed=D,P.raw=c.data[x]),u&&(P.options=d||this.resolveDataElementOptions(x,M.active?"active":n)),_||this.updateElement(M,x,P,n),v=D}}getMaxOverflow(){const t=this._cachedMeta,e=t.dataset,i=e.options&&e.options.borderWidth||0,n=t.data||[];if(!n.length)return i;const o=n[0].size(this.resolveDataElementOptions(0)),a=n[n.length-1].size(this.resolveDataElementOptions(n.length-1));return Math.max(i,o,a)/2}draw(){const t=this._cachedMeta;t.dataset.updateControlPoints(this.chart.chartArea,t.iScale.axis),super.draw()}}class md extends Gt{static id="polarArea";static defaults={dataElementType:"arc",animation:{animateRotate:!0,animateScale:!0},animations:{numbers:{type:"number",properties:["x","y","startAngle","endAngle","innerRadius","outerRadius"]}},indexAxis:"r",startAngle:0};static overrides={aspectRatio:1,plugins:{legend:{labels:{generateLabels(t){const e=t.data;if(e.labels.length&&e.datasets.length){const{labels:{pointStyle:i,color:n}}=t.legend.options;return e.labels.map((o,a)=>{const l=t.getDatasetMeta(0).controller.getStyle(a);return{text:o,fillStyle:l.backgroundColor,strokeStyle:l.borderColor,fontColor:n,lineWidth:l.borderWidth,pointStyle:i,hidden:!t.getDataVisibility(a),index:a}})}return[]}},onClick(t,e,i){i.chart.toggleDataVisibility(e.index),i.chart.update()}}},scales:{r:{type:"radialLinear",angleLines:{display:!1},beginAtZero:!0,grid:{circular:!0},pointLabels:{display:!1},startAngle:0}}};constructor(t,e){super(t,e),this.innerRadius=void 0,this.outerRadius=void 0}getLabelAndValue(t){const e=this._cachedMeta,i=this.chart,n=i.data.labels||[],o=Ke(e._parsed[t].r,i.options.locale);return{label:n[t]||"",value:o}}parseObjectData(t,e,i,n){return Fo.bind(this)(t,e,i,n)}update(t){const e=this._cachedMeta.data;this._updateRadius(),this.updateElements(e,0,e.length,t)}getMinMax(){const t=this._cachedMeta,e={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY};return t.data.forEach((i,n)=>{const o=this.getParsed(n).r;!isNaN(o)&&this.chart.getDataVisibility(n)&&(oe.max&&(e.max=o))}),e}_updateRadius(){const t=this.chart,e=t.chartArea,i=t.options,n=Math.min(e.right-e.left,e.bottom-e.top),o=Math.max(n/2,0),a=Math.max(i.cutoutPercentage?o/100*i.cutoutPercentage:1,0),r=(o-a)/t.getVisibleDatasetCount();this.outerRadius=o-r*this.index,this.innerRadius=this.outerRadius-r}updateElements(t,e,i,n){const o=n==="reset",a=this.chart,l=a.options.animation,c=this._cachedMeta.rScale,d=c.xCenter,u=c.yCenter,f=c.getIndexAngle(0)-.5*G;let g=f,p;const m=360/this.countVisibleElements();for(p=0;p{!isNaN(this.getParsed(n).r)&&this.chart.getDataVisibility(n)&&e++}),e}_computeAngle(t,e,i){return this.chart.getDataVisibility(t)?St(this.resolveDataElementOptions(t,e).angle||i):0}}class bd extends Ko{static id="pie";static defaults={cutout:0,rotation:0,circumference:360,radius:"100%"}}class _d extends Gt{static id="radar";static defaults={datasetElementType:"line",dataElementType:"point",indexAxis:"r",showLine:!0,elements:{line:{fill:"start"}}};static overrides={aspectRatio:1,scales:{r:{type:"radialLinear"}}};getLabelAndValue(t){const e=this._cachedMeta.vScale,i=this.getParsed(t);return{label:e.getLabels()[t],value:""+e.getLabelForValue(i[e.axis])}}parseObjectData(t,e,i,n){return Fo.bind(this)(t,e,i,n)}update(t){const e=this._cachedMeta,i=e.dataset,n=e.data||[],o=e.iScale.getLabels();if(i.points=n,t!=="resize"){const a=this.resolveDatasetElementOptions(t);this.options.showLine||(a.borderWidth=0);const r={_loop:!0,_fullLoop:o.length===n.length,options:a};this.updateElement(i,void 0,r,t)}this.updateElements(n,0,n.length,t)}updateElements(t,e,i,n){const o=this._cachedMeta.rScale,a=n==="reset";for(let r=e;r0&&this.getParsed(e-1);for(let v=e;v0&&Math.abs(M[g]-k[g])>_,b&&(P.parsed=M,P.raw=c.data[v]),f&&(P.options=u||this.resolveDataElementOptions(v,x.active?"active":n)),w||this.updateElement(x,v,P,n),k=M}this.updateSharedOptions(u,n,d)}getMaxOverflow(){const t=this._cachedMeta,e=t.data||[];if(!this.options.showLine){let r=0;for(let l=e.length-1;l>=0;--l)r=Math.max(r,e[l].size(this.resolveDataElementOptions(l))/2);return r>0&&r}const i=t.dataset,n=i.options&&i.options.borderWidth||0;if(!e.length)return n;const o=e[0].size(this.resolveDataElementOptions(0)),a=e[e.length-1].size(this.resolveDataElementOptions(e.length-1));return Math.max(n,o,a)/2}}function se(){throw new Error("This method is not implemented: Check that a complete date adapter is provided.")}class $i{static override(t){Object.assign($i.prototype,t)}options;constructor(t){this.options=t||{}}init(){}formats(){return se()}parse(){return se()}format(){return se()}add(){return se()}diff(){return se()}startOf(){return se()}endOf(){return se()}}var yd={_date:$i};function vd(s,t,e,i){const{controller:n,data:o,_sorted:a}=s,r=n._cachedMeta.iScale;if(r&&t===r.axis&&t!=="r"&&a&&o.length){const l=r._reversePixels?Nl:Bt;if(i){if(n._sharedOptions){const c=o[0],d=typeof c.getRange=="function"&&c.getRange(t);if(d){const u=l(o,t,e-d),f=l(o,t,e+d);return{lo:u.lo,hi:f.hi}}}}else return l(o,t,e)}return{lo:0,hi:o.length-1}}function Xe(s,t,e,i,n){const o=s.getSortedVisibleDatasetMetas(),a=e[t];for(let r=0,l=o.length;r{l[a]&&l[a](t[e],n)&&(o.push({element:l,datasetIndex:c,index:d}),r=r||l.inRange(t.x,t.y,n))}),i&&!r?[]:o}var Md={evaluateInteractionItems:Xe,modes:{index(s,t,e,i){const n=ne(t,s),o=e.axis||"x",a=e.includeInvisible||!1,r=e.intersect?Ns(s,n,o,i,a):Vs(s,n,o,!1,i,a),l=[];return r.length?(s.getSortedVisibleDatasetMetas().forEach(c=>{const d=r[0].index,u=c.data[d];u&&!u.skip&&l.push({element:u,datasetIndex:c.index,index:d})}),l):[]},dataset(s,t,e,i){const n=ne(t,s),o=e.axis||"xy",a=e.includeInvisible||!1;let r=e.intersect?Ns(s,n,o,i,a):Vs(s,n,o,!1,i,a);if(r.length>0){const l=r[0].datasetIndex,c=s.getDatasetMeta(l).data;r=[];for(let d=0;de.pos===t)}function fn(s,t){return s.filter(e=>Go.indexOf(e.pos)===-1&&e.box.axis===t)}function Ce(s,t){return s.sort((e,i)=>{const n=t?i:e,o=t?e:i;return n.weight===o.weight?n.index-o.index:n.weight-o.weight})}function Pd(s){const t=[];let e,i,n,o,a,r;for(e=0,i=(s||[]).length;ec.box.fullSize),!0),i=Ce(Pe(t,"left"),!0),n=Ce(Pe(t,"right")),o=Ce(Pe(t,"top"),!0),a=Ce(Pe(t,"bottom")),r=fn(t,"x"),l=fn(t,"y");return{fullSize:e,leftAndTop:i.concat(o),rightAndBottom:n.concat(l).concat(a).concat(r),chartArea:Pe(t,"chartArea"),vertical:i.concat(n).concat(l),horizontal:o.concat(a).concat(r)}}function gn(s,t,e,i){return Math.max(s[e],t[e])+Math.max(s[i],t[i])}function qo(s,t){s.top=Math.max(s.top,t.top),s.left=Math.max(s.left,t.left),s.bottom=Math.max(s.bottom,t.bottom),s.right=Math.max(s.right,t.right)}function Od(s,t,e,i){const{pos:n,box:o}=e,a=s.maxPadding;if(!B(n)){e.size&&(s[n]-=e.size);const u=i[e.stack]||{size:0,count:1};u.size=Math.max(u.size,e.horizontal?o.height:o.width),e.size=u.size/u.count,s[n]+=e.size}o.getPadding&&qo(a,o.getPadding());const r=Math.max(0,t.outerWidth-gn(a,s,"left","right")),l=Math.max(0,t.outerHeight-gn(a,s,"top","bottom")),c=r!==s.w,d=l!==s.h;return s.w=r,s.h=l,e.horizontal?{same:c,other:d}:{same:d,other:c}}function Ad(s){const t=s.maxPadding;function e(i){const n=Math.max(t[i]-s[i],0);return s[i]+=n,n}s.y+=e("top"),s.x+=e("left"),e("right"),e("bottom")}function Ld(s,t){const e=t.maxPadding;function i(n){const o={left:0,top:0,right:0,bottom:0};return n.forEach(a=>{o[a]=Math.max(t[a],e[a])}),o}return i(s?["left","right"]:["top","bottom"])}function Te(s,t,e,i){const n=[];let o,a,r,l,c,d;for(o=0,a=s.length,c=0;o{typeof m.beforeLayout=="function"&&m.beforeLayout()});const d=l.reduce((m,b)=>b.box.options&&b.box.options.display===!1?m:m+1,0)||1,u=Object.freeze({outerWidth:t,outerHeight:e,padding:n,availableWidth:o,availableHeight:a,vBoxMaxWidth:o/2/d,hBoxMaxHeight:a/2}),f=Object.assign({},n);qo(f,ft(i));const g=Object.assign({maxPadding:f,w:o,h:a,x:n.left,y:n.top},n),p=Dd(l.concat(c),u);Te(r.fullSize,g,u,p),Te(l,g,u,p),Te(c,g,u,p)&&Te(l,g,u,p),Ad(g),pn(r.leftAndTop,g,u,p),g.x+=g.w,g.y+=g.h,pn(r.rightAndBottom,g,u,p),s.chartArea={left:g.left,top:g.top,right:g.left+g.w,bottom:g.top+g.h,height:g.h,width:g.w},W(r.chartArea,m=>{const b=m.box;Object.assign(b,s.chartArea),b.update(g.w,g.h,{left:0,top:0,right:0,bottom:0})})}};class Qo{acquireContext(t,e){}releaseContext(t){return!1}addEventListener(t,e,i){}removeEventListener(t,e,i){}getDevicePixelRatio(){return 1}getMaximumSize(t,e,i,n){return e=Math.max(0,e||t.width),i=i||t.height,{width:e,height:Math.max(0,n?Math.floor(e/n):i)}}isAttached(t){return!0}updateConfig(t){}}class Td extends Qo{acquireContext(t){return t&&t.getContext&&t.getContext("2d")||null}updateConfig(t){t.options.animation=!1}}const us="$chartjs",Rd={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},mn=s=>s===null||s==="";function Id(s,t){const e=s.style,i=s.getAttribute("height"),n=s.getAttribute("width");if(s[us]={initial:{height:i,width:n,style:{display:e.display,height:e.height,width:e.width}}},e.display=e.display||"block",e.boxSizing=e.boxSizing||"border-box",mn(n)){const o=qi(s,"width");o!==void 0&&(s.width=o)}if(mn(i))if(s.style.height==="")s.height=s.width/(t||2);else{const o=qi(s,"height");o!==void 0&&(s.height=o)}return s}const Zo=Tc?{passive:!0}:!1;function Ed(s,t,e){s&&s.addEventListener(t,e,Zo)}function Fd(s,t,e){s&&s.canvas&&s.canvas.removeEventListener(t,e,Zo)}function Bd(s,t){const e=Rd[s.type]||s.type,{x:i,y:n}=ne(s,t);return{type:e,chart:t,native:s,x:i!==void 0?i:null,y:n!==void 0?n:null}}function ys(s,t){for(const e of s)if(e===t||e.contains(t))return!0}function zd(s,t,e){const i=s.canvas,n=new MutationObserver(o=>{let a=!1;for(const r of o)a=a||ys(r.addedNodes,i),a=a&&!ys(r.removedNodes,i);a&&e()});return n.observe(document,{childList:!0,subtree:!0}),n}function Nd(s,t,e){const i=s.canvas,n=new MutationObserver(o=>{let a=!1;for(const r of o)a=a||ys(r.removedNodes,i),a=a&&!ys(r.addedNodes,i);a&&e()});return n.observe(document,{childList:!0,subtree:!0}),n}const He=new Map;let bn=0;function ta(){const s=window.devicePixelRatio;s!==bn&&(bn=s,He.forEach((t,e)=>{e.currentDevicePixelRatio!==s&&t()}))}function Vd(s,t){He.size||window.addEventListener("resize",ta),He.set(s,t)}function jd(s){He.delete(s),He.size||window.removeEventListener("resize",ta)}function Wd(s,t,e){const i=s.canvas,n=i&&Di(i);if(!n)return;const o=Co((r,l)=>{const c=n.clientWidth;e(r,l),c{const l=r[0],c=l.contentRect.width,d=l.contentRect.height;c===0&&d===0||o(c,d)});return a.observe(n),Vd(s,o),a}function js(s,t,e){e&&e.disconnect(),t==="resize"&&jd(s)}function Hd(s,t,e){const i=s.canvas,n=Co(o=>{s.ctx!==null&&e(Bd(o,s))},s);return Ed(i,t,n),n}class Ud extends Qo{acquireContext(t,e){const i=t&&t.getContext&&t.getContext("2d");return i&&i.canvas===t?(Id(t,e),i):null}releaseContext(t){const e=t.canvas;if(!e[us])return!1;const i=e[us].initial;["height","width"].forEach(o=>{const a=i[o];N(a)?e.removeAttribute(o):e.setAttribute(o,a)});const n=i.style||{};return Object.keys(n).forEach(o=>{e.style[o]=n[o]}),e.width=e.width,delete e[us],!0}addEventListener(t,e,i){this.removeEventListener(t,e);const n=t.$proxies||(t.$proxies={}),a={attach:zd,detach:Nd,resize:Wd}[e]||Hd;n[e]=a(t,e,i)}removeEventListener(t,e){const i=t.$proxies||(t.$proxies={}),n=i[e];if(!n)return;({attach:js,detach:js,resize:js}[e]||Fd)(t,e,n),i[e]=void 0}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(t,e,i,n){return Lc(t,e,i,n)}isAttached(t){const e=t&&Di(t);return!!(e&&e.isConnected)}}function Yd(s){return!Ci()||typeof OffscreenCanvas<"u"&&s instanceof OffscreenCanvas?Td:Ud}class Vt{static defaults={};static defaultRoutes=void 0;x;y;active=!1;options;$animations;tooltipPosition(t){const{x:e,y:i}=this.getProps(["x","y"],t);return{x:e,y:i}}hasValue(){return xe(this.x)&&xe(this.y)}getProps(t,e){const i=this.$animations;if(!e||!i)return this;const n={};return t.forEach(o=>{n[o]=i[o]&&i[o].active()?i[o]._to:this[o]}),n}}function Jd(s,t){const e=s.options.ticks,i=Kd(s),n=Math.min(e.maxTicksLimit||i,i),o=e.major.enabled?Gd(t):[],a=o.length,r=o[0],l=o[a-1],c=[];if(a>n)return qd(t,c,o,a/n),c;const d=Xd(o,t,n);if(a>0){let u,f;const g=a>1?Math.round((l-r)/(a-1)):null;for(ns(t,c,d,N(g)?0:r-g,r),u=0,f=a-1;un)return l}return Math.max(n,1)}function Gd(s){const t=[];let e,i;for(e=0,i=s.length;es==="left"?"right":s==="right"?"left":s,_n=(s,t,e)=>t==="top"||t==="left"?s[t]+e:s[t]-e,xn=(s,t)=>Math.min(t||s,s);function yn(s,t){const e=[],i=s.length/t,n=s.length;let o=0;for(;oa+r)))return l}function eh(s,t){W(s,e=>{const i=e.gc,n=i.length/2;let o;if(n>t){for(o=0;oi?i:e,i=n&&e>i?e:i,{min:_t(e,_t(i,e)),max:_t(i,_t(e,i))}}getPadding(){return{left:this.paddingLeft||0,top:this.paddingTop||0,right:this.paddingRight||0,bottom:this.paddingBottom||0}}getTicks(){return this.ticks}getLabels(){const t=this.chart.data;return this.options.labels||(this.isHorizontal()?t.xLabels:t.yLabels)||t.labels||[]}getLabelItems(t=this.chart.chartArea){return this._labelItems||(this._labelItems=this._computeLabelItems(t))}beforeLayout(){this._cache={},this._dataLimitsCached=!1}beforeUpdate(){Y(this.options.beforeUpdate,[this])}update(t,e,i){const{beginAtZero:n,grace:o,ticks:a}=this.options,r=a.sampleSize;this.beforeUpdate(),this.maxWidth=t,this.maxHeight=e,this._margins=i=Object.assign({left:0,right:0,top:0,bottom:0},i),this.ticks=null,this._labelSizes=null,this._gridLineItems=null,this._labelItems=null,this.beforeSetDimensions(),this.setDimensions(),this.afterSetDimensions(),this._maxLength=this.isHorizontal()?this.width+i.left+i.right:this.height+i.top+i.bottom,this._dataLimitsCached||(this.beforeDataLimits(),this.determineDataLimits(),this.afterDataLimits(),this._range=dc(this,o,n),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();const l=r=o||i<=1||!this.isHorizontal()){this.labelRotation=n;return}const d=this._getLabelSizes(),u=d.widest.width,f=d.highest.height,g=lt(this.chart.width-u,0,this.maxWidth);r=t.offset?this.maxWidth/i:g/(i-1),u+6>r&&(r=g/(i-(t.offset?.5:1)),l=this.maxHeight-De(t.grid)-e.padding-vn(t.title,this.chart.options.font),c=Math.sqrt(u*u+f*f),a=xi(Math.min(Math.asin(lt((d.highest.height+6)/r,-1,1)),Math.asin(lt(l/c,-1,1))-Math.asin(lt(f/c,-1,1)))),a=Math.max(n,Math.min(o,a))),this.labelRotation=a}afterCalculateLabelRotation(){Y(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){Y(this.options.beforeFit,[this])}fit(){const t={width:0,height:0},{chart:e,options:{ticks:i,title:n,grid:o}}=this,a=this._isVisible(),r=this.isHorizontal();if(a){const l=vn(n,e.options.font);if(r?(t.width=this.maxWidth,t.height=De(o)+l):(t.height=this.maxHeight,t.width=De(o)+l),i.display&&this.ticks.length){const{first:c,last:d,widest:u,highest:f}=this._getLabelSizes(),g=i.padding*2,p=St(this.labelRotation),m=Math.cos(p),b=Math.sin(p);if(r){const _=i.mirror?0:b*u.width+m*f.height;t.height=Math.min(this.maxHeight,t.height+_+g)}else{const _=i.mirror?0:m*u.width+b*f.height;t.width=Math.min(this.maxWidth,t.width+_+g)}this._calculatePadding(c,d,b,m)}}this._handleMargins(),r?(this.width=this._length=e.width-this._margins.left-this._margins.right,this.height=t.height):(this.width=t.width,this.height=this._length=e.height-this._margins.top-this._margins.bottom)}_calculatePadding(t,e,i,n){const{ticks:{align:o,padding:a},position:r}=this.options,l=this.labelRotation!==0,c=r!=="top"&&this.axis==="x";if(this.isHorizontal()){const d=this.getPixelForTick(0)-this.left,u=this.right-this.getPixelForTick(this.ticks.length-1);let f=0,g=0;l?c?(f=n*t.width,g=i*e.height):(f=i*t.height,g=n*e.width):o==="start"?g=e.width:o==="end"?f=t.width:o!=="inner"&&(f=t.width/2,g=e.width/2),this.paddingLeft=Math.max((f-d+a)*this.width/(this.width-d),0),this.paddingRight=Math.max((g-u+a)*this.width/(this.width-u),0)}else{let d=e.height/2,u=t.height/2;o==="start"?(d=0,u=t.height):o==="end"&&(d=e.height,u=0),this.paddingTop=d+a,this.paddingBottom=u+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(){Y(this.options.afterFit,[this])}isHorizontal(){const{axis:t,position:e}=this.options;return e==="top"||e==="bottom"||t==="x"}isFullSize(){return this.options.fullSize}_convertTicksToLabels(t){this.beforeTickToLabelConversion(),this.generateTickLabels(t);let e,i;for(e=0,i=t.length;e({width:a[$]||0,height:r[$]||0});return{first:D(0),last:D(e-1),widest:D(M),highest:D(P),widths:a,heights:r}}getLabelForValue(t){return t}getPixelForValue(t,e){return NaN}getValueForPixel(t){}getPixelForTick(t){const e=this.ticks;return t<0||t>e.length-1?null:this.getPixelForValue(e[t].value)}getPixelForDecimal(t){this._reversePixels&&(t=1-t);const e=this._startPixel+t*this._length;return zl(this._alignToPixels?ee(this.chart,e,0):e)}getDecimalForPixel(t){const e=(t-this._startPixel)/this._length;return this._reversePixels?1-e:e}getBasePixel(){return this.getPixelForValue(this.getBaseValue())}getBaseValue(){const{min:t,max:e}=this;return t<0&&e<0?e:t>0&&e>0?t:0}getContext(t){const e=this.ticks||[];if(t>=0&&tr*n?r/i:l/n:l*n0}_computeGridLineItems(t){const e=this.axis,i=this.chart,n=this.options,{grid:o,position:a,border:r}=n,l=o.offset,c=this.isHorizontal(),u=this.ticks.length+(l?1:0),f=De(o),g=[],p=r.setContext(this.getContext()),m=p.display?p.width:0,b=m/2,_=function(H){return ee(i,H,m)};let w,k,v,x,M,P,D,$,R,L,E,at;if(a==="top")w=_(this.bottom),P=this.bottom-f,$=w-b,L=_(t.top)+b,at=t.bottom;else if(a==="bottom")w=_(this.top),L=t.top,at=_(t.bottom)-b,P=w+b,$=this.top+f;else if(a==="left")w=_(this.right),M=this.right-f,D=w-b,R=_(t.left)+b,E=t.right;else if(a==="right")w=_(this.left),R=t.left,E=_(t.right)-b,M=w+b,D=this.left+f;else if(e==="x"){if(a==="center")w=_((t.top+t.bottom)/2+.5);else if(B(a)){const H=Object.keys(a)[0],tt=a[H];w=_(this.chart.scales[H].getPixelForValue(tt))}L=t.top,at=t.bottom,P=w+b,$=P+f}else if(e==="y"){if(a==="center")w=_((t.left+t.right)/2);else if(B(a)){const H=Object.keys(a)[0],tt=a[H];w=_(this.chart.scales[H].getPixelForValue(tt))}M=w-b,D=M-f,R=t.left,E=t.right}const J=I(n.ticks.maxTicksLimit,u),z=Math.max(1,Math.ceil(u/J));for(k=0;k0&&(Zt-=Qt/2);break}Ge={left:Zt,top:Se,width:Qt+fe.width,height:ke+fe.height,color:z.backdropColor}}b.push({label:v,font:$,textOffset:E,options:{rotation:m,color:tt,strokeColor:kt,strokeWidth:dt,textAlign:ue,textBaseline:at,translation:[x,M],backdrop:Ge}})}return b}_getXAxisLabelAlignment(){const{position:t,ticks:e}=this.options;if(-St(this.labelRotation))return t==="top"?"left":"right";let n="center";return e.align==="start"?n="left":e.align==="end"?n="right":e.align==="inner"&&(n="inner"),n}_getYAxisLabelAlignment(t){const{position:e,ticks:{crossAlign:i,mirror:n,padding:o}}=this.options,a=this._getLabelSizes(),r=t+o,l=a.widest.width;let c,d;return e==="left"?n?(d=this.right+o,i==="near"?c="left":i==="center"?(c="center",d+=l/2):(c="right",d+=l)):(d=this.right-r,i==="near"?c="right":i==="center"?(c="center",d-=l/2):(c="left",d=this.left)):e==="right"?n?(d=this.left+o,i==="near"?c="right":i==="center"?(c="center",d-=l/2):(c="left",d-=l)):(d=this.left+r,i==="near"?c="left":i==="center"?(c="center",d+=l/2):(c="right",d=this.right)):c="right",{textAlign:c,x:d}}_computeLabelArea(){if(this.options.ticks.mirror)return;const t=this.chart,e=this.options.position;if(e==="left"||e==="right")return{top:0,left:this.left,bottom:t.height,right:this.right};if(e==="top"||e==="bottom")return{top:this.top,left:0,bottom:this.bottom,right:t.width}}drawBackground(){const{ctx:t,options:{backgroundColor:e},left:i,top:n,width:o,height:a}=this;e&&(t.save(),t.fillStyle=e,t.fillRect(i,n,o,a),t.restore())}getLineWidthForValue(t){const e=this.options.grid;if(!this._isVisible()||!e.display)return 0;const n=this.ticks.findIndex(o=>o.value===t);return n>=0?e.setContext(this.getContext(n)).lineWidth:0}drawGrid(t){const e=this.options.grid,i=this.ctx,n=this._gridLineItems||(this._gridLineItems=this._computeGridLineItems(t));let o,a;const r=(l,c,d)=>{!d.width||!d.color||(i.save(),i.lineWidth=d.width,i.strokeStyle=d.color,i.setLineDash(d.borderDash||[]),i.lineDashOffset=d.borderDashOffset,i.beginPath(),i.moveTo(l.x,l.y),i.lineTo(c.x,c.y),i.stroke(),i.restore())};if(e.display)for(o=0,a=n.length;o{this.draw(o)}}]:[{z:i,draw:o=>{this.drawBackground(),this.drawGrid(o),this.drawTitle()}},{z:n,draw:()=>{this.drawBorder()}},{z:e,draw:o=>{this.drawLabels(o)}}]}getMatchingVisibleMetas(t){const e=this.chart.getSortedVisibleDatasetMetas(),i=this.axis+"AxisID",n=[];let o,a;for(o=0,a=e.length;o{const i=e.split("."),n=i.pop(),o=[s].concat(i).join("."),a=t[e].split("."),r=a.pop(),l=a.join(".");Z.route(o,n,l,r)})}function lh(s){return"id"in s&&"defaults"in s}class ch{constructor(){this.controllers=new os(Gt,"datasets",!0),this.elements=new os(Vt,"elements"),this.plugins=new os(Object,"plugins"),this.scales=new os(he,"scales"),this._typedRegistries=[this.controllers,this.scales,this.elements]}add(...t){this._each("register",t)}remove(...t){this._each("unregister",t)}addControllers(...t){this._each("register",t,this.controllers)}addElements(...t){this._each("register",t,this.elements)}addPlugins(...t){this._each("register",t,this.plugins)}addScales(...t){this._each("register",t,this.scales)}getController(t){return this._get(t,this.controllers,"controller")}getElement(t){return this._get(t,this.elements,"element")}getPlugin(t){return this._get(t,this.plugins,"plugin")}getScale(t){return this._get(t,this.scales,"scale")}removeControllers(...t){this._each("unregister",t,this.controllers)}removeElements(...t){this._each("unregister",t,this.elements)}removePlugins(...t){this._each("unregister",t,this.plugins)}removeScales(...t){this._each("unregister",t,this.scales)}_each(t,e,i){[...e].forEach(n=>{const o=i||this._getRegistryForType(n);i||o.isForType(n)||o===this.plugins&&n.id?this._exec(t,o,n):W(n,a=>{const r=i||this._getRegistryForType(a);this._exec(t,r,a)})})}_exec(t,e,i){const n=_i(t);Y(i["before"+n],[],i),e[t](i),Y(i["after"+n],[],i)}_getRegistryForType(t){for(let e=0;eo.filter(r=>!a.some(l=>r.plugin.id===l.plugin.id));this._notify(n(e,i),t,"stop"),this._notify(n(i,e),t,"start")}}function hh(s){const t={},e=[],i=Object.keys(Pt.plugins.items);for(let o=0;o1&&wn(s[0].toLowerCase());if(i)return i}throw new Error(`Cannot determine type of '${s}' axis. Please provide 'axis' or 'position' option.`)}function kn(s,t,e){if(e[t+"AxisID"]===s)return{axis:t}}function _h(s,t){if(t.data&&t.data.datasets){const e=t.data.datasets.filter(i=>i.xAxisID===s||i.yAxisID===s);if(e.length)return kn(s,"x",e[0])||kn(s,"y",e[0])}return{}}function xh(s,t){const e=ce[s.type]||{scales:{}},i=t.scales||{},n=ei(s.type,t),o=Object.create(null);return Object.keys(i).forEach(a=>{const r=i[a];if(!B(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=si(a,r,_h(a,s),Z.scales[r.type]),c=mh(l,n),d=e.scales||{};o[a]=Ie(Object.create(null),[{axis:l},r,d[l],d[c]])}),s.data.datasets.forEach(a=>{const r=a.type||s.type,l=a.indexAxis||ei(r,t),d=(ce[r]||{}).scales||{};Object.keys(d).forEach(u=>{const f=ph(u,l),g=a[f+"AxisID"]||f;o[g]=o[g]||Object.create(null),Ie(o[g],[{axis:f},i[g],d[u]])})}),Object.keys(o).forEach(a=>{const r=o[a];Ie(r,[Z.scales[r.type],Z.scale])}),o}function ea(s){const t=s.options||(s.options={});t.plugins=I(t.plugins,{}),t.scales=xh(s,t)}function sa(s){return s=s||{},s.datasets=s.datasets||[],s.labels=s.labels||[],s}function yh(s){return s=s||{},s.data=sa(s.data),ea(s),s}const Sn=new Map,ia=new Set;function as(s,t){let e=Sn.get(s);return e||(e=t(),Sn.set(s,e),ia.add(e)),e}const $e=(s,t,e)=>{const i=Jt(t,e);i!==void 0&&s.add(i)};let vh=class{constructor(t){this._config=yh(t),this._scopeCache=new Map,this._resolverCache=new Map}get platform(){return this._config.platform}get type(){return this._config.type}set type(t){this._config.type=t}get data(){return this._config.data}set data(t){this._config.data=sa(t)}get options(){return this._config.options}set options(t){this._config.options=t}get plugins(){return this._config.plugins}update(){const t=this._config;this.clearCache(),ea(t)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(t){return as(t,()=>[[`datasets.${t}`,""]])}datasetAnimationScopeKeys(t,e){return as(`${t}.transition.${e}`,()=>[[`datasets.${t}.transitions.${e}`,`transitions.${e}`],[`datasets.${t}`,""]])}datasetElementScopeKeys(t,e){return as(`${t}-${e}`,()=>[[`datasets.${t}.elements.${e}`,`datasets.${t}`,`elements.${e}`,""]])}pluginScopeKeys(t){const e=t.id,i=this.type;return as(`${i}-plugin-${e}`,()=>[[`plugins.${e}`,...t.additionalOptionScopes||[]]])}_cachedScopes(t,e){const i=this._scopeCache;let n=i.get(t);return(!n||e)&&(n=new Map,i.set(t,n)),n}getOptionScopes(t,e,i){const{options:n,type:o}=this,a=this._cachedScopes(t,i),r=a.get(e);if(r)return r;const l=new Set;e.forEach(d=>{t&&(l.add(t),d.forEach(u=>$e(l,t,u))),d.forEach(u=>$e(l,n,u)),d.forEach(u=>$e(l,ce[o]||{},u)),d.forEach(u=>$e(l,Z,u)),d.forEach(u=>$e(l,Zs,u))});const c=Array.from(l);return c.length===0&&c.push(Object.create(null)),ia.has(e)&&a.set(e,c),c}chartOptionScopes(){const{options:t,type:e}=this;return[t,ce[e]||{},Z.datasets[e]||{},{type:e},Z,Zs]}resolveNamedOptions(t,e,i,n=[""]){const o={$shared:!0},{resolver:a,subPrefixes:r}=Mn(this._resolverCache,t,n);let l=a;if(kh(a,e)){o.$shared=!1,i=Kt(i)?i():i;const c=this.createResolver(t,i,r);l=ye(a,i,c)}for(const c of e)o[c]=l[c];return o}createResolver(t,e,i=[""],n){const{resolver:o}=Mn(this._resolverCache,t,i);return B(e)?ye(o,e,void 0,n):o}};function Mn(s,t,e){let i=s.get(t);i||(i=new Map,s.set(t,i));const n=e.join();let o=i.get(n);return o||(o={resolver:Si(t,e),subPrefixes:e.filter(r=>!r.toLowerCase().includes("hover"))},i.set(n,o)),o}const wh=s=>B(s)&&Object.getOwnPropertyNames(s).some(t=>Kt(s[t]));function kh(s,t){const{isScriptable:e,isIndexable:i}=To(s);for(const n of t){const o=e(n),a=i(n),r=(a||o)&&s[n];if(o&&(Kt(r)||wh(r))||a&&q(r))return!0}return!1}var Sh="4.4.4";const Mh=["top","bottom","left","right","chartArea"];function Pn(s,t){return s==="top"||s==="bottom"||Mh.indexOf(s)===-1&&t==="x"}function Cn(s,t){return function(e,i){return e[s]===i[s]?e[t]-i[t]:e[s]-i[s]}}function Dn(s){const t=s.chart,e=t.options.animation;t.notifyPlugins("afterRender"),Y(e&&e.onComplete,[s],t)}function Ph(s){const t=s.chart,e=t.options.animation;Y(e&&e.onProgress,[s],t)}function na(s){return Ci()&&typeof s=="string"?s=document.getElementById(s):s&&s.length&&(s=s[0]),s&&s.canvas&&(s=s.canvas),s}const fs={},$n=s=>{const t=na(s);return Object.values(fs).filter(e=>e.canvas===t).pop()};function Ch(s,t,e){const i=Object.keys(s);for(const n of i){const o=+n;if(o>=t){const a=s[n];delete s[n],(e>0||o>t)&&(s[o+e]=a)}}}function Dh(s,t,e,i){return!e||s.type==="mouseout"?null:i?t:s}function rs(s,t,e){return s.options.clip?s[e]:t[e]}function $h(s,t){const{xScale:e,yScale:i}=s;return e&&i?{left:rs(e,t,"left"),right:rs(e,t,"right"),top:rs(i,t,"top"),bottom:rs(i,t,"bottom")}:t}let Os=class{static defaults=Z;static instances=fs;static overrides=ce;static registry=Pt;static version=Sh;static getChart=$n;static register(...t){Pt.add(...t),On()}static unregister(...t){Pt.remove(...t),On()}constructor(t,e){const i=this.config=new vh(e),n=na(t),o=$n(n);if(o)throw new Error("Canvas is already in use. Chart with ID '"+o.id+"' must be destroyed before the canvas with ID '"+o.canvas.id+"' can be reused.");const a=i.createResolver(i.chartOptionScopes(),this.getContext());this.platform=new(i.platform||Yd(n)),this.platform.updateConfig(i);const r=this.platform.acquireContext(n,a.aspectRatio),l=r&&r.canvas,c=l&&l.height,d=l&&l.width;if(this.id=Cl(),this.ctx=r,this.canvas=l,this.width=d,this.height=c,this._options=a,this._aspectRatio=this.aspectRatio,this._layers=[],this._metasets=[],this._stacks=void 0,this.boxes=[],this.currentDevicePixelRatio=void 0,this.chartArea=void 0,this._active=[],this._lastEvent=void 0,this._listeners={},this._responsiveListeners=void 0,this._sortedMetasets=[],this.scales={},this._plugins=new dh,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=Wl(u=>this.update(u),a.resizeDelay||0),this._dataChanges=[],fs[this.id]=this,!r||!l){console.error("Failed to create chart: can't acquire context from the given item");return}Rt.listen(this,"complete",Dn),Rt.listen(this,"progress",Ph),this._initialize(),this.attached&&this.update()}get aspectRatio(){const{options:{aspectRatio:t,maintainAspectRatio:e},width:i,height:n,_aspectRatio:o}=this;return N(t)?e&&o?o:n?i/n:null:t}get data(){return this.config.data}set data(t){this.config.data=t}get options(){return this._options}set options(t){this.config.options=t}get registry(){return Pt}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():Gi(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return Ji(this.canvas,this.ctx),this}stop(){return Rt.stop(this),this}resize(t,e){Rt.running(this)?this._resizeBeforeDraw={width:t,height:e}:this._resize(t,e)}_resize(t,e){const i=this.options,n=this.canvas,o=i.maintainAspectRatio&&this.aspectRatio,a=this.platform.getMaximumSize(n,t,e,o),r=i.devicePixelRatio||this.platform.getDevicePixelRatio(),l=this.width?"resize":"attach";this.width=a.width,this.height=a.height,this._aspectRatio=this.aspectRatio,Gi(this,r,!0)&&(this.notifyPlugins("resize",{size:a}),Y(i.onResize,[this,a],this),this.attached&&this._doResize(l)&&this.render())}ensureScalesHaveIDs(){const e=this.options.scales||{};W(e,(i,n)=>{i.id=n})}buildOrUpdateScales(){const t=this.options,e=t.scales,i=this.scales,n=Object.keys(i).reduce((a,r)=>(a[r]=!1,a),{});let o=[];e&&(o=o.concat(Object.keys(e).map(a=>{const r=e[a],l=si(a,r),c=l==="r",d=l==="x";return{options:r,dposition:c?"chartArea":d?"bottom":"left",dtype:c?"radialLinear":d?"category":"linear"}}))),W(o,a=>{const r=a.options,l=r.id,c=si(l,r),d=I(r.type,a.dtype);(r.position===void 0||Pn(r.position,c)!==Pn(a.dposition))&&(r.position=a.dposition),n[l]=!0;let u=null;if(l in i&&i[l].type===d)u=i[l];else{const f=Pt.getScale(d);u=new f({id:l,type:d,ctx:this.ctx,chart:this}),i[u.id]=u}u.init(r,t)}),W(n,(a,r)=>{a||delete i[r]}),W(i,a=>{wt.configure(this,a,a.options),wt.addBox(this,a)})}_updateMetasets(){const t=this._metasets,e=this.data.datasets.length,i=t.length;if(t.sort((n,o)=>n.index-o.index),i>e){for(let n=e;ne.length&&delete this._stacks,t.forEach((i,n)=>{e.filter(o=>o===i._dataset).length===0&&this._destroyDatasetMeta(n)})}buildOrUpdateControllers(){const t=[],e=this.data.datasets;let i,n;for(this._removeUnreferencedMetasets(),i=0,n=e.length;i{this.getDatasetMeta(e).controller.reset()},this)}reset(){this._resetElements(),this.notifyPlugins("reset")}update(t){const e=this.config;e.update();const i=this._options=e.createResolver(e.chartOptionScopes(),this.getContext()),n=this._animationsDisabled=!i.animation;if(this._updateScales(),this._checkEventBindings(),this._updateHiddenIndices(),this._plugins.invalidate(),this.notifyPlugins("beforeUpdate",{mode:t,cancelable:!0})===!1)return;const o=this.buildOrUpdateControllers();this.notifyPlugins("beforeElementsUpdate");let a=0;for(let c=0,d=this.data.datasets.length;c{c.reset()}),this._updateDatasets(t),this.notifyPlugins("afterUpdate",{mode:t}),this._layers.sort(Cn("z","_idx"));const{_active:r,_lastEvent:l}=this;l?this._eventHandler(l,!0):r.length&&this._updateHoverStyles(r,r,!0),this.render()}_updateScales(){W(this.scales,t=>{wt.removeBox(this,t)}),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){const t=this.options,e=new Set(Object.keys(this._listeners)),i=new Set(t.events);(!Bi(e,i)||!!this._responsiveListeners!==t.responsive)&&(this.unbindEvents(),this.bindEvents())}_updateHiddenIndices(){const{_hiddenIndices:t}=this,e=this._getUniformDataChanges()||[];for(const{method:i,start:n,count:o}of e){const a=i==="_removeElements"?-o:o;Ch(t,n,a)}}_getUniformDataChanges(){const t=this._dataChanges;if(!t||!t.length)return;this._dataChanges=[];const e=this.data.datasets.length,i=o=>new Set(t.filter(a=>a[0]===o).map((a,r)=>r+","+a.splice(1).join(","))),n=i(0);for(let o=1;oo.split(",")).map(o=>({method:o[1],start:+o[2],count:+o[3]}))}_updateLayout(t){if(this.notifyPlugins("beforeLayout",{cancelable:!0})===!1)return;wt.update(this,this.width,this.height,t);const e=this.chartArea,i=e.width<=0||e.height<=0;this._layers=[],W(this.boxes,n=>{i&&n.position==="chartArea"||(n.configure&&n.configure(),this._layers.push(...n._layers()))},this),this._layers.forEach((n,o)=>{n._idx=o}),this.notifyPlugins("afterLayout")}_updateDatasets(t){if(this.notifyPlugins("beforeDatasetsUpdate",{mode:t,cancelable:!0})!==!1){for(let e=0,i=this.data.datasets.length;e=0;--e)this._drawDataset(t[e]);this.notifyPlugins("afterDatasetsDraw")}_drawDataset(t){const e=this.ctx,i=t._clip,n=!i.disabled,o=$h(t,this.chartArea),a={meta:t,index:t.index,cancelable:!0};this.notifyPlugins("beforeDatasetDraw",a)!==!1&&(n&&Cs(e,{left:i.left===!1?0:o.left-i.left,right:i.right===!1?this.width:o.right+i.right,top:i.top===!1?0:o.top-i.top,bottom:i.bottom===!1?this.height:o.bottom+i.bottom}),t.controller.draw(),n&&Ds(e),a.cancelable=!1,this.notifyPlugins("afterDatasetDraw",a))}isPointInArea(t){return zt(t,this.chartArea,this._minPadding)}getElementsAtEventForMode(t,e,i,n){const o=Md.modes[e];return typeof o=="function"?o(this,t,i,n):[]}getDatasetMeta(t){const e=this.data.datasets[t],i=this._metasets;let n=i.filter(o=>o&&o._dataset===e).pop();return n||(n={type:null,data:[],dataset:null,controller:null,hidden:null,xAxisID:null,yAxisID:null,order:e&&e.order||0,index:t,_dataset:e,_parsed:[],_sorted:!1},i.push(n)),n}getContext(){return this.$context||(this.$context=Xt(null,{chart:this,type:"chart"}))}getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(t){const e=this.data.datasets[t];if(!e)return!1;const i=this.getDatasetMeta(t);return typeof i.hidden=="boolean"?!i.hidden:!e.hidden}setDatasetVisibility(t,e){const i=this.getDatasetMeta(t);i.hidden=!e}toggleDataVisibility(t){this._hiddenIndices[t]=!this._hiddenIndices[t]}getDataVisibility(t){return!this._hiddenIndices[t]}_updateVisibility(t,e,i){const n=i?"show":"hide",o=this.getDatasetMeta(t),a=o.controller._resolveAnimations(void 0,n);Ve(e)?(o.data[e].hidden=!i,this.update()):(this.setDatasetVisibility(t,i),a.update(o,{visible:i}),this.update(r=>r.datasetIndex===t?n:void 0))}hide(t,e){this._updateVisibility(t,e,!1)}show(t,e){this._updateVisibility(t,e,!0)}_destroyDatasetMeta(t){const e=this._metasets[t];e&&e.controller&&e.controller._destroy(),delete this._metasets[t]}_stop(){let t,e;for(this.stop(),Rt.remove(this),t=0,e=this.data.datasets.length;t{e.addEventListener(this,o,a),t[o]=a},n=(o,a,r)=>{o.offsetX=a,o.offsetY=r,this._eventHandler(o)};W(this.options.events,o=>i(o,n))}bindResponsiveEvents(){this._responsiveListeners||(this._responsiveListeners={});const t=this._responsiveListeners,e=this.platform,i=(l,c)=>{e.addEventListener(this,l,c),t[l]=c},n=(l,c)=>{t[l]&&(e.removeEventListener(this,l,c),delete t[l])},o=(l,c)=>{this.canvas&&this.resize(l,c)};let a;const r=()=>{n("attach",r),this.attached=!0,this.resize(),i("resize",o),i("detach",a)};a=()=>{this.attached=!1,n("resize",o),this._stop(),this._resize(0,0),i("attach",r)},e.isAttached(this.canvas)?r():a()}unbindEvents(){W(this._listeners,(t,e)=>{this.platform.removeEventListener(this,e,t)}),this._listeners={},W(this._responsiveListeners,(t,e)=>{this.platform.removeEventListener(this,e,t)}),this._responsiveListeners=void 0}updateHoverStyle(t,e,i){const n=i?"set":"remove";let o,a,r,l;for(e==="dataset"&&(o=this.getDatasetMeta(t[0].datasetIndex),o.controller["_"+n+"DatasetHoverStyle"]()),r=0,l=t.length;r{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}});!ps(i,e)&&(this._active=i,this._lastEvent=null,this._updateHoverStyles(i,e))}notifyPlugins(t,e,i){return this._plugins.notify(this,t,e,i)}isPluginEnabled(t){return this._plugins._cache.filter(e=>e.plugin.id===t).length===1}_updateHoverStyles(t,e,i){const n=this.options.hover,o=(l,c)=>l.filter(d=>!c.some(u=>d.datasetIndex===u.datasetIndex&&d.index===u.index)),a=o(e,t),r=i?t:o(t,e);a.length&&this.updateHoverStyle(a,n.mode,!1),r.length&&n.mode&&this.updateHoverStyle(r,n.mode,!0)}_eventHandler(t,e){const i={event:t,replay:e,cancelable:!0,inChartArea:this.isPointInArea(t)},n=a=>(a.options.events||this.options.events).includes(t.native.type);if(this.notifyPlugins("beforeEvent",i,n)===!1)return;const o=this._handleEvent(t,e,i.inChartArea);return i.cancelable=!1,this.notifyPlugins("afterEvent",i,n),(o||i.changed)&&this.render(),this}_handleEvent(t,e,i){const{_active:n=[],options:o}=this,a=e,r=this._getActiveElements(t,n,i,a),l=Tl(t),c=Dh(t,this._lastEvent,i,l);i&&(this._lastEvent=null,Y(o.onHover,[t,r,this],this),l&&Y(o.onClick,[t,r,this],this));const d=!ps(r,n);return(d||e)&&(this._active=r,this._updateHoverStyles(r,n,e)),this._lastEvent=c,d}_getActiveElements(t,e,i,n){if(t.type==="mouseout")return[];if(!i)return e;const o=this.options.hover;return this.getElementsAtEventForMode(t,o.mode,o,n)}};function On(){return W(Os.instances,s=>s._plugins.invalidate())}function Oh(s,t,e){const{startAngle:i,pixelMargin:n,x:o,y:a,outerRadius:r,innerRadius:l}=t;let c=n/r;s.beginPath(),s.arc(o,a,r,i-c,e+c),l>n?(c=n/l,s.arc(o,a,l,e+c,i-c,!0)):s.arc(o,a,n,e+et,i-et),s.closePath(),s.clip()}function Ah(s){return ki(s,["outerStart","outerEnd","innerStart","innerEnd"])}function Lh(s,t,e,i){const n=Ah(s.options.borderRadius),o=(e-t)/2,a=Math.min(o,i*t/2),r=l=>{const c=(e-Math.min(o,l))*i/2;return lt(l,0,Math.min(o,c))};return{outerStart:r(n.outerStart),outerEnd:r(n.outerEnd),innerStart:lt(n.innerStart,0,a),innerEnd:lt(n.innerEnd,0,a)}}function pe(s,t,e,i){return{x:e+s*Math.cos(t),y:i+s*Math.sin(t)}}function vs(s,t,e,i,n,o){const{x:a,y:r,startAngle:l,pixelMargin:c,innerRadius:d}=t,u=Math.max(t.outerRadius+i+e-c,0),f=d>0?d+i+e+c:0;let g=0;const p=n-l;if(i){const z=d>0?d-i:0,H=u>0?u-i:0,tt=(z+H)/2,kt=tt!==0?p*tt/(tt+i):p;g=(p-kt)/2}const m=Math.max(.001,p*u-e/G)/u,b=(p-m)/2,_=l+b+g,w=n-b-g,{outerStart:k,outerEnd:v,innerStart:x,innerEnd:M}=Lh(t,f,u,w-_),P=u-k,D=u-v,$=_+k/P,R=w-v/D,L=f+x,E=f+M,at=_+x/L,J=w-M/E;if(s.beginPath(),o){const z=($+R)/2;if(s.arc(a,r,u,$,z),s.arc(a,r,u,z,R),v>0){const dt=pe(D,R,a,r);s.arc(dt.x,dt.y,v,R,w+et)}const H=pe(E,w,a,r);if(s.lineTo(H.x,H.y),M>0){const dt=pe(E,J,a,r);s.arc(dt.x,dt.y,M,w+et,J+Math.PI)}const tt=(w-M/f+(_+x/f))/2;if(s.arc(a,r,f,w-M/f,tt,!0),s.arc(a,r,f,tt,_+x/f,!0),x>0){const dt=pe(L,at,a,r);s.arc(dt.x,dt.y,x,at+Math.PI,_-et)}const kt=pe(P,_,a,r);if(s.lineTo(kt.x,kt.y),k>0){const dt=pe(P,$,a,r);s.arc(dt.x,dt.y,k,_-et,$)}}else{s.moveTo(a,r);const z=Math.cos($)*u+a,H=Math.sin($)*u+r;s.lineTo(z,H);const tt=Math.cos(R)*u+a,kt=Math.sin(R)*u+r;s.lineTo(tt,kt)}s.closePath()}function Th(s,t,e,i,n){const{fullCircles:o,startAngle:a,circumference:r}=t;let l=t.endAngle;if(o){vs(s,t,e,i,l,n);for(let c=0;ct!=="borderDash"};circumference;endAngle;fullCircles;innerRadius;outerRadius;pixelMargin;startAngle;constructor(t){super(),this.options=void 0,this.circumference=void 0,this.startAngle=void 0,this.endAngle=void 0,this.innerRadius=void 0,this.outerRadius=void 0,this.pixelMargin=0,this.fullCircles=0,t&&Object.assign(this,t)}inRange(t,e,i){const n=this.getProps(["x","y"],i),{angle:o,distance:a}=ko(n,{x:t,y:e}),{startAngle:r,endAngle:l,innerRadius:c,outerRadius:d,circumference:u}=this.getProps(["startAngle","endAngle","innerRadius","outerRadius","circumference"],i),f=(this.options.spacing+this.options.borderWidth)/2,g=I(u,l-r),p=je(o,r,l)&&r!==l,m=g>=X||p,b=Ft(a,c+f,d+f);return m&&b}getCenterPoint(t){const{x:e,y:i,startAngle:n,endAngle:o,innerRadius:a,outerRadius:r}=this.getProps(["x","y","startAngle","endAngle","innerRadius","outerRadius"],t),{offset:l,spacing:c}=this.options,d=(n+o)/2,u=(a+r+c+l)/2;return{x:e+Math.cos(d)*u,y:i+Math.sin(d)*u}}tooltipPosition(t){return this.getCenterPoint(t)}draw(t){const{options:e,circumference:i}=this,n=(e.offset||0)/4,o=(e.spacing||0)/2,a=e.circular;if(this.pixelMargin=e.borderAlign==="inner"?.33:0,this.fullCircles=i>X?Math.floor(i/X):0,i===0||this.innerRadius<0||this.outerRadius<0)return;t.save();const r=(this.startAngle+this.endAngle)/2;t.translate(Math.cos(r)*n,Math.sin(r)*n);const l=1-Math.sin(Math.min(G,i||0)),c=n*l;t.fillStyle=e.backgroundColor,t.strokeStyle=e.borderColor,Th(t,this,c,o,a),Rh(t,this,c,o,a),t.restore()}}function oa(s,t,e=t){s.lineCap=I(e.borderCapStyle,t.borderCapStyle),s.setLineDash(I(e.borderDash,t.borderDash)),s.lineDashOffset=I(e.borderDashOffset,t.borderDashOffset),s.lineJoin=I(e.borderJoinStyle,t.borderJoinStyle),s.lineWidth=I(e.borderWidth,t.borderWidth),s.strokeStyle=I(e.borderColor,t.borderColor)}function Eh(s,t,e){s.lineTo(e.x,e.y)}function Fh(s){return s.stepped?ec:s.tension||s.cubicInterpolationMode==="monotone"?sc:Eh}function aa(s,t,e={}){const i=s.length,{start:n=0,end:o=i-1}=e,{start:a,end:r}=t,l=Math.max(n,a),c=Math.min(o,r),d=nr&&o>r;return{count:i,start:l,loop:t.loop,ilen:c(a+(c?r-v:v))%o,k=()=>{m!==b&&(s.lineTo(d,b),s.lineTo(d,m),s.lineTo(d,_))};for(l&&(g=n[w(0)],s.moveTo(g.x,g.y)),f=0;f<=r;++f){if(g=n[w(f)],g.skip)continue;const v=g.x,x=g.y,M=v|0;M===p?(xb&&(b=x),d=(u*d+v)/++u):(k(),s.lineTo(v,x),p=M,u=0,m=b=x),_=x}k()}function ii(s){const t=s.options,e=t.borderDash&&t.borderDash.length;return!s._decimated&&!s._loop&&!t.tension&&t.cubicInterpolationMode!=="monotone"&&!t.stepped&&!e?zh:Bh}function Nh(s){return s.stepped?Rc:s.tension||s.cubicInterpolationMode==="monotone"?Ic:oe}function Vh(s,t,e,i){let n=t._path;n||(n=t._path=new Path2D,t.path(n,e,i)&&n.closePath()),oa(s,t.options),s.stroke(n)}function jh(s,t,e,i){const{segments:n,options:o}=t,a=ii(t);for(const r of n)oa(s,o,r.style),s.beginPath(),a(s,t,r,{start:e,end:e+i-1})&&s.closePath(),s.stroke()}const Wh=typeof Path2D=="function";function Hh(s,t,e,i){Wh&&!t.options.segment?Vh(s,t,e,i):jh(s,t,e,i)}class As extends Vt{static id="line";static defaults={borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderWidth:3,capBezierPoints:!0,cubicInterpolationMode:"default",fill:!1,spanGaps:!1,stepped:!1,tension:0};static defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};static descriptors={_scriptable:!0,_indexable:t=>t!=="borderDash"&&t!=="fill"};constructor(t){super(),this.animated=!0,this.options=void 0,this._chart=void 0,this._loop=void 0,this._fullLoop=void 0,this._path=void 0,this._points=void 0,this._segments=void 0,this._decimated=!1,this._pointsUpdated=!1,this._datasetIndex=void 0,t&&Object.assign(this,t)}updateControlPoints(t,e){const i=this.options;if((i.tension||i.cubicInterpolationMode==="monotone")&&!i.stepped&&!this._pointsUpdated){const n=i.spanGaps?this._loop:this._fullLoop;Pc(this._points,i,t,n,e),this._pointsUpdated=!0}}set points(t){this._points=t,delete this._segments,delete this._path,this._pointsUpdated=!1}get points(){return this._points}get segments(){return this._segments||(this._segments=Vc(this,this.options.segment))}first(){const t=this.segments,e=this.points;return t.length&&e[t[0].start]}last(){const t=this.segments,e=this.points,i=t.length;return i&&e[t[i-1].end]}interpolate(t,e){const i=this.options,n=t[e],o=this.points,a=Wo(this,{property:e,start:n,end:n});if(!a.length)return;const r=[],l=Nh(i);let c,d;for(c=0,d=a.length;c=e)return s.slice(t,t+e);const a=[],r=(e-2)/(o-2);let l=0;const c=t+e-1;let d=t,u,f,g,p,m;for(a[l++]=s[d],u=0;ug&&(g=p,f=s[w],m=w);a[l++]=f,d=m}return a[l++]=s[c],a}function Zh(s,t,e,i){let n=0,o=0,a,r,l,c,d,u,f,g,p,m;const b=[],_=t+e-1,w=s[t].x,v=s[_].x-w;for(a=t;am&&(m=c,f=a),n=(o*n+r.x)/++o;else{const M=a-1;if(!N(u)&&!N(f)){const P=Math.min(u,f),D=Math.max(u,f);P!==g&&P!==M&&b.push({...s[P],x:n}),D!==g&&D!==M&&b.push({...s[D],x:n})}a>0&&M!==g&&b.push(s[M]),b.push(r),d=x,o=0,p=m=c,u=f=g=a}}return b}function la(s){if(s._decimated){const t=s._data;delete s._decimated,delete s._data,Object.defineProperty(s,"data",{configurable:!0,enumerable:!0,writable:!0,value:t})}}function Ln(s){s.data.datasets.forEach(t=>{la(t)})}function tu(s,t){const e=t.length;let i=0,n;const{iScale:o}=s,{min:a,max:r,minDefined:l,maxDefined:c}=o.getUserBounds();return l&&(i=lt(Bt(t,o.axis,a).lo,0,e-1)),c?n=lt(Bt(t,o.axis,r).hi+1,i,e)-i:n=e-i,{start:i,count:n}}var eu={id:"decimation",defaults:{algorithm:"min-max",enabled:!1},beforeElementsUpdate:(s,t,e)=>{if(!e.enabled){Ln(s);return}const i=s.width;s.data.datasets.forEach((n,o)=>{const{_data:a,indexAxis:r}=n,l=s.getDatasetMeta(o),c=a||n.data;if(Le([r,s.options.indexAxis])==="y"||!l.controller.supportsDecimation)return;const d=s.scales[l.xAxisID];if(d.type!=="linear"&&d.type!=="time"||s.options.parsing)return;let{start:u,count:f}=tu(l,c);const g=e.threshold||4*i;if(f<=g){la(n);return}N(a)&&(n._data=c,delete n.data,Object.defineProperty(n,"data",{configurable:!0,enumerable:!0,get:function(){return this._decimated},set:function(m){this._data=m}}));let p;switch(e.algorithm){case"lttb":p=Qh(c,u,f,i,e);break;case"min-max":p=Zh(c,u,f,i);break;default:throw new Error(`Unsupported decimation algorithm '${e.algorithm}'`)}n._decimated=p})},destroy(s){Ln(s)}};function su(s,t,e){const i=s.segments,n=s.points,o=t.points,a=[];for(const r of i){let{start:l,end:c}=r;c=Oi(l,c,n);const d=ni(e,n[l],n[c],r.loop);if(!t.segments){a.push({source:r,target:d,start:n[l],end:n[c]});continue}const u=Wo(t,d);for(const f of u){const g=ni(e,o[f.start],o[f.end],f.loop),p=jo(r,n,g);for(const m of p)a.push({source:m,target:f,start:{[e]:Tn(d,g,"start",Math.max)},end:{[e]:Tn(d,g,"end",Math.min)}})}}return a}function ni(s,t,e,i){if(i)return;let n=t[s],o=e[s];return s==="angle"&&(n=xt(n),o=xt(o)),{property:s,start:n,end:o}}function iu(s,t){const{x:e=null,y:i=null}=s||{},n=t.points,o=[];return t.segments.forEach(({start:a,end:r})=>{r=Oi(a,r,n);const l=n[a],c=n[r];i!==null?(o.push({x:l.x,y:i}),o.push({x:c.x,y:i})):e!==null&&(o.push({x:e,y:l.y}),o.push({x:e,y:c.y}))}),o}function Oi(s,t,e){for(;t>s;t--){const i=e[t];if(!isNaN(i.x)&&!isNaN(i.y))break}return t}function Tn(s,t,e,i){return s&&t?i(s[e],t[e]):s?s[e]:t?t[e]:0}function ca(s,t){let e=[],i=!1;return q(s)?(i=!0,e=s):e=iu(s,t),e.length?new As({points:e,options:{tension:0},_loop:i,_fullLoop:i}):null}function Rn(s){return s&&s.fill!==!1}function nu(s,t,e){let n=s[t].fill;const o=[t];let a;if(!e)return n;for(;n!==!1&&o.indexOf(n)===-1;){if(!Q(n))return n;if(a=s[n],!a)return!1;if(a.visible)return n;o.push(n),n=a.fill}return!1}function ou(s,t,e){const i=cu(s);if(B(i))return isNaN(i.value)?!1:i;let n=parseFloat(i);return Q(n)&&Math.floor(n)===n?au(i[0],t,n,e):["origin","start","end","stack","shape"].indexOf(i)>=0&&i}function au(s,t,e,i){return(s==="-"||s==="+")&&(e=t+e),e===t||e<0||e>=i?!1:e}function ru(s,t){let e=null;return s==="start"?e=t.bottom:s==="end"?e=t.top:B(s)?e=t.getPixelForValue(s.value):t.getBasePixel&&(e=t.getBasePixel()),e}function lu(s,t,e){let i;return s==="start"?i=e:s==="end"?i=t.options.reverse?t.min:t.max:B(s)?i=s.value:i=t.getBaseValue(),i}function cu(s){const t=s.options,e=t.fill;let i=I(e&&e.target,e);return i===void 0&&(i=!!t.backgroundColor),i===!1||i===null?!1:i===!0?"origin":i}function du(s){const{scale:t,index:e,line:i}=s,n=[],o=i.segments,a=i.points,r=hu(t,e);r.push(ca({x:null,y:t.bottom},i));for(let l=0;l=0;--a){const r=n[a].$filler;r&&(r.line.updateControlPoints(o,r.axis),i&&r.fill&&Us(s.ctx,r,o))}},beforeDatasetsDraw(s,t,e){if(e.drawTime!=="beforeDatasetsDraw")return;const i=s.getSortedVisibleDatasetMetas();for(let n=i.length-1;n>=0;--n){const o=i[n].$filler;Rn(o)&&Us(s.ctx,o,s.chartArea)}},beforeDatasetDraw(s,t,e){const i=t.meta.$filler;!Rn(i)||e.drawTime!=="beforeDatasetDraw"||Us(s.ctx,i,s.chartArea)},defaults:{propagate:!0,drawTime:"beforeDatasetDraw"}};const Bn=(s,t)=>{let{boxHeight:e=t,boxWidth:i=t}=s;return s.usePointStyle&&(e=Math.min(e,t),i=s.pointStyleWidth||Math.min(i,t)),{boxWidth:i,boxHeight:e,itemHeight:Math.max(t,e)}},wu=(s,t)=>s!==null&&t!==null&&s.datasetIndex===t.datasetIndex&&s.index===t.index;class zn extends Vt{constructor(t){super(),this._added=!1,this.legendHitBoxes=[],this._hoveredItem=null,this.doughnutMode=!1,this.chart=t.chart,this.options=t.options,this.ctx=t.ctx,this.legendItems=void 0,this.columnSizes=void 0,this.lineWidths=void 0,this.maxHeight=void 0,this.maxWidth=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.height=void 0,this.width=void 0,this._margins=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(t,e,i){this.maxWidth=t,this.maxHeight=e,this._margins=i,this.setDimensions(),this.buildLabels(),this.fit()}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=this._margins.left,this.right=this.width):(this.height=this.maxHeight,this.top=this._margins.top,this.bottom=this.height)}buildLabels(){const t=this.options.labels||{};let e=Y(t.generateLabels,[this.chart],this)||[];t.filter&&(e=e.filter(i=>t.filter(i,this.chart.data))),t.sort&&(e=e.sort((i,n)=>t.sort(i,n,this.chart.data))),this.options.reverse&&e.reverse(),this.legendItems=e}fit(){const{options:t,ctx:e}=this;if(!t.display){this.width=this.height=0;return}const i=t.labels,n=ot(i.font),o=n.size,a=this._computeTitleHeight(),{boxWidth:r,itemHeight:l}=Bn(i,o);let c,d;e.font=n.string,this.isHorizontal()?(c=this.maxWidth,d=this._fitRows(a,o,r,l)+10):(d=this.maxHeight,c=this._fitCols(a,n,r,l)+10),this.width=Math.min(c,t.maxWidth||this.maxWidth),this.height=Math.min(d,t.maxHeight||this.maxHeight)}_fitRows(t,e,i,n){const{ctx:o,maxWidth:a,options:{labels:{padding:r}}}=this,l=this.legendHitBoxes=[],c=this.lineWidths=[0],d=n+r;let u=t;o.textAlign="left",o.textBaseline="middle";let f=-1,g=-d;return this.legendItems.forEach((p,m)=>{const b=i+e/2+o.measureText(p.text).width;(m===0||c[c.length-1]+b+2*r>a)&&(u+=d,c[c.length-(m>0?0:1)]=0,g+=d,f++),l[m]={left:0,top:g,row:f,width:b,height:n},c[c.length-1]+=b+r}),u}_fitCols(t,e,i,n){const{ctx:o,maxHeight:a,options:{labels:{padding:r}}}=this,l=this.legendHitBoxes=[],c=this.columnSizes=[],d=a-t;let u=r,f=0,g=0,p=0,m=0;return this.legendItems.forEach((b,_)=>{const{itemWidth:w,itemHeight:k}=ku(i,e,o,b,n);_>0&&g+k+2*r>d&&(u+=f+r,c.push({width:f,height:g}),p+=f+r,m++,f=g=0),l[_]={left:p,top:g,col:m,width:w,height:k},f=Math.max(f,w),g+=k+r}),u+=f,c.push({width:f,height:g}),u}adjustHitBoxes(){if(!this.options.display)return;const t=this._computeTitleHeight(),{legendHitBoxes:e,options:{align:i,labels:{padding:n},rtl:o}}=this,a=_e(o,this.left,this.width);if(this.isHorizontal()){let r=0,l=ht(i,this.left+n,this.right-this.lineWidths[r]);for(const c of e)r!==c.row&&(r=c.row,l=ht(i,this.left+n,this.right-this.lineWidths[r])),c.top+=this.top+t+n,c.left=a.leftForLtr(a.x(l),c.width),l+=c.width+n}else{let r=0,l=ht(i,this.top+t+n,this.bottom-this.columnSizes[r].height);for(const c of e)c.col!==r&&(r=c.col,l=ht(i,this.top+t+n,this.bottom-this.columnSizes[r].height)),c.top=l,c.left+=this.left+n,c.left=a.leftForLtr(a.x(c.left),c.width),l+=c.height+n}}isHorizontal(){return this.options.position==="top"||this.options.position==="bottom"}draw(){if(this.options.display){const t=this.ctx;Cs(t,this),this._draw(),Ds(t)}}_draw(){const{options:t,columnSizes:e,lineWidths:i,ctx:n}=this,{align:o,labels:a}=t,r=Z.color,l=_e(t.rtl,this.left,this.width),c=ot(a.font),{padding:d}=a,u=c.size,f=u/2;let g;this.drawTitle(),n.textAlign=l.textAlign("left"),n.textBaseline="middle",n.lineWidth=.5,n.font=c.string;const{boxWidth:p,boxHeight:m,itemHeight:b}=Bn(a,u),_=function(M,P,D){if(isNaN(p)||p<=0||isNaN(m)||m<0)return;n.save();const $=I(D.lineWidth,1);if(n.fillStyle=I(D.fillStyle,r),n.lineCap=I(D.lineCap,"butt"),n.lineDashOffset=I(D.lineDashOffset,0),n.lineJoin=I(D.lineJoin,"miter"),n.lineWidth=$,n.strokeStyle=I(D.strokeStyle,r),n.setLineDash(I(D.lineDash,[])),a.usePointStyle){const R={radius:m*Math.SQRT2/2,pointStyle:D.pointStyle,rotation:D.rotation,borderWidth:$},L=l.xPlus(M,p/2),E=P+f;Ao(n,R,L,E,a.pointStyleWidth&&p)}else{const R=P+Math.max((u-m)/2,0),L=l.leftForLtr(M,p),E=re(D.borderRadius);n.beginPath(),Object.values(E).some(at=>at!==0)?We(n,{x:L,y:R,w:p,h:m,radius:E}):n.rect(L,R,p,m),n.fill(),$!==0&&n.stroke()}n.restore()},w=function(M,P,D){de(n,D.text,M,P+b/2,c,{strikethrough:D.hidden,textAlign:l.textAlign(D.textAlign)})},k=this.isHorizontal(),v=this._computeTitleHeight();k?g={x:ht(o,this.left+d,this.right-i[0]),y:this.top+d+v,line:0}:g={x:this.left+d,y:ht(o,this.top+v+d,this.bottom-e[0].height),line:0},zo(this.ctx,t.textDirection);const x=b+d;this.legendItems.forEach((M,P)=>{n.strokeStyle=M.fontColor,n.fillStyle=M.fontColor;const D=n.measureText(M.text).width,$=l.textAlign(M.textAlign||(M.textAlign=a.textAlign)),R=p+f+D;let L=g.x,E=g.y;l.setWidth(this.width),k?P>0&&L+R+d>this.right&&(E=g.y+=x,g.line++,L=g.x=ht(o,this.left+d,this.right-i[g.line])):P>0&&E+x>this.bottom&&(L=g.x=L+e[g.line].width+d,g.line++,E=g.y=ht(o,this.top+v+d,this.bottom-e[g.line].height));const at=l.x(L);if(_(at,E,M),L=Hl($,L+p+f,k?L+R:this.right,t.rtl),w(l.x(L),E,M),k)g.x+=R+d;else if(typeof M.text!="string"){const J=c.lineHeight;g.y+=ha(M,J)+d}else g.y+=x}),No(this.ctx,t.textDirection)}drawTitle(){const t=this.options,e=t.title,i=ot(e.font),n=ft(e.padding);if(!e.display)return;const o=_e(t.rtl,this.left,this.width),a=this.ctx,r=e.position,l=i.size/2,c=n.top+l;let d,u=this.left,f=this.width;if(this.isHorizontal())f=Math.max(...this.lineWidths),d=this.top+c,u=ht(t.align,u,this.right-f);else{const p=this.columnSizes.reduce((m,b)=>Math.max(m,b.height),0);d=c+ht(t.align,this.top,this.bottom-p-t.labels.padding-this._computeTitleHeight())}const g=ht(r,u,u+f);a.textAlign=o.textAlign(vi(r)),a.textBaseline="middle",a.strokeStyle=e.color,a.fillStyle=e.color,a.font=i.string,de(a,e.text,g,d,i)}_computeTitleHeight(){const t=this.options.title,e=ot(t.font),i=ft(t.padding);return t.display?e.lineHeight+i.height:0}_getLegendItemAt(t,e){let i,n,o;if(Ft(t,this.left,this.right)&&Ft(e,this.top,this.bottom)){for(o=this.legendHitBoxes,i=0;io.length>a.length?o:a)),t+e.size/2+i.measureText(n).width}function Mu(s,t,e){let i=s;return typeof t.text!="string"&&(i=ha(t,e)),i}function ha(s,t){const e=s.text?s.text.length:0;return t*e}function Pu(s,t){return!!((s==="mousemove"||s==="mouseout")&&(t.onHover||t.onLeave)||t.onClick&&(s==="click"||s==="mouseup"))}var Cu={id:"legend",_element:zn,start(s,t,e){const i=s.legend=new zn({ctx:s.ctx,options:e,chart:s});wt.configure(s,i,e),wt.addBox(s,i)},stop(s){wt.removeBox(s,s.legend),delete s.legend},beforeUpdate(s,t,e){const i=s.legend;wt.configure(s,i,e),i.options=e},afterUpdate(s){const t=s.legend;t.buildLabels(),t.adjustHitBoxes()},afterEvent(s,t){t.replay||s.legend.handleEvent(t.event)},defaults:{display:!0,position:"top",align:"center",fullSize:!0,reverse:!1,weight:1e3,onClick(s,t,e){const i=t.datasetIndex,n=e.chart;n.isDatasetVisible(i)?(n.hide(i),t.hidden=!0):(n.show(i),t.hidden=!1)},onHover:null,onLeave:null,labels:{color:s=>s.chart.options.color,boxWidth:40,padding:10,generateLabels(s){const t=s.data.datasets,{labels:{usePointStyle:e,pointStyle:i,textAlign:n,color:o,useBorderRadius:a,borderRadius:r}}=s.legend.options;return s._getSortedDatasetMetas().map(l=>{const c=l.controller.getStyle(e?0:void 0),d=ft(c.borderWidth);return{text:t[l.index].label,fillStyle:c.backgroundColor,fontColor:o,hidden:!l.visible,lineCap:c.borderCapStyle,lineDash:c.borderDash,lineDashOffset:c.borderDashOffset,lineJoin:c.borderJoinStyle,lineWidth:(d.width+d.height)/4,strokeStyle:c.borderColor,pointStyle:i||c.pointStyle,rotation:c.rotation,textAlign:n||c.textAlign,borderRadius:a&&(r||c.borderRadius),datasetIndex:l.index}},this)}},title:{color:s=>s.chart.options.color,display:!1,position:"center",text:""}},descriptors:{_scriptable:s=>!s.startsWith("on"),labels:{_scriptable:s=>!["generateLabels","filter","sort"].includes(s)}}};class ua extends Vt{constructor(t){super(),this.chart=t.chart,this.options=t.options,this.ctx=t.ctx,this._padding=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(t,e){const i=this.options;if(this.left=0,this.top=0,!i.display){this.width=this.height=this.right=this.bottom=0;return}this.width=this.right=t,this.height=this.bottom=e;const n=q(i.text)?i.text.length:1;this._padding=ft(i.padding);const o=n*ot(i.font).lineHeight+this._padding.height;this.isHorizontal()?this.height=o:this.width=o}isHorizontal(){const t=this.options.position;return t==="top"||t==="bottom"}_drawArgs(t){const{top:e,left:i,bottom:n,right:o,options:a}=this,r=a.align;let l=0,c,d,u;return this.isHorizontal()?(d=ht(r,i,o),u=e+t,c=o-i):(a.position==="left"?(d=i+t,u=ht(r,n,e),l=G*-.5):(d=o-t,u=ht(r,e,n),l=G*.5),c=n-e),{titleX:d,titleY:u,maxWidth:c,rotation:l}}draw(){const t=this.ctx,e=this.options;if(!e.display)return;const i=ot(e.font),o=i.lineHeight/2+this._padding.top,{titleX:a,titleY:r,maxWidth:l,rotation:c}=this._drawArgs(o);de(t,e.text,0,0,i,{color:e.color,maxWidth:l,rotation:c,textAlign:vi(e.align),textBaseline:"middle",translation:[a,r]})}}function Du(s,t){const e=new ua({ctx:s.ctx,options:t,chart:s});wt.configure(s,e,t),wt.addBox(s,e),s.titleBlock=e}var $u={id:"title",_element:ua,start(s,t,e){Du(s,e)},stop(s){const t=s.titleBlock;wt.removeBox(s,t),delete s.titleBlock},beforeUpdate(s,t,e){const i=s.titleBlock;wt.configure(s,i,e),i.options=e},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 Re={average(s){if(!s.length)return!1;let t,e,i=new Set,n=0,o=0;for(t=0,e=s.length;tr+l)/i.size,y:n/o}},nearest(s,t){if(!s.length)return!1;let e=t.x,i=t.y,n=Number.POSITIVE_INFINITY,o,a,r;for(o=0,a=s.length;o-1?s.split(` `):s}function Ou(s,t){const{element:e,datasetIndex:i,index:n}=t,o=s.getDatasetMeta(i).controller,{label:a,value:r}=o.getLabelAndValue(n);return{chart:s,label:a,parsed:o.getParsed(n),raw:s.data.datasets[i].data[n],formattedValue:r,dataset:o.getDataset(),dataIndex:n,datasetIndex:i,element:e}}function Nn(s,t){const e=s.chart.ctx,{body:i,footer:n,title:o}=s,{boxWidth:a,boxHeight:r}=t,l=ot(t.bodyFont),c=ot(t.titleFont),d=ot(t.footerFont),u=o.length,f=n.length,g=i.length,p=ft(t.padding);let m=p.height,b=0,_=i.reduce((v,x)=>v+x.before.length+x.lines.length+x.after.length,0);if(_+=s.beforeBody.length+s.afterBody.length,u&&(m+=u*c.lineHeight+(u-1)*t.titleSpacing+t.titleMarginBottom),_){const v=t.displayColors?Math.max(r,l.lineHeight):l.lineHeight;m+=g*v+(_-g)*l.lineHeight+(_-1)*t.bodySpacing}f&&(m+=t.footerMarginTop+f*d.lineHeight+(f-1)*t.footerSpacing);let w=0;const k=function(v){b=Math.max(b,e.measureText(v).width+w)};return e.save(),e.font=c.string,W(s.title,k),e.font=l.string,W(s.beforeBody.concat(s.afterBody),k),w=t.displayColors?a+2+t.boxPadding:0,W(i,v=>{W(v.before,k),W(v.lines,k),W(v.after,k)}),w=0,e.font=d.string,W(s.footer,k),e.restore(),b+=p.width,{width:b,height:m}}function Au(s,t){const{y:e,height:i}=t;return es.height-i/2?"bottom":"center"}function Lu(s,t,e,i){const{x:n,width:o}=i,a=e.caretSize+e.caretPadding;if(s==="left"&&n+o+a>t.width||s==="right"&&n-o-a<0)return!0}function Tu(s,t,e,i){const{x:n,width:o}=e,{width:a,chartArea:{left:r,right:l}}=s;let c="center";return i==="center"?c=n<=(r+l)/2?"left":"right":n<=o/2?c="left":n>=a-o/2&&(c="right"),Lu(c,s,t,e)&&(c="center"),c}function Vn(s,t,e){const i=e.yAlign||t.yAlign||Au(s,e);return{xAlign:e.xAlign||t.xAlign||Tu(s,t,e,i),yAlign:i}}function Ru(s,t){let{x:e,width:i}=s;return t==="right"?e-=i:t==="center"&&(e-=i/2),e}function Iu(s,t,e){let{y:i,height:n}=s;return t==="top"?i+=e:t==="bottom"?i-=n+e:i-=n/2,i}function jn(s,t,e,i){const{caretSize:n,caretPadding:o,cornerRadius:a}=s,{xAlign:r,yAlign:l}=e,c=n+o,{topLeft:d,topRight:u,bottomLeft:f,bottomRight:g}=re(a);let p=Ru(t,r);const m=Iu(t,l,c);return l==="center"?r==="left"?p+=c:r==="right"&&(p-=c):r==="left"?p-=Math.max(d,f)+n:r==="right"&&(p+=Math.max(u,g)+n),{x:lt(p,0,i.width-t.width),y:lt(m,0,i.height-t.height)}}function ls(s,t,e){const i=ft(e.padding);return t==="center"?s.x+s.width/2:t==="right"?s.x+s.width-i.right:s.x+i.left}function Wn(s){return Mt([],It(s))}function Eu(s,t,e){return Xt(s,{tooltip:t,tooltipItems:e,type:"tooltip"})}function Hn(s,t){const e=t&&t.dataset&&t.dataset.tooltip&&t.dataset.tooltip.callbacks;return e?s.override(e):s}const fa={beforeTitle:Tt,title(s){if(s.length>0){const t=s[0],e=t.chart.data.labels,i=e?e.length:0;if(this&&this.options&&this.options.mode==="dataset")return t.dataset.label||"";if(t.label)return t.label;if(i>0&&t.dataIndex"u"?fa[t].call(e,i):n}class Un extends Vt{static positioners=Re;constructor(t){super(),this.opacity=0,this._active=[],this._eventPosition=void 0,this._size=void 0,this._cachedAnimations=void 0,this._tooltipItems=[],this.$animations=void 0,this.$context=void 0,this.chart=t.chart,this.options=t.options,this.dataPoints=void 0,this.title=void 0,this.beforeBody=void 0,this.body=void 0,this.afterBody=void 0,this.footer=void 0,this.xAlign=void 0,this.yAlign=void 0,this.x=void 0,this.y=void 0,this.height=void 0,this.width=void 0,this.caretX=void 0,this.caretY=void 0,this.labelColors=void 0,this.labelPointStyles=void 0,this.labelTextColors=void 0}initialize(t){this.options=t,this._cachedAnimations=void 0,this.$context=void 0}_resolveAnimations(){const t=this._cachedAnimations;if(t)return t;const e=this.chart,i=this.options.setContext(this.getContext()),n=i.enabled&&e.options.animation&&i.animations,o=new Ho(this.chart,n);return n._cacheable&&(this._cachedAnimations=Object.freeze(o)),o}getContext(){return this.$context||(this.$context=Eu(this.chart.getContext(),this,this._tooltipItems))}getTitle(t,e){const{callbacks:i}=e,n=mt(i,"beforeTitle",this,t),o=mt(i,"title",this,t),a=mt(i,"afterTitle",this,t);let r=[];return r=Mt(r,It(n)),r=Mt(r,It(o)),r=Mt(r,It(a)),r}getBeforeBody(t,e){return Wn(mt(e.callbacks,"beforeBody",this,t))}getBody(t,e){const{callbacks:i}=e,n=[];return W(t,o=>{const a={before:[],lines:[],after:[]},r=Hn(i,o);Mt(a.before,It(mt(r,"beforeLabel",this,o))),Mt(a.lines,mt(r,"label",this,o)),Mt(a.after,It(mt(r,"afterLabel",this,o))),n.push(a)}),n}getAfterBody(t,e){return Wn(mt(e.callbacks,"afterBody",this,t))}getFooter(t,e){const{callbacks:i}=e,n=mt(i,"beforeFooter",this,t),o=mt(i,"footer",this,t),a=mt(i,"afterFooter",this,t);let r=[];return r=Mt(r,It(n)),r=Mt(r,It(o)),r=Mt(r,It(a)),r}_createItems(t){const e=this._active,i=this.chart.data,n=[],o=[],a=[];let r=[],l,c;for(l=0,c=e.length;lt.filter(d,u,f,i))),t.itemSort&&(r=r.sort((d,u)=>t.itemSort(d,u,i))),W(r,d=>{const u=Hn(t.callbacks,d);n.push(mt(u,"labelColor",this,d)),o.push(mt(u,"labelPointStyle",this,d)),a.push(mt(u,"labelTextColor",this,d))}),this.labelColors=n,this.labelPointStyles=o,this.labelTextColors=a,this.dataPoints=r,r}update(t,e){const i=this.options.setContext(this.getContext()),n=this._active;let o,a=[];if(!n.length)this.opacity!==0&&(o={opacity:0});else{const r=Re[i.position].call(this,n,this._eventPosition);a=this._createItems(i),this.title=this.getTitle(a,i),this.beforeBody=this.getBeforeBody(a,i),this.body=this.getBody(a,i),this.afterBody=this.getAfterBody(a,i),this.footer=this.getFooter(a,i);const l=this._size=Nn(this,i),c=Object.assign({},r,l),d=Vn(this.chart,i,c),u=jn(i,c,d,this.chart);this.xAlign=d.xAlign,this.yAlign=d.yAlign,o={opacity:1,x:u.x,y:u.y,width:l.width,height:l.height,caretX:r.x,caretY:r.y}}this._tooltipItems=a,this.$context=void 0,o&&this._resolveAnimations().update(this,o),t&&i.external&&i.external.call(this,{chart:this.chart,tooltip:this,replay:e})}drawCaret(t,e,i,n){const o=this.getCaretPosition(t,i,n);e.lineTo(o.x1,o.y1),e.lineTo(o.x2,o.y2),e.lineTo(o.x3,o.y3)}getCaretPosition(t,e,i){const{xAlign:n,yAlign:o}=this,{caretSize:a,cornerRadius:r}=i,{topLeft:l,topRight:c,bottomLeft:d,bottomRight:u}=re(r),{x:f,y:g}=t,{width:p,height:m}=e;let b,_,w,k,v,x;return o==="center"?(v=g+m/2,n==="left"?(b=f,_=b-a,k=v+a,x=v-a):(b=f+p,_=b+a,k=v-a,x=v+a),w=b):(n==="left"?_=f+Math.max(l,d)+a:n==="right"?_=f+p-Math.max(c,u)-a:_=this.caretX,o==="top"?(k=g,v=k-a,b=_-a,w=_+a):(k=g+m,v=k+a,b=_+a,w=_-a),x=k),{x1:b,x2:_,x3:w,y1:k,y2:v,y3:x}}drawTitle(t,e,i){const n=this.title,o=n.length;let a,r,l;if(o){const c=_e(i.rtl,this.x,this.width);for(t.x=ls(this,i.titleAlign,i),e.textAlign=c.textAlign(i.titleAlign),e.textBaseline="middle",a=ot(i.titleFont),r=i.titleSpacing,e.fillStyle=i.titleColor,e.font=a.string,l=0;lw!==0)?(t.beginPath(),t.fillStyle=o.multiKeyBackground,We(t,{x:m,y:p,w:c,h:l,radius:_}),t.fill(),t.stroke(),t.fillStyle=a.backgroundColor,t.beginPath(),We(t,{x:b,y:p+1,w:c-2,h:l-2,radius:_}),t.fill()):(t.fillStyle=o.multiKeyBackground,t.fillRect(m,p,c,l),t.strokeRect(m,p,c,l),t.fillStyle=a.backgroundColor,t.fillRect(b,p+1,c-2,l-2))}t.fillStyle=this.labelTextColors[i]}drawBody(t,e,i){const{body:n}=this,{bodySpacing:o,bodyAlign:a,displayColors:r,boxHeight:l,boxWidth:c,boxPadding:d}=i,u=ot(i.bodyFont);let f=u.lineHeight,g=0;const p=_e(i.rtl,this.x,this.width),m=function(D){e.fillText(D,p.x(t.x+g),t.y+f/2),t.y+=f+o},b=p.textAlign(a);let _,w,k,v,x,M,P;for(e.textAlign=a,e.textBaseline="middle",e.font=u.string,t.x=ls(this,b,i),e.fillStyle=i.bodyColor,W(this.beforeBody,m),g=r&&b!=="right"?a==="center"?c/2+d:c+2+d:0,v=0,M=n.length;v0&&e.stroke()}_updateAnimationTarget(t){const e=this.chart,i=this.$animations,n=i&&i.x,o=i&&i.y;if(n||o){const a=Re[t.position].call(this,this._active,this._eventPosition);if(!a)return;const r=this._size=Nn(this,t),l=Object.assign({},a,this._size),c=Vn(e,t,l),d=jn(t,l,c,e);(n._to!==d.x||o._to!==d.y)&&(this.xAlign=c.xAlign,this.yAlign=c.yAlign,this.width=r.width,this.height=r.height,this.caretX=a.x,this.caretY=a.y,this._resolveAnimations().update(this,d))}}_willRender(){return!!this.opacity}draw(t){const e=this.options.setContext(this.getContext());let i=this.opacity;if(!i)return;this._updateAnimationTarget(e);const n={width:this.width,height:this.height},o={x:this.x,y:this.y};i=Math.abs(i)<.001?0:i;const a=ft(e.padding),r=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;e.enabled&&r&&(t.save(),t.globalAlpha=i,this.drawBackground(o,t,n,e),zo(t,e.textDirection),o.y+=a.top,this.drawTitle(o,t,e),this.drawBody(o,t,e),this.drawFooter(o,t,e),No(t,e.textDirection),t.restore())}getActiveElements(){return this._active||[]}setActiveElements(t,e){const i=this._active,n=t.map(({datasetIndex:r,index:l})=>{const c=this.chart.getDatasetMeta(r);if(!c)throw new Error("Cannot find a dataset at index "+r);return{datasetIndex:r,element:c.data[l],index:l}}),o=!ps(i,n),a=this._positionChanged(n,e);(o||a)&&(this._active=n,this._eventPosition=e,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(t,e,i=!0){if(e&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;const n=this.options,o=this._active||[],a=this._getActiveElements(t,o,e,i),r=this._positionChanged(a,t),l=e||!ps(a,o)||r;return l&&(this._active=a,(n.enabled||n.external)&&(this._eventPosition={x:t.x,y:t.y},this.update(!0,e))),l}_getActiveElements(t,e,i,n){const o=this.options;if(t.type==="mouseout")return[];if(!n)return e.filter(r=>this.chart.data.datasets[r.datasetIndex]&&this.chart.getDatasetMeta(r.datasetIndex).controller.getParsed(r.index)!==void 0);const a=this.chart.getElementsAtEventForMode(t,o.mode,o,i);return o.reverse&&a.reverse(),a}_positionChanged(t,e){const{caretX:i,caretY:n,options:o}=this,a=Re[o.position].call(this,t,e);return a!==!1&&(i!==a.x||n!==a.y)}}var Fu={id:"tooltip",_element:Un,positioners:Re,afterInit(s,t,e){e&&(s.tooltip=new Un({chart:s,options:e}))},beforeUpdate(s,t,e){s.tooltip&&s.tooltip.initialize(e)},reset(s,t,e){s.tooltip&&s.tooltip.initialize(e)},afterDraw(s){const t=s.tooltip;if(t&&t._willRender()){const e={tooltip:t};if(s.notifyPlugins("beforeTooltipDraw",{...e,cancelable:!0})===!1)return;t.draw(s.ctx),s.notifyPlugins("afterTooltipDraw",e)}},afterEvent(s,t){if(s.tooltip){const e=t.replay;s.tooltip.handleEvent(t.event,e,t.inChartArea)&&(t.changed=!0)}},defaults:{enabled:!0,external:null,position:"average",backgroundColor:"rgba(0,0,0,0.8)",titleColor:"#fff",titleFont:{weight:"bold"},titleSpacing:2,titleMarginBottom:6,titleAlign:"left",bodyColor:"#fff",bodySpacing:2,bodyFont:{},bodyAlign:"left",footerColor:"#fff",footerSpacing:2,footerMarginTop:6,footerFont:{weight:"bold"},footerAlign:"left",padding:6,caretPadding:2,caretSize:5,cornerRadius:6,boxHeight:(s,t)=>t.bodyFont.size,boxWidth:(s,t)=>t.bodyFont.size,multiKeyBackground:"#fff",displayColors:!0,boxPadding:0,borderColor:"rgba(0,0,0,0)",borderWidth:0,animation:{duration:400,easing:"easeOutQuart"},animations:{numbers:{type:"number",properties:["x","y","width","height","caretX","caretY"]},opacity:{easing:"linear",duration:200}},callbacks:fa},defaultRoutes:{bodyFont:"font",footerFont:"font",titleFont:"font"},descriptors:{_scriptable:s=>s!=="filter"&&s!=="itemSort"&&s!=="external",_indexable:!1,callbacks:{_scriptable:!1,_indexable:!1},animation:{_fallback:!1},animations:{_fallback:"animation"}},additionalOptionScopes:["interaction"]};const Bu=(s,t,e,i)=>(typeof t=="string"?(e=s.push(t)-1,i.unshift({index:e,label:t})):isNaN(t)&&(e=null),e);function zu(s,t,e,i){const n=s.indexOf(t);if(n===-1)return Bu(s,t,e,i);const o=s.lastIndexOf(t);return n!==o?e:n}const Nu=(s,t)=>s===null?null:lt(Math.round(s),0,t);function Yn(s){const t=this.getLabels();return s>=0&&se.length-1?null:this.getPixelForValue(e[t].value)}getValueForPixel(t){return Math.round(this._startValue+this.getDecimalForPixel(t)*this._valueRange)}getBasePixel(){return this.bottom}}function ju(s,t){const e=[],{bounds:n,step:o,min:a,max:r,precision:l,count:c,maxTicks:d,maxDigits:u,includeBounds:f}=s,g=o||1,p=d-1,{min:m,max:b}=t,_=!N(a),w=!N(r),k=!N(c),v=(b-m)/(u+1);let x=Ni((b-m)/p/g)*g,M,P,D,$;if(x<1e-14&&!_&&!w)return[{value:m},{value:b}];$=Math.ceil(b/x)-Math.floor(m/x),$>p&&(x=Ni($*x/p/g)*g),N(l)||(M=Math.pow(10,l),x=Math.ceil(x*M)/M),n==="ticks"?(P=Math.floor(m/x)*x,D=Math.ceil(b/x)*x):(P=m,D=b),_&&w&&o&&Fl((r-a)/o,x/1e3)?($=Math.round(Math.min((r-a)/x,d)),x=(r-a)/$,P=a,D=r):k?(P=_?a:P,D=w?r:D,$=c-1,x=(D-P)/$):($=(D-P)/x,Ee($,Math.round($),x/1e3)?$=Math.round($):$=Math.ceil($));const R=Math.max(Vi(x),Vi(P));M=Math.pow(10,N(l)?R:l),P=Math.round(P*M)/M,D=Math.round(D*M)/M;let L=0;for(_&&(f&&P!==a?(e.push({value:a}),Pr)break;e.push({value:E})}return w&&f&&D!==r?e.length&&Ee(e[e.length-1].value,r,Jn(r,v,s))?e[e.length-1].value=r:e.push({value:r}):(!w||D===r)&&e.push({value:D}),e}function Jn(s,t,{horizontal:e,minRotation:i}){const n=St(i),o=(e?Math.sin(n):Math.cos(n))||.001,a=.75*t*(""+s).length;return Math.min(t/o,a)}class ws extends he{constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._endValue=void 0,this._valueRange=0}parse(t,e){return N(t)||(typeof t=="number"||t instanceof Number)&&!isFinite(+t)?null:+t}handleTickRangeOptions(){const{beginAtZero:t}=this.options,{minDefined:e,maxDefined:i}=this.getUserBounds();let{min:n,max:o}=this;const a=l=>n=e?n:l,r=l=>o=i?o:l;if(t){const l=Dt(n),c=Dt(o);l<0&&c<0?r(0):l>0&&c>0&&a(0)}if(n===o){let l=o===0?1:Math.abs(o*.05);r(o+l),t||a(n-l)}this.min=n,this.max=o}getTickLimit(){const t=this.options.ticks;let{maxTicksLimit:e,stepSize:i}=t,n;return i?(n=Math.ceil(this.max/i)-Math.floor(this.min/i)+1,n>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${i} would result generating up to ${n} ticks. Limiting to 1000.`),n=1e3)):(n=this.computeTickLimit(),e=e||11),e&&(n=Math.min(e,n)),n}computeTickLimit(){return Number.POSITIVE_INFINITY}buildTicks(){const t=this.options,e=t.ticks;let i=this.getTickLimit();i=Math.max(2,i);const n={maxTicks:i,bounds:t.bounds,min:t.min,max:t.max,precision:e.precision,step:e.stepSize,count:e.count,maxDigits:this._maxDigits(),horizontal:this.isHorizontal(),minRotation:e.minRotation||0,includeBounds:e.includeBounds!==!1},o=this._range||this,a=ju(n,o);return t.bounds==="ticks"&&wo(a,this,"value"),t.reverse?(a.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),a}configure(){const t=this.ticks;let e=this.min,i=this.max;if(super.configure(),this.options.offset&&t.length){const n=(i-e)/Math.max(t.length-1,1)/2;e-=n,i+=n}this._startValue=e,this._endValue=i,this._valueRange=i-e}getLabelForValue(t){return Ke(t,this.chart.options.locale,this.options.ticks.format)}}class Wu extends ws{static id="linear";static defaults={ticks:{callback:Ps.formatters.numeric}};determineDataLimits(){const{min:t,max:e}=this.getMinMax(!0);this.min=Q(t)?t:0,this.max=Q(e)?e:1,this.handleTickRangeOptions()}computeTickLimit(){const t=this.isHorizontal(),e=t?this.width:this.height,i=St(this.options.ticks.minRotation),n=(t?Math.sin(i):Math.cos(i))||.001,o=this._resolveTickFontOptions(0);return Math.ceil(e/Math.min(40,o.lineHeight/n))}getPixelForValue(t){return t===null?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getValueForPixel(t){return this._startValue+this.getDecimalForPixel(t)*this._valueRange}}const Ue=s=>Math.floor(Wt(s)),ie=(s,t)=>Math.pow(10,Ue(s)+t);function Kn(s){return s/Math.pow(10,Ue(s))===1}function Xn(s,t,e){const i=Math.pow(10,e),n=Math.floor(s/i);return Math.ceil(t/i)-n}function Hu(s,t){const e=t-s;let i=Ue(e);for(;Xn(s,t,i)>10;)i++;for(;Xn(s,t,i)<10;)i--;return Math.min(i,Ue(s))}function Uu(s,{min:t,max:e}){t=_t(s.min,t);const i=[],n=Ue(t);let o=Hu(t,e),a=o<0?Math.pow(10,Math.abs(o)):1;const r=Math.pow(10,o),l=n>o?Math.pow(10,n):0,c=Math.round((t-l)*a)/a,d=Math.floor((t-l)/r/10)*r*10;let u=Math.floor((c-d)/Math.pow(10,o)),f=_t(s.min,Math.round((l+d+u*Math.pow(10,o))*a)/a);for(;f=10?u=u<15?15:20:u++,u>=20&&(o++,u=2,a=o>=0?1:a),f=Math.round((l+d+u*Math.pow(10,o))*a)/a;const g=_t(s.max,f);return i.push({value:g,major:Kn(g),significand:u}),i}class Yu extends he{static id="logarithmic";static defaults={ticks:{callback:Ps.formatters.logarithmic,major:{enabled:!0}}};constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._valueRange=0}parse(t,e){const i=ws.prototype.parse.apply(this,[t,e]);if(i===0){this._zero=!0;return}return Q(i)&&i>0?i:null}determineDataLimits(){const{min:t,max:e}=this.getMinMax(!0);this.min=Q(t)?Math.max(0,t):null,this.max=Q(e)?Math.max(0,e):null,this.options.beginAtZero&&(this._zero=!0),this._zero&&this.min!==this._suggestedMin&&!Q(this._userMin)&&(this.min=t===ie(this.min,0)?ie(this.min,-1):ie(this.min,0)),this.handleTickRangeOptions()}handleTickRangeOptions(){const{minDefined:t,maxDefined:e}=this.getUserBounds();let i=this.min,n=this.max;const o=r=>i=t?i:r,a=r=>n=e?n:r;i===n&&(i<=0?(o(1),a(10)):(o(ie(i,-1)),a(ie(n,1)))),i<=0&&o(ie(n,-1)),n<=0&&a(ie(i,1)),this.min=i,this.max=n}buildTicks(){const t=this.options,e={min:this._userMin,max:this._userMax},i=Uu(e,this);return t.bounds==="ticks"&&wo(i,this,"value"),t.reverse?(i.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),i}getLabelForValue(t){return t===void 0?"0":Ke(t,this.chart.options.locale,this.options.ticks.format)}configure(){const t=this.min;super.configure(),this._startValue=Wt(t),this._valueRange=Wt(this.max)-Wt(t)}getPixelForValue(t){return(t===void 0||t===0)&&(t=this.min),t===null||isNaN(t)?NaN:this.getPixelForDecimal(t===this.min?0:(Wt(t)-this._startValue)/this._valueRange)}getValueForPixel(t){const e=this.getDecimalForPixel(t);return Math.pow(10,this._startValue+e*this._valueRange)}}function oi(s){const t=s.ticks;if(t.display&&s.display){const e=ft(t.backdropPadding);return I(t.font&&t.font.size,Z.font.size)+e.height}return 0}function Ju(s,t,e){return e=q(e)?e:[e],{w:tc(s,t.string,e),h:e.length*t.lineHeight}}function Gn(s,t,e,i,n){return s===i||s===n?{start:t-e/2,end:t+e/2}:sn?{start:t-e,end:t}:{start:t,end:t+e}}function Ku(s){const t={l:s.left+s._padding.left,r:s.right-s._padding.right,t:s.top+s._padding.top,b:s.bottom-s._padding.bottom},e=Object.assign({},t),i=[],n=[],o=s._pointLabels.length,a=s.options.pointLabels,r=a.centerPointLabels?G/o:0;for(let l=0;lt.r&&(r=(i.end-t.r)/o,s.r=Math.max(s.r,t.r+r)),n.startt.b&&(l=(n.end-t.b)/a,s.b=Math.max(s.b,t.b+l))}function Gu(s,t,e){const i=s.drawingArea,{extra:n,additionalAngle:o,padding:a,size:r}=e,l=s.getPointPosition(t,i+n+a,o),c=Math.round(xi(xt(l.angle+et))),d=ef(l.y,r.h,c),u=Zu(c),f=tf(l.x,r.w,u);return{visible:!0,x:l.x,y:d,textAlign:u,left:f,top:d,right:f+r.w,bottom:d+r.h}}function qu(s,t){if(!t)return!0;const{left:e,top:i,right:n,bottom:o}=s;return!(zt({x:e,y:i},t)||zt({x:e,y:o},t)||zt({x:n,y:i},t)||zt({x:n,y:o},t))}function Qu(s,t,e){const i=[],n=s._pointLabels.length,o=s.options,{centerPointLabels:a,display:r}=o.pointLabels,l={extra:oi(o)/2,additionalAngle:a?G/n:0};let c;for(let d=0;d270||e<90)&&(s-=t),s}function sf(s,t,e){const{left:i,top:n,right:o,bottom:a}=e,{backdropColor:r}=t;if(!N(r)){const l=re(t.borderRadius),c=ft(t.backdropPadding);s.fillStyle=r;const d=i-c.left,u=n-c.top,f=o-i+c.width,g=a-n+c.height;Object.values(l).some(p=>p!==0)?(s.beginPath(),We(s,{x:d,y:u,w:f,h:g,radius:l}),s.fill()):s.fillRect(d,u,f,g)}}function nf(s,t){const{ctx:e,options:{pointLabels:i}}=s;for(let n=t-1;n>=0;n--){const o=s._pointLabelItems[n];if(!o.visible)continue;const a=i.setContext(s.getPointLabelContext(n));sf(e,a,o);const r=ot(a.font),{x:l,y:c,textAlign:d}=o;de(e,s._pointLabels[n],l,c+r.lineHeight/2,r,{color:a.color,textAlign:d,textBaseline:"middle"})}}function ga(s,t,e,i){const{ctx:n}=s;if(e)n.arc(s.xCenter,s.yCenter,t,0,X);else{let o=s.getPointPosition(0,t);n.moveTo(o.x,o.y);for(let a=1;a{const n=Y(this.options.pointLabels.callback,[e,i],this);return n||n===0?n:""}).filter((e,i)=>this.chart.getDataVisibility(i))}fit(){const t=this.options;t.display&&t.pointLabels.display?Ku(this):this.setCenterPoint(0,0,0,0)}setCenterPoint(t,e,i,n){this.xCenter+=Math.floor((t-e)/2),this.yCenter+=Math.floor((i-n)/2),this.drawingArea-=Math.min(this.drawingArea/2,Math.max(t,e,i,n))}getIndexAngle(t){const e=X/(this._pointLabels.length||1),i=this.options.startAngle||0;return xt(t*e+St(i))}getDistanceFromCenterForValue(t){if(N(t))return NaN;const e=this.drawingArea/(this.max-this.min);return this.options.reverse?(this.max-t)*e:(t-this.min)*e}getValueForDistanceFromCenter(t){if(N(t))return NaN;const e=t/(this.drawingArea/(this.max-this.min));return this.options.reverse?this.max-e:this.min+e}getPointLabelContext(t){const e=this._pointLabels||[];if(t>=0&&t{if(u!==0||u===0&&this.min<0){l=this.getDistanceFromCenterForValue(d.value);const f=this.getContext(u),g=n.setContext(f),p=o.setContext(f);of(this,g,l,a,p)}}),i.display){for(t.save(),r=a-1;r>=0;r--){const d=i.setContext(this.getPointLabelContext(r)),{color:u,lineWidth:f}=d;!f||!u||(t.lineWidth=f,t.strokeStyle=u,t.setLineDash(d.borderDash),t.lineDashOffset=d.borderDashOffset,l=this.getDistanceFromCenterForValue(e.reverse?this.min:this.max),c=this.getPointPosition(r,l),t.beginPath(),t.moveTo(this.xCenter,this.yCenter),t.lineTo(c.x,c.y),t.stroke())}t.restore()}}drawBorder(){}drawLabels(){const t=this.ctx,e=this.options,i=e.ticks;if(!i.display)return;const n=this.getIndexAngle(0);let o,a;t.save(),t.translate(this.xCenter,this.yCenter),t.rotate(n),t.textAlign="center",t.textBaseline="middle",this.ticks.forEach((r,l)=>{if(l===0&&this.min>=0&&!e.reverse)return;const c=i.setContext(this.getContext(l)),d=ot(c.font);if(o=this.getDistanceFromCenterForValue(this.ticks[l].value),c.showLabelBackdrop){t.font=d.string,a=t.measureText(r.label).width,t.fillStyle=c.backdropColor;const u=ft(c.backdropPadding);t.fillRect(-a/2-u.left,-o-d.size/2-u.top,a+u.width,d.size+u.height)}de(t,r.label,0,-o,d,{color:c.color,strokeColor:c.textStrokeColor,strokeWidth:c.textStrokeWidth})}),t.restore()}drawTitle(){}}const Ls={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}},bt=Object.keys(Ls);function qn(s,t){return s-t}function Qn(s,t){if(N(t))return null;const e=s._adapter,{parser:i,round:n,isoWeekday:o}=s._parseOpts;let a=t;return typeof i=="function"&&(a=i(a)),Q(a)||(a=typeof i=="string"?e.parse(a,i):e.parse(a)),a===null?null:(n&&(a=n==="week"&&(xe(o)||o===!0)?e.startOf(a,"isoWeek",o):e.startOf(a,n)),+a)}function Zn(s,t,e,i){const n=bt.length;for(let o=bt.indexOf(s);o=bt.indexOf(e);o--){const a=bt[o];if(Ls[a].common&&s._adapter.diff(n,i,a)>=t-1)return a}return bt[e?bt.indexOf(e):0]}function cf(s){for(let t=bt.indexOf(s)+1,e=bt.length;t=t?e[i]:e[n];s[o]=!0}}function df(s,t,e,i){const n=s._adapter,o=+n.startOf(t[0].value,i),a=t[t.length-1].value;let r,l;for(r=o;r<=a;r=+n.add(r,1,i))l=e[r],l>=0&&(t[l].major=!0);return t}function eo(s,t,e){const i=[],n={},o=t.length;let a,r;for(a=0;a+t.value))}initOffsets(t=[]){let e=0,i=0,n,o;this.options.offset&&t.length&&(n=this.getDecimalForValue(t[0]),t.length===1?e=1-n:e=(this.getDecimalForValue(t[1])-n)/2,o=this.getDecimalForValue(t[t.length-1]),t.length===1?i=o:i=(o-this.getDecimalForValue(t[t.length-2]))/2);const a=t.length<3?.5:.25;e=lt(e,0,a),i=lt(i,0,a),this._offsets={start:e,end:i,factor:1/(e+1+i)}}_generate(){const t=this._adapter,e=this.min,i=this.max,n=this.options,o=n.time,a=o.unit||Zn(o.minUnit,e,i,this._getLabelCapacity(e)),r=I(n.ticks.stepSize,1),l=a==="week"?o.isoWeekday:!1,c=xe(l)||l===!0,d={};let u=e,f,g;if(c&&(u=+t.startOf(u,"isoWeek",l)),u=+t.startOf(u,c?"day":a),t.diff(i,e,a)>1e5*r)throw new Error(e+" and "+i+" are too far apart with stepSize of "+r+" "+a);const p=n.ticks.source==="data"&&this.getDataTimestamps();for(f=u,g=0;f+m)}getLabelForValue(t){const e=this._adapter,i=this.options.time;return i.tooltipFormat?e.format(t,i.tooltipFormat):e.format(t,i.displayFormats.datetime)}format(t,e){const n=this.options.time.displayFormats,o=this._unit,a=e||n[o];return this._adapter.format(t,a)}_tickFormatFunction(t,e,i,n){const o=this.options,a=o.ticks.callback;if(a)return Y(a,[t,e,i],this);const r=o.time.displayFormats,l=this._unit,c=this._majorUnit,d=l&&r[l],u=c&&r[c],f=i[e],g=c&&u&&f&&f.major;return this._adapter.format(t,n||(g?u:d))}generateTickLabels(t){let e,i,n;for(e=0,i=t.length;e0?r:1}getDataTimestamps(){let t=this._cache.data||[],e,i;if(t.length)return t;const n=this.getMatchingVisibleMetas();if(this._normalized&&n.length)return this._cache.data=n[0].controller.getAllParsedValues(this);for(e=0,i=n.length;e=s[i].pos&&t<=s[n].pos&&({lo:i,hi:n}=Bt(s,"pos",t)),{pos:o,time:r}=s[i],{pos:a,time:l}=s[n]):(t>=s[i].time&&t<=s[n].time&&({lo:i,hi:n}=Bt(s,"time",t)),{time:o,pos:r}=s[i],{time:a,pos:l}=s[n]);const c=a-o;return c?r+(l-r)*(t-o)/c:r}class hf extends ai{static id="timeseries";static defaults=ai.defaults;constructor(t){super(t),this._table=[],this._minPos=void 0,this._tableRange=void 0}initOffsets(){const t=this._getTimestampsForTable(),e=this._table=this.buildLookupTable(t);this._minPos=cs(e,this.min),this._tableRange=cs(e,this.max)-this._minPos,super.initOffsets(t)}buildLookupTable(t){const{min:e,max:i}=this,n=[],o=[];let a,r,l,c,d;for(a=0,r=t.length;a=e&&c<=i&&n.push(c);if(n.length<2)return[{time:e,pos:0},{time:i,pos:1}];for(a=0,r=n.length;an-o)}_getTimestampsForTable(){let t=this._cache.all||[];if(t.length)return t;const e=this.getDataTimestamps(),i=this.getLabelTimestamps();return e.length&&i.length?t=this.normalize(e.concat(i)):t=e.length?e:i,t=this._cache.all=t,t}getDecimalForValue(t){return(cs(this._table,t)-this._minPos)/this._tableRange}getValueForPixel(t){const e=this._offsets,i=this.getDecimalForPixel(t)/e.factor-e.end;return cs(this._table,i*this._tableRange+this._minPos,!0)}}const pa={data:{type:Object,required:!0},options:{type:Object,default:()=>({})},plugins:{type:Array,default:()=>[]},datasetIdKey:{type:String,default:"label"},updateMode:{type:String,default:void 0}},uf={ariaLabel:{type:String},ariaDescribedby:{type:String}},ff={type:{type:String,required:!0},destroyDelay:{type:Number,default:0},...pa,...uf},gf=La[0]==="2"?(s,t)=>Object.assign(s,{attrs:t}):(s,t)=>Object.assign(s,t);function me(s){return co(s)?Ks(s):s}function pf(s){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:s;return co(t)?new Proxy(s,{}):s}function mf(s,t){const e=s.options;e&&t&&Object.assign(e,t)}function ma(s,t){s.labels=t}function ba(s,t,e){const i=[];s.datasets=t.map(n=>{const o=s.datasets.find(a=>a[e]===n[e]);return!o||!n.data||i.includes(o)?{...n}:(i.push(o),Object.assign(o,n),o)})}function bf(s,t){const e={labels:[],datasets:[]};return ma(e,s.labels),ba(e,s.datasets,t),e}const _f=ro({props:ff,setup(s,t){let{expose:e,slots:i}=t;const n=U(null),o=lo(null);e({chart:o});const a=()=>{if(!n.value)return;const{type:c,data:d,options:u,plugins:f,datasetIdKey:g}=s,p=bf(d,g),m=pf(p,d);o.value=new Os(n.value,{type:c,data:m,options:{...u},plugins:f})},r=()=>{const c=Ks(o.value);c&&(s.destroyDelay>0?setTimeout(()=>{c.destroy(),o.value=null},s.destroyDelay):(c.destroy(),o.value=null))},l=c=>{c.update(s.updateMode)};return fi(a),Ta(r),Ss([()=>s.options,()=>s.data],(c,d)=>{let[u,f]=c,[g,p]=d;const m=Ks(o.value);if(!m)return;let b=!1;if(u){const _=me(u),w=me(g);_&&_!==w&&(mf(m,_),b=!0)}if(f){const _=me(f.labels),w=me(p.labels),k=me(f.datasets),v=me(p.datasets);_!==w&&(ma(m.config.data,_),b=!0),k&&k!==v&&(ba(m.config.data,k,s.datasetIdKey),b=!0)}b&&Ra(()=>{l(m)})},{deep:!0}),()=>Js("canvas",{role:"img",ariaLabel:s.ariaLabel,ariaDescribedby:s.ariaDescribedby,ref:n},[Js("p",{},[i.default?i.default():""])])}});function _a(s,t){return Os.register(t),ro({props:pa,setup(e,i){let{expose:n}=i;const o=lo(null),a=r=>{o.value=r?.chart};return n({chart:o}),()=>Js(_f,gf({ref:a},{type:s,...e}))}})}const xf=_a("bar",Jo),yf=_a("line",Xo);function Nt(s){return Array.isArray?Array.isArray(s):va(s)==="[object Array]"}const vf=1/0;function wf(s){if(typeof s=="string")return s;let t=s+"";return t=="0"&&1/s==-vf?"-0":t}function kf(s){return s==null?"":wf(s)}function Ct(s){return typeof s=="string"}function xa(s){return typeof s=="number"}function Sf(s){return s===!0||s===!1||Mf(s)&&va(s)=="[object Boolean]"}function ya(s){return typeof s=="object"}function Mf(s){return ya(s)&&s!==null}function yt(s){return s!=null}function Ys(s){return!s.trim().length}function va(s){return s==null?s===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(s)}const Pf="Incorrect 'index' type",Cf=s=>`Invalid value for key ${s}`,Df=s=>`Pattern length exceeds max of ${s}.`,$f=s=>`Missing ${s} property in key`,Of=s=>`Property 'weight' in key '${s}' must be a positive integer`,so=Object.prototype.hasOwnProperty;class Af{constructor(t){this._keys=[],this._keyMap={};let e=0;t.forEach(i=>{let n=wa(i);this._keys.push(n),this._keyMap[n.id]=n,e+=n.weight}),this._keys.forEach(i=>{i.weight/=e})}get(t){return this._keyMap[t]}keys(){return this._keys}toJSON(){return JSON.stringify(this._keys)}}function wa(s){let t=null,e=null,i=null,n=1,o=null;if(Ct(s)||Nt(s))i=s,t=io(s),e=ri(s);else{if(!so.call(s,"name"))throw new Error($f("name"));const a=s.name;if(i=a,so.call(s,"weight")&&(n=s.weight,n<=0))throw new Error(Of(a));t=io(a),e=ri(a),o=s.getFn}return{path:t,id:e,weight:n,src:i,getFn:o}}function io(s){return Nt(s)?s:s.split(".")}function ri(s){return Nt(s)?s.join("."):s}function Lf(s,t){let e=[],i=!1;const n=(o,a,r)=>{if(yt(o))if(!a[r])e.push(o);else{let l=a[r];const c=o[l];if(!yt(c))return;if(r===a.length-1&&(Ct(c)||xa(c)||Sf(c)))e.push(kf(c));else if(Nt(c)){i=!0;for(let d=0,u=c.length;ds.score===t.score?s.idx{this._keysMap[e.id]=i})}create(){this.isCreated||!this.docs.length||(this.isCreated=!0,Ct(this.docs[0])?this.docs.forEach((t,e)=>{this._addString(t,e)}):this.docs.forEach((t,e)=>{this._addObject(t,e)}),this.norm.clear())}add(t){const e=this.size();Ct(t)?this._addString(t,e):this._addObject(t,e)}removeAt(t){this.records.splice(t,1);for(let e=t,i=this.size();e{let a=n.getFn?n.getFn(t):this.getFn(t,n.path);if(yt(a)){if(Nt(a)){let r=[];const l=[{nestedArrIndex:-1,value:a}];for(;l.length;){const{nestedArrIndex:c,value:d}=l.pop();if(yt(d))if(Ct(d)&&!Ys(d)){let u={v:d,i:c,n:this.norm.get(d)};r.push(u)}else Nt(d)&&d.forEach((u,f)=>{l.push({nestedArrIndex:f,value:u})})}i.$[o]=r}else if(Ct(a)&&!Ys(a)){let r={v:a,n:this.norm.get(a)};i.$[o]=r}}}),this.records.push(i)}toJSON(){return{keys:this.keys,records:this.records}}}function ka(s,t,{getFn:e=A.getFn,fieldNormWeight:i=A.fieldNormWeight}={}){const n=new Ai({getFn:e,fieldNormWeight:i});return n.setKeys(s.map(wa)),n.setSources(t),n.create(),n}function zf(s,{getFn:t=A.getFn,fieldNormWeight:e=A.fieldNormWeight}={}){const{keys:i,records:n}=s,o=new Ai({getFn:t,fieldNormWeight:e});return o.setKeys(i),o.setIndexRecords(n),o}function ds(s,{errors:t=0,currentLocation:e=0,expectedLocation:i=0,distance:n=A.distance,ignoreLocation:o=A.ignoreLocation}={}){const a=t/s.length;if(o)return a;const r=Math.abs(i-e);return n?a+r/n:r?1:a}function Nf(s=[],t=A.minMatchCharLength){let e=[],i=-1,n=-1,o=0;for(let a=s.length;o=t&&e.push([i,n]),i=-1)}return s[o-1]&&o-i>=t&&e.push([i,o-1]),e}const ae=32;function Vf(s,t,e,{location:i=A.location,distance:n=A.distance,threshold:o=A.threshold,findAllMatches:a=A.findAllMatches,minMatchCharLength:r=A.minMatchCharLength,includeMatches:l=A.includeMatches,ignoreLocation:c=A.ignoreLocation}={}){if(t.length>ae)throw new Error(Df(ae));const d=t.length,u=s.length,f=Math.max(0,Math.min(i,u));let g=o,p=f;const m=r>1||l,b=m?Array(u):[];let _;for(;(_=s.indexOf(t,p))>-1;){let P=ds(t,{currentLocation:_,expectedLocation:f,distance:n,ignoreLocation:c});if(g=Math.min(P,g),p=_+d,m){let D=0;for(;D=R;J-=1){let z=J-1,H=e[s.charAt(z)];if(m&&(b[z]=+!!H),E[J]=(E[J+1]<<1|1)&H,P&&(E[J]|=(w[J+1]|w[J])<<1|1|w[J+1]),E[J]&x&&(k=ds(t,{errors:P,currentLocation:z,expectedLocation:f,distance:n,ignoreLocation:c}),k<=g)){if(g=k,p=z,p<=f)break;R=Math.max(1,2*f-p)}}if(ds(t,{errors:P+1,currentLocation:f,expectedLocation:f,distance:n,ignoreLocation:c})>g)break;w=E}const M={isMatch:p>=0,score:Math.max(.001,k)};if(m){const P=Nf(b,r);P.length?l&&(M.indices=P):M.isMatch=!1}return M}function jf(s){let t={};for(let e=0,i=s.length;e{this.chunks.push({pattern:f,alphabet:jf(f),startIndex:g})},u=this.pattern.length;if(u>ae){let f=0;const g=u%ae,p=u-g;for(;f{const{isMatch:_,score:w,indices:k}=Vf(t,p,m,{location:n+b,distance:o,threshold:a,findAllMatches:r,minMatchCharLength:l,includeMatches:i,ignoreLocation:c});_&&(f=!0),u+=w,_&&k&&(d=[...d,...k])});let g={isMatch:f,score:f?u/this.chunks.length:1};return f&&i&&(g.indices=d),g}}class qt{constructor(t){this.pattern=t}static isMultiMatch(t){return no(t,this.multiRegex)}static isSingleMatch(t){return no(t,this.singleRegex)}search(){}}function no(s,t){const e=s.match(t);return e?e[1]:null}class Wf extends qt{constructor(t){super(t)}static get type(){return"exact"}static get multiRegex(){return/^="(.*)"$/}static get singleRegex(){return/^=(.*)$/}search(t){const e=t===this.pattern;return{isMatch:e,score:e?0:1,indices:[0,this.pattern.length-1]}}}class Hf extends qt{constructor(t){super(t)}static get type(){return"inverse-exact"}static get multiRegex(){return/^!"(.*)"$/}static get singleRegex(){return/^!(.*)$/}search(t){const i=t.indexOf(this.pattern)===-1;return{isMatch:i,score:i?0:1,indices:[0,t.length-1]}}}class Uf extends qt{constructor(t){super(t)}static get type(){return"prefix-exact"}static get multiRegex(){return/^\^"(.*)"$/}static get singleRegex(){return/^\^(.*)$/}search(t){const e=t.startsWith(this.pattern);return{isMatch:e,score:e?0:1,indices:[0,this.pattern.length-1]}}}class Yf extends qt{constructor(t){super(t)}static get type(){return"inverse-prefix-exact"}static get multiRegex(){return/^!\^"(.*)"$/}static get singleRegex(){return/^!\^(.*)$/}search(t){const e=!t.startsWith(this.pattern);return{isMatch:e,score:e?0:1,indices:[0,t.length-1]}}}class Jf extends qt{constructor(t){super(t)}static get type(){return"suffix-exact"}static get multiRegex(){return/^"(.*)"\$$/}static get singleRegex(){return/^(.*)\$$/}search(t){const e=t.endsWith(this.pattern);return{isMatch:e,score:e?0:1,indices:[t.length-this.pattern.length,t.length-1]}}}class Kf extends qt{constructor(t){super(t)}static get type(){return"inverse-suffix-exact"}static get multiRegex(){return/^!"(.*)"\$$/}static get singleRegex(){return/^!(.*)\$$/}search(t){const e=!t.endsWith(this.pattern);return{isMatch:e,score:e?0:1,indices:[0,t.length-1]}}}class Ma extends qt{constructor(t,{location:e=A.location,threshold:i=A.threshold,distance:n=A.distance,includeMatches:o=A.includeMatches,findAllMatches:a=A.findAllMatches,minMatchCharLength:r=A.minMatchCharLength,isCaseSensitive:l=A.isCaseSensitive,ignoreLocation:c=A.ignoreLocation}={}){super(t),this._bitapSearch=new Sa(t,{location:e,threshold:i,distance:n,includeMatches:o,findAllMatches:a,minMatchCharLength:r,isCaseSensitive:l,ignoreLocation:c})}static get type(){return"fuzzy"}static get multiRegex(){return/^"(.*)"$/}static get singleRegex(){return/^(.*)$/}search(t){return this._bitapSearch.searchIn(t)}}class Pa extends qt{constructor(t){super(t)}static get type(){return"include"}static get multiRegex(){return/^'"(.*)"$/}static get singleRegex(){return/^'(.*)$/}search(t){let e=0,i;const n=[],o=this.pattern.length;for(;(i=t.indexOf(this.pattern,e))>-1;)e=i+o,n.push([i,e-1]);const a=!!n.length;return{isMatch:a,score:a?0:1,indices:n}}}const li=[Wf,Pa,Uf,Yf,Kf,Jf,Hf,Ma],oo=li.length,Xf=/ +(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/,Gf="|";function qf(s,t={}){return s.split(Gf).map(e=>{let i=e.trim().split(Xf).filter(o=>o&&!!o.trim()),n=[];for(let o=0,a=i.length;o!!(s[ks.AND]||s[ks.OR]),eg=s=>!!s[hi.PATH],sg=s=>!Nt(s)&&ya(s)&&!ui(s),ao=s=>({[ks.AND]:Object.keys(s).map(t=>({[t]:s[t]}))});function Ca(s,t,{auto:e=!0}={}){const i=n=>{let o=Object.keys(n);const a=eg(n);if(!a&&o.length>1&&!ui(n))return i(ao(n));if(sg(n)){const l=a?n[hi.PATH]:o[0],c=a?n[hi.PATTERN]:n[l];if(!Ct(c))throw new Error(Cf(l));const d={keyId:ri(l),pattern:c};return e&&(d.searcher=di(c,t)),d}let r={children:[],operator:o[0]};return o.forEach(l=>{const c=n[l];Nt(c)&&c.forEach(d=>{r.children.push(i(d))})}),r};return ui(s)||(s=ao(s)),i(s)}function ig(s,{ignoreFieldNorm:t=A.ignoreFieldNorm}){s.forEach(e=>{let i=1;e.matches.forEach(({key:n,norm:o,score:a})=>{const r=n?n.weight:null;i*=Math.pow(a===0&&r?Number.EPSILON:a,(r||1)*(t?1:o))}),e.score=i})}function ng(s,t){const e=s.matches;t.matches=[],yt(e)&&e.forEach(i=>{if(!yt(i.indices)||!i.indices.length)return;const{indices:n,value:o}=i;let a={indices:n,value:o};i.key&&(a.key=i.key.src),i.idx>-1&&(a.refIndex=i.idx),t.matches.push(a)})}function og(s,t){t.score=s.score}function ag(s,t,{includeMatches:e=A.includeMatches,includeScore:i=A.includeScore}={}){const n=[];return e&&n.push(ng),i&&n.push(og),s.map(o=>{const{idx:a}=o,r={item:t[a],refIndex:a};return n.length&&n.forEach(l=>{l(o,r)}),r})}class we{constructor(t,e={},i){this.options={...A,...e},this.options.useExtendedSearch,this._keyStore=new Af(this.options.keys),this.setCollection(t,i)}setCollection(t,e){if(this._docs=t,e&&!(e instanceof Ai))throw new Error(Pf);this._myIndex=e||ka(this.options.keys,this._docs,{getFn:this.options.getFn,fieldNormWeight:this.options.fieldNormWeight})}add(t){yt(t)&&(this._docs.push(t),this._myIndex.add(t))}remove(t=()=>!1){const e=[];for(let i=0,n=this._docs.length;i-1&&(l=l.slice(0,e)),ag(l,this._docs,{includeMatches:i,includeScore:n})}_searchStringList(t){const e=di(t,this.options),{records:i}=this._myIndex,n=[];return i.forEach(({v:o,i:a,n:r})=>{if(!yt(o))return;const{isMatch:l,score:c,indices:d}=e.searchIn(o);l&&n.push({item:o,idx:a,matches:[{score:c,value:o,norm:r,indices:d}]})}),n}_searchLogical(t){const e=Ca(t,this.options),i=(r,l,c)=>{if(!r.children){const{keyId:u,searcher:f}=r,g=this._findMatches({key:this._keyStore.get(u),value:this._myIndex.getValueForItemAtKeyId(l,u),searcher:f});return g&&g.length?[{idx:c,item:l,matches:g}]:[]}const d=[];for(let u=0,f=r.children.length;u{if(yt(r)){let c=i(e,r,l);c.length&&(o[l]||(o[l]={idx:l,item:r,matches:[]},a.push(o[l])),c.forEach(({matches:d})=>{o[l].matches.push(...d)}))}}),a}_searchObjectList(t){const e=di(t,this.options),{keys:i,records:n}=this._myIndex,o=[];return n.forEach(({$:a,i:r})=>{if(!yt(a))return;let l=[];i.forEach((c,d)=>{l.push(...this._findMatches({key:c,value:a[d],searcher:e}))}),l.length&&o.push({idx:r,item:a,matches:l})}),o}_findMatches({key:t,value:e,searcher:i}){if(!yt(e))return[];let n=[];if(Nt(e))e.forEach(({v:o,i:a,n:r})=>{if(!yt(o))return;const{isMatch:l,score:c,indices:d}=i.searchIn(o);l&&n.push({score:c,key:t,value:o,idx:a,norm:r,indices:d})});else{const{v:o,n:a}=e,{isMatch:r,score:l,indices:c}=i.searchIn(o);r&&n.push({score:l,key:t,value:o,norm:a,indices:c})}return n}}we.version="7.0.0";we.createIndex=ka;we.parseIndex=zf;we.config=A;we.parseQuery=Ca;tg(Zf);const rg={name:"peerSettings",components:{LocaleText:O},props:{selectedPeer:Object},data(){return{data:void 0,dataChanged:!1,showKey:!1,saving:!1}},setup(){return{dashboardConfigurationStore:At()}},methods:{reset(){this.selectedPeer&&(this.data=JSON.parse(JSON.stringify(this.selectedPeer)),this.dataChanged=!1)},savePeer(){this.saving=!0,ut(`/api/updatePeerSettings/${this.$route.params.id}`,this.data,s=>{this.saving=!1,s.status?this.dashboardConfigurationStore.newMessage("Server","Peer saved","success"):this.dashboardConfigurationStore.newMessage("Server",s.message,"danger"),this.$emit("refresh")})},resetPeerData(s){this.saving=!0,ut(`/api/resetPeerData/${this.$route.params.id}`,{id:this.data.id,type:s},t=>{this.saving=!1,t.status?this.dashboardConfigurationStore.newMessage("Server","Peer data usage reset successfully","success"):this.dashboardConfigurationStore.newMessage("Server",t.message,"danger"),this.$emit("refresh")})}},beforeMount(){this.reset()},mounted(){this.$el.querySelectorAll("input").forEach(s=>{s.addEventListener("keyup",()=>{this.dataChanged=!0})})}},lg={class:"peerSettingContainer w-100 h-100 position-absolute top-0 start-0 overflow-y-scroll"},cg={class:"container d-flex h-100 w-100"},dg={class:"m-auto modal-dialog-centered dashboardModal"},hg={class:"card rounded-3 shadow flex-grow-1"},ug={class:"card-header bg-transparent d-flex align-items-center gap-2 border-0 p-4 pb-2"},fg={class:"mb-0"},gg={key:0,class:"card-body px-4 pb-4"},pg={class:"d-flex flex-column gap-2 mb-4"},mg={class:"d-flex align-items-center"},bg={class:"text-muted"},_g={class:"ms-auto"},xg={for:"peer_name_textbox",class:"form-label"},yg={class:"text-muted"},vg=["disabled"],wg={class:"d-flex position-relative"},kg={for:"peer_private_key_textbox",class:"form-label"},Sg={class:"text-muted"},Mg=["type","disabled"],Pg={for:"peer_allowed_ip_textbox",class:"form-label"},Cg={class:"text-muted"},Dg=["disabled"],$g={for:"peer_endpoint_allowed_ips",class:"form-label"},Og={class:"text-muted"},Ag=["disabled"],Lg={for:"peer_DNS_textbox",class:"form-label"},Tg={class:"text-muted"},Rg=["disabled"],Ig={class:"accordion mt-3",id:"peerSettingsAccordion"},Eg={class:"accordion-item"},Fg={class:"accordion-header"},Bg={class:"accordion-button rounded-3 collapsed",type:"button","data-bs-toggle":"collapse","data-bs-target":"#peerSettingsAccordionOptional"},zg={id:"peerSettingsAccordionOptional",class:"accordion-collapse collapse","data-bs-parent":"#peerSettingsAccordion"},Ng={class:"accordion-body d-flex flex-column gap-2 mb-2"},Vg={for:"peer_preshared_key_textbox",class:"form-label"},jg={class:"text-muted"},Wg=["disabled"],Hg={for:"peer_mtu",class:"form-label"},Ug={class:"text-muted"},Yg=["disabled"],Jg={for:"peer_keep_alive",class:"form-label"},Kg={class:"text-muted"},Xg=["disabled"],Gg={class:"d-flex gap-2 align-items-center"},qg={class:"d-flex gap-2 ms-auto"},Qg={class:"d-flex align-items-center gap-2"},Zg=["disabled"],tp=["disabled"];function ep(s,t,e,i,n,o){const a=V("LocaleText");return S(),C("div",lg,[h("div",cg,[h("div",dg,[h("div",hg,[h("div",ug,[h("h4",fg,[y(a,{t:"Peer Settings"})]),h("button",{type:"button",class:"btn-close ms-auto",onClick:t[0]||(t[0]=r=>this.$emit("close"))})]),this.data?(S(),C("div",gg,[h("div",pg,[h("div",mg,[h("small",bg,[y(a,{t:"Public Key"})]),h("small",_g,[h("samp",null,F(this.data.id),1)])]),h("div",null,[h("label",xg,[h("small",yg,[y(a,{t:"Name"})])]),K(h("input",{type:"text",class:"form-control form-control-sm rounded-3",disabled:this.saving,"onUpdate:modelValue":t[1]||(t[1]=r=>this.data.name=r),id:"peer_name_textbox",placeholder:""},null,8,vg),[[rt,this.data.name]])]),h("div",null,[h("div",wg,[h("label",kg,[h("small",Sg,[y(a,{t:"Private Key"}),h("code",null,[y(a,{t:"(Required for QR Code and Download)"})])])]),h("a",{role:"button",class:"ms-auto text-decoration-none toggleShowKey",onClick:t[2]||(t[2]=r=>this.showKey=!this.showKey)},[h("i",{class:it(["bi",[this.showKey?"bi-eye-slash-fill":"bi-eye-fill"]])},null,2)])]),K(h("input",{type:[this.showKey?"text":"password"],class:"form-control form-control-sm rounded-3",disabled:this.saving,"onUpdate:modelValue":t[3]||(t[3]=r=>this.data.private_key=r),id:"peer_private_key_textbox",style:{"padding-right":"40px"}},null,8,Mg),[[Ia,this.data.private_key]])]),h("div",null,[h("label",Pg,[h("small",Cg,[y(a,{t:"Allowed IPs"}),h("code",null,[y(a,{t:"(Required)"})])])]),K(h("input",{type:"text",class:"form-control form-control-sm rounded-3",disabled:this.saving,"onUpdate:modelValue":t[4]||(t[4]=r=>this.data.allowed_ip=r),id:"peer_allowed_ip_textbox"},null,8,Dg),[[rt,this.data.allowed_ip]])]),h("div",null,[h("label",$g,[h("small",Og,[y(a,{t:"Endpoint Allowed IPs"}),h("code",null,[y(a,{t:"(Required)"})])])]),K(h("input",{type:"text",class:"form-control form-control-sm rounded-3",disabled:this.saving,"onUpdate:modelValue":t[5]||(t[5]=r=>this.data.endpoint_allowed_ip=r),id:"peer_endpoint_allowed_ips"},null,8,Ag),[[rt,this.data.endpoint_allowed_ip]])]),h("div",null,[h("label",Lg,[h("small",Tg,[y(a,{t:"DNS"})])]),K(h("input",{type:"text",class:"form-control form-control-sm rounded-3",disabled:this.saving,"onUpdate:modelValue":t[6]||(t[6]=r=>this.data.DNS=r),id:"peer_DNS_textbox"},null,8,Rg),[[rt,this.data.DNS]])]),h("div",Ig,[h("div",Eg,[h("h2",Fg,[h("button",Bg,[y(a,{t:"Optional Settings"})])]),h("div",zg,[h("div",Ng,[h("div",null,[h("label",Vg,[h("small",jg,[y(a,{t:"Pre-Shared Key"})])]),K(h("input",{type:"text",class:"form-control form-control-sm rounded-3",disabled:this.saving,"onUpdate:modelValue":t[7]||(t[7]=r=>this.data.preshared_key=r),id:"peer_preshared_key_textbox"},null,8,Wg),[[rt,this.data.preshared_key]])]),h("div",null,[h("label",Hg,[h("small",Ug,[y(a,{t:"MTU"})])]),K(h("input",{type:"number",class:"form-control form-control-sm rounded-3",disabled:this.saving,"onUpdate:modelValue":t[8]||(t[8]=r=>this.data.mtu=r),id:"peer_mtu"},null,8,Yg),[[rt,this.data.mtu]])]),h("div",null,[h("label",Jg,[h("small",Kg,[y(a,{t:"Persistent Keepalive"})])]),K(h("input",{type:"number",class:"form-control form-control-sm rounded-3",disabled:this.saving,"onUpdate:modelValue":t[9]||(t[9]=r=>this.data.keepalive=r),id:"peer_keep_alive"},null,8,Xg),[[rt,this.data.keepalive]])])])])])]),t[18]||(t[18]=h("hr",null,null,-1)),h("div",Gg,[h("strong",null,[y(a,{t:"Reset Data Usage"})]),h("div",qg,[h("button",{class:"btn bg-primary-subtle text-primary-emphasis rounded-3 flex-grow-1 shadow-sm",onClick:t[10]||(t[10]=r=>this.resetPeerData("total"))},[t[15]||(t[15]=h("i",{class:"bi bi-arrow-down-up me-2"},null,-1)),y(a,{t:"Total"})]),h("button",{class:"btn bg-primary-subtle text-primary-emphasis rounded-3 flex-grow-1 shadow-sm",onClick:t[11]||(t[11]=r=>this.resetPeerData("receive"))},[t[16]||(t[16]=h("i",{class:"bi bi-arrow-down me-2"},null,-1)),y(a,{t:"Received"})]),h("button",{class:"btn bg-primary-subtle text-primary-emphasis rounded-3 flex-grow-1 shadow-sm",onClick:t[12]||(t[12]=r=>this.resetPeerData("sent"))},[t[17]||(t[17]=h("i",{class:"bi bi-arrow-up me-2"},null,-1)),y(a,{t:"Sent"})])])])]),h("div",Qg,[h("button",{class:"btn bg-secondary-subtle border-secondary-subtle text-secondary-emphasis rounded-3 shadow ms-auto px-3 py-2",onClick:t[13]||(t[13]=r=>this.reset()),disabled:!this.dataChanged||this.saving},t[19]||(t[19]=[h("i",{class:"bi bi-arrow-clockwise"},null,-1)]),8,Zg),h("button",{class:"btn bg-primary-subtle border-primary-subtle text-primary-emphasis rounded-3 px-3 py-2 shadow",disabled:!this.dataChanged||this.saving,onClick:t[14]||(t[14]=r=>this.savePeer())},t[20]||(t[20]=[h("i",{class:"bi bi-save-fill"},null,-1)]),8,tp)])])):T("",!0)])])])])}const sp=pt(rg,[["render",ep],["__scopeId","data-v-a63ae8cb"]]),ip={name:"peerQRCode",components:{LocaleText:O},props:{peerConfigData:String},mounted(){Ba.toCanvas(document.querySelector("#qrcode"),this.peerConfigData,s=>{s&&console.error(s)})}},np={class:"peerSettingContainer w-100 h-100 position-absolute top-0 start-0"},op={class:"container d-flex h-100 w-100"},ap={class:"m-auto modal-dialog-centered dashboardModal justify-content-center"},rp={class:"card rounded-3 shadow"},lp={class:"card-header bg-transparent d-flex align-items-center gap-2 border-0 p-4 pb-0"},cp={class:"mb-0"},dp={class:"card-body"},hp={id:"qrcode",class:"rounded-3 shadow",ref:"qrcode"};function up(s,t,e,i,n,o){const a=V("LocaleText");return S(),C("div",np,[h("div",op,[h("div",ap,[h("div",rp,[h("div",lp,[h("h4",cp,[y(a,{t:"QR Code"})]),h("button",{type:"button",class:"btn-close ms-auto",onClick:t[0]||(t[0]=r=>this.$emit("close"))})]),h("div",dp,[h("canvas",hp,null,512)])])])])])}const fp=pt(ip,[["render",up]]),gp={name:"scheduleDropdown",props:{options:Array,data:String,edit:!1},setup(s){s.data===void 0&&this.$emit("update",this.options[0].value)},computed:{currentSelection(){return this.options.find(s=>s.value===this.data)}}},pp={class:"dropdown scheduleDropdown"},mp={class:"dropdown-menu rounded-3 shadow",style:{"font-size":"0.875rem",width:"200px"}},bp=["onClick"],_p={key:0,class:"bi bi-check ms-auto"};function xp(s,t,e,i,n,o){return S(),C("div",pp,[h("button",{class:it(["btn btn-sm btn-outline-primary rounded-3",{"disabled border-transparent":!e.edit}]),type:"button","data-bs-toggle":"dropdown","aria-expanded":"false"},[h("samp",null,F(this.currentSelection.display),1)],2),h("ul",mp,[e.edit?(S(!0),C(ct,{key:0},Ot(this.options,a=>(S(),C("li",null,[h("a",{class:"dropdown-item d-flex align-items-center",role:"button",onClick:r=>s.$emit("update",a.value)},[h("samp",null,F(a.display),1),a.value===this.currentSelection.value?(S(),C("i",_p)):T("",!0)],8,bp)]))),256)):T("",!0)])])}const Da=pt(gp,[["render",xp],["__scopeId","data-v-6a5aba2a"]]),yp={name:"schedulePeerJob",components:{LocaleText:O,VueDatePicker:fo,ScheduleDropdown:Da},props:{dropdowns:Array[Object],pjob:Object,viewOnly:!1},setup(s){const t=U({}),e=U(!1),i=U(!1);t.value=JSON.parse(JSON.stringify(s.pjob)),t.value.CreationDate||(e.value=!0,i.value=!0);const n=At();return{job:t,edit:e,newJob:i,store:n}},data(){return{inputType:void 0}},watch:{pjob:{deep:!0,immediate:!0,handler(s){this.edit||(this.job=JSON.parse(JSON.stringify(s)))}}},methods:{save(){this.job.Field&&this.job.Operator&&this.job.Action&&this.job.Value?ut("/api/savePeerScheduleJob/",{Job:this.job},s=>{s.status?(this.edit=!1,this.store.newMessage("Server","Peer job saved","success"),console.log(s.data),this.$emit("refresh",s.data[0]),this.newJob=!1):this.store.newMessage("Server",s.message,"danger")}):this.alert()},alert(){let s="animate__flash",t=this.$el.querySelectorAll(".scheduleDropdown"),e=this.$el.querySelectorAll("input");t.forEach(i=>i.classList.add("animate__animated",s)),e.forEach(i=>i.classList.add("animate__animated",s)),setTimeout(()=>{t.forEach(i=>i.classList.remove("animate__animated",s)),e.forEach(i=>i.classList.remove("animate__animated",s))},2e3)},reset(){this.job.CreationDate?(this.job=JSON.parse(JSON.stringify(this.pjob)),this.edit=!1):this.$emit("delete")},delete(){this.job.CreationDate&&ut("/api/deletePeerScheduleJob/",{Job:this.job},s=>{s.status?this.store.newMessage("Server","Peer job deleted","success"):(this.store.newMessage("Server",s.message,"danger"),this.$emit("delete"))}),this.$emit("delete")},parseTime(s){s&&(this.job.Value=Ut(s).format("YYYY-MM-DD HH:mm:ss"))}}},vp={class:"card-header bg-transparent text-muted border-0"},wp={key:0,class:"d-flex"},kp={class:"me-auto"},Sp={key:1},Mp={class:"badge text-bg-warning"},Pp={class:"card-body pt-1",style:{"font-family":"var(--bs-font-monospace)"}},Cp={class:"d-flex gap-2 align-items-center mb-2"},Dp=["disabled"],$p={class:"px-5 d-flex gap-2 align-items-center"},Op={class:"d-flex gap-3"},Ap={key:0,class:"ms-auto d-flex gap-3"},Lp={key:1,class:"ms-auto d-flex gap-3"};function Tp(s,t,e,i,n,o){const a=V("LocaleText"),r=V("ScheduleDropdown"),l=V("VueDatePicker");return S(),C("div",{class:it(["card shadow-sm rounded-3 mb-2",{"border-warning-subtle":this.newJob}])},[h("div",vp,[this.newJob?(S(),C("small",Sp,[h("span",Mp,[y(a,{t:"Unsaved Job"})])])):(S(),C("small",wp,[h("strong",kp,[y(a,{t:"Job ID"})]),h("samp",null,F(this.job.JobID),1)]))]),h("div",Pp,[h("div",Cp,[h("samp",null,[y(a,{t:"if"})]),y(r,{edit:i.edit,options:this.dropdowns.Field,data:this.job.Field,onUpdate:t[0]||(t[0]=c=>{this.job.Field=c})},null,8,["edit","options","data"]),h("samp",null,[y(a,{t:"is"})]),y(r,{edit:i.edit,options:this.dropdowns.Operator,data:this.job.Operator,onUpdate:t[1]||(t[1]=c=>this.job.Operator=c)},null,8,["edit","options","data"]),this.job.Field==="date"?(S(),j(l,{key:0,is24:!0,"min-date":new Date,"model-value":this.job.Value,"onUpdate:modelValue":this.parseTime,"time-picker-inline":"",format:"yyyy-MM-dd HH:mm:ss","preview-format":"yyyy-MM-dd HH:mm:ss",clearable:!1,disabled:!i.edit,dark:this.store.Configuration.Server.dashboard_theme==="dark"},null,8,["min-date","model-value","onUpdate:modelValue","disabled","dark"])):K((S(),C("input",{key:1,class:"form-control form-control-sm form-control-dark rounded-3 flex-grow-1",disabled:!i.edit,"onUpdate:modelValue":t[2]||(t[2]=c=>this.job.Value=c),style:{width:"auto"}},null,8,Dp)),[[rt,this.job.Value]]),h("samp",null,F(this.dropdowns.Field.find(c=>c.value===this.job.Field)?.unit)+" { ",1)]),h("div",$p,[h("samp",null,[y(a,{t:"then"})]),y(r,{edit:i.edit,options:this.dropdowns.Action,data:this.job.Action,onUpdate:t[3]||(t[3]=c=>this.job.Action=c)},null,8,["edit","options","data"])]),h("div",Op,[t[12]||(t[12]=h("samp",null,"}",-1)),this.edit?(S(),C("div",Lp,[h("a",{role:"button",class:"text-secondary text-decoration-none",onClick:t[6]||(t[6]=c=>this.reset())},[t[10]||(t[10]=st("[C] ")),y(a,{t:"Cancel"})]),h("a",{role:"button",class:"text-primary ms-auto text-decoration-none",onClick:t[7]||(t[7]=c=>this.save())},[t[11]||(t[11]=st("[S] ")),y(a,{t:"Save"})])])):(S(),C("div",Ap,[h("a",{role:"button",class:"ms-auto text-decoration-none",onClick:t[4]||(t[4]=c=>this.edit=!0)},[t[8]||(t[8]=st("[E] ")),y(a,{t:"Edit"})]),h("a",{role:"button",onClick:t[5]||(t[5]=c=>this.delete()),class:"text-danger text-decoration-none"},[t[9]||(t[9]=st("[D] ")),y(a,{t:"Delete"})])]))])])],2)}const $a=pt(yp,[["render",Tp],["__scopeId","data-v-8f3f1b93"]]),Rp={name:"peerJobs",setup(){return{store:Ye()}},props:{selectedPeer:Object},components:{LocaleText:O,SchedulePeerJob:$a,ScheduleDropdown:Da},data(){return{}},methods:{deleteJob(s){this.selectedPeer.jobs=this.selectedPeer.jobs.filter(t=>t.JobID!==s.JobID)},addJob(){this.selectedPeer.jobs.unshift(JSON.parse(JSON.stringify({JobID:ho().toString(),Configuration:this.selectedPeer.configuration.Name,Peer:this.selectedPeer.id,Field:this.store.PeerScheduleJobs.dropdowns.Field[0].value,Operator:this.store.PeerScheduleJobs.dropdowns.Operator[0].value,Value:"",CreationDate:"",ExpireDate:"",Action:this.store.PeerScheduleJobs.dropdowns.Action[0].value})))}}},Ip={class:"peerSettingContainer w-100 h-100 position-absolute top-0 start-0 overflow-y-scroll"},Ep={class:"container d-flex h-100 w-100"},Fp={class:"m-auto modal-dialog-centered dashboardModal"},Bp={class:"card rounded-3 shadow",style:{width:"700px"}},zp={class:"card-header bg-transparent d-flex align-items-center gap-2 border-0 p-4 pb-2"},Np={class:"mb-0 fw-normal"},Vp={class:"card-body px-4 pb-4 pt-2 position-relative"},jp={class:"d-flex align-items-center mb-3"},Wp={class:"card shadow-sm",key:"none",style:{height:"153px"}},Hp={class:"card-body text-muted text-center d-flex"},Up={class:"m-auto"};function Yp(s,t,e,i,n,o){const a=V("LocaleText"),r=V("SchedulePeerJob");return S(),C("div",Ip,[h("div",Ep,[h("div",Fp,[h("div",Bp,[h("div",zp,[h("h4",Np,[y(a,{t:"Schedule Jobs"})]),h("button",{type:"button",class:"btn-close ms-auto",onClick:t[0]||(t[0]=l=>this.$emit("close"))})]),h("div",Vp,[h("div",jp,[h("button",{class:"btn bg-primary-subtle border-1 border-primary-subtle text-primary-emphasis rounded-3 shadow",onClick:t[1]||(t[1]=l=>this.addJob())},[t[3]||(t[3]=h("i",{class:"bi bi-plus-lg me-2"},null,-1)),y(a,{t:"Job"})])]),y(gi,{name:"schedulePeerJobTransition",tag:"div",class:"position-relative"},{default:nt(()=>[(S(!0),C(ct,null,Ot(this.selectedPeer.jobs,(l,c)=>(S(),j(r,{onRefresh:t[2]||(t[2]=d=>this.$emit("refresh")),onDelete:d=>this.deleteJob(l),dropdowns:this.store.PeerScheduleJobs.dropdowns,key:l.JobID,pjob:l},null,8,["onDelete","dropdowns","pjob"]))),128)),this.selectedPeer.jobs.length===0?(S(),C("div",Wp,[h("div",Hp,[h("h6",Up,[y(a,{t:"This peer does not have any job yet."})])])])):T("",!0)]),_:1})])])])])])}const Jp=pt(Rp,[["render",Yp],["__scopeId","data-v-5bbdd42b"]]),Kp={name:"peerJobsAllModal",setup(){return{store:Ye()}},components:{LocaleText:O,SchedulePeerJob:$a},props:{configurationPeers:Array[Object]},methods:{getuuid(){return ho()}},computed:{getAllJobs(){return this.configurationPeers.filter(s=>s.jobs.length>0)}}},Xp={class:"peerSettingContainer w-100 h-100 position-absolute top-0 start-0 overflow-y-scroll"},Gp={class:"container d-flex h-100 w-100"},qp={class:"m-auto modal-dialog-centered dashboardModal"},Qp={class:"card rounded-3 shadow",style:{width:"700px"}},Zp={class:"card-header bg-transparent d-flex align-items-center gap-2 border-0 p-4 pb-2"},tm={class:"mb-0 fw-normal"},em={class:"card-body px-4 pb-4 pt-2"},sm={key:0,class:"accordion",id:"peerJobsLogsModalAccordion"},im={class:"accordion-header"},nm=["data-bs-target"],om={key:0},am={class:"text-muted"},rm=["id"],lm={class:"accordion-body"},cm={key:1,class:"card shadow-sm",style:{height:"153px"}},dm={class:"card-body text-muted text-center d-flex"},hm={class:"m-auto"};function um(s,t,e,i,n,o){const a=V("LocaleText"),r=V("SchedulePeerJob");return S(),C("div",Xp,[h("div",Gp,[h("div",qp,[h("div",Qp,[h("div",Zp,[h("h4",tm,[y(a,{t:"All Active Jobs"})]),h("button",{type:"button",class:"btn-close ms-auto",onClick:t[0]||(t[0]=l=>this.$emit("close"))})]),h("div",em,[this.getAllJobs.length>0?(S(),C("div",sm,[(S(!0),C(ct,null,Ot(this.getAllJobs,(l,c)=>(S(),C("div",{class:"accordion-item",key:l.id},[h("h2",im,[h("button",{class:"accordion-button collapsed",type:"button","data-bs-toggle":"collapse","data-bs-target":"#collapse_"+c},[h("small",null,[h("strong",null,[l.name?(S(),C("span",om,F(l.name)+" • ",1)):T("",!0),h("samp",am,F(l.id),1)])])],8,nm)]),h("div",{id:"collapse_"+c,class:"accordion-collapse collapse","data-bs-parent":"#peerJobsLogsModalAccordion"},[h("div",lm,[(S(!0),C(ct,null,Ot(l.jobs,d=>(S(),j(r,{onDelete:t[1]||(t[1]=u=>this.$emit("refresh")),onRefresh:t[2]||(t[2]=u=>this.$emit("refresh")),dropdowns:this.store.PeerScheduleJobs.dropdowns,viewOnly:!0,key:d.JobID,pjob:d},null,8,["dropdowns","pjob"]))),128))])],8,rm)]))),128))])):(S(),C("div",cm,[h("div",dm,[h("span",hm,[y(a,{t:"No active job at the moment."})])])]))])])])])])}const fm=pt(Kp,[["render",um]]),gm={name:"peerJobsLogsModal",components:{LocaleText:O},props:{configurationInfo:Object},data(){return{dataLoading:!0,data:[],logFetchTime:void 0,showLogID:!1,showJobID:!0,showSuccessJob:!0,showFailedJob:!0,showLogAmount:10}},async mounted(){await this.fetchLog()},methods:{async fetchLog(){this.dataLoading=!0,await $t(`/api/getPeerScheduleJobLogs/${this.configurationInfo.Name}`,{},s=>{this.data=s.data,this.logFetchTime=Ut().format("YYYY-MM-DD HH:mm:ss"),this.dataLoading=!1})}},computed:{getLogs(){return this.data.filter(s=>this.showSuccessJob&&s.Status==="1"||this.showFailedJob&&s.Status==="0")},showLogs(){return this.getLogs.slice(0,this.showLogAmount)}}},pm={class:"peerSettingContainer w-100 h-100 position-absolute top-0 start-0 overflow-y-scroll"},mm={class:"container-fluid d-flex h-100 w-100"},bm={class:"m-auto mt-0 modal-dialog-centered dashboardModal",style:{width:"100%"}},_m={class:"card rounded-3 shadow w-100"},xm={class:"card-header bg-transparent d-flex align-items-center gap-2 border-0 p-4 pb-0"},ym={class:"mb-0"},vm={class:"card-body px-4 pb-4 pt-2"},wm={key:0},km={class:"mb-2 d-flex gap-3"},Sm={class:"d-flex gap-3 align-items-center"},Mm={class:"text-muted"},Pm={class:"form-check"},Cm={class:"form-check-label",for:"jobLogsShowSuccessCheck"},Dm={class:"badge text-success-emphasis bg-success-subtle"},$m={class:"form-check"},Om={class:"form-check-label",for:"jobLogsShowFailedCheck"},Am={class:"badge text-danger-emphasis bg-danger-subtle"},Lm={class:"d-flex gap-3 align-items-center ms-auto"},Tm={class:"text-muted"},Rm={class:"form-check"},Im={class:"form-check-label",for:"jobLogsShowJobIDCheck"},Em={class:"form-check"},Fm={class:"form-check-label",for:"jobLogsShowLogIDCheck"},Bm={class:"table"},zm={scope:"col"},Nm={key:0,scope:"col"},Vm={key:1,scope:"col"},jm={scope:"col"},Wm={scope:"col"},Hm={style:{"font-size":"0.875rem"}},Um={scope:"row"},Ym={key:0},Jm={class:"text-muted"},Km={key:1},Xm={class:"text-muted"},Gm={class:"d-flex gap-2"},qm={key:1,class:"d-flex align-items-center flex-column"};function Qm(s,t,e,i,n,o){const a=V("LocaleText");return S(),C("div",pm,[h("div",mm,[h("div",bm,[h("div",_m,[h("div",xm,[h("h4",ym,[y(a,{t:"Jobs Logs"})]),h("button",{type:"button",class:"btn-close ms-auto",onClick:t[0]||(t[0]=r=>this.$emit("close"))})]),h("div",vm,[this.dataLoading?(S(),C("div",qm,t[11]||(t[11]=[h("div",{class:"spinner-border text-body",role:"status"},[h("span",{class:"visually-hidden"},"Loading...")],-1)]))):(S(),C("div",wm,[h("p",null,[y(a,{t:"Updated at"}),st(" : "+F(this.logFetchTime),1)]),h("div",km,[h("button",{onClick:t[1]||(t[1]=r=>this.fetchLog()),class:"btn btn-sm rounded-3 shadow-sm text-info-emphasis bg-info-subtle border-1 border-info-subtle me-1"},[t[8]||(t[8]=h("i",{class:"bi bi-arrow-clockwise me-2"},null,-1)),y(a,{t:"Refresh"})]),h("div",Sm,[h("span",Mm,[y(a,{t:"Filter"})]),h("div",Pm,[K(h("input",{class:"form-check-input",type:"checkbox","onUpdate:modelValue":t[2]||(t[2]=r=>this.showSuccessJob=r),id:"jobLogsShowSuccessCheck"},null,512),[[be,this.showSuccessJob]]),h("label",Cm,[h("span",Dm,[y(a,{t:"Success"})])])]),h("div",$m,[K(h("input",{class:"form-check-input",type:"checkbox","onUpdate:modelValue":t[3]||(t[3]=r=>this.showFailedJob=r),id:"jobLogsShowFailedCheck"},null,512),[[be,this.showFailedJob]]),h("label",Om,[h("span",Am,[y(a,{t:"Failed"})])])])]),h("div",Lm,[h("span",Tm,[y(a,{t:"Display"})]),h("div",Rm,[K(h("input",{class:"form-check-input",type:"checkbox","onUpdate:modelValue":t[4]||(t[4]=r=>n.showJobID=r),id:"jobLogsShowJobIDCheck"},null,512),[[be,n.showJobID]]),h("label",Im,[y(a,{t:"Job ID"})])]),h("div",Em,[K(h("input",{class:"form-check-input",type:"checkbox","onUpdate:modelValue":t[5]||(t[5]=r=>n.showLogID=r),id:"jobLogsShowLogIDCheck"},null,512),[[be,n.showLogID]]),h("label",Fm,[y(a,{t:"Log ID"})])])])]),h("table",Bm,[h("thead",null,[h("tr",null,[h("th",zm,[y(a,{t:"Date"})]),n.showLogID?(S(),C("th",Nm,[y(a,{t:"Log ID"})])):T("",!0),n.showJobID?(S(),C("th",Vm,[y(a,{t:"Job ID"})])):T("",!0),h("th",jm,[y(a,{t:"Status"})]),h("th",Wm,[y(a,{t:"Message"})])])]),h("tbody",null,[(S(!0),C(ct,null,Ot(this.showLogs,r=>(S(),C("tr",Hm,[h("th",Um,F(r.LogDate),1),n.showLogID?(S(),C("td",Ym,[h("samp",Jm,F(r.LogID),1)])):T("",!0),n.showJobID?(S(),C("td",Km,[h("samp",Xm,F(r.JobID),1)])):T("",!0),h("td",null,[h("span",{class:it(["badge",[r.Status==="1"?"text-success-emphasis bg-success-subtle":"text-danger-emphasis bg-danger-subtle"]])},F(r.Status==="1"?"Success":"Failed"),3)]),h("td",null,F(r.Message),1)]))),256))])]),h("div",Gm,[this.getLogs.length>this.showLogAmount?(S(),C("button",{key:0,onClick:t[6]||(t[6]=r=>this.showLogAmount+=20),class:"btn btn-sm rounded-3 shadow-sm text-primary-emphasis bg-primary-subtle border-1 border-primary-subtle"},t[9]||(t[9]=[h("i",{class:"bi bi-chevron-down me-2"},null,-1),st(" Show More ")]))):T("",!0),this.showLogAmount>20?(S(),C("button",{key:1,onClick:t[7]||(t[7]=r=>this.showLogAmount=20),class:"btn btn-sm rounded-3 shadow-sm text-primary-emphasis bg-primary-subtle border-1 border-primary-subtle"},t[10]||(t[10]=[h("i",{class:"bi bi-chevron-up me-2"},null,-1),st(" Collapse ")]))):T("",!0)])]))])])])])])}const Zm=pt(gm,[["render",Qm]]),tb={name:"peerShareLinkModal",props:{peer:Object},components:{LocaleText:O,VueDatePicker:fo},data(){return{dataCopy:void 0,loading:!1}},setup(){return{store:At()}},mounted(){this.dataCopy=JSON.parse(JSON.stringify(this.peer.ShareLink)).at(0)},watch:{"peer.ShareLink":{deep:!0,handler(s,t){t.length!==s.length&&(this.dataCopy=JSON.parse(JSON.stringify(this.peer.ShareLink)).at(0))}}},methods:{startSharing(){this.loading=!0,ut("/api/sharePeer/create",{Configuration:this.peer.configuration.Name,Peer:this.peer.id,ExpireDate:Ut().add(7,"d").format("YYYY-MM-DD HH:mm:ss")},s=>{s.status?(this.peer.ShareLink=s.data,this.dataCopy=s.data.at(0)):this.store.newMessage("Server","Share link failed to create. Reason: "+s.message,"danger"),this.loading=!1})},updateLinkExpireDate(){ut("/api/sharePeer/update",this.dataCopy,s=>{s.status?(this.dataCopy=s.data.at(0),this.peer.ShareLink=s.data,this.store.newMessage("Server","Link expire date updated","success")):this.store.newMessage("Server","Link expire date failed to update. Reason: "+s.message,"danger"),this.loading=!1})},stopSharing(){this.loading=!0,this.dataCopy.ExpireDate=Ut().format("YYYY-MM-DD HH:mm:ss"),this.updateLinkExpireDate()},parseTime(s){s?this.dataCopy.ExpireDate=Ut(s).format("YYYY-MM-DD HH:mm:ss"):this.dataCopy.ExpireDate=void 0,this.updateLinkExpireDate()}},computed:{getUrl(){const s=this.store.getActiveCrossServer();return s?`${s.host}/${this.$router.resolve({path:"/share",query:{ShareID:this.dataCopy.ShareID}}).href}`:window.location.origin+window.location.pathname+this.$router.resolve({path:"/share",query:{ShareID:this.dataCopy.ShareID}}).href}}},eb={class:"peerSettingContainer w-100 h-100 position-absolute top-0 start-0 overflow-y-scroll"},sb={class:"container d-flex h-100 w-100"},ib={class:"m-auto modal-dialog-centered dashboardModal",style:{width:"500px"}},nb={class:"card rounded-3 shadow flex-grow-1"},ob={class:"card-header bg-transparent d-flex align-items-center gap-2 border-0 p-4"},ab={class:"mb-0"},rb={key:0,class:"card-body px-4 pb-4"},lb={key:0},cb={class:"mb-3 text-muted"},db=["disabled"],hb={key:1},ub={class:"d-flex gap-2 mb-4"},fb=["href"],gb={class:"d-flex flex-column gap-2 mb-3"},pb=["disabled"];function mb(s,t,e,i,n,o){const a=V("LocaleText"),r=V("VueDatePicker");return S(),C("div",eb,[h("div",sb,[h("div",ib,[h("div",nb,[h("div",ob,[h("h4",ab,[y(a,{t:"Share Peer"})]),h("button",{type:"button",class:"btn-close ms-auto",onClick:t[0]||(t[0]=l=>this.$emit("close"))})]),this.peer.ShareLink?(S(),C("div",rb,[this.dataCopy?(S(),C("div",hb,[h("div",ub,[t[4]||(t[4]=h("i",{class:"bi bi-link-45deg"},null,-1)),h("a",{href:this.getUrl,class:"text-decoration-none",target:"_blank"},F(o.getUrl),9,fb)]),h("div",gb,[h("small",null,[t[5]||(t[5]=h("i",{class:"bi bi-calendar me-2"},null,-1)),y(a,{t:"Expire At"})]),y(r,{is24:!0,"min-date":new Date,"model-value":this.dataCopy.ExpireDate,"onUpdate:modelValue":this.parseTime,"time-picker-inline":"",format:"yyyy-MM-dd HH:mm:ss","preview-format":"yyyy-MM-dd HH:mm:ss",dark:this.store.Configuration.Server.dashboard_theme==="dark"},null,8,["min-date","model-value","onUpdate:modelValue","dark"])]),h("button",{onClick:t[2]||(t[2]=l=>this.stopSharing()),disabled:this.loading,class:"w-100 btn bg-danger-subtle text-danger-emphasis border-1 border-danger-subtle rounded-3 shadow-sm"},[h("span",{class:it({"animate__animated animate__flash animate__infinite animate__slower":this.loading})},t[6]||(t[6]=[h("i",{class:"bi bi-send-slash-fill me-2"},null,-1)]),2),this.loading?(S(),j(a,{key:0,t:"Stop Sharing..."})):(S(),j(a,{key:1,t:"Stop Sharing"}))],8,pb)])):(S(),C("div",lb,[h("h6",cb,[y(a,{t:"Currently the peer is not sharing"})]),h("button",{onClick:t[1]||(t[1]=l=>this.startSharing()),disabled:this.loading,class:"w-100 btn bg-success-subtle text-success-emphasis border-1 border-success-subtle rounded-3 shadow-sm"},[h("span",{class:it({"animate__animated animate__flash animate__infinite animate__slower":this.loading})},t[3]||(t[3]=[h("i",{class:"bi bi-send-fill me-2"},null,-1)]),2),this.loading?(S(),j(a,{key:0,t:"Sharing..."})):(S(),j(a,{key:1,t:"Start Sharing"}))],8,db)]))])):T("",!0)])])])])}const bb=pt(tb,[["render",mb]]),_b={class:"container d-flex h-100 w-100"},xb={class:"m-auto modal-dialog-centered dashboardModal",style:{width:"700px"}},yb={class:"card rounded-3 shadow flex-grow-1"},vb={class:"card-header bg-transparent d-flex align-items-center gap-2 border-0 p-4"},wb={class:"mb-0"},kb={class:"card-body px-4 pb-4"},Sb={class:"d-flex gap-2 flex-column"},Mb={class:"d-flex align-items-center"},Pb={class:"text-muted"},Cb={class:"ms-auto"},Db={class:"d-flex align-items-center"},$b={class:"text-muted"},Ob={class:"ms-auto"},Ab={for:"configuration_private_key",class:"form-label d-flex"},Lb={class:"text-muted d-block"},Tb={class:"form-check form-switch ms-auto"},Rb=["disabled"],Ib={for:"configuration_ipaddress_cidr",class:"form-label"},Eb={class:"text-muted"},Fb=["disabled"],Bb={for:"configuration_listen_port",class:"form-label"},zb={class:"text-muted"},Nb=["disabled"],Vb={for:"configuration_preup",class:"form-label"},jb={class:"text-muted"},Wb=["disabled"],Hb={for:"configuration_predown",class:"form-label"},Ub={class:"text-muted"},Yb=["disabled"],Jb={for:"configuration_postup",class:"form-label"},Kb={class:"text-muted"},Xb=["disabled"],Gb={for:"configuration_postdown",class:"form-label"},qb={class:"text-muted"},Qb=["disabled"],Zb={class:"d-flex align-items-center gap-2 mt-4"},t_=["disabled"],e_=["disabled"],s_={__name:"editConfiguration",props:{configurationInfo:Object},emits:["changed","close"],setup(s,{emit:t}){const e=s,i=Ye(),n=At(),o=U(!1),a=Xs(JSON.parse(JSON.stringify(e.configurationInfo))),r=U(!1),l=U(!1);U(!1);const c=Xs({PrivateKey:!0,IPAddress:!0,ListenPort:!0}),d=Gs("editConfigurationContainer"),u=()=>{i.checkWGKeyLength(a.PrivateKey)?(c.PrivateKey=!0,a.PublicKey=window.wireguard.generatePublicKey(a.PrivateKey)):c.PrivateKey=!1},f=()=>{l.value=!1,Object.assign(a,JSON.parse(JSON.stringify(e.configurationInfo)))},g=t,p=()=>{o.value=!0,ut("/api/updateWireguardConfiguration",a,m=>{o.value=!1,m.status?(n.newMessage("Server","Configuration saved","success"),l.value=!1,g("dataChanged",m.data)):n.newMessage("Server",m.message,"danger")})};return Ss(a,()=>{l.value=JSON.stringify(a)!==JSON.stringify(e.configurationInfo)},{deep:!0}),U(!1),(m,b)=>(S(),C("div",{class:"peerSettingContainer w-100 h-100 position-absolute top-0 start-0 overflow-y-scroll",ref_key:"editConfigurationContainer",ref:d},[h("div",_b,[h("div",xb,[h("div",yb,[h("div",vb,[h("h4",wb,[y(O,{t:"Configuration Settings"})]),h("button",{type:"button",class:"btn-close ms-auto",onClick:b[0]||(b[0]=_=>m.$emit("close"))})]),h("div",kb,[h("div",Sb,[h("div",Mb,[h("small",Pb,[y(O,{t:"Name"})]),h("small",Cb,[h("samp",null,F(a.Name),1)])]),h("div",Db,[h("small",$b,[y(O,{t:"Public Key"})]),h("small",Ob,[h("samp",null,F(a.PublicKey),1)])]),b[15]||(b[15]=h("hr",null,null,-1)),h("div",null,[h("label",Ab,[h("small",Lb,[y(O,{t:"Private Key"})]),h("div",Tb,[K(h("input",{class:"form-check-input",type:"checkbox",role:"switch",id:"editPrivateKeySwitch","onUpdate:modelValue":b[1]||(b[1]=_=>r.value=_)},null,512),[[be,r.value]]),b[12]||(b[12]=h("label",{class:"form-check-label",for:"editPrivateKeySwitch"},[h("small",null,"Edit")],-1))])]),K(h("input",{type:"text",class:it(["form-control form-control-sm rounded-3",{"is-invalid":!c.PrivateKey}]),disabled:o.value||!r.value,onKeyup:b[2]||(b[2]=_=>u()),"onUpdate:modelValue":b[3]||(b[3]=_=>a.PrivateKey=_),id:"configuration_private_key"},null,42,Rb),[[rt,a.PrivateKey]])]),h("div",null,[h("label",Ib,[h("small",Eb,[y(O,{t:"IP Address/CIDR"})])]),K(h("input",{type:"text",class:"form-control form-control-sm rounded-3",disabled:o.value,"onUpdate:modelValue":b[4]||(b[4]=_=>a.Address=_),id:"configuration_ipaddress_cidr"},null,8,Fb),[[rt,a.Address]])]),h("div",null,[h("label",Bb,[h("small",zb,[y(O,{t:"Listen Port"})])]),K(h("input",{type:"number",class:"form-control form-control-sm rounded-3",disabled:o.value,"onUpdate:modelValue":b[5]||(b[5]=_=>a.ListenPort=_),id:"configuration_listen_port"},null,8,Nb),[[rt,a.ListenPort]])]),h("div",null,[h("label",Vb,[h("small",jb,[y(O,{t:"PreUp"})])]),K(h("input",{type:"text",class:"form-control form-control-sm rounded-3",disabled:o.value,"onUpdate:modelValue":b[6]||(b[6]=_=>a.PreUp=_),id:"configuration_preup"},null,8,Wb),[[rt,a.PreUp]])]),h("div",null,[h("label",Hb,[h("small",Ub,[y(O,{t:"PreDown"})])]),K(h("input",{type:"text",class:"form-control form-control-sm rounded-3",disabled:o.value,"onUpdate:modelValue":b[7]||(b[7]=_=>a.PreDown=_),id:"configuration_predown"},null,8,Yb),[[rt,a.PreDown]])]),h("div",null,[h("label",Jb,[h("small",Kb,[y(O,{t:"PostUp"})])]),K(h("input",{type:"text",class:"form-control form-control-sm rounded-3",disabled:o.value,"onUpdate:modelValue":b[8]||(b[8]=_=>a.PostUp=_),id:"configuration_postup"},null,8,Xb),[[rt,a.PostUp]])]),h("div",null,[h("label",Gb,[h("small",qb,[y(O,{t:"PostDown"})])]),K(h("input",{type:"text",class:"form-control form-control-sm rounded-3",disabled:o.value,"onUpdate:modelValue":b[9]||(b[9]=_=>a.PostDown=_),id:"configuration_postdown"},null,8,Qb),[[rt,a.PostDown]])]),h("div",Zb,[h("button",{class:"btn bg-secondary-subtle border-secondary-subtle text-secondary-emphasis rounded-3 shadow ms-auto",onClick:b[10]||(b[10]=_=>f()),disabled:!l.value||o.value},b[13]||(b[13]=[h("i",{class:"bi bi-arrow-clockwise"},null,-1)]),8,t_),h("button",{class:"btn bg-primary-subtle border-primary-subtle text-primary-emphasis rounded-3 shadow",disabled:!l.value||o.value,onClick:b[11]||(b[11]=_=>p())},b[14]||(b[14]=[h("i",{class:"bi bi-save-fill"},null,-1)]),8,e_)])])])])])])],512))}},i_={class:"peerSettingContainer w-100 h-100 position-absolute top-0 start-0 overflow-y-scroll",ref:"selectPeersContainer"},n_={class:"container d-flex h-100 w-100"},o_={class:"m-auto modal-dialog-centered dashboardModal",style:{width:"700px"}},a_={class:"card rounded-3 shadow flex-grow-1"},r_={class:"card-header bg-transparent d-flex align-items-center gap-2 p-4 flex-column pb-3"},l_={class:"mb-2 w-100 d-flex"},c_={class:"mb-0"},d_={class:"d-flex w-100 align-items-center gap-2"},h_={class:"d-flex gap-3"},u_={class:"card-body px-4 flex-grow-1 d-flex gap-2 flex-column position-relative",ref:"card-body",style:{"overflow-y":"scroll"}},f_=["onClick","disabled","data-id"],g_={key:0},p_={class:"d-flex flex-column"},m_={class:"fw-bold"},b_={class:"text-muted"},__={key:1,class:"ms-auto"},x_={key:0,class:"spinner-border spinner-border-sm",role:"status"},y_={class:"card-footer px-4 py-3 gap-2 d-flex align-items-center"},v_=["disabled"],w_={key:0,class:"flex-grow-1 text-center"},k_=["disabled"],S_={key:0,class:"flex-grow-1 text-center"},M_=["disabled"],P_={key:0,class:"flex-grow-1 text-center"},C_=["disabled"],D_={__name:"selectPeers",props:{configurationPeers:Array},emits:["refresh","close"],setup(s,{emit:t}){const e=s,i=U(!1),n=U(!1),o=U([]),a=U(""),r=k=>{o.value.find(v=>v===k)?o.value=o.value.filter(v=>v!==k):o.value.push(k)},l=uo(()=>i.value||n.value?e.configurationPeers.filter(k=>o.value.find(v=>v===k.id)):a.value.length>0?e.configurationPeers.filter(k=>k.id.includes(a.value)||k.name.includes(a.value)):e.configurationPeers);Ss(o,()=>{o.value.length===0&&(i.value=!1,n.value=!1)});const c=Ms(),d=At(),u=t,f=U(!1),g=()=>{f.value=!0,ut(`/api/deletePeers/${c.params.id}`,{peers:o.value},k=>{d.newMessage("Server",k.message,k.status?"success":"danger"),k.status&&(o.value=[],i.value=!1),u("refresh"),f.value=!1})},p=Xs({success:[],failed:[]}),m=Gs("card-body"),b=Gs("sp"),_=async()=>{n.value=!0;for(const k of o.value)m.value.scrollTo({top:b.value.find(v=>v.dataset.id===k).offsetTop-20,behavior:"smooth"}),await $t("/api/downloadPeer/"+c.params.id,{id:k},v=>{if(v.status){const x=new Blob([v.data.file],{type:"text/plain"}),M=URL.createObjectURL(x),P=`${v.data.fileName}.conf`,D=document.createElement("a");D.href=M,D.download=P,D.click(),p.success.push(k)}else p.failed.push(k)})},w=()=>{p.success=[],p.failed=[],n.value=!1};return(k,v)=>(S(),C("div",i_,[h("div",n_,[h("div",o_,[h("div",a_,[h("div",r_,[h("div",l_,[h("h4",c_,[y(O,{t:"Select Peers"})]),h("button",{type:"button",class:"btn-close ms-auto",onClick:v[0]||(v[0]=x=>u("close"))})]),h("div",d_,[h("div",h_,[!n.value&&o.value.length!==s.configurationPeers.map(x=>x.id).length?(S(),C("a",{key:0,role:"button",onClick:v[1]||(v[1]=x=>o.value=s.configurationPeers.map(M=>M.id)),class:"text-decoration-none text-body"},[h("small",null,[v[9]||(v[9]=h("i",{class:"bi bi-check-all me-2"},null,-1)),y(O,{t:"Select All"})])])):T("",!0),o.value.length>0&&!n.value?(S(),C("a",{key:1,role:"button",class:"text-decoration-none text-body",onClick:v[2]||(v[2]=x=>o.value=[])},[h("small",null,[v[10]||(v[10]=h("i",{class:"bi bi-x-circle-fill me-2"},null,-1)),y(O,{t:"Clear Selection"})])])):T("",!0)]),v[11]||(v[11]=h("label",{class:"ms-auto",for:"selectPeersSearchInput"},[h("i",{class:"bi bi-search"})],-1)),K(h("input",{class:"form-control form-control-sm rounded-3","onUpdate:modelValue":v[3]||(v[3]=x=>a.value=x),id:"selectPeersSearchInput",style:{width:"200px !important"},type:"text"},null,512),[[rt,a.value]])])]),h("div",u_,[(S(!0),C(ct,null,Ot(l.value,x=>(S(),C("button",{type:"button",class:it(["btn w-100 peerBtn text-start rounded-3 d-flex align-items-center gap-3",{active:o.value.find(M=>M===x.id)}]),onClick:M=>r(x.id),key:x.id,disabled:i.value||n.value,ref_for:!0,ref:"sp","data-id":x.id},[n.value?T("",!0):(S(),C("span",g_,[h("i",{class:it(["bi",[o.value.find(M=>M===x.id)?"bi-check-circle-fill":"bi-circle"]])},null,2)])),h("span",p_,[h("small",m_,F(x.name?x.name:"Untitled Peer"),1),h("small",b_,[h("samp",null,F(x.id),1)])]),n.value?(S(),C("span",__,[!p.success.find(M=>M===x.id)&&!p.failed.find(M=>M===x.id)?(S(),C("span",x_)):(S(),C("i",{key:1,class:it(["bi",[p.failed.find(M=>M===x.id)?"bi-x-circle-fill":"bi-check-circle-fill"]])},null,2))])):T("",!0)],10,f_))),128))],512),h("div",y_,[!i.value&&!n.value?(S(),C(ct,{key:0},[h("button",{class:"btn bg-primary-subtle text-primary-emphasis border-primary-subtle rounded-3",disabled:o.value.length===0||f.value,onClick:v[4]||(v[4]=x=>_())},v[12]||(v[12]=[h("i",{class:"bi bi-download"},null,-1)]),8,v_),o.value.length>0?(S(),C("span",w_,[v[13]||(v[13]=h("i",{class:"bi bi-check-circle-fill me-2"},null,-1)),y(O,{t:o.value.length+" Peer"+(o.value.length>1?"s":"")},null,8,["t"])])):T("",!0),h("button",{class:"btn bg-danger-subtle text-danger-emphasis border-danger-subtle ms-auto rounded-3",onClick:v[5]||(v[5]=x=>i.value=!0),disabled:o.value.length===0||f.value},v[14]||(v[14]=[h("i",{class:"bi bi-trash"},null,-1)]),8,k_)],64)):n.value?(S(),C(ct,{key:1},[p.failed.length+p.success.length1?"s":"")},null,8,["t"]),v[16]||(v[16]=st("... "))])):(S(),C(ct,{key:1},[h("strong",null,[y(O,{t:"Download Finished"})]),h("button",{onClick:v[6]||(v[6]=x=>w()),class:"btn bg-secondary-subtle text-secondary-emphasis border border-secondary-subtle rounded-3 ms-auto"},[y(O,{t:"Done"})])],64))],64)):i.value?(S(),C(ct,{key:2},[h("button",{class:"btn btn-danger rounded-3",disabled:o.value.length===0||f.value,onClick:v[7]||(v[7]=x=>g())},[y(O,{t:"Yes"})],8,M_),o.value.length>0?(S(),C("strong",P_,[y(O,{t:"Are you sure to delete"}),v[17]||(v[17]=st()),y(O,{t:o.value.length+" Peer"+(o.value.length>1?"s":"")},null,8,["t"]),v[18]||(v[18]=st("? "))])):T("",!0),h("button",{class:"btn bg-secondary-subtle text-secondary-emphasis border border-secondary-subtle ms-auto rounded-3",disabled:o.value.length===0||f.value,onClick:v[8]||(v[8]=x=>i.value=!1)},[y(O,{t:"No"})],8,C_)],64)):T("",!0)])])])])],512))}},$_=pt(D_,[["__scopeId","data-v-177407c1"]]),O_={class:"card my-0 rounded-3"},A_={class:"card-body position-relative"},L_={key:0,class:"position-absolute w-100 h-100 confirmationContainer start-0 top-0 rounded-3 d-flex p-2"},T_={class:"m-auto"},R_={class:"d-flex gap-2 align-items-center justify-content-center"},I_=["disabled"],E_=["disabled"],F_={key:0,class:"position-absolute w-100 h-100 confirmationContainer start-0 top-0 rounded-3 d-flex p-2"},B_={class:"m-auto"},z_={class:"d-flex gap-2 align-items-center justify-content-center"},N_=["disabled"],V_=["disabled"],j_={class:"d-flex gap-3"},W_={class:"d-flex flex-column"},H_={class:"text-muted"},U_={class:"d-flex flex-column"},Y_={class:"text-muted"},J_={class:"d-flex gap-2 align-items-center ms-auto"},K_={class:"card rounded-3"},X_={key:0,class:"card-body"},G_=["value"],q_={class:"d-flex"},Q_={__name:"backup",props:["b","delay"],emits:["refresh","refreshPeersList"],setup(s,{emit:t}){Ea(g=>({"6919ade8":u.value}));const e=s,i=U(!1),n=U(!1),o=Ms(),a=t,r=At(),l=U(!1),c=()=>{l.value=!0,ut("/api/deleteWireguardConfigurationBackup",{configurationName:o.params.id,backupFileName:e.b.filename},g=>{l.value=!1,g.status?(a("refresh"),r.newMessage("Server","Backup deleted","success")):r.newMessage("Server","Backup failed to delete","danger")})},d=()=>{l.value=!0,ut("/api/restoreWireguardConfigurationBackup",{configurationName:o.params.id,backupFileName:e.b.filename},g=>{l.value=!1,n.value=!1,g.status?(a("refresh"),r.newMessage("Server","Backup restored with "+e.b.filename,"success")):r.newMessage("Server","Backup failed to restore","danger")})},u=uo(()=>e.delay+"s"),f=U(!1);return(g,p)=>(S(),C("div",O_,[h("div",A_,[y(gt,{name:"zoomReversed"},{default:nt(()=>[i.value?(S(),C("div",L_,[h("div",T_,[h("h5",null,[y(O,{t:"Are you sure to delete this backup?"})]),h("div",R_,[h("button",{class:"btn btn-danger rounded-3",disabled:l.value,onClick:p[0]||(p[0]=m=>c())},[y(O,{t:"Yes"})],8,I_),h("button",{onClick:p[1]||(p[1]=m=>i.value=!1),disabled:l.value,class:"btn bg-secondary-subtle text-secondary-emphasis border-secondary-subtle rounded-3"},[y(O,{t:"No"})],8,E_)])])])):T("",!0)]),_:1}),y(gt,{name:"zoomReversed"},{default:nt(()=>[n.value?(S(),C("div",F_,[h("div",B_,[h("h5",null,[y(O,{t:"Are you sure to restore this backup?"})]),h("div",z_,[h("button",{disabled:l.value,onClick:p[2]||(p[2]=m=>d()),class:"btn btn-success rounded-3"},[y(O,{t:"Yes"})],8,N_),h("button",{onClick:p[3]||(p[3]=m=>n.value=!1),disabled:l.value,class:"btn bg-secondary-subtle text-secondary-emphasis border-secondary-subtle rounded-3"},[y(O,{t:"No"})],8,V_)])])])):T("",!0)]),_:1}),h("div",j_,[h("div",W_,[h("small",H_,[y(O,{t:"Backup"})]),h("samp",null,F(s.b.filename),1)]),h("div",U_,[h("small",Y_,[y(O,{t:"Backup Date"})]),st(" "+F(gs(Ut)(s.b.backupDate,"YYYYMMDDHHmmss").format("YYYY-MM-DD HH:mm:ss")),1)]),h("div",J_,[h("button",{onClick:p[4]||(p[4]=m=>n.value=!0),class:"btn bg-warning-subtle text-warning-emphasis border-warning-subtle rounded-3 btn-sm"},p[7]||(p[7]=[h("i",{class:"bi bi-clock-history"},null,-1)])),h("button",{onClick:p[5]||(p[5]=m=>i.value=!0),class:"btn bg-danger-subtle text-danger-emphasis border-danger-subtle rounded-3 btn-sm"},p[8]||(p[8]=[h("i",{class:"bi bi-trash-fill"},null,-1)]))])]),p[12]||(p[12]=h("hr",null,null,-1)),h("div",K_,[h("a",{role:"button",class:it(["card-header d-flex text-decoration-none align-items-center",{"border-bottom-0":!f.value}]),style:{cursor:"pointer"},onClick:p[6]||(p[6]=m=>f.value=!f.value)},[h("small",null,[p[9]||(p[9]=st(".conf ")),y(O,{t:"File"})]),p[10]||(p[10]=h("i",{class:"bi bi-chevron-down ms-auto"},null,-1))],2),f.value?(S(),C("div",X_,[h("textarea",{class:"form-control rounded-3",value:s.b.content,disabled:"",style:{height:"300px","font-family":"var(--bs-font-monospace),sans-serif !important"}},null,8,G_)])):T("",!0)]),p[13]||(p[13]=h("hr",null,null,-1)),h("div",q_,[h("span",null,[p[11]||(p[11]=h("i",{class:"bi bi-database me-1"},null,-1)),y(O,{t:"Database File"})]),h("i",{class:it(["bi ms-auto",[s.b.database?"text-success bi-check-circle-fill":"text-danger bi-x-circle-fill"]])},null,2)])])]))}},Z_=pt(Q_,[["__scopeId","data-v-a575be12"]]),tx={class:"peerSettingContainer w-100 h-100 position-absolute top-0 start-0 overflow-y-scroll",ref:"editConfigurationContainer"},ex={class:"d-flex h-100 w-100"},sx={class:"modal-dialog-centered dashboardModal w-100 h-100 overflow-x-scroll flex-column gap-3 mx-3"},ix={class:"my-5 d-flex gap-3 flex-column position-relative"},nx={class:"title"},ox={class:"d-flex mb-3"},ax={class:"mb-0"},rx={class:"position-relative d-flex flex-column gap-3"},lx={class:"text-center title",key:"spinner"},cx={class:"card my-0 rounded-3",key:"noBackups"},dx={class:"card-body text-center text-muted"},hx={__name:"configurationBackupRestore",emits:["close","refreshPeersList"],setup(s,{emit:t}){const e=Ms(),i=U([]),n=U(!0),o=t;fi(()=>{a()});const a=()=>{n.value=!0,$t("/api/getWireguardConfigurationBackup",{configurationName:e.params.id},l=>{i.value=l.data,n.value=!1})},r=()=>{$t("/api/createWireguardConfigurationBackup",{configurationName:e.params.id},l=>{i.value=l.data,n.value=!1})};return(l,c)=>(S(),C("div",tx,[h("div",ex,[h("div",sx,[h("div",ix,[h("div",nx,[h("div",ox,[h("h4",ax,[y(O,{t:"Backup & Restore"})]),h("button",{type:"button",class:"btn-close ms-auto",onClick:c[0]||(c[0]=d=>l.$emit("close"))})]),h("button",{onClick:c[1]||(c[1]=d=>r()),class:"btn bg-primary-subtle text-primary-emphasis border-primary-subtle rounded-3 w-100"},[c[4]||(c[4]=h("i",{class:"bi bi-plus-circle-fill me-2"},null,-1)),y(O,{t:"Create Backup"})])]),h("div",rx,[y(gi,{name:"list1"},{default:nt(()=>[n.value&&i.value.length===0?(S(),C("div",lx,c[5]||(c[5]=[h("div",{class:"spinner-border"},null,-1)]))):!n.value&&i.value.length===0?(S(),C("div",cx,[h("div",dx,[c[6]||(c[6]=h("i",{class:"bi bi-x-circle-fill me-2"},null,-1)),y(O,{t:"No backup yet, click the button above to create backup."})])])):T("",!0),(S(!0),C(ct,null,Ot(i.value,(d,u)=>(S(),j(Z_,{onRefresh:c[2]||(c[2]=f=>a()),onRefreshPeersList:c[3]||(c[3]=f=>o("refreshPeersList")),b:d,delay:u*.05,key:d.filename},null,8,["b","delay"]))),128))]),_:1})])])])])],512))}},ux=pt(hx,[["__scopeId","data-v-0b159317"]]),fx={class:"peerSettingContainer w-100 h-100 position-absolute top-0 start-0 overflow-y-scroll"},gx={class:"container d-flex h-100 w-100"},px={class:"m-auto modal-dialog-centered dashboardModal",style:{width:"700px"}},mx={class:"card rounded-3 shadow flex-grow-1 bg-danger-subtle border-danger-subtle",id:"deleteConfigurationContainer"},bx={class:"card-header bg-transparent d-flex align-items-center gap-2 border-0 p-4 pb-0"},_x={class:"mb-0"},xx={class:"card-body px-4 text-muted"},yx={class:"mb-0"},vx={key:0},wx={key:1},kx={key:2,class:"d-flex align-items-center gap-2"},Sx=["placeholder"],Mx=["disabled"],Px={__name:"deleteConfiguration",emits:["backup"],setup(s,{emit:t}){const i=Ms().params.id,n=U(""),o=Fa(),a=At(),r=U(!1),l=()=>{clearInterval(a.Peers.RefreshInterval),r.value=!0,ut("/api/deleteWireguardConfiguration",{Name:i},g=>{g.status?(o.push("/"),a.newMessage("Server","Configuration deleted","success")):r.value=!1})},c=U(!0),d=U([]),u=()=>{c.value=!0,$t("/api/getWireguardConfigurationBackup",{configurationName:i},g=>{d.value=g.data,c.value=!1})};fi(()=>{u()});const f=t;return(g,p)=>(S(),C("div",fx,[h("div",gx,[h("div",px,[h("div",mx,[h("div",bx,[h("h5",_x,[y(O,{t:"Are you sure to delete this configuration?"})]),h("button",{type:"button",class:"btn-close ms-auto",onClick:p[0]||(p[0]=m=>g.$emit("close"))})]),h("div",xx,[h("p",yx,[y(O,{t:"Once you deleted this configuration:"})]),h("ul",null,[h("li",null,[y(O,{t:"All connected peers will get disconnected"})]),h("li",null,[y(O,{t:"Both configuration file (.conf) and database table related to this configuration will get deleted"})])]),h("div",{class:it(["alert",[c.value?"alert-secondary":d.value.length>0?"alert-success":"alert-danger"]])},[c.value?(S(),C("div",vx,[p[5]||(p[5]=h("i",{class:"bi bi-search me-2"},null,-1)),y(O,{t:"Checking backups..."})])):d.value.length>0?(S(),C("div",wx,[p[6]||(p[6]=h("i",{class:"bi bi-check-circle-fill me-2"},null,-1)),y(O,{t:"This configuration have "+d.value.length+" backups"},null,8,["t"])])):(S(),C("div",kx,[p[9]||(p[9]=h("i",{class:"bi bi-x-circle-fill me-2"},null,-1)),y(O,{t:"This configuration have no backup"}),h("a",{role:"button",onClick:p[1]||(p[1]=m=>f("backup")),class:"ms-auto btn btn-sm btn-primary rounded-3"},[p[7]||(p[7]=h("i",{class:"bi bi-clock-history me-2"},null,-1)),y(O,{t:"Backup"})]),h("a",{role:"button",onClick:p[2]||(p[2]=m=>u()),class:"btn btn-sm btn-primary rounded-3"},p[8]||(p[8]=[h("i",{class:"bi bi-arrow-clockwise"},null,-1)]))]))],2),p[11]||(p[11]=h("hr",null,null,-1)),h("p",null,[y(O,{t:"If you're sure, please type in the configuration name below and click Delete"})]),K(h("input",{class:"form-control rounded-3 mb-3",placeholder:gs(i),"onUpdate:modelValue":p[3]||(p[3]=m=>n.value=m),type:"text"},null,8,Sx),[[rt,n.value]]),h("button",{class:"btn btn-danger w-100",onClick:p[4]||(p[4]=m=>l()),disabled:n.value!==gs(i)||r.value},[p[10]||(p[10]=h("i",{class:"bi bi-trash-fill me-2 rounded-3"},null,-1)),y(O,{t:"Delete"})],8,Mx)])])])])]))}};Os.register(Ih,As,qh,Uh,Jo,gd,Ko,Xo,bd,md,_d,xd,Vu,Wu,Yu,rf,ai,hf,eu,vu,Cu,$u,Fu);const Cx={name:"peerList",components:{DeleteConfiguration:Px,ConfigurationBackupRestore:ux,SelectPeers:$_,EditConfiguration:s_,LocaleText:O,PeerShareLinkModal:bb,PeerJobsLogsModal:Zm,PeerJobsAllModal:fm,PeerJobs:Jp,PeerCreate:za,PeerQRCode:fp,PeerSettings:sp,PeerSearch:yr,Peer:nl,Line:yf,Bar:xf},setup(){const s=At(),t=Ye(),e=U(void 0);return{dashboardConfigurationStore:s,wireguardConfigurationStore:t,interval:e}},data(){return{configurationToggling:!1,loading:!1,error:null,configurationInfo:[],configurationPeers:[],historyDataSentDifference:[],historyDataReceivedDifference:[],historySentData:{labels:[],datasets:[{label:"Data Sent",data:[],fill:!1,borderColor:"#198754",tension:0}]},historyReceiveData:{labels:[],datasets:[{label:"Data Received",data:[],fill:!1,borderColor:"#0d6efd",tension:0}]},peerSetting:{modalOpen:!1,selectedPeer:void 0},peerScheduleJobs:{modalOpen:!1,selectedPeer:void 0},peerQRCode:{modalOpen:!1,peerConfigData:void 0},peerCreate:{modalOpen:!1},peerScheduleJobsAll:{modalOpen:!1},peerScheduleJobsLogs:{modalOpen:!1},peerShare:{modalOpen:!1,selectedPeer:void 0},editConfiguration:{modalOpen:!1},selectPeers:{modalOpen:!1},backupRestore:{modalOpen:!1},deleteConfiguration:{modalOpen:!1}}},mounted(){},watch:{$route:{immediate:!0,handler(){clearInterval(this.dashboardConfigurationStore.Peers.RefreshInterval),this.loading=!0;let s=this.$route.params.id;this.configurationInfo=[],this.configurationPeers=[],s&&(this.getPeers(s),this.setPeerInterval())}},"dashboardConfigurationStore.Configuration.Server.dashboard_refresh_interval"(){clearInterval(this.dashboardConfigurationStore.Peers.RefreshInterval),this.setPeerInterval()}},beforeRouteLeave(){clearInterval(this.dashboardConfigurationStore.Peers.RefreshInterval)},methods:{toggle(){this.configurationToggling=!0,$t("/api/toggleWireguardConfiguration/",{configurationName:this.configurationInfo.Name},s=>{s.status?this.dashboardConfigurationStore.newMessage("Server",`${this.configurationInfo.Name} ${s.data?"is on":"is off"}`,"success"):this.dashboardConfigurationStore.newMessage("Server",s.message,"danger"),this.configurationInfo.Status=s.data,this.configurationToggling=!1})},getPeers(s=this.$route.params.id){$t("/api/getWireguardConfigurationInfo",{configurationName:s},t=>{if(this.configurationInfo=t.data.configurationInfo,this.configurationPeers=t.data.configurationPeers,this.configurationPeers.forEach(e=>{e.restricted=!1}),t.data.configurationRestrictedPeers.forEach(e=>{e.restricted=!0,this.configurationPeers.push(e)}),this.loading=!1,this.configurationPeers.length>0){const e=this.configurationPeers.map(n=>n.total_sent+n.cumu_sent).reduce((n,o)=>n+o).toFixed(4),i=this.configurationPeers.map(n=>n.total_receive+n.cumu_receive).reduce((n,o)=>n+o).toFixed(4);this.historyDataSentDifference[this.historyDataSentDifference.length-1]!==e&&(this.historyDataSentDifference.length>0&&(this.historySentData={labels:[...this.historySentData.labels,Ut().format("HH:mm:ss A")],datasets:[{label:"Data Sent",data:[...this.historySentData.datasets[0].data,((e-this.historyDataSentDifference[this.historyDataSentDifference.length-1])*1e3).toFixed(4)],fill:!1,borderColor:"#198754",tension:0}]}),this.historyDataSentDifference.push(e)),this.historyDataReceivedDifference[this.historyDataReceivedDifference.length-1]!==i&&(this.historyDataReceivedDifference.length>0&&(this.historyReceiveData={labels:[...this.historyReceiveData.labels,Ut().format("HH:mm:ss A")],datasets:[{label:"Data Received",data:[...this.historyReceiveData.datasets[0].data,((i-this.historyDataReceivedDifference[this.historyDataReceivedDifference.length-1])*1e3).toFixed(4)],fill:!1,borderColor:"#0d6efd",tension:0}]}),this.historyDataReceivedDifference.push(i))}})},setPeerInterval(){this.dashboardConfigurationStore.Peers.RefreshInterval=setInterval(()=>{this.getPeers()},parseInt(this.dashboardConfigurationStore.Configuration.Server.dashboard_refresh_interval))}},computed:{configurationSummary(){return{connectedPeers:this.configurationPeers.filter(t=>t.status==="running").length,totalUsage:this.configurationPeers.length>0?this.configurationPeers.filter(t=>!t.restricted).map(t=>t.total_data+t.cumu_data).reduce((t,e)=>t+e,0).toFixed(4):0,totalReceive:this.configurationPeers.length>0?this.configurationPeers.filter(t=>!t.restricted).map(t=>t.total_receive+t.cumu_receive).reduce((t,e)=>t+e,0).toFixed(4):0,totalSent:this.configurationPeers.length>0?this.configurationPeers.filter(t=>!t.restricted).map(t=>t.total_sent+t.cumu_sent).reduce((t,e)=>t+e,0).toFixed(4):0}},receiveData(){return this.historyReceiveData},sentData(){return this.historySentData},individualDataUsage(){return{labels:this.configurationPeers.map(s=>s.name?s.name:`Untitled Peer - ${s.id}`),datasets:[{label:"Total Data Usage",data:this.configurationPeers.map(s=>s.cumu_data+s.total_data),backgroundColor:this.configurationPeers.map(s=>"#0dcaf0"),tooltip:{callbacks:{label:s=>`${s.formattedValue} GB`}}}]}},individualDataUsageChartOption(){return{responsive:!0,plugins:{legend:{display:!1}},scales:{x:{ticks:{display:!1},grid:{display:!1}},y:{ticks:{callback:(s,t)=>`${s} GB`},grid:{display:!1}}}}},chartOptions(){return{responsive:!0,plugins:{legend:{display:!1},tooltip:{callbacks:{label:s=>`${s.formattedValue} MB/s`}}},scales:{x:{ticks:{display:!1},grid:{display:!1}},y:{ticks:{callback:(s,t)=>`${s} MB/s`},grid:{display:!1}}}}},searchPeers(){new we(this.configurationPeers,{keys:["name","id","allowed_ip"]});const s=this.wireguardConfigurationStore.searchString?this.configurationPeers.filter(t=>t.name.includes(this.wireguardConfigurationStore.searchString)||t.id.includes(this.wireguardConfigurationStore.searchString)||t.allowed_ip.includes(this.wireguardConfigurationStore.searchString)):this.configurationPeers;return this.dashboardConfigurationStore.Configuration.Server.dashboard_sort==="restricted"?s.slice().sort((t,e)=>t[this.dashboardConfigurationStore.Configuration.Server.dashboard_sort]e[this.dashboardConfigurationStore.Configuration.Server.dashboard_sort]?-1:0):s.slice().sort((t,e)=>t[this.dashboardConfigurationStore.Configuration.Server.dashboard_sort]e[this.dashboardConfigurationStore.Configuration.Server.dashboard_sort]?1:0)}}},Dx={key:0,class:"container-md"},$x={class:"d-flex align-items-center"},Ox={CLASS:"text-muted"},Ax={class:"d-flex align-items-center gap-3"},Lx={class:"mb-0 display-4"},Tx={class:"card rounded-3 bg-transparent shadow-sm ms-auto"},Rx={class:"card-body py-2 d-flex align-items-center"},Ix={class:"mb-0 text-muted"},Ex={class:"form-check form-switch ms-auto"},Fx=["for"],Bx={key:4,class:"spinner-border spinner-border-sm ms-2","aria-hidden":"true"},zx=["disabled","id"],Nx={class:"row mt-3 gy-2 gx-2 mb-2"},Vx={class:"col-12 col-lg-3"},jx={class:"card rounded-3 bg-transparent shadow-sm"},Wx={class:"card-body py-2"},Hx={class:"mb-0 text-muted"},Ux={class:"col-12 col-lg-3"},Yx={class:"card rounded-3 bg-transparent shadow-sm"},Jx={class:"card-body py-2"},Kx={class:"mb-0 text-muted"},Xx={style:{"word-break":"break-all"},class:"col-12 col-lg-6"},Gx={class:"card rounded-3 bg-transparent shadow-sm"},qx={class:"card-body py-2"},Qx={class:"mb-0 text-muted"},Zx={class:"row gx-2 gy-2 mb-2"},t0={class:"col-12 col-lg-3"},e0={class:"card rounded-3 bg-transparent shadow-sm"},s0={class:"card-body d-flex"},i0={class:"mb-0 text-muted"},n0={class:"h4"},o0={class:"col-12 col-lg-3"},a0={class:"card rounded-3 bg-transparent shadow-sm"},r0={class:"card-body d-flex"},l0={class:"mb-0 text-muted"},c0={class:"h4"},d0={class:"col-12 col-lg-3"},h0={class:"card rounded-3 bg-transparent shadow-sm"},u0={class:"card-body d-flex"},f0={class:"mb-0 text-muted"},g0={class:"h4 text-primary"},p0={class:"col-12 col-lg-3"},m0={class:"card rounded-3 bg-transparent shadow-sm"},b0={class:"card-body d-flex"},_0={class:"mb-0 text-muted"},x0={class:"h4 text-success"},y0={class:"row gx-2 gy-2 mb-3"},v0={class:"col-12 col-lg-6"},w0={class:"card rounded-3 bg-transparent shadow-sm",style:{height:"270px"}},k0={class:"card-header bg-transparent border-0"},S0={class:"text-muted"},M0={class:"card-body pt-1"},P0={class:"col-sm col-lg-3"},C0={class:"card rounded-3 bg-transparent shadow-sm",style:{height:"270px"}},D0={class:"card-header bg-transparent border-0"},$0={class:"text-muted"},O0={class:"card-body pt-1"},A0={class:"col-sm col-lg-3"},L0={class:"card rounded-3 bg-transparent shadow-sm",style:{height:"270px"}},T0={class:"card-header bg-transparent border-0"},R0={class:"text-muted"},I0={class:"card-body pt-1"},E0={class:"mb-3"};function F0(s,t,e,i,n,o){const a=V("LocaleText"),r=V("Bar"),l=V("Line"),c=V("PeerSearch"),d=V("Peer"),u=V("PeerSettings"),f=V("PeerQRCode"),g=V("PeerJobs"),p=V("PeerJobsAllModal"),m=V("PeerJobsLogsModal"),b=V("PeerShareLinkModal"),_=V("EditConfiguration"),w=V("SelectPeers"),k=V("DeleteConfiguration"),v=V("ConfigurationBackupRestore");return this.loading?T("",!0):(S(),C("div",Dx,[h("div",$x,[h("div",null,[h("small",Ox,[y(a,{t:"CONFIGURATION"})]),h("div",Ax,[h("h1",Lx,[h("samp",null,F(this.configurationInfo.Name),1)])])]),h("div",Tx,[h("div",Rx,[h("div",null,[h("p",Ix,[h("small",null,[y(a,{t:"Status"})])]),h("div",Ex,[h("label",{class:"form-check-label",style:{cursor:"pointer"},for:"switch"+this.configurationInfo.id},[!this.configurationInfo.Status&&this.configurationToggling?(S(),j(a,{key:0,t:"Turning Off..."})):this.configurationInfo.Status&&this.configurationToggling?(S(),j(a,{key:1,t:"Turning On..."})):this.configurationInfo.Status&&!this.configurationToggling?(S(),j(a,{key:2,t:"On"})):!this.configurationInfo.Status&&!this.configurationToggling?(S(),j(a,{key:3,t:"Off"})):T("",!0),this.configurationToggling?(S(),C("span",Bx)):T("",!0)],8,Fx),K(h("input",{class:"form-check-input",style:{cursor:"pointer"},disabled:this.configurationToggling,type:"checkbox",role:"switch",id:"switch"+this.configurationInfo.id,onChange:t[0]||(t[0]=x=>this.toggle()),"onUpdate:modelValue":t[1]||(t[1]=x=>this.configurationInfo.Status=x)},null,40,zx),[[be,this.configurationInfo.Status]])])]),h("div",{class:it(["dot ms-5",{active:this.configurationInfo.Status}])},null,2)])])]),t[31]||(t[31]=h("hr",null,null,-1)),h("div",Nx,[h("div",Vx,[h("div",jx,[h("div",Wx,[h("p",Hx,[h("small",null,[y(a,{t:"Address"})])]),st(" "+F(this.configurationInfo.Address),1)])])]),h("div",Ux,[h("div",Yx,[h("div",Jx,[h("p",Kx,[h("small",null,[y(a,{t:"Listen Port"})])]),st(" "+F(this.configurationInfo.ListenPort),1)])])]),h("div",Xx,[h("div",Gx,[h("div",qx,[h("p",Qx,[h("small",null,[y(a,{t:"Public Key"})])]),h("samp",null,F(this.configurationInfo.PublicKey),1)])])])]),h("div",Zx,[h("div",t0,[h("div",e0,[h("div",s0,[h("div",null,[h("p",i0,[h("small",null,[y(a,{t:"Connected Peers"})])]),h("strong",n0,F(o.configurationSummary.connectedPeers)+" / "+F(n.configurationPeers.length),1)]),t[27]||(t[27]=h("i",{class:"bi bi-ethernet ms-auto h2 text-muted"},null,-1))])])]),h("div",o0,[h("div",a0,[h("div",r0,[h("div",null,[h("p",l0,[h("small",null,[y(a,{t:"Total Usage"})])]),h("strong",c0,F(o.configurationSummary.totalUsage)+" GB",1)]),t[28]||(t[28]=h("i",{class:"bi bi-arrow-down-up ms-auto h2 text-muted"},null,-1))])])]),h("div",d0,[h("div",h0,[h("div",u0,[h("div",null,[h("p",f0,[h("small",null,[y(a,{t:"Total Received"})])]),h("strong",g0,F(o.configurationSummary.totalReceive)+" GB",1)]),t[29]||(t[29]=h("i",{class:"bi bi-arrow-down ms-auto h2 text-muted"},null,-1))])])]),h("div",p0,[h("div",m0,[h("div",b0,[h("div",null,[h("p",_0,[h("small",null,[y(a,{t:"Total Sent"})])]),h("strong",x0,F(o.configurationSummary.totalSent)+" GB",1)]),t[30]||(t[30]=h("i",{class:"bi bi-arrow-up ms-auto h2 text-muted"},null,-1))])])])]),h("div",y0,[h("div",v0,[h("div",w0,[h("div",k0,[h("small",S0,[y(a,{t:"Peers Data Usage"})])]),h("div",M0,[y(r,{data:o.individualDataUsage,options:o.individualDataUsageChartOption,style:{width:"100%",height:"200px","max-height":"200px"}},null,8,["data","options"])])])]),h("div",P0,[h("div",C0,[h("div",D0,[h("small",$0,[y(a,{t:"Real Time Received Data Usage"})])]),h("div",O0,[y(l,{options:o.chartOptions,data:o.receiveData,style:{width:"100%",height:"200px","max-height":"200px"}},null,8,["options","data"])])])]),h("div",A0,[h("div",L0,[h("div",T0,[h("small",R0,[y(a,{t:"Real Time Sent Data Usage"})])]),h("div",I0,[y(l,{options:o.chartOptions,data:o.sentData,style:{width:"100%",height:"200px","max-height":"200px"}},null,8,["options","data"])])])])]),h("div",E0,[y(c,{onJobsAll:t[2]||(t[2]=x=>this.peerScheduleJobsAll.modalOpen=!0),onJobLogs:t[3]||(t[3]=x=>this.peerScheduleJobsLogs.modalOpen=!0),onEditConfiguration:t[4]||(t[4]=x=>this.editConfiguration.modalOpen=!0),onSelectPeers:t[5]||(t[5]=x=>this.selectPeers.modalOpen=!0),onBackupRestore:t[6]||(t[6]=x=>this.backupRestore.modalOpen=!0),onDeleteConfiguration:t[7]||(t[7]=x=>this.deleteConfiguration.modalOpen=!0),configuration:this.configurationInfo},null,8,["configuration"]),y(gi,{name:"list",tag:"div",class:"row gx-2 gy-2 z-0"},{default:nt(()=>[(S(!0),C(ct,null,Ot(this.searchPeers,x=>(S(),C("div",{class:"col-12 col-lg-6 col-xl-4",key:x.id},[y(d,{Peer:x,onShare:M=>{this.peerShare.selectedPeer=x.id,this.peerShare.modalOpen=!0},onRefresh:t[8]||(t[8]=M=>this.getPeers()),onJobs:M=>{n.peerScheduleJobs.modalOpen=!0,n.peerScheduleJobs.selectedPeer=this.configurationPeers.find(P=>P.id===x.id)},onSetting:M=>{n.peerSetting.modalOpen=!0,n.peerSetting.selectedPeer=this.configurationPeers.find(P=>P.id===x.id)},onQrcode:t[9]||(t[9]=M=>{this.peerQRCode.peerConfigData=M,this.peerQRCode.modalOpen=!0})},null,8,["Peer","onShare","onJobs","onSetting"])]))),128))]),_:1})]),y(gt,{name:"zoom"},{default:nt(()=>[this.peerSetting.modalOpen?(S(),j(u,{key:"settings",selectedPeer:this.peerSetting.selectedPeer,onRefresh:t[10]||(t[10]=x=>this.getPeers()),onClose:t[11]||(t[11]=x=>this.peerSetting.modalOpen=!1)},null,8,["selectedPeer"])):T("",!0)]),_:1}),y(gt,{name:"zoom"},{default:nt(()=>[n.peerQRCode.modalOpen?(S(),j(f,{peerConfigData:this.peerQRCode.peerConfigData,key:"qrcode",onClose:t[12]||(t[12]=x=>this.peerQRCode.modalOpen=!1)},null,8,["peerConfigData"])):T("",!0)]),_:1}),y(gt,{name:"zoom"},{default:nt(()=>[this.peerScheduleJobs.modalOpen?(S(),j(g,{key:0,onRefresh:t[13]||(t[13]=x=>this.getPeers()),selectedPeer:this.peerScheduleJobs.selectedPeer,onClose:t[14]||(t[14]=x=>this.peerScheduleJobs.modalOpen=!1)},null,8,["selectedPeer"])):T("",!0)]),_:1}),y(gt,{name:"zoom"},{default:nt(()=>[this.peerScheduleJobsAll.modalOpen?(S(),j(p,{key:0,onRefresh:t[15]||(t[15]=x=>this.getPeers()),onClose:t[16]||(t[16]=x=>this.peerScheduleJobsAll.modalOpen=!1),configurationPeers:this.configurationPeers},null,8,["configurationPeers"])):T("",!0)]),_:1}),y(gt,{name:"zoom"},{default:nt(()=>[this.peerScheduleJobsLogs.modalOpen?(S(),j(m,{key:0,onClose:t[17]||(t[17]=x=>this.peerScheduleJobsLogs.modalOpen=!1),configurationInfo:this.configurationInfo},null,8,["configurationInfo"])):T("",!0)]),_:1}),y(gt,{name:"zoom"},{default:nt(()=>[this.peerShare.modalOpen?(S(),j(b,{key:0,onClose:t[18]||(t[18]=x=>{this.peerShare.modalOpen=!1,this.peerShare.selectedPeer=void 0}),peer:this.configurationPeers.find(x=>x.id===this.peerShare.selectedPeer)},null,8,["peer"])):T("",!0)]),_:1}),y(gt,{name:"zoom"},{default:nt(()=>[this.editConfiguration.modalOpen?(S(),j(_,{key:0,onClose:t[19]||(t[19]=x=>this.editConfiguration.modalOpen=!1),onDataChanged:t[20]||(t[20]=x=>this.configurationInfo=x),configurationInfo:this.configurationInfo},null,8,["configurationInfo"])):T("",!0)]),_:1}),y(gt,{name:"zoom"},{default:nt(()=>[this.selectPeers.modalOpen?(S(),j(w,{key:0,onRefresh:t[21]||(t[21]=x=>this.getPeers()),configurationPeers:this.configurationPeers,onClose:t[22]||(t[22]=x=>this.selectPeers.modalOpen=!1)},null,8,["configurationPeers"])):T("",!0)]),_:1}),y(gt,{name:"zoom"},{default:nt(()=>[n.deleteConfiguration.modalOpen?(S(),j(k,{key:0,onBackup:t[23]||(t[23]=x=>n.backupRestore.modalOpen=!0),onClose:t[24]||(t[24]=x=>n.deleteConfiguration.modalOpen=!1)})):T("",!0)]),_:1}),y(gt,{name:"zoom"},{default:nt(()=>[n.backupRestore.modalOpen?(S(),j(v,{key:0,onClose:t[25]||(t[25]=x=>n.backupRestore.modalOpen=!1),onRefreshPeersList:t[26]||(t[26]=x=>this.getPeers())})):T("",!0)]),_:1})]))}const J0=pt(Cx,[["render",F0],["__scopeId","data-v-7a0360ac"]]);export{J0 as default};