Files
CloudFlare-ImgBed/frontend-dist/js/161.2f01a91a.js
T

23 lines
403 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([[161],{2893:function(e,t,s){s(85331)},3261:function(e,t,s){s(85331)},4885:function(e,t,s){s(85331)},5802:function(e,t,s){s(85331),s(38736),s(213),s(85970)},34396:function(e,t,s){s(85331),s(4885)},39161:function(e,t,s){s.r(t),s.d(t,{default:function(){return ef}});var i=s(48789),a=s(56768),n=s(24232);const o={class:"menu-list"},l=["onClick"],r={class:"menu-icon"},d={class:"menu-text"};function c(e,t,s,c,h,u){const p=i.A,g=(0,a.g2)("font-awesome-icon");return(0,a.uX)(),(0,a.CE)("div",{class:(0,n.C4)(["sidebar-container",{"is-collapsed":s.isCollapse}]),ref:"sidebar",style:(0,n.Tr)(u.sidebarStyle)},[(0,a.Lk)("div",o,[((0,a.uX)(!0),(0,a.CE)(a.FK,null,(0,a.pI)(h.menuItems,t=>((0,a.uX)(),(0,a.CE)("div",{key:t.index,class:(0,n.C4)(["menu-item",{"is-active":s.activeIndex===t.index}]),onClick:e=>u.handleSelect(t.index)},[(0,a.Lk)("span",r,["ai"===t.index?((0,a.uX)(),(0,a.Wv)(p,{key:0,class:"menu-glyph"})):((0,a.uX)(),(0,a.Wv)(g,{key:1,icon:t.icon,class:"menu-glyph"},null,8,["icon"]))]),(0,a.Lk)("span",d,(0,n.v_)(e.$t(t.titleKey)),1)],10,l))),128))]),(0,a.Lk)("div",{class:"toggle-button",onClick:t[0]||(t[0]=(...e)=>u.toggleCollapse&&u.toggleCollapse(...e))},[(0,a.bF)(g,{icon:s.isCollapse?"angle-double-right":"angle-double-left"},null,8,["icon"])])],6)}var h={name:"SysConfigTabs",components:{AIIcon:i.A},props:{activeIndex:{type:String,default:"status"},isCollapse:{type:Boolean,default:!1}},data(){return{expandedWidth:null,menuItems:[{index:"status",icon:"chart-bar",titleKey:"sysConfigTabs.systemStatus"},{index:"upload",icon:"cloud-upload",titleKey:"sysConfigTabs.uploadSettings"},{index:"security",icon:"shield",titleKey:"sysConfigTabs.securitySettings"},{index:"page",icon:"pager",titleKey:"sysConfigTabs.pageSettings"},{index:"ai",titleKey:"sysAI.title"},{index:"others",icon:"cog",titleKey:"sysConfigTabs.otherSettings"}]}},computed:{collapsedWidth(){return window.innerWidth<=768?50:56},sidebarStyle(){return this.isCollapse?{width:this.collapsedWidth+"px"}:this.expandedWidth?{width:this.expandedWidth+"px"}:{}}},watch:{"$i18n.locale"(){this.$nextTick(()=>this.measureWidth())}},methods:{toggleCollapse(){this.$emit("update:isCollapse",!this.isCollapse)},checkMobile(){const e=window.innerWidth<=768;this.$emit("update:isCollapse",e)},handleSelect(e){this.$emit("update:activeIndex",e)},measureWidth(){const e=this.$refs.sidebar;if(!e)return;const t=e.style.width,s=e.style.transition,i=e.classList.contains("is-collapsed");e.style.transition="none",i&&e.classList.remove("is-collapsed"),e.style.width="auto",e.offsetWidth;const a=e.scrollWidth;e.style.width=t,i&&e.classList.add("is-collapsed"),e.offsetWidth,e.style.transition=s,this.expandedWidth=a}},mounted(){this.checkMobile(),this.$nextTick(()=>this.measureWidth()),window.addEventListener("resize",this.checkMobile)},beforeUnmount(){window.removeEventListener("resize",this.checkMobile)}},u=s(71241);const p=(0,u.A)(h,[["render",c],["__scopeId","data-v-7e86d3a2"]]);var g=p,m=s(78370);const f={class:"container"};function b(e,t,s,i,o,l){const r=m.A,d=g;return(0,a.uX)(),(0,a.CE)("div",f,[(0,a.bF)(r,{"active-tab":"systemConfig"}),(0,a.bF)(d,{activeIndex:o.activeIndex,"onUpdate:activeIndex":t[0]||(t[0]=e=>o.activeIndex=e),isCollapse:o.isSidebarCollapse,"onUpdate:isCollapse":t[1]||(t[1]=e=>o.isSidebarCollapse=e)},null,8,["activeIndex","isCollapse"]),((0,a.uX)(),(0,a.Wv)((0,a.$y)(l.currentComponent),{class:(0,n.C4)(["main-container",{collapsed:o.isSidebarCollapse}])},null,8,["class"]))])}s(44114);var y=s(99114),v=(s(85331),s(30694),s(57009)),x=(s(78450),s(78507)),k=(s(213),s(69655)),_=(s(2893),s(9267)),w=(s(15616),s(45130));const C={class:"date-range-calendar"},S={class:"selected-range"},F={class:"selected-range-inputs"},T=["aria-label"],A={class:"date-range-separator"},M=["aria-label"],P={class:"calendar-header"},$=["aria-label"],D={class:"calendar-title"},V=["aria-label"],L={class:"calendar-weekdays"},E={class:"calendar-grid"},I=["onClick"];function U(e,t,s,i,o,l){const r=(0,a.g2)("font-awesome-icon");return(0,a.uX)(),(0,a.CE)("div",C,[(0,a.Lk)("div",S,[(0,a.Lk)("div",F,[(0,a.bo)((0,a.Lk)("input",{"onUpdate:modelValue":t[0]||(t[0]=e=>o.inputStart=e),class:"date-input",type:"text",inputmode:"numeric","aria-label":l.startDateLabel,onChange:t[1]||(t[1]=(...e)=>l.handleManualInput&&l.handleManualInput(...e))},null,40,T),[[w.Jo,o.inputStart,void 0,{trim:!0}]]),(0,a.Lk)("span",A,(0,n.v_)(l.rangeSeparator),1),(0,a.bo)((0,a.Lk)("input",{"onUpdate:modelValue":t[2]||(t[2]=e=>o.inputEnd=e),class:"date-input",type:"text",inputmode:"numeric","aria-label":l.endDateLabel,onChange:t[3]||(t[3]=(...e)=>l.handleManualInput&&l.handleManualInput(...e))},null,40,M),[[w.Jo,o.inputEnd,void 0,{trim:!0}]])])]),(0,a.Lk)("div",P,[(0,a.Lk)("button",{type:"button",class:"calendar-nav","aria-label":l.previousMonthLabel,onClick:t[4]||(t[4]=(...e)=>l.goToPreviousMonth&&l.goToPreviousMonth(...e))},[(0,a.bF)(r,{icon:"chevron-left"})],8,$),(0,a.Lk)("div",D,(0,n.v_)(l.monthTitle),1),(0,a.Lk)("button",{type:"button",class:"calendar-nav","aria-label":l.nextMonthLabel,onClick:t[5]||(t[5]=(...e)=>l.goToNextMonth&&l.goToNextMonth(...e))},[(0,a.bF)(r,{icon:"chevron-right"})],8,V)]),(0,a.Lk)("div",L,[((0,a.uX)(!0),(0,a.CE)(a.FK,null,(0,a.pI)(l.weekdayLabels,e=>((0,a.uX)(),(0,a.CE)("span",{key:e},(0,n.v_)(e),1))),128))]),(0,a.Lk)("div",E,[((0,a.uX)(!0),(0,a.CE)(a.FK,null,(0,a.pI)(l.calendarDays,e=>((0,a.uX)(),(0,a.CE)("button",{key:e.key,type:"button",class:(0,n.C4)(["calendar-day",{"is-muted":!e.isCurrentMonth,"is-today":e.isToday,"is-range-start":e.key===o.draftStart,"is-range-end":e.key===o.draftEnd,"is-in-range":l.isInRange(e.key)}]),onClick:t=>l.selectDay(e.key)},(0,n.v_)(e.dayOfMonth),11,I))),128))])])}const O=864e5;function R(e){return String(e).padStart(2,"0")}function W(e){return`${e.getFullYear()}-${R(e.getMonth()+1)}-${R(e.getDate())}`}function N(e){if("string"!==typeof e)return null;const t=e.trim().match(/^(\d{4})[-/](\d{1,2})[-/](\d{1,2})$/);if(!t)return null;const s=Number(t[1]),i=Number(t[2])-1,a=Number(t[3]),n=new Date(s,i,a);return n.getFullYear()!==s||n.getMonth()!==i||n.getDate()!==a?null:(n.setHours(0,0,0,0),n)}function z(e,t){return new Date(e.getFullYear(),e.getMonth()+t,1)}var B={name:"DateRangeCalendar",props:{modelValue:{type:Array,default:()=>[]}},emits:["update:modelValue","change"],data(){const e=new Date;return e.setHours(0,0,0,0),{displayYear:e.getFullYear(),displayMonth:e.getMonth(),draftStart:"",draftEnd:"",inputStart:"",inputEnd:"",awaitingEnd:!1}},computed:{previousMonthLabel(){return this.$t("dateRangeCalendar.previousMonth")},nextMonthLabel(){return this.$t("dateRangeCalendar.nextMonth")},startDateLabel(){return this.$t("dateRangeCalendar.startDate")},endDateLabel(){return this.$t("dateRangeCalendar.endDate")},rangeSeparator(){return this.$t("dateRangeCalendar.rangeSeparator")},monthTitle(){return this.$t("dateRangeCalendar.monthTitle",{year:this.displayYear,month:R(this.displayMonth+1)})},weekdayLabels(){return[this.$t("dateRangeCalendar.weekdaySun"),this.$t("dateRangeCalendar.weekdayMon"),this.$t("dateRangeCalendar.weekdayTue"),this.$t("dateRangeCalendar.weekdayWed"),this.$t("dateRangeCalendar.weekdayThu"),this.$t("dateRangeCalendar.weekdayFri"),this.$t("dateRangeCalendar.weekdaySat")]},calendarDays(){const e=new Date(this.displayYear,this.displayMonth,1),t=new Date(this.displayYear,this.displayMonth,1-e.getDay()),s=W(new Date);return Array.from({length:42},(e,i)=>{const a=new Date(t.getTime()+i*O),n=W(a);return{key:n,dayOfMonth:a.getDate(),isCurrentMonth:a.getMonth()===this.displayMonth,isToday:n===s}})}},watch:{modelValue:{immediate:!0,handler(e){this.syncFromModel(e)}}},methods:{syncFromModel(e){const t=N(e?.[0]),s=N(e?.[1]);this.draftStart=t?W(t):"",this.draftEnd=s?W(s):"",this.inputStart=this.draftStart,this.inputEnd=this.draftEnd,this.awaitingEnd=!1;const i=t||s;i&&(this.displayYear=i.getFullYear(),this.displayMonth=i.getMonth())},goToPreviousMonth(){const e=z(new Date(this.displayYear,this.displayMonth,1),-1);this.displayYear=e.getFullYear(),this.displayMonth=e.getMonth()},goToNextMonth(){const e=z(new Date(this.displayYear,this.displayMonth,1),1);this.displayYear=e.getFullYear(),this.displayMonth=e.getMonth()},selectDay(e){if(!this.draftStart||this.draftEnd||!this.awaitingEnd)return this.draftStart=e,this.draftEnd="",this.inputStart=e,this.inputEnd="",void(this.awaitingEnd=!0);const t=e<this.draftStart?[e,this.draftStart]:[this.draftStart,e];this.draftStart=t[0],this.draftEnd=t[1],this.inputStart=t[0],this.inputEnd=t[1],this.awaitingEnd=!1,this.commitRange(t)},handleManualInput(){const e=N(this.inputStart),t=N(this.inputEnd);if(!e||!t)return;const s=W(e),i=W(t),a=s<=i?[s,i]:[i,s];this.draftStart=a[0],this.draftEnd=a[1],this.inputStart=a[0],this.inputEnd=a[1],this.awaitingEnd=!1,this.displayYear=e.getFullYear(),this.displayMonth=e.getMonth(),this.commitRange(a)},commitRange(e){this.$emit("update:modelValue",e),this.$emit("change",e)},isInRange(e){return Boolean(this.draftStart&&this.draftEnd&&e>this.draftStart&&e<this.draftEnd)}}};const j=(0,u.A)(B,[["render",U],["__scopeId","data-v-58bbd7a9"]]);var H=j,q=s(66810),X=(s(34396),s(3261),s(80047));s(99648);const K={class:"status-panel"},Q=["aria-label"],Y={class:"status-hero-copy"},G={class:"status-hero-kicker"},J={class:"system-health-badge","aria-live":"polite"},Z={class:"status-hero-date"},ee={class:"status-hero-title"},te={class:"status-hero-summary","aria-live":"polite"},se={class:"status-hero-time-card"},ie={class:"status-hero-time-caption"},ae=["datetime"],ne={class:"status-hero-timezone"},oe={class:"overview-cards"},le={class:"card-icon"},re={class:"card-content"},de={class:"card-title"},ce={class:"card-value"},he={class:"card-subtitle"},ue={class:"overview-card index-status"},pe={class:"card-icon"},ge={class:"card-content"},me={class:"card-title"},fe={class:"card-value"},be={class:"card-subtitle"},ye={class:"card-icon"},ve={class:"card-content"},xe={class:"card-title"},ke={class:"card-value"},_e={class:"card-subtitle"},we={class:"charts-section"},Ce={class:"chart-card trend-chart-card"},Se={class:"chart-header trend-chart-header"},Fe={class:"chart-title"},Te={class:"trend-controls"},Ae={class:"trend-date-panel"},Me={class:"chart-content trend-chart-content"},Pe={key:0,class:"empty-state trend-empty-state"},$e={key:1,class:"line-chart-wrapper"},De={class:"chart-card"},Ve={class:"chart-header"},Le={class:"chart-content"},Ee={key:0,class:"empty-state"},Ie={key:1,class:"pie-chart-container"},Ue={class:"pie-chart-wrapper"},Oe={class:"chart-center-text"},Re={class:"center-value"},We={class:"center-label"},Ne={class:"chart-legend"},ze={class:"legend-label"},Be={class:"legend-value"},je={class:"legend-percent"},He={class:"chart-card"},qe={class:"chart-header"},Xe={class:"chart-content"},Ke={key:0,class:"empty-state"},Qe={key:1,class:"pie-chart-container"},Ye={class:"pie-chart-wrapper"},Ge={class:"chart-center-text"},Je={class:"center-value"},Ze={class:"center-label"},et={class:"chart-legend"},tt={class:"legend-label"},st={class:"legend-value"},it={class:"legend-percent"},at={class:"actions-section"},nt={class:"action-card"},ot={class:"action-header"},lt={class:"action-content"},rt={key:0,class:"progress-container"},dt={class:"progress-header"},ct={class:"progress-phase"},ht={class:"progress-percentage"},ut={class:"progress-details"},pt={key:0,class:"progress-count"},gt={key:1,class:"progress-time"},mt={key:0,class:"progress-message"},ft={key:1,class:"error-container"},bt={class:"error-icon"},yt={class:"error-content"},vt={class:"error-message"},xt={key:0,class:"error-suggestion"},kt={class:"error-actions"},_t={key:2,class:"action-buttons"},wt={class:"restore-section"},Ct={key:0,class:"file-info-section"},St=["src"],Ft={key:2,class:"card-bg-fallback"},Tt={class:"file-card-header"},At={class:"info-card-footer"},Mt={class:"file-name"},Pt={class:"file-meta"},$t=["src"],Dt={key:2,class:"card-bg-fallback"},Vt={class:"file-card-header warning"},Lt={class:"info-card-footer"},Et={class:"file-name"},It={class:"file-meta"};function Ut(e,t,s,i,o,l){const r=(0,a.g2)("font-awesome-icon"),d=X.S2,c=q.Zh,h=q.MQ,u=H,p=_.kZ,g=(0,a.g2)("Line"),m=(0,a.g2)("Doughnut"),f=k.ve,b=x.R7,w=v.Zq,C=y.A;return(0,a.bo)(((0,a.uX)(),(0,a.CE)("div",K,[(0,a.Lk)("section",{class:(0,n.C4)(["status-hero",`is-${l.systemHealthState}`]),"aria-label":e.$t("sysStatus.systemOverview")},[(0,a.Lk)("div",Y,[(0,a.Lk)("div",G,[(0,a.Lk)("span",J,[t[12]||(t[12]=(0,a.Lk)("span",{class:"system-health-dot","aria-hidden":"true"},null,-1)),(0,a.eW)(" "+(0,n.v_)(l.systemHealthLabel),1)]),(0,a.Lk)("span",Z,(0,n.v_)(l.currentDateLabel),1)]),(0,a.Lk)("h1",ee,(0,n.v_)(l.greetingTitle),1),(0,a.Lk)("p",te,(0,n.v_)(l.systemStatusSummary),1)]),(0,a.Lk)("div",se,[(0,a.Lk)("span",ie,(0,n.v_)(e.$t("sysStatus.localTime")),1),(0,a.Lk)("time",{class:"status-hero-time",datetime:o.currentTime.toISOString()},(0,n.v_)(l.currentTimeLabel),9,ae),(0,a.Lk)("span",ne,(0,n.v_)(l.timeZoneLabel),1)])],10,Q),(0,a.Lk)("div",oe,[(0,a.Lk)("div",{class:"overview-card total-files",onClick:t[0]||(t[0]=(...e)=>l.fetchIndexInfo&&l.fetchIndexInfo(...e))},[(0,a.Lk)("div",le,[(0,a.bF)(r,{icon:"database"})]),(0,a.Lk)("div",re,[(0,a.Lk)("div",de,(0,n.v_)(e.$t("sysStatus.totalFiles")),1),(0,a.Lk)("div",ce,(0,n.v_)(o.indexInfo.totalFiles?.toLocaleString()||"0"),1),(0,a.Lk)("div",he,(0,n.v_)(e.$t("sysStatus.clickToRefresh")),1)])]),(0,a.Lk)("div",ue,[(0,a.Lk)("div",pe,[(0,a.bF)(r,{icon:"clock"})]),(0,a.Lk)("div",ge,[(0,a.Lk)("div",me,(0,n.v_)(e.$t("sysStatus.indexUpdateTime")),1),(0,a.Lk)("div",fe,(0,n.v_)(l.formatTime(o.indexInfo.lastUpdated)),1),(0,a.Lk)("div",be,(0,n.v_)(l.getTimeAgo(o.indexInfo.lastUpdated)),1)])]),(0,a.Lk)("div",{class:"overview-card system-version",onClick:t[1]||(t[1]=(...e)=>l.openReleases&&l.openReleases(...e))},[(0,a.Lk)("div",ye,[(0,a.bF)(r,{icon:"code-branch"})]),(0,a.Lk)("div",ve,[(0,a.Lk)("div",xe,(0,n.v_)(e.$t("sysStatus.systemVersion")),1),(0,a.Lk)("div",ke,"v"+(0,n.v_)(o.version),1),(0,a.Lk)("div",_e,(0,n.v_)(e.$t("sysStatus.clickToViewChangelog")),1)])])]),(0,a.Lk)("div",we,[(0,a.Lk)("div",Ce,[(0,a.Lk)("div",Se,[(0,a.Lk)("div",Fe,[(0,a.bF)(r,{icon:"chart-line"}),(0,a.Lk)("span",null,(0,n.v_)(e.$t("sysStatus.uploadTrend")),1),(0,a.bF)(d,{class:"trend-calendar-btn",circle:"","aria-label":e.$t("sysStatus.selectDateRange"),onClick:l.openTrendDateDialog},{default:(0,a.k6)(()=>[(0,a.bF)(r,{icon:"calendar"})]),_:1},8,["aria-label","onClick"])]),(0,a.Lk)("div",Te,[(0,a.bF)(h,{modelValue:o.trendGroupBy,"onUpdate:modelValue":t[2]||(t[2]=e=>o.trendGroupBy=e),size:"small",class:"trend-group-switch","aria-label":e.$t("sysStatus.uploadTrendGroupBy")},{default:(0,a.k6)(()=>[(0,a.bF)(c,{label:"channel"},{default:(0,a.k6)(()=>[(0,a.eW)((0,n.v_)(e.$t("sysStatus.byChannelType")),1)]),_:1}),(0,a.bF)(c,{label:"channelName"},{default:(0,a.k6)(()=>[(0,a.eW)((0,n.v_)(e.$t("sysStatus.byChannelName")),1)]),_:1})]),_:1},8,["modelValue","aria-label"])])]),(0,a.bF)(p,{modelValue:o.trendDatePickerVisible,"onUpdate:modelValue":t[4]||(t[4]=e=>o.trendDatePickerVisible=e),title:e.$t("sysStatus.selectDateRange"),width:l.trendDateDialogWidth,class:"trend-date-dialog","align-center":"","append-to-body":""},{default:(0,a.k6)(()=>[(0,a.Lk)("div",Ae,[(0,a.bF)(u,{modelValue:o.trendDateRange,"onUpdate:modelValue":t[3]||(t[3]=e=>o.trendDateRange=e),onChange:l.handleTrendDateRangeChange},null,8,["modelValue","onChange"])])]),_:1},8,["modelValue","title","width"]),(0,a.Lk)("div",Me,[l.hasTrendData?((0,a.uX)(),(0,a.CE)("div",$e,[(0,a.bF)(g,{data:l.uploadTrendChartData,options:l.lineChartOptions},null,8,["data","options"])])):((0,a.uX)(),(0,a.CE)("div",Pe,[(0,a.bF)(r,{icon:"inbox"}),(0,a.Lk)("span",null,(0,n.v_)(e.$t("sysStatus.noData")),1)]))])]),(0,a.Lk)("div",De,[(0,a.Lk)("div",Ve,[(0,a.bF)(r,{icon:"share-alt"}),(0,a.Lk)("span",null,(0,n.v_)(e.$t("sysStatus.channelDistribution")),1)]),(0,a.Lk)("div",Le,[0===Object.keys(o.indexInfo.channelStats||{}).length?((0,a.uX)(),(0,a.CE)("div",Ee,[(0,a.bF)(r,{icon:"inbox"}),(0,a.Lk)("span",null,(0,n.v_)(e.$t("sysStatus.noData")),1)])):((0,a.uX)(),(0,a.CE)("div",Ie,[(0,a.Lk)("div",Ue,[(0,a.bF)(m,{data:l.channelChartData,options:l.chartOptions},null,8,["data","options"]),(0,a.Lk)("div",Oe,[(0,a.Lk)("div",Re,(0,n.v_)(o.indexInfo.totalFiles?.toLocaleString()||"0"),1),(0,a.Lk)("div",We,(0,n.v_)(e.$t("sysStatus.totalFilesLabel")),1)])]),(0,a.Lk)("div",Ne,[((0,a.uX)(!0),(0,a.CE)(a.FK,null,(0,a.pI)(o.indexInfo.channelStats,(e,t,s)=>((0,a.uX)(),(0,a.CE)("div",{key:t,class:"legend-item"},[(0,a.Lk)("span",{class:"legend-color",style:(0,n.Tr)({background:l.getChartColor(s)})},null,4),(0,a.Lk)("span",ze,(0,n.v_)(t),1),(0,a.Lk)("span",Be,(0,n.v_)(e.toLocaleString()),1),(0,a.Lk)("span",je,(0,n.v_)(l.getPercentage(e,o.indexInfo.totalFiles))+"%",1)]))),128))])]))])]),(0,a.Lk)("div",He,[(0,a.Lk)("div",qe,[(0,a.bF)(r,{icon:"file-alt"}),(0,a.Lk)("span",null,(0,n.v_)(e.$t("sysStatus.fileStatusDistribution")),1)]),(0,a.Lk)("div",Xe,[0===Object.keys(o.indexInfo.typeStats||{}).length?((0,a.uX)(),(0,a.CE)("div",Ke,[(0,a.bF)(r,{icon:"inbox"}),(0,a.Lk)("span",null,(0,n.v_)(e.$t("sysStatus.noData")),1)])):((0,a.uX)(),(0,a.CE)("div",Qe,[(0,a.Lk)("div",Ye,[(0,a.bF)(m,{data:l.typeChartData,options:l.chartOptions},null,8,["data","options"]),(0,a.Lk)("div",Ge,[(0,a.Lk)("div",Je,(0,n.v_)(Object.keys(o.indexInfo.typeStats).length),1),(0,a.Lk)("div",Ze,(0,n.v_)(e.$t("sysStatus.statusTypes")),1)])]),(0,a.Lk)("div",et,[((0,a.uX)(!0),(0,a.CE)(a.FK,null,(0,a.pI)(l.aggregatedTypeStats,(e,t,s)=>((0,a.uX)(),(0,a.CE)("div",{key:t,class:"legend-item"},[(0,a.Lk)("span",{class:"legend-color",style:(0,n.Tr)({background:l.getTypeChartColor(s)})},null,4),(0,a.Lk)("span",tt,(0,n.v_)(t),1),(0,a.Lk)("span",st,(0,n.v_)(e.toLocaleString()),1),(0,a.Lk)("span",it,(0,n.v_)(l.getPercentage(e,o.indexInfo.totalFiles))+"%",1)]))),128))])]))])])]),(0,a.Lk)("div",at,[(0,a.Lk)("div",nt,[(0,a.Lk)("div",ot,[(0,a.bF)(r,{icon:"tools"}),(0,a.Lk)("span",null,(0,n.v_)(e.$t("sysStatus.systemMaintenance")),1)]),(0,a.Lk)("div",lt,[o.isProcessing?((0,a.uX)(),(0,a.CE)("div",rt,[(0,a.Lk)("div",dt,[(0,a.Lk)("span",ct,(0,n.v_)(l.phaseDescription),1),(0,a.Lk)("span",ht,(0,n.v_)(Math.round(o.processingProgress.percentage))+"%",1)]),(0,a.bF)(f,{percentage:o.processingProgress.percentage,"stroke-width":12,"show-text":!1,class:"progress-bar"},null,8,["percentage"]),(0,a.Lk)("div",ut,[o.processingProgress.current>0?((0,a.uX)(),(0,a.CE)("span",pt,[(0,a.bF)(r,{icon:"file-alt"}),(0,a.eW)(" "+(0,n.v_)(o.processingProgress.current.toLocaleString())+" ",1),o.processingProgress.total>0?((0,a.uX)(),(0,a.CE)(a.FK,{key:0},[(0,a.eW)(" / "+(0,n.v_)(o.processingProgress.total.toLocaleString()),1)],64)):(0,a.Q3)("",!0),(0,a.eW)(" "+(0,n.v_)(e.$t("sysStatus.records")),1)])):(0,a.Q3)("",!0),l.estimatedTimeRemaining?((0,a.uX)(),(0,a.CE)("span",gt,[(0,a.bF)(r,{icon:"clock"}),(0,a.eW)(" "+(0,n.v_)(l.estimatedTimeRemaining),1)])):(0,a.Q3)("",!0)]),o.processingProgress.message?((0,a.uX)(),(0,a.CE)("div",mt,(0,n.v_)(o.processingProgress.message),1)):(0,a.Q3)("",!0),(0,a.bF)(d,{type:"danger",plain:"",size:"small",onClick:l.cancelOperation,class:"cancel-btn"},{default:(0,a.k6)(()=>[(0,a.bF)(r,{icon:"times"}),(0,a.eW)(" "+(0,n.v_)(e.$t("sysStatus.cancelOperation")),1)]),_:1},8,["onClick"])])):o.processingError?((0,a.uX)(),(0,a.CE)("div",ft,[(0,a.Lk)("div",bt,[(0,a.bF)(r,{icon:"exclamation-triangle"})]),(0,a.Lk)("div",yt,[(0,a.Lk)("div",vt,(0,n.v_)(o.processingError.message),1),o.processingError.suggestion?((0,a.uX)(),(0,a.CE)("div",xt,(0,n.v_)(o.processingError.suggestion),1)):(0,a.Q3)("",!0)]),(0,a.Lk)("div",kt,[o.processingError.recoverable?((0,a.uX)(),(0,a.Wv)(d,{key:0,type:"primary",size:"small",onClick:l.retryOperation},{default:(0,a.k6)(()=>[(0,a.bF)(r,{icon:"redo"}),(0,a.eW)(" "+(0,n.v_)(e.$t("sysStatus.retry")),1)]),_:1},8,["onClick"])):(0,a.Q3)("",!0),(0,a.bF)(d,{type:"default",size:"small",onClick:l.dismissError},{default:(0,a.k6)(()=>[(0,a.eW)((0,n.v_)(e.$t("sysStatus.close")),1)]),_:1},8,["onClick"])])])):((0,a.uX)(),(0,a.CE)("div",_t,[(0,a.bF)(b,{content:e.$t("sysStatus.rebuildTooltip"),placement:"top"},{default:(0,a.k6)(()=>[(0,a.bF)(d,{type:"primary",loading:o.rebuilding,disabled:o.isProcessing,onClick:l.rebuildIndex,class:"action-btn rebuild-btn"},{default:(0,a.k6)(()=>[(0,a.bF)(r,{icon:"sync-alt"}),(0,a.eW)(" "+(0,n.v_)(o.rebuilding?e.$t("sysStatus.rebuilding"):e.$t("sysStatus.rebuildIndex")),1)]),_:1},8,["loading","disabled","onClick"])]),_:1},8,["content"]),(0,a.bF)(b,{content:e.$t("sysStatus.backupTooltip"),placement:"top"},{default:(0,a.k6)(()=>[(0,a.bF)(d,{type:"success",loading:o.backing,disabled:o.isProcessing,onClick:l.backupData,class:"action-btn backup-btn"},{default:(0,a.k6)(()=>[(0,a.bF)(r,{icon:"download"}),(0,a.eW)(" "+(0,n.v_)(o.backing?e.$t("sysStatus.backingUp"):e.$t("sysStatus.backupData")),1)]),_:1},8,["loading","disabled","onClick"])]),_:1},8,["content"]),(0,a.bF)(b,{content:e.$t("sysStatus.restoreTooltip"),placement:"top"},{default:(0,a.k6)(()=>[(0,a.Lk)("div",wt,[(0,a.Lk)("input",{type:"file",ref:"fileInput",accept:".json",onChange:t[5]||(t[5]=(...e)=>l.handleFileSelect&&l.handleFileSelect(...e)),style:{display:"none"}},null,544),(0,a.bF)(d,{type:"warning",loading:o.restoring,disabled:o.isProcessing,onClick:l.selectRestoreFile,class:"action-btn restore-btn"},{default:(0,a.k6)(()=>[(0,a.bF)(r,{icon:"upload"}),(0,a.eW)(" "+(0,n.v_)(o.restoring?e.$t("sysStatus.restoring"):e.$t("sysStatus.restoreData")),1)]),_:1},8,["loading","disabled","onClick"])])]),_:1},8,["content"])]))])])]),o.indexInfo.newestFile||o.indexInfo.oldestFile?((0,a.uX)(),(0,a.CE)("div",Ct,[o.indexInfo.newestFile?((0,a.uX)(),(0,a.CE)("div",{key:0,class:"file-info-card info-card-newest",onClick:t[8]||(t[8]=e=>l.openFileInNewTab(o.indexInfo.newestFile))},[l.isImageFile(o.indexInfo.newestFile)&&!o.loadErrors["newest"]?((0,a.uX)(),(0,a.Wv)(w,{key:0,src:"/file/"+o.indexInfo.newestFile.id+"?from=admin",fit:"cover",class:"card-bg-media",onError:t[6]||(t[6]=e=>l.handleImageError("newest"))},null,8,["src"])):l.isVideoFile(o.indexInfo.newestFile)&&!o.loadErrors["newest"]?((0,a.uX)(),(0,a.CE)("video",{key:1,src:"/file/"+o.indexInfo.newestFile.id+"?from=admin",class:"card-bg-media",muted:"",loop:"",autoplay:"",onError:t[7]||(t[7]=e=>l.handleImageError("newest"))},null,40,St)):((0,a.uX)(),(0,a.CE)("div",Ft,[(0,a.bF)(r,{icon:"file-alt",class:"fallback-icon"})])),(0,a.Lk)("div",Tt,[(0,a.bF)(r,{icon:"arrow-up"}),(0,a.Lk)("span",null,(0,n.v_)(e.$t("sysStatus.latestUpload")),1)]),(0,a.Lk)("div",At,[(0,a.Lk)("div",Mt,(0,n.v_)(o.indexInfo.newestFile.metadata?.FileName||o.indexInfo.newestFile.id),1),(0,a.Lk)("div",Pt,(0,n.v_)(l.formatTime(o.indexInfo.newestFile.metadata?.TimeStamp)),1)])])):(0,a.Q3)("",!0),o.indexInfo.oldestFile?((0,a.uX)(),(0,a.CE)("div",{key:1,class:"file-info-card info-card-oldest",onClick:t[11]||(t[11]=e=>l.openFileInNewTab(o.indexInfo.oldestFile))},[l.isImageFile(o.indexInfo.oldestFile)&&!o.loadErrors["oldest"]?((0,a.uX)(),(0,a.Wv)(w,{key:0,src:"/file/"+o.indexInfo.oldestFile.id+"?from=admin",fit:"cover",class:"card-bg-media",onError:t[9]||(t[9]=e=>l.handleImageError("oldest"))},null,8,["src"])):l.isVideoFile(o.indexInfo.oldestFile)&&!o.loadErrors["oldest"]?((0,a.uX)(),(0,a.CE)("video",{key:1,src:"/file/"+o.indexInfo.oldestFile.id+"?from=admin",class:"card-bg-media",muted:"",loop:"",autoplay:"",onError:t[10]||(t[10]=e=>l.handleImageError("oldest"))},null,40,$t)):((0,a.uX)(),(0,a.CE)("div",Dt,[(0,a.bF)(r,{icon:"file-alt",class:"fallback-icon"})])),(0,a.Lk)("div",Vt,[(0,a.bF)(r,{icon:"arrow-down"}),(0,a.Lk)("span",null,(0,n.v_)(e.$t("sysStatus.earliestUpload")),1)]),(0,a.Lk)("div",Lt,[(0,a.Lk)("div",Et,(0,n.v_)(o.indexInfo.oldestFile.metadata?.FileName||o.indexInfo.oldestFile.id),1),(0,a.Lk)("div",It,(0,n.v_)(l.formatTime(o.indexInfo.oldestFile.metadata?.TimeStamp)),1)])])):(0,a.Q3)("",!0)])):(0,a.Q3)("",!0)])),[[C,o.loading]])}s(18111),s(7588),s(61701),s(18237),s(17642),s(58004),s(33853),s(45876),s(32475),s(15024),s(31698);var Ot=s(70797),Rt={rE:"2.7.7"},Wt=(s(20116),s(91114));s(22489),s(13579);
/*!
* @kurkle/color v0.3.4
* https://github.com/kurkle/color#readme
* (c) 2024 Jukka Kurkela
* Released under the MIT License
*/
function Nt(e){return e+.5|0}const zt=(e,t,s)=>Math.max(Math.min(e,s),t);function Bt(e){return zt(Nt(2.55*e),0,255)}function jt(e){return zt(Nt(255*e),0,255)}function Ht(e){return zt(Nt(e/2.55)/100,0,1)}function qt(e){return zt(Nt(100*e),0,100)}const Xt={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},Kt=[..."0123456789ABCDEF"],Qt=e=>Kt[15&e],Yt=e=>Kt[(240&e)>>4]+Kt[15&e],Gt=e=>(240&e)>>4===(15&e),Jt=e=>Gt(e.r)&&Gt(e.g)&&Gt(e.b)&&Gt(e.a);function Zt(e){var t,s=e.length;return"#"===e[0]&&(4===s||5===s?t={r:255&17*Xt[e[1]],g:255&17*Xt[e[2]],b:255&17*Xt[e[3]],a:5===s?17*Xt[e[4]]:255}:7!==s&&9!==s||(t={r:Xt[e[1]]<<4|Xt[e[2]],g:Xt[e[3]]<<4|Xt[e[4]],b:Xt[e[5]]<<4|Xt[e[6]],a:9===s?Xt[e[7]]<<4|Xt[e[8]]:255})),t}const es=(e,t)=>e<255?t(e):"";function ts(e){var t=Jt(e)?Qt:Yt;return e?"#"+t(e.r)+t(e.g)+t(e.b)+es(e.a,t):void 0}const ss=/^(hsla?|hwb|hsv)\(\s*([-+.e\d]+)(?:deg)?[\s,]+([-+.e\d]+)%[\s,]+([-+.e\d]+)%(?:[\s,]+([-+.e\d]+)(%)?)?\s*\)$/;function is(e,t,s){const i=t*Math.min(s,1-s),a=(t,a=(t+e/30)%12)=>s-i*Math.max(Math.min(a-3,9-a,1),-1);return[a(0),a(8),a(4)]}function as(e,t,s){const i=(i,a=(i+e/60)%6)=>s-s*t*Math.max(Math.min(a,4-a,1),0);return[i(5),i(3),i(1)]}function ns(e,t,s){const i=is(e,1,.5);let a;for(t+s>1&&(a=1/(t+s),t*=a,s*=a),a=0;a<3;a++)i[a]*=1-t-s,i[a]+=t;return i}function os(e,t,s,i,a){return e===a?(t-s)/i+(t<s?6:0):t===a?(s-e)/i+2:(e-t)/i+4}function ls(e){const t=255,s=e.r/t,i=e.g/t,a=e.b/t,n=Math.max(s,i,a),o=Math.min(s,i,a),l=(n+o)/2;let r,d,c;return n!==o&&(c=n-o,d=l>.5?c/(2-n-o):c/(n+o),r=os(s,i,a,c,n),r=60*r+.5),[0|r,d||0,l]}function rs(e,t,s,i){return(Array.isArray(t)?e(t[0],t[1],t[2]):e(t,s,i)).map(jt)}function ds(e,t,s){return rs(is,e,t,s)}function cs(e,t,s){return rs(ns,e,t,s)}function hs(e,t,s){return rs(as,e,t,s)}function us(e){return(e%360+360)%360}function ps(e){const t=ss.exec(e);let s,i=255;if(!t)return;t[5]!==s&&(i=t[6]?Bt(+t[5]):jt(+t[5]));const a=us(+t[2]),n=+t[3]/100,o=+t[4]/100;return s="hwb"===t[1]?cs(a,n,o):"hsv"===t[1]?hs(a,n,o):ds(a,n,o),{r:s[0],g:s[1],b:s[2],a:i}}function gs(e,t){var s=ls(e);s[0]=us(s[0]+t),s=ds(s),e.r=s[0],e.g=s[1],e.b=s[2]}function ms(e){if(!e)return;const t=ls(e),s=t[0],i=qt(t[1]),a=qt(t[2]);return e.a<255?`hsla(${s}, ${i}%, ${a}%, ${Ht(e.a)})`:`hsl(${s}, ${i}%, ${a}%)`}const fs={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"},bs={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 ys(){const e={},t=Object.keys(bs),s=Object.keys(fs);let i,a,n,o,l;for(i=0;i<t.length;i++){for(o=l=t[i],a=0;a<s.length;a++)n=s[a],l=l.replace(n,fs[n]);n=parseInt(bs[o],16),e[l]=[n>>16&255,n>>8&255,255&n]}return e}let vs;function xs(e){vs||(vs=ys(),vs.transparent=[0,0,0,0]);const t=vs[e.toLowerCase()];return t&&{r:t[0],g:t[1],b:t[2],a:4===t.length?t[3]:255}}const ks=/^rgba?\(\s*([-+.\d]+)(%)?[\s,]+([-+.e\d]+)(%)?[\s,]+([-+.e\d]+)(%)?(?:[\s,/]+([-+.e\d]+)(%)?)?\s*\)$/;function _s(e){const t=ks.exec(e);let s,i,a,n=255;if(t){if(t[7]!==s){const e=+t[7];n=t[8]?Bt(e):zt(255*e,0,255)}return s=+t[1],i=+t[3],a=+t[5],s=255&(t[2]?Bt(s):zt(s,0,255)),i=255&(t[4]?Bt(i):zt(i,0,255)),a=255&(t[6]?Bt(a):zt(a,0,255)),{r:s,g:i,b:a,a:n}}}function ws(e){return e&&(e.a<255?`rgba(${e.r}, ${e.g}, ${e.b}, ${Ht(e.a)})`:`rgb(${e.r}, ${e.g}, ${e.b})`)}const Cs=e=>e<=.0031308?12.92*e:1.055*Math.pow(e,1/2.4)-.055,Ss=e=>e<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4);function Fs(e,t,s){const i=Ss(Ht(e.r)),a=Ss(Ht(e.g)),n=Ss(Ht(e.b));return{r:jt(Cs(i+s*(Ss(Ht(t.r))-i))),g:jt(Cs(a+s*(Ss(Ht(t.g))-a))),b:jt(Cs(n+s*(Ss(Ht(t.b))-n))),a:e.a+s*(t.a-e.a)}}function Ts(e,t,s){if(e){let i=ls(e);i[t]=Math.max(0,Math.min(i[t]+i[t]*s,0===t?360:1)),i=ds(i),e.r=i[0],e.g=i[1],e.b=i[2]}}function As(e,t){return e?Object.assign(t||{},e):e}function Ms(e){var t={r:0,g:0,b:0,a:255};return Array.isArray(e)?e.length>=3&&(t={r:e[0],g:e[1],b:e[2],a:255},e.length>3&&(t.a=jt(e[3]))):(t=As(e,{r:0,g:0,b:0,a:1}),t.a=jt(t.a)),t}function Ps(e){return"r"===e.charAt(0)?_s(e):ps(e)}class $s{constructor(e){if(e instanceof $s)return e;const t=typeof e;let s;"object"===t?s=Ms(e):"string"===t&&(s=Zt(e)||xs(e)||Ps(e)),this._rgb=s,this._valid=!!s}get valid(){return this._valid}get rgb(){var e=As(this._rgb);return e&&(e.a=Ht(e.a)),e}set rgb(e){this._rgb=Ms(e)}rgbString(){return this._valid?ws(this._rgb):void 0}hexString(){return this._valid?ts(this._rgb):void 0}hslString(){return this._valid?ms(this._rgb):void 0}mix(e,t){if(e){const s=this.rgb,i=e.rgb;let a;const n=t===a?.5:t,o=2*n-1,l=s.a-i.a,r=((o*l===-1?o:(o+l)/(1+o*l))+1)/2;a=1-r,s.r=255&r*s.r+a*i.r+.5,s.g=255&r*s.g+a*i.g+.5,s.b=255&r*s.b+a*i.b+.5,s.a=n*s.a+(1-n)*i.a,this.rgb=s}return this}interpolate(e,t){return e&&(this._rgb=Fs(this._rgb,e._rgb,t)),this}clone(){return new $s(this.rgb)}alpha(e){return this._rgb.a=jt(e),this}clearer(e){const t=this._rgb;return t.a*=1-e,this}greyscale(){const e=this._rgb,t=Nt(.3*e.r+.59*e.g+.11*e.b);return e.r=e.g=e.b=t,this}opaquer(e){const t=this._rgb;return t.a*=1+e,this}negate(){const e=this._rgb;return e.r=255-e.r,e.g=255-e.g,e.b=255-e.b,this}lighten(e){return Ts(this._rgb,2,e),this}darken(e){return Ts(this._rgb,2,-e),this}saturate(e){return Ts(this._rgb,1,e),this}desaturate(e){return Ts(this._rgb,1,-e),this}rotate(e){return gs(this._rgb,e),this}}
/*!
* Chart.js v4.5.1
* https://www.chartjs.org
* (c) 2025 Chart.js Contributors
* Released under the MIT License
*/
function Ds(){}const Vs=(()=>{let e=0;return()=>e++})();function Ls(e){return null===e||void 0===e}function Es(e){if(Array.isArray&&Array.isArray(e))return!0;const t=Object.prototype.toString.call(e);return"[object"===t.slice(0,7)&&"Array]"===t.slice(-6)}function Is(e){return null!==e&&"[object Object]"===Object.prototype.toString.call(e)}function Us(e){return("number"===typeof e||e instanceof Number)&&isFinite(+e)}function Os(e,t){return Us(e)?e:t}function Rs(e,t){return"undefined"===typeof e?t:e}const Ws=(e,t)=>"string"===typeof e&&e.endsWith("%")?parseFloat(e)/100:+e/t,Ns=(e,t)=>"string"===typeof e&&e.endsWith("%")?parseFloat(e)/100*t:+e;function zs(e,t,s){if(e&&"function"===typeof e.call)return e.apply(s,t)}function Bs(e,t,s,i){let a,n,o;if(Es(e))if(n=e.length,i)for(a=n-1;a>=0;a--)t.call(s,e[a],a);else for(a=0;a<n;a++)t.call(s,e[a],a);else if(Is(e))for(o=Object.keys(e),n=o.length,a=0;a<n;a++)t.call(s,e[o[a]],o[a])}function js(e,t){let s,i,a,n;if(!e||!t||e.length!==t.length)return!1;for(s=0,i=e.length;s<i;++s)if(a=e[s],n=t[s],a.datasetIndex!==n.datasetIndex||a.index!==n.index)return!1;return!0}function Hs(e){if(Es(e))return e.map(Hs);if(Is(e)){const t=Object.create(null),s=Object.keys(e),i=s.length;let a=0;for(;a<i;++a)t[s[a]]=Hs(e[s[a]]);return t}return e}function qs(e){return-1===["__proto__","prototype","constructor"].indexOf(e)}function Xs(e,t,s,i){if(!qs(e))return;const a=t[e],n=s[e];Is(a)&&Is(n)?Ks(a,n,i):t[e]=Hs(n)}function Ks(e,t,s){const i=Es(t)?t:[t],a=i.length;if(!Is(e))return e;s=s||{};const n=s.merger||Xs;let o;for(let l=0;l<a;++l){if(o=i[l],!Is(o))continue;const t=Object.keys(o);for(let i=0,a=t.length;i<a;++i)n(t[i],e,o,s)}return e}function Qs(e,t){return Ks(e,t,{merger:Ys})}function Ys(e,t,s){if(!qs(e))return;const i=t[e],a=s[e];Is(i)&&Is(a)?Qs(i,a):Object.prototype.hasOwnProperty.call(t,e)||(t[e]=Hs(a))}const Gs={"":e=>e,x:e=>e.x,y:e=>e.y};function Js(e){const t=e.split("."),s=[];let i="";for(const a of t)i+=a,i.endsWith("\\")?i=i.slice(0,-1)+".":(s.push(i),i="");return s}function Zs(e){const t=Js(e);return e=>{for(const s of t){if(""===s)break;e=e&&e[s]}return e}}function ei(e,t){const s=Gs[t]||(Gs[t]=Zs(t));return s(e)}function ti(e){return e.charAt(0).toUpperCase()+e.slice(1)}const si=e=>"undefined"!==typeof e,ii=e=>"function"===typeof e,ai=(e,t)=>{if(e.size!==t.size)return!1;for(const s of e)if(!t.has(s))return!1;return!0};function ni(e){return"mouseup"===e.type||"click"===e.type||"contextmenu"===e.type}const oi=Math.PI,li=2*oi,ri=li+oi,di=Number.POSITIVE_INFINITY,ci=oi/180,hi=oi/2,ui=oi/4,pi=2*oi/3,gi=Math.log10,mi=Math.sign;function fi(e,t,s){return Math.abs(e-t)<s}function bi(e){const t=Math.round(e);e=fi(e,t,e/1e3)?t:e;const s=Math.pow(10,Math.floor(gi(e))),i=e/s,a=i<=1?1:i<=2?2:i<=5?5:10;return a*s}function yi(e){const t=[],s=Math.sqrt(e);let i;for(i=1;i<s;i++)e%i===0&&(t.push(i),t.push(e/i));return s===(0|s)&&t.push(s),t.sort((e,t)=>e-t).pop(),t}function vi(e){return"symbol"===typeof e||"object"===typeof e&&null!==e&&!(Symbol.toPrimitive in e||"toString"in e||"valueOf"in e)}function xi(e){return!vi(e)&&!isNaN(parseFloat(e))&&isFinite(e)}function ki(e,t){const s=Math.round(e);return s-t<=e&&s+t>=e}function _i(e,t,s){let i,a,n;for(i=0,a=e.length;i<a;i++)n=e[i][s],isNaN(n)||(t.min=Math.min(t.min,n),t.max=Math.max(t.max,n))}function wi(e){return e*(oi/180)}function Ci(e){return e*(180/oi)}function Si(e){if(!Us(e))return;let t=1,s=0;while(Math.round(e*t)/t!==e)t*=10,s++;return s}function Fi(e,t){const s=t.x-e.x,i=t.y-e.y,a=Math.sqrt(s*s+i*i);let n=Math.atan2(i,s);return n<-.5*oi&&(n+=li),{angle:n,distance:a}}function Ti(e,t){return Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))}function Ai(e,t){return(e-t+ri)%li-oi}function Mi(e){return(e%li+li)%li}function Pi(e,t,s,i){const a=Mi(e),n=Mi(t),o=Mi(s),l=Mi(n-a),r=Mi(o-a),d=Mi(a-n),c=Mi(a-o);return a===n||a===o||i&&n===o||l>r&&d<c}function $i(e,t,s){return Math.max(t,Math.min(s,e))}function Di(e){return $i(e,-32768,32767)}function Vi(e,t,s,i=1e-6){return e>=Math.min(t,s)-i&&e<=Math.max(t,s)+i}function Li(e,t,s){s=s||(s=>e[s]<t);let i,a=e.length-1,n=0;while(a-n>1)i=n+a>>1,s(i)?n=i:a=i;return{lo:n,hi:a}}const Ei=(e,t,s,i)=>Li(e,s,i?i=>{const a=e[i][t];return a<s||a===s&&e[i+1][t]===s}:i=>e[i][t]<s),Ii=(e,t,s)=>Li(e,s,i=>e[i][t]>=s);function Ui(e,t,s){let i=0,a=e.length;while(i<a&&e[i]<t)i++;while(a>i&&e[a-1]>s)a--;return i>0||a<e.length?e.slice(i,a):e}const Oi=["push","pop","shift","splice","unshift"];function Ri(e,t){e._chartjs?e._chartjs.listeners.push(t):(Object.defineProperty(e,"_chartjs",{configurable:!0,enumerable:!1,value:{listeners:[t]}}),Oi.forEach(t=>{const s="_onData"+ti(t),i=e[t];Object.defineProperty(e,t,{configurable:!0,enumerable:!1,value(...t){const a=i.apply(this,t);return e._chartjs.listeners.forEach(e=>{"function"===typeof e[s]&&e[s](...t)}),a}})}))}function Wi(e,t){const s=e._chartjs;if(!s)return;const i=s.listeners,a=i.indexOf(t);-1!==a&&i.splice(a,1),i.length>0||(Oi.forEach(t=>{delete e[t]}),delete e._chartjs)}function Ni(e){const t=new Set(e);return t.size===e.length?e:Array.from(t)}const zi=function(){return"undefined"===typeof window?function(e){return e()}:window.requestAnimationFrame}();function Bi(e,t){let s=[],i=!1;return function(...a){s=a,i||(i=!0,zi.call(window,()=>{i=!1,e.apply(t,s)}))}}function ji(e,t){let s;return function(...i){return t?(clearTimeout(s),s=setTimeout(e,t,i)):e.apply(this,i),t}}const Hi=e=>"start"===e?"left":"end"===e?"right":"center",qi=(e,t,s)=>"start"===e?t:"end"===e?s:(t+s)/2,Xi=(e,t,s,i)=>{const a=i?"left":"right";return e===a?s:"center"===e?(t+s)/2:t};function Ki(e,t,s){const i=t.length;let a=0,n=i;if(e._sorted){const{iScale:o,vScale:l,_parsed:r}=e,d=e.dataset&&e.dataset.options?e.dataset.options.spanGaps:null,c=o.axis,{min:h,max:u,minDefined:p,maxDefined:g}=o.getUserBounds();if(p){if(a=Math.min(Ei(r,c,h).lo,s?i:Ei(t,c,o.getPixelForValue(h)).lo),d){const e=r.slice(0,a+1).reverse().findIndex(e=>!Ls(e[l.axis]));a-=Math.max(0,e)}a=$i(a,0,i-1)}if(g){let e=Math.max(Ei(r,o.axis,u,!0).hi+1,s?0:Ei(t,c,o.getPixelForValue(u),!0).hi+1);if(d){const t=r.slice(e-1).findIndex(e=>!Ls(e[l.axis]));e+=Math.max(0,t)}n=$i(e,a,i)-a}else n=i-a}return{start:a,count:n}}function Qi(e){const{xScale:t,yScale:s,_scaleRanges:i}=e,a={xmin:t.min,xmax:t.max,ymin:s.min,ymax:s.max};if(!i)return e._scaleRanges=a,!0;const n=i.xmin!==t.min||i.xmax!==t.max||i.ymin!==s.min||i.ymax!==s.max;return Object.assign(i,a),n}const Yi=e=>0===e||1===e,Gi=(e,t,s)=>-Math.pow(2,10*(e-=1))*Math.sin((e-t)*li/s),Ji=(e,t,s)=>Math.pow(2,-10*e)*Math.sin((e-t)*li/s)+1,Zi={linear:e=>e,easeInQuad:e=>e*e,easeOutQuad:e=>-e*(e-2),easeInOutQuad:e=>(e/=.5)<1?.5*e*e:-.5*(--e*(e-2)-1),easeInCubic:e=>e*e*e,easeOutCubic:e=>(e-=1)*e*e+1,easeInOutCubic:e=>(e/=.5)<1?.5*e*e*e:.5*((e-=2)*e*e+2),easeInQuart:e=>e*e*e*e,easeOutQuart:e=>-((e-=1)*e*e*e-1),easeInOutQuart:e=>(e/=.5)<1?.5*e*e*e*e:-.5*((e-=2)*e*e*e-2),easeInQuint:e=>e*e*e*e*e,easeOutQuint:e=>(e-=1)*e*e*e*e+1,easeInOutQuint:e=>(e/=.5)<1?.5*e*e*e*e*e:.5*((e-=2)*e*e*e*e+2),easeInSine:e=>1-Math.cos(e*hi),easeOutSine:e=>Math.sin(e*hi),easeInOutSine:e=>-.5*(Math.cos(oi*e)-1),easeInExpo:e=>0===e?0:Math.pow(2,10*(e-1)),easeOutExpo:e=>1===e?1:1-Math.pow(2,-10*e),easeInOutExpo:e=>Yi(e)?e:e<.5?.5*Math.pow(2,10*(2*e-1)):.5*(2-Math.pow(2,-10*(2*e-1))),easeInCirc:e=>e>=1?e:-(Math.sqrt(1-e*e)-1),easeOutCirc:e=>Math.sqrt(1-(e-=1)*e),easeInOutCirc:e=>(e/=.5)<1?-.5*(Math.sqrt(1-e*e)-1):.5*(Math.sqrt(1-(e-=2)*e)+1),easeInElastic:e=>Yi(e)?e:Gi(e,.075,.3),easeOutElastic:e=>Yi(e)?e:Ji(e,.075,.3),easeInOutElastic(e){const t=.1125,s=.45;return Yi(e)?e:e<.5?.5*Gi(2*e,t,s):.5+.5*Ji(2*e-1,t,s)},easeInBack(e){const t=1.70158;return e*e*((t+1)*e-t)},easeOutBack(e){const t=1.70158;return(e-=1)*e*((t+1)*e+t)+1},easeInOutBack(e){let t=1.70158;return(e/=.5)<1?e*e*((1+(t*=1.525))*e-t)*.5:.5*((e-=2)*e*((1+(t*=1.525))*e+t)+2)},easeInBounce:e=>1-Zi.easeOutBounce(1-e),easeOutBounce(e){const t=7.5625,s=2.75;return e<1/s?t*e*e:e<2/s?t*(e-=1.5/s)*e+.75:e<2.5/s?t*(e-=2.25/s)*e+.9375:t*(e-=2.625/s)*e+.984375},easeInOutBounce:e=>e<.5?.5*Zi.easeInBounce(2*e):.5*Zi.easeOutBounce(2*e-1)+.5};function ea(e){if(e&&"object"===typeof e){const t=e.toString();return"[object CanvasPattern]"===t||"[object CanvasGradient]"===t}return!1}function ta(e){return ea(e)?e:new $s(e)}function sa(e){return ea(e)?e:new $s(e).saturate(.5).darken(.1).hexString()}const ia=["x","y","borderWidth","radius","tension"],aa=["color","borderColor","backgroundColor"];function na(e){e.set("animation",{delay:void 0,duration:1e3,easing:"easeOutQuart",fn:void 0,from:void 0,loop:void 0,to:void 0,type:void 0}),e.describe("animation",{_fallback:!1,_indexable:!1,_scriptable:e=>"onProgress"!==e&&"onComplete"!==e&&"fn"!==e}),e.set("animations",{colors:{type:"color",properties:aa},numbers:{type:"number",properties:ia}}),e.describe("animations",{_fallback:"animation"}),e.set("transitions",{active:{animation:{duration:400}},resize:{animation:{duration:0}},show:{animations:{colors:{from:"transparent"},visible:{type:"boolean",duration:0}}},hide:{animations:{colors:{to:"transparent"},visible:{type:"boolean",easing:"linear",fn:e=>0|e}}}})}function oa(e){e.set("layout",{autoPadding:!0,padding:{top:0,right:0,bottom:0,left:0}})}const la=new Map;function ra(e,t){t=t||{};const s=e+JSON.stringify(t);let i=la.get(s);return i||(i=new Intl.NumberFormat(e,t),la.set(s,i)),i}function da(e,t,s){return ra(t,s).format(e)}const ca={values(e){return Es(e)?e:""+e},numeric(e,t,s){if(0===e)return"0";const i=this.chart.options.locale;let a,n=e;if(s.length>1){const t=Math.max(Math.abs(s[0].value),Math.abs(s[s.length-1].value));(t<1e-4||t>1e15)&&(a="scientific"),n=ha(e,s)}const o=gi(Math.abs(n)),l=isNaN(o)?1:Math.max(Math.min(-1*Math.floor(o),20),0),r={notation:a,minimumFractionDigits:l,maximumFractionDigits:l};return Object.assign(r,this.options.ticks.format),da(e,i,r)},logarithmic(e,t,s){if(0===e)return"0";const i=s[t].significand||e/Math.pow(10,Math.floor(gi(e)));return[1,2,3,5,10,15].includes(i)||t>.8*s.length?ca.numeric.call(this,e,t,s):""}};function ha(e,t){let s=t.length>3?t[2].value-t[1].value:t[1].value-t[0].value;return Math.abs(s)>=1&&e!==Math.floor(e)&&(s=e-Math.floor(e)),s}var ua={formatters:ca};function pa(e){e.set("scale",{display:!0,offset:!1,reverse:!1,beginAtZero:!1,bounds:"ticks",clip:!0,grace:0,grid:{display:!0,lineWidth:1,drawOnChartArea:!0,drawTicks:!0,tickLength:8,tickWidth:(e,t)=>t.lineWidth,tickColor:(e,t)=>t.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:ua.formatters.values,minor:{},major:{},align:"center",crossAlign:"near",showLabelBackdrop:!1,backdropColor:"rgba(255, 255, 255, 0.75)",backdropPadding:2}}),e.route("scale.ticks","color","","color"),e.route("scale.grid","color","","borderColor"),e.route("scale.border","color","","borderColor"),e.route("scale.title","color","","color"),e.describe("scale",{_fallback:!1,_scriptable:e=>!e.startsWith("before")&&!e.startsWith("after")&&"callback"!==e&&"parser"!==e,_indexable:e=>"borderDash"!==e&&"tickBorderDash"!==e&&"dash"!==e}),e.describe("scales",{_fallback:"scale"}),e.describe("scale.ticks",{_scriptable:e=>"backdropPadding"!==e&&"callback"!==e,_indexable:e=>"backdropPadding"!==e})}const ga=Object.create(null),ma=Object.create(null);function fa(e,t){if(!t)return e;const s=t.split(".");for(let i=0,a=s.length;i<a;++i){const t=s[i];e=e[t]||(e[t]=Object.create(null))}return e}function ba(e,t,s){return"string"===typeof t?Ks(fa(e,t),s):Ks(fa(e,""),t)}class ya{constructor(e,t){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=e=>e.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=(e,t)=>sa(t.backgroundColor),this.hoverBorderColor=(e,t)=>sa(t.borderColor),this.hoverColor=(e,t)=>sa(t.color),this.indexAxis="x",this.interaction={mode:"nearest",intersect:!0,includeInvisible:!1},this.maintainAspectRatio=!0,this.onHover=null,this.onClick=null,this.parsing=!0,this.plugins={},this.responsive=!0,this.scale=void 0,this.scales={},this.showLine=!0,this.drawActiveElementsOnTop=!0,this.describe(e),this.apply(t)}set(e,t){return ba(this,e,t)}get(e){return fa(this,e)}describe(e,t){return ba(ma,e,t)}override(e,t){return ba(ga,e,t)}route(e,t,s,i){const a=fa(this,e),n=fa(this,s),o="_"+t;Object.defineProperties(a,{[o]:{value:a[t],writable:!0},[t]:{enumerable:!0,get(){const e=this[o],t=n[i];return Is(e)?Object.assign({},t,e):Rs(e,t)},set(e){this[o]=e}}})}apply(e){e.forEach(e=>e(this))}}var va=new ya({_scriptable:e=>!e.startsWith("on"),_indexable:e=>"events"!==e,hover:{_fallback:"interaction"},interaction:{_scriptable:!1,_indexable:!1}},[na,oa,pa]);function xa(e){return!e||Ls(e.size)||Ls(e.family)?null:(e.style?e.style+" ":"")+(e.weight?e.weight+" ":"")+e.size+"px "+e.family}function ka(e,t,s,i,a){let n=t[a];return n||(n=t[a]=e.measureText(a).width,s.push(a)),n>i&&(i=n),i}function _a(e,t,s,i){i=i||{};let a=i.data=i.data||{},n=i.garbageCollect=i.garbageCollect||[];i.font!==t&&(a=i.data={},n=i.garbageCollect=[],i.font=t),e.save(),e.font=t;let o=0;const l=s.length;let r,d,c,h,u;for(r=0;r<l;r++)if(h=s[r],void 0===h||null===h||Es(h)){if(Es(h))for(d=0,c=h.length;d<c;d++)u=h[d],void 0===u||null===u||Es(u)||(o=ka(e,a,n,o,u))}else o=ka(e,a,n,o,h);e.restore();const p=n.length/2;if(p>s.length){for(r=0;r<p;r++)delete a[n[r]];n.splice(0,p)}return o}function wa(e,t,s){const i=e.currentDevicePixelRatio,a=0!==s?Math.max(s/2,.5):0;return Math.round((t-a)*i)/i+a}function Ca(e,t){(t||e)&&(t=t||e.getContext("2d"),t.save(),t.resetTransform(),t.clearRect(0,0,e.width,e.height),t.restore())}function Sa(e,t,s,i){Fa(e,t,s,i,null)}function Fa(e,t,s,i,a){let n,o,l,r,d,c,h,u;const p=t.pointStyle,g=t.rotation,m=t.radius;let f=(g||0)*ci;if(p&&"object"===typeof p&&(n=p.toString(),"[object HTMLImageElement]"===n||"[object HTMLCanvasElement]"===n))return e.save(),e.translate(s,i),e.rotate(f),e.drawImage(p,-p.width/2,-p.height/2,p.width,p.height),void e.restore();if(!(isNaN(m)||m<=0)){switch(e.beginPath(),p){default:a?e.ellipse(s,i,a/2,m,0,0,li):e.arc(s,i,m,0,li),e.closePath();break;case"triangle":c=a?a/2:m,e.moveTo(s+Math.sin(f)*c,i-Math.cos(f)*m),f+=pi,e.lineTo(s+Math.sin(f)*c,i-Math.cos(f)*m),f+=pi,e.lineTo(s+Math.sin(f)*c,i-Math.cos(f)*m),e.closePath();break;case"rectRounded":d=.516*m,r=m-d,o=Math.cos(f+ui)*r,h=Math.cos(f+ui)*(a?a/2-d:r),l=Math.sin(f+ui)*r,u=Math.sin(f+ui)*(a?a/2-d:r),e.arc(s-h,i-l,d,f-oi,f-hi),e.arc(s+u,i-o,d,f-hi,f),e.arc(s+h,i+l,d,f,f+hi),e.arc(s-u,i+o,d,f+hi,f+oi),e.closePath();break;case"rect":if(!g){r=Math.SQRT1_2*m,c=a?a/2:r,e.rect(s-c,i-r,2*c,2*r);break}f+=ui;case"rectRot":h=Math.cos(f)*(a?a/2:m),o=Math.cos(f)*m,l=Math.sin(f)*m,u=Math.sin(f)*(a?a/2:m),e.moveTo(s-h,i-l),e.lineTo(s+u,i-o),e.lineTo(s+h,i+l),e.lineTo(s-u,i+o),e.closePath();break;case"crossRot":f+=ui;case"cross":h=Math.cos(f)*(a?a/2:m),o=Math.cos(f)*m,l=Math.sin(f)*m,u=Math.sin(f)*(a?a/2:m),e.moveTo(s-h,i-l),e.lineTo(s+h,i+l),e.moveTo(s+u,i-o),e.lineTo(s-u,i+o);break;case"star":h=Math.cos(f)*(a?a/2:m),o=Math.cos(f)*m,l=Math.sin(f)*m,u=Math.sin(f)*(a?a/2:m),e.moveTo(s-h,i-l),e.lineTo(s+h,i+l),e.moveTo(s+u,i-o),e.lineTo(s-u,i+o),f+=ui,h=Math.cos(f)*(a?a/2:m),o=Math.cos(f)*m,l=Math.sin(f)*m,u=Math.sin(f)*(a?a/2:m),e.moveTo(s-h,i-l),e.lineTo(s+h,i+l),e.moveTo(s+u,i-o),e.lineTo(s-u,i+o);break;case"line":o=a?a/2:Math.cos(f)*m,l=Math.sin(f)*m,e.moveTo(s-o,i-l),e.lineTo(s+o,i+l);break;case"dash":e.moveTo(s,i),e.lineTo(s+Math.cos(f)*(a?a/2:m),i+Math.sin(f)*m);break;case!1:e.closePath();break}e.fill(),t.borderWidth>0&&e.stroke()}}function Ta(e,t,s){return s=s||.5,!t||e&&e.x>t.left-s&&e.x<t.right+s&&e.y>t.top-s&&e.y<t.bottom+s}function Aa(e,t){e.save(),e.beginPath(),e.rect(t.left,t.top,t.right-t.left,t.bottom-t.top),e.clip()}function Ma(e){e.restore()}function Pa(e,t,s,i,a){if(!t)return e.lineTo(s.x,s.y);if("middle"===a){const i=(t.x+s.x)/2;e.lineTo(i,t.y),e.lineTo(i,s.y)}else"after"===a!==!!i?e.lineTo(t.x,s.y):e.lineTo(s.x,t.y);e.lineTo(s.x,s.y)}function $a(e,t,s,i){if(!t)return e.lineTo(s.x,s.y);e.bezierCurveTo(i?t.cp1x:t.cp2x,i?t.cp1y:t.cp2y,i?s.cp2x:s.cp1x,i?s.cp2y:s.cp1y,s.x,s.y)}function Da(e,t){t.translation&&e.translate(t.translation[0],t.translation[1]),Ls(t.rotation)||e.rotate(t.rotation),t.color&&(e.fillStyle=t.color),t.textAlign&&(e.textAlign=t.textAlign),t.textBaseline&&(e.textBaseline=t.textBaseline)}function Va(e,t,s,i,a){if(a.strikethrough||a.underline){const n=e.measureText(i),o=t-n.actualBoundingBoxLeft,l=t+n.actualBoundingBoxRight,r=s-n.actualBoundingBoxAscent,d=s+n.actualBoundingBoxDescent,c=a.strikethrough?(r+d)/2:d;e.strokeStyle=e.fillStyle,e.beginPath(),e.lineWidth=a.decorationWidth||2,e.moveTo(o,c),e.lineTo(l,c),e.stroke()}}function La(e,t){const s=e.fillStyle;e.fillStyle=t.color,e.fillRect(t.left,t.top,t.width,t.height),e.fillStyle=s}function Ea(e,t,s,i,a,n={}){const o=Es(t)?t:[t],l=n.strokeWidth>0&&""!==n.strokeColor;let r,d;for(e.save(),e.font=a.string,Da(e,n),r=0;r<o.length;++r)d=o[r],n.backdrop&&La(e,n.backdrop),l&&(n.strokeColor&&(e.strokeStyle=n.strokeColor),Ls(n.strokeWidth)||(e.lineWidth=n.strokeWidth),e.strokeText(d,s,i,n.maxWidth)),e.fillText(d,s,i,n.maxWidth),Va(e,s,i,d,n),i+=Number(a.lineHeight);e.restore()}function Ia(e,t){const{x:s,y:i,w:a,h:n,radius:o}=t;e.arc(s+o.topLeft,i+o.topLeft,o.topLeft,1.5*oi,oi,!0),e.lineTo(s,i+n-o.bottomLeft),e.arc(s+o.bottomLeft,i+n-o.bottomLeft,o.bottomLeft,oi,hi,!0),e.lineTo(s+a-o.bottomRight,i+n),e.arc(s+a-o.bottomRight,i+n-o.bottomRight,o.bottomRight,hi,0,!0),e.lineTo(s+a,i+o.topRight),e.arc(s+a-o.topRight,i+o.topRight,o.topRight,0,-hi,!0),e.lineTo(s+o.topLeft,i)}const Ua=/^(normal|(\d+(?:\.\d+)?)(px|em|%)?)$/,Oa=/^(normal|italic|initial|inherit|unset|(oblique( -?[0-9]?[0-9]deg)?))$/;function Ra(e,t){const s=(""+e).match(Ua);if(!s||"normal"===s[1])return 1.2*t;switch(e=+s[2],s[3]){case"px":return e;case"%":e/=100;break}return t*e}const Wa=e=>+e||0;function Na(e,t){const s={},i=Is(t),a=i?Object.keys(t):t,n=Is(e)?i?s=>Rs(e[s],e[t[s]]):t=>e[t]:()=>e;for(const o of a)s[o]=Wa(n(o));return s}function za(e){return Na(e,{top:"y",right:"x",bottom:"y",left:"x"})}function Ba(e){return Na(e,["topLeft","topRight","bottomLeft","bottomRight"])}function ja(e){const t=za(e);return t.width=t.left+t.right,t.height=t.top+t.bottom,t}function Ha(e,t){e=e||{},t=t||va.font;let s=Rs(e.size,t.size);"string"===typeof s&&(s=parseInt(s,10));let i=Rs(e.style,t.style);i&&!(""+i).match(Oa)&&(console.warn('Invalid font style specified: "'+i+'"'),i=void 0);const a={family:Rs(e.family,t.family),lineHeight:Ra(Rs(e.lineHeight,t.lineHeight),s),size:s,style:i,weight:Rs(e.weight,t.weight),string:""};return a.string=xa(a),a}function qa(e,t,s,i){let a,n,o,l=!0;for(a=0,n=e.length;a<n;++a)if(o=e[a],void 0!==o&&(void 0!==t&&"function"===typeof o&&(o=o(t),l=!1),void 0!==s&&Es(o)&&(o=o[s%o.length],l=!1),void 0!==o))return i&&!l&&(i.cacheable=!1),o}function Xa(e,t,s){const{min:i,max:a}=e,n=Ns(t,(a-i)/2),o=(e,t)=>s&&0===e?0:e+t;return{min:o(i,-Math.abs(n)),max:o(a,n)}}function Ka(e,t){return Object.assign(Object.create(e),t)}function Qa(e,t=[""],s,i,a=()=>e[0]){const n=s||e;"undefined"===typeof i&&(i=un("_fallback",e));const o={[Symbol.toStringTag]:"Object",_cacheable:!0,_scopes:e,_rootScopes:n,_fallback:i,_getTarget:a,override:s=>Qa([s,...e],t,n,i)};return new Proxy(o,{deleteProperty(t,s){return delete t[s],delete t._keys,delete e[0][s],!0},get(s,i){return en(s,i,()=>hn(i,t,e,s))},getOwnPropertyDescriptor(e,t){return Reflect.getOwnPropertyDescriptor(e._scopes[0],t)},getPrototypeOf(){return Reflect.getPrototypeOf(e[0])},has(e,t){return pn(e).includes(t)},ownKeys(e){return pn(e)},set(e,t,s){const i=e._storage||(e._storage=a());return e[t]=i[t]=s,delete e._keys,!0}})}function Ya(e,t,s,i){const a={_cacheable:!1,_proxy:e,_context:t,_subProxy:s,_stack:new Set,_descriptors:Ga(e,i),setContext:t=>Ya(e,t,s,i),override:a=>Ya(e.override(a),t,s,i)};return new Proxy(a,{deleteProperty(t,s){return delete t[s],delete e[s],!0},get(e,t,s){return en(e,t,()=>tn(e,t,s))},getOwnPropertyDescriptor(t,s){return t._descriptors.allKeys?Reflect.has(e,s)?{enumerable:!0,configurable:!0}:void 0:Reflect.getOwnPropertyDescriptor(e,s)},getPrototypeOf(){return Reflect.getPrototypeOf(e)},has(t,s){return Reflect.has(e,s)},ownKeys(){return Reflect.ownKeys(e)},set(t,s,i){return e[s]=i,delete t[s],!0}})}function Ga(e,t={scriptable:!0,indexable:!0}){const{_scriptable:s=t.scriptable,_indexable:i=t.indexable,_allKeys:a=t.allKeys}=e;return{allKeys:a,scriptable:s,indexable:i,isScriptable:ii(s)?s:()=>s,isIndexable:ii(i)?i:()=>i}}const Ja=(e,t)=>e?e+ti(t):t,Za=(e,t)=>Is(t)&&"adapters"!==e&&(null===Object.getPrototypeOf(t)||t.constructor===Object);function en(e,t,s){if(Object.prototype.hasOwnProperty.call(e,t)||"constructor"===t)return e[t];const i=s();return e[t]=i,i}function tn(e,t,s){const{_proxy:i,_context:a,_subProxy:n,_descriptors:o}=e;let l=i[t];return ii(l)&&o.isScriptable(t)&&(l=sn(t,l,e,s)),Es(l)&&l.length&&(l=an(t,l,e,o.isIndexable)),Za(t,l)&&(l=Ya(l,a,n&&n[t],o)),l}function sn(e,t,s,i){const{_proxy:a,_context:n,_subProxy:o,_stack:l}=s;if(l.has(e))throw new Error("Recursion detected: "+Array.from(l).join("->")+"->"+e);l.add(e);let r=t(n,o||i);return l.delete(e),Za(e,r)&&(r=rn(a._scopes,a,e,r)),r}function an(e,t,s,i){const{_proxy:a,_context:n,_subProxy:o,_descriptors:l}=s;if("undefined"!==typeof n.index&&i(e))return t[n.index%t.length];if(Is(t[0])){const s=t,i=a._scopes.filter(e=>e!==s);t=[];for(const r of s){const s=rn(i,a,e,r);t.push(Ya(s,n,o&&o[e],l))}}return t}function nn(e,t,s){return ii(e)?e(t,s):e}const on=(e,t)=>!0===e?t:"string"===typeof e?ei(t,e):void 0;function ln(e,t,s,i,a){for(const n of t){const t=on(s,n);if(t){e.add(t);const n=nn(t._fallback,s,a);if("undefined"!==typeof n&&n!==s&&n!==i)return n}else if(!1===t&&"undefined"!==typeof i&&s!==i)return null}return!1}function rn(e,t,s,i){const a=t._rootScopes,n=nn(t._fallback,s,i),o=[...e,...a],l=new Set;l.add(i);let r=dn(l,o,s,n||s,i);return null!==r&&(("undefined"===typeof n||n===s||(r=dn(l,o,n,r,i),null!==r))&&Qa(Array.from(l),[""],a,n,()=>cn(t,s,i)))}function dn(e,t,s,i,a){while(s)s=ln(e,t,s,i,a);return s}function cn(e,t,s){const i=e._getTarget();t in i||(i[t]={});const a=i[t];return Es(a)&&Is(s)?s:a||{}}function hn(e,t,s,i){let a;for(const n of t)if(a=un(Ja(n,e),s),"undefined"!==typeof a)return Za(e,a)?rn(s,i,e,a):a}function un(e,t){for(const s of t){if(!s)continue;const t=s[e];if("undefined"!==typeof t)return t}}function pn(e){let t=e._keys;return t||(t=e._keys=gn(e._scopes)),t}function gn(e){const t=new Set;for(const s of e)for(const e of Object.keys(s).filter(e=>!e.startsWith("_")))t.add(e);return Array.from(t)}function mn(e,t,s,i){const{iScale:a}=e,{key:n="r"}=this._parsing,o=new Array(i);let l,r,d,c;for(l=0,r=i;l<r;++l)d=l+s,c=t[d],o[l]={r:a.parse(ei(c,n),d)};return o}const fn=Number.EPSILON||1e-14,bn=(e,t)=>t<e.length&&!e[t].skip&&e[t],yn=e=>"x"===e?"y":"x";function vn(e,t,s,i){const a=e.skip?t:e,n=t,o=s.skip?t:s,l=Ti(n,a),r=Ti(o,n);let d=l/(l+r),c=r/(l+r);d=isNaN(d)?0:d,c=isNaN(c)?0:c;const h=i*d,u=i*c;return{previous:{x:n.x-h*(o.x-a.x),y:n.y-h*(o.y-a.y)},next:{x:n.x+u*(o.x-a.x),y:n.y+u*(o.y-a.y)}}}function xn(e,t,s){const i=e.length;let a,n,o,l,r,d=bn(e,0);for(let c=0;c<i-1;++c)r=d,d=bn(e,c+1),r&&d&&(fi(t[c],0,fn)?s[c]=s[c+1]=0:(a=s[c]/t[c],n=s[c+1]/t[c],l=Math.pow(a,2)+Math.pow(n,2),l<=9||(o=3/Math.sqrt(l),s[c]=a*o*t[c],s[c+1]=n*o*t[c])))}function kn(e,t,s="x"){const i=yn(s),a=e.length;let n,o,l,r=bn(e,0);for(let d=0;d<a;++d){if(o=l,l=r,r=bn(e,d+1),!l)continue;const a=l[s],c=l[i];o&&(n=(a-o[s])/3,l[`cp1${s}`]=a-n,l[`cp1${i}`]=c-n*t[d]),r&&(n=(r[s]-a)/3,l[`cp2${s}`]=a+n,l[`cp2${i}`]=c+n*t[d])}}function _n(e,t="x"){const s=yn(t),i=e.length,a=Array(i).fill(0),n=Array(i);let o,l,r,d=bn(e,0);for(o=0;o<i;++o)if(l=r,r=d,d=bn(e,o+1),r){if(d){const e=d[t]-r[t];a[o]=0!==e?(d[s]-r[s])/e:0}n[o]=l?d?mi(a[o-1])!==mi(a[o])?0:(a[o-1]+a[o])/2:a[o-1]:a[o]}xn(e,a,n),kn(e,n,t)}function wn(e,t,s){return Math.max(Math.min(e,s),t)}function Cn(e,t){let s,i,a,n,o,l=Ta(e[0],t);for(s=0,i=e.length;s<i;++s)o=n,n=l,l=s<i-1&&Ta(e[s+1],t),n&&(a=e[s],o&&(a.cp1x=wn(a.cp1x,t.left,t.right),a.cp1y=wn(a.cp1y,t.top,t.bottom)),l&&(a.cp2x=wn(a.cp2x,t.left,t.right),a.cp2y=wn(a.cp2y,t.top,t.bottom)))}function Sn(e,t,s,i,a){let n,o,l,r;if(t.spanGaps&&(e=e.filter(e=>!e.skip)),"monotone"===t.cubicInterpolationMode)_n(e,a);else{let s=i?e[e.length-1]:e[0];for(n=0,o=e.length;n<o;++n)l=e[n],r=vn(s,l,e[Math.min(n+1,o-(i?0:1))%o],t.tension),l.cp1x=r.previous.x,l.cp1y=r.previous.y,l.cp2x=r.next.x,l.cp2y=r.next.y,s=l}t.capBezierPoints&&Cn(e,s)}function Fn(){return"undefined"!==typeof window&&"undefined"!==typeof document}function Tn(e){let t=e.parentNode;return t&&"[object ShadowRoot]"===t.toString()&&(t=t.host),t}function An(e,t,s){let i;return"string"===typeof e?(i=parseInt(e,10),-1!==e.indexOf("%")&&(i=i/100*t.parentNode[s])):i=e,i}const Mn=e=>e.ownerDocument.defaultView.getComputedStyle(e,null);function Pn(e,t){return Mn(e).getPropertyValue(t)}const $n=["top","right","bottom","left"];function Dn(e,t,s){const i={};s=s?"-"+s:"";for(let a=0;a<4;a++){const n=$n[a];i[n]=parseFloat(e[t+"-"+n+s])||0}return i.width=i.left+i.right,i.height=i.top+i.bottom,i}const Vn=(e,t,s)=>(e>0||t>0)&&(!s||!s.shadowRoot);function Ln(e,t){const s=e.touches,i=s&&s.length?s[0]:e,{offsetX:a,offsetY:n}=i;let o,l,r=!1;if(Vn(a,n,e.target))o=a,l=n;else{const e=t.getBoundingClientRect();o=i.clientX-e.left,l=i.clientY-e.top,r=!0}return{x:o,y:l,box:r}}function En(e,t){if("native"in e)return e;const{canvas:s,currentDevicePixelRatio:i}=t,a=Mn(s),n="border-box"===a.boxSizing,o=Dn(a,"padding"),l=Dn(a,"border","width"),{x:r,y:d,box:c}=Ln(e,s),h=o.left+(c&&l.left),u=o.top+(c&&l.top);let{width:p,height:g}=t;return n&&(p-=o.width+l.width,g-=o.height+l.height),{x:Math.round((r-h)/p*s.width/i),y:Math.round((d-u)/g*s.height/i)}}function In(e,t,s){let i,a;if(void 0===t||void 0===s){const n=e&&Tn(e);if(n){const e=n.getBoundingClientRect(),o=Mn(n),l=Dn(o,"border","width"),r=Dn(o,"padding");t=e.width-r.width-l.width,s=e.height-r.height-l.height,i=An(o.maxWidth,n,"clientWidth"),a=An(o.maxHeight,n,"clientHeight")}else t=e.clientWidth,s=e.clientHeight}return{width:t,height:s,maxWidth:i||di,maxHeight:a||di}}const Un=e=>Math.round(10*e)/10;function On(e,t,s,i){const a=Mn(e),n=Dn(a,"margin"),o=An(a.maxWidth,e,"clientWidth")||di,l=An(a.maxHeight,e,"clientHeight")||di,r=In(e,t,s);let{width:d,height:c}=r;if("content-box"===a.boxSizing){const e=Dn(a,"border","width"),t=Dn(a,"padding");d-=t.width+e.width,c-=t.height+e.height}d=Math.max(0,d-n.width),c=Math.max(0,i?d/i:c-n.height),d=Un(Math.min(d,o,r.maxWidth)),c=Un(Math.min(c,l,r.maxHeight)),d&&!c&&(c=Un(d/2));const h=void 0!==t||void 0!==s;return h&&i&&r.height&&c>r.height&&(c=r.height,d=Un(Math.floor(c*i))),{width:d,height:c}}function Rn(e,t,s){const i=t||1,a=Un(e.height*i),n=Un(e.width*i);e.height=Un(e.height),e.width=Un(e.width);const o=e.canvas;return o.style&&(s||!o.style.height&&!o.style.width)&&(o.style.height=`${e.height}px`,o.style.width=`${e.width}px`),(e.currentDevicePixelRatio!==i||o.height!==a||o.width!==n)&&(e.currentDevicePixelRatio=i,o.height=a,o.width=n,e.ctx.setTransform(i,0,0,i,0,0),!0)}const Wn=function(){let e=!1;try{const t={get passive(){return e=!0,!1}};Fn()&&(window.addEventListener("test",null,t),window.removeEventListener("test",null,t))}catch(t){}return e}();function Nn(e,t){const s=Pn(e,t),i=s&&s.match(/^(\d+)(\.\d+)?px$/);return i?+i[1]:void 0}function zn(e,t,s,i){return{x:e.x+s*(t.x-e.x),y:e.y+s*(t.y-e.y)}}function Bn(e,t,s,i){return{x:e.x+s*(t.x-e.x),y:"middle"===i?s<.5?e.y:t.y:"after"===i?s<1?e.y:t.y:s>0?t.y:e.y}}function jn(e,t,s,i){const a={x:e.cp2x,y:e.cp2y},n={x:t.cp1x,y:t.cp1y},o=zn(e,a,s),l=zn(a,n,s),r=zn(n,t,s),d=zn(o,l,s),c=zn(l,r,s);return zn(d,c,s)}const Hn=function(e,t){return{x(s){return e+e+t-s},setWidth(e){t=e},textAlign(e){return"center"===e?e:"right"===e?"left":"right"},xPlus(e,t){return e-t},leftForLtr(e,t){return e-t}}},qn=function(){return{x(e){return e},setWidth(e){},textAlign(e){return e},xPlus(e,t){return e+t},leftForLtr(e,t){return e}}};function Xn(e,t,s){return e?Hn(t,s):qn()}function Kn(e,t){let s,i;"ltr"!==t&&"rtl"!==t||(s=e.canvas.style,i=[s.getPropertyValue("direction"),s.getPropertyPriority("direction")],s.setProperty("direction",t,"important"),e.prevTextDirection=i)}function Qn(e,t){void 0!==t&&(delete e.prevTextDirection,e.canvas.style.setProperty("direction",t[0],t[1]))}function Yn(e){return"angle"===e?{between:Pi,compare:Ai,normalize:Mi}:{between:Vi,compare:(e,t)=>e-t,normalize:e=>e}}function Gn({start:e,end:t,count:s,loop:i,style:a}){return{start:e%s,end:t%s,loop:i&&(t-e+1)%s===0,style:a}}function Jn(e,t,s){const{property:i,start:a,end:n}=s,{between:o,normalize:l}=Yn(i),r=t.length;let d,c,{start:h,end:u,loop:p}=e;if(p){for(h+=r,u+=r,d=0,c=r;d<c;++d){if(!o(l(t[h%r][i]),a,n))break;h--,u--}h%=r,u%=r}return u<h&&(u+=r),{start:h,end:u,loop:p,style:e.style}}function Zn(e,t,s){if(!s)return[e];const{property:i,start:a,end:n}=s,o=t.length,{compare:l,between:r,normalize:d}=Yn(i),{start:c,end:h,loop:u,style:p}=Jn(e,t,s),g=[];let m,f,b,y=!1,v=null;const x=()=>r(a,b,m)&&0!==l(a,b),k=()=>0===l(n,m)||r(n,b,m),_=()=>y||x(),w=()=>!y||k();for(let C=c,S=c;C<=h;++C)f=t[C%o],f.skip||(m=d(f[i]),m!==b&&(y=r(m,a,n),null===v&&_()&&(v=0===l(m,a)?C:S),null!==v&&w()&&(g.push(Gn({start:v,end:C,loop:u,count:o,style:p})),v=null),S=C,b=m));return null!==v&&g.push(Gn({start:v,end:h,loop:u,count:o,style:p})),g}function eo(e,t){const s=[],i=e.segments;for(let a=0;a<i.length;a++){const n=Zn(i[a],e.points,t);n.length&&s.push(...n)}return s}function to(e,t,s,i){let a=0,n=t-1;if(s&&!i)while(a<t&&!e[a].skip)a++;while(a<t&&e[a].skip)a++;a%=t,s&&(n+=a);while(n>a&&e[n%t].skip)n--;return n%=t,{start:a,end:n}}function so(e,t,s,i){const a=e.length,n=[];let o,l=t,r=e[t];for(o=t+1;o<=s;++o){const s=e[o%a];s.skip||s.stop?r.skip||(i=!1,n.push({start:t%a,end:(o-1)%a,loop:i}),t=l=s.stop?o:null):(l=o,r.skip&&(t=o)),r=s}return null!==l&&n.push({start:t%a,end:l%a,loop:i}),n}function io(e,t){const s=e.points,i=e.options.spanGaps,a=s.length;if(!a)return[];const n=!!e._loop,{start:o,end:l}=to(s,a,n,i);if(!0===i)return ao(e,[{start:o,end:l,loop:n}],s,t);const r=l<o?l+a:l,d=!!e._fullLoop&&0===o&&l===a-1;return ao(e,so(s,o,r,d),s,t)}function ao(e,t,s,i){return i&&i.setContext&&s?no(e,t,s,i):t}function no(e,t,s,i){const a=e._chart.getContext(),n=oo(e.options),{_datasetIndex:o,options:{spanGaps:l}}=e,r=s.length,d=[];let c=n,h=t[0].start,u=h;function p(e,t,i,a){const n=l?-1:1;if(e!==t){e+=r;while(s[e%r].skip)e-=n;while(s[t%r].skip)t+=n;e%r!==t%r&&(d.push({start:e%r,end:t%r,loop:i,style:a}),c=a,h=t%r)}}for(const g of t){h=l?h:g.start;let e,t=s[h%r];for(u=h+1;u<=g.end;u++){const n=s[u%r];e=oo(i.setContext(Ka(a,{type:"segment",p0:t,p1:n,p0DataIndex:(u-1)%r,p1DataIndex:u%r,datasetIndex:o}))),lo(e,c)&&p(h,u-1,g.loop,c),t=n,c=e}h<u-1&&p(h,u-1,g.loop,c)}return d}function oo(e){return{backgroundColor:e.backgroundColor,borderCapStyle:e.borderCapStyle,borderDash:e.borderDash,borderDashOffset:e.borderDashOffset,borderJoinStyle:e.borderJoinStyle,borderWidth:e.borderWidth,borderColor:e.borderColor}}function lo(e,t){if(!t)return!1;const s=[],i=function(e,t){return ea(t)?(s.includes(t)||s.push(t),s.indexOf(t)):t};return JSON.stringify(e,i)!==JSON.stringify(t,i)}function ro(e,t,s){return e.options.clip?e[s]:t[s]}function co(e,t){const{xScale:s,yScale:i}=e;return s&&i?{left:ro(s,t,"left"),right:ro(s,t,"right"),top:ro(i,t,"top"),bottom:ro(i,t,"bottom")}:t}function ho(e,t){const s=t._clip;if(s.disabled)return!1;const i=co(t,e.chartArea);return{left:!1===s.left?0:i.left-(!0===s.left?0:s.left),right:!1===s.right?e.width:i.right+(!0===s.right?0:s.right),top:!1===s.top?0:i.top-(!0===s.top?0:s.top),bottom:!1===s.bottom?e.height:i.bottom+(!0===s.bottom?0:s.bottom)}}
/*!
* Chart.js v4.5.1
* https://www.chartjs.org
* (c) 2025 Chart.js Contributors
* Released under the MIT License
*/
class uo{constructor(){this._request=null,this._charts=new Map,this._running=!1,this._lastDate=void 0}_notify(e,t,s,i){const a=t.listeners[i],n=t.duration;a.forEach(i=>i({chart:e,initial:t.initial,numSteps:n,currentStep:Math.min(s-t.start,n)}))}_refresh(){this._request||(this._running=!0,this._request=zi.call(window,()=>{this._update(),this._request=null,this._running&&this._refresh()}))}_update(e=Date.now()){let t=0;this._charts.forEach((s,i)=>{if(!s.running||!s.items.length)return;const a=s.items;let n,o=a.length-1,l=!1;for(;o>=0;--o)n=a[o],n._active?(n._total>s.duration&&(s.duration=n._total),n.tick(e),l=!0):(a[o]=a[a.length-1],a.pop());l&&(i.draw(),this._notify(i,s,e,"progress")),a.length||(s.running=!1,this._notify(i,s,e,"complete"),s.initial=!1),t+=a.length}),this._lastDate=e,0===t&&(this._running=!1)}_getAnims(e){const t=this._charts;let s=t.get(e);return s||(s={running:!1,initial:!0,items:[],listeners:{complete:[],progress:[]}},t.set(e,s)),s}listen(e,t,s){this._getAnims(e).listeners[t].push(s)}add(e,t){t&&t.length&&this._getAnims(e).items.push(...t)}has(e){return this._getAnims(e).items.length>0}start(e){const t=this._charts.get(e);t&&(t.running=!0,t.start=Date.now(),t.duration=t.items.reduce((e,t)=>Math.max(e,t._duration),0),this._refresh())}running(e){if(!this._running)return!1;const t=this._charts.get(e);return!!(t&&t.running&&t.items.length)}stop(e){const t=this._charts.get(e);if(!t||!t.items.length)return;const s=t.items;let i=s.length-1;for(;i>=0;--i)s[i].cancel();t.items=[],this._notify(e,t,Date.now(),"complete")}remove(e){return this._charts.delete(e)}}var po=new uo;const go="transparent",mo={boolean(e,t,s){return s>.5?t:e},color(e,t,s){const i=ta(e||go),a=i.valid&&ta(t||go);return a&&a.valid?a.mix(i,s).hexString():t},number(e,t,s){return e+(t-e)*s}};class fo{constructor(e,t,s,i){const a=t[s];i=qa([e.to,i,a,e.from]);const n=qa([e.from,a,i]);this._active=!0,this._fn=e.fn||mo[e.type||typeof n],this._easing=Zi[e.easing]||Zi.linear,this._start=Math.floor(Date.now()+(e.delay||0)),this._duration=this._total=Math.floor(e.duration),this._loop=!!e.loop,this._target=t,this._prop=s,this._from=n,this._to=i,this._promises=void 0}active(){return this._active}update(e,t,s){if(this._active){this._notify(!1);const i=this._target[this._prop],a=s-this._start,n=this._duration-a;this._start=s,this._duration=Math.floor(Math.max(n,e.duration)),this._total+=a,this._loop=!!e.loop,this._to=qa([e.to,t,i,e.from]),this._from=qa([e.from,i,t])}}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(e){const t=e-this._start,s=this._duration,i=this._prop,a=this._from,n=this._loop,o=this._to;let l;if(this._active=a!==o&&(n||t<s),!this._active)return this._target[i]=o,void this._notify(!0);t<0?this._target[i]=a:(l=t/s%2,l=n&&l>1?2-l:l,l=this._easing(Math.min(1,Math.max(0,l))),this._target[i]=this._fn(a,o,l))}wait(){const e=this._promises||(this._promises=[]);return new Promise((t,s)=>{e.push({res:t,rej:s})})}_notify(e){const t=e?"res":"rej",s=this._promises||[];for(let i=0;i<s.length;i++)s[i][t]()}}class bo{constructor(e,t){this._chart=e,this._properties=new Map,this.configure(t)}configure(e){if(!Is(e))return;const t=Object.keys(va.animation),s=this._properties;Object.getOwnPropertyNames(e).forEach(i=>{const a=e[i];if(!Is(a))return;const n={};for(const e of t)n[e]=a[e];(Es(a.properties)&&a.properties||[i]).forEach(e=>{e!==i&&s.has(e)||s.set(e,n)})})}_animateOptions(e,t){const s=t.options,i=vo(e,s);if(!i)return[];const a=this._createAnimations(i,s);return s.$shared&&yo(e.options.$animations,s).then(()=>{e.options=s},()=>{}),a}_createAnimations(e,t){const s=this._properties,i=[],a=e.$animations||(e.$animations={}),n=Object.keys(t),o=Date.now();let l;for(l=n.length-1;l>=0;--l){const r=n[l];if("$"===r.charAt(0))continue;if("options"===r){i.push(...this._animateOptions(e,t));continue}const d=t[r];let c=a[r];const h=s.get(r);if(c){if(h&&c.active()){c.update(h,d,o);continue}c.cancel()}h&&h.duration?(a[r]=c=new fo(h,e,r,d),i.push(c)):e[r]=d}return i}update(e,t){if(0===this._properties.size)return void Object.assign(e,t);const s=this._createAnimations(e,t);return s.length?(po.add(this._chart,s),!0):void 0}}function yo(e,t){const s=[],i=Object.keys(t);for(let a=0;a<i.length;a++){const t=e[i[a]];t&&t.active()&&s.push(t.wait())}return Promise.all(s)}function vo(e,t){if(!t)return;let s=e.options;if(s)return s.$shared&&(e.options=s=Object.assign({},s,{$shared:!1,$animations:{}})),s;e.options=t}function xo(e,t){const s=e&&e.options||{},i=s.reverse,a=void 0===s.min?t:0,n=void 0===s.max?t:0;return{start:i?n:a,end:i?a:n}}function ko(e,t,s){if(!1===s)return!1;const i=xo(e,s),a=xo(t,s);return{top:a.end,right:i.end,bottom:a.start,left:i.start}}function _o(e){let t,s,i,a;return Is(e)?(t=e.top,s=e.right,i=e.bottom,a=e.left):t=s=i=a=e,{top:t,right:s,bottom:i,left:a,disabled:!1===e}}function wo(e,t){const s=[],i=e._getSortedDatasetMetas(t);let a,n;for(a=0,n=i.length;a<n;++a)s.push(i[a].index);return s}function Co(e,t,s,i={}){const a=e.keys,n="single"===i.mode;let o,l,r,d;if(null===t)return;let c=!1;for(o=0,l=a.length;o<l;++o){if(r=+a[o],r===s){if(c=!0,i.all)continue;break}d=e.values[r],Us(d)&&(n||0===t||mi(t)===mi(d))&&(t+=d)}return c||i.all?t:0}function So(e,t){const{iScale:s,vScale:i}=t,a="x"===s.axis?"x":"y",n="x"===i.axis?"x":"y",o=Object.keys(e),l=new Array(o.length);let r,d,c;for(r=0,d=o.length;r<d;++r)c=o[r],l[r]={[a]:c,[n]:e[c]};return l}function Fo(e,t){const s=e&&e.options.stacked;return s||void 0===s&&void 0!==t.stack}function To(e,t,s){return`${e.id}.${t.id}.${s.stack||s.type}`}function Ao(e){const{min:t,max:s,minDefined:i,maxDefined:a}=e.getUserBounds();return{min:i?t:Number.NEGATIVE_INFINITY,max:a?s:Number.POSITIVE_INFINITY}}function Mo(e,t,s){const i=e[t]||(e[t]={});return i[s]||(i[s]={})}function Po(e,t,s,i){for(const a of t.getMatchingVisibleMetas(i).reverse()){const t=e[a.index];if(s&&t>0||!s&&t<0)return a.index}return null}function $o(e,t){const{chart:s,_cachedMeta:i}=e,a=s._stacks||(s._stacks={}),{iScale:n,vScale:o,index:l}=i,r=n.axis,d=o.axis,c=To(n,o,i),h=t.length;let u;for(let p=0;p<h;++p){const e=t[p],{[r]:s,[d]:n}=e,h=e._stacks||(e._stacks={});u=h[d]=Mo(a,c,s),u[l]=n,u._top=Po(u,o,!0,i.type),u._bottom=Po(u,o,!1,i.type);const g=u._visualValues||(u._visualValues={});g[l]=n}}function Do(e,t){const s=e.scales;return Object.keys(s).filter(e=>s[e].axis===t).shift()}function Vo(e,t){return Ka(e,{active:!1,dataset:void 0,datasetIndex:t,index:t,mode:"default",type:"dataset"})}function Lo(e,t,s){return Ka(e,{active:!1,dataIndex:t,parsed:void 0,raw:void 0,element:s,index:t,mode:"default",type:"data"})}function Eo(e,t){const s=e.controller.index,i=e.vScale&&e.vScale.axis;if(i){t=t||e._parsed;for(const e of t){const t=e._stacks;if(!t||void 0===t[i]||void 0===t[i][s])return;delete t[i][s],void 0!==t[i]._visualValues&&void 0!==t[i]._visualValues[s]&&delete t[i]._visualValues[s]}}}const Io=e=>"reset"===e||"none"===e,Uo=(e,t)=>t?e:Object.assign({},e),Oo=(e,t,s)=>e&&!t.hidden&&t._stacked&&{keys:wo(s,!0),values:null};class Ro{constructor(e,t){this.chart=e,this._ctx=e.ctx,this.index=t,this._cachedDataOpts={},this._cachedMeta=this.getMeta(),this._type=this._cachedMeta.type,this.options=void 0,this._parsing=!1,this._data=void 0,this._objectData=void 0,this._sharedOptions=void 0,this._drawStart=void 0,this._drawCount=void 0,this.enableOptionSharing=!1,this.supportsDecimation=!1,this.$context=void 0,this._syncList=[],this.datasetElementType=new.target.datasetElementType,this.dataElementType=new.target.dataElementType,this.initialize()}initialize(){const e=this._cachedMeta;this.configure(),this.linkScales(),e._stacked=Fo(e.vScale,e),this.addElements(),this.options.fill&&!this.chart.isPluginEnabled("filler")&&console.warn("Tried to use the 'fill' option without the 'Filler' plugin enabled. Please import and register the 'Filler' plugin and make sure it is not disabled in the options")}updateIndex(e){this.index!==e&&Eo(this._cachedMeta),this.index=e}linkScales(){const e=this.chart,t=this._cachedMeta,s=this.getDataset(),i=(e,t,s,i)=>"x"===e?t:"r"===e?i:s,a=t.xAxisID=Rs(s.xAxisID,Do(e,"x")),n=t.yAxisID=Rs(s.yAxisID,Do(e,"y")),o=t.rAxisID=Rs(s.rAxisID,Do(e,"r")),l=t.indexAxis,r=t.iAxisID=i(l,a,n,o),d=t.vAxisID=i(l,n,a,o);t.xScale=this.getScaleForId(a),t.yScale=this.getScaleForId(n),t.rScale=this.getScaleForId(o),t.iScale=this.getScaleForId(r),t.vScale=this.getScaleForId(d)}getDataset(){return this.chart.data.datasets[this.index]}getMeta(){return this.chart.getDatasetMeta(this.index)}getScaleForId(e){return this.chart.scales[e]}_getOtherScale(e){const t=this._cachedMeta;return e===t.iScale?t.vScale:t.iScale}reset(){this._update("reset")}_destroy(){const e=this._cachedMeta;this._data&&Wi(this._data,this),e._stacked&&Eo(e)}_dataCheck(){const e=this.getDataset(),t=e.data||(e.data=[]),s=this._data;if(Is(t)){const e=this._cachedMeta;this._data=So(t,e)}else if(s!==t){if(s){Wi(s,this);const e=this._cachedMeta;Eo(e),e._parsed=[]}t&&Object.isExtensible(t)&&Ri(t,this),this._syncList=[],this._data=t}}addElements(){const e=this._cachedMeta;this._dataCheck(),this.datasetElementType&&(e.dataset=new this.datasetElementType)}buildOrUpdateElements(e){const t=this._cachedMeta,s=this.getDataset();let i=!1;this._dataCheck();const a=t._stacked;t._stacked=Fo(t.vScale,t),t.stack!==s.stack&&(i=!0,Eo(t),t.stack=s.stack),this._resyncElements(e),(i||a!==t._stacked)&&($o(this,t._parsed),t._stacked=Fo(t.vScale,t))}configure(){const e=this.chart.config,t=e.datasetScopeKeys(this._type),s=e.getOptionScopes(this.getDataset(),t,!0);this.options=e.createResolver(s,this.getContext()),this._parsing=this.options.parsing,this._cachedDataOpts={}}parse(e,t){const{_cachedMeta:s,_data:i}=this,{iScale:a,_stacked:n}=s,o=a.axis;let l,r,d,c=0===e&&t===i.length||s._sorted,h=e>0&&s._parsed[e-1];if(!1===this._parsing)s._parsed=i,s._sorted=!0,d=i;else{d=Es(i[e])?this.parseArrayData(s,i,e,t):Is(i[e])?this.parseObjectData(s,i,e,t):this.parsePrimitiveData(s,i,e,t);const a=()=>null===r[o]||h&&r[o]<h[o];for(l=0;l<t;++l)s._parsed[l+e]=r=d[l],c&&(a()&&(c=!1),h=r);s._sorted=c}n&&$o(this,d)}parsePrimitiveData(e,t,s,i){const{iScale:a,vScale:n}=e,o=a.axis,l=n.axis,r=a.getLabels(),d=a===n,c=new Array(i);let h,u,p;for(h=0,u=i;h<u;++h)p=h+s,c[h]={[o]:d||a.parse(r[p],p),[l]:n.parse(t[p],p)};return c}parseArrayData(e,t,s,i){const{xScale:a,yScale:n}=e,o=new Array(i);let l,r,d,c;for(l=0,r=i;l<r;++l)d=l+s,c=t[d],o[l]={x:a.parse(c[0],d),y:n.parse(c[1],d)};return o}parseObjectData(e,t,s,i){const{xScale:a,yScale:n}=e,{xAxisKey:o="x",yAxisKey:l="y"}=this._parsing,r=new Array(i);let d,c,h,u;for(d=0,c=i;d<c;++d)h=d+s,u=t[h],r[d]={x:a.parse(ei(u,o),h),y:n.parse(ei(u,l),h)};return r}getParsed(e){return this._cachedMeta._parsed[e]}getDataElement(e){return this._cachedMeta.data[e]}applyStack(e,t,s){const i=this.chart,a=this._cachedMeta,n=t[e.axis],o={keys:wo(i,!0),values:t._stacks[e.axis]._visualValues};return Co(o,n,a.index,{mode:s})}updateRangeFromParsed(e,t,s,i){const a=s[t.axis];let n=null===a?NaN:a;const o=i&&s._stacks[t.axis];i&&o&&(i.values=o,n=Co(i,a,this._cachedMeta.index)),e.min=Math.min(e.min,n),e.max=Math.max(e.max,n)}getMinMax(e,t){const s=this._cachedMeta,i=s._parsed,a=s._sorted&&e===s.iScale,n=i.length,o=this._getOtherScale(e),l=Oo(t,s,this.chart),r={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY},{min:d,max:c}=Ao(o);let h,u;function p(){u=i[h];const t=u[o.axis];return!Us(u[e.axis])||d>t||c<t}for(h=0;h<n;++h)if(!p()&&(this.updateRangeFromParsed(r,e,u,l),a))break;if(a)for(h=n-1;h>=0;--h)if(!p()){this.updateRangeFromParsed(r,e,u,l);break}return r}getAllParsedValues(e){const t=this._cachedMeta._parsed,s=[];let i,a,n;for(i=0,a=t.length;i<a;++i)n=t[i][e.axis],Us(n)&&s.push(n);return s}getMaxOverflow(){return!1}getLabelAndValue(e){const t=this._cachedMeta,s=t.iScale,i=t.vScale,a=this.getParsed(e);return{label:s?""+s.getLabelForValue(a[s.axis]):"",value:i?""+i.getLabelForValue(a[i.axis]):""}}_update(e){const t=this._cachedMeta;this.update(e||"default"),t._clip=_o(Rs(this.options.clip,ko(t.xScale,t.yScale,this.getMaxOverflow())))}update(e){}draw(){const e=this._ctx,t=this.chart,s=this._cachedMeta,i=s.data||[],a=t.chartArea,n=[],o=this._drawStart||0,l=this._drawCount||i.length-o,r=this.options.drawActiveElementsOnTop;let d;for(s.dataset&&s.dataset.draw(e,a,o,l),d=o;d<o+l;++d){const t=i[d];t.hidden||(t.active&&r?n.push(t):t.draw(e,a))}for(d=0;d<n.length;++d)n[d].draw(e,a)}getStyle(e,t){const s=t?"active":"default";return void 0===e&&this._cachedMeta.dataset?this.resolveDatasetElementOptions(s):this.resolveDataElementOptions(e||0,s)}getContext(e,t,s){const i=this.getDataset();let a;if(e>=0&&e<this._cachedMeta.data.length){const t=this._cachedMeta.data[e];a=t.$context||(t.$context=Lo(this.getContext(),e,t)),a.parsed=this.getParsed(e),a.raw=i.data[e],a.index=a.dataIndex=e}else a=this.$context||(this.$context=Vo(this.chart.getContext(),this.index)),a.dataset=i,a.index=a.datasetIndex=this.index;return a.active=!!t,a.mode=s,a}resolveDatasetElementOptions(e){return this._resolveElementOptions(this.datasetElementType.id,e)}resolveDataElementOptions(e,t){return this._resolveElementOptions(this.dataElementType.id,t,e)}_resolveElementOptions(e,t="default",s){const i="active"===t,a=this._cachedDataOpts,n=e+"-"+t,o=a[n],l=this.enableOptionSharing&&si(s);if(o)return Uo(o,l);const r=this.chart.config,d=r.datasetElementScopeKeys(this._type,e),c=i?[`${e}Hover`,"hover",e,""]:[e,""],h=r.getOptionScopes(this.getDataset(),d),u=Object.keys(va.elements[e]),p=()=>this.getContext(s,i,t),g=r.resolveNamedOptions(h,u,p,c);return g.$shared&&(g.$shared=l,a[n]=Object.freeze(Uo(g,l))),g}_resolveAnimations(e,t,s){const i=this.chart,a=this._cachedDataOpts,n=`animation-${t}`,o=a[n];if(o)return o;let l;if(!1!==i.options.animation){const i=this.chart.config,a=i.datasetAnimationScopeKeys(this._type,t),n=i.getOptionScopes(this.getDataset(),a);l=i.createResolver(n,this.getContext(e,s,t))}const r=new bo(i,l&&l.animations);return l&&l._cacheable&&(a[n]=Object.freeze(r)),r}getSharedOptions(e){if(e.$shared)return this._sharedOptions||(this._sharedOptions=Object.assign({},e))}includeOptions(e,t){return!t||Io(e)||this.chart._animationsDisabled}_getSharedOptions(e,t){const s=this.resolveDataElementOptions(e,t),i=this._sharedOptions,a=this.getSharedOptions(s),n=this.includeOptions(t,a)||a!==i;return this.updateSharedOptions(a,t,s),{sharedOptions:a,includeOptions:n}}updateElement(e,t,s,i){Io(i)?Object.assign(e,s):this._resolveAnimations(t,i).update(e,s)}updateSharedOptions(e,t,s){e&&!Io(t)&&this._resolveAnimations(void 0,t).update(e,s)}_setStyle(e,t,s,i){e.active=i;const a=this.getStyle(t,i);this._resolveAnimations(t,s,i).update(e,{options:!i&&this.getSharedOptions(a)||a})}removeHoverStyle(e,t,s){this._setStyle(e,s,"active",!1)}setHoverStyle(e,t,s){this._setStyle(e,s,"active",!0)}_removeDatasetHoverStyle(){const e=this._cachedMeta.dataset;e&&this._setStyle(e,void 0,"active",!1)}_setDatasetHoverStyle(){const e=this._cachedMeta.dataset;e&&this._setStyle(e,void 0,"active",!0)}_resyncElements(e){const t=this._data,s=this._cachedMeta.data;for(const[o,l,r]of this._syncList)this[o](l,r);this._syncList=[];const i=s.length,a=t.length,n=Math.min(a,i);n&&this.parse(0,n),a>i?this._insertElements(i,a-i,e):a<i&&this._removeElements(a,i-a)}_insertElements(e,t,s=!0){const i=this._cachedMeta,a=i.data,n=e+t;let o;const l=e=>{for(e.length+=t,o=e.length-1;o>=n;o--)e[o]=e[o-t]};for(l(a),o=e;o<n;++o)a[o]=new this.dataElementType;this._parsing&&l(i._parsed),this.parse(e,t),s&&this.updateElements(a,e,t,"reset")}updateElements(e,t,s,i){}_removeElements(e,t){const s=this._cachedMeta;if(this._parsing){const i=s._parsed.splice(e,t);s._stacked&&Eo(s,i)}s.data.splice(e,t)}_sync(e){if(this._parsing)this._syncList.push(e);else{const[t,s,i]=e;this[t](s,i)}this.chart._dataChanges.push([this.index,...e])}_onDataPush(){const e=arguments.length;this._sync(["_insertElements",this.getDataset().data.length-e,e])}_onDataPop(){this._sync(["_removeElements",this._cachedMeta.data.length-1,1])}_onDataShift(){this._sync(["_removeElements",0,1])}_onDataSplice(e,t){t&&this._sync(["_removeElements",e,t]);const s=arguments.length-2;s&&this._sync(["_insertElements",e,s])}_onDataUnshift(){this._sync(["_insertElements",0,arguments.length])}}function Wo(e,t){if(!e._cache.$bar){const s=e.getMatchingVisibleMetas(t);let i=[];for(let t=0,a=s.length;t<a;t++)i=i.concat(s[t].controller.getAllParsedValues(e));e._cache.$bar=Ni(i.sort((e,t)=>e-t))}return e._cache.$bar}function No(e){const t=e.iScale,s=Wo(t,e.type);let i,a,n,o,l=t._length;const r=()=>{32767!==n&&-32768!==n&&(si(o)&&(l=Math.min(l,Math.abs(n-o)||l)),o=n)};for(i=0,a=s.length;i<a;++i)n=t.getPixelForValue(s[i]),r();for(o=void 0,i=0,a=t.ticks.length;i<a;++i)n=t.getPixelForTick(i),r();return l}function zo(e,t,s,i){const a=s.barThickness;let n,o;return Ls(a)?(n=t.min*s.categoryPercentage,o=s.barPercentage):(n=a*i,o=1),{chunk:n/i,ratio:o,start:t.pixels[e]-n/2}}function Bo(e,t,s,i){const a=t.pixels,n=a[e];let o=e>0?a[e-1]:null,l=e<a.length-1?a[e+1]:null;const r=s.categoryPercentage;null===o&&(o=n-(null===l?t.end-t.start:l-n)),null===l&&(l=n+n-o);const d=n-(n-Math.min(o,l))/2*r,c=Math.abs(l-o)/2*r;return{chunk:c/i,ratio:s.barPercentage,start:d}}function jo(e,t,s,i){const a=s.parse(e[0],i),n=s.parse(e[1],i),o=Math.min(a,n),l=Math.max(a,n);let r=o,d=l;Math.abs(o)>Math.abs(l)&&(r=l,d=o),t[s.axis]=d,t._custom={barStart:r,barEnd:d,start:a,end:n,min:o,max:l}}function Ho(e,t,s,i){return Es(e)?jo(e,t,s,i):t[s.axis]=s.parse(e,i),t}function qo(e,t,s,i){const a=e.iScale,n=e.vScale,o=a.getLabels(),l=a===n,r=[];let d,c,h,u;for(d=s,c=s+i;d<c;++d)u=t[d],h={},h[a.axis]=l||a.parse(o[d],d),r.push(Ho(u,h,n,d));return r}function Xo(e){return e&&void 0!==e.barStart&&void 0!==e.barEnd}function Ko(e,t,s){return 0!==e?mi(e):(t.isHorizontal()?1:-1)*(t.min>=s?1:-1)}function Qo(e){let t,s,i,a,n;return e.horizontal?(t=e.base>e.x,s="left",i="right"):(t=e.base<e.y,s="bottom",i="top"),t?(a="end",n="start"):(a="start",n="end"),{start:s,end:i,reverse:t,top:a,bottom:n}}function Yo(e,t,s,i){let a=t.borderSkipped;const n={};if(!a)return void(e.borderSkipped=n);if(!0===a)return void(e.borderSkipped={top:!0,right:!0,bottom:!0,left:!0});const{start:o,end:l,reverse:r,top:d,bottom:c}=Qo(e);"middle"===a&&s&&(e.enableBorderRadius=!0,(s._top||0)===i?a=d:(s._bottom||0)===i?a=c:(n[Go(c,o,l,r)]=!0,a=d)),n[Go(a,o,l,r)]=!0,e.borderSkipped=n}function Go(e,t,s,i){return i?(e=Jo(e,t,s),e=Zo(e,s,t)):e=Zo(e,t,s),e}function Jo(e,t,s){return e===t?s:e===s?t:e}function Zo(e,t,s){return"start"===e?t:"end"===e?s:e}function el(e,{inflateAmount:t},s){e.inflateAmount="auto"===t?1===s?.33:0:t}(0,Wt.A)(Ro,"defaults",{}),(0,Wt.A)(Ro,"datasetElementType",null),(0,Wt.A)(Ro,"dataElementType",null);class tl extends Ro{parsePrimitiveData(e,t,s,i){return qo(e,t,s,i)}parseArrayData(e,t,s,i){return qo(e,t,s,i)}parseObjectData(e,t,s,i){const{iScale:a,vScale:n}=e,{xAxisKey:o="x",yAxisKey:l="y"}=this._parsing,r="x"===a.axis?o:l,d="x"===n.axis?o:l,c=[];let h,u,p,g;for(h=s,u=s+i;h<u;++h)g=t[h],p={},p[a.axis]=a.parse(ei(g,r),h),c.push(Ho(ei(g,d),p,n,h));return c}updateRangeFromParsed(e,t,s,i){super.updateRangeFromParsed(e,t,s,i);const a=s._custom;a&&t===this._cachedMeta.vScale&&(e.min=Math.min(e.min,a.min),e.max=Math.max(e.max,a.max))}getMaxOverflow(){return 0}getLabelAndValue(e){const t=this._cachedMeta,{iScale:s,vScale:i}=t,a=this.getParsed(e),n=a._custom,o=Xo(n)?"["+n.start+", "+n.end+"]":""+i.getLabelForValue(a[i.axis]);return{label:""+s.getLabelForValue(a[s.axis]),value:o}}initialize(){this.enableOptionSharing=!0,super.initialize();const e=this._cachedMeta;e.stack=this.getDataset().stack}update(e){const t=this._cachedMeta;this.updateElements(t.data,0,t.data.length,e)}updateElements(e,t,s,i){const a="reset"===i,{index:n,_cachedMeta:{vScale:o}}=this,l=o.getBasePixel(),r=o.isHorizontal(),d=this._getRuler(),{sharedOptions:c,includeOptions:h}=this._getSharedOptions(t,i);for(let u=t;u<t+s;u++){const t=this.getParsed(u),s=a||Ls(t[o.axis])?{base:l,head:l}:this._calculateBarValuePixels(u),p=this._calculateBarIndexPixels(u,d),g=(t._stacks||{})[o.axis],m={horizontal:r,base:s.base,enableBorderRadius:!g||Xo(t._custom)||n===g._top||n===g._bottom,x:r?s.head:p.center,y:r?p.center:s.head,height:r?p.size:Math.abs(s.size),width:r?Math.abs(s.size):p.size};h&&(m.options=c||this.resolveDataElementOptions(u,e[u].active?"active":i));const f=m.options||e[u].options;Yo(m,f,g,n),el(m,f,d.ratio),this.updateElement(e[u],u,m,i)}}_getStacks(e,t){const{iScale:s}=this._cachedMeta,i=s.getMatchingVisibleMetas(this._type).filter(e=>e.controller.options.grouped),a=s.options.stacked,n=[],o=this._cachedMeta.controller.getParsed(t),l=o&&o[s.axis],r=e=>{const t=e._parsed.find(e=>e[s.axis]===l),i=t&&t[e.vScale.axis];if(Ls(i)||isNaN(i))return!0};for(const d of i)if((void 0===t||!r(d))&&((!1===a||-1===n.indexOf(d.stack)||void 0===a&&void 0===d.stack)&&n.push(d.stack),d.index===e))break;return n.length||n.push(void 0),n}_getStackCount(e){return this._getStacks(void 0,e).length}_getAxisCount(){return this._getAxis().length}getFirstScaleIdForIndexAxis(){const e=this.chart.scales,t=this.chart.options.indexAxis;return Object.keys(e).filter(s=>e[s].axis===t).shift()}_getAxis(){const e={},t=this.getFirstScaleIdForIndexAxis();for(const s of this.chart.data.datasets)e[Rs("x"===this.chart.options.indexAxis?s.xAxisID:s.yAxisID,t)]=!0;return Object.keys(e)}_getStackIndex(e,t,s){const i=this._getStacks(e,s),a=void 0!==t?i.indexOf(t):-1;return-1===a?i.length-1:a}_getRuler(){const e=this.options,t=this._cachedMeta,s=t.iScale,i=[];let a,n;for(a=0,n=t.data.length;a<n;++a)i.push(s.getPixelForValue(this.getParsed(a)[s.axis],a));const o=e.barThickness,l=o||No(t);return{min:l,pixels:i,start:s._startPixel,end:s._endPixel,stackCount:this._getStackCount(),scale:s,grouped:e.grouped,ratio:o?1:e.categoryPercentage*e.barPercentage}}_calculateBarValuePixels(e){const{_cachedMeta:{vScale:t,_stacked:s,index:i},options:{base:a,minBarLength:n}}=this,o=a||0,l=this.getParsed(e),r=l._custom,d=Xo(r);let c,h,u=l[t.axis],p=0,g=s?this.applyStack(t,l,s):u;g!==u&&(p=g-u,g=u),d&&(u=r.barStart,g=r.barEnd-r.barStart,0!==u&&mi(u)!==mi(r.barEnd)&&(p=0),p+=u);const m=Ls(a)||d?p:a;let f=t.getPixelForValue(m);if(c=this.chart.getDataVisibility(e)?t.getPixelForValue(p+g):f,h=c-f,Math.abs(h)<n){h=Ko(h,t,o)*n,u===o&&(f-=h/2);const e=t.getPixelForDecimal(0),a=t.getPixelForDecimal(1),r=Math.min(e,a),p=Math.max(e,a);f=Math.max(Math.min(f,p),r),c=f+h,s&&!d&&(l._stacks[t.axis]._visualValues[i]=t.getValueForPixel(c)-t.getValueForPixel(f))}if(f===t.getPixelForValue(o)){const e=mi(h)*t.getLineWidthForValue(o)/2;f+=e,h-=e}return{size:h,base:f,head:c,center:c+h/2}}_calculateBarIndexPixels(e,t){const s=t.scale,i=this.options,a=i.skipNull,n=Rs(i.maxBarThickness,1/0);let o,l;const r=this._getAxisCount();if(t.grouped){const s=a?this._getStackCount(e):t.stackCount,d="flex"===i.barThickness?Bo(e,t,i,s*r):zo(e,t,i,s*r),c="x"===this.chart.options.indexAxis?this.getDataset().xAxisID:this.getDataset().yAxisID,h=this._getAxis().indexOf(Rs(c,this.getFirstScaleIdForIndexAxis())),u=this._getStackIndex(this.index,this._cachedMeta.stack,a?e:void 0)+h;o=d.start+d.chunk*u+d.chunk/2,l=Math.min(n,d.chunk*d.ratio)}else o=s.getPixelForValue(this.getParsed(e)[s.axis],e),l=Math.min(n,t.min*t.ratio);return{base:o-l/2,head:o+l/2,center:o,size:l}}draw(){const e=this._cachedMeta,t=e.vScale,s=e.data,i=s.length;let a=0;for(;a<i;++a)null===this.getParsed(a)[t.axis]||s[a].hidden||s[a].draw(this._ctx)}}(0,Wt.A)(tl,"id","bar"),(0,Wt.A)(tl,"defaults",{datasetElementType:!1,dataElementType:"bar",categoryPercentage:.8,barPercentage:.9,grouped:!0,animations:{numbers:{type:"number",properties:["x","y","base","width","height"]}}}),(0,Wt.A)(tl,"overrides",{scales:{_index_:{type:"category",offset:!0,grid:{offset:!0}},_value_:{type:"linear",beginAtZero:!0}}});class sl extends Ro{initialize(){this.enableOptionSharing=!0,super.initialize()}parsePrimitiveData(e,t,s,i){const a=super.parsePrimitiveData(e,t,s,i);for(let n=0;n<a.length;n++)a[n]._custom=this.resolveDataElementOptions(n+s).radius;return a}parseArrayData(e,t,s,i){const a=super.parseArrayData(e,t,s,i);for(let n=0;n<a.length;n++){const e=t[s+n];a[n]._custom=Rs(e[2],this.resolveDataElementOptions(n+s).radius)}return a}parseObjectData(e,t,s,i){const a=super.parseObjectData(e,t,s,i);for(let n=0;n<a.length;n++){const e=t[s+n];a[n]._custom=Rs(e&&e.r&&+e.r,this.resolveDataElementOptions(n+s).radius)}return a}getMaxOverflow(){const e=this._cachedMeta.data;let t=0;for(let s=e.length-1;s>=0;--s)t=Math.max(t,e[s].size(this.resolveDataElementOptions(s))/2);return t>0&&t}getLabelAndValue(e){const t=this._cachedMeta,s=this.chart.data.labels||[],{xScale:i,yScale:a}=t,n=this.getParsed(e),o=i.getLabelForValue(n.x),l=a.getLabelForValue(n.y),r=n._custom;return{label:s[e]||"",value:"("+o+", "+l+(r?", "+r:"")+")"}}update(e){const t=this._cachedMeta.data;this.updateElements(t,0,t.length,e)}updateElements(e,t,s,i){const a="reset"===i,{iScale:n,vScale:o}=this._cachedMeta,{sharedOptions:l,includeOptions:r}=this._getSharedOptions(t,i),d=n.axis,c=o.axis;for(let h=t;h<t+s;h++){const t=e[h],s=!a&&this.getParsed(h),u={},p=u[d]=a?n.getPixelForDecimal(.5):n.getPixelForValue(s[d]),g=u[c]=a?o.getBasePixel():o.getPixelForValue(s[c]);u.skip=isNaN(p)||isNaN(g),r&&(u.options=l||this.resolveDataElementOptions(h,t.active?"active":i),a&&(u.options.radius=0)),this.updateElement(t,h,u,i)}}resolveDataElementOptions(e,t){const s=this.getParsed(e);let i=super.resolveDataElementOptions(e,t);i.$shared&&(i=Object.assign({},i,{$shared:!1}));const a=i.radius;return"active"!==t&&(i.radius=0),i.radius+=Rs(s&&s._custom,a),i}}function il(e,t,s){let i=1,a=1,n=0,o=0;if(t<li){const l=e,r=l+t,d=Math.cos(l),c=Math.sin(l),h=Math.cos(r),u=Math.sin(r),p=(e,t,i)=>Pi(e,l,r,!0)?1:Math.max(t,t*s,i,i*s),g=(e,t,i)=>Pi(e,l,r,!0)?-1:Math.min(t,t*s,i,i*s),m=p(0,d,h),f=p(hi,c,u),b=g(oi,d,h),y=g(oi+hi,c,u);i=(m-b)/2,a=(f-y)/2,n=-(m+b)/2,o=-(f+y)/2}return{ratioX:i,ratioY:a,offsetX:n,offsetY:o}}(0,Wt.A)(sl,"id","bubble"),(0,Wt.A)(sl,"defaults",{datasetElementType:!1,dataElementType:"point",animations:{numbers:{type:"number",properties:["x","y","borderWidth","radius"]}}}),(0,Wt.A)(sl,"overrides",{scales:{x:{type:"linear"},y:{type:"linear"}}});class al extends Ro{constructor(e,t){super(e,t),this.enableOptionSharing=!0,this.innerRadius=void 0,this.outerRadius=void 0,this.offsetX=void 0,this.offsetY=void 0}linkScales(){}parse(e,t){const s=this.getDataset().data,i=this._cachedMeta;if(!1===this._parsing)i._parsed=s;else{let a,n,o=e=>+s[e];if(Is(s[e])){const{key:e="value"}=this._parsing;o=t=>+ei(s[t],e)}for(a=e,n=e+t;a<n;++a)i._parsed[a]=o(a)}}_getRotation(){return wi(this.options.rotation-90)}_getCircumference(){return wi(this.options.circumference)}_getRotationExtents(){let e=li,t=-li;for(let s=0;s<this.chart.data.datasets.length;++s)if(this.chart.isDatasetVisible(s)&&this.chart.getDatasetMeta(s).type===this._type){const i=this.chart.getDatasetMeta(s).controller,a=i._getRotation(),n=i._getCircumference();e=Math.min(e,a),t=Math.max(t,a+n)}return{rotation:e,circumference:t-e}}update(e){const t=this.chart,{chartArea:s}=t,i=this._cachedMeta,a=i.data,n=this.getMaxBorderWidth()+this.getMaxOffset(a)+this.options.spacing,o=Math.max((Math.min(s.width,s.height)-n)/2,0),l=Math.min(Ws(this.options.cutout,o),1),r=this._getRingWeight(this.index),{circumference:d,rotation:c}=this._getRotationExtents(),{ratioX:h,ratioY:u,offsetX:p,offsetY:g}=il(c,d,l),m=(s.width-n)/h,f=(s.height-n)/u,b=Math.max(Math.min(m,f)/2,0),y=Ns(this.options.radius,b),v=Math.max(y*l,0),x=(y-v)/this._getVisibleDatasetWeightTotal();this.offsetX=p*y,this.offsetY=g*y,i.total=this.calculateTotal(),this.outerRadius=y-x*this._getRingWeightOffset(this.index),this.innerRadius=Math.max(this.outerRadius-x*r,0),this.updateElements(a,0,a.length,e)}_circumference(e,t){const s=this.options,i=this._cachedMeta,a=this._getCircumference();return t&&s.animation.animateRotate||!this.chart.getDataVisibility(e)||null===i._parsed[e]||i.data[e].hidden?0:this.calculateCircumference(i._parsed[e]*a/li)}updateElements(e,t,s,i){const a="reset"===i,n=this.chart,o=n.chartArea,l=n.options,r=l.animation,d=(o.left+o.right)/2,c=(o.top+o.bottom)/2,h=a&&r.animateScale,u=h?0:this.innerRadius,p=h?0:this.outerRadius,{sharedOptions:g,includeOptions:m}=this._getSharedOptions(t,i);let f,b=this._getRotation();for(f=0;f<t;++f)b+=this._circumference(f,a);for(f=t;f<t+s;++f){const t=this._circumference(f,a),s=e[f],n={x:d+this.offsetX,y:c+this.offsetY,startAngle:b,endAngle:b+t,circumference:t,outerRadius:p,innerRadius:u};m&&(n.options=g||this.resolveDataElementOptions(f,s.active?"active":i)),b+=t,this.updateElement(s,f,n,i)}}calculateTotal(){const e=this._cachedMeta,t=e.data;let s,i=0;for(s=0;s<t.length;s++){const a=e._parsed[s];null===a||isNaN(a)||!this.chart.getDataVisibility(s)||t[s].hidden||(i+=Math.abs(a))}return i}calculateCircumference(e){const t=this._cachedMeta.total;return t>0&&!isNaN(e)?li*(Math.abs(e)/t):0}getLabelAndValue(e){const t=this._cachedMeta,s=this.chart,i=s.data.labels||[],a=da(t._parsed[e],s.options.locale);return{label:i[e]||"",value:a}}getMaxBorderWidth(e){let t=0;const s=this.chart;let i,a,n,o,l;if(!e)for(i=0,a=s.data.datasets.length;i<a;++i)if(s.isDatasetVisible(i)){n=s.getDatasetMeta(i),e=n.data,o=n.controller;break}if(!e)return 0;for(i=0,a=e.length;i<a;++i)l=o.resolveDataElementOptions(i),"inner"!==l.borderAlign&&(t=Math.max(t,l.borderWidth||0,l.hoverBorderWidth||0));return t}getMaxOffset(e){let t=0;for(let s=0,i=e.length;s<i;++s){const e=this.resolveDataElementOptions(s);t=Math.max(t,e.offset||0,e.hoverOffset||0)}return t}_getRingWeightOffset(e){let t=0;for(let s=0;s<e;++s)this.chart.isDatasetVisible(s)&&(t+=this._getRingWeight(s));return t}_getRingWeight(e){return Math.max(Rs(this.chart.data.datasets[e].weight,1),0)}_getVisibleDatasetWeightTotal(){return this._getRingWeightOffset(this.chart.data.datasets.length)||1}}(0,Wt.A)(al,"id","doughnut"),(0,Wt.A)(al,"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,Wt.A)(al,"descriptors",{_scriptable:e=>"spacing"!==e,_indexable:e=>"spacing"!==e&&!e.startsWith("borderDash")&&!e.startsWith("hoverBorderDash")}),(0,Wt.A)(al,"overrides",{aspectRatio:1,plugins:{legend:{labels:{generateLabels(e){const t=e.data,{labels:{pointStyle:s,textAlign:i,color:a,useBorderRadius:n,borderRadius:o}}=e.legend.options;return t.labels.length&&t.datasets.length?t.labels.map((t,l)=>{const r=e.getDatasetMeta(0),d=r.controller.getStyle(l);return{text:t,fillStyle:d.backgroundColor,fontColor:a,hidden:!e.getDataVisibility(l),lineDash:d.borderDash,lineDashOffset:d.borderDashOffset,lineJoin:d.borderJoinStyle,lineWidth:d.borderWidth,strokeStyle:d.borderColor,textAlign:i,pointStyle:s,borderRadius:n&&(o||d.borderRadius),index:l}}):[]}},onClick(e,t,s){s.chart.toggleDataVisibility(t.index),s.chart.update()}}}});class nl extends Ro{initialize(){this.enableOptionSharing=!0,this.supportsDecimation=!0,super.initialize()}update(e){const t=this._cachedMeta,{dataset:s,data:i=[],_dataset:a}=t,n=this.chart._animationsDisabled;let{start:o,count:l}=Ki(t,i,n);this._drawStart=o,this._drawCount=l,Qi(t)&&(o=0,l=i.length),s._chart=this.chart,s._datasetIndex=this.index,s._decimated=!!a._decimated,s.points=i;const r=this.resolveDatasetElementOptions(e);this.options.showLine||(r.borderWidth=0),r.segment=this.options.segment,this.updateElement(s,void 0,{animated:!n,options:r},e),this.updateElements(i,o,l,e)}updateElements(e,t,s,i){const a="reset"===i,{iScale:n,vScale:o,_stacked:l,_dataset:r}=this._cachedMeta,{sharedOptions:d,includeOptions:c}=this._getSharedOptions(t,i),h=n.axis,u=o.axis,{spanGaps:p,segment:g}=this.options,m=xi(p)?p:Number.POSITIVE_INFINITY,f=this.chart._animationsDisabled||a||"none"===i,b=t+s,y=e.length;let v=t>0&&this.getParsed(t-1);for(let x=0;x<y;++x){const s=e[x],p=f?s:{};if(x<t||x>=b){p.skip=!0;continue}const y=this.getParsed(x),k=Ls(y[u]),_=p[h]=n.getPixelForValue(y[h],x),w=p[u]=a||k?o.getBasePixel():o.getPixelForValue(l?this.applyStack(o,y,l):y[u],x);p.skip=isNaN(_)||isNaN(w)||k,p.stop=x>0&&Math.abs(y[h]-v[h])>m,g&&(p.parsed=y,p.raw=r.data[x]),c&&(p.options=d||this.resolveDataElementOptions(x,s.active?"active":i)),f||this.updateElement(s,x,p,i),v=y}}getMaxOverflow(){const e=this._cachedMeta,t=e.dataset,s=t.options&&t.options.borderWidth||0,i=e.data||[];if(!i.length)return s;const a=i[0].size(this.resolveDataElementOptions(0)),n=i[i.length-1].size(this.resolveDataElementOptions(i.length-1));return Math.max(s,a,n)/2}draw(){const e=this._cachedMeta;e.dataset.updateControlPoints(this.chart.chartArea,e.iScale.axis),super.draw()}}(0,Wt.A)(nl,"id","line"),(0,Wt.A)(nl,"defaults",{datasetElementType:"line",dataElementType:"point",showLine:!0,spanGaps:!1}),(0,Wt.A)(nl,"overrides",{scales:{_index_:{type:"category"},_value_:{type:"linear"}}});class ol extends Ro{constructor(e,t){super(e,t),this.innerRadius=void 0,this.outerRadius=void 0}getLabelAndValue(e){const t=this._cachedMeta,s=this.chart,i=s.data.labels||[],a=da(t._parsed[e].r,s.options.locale);return{label:i[e]||"",value:a}}parseObjectData(e,t,s,i){return mn.bind(this)(e,t,s,i)}update(e){const t=this._cachedMeta.data;this._updateRadius(),this.updateElements(t,0,t.length,e)}getMinMax(){const e=this._cachedMeta,t={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY};return e.data.forEach((e,s)=>{const i=this.getParsed(s).r;!isNaN(i)&&this.chart.getDataVisibility(s)&&(i<t.min&&(t.min=i),i>t.max&&(t.max=i))}),t}_updateRadius(){const e=this.chart,t=e.chartArea,s=e.options,i=Math.min(t.right-t.left,t.bottom-t.top),a=Math.max(i/2,0),n=Math.max(s.cutoutPercentage?a/100*s.cutoutPercentage:1,0),o=(a-n)/e.getVisibleDatasetCount();this.outerRadius=a-o*this.index,this.innerRadius=this.outerRadius-o}updateElements(e,t,s,i){const a="reset"===i,n=this.chart,o=n.options,l=o.animation,r=this._cachedMeta.rScale,d=r.xCenter,c=r.yCenter,h=r.getIndexAngle(0)-.5*oi;let u,p=h;const g=360/this.countVisibleElements();for(u=0;u<t;++u)p+=this._computeAngle(u,i,g);for(u=t;u<t+s;u++){const t=e[u];let s=p,o=p+this._computeAngle(u,i,g),m=n.getDataVisibility(u)?r.getDistanceFromCenterForValue(this.getParsed(u).r):0;p=o,a&&(l.animateScale&&(m=0),l.animateRotate&&(s=o=h));const f={x:d,y:c,innerRadius:0,outerRadius:m,startAngle:s,endAngle:o,options:this.resolveDataElementOptions(u,t.active?"active":i)};this.updateElement(t,u,f,i)}}countVisibleElements(){const e=this._cachedMeta;let t=0;return e.data.forEach((e,s)=>{!isNaN(this.getParsed(s).r)&&this.chart.getDataVisibility(s)&&t++}),t}_computeAngle(e,t,s){return this.chart.getDataVisibility(e)?wi(this.resolveDataElementOptions(e,t).angle||s):0}}(0,Wt.A)(ol,"id","polarArea"),(0,Wt.A)(ol,"defaults",{dataElementType:"arc",animation:{animateRotate:!0,animateScale:!0},animations:{numbers:{type:"number",properties:["x","y","startAngle","endAngle","innerRadius","outerRadius"]}},indexAxis:"r",startAngle:0}),(0,Wt.A)(ol,"overrides",{aspectRatio:1,plugins:{legend:{labels:{generateLabels(e){const t=e.data;if(t.labels.length&&t.datasets.length){const{labels:{pointStyle:s,color:i}}=e.legend.options;return t.labels.map((t,a)=>{const n=e.getDatasetMeta(0),o=n.controller.getStyle(a);return{text:t,fillStyle:o.backgroundColor,strokeStyle:o.borderColor,fontColor:i,lineWidth:o.borderWidth,pointStyle:s,hidden:!e.getDataVisibility(a),index:a}})}return[]}},onClick(e,t,s){s.chart.toggleDataVisibility(t.index),s.chart.update()}}},scales:{r:{type:"radialLinear",angleLines:{display:!1},beginAtZero:!0,grid:{circular:!0},pointLabels:{display:!1},startAngle:0}}});class ll extends al{}(0,Wt.A)(ll,"id","pie"),(0,Wt.A)(ll,"defaults",{cutout:0,rotation:0,circumference:360,radius:"100%"});class rl extends Ro{getLabelAndValue(e){const t=this._cachedMeta.vScale,s=this.getParsed(e);return{label:t.getLabels()[e],value:""+t.getLabelForValue(s[t.axis])}}parseObjectData(e,t,s,i){return mn.bind(this)(e,t,s,i)}update(e){const t=this._cachedMeta,s=t.dataset,i=t.data||[],a=t.iScale.getLabels();if(s.points=i,"resize"!==e){const t=this.resolveDatasetElementOptions(e);this.options.showLine||(t.borderWidth=0);const n={_loop:!0,_fullLoop:a.length===i.length,options:t};this.updateElement(s,void 0,n,e)}this.updateElements(i,0,i.length,e)}updateElements(e,t,s,i){const a=this._cachedMeta.rScale,n="reset"===i;for(let o=t;o<t+s;o++){const t=e[o],s=this.resolveDataElementOptions(o,t.active?"active":i),l=a.getPointPositionForValue(o,this.getParsed(o).r),r=n?a.xCenter:l.x,d=n?a.yCenter:l.y,c={x:r,y:d,angle:l.angle,skip:isNaN(r)||isNaN(d),options:s};this.updateElement(t,o,c,i)}}}(0,Wt.A)(rl,"id","radar"),(0,Wt.A)(rl,"defaults",{datasetElementType:"line",dataElementType:"point",indexAxis:"r",showLine:!0,elements:{line:{fill:"start"}}}),(0,Wt.A)(rl,"overrides",{aspectRatio:1,scales:{r:{type:"radialLinear"}}});class dl extends Ro{getLabelAndValue(e){const t=this._cachedMeta,s=this.chart.data.labels||[],{xScale:i,yScale:a}=t,n=this.getParsed(e),o=i.getLabelForValue(n.x),l=a.getLabelForValue(n.y);return{label:s[e]||"",value:"("+o+", "+l+")"}}update(e){const t=this._cachedMeta,{data:s=[]}=t,i=this.chart._animationsDisabled;let{start:a,count:n}=Ki(t,s,i);if(this._drawStart=a,this._drawCount=n,Qi(t)&&(a=0,n=s.length),this.options.showLine){this.datasetElementType||this.addElements();const{dataset:a,_dataset:n}=t;a._chart=this.chart,a._datasetIndex=this.index,a._decimated=!!n._decimated,a.points=s;const o=this.resolveDatasetElementOptions(e);o.segment=this.options.segment,this.updateElement(a,void 0,{animated:!i,options:o},e)}else this.datasetElementType&&(delete t.dataset,this.datasetElementType=!1);this.updateElements(s,a,n,e)}addElements(){const{showLine:e}=this.options;!this.datasetElementType&&e&&(this.datasetElementType=this.chart.registry.getElement("line")),super.addElements()}updateElements(e,t,s,i){const a="reset"===i,{iScale:n,vScale:o,_stacked:l,_dataset:r}=this._cachedMeta,d=this.resolveDataElementOptions(t,i),c=this.getSharedOptions(d),h=this.includeOptions(i,c),u=n.axis,p=o.axis,{spanGaps:g,segment:m}=this.options,f=xi(g)?g:Number.POSITIVE_INFINITY,b=this.chart._animationsDisabled||a||"none"===i;let y=t>0&&this.getParsed(t-1);for(let v=t;v<t+s;++v){const t=e[v],s=this.getParsed(v),d=b?t:{},g=Ls(s[p]),x=d[u]=n.getPixelForValue(s[u],v),k=d[p]=a||g?o.getBasePixel():o.getPixelForValue(l?this.applyStack(o,s,l):s[p],v);d.skip=isNaN(x)||isNaN(k)||g,d.stop=v>0&&Math.abs(s[u]-y[u])>f,m&&(d.parsed=s,d.raw=r.data[v]),h&&(d.options=c||this.resolveDataElementOptions(v,t.active?"active":i)),b||this.updateElement(t,v,d,i),y=s}this.updateSharedOptions(c,i,d)}getMaxOverflow(){const e=this._cachedMeta,t=e.data||[];if(!this.options.showLine){let e=0;for(let s=t.length-1;s>=0;--s)e=Math.max(e,t[s].size(this.resolveDataElementOptions(s))/2);return e>0&&e}const s=e.dataset,i=s.options&&s.options.borderWidth||0;if(!t.length)return i;const a=t[0].size(this.resolveDataElementOptions(0)),n=t[t.length-1].size(this.resolveDataElementOptions(t.length-1));return Math.max(i,a,n)/2}}(0,Wt.A)(dl,"id","scatter"),(0,Wt.A)(dl,"defaults",{datasetElementType:!1,dataElementType:"point",showLine:!1,fill:!1}),(0,Wt.A)(dl,"overrides",{interaction:{mode:"point"},scales:{x:{type:"linear"},y:{type:"linear"}}});function cl(){throw new Error("This method is not implemented: Check that a complete date adapter is provided.")}class hl{static override(e){Object.assign(hl.prototype,e)}constructor(e){(0,Wt.A)(this,"options",void 0),this.options=e||{}}init(){}formats(){return cl()}parse(){return cl()}format(){return cl()}add(){return cl()}diff(){return cl()}startOf(){return cl()}endOf(){return cl()}}var ul={_date:hl};function pl(e,t,s,i){const{controller:a,data:n,_sorted:o}=e,l=a._cachedMeta.iScale,r=e.dataset&&e.dataset.options?e.dataset.options.spanGaps:null;if(l&&t===l.axis&&"r"!==t&&o&&n.length){const o=l._reversePixels?Ii:Ei;if(!i){const i=o(n,t,s);if(r){const{vScale:t}=a._cachedMeta,{_parsed:s}=e,n=s.slice(0,i.lo+1).reverse().findIndex(e=>!Ls(e[t.axis]));i.lo-=Math.max(0,n);const o=s.slice(i.hi).findIndex(e=>!Ls(e[t.axis]));i.hi+=Math.max(0,o)}return i}if(a._sharedOptions){const e=n[0],i="function"===typeof e.getRange&&e.getRange(t);if(i){const e=o(n,t,s-i),a=o(n,t,s+i);return{lo:e.lo,hi:a.hi}}}}return{lo:0,hi:n.length-1}}function gl(e,t,s,i,a){const n=e.getSortedVisibleDatasetMetas(),o=s[t];for(let l=0,r=n.length;l<r;++l){const{index:e,data:s}=n[l],{lo:r,hi:d}=pl(n[l],t,o,a);for(let t=r;t<=d;++t){const a=s[t];a.skip||i(a,e,t)}}}function ml(e){const t=-1!==e.indexOf("x"),s=-1!==e.indexOf("y");return function(e,i){const a=t?Math.abs(e.x-i.x):0,n=s?Math.abs(e.y-i.y):0;return Math.sqrt(Math.pow(a,2)+Math.pow(n,2))}}function fl(e,t,s,i,a){const n=[];if(!a&&!e.isPointInArea(t))return n;const o=function(s,o,l){(a||Ta(s,e.chartArea,0))&&s.inRange(t.x,t.y,i)&&n.push({element:s,datasetIndex:o,index:l})};return gl(e,s,t,o,!0),n}function bl(e,t,s,i){let a=[];function n(e,s,n){const{startAngle:o,endAngle:l}=e.getProps(["startAngle","endAngle"],i),{angle:r}=Fi(e,{x:t.x,y:t.y});Pi(r,o,l)&&a.push({element:e,datasetIndex:s,index:n})}return gl(e,s,t,n),a}function yl(e,t,s,i,a,n){let o=[];const l=ml(s);let r=Number.POSITIVE_INFINITY;function d(s,d,c){const h=s.inRange(t.x,t.y,a);if(i&&!h)return;const u=s.getCenterPoint(a),p=!!n||e.isPointInArea(u);if(!p&&!h)return;const g=l(t,u);g<r?(o=[{element:s,datasetIndex:d,index:c}],r=g):g===r&&o.push({element:s,datasetIndex:d,index:c})}return gl(e,s,t,d),o}function vl(e,t,s,i,a,n){return n||e.isPointInArea(t)?"r"!==s||i?yl(e,t,s,i,a,n):bl(e,t,s,a):[]}function xl(e,t,s,i,a){const n=[],o="x"===s?"inXRange":"inYRange";let l=!1;return gl(e,s,t,(e,i,r)=>{e[o]&&e[o](t[s],a)&&(n.push({element:e,datasetIndex:i,index:r}),l=l||e.inRange(t.x,t.y,a))}),i&&!l?[]:n}var kl={evaluateInteractionItems:gl,modes:{index(e,t,s,i){const a=En(t,e),n=s.axis||"x",o=s.includeInvisible||!1,l=s.intersect?fl(e,a,n,i,o):vl(e,a,n,!1,i,o),r=[];return l.length?(e.getSortedVisibleDatasetMetas().forEach(e=>{const t=l[0].index,s=e.data[t];s&&!s.skip&&r.push({element:s,datasetIndex:e.index,index:t})}),r):[]},dataset(e,t,s,i){const a=En(t,e),n=s.axis||"xy",o=s.includeInvisible||!1;let l=s.intersect?fl(e,a,n,i,o):vl(e,a,n,!1,i,o);if(l.length>0){const t=l[0].datasetIndex,s=e.getDatasetMeta(t).data;l=[];for(let e=0;e<s.length;++e)l.push({element:s[e],datasetIndex:t,index:e})}return l},point(e,t,s,i){const a=En(t,e),n=s.axis||"xy",o=s.includeInvisible||!1;return fl(e,a,n,i,o)},nearest(e,t,s,i){const a=En(t,e),n=s.axis||"xy",o=s.includeInvisible||!1;return vl(e,a,n,s.intersect,i,o)},x(e,t,s,i){const a=En(t,e);return xl(e,a,"x",s.intersect,i)},y(e,t,s,i){const a=En(t,e);return xl(e,a,"y",s.intersect,i)}}};const _l=["left","top","right","bottom"];function wl(e,t){return e.filter(e=>e.pos===t)}function Cl(e,t){return e.filter(e=>-1===_l.indexOf(e.pos)&&e.box.axis===t)}function Sl(e,t){return e.sort((e,s)=>{const i=t?s:e,a=t?e:s;return i.weight===a.weight?i.index-a.index:i.weight-a.weight})}function Fl(e){const t=[];let s,i,a,n,o,l;for(s=0,i=(e||[]).length;s<i;++s)a=e[s],({position:n,options:{stack:o,stackWeight:l=1}}=a),t.push({index:s,box:a,pos:n,horizontal:a.isHorizontal(),weight:a.weight,stack:o&&n+o,stackWeight:l});return t}function Tl(e){const t={};for(const s of e){const{stack:e,pos:i,stackWeight:a}=s;if(!e||!_l.includes(i))continue;const n=t[e]||(t[e]={count:0,placed:0,weight:0,size:0});n.count++,n.weight+=a}return t}function Al(e,t){const s=Tl(e),{vBoxMaxWidth:i,hBoxMaxHeight:a}=t;let n,o,l;for(n=0,o=e.length;n<o;++n){l=e[n];const{fullSize:o}=l.box,r=s[l.stack],d=r&&l.stackWeight/r.weight;l.horizontal?(l.width=d?d*i:o&&t.availableWidth,l.height=a):(l.width=i,l.height=d?d*a:o&&t.availableHeight)}return s}function Ml(e){const t=Fl(e),s=Sl(t.filter(e=>e.box.fullSize),!0),i=Sl(wl(t,"left"),!0),a=Sl(wl(t,"right")),n=Sl(wl(t,"top"),!0),o=Sl(wl(t,"bottom")),l=Cl(t,"x"),r=Cl(t,"y");return{fullSize:s,leftAndTop:i.concat(n),rightAndBottom:a.concat(r).concat(o).concat(l),chartArea:wl(t,"chartArea"),vertical:i.concat(a).concat(r),horizontal:n.concat(o).concat(l)}}function Pl(e,t,s,i){return Math.max(e[s],t[s])+Math.max(e[i],t[i])}function $l(e,t){e.top=Math.max(e.top,t.top),e.left=Math.max(e.left,t.left),e.bottom=Math.max(e.bottom,t.bottom),e.right=Math.max(e.right,t.right)}function Dl(e,t,s,i){const{pos:a,box:n}=s,o=e.maxPadding;if(!Is(a)){s.size&&(e[a]-=s.size);const t=i[s.stack]||{size:0,count:1};t.size=Math.max(t.size,s.horizontal?n.height:n.width),s.size=t.size/t.count,e[a]+=s.size}n.getPadding&&$l(o,n.getPadding());const l=Math.max(0,t.outerWidth-Pl(o,e,"left","right")),r=Math.max(0,t.outerHeight-Pl(o,e,"top","bottom")),d=l!==e.w,c=r!==e.h;return e.w=l,e.h=r,s.horizontal?{same:d,other:c}:{same:c,other:d}}function Vl(e){const t=e.maxPadding;function s(s){const i=Math.max(t[s]-e[s],0);return e[s]+=i,i}e.y+=s("top"),e.x+=s("left"),s("right"),s("bottom")}function Ll(e,t){const s=t.maxPadding;function i(e){const i={left:0,top:0,right:0,bottom:0};return e.forEach(e=>{i[e]=Math.max(t[e],s[e])}),i}return i(e?["left","right"]:["top","bottom"])}function El(e,t,s,i){const a=[];let n,o,l,r,d,c;for(n=0,o=e.length,d=0;n<o;++n){l=e[n],r=l.box,r.update(l.width||t.w,l.height||t.h,Ll(l.horizontal,t));const{same:o,other:h}=Dl(t,s,l,i);d|=o&&a.length,c=c||h,r.fullSize||a.push(l)}return d&&El(a,t,s,i)||c}function Il(e,t,s,i,a){e.top=s,e.left=t,e.right=t+i,e.bottom=s+a,e.width=i,e.height=a}function Ul(e,t,s,i){const a=s.padding;let{x:n,y:o}=t;for(const l of e){const e=l.box,r=i[l.stack]||{count:1,placed:0,weight:1},d=l.stackWeight/r.weight||1;if(l.horizontal){const i=t.w*d,n=r.size||e.height;si(r.start)&&(o=r.start),e.fullSize?Il(e,a.left,o,s.outerWidth-a.right-a.left,n):Il(e,t.left+r.placed,o,i,n),r.start=o,r.placed+=i,o=e.bottom}else{const i=t.h*d,o=r.size||e.width;si(r.start)&&(n=r.start),e.fullSize?Il(e,n,a.top,o,s.outerHeight-a.bottom-a.top):Il(e,n,t.top+r.placed,o,i),r.start=n,r.placed+=i,n=e.right}}t.x=n,t.y=o}var Ol={addBox(e,t){e.boxes||(e.boxes=[]),t.fullSize=t.fullSize||!1,t.position=t.position||"top",t.weight=t.weight||0,t._layers=t._layers||function(){return[{z:0,draw(e){t.draw(e)}}]},e.boxes.push(t)},removeBox(e,t){const s=e.boxes?e.boxes.indexOf(t):-1;-1!==s&&e.boxes.splice(s,1)},configure(e,t,s){t.fullSize=s.fullSize,t.position=s.position,t.weight=s.weight},update(e,t,s,i){if(!e)return;const a=ja(e.options.layout.padding),n=Math.max(t-a.width,0),o=Math.max(s-a.height,0),l=Ml(e.boxes),r=l.vertical,d=l.horizontal;Bs(e.boxes,e=>{"function"===typeof e.beforeLayout&&e.beforeLayout()});const c=r.reduce((e,t)=>t.box.options&&!1===t.box.options.display?e:e+1,0)||1,h=Object.freeze({outerWidth:t,outerHeight:s,padding:a,availableWidth:n,availableHeight:o,vBoxMaxWidth:n/2/c,hBoxMaxHeight:o/2}),u=Object.assign({},a);$l(u,ja(i));const p=Object.assign({maxPadding:u,w:n,h:o,x:a.left,y:a.top},a),g=Al(r.concat(d),h);El(l.fullSize,p,h,g),El(r,p,h,g),El(d,p,h,g)&&El(r,p,h,g),Vl(p),Ul(l.leftAndTop,p,h,g),p.x+=p.w,p.y+=p.h,Ul(l.rightAndBottom,p,h,g),e.chartArea={left:p.left,top:p.top,right:p.left+p.w,bottom:p.top+p.h,height:p.h,width:p.w},Bs(l.chartArea,t=>{const s=t.box;Object.assign(s,e.chartArea),s.update(p.w,p.h,{left:0,top:0,right:0,bottom:0})})}};class Rl{acquireContext(e,t){}releaseContext(e){return!1}addEventListener(e,t,s){}removeEventListener(e,t,s){}getDevicePixelRatio(){return 1}getMaximumSize(e,t,s,i){return t=Math.max(0,t||e.width),s=s||e.height,{width:t,height:Math.max(0,i?Math.floor(t/i):s)}}isAttached(e){return!0}updateConfig(e){}}class Wl extends Rl{acquireContext(e){return e&&e.getContext&&e.getContext("2d")||null}updateConfig(e){e.options.animation=!1}}const Nl="$chartjs",zl={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},Bl=e=>null===e||""===e;function jl(e,t){const s=e.style,i=e.getAttribute("height"),a=e.getAttribute("width");if(e[Nl]={initial:{height:i,width:a,style:{display:s.display,height:s.height,width:s.width}}},s.display=s.display||"block",s.boxSizing=s.boxSizing||"border-box",Bl(a)){const t=Nn(e,"width");void 0!==t&&(e.width=t)}if(Bl(i))if(""===e.style.height)e.height=e.width/(t||2);else{const t=Nn(e,"height");void 0!==t&&(e.height=t)}return e}const Hl=!!Wn&&{passive:!0};function ql(e,t,s){e&&e.addEventListener(t,s,Hl)}function Xl(e,t,s){e&&e.canvas&&e.canvas.removeEventListener(t,s,Hl)}function Kl(e,t){const s=zl[e.type]||e.type,{x:i,y:a}=En(e,t);return{type:s,chart:t,native:e,x:void 0!==i?i:null,y:void 0!==a?a:null}}function Ql(e,t){for(const s of e)if(s===t||s.contains(t))return!0}function Yl(e,t,s){const i=e.canvas,a=new MutationObserver(e=>{let t=!1;for(const s of e)t=t||Ql(s.addedNodes,i),t=t&&!Ql(s.removedNodes,i);t&&s()});return a.observe(document,{childList:!0,subtree:!0}),a}function Gl(e,t,s){const i=e.canvas,a=new MutationObserver(e=>{let t=!1;for(const s of e)t=t||Ql(s.removedNodes,i),t=t&&!Ql(s.addedNodes,i);t&&s()});return a.observe(document,{childList:!0,subtree:!0}),a}const Jl=new Map;let Zl=0;function er(){const e=window.devicePixelRatio;e!==Zl&&(Zl=e,Jl.forEach((t,s)=>{s.currentDevicePixelRatio!==e&&t()}))}function tr(e,t){Jl.size||window.addEventListener("resize",er),Jl.set(e,t)}function sr(e){Jl.delete(e),Jl.size||window.removeEventListener("resize",er)}function ir(e,t,s){const i=e.canvas,a=i&&Tn(i);if(!a)return;const n=Bi((e,t)=>{const i=a.clientWidth;s(e,t),i<a.clientWidth&&s()},window),o=new ResizeObserver(e=>{const t=e[0],s=t.contentRect.width,i=t.contentRect.height;0===s&&0===i||n(s,i)});return o.observe(a),tr(e,n),o}function ar(e,t,s){s&&s.disconnect(),"resize"===t&&sr(e)}function nr(e,t,s){const i=e.canvas,a=Bi(t=>{null!==e.ctx&&s(Kl(t,e))},e);return ql(i,t,a),a}class or extends Rl{acquireContext(e,t){const s=e&&e.getContext&&e.getContext("2d");return s&&s.canvas===e?(jl(e,t),s):null}releaseContext(e){const t=e.canvas;if(!t[Nl])return!1;const s=t[Nl].initial;["height","width"].forEach(e=>{const i=s[e];Ls(i)?t.removeAttribute(e):t.setAttribute(e,i)});const i=s.style||{};return Object.keys(i).forEach(e=>{t.style[e]=i[e]}),t.width=t.width,delete t[Nl],!0}addEventListener(e,t,s){this.removeEventListener(e,t);const i=e.$proxies||(e.$proxies={}),a={attach:Yl,detach:Gl,resize:ir},n=a[t]||nr;i[t]=n(e,t,s)}removeEventListener(e,t){const s=e.$proxies||(e.$proxies={}),i=s[t];if(!i)return;const a={attach:ar,detach:ar,resize:ar},n=a[t]||Xl;n(e,t,i),s[t]=void 0}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(e,t,s,i){return On(e,t,s,i)}isAttached(e){const t=e&&Tn(e);return!(!t||!t.isConnected)}}function lr(e){return!Fn()||"undefined"!==typeof OffscreenCanvas&&e instanceof OffscreenCanvas?Wl:or}class rr{constructor(){(0,Wt.A)(this,"x",void 0),(0,Wt.A)(this,"y",void 0),(0,Wt.A)(this,"active",!1),(0,Wt.A)(this,"options",void 0),(0,Wt.A)(this,"$animations",void 0)}tooltipPosition(e){const{x:t,y:s}=this.getProps(["x","y"],e);return{x:t,y:s}}hasValue(){return xi(this.x)&&xi(this.y)}getProps(e,t){const s=this.$animations;if(!t||!s)return this;const i={};return e.forEach(e=>{i[e]=s[e]&&s[e].active()?s[e]._to:this[e]}),i}}function dr(e,t){const s=e.options.ticks,i=cr(e),a=Math.min(s.maxTicksLimit||i,i),n=s.major.enabled?ur(t):[],o=n.length,l=n[0],r=n[o-1],d=[];if(o>a)return pr(t,d,n,o/a),d;const c=hr(n,t,a);if(o>0){let e,s;const i=o>1?Math.round((r-l)/(o-1)):null;for(gr(t,d,c,Ls(i)?0:l-i,l),e=0,s=o-1;e<s;e++)gr(t,d,c,n[e],n[e+1]);return gr(t,d,c,r,Ls(i)?t.length:r+i),d}return gr(t,d,c),d}function cr(e){const t=e.options.offset,s=e._tickSize(),i=e._length/s+(t?0:1),a=e._maxLength/s;return Math.floor(Math.min(i,a))}function hr(e,t,s){const i=mr(e),a=t.length/s;if(!i)return Math.max(a,1);const n=yi(i);for(let o=0,l=n.length-1;o<l;o++){const e=n[o];if(e>a)return e}return Math.max(a,1)}function ur(e){const t=[];let s,i;for(s=0,i=e.length;s<i;s++)e[s].major&&t.push(s);return t}function pr(e,t,s,i){let a,n=0,o=s[0];for(i=Math.ceil(i),a=0;a<e.length;a++)a===o&&(t.push(e[a]),n++,o=s[n*i])}function gr(e,t,s,i,a){const n=Rs(i,0),o=Math.min(Rs(a,e.length),e.length);let l,r,d,c=0;s=Math.ceil(s),a&&(l=a-i,s=l/Math.floor(l/s)),d=n;while(d<0)c++,d=Math.round(n+c*s);for(r=Math.max(n,0);r<o;r++)r===d&&(t.push(e[r]),c++,d=Math.round(n+c*s))}function mr(e){const t=e.length;let s,i;if(t<2)return!1;for(i=e[0],s=1;s<t;++s)if(e[s]-e[s-1]!==i)return!1;return i}(0,Wt.A)(rr,"defaults",{}),(0,Wt.A)(rr,"defaultRoutes",void 0);const fr=e=>"left"===e?"right":"right"===e?"left":e,br=(e,t,s)=>"top"===t||"left"===t?e[t]+s:e[t]-s,yr=(e,t)=>Math.min(t||e,e);function vr(e,t){const s=[],i=e.length/t,a=e.length;let n=0;for(;n<a;n+=i)s.push(e[Math.floor(n)]);return s}function xr(e,t,s){const i=e.ticks.length,a=Math.min(t,i-1),n=e._startPixel,o=e._endPixel,l=1e-6;let r,d=e.getPixelForTick(a);if(!(s&&(r=1===i?Math.max(d-n,o-d):0===t?(e.getPixelForTick(1)-d)/2:(d-e.getPixelForTick(a-1))/2,d+=a<t?r:-r,d<n-l||d>o+l)))return d}function kr(e,t){Bs(e,e=>{const s=e.gc,i=s.length/2;let a;if(i>t){for(a=0;a<i;++a)delete e.data[s[a]];s.splice(0,i)}})}function _r(e){return e.drawTicks?e.tickLength:0}function wr(e,t){if(!e.display)return 0;const s=Ha(e.font,t),i=ja(e.padding),a=Es(e.text)?e.text.length:1;return a*s.lineHeight+i.height}function Cr(e,t){return Ka(e,{scale:t,type:"scale"})}function Sr(e,t,s){return Ka(e,{tick:s,index:t,type:"tick"})}function Fr(e,t,s){let i=Hi(e);return(s&&"right"!==t||!s&&"right"===t)&&(i=fr(i)),i}function Tr(e,t,s,i){const{top:a,left:n,bottom:o,right:l,chart:r}=e,{chartArea:d,scales:c}=r;let h,u,p,g=0;const m=o-a,f=l-n;if(e.isHorizontal()){if(u=qi(i,n,l),Is(s)){const e=Object.keys(s)[0],i=s[e];p=c[e].getPixelForValue(i)+m-t}else p="center"===s?(d.bottom+d.top)/2+m-t:br(e,s,t);h=l-n}else{if(Is(s)){const e=Object.keys(s)[0],i=s[e];u=c[e].getPixelForValue(i)-f+t}else u="center"===s?(d.left+d.right)/2-f+t:br(e,s,t);p=qi(i,o,a),g="left"===s?-hi:hi}return{titleX:u,titleY:p,maxWidth:h,rotation:g}}class Ar extends rr{constructor(e){super(),this.id=e.id,this.type=e.type,this.options=void 0,this.ctx=e.ctx,this.chart=e.chart,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this._margins={left:0,right:0,top:0,bottom:0},this.maxWidth=void 0,this.maxHeight=void 0,this.paddingTop=void 0,this.paddingBottom=void 0,this.paddingLeft=void 0,this.paddingRight=void 0,this.axis=void 0,this.labelRotation=void 0,this.min=void 0,this.max=void 0,this._range=void 0,this.ticks=[],this._gridLineItems=null,this._labelItems=null,this._labelSizes=null,this._length=0,this._maxLength=0,this._longestTextCache={},this._startPixel=void 0,this._endPixel=void 0,this._reversePixels=!1,this._userMax=void 0,this._userMin=void 0,this._suggestedMax=void 0,this._suggestedMin=void 0,this._ticksLength=0,this._borderValue=0,this._cache={},this._dataLimitsCached=!1,this.$context=void 0}init(e){this.options=e.setContext(this.getContext()),this.axis=e.axis,this._userMin=this.parse(e.min),this._userMax=this.parse(e.max),this._suggestedMin=this.parse(e.suggestedMin),this._suggestedMax=this.parse(e.suggestedMax)}parse(e,t){return e}getUserBounds(){let{_userMin:e,_userMax:t,_suggestedMin:s,_suggestedMax:i}=this;return e=Os(e,Number.POSITIVE_INFINITY),t=Os(t,Number.NEGATIVE_INFINITY),s=Os(s,Number.POSITIVE_INFINITY),i=Os(i,Number.NEGATIVE_INFINITY),{min:Os(e,s),max:Os(t,i),minDefined:Us(e),maxDefined:Us(t)}}getMinMax(e){let t,{min:s,max:i,minDefined:a,maxDefined:n}=this.getUserBounds();if(a&&n)return{min:s,max:i};const o=this.getMatchingVisibleMetas();for(let l=0,r=o.length;l<r;++l)t=o[l].controller.getMinMax(this,e),a||(s=Math.min(s,t.min)),n||(i=Math.max(i,t.max));return s=n&&s>i?i:s,i=a&&s>i?s:i,{min:Os(s,Os(i,s)),max:Os(i,Os(s,i))}}getPadding(){return{left:this.paddingLeft||0,top:this.paddingTop||0,right:this.paddingRight||0,bottom:this.paddingBottom||0}}getTicks(){return this.ticks}getLabels(){const e=this.chart.data;return this.options.labels||(this.isHorizontal()?e.xLabels:e.yLabels)||e.labels||[]}getLabelItems(e=this.chart.chartArea){const t=this._labelItems||(this._labelItems=this._computeLabelItems(e));return t}beforeLayout(){this._cache={},this._dataLimitsCached=!1}beforeUpdate(){zs(this.options.beforeUpdate,[this])}update(e,t,s){const{beginAtZero:i,grace:a,ticks:n}=this.options,o=n.sampleSize;this.beforeUpdate(),this.maxWidth=e,this.maxHeight=t,this._margins=s=Object.assign({left:0,right:0,top:0,bottom:0},s),this.ticks=null,this._labelSizes=null,this._gridLineItems=null,this._labelItems=null,this.beforeSetDimensions(),this.setDimensions(),this.afterSetDimensions(),this._maxLength=this.isHorizontal()?this.width+s.left+s.right:this.height+s.top+s.bottom,this._dataLimitsCached||(this.beforeDataLimits(),this.determineDataLimits(),this.afterDataLimits(),this._range=Xa(this,a,i),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();const l=o<this.ticks.length;this._convertTicksToLabels(l?vr(this.ticks,o):this.ticks),this.configure(),this.beforeCalculateLabelRotation(),this.calculateLabelRotation(),this.afterCalculateLabelRotation(),n.display&&(n.autoSkip||"auto"===n.source)&&(this.ticks=dr(this,this.ticks),this._labelSizes=null,this.afterAutoSkip()),l&&this._convertTicksToLabels(this.ticks),this.beforeFit(),this.fit(),this.afterFit(),this.afterUpdate()}configure(){let e,t,s=this.options.reverse;this.isHorizontal()?(e=this.left,t=this.right):(e=this.top,t=this.bottom,s=!s),this._startPixel=e,this._endPixel=t,this._reversePixels=s,this._length=t-e,this._alignToPixels=this.options.alignToPixels}afterUpdate(){zs(this.options.afterUpdate,[this])}beforeSetDimensions(){zs(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(){zs(this.options.afterSetDimensions,[this])}_callHooks(e){this.chart.notifyPlugins(e,this.getContext()),zs(this.options[e],[this])}beforeDataLimits(){this._callHooks("beforeDataLimits")}determineDataLimits(){}afterDataLimits(){this._callHooks("afterDataLimits")}beforeBuildTicks(){this._callHooks("beforeBuildTicks")}buildTicks(){return[]}afterBuildTicks(){this._callHooks("afterBuildTicks")}beforeTickToLabelConversion(){zs(this.options.beforeTickToLabelConversion,[this])}generateTickLabels(e){const t=this.options.ticks;let s,i,a;for(s=0,i=e.length;s<i;s++)a=e[s],a.label=zs(t.callback,[a.value,s,e],this)}afterTickToLabelConversion(){zs(this.options.afterTickToLabelConversion,[this])}beforeCalculateLabelRotation(){zs(this.options.beforeCalculateLabelRotation,[this])}calculateLabelRotation(){const e=this.options,t=e.ticks,s=yr(this.ticks.length,e.ticks.maxTicksLimit),i=t.minRotation||0,a=t.maxRotation;let n,o,l,r=i;if(!this._isVisible()||!t.display||i>=a||s<=1||!this.isHorizontal())return void(this.labelRotation=i);const d=this._getLabelSizes(),c=d.widest.width,h=d.highest.height,u=$i(this.chart.width-c,0,this.maxWidth);n=e.offset?this.maxWidth/s:u/(s-1),c+6>n&&(n=u/(s-(e.offset?.5:1)),o=this.maxHeight-_r(e.grid)-t.padding-wr(e.title,this.chart.options.font),l=Math.sqrt(c*c+h*h),r=Ci(Math.min(Math.asin($i((d.highest.height+6)/n,-1,1)),Math.asin($i(o/l,-1,1))-Math.asin($i(h/l,-1,1)))),r=Math.max(i,Math.min(a,r))),this.labelRotation=r}afterCalculateLabelRotation(){zs(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){zs(this.options.beforeFit,[this])}fit(){const e={width:0,height:0},{chart:t,options:{ticks:s,title:i,grid:a}}=this,n=this._isVisible(),o=this.isHorizontal();if(n){const n=wr(i,t.options.font);if(o?(e.width=this.maxWidth,e.height=_r(a)+n):(e.height=this.maxHeight,e.width=_r(a)+n),s.display&&this.ticks.length){const{first:t,last:i,widest:a,highest:n}=this._getLabelSizes(),l=2*s.padding,r=wi(this.labelRotation),d=Math.cos(r),c=Math.sin(r);if(o){const t=s.mirror?0:c*a.width+d*n.height;e.height=Math.min(this.maxHeight,e.height+t+l)}else{const t=s.mirror?0:d*a.width+c*n.height;e.width=Math.min(this.maxWidth,e.width+t+l)}this._calculatePadding(t,i,c,d)}}this._handleMargins(),o?(this.width=this._length=t.width-this._margins.left-this._margins.right,this.height=e.height):(this.width=e.width,this.height=this._length=t.height-this._margins.top-this._margins.bottom)}_calculatePadding(e,t,s,i){const{ticks:{align:a,padding:n},position:o}=this.options,l=0!==this.labelRotation,r="top"!==o&&"x"===this.axis;if(this.isHorizontal()){const o=this.getPixelForTick(0)-this.left,d=this.right-this.getPixelForTick(this.ticks.length-1);let c=0,h=0;l?r?(c=i*e.width,h=s*t.height):(c=s*e.height,h=i*t.width):"start"===a?h=t.width:"end"===a?c=e.width:"inner"!==a&&(c=e.width/2,h=t.width/2),this.paddingLeft=Math.max((c-o+n)*this.width/(this.width-o),0),this.paddingRight=Math.max((h-d+n)*this.width/(this.width-d),0)}else{let s=t.height/2,i=e.height/2;"start"===a?(s=0,i=e.height):"end"===a&&(s=t.height,i=0),this.paddingTop=s+n,this.paddingBottom=i+n}}_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(){zs(this.options.afterFit,[this])}isHorizontal(){const{axis:e,position:t}=this.options;return"top"===t||"bottom"===t||"x"===e}isFullSize(){return this.options.fullSize}_convertTicksToLabels(e){let t,s;for(this.beforeTickToLabelConversion(),this.generateTickLabels(e),t=0,s=e.length;t<s;t++)Ls(e[t].label)&&(e.splice(t,1),s--,t--);this.afterTickToLabelConversion()}_getLabelSizes(){let e=this._labelSizes;if(!e){const t=this.options.ticks.sampleSize;let s=this.ticks;t<s.length&&(s=vr(s,t)),this._labelSizes=e=this._computeLabelSizes(s,s.length,this.options.ticks.maxTicksLimit)}return e}_computeLabelSizes(e,t,s){const{ctx:i,_longestTextCache:a}=this,n=[],o=[],l=Math.floor(t/yr(t,s));let r,d,c,h,u,p,g,m,f,b,y,v=0,x=0;for(r=0;r<t;r+=l){if(h=e[r].label,u=this._resolveTickFontOptions(r),i.font=p=u.string,g=a[p]=a[p]||{data:{},gc:[]},m=u.lineHeight,f=b=0,Ls(h)||Es(h)){if(Es(h))for(d=0,c=h.length;d<c;++d)y=h[d],Ls(y)||Es(y)||(f=ka(i,g.data,g.gc,f,y),b+=m)}else f=ka(i,g.data,g.gc,f,h),b=m;n.push(f),o.push(b),v=Math.max(f,v),x=Math.max(b,x)}kr(a,t);const k=n.indexOf(v),_=o.indexOf(x),w=e=>({width:n[e]||0,height:o[e]||0});return{first:w(0),last:w(t-1),widest:w(k),highest:w(_),widths:n,heights:o}}getLabelForValue(e){return e}getPixelForValue(e,t){return NaN}getValueForPixel(e){}getPixelForTick(e){const t=this.ticks;return e<0||e>t.length-1?null:this.getPixelForValue(t[e].value)}getPixelForDecimal(e){this._reversePixels&&(e=1-e);const t=this._startPixel+e*this._length;return Di(this._alignToPixels?wa(this.chart,t,0):t)}getDecimalForPixel(e){const t=(e-this._startPixel)/this._length;return this._reversePixels?1-t:t}getBasePixel(){return this.getPixelForValue(this.getBaseValue())}getBaseValue(){const{min:e,max:t}=this;return e<0&&t<0?t:e>0&&t>0?e:0}getContext(e){const t=this.ticks||[];if(e>=0&&e<t.length){const s=t[e];return s.$context||(s.$context=Sr(this.getContext(),e,s))}return this.$context||(this.$context=Cr(this.chart.getContext(),this))}_tickSize(){const e=this.options.ticks,t=wi(this.labelRotation),s=Math.abs(Math.cos(t)),i=Math.abs(Math.sin(t)),a=this._getLabelSizes(),n=e.autoSkipPadding||0,o=a?a.widest.width+n:0,l=a?a.highest.height+n:0;return this.isHorizontal()?l*s>o*i?o/s:l/i:l*i<o*s?l/s:o/i}_isVisible(){const e=this.options.display;return"auto"!==e?!!e:this.getMatchingVisibleMetas().length>0}_computeGridLineItems(e){const t=this.axis,s=this.chart,i=this.options,{grid:a,position:n,border:o}=i,l=a.offset,r=this.isHorizontal(),d=this.ticks,c=d.length+(l?1:0),h=_r(a),u=[],p=o.setContext(this.getContext()),g=p.display?p.width:0,m=g/2,f=function(e){return wa(s,e,g)};let b,y,v,x,k,_,w,C,S,F,T,A;if("top"===n)b=f(this.bottom),_=this.bottom-h,C=b-m,F=f(e.top)+m,A=e.bottom;else if("bottom"===n)b=f(this.top),F=e.top,A=f(e.bottom)-m,_=b+m,C=this.top+h;else if("left"===n)b=f(this.right),k=this.right-h,w=b-m,S=f(e.left)+m,T=e.right;else if("right"===n)b=f(this.left),S=e.left,T=f(e.right)-m,k=b+m,w=this.left+h;else if("x"===t){if("center"===n)b=f((e.top+e.bottom)/2+.5);else if(Is(n)){const e=Object.keys(n)[0],t=n[e];b=f(this.chart.scales[e].getPixelForValue(t))}F=e.top,A=e.bottom,_=b+m,C=_+h}else if("y"===t){if("center"===n)b=f((e.left+e.right)/2);else if(Is(n)){const e=Object.keys(n)[0],t=n[e];b=f(this.chart.scales[e].getPixelForValue(t))}k=b-m,w=k-h,S=e.left,T=e.right}const M=Rs(i.ticks.maxTicksLimit,c),P=Math.max(1,Math.ceil(c/M));for(y=0;y<c;y+=P){const e=this.getContext(y),t=a.setContext(e),i=o.setContext(e),n=t.lineWidth,d=t.color,c=i.dash||[],h=i.dashOffset,p=t.tickWidth,g=t.tickColor,m=t.tickBorderDash||[],f=t.tickBorderDashOffset;v=xr(this,y,l),void 0!==v&&(x=wa(s,v,n),r?k=w=S=T=x:_=C=F=A=x,u.push({tx1:k,ty1:_,tx2:w,ty2:C,x1:S,y1:F,x2:T,y2:A,width:n,color:d,borderDash:c,borderDashOffset:h,tickWidth:p,tickColor:g,tickBorderDash:m,tickBorderDashOffset:f}))}return this._ticksLength=c,this._borderValue=b,u}_computeLabelItems(e){const t=this.axis,s=this.options,{position:i,ticks:a}=s,n=this.isHorizontal(),o=this.ticks,{align:l,crossAlign:r,padding:d,mirror:c}=a,h=_r(s.grid),u=h+d,p=c?-d:u,g=-wi(this.labelRotation),m=[];let f,b,y,v,x,k,_,w,C,S,F,T,A="middle";if("top"===i)k=this.bottom-p,_=this._getXAxisLabelAlignment();else if("bottom"===i)k=this.top+p,_=this._getXAxisLabelAlignment();else if("left"===i){const e=this._getYAxisLabelAlignment(h);_=e.textAlign,x=e.x}else if("right"===i){const e=this._getYAxisLabelAlignment(h);_=e.textAlign,x=e.x}else if("x"===t){if("center"===i)k=(e.top+e.bottom)/2+u;else if(Is(i)){const e=Object.keys(i)[0],t=i[e];k=this.chart.scales[e].getPixelForValue(t)+u}_=this._getXAxisLabelAlignment()}else if("y"===t){if("center"===i)x=(e.left+e.right)/2-u;else if(Is(i)){const e=Object.keys(i)[0],t=i[e];x=this.chart.scales[e].getPixelForValue(t)}_=this._getYAxisLabelAlignment(h).textAlign}"y"===t&&("start"===l?A="top":"end"===l&&(A="bottom"));const M=this._getLabelSizes();for(f=0,b=o.length;f<b;++f){y=o[f],v=y.label;const e=a.setContext(this.getContext(f));w=this.getPixelForTick(f)+a.labelOffset,C=this._resolveTickFontOptions(f),S=C.lineHeight,F=Es(v)?v.length:1;const t=F/2,s=e.color,l=e.textStrokeColor,d=e.textStrokeWidth;let h,u=_;if(n?(x=w,"inner"===_&&(u=f===b-1?this.options.reverse?"left":"right":0===f?this.options.reverse?"right":"left":"center"),T="top"===i?"near"===r||0!==g?-F*S+S/2:"center"===r?-M.highest.height/2-t*S+S:-M.highest.height+S/2:"near"===r||0!==g?S/2:"center"===r?M.highest.height/2-t*S:M.highest.height-F*S,c&&(T*=-1),0===g||e.showLabelBackdrop||(x+=S/2*Math.sin(g))):(k=w,T=(1-F)*S/2),e.showLabelBackdrop){const t=ja(e.backdropPadding),s=M.heights[f],i=M.widths[f];let a=T-t.top,n=0-t.left;switch(A){case"middle":a-=s/2;break;case"bottom":a-=s;break}switch(_){case"center":n-=i/2;break;case"right":n-=i;break;case"inner":f===b-1?n-=i:f>0&&(n-=i/2);break}h={left:n,top:a,width:i+t.width,height:s+t.height,color:e.backdropColor}}m.push({label:v,font:C,textOffset:T,options:{rotation:g,color:s,strokeColor:l,strokeWidth:d,textAlign:u,textBaseline:A,translation:[x,k],backdrop:h}})}return m}_getXAxisLabelAlignment(){const{position:e,ticks:t}=this.options,s=-wi(this.labelRotation);if(s)return"top"===e?"left":"right";let i="center";return"start"===t.align?i="left":"end"===t.align?i="right":"inner"===t.align&&(i="inner"),i}_getYAxisLabelAlignment(e){const{position:t,ticks:{crossAlign:s,mirror:i,padding:a}}=this.options,n=this._getLabelSizes(),o=e+a,l=n.widest.width;let r,d;return"left"===t?i?(d=this.right+a,"near"===s?r="left":"center"===s?(r="center",d+=l/2):(r="right",d+=l)):(d=this.right-o,"near"===s?r="right":"center"===s?(r="center",d-=l/2):(r="left",d=this.left)):"right"===t?i?(d=this.left+a,"near"===s?r="right":"center"===s?(r="center",d-=l/2):(r="left",d-=l)):(d=this.left+o,"near"===s?r="left":"center"===s?(r="center",d+=l/2):(r="right",d=this.right)):r="right",{textAlign:r,x:d}}_computeLabelArea(){if(this.options.ticks.mirror)return;const e=this.chart,t=this.options.position;return"left"===t||"right"===t?{top:0,left:this.left,bottom:e.height,right:this.right}:"top"===t||"bottom"===t?{top:this.top,left:0,bottom:this.bottom,right:e.width}:void 0}drawBackground(){const{ctx:e,options:{backgroundColor:t},left:s,top:i,width:a,height:n}=this;t&&(e.save(),e.fillStyle=t,e.fillRect(s,i,a,n),e.restore())}getLineWidthForValue(e){const t=this.options.grid;if(!this._isVisible()||!t.display)return 0;const s=this.ticks,i=s.findIndex(t=>t.value===e);if(i>=0){const e=t.setContext(this.getContext(i));return e.lineWidth}return 0}drawGrid(e){const t=this.options.grid,s=this.ctx,i=this._gridLineItems||(this._gridLineItems=this._computeGridLineItems(e));let a,n;const o=(e,t,i)=>{i.width&&i.color&&(s.save(),s.lineWidth=i.width,s.strokeStyle=i.color,s.setLineDash(i.borderDash||[]),s.lineDashOffset=i.borderDashOffset,s.beginPath(),s.moveTo(e.x,e.y),s.lineTo(t.x,t.y),s.stroke(),s.restore())};if(t.display)for(a=0,n=i.length;a<n;++a){const e=i[a];t.drawOnChartArea&&o({x:e.x1,y:e.y1},{x:e.x2,y:e.y2},e),t.drawTicks&&o({x:e.tx1,y:e.ty1},{x:e.tx2,y:e.ty2},{color:e.tickColor,width:e.tickWidth,borderDash:e.tickBorderDash,borderDashOffset:e.tickBorderDashOffset})}}drawBorder(){const{chart:e,ctx:t,options:{border:s,grid:i}}=this,a=s.setContext(this.getContext()),n=s.display?a.width:0;if(!n)return;const o=i.setContext(this.getContext(0)).lineWidth,l=this._borderValue;let r,d,c,h;this.isHorizontal()?(r=wa(e,this.left,n)-n/2,d=wa(e,this.right,o)+o/2,c=h=l):(c=wa(e,this.top,n)-n/2,h=wa(e,this.bottom,o)+o/2,r=d=l),t.save(),t.lineWidth=a.width,t.strokeStyle=a.color,t.beginPath(),t.moveTo(r,c),t.lineTo(d,h),t.stroke(),t.restore()}drawLabels(e){const t=this.options.ticks;if(!t.display)return;const s=this.ctx,i=this._computeLabelArea();i&&Aa(s,i);const a=this.getLabelItems(e);for(const n of a){const e=n.options,t=n.font,i=n.label,a=n.textOffset;Ea(s,i,0,a,t,e)}i&&Ma(s)}drawTitle(){const{ctx:e,options:{position:t,title:s,reverse:i}}=this;if(!s.display)return;const a=Ha(s.font),n=ja(s.padding),o=s.align;let l=a.lineHeight/2;"bottom"===t||"center"===t||Is(t)?(l+=n.bottom,Es(s.text)&&(l+=a.lineHeight*(s.text.length-1))):l+=n.top;const{titleX:r,titleY:d,maxWidth:c,rotation:h}=Tr(this,l,t,o);Ea(e,s.text,0,0,a,{color:s.color,maxWidth:c,rotation:h,textAlign:Fr(o,t,i),textBaseline:"middle",translation:[r,d]})}draw(e){this._isVisible()&&(this.drawBackground(),this.drawGrid(e),this.drawBorder(),this.drawTitle(),this.drawLabels(e))}_layers(){const e=this.options,t=e.ticks&&e.ticks.z||0,s=Rs(e.grid&&e.grid.z,-1),i=Rs(e.border&&e.border.z,0);return this._isVisible()&&this.draw===Ar.prototype.draw?[{z:s,draw:e=>{this.drawBackground(),this.drawGrid(e),this.drawTitle()}},{z:i,draw:()=>{this.drawBorder()}},{z:t,draw:e=>{this.drawLabels(e)}}]:[{z:t,draw:e=>{this.draw(e)}}]}getMatchingVisibleMetas(e){const t=this.chart.getSortedVisibleDatasetMetas(),s=this.axis+"AxisID",i=[];let a,n;for(a=0,n=t.length;a<n;++a){const n=t[a];n[s]!==this.id||e&&n.type!==e||i.push(n)}return i}_resolveTickFontOptions(e){const t=this.options.ticks.setContext(this.getContext(e));return Ha(t.font)}_maxDigits(){const e=this._resolveTickFontOptions(0).lineHeight;return(this.isHorizontal()?this.width:this.height)/e}}class Mr{constructor(e,t,s){this.type=e,this.scope=t,this.override=s,this.items=Object.create(null)}isForType(e){return Object.prototype.isPrototypeOf.call(this.type.prototype,e.prototype)}register(e){const t=Object.getPrototypeOf(e);let s;Dr(t)&&(s=this.register(t));const i=this.items,a=e.id,n=this.scope+"."+a;if(!a)throw new Error("class does not have id: "+e);return a in i||(i[a]=e,Pr(e,n,s),this.override&&va.override(e.id,e.overrides)),n}get(e){return this.items[e]}unregister(e){const t=this.items,s=e.id,i=this.scope;s in t&&delete t[s],i&&s in va[i]&&(delete va[i][s],this.override&&delete ga[s])}}function Pr(e,t,s){const i=Ks(Object.create(null),[s?va.get(s):{},va.get(t),e.defaults]);va.set(t,i),e.defaultRoutes&&$r(t,e.defaultRoutes),e.descriptors&&va.describe(t,e.descriptors)}function $r(e,t){Object.keys(t).forEach(s=>{const i=s.split("."),a=i.pop(),n=[e].concat(i).join("."),o=t[s].split("."),l=o.pop(),r=o.join(".");va.route(n,a,r,l)})}function Dr(e){return"id"in e&&"defaults"in e}class Vr{constructor(){this.controllers=new Mr(Ro,"datasets",!0),this.elements=new Mr(rr,"elements"),this.plugins=new Mr(Object,"plugins"),this.scales=new Mr(Ar,"scales"),this._typedRegistries=[this.controllers,this.scales,this.elements]}add(...e){this._each("register",e)}remove(...e){this._each("unregister",e)}addControllers(...e){this._each("register",e,this.controllers)}addElements(...e){this._each("register",e,this.elements)}addPlugins(...e){this._each("register",e,this.plugins)}addScales(...e){this._each("register",e,this.scales)}getController(e){return this._get(e,this.controllers,"controller")}getElement(e){return this._get(e,this.elements,"element")}getPlugin(e){return this._get(e,this.plugins,"plugin")}getScale(e){return this._get(e,this.scales,"scale")}removeControllers(...e){this._each("unregister",e,this.controllers)}removeElements(...e){this._each("unregister",e,this.elements)}removePlugins(...e){this._each("unregister",e,this.plugins)}removeScales(...e){this._each("unregister",e,this.scales)}_each(e,t,s){[...t].forEach(t=>{const i=s||this._getRegistryForType(t);s||i.isForType(t)||i===this.plugins&&t.id?this._exec(e,i,t):Bs(t,t=>{const i=s||this._getRegistryForType(t);this._exec(e,i,t)})})}_exec(e,t,s){const i=ti(e);zs(s["before"+i],[],s),t[e](s),zs(s["after"+i],[],s)}_getRegistryForType(e){for(let t=0;t<this._typedRegistries.length;t++){const s=this._typedRegistries[t];if(s.isForType(e))return s}return this.plugins}_get(e,t,s){const i=t.get(e);if(void 0===i)throw new Error('"'+e+'" is not a registered '+s+".");return i}}var Lr=new Vr;class Er{constructor(){this._init=void 0}notify(e,t,s,i){if("beforeInit"===t&&(this._init=this._createDescriptors(e,!0),this._notify(this._init,e,"install")),void 0===this._init)return;const a=i?this._descriptors(e).filter(i):this._descriptors(e),n=this._notify(a,e,t,s);return"afterDestroy"===t&&(this._notify(a,e,"stop"),this._notify(this._init,e,"uninstall"),this._init=void 0),n}_notify(e,t,s,i){i=i||{};for(const a of e){const e=a.plugin,n=e[s],o=[t,i,a.options];if(!1===zs(n,o,e)&&i.cancelable)return!1}return!0}invalidate(){Ls(this._cache)||(this._oldCache=this._cache,this._cache=void 0)}_descriptors(e){if(this._cache)return this._cache;const t=this._cache=this._createDescriptors(e);return this._notifyStateChanges(e),t}_createDescriptors(e,t){const s=e&&e.config,i=Rs(s.options&&s.options.plugins,{}),a=Ir(s);return!1!==i||t?Or(e,a,i,t):[]}_notifyStateChanges(e){const t=this._oldCache||[],s=this._cache,i=(e,t)=>e.filter(e=>!t.some(t=>e.plugin.id===t.plugin.id));this._notify(i(t,s),e,"stop"),this._notify(i(s,t),e,"start")}}function Ir(e){const t={},s=[],i=Object.keys(Lr.plugins.items);for(let n=0;n<i.length;n++)s.push(Lr.getPlugin(i[n]));const a=e.plugins||[];for(let n=0;n<a.length;n++){const e=a[n];-1===s.indexOf(e)&&(s.push(e),t[e.id]=!0)}return{plugins:s,localIds:t}}function Ur(e,t){return t||!1!==e?!0===e?{}:e:null}function Or(e,{plugins:t,localIds:s},i,a){const n=[],o=e.getContext();for(const l of t){const t=l.id,r=Ur(i[t],a);null!==r&&n.push({plugin:l,options:Rr(e.config,{plugin:l,local:s[t]},r,o)})}return n}function Rr(e,{plugin:t,local:s},i,a){const n=e.pluginScopeKeys(t),o=e.getOptionScopes(i,n);return s&&t.defaults&&o.push(t.defaults),e.createResolver(o,a,[""],{scriptable:!1,indexable:!1,allKeys:!0})}function Wr(e,t){const s=va.datasets[e]||{},i=(t.datasets||{})[e]||{};return i.indexAxis||t.indexAxis||s.indexAxis||"x"}function Nr(e,t){let s=e;return"_index_"===e?s=t:"_value_"===e&&(s="x"===t?"y":"x"),s}function zr(e,t){return e===t?"_index_":"_value_"}function Br(e){if("x"===e||"y"===e||"r"===e)return e}function jr(e){return"top"===e||"bottom"===e?"x":"left"===e||"right"===e?"y":void 0}function Hr(e,...t){if(Br(e))return e;for(const s of t){const t=s.axis||jr(s.position)||e.length>1&&Br(e[0].toLowerCase());if(t)return t}throw new Error(`Cannot determine type of '${e}' axis. Please provide 'axis' or 'position' option.`)}function qr(e,t,s){if(s[t+"AxisID"]===e)return{axis:t}}function Xr(e,t){if(t.data&&t.data.datasets){const s=t.data.datasets.filter(t=>t.xAxisID===e||t.yAxisID===e);if(s.length)return qr(e,"x",s[0])||qr(e,"y",s[0])}return{}}function Kr(e,t){const s=ga[e.type]||{scales:{}},i=t.scales||{},a=Wr(e.type,t),n=Object.create(null);return Object.keys(i).forEach(t=>{const o=i[t];if(!Is(o))return console.error(`Invalid scale configuration for scale: ${t}`);if(o._proxy)return console.warn(`Ignoring resolver passed as options for scale: ${t}`);const l=Hr(t,o,Xr(t,e),va.scales[o.type]),r=zr(l,a),d=s.scales||{};n[t]=Qs(Object.create(null),[{axis:l},o,d[l],d[r]])}),e.data.datasets.forEach(s=>{const a=s.type||e.type,o=s.indexAxis||Wr(a,t),l=ga[a]||{},r=l.scales||{};Object.keys(r).forEach(e=>{const t=Nr(e,o),a=s[t+"AxisID"]||t;n[a]=n[a]||Object.create(null),Qs(n[a],[{axis:t},i[a],r[e]])})}),Object.keys(n).forEach(e=>{const t=n[e];Qs(t,[va.scales[t.type],va.scale])}),n}function Qr(e){const t=e.options||(e.options={});t.plugins=Rs(t.plugins,{}),t.scales=Kr(e,t)}function Yr(e){return e=e||{},e.datasets=e.datasets||[],e.labels=e.labels||[],e}function Gr(e){return e=e||{},e.data=Yr(e.data),Qr(e),e}const Jr=new Map,Zr=new Set;function ed(e,t){let s=Jr.get(e);return s||(s=t(),Jr.set(e,s),Zr.add(s)),s}const td=(e,t,s)=>{const i=ei(t,s);void 0!==i&&e.add(i)};class sd{constructor(e){this._config=Gr(e),this._scopeCache=new Map,this._resolverCache=new Map}get platform(){return this._config.platform}get type(){return this._config.type}set type(e){this._config.type=e}get data(){return this._config.data}set data(e){this._config.data=Yr(e)}get options(){return this._config.options}set options(e){this._config.options=e}get plugins(){return this._config.plugins}update(){const e=this._config;this.clearCache(),Qr(e)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(e){return ed(e,()=>[[`datasets.${e}`,""]])}datasetAnimationScopeKeys(e,t){return ed(`${e}.transition.${t}`,()=>[[`datasets.${e}.transitions.${t}`,`transitions.${t}`],[`datasets.${e}`,""]])}datasetElementScopeKeys(e,t){return ed(`${e}-${t}`,()=>[[`datasets.${e}.elements.${t}`,`datasets.${e}`,`elements.${t}`,""]])}pluginScopeKeys(e){const t=e.id,s=this.type;return ed(`${s}-plugin-${t}`,()=>[[`plugins.${t}`,...e.additionalOptionScopes||[]]])}_cachedScopes(e,t){const s=this._scopeCache;let i=s.get(e);return i&&!t||(i=new Map,s.set(e,i)),i}getOptionScopes(e,t,s){const{options:i,type:a}=this,n=this._cachedScopes(e,s),o=n.get(t);if(o)return o;const l=new Set;t.forEach(t=>{e&&(l.add(e),t.forEach(t=>td(l,e,t))),t.forEach(e=>td(l,i,e)),t.forEach(e=>td(l,ga[a]||{},e)),t.forEach(e=>td(l,va,e)),t.forEach(e=>td(l,ma,e))});const r=Array.from(l);return 0===r.length&&r.push(Object.create(null)),Zr.has(t)&&n.set(t,r),r}chartOptionScopes(){const{options:e,type:t}=this;return[e,ga[t]||{},va.datasets[t]||{},{type:t},va,ma]}resolveNamedOptions(e,t,s,i=[""]){const a={$shared:!0},{resolver:n,subPrefixes:o}=id(this._resolverCache,e,i);let l=n;if(nd(n,t)){a.$shared=!1,s=ii(s)?s():s;const t=this.createResolver(e,s,o);l=Ya(n,s,t)}for(const r of t)a[r]=l[r];return a}createResolver(e,t,s=[""],i){const{resolver:a}=id(this._resolverCache,e,s);return Is(t)?Ya(a,t,void 0,i):a}}function id(e,t,s){let i=e.get(t);i||(i=new Map,e.set(t,i));const a=s.join();let n=i.get(a);if(!n){const e=Qa(t,s);n={resolver:e,subPrefixes:s.filter(e=>!e.toLowerCase().includes("hover"))},i.set(a,n)}return n}const ad=e=>Is(e)&&Object.getOwnPropertyNames(e).some(t=>ii(e[t]));function nd(e,t){const{isScriptable:s,isIndexable:i}=Ga(e);for(const a of t){const t=s(a),n=i(a),o=(n||t)&&e[a];if(t&&(ii(o)||ad(o))||n&&Es(o))return!0}return!1}var od="4.5.1";const ld=["top","bottom","left","right","chartArea"];function rd(e,t){return"top"===e||"bottom"===e||-1===ld.indexOf(e)&&"x"===t}function dd(e,t){return function(s,i){return s[e]===i[e]?s[t]-i[t]:s[e]-i[e]}}function cd(e){const t=e.chart,s=t.options.animation;t.notifyPlugins("afterRender"),zs(s&&s.onComplete,[e],t)}function hd(e){const t=e.chart,s=t.options.animation;zs(s&&s.onProgress,[e],t)}function ud(e){return Fn()&&"string"===typeof e?e=document.getElementById(e):e&&e.length&&(e=e[0]),e&&e.canvas&&(e=e.canvas),e}const pd={},gd=e=>{const t=ud(e);return Object.values(pd).filter(e=>e.canvas===t).pop()};function md(e,t,s){const i=Object.keys(e);for(const a of i){const i=+a;if(i>=t){const n=e[a];delete e[a],(s>0||i>t)&&(e[i+s]=n)}}}function fd(e,t,s,i){return s&&"mouseout"!==e.type?i?t:e:null}class bd{static register(...e){Lr.add(...e),yd()}static unregister(...e){Lr.remove(...e),yd()}constructor(e,t){const s=this.config=new sd(t),i=ud(e),a=gd(i);if(a)throw new Error("Canvas is already in use. Chart with ID '"+a.id+"' must be destroyed before the canvas with ID '"+a.canvas.id+"' can be reused.");const n=s.createResolver(s.chartOptionScopes(),this.getContext());this.platform=new(s.platform||lr(i)),this.platform.updateConfig(s);const o=this.platform.acquireContext(i,n.aspectRatio),l=o&&o.canvas,r=l&&l.height,d=l&&l.width;this.id=Vs(),this.ctx=o,this.canvas=l,this.width=d,this.height=r,this._options=n,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 Er,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=ji(e=>this.update(e),n.resizeDelay||0),this._dataChanges=[],pd[this.id]=this,o&&l?(po.listen(this,"complete",cd),po.listen(this,"progress",hd),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:e,maintainAspectRatio:t},width:s,height:i,_aspectRatio:a}=this;return Ls(e)?t&&a?a:i?s/i:null:e}get data(){return this.config.data}set data(e){this.config.data=e}get options(){return this._options}set options(e){this.config.options=e}get registry(){return Lr}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():Rn(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return Ca(this.canvas,this.ctx),this}stop(){return po.stop(this),this}resize(e,t){po.running(this)?this._resizeBeforeDraw={width:e,height:t}:this._resize(e,t)}_resize(e,t){const s=this.options,i=this.canvas,a=s.maintainAspectRatio&&this.aspectRatio,n=this.platform.getMaximumSize(i,e,t,a),o=s.devicePixelRatio||this.platform.getDevicePixelRatio(),l=this.width?"resize":"attach";this.width=n.width,this.height=n.height,this._aspectRatio=this.aspectRatio,Rn(this,o,!0)&&(this.notifyPlugins("resize",{size:n}),zs(s.onResize,[this,n],this),this.attached&&this._doResize(l)&&this.render())}ensureScalesHaveIDs(){const e=this.options,t=e.scales||{};Bs(t,(e,t)=>{e.id=t})}buildOrUpdateScales(){const e=this.options,t=e.scales,s=this.scales,i=Object.keys(s).reduce((e,t)=>(e[t]=!1,e),{});let a=[];t&&(a=a.concat(Object.keys(t).map(e=>{const s=t[e],i=Hr(e,s),a="r"===i,n="x"===i;return{options:s,dposition:a?"chartArea":n?"bottom":"left",dtype:a?"radialLinear":n?"category":"linear"}}))),Bs(a,t=>{const a=t.options,n=a.id,o=Hr(n,a),l=Rs(a.type,t.dtype);void 0!==a.position&&rd(a.position,o)===rd(t.dposition)||(a.position=t.dposition),i[n]=!0;let r=null;if(n in s&&s[n].type===l)r=s[n];else{const e=Lr.getScale(l);r=new e({id:n,type:l,ctx:this.ctx,chart:this}),s[r.id]=r}r.init(a,e)}),Bs(i,(e,t)=>{e||delete s[t]}),Bs(s,e=>{Ol.configure(this,e,e.options),Ol.addBox(this,e)})}_updateMetasets(){const e=this._metasets,t=this.data.datasets.length,s=e.length;if(e.sort((e,t)=>e.index-t.index),s>t){for(let e=t;e<s;++e)this._destroyDatasetMeta(e);e.splice(t,s-t)}this._sortedMetasets=e.slice(0).sort(dd("order","index"))}_removeUnreferencedMetasets(){const{_metasets:e,data:{datasets:t}}=this;e.length>t.length&&delete this._stacks,e.forEach((e,s)=>{0===t.filter(t=>t===e._dataset).length&&this._destroyDatasetMeta(s)})}buildOrUpdateControllers(){const e=[],t=this.data.datasets;let s,i;for(this._removeUnreferencedMetasets(),s=0,i=t.length;s<i;s++){const i=t[s];let a=this.getDatasetMeta(s);const n=i.type||this.config.type;if(a.type&&a.type!==n&&(this._destroyDatasetMeta(s),a=this.getDatasetMeta(s)),a.type=n,a.indexAxis=i.indexAxis||Wr(n,this.options),a.order=i.order||0,a.index=s,a.label=""+i.label,a.visible=this.isDatasetVisible(s),a.controller)a.controller.updateIndex(s),a.controller.linkScales();else{const t=Lr.getController(n),{datasetElementType:i,dataElementType:o}=va.datasets[n];Object.assign(t,{dataElementType:Lr.getElement(o),datasetElementType:i&&Lr.getElement(i)}),a.controller=new t(this,s),e.push(a.controller)}}return this._updateMetasets(),e}_resetElements(){Bs(this.data.datasets,(e,t)=>{this.getDatasetMeta(t).controller.reset()},this)}reset(){this._resetElements(),this.notifyPlugins("reset")}update(e){const t=this.config;t.update();const s=this._options=t.createResolver(t.chartOptionScopes(),this.getContext()),i=this._animationsDisabled=!s.animation;if(this._updateScales(),this._checkEventBindings(),this._updateHiddenIndices(),this._plugins.invalidate(),!1===this.notifyPlugins("beforeUpdate",{mode:e,cancelable:!0}))return;const a=this.buildOrUpdateControllers();this.notifyPlugins("beforeElementsUpdate");let n=0;for(let r=0,d=this.data.datasets.length;r<d;r++){const{controller:e}=this.getDatasetMeta(r),t=!i&&-1===a.indexOf(e);e.buildOrUpdateElements(t),n=Math.max(+e.getMaxOverflow(),n)}n=this._minPadding=s.layout.autoPadding?n:0,this._updateLayout(n),i||Bs(a,e=>{e.reset()}),this._updateDatasets(e),this.notifyPlugins("afterUpdate",{mode:e}),this._layers.sort(dd("z","_idx"));const{_active:o,_lastEvent:l}=this;l?this._eventHandler(l,!0):o.length&&this._updateHoverStyles(o,o,!0),this.render()}_updateScales(){Bs(this.scales,e=>{Ol.removeBox(this,e)}),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){const e=this.options,t=new Set(Object.keys(this._listeners)),s=new Set(e.events);ai(t,s)&&!!this._responsiveListeners===e.responsive||(this.unbindEvents(),this.bindEvents())}_updateHiddenIndices(){const{_hiddenIndices:e}=this,t=this._getUniformDataChanges()||[];for(const{method:s,start:i,count:a}of t){const t="_removeElements"===s?-a:a;md(e,i,t)}}_getUniformDataChanges(){const e=this._dataChanges;if(!e||!e.length)return;this._dataChanges=[];const t=this.data.datasets.length,s=t=>new Set(e.filter(e=>e[0]===t).map((e,t)=>t+","+e.splice(1).join(","))),i=s(0);for(let a=1;a<t;a++)if(!ai(i,s(a)))return;return Array.from(i).map(e=>e.split(",")).map(e=>({method:e[1],start:+e[2],count:+e[3]}))}_updateLayout(e){if(!1===this.notifyPlugins("beforeLayout",{cancelable:!0}))return;Ol.update(this,this.width,this.height,e);const t=this.chartArea,s=t.width<=0||t.height<=0;this._layers=[],Bs(this.boxes,e=>{s&&"chartArea"===e.position||(e.configure&&e.configure(),this._layers.push(...e._layers()))},this),this._layers.forEach((e,t)=>{e._idx=t}),this.notifyPlugins("afterLayout")}_updateDatasets(e){if(!1!==this.notifyPlugins("beforeDatasetsUpdate",{mode:e,cancelable:!0})){for(let e=0,t=this.data.datasets.length;e<t;++e)this.getDatasetMeta(e).controller.configure();for(let t=0,s=this.data.datasets.length;t<s;++t)this._updateDataset(t,ii(e)?e({datasetIndex:t}):e);this.notifyPlugins("afterDatasetsUpdate",{mode:e})}}_updateDataset(e,t){const s=this.getDatasetMeta(e),i={meta:s,index:e,mode:t,cancelable:!0};!1!==this.notifyPlugins("beforeDatasetUpdate",i)&&(s.controller._update(t),i.cancelable=!1,this.notifyPlugins("afterDatasetUpdate",i))}render(){!1!==this.notifyPlugins("beforeRender",{cancelable:!0})&&(po.has(this)?this.attached&&!po.running(this)&&po.start(this):(this.draw(),cd({chart:this})))}draw(){let e;if(this._resizeBeforeDraw){const{width:e,height:t}=this._resizeBeforeDraw;this._resizeBeforeDraw=null,this._resize(e,t)}if(this.clear(),this.width<=0||this.height<=0)return;if(!1===this.notifyPlugins("beforeDraw",{cancelable:!0}))return;const t=this._layers;for(e=0;e<t.length&&t[e].z<=0;++e)t[e].draw(this.chartArea);for(this._drawDatasets();e<t.length;++e)t[e].draw(this.chartArea);this.notifyPlugins("afterDraw")}_getSortedDatasetMetas(e){const t=this._sortedMetasets,s=[];let i,a;for(i=0,a=t.length;i<a;++i){const a=t[i];e&&!a.visible||s.push(a)}return s}getSortedVisibleDatasetMetas(){return this._getSortedDatasetMetas(!0)}_drawDatasets(){if(!1===this.notifyPlugins("beforeDatasetsDraw",{cancelable:!0}))return;const e=this.getSortedVisibleDatasetMetas();for(let t=e.length-1;t>=0;--t)this._drawDataset(e[t]);this.notifyPlugins("afterDatasetsDraw")}_drawDataset(e){const t=this.ctx,s={meta:e,index:e.index,cancelable:!0},i=ho(this,e);!1!==this.notifyPlugins("beforeDatasetDraw",s)&&(i&&Aa(t,i),e.controller.draw(),i&&Ma(t),s.cancelable=!1,this.notifyPlugins("afterDatasetDraw",s))}isPointInArea(e){return Ta(e,this.chartArea,this._minPadding)}getElementsAtEventForMode(e,t,s,i){const a=kl.modes[t];return"function"===typeof a?a(this,e,s,i):[]}getDatasetMeta(e){const t=this.data.datasets[e],s=this._metasets;let i=s.filter(e=>e&&e._dataset===t).pop();return i||(i={type:null,data:[],dataset:null,controller:null,hidden:null,xAxisID:null,yAxisID:null,order:t&&t.order||0,index:e,_dataset:t,_parsed:[],_sorted:!1},s.push(i)),i}getContext(){return this.$context||(this.$context=Ka(null,{chart:this,type:"chart"}))}getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(e){const t=this.data.datasets[e];if(!t)return!1;const s=this.getDatasetMeta(e);return"boolean"===typeof s.hidden?!s.hidden:!t.hidden}setDatasetVisibility(e,t){const s=this.getDatasetMeta(e);s.hidden=!t}toggleDataVisibility(e){this._hiddenIndices[e]=!this._hiddenIndices[e]}getDataVisibility(e){return!this._hiddenIndices[e]}_updateVisibility(e,t,s){const i=s?"show":"hide",a=this.getDatasetMeta(e),n=a.controller._resolveAnimations(void 0,i);si(t)?(a.data[t].hidden=!s,this.update()):(this.setDatasetVisibility(e,s),n.update(a,{visible:s}),this.update(t=>t.datasetIndex===e?i:void 0))}hide(e,t){this._updateVisibility(e,t,!1)}show(e,t){this._updateVisibility(e,t,!0)}_destroyDatasetMeta(e){const t=this._metasets[e];t&&t.controller&&t.controller._destroy(),delete this._metasets[e]}_stop(){let e,t;for(this.stop(),po.remove(this),e=0,t=this.data.datasets.length;e<t;++e)this._destroyDatasetMeta(e)}destroy(){this.notifyPlugins("beforeDestroy");const{canvas:e,ctx:t}=this;this._stop(),this.config.clearCache(),e&&(this.unbindEvents(),Ca(e,t),this.platform.releaseContext(t),this.canvas=null,this.ctx=null),delete pd[this.id],this.notifyPlugins("afterDestroy")}toBase64Image(...e){return this.canvas.toDataURL(...e)}bindEvents(){this.bindUserEvents(),this.options.responsive?this.bindResponsiveEvents():this.attached=!0}bindUserEvents(){const e=this._listeners,t=this.platform,s=(s,i)=>{t.addEventListener(this,s,i),e[s]=i},i=(e,t,s)=>{e.offsetX=t,e.offsetY=s,this._eventHandler(e)};Bs(this.options.events,e=>s(e,i))}bindResponsiveEvents(){this._responsiveListeners||(this._responsiveListeners={});const e=this._responsiveListeners,t=this.platform,s=(s,i)=>{t.addEventListener(this,s,i),e[s]=i},i=(s,i)=>{e[s]&&(t.removeEventListener(this,s,i),delete e[s])},a=(e,t)=>{this.canvas&&this.resize(e,t)};let n;const o=()=>{i("attach",o),this.attached=!0,this.resize(),s("resize",a),s("detach",n)};n=()=>{this.attached=!1,i("resize",a),this._stop(),this._resize(0,0),s("attach",o)},t.isAttached(this.canvas)?o():n()}unbindEvents(){Bs(this._listeners,(e,t)=>{this.platform.removeEventListener(this,t,e)}),this._listeners={},Bs(this._responsiveListeners,(e,t)=>{this.platform.removeEventListener(this,t,e)}),this._responsiveListeners=void 0}updateHoverStyle(e,t,s){const i=s?"set":"remove";let a,n,o,l;for("dataset"===t&&(a=this.getDatasetMeta(e[0].datasetIndex),a.controller["_"+i+"DatasetHoverStyle"]()),o=0,l=e.length;o<l;++o){n=e[o];const t=n&&this.getDatasetMeta(n.datasetIndex).controller;t&&t[i+"HoverStyle"](n.element,n.datasetIndex,n.index)}}getActiveElements(){return this._active||[]}setActiveElements(e){const t=this._active||[],s=e.map(({datasetIndex:e,index:t})=>{const s=this.getDatasetMeta(e);if(!s)throw new Error("No dataset found at index "+e);return{datasetIndex:e,element:s.data[t],index:t}}),i=!js(s,t);i&&(this._active=s,this._lastEvent=null,this._updateHoverStyles(s,t))}notifyPlugins(e,t,s){return this._plugins.notify(this,e,t,s)}isPluginEnabled(e){return 1===this._plugins._cache.filter(t=>t.plugin.id===e).length}_updateHoverStyles(e,t,s){const i=this.options.hover,a=(e,t)=>e.filter(e=>!t.some(t=>e.datasetIndex===t.datasetIndex&&e.index===t.index)),n=a(t,e),o=s?e:a(e,t);n.length&&this.updateHoverStyle(n,i.mode,!1),o.length&&i.mode&&this.updateHoverStyle(o,i.mode,!0)}_eventHandler(e,t){const s={event:e,replay:t,cancelable:!0,inChartArea:this.isPointInArea(e)},i=t=>(t.options.events||this.options.events).includes(e.native.type);if(!1===this.notifyPlugins("beforeEvent",s,i))return;const a=this._handleEvent(e,t,s.inChartArea);return s.cancelable=!1,this.notifyPlugins("afterEvent",s,i),(a||s.changed)&&this.render(),this}_handleEvent(e,t,s){const{_active:i=[],options:a}=this,n=t,o=this._getActiveElements(e,i,s,n),l=ni(e),r=fd(e,this._lastEvent,s,l);s&&(this._lastEvent=null,zs(a.onHover,[e,o,this],this),l&&zs(a.onClick,[e,o,this],this));const d=!js(o,i);return(d||t)&&(this._active=o,this._updateHoverStyles(o,i,t)),this._lastEvent=r,d}_getActiveElements(e,t,s,i){if("mouseout"===e.type)return[];if(!s)return t;const a=this.options.hover;return this.getElementsAtEventForMode(e,a.mode,a,i)}}function yd(){return Bs(bd.instances,e=>e._plugins.invalidate())}function vd(e,t,s){const{startAngle:i,x:a,y:n,outerRadius:o,innerRadius:l,options:r}=t,{borderWidth:d,borderJoinStyle:c}=r,h=Math.min(d/o,Mi(i-s));if(e.beginPath(),e.arc(a,n,o-d/2,i+h/2,s-h/2),l>0){const t=Math.min(d/l,Mi(i-s));e.arc(a,n,l+d/2,s-t/2,i+t/2,!0)}else{const t=Math.min(d/2,o*Mi(i-s));if("round"===c)e.arc(a,n,t,s-oi/2,i+oi/2,!0);else if("bevel"===c){const o=2*t*t,l=-o*Math.cos(s+oi/2)+a,r=-o*Math.sin(s+oi/2)+n,d=o*Math.cos(i+oi/2)+a,c=o*Math.sin(i+oi/2)+n;e.lineTo(l,r),e.lineTo(d,c)}}e.closePath(),e.moveTo(0,0),e.rect(0,0,e.canvas.width,e.canvas.height),e.clip("evenodd")}function xd(e,t,s){const{startAngle:i,pixelMargin:a,x:n,y:o,outerRadius:l,innerRadius:r}=t;let d=a/l;e.beginPath(),e.arc(n,o,l,i-d,s+d),r>a?(d=a/r,e.arc(n,o,r,s+d,i-d,!0)):e.arc(n,o,a,s+hi,i-hi),e.closePath(),e.clip()}function kd(e){return Na(e,["outerStart","outerEnd","innerStart","innerEnd"])}function _d(e,t,s,i){const a=kd(e.options.borderRadius),n=(s-t)/2,o=Math.min(n,i*t/2),l=e=>{const t=(s-Math.min(n,e))*i/2;return $i(e,0,Math.min(n,t))};return{outerStart:l(a.outerStart),outerEnd:l(a.outerEnd),innerStart:$i(a.innerStart,0,o),innerEnd:$i(a.innerEnd,0,o)}}function wd(e,t,s,i){return{x:s+e*Math.cos(t),y:i+e*Math.sin(t)}}function Cd(e,t,s,i,a,n){const{x:o,y:l,startAngle:r,pixelMargin:d,innerRadius:c}=t,h=Math.max(t.outerRadius+i+s-d,0),u=c>0?c+i+s+d:0;let p=0;const g=a-r;if(i){const e=c>0?c-i:0,t=h>0?h-i:0,s=(e+t)/2,a=0!==s?g*s/(s+i):g;p=(g-a)/2}const m=Math.max(.001,g*h-s/oi)/h,f=(g-m)/2,b=r+f+p,y=a-f-p,{outerStart:v,outerEnd:x,innerStart:k,innerEnd:_}=_d(t,u,h,y-b),w=h-v,C=h-x,S=b+v/w,F=y-x/C,T=u+k,A=u+_,M=b+k/T,P=y-_/A;if(e.beginPath(),n){const t=(S+F)/2;if(e.arc(o,l,h,S,t),e.arc(o,l,h,t,F),x>0){const t=wd(C,F,o,l);e.arc(t.x,t.y,x,F,y+hi)}const s=wd(A,y,o,l);if(e.lineTo(s.x,s.y),_>0){const t=wd(A,P,o,l);e.arc(t.x,t.y,_,y+hi,P+Math.PI)}const i=(y-_/u+(b+k/u))/2;if(e.arc(o,l,u,y-_/u,i,!0),e.arc(o,l,u,i,b+k/u,!0),k>0){const t=wd(T,M,o,l);e.arc(t.x,t.y,k,M+Math.PI,b-hi)}const a=wd(w,b,o,l);if(e.lineTo(a.x,a.y),v>0){const t=wd(w,S,o,l);e.arc(t.x,t.y,v,b-hi,S)}}else{e.moveTo(o,l);const t=Math.cos(S)*h+o,s=Math.sin(S)*h+l;e.lineTo(t,s);const i=Math.cos(F)*h+o,a=Math.sin(F)*h+l;e.lineTo(i,a)}e.closePath()}function Sd(e,t,s,i,a){const{fullCircles:n,startAngle:o,circumference:l}=t;let r=t.endAngle;if(n){Cd(e,t,s,i,r,a);for(let t=0;t<n;++t)e.fill();isNaN(l)||(r=o+(l%li||li))}return Cd(e,t,s,i,r,a),e.fill(),r}function Fd(e,t,s,i,a){const{fullCircles:n,startAngle:o,circumference:l,options:r}=t,{borderWidth:d,borderJoinStyle:c,borderDash:h,borderDashOffset:u,borderRadius:p}=r,g="inner"===r.borderAlign;if(!d)return;e.setLineDash(h||[]),e.lineDashOffset=u,g?(e.lineWidth=2*d,e.lineJoin=c||"round"):(e.lineWidth=d,e.lineJoin=c||"bevel");let m=t.endAngle;if(n){Cd(e,t,s,i,m,a);for(let t=0;t<n;++t)e.stroke();isNaN(l)||(m=o+(l%li||li))}g&&xd(e,t,m),r.selfJoin&&m-o>=oi&&0===p&&"miter"!==c&&vd(e,t,m),n||(Cd(e,t,s,i,m,a),e.stroke())}(0,Wt.A)(bd,"defaults",va),(0,Wt.A)(bd,"instances",pd),(0,Wt.A)(bd,"overrides",ga),(0,Wt.A)(bd,"registry",Lr),(0,Wt.A)(bd,"version",od),(0,Wt.A)(bd,"getChart",gd);class Td extends rr{constructor(e){super(),(0,Wt.A)(this,"circumference",void 0),(0,Wt.A)(this,"endAngle",void 0),(0,Wt.A)(this,"fullCircles",void 0),(0,Wt.A)(this,"innerRadius",void 0),(0,Wt.A)(this,"outerRadius",void 0),(0,Wt.A)(this,"pixelMargin",void 0),(0,Wt.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,e&&Object.assign(this,e)}inRange(e,t,s){const i=this.getProps(["x","y"],s),{angle:a,distance:n}=Fi(i,{x:e,y:t}),{startAngle:o,endAngle:l,innerRadius:r,outerRadius:d,circumference:c}=this.getProps(["startAngle","endAngle","innerRadius","outerRadius","circumference"],s),h=(this.options.spacing+this.options.borderWidth)/2,u=Rs(c,l-o),p=Pi(a,o,l)&&o!==l,g=u>=li||p,m=Vi(n,r+h,d+h);return g&&m}getCenterPoint(e){const{x:t,y:s,startAngle:i,endAngle:a,innerRadius:n,outerRadius:o}=this.getProps(["x","y","startAngle","endAngle","innerRadius","outerRadius"],e),{offset:l,spacing:r}=this.options,d=(i+a)/2,c=(n+o+r+l)/2;return{x:t+Math.cos(d)*c,y:s+Math.sin(d)*c}}tooltipPosition(e){return this.getCenterPoint(e)}draw(e){const{options:t,circumference:s}=this,i=(t.offset||0)/4,a=(t.spacing||0)/2,n=t.circular;if(this.pixelMargin="inner"===t.borderAlign?.33:0,this.fullCircles=s>li?Math.floor(s/li):0,0===s||this.innerRadius<0||this.outerRadius<0)return;e.save();const o=(this.startAngle+this.endAngle)/2;e.translate(Math.cos(o)*i,Math.sin(o)*i);const l=1-Math.sin(Math.min(oi,s||0)),r=i*l;e.fillStyle=t.backgroundColor,e.strokeStyle=t.borderColor,Sd(e,this,r,a,n),Fd(e,this,r,a,n),e.restore()}}function Ad(e,t,s=t){e.lineCap=Rs(s.borderCapStyle,t.borderCapStyle),e.setLineDash(Rs(s.borderDash,t.borderDash)),e.lineDashOffset=Rs(s.borderDashOffset,t.borderDashOffset),e.lineJoin=Rs(s.borderJoinStyle,t.borderJoinStyle),e.lineWidth=Rs(s.borderWidth,t.borderWidth),e.strokeStyle=Rs(s.borderColor,t.borderColor)}function Md(e,t,s){e.lineTo(s.x,s.y)}function Pd(e){return e.stepped?Pa:e.tension||"monotone"===e.cubicInterpolationMode?$a:Md}function $d(e,t,s={}){const i=e.length,{start:a=0,end:n=i-1}=s,{start:o,end:l}=t,r=Math.max(a,o),d=Math.min(n,l),c=a<o&&n<o||a>l&&n>l;return{count:i,start:r,loop:t.loop,ilen:d<r&&!c?i+d-r:d-r}}function Dd(e,t,s,i){const{points:a,options:n}=t,{count:o,start:l,loop:r,ilen:d}=$d(a,s,i),c=Pd(n);let h,u,p,{move:g=!0,reverse:m}=i||{};for(h=0;h<=d;++h)u=a[(l+(m?d-h:h))%o],u.skip||(g?(e.moveTo(u.x,u.y),g=!1):c(e,p,u,m,n.stepped),p=u);return r&&(u=a[(l+(m?d:0))%o],c(e,p,u,m,n.stepped)),!!r}function Vd(e,t,s,i){const a=t.points,{count:n,start:o,ilen:l}=$d(a,s,i),{move:r=!0,reverse:d}=i||{};let c,h,u,p,g,m,f=0,b=0;const y=e=>(o+(d?l-e:e))%n,v=()=>{p!==g&&(e.lineTo(f,g),e.lineTo(f,p),e.lineTo(f,m))};for(r&&(h=a[y(0)],e.moveTo(h.x,h.y)),c=0;c<=l;++c){if(h=a[y(c)],h.skip)continue;const t=h.x,s=h.y,i=0|t;i===u?(s<p?p=s:s>g&&(g=s),f=(b*f+t)/++b):(v(),e.lineTo(t,s),u=i,b=0,p=g=s),m=s}v()}function Ld(e){const t=e.options,s=t.borderDash&&t.borderDash.length,i=!e._decimated&&!e._loop&&!t.tension&&"monotone"!==t.cubicInterpolationMode&&!t.stepped&&!s;return i?Vd:Dd}function Ed(e){return e.stepped?Bn:e.tension||"monotone"===e.cubicInterpolationMode?jn:zn}function Id(e,t,s,i){let a=t._path;a||(a=t._path=new Path2D,t.path(a,s,i)&&a.closePath()),Ad(e,t.options),e.stroke(a)}function Ud(e,t,s,i){const{segments:a,options:n}=t,o=Ld(t);for(const l of a)Ad(e,n,l.style),e.beginPath(),o(e,t,l,{start:s,end:s+i-1})&&e.closePath(),e.stroke()}(0,Wt.A)(Td,"id","arc"),(0,Wt.A)(Td,"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,Wt.A)(Td,"defaultRoutes",{backgroundColor:"backgroundColor"}),(0,Wt.A)(Td,"descriptors",{_scriptable:!0,_indexable:e=>"borderDash"!==e});const Od="function"===typeof Path2D;function Rd(e,t,s,i){Od&&!t.options.segment?Id(e,t,s,i):Ud(e,t,s,i)}class Wd extends rr{constructor(e){super(),this.animated=!0,this.options=void 0,this._chart=void 0,this._loop=void 0,this._fullLoop=void 0,this._path=void 0,this._points=void 0,this._segments=void 0,this._decimated=!1,this._pointsUpdated=!1,this._datasetIndex=void 0,e&&Object.assign(this,e)}updateControlPoints(e,t){const s=this.options;if((s.tension||"monotone"===s.cubicInterpolationMode)&&!s.stepped&&!this._pointsUpdated){const i=s.spanGaps?this._loop:this._fullLoop;Sn(this._points,s,e,i,t),this._pointsUpdated=!0}}set points(e){this._points=e,delete this._segments,delete this._path,this._pointsUpdated=!1}get points(){return this._points}get segments(){return this._segments||(this._segments=io(this,this.options.segment))}first(){const e=this.segments,t=this.points;return e.length&&t[e[0].start]}last(){const e=this.segments,t=this.points,s=e.length;return s&&t[e[s-1].end]}interpolate(e,t){const s=this.options,i=e[t],a=this.points,n=eo(this,{property:t,start:i,end:i});if(!n.length)return;const o=[],l=Ed(s);let r,d;for(r=0,d=n.length;r<d;++r){const{start:d,end:c}=n[r],h=a[d],u=a[c];if(h===u){o.push(h);continue}const p=Math.abs((i-h[t])/(u[t]-h[t])),g=l(h,u,p,s.stepped);g[t]=e[t],o.push(g)}return 1===o.length?o[0]:o}pathSegment(e,t,s){const i=Ld(this);return i(e,this,t,s)}path(e,t,s){const i=this.segments,a=Ld(this);let n=this._loop;t=t||0,s=s||this.points.length-t;for(const o of i)n&=a(e,this,o,{start:t,end:t+s-1});return!!n}draw(e,t,s,i){const a=this.options||{},n=this.points||[];n.length&&a.borderWidth&&(e.save(),Rd(e,this,s,i),e.restore()),this.animated&&(this._pointsUpdated=!1,this._path=void 0)}}function Nd(e,t,s,i){const a=e.options,{[s]:n}=e.getProps([s],i);return Math.abs(t-n)<a.radius+a.hitRadius}(0,Wt.A)(Wd,"id","line"),(0,Wt.A)(Wd,"defaults",{borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderWidth:3,capBezierPoints:!0,cubicInterpolationMode:"default",fill:!1,spanGaps:!1,stepped:!1,tension:0}),(0,Wt.A)(Wd,"defaultRoutes",{backgroundColor:"backgroundColor",borderColor:"borderColor"}),(0,Wt.A)(Wd,"descriptors",{_scriptable:!0,_indexable:e=>"borderDash"!==e&&"fill"!==e});class zd extends rr{constructor(e){super(),(0,Wt.A)(this,"parsed",void 0),(0,Wt.A)(this,"skip",void 0),(0,Wt.A)(this,"stop",void 0),this.options=void 0,this.parsed=void 0,this.skip=void 0,this.stop=void 0,e&&Object.assign(this,e)}inRange(e,t,s){const i=this.options,{x:a,y:n}=this.getProps(["x","y"],s);return Math.pow(e-a,2)+Math.pow(t-n,2)<Math.pow(i.hitRadius+i.radius,2)}inXRange(e,t){return Nd(this,e,"x",t)}inYRange(e,t){return Nd(this,e,"y",t)}getCenterPoint(e){const{x:t,y:s}=this.getProps(["x","y"],e);return{x:t,y:s}}size(e){e=e||this.options||{};let t=e.radius||0;t=Math.max(t,t&&e.hoverRadius||0);const s=t&&e.borderWidth||0;return 2*(t+s)}draw(e,t){const s=this.options;this.skip||s.radius<.1||!Ta(this,t,this.size(s)/2)||(e.strokeStyle=s.borderColor,e.lineWidth=s.borderWidth,e.fillStyle=s.backgroundColor,Sa(e,s,this.x,this.y))}getRange(){const e=this.options||{};return e.radius+e.hitRadius}}function Bd(e,t){const{x:s,y:i,base:a,width:n,height:o}=e.getProps(["x","y","base","width","height"],t);let l,r,d,c,h;return e.horizontal?(h=o/2,l=Math.min(s,a),r=Math.max(s,a),d=i-h,c=i+h):(h=n/2,l=s-h,r=s+h,d=Math.min(i,a),c=Math.max(i,a)),{left:l,top:d,right:r,bottom:c}}function jd(e,t,s,i){return e?0:$i(t,s,i)}function Hd(e,t,s){const i=e.options.borderWidth,a=e.borderSkipped,n=za(i);return{t:jd(a.top,n.top,0,s),r:jd(a.right,n.right,0,t),b:jd(a.bottom,n.bottom,0,s),l:jd(a.left,n.left,0,t)}}function qd(e,t,s){const{enableBorderRadius:i}=e.getProps(["enableBorderRadius"]),a=e.options.borderRadius,n=Ba(a),o=Math.min(t,s),l=e.borderSkipped,r=i||Is(a);return{topLeft:jd(!r||l.top||l.left,n.topLeft,0,o),topRight:jd(!r||l.top||l.right,n.topRight,0,o),bottomLeft:jd(!r||l.bottom||l.left,n.bottomLeft,0,o),bottomRight:jd(!r||l.bottom||l.right,n.bottomRight,0,o)}}function Xd(e){const t=Bd(e),s=t.right-t.left,i=t.bottom-t.top,a=Hd(e,s/2,i/2),n=qd(e,s/2,i/2);return{outer:{x:t.left,y:t.top,w:s,h:i,radius:n},inner:{x:t.left+a.l,y:t.top+a.t,w:s-a.l-a.r,h:i-a.t-a.b,radius:{topLeft:Math.max(0,n.topLeft-Math.max(a.t,a.l)),topRight:Math.max(0,n.topRight-Math.max(a.t,a.r)),bottomLeft:Math.max(0,n.bottomLeft-Math.max(a.b,a.l)),bottomRight:Math.max(0,n.bottomRight-Math.max(a.b,a.r))}}}}function Kd(e,t,s,i){const a=null===t,n=null===s,o=a&&n,l=e&&!o&&Bd(e,i);return l&&(a||Vi(t,l.left,l.right))&&(n||Vi(s,l.top,l.bottom))}function Qd(e){return e.topLeft||e.topRight||e.bottomLeft||e.bottomRight}function Yd(e,t){e.rect(t.x,t.y,t.w,t.h)}function Gd(e,t,s={}){const i=e.x!==s.x?-t:0,a=e.y!==s.y?-t:0,n=(e.x+e.w!==s.x+s.w?t:0)-i,o=(e.y+e.h!==s.y+s.h?t:0)-a;return{x:e.x+i,y:e.y+a,w:e.w+n,h:e.h+o,radius:e.radius}}(0,Wt.A)(zd,"id","point"),(0,Wt.A)(zd,"defaults",{borderWidth:1,hitRadius:1,hoverBorderWidth:1,hoverRadius:4,pointStyle:"circle",radius:3,rotation:0}),(0,Wt.A)(zd,"defaultRoutes",{backgroundColor:"backgroundColor",borderColor:"borderColor"});class Jd extends rr{constructor(e){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,e&&Object.assign(this,e)}draw(e){const{inflateAmount:t,options:{borderColor:s,backgroundColor:i}}=this,{inner:a,outer:n}=Xd(this),o=Qd(n.radius)?Ia:Yd;e.save(),n.w===a.w&&n.h===a.h||(e.beginPath(),o(e,Gd(n,t,a)),e.clip(),o(e,Gd(a,-t,n)),e.fillStyle=s,e.fill("evenodd")),e.beginPath(),o(e,Gd(a,t)),e.fillStyle=i,e.fill(),e.restore()}inRange(e,t,s){return Kd(this,e,t,s)}inXRange(e,t){return Kd(this,e,null,t)}inYRange(e,t){return Kd(this,null,e,t)}getCenterPoint(e){const{x:t,y:s,base:i,horizontal:a}=this.getProps(["x","y","base","horizontal"],e);return{x:a?(t+i)/2:t,y:a?s:(s+i)/2}}getRange(e){return"x"===e?this.width/2:this.height/2}}(0,Wt.A)(Jd,"id","bar"),(0,Wt.A)(Jd,"defaults",{borderSkipped:"start",borderWidth:0,borderRadius:0,inflateAmount:"auto",pointStyle:void 0}),(0,Wt.A)(Jd,"defaultRoutes",{backgroundColor:"backgroundColor",borderColor:"borderColor"});function Zd(e,t,s){const i=e.segments,a=e.points,n=t.points,o=[];for(const l of i){let{start:e,end:i}=l;i=sc(e,i,a);const r=ec(s,a[e],a[i],l.loop);if(!t.segments){o.push({source:l,target:r,start:a[e],end:a[i]});continue}const d=eo(t,r);for(const t of d){const e=ec(s,n[t.start],n[t.end],t.loop),i=Zn(l,a,e);for(const a of i)o.push({source:a,target:t,start:{[s]:ic(r,e,"start",Math.max)},end:{[s]:ic(r,e,"end",Math.min)}})}}return o}function ec(e,t,s,i){if(i)return;let a=t[e],n=s[e];return"angle"===e&&(a=Mi(a),n=Mi(n)),{property:e,start:a,end:n}}function tc(e,t){const{x:s=null,y:i=null}=e||{},a=t.points,n=[];return t.segments.forEach(({start:e,end:t})=>{t=sc(e,t,a);const o=a[e],l=a[t];null!==i?(n.push({x:o.x,y:i}),n.push({x:l.x,y:i})):null!==s&&(n.push({x:s,y:o.y}),n.push({x:s,y:l.y}))}),n}function sc(e,t,s){for(;t>e;t--){const e=s[t];if(!isNaN(e.x)&&!isNaN(e.y))break}return t}function ic(e,t,s,i){return e&&t?i(e[s],t[s]):e?e[s]:t?t[s]:0}function ac(e,t){let s=[],i=!1;return Es(e)?(i=!0,s=e):s=tc(e,t),s.length?new Wd({points:s,options:{tension:0},_loop:i,_fullLoop:i}):null}function nc(e){return e&&!1!==e.fill}function oc(e,t,s){const i=e[t];let a=i.fill;const n=[t];let o;if(!s)return a;while(!1!==a&&-1===n.indexOf(a)){if(!Us(a))return a;if(o=e[a],!o)return!1;if(o.visible)return a;n.push(a),a=o.fill}return!1}function lc(e,t,s){const i=hc(e);if(Is(i))return!isNaN(i.value)&&i;let a=parseFloat(i);return Us(a)&&Math.floor(a)===a?rc(i[0],t,a,s):["origin","start","end","stack","shape"].indexOf(i)>=0&&i}function rc(e,t,s,i){return"-"!==e&&"+"!==e||(s=t+s),!(s===t||s<0||s>=i)&&s}function dc(e,t){let s=null;return"start"===e?s=t.bottom:"end"===e?s=t.top:Is(e)?s=t.getPixelForValue(e.value):t.getBasePixel&&(s=t.getBasePixel()),s}function cc(e,t,s){let i;return i="start"===e?s:"end"===e?t.options.reverse?t.min:t.max:Is(e)?e.value:t.getBaseValue(),i}function hc(e){const t=e.options,s=t.fill;let i=Rs(s&&s.target,s);return void 0===i&&(i=!!t.backgroundColor),!1!==i&&null!==i&&(!0===i?"origin":i)}function uc(e){const{scale:t,index:s,line:i}=e,a=[],n=i.segments,o=i.points,l=pc(t,s);l.push(ac({x:null,y:t.bottom},i));for(let r=0;r<n.length;r++){const e=n[r];for(let t=e.start;t<=e.end;t++)gc(a,o[t],l)}return new Wd({points:a,options:{}})}function pc(e,t){const s=[],i=e.getMatchingVisibleMetas("line");for(let a=0;a<i.length;a++){const e=i[a];if(e.index===t)break;e.hidden||s.unshift(e.dataset)}return s}function gc(e,t,s){const i=[];for(let a=0;a<s.length;a++){const n=s[a],{first:o,last:l,point:r}=mc(n,t,"x");if(!(!r||o&&l))if(o)i.unshift(r);else if(e.push(r),!l)break}e.push(...i)}function mc(e,t,s){const i=e.interpolate(t,s);if(!i)return{};const a=i[s],n=e.segments,o=e.points;let l=!1,r=!1;for(let d=0;d<n.length;d++){const e=n[d],t=o[e.start][s],i=o[e.end][s];if(Vi(a,t,i)){l=a===t,r=a===i;break}}return{first:l,last:r,point:i}}class fc{constructor(e){this.x=e.x,this.y=e.y,this.radius=e.radius}pathSegment(e,t,s){const{x:i,y:a,radius:n}=this;return t=t||{start:0,end:li},e.arc(i,a,n,t.end,t.start,!0),!s.bounds}interpolate(e){const{x:t,y:s,radius:i}=this,a=e.angle;return{x:t+Math.cos(a)*i,y:s+Math.sin(a)*i,angle:a}}}function bc(e){const{chart:t,fill:s,line:i}=e;if(Us(s))return yc(t,s);if("stack"===s)return uc(e);if("shape"===s)return!0;const a=vc(e);return a instanceof fc?a:ac(a,i)}function yc(e,t){const s=e.getDatasetMeta(t),i=s&&e.isDatasetVisible(t);return i?s.dataset:null}function vc(e){const t=e.scale||{};return t.getPointPositionForValue?kc(e):xc(e)}function xc(e){const{scale:t={},fill:s}=e,i=dc(s,t);if(Us(i)){const e=t.isHorizontal();return{x:e?i:null,y:e?null:i}}return null}function kc(e){const{scale:t,fill:s}=e,i=t.options,a=t.getLabels().length,n=i.reverse?t.max:t.min,o=cc(s,t,n),l=[];if(i.grid.circular){const e=t.getPointPositionForValue(0,n);return new fc({x:e.x,y:e.y,radius:t.getDistanceFromCenterForValue(o)})}for(let r=0;r<a;++r)l.push(t.getPointPositionForValue(r,o));return l}function _c(e,t,s){const i=bc(t),{chart:a,index:n,line:o,scale:l,axis:r}=t,d=o.options,c=d.fill,h=d.backgroundColor,{above:u=h,below:p=h}=c||{},g=a.getDatasetMeta(n),m=ho(a,g);i&&o.points.length&&(Aa(e,s),wc(e,{line:o,target:i,above:u,below:p,area:s,scale:l,axis:r,clip:m}),Ma(e))}function wc(e,t){const{line:s,target:i,above:a,below:n,area:o,scale:l,clip:r}=t,d=s._loop?"angle":t.axis;e.save();let c=n;n!==a&&("x"===d?(Cc(e,i,o.top),Fc(e,{line:s,target:i,color:a,scale:l,property:d,clip:r}),e.restore(),e.save(),Cc(e,i,o.bottom)):"y"===d&&(Sc(e,i,o.left),Fc(e,{line:s,target:i,color:n,scale:l,property:d,clip:r}),e.restore(),e.save(),Sc(e,i,o.right),c=a)),Fc(e,{line:s,target:i,color:c,scale:l,property:d,clip:r}),e.restore()}function Cc(e,t,s){const{segments:i,points:a}=t;let n=!0,o=!1;e.beginPath();for(const l of i){const{start:i,end:r}=l,d=a[i],c=a[sc(i,r,a)];n?(e.moveTo(d.x,d.y),n=!1):(e.lineTo(d.x,s),e.lineTo(d.x,d.y)),o=!!t.pathSegment(e,l,{move:o}),o?e.closePath():e.lineTo(c.x,s)}e.lineTo(t.first().x,s),e.closePath(),e.clip()}function Sc(e,t,s){const{segments:i,points:a}=t;let n=!0,o=!1;e.beginPath();for(const l of i){const{start:i,end:r}=l,d=a[i],c=a[sc(i,r,a)];n?(e.moveTo(d.x,d.y),n=!1):(e.lineTo(s,d.y),e.lineTo(d.x,d.y)),o=!!t.pathSegment(e,l,{move:o}),o?e.closePath():e.lineTo(s,c.y)}e.lineTo(s,t.first().y),e.closePath(),e.clip()}function Fc(e,t){const{line:s,target:i,property:a,color:n,scale:o,clip:l}=t,r=Zd(s,i,a);for(const{source:d,target:c,start:h,end:u}of r){const{style:{backgroundColor:t=n}={}}=d,r=!0!==i;e.save(),e.fillStyle=t,Tc(e,o,l,r&&ec(a,h,u)),e.beginPath();const p=!!s.pathSegment(e,d);let g;if(r){p?e.closePath():Ac(e,i,u,a);const t=!!i.pathSegment(e,c,{move:p,reverse:!0});g=p&&t,g||Ac(e,i,h,a)}e.closePath(),e.fill(g?"evenodd":"nonzero"),e.restore()}}function Tc(e,t,s,i){const a=t.chart.chartArea,{property:n,start:o,end:l}=i||{};if("x"===n||"y"===n){let t,i,r,d;"x"===n?(t=o,i=a.top,r=l,d=a.bottom):(t=a.left,i=o,r=a.right,d=l),e.beginPath(),s&&(t=Math.max(t,s.left),r=Math.min(r,s.right),i=Math.max(i,s.top),d=Math.min(d,s.bottom)),e.rect(t,i,r-t,d-i),e.clip()}}function Ac(e,t,s,i){const a=t.interpolate(s,i);a&&e.lineTo(a.x,a.y)}var Mc={id:"filler",afterDatasetsUpdate(e,t,s){const i=(e.data.datasets||[]).length,a=[];let n,o,l,r;for(o=0;o<i;++o)n=e.getDatasetMeta(o),l=n.dataset,r=null,l&&l.options&&l instanceof Wd&&(r={visible:e.isDatasetVisible(o),index:o,fill:lc(l,o,i),chart:e,axis:n.controller.options.indexAxis,scale:n.vScale,line:l}),n.$filler=r,a.push(r);for(o=0;o<i;++o)r=a[o],r&&!1!==r.fill&&(r.fill=oc(a,o,s.propagate))},beforeDraw(e,t,s){const i="beforeDraw"===s.drawTime,a=e.getSortedVisibleDatasetMetas(),n=e.chartArea;for(let o=a.length-1;o>=0;--o){const t=a[o].$filler;t&&(t.line.updateControlPoints(n,t.axis),i&&t.fill&&_c(e.ctx,t,n))}},beforeDatasetsDraw(e,t,s){if("beforeDatasetsDraw"!==s.drawTime)return;const i=e.getSortedVisibleDatasetMetas();for(let a=i.length-1;a>=0;--a){const t=i[a].$filler;nc(t)&&_c(e.ctx,t,e.chartArea)}},beforeDatasetDraw(e,t,s){const i=t.meta.$filler;nc(i)&&"beforeDatasetDraw"===s.drawTime&&_c(e.ctx,i,e.chartArea)},defaults:{propagate:!0,drawTime:"beforeDatasetDraw"}};const Pc=(e,t)=>{let{boxHeight:s=t,boxWidth:i=t}=e;return e.usePointStyle&&(s=Math.min(s,t),i=e.pointStyleWidth||Math.min(i,t)),{boxWidth:i,boxHeight:s,itemHeight:Math.max(t,s)}},$c=(e,t)=>null!==e&&null!==t&&e.datasetIndex===t.datasetIndex&&e.index===t.index;class Dc extends rr{constructor(e){super(),this._added=!1,this.legendHitBoxes=[],this._hoveredItem=null,this.doughnutMode=!1,this.chart=e.chart,this.options=e.options,this.ctx=e.ctx,this.legendItems=void 0,this.columnSizes=void 0,this.lineWidths=void 0,this.maxHeight=void 0,this.maxWidth=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.height=void 0,this.width=void 0,this._margins=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(e,t,s){this.maxWidth=e,this.maxHeight=t,this._margins=s,this.setDimensions(),this.buildLabels(),this.fit()}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=this._margins.left,this.right=this.width):(this.height=this.maxHeight,this.top=this._margins.top,this.bottom=this.height)}buildLabels(){const e=this.options.labels||{};let t=zs(e.generateLabels,[this.chart],this)||[];e.filter&&(t=t.filter(t=>e.filter(t,this.chart.data))),e.sort&&(t=t.sort((t,s)=>e.sort(t,s,this.chart.data))),this.options.reverse&&t.reverse(),this.legendItems=t}fit(){const{options:e,ctx:t}=this;if(!e.display)return void(this.width=this.height=0);const s=e.labels,i=Ha(s.font),a=i.size,n=this._computeTitleHeight(),{boxWidth:o,itemHeight:l}=Pc(s,a);let r,d;t.font=i.string,this.isHorizontal()?(r=this.maxWidth,d=this._fitRows(n,a,o,l)+10):(d=this.maxHeight,r=this._fitCols(n,i,o,l)+10),this.width=Math.min(r,e.maxWidth||this.maxWidth),this.height=Math.min(d,e.maxHeight||this.maxHeight)}_fitRows(e,t,s,i){const{ctx:a,maxWidth:n,options:{labels:{padding:o}}}=this,l=this.legendHitBoxes=[],r=this.lineWidths=[0],d=i+o;let c=e;a.textAlign="left",a.textBaseline="middle";let h=-1,u=-d;return this.legendItems.forEach((e,p)=>{const g=s+t/2+a.measureText(e.text).width;(0===p||r[r.length-1]+g+2*o>n)&&(c+=d,r[r.length-(p>0?0:1)]=0,u+=d,h++),l[p]={left:0,top:u,row:h,width:g,height:i},r[r.length-1]+=g+o}),c}_fitCols(e,t,s,i){const{ctx:a,maxHeight:n,options:{labels:{padding:o}}}=this,l=this.legendHitBoxes=[],r=this.columnSizes=[],d=n-e;let c=o,h=0,u=0,p=0,g=0;return this.legendItems.forEach((e,n)=>{const{itemWidth:m,itemHeight:f}=Vc(s,t,a,e,i);n>0&&u+f+2*o>d&&(c+=h+o,r.push({width:h,height:u}),p+=h+o,g++,h=u=0),l[n]={left:p,top:u,col:g,width:m,height:f},h=Math.max(h,m),u+=f+o}),c+=h,r.push({width:h,height:u}),c}adjustHitBoxes(){if(!this.options.display)return;const e=this._computeTitleHeight(),{legendHitBoxes:t,options:{align:s,labels:{padding:i},rtl:a}}=this,n=Xn(a,this.left,this.width);if(this.isHorizontal()){let a=0,o=qi(s,this.left+i,this.right-this.lineWidths[a]);for(const l of t)a!==l.row&&(a=l.row,o=qi(s,this.left+i,this.right-this.lineWidths[a])),l.top+=this.top+e+i,l.left=n.leftForLtr(n.x(o),l.width),o+=l.width+i}else{let a=0,o=qi(s,this.top+e+i,this.bottom-this.columnSizes[a].height);for(const l of t)l.col!==a&&(a=l.col,o=qi(s,this.top+e+i,this.bottom-this.columnSizes[a].height)),l.top=o,l.left+=this.left+i,l.left=n.leftForLtr(n.x(l.left),l.width),o+=l.height+i}}isHorizontal(){return"top"===this.options.position||"bottom"===this.options.position}draw(){if(this.options.display){const e=this.ctx;Aa(e,this),this._draw(),Ma(e)}}_draw(){const{options:e,columnSizes:t,lineWidths:s,ctx:i}=this,{align:a,labels:n}=e,o=va.color,l=Xn(e.rtl,this.left,this.width),r=Ha(n.font),{padding:d}=n,c=r.size,h=c/2;let u;this.drawTitle(),i.textAlign=l.textAlign("left"),i.textBaseline="middle",i.lineWidth=.5,i.font=r.string;const{boxWidth:p,boxHeight:g,itemHeight:m}=Pc(n,c),f=function(e,t,s){if(isNaN(p)||p<=0||isNaN(g)||g<0)return;i.save();const a=Rs(s.lineWidth,1);if(i.fillStyle=Rs(s.fillStyle,o),i.lineCap=Rs(s.lineCap,"butt"),i.lineDashOffset=Rs(s.lineDashOffset,0),i.lineJoin=Rs(s.lineJoin,"miter"),i.lineWidth=a,i.strokeStyle=Rs(s.strokeStyle,o),i.setLineDash(Rs(s.lineDash,[])),n.usePointStyle){const o={radius:g*Math.SQRT2/2,pointStyle:s.pointStyle,rotation:s.rotation,borderWidth:a},r=l.xPlus(e,p/2),d=t+h;Fa(i,o,r,d,n.pointStyleWidth&&p)}else{const n=t+Math.max((c-g)/2,0),o=l.leftForLtr(e,p),r=Ba(s.borderRadius);i.beginPath(),Object.values(r).some(e=>0!==e)?Ia(i,{x:o,y:n,w:p,h:g,radius:r}):i.rect(o,n,p,g),i.fill(),0!==a&&i.stroke()}i.restore()},b=function(e,t,s){Ea(i,s.text,e,t+m/2,r,{strikethrough:s.hidden,textAlign:l.textAlign(s.textAlign)})},y=this.isHorizontal(),v=this._computeTitleHeight();u=y?{x:qi(a,this.left+d,this.right-s[0]),y:this.top+d+v,line:0}:{x:this.left+d,y:qi(a,this.top+v+d,this.bottom-t[0].height),line:0},Kn(this.ctx,e.textDirection);const x=m+d;this.legendItems.forEach((o,c)=>{i.strokeStyle=o.fontColor,i.fillStyle=o.fontColor;const g=i.measureText(o.text).width,m=l.textAlign(o.textAlign||(o.textAlign=n.textAlign)),k=p+h+g;let _=u.x,w=u.y;l.setWidth(this.width),y?c>0&&_+k+d>this.right&&(w=u.y+=x,u.line++,_=u.x=qi(a,this.left+d,this.right-s[u.line])):c>0&&w+x>this.bottom&&(_=u.x=_+t[u.line].width+d,u.line++,w=u.y=qi(a,this.top+v+d,this.bottom-t[u.line].height));const C=l.x(_);if(f(C,w,o),_=Xi(m,_+p+h,y?_+k:this.right,e.rtl),b(l.x(_),w,o),y)u.x+=k+d;else if("string"!==typeof o.text){const e=r.lineHeight;u.y+=Ic(o,e)+d}else u.y+=x}),Qn(this.ctx,e.textDirection)}drawTitle(){const e=this.options,t=e.title,s=Ha(t.font),i=ja(t.padding);if(!t.display)return;const a=Xn(e.rtl,this.left,this.width),n=this.ctx,o=t.position,l=s.size/2,r=i.top+l;let d,c=this.left,h=this.width;if(this.isHorizontal())h=Math.max(...this.lineWidths),d=this.top+r,c=qi(e.align,c,this.right-h);else{const t=this.columnSizes.reduce((e,t)=>Math.max(e,t.height),0);d=r+qi(e.align,this.top,this.bottom-t-e.labels.padding-this._computeTitleHeight())}const u=qi(o,c,c+h);n.textAlign=a.textAlign(Hi(o)),n.textBaseline="middle",n.strokeStyle=t.color,n.fillStyle=t.color,n.font=s.string,Ea(n,t.text,u,d,s)}_computeTitleHeight(){const e=this.options.title,t=Ha(e.font),s=ja(e.padding);return e.display?t.lineHeight+s.height:0}_getLegendItemAt(e,t){let s,i,a;if(Vi(e,this.left,this.right)&&Vi(t,this.top,this.bottom))for(a=this.legendHitBoxes,s=0;s<a.length;++s)if(i=a[s],Vi(e,i.left,i.left+i.width)&&Vi(t,i.top,i.top+i.height))return this.legendItems[s];return null}handleEvent(e){const t=this.options;if(!Uc(e.type,t))return;const s=this._getLegendItemAt(e.x,e.y);if("mousemove"===e.type||"mouseout"===e.type){const i=this._hoveredItem,a=$c(i,s);i&&!a&&zs(t.onLeave,[e,i,this],this),this._hoveredItem=s,s&&!a&&zs(t.onHover,[e,s,this],this)}else s&&zs(t.onClick,[e,s,this],this)}}function Vc(e,t,s,i,a){const n=Lc(i,e,t,s),o=Ec(a,i,t.lineHeight);return{itemWidth:n,itemHeight:o}}function Lc(e,t,s,i){let a=e.text;return a&&"string"!==typeof a&&(a=a.reduce((e,t)=>e.length>t.length?e:t)),t+s.size/2+i.measureText(a).width}function Ec(e,t,s){let i=e;return"string"!==typeof t.text&&(i=Ic(t,s)),i}function Ic(e,t){const s=e.text?e.text.length:0;return t*s}function Uc(e,t){return!("mousemove"!==e&&"mouseout"!==e||!t.onHover&&!t.onLeave)||!(!t.onClick||"click"!==e&&"mouseup"!==e)}var Oc={id:"legend",_element:Dc,start(e,t,s){const i=e.legend=new Dc({ctx:e.ctx,options:s,chart:e});Ol.configure(e,i,s),Ol.addBox(e,i)},stop(e){Ol.removeBox(e,e.legend),delete e.legend},beforeUpdate(e,t,s){const i=e.legend;Ol.configure(e,i,s),i.options=s},afterUpdate(e){const t=e.legend;t.buildLabels(),t.adjustHitBoxes()},afterEvent(e,t){t.replay||e.legend.handleEvent(t.event)},defaults:{display:!0,position:"top",align:"center",fullSize:!0,reverse:!1,weight:1e3,onClick(e,t,s){const i=t.datasetIndex,a=s.chart;a.isDatasetVisible(i)?(a.hide(i),t.hidden=!0):(a.show(i),t.hidden=!1)},onHover:null,onLeave:null,labels:{color:e=>e.chart.options.color,boxWidth:40,padding:10,generateLabels(e){const t=e.data.datasets,{labels:{usePointStyle:s,pointStyle:i,textAlign:a,color:n,useBorderRadius:o,borderRadius:l}}=e.legend.options;return e._getSortedDatasetMetas().map(e=>{const r=e.controller.getStyle(s?0:void 0),d=ja(r.borderWidth);return{text:t[e.index].label,fillStyle:r.backgroundColor,fontColor:n,hidden:!e.visible,lineCap:r.borderCapStyle,lineDash:r.borderDash,lineDashOffset:r.borderDashOffset,lineJoin:r.borderJoinStyle,lineWidth:(d.width+d.height)/4,strokeStyle:r.borderColor,pointStyle:i||r.pointStyle,rotation:r.rotation,textAlign:a||r.textAlign,borderRadius:o&&(l||r.borderRadius),datasetIndex:e.index}},this)}},title:{color:e=>e.chart.options.color,display:!1,position:"center",text:""}},descriptors:{_scriptable:e=>!e.startsWith("on"),labels:{_scriptable:e=>!["generateLabels","filter","sort"].includes(e)}}};new WeakMap;const Rc={average(e){if(!e.length)return!1;let t,s,i=new Set,a=0,n=0;for(t=0,s=e.length;t<s;++t){const s=e[t].element;if(s&&s.hasValue()){const e=s.tooltipPosition();i.add(e.x),a+=e.y,++n}}if(0===n||0===i.size)return!1;const o=[...i].reduce((e,t)=>e+t)/i.size;return{x:o,y:a/n}},nearest(e,t){if(!e.length)return!1;let s,i,a,n=t.x,o=t.y,l=Number.POSITIVE_INFINITY;for(s=0,i=e.length;s<i;++s){const i=e[s].element;if(i&&i.hasValue()){const e=i.getCenterPoint(),s=Ti(t,e);s<l&&(l=s,a=i)}}if(a){const e=a.tooltipPosition();n=e.x,o=e.y}return{x:n,y:o}}};function Wc(e,t){return t&&(Es(t)?Array.prototype.push.apply(e,t):e.push(t)),e}function Nc(e){return("string"===typeof e||e instanceof String)&&e.indexOf("\n")>-1?e.split("\n"):e}function zc(e,t){const{element:s,datasetIndex:i,index:a}=t,n=e.getDatasetMeta(i).controller,{label:o,value:l}=n.getLabelAndValue(a);return{chart:e,label:o,parsed:n.getParsed(a),raw:e.data.datasets[i].data[a],formattedValue:l,dataset:n.getDataset(),dataIndex:a,datasetIndex:i,element:s}}function Bc(e,t){const s=e.chart.ctx,{body:i,footer:a,title:n}=e,{boxWidth:o,boxHeight:l}=t,r=Ha(t.bodyFont),d=Ha(t.titleFont),c=Ha(t.footerFont),h=n.length,u=a.length,p=i.length,g=ja(t.padding);let m=g.height,f=0,b=i.reduce((e,t)=>e+t.before.length+t.lines.length+t.after.length,0);if(b+=e.beforeBody.length+e.afterBody.length,h&&(m+=h*d.lineHeight+(h-1)*t.titleSpacing+t.titleMarginBottom),b){const e=t.displayColors?Math.max(l,r.lineHeight):r.lineHeight;m+=p*e+(b-p)*r.lineHeight+(b-1)*t.bodySpacing}u&&(m+=t.footerMarginTop+u*c.lineHeight+(u-1)*t.footerSpacing);let y=0;const v=function(e){f=Math.max(f,s.measureText(e).width+y)};return s.save(),s.font=d.string,Bs(e.title,v),s.font=r.string,Bs(e.beforeBody.concat(e.afterBody),v),y=t.displayColors?o+2+t.boxPadding:0,Bs(i,e=>{Bs(e.before,v),Bs(e.lines,v),Bs(e.after,v)}),y=0,s.font=c.string,Bs(e.footer,v),s.restore(),f+=g.width,{width:f,height:m}}function jc(e,t){const{y:s,height:i}=t;return s<i/2?"top":s>e.height-i/2?"bottom":"center"}function Hc(e,t,s,i){const{x:a,width:n}=i,o=s.caretSize+s.caretPadding;return"left"===e&&a+n+o>t.width||("right"===e&&a-n-o<0||void 0)}function qc(e,t,s,i){const{x:a,width:n}=s,{width:o,chartArea:{left:l,right:r}}=e;let d="center";return"center"===i?d=a<=(l+r)/2?"left":"right":a<=n/2?d="left":a>=o-n/2&&(d="right"),Hc(d,e,t,s)&&(d="center"),d}function Xc(e,t,s){const i=s.yAlign||t.yAlign||jc(e,s);return{xAlign:s.xAlign||t.xAlign||qc(e,t,s,i),yAlign:i}}function Kc(e,t){let{x:s,width:i}=e;return"right"===t?s-=i:"center"===t&&(s-=i/2),s}function Qc(e,t,s){let{y:i,height:a}=e;return"top"===t?i+=s:i-="bottom"===t?a+s:a/2,i}function Yc(e,t,s,i){const{caretSize:a,caretPadding:n,cornerRadius:o}=e,{xAlign:l,yAlign:r}=s,d=a+n,{topLeft:c,topRight:h,bottomLeft:u,bottomRight:p}=Ba(o);let g=Kc(t,l);const m=Qc(t,r,d);return"center"===r?"left"===l?g+=d:"right"===l&&(g-=d):"left"===l?g-=Math.max(c,u)+a:"right"===l&&(g+=Math.max(h,p)+a),{x:$i(g,0,i.width-t.width),y:$i(m,0,i.height-t.height)}}function Gc(e,t,s){const i=ja(s.padding);return"center"===t?e.x+e.width/2:"right"===t?e.x+e.width-i.right:e.x+i.left}function Jc(e){return Wc([],Nc(e))}function Zc(e,t,s){return Ka(e,{tooltip:t,tooltipItems:s,type:"tooltip"})}function eh(e,t){const s=t&&t.dataset&&t.dataset.tooltip&&t.dataset.tooltip.callbacks;return s?e.override(s):e}const th={beforeTitle:Ds,title(e){if(e.length>0){const t=e[0],s=t.chart.data.labels,i=s?s.length:0;if(this&&this.options&&"dataset"===this.options.mode)return t.dataset.label||"";if(t.label)return t.label;if(i>0&&t.dataIndex<i)return s[t.dataIndex]}return""},afterTitle:Ds,beforeBody:Ds,beforeLabel:Ds,label(e){if(this&&this.options&&"dataset"===this.options.mode)return e.label+": "+e.formattedValue||e.formattedValue;let t=e.dataset.label||"";t&&(t+=": ");const s=e.formattedValue;return Ls(s)||(t+=s),t},labelColor(e){const t=e.chart.getDatasetMeta(e.datasetIndex),s=t.controller.getStyle(e.dataIndex);return{borderColor:s.borderColor,backgroundColor:s.backgroundColor,borderWidth:s.borderWidth,borderDash:s.borderDash,borderDashOffset:s.borderDashOffset,borderRadius:0}},labelTextColor(){return this.options.bodyColor},labelPointStyle(e){const t=e.chart.getDatasetMeta(e.datasetIndex),s=t.controller.getStyle(e.dataIndex);return{pointStyle:s.pointStyle,rotation:s.rotation}},afterLabel:Ds,afterBody:Ds,beforeFooter:Ds,footer:Ds,afterFooter:Ds};function sh(e,t,s,i){const a=e[t].call(s,i);return"undefined"===typeof a?th[t].call(s,i):a}class ih extends rr{constructor(e){super(),this.opacity=0,this._active=[],this._eventPosition=void 0,this._size=void 0,this._cachedAnimations=void 0,this._tooltipItems=[],this.$animations=void 0,this.$context=void 0,this.chart=e.chart,this.options=e.options,this.dataPoints=void 0,this.title=void 0,this.beforeBody=void 0,this.body=void 0,this.afterBody=void 0,this.footer=void 0,this.xAlign=void 0,this.yAlign=void 0,this.x=void 0,this.y=void 0,this.height=void 0,this.width=void 0,this.caretX=void 0,this.caretY=void 0,this.labelColors=void 0,this.labelPointStyles=void 0,this.labelTextColors=void 0}initialize(e){this.options=e,this._cachedAnimations=void 0,this.$context=void 0}_resolveAnimations(){const e=this._cachedAnimations;if(e)return e;const t=this.chart,s=this.options.setContext(this.getContext()),i=s.enabled&&t.options.animation&&s.animations,a=new bo(this.chart,i);return i._cacheable&&(this._cachedAnimations=Object.freeze(a)),a}getContext(){return this.$context||(this.$context=Zc(this.chart.getContext(),this,this._tooltipItems))}getTitle(e,t){const{callbacks:s}=t,i=sh(s,"beforeTitle",this,e),a=sh(s,"title",this,e),n=sh(s,"afterTitle",this,e);let o=[];return o=Wc(o,Nc(i)),o=Wc(o,Nc(a)),o=Wc(o,Nc(n)),o}getBeforeBody(e,t){return Jc(sh(t.callbacks,"beforeBody",this,e))}getBody(e,t){const{callbacks:s}=t,i=[];return Bs(e,e=>{const t={before:[],lines:[],after:[]},a=eh(s,e);Wc(t.before,Nc(sh(a,"beforeLabel",this,e))),Wc(t.lines,sh(a,"label",this,e)),Wc(t.after,Nc(sh(a,"afterLabel",this,e))),i.push(t)}),i}getAfterBody(e,t){return Jc(sh(t.callbacks,"afterBody",this,e))}getFooter(e,t){const{callbacks:s}=t,i=sh(s,"beforeFooter",this,e),a=sh(s,"footer",this,e),n=sh(s,"afterFooter",this,e);let o=[];return o=Wc(o,Nc(i)),o=Wc(o,Nc(a)),o=Wc(o,Nc(n)),o}_createItems(e){const t=this._active,s=this.chart.data,i=[],a=[],n=[];let o,l,r=[];for(o=0,l=t.length;o<l;++o)r.push(zc(this.chart,t[o]));return e.filter&&(r=r.filter((t,i,a)=>e.filter(t,i,a,s))),e.itemSort&&(r=r.sort((t,i)=>e.itemSort(t,i,s))),Bs(r,t=>{const s=eh(e.callbacks,t);i.push(sh(s,"labelColor",this,t)),a.push(sh(s,"labelPointStyle",this,t)),n.push(sh(s,"labelTextColor",this,t))}),this.labelColors=i,this.labelPointStyles=a,this.labelTextColors=n,this.dataPoints=r,r}update(e,t){const s=this.options.setContext(this.getContext()),i=this._active;let a,n=[];if(i.length){const e=Rc[s.position].call(this,i,this._eventPosition);n=this._createItems(s),this.title=this.getTitle(n,s),this.beforeBody=this.getBeforeBody(n,s),this.body=this.getBody(n,s),this.afterBody=this.getAfterBody(n,s),this.footer=this.getFooter(n,s);const t=this._size=Bc(this,s),o=Object.assign({},e,t),l=Xc(this.chart,s,o),r=Yc(s,o,l,this.chart);this.xAlign=l.xAlign,this.yAlign=l.yAlign,a={opacity:1,x:r.x,y:r.y,width:t.width,height:t.height,caretX:e.x,caretY:e.y}}else 0!==this.opacity&&(a={opacity:0});this._tooltipItems=n,this.$context=void 0,a&&this._resolveAnimations().update(this,a),e&&s.external&&s.external.call(this,{chart:this.chart,tooltip:this,replay:t})}drawCaret(e,t,s,i){const a=this.getCaretPosition(e,s,i);t.lineTo(a.x1,a.y1),t.lineTo(a.x2,a.y2),t.lineTo(a.x3,a.y3)}getCaretPosition(e,t,s){const{xAlign:i,yAlign:a}=this,{caretSize:n,cornerRadius:o}=s,{topLeft:l,topRight:r,bottomLeft:d,bottomRight:c}=Ba(o),{x:h,y:u}=e,{width:p,height:g}=t;let m,f,b,y,v,x;return"center"===a?(v=u+g/2,"left"===i?(m=h,f=m-n,y=v+n,x=v-n):(m=h+p,f=m+n,y=v-n,x=v+n),b=m):(f="left"===i?h+Math.max(l,d)+n:"right"===i?h+p-Math.max(r,c)-n:this.caretX,"top"===a?(y=u,v=y-n,m=f-n,b=f+n):(y=u+g,v=y+n,m=f+n,b=f-n),x=y),{x1:m,x2:f,x3:b,y1:y,y2:v,y3:x}}drawTitle(e,t,s){const i=this.title,a=i.length;let n,o,l;if(a){const r=Xn(s.rtl,this.x,this.width);for(e.x=Gc(this,s.titleAlign,s),t.textAlign=r.textAlign(s.titleAlign),t.textBaseline="middle",n=Ha(s.titleFont),o=s.titleSpacing,t.fillStyle=s.titleColor,t.font=n.string,l=0;l<a;++l)t.fillText(i[l],r.x(e.x),e.y+n.lineHeight/2),e.y+=n.lineHeight+o,l+1===a&&(e.y+=s.titleMarginBottom-o)}}_drawColorBox(e,t,s,i,a){const n=this.labelColors[s],o=this.labelPointStyles[s],{boxHeight:l,boxWidth:r}=a,d=Ha(a.bodyFont),c=Gc(this,"left",a),h=i.x(c),u=l<d.lineHeight?(d.lineHeight-l)/2:0,p=t.y+u;if(a.usePointStyle){const t={radius:Math.min(r,l)/2,pointStyle:o.pointStyle,rotation:o.rotation,borderWidth:1},s=i.leftForLtr(h,r)+r/2,d=p+l/2;e.strokeStyle=a.multiKeyBackground,e.fillStyle=a.multiKeyBackground,Sa(e,t,s,d),e.strokeStyle=n.borderColor,e.fillStyle=n.backgroundColor,Sa(e,t,s,d)}else{e.lineWidth=Is(n.borderWidth)?Math.max(...Object.values(n.borderWidth)):n.borderWidth||1,e.strokeStyle=n.borderColor,e.setLineDash(n.borderDash||[]),e.lineDashOffset=n.borderDashOffset||0;const t=i.leftForLtr(h,r),s=i.leftForLtr(i.xPlus(h,1),r-2),o=Ba(n.borderRadius);Object.values(o).some(e=>0!==e)?(e.beginPath(),e.fillStyle=a.multiKeyBackground,Ia(e,{x:t,y:p,w:r,h:l,radius:o}),e.fill(),e.stroke(),e.fillStyle=n.backgroundColor,e.beginPath(),Ia(e,{x:s,y:p+1,w:r-2,h:l-2,radius:o}),e.fill()):(e.fillStyle=a.multiKeyBackground,e.fillRect(t,p,r,l),e.strokeRect(t,p,r,l),e.fillStyle=n.backgroundColor,e.fillRect(s,p+1,r-2,l-2))}e.fillStyle=this.labelTextColors[s]}drawBody(e,t,s){const{body:i}=this,{bodySpacing:a,bodyAlign:n,displayColors:o,boxHeight:l,boxWidth:r,boxPadding:d}=s,c=Ha(s.bodyFont);let h=c.lineHeight,u=0;const p=Xn(s.rtl,this.x,this.width),g=function(s){t.fillText(s,p.x(e.x+u),e.y+h/2),e.y+=h+a},m=p.textAlign(n);let f,b,y,v,x,k,_;for(t.textAlign=n,t.textBaseline="middle",t.font=c.string,e.x=Gc(this,m,s),t.fillStyle=s.bodyColor,Bs(this.beforeBody,g),u=o&&"right"!==m?"center"===n?r/2+d:r+2+d:0,v=0,k=i.length;v<k;++v){for(f=i[v],b=this.labelTextColors[v],t.fillStyle=b,Bs(f.before,g),y=f.lines,o&&y.length&&(this._drawColorBox(t,e,v,p,s),h=Math.max(c.lineHeight,l)),x=0,_=y.length;x<_;++x)g(y[x]),h=c.lineHeight;Bs(f.after,g)}u=0,h=c.lineHeight,Bs(this.afterBody,g),e.y-=a}drawFooter(e,t,s){const i=this.footer,a=i.length;let n,o;if(a){const l=Xn(s.rtl,this.x,this.width);for(e.x=Gc(this,s.footerAlign,s),e.y+=s.footerMarginTop,t.textAlign=l.textAlign(s.footerAlign),t.textBaseline="middle",n=Ha(s.footerFont),t.fillStyle=s.footerColor,t.font=n.string,o=0;o<a;++o)t.fillText(i[o],l.x(e.x),e.y+n.lineHeight/2),e.y+=n.lineHeight+s.footerSpacing}}drawBackground(e,t,s,i){const{xAlign:a,yAlign:n}=this,{x:o,y:l}=e,{width:r,height:d}=s,{topLeft:c,topRight:h,bottomLeft:u,bottomRight:p}=Ba(i.cornerRadius);t.fillStyle=i.backgroundColor,t.strokeStyle=i.borderColor,t.lineWidth=i.borderWidth,t.beginPath(),t.moveTo(o+c,l),"top"===n&&this.drawCaret(e,t,s,i),t.lineTo(o+r-h,l),t.quadraticCurveTo(o+r,l,o+r,l+h),"center"===n&&"right"===a&&this.drawCaret(e,t,s,i),t.lineTo(o+r,l+d-p),t.quadraticCurveTo(o+r,l+d,o+r-p,l+d),"bottom"===n&&this.drawCaret(e,t,s,i),t.lineTo(o+u,l+d),t.quadraticCurveTo(o,l+d,o,l+d-u),"center"===n&&"left"===a&&this.drawCaret(e,t,s,i),t.lineTo(o,l+c),t.quadraticCurveTo(o,l,o+c,l),t.closePath(),t.fill(),i.borderWidth>0&&t.stroke()}_updateAnimationTarget(e){const t=this.chart,s=this.$animations,i=s&&s.x,a=s&&s.y;if(i||a){const s=Rc[e.position].call(this,this._active,this._eventPosition);if(!s)return;const n=this._size=Bc(this,e),o=Object.assign({},s,this._size),l=Xc(t,e,o),r=Yc(e,o,l,t);i._to===r.x&&a._to===r.y||(this.xAlign=l.xAlign,this.yAlign=l.yAlign,this.width=n.width,this.height=n.height,this.caretX=s.x,this.caretY=s.y,this._resolveAnimations().update(this,r))}}_willRender(){return!!this.opacity}draw(e){const t=this.options.setContext(this.getContext());let s=this.opacity;if(!s)return;this._updateAnimationTarget(t);const i={width:this.width,height:this.height},a={x:this.x,y:this.y};s=Math.abs(s)<.001?0:s;const n=ja(t.padding),o=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;t.enabled&&o&&(e.save(),e.globalAlpha=s,this.drawBackground(a,e,i,t),Kn(e,t.textDirection),a.y+=n.top,this.drawTitle(a,e,t),this.drawBody(a,e,t),this.drawFooter(a,e,t),Qn(e,t.textDirection),e.restore())}getActiveElements(){return this._active||[]}setActiveElements(e,t){const s=this._active,i=e.map(({datasetIndex:e,index:t})=>{const s=this.chart.getDatasetMeta(e);if(!s)throw new Error("Cannot find a dataset at index "+e);return{datasetIndex:e,element:s.data[t],index:t}}),a=!js(s,i),n=this._positionChanged(i,t);(a||n)&&(this._active=i,this._eventPosition=t,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(e,t,s=!0){if(t&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;const i=this.options,a=this._active||[],n=this._getActiveElements(e,a,t,s),o=this._positionChanged(n,e),l=t||!js(n,a)||o;return l&&(this._active=n,(i.enabled||i.external)&&(this._eventPosition={x:e.x,y:e.y},this.update(!0,t))),l}_getActiveElements(e,t,s,i){const a=this.options;if("mouseout"===e.type)return[];if(!i)return t.filter(e=>this.chart.data.datasets[e.datasetIndex]&&void 0!==this.chart.getDatasetMeta(e.datasetIndex).controller.getParsed(e.index));const n=this.chart.getElementsAtEventForMode(e,a.mode,a,s);return a.reverse&&n.reverse(),n}_positionChanged(e,t){const{caretX:s,caretY:i,options:a}=this,n=Rc[a.position].call(this,e,t);return!1!==n&&(s!==n.x||i!==n.y)}}(0,Wt.A)(ih,"positioners",Rc);var ah={id:"tooltip",_element:ih,positioners:Rc,afterInit(e,t,s){s&&(e.tooltip=new ih({chart:e,options:s}))},beforeUpdate(e,t,s){e.tooltip&&e.tooltip.initialize(s)},reset(e,t,s){e.tooltip&&e.tooltip.initialize(s)},afterDraw(e){const t=e.tooltip;if(t&&t._willRender()){const s={tooltip:t};if(!1===e.notifyPlugins("beforeTooltipDraw",{...s,cancelable:!0}))return;t.draw(e.ctx),e.notifyPlugins("afterTooltipDraw",s)}},afterEvent(e,t){if(e.tooltip){const s=t.replay;e.tooltip.handleEvent(t.event,s,t.inChartArea)&&(t.changed=!0)}},defaults:{enabled:!0,external:null,position:"average",backgroundColor:"rgba(0,0,0,0.8)",titleColor:"#fff",titleFont:{weight:"bold"},titleSpacing:2,titleMarginBottom:6,titleAlign:"left",bodyColor:"#fff",bodySpacing:2,bodyFont:{},bodyAlign:"left",footerColor:"#fff",footerSpacing:2,footerMarginTop:6,footerFont:{weight:"bold"},footerAlign:"left",padding:6,caretPadding:2,caretSize:5,cornerRadius:6,boxHeight:(e,t)=>t.bodyFont.size,boxWidth:(e,t)=>t.bodyFont.size,multiKeyBackground:"#fff",displayColors:!0,boxPadding:0,borderColor:"rgba(0,0,0,0)",borderWidth:0,animation:{duration:400,easing:"easeOutQuart"},animations:{numbers:{type:"number",properties:["x","y","width","height","caretX","caretY"]},opacity:{easing:"linear",duration:200}},callbacks:th},defaultRoutes:{bodyFont:"font",footerFont:"font",titleFont:"font"},descriptors:{_scriptable:e=>"filter"!==e&&"itemSort"!==e&&"external"!==e,_indexable:!1,callbacks:{_scriptable:!1,_indexable:!1},animation:{_fallback:!1},animations:{_fallback:"animation"}},additionalOptionScopes:["interaction"]};const nh=(e,t,s,i)=>("string"===typeof t?(s=e.push(t)-1,i.unshift({index:s,label:t})):isNaN(t)&&(s=null),s);function oh(e,t,s,i){const a=e.indexOf(t);if(-1===a)return nh(e,t,s,i);const n=e.lastIndexOf(t);return a!==n?s:a}const lh=(e,t)=>null===e?null:$i(Math.round(e),0,t);function rh(e){const t=this.getLabels();return e>=0&&e<t.length?t[e]:e}class dh extends Ar{constructor(e){super(e),this._startValue=void 0,this._valueRange=0,this._addedLabels=[]}init(e){const t=this._addedLabels;if(t.length){const e=this.getLabels();for(const{index:s,label:i}of t)e[s]===i&&e.splice(s,1);this._addedLabels=[]}super.init(e)}parse(e,t){if(Ls(e))return null;const s=this.getLabels();return t=isFinite(t)&&s[t]===e?t:oh(s,e,Rs(t,e),this._addedLabels),lh(t,s.length-1)}determineDataLimits(){const{minDefined:e,maxDefined:t}=this.getUserBounds();let{min:s,max:i}=this.getMinMax(!0);"ticks"===this.options.bounds&&(e||(s=0),t||(i=this.getLabels().length-1)),this.min=s,this.max=i}buildTicks(){const e=this.min,t=this.max,s=this.options.offset,i=[];let a=this.getLabels();a=0===e&&t===a.length-1?a:a.slice(e,t+1),this._valueRange=Math.max(a.length-(s?0:1),1),this._startValue=this.min-(s?.5:0);for(let n=e;n<=t;n++)i.push({value:n});return i}getLabelForValue(e){return rh.call(this,e)}configure(){super.configure(),this.isHorizontal()||(this._reversePixels=!this._reversePixels)}getPixelForValue(e){return"number"!==typeof e&&(e=this.parse(e)),null===e?NaN:this.getPixelForDecimal((e-this._startValue)/this._valueRange)}getPixelForTick(e){const t=this.ticks;return e<0||e>t.length-1?null:this.getPixelForValue(t[e].value)}getValueForPixel(e){return Math.round(this._startValue+this.getDecimalForPixel(e)*this._valueRange)}getBasePixel(){return this.bottom}}function ch(e,t){const s=[],i=1e-14,{bounds:a,step:n,min:o,max:l,precision:r,count:d,maxTicks:c,maxDigits:h,includeBounds:u}=e,p=n||1,g=c-1,{min:m,max:f}=t,b=!Ls(o),y=!Ls(l),v=!Ls(d),x=(f-m)/(h+1);let k,_,w,C,S=bi((f-m)/g/p)*p;if(S<i&&!b&&!y)return[{value:m},{value:f}];C=Math.ceil(f/S)-Math.floor(m/S),C>g&&(S=bi(C*S/g/p)*p),Ls(r)||(k=Math.pow(10,r),S=Math.ceil(S*k)/k),"ticks"===a?(_=Math.floor(m/S)*S,w=Math.ceil(f/S)*S):(_=m,w=f),b&&y&&n&&ki((l-o)/n,S/1e3)?(C=Math.round(Math.min((l-o)/S,c)),S=(l-o)/C,_=o,w=l):v?(_=b?o:_,w=y?l:w,C=d-1,S=(w-_)/C):(C=(w-_)/S,C=fi(C,Math.round(C),S/1e3)?Math.round(C):Math.ceil(C));const F=Math.max(Si(S),Si(_));k=Math.pow(10,Ls(r)?F:r),_=Math.round(_*k)/k,w=Math.round(w*k)/k;let T=0;for(b&&(u&&_!==o?(s.push({value:o}),_<o&&T++,fi(Math.round((_+T*S)*k)/k,o,hh(o,x,e))&&T++):_<o&&T++);T<C;++T){const e=Math.round((_+T*S)*k)/k;if(y&&e>l)break;s.push({value:e})}return y&&u&&w!==l?s.length&&fi(s[s.length-1].value,l,hh(l,x,e))?s[s.length-1].value=l:s.push({value:l}):y&&w!==l||s.push({value:w}),s}function hh(e,t,{horizontal:s,minRotation:i}){const a=wi(i),n=(s?Math.sin(a):Math.cos(a))||.001,o=.75*t*(""+e).length;return Math.min(t/n,o)}(0,Wt.A)(dh,"id","category"),(0,Wt.A)(dh,"defaults",{ticks:{callback:rh}});class uh extends Ar{constructor(e){super(e),this.start=void 0,this.end=void 0,this._startValue=void 0,this._endValue=void 0,this._valueRange=0}parse(e,t){return Ls(e)||("number"===typeof e||e instanceof Number)&&!isFinite(+e)?null:+e}handleTickRangeOptions(){const{beginAtZero:e}=this.options,{minDefined:t,maxDefined:s}=this.getUserBounds();let{min:i,max:a}=this;const n=e=>i=t?i:e,o=e=>a=s?a:e;if(e){const e=mi(i),t=mi(a);e<0&&t<0?o(0):e>0&&t>0&&n(0)}if(i===a){let t=0===a?1:Math.abs(.05*a);o(a+t),e||n(i-t)}this.min=i,this.max=a}getTickLimit(){const e=this.options.ticks;let t,{maxTicksLimit:s,stepSize:i}=e;return i?(t=Math.ceil(this.max/i)-Math.floor(this.min/i)+1,t>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${i} would result generating up to ${t} ticks. Limiting to 1000.`),t=1e3)):(t=this.computeTickLimit(),s=s||11),s&&(t=Math.min(s,t)),t}computeTickLimit(){return Number.POSITIVE_INFINITY}buildTicks(){const e=this.options,t=e.ticks;let s=this.getTickLimit();s=Math.max(2,s);const i={maxTicks:s,bounds:e.bounds,min:e.min,max:e.max,precision:t.precision,step:t.stepSize,count:t.count,maxDigits:this._maxDigits(),horizontal:this.isHorizontal(),minRotation:t.minRotation||0,includeBounds:!1!==t.includeBounds},a=this._range||this,n=ch(i,a);return"ticks"===e.bounds&&_i(n,this,"value"),e.reverse?(n.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),n}configure(){const e=this.ticks;let t=this.min,s=this.max;if(super.configure(),this.options.offset&&e.length){const i=(s-t)/Math.max(e.length-1,1)/2;t-=i,s+=i}this._startValue=t,this._endValue=s,this._valueRange=s-t}getLabelForValue(e){return da(e,this.chart.options.locale,this.options.ticks.format)}}class ph extends uh{determineDataLimits(){const{min:e,max:t}=this.getMinMax(!0);this.min=Us(e)?e:0,this.max=Us(t)?t:1,this.handleTickRangeOptions()}computeTickLimit(){const e=this.isHorizontal(),t=e?this.width:this.height,s=wi(this.options.ticks.minRotation),i=(e?Math.sin(s):Math.cos(s))||.001,a=this._resolveTickFontOptions(0);return Math.ceil(t/Math.min(40,a.lineHeight/i))}getPixelForValue(e){return null===e?NaN:this.getPixelForDecimal((e-this._startValue)/this._valueRange)}getValueForPixel(e){return this._startValue+this.getDecimalForPixel(e)*this._valueRange}}(0,Wt.A)(ph,"id","linear"),(0,Wt.A)(ph,"defaults",{ticks:{callback:ua.formatters.numeric}});const gh=e=>Math.floor(gi(e)),mh=(e,t)=>Math.pow(10,gh(e)+t);function fh(e){const t=e/Math.pow(10,gh(e));return 1===t}function bh(e,t,s){const i=Math.pow(10,s),a=Math.floor(e/i),n=Math.ceil(t/i);return n-a}function yh(e,t){const s=t-e;let i=gh(s);while(bh(e,t,i)>10)i++;while(bh(e,t,i)<10)i--;return Math.min(i,gh(e))}function vh(e,{min:t,max:s}){t=Os(e.min,t);const i=[],a=gh(t);let n=yh(t,s),o=n<0?Math.pow(10,Math.abs(n)):1;const l=Math.pow(10,n),r=a>n?Math.pow(10,a):0,d=Math.round((t-r)*o)/o,c=Math.floor((t-r)/l/10)*l*10;let h=Math.floor((d-c)/Math.pow(10,n)),u=Os(e.min,Math.round((r+c+h*Math.pow(10,n))*o)/o);while(u<s)i.push({value:u,major:fh(u),significand:h}),h>=10?h=h<15?15:20:h++,h>=20&&(n++,h=2,o=n>=0?1:o),u=Math.round((r+c+h*Math.pow(10,n))*o)/o;const p=Os(e.max,u);return i.push({value:p,major:fh(p),significand:h}),i}class xh extends Ar{constructor(e){super(e),this.start=void 0,this.end=void 0,this._startValue=void 0,this._valueRange=0}parse(e,t){const s=uh.prototype.parse.apply(this,[e,t]);if(0!==s)return Us(s)&&s>0?s:null;this._zero=!0}determineDataLimits(){const{min:e,max:t}=this.getMinMax(!0);this.min=Us(e)?Math.max(0,e):null,this.max=Us(t)?Math.max(0,t):null,this.options.beginAtZero&&(this._zero=!0),this._zero&&this.min!==this._suggestedMin&&!Us(this._userMin)&&(this.min=e===mh(this.min,0)?mh(this.min,-1):mh(this.min,0)),this.handleTickRangeOptions()}handleTickRangeOptions(){const{minDefined:e,maxDefined:t}=this.getUserBounds();let s=this.min,i=this.max;const a=t=>s=e?s:t,n=e=>i=t?i:e;s===i&&(s<=0?(a(1),n(10)):(a(mh(s,-1)),n(mh(i,1)))),s<=0&&a(mh(i,-1)),i<=0&&n(mh(s,1)),this.min=s,this.max=i}buildTicks(){const e=this.options,t={min:this._userMin,max:this._userMax},s=vh(t,this);return"ticks"===e.bounds&&_i(s,this,"value"),e.reverse?(s.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),s}getLabelForValue(e){return void 0===e?"0":da(e,this.chart.options.locale,this.options.ticks.format)}configure(){const e=this.min;super.configure(),this._startValue=gi(e),this._valueRange=gi(this.max)-gi(e)}getPixelForValue(e){return void 0!==e&&0!==e||(e=this.min),null===e||isNaN(e)?NaN:this.getPixelForDecimal(e===this.min?0:(gi(e)-this._startValue)/this._valueRange)}getValueForPixel(e){const t=this.getDecimalForPixel(e);return Math.pow(10,this._startValue+t*this._valueRange)}}function kh(e){const t=e.ticks;if(t.display&&e.display){const e=ja(t.backdropPadding);return Rs(t.font&&t.font.size,va.font.size)+e.height}return 0}function _h(e,t,s){return s=Es(s)?s:[s],{w:_a(e,t.string,s),h:s.length*t.lineHeight}}function wh(e,t,s,i,a){return e===i||e===a?{start:t-s/2,end:t+s/2}:e<i||e>a?{start:t-s,end:t}:{start:t,end:t+s}}function Ch(e){const t={l:e.left+e._padding.left,r:e.right-e._padding.right,t:e.top+e._padding.top,b:e.bottom-e._padding.bottom},s=Object.assign({},t),i=[],a=[],n=e._pointLabels.length,o=e.options.pointLabels,l=o.centerPointLabels?oi/n:0;for(let r=0;r<n;r++){const n=o.setContext(e.getPointLabelContext(r));a[r]=n.padding;const d=e.getPointPosition(r,e.drawingArea+a[r],l),c=Ha(n.font),h=_h(e.ctx,c,e._pointLabels[r]);i[r]=h;const u=Mi(e.getIndexAngle(r)+l),p=Math.round(Ci(u)),g=wh(p,d.x,h.w,0,180),m=wh(p,d.y,h.h,90,270);Sh(s,t,u,g,m)}e.setCenterPoint(t.l-s.l,s.r-t.r,t.t-s.t,s.b-t.b),e._pointLabelItems=Ah(e,i,a)}function Sh(e,t,s,i,a){const n=Math.abs(Math.sin(s)),o=Math.abs(Math.cos(s));let l=0,r=0;i.start<t.l?(l=(t.l-i.start)/n,e.l=Math.min(e.l,t.l-l)):i.end>t.r&&(l=(i.end-t.r)/n,e.r=Math.max(e.r,t.r+l)),a.start<t.t?(r=(t.t-a.start)/o,e.t=Math.min(e.t,t.t-r)):a.end>t.b&&(r=(a.end-t.b)/o,e.b=Math.max(e.b,t.b+r))}function Fh(e,t,s){const i=e.drawingArea,{extra:a,additionalAngle:n,padding:o,size:l}=s,r=e.getPointPosition(t,i+a+o,n),d=Math.round(Ci(Mi(r.angle+hi))),c=$h(r.y,l.h,d),h=Mh(d),u=Ph(r.x,l.w,h);return{visible:!0,x:r.x,y:c,textAlign:h,left:u,top:c,right:u+l.w,bottom:c+l.h}}function Th(e,t){if(!t)return!0;const{left:s,top:i,right:a,bottom:n}=e,o=Ta({x:s,y:i},t)||Ta({x:s,y:n},t)||Ta({x:a,y:i},t)||Ta({x:a,y:n},t);return!o}function Ah(e,t,s){const i=[],a=e._pointLabels.length,n=e.options,{centerPointLabels:o,display:l}=n.pointLabels,r={extra:kh(n)/2,additionalAngle:o?oi/a:0};let d;for(let c=0;c<a;c++){r.padding=s[c],r.size=t[c];const a=Fh(e,c,r);i.push(a),"auto"===l&&(a.visible=Th(a,d),a.visible&&(d=a))}return i}function Mh(e){return 0===e||180===e?"center":e<180?"left":"right"}function Ph(e,t,s){return"right"===s?e-=t:"center"===s&&(e-=t/2),e}function $h(e,t,s){return 90===s||270===s?e-=t/2:(s>270||s<90)&&(e-=t),e}function Dh(e,t,s){const{left:i,top:a,right:n,bottom:o}=s,{backdropColor:l}=t;if(!Ls(l)){const s=Ba(t.borderRadius),r=ja(t.backdropPadding);e.fillStyle=l;const d=i-r.left,c=a-r.top,h=n-i+r.width,u=o-a+r.height;Object.values(s).some(e=>0!==e)?(e.beginPath(),Ia(e,{x:d,y:c,w:h,h:u,radius:s}),e.fill()):e.fillRect(d,c,h,u)}}function Vh(e,t){const{ctx:s,options:{pointLabels:i}}=e;for(let a=t-1;a>=0;a--){const t=e._pointLabelItems[a];if(!t.visible)continue;const n=i.setContext(e.getPointLabelContext(a));Dh(s,n,t);const o=Ha(n.font),{x:l,y:r,textAlign:d}=t;Ea(s,e._pointLabels[a],l,r+o.lineHeight/2,o,{color:n.color,textAlign:d,textBaseline:"middle"})}}function Lh(e,t,s,i){const{ctx:a}=e;if(s)a.arc(e.xCenter,e.yCenter,t,0,li);else{let s=e.getPointPosition(0,t);a.moveTo(s.x,s.y);for(let n=1;n<i;n++)s=e.getPointPosition(n,t),a.lineTo(s.x,s.y)}}function Eh(e,t,s,i,a){const n=e.ctx,o=t.circular,{color:l,lineWidth:r}=t;!o&&!i||!l||!r||s<0||(n.save(),n.strokeStyle=l,n.lineWidth=r,n.setLineDash(a.dash||[]),n.lineDashOffset=a.dashOffset,n.beginPath(),Lh(e,s,o,i),n.closePath(),n.stroke(),n.restore())}function Ih(e,t,s){return Ka(e,{label:s,index:t,type:"pointLabel"})}(0,Wt.A)(xh,"id","logarithmic"),(0,Wt.A)(xh,"defaults",{ticks:{callback:ua.formatters.logarithmic,major:{enabled:!0}}});class Uh extends uh{constructor(e){super(e),this.xCenter=void 0,this.yCenter=void 0,this.drawingArea=void 0,this._pointLabels=[],this._pointLabelItems=[]}setDimensions(){const e=this._padding=ja(kh(this.options)/2),t=this.width=this.maxWidth-e.width,s=this.height=this.maxHeight-e.height;this.xCenter=Math.floor(this.left+t/2+e.left),this.yCenter=Math.floor(this.top+s/2+e.top),this.drawingArea=Math.floor(Math.min(t,s)/2)}determineDataLimits(){const{min:e,max:t}=this.getMinMax(!1);this.min=Us(e)&&!isNaN(e)?e:0,this.max=Us(t)&&!isNaN(t)?t:0,this.handleTickRangeOptions()}computeTickLimit(){return Math.ceil(this.drawingArea/kh(this.options))}generateTickLabels(e){uh.prototype.generateTickLabels.call(this,e),this._pointLabels=this.getLabels().map((e,t)=>{const s=zs(this.options.pointLabels.callback,[e,t],this);return s||0===s?s:""}).filter((e,t)=>this.chart.getDataVisibility(t))}fit(){const e=this.options;e.display&&e.pointLabels.display?Ch(this):this.setCenterPoint(0,0,0,0)}setCenterPoint(e,t,s,i){this.xCenter+=Math.floor((e-t)/2),this.yCenter+=Math.floor((s-i)/2),this.drawingArea-=Math.min(this.drawingArea/2,Math.max(e,t,s,i))}getIndexAngle(e){const t=li/(this._pointLabels.length||1),s=this.options.startAngle||0;return Mi(e*t+wi(s))}getDistanceFromCenterForValue(e){if(Ls(e))return NaN;const t=this.drawingArea/(this.max-this.min);return this.options.reverse?(this.max-e)*t:(e-this.min)*t}getValueForDistanceFromCenter(e){if(Ls(e))return NaN;const t=e/(this.drawingArea/(this.max-this.min));return this.options.reverse?this.max-t:this.min+t}getPointLabelContext(e){const t=this._pointLabels||[];if(e>=0&&e<t.length){const s=t[e];return Ih(this.getContext(),e,s)}}getPointPosition(e,t,s=0){const i=this.getIndexAngle(e)-hi+s;return{x:Math.cos(i)*t+this.xCenter,y:Math.sin(i)*t+this.yCenter,angle:i}}getPointPositionForValue(e,t){return this.getPointPosition(e,this.getDistanceFromCenterForValue(t))}getBasePosition(e){return this.getPointPositionForValue(e||0,this.getBaseValue())}getPointLabelPosition(e){const{left:t,top:s,right:i,bottom:a}=this._pointLabelItems[e];return{left:t,top:s,right:i,bottom:a}}drawBackground(){const{backgroundColor:e,grid:{circular:t}}=this.options;if(e){const s=this.ctx;s.save(),s.beginPath(),Lh(this,this.getDistanceFromCenterForValue(this._endValue),t,this._pointLabels.length),s.closePath(),s.fillStyle=e,s.fill(),s.restore()}}drawGrid(){const e=this.ctx,t=this.options,{angleLines:s,grid:i,border:a}=t,n=this._pointLabels.length;let o,l,r;if(t.pointLabels.display&&Vh(this,n),i.display&&this.ticks.forEach((e,t)=>{if(0!==t||0===t&&this.min<0){l=this.getDistanceFromCenterForValue(e.value);const s=this.getContext(t),o=i.setContext(s),r=a.setContext(s);Eh(this,o,l,n,r)}}),s.display){for(e.save(),o=n-1;o>=0;o--){const i=s.setContext(this.getPointLabelContext(o)),{color:a,lineWidth:n}=i;n&&a&&(e.lineWidth=n,e.strokeStyle=a,e.setLineDash(i.borderDash),e.lineDashOffset=i.borderDashOffset,l=this.getDistanceFromCenterForValue(t.reverse?this.min:this.max),r=this.getPointPosition(o,l),e.beginPath(),e.moveTo(this.xCenter,this.yCenter),e.lineTo(r.x,r.y),e.stroke())}e.restore()}}drawBorder(){}drawLabels(){const e=this.ctx,t=this.options,s=t.ticks;if(!s.display)return;const i=this.getIndexAngle(0);let a,n;e.save(),e.translate(this.xCenter,this.yCenter),e.rotate(i),e.textAlign="center",e.textBaseline="middle",this.ticks.forEach((i,o)=>{if(0===o&&this.min>=0&&!t.reverse)return;const l=s.setContext(this.getContext(o)),r=Ha(l.font);if(a=this.getDistanceFromCenterForValue(this.ticks[o].value),l.showLabelBackdrop){e.font=r.string,n=e.measureText(i.label).width,e.fillStyle=l.backdropColor;const t=ja(l.backdropPadding);e.fillRect(-n/2-t.left,-a-r.size/2-t.top,n+t.width,r.size+t.height)}Ea(e,i.label,0,-a,r,{color:l.color,strokeColor:l.textStrokeColor,strokeWidth:l.textStrokeWidth})}),e.restore()}drawTitle(){}}(0,Wt.A)(Uh,"id","radialLinear"),(0,Wt.A)(Uh,"defaults",{display:!0,animate:!0,position:"chartArea",angleLines:{display:!0,lineWidth:1,borderDash:[],borderDashOffset:0},grid:{circular:!1},startAngle:0,ticks:{showLabelBackdrop:!0,callback:ua.formatters.numeric},pointLabels:{backdropColor:void 0,backdropPadding:2,display:!0,font:{size:10},callback(e){return e},padding:5,centerPointLabels:!1}}),(0,Wt.A)(Uh,"defaultRoutes",{"angleLines.color":"borderColor","pointLabels.color":"color","ticks.color":"color"}),(0,Wt.A)(Uh,"descriptors",{angleLines:{_fallback:"grid"}});const Oh={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}},Rh=Object.keys(Oh);function Wh(e,t){return e-t}function Nh(e,t){if(Ls(t))return null;const s=e._adapter,{parser:i,round:a,isoWeekday:n}=e._parseOpts;let o=t;return"function"===typeof i&&(o=i(o)),Us(o)||(o="string"===typeof i?s.parse(o,i):s.parse(o)),null===o?null:(a&&(o="week"!==a||!xi(n)&&!0!==n?s.startOf(o,a):s.startOf(o,"isoWeek",n)),+o)}function zh(e,t,s,i){const a=Rh.length;for(let n=Rh.indexOf(e);n<a-1;++n){const e=Oh[Rh[n]],a=e.steps?e.steps:Number.MAX_SAFE_INTEGER;if(e.common&&Math.ceil((s-t)/(a*e.size))<=i)return Rh[n]}return Rh[a-1]}function Bh(e,t,s,i,a){for(let n=Rh.length-1;n>=Rh.indexOf(s);n--){const s=Rh[n];if(Oh[s].common&&e._adapter.diff(a,i,s)>=t-1)return s}return Rh[s?Rh.indexOf(s):0]}function jh(e){for(let t=Rh.indexOf(e)+1,s=Rh.length;t<s;++t)if(Oh[Rh[t]].common)return Rh[t]}function Hh(e,t,s){if(s){if(s.length){const{lo:i,hi:a}=Li(s,t),n=s[i]>=t?s[i]:s[a];e[n]=!0}}else e[t]=!0}function qh(e,t,s,i){const a=e._adapter,n=+a.startOf(t[0].value,i),o=t[t.length-1].value;let l,r;for(l=n;l<=o;l=+a.add(l,1,i))r=s[l],r>=0&&(t[r].major=!0);return t}function Xh(e,t,s){const i=[],a={},n=t.length;let o,l;for(o=0;o<n;++o)l=t[o],a[l]=o,i.push({value:l,major:!1});return 0!==n&&s?qh(e,i,a,s):i}class Kh extends Ar{constructor(e){super(e),this._cache={data:[],labels:[],all:[]},this._unit="day",this._majorUnit=void 0,this._offsets={},this._normalized=!1,this._parseOpts=void 0}init(e,t={}){const s=e.time||(e.time={}),i=this._adapter=new ul._date(e.adapters.date);i.init(t),Qs(s.displayFormats,i.formats()),this._parseOpts={parser:s.parser,round:s.round,isoWeekday:s.isoWeekday},super.init(e),this._normalized=t.normalized}parse(e,t){return void 0===e?null:Nh(this,e)}beforeLayout(){super.beforeLayout(),this._cache={data:[],labels:[],all:[]}}determineDataLimits(){const e=this.options,t=this._adapter,s=e.time.unit||"day";let{min:i,max:a,minDefined:n,maxDefined:o}=this.getUserBounds();function l(e){n||isNaN(e.min)||(i=Math.min(i,e.min)),o||isNaN(e.max)||(a=Math.max(a,e.max))}n&&o||(l(this._getLabelBounds()),"ticks"===e.bounds&&"labels"===e.ticks.source||l(this.getMinMax(!1))),i=Us(i)&&!isNaN(i)?i:+t.startOf(Date.now(),s),a=Us(a)&&!isNaN(a)?a:+t.endOf(Date.now(),s)+1,this.min=Math.min(i,a-1),this.max=Math.max(i+1,a)}_getLabelBounds(){const e=this.getLabelTimestamps();let t=Number.POSITIVE_INFINITY,s=Number.NEGATIVE_INFINITY;return e.length&&(t=e[0],s=e[e.length-1]),{min:t,max:s}}buildTicks(){const e=this.options,t=e.time,s=e.ticks,i="labels"===s.source?this.getLabelTimestamps():this._generate();"ticks"===e.bounds&&i.length&&(this.min=this._userMin||i[0],this.max=this._userMax||i[i.length-1]);const a=this.min,n=this.max,o=Ui(i,a,n);return this._unit=t.unit||(s.autoSkip?zh(t.minUnit,this.min,this.max,this._getLabelCapacity(a)):Bh(this,o.length,t.minUnit,this.min,this.max)),this._majorUnit=s.major.enabled&&"year"!==this._unit?jh(this._unit):void 0,this.initOffsets(i),e.reverse&&o.reverse(),Xh(this,o,this._majorUnit)}afterAutoSkip(){this.options.offsetAfterAutoskip&&this.initOffsets(this.ticks.map(e=>+e.value))}initOffsets(e=[]){let t,s,i=0,a=0;this.options.offset&&e.length&&(t=this.getDecimalForValue(e[0]),i=1===e.length?1-t:(this.getDecimalForValue(e[1])-t)/2,s=this.getDecimalForValue(e[e.length-1]),a=1===e.length?s:(s-this.getDecimalForValue(e[e.length-2]))/2);const n=e.length<3?.5:.25;i=$i(i,0,n),a=$i(a,0,n),this._offsets={start:i,end:a,factor:1/(i+1+a)}}_generate(){const e=this._adapter,t=this.min,s=this.max,i=this.options,a=i.time,n=a.unit||zh(a.minUnit,t,s,this._getLabelCapacity(t)),o=Rs(i.ticks.stepSize,1),l="week"===n&&a.isoWeekday,r=xi(l)||!0===l,d={};let c,h,u=t;if(r&&(u=+e.startOf(u,"isoWeek",l)),u=+e.startOf(u,r?"day":n),e.diff(s,t,n)>1e5*o)throw new Error(t+" and "+s+" are too far apart with stepSize of "+o+" "+n);const p="data"===i.ticks.source&&this.getDataTimestamps();for(c=u,h=0;c<s;c=+e.add(c,o,n),h++)Hh(d,c,p);return c!==s&&"ticks"!==i.bounds&&1!==h||Hh(d,c,p),Object.keys(d).sort(Wh).map(e=>+e)}getLabelForValue(e){const t=this._adapter,s=this.options.time;return s.tooltipFormat?t.format(e,s.tooltipFormat):t.format(e,s.displayFormats.datetime)}format(e,t){const s=this.options,i=s.time.displayFormats,a=this._unit,n=t||i[a];return this._adapter.format(e,n)}_tickFormatFunction(e,t,s,i){const a=this.options,n=a.ticks.callback;if(n)return zs(n,[e,t,s],this);const o=a.time.displayFormats,l=this._unit,r=this._majorUnit,d=l&&o[l],c=r&&o[r],h=s[t],u=r&&c&&h&&h.major;return this._adapter.format(e,i||(u?c:d))}generateTickLabels(e){let t,s,i;for(t=0,s=e.length;t<s;++t)i=e[t],i.label=this._tickFormatFunction(i.value,t,e)}getDecimalForValue(e){return null===e?NaN:(e-this.min)/(this.max-this.min)}getPixelForValue(e){const t=this._offsets,s=this.getDecimalForValue(e);return this.getPixelForDecimal((t.start+s)*t.factor)}getValueForPixel(e){const t=this._offsets,s=this.getDecimalForPixel(e)/t.factor-t.end;return this.min+s*(this.max-this.min)}_getLabelSize(e){const t=this.options.ticks,s=this.ctx.measureText(e).width,i=wi(this.isHorizontal()?t.maxRotation:t.minRotation),a=Math.cos(i),n=Math.sin(i),o=this._resolveTickFontOptions(0).size;return{w:s*a+o*n,h:s*n+o*a}}_getLabelCapacity(e){const t=this.options.time,s=t.displayFormats,i=s[t.unit]||s.millisecond,a=this._tickFormatFunction(e,0,Xh(this,[e],this._majorUnit),i),n=this._getLabelSize(a),o=Math.floor(this.isHorizontal()?this.width/n.w:this.height/n.h)-1;return o>0?o:1}getDataTimestamps(){let e,t,s=this._cache.data||[];if(s.length)return s;const i=this.getMatchingVisibleMetas();if(this._normalized&&i.length)return this._cache.data=i[0].controller.getAllParsedValues(this);for(e=0,t=i.length;e<t;++e)s=s.concat(i[e].controller.getAllParsedValues(this));return this._cache.data=this.normalize(s)}getLabelTimestamps(){const e=this._cache.labels||[];let t,s;if(e.length)return e;const i=this.getLabels();for(t=0,s=i.length;t<s;++t)e.push(Nh(this,i[t]));return this._cache.labels=this._normalized?e:this.normalize(e)}normalize(e){return Ni(e.sort(Wh))}}function Qh(e,t,s){let i,a,n,o,l=0,r=e.length-1;s?(t>=e[l].pos&&t<=e[r].pos&&({lo:l,hi:r}=Ei(e,"pos",t)),({pos:i,time:n}=e[l]),({pos:a,time:o}=e[r])):(t>=e[l].time&&t<=e[r].time&&({lo:l,hi:r}=Ei(e,"time",t)),({time:i,pos:n}=e[l]),({time:a,pos:o}=e[r]));const d=a-i;return d?n+(o-n)*(t-i)/d:n}(0,Wt.A)(Kh,"id","time"),(0,Wt.A)(Kh,"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 Yh extends Kh{constructor(e){super(e),this._table=[],this._minPos=void 0,this._tableRange=void 0}initOffsets(){const e=this._getTimestampsForTable(),t=this._table=this.buildLookupTable(e);this._minPos=Qh(t,this.min),this._tableRange=Qh(t,this.max)-this._minPos,super.initOffsets(e)}buildLookupTable(e){const{min:t,max:s}=this,i=[],a=[];let n,o,l,r,d;for(n=0,o=e.length;n<o;++n)r=e[n],r>=t&&r<=s&&i.push(r);if(i.length<2)return[{time:t,pos:0},{time:s,pos:1}];for(n=0,o=i.length;n<o;++n)d=i[n+1],l=i[n-1],r=i[n],Math.round((d+l)/2)!==r&&a.push({time:r,pos:n/(o-1)});return a}_generate(){const e=this.min,t=this.max;let s=super.getDataTimestamps();return s.includes(e)&&s.length||s.splice(0,0,e),s.includes(t)&&1!==s.length||s.push(t),s.sort((e,t)=>e-t)}_getTimestampsForTable(){let e=this._cache.all||[];if(e.length)return e;const t=this.getDataTimestamps(),s=this.getLabelTimestamps();return e=t.length&&s.length?this.normalize(t.concat(s)):t.length?t:s,e=this._cache.all=e,e}getDecimalForValue(e){return(Qh(this._table,e)-this._minPos)/this._tableRange}getValueForPixel(e){const t=this._offsets,s=this.getDecimalForPixel(e)/t.factor-t.end;return Qh(this._table,s*this._tableRange+this._minPos,!0)}}(0,Wt.A)(Yh,"id","timeseries"),(0,Wt.A)(Yh,"defaults",Kh.defaults);var Gh=s(90144);const Jh={data:{type:Object,required:!0},options:{type:Object,default:()=>({})},plugins:{type:Array,default:()=>[]},datasetIdKey:{type:String,default:"label"},updateMode:{type:String,default:void 0}},Zh={ariaLabel:{type:String},ariaDescribedby:{type:String}},eu={type:{type:String,required:!0},destroyDelay:{type:Number,default:0},...Jh,...Zh},tu="2"===a.rE[0]?(e,t)=>Object.assign(e,{attrs:t}):(e,t)=>Object.assign(e,t);function su(e){return(0,Gh.ju)(e)?(0,Gh.ux)(e):e}function iu(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e;return(0,Gh.ju)(t)?new Proxy(e,{}):e}function au(e,t){const s=e.options;s&&t&&Object.assign(s,t)}function nu(e,t){e.labels=t}function ou(e,t,s){const i=[];e.datasets=t.map(t=>{const a=e.datasets.find(e=>e[s]===t[s]);return a&&t.data&&!i.includes(a)?(i.push(a),Object.assign(a,t),a):{...t}})}function lu(e,t){const s={labels:[],datasets:[]};return nu(s,e.labels),ou(s,e.datasets,t),s}const ru=(0,a.pM)({props:eu,setup(e,t){let{expose:s,slots:i}=t;const n=(0,Gh.KR)(null),o=(0,Gh.IJ)(null);s({chart:o});const l=()=>{if(!n.value)return;const{type:t,data:s,options:i,plugins:a,datasetIdKey:l}=e,r=lu(s,l),d=iu(r,s);o.value=new bd(n.value,{type:t,data:d,options:{...i},plugins:a})},r=()=>{const t=(0,Gh.ux)(o.value);t&&(e.destroyDelay>0?setTimeout(()=>{t.destroy(),o.value=null},e.destroyDelay):(t.destroy(),o.value=null))},d=t=>{t.update(e.updateMode)};return(0,a.sV)(l),(0,a.hi)(r),(0,a.wB)([()=>e.options,()=>e.data],(t,s)=>{let[i,n]=t,[l,r]=s;const c=(0,Gh.ux)(o.value);if(!c)return;let h=!1;if(i){const e=su(i),t=su(l);e&&e!==t&&(au(c,e),h=!0)}if(n){const t=su(n.labels),s=su(r.labels),i=su(n.datasets),a=su(r.datasets);t!==s&&(nu(c.config.data,t),h=!0),i&&i!==a&&(ou(c.config.data,i,e.datasetIdKey),h=!0)}h&&(0,a.dY)(()=>{d(c)})},{deep:!0}),()=>(0,a.h)("canvas",{role:"img","aria-label":e.ariaLabel,"aria-describedby":e.ariaDescribedby,ref:n},[(0,a.h)("p",{},[i.default?i.default():""])])}});function du(e,t){return bd.register(t),(0,a.pM)({props:Jh,setup(t,s){let{expose:i}=s;const n=(0,Gh.IJ)(null),o=e=>{n.value=e?.chart};return i({chart:n}),()=>(0,a.h)(ru,tu({ref:o},{type:e,...t}))}})}const cu=du("doughnut",al),hu=du("line",nl);s(79577),s(41549),s(49797),s(49631),s(35623);class uu extends Error{constructor(e,t,s=!1,i=""){super(e),this.name="BatchOperationError",this.code=t,this.recoverable=s,this.suggestion=i}}const pu={401:()=>new uu("认证失败,请重新登录","AUTH_FAILED",!1,"请刷新页面并重新登录"),403:()=>new uu("权限不足或请求被拒绝","FORBIDDEN",!1,"请确认您有管理员权限"),400:e=>new uu(`请求数据无效: ${e}`,"INVALID_DATA",!0,"请检查数据格式后重试"),500:()=>new uu("服务器内部错误","SERVER_ERROR",!0,"请稍后重试,如果问题持续请联系管理员"),NETWORK:()=>new uu("网络连接失败","NETWORK_ERROR",!0,"请检查网络连接后重试"),ABORT:()=>new uu("操作已取消","ABORTED",!1,"")};function gu(e,t=""){if("AbortError"===e.name)return pu.ABORT();if(e instanceof Response||e&&"number"===typeof e.status){const s=pu[e.status];return s?s(t):new uu(`请求失败: ${e.status}`,"HTTP_ERROR",!0,"请稍后重试")}return e instanceof TypeError&&e.message.includes("fetch")?pu.NETWORK():new uu(e.message||"未知错误","UNKNOWN_ERROR",!0,"请稍后重试")}class mu{constructor(e={}){this.batchSize=e.batchSize||1e3,this.onProgress=e.onProgress||(()=>{}),this.onError=e.onError||(()=>{}),this.abortController=null}async fetchAllRecords(e=!1){this.abortController=new AbortController;const t=[];let s=null,i=0,a=0;try{do{if(this.abortController.signal.aborted)break;const n=await this.fetchBatch(s,e);t.push(...n.records),s=n.nextCursor,i+=n.records.length,a++,this.onProgress({phase:"fetching",current:i,batchCount:a,message:`已获取 ${i} 条记录...`})}while(s&&!this.abortController.signal.aborted);if(this.abortController.signal.aborted)throw pu.ABORT();return t}catch(n){const e=n instanceof uu?n:gu(n);throw this.onError(e),e}}async fetchBatch(e,t){const s=new URLSearchParams;e&&s.set("cursor",e),t&&s.set("includeValue","true"),s.set("limit",String(this.batchSize));try{const e=await(0,Ot.A)(`/api/manage/batch/list?${s}`,{signal:this.abortController.signal});if(!e.ok){let t="";try{const s=await e.json();t=s.error||""}catch{}throw gu(e,t)}const t=await e.json();if(!t.success)throw new uu(t.error||"请求失败","API_ERROR",!0,"请稍后重试");return{records:t.records||[],nextCursor:t.nextCursor||null,totalProcessed:t.totalProcessed||0}}catch(i){if(i instanceof uu)throw i;throw gu(i)}}abort(){this.abortController&&this.abortController.abort()}isAborted(){return!!this.abortController&&this.abortController.signal.aborted}reset(){this.abortController=null}}var fu=mu;class bu{constructor(e={}){this.chunkSize=e.chunkSize||null,this.maxRetries=e.maxRetries||3,this.retryDelay=e.retryDelay||1e3,this.onProgress=e.onProgress||(()=>{}),this.onError=e.onError||(()=>{}),this.sessionId=this.generateSessionId(),this.aborted=!1}async fetchConfig(){try{const e=await(0,Ot.A)("/api/manage/batch/index/config");if(!e.ok)throw new Error("获取配置失败");const t=await e.json();if(t.success)return{chunkSize:t.chunkSize||500,databaseType:t.databaseType||"unknown"};throw new Error(t.error||"获取配置失败")}catch(e){return console.warn("Failed to fetch index config, using default:",e),{chunkSize:500,databaseType:"unknown"}}}async rebuild(){this.aborted=!1;try{if(!this.chunkSize){const e=await this.fetchConfig();this.chunkSize=e.chunkSize}this.onProgress({phase:"fetching",message:"正在获取数据...",current:0});const e=new fu({onProgress:e=>this.onProgress({...e,phase:"fetching"}),onError:e=>this.onError(e)}),t=await e.fetchAllRecords(!1);if(this.aborted)throw new uu("操作已取消","ABORTED",!1,"");if(this.onProgress({phase:"sorting",message:"正在排序...",current:0,total:t.length}),this.sortByTimestampDescending(t),this.aborted)throw new uu("操作已取消","ABORTED",!1,"");const s=this.splitIntoChunks(t);for(let i=0;i<s.length;i++){if(this.aborted)throw new uu("操作已取消","ABORTED",!1,"");await this.uploadChunkWithRetry(s[i],i),this.onProgress({phase:"uploading",current:i+1,total:s.length,message:`正在上传分块 ${i+1}/${s.length}...`})}return this.onProgress({phase:"finalizing",message:"正在完成重建...",current:s.length,total:s.length}),await this.finalize(s.length,t.length),this.onProgress({phase:"completed",message:`索引重建完成,共 ${t.length} 个文件`,current:t.length,total:t.length}),{success:!0,totalFiles:t.length}}catch(e){const t=e instanceof uu?e:new uu(e.message||"索引重建失败","REBUILD_ERROR",!0,"请稍后重试");throw this.onError(t),t}}sortByTimestampDescending(e){e.sort((e,t)=>{const s=e.metadata&&e.metadata.TimeStamp||0,i=t.metadata&&t.metadata.TimeStamp||0;return i-s})}splitIntoChunks(e){const t=[];for(let s=0;s<e.length;s+=this.chunkSize)t.push(e.slice(s,s+this.chunkSize));return t}async uploadChunkWithRetry(e,t){let s;for(let a=1;a<=this.maxRetries;a++)try{return await this.uploadChunk(e,t)}catch(i){if(s=i,i instanceof uu&&("AUTH_FAILED"===i.code||"FORBIDDEN"===i.code||"ABORTED"===i.code))throw i;if(a<this.maxRetries){const e=this.retryDelay*Math.pow(2,a-1);await this.sleep(e),this.onProgress({phase:"retrying",message:`分块 ${t+1} 上传失败,正在重试 (${a}/${this.maxRetries})...`,current:t,attempt:a})}}throw s instanceof uu?s:new uu(`分块 ${t+1} 上传失败,已重试 ${this.maxRetries} 次`,"CHUNK_UPLOAD_FAILED",!1,"请检查网络连接后重新开始重建")}async uploadChunk(e,t){const s=await this.calculateChecksum(e);try{const i=await(0,Ot.A)("/api/manage/batch/index/chunk",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({chunkId:String(t),sessionId:this.sessionId,data:e,checksum:s})});if(!i.ok){let e="";try{const t=await i.json();e=t.error||""}catch{}throw this.createHttpError(i.status,e)}const a=await i.json();if(!a.success)throw new uu(a.error||"分块上传失败","CHUNK_UPLOAD_FAILED",!0,"请稍后重试");return a}catch(i){if(i instanceof uu)throw i;if(i instanceof TypeError&&i.message.includes("fetch"))throw new uu("网络连接失败","NETWORK_ERROR",!0,"请检查网络连接后重试");throw new uu(i.message||"分块上传失败","CHUNK_UPLOAD_FAILED",!0,"请稍后重试")}}async finalize(e,t){try{const s=await(0,Ot.A)("/api/manage/batch/index/finalize",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:this.sessionId,totalChunks:e,totalFiles:t})});if(!s.ok){let e="";try{const t=await s.json();e=t.error||""}catch{}throw this.createHttpError(s.status,e)}const i=await s.json();if(!i.success)throw new uu(i.error||"索引完成失败","FINALIZE_FAILED",!0,"请稍后重试");return i}catch(s){if(s instanceof uu)throw s;throw new uu(s.message||"索引完成失败","FINALIZE_FAILED",!0,"请稍后重试")}}generateSessionId(){return`rebuild_${Date.now()}_${Math.random().toString(36).slice(2)}`}async calculateChecksum(e){const t=JSON.stringify(e),s=new TextEncoder,i=s.encode(t);if("undefined"!==typeof crypto&&crypto.subtle){const e=await crypto.subtle.digest("SHA-256",i),t=Array.from(new Uint8Array(e));return t.map(e=>e.toString(16).padStart(2,"0")).join("")}let a=2166136261,n=2166136261;for(let o=0;o<i.length;o++)a=Math.imul(a^i[o],16777619)>>>0,n=Math.imul(n^i[o],16777635)>>>0;return a.toString(16).padStart(8,"0")+n.toString(16).padStart(8,"0")}createHttpError(e,t=""){switch(e){case 401:return new uu("认证失败,请重新登录","AUTH_FAILED",!1,"请刷新页面并重新登录");case 403:return new uu("权限不足或请求被拒绝","FORBIDDEN",!1,"请确认您有管理员权限");case 400:return new uu(`请求数据无效: ${t}`,"INVALID_DATA",!0,"请检查数据格式后重试");case 404:return new uu("会话不存在","SESSION_NOT_FOUND",!1,"请重新开始索引重建");case 410:return new uu("会话已过期","SESSION_EXPIRED",!1,"请重新开始索引重建");case 500:default:return new uu(`服务器错误: ${t||e}`,"SERVER_ERROR",!0,"请稍后重试")}}sleep(e){return new Promise(t=>setTimeout(t,e))}abort(){this.aborted=!0}reset(){this.aborted=!1,this.sessionId=this.generateSessionId()}}var yu=bu;class vu{constructor(e={}){this.onProgress=e.onProgress||(()=>{}),this.processor=null}async generateBackup(){this.processor=new fu({onProgress:e=>this.onProgress({...e,phase:"fetching"})});const e=await this.processor.fetchAllRecords(!0);this.onProgress({phase:"building",message:"正在构建备份数据..."});const t={timestamp:Date.now(),version:Rt.rE,data:{fileCount:e.length,files:{},settings:{}}};for(const a of e)t.data.files[a.id]={metadata:a.metadata,value:a.value||null};const s=await this.fetchSettings();t.data.settings=s,this.onProgress({phase:"downloading",message:"正在生成下载..."}),this.downloadBackup(t);const i=Object.keys(s).length;return{success:!0,fileCount:e.length,settingsCount:i}}async fetchSettings(){try{const e=await(0,Ot.A)("/api/manage/batch/settings");if(!e.ok)return console.warn("Failed to fetch settings:",e.status),{};const t=await e.json();return t.settings||{}}catch(e){return console.warn("Failed to fetch settings:",e),{}}}downloadBackup(e){const t=JSON.stringify(e,null,2),s=new Blob([t],{type:"application/json"}),i=URL.createObjectURL(s),a=document.createElement("a");a.href=i,a.download=`imgbed_backup_${(new Date).toISOString().split("T")[0]}.json`,document.body.appendChild(a),a.click(),document.body.removeChild(a),URL.revokeObjectURL(i)}abort(){this.processor&&this.processor.abort()}isAborted(){return!!this.processor&&this.processor.isAborted()}}var xu=vu;class ku{constructor(e={}){this.chunkSize=e.chunkSize||50,this.maxRetries=e.maxRetries||3,this.retryDelay=e.retryDelay||1e3,this.onProgress=e.onProgress||(()=>{}),this.onError=e.onError||(()=>{}),this.aborted=!1}async restore(e){if(this.aborted=!1,!e||!e.data)throw new uu("备份文件格式无效","INVALID_BACKUP",!1,"请选择有效的备份文件");const{files:t={},settings:s={}}=e.data,i=Object.entries(t),a=Object.entries(s),n=i.length,o=a.length,l=n+o;let r=0,d=0,c=0,h=0;try{this.onProgress({phase:"restoring_files",message:"正在恢复文件数据...",current:0,total:l});const t=this.splitIntoChunks(i,this.chunkSize);for(let e=0;e<t.length;e++){if(this.aborted)throw new uu("操作已取消","ABORTED",!1,"");const s=t[e],i=Object.fromEntries(s),a=await this.uploadChunkWithRetry("files",i);r+=a.restoredCount,c+=a.failedCount,this.onProgress({phase:"restoring_files",message:`正在恢复文件数据 ${r}/${n}...`,current:r,total:l,percentage:r/l*80})}this.onProgress({phase:"restoring_settings",message:"正在恢复系统设置...",current:r,total:l});const s=this.splitIntoChunks(a,this.chunkSize);for(let e=0;e<s.length;e++){if(this.aborted)throw new uu("操作已取消","ABORTED",!1,"");const t=s[e],i=Object.fromEntries(t),a=await this.uploadChunkWithRetry("settings",i);d+=a.restoredCount,h+=a.failedCount,this.onProgress({phase:"restoring_settings",message:`正在恢复系统设置 ${d}/${o}...`,current:r+d,total:l,percentage:80+d/o*20})}return this.onProgress({phase:"completed",message:"恢复完成",current:l,total:l,percentage:100}),{success:!0,restoredFiles:r,restoredSettings:d,failedFiles:c,failedSettings:h,backupTimestamp:e.timestamp}}catch(u){const e=u instanceof uu?u:new uu(u.message||"恢复失败","RESTORE_ERROR",!0,"请稍后重试");throw this.onError(e),e}}splitIntoChunks(e,t){const s=[];for(let i=0;i<e.length;i+=t)s.push(e.slice(i,i+t));return s}async uploadChunkWithRetry(e,t){let s;for(let a=1;a<=this.maxRetries;a++)try{return await this.uploadChunk(e,t)}catch(i){if(s=i,i instanceof uu&&("AUTH_FAILED"===i.code||"FORBIDDEN"===i.code||"ABORTED"===i.code))throw i;if(a<this.maxRetries){const e=this.retryDelay*Math.pow(2,a-1);await this.sleep(e)}}throw s}async uploadChunk(e,t){try{const s=await(0,Ot.A)("/api/manage/batch/restore/chunk",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:e,data:t})});if(!s.ok){let e="";try{const t=await s.json();e=t.error||""}catch{}throw this.createHttpError(s.status,e)}const i=await s.json();if(!i.success)throw new uu(i.error||"恢复分块失败","CHUNK_RESTORE_FAILED",!0,"请稍后重试");return i}catch(s){if(s instanceof uu)throw s;if(s instanceof TypeError&&s.message.includes("fetch"))throw new uu("网络连接失败","NETWORK_ERROR",!0,"请检查网络连接后重试");throw new uu(s.message||"恢复分块失败","CHUNK_RESTORE_FAILED",!0,"请稍后重试")}}createHttpError(e,t=""){switch(e){case 401:return new uu("认证失败,请重新登录","AUTH_FAILED",!1,"请刷新页面并重新登录");case 403:return new uu("权限不足或请求被拒绝","FORBIDDEN",!1,"请确认您有管理员权限");case 400:return new uu(`请求数据无效: ${t}`,"INVALID_DATA",!0,"请检查备份文件格式");case 500:default:return new uu(`服务器错误: ${t||e}`,"SERVER_ERROR",!0,"请稍后重试")}}sleep(e){return new Promise(t=>setTimeout(t,e))}abort(){this.aborted=!0}}var _u=ku;bd.register(Td,ah,Oc,dh,ph,zd,Wd,Mc);const wu=864e5;function Cu(e){return String(e).padStart(2,"0")}function Su(e){return`${e.getFullYear()}-${Cu(e.getMonth()+1)}-${Cu(e.getDate())}`}function Fu(){const e=new Date;e.setHours(0,0,0,0);const t=new Date(e.getTime()-6*wu);return[Su(t),Su(e)]}var Tu={name:"SysCogStatus",components:{Doughnut:cu,Line:hu,DateRangeCalendar:H},data(){return{loading:!1,rebuilding:!1,backing:!1,restoring:!1,indexInfo:{},indexInfoLoaded:!1,indexInfoError:!1,currentTime:new Date,clockTimer:null,version:Rt.rE,loadErrors:{newest:!1,oldest:!1},trendGroupBy:"channel",trendDatePickerVisible:!1,trendDateRange:Fu(),channelColors:["#8B5CF6","#EC4899","#06B6D4","#10B981","#F59E0B","#EF4444","#2563EB","#84CC16"],typeColors:["#10B981","#3B82F6","#F59E0B","#EF4444","#8B5CF6","#EC4899","#06B6D4","#84CC16"],trendColors:["#2563EB","#10B981","#F59E0B","#EF4444","#8B5CF6","#06B6D4","#EC4899","#84CC16","#64748B"],isProcessing:!1,processingPhase:"",processingProgress:{current:0,total:0,message:"",percentage:0},processingError:null,processingStartTime:null,currentRebuilder:null,currentBackupGenerator:null,currentRestoreProcessor:null}},computed:{currentLocale(){return String(this.$i18n.locale||"zh-CN")},indexedFileCount(){return Number(this.indexInfo.totalFiles||0)},uploadChannelCount(){return Object.keys(this.indexInfo.channelStats||{}).length},systemHealthState(){return this.indexInfoError?"attention":this.indexInfoLoaded?"healthy":"checking"},systemHealthLabel(){return this.$t(`sysStatus.health${this.systemHealthState.charAt(0).toUpperCase()}${this.systemHealthState.slice(1)}`)},greetingTitle(){const e=this.currentTime.getHours();return e<5?this.$t("sysStatus.greetingLateNight"):e<11?this.$t("sysStatus.greetingMorning"):e<14?this.$t("sysStatus.greetingNoon"):e<18?this.$t("sysStatus.greetingAfternoon"):e<23?this.$t("sysStatus.greetingEvening"):this.$t("sysStatus.greetingLateNight")},systemStatusSummary(){return this.indexInfoError?this.$t("sysStatus.summaryUnavailable"):this.indexInfoLoaded?0===this.indexedFileCount?this.$t("sysStatus.summaryEmpty"):0===this.uploadChannelCount?this.$t("sysStatus.summaryIndexed",{files:this.indexedFileCount.toLocaleString(this.currentLocale)}):this.$t("sysStatus.summaryHealthy",{files:this.indexedFileCount.toLocaleString(this.currentLocale),channels:this.uploadChannelCount.toLocaleString(this.currentLocale)}):this.$t("sysStatus.summaryChecking")},currentDateLabel(){return new Intl.DateTimeFormat(this.currentLocale,{year:"numeric",month:"long",day:"numeric",weekday:"long"}).format(this.currentTime)},currentTimeLabel(){return new Intl.DateTimeFormat(this.currentLocale,{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1}).format(this.currentTime)},timeZoneLabel(){const e=Intl.DateTimeFormat().resolvedOptions().timeZone||this.$t("sysStatus.localTimezone"),t=-this.currentTime.getTimezoneOffset(),s=t>=0?"+":"-",i=Math.abs(t),a=Math.floor(i/60),n=i%60,o=0===n?`UTC${s}${a}`:`UTC${s}${a}:${String(n).padStart(2,"0")}`;return`${e} · ${o}`},channelChartData(){const e=this.indexInfo.channelStats||{};return{labels:Object.keys(e),datasets:[{data:Object.values(e),backgroundColor:this.channelColors.slice(0,Object.keys(e).length),borderWidth:0}]}},typeChartData(){const e=this.aggregatedTypeStats;return{labels:Object.keys(e),datasets:[{data:Object.values(e),backgroundColor:this.typeColors.slice(0,Object.keys(e).length),borderWidth:0}]}},aggregatedTypeStats(){const e=this.indexInfo.typeStats||{},t={};for(const[s,i]of Object.entries(e)){const e="Block"===s?this.$t("sysStatus.blocked"):this.$t("sysStatus.normalStatus");t[e]=(t[e]||0)+i}return t},currentTrendGroup(){const e=this.indexInfo.uploadTrend||{},t=e.groupBy||{};return t[this.trendGroupBy]||{series:[]}},trendRawLabels(){const e=this.indexInfo.uploadTrend||{};return e.labels||[]},trendRangeCrossesYear(){const e=new Set;return this.trendRawLabels.forEach(t=>{this.extractTrendLabelDates(t).forEach(t=>e.add(t.year))}),e.size>1},trendDisplayLabels(){return this.trendRawLabels.map(e=>this.formatTrendAxisLabel(e))},hasTrendData(){const e=this.indexInfo.uploadTrend||{};return(e.labels||[]).length>0},trendDateDialogWidth(){return window.innerWidth>768?"420px":"90%"},uploadTrendChartData(){const e=this.indexInfo.uploadTrend||{},t=this.currentTrendGroup.series||[],s="#F97316";return{labels:this.trendDisplayLabels,datasets:[{label:this.$t("sysStatus.totalUploads"),data:e.total||[],borderColor:s,backgroundColor:this.hexToRgba(s,.1),pointBackgroundColor:s,pointBorderColor:s,borderWidth:3,pointRadius:2,pointHoverRadius:5,tension:.28,fill:!1},...t.map((e,t)=>{const s=this.getTrendColor(t);return{label:this.formatTrendSeriesName(e),data:e.data||[],borderColor:s,backgroundColor:this.hexToRgba(s,.12),pointBackgroundColor:s,pointBorderColor:s,borderWidth:2,pointRadius:2,pointHoverRadius:5,tension:.32,fill:!1}})]}},lineChartOptions(){const e="#64748B";return{responsive:!0,maintainAspectRatio:!1,interaction:{mode:"index",intersect:!1},plugins:{legend:{display:!0,position:"bottom",labels:{usePointStyle:!0,boxWidth:8,boxHeight:8,padding:16,color:e}},tooltip:{backgroundColor:"rgba(0, 0, 0, 0.8)",titleColor:"#fff",bodyColor:"#fff",padding:12,cornerRadius:8,displayColors:!0,callbacks:{title:e=>{const t=e?.[0]?.dataIndex;return this.trendRawLabels[t]||""},label:e=>{const t=e.parsed||{},s=void 0!==t.y?t.y:e.raw;return` ${e.dataset.label}: ${Number(s||0).toLocaleString()} ${this.$t("sysStatus.uploadsUnit")}`}}}},scales:{x:{grid:{display:!1},ticks:{color:e,maxTicksLimit:8,autoSkip:!0}},y:{beginAtZero:!0,grid:{color:"rgba(148, 163, 184, 0.18)"},ticks:{color:e,precision:0,callback:e=>Number(e).toLocaleString()}}}}},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:e=>{const t=e.raw,s=e.dataset.data.reduce((e,t)=>e+t,0),i=(t/s*100).toFixed(1);return` ${t.toLocaleString()} (${i}%)`}}}},animation:{animateRotate:!0,animateScale:!0}}},estimatedTimeRemaining(){if(!this.isProcessing||!this.processingStartTime)return"";if(0===this.processingProgress.current||0===this.processingProgress.percentage)return"";const e=Date.now()-this.processingStartTime,t=this.processingProgress.percentage/100;if(t<=0)return"";const s=e/t,i=s-e;if(i<=0)return this.$t("sysStatus.aboutToComplete");const a=Math.ceil(i/1e3);if(a<60)return this.$t("sysStatus.seconds",{count:a});const n=Math.ceil(a/60);if(n<60)return this.$t("sysStatus.minutes",{count:n});const o=Math.floor(n/60),l=n%60;return this.$t("sysStatus.hoursMinutes",{hours:o,minutes:l})},phaseDescription(){const e={fetching:this.$t("sysStatus.phaseFetching"),sorting:this.$t("sysStatus.phaseSorting"),uploading:this.$t("sysStatus.phaseUploading"),finalizing:this.$t("sysStatus.phaseFinalizing"),building:this.$t("sysStatus.phaseBuilding"),downloading:this.$t("sysStatus.phaseDownloading"),restoring_files:this.$t("sysStatus.phaseRestoringFiles"),restoring_settings:this.$t("sysStatus.phaseRestoringSettings"),completed:this.$t("sysStatus.phaseCompleted"),retrying:this.$t("sysStatus.phaseRetrying")};return e[this.processingPhase]||this.processingPhase}},mounted(){this.fetchIndexInfo(),this.clockTimer=window.setInterval(()=>{this.currentTime=new Date},1e3)},beforeUnmount(){this.clockTimer&&(window.clearInterval(this.clockTimer),this.clockTimer=null)},methods:{getChartColor(e){return this.channelColors[e%this.channelColors.length]},getTypeChartColor(e){return this.typeColors[e%this.typeColors.length]},getTrendColor(e){return this.trendColors[e%this.trendColors.length]},formatTrendSeriesName(e){return e?.isOther||"__other__"===e?.name?this.$t("sysStatus.otherChannels"):e?.name||this.$t("sysStatus.unknown")},hexToRgba(e,t){const s=(e||"").replace("#","");if(6!==s.length)return`rgba(37, 99, 235, ${t})`;const i=parseInt(s.slice(0,2),16),a=parseInt(s.slice(2,4),16),n=parseInt(s.slice(4,6),16);return`rgba(${i}, ${a}, ${n}, ${t})`},extractTrendLabelDates(e){const t=String(e||"").match(/\d{4}-\d{2}-\d{2}/g)||[];return t.map(e=>{const[t,s,i]=e.split("-").map(Number);return{year:t,month:s,day:i}})},formatTrendAxisLabel(e){const t=this.extractTrendLabelDates(e);if(0===t.length)return e;const s=(e,t)=>{const s=`${e.month}/${e.day}`;return t?`${e.year}/${s}`:s};if(1===t.length)return s(t[0],this.trendRangeCrossesYear);const[i,a]=t;if(!this.trendRangeCrossesYear)return`${s(i,!1)}-${s(a,!1)}`;const n=i.year===a.year?s(a,!1):s(a,!0);return`${s(i,!0)}-${n}`},openTrendDateDialog(){this.trendDatePickerVisible=!0},handleTrendDateRangeChange(e){Array.isArray(e)&&2===e.length&&e[0]&&e[1]&&(this.trendDatePickerVisible=!1,this.fetchIndexInfo())},getTrendDateRangeParams(){return Array.isArray(this.trendDateRange)&&2===this.trendDateRange.length||(this.trendDateRange=Fu()),{startDate:this.trendDateRange[0],endDate:this.trendDateRange[1]}},async fetchIndexInfo(){this.loading=!0,this.indexInfoError=!1;try{const{startDate:e,endDate:t}=this.getTrendDateRangeParams(),s=new URLSearchParams({action:"info",timezoneOffset:String((new Date).getTimezoneOffset()),trendMaxPoints:"90",trendSeriesLimit:"8",trendStartDate:e,trendEndDate:t}),i=await(0,Ot.A)(`/api/manage/list?${s.toString()}`,{method:"GET"});if(!i.ok)throw new Error("API请求失败");{const e=await i.json();this.indexInfo=e,this.indexInfoLoaded=!0}}catch(e){console.error("获取索引信息失败:",e),this.indexInfoError=!0,this.$message.error(this.$t("sysStatus.fetchIndexFailed"))}finally{this.loading=!1}},async rebuildIndex(){if(this.isProcessing)this.$message.warning(this.$t("sysStatus.operationInProgress"));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 yu({onProgress:e=>this.handleProgress(e),onError:e=>this.handleError(e)});try{const e=await this.currentRebuilder.rebuild();this.$message.success(this.$t("sysStatus.rebuildSuccess",{count:e.totalFiles.toLocaleString()})),setTimeout(()=>{this.fetchIndexInfo()},1e3)}catch(e){if("ABORTED"!==e.code){const t=e.suggestion?`${e.message}。${e.suggestion}`:e.message;this.$message.error(t),this.processingError={message:e.message,suggestion:e.suggestion,recoverable:e.recoverable}}}finally{this.rebuilding=!1,this.isProcessing=!1,this.currentRebuilder=null,this.processingStartTime=null}}},async backupData(){if(this.isProcessing)this.$message.warning(this.$t("sysStatus.operationInProgress"));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 xu({onProgress:e=>this.handleProgress(e)});try{const e=await this.currentBackupGenerator.generateBackup(),t=e.settingsCount>0?this.$t("sysStatus.backupSuccessWithSettings",{fileCount:e.fileCount.toLocaleString(),settingsCount:e.settingsCount}):this.$t("sysStatus.backupSuccess",{count:e.fileCount.toLocaleString()});this.$message.success(t)}catch(e){if("ABORTED"!==e.code){const t=e.suggestion?`${e.message}。${e.suggestion}`:e.message;this.$message.error(t),this.processingError={message:e.message,suggestion:e.suggestion,recoverable:e.recoverable}}}finally{this.backing=!1,this.isProcessing=!1,this.currentBackupGenerator=null,this.processingStartTime=null}}},selectRestoreFile(){this.restoring||this.$refs.fileInput.click()},async handleFileSelect(e){const t=e.target.files[0];if(t)if(t.name.endsWith(".json")){try{await this.$confirm(this.$t("sysStatus.restoreConfirmMessage"),this.$t("sysStatus.restoreConfirmTitle"),{confirmButtonText:this.$t("sysStatus.restoreConfirmOk"),cancelButtonText:this.$t("sysStatus.restoreConfirmCancel"),type:"warning"}),await this.restoreData(t)}catch(s){"cancel"!==s&&console.error("确认恢复失败:",s)}e.target.value=""}else this.$message.error(this.$t("sysStatus.selectJsonFile"))},async restoreData(e){if(this.isProcessing)this.$message.warning(this.$t("sysStatus.operationInProgress"));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 s=await e.text();let i;try{i=JSON.parse(s)}catch(t){throw new Error(this.$t("sysStatus.invalidBackupFile"))}this.currentRestoreProcessor=new _u({chunkSize:100,onProgress:e=>this.handleProgress(e),onError:e=>this.handleError(e)});const a=await this.currentRestoreProcessor.restore(i);this.restoring=!1,this.isProcessing=!1,this.currentRestoreProcessor=null,this.processingStartTime=null,this.$message.success(this.$t("sysStatus.restoreSuccess",{files:a.restoredFiles,settings:a.restoredSettings})),await new Promise(e=>setTimeout(e,500)),await this.rebuildIndex()}catch(s){if(console.error("恢复数据失败:",s),this.restoring=!1,this.isProcessing=!1,this.currentRestoreProcessor=null,this.processingStartTime=null,"ABORTED"!==s.code){const e=s.suggestion?`${s.message}。${s.suggestion}`:s.message;this.$message.error(this.$t("sysStatus.restoreFailed")+": "+e),this.processingError={message:s.message,suggestion:s.suggestion,recoverable:s.recoverable}}}}},formatTime(e){if(!e)return this.$t("sysStatus.unknown");const t=new Date(e);return t.toLocaleString("zh-CN",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"})},getPercentage(e,t){return t&&0!==t?Math.round(e/t*100):0},getTimeAgo(e){if(!e)return"";const t=Date.now(),s=t-e,i=Math.floor(s/6e4),a=Math.floor(s/36e5),n=Math.floor(s/864e5);return n>0?this.$t("sysStatus.daysAgo",{count:n}):a>0?this.$t("sysStatus.hoursAgo",{count:a}):i>0?this.$t("sysStatus.minutesAgo",{count:i}):this.$t("sysStatus.justNow")},handleImageError(e){this.loadErrors[e]=!0},isValidPreview(e,t){return!this.loadErrors[e]&&(!!t?.metadata?.FileType&&(t.metadata.FileType.includes("image")||t.metadata.FileType.includes("video")))},openReleases(){window.open("https://github.com/MarSeventh/CloudFlare-ImgBed/releases","_blank")},isImageFile(e){if(!e)return!1;if(e.metadata?.FileType?.includes("image"))return!0;const t=e.metadata?.FileName||e.id||"",s=t.substring(t.lastIndexOf(".")+1).toLowerCase(),i=["jpg","jpeg","png","gif","bmp","webp","svg","ico","tiff","tif","avif","heic","heif"];return i.includes(s)},isVideoFile(e){if(!e)return!1;if(e.metadata?.FileType?.includes("video"))return!0;const t=e.metadata?.FileName||e.id||"",s=t.substring(t.lastIndexOf(".")+1).toLowerCase(),i=["mp4","webm","ogg","avi","mov","flv","wmv","mkv","m4v","3gp","mpeg","mpg"];return i.includes(s)},openFileInNewTab(e){e?.id&&window.open("/file/"+e.id+"?from=admin","_blank")},handleProgress(e){this.processingPhase=e.phase,this.processingProgress.message=e.message||"",this.processingProgress.current=e.current||0,"fetching"===e.phase?(this.processingProgress.total=e.total||0,e.total&&e.total>0?this.processingProgress.percentage=Math.min(60,e.current/e.total*60):this.processingProgress.percentage=Math.min(50,15*Math.log10(e.current+1))):"sorting"===e.phase?(this.processingProgress.percentage=65,this.processingProgress.total=e.total||this.processingProgress.total):"uploading"===e.phase?(this.processingProgress.total=e.total||0,e.total&&e.total>0&&(this.processingProgress.percentage=70+e.current/e.total*25)):"finalizing"===e.phase?this.processingProgress.percentage=97:"building"===e.phase?this.processingProgress.percentage=80:"downloading"===e.phase?this.processingProgress.percentage=95:"restoring_files"===e.phase?(this.processingProgress.total=e.total||0,this.processingProgress.percentage=e.percentage||0):"restoring_settings"===e.phase?(this.processingProgress.total=e.total||0,this.processingProgress.percentage=e.percentage||80):"completed"===e.phase?this.processingProgress.percentage=100:"retrying"===e.phase&&(this.processingProgress.message=e.message)},handleError(e){console.error("批量操作错误:",e),this.processingError={message:e.message,suggestion:e.suggestion,recoverable:e.recoverable}},cancelOperation(){this.currentRebuilder&&(this.currentRebuilder.abort(),this.$message.info(this.$t("sysStatus.cancellingRebuild"))),this.currentBackupGenerator&&(this.currentBackupGenerator.abort(),this.$message.info(this.$t("sysStatus.cancellingRebuild"))),this.currentRestoreProcessor&&(this.currentRestoreProcessor.abort(),this.$message.info(this.$t("sysStatus.cancellingRebuild")))},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 Au=(0,u.A)(Tu,[["render",Ut],["__scopeId","data-v-993a3210"]]);var Mu=Au,Pu=s(59869),$u=(s(70415),s(73565),s(82006)),Du=(s(98642),s(81418)),Vu=(s(50333),s(39623)),Lu=(s(29092),s(63003),s(76018)),Eu=(s(96808),s(67819),s(55558)),Iu=(s(10456),s(12687)),Uu=(s(18785),s(97769));const Ou=["onClick"];function Ru(e,t,s,i,o,l){const r=(0,a.g2)("font-awesome-icon"),d=Uu.A;return(0,a.uX)(),(0,a.CE)("div",{class:(0,n.C4)(["custom-select",{"is-open":o.isOpen}]),style:(0,n.Tr)({width:s.width})},[(0,a.Lk)("div",{class:"custom-select-trigger",onClick:t[0]||(t[0]=(...e)=>l.toggleDropdown&&l.toggleDropdown(...e))},[(0,a.Lk)("span",{class:(0,n.C4)(["custom-select-value",{"is-placeholder":!s.modelValue}])},(0,n.v_)(l.displayLabel),3),(0,a.bF)(r,{icon:"chevron-down",class:"custom-select-arrow"})]),(0,a.bF)(w.eB,{name:"dropdown-fade"},{default:(0,a.k6)(()=>[(0,a.bo)((0,a.Lk)("div",{class:"custom-select-dropdown",onClick:t[1]||(t[1]=(0,w.D$)(()=>{},["stop"]))},[((0,a.uX)(!0),(0,a.CE)(a.FK,null,(0,a.pI)(s.options,t=>((0,a.uX)(),(0,a.CE)("div",{key:t.value,class:(0,n.C4)(["custom-select-option",{"is-selected":s.modelValue===t.value}]),onClick:e=>l.selectOption(t.value)},[(0,a.RG)(e.$slots,"option",{option:t},()=>[t.channelType?((0,a.uX)(),(0,a.Wv)(d,{key:0,type:t.channelType,class:(0,n.C4)(["option-icon",t.iconClass])},null,8,["type","class"])):t.icon?((0,a.uX)(),(0,a.Wv)(r,{key:1,icon:t.icon,class:(0,n.C4)(["option-icon",t.iconClass])},null,8,["icon","class"])):(0,a.Q3)("",!0),(0,a.Lk)("span",null,(0,n.v_)(t.label),1)],!0)],10,Ou))),128))],512),[[w.aG,o.isOpen]])]),_:3})],6)}var Wu={name:"CustomSelect",components:{ChannelIcon:Uu.A},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:{resolvedPlaceholder(){return this.placeholder||this.$t("common.select")},displayLabel(){const e=this.options.find(e=>e.value===this.modelValue);return e?e.label:this.resolvedPlaceholder}},mounted(){document.addEventListener("click",this.handleClickOutside)},beforeUnmount(){document.removeEventListener("click",this.handleClickOutside)},methods:{toggleDropdown(){this.isOpen=!this.isOpen},selectOption(e){this.$emit("update:modelValue",e),this.$emit("change",e),this.isOpen=!1},handleClickOutside(e){this.$el.contains(e.target)||(this.isOpen=!1)}}};const Nu=(0,u.A)(Wu,[["render",Ru],["__scopeId","data-v-b9420432"]]);var zu=Nu;const Bu={class:"upload-settings"},ju={class:"page-header"},Hu={class:"first-title"},qu={class:"header-actions"},Xu={class:"group-header"},Ku={class:"group-title"},Qu={key:0,class:"load-balance-switch"},Yu={class:"switch-label"},Gu={key:0,class:"channel-cards"},Ju=["onMousemove","onMouseleave"],Zu={class:"card-header"},ep={class:"card-title"},tp={class:"channel-name"},sp={class:"card-body"},ip={class:"card-info"},ap={class:"info-item"},np={class:"info-text"},op={key:0,class:"info-item"},lp={class:"info-text"},rp={key:1,class:"info-item"},dp=["title"],cp={class:"info-item"},hp={class:"info-text"},up={key:0,class:"info-item"},pp=["title"],gp={class:"info-item"},mp={class:"info-text"},fp={class:"info-item"},bp={class:"info-text"},yp={class:"info-item"},vp={class:"info-text"},xp={class:"info-item"},kp=["title"],_p={key:0,class:"info-item"},wp=["title"],Cp={key:0,class:"quota-mini"},Sp={class:"quota-text"},Fp={class:"card-actions"},Tp={key:1,class:"empty-tip"},Ap={class:"channel-type-option"},Mp={key:0,class:"form-warning",style:{"margin-top":"0"}},Pp=["innerHTML"],$p={class:"form-warning"},Dp={class:"quota-label"},Vp={class:"quota-status"};function Lp(e,t,s,i,o,l){const r=(0,a.g2)("font-awesome-icon"),d=x.R7,c=zu,h=X.S2,u=Uu.A,p=Iu.u,g=Eu.qi,m=k.ve,f=Lu.P9,b=Lu.AV,v=$u.xE,C=Vu.WK,S=Du.lq,F=$u.US,T=_.kZ,A=Pu.MF,M=Pu.TS,P=y.A;return(0,a.bo)(((0,a.uX)(),(0,a.CE)("div",Bu,[(0,a.Lk)("div",ju,[(0,a.Lk)("h3",Hu,[(0,a.eW)((0,n.v_)(e.$t("sysUpload.title"))+" ",1),(0,a.bF)(d,{content:e.$t("sysUpload.titleTooltip"),placement:"right"},{default:(0,a.k6)(()=>[(0,a.bF)(r,{icon:"question-circle",class:"help-icon"})]),_:1},8,["content"])]),(0,a.Lk)("div",qu,[(0,a.bF)(c,{modelValue:o.channelFilter,"onUpdate:modelValue":t[0]||(t[0]=e=>o.channelFilter=e),options:l.filterOptions,placeholder:e.$t("sysUpload.filterPlaceholder"),width:"160px"},null,8,["modelValue","options","placeholder"]),(0,a.bF)(h,{type:"primary",onClick:t[1]||(t[1]=e=>o.showAddDialog=!0),class:"add-btn"},{default:(0,a.k6)(()=>[(0,a.bF)(r,{icon:"plus",style:{"margin-right":"6px"}}),(0,a.eW)(" "+(0,n.v_)(e.$t("sysUpload.addChannel")),1)]),_:1})])]),((0,a.uX)(!0),(0,a.CE)(a.FK,null,(0,a.pI)(l.filteredChannels,s=>((0,a.uX)(),(0,a.CE)("div",{key:s.value,class:"channel-group"},[(0,a.Lk)("div",Xu,[(0,a.Lk)("div",Ku,[(0,a.bF)(u,{type:s.value,class:"group-icon"},null,8,["type"]),(0,a.Lk)("span",null,(0,n.v_)(s.label),1),(0,a.bF)(p,{size:"small",type:"info",class:"channel-count"},{default:(0,a.k6)(()=>[(0,a.eW)((0,n.v_)(l.getChannelList(s.value).length),1)]),_:2},1024)]),l.hasLoadBalance(s.value)?((0,a.uX)(),(0,a.CE)("div",Qu,[(0,a.Lk)("span",Yu,(0,n.v_)(e.$t("sysUpload.loadBalance")),1),(0,a.bF)(g,{modelValue:l.getSettings(s.value).loadBalance.enabled,"onUpdate:modelValue":e=>l.getSettings(s.value).loadBalance.enabled=e,size:"small",onChange:l.saveSettings},null,8,["modelValue","onUpdate:modelValue","onChange"])])):(0,a.Q3)("",!0)]),l.getChannelList(s.value).length>0?((0,a.uX)(),(0,a.CE)("div",Gu,[((0,a.uX)(!0),(0,a.CE)(a.FK,null,(0,a.pI)(l.getChannelList(s.value),(i,o)=>((0,a.uX)(),(0,a.CE)("div",{key:i.name||o,class:(0,n.C4)(["channel-card",[s.value,{disabled:!i.enabled,fixed:i.fixed}]]),onMousemove:e=>l.handleCardMouseMove(e,s.value,o),onMouseleave:e=>l.handleCardMouseLeave(s.value,o)},[(0,a.Lk)("div",{class:"card-glow",ref_for:!0,ref:`glow-${s.value}-${o}`},null,512),(0,a.Lk)("div",Zu,[(0,a.Lk)("div",ep,[(0,a.Lk)("span",tp,(0,n.v_)(i.name||e.$t("sysUpload.unnamedChannel")),1),i.fixed?((0,a.uX)(),(0,a.Wv)(p,{key:0,size:"small",type:"warning"},{default:(0,a.k6)(()=>[(0,a.eW)((0,n.v_)(e.$t("sysUpload.envVariable")),1)]),_:1})):(0,a.Q3)("",!0)]),(0,a.bF)(g,{modelValue:i.enabled,"onUpdate:modelValue":e=>i.enabled=e,size:"small",onClick:t[2]||(t[2]=(0,w.D$)(()=>{},["stop"])),onChange:l.saveSettings},null,8,["modelValue","onUpdate:modelValue","onChange"])]),(0,a.Lk)("div",sp,[(0,a.Lk)("div",ip,["telegram"===s.value?((0,a.uX)(),(0,a.CE)(a.FK,{key:0},[(0,a.Lk)("div",ap,[(0,a.bF)(r,{icon:"robot",class:"info-icon"}),(0,a.Lk)("span",np,"Bot: "+(0,n.v_)(l.maskText(i.botToken)),1)]),i.chatId?((0,a.uX)(),(0,a.CE)("div",op,[(0,a.bF)(r,{icon:"comments",class:"info-icon"}),(0,a.Lk)("span",lp,"Channel: "+(0,n.v_)(l.maskText(i.chatId)),1)])):(0,a.Q3)("",!0)],64)):"cfr2"===s.value?((0,a.uX)(),(0,a.CE)("div",rp,[(0,a.bF)(r,{icon:"link",class:"info-icon"}),(0,a.Lk)("span",{class:"info-text",title:i.publicUrl},(0,n.v_)(i.publicUrl||e.$t("sysUpload.notSet")),9,dp)])):"s3"===s.value?((0,a.uX)(),(0,a.CE)(a.FK,{key:2},[(0,a.Lk)("div",cp,[(0,a.bF)(r,{icon:"server",class:"info-icon"}),(0,a.Lk)("span",hp,(0,n.v_)(i.bucketName||e.$t("sysUpload.notSet")),1)]),i.endpoint?((0,a.uX)(),(0,a.CE)("div",up,[(0,a.bF)(r,{icon:"link",class:"info-icon"}),(0,a.Lk)("span",{class:"info-text",title:i.endpoint},(0,n.v_)(i.endpoint),9,pp)])):(0,a.Q3)("",!0)],64)):"discord"===s.value?((0,a.uX)(),(0,a.CE)(a.FK,{key:3},[(0,a.Lk)("div",gp,[(0,a.bF)(r,{icon:"robot",class:"info-icon"}),(0,a.Lk)("span",mp,"Bot: "+(0,n.v_)(l.maskText(i.botToken)),1)]),(0,a.Lk)("div",fp,[(0,a.bF)(r,{icon:"hashtag",class:"info-icon"}),(0,a.Lk)("span",bp,"Channel: "+(0,n.v_)(l.maskText(i.channelId)),1)]),i.isNitro?((0,a.uX)(),(0,a.Wv)(p,{key:0,size:"small",type:"success"},{default:(0,a.k6)(()=>[...t[78]||(t[78]=[(0,a.eW)("Nitro",-1)])]),_:1})):(0,a.Q3)("",!0)],64)):"huggingface"===s.value?((0,a.uX)(),(0,a.CE)(a.FK,{key:4},[(0,a.Lk)("div",yp,[(0,a.bF)(r,{icon:"database",class:"info-icon"}),(0,a.Lk)("span",vp,(0,n.v_)(i.repo||e.$t("sysUpload.notSet")),1)]),i.isPrivate?((0,a.uX)(),(0,a.Wv)(p,{key:0,size:"small",type:"warning"},{default:(0,a.k6)(()=>[(0,a.eW)((0,n.v_)(e.$t("sysUpload.privateRepo")),1)]),_:1})):(0,a.Q3)("",!0)],64)):"webdav"===s.value?((0,a.uX)(),(0,a.CE)(a.FK,{key:5},[(0,a.Lk)("div",xp,[(0,a.bF)(r,{icon:"folder",class:"info-icon"}),(0,a.Lk)("span",{class:"info-text",title:i.baseUrl},(0,n.v_)(i.baseUrl||e.$t("sysUpload.notSet")),9,kp)]),i.publicUrl?((0,a.uX)(),(0,a.CE)("div",_p,[(0,a.bF)(r,{icon:"link",class:"info-icon"}),(0,a.Lk)("span",{class:"info-text",title:i.publicUrl},(0,n.v_)(i.publicUrl),9,wp)])):(0,a.Q3)("",!0)],64)):(0,a.Q3)("",!0)]),i.quota?.enabled?((0,a.uX)(),(0,a.CE)("div",Cp,[(0,a.bF)(m,{percentage:l.getQuotaPercentage(i),status:l.getQuotaStatus(i),"stroke-width":6},null,8,["percentage","status"]),(0,a.Lk)("span",Sp,(0,n.v_)(l.getQuotaText(i)),1)])):(0,a.Q3)("",!0)]),(0,a.Lk)("div",Fp,[(0,a.bF)(h,{text:"",type:"primary",size:"small",onClick:e=>l.openDetailDialog(s.value,o)},{default:(0,a.k6)(()=>[(0,a.bF)(r,{icon:"eye",style:{"margin-right":"4px"}}),(0,a.eW)((0,n.v_)(e.$t("sysUpload.detail")),1)]),_:1},8,["onClick"]),(0,a.bF)(h,{text:"",type:"primary",size:"small",onClick:e=>l.openEditDialog(s.value,o)},{default:(0,a.k6)(()=>[(0,a.bF)(r,{icon:"edit",style:{"margin-right":"4px"}}),(0,a.eW)((0,n.v_)(e.$t("sysUpload.editBtn")),1)]),_:1},8,["onClick"]),(0,a.bF)(h,{text:"",type:"danger",size:"small",onClick:e=>l.deleteChannel(s.value,o),disabled:i.fixed},{default:(0,a.k6)(()=>[(0,a.bF)(r,{icon:"trash-alt",style:{"margin-right":"4px"}}),(0,a.eW)((0,n.v_)(e.$t("sysUpload.deleteBtn")),1)]),_:1},8,["onClick","disabled"])])],42,Ju))),128))])):((0,a.uX)(),(0,a.CE)("div",Tp,[(0,a.bF)(r,{icon:"inbox",class:"empty-icon"}),(0,a.Lk)("span",null,(0,n.v_)(e.$t("sysUpload.noChannels",{type:s.label})),1)]))]))),128)),(0,a.bF)(T,{modelValue:o.showAddDialog,"onUpdate:modelValue":t[35]||(t[35]=e=>o.showAddDialog=e),title:e.$t("sysUpload.addDialogTitle"),class:"channel-dialog","destroy-on-close":"",onClosed:l.resetAddForm},{footer:(0,a.k6)(()=>[(0,a.bF)(h,{onClick:t[34]||(t[34]=e=>o.showAddDialog=!1)},{default:(0,a.k6)(()=>[(0,a.eW)((0,n.v_)(e.$t("sysUpload.cancel")),1)]),_:1}),"cfr2"!==o.newChannel.type?((0,a.uX)(),(0,a.Wv)(h,{key:0,type:"primary",onClick:l.confirmAddChannel},{default:(0,a.k6)(()=>[(0,a.eW)((0,n.v_)(e.$t("sysUpload.confirmAdd")),1)]),_:1},8,["onClick"])):(0,a.Q3)("",!0)]),default:(0,a.k6)(()=>[(0,a.bF)(F,{model:o.newChannel,"label-position":"top",ref:"addForm",rules:l.addRules},{default:(0,a.k6)(()=>[(0,a.bF)(v,{label:e.$t("sysUpload.channelTypeLabel"),prop:"type"},{default:(0,a.k6)(()=>[(0,a.bF)(b,{modelValue:o.newChannel.type,"onUpdate:modelValue":t[3]||(t[3]=e=>o.newChannel.type=e),placeholder:e.$t("sysUpload.channelTypePlaceholder"),style:{width:"100%"},onChange:l.onChannelTypeChange},{default:(0,a.k6)(()=>[((0,a.uX)(!0),(0,a.CE)(a.FK,null,(0,a.pI)(o.addableChannels,e=>((0,a.uX)(),(0,a.Wv)(f,{key:e.value,label:e.label,value:e.value},{default:(0,a.k6)(()=>[(0,a.Lk)("span",Ap,[(0,a.bF)(u,{type:e.value,class:"select-option-icon"},null,8,["type"]),(0,a.Lk)("span",null,(0,n.v_)(e.label),1)])]),_:2},1032,["label","value"]))),128))]),_:1},8,["modelValue","placeholder","onChange"])]),_:1},8,["label"]),"cfr2"===o.newChannel.type?((0,a.uX)(),(0,a.CE)("div",Mp,[(0,a.bF)(r,{icon:"info-circle",style:{"margin-right":"6px"}}),(0,a.Lk)("span",{innerHTML:e.$t("sysUpload.r2ConfigNote")},null,8,Pp)])):((0,a.uX)(),(0,a.CE)(a.FK,{key:1},[(0,a.bF)(v,{prop:"name"},{label:(0,a.k6)(()=>[(0,a.eW)((0,n.v_)(e.$t("sysUpload.channelNameLabel"))+" ",1),(0,a.bF)(d,{content:e.$t("sysUpload.channelNameImmutableTip"),placement:"top"},{default:(0,a.k6)(()=>[(0,a.bF)(r,{icon:"exclamation-triangle",class:"inline-warning-icon"})]),_:1},8,["content"])]),default:(0,a.k6)(()=>[(0,a.bF)(C,{modelValue:o.newChannel.name,"onUpdate:modelValue":t[4]||(t[4]=e=>o.newChannel.name=e),placeholder:e.$t("sysUpload.channelNamePlaceholder")},null,8,["modelValue","placeholder"])]),_:1}),"telegram"===o.newChannel.type?((0,a.uX)(),(0,a.CE)(a.FK,{key:0},[(0,a.bF)(v,{label:e.$t("sysUpload.botTokenLabel"),prop:"botToken"},{default:(0,a.k6)(()=>[(0,a.bF)(C,{modelValue:o.newChannel.botToken,"onUpdate:modelValue":t[5]||(t[5]=e=>o.newChannel.botToken=e),type:"password","show-password":"",placeholder:e.$t("sysUpload.botTokenPlaceholder")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),(0,a.bF)(v,{label:e.$t("sysUpload.chatIdLabel"),prop:"chatId"},{default:(0,a.k6)(()=>[(0,a.bF)(C,{modelValue:o.newChannel.chatId,"onUpdate:modelValue":t[6]||(t[6]=e=>o.newChannel.chatId=e),type:"password","show-password":"",placeholder:e.$t("sysUpload.chatIdPlaceholder")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),(0,a.bF)(v,{label:e.$t("sysUpload.proxyDomain")},{default:(0,a.k6)(()=>[(0,a.bF)(C,{modelValue:o.newChannel.proxyUrl,"onUpdate:modelValue":t[7]||(t[7]=e=>o.newChannel.proxyUrl=e),placeholder:e.$t("sysUpload.proxyDomainPlaceholder")},null,8,["modelValue","placeholder"])]),_:1},8,["label"])],64)):"s3"===o.newChannel.type?((0,a.uX)(),(0,a.CE)(a.FK,{key:1},[(0,a.bF)(v,{label:e.$t("sysUpload.endpointLabel"),prop:"endpoint"},{default:(0,a.k6)(()=>[(0,a.bF)(C,{modelValue:o.newChannel.endpoint,"onUpdate:modelValue":t[8]||(t[8]=e=>o.newChannel.endpoint=e),placeholder:e.$t("sysUpload.endpointPlaceholder")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),(0,a.bF)(v,null,{label:(0,a.k6)(()=>[(0,a.eW)((0,n.v_)(e.$t("sysUpload.cdnDomain"))+" ",1),(0,a.bF)(d,{content:e.$t("sysUpload.cdnDomainTip"),placement:"top"},{default:(0,a.k6)(()=>[(0,a.bF)(r,{icon:"question-circle",class:"inline-help-icon"})]),_:1},8,["content"])]),default:(0,a.k6)(()=>[(0,a.bF)(C,{modelValue:o.newChannel.cdnDomain,"onUpdate:modelValue":t[9]||(t[9]=e=>o.newChannel.cdnDomain=e),placeholder:e.$t("sysUpload.cdnDomainPlaceholder")},null,8,["modelValue","placeholder"])]),_:1}),(0,a.bF)(v,{label:e.$t("sysUpload.bucketName"),prop:"bucketName"},{default:(0,a.k6)(()=>[(0,a.bF)(C,{modelValue:o.newChannel.bucketName,"onUpdate:modelValue":t[10]||(t[10]=e=>o.newChannel.bucketName=e),placeholder:e.$t("sysUpload.bucketNamePlaceholder")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),(0,a.bF)(v,{label:e.$t("sysUpload.bucketRegion"),prop:"region"},{default:(0,a.k6)(()=>[(0,a.bF)(C,{modelValue:o.newChannel.region,"onUpdate:modelValue":t[11]||(t[11]=e=>o.newChannel.region=e),placeholder:e.$t("sysUpload.bucketRegionPlaceholder")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),(0,a.bF)(v,{label:e.$t("sysUpload.accessKeyId"),prop:"accessKeyId"},{default:(0,a.k6)(()=>[(0,a.bF)(C,{modelValue:o.newChannel.accessKeyId,"onUpdate:modelValue":t[12]||(t[12]=e=>o.newChannel.accessKeyId=e),type:"password","show-password":"",placeholder:e.$t("sysUpload.accessKeyIdPlaceholder")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),(0,a.bF)(v,{label:e.$t("sysUpload.secretAccessKey"),prop:"secretAccessKey"},{default:(0,a.k6)(()=>[(0,a.bF)(C,{modelValue:o.newChannel.secretAccessKey,"onUpdate:modelValue":t[13]||(t[13]=e=>o.newChannel.secretAccessKey=e),type:"password","show-password":"",placeholder:e.$t("sysUpload.secretAccessKeyPlaceholder")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),(0,a.bF)(v,null,{label:(0,a.k6)(()=>[(0,a.eW)((0,n.v_)(e.$t("sysUpload.pathStyle"))+" ",1),(0,a.bF)(d,{content:e.$t("sysUpload.pathStyleTip"),placement:"top"},{default:(0,a.k6)(()=>[(0,a.bF)(r,{icon:"question-circle",class:"inline-help-icon"})]),_:1},8,["content"])]),default:(0,a.k6)(()=>[(0,a.bF)(g,{modelValue:o.newChannel.pathStyle,"onUpdate:modelValue":t[14]||(t[14]=e=>o.newChannel.pathStyle=e)},null,8,["modelValue"])]),_:1}),(0,a.bF)(v,{label:e.$t("sysUpload.quotaLimit")},{default:(0,a.k6)(()=>[(0,a.bF)(g,{modelValue:o.newChannel.quota.enabled,"onUpdate:modelValue":t[15]||(t[15]=e=>o.newChannel.quota.enabled=e)},null,8,["modelValue"])]),_:1},8,["label"]),o.newChannel.quota?.enabled?((0,a.uX)(),(0,a.CE)(a.FK,{key:0},[(0,a.bF)(v,{label:e.$t("sysUpload.quotaLimitGB")},{default:(0,a.k6)(()=>[(0,a.bF)(S,{modelValue:o.newChannel.quota.limitGB,"onUpdate:modelValue":t[16]||(t[16]=e=>o.newChannel.quota.limitGB=e),min:.1,step:1,precision:1},null,8,["modelValue"])]),_:1},8,["label"]),(0,a.bF)(v,{label:e.$t("sysUpload.quotaThreshold")},{default:(0,a.k6)(()=>[(0,a.bF)(S,{modelValue:o.newChannel.quota.threshold,"onUpdate:modelValue":t[17]||(t[17]=e=>o.newChannel.quota.threshold=e),min:50,max:100,step:5},null,8,["modelValue"])]),_:1},8,["label"])],64)):(0,a.Q3)("",!0)],64)):"discord"===o.newChannel.type?((0,a.uX)(),(0,a.CE)(a.FK,{key:2},[(0,a.bF)(v,{label:e.$t("sysUpload.botTokenLabel"),prop:"botToken"},{default:(0,a.k6)(()=>[(0,a.bF)(C,{modelValue:o.newChannel.botToken,"onUpdate:modelValue":t[18]||(t[18]=e=>o.newChannel.botToken=e),type:"password","show-password":"",placeholder:e.$t("sysUpload.botTokenPlaceholder")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),(0,a.bF)(v,{label:e.$t("sysUpload.channelIdLabel"),prop:"channelId"},{default:(0,a.k6)(()=>[(0,a.bF)(C,{modelValue:o.newChannel.channelId,"onUpdate:modelValue":t[19]||(t[19]=e=>o.newChannel.channelId=e),type:"password","show-password":"",placeholder:e.$t("sysUpload.channelIdPlaceholder")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),(0,a.bF)(v,{label:e.$t("sysUpload.proxyDomain")},{default:(0,a.k6)(()=>[(0,a.bF)(C,{modelValue:o.newChannel.proxyUrl,"onUpdate:modelValue":t[20]||(t[20]=e=>o.newChannel.proxyUrl=e),placeholder:e.$t("sysUpload.proxyDomainPlaceholder")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),(0,a.bF)(v,null,{label:(0,a.k6)(()=>[(0,a.eW)((0,n.v_)(e.$t("sysUpload.nitroMember"))+" ",1),(0,a.bF)(d,{content:e.$t("sysUpload.nitroTip"),placement:"top"},{default:(0,a.k6)(()=>[(0,a.bF)(r,{icon:"question-circle",class:"inline-help-icon"})]),_:1},8,["content"])]),default:(0,a.k6)(()=>[(0,a.bF)(g,{modelValue:o.newChannel.isNitro,"onUpdate:modelValue":t[21]||(t[21]=e=>o.newChannel.isNitro=e)},null,8,["modelValue"])]),_:1}),(0,a.Lk)("div",$p,[(0,a.bF)(r,{icon:"exclamation-triangle",style:{"margin-right":"6px"}}),(0,a.eW)(" "+(0,n.v_)(e.$t("sysUpload.discordWarning")),1)])],64)):"huggingface"===o.newChannel.type?((0,a.uX)(),(0,a.CE)(a.FK,{key:3},[(0,a.bF)(v,{label:e.$t("sysUpload.repoName"),prop:"repo"},{default:(0,a.k6)(()=>[(0,a.bF)(C,{modelValue:o.newChannel.repo,"onUpdate:modelValue":t[22]||(t[22]=e=>o.newChannel.repo=e),placeholder:e.$t("sysUpload.repoNamePlaceholder")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),(0,a.bF)(v,{label:e.$t("sysUpload.accessToken"),prop:"token"},{default:(0,a.k6)(()=>[(0,a.bF)(C,{modelValue:o.newChannel.token,"onUpdate:modelValue":t[23]||(t[23]=e=>o.newChannel.token=e),type:"password","show-password":"",placeholder:e.$t("sysUpload.accessTokenPlaceholder")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),(0,a.bF)(v,null,{label:(0,a.k6)(()=>[(0,a.eW)((0,n.v_)(e.$t("sysUpload.privateRepo"))+" ",1),(0,a.bF)(d,{content:e.$t("sysUpload.privateRepoTip"),placement:"top"},{default:(0,a.k6)(()=>[(0,a.bF)(r,{icon:"question-circle",class:"inline-help-icon"})]),_:1},8,["content"])]),default:(0,a.k6)(()=>[(0,a.bF)(g,{modelValue:o.newChannel.isPrivate,"onUpdate:modelValue":t[24]||(t[24]=e=>o.newChannel.isPrivate=e)},null,8,["modelValue"])]),_:1})],64)):"webdav"===o.newChannel.type?((0,a.uX)(),(0,a.CE)(a.FK,{key:4},[(0,a.bF)(v,{label:e.$t("sysUpload.webdavBaseUrl"),prop:"baseUrl"},{default:(0,a.k6)(()=>[(0,a.bF)(C,{modelValue:o.newChannel.baseUrl,"onUpdate:modelValue":t[25]||(t[25]=e=>o.newChannel.baseUrl=e),placeholder:e.$t("sysUpload.webdavBaseUrlPlaceholder")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),(0,a.bF)(v,{label:e.$t("sysUpload.webdavUsername")},{default:(0,a.k6)(()=>[(0,a.bF)(C,{modelValue:o.newChannel.username,"onUpdate:modelValue":t[26]||(t[26]=e=>o.newChannel.username=e),placeholder:e.$t("sysUpload.webdavUsernamePlaceholder")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),(0,a.bF)(v,{label:e.$t("sysUpload.webdavPassword")},{default:(0,a.k6)(()=>[(0,a.bF)(C,{modelValue:o.newChannel.password,"onUpdate:modelValue":t[27]||(t[27]=e=>o.newChannel.password=e),type:"password","show-password":"",placeholder:e.$t("sysUpload.webdavPasswordPlaceholder")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),(0,a.bF)(v,null,{label:(0,a.k6)(()=>[(0,a.eW)((0,n.v_)(e.$t("sysUpload.publicUrl"))+" ",1),(0,a.bF)(d,{content:e.$t("sysUpload.webdavPublicUrlTip"),placement:"top"},{default:(0,a.k6)(()=>[(0,a.bF)(r,{icon:"question-circle",class:"inline-help-icon"})]),_:1},8,["content"])]),default:(0,a.k6)(()=>[(0,a.bF)(C,{modelValue:o.newChannel.publicUrl,"onUpdate:modelValue":t[28]||(t[28]=e=>o.newChannel.publicUrl=e),placeholder:e.$t("sysUpload.webdavPublicUrlPlaceholder")},null,8,["modelValue","placeholder"])]),_:1}),(0,a.bF)(v,{label:e.$t("sysUpload.webdavHeaders")},{default:(0,a.k6)(()=>[(0,a.bF)(C,{modelValue:o.newChannel.headersText,"onUpdate:modelValue":t[29]||(t[29]=e=>o.newChannel.headersText=e),type:"textarea",autosize:{minRows:2},placeholder:e.$t("sysUpload.webdavHeadersPlaceholder")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),(0,a.bF)(v,null,{label:(0,a.k6)(()=>[(0,a.eW)((0,n.v_)(e.$t("sysUpload.webdavCreateDirectory"))+" ",1),(0,a.bF)(d,{content:e.$t("sysUpload.webdavCreateDirectoryTip"),placement:"top"},{default:(0,a.k6)(()=>[(0,a.bF)(r,{icon:"question-circle",class:"inline-help-icon"})]),_:1},8,["content"])]),default:(0,a.k6)(()=>[(0,a.bF)(g,{modelValue:o.newChannel.createDirectory,"onUpdate:modelValue":t[30]||(t[30]=e=>o.newChannel.createDirectory=e)},null,8,["modelValue"])]),_:1}),(0,a.bF)(v,{label:e.$t("sysUpload.quotaLimit")},{default:(0,a.k6)(()=>[(0,a.bF)(g,{modelValue:o.newChannel.quota.enabled,"onUpdate:modelValue":t[31]||(t[31]=e=>o.newChannel.quota.enabled=e)},null,8,["modelValue"])]),_:1},8,["label"]),o.newChannel.quota?.enabled?((0,a.uX)(),(0,a.CE)(a.FK,{key:0},[(0,a.bF)(v,{label:e.$t("sysUpload.quotaLimitGB")},{default:(0,a.k6)(()=>[(0,a.bF)(S,{modelValue:o.newChannel.quota.limitGB,"onUpdate:modelValue":t[32]||(t[32]=e=>o.newChannel.quota.limitGB=e),min:.1,step:1,precision:1},null,8,["modelValue"])]),_:1},8,["label"]),(0,a.bF)(v,{label:e.$t("sysUpload.quotaThreshold")},{default:(0,a.k6)(()=>[(0,a.bF)(S,{modelValue:o.newChannel.quota.threshold,"onUpdate:modelValue":t[33]||(t[33]=e=>o.newChannel.quota.threshold=e),min:50,max:100,step:5},null,8,["modelValue"])]),_:1},8,["label"])],64)):(0,a.Q3)("",!0)],64)):(0,a.Q3)("",!0)],64))]),_:1},8,["model","rules"])]),_:1},8,["modelValue","title","onClosed"]),(0,a.bF)(T,{modelValue:o.showDetailDialog,"onUpdate:modelValue":t[37]||(t[37]=e=>o.showDetailDialog=e),title:e.$t("sysUpload.detailDialogTitle",{name:o.currentChannel?.name||""}),class:"channel-dialog",onClosed:l.resetDetailData},{footer:(0,a.k6)(()=>[(0,a.bF)(h,{onClick:t[36]||(t[36]=e=>o.showDetailDialog=!1)},{default:(0,a.k6)(()=>[(0,a.eW)((0,n.v_)(e.$t("sysUpload.closeBtn")),1)]),_:1}),(0,a.bF)(h,{type:"primary",onClick:l.openEditFromDetail},{default:(0,a.k6)(()=>[(0,a.eW)((0,n.v_)(e.$t("sysUpload.editBtn")),1)]),_:1},8,["onClick"])]),default:(0,a.k6)(()=>[(0,a.bF)(M,{column:1,border:""},{default:(0,a.k6)(()=>[(0,a.bF)(A,{label:e.$t("sysUpload.channelNameDetail")},{default:(0,a.k6)(()=>[(0,a.eW)((0,n.v_)(o.currentChannel?.name),1)]),_:1},8,["label"]),(0,a.bF)(A,{label:e.$t("sysUpload.channelTypeDetail")},{default:(0,a.k6)(()=>[(0,a.eW)((0,n.v_)(l.getChannelTypeLabel(o.currentChannelType)),1)]),_:1},8,["label"]),(0,a.bF)(A,{label:e.$t("sysUpload.statusLabel")},{default:(0,a.k6)(()=>[(0,a.bF)(p,{type:o.currentChannel?.enabled?"success":"info"},{default:(0,a.k6)(()=>[(0,a.eW)((0,n.v_)(o.currentChannel?.enabled?e.$t("sysUpload.enabled"):e.$t("sysUpload.disabled")),1)]),_:1},8,["type"])]),_:1},8,["label"]),o.currentChannel?.fixed?((0,a.uX)(),(0,a.Wv)(A,{key:0,label:e.$t("sysUpload.configSource")},{default:(0,a.k6)(()=>[(0,a.bF)(p,{type:"warning"},{default:(0,a.k6)(()=>[(0,a.eW)((0,n.v_)(e.$t("sysUpload.envVariable")),1)]),_:1})]),_:1},8,["label"])):(0,a.Q3)("",!0),"telegram"===o.currentChannelType?((0,a.uX)(),(0,a.CE)(a.FK,{key:1},[(0,a.bF)(A,{label:e.$t("sysUpload.botTokenLabel")},{default:(0,a.k6)(()=>[(0,a.eW)((0,n.v_)(l.maskText(o.currentChannel?.botToken,10)),1)]),_:1},8,["label"]),(0,a.bF)(A,{label:e.$t("sysUpload.chatIdLabel")},{default:(0,a.k6)(()=>[(0,a.eW)((0,n.v_)(l.maskText(o.currentChannel?.chatId,6)),1)]),_:1},8,["label"]),(0,a.bF)(A,{label:e.$t("sysUpload.proxyDomain")},{default:(0,a.k6)(()=>[(0,a.eW)((0,n.v_)(o.currentChannel?.proxyUrl||e.$t("sysUpload.notSet")),1)]),_:1},8,["label"])],64)):"cfr2"===o.currentChannelType?((0,a.uX)(),(0,a.Wv)(A,{key:2,label:e.$t("sysUpload.publicUrl")},{default:(0,a.k6)(()=>[(0,a.bF)(C,{"model-value":o.currentChannel?.publicUrl||e.$t("sysUpload.notSet"),readonly:""},null,8,["model-value"])]),_:1},8,["label"])):"s3"===o.currentChannelType?((0,a.uX)(),(0,a.CE)(a.FK,{key:3},[(0,a.bF)(A,{label:e.$t("sysUpload.endpointLabel")},{default:(0,a.k6)(()=>[(0,a.bF)(C,{"model-value":o.currentChannel?.endpoint,readonly:""},null,8,["model-value"])]),_:1},8,["label"]),(0,a.bF)(A,{label:e.$t("sysUpload.cdnDomain")},{default:(0,a.k6)(()=>[(0,a.bF)(C,{"model-value":o.currentChannel?.cdnDomain||e.$t("sysUpload.notSet"),readonly:""},null,8,["model-value"])]),_:1},8,["label"]),(0,a.bF)(A,{label:e.$t("sysUpload.bucketName")},{default:(0,a.k6)(()=>[(0,a.eW)((0,n.v_)(o.currentChannel?.bucketName),1)]),_:1},8,["label"]),(0,a.bF)(A,{label:e.$t("sysUpload.bucketRegion")},{default:(0,a.k6)(()=>[(0,a.eW)((0,n.v_)(o.currentChannel?.region),1)]),_:1},8,["label"]),(0,a.bF)(A,{label:e.$t("sysUpload.pathStyle")},{default:(0,a.k6)(()=>[(0,a.eW)((0,n.v_)(o.currentChannel?.pathStyle?e.$t("sysUpload.isPathStyle"):e.$t("sysUpload.isNotPathStyle")),1)]),_:1},8,["label"])],64)):"discord"===o.currentChannelType?((0,a.uX)(),(0,a.CE)(a.FK,{key:4},[(0,a.bF)(A,{label:e.$t("sysUpload.botTokenLabel")},{default:(0,a.k6)(()=>[(0,a.eW)((0,n.v_)(l.maskText(o.currentChannel?.botToken,10)),1)]),_:1},8,["label"]),(0,a.bF)(A,{label:e.$t("sysUpload.channelIdLabel")},{default:(0,a.k6)(()=>[(0,a.eW)((0,n.v_)(l.maskText(o.currentChannel?.channelId,6)),1)]),_:1},8,["label"]),(0,a.bF)(A,{label:e.$t("sysUpload.proxyDomain")},{default:(0,a.k6)(()=>[(0,a.eW)((0,n.v_)(o.currentChannel?.proxyUrl||e.$t("sysUpload.notSet")),1)]),_:1},8,["label"]),(0,a.bF)(A,{label:e.$t("sysUpload.nitroMember")},{default:(0,a.k6)(()=>[(0,a.eW)((0,n.v_)(o.currentChannel?.isNitro?e.$t("sysUpload.isPathStyle"):e.$t("sysUpload.isNotPathStyle")),1)]),_:1},8,["label"])],64)):"huggingface"===o.currentChannelType?((0,a.uX)(),(0,a.CE)(a.FK,{key:5},[(0,a.bF)(A,{label:e.$t("sysUpload.repoName")},{default:(0,a.k6)(()=>[(0,a.eW)((0,n.v_)(o.currentChannel?.repo),1)]),_:1},8,["label"]),(0,a.bF)(A,{label:e.$t("sysUpload.privateRepo")},{default:(0,a.k6)(()=>[(0,a.eW)((0,n.v_)(o.currentChannel?.isPrivate?e.$t("sysUpload.isPathStyle"):e.$t("sysUpload.isNotPathStyle")),1)]),_:1},8,["label"])],64)):"webdav"===o.currentChannelType?((0,a.uX)(),(0,a.CE)(a.FK,{key:6},[(0,a.bF)(A,{label:e.$t("sysUpload.webdavBaseUrl")},{default:(0,a.k6)(()=>[(0,a.bF)(C,{"model-value":o.currentChannel?.baseUrl,readonly:""},null,8,["model-value"])]),_:1},8,["label"]),(0,a.bF)(A,{label:e.$t("sysUpload.publicUrl")},{default:(0,a.k6)(()=>[(0,a.bF)(C,{"model-value":o.currentChannel?.publicUrl||e.$t("sysUpload.notSet"),readonly:""},null,8,["model-value"])]),_:1},8,["label"]),(0,a.bF)(A,{label:e.$t("sysUpload.webdavUsername")},{default:(0,a.k6)(()=>[(0,a.eW)((0,n.v_)(o.currentChannel?.username||e.$t("sysUpload.notSet")),1)]),_:1},8,["label"]),(0,a.bF)(A,{label:e.$t("sysUpload.webdavHeaders")},{default:(0,a.k6)(()=>[(0,a.bF)(C,{"model-value":l.formatHeaders(o.currentChannel?.headers),type:"textarea",autosize:{minRows:2},readonly:""},null,8,["model-value"])]),_:1},8,["label"]),(0,a.bF)(A,{label:e.$t("sysUpload.webdavCreateDirectory")},{default:(0,a.k6)(()=>[(0,a.eW)((0,n.v_)(!1!==o.currentChannel?.createDirectory?e.$t("sysUpload.isPathStyle"):e.$t("sysUpload.isNotPathStyle")),1)]),_:1},8,["label"])],64)):(0,a.Q3)("",!0),o.currentChannel?.quota?.enabled?((0,a.uX)(),(0,a.CE)(a.FK,{key:7},[(0,a.bF)(A,{label:e.$t("sysUpload.quotaLimit")},{default:(0,a.k6)(()=>[(0,a.eW)((0,n.v_)(o.currentChannel?.quota?.limitGB)+" GB",1)]),_:1},8,["label"]),(0,a.bF)(A,{label:e.$t("sysUpload.quotaThreshold")},{default:(0,a.k6)(()=>[(0,a.eW)((0,n.v_)(o.currentChannel?.quota?.threshold)+"%",1)]),_:1},8,["label"]),(0,a.bF)(A,null,{label:(0,a.k6)(()=>[(0,a.Lk)("span",Dp,[(0,a.eW)((0,n.v_)(e.$t("sysUpload.currentUsage"))+" ",1),(0,a.bF)(h,{link:"",type:"primary",onClick:l.refreshQuota,class:"refresh-btn"},{default:(0,a.k6)(()=>[(0,a.bF)(r,{icon:"sync-alt",class:(0,n.C4)({"fa-spin":o.quotaLoading})},null,8,["class"])]),_:1},8,["onClick"])])]),default:(0,a.k6)(()=>[(0,a.Lk)("div",Vp,[(0,a.bF)(m,{percentage:l.getQuotaPercentage(o.currentChannel),status:l.getQuotaStatus(o.currentChannel),"stroke-width":16,"text-inside":!0,format:()=>l.getQuotaText(o.currentChannel)},null,8,["percentage","status","format"]),(0,a.Lk)("div",{class:(0,n.C4)(["quota-info",{"quota-warning":l.isQuotaExceeded(o.currentChannel)}])},(0,n.v_)(l.getQuotaStatusText(o.currentChannel)),3)])]),_:1})],64)):(0,a.Q3)("",!0)]),_:1})]),_:1},8,["modelValue","title","onClosed"]),(0,a.bF)(T,{modelValue:o.showEditDialog,"onUpdate:modelValue":t[77]||(t[77]=e=>o.showEditDialog=e),title:e.$t("sysUpload.editDialogTitle",{name:o.editChannel?.name||""}),class:"channel-dialog","destroy-on-close":"",onClosed:l.resetEditData},{footer:(0,a.k6)(()=>[(0,a.bF)(h,{onClick:t[76]||(t[76]=e=>o.showEditDialog=!1)},{default:(0,a.k6)(()=>[(0,a.eW)((0,n.v_)(e.$t("sysUpload.cancel")),1)]),_:1}),(0,a.bF)(h,{type:"primary",onClick:l.confirmEditChannel},{default:(0,a.k6)(()=>[(0,a.eW)((0,n.v_)(e.$t("sysUpload.saveChanges")),1)]),_:1},8,["onClick"])]),default:(0,a.k6)(()=>[(0,a.bF)(F,{model:o.editChannel,"label-position":"top",ref:"editForm",rules:l.editRules},{default:(0,a.k6)(()=>[(0,a.bF)(v,{prop:"name"},{label:(0,a.k6)(()=>[(0,a.eW)((0,n.v_)(e.$t("sysUpload.channelNameLabel"))+" ",1),(0,a.bF)(d,{content:e.$t("sysUpload.channelNameEditDisabledTip"),placement:"top"},{default:(0,a.k6)(()=>[(0,a.bF)(r,{icon:"exclamation-triangle",class:"inline-warning-icon"})]),_:1},8,["content"])]),default:(0,a.k6)(()=>[(0,a.bF)(C,{modelValue:o.editChannel.name,"onUpdate:modelValue":t[38]||(t[38]=e=>o.editChannel.name=e),disabled:""},null,8,["modelValue"])]),_:1}),(0,a.bF)(v,{label:e.$t("sysUpload.enableChannel")},{default:(0,a.k6)(()=>[(0,a.bF)(g,{modelValue:o.editChannel.enabled,"onUpdate:modelValue":t[39]||(t[39]=e=>o.editChannel.enabled=e)},null,8,["modelValue"])]),_:1},8,["label"]),"telegram"===o.currentChannelType?((0,a.uX)(),(0,a.CE)(a.FK,{key:0},[(0,a.bF)(v,{label:e.$t("sysUpload.botTokenLabel"),prop:"botToken"},{default:(0,a.k6)(()=>[(0,a.bF)(C,{modelValue:o.editChannel.botToken,"onUpdate:modelValue":t[40]||(t[40]=e=>o.editChannel.botToken=e),disabled:o.editChannel.fixed,type:"password","show-password":""},null,8,["modelValue","disabled"])]),_:1},8,["label"]),(0,a.bF)(v,{label:e.$t("sysUpload.chatIdLabel"),prop:"chatId"},{default:(0,a.k6)(()=>[(0,a.bF)(C,{modelValue:o.editChannel.chatId,"onUpdate:modelValue":t[41]||(t[41]=e=>o.editChannel.chatId=e),disabled:o.editChannel.fixed,type:"password","show-password":""},null,8,["modelValue","disabled"])]),_:1},8,["label"]),(0,a.bF)(v,{label:e.$t("sysUpload.proxyDomain")},{default:(0,a.k6)(()=>[(0,a.bF)(C,{modelValue:o.editChannel.proxyUrl,"onUpdate:modelValue":t[42]||(t[42]=e=>o.editChannel.proxyUrl=e),placeholder:e.$t("sysUpload.proxyDomainPlaceholder")},null,8,["modelValue","placeholder"])]),_:1},8,["label"])],64)):"cfr2"===o.currentChannelType?((0,a.uX)(),(0,a.CE)(a.FK,{key:1},[(0,a.bF)(v,{label:e.$t("sysUpload.publicUrl")},{default:(0,a.k6)(()=>[(0,a.bF)(C,{modelValue:o.editChannel.publicUrl,"onUpdate:modelValue":t[43]||(t[43]=e=>o.editChannel.publicUrl=e)},null,8,["modelValue"])]),_:1},8,["label"]),(0,a.bF)(v,{label:e.$t("sysUpload.quotaLimit")},{default:(0,a.k6)(()=>[(0,a.bF)(g,{modelValue:o.editChannel.quota.enabled,"onUpdate:modelValue":t[44]||(t[44]=e=>o.editChannel.quota.enabled=e),onChange:t[45]||(t[45]=e=>l.onQuotaEnabledChange(e,o.editChannel))},null,8,["modelValue"])]),_:1},8,["label"]),o.editChannel.quota?.enabled?((0,a.uX)(),(0,a.CE)(a.FK,{key:0},[(0,a.bF)(v,{label:e.$t("sysUpload.quotaLimitGB")},{default:(0,a.k6)(()=>[(0,a.bF)(S,{modelValue:o.editChannel.quota.limitGB,"onUpdate:modelValue":t[46]||(t[46]=e=>o.editChannel.quota.limitGB=e),min:.1,step:1,precision:1},null,8,["modelValue"])]),_:1},8,["label"]),(0,a.bF)(v,{label:e.$t("sysUpload.quotaThreshold")},{default:(0,a.k6)(()=>[(0,a.bF)(S,{modelValue:o.editChannel.quota.threshold,"onUpdate:modelValue":t[47]||(t[47]=e=>o.editChannel.quota.threshold=e),min:50,max:100,step:5},null,8,["modelValue"])]),_:1},8,["label"])],64)):(0,a.Q3)("",!0)],64)):"s3"===o.currentChannelType?((0,a.uX)(),(0,a.CE)(a.FK,{key:2},[(0,a.bF)(v,{label:e.$t("sysUpload.endpointLabel"),prop:"endpoint"},{default:(0,a.k6)(()=>[(0,a.bF)(C,{modelValue:o.editChannel.endpoint,"onUpdate:modelValue":t[48]||(t[48]=e=>o.editChannel.endpoint=e),disabled:o.editChannel.fixed},null,8,["modelValue","disabled"])]),_:1},8,["label"]),(0,a.bF)(v,null,{label:(0,a.k6)(()=>[(0,a.eW)((0,n.v_)(e.$t("sysUpload.cdnDomain"))+" ",1),(0,a.bF)(d,{content:e.$t("sysUpload.cdnDomainTip"),placement:"top"},{default:(0,a.k6)(()=>[(0,a.bF)(r,{icon:"question-circle",class:"inline-help-icon"})]),_:1},8,["content"])]),default:(0,a.k6)(()=>[(0,a.bF)(C,{modelValue:o.editChannel.cdnDomain,"onUpdate:modelValue":t[49]||(t[49]=e=>o.editChannel.cdnDomain=e),placeholder:e.$t("sysUpload.cdnDomainPlaceholder")},null,8,["modelValue","placeholder"])]),_:1}),(0,a.bF)(v,{label:e.$t("sysUpload.bucketName"),prop:"bucketName"},{default:(0,a.k6)(()=>[(0,a.bF)(C,{modelValue:o.editChannel.bucketName,"onUpdate:modelValue":t[50]||(t[50]=e=>o.editChannel.bucketName=e),disabled:o.editChannel.fixed},null,8,["modelValue","disabled"])]),_:1},8,["label"]),(0,a.bF)(v,{label:e.$t("sysUpload.bucketRegion"),prop:"region"},{default:(0,a.k6)(()=>[(0,a.bF)(C,{modelValue:o.editChannel.region,"onUpdate:modelValue":t[51]||(t[51]=e=>o.editChannel.region=e),disabled:o.editChannel.fixed},null,8,["modelValue","disabled"])]),_:1},8,["label"]),(0,a.bF)(v,{label:e.$t("sysUpload.accessKeyId"),prop:"accessKeyId"},{default:(0,a.k6)(()=>[(0,a.bF)(C,{modelValue:o.editChannel.accessKeyId,"onUpdate:modelValue":t[52]||(t[52]=e=>o.editChannel.accessKeyId=e),disabled:o.editChannel.fixed,type:"password","show-password":""},null,8,["modelValue","disabled"])]),_:1},8,["label"]),(0,a.bF)(v,{label:e.$t("sysUpload.secretAccessKey"),prop:"secretAccessKey"},{default:(0,a.k6)(()=>[(0,a.bF)(C,{modelValue:o.editChannel.secretAccessKey,"onUpdate:modelValue":t[53]||(t[53]=e=>o.editChannel.secretAccessKey=e),disabled:o.editChannel.fixed,type:"password","show-password":""},null,8,["modelValue","disabled"])]),_:1},8,["label"]),(0,a.bF)(v,null,{label:(0,a.k6)(()=>[(0,a.eW)((0,n.v_)(e.$t("sysUpload.pathStyle"))+" ",1),(0,a.bF)(d,{content:e.$t("sysUpload.pathStyleTip"),placement:"top"},{default:(0,a.k6)(()=>[(0,a.bF)(r,{icon:"question-circle",class:"inline-help-icon"})]),_:1},8,["content"])]),default:(0,a.k6)(()=>[(0,a.bF)(g,{modelValue:o.editChannel.pathStyle,"onUpdate:modelValue":t[54]||(t[54]=e=>o.editChannel.pathStyle=e),disabled:o.editChannel.fixed},null,8,["modelValue","disabled"])]),_:1}),(0,a.bF)(v,{label:e.$t("sysUpload.quotaLimit")},{default:(0,a.k6)(()=>[(0,a.bF)(g,{modelValue:o.editChannel.quota.enabled,"onUpdate:modelValue":t[55]||(t[55]=e=>o.editChannel.quota.enabled=e),onChange:t[56]||(t[56]=e=>l.onQuotaEnabledChange(e,o.editChannel))},null,8,["modelValue"])]),_:1},8,["label"]),o.editChannel.quota?.enabled?((0,a.uX)(),(0,a.CE)(a.FK,{key:0},[(0,a.bF)(v,{label:e.$t("sysUpload.quotaLimitGB")},{default:(0,a.k6)(()=>[(0,a.bF)(S,{modelValue:o.editChannel.quota.limitGB,"onUpdate:modelValue":t[57]||(t[57]=e=>o.editChannel.quota.limitGB=e),min:.1,step:1,precision:1},null,8,["modelValue"])]),_:1},8,["label"]),(0,a.bF)(v,{label:e.$t("sysUpload.quotaThreshold")},{default:(0,a.k6)(()=>[(0,a.bF)(S,{modelValue:o.editChannel.quota.threshold,"onUpdate:modelValue":t[58]||(t[58]=e=>o.editChannel.quota.threshold=e),min:50,max:100,step:5},null,8,["modelValue"])]),_:1},8,["label"])],64)):(0,a.Q3)("",!0)],64)):"discord"===o.currentChannelType?((0,a.uX)(),(0,a.CE)(a.FK,{key:3},[(0,a.bF)(v,{label:e.$t("sysUpload.botTokenLabel"),prop:"botToken"},{default:(0,a.k6)(()=>[(0,a.bF)(C,{modelValue:o.editChannel.botToken,"onUpdate:modelValue":t[59]||(t[59]=e=>o.editChannel.botToken=e),disabled:o.editChannel.fixed,type:"password","show-password":""},null,8,["modelValue","disabled"])]),_:1},8,["label"]),(0,a.bF)(v,{label:e.$t("sysUpload.channelIdLabel"),prop:"channelId"},{default:(0,a.k6)(()=>[(0,a.bF)(C,{modelValue:o.editChannel.channelId,"onUpdate:modelValue":t[60]||(t[60]=e=>o.editChannel.channelId=e),disabled:o.editChannel.fixed,type:"password","show-password":""},null,8,["modelValue","disabled"])]),_:1},8,["label"]),(0,a.bF)(v,{label:e.$t("sysUpload.proxyDomain")},{default:(0,a.k6)(()=>[(0,a.bF)(C,{modelValue:o.editChannel.proxyUrl,"onUpdate:modelValue":t[61]||(t[61]=e=>o.editChannel.proxyUrl=e),placeholder:e.$t("sysUpload.proxyDomainPlaceholder")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),(0,a.bF)(v,null,{label:(0,a.k6)(()=>[(0,a.eW)((0,n.v_)(e.$t("sysUpload.nitroMember"))+" ",1),(0,a.bF)(d,{content:e.$t("sysUpload.nitroTip"),placement:"top"},{default:(0,a.k6)(()=>[(0,a.bF)(r,{icon:"question-circle",class:"inline-help-icon"})]),_:1},8,["content"])]),default:(0,a.k6)(()=>[(0,a.bF)(g,{modelValue:o.editChannel.isNitro,"onUpdate:modelValue":t[62]||(t[62]=e=>o.editChannel.isNitro=e)},null,8,["modelValue"])]),_:1})],64)):"huggingface"===o.currentChannelType?((0,a.uX)(),(0,a.CE)(a.FK,{key:4},[(0,a.bF)(v,{label:e.$t("sysUpload.repoName"),prop:"repo"},{default:(0,a.k6)(()=>[(0,a.bF)(C,{modelValue:o.editChannel.repo,"onUpdate:modelValue":t[63]||(t[63]=e=>o.editChannel.repo=e),disabled:o.editChannel.fixed},null,8,["modelValue","disabled"])]),_:1},8,["label"]),(0,a.bF)(v,{label:e.$t("sysUpload.accessToken"),prop:"token"},{default:(0,a.k6)(()=>[(0,a.bF)(C,{modelValue:o.editChannel.token,"onUpdate:modelValue":t[64]||(t[64]=e=>o.editChannel.token=e),disabled:o.editChannel.fixed,type:"password","show-password":""},null,8,["modelValue","disabled"])]),_:1},8,["label"]),(0,a.bF)(v,null,{label:(0,a.k6)(()=>[(0,a.eW)((0,n.v_)(e.$t("sysUpload.privateRepo"))+" ",1),(0,a.bF)(d,{content:e.$t("sysUpload.privateRepoTip"),placement:"top"},{default:(0,a.k6)(()=>[(0,a.bF)(r,{icon:"question-circle",class:"inline-help-icon"})]),_:1},8,["content"])]),default:(0,a.k6)(()=>[(0,a.bF)(g,{modelValue:o.editChannel.isPrivate,"onUpdate:modelValue":t[65]||(t[65]=e=>o.editChannel.isPrivate=e)},null,8,["modelValue"])]),_:1})],64)):"webdav"===o.currentChannelType?((0,a.uX)(),(0,a.CE)(a.FK,{key:5},[(0,a.bF)(v,{label:e.$t("sysUpload.webdavBaseUrl"),prop:"baseUrl"},{default:(0,a.k6)(()=>[(0,a.bF)(C,{modelValue:o.editChannel.baseUrl,"onUpdate:modelValue":t[66]||(t[66]=e=>o.editChannel.baseUrl=e),disabled:o.editChannel.fixed},null,8,["modelValue","disabled"])]),_:1},8,["label"]),(0,a.bF)(v,{label:e.$t("sysUpload.webdavUsername")},{default:(0,a.k6)(()=>[(0,a.bF)(C,{modelValue:o.editChannel.username,"onUpdate:modelValue":t[67]||(t[67]=e=>o.editChannel.username=e),disabled:o.editChannel.fixed},null,8,["modelValue","disabled"])]),_:1},8,["label"]),(0,a.bF)(v,{label:e.$t("sysUpload.webdavPassword")},{default:(0,a.k6)(()=>[(0,a.bF)(C,{modelValue:o.editChannel.password,"onUpdate:modelValue":t[68]||(t[68]=e=>o.editChannel.password=e),disabled:o.editChannel.fixed,type:"password","show-password":""},null,8,["modelValue","disabled"])]),_:1},8,["label"]),(0,a.bF)(v,null,{label:(0,a.k6)(()=>[(0,a.eW)((0,n.v_)(e.$t("sysUpload.publicUrl"))+" ",1),(0,a.bF)(d,{content:e.$t("sysUpload.webdavPublicUrlTip"),placement:"top"},{default:(0,a.k6)(()=>[(0,a.bF)(r,{icon:"question-circle",class:"inline-help-icon"})]),_:1},8,["content"])]),default:(0,a.k6)(()=>[(0,a.bF)(C,{modelValue:o.editChannel.publicUrl,"onUpdate:modelValue":t[69]||(t[69]=e=>o.editChannel.publicUrl=e),placeholder:e.$t("sysUpload.webdavPublicUrlPlaceholder")},null,8,["modelValue","placeholder"])]),_:1}),(0,a.bF)(v,{label:e.$t("sysUpload.webdavHeaders")},{default:(0,a.k6)(()=>[(0,a.bF)(C,{modelValue:o.editChannel.headersText,"onUpdate:modelValue":t[70]||(t[70]=e=>o.editChannel.headersText=e),type:"textarea",autosize:{minRows:2},placeholder:e.$t("sysUpload.webdavHeadersPlaceholder")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),(0,a.bF)(v,null,{label:(0,a.k6)(()=>[(0,a.eW)((0,n.v_)(e.$t("sysUpload.webdavCreateDirectory"))+" ",1),(0,a.bF)(d,{content:e.$t("sysUpload.webdavCreateDirectoryTip"),placement:"top"},{default:(0,a.k6)(()=>[(0,a.bF)(r,{icon:"question-circle",class:"inline-help-icon"})]),_:1},8,["content"])]),default:(0,a.k6)(()=>[(0,a.bF)(g,{modelValue:o.editChannel.createDirectory,"onUpdate:modelValue":t[71]||(t[71]=e=>o.editChannel.createDirectory=e)},null,8,["modelValue"])]),_:1}),(0,a.bF)(v,{label:e.$t("sysUpload.quotaLimit")},{default:(0,a.k6)(()=>[(0,a.bF)(g,{modelValue:o.editChannel.quota.enabled,"onUpdate:modelValue":t[72]||(t[72]=e=>o.editChannel.quota.enabled=e),onChange:t[73]||(t[73]=e=>l.onQuotaEnabledChange(e,o.editChannel))},null,8,["modelValue"])]),_:1},8,["label"]),o.editChannel.quota?.enabled?((0,a.uX)(),(0,a.CE)(a.FK,{key:0},[(0,a.bF)(v,{label:e.$t("sysUpload.quotaLimitGB")},{default:(0,a.k6)(()=>[(0,a.bF)(S,{modelValue:o.editChannel.quota.limitGB,"onUpdate:modelValue":t[74]||(t[74]=e=>o.editChannel.quota.limitGB=e),min:.1,step:1,precision:1},null,8,["modelValue"])]),_:1},8,["label"]),(0,a.bF)(v,{label:e.$t("sysUpload.quotaThreshold")},{default:(0,a.k6)(()=>[(0,a.bF)(S,{modelValue:o.editChannel.quota.threshold,"onUpdate:modelValue":t[75]||(t[75]=e=>o.editChannel.quota.threshold=e),min:50,max:100,step:5},null,8,["modelValue"])]),_:1},8,["label"])],64)):(0,a.Q3)("",!0)],64)):(0,a.Q3)("",!0)]),_:1},8,["model","rules"])]),_:1},8,["modelValue","title","onClosed"])])),[[P,o.loading]])}var Ep={components:{ChannelIcon:Uu.A,CustomSelect:zu},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"},{value:"webdav",label:"WebDAV"}],addableChannels:[{value:"telegram",label:"Telegram"},{value:"cfr2",label:"CloudFlare R2"},{value:"s3",label:"S3"},{value:"discord",label:"Discord"},{value:"huggingface",label:"HuggingFace"},{value:"webdav",label:"WebDAV"}],telegramSettings:{loadBalance:{enabled:!1},channels:[]},cfr2Settings:{channels:[]},s3Settings:{loadBalance:{enabled:!1},channels:[]},discordSettings:{loadBalance:{enabled:!1},channels:[]},huggingfaceSettings:{loadBalance:{enabled:!1},channels:[]},webdavSettings:{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,baseUrl:"",username:"",password:"",publicUrl:"",headersText:"",createDirectory:!0},quotaStats:{},quotaLoading:!1,loading:!1}},computed:{filterOptions(){return[{value:"",label:this.$t("common.all")},...this.channels.map(e=>({value:e.value,label:e.label,channelType:e.value}))]},filteredChannels(){return this.channelFilter?this.channels.filter(e=>e.value===this.channelFilter):this.channels},addRules(){return{type:[{required:!0,message:this.$t("sysUpload.channelTypePlaceholder"),trigger:"change"}],name:[{required:!0,message:this.$t("sysUpload.channelNamePlaceholder"),trigger:"blur"},{pattern:/^[\u4e00-\u9fa5a-zA-Z0-9_-]+$/,message:this.$t("sysUpload.channelNamePlaceholder"),trigger:"blur"}],botToken:[{required:!0,message:this.$t("sysUpload.botTokenPlaceholder"),trigger:"blur"}],chatId:[{required:!0,message:this.$t("sysUpload.chatIdPlaceholder"),trigger:"blur"}],channelId:[{required:!0,message:this.$t("sysUpload.channelIdPlaceholder"),trigger:"blur"}],endpoint:[{required:!0,message:this.$t("sysUpload.endpointPlaceholder"),trigger:"blur"}],bucketName:[{required:!0,message:this.$t("sysUpload.bucketNamePlaceholder"),trigger:"blur"}],region:[{required:!0,message:this.$t("sysUpload.bucketRegionPlaceholder"),trigger:"blur"}],accessKeyId:[{required:!0,message:this.$t("sysUpload.accessKeyIdPlaceholder"),trigger:"blur"}],secretAccessKey:[{required:!0,message:this.$t("sysUpload.secretAccessKeyPlaceholder"),trigger:"blur"}],repo:[{required:!0,message:this.$t("sysUpload.repoNamePlaceholder"),trigger:"blur"}],token:[{required:!0,message:this.$t("sysUpload.accessTokenPlaceholder"),trigger:"blur"}],baseUrl:[{required:!0,message:this.$t("sysUpload.webdavBaseUrlPlaceholder"),trigger:"blur"}]}},editRules(){return{name:[{required:!0,message:this.$t("sysUpload.channelNamePlaceholder"),trigger:"blur"},{pattern:/^[\u4e00-\u9fa5a-zA-Z0-9_-]+$/,message:this.$t("sysUpload.channelNamePlaceholder"),trigger:"blur"}],botToken:[{required:!0,message:this.$t("sysUpload.botTokenPlaceholder"),trigger:"blur"}],chatId:[{required:!0,message:this.$t("sysUpload.chatIdPlaceholder"),trigger:"blur"}],channelId:[{required:!0,message:this.$t("sysUpload.channelIdPlaceholder"),trigger:"blur"}],endpoint:[{required:!0,message:this.$t("sysUpload.endpointPlaceholder"),trigger:"blur"}],bucketName:[{required:!0,message:this.$t("sysUpload.bucketNamePlaceholder"),trigger:"blur"}],region:[{required:!0,message:this.$t("sysUpload.bucketRegionPlaceholder"),trigger:"blur"}],accessKeyId:[{required:!0,message:this.$t("sysUpload.accessKeyIdPlaceholder"),trigger:"blur"}],secretAccessKey:[{required:!0,message:this.$t("sysUpload.secretAccessKeyPlaceholder"),trigger:"blur"}],repo:[{required:!0,message:this.$t("sysUpload.repoNamePlaceholder"),trigger:"blur"}],token:[{required:!0,message:this.$t("sysUpload.accessTokenPlaceholder"),trigger:"blur"}],baseUrl:[{required:!0,message:this.$t("sysUpload.webdavBaseUrlPlaceholder"),trigger:"blur"}]}}},methods:{handleCardMouseMove(e,t,s){const i=e.currentTarget,a=i.getBoundingClientRect(),n=e.clientX-a.left,o=e.clientY-a.top,l=`glow-${t}-${s}`,r=this.$refs[l];r&&r[0]&&(r[0].style.opacity="1",r[0].style.left=`${n}px`,r[0].style.top=`${o}px`)},handleCardMouseLeave(e,t){const s=`glow-${e}-${t}`,i=this.$refs[s];i&&i[0]&&(i[0].style.opacity="0")},getChannelTypeLabel(e){const t=this.channels.find(t=>t.value===e);return t?t.label:e},getChannelList(e){return this.getSettings(e)?.channels||[]},getSettings(e){const t={telegram:this.telegramSettings,cfr2:this.cfr2Settings,s3:this.s3Settings,discord:this.discordSettings,huggingface:this.huggingfaceSettings,webdav:this.webdavSettings};return t[e]},hasLoadBalance(e){return["telegram","s3","discord","huggingface","webdav"].includes(e)},maskText(e,t=4){return e?e.length<=2*t?"****":e.slice(0,t)+"****"+e.slice(-t):this.$t("sysUpload.notSet")},formatHeaders(e){return!e||"object"===typeof e&&0===Object.keys(e).length?this.$t("sysUpload.notSet"):"string"===typeof e?e:JSON.stringify(e,null,2)},headersToText(e){return e?"string"===typeof e?e:JSON.stringify(e,null,2):""},parseHeadersText(e){if(!e||!e.trim())return{};try{const t=JSON.parse(e);return!t||"object"!==typeof t||Array.isArray(t)?null:t}catch(t){return null}},openDetailDialog(e,t){this.currentChannelType=e,this.currentChannelIndex=t,this.currentChannel=this.getChannelList(e)[t],this.showDetailDialog=!0},openEditDialog(e,t){this.currentChannelType=e,this.currentChannelIndex=t;const s=this.getChannelList(e)[t];this.editChannel=JSON.parse(JSON.stringify(s)),"webdav"===e&&(this.editChannel.headersText=this.headersToText(this.editChannel.headers),this.editChannel.createDirectory=!1!==this.editChannel.createDirectory),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,baseUrl:"",username:"",password:"",publicUrl:"",headersText:"",createDirectory:!0}},resetDetailData(){this.currentChannel=null},resetEditData(){this.editChannel={}},onChannelTypeChange(){const{type:e,name:t}=this.newChannel;this.newChannel={type:e,name:t,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,baseUrl:"",username:"",password:"",publicUrl:"",headersText:"",createDirectory:!0}},confirmAddChannel(){this.$refs.addForm.validate(e=>{if(!e)return;const{type:t,name:s}=this.newChannel,i=this.getSettings(t),a=["Telegram_env","R2_env","S3_env","Discord_env","HuggingFace_env","WebDAV_env"];if(a.includes(s))return void this.$message.warning(this.$t("sysUpload.reservedName"));const n=i.channels.some(e=>e.name===s);if(n)return void this.$message.warning(this.$t("sysUpload.duplicateName"));let o={id:i.channels.length+1,name:this.newChannel.name,type:t,savePath:"database",enabled:!0,fixed:!1};if("telegram"===t)Object.assign(o,{botToken:this.newChannel.botToken,chatId:this.newChannel.chatId,proxyUrl:this.newChannel.proxyUrl});else if("s3"===t)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}});else if("discord"===t)Object.assign(o,{botToken:this.newChannel.botToken,channelId:this.newChannel.channelId,proxyUrl:this.newChannel.proxyUrl,isNitro:this.newChannel.isNitro});else if("huggingface"===t)Object.assign(o,{repo:this.newChannel.repo,token:this.newChannel.token,isPrivate:this.newChannel.isPrivate});else if("webdav"===t){const e=this.parseHeadersText(this.newChannel.headersText);if(null===e)return void this.$message.warning(this.$t("sysUpload.webdavHeadersInvalid"));Object.assign(o,{baseUrl:this.newChannel.baseUrl,username:this.newChannel.username,password:this.newChannel.password,publicUrl:this.newChannel.publicUrl,headers:e,createDirectory:!1!==this.newChannel.createDirectory,quota:{...this.newChannel.quota}})}i.channels.push(o),this.showAddDialog=!1,this.saveSettings()})},confirmEditChannel(){this.$refs.editForm.validate(e=>{if(!e)return;const t=this.getSettings(this.currentChannelType),s=this.currentChannelIndex,i=t.channels[s]?.name||this.editChannel.name,a={...this.editChannel,name:i};if("webdav"===this.currentChannelType){const e=this.parseHeadersText(a.headersText);if(null===e)return void this.$message.warning(this.$t("sysUpload.webdavHeadersInvalid"));a.headers=e,a.createDirectory=!1!==a.createDirectory,delete a.headersText}t.channels[this.currentChannelIndex]=a,this.showEditDialog=!1,this.saveSettings()})},deleteChannel(e,t){const s=this.getChannelList(e)[t];s.fixed?this.$message.warning(this.$t("sysUpload.fixedChannelCannotDelete")):this.$confirm(this.$t("sysUpload.deleteChannelConfirm"),this.$t("common.warning"),{confirmButtonText:this.$t("common.confirm"),cancelButtonText:this.$t("common.cancel"),type:"warning"}).then(()=>{const s=this.getSettings(e);s.channels.splice(t,1),s.channels.forEach((e,t)=>{e.id=t+1}),this.saveSettings()}).catch(()=>{})},saveSettings(){const e={telegram:this.telegramSettings,cfr2:this.cfr2Settings,s3:this.s3Settings,discord:this.discordSettings,huggingface:this.huggingfaceSettings,webdav:this.webdavSettings};(0,Ot.A)("/api/manage/sysConfig/upload",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}).then(()=>{this.$message.success(this.$t("sysOthers.settingsSaved"))})},async refreshQuota(){this.quotaLoading=!0;try{const e=await(0,Ot.A)("/api/manage/quota",{method:"POST"}),t=await e.json();if(t.success)this.quotaStats=t.channelStats||{};else{const e=await(0,Ot.A)("/api/manage/quota"),t=await e.json();t.success&&(this.quotaStats=t.quotaStats||{})}}catch(e){console.error("Failed to refresh quota stats:",e)}finally{this.quotaLoading=!1}},async loadQuotaStats(){try{const e=await(0,Ot.A)("/api/manage/quota"),t=await e.json();t.success&&(this.quotaStats=t.quotaStats||{})}catch(e){console.error("Failed to load quota stats:",e)}},getChannelUsedGB(e){const t=this.quotaStats[e.name];return t?(t.usedMB||0)/1024:0},getQuotaPercentage(e){const t=this.getChannelUsedGB(e),s=e.quota?.limitGB||10,i=t/s*100;return Math.min(100,Math.round(10*i)/10)},getQuotaStatus(e){const t=this.getQuotaPercentage(e),s=e.quota?.threshold||95;return t>=s?"exception":t>=80?"warning":"success"},getQuotaText(e){const t=this.getChannelUsedGB(e),s=e.quota?.limitGB||10;return`${t.toFixed(2)} / ${s} GB`},isQuotaExceeded(e){const t=this.getQuotaPercentage(e),s=e.quota?.threshold||95;return t>=s},getQuotaStatusText(e){const t=this.getQuotaPercentage(e),s=e.quota?.threshold||95;return t>=s?`⚠️ 已达到容量阈值 (${s}%),渠道写入已暂停`:t>=80?"⚡ 容量使用较高,接近阈值":"✓ 容量正常"},async onQuotaEnabledChange(e,t){if(e&&t.name){const e=this.quotaStats[t.name];e||this.$confirm(this.$t("sysUpload.quotaInitConfirm"),this.$t("sysUpload.quotaInitTitle"),{confirmButtonText:this.$t("sysUpload.quotaInitConfirmBtn"),cancelButtonText:this.$t("sysUpload.quotaInitCancelBtn"),type:"info"}).then(async()=>{await this.recalculateQuota()}).catch(()=>{this.$message.info(this.$t("sysUpload.quotaInitLater"))})}},async recalculateQuota(){this.quotaLoading=!0;try{this.$message.info(this.$t("sysUpload.quotaCalculating"));const e=await(0,Ot.A)("/api/manage/quota",{method:"POST"}),t=await e.json();t.success?(this.quotaStats=t.channelStats||{},this.$message.success(this.$t("sysUpload.quotaCalculateSuccess"))):this.$message.error(this.$t("sysUpload.quotaCalculateError")+(t.error||""))}catch(e){console.error("Failed to recalculate quota:",e),this.$message.error(this.$t("sysUpload.quotaCalculateFailed"))}finally{this.quotaLoading=!1}}},mounted(){this.loading=!0,(0,Ot.A)("/api/manage/sysConfig/upload").then(e=>e.json()).then(e=>{this.telegramSettings=e.telegram,e.cfr2&&e.cfr2.channels&&(e.cfr2.channels=e.cfr2.channels.map(e=>({...e,quota:e.quota||{enabled:!1,limitGB:10,threshold:95}}))),this.cfr2Settings=e.cfr2,e.s3&&e.s3.channels&&(e.s3.channels=e.s3.channels.map(e=>({...e,quota:e.quota||{enabled:!1,limitGB:10,threshold:95}}))),this.s3Settings=e.s3,e.discord&&e.discord.channels&&(e.discord.channels=e.discord.channels.map(e=>({...e,proxyUrl:e.proxyUrl||""}))),this.discordSettings=e.discord||{loadBalance:{},channels:[]},e.huggingface&&e.huggingface.channels&&(e.huggingface.channels=e.huggingface.channels.map(e=>({...e,isPrivate:e.isPrivate||!1}))),this.huggingfaceSettings=e.huggingface||{loadBalance:{},channels:[]},e.webdav&&e.webdav.channels&&(e.webdav.channels=e.webdav.channels.map(e=>({...e,username:e.username||"",password:e.password||"",publicUrl:e.publicUrl||"",headers:e.headers||{},createDirectory:!1!==e.createDirectory,quota:e.quota||{enabled:!1,limitGB:10,threshold:95}}))),this.webdavSettings=e.webdav||{loadBalance:{},channels:[]},this.loadQuotaStats()}).finally(()=>{this.loading=!1})}};const Ip=(0,u.A)(Ep,[["render",Lp],["__scopeId","data-v-058443f7"]]);var Up=Ip,Op=s(98469);s(49187);const Rp=["aria-label"],Wp={class:"save-text"};function Np(e,t,s,i,o,l){const r=(0,a.g2)("font-awesome-icon");return(0,a.uX)(),(0,a.Wv)(w.eB,{name:"fade-up"},{default:(0,a.k6)(()=>[(0,a.bo)((0,a.Lk)("div",{class:(0,n.C4)(["floating-save-btn",{"is-loading":s.loading}]),onClick:t[0]||(t[0]=(...e)=>l.handleClick&&l.handleClick(...e))},[s.dirty?((0,a.uX)(),(0,a.CE)("span",{key:0,class:"unsaved-dot",role:"img","aria-label":e.$t("floatingSave.unsaved")},null,8,Rp)):(0,a.Q3)("",!0),s.loading?((0,a.uX)(),(0,a.Wv)(r,{key:1,icon:"spinner",spin:""})):((0,a.uX)(),(0,a.Wv)(r,{key:2,icon:"save"})),(0,a.Lk)("span",Wp,(0,n.v_)(s.loading?e.$t("floatingSave.saving"):e.$t("floatingSave.save")),1)],2),[[w.aG,o.visible]])]),_:1})}var zp={name:"FloatingSaveButton",emits:["click"],props:{dirty:{type:Boolean,default:!1},loading:{type:Boolean,default:!1},show:{type:Boolean,default:!0}},data(){return{visible:!1,visibilityTimer:null}},watch:{show:{immediate:!0,handler(e){clearTimeout(this.visibilityTimer),e?this.visibilityTimer=setTimeout(()=>{this.visible=!0},600):this.visible=!1}}},beforeUnmount(){clearTimeout(this.visibilityTimer)},methods:{handleClick(){this.loading||this.$emit("click")}}};const Bp=(0,u.A)(zp,[["render",Np],["__scopeId","data-v-9ebe7158"]]);var jp=Bp,Hp=s(84757);s(5802),s(64752),s(38736);const qp={class:"security-settings"},Xp={class:"first-settings"},Kp={class:"first-title"},Qp={class:"second-title"},Yp={style:{display:"flex",gap:"8px",width:"100%"}},Gp={class:"second-title"},Jp={style:{display:"flex",gap:"8px",width:"100%"}},Zp={class:"second-title token-title"},eg={class:"token-actions"},tg={class:"token-table-container"},sg={class:"table-cell-content"},ig={class:"table-cell-content"},ag={class:"token-display"},ng={class:"table-cell-content"},og={class:"table-cell-content"},lg={class:"table-cell-content"},rg={class:"table-cell-content"},dg={class:"table-cell-content action-buttons"},cg={class:"first-settings"},hg={class:"first-title"},ug={class:"second-title"},pg={class:"second-title"},gg={class:"query-param-list"},mg={class:"query-param-list"},fg={class:"first-settings"},bg={class:"first-title"},yg={class:"second-title"},vg={class:"second-title"},xg={class:"second-title"},kg={class:"second-title"},_g={class:"form-item-hint"},wg={class:"form-item-hint"},Cg={style:{display:"flex",gap:"10px",width:"100%"}},Sg={class:"dialog-footer"},Fg={style:{display:"flex",gap:"10px",width:"100%"}},Tg={class:"dialog-footer"},Ag={class:"token-result"},Mg={style:{"margin-bottom":"15px",color:"#e6a23c"}},Pg={class:"dialog-footer"};function $g(e,t,s,i,o,l){const r=Vu.WK,d=Op.dI,c=$u.xE,h=$u.US,u=(0,a.g2)("font-awesome-icon"),p=X.S2,g=Hp.o8,m=Iu.u,f=Hp.Up,b=x.R7,v=Eu.qi,k=Lu.P9,C=Lu.AV,S=Du.lq,F=jp,T=Op.o5,A=_.kZ,M=y.A;return(0,a.bo)(((0,a.uX)(),(0,a.CE)("div",qp,[(0,a.Lk)("div",Xp,[(0,a.Lk)("h3",Kp,(0,n.v_)(e.$t("sysSecurity.authManagement")),1),(0,a.Lk)("h4",Qp,(0,n.v_)(e.$t("sysSecurity.userAuth")),1),(0,a.bF)(h,{model:o.authSettings.user,disabled:o.saving,rules:l.userPassRules,ref:"userPassForm","label-width":"120px"},{default:(0,a.k6)(()=>[(0,a.bF)(c,{label:e.$t("sysSecurity.uploadPassword"),prop:"authCode"},{default:(0,a.k6)(()=>[(0,a.Lk)("div",Yp,[(0,a.bF)(r,{modelValue:o.authSettings.user.authCode,"onUpdate:modelValue":t[0]||(t[0]=e=>o.authSettings.user.authCode=e),type:"password","show-password":"",onInput:l.handleUserPassInput,autocomplete:"new-password",placeholder:o.authSettings.user._hasPassword?e.$t("sysSecurity.passwordUnchanged"):"",disabled:o.clearUserPassword},null,8,["modelValue","onInput","placeholder","disabled"]),o.authSettings.user._hasPassword?((0,a.uX)(),(0,a.Wv)(d,{key:0,modelValue:o.clearUserPassword,"onUpdate:modelValue":t[1]||(t[1]=e=>o.clearUserPassword=e),onChange:l.handleClearUserPassword},{default:(0,a.k6)(()=>[(0,a.eW)((0,n.v_)(e.$t("sysSecurity.clearPassword")),1)]),_:1},8,["modelValue","onChange"])):(0,a.Q3)("",!0)])]),_:1},8,["label"]),(0,a.bF)(w.eB,{name:"fade-slide",mode:"out-in"},{default:(0,a.k6)(()=>[o.showUserPassConfirm?((0,a.uX)(),(0,a.Wv)(c,{label:e.$t("sysSecurity.confirmPassword"),prop:"confirmNewUserPassword",key:"user-confirm"},{default:(0,a.k6)(()=>[(0,a.bF)(r,{modelValue:o.authSettings.user.confirmNewUserPassword,"onUpdate:modelValue":t[2]||(t[2]=e=>o.authSettings.user.confirmNewUserPassword=e),type:"password","show-password":"",autocomplete:"new-password"},null,8,["modelValue"])]),_:1},8,["label"])):(0,a.Q3)("",!0)]),_:1})]),_:1},8,["model","disabled","rules"]),(0,a.Lk)("h4",Gp,(0,n.v_)(e.$t("sysSecurity.adminAuth")),1),(0,a.bF)(h,{model:o.authSettings.admin,disabled:o.saving,rules:l.adminPassRules,ref:"adminPassForm","label-width":"120px"},{default:(0,a.k6)(()=>[(0,a.bF)(c,{label:e.$t("sysSecurity.adminUsername"),prop:"adminUsername"},{default:(0,a.k6)(()=>[(0,a.bF)(r,{modelValue:o.authSettings.admin.adminUsername,"onUpdate:modelValue":t[3]||(t[3]=e=>o.authSettings.admin.adminUsername=e),autocomplete:"new-password",disabled:o.clearAdminPassword},null,8,["modelValue","disabled"])]),_:1},8,["label"]),(0,a.bF)(c,{label:e.$t("sysSecurity.adminPassword"),prop:"adminPassword"},{default:(0,a.k6)(()=>[(0,a.Lk)("div",Jp,[(0,a.bF)(r,{modelValue:o.authSettings.admin.adminPassword,"onUpdate:modelValue":t[4]||(t[4]=e=>o.authSettings.admin.adminPassword=e),type:"password","show-password":"",onInput:l.handleAdminPassInput,autocomplete:"new-password",placeholder:o.authSettings.admin._hasPassword?e.$t("sysSecurity.passwordUnchanged"):"",disabled:o.clearAdminPassword},null,8,["modelValue","onInput","placeholder","disabled"]),o.authSettings.admin._hasPassword?((0,a.uX)(),(0,a.Wv)(d,{key:0,modelValue:o.clearAdminPassword,"onUpdate:modelValue":t[5]||(t[5]=e=>o.clearAdminPassword=e),onChange:l.handleClearAdminPassword},{default:(0,a.k6)(()=>[(0,a.eW)((0,n.v_)(e.$t("sysSecurity.clearPassword")),1)]),_:1},8,["modelValue","onChange"])):(0,a.Q3)("",!0)])]),_:1},8,["label"]),(0,a.bF)(w.eB,{name:"fade-slide",mode:"out-in"},{default:(0,a.k6)(()=>[o.showAdminPassConfirm?((0,a.uX)(),(0,a.Wv)(c,{label:e.$t("sysSecurity.confirmPassword"),prop:"confirmNewAdminPassword",key:"admin-confirm"},{default:(0,a.k6)(()=>[(0,a.bF)(r,{modelValue:o.authSettings.admin.confirmNewAdminPassword,"onUpdate:modelValue":t[6]||(t[6]=e=>o.authSettings.admin.confirmNewAdminPassword=e),type:"password","show-password":"",autocomplete:"new-password"},null,8,["modelValue"])]),_:1},8,["label"])):(0,a.Q3)("",!0)]),_:1})]),_:1},8,["model","disabled","rules"]),(0,a.Lk)("h4",Zp,[(0,a.eW)((0,n.v_)(e.$t("sysSecurity.apiTokenManagement"))+" ",1),(0,a.Lk)("a",eg,[(0,a.bF)(p,{type:"primary",size:"small",onClick:t[7]||(t[7]=e=>o.showCreateTokenDialog=!0),circle:""},{default:(0,a.k6)(()=>[(0,a.bF)(u,{icon:"plus"})]),_:1})])]),(0,a.Lk)("div",tg,[(0,a.bo)(((0,a.uX)(),(0,a.Wv)(f,{data:o.apiTokens,class:"token-table"},{default:(0,a.k6)(()=>[(0,a.bF)(g,{prop:"name",label:e.$t("sysSecurity.tokenName"),"header-align":"center"},{default:(0,a.k6)(e=>[(0,a.Lk)("div",sg,(0,n.v_)(e.row.name),1)]),_:1},8,["label"]),(0,a.bF)(g,{prop:"token",label:e.$t("sysSecurity.tokenValue"),"header-align":"center"},{default:(0,a.k6)(e=>[(0,a.Lk)("div",ig,[(0,a.Lk)("span",ag,(0,n.v_)(e.row.token),1)])]),_:1},8,["label"]),(0,a.bF)(g,{prop:"permissions",label:e.$t("sysSecurity.permissions"),"header-align":"center"},{default:(0,a.k6)(e=>[(0,a.Lk)("div",ng,[((0,a.uX)(!0),(0,a.CE)(a.FK,null,(0,a.pI)(e.row.permissions,e=>((0,a.uX)(),(0,a.Wv)(m,{key:e,size:"small",class:"permission-tag"},{default:(0,a.k6)(()=>[(0,a.eW)((0,n.v_)(l.getPermissionText(e)),1)]),_:2},1024))),128))])]),_:1},8,["label"]),(0,a.bF)(g,{prop:"createdAt",label:e.$t("sysSecurity.createdAt"),"header-align":"center"},{default:(0,a.k6)(e=>[(0,a.Lk)("div",og,(0,n.v_)(l.formatDate(e.row.createdAt)),1)]),_:1},8,["label"]),(0,a.bF)(g,{label:e.$t("sysSecurity.status"),"header-align":"center",width:"90"},{default:(0,a.k6)(e=>[(0,a.Lk)("div",lg,[(0,a.bF)(m,{type:"active"===l.getTokenStatus(e.row.expiresAt).status?"success":"danger",size:"small"},{default:(0,a.k6)(()=>[(0,a.eW)((0,n.v_)(l.getTokenStatus(e.row.expiresAt).label),1)]),_:2},1032,["type"])])]),_:1},8,["label"]),(0,a.bF)(g,{label:e.$t("sysSecurity.expiresAt"),"header-align":"center"},{default:(0,a.k6)(e=>[(0,a.Lk)("div",rg,(0,n.v_)(l.getTokenStatus(e.row.expiresAt).expiresText),1)]),_:1},8,["label"]),(0,a.bF)(g,{label:e.$t("sysSecurity.operation"),fixed:"right","header-align":"center"},{default:(0,a.k6)(t=>[(0,a.Lk)("div",dg,[(0,a.bF)(p,{class:"action-button",size:"small",onClick:e=>l.editToken(t.row)},{default:(0,a.k6)(()=>[(0,a.eW)((0,n.v_)(e.$t("sysSecurity.editBtn")),1)]),_:1},8,["onClick"]),(0,a.bF)(p,{class:"action-button",size:"small",type:"danger",onClick:e=>l.deleteToken(t.row.id)},{default:(0,a.k6)(()=>[(0,a.eW)((0,n.v_)(e.$t("sysSecurity.deleteBtn")),1)]),_:1},8,["onClick"])])]),_:1},8,["label"])]),_:1},8,["data"])),[[M,o.tokenLoading]])])]),(0,a.Lk)("div",cg,[(0,a.Lk)("h3",hg,(0,n.v_)(e.$t("sysSecurity.uploadManagement")),1),(0,a.Lk)("h4",ug,[(0,a.eW)((0,n.v_)(e.$t("sysSecurity.imageReview"))+" ",1),(0,a.bF)(b,{content:e.$t("sysSecurity.imageReviewTooltip"),placement:"top"},{default:(0,a.k6)(()=>[(0,a.bF)(u,{icon:"question-circle",style:{"margin-left":"5px",cursor:"pointer"}})]),_:1},8,["content"])]),(0,a.bF)(h,{model:o.uploadSettings.moderate,"label-width":"120px",disabled:o.saving},{default:(0,a.k6)(()=>[(0,a.bF)(c,{label:e.$t("sysSecurity.enableReview")},{default:(0,a.k6)(()=>[(0,a.bF)(v,{modelValue:o.uploadSettings.moderate.enabled,"onUpdate:modelValue":t[8]||(t[8]=e=>o.uploadSettings.moderate.enabled=e)},null,8,["modelValue"])]),_:1},8,["label"]),(0,a.bF)(c,{label:e.$t("sysSecurity.reviewChannel")},{default:(0,a.k6)(()=>[(0,a.bF)(C,{modelValue:o.uploadSettings.moderate.channel,"onUpdate:modelValue":t[9]||(t[9]=e=>o.uploadSettings.moderate.channel=e),placeholder:e.$t("sysSecurity.reviewChannelPlaceholder")},{default:(0,a.k6)(()=>[(0,a.bF)(k,{label:"moderatecontent.com",value:"moderatecontent.com"}),(0,a.bF)(k,{label:"nsfwjs",value:"nsfwjs"})]),_:1},8,["modelValue","placeholder"])]),_:1},8,["label"]),"moderatecontent.com"===o.uploadSettings.moderate.channel?((0,a.uX)(),(0,a.Wv)(c,{key:0,label:e.$t("sysSecurity.apiKey")},{default:(0,a.k6)(()=>[(0,a.bF)(r,{modelValue:o.uploadSettings.moderate.moderateContentApiKey,"onUpdate:modelValue":t[10]||(t[10]=e=>o.uploadSettings.moderate.moderateContentApiKey=e)},null,8,["modelValue"])]),_:1},8,["label"])):(0,a.Q3)("",!0),"nsfwjs"===o.uploadSettings.moderate.channel?((0,a.uX)(),(0,a.Wv)(c,{key:1,label:e.$t("sysSecurity.apiPath")},{default:(0,a.k6)(()=>[(0,a.bF)(r,{modelValue:o.uploadSettings.moderate.nsfwApiPath,"onUpdate:modelValue":t[11]||(t[11]=e=>o.uploadSettings.moderate.nsfwApiPath=e),placeholder:"https://nsfwjs.your.domain"},null,8,["modelValue"])]),_:1},8,["label"])):(0,a.Q3)("",!0)]),_:1},8,["model","disabled"]),(0,a.Lk)("h4",pg,[(0,a.eW)((0,n.v_)(e.$t("sysSecurity.ipQuery"))+" ",1),(0,a.bF)(b,{content:e.$t("sysSecurity.ipQueryTooltip"),placement:"top"},{default:(0,a.k6)(()=>[(0,a.bF)(u,{icon:"question-circle",style:{"margin-left":"5px",cursor:"pointer"}})]),_:1},8,["content"])]),(0,a.bF)(h,{model:o.uploadSettings.ipQuery,"label-width":"120px",disabled:o.saving},{default:(0,a.k6)(()=>[(0,a.bF)(c,{label:e.$t("sysSecurity.enableIpQuery")},{default:(0,a.k6)(()=>[(0,a.bF)(v,{modelValue:o.uploadSettings.ipQuery.enabled,"onUpdate:modelValue":t[12]||(t[12]=e=>o.uploadSettings.ipQuery.enabled=e)},null,8,["modelValue"])]),_:1},8,["label"]),(0,a.bF)(c,{label:e.$t("sysSecurity.ipQueryChannel")},{default:(0,a.k6)(()=>[(0,a.bF)(C,{modelValue:o.uploadSettings.ipQuery.channel,"onUpdate:modelValue":t[13]||(t[13]=e=>o.uploadSettings.ipQuery.channel=e),placeholder:e.$t("sysSecurity.ipQueryChannelPlaceholder")},{default:(0,a.k6)(()=>[(0,a.bF)(k,{label:e.$t("sysSecurity.customApi"),value:"customApi"},null,8,["label"])]),_:1},8,["modelValue","placeholder"])]),_:1},8,["label"]),"customApi"===o.uploadSettings.ipQuery.channel?((0,a.uX)(),(0,a.CE)(a.FK,{key:0},[(0,a.bF)(c,{label:e.$t("sysSecurity.apiPath")},{default:(0,a.k6)(()=>[(0,a.bF)(r,{modelValue:o.uploadSettings.ipQuery.customApi.url,"onUpdate:modelValue":t[14]||(t[14]=e=>o.uploadSettings.ipQuery.customApi.url=e),placeholder:"https://api.example.com/ip"},null,8,["modelValue"])]),_:1},8,["label"]),(0,a.bF)(c,{label:e.$t("sysSecurity.queryParams")},{default:(0,a.k6)(()=>[(0,a.Lk)("div",gg,[((0,a.uX)(!0),(0,a.CE)(a.FK,null,(0,a.pI)(o.uploadSettings.ipQuery.customApi.params,(t,s)=>((0,a.uX)(),(0,a.CE)("div",{key:s,class:"query-param-row"},[(0,a.bF)(r,{modelValue:t.key,"onUpdate:modelValue":e=>t.key=e,placeholder:e.$t("sysSecurity.paramNamePlaceholder")},null,8,["modelValue","onUpdate:modelValue","placeholder"]),(0,a.bF)(r,{modelValue:t.value,"onUpdate:modelValue":e=>t.value=e,placeholder:e.$t("sysSecurity.paramValuePlaceholder")},null,8,["modelValue","onUpdate:modelValue","placeholder"]),(0,a.bF)(p,{type:"danger",plain:"",circle:"",onClick:e=>l.removeIpQueryParam(s),disabled:o.uploadSettings.ipQuery.customApi.params.length<=1},{default:(0,a.k6)(()=>[(0,a.bF)(u,{icon:"trash-alt"})]),_:1},8,["onClick","disabled"])]))),128)),(0,a.bF)(p,{type:"primary",plain:"",onClick:l.addIpQueryParam},{default:(0,a.k6)(()=>[(0,a.bF)(u,{icon:"plus"}),(0,a.Lk)("span",null,(0,n.v_)(e.$t("sysSecurity.addQueryParam")),1)]),_:1},8,["onClick"])])]),_:1},8,["label"]),(0,a.bF)(c,null,{label:(0,a.k6)(()=>[(0,a.eW)((0,n.v_)(e.$t("sysSecurity.responseFields"))+" ",1),(0,a.bF)(b,{content:e.$t("sysSecurity.responseFieldsTip"),placement:"top"},{default:(0,a.k6)(()=>[(0,a.bF)(u,{icon:"question-circle",style:{"margin-left":"5px",cursor:"pointer"}})]),_:1},8,["content"])]),default:(0,a.k6)(()=>[(0,a.Lk)("div",mg,[((0,a.uX)(!0),(0,a.CE)(a.FK,null,(0,a.pI)(o.uploadSettings.ipQuery.customApi.responseFields,(t,s)=>((0,a.uX)(),(0,a.CE)("div",{key:s,class:"response-field-row"},[(0,a.bF)(r,{modelValue:o.uploadSettings.ipQuery.customApi.responseFields[s],"onUpdate:modelValue":e=>o.uploadSettings.ipQuery.customApi.responseFields[s]=e,placeholder:e.$t("sysSecurity.responseFieldPathPlaceholder")},null,8,["modelValue","onUpdate:modelValue","placeholder"]),(0,a.bF)(p,{plain:"",circle:"",onClick:e=>l.moveIpQueryResponseField(s,-1),disabled:0===s},{default:(0,a.k6)(()=>[(0,a.bF)(u,{icon:"arrow-up"})]),_:1},8,["onClick","disabled"]),(0,a.bF)(p,{plain:"",circle:"",onClick:e=>l.moveIpQueryResponseField(s,1),disabled:s===o.uploadSettings.ipQuery.customApi.responseFields.length-1},{default:(0,a.k6)(()=>[(0,a.bF)(u,{icon:"arrow-down"})]),_:1},8,["onClick","disabled"]),(0,a.bF)(p,{type:"danger",plain:"",circle:"",onClick:e=>l.removeIpQueryResponseField(s)},{default:(0,a.k6)(()=>[(0,a.bF)(u,{icon:"trash-alt"})]),_:1},8,["onClick"])]))),128)),(0,a.bF)(p,{type:"primary",plain:"",onClick:l.addIpQueryResponseField},{default:(0,a.k6)(()=>[(0,a.bF)(u,{icon:"plus"}),(0,a.Lk)("span",null,(0,n.v_)(e.$t("sysSecurity.addResponseField")),1)]),_:1},8,["onClick"])])]),_:1})],64)):(0,a.Q3)("",!0)]),_:1},8,["model","disabled"])]),(0,a.Lk)("div",fg,[(0,a.Lk)("h3",bg,(0,n.v_)(e.$t("sysSecurity.accessManagement")),1),(0,a.Lk)("h4",yg,(0,n.v_)(e.$t("sysSecurity.domainFilter")),1),(0,a.bF)(h,{model:o.accessSettings,"label-width":"120px",disabled:o.saving},{default:(0,a.k6)(()=>[(0,a.bF)(c,null,{label:(0,a.k6)(()=>[(0,a.eW)((0,n.v_)(e.$t("sysSecurity.allowedDomains"))+" ",1),(0,a.bF)(b,{content:e.$t("sysSecurity.allowedDomainsTooltip"),placement:"top","raw-content":""},{default:(0,a.k6)(()=>[(0,a.bF)(u,{icon:"question-circle",style:{"margin-left":"5px",cursor:"pointer"}})]),_:1},8,["content"])]),default:(0,a.k6)(()=>[(0,a.bF)(r,{modelValue:o.accessSettings.allowedDomains,"onUpdate:modelValue":t[15]||(t[15]=e=>o.accessSettings.allowedDomains=e)},null,8,["modelValue"])]),_:1})]),_:1},8,["model","disabled"]),(0,a.Lk)("h4",vg,(0,n.v_)(e.$t("sysSecurity.whiteListMode")),1),(0,a.bF)(h,{model:o.accessSettings,rules:l.accessRules,ref:"accessForm","label-width":"120px",disabled:o.saving},{default:(0,a.k6)(()=>[(0,a.bF)(c,null,{label:(0,a.k6)(()=>[(0,a.eW)((0,n.v_)(e.$t("sysSecurity.enableWhiteList"))+" ",1),(0,a.bF)(b,{content:e.$t("sysSecurity.enableWhiteListTooltip"),placement:"top","raw-content":""},{default:(0,a.k6)(()=>[(0,a.bF)(u,{icon:"question-circle",style:{"margin-left":"5px",cursor:"pointer"}})]),_:1},8,["content"])]),default:(0,a.k6)(()=>[(0,a.bF)(v,{modelValue:o.accessSettings.whiteListMode,"onUpdate:modelValue":t[16]||(t[16]=e=>o.accessSettings.whiteListMode=e)},null,8,["modelValue"])]),_:1})]),_:1},8,["model","rules","disabled"]),(0,a.Lk)("h4",xg,(0,n.v_)(e.$t("sysSecurity.imageTransform")),1),(0,a.bF)(h,{model:o.accessSettings,rules:l.accessRules,ref:"imageTransformForm","label-width":"120px",disabled:o.saving},{default:(0,a.k6)(()=>[(0,a.bF)(c,null,{label:(0,a.k6)(()=>[(0,a.eW)((0,n.v_)(e.$t("sysSecurity.enableImageTransform"))+" ",1),(0,a.bF)(b,{content:e.$t("sysSecurity.enableImageTransformTooltip"),placement:"top","raw-content":""},{default:(0,a.k6)(()=>[(0,a.bF)(u,{icon:"question-circle",style:{"margin-left":"5px",cursor:"pointer"}})]),_:1},8,["content"])]),default:(0,a.k6)(()=>[(0,a.bF)(v,{modelValue:o.accessSettings.imageTransformEnabled,"onUpdate:modelValue":t[17]||(t[17]=e=>o.accessSettings.imageTransformEnabled=e)},null,8,["modelValue"])]),_:1}),o.accessSettings.imageTransformEnabled?((0,a.uX)(),(0,a.Wv)(c,{key:0,prop:"imageTransformAllowedSizes"},{label:(0,a.k6)(()=>[(0,a.eW)((0,n.v_)(e.$t("sysSecurity.imageTransformAllowedSizes"))+" ",1),(0,a.bF)(b,{content:e.$t("sysSecurity.imageTransformAllowedSizesHint"),placement:"top","raw-content":""},{default:(0,a.k6)(()=>[(0,a.bF)(u,{icon:"question-circle",style:{"margin-left":"5px",cursor:"pointer"}})]),_:1},8,["content"])]),default:(0,a.k6)(()=>[(0,a.bF)(r,{modelValue:o.accessSettings.imageTransformAllowedSizes,"onUpdate:modelValue":t[18]||(t[18]=e=>o.accessSettings.imageTransformAllowedSizes=e),placeholder:e.$t("sysSecurity.imageTransformAllowedSizesPlaceholder")},null,8,["modelValue","placeholder"])]),_:1})):(0,a.Q3)("",!0)]),_:1},8,["model","rules","disabled"]),(0,a.Lk)("h4",kg,(0,n.v_)(e.$t("sysSecurity.sessionSecurityPolicy")),1),(0,a.bF)(h,{model:o.accessSettings,"label-width":"120px",disabled:o.saving},{default:(0,a.k6)(()=>[(0,a.bF)(c,null,{label:(0,a.k6)(()=>[(0,a.eW)((0,n.v_)(e.$t("sysSecurity.secureMode"))+" ",1),(0,a.bF)(b,{content:e.$t("sysSecurity.secureModeTooltip"),placement:"top"},{default:(0,a.k6)(()=>[(0,a.bF)(u,{icon:"question-circle",style:{"margin-left":"5px",cursor:"pointer"}})]),_:1},8,["content"])]),default:(0,a.k6)(()=>[(0,a.bF)(v,{modelValue:o.accessSettings.sessionSecure,"onUpdate:modelValue":t[19]||(t[19]=e=>o.accessSettings.sessionSecure=e)},null,8,["modelValue"])]),_:1}),(0,a.bF)(c,{label:e.$t("sysSecurity.userSessionMaxAge"),prop:"userSessionMaxAge"},{default:(0,a.k6)(()=>[(0,a.bF)(S,{modelValue:o.accessSettings.userSessionMaxAge,"onUpdate:modelValue":t[20]||(t[20]=e=>o.accessSettings.userSessionMaxAge=e),min:1,max:3650,step:1,precision:0,"controls-position":"right"},null,8,["modelValue"]),(0,a.Lk)("span",_g,(0,n.v_)(e.$t("sysSecurity.sessionMaxAgeUnit")),1)]),_:1},8,["label"]),(0,a.bF)(c,{label:e.$t("sysSecurity.adminSessionMaxAge"),prop:"adminSessionMaxAge"},{default:(0,a.k6)(()=>[(0,a.bF)(S,{modelValue:o.accessSettings.adminSessionMaxAge,"onUpdate:modelValue":t[21]||(t[21]=e=>o.accessSettings.adminSessionMaxAge=e),min:1,max:3650,step:1,precision:0,"controls-position":"right"},null,8,["modelValue"]),(0,a.Lk)("span",wg,(0,n.v_)(e.$t("sysSecurity.sessionMaxAgeUnit")),1)]),_:1},8,["label"])]),_:1},8,["model","disabled"])]),(0,a.bF)(F,{show:!o.loading,loading:o.saving,dirty:e.hasUnsavedChanges,onClick:l.saveSettings},null,8,["show","loading","dirty","onClick"]),(0,a.bF)(A,{modelValue:o.showCreateTokenDialog,"onUpdate:modelValue":t[29]||(t[29]=e=>o.showCreateTokenDialog=e),title:e.$t("sysSecurity.createTokenTitle"),width:l.dialogWidth},{footer:(0,a.k6)(()=>[(0,a.Lk)("span",Sg,[(0,a.bF)(p,{onClick:t[28]||(t[28]=e=>o.showCreateTokenDialog=!1)},{default:(0,a.k6)(()=>[(0,a.eW)((0,n.v_)(e.$t("common.cancel")),1)]),_:1}),(0,a.bF)(p,{type:"primary",onClick:l.createToken},{default:(0,a.k6)(()=>[(0,a.eW)((0,n.v_)(e.$t("sysSecurity.createBtn")),1)]),_:1},8,["onClick"])])]),default:(0,a.k6)(()=>[(0,a.bF)(h,{model:o.newToken,rules:l.tokenRules,ref:"tokenForm","label-width":"100px"},{default:(0,a.k6)(()=>[(0,a.bF)(c,{label:e.$t("sysSecurity.tokenNameLabel"),prop:"name"},{default:(0,a.k6)(()=>[(0,a.bF)(r,{modelValue:o.newToken.name,"onUpdate:modelValue":t[22]||(t[22]=e=>o.newToken.name=e),placeholder:e.$t("sysSecurity.tokenNamePlaceholder")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),(0,a.bF)(c,{label:e.$t("sysSecurity.permissionsLabel"),prop:"permissions"},{default:(0,a.k6)(()=>[(0,a.bF)(T,{modelValue:o.newToken.permissions,"onUpdate:modelValue":t[23]||(t[23]=e=>o.newToken.permissions=e)},{default:(0,a.k6)(()=>[(0,a.bF)(d,{label:"upload"},{default:(0,a.k6)(()=>[(0,a.eW)((0,n.v_)(e.$t("sysSecurity.permUpload")),1)]),_:1}),(0,a.bF)(d,{label:"delete"},{default:(0,a.k6)(()=>[(0,a.eW)((0,n.v_)(e.$t("sysSecurity.permDelete")),1)]),_:1}),(0,a.bF)(d,{label:"list"},{default:(0,a.k6)(()=>[(0,a.eW)((0,n.v_)(e.$t("sysSecurity.permList")),1)]),_:1}),(0,a.bF)(d,{label:"manage"},{default:(0,a.k6)(()=>[(0,a.eW)((0,n.v_)(e.$t("sysSecurity.permManage")),1)]),_:1})]),_:1},8,["modelValue"])]),_:1},8,["label"]),(0,a.bF)(c,{label:e.$t("sysSecurity.neverExpire")},{default:(0,a.k6)(()=>[(0,a.bF)(v,{modelValue:o.newToken.neverExpire,"onUpdate:modelValue":t[24]||(t[24]=e=>o.newToken.neverExpire=e),onChange:l.onCreateNeverExpireChange},null,8,["modelValue","onChange"])]),_:1},8,["label"]),o.newToken.neverExpire?(0,a.Q3)("",!0):((0,a.uX)(),(0,a.Wv)(c,{key:0,label:e.$t("sysSecurity.validPeriod"),prop:"expirationValue"},{default:(0,a.k6)(()=>[(0,a.Lk)("div",Cg,[(0,a.bF)(S,{modelValue:o.newToken.expirationValue,"onUpdate:modelValue":t[25]||(t[25]=e=>o.newToken.expirationValue=e),min:1,step:1,"controls-position":"right",style:{flex:"1"}},null,8,["modelValue"]),(0,a.bF)(C,{modelValue:o.newToken.expirationUnit,"onUpdate:modelValue":t[26]||(t[26]=e=>o.newToken.expirationUnit=e),style:{width:"100px"}},{default:(0,a.k6)(()=>[((0,a.uX)(!0),(0,a.CE)(a.FK,null,(0,a.pI)(o.timeUnitOptions,t=>((0,a.uX)(),(0,a.Wv)(k,{key:t.value,label:e.$t(t.labelKey),value:t.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])])]),_:1},8,["label"])),o.newToken.neverExpire?(0,a.Q3)("",!0):((0,a.uX)(),(0,a.Wv)(c,{key:1,label:e.$t("sysSecurity.autoDeleteOnExpire")},{default:(0,a.k6)(()=>[(0,a.bF)(v,{modelValue:o.newToken.autoDelete,"onUpdate:modelValue":t[27]||(t[27]=e=>o.newToken.autoDelete=e)},null,8,["modelValue"])]),_:1},8,["label"]))]),_:1},8,["model","rules"])]),_:1},8,["modelValue","title","width"]),(0,a.bF)(A,{modelValue:o.showEditTokenDialog,"onUpdate:modelValue":t[37]||(t[37]=e=>o.showEditTokenDialog=e),title:e.$t("sysSecurity.editTokenTitle"),width:l.dialogWidth},{footer:(0,a.k6)(()=>[(0,a.Lk)("span",Tg,[(0,a.bF)(p,{onClick:t[36]||(t[36]=e=>o.showEditTokenDialog=!1)},{default:(0,a.k6)(()=>[(0,a.eW)((0,n.v_)(e.$t("common.cancel")),1)]),_:1}),(0,a.bF)(p,{type:"primary",onClick:l.updateToken},{default:(0,a.k6)(()=>[(0,a.eW)((0,n.v_)(e.$t("sysSecurity.updateBtn")),1)]),_:1},8,["onClick"])])]),default:(0,a.k6)(()=>[(0,a.bF)(h,{model:o.editingToken,rules:l.editTokenRules,ref:"editTokenForm","label-width":"100px"},{default:(0,a.k6)(()=>[(0,a.bF)(c,{label:e.$t("sysSecurity.tokenNameLabel")},{default:(0,a.k6)(()=>[(0,a.bF)(r,{modelValue:o.editingToken.name,"onUpdate:modelValue":t[30]||(t[30]=e=>o.editingToken.name=e),disabled:""},null,8,["modelValue"])]),_:1},8,["label"]),(0,a.bF)(c,{label:e.$t("sysSecurity.permissionsLabel"),prop:"permissions"},{default:(0,a.k6)(()=>[(0,a.bF)(T,{modelValue:o.editingToken.permissions,"onUpdate:modelValue":t[31]||(t[31]=e=>o.editingToken.permissions=e)},{default:(0,a.k6)(()=>[(0,a.bF)(d,{label:"upload"},{default:(0,a.k6)(()=>[(0,a.eW)((0,n.v_)(e.$t("sysSecurity.permUpload")),1)]),_:1}),(0,a.bF)(d,{label:"delete"},{default:(0,a.k6)(()=>[(0,a.eW)((0,n.v_)(e.$t("sysSecurity.permDelete")),1)]),_:1}),(0,a.bF)(d,{label:"list"},{default:(0,a.k6)(()=>[(0,a.eW)((0,n.v_)(e.$t("sysSecurity.permList")),1)]),_:1}),(0,a.bF)(d,{label:"manage"},{default:(0,a.k6)(()=>[(0,a.eW)((0,n.v_)(e.$t("sysSecurity.permManage")),1)]),_:1})]),_:1},8,["modelValue"])]),_:1},8,["label"]),(0,a.bF)(c,{label:e.$t("sysSecurity.neverExpire")},{default:(0,a.k6)(()=>[(0,a.bF)(v,{modelValue:o.editingToken.neverExpire,"onUpdate:modelValue":t[32]||(t[32]=e=>o.editingToken.neverExpire=e),onChange:l.onEditNeverExpireChange},null,8,["modelValue","onChange"])]),_:1},8,["label"]),o.editingToken.neverExpire?(0,a.Q3)("",!0):((0,a.uX)(),(0,a.Wv)(c,{key:0,label:e.$t("sysSecurity.validPeriod"),prop:"expirationValue"},{default:(0,a.k6)(()=>[(0,a.Lk)("div",Fg,[(0,a.bF)(S,{modelValue:o.editingToken.expirationValue,"onUpdate:modelValue":t[33]||(t[33]=e=>o.editingToken.expirationValue=e),min:1,step:1,"controls-position":"right",style:{flex:"1"}},null,8,["modelValue"]),(0,a.bF)(C,{modelValue:o.editingToken.expirationUnit,"onUpdate:modelValue":t[34]||(t[34]=e=>o.editingToken.expirationUnit=e),style:{width:"100px"}},{default:(0,a.k6)(()=>[((0,a.uX)(!0),(0,a.CE)(a.FK,null,(0,a.pI)(o.timeUnitOptions,t=>((0,a.uX)(),(0,a.Wv)(k,{key:t.value,label:e.$t(t.labelKey),value:t.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])])]),_:1},8,["label"])),o.editingToken.neverExpire?(0,a.Q3)("",!0):((0,a.uX)(),(0,a.Wv)(c,{key:1,label:e.$t("sysSecurity.autoDeleteOnExpire")},{default:(0,a.k6)(()=>[(0,a.bF)(v,{modelValue:o.editingToken.autoDelete,"onUpdate:modelValue":t[35]||(t[35]=e=>o.editingToken.autoDelete=e)},null,8,["modelValue"])]),_:1},8,["label"]))]),_:1},8,["model","rules"])]),_:1},8,["modelValue","title","width"]),(0,a.bF)(A,{modelValue:o.showTokenResultDialog,"onUpdate:modelValue":t[40]||(t[40]=e=>o.showTokenResultDialog=e),title:e.$t("sysSecurity.tokenCreatedTitle"),width:l.dialogWidth},{footer:(0,a.k6)(()=>[(0,a.Lk)("span",Pg,[(0,a.bF)(p,{type:"primary",onClick:t[39]||(t[39]=e=>o.showTokenResultDialog=!1)},{default:(0,a.k6)(()=>[(0,a.eW)((0,n.v_)(e.$t("sysSecurity.savedBtn")),1)]),_:1})])]),default:(0,a.k6)(()=>[(0,a.Lk)("div",Ag,[(0,a.Lk)("p",Mg,[(0,a.bF)(u,{icon:"exclamation-triangle",style:{"margin-right":"5px"}}),(0,a.eW)(" "+(0,n.v_)(e.$t("sysSecurity.tokenCreatedWarning")),1)]),(0,a.bF)(h,{"label-width":"100px"},{default:(0,a.k6)(()=>[(0,a.bF)(c,{label:e.$t("sysSecurity.tokenNameLabel")},{default:(0,a.k6)(()=>[(0,a.Lk)("span",null,(0,n.v_)(o.createdToken.name),1)]),_:1},8,["label"]),(0,a.bF)(c,{label:e.$t("sysSecurity.fullToken")},{default:(0,a.k6)(()=>[(0,a.bF)(r,{modelValue:o.createdToken.token,"onUpdate:modelValue":t[38]||(t[38]=e=>o.createdToken.token=e),readonly:""},{append:(0,a.k6)(()=>[(0,a.bF)(p,{onClick:l.copyToken},{default:(0,a.k6)(()=>[(0,a.eW)((0,n.v_)(e.$t("sysSecurity.copyBtn")),1)]),_:1},8,["onClick"])]),_:1},8,["modelValue"])]),_:1},8,["label"])]),_:1})])]),_:1},8,["modelValue","title","width"])])),[[M,o.loading]])}s(81148);const Dg={s:1e3,m:6e4,h:36e5,d:864e5};function Vg(e,t,s){if(!Number.isFinite(t)||t<=0)throw new Error("有效期数值必须大于 0");const i="string"===typeof e?new Date(e):new Date(e.getTime());if(Dg[s])return new Date(i.getTime()+t*Dg[s]).toISOString();if("M"===s)return i.setUTCMonth(i.getUTCMonth()+t),i.toISOString();if("Y"===s)return i.setUTCFullYear(i.getUTCFullYear()+t),i.toISOString();throw new Error(`无效的时间单位: ${s}`)}function Lg(e){const t=new Date(e),s=t.getFullYear(),i=String(t.getMonth()+1).padStart(2,"0"),a=String(t.getDate()).padStart(2,"0"),n=String(t.getHours()).padStart(2,"0"),o=String(t.getMinutes()).padStart(2,"0"),l=String(t.getSeconds()).padStart(2,"0");return`${s}-${i}-${a} ${n}:${o}:${l}`}function Eg(e,t=new Date){if(null===e||void 0===e)return{status:"active",label:"有效",expiresText:"永不过期"};const s=new Date(e),i=t instanceof Date?t:new Date(t),a=Lg(e);return i.getTime()>s.getTime()?{status:"expired",label:"已过期",expiresText:a}:{status:"active",label:"有效",expiresText:a}}function Ig(e){return JSON.stringify(e,(e,t)=>t&&"object"===typeof t&&!Array.isArray(t)?Object.fromEntries(Object.keys(t).sort().map(e=>[e,t[e]])):t)}var Ug={data(){return{savedSettingsSnapshot:null}},computed:{hasUnsavedChanges(){return null!==this.savedSettingsSnapshot&&Ig(this.editableSettings)!==this.savedSettingsSnapshot}},methods:{markSettingsSaved(e=this.editableSettings){this.savedSettingsSnapshot=Ig(e)}}},Og={mixins:[Ug],components:{FloatingSaveButton:jp},data(){return{authSettings:{user:{},admin:{}},uploadSettings:{moderate:{},ipQuery:{enabled:!1,channel:"customApi",customApi:{url:"",params:[{key:"ip",value:"{ip}"}],responseFields:[]}}},accessSettings:{},apiTokens:[],loading:!0,saving:!1,tokenLoading:!1,oriUserPassword:"",oriAdminPassword:"",showUserPassConfirm:!1,showAdminPassConfirm:!1,clearUserPassword:!1,clearAdminPassword:!1,showCreateTokenDialog:!1,showEditTokenDialog:!1,showTokenResultDialog:!1,timeUnitOptions:[{labelKey:"sysSecurity.timeUnitSeconds",value:"s"},{labelKey:"sysSecurity.timeUnitMinutes",value:"m"},{labelKey:"sysSecurity.timeUnitHours",value:"h"},{labelKey:"sysSecurity.timeUnitDays",value:"d"},{labelKey:"sysSecurity.timeUnitMonths",value:"M"},{labelKey:"sysSecurity.timeUnitYears",value:"Y"}],newToken:{name:"",owner:"",permissions:[],neverExpire:!0,expirationValue:1,expirationUnit:"d",autoDelete:!1},editingToken:{id:"",name:"",owner:"",permissions:[],neverExpire:!0,expirationValue:1,expirationUnit:"d",autoDelete:!1},createdToken:{name:"",token:""}}},computed:{editableSettings(){return{auth:{user:{authCode:this.authSettings.user.authCode},admin:{adminUsername:this.authSettings.admin.adminUsername,adminPassword:this.authSettings.admin.adminPassword}},upload:this.uploadSettings,access:this.accessSettings,clearUserPassword:this.clearUserPassword,clearAdminPassword:this.clearAdminPassword}},dialogWidth(){return window.innerWidth>768?"50%":"90%"},userPassRules(){return{authCode:[{validator:(e,t,s)=>{const i=["%","&","?","#","/"],a=i.some(e=>t&&t.includes(e));a?s(new Error(this.$t("sysSecurity.passwordUrlReserved"))):s()},trigger:"blur"}],confirmNewUserPassword:[{validator:(e,t,s)=>{t?t!==this.authSettings.user.authCode?s(new Error(this.$t("sysSecurity.passwordMismatch"))):s():s(new Error(this.$t("sysSecurity.confirmUploadPassword")))},trigger:"blur"}]}},adminPassRules(){return{confirmNewAdminPassword:[{validator:(e,t,s)=>{t?t!==this.authSettings.admin.adminPassword?s(new Error(this.$t("sysSecurity.passwordMismatch"))):s():s(new Error(this.$t("sysSecurity.confirmAdminPassword")))},trigger:"blur"}]}},accessRules(){const e=(e,t,s)=>{!Number.isInteger(t)||t<1||t>3650?s(new Error(this.$t("sysSecurity.sessionMaxAgeInvalid"))):s()},t=(e,t,s)=>{if(!this.accessSettings.imageTransformEnabled||!t||!t.trim())return void s();const i=t.split(",").map(e=>e.trim().toLowerCase()).filter(Boolean),a=i.every(e=>{const t=e.match(/^(auto|[1-9]\d*)x(auto|[1-9]\d*)$/);return!(!t||"auto"===t[1]&&"auto"===t[2])&&t.slice(1).every(e=>"auto"===e||Number(e)<=4096)});a?s():s(new Error(this.$t("sysSecurity.imageTransformAllowedSizesInvalid")))};return{userSessionMaxAge:[{validator:e,trigger:"change"}],adminSessionMaxAge:[{validator:e,trigger:"change"}],imageTransformAllowedSizes:[{validator:t,trigger:["blur","change"]}]}},tokenRules(){return{name:[{required:!0,message:this.$t("sysSecurity.tokenNameRequired"),trigger:"blur"}],permissions:[{required:!0,message:this.$t("sysSecurity.permissionsRequired"),trigger:"change"}],expirationValue:[{validator:(e,t,s)=>{this.newToken.neverExpire||t&&!(t<=0)?s():s(new Error(this.$t("sysSecurity.validPeriodRequired")))},trigger:"blur"}]}},editTokenRules(){return{permissions:[{required:!0,message:this.$t("sysSecurity.permissionsRequired"),trigger:"change"}],expirationValue:[{validator:(e,t,s)=>{this.editingToken.neverExpire||t&&!(t<=0)?s():s(new Error(this.$t("sysSecurity.validPeriodRequired")))},trigger:"blur"}]}}},methods:{normalizeIpQuerySettings(e={}){const t=e.ipQuery||{},s=t.customApi||{},i=Array.isArray(s.params)&&s.params.length>0?s.params.map(e=>({key:e?.key||"",value:e?.value||""})):[{key:"ip",value:"{ip}"}],a=Array.isArray(s.responseFields)?s.responseFields.map(e=>"string"===typeof e?e:e?.path||""):[];return{...e,moderate:e.moderate||{},ipQuery:{enabled:t.enabled??!1,channel:t.channel||"customApi",customApi:{url:s.url||"",params:i,responseFields:a}}}},addIpQueryParam(){this.uploadSettings.ipQuery.customApi.params.push({key:"",value:""})},removeIpQueryParam(e){this.uploadSettings.ipQuery.customApi.params.length<=1||this.uploadSettings.ipQuery.customApi.params.splice(e,1)},addIpQueryResponseField(){this.uploadSettings.ipQuery.customApi.responseFields.push("")},removeIpQueryResponseField(e){this.uploadSettings.ipQuery.customApi.responseFields.splice(e,1)},moveIpQueryResponseField(e,t){const s=this.uploadSettings.ipQuery.customApi.responseFields,i=e+t;if(i<0||i>=s.length)return;const[a]=s.splice(e,1);s.splice(i,0,a)},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},handleClearUserPassword(e){e&&(this.authSettings.user.authCode="",this.showUserPassConfirm=!1)},handleClearAdminPassword(e){e&&(this.authSettings.admin.adminPassword="",this.authSettings.admin.adminUsername="",this.showAdminPassConfirm=!1)},getPermissionText(e){const t={upload:this.$t("sysSecurity.permUpload"),delete:this.$t("sysSecurity.permDelete"),list:this.$t("sysSecurity.permList"),manage:this.$t("sysSecurity.permManage")};return t[e]||e},formatDate(e){return new Date(e).toLocaleString("zh-CN")},async loadApiTokens(){this.tokenLoading=!0;try{const e=await(0,Ot.A)("/api/manage/apiTokens"),t=await e.json();this.apiTokens=t.tokens||[]}catch(e){this.$message.error(this.$t("sysSecurity.tokenListFailed"))}finally{this.tokenLoading=!1}},createToken(){this.$refs.tokenForm.validate(async e=>{if(e)try{this.newToken.owner="admin";let e=null,t=!1;this.newToken.neverExpire||(e=Vg(new Date,this.newToken.expirationValue,this.newToken.expirationUnit),t=this.newToken.autoDelete);const s=await(0,Ot.A)("/api/manage/apiTokens",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:this.newToken.name,owner:this.newToken.owner,permissions:this.newToken.permissions,expiresAt:e,autoDelete:t})}),i=await s.json();s.ok?(this.createdToken={name:i.name,token:i.token},this.showCreateTokenDialog=!1,this.showTokenResultDialog=!0,this.newToken={name:"",owner:"",permissions:[],neverExpire:!0,expirationValue:1,expirationUnit:"d",autoDelete:!1},await this.loadApiTokens(),this.$message.success(this.$t("sysSecurity.tokenCreateSuccess"))):this.$message.error(i.error||this.$t("sysSecurity.tokenCreateFailed"))}catch(t){this.$message.error(this.$t("sysSecurity.tokenCreateFailed"))}})},editToken(e){const t=null!==e.expiresAt&&void 0!==e.expiresAt;this.editingToken={id:e.id,name:e.name,owner:e.owner,permissions:[...e.permissions],neverExpire:!t,expirationValue:1,expirationUnit:"d",autoDelete:e.autoDelete||!1},this.showEditTokenDialog=!0},updateToken(){this.$refs.editTokenForm.validate(async e=>{if(e)try{let e=null,t=!1;this.editingToken.neverExpire||(e=Vg(new Date,this.editingToken.expirationValue,this.editingToken.expirationUnit),t=this.editingToken.autoDelete);const s=await(0,Ot.A)("/api/manage/apiTokens",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({tokenId:this.editingToken.id,permissions:this.editingToken.permissions,expiresAt:e,autoDelete:t})}),i=await s.json();s.ok?(this.showEditTokenDialog=!1,await this.loadApiTokens(),this.$message.success(this.$t("sysSecurity.tokenUpdateSuccess"))):this.$message.error(i.error||this.$t("sysSecurity.tokenUpdateFailed"))}catch(t){this.$message.error(this.$t("sysSecurity.tokenUpdateFailed"))}})},async deleteToken(e){try{await this.$confirm(this.$t("sysSecurity.tokenDeleteConfirm"),this.$t("sysSecurity.tokenDeleteConfirmTitle"),{confirmButtonText:this.$t("sysSecurity.tokenDeleteConfirmOk"),cancelButtonText:this.$t("sysSecurity.tokenDeleteConfirmCancel"),type:"warning"});const t=await(0,Ot.A)(`/api/manage/apiTokens?id=${e}`,{method:"DELETE"}),s=await t.json();t.ok?(await this.loadApiTokens(),this.$message.success(this.$t("sysSecurity.tokenDeleteSuccess"))):this.$message.error(s.error||this.$t("sysSecurity.tokenDeleteFailed"))}catch(t){"cancel"!==t&&this.$message.error(this.$t("sysSecurity.tokenDeleteFailed"))}},async copyToken(){try{await navigator.clipboard.writeText(this.createdToken.token),this.$message.success(this.$t("sysSecurity.tokenCopied"))}catch(e){this.$message.error(this.$t("sysSecurity.copyFailed"))}},onCreateNeverExpireChange(e){e&&(this.newToken.autoDelete=!1)},onEditNeverExpireChange(e){e&&(this.editingToken.autoDelete=!1)},getTokenStatus(e){return Eg(e)},saveSettings(){if(this.saving)return;this.saving=!0;let e=[];return e.push(new Promise(e=>{this.$refs.userPassForm.validate(t=>{e(t)})})),e.push(new Promise(e=>{this.$refs.adminPassForm.validate(t=>{e(t)})})),e.push(new Promise(e=>{this.$refs.accessForm.validate(t=>{e(t)})})),e.push(new Promise(e=>{this.$refs.imageTransformForm.validate(t=>{e(t)})})),Promise.all(e).then(e=>{const t=e.every(e=>e);if(!t)return;if(this.accessSettings.userSessionMaxAge<1||!Number.isInteger(this.accessSettings.userSessionMaxAge)||this.accessSettings.userSessionMaxAge>3650||this.accessSettings.adminSessionMaxAge<1||!Number.isInteger(this.accessSettings.adminSessionMaxAge)||this.accessSettings.adminSessionMaxAge>3650)return void this.$message.error(this.$t("sysSecurity.sessionMaxAgeInvalid"));const s=JSON.parse(JSON.stringify({auth:this.authSettings,upload:this.uploadSettings,access:this.accessSettings}));return delete s.auth.user.confirmNewUserPassword,delete s.auth.admin.confirmNewAdminPassword,this.clearUserPassword&&(s.auth.user._clear=!0,s.auth.user.authCode=""),this.clearAdminPassword&&(s.auth.admin._clear=!0,s.auth.admin.adminPassword=""),(0,Ot.A)("/api/manage/sysConfig/security",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)}).then(e=>{if(!e.ok)throw new Error(this.$t("floatingSave.failed"));return e.json()}).then(e=>{if(e.adminPasswordChanged){this.markSettingsSaved();const e=this.$t("sysSecurity.adminPasswordChangedRelogin");return this.$message.warning(e),void setTimeout(()=>{this.$store.commit("setAdminLoggedIn",!1),this.$router.push("/adminLogin")},1500)}this.$message.success(this.$t("sysSecurity.settingsSaved")),this.authSettings.user.authCode="",this.authSettings.admin.adminPassword="",this.authSettings.user.confirmNewUserPassword="",this.authSettings.admin.confirmNewAdminPassword="",this.oriUserPassword="",this.oriAdminPassword="",s.auth.user.authCode&&!s.auth.user._clear?this.authSettings.user._hasPassword=!0:s.auth.user._clear&&(this.authSettings.user._hasPassword=!1),s.auth.admin.adminPassword&&!s.auth.admin._clear?this.authSettings.admin._hasPassword=!0:s.auth.admin._clear&&(this.authSettings.admin._hasPassword=!1),this.showUserPassConfirm=!1,this.showAdminPassConfirm=!1,this.clearUserPassword=!1,this.clearAdminPassword=!1,this.markSettingsSaved()})}).catch(()=>{this.$message.error(this.$t("floatingSave.failed"))}).finally(()=>{this.saving=!1})}},mounted(){this.loading=!0,(0,Ot.A)("/api/manage/sysConfig/security").then(e=>e.json()).then(async e=>{this.authSettings=e.auth,this.uploadSettings=this.normalizeIpQuerySettings(e.upload),this.accessSettings={imageTransformEnabled:!1,imageTransformAllowedSizes:"",...e.access},this.oriUserPassword="",this.oriAdminPassword="",this.authSettings.user.confirmNewUserPassword="",this.authSettings.admin.confirmNewAdminPassword="",await this.$nextTick(),this.markSettingsSaved(),this.loadApiTokens()}).finally(()=>{this.loading=!1})}};const Rg=(0,u.A)(Og,[["render",$g],["__scopeId","data-v-d622bb02"]]);var Wg=Rg;const Ng={class:"page-settings"},zg={class:"first-title"},Bg={key:5,class:"announcement-refresh-option"};function jg(e,t,s,i,o,l){const r=(0,a.g2)("font-awesome-icon"),d=x.R7,c=Lu.P9,h=Lu.AV,u=Eu.qi,p=Vu.WK,g=Op.dI,m=$u.xE,f=$u.US,b=jp,v=y.A;return(0,a.bo)(((0,a.uX)(),(0,a.CE)("div",Ng,[((0,a.uX)(!0),(0,a.CE)(a.FK,null,(0,a.pI)(l.groupedSettings,(s,i)=>((0,a.uX)(),(0,a.CE)("div",{key:i,class:"first-settings"},[(0,a.Lk)("h3",zg,(0,n.v_)(i),1),(0,a.bF)(f,{model:o.settings,"label-width":"150px"},{default:(0,a.k6)(()=>[((0,a.uX)(!0),(0,a.CE)(a.FK,null,(0,a.pI)(s,(s,i)=>((0,a.uX)(),(0,a.Wv)(m,{key:s.id,class:(0,n.C4)({"announcement-manual-height":"announcement"===s.id&&null!==o.announcementManualHeight}),style:(0,n.Tr)("announcement"===s.id&&null!==o.announcementManualHeight?{"--announcement-manual-height":`${o.announcementManualHeight}px`}:void 0)},{label:(0,a.k6)(()=>[(0,a.eW)((0,n.v_)(l.localized(s,"label"))+" ",1),s.tooltip?((0,a.uX)(),(0,a.Wv)(d,{key:0,content:l.localized(s,"tooltip"),placement:"top","raw-content":""},{default:(0,a.k6)(()=>[(0,a.bF)(r,{icon:"question-circle",style:{"margin-left":"5px",cursor:"pointer"}})]),_:1},8,["content"])):(0,a.Q3)("",!0)]),default:(0,a.k6)(()=>["select"===s.type?((0,a.uX)(),(0,a.Wv)(h,{key:0,modelValue:s.value,"onUpdate:modelValue":e=>s.value=e,disabled:s.fixed,placeholder:l.localized(s,"placeholder"),style:{width:"100%"}},{default:(0,a.k6)(()=>[((0,a.uX)(!0),(0,a.CE)(a.FK,null,(0,a.pI)(s.options,e=>((0,a.uX)(),(0,a.Wv)(c,{key:e.value,label:l.localizedOption(e),value:e.value},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","disabled","placeholder"])):"channelName"===s.type?((0,a.uX)(),(0,a.Wv)(h,{key:1,modelValue:s.value,"onUpdate:modelValue":e=>s.value=e,disabled:!l.currentUploadChannel||0===l.currentChannelList.length,placeholder:e.$t("sysPage.channelSelectPlaceholder"),clearable:"",style:{width:"100%"}},{default:(0,a.k6)(()=>[((0,a.uX)(!0),(0,a.CE)(a.FK,null,(0,a.pI)(l.currentChannelList,e=>((0,a.uX)(),(0,a.Wv)(c,{key:e.name,label:e.name,value:e.name},null,8,["label","value"]))),128))]),_:1},8,["modelValue","onUpdate:modelValue","disabled","placeholder"])):"boolean"===s.type?((0,a.uX)(),(0,a.Wv)(u,{key:2,modelValue:s.value,"onUpdate:modelValue":e=>s.value=e,disabled:s.fixed},null,8,["modelValue","onUpdate:modelValue","disabled"])):"textarea"===s.type?((0,a.uX)(),(0,a.Wv)(p,{key:3,modelValue:s.value,"onUpdate:modelValue":e=>s.value=e,type:"textarea",autosize:{minRows:2,maxRows:"announcement"===s.id?8:void 0},resize:"vertical",disabled:s.fixed,placeholder:l.localized(s,"placeholder"),onMousedown:e=>l.handleAnnouncementResizeStart(e,s)},null,8,["modelValue","onUpdate:modelValue","autosize","disabled","placeholder","onMousedown"])):((0,a.uX)(),(0,a.Wv)(p,{key:4,modelValue:s.value,"onUpdate:modelValue":e=>s.value=e,disabled:s.fixed,placeholder:l.localized(s,"placeholder")},null,8,["modelValue","onUpdate:modelValue","disabled","placeholder"])),"announcement"===s.id?((0,a.uX)(),(0,a.CE)("div",Bg,[(0,a.bF)(g,{modelValue:o.refreshAnnouncement,"onUpdate:modelValue":t[0]||(t[0]=e=>o.refreshAnnouncement=e)},{default:(0,a.k6)(()=>[(0,a.eW)((0,n.v_)(e.$t("sysPage.refreshAnnouncement")),1)]),_:1},8,["modelValue"])])):(0,a.Q3)("",!0)]),_:2},1032,["class","style"]))),128))]),_:2},1032,["model"])]))),128)),(0,a.bF)(b,{show:!o.loading,loading:o.saving,dirty:e.hasUnsavedChanges,onClick:l.saveSettings},null,8,["show","loading","dirty","onClick"])])),[[v,o.loading]])}var Hg=s(457),qg={mixins:[Ug],components:{FloatingSaveButton:jp},data(){return{settings:{config:[]},loading:!0,saving:!1,refreshAnnouncement:!1,announcementManualHeight:null,announcementResizeMouseUpHandler:null,availableChannels:{}}},computed:{editableSettings(){return{config:this.settings.config.map(({id:e,value:t})=>({id:e,value:t})),refreshAnnouncement:this.refreshAnnouncement}},isEn(){return"en"===this.$i18n.locale},groupedSettings(){const e={};return this.settings.config&&this.settings.config.forEach(t=>{const s=this.isEn?t.category_en||t.category||this.$t("sysPage.otherSettings"):t.category||this.$t("sysPage.otherSettings");e[s]||(e[s]=[]),e[s].push(t)}),e},currentUploadChannel(){const e=this.settings.config?.find(e=>"defaultUploadChannel"===e.id);return e?.value||""},currentChannelList(){return this.availableChannels[this.currentUploadChannel]||[]}},watch:{currentUploadChannel(e,t){if(!this.loading&&e!==t){const t=this.settings.config?.find(e=>"defaultChannelName"===e.id);if(t){const s=this.availableChannels[e]||[];s.some(e=>e.name===t.value)||(t.value="")}}}},methods:{localized(e,t){return this.isEn&&e[t+"_en"]?e[t+"_en"]:e[t]||""},localizedOption(e){return this.isEn&&e.label_en?e.label_en:e.label},handleAnnouncementResizeStart(e,t){if("announcement"!==t.id)return;const s=e.target.closest?.("textarea");if(!s)return;const i=s.getBoundingClientRect(),a=24,n=e.clientX>=i.right-a&&e.clientY>=i.bottom-a;if(!n)return;const o=s.closest(".el-form-item");this.announcementResizeMouseUpHandler&&window.removeEventListener("mouseup",this.announcementResizeMouseUpHandler);const l=s.offsetHeight;s.style.height=`${l}px`,o?.classList.remove("announcement-manual-height"),this.announcementResizeMouseUpHandler=()=>{const e=s.offsetHeight,t=Math.abs(e-l)>1?e:this.announcementManualHeight;null!==t&&(this.announcementManualHeight=t,o?.style.setProperty("--announcement-manual-height",`${t}px`),o?.classList.add("announcement-manual-height")),this.announcementResizeMouseUpHandler=null},window.addEventListener("mouseup",this.announcementResizeMouseUpHandler,{once:!0})},async saveSettings(){if(this.saving)return;const e=JSON.parse(JSON.stringify({...this.settings,refreshAnnouncement:this.refreshAnnouncement}));this.saving=!0;try{const t=await(0,Ot.A)("/api/manage/sysConfig/page",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok)throw new Error(this.$t("floatingSave.failed"));this.refreshAnnouncement===e.refreshAnnouncement&&(this.refreshAnnouncement=!1),this.markSettingsSaved({config:e.config.map(({id:e,value:t})=>({id:e,value:t})),refreshAnnouncement:!1}),this.$message.success(this.$t("sysPage.settingsSaved"))}catch{this.$message.error(this.$t("floatingSave.failed"))}finally{this.saving=!1}},async fetchAvailableChannels(){try{const e=await Hg.A.get("/api/channels");e.data&&(this.availableChannels=e.data)}catch(e){console.error("Failed to fetch available channels:",e)}}},beforeUnmount(){this.announcementResizeMouseUpHandler&&window.removeEventListener("mouseup",this.announcementResizeMouseUpHandler)},mounted(){this.loading=!0,this.fetchAvailableChannels(),(0,Ot.A)("/api/manage/sysConfig/page").then(e=>e.json()).then(async e=>{this.settings=e,this.settings.config&&this.settings.config.forEach(e=>{void 0!==e.value&&null!==e.value&&""!==e.value||void 0===e.default||(e.value=e.default),"boolean"===e.type&&"string"===typeof e.value&&(e.value="true"===e.value)}),await this.$nextTick(),this.markSettingsSaved()}).finally(()=>{this.loading=!1})}};const Xg=(0,u.A)(qg,[["render",jg],["__scopeId","data-v-0c5bff6e"]]);var Kg=Xg;const Qg={class:"others-settings"},Yg={class:"first-settings"},Gg={class:"first-title"},Jg={class:"first-title"},Zg={class:"first-title"},em={class:"first-title"},tm=["innerHTML"],sm={class:"first-title"};function im(e,t,s,i,o,l){const r=(0,a.g2)("font-awesome-icon"),d=x.R7,c=Eu.qi,h=$u.xE,u=$u.US,p=Vu.WK,g=Lu.P9,m=Lu.AV,f=jp,b=y.A;return(0,a.bo)(((0,a.uX)(),(0,a.CE)("div",Qg,[(0,a.Lk)("div",Yg,[(0,a.Lk)("h3",Gg,[(0,a.eW)((0,n.v_)(e.$t("sysOthers.remoteTelemetry"))+" ",1),(0,a.bF)(d,{content:e.$t("sysOthers.remoteTelemetryTooltip"),placement:"right"},{default:(0,a.k6)(()=>[(0,a.bF)(r,{icon:"question-circle",style:{"margin-left":"5px",cursor:"pointer"}})]),_:1},8,["content"])]),(0,a.bF)(u,{model:o.settings.telemetry,"label-width":"120px"},{default:(0,a.k6)(()=>[(0,a.bF)(h,{label:e.$t("sysOthers.enable")},{default:(0,a.k6)(()=>[(0,a.bF)(c,{modelValue:o.settings.telemetry.enabled,"onUpdate:modelValue":t[0]||(t[0]=e=>o.settings.telemetry.enabled=e),disabled:o.settings.telemetry.fixed},null,8,["modelValue","disabled"])]),_:1},8,["label"])]),_:1},8,["model"]),(0,a.Lk)("h3",Jg,[(0,a.eW)((0,n.v_)(e.$t("sysOthers.cloudflareApiToken"))+" ",1),(0,a.bF)(d,{content:e.$t("sysOthers.cloudflareApiTokenTooltip"),placement:"right","raw-content":""},{default:(0,a.k6)(()=>[(0,a.bF)(r,{icon:"question-circle",style:{"margin-left":"5px",cursor:"pointer"}})]),_:1},8,["content"])]),(0,a.bF)(u,{model:o.settings.cloudflareApiToken,"label-width":"120px"},{default:(0,a.k6)(()=>[(0,a.bF)(h,{label:e.$t("sysOthers.zoneId")},{default:(0,a.k6)(()=>[(0,a.bF)(p,{modelValue:o.settings.cloudflareApiToken.CF_ZONE_ID,"onUpdate:modelValue":t[1]||(t[1]=e=>o.settings.cloudflareApiToken.CF_ZONE_ID=e),disabled:o.settings.cloudflareApiToken.fixed},null,8,["modelValue","disabled"])]),_:1},8,["label"]),(0,a.bF)(h,{label:e.$t("sysOthers.accountEmail")},{default:(0,a.k6)(()=>[(0,a.bF)(p,{modelValue:o.settings.cloudflareApiToken.CF_EMAIL,"onUpdate:modelValue":t[2]||(t[2]=e=>o.settings.cloudflareApiToken.CF_EMAIL=e),disabled:o.settings.cloudflareApiToken.fixed},null,8,["modelValue","disabled"])]),_:1},8,["label"]),(0,a.bF)(h,{label:"API Key"},{default:(0,a.k6)(()=>[(0,a.bF)(p,{modelValue:o.settings.cloudflareApiToken.CF_API_KEY,"onUpdate:modelValue":t[3]||(t[3]=e=>o.settings.cloudflareApiToken.CF_API_KEY=e),disabled:o.settings.cloudflareApiToken.fixed,type:"password","show-password":"",autocomplete:"new-password"},null,8,["modelValue","disabled"])]),_:1})]),_:1},8,["model"]),(0,a.Lk)("h3",Zg,[(0,a.eW)((0,n.v_)(e.$t("sysOthers.randomImageApi"))+" ",1),(0,a.bF)(d,{content:e.$t("sysOthers.randomImageApiTooltip"),placement:"right"},{default:(0,a.k6)(()=>[(0,a.bF)(r,{icon:"question-circle",style:{"margin-left":"5px",cursor:"pointer"}})]),_:1},8,["content"])]),(0,a.bF)(u,{model:o.settings.randomImageAPI,"label-width":"120px"},{default:(0,a.k6)(()=>[(0,a.bF)(h,{label:e.$t("sysOthers.enable")},{default:(0,a.k6)(()=>[(0,a.bF)(c,{modelValue:o.settings.randomImageAPI.enabled,"onUpdate:modelValue":t[4]||(t[4]=e=>o.settings.randomImageAPI.enabled=e),disabled:o.settings.randomImageAPI.fixed},null,8,["modelValue","disabled"])]),_:1},8,["label"]),(0,a.bF)(h,{prop:"randomImageAPI.allowedDir"},{label:(0,a.k6)(()=>[(0,a.Lk)("span",null,(0,n.v_)(e.$t("sysOthers.directory")),1),(0,a.bF)(d,{content:e.$t("sysOthers.directoryTooltip"),placement:"right","raw-content":""},{default:(0,a.k6)(()=>[(0,a.bF)(r,{icon:"question-circle",style:{"margin-left":"5px",cursor:"pointer"}})]),_:1},8,["content"])]),default:(0,a.k6)(()=>[(0,a.bF)(p,{modelValue:o.settings.randomImageAPI.allowedDir,"onUpdate:modelValue":t[5]||(t[5]=e=>o.settings.randomImageAPI.allowedDir=e),disabled:o.settings.randomImageAPI.fixed},null,8,["modelValue","disabled"])]),_:1})]),_:1},8,["model"]),(0,a.Lk)("h3",em,[(0,a.eW)((0,n.v_)(e.$t("sysOthers.publicBrowse"))+" ",1),(0,a.bF)(d,{content:e.$t("sysOthers.publicBrowseTooltip"),placement:"right","raw-content":""},{default:(0,a.k6)(()=>[(0,a.bF)(r,{icon:"question-circle",style:{"margin-left":"5px",cursor:"pointer"}})]),_:1},8,["content"])]),(0,a.bF)(u,{model:o.settings.publicBrowse,"label-width":"120px"},{default:(0,a.k6)(()=>[(0,a.bF)(h,{label:e.$t("sysOthers.enable")},{default:(0,a.k6)(()=>[(0,a.bF)(c,{modelValue:o.settings.publicBrowse.enabled,"onUpdate:modelValue":t[6]||(t[6]=e=>o.settings.publicBrowse.enabled=e),disabled:o.settings.publicBrowse.fixed},null,8,["modelValue","disabled"])]),_:1},8,["label"]),(0,a.bF)(h,{prop:"publicBrowse.allowedDir"},{label:(0,a.k6)(()=>[(0,a.Lk)("span",null,(0,n.v_)(e.$t("sysOthers.openDirectory")),1),(0,a.bF)(d,{placement:"right","raw-content":""},{content:(0,a.k6)(()=>[(0,a.Lk)("div",{style:{"max-width":"320px","line-height":"1.6"},innerHTML:e.$t("sysOthers.openDirectoryTooltip")},null,8,tm)]),default:(0,a.k6)(()=>[(0,a.bF)(r,{icon:"question-circle",style:{"margin-left":"5px",cursor:"pointer"}})]),_:1})]),default:(0,a.k6)(()=>[(0,a.bF)(p,{modelValue:o.settings.publicBrowse.allowedDir,"onUpdate:modelValue":t[7]||(t[7]=e=>o.settings.publicBrowse.allowedDir=e),disabled:o.settings.publicBrowse.fixed,placeholder:"wallpaper,photos,album"},null,8,["modelValue","disabled"])]),_:1})]),_:1},8,["model"]),(0,a.Lk)("h3",sm,[(0,a.eW)((0,n.v_)(e.$t("sysOthers.webdav"))+" ",1),(0,a.bF)(d,{content:e.$t("sysOthers.webdavTooltip"),placement:"right","raw-content":""},{default:(0,a.k6)(()=>[(0,a.bF)(r,{icon:"question-circle",style:{"margin-left":"5px",cursor:"pointer"}})]),_:1},8,["content"])]),(0,a.bF)(u,{model:o.settings.webDAV,"label-width":"120px"},{default:(0,a.k6)(()=>[(0,a.bF)(h,{label:e.$t("sysOthers.enable")},{default:(0,a.k6)(()=>[(0,a.bF)(c,{modelValue:o.settings.webDAV.enabled,"onUpdate:modelValue":t[8]||(t[8]=e=>o.settings.webDAV.enabled=e),disabled:o.settings.webDAV.fixed},null,8,["modelValue","disabled"])]),_:1},8,["label"]),(0,a.bF)(h,{label:e.$t("sysOthers.webdavUsername")},{default:(0,a.k6)(()=>[(0,a.bF)(p,{modelValue:o.settings.webDAV.username,"onUpdate:modelValue":t[9]||(t[9]=e=>o.settings.webDAV.username=e),disabled:o.settings.webDAV.fixed},null,8,["modelValue","disabled"])]),_:1},8,["label"]),(0,a.bF)(h,{label:e.$t("sysOthers.webdavPassword")},{default:(0,a.k6)(()=>[(0,a.bF)(p,{modelValue:o.settings.webDAV.password,"onUpdate:modelValue":t[10]||(t[10]=e=>o.settings.webDAV.password=e),disabled:o.settings.webDAV.fixed,type:"password","show-password":"",autocomplete:"new-password"},null,8,["modelValue","disabled"])]),_:1},8,["label"]),(0,a.bF)(h,{label:e.$t("sysOthers.webdavUploadChannel")},{default:(0,a.k6)(()=>[(0,a.bF)(m,{modelValue:o.settings.webDAV.uploadChannel,"onUpdate:modelValue":t[11]||(t[11]=e=>o.settings.webDAV.uploadChannel=e),disabled:o.settings.webDAV.fixed,placeholder:e.$t("sysOthers.webdavDefaultChannel"),clearable:""},{default:(0,a.k6)(()=>[(0,a.bF)(g,{label:"Telegram",value:"telegram"}),(0,a.bF)(g,{label:"Cloudflare R2",value:"cfr2"}),(0,a.bF)(g,{label:"S3",value:"s3"}),(0,a.bF)(g,{label:"Discord",value:"discord"}),(0,a.bF)(g,{label:"HuggingFace",value:"huggingface"}),(0,a.bF)(g,{label:"WebDAV",value:"webdav"})]),_:1},8,["modelValue","disabled","placeholder"])]),_:1},8,["label"]),o.settings.webDAV.uploadChannel&&l.webdavChannelList.length>1?((0,a.uX)(),(0,a.Wv)(h,{key:0,label:e.$t("sysOthers.webdavChannelName")},{default:(0,a.k6)(()=>[(0,a.bF)(m,{modelValue:o.settings.webDAV.channelName,"onUpdate:modelValue":t[12]||(t[12]=e=>o.settings.webDAV.channelName=e),disabled:o.settings.webDAV.fixed,placeholder:e.$t("uploadSettings.autoSelect"),clearable:""},{default:(0,a.k6)(()=>[((0,a.uX)(!0),(0,a.CE)(a.FK,null,(0,a.pI)(l.webdavChannelList,e=>((0,a.uX)(),(0,a.Wv)(g,{key:e.name,label:e.name,value:e.name},null,8,["label","value"]))),128))]),_:1},8,["modelValue","disabled","placeholder"])]),_:1},8,["label"])):(0,a.Q3)("",!0)]),_:1},8,["model"])]),(0,a.bF)(f,{show:!o.loading,loading:o.saving,dirty:e.hasUnsavedChanges,onClick:l.saveSettings},null,8,["show","loading","dirty","onClick"])])),[[b,o.loading]])}var am={mixins:[Ug],components:{FloatingSaveButton:jp},data(){return{settings:{telemetry:{},randomImageAPI:{},cloudflareApiToken:{},webDAV:{},publicBrowse:{}},availableChannels:{},loading:!0,saving:!1}},computed:{editableSettings(){return this.settings},webdavChannelList(){const e=this.settings.webDAV?.uploadChannel;return e&&this.availableChannels[e]||[]}},watch:{"settings.webDAV.uploadChannel"(){!this.loading&&this.settings.webDAV&&(this.settings.webDAV.channelName="")}},methods:{async saveSettings(){if(this.saving)return;const e=JSON.parse(JSON.stringify(this.settings));this.saving=!0;try{const t=await(0,Ot.A)("/api/manage/sysConfig/others",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok)throw new Error(this.$t("floatingSave.failed"));this.markSettingsSaved(e),this.$message.success(this.$t("sysOthers.settingsSaved"))}catch{this.$message.error(this.$t("floatingSave.failed"))}finally{this.saving=!1}},async fetchAvailableChannels(){try{const e=await(0,Ot.A)("/api/channels");e.ok&&(this.availableChannels=await e.json())}catch(e){console.error("Failed to fetch available channels:",e)}}},mounted(){this.loading=!0,(0,Ot.A)("/api/manage/sysConfig/others").then(e=>e.json()).then(async e=>{this.settings=e,await this.$nextTick(),this.markSettingsSaved()}).finally(()=>{this.loading=!1}),this.fetchAvailableChannels()}};const nm=(0,u.A)(am,[["render",im],["__scopeId","data-v-2841888b"]]);var om=nm,lm=s(89559);s(85332);const rm={class:"ai-settings"},dm={key:0,class:"first-settings"},cm={class:"first-title"},hm={class:"basic-settings"},um={class:"resource-group"},pm={class:"group-header"},gm={class:"resource-title-icon"},mm={class:"resource-title-text"},fm={key:0,class:"empty-card"},bm={class:"empty-icon"},ym={class:"empty-title"},vm={key:1,class:"resource-cards"},xm={class:"card-header"},km={class:"card-title"},_m={class:"card-body"},wm={class:"card-info"},Cm=["title"],Sm={class:"card-info"},Fm={class:"card-actions"},Tm={class:"resource-group"},Am={class:"group-header"},Mm={class:"resource-title-icon"},Pm={class:"resource-title-text"},$m={key:0,class:"empty-card"},Dm={class:"empty-icon"},Vm={class:"empty-title"},Lm={key:1,class:"resource-cards"},Em={class:"card-header"},Im={class:"card-title"},Um={class:"model-capabilities"},Om={class:"card-body"},Rm={class:"card-info"},Wm={class:"card-actions"},Nm={class:"first-title"},zm={class:"first-title"},Bm={class:"json-mode-hint"};function jm(e,t,s,i,o,l){const r=Eu.qi,d=$u.xE,c=Du.lq,h=$u.US,u=(0,a.g2)("font-awesome-icon"),p=Iu.u,g=X.S2,m=x.R7,f=Vu.WK,b=Lu.P9,v=Lu.AV,k=jp,w=lm.KR,C=Op.dI,S=_.kZ,F=y.A;return(0,a.bo)(((0,a.uX)(),(0,a.CE)("div",rm,[o.settings?((0,a.uX)(),(0,a.CE)("div",dm,[(0,a.Lk)("h3",cm,(0,n.v_)(e.$t("sysAI.general")),1),(0,a.Lk)("section",hm,[(0,a.bF)(h,{"label-width":"120px",disabled:o.saving},{default:(0,a.k6)(()=>[(0,a.bF)(d,{label:e.$t("sysAI.enable")},{default:(0,a.k6)(()=>[(0,a.bF)(r,{modelValue:o.settings.enabled,"onUpdate:modelValue":t[0]||(t[0]=e=>o.settings.enabled=e)},null,8,["modelValue"])]),_:1},8,["label"]),(0,a.bF)(d,{label:e.$t("sysAI.timeout")},{default:(0,a.k6)(()=>[(0,a.bF)(c,{modelValue:o.settings.execution.providerTimeoutMs,"onUpdate:modelValue":t[1]||(t[1]=e=>o.settings.execution.providerTimeoutMs=e),min:1e3,max:2e4,step:1e3},null,8,["modelValue"])]),_:1},8,["label"]),(0,a.bF)(d,{label:e.$t("sysAI.batchSize")},{default:(0,a.k6)(()=>[(0,a.bF)(c,{modelValue:o.settings.execution.maxBatchSize,"onUpdate:modelValue":t[2]||(t[2]=e=>o.settings.execution.maxBatchSize=e),min:1,max:3},null,8,["modelValue"])]),_:1},8,["label"]),(0,a.bF)(d,{label:e.$t("sysAI.concurrency")},{default:(0,a.k6)(()=>[(0,a.bF)(c,{modelValue:o.settings.execution.concurrency,"onUpdate:modelValue":t[3]||(t[3]=e=>o.settings.execution.concurrency=e),min:1,max:2},null,8,["modelValue"])]),_:1},8,["label"])]),_:1},8,["disabled"]),(0,a.Lk)("div",um,[(0,a.Lk)("div",pm,[(0,a.Lk)("h4",null,[(0,a.Lk)("span",gm,[(0,a.bF)(u,{icon:"server"})]),(0,a.Lk)("span",mm,(0,n.v_)(e.$t("sysAI.providers")),1),(0,a.bF)(p,{size:"small",type:"info"},{default:(0,a.k6)(()=>[(0,a.eW)((0,n.v_)(o.settings.providers.length),1)]),_:1})]),(0,a.bF)(g,{type:"primary",size:"small",disabled:o.saving||!!o.testing||o.settings.providers.length>=8,onClick:t[4]||(t[4]=e=>l.openProvider())},{default:(0,a.k6)(()=>[(0,a.bF)(u,{icon:"plus"}),(0,a.eW)((0,n.v_)(e.$t("sysAI.addProvider")),1)]),_:1},8,["disabled"])]),o.settings.providers.length?((0,a.uX)(),(0,a.CE)("div",vm,[((0,a.uX)(!0),(0,a.CE)(a.FK,null,(0,a.pI)(o.settings.providers,t=>((0,a.uX)(),(0,a.CE)("article",{key:t.id,class:(0,n.C4)(["resource-card",{disabled:!t.enabled}])},[(0,a.Lk)("div",xm,[(0,a.Lk)("span",km,(0,n.v_)(t.name||t.id),1),(0,a.bF)(r,{modelValue:t.enabled,"onUpdate:modelValue":e=>t.enabled=e,size:"small",disabled:o.saving||!!o.testing,"aria-label":e.$t("sysAI.enabled")},null,8,["modelValue","onUpdate:modelValue","disabled","aria-label"])]),(0,a.Lk)("div",_m,[(0,a.Lk)("div",wm,[(0,a.bF)(u,{icon:"link"}),(0,a.Lk)("span",{title:t.baseUrl},(0,n.v_)(t.baseUrl),9,Cm)]),(0,a.Lk)("div",Sm,[(0,a.bF)(u,{icon:"shield-alt"}),(0,a.Lk)("span",null,(0,n.v_)(l.keyPreview(t)),1)])]),(0,a.Lk)("div",Fm,[(0,a.bF)(g,{type:"primary",text:"",size:"small",disabled:o.saving||!!o.testing,onClick:e=>l.openProvider(t)},{default:(0,a.k6)(()=>[(0,a.bF)(u,{icon:"edit"}),(0,a.eW)((0,n.v_)(e.$t("sysAI.edit")),1)]),_:1},8,["disabled","onClick"]),(0,a.bF)(g,{type:"danger",text:"",size:"small",disabled:o.saving||!!o.testing,onClick:e=>l.removeProvider(t.id)},{default:(0,a.k6)(()=>[(0,a.bF)(u,{icon:"trash-alt"}),(0,a.eW)((0,n.v_)(e.$t("sysAI.remove")),1)]),_:1},8,["disabled","onClick"])])],2))),128))])):((0,a.uX)(),(0,a.CE)("div",fm,[(0,a.Lk)("span",bm,[(0,a.bF)(u,{icon:"server"})]),(0,a.Lk)("span",ym,(0,n.v_)(e.$t("sysAI.noProviders")),1),(0,a.bF)(g,{type:"primary",plain:"",disabled:o.saving,onClick:t[5]||(t[5]=e=>l.openProvider())},{default:(0,a.k6)(()=>[(0,a.bF)(u,{icon:"plus"}),(0,a.eW)((0,n.v_)(e.$t("sysAI.addProvider")),1)]),_:1},8,["disabled"])]))]),(0,a.Lk)("div",Tm,[(0,a.Lk)("div",Am,[(0,a.Lk)("h4",null,[(0,a.Lk)("span",Mm,[(0,a.bF)(u,{icon:"robot"})]),(0,a.Lk)("span",Pm,(0,n.v_)(e.$t("sysAI.models")),1),(0,a.bF)(p,{size:"small",type:"info"},{default:(0,a.k6)(()=>[(0,a.eW)((0,n.v_)(o.settings.models.length),1)]),_:1})]),(0,a.bF)(g,{type:"primary",size:"small",disabled:o.saving||!!o.testing||!o.settings.providers.length||o.settings.models.length>=16,onClick:t[6]||(t[6]=e=>l.openModel())},{default:(0,a.k6)(()=>[(0,a.bF)(u,{icon:"plus"}),(0,a.eW)((0,n.v_)(e.$t("sysAI.addModel")),1)]),_:1},8,["disabled"])]),o.settings.models.length?((0,a.uX)(),(0,a.CE)("div",Lm,[((0,a.uX)(!0),(0,a.CE)(a.FK,null,(0,a.pI)(o.settings.models,s=>((0,a.uX)(),(0,a.CE)("article",{key:s.id,class:(0,n.C4)(["resource-card",{disabled:!l.isModelAvailable(s)}])},[(0,a.Lk)("div",Em,[(0,a.Lk)("span",Im,(0,n.v_)(s.model),1),(0,a.Lk)("div",Um,[(0,a.bF)(p,{size:"small",type:"info"},{default:(0,a.k6)(()=>[...t[31]||(t[31]=[(0,a.eW)("text",-1)])]),_:1}),s.vision?((0,a.uX)(),(0,a.Wv)(p,{key:0,size:"small"},{default:(0,a.k6)(()=>[...t[32]||(t[32]=[(0,a.eW)("img",-1)])]),_:1})):(0,a.Q3)("",!0)])]),(0,a.Lk)("div",Om,[(0,a.Lk)("div",Rm,[(0,a.bF)(u,{icon:"server"}),(0,a.Lk)("span",null,(0,n.v_)(l.providerName(s.providerId)),1)])]),(0,a.Lk)("div",Wm,[(0,a.bF)(g,{type:"primary",text:"",size:"small",loading:o.testing===s.id,disabled:o.saving||!!o.testing||!l.isModelAvailable(s),onClick:e=>l.testModel(s)},{default:(0,a.k6)(()=>[o.testing!==s.id?((0,a.uX)(),(0,a.Wv)(u,{key:0,icon:"link"})):(0,a.Q3)("",!0),(0,a.eW)((0,n.v_)(e.$t("sysAI.test")),1)]),_:2},1032,["loading","disabled","onClick"]),(0,a.bF)(g,{type:"primary",text:"",size:"small",disabled:o.saving||!!o.testing,onClick:e=>l.openModel(s)},{default:(0,a.k6)(()=>[(0,a.bF)(u,{icon:"edit"}),(0,a.eW)((0,n.v_)(e.$t("sysAI.edit")),1)]),_:1},8,["disabled","onClick"]),(0,a.bF)(g,{type:"danger",text:"",size:"small",disabled:o.saving||!!o.testing,onClick:e=>l.removeModel(s.id)},{default:(0,a.k6)(()=>[(0,a.bF)(u,{icon:"trash-alt"}),(0,a.eW)((0,n.v_)(e.$t("sysAI.remove")),1)]),_:1},8,["disabled","onClick"])])],2))),128))])):((0,a.uX)(),(0,a.CE)("div",$m,[(0,a.Lk)("span",Dm,[(0,a.bF)(u,{icon:"robot"})]),(0,a.Lk)("span",Vm,(0,n.v_)(e.$t("sysAI.noModels")),1),(0,a.bF)(g,{type:"primary",plain:"",disabled:o.saving||!o.settings.providers.length,onClick:t[7]||(t[7]=e=>l.openModel())},{default:(0,a.k6)(()=>[(0,a.bF)(u,{icon:"plus"}),(0,a.eW)((0,n.v_)(e.$t("sysAI.addModel")),1)]),_:1},8,["disabled"])]))])]),(0,a.Lk)("h3",Nm,(0,n.v_)(e.$t("sysAI.prompts")),1),(0,a.bF)(h,{"label-width":"120px",class:"prompt-form",disabled:o.saving},{default:(0,a.k6)(()=>[(0,a.bF)(d,null,{label:(0,a.k6)(()=>[(0,a.eW)((0,n.v_)(e.$t("sysAI.tagPrompt"))+" ",1),(0,a.bF)(m,{placement:"right"},{content:(0,a.k6)(()=>[(0,a.eW)((0,n.v_)(e.$t("sysAI.promptHint"))+" ",1),t[33]||(t[33]=(0,a.Lk)("code",null,"{language} {maxTags} {preferredTags}",-1))]),default:(0,a.k6)(()=>[(0,a.bF)(u,{icon:"question-circle",class:"help-icon"})]),_:1})]),default:(0,a.k6)(()=>[(0,a.bF)(f,{modelValue:o.prompt,"onUpdate:modelValue":t[8]||(t[8]=e=>o.prompt=e),type:"textarea",rows:8,maxlength:"8000","show-word-limit":""},null,8,["modelValue"]),(0,a.bF)(g,{class:"reset-prompt",onClick:t[9]||(t[9]=e=>o.prompt=o.defaultPrompt)},{default:(0,a.k6)(()=>[(0,a.eW)((0,n.v_)(e.$t("sysAI.resetPrompt")),1)]),_:1})]),_:1})]),_:1},8,["disabled"]),(0,a.Lk)("h3",zm,(0,n.v_)(e.$t("sysAI.tagging")),1),(0,a.bF)(h,{model:l.tagging,"label-width":"120px",disabled:o.saving},{default:(0,a.k6)(()=>[(0,a.bF)(d,{label:e.$t("sysAI.enableTagging")},{default:(0,a.k6)(()=>[(0,a.bF)(r,{modelValue:l.tagging.enabled,"onUpdate:modelValue":t[10]||(t[10]=e=>l.tagging.enabled=e)},null,8,["modelValue"])]),_:1},8,["label"]),(0,a.bF)(d,{label:e.$t("sysAI.modelName")},{default:(0,a.k6)(()=>[(0,a.bF)(v,{modelValue:l.tagging.modelId,"onUpdate:modelValue":t[11]||(t[11]=e=>l.tagging.modelId=e)},{default:(0,a.k6)(()=>[((0,a.uX)(!0),(0,a.CE)(a.FK,null,(0,a.pI)(l.visionModels,e=>((0,a.uX)(),(0,a.Wv)(b,{key:e.id,label:`${e.model||e.id} · ${l.providerName(e.providerId)}`,value:e.id,disabled:!l.isModelAvailable(e)},null,8,["label","value","disabled"]))),128))]),_:1},8,["modelValue"])]),_:1},8,["label"]),(0,a.bF)(d,{label:e.$t("sysAI.language")},{default:(0,a.k6)(()=>[(0,a.bF)(v,{modelValue:l.tagging.language,"onUpdate:modelValue":t[12]||(t[12]=e=>l.tagging.language=e)},{default:(0,a.k6)(()=>[(0,a.bF)(b,{label:"中文",value:"zh-CN"}),(0,a.bF)(b,{label:"English",value:"en"})]),_:1},8,["modelValue"])]),_:1},8,["label"]),(0,a.bF)(d,{label:e.$t("sysAI.maxTags")},{default:(0,a.k6)(()=>[(0,a.bF)(c,{modelValue:l.tagging.maxTags,"onUpdate:modelValue":t[13]||(t[13]=e=>l.tagging.maxTags=e),min:1,max:10},null,8,["modelValue"])]),_:1},8,["label"]),(0,a.bF)(d,null,{label:(0,a.k6)(()=>[(0,a.eW)((0,n.v_)(e.$t("sysAI.vocabulary")),1),(0,a.bF)(m,{content:e.$t("sysAI.vocabularyHint"),placement:"right"},{default:(0,a.k6)(()=>[(0,a.bF)(u,{icon:"question-circle",class:"help-icon"})]),_:1},8,["content"])]),default:(0,a.k6)(()=>[(0,a.bF)(f,{modelValue:o.vocabulary,"onUpdate:modelValue":t[14]||(t[14]=e=>o.vocabulary=e),type:"textarea",rows:3},null,8,["modelValue"])]),_:1})]),_:1},8,["model","disabled"]),(0,a.bF)(k,{show:!o.loading&&!o.providerDialogVisible&&!o.modelDialogVisible,loading:o.saving,dirty:e.hasUnsavedChanges,onClick:l.save},null,8,["show","loading","dirty","onClick"])])):o.loadError?((0,a.uX)(),(0,a.Wv)(w,{key:1,title:o.loadError,type:"error",closable:!1},null,8,["title"])):(0,a.Q3)("",!0),(0,a.bF)(S,{modelValue:o.providerDialogVisible,"onUpdate:modelValue":t[21]||(t[21]=e=>o.providerDialogVisible=e),title:e.$t(o.editingProvider?"sysAI.editProvider":"sysAI.addProvider"),width:"min(600px, 90vw)",class:"ai-dialog","destroy-on-close":"",onClosed:t[22]||(t[22]=e=>o.providerDraft=null)},{footer:(0,a.k6)(()=>[(0,a.bF)(g,{onClick:t[20]||(t[20]=e=>o.providerDialogVisible=!1)},{default:(0,a.k6)(()=>[(0,a.eW)((0,n.v_)(e.$t("sysAI.cancel")),1)]),_:1}),(0,a.bF)(g,{type:"primary",onClick:l.confirmProvider},{default:(0,a.k6)(()=>[(0,a.eW)((0,n.v_)(e.$t(o.editingProvider?"sysAI.confirm":"sysAI.confirmAdd")),1)]),_:1},8,["onClick"])]),default:(0,a.k6)(()=>[o.providerDraft?((0,a.uX)(),(0,a.Wv)(h,{key:0,ref:"providerForm",model:o.providerDraft,rules:l.providerRules,"label-position":"top",class:"editor-form"},{default:(0,a.k6)(()=>[(0,a.bF)(d,{label:e.$t("sysAI.name"),prop:"name"},{default:(0,a.k6)(()=>[(0,a.bF)(f,{modelValue:o.providerDraft.name,"onUpdate:modelValue":t[15]||(t[15]=e=>o.providerDraft.name=e),maxlength:"200"},null,8,["modelValue"])]),_:1},8,["label"]),(0,a.bF)(d,{label:e.$t("sysAI.protocol")},{default:(0,a.k6)(()=>[(0,a.bF)(f,{"model-value":"OpenAI compatible (chat)",disabled:""})]),_:1},8,["label"]),(0,a.bF)(d,{label:"Base URL",prop:"baseUrl"},{default:(0,a.k6)(()=>[(0,a.bF)(f,{modelValue:o.providerDraft.baseUrl,"onUpdate:modelValue":t[16]||(t[16]=e=>o.providerDraft.baseUrl=e),placeholder:"https://example.com/v1",maxlength:"500"},null,8,["modelValue"])]),_:1}),(0,a.bF)(d,{prop:"apiKey",class:"api-key-field"},{label:(0,a.k6)(()=>[t[34]||(t[34]=(0,a.eW)("API Key",-1)),(0,a.bF)(m,{content:e.$t("sysAI.credentialHint"),placement:"top"},{default:(0,a.k6)(()=>[(0,a.bF)(u,{icon:"question-circle",class:"help-icon"})]),_:1},8,["content"])]),default:(0,a.k6)(()=>[(0,a.bF)(f,{modelValue:o.providerDraft.apiKey,"onUpdate:modelValue":t[17]||(t[17]=e=>o.providerDraft.apiKey=e),type:"password","show-password":"",autocomplete:"new-password",placeholder:o.providerDraft.credential.configured?e.$t("sysAI.keyUnchanged"):e.$t("sysAI.enterKey"),maxlength:"2048",disabled:!o.canStoreCredentials||o.providerDraft.clearApiKey},null,8,["modelValue","placeholder","disabled"])]),_:1}),o.editingProvider&&o.providerDraft.credential.configured?((0,a.uX)(),(0,a.Wv)(d,{key:0,prop:"clearApiKey"},{default:(0,a.k6)(()=>[(0,a.bF)(C,{modelValue:o.providerDraft.clearApiKey,"onUpdate:modelValue":t[18]||(t[18]=e=>o.providerDraft.clearApiKey=e),disabled:!o.canStoreCredentials},{default:(0,a.k6)(()=>[(0,a.eW)((0,n.v_)(e.$t("sysAI.clearKey")),1)]),_:1},8,["modelValue","disabled"])]),_:1})):(0,a.Q3)("",!0),(0,a.bF)(d,{label:e.$t("sysAI.enabled")},{default:(0,a.k6)(()=>[(0,a.bF)(r,{modelValue:o.providerDraft.enabled,"onUpdate:modelValue":t[19]||(t[19]=e=>o.providerDraft.enabled=e)},null,8,["modelValue"])]),_:1},8,["label"])]),_:1},8,["model","rules"])):(0,a.Q3)("",!0)]),_:1},8,["modelValue","title"]),(0,a.bF)(S,{modelValue:o.modelDialogVisible,"onUpdate:modelValue":t[29]||(t[29]=e=>o.modelDialogVisible=e),title:e.$t(o.editingModel?"sysAI.editModel":"sysAI.addModel"),width:"min(600px, 90vw)",class:"ai-dialog","destroy-on-close":"",onClosed:t[30]||(t[30]=e=>o.modelDraft=null)},{footer:(0,a.k6)(()=>[(0,a.bF)(g,{onClick:t[28]||(t[28]=e=>o.modelDialogVisible=!1)},{default:(0,a.k6)(()=>[(0,a.eW)((0,n.v_)(e.$t("sysAI.cancel")),1)]),_:1}),(0,a.bF)(g,{type:"primary",onClick:l.confirmModel},{default:(0,a.k6)(()=>[(0,a.eW)((0,n.v_)(e.$t(o.editingModel?"sysAI.confirm":"sysAI.confirmAdd")),1)]),_:1},8,["onClick"])]),default:(0,a.k6)(()=>[o.modelDraft?((0,a.uX)(),(0,a.Wv)(h,{key:0,ref:"modelForm",model:o.modelDraft,rules:l.modelRules,"label-position":"top",class:"editor-form"},{default:(0,a.k6)(()=>[(0,a.bF)(d,{label:e.$t("sysAI.provider"),prop:"providerId"},{default:(0,a.k6)(()=>[(0,a.bF)(v,{modelValue:o.modelDraft.providerId,"onUpdate:modelValue":t[23]||(t[23]=e=>o.modelDraft.providerId=e)},{default:(0,a.k6)(()=>[((0,a.uX)(!0),(0,a.CE)(a.FK,null,(0,a.pI)(o.settings.providers,e=>((0,a.uX)(),(0,a.Wv)(b,{key:e.id,label:e.name||e.id,value:e.id},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1},8,["label"]),(0,a.bF)(d,{label:e.$t("sysAI.modelName"),prop:"model"},{default:(0,a.k6)(()=>[(0,a.bF)(f,{modelValue:o.modelDraft.model,"onUpdate:modelValue":t[24]||(t[24]=e=>o.modelDraft.model=e),maxlength:"200"},null,8,["modelValue"])]),_:1},8,["label"]),(0,a.bF)(d,{label:e.$t("sysAI.vision")},{default:(0,a.k6)(()=>[(0,a.bF)(r,{modelValue:o.modelDraft.vision,"onUpdate:modelValue":t[25]||(t[25]=e=>o.modelDraft.vision=e)},null,8,["modelValue"])]),_:1},8,["label"]),(0,a.bF)(d,null,{label:(0,a.k6)(()=>[(0,a.eW)((0,n.v_)(e.$t("sysAI.jsonMode")),1),(0,a.bF)(m,{placement:"top"},{content:(0,a.k6)(()=>[(0,a.Lk)("span",Bm,(0,n.v_)(e.$t("sysAI.jsonModeHint")),1)]),default:(0,a.k6)(()=>[(0,a.bF)(u,{icon:"question-circle",class:"help-icon"})]),_:1})]),default:(0,a.k6)(()=>[(0,a.bF)(v,{modelValue:o.modelDraft.structuredOutput,"onUpdate:modelValue":t[26]||(t[26]=e=>o.modelDraft.structuredOutput=e)},{default:(0,a.k6)(()=>[(0,a.bF)(b,{label:e.$t("sysAI.promptOnly"),value:"none"},null,8,["label"]),(0,a.bF)(b,{label:e.$t("sysAI.nativeJsonObject"),value:"json"},null,8,["label"])]),_:1},8,["modelValue"])]),_:1}),(0,a.bF)(d,{label:e.$t("sysAI.outputTokens")},{default:(0,a.k6)(()=>[(0,a.bF)(c,{modelValue:o.modelDraft.maxOutputTokens,"onUpdate:modelValue":t[27]||(t[27]=e=>o.modelDraft.maxOutputTokens=e),min:64,max:2048},null,8,["modelValue"])]),_:1},8,["label"])]),_:1},8,["model","rules"])):(0,a.Q3)("",!0)]),_:1},8,["modelValue","title"])])),[[F,o.loading]])}var Hm=s(84344);const qm="builtin.image-tags.v1",Xm=e=>e+(globalThis.crypto?.randomUUID?.().replace(/-/g,"")||Date.now().toString(36)+Math.random().toString(36).slice(2));var Km={mixins:[Ug],name:"SysCogAI",components:{FloatingSaveButton:jp},data(){return{settings:null,loading:!0,saving:!1,testing:"",loadError:"",prompt:"",defaultPrompt:"",vocabulary:"",canStoreCredentials:!1,providerDialogVisible:!1,modelDialogVisible:!1,providerDraft:null,modelDraft:null,editingProvider:!1,editingModel:!1}},computed:{editableSettings(){return this.settings?this.payload():null},tagging(){return this.settings.capabilities["image.tags"]},visionModels(){return this.settings?.models.filter(e=>e.vision)||[]},availableVisionModels(){return this.visionModels.filter(e=>this.isModelAvailable(e))},providerRules(){return{name:[this.requiredRule(this.$t("sysAI.name"))],baseUrl:[this.requiredRule("Base URL"),{validator:(e,t,s)=>{try{const e=new URL(t);if(!["https:","http:"].includes(e.protocol)||e.username||e.password||e.search||e.hash)throw new Error;s()}catch{s(new Error(this.$t("sysAI.invalidURL")))}},trigger:"blur"}],apiKey:[{validator:(e,t,s)=>this.canStoreCredentials?this.providerDraft?.credential.configured||this.providerDraft?.clearApiKey||t?.trim()?void s():s(new Error(this.$t("sysAI.enterKey"))):s(new Error(this.$t("sysAI.credentialHint"))),trigger:"blur"}]}},modelRules(){return{providerId:[this.requiredRule(this.$t("sysAI.provider"))],model:[this.requiredRule(this.$t("sysAI.modelName"))]}}},watch:{availableVisionModels(){this.syncTaggingModel()}},async mounted(){try{this.setConfig(await(0,Hm.Lh)("/api/manage/sysConfig/ai"))}catch(e){this.loadError=this.errorText(e)}finally{this.loading=!1}},methods:{errorText(e){return(0,Hm.wt)(e,this.$t,this.$te)},setConfig(e){this.canStoreCredentials=e.canStoreCredentials,this.defaultPrompt=e.defaults.tagPrompt,this.prompt=e.promptOverrides[qm]?.template||this.defaultPrompt,this.vocabulary=e.capabilities["image.tags"].preferredTags.join(", "),this.settings=e,this.markSettingsSaved()},payload(){const e=JSON.parse(JSON.stringify(this.settings));return e.promptOverrides=this.prompt===this.defaultPrompt?{}:{[qm]:{template:this.prompt}},e.capabilities["image.tags"].preferredTags=this.vocabulary.split(/[,,\n]/).map(e=>e.trim()).filter(Boolean),e},requiredRule(e){return{required:!0,whitespace:!0,message:this.$t("sysAI.required",{field:e}),trigger:"blur"}},providerName(e){return this.settings.providers.find(t=>t.id===e)?.name||e},isModelAvailable(e){return this.settings?.providers.some(t=>t.id===e.providerId&&t.enabled)||!1},syncTaggingModel(){if(!this.settings||this.availableVisionModels.some(e=>e.id===this.tagging.modelId))return;const e=!!this.tagging.modelId;this.tagging.modelId=this.availableVisionModels[0]?.id||"",!this.tagging.modelId&&e&&(this.tagging.enabled=!1)},keyPreview(e){if(e.clearApiKey)return this.$t("sysAI.keyNotConfigured");const t=e.apiKey?.trim();return t?t.length>6?`${t.slice(0,2)}******${t.slice(-4)}`:"******":e.credential.maskedKey||(e.credential.configured?"******":this.$t("sysAI.keyNotConfigured"))},openProvider(e){this.saving||this.testing||!e&&this.settings.providers.length>=8||(this.editingProvider=!!e,this.providerDraft=e?JSON.parse(JSON.stringify(e)):{id:Xm("provider_"),name:"",protocol:"openai-compatible",baseUrl:"",enabled:!0,credential:{source:"stored",configured:!1}},this.providerDraft.credential={source:"stored",configured:"stored"===this.providerDraft.credential?.source&&!!this.providerDraft.credential.configured,maskedKey:this.providerDraft.credential?.maskedKey||""},this.providerDialogVisible=!0)},async confirmProvider(){if(!await this.$refs.providerForm.validate().catch(()=>!1))return;const e=JSON.parse(JSON.stringify(this.providerDraft));e.name=e.name.trim(),e.baseUrl=e.baseUrl.trim();const t=this.settings.providers.findIndex(t=>t.id===e.id);t<0?this.settings.providers.push(e):this.settings.providers.splice(t,1,e),this.providerDialogVisible=!1},removeProvider(e){this.settings.models.some(t=>t.providerId===e)?this.$message.warning(this.$t("sysAI.providerInUse")):this.settings.providers=this.settings.providers.filter(t=>t.id!==e)},openModel(e){this.saving||this.testing||!this.settings.providers.length||!e&&this.settings.models.length>=16||(this.editingModel=!!e,this.modelDraft=e?JSON.parse(JSON.stringify(e)):{id:Xm("model_"),providerId:this.settings.providers[0].id,model:"",vision:!0,structuredOutput:"none",maxOutputTokens:256},this.modelDialogVisible=!0)},async confirmModel(){if(!await this.$refs.modelForm.validate().catch(()=>!1))return;const e=JSON.parse(JSON.stringify(this.modelDraft));e.model=e.model.trim();const t=this.settings.models.findIndex(t=>t.id===e.id);t<0?this.settings.models.push(e):this.settings.models.splice(t,1,e),this.syncTaggingModel(),this.modelDialogVisible=!1},removeModel(e){this.settings.models=this.settings.models.filter(t=>t.id!==e),this.syncTaggingModel()},async save(){if(!this.saving){this.saving=!0;try{this.setConfig(await(0,Hm.Lh)("/api/manage/sysConfig/ai",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(this.payload())})),this.$message.success(this.$t("sysAI.saved"))}catch(e){this.$message.error(this.errorText(e))}finally{this.saving=!1}}},async testModel(e){if(!this.saving&&!this.testing&&this.isModelAvailable(e)){this.testing=e.id;try{const t=await(0,Hm.Lh)("/api/manage/ai/test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({config:this.payload(),modelId:e.id})});this.$message.success(this.$t("sysAI.testSuccess",{ms:t.elapsedMs}))}catch(t){this.$message.error(this.errorText(t))}finally{this.testing=""}}}}};const Qm=(0,u.A)(Km,[["render",jm],["__scopeId","data-v-7732a438"]]);var Ym=Qm,Gm=s(48903),Jm={name:"SystemConfig",mixins:[Gm.A],data(){return{activeIndex:"status",isSidebarCollapse:!1}},watch:{"$route.hash":{immediate:!0,handler(e){this.activeIndex=e.replace("#","")}},activeIndex(e){const t=`#${e}`;this.$router.push({hash:t})}},components:{AdminHeader:m.A,SysConfigTabs:g,SysCogStatus:Mu,SysCogUpload:Up,SysCogSecurity:Wg,SysCogPage:Kg,SysCogOthers:om,SysCogAI:Ym},computed:{currentComponent(){const e=this.$route.hash.replace("#","");switch(e){case"status":return Mu;case"upload":return Up;case"security":return Wg;case"page":return Kg;case"others":return om;case"ai":return Ym;default:return Mu}}},methods:{setDefaultHash(){const e="#status";window.location.hash=e,this.activeIndex=e.replace("#","")}},mounted(){this.initializeBackground("adminBkImg",".container",!1,!0),window.location.hash||this.setDefaultHash()}};const Zm=(0,u.A)(Jm,[["render",b],["__scopeId","data-v-1c8c15ba"]]);var ef=Zm},48789:function(e,t,s){s.d(t,{A:function(){return d}});var i=s(56768);const a={class:"ai-icon","aria-hidden":"true"};function n(e,t,s,n,o,l){return(0,i.uX)(),(0,i.CE)("span",a,[...t[0]||(t[0]=[(0,i.Lk)("svg",{viewBox:"0 0 36 32",xmlns:"http://www.w3.org/2000/svg",focusable:"false"},[(0,i.Lk)("g",{fill:"none",stroke:"currentColor","stroke-width":"3.2","stroke-linecap":"round","stroke-linejoin":"round"},[(0,i.Lk)("path",{d:"M4 23 9.5 9Q11 5.5 12.5 9L18 23M6.5 17.5H15.5"}),(0,i.Lk)("path",{d:"M23 8.5H31.5M27.25 8.5V23.5M23 23.5H31.5"})])],-1)])])}var o={name:"AIIcon"},l=s(71241);const r=(0,l.A)(o,[["render",n],["__scopeId","data-v-44a8b378"]]);var d=r},49187:function(e,t,s){s(85331),s(38736)},50333:function(e,t,s){s(85331),s(29092)},63003:function(e,t,s){s(85331)},64752:function(e,t,s){s(85331),s(38736),s(18785)},70415:function(e,t,s){s(85331),s(73565)},73565:function(e,t,s){s(85331)},84344:function(e,t,s){s.d(t,{EY:function(){return u},Lh:function(){return d},hP:function(){return h},wt:function(){return l}});s(44114),s(18111),s(61701),s(13579),s(64979);var i=s(70797);const a=262144,n=20971520;function o(e){if(e?.aborted)throw new DOMException("Cancelled","AbortError")}function l(e,t,s){const i=e?.code||e?.message,a=`aiErrors.${i}`,n=s(a)?t(a,{status:e.details?.status||e.status}):t("aiErrors.NETWORK_ERROR"),o=["code","type","requestId"].filter(t=>e?.details?.[t]).map(s=>`${t(`aiErrors.${s}`)}: ${e.details[s]}`);return o.length?`${n} (${o.join(", ")})`:n}const r=e=>({code:e.code||e.message,message:e.message,...e.details?{details:e.details}:{}});async function d(e,t={}){const s=await(0,i.A)(e,t);let a;try{a=await s.json()}catch{const e=new Error(`HTTP ${s.status}`);throw e.code=401===s.status?"AUTH_REQUIRED":s.ok?"INVALID_RESPONSE":"HTTP_ERROR",e.details={status:s.status},e}if(!a||"object"!==typeof a||Array.isArray(a)){const e=new Error("INVALID_RESPONSE");throw e.code="INVALID_RESPONSE",e}if(!s.ok){const e=new Error(a.error?.message||a.message||`HTTP ${s.status}`);throw e.code=a.error?.code||(401===s.status?"AUTH_REQUIRED":"HTTP_ERROR"),e.details={status:s.status,...a.error?.details},e}return a}async function c(e,t){o(t);const s=e.metadata?.FileType?.toLowerCase();if(s&&!["image/jpeg","image/png","image/webp","image/avif","image/gif"].includes(s))throw new Error("UNSUPPORTED_IMAGE");if(Number(e.metadata?.FileSizeBytes)>n)throw new Error("IMAGE_TOO_LARGE");const l=e.name.split("/").map(encodeURIComponent).join("/"),r=await(0,i.A)(`/file/${l}`,{signal:t});if(!r.ok){const e=new Error(`HTTP ${r.status}`);throw e.code="IMAGE_FETCH_FAILED",e.details={status:r.status},e}if(Number(r.headers.get("Content-Length"))>n)throw await(r.body?.cancel()),new Error("IMAGE_TOO_LARGE");const d=r.body.getReader(),c=[];let h=0;try{while(1){o(t);const{value:e,done:s}=await d.read();if(s)break;if(h+=e.byteLength,h>n)throw await d.cancel(),new Error("IMAGE_TOO_LARGE");c.push(e)}}finally{d.releaseLock()}const u=new Blob(c,{type:r.headers.get("Content-Type")||s});let p,g;o(t);try{"function"===typeof createImageBitmap?p=await createImageBitmap(u):(g=URL.createObjectURL(u),p=new Image,await new Promise((e,t)=>{p.onload=e,p.onerror=()=>t(new Error("UNSUPPORTED_IMAGE")),p.src=g})),o(t);const e=p.width||p.naturalWidth,s=p.height||p.naturalHeight;if(!e||!s)throw new Error("UNSUPPORTED_IMAGE");const i=document.createElement("canvas"),n=Math.min(1,768/Math.max(e,s));i.width=Math.max(1,Math.round(e*n)),i.height=Math.max(1,Math.round(s*n));const l=i.getContext("2d");l.fillStyle="#ffffff",l.fillRect(0,0,i.width,i.height),l.drawImage(p,0,0,i.width,i.height);for(const r of[.8,.6,.4]){o(t);const e=await new Promise(e=>i.toBlob(e,"image/jpeg",r));if(e&&e.size<=a&&(e.size<=131072||.4===r))return e}throw new Error("PREVIEW_TOO_LARGE")}catch(m){if(t?.aborted||"AbortError"===m.name||"PREVIEW_TOO_LARGE"===m.message)throw m;throw new Error("UNSUPPORTED_IMAGE")}finally{p?.close?.(),g&&URL.revokeObjectURL(g)}}async function h(e,{signal:t,batchSize:s=3,onResult:i,prepare:a=c}={}){s=Math.max(1,Math.min(3,s));const n=[];for(let c=0;c<e.length;c+=s){o(t);const h=[];for(const o of e.slice(c,c+s))try{h.push({file:o,image:await a(o,t)})}catch(l){if(t?.aborted||"AbortError"===l.name)throw l;const e={fileId:o.name,error:r(l)};n.push(e),i?.(e)}if(o(t),!h.length)continue;const u=new FormData;u.append("items",JSON.stringify(h.map(e=>({fileId:e.file.name})))),h.forEach((e,t)=>u.append(`image${t}`,e.image,"preview.jpg"));try{const e=await d("/api/manage/ai/tags",{method:"POST",body:u,signal:t});if(o(t),!Array.isArray(e.results)||e.results.length!==h.length)throw new Error("INVALID_RESPONSE");for(let t=0;t<h.length;t++){const s=e.results[t];if(!s||s.fileId!==h[t].file.name||!s.error&&(!Array.isArray(s.tags)||s.tags.some(e=>"string"!==typeof e)||!/^[a-f0-9]{64}$/.test(s.sourceIdentity)))throw new Error("INVALID_RESPONSE")}for(const t of e.results)n.push(t),i?.(t)}catch(l){if(t?.aborted||"AbortError"===l.name)throw l;for(const e of h){const t={fileId:e.file.name,error:r(l)};n.push(t),i?.(t)}}}return n}async function u(e,t){const s=[];for(let a=0;a<e.length;a+=50){const n=e.slice(a,a+50);try{const e=await d("/api/manage/tags/apply",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({items:n})});if(!Array.isArray(e.results)||e.results.length!==n.length||e.results.some((e,t)=>!e||e.fileId!==n[t].fileId||"boolean"!==typeof e.saved||e.saved&&(!Array.isArray(e.tags)||e.tags.some(e=>"string"!==typeof e))))throw new Error("INVALID_RESPONSE");for(const i of e.results)s.push(i),t?.(i)}catch(i){for(const e of n){const a={fileId:e.fileId,saved:!1,error:r(i)};s.push(a),t?.(a)}}}return s}},91114:function(e,t,s){function i(e){return i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i(e)}function a(e,t){if("object"!=i(e)||!e)return e;var s=e[Symbol.toPrimitive];if(void 0!==s){var a=s.call(e,t||"default");if("object"!=i(a))return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}function n(e){var t=a(e,"string");return"symbol"==i(t)?t:t+""}function o(e,t,s){return(t=n(t))in e?Object.defineProperty(e,t,{value:s,enumerable:!0,configurable:!0,writable:!0}):e[t]=s,e}s.d(t,{A:function(){return o}})},97769:function(e,t,s){s.d(t,{A:function(){return h}});var i=s(56768);const a={key:0,class:"channel-svg-icon",viewBox:"0 0 1024 1024",xmlns:"http://www.w3.org/2000/svg"},n={key:1,class:"channel-svg-icon",viewBox:"0 0 1024 1024",xmlns:"http://www.w3.org/2000/svg"},o={key:2,class:"channel-svg-icon",viewBox:"0 0 1024 1024",xmlns:"http://www.w3.org/2000/svg"};function l(e,t,s,l,r,d){const c=(0,i.g2)("font-awesome-icon");return(0,i.uX)(),(0,i.CE)("span",(0,i.v6)(e.$attrs,{class:["channel-icon-wrapper",`channel-brand-${s.type}`]}),["telegram"===s.type?((0,i.uX)(),(0,i.CE)("svg",a,[...t[0]||(t[0]=[(0,i.Lk)("path",{d:"M417.28 795.733333 429.226667 615.253333 756.906667 320C771.413333 306.773333 753.92 300.373333 734.72 311.893333L330.24 567.466667 155.306667 512C117.76 501.333333 117.333333 475.306667 163.84 456.533333L845.226667 193.706667C876.373333 179.626667 906.24 201.386667 894.293333 249.173333L778.24 795.733333C770.133333 834.56 746.666667 843.946667 714.24 826.026667L537.6 695.466667 452.693333 777.813333C442.88 787.626667 434.773333 795.733333 417.28 795.733333Z"},null,-1)])])):"huggingface"===s.type?((0,i.uX)(),(0,i.CE)("svg",n,[...t[1]||(t[1]=[(0,i.Fv)('<path d="M509.0304 870.656c94.6432 0 185.4464-37.3504 252.3904-103.8336a353.28 353.28 0 0 0 104.5504-250.6752 353.28 353.28 0 0 0-104.5504-250.6752 358.1952 358.1952 0 0 0-252.416-103.8336 358.1696 358.1696 0 0 0-252.3904 103.8336 353.28 353.28 0 0 0-104.5504 250.6752 353.28 353.28 0 0 0 104.5504 250.6752 358.1696 358.1696 0 0 0 252.416 103.8336z" fill="#FFD21E" data-v-ce6ff2ce></path><path d="M865.9712 516.1472a353.28 353.28 0 0 0-104.5504-250.6752 358.1952 358.1952 0 0 0-252.416-103.8336 358.1952 358.1952 0 0 0-252.3904 103.8336 353.28 353.28 0 0 0-104.5504 250.6752 353.28 353.28 0 0 0 104.5504 250.6752 358.1952 358.1952 0 0 0 252.416 103.8336c94.6432 0 185.4464-37.3504 252.3904-103.8336a353.28 353.28 0 0 0 104.5504-250.6752z m-754.9952 0c0-51.9168 10.3168-103.3216 30.3104-151.296a395.1616 395.1616 0 0 1 86.272-128.2304 398.208 398.208 0 0 1 129.152-85.6832 400.384 400.384 0 0 1 304.64 0c48.2816 19.8656 92.16 48.9728 129.1264 85.6832a395.1616 395.1616 0 0 1 86.272 128.256 392.96 392.96 0 0 1 30.2848 151.296c0 104.832-41.9328 205.3632-116.5568 279.5008a399.4112 399.4112 0 0 1-281.472 115.7888A399.4112 399.4112 0 0 1 227.584 795.6736a393.9584 393.9584 0 0 1-116.5824-279.5264z" fill="#FF9D0B" data-v-ce6ff2ce></path><path d="M624.9984 419.7376c13.1328 4.5056 18.2784 31.232 31.5136 24.2944a51.2 51.2 0 0 0 21.1456-20.8896 50.688 50.688 0 0 0-5.4272-56.4224 51.3792 51.3792 0 0 0-54.5792-16.5888c-9.728 2.8928-18.3552 8.6016-24.832 16.384a50.8416 50.8416 0 0 0-5.7344 56.3968c6.272 11.7248 26.1888-7.3472 38.016-3.2768l-0.1024 0.1024z m-241.92 0c-13.1328 4.5056-18.3808 31.232-31.5136 24.2944a51.2 51.2 0 0 1-21.1456-20.8896 50.688 50.688 0 0 1 5.4272-56.4224 51.4048 51.4048 0 0 1 54.5792-16.5888c9.728 2.8928 18.3808 8.6016 24.832 16.384a50.8416 50.8416 0 0 1 5.7344 56.3968c-6.272 11.7248-26.2912-7.3472-38.016-3.2768l0.1024 0.1024z" fill="#3A3B45" data-v-ce6ff2ce></path><path d="M506.4448 664.4736c100.9664 0 133.5296-89.344 133.5296-135.2704 0-23.8592-16.128-16.3072-41.984-3.6608-23.9616 11.7248-56.0896 27.9552-91.4432 27.9552-73.8304 0-133.5296-70.1952-133.5296-24.2944 0 45.9008 32.4608 135.2704 133.5296 135.2704h-0.1024z" fill="#FF323D" data-v-ce6ff2ce></path><path d="M429.1072 641.1264a88.8832 88.8832 0 0 1 54.4512-45.824c4.096-1.2032 8.32 5.8368 12.7232 13.056 4.096 6.9632 8.448 14.0032 12.7488 14.0032 4.608 0 9.216-6.9376 13.6448-13.7728 4.6336-7.168 9.1392-14.08 13.568-12.7488a88.32 88.32 0 0 1 51.3536 42.5216C625.92 608.384 640 559.4112 640 529.2032c0-23.8592-16.128-16.3072-42.0352-3.6608l-1.4336 0.7168c-23.7312 11.7248-55.3472 27.2384-90.0608 27.2384-34.7392 0-66.2528-15.5136-90.112-27.2384-26.7008-13.1584-43.4432-21.4272-43.4432 2.944 0 31.1296 15.0016 82.2272 56.192 111.9232z" fill="#3A3B45" data-v-ce6ff2ce></path><path d="M750.4128 467.712c8.8576 0 17.3312-3.5072 23.6032-9.728a33.024 33.024 0 0 0 0-46.8992 33.5104 33.5104 0 0 0-47.2064 0 33.024 33.024 0 0 0 0 46.8992c6.2464 6.2208 14.7456 9.728 23.6032 9.728z m-477.6448 0c8.8576 0 17.3568-3.5072 23.6032-9.728a33.024 33.024 0 0 0 0-46.8992 33.5104 33.5104 0 0 0-47.2064 0 33.024 33.024 0 0 0 0 46.8992c6.272 6.2208 14.7456 9.728 23.6032 9.728z m-68.7104 112.2048c-16.64 0-31.4368 6.7328-41.8048 19.072a60.6464 60.6464 0 0 0-13.6704 38.3488 73.472 73.472 0 0 0-19.9168-3.072c-15.9232 0-30.3104 6.0416-40.4736 16.9472a59.008 59.008 0 0 0-8.2176 71.424 54.016 54.016 0 0 0-18.3808 28.7744 59.3152 59.3152 0 0 0 8.192 48.3584 53.0176 53.0176 0 0 0-3.7888 51.2c10.496 23.68 36.6848 42.24 87.5264 62.2336 31.5392 12.4416 60.4928 20.4032 60.6976 20.5056a458.24 458.24 0 0 0 112.2816 16.3328c60.16 0 103.2192-18.3808 127.9744-54.4768 39.8592-58.0608 34.2016-111.2064-17.4592-162.432-28.4672-28.3648-47.4624-70.0672-51.3536-79.2576-8.0128-27.136-29.184-57.344-64.2048-57.344a58.88 58.88 0 0 0-47.2576 25.088c-10.2656-12.8256-20.3264-22.9376-29.3632-28.7488a76.3648 76.3648 0 0 0-40.7808-12.9536z m0 40.8064c5.2224 0 11.6992 2.2528 18.688 6.6304 21.9904 13.8752 64.2048 86.016 79.7184 114.048 5.12 9.3952 14.08 13.3632 21.9648 13.3632 15.9232 0 28.2624-15.616 1.536-35.5072-40.2432-29.8752-26.1888-78.7456-6.9632-81.7152 0.8192-0.2048 1.7408-0.2048 2.4576-0.2048 17.4592 0 25.1648 29.9008 25.1648 29.9008s22.6048 56.32 61.44 94.8736c38.7072 38.4768 40.7552 69.376 12.5184 110.4896-19.3024 28.0576-56.192 36.5312-94.08 36.5312-39.168 0-79.4112-9.216-101.888-14.8992-1.152-0.3072-138.1632-38.784-120.832-71.424 2.8928-5.504 7.7312-7.7568 13.7728-7.7568 24.448 0 68.8384 36.1216 88.0384 36.1216 4.1984 0 7.168-1.7408 8.5248-6.1184 8.1152-29.0816-123.8784-41.3184-112.7936-83.3536 2.048-7.424 7.296-10.3936 14.7968-10.3936 32.256 0 104.7808 56.3968 119.9872 56.3968 1.1264 0 2.048-0.2816 2.4576-1.024 7.6032-12.2368 3.3792-20.7872-50.3296-53.0432-53.504-32.2304-91.2128-51.6096-69.8624-74.752 2.4832-2.6624 5.9648-3.8912 10.2912-3.8912 32.5632 0 109.4912 69.5808 109.4912 69.5808s20.736 21.4272 33.3824 21.4272c2.8672 0 5.3504-1.024 6.9888-3.8912 8.832-14.8992-82.7904-83.8656-87.936-112.3072-3.4816-19.4048 2.4576-29.0816 13.4656-29.0816z" fill="#FF9D0B" data-v-ce6ff2ce></path><path d="M420.5824 872.6016c28.2368-41.216 26.1888-72.1152-12.544-110.592-38.8096-38.4512-61.4144-94.8736-61.4144-94.8736s-8.4224-32.64-27.648-29.5936c-19.2 3.072-33.28 51.84 7.0144 81.7152 40.1408 29.9008-8.0128 50.2016-23.552 22.144-15.3856-28.0576-57.7024-100.1728-79.6928-114.048-21.888-13.7728-37.2736-6.144-32.1536 22.4512 5.12 28.4416 96.8704 97.408 87.936 112.2048-8.96 15.0016-40.3712-17.4336-40.3712-17.4336s-98.304-88.8576-119.7568-65.7152c-21.376 23.168 16.3328 42.5472 69.8368 74.7776 53.7088 32.256 57.9328 40.8064 50.3296 53.0688-7.68 12.2368-126.1312-87.04-137.216-44.9024-11.1104 41.9328 120.8832 54.0672 112.768 83.1488-8.192 29.0816-93.056-54.8864-110.336-22.2464-17.4336 32.768 119.68 71.2192 120.832 71.5264 44.16 11.4176 156.6208 35.584 195.968-21.632z" fill="#FFD21E" data-v-ce6ff2ce></path><path d="M819.1232 579.9168c16.64 0 31.5392 6.7328 41.8048 19.072 8.8576 10.8544 13.6704 24.3968 13.6704 38.3488 6.5024-1.92 13.2352-2.9696 20.0192-3.072 15.9232 0 30.3104 6.0416 40.4736 16.9472a58.9824 58.9824 0 0 1 8.2176 71.424c9.0624 7.3728 15.4624 17.4592 18.2784 28.7744a59.2896 59.2896 0 0 1-8.192 48.3584 52.992 52.992 0 0 1 3.7888 51.2c-10.496 23.68-36.6848 42.24-87.424 62.208-31.6416 12.4672-60.5952 20.4288-60.8 20.5312-36.608 10.0608-74.3168 15.5392-112.2816 16.3328-60.1856 0-103.2192-18.3808-128-54.4768-39.8336-58.0608-34.176-111.2064 17.4848-162.432 28.544-28.3648 47.5648-70.0672 51.456-79.2576 8.0128-27.136 29.0816-57.344 64.1024-57.344a58.88 58.88 0 0 1 47.232 25.088c10.2912-12.8256 20.352-22.9376 29.4912-28.7488a76.3904 76.3904 0 0 1 40.6784-12.9536z m0 40.8064c-5.248 0-11.5968 2.2272-18.688 6.6304-21.888 13.8752-64.2048 86.016-79.7184 114.048a24.832 24.832 0 0 1-21.9648 13.3632c-15.8208 0-28.2624-15.616-1.4592-35.5072 40.192-29.8752 26.112-78.7456 6.912-81.7152a15.872 15.872 0 0 0-2.4832-0.2048c-17.4592 0-25.1648 29.9008-25.1648 29.9008s-22.6048 56.32-61.3376 94.8736c-38.8096 38.4512-40.8576 69.376-12.544 110.4896 19.2256 28.0576 56.2176 36.5312 94.0032 36.5312 39.2448 0 79.4112-9.216 102.016-14.8992 1.024-0.3072 138.1376-38.784 120.7808-71.424-2.9696-5.504-7.68-7.7568-13.7728-7.7568-24.4224 0-68.9152 36.1216-88.0128 36.1216-4.3264 0-7.296-1.7408-8.5248-6.144-8.2176-29.056 123.776-41.2928 112.6656-83.328-1.9456-7.424-7.168-10.3936-14.7712-10.3936-32.256 0-104.7808 56.3968-119.9872 56.3968-1.024 0-1.9456-0.3072-2.3552-1.024-7.6032-12.2368-3.5072-20.7872 50.1248-53.0432 53.7088-32.2304 91.392-51.6096 69.8368-74.752-2.3552-2.6624-5.8368-3.8912-10.0608-3.8912-32.6656 0-109.5936 69.5808-109.5936 69.5808s-20.736 21.4272-33.28 21.4272a7.6288 7.6288 0 0 1-6.9888-3.8912c-8.9344-14.8992 82.688-83.8656 87.808-112.3072 3.5072-19.4048-2.4576-29.0816-13.44-29.0816z" fill="#FF9D0B" data-v-ce6ff2ce></path><path d="M602.7008 872.6016c-28.2368-41.216-26.2912-72.1152 12.544-110.592 38.7072-38.4512 61.312-94.8736 61.312-94.8736s8.4224-32.64 27.7248-29.5936c19.1232 3.072 33.1776 51.84-6.9888 81.7152-40.2432 29.9008 8.0128 50.2016 23.424 22.144 15.5136-28.0576 57.856-100.1728 79.7184-114.048 21.8624-13.7728 37.376-6.144 32.1536 22.4512-5.12 28.4416-96.768 97.408-87.808 112.2048 8.8064 15.0016 40.2432-17.4336 40.2432-17.4336s98.4064-88.8576 119.7568-65.7152c21.376 23.168-16.2304 42.5472-69.8368 74.7776-53.7344 32.256-57.8304 40.8064-50.3296 53.0688 7.68 12.2368 126.1312-87.04 137.216-44.9024 11.1104 41.9328-120.7808 54.0672-112.6656 83.1488 8.192 29.0816 92.9536-54.8864 110.336-22.2464 17.3312 32.768-119.68 71.2192-120.832 71.5264-44.2624 11.4176-156.7232 35.584-195.968-21.632z" fill="#FFD21E" data-v-ce6ff2ce></path>',9)])])):"webdav"===s.type?((0,i.uX)(),(0,i.CE)("svg",o,[...t[2]||(t[2]=[(0,i.Lk)("path",{d:"M446.293333 810.666667C384 898.986667 262.4 921.173333 174.506667 859.733333c-87.466667-61.44-107.946667-183.893333-46.506667-273.066666a195.626667 195.626667 0 0 1 152.746667-84.48l2.133333 61.013333c-38.826667 2.986667-76.373333 23.04-100.693333 58.026667-42.666667 61.44-29.44 144.213333 29.013333 185.6 58.88 40.96 141.226667 25.173333 183.893333-35.84 13.226667-19.2 20.906667-40.106667 23.893334-61.44v-43.093334l238.08-1.706666 2.986666-4.693334c22.613333-39.253333 71.68-52.906667 110.08-30.72a81.066667 81.066667 0 0 1 29.013334 110.933334c-22.613333 38.826667-72.106667 52.48-110.506667 30.293333-17.493333-9.813333-29.866667-25.6-35.413333-43.52l-173.653334 0.853333a211.626667 211.626667 0 0 1-33.28 82.773334m310.613334-304.64c107.946667 13.226667 184.746667 110.08 171.52 216.32-13.226667 106.666667-111.36 182.186667-219.306667 168.96a197.504 197.504 0 0 1-146.346667-94.293334l52.906667-30.72a137.386667 137.386667 0 0 0 98.986667 61.866667c74.666667 8.96 140.8-41.813333 149.76-113.066667 8.96-71.253333-43.946667-136.533333-117.76-145.493333-23.04-2.56-45.226667 0.426667-65.28 7.68l-36.266667 18.773333-110.08-203.52h-9.386667a81.322667 81.322667 0 0 1-78.933333-83.2c1.28-44.373333 39.68-78.933333 84.48-77.226666 44.8 2.56 80.213333 38.826667 78.933333 83.2-0.853333 18.773333-8.106667 35.84-19.626666 49.066666l81.066666 149.76c26.453333-8.533333 55.466667-11.52 85.333334-8.106666M352 389.973333c-42.666667-100.266667 2.56-215.04 101.12-256.853333 98.986667-41.813333 213.333333 5.546667 256 105.813333 25.173333 58.453333 20.053333 122.453333-8.533333 173.653334l-52.906667-30.72c17.92-34.56 20.906667-76.8 3.84-116.48-29.013333-68.266667-106.24-101.12-172.373333-73.386667-66.56 28.16-96.426667 106.666667-67.413334 174.933333 11.946667 28.16 32 49.92 56.32 64.426667l16.64 8.96-130.986666 212.906667c1.28 2.133333 2.986667 4.693333 4.266666 8.106666 20.906667 38.826667 6.4 87.893333-32.853333 108.8-38.826667 20.906667-87.893333 5.546667-109.226667-34.56-20.906667-39.68-6.4-88.746667 32.853334-109.653333 16.64-8.96 34.986667-11.093333 52.48-7.253333l98.56-160.853334c-20.053333-18.346667-37.12-41.386667-47.786667-67.84z"},null,-1)])])):((0,i.uX)(),(0,i.Wv)(c,{key:3,icon:d.fontAwesomeIcon},null,8,["icon"]))],16)}var r={name:"ChannelIcon",inheritAttrs:!1,props:{type:{type:String,required:!0}},computed:{fontAwesomeIcon(){const e={cfr2:["fab","cloudflare"],s3:["fab","aws"],discord:["fab","discord"]};return e[this.type]||"server"}}},d=s(71241);const c=(0,d.A)(r,[["render",l],["__scopeId","data-v-ce6ff2ce"]]);var h=c},98642:function(e,t,s){s(85331)}}]);
//# sourceMappingURL=161.2f01a91a.js.map