/*! For license information please see shindan.js.LICENSE.txt */
(()=>{var t={3573:t=>{function e(t){return e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},e(t)}function i(t,e){var i="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!i){if(Array.isArray(t)||(i=function(t,e){if(t){if("string"==typeof t)return n(t,e);var i={}.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?n(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){i&&(t=i);var r=0,o=function(){};return{s:o,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,s=!0,l=!1;return{s:function(){i=i.call(t)},n:function(){var t=i.next();return s=t.done,t},e:function(t){l=!0,a=t},f:function(){try{s||null==i.return||i.return()}finally{if(l)throw a}}}}function n(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=Array(e);i<e;i++)n[i]=t[i];return n}function r(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),i.push.apply(i,n)}return i}function o(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?r(Object(i),!0).forEach(function(e){a(t,e,i[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):r(Object(i)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))})}return t}function a(t,i,n){return(i=function(t){var i=function(t,i){if("object"!=e(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,i||"default");if("object"!=e(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===i?String:Number)(t)}(t,"string");return"symbol"==e(i)?i:i+""}(i))in t?Object.defineProperty(t,i,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[i]=n,t}function s(t,e,i,n,r,o,a,s){return!(t+i/2<r-a/2||t-i/2>r+a/2||e+n/2<o-s/2||e-n/2>o+s/2)}function l(t,e,i,n,r,o,a){var s=Math.max(t-i/2,Math.min(r,t+i/2))-r,l=Math.max(e-n/2,Math.min(o,e+n/2))-o;return s*s+l*l<a*a}function c(t,e,i,n,r,o,a){for(var s=6*a,l=28*a,c=Math.min(80*a,n/(r*o)*.9),h=Math.max(l,c),u=null;h>=s;){t.font="bold ".concat(h,"px sans-serif");var d=b(e),f=[];if(2===o&&d.length>=4)if(d.every(function(t){return 1===t.length&&!t.match(/[a-zA-Z0-9]/)})&&d.length%2==0){var p=d.length/2,g=d.slice(0,p).join(""),m=d.slice(p).join(""),y=t.measureText(g).width,x=t.measureText(m).width;y<=.95*i&&x<=.95*i&&(f=[g,m])}if(0===f.length){for(var v="",_=0;_<d.length;_++){var w=d[_],k=v?v+w:w;if(t.measureText(k).width>.95*i)if(v)f.push(v.trim()),v=w;else if(w.length>1)if(/^[a-zA-Z]+$/.test(w)){for(var S="",M=0;M<w.length;M++){var D=w[M],P=S+D+"-";t.measureText(P).width>.95*i&&S.length>0?(f.push(S+"-"),S=D):S+=D}v=S}else for(var T=0;T<w.length;T++){var C=w[T],E=v+C;t.measureText(E).width>.95*i?v?(f.push(v),v=C):(f.push(C),v=""):v=E}else f.push(w),v="";else v=k}v&&f.push(v.trim())}var O=h*r*f.length;if(f.length<=o&&O<=.95*n){u={lines:f,fontSize:h};break}h-=1}u||(t.font="bold ".concat(s,"px sans-serif"),u={lines:[e.substring(0,10)+"..."],fontSize:s});return u}function h(t,e,i){var n=t.x-t.width/2,r=t.x+t.width/2,o=t.y-t.height/2,a=t.y+t.height/2,s=e.x-e.width/2,l=e.x+e.width/2,c=e.y-e.height/2,h=e.y+e.height/2;return!(r+i<s||n-i>l||a+i<c||o-i>h)}function u(t,e,i,n,r){for(var o=t.x-t.width/2-r,a=t.x+t.width/2+r,s=t.y-t.height/2-r,l=t.y+t.height/2+r,c=0;c<=20;c++){var h=c/20,u=(1-h)*(1-h)*e.x+2*(1-h)*h*i.x+h*h*n.x,d=(1-h)*(1-h)*e.y+2*(1-h)*h*i.y+h*h*n.y;if(u>=o&&u<=a&&d>=s&&d<=l)return!0}return!1}function d(t,e,n,r,o){for(var a=0,s=0;s<n;s++){a+=100*f(t,e[s])}for(var l=0;l<e.length;l++)if(l!==n){var c=e[l];a+=p(t,c.arrowStart,c.arrowControl,c.arrowEnd)}var h,u=i(r);try{for(u.s();!(h=u.n()).done;){a+=200*g(t,h.value)}}catch(t){u.e(t)}finally{u.f()}return a}function f(t,e){var i=t.x-t.width/2,n=t.x+t.width/2,r=t.y-t.height/2,o=t.y+t.height/2,a=e.x-e.width/2,s=e.x+e.width/2,l=e.y-e.height/2,c=e.y+e.height/2;return Math.max(0,Math.min(n,s)-Math.max(i,a))*Math.max(0,Math.min(o,c)-Math.max(r,l))}function p(t,e,i,n){for(var r=t.x-t.width/2,o=t.x+t.width/2,a=t.y-t.height/2,s=t.y+t.height/2,l=0,c=0;c<20;c++){var h=c/20,u=(c+1)/20,d=(1-h)*(1-h)*e.x+2*(1-h)*h*i.x+h*h*n.x,f=(1-h)*(1-h)*e.y+2*(1-h)*h*i.y+h*h*n.y,p=(1-u)*(1-u)*e.x+2*(1-u)*u*i.x+u*u*n.x,g=(1-u)*(1-u)*e.y+2*(1-u)*u*i.y+u*u*n.y;if(d>=r&&d<=o&&f>=a&&f<=s||p>=r&&p<=o&&g>=a&&g<=s)l+=Math.sqrt((p-d)*(p-d)+(g-f)*(g-f))}return l}function g(t,e){var i=t.x-e.x,n=t.y-e.y,r=Math.sqrt(i*i+n*n),o=Math.sqrt(t.width/2*(t.width/2)+t.height/2*(t.height/2)),a=e.radius+o;return r>=a?0:a-r}function m(t,e,i){var n=t.x-e.x,r=t.y-e.y,o=Math.sqrt(n*n+r*r),a=Math.sqrt(t.width/2*(t.width/2)+t.height/2*(t.height/2));return o<e.radius+a+i}function b(t){for(var e=Array.from(t),i=[],n=0;n<e.length;){var r=e[n];if(/[a-zA-Z0-9]/.test(r)){var o=r;for(n++;n<e.length&&/[a-zA-Z0-9]/.test(e[n]);)o+=e[n],n++;i.push(o)}else{var a=r;for(n++;n<e.length&&/[\u0E31\u0E33-\u0E3A\u0E47-\u0E4E]/.test(e[n]);)a+=e[n],n++;i.push(a)}}return i}function y(t){var e,i,n;if(t.startsWith("#")){var r=t.slice(1);3===r.length?(e=parseInt(r[0]+r[0],16),i=parseInt(r[1]+r[1],16),n=parseInt(r[2]+r[2],16)):(e=parseInt(r.slice(0,2),16),i=parseInt(r.slice(2,4),16),n=parseInt(r.slice(4,6),16))}else{if(!t.startsWith("rgb"))return!1;var o=t.match(/\d+/g);e=parseInt(o[0]),i=parseInt(o[1]),n=parseInt(o[2])}var a=e/255,s=i/255,l=n/255;return.2126*(a<=.03928?a/12.92:Math.pow((a+.055)/1.055,2.4))+.7152*(s<=.03928?s/12.92:Math.pow((s+.055)/1.055,2.4))+.0722*(l<=.03928?l/12.92:Math.pow((l+.055)/1.055,2.4))>.5}function x(t,e,i){t/=255,e/=255,i/=255;var n,r,o=Math.max(t,e,i),a=Math.min(t,e,i),s=(o+a)/2;if(o===a)n=r=0;else{var l=o-a;switch(r=s>.5?l/(2-o-a):l/(o+a),o){case t:n=((e-i)/l+(e<i?6:0))/6;break;case e:n=((i-t)/l+2)/6;break;case i:n=((t-e)/l+4)/6}}return{h:Math.round(360*n),s:Math.round(100*r),l:Math.round(100*s)}}function v(t,e,i){var n,r,o;if(t/=360,i/=100,0===(e/=100))n=r=o=i;else{var a=function(t,e,i){return i<0&&(i+=1),i>1&&(i-=1),i<1/6?t+6*(e-t)*i:i<.5?e:i<2/3?t+(e-t)*(2/3-i)*6:t},s=i<.5?i*(1+e):i+e-i*e,l=2*i-s;n=a(l,s,t+1/3),r=a(l,s,t),o=a(l,s,t-1/3)}return{r:Math.round(255*n),g:Math.round(255*r),b:Math.round(255*o)}}function _(t,e){var i,n,r;if(t.startsWith("#")){var o=t.slice(1);3===o.length?(i=parseInt(o[0]+o[0],16),n=parseInt(o[1]+o[1],16),r=parseInt(o[2]+o[2],16)):(i=parseInt(o.slice(0,2),16),n=parseInt(o.slice(2,4),16),r=parseInt(o.slice(4,6),16))}else{if(!t.startsWith("rgb"))return"#000000";var a=t.match(/\d+/g);i=parseInt(a[0]),n=parseInt(a[1]),r=parseInt(a[2])}var s=x(i,n,r);s.l=Math.max(0,s.l*(1-e));var l=v(s.h,s.s,s.l);return"#".concat(l.r.toString(16).padStart(2,"0")).concat(l.g.toString(16).padStart(2,"0")).concat(l.b.toString(16).padStart(2,"0"))}var w={drawCorrelationChart:function(t,e){var n,r,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};"number"==typeof a&&(a={scale:a});var f=a&&a.ctx?a.ctx:t.getContext("2d");if(!f)throw new Error("Canvas 2D context is required");var p=t.width,g=t.height,b=null!==(n=a.baseDisplayWidth)&&void 0!==n?n:500,x="number"==typeof a.scale?a.scale:Math.max(1,p/b),v=!1!==a.resizeCanvas,w=a.backgroundColor||"#ffffff",k=a.verticalAlign||"top",S=null!==(r=a.offsetY)&&void 0!==r?r:0;f.clearRect(0,0,p,g);var M=e.correlationData||{},D=M.characters||[],P=M.centerCharacter;if(0===D.length)return f.fillStyle="#666",f.font="28px sans-serif",f.textAlign="center",f.textBaseline="middle",void f.fillText("登場人物を追加してください",p/2,g/2);var T,C=p/2,E=g/2,O=void 0!==P&&P>=0&&P<D.length,A=D.length;T=1===A?65*x:2===A?60*x:3===A?55*x:4===A?50*x:5===A?45*x:40*x;var L=[];if(O){var I=D[P],F=D.filter(function(t,e){return e!==P}),R=Math.min(p,g)/2.8;L.push(o(o({},I),{},{x:C,y:E,originalIndex:P,isCenter:!0,radius:T})),F.forEach(function(t,e){var i=e/F.length*2*Math.PI-Math.PI/2,n=C+R*Math.cos(i),r=E+R*Math.sin(i),a=D.findIndex(function(e){return e===t});L.push(o(o({},t),{},{x:n,y:r,originalIndex:a,isCenter:!1,radius:T}))})}else{var z=p/2-T-(6===A?40:0),j=D.map(function(t,e){var i=e/D.length*2*Math.PI-Math.PI/2,n=z*Math.cos(i),r=z*Math.sin(i);return 6===D.length&&(1!==e&&2!==e&&4!==e&&5!==e||(n*=1.15)),{x:n,y:r,char:t,index:e}}),B=T+1*x,W=1/0,N=-1/0,V=1/0,H=-1/0;j.forEach(function(t){W=Math.min(W,t.x-B),N=Math.max(N,t.x+B),V=Math.min(V,t.y-B),H=Math.max(H,t.y+B)});var q=C-(W+N)/2,$=E-(V+H)/2;j.forEach(function(t){L.push(o(o({},t.char),{},{x:t.x+q,y:t.y+$,originalIndex:t.index,isCenter:!1,radius:T}))})}var U=1*x,Y=1/0,G=-1/0,X=1/0,Z=-1/0;L.forEach(function(t){var e=t.radius+U;Y=Math.min(Y,t.x-e),G=Math.max(G,t.x+e),X=Math.min(X,t.y-e),Z=Math.max(Z,t.y+e)});var Q=G-Y,J=Z-X,K=S+J,tt=g;if(v){var et=Math.max(1,Math.ceil(K));et!==t.height&&(t.height=et),tt=g=t.height}else tt=g;(f=a&&a.ctx?a.ctx:t.getContext("2d")).fillStyle=w,f.fillRect(0,0,p,tt);var it=Math.max(0,tt-K),nt=0;"center"===k?nt=it/2:"bottom"===k&&(nt=it);var rt=S-X+nt;L.forEach(function(t){t.y+=rt});var ot=new Set;L.forEach(function(t){t.feelings&&0!==t.feelings.length&&t.feelings.forEach(function(e){var i=parseInt(e.target);if(!isNaN(i)){var n=L.find(function(t){return t.originalIndex===i});if(n&&n.feelings)if(n.feelings.some(function(e){return parseInt(e.target)===t.originalIndex})){var r=[Math.min(t.originalIndex,i),Math.max(t.originalIndex,i)].join("-");ot.add(r)}}})});var at=[];return L.forEach(function(t){t.feelings&&0!==t.feelings.length&&t.feelings.forEach(function(e){var i=parseInt(e.target);if(!isNaN(i)){var n=L.find(function(t){return t.originalIndex===i});if(n){var r=e.emotion||"";if(""!==r.trim()){var o=[Math.min(t.originalIndex,i),Math.max(t.originalIndex,i)].join("-"),a=ot.has(o),s=a&&t.originalIndex>i,l=function(t,e,i,n){var r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,o=arguments.length>5&&void 0!==arguments[5]&&arguments[5],a=arguments.length>6&&void 0!==arguments[6]&&arguments[6],s=e.x,l=e.y,c=i.x,h=i.y,u=c-s,d=h-l,f=Math.sqrt(u*u+d*d);if(0===f)return;var p,g,m=u/f,b=d/f,x=4*r,v=-b*x,w=m*x,k=e.radius+1*r,S=i.radius+1*r,M=s+m*k+v,D=l+b*k+w,P=c-m*S+v,T=h-b*S+w,C=(M+P)/2,E=(D+T)/2;if(o){var O,A,L=Math.min(.25*f,50*r);e.originalIndex<i.originalIndex?(O=e,A=i):(O=i,A=e);var I=A.x-O.x,F=A.y-O.y,R=Math.sqrt(I*I+F*F);if(0===R)p=C,g=E;else{var z=a?-1:1;p=C+-(F/R)*L*z,g=E+I/R*L*z}}else{var j=-b,B=m,W=Math.min(.15*f,30*r);p=C+j*W,g=E+B*W}var N=e.color||"#666",V=y(N)?_(N,.3):N;t.strokeStyle="#ffffff",t.lineWidth=6*r,t.beginPath(),t.moveTo(M,D),t.quadraticCurveTo(p,g,P,T),t.stroke(),t.globalAlpha=.7,t.strokeStyle=V,t.lineWidth=2*r,t.beginPath(),t.moveTo(M,D),t.quadraticCurveTo(p,g,P,T),t.stroke();var H=14*r,q=Math.atan2(T-g,P-p);t.globalAlpha=1,t.fillStyle="#ffffff",t.strokeStyle="#ffffff",t.lineWidth=2*r,t.beginPath(),t.moveTo(P,T),t.lineTo(P-H*Math.cos(q-Math.PI/6),T-H*Math.sin(q-Math.PI/6)),t.lineTo(P-H*Math.cos(q+Math.PI/6),T-H*Math.sin(q+Math.PI/6)),t.closePath(),t.fill(),t.stroke(),t.globalAlpha=.7,t.fillStyle=V,t.beginPath(),t.moveTo(P,T),t.lineTo(P-H*Math.cos(q-Math.PI/6),T-H*Math.sin(q-Math.PI/6)),t.lineTo(P-H*Math.cos(q+Math.PI/6),T-H*Math.sin(q+Math.PI/6)),t.closePath(),t.fill(),t.globalAlpha=1;var $=.5;return{x:(1-$)*(1-$)*M+2*(1-$)*$*p+$*$*P,y:(1-$)*(1-$)*D+2*(1-$)*$*g+$*$*T,emotion:n,color:N,scale:r,arrowStart:{x:M,y:D},arrowControl:{x:p,y:g},arrowEnd:{x:P,y:T},fromIndex:e.originalIndex,toIndex:i.originalIndex}}(f,t,n,r,x,a,s);l&&at.push(l)}}}})}),function(t,e,n,r,a,f,p){var g,b;f<=2?(g=90*a,b=50*a):3===f?(g=75*a,b=42*a):4===f?(g=68*a,b=38*a):(g=60*a,b=35*a);for(var x=1.1,v=2,w=e.map(function(e){var i=e.emotion;t.font="bold 28px sans-serif";var n=10*t.measureText("あ").width;if(t.measureText(i).width>n){for(var r=i;t.measureText(r+"...").width>n&&r.length>0;)r=r.substring(0,r.length-1);i=r+"..."}var s=c(t,i,g,b,x,v,a);return o(o({},e),{},{lines:s.lines,fontSize:s.fontSize,lineHeight:x,width:g,height:b,x:e.x,y:e.y,arrowStart:e.arrowStart,arrowControl:e.arrowControl,arrowEnd:e.arrowEnd,fromIndex:e.fromIndex,toIndex:e.toIndex})}),k=0;k<w.length;k++)for(var S=w[k],M=k+1;M<w.length;M++){var D=w[M];if(S.fromIndex===D.toIndex&&S.toIndex===D.fromIndex){var P=S.arrowStart.x,T=S.arrowStart.y,C=S.arrowControl.x,E=S.arrowControl.y,O=S.arrowEnd.x,A=S.arrowEnd.y,L=.25*P+.5*C+.25*O,I=.25*T+.5*E+.25*A,F=D.arrowStart.x,R=D.arrowStart.y,z=D.arrowControl.x,j=D.arrowControl.y,B=D.arrowEnd.x,W=D.arrowEnd.y,N=.25*F+.5*z+.25*B,V=.25*R+.5*j+.25*W,H=P-L,q=T-I,$=F-N,U=R-V,Y=.3;if(S.x=L+H*Y,S.y=I+q*Y,D.x=N+$*Y,D.y=V+U*Y,f<=3){var G=-2*(1-Y)*P+2*(1-2*Y)*C+2*Y*O,X=-2*(1-Y)*T+2*(1-2*Y)*E+2*Y*A,Z=Math.sqrt(G*G+X*X),Q=-X/Z,J=G/Z,K=-2*(1-Y)*F+2*(1-2*Y)*z+2*Y*B,tt=-2*(1-Y)*R+2*(1-2*Y)*j+2*Y*W,et=Math.sqrt(K*K+tt*tt),it=-tt/et,nt=K/et,rt=void 0;rt=2===f?20*a:15*a,S.x+=Q*rt,S.y+=J*rt,D.x+=it*rt,D.y+=nt*rt}S.isMutualEmotion=!0,D.isMutualEmotion=!0}}for(var ot=2*a,at=5*a,st=0;st<w.length;st++){for(var lt=w[st],ct=lt.x,ht=lt.y,ut=!1,dt=0;dt<st;dt++){if(h(lt,w[dt],ot)){ut=!0;break}}if(!lt.isMutualEmotion||ut){for(var ft=!1,pt=0;pt<w.length;pt++)if(st!==pt){var gt=w[pt];if(u(lt,gt.arrowStart,gt.arrowControl,gt.arrowEnd,at)){ft=!0;break}}var mt,bt=!1,yt=i(p);try{for(yt.s();!(mt=yt.n()).done;){if(m(lt,mt.value,ot)){bt=!0;break}}}catch(t){yt.e(t)}finally{yt.f()}if(ut||ft||bt){for(var xt=null,vt=1/0,_t=0,wt=[.5,.4,.6,.3,.7,.2,.8,.1,.9,.45,.55,.35,.65,.25,.75,.15,.85,.05,.95];_t<wt.length;_t++){var kt=wt[_t],St=lt.arrowStart.x,Mt=lt.arrowStart.y,Dt=lt.arrowControl.x,Pt=lt.arrowControl.y,Tt=(1-kt)*(1-kt)*St+2*(1-kt)*kt*Dt+kt*kt*lt.arrowEnd.x,Ct=(1-kt)*(1-kt)*Mt+2*(1-kt)*kt*Pt+kt*kt*lt.arrowEnd.y;lt.x=Tt,lt.y=Ct;var Et=d(lt,w,st,p,at);if(0===Et){xt={x:Tt,y:Ct},vt=0;break}Et<vt&&(vt=Et,xt={x:Tt,y:Ct})}xt?(lt.x=xt.x,lt.y=xt.y):(lt.x=ct,lt.y=ht)}}}(function(t,e,n,r,o,a,h,u){for(var d=1.8,f=.05,p=e.map(function(t,e){return{index:e,width:t.width,height:t.height,fontSize:t.fontSize,lines:t.lines,emotion:t.emotion,x:t.x,y:t.y}}),g=1,m=p.map(function(t){return{index:t.index,width:t.width,height:t.height,fontSize:t.fontSize,lines:t.lines}}),b=1+f;b<=d;b+=f){var y,x=!1,v=[],_=i(p);try{for(_.s();!(y=_.n()).done;){var w=y.value,k=w.width*b,S=w.height*b,M=c(t,w.emotion,k,S,o,a,r);v.push({index:w.index,width:k,height:S,fontSize:M.fontSize,lines:M.lines,x:w.x,y:w.y})}}catch(t){_.e(t)}finally{_.f()}for(var D=0;D<v.length;D++){for(var P=v[D],T=D+1;T<v.length;T++){var C=v[T];if(s(P.x,P.y,P.width,P.height,C.x,C.y,C.width,C.height)){x=!0;break}}if(x)break;if(!x){var E,O=i(n);try{for(O.s();!(E=O.n()).done;){var A=E.value,L=A.radius||40*r;if(l(P.x,P.y,P.width,P.height,A.x,A.y,L)){x=!0;break}}}catch(t){O.e(t)}finally{O.f()}}if(!x){var I=P.x-P.width/2,F=P.x+P.width/2,R=P.y-P.height/2,z=P.y+P.height/2;(I<0||F>h||R<0||z>u)&&(x=!0)}if(x)break}if(x)break;g=b,m=v}(100*(g-1)).toFixed(0);m.forEach(function(t){p[t.index];e[t.index].width=t.width,e[t.index].height=t.height,e[t.index].fontSize=t.fontSize,e[t.index].lines=t.lines})})(t,w,p,a,x,v,n,r),w.forEach(function(e){var i=e.x,n=e.y,r=e.lines,o=e.fontSize,a=e.lineHeight,s=e.color,l=e.width;e.height;t.font="bold ".concat(o,"px sans-serif"),t.textAlign="left",t.textBaseline="middle";var c=n-o*a*r.length/2+o/2,h=i-l/2;r.forEach(function(e,i){var n=c+o*a*i,r=y(s)?_(s,.6):s;t.strokeStyle="#ffffff",t.lineWidth=Math.max(4,.25*o),t.lineJoin="round",t.strokeText(e,h,n),t.fillStyle=r,t.fillText(e,h,n)})})}(f,at,p,tt,x,A,L),L.forEach(function(t){!function(t,e){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,n=e.x,r=e.y,o=e.radius,a=e.color||"#666";t.fillStyle=a,t.strokeStyle=_(a,.4),t.lineWidth=1*i,t.beginPath(),t.arc(n,r,o,0,2*Math.PI),t.fill(),t.stroke();var s=e.name||"";if(!s)return;var l=12;s.length>l&&(s=s.slice(0,l)+"...");var c=2*o*.85,h=2*o*.7,u=e.isCenter?32*i:28*i,d=10*i,f=y(a)?"#000000":"#ffffff";if(t.fillStyle=f,t.textAlign="center",t.textBaseline="middle",s.length>5){for(var p=Math.ceil(s.length/2),g=s.slice(0,p),m=s.slice(p),b=!1;u>d&&!b;){t.font="bold ".concat(u,"px sans-serif");var x=t.measureText(g).width,v=t.measureText(m).width;Math.max(x,v)<=c&&2.2*u<=h?b=!0:u-=1}t.font="bold ".concat(u,"px sans-serif");var w=.6*u;t.fillStyle=f,t.fillText(g,n,r-w),t.fillText(m,n,r+w)}else{for(var k=!1;u>d&&!k;){t.font="bold ".concat(u,"px sans-serif"),t.measureText(s).width<=c?k=!0:u-=1}t.font="bold ".concat(u,"px sans-serif"),t.fillStyle=f,t.fillText(s,n,r)}}(f,t,x)}),{width:t.width,height:t.height,chartWidth:Q,chartHeight:J,offsetY:S,scale:x}},calculateTitleSize:function(t,e){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:30,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:12;if(!t)return{displayTitle:"",fontSize:i};var r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null;if(r||"undefined"!=typeof document&&"function"==typeof document.createElement&&(r=document.createElement("canvas").getContext("2d")),!r)return{displayTitle:t.length>20?t.substring(0,20)+"…":t,fontSize:n};var o=i;r.font="bold ".concat(o,"px sans-serif");var a=t,s=r.measureText(a).width;if(s>e)for(;a.length>0;){var l=(a=a.slice(0,-1))+"…";if((s=r.measureText(l).width)<=e){a=l;break}}for(r.font="bold ".concat(o,"px sans-serif"),s=r.measureText(a).width;s>e&&o>n;)o-=1,r.font="bold ".concat(o,"px sans-serif"),s=r.measureText(a).width;return{displayTitle:a,fontSize:o}}};t.exports&&(t.exports=w),"undefined"!=typeof window&&(window.correlationChartCommon=w)},7059:(t,e,i)=>{"use strict";function n(){}i.d(e,{P:()=>_a});const r=function(){let t=0;return function(){return t++}}();function o(t){return null==t}function a(t){if(Array.isArray&&Array.isArray(t))return!0;const e=Object.prototype.toString.call(t);return"[object"===e.slice(0,7)&&"Array]"===e.slice(-6)}function s(t){return null!==t&&"[object Object]"===Object.prototype.toString.call(t)}const l=t=>("number"==typeof t||t instanceof Number)&&isFinite(+t);function c(t,e){return l(t)?t:e}function h(t,e){return void 0===t?e:t}const u=(t,e)=>"string"==typeof t&&t.endsWith("%")?parseFloat(t)/100*e:+t;function d(t,e,i){if(t&&"function"==typeof t.call)return t.apply(i,e)}function f(t,e,i,n){let r,o,l;if(a(t))if(o=t.length,n)for(r=o-1;r>=0;r--)e.call(i,t[r],r);else for(r=0;r<o;r++)e.call(i,t[r],r);else if(s(t))for(l=Object.keys(t),o=l.length,r=0;r<o;r++)e.call(i,t[l[r]],l[r])}function p(t,e){let i,n,r,o;if(!t||!e||t.length!==e.length)return!1;for(i=0,n=t.length;i<n;++i)if(r=t[i],o=e[i],r.datasetIndex!==o.datasetIndex||r.index!==o.index)return!1;return!0}function g(t){if(a(t))return t.map(g);if(s(t)){const e=Object.create(null),i=Object.keys(t),n=i.length;let r=0;for(;r<n;++r)e[i[r]]=g(t[i[r]]);return e}return t}function m(t){return-1===["__proto__","prototype","constructor"].indexOf(t)}function b(t,e,i,n){if(!m(t))return;const r=e[t],o=i[t];s(r)&&s(o)?y(r,o,n):e[t]=g(o)}function y(t,e,i){const n=a(e)?e:[e],r=n.length;if(!s(t))return t;const o=(i=i||{}).merger||b;for(let a=0;a<r;++a){if(!s(e=n[a]))continue;const r=Object.keys(e);for(let n=0,a=r.length;n<a;++n)o(r[n],t,e,i)}return t}function x(t,e){return y(t,e,{merger:v})}function v(t,e,i){if(!m(t))return;const n=e[t],r=i[t];s(n)&&s(r)?x(n,r):Object.prototype.hasOwnProperty.call(e,t)||(e[t]=g(r))}const _={"":t=>t,x:t=>t.x,y:t=>t.y};function w(t,e){const i=_[e]||(_[e]=function(t){const e=function(t){const e=t.split("."),i=[];let n="";for(const t of e)n+=t,n.endsWith("\\")?n=n.slice(0,-1)+".":(i.push(n),n="");return i}(t);return t=>{for(const i of e){if(""===i)break;t=t&&t[i]}return t}}(e));return i(t)}function k(t){return t.charAt(0).toUpperCase()+t.slice(1)}const S=t=>void 0!==t,M=t=>"function"==typeof t,D=(t,e)=>{if(t.size!==e.size)return!1;for(const i of t)if(!e.has(i))return!1;return!0};const P=Math.PI,T=2*P,C=T+P,E=Number.POSITIVE_INFINITY,O=P/180,A=P/2,L=P/4,I=2*P/3,F=Math.log10,R=Math.sign;function z(t){const e=Math.round(t);t=B(t,e,t/1e3)?e:t;const i=Math.pow(10,Math.floor(F(t))),n=t/i;return(n<=1?1:n<=2?2:n<=5?5:10)*i}function j(t){return!isNaN(parseFloat(t))&&isFinite(t)}function B(t,e,i){return Math.abs(t-e)<i}function W(t,e,i){let n,r,o;for(n=0,r=t.length;n<r;n++)o=t[n][i],isNaN(o)||(e.min=Math.min(e.min,o),e.max=Math.max(e.max,o))}function N(t){return t*(P/180)}function V(t){return t*(180/P)}function H(t){if(!l(t))return;let e=1,i=0;for(;Math.round(t*e)/e!==t;)e*=10,i++;return i}function q(t,e){const i=e.x-t.x,n=e.y-t.y,r=Math.sqrt(i*i+n*n);let o=Math.atan2(n,i);return o<-.5*P&&(o+=T),{angle:o,distance:r}}function $(t,e){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function U(t,e){return(t-e+C)%T-P}function Y(t){return(t%T+T)%T}function G(t,e,i,n){const r=Y(t),o=Y(e),a=Y(i),s=Y(o-r),l=Y(a-r),c=Y(r-o),h=Y(r-a);return r===o||r===a||n&&o===a||s>l&&c<h}function X(t,e,i){return Math.max(e,Math.min(i,t))}function Z(t,e,i,n=1e-6){return t>=Math.min(e,i)-n&&t<=Math.max(e,i)+n}function Q(t,e,i){i=i||(i=>t[i]<e);let n,r=t.length-1,o=0;for(;r-o>1;)n=o+r>>1,i(n)?o=n:r=n;return{lo:o,hi:r}}const J=(t,e,i,n)=>Q(t,i,n?n=>t[n][e]<=i:n=>t[n][e]<i),K=(t,e,i)=>Q(t,i,n=>t[n][e]>=i);const tt=["push","pop","shift","splice","unshift"];function et(t,e){const i=t._chartjs;if(!i)return;const n=i.listeners,r=n.indexOf(e);-1!==r&&n.splice(r,1),n.length>0||(tt.forEach(e=>{delete t[e]}),delete t._chartjs)}function it(t){const e=new Set;let i,n;for(i=0,n=t.length;i<n;++i)e.add(t[i]);return e.size===n?t:Array.from(e)}const nt="undefined"==typeof window?function(t){return t()}:window.requestAnimationFrame;function rt(t,e,i){const n=i||(t=>Array.prototype.slice.call(t));let r=!1,o=[];return function(...i){o=n(i),r||(r=!0,nt.call(window,()=>{r=!1,t.apply(e,o)}))}}const ot=t=>"start"===t?"left":"end"===t?"right":"center",at=(t,e,i)=>"start"===t?e:"end"===t?i:(e+i)/2;function st(t,e,i){const n=e.length;let r=0,o=n;if(t._sorted){const{iScale:a,_parsed:s}=t,l=a.axis,{min:c,max:h,minDefined:u,maxDefined:d}=a.getUserBounds();u&&(r=X(Math.min(J(s,a.axis,c).lo,i?n:J(e,l,a.getPixelForValue(c)).lo),0,n-1)),o=d?X(Math.max(J(s,a.axis,h,!0).hi+1,i?0:J(e,l,a.getPixelForValue(h),!0).hi+1),r,n)-r:n-r}return{start:r,count:o}}function lt(t){const{xScale:e,yScale:i,_scaleRanges:n}=t,r={xmin:e.min,xmax:e.max,ymin:i.min,ymax:i.max};if(!n)return t._scaleRanges=r,!0;const o=n.xmin!==e.min||n.xmax!==e.max||n.ymin!==i.min||n.ymax!==i.max;return Object.assign(n,r),o}const ct=t=>0===t||1===t,ht=(t,e,i)=>-Math.pow(2,10*(t-=1))*Math.sin((t-e)*T/i),ut=(t,e,i)=>Math.pow(2,-10*t)*Math.sin((t-e)*T/i)+1,dt={linear:t=>t,easeInQuad:t=>t*t,easeOutQuad:t=>-t*(t-2),easeInOutQuad:t=>(t/=.5)<1?.5*t*t:-.5*(--t*(t-2)-1),easeInCubic:t=>t*t*t,easeOutCubic:t=>(t-=1)*t*t+1,easeInOutCubic:t=>(t/=.5)<1?.5*t*t*t:.5*((t-=2)*t*t+2),easeInQuart:t=>t*t*t*t,easeOutQuart:t=>-((t-=1)*t*t*t-1),easeInOutQuart:t=>(t/=.5)<1?.5*t*t*t*t:-.5*((t-=2)*t*t*t-2),easeInQuint:t=>t*t*t*t*t,easeOutQuint:t=>(t-=1)*t*t*t*t+1,easeInOutQuint:t=>(t/=.5)<1?.5*t*t*t*t*t:.5*((t-=2)*t*t*t*t+2),easeInSine:t=>1-Math.cos(t*A),easeOutSine:t=>Math.sin(t*A),easeInOutSine:t=>-.5*(Math.cos(P*t)-1),easeInExpo:t=>0===t?0:Math.pow(2,10*(t-1)),easeOutExpo:t=>1===t?1:1-Math.pow(2,-10*t),easeInOutExpo:t=>ct(t)?t:t<.5?.5*Math.pow(2,10*(2*t-1)):.5*(2-Math.pow(2,-10*(2*t-1))),easeInCirc:t=>t>=1?t:-(Math.sqrt(1-t*t)-1),easeOutCirc:t=>Math.sqrt(1-(t-=1)*t),easeInOutCirc:t=>(t/=.5)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1),easeInElastic:t=>ct(t)?t:ht(t,.075,.3),easeOutElastic:t=>ct(t)?t:ut(t,.075,.3),easeInOutElastic(t){const e=.1125;return ct(t)?t:t<.5?.5*ht(2*t,e,.45):.5+.5*ut(2*t-1,e,.45)},easeInBack(t){const e=1.70158;return t*t*((e+1)*t-e)},easeOutBack(t){const e=1.70158;return(t-=1)*t*((e+1)*t+e)+1},easeInOutBack(t){let e=1.70158;return(t/=.5)<1?t*t*((1+(e*=1.525))*t-e)*.5:.5*((t-=2)*t*((1+(e*=1.525))*t+e)+2)},easeInBounce:t=>1-dt.easeOutBounce(1-t),easeOutBounce(t){const e=7.5625,i=2.75;return t<1/i?e*t*t:t<2/i?e*(t-=1.5/i)*t+.75:t<2.5/i?e*(t-=2.25/i)*t+.9375:e*(t-=2.625/i)*t+.984375},easeInOutBounce:t=>t<.5?.5*dt.easeInBounce(2*t):.5*dt.easeOutBounce(2*t-1)+.5};function ft(t){return t+.5|0}const pt=(t,e,i)=>Math.max(Math.min(t,i),e);function gt(t){return pt(ft(2.55*t),0,255)}function mt(t){return pt(ft(255*t),0,255)}function bt(t){return pt(ft(t/2.55)/100,0,1)}function yt(t){return pt(ft(100*t),0,100)}const xt={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,A:10,B:11,C:12,D:13,E:14,F:15,a:10,b:11,c:12,d:13,e:14,f:15},vt=[..."0123456789ABCDEF"],_t=t=>vt[15&t],wt=t=>vt[(240&t)>>4]+vt[15&t],kt=t=>(240&t)>>4==(15&t);function St(t){var e=(t=>kt(t.r)&&kt(t.g)&&kt(t.b)&&kt(t.a))(t)?_t:wt;return t?"#"+e(t.r)+e(t.g)+e(t.b)+((t,e)=>t<255?e(t):"")(t.a,e):void 0}const Mt=/^(hsla?|hwb|hsv)\(\s*([-+.e\d]+)(?:deg)?[\s,]+([-+.e\d]+)%[\s,]+([-+.e\d]+)%(?:[\s,]+([-+.e\d]+)(%)?)?\s*\)$/;function Dt(t,e,i){const n=e*Math.min(i,1-i),r=(e,r=(e+t/30)%12)=>i-n*Math.max(Math.min(r-3,9-r,1),-1);return[r(0),r(8),r(4)]}function Pt(t,e,i){const n=(n,r=(n+t/60)%6)=>i-i*e*Math.max(Math.min(r,4-r,1),0);return[n(5),n(3),n(1)]}function Tt(t,e,i){const n=Dt(t,1,.5);let r;for(e+i>1&&(r=1/(e+i),e*=r,i*=r),r=0;r<3;r++)n[r]*=1-e-i,n[r]+=e;return n}function Ct(t){const e=t.r/255,i=t.g/255,n=t.b/255,r=Math.max(e,i,n),o=Math.min(e,i,n),a=(r+o)/2;let s,l,c;return r!==o&&(c=r-o,l=a>.5?c/(2-r-o):c/(r+o),s=function(t,e,i,n,r){return t===r?(e-i)/n+(e<i?6:0):e===r?(i-t)/n+2:(t-e)/n+4}(e,i,n,c,r),s=60*s+.5),[0|s,l||0,a]}function Et(t,e,i,n){return(Array.isArray(e)?t(e[0],e[1],e[2]):t(e,i,n)).map(mt)}function Ot(t,e,i){return Et(Dt,t,e,i)}function At(t){return(t%360+360)%360}function Lt(t){const e=Mt.exec(t);let i,n=255;if(!e)return;e[5]!==i&&(n=e[6]?gt(+e[5]):mt(+e[5]));const r=At(+e[2]),o=+e[3]/100,a=+e[4]/100;return i="hwb"===e[1]?function(t,e,i){return Et(Tt,t,e,i)}(r,o,a):"hsv"===e[1]?function(t,e,i){return Et(Pt,t,e,i)}(r,o,a):Ot(r,o,a),{r:i[0],g:i[1],b:i[2],a:n}}const It={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"},Ft={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"};let Rt;function zt(t){Rt||(Rt=function(){const t={},e=Object.keys(Ft),i=Object.keys(It);let n,r,o,a,s;for(n=0;n<e.length;n++){for(a=s=e[n],r=0;r<i.length;r++)o=i[r],s=s.replace(o,It[o]);o=parseInt(Ft[a],16),t[s]=[o>>16&255,o>>8&255,255&o]}return t}(),Rt.transparent=[0,0,0,0]);const e=Rt[t.toLowerCase()];return e&&{r:e[0],g:e[1],b:e[2],a:4===e.length?e[3]:255}}const jt=/^rgba?\(\s*([-+.\d]+)(%)?[\s,]+([-+.e\d]+)(%)?[\s,]+([-+.e\d]+)(%)?(?:[\s,/]+([-+.e\d]+)(%)?)?\s*\)$/;const Bt=t=>t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055,Wt=t=>t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4);function Nt(t,e,i){if(t){let n=Ct(t);n[e]=Math.max(0,Math.min(n[e]+n[e]*i,0===e?360:1)),n=Ot(n),t.r=n[0],t.g=n[1],t.b=n[2]}}function Vt(t,e){return t?Object.assign(e||{},t):t}function Ht(t){var e={r:0,g:0,b:0,a:255};return Array.isArray(t)?t.length>=3&&(e={r:t[0],g:t[1],b:t[2],a:255},t.length>3&&(e.a=mt(t[3]))):(e=Vt(t,{r:0,g:0,b:0,a:1})).a=mt(e.a),e}function qt(t){return"r"===t.charAt(0)?function(t){const e=jt.exec(t);let i,n,r,o=255;if(e){if(e[7]!==i){const t=+e[7];o=e[8]?gt(t):pt(255*t,0,255)}return i=+e[1],n=+e[3],r=+e[5],i=255&(e[2]?gt(i):pt(i,0,255)),n=255&(e[4]?gt(n):pt(n,0,255)),r=255&(e[6]?gt(r):pt(r,0,255)),{r:i,g:n,b:r,a:o}}}(t):Lt(t)}class $t{constructor(t){if(t instanceof $t)return t;const e=typeof t;let i;var n,r,o;"object"===e?i=Ht(t):"string"===e&&(o=(n=t).length,"#"===n[0]&&(4===o||5===o?r={r:255&17*xt[n[1]],g:255&17*xt[n[2]],b:255&17*xt[n[3]],a:5===o?17*xt[n[4]]:255}:7!==o&&9!==o||(r={r:xt[n[1]]<<4|xt[n[2]],g:xt[n[3]]<<4|xt[n[4]],b:xt[n[5]]<<4|xt[n[6]],a:9===o?xt[n[7]]<<4|xt[n[8]]:255})),i=r||zt(t)||qt(t)),this._rgb=i,this._valid=!!i}get valid(){return this._valid}get rgb(){var t=Vt(this._rgb);return t&&(t.a=bt(t.a)),t}set rgb(t){this._rgb=Ht(t)}rgbString(){return this._valid?(t=this._rgb)&&(t.a<255?`rgba(${t.r}, ${t.g}, ${t.b}, ${bt(t.a)})`:`rgb(${t.r}, ${t.g}, ${t.b})`):void 0;var t}hexString(){return this._valid?St(this._rgb):void 0}hslString(){return this._valid?function(t){if(!t)return;const e=Ct(t),i=e[0],n=yt(e[1]),r=yt(e[2]);return t.a<255?`hsla(${i}, ${n}%, ${r}%, ${bt(t.a)})`:`hsl(${i}, ${n}%, ${r}%)`}(this._rgb):void 0}mix(t,e){if(t){const i=this.rgb,n=t.rgb;let r;const o=e===r?.5:e,a=2*o-1,s=i.a-n.a,l=((a*s===-1?a:(a+s)/(1+a*s))+1)/2;r=1-l,i.r=255&l*i.r+r*n.r+.5,i.g=255&l*i.g+r*n.g+.5,i.b=255&l*i.b+r*n.b+.5,i.a=o*i.a+(1-o)*n.a,this.rgb=i}return this}interpolate(t,e){return t&&(this._rgb=function(t,e,i){const n=Wt(bt(t.r)),r=Wt(bt(t.g)),o=Wt(bt(t.b));return{r:mt(Bt(n+i*(Wt(bt(e.r))-n))),g:mt(Bt(r+i*(Wt(bt(e.g))-r))),b:mt(Bt(o+i*(Wt(bt(e.b))-o))),a:t.a+i*(e.a-t.a)}}(this._rgb,t._rgb,e)),this}clone(){return new $t(this.rgb)}alpha(t){return this._rgb.a=mt(t),this}clearer(t){return this._rgb.a*=1-t,this}greyscale(){const t=this._rgb,e=ft(.3*t.r+.59*t.g+.11*t.b);return t.r=t.g=t.b=e,this}opaquer(t){return this._rgb.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 Nt(this._rgb,2,t),this}darken(t){return Nt(this._rgb,2,-t),this}saturate(t){return Nt(this._rgb,1,t),this}desaturate(t){return Nt(this._rgb,1,-t),this}rotate(t){return function(t,e){var i=Ct(t);i[0]=At(i[0]+e),i=Ot(i),t.r=i[0],t.g=i[1],t.b=i[2]}(this._rgb,t),this}}function Ut(t){return new $t(t)}function Yt(t){if(t&&"object"==typeof t){const e=t.toString();return"[object CanvasPattern]"===e||"[object CanvasGradient]"===e}return!1}function Gt(t){return Yt(t)?t:Ut(t)}function Xt(t){return Yt(t)?t:Ut(t).saturate(.5).darken(.1).hexString()}const Zt=Object.create(null),Qt=Object.create(null);function Jt(t,e){if(!e)return t;const i=e.split(".");for(let e=0,n=i.length;e<n;++e){const n=i[e];t=t[n]||(t[n]=Object.create(null))}return t}function Kt(t,e,i){return"string"==typeof e?y(Jt(t,e),i):y(Jt(t,""),e)}var te=new class{constructor(t){this.animation=void 0,this.backgroundColor="rgba(0,0,0,0.1)",this.borderColor="rgba(0,0,0,0.1)",this.color="#666",this.datasets={},this.devicePixelRatio=t=>t.chart.platform.getDevicePixelRatio(),this.elements={},this.events=["mousemove","mouseout","click","touchstart","touchmove"],this.font={family:"'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",size:12,style:"normal",lineHeight:1.2,weight:null},this.hover={},this.hoverBackgroundColor=(t,e)=>Xt(e.backgroundColor),this.hoverBorderColor=(t,e)=>Xt(e.borderColor),this.hoverColor=(t,e)=>Xt(e.color),this.indexAxis="x",this.interaction={mode:"nearest",intersect:!0,includeInvisible:!1},this.maintainAspectRatio=!0,this.onHover=null,this.onClick=null,this.parsing=!0,this.plugins={},this.responsive=!0,this.scale=void 0,this.scales={},this.showLine=!0,this.drawActiveElementsOnTop=!0,this.describe(t)}set(t,e){return Kt(this,t,e)}get(t){return Jt(this,t)}describe(t,e){return Kt(Qt,t,e)}override(t,e){return Kt(Zt,t,e)}route(t,e,i,n){const r=Jt(this,t),o=Jt(this,i),a="_"+e;Object.defineProperties(r,{[a]:{value:r[e],writable:!0},[e]:{enumerable:!0,get(){const t=this[a],e=o[n];return s(t)?Object.assign({},e,t):h(t,e)},set(t){this[a]=t}}})}}({_scriptable:t=>!t.startsWith("on"),_indexable:t=>"events"!==t,hover:{_fallback:"interaction"},interaction:{_scriptable:!1,_indexable:!1}});function ee(t,e,i,n,r){let o=e[r];return o||(o=e[r]=t.measureText(r).width,i.push(r)),o>n&&(n=o),n}function ie(t,e,i,n){let r=(n=n||{}).data=n.data||{},o=n.garbageCollect=n.garbageCollect||[];n.font!==e&&(r=n.data={},o=n.garbageCollect=[],n.font=e),t.save(),t.font=e;let s=0;const l=i.length;let c,h,u,d,f;for(c=0;c<l;c++)if(d=i[c],null!=d&&!0!==a(d))s=ee(t,r,o,s,d);else if(a(d))for(h=0,u=d.length;h<u;h++)f=d[h],null==f||a(f)||(s=ee(t,r,o,s,f));t.restore();const p=o.length/2;if(p>i.length){for(c=0;c<p;c++)delete r[o[c]];o.splice(0,p)}return s}function ne(t,e,i){const n=t.currentDevicePixelRatio,r=0!==i?Math.max(i/2,.5):0;return Math.round((e-r)*n)/n+r}function re(t,e){(e=e||t.getContext("2d")).save(),e.resetTransform(),e.clearRect(0,0,t.width,t.height),e.restore()}function oe(t,e,i,n){ae(t,e,i,n,null)}function ae(t,e,i,n,r){let o,a,s,l,c,h;const u=e.pointStyle,d=e.rotation,f=e.radius;let p=(d||0)*O;if(u&&"object"==typeof u&&(o=u.toString(),"[object HTMLImageElement]"===o||"[object HTMLCanvasElement]"===o))return t.save(),t.translate(i,n),t.rotate(p),t.drawImage(u,-u.width/2,-u.height/2,u.width,u.height),void t.restore();if(!(isNaN(f)||f<=0)){switch(t.beginPath(),u){default:r?t.ellipse(i,n,r/2,f,0,0,T):t.arc(i,n,f,0,T),t.closePath();break;case"triangle":t.moveTo(i+Math.sin(p)*f,n-Math.cos(p)*f),p+=I,t.lineTo(i+Math.sin(p)*f,n-Math.cos(p)*f),p+=I,t.lineTo(i+Math.sin(p)*f,n-Math.cos(p)*f),t.closePath();break;case"rectRounded":c=.516*f,l=f-c,a=Math.cos(p+L)*l,s=Math.sin(p+L)*l,t.arc(i-a,n-s,c,p-P,p-A),t.arc(i+s,n-a,c,p-A,p),t.arc(i+a,n+s,c,p,p+A),t.arc(i-s,n+a,c,p+A,p+P),t.closePath();break;case"rect":if(!d){l=Math.SQRT1_2*f,h=r?r/2:l,t.rect(i-h,n-l,2*h,2*l);break}p+=L;case"rectRot":a=Math.cos(p)*f,s=Math.sin(p)*f,t.moveTo(i-a,n-s),t.lineTo(i+s,n-a),t.lineTo(i+a,n+s),t.lineTo(i-s,n+a),t.closePath();break;case"crossRot":p+=L;case"cross":a=Math.cos(p)*f,s=Math.sin(p)*f,t.moveTo(i-a,n-s),t.lineTo(i+a,n+s),t.moveTo(i+s,n-a),t.lineTo(i-s,n+a);break;case"star":a=Math.cos(p)*f,s=Math.sin(p)*f,t.moveTo(i-a,n-s),t.lineTo(i+a,n+s),t.moveTo(i+s,n-a),t.lineTo(i-s,n+a),p+=L,a=Math.cos(p)*f,s=Math.sin(p)*f,t.moveTo(i-a,n-s),t.lineTo(i+a,n+s),t.moveTo(i+s,n-a),t.lineTo(i-s,n+a);break;case"line":a=r?r/2:Math.cos(p)*f,s=Math.sin(p)*f,t.moveTo(i-a,n-s),t.lineTo(i+a,n+s);break;case"dash":t.moveTo(i,n),t.lineTo(i+Math.cos(p)*f,n+Math.sin(p)*f)}t.fill(),e.borderWidth>0&&t.stroke()}}function se(t,e,i){return i=i||.5,!e||t&&t.x>e.left-i&&t.x<e.right+i&&t.y>e.top-i&&t.y<e.bottom+i}function le(t,e){t.save(),t.beginPath(),t.rect(e.left,e.top,e.right-e.left,e.bottom-e.top),t.clip()}function ce(t){t.restore()}function he(t,e,i,n,r){if(!e)return t.lineTo(i.x,i.y);if("middle"===r){const n=(e.x+i.x)/2;t.lineTo(n,e.y),t.lineTo(n,i.y)}else"after"===r!=!!n?t.lineTo(e.x,i.y):t.lineTo(i.x,e.y);t.lineTo(i.x,i.y)}function ue(t,e,i,n){if(!e)return t.lineTo(i.x,i.y);t.bezierCurveTo(n?e.cp1x:e.cp2x,n?e.cp1y:e.cp2y,n?i.cp2x:i.cp1x,n?i.cp2y:i.cp1y,i.x,i.y)}function de(t,e,i,n,r,s={}){const l=a(e)?e:[e],c=s.strokeWidth>0&&""!==s.strokeColor;let h,u;for(t.save(),t.font=r.string,function(t,e){e.translation&&t.translate(e.translation[0],e.translation[1]);o(e.rotation)||t.rotate(e.rotation);e.color&&(t.fillStyle=e.color);e.textAlign&&(t.textAlign=e.textAlign);e.textBaseline&&(t.textBaseline=e.textBaseline)}(t,s),h=0;h<l.length;++h)u=l[h],c&&(s.strokeColor&&(t.strokeStyle=s.strokeColor),o(s.strokeWidth)||(t.lineWidth=s.strokeWidth),t.strokeText(u,i,n,s.maxWidth)),t.fillText(u,i,n,s.maxWidth),fe(t,i,n,u,s),n+=r.lineHeight;t.restore()}function fe(t,e,i,n,r){if(r.strikethrough||r.underline){const o=t.measureText(n),a=e-o.actualBoundingBoxLeft,s=e+o.actualBoundingBoxRight,l=i-o.actualBoundingBoxAscent,c=i+o.actualBoundingBoxDescent,h=r.strikethrough?(l+c)/2:c;t.strokeStyle=t.fillStyle,t.beginPath(),t.lineWidth=r.decorationWidth||2,t.moveTo(a,h),t.lineTo(s,h),t.stroke()}}function pe(t,e){const{x:i,y:n,w:r,h:o,radius:a}=e;t.arc(i+a.topLeft,n+a.topLeft,a.topLeft,-A,P,!0),t.lineTo(i,n+o-a.bottomLeft),t.arc(i+a.bottomLeft,n+o-a.bottomLeft,a.bottomLeft,P,A,!0),t.lineTo(i+r-a.bottomRight,n+o),t.arc(i+r-a.bottomRight,n+o-a.bottomRight,a.bottomRight,A,0,!0),t.lineTo(i+r,n+a.topRight),t.arc(i+r-a.topRight,n+a.topRight,a.topRight,0,-A,!0),t.lineTo(i+a.topLeft,n)}const ge=new RegExp(/^(normal|(\d+(?:\.\d+)?)(px|em|%)?)$/),me=new RegExp(/^(normal|italic|initial|inherit|unset|(oblique( -?[0-9]?[0-9]deg)?))$/);function be(t,e){const i=(""+t).match(ge);if(!i||"normal"===i[1])return 1.2*e;switch(t=+i[2],i[3]){case"px":return t;case"%":t/=100}return e*t}const ye=t=>+t||0;function xe(t,e){const i={},n=s(e),r=n?Object.keys(e):e,o=s(t)?n?i=>h(t[i],t[e[i]]):e=>t[e]:()=>t;for(const t of r)i[t]=ye(o(t));return i}function ve(t){return xe(t,{top:"y",right:"x",bottom:"y",left:"x"})}function _e(t){return xe(t,["topLeft","topRight","bottomLeft","bottomRight"])}function we(t){const e=ve(t);return e.width=e.left+e.right,e.height=e.top+e.bottom,e}function ke(t,e){t=t||{},e=e||te.font;let i=h(t.size,e.size);"string"==typeof i&&(i=parseInt(i,10));let n=h(t.style,e.style);n&&!(""+n).match(me)&&(n="");const r={family:h(t.family,e.family),lineHeight:be(h(t.lineHeight,e.lineHeight),i),size:i,style:n,weight:h(t.weight,e.weight),string:""};return r.string=function(t){return!t||o(t.size)||o(t.family)?null:(t.style?t.style+" ":"")+(t.weight?t.weight+" ":"")+t.size+"px "+t.family}(r),r}function Se(t,e,i,n){let r,o,s,l=!0;for(r=0,o=t.length;r<o;++r)if(s=t[r],void 0!==s&&(void 0!==e&&"function"==typeof s&&(s=s(e),l=!1),void 0!==i&&a(s)&&(s=s[i%s.length],l=!1),void 0!==s))return n&&!l&&(n.cacheable=!1),s}function Me(t,e){return Object.assign(Object.create(t),e)}function De(t,e=[""],i=t,n,r=()=>t[0]){S(n)||(n=ze("_fallback",t));const o={[Symbol.toStringTag]:"Object",_cacheable:!0,_scopes:t,_rootScopes:i,_fallback:n,_getTarget:r,override:r=>De([r,...t],e,i,n)};return new Proxy(o,{deleteProperty:(e,i)=>(delete e[i],delete e._keys,delete t[0][i],!0),get:(i,n)=>Oe(i,n,()=>function(t,e,i,n){let r;for(const o of e)if(r=ze(Ce(o,t),i),S(r))return Ee(t,r)?Fe(i,n,t,r):r}(n,e,t,i)),getOwnPropertyDescriptor:(t,e)=>Reflect.getOwnPropertyDescriptor(t._scopes[0],e),getPrototypeOf:()=>Reflect.getPrototypeOf(t[0]),has:(t,e)=>je(t).includes(e),ownKeys:t=>je(t),set(t,e,i){const n=t._storage||(t._storage=r());return t[e]=n[e]=i,delete t._keys,!0}})}function Pe(t,e,i,n){const r={_cacheable:!1,_proxy:t,_context:e,_subProxy:i,_stack:new Set,_descriptors:Te(t,n),setContext:e=>Pe(t,e,i,n),override:r=>Pe(t.override(r),e,i,n)};return new Proxy(r,{deleteProperty:(e,i)=>(delete e[i],delete t[i],!0),get:(t,e,i)=>Oe(t,e,()=>function(t,e,i){const{_proxy:n,_context:r,_subProxy:o,_descriptors:l}=t;let c=n[e];M(c)&&l.isScriptable(e)&&(c=function(t,e,i,n){const{_proxy:r,_context:o,_subProxy:a,_stack:s}=i;if(s.has(t))throw new Error("Recursion detected: "+Array.from(s).join("->")+"->"+t);s.add(t),e=e(o,a||n),s.delete(t),Ee(t,e)&&(e=Fe(r._scopes,r,t,e));return e}(e,c,t,i));a(c)&&c.length&&(c=function(t,e,i,n){const{_proxy:r,_context:o,_subProxy:a,_descriptors:l}=i;if(S(o.index)&&n(t))e=e[o.index%e.length];else if(s(e[0])){const i=e,n=r._scopes.filter(t=>t!==i);e=[];for(const s of i){const i=Fe(n,r,t,s);e.push(Pe(i,o,a&&a[t],l))}}return e}(e,c,t,l.isIndexable));Ee(e,c)&&(c=Pe(c,r,o&&o[e],l));return c}(t,e,i)),getOwnPropertyDescriptor:(e,i)=>e._descriptors.allKeys?Reflect.has(t,i)?{enumerable:!0,configurable:!0}:void 0:Reflect.getOwnPropertyDescriptor(t,i),getPrototypeOf:()=>Reflect.getPrototypeOf(t),has:(e,i)=>Reflect.has(t,i),ownKeys:()=>Reflect.ownKeys(t),set:(e,i,n)=>(t[i]=n,delete e[i],!0)})}function Te(t,e={scriptable:!0,indexable:!0}){const{_scriptable:i=e.scriptable,_indexable:n=e.indexable,_allKeys:r=e.allKeys}=t;return{allKeys:r,scriptable:i,indexable:n,isScriptable:M(i)?i:()=>i,isIndexable:M(n)?n:()=>n}}const Ce=(t,e)=>t?t+k(e):e,Ee=(t,e)=>s(e)&&"adapters"!==t&&(null===Object.getPrototypeOf(e)||e.constructor===Object);function Oe(t,e,i){if(Object.prototype.hasOwnProperty.call(t,e))return t[e];const n=i();return t[e]=n,n}function Ae(t,e,i){return M(t)?t(e,i):t}const Le=(t,e)=>!0===t?e:"string"==typeof t?w(e,t):void 0;function Ie(t,e,i,n,r){for(const o of e){const e=Le(i,o);if(e){t.add(e);const o=Ae(e._fallback,i,r);if(S(o)&&o!==i&&o!==n)return o}else if(!1===e&&S(n)&&i!==n)return null}return!1}function Fe(t,e,i,n){const r=e._rootScopes,o=Ae(e._fallback,i,n),l=[...t,...r],c=new Set;c.add(n);let h=Re(c,l,i,o||i,n);return null!==h&&((!S(o)||o===i||(h=Re(c,l,o,h,n),null!==h))&&De(Array.from(c),[""],r,o,()=>function(t,e,i){const n=t._getTarget();e in n||(n[e]={});const r=n[e];if(a(r)&&s(i))return i;return r}(e,i,n)))}function Re(t,e,i,n,r){for(;i;)i=Ie(t,e,i,n,r);return i}function ze(t,e){for(const i of e){if(!i)continue;const e=i[t];if(S(e))return e}}function je(t){let e=t._keys;return e||(e=t._keys=function(t){const e=new Set;for(const i of t)for(const t of Object.keys(i).filter(t=>!t.startsWith("_")))e.add(t);return Array.from(e)}(t._scopes)),e}function Be(t,e,i,n){const{iScale:r}=t,{key:o="r"}=this._parsing,a=new Array(n);let s,l,c,h;for(s=0,l=n;s<l;++s)c=s+i,h=e[c],a[s]={r:r.parse(w(h,o),c)};return a}const We=Number.EPSILON||1e-14,Ne=(t,e)=>e<t.length&&!t[e].skip&&t[e],Ve=t=>"x"===t?"y":"x";function He(t,e,i,n){const r=t.skip?e:t,o=e,a=i.skip?e:i,s=$(o,r),l=$(a,o);let c=s/(s+l),h=l/(s+l);c=isNaN(c)?0:c,h=isNaN(h)?0:h;const u=n*c,d=n*h;return{previous:{x:o.x-u*(a.x-r.x),y:o.y-u*(a.y-r.y)},next:{x:o.x+d*(a.x-r.x),y:o.y+d*(a.y-r.y)}}}function qe(t,e="x"){const i=Ve(e),n=t.length,r=Array(n).fill(0),o=Array(n);let a,s,l,c=Ne(t,0);for(a=0;a<n;++a)if(s=l,l=c,c=Ne(t,a+1),l){if(c){const t=c[e]-l[e];r[a]=0!==t?(c[i]-l[i])/t:0}o[a]=s?c?R(r[a-1])!==R(r[a])?0:(r[a-1]+r[a])/2:r[a-1]:r[a]}!function(t,e,i){const n=t.length;let r,o,a,s,l,c=Ne(t,0);for(let h=0;h<n-1;++h)l=c,c=Ne(t,h+1),l&&c&&(B(e[h],0,We)?i[h]=i[h+1]=0:(r=i[h]/e[h],o=i[h+1]/e[h],s=Math.pow(r,2)+Math.pow(o,2),s<=9||(a=3/Math.sqrt(s),i[h]=r*a*e[h],i[h+1]=o*a*e[h])))}(t,r,o),function(t,e,i="x"){const n=Ve(i),r=t.length;let o,a,s,l=Ne(t,0);for(let c=0;c<r;++c){if(a=s,s=l,l=Ne(t,c+1),!s)continue;const r=s[i],h=s[n];a&&(o=(r-a[i])/3,s[`cp1${i}`]=r-o,s[`cp1${n}`]=h-o*e[c]),l&&(o=(l[i]-r)/3,s[`cp2${i}`]=r+o,s[`cp2${n}`]=h+o*e[c])}}(t,o,e)}function $e(t,e,i){return Math.max(Math.min(t,i),e)}function Ue(t,e,i,n,r){let o,a,s,l;if(e.spanGaps&&(t=t.filter(t=>!t.skip)),"monotone"===e.cubicInterpolationMode)qe(t,r);else{let i=n?t[t.length-1]:t[0];for(o=0,a=t.length;o<a;++o)s=t[o],l=He(i,s,t[Math.min(o+1,a-(n?0:1))%a],e.tension),s.cp1x=l.previous.x,s.cp1y=l.previous.y,s.cp2x=l.next.x,s.cp2y=l.next.y,i=s}e.capBezierPoints&&function(t,e){let i,n,r,o,a,s=se(t[0],e);for(i=0,n=t.length;i<n;++i)a=o,o=s,s=i<n-1&&se(t[i+1],e),o&&(r=t[i],a&&(r.cp1x=$e(r.cp1x,e.left,e.right),r.cp1y=$e(r.cp1y,e.top,e.bottom)),s&&(r.cp2x=$e(r.cp2x,e.left,e.right),r.cp2y=$e(r.cp2y,e.top,e.bottom)))}(t,i)}function Ye(){return"undefined"!=typeof window&&"undefined"!=typeof document}function Ge(t){let e=t.parentNode;return e&&"[object ShadowRoot]"===e.toString()&&(e=e.host),e}function Xe(t,e,i){let n;return"string"==typeof t?(n=parseInt(t,10),-1!==t.indexOf("%")&&(n=n/100*e.parentNode[i])):n=t,n}const Ze=t=>window.getComputedStyle(t,null);const Qe=["top","right","bottom","left"];function Je(t,e,i){const n={};i=i?"-"+i:"";for(let r=0;r<4;r++){const o=Qe[r];n[o]=parseFloat(t[e+"-"+o+i])||0}return n.width=n.left+n.right,n.height=n.top+n.bottom,n}function Ke(t,e){if("native"in t)return t;const{canvas:i,currentDevicePixelRatio:n}=e,r=Ze(i),o="border-box"===r.boxSizing,a=Je(r,"padding"),s=Je(r,"border","width"),{x:l,y:c,box:h}=function(t,e){const i=t.touches,n=i&&i.length?i[0]:t,{offsetX:r,offsetY:o}=n;let a,s,l=!1;if(((t,e,i)=>(t>0||e>0)&&(!i||!i.shadowRoot))(r,o,t.target))a=r,s=o;else{const t=e.getBoundingClientRect();a=n.clientX-t.left,s=n.clientY-t.top,l=!0}return{x:a,y:s,box:l}}(t,i),u=a.left+(h&&s.left),d=a.top+(h&&s.top);let{width:f,height:p}=e;return o&&(f-=a.width+s.width,p-=a.height+s.height),{x:Math.round((l-u)/f*i.width/n),y:Math.round((c-d)/p*i.height/n)}}const ti=t=>Math.round(10*t)/10;function ei(t,e,i,n){const r=Ze(t),o=Je(r,"margin"),a=Xe(r.maxWidth,t,"clientWidth")||E,s=Xe(r.maxHeight,t,"clientHeight")||E,l=function(t,e,i){let n,r;if(void 0===e||void 0===i){const o=Ge(t);if(o){const t=o.getBoundingClientRect(),a=Ze(o),s=Je(a,"border","width"),l=Je(a,"padding");e=t.width-l.width-s.width,i=t.height-l.height-s.height,n=Xe(a.maxWidth,o,"clientWidth"),r=Xe(a.maxHeight,o,"clientHeight")}else e=t.clientWidth,i=t.clientHeight}return{width:e,height:i,maxWidth:n||E,maxHeight:r||E}}(t,e,i);let{width:c,height:h}=l;if("content-box"===r.boxSizing){const t=Je(r,"border","width"),e=Je(r,"padding");c-=e.width+t.width,h-=e.height+t.height}return c=Math.max(0,c-o.width),h=Math.max(0,n?Math.floor(c/n):h-o.height),c=ti(Math.min(c,a,l.maxWidth)),h=ti(Math.min(h,s,l.maxHeight)),c&&!h&&(h=ti(c/2)),{width:c,height:h}}function ii(t,e,i){const n=e||1,r=Math.floor(t.height*n),o=Math.floor(t.width*n);t.height=r/n,t.width=o/n;const a=t.canvas;return a.style&&(i||!a.style.height&&!a.style.width)&&(a.style.height=`${t.height}px`,a.style.width=`${t.width}px`),(t.currentDevicePixelRatio!==n||a.height!==r||a.width!==o)&&(t.currentDevicePixelRatio=n,a.height=r,a.width=o,t.ctx.setTransform(n,0,0,n,0,0),!0)}const ni=function(){let t=!1;try{const e={get passive(){return t=!0,!1}};window.addEventListener("test",null,e),window.removeEventListener("test",null,e)}catch(t){}return t}();function ri(t,e){const i=function(t,e){return Ze(t).getPropertyValue(e)}(t,e),n=i&&i.match(/^(\d+)(\.\d+)?px$/);return n?+n[1]:void 0}function oi(t,e,i,n){return{x:t.x+i*(e.x-t.x),y:t.y+i*(e.y-t.y)}}function ai(t,e,i,n){return{x:t.x+i*(e.x-t.x),y:"middle"===n?i<.5?t.y:e.y:"after"===n?i<1?t.y:e.y:i>0?e.y:t.y}}function si(t,e,i,n){const r={x:t.cp2x,y:t.cp2y},o={x:e.cp1x,y:e.cp1y},a=oi(t,r,i),s=oi(r,o,i),l=oi(o,e,i),c=oi(a,s,i),h=oi(s,l,i);return oi(c,h,i)}const li=new Map;function ci(t,e,i){return function(t,e){e=e||{};const i=t+JSON.stringify(e);let n=li.get(i);return n||(n=new Intl.NumberFormat(t,e),li.set(i,n)),n}(e,i).format(t)}function hi(t,e,i){return t?function(t,e){return{x:i=>t+t+e-i,setWidth(t){e=t},textAlign:t=>"center"===t?t:"right"===t?"left":"right",xPlus:(t,e)=>t-e,leftForLtr:(t,e)=>t-e}}(e,i):{x:t=>t,setWidth(t){},textAlign:t=>t,xPlus:(t,e)=>t+e,leftForLtr:(t,e)=>t}}function ui(t,e){let i,n;"ltr"!==e&&"rtl"!==e||(i=t.canvas.style,n=[i.getPropertyValue("direction"),i.getPropertyPriority("direction")],i.setProperty("direction",e,"important"),t.prevTextDirection=n)}function di(t,e){void 0!==e&&(delete t.prevTextDirection,t.canvas.style.setProperty("direction",e[0],e[1]))}function fi(t){return"angle"===t?{between:G,compare:U,normalize:Y}:{between:Z,compare:(t,e)=>t-e,normalize:t=>t}}function pi({start:t,end:e,count:i,loop:n,style:r}){return{start:t%i,end:e%i,loop:n&&(e-t+1)%i==0,style:r}}function gi(t,e,i){if(!i)return[t];const{property:n,start:r,end:o}=i,a=e.length,{compare:s,between:l,normalize:c}=fi(n),{start:h,end:u,loop:d,style:f}=function(t,e,i){const{property:n,start:r,end:o}=i,{between:a,normalize:s}=fi(n),l=e.length;let c,h,{start:u,end:d,loop:f}=t;if(f){for(u+=l,d+=l,c=0,h=l;c<h&&a(s(e[u%l][n]),r,o);++c)u--,d--;u%=l,d%=l}return d<u&&(d+=l),{start:u,end:d,loop:f,style:t.style}}(t,e,i),p=[];let g,m,b,y=!1,x=null;const v=()=>y||l(r,b,g)&&0!==s(r,b),_=()=>!y||0===s(o,g)||l(o,b,g);for(let t=h,i=h;t<=u;++t)m=e[t%a],m.skip||(g=c(m[n]),g!==b&&(y=l(g,r,o),null===x&&v()&&(x=0===s(g,r)?t:i),null!==x&&_()&&(p.push(pi({start:x,end:t,loop:d,count:a,style:f})),x=null),i=t,b=g));return null!==x&&p.push(pi({start:x,end:u,loop:d,count:a,style:f})),p}function mi(t,e){const i=[],n=t.segments;for(let r=0;r<n.length;r++){const o=gi(n[r],t.points,e);o.length&&i.push(...o)}return i}function bi(t,e,i,n){return n&&n.setContext&&i?function(t,e,i,n){const r=t._chart.getContext(),o=yi(t.options),{_datasetIndex:a,options:{spanGaps:s}}=t,l=i.length,c=[];let h=o,u=e[0].start,d=u;function f(t,e,n,r){const o=s?-1:1;if(t!==e){for(t+=l;i[t%l].skip;)t-=o;for(;i[e%l].skip;)e+=o;t%l!==e%l&&(c.push({start:t%l,end:e%l,loop:n,style:r}),h=r,u=e%l)}}for(const t of e){u=s?u:t.start;let e,o=i[u%l];for(d=u+1;d<=t.end;d++){const s=i[d%l];e=yi(n.setContext(Me(r,{type:"segment",p0:o,p1:s,p0DataIndex:(d-1)%l,p1DataIndex:d%l,datasetIndex:a}))),xi(e,h)&&f(u,d-1,t.loop,h),o=s,h=e}u<d-1&&f(u,d-1,t.loop,h)}return c}(t,e,i,n):e}function yi(t){return{backgroundColor:t.backgroundColor,borderCapStyle:t.borderCapStyle,borderDash:t.borderDash,borderDashOffset:t.borderDashOffset,borderJoinStyle:t.borderJoinStyle,borderWidth:t.borderWidth,borderColor:t.borderColor}}function xi(t,e){return e&&JSON.stringify(t)!==JSON.stringify(e)}var vi=new class{constructor(){this._request=null,this._charts=new Map,this._running=!1,this._lastDate=void 0}_notify(t,e,i,n){const r=e.listeners[n],o=e.duration;r.forEach(n=>n({chart:t,initial:e.initial,numSteps:o,currentStep:Math.min(i-e.start,o)}))}_refresh(){this._request||(this._running=!0,this._request=nt.call(window,()=>{this._update(),this._request=null,this._running&&this._refresh()}))}_update(t=Date.now()){let e=0;this._charts.forEach((i,n)=>{if(!i.running||!i.items.length)return;const r=i.items;let o,a=r.length-1,s=!1;for(;a>=0;--a)o=r[a],o._active?(o._total>i.duration&&(i.duration=o._total),o.tick(t),s=!0):(r[a]=r[r.length-1],r.pop());s&&(n.draw(),this._notify(n,i,t,"progress")),r.length||(i.running=!1,this._notify(n,i,t,"complete"),i.initial=!1),e+=r.length}),this._lastDate=t,0===e&&(this._running=!1)}_getAnims(t){const e=this._charts;let i=e.get(t);return i||(i={running:!1,initial:!0,items:[],listeners:{complete:[],progress:[]}},e.set(t,i)),i}listen(t,e,i){this._getAnims(t).listeners[e].push(i)}add(t,e){e&&e.length&&this._getAnims(t).items.push(...e)}has(t){return this._getAnims(t).items.length>0}start(t){const e=this._charts.get(t);e&&(e.running=!0,e.start=Date.now(),e.duration=e.items.reduce((t,e)=>Math.max(t,e._duration),0),this._refresh())}running(t){if(!this._running)return!1;const e=this._charts.get(t);return!!(e&&e.running&&e.items.length)}stop(t){const e=this._charts.get(t);if(!e||!e.items.length)return;const i=e.items;let n=i.length-1;for(;n>=0;--n)i[n].cancel();e.items=[],this._notify(t,e,Date.now(),"complete")}remove(t){return this._charts.delete(t)}};const _i="transparent",wi={boolean:(t,e,i)=>i>.5?e:t,color(t,e,i){const n=Gt(t||_i),r=n.valid&&Gt(e||_i);return r&&r.valid?r.mix(n,i).hexString():e},number:(t,e,i)=>t+(e-t)*i};class ki{constructor(t,e,i,n){const r=e[i];n=Se([t.to,n,r,t.from]);const o=Se([t.from,r,n]);this._active=!0,this._fn=t.fn||wi[t.type||typeof o],this._easing=dt[t.easing]||dt.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=o,this._to=n,this._promises=void 0}active(){return this._active}update(t,e,i){if(this._active){this._notify(!1);const n=this._target[this._prop],r=i-this._start,o=this._duration-r;this._start=i,this._duration=Math.floor(Math.max(o,t.duration)),this._total+=r,this._loop=!!t.loop,this._to=Se([t.to,e,n,t.from]),this._from=Se([t.from,n,e])}}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(t){const e=t-this._start,i=this._duration,n=this._prop,r=this._from,o=this._loop,a=this._to;let s;if(this._active=r!==a&&(o||e<i),!this._active)return this._target[n]=a,void this._notify(!0);e<0?this._target[n]=r:(s=e/i%2,s=o&&s>1?2-s:s,s=this._easing(Math.min(1,Math.max(0,s))),this._target[n]=this._fn(r,a,s))}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 t=0;t<i.length;t++)i[t][e]()}}te.set("animation",{delay:void 0,duration:1e3,easing:"easeOutQuart",fn:void 0,from:void 0,loop:void 0,to:void 0,type:void 0});const Si=Object.keys(te.animation);te.describe("animation",{_fallback:!1,_indexable:!1,_scriptable:t=>"onProgress"!==t&&"onComplete"!==t&&"fn"!==t}),te.set("animations",{colors:{type:"color",properties:["color","borderColor","backgroundColor"]},numbers:{type:"number",properties:["x","y","borderWidth","radius","tension"]}}),te.describe("animations",{_fallback:"animation"}),te.set("transitions",{active:{animation:{duration:400}},resize:{animation:{duration:0}},show:{animations:{colors:{from:"transparent"},visible:{type:"boolean",duration:0}}},hide:{animations:{colors:{to:"transparent"},visible:{type:"boolean",easing:"linear",fn:t=>0|t}}}});class Mi{constructor(t,e){this._chart=t,this._properties=new Map,this.configure(e)}configure(t){if(!s(t))return;const e=this._properties;Object.getOwnPropertyNames(t).forEach(i=>{const n=t[i];if(!s(n))return;const r={};for(const t of Si)r[t]=n[t];(a(n.properties)&&n.properties||[i]).forEach(t=>{t!==i&&e.has(t)||e.set(t,r)})})}_animateOptions(t,e){const i=e.options,n=function(t,e){if(!e)return;let i=t.options;if(!i)return void(t.options=e);i.$shared&&(t.options=i=Object.assign({},i,{$shared:!1,$animations:{}}));return i}(t,i);if(!n)return[];const r=this._createAnimations(n,i);return i.$shared&&function(t,e){const i=[],n=Object.keys(e);for(let e=0;e<n.length;e++){const r=t[n[e]];r&&r.active()&&i.push(r.wait())}return Promise.all(i)}(t.options.$animations,i).then(()=>{t.options=i},()=>{}),r}_createAnimations(t,e){const i=this._properties,n=[],r=t.$animations||(t.$animations={}),o=Object.keys(e),a=Date.now();let s;for(s=o.length-1;s>=0;--s){const l=o[s];if("$"===l.charAt(0))continue;if("options"===l){n.push(...this._animateOptions(t,e));continue}const c=e[l];let h=r[l];const u=i.get(l);if(h){if(u&&h.active()){h.update(u,c,a);continue}h.cancel()}u&&u.duration?(r[l]=h=new ki(u,t,l,c),n.push(h)):t[l]=c}return n}update(t,e){if(0===this._properties.size)return void Object.assign(t,e);const i=this._createAnimations(t,e);return i.length?(vi.add(this._chart,i),!0):void 0}}function Di(t,e){const i=t&&t.options||{},n=i.reverse,r=void 0===i.min?e:0,o=void 0===i.max?e:0;return{start:n?o:r,end:n?r:o}}function Pi(t,e){const i=[],n=t._getSortedDatasetMetas(e);let r,o;for(r=0,o=n.length;r<o;++r)i.push(n[r].index);return i}function Ti(t,e,i,n={}){const r=t.keys,o="single"===n.mode;let a,s,c,h;if(null!==e){for(a=0,s=r.length;a<s;++a){if(c=+r[a],c===i){if(n.all)continue;break}h=t.values[c],l(h)&&(o||0===e||R(e)===R(h))&&(e+=h)}return e}}function Ci(t,e){const i=t&&t.options.stacked;return i||void 0===i&&void 0!==e.stack}function Ei(t,e,i){const n=t[e]||(t[e]={});return n[i]||(n[i]={})}function Oi(t,e,i,n){for(const r of e.getMatchingVisibleMetas(n).reverse()){const e=t[r.index];if(i&&e>0||!i&&e<0)return r.index}return null}function Ai(t,e){const{chart:i,_cachedMeta:n}=t,r=i._stacks||(i._stacks={}),{iScale:o,vScale:a,index:s}=n,l=o.axis,c=a.axis,h=function(t,e,i){return`${t.id}.${e.id}.${i.stack||i.type}`}(o,a,n),u=e.length;let d;for(let t=0;t<u;++t){const i=e[t],{[l]:o,[c]:u}=i;d=(i._stacks||(i._stacks={}))[c]=Ei(r,h,o),d[s]=u,d._top=Oi(d,a,!0,n.type),d._bottom=Oi(d,a,!1,n.type)}}function Li(t,e){const i=t.scales;return Object.keys(i).filter(t=>i[t].axis===e).shift()}function Ii(t,e){const i=t.controller.index,n=t.vScale&&t.vScale.axis;if(n){e=e||t._parsed;for(const t of e){const e=t._stacks;if(!e||void 0===e[n]||void 0===e[n][i])return;delete e[n][i]}}}const Fi=t=>"reset"===t||"none"===t,Ri=(t,e)=>e?t:Object.assign({},t);class zi{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.initialize()}initialize(){const t=this._cachedMeta;this.configure(),this.linkScales(),t._stacked=Ci(t.vScale,t),this.addElements()}updateIndex(t){this.index!==t&&Ii(this._cachedMeta),this.index=t}linkScales(){const t=this.chart,e=this._cachedMeta,i=this.getDataset(),n=(t,e,i,n)=>"x"===t?e:"r"===t?n:i,r=e.xAxisID=h(i.xAxisID,Li(t,"x")),o=e.yAxisID=h(i.yAxisID,Li(t,"y")),a=e.rAxisID=h(i.rAxisID,Li(t,"r")),s=e.indexAxis,l=e.iAxisID=n(s,r,o,a),c=e.vAxisID=n(s,o,r,a);e.xScale=this.getScaleForId(r),e.yScale=this.getScaleForId(o),e.rScale=this.getScaleForId(a),e.iScale=this.getScaleForId(l),e.vScale=this.getScaleForId(c)}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&&et(this._data,this),t._stacked&&Ii(t)}_dataCheck(){const t=this.getDataset(),e=t.data||(t.data=[]),i=this._data;if(s(e))this._data=function(t){const e=Object.keys(t),i=new Array(e.length);let n,r,o;for(n=0,r=e.length;n<r;++n)o=e[n],i[n]={x:o,y:t[o]};return i}(e);else if(i!==e){if(i){et(i,this);const t=this._cachedMeta;Ii(t),t._parsed=[]}e&&Object.isExtensible(e)&&(r=this,(n=e)._chartjs?n._chartjs.listeners.push(r):(Object.defineProperty(n,"_chartjs",{configurable:!0,enumerable:!1,value:{listeners:[r]}}),tt.forEach(t=>{const e="_onData"+k(t),i=n[t];Object.defineProperty(n,t,{configurable:!0,enumerable:!1,value(...t){const r=i.apply(this,t);return n._chartjs.listeners.forEach(i=>{"function"==typeof i[e]&&i[e](...t)}),r}})}))),this._syncList=[],this._data=e}var n,r}addElements(){const t=this._cachedMeta;this._dataCheck(),this.datasetElementType&&(t.dataset=new this.datasetElementType)}buildOrUpdateElements(t){const e=this._cachedMeta,i=this.getDataset();let n=!1;this._dataCheck();const r=e._stacked;e._stacked=Ci(e.vScale,e),e.stack!==i.stack&&(n=!0,Ii(e),e.stack=i.stack),this._resyncElements(t),(n||r!==e._stacked)&&Ai(this,e._parsed)}configure(){const t=this.chart.config,e=t.datasetScopeKeys(this._type),i=t.getOptionScopes(this.getDataset(),e,!0);this.options=t.createResolver(i,this.getContext()),this._parsing=this.options.parsing,this._cachedDataOpts={}}parse(t,e){const{_cachedMeta:i,_data:n}=this,{iScale:r,_stacked:o}=i,l=r.axis;let c,h,u,d=0===t&&e===n.length||i._sorted,f=t>0&&i._parsed[t-1];if(!1===this._parsing)i._parsed=n,i._sorted=!0,u=n;else{u=a(n[t])?this.parseArrayData(i,n,t,e):s(n[t])?this.parseObjectData(i,n,t,e):this.parsePrimitiveData(i,n,t,e);const r=()=>null===h[l]||f&&h[l]<f[l];for(c=0;c<e;++c)i._parsed[c+t]=h=u[c],d&&(r()&&(d=!1),f=h);i._sorted=d}o&&Ai(this,u)}parsePrimitiveData(t,e,i,n){const{iScale:r,vScale:o}=t,a=r.axis,s=o.axis,l=r.getLabels(),c=r===o,h=new Array(n);let u,d,f;for(u=0,d=n;u<d;++u)f=u+i,h[u]={[a]:c||r.parse(l[f],f),[s]:o.parse(e[f],f)};return h}parseArrayData(t,e,i,n){const{xScale:r,yScale:o}=t,a=new Array(n);let s,l,c,h;for(s=0,l=n;s<l;++s)c=s+i,h=e[c],a[s]={x:r.parse(h[0],c),y:o.parse(h[1],c)};return a}parseObjectData(t,e,i,n){const{xScale:r,yScale:o}=t,{xAxisKey:a="x",yAxisKey:s="y"}=this._parsing,l=new Array(n);let c,h,u,d;for(c=0,h=n;c<h;++c)u=c+i,d=e[u],l[c]={x:r.parse(w(d,a),u),y:o.parse(w(d,s),u)};return l}getParsed(t){return this._cachedMeta._parsed[t]}getDataElement(t){return this._cachedMeta.data[t]}applyStack(t,e,i){const n=this.chart,r=this._cachedMeta,o=e[t.axis];return Ti({keys:Pi(n,!0),values:e._stacks[t.axis]},o,r.index,{mode:i})}updateRangeFromParsed(t,e,i,n){const r=i[e.axis];let o=null===r?NaN:r;const a=n&&i._stacks[e.axis];n&&a&&(n.values=a,o=Ti(n,r,this._cachedMeta.index)),t.min=Math.min(t.min,o),t.max=Math.max(t.max,o)}getMinMax(t,e){const i=this._cachedMeta,n=i._parsed,r=i._sorted&&t===i.iScale,o=n.length,a=this._getOtherScale(t),s=((t,e,i)=>t&&!e.hidden&&e._stacked&&{keys:Pi(i,!0),values:null})(e,i,this.chart),c={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY},{min:h,max:u}=function(t){const{min:e,max:i,minDefined:n,maxDefined:r}=t.getUserBounds();return{min:n?e:Number.NEGATIVE_INFINITY,max:r?i:Number.POSITIVE_INFINITY}}(a);let d,f;function p(){f=n[d];const e=f[a.axis];return!l(f[t.axis])||h>e||u<e}for(d=0;d<o&&(p()||(this.updateRangeFromParsed(c,t,f,s),!r));++d);if(r)for(d=o-1;d>=0;--d)if(!p()){this.updateRangeFromParsed(c,t,f,s);break}return c}getAllParsedValues(t){const e=this._cachedMeta._parsed,i=[];let n,r,o;for(n=0,r=e.length;n<r;++n)o=e[n][t.axis],l(o)&&i.push(o);return i}getMaxOverflow(){return!1}getLabelAndValue(t){const e=this._cachedMeta,i=e.iScale,n=e.vScale,r=this.getParsed(t);return{label:i?""+i.getLabelForValue(r[i.axis]):"",value:n?""+n.getLabelForValue(r[n.axis]):""}}_update(t){const e=this._cachedMeta;this.update(t||"default"),e._clip=function(t){let e,i,n,r;return s(t)?(e=t.top,i=t.right,n=t.bottom,r=t.left):e=i=n=r=t,{top:e,right:i,bottom:n,left:r,disabled:!1===t}}(h(this.options.clip,function(t,e,i){if(!1===i)return!1;const n=Di(t,i),r=Di(e,i);return{top:r.end,right:n.end,bottom:r.start,left:n.start}}(e.xScale,e.yScale,this.getMaxOverflow())))}update(t){}draw(){const t=this._ctx,e=this.chart,i=this._cachedMeta,n=i.data||[],r=e.chartArea,o=[],a=this._drawStart||0,s=this._drawCount||n.length-a,l=this.options.drawActiveElementsOnTop;let c;for(i.dataset&&i.dataset.draw(t,r,a,s),c=a;c<a+s;++c){const e=n[c];e.hidden||(e.active&&l?o.push(e):e.draw(t,r))}for(c=0;c<o.length;++c)o[c].draw(t,r)}getStyle(t,e){const i=e?"active":"default";return void 0===t&&this._cachedMeta.dataset?this.resolveDatasetElementOptions(i):this.resolveDataElementOptions(t||0,i)}getContext(t,e,i){const n=this.getDataset();let r;if(t>=0&&t<this._cachedMeta.data.length){const e=this._cachedMeta.data[t];r=e.$context||(e.$context=function(t,e,i){return Me(t,{active:!1,dataIndex:e,parsed:void 0,raw:void 0,element:i,index:e,mode:"default",type:"data"})}(this.getContext(),t,e)),r.parsed=this.getParsed(t),r.raw=n.data[t],r.index=r.dataIndex=t}else r=this.$context||(this.$context=function(t,e){return Me(t,{active:!1,dataset:void 0,datasetIndex:e,index:e,mode:"default",type:"dataset"})}(this.chart.getContext(),this.index)),r.dataset=n,r.index=r.datasetIndex=this.index;return r.active=!!e,r.mode=i,r}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 n="active"===e,r=this._cachedDataOpts,o=t+"-"+e,a=r[o],s=this.enableOptionSharing&&S(i);if(a)return Ri(a,s);const l=this.chart.config,c=l.datasetElementScopeKeys(this._type,t),h=n?[`${t}Hover`,"hover",t,""]:[t,""],u=l.getOptionScopes(this.getDataset(),c),d=Object.keys(te.elements[t]),f=l.resolveNamedOptions(u,d,()=>this.getContext(i,n),h);return f.$shared&&(f.$shared=s,r[o]=Object.freeze(Ri(f,s))),f}_resolveAnimations(t,e,i){const n=this.chart,r=this._cachedDataOpts,o=`animation-${e}`,a=r[o];if(a)return a;let s;if(!1!==n.options.animation){const n=this.chart.config,r=n.datasetAnimationScopeKeys(this._type,e),o=n.getOptionScopes(this.getDataset(),r);s=n.createResolver(o,this.getContext(t,i,e))}const l=new Mi(n,s&&s.animations);return s&&s._cacheable&&(r[o]=Object.freeze(l)),l}getSharedOptions(t){if(t.$shared)return this._sharedOptions||(this._sharedOptions=Object.assign({},t))}includeOptions(t,e){return!e||Fi(t)||this.chart._animationsDisabled}_getSharedOptions(t,e){const i=this.resolveDataElementOptions(t,e),n=this._sharedOptions,r=this.getSharedOptions(i),o=this.includeOptions(e,r)||r!==n;return this.updateSharedOptions(r,e,i),{sharedOptions:r,includeOptions:o}}updateElement(t,e,i,n){Fi(n)?Object.assign(t,i):this._resolveAnimations(e,n).update(t,i)}updateSharedOptions(t,e,i){t&&!Fi(e)&&this._resolveAnimations(void 0,e).update(t,i)}_setStyle(t,e,i,n){t.active=n;const r=this.getStyle(e,n);this._resolveAnimations(e,i,n).update(t,{options:!n&&this.getSharedOptions(r)||r})}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[t,e,i]of this._syncList)this[t](e,i);this._syncList=[];const n=i.length,r=e.length,o=Math.min(r,n);o&&this.parse(0,o),r>n?this._insertElements(n,r-n,t):r<n&&this._removeElements(r,n-r)}_insertElements(t,e,i=!0){const n=this._cachedMeta,r=n.data,o=t+e;let a;const s=t=>{for(t.length+=e,a=t.length-1;a>=o;a--)t[a]=t[a-e]};for(s(r),a=t;a<o;++a)r[a]=new this.dataElementType;this._parsing&&s(n._parsed),this.parse(t,e),i&&this.updateElements(r,t,e,"reset")}updateElements(t,e,i,n){}_removeElements(t,e){const i=this._cachedMeta;if(this._parsing){const n=i._parsed.splice(t,e);i._stacked&&Ii(i,n)}i.data.splice(t,e)}_sync(t){if(this._parsing)this._syncList.push(t);else{const[e,i,n]=t;this[e](i,n)}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 ji(t){const e=t.iScale,i=function(t,e){if(!t._cache.$bar){const i=t.getMatchingVisibleMetas(e);let n=[];for(let e=0,r=i.length;e<r;e++)n=n.concat(i[e].controller.getAllParsedValues(t));t._cache.$bar=it(n.sort((t,e)=>t-e))}return t._cache.$bar}(e,t.type);let n,r,o,a,s=e._length;const l=()=>{32767!==o&&-32768!==o&&(S(a)&&(s=Math.min(s,Math.abs(o-a)||s)),a=o)};for(n=0,r=i.length;n<r;++n)o=e.getPixelForValue(i[n]),l();for(a=void 0,n=0,r=e.ticks.length;n<r;++n)o=e.getPixelForTick(n),l();return s}function Bi(t,e,i,n){return a(t)?function(t,e,i,n){const r=i.parse(t[0],n),o=i.parse(t[1],n),a=Math.min(r,o),s=Math.max(r,o);let l=a,c=s;Math.abs(a)>Math.abs(s)&&(l=s,c=a),e[i.axis]=c,e._custom={barStart:l,barEnd:c,start:r,end:o,min:a,max:s}}(t,e,i,n):e[i.axis]=i.parse(t,n),e}function Wi(t,e,i,n){const r=t.iScale,o=t.vScale,a=r.getLabels(),s=r===o,l=[];let c,h,u,d;for(c=i,h=i+n;c<h;++c)d=e[c],u={},u[r.axis]=s||r.parse(a[c],c),l.push(Bi(d,u,o,c));return l}function Ni(t){return t&&void 0!==t.barStart&&void 0!==t.barEnd}function Vi(t,e,i,n){let r=e.borderSkipped;const o={};if(!r)return void(t.borderSkipped=o);if(!0===r)return void(t.borderSkipped={top:!0,right:!0,bottom:!0,left:!0});const{start:a,end:s,reverse:l,top:c,bottom:h}=function(t){let e,i,n,r,o;return t.horizontal?(e=t.base>t.x,i="left",n="right"):(e=t.base<t.y,i="bottom",n="top"),e?(r="end",o="start"):(r="start",o="end"),{start:i,end:n,reverse:e,top:r,bottom:o}}(t);"middle"===r&&i&&(t.enableBorderRadius=!0,(i._top||0)===n?r=c:(i._bottom||0)===n?r=h:(o[Hi(h,a,s,l)]=!0,r=c)),o[Hi(r,a,s,l)]=!0,t.borderSkipped=o}function Hi(t,e,i,n){var r,o,a;return n?(a=i,t=qi(t=(r=t)===(o=e)?a:r===a?o:r,i,e)):t=qi(t,e,i),t}function qi(t,e,i){return"start"===t?e:"end"===t?i:t}function $i(t,{inflateAmount:e},i){t.inflateAmount="auto"===e?1===i?.33:0:e}zi.defaults={},zi.prototype.datasetElementType=null,zi.prototype.dataElementType=null;class Ui extends zi{parsePrimitiveData(t,e,i,n){return Wi(t,e,i,n)}parseArrayData(t,e,i,n){return Wi(t,e,i,n)}parseObjectData(t,e,i,n){const{iScale:r,vScale:o}=t,{xAxisKey:a="x",yAxisKey:s="y"}=this._parsing,l="x"===r.axis?a:s,c="x"===o.axis?a:s,h=[];let u,d,f,p;for(u=i,d=i+n;u<d;++u)p=e[u],f={},f[r.axis]=r.parse(w(p,l),u),h.push(Bi(w(p,c),f,o,u));return h}updateRangeFromParsed(t,e,i,n){super.updateRangeFromParsed(t,e,i,n);const r=i._custom;r&&e===this._cachedMeta.vScale&&(t.min=Math.min(t.min,r.min),t.max=Math.max(t.max,r.max))}getMaxOverflow(){return 0}getLabelAndValue(t){const e=this._cachedMeta,{iScale:i,vScale:n}=e,r=this.getParsed(t),o=r._custom,a=Ni(o)?"["+o.start+", "+o.end+"]":""+n.getLabelForValue(r[n.axis]);return{label:""+i.getLabelForValue(r[i.axis]),value:a}}initialize(){this.enableOptionSharing=!0,super.initialize();this._cachedMeta.stack=this.getDataset().stack}update(t){const e=this._cachedMeta;this.updateElements(e.data,0,e.data.length,t)}updateElements(t,e,i,n){const r="reset"===n,{index:a,_cachedMeta:{vScale:s}}=this,l=s.getBasePixel(),c=s.isHorizontal(),h=this._getRuler(),{sharedOptions:u,includeOptions:d}=this._getSharedOptions(e,n);for(let f=e;f<e+i;f++){const e=this.getParsed(f),i=r||o(e[s.axis])?{base:l,head:l}:this._calculateBarValuePixels(f),p=this._calculateBarIndexPixels(f,h),g=(e._stacks||{})[s.axis],m={horizontal:c,base:i.base,enableBorderRadius:!g||Ni(e._custom)||a===g._top||a===g._bottom,x:c?i.head:p.center,y:c?p.center:i.head,height:c?p.size:Math.abs(i.size),width:c?Math.abs(i.size):p.size};d&&(m.options=u||this.resolveDataElementOptions(f,t[f].active?"active":n));const b=m.options||t[f].options;Vi(m,b,g,a),$i(m,b,h.ratio),this.updateElement(t[f],f,m,n)}}_getStacks(t,e){const{iScale:i}=this._cachedMeta,n=i.getMatchingVisibleMetas(this._type).filter(t=>t.controller.options.grouped),r=i.options.stacked,a=[],s=t=>{const i=t.controller.getParsed(e),n=i&&i[t.vScale.axis];if(o(n)||isNaN(n))return!0};for(const i of n)if((void 0===e||!s(i))&&((!1===r||-1===a.indexOf(i.stack)||void 0===r&&void 0===i.stack)&&a.push(i.stack),i.index===t))break;return a.length||a.push(void 0),a}_getStackCount(t){return this._getStacks(void 0,t).length}_getStackIndex(t,e,i){const n=this._getStacks(t,i),r=void 0!==e?n.indexOf(e):-1;return-1===r?n.length-1:r}_getRuler(){const t=this.options,e=this._cachedMeta,i=e.iScale,n=[];let r,o;for(r=0,o=e.data.length;r<o;++r)n.push(i.getPixelForValue(this.getParsed(r)[i.axis],r));const a=t.barThickness;return{min:a||ji(e),pixels:n,start:i._startPixel,end:i._endPixel,stackCount:this._getStackCount(),scale:i,grouped:t.grouped,ratio:a?1:t.categoryPercentage*t.barPercentage}}_calculateBarValuePixels(t){const{_cachedMeta:{vScale:e,_stacked:i},options:{base:n,minBarLength:r}}=this,a=n||0,s=this.getParsed(t),l=s._custom,c=Ni(l);let h,u,d=s[e.axis],f=0,p=i?this.applyStack(e,s,i):d;p!==d&&(f=p-d,p=d),c&&(d=l.barStart,p=l.barEnd-l.barStart,0!==d&&R(d)!==R(l.barEnd)&&(f=0),f+=d);const g=o(n)||c?f:n;let m=e.getPixelForValue(g);if(h=this.chart.getDataVisibility(t)?e.getPixelForValue(f+p):m,u=h-m,Math.abs(u)<r){u=function(t,e,i){return 0!==t?R(t):(e.isHorizontal()?1:-1)*(e.min>=i?1:-1)}(u,e,a)*r,d===a&&(m-=u/2);const t=e.getPixelForDecimal(0),i=e.getPixelForDecimal(1),n=Math.min(t,i),o=Math.max(t,i);m=Math.max(Math.min(m,o),n),h=m+u}if(m===e.getPixelForValue(a)){const t=R(u)*e.getLineWidthForValue(a)/2;m+=t,u-=t}return{size:u,base:m,head:h,center:h+u/2}}_calculateBarIndexPixels(t,e){const i=e.scale,n=this.options,r=n.skipNull,a=h(n.maxBarThickness,1/0);let s,l;if(e.grouped){const i=r?this._getStackCount(t):e.stackCount,c="flex"===n.barThickness?function(t,e,i,n){const r=e.pixels,o=r[t];let a=t>0?r[t-1]:null,s=t<r.length-1?r[t+1]:null;const l=i.categoryPercentage;null===a&&(a=o-(null===s?e.end-e.start:s-o)),null===s&&(s=o+o-a);const c=o-(o-Math.min(a,s))/2*l;return{chunk:Math.abs(s-a)/2*l/n,ratio:i.barPercentage,start:c}}(t,e,n,i):function(t,e,i,n){const r=i.barThickness;let a,s;return o(r)?(a=e.min*i.categoryPercentage,s=i.barPercentage):(a=r*n,s=1),{chunk:a/n,ratio:s,start:e.pixels[t]-a/2}}(t,e,n,i),h=this._getStackIndex(this.index,this._cachedMeta.stack,r?t:void 0);s=c.start+c.chunk*h+c.chunk/2,l=Math.min(a,c.chunk*c.ratio)}else s=i.getPixelForValue(this.getParsed(t)[i.axis],t),l=Math.min(a,e.min*e.ratio);return{base:s-l/2,head:s+l/2,center:s,size:l}}draw(){const t=this._cachedMeta,e=t.vScale,i=t.data,n=i.length;let r=0;for(;r<n;++r)null!==this.getParsed(r)[e.axis]&&i[r].draw(this._ctx)}}Ui.id="bar",Ui.defaults={datasetElementType:!1,dataElementType:"bar",categoryPercentage:.8,barPercentage:.9,grouped:!0,animations:{numbers:{type:"number",properties:["x","y","base","width","height"]}}},Ui.overrides={scales:{_index_:{type:"category",offset:!0,grid:{offset:!0}},_value_:{type:"linear",beginAtZero:!0}}};class Yi extends zi{initialize(){this.enableOptionSharing=!0,super.initialize()}parsePrimitiveData(t,e,i,n){const r=super.parsePrimitiveData(t,e,i,n);for(let t=0;t<r.length;t++)r[t]._custom=this.resolveDataElementOptions(t+i).radius;return r}parseArrayData(t,e,i,n){const r=super.parseArrayData(t,e,i,n);for(let t=0;t<r.length;t++){const n=e[i+t];r[t]._custom=h(n[2],this.resolveDataElementOptions(t+i).radius)}return r}parseObjectData(t,e,i,n){const r=super.parseObjectData(t,e,i,n);for(let t=0;t<r.length;t++){const n=e[i+t];r[t]._custom=h(n&&n.r&&+n.r,this.resolveDataElementOptions(t+i).radius)}return r}getMaxOverflow(){const t=this._cachedMeta.data;let e=0;for(let i=t.length-1;i>=0;--i)e=Math.max(e,t[i].size(this.resolveDataElementOptions(i))/2);return e>0&&e}getLabelAndValue(t){const e=this._cachedMeta,{xScale:i,yScale:n}=e,r=this.getParsed(t),o=i.getLabelForValue(r.x),a=n.getLabelForValue(r.y),s=r._custom;return{label:e.label,value:"("+o+", "+a+(s?", "+s:"")+")"}}update(t){const e=this._cachedMeta.data;this.updateElements(e,0,e.length,t)}updateElements(t,e,i,n){const r="reset"===n,{iScale:o,vScale:a}=this._cachedMeta,{sharedOptions:s,includeOptions:l}=this._getSharedOptions(e,n),c=o.axis,h=a.axis;for(let u=e;u<e+i;u++){const e=t[u],i=!r&&this.getParsed(u),d={},f=d[c]=r?o.getPixelForDecimal(.5):o.getPixelForValue(i[c]),p=d[h]=r?a.getBasePixel():a.getPixelForValue(i[h]);d.skip=isNaN(f)||isNaN(p),l&&(d.options=s||this.resolveDataElementOptions(u,e.active?"active":n),r&&(d.options.radius=0)),this.updateElement(e,u,d,n)}}resolveDataElementOptions(t,e){const i=this.getParsed(t);let n=super.resolveDataElementOptions(t,e);n.$shared&&(n=Object.assign({},n,{$shared:!1}));const r=n.radius;return"active"!==e&&(n.radius=0),n.radius+=h(i&&i._custom,r),n}}Yi.id="bubble",Yi.defaults={datasetElementType:!1,dataElementType:"point",animations:{numbers:{type:"number",properties:["x","y","borderWidth","radius"]}}},Yi.overrides={scales:{x:{type:"linear"},y:{type:"linear"}},plugins:{tooltip:{callbacks:{title:()=>""}}}};class Gi extends zi{constructor(t,e){super(t,e),this.enableOptionSharing=!0,this.innerRadius=void 0,this.outerRadius=void 0,this.offsetX=void 0,this.offsetY=void 0}linkScales(){}parse(t,e){const i=this.getDataset().data,n=this._cachedMeta;if(!1===this._parsing)n._parsed=i;else{let r,o,a=t=>+i[t];if(s(i[t])){const{key:t="value"}=this._parsing;a=e=>+w(i[e],t)}for(r=t,o=t+e;r<o;++r)n._parsed[r]=a(r)}}_getRotation(){return N(this.options.rotation-90)}_getCircumference(){return N(this.options.circumference)}_getRotationExtents(){let t=T,e=-T;for(let i=0;i<this.chart.data.datasets.length;++i)if(this.chart.isDatasetVisible(i)){const n=this.chart.getDatasetMeta(i).controller,r=n._getRotation(),o=n._getCircumference();t=Math.min(t,r),e=Math.max(e,r+o)}return{rotation:t,circumference:e-t}}update(t){const e=this.chart,{chartArea:i}=e,n=this._cachedMeta,r=n.data,o=this.getMaxBorderWidth()+this.getMaxOffset(r)+this.options.spacing,a=Math.max((Math.min(i.width,i.height)-o)/2,0),s=Math.min((l=this.options.cutout,c=a,"string"==typeof l&&l.endsWith("%")?parseFloat(l)/100:l/c),1);var l,c;const h=this._getRingWeight(this.index),{circumference:d,rotation:f}=this._getRotationExtents(),{ratioX:p,ratioY:g,offsetX:m,offsetY:b}=function(t,e,i){let n=1,r=1,o=0,a=0;if(e<T){const s=t,l=s+e,c=Math.cos(s),h=Math.sin(s),u=Math.cos(l),d=Math.sin(l),f=(t,e,n)=>G(t,s,l,!0)?1:Math.max(e,e*i,n,n*i),p=(t,e,n)=>G(t,s,l,!0)?-1:Math.min(e,e*i,n,n*i),g=f(0,c,u),m=f(A,h,d),b=p(P,c,u),y=p(P+A,h,d);n=(g-b)/2,r=(m-y)/2,o=-(g+b)/2,a=-(m+y)/2}return{ratioX:n,ratioY:r,offsetX:o,offsetY:a}}(f,d,s),y=(i.width-o)/p,x=(i.height-o)/g,v=Math.max(Math.min(y,x)/2,0),_=u(this.options.radius,v),w=(_-Math.max(_*s,0))/this._getVisibleDatasetWeightTotal();this.offsetX=m*_,this.offsetY=b*_,n.total=this.calculateTotal(),this.outerRadius=_-w*this._getRingWeightOffset(this.index),this.innerRadius=Math.max(this.outerRadius-w*h,0),this.updateElements(r,0,r.length,t)}_circumference(t,e){const i=this.options,n=this._cachedMeta,r=this._getCircumference();return e&&i.animation.animateRotate||!this.chart.getDataVisibility(t)||null===n._parsed[t]||n.data[t].hidden?0:this.calculateCircumference(n._parsed[t]*r/T)}updateElements(t,e,i,n){const r="reset"===n,o=this.chart,a=o.chartArea,s=o.options.animation,l=(a.left+a.right)/2,c=(a.top+a.bottom)/2,h=r&&s.animateScale,u=h?0:this.innerRadius,d=h?0:this.outerRadius,{sharedOptions:f,includeOptions:p}=this._getSharedOptions(e,n);let g,m=this._getRotation();for(g=0;g<e;++g)m+=this._circumference(g,r);for(g=e;g<e+i;++g){const e=this._circumference(g,r),i=t[g],o={x:l+this.offsetX,y:c+this.offsetY,startAngle:m,endAngle:m+e,circumference:e,outerRadius:d,innerRadius:u};p&&(o.options=f||this.resolveDataElementOptions(g,i.active?"active":n)),m+=e,this.updateElement(i,g,o,n)}}calculateTotal(){const t=this._cachedMeta,e=t.data;let i,n=0;for(i=0;i<e.length;i++){const r=t._parsed[i];null===r||isNaN(r)||!this.chart.getDataVisibility(i)||e[i].hidden||(n+=Math.abs(r))}return n}calculateCircumference(t){const e=this._cachedMeta.total;return e>0&&!isNaN(t)?T*(Math.abs(t)/e):0}getLabelAndValue(t){const e=this._cachedMeta,i=this.chart,n=i.data.labels||[],r=ci(e._parsed[t],i.options.locale);return{label:n[t]||"",value:r}}getMaxBorderWidth(t){let e=0;const i=this.chart;let n,r,o,a,s;if(!t)for(n=0,r=i.data.datasets.length;n<r;++n)if(i.isDatasetVisible(n)){o=i.getDatasetMeta(n),t=o.data,a=o.controller;break}if(!t)return 0;for(n=0,r=t.length;n<r;++n)s=a.resolveDataElementOptions(n),"inner"!==s.borderAlign&&(e=Math.max(e,s.borderWidth||0,s.hoverBorderWidth||0));return e}getMaxOffset(t){let e=0;for(let i=0,n=t.length;i<n;++i){const t=this.resolveDataElementOptions(i);e=Math.max(e,t.offset||0,t.hoverOffset||0)}return e}_getRingWeightOffset(t){let e=0;for(let i=0;i<t;++i)this.chart.isDatasetVisible(i)&&(e+=this._getRingWeight(i));return e}_getRingWeight(t){return Math.max(h(this.chart.data.datasets[t].weight,1),0)}_getVisibleDatasetWeightTotal(){return this._getRingWeightOffset(this.chart.data.datasets.length)||1}}Gi.id="doughnut",Gi.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"},Gi.descriptors={_scriptable:t=>"spacing"!==t,_indexable:t=>"spacing"!==t},Gi.overrides={aspectRatio:1,plugins:{legend:{labels:{generateLabels(t){const e=t.data;if(e.labels.length&&e.datasets.length){const{labels:{pointStyle:i}}=t.legend.options;return e.labels.map((e,n)=>{const r=t.getDatasetMeta(0).controller.getStyle(n);return{text:e,fillStyle:r.backgroundColor,strokeStyle:r.borderColor,lineWidth:r.borderWidth,pointStyle:i,hidden:!t.getDataVisibility(n),index:n}})}return[]}},onClick(t,e,i){i.chart.toggleDataVisibility(e.index),i.chart.update()}},tooltip:{callbacks:{title:()=>"",label(t){let e=t.label;const i=": "+t.formattedValue;return a(e)?(e=e.slice(),e[0]+=i):e+=i,e}}}}};class Xi extends zi{initialize(){this.enableOptionSharing=!0,this.supportsDecimation=!0,super.initialize()}update(t){const e=this._cachedMeta,{dataset:i,data:n=[],_dataset:r}=e,o=this.chart._animationsDisabled;let{start:a,count:s}=st(e,n,o);this._drawStart=a,this._drawCount=s,lt(e)&&(a=0,s=n.length),i._chart=this.chart,i._datasetIndex=this.index,i._decimated=!!r._decimated,i.points=n;const l=this.resolveDatasetElementOptions(t);this.options.showLine||(l.borderWidth=0),l.segment=this.options.segment,this.updateElement(i,void 0,{animated:!o,options:l},t),this.updateElements(n,a,s,t)}updateElements(t,e,i,n){const r="reset"===n,{iScale:a,vScale:s,_stacked:l,_dataset:c}=this._cachedMeta,{sharedOptions:h,includeOptions:u}=this._getSharedOptions(e,n),d=a.axis,f=s.axis,{spanGaps:p,segment:g}=this.options,m=j(p)?p:Number.POSITIVE_INFINITY,b=this.chart._animationsDisabled||r||"none"===n;let y=e>0&&this.getParsed(e-1);for(let p=e;p<e+i;++p){const e=t[p],i=this.getParsed(p),x=b?e:{},v=o(i[f]),_=x[d]=a.getPixelForValue(i[d],p),w=x[f]=r||v?s.getBasePixel():s.getPixelForValue(l?this.applyStack(s,i,l):i[f],p);x.skip=isNaN(_)||isNaN(w)||v,x.stop=p>0&&Math.abs(i[d]-y[d])>m,g&&(x.parsed=i,x.raw=c.data[p]),u&&(x.options=h||this.resolveDataElementOptions(p,e.active?"active":n)),b||this.updateElement(e,p,x,n),y=i}}getMaxOverflow(){const t=this._cachedMeta,e=t.dataset,i=e.options&&e.options.borderWidth||0,n=t.data||[];if(!n.length)return i;const r=n[0].size(this.resolveDataElementOptions(0)),o=n[n.length-1].size(this.resolveDataElementOptions(n.length-1));return Math.max(i,r,o)/2}draw(){const t=this._cachedMeta;t.dataset.updateControlPoints(this.chart.chartArea,t.iScale.axis),super.draw()}}Xi.id="line",Xi.defaults={datasetElementType:"line",dataElementType:"point",showLine:!0,spanGaps:!1},Xi.overrides={scales:{_index_:{type:"category"},_value_:{type:"linear"}}};class Zi extends zi{constructor(t,e){super(t,e),this.innerRadius=void 0,this.outerRadius=void 0}getLabelAndValue(t){const e=this._cachedMeta,i=this.chart,n=i.data.labels||[],r=ci(e._parsed[t].r,i.options.locale);return{label:n[t]||"",value:r}}parseObjectData(t,e,i,n){return Be.bind(this)(t,e,i,n)}update(t){const e=this._cachedMeta.data;this._updateRadius(),this.updateElements(e,0,e.length,t)}getMinMax(){const t=this._cachedMeta,e={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY};return t.data.forEach((t,i)=>{const n=this.getParsed(i).r;!isNaN(n)&&this.chart.getDataVisibility(i)&&(n<e.min&&(e.min=n),n>e.max&&(e.max=n))}),e}_updateRadius(){const t=this.chart,e=t.chartArea,i=t.options,n=Math.min(e.right-e.left,e.bottom-e.top),r=Math.max(n/2,0),o=(r-Math.max(i.cutoutPercentage?r/100*i.cutoutPercentage:1,0))/t.getVisibleDatasetCount();this.outerRadius=r-o*this.index,this.innerRadius=this.outerRadius-o}updateElements(t,e,i,n){const r="reset"===n,o=this.chart,a=o.options.animation,s=this._cachedMeta.rScale,l=s.xCenter,c=s.yCenter,h=s.getIndexAngle(0)-.5*P;let u,d=h;const f=360/this.countVisibleElements();for(u=0;u<e;++u)d+=this._computeAngle(u,n,f);for(u=e;u<e+i;u++){const e=t[u];let i=d,p=d+this._computeAngle(u,n,f),g=o.getDataVisibility(u)?s.getDistanceFromCenterForValue(this.getParsed(u).r):0;d=p,r&&(a.animateScale&&(g=0),a.animateRotate&&(i=p=h));const m={x:l,y:c,innerRadius:0,outerRadius:g,startAngle:i,endAngle:p,options:this.resolveDataElementOptions(u,e.active?"active":n)};this.updateElement(e,u,m,n)}}countVisibleElements(){const t=this._cachedMeta;let e=0;return t.data.forEach((t,i)=>{!isNaN(this.getParsed(i).r)&&this.chart.getDataVisibility(i)&&e++}),e}_computeAngle(t,e,i){return this.chart.getDataVisibility(t)?N(this.resolveDataElementOptions(t,e).angle||i):0}}Zi.id="polarArea",Zi.defaults={dataElementType:"arc",animation:{animateRotate:!0,animateScale:!0},animations:{numbers:{type:"number",properties:["x","y","startAngle","endAngle","innerRadius","outerRadius"]}},indexAxis:"r",startAngle:0},Zi.overrides={aspectRatio:1,plugins:{legend:{labels:{generateLabels(t){const e=t.data;if(e.labels.length&&e.datasets.length){const{labels:{pointStyle:i}}=t.legend.options;return e.labels.map((e,n)=>{const r=t.getDatasetMeta(0).controller.getStyle(n);return{text:e,fillStyle:r.backgroundColor,strokeStyle:r.borderColor,lineWidth:r.borderWidth,pointStyle:i,hidden:!t.getDataVisibility(n),index:n}})}return[]}},onClick(t,e,i){i.chart.toggleDataVisibility(e.index),i.chart.update()}},tooltip:{callbacks:{title:()=>"",label:t=>t.chart.data.labels[t.dataIndex]+": "+t.formattedValue}}},scales:{r:{type:"radialLinear",angleLines:{display:!1},beginAtZero:!0,grid:{circular:!0},pointLabels:{display:!1},startAngle:0}}};class Qi extends Gi{}Qi.id="pie",Qi.defaults={cutout:0,rotation:0,circumference:360,radius:"100%"};class Ji extends zi{getLabelAndValue(t){const e=this._cachedMeta.vScale,i=this.getParsed(t);return{label:e.getLabels()[t],value:""+e.getLabelForValue(i[e.axis])}}parseObjectData(t,e,i,n){return Be.bind(this)(t,e,i,n)}update(t){const e=this._cachedMeta,i=e.dataset,n=e.data||[],r=e.iScale.getLabels();if(i.points=n,"resize"!==t){const e=this.resolveDatasetElementOptions(t);this.options.showLine||(e.borderWidth=0);const o={_loop:!0,_fullLoop:r.length===n.length,options:e};this.updateElement(i,void 0,o,t)}this.updateElements(n,0,n.length,t)}updateElements(t,e,i,n){const r=this._cachedMeta.rScale,o="reset"===n;for(let a=e;a<e+i;a++){const e=t[a],i=this.resolveDataElementOptions(a,e.active?"active":n),s=r.getPointPositionForValue(a,this.getParsed(a).r),l=o?r.xCenter:s.x,c=o?r.yCenter:s.y,h={x:l,y:c,angle:s.angle,skip:isNaN(l)||isNaN(c),options:i};this.updateElement(e,a,h,n)}}}Ji.id="radar",Ji.defaults={datasetElementType:"line",dataElementType:"point",indexAxis:"r",showLine:!0,elements:{line:{fill:"start"}}},Ji.overrides={aspectRatio:1,scales:{r:{type:"radialLinear"}}};class Ki{constructor(){this.x=void 0,this.y=void 0,this.active=!1,this.options=void 0,this.$animations=void 0}tooltipPosition(t){const{x:e,y:i}=this.getProps(["x","y"],t);return{x:e,y:i}}hasValue(){return j(this.x)&&j(this.y)}getProps(t,e){const i=this.$animations;if(!e||!i)return this;const n={};return t.forEach(t=>{n[t]=i[t]&&i[t].active()?i[t]._to:this[t]}),n}}Ki.defaults={},Ki.defaultRoutes=void 0;const tn={values:t=>a(t)?t:""+t,numeric(t,e,i){if(0===t)return"0";const n=this.chart.options.locale;let r,o=t;if(i.length>1){const e=Math.max(Math.abs(i[0].value),Math.abs(i[i.length-1].value));(e<1e-4||e>1e15)&&(r="scientific"),o=function(t,e){let i=e.length>3?e[2].value-e[1].value:e[1].value-e[0].value;Math.abs(i)>=1&&t!==Math.floor(t)&&(i=t-Math.floor(t));return i}(t,i)}const a=F(Math.abs(o)),s=Math.max(Math.min(-1*Math.floor(a),20),0),l={notation:r,minimumFractionDigits:s,maximumFractionDigits:s};return Object.assign(l,this.options.ticks.format),ci(t,n,l)},logarithmic(t,e,i){if(0===t)return"0";const n=t/Math.pow(10,Math.floor(F(t)));return 1===n||2===n||5===n?tn.numeric.call(this,t,e,i):""}};var en={formatters:tn};function nn(t,e){const i=t.options.ticks,n=i.maxTicksLimit||function(t){const e=t.options.offset,i=t._tickSize(),n=t._length/i+(e?0:1),r=t._maxLength/i;return Math.floor(Math.min(n,r))}(t),r=i.major.enabled?function(t){const e=[];let i,n;for(i=0,n=t.length;i<n;i++)t[i].major&&e.push(i);return e}(e):[],a=r.length,s=r[0],l=r[a-1],c=[];if(a>n)return function(t,e,i,n){let r,o=0,a=i[0];for(n=Math.ceil(n),r=0;r<t.length;r++)r===a&&(e.push(t[r]),o++,a=i[o*n])}(e,c,r,a/n),c;const h=function(t,e,i){const n=function(t){const e=t.length;let i,n;if(e<2)return!1;for(n=t[0],i=1;i<e;++i)if(t[i]-t[i-1]!==n)return!1;return n}(t),r=e.length/i;if(!n)return Math.max(r,1);const o=function(t){const e=[],i=Math.sqrt(t);let n;for(n=1;n<i;n++)t%n===0&&(e.push(n),e.push(t/n));return i===(0|i)&&e.push(i),e.sort((t,e)=>t-e).pop(),e}(n);for(let t=0,e=o.length-1;t<e;t++){const e=o[t];if(e>r)return e}return Math.max(r,1)}(r,e,n);if(a>0){let t,i;const n=a>1?Math.round((l-s)/(a-1)):null;for(rn(e,c,h,o(n)?0:s-n,s),t=0,i=a-1;t<i;t++)rn(e,c,h,r[t],r[t+1]);return rn(e,c,h,l,o(n)?e.length:l+n),c}return rn(e,c,h),c}function rn(t,e,i,n,r){const o=h(n,0),a=Math.min(h(r,t.length),t.length);let s,l,c,u=0;for(i=Math.ceil(i),r&&(s=r-n,i=s/Math.floor(s/i)),c=o;c<0;)u++,c=Math.round(o+u*i);for(l=Math.max(o,0);l<a;l++)l===c&&(e.push(t[l]),u++,c=Math.round(o+u*i))}te.set("scale",{display:!0,offset:!1,reverse:!1,beginAtZero:!1,bounds:"ticks",grace:0,grid:{display:!0,lineWidth:1,drawBorder:!0,drawOnChartArea:!0,drawTicks:!0,tickLength:8,tickWidth:(t,e)=>e.lineWidth,tickColor:(t,e)=>e.color,offset:!1,borderDash:[],borderDashOffset:0,borderWidth: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:en.formatters.values,minor:{},major:{},align:"center",crossAlign:"near",showLabelBackdrop:!1,backdropColor:"rgba(255, 255, 255, 0.75)",backdropPadding:2}}),te.route("scale.ticks","color","","color"),te.route("scale.grid","color","","borderColor"),te.route("scale.grid","borderColor","","borderColor"),te.route("scale.title","color","","color"),te.describe("scale",{_fallback:!1,_scriptable:t=>!t.startsWith("before")&&!t.startsWith("after")&&"callback"!==t&&"parser"!==t,_indexable:t=>"borderDash"!==t&&"tickBorderDash"!==t}),te.describe("scales",{_fallback:"scale"}),te.describe("scale.ticks",{_scriptable:t=>"backdropPadding"!==t&&"callback"!==t,_indexable:t=>"backdropPadding"!==t});const on=(t,e,i)=>"top"===e||"left"===e?t[e]+i:t[e]-i;function an(t,e){const i=[],n=t.length/e,r=t.length;let o=0;for(;o<r;o+=n)i.push(t[Math.floor(o)]);return i}function sn(t,e,i){const n=t.ticks.length,r=Math.min(e,n-1),o=t._startPixel,a=t._endPixel,s=1e-6;let l,c=t.getPixelForTick(r);if(!(i&&(l=1===n?Math.max(c-o,a-c):0===e?(t.getPixelForTick(1)-c)/2:(c-t.getPixelForTick(r-1))/2,c+=r<e?l:-l,c<o-s||c>a+s)))return c}function ln(t){return t.drawTicks?t.tickLength:0}function cn(t,e){if(!t.display)return 0;const i=ke(t.font,e),n=we(t.padding);return(a(t.text)?t.text.length:1)*i.lineHeight+n.height}function hn(t,e,i){let n=ot(t);return(i&&"right"!==e||!i&&"right"===e)&&(n=(t=>"left"===t?"right":"right"===t?"left":t)(n)),n}class un extends Ki{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:n}=this;return t=c(t,Number.POSITIVE_INFINITY),e=c(e,Number.NEGATIVE_INFINITY),i=c(i,Number.POSITIVE_INFINITY),n=c(n,Number.NEGATIVE_INFINITY),{min:c(t,i),max:c(e,n),minDefined:l(t),maxDefined:l(e)}}getMinMax(t){let e,{min:i,max:n,minDefined:r,maxDefined:o}=this.getUserBounds();if(r&&o)return{min:i,max:n};const a=this.getMatchingVisibleMetas();for(let s=0,l=a.length;s<l;++s)e=a[s].controller.getMinMax(this,t),r||(i=Math.min(i,e.min)),o||(n=Math.max(n,e.max));return i=o&&i>n?n:i,n=r&&i>n?i:n,{min:c(i,c(n,i)),max:c(n,c(i,n))}}getPadding(){return{left:this.paddingLeft||0,top:this.paddingTop||0,right:this.paddingRight||0,bottom:this.paddingBottom||0}}getTicks(){return this.ticks}getLabels(){const t=this.chart.data;return this.options.labels||(this.isHorizontal()?t.xLabels:t.yLabels)||t.labels||[]}beforeLayout(){this._cache={},this._dataLimitsCached=!1}beforeUpdate(){d(this.options.beforeUpdate,[this])}update(t,e,i){const{beginAtZero:n,grace:r,ticks:o}=this.options,a=o.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=function(t,e,i){const{min:n,max:r}=t,o=u(e,(r-n)/2),a=(t,e)=>i&&0===t?0:t+e;return{min:a(n,-Math.abs(o)),max:a(r,o)}}(this,r,n),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();const s=a<this.ticks.length;this._convertTicksToLabels(s?an(this.ticks,a):this.ticks),this.configure(),this.beforeCalculateLabelRotation(),this.calculateLabelRotation(),this.afterCalculateLabelRotation(),o.display&&(o.autoSkip||"auto"===o.source)&&(this.ticks=nn(this,this.ticks),this._labelSizes=null,this.afterAutoSkip()),s&&this._convertTicksToLabels(this.ticks),this.beforeFit(),this.fit(),this.afterFit(),this.afterUpdate()}configure(){let t,e,i=this.options.reverse;this.isHorizontal()?(t=this.left,e=this.right):(t=this.top,e=this.bottom,i=!i),this._startPixel=t,this._endPixel=e,this._reversePixels=i,this._length=e-t,this._alignToPixels=this.options.alignToPixels}afterUpdate(){d(this.options.afterUpdate,[this])}beforeSetDimensions(){d(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(){d(this.options.afterSetDimensions,[this])}_callHooks(t){this.chart.notifyPlugins(t,this.getContext()),d(this.options[t],[this])}beforeDataLimits(){this._callHooks("beforeDataLimits")}determineDataLimits(){}afterDataLimits(){this._callHooks("afterDataLimits")}beforeBuildTicks(){this._callHooks("beforeBuildTicks")}buildTicks(){return[]}afterBuildTicks(){this._callHooks("afterBuildTicks")}beforeTickToLabelConversion(){d(this.options.beforeTickToLabelConversion,[this])}generateTickLabels(t){const e=this.options.ticks;let i,n,r;for(i=0,n=t.length;i<n;i++)r=t[i],r.label=d(e.callback,[r.value,i,t],this)}afterTickToLabelConversion(){d(this.options.afterTickToLabelConversion,[this])}beforeCalculateLabelRotation(){d(this.options.beforeCalculateLabelRotation,[this])}calculateLabelRotation(){const t=this.options,e=t.ticks,i=this.ticks.length,n=e.minRotation||0,r=e.maxRotation;let o,a,s,l=n;if(!this._isVisible()||!e.display||n>=r||i<=1||!this.isHorizontal())return void(this.labelRotation=n);const c=this._getLabelSizes(),h=c.widest.width,u=c.highest.height,d=X(this.chart.width-h,0,this.maxWidth);o=t.offset?this.maxWidth/i:d/(i-1),h+6>o&&(o=d/(i-(t.offset?.5:1)),a=this.maxHeight-ln(t.grid)-e.padding-cn(t.title,this.chart.options.font),s=Math.sqrt(h*h+u*u),l=V(Math.min(Math.asin(X((c.highest.height+6)/o,-1,1)),Math.asin(X(a/s,-1,1))-Math.asin(X(u/s,-1,1)))),l=Math.max(n,Math.min(r,l))),this.labelRotation=l}afterCalculateLabelRotation(){d(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){d(this.options.beforeFit,[this])}fit(){const t={width:0,height:0},{chart:e,options:{ticks:i,title:n,grid:r}}=this,o=this._isVisible(),a=this.isHorizontal();if(o){const o=cn(n,e.options.font);if(a?(t.width=this.maxWidth,t.height=ln(r)+o):(t.height=this.maxHeight,t.width=ln(r)+o),i.display&&this.ticks.length){const{first:e,last:n,widest:r,highest:o}=this._getLabelSizes(),s=2*i.padding,l=N(this.labelRotation),c=Math.cos(l),h=Math.sin(l);if(a){const e=i.mirror?0:h*r.width+c*o.height;t.height=Math.min(this.maxHeight,t.height+e+s)}else{const e=i.mirror?0:c*r.width+h*o.height;t.width=Math.min(this.maxWidth,t.width+e+s)}this._calculatePadding(e,n,h,c)}}this._handleMargins(),a?(this.width=this._length=e.width-this._margins.left-this._margins.right,this.height=t.height):(this.width=t.width,this.height=this._length=e.height-this._margins.top-this._margins.bottom)}_calculatePadding(t,e,i,n){const{ticks:{align:r,padding:o},position:a}=this.options,s=0!==this.labelRotation,l="top"!==a&&"x"===this.axis;if(this.isHorizontal()){const a=this.getPixelForTick(0)-this.left,c=this.right-this.getPixelForTick(this.ticks.length-1);let h=0,u=0;s?l?(h=n*t.width,u=i*e.height):(h=i*t.height,u=n*e.width):"start"===r?u=e.width:"end"===r?h=t.width:"inner"!==r&&(h=t.width/2,u=e.width/2),this.paddingLeft=Math.max((h-a+o)*this.width/(this.width-a),0),this.paddingRight=Math.max((u-c+o)*this.width/(this.width-c),0)}else{let i=e.height/2,n=t.height/2;"start"===r?(i=0,n=t.height):"end"===r&&(i=e.height,n=0),this.paddingTop=i+o,this.paddingBottom=n+o}}_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(){d(this.options.afterFit,[this])}isHorizontal(){const{axis:t,position:e}=this.options;return"top"===e||"bottom"===e||"x"===t}isFullSize(){return this.options.fullSize}_convertTicksToLabels(t){let e,i;for(this.beforeTickToLabelConversion(),this.generateTickLabels(t),e=0,i=t.length;e<i;e++)o(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=an(i,e)),this._labelSizes=t=this._computeLabelSizes(i,i.length)}return t}_computeLabelSizes(t,e){const{ctx:i,_longestTextCache:n}=this,r=[],s=[];let l,c,h,u,d,p,g,m,b,y,x,v=0,_=0;for(l=0;l<e;++l){if(u=t[l].label,d=this._resolveTickFontOptions(l),i.font=p=d.string,g=n[p]=n[p]||{data:{},gc:[]},m=d.lineHeight,b=y=0,o(u)||a(u)){if(a(u))for(c=0,h=u.length;c<h;++c)x=u[c],o(x)||a(x)||(b=ee(i,g.data,g.gc,b,x),y+=m)}else b=ee(i,g.data,g.gc,b,u),y=m;r.push(b),s.push(y),v=Math.max(b,v),_=Math.max(y,_)}!function(t,e){f(t,t=>{const i=t.gc,n=i.length/2;let r;if(n>e){for(r=0;r<n;++r)delete t.data[i[r]];i.splice(0,n)}})}(n,e);const w=r.indexOf(v),k=s.indexOf(_),S=t=>({width:r[t]||0,height:s[t]||0});return{first:S(0),last:S(e-1),widest:S(w),highest:S(k),widths:r,heights:s}}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 X(this._alignToPixels?ne(this.chart,e,0):e,-32768,32767)}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=function(t,e,i){return Me(t,{tick:i,index:e,type:"tick"})}(this.getContext(),t,i))}return this.$context||(this.$context=Me(this.chart.getContext(),{scale:this,type:"scale"}))}_tickSize(){const t=this.options.ticks,e=N(this.labelRotation),i=Math.abs(Math.cos(e)),n=Math.abs(Math.sin(e)),r=this._getLabelSizes(),o=t.autoSkipPadding||0,a=r?r.widest.width+o:0,s=r?r.highest.height+o:0;return this.isHorizontal()?s*i>a*n?a/i:s/n:s*n<a*i?s/i:a/n}_isVisible(){const t=this.options.display;return"auto"!==t?!!t:this.getMatchingVisibleMetas().length>0}_computeGridLineItems(t){const e=this.axis,i=this.chart,n=this.options,{grid:r,position:o}=n,a=r.offset,l=this.isHorizontal(),c=this.ticks.length+(a?1:0),u=ln(r),d=[],f=r.setContext(this.getContext()),p=f.drawBorder?f.borderWidth:0,g=p/2,m=function(t){return ne(i,t,p)};let b,y,x,v,_,w,k,S,M,D,P,T;if("top"===o)b=m(this.bottom),w=this.bottom-u,S=b-g,D=m(t.top)+g,T=t.bottom;else if("bottom"===o)b=m(this.top),D=t.top,T=m(t.bottom)-g,w=b+g,S=this.top+u;else if("left"===o)b=m(this.right),_=this.right-u,k=b-g,M=m(t.left)+g,P=t.right;else if("right"===o)b=m(this.left),M=t.left,P=m(t.right)-g,_=b+g,k=this.left+u;else if("x"===e){if("center"===o)b=m((t.top+t.bottom)/2+.5);else if(s(o)){const t=Object.keys(o)[0],e=o[t];b=m(this.chart.scales[t].getPixelForValue(e))}D=t.top,T=t.bottom,w=b+g,S=w+u}else if("y"===e){if("center"===o)b=m((t.left+t.right)/2);else if(s(o)){const t=Object.keys(o)[0],e=o[t];b=m(this.chart.scales[t].getPixelForValue(e))}_=b-g,k=_-u,M=t.left,P=t.right}const C=h(n.ticks.maxTicksLimit,c),E=Math.max(1,Math.ceil(c/C));for(y=0;y<c;y+=E){const t=r.setContext(this.getContext(y)),e=t.lineWidth,n=t.color,o=t.borderDash||[],s=t.borderDashOffset,c=t.tickWidth,h=t.tickColor,u=t.tickBorderDash||[],f=t.tickBorderDashOffset;x=sn(this,y,a),void 0!==x&&(v=ne(i,x,e),l?_=k=M=P=v:w=S=D=T=v,d.push({tx1:_,ty1:w,tx2:k,ty2:S,x1:M,y1:D,x2:P,y2:T,width:e,color:n,borderDash:o,borderDashOffset:s,tickWidth:c,tickColor:h,tickBorderDash:u,tickBorderDashOffset:f}))}return this._ticksLength=c,this._borderValue=b,d}_computeLabelItems(t){const e=this.axis,i=this.options,{position:n,ticks:r}=i,o=this.isHorizontal(),l=this.ticks,{align:c,crossAlign:h,padding:u,mirror:d}=r,f=ln(i.grid),p=f+u,g=d?-u:p,m=-N(this.labelRotation),b=[];let y,x,v,_,w,k,S,M,D,P,T,C,E="middle";if("top"===n)k=this.bottom-g,S=this._getXAxisLabelAlignment();else if("bottom"===n)k=this.top+g,S=this._getXAxisLabelAlignment();else if("left"===n){const t=this._getYAxisLabelAlignment(f);S=t.textAlign,w=t.x}else if("right"===n){const t=this._getYAxisLabelAlignment(f);S=t.textAlign,w=t.x}else if("x"===e){if("center"===n)k=(t.top+t.bottom)/2+p;else if(s(n)){const t=Object.keys(n)[0],e=n[t];k=this.chart.scales[t].getPixelForValue(e)+p}S=this._getXAxisLabelAlignment()}else if("y"===e){if("center"===n)w=(t.left+t.right)/2-p;else if(s(n)){const t=Object.keys(n)[0],e=n[t];w=this.chart.scales[t].getPixelForValue(e)}S=this._getYAxisLabelAlignment(f).textAlign}"y"===e&&("start"===c?E="top":"end"===c&&(E="bottom"));const O=this._getLabelSizes();for(y=0,x=l.length;y<x;++y){v=l[y],_=v.label;const t=r.setContext(this.getContext(y));M=this.getPixelForTick(y)+r.labelOffset,D=this._resolveTickFontOptions(y),P=D.lineHeight,T=a(_)?_.length:1;const e=T/2,i=t.color,s=t.textStrokeColor,c=t.textStrokeWidth;let u,f=S;if(o?(w=M,"inner"===S&&(f=y===x-1?this.options.reverse?"left":"right":0===y?this.options.reverse?"right":"left":"center"),C="top"===n?"near"===h||0!==m?-T*P+P/2:"center"===h?-O.highest.height/2-e*P+P:-O.highest.height+P/2:"near"===h||0!==m?P/2:"center"===h?O.highest.height/2-e*P:O.highest.height-T*P,d&&(C*=-1)):(k=M,C=(1-T)*P/2),t.showLabelBackdrop){const e=we(t.backdropPadding),i=O.heights[y],n=O.widths[y];let r=k+C-e.top,o=w-e.left;switch(E){case"middle":r-=i/2;break;case"bottom":r-=i}switch(S){case"center":o-=n/2;break;case"right":o-=n}u={left:o,top:r,width:n+e.width,height:i+e.height,color:t.backdropColor}}b.push({rotation:m,label:_,font:D,color:i,strokeColor:s,strokeWidth:c,textOffset:C,textAlign:f,textBaseline:E,translation:[w,k],backdrop:u})}return b}_getXAxisLabelAlignment(){const{position:t,ticks:e}=this.options;if(-N(this.labelRotation))return"top"===t?"left":"right";let i="center";return"start"===e.align?i="left":"end"===e.align?i="right":"inner"===e.align&&(i="inner"),i}_getYAxisLabelAlignment(t){const{position:e,ticks:{crossAlign:i,mirror:n,padding:r}}=this.options,o=t+r,a=this._getLabelSizes().widest.width;let s,l;return"left"===e?n?(l=this.right+r,"near"===i?s="left":"center"===i?(s="center",l+=a/2):(s="right",l+=a)):(l=this.right-o,"near"===i?s="right":"center"===i?(s="center",l-=a/2):(s="left",l=this.left)):"right"===e?n?(l=this.left+r,"near"===i?s="right":"center"===i?(s="center",l-=a/2):(s="left",l-=a)):(l=this.left+o,"near"===i?s="left":"center"===i?(s="center",l+=a/2):(s="right",l=this.right)):s="right",{textAlign:s,x:l}}_computeLabelArea(){if(this.options.ticks.mirror)return;const t=this.chart,e=this.options.position;return"left"===e||"right"===e?{top:0,left:this.left,bottom:t.height,right:this.right}:"top"===e||"bottom"===e?{top:this.top,left:0,bottom:this.bottom,right:t.width}:void 0}drawBackground(){const{ctx:t,options:{backgroundColor:e},left:i,top:n,width:r,height:o}=this;e&&(t.save(),t.fillStyle=e,t.fillRect(i,n,r,o),t.restore())}getLineWidthForValue(t){const e=this.options.grid;if(!this._isVisible()||!e.display)return 0;const i=this.ticks.findIndex(e=>e.value===t);if(i>=0){return e.setContext(this.getContext(i)).lineWidth}return 0}drawGrid(t){const e=this.options.grid,i=this.ctx,n=this._gridLineItems||(this._gridLineItems=this._computeGridLineItems(t));let r,o;const a=(t,e,n)=>{n.width&&n.color&&(i.save(),i.lineWidth=n.width,i.strokeStyle=n.color,i.setLineDash(n.borderDash||[]),i.lineDashOffset=n.borderDashOffset,i.beginPath(),i.moveTo(t.x,t.y),i.lineTo(e.x,e.y),i.stroke(),i.restore())};if(e.display)for(r=0,o=n.length;r<o;++r){const t=n[r];e.drawOnChartArea&&a({x:t.x1,y:t.y1},{x:t.x2,y:t.y2},t),e.drawTicks&&a({x:t.tx1,y:t.ty1},{x:t.tx2,y:t.ty2},{color:t.tickColor,width:t.tickWidth,borderDash:t.tickBorderDash,borderDashOffset:t.tickBorderDashOffset})}}drawBorder(){const{chart:t,ctx:e,options:{grid:i}}=this,n=i.setContext(this.getContext()),r=i.drawBorder?n.borderWidth:0;if(!r)return;const o=i.setContext(this.getContext(0)).lineWidth,a=this._borderValue;let s,l,c,h;this.isHorizontal()?(s=ne(t,this.left,r)-r/2,l=ne(t,this.right,o)+o/2,c=h=a):(c=ne(t,this.top,r)-r/2,h=ne(t,this.bottom,o)+o/2,s=l=a),e.save(),e.lineWidth=n.borderWidth,e.strokeStyle=n.borderColor,e.beginPath(),e.moveTo(s,c),e.lineTo(l,h),e.stroke(),e.restore()}drawLabels(t){if(!this.options.ticks.display)return;const e=this.ctx,i=this._computeLabelArea();i&&le(e,i);const n=this._labelItems||(this._labelItems=this._computeLabelItems(t));let r,o;for(r=0,o=n.length;r<o;++r){const t=n[r],i=t.font,o=t.label;t.backdrop&&(e.fillStyle=t.backdrop.color,e.fillRect(t.backdrop.left,t.backdrop.top,t.backdrop.width,t.backdrop.height)),de(e,o,0,t.textOffset,i,t)}i&&ce(e)}drawTitle(){const{ctx:t,options:{position:e,title:i,reverse:n}}=this;if(!i.display)return;const r=ke(i.font),o=we(i.padding),l=i.align;let c=r.lineHeight/2;"bottom"===e||"center"===e||s(e)?(c+=o.bottom,a(i.text)&&(c+=r.lineHeight*(i.text.length-1))):c+=o.top;const{titleX:h,titleY:u,maxWidth:d,rotation:f}=function(t,e,i,n){const{top:r,left:o,bottom:a,right:l,chart:c}=t,{chartArea:h,scales:u}=c;let d,f,p,g=0;const m=a-r,b=l-o;if(t.isHorizontal()){if(f=at(n,o,l),s(i)){const t=Object.keys(i)[0],n=i[t];p=u[t].getPixelForValue(n)+m-e}else p="center"===i?(h.bottom+h.top)/2+m-e:on(t,i,e);d=l-o}else{if(s(i)){const t=Object.keys(i)[0],n=i[t];f=u[t].getPixelForValue(n)-b+e}else f="center"===i?(h.left+h.right)/2-b+e:on(t,i,e);p=at(n,a,r),g="left"===i?-A:A}return{titleX:f,titleY:p,maxWidth:d,rotation:g}}(this,c,e,l);de(t,i.text,0,0,r,{color:i.color,maxWidth:d,rotation:f,textAlign:hn(l,e,n),textBaseline:"middle",translation:[h,u]})}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=h(t.grid&&t.grid.z,-1);return this._isVisible()&&this.draw===un.prototype.draw?[{z:i,draw:t=>{this.drawBackground(),this.drawGrid(t),this.drawTitle()}},{z:i+1,draw:()=>{this.drawBorder()}},{z:e,draw:t=>{this.drawLabels(t)}}]:[{z:e,draw:t=>{this.draw(t)}}]}getMatchingVisibleMetas(t){const e=this.chart.getSortedVisibleDatasetMetas(),i=this.axis+"AxisID",n=[];let r,o;for(r=0,o=e.length;r<o;++r){const o=e[r];o[i]!==this.id||t&&o.type!==t||n.push(o)}return n}_resolveTickFontOptions(t){return ke(this.options.ticks.setContext(this.getContext(t)).font)}_maxDigits(){const t=this._resolveTickFontOptions(0).lineHeight;return(this.isHorizontal()?this.width:this.height)/t}}class dn{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;(function(t){return"id"in t&&"defaults"in t})(e)&&(i=this.register(e));const n=this.items,r=t.id,o=this.scope+"."+r;if(!r)throw new Error("class does not have id: "+t);return r in n||(n[r]=t,function(t,e,i){const n=y(Object.create(null),[i?te.get(i):{},te.get(e),t.defaults]);te.set(e,n),t.defaultRoutes&&function(t,e){Object.keys(e).forEach(i=>{const n=i.split("."),r=n.pop(),o=[t].concat(n).join("."),a=e[i].split("."),s=a.pop(),l=a.join(".");te.route(o,r,l,s)})}(e,t.defaultRoutes);t.descriptors&&te.describe(e,t.descriptors)}(t,o,i),this.override&&te.override(t.id,t.overrides)),o}get(t){return this.items[t]}unregister(t){const e=this.items,i=t.id,n=this.scope;i in e&&delete e[i],n&&i in te[n]&&(delete te[n][i],this.override&&delete Zt[i])}}var fn=new class{constructor(){this.controllers=new dn(zi,"datasets",!0),this.elements=new dn(Ki,"elements"),this.plugins=new dn(Object,"plugins"),this.scales=new dn(un,"scales"),this._typedRegistries=[this.controllers,this.scales,this.elements]}add(...t){this._each("register",t)}remove(...t){this._each("unregister",t)}addControllers(...t){this._each("register",t,this.controllers)}addElements(...t){this._each("register",t,this.elements)}addPlugins(...t){this._each("register",t,this.plugins)}addScales(...t){this._each("register",t,this.scales)}getController(t){return this._get(t,this.controllers,"controller")}getElement(t){return this._get(t,this.elements,"element")}getPlugin(t){return this._get(t,this.plugins,"plugin")}getScale(t){return this._get(t,this.scales,"scale")}removeControllers(...t){this._each("unregister",t,this.controllers)}removeElements(...t){this._each("unregister",t,this.elements)}removePlugins(...t){this._each("unregister",t,this.plugins)}removeScales(...t){this._each("unregister",t,this.scales)}_each(t,e,i){[...e].forEach(e=>{const n=i||this._getRegistryForType(e);i||n.isForType(e)||n===this.plugins&&e.id?this._exec(t,n,e):f(e,e=>{const n=i||this._getRegistryForType(e);this._exec(t,n,e)})})}_exec(t,e,i){const n=k(t);d(i["before"+n],[],i),e[t](i),d(i["after"+n],[],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 n=e.get(t);if(void 0===n)throw new Error('"'+t+'" is not a registered '+i+".");return n}};class pn extends zi{update(t){const e=this._cachedMeta,{data:i=[]}=e,n=this.chart._animationsDisabled;let{start:r,count:o}=st(e,i,n);if(this._drawStart=r,this._drawCount=o,lt(e)&&(r=0,o=i.length),this.options.showLine){const{dataset:r,_dataset:o}=e;r._chart=this.chart,r._datasetIndex=this.index,r._decimated=!!o._decimated,r.points=i;const a=this.resolveDatasetElementOptions(t);a.segment=this.options.segment,this.updateElement(r,void 0,{animated:!n,options:a},t)}this.updateElements(i,r,o,t)}addElements(){const{showLine:t}=this.options;!this.datasetElementType&&t&&(this.datasetElementType=fn.getElement("line")),super.addElements()}updateElements(t,e,i,n){const r="reset"===n,{iScale:a,vScale:s,_stacked:l,_dataset:c}=this._cachedMeta,h=this.resolveDataElementOptions(e,n),u=this.getSharedOptions(h),d=this.includeOptions(n,u),f=a.axis,p=s.axis,{spanGaps:g,segment:m}=this.options,b=j(g)?g:Number.POSITIVE_INFINITY,y=this.chart._animationsDisabled||r||"none"===n;let x=e>0&&this.getParsed(e-1);for(let h=e;h<e+i;++h){const e=t[h],i=this.getParsed(h),g=y?e:{},v=o(i[p]),_=g[f]=a.getPixelForValue(i[f],h),w=g[p]=r||v?s.getBasePixel():s.getPixelForValue(l?this.applyStack(s,i,l):i[p],h);g.skip=isNaN(_)||isNaN(w)||v,g.stop=h>0&&Math.abs(i[f]-x[f])>b,m&&(g.parsed=i,g.raw=c.data[h]),d&&(g.options=u||this.resolveDataElementOptions(h,e.active?"active":n)),y||this.updateElement(e,h,g,n),x=i}this.updateSharedOptions(u,n,h)}getMaxOverflow(){const t=this._cachedMeta,e=t.data||[];if(!this.options.showLine){let t=0;for(let i=e.length-1;i>=0;--i)t=Math.max(t,e[i].size(this.resolveDataElementOptions(i))/2);return t>0&&t}const i=t.dataset,n=i.options&&i.options.borderWidth||0;if(!e.length)return n;const r=e[0].size(this.resolveDataElementOptions(0)),o=e[e.length-1].size(this.resolveDataElementOptions(e.length-1));return Math.max(n,r,o)/2}}pn.id="scatter",pn.defaults={datasetElementType:!1,dataElementType:"point",showLine:!1,fill:!1},pn.overrides={interaction:{mode:"point"},plugins:{tooltip:{callbacks:{title:()=>"",label:t=>"("+t.label+", "+t.formattedValue+")"}}},scales:{x:{type:"linear"},y:{type:"linear"}}};var gn=Object.freeze({__proto__:null,BarController:Ui,BubbleController:Yi,DoughnutController:Gi,LineController:Xi,PolarAreaController:Zi,PieController:Qi,RadarController:Ji,ScatterController:pn});function mn(){throw new Error("This method is not implemented: Check that a complete date adapter is provided.")}class bn{constructor(t){this.options=t||{}}init(t){}formats(){return mn()}parse(t,e){return mn()}format(t,e){return mn()}add(t,e,i){return mn()}diff(t,e,i){return mn()}startOf(t,e,i){return mn()}endOf(t,e){return mn()}}bn.override=function(t){Object.assign(bn.prototype,t)};var yn={_date:bn};function xn(t,e,i,n){const{controller:r,data:o,_sorted:a}=t,s=r._cachedMeta.iScale;if(s&&e===s.axis&&"r"!==e&&a&&o.length){const t=s._reversePixels?K:J;if(!n)return t(o,e,i);if(r._sharedOptions){const n=o[0],r="function"==typeof n.getRange&&n.getRange(e);if(r){const n=t(o,e,i-r),a=t(o,e,i+r);return{lo:n.lo,hi:a.hi}}}}return{lo:0,hi:o.length-1}}function vn(t,e,i,n,r){const o=t.getSortedVisibleDatasetMetas(),a=i[e];for(let t=0,i=o.length;t<i;++t){const{index:i,data:s}=o[t],{lo:l,hi:c}=xn(o[t],e,a,r);for(let t=l;t<=c;++t){const e=s[t];e.skip||n(e,i,t)}}}function _n(t,e,i,n,r){const o=[];if(!r&&!t.isPointInArea(e))return o;return vn(t,i,e,function(i,a,s){(r||se(i,t.chartArea,0))&&i.inRange(e.x,e.y,n)&&o.push({element:i,datasetIndex:a,index:s})},!0),o}function wn(t,e,i,n,r,o){let a=[];const s=function(t){const e=-1!==t.indexOf("x"),i=-1!==t.indexOf("y");return function(t,n){const r=e?Math.abs(t.x-n.x):0,o=i?Math.abs(t.y-n.y):0;return Math.sqrt(Math.pow(r,2)+Math.pow(o,2))}}(i);let l=Number.POSITIVE_INFINITY;return vn(t,i,e,function(i,c,h){const u=i.inRange(e.x,e.y,r);if(n&&!u)return;const d=i.getCenterPoint(r);if(!(!!o||t.isPointInArea(d))&&!u)return;const f=s(e,d);f<l?(a=[{element:i,datasetIndex:c,index:h}],l=f):f===l&&a.push({element:i,datasetIndex:c,index:h})}),a}function kn(t,e,i,n,r,o){return o||t.isPointInArea(e)?"r"!==i||n?wn(t,e,i,n,r,o):function(t,e,i,n){let r=[];return vn(t,i,e,function(t,i,o){const{startAngle:a,endAngle:s}=t.getProps(["startAngle","endAngle"],n),{angle:l}=q(t,{x:e.x,y:e.y});G(l,a,s)&&r.push({element:t,datasetIndex:i,index:o})}),r}(t,e,i,r):[]}function Sn(t,e,i,n,r){const o=[],a="x"===i?"inXRange":"inYRange";let s=!1;return vn(t,i,e,(t,n,l)=>{t[a](e[i],r)&&(o.push({element:t,datasetIndex:n,index:l}),s=s||t.inRange(e.x,e.y,r))}),n&&!s?[]:o}var Mn={evaluateInteractionItems:vn,modes:{index(t,e,i,n){const r=Ke(e,t),o=i.axis||"x",a=i.includeInvisible||!1,s=i.intersect?_n(t,r,o,n,a):kn(t,r,o,!1,n,a),l=[];return s.length?(t.getSortedVisibleDatasetMetas().forEach(t=>{const e=s[0].index,i=t.data[e];i&&!i.skip&&l.push({element:i,datasetIndex:t.index,index:e})}),l):[]},dataset(t,e,i,n){const r=Ke(e,t),o=i.axis||"xy",a=i.includeInvisible||!1;let s=i.intersect?_n(t,r,o,n,a):kn(t,r,o,!1,n,a);if(s.length>0){const e=s[0].datasetIndex,i=t.getDatasetMeta(e).data;s=[];for(let t=0;t<i.length;++t)s.push({element:i[t],datasetIndex:e,index:t})}return s},point:(t,e,i,n)=>_n(t,Ke(e,t),i.axis||"xy",n,i.includeInvisible||!1),nearest(t,e,i,n){const r=Ke(e,t),o=i.axis||"xy",a=i.includeInvisible||!1;return kn(t,r,o,i.intersect,n,a)},x:(t,e,i,n)=>Sn(t,Ke(e,t),"x",i.intersect,n),y:(t,e,i,n)=>Sn(t,Ke(e,t),"y",i.intersect,n)}};const Dn=["left","top","right","bottom"];function Pn(t,e){return t.filter(t=>t.pos===e)}function Tn(t,e){return t.filter(t=>-1===Dn.indexOf(t.pos)&&t.box.axis===e)}function Cn(t,e){return t.sort((t,i)=>{const n=e?i:t,r=e?t:i;return n.weight===r.weight?n.index-r.index:n.weight-r.weight})}function En(t,e){const i=function(t){const e={};for(const i of t){const{stack:t,pos:n,stackWeight:r}=i;if(!t||!Dn.includes(n))continue;const o=e[t]||(e[t]={count:0,placed:0,weight:0,size:0});o.count++,o.weight+=r}return e}(t),{vBoxMaxWidth:n,hBoxMaxHeight:r}=e;let o,a,s;for(o=0,a=t.length;o<a;++o){s=t[o];const{fullSize:a}=s.box,l=i[s.stack],c=l&&s.stackWeight/l.weight;s.horizontal?(s.width=c?c*n:a&&e.availableWidth,s.height=r):(s.width=n,s.height=c?c*r:a&&e.availableHeight)}return i}function On(t,e,i,n){return Math.max(t[i],e[i])+Math.max(t[n],e[n])}function An(t,e){t.top=Math.max(t.top,e.top),t.left=Math.max(t.left,e.left),t.bottom=Math.max(t.bottom,e.bottom),t.right=Math.max(t.right,e.right)}function Ln(t,e,i,n){const{pos:r,box:o}=i,a=t.maxPadding;if(!s(r)){i.size&&(t[r]-=i.size);const e=n[i.stack]||{size:0,count:1};e.size=Math.max(e.size,i.horizontal?o.height:o.width),i.size=e.size/e.count,t[r]+=i.size}o.getPadding&&An(a,o.getPadding());const l=Math.max(0,e.outerWidth-On(a,t,"left","right")),c=Math.max(0,e.outerHeight-On(a,t,"top","bottom")),h=l!==t.w,u=c!==t.h;return t.w=l,t.h=c,i.horizontal?{same:h,other:u}:{same:u,other:h}}function In(t,e){const i=e.maxPadding;function n(t){const n={left:0,top:0,right:0,bottom:0};return t.forEach(t=>{n[t]=Math.max(e[t],i[t])}),n}return n(t?["left","right"]:["top","bottom"])}function Fn(t,e,i,n){const r=[];let o,a,s,l,c,h;for(o=0,a=t.length,c=0;o<a;++o){s=t[o],l=s.box,l.update(s.width||e.w,s.height||e.h,In(s.horizontal,e));const{same:a,other:u}=Ln(e,i,s,n);c|=a&&r.length,h=h||u,l.fullSize||r.push(s)}return c&&Fn(r,e,i,n)||h}function Rn(t,e,i,n,r){t.top=i,t.left=e,t.right=e+n,t.bottom=i+r,t.width=n,t.height=r}function zn(t,e,i,n){const r=i.padding;let{x:o,y:a}=e;for(const s of t){const t=s.box,l=n[s.stack]||{count:1,placed:0,weight:1},c=s.stackWeight/l.weight||1;if(s.horizontal){const n=e.w*c,o=l.size||t.height;S(l.start)&&(a=l.start),t.fullSize?Rn(t,r.left,a,i.outerWidth-r.right-r.left,o):Rn(t,e.left+l.placed,a,n,o),l.start=a,l.placed+=n,a=t.bottom}else{const n=e.h*c,a=l.size||t.width;S(l.start)&&(o=l.start),t.fullSize?Rn(t,o,r.top,a,i.outerHeight-r.bottom-r.top):Rn(t,o,e.top+l.placed,a,n),l.start=o,l.placed+=n,o=t.right}}e.x=o,e.y=a}te.set("layout",{autoPadding:!0,padding:{top:0,right:0,bottom:0,left:0}});var jn={addBox(t,e){t.boxes||(t.boxes=[]),e.fullSize=e.fullSize||!1,e.position=e.position||"top",e.weight=e.weight||0,e._layers=e._layers||function(){return[{z:0,draw(t){e.draw(t)}}]},t.boxes.push(e)},removeBox(t,e){const i=t.boxes?t.boxes.indexOf(e):-1;-1!==i&&t.boxes.splice(i,1)},configure(t,e,i){e.fullSize=i.fullSize,e.position=i.position,e.weight=i.weight},update(t,e,i,n){if(!t)return;const r=we(t.options.layout.padding),o=Math.max(e-r.width,0),a=Math.max(i-r.height,0),s=function(t){const e=function(t){const e=[];let i,n,r,o,a,s;for(i=0,n=(t||[]).length;i<n;++i)r=t[i],({position:o,options:{stack:a,stackWeight:s=1}}=r),e.push({index:i,box:r,pos:o,horizontal:r.isHorizontal(),weight:r.weight,stack:a&&o+a,stackWeight:s});return e}(t),i=Cn(e.filter(t=>t.box.fullSize),!0),n=Cn(Pn(e,"left"),!0),r=Cn(Pn(e,"right")),o=Cn(Pn(e,"top"),!0),a=Cn(Pn(e,"bottom")),s=Tn(e,"x"),l=Tn(e,"y");return{fullSize:i,leftAndTop:n.concat(o),rightAndBottom:r.concat(l).concat(a).concat(s),chartArea:Pn(e,"chartArea"),vertical:n.concat(r).concat(l),horizontal:o.concat(a).concat(s)}}(t.boxes),l=s.vertical,c=s.horizontal;f(t.boxes,t=>{"function"==typeof t.beforeLayout&&t.beforeLayout()});const h=l.reduce((t,e)=>e.box.options&&!1===e.box.options.display?t:t+1,0)||1,u=Object.freeze({outerWidth:e,outerHeight:i,padding:r,availableWidth:o,availableHeight:a,vBoxMaxWidth:o/2/h,hBoxMaxHeight:a/2}),d=Object.assign({},r);An(d,we(n));const p=Object.assign({maxPadding:d,w:o,h:a,x:r.left,y:r.top},r),g=En(l.concat(c),u);Fn(s.fullSize,p,u,g),Fn(l,p,u,g),Fn(c,p,u,g)&&Fn(l,p,u,g),function(t){const e=t.maxPadding;function i(i){const n=Math.max(e[i]-t[i],0);return t[i]+=n,n}t.y+=i("top"),t.x+=i("left"),i("right"),i("bottom")}(p),zn(s.leftAndTop,p,u,g),p.x+=p.w,p.y+=p.h,zn(s.rightAndBottom,p,u,g),t.chartArea={left:p.left,top:p.top,right:p.left+p.w,bottom:p.top+p.h,height:p.h,width:p.w},f(s.chartArea,e=>{const i=e.box;Object.assign(i,t.chartArea),i.update(p.w,p.h,{left:0,top:0,right:0,bottom:0})})}};class Bn{acquireContext(t,e){}releaseContext(t){return!1}addEventListener(t,e,i){}removeEventListener(t,e,i){}getDevicePixelRatio(){return 1}getMaximumSize(t,e,i,n){return e=Math.max(0,e||t.width),i=i||t.height,{width:e,height:Math.max(0,n?Math.floor(e/n):i)}}isAttached(t){return!0}updateConfig(t){}}class Wn extends Bn{acquireContext(t){return t&&t.getContext&&t.getContext("2d")||null}updateConfig(t){t.options.animation=!1}}const Nn="$chartjs",Vn={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},Hn=t=>null===t||""===t;const qn=!!ni&&{passive:!0};function $n(t,e,i){t.canvas.removeEventListener(e,i,qn)}function Un(t,e){for(const i of t)if(i===e||i.contains(e))return!0}function Yn(t,e,i){const n=t.canvas,r=new MutationObserver(t=>{let e=!1;for(const i of t)e=e||Un(i.addedNodes,n),e=e&&!Un(i.removedNodes,n);e&&i()});return r.observe(document,{childList:!0,subtree:!0}),r}function Gn(t,e,i){const n=t.canvas,r=new MutationObserver(t=>{let e=!1;for(const i of t)e=e||Un(i.removedNodes,n),e=e&&!Un(i.addedNodes,n);e&&i()});return r.observe(document,{childList:!0,subtree:!0}),r}const Xn=new Map;let Zn=0;function Qn(){const t=window.devicePixelRatio;t!==Zn&&(Zn=t,Xn.forEach((e,i)=>{i.currentDevicePixelRatio!==t&&e()}))}function Jn(t,e,i){const n=t.canvas,r=n&&Ge(n);if(!r)return;const o=rt((t,e)=>{const n=r.clientWidth;i(t,e),n<r.clientWidth&&i()},window),a=new ResizeObserver(t=>{const e=t[0],i=e.contentRect.width,n=e.contentRect.height;0===i&&0===n||o(i,n)});return a.observe(r),function(t,e){Xn.size||window.addEventListener("resize",Qn),Xn.set(t,e)}(t,o),a}function Kn(t,e,i){i&&i.disconnect(),"resize"===e&&function(t){Xn.delete(t),Xn.size||window.removeEventListener("resize",Qn)}(t)}function tr(t,e,i){const n=t.canvas,r=rt(e=>{null!==t.ctx&&i(function(t,e){const i=Vn[t.type]||t.type,{x:n,y:r}=Ke(t,e);return{type:i,chart:e,native:t,x:void 0!==n?n:null,y:void 0!==r?r:null}}(e,t))},t,t=>{const e=t[0];return[e,e.offsetX,e.offsetY]});return function(t,e,i){t.addEventListener(e,i,qn)}(n,e,r),r}class er extends Bn{acquireContext(t,e){const i=t&&t.getContext&&t.getContext("2d");return i&&i.canvas===t?(function(t,e){const i=t.style,n=t.getAttribute("height"),r=t.getAttribute("width");if(t[Nn]={initial:{height:n,width:r,style:{display:i.display,height:i.height,width:i.width}}},i.display=i.display||"block",i.boxSizing=i.boxSizing||"border-box",Hn(r)){const e=ri(t,"width");void 0!==e&&(t.width=e)}if(Hn(n))if(""===t.style.height)t.height=t.width/(e||2);else{const e=ri(t,"height");void 0!==e&&(t.height=e)}}(t,e),i):null}releaseContext(t){const e=t.canvas;if(!e[Nn])return!1;const i=e[Nn].initial;["height","width"].forEach(t=>{const n=i[t];o(n)?e.removeAttribute(t):e.setAttribute(t,n)});const n=i.style||{};return Object.keys(n).forEach(t=>{e.style[t]=n[t]}),e.width=e.width,delete e[Nn],!0}addEventListener(t,e,i){this.removeEventListener(t,e);const n=t.$proxies||(t.$proxies={}),r={attach:Yn,detach:Gn,resize:Jn}[e]||tr;n[e]=r(t,e,i)}removeEventListener(t,e){const i=t.$proxies||(t.$proxies={}),n=i[e];if(!n)return;({attach:Kn,detach:Kn,resize:Kn}[e]||$n)(t,e,n),i[e]=void 0}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(t,e,i,n){return ei(t,e,i,n)}isAttached(t){const e=Ge(t);return!(!e||!e.isConnected)}}class ir{constructor(){this._init=[]}notify(t,e,i,n){"beforeInit"===e&&(this._init=this._createDescriptors(t,!0),this._notify(this._init,t,"install"));const r=n?this._descriptors(t).filter(n):this._descriptors(t),o=this._notify(r,t,e,i);return"afterDestroy"===e&&(this._notify(r,t,"stop"),this._notify(this._init,t,"uninstall")),o}_notify(t,e,i,n){n=n||{};for(const r of t){const t=r.plugin;if(!1===d(t[i],[e,n,r.options],t)&&n.cancelable)return!1}return!0}invalidate(){o(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,n=h(i.options&&i.options.plugins,{}),r=function(t){const e={},i=[],n=Object.keys(fn.plugins.items);for(let t=0;t<n.length;t++)i.push(fn.getPlugin(n[t]));const r=t.plugins||[];for(let t=0;t<r.length;t++){const n=r[t];-1===i.indexOf(n)&&(i.push(n),e[n.id]=!0)}return{plugins:i,localIds:e}}(i);return!1!==n||e?function(t,{plugins:e,localIds:i},n,r){const o=[],a=t.getContext();for(const s of e){const e=s.id,l=nr(n[e],r);null!==l&&o.push({plugin:s,options:rr(t.config,{plugin:s,local:i[e]},l,a)})}return o}(t,r,n,e):[]}_notifyStateChanges(t){const e=this._oldCache||[],i=this._cache,n=(t,e)=>t.filter(t=>!e.some(e=>t.plugin.id===e.plugin.id));this._notify(n(e,i),t,"stop"),this._notify(n(i,e),t,"start")}}function nr(t,e){return e||!1!==t?!0===t?{}:t:null}function rr(t,{plugin:e,local:i},n,r){const o=t.pluginScopeKeys(e),a=t.getOptionScopes(n,o);return i&&e.defaults&&a.push(e.defaults),t.createResolver(a,r,[""],{scriptable:!1,indexable:!1,allKeys:!0})}function or(t,e){const i=te.datasets[t]||{};return((e.datasets||{})[t]||{}).indexAxis||e.indexAxis||i.indexAxis||"x"}function ar(t,e){return"x"===t||"y"===t?t:e.axis||("top"===(i=e.position)||"bottom"===i?"x":"left"===i||"right"===i?"y":void 0)||t.charAt(0).toLowerCase();var i}function sr(t){const e=t.options||(t.options={});e.plugins=h(e.plugins,{}),e.scales=function(t,e){const i=Zt[t.type]||{scales:{}},n=e.scales||{},r=or(t.type,e),o=Object.create(null),a=Object.create(null);return Object.keys(n).forEach(t=>{const e=n[t];if(!s(e))return;if(e._proxy)return;const l=ar(t,e),c=function(t,e){return t===e?"_index_":"_value_"}(l,r),h=i.scales||{};o[l]=o[l]||t,a[t]=x(Object.create(null),[{axis:l},e,h[l],h[c]])}),t.data.datasets.forEach(i=>{const r=i.type||t.type,s=i.indexAxis||or(r,e),l=(Zt[r]||{}).scales||{};Object.keys(l).forEach(t=>{const e=function(t,e){let i=t;return"_index_"===t?i=e:"_value_"===t&&(i="x"===e?"y":"x"),i}(t,s),r=i[e+"AxisID"]||o[e]||e;a[r]=a[r]||Object.create(null),x(a[r],[{axis:e},n[r],l[t]])})}),Object.keys(a).forEach(t=>{const e=a[t];x(e,[te.scales[e.type],te.scale])}),a}(t,e)}function lr(t){return(t=t||{}).datasets=t.datasets||[],t.labels=t.labels||[],t}const cr=new Map,hr=new Set;function ur(t,e){let i=cr.get(t);return i||(i=e(),cr.set(t,i),hr.add(i)),i}const dr=(t,e,i)=>{const n=w(e,i);void 0!==n&&t.add(n)};class fr{constructor(t){this._config=function(t){return(t=t||{}).data=lr(t.data),sr(t),t}(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=lr(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(),sr(t)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(t){return ur(t,()=>[[`datasets.${t}`,""]])}datasetAnimationScopeKeys(t,e){return ur(`${t}.transition.${e}`,()=>[[`datasets.${t}.transitions.${e}`,`transitions.${e}`],[`datasets.${t}`,""]])}datasetElementScopeKeys(t,e){return ur(`${t}-${e}`,()=>[[`datasets.${t}.elements.${e}`,`datasets.${t}`,`elements.${e}`,""]])}pluginScopeKeys(t){const e=t.id;return ur(`${this.type}-plugin-${e}`,()=>[[`plugins.${e}`,...t.additionalOptionScopes||[]]])}_cachedScopes(t,e){const i=this._scopeCache;let n=i.get(t);return n&&!e||(n=new Map,i.set(t,n)),n}getOptionScopes(t,e,i){const{options:n,type:r}=this,o=this._cachedScopes(t,i),a=o.get(e);if(a)return a;const s=new Set;e.forEach(e=>{t&&(s.add(t),e.forEach(e=>dr(s,t,e))),e.forEach(t=>dr(s,n,t)),e.forEach(t=>dr(s,Zt[r]||{},t)),e.forEach(t=>dr(s,te,t)),e.forEach(t=>dr(s,Qt,t))});const l=Array.from(s);return 0===l.length&&l.push(Object.create(null)),hr.has(e)&&o.set(e,l),l}chartOptionScopes(){const{options:t,type:e}=this;return[t,Zt[e]||{},te.datasets[e]||{},{type:e},te,Qt]}resolveNamedOptions(t,e,i,n=[""]){const r={$shared:!0},{resolver:o,subPrefixes:s}=pr(this._resolverCache,t,n);let l=o;if(function(t,e){const{isScriptable:i,isIndexable:n}=Te(t);for(const r of e){const e=i(r),o=n(r),s=(o||e)&&t[r];if(e&&(M(s)||gr(s))||o&&a(s))return!0}return!1}(o,e)){r.$shared=!1;l=Pe(o,i=M(i)?i():i,this.createResolver(t,i,s))}for(const t of e)r[t]=l[t];return r}createResolver(t,e,i=[""],n){const{resolver:r}=pr(this._resolverCache,t,i);return s(e)?Pe(r,e,void 0,n):r}}function pr(t,e,i){let n=t.get(e);n||(n=new Map,t.set(e,n));const r=i.join();let o=n.get(r);if(!o){o={resolver:De(e,i),subPrefixes:i.filter(t=>!t.toLowerCase().includes("hover"))},n.set(r,o)}return o}const gr=t=>s(t)&&Object.getOwnPropertyNames(t).reduce((e,i)=>e||M(t[i]),!1);const mr=["top","bottom","left","right","chartArea"];function br(t,e){return"top"===t||"bottom"===t||-1===mr.indexOf(t)&&"x"===e}function yr(t,e){return function(i,n){return i[t]===n[t]?i[e]-n[e]:i[t]-n[t]}}function xr(t){const e=t.chart,i=e.options.animation;e.notifyPlugins("afterRender"),d(i&&i.onComplete,[t],e)}function vr(t){const e=t.chart,i=e.options.animation;d(i&&i.onProgress,[t],e)}function _r(t){return Ye()&&"string"==typeof t?t=document.getElementById(t):t&&t.length&&(t=t[0]),t&&t.canvas&&(t=t.canvas),t}const wr={},kr=t=>{const e=_r(t);return Object.values(wr).filter(t=>t.canvas===e).pop()};function Sr(t,e,i){const n=Object.keys(t);for(const r of n){const n=+r;if(n>=e){const o=t[r];delete t[r],(i>0||n>e)&&(t[n+i]=o)}}}class Mr{constructor(t,e){const i=this.config=new fr(e),n=_r(t),o=kr(n);if(o)throw new Error("Canvas is already in use. Chart with ID '"+o.id+"' must be destroyed before the canvas with ID '"+o.canvas.id+"' can be reused.");const a=i.createResolver(i.chartOptionScopes(),this.getContext());this.platform=new(i.platform||function(t){return!Ye()||"undefined"!=typeof OffscreenCanvas&&t instanceof OffscreenCanvas?Wn:er}(n)),this.platform.updateConfig(i);const s=this.platform.acquireContext(n,a.aspectRatio),l=s&&s.canvas,c=l&&l.height,h=l&&l.width;this.id=r(),this.ctx=s,this.canvas=l,this.width=h,this.height=c,this._options=a,this._aspectRatio=this.aspectRatio,this._layers=[],this._metasets=[],this._stacks=void 0,this.boxes=[],this.currentDevicePixelRatio=void 0,this.chartArea=void 0,this._active=[],this._lastEvent=void 0,this._listeners={},this._responsiveListeners=void 0,this._sortedMetasets=[],this.scales={},this._plugins=new ir,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=function(t,e){let i;return function(...n){return e?(clearTimeout(i),i=setTimeout(t,e,n)):t.apply(this,n),e}}(t=>this.update(t),a.resizeDelay||0),this._dataChanges=[],wr[this.id]=this,s&&l&&(vi.listen(this,"complete",xr),vi.listen(this,"progress",vr),this._initialize(),this.attached&&this.update())}get aspectRatio(){const{options:{aspectRatio:t,maintainAspectRatio:e},width:i,height:n,_aspectRatio:r}=this;return o(t)?e&&r?r:n?i/n:null:t}get data(){return this.config.data}set data(t){this.config.data=t}get options(){return this._options}set options(t){this.config.options=t}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():ii(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return re(this.canvas,this.ctx),this}stop(){return vi.stop(this),this}resize(t,e){vi.running(this)?this._resizeBeforeDraw={width:t,height:e}:this._resize(t,e)}_resize(t,e){const i=this.options,n=this.canvas,r=i.maintainAspectRatio&&this.aspectRatio,o=this.platform.getMaximumSize(n,t,e,r),a=i.devicePixelRatio||this.platform.getDevicePixelRatio(),s=this.width?"resize":"attach";this.width=o.width,this.height=o.height,this._aspectRatio=this.aspectRatio,ii(this,a,!0)&&(this.notifyPlugins("resize",{size:o}),d(i.onResize,[this,o],this),this.attached&&this._doResize(s)&&this.render())}ensureScalesHaveIDs(){f(this.options.scales||{},(t,e)=>{t.id=e})}buildOrUpdateScales(){const t=this.options,e=t.scales,i=this.scales,n=Object.keys(i).reduce((t,e)=>(t[e]=!1,t),{});let r=[];e&&(r=r.concat(Object.keys(e).map(t=>{const i=e[t],n=ar(t,i),r="r"===n,o="x"===n;return{options:i,dposition:r?"chartArea":o?"bottom":"left",dtype:r?"radialLinear":o?"category":"linear"}}))),f(r,e=>{const r=e.options,o=r.id,a=ar(o,r),s=h(r.type,e.dtype);void 0!==r.position&&br(r.position,a)===br(e.dposition)||(r.position=e.dposition),n[o]=!0;let l=null;if(o in i&&i[o].type===s)l=i[o];else{l=new(fn.getScale(s))({id:o,type:s,ctx:this.ctx,chart:this}),i[l.id]=l}l.init(r,t)}),f(n,(t,e)=>{t||delete i[e]}),f(i,t=>{jn.configure(this,t,t.options),jn.addBox(this,t)})}_updateMetasets(){const t=this._metasets,e=this.data.datasets.length,i=t.length;if(t.sort((t,e)=>t.index-e.index),i>e){for(let t=e;t<i;++t)this._destroyDatasetMeta(t);t.splice(e,i-e)}this._sortedMetasets=t.slice(0).sort(yr("order","index"))}_removeUnreferencedMetasets(){const{_metasets:t,data:{datasets:e}}=this;t.length>e.length&&delete this._stacks,t.forEach((t,i)=>{0===e.filter(e=>e===t._dataset).length&&this._destroyDatasetMeta(i)})}buildOrUpdateControllers(){const t=[],e=this.data.datasets;let i,n;for(this._removeUnreferencedMetasets(),i=0,n=e.length;i<n;i++){const n=e[i];let r=this.getDatasetMeta(i);const o=n.type||this.config.type;if(r.type&&r.type!==o&&(this._destroyDatasetMeta(i),r=this.getDatasetMeta(i)),r.type=o,r.indexAxis=n.indexAxis||or(o,this.options),r.order=n.order||0,r.index=i,r.label=""+n.label,r.visible=this.isDatasetVisible(i),r.controller)r.controller.updateIndex(i),r.controller.linkScales();else{const e=fn.getController(o),{datasetElementType:n,dataElementType:a}=te.datasets[o];Object.assign(e.prototype,{dataElementType:fn.getElement(a),datasetElementType:n&&fn.getElement(n)}),r.controller=new e(this,i),t.push(r.controller)}}return this._updateMetasets(),t}_resetElements(){f(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()),n=this._animationsDisabled=!i.animation;if(this._updateScales(),this._checkEventBindings(),this._updateHiddenIndices(),this._plugins.invalidate(),!1===this.notifyPlugins("beforeUpdate",{mode:t,cancelable:!0}))return;const r=this.buildOrUpdateControllers();this.notifyPlugins("beforeElementsUpdate");let o=0;for(let t=0,e=this.data.datasets.length;t<e;t++){const{controller:e}=this.getDatasetMeta(t),i=!n&&-1===r.indexOf(e);e.buildOrUpdateElements(i),o=Math.max(+e.getMaxOverflow(),o)}o=this._minPadding=i.layout.autoPadding?o:0,this._updateLayout(o),n||f(r,t=>{t.reset()}),this._updateDatasets(t),this.notifyPlugins("afterUpdate",{mode:t}),this._layers.sort(yr("z","_idx"));const{_active:a,_lastEvent:s}=this;s?this._eventHandler(s,!0):a.length&&this._updateHoverStyles(a,a,!0),this.render()}_updateScales(){f(this.scales,t=>{jn.removeBox(this,t)}),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){const t=this.options,e=new Set(Object.keys(this._listeners)),i=new Set(t.events);D(e,i)&&!!this._responsiveListeners===t.responsive||(this.unbindEvents(),this.bindEvents())}_updateHiddenIndices(){const{_hiddenIndices:t}=this,e=this._getUniformDataChanges()||[];for(const{method:i,start:n,count:r}of e){Sr(t,n,"_removeElements"===i?-r:r)}}_getUniformDataChanges(){const t=this._dataChanges;if(!t||!t.length)return;this._dataChanges=[];const e=this.data.datasets.length,i=e=>new Set(t.filter(t=>t[0]===e).map((t,e)=>e+","+t.splice(1).join(","))),n=i(0);for(let t=1;t<e;t++)if(!D(n,i(t)))return;return Array.from(n).map(t=>t.split(",")).map(t=>({method:t[1],start:+t[2],count:+t[3]}))}_updateLayout(t){if(!1===this.notifyPlugins("beforeLayout",{cancelable:!0}))return;jn.update(this,this.width,this.height,t);const e=this.chartArea,i=e.width<=0||e.height<=0;this._layers=[],f(this.boxes,t=>{i&&"chartArea"===t.position||(t.configure&&t.configure(),this._layers.push(...t._layers()))},this),this._layers.forEach((t,e)=>{t._idx=e}),this.notifyPlugins("afterLayout")}_updateDatasets(t){if(!1!==this.notifyPlugins("beforeDatasetsUpdate",{mode:t,cancelable:!0})){for(let t=0,e=this.data.datasets.length;t<e;++t)this.getDatasetMeta(t).controller.configure();for(let e=0,i=this.data.datasets.length;e<i;++e)this._updateDataset(e,M(t)?t({datasetIndex:e}):t);this.notifyPlugins("afterDatasetsUpdate",{mode:t})}}_updateDataset(t,e){const i=this.getDatasetMeta(t),n={meta:i,index:t,mode:e,cancelable:!0};!1!==this.notifyPlugins("beforeDatasetUpdate",n)&&(i.controller._update(e),n.cancelable=!1,this.notifyPlugins("afterDatasetUpdate",n))}render(){!1!==this.notifyPlugins("beforeRender",{cancelable:!0})&&(vi.has(this)?this.attached&&!vi.running(this)&&vi.start(this):(this.draw(),xr({chart:this})))}draw(){let t;if(this._resizeBeforeDraw){const{width:t,height:e}=this._resizeBeforeDraw;this._resize(t,e),this._resizeBeforeDraw=null}if(this.clear(),this.width<=0||this.height<=0)return;if(!1===this.notifyPlugins("beforeDraw",{cancelable:!0}))return;const e=this._layers;for(t=0;t<e.length&&e[t].z<=0;++t)e[t].draw(this.chartArea);for(this._drawDatasets();t<e.length;++t)e[t].draw(this.chartArea);this.notifyPlugins("afterDraw")}_getSortedDatasetMetas(t){const e=this._sortedMetasets,i=[];let n,r;for(n=0,r=e.length;n<r;++n){const r=e[n];t&&!r.visible||i.push(r)}return i}getSortedVisibleDatasetMetas(){return this._getSortedDatasetMetas(!0)}_drawDatasets(){if(!1===this.notifyPlugins("beforeDatasetsDraw",{cancelable:!0}))return;const t=this.getSortedVisibleDatasetMetas();for(let e=t.length-1;e>=0;--e)this._drawDataset(t[e]);this.notifyPlugins("afterDatasetsDraw")}_drawDataset(t){const e=this.ctx,i=t._clip,n=!i.disabled,r=this.chartArea,o={meta:t,index:t.index,cancelable:!0};!1!==this.notifyPlugins("beforeDatasetDraw",o)&&(n&&le(e,{left:!1===i.left?0:r.left-i.left,right:!1===i.right?this.width:r.right+i.right,top:!1===i.top?0:r.top-i.top,bottom:!1===i.bottom?this.height:r.bottom+i.bottom}),t.controller.draw(),n&&ce(e),o.cancelable=!1,this.notifyPlugins("afterDatasetDraw",o))}isPointInArea(t){return se(t,this.chartArea,this._minPadding)}getElementsAtEventForMode(t,e,i,n){const r=Mn.modes[e];return"function"==typeof r?r(this,t,i,n):[]}getDatasetMeta(t){const e=this.data.datasets[t],i=this._metasets;let n=i.filter(t=>t&&t._dataset===e).pop();return n||(n={type:null,data:[],dataset:null,controller:null,hidden:null,xAxisID:null,yAxisID:null,order:e&&e.order||0,index:t,_dataset:e,_parsed:[],_sorted:!1},i.push(n)),n}getContext(){return this.$context||(this.$context=Me(null,{chart:this,type:"chart"}))}getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(t){const e=this.data.datasets[t];if(!e)return!1;const i=this.getDatasetMeta(t);return"boolean"==typeof i.hidden?!i.hidden:!e.hidden}setDatasetVisibility(t,e){this.getDatasetMeta(t).hidden=!e}toggleDataVisibility(t){this._hiddenIndices[t]=!this._hiddenIndices[t]}getDataVisibility(t){return!this._hiddenIndices[t]}_updateVisibility(t,e,i){const n=i?"show":"hide",r=this.getDatasetMeta(t),o=r.controller._resolveAnimations(void 0,n);S(e)?(r.data[e].hidden=!i,this.update()):(this.setDatasetVisibility(t,i),o.update(r,{visible:i}),this.update(e=>e.datasetIndex===t?n:void 0))}hide(t,e){this._updateVisibility(t,e,!1)}show(t,e){this._updateVisibility(t,e,!0)}_destroyDatasetMeta(t){const e=this._metasets[t];e&&e.controller&&e.controller._destroy(),delete this._metasets[t]}_stop(){let t,e;for(this.stop(),vi.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(),re(t,e),this.platform.releaseContext(e),this.canvas=null,this.ctx=null),this.notifyPlugins("destroy"),delete wr[this.id],this.notifyPlugins("afterDestroy")}toBase64Image(...t){return this.canvas.toDataURL(...t)}bindEvents(){this.bindUserEvents(),this.options.responsive?this.bindResponsiveEvents():this.attached=!0}bindUserEvents(){const t=this._listeners,e=this.platform,i=(i,n)=>{e.addEventListener(this,i,n),t[i]=n},n=(t,e,i)=>{t.offsetX=e,t.offsetY=i,this._eventHandler(t)};f(this.options.events,t=>i(t,n))}bindResponsiveEvents(){this._responsiveListeners||(this._responsiveListeners={});const t=this._responsiveListeners,e=this.platform,i=(i,n)=>{e.addEventListener(this,i,n),t[i]=n},n=(i,n)=>{t[i]&&(e.removeEventListener(this,i,n),delete t[i])},r=(t,e)=>{this.canvas&&this.resize(t,e)};let o;const a=()=>{n("attach",a),this.attached=!0,this.resize(),i("resize",r),i("detach",o)};o=()=>{this.attached=!1,n("resize",r),this._stop(),this._resize(0,0),i("attach",a)},e.isAttached(this.canvas)?a():o()}unbindEvents(){f(this._listeners,(t,e)=>{this.platform.removeEventListener(this,e,t)}),this._listeners={},f(this._responsiveListeners,(t,e)=>{this.platform.removeEventListener(this,e,t)}),this._responsiveListeners=void 0}updateHoverStyle(t,e,i){const n=i?"set":"remove";let r,o,a,s;for("dataset"===e&&(r=this.getDatasetMeta(t[0].datasetIndex),r.controller["_"+n+"DatasetHoverStyle"]()),a=0,s=t.length;a<s;++a){o=t[a];const e=o&&this.getDatasetMeta(o.datasetIndex).controller;e&&e[n+"HoverStyle"](o.element,o.datasetIndex,o.index)}}getActiveElements(){return this._active||[]}setActiveElements(t){const e=this._active||[],i=t.map(({datasetIndex:t,index:e})=>{const i=this.getDatasetMeta(t);if(!i)throw new Error("No dataset found at index "+t);return{datasetIndex:t,element:i.data[e],index:e}});!p(i,e)&&(this._active=i,this._lastEvent=null,this._updateHoverStyles(i,e))}notifyPlugins(t,e,i){return this._plugins.notify(this,t,e,i)}_updateHoverStyles(t,e,i){const n=this.options.hover,r=(t,e)=>t.filter(t=>!e.some(e=>t.datasetIndex===e.datasetIndex&&t.index===e.index)),o=r(e,t),a=i?t:r(t,e);o.length&&this.updateHoverStyle(o,n.mode,!1),a.length&&n.mode&&this.updateHoverStyle(a,n.mode,!0)}_eventHandler(t,e){const i={event:t,replay:e,cancelable:!0,inChartArea:this.isPointInArea(t)},n=e=>(e.options.events||this.options.events).includes(t.native.type);if(!1===this.notifyPlugins("beforeEvent",i,n))return;const r=this._handleEvent(t,e,i.inChartArea);return i.cancelable=!1,this.notifyPlugins("afterEvent",i,n),(r||i.changed)&&this.render(),this}_handleEvent(t,e,i){const{_active:n=[],options:r}=this,o=e,a=this._getActiveElements(t,n,i,o),s=function(t){return"mouseup"===t.type||"click"===t.type||"contextmenu"===t.type}(t),l=function(t,e,i,n){return i&&"mouseout"!==t.type?n?e:t:null}(t,this._lastEvent,i,s);i&&(this._lastEvent=null,d(r.onHover,[t,a,this],this),s&&d(r.onClick,[t,a,this],this));const c=!p(a,n);return(c||e)&&(this._active=a,this._updateHoverStyles(a,n,e)),this._lastEvent=l,c}_getActiveElements(t,e,i,n){if("mouseout"===t.type)return[];if(!i)return e;const r=this.options.hover;return this.getElementsAtEventForMode(t,r.mode,r,n)}}const Dr=()=>f(Mr.instances,t=>t._plugins.invalidate()),Pr=!0;function Tr(t,e,i){const{startAngle:n,pixelMargin:r,x:o,y:a,outerRadius:s,innerRadius:l}=e;let c=r/s;t.beginPath(),t.arc(o,a,s,n-c,i+c),l>r?(c=r/l,t.arc(o,a,l,i+c,n-c,!0)):t.arc(o,a,r,i+A,n-A),t.closePath(),t.clip()}function Cr(t,e,i,n){const r=xe(t.options.borderRadius,["outerStart","outerEnd","innerStart","innerEnd"]);const o=(i-e)/2,a=Math.min(o,n*e/2),s=t=>{const e=(i-Math.min(o,t))*n/2;return X(t,0,Math.min(o,e))};return{outerStart:s(r.outerStart),outerEnd:s(r.outerEnd),innerStart:X(r.innerStart,0,a),innerEnd:X(r.innerEnd,0,a)}}function Er(t,e,i,n){return{x:i+t*Math.cos(e),y:n+t*Math.sin(e)}}function Or(t,e,i,n,r,o){const{x:a,y:s,startAngle:l,pixelMargin:c,innerRadius:h}=e,u=Math.max(e.outerRadius+n+i-c,0),d=h>0?h+n+i+c:0;let f=0;const p=r-l;if(n){const t=((h>0?h-n:0)+(u>0?u-n:0))/2;f=(p-(0!==t?p*t/(t+n):p))/2}const g=(p-Math.max(.001,p*u-i/P)/u)/2,m=l+g+f,b=r-g-f,{outerStart:y,outerEnd:x,innerStart:v,innerEnd:_}=Cr(e,d,u,b-m),w=u-y,k=u-x,S=m+y/w,M=b-x/k,D=d+v,T=d+_,C=m+v/D,E=b-_/T;if(t.beginPath(),o){if(t.arc(a,s,u,S,M),x>0){const e=Er(k,M,a,s);t.arc(e.x,e.y,x,M,b+A)}const e=Er(T,b,a,s);if(t.lineTo(e.x,e.y),_>0){const e=Er(T,E,a,s);t.arc(e.x,e.y,_,b+A,E+Math.PI)}if(t.arc(a,s,d,b-_/d,m+v/d,!0),v>0){const e=Er(D,C,a,s);t.arc(e.x,e.y,v,C+Math.PI,m-A)}const i=Er(w,m,a,s);if(t.lineTo(i.x,i.y),y>0){const e=Er(w,S,a,s);t.arc(e.x,e.y,y,m-A,S)}}else{t.moveTo(a,s);const e=Math.cos(S)*u+a,i=Math.sin(S)*u+s;t.lineTo(e,i);const n=Math.cos(M)*u+a,r=Math.sin(M)*u+s;t.lineTo(n,r)}t.closePath()}function Ar(t,e,i,n,r,o){const{options:a}=e,{borderWidth:s,borderJoinStyle:l}=a,c="inner"===a.borderAlign;s&&(c?(t.lineWidth=2*s,t.lineJoin=l||"round"):(t.lineWidth=s,t.lineJoin=l||"bevel"),e.fullCircles&&function(t,e,i){const{x:n,y:r,startAngle:o,pixelMargin:a,fullCircles:s}=e,l=Math.max(e.outerRadius-a,0),c=e.innerRadius+a;let h;for(i&&Tr(t,e,o+T),t.beginPath(),t.arc(n,r,c,o+T,o,!0),h=0;h<s;++h)t.stroke();for(t.beginPath(),t.arc(n,r,l,o,o+T),h=0;h<s;++h)t.stroke()}(t,e,c),c&&Tr(t,e,r),Or(t,e,i,n,r,o),t.stroke())}Object.defineProperties(Mr,{defaults:{enumerable:Pr,value:te},instances:{enumerable:Pr,value:wr},overrides:{enumerable:Pr,value:Zt},registry:{enumerable:Pr,value:fn},version:{enumerable:Pr,value:"3.9.1"},getChart:{enumerable:Pr,value:kr},register:{enumerable:Pr,value:(...t)=>{fn.add(...t),Dr()}},unregister:{enumerable:Pr,value:(...t)=>{fn.remove(...t),Dr()}}});class Lr extends Ki{constructor(t){super(),this.options=void 0,this.circumference=void 0,this.startAngle=void 0,this.endAngle=void 0,this.innerRadius=void 0,this.outerRadius=void 0,this.pixelMargin=0,this.fullCircles=0,t&&Object.assign(this,t)}inRange(t,e,i){const n=this.getProps(["x","y"],i),{angle:r,distance:o}=q(n,{x:t,y:e}),{startAngle:a,endAngle:s,innerRadius:l,outerRadius:c,circumference:u}=this.getProps(["startAngle","endAngle","innerRadius","outerRadius","circumference"],i),d=this.options.spacing/2,f=h(u,s-a)>=T||G(r,a,s),p=Z(o,l+d,c+d);return f&&p}getCenterPoint(t){const{x:e,y:i,startAngle:n,endAngle:r,innerRadius:o,outerRadius:a}=this.getProps(["x","y","startAngle","endAngle","innerRadius","outerRadius","circumference"],t),{offset:s,spacing:l}=this.options,c=(n+r)/2,h=(o+a+l+s)/2;return{x:e+Math.cos(c)*h,y:i+Math.sin(c)*h}}tooltipPosition(t){return this.getCenterPoint(t)}draw(t){const{options:e,circumference:i}=this,n=(e.offset||0)/2,r=(e.spacing||0)/2,o=e.circular;if(this.pixelMargin="inner"===e.borderAlign?.33:0,this.fullCircles=i>T?Math.floor(i/T):0,0===i||this.innerRadius<0||this.outerRadius<0)return;t.save();let a=0;if(n){a=n/2;const e=(this.startAngle+this.endAngle)/2;t.translate(Math.cos(e)*a,Math.sin(e)*a),this.circumference>=P&&(a=n)}t.fillStyle=e.backgroundColor,t.strokeStyle=e.borderColor;const s=function(t,e,i,n,r){const{fullCircles:o,startAngle:a,circumference:s}=e;let l=e.endAngle;if(o){Or(t,e,i,n,a+T,r);for(let e=0;e<o;++e)t.fill();isNaN(s)||(l=a+s%T,s%T===0&&(l+=T))}return Or(t,e,i,n,l,r),t.fill(),l}(t,this,a,r,o);Ar(t,this,a,r,s,o),t.restore()}}function Ir(t,e,i=e){t.lineCap=h(i.borderCapStyle,e.borderCapStyle),t.setLineDash(h(i.borderDash,e.borderDash)),t.lineDashOffset=h(i.borderDashOffset,e.borderDashOffset),t.lineJoin=h(i.borderJoinStyle,e.borderJoinStyle),t.lineWidth=h(i.borderWidth,e.borderWidth),t.strokeStyle=h(i.borderColor,e.borderColor)}function Fr(t,e,i){t.lineTo(i.x,i.y)}function Rr(t,e,i={}){const n=t.length,{start:r=0,end:o=n-1}=i,{start:a,end:s}=e,l=Math.max(r,a),c=Math.min(o,s),h=r<a&&o<a||r>s&&o>s;return{count:n,start:l,loop:e.loop,ilen:c<l&&!h?n+c-l:c-l}}function zr(t,e,i,n){const{points:r,options:o}=e,{count:a,start:s,loop:l,ilen:c}=Rr(r,i,n),h=function(t){return t.stepped?he:t.tension||"monotone"===t.cubicInterpolationMode?ue:Fr}(o);let u,d,f,{move:p=!0,reverse:g}=n||{};for(u=0;u<=c;++u)d=r[(s+(g?c-u:u))%a],d.skip||(p?(t.moveTo(d.x,d.y),p=!1):h(t,f,d,g,o.stepped),f=d);return l&&(d=r[(s+(g?c:0))%a],h(t,f,d,g,o.stepped)),!!l}function jr(t,e,i,n){const r=e.points,{count:o,start:a,ilen:s}=Rr(r,i,n),{move:l=!0,reverse:c}=n||{};let h,u,d,f,p,g,m=0,b=0;const y=t=>(a+(c?s-t:t))%o,x=()=>{f!==p&&(t.lineTo(m,p),t.lineTo(m,f),t.lineTo(m,g))};for(l&&(u=r[y(0)],t.moveTo(u.x,u.y)),h=0;h<=s;++h){if(u=r[y(h)],u.skip)continue;const e=u.x,i=u.y,n=0|e;n===d?(i<f?f=i:i>p&&(p=i),m=(b*m+e)/++b):(x(),t.lineTo(e,i),d=n,b=0,f=p=i),g=i}x()}function Br(t){const e=t.options,i=e.borderDash&&e.borderDash.length;return!(t._decimated||t._loop||e.tension||"monotone"===e.cubicInterpolationMode||e.stepped||i)?jr:zr}Lr.id="arc",Lr.defaults={borderAlign:"center",borderColor:"#fff",borderJoinStyle:void 0,borderRadius:0,borderWidth:2,offset:0,spacing:0,angle:void 0,circular:!0},Lr.defaultRoutes={backgroundColor:"backgroundColor"};const Wr="function"==typeof Path2D;function Nr(t,e,i,n){Wr&&!e.options.segment?function(t,e,i,n){let r=e._path;r||(r=e._path=new Path2D,e.path(r,i,n)&&r.closePath()),Ir(t,e.options),t.stroke(r)}(t,e,i,n):function(t,e,i,n){const{segments:r,options:o}=e,a=Br(e);for(const s of r)Ir(t,o,s.style),t.beginPath(),a(t,e,s,{start:i,end:i+n-1})&&t.closePath(),t.stroke()}(t,e,i,n)}class Vr extends Ki{constructor(t){super(),this.animated=!0,this.options=void 0,this._chart=void 0,this._loop=void 0,this._fullLoop=void 0,this._path=void 0,this._points=void 0,this._segments=void 0,this._decimated=!1,this._pointsUpdated=!1,this._datasetIndex=void 0,t&&Object.assign(this,t)}updateControlPoints(t,e){const i=this.options;if((i.tension||"monotone"===i.cubicInterpolationMode)&&!i.stepped&&!this._pointsUpdated){const n=i.spanGaps?this._loop:this._fullLoop;Ue(this._points,i,t,n,e),this._pointsUpdated=!0}}set points(t){this._points=t,delete this._segments,delete this._path,this._pointsUpdated=!1}get points(){return this._points}get segments(){return this._segments||(this._segments=function(t,e){const i=t.points,n=t.options.spanGaps,r=i.length;if(!r)return[];const o=!!t._loop,{start:a,end:s}=function(t,e,i,n){let r=0,o=e-1;if(i&&!n)for(;r<e&&!t[r].skip;)r++;for(;r<e&&t[r].skip;)r++;for(r%=e,i&&(o+=r);o>r&&t[o%e].skip;)o--;return o%=e,{start:r,end:o}}(i,r,o,n);return bi(t,!0===n?[{start:a,end:s,loop:o}]:function(t,e,i,n){const r=t.length,o=[];let a,s=e,l=t[e];for(a=e+1;a<=i;++a){const i=t[a%r];i.skip||i.stop?l.skip||(n=!1,o.push({start:e%r,end:(a-1)%r,loop:n}),e=s=i.stop?a:null):(s=a,l.skip&&(e=a)),l=i}return null!==s&&o.push({start:e%r,end:s%r,loop:n}),o}(i,a,s<a?s+r:s,!!t._fullLoop&&0===a&&s===r-1),i,e)}(this,this.options.segment))}first(){const t=this.segments,e=this.points;return t.length&&e[t[0].start]}last(){const t=this.segments,e=this.points,i=t.length;return i&&e[t[i-1].end]}interpolate(t,e){const i=this.options,n=t[e],r=this.points,o=mi(this,{property:e,start:n,end:n});if(!o.length)return;const a=[],s=function(t){return t.stepped?ai:t.tension||"monotone"===t.cubicInterpolationMode?si:oi}(i);let l,c;for(l=0,c=o.length;l<c;++l){const{start:c,end:h}=o[l],u=r[c],d=r[h];if(u===d){a.push(u);continue}const f=s(u,d,Math.abs((n-u[e])/(d[e]-u[e])),i.stepped);f[e]=t[e],a.push(f)}return 1===a.length?a[0]:a}pathSegment(t,e,i){return Br(this)(t,this,e,i)}path(t,e,i){const n=this.segments,r=Br(this);let o=this._loop;e=e||0,i=i||this.points.length-e;for(const a of n)o&=r(t,this,a,{start:e,end:e+i-1});return!!o}draw(t,e,i,n){const r=this.options||{};(this.points||[]).length&&r.borderWidth&&(t.save(),Nr(t,this,i,n),t.restore()),this.animated&&(this._pointsUpdated=!1,this._path=void 0)}}function Hr(t,e,i,n){const r=t.options,{[i]:o}=t.getProps([i],n);return Math.abs(e-o)<r.radius+r.hitRadius}Vr.id="line",Vr.defaults={borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderWidth:3,capBezierPoints:!0,cubicInterpolationMode:"default",fill:!1,spanGaps:!1,stepped:!1,tension:0},Vr.defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"},Vr.descriptors={_scriptable:!0,_indexable:t=>"borderDash"!==t&&"fill"!==t};class qr extends Ki{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 n=this.options,{x:r,y:o}=this.getProps(["x","y"],i);return Math.pow(t-r,2)+Math.pow(e-o,2)<Math.pow(n.hitRadius+n.radius,2)}inXRange(t,e){return Hr(this,t,"x",e)}inYRange(t,e){return Hr(this,t,"y",e)}getCenterPoint(t){const{x:e,y:i}=this.getProps(["x","y"],t);return{x:e,y:i}}size(t){let e=(t=t||this.options||{}).radius||0;e=Math.max(e,e&&t.hoverRadius||0);return 2*(e+(e&&t.borderWidth||0))}draw(t,e){const i=this.options;this.skip||i.radius<.1||!se(this,e,this.size(i)/2)||(t.strokeStyle=i.borderColor,t.lineWidth=i.borderWidth,t.fillStyle=i.backgroundColor,oe(t,i,this.x,this.y))}getRange(){const t=this.options||{};return t.radius+t.hitRadius}}function $r(t,e){const{x:i,y:n,base:r,width:o,height:a}=t.getProps(["x","y","base","width","height"],e);let s,l,c,h,u;return t.horizontal?(u=a/2,s=Math.min(i,r),l=Math.max(i,r),c=n-u,h=n+u):(u=o/2,s=i-u,l=i+u,c=Math.min(n,r),h=Math.max(n,r)),{left:s,top:c,right:l,bottom:h}}function Ur(t,e,i,n){return t?0:X(e,i,n)}function Yr(t){const e=$r(t),i=e.right-e.left,n=e.bottom-e.top,r=function(t,e,i){const n=t.options.borderWidth,r=t.borderSkipped,o=ve(n);return{t:Ur(r.top,o.top,0,i),r:Ur(r.right,o.right,0,e),b:Ur(r.bottom,o.bottom,0,i),l:Ur(r.left,o.left,0,e)}}(t,i/2,n/2),o=function(t,e,i){const{enableBorderRadius:n}=t.getProps(["enableBorderRadius"]),r=t.options.borderRadius,o=_e(r),a=Math.min(e,i),l=t.borderSkipped,c=n||s(r);return{topLeft:Ur(!c||l.top||l.left,o.topLeft,0,a),topRight:Ur(!c||l.top||l.right,o.topRight,0,a),bottomLeft:Ur(!c||l.bottom||l.left,o.bottomLeft,0,a),bottomRight:Ur(!c||l.bottom||l.right,o.bottomRight,0,a)}}(t,i/2,n/2);return{outer:{x:e.left,y:e.top,w:i,h:n,radius:o},inner:{x:e.left+r.l,y:e.top+r.t,w:i-r.l-r.r,h:n-r.t-r.b,radius:{topLeft:Math.max(0,o.topLeft-Math.max(r.t,r.l)),topRight:Math.max(0,o.topRight-Math.max(r.t,r.r)),bottomLeft:Math.max(0,o.bottomLeft-Math.max(r.b,r.l)),bottomRight:Math.max(0,o.bottomRight-Math.max(r.b,r.r))}}}}function Gr(t,e,i,n){const r=null===e,o=null===i,a=t&&!(r&&o)&&$r(t,n);return a&&(r||Z(e,a.left,a.right))&&(o||Z(i,a.top,a.bottom))}function Xr(t,e){t.rect(e.x,e.y,e.w,e.h)}function Zr(t,e,i={}){const n=t.x!==i.x?-e:0,r=t.y!==i.y?-e:0,o=(t.x+t.w!==i.x+i.w?e:0)-n,a=(t.y+t.h!==i.y+i.h?e:0)-r;return{x:t.x+n,y:t.y+r,w:t.w+o,h:t.h+a,radius:t.radius}}qr.id="point",qr.defaults={borderWidth:1,hitRadius:1,hoverBorderWidth:1,hoverRadius:4,pointStyle:"circle",radius:3,rotation:0},qr.defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};class Qr extends Ki{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:n}}=this,{inner:r,outer:o}=Yr(this),a=(s=o.radius).topLeft||s.topRight||s.bottomLeft||s.bottomRight?pe:Xr;var s;t.save(),o.w===r.w&&o.h===r.h||(t.beginPath(),a(t,Zr(o,e,r)),t.clip(),a(t,Zr(r,-e,o)),t.fillStyle=i,t.fill("evenodd")),t.beginPath(),a(t,Zr(r,e)),t.fillStyle=n,t.fill(),t.restore()}inRange(t,e,i){return Gr(this,t,e,i)}inXRange(t,e){return Gr(this,t,null,e)}inYRange(t,e){return Gr(this,null,t,e)}getCenterPoint(t){const{x:e,y:i,base:n,horizontal:r}=this.getProps(["x","y","base","horizontal"],t);return{x:r?(e+n)/2:e,y:r?i:(i+n)/2}}getRange(t){return"x"===t?this.width/2:this.height/2}}Qr.id="bar",Qr.defaults={borderSkipped:"start",borderWidth:0,borderRadius:0,inflateAmount:"auto",pointStyle:void 0},Qr.defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};var Jr=Object.freeze({__proto__:null,ArcElement:Lr,LineElement:Vr,PointElement:qr,BarElement:Qr});function Kr(t){if(t._decimated){const e=t._data;delete t._decimated,delete t._data,Object.defineProperty(t,"data",{value:e})}}function to(t){t.data.datasets.forEach(t=>{Kr(t)})}var eo={id:"decimation",defaults:{algorithm:"min-max",enabled:!1},beforeElementsUpdate:(t,e,i)=>{if(!i.enabled)return void to(t);const n=t.width;t.data.datasets.forEach((e,r)=>{const{_data:a,indexAxis:s}=e,l=t.getDatasetMeta(r),c=a||e.data;if("y"===Se([s,t.options.indexAxis]))return;if(!l.controller.supportsDecimation)return;const h=t.scales[l.xAxisID];if("linear"!==h.type&&"time"!==h.type)return;if(t.options.parsing)return;let{start:u,count:d}=function(t,e){const i=e.length;let n,r=0;const{iScale:o}=t,{min:a,max:s,minDefined:l,maxDefined:c}=o.getUserBounds();return l&&(r=X(J(e,o.axis,a).lo,0,i-1)),n=c?X(J(e,o.axis,s).hi+1,r,i)-r:i-r,{start:r,count:n}}(l,c);if(d<=(i.threshold||4*n))return void Kr(e);let f;switch(o(a)&&(e._data=c,delete e.data,Object.defineProperty(e,"data",{configurable:!0,enumerable:!0,get:function(){return this._decimated},set:function(t){this._data=t}})),i.algorithm){case"lttb":f=function(t,e,i,n,r){const o=r.samples||n;if(o>=i)return t.slice(e,e+i);const a=[],s=(i-2)/(o-2);let l=0;const c=e+i-1;let h,u,d,f,p,g=e;for(a[l++]=t[g],h=0;h<o-2;h++){let n,r=0,o=0;const c=Math.floor((h+1)*s)+1+e,m=Math.min(Math.floor((h+2)*s)+1,i)+e,b=m-c;for(n=c;n<m;n++)r+=t[n].x,o+=t[n].y;r/=b,o/=b;const y=Math.floor(h*s)+1+e,x=Math.min(Math.floor((h+1)*s)+1,i)+e,{x:v,y:_}=t[g];for(d=f=-1,n=y;n<x;n++)f=.5*Math.abs((v-r)*(t[n].y-_)-(v-t[n].x)*(o-_)),f>d&&(d=f,u=t[n],p=n);a[l++]=u,g=p}return a[l++]=t[c],a}(c,u,d,n,i);break;case"min-max":f=function(t,e,i,n){let r,a,s,l,c,h,u,d,f,p,g=0,m=0;const b=[],y=e+i-1,x=t[e].x,v=t[y].x-x;for(r=e;r<e+i;++r){a=t[r],s=(a.x-x)/v*n,l=a.y;const e=0|s;if(e===c)l<f?(f=l,h=r):l>p&&(p=l,u=r),g=(m*g+a.x)/++m;else{const i=r-1;if(!o(h)&&!o(u)){const e=Math.min(h,u),n=Math.max(h,u);e!==d&&e!==i&&b.push({...t[e],x:g}),n!==d&&n!==i&&b.push({...t[n],x:g})}r>0&&i!==d&&b.push(t[i]),b.push(a),c=e,m=0,f=p=l,h=u=d=r}}return b}(c,u,d,n);break;default:throw new Error(`Unsupported decimation algorithm '${i.algorithm}'`)}e._decimated=f})},destroy(t){to(t)}};function io(t,e,i,n){if(n)return;let r=e[t],o=i[t];return"angle"===t&&(r=Y(r),o=Y(o)),{property:t,start:r,end:o}}function no(t,e,i){for(;e>t;e--){const t=i[e];if(!isNaN(t.x)&&!isNaN(t.y))break}return e}function ro(t,e,i,n){return t&&e?n(t[i],e[i]):t?t[i]:e?e[i]:0}function oo(t,e){let i=[],n=!1;return a(t)?(n=!0,i=t):i=function(t,e){const{x:i=null,y:n=null}=t||{},r=e.points,o=[];return e.segments.forEach(({start:t,end:e})=>{e=no(t,e,r);const a=r[t],s=r[e];null!==n?(o.push({x:a.x,y:n}),o.push({x:s.x,y:n})):null!==i&&(o.push({x:i,y:a.y}),o.push({x:i,y:s.y}))}),o}(t,e),i.length?new Vr({points:i,options:{tension:0},_loop:n,_fullLoop:n}):null}function ao(t){return t&&!1!==t.fill}function so(t,e,i){let n=t[e].fill;const r=[e];let o;if(!i)return n;for(;!1!==n&&-1===r.indexOf(n);){if(!l(n))return n;if(o=t[n],!o)return!1;if(o.visible)return n;r.push(n),n=o.fill}return!1}function lo(t,e,i){const n=function(t){const e=t.options,i=e.fill;let n=h(i&&i.target,i);void 0===n&&(n=!!e.backgroundColor);if(!1===n||null===n)return!1;if(!0===n)return"origin";return n}(t);if(s(n))return!isNaN(n.value)&&n;let r=parseFloat(n);return l(r)&&Math.floor(r)===r?function(t,e,i,n){"-"!==t&&"+"!==t||(i=e+i);if(i===e||i<0||i>=n)return!1;return i}(n[0],e,r,i):["origin","start","end","stack","shape"].indexOf(n)>=0&&n}function co(t,e,i){const n=[];for(let r=0;r<i.length;r++){const o=i[r],{first:a,last:s,point:l}=ho(o,e,"x");if(!(!l||a&&s))if(a)n.unshift(l);else if(t.push(l),!s)break}t.push(...n)}function ho(t,e,i){const n=t.interpolate(e,i);if(!n)return{};const r=n[i],o=t.segments,a=t.points;let s=!1,l=!1;for(let t=0;t<o.length;t++){const e=o[t],n=a[e.start][i],c=a[e.end][i];if(Z(r,n,c)){s=r===n,l=r===c;break}}return{first:s,last:l,point:n}}class uo{constructor(t){this.x=t.x,this.y=t.y,this.radius=t.radius}pathSegment(t,e,i){const{x:n,y:r,radius:o}=this;return e=e||{start:0,end:T},t.arc(n,r,o,e.end,e.start,!0),!i.bounds}interpolate(t){const{x:e,y:i,radius:n}=this,r=t.angle;return{x:e+Math.cos(r)*n,y:i+Math.sin(r)*n,angle:r}}}function fo(t){const{chart:e,fill:i,line:n}=t;if(l(i))return function(t,e){const i=t.getDatasetMeta(e),n=i&&t.isDatasetVisible(e);return n?i.dataset:null}(e,i);if("stack"===i)return function(t){const{scale:e,index:i,line:n}=t,r=[],o=n.segments,a=n.points,s=function(t,e){const i=[],n=t.getMatchingVisibleMetas("line");for(let t=0;t<n.length;t++){const r=n[t];if(r.index===e)break;r.hidden||i.unshift(r.dataset)}return i}(e,i);s.push(oo({x:null,y:e.bottom},n));for(let t=0;t<o.length;t++){const e=o[t];for(let t=e.start;t<=e.end;t++)co(r,a[t],s)}return new Vr({points:r,options:{}})}(t);if("shape"===i)return!0;const r=function(t){const e=t.scale||{};if(e.getPointPositionForValue)return function(t){const{scale:e,fill:i}=t,n=e.options,r=e.getLabels().length,o=n.reverse?e.max:e.min,a=function(t,e,i){let n;return n="start"===t?i:"end"===t?e.options.reverse?e.min:e.max:s(t)?t.value:e.getBaseValue(),n}(i,e,o),l=[];if(n.grid.circular){const t=e.getPointPositionForValue(0,o);return new uo({x:t.x,y:t.y,radius:e.getDistanceFromCenterForValue(a)})}for(let t=0;t<r;++t)l.push(e.getPointPositionForValue(t,a));return l}(t);return function(t){const{scale:e={},fill:i}=t,n=function(t,e){let i=null;return"start"===t?i=e.bottom:"end"===t?i=e.top:s(t)?i=e.getPixelForValue(t.value):e.getBasePixel&&(i=e.getBasePixel()),i}(i,e);if(l(n)){const t=e.isHorizontal();return{x:t?n:null,y:t?null:n}}return null}(t)}(t);return r instanceof uo?r:oo(r,n)}function po(t,e,i){const n=fo(e),{line:r,scale:o,axis:a}=e,s=r.options,l=s.fill,c=s.backgroundColor,{above:h=c,below:u=c}=l||{};n&&r.points.length&&(le(t,i),function(t,e){const{line:i,target:n,above:r,below:o,area:a,scale:s}=e,l=i._loop?"angle":e.axis;t.save(),"x"===l&&o!==r&&(go(t,n,a.top),mo(t,{line:i,target:n,color:r,scale:s,property:l}),t.restore(),t.save(),go(t,n,a.bottom));mo(t,{line:i,target:n,color:o,scale:s,property:l}),t.restore()}(t,{line:r,target:n,above:h,below:u,area:i,scale:o,axis:a}),ce(t))}function go(t,e,i){const{segments:n,points:r}=e;let o=!0,a=!1;t.beginPath();for(const s of n){const{start:n,end:l}=s,c=r[n],h=r[no(n,l,r)];o?(t.moveTo(c.x,c.y),o=!1):(t.lineTo(c.x,i),t.lineTo(c.x,c.y)),a=!!e.pathSegment(t,s,{move:a}),a?t.closePath():t.lineTo(h.x,i)}t.lineTo(e.first().x,i),t.closePath(),t.clip()}function mo(t,e){const{line:i,target:n,property:r,color:o,scale:a}=e,s=function(t,e,i){const n=t.segments,r=t.points,o=e.points,a=[];for(const t of n){let{start:n,end:s}=t;s=no(n,s,r);const l=io(i,r[n],r[s],t.loop);if(!e.segments){a.push({source:t,target:l,start:r[n],end:r[s]});continue}const c=mi(e,l);for(const e of c){const n=io(i,o[e.start],o[e.end],e.loop),s=gi(t,r,n);for(const t of s)a.push({source:t,target:e,start:{[i]:ro(l,n,"start",Math.max)},end:{[i]:ro(l,n,"end",Math.min)}})}}return a}(i,n,r);for(const{source:e,target:l,start:c,end:h}of s){const{style:{backgroundColor:s=o}={}}=e,u=!0!==n;t.save(),t.fillStyle=s,bo(t,a,u&&io(r,c,h)),t.beginPath();const d=!!i.pathSegment(t,e);let f;if(u){d?t.closePath():yo(t,n,h,r);const e=!!n.pathSegment(t,l,{move:d,reverse:!0});f=d&&e,f||yo(t,n,c,r)}t.closePath(),t.fill(f?"evenodd":"nonzero"),t.restore()}}function bo(t,e,i){const{top:n,bottom:r}=e.chart.chartArea,{property:o,start:a,end:s}=i||{};"x"===o&&(t.beginPath(),t.rect(a,n,s-a,r-n),t.clip())}function yo(t,e,i,n){const r=e.interpolate(i,n);r&&t.lineTo(r.x,r.y)}var xo={id:"filler",afterDatasetsUpdate(t,e,i){const n=(t.data.datasets||[]).length,r=[];let o,a,s,l;for(a=0;a<n;++a)o=t.getDatasetMeta(a),s=o.dataset,l=null,s&&s.options&&s instanceof Vr&&(l={visible:t.isDatasetVisible(a),index:a,fill:lo(s,a,n),chart:t,axis:o.controller.options.indexAxis,scale:o.vScale,line:s}),o.$filler=l,r.push(l);for(a=0;a<n;++a)l=r[a],l&&!1!==l.fill&&(l.fill=so(r,a,i.propagate))},beforeDraw(t,e,i){const n="beforeDraw"===i.drawTime,r=t.getSortedVisibleDatasetMetas(),o=t.chartArea;for(let e=r.length-1;e>=0;--e){const i=r[e].$filler;i&&(i.line.updateControlPoints(o,i.axis),n&&i.fill&&po(t.ctx,i,o))}},beforeDatasetsDraw(t,e,i){if("beforeDatasetsDraw"!==i.drawTime)return;const n=t.getSortedVisibleDatasetMetas();for(let e=n.length-1;e>=0;--e){const i=n[e].$filler;ao(i)&&po(t.ctx,i,t.chartArea)}},beforeDatasetDraw(t,e,i){const n=e.meta.$filler;ao(n)&&"beforeDatasetDraw"===i.drawTime&&po(t.ctx,n,t.chartArea)},defaults:{propagate:!0,drawTime:"beforeDatasetDraw"}};const vo=(t,e)=>{let{boxHeight:i=e,boxWidth:n=e}=t;return t.usePointStyle&&(i=Math.min(i,e),n=t.pointStyleWidth||Math.min(n,e)),{boxWidth:n,boxHeight:i,itemHeight:Math.max(e,i)}};class _o extends Ki{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=d(t.generateLabels,[this.chart],this)||[];t.filter&&(e=e.filter(e=>t.filter(e,this.chart.data))),t.sort&&(e=e.sort((e,i)=>t.sort(e,i,this.chart.data))),this.options.reverse&&e.reverse(),this.legendItems=e}fit(){const{options:t,ctx:e}=this;if(!t.display)return void(this.width=this.height=0);const i=t.labels,n=ke(i.font),r=n.size,o=this._computeTitleHeight(),{boxWidth:a,itemHeight:s}=vo(i,r);let l,c;e.font=n.string,this.isHorizontal()?(l=this.maxWidth,c=this._fitRows(o,r,a,s)+10):(c=this.maxHeight,l=this._fitCols(o,r,a,s)+10),this.width=Math.min(l,t.maxWidth||this.maxWidth),this.height=Math.min(c,t.maxHeight||this.maxHeight)}_fitRows(t,e,i,n){const{ctx:r,maxWidth:o,options:{labels:{padding:a}}}=this,s=this.legendHitBoxes=[],l=this.lineWidths=[0],c=n+a;let h=t;r.textAlign="left",r.textBaseline="middle";let u=-1,d=-c;return this.legendItems.forEach((t,f)=>{const p=i+e/2+r.measureText(t.text).width;(0===f||l[l.length-1]+p+2*a>o)&&(h+=c,l[l.length-(f>0?0:1)]=0,d+=c,u++),s[f]={left:0,top:d,row:u,width:p,height:n},l[l.length-1]+=p+a}),h}_fitCols(t,e,i,n){const{ctx:r,maxHeight:o,options:{labels:{padding:a}}}=this,s=this.legendHitBoxes=[],l=this.columnSizes=[],c=o-t;let h=a,u=0,d=0,f=0,p=0;return this.legendItems.forEach((t,o)=>{const g=i+e/2+r.measureText(t.text).width;o>0&&d+n+2*a>c&&(h+=u+a,l.push({width:u,height:d}),f+=u+a,p++,u=d=0),s[o]={left:f,top:d,col:p,width:g,height:n},u=Math.max(u,g),d+=n+a}),h+=u,l.push({width:u,height:d}),h}adjustHitBoxes(){if(!this.options.display)return;const t=this._computeTitleHeight(),{legendHitBoxes:e,options:{align:i,labels:{padding:n},rtl:r}}=this,o=hi(r,this.left,this.width);if(this.isHorizontal()){let r=0,a=at(i,this.left+n,this.right-this.lineWidths[r]);for(const s of e)r!==s.row&&(r=s.row,a=at(i,this.left+n,this.right-this.lineWidths[r])),s.top+=this.top+t+n,s.left=o.leftForLtr(o.x(a),s.width),a+=s.width+n}else{let r=0,a=at(i,this.top+t+n,this.bottom-this.columnSizes[r].height);for(const s of e)s.col!==r&&(r=s.col,a=at(i,this.top+t+n,this.bottom-this.columnSizes[r].height)),s.top=a,s.left+=this.left+n,s.left=o.leftForLtr(o.x(s.left),s.width),a+=s.height+n}}isHorizontal(){return"top"===this.options.position||"bottom"===this.options.position}draw(){if(this.options.display){const t=this.ctx;le(t,this),this._draw(),ce(t)}}_draw(){const{options:t,columnSizes:e,lineWidths:i,ctx:n}=this,{align:r,labels:o}=t,a=te.color,s=hi(t.rtl,this.left,this.width),l=ke(o.font),{color:c,padding:u}=o,d=l.size,f=d/2;let p;this.drawTitle(),n.textAlign=s.textAlign("left"),n.textBaseline="middle",n.lineWidth=.5,n.font=l.string;const{boxWidth:g,boxHeight:m,itemHeight:b}=vo(o,d),y=this.isHorizontal(),x=this._computeTitleHeight();p=y?{x:at(r,this.left+u,this.right-i[0]),y:this.top+u+x,line:0}:{x:this.left+u,y:at(r,this.top+x+u,this.bottom-e[0].height),line:0},ui(this.ctx,t.textDirection);const v=b+u;this.legendItems.forEach((_,w)=>{n.strokeStyle=_.fontColor||c,n.fillStyle=_.fontColor||c;const k=n.measureText(_.text).width,S=s.textAlign(_.textAlign||(_.textAlign=o.textAlign)),M=g+f+k;let D=p.x,P=p.y;s.setWidth(this.width),y?w>0&&D+M+u>this.right&&(P=p.y+=v,p.line++,D=p.x=at(r,this.left+u,this.right-i[p.line])):w>0&&P+v>this.bottom&&(D=p.x=D+e[p.line].width+u,p.line++,P=p.y=at(r,this.top+x+u,this.bottom-e[p.line].height));!function(t,e,i){if(isNaN(g)||g<=0||isNaN(m)||m<0)return;n.save();const r=h(i.lineWidth,1);if(n.fillStyle=h(i.fillStyle,a),n.lineCap=h(i.lineCap,"butt"),n.lineDashOffset=h(i.lineDashOffset,0),n.lineJoin=h(i.lineJoin,"miter"),n.lineWidth=r,n.strokeStyle=h(i.strokeStyle,a),n.setLineDash(h(i.lineDash,[])),o.usePointStyle){const a={radius:m*Math.SQRT2/2,pointStyle:i.pointStyle,rotation:i.rotation,borderWidth:r},l=s.xPlus(t,g/2);ae(n,a,l,e+f,o.pointStyleWidth&&g)}else{const o=e+Math.max((d-m)/2,0),a=s.leftForLtr(t,g),l=_e(i.borderRadius);n.beginPath(),Object.values(l).some(t=>0!==t)?pe(n,{x:a,y:o,w:g,h:m,radius:l}):n.rect(a,o,g,m),n.fill(),0!==r&&n.stroke()}n.restore()}(s.x(D),P,_),D=((t,e,i,n)=>t===(n?"left":"right")?i:"center"===t?(e+i)/2:e)(S,D+g+f,y?D+M:this.right,t.rtl),function(t,e,i){de(n,i.text,t,e+b/2,l,{strikethrough:i.hidden,textAlign:s.textAlign(i.textAlign)})}(s.x(D),P,_),y?p.x+=M+u:p.y+=v}),di(this.ctx,t.textDirection)}drawTitle(){const t=this.options,e=t.title,i=ke(e.font),n=we(e.padding);if(!e.display)return;const r=hi(t.rtl,this.left,this.width),o=this.ctx,a=e.position,s=i.size/2,l=n.top+s;let c,h=this.left,u=this.width;if(this.isHorizontal())u=Math.max(...this.lineWidths),c=this.top+l,h=at(t.align,h,this.right-u);else{const e=this.columnSizes.reduce((t,e)=>Math.max(t,e.height),0);c=l+at(t.align,this.top,this.bottom-e-t.labels.padding-this._computeTitleHeight())}const d=at(a,h,h+u);o.textAlign=r.textAlign(ot(a)),o.textBaseline="middle",o.strokeStyle=e.color,o.fillStyle=e.color,o.font=i.string,de(o,e.text,d,c,i)}_computeTitleHeight(){const t=this.options.title,e=ke(t.font),i=we(t.padding);return t.display?e.lineHeight+i.height:0}_getLegendItemAt(t,e){let i,n,r;if(Z(t,this.left,this.right)&&Z(e,this.top,this.bottom))for(r=this.legendHitBoxes,i=0;i<r.length;++i)if(n=r[i],Z(t,n.left,n.left+n.width)&&Z(e,n.top,n.top+n.height))return this.legendItems[i];return null}handleEvent(t){const e=this.options;if(!function(t,e){if(("mousemove"===t||"mouseout"===t)&&(e.onHover||e.onLeave))return!0;if(e.onClick&&("click"===t||"mouseup"===t))return!0;return!1}(t.type,e))return;const i=this._getLegendItemAt(t.x,t.y);if("mousemove"===t.type||"mouseout"===t.type){const o=this._hoveredItem,a=(r=i,null!==(n=o)&&null!==r&&n.datasetIndex===r.datasetIndex&&n.index===r.index);o&&!a&&d(e.onLeave,[t,o,this],this),this._hoveredItem=i,i&&!a&&d(e.onHover,[t,i,this],this)}else i&&d(e.onClick,[t,i,this],this);var n,r}}var wo={id:"legend",_element:_o,start(t,e,i){const n=t.legend=new _o({ctx:t.ctx,options:i,chart:t});jn.configure(t,n,i),jn.addBox(t,n)},stop(t){jn.removeBox(t,t.legend),delete t.legend},beforeUpdate(t,e,i){const n=t.legend;jn.configure(t,n,i),n.options=i},afterUpdate(t){const e=t.legend;e.buildLabels(),e.adjustHitBoxes()},afterEvent(t,e){e.replay||t.legend.handleEvent(e.event)},defaults:{display:!0,position:"top",align:"center",fullSize:!0,reverse:!1,weight:1e3,onClick(t,e,i){const n=e.datasetIndex,r=i.chart;r.isDatasetVisible(n)?(r.hide(n),e.hidden=!0):(r.show(n),e.hidden=!1)},onHover:null,onLeave:null,labels:{color:t=>t.chart.options.color,boxWidth:40,padding:10,generateLabels(t){const e=t.data.datasets,{labels:{usePointStyle:i,pointStyle:n,textAlign:r,color:o}}=t.legend.options;return t._getSortedDatasetMetas().map(t=>{const a=t.controller.getStyle(i?0:void 0),s=we(a.borderWidth);return{text:e[t.index].label,fillStyle:a.backgroundColor,fontColor:o,hidden:!t.visible,lineCap:a.borderCapStyle,lineDash:a.borderDash,lineDashOffset:a.borderDashOffset,lineJoin:a.borderJoinStyle,lineWidth:(s.width+s.height)/4,strokeStyle:a.borderColor,pointStyle:n||a.pointStyle,rotation:a.rotation,textAlign:r||a.textAlign,borderRadius:0,datasetIndex:t.index}},this)}},title:{color:t=>t.chart.options.color,display:!1,position:"center",text:""}},descriptors:{_scriptable:t=>!t.startsWith("on"),labels:{_scriptable:t=>!["generateLabels","filter","sort"].includes(t)}}};class ko extends Ki{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)return void(this.width=this.height=this.right=this.bottom=0);this.width=this.right=t,this.height=this.bottom=e;const n=a(i.text)?i.text.length:1;this._padding=we(i.padding);const r=n*ke(i.font).lineHeight+this._padding.height;this.isHorizontal()?this.height=r:this.width=r}isHorizontal(){const t=this.options.position;return"top"===t||"bottom"===t}_drawArgs(t){const{top:e,left:i,bottom:n,right:r,options:o}=this,a=o.align;let s,l,c,h=0;return this.isHorizontal()?(l=at(a,i,r),c=e+t,s=r-i):("left"===o.position?(l=i+t,c=at(a,n,e),h=-.5*P):(l=r-t,c=at(a,e,n),h=.5*P),s=n-e),{titleX:l,titleY:c,maxWidth:s,rotation:h}}draw(){const t=this.ctx,e=this.options;if(!e.display)return;const i=ke(e.font),n=i.lineHeight/2+this._padding.top,{titleX:r,titleY:o,maxWidth:a,rotation:s}=this._drawArgs(n);de(t,e.text,0,0,i,{color:e.color,maxWidth:a,rotation:s,textAlign:ot(e.align),textBaseline:"middle",translation:[r,o]})}}var So={id:"title",_element:ko,start(t,e,i){!function(t,e){const i=new ko({ctx:t.ctx,options:e,chart:t});jn.configure(t,i,e),jn.addBox(t,i),t.titleBlock=i}(t,i)},stop(t){const e=t.titleBlock;jn.removeBox(t,e),delete t.titleBlock},beforeUpdate(t,e,i){const n=t.titleBlock;jn.configure(t,n,i),n.options=i},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 Mo=new WeakMap;var Do={id:"subtitle",start(t,e,i){const n=new ko({ctx:t.ctx,options:i,chart:t});jn.configure(t,n,i),jn.addBox(t,n),Mo.set(t,n)},stop(t){jn.removeBox(t,Mo.get(t)),Mo.delete(t)},beforeUpdate(t,e,i){const n=Mo.get(t);jn.configure(t,n,i),n.options=i},defaults:{align:"center",display:!1,font:{weight:"normal"},fullSize:!0,padding:0,position:"top",text:"",weight:1500},defaultRoutes:{color:"color"},descriptors:{_scriptable:!0,_indexable:!1}};const Po={average(t){if(!t.length)return!1;let e,i,n=0,r=0,o=0;for(e=0,i=t.length;e<i;++e){const i=t[e].element;if(i&&i.hasValue()){const t=i.tooltipPosition();n+=t.x,r+=t.y,++o}}return{x:n/o,y:r/o}},nearest(t,e){if(!t.length)return!1;let i,n,r,o=e.x,a=e.y,s=Number.POSITIVE_INFINITY;for(i=0,n=t.length;i<n;++i){const n=t[i].element;if(n&&n.hasValue()){const t=$(e,n.getCenterPoint());t<s&&(s=t,r=n)}}if(r){const t=r.tooltipPosition();o=t.x,a=t.y}return{x:o,y:a}}};function To(t,e){return e&&(a(e)?Array.prototype.push.apply(t,e):t.push(e)),t}function Co(t){return("string"==typeof t||t instanceof String)&&t.indexOf("\n")>-1?t.split("\n"):t}function Eo(t,e){const{element:i,datasetIndex:n,index:r}=e,o=t.getDatasetMeta(n).controller,{label:a,value:s}=o.getLabelAndValue(r);return{chart:t,label:a,parsed:o.getParsed(r),raw:t.data.datasets[n].data[r],formattedValue:s,dataset:o.getDataset(),dataIndex:r,datasetIndex:n,element:i}}function Oo(t,e){const i=t.chart.ctx,{body:n,footer:r,title:o}=t,{boxWidth:a,boxHeight:s}=e,l=ke(e.bodyFont),c=ke(e.titleFont),h=ke(e.footerFont),u=o.length,d=r.length,p=n.length,g=we(e.padding);let m=g.height,b=0,y=n.reduce((t,e)=>t+e.before.length+e.lines.length+e.after.length,0);if(y+=t.beforeBody.length+t.afterBody.length,u&&(m+=u*c.lineHeight+(u-1)*e.titleSpacing+e.titleMarginBottom),y){m+=p*(e.displayColors?Math.max(s,l.lineHeight):l.lineHeight)+(y-p)*l.lineHeight+(y-1)*e.bodySpacing}d&&(m+=e.footerMarginTop+d*h.lineHeight+(d-1)*e.footerSpacing);let x=0;const v=function(t){b=Math.max(b,i.measureText(t).width+x)};return i.save(),i.font=c.string,f(t.title,v),i.font=l.string,f(t.beforeBody.concat(t.afterBody),v),x=e.displayColors?a+2+e.boxPadding:0,f(n,t=>{f(t.before,v),f(t.lines,v),f(t.after,v)}),x=0,i.font=h.string,f(t.footer,v),i.restore(),b+=g.width,{width:b,height:m}}function Ao(t,e,i,n){const{x:r,width:o}=i,{width:a,chartArea:{left:s,right:l}}=t;let c="center";return"center"===n?c=r<=(s+l)/2?"left":"right":r<=o/2?c="left":r>=a-o/2&&(c="right"),function(t,e,i,n){const{x:r,width:o}=n,a=i.caretSize+i.caretPadding;return"left"===t&&r+o+a>e.width||"right"===t&&r-o-a<0||void 0}(c,t,e,i)&&(c="center"),c}function Lo(t,e,i){const n=i.yAlign||e.yAlign||function(t,e){const{y:i,height:n}=e;return i<n/2?"top":i>t.height-n/2?"bottom":"center"}(t,i);return{xAlign:i.xAlign||e.xAlign||Ao(t,e,i,n),yAlign:n}}function Io(t,e,i,n){const{caretSize:r,caretPadding:o,cornerRadius:a}=t,{xAlign:s,yAlign:l}=i,c=r+o,{topLeft:h,topRight:u,bottomLeft:d,bottomRight:f}=_e(a);let p=function(t,e){let{x:i,width:n}=t;return"right"===e?i-=n:"center"===e&&(i-=n/2),i}(e,s);const g=function(t,e,i){let{y:n,height:r}=t;return"top"===e?n+=i:n-="bottom"===e?r+i:r/2,n}(e,l,c);return"center"===l?"left"===s?p+=c:"right"===s&&(p-=c):"left"===s?p-=Math.max(h,d)+r:"right"===s&&(p+=Math.max(u,f)+r),{x:X(p,0,n.width-e.width),y:X(g,0,n.height-e.height)}}function Fo(t,e,i){const n=we(i.padding);return"center"===e?t.x+t.width/2:"right"===e?t.x+t.width-n.right:t.x+n.left}function Ro(t){return To([],Co(t))}function zo(t,e){const i=e&&e.dataset&&e.dataset.tooltip&&e.dataset.tooltip.callbacks;return i?t.override(i):t}class jo extends Ki{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||t._chart,this._chart=this.chart,this.options=t.options,this.dataPoints=void 0,this.title=void 0,this.beforeBody=void 0,this.body=void 0,this.afterBody=void 0,this.footer=void 0,this.xAlign=void 0,this.yAlign=void 0,this.x=void 0,this.y=void 0,this.height=void 0,this.width=void 0,this.caretX=void 0,this.caretY=void 0,this.labelColors=void 0,this.labelPointStyles=void 0,this.labelTextColors=void 0}initialize(t){this.options=t,this._cachedAnimations=void 0,this.$context=void 0}_resolveAnimations(){const t=this._cachedAnimations;if(t)return t;const e=this.chart,i=this.options.setContext(this.getContext()),n=i.enabled&&e.options.animation&&i.animations,r=new Mi(this.chart,n);return n._cacheable&&(this._cachedAnimations=Object.freeze(r)),r}getContext(){return this.$context||(this.$context=(t=this.chart.getContext(),e=this,i=this._tooltipItems,Me(t,{tooltip:e,tooltipItems:i,type:"tooltip"})));var t,e,i}getTitle(t,e){const{callbacks:i}=e,n=i.beforeTitle.apply(this,[t]),r=i.title.apply(this,[t]),o=i.afterTitle.apply(this,[t]);let a=[];return a=To(a,Co(n)),a=To(a,Co(r)),a=To(a,Co(o)),a}getBeforeBody(t,e){return Ro(e.callbacks.beforeBody.apply(this,[t]))}getBody(t,e){const{callbacks:i}=e,n=[];return f(t,t=>{const e={before:[],lines:[],after:[]},r=zo(i,t);To(e.before,Co(r.beforeLabel.call(this,t))),To(e.lines,r.label.call(this,t)),To(e.after,Co(r.afterLabel.call(this,t))),n.push(e)}),n}getAfterBody(t,e){return Ro(e.callbacks.afterBody.apply(this,[t]))}getFooter(t,e){const{callbacks:i}=e,n=i.beforeFooter.apply(this,[t]),r=i.footer.apply(this,[t]),o=i.afterFooter.apply(this,[t]);let a=[];return a=To(a,Co(n)),a=To(a,Co(r)),a=To(a,Co(o)),a}_createItems(t){const e=this._active,i=this.chart.data,n=[],r=[],o=[];let a,s,l=[];for(a=0,s=e.length;a<s;++a)l.push(Eo(this.chart,e[a]));return t.filter&&(l=l.filter((e,n,r)=>t.filter(e,n,r,i))),t.itemSort&&(l=l.sort((e,n)=>t.itemSort(e,n,i))),f(l,e=>{const i=zo(t.callbacks,e);n.push(i.labelColor.call(this,e)),r.push(i.labelPointStyle.call(this,e)),o.push(i.labelTextColor.call(this,e))}),this.labelColors=n,this.labelPointStyles=r,this.labelTextColors=o,this.dataPoints=l,l}update(t,e){const i=this.options.setContext(this.getContext()),n=this._active;let r,o=[];if(n.length){const t=Po[i.position].call(this,n,this._eventPosition);o=this._createItems(i),this.title=this.getTitle(o,i),this.beforeBody=this.getBeforeBody(o,i),this.body=this.getBody(o,i),this.afterBody=this.getAfterBody(o,i),this.footer=this.getFooter(o,i);const e=this._size=Oo(this,i),a=Object.assign({},t,e),s=Lo(this.chart,i,a),l=Io(i,a,s,this.chart);this.xAlign=s.xAlign,this.yAlign=s.yAlign,r={opacity:1,x:l.x,y:l.y,width:e.width,height:e.height,caretX:t.x,caretY:t.y}}else 0!==this.opacity&&(r={opacity:0});this._tooltipItems=o,this.$context=void 0,r&&this._resolveAnimations().update(this,r),t&&i.external&&i.external.call(this,{chart:this.chart,tooltip:this,replay:e})}drawCaret(t,e,i,n){const r=this.getCaretPosition(t,i,n);e.lineTo(r.x1,r.y1),e.lineTo(r.x2,r.y2),e.lineTo(r.x3,r.y3)}getCaretPosition(t,e,i){const{xAlign:n,yAlign:r}=this,{caretSize:o,cornerRadius:a}=i,{topLeft:s,topRight:l,bottomLeft:c,bottomRight:h}=_e(a),{x:u,y:d}=t,{width:f,height:p}=e;let g,m,b,y,x,v;return"center"===r?(x=d+p/2,"left"===n?(g=u,m=g-o,y=x+o,v=x-o):(g=u+f,m=g+o,y=x-o,v=x+o),b=g):(m="left"===n?u+Math.max(s,c)+o:"right"===n?u+f-Math.max(l,h)-o:this.caretX,"top"===r?(y=d,x=y-o,g=m-o,b=m+o):(y=d+p,x=y+o,g=m+o,b=m-o),v=y),{x1:g,x2:m,x3:b,y1:y,y2:x,y3:v}}drawTitle(t,e,i){const n=this.title,r=n.length;let o,a,s;if(r){const l=hi(i.rtl,this.x,this.width);for(t.x=Fo(this,i.titleAlign,i),e.textAlign=l.textAlign(i.titleAlign),e.textBaseline="middle",o=ke(i.titleFont),a=i.titleSpacing,e.fillStyle=i.titleColor,e.font=o.string,s=0;s<r;++s)e.fillText(n[s],l.x(t.x),t.y+o.lineHeight/2),t.y+=o.lineHeight+a,s+1===r&&(t.y+=i.titleMarginBottom-a)}}_drawColorBox(t,e,i,n,r){const o=this.labelColors[i],a=this.labelPointStyles[i],{boxHeight:l,boxWidth:c,boxPadding:h}=r,u=ke(r.bodyFont),d=Fo(this,"left",r),f=n.x(d),p=l<u.lineHeight?(u.lineHeight-l)/2:0,g=e.y+p;if(r.usePointStyle){const e={radius:Math.min(c,l)/2,pointStyle:a.pointStyle,rotation:a.rotation,borderWidth:1},i=n.leftForLtr(f,c)+c/2,s=g+l/2;t.strokeStyle=r.multiKeyBackground,t.fillStyle=r.multiKeyBackground,oe(t,e,i,s),t.strokeStyle=o.borderColor,t.fillStyle=o.backgroundColor,oe(t,e,i,s)}else{t.lineWidth=s(o.borderWidth)?Math.max(...Object.values(o.borderWidth)):o.borderWidth||1,t.strokeStyle=o.borderColor,t.setLineDash(o.borderDash||[]),t.lineDashOffset=o.borderDashOffset||0;const e=n.leftForLtr(f,c-h),i=n.leftForLtr(n.xPlus(f,1),c-h-2),a=_e(o.borderRadius);Object.values(a).some(t=>0!==t)?(t.beginPath(),t.fillStyle=r.multiKeyBackground,pe(t,{x:e,y:g,w:c,h:l,radius:a}),t.fill(),t.stroke(),t.fillStyle=o.backgroundColor,t.beginPath(),pe(t,{x:i,y:g+1,w:c-2,h:l-2,radius:a}),t.fill()):(t.fillStyle=r.multiKeyBackground,t.fillRect(e,g,c,l),t.strokeRect(e,g,c,l),t.fillStyle=o.backgroundColor,t.fillRect(i,g+1,c-2,l-2))}t.fillStyle=this.labelTextColors[i]}drawBody(t,e,i){const{body:n}=this,{bodySpacing:r,bodyAlign:o,displayColors:a,boxHeight:s,boxWidth:l,boxPadding:c}=i,h=ke(i.bodyFont);let u=h.lineHeight,d=0;const p=hi(i.rtl,this.x,this.width),g=function(i){e.fillText(i,p.x(t.x+d),t.y+u/2),t.y+=u+r},m=p.textAlign(o);let b,y,x,v,_,w,k;for(e.textAlign=o,e.textBaseline="middle",e.font=h.string,t.x=Fo(this,m,i),e.fillStyle=i.bodyColor,f(this.beforeBody,g),d=a&&"right"!==m?"center"===o?l/2+c:l+2+c:0,v=0,w=n.length;v<w;++v){for(b=n[v],y=this.labelTextColors[v],e.fillStyle=y,f(b.before,g),x=b.lines,a&&x.length&&(this._drawColorBox(e,t,v,p,i),u=Math.max(h.lineHeight,s)),_=0,k=x.length;_<k;++_)g(x[_]),u=h.lineHeight;f(b.after,g)}d=0,u=h.lineHeight,f(this.afterBody,g),t.y-=r}drawFooter(t,e,i){const n=this.footer,r=n.length;let o,a;if(r){const s=hi(i.rtl,this.x,this.width);for(t.x=Fo(this,i.footerAlign,i),t.y+=i.footerMarginTop,e.textAlign=s.textAlign(i.footerAlign),e.textBaseline="middle",o=ke(i.footerFont),e.fillStyle=i.footerColor,e.font=o.string,a=0;a<r;++a)e.fillText(n[a],s.x(t.x),t.y+o.lineHeight/2),t.y+=o.lineHeight+i.footerSpacing}}drawBackground(t,e,i,n){const{xAlign:r,yAlign:o}=this,{x:a,y:s}=t,{width:l,height:c}=i,{topLeft:h,topRight:u,bottomLeft:d,bottomRight:f}=_e(n.cornerRadius);e.fillStyle=n.backgroundColor,e.strokeStyle=n.borderColor,e.lineWidth=n.borderWidth,e.beginPath(),e.moveTo(a+h,s),"top"===o&&this.drawCaret(t,e,i,n),e.lineTo(a+l-u,s),e.quadraticCurveTo(a+l,s,a+l,s+u),"center"===o&&"right"===r&&this.drawCaret(t,e,i,n),e.lineTo(a+l,s+c-f),e.quadraticCurveTo(a+l,s+c,a+l-f,s+c),"bottom"===o&&this.drawCaret(t,e,i,n),e.lineTo(a+d,s+c),e.quadraticCurveTo(a,s+c,a,s+c-d),"center"===o&&"left"===r&&this.drawCaret(t,e,i,n),e.lineTo(a,s+h),e.quadraticCurveTo(a,s,a+h,s),e.closePath(),e.fill(),n.borderWidth>0&&e.stroke()}_updateAnimationTarget(t){const e=this.chart,i=this.$animations,n=i&&i.x,r=i&&i.y;if(n||r){const i=Po[t.position].call(this,this._active,this._eventPosition);if(!i)return;const o=this._size=Oo(this,t),a=Object.assign({},i,this._size),s=Lo(e,t,a),l=Io(t,a,s,e);n._to===l.x&&r._to===l.y||(this.xAlign=s.xAlign,this.yAlign=s.yAlign,this.width=o.width,this.height=o.height,this.caretX=i.x,this.caretY=i.y,this._resolveAnimations().update(this,l))}}_willRender(){return!!this.opacity}draw(t){const e=this.options.setContext(this.getContext());let i=this.opacity;if(!i)return;this._updateAnimationTarget(e);const n={width:this.width,height:this.height},r={x:this.x,y:this.y};i=Math.abs(i)<.001?0:i;const o=we(e.padding),a=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;e.enabled&&a&&(t.save(),t.globalAlpha=i,this.drawBackground(r,t,n,e),ui(t,e.textDirection),r.y+=o.top,this.drawTitle(r,t,e),this.drawBody(r,t,e),this.drawFooter(r,t,e),di(t,e.textDirection),t.restore())}getActiveElements(){return this._active||[]}setActiveElements(t,e){const i=this._active,n=t.map(({datasetIndex:t,index:e})=>{const i=this.chart.getDatasetMeta(t);if(!i)throw new Error("Cannot find a dataset at index "+t);return{datasetIndex:t,element:i.data[e],index:e}}),r=!p(i,n),o=this._positionChanged(n,e);(r||o)&&(this._active=n,this._eventPosition=e,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(t,e,i=!0){if(e&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;const n=this.options,r=this._active||[],o=this._getActiveElements(t,r,e,i),a=this._positionChanged(o,t),s=e||!p(o,r)||a;return s&&(this._active=o,(n.enabled||n.external)&&(this._eventPosition={x:t.x,y:t.y},this.update(!0,e))),s}_getActiveElements(t,e,i,n){const r=this.options;if("mouseout"===t.type)return[];if(!n)return e;const o=this.chart.getElementsAtEventForMode(t,r.mode,r,i);return r.reverse&&o.reverse(),o}_positionChanged(t,e){const{caretX:i,caretY:n,options:r}=this,o=Po[r.position].call(this,t,e);return!1!==o&&(i!==o.x||n!==o.y)}}jo.positioners=Po;var Bo={id:"tooltip",_element:jo,positioners:Po,afterInit(t,e,i){i&&(t.tooltip=new jo({chart:t,options:i}))},beforeUpdate(t,e,i){t.tooltip&&t.tooltip.initialize(i)},reset(t,e,i){t.tooltip&&t.tooltip.initialize(i)},afterDraw(t){const e=t.tooltip;if(e&&e._willRender()){const i={tooltip:e};if(!1===t.notifyPlugins("beforeTooltipDraw",i))return;e.draw(t.ctx),t.notifyPlugins("afterTooltipDraw",i)}},afterEvent(t,e){if(t.tooltip){const i=e.replay;t.tooltip.handleEvent(e.event,i,e.inChartArea)&&(e.changed=!0)}},defaults:{enabled:!0,external:null,position:"average",backgroundColor:"rgba(0,0,0,0.8)",titleColor:"#fff",titleFont:{weight:"bold"},titleSpacing:2,titleMarginBottom:6,titleAlign:"left",bodyColor:"#fff",bodySpacing:2,bodyFont:{},bodyAlign:"left",footerColor:"#fff",footerSpacing:2,footerMarginTop:6,footerFont:{weight:"bold"},footerAlign:"left",padding:6,caretPadding:2,caretSize:5,cornerRadius:6,boxHeight:(t,e)=>e.bodyFont.size,boxWidth:(t,e)=>e.bodyFont.size,multiKeyBackground:"#fff",displayColors:!0,boxPadding:0,borderColor:"rgba(0,0,0,0)",borderWidth:0,animation:{duration:400,easing:"easeOutQuart"},animations:{numbers:{type:"number",properties:["x","y","width","height","caretX","caretY"]},opacity:{easing:"linear",duration:200}},callbacks:{beforeTitle:n,title(t){if(t.length>0){const e=t[0],i=e.chart.data.labels,n=i?i.length:0;if(this&&this.options&&"dataset"===this.options.mode)return e.dataset.label||"";if(e.label)return e.label;if(n>0&&e.dataIndex<n)return i[e.dataIndex]}return""},afterTitle:n,beforeBody:n,beforeLabel:n,label(t){if(this&&this.options&&"dataset"===this.options.mode)return t.label+": "+t.formattedValue||t.formattedValue;let e=t.dataset.label||"";e&&(e+=": ");const i=t.formattedValue;return o(i)||(e+=i),e},labelColor(t){const e=t.chart.getDatasetMeta(t.datasetIndex).controller.getStyle(t.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(t){const e=t.chart.getDatasetMeta(t.datasetIndex).controller.getStyle(t.dataIndex);return{pointStyle:e.pointStyle,rotation:e.rotation}},afterLabel:n,afterBody:n,beforeFooter:n,footer:n,afterFooter:n}},defaultRoutes:{bodyFont:"font",footerFont:"font",titleFont:"font"},descriptors:{_scriptable:t=>"filter"!==t&&"itemSort"!==t&&"external"!==t,_indexable:!1,callbacks:{_scriptable:!1,_indexable:!1},animation:{_fallback:!1},animations:{_fallback:"animation"}},additionalOptionScopes:["interaction"]},Wo=Object.freeze({__proto__:null,Decimation:eo,Filler:xo,Legend:wo,SubTitle:Do,Title:So,Tooltip:Bo});function No(t,e,i,n){const r=t.indexOf(e);if(-1===r)return((t,e,i,n)=>("string"==typeof e?(i=t.push(e)-1,n.unshift({index:i,label:e})):isNaN(e)&&(i=null),i))(t,e,i,n);return r!==t.lastIndexOf(e)?i:r}class Vo extends un{constructor(t){super(t),this._startValue=void 0,this._valueRange=0,this._addedLabels=[]}init(t){const e=this._addedLabels;if(e.length){const t=this.getLabels();for(const{index:i,label:n}of e)t[i]===n&&t.splice(i,1);this._addedLabels=[]}super.init(t)}parse(t,e){if(o(t))return null;const i=this.getLabels();return((t,e)=>null===t?null:X(Math.round(t),0,e))(e=isFinite(e)&&i[e]===t?e:No(i,t,h(e,t),this._addedLabels),i.length-1)}determineDataLimits(){const{minDefined:t,maxDefined:e}=this.getUserBounds();let{min:i,max:n}=this.getMinMax(!0);"ticks"===this.options.bounds&&(t||(i=0),e||(n=this.getLabels().length-1)),this.min=i,this.max=n}buildTicks(){const t=this.min,e=this.max,i=this.options.offset,n=[];let r=this.getLabels();r=0===t&&e===r.length-1?r:r.slice(t,e+1),this._valueRange=Math.max(r.length-(i?0:1),1),this._startValue=this.min-(i?.5:0);for(let i=t;i<=e;i++)n.push({value:i});return n}getLabelForValue(t){const e=this.getLabels();return t>=0&&t<e.length?e[t]:t}configure(){super.configure(),this.isHorizontal()||(this._reversePixels=!this._reversePixels)}getPixelForValue(t){return"number"!=typeof t&&(t=this.parse(t)),null===t?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getPixelForTick(t){const e=this.ticks;return t<0||t>e.length-1?null:this.getPixelForValue(e[t].value)}getValueForPixel(t){return Math.round(this._startValue+this.getDecimalForPixel(t)*this._valueRange)}getBasePixel(){return this.bottom}}function Ho(t,e){const i=[],{bounds:n,step:r,min:a,max:s,precision:l,count:c,maxTicks:h,maxDigits:u,includeBounds:d}=t,f=r||1,p=h-1,{min:g,max:m}=e,b=!o(a),y=!o(s),x=!o(c),v=(m-g)/(u+1);let _,w,k,S,M=z((m-g)/p/f)*f;if(M<1e-14&&!b&&!y)return[{value:g},{value:m}];S=Math.ceil(m/M)-Math.floor(g/M),S>p&&(M=z(S*M/p/f)*f),o(l)||(_=Math.pow(10,l),M=Math.ceil(M*_)/_),"ticks"===n?(w=Math.floor(g/M)*M,k=Math.ceil(m/M)*M):(w=g,k=m),b&&y&&r&&function(t,e){const i=Math.round(t);return i-e<=t&&i+e>=t}((s-a)/r,M/1e3)?(S=Math.round(Math.min((s-a)/M,h)),M=(s-a)/S,w=a,k=s):x?(w=b?a:w,k=y?s:k,S=c-1,M=(k-w)/S):(S=(k-w)/M,S=B(S,Math.round(S),M/1e3)?Math.round(S):Math.ceil(S));const D=Math.max(H(M),H(w));_=Math.pow(10,o(l)?D:l),w=Math.round(w*_)/_,k=Math.round(k*_)/_;let P=0;for(b&&(d&&w!==a?(i.push({value:a}),w<a&&P++,B(Math.round((w+P*M)*_)/_,a,qo(a,v,t))&&P++):w<a&&P++);P<S;++P)i.push({value:Math.round((w+P*M)*_)/_});return y&&d&&k!==s?i.length&&B(i[i.length-1].value,s,qo(s,v,t))?i[i.length-1].value=s:i.push({value:s}):y&&k!==s||i.push({value:k}),i}function qo(t,e,{horizontal:i,minRotation:n}){const r=N(n),o=(i?Math.sin(r):Math.cos(r))||.001,a=.75*e*(""+t).length;return Math.min(e/o,a)}Vo.id="category",Vo.defaults={ticks:{callback:Vo.prototype.getLabelForValue}};class $o extends un{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 o(t)||("number"==typeof t||t instanceof Number)&&!isFinite(+t)?null:+t}handleTickRangeOptions(){const{beginAtZero:t}=this.options,{minDefined:e,maxDefined:i}=this.getUserBounds();let{min:n,max:r}=this;const o=t=>n=e?n:t,a=t=>r=i?r:t;if(t){const t=R(n),e=R(r);t<0&&e<0?a(0):t>0&&e>0&&o(0)}if(n===r){let e=1;(r>=Number.MAX_SAFE_INTEGER||n<=Number.MIN_SAFE_INTEGER)&&(e=Math.abs(.05*r)),a(r+e),t||o(n-e)}this.min=n,this.max=r}getTickLimit(){const t=this.options.ticks;let e,{maxTicksLimit:i,stepSize:n}=t;return n?(e=Math.ceil(this.max/n)-Math.floor(this.min/n)+1,e>1e3&&(e=1e3)):(e=this.computeTickLimit(),i=i||11),i&&(e=Math.min(i,e)),e}computeTickLimit(){return Number.POSITIVE_INFINITY}buildTicks(){const t=this.options,e=t.ticks;let i=this.getTickLimit();i=Math.max(2,i);const n=Ho({maxTicks:i,bounds:t.bounds,min:t.min,max:t.max,precision:e.precision,step:e.stepSize,count:e.count,maxDigits:this._maxDigits(),horizontal:this.isHorizontal(),minRotation:e.minRotation||0,includeBounds:!1!==e.includeBounds},this._range||this);return"ticks"===t.bounds&&W(n,this,"value"),t.reverse?(n.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),n}configure(){const t=this.ticks;let e=this.min,i=this.max;if(super.configure(),this.options.offset&&t.length){const n=(i-e)/Math.max(t.length-1,1)/2;e-=n,i+=n}this._startValue=e,this._endValue=i,this._valueRange=i-e}getLabelForValue(t){return ci(t,this.chart.options.locale,this.options.ticks.format)}}class Uo extends $o{determineDataLimits(){const{min:t,max:e}=this.getMinMax(!0);this.min=l(t)?t:0,this.max=l(e)?e:1,this.handleTickRangeOptions()}computeTickLimit(){const t=this.isHorizontal(),e=t?this.width:this.height,i=N(this.options.ticks.minRotation),n=(t?Math.sin(i):Math.cos(i))||.001,r=this._resolveTickFontOptions(0);return Math.ceil(e/Math.min(40,r.lineHeight/n))}getPixelForValue(t){return null===t?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getValueForPixel(t){return this._startValue+this.getDecimalForPixel(t)*this._valueRange}}function Yo(t){return 1===t/Math.pow(10,Math.floor(F(t)))}Uo.id="linear",Uo.defaults={ticks:{callback:en.formatters.numeric}};class Go extends un{constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._valueRange=0}parse(t,e){const i=$o.prototype.parse.apply(this,[t,e]);if(0!==i)return l(i)&&i>0?i:null;this._zero=!0}determineDataLimits(){const{min:t,max:e}=this.getMinMax(!0);this.min=l(t)?Math.max(0,t):null,this.max=l(e)?Math.max(0,e):null,this.options.beginAtZero&&(this._zero=!0),this.handleTickRangeOptions()}handleTickRangeOptions(){const{minDefined:t,maxDefined:e}=this.getUserBounds();let i=this.min,n=this.max;const r=e=>i=t?i:e,o=t=>n=e?n:t,a=(t,e)=>Math.pow(10,Math.floor(F(t))+e);i===n&&(i<=0?(r(1),o(10)):(r(a(i,-1)),o(a(n,1)))),i<=0&&r(a(n,-1)),n<=0&&o(a(i,1)),this._zero&&this.min!==this._suggestedMin&&i===a(this.min,0)&&r(a(i,-1)),this.min=i,this.max=n}buildTicks(){const t=this.options,e=function(t,e){const i=Math.floor(F(e.max)),n=Math.ceil(e.max/Math.pow(10,i)),r=[];let o=c(t.min,Math.pow(10,Math.floor(F(e.min)))),a=Math.floor(F(o)),s=Math.floor(o/Math.pow(10,a)),l=a<0?Math.pow(10,Math.abs(a)):1;do{r.push({value:o,major:Yo(o)}),++s,10===s&&(s=1,++a,l=a>=0?1:l),o=Math.round(s*Math.pow(10,a)*l)/l}while(a<i||a===i&&s<n);const h=c(t.max,o);return r.push({value:h,major:Yo(o)}),r}({min:this._userMin,max:this._userMax},this);return"ticks"===t.bounds&&W(e,this,"value"),t.reverse?(e.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),e}getLabelForValue(t){return void 0===t?"0":ci(t,this.chart.options.locale,this.options.ticks.format)}configure(){const t=this.min;super.configure(),this._startValue=F(t),this._valueRange=F(this.max)-F(t)}getPixelForValue(t){return void 0!==t&&0!==t||(t=this.min),null===t||isNaN(t)?NaN:this.getPixelForDecimal(t===this.min?0:(F(t)-this._startValue)/this._valueRange)}getValueForPixel(t){const e=this.getDecimalForPixel(t);return Math.pow(10,this._startValue+e*this._valueRange)}}function Xo(t){const e=t.ticks;if(e.display&&t.display){const t=we(e.backdropPadding);return h(e.font&&e.font.size,te.font.size)+t.height}return 0}function Zo(t,e,i){return i=a(i)?i:[i],{w:ie(t,e.string,i),h:i.length*e.lineHeight}}function Qo(t,e,i,n,r){return t===n||t===r?{start:e-i/2,end:e+i/2}:t<n||t>r?{start:e-i,end:e}:{start:e,end:e+i}}function Jo(t){const e={l:t.left+t._padding.left,r:t.right-t._padding.right,t:t.top+t._padding.top,b:t.bottom-t._padding.bottom},i=Object.assign({},e),n=[],r=[],o=t._pointLabels.length,a=t.options.pointLabels,s=a.centerPointLabels?P/o:0;for(let l=0;l<o;l++){const o=a.setContext(t.getPointLabelContext(l));r[l]=o.padding;const c=t.getPointPosition(l,t.drawingArea+r[l],s),h=ke(o.font),u=Zo(t.ctx,h,t._pointLabels[l]);n[l]=u;const d=Y(t.getIndexAngle(l)+s),f=Math.round(V(d));Ko(i,e,d,Qo(f,c.x,u.w,0,180),Qo(f,c.y,u.h,90,270))}t.setCenterPoint(e.l-i.l,i.r-e.r,e.t-i.t,i.b-e.b),t._pointLabelItems=function(t,e,i){const n=[],r=t._pointLabels.length,o=t.options,a=Xo(o)/2,s=t.drawingArea,l=o.pointLabels.centerPointLabels?P/r:0;for(let o=0;o<r;o++){const r=t.getPointPosition(o,s+a+i[o],l),c=Math.round(V(Y(r.angle+A))),h=e[o],u=ia(r.y,h.h,c),d=ta(c),f=ea(r.x,h.w,d);n.push({x:r.x,y:u,textAlign:d,left:f,top:u,right:f+h.w,bottom:u+h.h})}return n}(t,n,r)}function Ko(t,e,i,n,r){const o=Math.abs(Math.sin(i)),a=Math.abs(Math.cos(i));let s=0,l=0;n.start<e.l?(s=(e.l-n.start)/o,t.l=Math.min(t.l,e.l-s)):n.end>e.r&&(s=(n.end-e.r)/o,t.r=Math.max(t.r,e.r+s)),r.start<e.t?(l=(e.t-r.start)/a,t.t=Math.min(t.t,e.t-l)):r.end>e.b&&(l=(r.end-e.b)/a,t.b=Math.max(t.b,e.b+l))}function ta(t){return 0===t||180===t?"center":t<180?"left":"right"}function ea(t,e,i){return"right"===i?t-=e:"center"===i&&(t-=e/2),t}function ia(t,e,i){return 90===i||270===i?t-=e/2:(i>270||i<90)&&(t-=e),t}function na(t,e,i,n){const{ctx:r}=t;if(i)r.arc(t.xCenter,t.yCenter,e,0,T);else{let i=t.getPointPosition(0,e);r.moveTo(i.x,i.y);for(let o=1;o<n;o++)i=t.getPointPosition(o,e),r.lineTo(i.x,i.y)}}Go.id="logarithmic",Go.defaults={ticks:{callback:en.formatters.logarithmic,major:{enabled:!0}}};class ra extends $o{constructor(t){super(t),this.xCenter=void 0,this.yCenter=void 0,this.drawingArea=void 0,this._pointLabels=[],this._pointLabelItems=[]}setDimensions(){const t=this._padding=we(Xo(this.options)/2),e=this.width=this.maxWidth-t.width,i=this.height=this.maxHeight-t.height;this.xCenter=Math.floor(this.left+e/2+t.left),this.yCenter=Math.floor(this.top+i/2+t.top),this.drawingArea=Math.floor(Math.min(e,i)/2)}determineDataLimits(){const{min:t,max:e}=this.getMinMax(!1);this.min=l(t)&&!isNaN(t)?t:0,this.max=l(e)&&!isNaN(e)?e:0,this.handleTickRangeOptions()}computeTickLimit(){return Math.ceil(this.drawingArea/Xo(this.options))}generateTickLabels(t){$o.prototype.generateTickLabels.call(this,t),this._pointLabels=this.getLabels().map((t,e)=>{const i=d(this.options.pointLabels.callback,[t,e],this);return i||0===i?i:""}).filter((t,e)=>this.chart.getDataVisibility(e))}fit(){const t=this.options;t.display&&t.pointLabels.display?Jo(this):this.setCenterPoint(0,0,0,0)}setCenterPoint(t,e,i,n){this.xCenter+=Math.floor((t-e)/2),this.yCenter+=Math.floor((i-n)/2),this.drawingArea-=Math.min(this.drawingArea/2,Math.max(t,e,i,n))}getIndexAngle(t){return Y(t*(T/(this._pointLabels.length||1))+N(this.options.startAngle||0))}getDistanceFromCenterForValue(t){if(o(t))return NaN;const e=this.drawingArea/(this.max-this.min);return this.options.reverse?(this.max-t)*e:(t-this.min)*e}getValueForDistanceFromCenter(t){if(o(t))return NaN;const e=t/(this.drawingArea/(this.max-this.min));return this.options.reverse?this.max-e:this.min+e}getPointLabelContext(t){const e=this._pointLabels||[];if(t>=0&&t<e.length){const i=e[t];return function(t,e,i){return Me(t,{label:i,index:e,type:"pointLabel"})}(this.getContext(),t,i)}}getPointPosition(t,e,i=0){const n=this.getIndexAngle(t)-A+i;return{x:Math.cos(n)*e+this.xCenter,y:Math.sin(n)*e+this.yCenter,angle:n}}getPointPositionForValue(t,e){return this.getPointPosition(t,this.getDistanceFromCenterForValue(e))}getBasePosition(t){return this.getPointPositionForValue(t||0,this.getBaseValue())}getPointLabelPosition(t){const{left:e,top:i,right:n,bottom:r}=this._pointLabelItems[t];return{left:e,top:i,right:n,bottom:r}}drawBackground(){const{backgroundColor:t,grid:{circular:e}}=this.options;if(t){const i=this.ctx;i.save(),i.beginPath(),na(this,this.getDistanceFromCenterForValue(this._endValue),e,this._pointLabels.length),i.closePath(),i.fillStyle=t,i.fill(),i.restore()}}drawGrid(){const t=this.ctx,e=this.options,{angleLines:i,grid:n}=e,r=this._pointLabels.length;let a,s,l;if(e.pointLabels.display&&function(t,e){const{ctx:i,options:{pointLabels:n}}=t;for(let r=e-1;r>=0;r--){const e=n.setContext(t.getPointLabelContext(r)),a=ke(e.font),{x:s,y:l,textAlign:c,left:h,top:u,right:d,bottom:f}=t._pointLabelItems[r],{backdropColor:p}=e;if(!o(p)){const t=_e(e.borderRadius),n=we(e.backdropPadding);i.fillStyle=p;const r=h-n.left,o=u-n.top,a=d-h+n.width,s=f-u+n.height;Object.values(t).some(t=>0!==t)?(i.beginPath(),pe(i,{x:r,y:o,w:a,h:s,radius:t}),i.fill()):i.fillRect(r,o,a,s)}de(i,t._pointLabels[r],s,l+a.lineHeight/2,a,{color:e.color,textAlign:c,textBaseline:"middle"})}}(this,r),n.display&&this.ticks.forEach((t,e)=>{if(0!==e){s=this.getDistanceFromCenterForValue(t.value);!function(t,e,i,n){const r=t.ctx,o=e.circular,{color:a,lineWidth:s}=e;!o&&!n||!a||!s||i<0||(r.save(),r.strokeStyle=a,r.lineWidth=s,r.setLineDash(e.borderDash),r.lineDashOffset=e.borderDashOffset,r.beginPath(),na(t,i,o,n),r.closePath(),r.stroke(),r.restore())}(this,n.setContext(this.getContext(e-1)),s,r)}}),i.display){for(t.save(),a=r-1;a>=0;a--){const n=i.setContext(this.getPointLabelContext(a)),{color:r,lineWidth:o}=n;o&&r&&(t.lineWidth=o,t.strokeStyle=r,t.setLineDash(n.borderDash),t.lineDashOffset=n.borderDashOffset,s=this.getDistanceFromCenterForValue(e.ticks.reverse?this.min:this.max),l=this.getPointPosition(a,s),t.beginPath(),t.moveTo(this.xCenter,this.yCenter),t.lineTo(l.x,l.y),t.stroke())}t.restore()}}drawBorder(){}drawLabels(){const t=this.ctx,e=this.options,i=e.ticks;if(!i.display)return;const n=this.getIndexAngle(0);let r,o;t.save(),t.translate(this.xCenter,this.yCenter),t.rotate(n),t.textAlign="center",t.textBaseline="middle",this.ticks.forEach((n,a)=>{if(0===a&&!e.reverse)return;const s=i.setContext(this.getContext(a)),l=ke(s.font);if(r=this.getDistanceFromCenterForValue(this.ticks[a].value),s.showLabelBackdrop){t.font=l.string,o=t.measureText(n.label).width,t.fillStyle=s.backdropColor;const e=we(s.backdropPadding);t.fillRect(-o/2-e.left,-r-l.size/2-e.top,o+e.width,l.size+e.height)}de(t,n.label,0,-r,l,{color:s.color})}),t.restore()}drawTitle(){}}ra.id="radialLinear",ra.defaults={display:!0,animate:!0,position:"chartArea",angleLines:{display:!0,lineWidth:1,borderDash:[],borderDashOffset:0},grid:{circular:!1},startAngle:0,ticks:{showLabelBackdrop:!0,callback:en.formatters.numeric},pointLabels:{backdropColor:void 0,backdropPadding:2,display:!0,font:{size:10},callback:t=>t,padding:5,centerPointLabels:!1}},ra.defaultRoutes={"angleLines.color":"borderColor","pointLabels.color":"color","ticks.color":"color"},ra.descriptors={angleLines:{_fallback:"grid"}};const oa={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}},aa=Object.keys(oa);function sa(t,e){return t-e}function la(t,e){if(o(e))return null;const i=t._adapter,{parser:n,round:r,isoWeekday:a}=t._parseOpts;let s=e;return"function"==typeof n&&(s=n(s)),l(s)||(s="string"==typeof n?i.parse(s,n):i.parse(s)),null===s?null:(r&&(s="week"!==r||!j(a)&&!0!==a?i.startOf(s,r):i.startOf(s,"isoWeek",a)),+s)}function ca(t,e,i,n){const r=aa.length;for(let o=aa.indexOf(t);o<r-1;++o){const t=oa[aa[o]],r=t.steps?t.steps:Number.MAX_SAFE_INTEGER;if(t.common&&Math.ceil((i-e)/(r*t.size))<=n)return aa[o]}return aa[r-1]}function ha(t,e,i){if(i){if(i.length){const{lo:n,hi:r}=Q(i,e);t[i[n]>=e?i[n]:i[r]]=!0}}else t[e]=!0}function ua(t,e,i){const n=[],r={},o=e.length;let a,s;for(a=0;a<o;++a)s=e[a],r[s]=a,n.push({value:s,major:!1});return 0!==o&&i?function(t,e,i,n){const r=t._adapter,o=+r.startOf(e[0].value,n),a=e[e.length-1].value;let s,l;for(s=o;s<=a;s=+r.add(s,1,n))l=i[s],l>=0&&(e[l].major=!0);return e}(t,n,r,i):n}class da extends un{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={}),n=this._adapter=new yn._date(t.adapters.date);n.init(e),x(i.displayFormats,n.formats()),this._parseOpts={parser:i.parser,round:i.round,isoWeekday:i.isoWeekday},super.init(t),this._normalized=e.normalized}parse(t,e){return void 0===t?null:la(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:n,max:r,minDefined:o,maxDefined:a}=this.getUserBounds();function s(t){o||isNaN(t.min)||(n=Math.min(n,t.min)),a||isNaN(t.max)||(r=Math.max(r,t.max))}o&&a||(s(this._getLabelBounds()),"ticks"===t.bounds&&"labels"===t.ticks.source||s(this.getMinMax(!1))),n=l(n)&&!isNaN(n)?n:+e.startOf(Date.now(),i),r=l(r)&&!isNaN(r)?r:+e.endOf(Date.now(),i)+1,this.min=Math.min(n,r-1),this.max=Math.max(n+1,r)}_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,n="labels"===i.source?this.getLabelTimestamps():this._generate();"ticks"===t.bounds&&n.length&&(this.min=this._userMin||n[0],this.max=this._userMax||n[n.length-1]);const r=this.min,o=function(t,e,i){let n=0,r=t.length;for(;n<r&&t[n]<e;)n++;for(;r>n&&t[r-1]>i;)r--;return n>0||r<t.length?t.slice(n,r):t}(n,r,this.max);return this._unit=e.unit||(i.autoSkip?ca(e.minUnit,this.min,this.max,this._getLabelCapacity(r)):function(t,e,i,n,r){for(let o=aa.length-1;o>=aa.indexOf(i);o--){const i=aa[o];if(oa[i].common&&t._adapter.diff(r,n,i)>=e-1)return i}return aa[i?aa.indexOf(i):0]}(this,o.length,e.minUnit,this.min,this.max)),this._majorUnit=i.major.enabled&&"year"!==this._unit?function(t){for(let e=aa.indexOf(t)+1,i=aa.length;e<i;++e)if(oa[aa[e]].common)return aa[e]}(this._unit):void 0,this.initOffsets(n),t.reverse&&o.reverse(),ua(this,o,this._majorUnit)}afterAutoSkip(){this.options.offsetAfterAutoskip&&this.initOffsets(this.ticks.map(t=>+t.value))}initOffsets(t){let e,i,n=0,r=0;this.options.offset&&t.length&&(e=this.getDecimalForValue(t[0]),n=1===t.length?1-e:(this.getDecimalForValue(t[1])-e)/2,i=this.getDecimalForValue(t[t.length-1]),r=1===t.length?i:(i-this.getDecimalForValue(t[t.length-2]))/2);const o=t.length<3?.5:.25;n=X(n,0,o),r=X(r,0,o),this._offsets={start:n,end:r,factor:1/(n+1+r)}}_generate(){const t=this._adapter,e=this.min,i=this.max,n=this.options,r=n.time,o=r.unit||ca(r.minUnit,e,i,this._getLabelCapacity(e)),a=h(r.stepSize,1),s="week"===o&&r.isoWeekday,l=j(s)||!0===s,c={};let u,d,f=e;if(l&&(f=+t.startOf(f,"isoWeek",s)),f=+t.startOf(f,l?"day":o),t.diff(i,e,o)>1e5*a)throw new Error(e+" and "+i+" are too far apart with stepSize of "+a+" "+o);const p="data"===n.ticks.source&&this.getDataTimestamps();for(u=f,d=0;u<i;u=+t.add(u,a,o),d++)ha(c,u,p);return u!==i&&"ticks"!==n.bounds&&1!==d||ha(c,u,p),Object.keys(c).sort((t,e)=>t-e).map(t=>+t)}getLabelForValue(t){const e=this._adapter,i=this.options.time;return i.tooltipFormat?e.format(t,i.tooltipFormat):e.format(t,i.displayFormats.datetime)}_tickFormatFunction(t,e,i,n){const r=this.options,o=r.time.displayFormats,a=this._unit,s=this._majorUnit,l=a&&o[a],c=s&&o[s],h=i[e],u=s&&c&&h&&h.major,f=this._adapter.format(t,n||(u?c:l)),p=r.ticks.callback;return p?d(p,[f,e,i],this):f}generateTickLabels(t){let e,i,n;for(e=0,i=t.length;e<i;++e)n=t[e],n.label=this._tickFormatFunction(n.value,e,t)}getDecimalForValue(t){return null===t?NaN:(t-this.min)/(this.max-this.min)}getPixelForValue(t){const e=this._offsets,i=this.getDecimalForValue(t);return this.getPixelForDecimal((e.start+i)*e.factor)}getValueForPixel(t){const e=this._offsets,i=this.getDecimalForPixel(t)/e.factor-e.end;return this.min+i*(this.max-this.min)}_getLabelSize(t){const e=this.options.ticks,i=this.ctx.measureText(t).width,n=N(this.isHorizontal()?e.maxRotation:e.minRotation),r=Math.cos(n),o=Math.sin(n),a=this._resolveTickFontOptions(0).size;return{w:i*r+a*o,h:i*o+a*r}}_getLabelCapacity(t){const e=this.options.time,i=e.displayFormats,n=i[e.unit]||i.millisecond,r=this._tickFormatFunction(t,0,ua(this,[t],this._majorUnit),n),o=this._getLabelSize(r),a=Math.floor(this.isHorizontal()?this.width/o.w:this.height/o.h)-1;return a>0?a:1}getDataTimestamps(){let t,e,i=this._cache.data||[];if(i.length)return i;const n=this.getMatchingVisibleMetas();if(this._normalized&&n.length)return this._cache.data=n[0].controller.getAllParsedValues(this);for(t=0,e=n.length;t<e;++t)i=i.concat(n[t].controller.getAllParsedValues(this));return this._cache.data=this.normalize(i)}getLabelTimestamps(){const t=this._cache.labels||[];let e,i;if(t.length)return t;const n=this.getLabels();for(e=0,i=n.length;e<i;++e)t.push(la(this,n[e]));return this._cache.labels=this._normalized?t:this.normalize(t)}normalize(t){return it(t.sort(sa))}}function fa(t,e,i){let n,r,o,a,s=0,l=t.length-1;i?(e>=t[s].pos&&e<=t[l].pos&&({lo:s,hi:l}=J(t,"pos",e)),({pos:n,time:o}=t[s]),({pos:r,time:a}=t[l])):(e>=t[s].time&&e<=t[l].time&&({lo:s,hi:l}=J(t,"time",e)),({time:n,pos:o}=t[s]),({time:r,pos:a}=t[l]));const c=r-n;return c?o+(a-o)*(e-n)/c:o}da.id="time",da.defaults={bounds:"data",adapters:{},time:{parser:!1,unit:!1,round:!1,isoWeekday:!1,minUnit:"millisecond",displayFormats:{}},ticks:{source:"auto",major:{enabled:!1}}};class pa extends da{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=fa(e,this.min),this._tableRange=fa(e,this.max)-this._minPos,super.initOffsets(t)}buildLookupTable(t){const{min:e,max:i}=this,n=[],r=[];let o,a,s,l,c;for(o=0,a=t.length;o<a;++o)l=t[o],l>=e&&l<=i&&n.push(l);if(n.length<2)return[{time:e,pos:0},{time:i,pos:1}];for(o=0,a=n.length;o<a;++o)c=n[o+1],s=n[o-1],l=n[o],Math.round((c+s)/2)!==l&&r.push({time:l,pos:o/(a-1)});return r}_getTimestampsForTable(){let t=this._cache.all||[];if(t.length)return t;const e=this.getDataTimestamps(),i=this.getLabelTimestamps();return t=e.length&&i.length?this.normalize(e.concat(i)):e.length?e:i,t=this._cache.all=t,t}getDecimalForValue(t){return(fa(this._table,t)-this._minPos)/this._tableRange}getValueForPixel(t){const e=this._offsets,i=this.getDecimalForPixel(t)/e.factor-e.end;return fa(this._table,i*this._tableRange+this._minPos,!0)}}pa.id="timeseries",pa.defaults=da.defaults;const ga=[gn,Jr,Wo,Object.freeze({__proto__:null,CategoryScale:Vo,LinearScale:Uo,LogarithmicScale:Go,RadialLinearScale:ra,TimeScale:da,TimeSeriesScale:pa})];Mr.register(...ga);const ma=Mr;var ba=i(3573);function ya(t){var e=t.title,i=t.displayWidth,n=t.scale,r=void 0===n?2:n,o=t.ctx,a=t.fontRatio,s=void 0===a?.06:a,l=t.minFontSize,c=void 0===l?18:l,h=t.maxFontSize,u=void 0===h?45:h,d=t.leftPadding,f=void 0===d?0:d,p=t.topPadding,g=void 0===p?0:p,m=t.bottomSpacing,b=void 0===m?"default":m;if(!e)return{displayTitle:"",fontPx:0,fontDisplay:0,leftPx:0,topPx:0,bottomPx:0,totalHeightPx:0,totalHeightDisplay:0};var y,x=Math.min(Math.max(Math.round(i*s),c),u),v=x*r;y="compact"===b?Math.round(.3*v):"number"==typeof b?b*r:Math.round(.5*v);var _=function(t,e){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:30,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:12;if(!t)return{displayTitle:"",fontSize:i};var r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null;if(r||"undefined"!=typeof document&&"function"==typeof document.createElement&&(r=document.createElement("canvas").getContext("2d")),!r)return{displayTitle:t.length>20?t.substring(0,20)+"…":t,fontSize:n};var o=i;r.font="bold ".concat(o,"px sans-serif");var a=t,s=r.measureText(a).width;if(s>e)for(;a.length>0;){var l=(a=a.slice(0,-1))+"…";if((s=r.measureText(l).width)<=e){a=l;break}}for(r.font="bold ".concat(o,"px sans-serif"),s=r.measureText(a).width;s>e&&o>n;)o-=1,r.font="bold ".concat(o,"px sans-serif"),s=r.measureText(a).width;return{displayTitle:a,fontSize:o}}(e,Math.max(10,i-2*f)*r,v,c*r,o),w=g*r,k=w+v+y;return{displayTitle:_.displayTitle,fontPx:v,fontDisplay:x,leftPx:f*r,leftDisplay:f,topPx:w,topDisplay:g,bottomPx:y,bottomDisplay:y/r,totalHeightPx:k,totalHeightDisplay:k/r}}var xa=i.n(ba)().drawCorrelationChart;function va(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;if(!t.startsWith("#")){var i=document.createElement("canvas");i.width=i.height=1;var n=i.getContext("2d");n.fillStyle=t;var r=n.fillStyle;if(!r.startsWith("#"))return 1===e||t.includes("rgba")?t:t.replace("rgb","rgba").replace(")",", ".concat(e,")"));t=r}var o=parseInt(t.slice(1,3),16),a=parseInt(t.slice(3,5),16),s=parseInt(t.slice(5,7),16);return"rgba(".concat(o,", ").concat(a,", ").concat(s,", ").concat(e,")")}function _a(t,e){var i=document.getElementById(t);return i?(i.chart&&(i.chart.destroy(),i.chart=null),function(t,e){var i=t.parentElement,n=window.getComputedStyle(i),r=parseFloat(n.paddingLeft)||0,o=parseFloat(n.paddingRight)||0,a=i.clientWidth-r-o;if(a<=0)return;var s=Math.min(a,600),l=2*s;if(e.displayWidth=s,e.scale=2,t.style.width=s+"px",t.style.maxWidth="100%",t.style.height="auto","scatter"===e.chartType){var c=t.getContext("2d"),h=ya({title:e.title,displayWidth:s,scale:2,ctx:c});t.width=l,t.height=l+h.totalHeightPx}else if("table"===e.chartType){var u=e.title?1.1:1;t.width=l,t.height=l*u}else if("correlation"===e.chartType){var d=t.getContext("2d"),f=ya({title:e.title,displayWidth:s,scale:2,ctx:d,bottomSpacing:"compact"});t.width=l,t.height=l+f.totalHeightPx}else t.width=l,t.height=l/5*4;switch(e.chartType){case"scatter":return function(t,e){var i,n,r,o,a,s,l,c,h=t.getContext("2d"),u=t.width,d=t.height,f=function(t){var e=.022*u,i=Math.max(.4,1-.018*(t-10)),n=2*(Math.round(e*i*10)/10),r=Math.max(.02*u,16);return n=Math.max(n,r),n=Math.min(n,60)},p=(f(10),ya({title:e.title,displayWidth:e.displayWidth,scale:e.scale,ctx:h})),g=p.totalHeightPx,m=.02*u,b=function(t){if(!t)return 0;var e=Array.isArray(t)?t:[t];return f(e.length)},y=b(null===(i=e.labels)||void 0===i?void 0:i.left),x=b(null===(n=e.labels)||void 0===n?void 0:n.right),v=null!==(r=e.labels)&&void 0!==r&&r.top?Math.min(e.labels.top.length,30):0,_=null!==(o=e.labels)&&void 0!==o&&o.bottom?Math.min(e.labels.bottom.length,30):0,w=v>0?f(v):0,k=_>0?f(_):0,S=y>0?1.5*y:0,M=x>0?1.5*x:0,D=w>0?1.3*w:0,P=k>0?1.3*k:0,T=Math.max(m,Math.max(S,M)),C=Math.max(m,Math.max(D,P)),E=d-g,O=Math.min(u-2*T,E-2*C),A=T,L=g+C,I=A+O,F=L+O,R={x:A+O/2,y:L+O/2};h.fillStyle="white",h.fillRect(0,0,u,d),p.displayTitle&&(h.font="bold ".concat(p.fontPx,"px sans-serif"),h.fillStyle="#333333",h.textAlign="left",h.textBaseline="top",h.fillText(p.displayTitle,p.leftPx,p.topPx));h.strokeStyle="#AAA",h.lineWidth=.8,h.beginPath(),h.moveTo(A,R.y),h.lineTo(I,R.y),h.moveTo(R.x,L),h.lineTo(R.x,F),h.stroke(),h.fillStyle="#222";var z=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:30;return t.length>e?t.substring(0,e):t};if(null!==(a=e.labels)&&void 0!==a&&a.left){var j=Array.isArray(e.labels.left)?e.labels.left:[e.labels.left],B=j.length,W=f(B);h.font="".concat(W,"px sans-serif"),h.textAlign="center",h.textBaseline="middle";var N=A-.5*W,V=1.1*W,H=j.length*V,q=R.y-H/2+V/2;j.forEach(function(t,e){h.fillText(t,N,q+V*e)})}if(null!==(s=e.labels)&&void 0!==s&&s.right){var $=Array.isArray(e.labels.right)?e.labels.right:[e.labels.right],U=$.length,Y=f(U);h.font="".concat(Y,"px sans-serif"),h.textAlign="center",h.textBaseline="middle";var G=I+.5*Y,X=1.1*Y,Z=$.length*X,Q=R.y-Z/2+X/2;$.forEach(function(t,e){h.fillText(t,G,Q+X*e)})}if(null!==(l=e.labels)&&void 0!==l&&l.top){var J=z(e.labels.top),K=J.length,tt=f(K);h.font="".concat(tt,"px sans-serif"),h.textAlign="center",h.textBaseline="bottom";var et=.3*tt;h.fillText(J,R.x,L-et)}if(null!==(c=e.labels)&&void 0!==c&&c.bottom){var it=z(e.labels.bottom),nt=it.length,rt=f(nt);h.font="".concat(rt,"px sans-serif"),h.textAlign="center",h.textBaseline="top";var ot=.3*rt;h.fillText(it,R.x,F+ot)}var at=.033*e.displayWidth*e.scale,st=parseFloat(e.x)||0,lt=parseFloat(e.y)||0,ct=(st+100)/200,ht=(100-lt)/200,ut=Math.round(O*ct+A),dt=Math.round(O*ht+L),ft=e.color||"#ff6384";h.beginPath(),h.arc(ut,dt,at,0,2*Math.PI),h.fillStyle="#FFFFFF",h.fill(),h.beginPath(),h.arc(ut,dt,.85*at,0,2*Math.PI),h.fillStyle=ft,h.fill()}(t,e),null;case"table":return function(t,e){var i=t.getContext("2d"),n=t.width,r=t.height,o=ya({title:e.title,displayWidth:e.displayWidth,scale:e.scale,ctx:i}),a=o.totalHeightPx,s=2,l=r-a,c=Math.min(n-2*s,l-2*s),h=s,u=a+s;if(!e.data||!Array.isArray(e.data)||0===e.data.length)return i.fillStyle="#f8f9fa",i.fillRect(0,0,n,r),i.fillStyle="#dc3545",i.font="28px sans-serif",i.textAlign="center",i.textBaseline="middle",void i.fillText("テーブルデータがありません",n/2,r/2);var d=e.data.length,f=e.data[0]?e.data[0].length:0;if(0===d||0===f)return;var p=c/f,g=c/d,m=function(t,e){return t&&""!==t?"_randomColor_"===t||t.includes("${")?"#000000":/^#[0-9A-Fa-f]{3,8}$/.test(t)||/^rgb/.test(t)||/^[a-zA-Z]+$/.test(t)?t:"#000000":e},b=function(t,e,i){if(!t)return"";t=String(t).replace(/\[.*?\]/g,"");var n,r=Math.min(e,i);return n=r<60?10:r<100?15:r<200?20:30,t.length>n&&(t=t.substring(0,n)),t},y=function(t,e,n){if(i.font="".concat(n,"px sans-serif"),i.measureText(t).width<=e)return[t];for(var r=[],o="",a=0;a<t.length;a++){var s=o+t[a];i.measureText(s).width>e?o?(r.push(o),o=t[a]):r.push(t[a]):o=s}return o&&r.push(o),r},x=m(e.borderColor,"#BBBBBB"),v=m(e.textColor,"#000000"),_=m(e.backgroundColor,"#FFFFFF");i.fillStyle=_,i.fillRect(0,0,n,r),o.displayTitle&&(i.font="bold ".concat(o.fontPx,"px sans-serif"),i.fillStyle="#333333",i.textAlign="left",i.textBaseline="top",i.fillText(o.displayTitle,o.leftPx,o.topPx));i.strokeStyle=x,i.lineWidth=3,i.strokeRect(h,u,c,c);for(var w=0;w<d;w++)for(var k=function(){var t=e.data[w][S]||{},n=h+S*p,r=u+w*g,o=m(t.bgcolor,_),a=m(t.color,v);o!==_&&(i.fillStyle=o,i.fillRect(n,r,p,g)),i.strokeStyle=x,i.lineWidth=1,i.strokeRect(n,r,p,g);var s=b(t.text,p,g);if(s){var l,c=.05*p,d=p-2*c,f=g-2*c,k=Math.min(p,g);l=k<60?.28:k<100?.32:k<200?.35:.38;for(var M=Math.min(g*l,40),D=y(s,d,M),P=1.2*M,T=D.length*P;T>f&&M>8;)P=1.2*(M-=3),T=(D=y(s,d,M)).length*P;i.fillStyle=a,i.font="".concat(M,"px sans-serif"),i.textAlign="center",i.textBaseline="middle";var C=r+g/2-T/2+P/2;D.forEach(function(t,e){var r=C+e*P;i.fillText(t,n+p/2,r)})}},S=0;S<f;S++)k()}(t,e),null;case"correlation":var p=t.getContext("2d"),g=ya({title:e.title,displayWidth:e.displayWidth,scale:e.scale,ctx:p,bottomSpacing:"compact"});return xa(t,e,{verticalAlign:"top",offsetY:g.totalHeightPx}),g.displayTitle&&(p.font="bold ".concat(g.fontPx,"px sans-serif"),p.fillStyle="#333333",p.textAlign="left",p.textBaseline="top",p.fillText(g.displayTitle,g.leftPx,g.topPx)),t.dataset.chartRendered="true",null;default:var m=function(t,e){var i=e.displayWidth,n=Math.round(.04*i);n=Math.max(10,Math.min(n,17));var r,o,a,s=Math.round(1.3*n);if(s=Math.max(13,Math.min(s,22)),ma.defaults.font.size=n,"radar"===e.chartType){var l=e.color||"#ff6384";r=va(l,.2),o=l,a=4}else if("line"===e.chartType){var c=e.color||"#ff6384";r=va(c,.2),o=c,a=4}else if("bar"===e.chartType||"pie"===e.chartType){for(var h,u=e.colors||["#ff6384","#36a2eb","#ffce56","#4bc0c0","#9966ff"],d=(null===(h=e.data)||void 0===h?void 0:h.length)||0,f=[],p=0;p<d;p++)p<u.length?f.push(u[p]):f.push(u[p%u.length]);r="pie"===e.chartType?f:f.map(function(t){return va(t,.8)}),o=f,a="pie"===e.chartType?.2:e.borderWidth||2}var g=e.data||[];if("pie"===e.chartType&&e.total&&e.total>0){var m=g.reduce(function(t,e){return t+(parseFloat(e)||0)},0);if(m>0){for(var b=e.total/m,y=[],x=0,v=0;v<g.length-1;v++){var _=parseFloat(g[v])||0,w=Math.round(_*b*10)/10;y.push(w),x+=w}if(g.length>0){var k=Math.round(10*(e.total-x))/10;y.push(k)}g=y}}var S={data:g,backgroundColor:r,borderColor:o,borderWidth:a,pointBackgroundColor:o,pointBorderColor:o,pointBorderWidth:2,pointRadius:5,pointHoverRadius:5};"line"===e.chartType&&(S.fill=!0,S.tension=.4);var M=t.getContext("2d"),D=ya({title:e.title,displayWidth:e.displayWidth,scale:e.scale,ctx:M}),P={type:e.chartType,data:{labels:e.labels||[],datasets:[S]},options:{responsive:!0,animation:!1!==e.animation&&{duration:1500},layout:{padding:{top:D.totalHeightDisplay||0,left:0,right:0,bottom:0}},plugins:{legend:{display:"pie"===e.chartType||(e.showLegend||!1),position:e.legendPosition||("pie"===e.chartType?"right":"top")},title:{display:!1}}},plugins:[{id:"customTitle",afterDraw:function(t){if(D.displayTitle){var e=t.ctx;e.save(),e.font="bold ".concat(D.fontDisplay,"px sans-serif"),e.fillStyle="#333333",e.textAlign="left",e.textBaseline="top",e.fillText(D.displayTitle,D.leftDisplay,D.topDisplay),e.restore()}}}]};P.data.labels&&Array.isArray(P.data.labels)&&(P.data.labels=P.data.labels.map(function(t){return"string"==typeof t&&t.length>10?t.substring(0,10)+"...":t}));if("radar"===e.chartType){var T={beginAtZero:!0,min:0,maxTicksLimit:6,color:"#999999",font:{size:n,family:"sans-serif"}};void 0!==e.max&&null!==e.max&&""!==e.max&&(T.max=Number(e.max)),void 0!==e.stepSize&&null!==e.stepSize&&""!==e.stepSize&&(T.stepSize=parseFloat(e.stepSize)),P.options.scales={r:{beginAtZero:!0,min:0,max:T.max,ticks:T,grid:{color:"rgba(0,0,0,0.1)"},pointLabels:{font:{size:s},color:"#222222"}}}}if("bar"===e.chartType||"line"===e.chartType){var C={maxTicksLimit:6,color:"#999999",font:{size:n}};void 0!==e.stepSize&&null!==e.stepSize&&""!==e.stepSize&&(C.stepSize=parseFloat(e.stepSize));var E={ticks:C};void 0!==e.min&&null!==e.min&&""!==e.min?(E.min=parseInt(e.min,10),E.beginAtZero=0===parseInt(e.min,10)):E.beginAtZero=!0,void 0!==e.max&&null!==e.max&&""!==e.max&&(E.max=parseInt(e.max,10)),P.options.scales={x:{ticks:{color:"#666666",font:{size:n}}},y:E}}try{var O=new ma(t,P);return t.chart=O,O}catch(t){return null}}(t,e);return t.dataset.chartRendered="true",m}}(i,e)):null}"undefined"!=typeof window&&(window.drawChartV2=_a)},8878:t=>{function e(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var i=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=i){var n,r,o,a,s=[],l=!0,c=!1;try{if(o=(i=i.call(t)).next,0===e){if(Object(i)!==i)return;l=!1}else for(;!(l=(n=o.call(i)).done)&&(s.push(n.value),s.length!==e);l=!0);}catch(t){c=!0,r=t}finally{try{if(!l&&null!=i.return&&(a=i.return(),Object(a)!==a))return}finally{if(c)throw r}}return s}}(t,e)||a(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function i(){var t,e,r="function"==typeof Symbol?Symbol:{},o=r.iterator||"@@iterator",a=r.toStringTag||"@@toStringTag";function s(i,r,o,a){var s=r&&r.prototype instanceof c?r:c,h=Object.create(s.prototype);return n(h,"_invoke",function(i,n,r){var o,a,s,c=0,h=r||[],u=!1,d={p:0,n:0,v:t,a:f,f:f.bind(t,4),d:function(e,i){return o=e,a=0,s=t,d.n=i,l}};function f(i,n){for(a=i,s=n,e=0;!u&&c&&!r&&e<h.length;e++){var r,o=h[e],f=d.p,p=o[2];i>3?(r=p===n)&&(s=o[(a=o[4])?5:(a=3,3)],o[4]=o[5]=t):o[0]<=f&&((r=i<2&&f<o[1])?(a=0,d.v=n,d.n=o[1]):f<p&&(r=i<3||o[0]>n||n>p)&&(o[4]=i,o[5]=n,d.n=p,a=0))}if(r||i>1)return l;throw u=!0,n}return function(r,h,p){if(c>1)throw TypeError("Generator is already running");for(u&&1===h&&f(h,p),a=h,s=p;(e=a<2?t:s)||!u;){o||(a?a<3?(a>1&&(d.n=-1),f(a,s)):d.n=s:d.v=s);try{if(c=2,o){if(a||(r="next"),e=o[r]){if(!(e=e.call(o,s)))throw TypeError("iterator result is not an object");if(!e.done)return e;s=e.value,a<2&&(a=0)}else 1===a&&(e=o.return)&&e.call(o),a<2&&(s=TypeError("The iterator does not provide a '"+r+"' method"),a=1);o=t}else if((e=(u=d.n<0)?s:i.call(n,d))!==l)break}catch(e){o=t,a=1,s=e}finally{c=1}}return{value:e,done:u}}}(i,o,a),!0),h}var l={};function c(){}function h(){}function u(){}e=Object.getPrototypeOf;var d=[][o]?e(e([][o]())):(n(e={},o,function(){return this}),e),f=u.prototype=c.prototype=Object.create(d);function p(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,u):(t.__proto__=u,n(t,a,"GeneratorFunction")),t.prototype=Object.create(f),t}return h.prototype=u,n(f,"constructor",u),n(u,"constructor",h),h.displayName="GeneratorFunction",n(u,a,"GeneratorFunction"),n(f),n(f,a,"Generator"),n(f,o,function(){return this}),n(f,"toString",function(){return"[object Generator]"}),(i=function(){return{w:s,m:p}})()}function n(t,e,i,r){var o=Object.defineProperty;try{o({},"",{})}catch(t){o=0}n=function(t,e,i,r){function a(e,i){n(t,e,function(t){return this._invoke(e,i,t)})}e?o?o(t,e,{value:i,enumerable:!r,configurable:!r,writable:!r}):t[e]=i:(a("next",0),a("throw",1),a("return",2))},n(t,e,i,r)}function r(t){return function(t){if(Array.isArray(t))return s(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||a(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function o(t,e){var i="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!i){if(Array.isArray(t)||(i=a(t))||e&&t&&"number"==typeof t.length){i&&(t=i);var n=0,r=function(){};return{s:r,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,l=!1;return{s:function(){i=i.call(t)},n:function(){var t=i.next();return s=t.done,t},e:function(t){l=!0,o=t},f:function(){try{s||null==i.return||i.return()}finally{if(l)throw o}}}}function a(t,e){if(t){if("string"==typeof t)return s(t,e);var i={}.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?s(t,e):void 0}}function s(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=Array(e);i<e;i++)n[i]=t[i];return n}function l(t,e,i,n,r,o,a){try{var s=t[o](a),l=s.value}catch(t){return void i(t)}s.done?e(l):Promise.resolve(l).then(n,r)}function c(t){return function(){var e=this,i=arguments;return new Promise(function(n,r){var o=t.apply(e,i);function a(t){l(o,n,r,a,s,"next",t)}function s(t){l(o,n,r,a,s,"throw",t)}a(void 0)})}}var h=[{key:"ogp",label:"OGP",width:1200,height:630,aspectRatio:1200/630,icon:"fas fa-fw fa-rectangle-wide"},{key:"4:3",label:"4:3",width:1200,height:900,aspectRatio:1200/900,icon:"fas fa-fw fa-rectangle-wide"},{key:"square",label:"1:1",width:1200,height:1200,aspectRatio:1,icon:"fas fa-fw fa-square"},{key:"3:4",label:"3:4",width:900,height:1200,aspectRatio:.75,icon:"fas fa-fw fa-rectangle-vertical"}];function u(t,e){return d.apply(this,arguments)}function d(){return d=c(i().m(function t(e,n){var a,s,l,c,h,u,d,f,m,b,y,x,v,_,w,k,S=arguments;return i().w(function(t){for(;;)switch(t.p=t.n){case 0:if(s=(a=S.length>2&&void 0!==S[2]?S[2]:{}).ctx||e.getContext("2d")){t.n=1;break}throw new Error("Canvas 2D context is required");case 1:if(l=n.canvas||{},c=n.objects||[],"undefined"==typeof document){t.n=2;break}if(!((h=T(c)).fonts.length>0)){t.n=2;break}return t.n=2,C(h);case 2:u=e.width,d=e.height,f=u/(l.width||1200),m=d/(l.height||630),b=a.scale||Math.min(f,m),s.fillStyle=l.backgroundColor||"#ffffff",s.fillRect(0,0,u,d),y=r(c).sort(function(t,e){return(parseInt(t.zIndex)||0)-(parseInt(e.zIndex)||0)}),x=o(y),t.p=3,x.s();case 4:if((v=x.n()).done){t.n=13;break}if(!1!==(_=v.value).visible&&"false"!==_.visible&&"0"!==_.visible){t.n=5;break}return t.a(3,12);case 5:t.p=5,w=_.type,t.n="shape"===w?6:"image"===w?7:"text"===w?9:10;break;case 6:return p(s,_.params,b,a),t.a(3,10);case 7:return t.n=8,g(s,_.params,b,a);case 8:return t.a(3,10);case 9:return D(s,_.params,b),t.a(3,10);case 10:t.n=12;break;case 11:t.p=11,t.v;case 12:t.n=4;break;case 13:t.n=15;break;case 14:t.p=14,k=t.v,x.e(k);case 15:return t.p=15,x.f(),t.f(15);case 16:return t.a(2)}},t,null,[[5,11],[3,14,15,16]])})),d.apply(this,arguments)}var f={speechBubble:"M 10 5 Q 5 5 5 10 L 5 60 Q 5 65 10 65 L 45 65 L 50 73 L 55 65 L 90 65 Q 95 65 95 60 L 95 10 Q 95 5 90 5 Z",roundBubble:"M 50 5 C 85 5 95 20 95 35 C 95 50 85 65 55 65 L 50 73 L 45 65 C 15 65 5 50 5 35 C 5 20 15 5 50 5 Z",shoutBubble:"M 91.1 37.1 L 97.5 33.4 L 91.1 29.7 L 97.3 25.2 L 90.3 22.2 L 96.1 16.9 L 88.8 15.7 L 93.0 8.2 L 84.6 10.4 L 84.8 3.4 L 76.5 7.5 L 75.4 1.7 L 68.3 7.1 L 65.4 1.9 L 59.2 7.1 L 55.0 2.3 L 50.0 7.1 L 45.0 2.3 L 40.8 7.1 L 34.6 1.9 L 31.7 7.1 L 24.6 1.7 L 23.5 7.5 L 15.2 3.4 L 15.4 10.4 L 7.0 8.2 L 11.2 15.7 L 3.9 16.9 L 9.7 22.2 L 2.7 25.2 L 8.9 29.7 L 2.5 33.4 L 8.9 37.1 L 2.7 42.3 L 9.7 44.5 L 3.9 51.1 L 11.2 51.2 L 7.0 58.6 L 15.4 56.4 L 15.2 63.5 L 23.5 59.3 L 24.6 65.2 L 31.7 59.7 L 34.6 65.0 L 40.8 59.7 L 45.0 64.6 L 50.0 59.7 L 55.0 64.6 L 59.2 59.7 L 65.4 65.0 L 68.3 59.7 L 75.4 65.2 L 76.5 59.3 L 84.8 63.5 L 84.6 56.4 L 93.0 58.6 L 88.8 51.2 L 96.1 51.1 L 90.3 44.5 L 97.3 42.3 Z",thoughtBubble:"M 20 5 L 80 5 Q 88 5 88 12 Q 95 12 95 20 L 95 50 Q 95 58 88 58 Q 88 65 80 65 L 20 65 Q 12 65 12 58 Q 5 58 5 50 L 5 20 Q 5 12 12 12 Q 12 5 20 5 Z M 47 68 C 43 68 43 72 47 72 C 51 72 51 68 47 68 Z M 50 73 C 47 73 47 76 50 76 C 53 76 53 73 50 73 Z",roundedRectBubble:"M 15 10 L 85 10 Q 95 10 95 20 L 95 45 Q 95 55 85 55 L 15 55 L 5 55 L 5 20 Q 5 10 15 10 Z",circle:"M 50 5 C 75 5 95 25 95 50 C 95 75 75 95 50 95 C 25 95 5 75 5 50 C 5 25 25 5 50 5 Z",triangle:"M 50 5 L 95 85 L 5 85 Z",rect:null,hexagon:"M 50 5 L 93 27 L 93 73 L 50 95 L 7 73 L 7 27 Z",star:"M 50 5 L 61 35 L 95 38 L 70 58 L 78 90 L 50 72 L 22 90 L 30 58 L 5 38 L 39 35 Z",heart:"M 50 88 Q 10 55 10 30 Q 10 10 30 10 Q 45 10 50 25 Q 55 10 70 10 Q 90 10 90 30 Q 90 55 50 88 Z"};function p(t,e,i){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},r=(parseFloat(e.x)||0)*i,o=(parseFloat(e.y)||0)*i,a=(parseFloat(e.width)||100)*i,s=(parseFloat(e.height)||100)*i,l=parseFloat(e.rotation)||0,c=e.shapeType||"rect";if(t.save(),t.translate(r,o),t.rotate(l*Math.PI/180),"rect"!==c&&f[c]){var h=f[c],u=a/100,d=s/100;t.scale(u,d);var p=n.Path2D||("undefined"!=typeof Path2D?Path2D:null);if(p){var g=new p(h);e.fill&&(t.fillStyle=e.fill,t.fill(g));var m=parseFloat(e.strokeWidth)||0;if(e.stroke&&m>0){t.restore(),t.save(),t.translate(r,o),t.rotate(l*Math.PI/180);var b=new p,y=h.match(/[MLQCZ][^MLQCZ]*/gi);y&&y.forEach(function(t){var e=t[0].toUpperCase(),i=t.slice(1).trim().split(/[\s,]+/).map(parseFloat).filter(function(t){return!isNaN(t)});switch(e){case"M":i.length>=2&&b.moveTo(i[0]*u,i[1]*d);break;case"L":i.length>=2&&b.lineTo(i[0]*u,i[1]*d);break;case"Q":i.length>=4&&b.quadraticCurveTo(i[0]*u,i[1]*d,i[2]*u,i[3]*d);break;case"C":i.length>=6&&b.bezierCurveTo(i[0]*u,i[1]*d,i[2]*u,i[3]*d,i[4]*u,i[5]*d);break;case"Z":b.closePath()}}),t.strokeStyle=e.stroke,t.lineWidth=m*i,t.stroke(b)}}else{!function(t,e){t.beginPath();var i=e.match(/[MLQCZ][^MLQCZ]*/gi);i&&i.forEach(function(e){var i=e[0].toUpperCase(),n=e.slice(1).trim().split(/[\s,]+/).map(parseFloat).filter(function(t){return!isNaN(t)});switch(i){case"M":n.length>=2&&t.moveTo(n[0],n[1]);break;case"L":n.length>=2&&t.lineTo(n[0],n[1]);break;case"Q":n.length>=4&&t.quadraticCurveTo(n[0],n[1],n[2],n[3]);break;case"C":n.length>=6&&t.bezierCurveTo(n[0],n[1],n[2],n[3],n[4],n[5]);break;case"Z":t.closePath()}})}(t,h),e.fill&&(t.fillStyle=e.fill,t.fill());var x=parseFloat(e.strokeWidth)||0;if(e.stroke&&x>0){t.restore(),t.save(),t.translate(r,o),t.rotate(l*Math.PI/180),t.beginPath();var v=h.match(/[MLQCZ][^MLQCZ]*/gi);v&&v.forEach(function(e){var i=e[0].toUpperCase(),n=e.slice(1).trim().split(/[\s,]+/).map(parseFloat).filter(function(t){return!isNaN(t)});switch(i){case"M":n.length>=2&&t.moveTo(n[0]*u,n[1]*d);break;case"L":n.length>=2&&t.lineTo(n[0]*u,n[1]*d);break;case"Q":n.length>=4&&t.quadraticCurveTo(n[0]*u,n[1]*d,n[2]*u,n[3]*d);break;case"C":n.length>=6&&t.bezierCurveTo(n[0]*u,n[1]*d,n[2]*u,n[3]*d,n[4]*u,n[5]*d);break;case"Z":t.closePath()}}),t.strokeStyle=e.stroke,t.lineWidth=x*i,t.stroke()}}}else{t.beginPath(),t.rect(0,0,a,s),e.fill&&(t.fillStyle=e.fill,t.fill());var _=parseFloat(e.strokeWidth)||0;e.stroke&&_>0&&(t.strokeStyle=e.stroke,t.lineWidth=_*i,t.stroke())}t.restore()}function g(t,e,i){return m.apply(this,arguments)}function m(){return m=c(i().m(function t(e,n,r){var o,a,s,l,c,h,u,d,f,p,g,m,y,x,v,_,w=arguments;return i().w(function(t){for(;;)switch(t.n){case 0:if(o=w.length>3&&void 0!==w[3]?w[3]:{},a=(parseFloat(n.x)||0)*r,s=(parseFloat(n.y)||0)*r,l=(parseFloat(n.width)||100)*r,c=(parseFloat(n.height)||100)*r,h=null,u=o.imageMap||{},"static"!==n.sourceType||!n.imageData){t.n=1;break}h=u[n.imageData]||n.imageData,t.n=4;break;case 1:if("dynamic"!==n.sourceType||!n.imageSource){t.n=4;break}if(!o.getImageUrl){t.n=3;break}return t.n=2,o.getImageUrl(n.imageSource);case 2:h=t.v,t.n=4;break;case 3:return e.fillStyle="#e9ecef",e.fillRect(a,s,l,c),e.fillStyle="#6c757d",e.font="".concat(12*r,"px sans-serif"),e.textAlign="center",e.textBaseline="middle",e.fillText("画像",a+l/2,s+c/2),t.a(2);case 4:if(h){t.n=5;break}return e.fillStyle="#e9ecef",e.fillRect(a,s,l,c),t.a(2);case 5:return t.n=6,b(h,o);case 6:(d=t.v)&&("circle"===(f=n.shape||"rectangle")||"ellipse"===f?(e.save(),e.beginPath(),"circle"===f?(p=Math.min(l,c)/2,g=a+l/2,m=s+c/2,e.arc(g,m,p,0,2*Math.PI)):(y=a+l/2,x=s+c/2,v=l/2,_=c/2,e.ellipse(y,x,v,_,0,0,2*Math.PI)),e.clip(),e.drawImage(d,a,s,l,c),e.restore()):e.drawImage(d,a,s,l,c));case 7:return t.a(2)}},t)})),m.apply(this,arguments)}function b(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise(function(i){if(e.loadImage){var n=setTimeout(function(){i(null)},1e4);e.loadImage(t).then(function(t){clearTimeout(n),i(t)}).catch(function(t){clearTimeout(n),i(null)})}else{if("undefined"!=typeof Image){var r=new Image;return t.startsWith("data:")||t.startsWith("blob:")||t.includes("localhost")||t.startsWith("/storage/")||(r.crossOrigin="anonymous"),r.onload=function(){return i(r)},r.onerror=function(){return i(null)},void(r.src=t)}i(null)}})}function y(t,e,i,n,r,o,a,s){for(var l=arguments.length>8&&void 0!==arguments[8]?arguments[8]:1.4,c=r;c>8;){var h="";a&&(h+="bold "),s&&(h+="italic "),h+="".concat(c,'px "').concat(o,'", sans-serif'),t.font=h;var u=c*l;if(P(t,e,i).length*u<=n)return c;c-=1}return 8}function x(t,e,i,n,r,a,s,l){for(var c=arguments.length>8&&void 0!==arguments[8]?arguments[8]:1.4,h=r;h>8;){var u="";s&&(u+="bold "),l&&(u+="italic "),u+="".concat(h,'px "').concat(a,'", sans-serif'),t.font=u;var d=P(t,e,n),f=h*c;if(d.length*f>i)h-=1;else{var p,g=0,m=o(d);try{for(m.s();!(p=m.n()).done;){var b,y=_(p.value),x=0,v=o(y);try{for(v.s();!(b=v.n()).done;){var w=b.value;x+=t.measureText(w).width}}catch(t){v.e(t)}finally{v.f()}x>g&&(g=x)}}catch(t){m.e(t)}finally{m.f()}if(g<=n)return h;h-=1}}return 8}var v={charSpacing:1,lineSpacing:1.4};function _(t){if("undefined"!=typeof Intl&&Intl.Segmenter){var e=new Intl.Segmenter("ja",{granularity:"grapheme"});return Array.from(e.segment(t),function(t){return t.segment})}return r(t)}var w={rotate90:["「","」","『","』","(",")","(",")","【","】","[","]","[","]","〈","〉","《","》","<",">","<",">","{","}","{","}","ー","-","―","─","〜","~","—","…","‥",":",";"],rotate90Pattern:/^[\x20-\x7E]$/,topRight:["、","。",",","."],smallKana:["ぁ","ぃ","ぅ","ぇ","ぉ","っ","ゃ","ゅ","ょ","ゎ","ァ","ィ","ゥ","ェ","ォ","ッ","ャ","ュ","ョ","ヮ"]};function k(t){return w.rotate90.includes(t)||w.rotate90Pattern&&w.rotate90Pattern.test(t)?90:0}function S(t,e){return w.topRight.includes(t)?{x:.6*e,y:.58*-e}:w.smallKana.includes(t)?{x:.05*e,y:.25*-e}:{x:0,y:0}}function M(t,e,i){var n=(e.x||0)*i,a=(e.y||0)*i,s=(e.width||200)*i,l=(e.height||50)*i,c=e.text||"",h=(e.fontSize||16)*i,u=e.font||"Noto Sans JP",d=e.color||"#000000",f=e.textAlign||"left",p=e.verticalAlign||"top",g=x(t,c,s,l,h,u,e.bold,e.italic,e.lineHeight||1.4),m="";e.bold&&(m+="bold "),e.italic&&(m+="italic "),m+="".concat(g,'px "').concat(u,'", sans-serif'),t.font=m,t.fillStyle=d;var b=e.strokeWidth>0&&e.strokeColor;b&&(t.strokeStyle=e.strokeColor,t.lineWidth=e.strokeWidth*i,t.lineJoin="round",t.miterLimit=2);var y=P(t,c,l),v=g*(e.lineHeight||1.4),w=y.map(function(e){var i,n=0,r=o(_(e));try{for(r.s();!(i=r.n()).done;){var a=i.value;n+=t.measureText(a).width}}catch(t){r.e(t)}finally{r.f()}return n}),M=y.length*v,D=Math.max.apply(Math,r(w)),T=n+s,C=a;"center"===f?C=a+(l-D)/2:"right"===f&&(C=a+l-D),"middle"===p?T=n+s-(s-M)/2:"bottom"===p&&(T=n+M),y.forEach(function(e,i){for(var n=T-(i+.5)*v,r=_(e),o=C,a=0;a<r.length;a++){var s=r[a],l=t.measureText(s).width,c=o+l/2,h=k(s),u=S(s,g),d=n+u.x,f=c+u.y;o+=l,t.save(),t.textBaseline="middle",t.textAlign="center",0!==h?(t.translate(d,f),t.rotate(h*Math.PI/180),b&&t.strokeText(s,0,0),t.fillText(s,0,0)):(b&&t.strokeText(s,d,f),t.fillText(s,d,f)),t.restore()}})}function D(t,e,i){if("vertical"===e.direction)return M(t,e,i);var n=(parseFloat(e.x)||0)*i,r=(parseFloat(e.y)||0)*i,o=(parseFloat(e.width)||200)*i,a=(parseFloat(e.height)||50)*i,s=e.text||"",l=(parseFloat(e.fontSize)||16)*i,c=e.font||"Noto Sans JP",h=e.color||"#000000",u=e.textAlign||"left",d=e.verticalAlign||"top",f=parseFloat(e.lineHeight)||1.4,p=y(t,s,o,a,l,c,e.bold,e.italic,f),g="";e.bold&&(g+="bold "),e.italic&&(g+="italic "),g+="".concat(p,'px "').concat(c,'", sans-serif'),t.font=g,t.fillStyle=h,t.textBaseline="top";var m=n;"center"===u?(t.textAlign="center",m=n+o/2):"right"===u?(t.textAlign="right",m=n+o):t.textAlign="left";var b=r,x=p*f,v=P(t,s,o),_=v.length*x;"middle"===d?b=r+(a-_)/2:"bottom"===d&&(b=r+a-_);var w=parseFloat(e.strokeWidth)||0;if(w>0&&e.strokeColor&&(t.strokeStyle=e.strokeColor,t.lineWidth=w*i,t.lineJoin="round",t.miterLimit=2,v.forEach(function(e,i){t.strokeText(e,m,b+i*x)})),v.forEach(function(e,i){t.fillText(e,m,b+i*x)}),e.underline){t.beginPath();var k=t.measureText(s),S=m;"center"===u?S=m-k.width/2:"right"===u&&(S=m-k.width),t.moveTo(S,b+p+2*i),t.lineTo(S+k.width,b+p+2*i),t.strokeStyle=h,t.lineWidth=1*i,t.stroke()}}function P(t,e,i){var n=[];return e.split("\n").forEach(function(e){if(""!==e){var r="";e.split("").forEach(function(e){var o=r+e;t.measureText(o).width>i&&""!==r?(n.push(r),r=e):r=o}),r&&n.push(r)}else n.push("")}),n.length>0?n:[""]}function T(t){var e={};return t.forEach(function(t){var i;if("text"===t.type&&null!==(i=t.params)&&void 0!==i&&i.font&&"_randomFont_"!==t.params.font){var n=t.params.font,r=t.params.text||"";e[n]||(e[n]=""),e[n]+=r}}),{fonts:Object.keys(e),fontTexts:e}}function C(t){return E.apply(this,arguments)}function E(){return(E=c(i().m(function t(e){var n,r,o,a,s;return i().w(function(t){for(;;)switch(t.n){case 0:if(n=e.fonts,r=e.fontTexts,0!==n.length){t.n=1;break}return t.a(2);case 1:if(o=n.map(function(t){return t.replace(/ /g,"+")}).join("&family="),a="https://fonts.googleapis.com/css2?family=".concat(o,"&display=swap"),!(s=document.getElementById("canvas-diagnosis-fonts"))||s.href!==a){t.n=3;break}return t.n=2,O(r);case 2:case 5:return t.a(2);case 3:return s&&s.remove(),t.n=4,new Promise(function(t){var e=document.createElement("link");e.id="canvas-diagnosis-fonts",e.rel="stylesheet",e.href=a,e.onload=function(){return t()},e.onerror=function(){t()},document.head.appendChild(e)});case 4:return t.n=5,O(r)}},t)}))).apply(this,arguments)}function O(t){return A.apply(this,arguments)}function A(){return(A=c(i().m(function t(n){var r;return i().w(function(t){for(;;)switch(t.n){case 0:return r=Object.entries(n).map(function(t){var i=e(t,2),n=i[0],r=i[1];return Promise.all([16,32,64,128].map(function(t){return document.fonts.load("".concat(t,'px "').concat(n,'"'),r).catch(function(t){})}))}),t.n=1,Promise.all(r);case 1:return t.n=2,document.fonts.ready;case 2:return t.a(2)}},t)}))).apply(this,arguments)}t.exports&&(t.exports={canvasSizeOptions:h,drawCanvasDiagnosis:u,drawShape:p,drawImage:g,drawText:D,drawVerticalText:M,wrapText:P,loadImage:b,shapeTypePaths:f,shapeTypeBounds:{speechBubble:{width:90,height:68},roundBubble:{width:90,height:68},shoutBubble:{width:95,height:63.5},thoughtBubble:{width:90,height:71},roundedRectBubble:{width:90,height:45},circle:{width:90,height:90},triangle:{width:90,height:80},rect:{width:100,height:100},hexagon:{width:86,height:90},star:{width:90,height:85},heart:{width:80,height:78}},verticalTextRules:w,getCharRotation:k,getCharOffset:S,calculateFitFontSize:y,calculateFitFontSizeVertical:x,TEXT_SPACING:v,splitGraphemes:_}),"undefined"!=typeof window&&(window.canvasDiagnosisCommon={canvasSizeOptions:h,drawCanvasDiagnosis:u,drawShape:p,drawImage:g,drawText:D,drawVerticalText:M,wrapText:P,loadImage:b,shapeTypePaths:f,verticalTextRules:w,getCharRotation:k,getCharOffset:S,calculateFitFontSize:y,calculateFitFontSizeVertical:x,TEXT_SPACING:v,splitGraphemes:_})}},e={};function i(n){var r=e[n];if(void 0!==r)return r.exports;var o=e[n]={exports:{}};return t[n](o,o.exports,i),o.exports}i.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return i.d(e,{a:e}),e},i.d=(t,e)=>{for(var n in e)i.o(e,n)&&!i.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},i.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),(()=>{"use strict";var t=i(7059);function e(t){return JSON.stringify(t).replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}var n=i(8878);function r(t,e){var i="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!i){if(Array.isArray(t)||(i=p(t))||e&&t&&"number"==typeof t.length){i&&(t=i);var n=0,r=function(){};return{s:r,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){i=i.call(t)},n:function(){var t=i.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==i.return||i.return()}finally{if(s)throw o}}}}function o(t){return o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},o(t)}function a(){var t,e,i="function"==typeof Symbol?Symbol:{},n=i.iterator||"@@iterator",r=i.toStringTag||"@@toStringTag";function o(i,n,r,o){var a=n&&n.prototype instanceof c?n:c,h=Object.create(a.prototype);return s(h,"_invoke",function(i,n,r){var o,a,s,c=0,h=r||[],u=!1,d={p:0,n:0,v:t,a:f,f:f.bind(t,4),d:function(e,i){return o=e,a=0,s=t,d.n=i,l}};function f(i,n){for(a=i,s=n,e=0;!u&&c&&!r&&e<h.length;e++){var r,o=h[e],f=d.p,p=o[2];i>3?(r=p===n)&&(s=o[(a=o[4])?5:(a=3,3)],o[4]=o[5]=t):o[0]<=f&&((r=i<2&&f<o[1])?(a=0,d.v=n,d.n=o[1]):f<p&&(r=i<3||o[0]>n||n>p)&&(o[4]=i,o[5]=n,d.n=p,a=0))}if(r||i>1)return l;throw u=!0,n}return function(r,h,p){if(c>1)throw TypeError("Generator is already running");for(u&&1===h&&f(h,p),a=h,s=p;(e=a<2?t:s)||!u;){o||(a?a<3?(a>1&&(d.n=-1),f(a,s)):d.n=s:d.v=s);try{if(c=2,o){if(a||(r="next"),e=o[r]){if(!(e=e.call(o,s)))throw TypeError("iterator result is not an object");if(!e.done)return e;s=e.value,a<2&&(a=0)}else 1===a&&(e=o.return)&&e.call(o),a<2&&(s=TypeError("The iterator does not provide a '"+r+"' method"),a=1);o=t}else if((e=(u=d.n<0)?s:i.call(n,d))!==l)break}catch(e){o=t,a=1,s=e}finally{c=1}}return{value:e,done:u}}}(i,r,o),!0),h}var l={};function c(){}function h(){}function u(){}e=Object.getPrototypeOf;var d=[][n]?e(e([][n]())):(s(e={},n,function(){return this}),e),f=u.prototype=c.prototype=Object.create(d);function p(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,u):(t.__proto__=u,s(t,r,"GeneratorFunction")),t.prototype=Object.create(f),t}return h.prototype=u,s(f,"constructor",u),s(u,"constructor",h),h.displayName="GeneratorFunction",s(u,r,"GeneratorFunction"),s(f),s(f,r,"Generator"),s(f,n,function(){return this}),s(f,"toString",function(){return"[object Generator]"}),(a=function(){return{w:o,m:p}})()}function s(t,e,i,n){var r=Object.defineProperty;try{r({},"",{})}catch(t){r=0}s=function(t,e,i,n){function o(e,i){s(t,e,function(t){return this._invoke(e,i,t)})}e?r?r(t,e,{value:i,enumerable:!n,configurable:!n,writable:!n}):t[e]=i:(o("next",0),o("throw",1),o("return",2))},s(t,e,i,n)}function l(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),i.push.apply(i,n)}return i}function c(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?l(Object(i),!0).forEach(function(e){h(t,e,i[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):l(Object(i)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))})}return t}function h(t,e,i){return(e=d(e))in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function u(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,d(n.key),n)}}function d(t){var e=function(t,e){if("object"!=o(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,e||"default");if("object"!=o(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==o(e)?e:e+""}function f(t){return function(t){if(Array.isArray(t))return g(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||p(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function p(t,e){if(t){if("string"==typeof t)return g(t,e);var i={}.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?g(t,e):void 0}}function g(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=Array(e);i<e;i++)n[i]=t[i];return n}function m(t,e,i,n,r,o,a){try{var s=t[o](a),l=s.value}catch(t){return void i(t)}s.done?e(l):Promise.resolve(l).then(n,r)}function b(t){return function(){var e=this,i=arguments;return new Promise(function(n,r){var o=t.apply(e,i);function a(t){m(o,n,r,a,s,"next",t)}function s(t){m(o,n,r,a,s,"throw",t)}a(void 0)})}}var y="100%",x="500px",v="100%",_="280px",w="220px",k="3000px",S="250px",M="720px";function D(t){return"function"==typeof window.htmlspecialchars?window.htmlspecialchars(t):"string"!=typeof t?"":t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function P(){return new Promise(function(t){return requestAnimationFrame(t)})}function T(t){return C.apply(this,arguments)}function C(){return(C=b(a().m(function t(e){var i,n,r,o,s,l;return a().w(function(t){for(;;)switch(t.n){case 0:i=1e3,n=10,r=Date.now();case 1:if(!(Date.now()-r<i)){t.n=8;break}return t.n=2,P();case 2:if(!((o=e.querySelectorAll(".typing-effect-block, .shuffle-effect-block, .text-block, .vertical-block")).length>0)){t.n=6;break}if((s=o[0]).isConnected){t.n=4;break}return t.n=3,new Promise(function(t){return setTimeout(t,n)});case 3:return t.a(3,1);case 4:if(""===(l=window.getComputedStyle(s)).opacity||""===l.display){t.n=5;break}return t.a(2,!0);case 5:case 6:return t.n=7,new Promise(function(t){return setTimeout(t,n)});case 7:t.n=1;break;case 8:return t.a(2,!1)}},t)}))).apply(this,arguments)}function E(t){if("undefined"!=typeof Intl&&Intl.Segmenter){var e=new Intl.Segmenter(void 0,{granularity:"grapheme"}).segment(t);return Array.from(e,function(t){return t.segment})}for(var i=[],n=0;n<t.length;){var r=t[n],o=t.charCodeAt(n);if(o>=55296&&o<=56319&&n+1<t.length){var a=t.charCodeAt(n+1);a>=56320&&a<=57343&&(r=t[n]+t[n+1],n++)}for(;n+1<t.length;){var s=t[n+1],l=t.charCodeAt(n+1);if(l>=3633&&l<=3642||l>=3655&&l<=3662)r+=s,n++;else if(""===s){if(r+=s,++n+1<t.length){var c=t[n+1],h=t.charCodeAt(n+1);if(h>=55296&&h<=56319&&n+2<t.length){var u=t.charCodeAt(n+2);u>=56320&&u<=57343&&(c=t[n+1]+t[n+2],n++)}r+=c,n++}}else{if(65038!==l&&65039!==l)break;r+=s,n++}}i.push(r),n++}return i}function O(t){return new Promise(function(e){if(t.element&&t.content)if(t.element.isConnected){for(;t.element.firstChild;)t.element.removeChild(t.element.firstChild);t.element.style.display="inline",t.element.style.verticalAlign="top";var i=document.createElement("span");if(i.className="typing-cursor",i.textContent="│",i.style.display="inline",i.style.animation="blink 0.6s infinite",i.style.fontWeight="normal",i.style.marginLeft="1px",i.style.color="#000000",i.style.fontFamily="monospace",i.style.fontSize="1.1em",i.style.verticalAlign="baseline",t.element.appendChild(i),!document.querySelector("#typing-cursor-style")){var n=document.createElement("style");n.id="typing-cursor-style",n.textContent="\n @keyframes blink {\n 0%, 49% { opacity: 1; }\n 50%, 100% { opacity: 0; }\n }\n ",document.head.appendChild(n)}var r=document.createElement("span");r.className="typing-text-container",t.element.insertBefore(r,i);var o=t.content.split("\n"),a=[];if(o.forEach(function(t,e){e>0&&a.push({type:"br"}),E(t).forEach(function(t){a.push({type:"char",value:t})})}),0===a.length)return i.style.display="none",void e();var s=0,l=(Date.now(),function(){if(s<a.length){if(!t.element.isConnected)return void e();var n=a[s];"br"===n.type?r.appendChild(document.createElement("br")):r.appendChild(document.createTextNode(n.value)),1===++s||a.length,setTimeout(l,t.interval||100)}else{Date.now();setTimeout(function(){i&&i.parentNode&&(i.style.display="none"),e()},500)}});setTimeout(l,t.delay||0)}else e();else e()})}var A=new Map;var L="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",I="あいうえおかがきぎくぐけげこごさざしじすずせぜそぞただちぢつづてでとどなにぬねのはばぱひびぴふぶぷへべぺほぼぽまみむめもゃやゅゆょよらりるれろゎわゐゑをん",F="アイウエオカガキギクグケゲコゴサザシジスズセゼソゾタダチヂツヅテデトドナニヌネノハバパヒビピフブプヘベペホボポマミムメモャヤュユョヨラリルレロヮワヰヱヲンヴ",R="一右雨円王音下火花貝学気九休玉金空月犬見五口校左三山子四糸字耳七車手十出女小上森人水正生青夕石赤千川先早草足村大男竹中虫町天田土二日入年白八百文木本名目立力林六",z="😄😃😀😊👲👳👮👷💂👶👦👧👨😺😸😻😽👹🙈💀👽💩🔥✨🌟💫💥💢💦👂👀👄👝👓🌂💄💛❤💔",j=",.?/\(^)![]{}*&^%$#':";function B(t,e){if("space"===t)return" ";var i="";switch(t){case"latin":i=L;break;case"hiragana":case"katakana":case"kanji":i=I+F+R;break;case"emoji":i=z;break;default:i=j+L}i+=e;var n=Array.from(i);return n[Math.floor(Math.random()*n.length)]}function W(t){return new Promise(function(e){if(t.element&&t.content){for(;t.element.firstChild;)t.element.removeChild(t.element.firstChild);t.element.style.display="inline",t.element.style.verticalAlign="top";var i=Math.min(Math.max(t.duration||10,5),100),n=Math.min(Math.max(t.delay||0,0),5e3),r=t.fps||16,o=t.element.id||"shuffle-".concat(Date.now());t.element.id||(t.element.id=o),function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;if(t){var e=A.get(t);e&&(clearTimeout(e),A.delete(t))}else A.forEach(function(t){clearTimeout(t)}),A.clear()}(o);for(var a=t.content,s=E(a),l=s.map(function(t){return" "===(e=t)?"space":/[a-zA-Z0-9]/.test(e)?"latin":/[\u3040-\u309F]/.test(e)?"hiragana":/[\u30A0-\u30FF]/.test(e)?"katakana":/[\u4E00-\u9FFF]/.test(e)?"kanji":/(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26A7\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5-\uDED8\uDEDC-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDDFF\uDE70-\uDE7C\uDE80-\uDE8A\uDE8E-\uDEC6\uDEC8\uDECD-\uDEDC\uDEDF-\uDEEA\uDEEF-\uDEF8])/.test(e)?"emoji":"symbols";var e}),c=[],h=0;h<s.length;h++)"\n"!==s[h]&&"space"!==l[h]&&c.push(h);if(0===c.length)return t.element.textContent=a,void e();for(var u=new Array(s.length).fill(!1),d=0;d<s.length;d++)"\n"!==s[d]&&"space"!==l[d]||(u[d]=!0);var p,g=0,m=0,b=function(){var t=document.getElementById(o);if(!t)return A.delete(o),void e();if(m>=c.length)return t.textContent=a,A.delete(o),void e();g>0&&g%i===0&&(u[c[m]]=!0,m++);for(var n=f(s),h=0;h<s.length;h++)u[h]||"\n"===s[h]||(n[h]=B(l[h],s[h]));t.innerHTML="";for(var d="",y=0;y<n.length;y++)"\n"===n[y]?(d&&(t.appendChild(document.createTextNode(d)),d=""),t.appendChild(document.createElement("br"))):d+=n[y];d&&t.appendChild(document.createTextNode(d)),g++,p=setTimeout(b,r),A.set(o,p)};setTimeout(b,n)}else e()})}function N(t,e){return new Promise(function(i,n){if(window.drawChartV2)V(t,e,i,n);else{var r=document.createElement("script");r.src="/js/chart2.js",r.onload=function(){window.drawChartV2?V(t,e,i,n):n(new Error("drawChartV2 not found after loading chart2.js"))},r.onerror=function(){return n(new Error("Failed to load chart2.js"))},document.head.appendChild(r)}})}function V(t,e,i,n){try{var r=window.drawChartV2(t,e);if(r&&r.options){var o,a=(null===(o=r.options.animation)||void 0===o?void 0:o.duration)||1e3;setTimeout(function(){i()},a)}else setTimeout(function(){i()},1e3)}catch(t){n(t)}}function H(t){return q.apply(this,arguments)}function q(){return(q=b(a().m(function t(e){var i,n,o,s,l,c,h,u,d;return a().w(function(t){for(;;)switch(t.p=t.n){case 0:if(0!==(i=e.querySelectorAll(".shindan-chart-block")).length){t.n=1;break}return t.a(2);case 1:n=r(i),t.p=2,n.s();case 3:if((o=n.n()).done){t.n=12;break}if(s=o.value,t.p=4,s.dataset.chart){t.n=5;break}return t.a(3,11);case 5:return l=JSON.parse(s.dataset.chart),c=s.dataset.chartIndex||"0",h="chart-for-image-".concat(Date.now(),"-").concat(c),(u=document.createElement("canvas")).id=h,u.style.maxWidth=_,u.style.height="auto",u.style.margin="0 auto",u.style.display="block",s.appendChild(u),t.n=6,P();case 6:if(document.getElementById(h)){t.n=7;break}return t.a(3,11);case 7:if(window.drawChartV2){t.n=8;break}return t.n=8,new Promise(function(t){var e=setInterval(function(){window.drawChartV2&&(clearInterval(e),t())},100)});case 8:return t.n=9,N(h,l);case 9:t.n=11;break;case 10:t.p=10,t.v;case 11:t.n=3;break;case 12:t.n=14;break;case 13:t.p=13,d=t.v,n.e(d);case 14:return t.p=14,n.f(),t.f(14);case 15:return t.a(2)}},t,null,[[4,10],[2,13,14,15]])}))).apply(this,arguments)}function U(t){return Y.apply(this,arguments)}function Y(){return Y=b(a().m(function t(e){var i,o,s,l,c,h,u,d,f,p,g,m,b=arguments;return a().w(function(t){for(;;)switch(t.p=t.n){case 0:if(i=b.length>1&&void 0!==b[1]?b[1]:{},0!==(o=e.querySelectorAll(".shindan-canvas-block")).length){t.n=1;break}return t.a(2);case 1:s=r(o),t.p=2,s.s();case 3:if((l=s.n()).done){t.n=10;break}if(c=l.value,t.p=4,c.dataset.canvasConfig){t.n=5;break}return t.a(3,9);case 5:return d=JSON.parse(c.dataset.canvasConfig),c.dataset.canvasIndex||"0",f=c.dataset.shindanId||c.getAttribute("data-shindan-id"),(p=document.createElement("canvas")).className="canvas-diagnosis-canvas",p.width=(null===(h=d.canvas)||void 0===h?void 0:h.width)||1200,p.height=(null===(u=d.canvas)||void 0===u?void 0:u.height)||630,p.style.maxWidth=w,p.style.height="auto",p.style.margin="0 auto",p.style.display="block",c.appendChild(p),t.n=6,P();case 6:return g=i,0===Object.keys(g).length&&f&&(g=tt(d,f)),t.n=7,(0,n.drawCanvasDiagnosis)(p,d,{imageMap:g});case 7:t.n=9;break;case 8:t.p=8,t.v;case 9:t.n=3;break;case 10:t.n=12;break;case 11:t.p=11,m=t.v,s.e(m);case 12:return t.p=12,s.f(),t.f(12);case 13:return t.a(2)}},t,null,[[4,8],[2,11,12,13]])})),Y.apply(this,arguments)}var G=function(){return t=function t(e){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.container=e,this.containerId=e.id,this.options=c({autoStart:!0,sequential:!0,observerThreshold:.1,onComplete:null,onStart:null},i),this.blocks=[],this.currentIndex=0,this.isRunning=!1,this.hasStarted=!1,this.observer=null},e=[{key:"getContainer",value:function(){if(this.containerId){var t=document.getElementById(this.containerId);if(t)return t}return this.container}},{key:"getOrderValue",value:function(t){var e=t.dataset.order;if(null==e||""===e)return 999999;var i=parseInt(e,10);return isNaN(i)?999999:i}},{key:"getBlockElement",value:function(t){var e=this.getContainer();if(!e)return null;var i=e.querySelector('[data-order="'.concat(t.order,'"]'));return i&&i.isConnected?i:null}},{key:"init",value:(x=b(a().m(function t(){return a().w(function(t){for(;;)switch(t.n){case 0:if(this.getContainer(),this.collectBlocks(),0!==this.blocks.length){t.n=1;break}return this.options.onComplete&&"function"==typeof this.options.onComplete&&this.options.onComplete(),t.a(2);case 1:this.start();case 2:return t.a(2)}},t,this)})),function(){return x.apply(this,arguments)})},{key:"setupIntersectionObserver",value:function(){var t=this,e={root:null,rootMargin:"0px",threshold:this.options.observerThreshold};this.observer=new IntersectionObserver(function(e){e.forEach(function(e){e.isIntersecting&&!t.hasStarted&&t.start()})},e),this.observer.observe(this.container)}},{key:"start",value:function(){this.hasStarted||this.isRunning||(this.hasStarted=!0,this.isRunning=!0,this.sequenceStartTime=Date.now(),this.options.onStart&&this.options.onStart(),this.executeNext(),this.observer&&(this.observer.disconnect(),this.observer=null))}},{key:"collectBlocks",value:function(){var t=this,e=[],i=new Set,n=this.getContainer(),r=n.querySelectorAll(".text-block"),o=n.querySelectorAll(".shindan-chart-block"),a=n.querySelectorAll(".typing-effect-block"),s=n.querySelectorAll(".shuffle-effect-block"),l=n.querySelectorAll(".image-block"),c=n.querySelectorAll(".image-merge-block"),h=n.querySelectorAll(".user-input-block"),u=n.querySelectorAll(".formatted-text-block"),d=n.querySelectorAll(".vertical-block");r.forEach(function(n){i.has(n)||n.parentElement&&n.parentElement.classList.contains("text-block")||(i.add(n),e.push({type:"text",element:n,order:t.getOrderValue(n)}))}),o.forEach(function(i){e.push({type:"chart",element:i,order:t.getOrderValue(i)})}),a.forEach(function(i,n){var r=i.dataset.content||"",o=i.dataset.brPlaceholder;i.isConnected;var a=r;if(o&&r){var s=o.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),l=new RegExp(s,"g");a=r.replace(l,"\n")}e.push({type:"typing",element:i,content:a,interval:parseInt(i.dataset.interval)||100,delay:parseInt(i.dataset.delay)||0,order:t.getOrderValue(i)})}),s.forEach(function(i){var n=i.dataset.content||"",r=i.dataset.brPlaceholder,o=n;if(r&&n){var a=r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),s=new RegExp(a,"g");o=n.replace(s,"\n")}e.push({type:"shuffle",element:i,content:o,duration:parseInt(i.dataset.duration)||30,delay:parseInt(i.dataset.delay)||0,order:t.getOrderValue(i)})}),l.forEach(function(i){e.push({type:"image",element:i,order:t.getOrderValue(i)})}),c.forEach(function(i){e.push({type:"image_merge",element:i,order:t.getOrderValue(i)})}),h.forEach(function(i){e.push({type:"userInput",element:i,order:t.getOrderValue(i)})}),u.forEach(function(i){e.push({type:"formattedText",element:i,order:t.getOrderValue(i)})}),d.forEach(function(i){e.push({type:"vertical",element:i,order:t.getOrderValue(i)})}),n.querySelectorAll(".shindan-canvas-block").forEach(function(i){e.push({type:"canvas",element:i,order:t.getOrderValue(i)})}),n.querySelectorAll(".media-block").forEach(function(i){var n=i.classList.contains("url-block");e.push({type:n?"url":"media",element:i,order:t.getOrderValue(i)})}),e.sort(function(t,e){return t.order-e.order}),this.blocks=e}},{key:"executeNext",value:(y=b(a().m(function t(){var e,i;return a().w(function(t){for(;;)switch(t.p=t.n){case 0:if(!(this.currentIndex>=this.blocks.length)){t.n=1;break}if(this.isRunning=!1,Date.now()-(this.sequenceStartTime||0)<1e3&&this.blocks.length,this.options.onComplete&&"function"==typeof this.options.onComplete)try{this.options.onComplete()}catch(t){}return t.a(2);case 1:e=this.blocks[this.currentIndex],t.p=2,i=e.type,t.n="text"===i?3:"chart"===i?5:"typing"===i?7:"shuffle"===i?9:"image"===i||"image_merge"===i?11:"url"===i?13:"media"===i?15:"userInput"===i?17:"formattedText"===i?19:"vertical"===i?21:"canvas"===i?23:25;break;case 3:return t.n=4,this.executeText(e);case 4:return t.a(3,26);case 5:return t.n=6,this.executeChart(e);case 6:return t.a(3,26);case 7:return t.n=8,this.executeTyping(e);case 8:return t.a(3,26);case 9:return t.n=10,this.executeShuffle(e);case 10:return t.a(3,26);case 11:return t.n=12,this.executeImage(e);case 12:return t.a(3,26);case 13:return t.n=14,this.executeText(e);case 14:return t.a(3,26);case 15:return t.n=16,this.executeMedia(e);case 16:return t.a(3,26);case 17:return t.n=18,this.executeUserInput(e);case 18:return t.a(3,26);case 19:return t.n=20,this.executeFormattedText(e);case 20:return t.a(3,26);case 21:return t.n=22,this.executeVertical(e);case 22:return t.a(3,26);case 23:return t.n=24,this.executeCanvas(e);case 24:return t.a(3,26);case 25:case 26:t.n=28;break;case 27:t.p=27,t.v;case 28:if(this.currentIndex++,!this.options.sequential){t.n=29;break}return t.n=29,this.executeNext();case 29:return t.a(2)}},t,this,[[2,27]])})),function(){return y.apply(this,arguments)})},{key:"executeText",value:(m=b(a().m(function t(e){var i;return a().w(function(t){for(;;)switch(t.n){case 0:if(i=this.getBlockElement(e)){t.n=1;break}return t.a(2);case 1:return i.style.opacity="1",t.n=2,new Promise(function(t){return setTimeout(t,0)});case 2:return t.a(2)}},t,this)})),function(t){return m.apply(this,arguments)})},{key:"executeVertical",value:(g=b(a().m(function t(e){var i;return a().w(function(t){for(;;)switch(t.n){case 0:if(i=this.getBlockElement(e)){t.n=1;break}return t.a(2);case 1:return i.style.opacity="1",t.n=2,new Promise(function(t){return setTimeout(t,0)});case 2:return t.a(2)}},t,this)})),function(t){return g.apply(this,arguments)})},{key:"executeChart",value:(p=b(a().m(function t(e){var i,n,r;return a().w(function(t){for(;;)switch(t.p=t.n){case 0:if(i=this.getBlockElement(e)){t.n=1;break}return t.a(2);case 1:return i.style.opacity="1",t.n=2,new Promise(function(t){return setTimeout(t,50)});case 2:if(!(n=i.querySelector("canvas"))||!n.id){t.n=7;break}return r=JSON.parse(i.dataset.chart||"{}"),t.p=3,t.n=4,N(n.id,r);case 4:t.n=6;break;case 5:t.p=5,t.v;case 6:t.n=8;break;case 7:case 8:return t.a(2)}},t,this,[[3,5]])})),function(t){return p.apply(this,arguments)})},{key:"executeCanvas",value:(f=b(a().m(function t(e){var i,r,o,s,l,c;return a().w(function(t){for(;;)switch(t.p=t.n){case 0:if(i=this.getBlockElement(e)){t.n=1;break}return t.a(2);case 1:if(i.style.opacity="1",r=i.querySelector("canvas")){t.n=2;break}return t.a(2);case 2:return o=JSON.parse(i.dataset.canvasConfig||"{}"),(s=i.getAttribute("data-shindan-id"))||(l=i.closest("[data-shindan-id]"))&&(s=l.getAttribute("data-shindan-id")),t.p=3,c=this.options.canvasImageMap&&Object.keys(this.options.canvasImageMap).length>0?this.options.canvasImageMap:tt(o,s),t.n=4,(0,n.drawCanvasDiagnosis)(r,o,{imageMap:c});case 4:t.n=6;break;case 5:t.p=5,t.v;case 6:return t.a(2)}},t,this,[[3,5]])})),function(t){return f.apply(this,arguments)})},{key:"executeTyping",value:(d=b(a().m(function t(e){var i,n;return a().w(function(t){for(;;)switch(t.n){case 0:if(i=this.getBlockElement(e)){t.n=1;break}return t.a(2);case 1:return i.style.transition="opacity 0.5s ease-in-out",i.style.opacity="1",t.n=2,new Promise(function(t){return setTimeout(t,500)});case 2:return Date.now(),n={element:i,content:e.content,interval:e.interval,delay:e.delay},t.n=3,O(n);case 3:Date.now(),e.content.length,e.interval;case 4:return t.a(2)}},t,this)})),function(t){return d.apply(this,arguments)})},{key:"executeShuffle",value:(h=b(a().m(function t(e){var i,n;return a().w(function(t){for(;;)switch(t.n){case 0:if(i=this.getBlockElement(e)){t.n=1;break}return t.a(2);case 1:return i.style.transition="opacity 0.5s ease-in-out",i.style.opacity="1",t.n=2,new Promise(function(t){return setTimeout(t,500)});case 2:return n={element:i,content:e.content,duration:e.duration,delay:e.delay,fps:e.fps},t.n=3,W(n);case 3:return t.a(2)}},t,this)})),function(t){return h.apply(this,arguments)})},{key:"executeImage",value:(l=b(a().m(function t(e){var i;return a().w(function(t){for(;;)switch(t.n){case 0:if(i=this.getBlockElement(e)){t.n=1;break}return t.a(2);case 1:return i.style.transition="opacity 0.5s ease-in-out",i.style.opacity="1",t.n=2,new Promise(function(t){return setTimeout(t,500)});case 2:return t.a(2)}},t,this)})),function(t){return l.apply(this,arguments)})},{key:"executeMedia",value:(s=b(a().m(function t(e){var i;return a().w(function(t){for(;;)switch(t.n){case 0:if(i=this.getBlockElement(e)){t.n=1;break}return t.a(2);case 1:return i.style.transition="opacity 0.5s ease-in-out",i.style.opacity="1",t.n=2,new Promise(function(t){return setTimeout(t,500)});case 2:return t.a(2)}},t,this)})),function(t){return s.apply(this,arguments)})},{key:"executeUserInput",value:(o=b(a().m(function t(e){var i;return a().w(function(t){for(;;)switch(t.n){case 0:if(i=this.getBlockElement(e)){t.n=1;break}return t.a(2);case 1:return i.style.opacity="1",t.n=2,new Promise(function(t){return setTimeout(t,0)});case 2:return t.a(2)}},t,this)})),function(t){return o.apply(this,arguments)})},{key:"executeFormattedText",value:(r=b(a().m(function t(e){var i;return a().w(function(t){for(;;)switch(t.n){case 0:if(i=this.getBlockElement(e)){t.n=1;break}return t.a(2);case 1:return i.style.opacity="1",t.n=2,new Promise(function(t){return setTimeout(t,0)});case 2:return t.a(2)}},t,this)})),function(t){return r.apply(this,arguments)})}],e&&u(t.prototype,e),i&&u(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,i,r,o,s,l,h,d,f,p,g,m,y,x}();function X(t,e){var i='<div class="alert alert-danger">';i+='<ul class="mb-0">',e.forEach(function(t){i+="<li>".concat(D(t),"</li>")}),i+="</ul>",i+="</div>",t.innerHTML=i}function Z(t){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=i.showLogs,r=void 0!==n&&n,a=i.isPreview,s=void 0!==a&&a,l=i.translations,c=void 0===l?{}:l,h=i.useSequencer,u=void 0!==h&&h,d=i.forImage,f=void 0!==d&&d,p=i.disableEffects,g=void 0!==p&&p,m=i.isTimeline,b=void 0!==m&&m,P=i.isSplitMode,T=void 0!==P&&P,C="";s&&(C='<div id="title_and_result" class="font-140">',C+='<div id="shindanResultBlock">',C+='<span id="shindanResultTitle" class="h5 d-block text-center font-weight-bold pb-3 mb-0">',C+=D(c.result_title||"診断結果"),C+="</span>",C+='<span id="shindanResultContainer" class="d-block py-4 px-3 px-sm-4 text-break">',C+='<span id="shindanResultContent">',C+='<span id="shindanResult" class="text-left d-block">');var E=[],O=t.blocks||t.result_blocks;if(O&&Array.isArray(O)){var A=O[O.length-1];A&&"text"===A.type&&A.content&&(A.content=A.content.trimEnd());var L=!1;O.forEach(function(t,i){if(t&&t.type)if("line_break"===t.type&&L)L=!1;else{var n=u&&!f?"0":"1";switch(t.type){case"line_break":C+="<br>",L=!1;break;case"text":var r=D(t.content||"");C+='<span class="text-block" data-order="'.concat(i,'" style="opacity: ').concat(n,'">').concat(r.replace(/\n/g,"<br>"),"</span>"),L=!1;break;case"user_input":var a=t.value||"",s="";s=t.styles&&t.styles.bold?'<span class="font-weight-bold">'.concat(D(a),"</span>"):D(a),C+='<span class="user-input-block" data-order="'.concat(i,'" style="opacity: ').concat(n,'">').concat(s,"</span>"),L=!1;break;case"formatted_text":var l=D(t.content||"");if(t.format&&"object"===o(t.format)){var c=[];if(t.format.fontFamily&&c.push("font-family: ".concat(t.format.fontFamily)),t.format.fontSize){c.push("font-size: ".concat(t.format.fontSize));var h=t.format.fontSize,d="1.5";if(h.includes("em")){var p=parseFloat(h);p>=2?d="1.2":p>=1.5&&(d="1.3")}else if(h.includes("px")){var m=parseFloat(h);m>=32?d="1.2":m>=24&&(d="1.3")}c.push("line-height: ".concat(d))}t.format.color&&c.push("color: ".concat(t.format.color)),t.format.fontWeight&&c.push("font-weight: ".concat(t.format.fontWeight)),t.format.fontStyle&&c.push("font-style: ".concat(t.format.fontStyle)),t.format.textDecoration&&c.push("text-decoration: ".concat(t.format.textDecoration)),c.length>0&&(l='<span style="'.concat(c.join("; "),'">').concat(l,"</span>"))}C+='<span class="formatted-text-block" data-order="'.concat(i,'" style="opacity: ').concat(n,'; display: inline; vertical-align: top;">').concat(l,"</span>"),L=!1;break;case"vertical":var P=t.vertical||t.content||"";C+='<span class="vertical-block" data-order="'.concat(i,'" style="opacity: ').concat(n,'; white-space: pre-wrap;">').concat(D(P),"</span>"),L=!1;break;case"chart":var E=t.config||{};if(C+='<div class="shindan-chart-block canvas_block my-3 mx-auto" style="max-width: '.concat(f?w:x,"; opacity: ").concat(n,'" data-chart-version="v2" data-chart="').concat(e(E),'" data-order="').concat(i,'" data-chart-index="').concat(i,'">'),!f){var O=function(t,e){var i="".concat(arguments.length>2&&void 0!==arguments[2]?arguments[2]:"chart","_v2_").concat(e);return{html:'<canvas id="'.concat(i,'" width="1" height="200" style="max-width: 100%; height: auto;"></canvas>'),chartInfo:{canvasId:i,config:t.config||t.data}}}(t,i);C+=O.html}C+="</div>",L=!0;break;case"canvas":var A=t.config||{canvas:{},objects:[]},I=A.canvas.width||1200,F=A.canvas.height||630,R=f?w:v,z=f?"none":M,j=t.shindan_id||"";if(C+='<div class="shindan-canvas-block canvas_block my-3 mx-auto" style="max-width: '.concat(R,"; opacity: ").concat(n,'; display: flex; justify-content: center;" data-canvas-config="').concat(e(A),'" data-shindan-id="').concat(j,'" data-order="').concat(i,'" data-canvas-index="').concat(i,'">'),!f){var B="none"!==z?"max-width: 100%; max-height: ".concat(z,"; height: auto;"):"max-width: 100%; height: auto;";C+='<canvas class="canvas-diagnosis-canvas" width="'.concat(I,'" height="').concat(F,'" style="').concat(B,'"></canvas>')}C+="</div>",L=!0;break;case"typing_effect":var W=t.content||"",N=t.interval||100,V=t.delay||0;if(f||g)C+='<span class="text-block" data-order="'.concat(i,'" style="opacity: 1">').concat(D(W).replace(/\n/g,"<br>"),"</span>");else{var H="typing_effect_".concat(i),q="__BR_".concat(i,"__"),$=W.replace(/\n/g,q);C+='<span id="'.concat(H,'" class="typing-effect-block" data-order="').concat(i,'" style="opacity: ').concat(n,'" '),C+='data-content="'.concat(D($),'" '),C+='data-br-placeholder="'.concat(D(q),'" '),C+='data-interval="'.concat(N,'" '),C+='data-delay="'.concat(V,'"></span>')}L=!1;break;case"shuffle_effect":var U=t.content||"",Y=t.duration||30,G=t.delay||0;if(f||g)C+='<span class="text-block" data-order="'.concat(i,'" style="opacity: 1">').concat(D(U).replace(/\n/g,"<br>"),"</span>");else{var X="shuffle_effect_".concat(i),Z="__BR_".concat(i,"__"),Q=U.replace(/\n/g,Z);C+='<span id="'.concat(X,'" class="shuffle-effect-block" data-order="').concat(i,'" style="opacity: ').concat(n,'" '),C+='data-content="'.concat(D(Q),'" '),C+='data-br-placeholder="'.concat(D(Z),'" '),C+='data-duration="'.concat(Y,'" '),C+='data-delay="'.concat(G,'"></span>')}L=!1;break;case"image":var J=t.image_url||"",K=f||b?_:y,tt=f&&T?"width: auto; height: auto; max-width: ".concat(K,"; max-height: ").concat(S,"; object-fit: contain; display: block; margin: 10px auto;"):f?"width: auto; height: auto; max-width: ".concat(K,"; display: block; margin: 10px auto;"):"width: auto; height: auto; max-width: ".concat(K,"; max-height: ").concat(k,"; object-fit: contain; display: block; margin: 10px auto;");C+='<span class="image-block" data-order="'.concat(i,'" style="opacity: ').concat(n,'">'),C+='<img src="'.concat(D(J),'" alt="').concat(D(""),'" style="').concat(tt,'">'),C+="</span>",L=!0;break;case"youtube":var et=t.video_id||"";if(f||b){var it="https://img.youtube.com/vi/".concat(et,"/mqdefault.jpg");C+='<span class="media-block youtube-block" data-order="'.concat(i,'" style="opacity: ').concat(n,'">'),C+='<img src="'.concat(it,'" alt="YouTube動画" style="max-width: 280px; cursor: pointer; display: block; margin: 10px auto;">'),C+="</span>"}else C+='<span class="media-block youtube-block" data-order="'.concat(i,'" style="opacity: ').concat(n,'">'),C+='<iframe width="560" height="315" src="https://www.youtube.com/embed/'.concat(et,'" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen style="display: block; margin: 10px auto;"></iframe>'),C+="</span>";L=!0;break;case"niconico":var nt=t.video_id||"",rt=t.url||"";if(f||b)C+='<span class="media-block niconico-block" data-order="'.concat(i,'" style="opacity: ').concat(n,'">'),C+=D(rt),C+="</span>",L=!1;else{var ot="niconico_".concat(i,"_").concat(Date.now());C+='<span class="media-block niconico-block" data-order="'.concat(i,'" style="opacity: ').concat(n,'">'),C+='<div id="'.concat(ot,'" data-niconico-id="').concat(D(nt),'" class="niconico-embed-container" style="display: flex; justify-content: center; margin: 10px 0;"></div>'),C+='<noscript><a href="https://www.nicovideo.jp/watch/'.concat(nt,'">').concat(D(rt),"</a></noscript>"),C+="</span>",L=!0}break;case"external_image":var at=t.thumbnail_url||t.large_url||"",st=t.service||"image",lt=t.jump_url||t.url||"";f?(C+='<span class="media-block external-image-block" data-order="'.concat(i,'" style="opacity: ').concat(n,'">'),C+='<img src="'.concat(D(at),'" alt="').concat(D(st),'" style="max-width: 280px; display: block; margin: 10px auto;">'),C+="</span>"):(C+='<span class="media-block external-image-block" data-order="'.concat(i,'" style="opacity: ').concat(n,'">'),C+='<a href="'.concat(D(lt),'" target="_blank" style="display: block; text-align: center; margin: 10px 0;">'),C+='<img src="'.concat(D(at),'" alt="').concat(D(st),'" style="max-width: 100%; cursor: pointer;">'),C+="</a>",C+="</span>"),L=!0;break;case"url":var ct=t.url||"",ht=t.is_internal?ct:t.jump_url||ct;f||b?(C+='<span class="media-block url-block" data-order="'.concat(i,'" style="opacity: ').concat(n,'">'),C+=D(ct),C+="</span>"):(C+='<span class="media-block url-block" data-order="'.concat(i,'" style="opacity: ').concat(n,'">'),C+='<a href="'.concat(D(ht),'" target="_blank" style="color: #0066cc;">').concat(D(ct),"</a>"),C+="</span>"),L=!1;break;case"image_merge":t.image_ids||t.images,t.layout;var ut=f||b?_:y,dt=f&&T?"width: auto; max-width: ".concat(ut,"; max-height: ").concat(S,"; object-fit: contain; height: auto; display: block; margin: 10px auto;"):f?"width: auto; max-width: ".concat(ut,"; height: auto; display: block; margin: 10px auto;"):"width: auto; max-width: ".concat(ut,"; max-height: ").concat(k,"; object-fit: contain; height: auto; display: block; margin: 10px auto;");C+='<span class="image-merge-block" data-order="'.concat(i,'" style="opacity: ').concat(n,'">'),t.image_url&&(C+='<img src="'.concat(D(t.image_url),'" alt="" style="').concat(dt,'" />')),C+="</span>",L=!0;break;case"format_start":var ft=t.format_id||"fmt_".concat(i),pt=[];t.styles&&(t.styles.fontFamily&&pt.push("font-family: ".concat(t.styles.fontFamily)),t.styles.fontSize&&pt.push("font-size: ".concat(t.styles.fontSize)),t.styles.color&&pt.push("color: ".concat(t.styles.color)),t.styles.fontWeight&&pt.push("font-weight: ".concat(t.styles.fontWeight)),t.styles.fontStyle&&pt.push("font-style: ".concat(t.styles.fontStyle)),t.styles.textDecoration&&pt.push("text-decoration: ".concat(t.styles.textDecoration)));var gt=pt.length>0?' style="'.concat(pt.join("; "),'"'):"";C+='<span class="format-block format-start" data-format-id="'.concat(ft,'"').concat(gt,">"),L=!1;break;case"format_end":C+="</span>",L=!1;break;default:C+='<span class="text-block" data-order="'.concat(i,'" style="opacity: ').concat(n,'">').concat(D(JSON.stringify(t)),"</span>"),L=!1}}})}return s&&(C+="</span>",C+="</span>",C+="</span>",C+="</div>",C+="</div>"),r&&E.length>0&&(C+='<div class="mt-3 text-center">',C+="<button class=\"btn btn-sm btn-outline-secondary\" onclick=\"document.getElementById('transformation-logs-container').classList.toggle('d-none')\">",C+='<i class="fas fa-chevron-down"></i> ',C+="<span>変換ログを表示</span>",C+="</button>",C+="</div>",C+='<div id="transformation-logs-container" class="mt-3 p-3 bg-light rounded d-none">',C+='<h6 class="font-weight-bold mb-3">変換プロセス</h6>',C+='<div class="small">',E.forEach(function(t){var e="error"===t.type?"text-danger":"warning"===t.type?"text-warning":"text-primary";C+='<div class="mb-2 border-bottom pb-2">',C+='<div class="d-flex justify-content-between">',C+='<span class="'.concat(e,' font-weight-bold">').concat(D(t.title),"</span>"),C+='<span class="text-muted">'.concat(D(t.timestamp),"</span>"),C+="</div>",C+="<div>".concat(D(t.message),"</div>"),t.details&&(C+='<div class="ml-3 mt-1 text-muted">',C+="<div>".concat(D(JSON.stringify(t.details,null,2)),"</div>"),C+="</div>"),C+="</div>"}),C+="</div>",C+="</div>"),C}function Q(t,e){return J.apply(this,arguments)}function J(){return J=b(a().m(function e(i,o){var s,l,h,u,d,f,p,g,m,b,y,x,v,_,w,k,S,M,D,P,C,E,O,A,L,I,F,R,z,j=arguments;return a().w(function(e){for(;;)switch(e.p=e.n){case 0:if(s=j.length>2&&void 0!==j[2]?j[2]:"default",l=j.length>3&&void 0!==j[3]?j[3]:{},i){e.n=1;break}return e.a(2);case 1:if(d=c(c(c({},u=(h={default:{enableEffects:!0,enableSequencer:!0,chartSize:"normal",imageSize:"normal",showLogs:!1,isPreview:!1,forImage:!1,disableEffects:!1},saved:{enableEffects:!0,enableSequencer:!0,chartSize:"normal",imageSize:"normal",showLogs:!1,isPreview:!1,forImage:!1,disableEffects:!1},timeline:{enableEffects:!1,enableSequencer:!1,chartSize:"small",imageSize:"small",maxImageHeight:1e3,showLogs:!1,isPreview:!1,forImage:!1,disableEffects:!0,compact:!0},image:{enableEffects:!1,enableSequencer:!1,chartSize:"normal",imageSize:"normal",showLogs:!1,isPreview:!1,forImage:!0,disableEffects:!0},preview:{enableEffects:!0,enableSequencer:!0,chartSize:"normal",imageSize:"normal",showLogs:!1,isPreview:!0,forImage:!1,disableEffects:!1}})[s]||h.default),l),{},{useSequencer:void 0!==l.useSequencer?l.useSequencer:u.enableSequencer,autoStartSequence:void 0===l.autoStartSequence||l.autoStartSequence}),!(o.errors&&o.errors.length>0)){e.n=2;break}return X(i,o.errors),e.a(2);case 2:if(o&&(o.blocks||o.result_blocks)){e.n=3;break}return i.innerHTML='<div class="text-center text-muted">診断結果がありません</div>',e.a(2);case 3:if(f=Z(o,{showLogs:d.showLogs,isPreview:d.isPreview,translations:d.translations||{},useSequencer:d.useSequencer,forImage:d.forImage,disableEffects:d.disableEffects,isTimeline:"timeline"===s,isSplitMode:d.isSplitMode||!1}),i.innerHTML=f,!d.forImage){e.n=6;break}return e.n=4,H(i);case 4:return e.n=5,U(i,d.canvasImageMap||{});case 5:e.n=27;break;case 6:return e.n=7,T(i);case 7:return e.n=8,new Promise(function(t){return setTimeout(t,100)});case 8:if("timeline"!==s){e.n=25;break}if(!((p=i.querySelectorAll(".shindan-chart-block")).length>0)){e.n=13;break}g=0,m=10;case 9:if(!(g<m)){e.n=12;break}if(y=p[0],!(((null===(b=y.parentElement)||void 0===b?void 0:b.clientWidth)||0)>0)){e.n=10;break}return e.a(3,12);case 10:return e.n=11,new Promise(function(t){return setTimeout(t,50)});case 11:g++,e.n=9;break;case 12:x=r(p);try{for(x.s();!(v=x.n()).done;){_=v.value;try{w=JSON.parse(_.dataset.chart),k="chart-timeline-".concat(Math.random().toString(36).substring(2,11),"-").concat(Array.from(p).indexOf(_)),(S=_.querySelector("canvas"))&&S.remove(),(M=document.createElement("canvas")).id=k,_.appendChild(M),(0,t.P)(k,c(c({},w),{},{animation:!1}))}catch(t){}}}catch(t){x.e(t)}finally{x.f()}case 13:if(!((D=i.querySelectorAll(".shindan-canvas-block")).length>0)){e.n=24;break}P=r(D),e.p=14,P.s();case 15:if((C=P.n()).done){e.n=21;break}if(E=C.value,e.p=16,O=E.querySelector("canvas")){e.n=17;break}return e.a(3,20);case 17:return A=JSON.parse(E.dataset.canvasConfig||"{}"),(L=E.getAttribute("data-shindan-id"))||(I=E.closest("[data-shindan-id]"))&&(L=I.getAttribute("data-shindan-id")),F=tt(A,L),e.n=18,(0,n.drawCanvasDiagnosis)(O,A,{imageMap:F});case 18:e.n=20;break;case 19:e.p=19,e.v;case 20:e.n=15;break;case 21:e.n=23;break;case 22:e.p=22,z=e.v,P.e(z);case 23:return e.p=23,P.f(),e.f(23);case 24:i.querySelectorAll("img").forEach(function(t){t.style.maxWidth="100%",t.style.maxHeight=d.maxImageHeight+"px",t.style.objectFit="contain"}),e.n=27;break;case 25:return R=new G(i,{autoStart:void 0===d.autoStartSequence||d.autoStartSequence,sequential:d.useSequencer||!1,onStart:d.onSequenceStart,onComplete:d.onSequenceComplete,canvasImageMap:d.canvasImageMap||{}}),e.n=26,R.init();case 26:i.querySelectorAll(".niconico-embed-container").length>0&&setTimeout(function(){document.querySelectorAll(".niconico-embed-container").forEach(function(t){var e=t.dataset.niconicoId;if(e&&"true"!==t.dataset.initialized){var i=document.createElement("script");i.type="application/javascript",i.src="https://embed.nicovideo.jp/watch/".concat(e,"/script?w=640&h=360"),i.onload=function(){t.dataset.initialized="true"},i.onerror=function(){t.innerHTML='<a href="https://www.nicovideo.jp/watch/'.concat(e,'" target="_blank" style="color: #0066cc;">ニコニコ動画を見る: ').concat(e,"</a>")},t.appendChild(i)}})},200);case 27:case 28:return e.a(2)}},e,null,[[16,19],[14,22,23,24]])})),J.apply(this,arguments)}function K(){document.querySelectorAll(".shindan-chart-block").forEach(function(t,e){if(t.dataset.chart)try{var i=JSON.parse(t.dataset.chart),n="chart-dom-".concat(Date.now(),"-").concat(e),r=t.querySelector("canvas");r&&r.remove();var o=document.createElement("canvas");o.id=n,o.width=1,o.height=200,o.style.maxWidth="100%",o.style.height="auto",t.appendChild(o),window.drawChartV2&&window.drawChartV2(n,i)}catch(t){}})}function tt(t,e){var i=window.canvasImageBasePath,n={};return t.objects&&t.objects.forEach(function(t){var r,o;if("image"===t.type&&"static"===(null===(r=t.params)||void 0===r?void 0:r.sourceType)&&null!==(o=t.params)&&void 0!==o&&o.imageData){var a=t.params.imageData;if(a.startsWith("data:"))return;a.startsWith("canvas/")&&i&&e&&(n[a]="".concat(i,"/").concat(e,"/").concat(a))}}),n}function et(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=(t.typingSelector,t.shuffleSelector,document.body),i=new G(e,{autoStart:!1,sequential:!0});i.init(),i.start()}function it(){return it=b(a().m(function t(e,i){var n,r=arguments;return a().w(function(t){for(;;)if(0===t.n)return n=r.length>2&&void 0!==r[2]?r[2]:{},t.a(2,Q(e,i,"saved",n))},t)})),it.apply(this,arguments)}function nt(t){return nt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},nt(t)}function rt(){var t,e,i="function"==typeof Symbol?Symbol:{},n=i.iterator||"@@iterator",r=i.toStringTag||"@@toStringTag";function o(i,n,r,o){var l=n&&n.prototype instanceof s?n:s,c=Object.create(l.prototype);return ot(c,"_invoke",function(i,n,r){var o,s,l,c=0,h=r||[],u=!1,d={p:0,n:0,v:t,a:f,f:f.bind(t,4),d:function(e,i){return o=e,s=0,l=t,d.n=i,a}};function f(i,n){for(s=i,l=n,e=0;!u&&c&&!r&&e<h.length;e++){var r,o=h[e],f=d.p,p=o[2];i>3?(r=p===n)&&(l=o[(s=o[4])?5:(s=3,3)],o[4]=o[5]=t):o[0]<=f&&((r=i<2&&f<o[1])?(s=0,d.v=n,d.n=o[1]):f<p&&(r=i<3||o[0]>n||n>p)&&(o[4]=i,o[5]=n,d.n=p,s=0))}if(r||i>1)return a;throw u=!0,n}return function(r,h,p){if(c>1)throw TypeError("Generator is already running");for(u&&1===h&&f(h,p),s=h,l=p;(e=s<2?t:l)||!u;){o||(s?s<3?(s>1&&(d.n=-1),f(s,l)):d.n=l:d.v=l);try{if(c=2,o){if(s||(r="next"),e=o[r]){if(!(e=e.call(o,l)))throw TypeError("iterator result is not an object");if(!e.done)return e;l=e.value,s<2&&(s=0)}else 1===s&&(e=o.return)&&e.call(o),s<2&&(l=TypeError("The iterator does not provide a '"+r+"' method"),s=1);o=t}else if((e=(u=d.n<0)?l:i.call(n,d))!==a)break}catch(e){o=t,s=1,l=e}finally{c=1}}return{value:e,done:u}}}(i,r,o),!0),c}var a={};function s(){}function l(){}function c(){}e=Object.getPrototypeOf;var h=[][n]?e(e([][n]())):(ot(e={},n,function(){return this}),e),u=c.prototype=s.prototype=Object.create(h);function d(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,c):(t.__proto__=c,ot(t,r,"GeneratorFunction")),t.prototype=Object.create(u),t}return l.prototype=c,ot(u,"constructor",c),ot(c,"constructor",l),l.displayName="GeneratorFunction",ot(c,r,"GeneratorFunction"),ot(u),ot(u,r,"Generator"),ot(u,n,function(){return this}),ot(u,"toString",function(){return"[object Generator]"}),(rt=function(){return{w:o,m:d}})()}function ot(t,e,i,n){var r=Object.defineProperty;try{r({},"",{})}catch(t){r=0}ot=function(t,e,i,n){function o(e,i){ot(t,e,function(t){return this._invoke(e,i,t)})}e?r?r(t,e,{value:i,enumerable:!n,configurable:!n,writable:!n}):t[e]=i:(o("next",0),o("throw",1),o("return",2))},ot(t,e,i,n)}function at(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),i.push.apply(i,n)}return i}function st(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?at(Object(i),!0).forEach(function(e){lt(t,e,i[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):at(Object(i)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))})}return t}function lt(t,e,i){return(e=function(t){var e=function(t,e){if("object"!=nt(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,e||"default");if("object"!=nt(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==nt(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function ct(t,e,i,n,r,o,a){try{var s=t[o](a),l=s.value}catch(t){return void i(t)}s.done?e(l):Promise.resolve(l).then(n,r)}function ht(t){return function(){var e=this,i=arguments;return new Promise(function(n,r){var o=t.apply(e,i);function a(t){ct(o,n,r,a,s,"next",t)}function s(t){ct(o,n,r,a,s,"throw",t)}a(void 0)})}}function ut(){return(ut=ht(rt().m(function t(e){var i,n,r,o,a,s,l,c;return rt().w(function(t){for(;;)switch(t.p=t.n){case 0:if(t.p=0,"true"!==e.dataset.processed){t.n=1;break}return t.a(2);case 1:if(e.dataset.processed="true",i="v1img-"+Date.now()+"-"+Math.random().toString(36).substr(2,9),e.dataset.debugId=i,n=JSON.parse(e.dataset.imageUrls||"[]"),r=e.dataset.direction||"horizontal",n&&0!==n.length){t.n=2;break}return t.a(2);case 2:return t.n=3,dt(n);case 3:if(0!==(o=t.v).length){t.n=4;break}return t.a(2);case 4:a=pt(o,r),(s=document.createElement("img")).src=a.toDataURL("image/jpeg",.9),s.className="shindanResult_image",s.style.cssText="max-width: 100%; height: auto; display: inline-block;",(l=e.parentElement)&&"shindanResult"===l.id&&new MutationObserver(function(t){t.forEach(function(t){t.type})}).observe(l,{childList:!0,subtree:!0}),e.replaceWith(s),(c=function(t){setTimeout(function(){s.parentElement,document.querySelectorAll('.v1-merged-image[data-debug-id="'.concat(i,'"]')).length},t)})(100),c(1e3),c(3e3),t.n=6;break;case 5:t.p=5,t.v,e.remove();case 6:return t.a(2)}},t,null,[[0,5]])}))).apply(this,arguments)}function dt(t){return ft.apply(this,arguments)}function ft(){return(ft=ht(rt().m(function t(e){var i,n;return rt().w(function(t){for(;;)switch(t.n){case 0:return i=e.map(function(t){return e=t,new Promise(function(t,i){var n=new Image;n.crossOrigin="anonymous",n.onload=function(){t(n)},n.onerror=function(t){i(new Error("Failed to load image: ".concat(e)))},n.src=e});var e}),t.n=1,Promise.allSettled(i);case 1:return n=t.v,t.a(2,n.filter(function(t){return"fulfilled"===t.status}).map(function(t){return t.value}))}},t)}))).apply(this,arguments)}function pt(t,e){if(0===t.length)throw new Error("No images to merge");if(1===t.length)return function(t){var e=document.createElement("canvas");e.width=t.naturalWidth||t.width,e.height=t.naturalHeight||t.height;var i=e.getContext("2d");return i.drawImage(t,0,0),e}(t[0]);var i=t.map(function(t){return{width:t.naturalWidth||t.width,height:t.naturalHeight||t.height,img:t}}),n=0,r=0,o=0,a=0;i.forEach(function(t){n=Math.max(n,t.width),r=Math.max(r,t.height)});var s=i.map(function(t){var i=t.width,s=t.height;if("horizontal"===e){if(t.height<r){var l=r/t.height;s=r,i=t.width*l}o+=i}else{if(t.width<n){var c=n/t.width;i=n,s=t.height*c}a+=s}return st(st({},t),{},{newWidth:i,newHeight:s})});"horizontal"===e?a=r:o=n;var l=1200;if(o>l||a>l){var c=o>a?l/o:l/a;o*=c,a*=c,s.forEach(function(t){t.newWidth*=c,t.newHeight*=c})}var h=document.createElement("canvas");h.width=o,h.height=a;var u=h.getContext("2d");u.fillStyle="#FFFFFF",u.fillRect(0,0,o,a);var d=0,f=0;return s.forEach(function(t){u.drawImage(t.img,d,f,t.newWidth,t.newHeight),"horizontal"===e?d+=t.newWidth:f+=t.newHeight}),h}function gt(t){return gt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},gt(t)}function mt(){var t,e,i="function"==typeof Symbol?Symbol:{},n=i.iterator||"@@iterator",r=i.toStringTag||"@@toStringTag";function o(i,n,r,o){var l=n&&n.prototype instanceof s?n:s,c=Object.create(l.prototype);return bt(c,"_invoke",function(i,n,r){var o,s,l,c=0,h=r||[],u=!1,d={p:0,n:0,v:t,a:f,f:f.bind(t,4),d:function(e,i){return o=e,s=0,l=t,d.n=i,a}};function f(i,n){for(s=i,l=n,e=0;!u&&c&&!r&&e<h.length;e++){var r,o=h[e],f=d.p,p=o[2];i>3?(r=p===n)&&(l=o[(s=o[4])?5:(s=3,3)],o[4]=o[5]=t):o[0]<=f&&((r=i<2&&f<o[1])?(s=0,d.v=n,d.n=o[1]):f<p&&(r=i<3||o[0]>n||n>p)&&(o[4]=i,o[5]=n,d.n=p,s=0))}if(r||i>1)return a;throw u=!0,n}return function(r,h,p){if(c>1)throw TypeError("Generator is already running");for(u&&1===h&&f(h,p),s=h,l=p;(e=s<2?t:l)||!u;){o||(s?s<3?(s>1&&(d.n=-1),f(s,l)):d.n=l:d.v=l);try{if(c=2,o){if(s||(r="next"),e=o[r]){if(!(e=e.call(o,l)))throw TypeError("iterator result is not an object");if(!e.done)return e;l=e.value,s<2&&(s=0)}else 1===s&&(e=o.return)&&e.call(o),s<2&&(l=TypeError("The iterator does not provide a '"+r+"' method"),s=1);o=t}else if((e=(u=d.n<0)?l:i.call(n,d))!==a)break}catch(e){o=t,s=1,l=e}finally{c=1}}return{value:e,done:u}}}(i,r,o),!0),c}var a={};function s(){}function l(){}function c(){}e=Object.getPrototypeOf;var h=[][n]?e(e([][n]())):(bt(e={},n,function(){return this}),e),u=c.prototype=s.prototype=Object.create(h);function d(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,c):(t.__proto__=c,bt(t,r,"GeneratorFunction")),t.prototype=Object.create(u),t}return l.prototype=c,bt(u,"constructor",c),bt(c,"constructor",l),l.displayName="GeneratorFunction",bt(c,r,"GeneratorFunction"),bt(u),bt(u,r,"Generator"),bt(u,n,function(){return this}),bt(u,"toString",function(){return"[object Generator]"}),(mt=function(){return{w:o,m:d}})()}function bt(t,e,i,n){var r=Object.defineProperty;try{r({},"",{})}catch(t){r=0}bt=function(t,e,i,n){function o(e,i){bt(t,e,function(t){return this._invoke(e,i,t)})}e?r?r(t,e,{value:i,enumerable:!n,configurable:!n,writable:!n}):t[e]=i:(o("next",0),o("throw",1),o("return",2))},bt(t,e,i,n)}function yt(t,e){var i="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!i){if(Array.isArray(t)||(i=function(t,e){if(t){if("string"==typeof t)return xt(t,e);var i={}.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?xt(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){i&&(t=i);var n=0,r=function(){};return{s:r,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){i=i.call(t)},n:function(){var t=i.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==i.return||i.return()}finally{if(s)throw o}}}}function xt(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=Array(e);i<e;i++)n[i]=t[i];return n}function vt(t,e,i,n,r,o,a){try{var s=t[o](a),l=s.value}catch(t){return void i(t)}s.done?e(l):Promise.resolve(l).then(n,r)}function _t(t){return function(){var e=this,i=arguments;return new Promise(function(n,r){var o=t.apply(e,i);function a(t){vt(o,n,r,a,s,"next",t)}function s(t){vt(o,n,r,a,s,"throw",t)}a(void 0)})}}function wt(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,kt(n.key),n)}}function kt(t){var e=function(t,e){if("object"!=gt(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,e||"default");if("object"!=gt(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==gt(e)?e:e+""}window.renderV1MergedImages=function(){((arguments.length>0&&void 0!==arguments[0]?arguments[0]:null)||document).querySelectorAll(".v1-merged-image").forEach(function(t){!function(t){ut.apply(this,arguments)}(t)})};var St=function(){return t=function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.waitTime=e.waitTime||20,this.messages=e.messages||{},this.premiumUrl=e.premiumUrl||"/premium"},e=[{key:"detect",value:(r=_t(mt().m(function t(){var e,i,n,r,o,a,s,l,c,h,u,d,f,p,g;return mt().w(function(t){for(;;)switch(t.p=t.n){case 0:if("undefined"==typeof shindanCreate||!0!==shindanCreate){t.n=1;break}return t.a(2,!1);case 1:if(e=!1,t.p=2,i=!1,t.p=3,!navigator.brave||"function"!=typeof navigator.brave.isBrave){t.n=5;break}return t.n=4,navigator.brave.isBrave();case 4:i=t.v;case 5:t.n=7;break;case 6:t.p=6,t.v;case 7:if(!((n=this.detectAdNetworks()).length>0)){t.n=17;break}r=yt(n),t.p=8,r.s();case 9:if((o=r.n()).done){t.n=14;break}return a=o.value,t.p=10,t.n=11,fetch(a.url,{method:"HEAD",mode:"no-cors",cache:"no-store"});case 11:t.n=13;break;case 12:t.p=12,t.v,e=!0;case 13:t.n=9;break;case 14:t.n=16;break;case 15:t.p=15,p=t.v,r.e(p);case 16:return t.p=16,r.f(),t.f(16);case 17:if(!i||e){t.n=25;break}return t.n=18,new Promise(function(t){return setTimeout(t,100)});case 18:s=document.querySelectorAll('[id^="div-gpt-"], .adsbygoogle'),l=yt(s),t.p=19,l.s();case 20:if((c=l.n()).done){t.n=22;break}if(h=c.value,!((u=h.getBoundingClientRect()).top<window.innerHeight&&u.bottom>0)||0!==h.offsetHeight){t.n=21;break}return e=!0,t.a(3,22);case 21:t.n=20;break;case 22:t.n=24;break;case 23:t.p=23,g=t.v,l.e(g);case 24:return t.p=24,l.f(),t.f(24);case 25:(d=document.getElementById("abcheck"))&&("none"!==(f=window.getComputedStyle(d)).display&&"hidden"!==f.visibility&&0!==d.offsetHeight||(e=!0)),t.n=27;break;case 26:t.p=26,t.v;case 27:return t.a(2,e)}},t,this,[[19,23,24,25],[10,12],[8,15,16,17],[3,6],[2,26]])})),function(){return r.apply(this,arguments)})},{key:"detectAdNetworks",value:function(){var t=[];return document.querySelector(".adsbygoogle")&&t.push({name:"Google AdSense",url:"https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"}),document.querySelector('[id^="div-gpt-"]')&&t.push({name:"Google GPT",url:"https://securepubads.g.doubleclick.net/tag/js/gpt.js"}),(document.querySelector('[id^="im-"]')||document.querySelector('script[src*="i-mobile.co.jp"]'))&&t.push({name:"i-mobile",url:"https://imp-adedge.i-mobile.co.jp/script/v1/spot.js"}),(document.querySelector('[id^="taboola-"]')||document.querySelector('script[src*="taboola.com"]'))&&t.push({name:"Taboola",url:"https://cdn.taboola.com/libtrc/shindanmaker-japan/loader.js"}),t}},{key:"showCountdownAndWait",value:(n=_t(mt().m(function t(e){var i,n,r,o=this,a=arguments;return mt().w(function(t){for(;;)if(0===t.n)return i=a.length>1&&void 0!==a[1]?a[1]:null,n=this.waitTime,(r=function(t){var e=o.messages.countdown.replace(":seconds",t),n=o.messages.subscription&&o.messages.subscribeButton,r='\n <div class="alert alert-warning">\n <div class="font-70">'.concat(e,"</div>\n ").concat(n?"\n ".concat(o.messages.subscription,'\n <button class="btn btn-sm btn-primary mt-2" id="adblock_subscription_btn">\n ').concat(o.messages.subscribeButton,"\n </button>\n "):"","\n </div>\n ");document.querySelectorAll(".adblock-alert").forEach(function(t){return t.remove()});var a=document.createElement("div");if(a.className="adblock-alert px-3 px-sm-4 px-md-5 mb-3",a.innerHTML=r,i){var s=document.querySelector(i);s&&s.parentNode&&s.parentNode.insertBefore(a,s)}var l=document.getElementById("adblock_subscription_btn");l&&l.addEventListener("click",function(t){t.preventDefault(),o.messages.preparing?alert(o.messages.preparing):o.premiumUrl&&window.open(o.premiumUrl,"_blank")})})(n),t.a(2,new Promise(function(t){var i=setInterval(function(){--n>0?r(n):(clearInterval(i),document.querySelectorAll(".adblock-alert").forEach(function(t){return t.remove()}),e&&e(),t())},1e3)}))},t,this)})),function(t){return n.apply(this,arguments)})}],e&&wt(t.prototype,e),i&&wt(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,i,n,r}();function Mt(){var t,e,i="function"==typeof Symbol?Symbol:{},n=i.iterator||"@@iterator",r=i.toStringTag||"@@toStringTag";function o(i,n,r,o){var l=n&&n.prototype instanceof s?n:s,c=Object.create(l.prototype);return Dt(c,"_invoke",function(i,n,r){var o,s,l,c=0,h=r||[],u=!1,d={p:0,n:0,v:t,a:f,f:f.bind(t,4),d:function(e,i){return o=e,s=0,l=t,d.n=i,a}};function f(i,n){for(s=i,l=n,e=0;!u&&c&&!r&&e<h.length;e++){var r,o=h[e],f=d.p,p=o[2];i>3?(r=p===n)&&(l=o[(s=o[4])?5:(s=3,3)],o[4]=o[5]=t):o[0]<=f&&((r=i<2&&f<o[1])?(s=0,d.v=n,d.n=o[1]):f<p&&(r=i<3||o[0]>n||n>p)&&(o[4]=i,o[5]=n,d.n=p,s=0))}if(r||i>1)return a;throw u=!0,n}return function(r,h,p){if(c>1)throw TypeError("Generator is already running");for(u&&1===h&&f(h,p),s=h,l=p;(e=s<2?t:l)||!u;){o||(s?s<3?(s>1&&(d.n=-1),f(s,l)):d.n=l:d.v=l);try{if(c=2,o){if(s||(r="next"),e=o[r]){if(!(e=e.call(o,l)))throw TypeError("iterator result is not an object");if(!e.done)return e;l=e.value,s<2&&(s=0)}else 1===s&&(e=o.return)&&e.call(o),s<2&&(l=TypeError("The iterator does not provide a '"+r+"' method"),s=1);o=t}else if((e=(u=d.n<0)?l:i.call(n,d))!==a)break}catch(e){o=t,s=1,l=e}finally{c=1}}return{value:e,done:u}}}(i,r,o),!0),c}var a={};function s(){}function l(){}function c(){}e=Object.getPrototypeOf;var h=[][n]?e(e([][n]())):(Dt(e={},n,function(){return this}),e),u=c.prototype=s.prototype=Object.create(h);function d(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,c):(t.__proto__=c,Dt(t,r,"GeneratorFunction")),t.prototype=Object.create(u),t}return l.prototype=c,Dt(u,"constructor",c),Dt(c,"constructor",l),l.displayName="GeneratorFunction",Dt(c,r,"GeneratorFunction"),Dt(u),Dt(u,r,"Generator"),Dt(u,n,function(){return this}),Dt(u,"toString",function(){return"[object Generator]"}),(Mt=function(){return{w:o,m:d}})()}function Dt(t,e,i,n){var r=Object.defineProperty;try{r({},"",{})}catch(t){r=0}Dt=function(t,e,i,n){function o(e,i){Dt(t,e,function(t){return this._invoke(e,i,t)})}e?r?r(t,e,{value:i,enumerable:!n,configurable:!n,writable:!n}):t[e]=i:(o("next",0),o("throw",1),o("return",2))},Dt(t,e,i,n)}function Pt(t,e,i,n,r,o,a){try{var s=t[o](a),l=s.value}catch(t){return void i(t)}s.done?e(l):Promise.resolve(l).then(n,r)}function Tt(t){return function(){var e=this,i=arguments;return new Promise(function(n,r){var o=t.apply(e,i);function a(t){Pt(o,n,r,a,s,"next",t)}function s(t){Pt(o,n,r,a,s,"throw",t)}a(void 0)})}}function Ct(){return Et.apply(this,arguments)}function Et(){return(Et=Tt(Mt().m(function t(){var e,i,n;return Mt().w(function(t){for(;;)switch(t.n){case 0:return n=new St({waitTime:(null===(e=window.adblockConfig)||void 0===e?void 0:e.waitTime)||20,isOwner:"undefined"!=typeof is_my_shindan&&is_my_shindan,messages:window.adblockMessages||{},premiumUrl:(null===(i=window.adblockConfig)||void 0===i?void 0:i.premiumUrl)||"/premium"}),t.n=1,n.detect();case 1:return t.a(2)}},t)}))).apply(this,arguments)}function Ot(){return new Promise(function(t){requestAnimationFrame(function(){requestAnimationFrame(t)})})}document.addEventListener("DOMContentLoaded",Tt(Mt().m(function t(){var e,i,n,r,o,a,s,l,c,h,u,d,f;return Mt().w(function(t){for(;;)switch(t.p=t.n){case 0:return"undefined"!=typeof shindan_id&&window.ShindanFormStorage&&(new window.ShindanFormStorage).init(shindan_id),document.getElementById("sh_ab_txt")&&Ct(),t.n=1,Ot();case 1:if(r=function(){document.querySelectorAll(".shindan-share-overlay").forEach(function(t){t.classList.remove("shindan-share-overlay")})},o=document.getElementById("shindanResult"),a=(null==o||null===(e=o.dataset)||void 0===e?void 0:e.blocks)||(null==o||null===(i=o.dataset)||void 0===i?void 0:i.resultBlocks),s=null==o||null===(n=o.dataset)||void 0===n?void 0:n.context,!o||!a){t.n=6;break}return t.p=2,l=JSON.parse(a),c=s?JSON.parse(s):{},l.find(function(t){return"text"===t.type}),t.n=3,Q(o,{blocks:l,context:c},"default",{useSequencer:!0,autoStartSequence:!0,onSequenceStart:function(){},onSequenceComplete:function(){r()}});case 3:h=o.querySelectorAll(".typing-effect-block"),u=o.querySelectorAll(".shuffle-effect-block"),h.length,u.length,t.n=5;break;case 4:t.p=4,t.v;case 5:t.n=7;break;case 6:d=document.querySelectorAll(".typing-effect-block"),f=document.querySelectorAll(".shuffle-effect-block"),(d.length>0||f.length>0)&&et({typingSelector:".typing-effect-block",shuffleSelector:".shuffle-effect-block"}),document.querySelectorAll(".shindan-chart-block").length>0&&K();case 7:return t.a(2)}},t,null,[[2,4]])}))),window.addEventListener("load",function(){initActionButtonsSticky()}),window.initActionButtonsSticky=function(){var t=document.querySelector(".result-action-buttons");if(t){t._stickyScrollHandler&&window.removeEventListener("scroll",t._stickyScrollHandler);var e=0,i=0,n=0,r=0,o=t.nextElementSibling;o&&o.classList.contains("result-action-buttons-spacer")||((o=document.createElement("div")).className="result-action-buttons-spacer",o.style.display="none",t.parentNode.insertBefore(o,t.nextSibling));var a=function(){var e=t.classList.contains("is-sticky");e&&(t.classList.remove("is-sticky"),o.style.display="none"),n=t.getBoundingClientRect().top+window.pageYOffset;var i=window.getComputedStyle(t);r=t.offsetHeight+parseFloat(i.marginTop)+parseFloat(i.marginBottom),e&&(t.classList.add("is-sticky"),o.style.height=r+"px",o.style.display="block")};a(),t._recalculatePosition=a;var s=!1,l=function(){s||(window.requestAnimationFrame(function(){if(i=window.pageYOffset||document.documentElement.scrollTop,n+r+10<i)t.classList.contains("is-sticky")||(t.classList.add("is-sticky"),o.style.height=r+"px",o.style.display="block","undefined"!=typeof $&&$(t).find('[data-toggle="tooltip"]').tooltip("hide"),setTimeout(function(){a()},100)),Math.abs(e-i)>=5&&(i>e&&i>10?t.classList.add("show"):t.classList.contains("show")&&("undefined"!=typeof $&&$(t).find('[data-toggle="tooltip"]').tooltip("hide"),t.classList.remove("show")),e=i);else{var l=t.classList.contains("is-sticky");t.classList.remove("is-sticky"),t.classList.remove("show"),o.style.display="none",e=i,l&&setTimeout(function(){a()},100)}s=!1}),s=!0)};t._stickyScrollHandler=l,window.addEventListener("scroll",l,{passive:!0})}},$(document).on("click","#loadMoreShindanTimeline",function(){var t=$(this).data("page");$(this).children("i").remove(),$(this).prepend(btn_spinner),function(t){$.ajax({url:"/loadMoreShindanTimeline",type:"POST",dataType:"json",data:{shindan_info,page:t}}).done(function(t){void 0!==t.html?($("#loadMoreShindanTimelineContainer").remove(),$("#resultRows").addClass("timeline-block-expanded"),$("#resultRows").append(t.html),$('[data-toggle="tooltip"]').tooltip(),"function"==typeof updateTimestamps&&updateTimestamps(),lazyload(),twemoji.parse(document.getElementById("resultRows"),{base:twemoji_asset}),renderAllV2TimelineResults()):$(this).remove()}).fail(function(){})}(t)}),window.renderResult=Q,window.renderSavedResult=function(t,e){return it.apply(this,arguments)},window.initializeChartsFromDOM=K,document.addEventListener("DOMContentLoaded",function(){var t=document.getElementById("clearStorageBtn");t&&t.addEventListener("click",function(){var e=t.dataset.confirmMessage,i=t.dataset.successMessage;confirm(e)&&window.shindanFormStorage&&(window.shindanFormStorage.clearAllData(),alert(i),location.reload())})})})()})();