yacd/assets/chart-lib-ced68107.js

17 lines
151 KiB
JavaScript
Raw Permalink Normal View History

2023-02-12 23:03:37 +08:00
var gn=Object.defineProperty;var pn=(i,t,e)=>t in i?gn(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e;var S=(i,t,e)=>(pn(i,typeof t!="symbol"?t+"":t,e),e);/*!
* @kurkle/color v0.3.2
* https://github.com/kurkle/color#readme
* (c) 2023 Jukka Kurkela
* Released under the MIT License
*/function te(i){return i+.5|0}const ot=(i,t,e)=>Math.max(Math.min(i,e),t);function Wt(i){return ot(te(i*2.55),0,255)}function ht(i){return ot(te(i*255),0,255)}function st(i){return ot(te(i/2.55)/100,0,1)}function ui(i){return ot(te(i*100),0,100)}const q={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},Ye=[..."0123456789ABCDEF"],mn=i=>Ye[i&15],bn=i=>Ye[(i&240)>>4]+Ye[i&15],oe=i=>(i&240)>>4===(i&15),_n=i=>oe(i.r)&&oe(i.g)&&oe(i.b)&&oe(i.a);function xn(i){var t=i.length,e;return i[0]==="#"&&(t===4||t===5?e={r:255&q[i[1]]*17,g:255&q[i[2]]*17,b:255&q[i[3]]*17,a:t===5?q[i[4]]*17:255}:(t===7||t===9)&&(e={r:q[i[1]]<<4|q[i[2]],g:q[i[3]]<<4|q[i[4]],b:q[i[5]]<<4|q[i[6]],a:t===9?q[i[7]]<<4|q[i[8]]:255})),e}const yn=(i,t)=>i<255?t(i):"";function vn(i){var t=_n(i)?mn:bn;return i?"#"+t(i.r)+t(i.g)+t(i.b)+yn(i.a,t):void 0}const kn=/^(hsla?|hwb|hsv)\(\s*([-+.e\d]+)(?:deg)?[\s,]+([-+.e\d]+)%[\s,]+([-+.e\d]+)%(?:[\s,]+([-+.e\d]+)(%)?)?\s*\)$/;function Ps(i,t,e){const s=t*Math.min(e,1-e),n=(o,r=(o+i/30)%12)=>e-s*Math.max(Math.min(r-3,9-r,1),-1);return[n(0),n(8),n(4)]}function wn(i,t,e){const s=(n,o=(n+i/60)%6)=>e-e*t*Math.max(Math.min(o,4-o,1),0);return[s(5),s(3),s(1)]}function Mn(i,t,e){const s=Ps(i,1,.5);let n;for(t+e>1&&(n=1/(t+e),t*=n,e*=n),n=0;n<3;n++)s[n]*=1-t-e,s[n]+=t;return s}function Sn(i,t,e,s,n){return i===n?(t-e)/s+(t<e?6:0):t===n?(e-i)/s+2:(i-t)/s+4}function ti(i){const e=i.r/255,s=i.g/255,n=i.b/255,o=Math.max(e,s,n),r=Math.min(e,s,n),a=(o+r)/2;let l,c,h;return o!==r&&(h=o-r,c=a>.5?h/(2-o-r):h/(o+r),l=Sn(e,s,n,h,o),l=l*60+.5),[l|0,c||0,a]}function ei(i,t,e,s){return(Array.isArray(t)?i(t[0],t[1],t[2]):i(t,e,s)).map(ht)}function ii(i,t,e){return ei(Ps,i,t,e)}function Pn(i,t,e){return ei(Mn,i,t,e)}function Dn(i,t,e){return ei(wn,i,t,e)}function Ds(i){return(i%360+360)%360}function On(i){const t=kn.exec(i);let e=255,s;if(!t)return;t[5]!==s&&(e=t[6]?Wt(+t[5]):ht(+t[5]));const n=Ds(+t[2]),o=+t[3]/100,r=+t[4]/100;return t[1]==="hwb"?s=Pn(n,o,r):t[1]==="hsv"?s=Dn(n,o,r):s=ii(n,o,r),{r:s[0],g:s[1],b:s[2],a:e}}function Ln(i,t){var e=ti(i);e[0]=Ds(e[0]+t),e=ii(e),i.r=e[0],i.g=e[1],i.b=e[2]}function Tn(i){if(!i)return;const t=ti(i),e=t[0],s=ui(t[1]),n=ui(t[2]);return i.a<255?`hsla(${e}, ${s}%, ${n}%, ${st(i.a)})`:`hsl(${e}, ${s}%, ${n}%)`}const gi={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"},pi={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",mocca
* Chart.js v4.2.1
* https://www.chartjs.org
* (c) 2023 Chart.js Contributors
* Released under the MIT License
*/const Bn=(()=>{let i=0;return()=>i++})();function A(i){return i===null||typeof i>"u"}function F(i){if(Array.isArray&&Array.isArray(i))return!0;const t=Object.prototype.toString.call(i);return t.slice(0,7)==="[object"&&t.slice(-6)==="Array]"}function L(i){return i!==null&&Object.prototype.toString.call(i)==="[object Object]"}function z(i){return(typeof i=="number"||i instanceof Number)&&isFinite(+i)}function U(i,t){return z(i)?i:t}function O(i,t){return typeof i>"u"?t:i}const Hn=(i,t)=>typeof i=="string"&&i.endsWith("%")?parseFloat(i)/100*t:+i;function I(i,t,e){if(i&&typeof i.call=="function")return i.apply(e,t)}function N(i,t,e,s){let n,o,r;if(F(i))if(o=i.length,s)for(n=o-1;n>=0;n--)t.call(e,i[n],n);else for(n=0;n<o;n++)t.call(e,i[n],n);else if(L(i))for(r=Object.keys(i),o=r.length,n=0;n<o;n++)t.call(e,i[r[n]],r[n])}function bi(i,t){let e,s,n,o;if(!i||!t||i.length!==t.length)return!1;for(e=0,s=i.length;e<s;++e)if(n=i[e],o=t[e],n.datasetIndex!==o.datasetIndex||n.index!==o.index)return!1;return!0}function ke(i){if(F(i))return i.map(ke);if(L(i)){const t=Object.create(null),e=Object.keys(i),s=e.length;let n=0;for(;n<s;++n)t[e[n]]=ke(i[e[n]]);return t}return i}function Ls(i){return["__proto__","prototype","constructor"].indexOf(i)===-1}function Nn(i,t,e,s){if(!Ls(i))return;const n=t[i],o=e[i];L(n)&&L(o)?qt(n,o,s):t[i]=ke(o)}function qt(i,t,e){const s=F(t)?t:[t],n=s.length;if(!L(i))return i;e=e||{};const o=e.merger||Nn;let r;for(let a=0;a<n;++a){if(r=s[a],!L(r))continue;const l=Object.keys(r);for(let c=0,h=l.length;c<h;++c)o(l[c],i,r,e)}return i}function jt(i,t){return qt(i,t,{merger:Wn})}function Wn(i,t,e){if(!Ls(i))return;const s=t[i],n=e[i];L(s)&&L(n)?jt(s,n):Object.prototype.hasOwnProperty.call(t,i)||(t[i]=ke(n))}const _i={"":i=>i,x:i=>i.x,y:i=>i.y};function Vn(i){const t=i.split("."),e=[];let s="";for(const n of t)s+=n,s.endsWith("\\")?s=s.slice(0,-1)+".":(e.push(s),s="");return e}function jn(i){const t=Vn(i);return e=>{for(const s of t){if(s==="")break;e=e&&e[s]}return e}}function we(i,t){return(_i[t]||(_i[t]=jn(t)))(i)}function si(i){return i.charAt(0).toUpperCase()+i.slice(1)}const Z=i=>typeof i<"u",ft=i=>typeof i=="function",xi=(i,t)=>{if(i.size!==t.size)return!1;for(const e of i)if(!t.has(e))return!1;return!0};function $n(i){return i.type==="mouseup"||i.type==="click"||i.type==="contextmenu"}const H=Math.PI,X=2*H,Un=X+H,Me=Number.POSITIVE_INFINITY,Yn=H/180,j=H/2,dt=H/4,yi=H*2/3,rt=Math.log10,Ot=Math.sign;function $t(i,t,e){return Math.abs(i-t)<e}function vi(i){const t=Math.round(i);i=$t(i,t,i/1e3)?t:i;const e=Math.pow(10,Math.floor(rt(i))),s=i/e;return(s<=1?1:s<=2?2:s<=5?5:10)*e}function Xn(i){const t=[],e=Math.sqrt(i);let s;for(s=1;s<e;s++)i%s===0&&(t.push(s),t.push(i/s));return e===(e|0)&&t.push(e),t.sort((n,o)=>n-o).pop(),t}function Gt(i){return!isNaN(parseFloat(i))&&isFinite(i)}function Kn(i,t){const e=Math.round(i);return e-t<=i&&e+t>=i}function Ts(i,t,e){let s,n,o;for(s=0,n=i.length;s<n;s++)o=i[s][e],isNaN(o)||(t.min=Math.min(t.min,o),t.max=Math.max(t.max,o))}function at(i){return i*(H/180)}function ni(i){return i*(180/H)}function ki(i){if(!z(i))return;let t=1,e=0;for(;Math.round(i*t)/t!==i;)t*=10,e++;return e}function qn(i,t){const e=t.x-i.x,s=t.y-i.y,n=Math.sqrt(e*e+s*s);let o=Math.atan2(s,e);return o<-.5*H&&(o+=X),{angle:o,distance:n}}function wi(i,t){return Math.sqrt(Math.pow(t.x-i.x,2)+Math.pow(t.y-i.y,2))}function Gn(i,t){return(i-t+Un)%X-H}function Y(i){return(i%X+X)%X}function Cs(i,t,e,s){const n=Y(i),o=Y(t),r=Y(e),a=Y(o-n),l=Y(r-n),c=Y(n-o),h=Y(n-r);return n===o||n===r||s&&o===r||a>l&&c<h}function tt(i,t,e){return Math.max(t,Math.min(e,i))}function Zn(i){return tt(i,-32768,32767)}function Dt(i,t,e,s=1e-6){return i>=Math.min(t,e)-s&&i<=Math.max(t,e)+s}function oi(i,t,e){e=e||(r=>i[r]<t);let s=i.length-1,n=0,o;for(;s-n>1;)o=n+s>>1,e(o)?n=o:s=o;return{lo:n,hi:s}}const _t=(i,t,e,s)=>oi(i,e,s?n=>{const o=i[n][t];return o<e||o===e&&i[n+1][t]===e}:n=>i[n][t]<e),Qn=(i,t,e)=>oi(i,e,s=>i[s][t]>=e);function Jn(i,t,e){let s=0,n=i.length;for(;s<n&&i[s]<t;)s++;for(;n>s&&i[n-1]>e;)n--;return s>0||n<i.length?i.slic
* Chart.js v4.2.1
* https://www.chartjs.org
* (c) 2023 Chart.js Contributors
* Released under the MIT License
*/class hr{constructor(){this._request=null,this._charts=new Map,this._running=!1,this._lastDate=void 0}_notify(t,e,s,n){const o=e.listeners[n],r=e.duration;o.forEach(a=>a({chart:t,initial:e.initial,numSteps:r,currentStep:Math.min(s-e.start,r)}))}_refresh(){this._request||(this._running=!0,this._request=As.call(window,()=>{this._update(),this._request=null,this._running&&this._refresh()}))}_update(t=Date.now()){let e=0;this._charts.forEach((s,n)=>{if(!s.running||!s.items.length)return;const o=s.items;let r=o.length-1,a=!1,l;for(;r>=0;--r)l=o[r],l._active?(l._total>s.duration&&(s.duration=l._total),l.tick(t),a=!0):(o[r]=o[o.length-1],o.pop());a&&(n.draw(),this._notify(n,s,t,"progress")),o.length||(s.running=!1,this._notify(n,s,t,"complete"),s.initial=!1),e+=o.length}),this._lastDate=t,e===0&&(this._running=!1)}_getAnims(t){const e=this._charts;let s=e.get(t);return s||(s={running:!1,initial:!0,items:[],listeners:{complete:[],progress:[]}},e.set(t,s)),s}listen(t,e,s){this._getAnims(t).listeners[e].push(s)}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((s,n)=>Math.max(s,n._duration),0),this._refresh())}running(t){if(!this._running)return!1;const e=this._charts.get(t);return!(!e||!e.running||!e.items.length)}stop(t){const e=this._charts.get(t);if(!e||!e.items.length)return;const s=e.items;let n=s.length-1;for(;n>=0;--n)s[n].cancel();e.items=[],this._notify(t,e,Date.now(),"complete")}remove(t){return this._charts.delete(t)}}var it=new hr;const Ri="transparent",fr={boolean(i,t,e){return e>.5?t:i},color(i,t,e){const s=Di(i||Ri),n=s.valid&&Di(t||Ri);return n&&n.valid?n.mix(s,e).hexString():t},number(i,t,e){return i+(t-i)*e}};class dr{constructor(t,e,s,n){const o=e[s];n=ce([t.to,n,o,t.from]);const r=ce([t.from,o,n]);this._active=!0,this._fn=t.fn||fr[t.type||typeof r],this._easing=Ut[t.easing]||Ut.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=s,this._from=r,this._to=n,this._promises=void 0}active(){return this._active}update(t,e,s){if(this._active){this._notify(!1);const n=this._target[this._prop],o=s-this._start,r=this._duration-o;this._start=s,this._duration=Math.floor(Math.max(r,t.duration)),this._total+=o,this._loop=!!t.loop,this._to=ce([t.to,e,n,t.from]),this._from=ce([t.from,n,e])}}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(t){const e=t-this._start,s=this._duration,n=this._prop,o=this._from,r=this._loop,a=this._to;let l;if(this._active=o!==a&&(r||e<s),!this._active){this._target[n]=a,this._notify(!0);return}if(e<0){this._target[n]=o;return}l=e/s%2,l=r&&l>1?2-l:l,l=this._easing(Math.min(1,Math.max(0,l))),this._target[n]=this._fn(o,a,l)}wait(){const t=this._promises||(this._promises=[]);return new Promise((e,s)=>{t.push({res:e,rej:s})})}_notify(t){const e=t?"res":"rej",s=this._promises||[];for(let n=0;n<s.length;n++)s[n][e]()}}class ur{constructor(t,e){this._chart=t,this._properties=new Map,this.configure(e)}configure(t){if(!L(t))return;const e=Object.keys(R.animation),s=this._properties;Object.getOwnPropertyNames(t).forEach(n=>{const o=t[n];if(!L(o))return;const r={};for(const a of e)r[a]=o[a];(F(o.properties)&&o.properties||[n]).forEach(a=>{(a===n||!s.has(a))&&s.set(a,r)})})}_animateOptions(t,e){const s=e.options,n=pr(t,s);if(!n)return[];const o=this._createAnimations(n,s);return s.$shared&&gr(t.options.$animations,s).then(()=>{t.options=s},()=>{}),o}_createAnimations(t,e){const s=this._properties,n=[],o=t.$animations||(t.$animations={}),r=Object.keys(e),a=Date.now();let l;for(l=r.length-1;l>=0;--l){const c=r[l];if(c.charAt(0)==="$")continue;if(c==="options"){n.push(...this._animateOptions(t,e));continue}const h=e[c];let f=o[c];const d=s.get(c);if(f)if(d&&f.active()){f.update(d,h,a);continue}else f.cancel();if(!d||!d.duration){t[c]=h;continue}o[c]=f=new dr(d,t,c,h),n.push(f)}return n}update(t,e){if(this._properties.size===0