@c2-markdown-ui/vue 0.0.0-stage → 0.4.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +112 -2
- package/dist/MarkdownUI.vue.d.ts +15 -0
- package/dist/favicon.ico +0 -0
- package/dist/index.css +1 -0
- package/dist/index.d.ts +23 -0
- package/dist/index.js +10843 -0
- package/dist/index.umd.cjs +53 -0
- package/dist/widgets/Button.vue.d.ts +19 -0
- package/dist/widgets/ButtonGroup.vue.d.ts +13 -0
- package/dist/widgets/Cascader.vue.d.ts +48 -0
- package/dist/widgets/Chart.vue.d.ts +24 -0
- package/dist/widgets/DatePicker.vue.d.ts +42 -0
- package/dist/widgets/Form.vue.d.ts +59 -0
- package/dist/widgets/Incomplete.vue.d.ts +2 -0
- package/dist/widgets/MultipleChoiceQuestion.vue.d.ts +20 -0
- package/dist/widgets/NumberInput.vue.d.ts +37 -0
- package/dist/widgets/Quiz.vue.d.ts +39 -0
- package/dist/widgets/RadioGroup.vue.d.ts +43 -0
- package/dist/widgets/Select.vue.d.ts +27 -0
- package/dist/widgets/SelectMulti.vue.d.ts +38 -0
- package/dist/widgets/ShortAnswerQuestion.vue.d.ts +22 -0
- package/dist/widgets/Slider.vue.d.ts +21 -0
- package/dist/widgets/Switch.vue.d.ts +28 -0
- package/dist/widgets/Text.vue.d.ts +22 -0
- package/dist/widgets/TextInput.vue.d.ts +32 -0
- package/dist/widgets/TreeSelect.vue.d.ts +109 -0
- package/dist/widgets/Widget.vue.d.ts +8 -0
- package/dist/widgets/chartRemoteData.d.ts +17 -0
- package/dist/widgets/index.d.ts +20 -0
- package/dist/widgets/remoteChoices.d.ts +22 -0
- package/dist/widgets/treeSelectTypes.d.ts +43 -0
- package/package.json +46 -4
- package/src/App.vue +11 -0
- package/src/lib/MarkdownUI.vue +105 -0
- package/src/lib/index.ts +28 -0
- package/src/lib/widgets/Button.vue +47 -0
- package/src/lib/widgets/ButtonGroup.vue +43 -0
- package/src/lib/widgets/Cascader.vue +475 -0
- package/src/lib/widgets/Chart.vue +287 -0
- package/src/lib/widgets/DatePicker.vue +659 -0
- package/src/lib/widgets/Form.vue +479 -0
- package/src/lib/widgets/Incomplete.vue +56 -0
- package/src/lib/widgets/MultipleChoiceQuestion.vue +73 -0
- package/src/lib/widgets/NumberInput.vue +179 -0
- package/src/lib/widgets/Quiz.vue +205 -0
- package/src/lib/widgets/RadioGroup.vue +237 -0
- package/src/lib/widgets/Select.vue +279 -0
- package/src/lib/widgets/SelectMulti.vue +145 -0
- package/src/lib/widgets/ShortAnswerQuestion.vue +79 -0
- package/src/lib/widgets/Slider.vue +61 -0
- package/src/lib/widgets/Switch.vue +68 -0
- package/src/lib/widgets/Text.vue +59 -0
- package/src/lib/widgets/TextInput.vue +83 -0
- package/src/lib/widgets/TreeSelect.vue +872 -0
- package/src/lib/widgets/Widget.vue +185 -0
- package/src/lib/widgets/chartRemoteData.ts +84 -0
- package/src/lib/widgets/index.ts +20 -0
- package/src/lib/widgets/remoteChoices.ts +64 -0
- package/src/lib/widgets/treeSelectTypes.ts +49 -0
- package/src/lib/widgets.css +1754 -0
- package/src/main.ts +4 -0
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
(function(it,r){typeof exports=="object"&&typeof module<"u"?r(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],r):(it=typeof globalThis<"u"?globalThis:it||self,r(it.MarkdownUIVue={},it.Vue))})(this,(function(it,r){"use strict";const sn=r.defineComponent({__name:"Button",props:{label:{default:"按钮"},color:{},textColor:{},size:{default:"medium"}},emits:["change"],setup(n,{emit:t}){const e=n,i=t,s=r.computed(()=>{const a={};return e.color&&(a.backgroundColor=e.color),e.textColor&&(a.color=e.textColor),Object.keys(a).length>0?a:void 0}),o=()=>{i("change",e.label)};return(a,l)=>(r.openBlock(),r.createElementBlock("button",{type:"button",class:r.normalizeClass(`widget-button size-${a.size}`),style:r.normalizeStyle(s.value),onClick:o},r.toDisplayString(a.label),7))}}),co={class:"widget-button-group"},ho={key:0},uo=["aria-label"],fo=["aria-pressed","onClick"],on=r.defineComponent({__name:"ButtonGroup",props:{choices:{},label:{default:""},default:{}},emits:["change"],setup(n,{emit:t}){const e=n,i=t,s=r.ref(e.default??e.choices[0]),o=a=>{s.value=a,i("change",a)};return(a,l)=>(r.openBlock(),r.createElementBlock("div",co,[a.label?(r.openBlock(),r.createElementBlock("label",ho,r.toDisplayString(a.label),1)):r.createCommentVNode("",!0),r.createElementVNode("div",{role:"group","aria-label":a.label},[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(a.choices,c=>(r.openBlock(),r.createElementBlock("button",{key:c,type:"button","aria-pressed":s.value===c,onClick:d=>o(c)},r.toDisplayString(c),9,fo))),128))],8,uo)]))}}),po={key:0,class:"widget-label-row"},mo={key:0,class:"widget-required-mark","aria-hidden":"true"},go={key:1},bo=["data-hint"],yo={class:"widget-field-content"},_o=["disabled","aria-expanded"],ko={key:0,class:"widget-error-text",role:"alert"},xo={key:1,class:"cas-panel"},wo={key:0,class:"cas-empty"},So=["onClick"],Co={class:"cas-option-label"},Eo={key:0,class:"cas-option-arrow","aria-hidden":"true"},Mo={key:0,class:"cas-empty"},vo=r.defineComponent({__name:"Cascader",props:{choices:{},data:{default:void 0},url:{default:""},lazy:{type:Boolean,default:!1},label:{default:""},default:{default:""},placeholder:{default:""},hint:{default:""},required:{type:Boolean,default:!1},message:{default:""},error:{default:""},disabled:{type:Boolean,default:!1}},emits:["change"],setup(n,{emit:t}){const e=n,i=t;function s(C){const T=C.indexOf(":");if(T>0){const P=C.slice(0,T).trim(),O=C.slice(T+1).trim();if(P&&O)return{value:P,label:O}}return{value:C.trim(),label:C.trim()}}function o(C,T=!1){return Array.isArray(C)?C.map(P=>{const O=P.value??P.key,F=P.children,H=Array.isArray(F)&&F.length>0,q=P.loaded===!0;return{value:String(O??""),label:String(P.label??O??""),children:H?o(F,T):[],isLeaf:T?!H&&q:!H,loaded:H||q}}):[]}function a(C){let T=C;Array.isArray(C)||(T=Array.isArray(C?.data)?C.data:Array.isArray(C?.options)?C.options:Array.isArray(C?.choices)?C.choices:Array.isArray(C?.items)?C.items:Array.isArray(C?.tree)?C.tree:Array.isArray(C?.treeData)?C.treeData:[]);const P=O=>(O||[]).map(F=>{if(!F||typeof F!="object")return null;const H=F.value??F.key;if(H==null||H==="")return null;const q={value:String(H)},Y=F.label??F.name??F.text;return Y!=null&&(q.label=String(Y)),Array.isArray(F.children)&&F.children.length>0&&(q.children=P(F.children)),q}).filter(F=>F!==null);return P(T)}const l=r.ref(null),c=r.ref(!1),d=r.ref(""),h=r.computed(()=>{if(l.value)return o(l.value,e.lazy);if(Array.isArray(e.data)&&e.data.length>0)return o(e.data,e.lazy);const C=[];for(const T of e.choices){if(!T)continue;const P=T.split("/").map(F=>F.trim()).filter(Boolean);if(P.length===0)continue;let O=C;for(let F=0;F<P.length;F++){const{value:H,label:q}=s(P[F]);let Y=O.find(G=>G.value===H);Y||(Y={value:H,label:q,children:[],isLeaf:F===P.length-1},O.push(Y)),O=Y.children}}return C});function u(C,T){if(!C)return[];const P=C.split("/").map(H=>H.trim()).filter(Boolean),O=[];let F=T;for(const H of P){const{value:q,label:Y}=s(H),G=F.find(ot=>ot.value===q||ot.value===H||ot.label===Y||ot.label===H);if(!G)return O;O.push(G.value),F=G.children}return O}const f=r.ref(u(e.default,h.value)),p=r.ref([]),g=r.ref(!1),b=r.ref(null);function m(C){b.value&&!b.value.contains(C.target)&&(g.value=!1)}if(r.onMounted(()=>document.addEventListener("mousedown",m)),r.onBeforeUnmount(()=>document.removeEventListener("mousedown",m)),e.url){let C=!1;c.value=!0,(async()=>{try{const T=await fetch(e.url);if(!T.ok)throw new Error(`HTTP ${T.status}`);const P=await T.json(),O=a(P);if(O.length===0)throw new Error("响应中没有可用选项");l.value=O,f.value.length===0&&(f.value=u(e.default,o(O,e.lazy)))}catch{}finally{c.value=!1}})()}function _(C,T,P){return C.map(O=>String(O.value??O.key??"")!==T[0]?O:T.length===1?{...O,children:P,loaded:!0}:{...O,children:_(O.children||[],T.slice(1),P)})}async function y(C,T){if(!(!e.url||!C||C.loaded)){d.value=T.join("/");try{const P=e.url.includes("?")?"&":"?",O=await fetch(`${e.url}${P}parent=${encodeURIComponent(C.value)}`);if(!O.ok)throw new Error(`HTTP ${O.status}`);const F=await O.json(),H=a(F);l.value&&(l.value=_(l.value,T,H))}catch{}finally{d.value=""}}}function k(C){let T=h.value;for(let P=0;P<C;P++){const O=p.value[P],F=T.find(H=>H.value===O);if(!F)return[];T=F.children}return T}const x=r.computed(()=>{if(!g.value)return 0;let C=1,T=h.value;for(const P of p.value){const O=T.find(F=>F.value===P);if(!O||O.isLeaf)break;T=O.children,C++}return C});function S(C){let T=h.value;const P=[];for(const O of C){const F=T.find(H=>H.value===O);if(!F)break;P.push(F.label),T=F.children}return P.join(" / ")}function N(){e.disabled||(g.value=!g.value,g.value&&(p.value=f.value.length>0?f.value.slice(0,-1):[]))}function V(C,T){if(e.disabled)return;const P=p.value.slice(0,C);P.push(T.value),T.isLeaf?(f.value=P,p.value=[],g.value=!1,i("change",P.join("/"))):(p.value=P,e.lazy&&e.url&&!T.loaded&&y(T,P))}function L(){f.value=[],p.value=[],g.value=!1,i("change","")}return(C,T)=>(r.openBlock(),r.createElementBlock("div",{class:"selector widget-cascader",ref_key:"rootEl",ref:b},[C.label||C.hint||C.required?(r.openBlock(),r.createElementBlock("div",po,[C.required?(r.openBlock(),r.createElementBlock("span",mo,"*")):r.createCommentVNode("",!0),C.label?(r.openBlock(),r.createElementBlock("label",go,r.toDisplayString(C.label),1)):r.createCommentVNode("",!0),C.hint?(r.openBlock(),r.createElementBlock("span",{key:2,class:"widget-hint","data-hint":C.hint},"ⓘ",8,bo)):r.createCommentVNode("",!0)])):r.createCommentVNode("",!0),r.createElementVNode("div",yo,[r.createElementVNode("button",{type:"button",class:r.normalizeClass(["cas-input",{"widget-input-error":!!C.error}]),disabled:C.disabled,"aria-expanded":g.value,onClick:N},[r.createElementVNode("span",{class:r.normalizeClass(["cas-input-text",{"cas-placeholder":f.value.length===0}])},r.toDisplayString(c.value?"加载中…":f.value.length>0?S(f.value):C.placeholder||"请选择"),3),!C.disabled&&f.value.length>0?(r.openBlock(),r.createElementBlock("span",{key:0,class:"cas-clear",role:"button",tabindex:"-1","aria-label":"清空",onClick:r.withModifiers(L,["stop"])},"×")):C.disabled?r.createCommentVNode("",!0):(r.openBlock(),r.createElementBlock("span",{key:1,class:r.normalizeClass(["cas-arrow",{"cas-arrow-open":g.value}]),"aria-hidden":"true"},"▾",2))],10,_o),C.error?(r.openBlock(),r.createElementBlock("div",ko,r.toDisplayString(C.error),1)):r.createCommentVNode("",!0),g.value?(r.openBlock(),r.createElementBlock("div",xo,[x.value===0?(r.openBlock(),r.createElementBlock("div",wo,r.toDisplayString(c.value?"加载中…":"暂无数据"),1)):(r.openBlock(!0),r.createElementBlock(r.Fragment,{key:1},r.renderList(x.value,P=>(r.openBlock(),r.createElementBlock("div",{key:P,class:"cas-menu",role:"menu"},[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(k(P-1),O=>(r.openBlock(),r.createElementBlock("button",{key:O.value,type:"button",class:r.normalizeClass(["cas-option",{"cas-option-active":p.value[P-1]===O.value}]),onClick:F=>V(P-1,O)},[r.createElementVNode("span",Co,r.toDisplayString(O.label),1),O.isLeaf?r.createCommentVNode("",!0):(r.openBlock(),r.createElementBlock("span",Eo,"›"))],10,So))),128)),k(P-1).length===0?(r.openBlock(),r.createElementBlock("div",Mo,r.toDisplayString(d.value&&p.value.join("/").startsWith(d.value)?"加载中…":"暂无数据"),1)):r.createCommentVNode("",!0)]))),128))])):r.createCommentVNode("",!0)])],512))}}),oe=(n,t)=>{const e=n.__vccOpts||n;for(const[i,s]of t)e[i]=s;return e},an=oe(vo,[["__scopeId","data-v-9fed9363"]]);/*!
|
|
2
|
+
* @kurkle/color v0.3.4
|
|
3
|
+
* https://github.com/kurkle/color#readme
|
|
4
|
+
* (c) 2024 Jukka Kurkela
|
|
5
|
+
* Released under the MIT License
|
|
6
|
+
*/function ae(n){return n+.5|0}const Pt=(n,t,e)=>Math.max(Math.min(n,e),t);function re(n){return Pt(ae(n*2.55),0,255)}function Nt(n){return Pt(ae(n*255),0,255)}function Mt(n){return Pt(ae(n/2.55)/100,0,1)}function si(n){return Pt(ae(n*100),0,100)}const bt={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},rn=[..."0123456789ABCDEF"],Bo=n=>rn[n&15],Do=n=>rn[(n&240)>>4]+rn[n&15],ve=n=>(n&240)>>4===(n&15),Ao=n=>ve(n.r)&&ve(n.g)&&ve(n.b)&&ve(n.a);function To(n){var t=n.length,e;return n[0]==="#"&&(t===4||t===5?e={r:255&bt[n[1]]*17,g:255&bt[n[2]]*17,b:255&bt[n[3]]*17,a:t===5?bt[n[4]]*17:255}:(t===7||t===9)&&(e={r:bt[n[1]]<<4|bt[n[2]],g:bt[n[3]]<<4|bt[n[4]],b:bt[n[5]]<<4|bt[n[6]],a:t===9?bt[n[7]]<<4|bt[n[8]]:255})),e}const Po=(n,t)=>n<255?t(n):"";function No(n){var t=Ao(n)?Bo:Do;return n?"#"+t(n.r)+t(n.g)+t(n.b)+Po(n.a,t):void 0}const Oo=/^(hsla?|hwb|hsv)\(\s*([-+.e\d]+)(?:deg)?[\s,]+([-+.e\d]+)%[\s,]+([-+.e\d]+)%(?:[\s,]+([-+.e\d]+)(%)?)?\s*\)$/;function oi(n,t,e){const i=t*Math.min(e,1-e),s=(o,a=(o+n/30)%12)=>e-i*Math.max(Math.min(a-3,9-a,1),-1);return[s(0),s(8),s(4)]}function Vo(n,t,e){const i=(s,o=(s+n/60)%6)=>e-e*t*Math.max(Math.min(o,4-o,1),0);return[i(5),i(3),i(1)]}function Lo(n,t,e){const i=oi(n,1,.5);let s;for(t+e>1&&(s=1/(t+e),t*=s,e*=s),s=0;s<3;s++)i[s]*=1-t-e,i[s]+=t;return i}function zo(n,t,e,i,s){return n===s?(t-e)/i+(t<e?6:0):t===s?(e-n)/i+2:(n-t)/i+4}function ln(n){const e=n.r/255,i=n.g/255,s=n.b/255,o=Math.max(e,i,s),a=Math.min(e,i,s),l=(o+a)/2;let c,d,h;return o!==a&&(h=o-a,d=l>.5?h/(2-o-a):h/(o+a),c=zo(e,i,s,h,o),c=c*60+.5),[c|0,d||0,l]}function cn(n,t,e,i){return(Array.isArray(t)?n(t[0],t[1],t[2]):n(t,e,i)).map(Nt)}function dn(n,t,e){return cn(oi,n,t,e)}function Ro(n,t,e){return cn(Lo,n,t,e)}function Io(n,t,e){return cn(Vo,n,t,e)}function ai(n){return(n%360+360)%360}function Fo(n){const t=Oo.exec(n);let e=255,i;if(!t)return;t[5]!==i&&(e=t[6]?re(+t[5]):Nt(+t[5]));const s=ai(+t[2]),o=+t[3]/100,a=+t[4]/100;return t[1]==="hwb"?i=Ro(s,o,a):t[1]==="hsv"?i=Io(s,o,a):i=dn(s,o,a),{r:i[0],g:i[1],b:i[2],a:e}}function $o(n,t){var e=ln(n);e[0]=ai(e[0]+t),e=dn(e),n.r=e[0],n.g=e[1],n.b=e[2]}function Wo(n){if(!n)return;const t=ln(n),e=t[0],i=si(t[1]),s=si(t[2]);return n.a<255?`hsla(${e}, ${i}%, ${s}%, ${Mt(n.a)})`:`hsl(${e}, ${i}%, ${s}%)`}const ri={x:"dark",Z:"light",Y:"re",X:"blu",W:"gr",V:"medium",U:"slate",A:"ee",T:"ol",S:"or",B:"ra",C:"lateg",D:"ights",R:"in",Q:"turquois",E:"hi",P:"ro",O:"al",N:"le",M:"de",L:"yello",F:"en",K:"ch",G:"arks",H:"ea",I:"ightg",J:"wh"},li={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 Ho(){const n={},t=Object.keys(li),e=Object.keys(ri);let i,s,o,a,l;for(i=0;i<t.length;i++){for(a=l=t[i],s=0;s<e.length;s++)o=e[s],l=l.replace(o,ri[o]);o=parseInt(li[a],16),n[l]=[o>>16&255,o>>8&255,o&255]}return n}let Be;function jo(n){Be||(Be=Ho(),Be.transparent=[0,0,0,0]);const t=Be[n.toLowerCase()];return t&&{r:t[0],g:t[1],b:t[2],a:t.length===4?t[3]:255}}const qo=/^rgba?\(\s*([-+.\d]+)(%)?[\s,]+([-+.e\d]+)(%)?[\s,]+([-+.e\d]+)(%)?(?:[\s,/]+([-+.e\d]+)(%)?)?\s*\)$/;function Yo(n){const t=qo.exec(n);let e=255,i,s,o;if(t){if(t[7]!==i){const a=+t[7];e=t[8]?re(a):Pt(a*255,0,255)}return i=+t[1],s=+t[3],o=+t[5],i=255&(t[2]?re(i):Pt(i,0,255)),s=255&(t[4]?re(s):Pt(s,0,255)),o=255&(t[6]?re(o):Pt(o,0,255)),{r:i,g:s,b:o,a:e}}}function Uo(n){return n&&(n.a<255?`rgba(${n.r}, ${n.g}, ${n.b}, ${Mt(n.a)})`:`rgb(${n.r}, ${n.g}, ${n.b})`)}const hn=n=>n<=.0031308?n*12.92:Math.pow(n,1/2.4)*1.055-.055,Gt=n=>n<=.04045?n/12.92:Math.pow((n+.055)/1.055,2.4);function Xo(n,t,e){const i=Gt(Mt(n.r)),s=Gt(Mt(n.g)),o=Gt(Mt(n.b));return{r:Nt(hn(i+e*(Gt(Mt(t.r))-i))),g:Nt(hn(s+e*(Gt(Mt(t.g))-s))),b:Nt(hn(o+e*(Gt(Mt(t.b))-o))),a:n.a+e*(t.a-n.a)}}function De(n,t,e){if(n){let i=ln(n);i[t]=Math.max(0,Math.min(i[t]+i[t]*e,t===0?360:1)),i=dn(i),n.r=i[0],n.g=i[1],n.b=i[2]}}function ci(n,t){return n&&Object.assign(t||{},n)}function di(n){var t={r:0,g:0,b:0,a:255};return Array.isArray(n)?n.length>=3&&(t={r:n[0],g:n[1],b:n[2],a:255},n.length>3&&(t.a=Nt(n[3]))):(t=ci(n,{r:0,g:0,b:0,a:1}),t.a=Nt(t.a)),t}function Ko(n){return n.charAt(0)==="r"?Yo(n):Fo(n)}class le{constructor(t){if(t instanceof le)return t;const e=typeof t;let i;e==="object"?i=di(t):e==="string"&&(i=To(t)||jo(t)||Ko(t)),this._rgb=i,this._valid=!!i}get valid(){return this._valid}get rgb(){var t=ci(this._rgb);return t&&(t.a=Mt(t.a)),t}set rgb(t){this._rgb=di(t)}rgbString(){return this._valid?Uo(this._rgb):void 0}hexString(){return this._valid?No(this._rgb):void 0}hslString(){return this._valid?Wo(this._rgb):void 0}mix(t,e){if(t){const i=this.rgb,s=t.rgb;let o;const a=e===o?.5:e,l=2*a-1,c=i.a-s.a,d=((l*c===-1?l:(l+c)/(1+l*c))+1)/2;o=1-d,i.r=255&d*i.r+o*s.r+.5,i.g=255&d*i.g+o*s.g+.5,i.b=255&d*i.b+o*s.b+.5,i.a=a*i.a+(1-a)*s.a,this.rgb=i}return this}interpolate(t,e){return t&&(this._rgb=Xo(this._rgb,t._rgb,e)),this}clone(){return new le(this.rgb)}alpha(t){return this._rgb.a=Nt(t),this}clearer(t){const e=this._rgb;return e.a*=1-t,this}greyscale(){const t=this._rgb,e=ae(t.r*.3+t.g*.59+t.b*.11);return t.r=t.g=t.b=e,this}opaquer(t){const e=this._rgb;return e.a*=1+t,this}negate(){const t=this._rgb;return t.r=255-t.r,t.g=255-t.g,t.b=255-t.b,this}lighten(t){return De(this._rgb,2,t),this}darken(t){return De(this._rgb,2,-t),this}saturate(t){return De(this._rgb,1,t),this}desaturate(t){return De(this._rgb,1,-t),this}rotate(t){return $o(this._rgb,t),this}}/*!
|
|
7
|
+
* Chart.js v4.5.0
|
|
8
|
+
* https://www.chartjs.org
|
|
9
|
+
* (c) 2025 Chart.js Contributors
|
|
10
|
+
* Released under the MIT License
|
|
11
|
+
*/function vt(){}const Go=(()=>{let n=0;return()=>n++})();function tt(n){return n==null}function lt(n){if(Array.isArray&&Array.isArray(n))return!0;const t=Object.prototype.toString.call(n);return t.slice(0,7)==="[object"&&t.slice(-6)==="Array]"}function Q(n){return n!==null&&Object.prototype.toString.call(n)==="[object Object]"}function yt(n){return(typeof n=="number"||n instanceof Number)&&isFinite(+n)}function wt(n,t){return yt(n)?n:t}function U(n,t){return typeof n>"u"?t:n}const Qo=(n,t)=>typeof n=="string"&&n.endsWith("%")?parseFloat(n)/100:+n/t,hi=(n,t)=>typeof n=="string"&&n.endsWith("%")?parseFloat(n)/100*t:+n;function st(n,t,e){if(n&&typeof n.call=="function")return n.apply(e,t)}function et(n,t,e,i){let s,o,a;if(lt(n))for(o=n.length,s=0;s<o;s++)t.call(e,n[s],s);else if(Q(n))for(a=Object.keys(n),o=a.length,s=0;s<o;s++)t.call(e,n[a[s]],a[s])}function Ae(n,t){let e,i,s,o;if(!n||!t||n.length!==t.length)return!1;for(e=0,i=n.length;e<i;++e)if(s=n[e],o=t[e],s.datasetIndex!==o.datasetIndex||s.index!==o.index)return!1;return!0}function Te(n){if(lt(n))return n.map(Te);if(Q(n)){const t=Object.create(null),e=Object.keys(n),i=e.length;let s=0;for(;s<i;++s)t[e[s]]=Te(n[e[s]]);return t}return n}function ui(n){return["__proto__","prototype","constructor"].indexOf(n)===-1}function Jo(n,t,e,i){if(!ui(n))return;const s=t[n],o=e[n];Q(s)&&Q(o)?ce(s,o,i):t[n]=Te(o)}function ce(n,t,e){const i=lt(t)?t:[t],s=i.length;if(!Q(n))return n;e=e||{};const o=e.merger||Jo;let a;for(let l=0;l<s;++l){if(a=i[l],!Q(a))continue;const c=Object.keys(a);for(let d=0,h=c.length;d<h;++d)o(c[d],n,a,e)}return n}function de(n,t){return ce(n,t,{merger:Zo})}function Zo(n,t,e){if(!ui(n))return;const i=t[n],s=e[n];Q(i)&&Q(s)?de(i,s):Object.prototype.hasOwnProperty.call(t,n)||(t[n]=Te(s))}const fi={"":n=>n,x:n=>n.x,y:n=>n.y};function ta(n){const t=n.split("."),e=[];let i="";for(const s of t)i+=s,i.endsWith("\\")?i=i.slice(0,-1)+".":(e.push(i),i="");return e}function ea(n){const t=ta(n);return e=>{for(const i of t){if(i==="")break;e=e&&e[i]}return e}}function Rt(n,t){return(fi[t]||(fi[t]=ea(t)))(n)}function un(n){return n.charAt(0).toUpperCase()+n.slice(1)}const he=n=>typeof n<"u",Ot=n=>typeof n=="function",pi=(n,t)=>{if(n.size!==t.size)return!1;for(const e of n)if(!t.has(e))return!1;return!0};function na(n){return n.type==="mouseup"||n.type==="click"||n.type==="contextmenu"}const nt=Math.PI,at=2*nt,ia=at+nt,Pe=Number.POSITIVE_INFINITY,sa=nt/180,ct=nt/2,It=nt/4,mi=nt*2/3,gi=Math.log10,St=Math.sign;function ue(n,t,e){return Math.abs(n-t)<e}function bi(n){const t=Math.round(n);n=ue(n,t,n/1e3)?t:n;const e=Math.pow(10,Math.floor(gi(n))),i=n/e;return(i<=1?1:i<=2?2:i<=5?5:10)*e}function oa(n){const t=[],e=Math.sqrt(n);let i;for(i=1;i<e;i++)n%i===0&&(t.push(i),t.push(n/i));return e===(e|0)&&t.push(e),t.sort((s,o)=>s-o).pop(),t}function aa(n){return typeof n=="symbol"||typeof n=="object"&&n!==null&&!(Symbol.toPrimitive in n||"toString"in n||"valueOf"in n)}function Qt(n){return!aa(n)&&!isNaN(parseFloat(n))&&isFinite(n)}function ra(n,t){const e=Math.round(n);return e-t<=n&&e+t>=n}function la(n,t,e){let i,s,o;for(i=0,s=n.length;i<s;i++)o=n[i][e],isNaN(o)||(t.min=Math.min(t.min,o),t.max=Math.max(t.max,o))}function Bt(n){return n*(nt/180)}function ca(n){return n*(180/nt)}function yi(n){if(!yt(n))return;let t=1,e=0;for(;Math.round(n*t)/t!==n;)t*=10,e++;return e}function _i(n,t){const e=t.x-n.x,i=t.y-n.y,s=Math.sqrt(e*e+i*i);let o=Math.atan2(i,e);return o<-.5*nt&&(o+=at),{angle:o,distance:s}}function fn(n,t){return Math.sqrt(Math.pow(t.x-n.x,2)+Math.pow(t.y-n.y,2))}function da(n,t){return(n-t+ia)%at-nt}function xt(n){return(n%at+at)%at}function fe(n,t,e,i){const s=xt(n),o=xt(t),a=xt(e),l=xt(o-s),c=xt(a-s),d=xt(s-o),h=xt(s-a);return s===o||s===a||i&&o===a||l>c&&d<h}function ht(n,t,e){return Math.max(t,Math.min(e,n))}function ha(n){return ht(n,-32768,32767)}function Vt(n,t,e,i=1e-6){return n>=Math.min(t,e)-i&&n<=Math.max(t,e)+i}function pn(n,t,e){e=e||(a=>n[a]<t);let i=n.length-1,s=0,o;for(;i-s>1;)o=s+i>>1,e(o)?s=o:i=o;return{lo:s,hi:i}}const Ft=(n,t,e,i)=>pn(n,e,i?s=>{const o=n[s][t];return o<e||o===e&&n[s+1][t]===e}:s=>n[s][t]<e),ua=(n,t,e)=>pn(n,e,i=>n[i][t]>=e);function fa(n,t,e){let i=0,s=n.length;for(;i<s&&n[i]<t;)i++;for(;s>i&&n[s-1]>e;)s--;return i>0||s<n.length?n.slice(i,s):n}const ki=["push","pop","shift","splice","unshift"];function pa(n,t){if(n._chartjs){n._chartjs.listeners.push(t);return}Object.defineProperty(n,"_chartjs",{configurable:!0,enumerable:!1,value:{listeners:[t]}}),ki.forEach(e=>{const i="_onData"+un(e),s=n[e];Object.defineProperty(n,e,{configurable:!0,enumerable:!1,value(...o){const a=s.apply(this,o);return n._chartjs.listeners.forEach(l=>{typeof l[i]=="function"&&l[i](...o)}),a}})})}function xi(n,t){const e=n._chartjs;if(!e)return;const i=e.listeners,s=i.indexOf(t);s!==-1&&i.splice(s,1),!(i.length>0)&&(ki.forEach(o=>{delete n[o]}),delete n._chartjs)}function wi(n){const t=new Set(n);return t.size===n.length?n:Array.from(t)}const Si=(function(){return typeof window>"u"?function(n){return n()}:window.requestAnimationFrame})();function Ci(n,t){let e=[],i=!1;return function(...s){e=s,i||(i=!0,Si.call(window,()=>{i=!1,n.apply(t,e)}))}}function ma(n,t){let e;return function(...i){return t?(clearTimeout(e),e=setTimeout(n,t,i)):n.apply(this,i),t}}const mn=n=>n==="start"?"left":n==="end"?"right":"center",ut=(n,t,e)=>n==="start"?t:n==="end"?e:(t+e)/2,ga=(n,t,e,i)=>n===(i?"left":"right")?e:n==="center"?(t+e)/2:t;function Ei(n,t,e){const i=t.length;let s=0,o=i;if(n._sorted){const{iScale:a,vScale:l,_parsed:c}=n,d=n.dataset&&n.dataset.options?n.dataset.options.spanGaps:null,h=a.axis,{min:u,max:f,minDefined:p,maxDefined:g}=a.getUserBounds();if(p){if(s=Math.min(Ft(c,h,u).lo,e?i:Ft(t,h,a.getPixelForValue(u)).lo),d){const b=c.slice(0,s+1).reverse().findIndex(m=>!tt(m[l.axis]));s-=Math.max(0,b)}s=ht(s,0,i-1)}if(g){let b=Math.max(Ft(c,a.axis,f,!0).hi+1,e?0:Ft(t,h,a.getPixelForValue(f),!0).hi+1);if(d){const m=c.slice(b-1).findIndex(_=>!tt(_[l.axis]));b+=Math.max(0,m)}o=ht(b,s,i)-s}else o=i-s}return{start:s,count:o}}function Mi(n){const{xScale:t,yScale:e,_scaleRanges:i}=n,s={xmin:t.min,xmax:t.max,ymin:e.min,ymax:e.max};if(!i)return n._scaleRanges=s,!0;const o=i.xmin!==t.min||i.xmax!==t.max||i.ymin!==e.min||i.ymax!==e.max;return Object.assign(i,s),o}const Ne=n=>n===0||n===1,vi=(n,t,e)=>-(Math.pow(2,10*(n-=1))*Math.sin((n-t)*at/e)),Bi=(n,t,e)=>Math.pow(2,-10*n)*Math.sin((n-t)*at/e)+1,pe={linear:n=>n,easeInQuad:n=>n*n,easeOutQuad:n=>-n*(n-2),easeInOutQuad:n=>(n/=.5)<1?.5*n*n:-.5*(--n*(n-2)-1),easeInCubic:n=>n*n*n,easeOutCubic:n=>(n-=1)*n*n+1,easeInOutCubic:n=>(n/=.5)<1?.5*n*n*n:.5*((n-=2)*n*n+2),easeInQuart:n=>n*n*n*n,easeOutQuart:n=>-((n-=1)*n*n*n-1),easeInOutQuart:n=>(n/=.5)<1?.5*n*n*n*n:-.5*((n-=2)*n*n*n-2),easeInQuint:n=>n*n*n*n*n,easeOutQuint:n=>(n-=1)*n*n*n*n+1,easeInOutQuint:n=>(n/=.5)<1?.5*n*n*n*n*n:.5*((n-=2)*n*n*n*n+2),easeInSine:n=>-Math.cos(n*ct)+1,easeOutSine:n=>Math.sin(n*ct),easeInOutSine:n=>-.5*(Math.cos(nt*n)-1),easeInExpo:n=>n===0?0:Math.pow(2,10*(n-1)),easeOutExpo:n=>n===1?1:-Math.pow(2,-10*n)+1,easeInOutExpo:n=>Ne(n)?n:n<.5?.5*Math.pow(2,10*(n*2-1)):.5*(-Math.pow(2,-10*(n*2-1))+2),easeInCirc:n=>n>=1?n:-(Math.sqrt(1-n*n)-1),easeOutCirc:n=>Math.sqrt(1-(n-=1)*n),easeInOutCirc:n=>(n/=.5)<1?-.5*(Math.sqrt(1-n*n)-1):.5*(Math.sqrt(1-(n-=2)*n)+1),easeInElastic:n=>Ne(n)?n:vi(n,.075,.3),easeOutElastic:n=>Ne(n)?n:Bi(n,.075,.3),easeInOutElastic(n){return Ne(n)?n:n<.5?.5*vi(n*2,.1125,.45):.5+.5*Bi(n*2-1,.1125,.45)},easeInBack(n){return n*n*((1.70158+1)*n-1.70158)},easeOutBack(n){return(n-=1)*n*((1.70158+1)*n+1.70158)+1},easeInOutBack(n){let t=1.70158;return(n/=.5)<1?.5*(n*n*(((t*=1.525)+1)*n-t)):.5*((n-=2)*n*(((t*=1.525)+1)*n+t)+2)},easeInBounce:n=>1-pe.easeOutBounce(1-n),easeOutBounce(n){return n<1/2.75?7.5625*n*n:n<2/2.75?7.5625*(n-=1.5/2.75)*n+.75:n<2.5/2.75?7.5625*(n-=2.25/2.75)*n+.9375:7.5625*(n-=2.625/2.75)*n+.984375},easeInOutBounce:n=>n<.5?pe.easeInBounce(n*2)*.5:pe.easeOutBounce(n*2-1)*.5+.5};function gn(n){if(n&&typeof n=="object"){const t=n.toString();return t==="[object CanvasPattern]"||t==="[object CanvasGradient]"}return!1}function Di(n){return gn(n)?n:new le(n)}function bn(n){return gn(n)?n:new le(n).saturate(.5).darken(.1).hexString()}const ba=["x","y","borderWidth","radius","tension"],ya=["color","borderColor","backgroundColor"];function _a(n){n.set("animation",{delay:void 0,duration:1e3,easing:"easeOutQuart",fn:void 0,from:void 0,loop:void 0,to:void 0,type:void 0}),n.describe("animation",{_fallback:!1,_indexable:!1,_scriptable:t=>t!=="onProgress"&&t!=="onComplete"&&t!=="fn"}),n.set("animations",{colors:{type:"color",properties:ya},numbers:{type:"number",properties:ba}}),n.describe("animations",{_fallback:"animation"}),n.set("transitions",{active:{animation:{duration:400}},resize:{animation:{duration:0}},show:{animations:{colors:{from:"transparent"},visible:{type:"boolean",duration:0}}},hide:{animations:{colors:{to:"transparent"},visible:{type:"boolean",easing:"linear",fn:t=>t|0}}}})}function ka(n){n.set("layout",{autoPadding:!0,padding:{top:0,right:0,bottom:0,left:0}})}const Ai=new Map;function xa(n,t){t=t||{};const e=n+JSON.stringify(t);let i=Ai.get(e);return i||(i=new Intl.NumberFormat(n,t),Ai.set(e,i)),i}function yn(n,t,e){return xa(t,e).format(n)}const wa={values(n){return lt(n)?n:""+n},numeric(n,t,e){if(n===0)return"0";const i=this.chart.options.locale;let s,o=n;if(e.length>1){const d=Math.max(Math.abs(e[0].value),Math.abs(e[e.length-1].value));(d<1e-4||d>1e15)&&(s="scientific"),o=Sa(n,e)}const a=gi(Math.abs(o)),l=isNaN(a)?1:Math.max(Math.min(-1*Math.floor(a),20),0),c={notation:s,minimumFractionDigits:l,maximumFractionDigits:l};return Object.assign(c,this.options.ticks.format),yn(n,i,c)}};function Sa(n,t){let e=t.length>3?t[2].value-t[1].value:t[1].value-t[0].value;return Math.abs(e)>=1&&n!==Math.floor(n)&&(e=n-Math.floor(n)),e}var Ti={formatters:wa};function Ca(n){n.set("scale",{display:!0,offset:!1,reverse:!1,beginAtZero:!1,bounds:"ticks",clip:!0,grace:0,grid:{display:!0,lineWidth:1,drawOnChartArea:!0,drawTicks:!0,tickLength:8,tickWidth:(t,e)=>e.lineWidth,tickColor:(t,e)=>e.color,offset:!1},border:{display:!0,dash:[],dashOffset:0,width:1},title:{display:!1,text:"",padding:{top:4,bottom:4}},ticks:{minRotation:0,maxRotation:50,mirror:!1,textStrokeWidth:0,textStrokeColor:"",padding:3,display:!0,autoSkip:!0,autoSkipPadding:3,labelOffset:0,callback:Ti.formatters.values,minor:{},major:{},align:"center",crossAlign:"near",showLabelBackdrop:!1,backdropColor:"rgba(255, 255, 255, 0.75)",backdropPadding:2}}),n.route("scale.ticks","color","","color"),n.route("scale.grid","color","","borderColor"),n.route("scale.border","color","","borderColor"),n.route("scale.title","color","","color"),n.describe("scale",{_fallback:!1,_scriptable:t=>!t.startsWith("before")&&!t.startsWith("after")&&t!=="callback"&&t!=="parser",_indexable:t=>t!=="borderDash"&&t!=="tickBorderDash"&&t!=="dash"}),n.describe("scales",{_fallback:"scale"}),n.describe("scale.ticks",{_scriptable:t=>t!=="backdropPadding"&&t!=="callback",_indexable:t=>t!=="backdropPadding"})}const $t=Object.create(null),_n=Object.create(null);function me(n,t){if(!t)return n;const e=t.split(".");for(let i=0,s=e.length;i<s;++i){const o=e[i];n=n[o]||(n[o]=Object.create(null))}return n}function kn(n,t,e){return typeof t=="string"?ce(me(n,t),e):ce(me(n,""),t)}class Ea{constructor(t,e){this.animation=void 0,this.backgroundColor="rgba(0,0,0,0.1)",this.borderColor="rgba(0,0,0,0.1)",this.color="#666",this.datasets={},this.devicePixelRatio=i=>i.chart.platform.getDevicePixelRatio(),this.elements={},this.events=["mousemove","mouseout","click","touchstart","touchmove"],this.font={family:"'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",size:12,style:"normal",lineHeight:1.2,weight:null},this.hover={},this.hoverBackgroundColor=(i,s)=>bn(s.backgroundColor),this.hoverBorderColor=(i,s)=>bn(s.borderColor),this.hoverColor=(i,s)=>bn(s.color),this.indexAxis="x",this.interaction={mode:"nearest",intersect:!0,includeInvisible:!1},this.maintainAspectRatio=!0,this.onHover=null,this.onClick=null,this.parsing=!0,this.plugins={},this.responsive=!0,this.scale=void 0,this.scales={},this.showLine=!0,this.drawActiveElementsOnTop=!0,this.describe(t),this.apply(e)}set(t,e){return kn(this,t,e)}get(t){return me(this,t)}describe(t,e){return kn(_n,t,e)}override(t,e){return kn($t,t,e)}route(t,e,i,s){const o=me(this,t),a=me(this,i),l="_"+e;Object.defineProperties(o,{[l]:{value:o[e],writable:!0},[e]:{enumerable:!0,get(){const c=this[l],d=a[s];return Q(c)?Object.assign({},d,c):U(c,d)},set(c){this[l]=c}}})}apply(t){t.forEach(e=>e(this))}}var rt=new Ea({_scriptable:n=>!n.startsWith("on"),_indexable:n=>n!=="events",hover:{_fallback:"interaction"},interaction:{_scriptable:!1,_indexable:!1}},[_a,ka,Ca]);function Ma(n){return!n||tt(n.size)||tt(n.family)?null:(n.style?n.style+" ":"")+(n.weight?n.weight+" ":"")+n.size+"px "+n.family}function Pi(n,t,e,i,s){let o=t[s];return o||(o=t[s]=n.measureText(s).width,e.push(s)),o>i&&(i=o),i}function Wt(n,t,e){const i=n.currentDevicePixelRatio,s=e!==0?Math.max(e/2,.5):0;return Math.round((t-s)*i)/i+s}function Ni(n,t){!t&&!n||(t=t||n.getContext("2d"),t.save(),t.resetTransform(),t.clearRect(0,0,n.width,n.height),t.restore())}function xn(n,t,e,i){Oi(n,t,e,i,null)}function Oi(n,t,e,i,s){let o,a,l,c,d,h,u,f;const p=t.pointStyle,g=t.rotation,b=t.radius;let m=(g||0)*sa;if(p&&typeof p=="object"&&(o=p.toString(),o==="[object HTMLImageElement]"||o==="[object HTMLCanvasElement]")){n.save(),n.translate(e,i),n.rotate(m),n.drawImage(p,-p.width/2,-p.height/2,p.width,p.height),n.restore();return}if(!(isNaN(b)||b<=0)){switch(n.beginPath(),p){default:s?n.ellipse(e,i,s/2,b,0,0,at):n.arc(e,i,b,0,at),n.closePath();break;case"triangle":h=s?s/2:b,n.moveTo(e+Math.sin(m)*h,i-Math.cos(m)*b),m+=mi,n.lineTo(e+Math.sin(m)*h,i-Math.cos(m)*b),m+=mi,n.lineTo(e+Math.sin(m)*h,i-Math.cos(m)*b),n.closePath();break;case"rectRounded":d=b*.516,c=b-d,a=Math.cos(m+It)*c,u=Math.cos(m+It)*(s?s/2-d:c),l=Math.sin(m+It)*c,f=Math.sin(m+It)*(s?s/2-d:c),n.arc(e-u,i-l,d,m-nt,m-ct),n.arc(e+f,i-a,d,m-ct,m),n.arc(e+u,i+l,d,m,m+ct),n.arc(e-f,i+a,d,m+ct,m+nt),n.closePath();break;case"rect":if(!g){c=Math.SQRT1_2*b,h=s?s/2:c,n.rect(e-h,i-c,2*h,2*c);break}m+=It;case"rectRot":u=Math.cos(m)*(s?s/2:b),a=Math.cos(m)*b,l=Math.sin(m)*b,f=Math.sin(m)*(s?s/2:b),n.moveTo(e-u,i-l),n.lineTo(e+f,i-a),n.lineTo(e+u,i+l),n.lineTo(e-f,i+a),n.closePath();break;case"crossRot":m+=It;case"cross":u=Math.cos(m)*(s?s/2:b),a=Math.cos(m)*b,l=Math.sin(m)*b,f=Math.sin(m)*(s?s/2:b),n.moveTo(e-u,i-l),n.lineTo(e+u,i+l),n.moveTo(e+f,i-a),n.lineTo(e-f,i+a);break;case"star":u=Math.cos(m)*(s?s/2:b),a=Math.cos(m)*b,l=Math.sin(m)*b,f=Math.sin(m)*(s?s/2:b),n.moveTo(e-u,i-l),n.lineTo(e+u,i+l),n.moveTo(e+f,i-a),n.lineTo(e-f,i+a),m+=It,u=Math.cos(m)*(s?s/2:b),a=Math.cos(m)*b,l=Math.sin(m)*b,f=Math.sin(m)*(s?s/2:b),n.moveTo(e-u,i-l),n.lineTo(e+u,i+l),n.moveTo(e+f,i-a),n.lineTo(e-f,i+a);break;case"line":a=s?s/2:Math.cos(m)*b,l=Math.sin(m)*b,n.moveTo(e-a,i-l),n.lineTo(e+a,i+l);break;case"dash":n.moveTo(e,i),n.lineTo(e+Math.cos(m)*(s?s/2:b),i+Math.sin(m)*b);break;case!1:n.closePath();break}n.fill(),t.borderWidth>0&&n.stroke()}}function ge(n,t,e){return e=e||.5,!t||n&&n.x>t.left-e&&n.x<t.right+e&&n.y>t.top-e&&n.y<t.bottom+e}function wn(n,t){n.save(),n.beginPath(),n.rect(t.left,t.top,t.right-t.left,t.bottom-t.top),n.clip()}function Sn(n){n.restore()}function va(n,t,e,i,s){if(!t)return n.lineTo(e.x,e.y);if(s==="middle"){const o=(t.x+e.x)/2;n.lineTo(o,t.y),n.lineTo(o,e.y)}else s==="after"!=!!i?n.lineTo(t.x,e.y):n.lineTo(e.x,t.y);n.lineTo(e.x,e.y)}function Ba(n,t,e,i){if(!t)return n.lineTo(e.x,e.y);n.bezierCurveTo(i?t.cp1x:t.cp2x,i?t.cp1y:t.cp2y,i?e.cp2x:e.cp1x,i?e.cp2y:e.cp1y,e.x,e.y)}function Da(n,t){t.translation&&n.translate(t.translation[0],t.translation[1]),tt(t.rotation)||n.rotate(t.rotation),t.color&&(n.fillStyle=t.color),t.textAlign&&(n.textAlign=t.textAlign),t.textBaseline&&(n.textBaseline=t.textBaseline)}function Aa(n,t,e,i,s){if(s.strikethrough||s.underline){const o=n.measureText(i),a=t-o.actualBoundingBoxLeft,l=t+o.actualBoundingBoxRight,c=e-o.actualBoundingBoxAscent,d=e+o.actualBoundingBoxDescent,h=s.strikethrough?(c+d)/2:d;n.strokeStyle=n.fillStyle,n.beginPath(),n.lineWidth=s.decorationWidth||2,n.moveTo(a,h),n.lineTo(l,h),n.stroke()}}function Ta(n,t){const e=n.fillStyle;n.fillStyle=t.color,n.fillRect(t.left,t.top,t.width,t.height),n.fillStyle=e}function be(n,t,e,i,s,o={}){const a=lt(t)?t:[t],l=o.strokeWidth>0&&o.strokeColor!=="";let c,d;for(n.save(),n.font=s.string,Da(n,o),c=0;c<a.length;++c)d=a[c],o.backdrop&&Ta(n,o.backdrop),l&&(o.strokeColor&&(n.strokeStyle=o.strokeColor),tt(o.strokeWidth)||(n.lineWidth=o.strokeWidth),n.strokeText(d,e,i,o.maxWidth)),n.fillText(d,e,i,o.maxWidth),Aa(n,e,i,d,o),i+=Number(s.lineHeight);n.restore()}function Oe(n,t){const{x:e,y:i,w:s,h:o,radius:a}=t;n.arc(e+a.topLeft,i+a.topLeft,a.topLeft,1.5*nt,nt,!0),n.lineTo(e,i+o-a.bottomLeft),n.arc(e+a.bottomLeft,i+o-a.bottomLeft,a.bottomLeft,nt,ct,!0),n.lineTo(e+s-a.bottomRight,i+o),n.arc(e+s-a.bottomRight,i+o-a.bottomRight,a.bottomRight,ct,0,!0),n.lineTo(e+s,i+a.topRight),n.arc(e+s-a.topRight,i+a.topRight,a.topRight,0,-ct,!0),n.lineTo(e+a.topLeft,i)}const Pa=/^(normal|(\d+(?:\.\d+)?)(px|em|%)?)$/,Na=/^(normal|italic|initial|inherit|unset|(oblique( -?[0-9]?[0-9]deg)?))$/;function Oa(n,t){const e=(""+n).match(Pa);if(!e||e[1]==="normal")return t*1.2;switch(n=+e[2],e[3]){case"px":return n;case"%":n/=100;break}return t*n}const Va=n=>+n||0;function Cn(n,t){const e={},i=Q(t),s=i?Object.keys(t):t,o=Q(n)?i?a=>U(n[a],n[t[a]]):a=>n[a]:()=>n;for(const a of s)e[a]=Va(o(a));return e}function Vi(n){return Cn(n,{top:"y",right:"x",bottom:"y",left:"x"})}function Jt(n){return Cn(n,["topLeft","topRight","bottomLeft","bottomRight"])}function _t(n){const t=Vi(n);return t.width=t.left+t.right,t.height=t.top+t.bottom,t}function ft(n,t){n=n||{},t=t||rt.font;let e=U(n.size,t.size);typeof e=="string"&&(e=parseInt(e,10));let i=U(n.style,t.style);i&&!(""+i).match(Na)&&(console.warn('Invalid font style specified: "'+i+'"'),i=void 0);const s={family:U(n.family,t.family),lineHeight:Oa(U(n.lineHeight,t.lineHeight),e),size:e,style:i,weight:U(n.weight,t.weight),string:""};return s.string=Ma(s),s}function Ve(n,t,e,i){let s,o,a;for(s=0,o=n.length;s<o;++s)if(a=n[s],a!==void 0&&a!==void 0)return a}function La(n,t,e){const{min:i,max:s}=n,o=hi(t,(s-i)/2),a=(l,c)=>e&&l===0?0:l+c;return{min:a(i,-Math.abs(o)),max:a(s,o)}}function Ht(n,t){return Object.assign(Object.create(n),t)}function En(n,t=[""],e,i,s=()=>n[0]){const o=e||n;typeof i>"u"&&(i=Fi("_fallback",n));const a={[Symbol.toStringTag]:"Object",_cacheable:!0,_scopes:n,_rootScopes:o,_fallback:i,_getTarget:s,override:l=>En([l,...n],t,o,i)};return new Proxy(a,{deleteProperty(l,c){return delete l[c],delete l._keys,delete n[0][c],!0},get(l,c){return zi(l,c,()=>ja(c,t,n,l))},getOwnPropertyDescriptor(l,c){return Reflect.getOwnPropertyDescriptor(l._scopes[0],c)},getPrototypeOf(){return Reflect.getPrototypeOf(n[0])},has(l,c){return $i(l).includes(c)},ownKeys(l){return $i(l)},set(l,c,d){const h=l._storage||(l._storage=s());return l[c]=h[c]=d,delete l._keys,!0}})}function Zt(n,t,e,i){const s={_cacheable:!1,_proxy:n,_context:t,_subProxy:e,_stack:new Set,_descriptors:Li(n,i),setContext:o=>Zt(n,o,e,i),override:o=>Zt(n.override(o),t,e,i)};return new Proxy(s,{deleteProperty(o,a){return delete o[a],delete n[a],!0},get(o,a,l){return zi(o,a,()=>Ra(o,a,l))},getOwnPropertyDescriptor(o,a){return o._descriptors.allKeys?Reflect.has(n,a)?{enumerable:!0,configurable:!0}:void 0:Reflect.getOwnPropertyDescriptor(n,a)},getPrototypeOf(){return Reflect.getPrototypeOf(n)},has(o,a){return Reflect.has(n,a)},ownKeys(){return Reflect.ownKeys(n)},set(o,a,l){return n[a]=l,delete o[a],!0}})}function Li(n,t={scriptable:!0,indexable:!0}){const{_scriptable:e=t.scriptable,_indexable:i=t.indexable,_allKeys:s=t.allKeys}=n;return{allKeys:s,scriptable:e,indexable:i,isScriptable:Ot(e)?e:()=>e,isIndexable:Ot(i)?i:()=>i}}const za=(n,t)=>n?n+un(t):t,Mn=(n,t)=>Q(t)&&n!=="adapters"&&(Object.getPrototypeOf(t)===null||t.constructor===Object);function zi(n,t,e){if(Object.prototype.hasOwnProperty.call(n,t)||t==="constructor")return n[t];const i=e();return n[t]=i,i}function Ra(n,t,e){const{_proxy:i,_context:s,_subProxy:o,_descriptors:a}=n;let l=i[t];return Ot(l)&&a.isScriptable(t)&&(l=Ia(t,l,n,e)),lt(l)&&l.length&&(l=Fa(t,l,n,a.isIndexable)),Mn(t,l)&&(l=Zt(l,s,o&&o[t],a)),l}function Ia(n,t,e,i){const{_proxy:s,_context:o,_subProxy:a,_stack:l}=e;if(l.has(n))throw new Error("Recursion detected: "+Array.from(l).join("->")+"->"+n);l.add(n);let c=t(o,a||i);return l.delete(n),Mn(n,c)&&(c=vn(s._scopes,s,n,c)),c}function Fa(n,t,e,i){const{_proxy:s,_context:o,_subProxy:a,_descriptors:l}=e;if(typeof o.index<"u"&&i(n))return t[o.index%t.length];if(Q(t[0])){const c=t,d=s._scopes.filter(h=>h!==c);t=[];for(const h of c){const u=vn(d,s,n,h);t.push(Zt(u,o,a&&a[n],l))}}return t}function Ri(n,t,e){return Ot(n)?n(t,e):n}const $a=(n,t)=>n===!0?t:typeof n=="string"?Rt(t,n):void 0;function Wa(n,t,e,i,s){for(const o of t){const a=$a(e,o);if(a){n.add(a);const l=Ri(a._fallback,e,s);if(typeof l<"u"&&l!==e&&l!==i)return l}else if(a===!1&&typeof i<"u"&&e!==i)return null}return!1}function vn(n,t,e,i){const s=t._rootScopes,o=Ri(t._fallback,e,i),a=[...n,...s],l=new Set;l.add(i);let c=Ii(l,a,e,o||e,i);return c===null||typeof o<"u"&&o!==e&&(c=Ii(l,a,o,c,i),c===null)?!1:En(Array.from(l),[""],s,o,()=>Ha(t,e,i))}function Ii(n,t,e,i,s){for(;e;)e=Wa(n,t,e,i,s);return e}function Ha(n,t,e){const i=n._getTarget();t in i||(i[t]={});const s=i[t];return lt(s)&&Q(e)?e:s||{}}function ja(n,t,e,i){let s;for(const o of t)if(s=Fi(za(o,n),e),typeof s<"u")return Mn(n,s)?vn(e,i,n,s):s}function Fi(n,t){for(const e of t){if(!e)continue;const i=e[n];if(typeof i<"u")return i}}function $i(n){let t=n._keys;return t||(t=n._keys=qa(n._scopes)),t}function qa(n){const t=new Set;for(const e of n)for(const i of Object.keys(e).filter(s=>!s.startsWith("_")))t.add(i);return Array.from(t)}const Ya=Number.EPSILON||1e-14,te=(n,t)=>t<n.length&&!n[t].skip&&n[t],Wi=n=>n==="x"?"y":"x";function Ua(n,t,e,i){const s=n.skip?t:n,o=t,a=e.skip?t:e,l=fn(o,s),c=fn(a,o);let d=l/(l+c),h=c/(l+c);d=isNaN(d)?0:d,h=isNaN(h)?0:h;const u=i*d,f=i*h;return{previous:{x:o.x-u*(a.x-s.x),y:o.y-u*(a.y-s.y)},next:{x:o.x+f*(a.x-s.x),y:o.y+f*(a.y-s.y)}}}function Xa(n,t,e){const i=n.length;let s,o,a,l,c,d=te(n,0);for(let h=0;h<i-1;++h)if(c=d,d=te(n,h+1),!(!c||!d)){if(ue(t[h],0,Ya)){e[h]=e[h+1]=0;continue}s=e[h]/t[h],o=e[h+1]/t[h],l=Math.pow(s,2)+Math.pow(o,2),!(l<=9)&&(a=3/Math.sqrt(l),e[h]=s*a*t[h],e[h+1]=o*a*t[h])}}function Ka(n,t,e="x"){const i=Wi(e),s=n.length;let o,a,l,c=te(n,0);for(let d=0;d<s;++d){if(a=l,l=c,c=te(n,d+1),!l)continue;const h=l[e],u=l[i];a&&(o=(h-a[e])/3,l[`cp1${e}`]=h-o,l[`cp1${i}`]=u-o*t[d]),c&&(o=(c[e]-h)/3,l[`cp2${e}`]=h+o,l[`cp2${i}`]=u+o*t[d])}}function Ga(n,t="x"){const e=Wi(t),i=n.length,s=Array(i).fill(0),o=Array(i);let a,l,c,d=te(n,0);for(a=0;a<i;++a)if(l=c,c=d,d=te(n,a+1),!!c){if(d){const h=d[t]-c[t];s[a]=h!==0?(d[e]-c[e])/h:0}o[a]=l?d?St(s[a-1])!==St(s[a])?0:(s[a-1]+s[a])/2:s[a-1]:s[a]}Xa(n,s,o),Ka(n,o,t)}function Le(n,t,e){return Math.max(Math.min(n,e),t)}function Qa(n,t){let e,i,s,o,a,l=ge(n[0],t);for(e=0,i=n.length;e<i;++e)a=o,o=l,l=e<i-1&&ge(n[e+1],t),o&&(s=n[e],a&&(s.cp1x=Le(s.cp1x,t.left,t.right),s.cp1y=Le(s.cp1y,t.top,t.bottom)),l&&(s.cp2x=Le(s.cp2x,t.left,t.right),s.cp2y=Le(s.cp2y,t.top,t.bottom)))}function Ja(n,t,e,i,s){let o,a,l,c;if(t.spanGaps&&(n=n.filter(d=>!d.skip)),t.cubicInterpolationMode==="monotone")Ga(n,s);else{let d=i?n[n.length-1]:n[0];for(o=0,a=n.length;o<a;++o)l=n[o],c=Ua(d,l,n[Math.min(o+1,a-(i?0:1))%a],t.tension),l.cp1x=c.previous.x,l.cp1y=c.previous.y,l.cp2x=c.next.x,l.cp2y=c.next.y,d=l}t.capBezierPoints&&Qa(n,e)}function Bn(){return typeof window<"u"&&typeof document<"u"}function Dn(n){let t=n.parentNode;return t&&t.toString()==="[object ShadowRoot]"&&(t=t.host),t}function ze(n,t,e){let i;return typeof n=="string"?(i=parseInt(n,10),n.indexOf("%")!==-1&&(i=i/100*t.parentNode[e])):i=n,i}const Re=n=>n.ownerDocument.defaultView.getComputedStyle(n,null);function Za(n,t){return Re(n).getPropertyValue(t)}const tr=["top","right","bottom","left"];function jt(n,t,e){const i={};e=e?"-"+e:"";for(let s=0;s<4;s++){const o=tr[s];i[o]=parseFloat(n[t+"-"+o+e])||0}return i.width=i.left+i.right,i.height=i.top+i.bottom,i}const er=(n,t,e)=>(n>0||t>0)&&(!e||!e.shadowRoot);function nr(n,t){const e=n.touches,i=e&&e.length?e[0]:n,{offsetX:s,offsetY:o}=i;let a=!1,l,c;if(er(s,o,n.target))l=s,c=o;else{const d=t.getBoundingClientRect();l=i.clientX-d.left,c=i.clientY-d.top,a=!0}return{x:l,y:c,box:a}}function qt(n,t){if("native"in n)return n;const{canvas:e,currentDevicePixelRatio:i}=t,s=Re(e),o=s.boxSizing==="border-box",a=jt(s,"padding"),l=jt(s,"border","width"),{x:c,y:d,box:h}=nr(n,e),u=a.left+(h&&l.left),f=a.top+(h&&l.top);let{width:p,height:g}=t;return o&&(p-=a.width+l.width,g-=a.height+l.height),{x:Math.round((c-u)/p*e.width/i),y:Math.round((d-f)/g*e.height/i)}}function ir(n,t,e){let i,s;if(t===void 0||e===void 0){const o=n&&Dn(n);if(!o)t=n.clientWidth,e=n.clientHeight;else{const a=o.getBoundingClientRect(),l=Re(o),c=jt(l,"border","width"),d=jt(l,"padding");t=a.width-d.width-c.width,e=a.height-d.height-c.height,i=ze(l.maxWidth,o,"clientWidth"),s=ze(l.maxHeight,o,"clientHeight")}}return{width:t,height:e,maxWidth:i||Pe,maxHeight:s||Pe}}const Ie=n=>Math.round(n*10)/10;function sr(n,t,e,i){const s=Re(n),o=jt(s,"margin"),a=ze(s.maxWidth,n,"clientWidth")||Pe,l=ze(s.maxHeight,n,"clientHeight")||Pe,c=ir(n,t,e);let{width:d,height:h}=c;if(s.boxSizing==="content-box"){const f=jt(s,"border","width"),p=jt(s,"padding");d-=p.width+f.width,h-=p.height+f.height}return d=Math.max(0,d-o.width),h=Math.max(0,i?d/i:h-o.height),d=Ie(Math.min(d,a,c.maxWidth)),h=Ie(Math.min(h,l,c.maxHeight)),d&&!h&&(h=Ie(d/2)),(t!==void 0||e!==void 0)&&i&&c.height&&h>c.height&&(h=c.height,d=Ie(Math.floor(h*i))),{width:d,height:h}}function Hi(n,t,e){const i=t||1,s=Math.floor(n.height*i),o=Math.floor(n.width*i);n.height=Math.floor(n.height),n.width=Math.floor(n.width);const a=n.canvas;return a.style&&(e||!a.style.height&&!a.style.width)&&(a.style.height=`${n.height}px`,a.style.width=`${n.width}px`),n.currentDevicePixelRatio!==i||a.height!==s||a.width!==o?(n.currentDevicePixelRatio=i,a.height=s,a.width=o,n.ctx.setTransform(i,0,0,i,0,0),!0):!1}const or=(function(){let n=!1;try{const t={get passive(){return n=!0,!1}};Bn()&&(window.addEventListener("test",null,t),window.removeEventListener("test",null,t))}catch{}return n})();function ji(n,t){const e=Za(n,t),i=e&&e.match(/^(\d+)(\.\d+)?px$/);return i?+i[1]:void 0}function Yt(n,t,e,i){return{x:n.x+e*(t.x-n.x),y:n.y+e*(t.y-n.y)}}function ar(n,t,e,i){return{x:n.x+e*(t.x-n.x),y:i==="middle"?e<.5?n.y:t.y:i==="after"?e<1?n.y:t.y:e>0?t.y:n.y}}function rr(n,t,e,i){const s={x:n.cp2x,y:n.cp2y},o={x:t.cp1x,y:t.cp1y},a=Yt(n,s,e),l=Yt(s,o,e),c=Yt(o,t,e),d=Yt(a,l,e),h=Yt(l,c,e);return Yt(d,h,e)}const lr=function(n,t){return{x(e){return n+n+t-e},setWidth(e){t=e},textAlign(e){return e==="center"?e:e==="right"?"left":"right"},xPlus(e,i){return e-i},leftForLtr(e,i){return e-i}}},cr=function(){return{x(n){return n},setWidth(n){},textAlign(n){return n},xPlus(n,t){return n+t},leftForLtr(n,t){return n}}};function ee(n,t,e){return n?lr(t,e):cr()}function qi(n,t){let e,i;(t==="ltr"||t==="rtl")&&(e=n.canvas.style,i=[e.getPropertyValue("direction"),e.getPropertyPriority("direction")],e.setProperty("direction",t,"important"),n.prevTextDirection=i)}function Yi(n,t){t!==void 0&&(delete n.prevTextDirection,n.canvas.style.setProperty("direction",t[0],t[1]))}function Ui(n){return n==="angle"?{between:fe,compare:da,normalize:xt}:{between:Vt,compare:(t,e)=>t-e,normalize:t=>t}}function Xi({start:n,end:t,count:e,loop:i,style:s}){return{start:n%e,end:t%e,loop:i&&(t-n+1)%e===0,style:s}}function dr(n,t,e){const{property:i,start:s,end:o}=e,{between:a,normalize:l}=Ui(i),c=t.length;let{start:d,end:h,loop:u}=n,f,p;if(u){for(d+=c,h+=c,f=0,p=c;f<p&&a(l(t[d%c][i]),s,o);++f)d--,h--;d%=c,h%=c}return h<d&&(h+=c),{start:d,end:h,loop:u,style:n.style}}function hr(n,t,e){if(!e)return[n];const{property:i,start:s,end:o}=e,a=t.length,{compare:l,between:c,normalize:d}=Ui(i),{start:h,end:u,loop:f,style:p}=dr(n,t,e),g=[];let b=!1,m=null,_,y,k;const x=()=>c(s,k,_)&&l(s,k)!==0,S=()=>l(o,_)===0||c(o,k,_),N=()=>b||x(),V=()=>!b||S();for(let L=h,C=h;L<=u;++L)y=t[L%a],!y.skip&&(_=d(y[i]),_!==k&&(b=c(_,s,o),m===null&&N()&&(m=l(_,s)===0?L:C),m!==null&&V()&&(g.push(Xi({start:m,end:L,loop:f,count:a,style:p})),m=null),C=L,k=_));return m!==null&&g.push(Xi({start:m,end:u,loop:f,count:a,style:p})),g}function ur(n,t){const e=[],i=n.segments;for(let s=0;s<i.length;s++){const o=hr(i[s],n.points,t);o.length&&e.push(...o)}return e}function fr(n,t,e,i){let s=0,o=t-1;if(e&&!i)for(;s<t&&!n[s].skip;)s++;for(;s<t&&n[s].skip;)s++;for(s%=t,e&&(o+=s);o>s&&n[o%t].skip;)o--;return o%=t,{start:s,end:o}}function pr(n,t,e,i){const s=n.length,o=[];let a=t,l=n[t],c;for(c=t+1;c<=e;++c){const d=n[c%s];d.skip||d.stop?l.skip||(i=!1,o.push({start:t%s,end:(c-1)%s,loop:i}),t=a=d.stop?c:null):(a=c,l.skip&&(t=c)),l=d}return a!==null&&o.push({start:t%s,end:a%s,loop:i}),o}function mr(n,t){const e=n.points,i=n.options.spanGaps,s=e.length;if(!s)return[];const o=!!n._loop,{start:a,end:l}=fr(e,s,o,i);if(i===!0)return Ki(n,[{start:a,end:l,loop:o}],e,t);const c=l<a?l+s:l,d=!!n._fullLoop&&a===0&&l===s-1;return Ki(n,pr(e,a,c,d),e,t)}function Ki(n,t,e,i){return!i||!i.setContext||!e?t:gr(n,t,e,i)}function gr(n,t,e,i){const s=n._chart.getContext(),o=Gi(n.options),{_datasetIndex:a,options:{spanGaps:l}}=n,c=e.length,d=[];let h=o,u=t[0].start,f=u;function p(g,b,m,_){const y=l?-1:1;if(g!==b){for(g+=c;e[g%c].skip;)g-=y;for(;e[b%c].skip;)b+=y;g%c!==b%c&&(d.push({start:g%c,end:b%c,loop:m,style:_}),h=_,u=b%c)}}for(const g of t){u=l?u:g.start;let b=e[u%c],m;for(f=u+1;f<=g.end;f++){const _=e[f%c];m=Gi(i.setContext(Ht(s,{type:"segment",p0:b,p1:_,p0DataIndex:(f-1)%c,p1DataIndex:f%c,datasetIndex:a}))),br(m,h)&&p(u,f-1,g.loop,h),b=_,h=m}u<f-1&&p(u,f-1,g.loop,h)}return d}function Gi(n){return{backgroundColor:n.backgroundColor,borderCapStyle:n.borderCapStyle,borderDash:n.borderDash,borderDashOffset:n.borderDashOffset,borderJoinStyle:n.borderJoinStyle,borderWidth:n.borderWidth,borderColor:n.borderColor}}function br(n,t){if(!t)return!1;const e=[],i=function(s,o){return gn(o)?(e.includes(o)||e.push(o),e.indexOf(o)):o};return JSON.stringify(n,i)!==JSON.stringify(t,i)}function Fe(n,t,e){return n.options.clip?n[e]:t[e]}function yr(n,t){const{xScale:e,yScale:i}=n;return e&&i?{left:Fe(e,t,"left"),right:Fe(e,t,"right"),top:Fe(i,t,"top"),bottom:Fe(i,t,"bottom")}:t}function _r(n,t){const e=t._clip;if(e.disabled)return!1;const i=yr(t,n.chartArea);return{left:e.left===!1?0:i.left-(e.left===!0?0:e.left),right:e.right===!1?n.width:i.right+(e.right===!0?0:e.right),top:e.top===!1?0:i.top-(e.top===!0?0:e.top),bottom:e.bottom===!1?n.height:i.bottom+(e.bottom===!0?0:e.bottom)}}/*!
|
|
12
|
+
* Chart.js v4.5.0
|
|
13
|
+
* https://www.chartjs.org
|
|
14
|
+
* (c) 2025 Chart.js Contributors
|
|
15
|
+
* Released under the MIT License
|
|
16
|
+
*/class kr{constructor(){this._request=null,this._charts=new Map,this._running=!1,this._lastDate=void 0}_notify(t,e,i,s){const o=e.listeners[s],a=e.duration;o.forEach(l=>l({chart:t,initial:e.initial,numSteps:a,currentStep:Math.min(i-e.start,a)}))}_refresh(){this._request||(this._running=!0,this._request=Si.call(window,()=>{this._update(),this._request=null,this._running&&this._refresh()}))}_update(t=Date.now()){let e=0;this._charts.forEach((i,s)=>{if(!i.running||!i.items.length)return;const o=i.items;let a=o.length-1,l=!1,c;for(;a>=0;--a)c=o[a],c._active?(c._total>i.duration&&(i.duration=c._total),c.tick(t),l=!0):(o[a]=o[o.length-1],o.pop());l&&(s.draw(),this._notify(s,i,t,"progress")),o.length||(i.running=!1,this._notify(s,i,t,"complete"),i.initial=!1),e+=o.length}),this._lastDate=t,e===0&&(this._running=!1)}_getAnims(t){const e=this._charts;let i=e.get(t);return i||(i={running:!1,initial:!0,items:[],listeners:{complete:[],progress:[]}},e.set(t,i)),i}listen(t,e,i){this._getAnims(t).listeners[e].push(i)}add(t,e){!e||!e.length||this._getAnims(t).items.push(...e)}has(t){return this._getAnims(t).items.length>0}start(t){const e=this._charts.get(t);e&&(e.running=!0,e.start=Date.now(),e.duration=e.items.reduce((i,s)=>Math.max(i,s._duration),0),this._refresh())}running(t){if(!this._running)return!1;const e=this._charts.get(t);return!(!e||!e.running||!e.items.length)}stop(t){const e=this._charts.get(t);if(!e||!e.items.length)return;const i=e.items;let s=i.length-1;for(;s>=0;--s)i[s].cancel();e.items=[],this._notify(t,e,Date.now(),"complete")}remove(t){return this._charts.delete(t)}}var Dt=new kr;const Qi="transparent",xr={boolean(n,t,e){return e>.5?t:n},color(n,t,e){const i=Di(n||Qi),s=i.valid&&Di(t||Qi);return s&&s.valid?s.mix(i,e).hexString():t},number(n,t,e){return n+(t-n)*e}};class wr{constructor(t,e,i,s){const o=e[i];s=Ve([t.to,s,o,t.from]);const a=Ve([t.from,o,s]);this._active=!0,this._fn=t.fn||xr[t.type||typeof a],this._easing=pe[t.easing]||pe.linear,this._start=Math.floor(Date.now()+(t.delay||0)),this._duration=this._total=Math.floor(t.duration),this._loop=!!t.loop,this._target=e,this._prop=i,this._from=a,this._to=s,this._promises=void 0}active(){return this._active}update(t,e,i){if(this._active){this._notify(!1);const s=this._target[this._prop],o=i-this._start,a=this._duration-o;this._start=i,this._duration=Math.floor(Math.max(a,t.duration)),this._total+=o,this._loop=!!t.loop,this._to=Ve([t.to,e,s,t.from]),this._from=Ve([t.from,s,e])}}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(t){const e=t-this._start,i=this._duration,s=this._prop,o=this._from,a=this._loop,l=this._to;let c;if(this._active=o!==l&&(a||e<i),!this._active){this._target[s]=l,this._notify(!0);return}if(e<0){this._target[s]=o;return}c=e/i%2,c=a&&c>1?2-c:c,c=this._easing(Math.min(1,Math.max(0,c))),this._target[s]=this._fn(o,l,c)}wait(){const t=this._promises||(this._promises=[]);return new Promise((e,i)=>{t.push({res:e,rej:i})})}_notify(t){const e=t?"res":"rej",i=this._promises||[];for(let s=0;s<i.length;s++)i[s][e]()}}class Ji{constructor(t,e){this._chart=t,this._properties=new Map,this.configure(e)}configure(t){if(!Q(t))return;const e=Object.keys(rt.animation),i=this._properties;Object.getOwnPropertyNames(t).forEach(s=>{const o=t[s];if(!Q(o))return;const a={};for(const l of e)a[l]=o[l];(lt(o.properties)&&o.properties||[s]).forEach(l=>{(l===s||!i.has(l))&&i.set(l,a)})})}_animateOptions(t,e){const i=e.options,s=Cr(t,i);if(!s)return[];const o=this._createAnimations(s,i);return i.$shared&&Sr(t.options.$animations,i).then(()=>{t.options=i},()=>{}),o}_createAnimations(t,e){const i=this._properties,s=[],o=t.$animations||(t.$animations={}),a=Object.keys(e),l=Date.now();let c;for(c=a.length-1;c>=0;--c){const d=a[c];if(d.charAt(0)==="$")continue;if(d==="options"){s.push(...this._animateOptions(t,e));continue}const h=e[d];let u=o[d];const f=i.get(d);if(u)if(f&&u.active()){u.update(f,h,l);continue}else u.cancel();if(!f||!f.duration){t[d]=h;continue}o[d]=u=new wr(f,t,d,h),s.push(u)}return s}update(t,e){if(this._properties.size===0){Object.assign(t,e);return}const i=this._createAnimations(t,e);if(i.length)return Dt.add(this._chart,i),!0}}function Sr(n,t){const e=[],i=Object.keys(t);for(let s=0;s<i.length;s++){const o=n[i[s]];o&&o.active()&&e.push(o.wait())}return Promise.all(e)}function Cr(n,t){if(!t)return;let e=n.options;if(!e){n.options=t;return}return e.$shared&&(n.options=e=Object.assign({},e,{$shared:!1,$animations:{}})),e}function Zi(n,t){const e=n&&n.options||{},i=e.reverse,s=e.min===void 0?t:0,o=e.max===void 0?t:0;return{start:i?o:s,end:i?s:o}}function Er(n,t,e){if(e===!1)return!1;const i=Zi(n,e),s=Zi(t,e);return{top:s.end,right:i.end,bottom:s.start,left:i.start}}function Mr(n){let t,e,i,s;return Q(n)?(t=n.top,e=n.right,i=n.bottom,s=n.left):t=e=i=s=n,{top:t,right:e,bottom:i,left:s,disabled:n===!1}}function ts(n,t){const e=[],i=n._getSortedDatasetMetas(t);let s,o;for(s=0,o=i.length;s<o;++s)e.push(i[s].index);return e}function es(n,t,e,i={}){const s=n.keys,o=i.mode==="single";let a,l,c,d;if(t===null)return;let h=!1;for(a=0,l=s.length;a<l;++a){if(c=+s[a],c===e){if(h=!0,i.all)continue;break}d=n.values[c],yt(d)&&(o||t===0||St(t)===St(d))&&(t+=d)}return!h&&!i.all?0:t}function vr(n,t){const{iScale:e,vScale:i}=t,s=e.axis==="x"?"x":"y",o=i.axis==="x"?"x":"y",a=Object.keys(n),l=new Array(a.length);let c,d,h;for(c=0,d=a.length;c<d;++c)h=a[c],l[c]={[s]:h,[o]:n[h]};return l}function An(n,t){const e=n&&n.options.stacked;return e||e===void 0&&t.stack!==void 0}function Br(n,t,e){return`${n.id}.${t.id}.${e.stack||e.type}`}function Dr(n){const{min:t,max:e,minDefined:i,maxDefined:s}=n.getUserBounds();return{min:i?t:Number.NEGATIVE_INFINITY,max:s?e:Number.POSITIVE_INFINITY}}function Ar(n,t,e){const i=n[t]||(n[t]={});return i[e]||(i[e]={})}function ns(n,t,e,i){for(const s of t.getMatchingVisibleMetas(i).reverse()){const o=n[s.index];if(e&&o>0||!e&&o<0)return s.index}return null}function is(n,t){const{chart:e,_cachedMeta:i}=n,s=e._stacks||(e._stacks={}),{iScale:o,vScale:a,index:l}=i,c=o.axis,d=a.axis,h=Br(o,a,i),u=t.length;let f;for(let p=0;p<u;++p){const g=t[p],{[c]:b,[d]:m}=g,_=g._stacks||(g._stacks={});f=_[d]=Ar(s,h,b),f[l]=m,f._top=ns(f,a,!0,i.type),f._bottom=ns(f,a,!1,i.type);const y=f._visualValues||(f._visualValues={});y[l]=m}}function Tn(n,t){const e=n.scales;return Object.keys(e).filter(i=>e[i].axis===t).shift()}function Tr(n,t){return Ht(n,{active:!1,dataset:void 0,datasetIndex:t,index:t,mode:"default",type:"dataset"})}function Pr(n,t,e){return Ht(n,{active:!1,dataIndex:t,parsed:void 0,raw:void 0,element:e,index:t,mode:"default",type:"data"})}function ye(n,t){const e=n.controller.index,i=n.vScale&&n.vScale.axis;if(i){t=t||n._parsed;for(const s of t){const o=s._stacks;if(!o||o[i]===void 0||o[i][e]===void 0)return;delete o[i][e],o[i]._visualValues!==void 0&&o[i]._visualValues[e]!==void 0&&delete o[i]._visualValues[e]}}}const Pn=n=>n==="reset"||n==="none",ss=(n,t)=>t?n:Object.assign({},n),Nr=(n,t,e)=>n&&!t.hidden&&t._stacked&&{keys:ts(e,!0),values:null};class _e{static defaults={};static datasetElementType=null;static dataElementType=null;constructor(t,e){this.chart=t,this._ctx=t.ctx,this.index=e,this._cachedDataOpts={},this._cachedMeta=this.getMeta(),this._type=this._cachedMeta.type,this.options=void 0,this._parsing=!1,this._data=void 0,this._objectData=void 0,this._sharedOptions=void 0,this._drawStart=void 0,this._drawCount=void 0,this.enableOptionSharing=!1,this.supportsDecimation=!1,this.$context=void 0,this._syncList=[],this.datasetElementType=new.target.datasetElementType,this.dataElementType=new.target.dataElementType,this.initialize()}initialize(){const t=this._cachedMeta;this.configure(),this.linkScales(),t._stacked=An(t.vScale,t),this.addElements(),this.options.fill&&!this.chart.isPluginEnabled("filler")&&console.warn("Tried to use the 'fill' option without the 'Filler' plugin enabled. Please import and register the 'Filler' plugin and make sure it is not disabled in the options")}updateIndex(t){this.index!==t&&ye(this._cachedMeta),this.index=t}linkScales(){const t=this.chart,e=this._cachedMeta,i=this.getDataset(),s=(u,f,p,g)=>u==="x"?f:u==="r"?g:p,o=e.xAxisID=U(i.xAxisID,Tn(t,"x")),a=e.yAxisID=U(i.yAxisID,Tn(t,"y")),l=e.rAxisID=U(i.rAxisID,Tn(t,"r")),c=e.indexAxis,d=e.iAxisID=s(c,o,a,l),h=e.vAxisID=s(c,a,o,l);e.xScale=this.getScaleForId(o),e.yScale=this.getScaleForId(a),e.rScale=this.getScaleForId(l),e.iScale=this.getScaleForId(d),e.vScale=this.getScaleForId(h)}getDataset(){return this.chart.data.datasets[this.index]}getMeta(){return this.chart.getDatasetMeta(this.index)}getScaleForId(t){return this.chart.scales[t]}_getOtherScale(t){const e=this._cachedMeta;return t===e.iScale?e.vScale:e.iScale}reset(){this._update("reset")}_destroy(){const t=this._cachedMeta;this._data&&xi(this._data,this),t._stacked&&ye(t)}_dataCheck(){const t=this.getDataset(),e=t.data||(t.data=[]),i=this._data;if(Q(e)){const s=this._cachedMeta;this._data=vr(e,s)}else if(i!==e){if(i){xi(i,this);const s=this._cachedMeta;ye(s),s._parsed=[]}e&&Object.isExtensible(e)&&pa(e,this),this._syncList=[],this._data=e}}addElements(){const t=this._cachedMeta;this._dataCheck(),this.datasetElementType&&(t.dataset=new this.datasetElementType)}buildOrUpdateElements(t){const e=this._cachedMeta,i=this.getDataset();let s=!1;this._dataCheck();const o=e._stacked;e._stacked=An(e.vScale,e),e.stack!==i.stack&&(s=!0,ye(e),e.stack=i.stack),this._resyncElements(t),(s||o!==e._stacked)&&(is(this,e._parsed),e._stacked=An(e.vScale,e))}configure(){const t=this.chart.config,e=t.datasetScopeKeys(this._type),i=t.getOptionScopes(this.getDataset(),e,!0);this.options=t.createResolver(i,this.getContext()),this._parsing=this.options.parsing,this._cachedDataOpts={}}parse(t,e){const{_cachedMeta:i,_data:s}=this,{iScale:o,_stacked:a}=i,l=o.axis;let c=t===0&&e===s.length?!0:i._sorted,d=t>0&&i._parsed[t-1],h,u,f;if(this._parsing===!1)i._parsed=s,i._sorted=!0,f=s;else{lt(s[t])?f=this.parseArrayData(i,s,t,e):Q(s[t])?f=this.parseObjectData(i,s,t,e):f=this.parsePrimitiveData(i,s,t,e);const p=()=>u[l]===null||d&&u[l]<d[l];for(h=0;h<e;++h)i._parsed[h+t]=u=f[h],c&&(p()&&(c=!1),d=u);i._sorted=c}a&&is(this,f)}parsePrimitiveData(t,e,i,s){const{iScale:o,vScale:a}=t,l=o.axis,c=a.axis,d=o.getLabels(),h=o===a,u=new Array(s);let f,p,g;for(f=0,p=s;f<p;++f)g=f+i,u[f]={[l]:h||o.parse(d[g],g),[c]:a.parse(e[g],g)};return u}parseArrayData(t,e,i,s){const{xScale:o,yScale:a}=t,l=new Array(s);let c,d,h,u;for(c=0,d=s;c<d;++c)h=c+i,u=e[h],l[c]={x:o.parse(u[0],h),y:a.parse(u[1],h)};return l}parseObjectData(t,e,i,s){const{xScale:o,yScale:a}=t,{xAxisKey:l="x",yAxisKey:c="y"}=this._parsing,d=new Array(s);let h,u,f,p;for(h=0,u=s;h<u;++h)f=h+i,p=e[f],d[h]={x:o.parse(Rt(p,l),f),y:a.parse(Rt(p,c),f)};return d}getParsed(t){return this._cachedMeta._parsed[t]}getDataElement(t){return this._cachedMeta.data[t]}applyStack(t,e,i){const s=this.chart,o=this._cachedMeta,a=e[t.axis],l={keys:ts(s,!0),values:e._stacks[t.axis]._visualValues};return es(l,a,o.index,{mode:i})}updateRangeFromParsed(t,e,i,s){const o=i[e.axis];let a=o===null?NaN:o;const l=s&&i._stacks[e.axis];s&&l&&(s.values=l,a=es(s,o,this._cachedMeta.index)),t.min=Math.min(t.min,a),t.max=Math.max(t.max,a)}getMinMax(t,e){const i=this._cachedMeta,s=i._parsed,o=i._sorted&&t===i.iScale,a=s.length,l=this._getOtherScale(t),c=Nr(e,i,this.chart),d={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY},{min:h,max:u}=Dr(l);let f,p;function g(){p=s[f];const b=p[l.axis];return!yt(p[t.axis])||h>b||u<b}for(f=0;f<a&&!(!g()&&(this.updateRangeFromParsed(d,t,p,c),o));++f);if(o){for(f=a-1;f>=0;--f)if(!g()){this.updateRangeFromParsed(d,t,p,c);break}}return d}getAllParsedValues(t){const e=this._cachedMeta._parsed,i=[];let s,o,a;for(s=0,o=e.length;s<o;++s)a=e[s][t.axis],yt(a)&&i.push(a);return i}getMaxOverflow(){return!1}getLabelAndValue(t){const e=this._cachedMeta,i=e.iScale,s=e.vScale,o=this.getParsed(t);return{label:i?""+i.getLabelForValue(o[i.axis]):"",value:s?""+s.getLabelForValue(o[s.axis]):""}}_update(t){const e=this._cachedMeta;this.update(t||"default"),e._clip=Mr(U(this.options.clip,Er(e.xScale,e.yScale,this.getMaxOverflow())))}update(t){}draw(){const t=this._ctx,e=this.chart,i=this._cachedMeta,s=i.data||[],o=e.chartArea,a=[],l=this._drawStart||0,c=this._drawCount||s.length-l,d=this.options.drawActiveElementsOnTop;let h;for(i.dataset&&i.dataset.draw(t,o,l,c),h=l;h<l+c;++h){const u=s[h];u.hidden||(u.active&&d?a.push(u):u.draw(t,o))}for(h=0;h<a.length;++h)a[h].draw(t,o)}getStyle(t,e){const i=e?"active":"default";return t===void 0&&this._cachedMeta.dataset?this.resolveDatasetElementOptions(i):this.resolveDataElementOptions(t||0,i)}getContext(t,e,i){const s=this.getDataset();let o;if(t>=0&&t<this._cachedMeta.data.length){const a=this._cachedMeta.data[t];o=a.$context||(a.$context=Pr(this.getContext(),t,a)),o.parsed=this.getParsed(t),o.raw=s.data[t],o.index=o.dataIndex=t}else o=this.$context||(this.$context=Tr(this.chart.getContext(),this.index)),o.dataset=s,o.index=o.datasetIndex=this.index;return o.active=!!e,o.mode=i,o}resolveDatasetElementOptions(t){return this._resolveElementOptions(this.datasetElementType.id,t)}resolveDataElementOptions(t,e){return this._resolveElementOptions(this.dataElementType.id,e,t)}_resolveElementOptions(t,e="default",i){const s=e==="active",o=this._cachedDataOpts,a=t+"-"+e,l=o[a],c=this.enableOptionSharing&&he(i);if(l)return ss(l,c);const d=this.chart.config,h=d.datasetElementScopeKeys(this._type,t),u=s?[`${t}Hover`,"hover",t,""]:[t,""],f=d.getOptionScopes(this.getDataset(),h),p=Object.keys(rt.elements[t]),g=()=>this.getContext(i,s,e),b=d.resolveNamedOptions(f,p,g,u);return b.$shared&&(b.$shared=c,o[a]=Object.freeze(ss(b,c))),b}_resolveAnimations(t,e,i){const s=this.chart,o=this._cachedDataOpts,a=`animation-${e}`,l=o[a];if(l)return l;let c;if(s.options.animation!==!1){const h=this.chart.config,u=h.datasetAnimationScopeKeys(this._type,e),f=h.getOptionScopes(this.getDataset(),u);c=h.createResolver(f,this.getContext(t,i,e))}const d=new Ji(s,c&&c.animations);return c&&c._cacheable&&(o[a]=Object.freeze(d)),d}getSharedOptions(t){if(t.$shared)return this._sharedOptions||(this._sharedOptions=Object.assign({},t))}includeOptions(t,e){return!e||Pn(t)||this.chart._animationsDisabled}_getSharedOptions(t,e){const i=this.resolveDataElementOptions(t,e),s=this._sharedOptions,o=this.getSharedOptions(i),a=this.includeOptions(e,o)||o!==s;return this.updateSharedOptions(o,e,i),{sharedOptions:o,includeOptions:a}}updateElement(t,e,i,s){Pn(s)?Object.assign(t,i):this._resolveAnimations(e,s).update(t,i)}updateSharedOptions(t,e,i){t&&!Pn(e)&&this._resolveAnimations(void 0,e).update(t,i)}_setStyle(t,e,i,s){t.active=s;const o=this.getStyle(e,s);this._resolveAnimations(e,i,s).update(t,{options:!s&&this.getSharedOptions(o)||o})}removeHoverStyle(t,e,i){this._setStyle(t,i,"active",!1)}setHoverStyle(t,e,i){this._setStyle(t,i,"active",!0)}_removeDatasetHoverStyle(){const t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!1)}_setDatasetHoverStyle(){const t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!0)}_resyncElements(t){const e=this._data,i=this._cachedMeta.data;for(const[l,c,d]of this._syncList)this[l](c,d);this._syncList=[];const s=i.length,o=e.length,a=Math.min(o,s);a&&this.parse(0,a),o>s?this._insertElements(s,o-s,t):o<s&&this._removeElements(o,s-o)}_insertElements(t,e,i=!0){const s=this._cachedMeta,o=s.data,a=t+e;let l;const c=d=>{for(d.length+=e,l=d.length-1;l>=a;l--)d[l]=d[l-e]};for(c(o),l=t;l<a;++l)o[l]=new this.dataElementType;this._parsing&&c(s._parsed),this.parse(t,e),i&&this.updateElements(o,t,e,"reset")}updateElements(t,e,i,s){}_removeElements(t,e){const i=this._cachedMeta;if(this._parsing){const s=i._parsed.splice(t,e);i._stacked&&ye(i,s)}i.data.splice(t,e)}_sync(t){if(this._parsing)this._syncList.push(t);else{const[e,i,s]=t;this[e](i,s)}this.chart._dataChanges.push([this.index,...t])}_onDataPush(){const t=arguments.length;this._sync(["_insertElements",this.getDataset().data.length-t,t])}_onDataPop(){this._sync(["_removeElements",this._cachedMeta.data.length-1,1])}_onDataShift(){this._sync(["_removeElements",0,1])}_onDataSplice(t,e){e&&this._sync(["_removeElements",t,e]);const i=arguments.length-2;i&&this._sync(["_insertElements",t,i])}_onDataUnshift(){this._sync(["_insertElements",0,arguments.length])}}function Or(n,t){if(!n._cache.$bar){const e=n.getMatchingVisibleMetas(t);let i=[];for(let s=0,o=e.length;s<o;s++)i=i.concat(e[s].controller.getAllParsedValues(n));n._cache.$bar=wi(i.sort((s,o)=>s-o))}return n._cache.$bar}function Vr(n){const t=n.iScale,e=Or(t,n.type);let i=t._length,s,o,a,l;const c=()=>{a===32767||a===-32768||(he(l)&&(i=Math.min(i,Math.abs(a-l)||i)),l=a)};for(s=0,o=e.length;s<o;++s)a=t.getPixelForValue(e[s]),c();for(l=void 0,s=0,o=t.ticks.length;s<o;++s)a=t.getPixelForTick(s),c();return i}function Lr(n,t,e,i){const s=e.barThickness;let o,a;return tt(s)?(o=t.min*e.categoryPercentage,a=e.barPercentage):(o=s*i,a=1),{chunk:o/i,ratio:a,start:t.pixels[n]-o/2}}function zr(n,t,e,i){const s=t.pixels,o=s[n];let a=n>0?s[n-1]:null,l=n<s.length-1?s[n+1]:null;const c=e.categoryPercentage;a===null&&(a=o-(l===null?t.end-t.start:l-o)),l===null&&(l=o+o-a);const d=o-(o-Math.min(a,l))/2*c;return{chunk:Math.abs(l-a)/2*c/i,ratio:e.barPercentage,start:d}}function Rr(n,t,e,i){const s=e.parse(n[0],i),o=e.parse(n[1],i),a=Math.min(s,o),l=Math.max(s,o);let c=a,d=l;Math.abs(a)>Math.abs(l)&&(c=l,d=a),t[e.axis]=d,t._custom={barStart:c,barEnd:d,start:s,end:o,min:a,max:l}}function os(n,t,e,i){return lt(n)?Rr(n,t,e,i):t[e.axis]=e.parse(n,i),t}function as(n,t,e,i){const s=n.iScale,o=n.vScale,a=s.getLabels(),l=s===o,c=[];let d,h,u,f;for(d=e,h=e+i;d<h;++d)f=t[d],u={},u[s.axis]=l||s.parse(a[d],d),c.push(os(f,u,o,d));return c}function Nn(n){return n&&n.barStart!==void 0&&n.barEnd!==void 0}function Ir(n,t,e){return n!==0?St(n):(t.isHorizontal()?1:-1)*(t.min>=e?1:-1)}function Fr(n){let t,e,i,s,o;return n.horizontal?(t=n.base>n.x,e="left",i="right"):(t=n.base<n.y,e="bottom",i="top"),t?(s="end",o="start"):(s="start",o="end"),{start:e,end:i,reverse:t,top:s,bottom:o}}function $r(n,t,e,i){let s=t.borderSkipped;const o={};if(!s){n.borderSkipped=o;return}if(s===!0){n.borderSkipped={top:!0,right:!0,bottom:!0,left:!0};return}const{start:a,end:l,reverse:c,top:d,bottom:h}=Fr(n);s==="middle"&&e&&(n.enableBorderRadius=!0,(e._top||0)===i?s=d:(e._bottom||0)===i?s=h:(o[rs(h,a,l,c)]=!0,s=d)),o[rs(s,a,l,c)]=!0,n.borderSkipped=o}function rs(n,t,e,i){return i?(n=Wr(n,t,e),n=ls(n,e,t)):n=ls(n,t,e),n}function Wr(n,t,e){return n===t?e:n===e?t:n}function ls(n,t,e){return n==="start"?t:n==="end"?e:n}function Hr(n,{inflateAmount:t},e){n.inflateAmount=t==="auto"?e===1?.33:0:t}class jr extends _e{static id="bar";static defaults={datasetElementType:!1,dataElementType:"bar",categoryPercentage:.8,barPercentage:.9,grouped:!0,animations:{numbers:{type:"number",properties:["x","y","base","width","height"]}}};static overrides={scales:{_index_:{type:"category",offset:!0,grid:{offset:!0}},_value_:{type:"linear",beginAtZero:!0}}};parsePrimitiveData(t,e,i,s){return as(t,e,i,s)}parseArrayData(t,e,i,s){return as(t,e,i,s)}parseObjectData(t,e,i,s){const{iScale:o,vScale:a}=t,{xAxisKey:l="x",yAxisKey:c="y"}=this._parsing,d=o.axis==="x"?l:c,h=a.axis==="x"?l:c,u=[];let f,p,g,b;for(f=i,p=i+s;f<p;++f)b=e[f],g={},g[o.axis]=o.parse(Rt(b,d),f),u.push(os(Rt(b,h),g,a,f));return u}updateRangeFromParsed(t,e,i,s){super.updateRangeFromParsed(t,e,i,s);const o=i._custom;o&&e===this._cachedMeta.vScale&&(t.min=Math.min(t.min,o.min),t.max=Math.max(t.max,o.max))}getMaxOverflow(){return 0}getLabelAndValue(t){const e=this._cachedMeta,{iScale:i,vScale:s}=e,o=this.getParsed(t),a=o._custom,l=Nn(a)?"["+a.start+", "+a.end+"]":""+s.getLabelForValue(o[s.axis]);return{label:""+i.getLabelForValue(o[i.axis]),value:l}}initialize(){this.enableOptionSharing=!0,super.initialize();const t=this._cachedMeta;t.stack=this.getDataset().stack}update(t){const e=this._cachedMeta;this.updateElements(e.data,0,e.data.length,t)}updateElements(t,e,i,s){const o=s==="reset",{index:a,_cachedMeta:{vScale:l}}=this,c=l.getBasePixel(),d=l.isHorizontal(),h=this._getRuler(),{sharedOptions:u,includeOptions:f}=this._getSharedOptions(e,s);for(let p=e;p<e+i;p++){const g=this.getParsed(p),b=o||tt(g[l.axis])?{base:c,head:c}:this._calculateBarValuePixels(p),m=this._calculateBarIndexPixels(p,h),_=(g._stacks||{})[l.axis],y={horizontal:d,base:b.base,enableBorderRadius:!_||Nn(g._custom)||a===_._top||a===_._bottom,x:d?b.head:m.center,y:d?m.center:b.head,height:d?m.size:Math.abs(b.size),width:d?Math.abs(b.size):m.size};f&&(y.options=u||this.resolveDataElementOptions(p,t[p].active?"active":s));const k=y.options||t[p].options;$r(y,k,_,a),Hr(y,k,h.ratio),this.updateElement(t[p],p,y,s)}}_getStacks(t,e){const{iScale:i}=this._cachedMeta,s=i.getMatchingVisibleMetas(this._type).filter(h=>h.controller.options.grouped),o=i.options.stacked,a=[],l=this._cachedMeta.controller.getParsed(e),c=l&&l[i.axis],d=h=>{const u=h._parsed.find(p=>p[i.axis]===c),f=u&&u[h.vScale.axis];if(tt(f)||isNaN(f))return!0};for(const h of s)if(!(e!==void 0&&d(h))&&((o===!1||a.indexOf(h.stack)===-1||o===void 0&&h.stack===void 0)&&a.push(h.stack),h.index===t))break;return a.length||a.push(void 0),a}_getStackCount(t){return this._getStacks(void 0,t).length}_getAxisCount(){return this._getAxis().length}getFirstScaleIdForIndexAxis(){const t=this.chart.scales,e=this.chart.options.indexAxis;return Object.keys(t).filter(i=>t[i].axis===e).shift()}_getAxis(){const t={},e=this.getFirstScaleIdForIndexAxis();for(const i of this.chart.data.datasets)t[U(this.chart.options.indexAxis==="x"?i.xAxisID:i.yAxisID,e)]=!0;return Object.keys(t)}_getStackIndex(t,e,i){const s=this._getStacks(t,i),o=e!==void 0?s.indexOf(e):-1;return o===-1?s.length-1:o}_getRuler(){const t=this.options,e=this._cachedMeta,i=e.iScale,s=[];let o,a;for(o=0,a=e.data.length;o<a;++o)s.push(i.getPixelForValue(this.getParsed(o)[i.axis],o));const l=t.barThickness;return{min:l||Vr(e),pixels:s,start:i._startPixel,end:i._endPixel,stackCount:this._getStackCount(),scale:i,grouped:t.grouped,ratio:l?1:t.categoryPercentage*t.barPercentage}}_calculateBarValuePixels(t){const{_cachedMeta:{vScale:e,_stacked:i,index:s},options:{base:o,minBarLength:a}}=this,l=o||0,c=this.getParsed(t),d=c._custom,h=Nn(d);let u=c[e.axis],f=0,p=i?this.applyStack(e,c,i):u,g,b;p!==u&&(f=p-u,p=u),h&&(u=d.barStart,p=d.barEnd-d.barStart,u!==0&&St(u)!==St(d.barEnd)&&(f=0),f+=u);const m=!tt(o)&&!h?o:f;let _=e.getPixelForValue(m);if(this.chart.getDataVisibility(t)?g=e.getPixelForValue(f+p):g=_,b=g-_,Math.abs(b)<a){b=Ir(b,e,l)*a,u===l&&(_-=b/2);const y=e.getPixelForDecimal(0),k=e.getPixelForDecimal(1),x=Math.min(y,k),S=Math.max(y,k);_=Math.max(Math.min(_,S),x),g=_+b,i&&!h&&(c._stacks[e.axis]._visualValues[s]=e.getValueForPixel(g)-e.getValueForPixel(_))}if(_===e.getPixelForValue(l)){const y=St(b)*e.getLineWidthForValue(l)/2;_+=y,b-=y}return{size:b,base:_,head:g,center:g+b/2}}_calculateBarIndexPixels(t,e){const i=e.scale,s=this.options,o=s.skipNull,a=U(s.maxBarThickness,1/0);let l,c;const d=this._getAxisCount();if(e.grouped){const h=o?this._getStackCount(t):e.stackCount,u=s.barThickness==="flex"?zr(t,e,s,h*d):Lr(t,e,s,h*d),f=this.chart.options.indexAxis==="x"?this.getDataset().xAxisID:this.getDataset().yAxisID,p=this._getAxis().indexOf(U(f,this.getFirstScaleIdForIndexAxis())),g=this._getStackIndex(this.index,this._cachedMeta.stack,o?t:void 0)+p;l=u.start+u.chunk*g+u.chunk/2,c=Math.min(a,u.chunk*u.ratio)}else l=i.getPixelForValue(this.getParsed(t)[i.axis],t),c=Math.min(a,e.min*e.ratio);return{base:l-c/2,head:l+c/2,center:l,size:c}}draw(){const t=this._cachedMeta,e=t.vScale,i=t.data,s=i.length;let o=0;for(;o<s;++o)this.getParsed(o)[e.axis]!==null&&!i[o].hidden&&i[o].draw(this._ctx)}}function qr(n,t,e){let i=1,s=1,o=0,a=0;if(t<at){const l=n,c=l+t,d=Math.cos(l),h=Math.sin(l),u=Math.cos(c),f=Math.sin(c),p=(k,x,S)=>fe(k,l,c,!0)?1:Math.max(x,x*e,S,S*e),g=(k,x,S)=>fe(k,l,c,!0)?-1:Math.min(x,x*e,S,S*e),b=p(0,d,u),m=p(ct,h,f),_=g(nt,d,u),y=g(nt+ct,h,f);i=(b-_)/2,s=(m-y)/2,o=-(b+_)/2,a=-(m+y)/2}return{ratioX:i,ratioY:s,offsetX:o,offsetY:a}}class Yr extends _e{static id="doughnut";static defaults={datasetElementType:!1,dataElementType:"arc",animation:{animateRotate:!0,animateScale:!1},animations:{numbers:{type:"number",properties:["circumference","endAngle","innerRadius","outerRadius","startAngle","x","y","offset","borderWidth","spacing"]}},cutout:"50%",rotation:0,circumference:360,radius:"100%",spacing:0,indexAxis:"r"};static descriptors={_scriptable:t=>t!=="spacing",_indexable:t=>t!=="spacing"&&!t.startsWith("borderDash")&&!t.startsWith("hoverBorderDash")};static overrides={aspectRatio:1,plugins:{legend:{labels:{generateLabels(t){const e=t.data;if(e.labels.length&&e.datasets.length){const{labels:{pointStyle:i,color:s}}=t.legend.options;return e.labels.map((o,a)=>{const c=t.getDatasetMeta(0).controller.getStyle(a);return{text:o,fillStyle:c.backgroundColor,strokeStyle:c.borderColor,fontColor:s,lineWidth:c.borderWidth,pointStyle:i,hidden:!t.getDataVisibility(a),index:a}})}return[]}},onClick(t,e,i){i.chart.toggleDataVisibility(e.index),i.chart.update()}}}};constructor(t,e){super(t,e),this.enableOptionSharing=!0,this.innerRadius=void 0,this.outerRadius=void 0,this.offsetX=void 0,this.offsetY=void 0}linkScales(){}parse(t,e){const i=this.getDataset().data,s=this._cachedMeta;if(this._parsing===!1)s._parsed=i;else{let o=c=>+i[c];if(Q(i[t])){const{key:c="value"}=this._parsing;o=d=>+Rt(i[d],c)}let a,l;for(a=t,l=t+e;a<l;++a)s._parsed[a]=o(a)}}_getRotation(){return Bt(this.options.rotation-90)}_getCircumference(){return Bt(this.options.circumference)}_getRotationExtents(){let t=at,e=-at;for(let i=0;i<this.chart.data.datasets.length;++i)if(this.chart.isDatasetVisible(i)&&this.chart.getDatasetMeta(i).type===this._type){const s=this.chart.getDatasetMeta(i).controller,o=s._getRotation(),a=s._getCircumference();t=Math.min(t,o),e=Math.max(e,o+a)}return{rotation:t,circumference:e-t}}update(t){const e=this.chart,{chartArea:i}=e,s=this._cachedMeta,o=s.data,a=this.getMaxBorderWidth()+this.getMaxOffset(o)+this.options.spacing,l=Math.max((Math.min(i.width,i.height)-a)/2,0),c=Math.min(Qo(this.options.cutout,l),1),d=this._getRingWeight(this.index),{circumference:h,rotation:u}=this._getRotationExtents(),{ratioX:f,ratioY:p,offsetX:g,offsetY:b}=qr(u,h,c),m=(i.width-a)/f,_=(i.height-a)/p,y=Math.max(Math.min(m,_)/2,0),k=hi(this.options.radius,y),x=Math.max(k*c,0),S=(k-x)/this._getVisibleDatasetWeightTotal();this.offsetX=g*k,this.offsetY=b*k,s.total=this.calculateTotal(),this.outerRadius=k-S*this._getRingWeightOffset(this.index),this.innerRadius=Math.max(this.outerRadius-S*d,0),this.updateElements(o,0,o.length,t)}_circumference(t,e){const i=this.options,s=this._cachedMeta,o=this._getCircumference();return e&&i.animation.animateRotate||!this.chart.getDataVisibility(t)||s._parsed[t]===null||s.data[t].hidden?0:this.calculateCircumference(s._parsed[t]*o/at)}updateElements(t,e,i,s){const o=s==="reset",a=this.chart,l=a.chartArea,d=a.options.animation,h=(l.left+l.right)/2,u=(l.top+l.bottom)/2,f=o&&d.animateScale,p=f?0:this.innerRadius,g=f?0:this.outerRadius,{sharedOptions:b,includeOptions:m}=this._getSharedOptions(e,s);let _=this._getRotation(),y;for(y=0;y<e;++y)_+=this._circumference(y,o);for(y=e;y<e+i;++y){const k=this._circumference(y,o),x=t[y],S={x:h+this.offsetX,y:u+this.offsetY,startAngle:_,endAngle:_+k,circumference:k,outerRadius:g,innerRadius:p};m&&(S.options=b||this.resolveDataElementOptions(y,x.active?"active":s)),_+=k,this.updateElement(x,y,S,s)}}calculateTotal(){const t=this._cachedMeta,e=t.data;let i=0,s;for(s=0;s<e.length;s++){const o=t._parsed[s];o!==null&&!isNaN(o)&&this.chart.getDataVisibility(s)&&!e[s].hidden&&(i+=Math.abs(o))}return i}calculateCircumference(t){const e=this._cachedMeta.total;return e>0&&!isNaN(t)?at*(Math.abs(t)/e):0}getLabelAndValue(t){const e=this._cachedMeta,i=this.chart,s=i.data.labels||[],o=yn(e._parsed[t],i.options.locale);return{label:s[t]||"",value:o}}getMaxBorderWidth(t){let e=0;const i=this.chart;let s,o,a,l,c;if(!t){for(s=0,o=i.data.datasets.length;s<o;++s)if(i.isDatasetVisible(s)){a=i.getDatasetMeta(s),t=a.data,l=a.controller;break}}if(!t)return 0;for(s=0,o=t.length;s<o;++s)c=l.resolveDataElementOptions(s),c.borderAlign!=="inner"&&(e=Math.max(e,c.borderWidth||0,c.hoverBorderWidth||0));return e}getMaxOffset(t){let e=0;for(let i=0,s=t.length;i<s;++i){const o=this.resolveDataElementOptions(i);e=Math.max(e,o.offset||0,o.hoverOffset||0)}return e}_getRingWeightOffset(t){let e=0;for(let i=0;i<t;++i)this.chart.isDatasetVisible(i)&&(e+=this._getRingWeight(i));return e}_getRingWeight(t){return Math.max(U(this.chart.data.datasets[t].weight,1),0)}_getVisibleDatasetWeightTotal(){return this._getRingWeightOffset(this.chart.data.datasets.length)||1}}class Ur extends _e{static id="line";static defaults={datasetElementType:"line",dataElementType:"point",showLine:!0,spanGaps:!1};static overrides={scales:{_index_:{type:"category"},_value_:{type:"linear"}}};initialize(){this.enableOptionSharing=!0,this.supportsDecimation=!0,super.initialize()}update(t){const e=this._cachedMeta,{dataset:i,data:s=[],_dataset:o}=e,a=this.chart._animationsDisabled;let{start:l,count:c}=Ei(e,s,a);this._drawStart=l,this._drawCount=c,Mi(e)&&(l=0,c=s.length),i._chart=this.chart,i._datasetIndex=this.index,i._decimated=!!o._decimated,i.points=s;const d=this.resolveDatasetElementOptions(t);this.options.showLine||(d.borderWidth=0),d.segment=this.options.segment,this.updateElement(i,void 0,{animated:!a,options:d},t),this.updateElements(s,l,c,t)}updateElements(t,e,i,s){const o=s==="reset",{iScale:a,vScale:l,_stacked:c,_dataset:d}=this._cachedMeta,{sharedOptions:h,includeOptions:u}=this._getSharedOptions(e,s),f=a.axis,p=l.axis,{spanGaps:g,segment:b}=this.options,m=Qt(g)?g:Number.POSITIVE_INFINITY,_=this.chart._animationsDisabled||o||s==="none",y=e+i,k=t.length;let x=e>0&&this.getParsed(e-1);for(let S=0;S<k;++S){const N=t[S],V=_?N:{};if(S<e||S>=y){V.skip=!0;continue}const L=this.getParsed(S),C=tt(L[p]),T=V[f]=a.getPixelForValue(L[f],S),P=V[p]=o||C?l.getBasePixel():l.getPixelForValue(c?this.applyStack(l,L,c):L[p],S);V.skip=isNaN(T)||isNaN(P)||C,V.stop=S>0&&Math.abs(L[f]-x[f])>m,b&&(V.parsed=L,V.raw=d.data[S]),u&&(V.options=h||this.resolveDataElementOptions(S,N.active?"active":s)),_||this.updateElement(N,S,V,s),x=L}}getMaxOverflow(){const t=this._cachedMeta,e=t.dataset,i=e.options&&e.options.borderWidth||0,s=t.data||[];if(!s.length)return i;const o=s[0].size(this.resolveDataElementOptions(0)),a=s[s.length-1].size(this.resolveDataElementOptions(s.length-1));return Math.max(i,o,a)/2}draw(){const t=this._cachedMeta;t.dataset.updateControlPoints(this.chart.chartArea,t.iScale.axis),super.draw()}}class Xr extends Yr{static id="pie";static defaults={cutout:0,rotation:0,circumference:360,radius:"100%"}}class Kr extends _e{static id="scatter";static defaults={datasetElementType:!1,dataElementType:"point",showLine:!1,fill:!1};static overrides={interaction:{mode:"point"},scales:{x:{type:"linear"},y:{type:"linear"}}};getLabelAndValue(t){const e=this._cachedMeta,i=this.chart.data.labels||[],{xScale:s,yScale:o}=e,a=this.getParsed(t),l=s.getLabelForValue(a.x),c=o.getLabelForValue(a.y);return{label:i[t]||"",value:"("+l+", "+c+")"}}update(t){const e=this._cachedMeta,{data:i=[]}=e,s=this.chart._animationsDisabled;let{start:o,count:a}=Ei(e,i,s);if(this._drawStart=o,this._drawCount=a,Mi(e)&&(o=0,a=i.length),this.options.showLine){this.datasetElementType||this.addElements();const{dataset:l,_dataset:c}=e;l._chart=this.chart,l._datasetIndex=this.index,l._decimated=!!c._decimated,l.points=i;const d=this.resolveDatasetElementOptions(t);d.segment=this.options.segment,this.updateElement(l,void 0,{animated:!s,options:d},t)}else this.datasetElementType&&(delete e.dataset,this.datasetElementType=!1);this.updateElements(i,o,a,t)}addElements(){const{showLine:t}=this.options;!this.datasetElementType&&t&&(this.datasetElementType=this.chart.registry.getElement("line")),super.addElements()}updateElements(t,e,i,s){const o=s==="reset",{iScale:a,vScale:l,_stacked:c,_dataset:d}=this._cachedMeta,h=this.resolveDataElementOptions(e,s),u=this.getSharedOptions(h),f=this.includeOptions(s,u),p=a.axis,g=l.axis,{spanGaps:b,segment:m}=this.options,_=Qt(b)?b:Number.POSITIVE_INFINITY,y=this.chart._animationsDisabled||o||s==="none";let k=e>0&&this.getParsed(e-1);for(let x=e;x<e+i;++x){const S=t[x],N=this.getParsed(x),V=y?S:{},L=tt(N[g]),C=V[p]=a.getPixelForValue(N[p],x),T=V[g]=o||L?l.getBasePixel():l.getPixelForValue(c?this.applyStack(l,N,c):N[g],x);V.skip=isNaN(C)||isNaN(T)||L,V.stop=x>0&&Math.abs(N[p]-k[p])>_,m&&(V.parsed=N,V.raw=d.data[x]),f&&(V.options=u||this.resolveDataElementOptions(x,S.active?"active":s)),y||this.updateElement(S,x,V,s),k=N}this.updateSharedOptions(u,s,h)}getMaxOverflow(){const t=this._cachedMeta,e=t.data||[];if(!this.options.showLine){let l=0;for(let c=e.length-1;c>=0;--c)l=Math.max(l,e[c].size(this.resolveDataElementOptions(c))/2);return l>0&&l}const i=t.dataset,s=i.options&&i.options.borderWidth||0;if(!e.length)return s;const o=e[0].size(this.resolveDataElementOptions(0)),a=e[e.length-1].size(this.resolveDataElementOptions(e.length-1));return Math.max(s,o,a)/2}}function Ut(){throw new Error("This method is not implemented: Check that a complete date adapter is provided.")}class On{static override(t){Object.assign(On.prototype,t)}options;constructor(t){this.options=t||{}}init(){}formats(){return Ut()}parse(){return Ut()}format(){return Ut()}add(){return Ut()}diff(){return Ut()}startOf(){return Ut()}endOf(){return Ut()}}var Gr={_date:On};function Qr(n,t,e,i){const{controller:s,data:o,_sorted:a}=n,l=s._cachedMeta.iScale,c=n.dataset&&n.dataset.options?n.dataset.options.spanGaps:null;if(l&&t===l.axis&&t!=="r"&&a&&o.length){const d=l._reversePixels?ua:Ft;if(i){if(s._sharedOptions){const h=o[0],u=typeof h.getRange=="function"&&h.getRange(t);if(u){const f=d(o,t,e-u),p=d(o,t,e+u);return{lo:f.lo,hi:p.hi}}}}else{const h=d(o,t,e);if(c){const{vScale:u}=s._cachedMeta,{_parsed:f}=n,p=f.slice(0,h.lo+1).reverse().findIndex(b=>!tt(b[u.axis]));h.lo-=Math.max(0,p);const g=f.slice(h.hi).findIndex(b=>!tt(b[u.axis]));h.hi+=Math.max(0,g)}return h}}return{lo:0,hi:o.length-1}}function $e(n,t,e,i,s){const o=n.getSortedVisibleDatasetMetas(),a=e[t];for(let l=0,c=o.length;l<c;++l){const{index:d,data:h}=o[l],{lo:u,hi:f}=Qr(o[l],t,a,s);for(let p=u;p<=f;++p){const g=h[p];g.skip||i(g,d,p)}}}function Jr(n){const t=n.indexOf("x")!==-1,e=n.indexOf("y")!==-1;return function(i,s){const o=t?Math.abs(i.x-s.x):0,a=e?Math.abs(i.y-s.y):0;return Math.sqrt(Math.pow(o,2)+Math.pow(a,2))}}function Vn(n,t,e,i,s){const o=[];return!s&&!n.isPointInArea(t)||$e(n,e,t,function(l,c,d){!s&&!ge(l,n.chartArea,0)||l.inRange(t.x,t.y,i)&&o.push({element:l,datasetIndex:c,index:d})},!0),o}function Zr(n,t,e,i){let s=[];function o(a,l,c){const{startAngle:d,endAngle:h}=a.getProps(["startAngle","endAngle"],i),{angle:u}=_i(a,{x:t.x,y:t.y});fe(u,d,h)&&s.push({element:a,datasetIndex:l,index:c})}return $e(n,e,t,o),s}function tl(n,t,e,i,s,o){let a=[];const l=Jr(e);let c=Number.POSITIVE_INFINITY;function d(h,u,f){const p=h.inRange(t.x,t.y,s);if(i&&!p)return;const g=h.getCenterPoint(s);if(!(!!o||n.isPointInArea(g))&&!p)return;const m=l(t,g);m<c?(a=[{element:h,datasetIndex:u,index:f}],c=m):m===c&&a.push({element:h,datasetIndex:u,index:f})}return $e(n,e,t,d),a}function Ln(n,t,e,i,s,o){return!o&&!n.isPointInArea(t)?[]:e==="r"&&!i?Zr(n,t,e,s):tl(n,t,e,i,s,o)}function cs(n,t,e,i,s){const o=[],a=e==="x"?"inXRange":"inYRange";let l=!1;return $e(n,e,t,(c,d,h)=>{c[a]&&c[a](t[e],s)&&(o.push({element:c,datasetIndex:d,index:h}),l=l||c.inRange(t.x,t.y,s))}),i&&!l?[]:o}var el={modes:{index(n,t,e,i){const s=qt(t,n),o=e.axis||"x",a=e.includeInvisible||!1,l=e.intersect?Vn(n,s,o,i,a):Ln(n,s,o,!1,i,a),c=[];return l.length?(n.getSortedVisibleDatasetMetas().forEach(d=>{const h=l[0].index,u=d.data[h];u&&!u.skip&&c.push({element:u,datasetIndex:d.index,index:h})}),c):[]},dataset(n,t,e,i){const s=qt(t,n),o=e.axis||"xy",a=e.includeInvisible||!1;let l=e.intersect?Vn(n,s,o,i,a):Ln(n,s,o,!1,i,a);if(l.length>0){const c=l[0].datasetIndex,d=n.getDatasetMeta(c).data;l=[];for(let h=0;h<d.length;++h)l.push({element:d[h],datasetIndex:c,index:h})}return l},point(n,t,e,i){const s=qt(t,n),o=e.axis||"xy",a=e.includeInvisible||!1;return Vn(n,s,o,i,a)},nearest(n,t,e,i){const s=qt(t,n),o=e.axis||"xy",a=e.includeInvisible||!1;return Ln(n,s,o,e.intersect,i,a)},x(n,t,e,i){const s=qt(t,n);return cs(n,s,"x",e.intersect,i)},y(n,t,e,i){const s=qt(t,n);return cs(n,s,"y",e.intersect,i)}}};const ds=["left","top","right","bottom"];function ke(n,t){return n.filter(e=>e.pos===t)}function hs(n,t){return n.filter(e=>ds.indexOf(e.pos)===-1&&e.box.axis===t)}function xe(n,t){return n.sort((e,i)=>{const s=t?i:e,o=t?e:i;return s.weight===o.weight?s.index-o.index:s.weight-o.weight})}function nl(n){const t=[];let e,i,s,o,a,l;for(e=0,i=(n||[]).length;e<i;++e)s=n[e],{position:o,options:{stack:a,stackWeight:l=1}}=s,t.push({index:e,box:s,pos:o,horizontal:s.isHorizontal(),weight:s.weight,stack:a&&o+a,stackWeight:l});return t}function il(n){const t={};for(const e of n){const{stack:i,pos:s,stackWeight:o}=e;if(!i||!ds.includes(s))continue;const a=t[i]||(t[i]={count:0,placed:0,weight:0,size:0});a.count++,a.weight+=o}return t}function sl(n,t){const e=il(n),{vBoxMaxWidth:i,hBoxMaxHeight:s}=t;let o,a,l;for(o=0,a=n.length;o<a;++o){l=n[o];const{fullSize:c}=l.box,d=e[l.stack],h=d&&l.stackWeight/d.weight;l.horizontal?(l.width=h?h*i:c&&t.availableWidth,l.height=s):(l.width=i,l.height=h?h*s:c&&t.availableHeight)}return e}function ol(n){const t=nl(n),e=xe(t.filter(d=>d.box.fullSize),!0),i=xe(ke(t,"left"),!0),s=xe(ke(t,"right")),o=xe(ke(t,"top"),!0),a=xe(ke(t,"bottom")),l=hs(t,"x"),c=hs(t,"y");return{fullSize:e,leftAndTop:i.concat(o),rightAndBottom:s.concat(c).concat(a).concat(l),chartArea:ke(t,"chartArea"),vertical:i.concat(s).concat(c),horizontal:o.concat(a).concat(l)}}function us(n,t,e,i){return Math.max(n[e],t[e])+Math.max(n[i],t[i])}function fs(n,t){n.top=Math.max(n.top,t.top),n.left=Math.max(n.left,t.left),n.bottom=Math.max(n.bottom,t.bottom),n.right=Math.max(n.right,t.right)}function al(n,t,e,i){const{pos:s,box:o}=e,a=n.maxPadding;if(!Q(s)){e.size&&(n[s]-=e.size);const u=i[e.stack]||{size:0,count:1};u.size=Math.max(u.size,e.horizontal?o.height:o.width),e.size=u.size/u.count,n[s]+=e.size}o.getPadding&&fs(a,o.getPadding());const l=Math.max(0,t.outerWidth-us(a,n,"left","right")),c=Math.max(0,t.outerHeight-us(a,n,"top","bottom")),d=l!==n.w,h=c!==n.h;return n.w=l,n.h=c,e.horizontal?{same:d,other:h}:{same:h,other:d}}function rl(n){const t=n.maxPadding;function e(i){const s=Math.max(t[i]-n[i],0);return n[i]+=s,s}n.y+=e("top"),n.x+=e("left"),e("right"),e("bottom")}function ll(n,t){const e=t.maxPadding;function i(s){const o={left:0,top:0,right:0,bottom:0};return s.forEach(a=>{o[a]=Math.max(t[a],e[a])}),o}return i(n?["left","right"]:["top","bottom"])}function we(n,t,e,i){const s=[];let o,a,l,c,d,h;for(o=0,a=n.length,d=0;o<a;++o){l=n[o],c=l.box,c.update(l.width||t.w,l.height||t.h,ll(l.horizontal,t));const{same:u,other:f}=al(t,e,l,i);d|=u&&s.length,h=h||f,c.fullSize||s.push(l)}return d&&we(s,t,e,i)||h}function We(n,t,e,i,s){n.top=e,n.left=t,n.right=t+i,n.bottom=e+s,n.width=i,n.height=s}function ps(n,t,e,i){const s=e.padding;let{x:o,y:a}=t;for(const l of n){const c=l.box,d=i[l.stack]||{placed:0,weight:1},h=l.stackWeight/d.weight||1;if(l.horizontal){const u=t.w*h,f=d.size||c.height;he(d.start)&&(a=d.start),c.fullSize?We(c,s.left,a,e.outerWidth-s.right-s.left,f):We(c,t.left+d.placed,a,u,f),d.start=a,d.placed+=u,a=c.bottom}else{const u=t.h*h,f=d.size||c.width;he(d.start)&&(o=d.start),c.fullSize?We(c,o,s.top,f,e.outerHeight-s.bottom-s.top):We(c,o,t.top+d.placed,f,u),d.start=o,d.placed+=u,o=c.right}}t.x=o,t.y=a}var kt={addBox(n,t){n.boxes||(n.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)}}]},n.boxes.push(t)},removeBox(n,t){const e=n.boxes?n.boxes.indexOf(t):-1;e!==-1&&n.boxes.splice(e,1)},configure(n,t,e){t.fullSize=e.fullSize,t.position=e.position,t.weight=e.weight},update(n,t,e,i){if(!n)return;const s=_t(n.options.layout.padding),o=Math.max(t-s.width,0),a=Math.max(e-s.height,0),l=ol(n.boxes),c=l.vertical,d=l.horizontal;et(n.boxes,b=>{typeof b.beforeLayout=="function"&&b.beforeLayout()});const h=c.reduce((b,m)=>m.box.options&&m.box.options.display===!1?b:b+1,0)||1,u=Object.freeze({outerWidth:t,outerHeight:e,padding:s,availableWidth:o,availableHeight:a,vBoxMaxWidth:o/2/h,hBoxMaxHeight:a/2}),f=Object.assign({},s);fs(f,_t(i));const p=Object.assign({maxPadding:f,w:o,h:a,x:s.left,y:s.top},s),g=sl(c.concat(d),u);we(l.fullSize,p,u,g),we(c,p,u,g),we(d,p,u,g)&&we(c,p,u,g),rl(p),ps(l.leftAndTop,p,u,g),p.x+=p.w,p.y+=p.h,ps(l.rightAndBottom,p,u,g),n.chartArea={left:p.left,top:p.top,right:p.left+p.w,bottom:p.top+p.h,height:p.h,width:p.w},et(l.chartArea,b=>{const m=b.box;Object.assign(m,n.chartArea),m.update(p.w,p.h,{left:0,top:0,right:0,bottom:0})})}};class ms{acquireContext(t,e){}releaseContext(t){return!1}addEventListener(t,e,i){}removeEventListener(t,e,i){}getDevicePixelRatio(){return 1}getMaximumSize(t,e,i,s){return e=Math.max(0,e||t.width),i=i||t.height,{width:e,height:Math.max(0,s?Math.floor(e/s):i)}}isAttached(t){return!0}updateConfig(t){}}class cl extends ms{acquireContext(t){return t&&t.getContext&&t.getContext("2d")||null}updateConfig(t){t.options.animation=!1}}const He="$chartjs",dl={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},gs=n=>n===null||n==="";function hl(n,t){const e=n.style,i=n.getAttribute("height"),s=n.getAttribute("width");if(n[He]={initial:{height:i,width:s,style:{display:e.display,height:e.height,width:e.width}}},e.display=e.display||"block",e.boxSizing=e.boxSizing||"border-box",gs(s)){const o=ji(n,"width");o!==void 0&&(n.width=o)}if(gs(i))if(n.style.height==="")n.height=n.width/(t||2);else{const o=ji(n,"height");o!==void 0&&(n.height=o)}return n}const bs=or?{passive:!0}:!1;function ul(n,t,e){n&&n.addEventListener(t,e,bs)}function fl(n,t,e){n&&n.canvas&&n.canvas.removeEventListener(t,e,bs)}function pl(n,t){const e=dl[n.type]||n.type,{x:i,y:s}=qt(n,t);return{type:e,chart:t,native:n,x:i!==void 0?i:null,y:s!==void 0?s:null}}function je(n,t){for(const e of n)if(e===t||e.contains(t))return!0}function ml(n,t,e){const i=n.canvas,s=new MutationObserver(o=>{let a=!1;for(const l of o)a=a||je(l.addedNodes,i),a=a&&!je(l.removedNodes,i);a&&e()});return s.observe(document,{childList:!0,subtree:!0}),s}function gl(n,t,e){const i=n.canvas,s=new MutationObserver(o=>{let a=!1;for(const l of o)a=a||je(l.removedNodes,i),a=a&&!je(l.addedNodes,i);a&&e()});return s.observe(document,{childList:!0,subtree:!0}),s}const Se=new Map;let ys=0;function _s(){const n=window.devicePixelRatio;n!==ys&&(ys=n,Se.forEach((t,e)=>{e.currentDevicePixelRatio!==n&&t()}))}function bl(n,t){Se.size||window.addEventListener("resize",_s),Se.set(n,t)}function yl(n){Se.delete(n),Se.size||window.removeEventListener("resize",_s)}function _l(n,t,e){const i=n.canvas,s=i&&Dn(i);if(!s)return;const o=Ci((l,c)=>{const d=s.clientWidth;e(l,c),d<s.clientWidth&&e()},window),a=new ResizeObserver(l=>{const c=l[0],d=c.contentRect.width,h=c.contentRect.height;d===0&&h===0||o(d,h)});return a.observe(s),bl(n,o),a}function zn(n,t,e){e&&e.disconnect(),t==="resize"&&yl(n)}function kl(n,t,e){const i=n.canvas,s=Ci(o=>{n.ctx!==null&&e(pl(o,n))},n);return ul(i,t,s),s}class xl extends ms{acquireContext(t,e){const i=t&&t.getContext&&t.getContext("2d");return i&&i.canvas===t?(hl(t,e),i):null}releaseContext(t){const e=t.canvas;if(!e[He])return!1;const i=e[He].initial;["height","width"].forEach(o=>{const a=i[o];tt(a)?e.removeAttribute(o):e.setAttribute(o,a)});const s=i.style||{};return Object.keys(s).forEach(o=>{e.style[o]=s[o]}),e.width=e.width,delete e[He],!0}addEventListener(t,e,i){this.removeEventListener(t,e);const s=t.$proxies||(t.$proxies={}),a={attach:ml,detach:gl,resize:_l}[e]||kl;s[e]=a(t,e,i)}removeEventListener(t,e){const i=t.$proxies||(t.$proxies={}),s=i[e];if(!s)return;({attach:zn,detach:zn,resize:zn}[e]||fl)(t,e,s),i[e]=void 0}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(t,e,i,s){return sr(t,e,i,s)}isAttached(t){const e=t&&Dn(t);return!!(e&&e.isConnected)}}function wl(n){return!Bn()||typeof OffscreenCanvas<"u"&&n instanceof OffscreenCanvas?cl:xl}class At{static defaults={};static defaultRoutes=void 0;x;y;active=!1;options;$animations;tooltipPosition(t){const{x:e,y:i}=this.getProps(["x","y"],t);return{x:e,y:i}}hasValue(){return Qt(this.x)&&Qt(this.y)}getProps(t,e){const i=this.$animations;if(!e||!i)return this;const s={};return t.forEach(o=>{s[o]=i[o]&&i[o].active()?i[o]._to:this[o]}),s}}function Sl(n,t){const e=n.options.ticks,i=Cl(n),s=Math.min(e.maxTicksLimit||i,i),o=e.major.enabled?Ml(t):[],a=o.length,l=o[0],c=o[a-1],d=[];if(a>s)return vl(t,d,o,a/s),d;const h=El(o,t,s);if(a>0){let u,f;const p=a>1?Math.round((c-l)/(a-1)):null;for(qe(t,d,h,tt(p)?0:l-p,l),u=0,f=a-1;u<f;u++)qe(t,d,h,o[u],o[u+1]);return qe(t,d,h,c,tt(p)?t.length:c+p),d}return qe(t,d,h),d}function Cl(n){const t=n.options.offset,e=n._tickSize(),i=n._length/e+(t?0:1),s=n._maxLength/e;return Math.floor(Math.min(i,s))}function El(n,t,e){const i=Bl(n),s=t.length/e;if(!i)return Math.max(s,1);const o=oa(i);for(let a=0,l=o.length-1;a<l;a++){const c=o[a];if(c>s)return c}return Math.max(s,1)}function Ml(n){const t=[];let e,i;for(e=0,i=n.length;e<i;e++)n[e].major&&t.push(e);return t}function vl(n,t,e,i){let s=0,o=e[0],a;for(i=Math.ceil(i),a=0;a<n.length;a++)a===o&&(t.push(n[a]),s++,o=e[s*i])}function qe(n,t,e,i,s){const o=U(i,0),a=Math.min(U(s,n.length),n.length);let l=0,c,d,h;for(e=Math.ceil(e),s&&(c=s-i,e=c/Math.floor(c/e)),h=o;h<0;)l++,h=Math.round(o+l*e);for(d=Math.max(o,0);d<a;d++)d===h&&(t.push(n[d]),l++,h=Math.round(o+l*e))}function Bl(n){const t=n.length;let e,i;if(t<2)return!1;for(i=n[0],e=1;e<t;++e)if(n[e]-n[e-1]!==i)return!1;return i}const Dl=n=>n==="left"?"right":n==="right"?"left":n,ks=(n,t,e)=>t==="top"||t==="left"?n[t]+e:n[t]-e,xs=(n,t)=>Math.min(t||n,n);function ws(n,t){const e=[],i=n.length/t,s=n.length;let o=0;for(;o<s;o+=i)e.push(n[Math.floor(o)]);return e}function Al(n,t,e){const i=n.ticks.length,s=Math.min(t,i-1),o=n._startPixel,a=n._endPixel,l=1e-6;let c=n.getPixelForTick(s),d;if(!(e&&(i===1?d=Math.max(c-o,a-c):t===0?d=(n.getPixelForTick(1)-c)/2:d=(c-n.getPixelForTick(s-1))/2,c+=s<t?d:-d,c<o-l||c>a+l)))return c}function Tl(n,t){et(n,e=>{const i=e.gc,s=i.length/2;let o;if(s>t){for(o=0;o<s;++o)delete e.data[i[o]];i.splice(0,s)}})}function Ce(n){return n.drawTicks?n.tickLength:0}function Ss(n,t){if(!n.display)return 0;const e=ft(n.font,t),i=_t(n.padding);return(lt(n.text)?n.text.length:1)*e.lineHeight+i.height}function Pl(n,t){return Ht(n,{scale:t,type:"scale"})}function Nl(n,t,e){return Ht(n,{tick:e,index:t,type:"tick"})}function Ol(n,t,e){let i=mn(n);return(e&&t!=="right"||!e&&t==="right")&&(i=Dl(i)),i}function Vl(n,t,e,i){const{top:s,left:o,bottom:a,right:l,chart:c}=n,{chartArea:d,scales:h}=c;let u=0,f,p,g;const b=a-s,m=l-o;if(n.isHorizontal()){if(p=ut(i,o,l),Q(e)){const _=Object.keys(e)[0],y=e[_];g=h[_].getPixelForValue(y)+b-t}else e==="center"?g=(d.bottom+d.top)/2+b-t:g=ks(n,e,t);f=l-o}else{if(Q(e)){const _=Object.keys(e)[0],y=e[_];p=h[_].getPixelForValue(y)-m+t}else e==="center"?p=(d.left+d.right)/2-m+t:p=ks(n,e,t);g=ut(i,a,s),u=e==="left"?-ct:ct}return{titleX:p,titleY:g,maxWidth:f,rotation:u}}class ne extends At{constructor(t){super(),this.id=t.id,this.type=t.type,this.options=void 0,this.ctx=t.ctx,this.chart=t.chart,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this._margins={left:0,right:0,top:0,bottom:0},this.maxWidth=void 0,this.maxHeight=void 0,this.paddingTop=void 0,this.paddingBottom=void 0,this.paddingLeft=void 0,this.paddingRight=void 0,this.axis=void 0,this.labelRotation=void 0,this.min=void 0,this.max=void 0,this._range=void 0,this.ticks=[],this._gridLineItems=null,this._labelItems=null,this._labelSizes=null,this._length=0,this._maxLength=0,this._longestTextCache={},this._startPixel=void 0,this._endPixel=void 0,this._reversePixels=!1,this._userMax=void 0,this._userMin=void 0,this._suggestedMax=void 0,this._suggestedMin=void 0,this._ticksLength=0,this._borderValue=0,this._cache={},this._dataLimitsCached=!1,this.$context=void 0}init(t){this.options=t.setContext(this.getContext()),this.axis=t.axis,this._userMin=this.parse(t.min),this._userMax=this.parse(t.max),this._suggestedMin=this.parse(t.suggestedMin),this._suggestedMax=this.parse(t.suggestedMax)}parse(t,e){return t}getUserBounds(){let{_userMin:t,_userMax:e,_suggestedMin:i,_suggestedMax:s}=this;return t=wt(t,Number.POSITIVE_INFINITY),e=wt(e,Number.NEGATIVE_INFINITY),i=wt(i,Number.POSITIVE_INFINITY),s=wt(s,Number.NEGATIVE_INFINITY),{min:wt(t,i),max:wt(e,s),minDefined:yt(t),maxDefined:yt(e)}}getMinMax(t){let{min:e,max:i,minDefined:s,maxDefined:o}=this.getUserBounds(),a;if(s&&o)return{min:e,max:i};const l=this.getMatchingVisibleMetas();for(let c=0,d=l.length;c<d;++c)a=l[c].controller.getMinMax(this,t),s||(e=Math.min(e,a.min)),o||(i=Math.max(i,a.max));return e=o&&e>i?i:e,i=s&&e>i?e:i,{min:wt(e,wt(i,e)),max:wt(i,wt(e,i))}}getPadding(){return{left:this.paddingLeft||0,top:this.paddingTop||0,right:this.paddingRight||0,bottom:this.paddingBottom||0}}getTicks(){return this.ticks}getLabels(){const t=this.chart.data;return this.options.labels||(this.isHorizontal()?t.xLabels:t.yLabels)||t.labels||[]}getLabelItems(t=this.chart.chartArea){return this._labelItems||(this._labelItems=this._computeLabelItems(t))}beforeLayout(){this._cache={},this._dataLimitsCached=!1}beforeUpdate(){st(this.options.beforeUpdate,[this])}update(t,e,i){const{beginAtZero:s,grace:o,ticks:a}=this.options,l=a.sampleSize;this.beforeUpdate(),this.maxWidth=t,this.maxHeight=e,this._margins=i=Object.assign({left:0,right:0,top:0,bottom:0},i),this.ticks=null,this._labelSizes=null,this._gridLineItems=null,this._labelItems=null,this.beforeSetDimensions(),this.setDimensions(),this.afterSetDimensions(),this._maxLength=this.isHorizontal()?this.width+i.left+i.right:this.height+i.top+i.bottom,this._dataLimitsCached||(this.beforeDataLimits(),this.determineDataLimits(),this.afterDataLimits(),this._range=La(this,o,s),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();const c=l<this.ticks.length;this._convertTicksToLabels(c?ws(this.ticks,l):this.ticks),this.configure(),this.beforeCalculateLabelRotation(),this.calculateLabelRotation(),this.afterCalculateLabelRotation(),a.display&&(a.autoSkip||a.source==="auto")&&(this.ticks=Sl(this,this.ticks),this._labelSizes=null,this.afterAutoSkip()),c&&this._convertTicksToLabels(this.ticks),this.beforeFit(),this.fit(),this.afterFit(),this.afterUpdate()}configure(){let t=this.options.reverse,e,i;this.isHorizontal()?(e=this.left,i=this.right):(e=this.top,i=this.bottom,t=!t),this._startPixel=e,this._endPixel=i,this._reversePixels=t,this._length=i-e,this._alignToPixels=this.options.alignToPixels}afterUpdate(){st(this.options.afterUpdate,[this])}beforeSetDimensions(){st(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(){st(this.options.afterSetDimensions,[this])}_callHooks(t){this.chart.notifyPlugins(t,this.getContext()),st(this.options[t],[this])}beforeDataLimits(){this._callHooks("beforeDataLimits")}determineDataLimits(){}afterDataLimits(){this._callHooks("afterDataLimits")}beforeBuildTicks(){this._callHooks("beforeBuildTicks")}buildTicks(){return[]}afterBuildTicks(){this._callHooks("afterBuildTicks")}beforeTickToLabelConversion(){st(this.options.beforeTickToLabelConversion,[this])}generateTickLabels(t){const e=this.options.ticks;let i,s,o;for(i=0,s=t.length;i<s;i++)o=t[i],o.label=st(e.callback,[o.value,i,t],this)}afterTickToLabelConversion(){st(this.options.afterTickToLabelConversion,[this])}beforeCalculateLabelRotation(){st(this.options.beforeCalculateLabelRotation,[this])}calculateLabelRotation(){const t=this.options,e=t.ticks,i=xs(this.ticks.length,t.ticks.maxTicksLimit),s=e.minRotation||0,o=e.maxRotation;let a=s,l,c,d;if(!this._isVisible()||!e.display||s>=o||i<=1||!this.isHorizontal()){this.labelRotation=s;return}const h=this._getLabelSizes(),u=h.widest.width,f=h.highest.height,p=ht(this.chart.width-u,0,this.maxWidth);l=t.offset?this.maxWidth/i:p/(i-1),u+6>l&&(l=p/(i-(t.offset?.5:1)),c=this.maxHeight-Ce(t.grid)-e.padding-Ss(t.title,this.chart.options.font),d=Math.sqrt(u*u+f*f),a=ca(Math.min(Math.asin(ht((h.highest.height+6)/l,-1,1)),Math.asin(ht(c/d,-1,1))-Math.asin(ht(f/d,-1,1)))),a=Math.max(s,Math.min(o,a))),this.labelRotation=a}afterCalculateLabelRotation(){st(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){st(this.options.beforeFit,[this])}fit(){const t={width:0,height:0},{chart:e,options:{ticks:i,title:s,grid:o}}=this,a=this._isVisible(),l=this.isHorizontal();if(a){const c=Ss(s,e.options.font);if(l?(t.width=this.maxWidth,t.height=Ce(o)+c):(t.height=this.maxHeight,t.width=Ce(o)+c),i.display&&this.ticks.length){const{first:d,last:h,widest:u,highest:f}=this._getLabelSizes(),p=i.padding*2,g=Bt(this.labelRotation),b=Math.cos(g),m=Math.sin(g);if(l){const _=i.mirror?0:m*u.width+b*f.height;t.height=Math.min(this.maxHeight,t.height+_+p)}else{const _=i.mirror?0:b*u.width+m*f.height;t.width=Math.min(this.maxWidth,t.width+_+p)}this._calculatePadding(d,h,m,b)}}this._handleMargins(),l?(this.width=this._length=e.width-this._margins.left-this._margins.right,this.height=t.height):(this.width=t.width,this.height=this._length=e.height-this._margins.top-this._margins.bottom)}_calculatePadding(t,e,i,s){const{ticks:{align:o,padding:a},position:l}=this.options,c=this.labelRotation!==0,d=l!=="top"&&this.axis==="x";if(this.isHorizontal()){const h=this.getPixelForTick(0)-this.left,u=this.right-this.getPixelForTick(this.ticks.length-1);let f=0,p=0;c?d?(f=s*t.width,p=i*e.height):(f=i*t.height,p=s*e.width):o==="start"?p=e.width:o==="end"?f=t.width:o!=="inner"&&(f=t.width/2,p=e.width/2),this.paddingLeft=Math.max((f-h+a)*this.width/(this.width-h),0),this.paddingRight=Math.max((p-u+a)*this.width/(this.width-u),0)}else{let h=e.height/2,u=t.height/2;o==="start"?(h=0,u=t.height):o==="end"&&(h=e.height,u=0),this.paddingTop=h+a,this.paddingBottom=u+a}}_handleMargins(){this._margins&&(this._margins.left=Math.max(this.paddingLeft,this._margins.left),this._margins.top=Math.max(this.paddingTop,this._margins.top),this._margins.right=Math.max(this.paddingRight,this._margins.right),this._margins.bottom=Math.max(this.paddingBottom,this._margins.bottom))}afterFit(){st(this.options.afterFit,[this])}isHorizontal(){const{axis:t,position:e}=this.options;return e==="top"||e==="bottom"||t==="x"}isFullSize(){return this.options.fullSize}_convertTicksToLabels(t){this.beforeTickToLabelConversion(),this.generateTickLabels(t);let e,i;for(e=0,i=t.length;e<i;e++)tt(t[e].label)&&(t.splice(e,1),i--,e--);this.afterTickToLabelConversion()}_getLabelSizes(){let t=this._labelSizes;if(!t){const e=this.options.ticks.sampleSize;let i=this.ticks;e<i.length&&(i=ws(i,e)),this._labelSizes=t=this._computeLabelSizes(i,i.length,this.options.ticks.maxTicksLimit)}return t}_computeLabelSizes(t,e,i){const{ctx:s,_longestTextCache:o}=this,a=[],l=[],c=Math.floor(e/xs(e,i));let d=0,h=0,u,f,p,g,b,m,_,y,k,x,S;for(u=0;u<e;u+=c){if(g=t[u].label,b=this._resolveTickFontOptions(u),s.font=m=b.string,_=o[m]=o[m]||{data:{},gc:[]},y=b.lineHeight,k=x=0,!tt(g)&&!lt(g))k=Pi(s,_.data,_.gc,k,g),x=y;else if(lt(g))for(f=0,p=g.length;f<p;++f)S=g[f],!tt(S)&&!lt(S)&&(k=Pi(s,_.data,_.gc,k,S),x+=y);a.push(k),l.push(x),d=Math.max(k,d),h=Math.max(x,h)}Tl(o,e);const N=a.indexOf(d),V=l.indexOf(h),L=C=>({width:a[C]||0,height:l[C]||0});return{first:L(0),last:L(e-1),widest:L(N),highest:L(V),widths:a,heights:l}}getLabelForValue(t){return t}getPixelForValue(t,e){return NaN}getValueForPixel(t){}getPixelForTick(t){const e=this.ticks;return t<0||t>e.length-1?null:this.getPixelForValue(e[t].value)}getPixelForDecimal(t){this._reversePixels&&(t=1-t);const e=this._startPixel+t*this._length;return ha(this._alignToPixels?Wt(this.chart,e,0):e)}getDecimalForPixel(t){const e=(t-this._startPixel)/this._length;return this._reversePixels?1-e:e}getBasePixel(){return this.getPixelForValue(this.getBaseValue())}getBaseValue(){const{min:t,max:e}=this;return t<0&&e<0?e:t>0&&e>0?t:0}getContext(t){const e=this.ticks||[];if(t>=0&&t<e.length){const i=e[t];return i.$context||(i.$context=Nl(this.getContext(),t,i))}return this.$context||(this.$context=Pl(this.chart.getContext(),this))}_tickSize(){const t=this.options.ticks,e=Bt(this.labelRotation),i=Math.abs(Math.cos(e)),s=Math.abs(Math.sin(e)),o=this._getLabelSizes(),a=t.autoSkipPadding||0,l=o?o.widest.width+a:0,c=o?o.highest.height+a:0;return this.isHorizontal()?c*i>l*s?l/i:c/s:c*s<l*i?c/i:l/s}_isVisible(){const t=this.options.display;return t!=="auto"?!!t:this.getMatchingVisibleMetas().length>0}_computeGridLineItems(t){const e=this.axis,i=this.chart,s=this.options,{grid:o,position:a,border:l}=s,c=o.offset,d=this.isHorizontal(),u=this.ticks.length+(c?1:0),f=Ce(o),p=[],g=l.setContext(this.getContext()),b=g.display?g.width:0,m=b/2,_=function(Y){return Wt(i,Y,b)};let y,k,x,S,N,V,L,C,T,P,O,F;if(a==="top")y=_(this.bottom),V=this.bottom-f,C=y-m,P=_(t.top)+m,F=t.bottom;else if(a==="bottom")y=_(this.top),P=t.top,F=_(t.bottom)-m,V=y+m,C=this.top+f;else if(a==="left")y=_(this.right),N=this.right-f,L=y-m,T=_(t.left)+m,O=t.right;else if(a==="right")y=_(this.left),T=t.left,O=_(t.right)-m,N=y+m,L=this.left+f;else if(e==="x"){if(a==="center")y=_((t.top+t.bottom)/2+.5);else if(Q(a)){const Y=Object.keys(a)[0],G=a[Y];y=_(this.chart.scales[Y].getPixelForValue(G))}P=t.top,F=t.bottom,V=y+m,C=V+f}else if(e==="y"){if(a==="center")y=_((t.left+t.right)/2);else if(Q(a)){const Y=Object.keys(a)[0],G=a[Y];y=_(this.chart.scales[Y].getPixelForValue(G))}N=y-m,L=N-f,T=t.left,O=t.right}const H=U(s.ticks.maxTicksLimit,u),q=Math.max(1,Math.ceil(u/H));for(k=0;k<u;k+=q){const Y=this.getContext(k),G=o.setContext(Y),ot=l.setContext(Y),E=G.lineWidth,R=G.color,A=ot.dash||[],$=ot.dashOffset,j=G.tickWidth,w=G.tickColor,D=G.tickBorderDash||[],v=G.tickBorderDashOffset;x=Al(this,k,c),x!==void 0&&(S=Wt(i,x,E),d?N=L=T=O=S:V=C=P=F=S,p.push({tx1:N,ty1:V,tx2:L,ty2:C,x1:T,y1:P,x2:O,y2:F,width:E,color:R,borderDash:A,borderDashOffset:$,tickWidth:j,tickColor:w,tickBorderDash:D,tickBorderDashOffset:v}))}return this._ticksLength=u,this._borderValue=y,p}_computeLabelItems(t){const e=this.axis,i=this.options,{position:s,ticks:o}=i,a=this.isHorizontal(),l=this.ticks,{align:c,crossAlign:d,padding:h,mirror:u}=o,f=Ce(i.grid),p=f+h,g=u?-h:p,b=-Bt(this.labelRotation),m=[];let _,y,k,x,S,N,V,L,C,T,P,O,F="middle";if(s==="top")N=this.bottom-g,V=this._getXAxisLabelAlignment();else if(s==="bottom")N=this.top+g,V=this._getXAxisLabelAlignment();else if(s==="left"){const q=this._getYAxisLabelAlignment(f);V=q.textAlign,S=q.x}else if(s==="right"){const q=this._getYAxisLabelAlignment(f);V=q.textAlign,S=q.x}else if(e==="x"){if(s==="center")N=(t.top+t.bottom)/2+p;else if(Q(s)){const q=Object.keys(s)[0],Y=s[q];N=this.chart.scales[q].getPixelForValue(Y)+p}V=this._getXAxisLabelAlignment()}else if(e==="y"){if(s==="center")S=(t.left+t.right)/2-p;else if(Q(s)){const q=Object.keys(s)[0],Y=s[q];S=this.chart.scales[q].getPixelForValue(Y)}V=this._getYAxisLabelAlignment(f).textAlign}e==="y"&&(c==="start"?F="top":c==="end"&&(F="bottom"));const H=this._getLabelSizes();for(_=0,y=l.length;_<y;++_){k=l[_],x=k.label;const q=o.setContext(this.getContext(_));L=this.getPixelForTick(_)+o.labelOffset,C=this._resolveTickFontOptions(_),T=C.lineHeight,P=lt(x)?x.length:1;const Y=P/2,G=q.color,ot=q.textStrokeColor,E=q.textStrokeWidth;let R=V;a?(S=L,V==="inner"&&(_===y-1?R=this.options.reverse?"left":"right":_===0?R=this.options.reverse?"right":"left":R="center"),s==="top"?d==="near"||b!==0?O=-P*T+T/2:d==="center"?O=-H.highest.height/2-Y*T+T:O=-H.highest.height+T/2:d==="near"||b!==0?O=T/2:d==="center"?O=H.highest.height/2-Y*T:O=H.highest.height-P*T,u&&(O*=-1),b!==0&&!q.showLabelBackdrop&&(S+=T/2*Math.sin(b))):(N=L,O=(1-P)*T/2);let A;if(q.showLabelBackdrop){const $=_t(q.backdropPadding),j=H.heights[_],w=H.widths[_];let D=O-$.top,v=0-$.left;switch(F){case"middle":D-=j/2;break;case"bottom":D-=j;break}switch(V){case"center":v-=w/2;break;case"right":v-=w;break;case"inner":_===y-1?v-=w:_>0&&(v-=w/2);break}A={left:v,top:D,width:w+$.width,height:j+$.height,color:q.backdropColor}}m.push({label:x,font:C,textOffset:O,options:{rotation:b,color:G,strokeColor:ot,strokeWidth:E,textAlign:R,textBaseline:F,translation:[S,N],backdrop:A}})}return m}_getXAxisLabelAlignment(){const{position:t,ticks:e}=this.options;if(-Bt(this.labelRotation))return t==="top"?"left":"right";let s="center";return e.align==="start"?s="left":e.align==="end"?s="right":e.align==="inner"&&(s="inner"),s}_getYAxisLabelAlignment(t){const{position:e,ticks:{crossAlign:i,mirror:s,padding:o}}=this.options,a=this._getLabelSizes(),l=t+o,c=a.widest.width;let d,h;return e==="left"?s?(h=this.right+o,i==="near"?d="left":i==="center"?(d="center",h+=c/2):(d="right",h+=c)):(h=this.right-l,i==="near"?d="right":i==="center"?(d="center",h-=c/2):(d="left",h=this.left)):e==="right"?s?(h=this.left+o,i==="near"?d="right":i==="center"?(d="center",h-=c/2):(d="left",h-=c)):(h=this.left+l,i==="near"?d="left":i==="center"?(d="center",h+=c/2):(d="right",h=this.right)):d="right",{textAlign:d,x:h}}_computeLabelArea(){if(this.options.ticks.mirror)return;const t=this.chart,e=this.options.position;if(e==="left"||e==="right")return{top:0,left:this.left,bottom:t.height,right:this.right};if(e==="top"||e==="bottom")return{top:this.top,left:0,bottom:this.bottom,right:t.width}}drawBackground(){const{ctx:t,options:{backgroundColor:e},left:i,top:s,width:o,height:a}=this;e&&(t.save(),t.fillStyle=e,t.fillRect(i,s,o,a),t.restore())}getLineWidthForValue(t){const e=this.options.grid;if(!this._isVisible()||!e.display)return 0;const s=this.ticks.findIndex(o=>o.value===t);return s>=0?e.setContext(this.getContext(s)).lineWidth:0}drawGrid(t){const e=this.options.grid,i=this.ctx,s=this._gridLineItems||(this._gridLineItems=this._computeGridLineItems(t));let o,a;const l=(c,d,h)=>{!h.width||!h.color||(i.save(),i.lineWidth=h.width,i.strokeStyle=h.color,i.setLineDash(h.borderDash||[]),i.lineDashOffset=h.borderDashOffset,i.beginPath(),i.moveTo(c.x,c.y),i.lineTo(d.x,d.y),i.stroke(),i.restore())};if(e.display)for(o=0,a=s.length;o<a;++o){const c=s[o];e.drawOnChartArea&&l({x:c.x1,y:c.y1},{x:c.x2,y:c.y2},c),e.drawTicks&&l({x:c.tx1,y:c.ty1},{x:c.tx2,y:c.ty2},{color:c.tickColor,width:c.tickWidth,borderDash:c.tickBorderDash,borderDashOffset:c.tickBorderDashOffset})}}drawBorder(){const{chart:t,ctx:e,options:{border:i,grid:s}}=this,o=i.setContext(this.getContext()),a=i.display?o.width:0;if(!a)return;const l=s.setContext(this.getContext(0)).lineWidth,c=this._borderValue;let d,h,u,f;this.isHorizontal()?(d=Wt(t,this.left,a)-a/2,h=Wt(t,this.right,l)+l/2,u=f=c):(u=Wt(t,this.top,a)-a/2,f=Wt(t,this.bottom,l)+l/2,d=h=c),e.save(),e.lineWidth=o.width,e.strokeStyle=o.color,e.beginPath(),e.moveTo(d,u),e.lineTo(h,f),e.stroke(),e.restore()}drawLabels(t){if(!this.options.ticks.display)return;const i=this.ctx,s=this._computeLabelArea();s&&wn(i,s);const o=this.getLabelItems(t);for(const a of o){const l=a.options,c=a.font,d=a.label,h=a.textOffset;be(i,d,0,h,c,l)}s&&Sn(i)}drawTitle(){const{ctx:t,options:{position:e,title:i,reverse:s}}=this;if(!i.display)return;const o=ft(i.font),a=_t(i.padding),l=i.align;let c=o.lineHeight/2;e==="bottom"||e==="center"||Q(e)?(c+=a.bottom,lt(i.text)&&(c+=o.lineHeight*(i.text.length-1))):c+=a.top;const{titleX:d,titleY:h,maxWidth:u,rotation:f}=Vl(this,c,e,l);be(t,i.text,0,0,o,{color:i.color,maxWidth:u,rotation:f,textAlign:Ol(l,e,s),textBaseline:"middle",translation:[d,h]})}draw(t){this._isVisible()&&(this.drawBackground(),this.drawGrid(t),this.drawBorder(),this.drawTitle(),this.drawLabels(t))}_layers(){const t=this.options,e=t.ticks&&t.ticks.z||0,i=U(t.grid&&t.grid.z,-1),s=U(t.border&&t.border.z,0);return!this._isVisible()||this.draw!==ne.prototype.draw?[{z:e,draw:o=>{this.draw(o)}}]:[{z:i,draw:o=>{this.drawBackground(),this.drawGrid(o),this.drawTitle()}},{z:s,draw:()=>{this.drawBorder()}},{z:e,draw:o=>{this.drawLabels(o)}}]}getMatchingVisibleMetas(t){const e=this.chart.getSortedVisibleDatasetMetas(),i=this.axis+"AxisID",s=[];let o,a;for(o=0,a=e.length;o<a;++o){const l=e[o];l[i]===this.id&&(!t||l.type===t)&&s.push(l)}return s}_resolveTickFontOptions(t){const e=this.options.ticks.setContext(this.getContext(t));return ft(e.font)}_maxDigits(){const t=this._resolveTickFontOptions(0).lineHeight;return(this.isHorizontal()?this.width:this.height)/t}}class Ye{constructor(t,e,i){this.type=t,this.scope=e,this.override=i,this.items=Object.create(null)}isForType(t){return Object.prototype.isPrototypeOf.call(this.type.prototype,t.prototype)}register(t){const e=Object.getPrototypeOf(t);let i;Rl(e)&&(i=this.register(e));const s=this.items,o=t.id,a=this.scope+"."+o;if(!o)throw new Error("class does not have id: "+t);return o in s||(s[o]=t,Ll(t,a,i),this.override&&rt.override(t.id,t.overrides)),a}get(t){return this.items[t]}unregister(t){const e=this.items,i=t.id,s=this.scope;i in e&&delete e[i],s&&i in rt[s]&&(delete rt[s][i],this.override&&delete $t[i])}}function Ll(n,t,e){const i=ce(Object.create(null),[e?rt.get(e):{},rt.get(t),n.defaults]);rt.set(t,i),n.defaultRoutes&&zl(t,n.defaultRoutes),n.descriptors&&rt.describe(t,n.descriptors)}function zl(n,t){Object.keys(t).forEach(e=>{const i=e.split("."),s=i.pop(),o=[n].concat(i).join("."),a=t[e].split("."),l=a.pop(),c=a.join(".");rt.route(o,s,c,l)})}function Rl(n){return"id"in n&&"defaults"in n}class Il{constructor(){this.controllers=new Ye(_e,"datasets",!0),this.elements=new Ye(At,"elements"),this.plugins=new Ye(Object,"plugins"),this.scales=new Ye(ne,"scales"),this._typedRegistries=[this.controllers,this.scales,this.elements]}add(...t){this._each("register",t)}remove(...t){this._each("unregister",t)}addControllers(...t){this._each("register",t,this.controllers)}addElements(...t){this._each("register",t,this.elements)}addPlugins(...t){this._each("register",t,this.plugins)}addScales(...t){this._each("register",t,this.scales)}getController(t){return this._get(t,this.controllers,"controller")}getElement(t){return this._get(t,this.elements,"element")}getPlugin(t){return this._get(t,this.plugins,"plugin")}getScale(t){return this._get(t,this.scales,"scale")}removeControllers(...t){this._each("unregister",t,this.controllers)}removeElements(...t){this._each("unregister",t,this.elements)}removePlugins(...t){this._each("unregister",t,this.plugins)}removeScales(...t){this._each("unregister",t,this.scales)}_each(t,e,i){[...e].forEach(s=>{const o=i||this._getRegistryForType(s);i||o.isForType(s)||o===this.plugins&&s.id?this._exec(t,o,s):et(s,a=>{const l=i||this._getRegistryForType(a);this._exec(t,l,a)})})}_exec(t,e,i){const s=un(t);st(i["before"+s],[],i),e[t](i),st(i["after"+s],[],i)}_getRegistryForType(t){for(let e=0;e<this._typedRegistries.length;e++){const i=this._typedRegistries[e];if(i.isForType(t))return i}return this.plugins}_get(t,e,i){const s=e.get(t);if(s===void 0)throw new Error('"'+t+'" is not a registered '+i+".");return s}}var Ct=new Il;class Fl{constructor(){this._init=[]}notify(t,e,i,s){e==="beforeInit"&&(this._init=this._createDescriptors(t,!0),this._notify(this._init,t,"install"));const o=s?this._descriptors(t).filter(s):this._descriptors(t),a=this._notify(o,t,e,i);return e==="afterDestroy"&&(this._notify(o,t,"stop"),this._notify(this._init,t,"uninstall")),a}_notify(t,e,i,s){s=s||{};for(const o of t){const a=o.plugin,l=a[i],c=[e,s,o.options];if(st(l,c,a)===!1&&s.cancelable)return!1}return!0}invalidate(){tt(this._cache)||(this._oldCache=this._cache,this._cache=void 0)}_descriptors(t){if(this._cache)return this._cache;const e=this._cache=this._createDescriptors(t);return this._notifyStateChanges(t),e}_createDescriptors(t,e){const i=t&&t.config,s=U(i.options&&i.options.plugins,{}),o=$l(i);return s===!1&&!e?[]:Hl(t,o,s,e)}_notifyStateChanges(t){const e=this._oldCache||[],i=this._cache,s=(o,a)=>o.filter(l=>!a.some(c=>l.plugin.id===c.plugin.id));this._notify(s(e,i),t,"stop"),this._notify(s(i,e),t,"start")}}function $l(n){const t={},e=[],i=Object.keys(Ct.plugins.items);for(let o=0;o<i.length;o++)e.push(Ct.getPlugin(i[o]));const s=n.plugins||[];for(let o=0;o<s.length;o++){const a=s[o];e.indexOf(a)===-1&&(e.push(a),t[a.id]=!0)}return{plugins:e,localIds:t}}function Wl(n,t){return!t&&n===!1?null:n===!0?{}:n}function Hl(n,{plugins:t,localIds:e},i,s){const o=[],a=n.getContext();for(const l of t){const c=l.id,d=Wl(i[c],s);d!==null&&o.push({plugin:l,options:jl(n.config,{plugin:l,local:e[c]},d,a)})}return o}function jl(n,{plugin:t,local:e},i,s){const o=n.pluginScopeKeys(t),a=n.getOptionScopes(i,o);return e&&t.defaults&&a.push(t.defaults),n.createResolver(a,s,[""],{scriptable:!1,indexable:!1,allKeys:!0})}function Rn(n,t){const e=rt.datasets[n]||{};return((t.datasets||{})[n]||{}).indexAxis||t.indexAxis||e.indexAxis||"x"}function ql(n,t){let e=n;return n==="_index_"?e=t:n==="_value_"&&(e=t==="x"?"y":"x"),e}function Yl(n,t){return n===t?"_index_":"_value_"}function Cs(n){if(n==="x"||n==="y"||n==="r")return n}function Ul(n){if(n==="top"||n==="bottom")return"x";if(n==="left"||n==="right")return"y"}function In(n,...t){if(Cs(n))return n;for(const e of t){const i=e.axis||Ul(e.position)||n.length>1&&Cs(n[0].toLowerCase());if(i)return i}throw new Error(`Cannot determine type of '${n}' axis. Please provide 'axis' or 'position' option.`)}function Es(n,t,e){if(e[t+"AxisID"]===n)return{axis:t}}function Xl(n,t){if(t.data&&t.data.datasets){const e=t.data.datasets.filter(i=>i.xAxisID===n||i.yAxisID===n);if(e.length)return Es(n,"x",e[0])||Es(n,"y",e[0])}return{}}function Kl(n,t){const e=$t[n.type]||{scales:{}},i=t.scales||{},s=Rn(n.type,t),o=Object.create(null);return Object.keys(i).forEach(a=>{const l=i[a];if(!Q(l))return console.error(`Invalid scale configuration for scale: ${a}`);if(l._proxy)return console.warn(`Ignoring resolver passed as options for scale: ${a}`);const c=In(a,l,Xl(a,n),rt.scales[l.type]),d=Yl(c,s),h=e.scales||{};o[a]=de(Object.create(null),[{axis:c},l,h[c],h[d]])}),n.data.datasets.forEach(a=>{const l=a.type||n.type,c=a.indexAxis||Rn(l,t),h=($t[l]||{}).scales||{};Object.keys(h).forEach(u=>{const f=ql(u,c),p=a[f+"AxisID"]||f;o[p]=o[p]||Object.create(null),de(o[p],[{axis:f},i[p],h[u]])})}),Object.keys(o).forEach(a=>{const l=o[a];de(l,[rt.scales[l.type],rt.scale])}),o}function Ms(n){const t=n.options||(n.options={});t.plugins=U(t.plugins,{}),t.scales=Kl(n,t)}function vs(n){return n=n||{},n.datasets=n.datasets||[],n.labels=n.labels||[],n}function Gl(n){return n=n||{},n.data=vs(n.data),Ms(n),n}const Bs=new Map,Ds=new Set;function Ue(n,t){let e=Bs.get(n);return e||(e=t(),Bs.set(n,e),Ds.add(e)),e}const Ee=(n,t,e)=>{const i=Rt(t,e);i!==void 0&&n.add(i)};class Ql{constructor(t){this._config=Gl(t),this._scopeCache=new Map,this._resolverCache=new Map}get platform(){return this._config.platform}get type(){return this._config.type}set type(t){this._config.type=t}get data(){return this._config.data}set data(t){this._config.data=vs(t)}get options(){return this._config.options}set options(t){this._config.options=t}get plugins(){return this._config.plugins}update(){const t=this._config;this.clearCache(),Ms(t)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(t){return Ue(t,()=>[[`datasets.${t}`,""]])}datasetAnimationScopeKeys(t,e){return Ue(`${t}.transition.${e}`,()=>[[`datasets.${t}.transitions.${e}`,`transitions.${e}`],[`datasets.${t}`,""]])}datasetElementScopeKeys(t,e){return Ue(`${t}-${e}`,()=>[[`datasets.${t}.elements.${e}`,`datasets.${t}`,`elements.${e}`,""]])}pluginScopeKeys(t){const e=t.id,i=this.type;return Ue(`${i}-plugin-${e}`,()=>[[`plugins.${e}`,...t.additionalOptionScopes||[]]])}_cachedScopes(t,e){const i=this._scopeCache;let s=i.get(t);return(!s||e)&&(s=new Map,i.set(t,s)),s}getOptionScopes(t,e,i){const{options:s,type:o}=this,a=this._cachedScopes(t,i),l=a.get(e);if(l)return l;const c=new Set;e.forEach(h=>{t&&(c.add(t),h.forEach(u=>Ee(c,t,u))),h.forEach(u=>Ee(c,s,u)),h.forEach(u=>Ee(c,$t[o]||{},u)),h.forEach(u=>Ee(c,rt,u)),h.forEach(u=>Ee(c,_n,u))});const d=Array.from(c);return d.length===0&&d.push(Object.create(null)),Ds.has(e)&&a.set(e,d),d}chartOptionScopes(){const{options:t,type:e}=this;return[t,$t[e]||{},rt.datasets[e]||{},{type:e},rt,_n]}resolveNamedOptions(t,e,i,s=[""]){const o={$shared:!0},{resolver:a,subPrefixes:l}=As(this._resolverCache,t,s);let c=a;if(Zl(a,e)){o.$shared=!1,i=Ot(i)?i():i;const d=this.createResolver(t,i,l);c=Zt(a,i,d)}for(const d of e)o[d]=c[d];return o}createResolver(t,e,i=[""],s){const{resolver:o}=As(this._resolverCache,t,i);return Q(e)?Zt(o,e,void 0,s):o}}function As(n,t,e){let i=n.get(t);i||(i=new Map,n.set(t,i));const s=e.join();let o=i.get(s);return o||(o={resolver:En(t,e),subPrefixes:e.filter(l=>!l.toLowerCase().includes("hover"))},i.set(s,o)),o}const Jl=n=>Q(n)&&Object.getOwnPropertyNames(n).some(t=>Ot(n[t]));function Zl(n,t){const{isScriptable:e,isIndexable:i}=Li(n);for(const s of t){const o=e(s),a=i(s),l=(a||o)&&n[s];if(o&&(Ot(l)||Jl(l))||a&<(l))return!0}return!1}var tc="4.5.0";const ec=["top","bottom","left","right","chartArea"];function Ts(n,t){return n==="top"||n==="bottom"||ec.indexOf(n)===-1&&t==="x"}function Ps(n,t){return function(e,i){return e[n]===i[n]?e[t]-i[t]:e[n]-i[n]}}function Ns(n){const t=n.chart,e=t.options.animation;t.notifyPlugins("afterRender"),st(e&&e.onComplete,[n],t)}function nc(n){const t=n.chart,e=t.options.animation;st(e&&e.onProgress,[n],t)}function Os(n){return Bn()&&typeof n=="string"?n=document.getElementById(n):n&&n.length&&(n=n[0]),n&&n.canvas&&(n=n.canvas),n}const Xe={},Vs=n=>{const t=Os(n);return Object.values(Xe).filter(e=>e.canvas===t).pop()};function ic(n,t,e){const i=Object.keys(n);for(const s of i){const o=+s;if(o>=t){const a=n[s];delete n[s],(e>0||o>t)&&(n[o+e]=a)}}}function sc(n,t,e,i){return!e||n.type==="mouseout"?null:i?t:n}let Fn=class{static defaults=rt;static instances=Xe;static overrides=$t;static registry=Ct;static version=tc;static getChart=Vs;static register(...t){Ct.add(...t),Ls()}static unregister(...t){Ct.remove(...t),Ls()}constructor(t,e){const i=this.config=new Ql(e),s=Os(t),o=Vs(s);if(o)throw new Error("Canvas is already in use. Chart with ID '"+o.id+"' must be destroyed before the canvas with ID '"+o.canvas.id+"' can be reused.");const a=i.createResolver(i.chartOptionScopes(),this.getContext());this.platform=new(i.platform||wl(s)),this.platform.updateConfig(i);const l=this.platform.acquireContext(s,a.aspectRatio),c=l&&l.canvas,d=c&&c.height,h=c&&c.width;if(this.id=Go(),this.ctx=l,this.canvas=c,this.width=h,this.height=d,this._options=a,this._aspectRatio=this.aspectRatio,this._layers=[],this._metasets=[],this._stacks=void 0,this.boxes=[],this.currentDevicePixelRatio=void 0,this.chartArea=void 0,this._active=[],this._lastEvent=void 0,this._listeners={},this._responsiveListeners=void 0,this._sortedMetasets=[],this.scales={},this._plugins=new Fl,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=ma(u=>this.update(u),a.resizeDelay||0),this._dataChanges=[],Xe[this.id]=this,!l||!c){console.error("Failed to create chart: can't acquire context from the given item");return}Dt.listen(this,"complete",Ns),Dt.listen(this,"progress",nc),this._initialize(),this.attached&&this.update()}get aspectRatio(){const{options:{aspectRatio:t,maintainAspectRatio:e},width:i,height:s,_aspectRatio:o}=this;return tt(t)?e&&o?o:s?i/s:null:t}get data(){return this.config.data}set data(t){this.config.data=t}get options(){return this._options}set options(t){this.config.options=t}get registry(){return Ct}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():Hi(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return Ni(this.canvas,this.ctx),this}stop(){return Dt.stop(this),this}resize(t,e){Dt.running(this)?this._resizeBeforeDraw={width:t,height:e}:this._resize(t,e)}_resize(t,e){const i=this.options,s=this.canvas,o=i.maintainAspectRatio&&this.aspectRatio,a=this.platform.getMaximumSize(s,t,e,o),l=i.devicePixelRatio||this.platform.getDevicePixelRatio(),c=this.width?"resize":"attach";this.width=a.width,this.height=a.height,this._aspectRatio=this.aspectRatio,Hi(this,l,!0)&&(this.notifyPlugins("resize",{size:a}),st(i.onResize,[this,a],this),this.attached&&this._doResize(c)&&this.render())}ensureScalesHaveIDs(){const e=this.options.scales||{};et(e,(i,s)=>{i.id=s})}buildOrUpdateScales(){const t=this.options,e=t.scales,i=this.scales,s=Object.keys(i).reduce((a,l)=>(a[l]=!1,a),{});let o=[];e&&(o=o.concat(Object.keys(e).map(a=>{const l=e[a],c=In(a,l),d=c==="r",h=c==="x";return{options:l,dposition:d?"chartArea":h?"bottom":"left",dtype:d?"radialLinear":h?"category":"linear"}}))),et(o,a=>{const l=a.options,c=l.id,d=In(c,l),h=U(l.type,a.dtype);(l.position===void 0||Ts(l.position,d)!==Ts(a.dposition))&&(l.position=a.dposition),s[c]=!0;let u=null;if(c in i&&i[c].type===h)u=i[c];else{const f=Ct.getScale(h);u=new f({id:c,type:h,ctx:this.ctx,chart:this}),i[u.id]=u}u.init(l,t)}),et(s,(a,l)=>{a||delete i[l]}),et(i,a=>{kt.configure(this,a,a.options),kt.addBox(this,a)})}_updateMetasets(){const t=this._metasets,e=this.data.datasets.length,i=t.length;if(t.sort((s,o)=>s.index-o.index),i>e){for(let s=e;s<i;++s)this._destroyDatasetMeta(s);t.splice(e,i-e)}this._sortedMetasets=t.slice(0).sort(Ps("order","index"))}_removeUnreferencedMetasets(){const{_metasets:t,data:{datasets:e}}=this;t.length>e.length&&delete this._stacks,t.forEach((i,s)=>{e.filter(o=>o===i._dataset).length===0&&this._destroyDatasetMeta(s)})}buildOrUpdateControllers(){const t=[],e=this.data.datasets;let i,s;for(this._removeUnreferencedMetasets(),i=0,s=e.length;i<s;i++){const o=e[i];let a=this.getDatasetMeta(i);const l=o.type||this.config.type;if(a.type&&a.type!==l&&(this._destroyDatasetMeta(i),a=this.getDatasetMeta(i)),a.type=l,a.indexAxis=o.indexAxis||Rn(l,this.options),a.order=o.order||0,a.index=i,a.label=""+o.label,a.visible=this.isDatasetVisible(i),a.controller)a.controller.updateIndex(i),a.controller.linkScales();else{const c=Ct.getController(l),{datasetElementType:d,dataElementType:h}=rt.datasets[l];Object.assign(c,{dataElementType:Ct.getElement(h),datasetElementType:d&&Ct.getElement(d)}),a.controller=new c(this,i),t.push(a.controller)}}return this._updateMetasets(),t}_resetElements(){et(this.data.datasets,(t,e)=>{this.getDatasetMeta(e).controller.reset()},this)}reset(){this._resetElements(),this.notifyPlugins("reset")}update(t){const e=this.config;e.update();const i=this._options=e.createResolver(e.chartOptionScopes(),this.getContext()),s=this._animationsDisabled=!i.animation;if(this._updateScales(),this._checkEventBindings(),this._updateHiddenIndices(),this._plugins.invalidate(),this.notifyPlugins("beforeUpdate",{mode:t,cancelable:!0})===!1)return;const o=this.buildOrUpdateControllers();this.notifyPlugins("beforeElementsUpdate");let a=0;for(let d=0,h=this.data.datasets.length;d<h;d++){const{controller:u}=this.getDatasetMeta(d),f=!s&&o.indexOf(u)===-1;u.buildOrUpdateElements(f),a=Math.max(+u.getMaxOverflow(),a)}a=this._minPadding=i.layout.autoPadding?a:0,this._updateLayout(a),s||et(o,d=>{d.reset()}),this._updateDatasets(t),this.notifyPlugins("afterUpdate",{mode:t}),this._layers.sort(Ps("z","_idx"));const{_active:l,_lastEvent:c}=this;c?this._eventHandler(c,!0):l.length&&this._updateHoverStyles(l,l,!0),this.render()}_updateScales(){et(this.scales,t=>{kt.removeBox(this,t)}),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){const t=this.options,e=new Set(Object.keys(this._listeners)),i=new Set(t.events);(!pi(e,i)||!!this._responsiveListeners!==t.responsive)&&(this.unbindEvents(),this.bindEvents())}_updateHiddenIndices(){const{_hiddenIndices:t}=this,e=this._getUniformDataChanges()||[];for(const{method:i,start:s,count:o}of e){const a=i==="_removeElements"?-o:o;ic(t,s,a)}}_getUniformDataChanges(){const t=this._dataChanges;if(!t||!t.length)return;this._dataChanges=[];const e=this.data.datasets.length,i=o=>new Set(t.filter(a=>a[0]===o).map((a,l)=>l+","+a.splice(1).join(","))),s=i(0);for(let o=1;o<e;o++)if(!pi(s,i(o)))return;return Array.from(s).map(o=>o.split(",")).map(o=>({method:o[1],start:+o[2],count:+o[3]}))}_updateLayout(t){if(this.notifyPlugins("beforeLayout",{cancelable:!0})===!1)return;kt.update(this,this.width,this.height,t);const e=this.chartArea,i=e.width<=0||e.height<=0;this._layers=[],et(this.boxes,s=>{i&&s.position==="chartArea"||(s.configure&&s.configure(),this._layers.push(...s._layers()))},this),this._layers.forEach((s,o)=>{s._idx=o}),this.notifyPlugins("afterLayout")}_updateDatasets(t){if(this.notifyPlugins("beforeDatasetsUpdate",{mode:t,cancelable:!0})!==!1){for(let e=0,i=this.data.datasets.length;e<i;++e)this.getDatasetMeta(e).controller.configure();for(let e=0,i=this.data.datasets.length;e<i;++e)this._updateDataset(e,Ot(t)?t({datasetIndex:e}):t);this.notifyPlugins("afterDatasetsUpdate",{mode:t})}}_updateDataset(t,e){const i=this.getDatasetMeta(t),s={meta:i,index:t,mode:e,cancelable:!0};this.notifyPlugins("beforeDatasetUpdate",s)!==!1&&(i.controller._update(e),s.cancelable=!1,this.notifyPlugins("afterDatasetUpdate",s))}render(){this.notifyPlugins("beforeRender",{cancelable:!0})!==!1&&(Dt.has(this)?this.attached&&!Dt.running(this)&&Dt.start(this):(this.draw(),Ns({chart:this})))}draw(){let t;if(this._resizeBeforeDraw){const{width:i,height:s}=this._resizeBeforeDraw;this._resizeBeforeDraw=null,this._resize(i,s)}if(this.clear(),this.width<=0||this.height<=0||this.notifyPlugins("beforeDraw",{cancelable:!0})===!1)return;const e=this._layers;for(t=0;t<e.length&&e[t].z<=0;++t)e[t].draw(this.chartArea);for(this._drawDatasets();t<e.length;++t)e[t].draw(this.chartArea);this.notifyPlugins("afterDraw")}_getSortedDatasetMetas(t){const e=this._sortedMetasets,i=[];let s,o;for(s=0,o=e.length;s<o;++s){const a=e[s];(!t||a.visible)&&i.push(a)}return i}getSortedVisibleDatasetMetas(){return this._getSortedDatasetMetas(!0)}_drawDatasets(){if(this.notifyPlugins("beforeDatasetsDraw",{cancelable:!0})===!1)return;const t=this.getSortedVisibleDatasetMetas();for(let e=t.length-1;e>=0;--e)this._drawDataset(t[e]);this.notifyPlugins("afterDatasetsDraw")}_drawDataset(t){const e=this.ctx,i={meta:t,index:t.index,cancelable:!0},s=_r(this,t);this.notifyPlugins("beforeDatasetDraw",i)!==!1&&(s&&wn(e,s),t.controller.draw(),s&&Sn(e),i.cancelable=!1,this.notifyPlugins("afterDatasetDraw",i))}isPointInArea(t){return ge(t,this.chartArea,this._minPadding)}getElementsAtEventForMode(t,e,i,s){const o=el.modes[e];return typeof o=="function"?o(this,t,i,s):[]}getDatasetMeta(t){const e=this.data.datasets[t],i=this._metasets;let s=i.filter(o=>o&&o._dataset===e).pop();return s||(s={type:null,data:[],dataset:null,controller:null,hidden:null,xAxisID:null,yAxisID:null,order:e&&e.order||0,index:t,_dataset:e,_parsed:[],_sorted:!1},i.push(s)),s}getContext(){return this.$context||(this.$context=Ht(null,{chart:this,type:"chart"}))}getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(t){const e=this.data.datasets[t];if(!e)return!1;const i=this.getDatasetMeta(t);return typeof i.hidden=="boolean"?!i.hidden:!e.hidden}setDatasetVisibility(t,e){const i=this.getDatasetMeta(t);i.hidden=!e}toggleDataVisibility(t){this._hiddenIndices[t]=!this._hiddenIndices[t]}getDataVisibility(t){return!this._hiddenIndices[t]}_updateVisibility(t,e,i){const s=i?"show":"hide",o=this.getDatasetMeta(t),a=o.controller._resolveAnimations(void 0,s);he(e)?(o.data[e].hidden=!i,this.update()):(this.setDatasetVisibility(t,i),a.update(o,{visible:i}),this.update(l=>l.datasetIndex===t?s:void 0))}hide(t,e){this._updateVisibility(t,e,!1)}show(t,e){this._updateVisibility(t,e,!0)}_destroyDatasetMeta(t){const e=this._metasets[t];e&&e.controller&&e.controller._destroy(),delete this._metasets[t]}_stop(){let t,e;for(this.stop(),Dt.remove(this),t=0,e=this.data.datasets.length;t<e;++t)this._destroyDatasetMeta(t)}destroy(){this.notifyPlugins("beforeDestroy");const{canvas:t,ctx:e}=this;this._stop(),this.config.clearCache(),t&&(this.unbindEvents(),Ni(t,e),this.platform.releaseContext(e),this.canvas=null,this.ctx=null),delete Xe[this.id],this.notifyPlugins("afterDestroy")}toBase64Image(...t){return this.canvas.toDataURL(...t)}bindEvents(){this.bindUserEvents(),this.options.responsive?this.bindResponsiveEvents():this.attached=!0}bindUserEvents(){const t=this._listeners,e=this.platform,i=(o,a)=>{e.addEventListener(this,o,a),t[o]=a},s=(o,a,l)=>{o.offsetX=a,o.offsetY=l,this._eventHandler(o)};et(this.options.events,o=>i(o,s))}bindResponsiveEvents(){this._responsiveListeners||(this._responsiveListeners={});const t=this._responsiveListeners,e=this.platform,i=(c,d)=>{e.addEventListener(this,c,d),t[c]=d},s=(c,d)=>{t[c]&&(e.removeEventListener(this,c,d),delete t[c])},o=(c,d)=>{this.canvas&&this.resize(c,d)};let a;const l=()=>{s("attach",l),this.attached=!0,this.resize(),i("resize",o),i("detach",a)};a=()=>{this.attached=!1,s("resize",o),this._stop(),this._resize(0,0),i("attach",l)},e.isAttached(this.canvas)?l():a()}unbindEvents(){et(this._listeners,(t,e)=>{this.platform.removeEventListener(this,e,t)}),this._listeners={},et(this._responsiveListeners,(t,e)=>{this.platform.removeEventListener(this,e,t)}),this._responsiveListeners=void 0}updateHoverStyle(t,e,i){const s=i?"set":"remove";let o,a,l,c;for(e==="dataset"&&(o=this.getDatasetMeta(t[0].datasetIndex),o.controller["_"+s+"DatasetHoverStyle"]()),l=0,c=t.length;l<c;++l){a=t[l];const d=a&&this.getDatasetMeta(a.datasetIndex).controller;d&&d[s+"HoverStyle"](a.element,a.datasetIndex,a.index)}}getActiveElements(){return this._active||[]}setActiveElements(t){const e=this._active||[],i=t.map(({datasetIndex:o,index:a})=>{const l=this.getDatasetMeta(o);if(!l)throw new Error("No dataset found at index "+o);return{datasetIndex:o,element:l.data[a],index:a}});!Ae(i,e)&&(this._active=i,this._lastEvent=null,this._updateHoverStyles(i,e))}notifyPlugins(t,e,i){return this._plugins.notify(this,t,e,i)}isPluginEnabled(t){return this._plugins._cache.filter(e=>e.plugin.id===t).length===1}_updateHoverStyles(t,e,i){const s=this.options.hover,o=(c,d)=>c.filter(h=>!d.some(u=>h.datasetIndex===u.datasetIndex&&h.index===u.index)),a=o(e,t),l=i?t:o(t,e);a.length&&this.updateHoverStyle(a,s.mode,!1),l.length&&s.mode&&this.updateHoverStyle(l,s.mode,!0)}_eventHandler(t,e){const i={event:t,replay:e,cancelable:!0,inChartArea:this.isPointInArea(t)},s=a=>(a.options.events||this.options.events).includes(t.native.type);if(this.notifyPlugins("beforeEvent",i,s)===!1)return;const o=this._handleEvent(t,e,i.inChartArea);return i.cancelable=!1,this.notifyPlugins("afterEvent",i,s),(o||i.changed)&&this.render(),this}_handleEvent(t,e,i){const{_active:s=[],options:o}=this,a=e,l=this._getActiveElements(t,s,i,a),c=na(t),d=sc(t,this._lastEvent,i,c);i&&(this._lastEvent=null,st(o.onHover,[t,l,this],this),c&&st(o.onClick,[t,l,this],this));const h=!Ae(l,s);return(h||e)&&(this._active=l,this._updateHoverStyles(l,s,e)),this._lastEvent=d,h}_getActiveElements(t,e,i,s){if(t.type==="mouseout")return[];if(!i)return e;const o=this.options.hover;return this.getElementsAtEventForMode(t,o.mode,o,s)}};function Ls(){return et(Fn.instances,n=>n._plugins.invalidate())}function oc(n,t,e){const{startAngle:i,x:s,y:o,outerRadius:a,innerRadius:l,options:c}=t,{borderWidth:d,borderJoinStyle:h}=c,u=Math.min(d/a,xt(i-e));if(n.beginPath(),n.arc(s,o,a-d/2,i+u/2,e-u/2),l>0){const f=Math.min(d/l,xt(i-e));n.arc(s,o,l+d/2,e-f/2,i+f/2,!0)}else{const f=Math.min(d/2,a*xt(i-e));if(h==="round")n.arc(s,o,f,e-nt/2,i+nt/2,!0);else if(h==="bevel"){const p=2*f*f,g=-p*Math.cos(e+nt/2)+s,b=-p*Math.sin(e+nt/2)+o,m=p*Math.cos(i+nt/2)+s,_=p*Math.sin(i+nt/2)+o;n.lineTo(g,b),n.lineTo(m,_)}}n.closePath(),n.moveTo(0,0),n.rect(0,0,n.canvas.width,n.canvas.height),n.clip("evenodd")}function ac(n,t,e){const{startAngle:i,pixelMargin:s,x:o,y:a,outerRadius:l,innerRadius:c}=t;let d=s/l;n.beginPath(),n.arc(o,a,l,i-d,e+d),c>s?(d=s/c,n.arc(o,a,c,e+d,i-d,!0)):n.arc(o,a,s,e+ct,i-ct),n.closePath(),n.clip()}function rc(n){return Cn(n,["outerStart","outerEnd","innerStart","innerEnd"])}function lc(n,t,e,i){const s=rc(n.options.borderRadius),o=(e-t)/2,a=Math.min(o,i*t/2),l=c=>{const d=(e-Math.min(o,c))*i/2;return ht(c,0,Math.min(o,d))};return{outerStart:l(s.outerStart),outerEnd:l(s.outerEnd),innerStart:ht(s.innerStart,0,a),innerEnd:ht(s.innerEnd,0,a)}}function ie(n,t,e,i){return{x:e+n*Math.cos(t),y:i+n*Math.sin(t)}}function Ke(n,t,e,i,s,o){const{x:a,y:l,startAngle:c,pixelMargin:d,innerRadius:h}=t,u=Math.max(t.outerRadius+i+e-d,0),f=h>0?h+i+e+d:0;let p=0;const g=s-c;if(i){const q=h>0?h-i:0,Y=u>0?u-i:0,G=(q+Y)/2,ot=G!==0?g*G/(G+i):g;p=(g-ot)/2}const b=Math.max(.001,g*u-e/nt)/u,m=(g-b)/2,_=c+m+p,y=s-m-p,{outerStart:k,outerEnd:x,innerStart:S,innerEnd:N}=lc(t,f,u,y-_),V=u-k,L=u-x,C=_+k/V,T=y-x/L,P=f+S,O=f+N,F=_+S/P,H=y-N/O;if(n.beginPath(),o){const q=(C+T)/2;if(n.arc(a,l,u,C,q),n.arc(a,l,u,q,T),x>0){const E=ie(L,T,a,l);n.arc(E.x,E.y,x,T,y+ct)}const Y=ie(O,y,a,l);if(n.lineTo(Y.x,Y.y),N>0){const E=ie(O,H,a,l);n.arc(E.x,E.y,N,y+ct,H+Math.PI)}const G=(y-N/f+(_+S/f))/2;if(n.arc(a,l,f,y-N/f,G,!0),n.arc(a,l,f,G,_+S/f,!0),S>0){const E=ie(P,F,a,l);n.arc(E.x,E.y,S,F+Math.PI,_-ct)}const ot=ie(V,_,a,l);if(n.lineTo(ot.x,ot.y),k>0){const E=ie(V,C,a,l);n.arc(E.x,E.y,k,_-ct,C)}}else{n.moveTo(a,l);const q=Math.cos(C)*u+a,Y=Math.sin(C)*u+l;n.lineTo(q,Y);const G=Math.cos(T)*u+a,ot=Math.sin(T)*u+l;n.lineTo(G,ot)}n.closePath()}function cc(n,t,e,i,s){const{fullCircles:o,startAngle:a,circumference:l}=t;let c=t.endAngle;if(o){Ke(n,t,e,i,c,s);for(let d=0;d<o;++d)n.fill();isNaN(l)||(c=a+(l%at||at))}return Ke(n,t,e,i,c,s),n.fill(),c}function dc(n,t,e,i,s){const{fullCircles:o,startAngle:a,circumference:l,options:c}=t,{borderWidth:d,borderJoinStyle:h,borderDash:u,borderDashOffset:f,borderRadius:p}=c,g=c.borderAlign==="inner";if(!d)return;n.setLineDash(u||[]),n.lineDashOffset=f,g?(n.lineWidth=d*2,n.lineJoin=h||"round"):(n.lineWidth=d,n.lineJoin=h||"bevel");let b=t.endAngle;if(o){Ke(n,t,e,i,b,s);for(let m=0;m<o;++m)n.stroke();isNaN(l)||(b=a+(l%at||at))}g&&ac(n,t,b),c.selfJoin&&b-a>=nt&&p===0&&h!=="miter"&&oc(n,t,b),o||(Ke(n,t,e,i,b,s),n.stroke())}class hc extends At{static id="arc";static defaults={borderAlign:"center",borderColor:"#fff",borderDash:[],borderDashOffset:0,borderJoinStyle:void 0,borderRadius:0,borderWidth:2,offset:0,spacing:0,angle:void 0,circular:!0,selfJoin:!1};static defaultRoutes={backgroundColor:"backgroundColor"};static descriptors={_scriptable:!0,_indexable:t=>t!=="borderDash"};circumference;endAngle;fullCircles;innerRadius;outerRadius;pixelMargin;startAngle;constructor(t){super(),this.options=void 0,this.circumference=void 0,this.startAngle=void 0,this.endAngle=void 0,this.innerRadius=void 0,this.outerRadius=void 0,this.pixelMargin=0,this.fullCircles=0,t&&Object.assign(this,t)}inRange(t,e,i){const s=this.getProps(["x","y"],i),{angle:o,distance:a}=_i(s,{x:t,y:e}),{startAngle:l,endAngle:c,innerRadius:d,outerRadius:h,circumference:u}=this.getProps(["startAngle","endAngle","innerRadius","outerRadius","circumference"],i),f=(this.options.spacing+this.options.borderWidth)/2,p=U(u,c-l),g=fe(o,l,c)&&l!==c,b=p>=at||g,m=Vt(a,d+f,h+f);return b&&m}getCenterPoint(t){const{x:e,y:i,startAngle:s,endAngle:o,innerRadius:a,outerRadius:l}=this.getProps(["x","y","startAngle","endAngle","innerRadius","outerRadius"],t),{offset:c,spacing:d}=this.options,h=(s+o)/2,u=(a+l+d+c)/2;return{x:e+Math.cos(h)*u,y:i+Math.sin(h)*u}}tooltipPosition(t){return this.getCenterPoint(t)}draw(t){const{options:e,circumference:i}=this,s=(e.offset||0)/4,o=(e.spacing||0)/2,a=e.circular;if(this.pixelMargin=e.borderAlign==="inner"?.33:0,this.fullCircles=i>at?Math.floor(i/at):0,i===0||this.innerRadius<0||this.outerRadius<0)return;t.save();const l=(this.startAngle+this.endAngle)/2;t.translate(Math.cos(l)*s,Math.sin(l)*s);const c=1-Math.sin(Math.min(nt,i||0)),d=s*c;t.fillStyle=e.backgroundColor,t.strokeStyle=e.borderColor,cc(t,this,d,o,a),dc(t,this,d,o,a),t.restore()}}function zs(n,t,e=t){n.lineCap=U(e.borderCapStyle,t.borderCapStyle),n.setLineDash(U(e.borderDash,t.borderDash)),n.lineDashOffset=U(e.borderDashOffset,t.borderDashOffset),n.lineJoin=U(e.borderJoinStyle,t.borderJoinStyle),n.lineWidth=U(e.borderWidth,t.borderWidth),n.strokeStyle=U(e.borderColor,t.borderColor)}function uc(n,t,e){n.lineTo(e.x,e.y)}function fc(n){return n.stepped?va:n.tension||n.cubicInterpolationMode==="monotone"?Ba:uc}function Rs(n,t,e={}){const i=n.length,{start:s=0,end:o=i-1}=e,{start:a,end:l}=t,c=Math.max(s,a),d=Math.min(o,l),h=s<a&&o<a||s>l&&o>l;return{count:i,start:c,loop:t.loop,ilen:d<c&&!h?i+d-c:d-c}}function pc(n,t,e,i){const{points:s,options:o}=t,{count:a,start:l,loop:c,ilen:d}=Rs(s,e,i),h=fc(o);let{move:u=!0,reverse:f}=i||{},p,g,b;for(p=0;p<=d;++p)g=s[(l+(f?d-p:p))%a],!g.skip&&(u?(n.moveTo(g.x,g.y),u=!1):h(n,b,g,f,o.stepped),b=g);return c&&(g=s[(l+(f?d:0))%a],h(n,b,g,f,o.stepped)),!!c}function mc(n,t,e,i){const s=t.points,{count:o,start:a,ilen:l}=Rs(s,e,i),{move:c=!0,reverse:d}=i||{};let h=0,u=0,f,p,g,b,m,_;const y=x=>(a+(d?l-x:x))%o,k=()=>{b!==m&&(n.lineTo(h,m),n.lineTo(h,b),n.lineTo(h,_))};for(c&&(p=s[y(0)],n.moveTo(p.x,p.y)),f=0;f<=l;++f){if(p=s[y(f)],p.skip)continue;const x=p.x,S=p.y,N=x|0;N===g?(S<b?b=S:S>m&&(m=S),h=(u*h+x)/++u):(k(),n.lineTo(x,S),g=N,u=0,b=m=S),_=S}k()}function $n(n){const t=n.options,e=t.borderDash&&t.borderDash.length;return!n._decimated&&!n._loop&&!t.tension&&t.cubicInterpolationMode!=="monotone"&&!t.stepped&&!e?mc:pc}function gc(n){return n.stepped?ar:n.tension||n.cubicInterpolationMode==="monotone"?rr:Yt}function bc(n,t,e,i){let s=t._path;s||(s=t._path=new Path2D,t.path(s,e,i)&&s.closePath()),zs(n,t.options),n.stroke(s)}function yc(n,t,e,i){const{segments:s,options:o}=t,a=$n(t);for(const l of s)zs(n,o,l.style),n.beginPath(),a(n,t,l,{start:e,end:e+i-1})&&n.closePath(),n.stroke()}const _c=typeof Path2D=="function";function kc(n,t,e,i){_c&&!t.options.segment?bc(n,t,e,i):yc(n,t,e,i)}class xc extends At{static id="line";static defaults={borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderWidth:3,capBezierPoints:!0,cubicInterpolationMode:"default",fill:!1,spanGaps:!1,stepped:!1,tension:0};static defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};static descriptors={_scriptable:!0,_indexable:t=>t!=="borderDash"&&t!=="fill"};constructor(t){super(),this.animated=!0,this.options=void 0,this._chart=void 0,this._loop=void 0,this._fullLoop=void 0,this._path=void 0,this._points=void 0,this._segments=void 0,this._decimated=!1,this._pointsUpdated=!1,this._datasetIndex=void 0,t&&Object.assign(this,t)}updateControlPoints(t,e){const i=this.options;if((i.tension||i.cubicInterpolationMode==="monotone")&&!i.stepped&&!this._pointsUpdated){const s=i.spanGaps?this._loop:this._fullLoop;Ja(this._points,i,t,s,e),this._pointsUpdated=!0}}set points(t){this._points=t,delete this._segments,delete this._path,this._pointsUpdated=!1}get points(){return this._points}get segments(){return this._segments||(this._segments=mr(this,this.options.segment))}first(){const t=this.segments,e=this.points;return t.length&&e[t[0].start]}last(){const t=this.segments,e=this.points,i=t.length;return i&&e[t[i-1].end]}interpolate(t,e){const i=this.options,s=t[e],o=this.points,a=ur(this,{property:e,start:s,end:s});if(!a.length)return;const l=[],c=gc(i);let d,h;for(d=0,h=a.length;d<h;++d){const{start:u,end:f}=a[d],p=o[u],g=o[f];if(p===g){l.push(p);continue}const b=Math.abs((s-p[e])/(g[e]-p[e])),m=c(p,g,b,i.stepped);m[e]=t[e],l.push(m)}return l.length===1?l[0]:l}pathSegment(t,e,i){return $n(this)(t,this,e,i)}path(t,e,i){const s=this.segments,o=$n(this);let a=this._loop;e=e||0,i=i||this.points.length-e;for(const l of s)a&=o(t,this,l,{start:e,end:e+i-1});return!!a}draw(t,e,i,s){const o=this.options||{};(this.points||[]).length&&o.borderWidth&&(t.save(),kc(t,this,i,s),t.restore()),this.animated&&(this._pointsUpdated=!1,this._path=void 0)}}function Is(n,t,e,i){const s=n.options,{[e]:o}=n.getProps([e],i);return Math.abs(t-o)<s.radius+s.hitRadius}class wc extends At{static id="point";parsed;skip;stop;static defaults={borderWidth:1,hitRadius:1,hoverBorderWidth:1,hoverRadius:4,pointStyle:"circle",radius:3,rotation:0};static defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};constructor(t){super(),this.options=void 0,this.parsed=void 0,this.skip=void 0,this.stop=void 0,t&&Object.assign(this,t)}inRange(t,e,i){const s=this.options,{x:o,y:a}=this.getProps(["x","y"],i);return Math.pow(t-o,2)+Math.pow(e-a,2)<Math.pow(s.hitRadius+s.radius,2)}inXRange(t,e){return Is(this,t,"x",e)}inYRange(t,e){return Is(this,t,"y",e)}getCenterPoint(t){const{x:e,y:i}=this.getProps(["x","y"],t);return{x:e,y:i}}size(t){t=t||this.options||{};let e=t.radius||0;e=Math.max(e,e&&t.hoverRadius||0);const i=e&&t.borderWidth||0;return(e+i)*2}draw(t,e){const i=this.options;this.skip||i.radius<.1||!ge(this,e,this.size(i)/2)||(t.strokeStyle=i.borderColor,t.lineWidth=i.borderWidth,t.fillStyle=i.backgroundColor,xn(t,i,this.x,this.y))}getRange(){const t=this.options||{};return t.radius+t.hitRadius}}function Fs(n,t){const{x:e,y:i,base:s,width:o,height:a}=n.getProps(["x","y","base","width","height"],t);let l,c,d,h,u;return n.horizontal?(u=a/2,l=Math.min(e,s),c=Math.max(e,s),d=i-u,h=i+u):(u=o/2,l=e-u,c=e+u,d=Math.min(i,s),h=Math.max(i,s)),{left:l,top:d,right:c,bottom:h}}function Lt(n,t,e,i){return n?0:ht(t,e,i)}function Sc(n,t,e){const i=n.options.borderWidth,s=n.borderSkipped,o=Vi(i);return{t:Lt(s.top,o.top,0,e),r:Lt(s.right,o.right,0,t),b:Lt(s.bottom,o.bottom,0,e),l:Lt(s.left,o.left,0,t)}}function Cc(n,t,e){const{enableBorderRadius:i}=n.getProps(["enableBorderRadius"]),s=n.options.borderRadius,o=Jt(s),a=Math.min(t,e),l=n.borderSkipped,c=i||Q(s);return{topLeft:Lt(!c||l.top||l.left,o.topLeft,0,a),topRight:Lt(!c||l.top||l.right,o.topRight,0,a),bottomLeft:Lt(!c||l.bottom||l.left,o.bottomLeft,0,a),bottomRight:Lt(!c||l.bottom||l.right,o.bottomRight,0,a)}}function Ec(n){const t=Fs(n),e=t.right-t.left,i=t.bottom-t.top,s=Sc(n,e/2,i/2),o=Cc(n,e/2,i/2);return{outer:{x:t.left,y:t.top,w:e,h:i,radius:o},inner:{x:t.left+s.l,y:t.top+s.t,w:e-s.l-s.r,h:i-s.t-s.b,radius:{topLeft:Math.max(0,o.topLeft-Math.max(s.t,s.l)),topRight:Math.max(0,o.topRight-Math.max(s.t,s.r)),bottomLeft:Math.max(0,o.bottomLeft-Math.max(s.b,s.l)),bottomRight:Math.max(0,o.bottomRight-Math.max(s.b,s.r))}}}}function Wn(n,t,e,i){const s=t===null,o=e===null,l=n&&!(s&&o)&&Fs(n,i);return l&&(s||Vt(t,l.left,l.right))&&(o||Vt(e,l.top,l.bottom))}function Mc(n){return n.topLeft||n.topRight||n.bottomLeft||n.bottomRight}function vc(n,t){n.rect(t.x,t.y,t.w,t.h)}function Hn(n,t,e={}){const i=n.x!==e.x?-t:0,s=n.y!==e.y?-t:0,o=(n.x+n.w!==e.x+e.w?t:0)-i,a=(n.y+n.h!==e.y+e.h?t:0)-s;return{x:n.x+i,y:n.y+s,w:n.w+o,h:n.h+a,radius:n.radius}}class Bc extends At{static id="bar";static defaults={borderSkipped:"start",borderWidth:0,borderRadius:0,inflateAmount:"auto",pointStyle:void 0};static defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};constructor(t){super(),this.options=void 0,this.horizontal=void 0,this.base=void 0,this.width=void 0,this.height=void 0,this.inflateAmount=void 0,t&&Object.assign(this,t)}draw(t){const{inflateAmount:e,options:{borderColor:i,backgroundColor:s}}=this,{inner:o,outer:a}=Ec(this),l=Mc(a.radius)?Oe:vc;t.save(),(a.w!==o.w||a.h!==o.h)&&(t.beginPath(),l(t,Hn(a,e,o)),t.clip(),l(t,Hn(o,-e,a)),t.fillStyle=i,t.fill("evenodd")),t.beginPath(),l(t,Hn(o,e)),t.fillStyle=s,t.fill(),t.restore()}inRange(t,e,i){return Wn(this,t,e,i)}inXRange(t,e){return Wn(this,t,null,e)}inYRange(t,e){return Wn(this,null,t,e)}getCenterPoint(t){const{x:e,y:i,base:s,horizontal:o}=this.getProps(["x","y","base","horizontal"],t);return{x:o?(e+s)/2:e,y:o?i:(i+s)/2}}getRange(t){return t==="x"?this.width/2:this.height/2}}const $s=(n,t)=>{let{boxHeight:e=t,boxWidth:i=t}=n;return n.usePointStyle&&(e=Math.min(e,t),i=n.pointStyleWidth||Math.min(i,t)),{boxWidth:i,boxHeight:e,itemHeight:Math.max(t,e)}},Dc=(n,t)=>n!==null&&t!==null&&n.datasetIndex===t.datasetIndex&&n.index===t.index;class Ws extends At{constructor(t){super(),this._added=!1,this.legendHitBoxes=[],this._hoveredItem=null,this.doughnutMode=!1,this.chart=t.chart,this.options=t.options,this.ctx=t.ctx,this.legendItems=void 0,this.columnSizes=void 0,this.lineWidths=void 0,this.maxHeight=void 0,this.maxWidth=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.height=void 0,this.width=void 0,this._margins=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(t,e,i){this.maxWidth=t,this.maxHeight=e,this._margins=i,this.setDimensions(),this.buildLabels(),this.fit()}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=this._margins.left,this.right=this.width):(this.height=this.maxHeight,this.top=this._margins.top,this.bottom=this.height)}buildLabels(){const t=this.options.labels||{};let e=st(t.generateLabels,[this.chart],this)||[];t.filter&&(e=e.filter(i=>t.filter(i,this.chart.data))),t.sort&&(e=e.sort((i,s)=>t.sort(i,s,this.chart.data))),this.options.reverse&&e.reverse(),this.legendItems=e}fit(){const{options:t,ctx:e}=this;if(!t.display){this.width=this.height=0;return}const i=t.labels,s=ft(i.font),o=s.size,a=this._computeTitleHeight(),{boxWidth:l,itemHeight:c}=$s(i,o);let d,h;e.font=s.string,this.isHorizontal()?(d=this.maxWidth,h=this._fitRows(a,o,l,c)+10):(h=this.maxHeight,d=this._fitCols(a,s,l,c)+10),this.width=Math.min(d,t.maxWidth||this.maxWidth),this.height=Math.min(h,t.maxHeight||this.maxHeight)}_fitRows(t,e,i,s){const{ctx:o,maxWidth:a,options:{labels:{padding:l}}}=this,c=this.legendHitBoxes=[],d=this.lineWidths=[0],h=s+l;let u=t;o.textAlign="left",o.textBaseline="middle";let f=-1,p=-h;return this.legendItems.forEach((g,b)=>{const m=i+e/2+o.measureText(g.text).width;(b===0||d[d.length-1]+m+2*l>a)&&(u+=h,d[d.length-(b>0?0:1)]=0,p+=h,f++),c[b]={left:0,top:p,row:f,width:m,height:s},d[d.length-1]+=m+l}),u}_fitCols(t,e,i,s){const{ctx:o,maxHeight:a,options:{labels:{padding:l}}}=this,c=this.legendHitBoxes=[],d=this.columnSizes=[],h=a-t;let u=l,f=0,p=0,g=0,b=0;return this.legendItems.forEach((m,_)=>{const{itemWidth:y,itemHeight:k}=Ac(i,e,o,m,s);_>0&&p+k+2*l>h&&(u+=f+l,d.push({width:f,height:p}),g+=f+l,b++,f=p=0),c[_]={left:g,top:p,col:b,width:y,height:k},f=Math.max(f,y),p+=k+l}),u+=f,d.push({width:f,height:p}),u}adjustHitBoxes(){if(!this.options.display)return;const t=this._computeTitleHeight(),{legendHitBoxes:e,options:{align:i,labels:{padding:s},rtl:o}}=this,a=ee(o,this.left,this.width);if(this.isHorizontal()){let l=0,c=ut(i,this.left+s,this.right-this.lineWidths[l]);for(const d of e)l!==d.row&&(l=d.row,c=ut(i,this.left+s,this.right-this.lineWidths[l])),d.top+=this.top+t+s,d.left=a.leftForLtr(a.x(c),d.width),c+=d.width+s}else{let l=0,c=ut(i,this.top+t+s,this.bottom-this.columnSizes[l].height);for(const d of e)d.col!==l&&(l=d.col,c=ut(i,this.top+t+s,this.bottom-this.columnSizes[l].height)),d.top=c,d.left+=this.left+s,d.left=a.leftForLtr(a.x(d.left),d.width),c+=d.height+s}}isHorizontal(){return this.options.position==="top"||this.options.position==="bottom"}draw(){if(this.options.display){const t=this.ctx;wn(t,this),this._draw(),Sn(t)}}_draw(){const{options:t,columnSizes:e,lineWidths:i,ctx:s}=this,{align:o,labels:a}=t,l=rt.color,c=ee(t.rtl,this.left,this.width),d=ft(a.font),{padding:h}=a,u=d.size,f=u/2;let p;this.drawTitle(),s.textAlign=c.textAlign("left"),s.textBaseline="middle",s.lineWidth=.5,s.font=d.string;const{boxWidth:g,boxHeight:b,itemHeight:m}=$s(a,u),_=function(N,V,L){if(isNaN(g)||g<=0||isNaN(b)||b<0)return;s.save();const C=U(L.lineWidth,1);if(s.fillStyle=U(L.fillStyle,l),s.lineCap=U(L.lineCap,"butt"),s.lineDashOffset=U(L.lineDashOffset,0),s.lineJoin=U(L.lineJoin,"miter"),s.lineWidth=C,s.strokeStyle=U(L.strokeStyle,l),s.setLineDash(U(L.lineDash,[])),a.usePointStyle){const T={radius:b*Math.SQRT2/2,pointStyle:L.pointStyle,rotation:L.rotation,borderWidth:C},P=c.xPlus(N,g/2),O=V+f;Oi(s,T,P,O,a.pointStyleWidth&&g)}else{const T=V+Math.max((u-b)/2,0),P=c.leftForLtr(N,g),O=Jt(L.borderRadius);s.beginPath(),Object.values(O).some(F=>F!==0)?Oe(s,{x:P,y:T,w:g,h:b,radius:O}):s.rect(P,T,g,b),s.fill(),C!==0&&s.stroke()}s.restore()},y=function(N,V,L){be(s,L.text,N,V+m/2,d,{strikethrough:L.hidden,textAlign:c.textAlign(L.textAlign)})},k=this.isHorizontal(),x=this._computeTitleHeight();k?p={x:ut(o,this.left+h,this.right-i[0]),y:this.top+h+x,line:0}:p={x:this.left+h,y:ut(o,this.top+x+h,this.bottom-e[0].height),line:0},qi(this.ctx,t.textDirection);const S=m+h;this.legendItems.forEach((N,V)=>{s.strokeStyle=N.fontColor,s.fillStyle=N.fontColor;const L=s.measureText(N.text).width,C=c.textAlign(N.textAlign||(N.textAlign=a.textAlign)),T=g+f+L;let P=p.x,O=p.y;c.setWidth(this.width),k?V>0&&P+T+h>this.right&&(O=p.y+=S,p.line++,P=p.x=ut(o,this.left+h,this.right-i[p.line])):V>0&&O+S>this.bottom&&(P=p.x=P+e[p.line].width+h,p.line++,O=p.y=ut(o,this.top+x+h,this.bottom-e[p.line].height));const F=c.x(P);if(_(F,O,N),P=ga(C,P+g+f,k?P+T:this.right,t.rtl),y(c.x(P),O,N),k)p.x+=T+h;else if(typeof N.text!="string"){const H=d.lineHeight;p.y+=Hs(N,H)+h}else p.y+=S}),Yi(this.ctx,t.textDirection)}drawTitle(){const t=this.options,e=t.title,i=ft(e.font),s=_t(e.padding);if(!e.display)return;const o=ee(t.rtl,this.left,this.width),a=this.ctx,l=e.position,c=i.size/2,d=s.top+c;let h,u=this.left,f=this.width;if(this.isHorizontal())f=Math.max(...this.lineWidths),h=this.top+d,u=ut(t.align,u,this.right-f);else{const g=this.columnSizes.reduce((b,m)=>Math.max(b,m.height),0);h=d+ut(t.align,this.top,this.bottom-g-t.labels.padding-this._computeTitleHeight())}const p=ut(l,u,u+f);a.textAlign=o.textAlign(mn(l)),a.textBaseline="middle",a.strokeStyle=e.color,a.fillStyle=e.color,a.font=i.string,be(a,e.text,p,h,i)}_computeTitleHeight(){const t=this.options.title,e=ft(t.font),i=_t(t.padding);return t.display?e.lineHeight+i.height:0}_getLegendItemAt(t,e){let i,s,o;if(Vt(t,this.left,this.right)&&Vt(e,this.top,this.bottom)){for(o=this.legendHitBoxes,i=0;i<o.length;++i)if(s=o[i],Vt(t,s.left,s.left+s.width)&&Vt(e,s.top,s.top+s.height))return this.legendItems[i]}return null}handleEvent(t){const e=this.options;if(!Nc(t.type,e))return;const i=this._getLegendItemAt(t.x,t.y);if(t.type==="mousemove"||t.type==="mouseout"){const s=this._hoveredItem,o=Dc(s,i);s&&!o&&st(e.onLeave,[t,s,this],this),this._hoveredItem=i,i&&!o&&st(e.onHover,[t,i,this],this)}else i&&st(e.onClick,[t,i,this],this)}}function Ac(n,t,e,i,s){const o=Tc(i,n,t,e),a=Pc(s,i,t.lineHeight);return{itemWidth:o,itemHeight:a}}function Tc(n,t,e,i){let s=n.text;return s&&typeof s!="string"&&(s=s.reduce((o,a)=>o.length>a.length?o:a)),t+e.size/2+i.measureText(s).width}function Pc(n,t,e){let i=n;return typeof t.text!="string"&&(i=Hs(t,e)),i}function Hs(n,t){const e=n.text?n.text.length:0;return t*e}function Nc(n,t){return!!((n==="mousemove"||n==="mouseout")&&(t.onHover||t.onLeave)||t.onClick&&(n==="click"||n==="mouseup"))}var Oc={id:"legend",_element:Ws,start(n,t,e){const i=n.legend=new Ws({ctx:n.ctx,options:e,chart:n});kt.configure(n,i,e),kt.addBox(n,i)},stop(n){kt.removeBox(n,n.legend),delete n.legend},beforeUpdate(n,t,e){const i=n.legend;kt.configure(n,i,e),i.options=e},afterUpdate(n){const t=n.legend;t.buildLabels(),t.adjustHitBoxes()},afterEvent(n,t){t.replay||n.legend.handleEvent(t.event)},defaults:{display:!0,position:"top",align:"center",fullSize:!0,reverse:!1,weight:1e3,onClick(n,t,e){const i=t.datasetIndex,s=e.chart;s.isDatasetVisible(i)?(s.hide(i),t.hidden=!0):(s.show(i),t.hidden=!1)},onHover:null,onLeave:null,labels:{color:n=>n.chart.options.color,boxWidth:40,padding:10,generateLabels(n){const t=n.data.datasets,{labels:{usePointStyle:e,pointStyle:i,textAlign:s,color:o,useBorderRadius:a,borderRadius:l}}=n.legend.options;return n._getSortedDatasetMetas().map(c=>{const d=c.controller.getStyle(e?0:void 0),h=_t(d.borderWidth);return{text:t[c.index].label,fillStyle:d.backgroundColor,fontColor:o,hidden:!c.visible,lineCap:d.borderCapStyle,lineDash:d.borderDash,lineDashOffset:d.borderDashOffset,lineJoin:d.borderJoinStyle,lineWidth:(h.width+h.height)/4,strokeStyle:d.borderColor,pointStyle:i||d.pointStyle,rotation:d.rotation,textAlign:s||d.textAlign,borderRadius:a&&(l||d.borderRadius),datasetIndex:c.index}},this)}},title:{color:n=>n.chart.options.color,display:!1,position:"center",text:""}},descriptors:{_scriptable:n=>!n.startsWith("on"),labels:{_scriptable:n=>!["generateLabels","filter","sort"].includes(n)}}};class js extends At{constructor(t){super(),this.chart=t.chart,this.options=t.options,this.ctx=t.ctx,this._padding=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(t,e){const i=this.options;if(this.left=0,this.top=0,!i.display){this.width=this.height=this.right=this.bottom=0;return}this.width=this.right=t,this.height=this.bottom=e;const s=lt(i.text)?i.text.length:1;this._padding=_t(i.padding);const o=s*ft(i.font).lineHeight+this._padding.height;this.isHorizontal()?this.height=o:this.width=o}isHorizontal(){const t=this.options.position;return t==="top"||t==="bottom"}_drawArgs(t){const{top:e,left:i,bottom:s,right:o,options:a}=this,l=a.align;let c=0,d,h,u;return this.isHorizontal()?(h=ut(l,i,o),u=e+t,d=o-i):(a.position==="left"?(h=i+t,u=ut(l,s,e),c=nt*-.5):(h=o-t,u=ut(l,e,s),c=nt*.5),d=s-e),{titleX:h,titleY:u,maxWidth:d,rotation:c}}draw(){const t=this.ctx,e=this.options;if(!e.display)return;const i=ft(e.font),o=i.lineHeight/2+this._padding.top,{titleX:a,titleY:l,maxWidth:c,rotation:d}=this._drawArgs(o);be(t,e.text,0,0,i,{color:e.color,maxWidth:c,rotation:d,textAlign:mn(e.align),textBaseline:"middle",translation:[a,l]})}}function Vc(n,t){const e=new js({ctx:n.ctx,options:t,chart:n});kt.configure(n,e,t),kt.addBox(n,e),n.titleBlock=e}var Lc={id:"title",_element:js,start(n,t,e){Vc(n,e)},stop(n){const t=n.titleBlock;kt.removeBox(n,t),delete n.titleBlock},beforeUpdate(n,t,e){const i=n.titleBlock;kt.configure(n,i,e),i.options=e},defaults:{align:"center",display:!1,font:{weight:"bold"},fullSize:!0,padding:10,position:"top",text:"",weight:2e3},defaultRoutes:{color:"color"},descriptors:{_scriptable:!0,_indexable:!1}};const Me={average(n){if(!n.length)return!1;let t,e,i=new Set,s=0,o=0;for(t=0,e=n.length;t<e;++t){const l=n[t].element;if(l&&l.hasValue()){const c=l.tooltipPosition();i.add(c.x),s+=c.y,++o}}return o===0||i.size===0?!1:{x:[...i].reduce((l,c)=>l+c)/i.size,y:s/o}},nearest(n,t){if(!n.length)return!1;let e=t.x,i=t.y,s=Number.POSITIVE_INFINITY,o,a,l;for(o=0,a=n.length;o<a;++o){const c=n[o].element;if(c&&c.hasValue()){const d=c.getCenterPoint(),h=fn(t,d);h<s&&(s=h,l=c)}}if(l){const c=l.tooltipPosition();e=c.x,i=c.y}return{x:e,y:i}}};function Et(n,t){return t&&(lt(t)?Array.prototype.push.apply(n,t):n.push(t)),n}function Tt(n){return(typeof n=="string"||n instanceof String)&&n.indexOf(`
|
|
17
|
+
`)>-1?n.split(`
|
|
18
|
+
`):n}function zc(n,t){const{element:e,datasetIndex:i,index:s}=t,o=n.getDatasetMeta(i).controller,{label:a,value:l}=o.getLabelAndValue(s);return{chart:n,label:a,parsed:o.getParsed(s),raw:n.data.datasets[i].data[s],formattedValue:l,dataset:o.getDataset(),dataIndex:s,datasetIndex:i,element:e}}function qs(n,t){const e=n.chart.ctx,{body:i,footer:s,title:o}=n,{boxWidth:a,boxHeight:l}=t,c=ft(t.bodyFont),d=ft(t.titleFont),h=ft(t.footerFont),u=o.length,f=s.length,p=i.length,g=_t(t.padding);let b=g.height,m=0,_=i.reduce((x,S)=>x+S.before.length+S.lines.length+S.after.length,0);if(_+=n.beforeBody.length+n.afterBody.length,u&&(b+=u*d.lineHeight+(u-1)*t.titleSpacing+t.titleMarginBottom),_){const x=t.displayColors?Math.max(l,c.lineHeight):c.lineHeight;b+=p*x+(_-p)*c.lineHeight+(_-1)*t.bodySpacing}f&&(b+=t.footerMarginTop+f*h.lineHeight+(f-1)*t.footerSpacing);let y=0;const k=function(x){m=Math.max(m,e.measureText(x).width+y)};return e.save(),e.font=d.string,et(n.title,k),e.font=c.string,et(n.beforeBody.concat(n.afterBody),k),y=t.displayColors?a+2+t.boxPadding:0,et(i,x=>{et(x.before,k),et(x.lines,k),et(x.after,k)}),y=0,e.font=h.string,et(n.footer,k),e.restore(),m+=g.width,{width:m,height:b}}function Rc(n,t){const{y:e,height:i}=t;return e<i/2?"top":e>n.height-i/2?"bottom":"center"}function Ic(n,t,e,i){const{x:s,width:o}=i,a=e.caretSize+e.caretPadding;if(n==="left"&&s+o+a>t.width||n==="right"&&s-o-a<0)return!0}function Fc(n,t,e,i){const{x:s,width:o}=e,{width:a,chartArea:{left:l,right:c}}=n;let d="center";return i==="center"?d=s<=(l+c)/2?"left":"right":s<=o/2?d="left":s>=a-o/2&&(d="right"),Ic(d,n,t,e)&&(d="center"),d}function Ys(n,t,e){const i=e.yAlign||t.yAlign||Rc(n,e);return{xAlign:e.xAlign||t.xAlign||Fc(n,t,e,i),yAlign:i}}function $c(n,t){let{x:e,width:i}=n;return t==="right"?e-=i:t==="center"&&(e-=i/2),e}function Wc(n,t,e){let{y:i,height:s}=n;return t==="top"?i+=e:t==="bottom"?i-=s+e:i-=s/2,i}function Us(n,t,e,i){const{caretSize:s,caretPadding:o,cornerRadius:a}=n,{xAlign:l,yAlign:c}=e,d=s+o,{topLeft:h,topRight:u,bottomLeft:f,bottomRight:p}=Jt(a);let g=$c(t,l);const b=Wc(t,c,d);return c==="center"?l==="left"?g+=d:l==="right"&&(g-=d):l==="left"?g-=Math.max(h,f)+s:l==="right"&&(g+=Math.max(u,p)+s),{x:ht(g,0,i.width-t.width),y:ht(b,0,i.height-t.height)}}function Ge(n,t,e){const i=_t(e.padding);return t==="center"?n.x+n.width/2:t==="right"?n.x+n.width-i.right:n.x+i.left}function Xs(n){return Et([],Tt(n))}function Hc(n,t,e){return Ht(n,{tooltip:t,tooltipItems:e,type:"tooltip"})}function Ks(n,t){const e=t&&t.dataset&&t.dataset.tooltip&&t.dataset.tooltip.callbacks;return e?n.override(e):n}const Gs={beforeTitle:vt,title(n){if(n.length>0){const t=n[0],e=t.chart.data.labels,i=e?e.length:0;if(this&&this.options&&this.options.mode==="dataset")return t.dataset.label||"";if(t.label)return t.label;if(i>0&&t.dataIndex<i)return e[t.dataIndex]}return""},afterTitle:vt,beforeBody:vt,beforeLabel:vt,label(n){if(this&&this.options&&this.options.mode==="dataset")return n.label+": "+n.formattedValue||n.formattedValue;let t=n.dataset.label||"";t&&(t+=": ");const e=n.formattedValue;return tt(e)||(t+=e),t},labelColor(n){const e=n.chart.getDatasetMeta(n.datasetIndex).controller.getStyle(n.dataIndex);return{borderColor:e.borderColor,backgroundColor:e.backgroundColor,borderWidth:e.borderWidth,borderDash:e.borderDash,borderDashOffset:e.borderDashOffset,borderRadius:0}},labelTextColor(){return this.options.bodyColor},labelPointStyle(n){const e=n.chart.getDatasetMeta(n.datasetIndex).controller.getStyle(n.dataIndex);return{pointStyle:e.pointStyle,rotation:e.rotation}},afterLabel:vt,afterBody:vt,beforeFooter:vt,footer:vt,afterFooter:vt};function pt(n,t,e,i){const s=n[t].call(e,i);return typeof s>"u"?Gs[t].call(e,i):s}class Qs extends At{static positioners=Me;constructor(t){super(),this.opacity=0,this._active=[],this._eventPosition=void 0,this._size=void 0,this._cachedAnimations=void 0,this._tooltipItems=[],this.$animations=void 0,this.$context=void 0,this.chart=t.chart,this.options=t.options,this.dataPoints=void 0,this.title=void 0,this.beforeBody=void 0,this.body=void 0,this.afterBody=void 0,this.footer=void 0,this.xAlign=void 0,this.yAlign=void 0,this.x=void 0,this.y=void 0,this.height=void 0,this.width=void 0,this.caretX=void 0,this.caretY=void 0,this.labelColors=void 0,this.labelPointStyles=void 0,this.labelTextColors=void 0}initialize(t){this.options=t,this._cachedAnimations=void 0,this.$context=void 0}_resolveAnimations(){const t=this._cachedAnimations;if(t)return t;const e=this.chart,i=this.options.setContext(this.getContext()),s=i.enabled&&e.options.animation&&i.animations,o=new Ji(this.chart,s);return s._cacheable&&(this._cachedAnimations=Object.freeze(o)),o}getContext(){return this.$context||(this.$context=Hc(this.chart.getContext(),this,this._tooltipItems))}getTitle(t,e){const{callbacks:i}=e,s=pt(i,"beforeTitle",this,t),o=pt(i,"title",this,t),a=pt(i,"afterTitle",this,t);let l=[];return l=Et(l,Tt(s)),l=Et(l,Tt(o)),l=Et(l,Tt(a)),l}getBeforeBody(t,e){return Xs(pt(e.callbacks,"beforeBody",this,t))}getBody(t,e){const{callbacks:i}=e,s=[];return et(t,o=>{const a={before:[],lines:[],after:[]},l=Ks(i,o);Et(a.before,Tt(pt(l,"beforeLabel",this,o))),Et(a.lines,pt(l,"label",this,o)),Et(a.after,Tt(pt(l,"afterLabel",this,o))),s.push(a)}),s}getAfterBody(t,e){return Xs(pt(e.callbacks,"afterBody",this,t))}getFooter(t,e){const{callbacks:i}=e,s=pt(i,"beforeFooter",this,t),o=pt(i,"footer",this,t),a=pt(i,"afterFooter",this,t);let l=[];return l=Et(l,Tt(s)),l=Et(l,Tt(o)),l=Et(l,Tt(a)),l}_createItems(t){const e=this._active,i=this.chart.data,s=[],o=[],a=[];let l=[],c,d;for(c=0,d=e.length;c<d;++c)l.push(zc(this.chart,e[c]));return t.filter&&(l=l.filter((h,u,f)=>t.filter(h,u,f,i))),t.itemSort&&(l=l.sort((h,u)=>t.itemSort(h,u,i))),et(l,h=>{const u=Ks(t.callbacks,h);s.push(pt(u,"labelColor",this,h)),o.push(pt(u,"labelPointStyle",this,h)),a.push(pt(u,"labelTextColor",this,h))}),this.labelColors=s,this.labelPointStyles=o,this.labelTextColors=a,this.dataPoints=l,l}update(t,e){const i=this.options.setContext(this.getContext()),s=this._active;let o,a=[];if(!s.length)this.opacity!==0&&(o={opacity:0});else{const l=Me[i.position].call(this,s,this._eventPosition);a=this._createItems(i),this.title=this.getTitle(a,i),this.beforeBody=this.getBeforeBody(a,i),this.body=this.getBody(a,i),this.afterBody=this.getAfterBody(a,i),this.footer=this.getFooter(a,i);const c=this._size=qs(this,i),d=Object.assign({},l,c),h=Ys(this.chart,i,d),u=Us(i,d,h,this.chart);this.xAlign=h.xAlign,this.yAlign=h.yAlign,o={opacity:1,x:u.x,y:u.y,width:c.width,height:c.height,caretX:l.x,caretY:l.y}}this._tooltipItems=a,this.$context=void 0,o&&this._resolveAnimations().update(this,o),t&&i.external&&i.external.call(this,{chart:this.chart,tooltip:this,replay:e})}drawCaret(t,e,i,s){const o=this.getCaretPosition(t,i,s);e.lineTo(o.x1,o.y1),e.lineTo(o.x2,o.y2),e.lineTo(o.x3,o.y3)}getCaretPosition(t,e,i){const{xAlign:s,yAlign:o}=this,{caretSize:a,cornerRadius:l}=i,{topLeft:c,topRight:d,bottomLeft:h,bottomRight:u}=Jt(l),{x:f,y:p}=t,{width:g,height:b}=e;let m,_,y,k,x,S;return o==="center"?(x=p+b/2,s==="left"?(m=f,_=m-a,k=x+a,S=x-a):(m=f+g,_=m+a,k=x-a,S=x+a),y=m):(s==="left"?_=f+Math.max(c,h)+a:s==="right"?_=f+g-Math.max(d,u)-a:_=this.caretX,o==="top"?(k=p,x=k-a,m=_-a,y=_+a):(k=p+b,x=k+a,m=_+a,y=_-a),S=k),{x1:m,x2:_,x3:y,y1:k,y2:x,y3:S}}drawTitle(t,e,i){const s=this.title,o=s.length;let a,l,c;if(o){const d=ee(i.rtl,this.x,this.width);for(t.x=Ge(this,i.titleAlign,i),e.textAlign=d.textAlign(i.titleAlign),e.textBaseline="middle",a=ft(i.titleFont),l=i.titleSpacing,e.fillStyle=i.titleColor,e.font=a.string,c=0;c<o;++c)e.fillText(s[c],d.x(t.x),t.y+a.lineHeight/2),t.y+=a.lineHeight+l,c+1===o&&(t.y+=i.titleMarginBottom-l)}}_drawColorBox(t,e,i,s,o){const a=this.labelColors[i],l=this.labelPointStyles[i],{boxHeight:c,boxWidth:d}=o,h=ft(o.bodyFont),u=Ge(this,"left",o),f=s.x(u),p=c<h.lineHeight?(h.lineHeight-c)/2:0,g=e.y+p;if(o.usePointStyle){const b={radius:Math.min(d,c)/2,pointStyle:l.pointStyle,rotation:l.rotation,borderWidth:1},m=s.leftForLtr(f,d)+d/2,_=g+c/2;t.strokeStyle=o.multiKeyBackground,t.fillStyle=o.multiKeyBackground,xn(t,b,m,_),t.strokeStyle=a.borderColor,t.fillStyle=a.backgroundColor,xn(t,b,m,_)}else{t.lineWidth=Q(a.borderWidth)?Math.max(...Object.values(a.borderWidth)):a.borderWidth||1,t.strokeStyle=a.borderColor,t.setLineDash(a.borderDash||[]),t.lineDashOffset=a.borderDashOffset||0;const b=s.leftForLtr(f,d),m=s.leftForLtr(s.xPlus(f,1),d-2),_=Jt(a.borderRadius);Object.values(_).some(y=>y!==0)?(t.beginPath(),t.fillStyle=o.multiKeyBackground,Oe(t,{x:b,y:g,w:d,h:c,radius:_}),t.fill(),t.stroke(),t.fillStyle=a.backgroundColor,t.beginPath(),Oe(t,{x:m,y:g+1,w:d-2,h:c-2,radius:_}),t.fill()):(t.fillStyle=o.multiKeyBackground,t.fillRect(b,g,d,c),t.strokeRect(b,g,d,c),t.fillStyle=a.backgroundColor,t.fillRect(m,g+1,d-2,c-2))}t.fillStyle=this.labelTextColors[i]}drawBody(t,e,i){const{body:s}=this,{bodySpacing:o,bodyAlign:a,displayColors:l,boxHeight:c,boxWidth:d,boxPadding:h}=i,u=ft(i.bodyFont);let f=u.lineHeight,p=0;const g=ee(i.rtl,this.x,this.width),b=function(L){e.fillText(L,g.x(t.x+p),t.y+f/2),t.y+=f+o},m=g.textAlign(a);let _,y,k,x,S,N,V;for(e.textAlign=a,e.textBaseline="middle",e.font=u.string,t.x=Ge(this,m,i),e.fillStyle=i.bodyColor,et(this.beforeBody,b),p=l&&m!=="right"?a==="center"?d/2+h:d+2+h:0,x=0,N=s.length;x<N;++x){for(_=s[x],y=this.labelTextColors[x],e.fillStyle=y,et(_.before,b),k=_.lines,l&&k.length&&(this._drawColorBox(e,t,x,g,i),f=Math.max(u.lineHeight,c)),S=0,V=k.length;S<V;++S)b(k[S]),f=u.lineHeight;et(_.after,b)}p=0,f=u.lineHeight,et(this.afterBody,b),t.y-=o}drawFooter(t,e,i){const s=this.footer,o=s.length;let a,l;if(o){const c=ee(i.rtl,this.x,this.width);for(t.x=Ge(this,i.footerAlign,i),t.y+=i.footerMarginTop,e.textAlign=c.textAlign(i.footerAlign),e.textBaseline="middle",a=ft(i.footerFont),e.fillStyle=i.footerColor,e.font=a.string,l=0;l<o;++l)e.fillText(s[l],c.x(t.x),t.y+a.lineHeight/2),t.y+=a.lineHeight+i.footerSpacing}}drawBackground(t,e,i,s){const{xAlign:o,yAlign:a}=this,{x:l,y:c}=t,{width:d,height:h}=i,{topLeft:u,topRight:f,bottomLeft:p,bottomRight:g}=Jt(s.cornerRadius);e.fillStyle=s.backgroundColor,e.strokeStyle=s.borderColor,e.lineWidth=s.borderWidth,e.beginPath(),e.moveTo(l+u,c),a==="top"&&this.drawCaret(t,e,i,s),e.lineTo(l+d-f,c),e.quadraticCurveTo(l+d,c,l+d,c+f),a==="center"&&o==="right"&&this.drawCaret(t,e,i,s),e.lineTo(l+d,c+h-g),e.quadraticCurveTo(l+d,c+h,l+d-g,c+h),a==="bottom"&&this.drawCaret(t,e,i,s),e.lineTo(l+p,c+h),e.quadraticCurveTo(l,c+h,l,c+h-p),a==="center"&&o==="left"&&this.drawCaret(t,e,i,s),e.lineTo(l,c+u),e.quadraticCurveTo(l,c,l+u,c),e.closePath(),e.fill(),s.borderWidth>0&&e.stroke()}_updateAnimationTarget(t){const e=this.chart,i=this.$animations,s=i&&i.x,o=i&&i.y;if(s||o){const a=Me[t.position].call(this,this._active,this._eventPosition);if(!a)return;const l=this._size=qs(this,t),c=Object.assign({},a,this._size),d=Ys(e,t,c),h=Us(t,c,d,e);(s._to!==h.x||o._to!==h.y)&&(this.xAlign=d.xAlign,this.yAlign=d.yAlign,this.width=l.width,this.height=l.height,this.caretX=a.x,this.caretY=a.y,this._resolveAnimations().update(this,h))}}_willRender(){return!!this.opacity}draw(t){const e=this.options.setContext(this.getContext());let i=this.opacity;if(!i)return;this._updateAnimationTarget(e);const s={width:this.width,height:this.height},o={x:this.x,y:this.y};i=Math.abs(i)<.001?0:i;const a=_t(e.padding),l=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;e.enabled&&l&&(t.save(),t.globalAlpha=i,this.drawBackground(o,t,s,e),qi(t,e.textDirection),o.y+=a.top,this.drawTitle(o,t,e),this.drawBody(o,t,e),this.drawFooter(o,t,e),Yi(t,e.textDirection),t.restore())}getActiveElements(){return this._active||[]}setActiveElements(t,e){const i=this._active,s=t.map(({datasetIndex:l,index:c})=>{const d=this.chart.getDatasetMeta(l);if(!d)throw new Error("Cannot find a dataset at index "+l);return{datasetIndex:l,element:d.data[c],index:c}}),o=!Ae(i,s),a=this._positionChanged(s,e);(o||a)&&(this._active=s,this._eventPosition=e,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(t,e,i=!0){if(e&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;const s=this.options,o=this._active||[],a=this._getActiveElements(t,o,e,i),l=this._positionChanged(a,t),c=e||!Ae(a,o)||l;return c&&(this._active=a,(s.enabled||s.external)&&(this._eventPosition={x:t.x,y:t.y},this.update(!0,e))),c}_getActiveElements(t,e,i,s){const o=this.options;if(t.type==="mouseout")return[];if(!s)return e.filter(l=>this.chart.data.datasets[l.datasetIndex]&&this.chart.getDatasetMeta(l.datasetIndex).controller.getParsed(l.index)!==void 0);const a=this.chart.getElementsAtEventForMode(t,o.mode,o,i);return o.reverse&&a.reverse(),a}_positionChanged(t,e){const{caretX:i,caretY:s,options:o}=this,a=Me[o.position].call(this,t,e);return a!==!1&&(i!==a.x||s!==a.y)}}var jc={id:"tooltip",_element:Qs,positioners:Me,afterInit(n,t,e){e&&(n.tooltip=new Qs({chart:n,options:e}))},beforeUpdate(n,t,e){n.tooltip&&n.tooltip.initialize(e)},reset(n,t,e){n.tooltip&&n.tooltip.initialize(e)},afterDraw(n){const t=n.tooltip;if(t&&t._willRender()){const e={tooltip:t};if(n.notifyPlugins("beforeTooltipDraw",{...e,cancelable:!0})===!1)return;t.draw(n.ctx),n.notifyPlugins("afterTooltipDraw",e)}},afterEvent(n,t){if(n.tooltip){const e=t.replay;n.tooltip.handleEvent(t.event,e,t.inChartArea)&&(t.changed=!0)}},defaults:{enabled:!0,external:null,position:"average",backgroundColor:"rgba(0,0,0,0.8)",titleColor:"#fff",titleFont:{weight:"bold"},titleSpacing:2,titleMarginBottom:6,titleAlign:"left",bodyColor:"#fff",bodySpacing:2,bodyFont:{},bodyAlign:"left",footerColor:"#fff",footerSpacing:2,footerMarginTop:6,footerFont:{weight:"bold"},footerAlign:"left",padding:6,caretPadding:2,caretSize:5,cornerRadius:6,boxHeight:(n,t)=>t.bodyFont.size,boxWidth:(n,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:Gs},defaultRoutes:{bodyFont:"font",footerFont:"font",titleFont:"font"},descriptors:{_scriptable:n=>n!=="filter"&&n!=="itemSort"&&n!=="external",_indexable:!1,callbacks:{_scriptable:!1,_indexable:!1},animation:{_fallback:!1},animations:{_fallback:"animation"}},additionalOptionScopes:["interaction"]};const qc=(n,t,e,i)=>(typeof t=="string"?(e=n.push(t)-1,i.unshift({index:e,label:t})):isNaN(t)&&(e=null),e);function Yc(n,t,e,i){const s=n.indexOf(t);if(s===-1)return qc(n,t,e,i);const o=n.lastIndexOf(t);return s!==o?e:s}const Uc=(n,t)=>n===null?null:ht(Math.round(n),0,t);function Js(n){const t=this.getLabels();return n>=0&&n<t.length?t[n]:n}class Xc extends ne{static id="category";static defaults={ticks:{callback:Js}};constructor(t){super(t),this._startValue=void 0,this._valueRange=0,this._addedLabels=[]}init(t){const e=this._addedLabels;if(e.length){const i=this.getLabels();for(const{index:s,label:o}of e)i[s]===o&&i.splice(s,1);this._addedLabels=[]}super.init(t)}parse(t,e){if(tt(t))return null;const i=this.getLabels();return e=isFinite(e)&&i[e]===t?e:Yc(i,t,U(e,t),this._addedLabels),Uc(e,i.length-1)}determineDataLimits(){const{minDefined:t,maxDefined:e}=this.getUserBounds();let{min:i,max:s}=this.getMinMax(!0);this.options.bounds==="ticks"&&(t||(i=0),e||(s=this.getLabels().length-1)),this.min=i,this.max=s}buildTicks(){const t=this.min,e=this.max,i=this.options.offset,s=[];let o=this.getLabels();o=t===0&&e===o.length-1?o:o.slice(t,e+1),this._valueRange=Math.max(o.length-(i?0:1),1),this._startValue=this.min-(i?.5:0);for(let a=t;a<=e;a++)s.push({value:a});return s}getLabelForValue(t){return Js.call(this,t)}configure(){super.configure(),this.isHorizontal()||(this._reversePixels=!this._reversePixels)}getPixelForValue(t){return typeof t!="number"&&(t=this.parse(t)),t===null?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getPixelForTick(t){const e=this.ticks;return t<0||t>e.length-1?null:this.getPixelForValue(e[t].value)}getValueForPixel(t){return Math.round(this._startValue+this.getDecimalForPixel(t)*this._valueRange)}getBasePixel(){return this.bottom}}function Kc(n,t){const e=[],{bounds:s,step:o,min:a,max:l,precision:c,count:d,maxTicks:h,maxDigits:u,includeBounds:f}=n,p=o||1,g=h-1,{min:b,max:m}=t,_=!tt(a),y=!tt(l),k=!tt(d),x=(m-b)/(u+1);let S=bi((m-b)/g/p)*p,N,V,L,C;if(S<1e-14&&!_&&!y)return[{value:b},{value:m}];C=Math.ceil(m/S)-Math.floor(b/S),C>g&&(S=bi(C*S/g/p)*p),tt(c)||(N=Math.pow(10,c),S=Math.ceil(S*N)/N),s==="ticks"?(V=Math.floor(b/S)*S,L=Math.ceil(m/S)*S):(V=b,L=m),_&&y&&o&&ra((l-a)/o,S/1e3)?(C=Math.round(Math.min((l-a)/S,h)),S=(l-a)/C,V=a,L=l):k?(V=_?a:V,L=y?l:L,C=d-1,S=(L-V)/C):(C=(L-V)/S,ue(C,Math.round(C),S/1e3)?C=Math.round(C):C=Math.ceil(C));const T=Math.max(yi(S),yi(V));N=Math.pow(10,tt(c)?T:c),V=Math.round(V*N)/N,L=Math.round(L*N)/N;let P=0;for(_&&(f&&V!==a?(e.push({value:a}),V<a&&P++,ue(Math.round((V+P*S)*N)/N,a,Zs(a,x,n))&&P++):V<a&&P++);P<C;++P){const O=Math.round((V+P*S)*N)/N;if(y&&O>l)break;e.push({value:O})}return y&&f&&L!==l?e.length&&ue(e[e.length-1].value,l,Zs(l,x,n))?e[e.length-1].value=l:e.push({value:l}):(!y||L===l)&&e.push({value:L}),e}function Zs(n,t,{horizontal:e,minRotation:i}){const s=Bt(i),o=(e?Math.sin(s):Math.cos(s))||.001,a=.75*t*(""+n).length;return Math.min(t/o,a)}class Gc extends ne{constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._endValue=void 0,this._valueRange=0}parse(t,e){return tt(t)||(typeof t=="number"||t instanceof Number)&&!isFinite(+t)?null:+t}handleTickRangeOptions(){const{beginAtZero:t}=this.options,{minDefined:e,maxDefined:i}=this.getUserBounds();let{min:s,max:o}=this;const a=c=>s=e?s:c,l=c=>o=i?o:c;if(t){const c=St(s),d=St(o);c<0&&d<0?l(0):c>0&&d>0&&a(0)}if(s===o){let c=o===0?1:Math.abs(o*.05);l(o+c),t||a(s-c)}this.min=s,this.max=o}getTickLimit(){const t=this.options.ticks;let{maxTicksLimit:e,stepSize:i}=t,s;return i?(s=Math.ceil(this.max/i)-Math.floor(this.min/i)+1,s>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${i} would result generating up to ${s} ticks. Limiting to 1000.`),s=1e3)):(s=this.computeTickLimit(),e=e||11),e&&(s=Math.min(e,s)),s}computeTickLimit(){return Number.POSITIVE_INFINITY}buildTicks(){const t=this.options,e=t.ticks;let i=this.getTickLimit();i=Math.max(2,i);const s={maxTicks:i,bounds:t.bounds,min:t.min,max:t.max,precision:e.precision,step:e.stepSize,count:e.count,maxDigits:this._maxDigits(),horizontal:this.isHorizontal(),minRotation:e.minRotation||0,includeBounds:e.includeBounds!==!1},o=this._range||this,a=Kc(s,o);return t.bounds==="ticks"&&la(a,this,"value"),t.reverse?(a.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),a}configure(){const t=this.ticks;let e=this.min,i=this.max;if(super.configure(),this.options.offset&&t.length){const s=(i-e)/Math.max(t.length-1,1)/2;e-=s,i+=s}this._startValue=e,this._endValue=i,this._valueRange=i-e}getLabelForValue(t){return yn(t,this.chart.options.locale,this.options.ticks.format)}}class Qc extends Gc{static id="linear";static defaults={ticks:{callback:Ti.formatters.numeric}};determineDataLimits(){const{min:t,max:e}=this.getMinMax(!0);this.min=yt(t)?t:0,this.max=yt(e)?e:1,this.handleTickRangeOptions()}computeTickLimit(){const t=this.isHorizontal(),e=t?this.width:this.height,i=Bt(this.options.ticks.minRotation),s=(t?Math.sin(i):Math.cos(i))||.001,o=this._resolveTickFontOptions(0);return Math.ceil(e/Math.min(40,o.lineHeight/s))}getPixelForValue(t){return t===null?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getValueForPixel(t){return this._startValue+this.getDecimalForPixel(t)*this._valueRange}}const Qe={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}},mt=Object.keys(Qe);function to(n,t){return n-t}function eo(n,t){if(tt(t))return null;const e=n._adapter,{parser:i,round:s,isoWeekday:o}=n._parseOpts;let a=t;return typeof i=="function"&&(a=i(a)),yt(a)||(a=typeof i=="string"?e.parse(a,i):e.parse(a)),a===null?null:(s&&(a=s==="week"&&(Qt(o)||o===!0)?e.startOf(a,"isoWeek",o):e.startOf(a,s)),+a)}function no(n,t,e,i){const s=mt.length;for(let o=mt.indexOf(n);o<s-1;++o){const a=Qe[mt[o]],l=a.steps?a.steps:Number.MAX_SAFE_INTEGER;if(a.common&&Math.ceil((e-t)/(l*a.size))<=i)return mt[o]}return mt[s-1]}function Jc(n,t,e,i,s){for(let o=mt.length-1;o>=mt.indexOf(e);o--){const a=mt[o];if(Qe[a].common&&n._adapter.diff(s,i,a)>=t-1)return a}return mt[e?mt.indexOf(e):0]}function Zc(n){for(let t=mt.indexOf(n)+1,e=mt.length;t<e;++t)if(Qe[mt[t]].common)return mt[t]}function io(n,t,e){if(!e)n[t]=!0;else if(e.length){const{lo:i,hi:s}=pn(e,t),o=e[i]>=t?e[i]:e[s];n[o]=!0}}function td(n,t,e,i){const s=n._adapter,o=+s.startOf(t[0].value,i),a=t[t.length-1].value;let l,c;for(l=o;l<=a;l=+s.add(l,1,i))c=e[l],c>=0&&(t[c].major=!0);return t}function so(n,t,e){const i=[],s={},o=t.length;let a,l;for(a=0;a<o;++a)l=t[a],s[l]=a,i.push({value:l,major:!1});return o===0||!e?i:td(n,i,s,e)}class oo extends ne{static id="time";static defaults={bounds:"data",adapters:{},time:{parser:!1,unit:!1,round:!1,isoWeekday:!1,minUnit:"millisecond",displayFormats:{}},ticks:{source:"auto",callback:!1,major:{enabled:!1}}};constructor(t){super(t),this._cache={data:[],labels:[],all:[]},this._unit="day",this._majorUnit=void 0,this._offsets={},this._normalized=!1,this._parseOpts=void 0}init(t,e={}){const i=t.time||(t.time={}),s=this._adapter=new Gr._date(t.adapters.date);s.init(e),de(i.displayFormats,s.formats()),this._parseOpts={parser:i.parser,round:i.round,isoWeekday:i.isoWeekday},super.init(t),this._normalized=e.normalized}parse(t,e){return t===void 0?null:eo(this,t)}beforeLayout(){super.beforeLayout(),this._cache={data:[],labels:[],all:[]}}determineDataLimits(){const t=this.options,e=this._adapter,i=t.time.unit||"day";let{min:s,max:o,minDefined:a,maxDefined:l}=this.getUserBounds();function c(d){!a&&!isNaN(d.min)&&(s=Math.min(s,d.min)),!l&&!isNaN(d.max)&&(o=Math.max(o,d.max))}(!a||!l)&&(c(this._getLabelBounds()),(t.bounds!=="ticks"||t.ticks.source!=="labels")&&c(this.getMinMax(!1))),s=yt(s)&&!isNaN(s)?s:+e.startOf(Date.now(),i),o=yt(o)&&!isNaN(o)?o:+e.endOf(Date.now(),i)+1,this.min=Math.min(s,o-1),this.max=Math.max(s+1,o)}_getLabelBounds(){const t=this.getLabelTimestamps();let e=Number.POSITIVE_INFINITY,i=Number.NEGATIVE_INFINITY;return t.length&&(e=t[0],i=t[t.length-1]),{min:e,max:i}}buildTicks(){const t=this.options,e=t.time,i=t.ticks,s=i.source==="labels"?this.getLabelTimestamps():this._generate();t.bounds==="ticks"&&s.length&&(this.min=this._userMin||s[0],this.max=this._userMax||s[s.length-1]);const o=this.min,a=this.max,l=fa(s,o,a);return this._unit=e.unit||(i.autoSkip?no(e.minUnit,this.min,this.max,this._getLabelCapacity(o)):Jc(this,l.length,e.minUnit,this.min,this.max)),this._majorUnit=!i.major.enabled||this._unit==="year"?void 0:Zc(this._unit),this.initOffsets(s),t.reverse&&l.reverse(),so(this,l,this._majorUnit)}afterAutoSkip(){this.options.offsetAfterAutoskip&&this.initOffsets(this.ticks.map(t=>+t.value))}initOffsets(t=[]){let e=0,i=0,s,o;this.options.offset&&t.length&&(s=this.getDecimalForValue(t[0]),t.length===1?e=1-s:e=(this.getDecimalForValue(t[1])-s)/2,o=this.getDecimalForValue(t[t.length-1]),t.length===1?i=o:i=(o-this.getDecimalForValue(t[t.length-2]))/2);const a=t.length<3?.5:.25;e=ht(e,0,a),i=ht(i,0,a),this._offsets={start:e,end:i,factor:1/(e+1+i)}}_generate(){const t=this._adapter,e=this.min,i=this.max,s=this.options,o=s.time,a=o.unit||no(o.minUnit,e,i,this._getLabelCapacity(e)),l=U(s.ticks.stepSize,1),c=a==="week"?o.isoWeekday:!1,d=Qt(c)||c===!0,h={};let u=e,f,p;if(d&&(u=+t.startOf(u,"isoWeek",c)),u=+t.startOf(u,d?"day":a),t.diff(i,e,a)>1e5*l)throw new Error(e+" and "+i+" are too far apart with stepSize of "+l+" "+a);const g=s.ticks.source==="data"&&this.getDataTimestamps();for(f=u,p=0;f<i;f=+t.add(f,l,a),p++)io(h,f,g);return(f===i||s.bounds==="ticks"||p===1)&&io(h,f,g),Object.keys(h).sort(to).map(b=>+b)}getLabelForValue(t){const e=this._adapter,i=this.options.time;return i.tooltipFormat?e.format(t,i.tooltipFormat):e.format(t,i.displayFormats.datetime)}format(t,e){const s=this.options.time.displayFormats,o=this._unit,a=e||s[o];return this._adapter.format(t,a)}_tickFormatFunction(t,e,i,s){const o=this.options,a=o.ticks.callback;if(a)return st(a,[t,e,i],this);const l=o.time.displayFormats,c=this._unit,d=this._majorUnit,h=c&&l[c],u=d&&l[d],f=i[e],p=d&&u&&f&&f.major;return this._adapter.format(t,s||(p?u:h))}generateTickLabels(t){let e,i,s;for(e=0,i=t.length;e<i;++e)s=t[e],s.label=this._tickFormatFunction(s.value,e,t)}getDecimalForValue(t){return t===null?NaN:(t-this.min)/(this.max-this.min)}getPixelForValue(t){const e=this._offsets,i=this.getDecimalForValue(t);return this.getPixelForDecimal((e.start+i)*e.factor)}getValueForPixel(t){const e=this._offsets,i=this.getDecimalForPixel(t)/e.factor-e.end;return this.min+i*(this.max-this.min)}_getLabelSize(t){const e=this.options.ticks,i=this.ctx.measureText(t).width,s=Bt(this.isHorizontal()?e.maxRotation:e.minRotation),o=Math.cos(s),a=Math.sin(s),l=this._resolveTickFontOptions(0).size;return{w:i*o+l*a,h:i*a+l*o}}_getLabelCapacity(t){const e=this.options.time,i=e.displayFormats,s=i[e.unit]||i.millisecond,o=this._tickFormatFunction(t,0,so(this,[t],this._majorUnit),s),a=this._getLabelSize(o),l=Math.floor(this.isHorizontal()?this.width/a.w:this.height/a.h)-1;return l>0?l:1}getDataTimestamps(){let t=this._cache.data||[],e,i;if(t.length)return t;const s=this.getMatchingVisibleMetas();if(this._normalized&&s.length)return this._cache.data=s[0].controller.getAllParsedValues(this);for(e=0,i=s.length;e<i;++e)t=t.concat(s[e].controller.getAllParsedValues(this));return this._cache.data=this.normalize(t)}getLabelTimestamps(){const t=this._cache.labels||[];let e,i;if(t.length)return t;const s=this.getLabels();for(e=0,i=s.length;e<i;++e)t.push(eo(this,s[e]));return this._cache.labels=this._normalized?t:this.normalize(t)}normalize(t){return wi(t.sort(to))}}function Je(n,t,e){let i=0,s=n.length-1,o,a,l,c;e?(t>=n[i].pos&&t<=n[s].pos&&({lo:i,hi:s}=Ft(n,"pos",t)),{pos:o,time:l}=n[i],{pos:a,time:c}=n[s]):(t>=n[i].time&&t<=n[s].time&&({lo:i,hi:s}=Ft(n,"time",t)),{time:o,pos:l}=n[i],{time:a,pos:c}=n[s]);const d=a-o;return d?l+(c-l)*(t-o)/d:l}class bf extends oo{static id="timeseries";static defaults=oo.defaults;constructor(t){super(t),this._table=[],this._minPos=void 0,this._tableRange=void 0}initOffsets(){const t=this._getTimestampsForTable(),e=this._table=this.buildLookupTable(t);this._minPos=Je(e,this.min),this._tableRange=Je(e,this.max)-this._minPos,super.initOffsets(t)}buildLookupTable(t){const{min:e,max:i}=this,s=[],o=[];let a,l,c,d,h;for(a=0,l=t.length;a<l;++a)d=t[a],d>=e&&d<=i&&s.push(d);if(s.length<2)return[{time:e,pos:0},{time:i,pos:1}];for(a=0,l=s.length;a<l;++a)h=s[a+1],c=s[a-1],d=s[a],Math.round((h+c)/2)!==d&&o.push({time:d,pos:a/(l-1)});return o}_generate(){const t=this.min,e=this.max;let i=super.getDataTimestamps();return(!i.includes(t)||!i.length)&&i.splice(0,0,t),(!i.includes(e)||i.length===1)&&i.push(e),i.sort((s,o)=>s-o)}_getTimestampsForTable(){let t=this._cache.all||[];if(t.length)return t;const e=this.getDataTimestamps(),i=this.getLabelTimestamps();return e.length&&i.length?t=this.normalize(e.concat(i)):t=e.length?e:i,t=this._cache.all=t,t}getDecimalForValue(t){return(Je(this._table,t)-this._minPos)/this._tableRange}getValueForPixel(t){const e=this._offsets,i=this.getDecimalForPixel(t)/e.factor-e.end;return Je(this._table,i*this._tableRange+this._minPos,!0)}}function ed(n){const t=n.split(`
|
|
19
|
+
`).map(o=>o.trim()).filter(o=>o.length>0);if(t.length===0)return null;const e=t[0].split(",").map(o=>o.trim());if(e.length<2)return null;const i=[],s=e.slice(1).map(o=>({label:o,data:[]}));for(let o=1;o<t.length;o++){const a=t[o].split(",").map(l=>l.trim());if(a.length!==e.length)return null;i.push(a[0]);for(let l=1;l<a.length;l++){const c=parseFloat(a[l]);if(isNaN(c))return null;s[l-1].data.push(c)}}return{labels:i,datasets:s}}function nd(n){let t=n;for(const a of["data","result","chart"])t&&typeof t=="object"&&!Array.isArray(t)&&t[a]&&typeof t[a]=="object"&&(t=t[a]);if(!t||typeof t!="object")return null;let e=t.labels,i=t.datasets;if(Array.isArray(t)&&t.length>0&&t[0]?.label!==void 0&&t[0]?.value!==void 0&&(e=t.map(a=>a.label),i=[{label:"Series",data:t.map(a=>Number(a.value))}]),!Array.isArray(e)||!Array.isArray(i)||e.length===0||i.length===0)return null;const s=e.map(a=>String(a)),o=[];for(const a of i){if(!a||!Array.isArray(a.data))continue;const l=a.data.map(c=>{const d=Number(c);return isNaN(d)?0:d});o.push({label:String(a.label??"Series"),data:l})}return o.length===0?null:{labels:s,datasets:o}}const id={key:0,class:"chart-empty"},sd={key:1,class:"chart-loading"},se=oe(r.defineComponent({__name:"Chart",props:{type:{},title:{},height:{default:400},url:{default:""},labels:{},datasets:{},options:{default:()=>({})}},emits:["change"],setup(n,{emit:t}){Fn.register(Xc,Qc,wc,xc,Bc,Lc,jc,Oc,hc,Ur,jr,Xr,Kr);const e=n,i=t,s=r.ref(null),o=r.ref(!1),a=r.computed(()=>s.value?s.value.labels:e.labels),l=r.computed(()=>s.value?s.value.datasets:e.datasets),c=r.computed(()=>!o.value&&a.value.length===0&&l.value.length===0),d=Math.max(200,Math.min(800,e.height||400)),h=r.ref();let u=null;const f=m=>{switch(m){case"chart-line":return"line";case"chart-bar":return"bar";case"chart-pie":return"pie";case"chart-scatter":return"scatter";default:return"line"}},p=()=>["#1677ff","#52c41a","#faad14","#ff4d4f","#722ed1","#13c2c2"],g=(m,_,y)=>{const k=p();return m.map((x,S)=>{const N=k[S%k.length];let V=x.data;return _==="scatter"&&(V=x.data.map((L,C)=>({x:C,y:L}))),_==="pie"?{...x,data:V,backgroundColor:k.slice(0,x.data.length),borderColor:k.slice(0,x.data.length),borderWidth:1}:{...x,data:V,borderColor:N,backgroundColor:_==="line"?N+"20":N,borderWidth:2,fill:_!=="line"}})},b=()=>{if(!h.value)return;u&&(u.destroy(),u=null);const m=f(e.type),_=g(l.value,m,a.value),k={...{responsive:!0,maintainAspectRatio:!1,plugins:{title:{display:!!e.title,text:e.title||""},legend:{display:l.value.length>1||m==="pie"}},onClick:(S,N)=>{if(N.length>0){const V=N[0],L=V.index,C=V.datasetIndex;i("change",{label:a.value[L],value:l.value[C]?.data[L],datasetLabel:l.value[C]?.label,dataIndex:L,datasetIndex:C})}}},...e.options},x=m==="scatter"?{datasets:_}:{labels:a.value,datasets:_};u=new Fn(h.value,{type:m,data:x,options:k})};return r.watch(()=>e.url,m=>{if(!m){s.value=null;return}let _=!1;o.value=!0,(async()=>{try{const y=await fetch(m);if(!y.ok)throw new Error(`HTTP ${y.status}`);const k=await y.text();let x=null;const S=k.trim();if(S.startsWith("{")||S.startsWith("["))try{x=nd(JSON.parse(S))}catch{x=null}if(x||(x=ed(k)),!x)throw new Error("响应无法解析为图表数据(CSV 或 JSON)");s.value=x}catch{}finally{o.value=!1}})()},{immediate:!0}),r.watch([a,l],()=>{b()}),r.onMounted(()=>{b()}),r.onUnmounted(()=>{u&&(u.destroy(),u=null)}),(m,_)=>(r.openBlock(),r.createElementBlock("div",{class:"widget-chart",style:r.normalizeStyle({height:`${r.unref(d)}px`})},[c.value?(r.openBlock(),r.createElementBlock("div",id,"暂无数据")):r.createCommentVNode("",!0),o.value?(r.openBlock(),r.createElementBlock("div",sd,"数据加载中...")):r.createCommentVNode("",!0),r.createElementVNode("canvas",{ref_key:"canvasRef",ref:h},null,512)],4))}}),[["__scopeId","data-v-2c33e8c9"]]),od={key:0,class:"widget-label-row"},ad={key:0,class:"widget-required-mark","aria-hidden":"true"},rd={key:1},ld=["data-hint"],cd={class:"widget-field-content"},dd=["aria-expanded","disabled"],hd={key:0,class:"widget-error-text",role:"alert"},ud={key:0,class:"dp-panels"},fd={class:"dp-calendar"},pd={class:"dp-header"},md={class:"dp-title"},gd={class:"dp-title-year"},bd={class:"dp-week-header"},yd=["onClick","onMouseover","disabled"],_d={class:"dp-calendar"},kd={class:"dp-header"},xd={class:"dp-title"},wd={class:"dp-title-year"},Sd={class:"dp-week-header"},Cd=["onClick","onMouseover","disabled"],Ed={key:1,class:"dp-calendar"},Md={class:"dp-header"},vd={class:"dp-title"},Bd={class:"dp-title-year"},Dd={class:"dp-week-header"},Ad=["onClick","onMouseover","disabled"],Td={key:2,class:"dp-time"},Pd={class:"dp-time-groups"},Nd={class:"dp-time-group"},Od={class:"dp-time-group"},Vd={class:"dp-footer"},Ld=["disabled"],zd={key:1,class:"dp-time-group"},Rd=["disabled"],Ze=oe(r.defineComponent({__name:"DatePicker",props:{label:{default:""},picker:{default:"date"},range:{type:Boolean,default:!1},default:{},format:{},placeholder:{default:""},disableBeforeNow:{type:Boolean,default:!1},disableAfterNow:{type:Boolean,default:!1},hint:{default:""},required:{type:Boolean,default:!1},message:{default:""},error:{default:""},disabled:{type:Boolean,default:!1}},emits:["change"],setup(n,{emit:t}){const e=n,i=t,s=r.computed(()=>e.picker==="datetime"),o=r.computed(()=>e.format??(s.value?"YYYY-MM-DD HH:mm:ss":"YYYY-MM-DD"));function a(z){if(z==null||z==="")return null;if(typeof z=="number")return z;const M=String(z).trim();if(/^-?\d+$/.test(M))return Number(M);const B=M.match(/^(\d{4})[-/](\d{1,2})[-/](\d{1,2})(?:[ T](\d{1,2}):(\d{1,2})(?::(\d{1,2}))?)?/);if(B)return new Date(Number(B[1]),Number(B[2])-1,Number(B[3]),Number(B[4]??0),Number(B[5]??0),Number(B[6]??0)).getTime();const dt=Date.parse(M);return isNaN(dt)?null:dt}function l(z){return String(z).padStart(2,"0")}function c(z){const M=new Date(z);return o.value.replace(/YYYY/g,String(M.getFullYear())).replace(/MM/g,l(M.getMonth()+1)).replace(/DD/g,l(M.getDate())).replace(/HH/g,l(M.getHours())).replace(/mm/g,l(M.getMinutes())).replace(/ss/g,l(M.getSeconds()))}const d=r.ref(null),h=r.ref(null),u=r.ref(null),f=e.default;f!=null&&(e.range&&Array.isArray(f)&&f.length>=2?(h.value=a(f[0]),u.value=a(f[1])):e.range&&!Array.isArray(f)?h.value=a(f):e.range||(d.value=a(Array.isArray(f)?f[0]:f)));const p=r.ref(!1),g=r.ref(new Date().getFullYear()),b=r.ref(new Date().getMonth()),m=r.reactive({h:0,m:0,s:0}),_=r.reactive({h:0,m:0,s:0}),y=r.reactive({h:0,m:0,s:0}),k=r.ref(!1),x=r.ref(null),S=r.ref();function N(z){S.value&&!S.value.contains(z.target)&&(p.value=!1)}r.onMounted(()=>document.addEventListener("mousedown",N)),r.onBeforeUnmount(()=>document.removeEventListener("mousedown",N));function V(z,M){const B=new Date(M);z.h=B.getHours(),z.m=B.getMinutes(),z.s=B.getSeconds()}function L(){const z=e.range?h.value??u.value:d.value,M=z!==null?new Date(z):new Date;g.value=M.getFullYear(),b.value=M.getMonth(),e.range?(h.value!==null&&V(_,h.value),u.value!==null&&V(y,u.value)):d.value!==null&&V(m,d.value)}function C(){e.disabled||(p.value=!p.value,p.value&&(k.value=!1,L()))}const T=["一","二","三","四","五","六","日"];function P(z,M){const dt=(new Date(z,M,1).getDay()+6)%7,gt=new Date(z,M,1-dt),Xt=[],zt=new Date,Kt=new Date(zt.getFullYear(),zt.getMonth(),zt.getDate()).getTime();for(let ti=0;ti<42;ti++){const ei=new Date(gt.getFullYear(),gt.getMonth(),gt.getDate()+ti),ni=ei.getTime();let ii=!1;e.disableBeforeNow&&ni<Kt&&(ii=!0),e.disableAfterNow&&ni>Kt&&(ii=!0),Xt.push({ts:ni,day:ei.getDate(),inMonth:ei.getMonth()===M,disabled:ii})}return Xt}function O(z){const M=new Date(z);return new Date(M.getFullYear(),M.getMonth(),M.getDate()).getTime()}const F=r.computed(()=>P(g.value,b.value)),H=r.computed(()=>`${b.value+1}月`),q=r.computed(()=>b.value===11?g.value+1:g.value),Y=r.computed(()=>b.value===11?0:b.value+1),G=r.computed(()=>P(q.value,Y.value)),ot=r.computed(()=>`${Y.value+1}月`);function E(){b.value===0?(b.value=11,g.value--):b.value--}function R(){b.value===11?(b.value=0,g.value++):b.value++}function A(){g.value--}function $(){g.value++}function j(z,M){return s.value?new Date(z).setHours(M.h,M.m,M.s,0):new Date(z).setHours(0,0,0,0)}function w(){e.range?i("change",h.value!==null&&u.value!==null?[h.value,u.value]:[]):i("change",d.value)}function D(z){z.disabled||(e.range?!k.value||h.value===null||z.ts<O(h.value)?(h.value=j(z.ts,_),u.value=null,k.value=!0):(u.value=j(z.ts,y),k.value=!1,s.value||(p.value=!1),w()):(d.value=j(z.ts,m),s.value||(p.value=!1),w()))}function v(z,M,B){const dt=B.target,gt=parseInt(dt.value,10);if(isNaN(gt))return;const zt=Math.min(M==="h"?23:59,Math.max(0,gt)),Kt=z==="single"?m:z==="start"?_:y;Kt[M]=zt,z==="single"&&d.value!==null&&(d.value=j(d.value,m),w()),z==="start"&&h.value!==null&&(h.value=j(h.value,_),u.value!==null&&w()),z==="end"&&u.value!==null&&(u.value=j(u.value,y),h.value!==null&&w())}function I(){d.value=null,h.value=null,u.value=null,k.value=!1,p.value=!1,i("change",e.range?[]:null)}function W(){e.range?(h.value!==null&&(h.value=j(h.value,_)),u.value!==null&&(u.value=j(u.value,y)),w()):d.value!==null&&(d.value=j(d.value,m),w()),p.value=!1}const X=r.computed(()=>h.value!==null?c(h.value):""),J=r.computed(()=>u.value!==null?c(u.value):""),K=r.computed(()=>e.error||"");function Z(z){const M=O(z.ts);let B="dp-cell";if(z.inMonth||(B+=" dp-cell-out"),z.disabled)return B+=" dp-cell-disabled",B;const dt=O(Date.now());if(M===dt&&(B+=" dp-cell-today"),e.range&&h.value!==null){const gt=O(h.value),Xt=u.value!==null?O(u.value):k.value&&x.value!==null?O(x.value):null;if(Xt!==null){const zt=Math.min(gt,Xt),Kt=Math.max(gt,Xt);M===zt&&(B+=" dp-cell-range-start"),M===Kt&&(B+=" dp-cell-range-end"),M>zt&&M<Kt&&(B+=" dp-cell-in-range")}else M===gt&&(B+=" dp-cell-range-start")}else d.value!==null&&M===O(d.value)&&(B+=" dp-cell-selected");return B}return(z,M)=>(r.openBlock(),r.createElementBlock("div",{class:"selector widget-date-picker",ref_key:"rootEl",ref:S},[z.label||z.hint||z.required?(r.openBlock(),r.createElementBlock("div",od,[z.required?(r.openBlock(),r.createElementBlock("span",ad,"*")):r.createCommentVNode("",!0),z.label?(r.openBlock(),r.createElementBlock("label",rd,r.toDisplayString(z.label),1)):r.createCommentVNode("",!0),z.hint?(r.openBlock(),r.createElementBlock("span",{key:2,class:"widget-hint","data-hint":z.hint},"ⓘ",8,ld)):r.createCommentVNode("",!0)])):r.createCommentVNode("",!0),r.createElementVNode("div",cd,[r.createElementVNode("button",{type:"button",class:r.normalizeClass(["dp-input",{"widget-input-error":!!K.value}]),onClick:C,"aria-expanded":p.value,disabled:z.disabled},[M[22]||(M[22]=r.createElementVNode("span",{class:"dp-input-icon","aria-hidden":"true"},"📅",-1)),z.range?(r.openBlock(),r.createElementBlock(r.Fragment,{key:0},[r.createElementVNode("span",{class:r.normalizeClass(["dp-input-text dp-seg",{"dp-placeholder":!X.value}])},r.toDisplayString(X.value||z.placeholder||(s.value?"开始时间":"开始日期")),3),M[21]||(M[21]=r.createElementVNode("span",{class:"dp-sep","aria-hidden":"true"},"→",-1)),r.createElementVNode("span",{class:r.normalizeClass(["dp-input-text dp-seg",{"dp-placeholder":!J.value}])},r.toDisplayString(J.value||(s.value?"结束时间":"结束日期")),3)],64)):(r.openBlock(),r.createElementBlock("span",{key:1,class:r.normalizeClass(["dp-input-text",{"dp-placeholder":!X.value&&d.value===null}])},r.toDisplayString(d.value!==null?c(d.value):z.placeholder||"请选择日期"),3)),!z.disabled&&(z.range?X.value||J.value:d.value!==null)?(r.openBlock(),r.createElementBlock("span",{key:2,class:"dp-clear",role:"button",tabindex:"-1","aria-label":"清空",onClick:r.withModifiers(I,["stop"])},"×")):r.createCommentVNode("",!0)],10,dd),K.value?(r.openBlock(),r.createElementBlock("div",hd,r.toDisplayString(K.value),1)):r.createCommentVNode("",!0),p.value?(r.openBlock(),r.createElementBlock("div",{key:1,class:r.normalizeClass(["dp-panel",{"dp-range":z.range}])},[z.range?(r.openBlock(),r.createElementBlock("div",ud,[r.createElementVNode("div",fd,[r.createElementVNode("div",pd,[r.createElementVNode("div",{class:"dp-header-nav"},[r.createElementVNode("button",{type:"button",class:"dp-nav",onClick:A,"aria-label":"上一年"},"«"),r.createElementVNode("button",{type:"button",class:"dp-nav",onClick:E,"aria-label":"上个月"},"‹")]),r.createElementVNode("span",md,[r.createElementVNode("span",gd,r.toDisplayString(g.value)+"年",1),r.createTextVNode(r.toDisplayString(H.value),1)]),M[23]||(M[23]=r.createElementVNode("div",{class:"dp-header-nav"},null,-1))]),r.createElementVNode("div",bd,[(r.openBlock(),r.createElementBlock(r.Fragment,null,r.renderList(T,B=>r.createElementVNode("span",{key:B,class:"dp-week"},r.toDisplayString(B),1)),64))]),r.createElementVNode("div",{class:"dp-grid",onMouseleave:M[0]||(M[0]=B=>x.value=null)},[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(F.value,B=>(r.openBlock(),r.createElementBlock("button",{key:B.ts,type:"button",class:r.normalizeClass(Z(B)),onClick:dt=>D(B),onMouseover:dt=>x.value=B.ts,disabled:B.disabled},r.toDisplayString(B.day),43,yd))),128))],32)]),r.createElementVNode("div",_d,[r.createElementVNode("div",kd,[M[24]||(M[24]=r.createElementVNode("div",{class:"dp-header-nav"},null,-1)),r.createElementVNode("span",xd,[r.createElementVNode("span",wd,r.toDisplayString(q.value)+"年",1),r.createTextVNode(r.toDisplayString(ot.value),1)]),r.createElementVNode("div",{class:"dp-header-nav"},[r.createElementVNode("button",{type:"button",class:"dp-nav",onClick:R,"aria-label":"下个月"},"›"),r.createElementVNode("button",{type:"button",class:"dp-nav",onClick:$,"aria-label":"下一年"},"»")])]),r.createElementVNode("div",Sd,[(r.openBlock(),r.createElementBlock(r.Fragment,null,r.renderList(T,B=>r.createElementVNode("span",{key:B,class:"dp-week"},r.toDisplayString(B),1)),64))]),r.createElementVNode("div",{class:"dp-grid",onMouseleave:M[1]||(M[1]=B=>x.value=null)},[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(G.value,B=>(r.openBlock(),r.createElementBlock("button",{key:B.ts,type:"button",class:r.normalizeClass(Z(B)),onClick:dt=>D(B),onMouseover:dt=>x.value=B.ts,disabled:B.disabled},r.toDisplayString(B.day),43,Cd))),128))],32)])])):(r.openBlock(),r.createElementBlock("div",Ed,[r.createElementVNode("div",Md,[r.createElementVNode("div",{class:"dp-header-nav"},[r.createElementVNode("button",{type:"button",class:"dp-nav",onClick:A,"aria-label":"上一年"},"«"),r.createElementVNode("button",{type:"button",class:"dp-nav",onClick:E,"aria-label":"上个月"},"‹")]),r.createElementVNode("span",vd,[r.createElementVNode("span",Bd,r.toDisplayString(g.value)+"年",1),r.createTextVNode(r.toDisplayString(H.value),1)]),r.createElementVNode("div",{class:"dp-header-nav"},[r.createElementVNode("button",{type:"button",class:"dp-nav",onClick:R,"aria-label":"下个月"},"›"),r.createElementVNode("button",{type:"button",class:"dp-nav",onClick:$,"aria-label":"下一年"},"»")])]),r.createElementVNode("div",Dd,[(r.openBlock(),r.createElementBlock(r.Fragment,null,r.renderList(T,B=>r.createElementVNode("span",{key:B,class:"dp-week"},r.toDisplayString(B),1)),64))]),r.createElementVNode("div",{class:"dp-grid",onMouseleave:M[2]||(M[2]=B=>x.value=null)},[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(F.value,B=>(r.openBlock(),r.createElementBlock("button",{key:B.ts,type:"button",class:r.normalizeClass(Z(B)),onClick:dt=>D(B),onMouseover:dt=>x.value=B.ts,disabled:B.disabled},r.toDisplayString(B.day),43,Ad))),128))],32)])),s.value?(r.openBlock(),r.createElementBlock("div",Td,[z.range?(r.openBlock(),r.createElementBlock(r.Fragment,{key:0},[r.createElementVNode("div",Pd,[r.createElementVNode("div",Nd,[M[25]||(M[25]=r.createElementVNode("span",{class:"dp-time-label"},"开始",-1)),r.withDirectives(r.createElementVNode("input",{class:"dp-time-input",type:"number",min:"0",max:"23","onUpdate:modelValue":M[3]||(M[3]=B=>_.h=B),onInput:M[4]||(M[4]=B=>v("start","h",B)),"aria-label":"开始 时"},null,544),[[r.vModelText,_.h,void 0,{number:!0}]]),M[26]||(M[26]=r.createElementVNode("span",{class:"dp-time-sep"},":",-1)),r.withDirectives(r.createElementVNode("input",{class:"dp-time-input",type:"number",min:"0",max:"59","onUpdate:modelValue":M[5]||(M[5]=B=>_.m=B),onInput:M[6]||(M[6]=B=>v("start","m",B)),"aria-label":"开始 分"},null,544),[[r.vModelText,_.m,void 0,{number:!0}]]),M[27]||(M[27]=r.createElementVNode("span",{class:"dp-time-sep"},":",-1)),r.withDirectives(r.createElementVNode("input",{class:"dp-time-input",type:"number",min:"0",max:"59","onUpdate:modelValue":M[7]||(M[7]=B=>_.s=B),onInput:M[8]||(M[8]=B=>v("start","s",B)),"aria-label":"开始 秒"},null,544),[[r.vModelText,_.s,void 0,{number:!0}]])]),M[31]||(M[31]=r.createElementVNode("span",{class:"dp-time-arrow","aria-hidden":"true"},"~",-1)),r.createElementVNode("div",Od,[M[28]||(M[28]=r.createElementVNode("span",{class:"dp-time-label"},"结束",-1)),r.withDirectives(r.createElementVNode("input",{class:"dp-time-input",type:"number",min:"0",max:"23","onUpdate:modelValue":M[9]||(M[9]=B=>y.h=B),onInput:M[10]||(M[10]=B=>v("end","h",B)),"aria-label":"结束 时"},null,544),[[r.vModelText,y.h,void 0,{number:!0}]]),M[29]||(M[29]=r.createElementVNode("span",{class:"dp-time-sep"},":",-1)),r.withDirectives(r.createElementVNode("input",{class:"dp-time-input",type:"number",min:"0",max:"59","onUpdate:modelValue":M[11]||(M[11]=B=>y.m=B),onInput:M[12]||(M[12]=B=>v("end","m",B)),"aria-label":"结束 分"},null,544),[[r.vModelText,y.m,void 0,{number:!0}]]),M[30]||(M[30]=r.createElementVNode("span",{class:"dp-time-sep"},":",-1)),r.withDirectives(r.createElementVNode("input",{class:"dp-time-input",type:"number",min:"0",max:"59","onUpdate:modelValue":M[13]||(M[13]=B=>y.s=B),onInput:M[14]||(M[14]=B=>v("end","s",B)),"aria-label":"结束 秒"},null,544),[[r.vModelText,y.s,void 0,{number:!0}]])])]),r.createElementVNode("div",Vd,[r.createElementVNode("button",{type:"button",class:"dp-ok",onClick:W,disabled:h.value===null},"确定",8,Ld)])],64)):(r.openBlock(),r.createElementBlock("div",zd,[r.withDirectives(r.createElementVNode("input",{class:"dp-time-input",type:"number",min:"0",max:"23","onUpdate:modelValue":M[15]||(M[15]=B=>m.h=B),onInput:M[16]||(M[16]=B=>v("single","h",B)),"aria-label":"时"},null,544),[[r.vModelText,m.h,void 0,{number:!0}]]),M[32]||(M[32]=r.createElementVNode("span",{class:"dp-time-sep"},":",-1)),r.withDirectives(r.createElementVNode("input",{class:"dp-time-input",type:"number",min:"0",max:"59","onUpdate:modelValue":M[17]||(M[17]=B=>m.m=B),onInput:M[18]||(M[18]=B=>v("single","m",B)),"aria-label":"分"},null,544),[[r.vModelText,m.m,void 0,{number:!0}]]),M[33]||(M[33]=r.createElementVNode("span",{class:"dp-time-sep"},":",-1)),r.withDirectives(r.createElementVNode("input",{class:"dp-time-input",type:"number",min:"0",max:"59","onUpdate:modelValue":M[19]||(M[19]=B=>m.s=B),onInput:M[20]||(M[20]=B=>v("single","s",B)),"aria-label":"秒"},null,544),[[r.vModelText,m.s,void 0,{number:!0}]]),r.createElementVNode("button",{type:"button",class:"dp-ok",onClick:W,disabled:d.value===null},"确定",8,Rd)]))])):r.createCommentVNode("",!0)],2)):r.createCommentVNode("",!0)])],512))}}),[["__scopeId","data-v-97efc0bb"]]);function Id(n){let t=n;return Array.isArray(n)||(t=Array.isArray(n?.data)?n.data:Array.isArray(n?.options)?n.options:Array.isArray(n?.choices)?n.choices:Array.isArray(n?.items)?n.items:[]),t.map(e=>{if(typeof e=="string"||typeof e=="number"){const i=String(e);return i?{value:i,label:i}:null}if(e&&typeof e=="object"){const i=e.value??e.key??e.id??e.name;if(i==null||i==="")return null;const s=e.label??e.name??e.text??String(i);return{value:String(i),label:String(s)}}return null}).filter(e=>e!==null)}function jn(n){const t=String(n??""),e=t.indexOf(":");if(e>0){const i=t.slice(0,e),s=t.slice(e+1);if(i&&s&&!/\s/.test(i)&&!/^\d+$/.test(i)&&!s.startsWith("//"))return{value:i,label:s}}return{value:t,label:t}}function Fd(n,t){const e=jn(n).value,i=t.find(s=>s.value===n||s.label===n||s.value===e);return i?i.value:n}const $d={key:0,class:"widget-label-row"},Wd={key:0,class:"widget-required-mark","aria-hidden":"true"},Hd={key:1},jd=["data-hint"],qd={class:"widget-field-content widget-select-content"},Yd=["disabled","aria-expanded"],Ud={key:0,class:"cas-panel cas-panel-single"},Xd={key:0,class:"cas-search"},Kd={class:"cas-menu cas-menu-full",role:"menu"},Gd=["onClick"],Qd={class:"cas-option-label"},Jd={key:0,class:"cas-empty"},qn=oe(r.defineComponent({__name:"Select",props:{choices:{},label:{default:""},default:{},url:{default:""},searchable:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},hint:{default:""},required:{type:Boolean,default:!1}},emits:["change"],setup(n,{emit:t}){const e=n,i=t,s=r.ref(null),o=r.computed(()=>s.value??(e.choices||[]).map(jn)),a=r.ref(e.default!==void 0?jn(e.default).value:o.value[0]?.value??""),l=r.ref(!1);async function c(){if(e.url){l.value=!0;try{const y=await fetch(e.url);if(!y.ok)throw new Error(`HTTP ${y.status}`);const k=await y.json(),x=Id(k);if(x.length===0)throw new Error("响应中没有可用选项");if(s.value=x,!x.some(S=>S.value===a.value)){const S=e.default!==void 0?Fd(e.default,x):a.value,N=x.some(V=>V.value===S)?S:x[0].value;N!==a.value&&(a.value=N,i("change",N))}}catch{}finally{l.value=!1}}}r.onMounted(c),r.watch(()=>e.url,c);const d=r.ref(null),h=r.ref(null),u=r.ref(!1),f=r.ref(""),p=r.computed(()=>o.value.find(y=>y.value===a.value)?.label??""),g=r.computed(()=>{if(!e.searchable)return o.value;const y=f.value.trim().toLowerCase();return y?o.value.filter(k=>k.value.toLowerCase().includes(y)||k.label.toLowerCase().includes(y)):o.value});function b(y){d.value&&!d.value.contains(y.target)&&(u.value=!1)}r.onMounted(()=>document.addEventListener("mousedown",b)),r.onBeforeUnmount(()=>document.removeEventListener("mousedown",b));function m(){e.disabled||(u.value=!u.value,u.value&&e.searchable&&(f.value="",r.nextTick(()=>h.value?.focus())))}function _(y){e.disabled||(a.value=y,u.value=!1,i("change",y))}return(y,k)=>(r.openBlock(),r.createElementBlock("div",{class:"selector",ref_key:"rootEl",ref:d},[y.label||y.hint||y.required?(r.openBlock(),r.createElementBlock("div",$d,[y.required?(r.openBlock(),r.createElementBlock("span",Wd,"*")):r.createCommentVNode("",!0),y.label?(r.openBlock(),r.createElementBlock("label",Hd,r.toDisplayString(y.label),1)):r.createCommentVNode("",!0),y.hint?(r.openBlock(),r.createElementBlock("span",{key:2,class:"widget-hint","data-hint":y.hint},"ⓘ",8,jd)):r.createCommentVNode("",!0)])):r.createCommentVNode("",!0),r.createElementVNode("div",qd,[r.createElementVNode("button",{type:"button",class:"cas-input",disabled:y.disabled,"aria-expanded":u.value,onClick:m},[r.createElementVNode("span",{class:r.normalizeClass(["cas-input-text",{"cas-placeholder":!p.value}])},r.toDisplayString(l.value?"加载中…":p.value||"请选择"),3),r.createElementVNode("span",{class:r.normalizeClass(["cas-arrow",{"cas-arrow-open":u.value}]),"aria-hidden":"true"},"▾",2)],8,Yd),u.value?(r.openBlock(),r.createElementBlock("div",Ud,[y.searchable?(r.openBlock(),r.createElementBlock("div",Xd,[r.withDirectives(r.createElementVNode("input",{ref_key:"searchEl",ref:h,type:"text",class:"cas-search-input","onUpdate:modelValue":k[0]||(k[0]=x=>f.value=x),placeholder:"搜索选项…"},null,512),[[r.vModelText,f.value]])])):r.createCommentVNode("",!0),r.createElementVNode("div",Kd,[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(g.value,x=>(r.openBlock(),r.createElementBlock("button",{key:x.value,type:"button",class:r.normalizeClass(["cas-option",{"cas-option-active":a.value===x.value}]),onClick:S=>_(x.value)},[r.createElementVNode("span",Qd,r.toDisplayString(x.label),1)],10,Gd))),128)),g.value.length===0?(r.openBlock(),r.createElementBlock("div",Jd,r.toDisplayString(l.value?"加载中…":f.value.trim()?"无匹配选项":"暂无数据"),1)):r.createCommentVNode("",!0)])])):r.createCommentVNode("",!0)])],512))}}),[["__scopeId","data-v-8fbaaa98"]]),Zd={key:0,class:"widget-label-row"},th={key:0,class:"widget-required-mark","aria-hidden":"true"},eh={key:1},nh=["data-hint"],ih={class:"widget-field-content"},sh=["disabled","aria-expanded","data-full"],oh={key:0,class:"ts-tag ts-tag-more"},ah={key:0,class:"widget-error-text",role:"alert"},rh={key:1,class:"ts-panel"},lh={key:0,class:"ts-search"},ch={class:"ts-tree",role:"tree"},dh={key:1,class:"ts-empty"},hh=r.defineComponent({name:"TreeNode",props:{node:{type:Object,required:!0},depth:{type:Number,required:!0},multiple:{type:Boolean,default:!1},checked:{type:Boolean,default:!1},indeterminate:{type:Boolean,default:!1},treeLine:{type:Boolean,default:!1},lazy:{type:Boolean,default:!1},url:{type:String,default:""}},emits:["toggle","check","load"],setup(n,{emit:t}){return()=>{const{node:e,depth:i,multiple:s,checked:o,indeterminate:a,treeLine:l}=n,c=n.lazy&&!!n.url&&!e.loaded&&e.children.length===0,d=e.children.length>0||c,h=16+i*20,u=r.h("span",{class:"ts-node-label",style:{paddingLeft:"8px"}},e.label);let f;s?f=r.h("span",{class:["ts-checkbox",o?"ts-checked":"",a?"ts-indeterminate":""].filter(Boolean),role:"checkbox","aria-checked":a?"mixed":o?"true":"false",style:o||a?{color:"#1677ff"}:void 0},o?"☑":a?"▣":"☐"):f=r.h("span",{class:["ts-radio",o?"ts-radio-checked":""].filter(Boolean),role:"radio","aria-checked":o?"true":"false",style:o?{color:"#1677ff"}:void 0},o?"●":"○");const p=d?r.h("span",{class:"ts-node-arrow","aria-hidden":"true",onClick:g=>{g.stopPropagation(),t("toggle",e.value,!0)}},"▸"):r.h("span",{class:"ts-node-leaf","aria-hidden":"true"},"·");return r.h("div",{class:["ts-node",l?"ts-tree-line":""].filter(Boolean),role:"treeitem",style:{paddingLeft:`${h}px`},onClick:()=>{d&&(t("toggle",e.value,!0),c&&t("load",e)),(!d||s)&&t("check",e)},onDblclick:()=>{n.lazy&&n.url&&d&&!e.loaded&&t("load",e)}},[f,p,u])}}}),uh={},fh=r.defineComponent({...uh,__name:"TreeSelect",props:{choices:{default:()=>[]},data:{default:void 0},url:{default:""},lazy:{type:Boolean,default:!1},multiple:{type:Boolean,default:!1},checkStrictly:{type:Boolean,default:!1},showCheckedStrategy:{default:"all"},maxTagCount:{default:void 0},treeLine:{type:Boolean,default:!1},label:{default:""},default:{default:""},placeholder:{default:""},hint:{default:""},required:{type:Boolean,default:!1},message:{default:""},error:{default:""},disabled:{type:Boolean,default:!1},searchable:{type:Boolean,default:!1}},emits:["change"],setup(n,{emit:t}){const e=n,i=t;function s(w){const D=w.indexOf(":");if(D>0){const v=w.slice(0,D).trim(),I=w.slice(D+1).trim();if(v&&I)return{value:v,label:I}}return{value:w.trim(),label:w.trim()}}function o(w,D=0){return Array.isArray(w)?w.map(v=>{const I=v.value??v.key,W=v.children,X=Array.isArray(W)&&W.length>0,J=v.loaded===!0;return{value:String(I??""),label:String(v.label??I??""),children:o(W,D+1),loaded:X||J,depth:D}}):[]}function a(w){const D=[];for(const v of w){if(!v)continue;const I=v.split("/").map(X=>X.trim()).filter(Boolean);if(I.length===0)continue;let W=D;for(let X=0;X<I.length;X++){const{value:J,label:K}=s(I[X]);let Z=W.find(z=>z.value===J);Z||(Z={value:J,label:K,children:[],loaded:!1,depth:X},W.push(Z)),W=Z.children}}return D}function l(w){let D=w;Array.isArray(w)||(D=Array.isArray(w?.data)?w.data:Array.isArray(w?.options)?w.options:Array.isArray(w?.choices)?w.choices:Array.isArray(w?.items)?w.items:Array.isArray(w?.tree)?w.tree:Array.isArray(w?.treeData)?w.treeData:[]);const v=I=>(I||[]).map(W=>{if(!W||typeof W!="object")return null;const X=W.value??W.key;if(X==null||X==="")return null;const J={value:String(X)},K=W.label??W.name??W.text;return K!=null&&(J.label=String(K)),Array.isArray(W.children)&&W.children.length>0&&(J.children=v(W.children)),J}).filter(W=>W!==null);return v(D)}const c=r.ref(null),d=r.ref(!1),h=r.ref(new Set),u=r.ref([]),f=r.ref(""),p=r.ref(!1),g=r.ref(null),b=r.ref(null),m=r.computed(()=>c.value?o(c.value):Array.isArray(e.data)&&e.data.length>0?o(e.data):a(e.choices)),_=r.computed(()=>{if(!f.value.trim())return m.value;const w=f.value.toLowerCase();return y(m.value,w)});function y(w,D){const v=[];for(const I of w){const W=I.label.toLowerCase().includes(D),X=y(I.children,D);(W||X.length>0)&&v.push({...I,children:X.length>0?X:I.children,loaded:X.length>0?!0:I.loaded})}return v}const k=r.computed(()=>{const w=[];function D(v){for(const I of v)w.push(I),h.value.has(I.value)&&I.children.length>0&&D(I.children)}return D(_.value),w}),x=r.computed(()=>{const w=u.value[0];if(!w)return"";function D(v){for(const I of v){if(I.value===w)return I.label;const W=D(I.children);if(W)return W}return""}return D(m.value)}),S=r.computed(()=>T.value.slice(0,L.value).map(w=>({value:w,label:N(w)})));function N(w){function D(v){for(const I of v){if(I.value===w)return I.label;const W=D(I.children);if(W)return W}return w}return D(m.value)}function V(w,D=m.value){for(const v of D){if(v.value===w)return v;const I=V(w,v.children);if(I)return I}}const L=r.computed(()=>typeof e.maxTagCount=="number"&&e.maxTagCount>=0?e.maxTagCount:1/0),C=r.computed(()=>!e.multiple||u.value.length===0?"":T.value.map(w=>N(w)).join(", ")),T=r.computed(()=>{const w=u.value;if(!e.multiple||e.checkStrictly||e.showCheckedStrategy==="all")return w;const D=new Set(w);if(e.showCheckedStrategy==="child")return w.filter(K=>{const Z=V(K);return!Z||Z.children.length===0});const v=[],I=K=>K.children.length===0?D.has(K.value):K.children.every(I),W=K=>{for(const Z of K)Z.children.length>0&&I(Z)?v.push(Z.value):(W(Z.children),Z.children.length===0&&D.has(Z.value)&&v.push(Z.value))};W(m.value);const X=new Set,J=K=>{for(const Z of K)X.add(Z.value),J(Z.children)};J(m.value);for(const K of w)X.has(K)||v.push(K);return v});r.watch(f,w=>{if(!w.trim())return;const D=w.toLowerCase(),v=new Set;function I(W,X){for(const J of W)J.label.toLowerCase().includes(D)&&X.forEach(K=>v.add(K)),J.children.length>0&&I(J.children,[...X,J.value])}I(m.value,[]),v.forEach(W=>h.value.add(W))});function P(){e.disabled||(p.value=!p.value,p.value&&e.searchable&&(f.value="",r.nextTick(()=>g.value?.focus())))}function O(w,D){if(D){const v=new Set(h.value);v.has(w)?v.delete(w):v.add(w),h.value=v}}function F(w){return e.checkStrictly||!e.multiple||w.children.length===0?u.value.includes(w.value):w.children.every(D=>F(D))}function H(w){if(e.checkStrictly||w.children.length===0)return!1;const D=w.children.map(v=>F(v)||H(v));return D.some(Boolean)&&!D.every(Boolean)}function q(w){if($=!0,e.multiple)if(e.checkStrictly)u.value=u.value.includes(w.value)?u.value.filter(D=>D!==w.value):[...u.value,w.value];else{let D=function(W,X){X?v.add(W.value):v.delete(W.value),W.children.forEach(J=>D(J,X))};const v=new Set(u.value);v.has(w.value)?v.delete(w.value):v.add(w.value);const I=v.has(w.value);D(w,I),u.value=Array.from(v)}else u.value=[w.value],p.value=!1;i("change",e.multiple?T.value:u.value[0]??"")}function Y(w,D=m.value){for(const v of D){if(v.value===w)return[v.value];if(v.children.length>0){const I=Y(w,v.children);if(I)return[v.value,...I]}}return null}async function G(w){if(!(!e.url||w.loaded)){d.value=!0;try{let D=function(J,K,Z){return J.map(z=>String(z.value??z.key??"")!==K[0]?z:K.length===1?{...z,children:Z,loaded:!0}:{...z,children:D(z.children||[],K.slice(1),Z)})};const v=e.url.includes("?")?"&":"?",I=await fetch(`${e.url}${v}parent=${encodeURIComponent(w.value)}`);if(!I.ok)throw new Error;const W=await I.json(),X=l(W);if(c.value){const J=Y(w.value)??[w.value];c.value=D(c.value,J,X)}}catch{}finally{d.value=!1}}}function ot(){const w=new Set;function D(v){for(const I of v)I.children.length>0&&(w.add(I.value),D(I.children))}D(m.value),h.value=w}function E(){h.value=new Set}function R(){$=!0,u.value=[],i("change",e.multiple?[]:"")}function A(w){const D=e.default;if(!D)return{values:[],ancestors:[]};const v=Array.isArray(D)?D.map(String):String(D).split(",").map(J=>J.trim()).filter(Boolean),I=[],W=[];function X(J,K,Z){for(const z of J){if(z.value===K||z.label===K)return[...Z,z.value];const M=X(z.children,K,[...Z,z.value]);if(M)return M}return null}for(const J of v){const K=J.split("/").map(B=>B.trim()).filter(Boolean);let Z=w,z;const M=[];for(const B of K){const dt=Z.find(gt=>gt.value===B)??Z.find(gt=>gt.label===B);if(!dt){z=void 0;break}M.push(dt.value),z=dt,Z=dt.children}if(z)I.push(z.value),W.push(...M.slice(0,-1));else if(K.length===1){const B=X(w,K[0],[]);B&&(I.push(B[B.length-1]),W.push(...B.slice(0,-1)))}}return{values:[...new Set(I)],ancestors:[...new Set(W)]}}let $=!1;if(r.watch(()=>[e.default,m.value],()=>{if($)return;const{values:w,ancestors:D}=A(m.value);u.value=w;const v=new Set(h.value);D.forEach(I=>v.add(I)),h.value=v},{immediate:!0}),e.url){let w=!1;d.value=!0,(async()=>{try{const D=await fetch(e.url);if(!D.ok)throw new Error;const v=await D.json();c.value=l(v)}catch{}finally{d.value=!1}})()}function j(w){b.value&&!b.value.contains(w.target)&&(p.value=!1)}return r.onMounted(()=>document.addEventListener("mousedown",j)),r.onBeforeUnmount(()=>document.removeEventListener("mousedown",j)),(w,D)=>(r.openBlock(),r.createElementBlock("div",{class:"selector widget-tree-select",ref_key:"rootEl",ref:b},[w.label||w.hint||w.required?(r.openBlock(),r.createElementBlock("div",Zd,[w.required?(r.openBlock(),r.createElementBlock("span",th,"*")):r.createCommentVNode("",!0),w.label?(r.openBlock(),r.createElementBlock("label",eh,r.toDisplayString(w.label),1)):r.createCommentVNode("",!0),w.hint?(r.openBlock(),r.createElementBlock("span",{key:2,class:"widget-hint","data-hint":w.hint},"ⓘ",8,nh)):r.createCommentVNode("",!0)])):r.createCommentVNode("",!0),r.createElementVNode("div",ih,[r.createElementVNode("button",{type:"button",class:r.normalizeClass(["ts-input",{"widget-input-error":!!w.error}]),disabled:w.disabled,"aria-expanded":p.value,"data-full":C.value,onClick:P},[w.multiple&&u.value.length>0?(r.openBlock(),r.createElementBlock(r.Fragment,{key:0},[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(S.value,v=>(r.openBlock(),r.createElementBlock("span",{class:"ts-tag",key:v.value},r.toDisplayString(v.label),1))),128)),T.value.length>L.value?(r.openBlock(),r.createElementBlock("span",oh,"(+"+r.toDisplayString(T.value.length-L.value)+")",1)):r.createCommentVNode("",!0)],64)):(r.openBlock(),r.createElementBlock("span",{key:1,class:r.normalizeClass(["ts-input-text",{"ts-placeholder":u.value.length===0}])},r.toDisplayString(x.value||w.placeholder||"请选择"),3)),!w.disabled&&u.value.length>0?(r.openBlock(),r.createElementBlock("span",{key:2,class:"ts-clear",role:"button",tabindex:"-1","aria-label":"清空",onClick:r.withModifiers(R,["stop"])},"×")):w.disabled?r.createCommentVNode("",!0):(r.openBlock(),r.createElementBlock("span",{key:3,class:r.normalizeClass(["ts-arrow",{"ts-arrow-open":p.value}]),"aria-hidden":"true"},"▾",2))],10,sh),w.error?(r.openBlock(),r.createElementBlock("div",ah,r.toDisplayString(w.error),1)):r.createCommentVNode("",!0),p.value?(r.openBlock(),r.createElementBlock("div",rh,[w.searchable?(r.openBlock(),r.createElementBlock("div",lh,[r.withDirectives(r.createElementVNode("input",{ref_key:"searchInputEl",ref:g,"onUpdate:modelValue":D[0]||(D[0]=v=>f.value=v),type:"text",class:"ts-search-input",placeholder:"搜索…",onKeydown:D[1]||(D[1]=r.withKeys(v=>p.value=!1,["esc"]))},null,544),[[r.vModelText,f.value]])])):r.createCommentVNode("",!0),r.createElementVNode("div",{class:"ts-toolbar"},[r.createElementVNode("button",{type:"button",class:"ts-tool-btn",onClick:ot},"展开全部"),r.createElementVNode("button",{type:"button",class:"ts-tool-btn",onClick:E},"折叠全部")]),r.createElementVNode("div",ch,[k.value.length>0?(r.openBlock(!0),r.createElementBlock(r.Fragment,{key:0},r.renderList(k.value,v=>(r.openBlock(),r.createBlock(r.unref(hh),{key:v.value,node:v,depth:v.depth,multiple:w.multiple,checked:F(v),indeterminate:H(v),treeLine:w.treeLine,lazy:w.lazy,url:w.url,remoteData:c.value,onToggle:O,onCheck:q,onLoad:G},null,8,["node","depth","multiple","checked","indeterminate","treeLine","lazy","url","remoteData"]))),128)):(r.openBlock(),r.createElementBlock("div",dh,r.toDisplayString(d.value?"加载中…":"暂无数据"),1))])])):r.createCommentVNode("",!0)])],512))}}),Yn=oe(fh,[["__scopeId","data-v-09f21e85"]]),ph={key:0,class:"widget-label-row"},mh={key:0,class:"widget-required-mark","aria-hidden":"true"},gh={key:1,class:"selector-multi-label"},bh=["data-hint"],yh={class:"widget-field-content"},_h=["data-direction"],kh={key:0,style:{color:"rgba(0, 0, 0, 0.45)","font-size":"13px"}},xh=["value","checked","disabled","onChange"],wh={key:0,class:"widget-error-text",role:"alert"},Un=r.defineComponent({__name:"SelectMulti",props:{choices:{},label:{default:""},default:{},direction:{default:"vertical"},columns:{default:0},hint:{default:""},required:{type:Boolean,default:!1},message:{default:""},error:{default:""},disabled:{type:Boolean,default:!1}},emits:["change"],setup(n,{emit:t}){const e=n,i=t;function s(f){const p=String(f??""),g=p.indexOf(":");if(g>0){const b=p.slice(0,g),m=p.slice(g+1);if(b&&m&&!/\s/.test(b)&&!/^\d+$/.test(b)&&!m.startsWith("//"))return{value:b,label:m}}return{value:p,label:p}}const o=r.computed(()=>{const f=[];for(const p of e.choices||[])if(p!==null&&typeof p=="object"){const g=p.value??p.key;if(g==null||g==="")continue;const b=String(g),m=p.label!==void 0&&p.label!==null&&p.label!==""?String(p.label):b;f.push({value:b,label:m})}else f.push(s(p));return f});function a(f){const p=String(f),g=o.value.find(b=>b.value===p||b.label===p);return g?g.value:s(p).value}const l=r.ref(Array.isArray(e.default)?e.default.map(a):e.default?[a(e.default)]:[]),c=r.ref(""),d=r.computed(()=>e.error||c.value);function h(f){return e.required&&f.length===0?e.message||(e.label?`请填写${e.label}`:"请至少选择一项"):""}function u(f,p){l.value=p?[...l.value,f]:l.value.filter(g=>g!==f),c.value=h(l.value),i("change",l.value)}return(f,p)=>(r.openBlock(),r.createElementBlock("div",{class:r.normalizeClass(["selector-multi",{"widget-field-error":!!d.value}])},[f.label||f.hint||f.required?(r.openBlock(),r.createElementBlock("div",ph,[f.required?(r.openBlock(),r.createElementBlock("span",mh,"*")):r.createCommentVNode("",!0),f.label?(r.openBlock(),r.createElementBlock("div",gh,r.toDisplayString(f.label),1)):r.createCommentVNode("",!0),f.hint?(r.openBlock(),r.createElementBlock("span",{key:2,class:"widget-hint","data-hint":f.hint},"ⓘ",8,bh)):r.createCommentVNode("",!0)])):r.createCommentVNode("",!0),r.createElementVNode("div",yh,[r.createElementVNode("div",{class:"checkbox-group","data-direction":f.columns>=1?"grid":f.direction||"vertical",style:r.normalizeStyle(f.columns>=1?{gridTemplateColumns:`repeat(${f.columns}, minmax(0, 1fr))`}:void 0)},[o.value.length===0?(r.openBlock(),r.createElementBlock("div",kh,"暂无选项")):r.createCommentVNode("",!0),(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(o.value,g=>(r.openBlock(),r.createElementBlock("label",{key:g.value,class:"checkbox-item"},[r.createElementVNode("input",{type:"checkbox",value:g.value,checked:l.value.includes(g.value),disabled:f.disabled,onChange:b=>u(g.value,b.target.checked)},null,40,xh),r.createElementVNode("span",null,r.toDisplayString(g.label),1)]))),128))],12,_h),d.value?(r.openBlock(),r.createElementBlock("div",wh,r.toDisplayString(d.value),1)):r.createCommentVNode("",!0)])],2))}}),Sh={key:0},Ch=["aria-label","data-direction"],Eh={key:0,style:{color:"rgba(0, 0, 0, 0.45)","font-size":"13px"}},Mh=["aria-pressed","disabled","onClick"],vh={key:1,class:"widget-error-text",role:"alert"},Bh={key:0,class:"widget-label-row"},Dh={key:0,class:"widget-required-mark","aria-hidden":"true"},Ah={key:1,class:"selector-multi-label"},Th=["data-hint"],Ph={class:"widget-field-content"},Nh=["aria-label","data-direction"],Oh={key:0,style:{color:"rgba(0, 0, 0, 0.45)","font-size":"13px"}},Vh=["value","checked","disabled","onChange"],Lh={key:0,class:"widget-error-text",role:"alert"},tn=r.defineComponent({__name:"RadioGroup",props:{choices:{},label:{default:""},default:{},button:{type:Boolean,default:!1},url:{default:""},direction:{},columns:{default:0},hint:{default:""},required:{type:Boolean,default:!1},message:{default:""},error:{default:""},disabled:{type:Boolean,default:!1}},emits:["change"],setup(n,{emit:t}){const e=n,i=t;function s(m){const _=String(m??""),y=_.indexOf(":");if(y>0){const k=_.slice(0,y),x=_.slice(y+1);if(k&&x&&!/\s/.test(k)&&!/^\d+$/.test(k)&&!x.startsWith("//"))return{value:k,label:x}}return{value:_,label:_}}const o=r.computed(()=>{const m=[];for(const _ of e.choices||[])if(_!==null&&typeof _=="object"){const y=_.value??_.key;if(y==null||y==="")continue;const k=String(y),x=_.label!==void 0&&_.label!==null&&_.label!==""?String(_.label):k;m.push({value:k,label:x})}else m.push(s(_));return m}),a=r.computed(()=>f.value??o.value);function l(m){const _=String(m),y=o.value.find(k=>k.value===_||k.label===_);return y?y.value:s(_).value}const c=r.ref(e.default!==void 0&&e.default!==null&&e.default!==""?l(Array.isArray(e.default)?e.default[0]:e.default):o.value[0]?.value??""),d=r.ref("");function h(m){return e.required&&m===""?e.message||(e.label?`请填写${e.label}`:"请至少选择一项"):""}function u(m){e.disabled||(c.value=m,d.value=h(m),i("change",m))}const f=r.ref(null),p=r.ref(!1);function g(m){let _=m;Array.isArray(m)||(_=Array.isArray(m?.data)?m.data:Array.isArray(m?.options)?m.options:Array.isArray(m?.choices)?m.choices:Array.isArray(m?.items)?m.items:[]);const y=[];for(const k of _||[])if(k!=null){if(typeof k=="string"||typeof k=="number"){const x=String(k);x&&y.push({value:x,label:x});continue}if(typeof k=="object"){const x=k.value??k.key??k.id??k.name;if(x==null||x==="")continue;const S=k.label??k.name??k.text??String(x);y.push({value:String(x),label:String(S)})}}return y}r.onMounted(async()=>{if(e.url){p.value=!0;try{const m=await fetch(e.url);if(!m.ok)throw new Error(`HTTP ${m.status}`);const _=await m.json(),y=g(_);if(y.length===0)throw new Error("响应中没有可用选项");f.value=y;const k=y.find(S=>S.value===c.value||S.label===c.value),x=k?k.value:y[0]?.value??"";x!==c.value&&(c.value=x,i("change",x))}catch{}finally{p.value=!1}}});const b=r.computed(()=>e.error||d.value);return(m,_)=>m.button?(r.openBlock(),r.createElementBlock("div",{key:0,class:r.normalizeClass(["widget-button-group",{"widget-field-error":!!b.value}])},[m.label?(r.openBlock(),r.createElementBlock("label",Sh,r.toDisplayString(m.label),1)):r.createCommentVNode("",!0),r.createElementVNode("div",{role:"group","aria-label":m.label,class:"radio-button-group","data-direction":m.columns>=1?"grid":m.direction||"horizontal",style:r.normalizeStyle(m.columns>=1?{gridTemplateColumns:`repeat(${m.columns}, minmax(0, 1fr))`}:void 0)},[a.value.length===0?(r.openBlock(),r.createElementBlock("div",Eh,r.toDisplayString(p.value?"加载中…":"暂无数据"),1)):r.createCommentVNode("",!0),(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(a.value,y=>(r.openBlock(),r.createElementBlock("button",{key:y.value,type:"button","aria-pressed":c.value===y.value,disabled:m.disabled,onClick:k=>u(y.value)},r.toDisplayString(y.label),9,Mh))),128))],12,Ch),b.value?(r.openBlock(),r.createElementBlock("div",vh,r.toDisplayString(b.value),1)):r.createCommentVNode("",!0)],2)):(r.openBlock(),r.createElementBlock("div",{key:1,class:r.normalizeClass(["selector-multi",{"widget-field-error":!!b.value}])},[m.label||m.hint||m.required?(r.openBlock(),r.createElementBlock("div",Bh,[m.required?(r.openBlock(),r.createElementBlock("span",Dh,"*")):r.createCommentVNode("",!0),m.label?(r.openBlock(),r.createElementBlock("div",Ah,r.toDisplayString(m.label),1)):r.createCommentVNode("",!0),m.hint?(r.openBlock(),r.createElementBlock("span",{key:2,class:"widget-hint","data-hint":m.hint},"ⓘ",8,Th)):r.createCommentVNode("",!0)])):r.createCommentVNode("",!0),r.createElementVNode("div",Ph,[r.createElementVNode("div",{class:"radio-group",role:"radiogroup","aria-label":m.label,"data-direction":m.columns>=1?"grid":m.direction||"vertical",style:r.normalizeStyle(m.columns>=1?{gridTemplateColumns:`repeat(${m.columns}, minmax(0, 1fr))`}:void 0)},[a.value.length===0?(r.openBlock(),r.createElementBlock("div",Oh,r.toDisplayString(p.value?"加载中…":"暂无数据"),1)):r.createCommentVNode("",!0),(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(a.value,y=>(r.openBlock(),r.createElementBlock("label",{key:y.value,class:"radio-item"},[r.createElementVNode("input",{type:"radio",value:y.value,checked:c.value===y.value,disabled:m.disabled,onChange:k=>u(y.value)},null,40,Vh),r.createElementVNode("span",null,r.toDisplayString(y.label),1)]))),128))],12,Nh),b.value?(r.openBlock(),r.createElementBlock("div",Lh,r.toDisplayString(b.value),1)):r.createCommentVNode("",!0)])],2))}}),zh={class:"widget-slider"},Rh={key:0,class:"widget-label-row"},Ih={key:0,class:"widget-required-mark","aria-hidden":"true"},Fh={key:1},$h=["data-hint"],Wh={class:"widget-field-content"},Hh={class:"slider-container"},jh={class:"slider-values"},qh={class:"min-value"},Yh={class:"current-value"},Uh={class:"max-value"},Xh=["min","max","step"],Xn=r.defineComponent({__name:"Slider",props:{min:{},max:{},step:{default:1},label:{default:""},default:{},hint:{default:""},required:{type:Boolean,default:!1}},emits:["change"],setup(n,{emit:t}){const e=n,i=t,s=r.ref(e.default??e.min),o=()=>{i("change",Number(s.value))};return(a,l)=>(r.openBlock(),r.createElementBlock("div",zh,[a.label||a.hint||a.required?(r.openBlock(),r.createElementBlock("div",Rh,[a.required?(r.openBlock(),r.createElementBlock("span",Ih,"*")):r.createCommentVNode("",!0),a.label?(r.openBlock(),r.createElementBlock("label",Fh,r.toDisplayString(a.label),1)):r.createCommentVNode("",!0),a.hint?(r.openBlock(),r.createElementBlock("span",{key:2,class:"widget-hint","data-hint":a.hint},"ⓘ",8,$h)):r.createCommentVNode("",!0)])):r.createCommentVNode("",!0),r.createElementVNode("div",Wh,[r.createElementVNode("div",Hh,[r.createElementVNode("div",jh,[r.createElementVNode("span",qh,r.toDisplayString(a.min),1),r.createElementVNode("span",Yh,r.toDisplayString(s.value),1),r.createElementVNode("span",Uh,r.toDisplayString(a.max),1)]),r.withDirectives(r.createElementVNode("input",{type:"range","onUpdate:modelValue":l[0]||(l[0]=c=>s.value=c),min:a.min,max:a.max,step:a.step,onMouseup:o,onTouchend:o},null,40,Xh),[[r.vModelText,s.value]])])])]))}}),Kh={class:"widget-switch"},Gh={key:0,class:"widget-label-row switch-label-row"},Qh={key:0,class:"widget-required-mark","aria-hidden":"true"},Jh={key:1},Zh=["data-hint"],tu={class:"widget-field-content"},eu=["aria-checked","aria-label","data-checked","disabled"],nu={key:0,class:"switch-text switch-text-checked"},iu={key:1,class:"switch-text switch-text-unchecked"},Kn=r.defineComponent({__name:"Switch",props:{label:{default:""},default:{type:Boolean},checkedText:{default:""},unCheckedText:{default:""},disabled:{type:Boolean,default:!1},hint:{default:""},required:{type:Boolean,default:!1}},emits:["change"],setup(n,{emit:t}){const e=n,i=t,s=r.ref(e.default??!1),o=()=>{e.disabled||(s.value=!s.value,i("change",s.value))};return(a,l)=>(r.openBlock(),r.createElementBlock("div",Kh,[a.label||a.hint||a.required?(r.openBlock(),r.createElementBlock("div",Gh,[a.required?(r.openBlock(),r.createElementBlock("span",Qh,"*")):r.createCommentVNode("",!0),a.label?(r.openBlock(),r.createElementBlock("label",Jh,r.toDisplayString(a.label),1)):r.createCommentVNode("",!0),a.hint?(r.openBlock(),r.createElementBlock("span",{key:2,class:"widget-hint","data-hint":a.hint},"ⓘ",8,Zh)):r.createCommentVNode("",!0)])):r.createCommentVNode("",!0),r.createElementVNode("div",tu,[r.createElementVNode("button",{type:"button",role:"switch","aria-checked":s.value,"aria-label":a.label,class:"switch-track","data-checked":s.value,disabled:a.disabled,onClick:o},[l[0]||(l[0]=r.createElementVNode("span",{class:"switch-thumb"},null,-1)),a.checkedText?(r.openBlock(),r.createElementBlock("span",nu,r.toDisplayString(a.checkedText),1)):r.createCommentVNode("",!0),a.unCheckedText?(r.openBlock(),r.createElementBlock("span",iu,r.toDisplayString(a.unCheckedText),1)):r.createCommentVNode("",!0)],8,eu)])]))}}),su={key:0,class:"widget-label-row"},ou={key:0,class:"widget-required-mark","aria-hidden":"true"},au={key:1},ru=["data-hint"],lu={class:"widget-field-content"},cu=["placeholder","disabled"],du={key:0,class:"widget-error-text",role:"alert"},Gn=r.defineComponent({__name:"TextInput",props:{placeholder:{default:""},label:{default:""},default:{default:""},hint:{default:""},required:{type:Boolean,default:!1},pattern:{default:""},message:{default:""},error:{default:""},disabled:{type:Boolean,default:!1}},emits:["change"],setup(n,{emit:t}){const e=n,i=t,s=r.ref(e.default),o=r.ref("");function a(h){return e.required&&!h.trim()?e.message||(e.label?`请填写${e.label}`:"该项为必填项"):e.pattern&&h&&!new RegExp(e.pattern).test(h)?e.message||(e.label?`${e.label}格式不正确`:"格式不正确"):""}function l(){o.value=a(s.value),i("change",s.value)}function c(){o.value&&(o.value=a(s.value))}const d=r.computed(()=>e.error||o.value);return(h,u)=>(r.openBlock(),r.createElementBlock("div",{class:r.normalizeClass(["widget-text-input",{"widget-field-error":!!d.value}])},[h.label||h.hint||h.required?(r.openBlock(),r.createElementBlock("div",su,[h.required?(r.openBlock(),r.createElementBlock("span",ou,"*")):r.createCommentVNode("",!0),h.label?(r.openBlock(),r.createElementBlock("label",au,r.toDisplayString(h.label),1)):r.createCommentVNode("",!0),h.hint?(r.openBlock(),r.createElementBlock("span",{key:2,class:"widget-hint","data-hint":h.hint},"ⓘ",8,ru)):r.createCommentVNode("",!0)])):r.createCommentVNode("",!0),r.createElementVNode("div",lu,[r.withDirectives(r.createElementVNode("input",{type:"text","onUpdate:modelValue":u[0]||(u[0]=f=>s.value=f),class:r.normalizeClass({"widget-input-error":!!d.value}),placeholder:h.placeholder,disabled:h.disabled,onBlur:l,onInput:c},null,42,cu),[[r.vModelText,s.value]]),d.value?(r.openBlock(),r.createElementBlock("div",du,r.toDisplayString(d.value),1)):r.createCommentVNode("",!0)])],2))}}),hu={key:0,class:"widget-label-row"},uu={key:0,class:"widget-required-mark","aria-hidden":"true"},fu={key:1},pu=["data-hint"],mu={class:"widget-field-content"},gu={class:"ni-wrap"},bu=["placeholder","disabled"],yu={class:"ni-steps","aria-hidden":"true"},_u=["disabled"],ku=["disabled"],xu={key:0,class:"widget-error-text",role:"alert"},en=r.defineComponent({__name:"NumberInput",props:{label:{default:""},min:{},max:{},step:{default:1},precision:{},default:{},placeholder:{default:""},hint:{default:""},required:{type:Boolean,default:!1},message:{default:""},error:{default:""},disabled:{type:Boolean,default:!1}},emits:["change"],setup(n,{emit:t}){const e=n,i=t;function s(y){return e.precision!==void 0&&e.precision>=0?y.toFixed(e.precision):String(y)}function o(y){const k=y.trim();if(!k||k==="-"||k==="."||k==="-."||k==="+"||k==="+.")return null;const x=Number(k);return isNaN(x)?null:x}function a(y){return e.precision!==void 0&&e.precision>=0&&(y=Number(y.toFixed(e.precision))),e.min!==void 0&&y<e.min&&(y=e.min),e.max!==void 0&&y>e.max&&(y=e.max),y}function l(y){return e.required&&y===null?e.message||(e.label?`请填写${e.label}`:"该项为必填项"):""}const c=r.ref(e.default!==void 0&&e.default!==null?s(e.default):""),d=r.ref("");r.watch(()=>e.default,y=>{c.value=y!=null?s(y):"",d.value=""});function h(){const y=o(c.value);if(y===null){c.value="",d.value=l(null),i("change",null);return}const k=a(y);c.value=s(k),d.value="",i("change",k)}function u(y){const x=o(c.value)??0,S=a(x+(e.step??1)*y);c.value=s(S),d.value="",i("change",S)}function f(y){y.key==="ArrowUp"?(y.preventDefault(),u(1)):y.key==="ArrowDown"?(y.preventDefault(),u(-1)):y.key==="Enter"&&h()}function p(){d.value&&(d.value=l(o(c.value)))}const g=r.computed(()=>o(c.value)),b=r.computed(()=>e.max!==void 0&&g.value!==null&&g.value>=e.max),m=r.computed(()=>e.min!==void 0&&g.value!==null&&g.value<=e.min),_=r.computed(()=>e.error||d.value);return(y,k)=>(r.openBlock(),r.createElementBlock("div",{class:r.normalizeClass(["widget-number-input",{"widget-field-error":!!_.value}])},[y.label||y.hint||y.required?(r.openBlock(),r.createElementBlock("div",hu,[y.required?(r.openBlock(),r.createElementBlock("span",uu,"*")):r.createCommentVNode("",!0),y.label?(r.openBlock(),r.createElementBlock("label",fu,r.toDisplayString(y.label),1)):r.createCommentVNode("",!0),y.hint?(r.openBlock(),r.createElementBlock("span",{key:2,class:"widget-hint","data-hint":y.hint},"ⓘ",8,pu)):r.createCommentVNode("",!0)])):r.createCommentVNode("",!0),r.createElementVNode("div",mu,[r.createElementVNode("div",gu,[r.withDirectives(r.createElementVNode("input",{type:"text",inputmode:"decimal",autocomplete:"off","onUpdate:modelValue":k[0]||(k[0]=x=>c.value=x),class:r.normalizeClass({"widget-input-error":!!_.value}),placeholder:y.placeholder,disabled:y.disabled,onKeydown:f,onFocusout:h,onInput:p},null,42,bu),[[r.vModelText,c.value]]),r.createElementVNode("span",yu,[r.createElementVNode("button",{type:"button",class:"ni-step-up",onClick:k[1]||(k[1]=x=>u(1)),disabled:y.disabled||b.value,"aria-label":"增加",tabindex:"-1"},[...k[3]||(k[3]=[r.createElementVNode("svg",{viewBox:"0 0 10 6",width:"10",height:"6"},[r.createElementVNode("path",{d:"M5 0 L10 6 H0 Z",fill:"currentColor"})],-1)])],8,_u),r.createElementVNode("button",{type:"button",class:"ni-step-down",onClick:k[2]||(k[2]=x=>u(-1)),disabled:y.disabled||m.value,"aria-label":"减少",tabindex:"-1"},[...k[4]||(k[4]=[r.createElementVNode("svg",{viewBox:"0 0 10 6",width:"10",height:"6"},[r.createElementVNode("path",{d:"M5 6 L0 0 H10 Z",fill:"currentColor"})],-1)])],8,ku)])]),_.value?(r.openBlock(),r.createElementBlock("div",xu,r.toDisplayString(_.value),1)):r.createCommentVNode("",!0)])],2))}}),wu={class:"widget-alert-icon","aria-hidden":"true"},nn=r.defineComponent({__name:"Text",props:{text:{default:""},size:{},color:{},bold:{type:Boolean},align:{},alert:{type:Boolean,default:!1},alertStyle:{default:"info"}},setup(n){const t=n,e={info:"ℹ",warning:"⚠",error:"✕"},i=r.computed(()=>({fontSize:t.size?`${t.size}px`:void 0,color:t.color||void 0,fontWeight:t.bold?600:void 0,textAlign:t.align||void 0}));return(s,o)=>s.alert?(r.openBlock(),r.createElementBlock("div",{key:0,class:r.normalizeClass(["widget-alert",`widget-alert-${s.alertStyle}`]),style:r.normalizeStyle({textAlign:s.align||void 0}),role:"alert"},[r.createElementVNode("span",wu,r.toDisplayString(e[s.alertStyle]??e.info),1),r.createElementVNode("span",{class:"widget-alert-message",style:r.normalizeStyle(i.value)},r.toDisplayString(s.text),5)],6)):(r.openBlock(),r.createElementBlock("p",{key:1,class:"widget-text",style:r.normalizeStyle(i.value)},r.toDisplayString(s.text),5))}}),Su=["data-align"],Cu=["data-field-type"],Eu=["data-align"],ao=r.defineComponent({__name:"Form",props:{id:{},fields:{},rows:{},inline:{type:Boolean},columns:{},submitLabel:{},cancelLabel:{},resetLabel:{},buttonsAlign:{},layout:{},labelWidth:{},contentWidth:{},disabled:{type:Boolean},initialData:{}},emits:["change","submit","fieldchange"],setup(n,{emit:t}){const e=n,i=t,s=r.computed(()=>e.inline?"widget-form widget-form-inline":"widget-form"),o=r.computed(()=>e.layout==="horizontal"),a=r.computed(()=>o.value?"widget-form-layout-horizontal":""),l=r.computed(()=>{if(!o.value)return;const E={"--form-label-width":`${e.labelWidth??80}px`};return e.contentWidth&&(E["--form-content-width"]=`${e.contentWidth}px`),E}),c=r.computed(()=>{const E={};return e.columns&&(E["--form-columns"]=String(e.columns)),l.value&&Object.assign(E,l.value),Object.keys(E).length?E:void 0}),d=r.computed(()=>!e.inline&&(!Array.isArray(e.rows)||e.rows.length===0)&&(e.fields||[]).some(E=>typeof E?.span=="number"&&E.span>=1&&E.span<=24)),h=E=>{const R=typeof E.span=="number"&&E.span>=1&&E.span<=24?Math.round(E.span):0;if(e.inline)return R>=1?{flex:`0 1 calc(${R} / 24 * 100%)`}:void 0;if(d.value)return{gridColumn:R>=1?`span ${R}`:"1 / -1"}},u=E=>{const R=String(E??""),A=R.indexOf(":");if(A>0){const $=R.slice(0,A),j=R.slice(A+1);if($&&j&&!/\s/.test($)&&!/^\d+$/.test($)&&!j.startsWith("//"))return $}return R},f=E=>{const R={};for(const A of E)if(A.type==="button")R[A.id]=A.label??"";else if(A.type==="button-group")R[A.id]=A.default??(Array.isArray(A.choices)&&A.choices.length?A.choices[0]:void 0);else if(A.type==="select")R[A.id]=A.default!==void 0&&A.default!==null&&A.default!==""?u(String(A.default)):Array.isArray(A.choices)&&A.choices.length?u(String(A.choices[0])):void 0;else if(A.type==="select-multi"){const $=A.default,j=(Array.isArray(A.choices)?A.choices:[]).filter(D=>D&&typeof D=="object"),w=D=>{const v=String(D),I=j.find(W=>String(W.value??W.key)===v||W.label===v);return I?String(I.value??I.key):u(v)};R[A.id]=Array.isArray($)?$.map(w):$?[w($)]:[]}else if(A.type==="radio-group"){const $=[];for(const D of Array.isArray(A.choices)?A.choices:[])if(D!==null&&typeof D=="object"){const v=D.value??D.key;if(v==null||v==="")continue;const I=String(v),W=D.label!==void 0&&D.label!==null&&D.label!==""?String(D.label):I;$.push({value:I,label:W})}else D!=null&&$.push({value:u(String(D)),label:String(D)});const j=D=>{const v=String(D),I=$.find(W=>W.value===v||W.label===v);return I?I.value:u(v)},w=A.default;w!=null&&w!==""?R[A.id]=j(Array.isArray(w)?w[0]:w):R[A.id]=$.length?$[0].value:""}else A.type==="slider"?R[A.id]=A.default??(typeof A.min=="number"?A.min:0):A.type==="switch"?R[A.id]=A.default??!1:A.type==="number-input"?R[A.id]=A.default??null:A.type==="text-input"&&(R[A.id]=A.default??"");return R},p=r.computed(()=>{const E=f(e.fields||[]),R=e.initialData;if(R){const A=new Set;for(const $ of e.fields??[])$?.id&&A.add($.id);for(const $ of e.rows??[]){const j=Array.isArray($)?$:$?.fields??[];for(const w of j)w?.id&&A.add(w.id)}for(const[$,j]of Object.entries(R))A.has($)&&(E[$]=j)}return E}),g=r.reactive({...p.value}),b=r.ref(0);r.watch(p,E=>{for(const R of Object.keys(g))delete g[R];Object.assign(g,E),b.value++});const m=E=>({...E,default:g[E.id]!==void 0?g[E.id]:E.default}),_=(E,R)=>{g[E]=R,i("fieldchange",y())},y=()=>{const E=$=>$==null||$===""||Array.isArray($)&&$.length===0,R=L.value,A={...g};return{id:e.id??"",visibleCount:R.length,filledCount:R.filter($=>!E(A[$.id])).length,values:A}},k=E=>{if(!E?.field||!Array.isArray(E.values)||E.values.length===0)return!0;const R=g[E.field],A=E.op||"eq";if(A==="eq")return Array.isArray(R)?R.some(j=>E.values.includes(String(j??""))):E.values.includes(String(R??""));const $=Number(R);return R==null||R===""||isNaN($)?!1:E.values.some(j=>{const w=Number(j);return isNaN(w)?!1:A==="gt"?$>w:A==="gte"?$>=w:A==="lt"?$<w:A==="lte"?$<=w:$!==w})},x=E=>{if(!E.when)return!0;const R=E.when;if(!Array.isArray(R)&&typeof R=="object"&&("all"in R||"any"in R)){const $=(R.all||[]).every(k),j=R.any||[],w=j.length===0?!0:j.some(k);return $&&w}const A=Array.isArray(R)?R:[R];return A.length===0?!0:A.every(k)},S=r.computed(()=>(e.fields||[]).filter(x)),N=E=>O(E).filter(x),V=r.computed(()=>H.value.filter(x)),L=r.computed(()=>{const E=[...e.fields||[],...H.value],R=new Set;return E.filter(A=>!A?.id||R.has(A.id)?!1:(R.add(A.id),x(A)))}),C=()=>{i("change",{...g}),i("submit",{...g})},T=()=>{Object.assign(g,p.value),b.value++,i("fieldchange",y())},P=()=>{i("change",{...p.value,_action:"cancel"})},O=E=>Array.isArray(E)?E:E.fields||[],F=E=>{if(!(Array.isArray(E)||E.gutter===void 0))return{"--row-gutter":`${E.gutter}px`}},H=r.computed(()=>(e.rows||[]).map(O).flatMap(E=>E)),q=r.computed(()=>G(H.value)),Y=r.computed(()=>{const E=(e.rows||[]).find(R=>!Array.isArray(R)&&R.gutter!==void 0);return E?.gutter!==void 0?{"--row-gutter":`${E.gutter}px`}:void 0}),G=E=>{const R=E.map(w=>typeof w.span=="number"&&w.span>=1&&w.span<=24?Math.round(w.span):void 0),A=R.reduce((w,D)=>w+(D??0),0),$=R.filter(w=>w===void 0).length;let j=0;if($>0)if(e.columns&&e.columns>=1)j=Math.max(Math.floor(24/e.columns),1);else{const w=Math.max(24-A,0);j=Math.max(Math.floor(w/$),1)}return R.map(w=>w??j)},ot=E=>({button:sn,"button-group":on,select:qn,"select-multi":Un,"radio-group":tn,cascade:an,"tree-select":Yn,slider:Xn,switch:Kn,"text-input":Gn,"number-input":en,"date-picker":Ze,text:nn,"chart-line":se,"chart-bar":se,"chart-pie":se,"chart-scatter":se})[E]||"div";return(E,R)=>(r.openBlock(),r.createElementBlock(r.Fragment,null,[E.rows&&E.rows.length>0?(r.openBlock(),r.createElementBlock("div",{key:0,class:r.normalizeClass(["widget-form",a.value]),style:r.normalizeStyle(l.value)},[E.columns&&E.columns>=1?(r.openBlock(),r.createElementBlock("div",{key:0,class:"widget-form-row",style:r.normalizeStyle(Y.value)},[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(V.value,(A,$)=>(r.openBlock(),r.createElementBlock("div",{key:`${A.id}:${b.value}`,class:"widget-form-field",style:r.normalizeStyle({gridColumn:`span ${q.value[$]}`})},[(r.openBlock(),r.createBlock(r.resolveDynamicComponent(ot(A.type)),r.mergeProps({ref_for:!0},m(A),{onChange:j=>_(A.id,j)}),null,16,["onChange"]))],4))),128))],4)):(r.openBlock(!0),r.createElementBlock(r.Fragment,{key:1},r.renderList(E.rows,(A,$)=>(r.openBlock(),r.createElementBlock("div",{key:$,class:"widget-form-row",style:r.normalizeStyle(F(A))},[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(N(A),(j,w)=>(r.openBlock(),r.createElementBlock("div",{key:`${j.id}:${b.value}`,class:"widget-form-field",style:r.normalizeStyle({gridColumn:`span ${G(N(A))[w]}`})},[(r.openBlock(),r.createBlock(r.resolveDynamicComponent(ot(j.type)),r.mergeProps({ref_for:!0},m(j),{onChange:D=>_(j.id,D)}),null,16,["onChange"]))],4))),128))],4))),128)),E.cancelLabel||E.resetLabel||E.submitLabel?(r.openBlock(),r.createElementBlock("div",{key:2,class:"widget-form-actions","data-align":E.buttonsAlign||"left"},[E.cancelLabel?(r.openBlock(),r.createElementBlock("button",{key:0,type:"button",class:"widget-form-cancel",onClick:P},r.toDisplayString(E.cancelLabel),1)):r.createCommentVNode("",!0),E.resetLabel?(r.openBlock(),r.createElementBlock("button",{key:1,type:"button",class:"widget-form-reset",onClick:T},r.toDisplayString(E.resetLabel),1)):r.createCommentVNode("",!0),E.submitLabel?(r.openBlock(),r.createElementBlock("button",{key:2,type:"button",class:"widget-form-submit",onClick:C},r.toDisplayString(E.submitLabel),1)):r.createCommentVNode("",!0)],8,Su)):r.createCommentVNode("",!0)],6)):r.createCommentVNode("",!0),r.createElementVNode("div",{class:r.normalizeClass([s.value,a.value,d.value?"widget-form-fields-grid":""]),style:r.normalizeStyle(c.value)},[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(S.value,A=>(r.openBlock(),r.createElementBlock("div",{key:`${A.id}:${b.value}`,class:"widget-form-field","data-field-type":A.type,style:r.normalizeStyle(h(A))},[(r.openBlock(),r.createBlock(r.resolveDynamicComponent(ot(A.type)),r.mergeProps({ref_for:!0},m(A),{onChange:$=>_(A.id,$)}),null,16,["onChange"]))],12,Cu))),128)),E.cancelLabel||E.resetLabel||E.submitLabel?(r.openBlock(),r.createElementBlock("div",{key:0,class:"widget-form-actions","data-align":E.buttonsAlign||"left"},[E.cancelLabel?(r.openBlock(),r.createElementBlock("button",{key:0,type:"button",class:"widget-form-cancel",onClick:P},r.toDisplayString(E.cancelLabel),1)):r.createCommentVNode("",!0),E.resetLabel?(r.openBlock(),r.createElementBlock("button",{key:1,type:"button",class:"widget-form-reset",onClick:T},r.toDisplayString(E.resetLabel),1)):r.createCommentVNode("",!0),E.submitLabel?(r.openBlock(),r.createElementBlock("button",{key:2,type:"button",class:"widget-form-submit",onClick:C},r.toDisplayString(E.submitLabel),1)):r.createCommentVNode("",!0)],8,Eu)):r.createCommentVNode("",!0)],6)],64))}}),Mu={class:"incomplete-widget"},vu=`
|
|
20
|
+
.incomplete-widget {
|
|
21
|
+
display: flex;
|
|
22
|
+
align-items: center;
|
|
23
|
+
padding: 8px 12px;
|
|
24
|
+
background-color: rgba(0, 0, 0, 0.04);
|
|
25
|
+
border: 1px solid #f0f0f0;
|
|
26
|
+
border-radius: 4px;
|
|
27
|
+
font-family: system-ui, -apple-system, sans-serif;
|
|
28
|
+
font-size: 14px;
|
|
29
|
+
color: rgba(0, 0, 0, 0.65);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.loading-indicator {
|
|
33
|
+
display: flex;
|
|
34
|
+
align-items: center;
|
|
35
|
+
gap: 8px;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.loading-text {
|
|
39
|
+
opacity: 0.7;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.loading-text::after {
|
|
43
|
+
content: '';
|
|
44
|
+
animation: dots 1.5s infinite;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
@keyframes dots {
|
|
48
|
+
0%, 20% { content: ''; }
|
|
49
|
+
40% { content: '.'; }
|
|
50
|
+
60% { content: '..'; }
|
|
51
|
+
80%, 100% { content: '...'; }
|
|
52
|
+
}
|
|
53
|
+
`,ro=r.defineComponent({__name:"Incomplete",setup(n){return r.onMounted(()=>{if(typeof document<"u"&&!document.getElementById("incomplete-widget-styles")){const t=document.createElement("style");t.id="incomplete-widget-styles",t.textContent=vu,document.head.appendChild(t)}}),(t,e)=>(r.openBlock(),r.createElementBlock("div",Mu,[...e[0]||(e[0]=[r.createElementVNode("div",{class:"loading-indicator"},[r.createElementVNode("span",{class:"loading-text"},"Loading...")],-1)])]))}}),Bu={class:"widget-mcq"},Du={class:"mcq-question"},Au={class:"mcq-choices"},Tu=["disabled","onClick"],Qn=r.defineComponent({__name:"MultipleChoiceQuestion",props:{question:{},choices:{},correctAnswer:{},showFeedback:{type:Boolean,default:!1}},emits:["change"],setup(n,{emit:t}){const e=n,i=t,s=r.ref(""),o=r.ref(!1);function a(c){s.value=c,o.value=!0;const d=e.correctAnswer?c===e.correctAnswer:void 0;i("change",{answer:c,isCorrect:d})}function l(c){let d="mcq-choice";return o.value&&e.showFeedback&&e.correctAnswer?c===e.correctAnswer?d+=" mcq-choice-correct":c===s.value&&c!==e.correctAnswer&&(d+=" mcq-choice-incorrect"):c===s.value&&(d+=" mcq-choice-selected"),d}return(c,d)=>(r.openBlock(),r.createElementBlock("div",Bu,[r.createElementVNode("div",Du,r.toDisplayString(c.question),1),r.createElementVNode("div",Au,[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(c.choices,(h,u)=>(r.openBlock(),r.createElementBlock("button",{key:u,class:r.normalizeClass(l(h)),disabled:o.value&&c.showFeedback,onClick:f=>a(h)},r.toDisplayString(h),11,Tu))),128))]),o.value&&c.showFeedback&&s.value?(r.openBlock(),r.createElementBlock("div",{key:0,class:r.normalizeClass(["mcq-feedback",s.value===c.correctAnswer?"correct":"incorrect"])},[c.correctAnswer?(r.openBlock(),r.createElementBlock(r.Fragment,{key:0},[r.createTextVNode(r.toDisplayString(s.value===c.correctAnswer?"✓ Correct!":`✗ Incorrect. The correct answer is: ${c.correctAnswer}`),1)],64)):(r.openBlock(),r.createElementBlock(r.Fragment,{key:1},[r.createTextVNode(" You selected: "+r.toDisplayString(s.value),1)],64))],2)):r.createCommentVNode("",!0)]))}}),Pu={class:"widget-quiz"},Nu={class:"quiz-header"},Ou={class:"quiz-title"},Vu={class:"quiz-stats"},Lu={key:0,class:"quiz-progress"},zu={class:"quiz-progress-text"},Ru={class:"quiz-progress-bar"},Iu={key:1,class:"quiz-score"},Fu={class:"quiz-score-text"},$u={class:"quiz-questions"},Wu={key:0,class:"quiz-question"},Hu={class:"quiz-question-header"},ju={class:"quiz-question-text"},qu={class:"quiz-question-points"},Yu={class:"quiz-choices"},Uu=["disabled","onClick"],Xu={key:0},Ku={key:1,class:"quiz-feedback"},Gu={key:1,class:"quiz-question"},Qu={class:"quiz-question-header"},Ju={class:"quiz-question-text"},Zu={class:"quiz-question-points"},tf={class:"quiz-input-container"},ef=["value","placeholder","disabled","onInput","onKeydown"],nf=["disabled","onClick"],sf={key:0},of={key:1,class:"quiz-feedback"},af={key:0,class:"quiz-summary"},rf={class:"quiz-final-score"},Jn=r.defineComponent({__name:"Quiz",props:{title:{},questions:{},showScore:{type:Boolean,default:!0},showProgress:{type:Boolean,default:!0},passingScore:{}},emits:["change"],setup(n,{emit:t}){const e=n,i=t,s=r.reactive({}),o=r.reactive({}),a=r.computed(()=>e.questions.reduce((_,y)=>_+y.points,0)),l=r.computed(()=>Object.values(s).reduce((_,y)=>_+y.points,0)),c=r.computed(()=>Object.keys(s).length),d=r.computed(()=>c.value===e.questions.length),h=r.computed(()=>Math.round(c.value/e.questions.length*100)),u=r.computed(()=>a.value>0?Math.round(l.value/a.value*100):0),f=r.computed(()=>e.passingScore!==void 0?u.value>=e.passingScore:!1);function p(){i("change",{answers:{...s},totalScore:l.value,maxScore:a.value,questionsAnswered:c.value,isCompleted:d.value})}function g(_,y){const k=e.questions.find(S=>S.id===_);if(!k||s[_]?.submitted)return;let x=!1;k.type==="mcq"?x=k.correctAnswer===y:k.type==="short-answer"&&k.correctAnswers&&(x=k.correctAnswers.some(S=>S.toLowerCase()===y.toLowerCase())),s[_]={answer:y,isCorrect:x,points:x?k.points:0,submitted:!0},o[_]&&delete o[_],p()}function b(_){const y=(o[_.id]||"").trim();y&&g(_.id,y)}function m(_,y){const k=s[_.id];let x="quiz-choice";return k?.submitted&&typeof _.correctAnswer<"u"&&(y===_.correctAnswer?x+=" quiz-choice-correct":y===k.answer&&y!==_.correctAnswer&&(x+=" quiz-choice-incorrect")),x}return(_,y)=>(r.openBlock(),r.createElementBlock("div",Pu,[r.createElementVNode("div",Nu,[r.createElementVNode("h2",Ou,r.toDisplayString(_.title),1),r.createElementVNode("div",Vu,[_.showProgress?(r.openBlock(),r.createElementBlock("div",Lu,[r.createElementVNode("span",zu," Progress: "+r.toDisplayString(c.value)+"/"+r.toDisplayString(_.questions.length)+" questions ",1),r.createElementVNode("div",Ru,[r.createElementVNode("div",{class:"quiz-progress-fill",style:r.normalizeStyle({width:`${h.value}%`})},null,4)])])):r.createCommentVNode("",!0),_.showScore?(r.openBlock(),r.createElementBlock("div",Iu,[r.createElementVNode("span",Fu," Score: "+r.toDisplayString(l.value)+"/"+r.toDisplayString(a.value)+" ("+r.toDisplayString(u.value)+"%) ",1)])):r.createCommentVNode("",!0)])]),r.createElementVNode("div",$u,[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(_.questions,k=>(r.openBlock(),r.createElementBlock("div",{key:k.id},[k.type==="mcq"?(r.openBlock(),r.createElementBlock("div",Wu,[r.createElementVNode("div",Hu,[r.createElementVNode("h3",ju,r.toDisplayString(k.question),1),r.createElementVNode("span",qu,r.toDisplayString(k.points)+" pts",1)]),r.createElementVNode("div",Yu,[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(k.choices||[],(x,S)=>(r.openBlock(),r.createElementBlock("button",{key:S,class:r.normalizeClass(m(k,x)),disabled:s[k.id]?.submitted,onClick:N=>g(k.id,x)},r.toDisplayString(x),11,Uu))),128))]),s[k.id]?.submitted?(r.openBlock(),r.createElementBlock("div",Xu,[typeof k.correctAnswer<"u"?(r.openBlock(),r.createElementBlock("div",{key:0,class:r.normalizeClass(["quiz-feedback",s[k.id].isCorrect?"correct":"incorrect"])},r.toDisplayString(s[k.id].isCorrect?`✓ Correct! (+${s[k.id].points} pts)`:`✗ Incorrect. The correct answer is: ${k.correctAnswer}`),3)):(r.openBlock(),r.createElementBlock("div",Ku," You selected: "+r.toDisplayString(s[k.id].answer),1))])):r.createCommentVNode("",!0)])):k.type==="short-answer"?(r.openBlock(),r.createElementBlock("div",Gu,[r.createElementVNode("div",Qu,[r.createElementVNode("h3",Ju,r.toDisplayString(k.question),1),r.createElementVNode("span",Zu,r.toDisplayString(k.points)+" pts",1)]),r.createElementVNode("div",tf,[r.createElementVNode("input",{type:"text",value:s[k.id]?.submitted?s[k.id].answer:o[k.id]||"",placeholder:k.placeholder||"Type your answer here...",disabled:s[k.id]?.submitted,class:r.normalizeClass(["quiz-input",s[k.id]?.submitted&&k.correctAnswers&&k.correctAnswers.length?s[k.id].isCorrect?"quiz-input-correct":"quiz-input-incorrect":""]),onInput:x=>!s[k.id]?.submitted&&(o[k.id]=x.target.value),onKeydown:r.withKeys(r.withModifiers(x=>!s[k.id]?.submitted&&b(k),["prevent"]),["enter"])},null,42,ef),s[k.id]?.submitted?r.createCommentVNode("",!0):(r.openBlock(),r.createElementBlock("button",{key:0,class:"quiz-submit",disabled:!(o[k.id]||"").trim(),onClick:x=>b(k)}," Submit ",8,nf))]),s[k.id]?.submitted?(r.openBlock(),r.createElementBlock("div",sf,[k.correctAnswers&&k.correctAnswers.length?(r.openBlock(),r.createElementBlock("div",{key:0,class:r.normalizeClass(["quiz-feedback",s[k.id].isCorrect?"correct":"incorrect"])},r.toDisplayString(s[k.id].isCorrect?`✓ Correct! (+${s[k.id].points} pts)`:`✗ Incorrect. Accepted answers: ${(k.correctAnswers||[]).join(", ")||"N/A"}`),3)):(r.openBlock(),r.createElementBlock("div",of," Your answer: "+r.toDisplayString(s[k.id].answer),1))])):r.createCommentVNode("",!0)])):r.createCommentVNode("",!0)]))),128))]),d.value?(r.openBlock(),r.createElementBlock("div",af,[y[0]||(y[0]=r.createElementVNode("h3",null,"Quiz Complete!",-1)),r.createElementVNode("div",rf," Final Score: "+r.toDisplayString(l.value)+"/"+r.toDisplayString(a.value)+" points ("+r.toDisplayString(u.value)+"%) ",1),_.passingScore!==void 0?(r.openBlock(),r.createElementBlock("div",{key:0,class:r.normalizeClass(["quiz-result",f.value?"passed":"failed"])},r.toDisplayString(f.value?"🎉 Passed!":"❌ Failed")+" (Passing: "+r.toDisplayString(_.passingScore)+"%) ",3)):r.createCommentVNode("",!0)])):r.createCommentVNode("",!0)]))}}),lf={class:"widget-saq"},cf={class:"saq-question"},df={class:"saq-input-container"},hf=["placeholder","disabled"],uf=["disabled"],Zn=r.defineComponent({__name:"ShortAnswerQuestion",props:{question:{},placeholder:{default:"Type your answer here..."},correctAnswer:{},correctAnswers:{},showFeedback:{type:Boolean,default:!1}},emits:["change"],setup(n,{emit:t}){const e=n,i=t,s=r.ref(""),o=r.ref(!1),a=r.ref(void 0);function l(){if(!s.value.trim())return;o.value=!0;const d=e.correctAnswers&&e.correctAnswers.length>0?e.correctAnswers:typeof e.correctAnswer=="string"?[e.correctAnswer]:void 0,h=d?d.some(u=>u.toLowerCase()===s.value.trim().toLowerCase()):void 0;a.value=h,i("change",{answer:s.value.trim(),isCorrect:h})}const c=r.computed(()=>!o.value||!e.showFeedback?"":e.correctAnswers&&e.correctAnswers.length>0||typeof e.correctAnswer<"u"?e.correctAnswers&&e.correctAnswers.length>0?a.value?"✓ Correct!":`✗ Incorrect. Accepted answers: ${(e.correctAnswers||[]).join(", ")}`:a.value?"✓ Correct!":`✗ Incorrect. The correct answer is: ${e.correctAnswer}`:`Your answer: ${s.value.trim()}`);return(d,h)=>(r.openBlock(),r.createElementBlock("div",lf,[r.createElementVNode("div",cf,r.toDisplayString(d.question),1),r.createElementVNode("div",df,[r.withDirectives(r.createElementVNode("input",{type:"text","onUpdate:modelValue":h[0]||(h[0]=u=>s.value=u),placeholder:d.placeholder||"Type your answer here...",disabled:o.value&&d.showFeedback,class:r.normalizeClass(["saq-input",o.value&&d.showFeedback?a.value?"saq-input-correct":"saq-input-incorrect":""]),onKeydown:h[1]||(h[1]=r.withKeys(r.withModifiers(u=>!o.value&&l(),["prevent"]),["enter"]))},null,42,hf),[[r.vModelText,s.value]]),o.value?r.createCommentVNode("",!0):(r.openBlock(),r.createElementBlock("button",{key:0,class:"saq-submit",disabled:!s.value.trim(),onClick:l}," Submit ",8,uf))]),o.value&&d.showFeedback&&c.value?(r.openBlock(),r.createElementBlock("div",{key:0,class:r.normalizeClass(["saq-feedback",a.value?"correct":"incorrect"])},r.toDisplayString(c.value),3)):r.createCommentVNode("",!0)]))}}),ff={class:"widget"},pf={key:1,style:{color:"red"}},lo=r.defineComponent({__name:"Widget",props:{id:{},content:{},data:{}},setup(n){const t=n,e={Button:sn,ButtonGroup:on,Cascader:an,TreeSelect:Yn,Chart:se,Form:ao,Incomplete:ro,MultipleChoiceQuestion:Qn,"multiple-choice-question":Qn,Select:qn,SelectMulti:Un,ShortAnswerQuestion:Zn,"short-answer-question":Zn,Slider:Xn,Switch:Kn,TextInput:Gn,Quiz:Jn,quiz:Jn,RadioGroup:tn,"radio-group":tn,Text:nn,text:nn,NumberInput:en,"number-input":en,DatePicker:Ze,"date-picker":Ze},i={button:"Button","button-group":"ButtonGroup",cascade:"Cascader","tree-select":"TreeSelect","chart-line":"Chart","chart-bar":"Chart","chart-pie":"Chart","chart-scatter":"Chart",form:"Form",incomplete:"Incomplete","multiple-choice-question":"MultipleChoiceQuestion",quiz:"Quiz","radio-group":"RadioGroup",select:"Select","select-multi":"SelectMulti","short-answer-question":"ShortAnswerQuestion",slider:"Slider",switch:"Switch",text:"Text","text-input":"TextInput","number-input":"NumberInput","date-picker":"DatePicker"};let s={type:"incomplete"};try{s=JSON.parse(decodeURIComponent(t.content))}catch{}const o=r.computed(()=>{if(t.data)try{return JSON.parse(decodeURIComponent(t.data))}catch{return}}),a=r.computed(()=>{const h=s.type,u=i[h]||h;let f=e[u];if(!f&&typeof u=="string"){const p=u.split(/[-_]/).map(g=>g.charAt(0).toUpperCase()+g.slice(1)).join("");f=e[p]}return f}),l=h=>{const u=new CustomEvent("widget-event",{detail:h,bubbles:!0,composed:!0}),f=document.querySelector(`markdown-ui-widget[id="${t.id}"]`);if(f){const p=f.closest(".widget-container");p&&p.dispatchEvent(u)}},c=(h,u)=>{const f=document.querySelector(`markdown-ui-widget[id="${h}"]`);if(f){const p=f.closest(".widget-container");p&&p.dispatchEvent(new CustomEvent("widget-submit",{detail:{id:h,value:u},bubbles:!0,composed:!0}))}},d=(h,u)=>{const f=document.querySelector(`markdown-ui-widget[id="${h}"]`);if(f){const p=f.closest(".widget-container");p&&p.dispatchEvent(new CustomEvent("widget-form-change",{detail:{id:h,stats:u},bubbles:!0,composed:!0}))}};return(h,u)=>(r.openBlock(),r.createElementBlock("div",ff,[a.value?(r.openBlock(),r.createBlock(r.resolveDynamicComponent(a.value),r.mergeProps({key:0},r.unref(s),{"initial-data":o.value,onChange:u[0]||(u[0]=f=>l({id:t.id,value:f})),onSubmit:u[1]||(u[1]=f=>c(t.id,f)),onFieldchange:u[2]||(u[2]=f=>d(t.id,f))}),null,16,["initial-data"])):(r.openBlock(),r.createElementBlock("span",pf,' Unknown widget "'+r.toDisplayString(r.unref(s).type)+'" ',1))]))}}),mf=["innerHTML"],gf=r.defineComponent({__name:"MarkdownUI",props:{html:{},data:{}},emits:["widgetEvent","submit","formChange"],setup(n,{emit:t}){const e=n,i=t,s=r.ref(),o=r.computed(()=>{const h=e.data;if(!h||Object.keys(h).length===0)return e.html;const u=encodeURIComponent(JSON.stringify(h));return e.html.replace(/<markdown-ui-widget\b/g,`<markdown-ui-widget data-widget-data="${u}"`)});let a;typeof HTMLElement<"u"&&(a=class extends HTMLElement{vueApp=null;mountPoint=null;connectedCallback(){const h=this.getAttribute("id")||"",u=this.getAttribute("content")||"",f=this.getAttribute("data-widget-data")||"";this.innerHTML="";const p=document.createElement("div");this.appendChild(p),this.mountPoint=p,import("vue").then(({createApp:g})=>{this.vueApp=g(lo,{id:h,content:u,data:f}),this.vueApp.mount(p)})}disconnectedCallback(){this.vueApp&&this.mountPoint&&(this.vueApp.unmount(),this.vueApp=null,this.mountPoint=null)}},typeof window<"u"&&!customElements.get("markdown-ui-widget")&&customElements.define("markdown-ui-widget",a));const l=h=>{i("widgetEvent",h)},c=h=>{i("submit",h)},d=h=>{i("formChange",h)};return r.onMounted(()=>{s.value&&(s.value.addEventListener("widget-event",l),s.value.addEventListener("widget-submit",c),s.value.addEventListener("widget-form-change",d))}),r.onUnmounted(()=>{s.value&&(s.value.removeEventListener("widget-event",l),s.value.removeEventListener("widget-submit",c),s.value.removeEventListener("widget-form-change",d))}),(h,u)=>(r.openBlock(),r.createElementBlock("div",{ref_key:"container",ref:s,class:"widget-container"},[r.createElementVNode("div",{innerHTML:o.value},null,8,mf)],512))}});it.Button=sn,it.ButtonGroup=on,it.Cascader=an,it.Chart=se,it.DatePicker=Ze,it.Form=ao,it.Incomplete=ro,it.MarkdownUI=gf,it.MultipleChoiceQuestion=Qn,it.NumberInput=en,it.Quiz=Jn,it.RadioGroup=tn,it.Select=qn,it.SelectMulti=Un,it.ShortAnswerQuestion=Zn,it.Slider=Xn,it.Switch=Kn,it.Text=nn,it.TextInput=Gn,it.TreeSelect=Yn,it.Widget=lo,Object.defineProperty(it,Symbol.toStringTag,{value:"Module"})}));
|