Files
CloudFlare-ImgBed/js/226.478c43ad.js
2026-01-24 15:15:53 +08:00

23 lines
302 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

"use strict";(self["webpackChunksanyue_imghub"]=self["webpackChunksanyue_imghub"]||[]).push([[226],{333:function(t,e,i){i(5331),i(6711)},415:function(t,e,i){i(5331),i(3565)},694:function(t,e,i){i(5331)},1114:function(t,e,i){function s(t){return s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},s(t)}function n(t,e){if("object"!=s(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,e||"default");if("object"!=s(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}function a(t){var e=n(t,"string");return"symbol"==s(e)?e:e+""}function o(t,e,i){return(e=a(e))in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}i.d(e,{A:function(){return o}})},2893:function(t,e,i){i(5331)},3565:function(t,e,i){i(5331)},4752:function(t,e,i){i(5331),i(8736),i(8785)},5226:function(t,e,i){i.r(e),i.d(e,{default:function(){return Yu}});var s=i(6768),n=i(4232);const a={class:"menu-list"},o=["onClick"],r={class:"menu-text"};function l(t,e,i,l,h,c){const d=(0,s.g2)("font-awesome-icon");return(0,s.uX)(),(0,s.CE)("div",{class:(0,n.C4)(["sidebar-container",{"is-collapsed":i.isCollapse}])},[(0,s.Lk)("div",a,[((0,s.uX)(!0),(0,s.CE)(s.FK,null,(0,s.pI)(h.menuItems,t=>((0,s.uX)(),(0,s.CE)("div",{key:t.index,class:(0,n.C4)(["menu-item",{"is-active":i.activeIndex===t.index}]),onClick:e=>c.handleSelect(t.index)},[(0,s.bF)(d,{icon:t.icon,class:"menu-icon"},null,8,["icon"]),(0,s.Lk)("span",r,(0,n.v_)(t.title),1)],10,o))),128))]),(0,s.Lk)("div",{class:"toggle-button",onClick:e[0]||(e[0]=(...t)=>c.toggleCollapse&&c.toggleCollapse(...t))},[(0,s.bF)(d,{icon:i.isCollapse?"angle-double-right":"angle-double-left"},null,8,["icon"])])],2)}var h={name:"SysConfigTabs",props:{activeIndex:{type:String,default:"status"},isCollapse:{type:Boolean,default:!1}},data(){return{menuItems:[{index:"status",icon:"chart-bar",title:"系统状态"},{index:"upload",icon:"cloud-upload",title:"上传设置"},{index:"security",icon:"shield",title:"安全设置"},{index:"page",icon:"pager",title:"网页设置"},{index:"others",icon:"cog",title:"其他设置"}]}},methods:{toggleCollapse(){this.$emit("update:isCollapse",!this.isCollapse)},checkMobile(){const t=window.innerWidth<=768;this.$emit("update:isCollapse",t)},handleSelect(t){this.$emit("update:activeIndex",t)}},mounted(){this.checkMobile(),window.addEventListener("resize",this.checkMobile)},beforeDestroy(){window.removeEventListener("resize",this.checkMobile)}},c=i(1241);const d=(0,c.A)(h,[["render",l],["__scopeId","data-v-5bb00686"]]);var u=d,g=i(4880),p=(i(5331),i(7128),i(8507)),f=(i(213),i(6011));const m={class:"container"},b={class:"header-content"},x={class:"header-action"};function y(t,e,i,a,o,r){const l=f.A,h=(0,s.g2)("font-awesome-icon"),c=p.R7,d=g.bZ,y=u;return(0,s.uX)(),(0,s.CE)("div",m,[(0,s.bF)(d,null,{default:(0,s.k6)(()=>[(0,s.Lk)("div",b,[(0,s.bF)(l,{activeTab:"systemConfig"}),(0,s.Lk)("div",x,[(0,s.bF)(c,{disabled:r.disableTooltip,content:"退出登录",placement:"bottom"},{default:(0,s.k6)(()=>[(0,s.bF)(h,{icon:"sign-out-alt",class:"header-icon",onClick:r.handleLogout},null,8,["onClick"])]),_:1},8,["disabled"])])])]),_:1}),(0,s.bF)(y,{activeIndex:o.activeIndex,"onUpdate:activeIndex":e[0]||(e[0]=t=>o.activeIndex=t),isCollapse:o.isSidebarCollapse,"onUpdate:isCollapse":e[1]||(e[1]=t=>o.isSidebarCollapse=t)},null,8,["activeIndex","isCollapse"]),((0,s.uX)(),(0,s.Wv)((0,s.$y)(r.currentComponent),{class:(0,n.C4)(["main-container",{collapsed:o.isSidebarCollapse}])},null,8,["class"]))])}i(4114);var _=i(9114),v=(i(694),i(7009)),k=(i(8450),i(47)),w=(i(9648),i(9655));i(2893);const C={class:"status-panel"},S={class:"overview-cards"},F={class:"card-icon"},M={class:"card-content"},A={class:"card-value"},T={class:"overview-card index-status"},P={class:"card-icon"},D={class:"card-content"},E={class:"card-value"},L={class:"card-subtitle"},I={class:"card-icon"},V={class:"card-content"},O={class:"card-value"},R={class:"charts-section"},W={class:"chart-card"},B={class:"chart-header"},z={class:"chart-content"},N={key:0,class:"empty-state"},U={key:1,class:"pie-chart-container"},$={class:"pie-chart-wrapper"},j={class:"chart-center-text"},H={class:"center-value"},X={class:"chart-legend"},q={class:"legend-label"},K={class:"legend-value"},Y={class:"legend-percent"},Q={class:"chart-card"},G={class:"chart-header"},J={class:"chart-content"},Z={key:0,class:"empty-state"},tt={key:1,class:"pie-chart-container"},et={class:"pie-chart-wrapper"},it={class:"chart-center-text"},st={class:"center-value"},nt={class:"chart-legend"},at={class:"legend-label"},ot={class:"legend-value"},rt={class:"legend-percent"},lt={class:"actions-section"},ht={class:"action-card"},ct={class:"action-header"},dt={class:"action-content"},ut={key:0,class:"progress-container"},gt={class:"progress-header"},pt={class:"progress-phase"},ft={class:"progress-percentage"},mt={class:"progress-details"},bt={key:0,class:"progress-count"},xt={key:1,class:"progress-time"},yt={key:0,class:"progress-message"},_t={key:1,class:"error-container"},vt={class:"error-icon"},kt={class:"error-content"},wt={class:"error-message"},Ct={key:0,class:"error-suggestion"},St={class:"error-actions"},Ft={key:2,class:"action-buttons"},Mt={class:"restore-section"},At={key:0,class:"file-info-section"},Tt=["src"],Pt={key:2,class:"card-bg-fallback"},Dt={class:"file-card-header"},Et={class:"info-card-footer"},Lt={class:"file-name"},It={class:"file-meta"},Vt=["src"],Ot={key:2,class:"card-bg-fallback"},Rt={class:"file-card-header warning"},Wt={class:"info-card-footer"},Bt={class:"file-name"},zt={class:"file-meta"};function Nt(t,e,i,a,o,r){const l=(0,s.g2)("font-awesome-icon"),h=(0,s.g2)("Doughnut"),c=w.ve,d=k.S2,u=p.R7,g=v.Zq,f=_.A;return(0,s.bo)(((0,s.uX)(),(0,s.CE)("div",C,[(0,s.Lk)("div",S,[(0,s.Lk)("div",{class:"overview-card total-files",onClick:e[0]||(e[0]=(...t)=>r.fetchIndexInfo&&r.fetchIndexInfo(...t))},[(0,s.Lk)("div",F,[(0,s.bF)(l,{icon:"database"})]),(0,s.Lk)("div",M,[e[9]||(e[9]=(0,s.Lk)("div",{class:"card-title"},"文件总数",-1)),(0,s.Lk)("div",A,(0,n.v_)(o.indexInfo.totalFiles?.toLocaleString()||"0"),1),e[10]||(e[10]=(0,s.Lk)("div",{class:"card-subtitle"},"点击刷新",-1))])]),(0,s.Lk)("div",T,[(0,s.Lk)("div",P,[(0,s.bF)(l,{icon:"clock"})]),(0,s.Lk)("div",D,[e[11]||(e[11]=(0,s.Lk)("div",{class:"card-title"},"索引更新时间",-1)),(0,s.Lk)("div",E,(0,n.v_)(r.formatTime(o.indexInfo.lastUpdated)),1),(0,s.Lk)("div",L,(0,n.v_)(r.getTimeAgo(o.indexInfo.lastUpdated)),1)])]),(0,s.Lk)("div",{class:"overview-card system-version",onClick:e[1]||(e[1]=(...t)=>r.openReleases&&r.openReleases(...t))},[(0,s.Lk)("div",I,[(0,s.bF)(l,{icon:"code-branch"})]),(0,s.Lk)("div",V,[e[12]||(e[12]=(0,s.Lk)("div",{class:"card-title"},"系统版本",-1)),(0,s.Lk)("div",O,"v"+(0,n.v_)(o.version),1),e[13]||(e[13]=(0,s.Lk)("div",{class:"card-subtitle"},"点击查看更新日志",-1))])])]),(0,s.Lk)("div",R,[(0,s.Lk)("div",W,[(0,s.Lk)("div",B,[(0,s.bF)(l,{icon:"share-alt"}),e[14]||(e[14]=(0,s.Lk)("span",null,"上传渠道分布",-1))]),(0,s.Lk)("div",z,[0===Object.keys(o.indexInfo.channelStats||{}).length?((0,s.uX)(),(0,s.CE)("div",N,[(0,s.bF)(l,{icon:"inbox"}),e[15]||(e[15]=(0,s.Lk)("span",null,"暂无数据",-1))])):((0,s.uX)(),(0,s.CE)("div",U,[(0,s.Lk)("div",$,[(0,s.bF)(h,{data:r.channelChartData,options:r.chartOptions},null,8,["data","options"]),(0,s.Lk)("div",j,[(0,s.Lk)("div",H,(0,n.v_)(o.indexInfo.totalFiles?.toLocaleString()||"0"),1),e[16]||(e[16]=(0,s.Lk)("div",{class:"center-label"},"文件总数",-1))])]),(0,s.Lk)("div",X,[((0,s.uX)(!0),(0,s.CE)(s.FK,null,(0,s.pI)(o.indexInfo.channelStats,(t,e,i)=>((0,s.uX)(),(0,s.CE)("div",{key:e,class:"legend-item"},[(0,s.Lk)("span",{class:"legend-color",style:(0,n.Tr)({background:r.getChartColor(i)})},null,4),(0,s.Lk)("span",q,(0,n.v_)(e),1),(0,s.Lk)("span",K,(0,n.v_)(t.toLocaleString()),1),(0,s.Lk)("span",Y,(0,n.v_)(r.getPercentage(t,o.indexInfo.totalFiles))+"%",1)]))),128))])]))])]),(0,s.Lk)("div",Q,[(0,s.Lk)("div",G,[(0,s.bF)(l,{icon:"file-alt"}),e[17]||(e[17]=(0,s.Lk)("span",null,"文件状态分布",-1))]),(0,s.Lk)("div",J,[0===Object.keys(o.indexInfo.typeStats||{}).length?((0,s.uX)(),(0,s.CE)("div",Z,[(0,s.bF)(l,{icon:"inbox"}),e[18]||(e[18]=(0,s.Lk)("span",null,"暂无数据",-1))])):((0,s.uX)(),(0,s.CE)("div",tt,[(0,s.Lk)("div",et,[(0,s.bF)(h,{data:r.typeChartData,options:r.chartOptions},null,8,["data","options"]),(0,s.Lk)("div",it,[(0,s.Lk)("div",st,(0,n.v_)(Object.keys(o.indexInfo.typeStats).length),1),e[19]||(e[19]=(0,s.Lk)("div",{class:"center-label"},"状态类型",-1))])]),(0,s.Lk)("div",nt,[((0,s.uX)(!0),(0,s.CE)(s.FK,null,(0,s.pI)(r.aggregatedTypeStats,(t,e,i)=>((0,s.uX)(),(0,s.CE)("div",{key:e,class:"legend-item"},[(0,s.Lk)("span",{class:"legend-color",style:(0,n.Tr)({background:r.getTypeChartColor(i)})},null,4),(0,s.Lk)("span",at,(0,n.v_)(e),1),(0,s.Lk)("span",ot,(0,n.v_)(t.toLocaleString()),1),(0,s.Lk)("span",rt,(0,n.v_)(r.getPercentage(t,o.indexInfo.totalFiles))+"%",1)]))),128))])]))])])]),(0,s.Lk)("div",lt,[(0,s.Lk)("div",ht,[(0,s.Lk)("div",ct,[(0,s.bF)(l,{icon:"tools"}),e[20]||(e[20]=(0,s.Lk)("span",null,"系统维护",-1))]),(0,s.Lk)("div",dt,[o.isProcessing?((0,s.uX)(),(0,s.CE)("div",ut,[(0,s.Lk)("div",gt,[(0,s.Lk)("span",pt,(0,n.v_)(r.phaseDescription),1),(0,s.Lk)("span",ft,(0,n.v_)(Math.round(o.processingProgress.percentage))+"%",1)]),(0,s.bF)(c,{percentage:o.processingProgress.percentage,"stroke-width":12,"show-text":!1,class:"progress-bar"},null,8,["percentage"]),(0,s.Lk)("div",mt,[o.processingProgress.current>0?((0,s.uX)(),(0,s.CE)("span",bt,[(0,s.bF)(l,{icon:"file-alt"}),(0,s.eW)(" "+(0,n.v_)(o.processingProgress.current.toLocaleString())+" ",1),o.processingProgress.total>0?((0,s.uX)(),(0,s.CE)(s.FK,{key:0},[(0,s.eW)(" / "+(0,n.v_)(o.processingProgress.total.toLocaleString()),1)],64)):(0,s.Q3)("",!0),e[21]||(e[21]=(0,s.eW)(" 条记录 ",-1))])):(0,s.Q3)("",!0),r.estimatedTimeRemaining?((0,s.uX)(),(0,s.CE)("span",xt,[(0,s.bF)(l,{icon:"clock"}),(0,s.eW)(" "+(0,n.v_)(r.estimatedTimeRemaining),1)])):(0,s.Q3)("",!0)]),o.processingProgress.message?((0,s.uX)(),(0,s.CE)("div",yt,(0,n.v_)(o.processingProgress.message),1)):(0,s.Q3)("",!0),(0,s.bF)(d,{type:"danger",plain:"",size:"small",onClick:r.cancelOperation,class:"cancel-btn"},{default:(0,s.k6)(()=>[(0,s.bF)(l,{icon:"times"}),e[22]||(e[22]=(0,s.eW)(" 取消操作 ",-1))]),_:1},8,["onClick"])])):o.processingError?((0,s.uX)(),(0,s.CE)("div",_t,[(0,s.Lk)("div",vt,[(0,s.bF)(l,{icon:"exclamation-triangle"})]),(0,s.Lk)("div",kt,[(0,s.Lk)("div",wt,(0,n.v_)(o.processingError.message),1),o.processingError.suggestion?((0,s.uX)(),(0,s.CE)("div",Ct,(0,n.v_)(o.processingError.suggestion),1)):(0,s.Q3)("",!0)]),(0,s.Lk)("div",St,[o.processingError.recoverable?((0,s.uX)(),(0,s.Wv)(d,{key:0,type:"primary",size:"small",onClick:r.retryOperation},{default:(0,s.k6)(()=>[(0,s.bF)(l,{icon:"redo"}),e[23]||(e[23]=(0,s.eW)(" 重试 ",-1))]),_:1},8,["onClick"])):(0,s.Q3)("",!0),(0,s.bF)(d,{type:"default",size:"small",onClick:r.dismissError},{default:(0,s.k6)(()=>[...e[24]||(e[24]=[(0,s.eW)(" 关闭 ",-1)])]),_:1},8,["onClick"])])])):((0,s.uX)(),(0,s.CE)("div",Ft,[(0,s.bF)(u,{content:"重新扫描所有文件并更新索引数据,适用于数据不一致时的修复",placement:"top"},{default:(0,s.k6)(()=>[(0,s.bF)(d,{type:"primary",loading:o.rebuilding,disabled:o.isProcessing,onClick:r.rebuildIndex,class:"action-btn rebuild-btn"},{default:(0,s.k6)(()=>[(0,s.bF)(l,{icon:"sync-alt"}),(0,s.eW)(" "+(0,n.v_)(o.rebuilding?"重建中...":"重建索引"),1)]),_:1},8,["loading","disabled","onClick"])]),_:1}),(0,s.bF)(u,{content:"备份所有文件元数据和系统设置到JSON文件",placement:"top"},{default:(0,s.k6)(()=>[(0,s.bF)(d,{type:"success",loading:o.backing,disabled:o.isProcessing,onClick:r.backupData,class:"action-btn backup-btn"},{default:(0,s.k6)(()=>[(0,s.bF)(l,{icon:"download"}),(0,s.eW)(" "+(0,n.v_)(o.backing?"备份中...":"备份数据"),1)]),_:1},8,["loading","disabled","onClick"])]),_:1}),(0,s.bF)(u,{content:"从备份文件恢复数据,将覆盖现有的文件元数据和系统设置",placement:"top"},{default:(0,s.k6)(()=>[(0,s.Lk)("div",Mt,[(0,s.Lk)("input",{type:"file",ref:"fileInput",accept:".json",onChange:e[2]||(e[2]=(...t)=>r.handleFileSelect&&r.handleFileSelect(...t)),style:{display:"none"}},null,544),(0,s.bF)(d,{type:"warning",loading:o.restoring,disabled:o.isProcessing,onClick:r.selectRestoreFile,class:"action-btn restore-btn"},{default:(0,s.k6)(()=>[(0,s.bF)(l,{icon:"upload"}),(0,s.eW)(" "+(0,n.v_)(o.restoring?"恢复中...":"恢复数据"),1)]),_:1},8,["loading","disabled","onClick"])])]),_:1})]))])])]),o.indexInfo.newestFile||o.indexInfo.oldestFile?((0,s.uX)(),(0,s.CE)("div",At,[o.indexInfo.newestFile?((0,s.uX)(),(0,s.CE)("div",{key:0,class:"file-info-card info-card-newest",onClick:e[5]||(e[5]=t=>r.openFileInNewTab(o.indexInfo.newestFile))},[r.isImageFile(o.indexInfo.newestFile)&&!o.loadErrors["newest"]?((0,s.uX)(),(0,s.Wv)(g,{key:0,src:"/file/"+o.indexInfo.newestFile.id+"?from=admin",fit:"cover",class:"card-bg-media",onError:e[3]||(e[3]=t=>r.handleImageError("newest"))},null,8,["src"])):r.isVideoFile(o.indexInfo.newestFile)&&!o.loadErrors["newest"]?((0,s.uX)(),(0,s.CE)("video",{key:1,src:"/file/"+o.indexInfo.newestFile.id+"?from=admin",class:"card-bg-media",muted:"",loop:"",autoplay:"",onError:e[4]||(e[4]=t=>r.handleImageError("newest"))},null,40,Tt)):((0,s.uX)(),(0,s.CE)("div",Pt,[(0,s.bF)(l,{icon:"file-alt",class:"fallback-icon"})])),(0,s.Lk)("div",Dt,[(0,s.bF)(l,{icon:"arrow-up"}),e[25]||(e[25]=(0,s.Lk)("span",null,"最近上传",-1))]),(0,s.Lk)("div",Et,[(0,s.Lk)("div",Lt,(0,n.v_)(o.indexInfo.newestFile.metadata?.FileName||o.indexInfo.newestFile.id),1),(0,s.Lk)("div",It,(0,n.v_)(r.formatTime(o.indexInfo.newestFile.metadata?.TimeStamp)),1)])])):(0,s.Q3)("",!0),o.indexInfo.oldestFile?((0,s.uX)(),(0,s.CE)("div",{key:1,class:"file-info-card info-card-oldest",onClick:e[8]||(e[8]=t=>r.openFileInNewTab(o.indexInfo.oldestFile))},[r.isImageFile(o.indexInfo.oldestFile)&&!o.loadErrors["oldest"]?((0,s.uX)(),(0,s.Wv)(g,{key:0,src:"/file/"+o.indexInfo.oldestFile.id+"?from=admin",fit:"cover",class:"card-bg-media",onError:e[6]||(e[6]=t=>r.handleImageError("oldest"))},null,8,["src"])):r.isVideoFile(o.indexInfo.oldestFile)&&!o.loadErrors["oldest"]?((0,s.uX)(),(0,s.CE)("video",{key:1,src:"/file/"+o.indexInfo.oldestFile.id+"?from=admin",class:"card-bg-media",muted:"",loop:"",autoplay:"",onError:e[7]||(e[7]=t=>r.handleImageError("oldest"))},null,40,Vt)):((0,s.uX)(),(0,s.CE)("div",Ot,[(0,s.bF)(l,{icon:"file-alt",class:"fallback-icon"})])),(0,s.Lk)("div",Rt,[(0,s.bF)(l,{icon:"arrow-down"}),e[26]||(e[26]=(0,s.Lk)("span",null,"最早上传",-1))]),(0,s.Lk)("div",Wt,[(0,s.Lk)("div",Bt,(0,n.v_)(o.indexInfo.oldestFile.metadata?.FileName||o.indexInfo.oldestFile.id),1),(0,s.Lk)("div",zt,(0,n.v_)(r.formatTime(o.indexInfo.oldestFile.metadata?.TimeStamp)),1)])])):(0,s.Q3)("",!0)])):(0,s.Q3)("",!0)])),[[f,o.loading]])}i(8111),i(8237),i(8335);var Ut=i(797),$t={rE:"2.5.4"},jt=(i(116),i(1701),i(1114));i(2489),i(7588),i(3579),i(7642),i(8004),i(3853),i(5876),i(2475),i(5024),i(1698),i(3110);
/*!
* @kurkle/color v0.3.4
* https://github.com/kurkle/color#readme
* (c) 2024 Jukka Kurkela
* Released under the MIT License
*/
function Ht(t){return t+.5|0}const Xt=(t,e,i)=>Math.max(Math.min(t,i),e);function qt(t){return Xt(Ht(2.55*t),0,255)}function Kt(t){return Xt(Ht(255*t),0,255)}function Yt(t){return Xt(Ht(t/2.55)/100,0,1)}function Qt(t){return Xt(Ht(100*t),0,100)}const Gt={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},Jt=[..."0123456789ABCDEF"],Zt=t=>Jt[15&t],te=t=>Jt[(240&t)>>4]+Jt[15&t],ee=t=>(240&t)>>4===(15&t),ie=t=>ee(t.r)&&ee(t.g)&&ee(t.b)&&ee(t.a);function se(t){var e,i=t.length;return"#"===t[0]&&(4===i||5===i?e={r:255&17*Gt[t[1]],g:255&17*Gt[t[2]],b:255&17*Gt[t[3]],a:5===i?17*Gt[t[4]]:255}:7!==i&&9!==i||(e={r:Gt[t[1]]<<4|Gt[t[2]],g:Gt[t[3]]<<4|Gt[t[4]],b:Gt[t[5]]<<4|Gt[t[6]],a:9===i?Gt[t[7]]<<4|Gt[t[8]]:255})),e}const ne=(t,e)=>t<255?e(t):"";function ae(t){var e=ie(t)?Zt:te;return t?"#"+e(t.r)+e(t.g)+e(t.b)+ne(t.a,e):void 0}const oe=/^(hsla?|hwb|hsv)\(\s*([-+.e\d]+)(?:deg)?[\s,]+([-+.e\d]+)%[\s,]+([-+.e\d]+)%(?:[\s,]+([-+.e\d]+)(%)?)?\s*\)$/;function re(t,e,i){const s=e*Math.min(i,1-i),n=(e,n=(e+t/30)%12)=>i-s*Math.max(Math.min(n-3,9-n,1),-1);return[n(0),n(8),n(4)]}function le(t,e,i){const s=(s,n=(s+t/60)%6)=>i-i*e*Math.max(Math.min(n,4-n,1),0);return[s(5),s(3),s(1)]}function he(t,e,i){const s=re(t,1,.5);let n;for(e+i>1&&(n=1/(e+i),e*=n,i*=n),n=0;n<3;n++)s[n]*=1-e-i,s[n]+=e;return s}function ce(t,e,i,s,n){return t===n?(e-i)/s+(e<i?6:0):e===n?(i-t)/s+2:(t-e)/s+4}function de(t){const e=255,i=t.r/e,s=t.g/e,n=t.b/e,a=Math.max(i,s,n),o=Math.min(i,s,n),r=(a+o)/2;let l,h,c;return a!==o&&(c=a-o,h=r>.5?c/(2-a-o):c/(a+o),l=ce(i,s,n,c,a),l=60*l+.5),[0|l,h||0,r]}function ue(t,e,i,s){return(Array.isArray(e)?t(e[0],e[1],e[2]):t(e,i,s)).map(Kt)}function ge(t,e,i){return ue(re,t,e,i)}function pe(t,e,i){return ue(he,t,e,i)}function fe(t,e,i){return ue(le,t,e,i)}function me(t){return(t%360+360)%360}function be(t){const e=oe.exec(t);let i,s=255;if(!e)return;e[5]!==i&&(s=e[6]?qt(+e[5]):Kt(+e[5]));const n=me(+e[2]),a=+e[3]/100,o=+e[4]/100;return i="hwb"===e[1]?pe(n,a,o):"hsv"===e[1]?fe(n,a,o):ge(n,a,o),{r:i[0],g:i[1],b:i[2],a:s}}function xe(t,e){var i=de(t);i[0]=me(i[0]+e),i=ge(i),t.r=i[0],t.g=i[1],t.b=i[2]}function ye(t){if(!t)return;const e=de(t),i=e[0],s=Qt(e[1]),n=Qt(e[2]);return t.a<255?`hsla(${i}, ${s}%, ${n}%, ${Yt(t.a)})`:`hsl(${i}, ${s}%, ${n}%)`}const _e={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"},ve={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 ke(){const t={},e=Object.keys(ve),i=Object.keys(_e);let s,n,a,o,r;for(s=0;s<e.length;s++){for(o=r=e[s],n=0;n<i.length;n++)a=i[n],r=r.replace(a,_e[a]);a=parseInt(ve[o],16),t[r]=[a>>16&255,a>>8&255,255&a]}return t}let we;function Ce(t){we||(we=ke(),we.transparent=[0,0,0,0]);const e=we[t.toLowerCase()];return e&&{r:e[0],g:e[1],b:e[2],a:4===e.length?e[3]:255}}const Se=/^rgba?\(\s*([-+.\d]+)(%)?[\s,]+([-+.e\d]+)(%)?[\s,]+([-+.e\d]+)(%)?(?:[\s,/]+([-+.e\d]+)(%)?)?\s*\)$/;function Fe(t){const e=Se.exec(t);let i,s,n,a=255;if(e){if(e[7]!==i){const t=+e[7];a=e[8]?qt(t):Xt(255*t,0,255)}return i=+e[1],s=+e[3],n=+e[5],i=255&(e[2]?qt(i):Xt(i,0,255)),s=255&(e[4]?qt(s):Xt(s,0,255)),n=255&(e[6]?qt(n):Xt(n,0,255)),{r:i,g:s,b:n,a:a}}}function Me(t){return t&&(t.a<255?`rgba(${t.r}, ${t.g}, ${t.b}, ${Yt(t.a)})`:`rgb(${t.r}, ${t.g}, ${t.b})`)}const Ae=t=>t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055,Te=t=>t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4);function Pe(t,e,i){const s=Te(Yt(t.r)),n=Te(Yt(t.g)),a=Te(Yt(t.b));return{r:Kt(Ae(s+i*(Te(Yt(e.r))-s))),g:Kt(Ae(n+i*(Te(Yt(e.g))-n))),b:Kt(Ae(a+i*(Te(Yt(e.b))-a))),a:t.a+i*(e.a-t.a)}}function De(t,e,i){if(t){let s=de(t);s[e]=Math.max(0,Math.min(s[e]+s[e]*i,0===e?360:1)),s=ge(s),t.r=s[0],t.g=s[1],t.b=s[2]}}function Ee(t,e){return t?Object.assign(e||{},t):t}function Le(t){var e={r:0,g:0,b:0,a:255};return Array.isArray(t)?t.length>=3&&(e={r:t[0],g:t[1],b:t[2],a:255},t.length>3&&(e.a=Kt(t[3]))):(e=Ee(t,{r:0,g:0,b:0,a:1}),e.a=Kt(e.a)),e}function Ie(t){return"r"===t.charAt(0)?Fe(t):be(t)}class Ve{constructor(t){if(t instanceof Ve)return t;const e=typeof t;let i;"object"===e?i=Le(t):"string"===e&&(i=se(t)||Ce(t)||Ie(t)),this._rgb=i,this._valid=!!i}get valid(){return this._valid}get rgb(){var t=Ee(this._rgb);return t&&(t.a=Yt(t.a)),t}set rgb(t){this._rgb=Le(t)}rgbString(){return this._valid?Me(this._rgb):void 0}hexString(){return this._valid?ae(this._rgb):void 0}hslString(){return this._valid?ye(this._rgb):void 0}mix(t,e){if(t){const i=this.rgb,s=t.rgb;let n;const a=e===n?.5:e,o=2*a-1,r=i.a-s.a,l=((o*r===-1?o:(o+r)/(1+o*r))+1)/2;n=1-l,i.r=255&l*i.r+n*s.r+.5,i.g=255&l*i.g+n*s.g+.5,i.b=255&l*i.b+n*s.b+.5,i.a=a*i.a+(1-a)*s.a,this.rgb=i}return this}interpolate(t,e){return t&&(this._rgb=Pe(this._rgb,t._rgb,e)),this}clone(){return new Ve(this.rgb)}alpha(t){return this._rgb.a=Kt(t),this}clearer(t){const e=this._rgb;return e.a*=1-t,this}greyscale(){const t=this._rgb,e=Ht(.3*t.r+.59*t.g+.11*t.b);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 De(this._rgb,2,t),this}darken(t){return De(this._rgb,2,-t),this}saturate(t){return De(this._rgb,1,t),this}desaturate(t){return De(this._rgb,1,-t),this}rotate(t){return xe(this._rgb,t),this}}
/*!
* Chart.js v4.5.1
* https://www.chartjs.org
* (c) 2025 Chart.js Contributors
* Released under the MIT License
*/
function Oe(){}const Re=(()=>{let t=0;return()=>t++})();function We(t){return null===t||void 0===t}function Be(t){if(Array.isArray&&Array.isArray(t))return!0;const e=Object.prototype.toString.call(t);return"[object"===e.slice(0,7)&&"Array]"===e.slice(-6)}function ze(t){return null!==t&&"[object Object]"===Object.prototype.toString.call(t)}function Ne(t){return("number"===typeof t||t instanceof Number)&&isFinite(+t)}function Ue(t,e){return Ne(t)?t:e}function $e(t,e){return"undefined"===typeof t?e:t}const je=(t,e)=>"string"===typeof t&&t.endsWith("%")?parseFloat(t)/100:+t/e,He=(t,e)=>"string"===typeof t&&t.endsWith("%")?parseFloat(t)/100*e:+t;function Xe(t,e,i){if(t&&"function"===typeof t.call)return t.apply(i,e)}function qe(t,e,i,s){let n,a,o;if(Be(t))if(a=t.length,s)for(n=a-1;n>=0;n--)e.call(i,t[n],n);else for(n=0;n<a;n++)e.call(i,t[n],n);else if(ze(t))for(o=Object.keys(t),a=o.length,n=0;n<a;n++)e.call(i,t[o[n]],o[n])}function Ke(t,e){let i,s,n,a;if(!t||!e||t.length!==e.length)return!1;for(i=0,s=t.length;i<s;++i)if(n=t[i],a=e[i],n.datasetIndex!==a.datasetIndex||n.index!==a.index)return!1;return!0}function Ye(t){if(Be(t))return t.map(Ye);if(ze(t)){const e=Object.create(null),i=Object.keys(t),s=i.length;let n=0;for(;n<s;++n)e[i[n]]=Ye(t[i[n]]);return e}return t}function Qe(t){return-1===["__proto__","prototype","constructor"].indexOf(t)}function Ge(t,e,i,s){if(!Qe(t))return;const n=e[t],a=i[t];ze(n)&&ze(a)?Je(n,a,s):e[t]=Ye(a)}function Je(t,e,i){const s=Be(e)?e:[e],n=s.length;if(!ze(t))return t;i=i||{};const a=i.merger||Ge;let o;for(let r=0;r<n;++r){if(o=s[r],!ze(o))continue;const e=Object.keys(o);for(let s=0,n=e.length;s<n;++s)a(e[s],t,o,i)}return t}function Ze(t,e){return Je(t,e,{merger:ti})}function ti(t,e,i){if(!Qe(t))return;const s=e[t],n=i[t];ze(s)&&ze(n)?Ze(s,n):Object.prototype.hasOwnProperty.call(e,t)||(e[t]=Ye(n))}const ei={"":t=>t,x:t=>t.x,y:t=>t.y};function ii(t){const e=t.split("."),i=[];let s="";for(const n of e)s+=n,s.endsWith("\\")?s=s.slice(0,-1)+".":(i.push(s),s="");return i}function si(t){const e=ii(t);return t=>{for(const i of e){if(""===i)break;t=t&&t[i]}return t}}function ni(t,e){const i=ei[e]||(ei[e]=si(e));return i(t)}function ai(t){return t.charAt(0).toUpperCase()+t.slice(1)}const oi=t=>"undefined"!==typeof t,ri=t=>"function"===typeof t,li=(t,e)=>{if(t.size!==e.size)return!1;for(const i of t)if(!e.has(i))return!1;return!0};function hi(t){return"mouseup"===t.type||"click"===t.type||"contextmenu"===t.type}const ci=Math.PI,di=2*ci,ui=di+ci,gi=Number.POSITIVE_INFINITY,pi=ci/180,fi=ci/2,mi=ci/4,bi=2*ci/3,xi=Math.log10,yi=Math.sign;function _i(t,e,i){return Math.abs(t-e)<i}function vi(t){const e=Math.round(t);t=_i(t,e,t/1e3)?e:t;const i=Math.pow(10,Math.floor(xi(t))),s=t/i,n=s<=1?1:s<=2?2:s<=5?5:10;return n*i}function ki(t){const e=[],i=Math.sqrt(t);let s;for(s=1;s<i;s++)t%s===0&&(e.push(s),e.push(t/s));return i===(0|i)&&e.push(i),e.sort((t,e)=>t-e).pop(),e}function wi(t){return"symbol"===typeof t||"object"===typeof t&&null!==t&&!(Symbol.toPrimitive in t||"toString"in t||"valueOf"in t)}function Ci(t){return!wi(t)&&!isNaN(parseFloat(t))&&isFinite(t)}function Si(t,e){const i=Math.round(t);return i-e<=t&&i+e>=t}function Fi(t,e,i){let s,n,a;for(s=0,n=t.length;s<n;s++)a=t[s][i],isNaN(a)||(e.min=Math.min(e.min,a),e.max=Math.max(e.max,a))}function Mi(t){return t*(ci/180)}function Ai(t){return t*(180/ci)}function Ti(t){if(!Ne(t))return;let e=1,i=0;while(Math.round(t*e)/e!==t)e*=10,i++;return i}function Pi(t,e){const i=e.x-t.x,s=e.y-t.y,n=Math.sqrt(i*i+s*s);let a=Math.atan2(s,i);return a<-.5*ci&&(a+=di),{angle:a,distance:n}}function Di(t,e){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Ei(t,e){return(t-e+ui)%di-ci}function Li(t){return(t%di+di)%di}function Ii(t,e,i,s){const n=Li(t),a=Li(e),o=Li(i),r=Li(a-n),l=Li(o-n),h=Li(n-a),c=Li(n-o);return n===a||n===o||s&&a===o||r>l&&h<c}function Vi(t,e,i){return Math.max(e,Math.min(i,t))}function Oi(t){return Vi(t,-32768,32767)}function Ri(t,e,i,s=1e-6){return t>=Math.min(e,i)-s&&t<=Math.max(e,i)+s}function Wi(t,e,i){i=i||(i=>t[i]<e);let s,n=t.length-1,a=0;while(n-a>1)s=a+n>>1,i(s)?a=s:n=s;return{lo:a,hi:n}}const Bi=(t,e,i,s)=>Wi(t,i,s?s=>{const n=t[s][e];return n<i||n===i&&t[s+1][e]===i}:s=>t[s][e]<i),zi=(t,e,i)=>Wi(t,i,s=>t[s][e]>=i);function Ni(t,e,i){let s=0,n=t.length;while(s<n&&t[s]<e)s++;while(n>s&&t[n-1]>i)n--;return s>0||n<t.length?t.slice(s,n):t}const Ui=["push","pop","shift","splice","unshift"];function $i(t,e){t._chartjs?t._chartjs.listeners.push(e):(Object.defineProperty(t,"_chartjs",{configurable:!0,enumerable:!1,value:{listeners:[e]}}),Ui.forEach(e=>{const i="_onData"+ai(e),s=t[e];Object.defineProperty(t,e,{configurable:!0,enumerable:!1,value(...e){const n=s.apply(this,e);return t._chartjs.listeners.forEach(t=>{"function"===typeof t[i]&&t[i](...e)}),n}})}))}function ji(t,e){const i=t._chartjs;if(!i)return;const s=i.listeners,n=s.indexOf(e);-1!==n&&s.splice(n,1),s.length>0||(Ui.forEach(e=>{delete t[e]}),delete t._chartjs)}function Hi(t){const e=new Set(t);return e.size===t.length?t:Array.from(e)}const Xi=function(){return"undefined"===typeof window?function(t){return t()}:window.requestAnimationFrame}();function qi(t,e){let i=[],s=!1;return function(...n){i=n,s||(s=!0,Xi.call(window,()=>{s=!1,t.apply(e,i)}))}}function Ki(t,e){let i;return function(...s){return e?(clearTimeout(i),i=setTimeout(t,e,s)):t.apply(this,s),e}}const Yi=t=>"start"===t?"left":"end"===t?"right":"center",Qi=(t,e,i)=>"start"===t?e:"end"===t?i:(e+i)/2,Gi=(t,e,i,s)=>{const n=s?"left":"right";return t===n?i:"center"===t?(e+i)/2:e};function Ji(t,e,i){const s=e.length;let n=0,a=s;if(t._sorted){const{iScale:o,vScale:r,_parsed:l}=t,h=t.dataset&&t.dataset.options?t.dataset.options.spanGaps:null,c=o.axis,{min:d,max:u,minDefined:g,maxDefined:p}=o.getUserBounds();if(g){if(n=Math.min(Bi(l,c,d).lo,i?s:Bi(e,c,o.getPixelForValue(d)).lo),h){const t=l.slice(0,n+1).reverse().findIndex(t=>!We(t[r.axis]));n-=Math.max(0,t)}n=Vi(n,0,s-1)}if(p){let t=Math.max(Bi(l,o.axis,u,!0).hi+1,i?0:Bi(e,c,o.getPixelForValue(u),!0).hi+1);if(h){const e=l.slice(t-1).findIndex(t=>!We(t[r.axis]));t+=Math.max(0,e)}a=Vi(t,n,s)-n}else a=s-n}return{start:n,count:a}}function Zi(t){const{xScale:e,yScale:i,_scaleRanges:s}=t,n={xmin:e.min,xmax:e.max,ymin:i.min,ymax:i.max};if(!s)return t._scaleRanges=n,!0;const a=s.xmin!==e.min||s.xmax!==e.max||s.ymin!==i.min||s.ymax!==i.max;return Object.assign(s,n),a}const ts=t=>0===t||1===t,es=(t,e,i)=>-Math.pow(2,10*(t-=1))*Math.sin((t-e)*di/i),is=(t,e,i)=>Math.pow(2,-10*t)*Math.sin((t-e)*di/i)+1,ss={linear:t=>t,easeInQuad:t=>t*t,easeOutQuad:t=>-t*(t-2),easeInOutQuad:t=>(t/=.5)<1?.5*t*t:-.5*(--t*(t-2)-1),easeInCubic:t=>t*t*t,easeOutCubic:t=>(t-=1)*t*t+1,easeInOutCubic:t=>(t/=.5)<1?.5*t*t*t:.5*((t-=2)*t*t+2),easeInQuart:t=>t*t*t*t,easeOutQuart:t=>-((t-=1)*t*t*t-1),easeInOutQuart:t=>(t/=.5)<1?.5*t*t*t*t:-.5*((t-=2)*t*t*t-2),easeInQuint:t=>t*t*t*t*t,easeOutQuint:t=>(t-=1)*t*t*t*t+1,easeInOutQuint:t=>(t/=.5)<1?.5*t*t*t*t*t:.5*((t-=2)*t*t*t*t+2),easeInSine:t=>1-Math.cos(t*fi),easeOutSine:t=>Math.sin(t*fi),easeInOutSine:t=>-.5*(Math.cos(ci*t)-1),easeInExpo:t=>0===t?0:Math.pow(2,10*(t-1)),easeOutExpo:t=>1===t?1:1-Math.pow(2,-10*t),easeInOutExpo:t=>ts(t)?t:t<.5?.5*Math.pow(2,10*(2*t-1)):.5*(2-Math.pow(2,-10*(2*t-1))),easeInCirc:t=>t>=1?t:-(Math.sqrt(1-t*t)-1),easeOutCirc:t=>Math.sqrt(1-(t-=1)*t),easeInOutCirc:t=>(t/=.5)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1),easeInElastic:t=>ts(t)?t:es(t,.075,.3),easeOutElastic:t=>ts(t)?t:is(t,.075,.3),easeInOutElastic(t){const e=.1125,i=.45;return ts(t)?t:t<.5?.5*es(2*t,e,i):.5+.5*is(2*t-1,e,i)},easeInBack(t){const e=1.70158;return t*t*((e+1)*t-e)},easeOutBack(t){const e=1.70158;return(t-=1)*t*((e+1)*t+e)+1},easeInOutBack(t){let e=1.70158;return(t/=.5)<1?t*t*((1+(e*=1.525))*t-e)*.5:.5*((t-=2)*t*((1+(e*=1.525))*t+e)+2)},easeInBounce:t=>1-ss.easeOutBounce(1-t),easeOutBounce(t){const e=7.5625,i=2.75;return t<1/i?e*t*t:t<2/i?e*(t-=1.5/i)*t+.75:t<2.5/i?e*(t-=2.25/i)*t+.9375:e*(t-=2.625/i)*t+.984375},easeInOutBounce:t=>t<.5?.5*ss.easeInBounce(2*t):.5*ss.easeOutBounce(2*t-1)+.5};function ns(t){if(t&&"object"===typeof t){const e=t.toString();return"[object CanvasPattern]"===e||"[object CanvasGradient]"===e}return!1}function as(t){return ns(t)?t:new Ve(t)}function os(t){return ns(t)?t:new Ve(t).saturate(.5).darken(.1).hexString()}const rs=["x","y","borderWidth","radius","tension"],ls=["color","borderColor","backgroundColor"];function hs(t){t.set("animation",{delay:void 0,duration:1e3,easing:"easeOutQuart",fn:void 0,from:void 0,loop:void 0,to:void 0,type:void 0}),t.describe("animation",{_fallback:!1,_indexable:!1,_scriptable:t=>"onProgress"!==t&&"onComplete"!==t&&"fn"!==t}),t.set("animations",{colors:{type:"color",properties:ls},numbers:{type:"number",properties:rs}}),t.describe("animations",{_fallback:"animation"}),t.set("transitions",{active:{animation:{duration:400}},resize:{animation:{duration:0}},show:{animations:{colors:{from:"transparent"},visible:{type:"boolean",duration:0}}},hide:{animations:{colors:{to:"transparent"},visible:{type:"boolean",easing:"linear",fn:t=>0|t}}}})}function cs(t){t.set("layout",{autoPadding:!0,padding:{top:0,right:0,bottom:0,left:0}})}const ds=new Map;function us(t,e){e=e||{};const i=t+JSON.stringify(e);let s=ds.get(i);return s||(s=new Intl.NumberFormat(t,e),ds.set(i,s)),s}function gs(t,e,i){return us(e,i).format(t)}const ps={values(t){return Be(t)?t:""+t},numeric(t,e,i){if(0===t)return"0";const s=this.chart.options.locale;let n,a=t;if(i.length>1){const e=Math.max(Math.abs(i[0].value),Math.abs(i[i.length-1].value));(e<1e-4||e>1e15)&&(n="scientific"),a=fs(t,i)}const o=xi(Math.abs(a)),r=isNaN(o)?1:Math.max(Math.min(-1*Math.floor(o),20),0),l={notation:n,minimumFractionDigits:r,maximumFractionDigits:r};return Object.assign(l,this.options.ticks.format),gs(t,s,l)},logarithmic(t,e,i){if(0===t)return"0";const s=i[e].significand||t/Math.pow(10,Math.floor(xi(t)));return[1,2,3,5,10,15].includes(s)||e>.8*i.length?ps.numeric.call(this,t,e,i):""}};function fs(t,e){let i=e.length>3?e[2].value-e[1].value:e[1].value-e[0].value;return Math.abs(i)>=1&&t!==Math.floor(t)&&(i=t-Math.floor(t)),i}var ms={formatters:ps};function bs(t){t.set("scale",{display:!0,offset:!1,reverse:!1,beginAtZero:!1,bounds:"ticks",clip:!0,grace:0,grid:{display:!0,lineWidth:1,drawOnChartArea:!0,drawTicks:!0,tickLength:8,tickWidth:(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:ms.formatters.values,minor:{},major:{},align:"center",crossAlign:"near",showLabelBackdrop:!1,backdropColor:"rgba(255, 255, 255, 0.75)",backdropPadding:2}}),t.route("scale.ticks","color","","color"),t.route("scale.grid","color","","borderColor"),t.route("scale.border","color","","borderColor"),t.route("scale.title","color","","color"),t.describe("scale",{_fallback:!1,_scriptable:t=>!t.startsWith("before")&&!t.startsWith("after")&&"callback"!==t&&"parser"!==t,_indexable:t=>"borderDash"!==t&&"tickBorderDash"!==t&&"dash"!==t}),t.describe("scales",{_fallback:"scale"}),t.describe("scale.ticks",{_scriptable:t=>"backdropPadding"!==t&&"callback"!==t,_indexable:t=>"backdropPadding"!==t})}const xs=Object.create(null),ys=Object.create(null);function _s(t,e){if(!e)return t;const i=e.split(".");for(let s=0,n=i.length;s<n;++s){const e=i[s];t=t[e]||(t[e]=Object.create(null))}return t}function vs(t,e,i){return"string"===typeof e?Je(_s(t,e),i):Je(_s(t,""),e)}class ks{constructor(t,e){this.animation=void 0,this.backgroundColor="rgba(0,0,0,0.1)",this.borderColor="rgba(0,0,0,0.1)",this.color="#666",this.datasets={},this.devicePixelRatio=t=>t.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=(t,e)=>os(e.backgroundColor),this.hoverBorderColor=(t,e)=>os(e.borderColor),this.hoverColor=(t,e)=>os(e.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 vs(this,t,e)}get(t){return _s(this,t)}describe(t,e){return vs(ys,t,e)}override(t,e){return vs(xs,t,e)}route(t,e,i,s){const n=_s(this,t),a=_s(this,i),o="_"+e;Object.defineProperties(n,{[o]:{value:n[e],writable:!0},[e]:{enumerable:!0,get(){const t=this[o],e=a[s];return ze(t)?Object.assign({},e,t):$e(t,e)},set(t){this[o]=t}}})}apply(t){t.forEach(t=>t(this))}}var ws=new ks({_scriptable:t=>!t.startsWith("on"),_indexable:t=>"events"!==t,hover:{_fallback:"interaction"},interaction:{_scriptable:!1,_indexable:!1}},[hs,cs,bs]);function Cs(t){return!t||We(t.size)||We(t.family)?null:(t.style?t.style+" ":"")+(t.weight?t.weight+" ":"")+t.size+"px "+t.family}function Ss(t,e,i,s,n){let a=e[n];return a||(a=e[n]=t.measureText(n).width,i.push(n)),a>s&&(s=a),s}function Fs(t,e,i,s){s=s||{};let n=s.data=s.data||{},a=s.garbageCollect=s.garbageCollect||[];s.font!==e&&(n=s.data={},a=s.garbageCollect=[],s.font=e),t.save(),t.font=e;let o=0;const r=i.length;let l,h,c,d,u;for(l=0;l<r;l++)if(d=i[l],void 0===d||null===d||Be(d)){if(Be(d))for(h=0,c=d.length;h<c;h++)u=d[h],void 0===u||null===u||Be(u)||(o=Ss(t,n,a,o,u))}else o=Ss(t,n,a,o,d);t.restore();const g=a.length/2;if(g>i.length){for(l=0;l<g;l++)delete n[a[l]];a.splice(0,g)}return o}function Ms(t,e,i){const s=t.currentDevicePixelRatio,n=0!==i?Math.max(i/2,.5):0;return Math.round((e-n)*s)/s+n}function As(t,e){(e||t)&&(e=e||t.getContext("2d"),e.save(),e.resetTransform(),e.clearRect(0,0,t.width,t.height),e.restore())}function Ts(t,e,i,s){Ps(t,e,i,s,null)}function Ps(t,e,i,s,n){let a,o,r,l,h,c,d,u;const g=e.pointStyle,p=e.rotation,f=e.radius;let m=(p||0)*pi;if(g&&"object"===typeof g&&(a=g.toString(),"[object HTMLImageElement]"===a||"[object HTMLCanvasElement]"===a))return t.save(),t.translate(i,s),t.rotate(m),t.drawImage(g,-g.width/2,-g.height/2,g.width,g.height),void t.restore();if(!(isNaN(f)||f<=0)){switch(t.beginPath(),g){default:n?t.ellipse(i,s,n/2,f,0,0,di):t.arc(i,s,f,0,di),t.closePath();break;case"triangle":c=n?n/2:f,t.moveTo(i+Math.sin(m)*c,s-Math.cos(m)*f),m+=bi,t.lineTo(i+Math.sin(m)*c,s-Math.cos(m)*f),m+=bi,t.lineTo(i+Math.sin(m)*c,s-Math.cos(m)*f),t.closePath();break;case"rectRounded":h=.516*f,l=f-h,o=Math.cos(m+mi)*l,d=Math.cos(m+mi)*(n?n/2-h:l),r=Math.sin(m+mi)*l,u=Math.sin(m+mi)*(n?n/2-h:l),t.arc(i-d,s-r,h,m-ci,m-fi),t.arc(i+u,s-o,h,m-fi,m),t.arc(i+d,s+r,h,m,m+fi),t.arc(i-u,s+o,h,m+fi,m+ci),t.closePath();break;case"rect":if(!p){l=Math.SQRT1_2*f,c=n?n/2:l,t.rect(i-c,s-l,2*c,2*l);break}m+=mi;case"rectRot":d=Math.cos(m)*(n?n/2:f),o=Math.cos(m)*f,r=Math.sin(m)*f,u=Math.sin(m)*(n?n/2:f),t.moveTo(i-d,s-r),t.lineTo(i+u,s-o),t.lineTo(i+d,s+r),t.lineTo(i-u,s+o),t.closePath();break;case"crossRot":m+=mi;case"cross":d=Math.cos(m)*(n?n/2:f),o=Math.cos(m)*f,r=Math.sin(m)*f,u=Math.sin(m)*(n?n/2:f),t.moveTo(i-d,s-r),t.lineTo(i+d,s+r),t.moveTo(i+u,s-o),t.lineTo(i-u,s+o);break;case"star":d=Math.cos(m)*(n?n/2:f),o=Math.cos(m)*f,r=Math.sin(m)*f,u=Math.sin(m)*(n?n/2:f),t.moveTo(i-d,s-r),t.lineTo(i+d,s+r),t.moveTo(i+u,s-o),t.lineTo(i-u,s+o),m+=mi,d=Math.cos(m)*(n?n/2:f),o=Math.cos(m)*f,r=Math.sin(m)*f,u=Math.sin(m)*(n?n/2:f),t.moveTo(i-d,s-r),t.lineTo(i+d,s+r),t.moveTo(i+u,s-o),t.lineTo(i-u,s+o);break;case"line":o=n?n/2:Math.cos(m)*f,r=Math.sin(m)*f,t.moveTo(i-o,s-r),t.lineTo(i+o,s+r);break;case"dash":t.moveTo(i,s),t.lineTo(i+Math.cos(m)*(n?n/2:f),s+Math.sin(m)*f);break;case!1:t.closePath();break}t.fill(),e.borderWidth>0&&t.stroke()}}function Ds(t,e,i){return i=i||.5,!e||t&&t.x>e.left-i&&t.x<e.right+i&&t.y>e.top-i&&t.y<e.bottom+i}function Es(t,e){t.save(),t.beginPath(),t.rect(e.left,e.top,e.right-e.left,e.bottom-e.top),t.clip()}function Ls(t){t.restore()}function Is(t,e,i,s,n){if(!e)return t.lineTo(i.x,i.y);if("middle"===n){const s=(e.x+i.x)/2;t.lineTo(s,e.y),t.lineTo(s,i.y)}else"after"===n!==!!s?t.lineTo(e.x,i.y):t.lineTo(i.x,e.y);t.lineTo(i.x,i.y)}function Vs(t,e,i,s){if(!e)return t.lineTo(i.x,i.y);t.bezierCurveTo(s?e.cp1x:e.cp2x,s?e.cp1y:e.cp2y,s?i.cp2x:i.cp1x,s?i.cp2y:i.cp1y,i.x,i.y)}function Os(t,e){e.translation&&t.translate(e.translation[0],e.translation[1]),We(e.rotation)||t.rotate(e.rotation),e.color&&(t.fillStyle=e.color),e.textAlign&&(t.textAlign=e.textAlign),e.textBaseline&&(t.textBaseline=e.textBaseline)}function Rs(t,e,i,s,n){if(n.strikethrough||n.underline){const a=t.measureText(s),o=e-a.actualBoundingBoxLeft,r=e+a.actualBoundingBoxRight,l=i-a.actualBoundingBoxAscent,h=i+a.actualBoundingBoxDescent,c=n.strikethrough?(l+h)/2:h;t.strokeStyle=t.fillStyle,t.beginPath(),t.lineWidth=n.decorationWidth||2,t.moveTo(o,c),t.lineTo(r,c),t.stroke()}}function Ws(t,e){const i=t.fillStyle;t.fillStyle=e.color,t.fillRect(e.left,e.top,e.width,e.height),t.fillStyle=i}function Bs(t,e,i,s,n,a={}){const o=Be(e)?e:[e],r=a.strokeWidth>0&&""!==a.strokeColor;let l,h;for(t.save(),t.font=n.string,Os(t,a),l=0;l<o.length;++l)h=o[l],a.backdrop&&Ws(t,a.backdrop),r&&(a.strokeColor&&(t.strokeStyle=a.strokeColor),We(a.strokeWidth)||(t.lineWidth=a.strokeWidth),t.strokeText(h,i,s,a.maxWidth)),t.fillText(h,i,s,a.maxWidth),Rs(t,i,s,h,a),s+=Number(n.lineHeight);t.restore()}function zs(t,e){const{x:i,y:s,w:n,h:a,radius:o}=e;t.arc(i+o.topLeft,s+o.topLeft,o.topLeft,1.5*ci,ci,!0),t.lineTo(i,s+a-o.bottomLeft),t.arc(i+o.bottomLeft,s+a-o.bottomLeft,o.bottomLeft,ci,fi,!0),t.lineTo(i+n-o.bottomRight,s+a),t.arc(i+n-o.bottomRight,s+a-o.bottomRight,o.bottomRight,fi,0,!0),t.lineTo(i+n,s+o.topRight),t.arc(i+n-o.topRight,s+o.topRight,o.topRight,0,-fi,!0),t.lineTo(i+o.topLeft,s)}const Ns=/^(normal|(\d+(?:\.\d+)?)(px|em|%)?)$/,Us=/^(normal|italic|initial|inherit|unset|(oblique( -?[0-9]?[0-9]deg)?))$/;function $s(t,e){const i=(""+t).match(Ns);if(!i||"normal"===i[1])return 1.2*e;switch(t=+i[2],i[3]){case"px":return t;case"%":t/=100;break}return e*t}const js=t=>+t||0;function Hs(t,e){const i={},s=ze(e),n=s?Object.keys(e):e,a=ze(t)?s?i=>$e(t[i],t[e[i]]):e=>t[e]:()=>t;for(const o of n)i[o]=js(a(o));return i}function Xs(t){return Hs(t,{top:"y",right:"x",bottom:"y",left:"x"})}function qs(t){return Hs(t,["topLeft","topRight","bottomLeft","bottomRight"])}function Ks(t){const e=Xs(t);return e.width=e.left+e.right,e.height=e.top+e.bottom,e}function Ys(t,e){t=t||{},e=e||ws.font;let i=$e(t.size,e.size);"string"===typeof i&&(i=parseInt(i,10));let s=$e(t.style,e.style);s&&!(""+s).match(Us)&&(console.warn('Invalid font style specified: "'+s+'"'),s=void 0);const n={family:$e(t.family,e.family),lineHeight:$s($e(t.lineHeight,e.lineHeight),i),size:i,style:s,weight:$e(t.weight,e.weight),string:""};return n.string=Cs(n),n}function Qs(t,e,i,s){let n,a,o,r=!0;for(n=0,a=t.length;n<a;++n)if(o=t[n],void 0!==o&&(void 0!==e&&"function"===typeof o&&(o=o(e),r=!1),void 0!==i&&Be(o)&&(o=o[i%o.length],r=!1),void 0!==o))return s&&!r&&(s.cacheable=!1),o}function Gs(t,e,i){const{min:s,max:n}=t,a=He(e,(n-s)/2),o=(t,e)=>i&&0===t?0:t+e;return{min:o(s,-Math.abs(a)),max:o(n,a)}}function Js(t,e){return Object.assign(Object.create(t),e)}function Zs(t,e=[""],i,s,n=()=>t[0]){const a=i||t;"undefined"===typeof s&&(s=mn("_fallback",t));const o={[Symbol.toStringTag]:"Object",_cacheable:!0,_scopes:t,_rootScopes:a,_fallback:s,_getTarget:n,override:i=>Zs([i,...t],e,a,s)};return new Proxy(o,{deleteProperty(e,i){return delete e[i],delete e._keys,delete t[0][i],!0},get(i,s){return an(i,s,()=>fn(s,e,t,i))},getOwnPropertyDescriptor(t,e){return Reflect.getOwnPropertyDescriptor(t._scopes[0],e)},getPrototypeOf(){return Reflect.getPrototypeOf(t[0])},has(t,e){return bn(t).includes(e)},ownKeys(t){return bn(t)},set(t,e,i){const s=t._storage||(t._storage=n());return t[e]=s[e]=i,delete t._keys,!0}})}function tn(t,e,i,s){const n={_cacheable:!1,_proxy:t,_context:e,_subProxy:i,_stack:new Set,_descriptors:en(t,s),setContext:e=>tn(t,e,i,s),override:n=>tn(t.override(n),e,i,s)};return new Proxy(n,{deleteProperty(e,i){return delete e[i],delete t[i],!0},get(t,e,i){return an(t,e,()=>on(t,e,i))},getOwnPropertyDescriptor(e,i){return e._descriptors.allKeys?Reflect.has(t,i)?{enumerable:!0,configurable:!0}:void 0:Reflect.getOwnPropertyDescriptor(t,i)},getPrototypeOf(){return Reflect.getPrototypeOf(t)},has(e,i){return Reflect.has(t,i)},ownKeys(){return Reflect.ownKeys(t)},set(e,i,s){return t[i]=s,delete e[i],!0}})}function en(t,e={scriptable:!0,indexable:!0}){const{_scriptable:i=e.scriptable,_indexable:s=e.indexable,_allKeys:n=e.allKeys}=t;return{allKeys:n,scriptable:i,indexable:s,isScriptable:ri(i)?i:()=>i,isIndexable:ri(s)?s:()=>s}}const sn=(t,e)=>t?t+ai(e):e,nn=(t,e)=>ze(e)&&"adapters"!==t&&(null===Object.getPrototypeOf(e)||e.constructor===Object);function an(t,e,i){if(Object.prototype.hasOwnProperty.call(t,e)||"constructor"===e)return t[e];const s=i();return t[e]=s,s}function on(t,e,i){const{_proxy:s,_context:n,_subProxy:a,_descriptors:o}=t;let r=s[e];return ri(r)&&o.isScriptable(e)&&(r=rn(e,r,t,i)),Be(r)&&r.length&&(r=ln(e,r,t,o.isIndexable)),nn(e,r)&&(r=tn(r,n,a&&a[e],o)),r}function rn(t,e,i,s){const{_proxy:n,_context:a,_subProxy:o,_stack:r}=i;if(r.has(t))throw new Error("Recursion detected: "+Array.from(r).join("->")+"->"+t);r.add(t);let l=e(a,o||s);return r.delete(t),nn(t,l)&&(l=un(n._scopes,n,t,l)),l}function ln(t,e,i,s){const{_proxy:n,_context:a,_subProxy:o,_descriptors:r}=i;if("undefined"!==typeof a.index&&s(t))return e[a.index%e.length];if(ze(e[0])){const i=e,s=n._scopes.filter(t=>t!==i);e=[];for(const l of i){const i=un(s,n,t,l);e.push(tn(i,a,o&&o[t],r))}}return e}function hn(t,e,i){return ri(t)?t(e,i):t}const cn=(t,e)=>!0===t?e:"string"===typeof t?ni(e,t):void 0;function dn(t,e,i,s,n){for(const a of e){const e=cn(i,a);if(e){t.add(e);const a=hn(e._fallback,i,n);if("undefined"!==typeof a&&a!==i&&a!==s)return a}else if(!1===e&&"undefined"!==typeof s&&i!==s)return null}return!1}function un(t,e,i,s){const n=e._rootScopes,a=hn(e._fallback,i,s),o=[...t,...n],r=new Set;r.add(s);let l=gn(r,o,i,a||i,s);return null!==l&&(("undefined"===typeof a||a===i||(l=gn(r,o,a,l,s),null!==l))&&Zs(Array.from(r),[""],n,a,()=>pn(e,i,s)))}function gn(t,e,i,s,n){while(i)i=dn(t,e,i,s,n);return i}function pn(t,e,i){const s=t._getTarget();e in s||(s[e]={});const n=s[e];return Be(n)&&ze(i)?i:n||{}}function fn(t,e,i,s){let n;for(const a of e)if(n=mn(sn(a,t),i),"undefined"!==typeof n)return nn(t,n)?un(i,s,t,n):n}function mn(t,e){for(const i of e){if(!i)continue;const e=i[t];if("undefined"!==typeof e)return e}}function bn(t){let e=t._keys;return e||(e=t._keys=xn(t._scopes)),e}function xn(t){const e=new Set;for(const i of t)for(const t of Object.keys(i).filter(t=>!t.startsWith("_")))e.add(t);return Array.from(e)}function yn(t,e,i,s){const{iScale:n}=t,{key:a="r"}=this._parsing,o=new Array(s);let r,l,h,c;for(r=0,l=s;r<l;++r)h=r+i,c=e[h],o[r]={r:n.parse(ni(c,a),h)};return o}const _n=Number.EPSILON||1e-14,vn=(t,e)=>e<t.length&&!t[e].skip&&t[e],kn=t=>"x"===t?"y":"x";function wn(t,e,i,s){const n=t.skip?e:t,a=e,o=i.skip?e:i,r=Di(a,n),l=Di(o,a);let h=r/(r+l),c=l/(r+l);h=isNaN(h)?0:h,c=isNaN(c)?0:c;const d=s*h,u=s*c;return{previous:{x:a.x-d*(o.x-n.x),y:a.y-d*(o.y-n.y)},next:{x:a.x+u*(o.x-n.x),y:a.y+u*(o.y-n.y)}}}function Cn(t,e,i){const s=t.length;let n,a,o,r,l,h=vn(t,0);for(let c=0;c<s-1;++c)l=h,h=vn(t,c+1),l&&h&&(_i(e[c],0,_n)?i[c]=i[c+1]=0:(n=i[c]/e[c],a=i[c+1]/e[c],r=Math.pow(n,2)+Math.pow(a,2),r<=9||(o=3/Math.sqrt(r),i[c]=n*o*e[c],i[c+1]=a*o*e[c])))}function Sn(t,e,i="x"){const s=kn(i),n=t.length;let a,o,r,l=vn(t,0);for(let h=0;h<n;++h){if(o=r,r=l,l=vn(t,h+1),!r)continue;const n=r[i],c=r[s];o&&(a=(n-o[i])/3,r[`cp1${i}`]=n-a,r[`cp1${s}`]=c-a*e[h]),l&&(a=(l[i]-n)/3,r[`cp2${i}`]=n+a,r[`cp2${s}`]=c+a*e[h])}}function Fn(t,e="x"){const i=kn(e),s=t.length,n=Array(s).fill(0),a=Array(s);let o,r,l,h=vn(t,0);for(o=0;o<s;++o)if(r=l,l=h,h=vn(t,o+1),l){if(h){const t=h[e]-l[e];n[o]=0!==t?(h[i]-l[i])/t:0}a[o]=r?h?yi(n[o-1])!==yi(n[o])?0:(n[o-1]+n[o])/2:n[o-1]:n[o]}Cn(t,n,a),Sn(t,a,e)}function Mn(t,e,i){return Math.max(Math.min(t,i),e)}function An(t,e){let i,s,n,a,o,r=Ds(t[0],e);for(i=0,s=t.length;i<s;++i)o=a,a=r,r=i<s-1&&Ds(t[i+1],e),a&&(n=t[i],o&&(n.cp1x=Mn(n.cp1x,e.left,e.right),n.cp1y=Mn(n.cp1y,e.top,e.bottom)),r&&(n.cp2x=Mn(n.cp2x,e.left,e.right),n.cp2y=Mn(n.cp2y,e.top,e.bottom)))}function Tn(t,e,i,s,n){let a,o,r,l;if(e.spanGaps&&(t=t.filter(t=>!t.skip)),"monotone"===e.cubicInterpolationMode)Fn(t,n);else{let i=s?t[t.length-1]:t[0];for(a=0,o=t.length;a<o;++a)r=t[a],l=wn(i,r,t[Math.min(a+1,o-(s?0:1))%o],e.tension),r.cp1x=l.previous.x,r.cp1y=l.previous.y,r.cp2x=l.next.x,r.cp2y=l.next.y,i=r}e.capBezierPoints&&An(t,i)}function Pn(){return"undefined"!==typeof window&&"undefined"!==typeof document}function Dn(t){let e=t.parentNode;return e&&"[object ShadowRoot]"===e.toString()&&(e=e.host),e}function En(t,e,i){let s;return"string"===typeof t?(s=parseInt(t,10),-1!==t.indexOf("%")&&(s=s/100*e.parentNode[i])):s=t,s}const Ln=t=>t.ownerDocument.defaultView.getComputedStyle(t,null);function In(t,e){return Ln(t).getPropertyValue(e)}const Vn=["top","right","bottom","left"];function On(t,e,i){const s={};i=i?"-"+i:"";for(let n=0;n<4;n++){const a=Vn[n];s[a]=parseFloat(t[e+"-"+a+i])||0}return s.width=s.left+s.right,s.height=s.top+s.bottom,s}const Rn=(t,e,i)=>(t>0||e>0)&&(!i||!i.shadowRoot);function Wn(t,e){const i=t.touches,s=i&&i.length?i[0]:t,{offsetX:n,offsetY:a}=s;let o,r,l=!1;if(Rn(n,a,t.target))o=n,r=a;else{const t=e.getBoundingClientRect();o=s.clientX-t.left,r=s.clientY-t.top,l=!0}return{x:o,y:r,box:l}}function Bn(t,e){if("native"in t)return t;const{canvas:i,currentDevicePixelRatio:s}=e,n=Ln(i),a="border-box"===n.boxSizing,o=On(n,"padding"),r=On(n,"border","width"),{x:l,y:h,box:c}=Wn(t,i),d=o.left+(c&&r.left),u=o.top+(c&&r.top);let{width:g,height:p}=e;return a&&(g-=o.width+r.width,p-=o.height+r.height),{x:Math.round((l-d)/g*i.width/s),y:Math.round((h-u)/p*i.height/s)}}function zn(t,e,i){let s,n;if(void 0===e||void 0===i){const a=t&&Dn(t);if(a){const t=a.getBoundingClientRect(),o=Ln(a),r=On(o,"border","width"),l=On(o,"padding");e=t.width-l.width-r.width,i=t.height-l.height-r.height,s=En(o.maxWidth,a,"clientWidth"),n=En(o.maxHeight,a,"clientHeight")}else e=t.clientWidth,i=t.clientHeight}return{width:e,height:i,maxWidth:s||gi,maxHeight:n||gi}}const Nn=t=>Math.round(10*t)/10;function Un(t,e,i,s){const n=Ln(t),a=On(n,"margin"),o=En(n.maxWidth,t,"clientWidth")||gi,r=En(n.maxHeight,t,"clientHeight")||gi,l=zn(t,e,i);let{width:h,height:c}=l;if("content-box"===n.boxSizing){const t=On(n,"border","width"),e=On(n,"padding");h-=e.width+t.width,c-=e.height+t.height}h=Math.max(0,h-a.width),c=Math.max(0,s?h/s:c-a.height),h=Nn(Math.min(h,o,l.maxWidth)),c=Nn(Math.min(c,r,l.maxHeight)),h&&!c&&(c=Nn(h/2));const d=void 0!==e||void 0!==i;return d&&s&&l.height&&c>l.height&&(c=l.height,h=Nn(Math.floor(c*s))),{width:h,height:c}}function $n(t,e,i){const s=e||1,n=Nn(t.height*s),a=Nn(t.width*s);t.height=Nn(t.height),t.width=Nn(t.width);const o=t.canvas;return o.style&&(i||!o.style.height&&!o.style.width)&&(o.style.height=`${t.height}px`,o.style.width=`${t.width}px`),(t.currentDevicePixelRatio!==s||o.height!==n||o.width!==a)&&(t.currentDevicePixelRatio=s,o.height=n,o.width=a,t.ctx.setTransform(s,0,0,s,0,0),!0)}const jn=function(){let t=!1;try{const e={get passive(){return t=!0,!1}};Pn()&&(window.addEventListener("test",null,e),window.removeEventListener("test",null,e))}catch(e){}return t}();function Hn(t,e){const i=In(t,e),s=i&&i.match(/^(\d+)(\.\d+)?px$/);return s?+s[1]:void 0}function Xn(t,e,i,s){return{x:t.x+i*(e.x-t.x),y:t.y+i*(e.y-t.y)}}function qn(t,e,i,s){return{x:t.x+i*(e.x-t.x),y:"middle"===s?i<.5?t.y:e.y:"after"===s?i<1?t.y:e.y:i>0?e.y:t.y}}function Kn(t,e,i,s){const n={x:t.cp2x,y:t.cp2y},a={x:e.cp1x,y:e.cp1y},o=Xn(t,n,i),r=Xn(n,a,i),l=Xn(a,e,i),h=Xn(o,r,i),c=Xn(r,l,i);return Xn(h,c,i)}const Yn=function(t,e){return{x(i){return t+t+e-i},setWidth(t){e=t},textAlign(t){return"center"===t?t:"right"===t?"left":"right"},xPlus(t,e){return t-e},leftForLtr(t,e){return t-e}}},Qn=function(){return{x(t){return t},setWidth(t){},textAlign(t){return t},xPlus(t,e){return t+e},leftForLtr(t,e){return t}}};function Gn(t,e,i){return t?Yn(e,i):Qn()}function Jn(t,e){let i,s;"ltr"!==e&&"rtl"!==e||(i=t.canvas.style,s=[i.getPropertyValue("direction"),i.getPropertyPriority("direction")],i.setProperty("direction",e,"important"),t.prevTextDirection=s)}function Zn(t,e){void 0!==e&&(delete t.prevTextDirection,t.canvas.style.setProperty("direction",e[0],e[1]))}function ta(t){return"angle"===t?{between:Ii,compare:Ei,normalize:Li}:{between:Ri,compare:(t,e)=>t-e,normalize:t=>t}}function ea({start:t,end:e,count:i,loop:s,style:n}){return{start:t%i,end:e%i,loop:s&&(e-t+1)%i===0,style:n}}function ia(t,e,i){const{property:s,start:n,end:a}=i,{between:o,normalize:r}=ta(s),l=e.length;let h,c,{start:d,end:u,loop:g}=t;if(g){for(d+=l,u+=l,h=0,c=l;h<c;++h){if(!o(r(e[d%l][s]),n,a))break;d--,u--}d%=l,u%=l}return u<d&&(u+=l),{start:d,end:u,loop:g,style:t.style}}function sa(t,e,i){if(!i)return[t];const{property:s,start:n,end:a}=i,o=e.length,{compare:r,between:l,normalize:h}=ta(s),{start:c,end:d,loop:u,style:g}=ia(t,e,i),p=[];let f,m,b,x=!1,y=null;const _=()=>l(n,b,f)&&0!==r(n,b),v=()=>0===r(a,f)||l(a,b,f),k=()=>x||_(),w=()=>!x||v();for(let C=c,S=c;C<=d;++C)m=e[C%o],m.skip||(f=h(m[s]),f!==b&&(x=l(f,n,a),null===y&&k()&&(y=0===r(f,n)?C:S),null!==y&&w()&&(p.push(ea({start:y,end:C,loop:u,count:o,style:g})),y=null),S=C,b=f));return null!==y&&p.push(ea({start:y,end:d,loop:u,count:o,style:g})),p}function na(t,e){const i=[],s=t.segments;for(let n=0;n<s.length;n++){const a=sa(s[n],t.points,e);a.length&&i.push(...a)}return i}function aa(t,e,i,s){let n=0,a=e-1;if(i&&!s)while(n<e&&!t[n].skip)n++;while(n<e&&t[n].skip)n++;n%=e,i&&(a+=n);while(a>n&&t[a%e].skip)a--;return a%=e,{start:n,end:a}}function oa(t,e,i,s){const n=t.length,a=[];let o,r=e,l=t[e];for(o=e+1;o<=i;++o){const i=t[o%n];i.skip||i.stop?l.skip||(s=!1,a.push({start:e%n,end:(o-1)%n,loop:s}),e=r=i.stop?o:null):(r=o,l.skip&&(e=o)),l=i}return null!==r&&a.push({start:e%n,end:r%n,loop:s}),a}function ra(t,e){const i=t.points,s=t.options.spanGaps,n=i.length;if(!n)return[];const a=!!t._loop,{start:o,end:r}=aa(i,n,a,s);if(!0===s)return la(t,[{start:o,end:r,loop:a}],i,e);const l=r<o?r+n:r,h=!!t._fullLoop&&0===o&&r===n-1;return la(t,oa(i,o,l,h),i,e)}function la(t,e,i,s){return s&&s.setContext&&i?ha(t,e,i,s):e}function ha(t,e,i,s){const n=t._chart.getContext(),a=ca(t.options),{_datasetIndex:o,options:{spanGaps:r}}=t,l=i.length,h=[];let c=a,d=e[0].start,u=d;function g(t,e,s,n){const a=r?-1:1;if(t!==e){t+=l;while(i[t%l].skip)t-=a;while(i[e%l].skip)e+=a;t%l!==e%l&&(h.push({start:t%l,end:e%l,loop:s,style:n}),c=n,d=e%l)}}for(const p of e){d=r?d:p.start;let t,e=i[d%l];for(u=d+1;u<=p.end;u++){const a=i[u%l];t=ca(s.setContext(Js(n,{type:"segment",p0:e,p1:a,p0DataIndex:(u-1)%l,p1DataIndex:u%l,datasetIndex:o}))),da(t,c)&&g(d,u-1,p.loop,c),e=a,c=t}d<u-1&&g(d,u-1,p.loop,c)}return h}function ca(t){return{backgroundColor:t.backgroundColor,borderCapStyle:t.borderCapStyle,borderDash:t.borderDash,borderDashOffset:t.borderDashOffset,borderJoinStyle:t.borderJoinStyle,borderWidth:t.borderWidth,borderColor:t.borderColor}}function da(t,e){if(!e)return!1;const i=[],s=function(t,e){return ns(e)?(i.includes(e)||i.push(e),i.indexOf(e)):e};return JSON.stringify(t,s)!==JSON.stringify(e,s)}function ua(t,e,i){return t.options.clip?t[i]:e[i]}function ga(t,e){const{xScale:i,yScale:s}=t;return i&&s?{left:ua(i,e,"left"),right:ua(i,e,"right"),top:ua(s,e,"top"),bottom:ua(s,e,"bottom")}:e}function pa(t,e){const i=e._clip;if(i.disabled)return!1;const s=ga(e,t.chartArea);return{left:!1===i.left?0:s.left-(!0===i.left?0:i.left),right:!1===i.right?t.width:s.right+(!0===i.right?0:i.right),top:!1===i.top?0:s.top-(!0===i.top?0:i.top),bottom:!1===i.bottom?t.height:s.bottom+(!0===i.bottom?0:i.bottom)}}
/*!
* Chart.js v4.5.1
* https://www.chartjs.org
* (c) 2025 Chart.js Contributors
* Released under the MIT License
*/
class fa{constructor(){this._request=null,this._charts=new Map,this._running=!1,this._lastDate=void 0}_notify(t,e,i,s){const n=e.listeners[s],a=e.duration;n.forEach(s=>s({chart:t,initial:e.initial,numSteps:a,currentStep:Math.min(i-e.start,a)}))}_refresh(){this._request||(this._running=!0,this._request=Xi.call(window,()=>{this._update(),this._request=null,this._running&&this._refresh()}))}_update(t=Date.now()){let e=0;this._charts.forEach((i,s)=>{if(!i.running||!i.items.length)return;const n=i.items;let a,o=n.length-1,r=!1;for(;o>=0;--o)a=n[o],a._active?(a._total>i.duration&&(i.duration=a._total),a.tick(t),r=!0):(n[o]=n[n.length-1],n.pop());r&&(s.draw(),this._notify(s,i,t,"progress")),n.length||(i.running=!1,this._notify(s,i,t,"complete"),i.initial=!1),e+=n.length}),this._lastDate=t,0===e&&(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((t,e)=>Math.max(t,e._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 s=i.length-1;for(;s>=0;--s)i[s].cancel();e.items=[],this._notify(t,e,Date.now(),"complete")}remove(t){return this._charts.delete(t)}}var ma=new fa;const ba="transparent",xa={boolean(t,e,i){return i>.5?e:t},color(t,e,i){const s=as(t||ba),n=s.valid&&as(e||ba);return n&&n.valid?n.mix(s,i).hexString():e},number(t,e,i){return t+(e-t)*i}};class ya{constructor(t,e,i,s){const n=e[i];s=Qs([t.to,s,n,t.from]);const a=Qs([t.from,n,s]);this._active=!0,this._fn=t.fn||xa[t.type||typeof a],this._easing=ss[t.easing]||ss.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=s,this._promises=void 0}active(){return this._active}update(t,e,i){if(this._active){this._notify(!1);const s=this._target[this._prop],n=i-this._start,a=this._duration-n;this._start=i,this._duration=Math.floor(Math.max(a,t.duration)),this._total+=n,this._loop=!!t.loop,this._to=Qs([t.to,e,s,t.from]),this._from=Qs([t.from,s,e])}}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(t){const e=t-this._start,i=this._duration,s=this._prop,n=this._from,a=this._loop,o=this._to;let r;if(this._active=n!==o&&(a||e<i),!this._active)return this._target[s]=o,void this._notify(!0);e<0?this._target[s]=n:(r=e/i%2,r=a&&r>1?2-r:r,r=this._easing(Math.min(1,Math.max(0,r))),this._target[s]=this._fn(n,o,r))}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 s=0;s<i.length;s++)i[s][e]()}}class _a{constructor(t,e){this._chart=t,this._properties=new Map,this.configure(e)}configure(t){if(!ze(t))return;const e=Object.keys(ws.animation),i=this._properties;Object.getOwnPropertyNames(t).forEach(s=>{const n=t[s];if(!ze(n))return;const a={};for(const t of e)a[t]=n[t];(Be(n.properties)&&n.properties||[s]).forEach(t=>{t!==s&&i.has(t)||i.set(t,a)})})}_animateOptions(t,e){const i=e.options,s=ka(t,i);if(!s)return[];const n=this._createAnimations(s,i);return i.$shared&&va(t.options.$animations,i).then(()=>{t.options=i},()=>{}),n}_createAnimations(t,e){const i=this._properties,s=[],n=t.$animations||(t.$animations={}),a=Object.keys(e),o=Date.now();let r;for(r=a.length-1;r>=0;--r){const l=a[r];if("$"===l.charAt(0))continue;if("options"===l){s.push(...this._animateOptions(t,e));continue}const h=e[l];let c=n[l];const d=i.get(l);if(c){if(d&&c.active()){c.update(d,h,o);continue}c.cancel()}d&&d.duration?(n[l]=c=new ya(d,t,l,h),s.push(c)):t[l]=h}return s}update(t,e){if(0===this._properties.size)return void Object.assign(t,e);const i=this._createAnimations(t,e);return i.length?(ma.add(this._chart,i),!0):void 0}}function va(t,e){const i=[],s=Object.keys(e);for(let n=0;n<s.length;n++){const e=t[s[n]];e&&e.active()&&i.push(e.wait())}return Promise.all(i)}function ka(t,e){if(!e)return;let i=t.options;if(i)return i.$shared&&(t.options=i=Object.assign({},i,{$shared:!1,$animations:{}})),i;t.options=e}function wa(t,e){const i=t&&t.options||{},s=i.reverse,n=void 0===i.min?e:0,a=void 0===i.max?e:0;return{start:s?a:n,end:s?n:a}}function Ca(t,e,i){if(!1===i)return!1;const s=wa(t,i),n=wa(e,i);return{top:n.end,right:s.end,bottom:n.start,left:s.start}}function Sa(t){let e,i,s,n;return ze(t)?(e=t.top,i=t.right,s=t.bottom,n=t.left):e=i=s=n=t,{top:e,right:i,bottom:s,left:n,disabled:!1===t}}function Fa(t,e){const i=[],s=t._getSortedDatasetMetas(e);let n,a;for(n=0,a=s.length;n<a;++n)i.push(s[n].index);return i}function Ma(t,e,i,s={}){const n=t.keys,a="single"===s.mode;let o,r,l,h;if(null===e)return;let c=!1;for(o=0,r=n.length;o<r;++o){if(l=+n[o],l===i){if(c=!0,s.all)continue;break}h=t.values[l],Ne(h)&&(a||0===e||yi(e)===yi(h))&&(e+=h)}return c||s.all?e:0}function Aa(t,e){const{iScale:i,vScale:s}=e,n="x"===i.axis?"x":"y",a="x"===s.axis?"x":"y",o=Object.keys(t),r=new Array(o.length);let l,h,c;for(l=0,h=o.length;l<h;++l)c=o[l],r[l]={[n]:c,[a]:t[c]};return r}function Ta(t,e){const i=t&&t.options.stacked;return i||void 0===i&&void 0!==e.stack}function Pa(t,e,i){return`${t.id}.${e.id}.${i.stack||i.type}`}function Da(t){const{min:e,max:i,minDefined:s,maxDefined:n}=t.getUserBounds();return{min:s?e:Number.NEGATIVE_INFINITY,max:n?i:Number.POSITIVE_INFINITY}}function Ea(t,e,i){const s=t[e]||(t[e]={});return s[i]||(s[i]={})}function La(t,e,i,s){for(const n of e.getMatchingVisibleMetas(s).reverse()){const e=t[n.index];if(i&&e>0||!i&&e<0)return n.index}return null}function Ia(t,e){const{chart:i,_cachedMeta:s}=t,n=i._stacks||(i._stacks={}),{iScale:a,vScale:o,index:r}=s,l=a.axis,h=o.axis,c=Pa(a,o,s),d=e.length;let u;for(let g=0;g<d;++g){const t=e[g],{[l]:i,[h]:a}=t,d=t._stacks||(t._stacks={});u=d[h]=Ea(n,c,i),u[r]=a,u._top=La(u,o,!0,s.type),u._bottom=La(u,o,!1,s.type);const p=u._visualValues||(u._visualValues={});p[r]=a}}function Va(t,e){const i=t.scales;return Object.keys(i).filter(t=>i[t].axis===e).shift()}function Oa(t,e){return Js(t,{active:!1,dataset:void 0,datasetIndex:e,index:e,mode:"default",type:"dataset"})}function Ra(t,e,i){return Js(t,{active:!1,dataIndex:e,parsed:void 0,raw:void 0,element:i,index:e,mode:"default",type:"data"})}function Wa(t,e){const i=t.controller.index,s=t.vScale&&t.vScale.axis;if(s){e=e||t._parsed;for(const t of e){const e=t._stacks;if(!e||void 0===e[s]||void 0===e[s][i])return;delete e[s][i],void 0!==e[s]._visualValues&&void 0!==e[s]._visualValues[i]&&delete e[s]._visualValues[i]}}}const Ba=t=>"reset"===t||"none"===t,za=(t,e)=>e?t:Object.assign({},t),Na=(t,e,i)=>t&&!e.hidden&&e._stacked&&{keys:Fa(i,!0),values:null};class Ua{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=Ta(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&&Wa(this._cachedMeta),this.index=t}linkScales(){const t=this.chart,e=this._cachedMeta,i=this.getDataset(),s=(t,e,i,s)=>"x"===t?e:"r"===t?s:i,n=e.xAxisID=$e(i.xAxisID,Va(t,"x")),a=e.yAxisID=$e(i.yAxisID,Va(t,"y")),o=e.rAxisID=$e(i.rAxisID,Va(t,"r")),r=e.indexAxis,l=e.iAxisID=s(r,n,a,o),h=e.vAxisID=s(r,a,n,o);e.xScale=this.getScaleForId(n),e.yScale=this.getScaleForId(a),e.rScale=this.getScaleForId(o),e.iScale=this.getScaleForId(l),e.vScale=this.getScaleForId(h)}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&&Wa(t)}_dataCheck(){const t=this.getDataset(),e=t.data||(t.data=[]),i=this._data;if(ze(e)){const t=this._cachedMeta;this._data=Aa(e,t)}else if(i!==e){if(i){ji(i,this);const t=this._cachedMeta;Wa(t),t._parsed=[]}e&&Object.isExtensible(e)&&$i(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 s=!1;this._dataCheck();const n=e._stacked;e._stacked=Ta(e.vScale,e),e.stack!==i.stack&&(s=!0,Wa(e),e.stack=i.stack),this._resyncElements(t),(s||n!==e._stacked)&&(Ia(this,e._parsed),e._stacked=Ta(e.vScale,e))}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:s}=this,{iScale:n,_stacked:a}=i,o=n.axis;let r,l,h,c=0===t&&e===s.length||i._sorted,d=t>0&&i._parsed[t-1];if(!1===this._parsing)i._parsed=s,i._sorted=!0,h=s;else{h=Be(s[t])?this.parseArrayData(i,s,t,e):ze(s[t])?this.parseObjectData(i,s,t,e):this.parsePrimitiveData(i,s,t,e);const n=()=>null===l[o]||d&&l[o]<d[o];for(r=0;r<e;++r)i._parsed[r+t]=l=h[r],c&&(n()&&(c=!1),d=l);i._sorted=c}a&&Ia(this,h)}parsePrimitiveData(t,e,i,s){const{iScale:n,vScale:a}=t,o=n.axis,r=a.axis,l=n.getLabels(),h=n===a,c=new Array(s);let d,u,g;for(d=0,u=s;d<u;++d)g=d+i,c[d]={[o]:h||n.parse(l[g],g),[r]:a.parse(e[g],g)};return c}parseArrayData(t,e,i,s){const{xScale:n,yScale:a}=t,o=new Array(s);let r,l,h,c;for(r=0,l=s;r<l;++r)h=r+i,c=e[h],o[r]={x:n.parse(c[0],h),y:a.parse(c[1],h)};return o}parseObjectData(t,e,i,s){const{xScale:n,yScale:a}=t,{xAxisKey:o="x",yAxisKey:r="y"}=this._parsing,l=new Array(s);let h,c,d,u;for(h=0,c=s;h<c;++h)d=h+i,u=e[d],l[h]={x:n.parse(ni(u,o),d),y:a.parse(ni(u,r),d)};return l}getParsed(t){return this._cachedMeta._parsed[t]}getDataElement(t){return this._cachedMeta.data[t]}applyStack(t,e,i){const s=this.chart,n=this._cachedMeta,a=e[t.axis],o={keys:Fa(s,!0),values:e._stacks[t.axis]._visualValues};return Ma(o,a,n.index,{mode:i})}updateRangeFromParsed(t,e,i,s){const n=i[e.axis];let a=null===n?NaN:n;const o=s&&i._stacks[e.axis];s&&o&&(s.values=o,a=Ma(s,n,this._cachedMeta.index)),t.min=Math.min(t.min,a),t.max=Math.max(t.max,a)}getMinMax(t,e){const i=this._cachedMeta,s=i._parsed,n=i._sorted&&t===i.iScale,a=s.length,o=this._getOtherScale(t),r=Na(e,i,this.chart),l={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY},{min:h,max:c}=Da(o);let d,u;function g(){u=s[d];const e=u[o.axis];return!Ne(u[t.axis])||h>e||c<e}for(d=0;d<a;++d)if(!g()&&(this.updateRangeFromParsed(l,t,u,r),n))break;if(n)for(d=a-1;d>=0;--d)if(!g()){this.updateRangeFromParsed(l,t,u,r);break}return l}getAllParsedValues(t){const e=this._cachedMeta._parsed,i=[];let s,n,a;for(s=0,n=e.length;s<n;++s)a=e[s][t.axis],Ne(a)&&i.push(a);return i}getMaxOverflow(){return!1}getLabelAndValue(t){const e=this._cachedMeta,i=e.iScale,s=e.vScale,n=this.getParsed(t);return{label:i?""+i.getLabelForValue(n[i.axis]):"",value:s?""+s.getLabelForValue(n[s.axis]):""}}_update(t){const e=this._cachedMeta;this.update(t||"default"),e._clip=Sa($e(this.options.clip,Ca(e.xScale,e.yScale,this.getMaxOverflow())))}update(t){}draw(){const t=this._ctx,e=this.chart,i=this._cachedMeta,s=i.data||[],n=e.chartArea,a=[],o=this._drawStart||0,r=this._drawCount||s.length-o,l=this.options.drawActiveElementsOnTop;let h;for(i.dataset&&i.dataset.draw(t,n,o,r),h=o;h<o+r;++h){const e=s[h];e.hidden||(e.active&&l?a.push(e):e.draw(t,n))}for(h=0;h<a.length;++h)a[h].draw(t,n)}getStyle(t,e){const i=e?"active":"default";return void 0===t&&this._cachedMeta.dataset?this.resolveDatasetElementOptions(i):this.resolveDataElementOptions(t||0,i)}getContext(t,e,i){const s=this.getDataset();let n;if(t>=0&&t<this._cachedMeta.data.length){const e=this._cachedMeta.data[t];n=e.$context||(e.$context=Ra(this.getContext(),t,e)),n.parsed=this.getParsed(t),n.raw=s.data[t],n.index=n.dataIndex=t}else n=this.$context||(this.$context=Oa(this.chart.getContext(),this.index)),n.dataset=s,n.index=n.datasetIndex=this.index;return n.active=!!e,n.mode=i,n}resolveDatasetElementOptions(t){return this._resolveElementOptions(this.datasetElementType.id,t)}resolveDataElementOptions(t,e){return this._resolveElementOptions(this.dataElementType.id,e,t)}_resolveElementOptions(t,e="default",i){const s="active"===e,n=this._cachedDataOpts,a=t+"-"+e,o=n[a],r=this.enableOptionSharing&&oi(i);if(o)return za(o,r);const l=this.chart.config,h=l.datasetElementScopeKeys(this._type,t),c=s?[`${t}Hover`,"hover",t,""]:[t,""],d=l.getOptionScopes(this.getDataset(),h),u=Object.keys(ws.elements[t]),g=()=>this.getContext(i,s,e),p=l.resolveNamedOptions(d,u,g,c);return p.$shared&&(p.$shared=r,n[a]=Object.freeze(za(p,r))),p}_resolveAnimations(t,e,i){const s=this.chart,n=this._cachedDataOpts,a=`animation-${e}`,o=n[a];if(o)return o;let r;if(!1!==s.options.animation){const s=this.chart.config,n=s.datasetAnimationScopeKeys(this._type,e),a=s.getOptionScopes(this.getDataset(),n);r=s.createResolver(a,this.getContext(t,i,e))}const l=new _a(s,r&&r.animations);return r&&r._cacheable&&(n[a]=Object.freeze(l)),l}getSharedOptions(t){if(t.$shared)return this._sharedOptions||(this._sharedOptions=Object.assign({},t))}includeOptions(t,e){return!e||Ba(t)||this.chart._animationsDisabled}_getSharedOptions(t,e){const i=this.resolveDataElementOptions(t,e),s=this._sharedOptions,n=this.getSharedOptions(i),a=this.includeOptions(e,n)||n!==s;return this.updateSharedOptions(n,e,i),{sharedOptions:n,includeOptions:a}}updateElement(t,e,i,s){Ba(s)?Object.assign(t,i):this._resolveAnimations(e,s).update(t,i)}updateSharedOptions(t,e,i){t&&!Ba(e)&&this._resolveAnimations(void 0,e).update(t,i)}_setStyle(t,e,i,s){t.active=s;const n=this.getStyle(e,s);this._resolveAnimations(e,i,s).update(t,{options:!s&&this.getSharedOptions(n)||n})}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[o,r,l]of this._syncList)this[o](r,l);this._syncList=[];const s=i.length,n=e.length,a=Math.min(n,s);a&&this.parse(0,a),n>s?this._insertElements(s,n-s,t):n<s&&this._removeElements(n,s-n)}_insertElements(t,e,i=!0){const s=this._cachedMeta,n=s.data,a=t+e;let o;const r=t=>{for(t.length+=e,o=t.length-1;o>=a;o--)t[o]=t[o-e]};for(r(n),o=t;o<a;++o)n[o]=new this.dataElementType;this._parsing&&r(s._parsed),this.parse(t,e),i&&this.updateElements(n,t,e,"reset")}updateElements(t,e,i,s){}_removeElements(t,e){const i=this._cachedMeta;if(this._parsing){const s=i._parsed.splice(t,e);i._stacked&&Wa(i,s)}i.data.splice(t,e)}_sync(t){if(this._parsing)this._syncList.push(t);else{const[e,i,s]=t;this[e](i,s)}this.chart._dataChanges.push([this.index,...t])}_onDataPush(){const t=arguments.length;this._sync(["_insertElements",this.getDataset().data.length-t,t])}_onDataPop(){this._sync(["_removeElements",this._cachedMeta.data.length-1,1])}_onDataShift(){this._sync(["_removeElements",0,1])}_onDataSplice(t,e){e&&this._sync(["_removeElements",t,e]);const i=arguments.length-2;i&&this._sync(["_insertElements",t,i])}_onDataUnshift(){this._sync(["_insertElements",0,arguments.length])}}function $a(t,e){if(!t._cache.$bar){const i=t.getMatchingVisibleMetas(e);let s=[];for(let e=0,n=i.length;e<n;e++)s=s.concat(i[e].controller.getAllParsedValues(t));t._cache.$bar=Hi(s.sort((t,e)=>t-e))}return t._cache.$bar}function ja(t){const e=t.iScale,i=$a(e,t.type);let s,n,a,o,r=e._length;const l=()=>{32767!==a&&-32768!==a&&(oi(o)&&(r=Math.min(r,Math.abs(a-o)||r)),o=a)};for(s=0,n=i.length;s<n;++s)a=e.getPixelForValue(i[s]),l();for(o=void 0,s=0,n=e.ticks.length;s<n;++s)a=e.getPixelForTick(s),l();return r}function Ha(t,e,i,s){const n=i.barThickness;let a,o;return We(n)?(a=e.min*i.categoryPercentage,o=i.barPercentage):(a=n*s,o=1),{chunk:a/s,ratio:o,start:e.pixels[t]-a/2}}function Xa(t,e,i,s){const n=e.pixels,a=n[t];let o=t>0?n[t-1]:null,r=t<n.length-1?n[t+1]:null;const l=i.categoryPercentage;null===o&&(o=a-(null===r?e.end-e.start:r-a)),null===r&&(r=a+a-o);const h=a-(a-Math.min(o,r))/2*l,c=Math.abs(r-o)/2*l;return{chunk:c/s,ratio:i.barPercentage,start:h}}function qa(t,e,i,s){const n=i.parse(t[0],s),a=i.parse(t[1],s),o=Math.min(n,a),r=Math.max(n,a);let l=o,h=r;Math.abs(o)>Math.abs(r)&&(l=r,h=o),e[i.axis]=h,e._custom={barStart:l,barEnd:h,start:n,end:a,min:o,max:r}}function Ka(t,e,i,s){return Be(t)?qa(t,e,i,s):e[i.axis]=i.parse(t,s),e}function Ya(t,e,i,s){const n=t.iScale,a=t.vScale,o=n.getLabels(),r=n===a,l=[];let h,c,d,u;for(h=i,c=i+s;h<c;++h)u=e[h],d={},d[n.axis]=r||n.parse(o[h],h),l.push(Ka(u,d,a,h));return l}function Qa(t){return t&&void 0!==t.barStart&&void 0!==t.barEnd}function Ga(t,e,i){return 0!==t?yi(t):(e.isHorizontal()?1:-1)*(e.min>=i?1:-1)}function Ja(t){let e,i,s,n,a;return t.horizontal?(e=t.base>t.x,i="left",s="right"):(e=t.base<t.y,i="bottom",s="top"),e?(n="end",a="start"):(n="start",a="end"),{start:i,end:s,reverse:e,top:n,bottom:a}}function Za(t,e,i,s){let n=e.borderSkipped;const a={};if(!n)return void(t.borderSkipped=a);if(!0===n)return void(t.borderSkipped={top:!0,right:!0,bottom:!0,left:!0});const{start:o,end:r,reverse:l,top:h,bottom:c}=Ja(t);"middle"===n&&i&&(t.enableBorderRadius=!0,(i._top||0)===s?n=h:(i._bottom||0)===s?n=c:(a[to(c,o,r,l)]=!0,n=h)),a[to(n,o,r,l)]=!0,t.borderSkipped=a}function to(t,e,i,s){return s?(t=eo(t,e,i),t=io(t,i,e)):t=io(t,e,i),t}function eo(t,e,i){return t===e?i:t===i?e:t}function io(t,e,i){return"start"===t?e:"end"===t?i:t}function so(t,{inflateAmount:e},i){t.inflateAmount="auto"===e?1===i?.33:0:e}(0,jt.A)(Ua,"defaults",{}),(0,jt.A)(Ua,"datasetElementType",null),(0,jt.A)(Ua,"dataElementType",null);class no extends Ua{parsePrimitiveData(t,e,i,s){return Ya(t,e,i,s)}parseArrayData(t,e,i,s){return Ya(t,e,i,s)}parseObjectData(t,e,i,s){const{iScale:n,vScale:a}=t,{xAxisKey:o="x",yAxisKey:r="y"}=this._parsing,l="x"===n.axis?o:r,h="x"===a.axis?o:r,c=[];let d,u,g,p;for(d=i,u=i+s;d<u;++d)p=e[d],g={},g[n.axis]=n.parse(ni(p,l),d),c.push(Ka(ni(p,h),g,a,d));return c}updateRangeFromParsed(t,e,i,s){super.updateRangeFromParsed(t,e,i,s);const n=i._custom;n&&e===this._cachedMeta.vScale&&(t.min=Math.min(t.min,n.min),t.max=Math.max(t.max,n.max))}getMaxOverflow(){return 0}getLabelAndValue(t){const e=this._cachedMeta,{iScale:i,vScale:s}=e,n=this.getParsed(t),a=n._custom,o=Qa(a)?"["+a.start+", "+a.end+"]":""+s.getLabelForValue(n[s.axis]);return{label:""+i.getLabelForValue(n[i.axis]),value:o}}initialize(){this.enableOptionSharing=!0,super.initialize();const t=this._cachedMeta;t.stack=this.getDataset().stack}update(t){const e=this._cachedMeta;this.updateElements(e.data,0,e.data.length,t)}updateElements(t,e,i,s){const n="reset"===s,{index:a,_cachedMeta:{vScale:o}}=this,r=o.getBasePixel(),l=o.isHorizontal(),h=this._getRuler(),{sharedOptions:c,includeOptions:d}=this._getSharedOptions(e,s);for(let u=e;u<e+i;u++){const e=this.getParsed(u),i=n||We(e[o.axis])?{base:r,head:r}:this._calculateBarValuePixels(u),g=this._calculateBarIndexPixels(u,h),p=(e._stacks||{})[o.axis],f={horizontal:l,base:i.base,enableBorderRadius:!p||Qa(e._custom)||a===p._top||a===p._bottom,x:l?i.head:g.center,y:l?g.center:i.head,height:l?g.size:Math.abs(i.size),width:l?Math.abs(i.size):g.size};d&&(f.options=c||this.resolveDataElementOptions(u,t[u].active?"active":s));const m=f.options||t[u].options;Za(f,m,p,a),so(f,m,h.ratio),this.updateElement(t[u],u,f,s)}}_getStacks(t,e){const{iScale:i}=this._cachedMeta,s=i.getMatchingVisibleMetas(this._type).filter(t=>t.controller.options.grouped),n=i.options.stacked,a=[],o=this._cachedMeta.controller.getParsed(e),r=o&&o[i.axis],l=t=>{const e=t._parsed.find(t=>t[i.axis]===r),s=e&&e[t.vScale.axis];if(We(s)||isNaN(s))return!0};for(const h of s)if((void 0===e||!l(h))&&((!1===n||-1===a.indexOf(h.stack)||void 0===n&&void 0===h.stack)&&a.push(h.stack),h.index===t))break;return a.length||a.push(void 0),a}_getStackCount(t){return this._getStacks(void 0,t).length}_getAxisCount(){return this._getAxis().length}getFirstScaleIdForIndexAxis(){const t=this.chart.scales,e=this.chart.options.indexAxis;return Object.keys(t).filter(i=>t[i].axis===e).shift()}_getAxis(){const t={},e=this.getFirstScaleIdForIndexAxis();for(const i of this.chart.data.datasets)t[$e("x"===this.chart.options.indexAxis?i.xAxisID:i.yAxisID,e)]=!0;return Object.keys(t)}_getStackIndex(t,e,i){const s=this._getStacks(t,i),n=void 0!==e?s.indexOf(e):-1;return-1===n?s.length-1:n}_getRuler(){const t=this.options,e=this._cachedMeta,i=e.iScale,s=[];let n,a;for(n=0,a=e.data.length;n<a;++n)s.push(i.getPixelForValue(this.getParsed(n)[i.axis],n));const o=t.barThickness,r=o||ja(e);return{min:r,pixels:s,start:i._startPixel,end:i._endPixel,stackCount:this._getStackCount(),scale:i,grouped:t.grouped,ratio:o?1:t.categoryPercentage*t.barPercentage}}_calculateBarValuePixels(t){const{_cachedMeta:{vScale:e,_stacked:i,index:s},options:{base:n,minBarLength:a}}=this,o=n||0,r=this.getParsed(t),l=r._custom,h=Qa(l);let c,d,u=r[e.axis],g=0,p=i?this.applyStack(e,r,i):u;p!==u&&(g=p-u,p=u),h&&(u=l.barStart,p=l.barEnd-l.barStart,0!==u&&yi(u)!==yi(l.barEnd)&&(g=0),g+=u);const f=We(n)||h?g:n;let m=e.getPixelForValue(f);if(c=this.chart.getDataVisibility(t)?e.getPixelForValue(g+p):m,d=c-m,Math.abs(d)<a){d=Ga(d,e,o)*a,u===o&&(m-=d/2);const t=e.getPixelForDecimal(0),n=e.getPixelForDecimal(1),l=Math.min(t,n),g=Math.max(t,n);m=Math.max(Math.min(m,g),l),c=m+d,i&&!h&&(r._stacks[e.axis]._visualValues[s]=e.getValueForPixel(c)-e.getValueForPixel(m))}if(m===e.getPixelForValue(o)){const t=yi(d)*e.getLineWidthForValue(o)/2;m+=t,d-=t}return{size:d,base:m,head:c,center:c+d/2}}_calculateBarIndexPixels(t,e){const i=e.scale,s=this.options,n=s.skipNull,a=$e(s.maxBarThickness,1/0);let o,r;const l=this._getAxisCount();if(e.grouped){const i=n?this._getStackCount(t):e.stackCount,h="flex"===s.barThickness?Xa(t,e,s,i*l):Ha(t,e,s,i*l),c="x"===this.chart.options.indexAxis?this.getDataset().xAxisID:this.getDataset().yAxisID,d=this._getAxis().indexOf($e(c,this.getFirstScaleIdForIndexAxis())),u=this._getStackIndex(this.index,this._cachedMeta.stack,n?t:void 0)+d;o=h.start+h.chunk*u+h.chunk/2,r=Math.min(a,h.chunk*h.ratio)}else o=i.getPixelForValue(this.getParsed(t)[i.axis],t),r=Math.min(a,e.min*e.ratio);return{base:o-r/2,head:o+r/2,center:o,size:r}}draw(){const t=this._cachedMeta,e=t.vScale,i=t.data,s=i.length;let n=0;for(;n<s;++n)null===this.getParsed(n)[e.axis]||i[n].hidden||i[n].draw(this._ctx)}}(0,jt.A)(no,"id","bar"),(0,jt.A)(no,"defaults",{datasetElementType:!1,dataElementType:"bar",categoryPercentage:.8,barPercentage:.9,grouped:!0,animations:{numbers:{type:"number",properties:["x","y","base","width","height"]}}}),(0,jt.A)(no,"overrides",{scales:{_index_:{type:"category",offset:!0,grid:{offset:!0}},_value_:{type:"linear",beginAtZero:!0}}});class ao extends Ua{initialize(){this.enableOptionSharing=!0,super.initialize()}parsePrimitiveData(t,e,i,s){const n=super.parsePrimitiveData(t,e,i,s);for(let a=0;a<n.length;a++)n[a]._custom=this.resolveDataElementOptions(a+i).radius;return n}parseArrayData(t,e,i,s){const n=super.parseArrayData(t,e,i,s);for(let a=0;a<n.length;a++){const t=e[i+a];n[a]._custom=$e(t[2],this.resolveDataElementOptions(a+i).radius)}return n}parseObjectData(t,e,i,s){const n=super.parseObjectData(t,e,i,s);for(let a=0;a<n.length;a++){const t=e[i+a];n[a]._custom=$e(t&&t.r&&+t.r,this.resolveDataElementOptions(a+i).radius)}return n}getMaxOverflow(){const t=this._cachedMeta.data;let e=0;for(let i=t.length-1;i>=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:s,yScale:n}=e,a=this.getParsed(t),o=s.getLabelForValue(a.x),r=n.getLabelForValue(a.y),l=a._custom;return{label:i[t]||"",value:"("+o+", "+r+(l?", "+l:"")+")"}}update(t){const e=this._cachedMeta.data;this.updateElements(e,0,e.length,t)}updateElements(t,e,i,s){const n="reset"===s,{iScale:a,vScale:o}=this._cachedMeta,{sharedOptions:r,includeOptions:l}=this._getSharedOptions(e,s),h=a.axis,c=o.axis;for(let d=e;d<e+i;d++){const e=t[d],i=!n&&this.getParsed(d),u={},g=u[h]=n?a.getPixelForDecimal(.5):a.getPixelForValue(i[h]),p=u[c]=n?o.getBasePixel():o.getPixelForValue(i[c]);u.skip=isNaN(g)||isNaN(p),l&&(u.options=r||this.resolveDataElementOptions(d,e.active?"active":s),n&&(u.options.radius=0)),this.updateElement(e,d,u,s)}}resolveDataElementOptions(t,e){const i=this.getParsed(t);let s=super.resolveDataElementOptions(t,e);s.$shared&&(s=Object.assign({},s,{$shared:!1}));const n=s.radius;return"active"!==e&&(s.radius=0),s.radius+=$e(i&&i._custom,n),s}}function oo(t,e,i){let s=1,n=1,a=0,o=0;if(e<di){const r=t,l=r+e,h=Math.cos(r),c=Math.sin(r),d=Math.cos(l),u=Math.sin(l),g=(t,e,s)=>Ii(t,r,l,!0)?1:Math.max(e,e*i,s,s*i),p=(t,e,s)=>Ii(t,r,l,!0)?-1:Math.min(e,e*i,s,s*i),f=g(0,h,d),m=g(fi,c,u),b=p(ci,h,d),x=p(ci+fi,c,u);s=(f-b)/2,n=(m-x)/2,a=-(f+b)/2,o=-(m+x)/2}return{ratioX:s,ratioY:n,offsetX:a,offsetY:o}}(0,jt.A)(ao,"id","bubble"),(0,jt.A)(ao,"defaults",{datasetElementType:!1,dataElementType:"point",animations:{numbers:{type:"number",properties:["x","y","borderWidth","radius"]}}}),(0,jt.A)(ao,"overrides",{scales:{x:{type:"linear"},y:{type:"linear"}}});class ro extends Ua{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,s=this._cachedMeta;if(!1===this._parsing)s._parsed=i;else{let n,a,o=t=>+i[t];if(ze(i[t])){const{key:t="value"}=this._parsing;o=e=>+ni(i[e],t)}for(n=t,a=t+e;n<a;++n)s._parsed[n]=o(n)}}_getRotation(){return Mi(this.options.rotation-90)}_getCircumference(){return Mi(this.options.circumference)}_getRotationExtents(){let t=di,e=-di;for(let i=0;i<this.chart.data.datasets.length;++i)if(this.chart.isDatasetVisible(i)&&this.chart.getDatasetMeta(i).type===this._type){const s=this.chart.getDatasetMeta(i).controller,n=s._getRotation(),a=s._getCircumference();t=Math.min(t,n),e=Math.max(e,n+a)}return{rotation:t,circumference:e-t}}update(t){const e=this.chart,{chartArea:i}=e,s=this._cachedMeta,n=s.data,a=this.getMaxBorderWidth()+this.getMaxOffset(n)+this.options.spacing,o=Math.max((Math.min(i.width,i.height)-a)/2,0),r=Math.min(je(this.options.cutout,o),1),l=this._getRingWeight(this.index),{circumference:h,rotation:c}=this._getRotationExtents(),{ratioX:d,ratioY:u,offsetX:g,offsetY:p}=oo(c,h,r),f=(i.width-a)/d,m=(i.height-a)/u,b=Math.max(Math.min(f,m)/2,0),x=He(this.options.radius,b),y=Math.max(x*r,0),_=(x-y)/this._getVisibleDatasetWeightTotal();this.offsetX=g*x,this.offsetY=p*x,s.total=this.calculateTotal(),this.outerRadius=x-_*this._getRingWeightOffset(this.index),this.innerRadius=Math.max(this.outerRadius-_*l,0),this.updateElements(n,0,n.length,t)}_circumference(t,e){const i=this.options,s=this._cachedMeta,n=this._getCircumference();return e&&i.animation.animateRotate||!this.chart.getDataVisibility(t)||null===s._parsed[t]||s.data[t].hidden?0:this.calculateCircumference(s._parsed[t]*n/di)}updateElements(t,e,i,s){const n="reset"===s,a=this.chart,o=a.chartArea,r=a.options,l=r.animation,h=(o.left+o.right)/2,c=(o.top+o.bottom)/2,d=n&&l.animateScale,u=d?0:this.innerRadius,g=d?0:this.outerRadius,{sharedOptions:p,includeOptions:f}=this._getSharedOptions(e,s);let m,b=this._getRotation();for(m=0;m<e;++m)b+=this._circumference(m,n);for(m=e;m<e+i;++m){const e=this._circumference(m,n),i=t[m],a={x:h+this.offsetX,y:c+this.offsetY,startAngle:b,endAngle:b+e,circumference:e,outerRadius:g,innerRadius:u};f&&(a.options=p||this.resolveDataElementOptions(m,i.active?"active":s)),b+=e,this.updateElement(i,m,a,s)}}calculateTotal(){const t=this._cachedMeta,e=t.data;let i,s=0;for(i=0;i<e.length;i++){const n=t._parsed[i];null===n||isNaN(n)||!this.chart.getDataVisibility(i)||e[i].hidden||(s+=Math.abs(n))}return s}calculateCircumference(t){const e=this._cachedMeta.total;return e>0&&!isNaN(t)?di*(Math.abs(t)/e):0}getLabelAndValue(t){const e=this._cachedMeta,i=this.chart,s=i.data.labels||[],n=gs(e._parsed[t],i.options.locale);return{label:s[t]||"",value:n}}getMaxBorderWidth(t){let e=0;const i=this.chart;let s,n,a,o,r;if(!t)for(s=0,n=i.data.datasets.length;s<n;++s)if(i.isDatasetVisible(s)){a=i.getDatasetMeta(s),t=a.data,o=a.controller;break}if(!t)return 0;for(s=0,n=t.length;s<n;++s)r=o.resolveDataElementOptions(s),"inner"!==r.borderAlign&&(e=Math.max(e,r.borderWidth||0,r.hoverBorderWidth||0));return e}getMaxOffset(t){let e=0;for(let i=0,s=t.length;i<s;++i){const t=this.resolveDataElementOptions(i);e=Math.max(e,t.offset||0,t.hoverOffset||0)}return e}_getRingWeightOffset(t){let e=0;for(let i=0;i<t;++i)this.chart.isDatasetVisible(i)&&(e+=this._getRingWeight(i));return e}_getRingWeight(t){return Math.max($e(this.chart.data.datasets[t].weight,1),0)}_getVisibleDatasetWeightTotal(){return this._getRingWeightOffset(this.chart.data.datasets.length)||1}}(0,jt.A)(ro,"id","doughnut"),(0,jt.A)(ro,"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"}),(0,jt.A)(ro,"descriptors",{_scriptable:t=>"spacing"!==t,_indexable:t=>"spacing"!==t&&!t.startsWith("borderDash")&&!t.startsWith("hoverBorderDash")}),(0,jt.A)(ro,"overrides",{aspectRatio:1,plugins:{legend:{labels:{generateLabels(t){const e=t.data,{labels:{pointStyle:i,textAlign:s,color:n,useBorderRadius:a,borderRadius:o}}=t.legend.options;return e.labels.length&&e.datasets.length?e.labels.map((e,r)=>{const l=t.getDatasetMeta(0),h=l.controller.getStyle(r);return{text:e,fillStyle:h.backgroundColor,fontColor:n,hidden:!t.getDataVisibility(r),lineDash:h.borderDash,lineDashOffset:h.borderDashOffset,lineJoin:h.borderJoinStyle,lineWidth:h.borderWidth,strokeStyle:h.borderColor,textAlign:s,pointStyle:i,borderRadius:a&&(o||h.borderRadius),index:r}}):[]}},onClick(t,e,i){i.chart.toggleDataVisibility(e.index),i.chart.update()}}}});class lo extends Ua{initialize(){this.enableOptionSharing=!0,this.supportsDecimation=!0,super.initialize()}update(t){const e=this._cachedMeta,{dataset:i,data:s=[],_dataset:n}=e,a=this.chart._animationsDisabled;let{start:o,count:r}=Ji(e,s,a);this._drawStart=o,this._drawCount=r,Zi(e)&&(o=0,r=s.length),i._chart=this.chart,i._datasetIndex=this.index,i._decimated=!!n._decimated,i.points=s;const l=this.resolveDatasetElementOptions(t);this.options.showLine||(l.borderWidth=0),l.segment=this.options.segment,this.updateElement(i,void 0,{animated:!a,options:l},t),this.updateElements(s,o,r,t)}updateElements(t,e,i,s){const n="reset"===s,{iScale:a,vScale:o,_stacked:r,_dataset:l}=this._cachedMeta,{sharedOptions:h,includeOptions:c}=this._getSharedOptions(e,s),d=a.axis,u=o.axis,{spanGaps:g,segment:p}=this.options,f=Ci(g)?g:Number.POSITIVE_INFINITY,m=this.chart._animationsDisabled||n||"none"===s,b=e+i,x=t.length;let y=e>0&&this.getParsed(e-1);for(let _=0;_<x;++_){const i=t[_],g=m?i:{};if(_<e||_>=b){g.skip=!0;continue}const x=this.getParsed(_),v=We(x[u]),k=g[d]=a.getPixelForValue(x[d],_),w=g[u]=n||v?o.getBasePixel():o.getPixelForValue(r?this.applyStack(o,x,r):x[u],_);g.skip=isNaN(k)||isNaN(w)||v,g.stop=_>0&&Math.abs(x[d]-y[d])>f,p&&(g.parsed=x,g.raw=l.data[_]),c&&(g.options=h||this.resolveDataElementOptions(_,i.active?"active":s)),m||this.updateElement(i,_,g,s),y=x}}getMaxOverflow(){const t=this._cachedMeta,e=t.dataset,i=e.options&&e.options.borderWidth||0,s=t.data||[];if(!s.length)return i;const n=s[0].size(this.resolveDataElementOptions(0)),a=s[s.length-1].size(this.resolveDataElementOptions(s.length-1));return Math.max(i,n,a)/2}draw(){const t=this._cachedMeta;t.dataset.updateControlPoints(this.chart.chartArea,t.iScale.axis),super.draw()}}(0,jt.A)(lo,"id","line"),(0,jt.A)(lo,"defaults",{datasetElementType:"line",dataElementType:"point",showLine:!0,spanGaps:!1}),(0,jt.A)(lo,"overrides",{scales:{_index_:{type:"category"},_value_:{type:"linear"}}});class ho extends Ua{constructor(t,e){super(t,e),this.innerRadius=void 0,this.outerRadius=void 0}getLabelAndValue(t){const e=this._cachedMeta,i=this.chart,s=i.data.labels||[],n=gs(e._parsed[t].r,i.options.locale);return{label:s[t]||"",value:n}}parseObjectData(t,e,i,s){return yn.bind(this)(t,e,i,s)}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((t,i)=>{const s=this.getParsed(i).r;!isNaN(s)&&this.chart.getDataVisibility(i)&&(s<e.min&&(e.min=s),s>e.max&&(e.max=s))}),e}_updateRadius(){const t=this.chart,e=t.chartArea,i=t.options,s=Math.min(e.right-e.left,e.bottom-e.top),n=Math.max(s/2,0),a=Math.max(i.cutoutPercentage?n/100*i.cutoutPercentage:1,0),o=(n-a)/t.getVisibleDatasetCount();this.outerRadius=n-o*this.index,this.innerRadius=this.outerRadius-o}updateElements(t,e,i,s){const n="reset"===s,a=this.chart,o=a.options,r=o.animation,l=this._cachedMeta.rScale,h=l.xCenter,c=l.yCenter,d=l.getIndexAngle(0)-.5*ci;let u,g=d;const p=360/this.countVisibleElements();for(u=0;u<e;++u)g+=this._computeAngle(u,s,p);for(u=e;u<e+i;u++){const e=t[u];let i=g,o=g+this._computeAngle(u,s,p),f=a.getDataVisibility(u)?l.getDistanceFromCenterForValue(this.getParsed(u).r):0;g=o,n&&(r.animateScale&&(f=0),r.animateRotate&&(i=o=d));const m={x:h,y:c,innerRadius:0,outerRadius:f,startAngle:i,endAngle:o,options:this.resolveDataElementOptions(u,e.active?"active":s)};this.updateElement(e,u,m,s)}}countVisibleElements(){const t=this._cachedMeta;let e=0;return t.data.forEach((t,i)=>{!isNaN(this.getParsed(i).r)&&this.chart.getDataVisibility(i)&&e++}),e}_computeAngle(t,e,i){return this.chart.getDataVisibility(t)?Mi(this.resolveDataElementOptions(t,e).angle||i):0}}(0,jt.A)(ho,"id","polarArea"),(0,jt.A)(ho,"defaults",{dataElementType:"arc",animation:{animateRotate:!0,animateScale:!0},animations:{numbers:{type:"number",properties:["x","y","startAngle","endAngle","innerRadius","outerRadius"]}},indexAxis:"r",startAngle:0}),(0,jt.A)(ho,"overrides",{aspectRatio:1,plugins:{legend:{labels:{generateLabels(t){const e=t.data;if(e.labels.length&&e.datasets.length){const{labels:{pointStyle:i,color:s}}=t.legend.options;return e.labels.map((e,n)=>{const a=t.getDatasetMeta(0),o=a.controller.getStyle(n);return{text:e,fillStyle:o.backgroundColor,strokeStyle:o.borderColor,fontColor:s,lineWidth:o.borderWidth,pointStyle:i,hidden:!t.getDataVisibility(n),index:n}})}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}}});class co extends ro{}(0,jt.A)(co,"id","pie"),(0,jt.A)(co,"defaults",{cutout:0,rotation:0,circumference:360,radius:"100%"});class uo extends Ua{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,s){return yn.bind(this)(t,e,i,s)}update(t){const e=this._cachedMeta,i=e.dataset,s=e.data||[],n=e.iScale.getLabels();if(i.points=s,"resize"!==t){const e=this.resolveDatasetElementOptions(t);this.options.showLine||(e.borderWidth=0);const a={_loop:!0,_fullLoop:n.length===s.length,options:e};this.updateElement(i,void 0,a,t)}this.updateElements(s,0,s.length,t)}updateElements(t,e,i,s){const n=this._cachedMeta.rScale,a="reset"===s;for(let o=e;o<e+i;o++){const e=t[o],i=this.resolveDataElementOptions(o,e.active?"active":s),r=n.getPointPositionForValue(o,this.getParsed(o).r),l=a?n.xCenter:r.x,h=a?n.yCenter:r.y,c={x:l,y:h,angle:r.angle,skip:isNaN(l)||isNaN(h),options:i};this.updateElement(e,o,c,s)}}}(0,jt.A)(uo,"id","radar"),(0,jt.A)(uo,"defaults",{datasetElementType:"line",dataElementType:"point",indexAxis:"r",showLine:!0,elements:{line:{fill:"start"}}}),(0,jt.A)(uo,"overrides",{aspectRatio:1,scales:{r:{type:"radialLinear"}}});class go extends Ua{getLabelAndValue(t){const e=this._cachedMeta,i=this.chart.data.labels||[],{xScale:s,yScale:n}=e,a=this.getParsed(t),o=s.getLabelForValue(a.x),r=n.getLabelForValue(a.y);return{label:i[t]||"",value:"("+o+", "+r+")"}}update(t){const e=this._cachedMeta,{data:i=[]}=e,s=this.chart._animationsDisabled;let{start:n,count:a}=Ji(e,i,s);if(this._drawStart=n,this._drawCount=a,Zi(e)&&(n=0,a=i.length),this.options.showLine){this.datasetElementType||this.addElements();const{dataset:n,_dataset:a}=e;n._chart=this.chart,n._datasetIndex=this.index,n._decimated=!!a._decimated,n.points=i;const o=this.resolveDatasetElementOptions(t);o.segment=this.options.segment,this.updateElement(n,void 0,{animated:!s,options:o},t)}else this.datasetElementType&&(delete e.dataset,this.datasetElementType=!1);this.updateElements(i,n,a,t)}addElements(){const{showLine:t}=this.options;!this.datasetElementType&&t&&(this.datasetElementType=this.chart.registry.getElement("line")),super.addElements()}updateElements(t,e,i,s){const n="reset"===s,{iScale:a,vScale:o,_stacked:r,_dataset:l}=this._cachedMeta,h=this.resolveDataElementOptions(e,s),c=this.getSharedOptions(h),d=this.includeOptions(s,c),u=a.axis,g=o.axis,{spanGaps:p,segment:f}=this.options,m=Ci(p)?p:Number.POSITIVE_INFINITY,b=this.chart._animationsDisabled||n||"none"===s;let x=e>0&&this.getParsed(e-1);for(let y=e;y<e+i;++y){const e=t[y],i=this.getParsed(y),h=b?e:{},p=We(i[g]),_=h[u]=a.getPixelForValue(i[u],y),v=h[g]=n||p?o.getBasePixel():o.getPixelForValue(r?this.applyStack(o,i,r):i[g],y);h.skip=isNaN(_)||isNaN(v)||p,h.stop=y>0&&Math.abs(i[u]-x[u])>m,f&&(h.parsed=i,h.raw=l.data[y]),d&&(h.options=c||this.resolveDataElementOptions(y,e.active?"active":s)),b||this.updateElement(e,y,h,s),x=i}this.updateSharedOptions(c,s,h)}getMaxOverflow(){const t=this._cachedMeta,e=t.data||[];if(!this.options.showLine){let t=0;for(let i=e.length-1;i>=0;--i)t=Math.max(t,e[i].size(this.resolveDataElementOptions(i))/2);return t>0&&t}const i=t.dataset,s=i.options&&i.options.borderWidth||0;if(!e.length)return s;const n=e[0].size(this.resolveDataElementOptions(0)),a=e[e.length-1].size(this.resolveDataElementOptions(e.length-1));return Math.max(s,n,a)/2}}(0,jt.A)(go,"id","scatter"),(0,jt.A)(go,"defaults",{datasetElementType:!1,dataElementType:"point",showLine:!1,fill:!1}),(0,jt.A)(go,"overrides",{interaction:{mode:"point"},scales:{x:{type:"linear"},y:{type:"linear"}}});function po(){throw new Error("This method is not implemented: Check that a complete date adapter is provided.")}class fo{static override(t){Object.assign(fo.prototype,t)}constructor(t){(0,jt.A)(this,"options",void 0),this.options=t||{}}init(){}formats(){return po()}parse(){return po()}format(){return po()}add(){return po()}diff(){return po()}startOf(){return po()}endOf(){return po()}}var mo={_date:fo};function bo(t,e,i,s){const{controller:n,data:a,_sorted:o}=t,r=n._cachedMeta.iScale,l=t.dataset&&t.dataset.options?t.dataset.options.spanGaps:null;if(r&&e===r.axis&&"r"!==e&&o&&a.length){const o=r._reversePixels?zi:Bi;if(!s){const s=o(a,e,i);if(l){const{vScale:e}=n._cachedMeta,{_parsed:i}=t,a=i.slice(0,s.lo+1).reverse().findIndex(t=>!We(t[e.axis]));s.lo-=Math.max(0,a);const o=i.slice(s.hi).findIndex(t=>!We(t[e.axis]));s.hi+=Math.max(0,o)}return s}if(n._sharedOptions){const t=a[0],s="function"===typeof t.getRange&&t.getRange(e);if(s){const t=o(a,e,i-s),n=o(a,e,i+s);return{lo:t.lo,hi:n.hi}}}}return{lo:0,hi:a.length-1}}function xo(t,e,i,s,n){const a=t.getSortedVisibleDatasetMetas(),o=i[e];for(let r=0,l=a.length;r<l;++r){const{index:t,data:i}=a[r],{lo:l,hi:h}=bo(a[r],e,o,n);for(let e=l;e<=h;++e){const n=i[e];n.skip||s(n,t,e)}}}function yo(t){const e=-1!==t.indexOf("x"),i=-1!==t.indexOf("y");return function(t,s){const n=e?Math.abs(t.x-s.x):0,a=i?Math.abs(t.y-s.y):0;return Math.sqrt(Math.pow(n,2)+Math.pow(a,2))}}function _o(t,e,i,s,n){const a=[];if(!n&&!t.isPointInArea(e))return a;const o=function(i,o,r){(n||Ds(i,t.chartArea,0))&&i.inRange(e.x,e.y,s)&&a.push({element:i,datasetIndex:o,index:r})};return xo(t,i,e,o,!0),a}function vo(t,e,i,s){let n=[];function a(t,i,a){const{startAngle:o,endAngle:r}=t.getProps(["startAngle","endAngle"],s),{angle:l}=Pi(t,{x:e.x,y:e.y});Ii(l,o,r)&&n.push({element:t,datasetIndex:i,index:a})}return xo(t,i,e,a),n}function ko(t,e,i,s,n,a){let o=[];const r=yo(i);let l=Number.POSITIVE_INFINITY;function h(i,h,c){const d=i.inRange(e.x,e.y,n);if(s&&!d)return;const u=i.getCenterPoint(n),g=!!a||t.isPointInArea(u);if(!g&&!d)return;const p=r(e,u);p<l?(o=[{element:i,datasetIndex:h,index:c}],l=p):p===l&&o.push({element:i,datasetIndex:h,index:c})}return xo(t,i,e,h),o}function wo(t,e,i,s,n,a){return a||t.isPointInArea(e)?"r"!==i||s?ko(t,e,i,s,n,a):vo(t,e,i,n):[]}function Co(t,e,i,s,n){const a=[],o="x"===i?"inXRange":"inYRange";let r=!1;return xo(t,i,e,(t,s,l)=>{t[o]&&t[o](e[i],n)&&(a.push({element:t,datasetIndex:s,index:l}),r=r||t.inRange(e.x,e.y,n))}),s&&!r?[]:a}var So={evaluateInteractionItems:xo,modes:{index(t,e,i,s){const n=Bn(e,t),a=i.axis||"x",o=i.includeInvisible||!1,r=i.intersect?_o(t,n,a,s,o):wo(t,n,a,!1,s,o),l=[];return r.length?(t.getSortedVisibleDatasetMetas().forEach(t=>{const e=r[0].index,i=t.data[e];i&&!i.skip&&l.push({element:i,datasetIndex:t.index,index:e})}),l):[]},dataset(t,e,i,s){const n=Bn(e,t),a=i.axis||"xy",o=i.includeInvisible||!1;let r=i.intersect?_o(t,n,a,s,o):wo(t,n,a,!1,s,o);if(r.length>0){const e=r[0].datasetIndex,i=t.getDatasetMeta(e).data;r=[];for(let t=0;t<i.length;++t)r.push({element:i[t],datasetIndex:e,index:t})}return r},point(t,e,i,s){const n=Bn(e,t),a=i.axis||"xy",o=i.includeInvisible||!1;return _o(t,n,a,s,o)},nearest(t,e,i,s){const n=Bn(e,t),a=i.axis||"xy",o=i.includeInvisible||!1;return wo(t,n,a,i.intersect,s,o)},x(t,e,i,s){const n=Bn(e,t);return Co(t,n,"x",i.intersect,s)},y(t,e,i,s){const n=Bn(e,t);return Co(t,n,"y",i.intersect,s)}}};const Fo=["left","top","right","bottom"];function Mo(t,e){return t.filter(t=>t.pos===e)}function Ao(t,e){return t.filter(t=>-1===Fo.indexOf(t.pos)&&t.box.axis===e)}function To(t,e){return t.sort((t,i)=>{const s=e?i:t,n=e?t:i;return s.weight===n.weight?s.index-n.index:s.weight-n.weight})}function Po(t){const e=[];let i,s,n,a,o,r;for(i=0,s=(t||[]).length;i<s;++i)n=t[i],({position:a,options:{stack:o,stackWeight:r=1}}=n),e.push({index:i,box:n,pos:a,horizontal:n.isHorizontal(),weight:n.weight,stack:o&&a+o,stackWeight:r});return e}function Do(t){const e={};for(const i of t){const{stack:t,pos:s,stackWeight:n}=i;if(!t||!Fo.includes(s))continue;const a=e[t]||(e[t]={count:0,placed:0,weight:0,size:0});a.count++,a.weight+=n}return e}function Eo(t,e){const i=Do(t),{vBoxMaxWidth:s,hBoxMaxHeight:n}=e;let a,o,r;for(a=0,o=t.length;a<o;++a){r=t[a];const{fullSize:o}=r.box,l=i[r.stack],h=l&&r.stackWeight/l.weight;r.horizontal?(r.width=h?h*s:o&&e.availableWidth,r.height=n):(r.width=s,r.height=h?h*n:o&&e.availableHeight)}return i}function Lo(t){const e=Po(t),i=To(e.filter(t=>t.box.fullSize),!0),s=To(Mo(e,"left"),!0),n=To(Mo(e,"right")),a=To(Mo(e,"top"),!0),o=To(Mo(e,"bottom")),r=Ao(e,"x"),l=Ao(e,"y");return{fullSize:i,leftAndTop:s.concat(a),rightAndBottom:n.concat(l).concat(o).concat(r),chartArea:Mo(e,"chartArea"),vertical:s.concat(n).concat(l),horizontal:a.concat(o).concat(r)}}function Io(t,e,i,s){return Math.max(t[i],e[i])+Math.max(t[s],e[s])}function Vo(t,e){t.top=Math.max(t.top,e.top),t.left=Math.max(t.left,e.left),t.bottom=Math.max(t.bottom,e.bottom),t.right=Math.max(t.right,e.right)}function Oo(t,e,i,s){const{pos:n,box:a}=i,o=t.maxPadding;if(!ze(n)){i.size&&(t[n]-=i.size);const e=s[i.stack]||{size:0,count:1};e.size=Math.max(e.size,i.horizontal?a.height:a.width),i.size=e.size/e.count,t[n]+=i.size}a.getPadding&&Vo(o,a.getPadding());const r=Math.max(0,e.outerWidth-Io(o,t,"left","right")),l=Math.max(0,e.outerHeight-Io(o,t,"top","bottom")),h=r!==t.w,c=l!==t.h;return t.w=r,t.h=l,i.horizontal?{same:h,other:c}:{same:c,other:h}}function Ro(t){const e=t.maxPadding;function i(i){const s=Math.max(e[i]-t[i],0);return t[i]+=s,s}t.y+=i("top"),t.x+=i("left"),i("right"),i("bottom")}function Wo(t,e){const i=e.maxPadding;function s(t){const s={left:0,top:0,right:0,bottom:0};return t.forEach(t=>{s[t]=Math.max(e[t],i[t])}),s}return s(t?["left","right"]:["top","bottom"])}function Bo(t,e,i,s){const n=[];let a,o,r,l,h,c;for(a=0,o=t.length,h=0;a<o;++a){r=t[a],l=r.box,l.update(r.width||e.w,r.height||e.h,Wo(r.horizontal,e));const{same:o,other:d}=Oo(e,i,r,s);h|=o&&n.length,c=c||d,l.fullSize||n.push(r)}return h&&Bo(n,e,i,s)||c}function zo(t,e,i,s,n){t.top=i,t.left=e,t.right=e+s,t.bottom=i+n,t.width=s,t.height=n}function No(t,e,i,s){const n=i.padding;let{x:a,y:o}=e;for(const r of t){const t=r.box,l=s[r.stack]||{count:1,placed:0,weight:1},h=r.stackWeight/l.weight||1;if(r.horizontal){const s=e.w*h,a=l.size||t.height;oi(l.start)&&(o=l.start),t.fullSize?zo(t,n.left,o,i.outerWidth-n.right-n.left,a):zo(t,e.left+l.placed,o,s,a),l.start=o,l.placed+=s,o=t.bottom}else{const s=e.h*h,o=l.size||t.width;oi(l.start)&&(a=l.start),t.fullSize?zo(t,a,n.top,o,i.outerHeight-n.bottom-n.top):zo(t,a,e.top+l.placed,o,s),l.start=a,l.placed+=s,a=t.right}}e.x=a,e.y=o}var Uo={addBox(t,e){t.boxes||(t.boxes=[]),e.fullSize=e.fullSize||!1,e.position=e.position||"top",e.weight=e.weight||0,e._layers=e._layers||function(){return[{z:0,draw(t){e.draw(t)}}]},t.boxes.push(e)},removeBox(t,e){const i=t.boxes?t.boxes.indexOf(e):-1;-1!==i&&t.boxes.splice(i,1)},configure(t,e,i){e.fullSize=i.fullSize,e.position=i.position,e.weight=i.weight},update(t,e,i,s){if(!t)return;const n=Ks(t.options.layout.padding),a=Math.max(e-n.width,0),o=Math.max(i-n.height,0),r=Lo(t.boxes),l=r.vertical,h=r.horizontal;qe(t.boxes,t=>{"function"===typeof t.beforeLayout&&t.beforeLayout()});const c=l.reduce((t,e)=>e.box.options&&!1===e.box.options.display?t:t+1,0)||1,d=Object.freeze({outerWidth:e,outerHeight:i,padding:n,availableWidth:a,availableHeight:o,vBoxMaxWidth:a/2/c,hBoxMaxHeight:o/2}),u=Object.assign({},n);Vo(u,Ks(s));const g=Object.assign({maxPadding:u,w:a,h:o,x:n.left,y:n.top},n),p=Eo(l.concat(h),d);Bo(r.fullSize,g,d,p),Bo(l,g,d,p),Bo(h,g,d,p)&&Bo(l,g,d,p),Ro(g),No(r.leftAndTop,g,d,p),g.x+=g.w,g.y+=g.h,No(r.rightAndBottom,g,d,p),t.chartArea={left:g.left,top:g.top,right:g.left+g.w,bottom:g.top+g.h,height:g.h,width:g.w},qe(r.chartArea,e=>{const i=e.box;Object.assign(i,t.chartArea),i.update(g.w,g.h,{left:0,top:0,right:0,bottom:0})})}};class $o{acquireContext(t,e){}releaseContext(t){return!1}addEventListener(t,e,i){}removeEventListener(t,e,i){}getDevicePixelRatio(){return 1}getMaximumSize(t,e,i,s){return e=Math.max(0,e||t.width),i=i||t.height,{width:e,height:Math.max(0,s?Math.floor(e/s):i)}}isAttached(t){return!0}updateConfig(t){}}class jo extends $o{acquireContext(t){return t&&t.getContext&&t.getContext("2d")||null}updateConfig(t){t.options.animation=!1}}const Ho="$chartjs",Xo={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},qo=t=>null===t||""===t;function Ko(t,e){const i=t.style,s=t.getAttribute("height"),n=t.getAttribute("width");if(t[Ho]={initial:{height:s,width:n,style:{display:i.display,height:i.height,width:i.width}}},i.display=i.display||"block",i.boxSizing=i.boxSizing||"border-box",qo(n)){const e=Hn(t,"width");void 0!==e&&(t.width=e)}if(qo(s))if(""===t.style.height)t.height=t.width/(e||2);else{const e=Hn(t,"height");void 0!==e&&(t.height=e)}return t}const Yo=!!jn&&{passive:!0};function Qo(t,e,i){t&&t.addEventListener(e,i,Yo)}function Go(t,e,i){t&&t.canvas&&t.canvas.removeEventListener(e,i,Yo)}function Jo(t,e){const i=Xo[t.type]||t.type,{x:s,y:n}=Bn(t,e);return{type:i,chart:e,native:t,x:void 0!==s?s:null,y:void 0!==n?n:null}}function Zo(t,e){for(const i of t)if(i===e||i.contains(e))return!0}function tr(t,e,i){const s=t.canvas,n=new MutationObserver(t=>{let e=!1;for(const i of t)e=e||Zo(i.addedNodes,s),e=e&&!Zo(i.removedNodes,s);e&&i()});return n.observe(document,{childList:!0,subtree:!0}),n}function er(t,e,i){const s=t.canvas,n=new MutationObserver(t=>{let e=!1;for(const i of t)e=e||Zo(i.removedNodes,s),e=e&&!Zo(i.addedNodes,s);e&&i()});return n.observe(document,{childList:!0,subtree:!0}),n}const ir=new Map;let sr=0;function nr(){const t=window.devicePixelRatio;t!==sr&&(sr=t,ir.forEach((e,i)=>{i.currentDevicePixelRatio!==t&&e()}))}function ar(t,e){ir.size||window.addEventListener("resize",nr),ir.set(t,e)}function or(t){ir.delete(t),ir.size||window.removeEventListener("resize",nr)}function rr(t,e,i){const s=t.canvas,n=s&&Dn(s);if(!n)return;const a=qi((t,e)=>{const s=n.clientWidth;i(t,e),s<n.clientWidth&&i()},window),o=new ResizeObserver(t=>{const e=t[0],i=e.contentRect.width,s=e.contentRect.height;0===i&&0===s||a(i,s)});return o.observe(n),ar(t,a),o}function lr(t,e,i){i&&i.disconnect(),"resize"===e&&or(t)}function hr(t,e,i){const s=t.canvas,n=qi(e=>{null!==t.ctx&&i(Jo(e,t))},t);return Qo(s,e,n),n}class cr extends $o{acquireContext(t,e){const i=t&&t.getContext&&t.getContext("2d");return i&&i.canvas===t?(Ko(t,e),i):null}releaseContext(t){const e=t.canvas;if(!e[Ho])return!1;const i=e[Ho].initial;["height","width"].forEach(t=>{const s=i[t];We(s)?e.removeAttribute(t):e.setAttribute(t,s)});const s=i.style||{};return Object.keys(s).forEach(t=>{e.style[t]=s[t]}),e.width=e.width,delete e[Ho],!0}addEventListener(t,e,i){this.removeEventListener(t,e);const s=t.$proxies||(t.$proxies={}),n={attach:tr,detach:er,resize:rr},a=n[e]||hr;s[e]=a(t,e,i)}removeEventListener(t,e){const i=t.$proxies||(t.$proxies={}),s=i[e];if(!s)return;const n={attach:lr,detach:lr,resize:lr},a=n[e]||Go;a(t,e,s),i[e]=void 0}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(t,e,i,s){return Un(t,e,i,s)}isAttached(t){const e=t&&Dn(t);return!(!e||!e.isConnected)}}function dr(t){return!Pn()||"undefined"!==typeof OffscreenCanvas&&t instanceof OffscreenCanvas?jo:cr}class ur{constructor(){(0,jt.A)(this,"x",void 0),(0,jt.A)(this,"y",void 0),(0,jt.A)(this,"active",!1),(0,jt.A)(this,"options",void 0),(0,jt.A)(this,"$animations",void 0)}tooltipPosition(t){const{x:e,y:i}=this.getProps(["x","y"],t);return{x:e,y:i}}hasValue(){return Ci(this.x)&&Ci(this.y)}getProps(t,e){const i=this.$animations;if(!e||!i)return this;const s={};return t.forEach(t=>{s[t]=i[t]&&i[t].active()?i[t]._to:this[t]}),s}}function gr(t,e){const i=t.options.ticks,s=pr(t),n=Math.min(i.maxTicksLimit||s,s),a=i.major.enabled?mr(e):[],o=a.length,r=a[0],l=a[o-1],h=[];if(o>n)return br(e,h,a,o/n),h;const c=fr(a,e,n);if(o>0){let t,i;const s=o>1?Math.round((l-r)/(o-1)):null;for(xr(e,h,c,We(s)?0:r-s,r),t=0,i=o-1;t<i;t++)xr(e,h,c,a[t],a[t+1]);return xr(e,h,c,l,We(s)?e.length:l+s),h}return xr(e,h,c),h}function pr(t){const e=t.options.offset,i=t._tickSize(),s=t._length/i+(e?0:1),n=t._maxLength/i;return Math.floor(Math.min(s,n))}function fr(t,e,i){const s=yr(t),n=e.length/i;if(!s)return Math.max(n,1);const a=ki(s);for(let o=0,r=a.length-1;o<r;o++){const t=a[o];if(t>n)return t}return Math.max(n,1)}function mr(t){const e=[];let i,s;for(i=0,s=t.length;i<s;i++)t[i].major&&e.push(i);return e}function br(t,e,i,s){let n,a=0,o=i[0];for(s=Math.ceil(s),n=0;n<t.length;n++)n===o&&(e.push(t[n]),a++,o=i[a*s])}function xr(t,e,i,s,n){const a=$e(s,0),o=Math.min($e(n,t.length),t.length);let r,l,h,c=0;i=Math.ceil(i),n&&(r=n-s,i=r/Math.floor(r/i)),h=a;while(h<0)c++,h=Math.round(a+c*i);for(l=Math.max(a,0);l<o;l++)l===h&&(e.push(t[l]),c++,h=Math.round(a+c*i))}function yr(t){const e=t.length;let i,s;if(e<2)return!1;for(s=t[0],i=1;i<e;++i)if(t[i]-t[i-1]!==s)return!1;return s}(0,jt.A)(ur,"defaults",{}),(0,jt.A)(ur,"defaultRoutes",void 0);const _r=t=>"left"===t?"right":"right"===t?"left":t,vr=(t,e,i)=>"top"===e||"left"===e?t[e]+i:t[e]-i,kr=(t,e)=>Math.min(e||t,t);function wr(t,e){const i=[],s=t.length/e,n=t.length;let a=0;for(;a<n;a+=s)i.push(t[Math.floor(a)]);return i}function Cr(t,e,i){const s=t.ticks.length,n=Math.min(e,s-1),a=t._startPixel,o=t._endPixel,r=1e-6;let l,h=t.getPixelForTick(n);if(!(i&&(l=1===s?Math.max(h-a,o-h):0===e?(t.getPixelForTick(1)-h)/2:(h-t.getPixelForTick(n-1))/2,h+=n<e?l:-l,h<a-r||h>o+r)))return h}function Sr(t,e){qe(t,t=>{const i=t.gc,s=i.length/2;let n;if(s>e){for(n=0;n<s;++n)delete t.data[i[n]];i.splice(0,s)}})}function Fr(t){return t.drawTicks?t.tickLength:0}function Mr(t,e){if(!t.display)return 0;const i=Ys(t.font,e),s=Ks(t.padding),n=Be(t.text)?t.text.length:1;return n*i.lineHeight+s.height}function Ar(t,e){return Js(t,{scale:e,type:"scale"})}function Tr(t,e,i){return Js(t,{tick:i,index:e,type:"tick"})}function Pr(t,e,i){let s=Yi(t);return(i&&"right"!==e||!i&&"right"===e)&&(s=_r(s)),s}function Dr(t,e,i,s){const{top:n,left:a,bottom:o,right:r,chart:l}=t,{chartArea:h,scales:c}=l;let d,u,g,p=0;const f=o-n,m=r-a;if(t.isHorizontal()){if(u=Qi(s,a,r),ze(i)){const t=Object.keys(i)[0],s=i[t];g=c[t].getPixelForValue(s)+f-e}else g="center"===i?(h.bottom+h.top)/2+f-e:vr(t,i,e);d=r-a}else{if(ze(i)){const t=Object.keys(i)[0],s=i[t];u=c[t].getPixelForValue(s)-m+e}else u="center"===i?(h.left+h.right)/2-m+e:vr(t,i,e);g=Qi(s,o,n),p="left"===i?-fi:fi}return{titleX:u,titleY:g,maxWidth:d,rotation:p}}class Er extends ur{constructor(t){super(),this.id=t.id,this.type=t.type,this.options=void 0,this.ctx=t.ctx,this.chart=t.chart,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this._margins={left:0,right:0,top:0,bottom:0},this.maxWidth=void 0,this.maxHeight=void 0,this.paddingTop=void 0,this.paddingBottom=void 0,this.paddingLeft=void 0,this.paddingRight=void 0,this.axis=void 0,this.labelRotation=void 0,this.min=void 0,this.max=void 0,this._range=void 0,this.ticks=[],this._gridLineItems=null,this._labelItems=null,this._labelSizes=null,this._length=0,this._maxLength=0,this._longestTextCache={},this._startPixel=void 0,this._endPixel=void 0,this._reversePixels=!1,this._userMax=void 0,this._userMin=void 0,this._suggestedMax=void 0,this._suggestedMin=void 0,this._ticksLength=0,this._borderValue=0,this._cache={},this._dataLimitsCached=!1,this.$context=void 0}init(t){this.options=t.setContext(this.getContext()),this.axis=t.axis,this._userMin=this.parse(t.min),this._userMax=this.parse(t.max),this._suggestedMin=this.parse(t.suggestedMin),this._suggestedMax=this.parse(t.suggestedMax)}parse(t,e){return t}getUserBounds(){let{_userMin:t,_userMax:e,_suggestedMin:i,_suggestedMax:s}=this;return t=Ue(t,Number.POSITIVE_INFINITY),e=Ue(e,Number.NEGATIVE_INFINITY),i=Ue(i,Number.POSITIVE_INFINITY),s=Ue(s,Number.NEGATIVE_INFINITY),{min:Ue(t,i),max:Ue(e,s),minDefined:Ne(t),maxDefined:Ne(e)}}getMinMax(t){let e,{min:i,max:s,minDefined:n,maxDefined:a}=this.getUserBounds();if(n&&a)return{min:i,max:s};const o=this.getMatchingVisibleMetas();for(let r=0,l=o.length;r<l;++r)e=o[r].controller.getMinMax(this,t),n||(i=Math.min(i,e.min)),a||(s=Math.max(s,e.max));return i=a&&i>s?s:i,s=n&&i>s?i:s,{min:Ue(i,Ue(s,i)),max:Ue(s,Ue(i,s))}}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){const e=this._labelItems||(this._labelItems=this._computeLabelItems(t));return e}beforeLayout(){this._cache={},this._dataLimitsCached=!1}beforeUpdate(){Xe(this.options.beforeUpdate,[this])}update(t,e,i){const{beginAtZero:s,grace:n,ticks:a}=this.options,o=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=Gs(this,n,s),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();const r=o<this.ticks.length;this._convertTicksToLabels(r?wr(this.ticks,o):this.ticks),this.configure(),this.beforeCalculateLabelRotation(),this.calculateLabelRotation(),this.afterCalculateLabelRotation(),a.display&&(a.autoSkip||"auto"===a.source)&&(this.ticks=gr(this,this.ticks),this._labelSizes=null,this.afterAutoSkip()),r&&this._convertTicksToLabels(this.ticks),this.beforeFit(),this.fit(),this.afterFit(),this.afterUpdate()}configure(){let t,e,i=this.options.reverse;this.isHorizontal()?(t=this.left,e=this.right):(t=this.top,e=this.bottom,i=!i),this._startPixel=t,this._endPixel=e,this._reversePixels=i,this._length=e-t,this._alignToPixels=this.options.alignToPixels}afterUpdate(){Xe(this.options.afterUpdate,[this])}beforeSetDimensions(){Xe(this.options.beforeSetDimensions,[this])}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=0,this.right=this.width):(this.height=this.maxHeight,this.top=0,this.bottom=this.height),this.paddingLeft=0,this.paddingTop=0,this.paddingRight=0,this.paddingBottom=0}afterSetDimensions(){Xe(this.options.afterSetDimensions,[this])}_callHooks(t){this.chart.notifyPlugins(t,this.getContext()),Xe(this.options[t],[this])}beforeDataLimits(){this._callHooks("beforeDataLimits")}determineDataLimits(){}afterDataLimits(){this._callHooks("afterDataLimits")}beforeBuildTicks(){this._callHooks("beforeBuildTicks")}buildTicks(){return[]}afterBuildTicks(){this._callHooks("afterBuildTicks")}beforeTickToLabelConversion(){Xe(this.options.beforeTickToLabelConversion,[this])}generateTickLabels(t){const e=this.options.ticks;let i,s,n;for(i=0,s=t.length;i<s;i++)n=t[i],n.label=Xe(e.callback,[n.value,i,t],this)}afterTickToLabelConversion(){Xe(this.options.afterTickToLabelConversion,[this])}beforeCalculateLabelRotation(){Xe(this.options.beforeCalculateLabelRotation,[this])}calculateLabelRotation(){const t=this.options,e=t.ticks,i=kr(this.ticks.length,t.ticks.maxTicksLimit),s=e.minRotation||0,n=e.maxRotation;let a,o,r,l=s;if(!this._isVisible()||!e.display||s>=n||i<=1||!this.isHorizontal())return void(this.labelRotation=s);const h=this._getLabelSizes(),c=h.widest.width,d=h.highest.height,u=Vi(this.chart.width-c,0,this.maxWidth);a=t.offset?this.maxWidth/i:u/(i-1),c+6>a&&(a=u/(i-(t.offset?.5:1)),o=this.maxHeight-Fr(t.grid)-e.padding-Mr(t.title,this.chart.options.font),r=Math.sqrt(c*c+d*d),l=Ai(Math.min(Math.asin(Vi((h.highest.height+6)/a,-1,1)),Math.asin(Vi(o/r,-1,1))-Math.asin(Vi(d/r,-1,1)))),l=Math.max(s,Math.min(n,l))),this.labelRotation=l}afterCalculateLabelRotation(){Xe(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){Xe(this.options.beforeFit,[this])}fit(){const t={width:0,height:0},{chart:e,options:{ticks:i,title:s,grid:n}}=this,a=this._isVisible(),o=this.isHorizontal();if(a){const a=Mr(s,e.options.font);if(o?(t.width=this.maxWidth,t.height=Fr(n)+a):(t.height=this.maxHeight,t.width=Fr(n)+a),i.display&&this.ticks.length){const{first:e,last:s,widest:n,highest:a}=this._getLabelSizes(),r=2*i.padding,l=Mi(this.labelRotation),h=Math.cos(l),c=Math.sin(l);if(o){const e=i.mirror?0:c*n.width+h*a.height;t.height=Math.min(this.maxHeight,t.height+e+r)}else{const e=i.mirror?0:h*n.width+c*a.height;t.width=Math.min(this.maxWidth,t.width+e+r)}this._calculatePadding(e,s,c,h)}}this._handleMargins(),o?(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,s){const{ticks:{align:n,padding:a},position:o}=this.options,r=0!==this.labelRotation,l="top"!==o&&"x"===this.axis;if(this.isHorizontal()){const o=this.getPixelForTick(0)-this.left,h=this.right-this.getPixelForTick(this.ticks.length-1);let c=0,d=0;r?l?(c=s*t.width,d=i*e.height):(c=i*t.height,d=s*e.width):"start"===n?d=e.width:"end"===n?c=t.width:"inner"!==n&&(c=t.width/2,d=e.width/2),this.paddingLeft=Math.max((c-o+a)*this.width/(this.width-o),0),this.paddingRight=Math.max((d-h+a)*this.width/(this.width-h),0)}else{let i=e.height/2,s=t.height/2;"start"===n?(i=0,s=t.height):"end"===n&&(i=e.height,s=0),this.paddingTop=i+a,this.paddingBottom=s+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(){Xe(this.options.afterFit,[this])}isHorizontal(){const{axis:t,position:e}=this.options;return"top"===e||"bottom"===e||"x"===t}isFullSize(){return this.options.fullSize}_convertTicksToLabels(t){let e,i;for(this.beforeTickToLabelConversion(),this.generateTickLabels(t),e=0,i=t.length;e<i;e++)We(t[e].label)&&(t.splice(e,1),i--,e--);this.afterTickToLabelConversion()}_getLabelSizes(){let t=this._labelSizes;if(!t){const e=this.options.ticks.sampleSize;let i=this.ticks;e<i.length&&(i=wr(i,e)),this._labelSizes=t=this._computeLabelSizes(i,i.length,this.options.ticks.maxTicksLimit)}return t}_computeLabelSizes(t,e,i){const{ctx:s,_longestTextCache:n}=this,a=[],o=[],r=Math.floor(e/kr(e,i));let l,h,c,d,u,g,p,f,m,b,x,y=0,_=0;for(l=0;l<e;l+=r){if(d=t[l].label,u=this._resolveTickFontOptions(l),s.font=g=u.string,p=n[g]=n[g]||{data:{},gc:[]},f=u.lineHeight,m=b=0,We(d)||Be(d)){if(Be(d))for(h=0,c=d.length;h<c;++h)x=d[h],We(x)||Be(x)||(m=Ss(s,p.data,p.gc,m,x),b+=f)}else m=Ss(s,p.data,p.gc,m,d),b=f;a.push(m),o.push(b),y=Math.max(m,y),_=Math.max(b,_)}Sr(n,e);const v=a.indexOf(y),k=o.indexOf(_),w=t=>({width:a[t]||0,height:o[t]||0});return{first:w(0),last:w(e-1),widest:w(v),highest:w(k),widths:a,heights:o}}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 Oi(this._alignToPixels?Ms(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&&t<e.length){const i=e[t];return i.$context||(i.$context=Tr(this.getContext(),t,i))}return this.$context||(this.$context=Ar(this.chart.getContext(),this))}_tickSize(){const t=this.options.ticks,e=Mi(this.labelRotation),i=Math.abs(Math.cos(e)),s=Math.abs(Math.sin(e)),n=this._getLabelSizes(),a=t.autoSkipPadding||0,o=n?n.widest.width+a:0,r=n?n.highest.height+a:0;return this.isHorizontal()?r*i>o*s?o/i:r/s:r*s<o*i?r/i:o/s}_isVisible(){const t=this.options.display;return"auto"!==t?!!t:this.getMatchingVisibleMetas().length>0}_computeGridLineItems(t){const e=this.axis,i=this.chart,s=this.options,{grid:n,position:a,border:o}=s,r=n.offset,l=this.isHorizontal(),h=this.ticks,c=h.length+(r?1:0),d=Fr(n),u=[],g=o.setContext(this.getContext()),p=g.display?g.width:0,f=p/2,m=function(t){return Ms(i,t,p)};let b,x,y,_,v,k,w,C,S,F,M,A;if("top"===a)b=m(this.bottom),k=this.bottom-d,C=b-f,F=m(t.top)+f,A=t.bottom;else if("bottom"===a)b=m(this.top),F=t.top,A=m(t.bottom)-f,k=b+f,C=this.top+d;else if("left"===a)b=m(this.right),v=this.right-d,w=b-f,S=m(t.left)+f,M=t.right;else if("right"===a)b=m(this.left),S=t.left,M=m(t.right)-f,v=b+f,w=this.left+d;else if("x"===e){if("center"===a)b=m((t.top+t.bottom)/2+.5);else if(ze(a)){const t=Object.keys(a)[0],e=a[t];b=m(this.chart.scales[t].getPixelForValue(e))}F=t.top,A=t.bottom,k=b+f,C=k+d}else if("y"===e){if("center"===a)b=m((t.left+t.right)/2);else if(ze(a)){const t=Object.keys(a)[0],e=a[t];b=m(this.chart.scales[t].getPixelForValue(e))}v=b-f,w=v-d,S=t.left,M=t.right}const T=$e(s.ticks.maxTicksLimit,c),P=Math.max(1,Math.ceil(c/T));for(x=0;x<c;x+=P){const t=this.getContext(x),e=n.setContext(t),s=o.setContext(t),a=e.lineWidth,h=e.color,c=s.dash||[],d=s.dashOffset,g=e.tickWidth,p=e.tickColor,f=e.tickBorderDash||[],m=e.tickBorderDashOffset;y=Cr(this,x,r),void 0!==y&&(_=Ms(i,y,a),l?v=w=S=M=_:k=C=F=A=_,u.push({tx1:v,ty1:k,tx2:w,ty2:C,x1:S,y1:F,x2:M,y2:A,width:a,color:h,borderDash:c,borderDashOffset:d,tickWidth:g,tickColor:p,tickBorderDash:f,tickBorderDashOffset:m}))}return this._ticksLength=c,this._borderValue=b,u}_computeLabelItems(t){const e=this.axis,i=this.options,{position:s,ticks:n}=i,a=this.isHorizontal(),o=this.ticks,{align:r,crossAlign:l,padding:h,mirror:c}=n,d=Fr(i.grid),u=d+h,g=c?-h:u,p=-Mi(this.labelRotation),f=[];let m,b,x,y,_,v,k,w,C,S,F,M,A="middle";if("top"===s)v=this.bottom-g,k=this._getXAxisLabelAlignment();else if("bottom"===s)v=this.top+g,k=this._getXAxisLabelAlignment();else if("left"===s){const t=this._getYAxisLabelAlignment(d);k=t.textAlign,_=t.x}else if("right"===s){const t=this._getYAxisLabelAlignment(d);k=t.textAlign,_=t.x}else if("x"===e){if("center"===s)v=(t.top+t.bottom)/2+u;else if(ze(s)){const t=Object.keys(s)[0],e=s[t];v=this.chart.scales[t].getPixelForValue(e)+u}k=this._getXAxisLabelAlignment()}else if("y"===e){if("center"===s)_=(t.left+t.right)/2-u;else if(ze(s)){const t=Object.keys(s)[0],e=s[t];_=this.chart.scales[t].getPixelForValue(e)}k=this._getYAxisLabelAlignment(d).textAlign}"y"===e&&("start"===r?A="top":"end"===r&&(A="bottom"));const T=this._getLabelSizes();for(m=0,b=o.length;m<b;++m){x=o[m],y=x.label;const t=n.setContext(this.getContext(m));w=this.getPixelForTick(m)+n.labelOffset,C=this._resolveTickFontOptions(m),S=C.lineHeight,F=Be(y)?y.length:1;const e=F/2,i=t.color,r=t.textStrokeColor,h=t.textStrokeWidth;let d,u=k;if(a?(_=w,"inner"===k&&(u=m===b-1?this.options.reverse?"left":"right":0===m?this.options.reverse?"right":"left":"center"),M="top"===s?"near"===l||0!==p?-F*S+S/2:"center"===l?-T.highest.height/2-e*S+S:-T.highest.height+S/2:"near"===l||0!==p?S/2:"center"===l?T.highest.height/2-e*S:T.highest.height-F*S,c&&(M*=-1),0===p||t.showLabelBackdrop||(_+=S/2*Math.sin(p))):(v=w,M=(1-F)*S/2),t.showLabelBackdrop){const e=Ks(t.backdropPadding),i=T.heights[m],s=T.widths[m];let n=M-e.top,a=0-e.left;switch(A){case"middle":n-=i/2;break;case"bottom":n-=i;break}switch(k){case"center":a-=s/2;break;case"right":a-=s;break;case"inner":m===b-1?a-=s:m>0&&(a-=s/2);break}d={left:a,top:n,width:s+e.width,height:i+e.height,color:t.backdropColor}}f.push({label:y,font:C,textOffset:M,options:{rotation:p,color:i,strokeColor:r,strokeWidth:h,textAlign:u,textBaseline:A,translation:[_,v],backdrop:d}})}return f}_getXAxisLabelAlignment(){const{position:t,ticks:e}=this.options,i=-Mi(this.labelRotation);if(i)return"top"===t?"left":"right";let s="center";return"start"===e.align?s="left":"end"===e.align?s="right":"inner"===e.align&&(s="inner"),s}_getYAxisLabelAlignment(t){const{position:e,ticks:{crossAlign:i,mirror:s,padding:n}}=this.options,a=this._getLabelSizes(),o=t+n,r=a.widest.width;let l,h;return"left"===e?s?(h=this.right+n,"near"===i?l="left":"center"===i?(l="center",h+=r/2):(l="right",h+=r)):(h=this.right-o,"near"===i?l="right":"center"===i?(l="center",h-=r/2):(l="left",h=this.left)):"right"===e?s?(h=this.left+n,"near"===i?l="right":"center"===i?(l="center",h-=r/2):(l="left",h-=r)):(h=this.left+o,"near"===i?l="left":"center"===i?(l="center",h+=r/2):(l="right",h=this.right)):l="right",{textAlign:l,x:h}}_computeLabelArea(){if(this.options.ticks.mirror)return;const t=this.chart,e=this.options.position;return"left"===e||"right"===e?{top:0,left:this.left,bottom:t.height,right:this.right}:"top"===e||"bottom"===e?{top:this.top,left:0,bottom:this.bottom,right:t.width}:void 0}drawBackground(){const{ctx:t,options:{backgroundColor:e},left:i,top:s,width:n,height:a}=this;e&&(t.save(),t.fillStyle=e,t.fillRect(i,s,n,a),t.restore())}getLineWidthForValue(t){const e=this.options.grid;if(!this._isVisible()||!e.display)return 0;const i=this.ticks,s=i.findIndex(e=>e.value===t);if(s>=0){const t=e.setContext(this.getContext(s));return t.lineWidth}return 0}drawGrid(t){const e=this.options.grid,i=this.ctx,s=this._gridLineItems||(this._gridLineItems=this._computeGridLineItems(t));let n,a;const o=(t,e,s)=>{s.width&&s.color&&(i.save(),i.lineWidth=s.width,i.strokeStyle=s.color,i.setLineDash(s.borderDash||[]),i.lineDashOffset=s.borderDashOffset,i.beginPath(),i.moveTo(t.x,t.y),i.lineTo(e.x,e.y),i.stroke(),i.restore())};if(e.display)for(n=0,a=s.length;n<a;++n){const t=s[n];e.drawOnChartArea&&o({x:t.x1,y:t.y1},{x:t.x2,y:t.y2},t),e.drawTicks&&o({x:t.tx1,y:t.ty1},{x:t.tx2,y:t.ty2},{color:t.tickColor,width:t.tickWidth,borderDash:t.tickBorderDash,borderDashOffset:t.tickBorderDashOffset})}}drawBorder(){const{chart:t,ctx:e,options:{border:i,grid:s}}=this,n=i.setContext(this.getContext()),a=i.display?n.width:0;if(!a)return;const o=s.setContext(this.getContext(0)).lineWidth,r=this._borderValue;let l,h,c,d;this.isHorizontal()?(l=Ms(t,this.left,a)-a/2,h=Ms(t,this.right,o)+o/2,c=d=r):(c=Ms(t,this.top,a)-a/2,d=Ms(t,this.bottom,o)+o/2,l=h=r),e.save(),e.lineWidth=n.width,e.strokeStyle=n.color,e.beginPath(),e.moveTo(l,c),e.lineTo(h,d),e.stroke(),e.restore()}drawLabels(t){const e=this.options.ticks;if(!e.display)return;const i=this.ctx,s=this._computeLabelArea();s&&Es(i,s);const n=this.getLabelItems(t);for(const a of n){const t=a.options,e=a.font,s=a.label,n=a.textOffset;Bs(i,s,0,n,e,t)}s&&Ls(i)}drawTitle(){const{ctx:t,options:{position:e,title:i,reverse:s}}=this;if(!i.display)return;const n=Ys(i.font),a=Ks(i.padding),o=i.align;let r=n.lineHeight/2;"bottom"===e||"center"===e||ze(e)?(r+=a.bottom,Be(i.text)&&(r+=n.lineHeight*(i.text.length-1))):r+=a.top;const{titleX:l,titleY:h,maxWidth:c,rotation:d}=Dr(this,r,e,o);Bs(t,i.text,0,0,n,{color:i.color,maxWidth:c,rotation:d,textAlign:Pr(o,e,s),textBaseline:"middle",translation:[l,h]})}draw(t){this._isVisible()&&(this.drawBackground(),this.drawGrid(t),this.drawBorder(),this.drawTitle(),this.drawLabels(t))}_layers(){const t=this.options,e=t.ticks&&t.ticks.z||0,i=$e(t.grid&&t.grid.z,-1),s=$e(t.border&&t.border.z,0);return this._isVisible()&&this.draw===Er.prototype.draw?[{z:i,draw:t=>{this.drawBackground(),this.drawGrid(t),this.drawTitle()}},{z:s,draw:()=>{this.drawBorder()}},{z:e,draw:t=>{this.drawLabels(t)}}]:[{z:e,draw:t=>{this.draw(t)}}]}getMatchingVisibleMetas(t){const e=this.chart.getSortedVisibleDatasetMetas(),i=this.axis+"AxisID",s=[];let n,a;for(n=0,a=e.length;n<a;++n){const a=e[n];a[i]!==this.id||t&&a.type!==t||s.push(a)}return s}_resolveTickFontOptions(t){const e=this.options.ticks.setContext(this.getContext(t));return Ys(e.font)}_maxDigits(){const t=this._resolveTickFontOptions(0).lineHeight;return(this.isHorizontal()?this.width:this.height)/t}}class Lr{constructor(t,e,i){this.type=t,this.scope=e,this.override=i,this.items=Object.create(null)}isForType(t){return Object.prototype.isPrototypeOf.call(this.type.prototype,t.prototype)}register(t){const e=Object.getPrototypeOf(t);let i;Or(e)&&(i=this.register(e));const s=this.items,n=t.id,a=this.scope+"."+n;if(!n)throw new Error("class does not have id: "+t);return n in s||(s[n]=t,Ir(t,a,i),this.override&&ws.override(t.id,t.overrides)),a}get(t){return this.items[t]}unregister(t){const e=this.items,i=t.id,s=this.scope;i in e&&delete e[i],s&&i in ws[s]&&(delete ws[s][i],this.override&&delete xs[i])}}function Ir(t,e,i){const s=Je(Object.create(null),[i?ws.get(i):{},ws.get(e),t.defaults]);ws.set(e,s),t.defaultRoutes&&Vr(e,t.defaultRoutes),t.descriptors&&ws.describe(e,t.descriptors)}function Vr(t,e){Object.keys(e).forEach(i=>{const s=i.split("."),n=s.pop(),a=[t].concat(s).join("."),o=e[i].split("."),r=o.pop(),l=o.join(".");ws.route(a,n,l,r)})}function Or(t){return"id"in t&&"defaults"in t}class Rr{constructor(){this.controllers=new Lr(Ua,"datasets",!0),this.elements=new Lr(ur,"elements"),this.plugins=new Lr(Object,"plugins"),this.scales=new Lr(Er,"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(e=>{const s=i||this._getRegistryForType(e);i||s.isForType(e)||s===this.plugins&&e.id?this._exec(t,s,e):qe(e,e=>{const s=i||this._getRegistryForType(e);this._exec(t,s,e)})})}_exec(t,e,i){const s=ai(t);Xe(i["before"+s],[],i),e[t](i),Xe(i["after"+s],[],i)}_getRegistryForType(t){for(let e=0;e<this._typedRegistries.length;e++){const i=this._typedRegistries[e];if(i.isForType(t))return i}return this.plugins}_get(t,e,i){const s=e.get(t);if(void 0===s)throw new Error('"'+t+'" is not a registered '+i+".");return s}}var Wr=new Rr;class Br{constructor(){this._init=void 0}notify(t,e,i,s){if("beforeInit"===e&&(this._init=this._createDescriptors(t,!0),this._notify(this._init,t,"install")),void 0===this._init)return;const n=s?this._descriptors(t).filter(s):this._descriptors(t),a=this._notify(n,t,e,i);return"afterDestroy"===e&&(this._notify(n,t,"stop"),this._notify(this._init,t,"uninstall"),this._init=void 0),a}_notify(t,e,i,s){s=s||{};for(const n of t){const t=n.plugin,a=t[i],o=[e,s,n.options];if(!1===Xe(a,o,t)&&s.cancelable)return!1}return!0}invalidate(){We(this._cache)||(this._oldCache=this._cache,this._cache=void 0)}_descriptors(t){if(this._cache)return this._cache;const e=this._cache=this._createDescriptors(t);return this._notifyStateChanges(t),e}_createDescriptors(t,e){const i=t&&t.config,s=$e(i.options&&i.options.plugins,{}),n=zr(i);return!1!==s||e?Ur(t,n,s,e):[]}_notifyStateChanges(t){const e=this._oldCache||[],i=this._cache,s=(t,e)=>t.filter(t=>!e.some(e=>t.plugin.id===e.plugin.id));this._notify(s(e,i),t,"stop"),this._notify(s(i,e),t,"start")}}function zr(t){const e={},i=[],s=Object.keys(Wr.plugins.items);for(let a=0;a<s.length;a++)i.push(Wr.getPlugin(s[a]));const n=t.plugins||[];for(let a=0;a<n.length;a++){const t=n[a];-1===i.indexOf(t)&&(i.push(t),e[t.id]=!0)}return{plugins:i,localIds:e}}function Nr(t,e){return e||!1!==t?!0===t?{}:t:null}function Ur(t,{plugins:e,localIds:i},s,n){const a=[],o=t.getContext();for(const r of e){const e=r.id,l=Nr(s[e],n);null!==l&&a.push({plugin:r,options:$r(t.config,{plugin:r,local:i[e]},l,o)})}return a}function $r(t,{plugin:e,local:i},s,n){const a=t.pluginScopeKeys(e),o=t.getOptionScopes(s,a);return i&&e.defaults&&o.push(e.defaults),t.createResolver(o,n,[""],{scriptable:!1,indexable:!1,allKeys:!0})}function jr(t,e){const i=ws.datasets[t]||{},s=(e.datasets||{})[t]||{};return s.indexAxis||e.indexAxis||i.indexAxis||"x"}function Hr(t,e){let i=t;return"_index_"===t?i=e:"_value_"===t&&(i="x"===e?"y":"x"),i}function Xr(t,e){return t===e?"_index_":"_value_"}function qr(t){if("x"===t||"y"===t||"r"===t)return t}function Kr(t){return"top"===t||"bottom"===t?"x":"left"===t||"right"===t?"y":void 0}function Yr(t,...e){if(qr(t))return t;for(const i of e){const e=i.axis||Kr(i.position)||t.length>1&&qr(t[0].toLowerCase());if(e)return e}throw new Error(`Cannot determine type of '${t}' axis. Please provide 'axis' or 'position' option.`)}function Qr(t,e,i){if(i[e+"AxisID"]===t)return{axis:e}}function Gr(t,e){if(e.data&&e.data.datasets){const i=e.data.datasets.filter(e=>e.xAxisID===t||e.yAxisID===t);if(i.length)return Qr(t,"x",i[0])||Qr(t,"y",i[0])}return{}}function Jr(t,e){const i=xs[t.type]||{scales:{}},s=e.scales||{},n=jr(t.type,e),a=Object.create(null);return Object.keys(s).forEach(e=>{const o=s[e];if(!ze(o))return console.error(`Invalid scale configuration for scale: ${e}`);if(o._proxy)return console.warn(`Ignoring resolver passed as options for scale: ${e}`);const r=Yr(e,o,Gr(e,t),ws.scales[o.type]),l=Xr(r,n),h=i.scales||{};a[e]=Ze(Object.create(null),[{axis:r},o,h[r],h[l]])}),t.data.datasets.forEach(i=>{const n=i.type||t.type,o=i.indexAxis||jr(n,e),r=xs[n]||{},l=r.scales||{};Object.keys(l).forEach(t=>{const e=Hr(t,o),n=i[e+"AxisID"]||e;a[n]=a[n]||Object.create(null),Ze(a[n],[{axis:e},s[n],l[t]])})}),Object.keys(a).forEach(t=>{const e=a[t];Ze(e,[ws.scales[e.type],ws.scale])}),a}function Zr(t){const e=t.options||(t.options={});e.plugins=$e(e.plugins,{}),e.scales=Jr(t,e)}function tl(t){return t=t||{},t.datasets=t.datasets||[],t.labels=t.labels||[],t}function el(t){return t=t||{},t.data=tl(t.data),Zr(t),t}const il=new Map,sl=new Set;function nl(t,e){let i=il.get(t);return i||(i=e(),il.set(t,i),sl.add(i)),i}const al=(t,e,i)=>{const s=ni(e,i);void 0!==s&&t.add(s)};class ol{constructor(t){this._config=el(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=tl(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(),Zr(t)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(t){return nl(t,()=>[[`datasets.${t}`,""]])}datasetAnimationScopeKeys(t,e){return nl(`${t}.transition.${e}`,()=>[[`datasets.${t}.transitions.${e}`,`transitions.${e}`],[`datasets.${t}`,""]])}datasetElementScopeKeys(t,e){return nl(`${t}-${e}`,()=>[[`datasets.${t}.elements.${e}`,`datasets.${t}`,`elements.${e}`,""]])}pluginScopeKeys(t){const e=t.id,i=this.type;return nl(`${i}-plugin-${e}`,()=>[[`plugins.${e}`,...t.additionalOptionScopes||[]]])}_cachedScopes(t,e){const i=this._scopeCache;let s=i.get(t);return s&&!e||(s=new Map,i.set(t,s)),s}getOptionScopes(t,e,i){const{options:s,type:n}=this,a=this._cachedScopes(t,i),o=a.get(e);if(o)return o;const r=new Set;e.forEach(e=>{t&&(r.add(t),e.forEach(e=>al(r,t,e))),e.forEach(t=>al(r,s,t)),e.forEach(t=>al(r,xs[n]||{},t)),e.forEach(t=>al(r,ws,t)),e.forEach(t=>al(r,ys,t))});const l=Array.from(r);return 0===l.length&&l.push(Object.create(null)),sl.has(e)&&a.set(e,l),l}chartOptionScopes(){const{options:t,type:e}=this;return[t,xs[e]||{},ws.datasets[e]||{},{type:e},ws,ys]}resolveNamedOptions(t,e,i,s=[""]){const n={$shared:!0},{resolver:a,subPrefixes:o}=rl(this._resolverCache,t,s);let r=a;if(hl(a,e)){n.$shared=!1,i=ri(i)?i():i;const e=this.createResolver(t,i,o);r=tn(a,i,e)}for(const l of e)n[l]=r[l];return n}createResolver(t,e,i=[""],s){const{resolver:n}=rl(this._resolverCache,t,i);return ze(e)?tn(n,e,void 0,s):n}}function rl(t,e,i){let s=t.get(e);s||(s=new Map,t.set(e,s));const n=i.join();let a=s.get(n);if(!a){const t=Zs(e,i);a={resolver:t,subPrefixes:i.filter(t=>!t.toLowerCase().includes("hover"))},s.set(n,a)}return a}const ll=t=>ze(t)&&Object.getOwnPropertyNames(t).some(e=>ri(t[e]));function hl(t,e){const{isScriptable:i,isIndexable:s}=en(t);for(const n of e){const e=i(n),a=s(n),o=(a||e)&&t[n];if(e&&(ri(o)||ll(o))||a&&Be(o))return!0}return!1}var cl="4.5.1";const dl=["top","bottom","left","right","chartArea"];function ul(t,e){return"top"===t||"bottom"===t||-1===dl.indexOf(t)&&"x"===e}function gl(t,e){return function(i,s){return i[t]===s[t]?i[e]-s[e]:i[t]-s[t]}}function pl(t){const e=t.chart,i=e.options.animation;e.notifyPlugins("afterRender"),Xe(i&&i.onComplete,[t],e)}function fl(t){const e=t.chart,i=e.options.animation;Xe(i&&i.onProgress,[t],e)}function ml(t){return Pn()&&"string"===typeof t?t=document.getElementById(t):t&&t.length&&(t=t[0]),t&&t.canvas&&(t=t.canvas),t}const bl={},xl=t=>{const e=ml(t);return Object.values(bl).filter(t=>t.canvas===e).pop()};function yl(t,e,i){const s=Object.keys(t);for(const n of s){const s=+n;if(s>=e){const a=t[n];delete t[n],(i>0||s>e)&&(t[s+i]=a)}}}function _l(t,e,i,s){return i&&"mouseout"!==t.type?s?e:t:null}class vl{static register(...t){Wr.add(...t),kl()}static unregister(...t){Wr.remove(...t),kl()}constructor(t,e){const i=this.config=new ol(e),s=ml(t),n=xl(s);if(n)throw new Error("Canvas is already in use. Chart with ID '"+n.id+"' must be destroyed before the canvas with ID '"+n.canvas.id+"' can be reused.");const a=i.createResolver(i.chartOptionScopes(),this.getContext());this.platform=new(i.platform||dr(s)),this.platform.updateConfig(i);const o=this.platform.acquireContext(s,a.aspectRatio),r=o&&o.canvas,l=r&&r.height,h=r&&r.width;this.id=Re(),this.ctx=o,this.canvas=r,this.width=h,this.height=l,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 Br,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=Ki(t=>this.update(t),a.resizeDelay||0),this._dataChanges=[],bl[this.id]=this,o&&r?(ma.listen(this,"complete",pl),ma.listen(this,"progress",fl),this._initialize(),this.attached&&this.update()):console.error("Failed to create chart: can't acquire context from the given item")}get aspectRatio(){const{options:{aspectRatio:t,maintainAspectRatio:e},width:i,height:s,_aspectRatio:n}=this;return We(t)?e&&n?n:s?i/s:null:t}get data(){return this.config.data}set data(t){this.config.data=t}get options(){return this._options}set options(t){this.config.options=t}get registry(){return Wr}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():$n(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return As(this.canvas,this.ctx),this}stop(){return ma.stop(this),this}resize(t,e){ma.running(this)?this._resizeBeforeDraw={width:t,height:e}:this._resize(t,e)}_resize(t,e){const i=this.options,s=this.canvas,n=i.maintainAspectRatio&&this.aspectRatio,a=this.platform.getMaximumSize(s,t,e,n),o=i.devicePixelRatio||this.platform.getDevicePixelRatio(),r=this.width?"resize":"attach";this.width=a.width,this.height=a.height,this._aspectRatio=this.aspectRatio,$n(this,o,!0)&&(this.notifyPlugins("resize",{size:a}),Xe(i.onResize,[this,a],this),this.attached&&this._doResize(r)&&this.render())}ensureScalesHaveIDs(){const t=this.options,e=t.scales||{};qe(e,(t,e)=>{t.id=e})}buildOrUpdateScales(){const t=this.options,e=t.scales,i=this.scales,s=Object.keys(i).reduce((t,e)=>(t[e]=!1,t),{});let n=[];e&&(n=n.concat(Object.keys(e).map(t=>{const i=e[t],s=Yr(t,i),n="r"===s,a="x"===s;return{options:i,dposition:n?"chartArea":a?"bottom":"left",dtype:n?"radialLinear":a?"category":"linear"}}))),qe(n,e=>{const n=e.options,a=n.id,o=Yr(a,n),r=$e(n.type,e.dtype);void 0!==n.position&&ul(n.position,o)===ul(e.dposition)||(n.position=e.dposition),s[a]=!0;let l=null;if(a in i&&i[a].type===r)l=i[a];else{const t=Wr.getScale(r);l=new t({id:a,type:r,ctx:this.ctx,chart:this}),i[l.id]=l}l.init(n,t)}),qe(s,(t,e)=>{t||delete i[e]}),qe(i,t=>{Uo.configure(this,t,t.options),Uo.addBox(this,t)})}_updateMetasets(){const t=this._metasets,e=this.data.datasets.length,i=t.length;if(t.sort((t,e)=>t.index-e.index),i>e){for(let t=e;t<i;++t)this._destroyDatasetMeta(t);t.splice(e,i-e)}this._sortedMetasets=t.slice(0).sort(gl("order","index"))}_removeUnreferencedMetasets(){const{_metasets:t,data:{datasets:e}}=this;t.length>e.length&&delete this._stacks,t.forEach((t,i)=>{0===e.filter(e=>e===t._dataset).length&&this._destroyDatasetMeta(i)})}buildOrUpdateControllers(){const t=[],e=this.data.datasets;let i,s;for(this._removeUnreferencedMetasets(),i=0,s=e.length;i<s;i++){const s=e[i];let n=this.getDatasetMeta(i);const a=s.type||this.config.type;if(n.type&&n.type!==a&&(this._destroyDatasetMeta(i),n=this.getDatasetMeta(i)),n.type=a,n.indexAxis=s.indexAxis||jr(a,this.options),n.order=s.order||0,n.index=i,n.label=""+s.label,n.visible=this.isDatasetVisible(i),n.controller)n.controller.updateIndex(i),n.controller.linkScales();else{const e=Wr.getController(a),{datasetElementType:s,dataElementType:o}=ws.datasets[a];Object.assign(e,{dataElementType:Wr.getElement(o),datasetElementType:s&&Wr.getElement(s)}),n.controller=new e(this,i),t.push(n.controller)}}return this._updateMetasets(),t}_resetElements(){qe(this.data.datasets,(t,e)=>{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()),s=this._animationsDisabled=!i.animation;if(this._updateScales(),this._checkEventBindings(),this._updateHiddenIndices(),this._plugins.invalidate(),!1===this.notifyPlugins("beforeUpdate",{mode:t,cancelable:!0}))return;const n=this.buildOrUpdateControllers();this.notifyPlugins("beforeElementsUpdate");let a=0;for(let l=0,h=this.data.datasets.length;l<h;l++){const{controller:t}=this.getDatasetMeta(l),e=!s&&-1===n.indexOf(t);t.buildOrUpdateElements(e),a=Math.max(+t.getMaxOverflow(),a)}a=this._minPadding=i.layout.autoPadding?a:0,this._updateLayout(a),s||qe(n,t=>{t.reset()}),this._updateDatasets(t),this.notifyPlugins("afterUpdate",{mode:t}),this._layers.sort(gl("z","_idx"));const{_active:o,_lastEvent:r}=this;r?this._eventHandler(r,!0):o.length&&this._updateHoverStyles(o,o,!0),this.render()}_updateScales(){qe(this.scales,t=>{Uo.removeBox(this,t)}),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){const t=this.options,e=new Set(Object.keys(this._listeners)),i=new Set(t.events);li(e,i)&&!!this._responsiveListeners===t.responsive||(this.unbindEvents(),this.bindEvents())}_updateHiddenIndices(){const{_hiddenIndices:t}=this,e=this._getUniformDataChanges()||[];for(const{method:i,start:s,count:n}of e){const e="_removeElements"===i?-n:n;yl(t,s,e)}}_getUniformDataChanges(){const t=this._dataChanges;if(!t||!t.length)return;this._dataChanges=[];const e=this.data.datasets.length,i=e=>new Set(t.filter(t=>t[0]===e).map((t,e)=>e+","+t.splice(1).join(","))),s=i(0);for(let n=1;n<e;n++)if(!li(s,i(n)))return;return Array.from(s).map(t=>t.split(",")).map(t=>({method:t[1],start:+t[2],count:+t[3]}))}_updateLayout(t){if(!1===this.notifyPlugins("beforeLayout",{cancelable:!0}))return;Uo.update(this,this.width,this.height,t);const e=this.chartArea,i=e.width<=0||e.height<=0;this._layers=[],qe(this.boxes,t=>{i&&"chartArea"===t.position||(t.configure&&t.configure(),this._layers.push(...t._layers()))},this),this._layers.forEach((t,e)=>{t._idx=e}),this.notifyPlugins("afterLayout")}_updateDatasets(t){if(!1!==this.notifyPlugins("beforeDatasetsUpdate",{mode:t,cancelable:!0})){for(let t=0,e=this.data.datasets.length;t<e;++t)this.getDatasetMeta(t).controller.configure();for(let e=0,i=this.data.datasets.length;e<i;++e)this._updateDataset(e,ri(t)?t({datasetIndex:e}):t);this.notifyPlugins("afterDatasetsUpdate",{mode:t})}}_updateDataset(t,e){const i=this.getDatasetMeta(t),s={meta:i,index:t,mode:e,cancelable:!0};!1!==this.notifyPlugins("beforeDatasetUpdate",s)&&(i.controller._update(e),s.cancelable=!1,this.notifyPlugins("afterDatasetUpdate",s))}render(){!1!==this.notifyPlugins("beforeRender",{cancelable:!0})&&(ma.has(this)?this.attached&&!ma.running(this)&&ma.start(this):(this.draw(),pl({chart:this})))}draw(){let t;if(this._resizeBeforeDraw){const{width:t,height:e}=this._resizeBeforeDraw;this._resizeBeforeDraw=null,this._resize(t,e)}if(this.clear(),this.width<=0||this.height<=0)return;if(!1===this.notifyPlugins("beforeDraw",{cancelable:!0}))return;const e=this._layers;for(t=0;t<e.length&&e[t].z<=0;++t)e[t].draw(this.chartArea);for(this._drawDatasets();t<e.length;++t)e[t].draw(this.chartArea);this.notifyPlugins("afterDraw")}_getSortedDatasetMetas(t){const e=this._sortedMetasets,i=[];let s,n;for(s=0,n=e.length;s<n;++s){const n=e[s];t&&!n.visible||i.push(n)}return i}getSortedVisibleDatasetMetas(){return this._getSortedDatasetMetas(!0)}_drawDatasets(){if(!1===this.notifyPlugins("beforeDatasetsDraw",{cancelable:!0}))return;const t=this.getSortedVisibleDatasetMetas();for(let e=t.length-1;e>=0;--e)this._drawDataset(t[e]);this.notifyPlugins("afterDatasetsDraw")}_drawDataset(t){const e=this.ctx,i={meta:t,index:t.index,cancelable:!0},s=pa(this,t);!1!==this.notifyPlugins("beforeDatasetDraw",i)&&(s&&Es(e,s),t.controller.draw(),s&&Ls(e),i.cancelable=!1,this.notifyPlugins("afterDatasetDraw",i))}isPointInArea(t){return Ds(t,this.chartArea,this._minPadding)}getElementsAtEventForMode(t,e,i,s){const n=So.modes[e];return"function"===typeof n?n(this,t,i,s):[]}getDatasetMeta(t){const e=this.data.datasets[t],i=this._metasets;let s=i.filter(t=>t&&t._dataset===e).pop();return s||(s={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(s)),s}getContext(){return this.$context||(this.$context=Js(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"boolean"===typeof i.hidden?!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 s=i?"show":"hide",n=this.getDatasetMeta(t),a=n.controller._resolveAnimations(void 0,s);oi(e)?(n.data[e].hidden=!i,this.update()):(this.setDatasetVisibility(t,i),a.update(n,{visible:i}),this.update(e=>e.datasetIndex===t?s: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(),ma.remove(this),t=0,e=this.data.datasets.length;t<e;++t)this._destroyDatasetMeta(t)}destroy(){this.notifyPlugins("beforeDestroy");const{canvas:t,ctx:e}=this;this._stop(),this.config.clearCache(),t&&(this.unbindEvents(),As(t,e),this.platform.releaseContext(e),this.canvas=null,this.ctx=null),delete bl[this.id],this.notifyPlugins("afterDestroy")}toBase64Image(...t){return this.canvas.toDataURL(...t)}bindEvents(){this.bindUserEvents(),this.options.responsive?this.bindResponsiveEvents():this.attached=!0}bindUserEvents(){const t=this._listeners,e=this.platform,i=(i,s)=>{e.addEventListener(this,i,s),t[i]=s},s=(t,e,i)=>{t.offsetX=e,t.offsetY=i,this._eventHandler(t)};qe(this.options.events,t=>i(t,s))}bindResponsiveEvents(){this._responsiveListeners||(this._responsiveListeners={});const t=this._responsiveListeners,e=this.platform,i=(i,s)=>{e.addEventListener(this,i,s),t[i]=s},s=(i,s)=>{t[i]&&(e.removeEventListener(this,i,s),delete t[i])},n=(t,e)=>{this.canvas&&this.resize(t,e)};let a;const o=()=>{s("attach",o),this.attached=!0,this.resize(),i("resize",n),i("detach",a)};a=()=>{this.attached=!1,s("resize",n),this._stop(),this._resize(0,0),i("attach",o)},e.isAttached(this.canvas)?o():a()}unbindEvents(){qe(this._listeners,(t,e)=>{this.platform.removeEventListener(this,e,t)}),this._listeners={},qe(this._responsiveListeners,(t,e)=>{this.platform.removeEventListener(this,e,t)}),this._responsiveListeners=void 0}updateHoverStyle(t,e,i){const s=i?"set":"remove";let n,a,o,r;for("dataset"===e&&(n=this.getDatasetMeta(t[0].datasetIndex),n.controller["_"+s+"DatasetHoverStyle"]()),o=0,r=t.length;o<r;++o){a=t[o];const e=a&&this.getDatasetMeta(a.datasetIndex).controller;e&&e[s+"HoverStyle"](a.element,a.datasetIndex,a.index)}}getActiveElements(){return this._active||[]}setActiveElements(t){const e=this._active||[],i=t.map(({datasetIndex:t,index:e})=>{const i=this.getDatasetMeta(t);if(!i)throw new Error("No dataset found at index "+t);return{datasetIndex:t,element:i.data[e],index:e}}),s=!Ke(i,e);s&&(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 1===this._plugins._cache.filter(e=>e.plugin.id===t).length}_updateHoverStyles(t,e,i){const s=this.options.hover,n=(t,e)=>t.filter(t=>!e.some(e=>t.datasetIndex===e.datasetIndex&&t.index===e.index)),a=n(e,t),o=i?t:n(t,e);a.length&&this.updateHoverStyle(a,s.mode,!1),o.length&&s.mode&&this.updateHoverStyle(o,s.mode,!0)}_eventHandler(t,e){const i={event:t,replay:e,cancelable:!0,inChartArea:this.isPointInArea(t)},s=e=>(e.options.events||this.options.events).includes(t.native.type);if(!1===this.notifyPlugins("beforeEvent",i,s))return;const n=this._handleEvent(t,e,i.inChartArea);return i.cancelable=!1,this.notifyPlugins("afterEvent",i,s),(n||i.changed)&&this.render(),this}_handleEvent(t,e,i){const{_active:s=[],options:n}=this,a=e,o=this._getActiveElements(t,s,i,a),r=hi(t),l=_l(t,this._lastEvent,i,r);i&&(this._lastEvent=null,Xe(n.onHover,[t,o,this],this),r&&Xe(n.onClick,[t,o,this],this));const h=!Ke(o,s);return(h||e)&&(this._active=o,this._updateHoverStyles(o,s,e)),this._lastEvent=l,h}_getActiveElements(t,e,i,s){if("mouseout"===t.type)return[];if(!i)return e;const n=this.options.hover;return this.getElementsAtEventForMode(t,n.mode,n,s)}}function kl(){return qe(vl.instances,t=>t._plugins.invalidate())}function wl(t,e,i){const{startAngle:s,x:n,y:a,outerRadius:o,innerRadius:r,options:l}=e,{borderWidth:h,borderJoinStyle:c}=l,d=Math.min(h/o,Li(s-i));if(t.beginPath(),t.arc(n,a,o-h/2,s+d/2,i-d/2),r>0){const e=Math.min(h/r,Li(s-i));t.arc(n,a,r+h/2,i-e/2,s+e/2,!0)}else{const e=Math.min(h/2,o*Li(s-i));if("round"===c)t.arc(n,a,e,i-ci/2,s+ci/2,!0);else if("bevel"===c){const o=2*e*e,r=-o*Math.cos(i+ci/2)+n,l=-o*Math.sin(i+ci/2)+a,h=o*Math.cos(s+ci/2)+n,c=o*Math.sin(s+ci/2)+a;t.lineTo(r,l),t.lineTo(h,c)}}t.closePath(),t.moveTo(0,0),t.rect(0,0,t.canvas.width,t.canvas.height),t.clip("evenodd")}function Cl(t,e,i){const{startAngle:s,pixelMargin:n,x:a,y:o,outerRadius:r,innerRadius:l}=e;let h=n/r;t.beginPath(),t.arc(a,o,r,s-h,i+h),l>n?(h=n/l,t.arc(a,o,l,i+h,s-h,!0)):t.arc(a,o,n,i+fi,s-fi),t.closePath(),t.clip()}function Sl(t){return Hs(t,["outerStart","outerEnd","innerStart","innerEnd"])}function Fl(t,e,i,s){const n=Sl(t.options.borderRadius),a=(i-e)/2,o=Math.min(a,s*e/2),r=t=>{const e=(i-Math.min(a,t))*s/2;return Vi(t,0,Math.min(a,e))};return{outerStart:r(n.outerStart),outerEnd:r(n.outerEnd),innerStart:Vi(n.innerStart,0,o),innerEnd:Vi(n.innerEnd,0,o)}}function Ml(t,e,i,s){return{x:i+t*Math.cos(e),y:s+t*Math.sin(e)}}function Al(t,e,i,s,n,a){const{x:o,y:r,startAngle:l,pixelMargin:h,innerRadius:c}=e,d=Math.max(e.outerRadius+s+i-h,0),u=c>0?c+s+i+h:0;let g=0;const p=n-l;if(s){const t=c>0?c-s:0,e=d>0?d-s:0,i=(t+e)/2,n=0!==i?p*i/(i+s):p;g=(p-n)/2}const f=Math.max(.001,p*d-i/ci)/d,m=(p-f)/2,b=l+m+g,x=n-m-g,{outerStart:y,outerEnd:_,innerStart:v,innerEnd:k}=Fl(e,u,d,x-b),w=d-y,C=d-_,S=b+y/w,F=x-_/C,M=u+v,A=u+k,T=b+v/M,P=x-k/A;if(t.beginPath(),a){const e=(S+F)/2;if(t.arc(o,r,d,S,e),t.arc(o,r,d,e,F),_>0){const e=Ml(C,F,o,r);t.arc(e.x,e.y,_,F,x+fi)}const i=Ml(A,x,o,r);if(t.lineTo(i.x,i.y),k>0){const e=Ml(A,P,o,r);t.arc(e.x,e.y,k,x+fi,P+Math.PI)}const s=(x-k/u+(b+v/u))/2;if(t.arc(o,r,u,x-k/u,s,!0),t.arc(o,r,u,s,b+v/u,!0),v>0){const e=Ml(M,T,o,r);t.arc(e.x,e.y,v,T+Math.PI,b-fi)}const n=Ml(w,b,o,r);if(t.lineTo(n.x,n.y),y>0){const e=Ml(w,S,o,r);t.arc(e.x,e.y,y,b-fi,S)}}else{t.moveTo(o,r);const e=Math.cos(S)*d+o,i=Math.sin(S)*d+r;t.lineTo(e,i);const s=Math.cos(F)*d+o,n=Math.sin(F)*d+r;t.lineTo(s,n)}t.closePath()}function Tl(t,e,i,s,n){const{fullCircles:a,startAngle:o,circumference:r}=e;let l=e.endAngle;if(a){Al(t,e,i,s,l,n);for(let e=0;e<a;++e)t.fill();isNaN(r)||(l=o+(r%di||di))}return Al(t,e,i,s,l,n),t.fill(),l}function Pl(t,e,i,s,n){const{fullCircles:a,startAngle:o,circumference:r,options:l}=e,{borderWidth:h,borderJoinStyle:c,borderDash:d,borderDashOffset:u,borderRadius:g}=l,p="inner"===l.borderAlign;if(!h)return;t.setLineDash(d||[]),t.lineDashOffset=u,p?(t.lineWidth=2*h,t.lineJoin=c||"round"):(t.lineWidth=h,t.lineJoin=c||"bevel");let f=e.endAngle;if(a){Al(t,e,i,s,f,n);for(let e=0;e<a;++e)t.stroke();isNaN(r)||(f=o+(r%di||di))}p&&Cl(t,e,f),l.selfJoin&&f-o>=ci&&0===g&&"miter"!==c&&wl(t,e,f),a||(Al(t,e,i,s,f,n),t.stroke())}(0,jt.A)(vl,"defaults",ws),(0,jt.A)(vl,"instances",bl),(0,jt.A)(vl,"overrides",xs),(0,jt.A)(vl,"registry",Wr),(0,jt.A)(vl,"version",cl),(0,jt.A)(vl,"getChart",xl);class Dl extends ur{constructor(t){super(),(0,jt.A)(this,"circumference",void 0),(0,jt.A)(this,"endAngle",void 0),(0,jt.A)(this,"fullCircles",void 0),(0,jt.A)(this,"innerRadius",void 0),(0,jt.A)(this,"outerRadius",void 0),(0,jt.A)(this,"pixelMargin",void 0),(0,jt.A)(this,"startAngle",void 0),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 s=this.getProps(["x","y"],i),{angle:n,distance:a}=Pi(s,{x:t,y:e}),{startAngle:o,endAngle:r,innerRadius:l,outerRadius:h,circumference:c}=this.getProps(["startAngle","endAngle","innerRadius","outerRadius","circumference"],i),d=(this.options.spacing+this.options.borderWidth)/2,u=$e(c,r-o),g=Ii(n,o,r)&&o!==r,p=u>=di||g,f=Ri(a,l+d,h+d);return p&&f}getCenterPoint(t){const{x:e,y:i,startAngle:s,endAngle:n,innerRadius:a,outerRadius:o}=this.getProps(["x","y","startAngle","endAngle","innerRadius","outerRadius"],t),{offset:r,spacing:l}=this.options,h=(s+n)/2,c=(a+o+l+r)/2;return{x:e+Math.cos(h)*c,y:i+Math.sin(h)*c}}tooltipPosition(t){return this.getCenterPoint(t)}draw(t){const{options:e,circumference:i}=this,s=(e.offset||0)/4,n=(e.spacing||0)/2,a=e.circular;if(this.pixelMargin="inner"===e.borderAlign?.33:0,this.fullCircles=i>di?Math.floor(i/di):0,0===i||this.innerRadius<0||this.outerRadius<0)return;t.save();const o=(this.startAngle+this.endAngle)/2;t.translate(Math.cos(o)*s,Math.sin(o)*s);const r=1-Math.sin(Math.min(ci,i||0)),l=s*r;t.fillStyle=e.backgroundColor,t.strokeStyle=e.borderColor,Tl(t,this,l,n,a),Pl(t,this,l,n,a),t.restore()}}function El(t,e,i=e){t.lineCap=$e(i.borderCapStyle,e.borderCapStyle),t.setLineDash($e(i.borderDash,e.borderDash)),t.lineDashOffset=$e(i.borderDashOffset,e.borderDashOffset),t.lineJoin=$e(i.borderJoinStyle,e.borderJoinStyle),t.lineWidth=$e(i.borderWidth,e.borderWidth),t.strokeStyle=$e(i.borderColor,e.borderColor)}function Ll(t,e,i){t.lineTo(i.x,i.y)}function Il(t){return t.stepped?Is:t.tension||"monotone"===t.cubicInterpolationMode?Vs:Ll}function Vl(t,e,i={}){const s=t.length,{start:n=0,end:a=s-1}=i,{start:o,end:r}=e,l=Math.max(n,o),h=Math.min(a,r),c=n<o&&a<o||n>r&&a>r;return{count:s,start:l,loop:e.loop,ilen:h<l&&!c?s+h-l:h-l}}function Ol(t,e,i,s){const{points:n,options:a}=e,{count:o,start:r,loop:l,ilen:h}=Vl(n,i,s),c=Il(a);let d,u,g,{move:p=!0,reverse:f}=s||{};for(d=0;d<=h;++d)u=n[(r+(f?h-d:d))%o],u.skip||(p?(t.moveTo(u.x,u.y),p=!1):c(t,g,u,f,a.stepped),g=u);return l&&(u=n[(r+(f?h:0))%o],c(t,g,u,f,a.stepped)),!!l}function Rl(t,e,i,s){const n=e.points,{count:a,start:o,ilen:r}=Vl(n,i,s),{move:l=!0,reverse:h}=s||{};let c,d,u,g,p,f,m=0,b=0;const x=t=>(o+(h?r-t:t))%a,y=()=>{g!==p&&(t.lineTo(m,p),t.lineTo(m,g),t.lineTo(m,f))};for(l&&(d=n[x(0)],t.moveTo(d.x,d.y)),c=0;c<=r;++c){if(d=n[x(c)],d.skip)continue;const e=d.x,i=d.y,s=0|e;s===u?(i<g?g=i:i>p&&(p=i),m=(b*m+e)/++b):(y(),t.lineTo(e,i),u=s,b=0,g=p=i),f=i}y()}function Wl(t){const e=t.options,i=e.borderDash&&e.borderDash.length,s=!t._decimated&&!t._loop&&!e.tension&&"monotone"!==e.cubicInterpolationMode&&!e.stepped&&!i;return s?Rl:Ol}function Bl(t){return t.stepped?qn:t.tension||"monotone"===t.cubicInterpolationMode?Kn:Xn}function zl(t,e,i,s){let n=e._path;n||(n=e._path=new Path2D,e.path(n,i,s)&&n.closePath()),El(t,e.options),t.stroke(n)}function Nl(t,e,i,s){const{segments:n,options:a}=e,o=Wl(e);for(const r of n)El(t,a,r.style),t.beginPath(),o(t,e,r,{start:i,end:i+s-1})&&t.closePath(),t.stroke()}(0,jt.A)(Dl,"id","arc"),(0,jt.A)(Dl,"defaults",{borderAlign:"center",borderColor:"#fff",borderDash:[],borderDashOffset:0,borderJoinStyle:void 0,borderRadius:0,borderWidth:2,offset:0,spacing:0,angle:void 0,circular:!0,selfJoin:!1}),(0,jt.A)(Dl,"defaultRoutes",{backgroundColor:"backgroundColor"}),(0,jt.A)(Dl,"descriptors",{_scriptable:!0,_indexable:t=>"borderDash"!==t});const Ul="function"===typeof Path2D;function $l(t,e,i,s){Ul&&!e.options.segment?zl(t,e,i,s):Nl(t,e,i,s)}class jl extends ur{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||"monotone"===i.cubicInterpolationMode)&&!i.stepped&&!this._pointsUpdated){const s=i.spanGaps?this._loop:this._fullLoop;Tn(this._points,i,t,s,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=ra(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,s=t[e],n=this.points,a=na(this,{property:e,start:s,end:s});if(!a.length)return;const o=[],r=Bl(i);let l,h;for(l=0,h=a.length;l<h;++l){const{start:h,end:c}=a[l],d=n[h],u=n[c];if(d===u){o.push(d);continue}const g=Math.abs((s-d[e])/(u[e]-d[e])),p=r(d,u,g,i.stepped);p[e]=t[e],o.push(p)}return 1===o.length?o[0]:o}pathSegment(t,e,i){const s=Wl(this);return s(t,this,e,i)}path(t,e,i){const s=this.segments,n=Wl(this);let a=this._loop;e=e||0,i=i||this.points.length-e;for(const o of s)a&=n(t,this,o,{start:e,end:e+i-1});return!!a}draw(t,e,i,s){const n=this.options||{},a=this.points||[];a.length&&n.borderWidth&&(t.save(),$l(t,this,i,s),t.restore()),this.animated&&(this._pointsUpdated=!1,this._path=void 0)}}function Hl(t,e,i,s){const n=t.options,{[i]:a}=t.getProps([i],s);return Math.abs(e-a)<n.radius+n.hitRadius}(0,jt.A)(jl,"id","line"),(0,jt.A)(jl,"defaults",{borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderWidth:3,capBezierPoints:!0,cubicInterpolationMode:"default",fill:!1,spanGaps:!1,stepped:!1,tension:0}),(0,jt.A)(jl,"defaultRoutes",{backgroundColor:"backgroundColor",borderColor:"borderColor"}),(0,jt.A)(jl,"descriptors",{_scriptable:!0,_indexable:t=>"borderDash"!==t&&"fill"!==t});class Xl extends ur{constructor(t){super(),(0,jt.A)(this,"parsed",void 0),(0,jt.A)(this,"skip",void 0),(0,jt.A)(this,"stop",void 0),this.options=void 0,this.parsed=void 0,this.skip=void 0,this.stop=void 0,t&&Object.assign(this,t)}inRange(t,e,i){const s=this.options,{x:n,y:a}=this.getProps(["x","y"],i);return Math.pow(t-n,2)+Math.pow(e-a,2)<Math.pow(s.hitRadius+s.radius,2)}inXRange(t,e){return Hl(this,t,"x",e)}inYRange(t,e){return Hl(this,t,"y",e)}getCenterPoint(t){const{x:e,y:i}=this.getProps(["x","y"],t);return{x:e,y:i}}size(t){t=t||this.options||{};let e=t.radius||0;e=Math.max(e,e&&t.hoverRadius||0);const i=e&&t.borderWidth||0;return 2*(e+i)}draw(t,e){const i=this.options;this.skip||i.radius<.1||!Ds(this,e,this.size(i)/2)||(t.strokeStyle=i.borderColor,t.lineWidth=i.borderWidth,t.fillStyle=i.backgroundColor,Ts(t,i,this.x,this.y))}getRange(){const t=this.options||{};return t.radius+t.hitRadius}}function ql(t,e){const{x:i,y:s,base:n,width:a,height:o}=t.getProps(["x","y","base","width","height"],e);let r,l,h,c,d;return t.horizontal?(d=o/2,r=Math.min(i,n),l=Math.max(i,n),h=s-d,c=s+d):(d=a/2,r=i-d,l=i+d,h=Math.min(s,n),c=Math.max(s,n)),{left:r,top:h,right:l,bottom:c}}function Kl(t,e,i,s){return t?0:Vi(e,i,s)}function Yl(t,e,i){const s=t.options.borderWidth,n=t.borderSkipped,a=Xs(s);return{t:Kl(n.top,a.top,0,i),r:Kl(n.right,a.right,0,e),b:Kl(n.bottom,a.bottom,0,i),l:Kl(n.left,a.left,0,e)}}function Ql(t,e,i){const{enableBorderRadius:s}=t.getProps(["enableBorderRadius"]),n=t.options.borderRadius,a=qs(n),o=Math.min(e,i),r=t.borderSkipped,l=s||ze(n);return{topLeft:Kl(!l||r.top||r.left,a.topLeft,0,o),topRight:Kl(!l||r.top||r.right,a.topRight,0,o),bottomLeft:Kl(!l||r.bottom||r.left,a.bottomLeft,0,o),bottomRight:Kl(!l||r.bottom||r.right,a.bottomRight,0,o)}}function Gl(t){const e=ql(t),i=e.right-e.left,s=e.bottom-e.top,n=Yl(t,i/2,s/2),a=Ql(t,i/2,s/2);return{outer:{x:e.left,y:e.top,w:i,h:s,radius:a},inner:{x:e.left+n.l,y:e.top+n.t,w:i-n.l-n.r,h:s-n.t-n.b,radius:{topLeft:Math.max(0,a.topLeft-Math.max(n.t,n.l)),topRight:Math.max(0,a.topRight-Math.max(n.t,n.r)),bottomLeft:Math.max(0,a.bottomLeft-Math.max(n.b,n.l)),bottomRight:Math.max(0,a.bottomRight-Math.max(n.b,n.r))}}}}function Jl(t,e,i,s){const n=null===e,a=null===i,o=n&&a,r=t&&!o&&ql(t,s);return r&&(n||Ri(e,r.left,r.right))&&(a||Ri(i,r.top,r.bottom))}function Zl(t){return t.topLeft||t.topRight||t.bottomLeft||t.bottomRight}function th(t,e){t.rect(e.x,e.y,e.w,e.h)}function eh(t,e,i={}){const s=t.x!==i.x?-e:0,n=t.y!==i.y?-e:0,a=(t.x+t.w!==i.x+i.w?e:0)-s,o=(t.y+t.h!==i.y+i.h?e:0)-n;return{x:t.x+s,y:t.y+n,w:t.w+a,h:t.h+o,radius:t.radius}}(0,jt.A)(Xl,"id","point"),(0,jt.A)(Xl,"defaults",{borderWidth:1,hitRadius:1,hoverBorderWidth:1,hoverRadius:4,pointStyle:"circle",radius:3,rotation:0}),(0,jt.A)(Xl,"defaultRoutes",{backgroundColor:"backgroundColor",borderColor:"borderColor"});class ih extends ur{constructor(t){super(),this.options=void 0,this.horizontal=void 0,this.base=void 0,this.width=void 0,this.height=void 0,this.inflateAmount=void 0,t&&Object.assign(this,t)}draw(t){const{inflateAmount:e,options:{borderColor:i,backgroundColor:s}}=this,{inner:n,outer:a}=Gl(this),o=Zl(a.radius)?zs:th;t.save(),a.w===n.w&&a.h===n.h||(t.beginPath(),o(t,eh(a,e,n)),t.clip(),o(t,eh(n,-e,a)),t.fillStyle=i,t.fill("evenodd")),t.beginPath(),o(t,eh(n,e)),t.fillStyle=s,t.fill(),t.restore()}inRange(t,e,i){return Jl(this,t,e,i)}inXRange(t,e){return Jl(this,t,null,e)}inYRange(t,e){return Jl(this,null,t,e)}getCenterPoint(t){const{x:e,y:i,base:s,horizontal:n}=this.getProps(["x","y","base","horizontal"],t);return{x:n?(e+s)/2:e,y:n?i:(i+s)/2}}getRange(t){return"x"===t?this.width/2:this.height/2}}(0,jt.A)(ih,"id","bar"),(0,jt.A)(ih,"defaults",{borderSkipped:"start",borderWidth:0,borderRadius:0,inflateAmount:"auto",pointStyle:void 0}),(0,jt.A)(ih,"defaultRoutes",{backgroundColor:"backgroundColor",borderColor:"borderColor"});const sh=(t,e)=>{let{boxHeight:i=e,boxWidth:s=e}=t;return t.usePointStyle&&(i=Math.min(i,e),s=t.pointStyleWidth||Math.min(s,e)),{boxWidth:s,boxHeight:i,itemHeight:Math.max(e,i)}},nh=(t,e)=>null!==t&&null!==e&&t.datasetIndex===e.datasetIndex&&t.index===e.index;class ah extends ur{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=Xe(t.generateLabels,[this.chart],this)||[];t.filter&&(e=e.filter(e=>t.filter(e,this.chart.data))),t.sort&&(e=e.sort((e,i)=>t.sort(e,i,this.chart.data))),this.options.reverse&&e.reverse(),this.legendItems=e}fit(){const{options:t,ctx:e}=this;if(!t.display)return void(this.width=this.height=0);const i=t.labels,s=Ys(i.font),n=s.size,a=this._computeTitleHeight(),{boxWidth:o,itemHeight:r}=sh(i,n);let l,h;e.font=s.string,this.isHorizontal()?(l=this.maxWidth,h=this._fitRows(a,n,o,r)+10):(h=this.maxHeight,l=this._fitCols(a,s,o,r)+10),this.width=Math.min(l,t.maxWidth||this.maxWidth),this.height=Math.min(h,t.maxHeight||this.maxHeight)}_fitRows(t,e,i,s){const{ctx:n,maxWidth:a,options:{labels:{padding:o}}}=this,r=this.legendHitBoxes=[],l=this.lineWidths=[0],h=s+o;let c=t;n.textAlign="left",n.textBaseline="middle";let d=-1,u=-h;return this.legendItems.forEach((t,g)=>{const p=i+e/2+n.measureText(t.text).width;(0===g||l[l.length-1]+p+2*o>a)&&(c+=h,l[l.length-(g>0?0:1)]=0,u+=h,d++),r[g]={left:0,top:u,row:d,width:p,height:s},l[l.length-1]+=p+o}),c}_fitCols(t,e,i,s){const{ctx:n,maxHeight:a,options:{labels:{padding:o}}}=this,r=this.legendHitBoxes=[],l=this.columnSizes=[],h=a-t;let c=o,d=0,u=0,g=0,p=0;return this.legendItems.forEach((t,a)=>{const{itemWidth:f,itemHeight:m}=oh(i,e,n,t,s);a>0&&u+m+2*o>h&&(c+=d+o,l.push({width:d,height:u}),g+=d+o,p++,d=u=0),r[a]={left:g,top:u,col:p,width:f,height:m},d=Math.max(d,f),u+=m+o}),c+=d,l.push({width:d,height:u}),c}adjustHitBoxes(){if(!this.options.display)return;const t=this._computeTitleHeight(),{legendHitBoxes:e,options:{align:i,labels:{padding:s},rtl:n}}=this,a=Gn(n,this.left,this.width);if(this.isHorizontal()){let n=0,o=Qi(i,this.left+s,this.right-this.lineWidths[n]);for(const r of e)n!==r.row&&(n=r.row,o=Qi(i,this.left+s,this.right-this.lineWidths[n])),r.top+=this.top+t+s,r.left=a.leftForLtr(a.x(o),r.width),o+=r.width+s}else{let n=0,o=Qi(i,this.top+t+s,this.bottom-this.columnSizes[n].height);for(const r of e)r.col!==n&&(n=r.col,o=Qi(i,this.top+t+s,this.bottom-this.columnSizes[n].height)),r.top=o,r.left+=this.left+s,r.left=a.leftForLtr(a.x(r.left),r.width),o+=r.height+s}}isHorizontal(){return"top"===this.options.position||"bottom"===this.options.position}draw(){if(this.options.display){const t=this.ctx;Es(t,this),this._draw(),Ls(t)}}_draw(){const{options:t,columnSizes:e,lineWidths:i,ctx:s}=this,{align:n,labels:a}=t,o=ws.color,r=Gn(t.rtl,this.left,this.width),l=Ys(a.font),{padding:h}=a,c=l.size,d=c/2;let u;this.drawTitle(),s.textAlign=r.textAlign("left"),s.textBaseline="middle",s.lineWidth=.5,s.font=l.string;const{boxWidth:g,boxHeight:p,itemHeight:f}=sh(a,c),m=function(t,e,i){if(isNaN(g)||g<=0||isNaN(p)||p<0)return;s.save();const n=$e(i.lineWidth,1);if(s.fillStyle=$e(i.fillStyle,o),s.lineCap=$e(i.lineCap,"butt"),s.lineDashOffset=$e(i.lineDashOffset,0),s.lineJoin=$e(i.lineJoin,"miter"),s.lineWidth=n,s.strokeStyle=$e(i.strokeStyle,o),s.setLineDash($e(i.lineDash,[])),a.usePointStyle){const o={radius:p*Math.SQRT2/2,pointStyle:i.pointStyle,rotation:i.rotation,borderWidth:n},l=r.xPlus(t,g/2),h=e+d;Ps(s,o,l,h,a.pointStyleWidth&&g)}else{const a=e+Math.max((c-p)/2,0),o=r.leftForLtr(t,g),l=qs(i.borderRadius);s.beginPath(),Object.values(l).some(t=>0!==t)?zs(s,{x:o,y:a,w:g,h:p,radius:l}):s.rect(o,a,g,p),s.fill(),0!==n&&s.stroke()}s.restore()},b=function(t,e,i){Bs(s,i.text,t,e+f/2,l,{strikethrough:i.hidden,textAlign:r.textAlign(i.textAlign)})},x=this.isHorizontal(),y=this._computeTitleHeight();u=x?{x:Qi(n,this.left+h,this.right-i[0]),y:this.top+h+y,line:0}:{x:this.left+h,y:Qi(n,this.top+y+h,this.bottom-e[0].height),line:0},Jn(this.ctx,t.textDirection);const _=f+h;this.legendItems.forEach((o,c)=>{s.strokeStyle=o.fontColor,s.fillStyle=o.fontColor;const p=s.measureText(o.text).width,f=r.textAlign(o.textAlign||(o.textAlign=a.textAlign)),v=g+d+p;let k=u.x,w=u.y;r.setWidth(this.width),x?c>0&&k+v+h>this.right&&(w=u.y+=_,u.line++,k=u.x=Qi(n,this.left+h,this.right-i[u.line])):c>0&&w+_>this.bottom&&(k=u.x=k+e[u.line].width+h,u.line++,w=u.y=Qi(n,this.top+y+h,this.bottom-e[u.line].height));const C=r.x(k);if(m(C,w,o),k=Gi(f,k+g+d,x?k+v:this.right,t.rtl),b(r.x(k),w,o),x)u.x+=v+h;else if("string"!==typeof o.text){const t=l.lineHeight;u.y+=hh(o,t)+h}else u.y+=_}),Zn(this.ctx,t.textDirection)}drawTitle(){const t=this.options,e=t.title,i=Ys(e.font),s=Ks(e.padding);if(!e.display)return;const n=Gn(t.rtl,this.left,this.width),a=this.ctx,o=e.position,r=i.size/2,l=s.top+r;let h,c=this.left,d=this.width;if(this.isHorizontal())d=Math.max(...this.lineWidths),h=this.top+l,c=Qi(t.align,c,this.right-d);else{const e=this.columnSizes.reduce((t,e)=>Math.max(t,e.height),0);h=l+Qi(t.align,this.top,this.bottom-e-t.labels.padding-this._computeTitleHeight())}const u=Qi(o,c,c+d);a.textAlign=n.textAlign(Yi(o)),a.textBaseline="middle",a.strokeStyle=e.color,a.fillStyle=e.color,a.font=i.string,Bs(a,e.text,u,h,i)}_computeTitleHeight(){const t=this.options.title,e=Ys(t.font),i=Ks(t.padding);return t.display?e.lineHeight+i.height:0}_getLegendItemAt(t,e){let i,s,n;if(Ri(t,this.left,this.right)&&Ri(e,this.top,this.bottom))for(n=this.legendHitBoxes,i=0;i<n.length;++i)if(s=n[i],Ri(t,s.left,s.left+s.width)&&Ri(e,s.top,s.top+s.height))return this.legendItems[i];return null}handleEvent(t){const e=this.options;if(!ch(t.type,e))return;const i=this._getLegendItemAt(t.x,t.y);if("mousemove"===t.type||"mouseout"===t.type){const s=this._hoveredItem,n=nh(s,i);s&&!n&&Xe(e.onLeave,[t,s,this],this),this._hoveredItem=i,i&&!n&&Xe(e.onHover,[t,i,this],this)}else i&&Xe(e.onClick,[t,i,this],this)}}function oh(t,e,i,s,n){const a=rh(s,t,e,i),o=lh(n,s,e.lineHeight);return{itemWidth:a,itemHeight:o}}function rh(t,e,i,s){let n=t.text;return n&&"string"!==typeof n&&(n=n.reduce((t,e)=>t.length>e.length?t:e)),e+i.size/2+s.measureText(n).width}function lh(t,e,i){let s=t;return"string"!==typeof e.text&&(s=hh(e,i)),s}function hh(t,e){const i=t.text?t.text.length:0;return e*i}function ch(t,e){return!("mousemove"!==t&&"mouseout"!==t||!e.onHover&&!e.onLeave)||!(!e.onClick||"click"!==t&&"mouseup"!==t)}var dh={id:"legend",_element:ah,start(t,e,i){const s=t.legend=new ah({ctx:t.ctx,options:i,chart:t});Uo.configure(t,s,i),Uo.addBox(t,s)},stop(t){Uo.removeBox(t,t.legend),delete t.legend},beforeUpdate(t,e,i){const s=t.legend;Uo.configure(t,s,i),s.options=i},afterUpdate(t){const e=t.legend;e.buildLabels(),e.adjustHitBoxes()},afterEvent(t,e){e.replay||t.legend.handleEvent(e.event)},defaults:{display:!0,position:"top",align:"center",fullSize:!0,reverse:!1,weight:1e3,onClick(t,e,i){const s=e.datasetIndex,n=i.chart;n.isDatasetVisible(s)?(n.hide(s),e.hidden=!0):(n.show(s),e.hidden=!1)},onHover:null,onLeave:null,labels:{color:t=>t.chart.options.color,boxWidth:40,padding:10,generateLabels(t){const e=t.data.datasets,{labels:{usePointStyle:i,pointStyle:s,textAlign:n,color:a,useBorderRadius:o,borderRadius:r}}=t.legend.options;return t._getSortedDatasetMetas().map(t=>{const l=t.controller.getStyle(i?0:void 0),h=Ks(l.borderWidth);return{text:e[t.index].label,fillStyle:l.backgroundColor,fontColor:a,hidden:!t.visible,lineCap:l.borderCapStyle,lineDash:l.borderDash,lineDashOffset:l.borderDashOffset,lineJoin:l.borderJoinStyle,lineWidth:(h.width+h.height)/4,strokeStyle:l.borderColor,pointStyle:s||l.pointStyle,rotation:l.rotation,textAlign:n||l.textAlign,borderRadius:o&&(r||l.borderRadius),datasetIndex:t.index}},this)}},title:{color:t=>t.chart.options.color,display:!1,position:"center",text:""}},descriptors:{_scriptable:t=>!t.startsWith("on"),labels:{_scriptable:t=>!["generateLabels","filter","sort"].includes(t)}}};new WeakMap;const uh={average(t){if(!t.length)return!1;let e,i,s=new Set,n=0,a=0;for(e=0,i=t.length;e<i;++e){const i=t[e].element;if(i&&i.hasValue()){const t=i.tooltipPosition();s.add(t.x),n+=t.y,++a}}if(0===a||0===s.size)return!1;const o=[...s].reduce((t,e)=>t+e)/s.size;return{x:o,y:n/a}},nearest(t,e){if(!t.length)return!1;let i,s,n,a=e.x,o=e.y,r=Number.POSITIVE_INFINITY;for(i=0,s=t.length;i<s;++i){const s=t[i].element;if(s&&s.hasValue()){const t=s.getCenterPoint(),i=Di(e,t);i<r&&(r=i,n=s)}}if(n){const t=n.tooltipPosition();a=t.x,o=t.y}return{x:a,y:o}}};function gh(t,e){return e&&(Be(e)?Array.prototype.push.apply(t,e):t.push(e)),t}function ph(t){return("string"===typeof t||t instanceof String)&&t.indexOf("\n")>-1?t.split("\n"):t}function fh(t,e){const{element:i,datasetIndex:s,index:n}=e,a=t.getDatasetMeta(s).controller,{label:o,value:r}=a.getLabelAndValue(n);return{chart:t,label:o,parsed:a.getParsed(n),raw:t.data.datasets[s].data[n],formattedValue:r,dataset:a.getDataset(),dataIndex:n,datasetIndex:s,element:i}}function mh(t,e){const i=t.chart.ctx,{body:s,footer:n,title:a}=t,{boxWidth:o,boxHeight:r}=e,l=Ys(e.bodyFont),h=Ys(e.titleFont),c=Ys(e.footerFont),d=a.length,u=n.length,g=s.length,p=Ks(e.padding);let f=p.height,m=0,b=s.reduce((t,e)=>t+e.before.length+e.lines.length+e.after.length,0);if(b+=t.beforeBody.length+t.afterBody.length,d&&(f+=d*h.lineHeight+(d-1)*e.titleSpacing+e.titleMarginBottom),b){const t=e.displayColors?Math.max(r,l.lineHeight):l.lineHeight;f+=g*t+(b-g)*l.lineHeight+(b-1)*e.bodySpacing}u&&(f+=e.footerMarginTop+u*c.lineHeight+(u-1)*e.footerSpacing);let x=0;const y=function(t){m=Math.max(m,i.measureText(t).width+x)};return i.save(),i.font=h.string,qe(t.title,y),i.font=l.string,qe(t.beforeBody.concat(t.afterBody),y),x=e.displayColors?o+2+e.boxPadding:0,qe(s,t=>{qe(t.before,y),qe(t.lines,y),qe(t.after,y)}),x=0,i.font=c.string,qe(t.footer,y),i.restore(),m+=p.width,{width:m,height:f}}function bh(t,e){const{y:i,height:s}=e;return i<s/2?"top":i>t.height-s/2?"bottom":"center"}function xh(t,e,i,s){const{x:n,width:a}=s,o=i.caretSize+i.caretPadding;return"left"===t&&n+a+o>e.width||("right"===t&&n-a-o<0||void 0)}function yh(t,e,i,s){const{x:n,width:a}=i,{width:o,chartArea:{left:r,right:l}}=t;let h="center";return"center"===s?h=n<=(r+l)/2?"left":"right":n<=a/2?h="left":n>=o-a/2&&(h="right"),xh(h,t,e,i)&&(h="center"),h}function _h(t,e,i){const s=i.yAlign||e.yAlign||bh(t,i);return{xAlign:i.xAlign||e.xAlign||yh(t,e,i,s),yAlign:s}}function vh(t,e){let{x:i,width:s}=t;return"right"===e?i-=s:"center"===e&&(i-=s/2),i}function kh(t,e,i){let{y:s,height:n}=t;return"top"===e?s+=i:s-="bottom"===e?n+i:n/2,s}function wh(t,e,i,s){const{caretSize:n,caretPadding:a,cornerRadius:o}=t,{xAlign:r,yAlign:l}=i,h=n+a,{topLeft:c,topRight:d,bottomLeft:u,bottomRight:g}=qs(o);let p=vh(e,r);const f=kh(e,l,h);return"center"===l?"left"===r?p+=h:"right"===r&&(p-=h):"left"===r?p-=Math.max(c,u)+n:"right"===r&&(p+=Math.max(d,g)+n),{x:Vi(p,0,s.width-e.width),y:Vi(f,0,s.height-e.height)}}function Ch(t,e,i){const s=Ks(i.padding);return"center"===e?t.x+t.width/2:"right"===e?t.x+t.width-s.right:t.x+s.left}function Sh(t){return gh([],ph(t))}function Fh(t,e,i){return Js(t,{tooltip:e,tooltipItems:i,type:"tooltip"})}function Mh(t,e){const i=e&&e.dataset&&e.dataset.tooltip&&e.dataset.tooltip.callbacks;return i?t.override(i):t}const Ah={beforeTitle:Oe,title(t){if(t.length>0){const e=t[0],i=e.chart.data.labels,s=i?i.length:0;if(this&&this.options&&"dataset"===this.options.mode)return e.dataset.label||"";if(e.label)return e.label;if(s>0&&e.dataIndex<s)return i[e.dataIndex]}return""},afterTitle:Oe,beforeBody:Oe,beforeLabel:Oe,label(t){if(this&&this.options&&"dataset"===this.options.mode)return t.label+": "+t.formattedValue||t.formattedValue;let e=t.dataset.label||"";e&&(e+=": ");const i=t.formattedValue;return We(i)||(e+=i),e},labelColor(t){const e=t.chart.getDatasetMeta(t.datasetIndex),i=e.controller.getStyle(t.dataIndex);return{borderColor:i.borderColor,backgroundColor:i.backgroundColor,borderWidth:i.borderWidth,borderDash:i.borderDash,borderDashOffset:i.borderDashOffset,borderRadius:0}},labelTextColor(){return this.options.bodyColor},labelPointStyle(t){const e=t.chart.getDatasetMeta(t.datasetIndex),i=e.controller.getStyle(t.dataIndex);return{pointStyle:i.pointStyle,rotation:i.rotation}},afterLabel:Oe,afterBody:Oe,beforeFooter:Oe,footer:Oe,afterFooter:Oe};function Th(t,e,i,s){const n=t[e].call(i,s);return"undefined"===typeof n?Ah[e].call(i,s):n}class Ph extends ur{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()),s=i.enabled&&e.options.animation&&i.animations,n=new _a(this.chart,s);return s._cacheable&&(this._cachedAnimations=Object.freeze(n)),n}getContext(){return this.$context||(this.$context=Fh(this.chart.getContext(),this,this._tooltipItems))}getTitle(t,e){const{callbacks:i}=e,s=Th(i,"beforeTitle",this,t),n=Th(i,"title",this,t),a=Th(i,"afterTitle",this,t);let o=[];return o=gh(o,ph(s)),o=gh(o,ph(n)),o=gh(o,ph(a)),o}getBeforeBody(t,e){return Sh(Th(e.callbacks,"beforeBody",this,t))}getBody(t,e){const{callbacks:i}=e,s=[];return qe(t,t=>{const e={before:[],lines:[],after:[]},n=Mh(i,t);gh(e.before,ph(Th(n,"beforeLabel",this,t))),gh(e.lines,Th(n,"label",this,t)),gh(e.after,ph(Th(n,"afterLabel",this,t))),s.push(e)}),s}getAfterBody(t,e){return Sh(Th(e.callbacks,"afterBody",this,t))}getFooter(t,e){const{callbacks:i}=e,s=Th(i,"beforeFooter",this,t),n=Th(i,"footer",this,t),a=Th(i,"afterFooter",this,t);let o=[];return o=gh(o,ph(s)),o=gh(o,ph(n)),o=gh(o,ph(a)),o}_createItems(t){const e=this._active,i=this.chart.data,s=[],n=[],a=[];let o,r,l=[];for(o=0,r=e.length;o<r;++o)l.push(fh(this.chart,e[o]));return t.filter&&(l=l.filter((e,s,n)=>t.filter(e,s,n,i))),t.itemSort&&(l=l.sort((e,s)=>t.itemSort(e,s,i))),qe(l,e=>{const i=Mh(t.callbacks,e);s.push(Th(i,"labelColor",this,e)),n.push(Th(i,"labelPointStyle",this,e)),a.push(Th(i,"labelTextColor",this,e))}),this.labelColors=s,this.labelPointStyles=n,this.labelTextColors=a,this.dataPoints=l,l}update(t,e){const i=this.options.setContext(this.getContext()),s=this._active;let n,a=[];if(s.length){const t=uh[i.position].call(this,s,this._eventPosition);a=this._createItems(i),this.title=this.getTitle(a,i),this.beforeBody=this.getBeforeBody(a,i),this.body=this.getBody(a,i),this.afterBody=this.getAfterBody(a,i),this.footer=this.getFooter(a,i);const e=this._size=mh(this,i),o=Object.assign({},t,e),r=_h(this.chart,i,o),l=wh(i,o,r,this.chart);this.xAlign=r.xAlign,this.yAlign=r.yAlign,n={opacity:1,x:l.x,y:l.y,width:e.width,height:e.height,caretX:t.x,caretY:t.y}}else 0!==this.opacity&&(n={opacity:0});this._tooltipItems=a,this.$context=void 0,n&&this._resolveAnimations().update(this,n),t&&i.external&&i.external.call(this,{chart:this.chart,tooltip:this,replay:e})}drawCaret(t,e,i,s){const n=this.getCaretPosition(t,i,s);e.lineTo(n.x1,n.y1),e.lineTo(n.x2,n.y2),e.lineTo(n.x3,n.y3)}getCaretPosition(t,e,i){const{xAlign:s,yAlign:n}=this,{caretSize:a,cornerRadius:o}=i,{topLeft:r,topRight:l,bottomLeft:h,bottomRight:c}=qs(o),{x:d,y:u}=t,{width:g,height:p}=e;let f,m,b,x,y,_;return"center"===n?(y=u+p/2,"left"===s?(f=d,m=f-a,x=y+a,_=y-a):(f=d+g,m=f+a,x=y-a,_=y+a),b=f):(m="left"===s?d+Math.max(r,h)+a:"right"===s?d+g-Math.max(l,c)-a:this.caretX,"top"===n?(x=u,y=x-a,f=m-a,b=m+a):(x=u+p,y=x+a,f=m+a,b=m-a),_=x),{x1:f,x2:m,x3:b,y1:x,y2:y,y3:_}}drawTitle(t,e,i){const s=this.title,n=s.length;let a,o,r;if(n){const l=Gn(i.rtl,this.x,this.width);for(t.x=Ch(this,i.titleAlign,i),e.textAlign=l.textAlign(i.titleAlign),e.textBaseline="middle",a=Ys(i.titleFont),o=i.titleSpacing,e.fillStyle=i.titleColor,e.font=a.string,r=0;r<n;++r)e.fillText(s[r],l.x(t.x),t.y+a.lineHeight/2),t.y+=a.lineHeight+o,r+1===n&&(t.y+=i.titleMarginBottom-o)}}_drawColorBox(t,e,i,s,n){const a=this.labelColors[i],o=this.labelPointStyles[i],{boxHeight:r,boxWidth:l}=n,h=Ys(n.bodyFont),c=Ch(this,"left",n),d=s.x(c),u=r<h.lineHeight?(h.lineHeight-r)/2:0,g=e.y+u;if(n.usePointStyle){const e={radius:Math.min(l,r)/2,pointStyle:o.pointStyle,rotation:o.rotation,borderWidth:1},i=s.leftForLtr(d,l)+l/2,h=g+r/2;t.strokeStyle=n.multiKeyBackground,t.fillStyle=n.multiKeyBackground,Ts(t,e,i,h),t.strokeStyle=a.borderColor,t.fillStyle=a.backgroundColor,Ts(t,e,i,h)}else{t.lineWidth=ze(a.borderWidth)?Math.max(...Object.values(a.borderWidth)):a.borderWidth||1,t.strokeStyle=a.borderColor,t.setLineDash(a.borderDash||[]),t.lineDashOffset=a.borderDashOffset||0;const e=s.leftForLtr(d,l),i=s.leftForLtr(s.xPlus(d,1),l-2),o=qs(a.borderRadius);Object.values(o).some(t=>0!==t)?(t.beginPath(),t.fillStyle=n.multiKeyBackground,zs(t,{x:e,y:g,w:l,h:r,radius:o}),t.fill(),t.stroke(),t.fillStyle=a.backgroundColor,t.beginPath(),zs(t,{x:i,y:g+1,w:l-2,h:r-2,radius:o}),t.fill()):(t.fillStyle=n.multiKeyBackground,t.fillRect(e,g,l,r),t.strokeRect(e,g,l,r),t.fillStyle=a.backgroundColor,t.fillRect(i,g+1,l-2,r-2))}t.fillStyle=this.labelTextColors[i]}drawBody(t,e,i){const{body:s}=this,{bodySpacing:n,bodyAlign:a,displayColors:o,boxHeight:r,boxWidth:l,boxPadding:h}=i,c=Ys(i.bodyFont);let d=c.lineHeight,u=0;const g=Gn(i.rtl,this.x,this.width),p=function(i){e.fillText(i,g.x(t.x+u),t.y+d/2),t.y+=d+n},f=g.textAlign(a);let m,b,x,y,_,v,k;for(e.textAlign=a,e.textBaseline="middle",e.font=c.string,t.x=Ch(this,f,i),e.fillStyle=i.bodyColor,qe(this.beforeBody,p),u=o&&"right"!==f?"center"===a?l/2+h:l+2+h:0,y=0,v=s.length;y<v;++y){for(m=s[y],b=this.labelTextColors[y],e.fillStyle=b,qe(m.before,p),x=m.lines,o&&x.length&&(this._drawColorBox(e,t,y,g,i),d=Math.max(c.lineHeight,r)),_=0,k=x.length;_<k;++_)p(x[_]),d=c.lineHeight;qe(m.after,p)}u=0,d=c.lineHeight,qe(this.afterBody,p),t.y-=n}drawFooter(t,e,i){const s=this.footer,n=s.length;let a,o;if(n){const r=Gn(i.rtl,this.x,this.width);for(t.x=Ch(this,i.footerAlign,i),t.y+=i.footerMarginTop,e.textAlign=r.textAlign(i.footerAlign),e.textBaseline="middle",a=Ys(i.footerFont),e.fillStyle=i.footerColor,e.font=a.string,o=0;o<n;++o)e.fillText(s[o],r.x(t.x),t.y+a.lineHeight/2),t.y+=a.lineHeight+i.footerSpacing}}drawBackground(t,e,i,s){const{xAlign:n,yAlign:a}=this,{x:o,y:r}=t,{width:l,height:h}=i,{topLeft:c,topRight:d,bottomLeft:u,bottomRight:g}=qs(s.cornerRadius);e.fillStyle=s.backgroundColor,e.strokeStyle=s.borderColor,e.lineWidth=s.borderWidth,e.beginPath(),e.moveTo(o+c,r),"top"===a&&this.drawCaret(t,e,i,s),e.lineTo(o+l-d,r),e.quadraticCurveTo(o+l,r,o+l,r+d),"center"===a&&"right"===n&&this.drawCaret(t,e,i,s),e.lineTo(o+l,r+h-g),e.quadraticCurveTo(o+l,r+h,o+l-g,r+h),"bottom"===a&&this.drawCaret(t,e,i,s),e.lineTo(o+u,r+h),e.quadraticCurveTo(o,r+h,o,r+h-u),"center"===a&&"left"===n&&this.drawCaret(t,e,i,s),e.lineTo(o,r+c),e.quadraticCurveTo(o,r,o+c,r),e.closePath(),e.fill(),s.borderWidth>0&&e.stroke()}_updateAnimationTarget(t){const e=this.chart,i=this.$animations,s=i&&i.x,n=i&&i.y;if(s||n){const i=uh[t.position].call(this,this._active,this._eventPosition);if(!i)return;const a=this._size=mh(this,t),o=Object.assign({},i,this._size),r=_h(e,t,o),l=wh(t,o,r,e);s._to===l.x&&n._to===l.y||(this.xAlign=r.xAlign,this.yAlign=r.yAlign,this.width=a.width,this.height=a.height,this.caretX=i.x,this.caretY=i.y,this._resolveAnimations().update(this,l))}}_willRender(){return!!this.opacity}draw(t){const e=this.options.setContext(this.getContext());let i=this.opacity;if(!i)return;this._updateAnimationTarget(e);const s={width:this.width,height:this.height},n={x:this.x,y:this.y};i=Math.abs(i)<.001?0:i;const a=Ks(e.padding),o=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;e.enabled&&o&&(t.save(),t.globalAlpha=i,this.drawBackground(n,t,s,e),Jn(t,e.textDirection),n.y+=a.top,this.drawTitle(n,t,e),this.drawBody(n,t,e),this.drawFooter(n,t,e),Zn(t,e.textDirection),t.restore())}getActiveElements(){return this._active||[]}setActiveElements(t,e){const i=this._active,s=t.map(({datasetIndex:t,index:e})=>{const i=this.chart.getDatasetMeta(t);if(!i)throw new Error("Cannot find a dataset at index "+t);return{datasetIndex:t,element:i.data[e],index:e}}),n=!Ke(i,s),a=this._positionChanged(s,e);(n||a)&&(this._active=s,this._eventPosition=e,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(t,e,i=!0){if(e&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;const s=this.options,n=this._active||[],a=this._getActiveElements(t,n,e,i),o=this._positionChanged(a,t),r=e||!Ke(a,n)||o;return r&&(this._active=a,(s.enabled||s.external)&&(this._eventPosition={x:t.x,y:t.y},this.update(!0,e))),r}_getActiveElements(t,e,i,s){const n=this.options;if("mouseout"===t.type)return[];if(!s)return e.filter(t=>this.chart.data.datasets[t.datasetIndex]&&void 0!==this.chart.getDatasetMeta(t.datasetIndex).controller.getParsed(t.index));const a=this.chart.getElementsAtEventForMode(t,n.mode,n,i);return n.reverse&&a.reverse(),a}_positionChanged(t,e){const{caretX:i,caretY:s,options:n}=this,a=uh[n.position].call(this,t,e);return!1!==a&&(i!==a.x||s!==a.y)}}(0,jt.A)(Ph,"positioners",uh);var Dh={id:"tooltip",_element:Ph,positioners:uh,afterInit(t,e,i){i&&(t.tooltip=new Ph({chart:t,options:i}))},beforeUpdate(t,e,i){t.tooltip&&t.tooltip.initialize(i)},reset(t,e,i){t.tooltip&&t.tooltip.initialize(i)},afterDraw(t){const e=t.tooltip;if(e&&e._willRender()){const i={tooltip:e};if(!1===t.notifyPlugins("beforeTooltipDraw",{...i,cancelable:!0}))return;e.draw(t.ctx),t.notifyPlugins("afterTooltipDraw",i)}},afterEvent(t,e){if(t.tooltip){const i=e.replay;t.tooltip.handleEvent(e.event,i,e.inChartArea)&&(e.changed=!0)}},defaults:{enabled:!0,external:null,position:"average",backgroundColor:"rgba(0,0,0,0.8)",titleColor:"#fff",titleFont:{weight:"bold"},titleSpacing:2,titleMarginBottom:6,titleAlign:"left",bodyColor:"#fff",bodySpacing:2,bodyFont:{},bodyAlign:"left",footerColor:"#fff",footerSpacing:2,footerMarginTop:6,footerFont:{weight:"bold"},footerAlign:"left",padding:6,caretPadding:2,caretSize:5,cornerRadius:6,boxHeight:(t,e)=>e.bodyFont.size,boxWidth:(t,e)=>e.bodyFont.size,multiKeyBackground:"#fff",displayColors:!0,boxPadding:0,borderColor:"rgba(0,0,0,0)",borderWidth:0,animation:{duration:400,easing:"easeOutQuart"},animations:{numbers:{type:"number",properties:["x","y","width","height","caretX","caretY"]},opacity:{easing:"linear",duration:200}},callbacks:Ah},defaultRoutes:{bodyFont:"font",footerFont:"font",titleFont:"font"},descriptors:{_scriptable:t=>"filter"!==t&&"itemSort"!==t&&"external"!==t,_indexable:!1,callbacks:{_scriptable:!1,_indexable:!1},animation:{_fallback:!1},animations:{_fallback:"animation"}},additionalOptionScopes:["interaction"]};const Eh=(t,e,i,s)=>("string"===typeof e?(i=t.push(e)-1,s.unshift({index:i,label:e})):isNaN(e)&&(i=null),i);function Lh(t,e,i,s){const n=t.indexOf(e);if(-1===n)return Eh(t,e,i,s);const a=t.lastIndexOf(e);return n!==a?i:n}const Ih=(t,e)=>null===t?null:Vi(Math.round(t),0,e);function Vh(t){const e=this.getLabels();return t>=0&&t<e.length?e[t]:t}class Oh extends Er{constructor(t){super(t),this._startValue=void 0,this._valueRange=0,this._addedLabels=[]}init(t){const e=this._addedLabels;if(e.length){const t=this.getLabels();for(const{index:i,label:s}of e)t[i]===s&&t.splice(i,1);this._addedLabels=[]}super.init(t)}parse(t,e){if(We(t))return null;const i=this.getLabels();return e=isFinite(e)&&i[e]===t?e:Lh(i,t,$e(e,t),this._addedLabels),Ih(e,i.length-1)}determineDataLimits(){const{minDefined:t,maxDefined:e}=this.getUserBounds();let{min:i,max:s}=this.getMinMax(!0);"ticks"===this.options.bounds&&(t||(i=0),e||(s=this.getLabels().length-1)),this.min=i,this.max=s}buildTicks(){const t=this.min,e=this.max,i=this.options.offset,s=[];let n=this.getLabels();n=0===t&&e===n.length-1?n:n.slice(t,e+1),this._valueRange=Math.max(n.length-(i?0:1),1),this._startValue=this.min-(i?.5:0);for(let a=t;a<=e;a++)s.push({value:a});return s}getLabelForValue(t){return Vh.call(this,t)}configure(){super.configure(),this.isHorizontal()||(this._reversePixels=!this._reversePixels)}getPixelForValue(t){return"number"!==typeof t&&(t=this.parse(t)),null===t?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getPixelForTick(t){const e=this.ticks;return t<0||t>e.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 Rh(t,e){const i=[],s=1e-14,{bounds:n,step:a,min:o,max:r,precision:l,count:h,maxTicks:c,maxDigits:d,includeBounds:u}=t,g=a||1,p=c-1,{min:f,max:m}=e,b=!We(o),x=!We(r),y=!We(h),_=(m-f)/(d+1);let v,k,w,C,S=vi((m-f)/p/g)*g;if(S<s&&!b&&!x)return[{value:f},{value:m}];C=Math.ceil(m/S)-Math.floor(f/S),C>p&&(S=vi(C*S/p/g)*g),We(l)||(v=Math.pow(10,l),S=Math.ceil(S*v)/v),"ticks"===n?(k=Math.floor(f/S)*S,w=Math.ceil(m/S)*S):(k=f,w=m),b&&x&&a&&Si((r-o)/a,S/1e3)?(C=Math.round(Math.min((r-o)/S,c)),S=(r-o)/C,k=o,w=r):y?(k=b?o:k,w=x?r:w,C=h-1,S=(w-k)/C):(C=(w-k)/S,C=_i(C,Math.round(C),S/1e3)?Math.round(C):Math.ceil(C));const F=Math.max(Ti(S),Ti(k));v=Math.pow(10,We(l)?F:l),k=Math.round(k*v)/v,w=Math.round(w*v)/v;let M=0;for(b&&(u&&k!==o?(i.push({value:o}),k<o&&M++,_i(Math.round((k+M*S)*v)/v,o,Wh(o,_,t))&&M++):k<o&&M++);M<C;++M){const t=Math.round((k+M*S)*v)/v;if(x&&t>r)break;i.push({value:t})}return x&&u&&w!==r?i.length&&_i(i[i.length-1].value,r,Wh(r,_,t))?i[i.length-1].value=r:i.push({value:r}):x&&w!==r||i.push({value:w}),i}function Wh(t,e,{horizontal:i,minRotation:s}){const n=Mi(s),a=(i?Math.sin(n):Math.cos(n))||.001,o=.75*e*(""+t).length;return Math.min(e/a,o)}(0,jt.A)(Oh,"id","category"),(0,jt.A)(Oh,"defaults",{ticks:{callback:Vh}});class Bh extends Er{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 We(t)||("number"===typeof t||t instanceof Number)&&!isFinite(+t)?null:+t}handleTickRangeOptions(){const{beginAtZero:t}=this.options,{minDefined:e,maxDefined:i}=this.getUserBounds();let{min:s,max:n}=this;const a=t=>s=e?s:t,o=t=>n=i?n:t;if(t){const t=yi(s),e=yi(n);t<0&&e<0?o(0):t>0&&e>0&&a(0)}if(s===n){let e=0===n?1:Math.abs(.05*n);o(n+e),t||a(s-e)}this.min=s,this.max=n}getTickLimit(){const t=this.options.ticks;let e,{maxTicksLimit:i,stepSize:s}=t;return s?(e=Math.ceil(this.max/s)-Math.floor(this.min/s)+1,e>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${s} would result generating up to ${e} ticks. Limiting to 1000.`),e=1e3)):(e=this.computeTickLimit(),i=i||11),i&&(e=Math.min(i,e)),e}computeTickLimit(){return Number.POSITIVE_INFINITY}buildTicks(){const t=this.options,e=t.ticks;let i=this.getTickLimit();i=Math.max(2,i);const s={maxTicks:i,bounds:t.bounds,min:t.min,max:t.max,precision:e.precision,step:e.stepSize,count:e.count,maxDigits:this._maxDigits(),horizontal:this.isHorizontal(),minRotation:e.minRotation||0,includeBounds:!1!==e.includeBounds},n=this._range||this,a=Rh(s,n);return"ticks"===t.bounds&&Fi(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 s=(i-e)/Math.max(t.length-1,1)/2;e-=s,i+=s}this._startValue=e,this._endValue=i,this._valueRange=i-e}getLabelForValue(t){return gs(t,this.chart.options.locale,this.options.ticks.format)}}class zh extends Bh{determineDataLimits(){const{min:t,max:e}=this.getMinMax(!0);this.min=Ne(t)?t:0,this.max=Ne(e)?e:1,this.handleTickRangeOptions()}computeTickLimit(){const t=this.isHorizontal(),e=t?this.width:this.height,i=Mi(this.options.ticks.minRotation),s=(t?Math.sin(i):Math.cos(i))||.001,n=this._resolveTickFontOptions(0);return Math.ceil(e/Math.min(40,n.lineHeight/s))}getPixelForValue(t){return null===t?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getValueForPixel(t){return this._startValue+this.getDecimalForPixel(t)*this._valueRange}}(0,jt.A)(zh,"id","linear"),(0,jt.A)(zh,"defaults",{ticks:{callback:ms.formatters.numeric}});const Nh=t=>Math.floor(xi(t)),Uh=(t,e)=>Math.pow(10,Nh(t)+e);function $h(t){const e=t/Math.pow(10,Nh(t));return 1===e}function jh(t,e,i){const s=Math.pow(10,i),n=Math.floor(t/s),a=Math.ceil(e/s);return a-n}function Hh(t,e){const i=e-t;let s=Nh(i);while(jh(t,e,s)>10)s++;while(jh(t,e,s)<10)s--;return Math.min(s,Nh(t))}function Xh(t,{min:e,max:i}){e=Ue(t.min,e);const s=[],n=Nh(e);let a=Hh(e,i),o=a<0?Math.pow(10,Math.abs(a)):1;const r=Math.pow(10,a),l=n>a?Math.pow(10,n):0,h=Math.round((e-l)*o)/o,c=Math.floor((e-l)/r/10)*r*10;let d=Math.floor((h-c)/Math.pow(10,a)),u=Ue(t.min,Math.round((l+c+d*Math.pow(10,a))*o)/o);while(u<i)s.push({value:u,major:$h(u),significand:d}),d>=10?d=d<15?15:20:d++,d>=20&&(a++,d=2,o=a>=0?1:o),u=Math.round((l+c+d*Math.pow(10,a))*o)/o;const g=Ue(t.max,u);return s.push({value:g,major:$h(g),significand:d}),s}class qh extends Er{constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._valueRange=0}parse(t,e){const i=Bh.prototype.parse.apply(this,[t,e]);if(0!==i)return Ne(i)&&i>0?i:null;this._zero=!0}determineDataLimits(){const{min:t,max:e}=this.getMinMax(!0);this.min=Ne(t)?Math.max(0,t):null,this.max=Ne(e)?Math.max(0,e):null,this.options.beginAtZero&&(this._zero=!0),this._zero&&this.min!==this._suggestedMin&&!Ne(this._userMin)&&(this.min=t===Uh(this.min,0)?Uh(this.min,-1):Uh(this.min,0)),this.handleTickRangeOptions()}handleTickRangeOptions(){const{minDefined:t,maxDefined:e}=this.getUserBounds();let i=this.min,s=this.max;const n=e=>i=t?i:e,a=t=>s=e?s:t;i===s&&(i<=0?(n(1),a(10)):(n(Uh(i,-1)),a(Uh(s,1)))),i<=0&&n(Uh(s,-1)),s<=0&&a(Uh(i,1)),this.min=i,this.max=s}buildTicks(){const t=this.options,e={min:this._userMin,max:this._userMax},i=Xh(e,this);return"ticks"===t.bounds&&Fi(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 void 0===t?"0":gs(t,this.chart.options.locale,this.options.ticks.format)}configure(){const t=this.min;super.configure(),this._startValue=xi(t),this._valueRange=xi(this.max)-xi(t)}getPixelForValue(t){return void 0!==t&&0!==t||(t=this.min),null===t||isNaN(t)?NaN:this.getPixelForDecimal(t===this.min?0:(xi(t)-this._startValue)/this._valueRange)}getValueForPixel(t){const e=this.getDecimalForPixel(t);return Math.pow(10,this._startValue+e*this._valueRange)}}function Kh(t){const e=t.ticks;if(e.display&&t.display){const t=Ks(e.backdropPadding);return $e(e.font&&e.font.size,ws.font.size)+t.height}return 0}function Yh(t,e,i){return i=Be(i)?i:[i],{w:Fs(t,e.string,i),h:i.length*e.lineHeight}}function Qh(t,e,i,s,n){return t===s||t===n?{start:e-i/2,end:e+i/2}:t<s||t>n?{start:e-i,end:e}:{start:e,end:e+i}}function Gh(t){const e={l:t.left+t._padding.left,r:t.right-t._padding.right,t:t.top+t._padding.top,b:t.bottom-t._padding.bottom},i=Object.assign({},e),s=[],n=[],a=t._pointLabels.length,o=t.options.pointLabels,r=o.centerPointLabels?ci/a:0;for(let l=0;l<a;l++){const a=o.setContext(t.getPointLabelContext(l));n[l]=a.padding;const h=t.getPointPosition(l,t.drawingArea+n[l],r),c=Ys(a.font),d=Yh(t.ctx,c,t._pointLabels[l]);s[l]=d;const u=Li(t.getIndexAngle(l)+r),g=Math.round(Ai(u)),p=Qh(g,h.x,d.w,0,180),f=Qh(g,h.y,d.h,90,270);Jh(i,e,u,p,f)}t.setCenterPoint(e.l-i.l,i.r-e.r,e.t-i.t,i.b-e.b),t._pointLabelItems=ec(t,s,n)}function Jh(t,e,i,s,n){const a=Math.abs(Math.sin(i)),o=Math.abs(Math.cos(i));let r=0,l=0;s.start<e.l?(r=(e.l-s.start)/a,t.l=Math.min(t.l,e.l-r)):s.end>e.r&&(r=(s.end-e.r)/a,t.r=Math.max(t.r,e.r+r)),n.start<e.t?(l=(e.t-n.start)/o,t.t=Math.min(t.t,e.t-l)):n.end>e.b&&(l=(n.end-e.b)/o,t.b=Math.max(t.b,e.b+l))}function Zh(t,e,i){const s=t.drawingArea,{extra:n,additionalAngle:a,padding:o,size:r}=i,l=t.getPointPosition(e,s+n+o,a),h=Math.round(Ai(Li(l.angle+fi))),c=nc(l.y,r.h,h),d=ic(h),u=sc(l.x,r.w,d);return{visible:!0,x:l.x,y:c,textAlign:d,left:u,top:c,right:u+r.w,bottom:c+r.h}}function tc(t,e){if(!e)return!0;const{left:i,top:s,right:n,bottom:a}=t,o=Ds({x:i,y:s},e)||Ds({x:i,y:a},e)||Ds({x:n,y:s},e)||Ds({x:n,y:a},e);return!o}function ec(t,e,i){const s=[],n=t._pointLabels.length,a=t.options,{centerPointLabels:o,display:r}=a.pointLabels,l={extra:Kh(a)/2,additionalAngle:o?ci/n:0};let h;for(let c=0;c<n;c++){l.padding=i[c],l.size=e[c];const n=Zh(t,c,l);s.push(n),"auto"===r&&(n.visible=tc(n,h),n.visible&&(h=n))}return s}function ic(t){return 0===t||180===t?"center":t<180?"left":"right"}function sc(t,e,i){return"right"===i?t-=e:"center"===i&&(t-=e/2),t}function nc(t,e,i){return 90===i||270===i?t-=e/2:(i>270||i<90)&&(t-=e),t}function ac(t,e,i){const{left:s,top:n,right:a,bottom:o}=i,{backdropColor:r}=e;if(!We(r)){const i=qs(e.borderRadius),l=Ks(e.backdropPadding);t.fillStyle=r;const h=s-l.left,c=n-l.top,d=a-s+l.width,u=o-n+l.height;Object.values(i).some(t=>0!==t)?(t.beginPath(),zs(t,{x:h,y:c,w:d,h:u,radius:i}),t.fill()):t.fillRect(h,c,d,u)}}function oc(t,e){const{ctx:i,options:{pointLabels:s}}=t;for(let n=e-1;n>=0;n--){const e=t._pointLabelItems[n];if(!e.visible)continue;const a=s.setContext(t.getPointLabelContext(n));ac(i,a,e);const o=Ys(a.font),{x:r,y:l,textAlign:h}=e;Bs(i,t._pointLabels[n],r,l+o.lineHeight/2,o,{color:a.color,textAlign:h,textBaseline:"middle"})}}function rc(t,e,i,s){const{ctx:n}=t;if(i)n.arc(t.xCenter,t.yCenter,e,0,di);else{let i=t.getPointPosition(0,e);n.moveTo(i.x,i.y);for(let a=1;a<s;a++)i=t.getPointPosition(a,e),n.lineTo(i.x,i.y)}}function lc(t,e,i,s,n){const a=t.ctx,o=e.circular,{color:r,lineWidth:l}=e;!o&&!s||!r||!l||i<0||(a.save(),a.strokeStyle=r,a.lineWidth=l,a.setLineDash(n.dash||[]),a.lineDashOffset=n.dashOffset,a.beginPath(),rc(t,i,o,s),a.closePath(),a.stroke(),a.restore())}function hc(t,e,i){return Js(t,{label:i,index:e,type:"pointLabel"})}(0,jt.A)(qh,"id","logarithmic"),(0,jt.A)(qh,"defaults",{ticks:{callback:ms.formatters.logarithmic,major:{enabled:!0}}});class cc extends Bh{constructor(t){super(t),this.xCenter=void 0,this.yCenter=void 0,this.drawingArea=void 0,this._pointLabels=[],this._pointLabelItems=[]}setDimensions(){const t=this._padding=Ks(Kh(this.options)/2),e=this.width=this.maxWidth-t.width,i=this.height=this.maxHeight-t.height;this.xCenter=Math.floor(this.left+e/2+t.left),this.yCenter=Math.floor(this.top+i/2+t.top),this.drawingArea=Math.floor(Math.min(e,i)/2)}determineDataLimits(){const{min:t,max:e}=this.getMinMax(!1);this.min=Ne(t)&&!isNaN(t)?t:0,this.max=Ne(e)&&!isNaN(e)?e:0,this.handleTickRangeOptions()}computeTickLimit(){return Math.ceil(this.drawingArea/Kh(this.options))}generateTickLabels(t){Bh.prototype.generateTickLabels.call(this,t),this._pointLabels=this.getLabels().map((t,e)=>{const i=Xe(this.options.pointLabels.callback,[t,e],this);return i||0===i?i:""}).filter((t,e)=>this.chart.getDataVisibility(e))}fit(){const t=this.options;t.display&&t.pointLabels.display?Gh(this):this.setCenterPoint(0,0,0,0)}setCenterPoint(t,e,i,s){this.xCenter+=Math.floor((t-e)/2),this.yCenter+=Math.floor((i-s)/2),this.drawingArea-=Math.min(this.drawingArea/2,Math.max(t,e,i,s))}getIndexAngle(t){const e=di/(this._pointLabels.length||1),i=this.options.startAngle||0;return Li(t*e+Mi(i))}getDistanceFromCenterForValue(t){if(We(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(We(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<e.length){const i=e[t];return hc(this.getContext(),t,i)}}getPointPosition(t,e,i=0){const s=this.getIndexAngle(t)-fi+i;return{x:Math.cos(s)*e+this.xCenter,y:Math.sin(s)*e+this.yCenter,angle:s}}getPointPositionForValue(t,e){return this.getPointPosition(t,this.getDistanceFromCenterForValue(e))}getBasePosition(t){return this.getPointPositionForValue(t||0,this.getBaseValue())}getPointLabelPosition(t){const{left:e,top:i,right:s,bottom:n}=this._pointLabelItems[t];return{left:e,top:i,right:s,bottom:n}}drawBackground(){const{backgroundColor:t,grid:{circular:e}}=this.options;if(t){const i=this.ctx;i.save(),i.beginPath(),rc(this,this.getDistanceFromCenterForValue(this._endValue),e,this._pointLabels.length),i.closePath(),i.fillStyle=t,i.fill(),i.restore()}}drawGrid(){const t=this.ctx,e=this.options,{angleLines:i,grid:s,border:n}=e,a=this._pointLabels.length;let o,r,l;if(e.pointLabels.display&&oc(this,a),s.display&&this.ticks.forEach((t,e)=>{if(0!==e||0===e&&this.min<0){r=this.getDistanceFromCenterForValue(t.value);const i=this.getContext(e),o=s.setContext(i),l=n.setContext(i);lc(this,o,r,a,l)}}),i.display){for(t.save(),o=a-1;o>=0;o--){const s=i.setContext(this.getPointLabelContext(o)),{color:n,lineWidth:a}=s;a&&n&&(t.lineWidth=a,t.strokeStyle=n,t.setLineDash(s.borderDash),t.lineDashOffset=s.borderDashOffset,r=this.getDistanceFromCenterForValue(e.reverse?this.min:this.max),l=this.getPointPosition(o,r),t.beginPath(),t.moveTo(this.xCenter,this.yCenter),t.lineTo(l.x,l.y),t.stroke())}t.restore()}}drawBorder(){}drawLabels(){const t=this.ctx,e=this.options,i=e.ticks;if(!i.display)return;const s=this.getIndexAngle(0);let n,a;t.save(),t.translate(this.xCenter,this.yCenter),t.rotate(s),t.textAlign="center",t.textBaseline="middle",this.ticks.forEach((s,o)=>{if(0===o&&this.min>=0&&!e.reverse)return;const r=i.setContext(this.getContext(o)),l=Ys(r.font);if(n=this.getDistanceFromCenterForValue(this.ticks[o].value),r.showLabelBackdrop){t.font=l.string,a=t.measureText(s.label).width,t.fillStyle=r.backdropColor;const e=Ks(r.backdropPadding);t.fillRect(-a/2-e.left,-n-l.size/2-e.top,a+e.width,l.size+e.height)}Bs(t,s.label,0,-n,l,{color:r.color,strokeColor:r.textStrokeColor,strokeWidth:r.textStrokeWidth})}),t.restore()}drawTitle(){}}(0,jt.A)(cc,"id","radialLinear"),(0,jt.A)(cc,"defaults",{display:!0,animate:!0,position:"chartArea",angleLines:{display:!0,lineWidth:1,borderDash:[],borderDashOffset:0},grid:{circular:!1},startAngle:0,ticks:{showLabelBackdrop:!0,callback:ms.formatters.numeric},pointLabels:{backdropColor:void 0,backdropPadding:2,display:!0,font:{size:10},callback(t){return t},padding:5,centerPointLabels:!1}}),(0,jt.A)(cc,"defaultRoutes",{"angleLines.color":"borderColor","pointLabels.color":"color","ticks.color":"color"}),(0,jt.A)(cc,"descriptors",{angleLines:{_fallback:"grid"}});const dc={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}},uc=Object.keys(dc);function gc(t,e){return t-e}function pc(t,e){if(We(e))return null;const i=t._adapter,{parser:s,round:n,isoWeekday:a}=t._parseOpts;let o=e;return"function"===typeof s&&(o=s(o)),Ne(o)||(o="string"===typeof s?i.parse(o,s):i.parse(o)),null===o?null:(n&&(o="week"!==n||!Ci(a)&&!0!==a?i.startOf(o,n):i.startOf(o,"isoWeek",a)),+o)}function fc(t,e,i,s){const n=uc.length;for(let a=uc.indexOf(t);a<n-1;++a){const t=dc[uc[a]],n=t.steps?t.steps:Number.MAX_SAFE_INTEGER;if(t.common&&Math.ceil((i-e)/(n*t.size))<=s)return uc[a]}return uc[n-1]}function mc(t,e,i,s,n){for(let a=uc.length-1;a>=uc.indexOf(i);a--){const i=uc[a];if(dc[i].common&&t._adapter.diff(n,s,i)>=e-1)return i}return uc[i?uc.indexOf(i):0]}function bc(t){for(let e=uc.indexOf(t)+1,i=uc.length;e<i;++e)if(dc[uc[e]].common)return uc[e]}function xc(t,e,i){if(i){if(i.length){const{lo:s,hi:n}=Wi(i,e),a=i[s]>=e?i[s]:i[n];t[a]=!0}}else t[e]=!0}function yc(t,e,i,s){const n=t._adapter,a=+n.startOf(e[0].value,s),o=e[e.length-1].value;let r,l;for(r=a;r<=o;r=+n.add(r,1,s))l=i[r],l>=0&&(e[l].major=!0);return e}function _c(t,e,i){const s=[],n={},a=e.length;let o,r;for(o=0;o<a;++o)r=e[o],n[r]=o,s.push({value:r,major:!1});return 0!==a&&i?yc(t,s,n,i):s}class vc extends Er{constructor(t){super(t),this._cache={data:[],labels:[],all:[]},this._unit="day",this._majorUnit=void 0,this._offsets={},this._normalized=!1,this._parseOpts=void 0}init(t,e={}){const i=t.time||(t.time={}),s=this._adapter=new mo._date(t.adapters.date);s.init(e),Ze(i.displayFormats,s.formats()),this._parseOpts={parser:i.parser,round:i.round,isoWeekday:i.isoWeekday},super.init(t),this._normalized=e.normalized}parse(t,e){return void 0===t?null:pc(this,t)}beforeLayout(){super.beforeLayout(),this._cache={data:[],labels:[],all:[]}}determineDataLimits(){const t=this.options,e=this._adapter,i=t.time.unit||"day";let{min:s,max:n,minDefined:a,maxDefined:o}=this.getUserBounds();function r(t){a||isNaN(t.min)||(s=Math.min(s,t.min)),o||isNaN(t.max)||(n=Math.max(n,t.max))}a&&o||(r(this._getLabelBounds()),"ticks"===t.bounds&&"labels"===t.ticks.source||r(this.getMinMax(!1))),s=Ne(s)&&!isNaN(s)?s:+e.startOf(Date.now(),i),n=Ne(n)&&!isNaN(n)?n:+e.endOf(Date.now(),i)+1,this.min=Math.min(s,n-1),this.max=Math.max(s+1,n)}_getLabelBounds(){const t=this.getLabelTimestamps();let e=Number.POSITIVE_INFINITY,i=Number.NEGATIVE_INFINITY;return t.length&&(e=t[0],i=t[t.length-1]),{min:e,max:i}}buildTicks(){const t=this.options,e=t.time,i=t.ticks,s="labels"===i.source?this.getLabelTimestamps():this._generate();"ticks"===t.bounds&&s.length&&(this.min=this._userMin||s[0],this.max=this._userMax||s[s.length-1]);const n=this.min,a=this.max,o=Ni(s,n,a);return this._unit=e.unit||(i.autoSkip?fc(e.minUnit,this.min,this.max,this._getLabelCapacity(n)):mc(this,o.length,e.minUnit,this.min,this.max)),this._majorUnit=i.major.enabled&&"year"!==this._unit?bc(this._unit):void 0,this.initOffsets(s),t.reverse&&o.reverse(),_c(this,o,this._majorUnit)}afterAutoSkip(){this.options.offsetAfterAutoskip&&this.initOffsets(this.ticks.map(t=>+t.value))}initOffsets(t=[]){let e,i,s=0,n=0;this.options.offset&&t.length&&(e=this.getDecimalForValue(t[0]),s=1===t.length?1-e:(this.getDecimalForValue(t[1])-e)/2,i=this.getDecimalForValue(t[t.length-1]),n=1===t.length?i:(i-this.getDecimalForValue(t[t.length-2]))/2);const a=t.length<3?.5:.25;s=Vi(s,0,a),n=Vi(n,0,a),this._offsets={start:s,end:n,factor:1/(s+1+n)}}_generate(){const t=this._adapter,e=this.min,i=this.max,s=this.options,n=s.time,a=n.unit||fc(n.minUnit,e,i,this._getLabelCapacity(e)),o=$e(s.ticks.stepSize,1),r="week"===a&&n.isoWeekday,l=Ci(r)||!0===r,h={};let c,d,u=e;if(l&&(u=+t.startOf(u,"isoWeek",r)),u=+t.startOf(u,l?"day":a),t.diff(i,e,a)>1e5*o)throw new Error(e+" and "+i+" are too far apart with stepSize of "+o+" "+a);const g="data"===s.ticks.source&&this.getDataTimestamps();for(c=u,d=0;c<i;c=+t.add(c,o,a),d++)xc(h,c,g);return c!==i&&"ticks"!==s.bounds&&1!==d||xc(h,c,g),Object.keys(h).sort(gc).map(t=>+t)}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 i=this.options,s=i.time.displayFormats,n=this._unit,a=e||s[n];return this._adapter.format(t,a)}_tickFormatFunction(t,e,i,s){const n=this.options,a=n.ticks.callback;if(a)return Xe(a,[t,e,i],this);const o=n.time.displayFormats,r=this._unit,l=this._majorUnit,h=r&&o[r],c=l&&o[l],d=i[e],u=l&&c&&d&&d.major;return this._adapter.format(t,s||(u?c:h))}generateTickLabels(t){let e,i,s;for(e=0,i=t.length;e<i;++e)s=t[e],s.label=this._tickFormatFunction(s.value,e,t)}getDecimalForValue(t){return null===t?NaN:(t-this.min)/(this.max-this.min)}getPixelForValue(t){const e=this._offsets,i=this.getDecimalForValue(t);return this.getPixelForDecimal((e.start+i)*e.factor)}getValueForPixel(t){const e=this._offsets,i=this.getDecimalForPixel(t)/e.factor-e.end;return this.min+i*(this.max-this.min)}_getLabelSize(t){const e=this.options.ticks,i=this.ctx.measureText(t).width,s=Mi(this.isHorizontal()?e.maxRotation:e.minRotation),n=Math.cos(s),a=Math.sin(s),o=this._resolveTickFontOptions(0).size;return{w:i*n+o*a,h:i*a+o*n}}_getLabelCapacity(t){const e=this.options.time,i=e.displayFormats,s=i[e.unit]||i.millisecond,n=this._tickFormatFunction(t,0,_c(this,[t],this._majorUnit),s),a=this._getLabelSize(n),o=Math.floor(this.isHorizontal()?this.width/a.w:this.height/a.h)-1;return o>0?o:1}getDataTimestamps(){let t,e,i=this._cache.data||[];if(i.length)return i;const s=this.getMatchingVisibleMetas();if(this._normalized&&s.length)return this._cache.data=s[0].controller.getAllParsedValues(this);for(t=0,e=s.length;t<e;++t)i=i.concat(s[t].controller.getAllParsedValues(this));return this._cache.data=this.normalize(i)}getLabelTimestamps(){const t=this._cache.labels||[];let e,i;if(t.length)return t;const s=this.getLabels();for(e=0,i=s.length;e<i;++e)t.push(pc(this,s[e]));return this._cache.labels=this._normalized?t:this.normalize(t)}normalize(t){return Hi(t.sort(gc))}}function kc(t,e,i){let s,n,a,o,r=0,l=t.length-1;i?(e>=t[r].pos&&e<=t[l].pos&&({lo:r,hi:l}=Bi(t,"pos",e)),({pos:s,time:a}=t[r]),({pos:n,time:o}=t[l])):(e>=t[r].time&&e<=t[l].time&&({lo:r,hi:l}=Bi(t,"time",e)),({time:s,pos:a}=t[r]),({time:n,pos:o}=t[l]));const h=n-s;return h?a+(o-a)*(e-s)/h:a}(0,jt.A)(vc,"id","time"),(0,jt.A)(vc,"defaults",{bounds:"data",adapters:{},time:{parser:!1,unit:!1,round:!1,isoWeekday:!1,minUnit:"millisecond",displayFormats:{}},ticks:{source:"auto",callback:!1,major:{enabled:!1}}});class wc extends vc{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=kc(e,this.min),this._tableRange=kc(e,this.max)-this._minPos,super.initOffsets(t)}buildLookupTable(t){const{min:e,max:i}=this,s=[],n=[];let a,o,r,l,h;for(a=0,o=t.length;a<o;++a)l=t[a],l>=e&&l<=i&&s.push(l);if(s.length<2)return[{time:e,pos:0},{time:i,pos:1}];for(a=0,o=s.length;a<o;++a)h=s[a+1],r=s[a-1],l=s[a],Math.round((h+r)/2)!==l&&n.push({time:l,pos:a/(o-1)});return n}_generate(){const t=this.min,e=this.max;let i=super.getDataTimestamps();return i.includes(t)&&i.length||i.splice(0,0,t),i.includes(e)&&1!==i.length||i.push(e),i.sort((t,e)=>t-e)}_getTimestampsForTable(){let t=this._cache.all||[];if(t.length)return t;const e=this.getDataTimestamps(),i=this.getLabelTimestamps();return t=e.length&&i.length?this.normalize(e.concat(i)):e.length?e:i,t=this._cache.all=t,t}getDecimalForValue(t){return(kc(this._table,t)-this._minPos)/this._tableRange}getValueForPixel(t){const e=this._offsets,i=this.getDecimalForPixel(t)/e.factor-e.end;return kc(this._table,i*this._tableRange+this._minPos,!0)}}(0,jt.A)(wc,"id","timeseries"),(0,jt.A)(wc,"defaults",vc.defaults);var Cc=i(144);const Sc={data:{type:Object,required:!0},options:{type:Object,default:()=>({})},plugins:{type:Array,default:()=>[]},datasetIdKey:{type:String,default:"label"},updateMode:{type:String,default:void 0}},Fc={ariaLabel:{type:String},ariaDescribedby:{type:String}},Mc={type:{type:String,required:!0},destroyDelay:{type:Number,default:0},...Sc,...Fc},Ac="2"===s.rE[0]?(t,e)=>Object.assign(t,{attrs:e}):(t,e)=>Object.assign(t,e);function Tc(t){return(0,Cc.ju)(t)?(0,Cc.ux)(t):t}function Pc(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t;return(0,Cc.ju)(e)?new Proxy(t,{}):t}function Dc(t,e){const i=t.options;i&&e&&Object.assign(i,e)}function Ec(t,e){t.labels=e}function Lc(t,e,i){const s=[];t.datasets=e.map(e=>{const n=t.datasets.find(t=>t[i]===e[i]);return n&&e.data&&!s.includes(n)?(s.push(n),Object.assign(n,e),n):{...e}})}function Ic(t,e){const i={labels:[],datasets:[]};return Ec(i,t.labels),Lc(i,t.datasets,e),i}const Vc=(0,s.pM)({props:Mc,setup(t,e){let{expose:i,slots:n}=e;const a=(0,Cc.KR)(null),o=(0,Cc.IJ)(null);i({chart:o});const r=()=>{if(!a.value)return;const{type:e,data:i,options:s,plugins:n,datasetIdKey:r}=t,l=Ic(i,r),h=Pc(l,i);o.value=new vl(a.value,{type:e,data:h,options:{...s},plugins:n})},l=()=>{const e=(0,Cc.ux)(o.value);e&&(t.destroyDelay>0?setTimeout(()=>{e.destroy(),o.value=null},t.destroyDelay):(e.destroy(),o.value=null))},h=e=>{e.update(t.updateMode)};return(0,s.sV)(r),(0,s.hi)(l),(0,s.wB)([()=>t.options,()=>t.data],(e,i)=>{let[n,a]=e,[r,l]=i;const c=(0,Cc.ux)(o.value);if(!c)return;let d=!1;if(n){const t=Tc(n),e=Tc(r);t&&t!==e&&(Dc(c,t),d=!0)}if(a){const e=Tc(a.labels),i=Tc(l.labels),s=Tc(a.datasets),n=Tc(l.datasets);e!==i&&(Ec(c.config.data,e),d=!0),s&&s!==n&&(Lc(c.config.data,s,t.datasetIdKey),d=!0)}d&&(0,s.dY)(()=>{h(c)})},{deep:!0}),()=>(0,s.h)("canvas",{role:"img","aria-label":t.ariaLabel,"aria-describedby":t.ariaDescribedby,ref:a},[(0,s.h)("p",{},[n.default?n.default():""])])}});function Oc(t,e){return vl.register(e),(0,s.pM)({props:Sc,setup(e,i){let{expose:n}=i;const a=(0,Cc.IJ)(null),o=t=>{a.value=t?.chart};return n({chart:a}),()=>(0,s.h)(Vc,Ac({ref:o},{type:t,...e}))}})}const Rc=Oc("doughnut",ro);i(6573),i(8100),i(7936),i(9577),i(1549),i(9797),i(9631),i(5623),i(4603),i(7566),i(8721);class Wc extends Error{constructor(t,e,i=!1,s=""){super(t),this.name="BatchOperationError",this.code=e,this.recoverable=i,this.suggestion=s}}const Bc={401:()=>new Wc("认证失败,请重新登录","AUTH_FAILED",!1,"请刷新页面并重新登录"),403:()=>new Wc("权限不足或请求被拒绝","FORBIDDEN",!1,"请确认您有管理员权限"),400:t=>new Wc(`请求数据无效: ${t}`,"INVALID_DATA",!0,"请检查数据格式后重试"),500:()=>new Wc("服务器内部错误","SERVER_ERROR",!0,"请稍后重试,如果问题持续请联系管理员"),NETWORK:()=>new Wc("网络连接失败","NETWORK_ERROR",!0,"请检查网络连接后重试"),ABORT:()=>new Wc("操作已取消","ABORTED",!1,"")};function zc(t,e=""){if("AbortError"===t.name)return Bc.ABORT();if(t instanceof Response||t&&"number"===typeof t.status){const i=Bc[t.status];return i?i(e):new Wc(`请求失败: ${t.status}`,"HTTP_ERROR",!0,"请稍后重试")}return t instanceof TypeError&&t.message.includes("fetch")?Bc.NETWORK():new Wc(t.message||"未知错误","UNKNOWN_ERROR",!0,"请稍后重试")}class Nc{constructor(t={}){this.batchSize=t.batchSize||1e3,this.onProgress=t.onProgress||(()=>{}),this.onError=t.onError||(()=>{}),this.abortController=null}async fetchAllRecords(t=!1){this.abortController=new AbortController;const e=[];let i=null,s=0,n=0;try{do{if(this.abortController.signal.aborted)break;const a=await this.fetchBatch(i,t);e.push(...a.records),i=a.nextCursor,s+=a.records.length,n++,this.onProgress({phase:"fetching",current:s,batchCount:n,message:`已获取 ${s} 条记录...`})}while(i&&!this.abortController.signal.aborted);if(this.abortController.signal.aborted)throw Bc.ABORT();return e}catch(a){const t=a instanceof Wc?a:zc(a);throw this.onError(t),t}}async fetchBatch(t,e){const i=new URLSearchParams;t&&i.set("cursor",t),e&&i.set("includeValue","true"),i.set("limit",String(this.batchSize));try{const t=await(0,Ut.A)(`/api/manage/batch/list?${i}`,{signal:this.abortController.signal});if(!t.ok){let e="";try{const i=await t.json();e=i.error||""}catch{}throw zc(t,e)}const e=await t.json();if(!e.success)throw new Wc(e.error||"请求失败","API_ERROR",!0,"请稍后重试");return{records:e.records||[],nextCursor:e.nextCursor||null,totalProcessed:e.totalProcessed||0}}catch(s){if(s instanceof Wc)throw s;throw zc(s)}}abort(){this.abortController&&this.abortController.abort()}isAborted(){return!!this.abortController&&this.abortController.signal.aborted}reset(){this.abortController=null}}var Uc=Nc;class $c{constructor(t={}){this.chunkSize=t.chunkSize||null,this.maxRetries=t.maxRetries||3,this.retryDelay=t.retryDelay||1e3,this.onProgress=t.onProgress||(()=>{}),this.onError=t.onError||(()=>{}),this.sessionId=this.generateSessionId(),this.aborted=!1}async fetchConfig(){try{const t=await(0,Ut.A)("/api/manage/batch/index/config");if(!t.ok)throw new Error("获取配置失败");const e=await t.json();if(e.success)return{chunkSize:e.chunkSize||500,databaseType:e.databaseType||"unknown"};throw new Error(e.error||"获取配置失败")}catch(t){return console.warn("Failed to fetch index config, using default:",t),{chunkSize:500,databaseType:"unknown"}}}async rebuild(){this.aborted=!1;try{if(!this.chunkSize){const t=await this.fetchConfig();this.chunkSize=t.chunkSize}this.onProgress({phase:"fetching",message:"正在获取数据...",current:0});const t=new Uc({onProgress:t=>this.onProgress({...t,phase:"fetching"}),onError:t=>this.onError(t)}),e=await t.fetchAllRecords(!1);if(this.aborted)throw new Wc("操作已取消","ABORTED",!1,"");if(this.onProgress({phase:"sorting",message:"正在排序...",current:0,total:e.length}),this.sortByTimestampDescending(e),this.aborted)throw new Wc("操作已取消","ABORTED",!1,"");const i=this.splitIntoChunks(e);for(let s=0;s<i.length;s++){if(this.aborted)throw new Wc("操作已取消","ABORTED",!1,"");await this.uploadChunkWithRetry(i[s],s),this.onProgress({phase:"uploading",current:s+1,total:i.length,message:`正在上传分块 ${s+1}/${i.length}...`})}return this.onProgress({phase:"finalizing",message:"正在完成重建...",current:i.length,total:i.length}),await this.finalize(i.length,e.length),this.onProgress({phase:"completed",message:`索引重建完成,共 ${e.length} 个文件`,current:e.length,total:e.length}),{success:!0,totalFiles:e.length}}catch(t){const e=t instanceof Wc?t:new Wc(t.message||"索引重建失败","REBUILD_ERROR",!0,"请稍后重试");throw this.onError(e),e}}sortByTimestampDescending(t){t.sort((t,e)=>{const i=t.metadata&&t.metadata.TimeStamp||0,s=e.metadata&&e.metadata.TimeStamp||0;return s-i})}splitIntoChunks(t){const e=[];for(let i=0;i<t.length;i+=this.chunkSize)e.push(t.slice(i,i+this.chunkSize));return e}async uploadChunkWithRetry(t,e){let i;for(let n=1;n<=this.maxRetries;n++)try{return await this.uploadChunk(t,e)}catch(s){if(i=s,s instanceof Wc&&("AUTH_FAILED"===s.code||"FORBIDDEN"===s.code||"ABORTED"===s.code))throw s;if(n<this.maxRetries){const t=this.retryDelay*Math.pow(2,n-1);await this.sleep(t),this.onProgress({phase:"retrying",message:`分块 ${e+1} 上传失败,正在重试 (${n}/${this.maxRetries})...`,current:e,attempt:n})}}throw i instanceof Wc?i:new Wc(`分块 ${e+1} 上传失败,已重试 ${this.maxRetries}`,"CHUNK_UPLOAD_FAILED",!1,"请检查网络连接后重新开始重建")}async uploadChunk(t,e){const i=await this.calculateChecksum(t);try{const s=await(0,Ut.A)("/api/manage/batch/index/chunk",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({chunkId:String(e),sessionId:this.sessionId,data:t,checksum:i})});if(!s.ok){let t="";try{const e=await s.json();t=e.error||""}catch{}throw this.createHttpError(s.status,t)}const n=await s.json();if(!n.success)throw new Wc(n.error||"分块上传失败","CHUNK_UPLOAD_FAILED",!0,"请稍后重试");return n}catch(s){if(s instanceof Wc)throw s;if(s instanceof TypeError&&s.message.includes("fetch"))throw new Wc("网络连接失败","NETWORK_ERROR",!0,"请检查网络连接后重试");throw new Wc(s.message||"分块上传失败","CHUNK_UPLOAD_FAILED",!0,"请稍后重试")}}async finalize(t,e){try{const i=await(0,Ut.A)("/api/manage/batch/index/finalize",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:this.sessionId,totalChunks:t,totalFiles:e})});if(!i.ok){let t="";try{const e=await i.json();t=e.error||""}catch{}throw this.createHttpError(i.status,t)}const s=await i.json();if(!s.success)throw new Wc(s.error||"索引完成失败","FINALIZE_FAILED",!0,"请稍后重试");return s}catch(i){if(i instanceof Wc)throw i;throw new Wc(i.message||"索引完成失败","FINALIZE_FAILED",!0,"请稍后重试")}}generateSessionId(){return`rebuild_${Date.now()}_${Math.random().toString(36).slice(2)}`}async calculateChecksum(t){const e=JSON.stringify(t),i=new TextEncoder,s=i.encode(e),n=await crypto.subtle.digest("SHA-256",s),a=Array.from(new Uint8Array(n));return a.map(t=>t.toString(16).padStart(2,"0")).join("")}createHttpError(t,e=""){switch(t){case 401:return new Wc("认证失败,请重新登录","AUTH_FAILED",!1,"请刷新页面并重新登录");case 403:return new Wc("权限不足或请求被拒绝","FORBIDDEN",!1,"请确认您有管理员权限");case 400:return new Wc(`请求数据无效: ${e}`,"INVALID_DATA",!0,"请检查数据格式后重试");case 404:return new Wc("会话不存在","SESSION_NOT_FOUND",!1,"请重新开始索引重建");case 410:return new Wc("会话已过期","SESSION_EXPIRED",!1,"请重新开始索引重建");case 500:default:return new Wc(`服务器错误: ${e||t}`,"SERVER_ERROR",!0,"请稍后重试")}}sleep(t){return new Promise(e=>setTimeout(e,t))}abort(){this.aborted=!0}reset(){this.aborted=!1,this.sessionId=this.generateSessionId()}}var jc=$c;class Hc{constructor(t={}){this.onProgress=t.onProgress||(()=>{}),this.processor=null}async generateBackup(){this.processor=new Uc({onProgress:t=>this.onProgress({...t,phase:"fetching"})});const t=await this.processor.fetchAllRecords(!0);this.onProgress({phase:"building",message:"正在构建备份数据..."});const e={timestamp:Date.now(),version:$t.rE,data:{fileCount:t.length,files:{},settings:{}}};for(const n of t)e.data.files[n.id]={metadata:n.metadata,value:n.value||null};const i=await this.fetchSettings();e.data.settings=i,this.onProgress({phase:"downloading",message:"正在生成下载..."}),this.downloadBackup(e);const s=Object.keys(i).length;return{success:!0,fileCount:t.length,settingsCount:s}}async fetchSettings(){try{const t=await(0,Ut.A)("/api/manage/batch/settings");if(!t.ok)return console.warn("Failed to fetch settings:",t.status),{};const e=await t.json();return e.settings||{}}catch(t){return console.warn("Failed to fetch settings:",t),{}}}downloadBackup(t){const e=JSON.stringify(t,null,2),i=new Blob([e],{type:"application/json"}),s=URL.createObjectURL(i),n=document.createElement("a");n.href=s,n.download=`imgbed_backup_${(new Date).toISOString().split("T")[0]}.json`,document.body.appendChild(n),n.click(),document.body.removeChild(n),URL.revokeObjectURL(s)}abort(){this.processor&&this.processor.abort()}isAborted(){return!!this.processor&&this.processor.isAborted()}}var Xc=Hc;class qc{constructor(t={}){this.chunkSize=t.chunkSize||50,this.maxRetries=t.maxRetries||3,this.retryDelay=t.retryDelay||1e3,this.onProgress=t.onProgress||(()=>{}),this.onError=t.onError||(()=>{}),this.aborted=!1}async restore(t){if(this.aborted=!1,!t||!t.data)throw new Wc("备份文件格式无效","INVALID_BACKUP",!1,"请选择有效的备份文件");const{files:e={},settings:i={}}=t.data,s=Object.entries(e),n=Object.entries(i),a=s.length,o=n.length,r=a+o;let l=0,h=0,c=0,d=0;try{this.onProgress({phase:"restoring_files",message:"正在恢复文件数据...",current:0,total:r});const e=this.splitIntoChunks(s,this.chunkSize);for(let t=0;t<e.length;t++){if(this.aborted)throw new Wc("操作已取消","ABORTED",!1,"");const i=e[t],s=Object.fromEntries(i),n=await this.uploadChunkWithRetry("files",s);l+=n.restoredCount,c+=n.failedCount,this.onProgress({phase:"restoring_files",message:`正在恢复文件数据 ${l}/${a}...`,current:l,total:r,percentage:l/r*80})}this.onProgress({phase:"restoring_settings",message:"正在恢复系统设置...",current:l,total:r});const i=this.splitIntoChunks(n,this.chunkSize);for(let t=0;t<i.length;t++){if(this.aborted)throw new Wc("操作已取消","ABORTED",!1,"");const e=i[t],s=Object.fromEntries(e),n=await this.uploadChunkWithRetry("settings",s);h+=n.restoredCount,d+=n.failedCount,this.onProgress({phase:"restoring_settings",message:`正在恢复系统设置 ${h}/${o}...`,current:l+h,total:r,percentage:80+h/o*20})}return this.onProgress({phase:"completed",message:"恢复完成",current:r,total:r,percentage:100}),{success:!0,restoredFiles:l,restoredSettings:h,failedFiles:c,failedSettings:d,backupTimestamp:t.timestamp}}catch(u){const t=u instanceof Wc?u:new Wc(u.message||"恢复失败","RESTORE_ERROR",!0,"请稍后重试");throw this.onError(t),t}}splitIntoChunks(t,e){const i=[];for(let s=0;s<t.length;s+=e)i.push(t.slice(s,s+e));return i}async uploadChunkWithRetry(t,e){let i;for(let n=1;n<=this.maxRetries;n++)try{return await this.uploadChunk(t,e)}catch(s){if(i=s,s instanceof Wc&&("AUTH_FAILED"===s.code||"FORBIDDEN"===s.code||"ABORTED"===s.code))throw s;if(n<this.maxRetries){const t=this.retryDelay*Math.pow(2,n-1);await this.sleep(t)}}throw i}async uploadChunk(t,e){try{const i=await(0,Ut.A)("/api/manage/batch/restore/chunk",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:t,data:e})});if(!i.ok){let t="";try{const e=await i.json();t=e.error||""}catch{}throw this.createHttpError(i.status,t)}const s=await i.json();if(!s.success)throw new Wc(s.error||"恢复分块失败","CHUNK_RESTORE_FAILED",!0,"请稍后重试");return s}catch(i){if(i instanceof Wc)throw i;if(i instanceof TypeError&&i.message.includes("fetch"))throw new Wc("网络连接失败","NETWORK_ERROR",!0,"请检查网络连接后重试");throw new Wc(i.message||"恢复分块失败","CHUNK_RESTORE_FAILED",!0,"请稍后重试")}}createHttpError(t,e=""){switch(t){case 401:return new Wc("认证失败,请重新登录","AUTH_FAILED",!1,"请刷新页面并重新登录");case 403:return new Wc("权限不足或请求被拒绝","FORBIDDEN",!1,"请确认您有管理员权限");case 400:return new Wc(`请求数据无效: ${e}`,"INVALID_DATA",!0,"请检查备份文件格式");case 500:default:return new Wc(`服务器错误: ${e||t}`,"SERVER_ERROR",!0,"请稍后重试")}}sleep(t){return new Promise(e=>setTimeout(e,t))}abort(){this.aborted=!0}}var Kc=qc;vl.register(Dl,Dh,dh);var Yc={name:"SysCogStatus",components:{Doughnut:Rc},data(){return{loading:!1,rebuilding:!1,backing:!1,restoring:!1,indexInfo:{},version:$t.rE,loadErrors:{newest:!1,oldest:!1},channelColors:["#8B5CF6","#EC4899","#06B6D4","#10B981","#F59E0B","#EF4444","#6366F1","#84CC16"],typeColors:["#10B981","#3B82F6","#F59E0B","#EF4444","#8B5CF6","#EC4899","#06B6D4","#84CC16"],isProcessing:!1,processingPhase:"",processingProgress:{current:0,total:0,message:"",percentage:0},processingError:null,processingStartTime:null,currentRebuilder:null,currentBackupGenerator:null,currentRestoreProcessor:null}},computed:{channelChartData(){const t=this.indexInfo.channelStats||{};return{labels:Object.keys(t),datasets:[{data:Object.values(t),backgroundColor:this.channelColors.slice(0,Object.keys(t).length),borderWidth:0}]}},typeChartData(){const t=this.aggregatedTypeStats;return{labels:Object.keys(t),datasets:[{data:Object.values(t),backgroundColor:this.typeColors.slice(0,Object.keys(t).length),borderWidth:0}]}},aggregatedTypeStats(){const t=this.indexInfo.typeStats||{},e={};for(const[i,s]of Object.entries(t)){const t="Block"===i?"已屏蔽":"正常";e[t]=(e[t]||0)+s}return e},chartOptions(){return{responsive:!0,maintainAspectRatio:!0,cutout:"65%",hoverOffset:8,layout:{padding:10},plugins:{legend:{display:!1},tooltip:{backgroundColor:"rgba(0, 0, 0, 0.8)",titleColor:"#fff",bodyColor:"#fff",padding:12,cornerRadius:8,displayColors:!0,z:100,callbacks:{label:t=>{const e=t.raw,i=t.dataset.data.reduce((t,e)=>t+e,0),s=(e/i*100).toFixed(1);return` ${e.toLocaleString()} (${s}%)`}}}},animation:{animateRotate:!0,animateScale:!0}}},estimatedTimeRemaining(){if(!this.isProcessing||!this.processingStartTime)return"";if(0===this.processingProgress.current||0===this.processingProgress.percentage)return"";const t=Date.now()-this.processingStartTime,e=this.processingProgress.percentage/100;if(e<=0)return"";const i=t/e,s=i-t;if(s<=0)return"即将完成";const n=Math.ceil(s/1e3);if(n<60)return`${n}`;const a=Math.ceil(n/60);if(a<60)return`${a} 分钟`;const o=Math.floor(a/60),r=a%60;return`${o} 小时 ${r} 分钟`},phaseDescription(){const t={fetching:"正在获取数据",sorting:"正在排序",uploading:"正在上传",finalizing:"正在完成",building:"正在构建备份",downloading:"正在生成下载",restoring_files:"正在恢复文件",restoring_settings:"正在恢复设置",completed:"已完成",retrying:"正在重试"};return t[this.processingPhase]||this.processingPhase}},mounted(){this.fetchIndexInfo()},methods:{getChartColor(t){return this.channelColors[t%this.channelColors.length]},getTypeChartColor(t){return this.typeColors[t%this.typeColors.length]},async fetchIndexInfo(){this.loading=!0;try{const t=await(0,Ut.A)("/api/manage/list?action=info",{method:"GET"});if(!t.ok)throw new Error("API请求失败");{const e=await t.json();this.indexInfo=e}}catch(t){console.error("获取索引信息失败:",t),this.$message.error("获取索引信息失败")}finally{this.loading=!1}},async rebuildIndex(){if(this.isProcessing)this.$message.warning("已有操作正在进行中");else{this.rebuilding=!0,this.isProcessing=!0,this.processingError=null,this.processingStartTime=Date.now(),this.processingProgress={current:0,total:0,message:"",percentage:0},this.currentRebuilder=new jc({onProgress:t=>this.handleProgress(t),onError:t=>this.handleError(t)});try{const t=await this.currentRebuilder.rebuild();this.$message.success(`索引重建完成!共处理 ${t.totalFiles.toLocaleString()} 个文件`),setTimeout(()=>{this.fetchIndexInfo()},1e3)}catch(t){if("ABORTED"!==t.code){const e=t.suggestion?`${t.message}${t.suggestion}`:t.message;this.$message.error(e),this.processingError={message:t.message,suggestion:t.suggestion,recoverable:t.recoverable}}}finally{this.rebuilding=!1,this.isProcessing=!1,this.currentRebuilder=null,this.processingStartTime=null}}},async backupData(){if(this.isProcessing)this.$message.warning("已有操作正在进行中");else{this.backing=!0,this.isProcessing=!0,this.processingError=null,this.processingStartTime=Date.now(),this.processingProgress={current:0,total:0,message:"",percentage:0},this.currentBackupGenerator=new Xc({onProgress:t=>this.handleProgress(t)});try{const t=await this.currentBackupGenerator.generateBackup(),e=t.settingsCount>0?`${t.settingsCount} 个设置项`:"";this.$message.success(`备份完成!共备份 ${t.fileCount.toLocaleString()} 个文件${e}`)}catch(t){if("ABORTED"!==t.code){const e=t.suggestion?`${t.message}${t.suggestion}`:t.message;this.$message.error(e),this.processingError={message:t.message,suggestion:t.suggestion,recoverable:t.recoverable}}}finally{this.backing=!1,this.isProcessing=!1,this.currentBackupGenerator=null,this.processingStartTime=null}}},selectRestoreFile(){this.restoring||this.$refs.fileInput.click()},async handleFileSelect(t){const e=t.target.files[0];if(e)if(e.name.endsWith(".json")){try{await this.$confirm("恢复操作将覆盖现有的文件元数据和系统设置,此操作不可逆。确定要继续吗?","确认恢复",{confirmButtonText:"确定恢复",cancelButtonText:"取消",type:"warning"}),await this.restoreData(e)}catch(i){"cancel"!==i&&console.error("确认恢复失败:",i)}t.target.value=""}else this.$message.error("请选择JSON格式的备份文件")},async restoreData(t){if(this.isProcessing)this.$message.warning("已有操作正在进行中");else{this.restoring=!0,this.isProcessing=!0,this.processingError=null,this.processingStartTime=Date.now(),this.processingProgress={current:0,total:0,message:"",percentage:0};try{const i=await t.text();let s;try{s=JSON.parse(i)}catch(e){throw new Error("备份文件格式无效,请选择有效的 JSON 文件")}this.currentRestoreProcessor=new Kc({chunkSize:100,onProgress:t=>this.handleProgress(t),onError:t=>this.handleError(t)});const n=await this.currentRestoreProcessor.restore(s);this.restoring=!1,this.isProcessing=!1,this.currentRestoreProcessor=null,this.processingStartTime=null,this.$message.success(`恢复完成!已恢复 ${n.restoredFiles} 个文件和 ${n.restoredSettings} 个设置项,正在重建索引...`),await new Promise(t=>setTimeout(t,500)),await this.rebuildIndex()}catch(i){if(console.error("恢复数据失败:",i),this.restoring=!1,this.isProcessing=!1,this.currentRestoreProcessor=null,this.processingStartTime=null,"ABORTED"!==i.code){const t=i.suggestion?`${i.message}${i.suggestion}`:i.message;this.$message.error("恢复数据失败: "+t),this.processingError={message:i.message,suggestion:i.suggestion,recoverable:i.recoverable}}}}},formatTime(t){if(!t)return"未知";const e=new Date(t);return e.toLocaleString("zh-CN",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"})},getPercentage(t,e){return e&&0!==e?Math.round(t/e*100):0},getTimeAgo(t){if(!t)return"";const e=Date.now(),i=e-t,s=Math.floor(i/6e4),n=Math.floor(i/36e5),a=Math.floor(i/864e5);return a>0?`${a}天前`:n>0?`${n}小时前`:s>0?`${s}分钟前`:"刚刚"},handleImageError(t){this.loadErrors[t]=!0},isValidPreview(t,e){return!this.loadErrors[t]&&(!!e?.metadata?.FileType&&(e.metadata.FileType.includes("image")||e.metadata.FileType.includes("video")))},openReleases(){window.open("https://github.com/MarSeventh/CloudFlare-ImgBed/releases","_blank")},isImageFile(t){if(!t)return!1;if(t.metadata?.FileType?.includes("image"))return!0;const e=t.metadata?.FileName||t.id||"",i=e.substring(e.lastIndexOf(".")+1).toLowerCase(),s=["jpg","jpeg","png","gif","bmp","webp","svg","ico","tiff","tif","avif","heic","heif"];return s.includes(i)},isVideoFile(t){if(!t)return!1;if(t.metadata?.FileType?.includes("video"))return!0;const e=t.metadata?.FileName||t.id||"",i=e.substring(e.lastIndexOf(".")+1).toLowerCase(),s=["mp4","webm","ogg","avi","mov","flv","wmv","mkv","m4v","3gp","mpeg","mpg"];return s.includes(i)},openFileInNewTab(t){t?.id&&window.open("/file/"+t.id,"_blank")},handleProgress(t){this.processingPhase=t.phase,this.processingProgress.message=t.message||"",this.processingProgress.current=t.current||0,"fetching"===t.phase?(this.processingProgress.total=t.total||0,t.total&&t.total>0?this.processingProgress.percentage=Math.min(60,t.current/t.total*60):this.processingProgress.percentage=Math.min(50,15*Math.log10(t.current+1))):"sorting"===t.phase?(this.processingProgress.percentage=65,this.processingProgress.total=t.total||this.processingProgress.total):"uploading"===t.phase?(this.processingProgress.total=t.total||0,t.total&&t.total>0&&(this.processingProgress.percentage=70+t.current/t.total*25)):"finalizing"===t.phase?this.processingProgress.percentage=97:"building"===t.phase?this.processingProgress.percentage=80:"downloading"===t.phase?this.processingProgress.percentage=95:"restoring_files"===t.phase?(this.processingProgress.total=t.total||0,this.processingProgress.percentage=t.percentage||0):"restoring_settings"===t.phase?(this.processingProgress.total=t.total||0,this.processingProgress.percentage=t.percentage||80):"completed"===t.phase?this.processingProgress.percentage=100:"retrying"===t.phase&&(this.processingProgress.message=t.message)},handleError(t){console.error("批量操作错误:",t),this.processingError={message:t.message,suggestion:t.suggestion,recoverable:t.recoverable}},cancelOperation(){this.currentRebuilder&&(this.currentRebuilder.abort(),this.$message.info("正在取消索引重建...")),this.currentBackupGenerator&&(this.currentBackupGenerator.abort(),this.$message.info("正在取消备份...")),this.currentRestoreProcessor&&(this.currentRestoreProcessor.abort(),this.$message.info("正在取消恢复..."))},retryOperation(){this.processingError=null,this.rebuilding?(this.rebuilding=!1,this.isProcessing=!1,this.$nextTick(()=>{this.rebuildIndex()})):this.backing&&(this.backing=!1,this.isProcessing=!1,this.$nextTick(()=>{this.backupData()}))},dismissError(){this.processingError=null}}};const Qc=(0,c.A)(Yc,[["render",Nt],["__scopeId","data-v-68ed43d0"]]);var Gc=Qc,Jc=i(9869),Zc=(i(415),i(3565),i(9267)),td=(i(5616),i(2006)),ed=i(1418),id=(i(333),i(9623)),sd=(i(6711),i(6018)),nd=(i(6808),i(200),i(5558)),ad=(i(8075),i(2687)),od=(i(8785),i(5130));const rd=["onClick"];function ld(t,e,i,a,o,r){const l=(0,s.g2)("font-awesome-icon");return(0,s.uX)(),(0,s.CE)("div",{class:(0,n.C4)(["custom-select",{"is-open":o.isOpen}]),style:(0,n.Tr)({width:i.width})},[(0,s.Lk)("div",{class:"custom-select-trigger",onClick:e[0]||(e[0]=(...t)=>r.toggleDropdown&&r.toggleDropdown(...t))},[(0,s.Lk)("span",{class:(0,n.C4)(["custom-select-value",{"is-placeholder":!i.modelValue}])},(0,n.v_)(r.displayLabel),3),(0,s.bF)(l,{icon:"chevron-down",class:"custom-select-arrow"})]),(0,s.bF)(od.eB,{name:"dropdown-fade"},{default:(0,s.k6)(()=>[(0,s.bo)((0,s.Lk)("div",{class:"custom-select-dropdown",onClick:e[1]||(e[1]=(0,od.D$)(()=>{},["stop"]))},[((0,s.uX)(!0),(0,s.CE)(s.FK,null,(0,s.pI)(i.options,e=>((0,s.uX)(),(0,s.CE)("div",{key:e.value,class:(0,n.C4)(["custom-select-option",{"is-selected":i.modelValue===e.value}]),onClick:t=>r.selectOption(e.value)},[(0,s.RG)(t.$slots,"option",{option:e},()=>[e.icon?((0,s.uX)(),(0,s.Wv)(l,{key:0,icon:e.icon,class:"option-icon"},null,8,["icon"])):(0,s.Q3)("",!0),(0,s.Lk)("span",null,(0,n.v_)(e.label),1)],!0)],10,rd))),128))],512),[[od.aG,o.isOpen]])]),_:3})],6)}var hd={name:"CustomSelect",props:{modelValue:{type:[String,Number],default:""},options:{type:Array,required:!0},placeholder:{type:String,default:"请选择"},width:{type:String,default:"160px"}},emits:["update:modelValue","change"],data(){return{isOpen:!1}},computed:{displayLabel(){const t=this.options.find(t=>t.value===this.modelValue);return t?t.label:this.placeholder}},mounted(){document.addEventListener("click",this.handleClickOutside)},beforeUnmount(){document.removeEventListener("click",this.handleClickOutside)},methods:{toggleDropdown(){this.isOpen=!this.isOpen},selectOption(t){this.$emit("update:modelValue",t),this.$emit("change",t),this.isOpen=!1},handleClickOutside(t){this.$el.contains(t.target)||(this.isOpen=!1)}}};const cd=(0,c.A)(hd,[["render",ld],["__scopeId","data-v-6c59d112"]]);var dd=cd;const ud={class:"upload-settings"},gd={class:"page-header"},pd={class:"first-title"},fd={class:"header-actions"},md={class:"group-header"},bd={class:"group-title"},xd={key:0,class:"load-balance-switch"},yd={key:0,class:"channel-cards"},_d=["onMousemove","onMouseleave"],vd={class:"card-header"},kd={class:"card-title"},wd={class:"channel-name"},Cd={class:"card-body"},Sd={class:"card-info"},Fd={class:"info-item"},Md={class:"info-text"},Ad={key:0,class:"info-item"},Td={class:"info-text"},Pd={key:1,class:"info-item"},Dd=["title"],Ed={class:"info-item"},Ld={class:"info-text"},Id={key:0,class:"info-item"},Vd=["title"],Od={class:"info-item"},Rd={class:"info-text"},Wd={class:"info-item"},Bd={class:"info-text"},zd={class:"info-item"},Nd={class:"info-text"},Ud={key:0,class:"quota-mini"},$d={class:"quota-text"},jd={class:"card-actions"},Hd={key:1,class:"empty-tip"},Xd={class:"form-warning"},qd={class:"quota-label"},Kd={class:"quota-status"};function Yd(t,e,i,a,o,r){const l=(0,s.g2)("font-awesome-icon"),h=p.R7,c=dd,d=k.S2,u=ad.u,g=nd.qi,f=w.ve,m=sd.P9,b=sd.AV,x=td.xE,y=id.WK,v=ed.lq,C=td.US,S=Zc.kZ,F=Jc.MF,M=Jc.TS,A=_.A;return(0,s.bo)(((0,s.uX)(),(0,s.CE)("div",ud,[(0,s.Lk)("div",gd,[(0,s.Lk)("h3",pd,[e[59]||(e[59]=(0,s.eW)(" 上传渠道管理 ",-1)),(0,s.bF)(h,{content:"管理所有上传渠道的配置,点击卡片查看详情或编辑",placement:"right"},{default:(0,s.k6)(()=>[(0,s.bF)(l,{icon:"question-circle",class:"help-icon"})]),_:1})]),(0,s.Lk)("div",fd,[(0,s.bF)(c,{modelValue:o.channelFilter,"onUpdate:modelValue":e[0]||(e[0]=t=>o.channelFilter=t),options:r.filterOptions,placeholder:"筛选渠道类型",width:"160px"},null,8,["modelValue","options"]),(0,s.bF)(d,{type:"primary",onClick:e[1]||(e[1]=t=>o.showAddDialog=!0),class:"add-btn"},{default:(0,s.k6)(()=>[(0,s.bF)(l,{icon:"plus",style:{"margin-right":"6px"}}),e[60]||(e[60]=(0,s.eW)(" 添加渠道 ",-1))]),_:1})])]),((0,s.uX)(!0),(0,s.CE)(s.FK,null,(0,s.pI)(r.filteredChannels,t=>((0,s.uX)(),(0,s.CE)("div",{key:t.value,class:"channel-group"},[(0,s.Lk)("div",md,[(0,s.Lk)("div",bd,[(0,s.bF)(l,{icon:r.getChannelIcon(t.value),class:"group-icon"},null,8,["icon"]),(0,s.Lk)("span",null,(0,n.v_)(t.label),1),(0,s.bF)(u,{size:"small",type:"info",class:"channel-count"},{default:(0,s.k6)(()=>[(0,s.eW)((0,n.v_)(r.getChannelList(t.value).length),1)]),_:2},1024)]),r.hasLoadBalance(t.value)?((0,s.uX)(),(0,s.CE)("div",xd,[e[61]||(e[61]=(0,s.Lk)("span",{class:"switch-label"},"负载均衡",-1)),(0,s.bF)(g,{modelValue:r.getSettings(t.value).loadBalance.enabled,"onUpdate:modelValue":e=>r.getSettings(t.value).loadBalance.enabled=e,size:"small",onChange:r.saveSettings},null,8,["modelValue","onUpdate:modelValue","onChange"])])):(0,s.Q3)("",!0)]),r.getChannelList(t.value).length>0?((0,s.uX)(),(0,s.CE)("div",yd,[((0,s.uX)(!0),(0,s.CE)(s.FK,null,(0,s.pI)(r.getChannelList(t.value),(i,a)=>((0,s.uX)(),(0,s.CE)("div",{key:i.name||a,class:(0,n.C4)(["channel-card",[t.value,{disabled:!i.enabled,fixed:i.fixed}]]),onMousemove:e=>r.handleCardMouseMove(e,t.value,a),onMouseleave:e=>r.handleCardMouseLeave(t.value,a)},[(0,s.Lk)("div",{class:"card-glow",ref_for:!0,ref:`glow-${t.value}-${a}`},null,512),(0,s.Lk)("div",vd,[(0,s.Lk)("div",kd,[(0,s.Lk)("span",wd,(0,n.v_)(i.name||"未命名渠道"),1),i.fixed?((0,s.uX)(),(0,s.Wv)(u,{key:0,size:"small",type:"warning"},{default:(0,s.k6)(()=>[...e[62]||(e[62]=[(0,s.eW)("环境变量",-1)])]),_:1})):(0,s.Q3)("",!0)]),(0,s.bF)(g,{modelValue:i.enabled,"onUpdate:modelValue":t=>i.enabled=t,size:"small",onClick:e[2]||(e[2]=(0,od.D$)(()=>{},["stop"])),onChange:r.saveSettings},null,8,["modelValue","onUpdate:modelValue","onChange"])]),(0,s.Lk)("div",Cd,[(0,s.Lk)("div",Sd,["telegram"===t.value?((0,s.uX)(),(0,s.CE)(s.FK,{key:0},[(0,s.Lk)("div",Fd,[(0,s.bF)(l,{icon:"robot",class:"info-icon"}),(0,s.Lk)("span",Md,"Bot: "+(0,n.v_)(r.maskText(i.botToken)),1)]),i.chatId?((0,s.uX)(),(0,s.CE)("div",Ad,[(0,s.bF)(l,{icon:"comments",class:"info-icon"}),(0,s.Lk)("span",Td,"Channel: "+(0,n.v_)(r.maskText(i.chatId)),1)])):(0,s.Q3)("",!0)],64)):"cfr2"===t.value?((0,s.uX)(),(0,s.CE)("div",Pd,[(0,s.bF)(l,{icon:"link",class:"info-icon"}),(0,s.Lk)("span",{class:"info-text",title:i.publicUrl},(0,n.v_)(i.publicUrl||"未设置公开链接"),9,Dd)])):"s3"===t.value?((0,s.uX)(),(0,s.CE)(s.FK,{key:2},[(0,s.Lk)("div",Ed,[(0,s.bF)(l,{icon:"server",class:"info-icon"}),(0,s.Lk)("span",Ld,(0,n.v_)(i.bucketName||"未设置"),1)]),i.endpoint?((0,s.uX)(),(0,s.CE)("div",Id,[(0,s.bF)(l,{icon:"link",class:"info-icon"}),(0,s.Lk)("span",{class:"info-text",title:i.endpoint},(0,n.v_)(i.endpoint),9,Vd)])):(0,s.Q3)("",!0)],64)):"discord"===t.value?((0,s.uX)(),(0,s.CE)(s.FK,{key:3},[(0,s.Lk)("div",Od,[(0,s.bF)(l,{icon:"robot",class:"info-icon"}),(0,s.Lk)("span",Rd,"Bot: "+(0,n.v_)(r.maskText(i.botToken)),1)]),(0,s.Lk)("div",Wd,[(0,s.bF)(l,{icon:"hashtag",class:"info-icon"}),(0,s.Lk)("span",Bd,"Channel: "+(0,n.v_)(r.maskText(i.channelId)),1)]),i.isNitro?((0,s.uX)(),(0,s.Wv)(u,{key:0,size:"small",type:"success"},{default:(0,s.k6)(()=>[...e[63]||(e[63]=[(0,s.eW)("Nitro",-1)])]),_:1})):(0,s.Q3)("",!0)],64)):"huggingface"===t.value?((0,s.uX)(),(0,s.CE)(s.FK,{key:4},[(0,s.Lk)("div",zd,[(0,s.bF)(l,{icon:"database",class:"info-icon"}),(0,s.Lk)("span",Nd,(0,n.v_)(i.repo||"未设置仓库"),1)]),i.isPrivate?((0,s.uX)(),(0,s.Wv)(u,{key:0,size:"small",type:"warning"},{default:(0,s.k6)(()=>[...e[64]||(e[64]=[(0,s.eW)("私有",-1)])]),_:1})):(0,s.Q3)("",!0)],64)):(0,s.Q3)("",!0)]),i.quota?.enabled?((0,s.uX)(),(0,s.CE)("div",Ud,[(0,s.bF)(f,{percentage:r.getQuotaPercentage(i),status:r.getQuotaStatus(i),"stroke-width":6},null,8,["percentage","status"]),(0,s.Lk)("span",$d,(0,n.v_)(r.getQuotaText(i)),1)])):(0,s.Q3)("",!0)]),(0,s.Lk)("div",jd,[(0,s.bF)(d,{text:"",type:"primary",size:"small",onClick:e=>r.openDetailDialog(t.value,a)},{default:(0,s.k6)(()=>[(0,s.bF)(l,{icon:"eye",style:{"margin-right":"4px"}}),e[65]||(e[65]=(0,s.eW)("详情 ",-1))]),_:1},8,["onClick"]),(0,s.bF)(d,{text:"",type:"primary",size:"small",onClick:e=>r.openEditDialog(t.value,a)},{default:(0,s.k6)(()=>[(0,s.bF)(l,{icon:"edit",style:{"margin-right":"4px"}}),e[66]||(e[66]=(0,s.eW)("编辑 ",-1))]),_:1},8,["onClick"]),(0,s.bF)(d,{text:"",type:"danger",size:"small",onClick:e=>r.deleteChannel(t.value,a),disabled:i.fixed},{default:(0,s.k6)(()=>[(0,s.bF)(l,{icon:"trash-alt",style:{"margin-right":"4px"}}),e[67]||(e[67]=(0,s.eW)("删除 ",-1))]),_:1},8,["onClick","disabled"])])],42,_d))),128))])):((0,s.uX)(),(0,s.CE)("div",Hd,[(0,s.bF)(l,{icon:"inbox",class:"empty-icon"}),(0,s.Lk)("span",null,"暂无 "+(0,n.v_)(t.label)+" 渠道",1)]))]))),128)),(0,s.bF)(S,{modelValue:o.showAddDialog,"onUpdate:modelValue":e[26]||(e[26]=t=>o.showAddDialog=t),title:"添加新渠道",class:"channel-dialog","destroy-on-close":"",onClosed:r.resetAddForm},{footer:(0,s.k6)(()=>[(0,s.bF)(d,{onClick:e[25]||(e[25]=t=>o.showAddDialog=!1)},{default:(0,s.k6)(()=>[...e[73]||(e[73]=[(0,s.eW)("取消",-1)])]),_:1}),(0,s.bF)(d,{type:"primary",onClick:r.confirmAddChannel},{default:(0,s.k6)(()=>[...e[74]||(e[74]=[(0,s.eW)("确认添加",-1)])]),_:1},8,["onClick"])]),default:(0,s.k6)(()=>[(0,s.bF)(C,{model:o.newChannel,"label-position":"top",ref:"addForm",rules:o.addRules},{default:(0,s.k6)(()=>[(0,s.bF)(x,{label:"渠道类型",prop:"type"},{default:(0,s.k6)(()=>[(0,s.bF)(b,{modelValue:o.newChannel.type,"onUpdate:modelValue":e[3]||(e[3]=t=>o.newChannel.type=t),placeholder:"请选择渠道类型",style:{width:"100%"},onChange:r.onChannelTypeChange},{default:(0,s.k6)(()=>[((0,s.uX)(!0),(0,s.CE)(s.FK,null,(0,s.pI)(o.addableChannels,t=>((0,s.uX)(),(0,s.Wv)(m,{key:t.value,label:t.label,value:t.value},{default:(0,s.k6)(()=>[(0,s.bF)(l,{icon:r.getChannelIcon(t.value),class:"select-option-icon"},null,8,["icon"]),(0,s.eW)(" "+(0,n.v_)(t.label),1)]),_:2},1032,["label","value"]))),128))]),_:1},8,["modelValue","onChange"])]),_:1}),(0,s.bF)(x,{label:"渠道名称",prop:"name"},{default:(0,s.k6)(()=>[(0,s.bF)(y,{modelValue:o.newChannel.name,"onUpdate:modelValue":e[4]||(e[4]=t=>o.newChannel.name=t),placeholder:"请输入渠道名称"},null,8,["modelValue"])]),_:1}),"telegram"===o.newChannel.type?((0,s.uX)(),(0,s.CE)(s.FK,{key:0},[(0,s.bF)(x,{label:"Bot Token",prop:"botToken"},{default:(0,s.k6)(()=>[(0,s.bF)(y,{modelValue:o.newChannel.botToken,"onUpdate:modelValue":e[5]||(e[5]=t=>o.newChannel.botToken=t),type:"password","show-password":"",placeholder:"请输入 Bot Token"},null,8,["modelValue"])]),_:1}),(0,s.bF)(x,{label:"Chat ID",prop:"chatId"},{default:(0,s.k6)(()=>[(0,s.bF)(y,{modelValue:o.newChannel.chatId,"onUpdate:modelValue":e[6]||(e[6]=t=>o.newChannel.chatId=t),type:"password","show-password":"",placeholder:"请输入 Chat ID"},null,8,["modelValue"])]),_:1}),(0,s.bF)(x,{label:"代理域名"},{default:(0,s.k6)(()=>[(0,s.bF)(y,{modelValue:o.newChannel.proxyUrl,"onUpdate:modelValue":e[7]||(e[7]=t=>o.newChannel.proxyUrl=t),placeholder:"可选,例如: your-proxy.example.com"},null,8,["modelValue"])]),_:1})],64)):"s3"===o.newChannel.type?((0,s.uX)(),(0,s.CE)(s.FK,{key:1},[(0,s.bF)(x,{label:"Endpoint",prop:"endpoint"},{default:(0,s.k6)(()=>[(0,s.bF)(y,{modelValue:o.newChannel.endpoint,"onUpdate:modelValue":e[8]||(e[8]=t=>o.newChannel.endpoint=t),placeholder:"例如: https://s3.us-east-005.backblazeb2.com"},null,8,["modelValue"])]),_:1}),(0,s.bF)(x,{label:"CDN 域名"},{default:(0,s.k6)(()=>[(0,s.bF)(y,{modelValue:o.newChannel.cdnDomain,"onUpdate:modelValue":e[9]||(e[9]=t=>o.newChannel.cdnDomain=t),placeholder:"如果有 CDN请配置 CDN 域名例如https://cdn.example.com"},null,8,["modelValue"]),e[68]||(e[68]=(0,s.Lk)("span",{class:"form-tip"},"可选配置。配置后将优先通过 CDN 读取文件,提高访问速度和降低成本",-1))]),_:1}),(0,s.bF)(x,{label:"存储桶名称",prop:"bucketName"},{default:(0,s.k6)(()=>[(0,s.bF)(y,{modelValue:o.newChannel.bucketName,"onUpdate:modelValue":e[10]||(e[10]=t=>o.newChannel.bucketName=t),placeholder:"请输入存储桶名称"},null,8,["modelValue"])]),_:1}),(0,s.bF)(x,{label:"存储桶区域",prop:"region"},{default:(0,s.k6)(()=>[(0,s.bF)(y,{modelValue:o.newChannel.region,"onUpdate:modelValue":e[11]||(e[11]=t=>o.newChannel.region=t),placeholder:"默认填写 auto"},null,8,["modelValue"])]),_:1}),(0,s.bF)(x,{label:"访问密钥 ID",prop:"accessKeyId"},{default:(0,s.k6)(()=>[(0,s.bF)(y,{modelValue:o.newChannel.accessKeyId,"onUpdate:modelValue":e[12]||(e[12]=t=>o.newChannel.accessKeyId=t),type:"password","show-password":"",placeholder:"请输入访问密钥 ID"},null,8,["modelValue"])]),_:1}),(0,s.bF)(x,{label:"机密访问密钥",prop:"secretAccessKey"},{default:(0,s.k6)(()=>[(0,s.bF)(y,{modelValue:o.newChannel.secretAccessKey,"onUpdate:modelValue":e[13]||(e[13]=t=>o.newChannel.secretAccessKey=t),type:"password","show-password":"",placeholder:"请输入机密访问密钥"},null,8,["modelValue"])]),_:1}),(0,s.bF)(x,{label:"路径风格"},{default:(0,s.k6)(()=>[(0,s.bF)(g,{modelValue:o.newChannel.pathStyle,"onUpdate:modelValue":e[14]||(e[14]=t=>o.newChannel.pathStyle=t)},null,8,["modelValue"]),e[69]||(e[69]=(0,s.Lk)("span",{class:"form-tip"},"使用 OpenList 时需开启",-1))]),_:1}),(0,s.bF)(x,{label:"容量限制"},{default:(0,s.k6)(()=>[(0,s.bF)(g,{modelValue:o.newChannel.quota.enabled,"onUpdate:modelValue":e[15]||(e[15]=t=>o.newChannel.quota.enabled=t)},null,8,["modelValue"])]),_:1}),o.newChannel.quota?.enabled?((0,s.uX)(),(0,s.CE)(s.FK,{key:0},[(0,s.bF)(x,{label:"容量上限 (GB)"},{default:(0,s.k6)(()=>[(0,s.bF)(v,{modelValue:o.newChannel.quota.limitGB,"onUpdate:modelValue":e[16]||(e[16]=t=>o.newChannel.quota.limitGB=t),min:.1,step:1,precision:1},null,8,["modelValue"])]),_:1}),(0,s.bF)(x,{label:"停用阈值 (%)"},{default:(0,s.k6)(()=>[(0,s.bF)(v,{modelValue:o.newChannel.quota.threshold,"onUpdate:modelValue":e[17]||(e[17]=t=>o.newChannel.quota.threshold=t),min:50,max:100,step:5},null,8,["modelValue"])]),_:1})],64)):(0,s.Q3)("",!0)],64)):"discord"===o.newChannel.type?((0,s.uX)(),(0,s.CE)(s.FK,{key:2},[(0,s.bF)(x,{label:"Bot Token",prop:"botToken"},{default:(0,s.k6)(()=>[(0,s.bF)(y,{modelValue:o.newChannel.botToken,"onUpdate:modelValue":e[18]||(e[18]=t=>o.newChannel.botToken=t),type:"password","show-password":"",placeholder:"请输入 Bot Token"},null,8,["modelValue"])]),_:1}),(0,s.bF)(x,{label:"Channel ID",prop:"channelId"},{default:(0,s.k6)(()=>[(0,s.bF)(y,{modelValue:o.newChannel.channelId,"onUpdate:modelValue":e[19]||(e[19]=t=>o.newChannel.channelId=t),type:"password","show-password":"",placeholder:"请输入 Channel ID"},null,8,["modelValue"])]),_:1}),(0,s.bF)(x,{label:"代理域名"},{default:(0,s.k6)(()=>[(0,s.bF)(y,{modelValue:o.newChannel.proxyUrl,"onUpdate:modelValue":e[20]||(e[20]=t=>o.newChannel.proxyUrl=t),placeholder:"可选,例如: your-proxy.example.com"},null,8,["modelValue"])]),_:1}),(0,s.bF)(x,{label:"Nitro 会员"},{default:(0,s.k6)(()=>[(0,s.bF)(g,{modelValue:o.newChannel.isNitro,"onUpdate:modelValue":e[21]||(e[21]=t=>o.newChannel.isNitro=t)},null,8,["modelValue"]),e[70]||(e[70]=(0,s.Lk)("span",{class:"form-tip"},"会员单文件限制 25MB否则为 10MB",-1))]),_:1}),(0,s.Lk)("div",Xd,[(0,s.bF)(l,{icon:"exclamation-triangle",style:{"margin-right":"6px"}}),e[71]||(e[71]=(0,s.eW)(" Discord 有接口频率限制,不建议将其用作大规模并发场景 ",-1))])],64)):"huggingface"===o.newChannel.type?((0,s.uX)(),(0,s.CE)(s.FK,{key:3},[(0,s.bF)(x,{label:"仓库名",prop:"repo"},{default:(0,s.k6)(()=>[(0,s.bF)(y,{modelValue:o.newChannel.repo,"onUpdate:modelValue":e[22]||(e[22]=t=>o.newChannel.repo=t),placeholder:"格式: username/repo-name"},null,8,["modelValue"])]),_:1}),(0,s.bF)(x,{label:"Access Token",prop:"token"},{default:(0,s.k6)(()=>[(0,s.bF)(y,{modelValue:o.newChannel.token,"onUpdate:modelValue":e[23]||(e[23]=t=>o.newChannel.token=t),type:"password","show-password":"",placeholder:"请输入 Access Token"},null,8,["modelValue"])]),_:1}),(0,s.bF)(x,{label:"私有仓库"},{default:(0,s.k6)(()=>[(0,s.bF)(g,{modelValue:o.newChannel.isPrivate,"onUpdate:modelValue":e[24]||(e[24]=t=>o.newChannel.isPrivate=t)},null,8,["modelValue"]),e[72]||(e[72]=(0,s.Lk)("span",{class:"form-tip"},"私有仓库限制 100GB",-1))]),_:1})],64)):(0,s.Q3)("",!0)]),_:1},8,["model","rules"])]),_:1},8,["modelValue","onClosed"]),(0,s.bF)(S,{modelValue:o.showDetailDialog,"onUpdate:modelValue":e[28]||(e[28]=t=>o.showDetailDialog=t),title:"渠道详情 - "+(o.currentChannel?.name||""),class:"channel-dialog",onClosed:r.resetDetailData},{footer:(0,s.k6)(()=>[(0,s.bF)(d,{onClick:e[27]||(e[27]=t=>o.showDetailDialog=!1)},{default:(0,s.k6)(()=>[...e[77]||(e[77]=[(0,s.eW)("关闭",-1)])]),_:1}),(0,s.bF)(d,{type:"primary",onClick:r.openEditFromDetail},{default:(0,s.k6)(()=>[...e[78]||(e[78]=[(0,s.eW)("编辑",-1)])]),_:1},8,["onClick"])]),default:(0,s.k6)(()=>[(0,s.bF)(M,{column:1,border:""},{default:(0,s.k6)(()=>[(0,s.bF)(F,{label:"渠道名称"},{default:(0,s.k6)(()=>[(0,s.eW)((0,n.v_)(o.currentChannel?.name),1)]),_:1}),(0,s.bF)(F,{label:"渠道类型"},{default:(0,s.k6)(()=>[(0,s.eW)((0,n.v_)(r.getChannelTypeLabel(o.currentChannelType)),1)]),_:1}),(0,s.bF)(F,{label:"状态"},{default:(0,s.k6)(()=>[(0,s.bF)(u,{type:o.currentChannel?.enabled?"success":"info"},{default:(0,s.k6)(()=>[(0,s.eW)((0,n.v_)(o.currentChannel?.enabled?"已启用":"已禁用"),1)]),_:1},8,["type"])]),_:1}),o.currentChannel?.fixed?((0,s.uX)(),(0,s.Wv)(F,{key:0,label:"配置来源"},{default:(0,s.k6)(()=>[(0,s.bF)(u,{type:"warning"},{default:(0,s.k6)(()=>[...e[75]||(e[75]=[(0,s.eW)("环境变量",-1)])]),_:1})]),_:1})):(0,s.Q3)("",!0),"telegram"===o.currentChannelType?((0,s.uX)(),(0,s.CE)(s.FK,{key:1},[(0,s.bF)(F,{label:"Bot Token"},{default:(0,s.k6)(()=>[(0,s.eW)((0,n.v_)(r.maskText(o.currentChannel?.botToken,10)),1)]),_:1}),(0,s.bF)(F,{label:"Chat ID"},{default:(0,s.k6)(()=>[(0,s.eW)((0,n.v_)(r.maskText(o.currentChannel?.chatId,6)),1)]),_:1}),(0,s.bF)(F,{label:"代理域名"},{default:(0,s.k6)(()=>[(0,s.eW)((0,n.v_)(o.currentChannel?.proxyUrl||"未设置"),1)]),_:1})],64)):"cfr2"===o.currentChannelType?((0,s.uX)(),(0,s.Wv)(F,{key:2,label:"公开访问链接"},{default:(0,s.k6)(()=>[(0,s.bF)(y,{"model-value":o.currentChannel?.publicUrl||"未设置",readonly:""},null,8,["model-value"])]),_:1})):"s3"===o.currentChannelType?((0,s.uX)(),(0,s.CE)(s.FK,{key:3},[(0,s.bF)(F,{label:"Endpoint"},{default:(0,s.k6)(()=>[(0,s.bF)(y,{"model-value":o.currentChannel?.endpoint,readonly:""},null,8,["model-value"])]),_:1}),(0,s.bF)(F,{label:"CDN 域名"},{default:(0,s.k6)(()=>[(0,s.bF)(y,{"model-value":o.currentChannel?.cdnDomain||"未设置",readonly:""},null,8,["model-value"])]),_:1}),(0,s.bF)(F,{label:"存储桶名称"},{default:(0,s.k6)(()=>[(0,s.eW)((0,n.v_)(o.currentChannel?.bucketName),1)]),_:1}),(0,s.bF)(F,{label:"存储桶区域"},{default:(0,s.k6)(()=>[(0,s.eW)((0,n.v_)(o.currentChannel?.region),1)]),_:1}),(0,s.bF)(F,{label:"路径风格"},{default:(0,s.k6)(()=>[(0,s.eW)((0,n.v_)(o.currentChannel?.pathStyle?"是":"否"),1)]),_:1})],64)):"discord"===o.currentChannelType?((0,s.uX)(),(0,s.CE)(s.FK,{key:4},[(0,s.bF)(F,{label:"Bot Token"},{default:(0,s.k6)(()=>[(0,s.eW)((0,n.v_)(r.maskText(o.currentChannel?.botToken,10)),1)]),_:1}),(0,s.bF)(F,{label:"Channel ID"},{default:(0,s.k6)(()=>[(0,s.eW)((0,n.v_)(r.maskText(o.currentChannel?.channelId,6)),1)]),_:1}),(0,s.bF)(F,{label:"代理域名"},{default:(0,s.k6)(()=>[(0,s.eW)((0,n.v_)(o.currentChannel?.proxyUrl||"未设置"),1)]),_:1}),(0,s.bF)(F,{label:"Nitro 会员"},{default:(0,s.k6)(()=>[(0,s.eW)((0,n.v_)(o.currentChannel?.isNitro?"是":"否"),1)]),_:1})],64)):"huggingface"===o.currentChannelType?((0,s.uX)(),(0,s.CE)(s.FK,{key:5},[(0,s.bF)(F,{label:"仓库名"},{default:(0,s.k6)(()=>[(0,s.eW)((0,n.v_)(o.currentChannel?.repo),1)]),_:1}),(0,s.bF)(F,{label:"私有仓库"},{default:(0,s.k6)(()=>[(0,s.eW)((0,n.v_)(o.currentChannel?.isPrivate?"是":"否"),1)]),_:1})],64)):(0,s.Q3)("",!0),o.currentChannel?.quota?.enabled?((0,s.uX)(),(0,s.CE)(s.FK,{key:6},[(0,s.bF)(F,{label:"容量限制"},{default:(0,s.k6)(()=>[(0,s.eW)((0,n.v_)(o.currentChannel?.quota?.limitGB)+" GB",1)]),_:1}),(0,s.bF)(F,{label:"停用阈值"},{default:(0,s.k6)(()=>[(0,s.eW)((0,n.v_)(o.currentChannel?.quota?.threshold)+"%",1)]),_:1}),(0,s.bF)(F,null,{label:(0,s.k6)(()=>[(0,s.Lk)("span",qd,[e[76]||(e[76]=(0,s.eW)(" 当前用量 ",-1)),(0,s.bF)(d,{link:"",type:"primary",onClick:r.refreshQuota,class:"refresh-btn"},{default:(0,s.k6)(()=>[(0,s.bF)(l,{icon:"sync-alt",class:(0,n.C4)({"fa-spin":o.quotaLoading})},null,8,["class"])]),_:1},8,["onClick"])])]),default:(0,s.k6)(()=>[(0,s.Lk)("div",Kd,[(0,s.bF)(f,{percentage:r.getQuotaPercentage(o.currentChannel),status:r.getQuotaStatus(o.currentChannel),"stroke-width":16,"text-inside":!0,format:()=>r.getQuotaText(o.currentChannel)},null,8,["percentage","status","format"]),(0,s.Lk)("div",{class:(0,n.C4)(["quota-info",{"quota-warning":r.isQuotaExceeded(o.currentChannel)}])},(0,n.v_)(r.getQuotaStatusText(o.currentChannel)),3)])]),_:1})],64)):(0,s.Q3)("",!0)]),_:1})]),_:1},8,["modelValue","title","onClosed"]),(0,s.bF)(S,{modelValue:o.showEditDialog,"onUpdate:modelValue":e[58]||(e[58]=t=>o.showEditDialog=t),title:"编辑渠道 - "+(o.editChannel?.name||""),class:"channel-dialog","destroy-on-close":"",onClosed:r.resetEditData},{footer:(0,s.k6)(()=>[(0,s.bF)(d,{onClick:e[57]||(e[57]=t=>o.showEditDialog=!1)},{default:(0,s.k6)(()=>[...e[80]||(e[80]=[(0,s.eW)("取消",-1)])]),_:1}),(0,s.bF)(d,{type:"primary",onClick:r.confirmEditChannel},{default:(0,s.k6)(()=>[...e[81]||(e[81]=[(0,s.eW)("保存修改",-1)])]),_:1},8,["onClick"])]),default:(0,s.k6)(()=>[(0,s.bF)(C,{model:o.editChannel,"label-position":"top",ref:"editForm",rules:o.editRules},{default:(0,s.k6)(()=>[(0,s.bF)(x,{label:"渠道名称",prop:"name"},{default:(0,s.k6)(()=>[(0,s.bF)(y,{modelValue:o.editChannel.name,"onUpdate:modelValue":e[29]||(e[29]=t=>o.editChannel.name=t),disabled:o.editChannel.fixed},null,8,["modelValue","disabled"])]),_:1}),(0,s.bF)(x,{label:"启用渠道"},{default:(0,s.k6)(()=>[(0,s.bF)(g,{modelValue:o.editChannel.enabled,"onUpdate:modelValue":e[30]||(e[30]=t=>o.editChannel.enabled=t)},null,8,["modelValue"])]),_:1}),"telegram"===o.currentChannelType?((0,s.uX)(),(0,s.CE)(s.FK,{key:0},[(0,s.bF)(x,{label:"Bot Token",prop:"botToken"},{default:(0,s.k6)(()=>[(0,s.bF)(y,{modelValue:o.editChannel.botToken,"onUpdate:modelValue":e[31]||(e[31]=t=>o.editChannel.botToken=t),disabled:o.editChannel.fixed,type:"password","show-password":""},null,8,["modelValue","disabled"])]),_:1}),(0,s.bF)(x,{label:"Chat ID",prop:"chatId"},{default:(0,s.k6)(()=>[(0,s.bF)(y,{modelValue:o.editChannel.chatId,"onUpdate:modelValue":e[32]||(e[32]=t=>o.editChannel.chatId=t),disabled:o.editChannel.fixed,type:"password","show-password":""},null,8,["modelValue","disabled"])]),_:1}),(0,s.bF)(x,{label:"代理域名"},{default:(0,s.k6)(()=>[(0,s.bF)(y,{modelValue:o.editChannel.proxyUrl,"onUpdate:modelValue":e[33]||(e[33]=t=>o.editChannel.proxyUrl=t),placeholder:"例如: your-proxy.example.com"},null,8,["modelValue"])]),_:1})],64)):"cfr2"===o.currentChannelType?((0,s.uX)(),(0,s.CE)(s.FK,{key:1},[(0,s.bF)(x,{label:"公开访问链接"},{default:(0,s.k6)(()=>[(0,s.bF)(y,{modelValue:o.editChannel.publicUrl,"onUpdate:modelValue":e[34]||(e[34]=t=>o.editChannel.publicUrl=t)},null,8,["modelValue"])]),_:1}),(0,s.bF)(x,{label:"容量限制"},{default:(0,s.k6)(()=>[(0,s.bF)(g,{modelValue:o.editChannel.quota.enabled,"onUpdate:modelValue":e[35]||(e[35]=t=>o.editChannel.quota.enabled=t),onChange:e[36]||(e[36]=t=>r.onQuotaEnabledChange(t,o.editChannel))},null,8,["modelValue"])]),_:1}),o.editChannel.quota?.enabled?((0,s.uX)(),(0,s.CE)(s.FK,{key:0},[(0,s.bF)(x,{label:"容量上限 (GB)"},{default:(0,s.k6)(()=>[(0,s.bF)(v,{modelValue:o.editChannel.quota.limitGB,"onUpdate:modelValue":e[37]||(e[37]=t=>o.editChannel.quota.limitGB=t),min:.1,step:1,precision:1},null,8,["modelValue"])]),_:1}),(0,s.bF)(x,{label:"停用阈值 (%)"},{default:(0,s.k6)(()=>[(0,s.bF)(v,{modelValue:o.editChannel.quota.threshold,"onUpdate:modelValue":e[38]||(e[38]=t=>o.editChannel.quota.threshold=t),min:50,max:100,step:5},null,8,["modelValue"])]),_:1})],64)):(0,s.Q3)("",!0)],64)):"s3"===o.currentChannelType?((0,s.uX)(),(0,s.CE)(s.FK,{key:2},[(0,s.bF)(x,{label:"Endpoint",prop:"endpoint"},{default:(0,s.k6)(()=>[(0,s.bF)(y,{modelValue:o.editChannel.endpoint,"onUpdate:modelValue":e[39]||(e[39]=t=>o.editChannel.endpoint=t),disabled:o.editChannel.fixed},null,8,["modelValue","disabled"])]),_:1}),(0,s.bF)(x,{label:"CDN 域名"},{default:(0,s.k6)(()=>[(0,s.bF)(y,{modelValue:o.editChannel.cdnDomain,"onUpdate:modelValue":e[40]||(e[40]=t=>o.editChannel.cdnDomain=t),placeholder:"如果有 CDN请配置 CDN 域名例如https://cdn.example.com"},null,8,["modelValue"]),e[79]||(e[79]=(0,s.Lk)("span",{class:"form-tip"},"可选配置。配置后将优先通过 CDN 读取文件,提高访问速度和降低成本",-1))]),_:1}),(0,s.bF)(x,{label:"存储桶名称",prop:"bucketName"},{default:(0,s.k6)(()=>[(0,s.bF)(y,{modelValue:o.editChannel.bucketName,"onUpdate:modelValue":e[41]||(e[41]=t=>o.editChannel.bucketName=t),disabled:o.editChannel.fixed},null,8,["modelValue","disabled"])]),_:1}),(0,s.bF)(x,{label:"存储桶区域",prop:"region"},{default:(0,s.k6)(()=>[(0,s.bF)(y,{modelValue:o.editChannel.region,"onUpdate:modelValue":e[42]||(e[42]=t=>o.editChannel.region=t),disabled:o.editChannel.fixed},null,8,["modelValue","disabled"])]),_:1}),(0,s.bF)(x,{label:"访问密钥 ID",prop:"accessKeyId"},{default:(0,s.k6)(()=>[(0,s.bF)(y,{modelValue:o.editChannel.accessKeyId,"onUpdate:modelValue":e[43]||(e[43]=t=>o.editChannel.accessKeyId=t),disabled:o.editChannel.fixed,type:"password","show-password":""},null,8,["modelValue","disabled"])]),_:1}),(0,s.bF)(x,{label:"机密访问密钥",prop:"secretAccessKey"},{default:(0,s.k6)(()=>[(0,s.bF)(y,{modelValue:o.editChannel.secretAccessKey,"onUpdate:modelValue":e[44]||(e[44]=t=>o.editChannel.secretAccessKey=t),disabled:o.editChannel.fixed,type:"password","show-password":""},null,8,["modelValue","disabled"])]),_:1}),(0,s.bF)(x,{label:"路径风格"},{default:(0,s.k6)(()=>[(0,s.bF)(g,{modelValue:o.editChannel.pathStyle,"onUpdate:modelValue":e[45]||(e[45]=t=>o.editChannel.pathStyle=t),disabled:o.editChannel.fixed},null,8,["modelValue","disabled"])]),_:1}),(0,s.bF)(x,{label:"容量限制"},{default:(0,s.k6)(()=>[(0,s.bF)(g,{modelValue:o.editChannel.quota.enabled,"onUpdate:modelValue":e[46]||(e[46]=t=>o.editChannel.quota.enabled=t),onChange:e[47]||(e[47]=t=>r.onQuotaEnabledChange(t,o.editChannel))},null,8,["modelValue"])]),_:1}),o.editChannel.quota?.enabled?((0,s.uX)(),(0,s.CE)(s.FK,{key:0},[(0,s.bF)(x,{label:"容量上限 (GB)"},{default:(0,s.k6)(()=>[(0,s.bF)(v,{modelValue:o.editChannel.quota.limitGB,"onUpdate:modelValue":e[48]||(e[48]=t=>o.editChannel.quota.limitGB=t),min:.1,step:1,precision:1},null,8,["modelValue"])]),_:1}),(0,s.bF)(x,{label:"停用阈值 (%)"},{default:(0,s.k6)(()=>[(0,s.bF)(v,{modelValue:o.editChannel.quota.threshold,"onUpdate:modelValue":e[49]||(e[49]=t=>o.editChannel.quota.threshold=t),min:50,max:100,step:5},null,8,["modelValue"])]),_:1})],64)):(0,s.Q3)("",!0)],64)):"discord"===o.currentChannelType?((0,s.uX)(),(0,s.CE)(s.FK,{key:3},[(0,s.bF)(x,{label:"Bot Token",prop:"botToken"},{default:(0,s.k6)(()=>[(0,s.bF)(y,{modelValue:o.editChannel.botToken,"onUpdate:modelValue":e[50]||(e[50]=t=>o.editChannel.botToken=t),disabled:o.editChannel.fixed,type:"password","show-password":""},null,8,["modelValue","disabled"])]),_:1}),(0,s.bF)(x,{label:"Channel ID",prop:"channelId"},{default:(0,s.k6)(()=>[(0,s.bF)(y,{modelValue:o.editChannel.channelId,"onUpdate:modelValue":e[51]||(e[51]=t=>o.editChannel.channelId=t),disabled:o.editChannel.fixed,type:"password","show-password":""},null,8,["modelValue","disabled"])]),_:1}),(0,s.bF)(x,{label:"代理域名"},{default:(0,s.k6)(()=>[(0,s.bF)(y,{modelValue:o.editChannel.proxyUrl,"onUpdate:modelValue":e[52]||(e[52]=t=>o.editChannel.proxyUrl=t),placeholder:"例如: your-proxy.example.com"},null,8,["modelValue"])]),_:1}),(0,s.bF)(x,{label:"Nitro 会员"},{default:(0,s.k6)(()=>[(0,s.bF)(g,{modelValue:o.editChannel.isNitro,"onUpdate:modelValue":e[53]||(e[53]=t=>o.editChannel.isNitro=t)},null,8,["modelValue"])]),_:1})],64)):"huggingface"===o.currentChannelType?((0,s.uX)(),(0,s.CE)(s.FK,{key:4},[(0,s.bF)(x,{label:"仓库名",prop:"repo"},{default:(0,s.k6)(()=>[(0,s.bF)(y,{modelValue:o.editChannel.repo,"onUpdate:modelValue":e[54]||(e[54]=t=>o.editChannel.repo=t),disabled:o.editChannel.fixed},null,8,["modelValue","disabled"])]),_:1}),(0,s.bF)(x,{label:"Access Token",prop:"token"},{default:(0,s.k6)(()=>[(0,s.bF)(y,{modelValue:o.editChannel.token,"onUpdate:modelValue":e[55]||(e[55]=t=>o.editChannel.token=t),disabled:o.editChannel.fixed,type:"password","show-password":""},null,8,["modelValue","disabled"])]),_:1}),(0,s.bF)(x,{label:"私有仓库"},{default:(0,s.k6)(()=>[(0,s.bF)(g,{modelValue:o.editChannel.isPrivate,"onUpdate:modelValue":e[56]||(e[56]=t=>o.editChannel.isPrivate=t)},null,8,["modelValue"])]),_:1})],64)):(0,s.Q3)("",!0)]),_:1},8,["model","rules"])]),_:1},8,["modelValue","title","onClosed"])])),[[A,o.loading]])}var Qd={components:{CustomSelect:dd},data(){return{channelFilter:"",channels:[{value:"telegram",label:"Telegram"},{value:"cfr2",label:"CloudFlare R2"},{value:"s3",label:"S3"},{value:"discord",label:"Discord"},{value:"huggingface",label:"HuggingFace"}],addableChannels:[{value:"telegram",label:"Telegram"},{value:"s3",label:"S3"},{value:"discord",label:"Discord"},{value:"huggingface",label:"HuggingFace"}],telegramSettings:{loadBalance:{enabled:!1},channels:[]},cfr2Settings:{channels:[]},s3Settings:{loadBalance:{enabled:!1},channels:[]},discordSettings:{loadBalance:{enabled:!1},channels:[]},huggingfaceSettings:{loadBalance:{enabled:!1},channels:[]},showAddDialog:!1,showDetailDialog:!1,showEditDialog:!1,currentChannelType:"",currentChannelIndex:-1,currentChannel:null,editChannel:{},newChannel:{type:"",name:"",enabled:!0,botToken:"",chatId:"",proxyUrl:"",endpoint:"",cdnDomain:"",bucketName:"",region:"auto",accessKeyId:"",secretAccessKey:"",pathStyle:!1,quota:{enabled:!1,limitGB:10,threshold:95},channelId:"",isNitro:!1,repo:"",token:"",isPrivate:!1},addRules:{type:[{required:!0,message:"请选择渠道类型",trigger:"change"}],name:[{required:!0,message:"请输入渠道名称",trigger:"blur"},{pattern:/^[\u4e00-\u9fa5a-zA-Z0-9_-]+$/,message:"渠道名称只能包含中英文、数字、下划线和横线",trigger:"blur"}],botToken:[{required:!0,message:"请输入 Bot Token",trigger:"blur"}],chatId:[{required:!0,message:"请输入 Chat ID",trigger:"blur"}],channelId:[{required:!0,message:"请输入 Channel ID",trigger:"blur"}],endpoint:[{required:!0,message:"请输入 Endpoint",trigger:"blur"}],bucketName:[{required:!0,message:"请输入存储桶名称",trigger:"blur"}],region:[{required:!0,message:"请输入存储桶区域",trigger:"blur"}],accessKeyId:[{required:!0,message:"请输入访问密钥 ID",trigger:"blur"}],secretAccessKey:[{required:!0,message:"请输入机密访问密钥",trigger:"blur"}],repo:[{required:!0,message:"请输入仓库名",trigger:"blur"}],token:[{required:!0,message:"请输入 Access Token",trigger:"blur"}]},editRules:{name:[{required:!0,message:"请输入渠道名称",trigger:"blur"},{pattern:/^[\u4e00-\u9fa5a-zA-Z0-9_-]+$/,message:"渠道名称只能包含中英文、数字、下划线和横线",trigger:"blur"}],botToken:[{required:!0,message:"请输入 Bot Token",trigger:"blur"}],chatId:[{required:!0,message:"请输入 Chat ID",trigger:"blur"}],channelId:[{required:!0,message:"请输入 Channel ID",trigger:"blur"}],endpoint:[{required:!0,message:"请输入 Endpoint",trigger:"blur"}],bucketName:[{required:!0,message:"请输入存储桶名称",trigger:"blur"}],region:[{required:!0,message:"请输入存储桶区域",trigger:"blur"}],accessKeyId:[{required:!0,message:"请输入访问密钥 ID",trigger:"blur"}],secretAccessKey:[{required:!0,message:"请输入机密访问密钥",trigger:"blur"}],repo:[{required:!0,message:"请输入仓库名",trigger:"blur"}],token:[{required:!0,message:"请输入 Access Token",trigger:"blur"}]},quotaStats:{},quotaLoading:!1,loading:!1}},computed:{filterOptions(){const t={telegram:"paper-plane",cfr2:"cloud",s3:"database",discord:"comments",huggingface:"robot"};return[{value:"",label:"全部类型"},...this.channels.map(e=>({value:e.value,label:e.label,icon:t[e.value]||"server"}))]},filteredChannels(){return this.channelFilter?this.channels.filter(t=>t.value===this.channelFilter):this.channels}},methods:{handleCardMouseMove(t,e,i){const s=t.currentTarget,n=s.getBoundingClientRect(),a=t.clientX-n.left,o=t.clientY-n.top,r=`glow-${e}-${i}`,l=this.$refs[r];l&&l[0]&&(l[0].style.opacity="1",l[0].style.left=`${a}px`,l[0].style.top=`${o}px`)},handleCardMouseLeave(t,e){const i=`glow-${t}-${e}`,s=this.$refs[i];s&&s[0]&&(s[0].style.opacity="0")},getChannelIcon(t){const e={telegram:"paper-plane",cfr2:"cloud",s3:"database",discord:"comments",huggingface:"robot"};return e[t]||"server"},getChannelTypeLabel(t){const e=this.channels.find(e=>e.value===t);return e?e.label:t},getChannelList(t){return this.getSettings(t)?.channels||[]},getSettings(t){const e={telegram:this.telegramSettings,cfr2:this.cfr2Settings,s3:this.s3Settings,discord:this.discordSettings,huggingface:this.huggingfaceSettings};return e[t]},hasLoadBalance(t){return["telegram","s3","discord","huggingface"].includes(t)},maskText(t,e=4){return t?t.length<=2*e?"****":t.slice(0,e)+"****"+t.slice(-e):"未设置"},openDetailDialog(t,e){this.currentChannelType=t,this.currentChannelIndex=e,this.currentChannel=this.getChannelList(t)[e],this.showDetailDialog=!0},openEditDialog(t,e){this.currentChannelType=t,this.currentChannelIndex=e;const i=this.getChannelList(t)[e];this.editChannel=JSON.parse(JSON.stringify(i)),this.editChannel.quota||(this.editChannel.quota={enabled:!1,limitGB:10,threshold:95}),this.showEditDialog=!0},openEditFromDetail(){this.showDetailDialog=!1,this.openEditDialog(this.currentChannelType,this.currentChannelIndex)},resetAddForm(){this.newChannel={type:"",name:"",enabled:!0,botToken:"",chatId:"",proxyUrl:"",endpoint:"",bucketName:"",region:"auto",accessKeyId:"",secretAccessKey:"",pathStyle:!1,quota:{enabled:!1,limitGB:10,threshold:95},channelId:"",isNitro:!1,repo:"",token:"",isPrivate:!1}},resetDetailData(){this.currentChannel=null},resetEditData(){this.editChannel={}},onChannelTypeChange(){const{type:t,name:e}=this.newChannel;this.newChannel={type:t,name:e,enabled:!0,botToken:"",chatId:"",proxyUrl:"",endpoint:"",cdnDomain:"",bucketName:"",region:"auto",accessKeyId:"",secretAccessKey:"",pathStyle:!1,quota:{enabled:!1,limitGB:10,threshold:95},channelId:"",isNitro:!1,repo:"",token:"",isPrivate:!1}},confirmAddChannel(){this.$refs.addForm.validate(t=>{if(!t)return;const{type:e,name:i}=this.newChannel,s=this.getSettings(e),n=["Telegram_env","R2_env","S3_env","Discord_env","HuggingFace_env"];if(n.includes(i))return void this.$message.warning("该名称为系统保留名称,请使用其他名称");const a=s.channels.some(t=>t.name===i);if(a)return void this.$message.warning("该类型下已存在同名渠道,请使用其他名称");let o={id:s.channels.length+1,name:this.newChannel.name,type:e,savePath:"database",enabled:!0,fixed:!1};"telegram"===e?Object.assign(o,{botToken:this.newChannel.botToken,chatId:this.newChannel.chatId,proxyUrl:this.newChannel.proxyUrl}):"s3"===e?Object.assign(o,{endpoint:this.newChannel.endpoint,cdnDomain:this.newChannel.cdnDomain,bucketName:this.newChannel.bucketName,region:this.newChannel.region,accessKeyId:this.newChannel.accessKeyId,secretAccessKey:this.newChannel.secretAccessKey,pathStyle:this.newChannel.pathStyle,quota:{...this.newChannel.quota}}):"discord"===e?Object.assign(o,{botToken:this.newChannel.botToken,channelId:this.newChannel.channelId,proxyUrl:this.newChannel.proxyUrl,isNitro:this.newChannel.isNitro}):"huggingface"===e&&Object.assign(o,{repo:this.newChannel.repo,token:this.newChannel.token,isPrivate:this.newChannel.isPrivate}),s.channels.push(o),this.showAddDialog=!1,this.saveSettings()})},confirmEditChannel(){this.$refs.editForm.validate(t=>{if(!t)return;const e=this.getSettings(this.currentChannelType),i=this.editChannel.name,s=this.currentChannelIndex,n=this.editChannel.fixed;if(!n){const t=["Telegram_env","R2_env","S3_env","Discord_env","HuggingFace_env"];if(t.includes(i))return void this.$message.warning("该名称为系统保留名称,请使用其他名称");const n=e.channels.some((t,e)=>e!==s&&t.name===i);if(n)return void this.$message.warning("该类型下已存在同名渠道,请使用其他名称")}e.channels[this.currentChannelIndex]={...this.editChannel},this.showEditDialog=!1,this.saveSettings()})},deleteChannel(t,e){const i=this.getChannelList(t)[e];i.fixed?this.$message.warning("环境变量配置的渠道无法删除"):this.$confirm("确定要删除该渠道吗?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then(()=>{const i=this.getSettings(t);i.channels.splice(e,1),i.channels.forEach((t,e)=>{t.id=e+1}),this.saveSettings()}).catch(()=>{})},saveSettings(){const t={telegram:this.telegramSettings,cfr2:this.cfr2Settings,s3:this.s3Settings,discord:this.discordSettings,huggingface:this.huggingfaceSettings};(0,Ut.A)("/api/manage/sysConfig/upload",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)}).then(()=>{this.$message.success("设置已保存")})},async refreshQuota(){this.quotaLoading=!0;try{const t=await(0,Ut.A)("/api/manage/quota",{method:"POST"}),e=await t.json();if(e.success)this.quotaStats=e.channelStats||{};else{const t=await(0,Ut.A)("/api/manage/quota"),e=await t.json();e.success&&(this.quotaStats=e.quotaStats||{})}}catch(t){console.error("Failed to refresh quota stats:",t)}finally{this.quotaLoading=!1}},async loadQuotaStats(){try{const t=await(0,Ut.A)("/api/manage/quota"),e=await t.json();e.success&&(this.quotaStats=e.quotaStats||{})}catch(t){console.error("Failed to load quota stats:",t)}},getChannelUsedGB(t){const e=this.quotaStats[t.name];return e?(e.usedMB||0)/1024:0},getQuotaPercentage(t){const e=this.getChannelUsedGB(t),i=t.quota?.limitGB||10,s=e/i*100;return Math.min(100,Math.round(10*s)/10)},getQuotaStatus(t){const e=this.getQuotaPercentage(t),i=t.quota?.threshold||95;return e>=i?"exception":e>=80?"warning":"success"},getQuotaText(t){const e=this.getChannelUsedGB(t),i=t.quota?.limitGB||10;return`${e.toFixed(2)} / ${i} GB`},isQuotaExceeded(t){const e=this.getQuotaPercentage(t),i=t.quota?.threshold||95;return e>=i},getQuotaStatusText(t){const e=this.getQuotaPercentage(t),i=t.quota?.threshold||95;return e>=i?`⚠️ 已达到容量阈值 (${i}%),渠道写入已暂停`:e>=80?"⚡ 容量使用较高,接近阈值":"✓ 容量正常"},async onQuotaEnabledChange(t,e){if(t&&e.name){const t=this.quotaStats[e.name];t||this.$confirm("首次启用容量限制需要统计现有文件容量,这可能需要一些时间。是否立即统计?","初始化容量统计",{confirmButtonText:"立即统计",cancelButtonText:"稍后手动统计",type:"info"}).then(async()=>{await this.recalculateQuota()}).catch(()=>{this.$message.info("您可以稍后点击刷新按钮手动统计")})}},async recalculateQuota(){this.quotaLoading=!0;try{this.$message.info("正在统计容量,请稍候...");const t=await(0,Ut.A)("/api/manage/quota",{method:"POST"}),e=await t.json();e.success?(this.quotaStats=e.channelStats||{},this.$message.success("容量统计完成")):this.$message.error("统计失败: "+(e.error||"未知错误"))}catch(t){console.error("Failed to recalculate quota:",t),this.$message.error("统计失败")}finally{this.quotaLoading=!1}}},mounted(){this.loading=!0,(0,Ut.A)("/api/manage/sysConfig/upload").then(t=>t.json()).then(t=>{this.telegramSettings=t.telegram,t.cfr2&&t.cfr2.channels&&(t.cfr2.channels=t.cfr2.channels.map(t=>({...t,quota:t.quota||{enabled:!1,limitGB:10,threshold:95}}))),this.cfr2Settings=t.cfr2,t.s3&&t.s3.channels&&(t.s3.channels=t.s3.channels.map(t=>({...t,quota:t.quota||{enabled:!1,limitGB:10,threshold:95}}))),this.s3Settings=t.s3,t.discord&&t.discord.channels&&(t.discord.channels=t.discord.channels.map(t=>({...t,proxyUrl:t.proxyUrl||""}))),this.discordSettings=t.discord||{loadBalance:{},channels:[]},t.huggingface&&t.huggingface.channels&&(t.huggingface.channels=t.huggingface.channels.map(t=>({...t,isPrivate:t.isPrivate||!1}))),this.huggingfaceSettings=t.huggingface||{loadBalance:{},channels:[]},this.loadQuotaStats()}).finally(()=>{this.loading=!1})}};const Gd=(0,c.A)(Qd,[["render",Yd],["__scopeId","data-v-89234e52"]]);var Jd=Gd,Zd=i(850);i(8736);const tu={class:"save-text"};function eu(t,e,i,a,o,r){const l=(0,s.g2)("font-awesome-icon");return(0,s.uX)(),(0,s.Wv)(od.eB,{name:"fade-up"},{default:(0,s.k6)(()=>[(0,s.bo)((0,s.Lk)("div",{class:(0,n.C4)(["floating-save-btn",{"is-loading":i.loading}]),onClick:e[0]||(e[0]=(...t)=>r.handleClick&&r.handleClick(...t))},[i.loading?((0,s.uX)(),(0,s.Wv)(l,{key:0,icon:"spinner",spin:""})):((0,s.uX)(),(0,s.Wv)(l,{key:1,icon:"save"})),(0,s.Lk)("span",tu,(0,n.v_)(i.loading?"保存中":"保存"),1)],2),[[od.aG,o.visible]])]),_:1})}var iu={name:"FloatingSaveButton",props:{loading:{type:Boolean,default:!1},show:{type:Boolean,default:!0}},data(){return{visible:!1}},watch:{show:{immediate:!0,handler(t){t?setTimeout(()=>{this.visible=!0},600):this.visible=!1}}},methods:{handleClick(){this.loading||this.$emit("click")}}};const su=(0,c.A)(iu,[["render",eu],["__scopeId","data-v-27fc6cc8"]]);var nu=su,au=i(7138);i(5802),i(4752);const ou={class:"security-settings"},ru={class:"first-settings"},lu={class:"second-title token-title"},hu={class:"token-actions"},cu={class:"token-table-container"},du={class:"table-cell-content"},uu={class:"table-cell-content"},gu={class:"token-display"},pu={class:"table-cell-content"},fu={class:"table-cell-content"},mu={class:"table-cell-content action-buttons"},bu={class:"first-settings"},xu={class:"second-title"},yu={class:"first-settings"},_u={class:"dialog-footer"},vu={class:"dialog-footer"},ku={class:"token-result"},wu={style:{"margin-bottom":"15px",color:"#e6a23c"}},Cu={class:"dialog-footer"};function Su(t,e,i,a,o,r){const l=id.WK,h=td.xE,c=td.US,d=(0,s.g2)("font-awesome-icon"),u=k.S2,g=au.o8,f=ad.u,m=au.Up,b=p.R7,x=nd.qi,y=sd.P9,v=sd.AV,w=nu,C=Zd.dI,S=Zd.o5,F=Zc.kZ,M=_.A;return(0,s.bo)(((0,s.uX)(),(0,s.CE)("div",ou,[(0,s.Lk)("div",ru,[e[26]||(e[26]=(0,s.Lk)("h3",{class:"first-title"},"认证管理",-1)),e[27]||(e[27]=(0,s.Lk)("h4",{class:"second-title"},"用户端认证",-1)),(0,s.bF)(c,{model:o.authSettings.user,rules:o.userPassRules,ref:"userPassForm","label-width":"120px"},{default:(0,s.k6)(()=>[(0,s.bF)(h,{label:"上传密码",prop:"authCode"},{default:(0,s.k6)(()=>[(0,s.bF)(l,{modelValue:o.authSettings.user.authCode,"onUpdate:modelValue":e[0]||(e[0]=t=>o.authSettings.user.authCode=t),type:"password","show-password":"",onInput:r.handleUserPassInput,autocomplete:"new-password"},null,8,["modelValue","onInput"])]),_:1}),(0,s.bF)(od.eB,{name:"fade-slide",mode:"out-in"},{default:(0,s.k6)(()=>[o.showUserPassConfirm?((0,s.uX)(),(0,s.Wv)(h,{label:"确认密码",prop:"confirmNewUserPassword",key:"user-confirm"},{default:(0,s.k6)(()=>[(0,s.bF)(l,{modelValue:o.authSettings.user.confirmNewUserPassword,"onUpdate:modelValue":e[1]||(e[1]=t=>o.authSettings.user.confirmNewUserPassword=t),type:"password","show-password":"",autocomplete:"new-password"},null,8,["modelValue"])]),_:1})):(0,s.Q3)("",!0)]),_:1})]),_:1},8,["model","rules"]),e[28]||(e[28]=(0,s.Lk)("h4",{class:"second-title"},"管理端认证",-1)),(0,s.bF)(c,{model:o.authSettings.admin,rules:o.adminPassRules,ref:"adminPassForm","label-width":"120px"},{default:(0,s.k6)(()=>[(0,s.bF)(h,{label:"用户名",prop:"adminUsername"},{default:(0,s.k6)(()=>[(0,s.bF)(l,{modelValue:o.authSettings.admin.adminUsername,"onUpdate:modelValue":e[2]||(e[2]=t=>o.authSettings.admin.adminUsername=t),autocomplete:"new-password"},null,8,["modelValue"])]),_:1}),(0,s.bF)(h,{label:"密码",prop:"adminPassword"},{default:(0,s.k6)(()=>[(0,s.bF)(l,{modelValue:o.authSettings.admin.adminPassword,"onUpdate:modelValue":e[3]||(e[3]=t=>o.authSettings.admin.adminPassword=t),type:"password","show-password":"",onInput:r.handleAdminPassInput,autocomplete:"new-password"},null,8,["modelValue","onInput"])]),_:1}),(0,s.bF)(od.eB,{name:"fade-slide",mode:"out-in"},{default:(0,s.k6)(()=>[o.showAdminPassConfirm?((0,s.uX)(),(0,s.Wv)(h,{label:"确认密码",prop:"confirmNewAdminPassword",key:"admin-confirm"},{default:(0,s.k6)(()=>[(0,s.bF)(l,{modelValue:o.authSettings.admin.confirmNewAdminPassword,"onUpdate:modelValue":e[4]||(e[4]=t=>o.authSettings.admin.confirmNewAdminPassword=t),type:"password","show-password":"",autocomplete:"new-password"},null,8,["modelValue"])]),_:1})):(0,s.Q3)("",!0)]),_:1})]),_:1},8,["model","rules"]),(0,s.Lk)("h4",lu,[e[23]||(e[23]=(0,s.eW)("API Token 管理 ",-1)),(0,s.Lk)("a",hu,[(0,s.bF)(u,{type:"primary",size:"small",onClick:e[5]||(e[5]=t=>o.showCreateTokenDialog=!0),circle:""},{default:(0,s.k6)(()=>[(0,s.bF)(d,{icon:"plus"})]),_:1})])]),(0,s.Lk)("div",cu,[(0,s.bo)(((0,s.uX)(),(0,s.Wv)(m,{data:o.apiTokens,class:"token-table"},{default:(0,s.k6)(()=>[(0,s.bF)(g,{prop:"name",label:"名称","header-align":"center"},{default:(0,s.k6)(t=>[(0,s.Lk)("div",du,(0,n.v_)(t.row.name),1)]),_:1}),(0,s.bF)(g,{prop:"token",label:"Token","header-align":"center"},{default:(0,s.k6)(t=>[(0,s.Lk)("div",uu,[(0,s.Lk)("span",gu,(0,n.v_)(t.row.token),1)])]),_:1}),(0,s.bF)(g,{prop:"permissions",label:"权限","header-align":"center"},{default:(0,s.k6)(t=>[(0,s.Lk)("div",pu,[((0,s.uX)(!0),(0,s.CE)(s.FK,null,(0,s.pI)(t.row.permissions,t=>((0,s.uX)(),(0,s.Wv)(f,{key:t,size:"small",class:"permission-tag"},{default:(0,s.k6)(()=>[(0,s.eW)((0,n.v_)(r.getPermissionText(t)),1)]),_:2},1024))),128))])]),_:1}),(0,s.bF)(g,{prop:"createdAt",label:"创建时间","header-align":"center"},{default:(0,s.k6)(t=>[(0,s.Lk)("div",fu,(0,n.v_)(r.formatDate(t.row.createdAt)),1)]),_:1}),(0,s.bF)(g,{label:"操作",fixed:"right","header-align":"center"},{default:(0,s.k6)(t=>[(0,s.Lk)("div",mu,[(0,s.bF)(u,{class:"action-button",size:"small",onClick:e=>r.editToken(t.row)},{default:(0,s.k6)(()=>[...e[24]||(e[24]=[(0,s.eW)("编辑",-1)])]),_:1},8,["onClick"]),(0,s.bF)(u,{class:"action-button",size:"small",type:"danger",onClick:e=>r.deleteToken(t.row.id)},{default:(0,s.k6)(()=>[...e[25]||(e[25]=[(0,s.eW)("删除",-1)])]),_:1},8,["onClick"])])]),_:1})]),_:1},8,["data"])),[[M,o.tokenLoading]])])]),(0,s.Lk)("div",bu,[e[30]||(e[30]=(0,s.Lk)("h3",{class:"first-title"},"上传管理",-1)),(0,s.Lk)("h4",xu,[e[29]||(e[29]=(0,s.eW)("图像审查 ",-1)),(0,s.bF)(b,{content:"仅对非分块上传文件生效,支持 nsfwjs 和 moderatecontent.com 渠道",placement:"top"},{default:(0,s.k6)(()=>[(0,s.bF)(d,{icon:"question-circle",style:{"margin-left":"5px",cursor:"pointer"}})]),_:1})]),(0,s.bF)(c,{model:o.uploadSettings.moderate,"label-width":"120px"},{default:(0,s.k6)(()=>[(0,s.bF)(h,{label:"开启审查"},{default:(0,s.k6)(()=>[(0,s.bF)(x,{modelValue:o.uploadSettings.moderate.enabled,"onUpdate:modelValue":e[6]||(e[6]=t=>o.uploadSettings.moderate.enabled=t)},null,8,["modelValue"])]),_:1}),(0,s.bF)(h,{label:"审查渠道"},{default:(0,s.k6)(()=>[(0,s.bF)(v,{modelValue:o.uploadSettings.moderate.channel,"onUpdate:modelValue":e[7]||(e[7]=t=>o.uploadSettings.moderate.channel=t),placeholder:"请选择审查渠道"},{default:(0,s.k6)(()=>[(0,s.bF)(y,{label:"moderatecontent.com",value:"moderatecontent.com"}),(0,s.bF)(y,{label:"nsfwjs",value:"nsfwjs"})]),_:1},8,["modelValue"])]),_:1}),"moderatecontent.com"===o.uploadSettings.moderate.channel?((0,s.uX)(),(0,s.Wv)(h,{key:0,label:"API Key"},{default:(0,s.k6)(()=>[(0,s.bF)(l,{modelValue:o.uploadSettings.moderate.moderateContentApiKey,"onUpdate:modelValue":e[8]||(e[8]=t=>o.uploadSettings.moderate.moderateContentApiKey=t)},null,8,["modelValue"])]),_:1})):(0,s.Q3)("",!0),"nsfwjs"===o.uploadSettings.moderate.channel?((0,s.uX)(),(0,s.Wv)(h,{key:1,label:"API 路径"},{default:(0,s.k6)(()=>[(0,s.bF)(l,{modelValue:o.uploadSettings.moderate.nsfwApiPath,"onUpdate:modelValue":e[9]||(e[9]=t=>o.uploadSettings.moderate.nsfwApiPath=t),placeholder:"https://nsfwjs.your.domain"},null,8,["modelValue"])]),_:1})):(0,s.Q3)("",!0)]),_:1},8,["model"])]),(0,s.Lk)("div",yu,[e[33]||(e[33]=(0,s.Lk)("h3",{class:"first-title"},"访问管理",-1)),e[34]||(e[34]=(0,s.Lk)("h4",{class:"second-title"},"域名过滤",-1)),(0,s.bF)(c,{model:o.accessSettings,"label-width":"120px"},{default:(0,s.k6)(()=>[(0,s.bF)(h,null,{label:(0,s.k6)(()=>[e[31]||(e[31]=(0,s.eW)(" 放行域名 ",-1)),(0,s.bF)(b,{content:"1.针对访问域名设置权限 <br/> 2.留空默认全部放行,多个域名请用英文逗号分隔",placement:"top","raw-content":""},{default:(0,s.k6)(()=>[(0,s.bF)(d,{icon:"question-circle",style:{"margin-left":"5px",cursor:"pointer"}})]),_:1})]),default:(0,s.k6)(()=>[(0,s.bF)(l,{modelValue:o.accessSettings.allowedDomains,"onUpdate:modelValue":e[10]||(e[10]=t=>o.accessSettings.allowedDomains=t)},null,8,["modelValue"])]),_:1})]),_:1},8,["model"]),e[35]||(e[35]=(0,s.Lk)("h4",{class:"second-title"},"白名单模式",-1)),(0,s.bF)(c,{model:o.accessSettings,"label-width":"120px"},{default:(0,s.k6)(()=>[(0,s.bF)(h,null,{label:(0,s.k6)(()=>[e[32]||(e[32]=(0,s.eW)(" 是否开启 ",-1)),(0,s.bF)(b,{content:"1.针对文件设置权限 <br> 2.开启后,仅被加入白名单的文件可被访问",placement:"top","raw-content":""},{default:(0,s.k6)(()=>[(0,s.bF)(d,{icon:"question-circle",style:{"margin-left":"5px",cursor:"pointer"}})]),_:1})]),default:(0,s.k6)(()=>[(0,s.bF)(x,{modelValue:o.accessSettings.whiteListMode,"onUpdate:modelValue":e[11]||(e[11]=t=>o.accessSettings.whiteListMode=t)},null,8,["modelValue"])]),_:1})]),_:1},8,["model"])]),(0,s.bF)(w,{show:!o.loading,onClick:r.saveSettings},null,8,["show","onClick"]),(0,s.bF)(F,{modelValue:o.showCreateTokenDialog,"onUpdate:modelValue":e[15]||(e[15]=t=>o.showCreateTokenDialog=t),title:"创建新 API Token",width:r.dialogWidth},{footer:(0,s.k6)(()=>[(0,s.Lk)("span",_u,[(0,s.bF)(u,{onClick:e[14]||(e[14]=t=>o.showCreateTokenDialog=!1)},{default:(0,s.k6)(()=>[...e[39]||(e[39]=[(0,s.eW)("取消",-1)])]),_:1}),(0,s.bF)(u,{type:"primary",onClick:r.createToken},{default:(0,s.k6)(()=>[...e[40]||(e[40]=[(0,s.eW)("创建",-1)])]),_:1},8,["onClick"])])]),default:(0,s.k6)(()=>[(0,s.bF)(c,{model:o.newToken,rules:o.tokenRules,ref:"tokenForm","label-width":"100px"},{default:(0,s.k6)(()=>[(0,s.bF)(h,{label:"Token 名称",prop:"name"},{default:(0,s.k6)(()=>[(0,s.bF)(l,{modelValue:o.newToken.name,"onUpdate:modelValue":e[12]||(e[12]=t=>o.newToken.name=t),placeholder:"请输入Token名称"},null,8,["modelValue"])]),_:1}),(0,s.bF)(h,{label:"权限",prop:"permissions"},{default:(0,s.k6)(()=>[(0,s.bF)(S,{modelValue:o.newToken.permissions,"onUpdate:modelValue":e[13]||(e[13]=t=>o.newToken.permissions=t)},{default:(0,s.k6)(()=>[(0,s.bF)(C,{label:"upload"},{default:(0,s.k6)(()=>[...e[36]||(e[36]=[(0,s.eW)("上传",-1)])]),_:1}),(0,s.bF)(C,{label:"delete"},{default:(0,s.k6)(()=>[...e[37]||(e[37]=[(0,s.eW)("删除",-1)])]),_:1}),(0,s.bF)(C,{label:"list"},{default:(0,s.k6)(()=>[...e[38]||(e[38]=[(0,s.eW)("列出",-1)])]),_:1})]),_:1},8,["modelValue"])]),_:1})]),_:1},8,["model","rules"])]),_:1},8,["modelValue","width"]),(0,s.bF)(F,{modelValue:o.showEditTokenDialog,"onUpdate:modelValue":e[19]||(e[19]=t=>o.showEditTokenDialog=t),title:"编辑 API Token",width:r.dialogWidth},{footer:(0,s.k6)(()=>[(0,s.Lk)("span",vu,[(0,s.bF)(u,{onClick:e[18]||(e[18]=t=>o.showEditTokenDialog=!1)},{default:(0,s.k6)(()=>[...e[44]||(e[44]=[(0,s.eW)("取消",-1)])]),_:1}),(0,s.bF)(u,{type:"primary",onClick:r.updateToken},{default:(0,s.k6)(()=>[...e[45]||(e[45]=[(0,s.eW)("更新",-1)])]),_:1},8,["onClick"])])]),default:(0,s.k6)(()=>[(0,s.bF)(c,{model:o.editingToken,rules:o.tokenRules,ref:"editTokenForm","label-width":"100px"},{default:(0,s.k6)(()=>[(0,s.bF)(h,{label:"Token 名称"},{default:(0,s.k6)(()=>[(0,s.bF)(l,{modelValue:o.editingToken.name,"onUpdate:modelValue":e[16]||(e[16]=t=>o.editingToken.name=t),disabled:""},null,8,["modelValue"])]),_:1}),(0,s.bF)(h,{label:"权限",prop:"permissions"},{default:(0,s.k6)(()=>[(0,s.bF)(S,{modelValue:o.editingToken.permissions,"onUpdate:modelValue":e[17]||(e[17]=t=>o.editingToken.permissions=t)},{default:(0,s.k6)(()=>[(0,s.bF)(C,{label:"upload"},{default:(0,s.k6)(()=>[...e[41]||(e[41]=[(0,s.eW)("上传",-1)])]),_:1}),(0,s.bF)(C,{label:"delete"},{default:(0,s.k6)(()=>[...e[42]||(e[42]=[(0,s.eW)("删除",-1)])]),_:1}),(0,s.bF)(C,{label:"list"},{default:(0,s.k6)(()=>[...e[43]||(e[43]=[(0,s.eW)("列出",-1)])]),_:1})]),_:1},8,["modelValue"])]),_:1})]),_:1},8,["model","rules"])]),_:1},8,["modelValue","width"]),(0,s.bF)(F,{modelValue:o.showTokenResultDialog,"onUpdate:modelValue":e[22]||(e[22]=t=>o.showTokenResultDialog=t),title:"Token 创建成功",width:r.dialogWidth},{footer:(0,s.k6)(()=>[(0,s.Lk)("span",Cu,[(0,s.bF)(u,{type:"primary",onClick:e[21]||(e[21]=t=>o.showTokenResultDialog=!1)},{default:(0,s.k6)(()=>[...e[48]||(e[48]=[(0,s.eW)("我已保存",-1)])]),_:1})])]),default:(0,s.k6)(()=>[(0,s.Lk)("div",ku,[(0,s.Lk)("p",wu,[(0,s.bF)(d,{icon:"exclamation-triangle",style:{"margin-right":"5px"}}),e[46]||(e[46]=(0,s.eW)(" 请妥善保存以下Token关闭此窗口后将无法再次查看完整Token ",-1))]),(0,s.bF)(c,{"label-width":"100px"},{default:(0,s.k6)(()=>[(0,s.bF)(h,{label:"Token 名称"},{default:(0,s.k6)(()=>[(0,s.Lk)("span",null,(0,n.v_)(o.createdToken.name),1)]),_:1}),(0,s.bF)(h,{label:"完整Token"},{default:(0,s.k6)(()=>[(0,s.bF)(l,{modelValue:o.createdToken.token,"onUpdate:modelValue":e[20]||(e[20]=t=>o.createdToken.token=t),readonly:""},{append:(0,s.k6)(()=>[(0,s.bF)(u,{onClick:r.copyToken},{default:(0,s.k6)(()=>[...e[47]||(e[47]=[(0,s.eW)("复制",-1)])]),_:1},8,["onClick"])]),_:1},8,["modelValue"])]),_:1})]),_:1})])]),_:1},8,["modelValue","width"])])),[[M,o.loading]])}i(1148);var Fu={components:{FloatingSaveButton:nu},data(){return{authSettings:{user:{},admin:{}},uploadSettings:{moderate:{}},accessSettings:{},apiTokens:[],loading:!0,tokenLoading:!1,oriUserPassword:"",oriAdminPassword:"",showUserPassConfirm:!1,showAdminPassConfirm:!1,showCreateTokenDialog:!1,showEditTokenDialog:!1,showTokenResultDialog:!1,newToken:{name:"",owner:"",permissions:[]},editingToken:{id:"",name:"",owner:"",permissions:[]},createdToken:{name:"",token:""},userPassRules:{authCode:[{validator:(t,e,i)=>{const s=["%","&","?","#","/"],n=s.some(t=>e&&e.includes(t));n?i(new Error("密码不能包含部分URL保留字符: % & ? # /")):i()},trigger:"blur"}],confirmNewUserPassword:[{message:"请再次输入上传密码",trigger:"blur"},{validator:(t,e,i)=>{e&&e!==this.authSettings.user.authCode?i(new Error("两次输入密码不一致")):i()},trigger:"blur"}]},adminPassRules:{confirmNewAdminPassword:[{message:"请再次输入管理密码",trigger:"blur"},{validator:(t,e,i)=>{e&&e!==this.authSettings.admin.adminPassword?i(new Error("两次输入密码不一致")):i()},trigger:"blur"}]},tokenRules:{name:[{required:!0,message:"请输入Token名称",trigger:"blur"}],permissions:[{required:!0,message:"请选择权限",trigger:"change"}]}}},computed:{dialogWidth(){return window.innerWidth>768?"50%":"90%"}},methods:{handleUserPassInput(){this.authSettings.user.authCode!==this.oriUserPassword?this.showUserPassConfirm=!0:this.showUserPassConfirm=!1},handleAdminPassInput(){this.authSettings.admin.adminPassword!==this.oriAdminPassword?this.showAdminPassConfirm=!0:this.showAdminPassConfirm=!1},getPermissionText(t){const e={upload:"上传",delete:"删除",list:"列出"};return e[t]||t},formatDate(t){return new Date(t).toLocaleString("zh-CN")},async loadApiTokens(){this.tokenLoading=!0;try{const t=await(0,Ut.A)("/api/manage/apiTokens"),e=await t.json();this.apiTokens=e.tokens||[]}catch(t){this.$message.error("获取Token列表失败")}finally{this.tokenLoading=!1}},createToken(){this.$refs.tokenForm.validate(async t=>{if(t)try{this.newToken.owner="admin";const t=await(0,Ut.A)("/api/manage/apiTokens",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(this.newToken)}),e=await t.json();t.ok?(this.createdToken={name:e.name,token:e.token},this.showCreateTokenDialog=!1,this.showTokenResultDialog=!0,this.newToken={name:"",owner:"",permissions:[]},await this.loadApiTokens(),this.$message.success("Token创建成功")):this.$message.error(e.error||"Token创建失败")}catch(e){this.$message.error("Token创建失败")}})},editToken(t){this.editingToken={id:t.id,name:t.name,owner:t.owner,permissions:[...t.permissions]},this.showEditTokenDialog=!0},updateToken(){this.$refs.editTokenForm.validate(async t=>{if(t)try{const t=await(0,Ut.A)("/api/manage/apiTokens",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({tokenId:this.editingToken.id,permissions:this.editingToken.permissions})}),e=await t.json();t.ok?(this.showEditTokenDialog=!1,await this.loadApiTokens(),this.$message.success("Token权限更新成功")):this.$message.error(e.error||"Token更新失败")}catch(e){this.$message.error("Token更新失败")}})},async deleteToken(t){try{await this.$confirm("此操作将永久删除该Token是否继续","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"});const e=await(0,Ut.A)(`/api/manage/apiTokens?id=${t}`,{method:"DELETE"}),i=await e.json();e.ok?(await this.loadApiTokens(),this.$message.success("Token删除成功")):this.$message.error(i.error||"Token删除失败")}catch(e){"cancel"!==e&&this.$message.error("Token删除失败")}},async copyToken(){try{await navigator.clipboard.writeText(this.createdToken.token),this.$message.success("Token已复制到剪贴板")}catch(t){this.$message.error("复制失败,请手动复制")}},saveSettings(){let t=[];t.push(new Promise(t=>{this.$refs.userPassForm.validate(e=>{t(e)})})),t.push(new Promise(t=>{this.$refs.adminPassForm.validate(e=>{t(e)})})),Promise.all(t).then(t=>{const e=t.every(t=>t);if(!e)return;const i={auth:this.authSettings,upload:this.uploadSettings,access:this.accessSettings};delete i.auth.user.confirmNewUserPassword,delete i.auth.admin.confirmNewAdminPassword,(0,Ut.A)("/api/manage/sysConfig/security",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)}).then(()=>{this.$message.success("设置已保存"),this.oriUserPassword=this.authSettings.user.authCode,this.oriAdminPassword=this.authSettings.admin.adminPassword,this.showUserPassConfirm=!1,this.showAdminPassConfirm=!1})})}},mounted(){this.loading=!0,(0,Ut.A)("/api/manage/sysConfig/security").then(t=>t.json()).then(t=>{this.authSettings=t.auth,this.uploadSettings=t.upload,this.accessSettings=t.access,this.oriUserPassword=this.authSettings.user.authCode,this.oriAdminPassword=this.authSettings.admin.adminPassword,this.authSettings.user.confirmNewUserPassword="",this.authSettings.admin.confirmNewAdminPassword="",this.loadApiTokens()}).finally(()=>{this.loading=!1})}};const Mu=(0,c.A)(Fu,[["render",Su],["__scopeId","data-v-fdf607e4"]]);var Au=Mu;const Tu={class:"page-settings"},Pu={class:"first-title"};function Du(t,e,i,a,o,r){const l=(0,s.g2)("font-awesome-icon"),h=p.R7,c=sd.P9,d=sd.AV,u=nd.qi,g=id.WK,f=td.xE,m=td.US,b=nu,x=_.A;return(0,s.bo)(((0,s.uX)(),(0,s.CE)("div",Tu,[((0,s.uX)(!0),(0,s.CE)(s.FK,null,(0,s.pI)(r.groupedSettings,(t,e)=>((0,s.uX)(),(0,s.CE)("div",{key:e,class:"first-settings"},[(0,s.Lk)("h3",Pu,(0,n.v_)(e),1),(0,s.bF)(m,{model:o.settings,"label-width":"150px"},{default:(0,s.k6)(()=>[((0,s.uX)(!0),(0,s.CE)(s.FK,null,(0,s.pI)(t,(t,e)=>((0,s.uX)(),(0,s.Wv)(f,{key:t.id},{label:(0,s.k6)(()=>[(0,s.eW)((0,n.v_)(t.label)+" ",1),t.tooltip?((0,s.uX)(),(0,s.Wv)(h,{key:0,content:t.tooltip,placement:"top","raw-content":""},{default:(0,s.k6)(()=>[(0,s.bF)(l,{icon:"question-circle",style:{"margin-left":"5px",cursor:"pointer"}})]),_:1},8,["content"])):(0,s.Q3)("",!0)]),default:(0,s.k6)(()=>["select"===t.type?((0,s.uX)(),(0,s.Wv)(d,{key:0,modelValue:t.value,"onUpdate:modelValue":e=>t.value=e,disabled:t.fixed,placeholder:t.placeholder,style:{width:"100%"}},{default:(0,s.k6)(()=>[((0,s.uX)(!0),(0,s.CE)(s.FK,null,(0,s.pI)(t.options,t=>((0,s.uX)(),(0,s.Wv)(c,{key:t.value,label:t.label,value:t.value},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","disabled","placeholder"])):"channelName"===t.type?((0,s.uX)(),(0,s.Wv)(d,{key:1,modelValue:t.value,"onUpdate:modelValue":e=>t.value=e,disabled:!r.currentUploadChannel||0===r.currentChannelList.length,placeholder:"请先选择上传渠道",clearable:"",style:{width:"100%"}},{default:(0,s.k6)(()=>[((0,s.uX)(!0),(0,s.CE)(s.FK,null,(0,s.pI)(r.currentChannelList,t=>((0,s.uX)(),(0,s.Wv)(c,{key:t.name,label:t.name,value:t.name},null,8,["label","value"]))),128))]),_:1},8,["modelValue","onUpdate:modelValue","disabled"])):"boolean"===t.type?((0,s.uX)(),(0,s.Wv)(u,{key:2,modelValue:t.value,"onUpdate:modelValue":e=>t.value=e,disabled:t.fixed},null,8,["modelValue","onUpdate:modelValue","disabled"])):((0,s.uX)(),(0,s.Wv)(g,{key:3,modelValue:t.value,"onUpdate:modelValue":e=>t.value=e,disabled:t.fixed,placeholder:t.placeholder},null,8,["modelValue","onUpdate:modelValue","disabled","placeholder"]))]),_:2},1024))),128))]),_:2},1032,["model"])]))),128)),(0,s.bF)(b,{show:!o.loading,onClick:r.saveSettings},null,8,["show","onClick"])])),[[x,o.loading]])}var Eu=i(457),Lu={components:{FloatingSaveButton:nu},data(){return{settings:{config:[]},loading:!0,availableChannels:{}}},computed:{groupedSettings(){const t={};return this.settings.config&&this.settings.config.forEach(e=>{const i=e.category||"其他设置";t[i]||(t[i]=[]),t[i].push(e)}),t},currentUploadChannel(){const t=this.settings.config?.find(t=>"defaultUploadChannel"===t.id);return t?.value||""},currentChannelList(){return this.availableChannels[this.currentUploadChannel]||[]}},watch:{currentUploadChannel(t,e){if(t!==e){const e=this.settings.config?.find(t=>"defaultChannelName"===t.id);if(e){const i=this.availableChannels[t]||[];i.some(t=>t.name===e.value)||(e.value="")}}}},methods:{saveSettings(){(0,Ut.A)("/api/manage/sysConfig/page",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(this.settings)}).then(()=>this.$message.success("设置已保存"))},async fetchAvailableChannels(){try{const t=await Eu.A.get("/api/channels");t.data&&(this.availableChannels=t.data)}catch(t){console.error("Failed to fetch available channels:",t)}}},mounted(){this.loading=!0,this.fetchAvailableChannels(),(0,Ut.A)("/api/manage/sysConfig/page").then(t=>t.json()).then(t=>{this.settings=t,this.settings.config&&this.settings.config.forEach(t=>{"boolean"===t.type&&("string"===typeof t.value?t.value="true"===t.value:void 0!==t.value&&null!==t.value||(t.value=t.default||!1))})}).finally(()=>{this.loading=!1})}};const Iu=(0,c.A)(Lu,[["render",Du],["__scopeId","data-v-44bd640d"]]);var Vu=Iu;const Ou={class:"others-settings"},Ru={class:"first-settings"},Wu={class:"first-title"},Bu={class:"first-title"},zu={class:"first-title"},Nu={class:"first-title"},Uu={class:"first-title"};function $u(t,e,i,n,a,o){const r=(0,s.g2)("font-awesome-icon"),l=p.R7,h=nd.qi,c=td.xE,d=td.US,u=id.WK,g=sd.P9,f=sd.AV,m=nu,b=_.A;return(0,s.bo)(((0,s.uX)(),(0,s.CE)("div",Ou,[(0,s.Lk)("div",Ru,[(0,s.Lk)("h3",Wu,[e[13]||(e[13]=(0,s.eW)("远端遥测 ",-1)),(0,s.bF)(l,{content:"便于问题查找和定位,建议开启",placement:"right"},{default:(0,s.k6)(()=>[(0,s.bF)(r,{icon:"question-circle",style:{"margin-left":"5px",cursor:"pointer"}})]),_:1})]),(0,s.bF)(d,{model:a.settings.telemetry,"label-width":"120px"},{default:(0,s.k6)(()=>[(0,s.bF)(c,{label:"启用"},{default:(0,s.k6)(()=>[(0,s.bF)(h,{modelValue:a.settings.telemetry.enabled,"onUpdate:modelValue":e[0]||(e[0]=t=>a.settings.telemetry.enabled=t),disabled:a.settings.telemetry.fixed},null,8,["modelValue","disabled"])]),_:1})]),_:1},8,["model"]),(0,s.Lk)("h3",Bu,[e[14]||(e[14]=(0,s.eW)("随机图像API ",-1)),(0,s.bF)(l,{content:"API具体用法请查阅文档",placement:"right"},{default:(0,s.k6)(()=>[(0,s.bF)(r,{icon:"question-circle",style:{"margin-left":"5px",cursor:"pointer"}})]),_:1})]),(0,s.bF)(d,{model:a.settings.randomImageAPI,"label-width":"120px"},{default:(0,s.k6)(()=>[(0,s.bF)(c,{label:"启用"},{default:(0,s.k6)(()=>[(0,s.bF)(h,{modelValue:a.settings.randomImageAPI.enabled,"onUpdate:modelValue":e[1]||(e[1]=t=>a.settings.randomImageAPI.enabled=t),disabled:a.settings.randomImageAPI.fixed},null,8,["modelValue","disabled"])]),_:1}),(0,s.bF)(c,{prop:"randomImageAPI.allowedDir"},{label:(0,s.k6)(()=>[e[15]||(e[15]=(0,s.Lk)("span",null,"目录",-1)),(0,s.bF)(l,{content:"1. 开放随机图权限的目录,默认为根目录,多个目录用逗号分隔 <br/> 2. 目录均采用绝对路径,例如/img/cover表示该目录及其所有子目录的文件可被随机图API访问",placement:"right","raw-content":""},{default:(0,s.k6)(()=>[(0,s.bF)(r,{icon:"question-circle",style:{"margin-left":"5px",cursor:"pointer"}})]),_:1})]),default:(0,s.k6)(()=>[(0,s.bF)(u,{modelValue:a.settings.randomImageAPI.allowedDir,"onUpdate:modelValue":e[2]||(e[2]=t=>a.settings.randomImageAPI.allowedDir=t),disabled:a.settings.randomImageAPI.fixed},null,8,["modelValue","disabled"])]),_:1})]),_:1},8,["model"]),(0,s.Lk)("h3",zu,[e[16]||(e[16]=(0,s.eW)("访客图库 ",-1)),(0,s.bF)(l,{content:"启用后,访客可通过 /browse 路径浏览指定目录的图片(只读,无法删除/移动)",placement:"right","raw-content":""},{default:(0,s.k6)(()=>[(0,s.bF)(r,{icon:"question-circle",style:{"margin-left":"5px",cursor:"pointer"}})]),_:1})]),(0,s.bF)(d,{model:a.settings.publicBrowse,"label-width":"120px"},{default:(0,s.k6)(()=>[(0,s.bF)(c,{label:"启用"},{default:(0,s.k6)(()=>[(0,s.bF)(h,{modelValue:a.settings.publicBrowse.enabled,"onUpdate:modelValue":e[3]||(e[3]=t=>a.settings.publicBrowse.enabled=t),disabled:a.settings.publicBrowse.fixed},null,8,["modelValue","disabled"])]),_:1}),(0,s.bF)(c,{prop:"publicBrowse.allowedDir"},{label:(0,s.k6)(()=>[e[18]||(e[18]=(0,s.Lk)("span",null,"开放目录",-1)),(0,s.bF)(l,{placement:"right","raw-content":""},{content:(0,s.k6)(()=>[...e[17]||(e[17]=[(0,s.Lk)("div",{style:{"max-width":"320px","line-height":"1.6"}},[(0,s.Lk)("p",{style:{margin:"0 0 8px 0"}},[(0,s.Lk)("b",null,"允许公开浏览的目录,多个目录用逗号分隔")]),(0,s.Lk)("p",{style:{margin:"0 0 8px 0"}},"示例wallpaper,photos,album"),(0,s.Lk)("p",{style:{margin:"0 0 8px 0",color:"#909399"}},"支持子目录2026/lucky,2026/rich"),(0,s.Lk)("p",{style:{margin:"0",color:"#67c23a"}},"访问链接https://你的域名/browse/2026/lucky")],-1)])]),default:(0,s.k6)(()=>[(0,s.bF)(r,{icon:"question-circle",style:{"margin-left":"5px",cursor:"pointer"}})]),_:1})]),default:(0,s.k6)(()=>[(0,s.bF)(u,{modelValue:a.settings.publicBrowse.allowedDir,"onUpdate:modelValue":e[4]||(e[4]=t=>a.settings.publicBrowse.allowedDir=t),disabled:a.settings.publicBrowse.fixed,placeholder:"wallpaper,photos,album"},null,8,["modelValue","disabled"])]),_:1})]),_:1},8,["model"]),(0,s.Lk)("h3",Nu,[e[19]||(e[19]=(0,s.eW)("CloudFlare API Token ",-1)),(0,s.bF)(l,{content:"设置后可以使后端拉黑、删除等操作不受CDN缓存限制 <br/> 建议设置,设置方式请查阅文档",placement:"right","raw-content":""},{default:(0,s.k6)(()=>[(0,s.bF)(r,{icon:"question-circle",style:{"margin-left":"5px",cursor:"pointer"}})]),_:1})]),(0,s.bF)(d,{model:a.settings.cloudflareApiToken,"label-width":"120px"},{default:(0,s.k6)(()=>[(0,s.bF)(c,{label:"区域ID"},{default:(0,s.k6)(()=>[(0,s.bF)(u,{modelValue:a.settings.cloudflareApiToken.CF_ZONE_ID,"onUpdate:modelValue":e[5]||(e[5]=t=>a.settings.cloudflareApiToken.CF_ZONE_ID=t),disabled:a.settings.cloudflareApiToken.fixed},null,8,["modelValue","disabled"])]),_:1}),(0,s.bF)(c,{label:"账户邮箱"},{default:(0,s.k6)(()=>[(0,s.bF)(u,{modelValue:a.settings.cloudflareApiToken.CF_EMAIL,"onUpdate:modelValue":e[6]||(e[6]=t=>a.settings.cloudflareApiToken.CF_EMAIL=t),disabled:a.settings.cloudflareApiToken.fixed},null,8,["modelValue","disabled"])]),_:1}),(0,s.bF)(c,{label:"API Key"},{default:(0,s.k6)(()=>[(0,s.bF)(u,{modelValue:a.settings.cloudflareApiToken.CF_API_KEY,"onUpdate:modelValue":e[7]||(e[7]=t=>a.settings.cloudflareApiToken.CF_API_KEY=t),disabled:a.settings.cloudflareApiToken.fixed,type:"password","show-password":"",autocomplete:"new-password"},null,8,["modelValue","disabled"])]),_:1})]),_:1},8,["model"]),(0,s.Lk)("h3",Uu,[e[20]||(e[20]=(0,s.eW)("WebDAV ",-1)),(0,s.bF)(l,{content:"启用后可以通过WebDAV协议访问和管理图片",placement:"right","raw-content":""},{default:(0,s.k6)(()=>[(0,s.bF)(r,{icon:"question-circle",style:{"margin-left":"5px",cursor:"pointer"}})]),_:1})]),(0,s.bF)(d,{model:a.settings.webDAV,"label-width":"120px"},{default:(0,s.k6)(()=>[(0,s.bF)(c,{label:"启用"},{default:(0,s.k6)(()=>[(0,s.bF)(h,{modelValue:a.settings.webDAV.enabled,"onUpdate:modelValue":e[8]||(e[8]=t=>a.settings.webDAV.enabled=t),disabled:a.settings.webDAV.fixed},null,8,["modelValue","disabled"])]),_:1}),(0,s.bF)(c,{label:"用户名"},{default:(0,s.k6)(()=>[(0,s.bF)(u,{modelValue:a.settings.webDAV.username,"onUpdate:modelValue":e[9]||(e[9]=t=>a.settings.webDAV.username=t),disabled:a.settings.webDAV.fixed},null,8,["modelValue","disabled"])]),_:1}),(0,s.bF)(c,{label:"密码"},{default:(0,s.k6)(()=>[(0,s.bF)(u,{modelValue:a.settings.webDAV.password,"onUpdate:modelValue":e[10]||(e[10]=t=>a.settings.webDAV.password=t),disabled:a.settings.webDAV.fixed,type:"password","show-password":"",autocomplete:"new-password"},null,8,["modelValue","disabled"])]),_:1}),(0,s.bF)(c,{label:"上传渠道"},{default:(0,s.k6)(()=>[(0,s.bF)(f,{modelValue:a.settings.webDAV.uploadChannel,"onUpdate:modelValue":e[11]||(e[11]=t=>a.settings.webDAV.uploadChannel=t),disabled:a.settings.webDAV.fixed,placeholder:"默认渠道",clearable:""},{default:(0,s.k6)(()=>[(0,s.bF)(g,{label:"Telegram",value:"telegram"}),(0,s.bF)(g,{label:"Cloudflare R2",value:"cfr2"}),(0,s.bF)(g,{label:"S3",value:"s3"}),(0,s.bF)(g,{label:"Discord",value:"discord"}),(0,s.bF)(g,{label:"HuggingFace",value:"huggingface"})]),_:1},8,["modelValue","disabled"])]),_:1}),a.settings.webDAV.uploadChannel&&o.webdavChannelList.length>1?((0,s.uX)(),(0,s.Wv)(c,{key:0,label:"指定渠道名"},{default:(0,s.k6)(()=>[(0,s.bF)(f,{modelValue:a.settings.webDAV.channelName,"onUpdate:modelValue":e[12]||(e[12]=t=>a.settings.webDAV.channelName=t),disabled:a.settings.webDAV.fixed,placeholder:"自动选择",clearable:""},{default:(0,s.k6)(()=>[((0,s.uX)(!0),(0,s.CE)(s.FK,null,(0,s.pI)(o.webdavChannelList,t=>((0,s.uX)(),(0,s.Wv)(g,{key:t.name,label:t.name,value:t.name},null,8,["label","value"]))),128))]),_:1},8,["modelValue","disabled"])]),_:1})):(0,s.Q3)("",!0)]),_:1},8,["model"])]),(0,s.bF)(m,{show:!a.loading,onClick:o.saveSettings},null,8,["show","onClick"])])),[[b,a.loading]])}var ju={components:{FloatingSaveButton:nu},data(){return{settings:{telemetry:{},randomImageAPI:{},cloudflareApiToken:{},webDAV:{},publicBrowse:{}},availableChannels:{},loading:!0}},computed:{webdavChannelList(){const t=this.settings.webDAV?.uploadChannel;return t&&this.availableChannels[t]||[]}},watch:{"settings.webDAV.uploadChannel"(){this.settings.webDAV&&(this.settings.webDAV.channelName="")}},methods:{saveSettings(){(0,Ut.A)("/api/manage/sysConfig/others",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(this.settings)}).then(()=>this.$message.success("设置已保存"))},async fetchAvailableChannels(){try{const t=await(0,Ut.A)("/api/channels");t.ok&&(this.availableChannels=await t.json())}catch(t){console.error("Failed to fetch available channels:",t)}}},mounted(){this.loading=!0,(0,Ut.A)("/api/manage/sysConfig/others").then(t=>t.json()).then(t=>{this.settings=t}).finally(()=>{this.loading=!1}),this.fetchAvailableChannels()}};const Hu=(0,c.A)(ju,[["render",$u],["__scopeId","data-v-0cedb60a"]]);var Xu=Hu,qu={name:"SystemConfig",data(){return{activeIndex:"status",isSidebarCollapse:!1}},watch:{"$route.hash":{immediate:!0,handler(t){this.activeIndex=t.replace("#",""),window.scrollTo(0,0)}},activeIndex(t){const e=`#${t}`;this.$router.push({hash:e})}},components:{DashboardTabs:f.A,SysConfigTabs:u,SysCogStatus:Gc,SysCogUpload:Jd,SysCogSecurity:Au,SysCogPage:Vu,SysCogOthers:Xu},computed:{disableTooltip(){return window.innerWidth<768},currentComponent(){const t=this.$route.hash.replace("#","");switch(t){case"status":return Gc;case"upload":return Jd;case"security":return Au;case"page":return Vu;case"others":return Xu;default:return Gc}}},methods:{handleLogout(){this.$store.commit("setCredentials",null),this.$router.push("/adminLogin")},setDefaultHash(){const t="#status";window.location.hash=t,this.activeIndex=t.replace("#","")}},mounted(){window.location.hash||this.setDefaultHash()}};const Ku=(0,c.A)(qu,[["render",y],["__scopeId","data-v-4cdf1dc2"]]);var Yu=Ku},5616:function(t,e,i){i(5331),i(7197)},5802:function(t,e,i){i(5331),i(8736),i(213),i(5970)}}]);
//# sourceMappingURL=226.478c43ad.js.map