vite-plugin-kiru 0.28.1 → 0.28.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +11 -12
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1723,35 +1723,35 @@ var dist_default = `<!DOCTYPE html>
|
|
|
1723
1723
|
<link rel="icon" type="image/svg+xml" href="./favicon.svg" />
|
|
1724
1724
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
1725
1725
|
<title>Kiru Devtools</title>
|
|
1726
|
-
<script type="module" crossorigin>(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))i(s);new MutationObserver(s=>{for(const o of s)if(o.type==="childList")for(const r of o.addedNodes)r.tagName==="LINK"&&r.rel==="modulepreload"&&i(r)}).observe(document,{childList:!0,subtree:!0});function n(s){const o={};return s.integrity&&(o.integrity=s.integrity),s.referrerPolicy&&(o.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?o.credentials="include":s.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function i(s){if(s.ep)return;s.ep=!0;const o=n(s);fetch(s.href,o)}})();const va=Symbol.for("kiru.signal"),Ac=Symbol.for("kiru.context"),Oi=Symbol.for("kiru.contextProvider"),$e=Symbol.for("kiru.fragment"),_a=Symbol.for("kiru.error"),wa=Symbol.for("kiru.memo"),Ys=Symbol.for("kiru.errorBoundary"),Ic=50,ne=2,St=4,Pi=8,re=16,Sa=32,as=64,Ye=128,Lc=/^on:?/,ka=new Set(["animateTransform","circle","clipPath","defs","desc","ellipse","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feMerge","feMergeNode","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","filter","foreignObject","g","image","line","linearGradient","marker","path","polygon","polyline","radialGradient","rect","stop","svg","switch","symbol","text","textPath","title","tspan","use"]),Rc=new Set(["allowfullscreen","autofocus","autoplay","async","checked","compact","controls","contenteditable","declare","default","defer","disabled","download","hidden","inert","ismap","multiple","nohref","noresize","noshade","novalidate","nowrap","open","popover","readonly","required","sandbox","scoped","selected","sortable","spellcheck","translate","wrap"]),Nc=new Map([["acceptCharset","accept-charset"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["httpEquiv","http-equiv"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),pi={internalProps:["children","ref","key","innerHTML"],isEvent:e=>e.startsWith("on"),isProperty:e=>!pi.internalProps.includes(e)&&!pi.isEvent(e)};function zc(e){switch(e){case"className":return"class";case"htmlFor":return"for";case"tabIndex":case"formAction":case"formMethod":case"formEncType":case"contentEditable":case"spellCheck":case"allowFullScreen":case"autoPlay":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"noModule":case"noValidate":case"popoverTarget":case"popoverTargetAction":case"playsInline":case"readOnly":case"itemscope":case"rowSpan":case"crossOrigin":return e.toLowerCase();default:return e.indexOf("-")>-1?e:e.startsWith("aria")?"aria-"+e.substring(4).toLowerCase():Nc.get(e)||e}}const Fc="production",he=Fc==="development",De={current:null},Ta={current:0},Xt={current:"window"in globalThis?"dom":"string"};function kt(){return Xt.current==="dom"||Xt.current==="hydrate"}var Ma;class Xe extends Error{constructor(t){const n=typeof t=="string"?t:t.message;super(n),this[Ma]=!0,typeof t!="string"&&(this.fatal=t?.fatal)}static isKiruError(t){return t instanceof Error&&t[_a]===!0}}Ma=_a;function Hc(e){return(e.flags&Pi)!==0}function Xs(e){return typeof e=="object"&&e!==null&&"type"in e}function Bc(e){return e===$e||e===Oi||e===Ys}function Vc(e){return e.type===$e}function Wc(e){return typeof e.type=="function"&&"displayName"in e.type&&e.type.displayName==="Kiru.lazy"}function jc(e){return typeof e.type=="function"&&"displayName"in e.type&&e.type.displayName==="Kiru.memo"}function gi(e){const{props:{children:t,...n},memoizedProps:i,index:s}=e;e.prev={props:n,memoizedProps:i,index:s},e.flags&=-15}function Di(e,t){t(e);let n=e.child;for(;n;)t(n),n.child&&Di(n,t),n=n.sibling}function Uc(e,t){let n=e.parent;for(;n;){if(t(n))return n;n=n.parent}return null}function $c(e){return Uc(e,t=>t.type===Ys)}function Yc(e){return typeof e=="string"||typeof e=="number"}function Xc(e){return typeof e=="function"||typeof e=="object"&&!!e&&"current"in e||W.isSignal(e)}const qc="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz-";function Gc(e=10,t=qc){let n="";for(let i=0;i<e;i++)n+=t[Math.random()*t.length|0];return n}const Fo=Object.freeze(()=>{}),ls={stack:new Array,current:function(){return this.stack[this.stack.length-1]}},Ve=new Map;function Cn(e,t=!1){return W.isSignal(e)?t?e.value:e.peek():e}const Kc=()=>{Ve.forEach(e=>e()),Ve.clear()},On={parentStack:[],childIdxStack:[],eventDeferrals:new Map,parent:function(){return this.parentStack[this.parentStack.length-1]},clear:function(){this.parentStack.length=0,this.childIdxStack.length=0},pop:function(){this.parentStack.pop(),this.childIdxStack.pop()},push:function(e){this.parentStack.push(e),this.childIdxStack.push(0)},currentChild:function(){return this.parentStack[this.parentStack.length-1].childNodes[this.childIdxStack[this.childIdxStack.length-1]]},nextChild:function(){return this.parentStack[this.parentStack.length-1].childNodes[this.childIdxStack[this.childIdxStack.length-1]++]},bumpChildIndex:function(){this.childIdxStack[this.childIdxStack.length-1]++},captureEvents:function(e){Ho(e,!0),this.eventDeferrals.set(e,[])},resetEvents:function(e){this.eventDeferrals.delete(e)},releaseEvents:function(e){Ho(e,!1);const t=this.eventDeferrals.get(e);for(;t?.length;)t.shift()()}},Zc=e=>{const t=e.target;!e.isTrusted||!t||On.eventDeferrals.get(t)?.push(()=>t.dispatchEvent(e))},Ho=(e,t)=>{for(const n in e)if(n.startsWith("on")){const i=n.substring(2);e[t?"addEventListener":"removeEventListener"](i,Zc,{passive:!0})}};let qs=!1,cs=!1;const Ea=e=>{e.preventDefault(),e.stopPropagation(),cs=!0};let Te=null;function Qc(){qs=!0,Te=document.activeElement,Te&&Te!==document.body&&Te.addEventListener("blur",Ea)}function Jc(){cs&&(Te.removeEventListener("blur",Ea),Te.isConnected&&Te.focus(),cs=!1),qs=!1}function us(e,t){if(typeof e=="function"){e(t);return}if(W.isSignal(e)){e.sneak(t),e.notify({filter:n=>typeof n=="function"});return}e.current=t}function tu(e){const t=e.type;return t=="#text"?eu(e):ka.has(t)?document.createElementNS("http://www.w3.org/2000/svg",t):document.createElement(t)}function eu(e){const{nodeValue:t}=e.props;if(!W.isSignal(t))return document.createTextNode(t);const n=t.peek()??"",i=document.createTextNode(n);return fs(e,i,t),i}function nu(e,t,n){const i=hs.get(e)??{},s=i[t]=o=>{if(qs){o.preventDefault(),o.stopPropagation();return}n(o)};return hs.set(e,i),s}const hs=new WeakMap;function Ca(e){const t=e.dom,n=e.prev?.props??{},i=e.props??{},s=new Set([...Object.keys(n),...Object.keys(i)]),o=Xt.current==="hydrate";s.forEach(r=>{const a=n[r],l=i[r];if(pi.internalProps.includes(r)&&r!=="innerHTML"){r==="ref"&&a!==l&&(a&&us(a,null),l&&us(l,t));return}if(pi.isEvent(r)){if(a!==l||Xt.current==="hydrate"){const c=r.replace(Lc,""),u=c==="focus"||c==="blur";r in n&&t.removeEventListener(c,u?hs.get(e)?.[c]:a),r in i&&t.addEventListener(c,u?nu(e,c,l):l)}return}if(!(t instanceof Text)){if(a===l||o&&t.getAttribute(r)===l)return;if(W.isSignal(a)&&e.cleanups){const c=e.cleanups[r];c&&(c(),delete e.cleanups[r])}if(W.isSignal(l))return ru(e,t,r,l,a);ui(t,r,l,a);return}W.isSignal(l)||t.nodeValue!==l&&(t.nodeValue=l)})}function iu(e){return e.multiple?Array.from(e.selectedOptions).map(t=>t.value):e.value}function Oa(e,t){if(!e.multiple||t===void 0||t===null||t===""){e.value=t;return}Array.from(e.options).forEach(n=>{n.selected=t.indexOf(n.value)>-1})}const su={value:"input",checked:"change",open:"toggle",volume:"volumechange",playbackRate:"ratechange",currentTime:"timeupdate"},ou=["progress","meter","number","range"];function ru(e,t,n,i,s){const o=e.cleanups??(e.cleanups={}),[r,a]=n.split(":");if(r!=="bind")return o[n]=i.subscribe((y,v)=>{ui(t,n,y,v)}),ui(t,n,i.peek(),Cn(s));const l=su[a];if(!l)return;const c=t instanceof HTMLSelectElement,u=c?y=>Oa(t,y):y=>t[a]=y,f=y=>{u(y)},p=y=>{i.sneak(y),i.notify({filter:v=>v!==f})};let g;if(a==="value"){const y=ou.indexOf(t.type)!==-1;g=()=>{let v=t.value;c?v=iu(t):typeof i.peek()=="number"&&y&&(v=t.valueAsNumber),p(v)}}else g=y=>{const v=y.target[a];a==="currentTime"&&i.peek()===v||p(v)};t.addEventListener(l,g);const x=i.subscribe(f);return o[n]=()=>{t.removeEventListener(l,g),x()},ui(t,a,i.peek(),Cn(s))}function fs(e,t,n){(e.cleanups??(e.cleanups={})).nodeValue=n.subscribe((i,s)=>{i!==s&&(t.nodeValue=i)})}function au(e){const t=On.nextChild();if(!t)throw new Xe({message:"Hydration mismatch - no node found",vNode:e});let n=t.nodeName;if(ka.has(n)||(n=n.toLowerCase()),e.type!==n)throw new Xe({message:\`Hydration mismatch - expected node of type \${e.type.toString()} but received \${n}\`,vNode:e});if(e.dom=t,e.type!=="#text"&&!(e.flags&re)){Ca(e);return}W.isSignal(e.props.nodeValue)&&fs(e,t,e.props.nodeValue);let i=e,s=e.sibling;for(;s&&s.type==="#text";){const o=s;On.bumpChildIndex();const r=String(Cn(i.props.nodeValue)??""),a=i.dom.splitText(r.length);o.dom=a,W.isSignal(o.props.nodeValue)&&fs(o,a,o.props.nodeValue),i=s,s=s.sibling}}function Pa(e,t,n,i=!1){if(n===null)return e.removeAttribute(t),!0;switch(typeof n){case"undefined":case"function":case"symbol":return e.removeAttribute(t),!0;case"boolean":if(i&&!n)return e.removeAttribute(t),!0}return!1}function lu(e,t,n){const i=Rc.has(t);Pa(e,t,n,i)||e.setAttribute(t,i&&typeof n=="boolean"?"":String(n))}const cu=["INPUT","TEXTAREA"],uu=e=>cu.indexOf(e.nodeName)>-1;function ui(e,t,n,i){if(n!==i)switch(t){case"style":return du(e,n,i);case"className":return fu(e,n);case"innerHTML":return hu(e,n);case"muted":e.muted=!!n;return;case"value":if(e.nodeName==="SELECT")return Oa(e,n);const s=n==null?"":String(n);if(uu(e)){e.value=s;return}e.setAttribute("value",s);return;case"checked":if(e.nodeName==="INPUT"){e.checked=!!n;return}e.setAttribute("checked",String(n));return;default:return lu(e,zc(t),n)}}function hu(e,t){if(t==null||typeof t=="boolean"){e.innerHTML="";return}e.innerHTML=String(t)}function fu(e,t){const n=Cn(t);if(!n)return e.removeAttribute("class");e.setAttribute("class",n)}function du(e,t,n){if(Pa(e,"style",t))return;if(typeof t=="string"){e.setAttribute("style",t);return}let i={};typeof n=="string"?e.setAttribute("style",""):typeof n=="object"&&n&&(i=n);const s=t;new Set([...Object.keys(i),...Object.keys(s)]).forEach(r=>{const a=i[r],l=s[r];if(a!==l){if(l===void 0){e.style[r]="";return}e.style[r]=l}})}function pu(e){let t=e.parent,n=t?.dom;for(;t&&!n;)t=t.parent,n=t?.dom;if(!n||!t){if(!e.parent&&e.dom)return e;throw new Xe({message:"No DOM parent found while attempting to place node.",vNode:e})}return t}function gu(e,t){const{node:n,lastChild:i}=t,s=e.dom;if(i){i.after(s);return}const o=Da(e,n);if(o){n.dom.insertBefore(s,o);return}n.dom.appendChild(s)}function Da(e,t){let n=e;for(;n;){let i=n.sibling;for(;i;){if(!(i.flags&(St|re))){const s=mu(i);if(s?.isConnected)return s}i=i.sibling}if(n=n.parent,!n||n.flags&re||n===t)return}}function mu(e){let t=e;for(;t;){if(t.dom)return t.dom;if(t.flags&re)return;t=t.child}}function bu(e){if(Xt.current==="hydrate")return Di(e,gi);const t={node:e.dom?e:pu(e)};ds(e,t,(e.flags&St)>0),e.dom&&!(e.flags&re)&&Aa(e,t,!1),gi(e)}function ds(e,t,n){let i=e.child;for(;i;){if(i.flags&as){i.flags&St&&xu(i,t),gi(i),i=i.sibling;continue}i.dom?(ds(i,{node:i},!1),i.flags&re||Aa(i,t,n)):ds(i,t,(i.flags&St)>0||n),gi(i),i=i.sibling}}function Aa(e,t,n){(n||!e.dom.isConnected||e.flags&St)&&gu(e,t),(!e.prev||e.flags&ne)&&Ca(e),t.lastChild=e.dom}function yu(e){e===e.parent?.child&&(e.parent.child=e.sibling),Di(e,t=>{const{hooks:n,subs:i,cleanups:s,dom:o,props:{ref:r}}=t;for(i?.forEach(a=>a()),s&&Object.values(s).forEach(a=>a());n?.length;)n.pop().cleanup?.();o&&(r&&us(r,null),o.isConnected&&!(t.flags&re)&&o.remove(),delete t.dom)}),e.parent=null}function xu(e,t){if(!e.child)return;const n=[];if(Ia(e.child,n),n.length===0)return;const{node:i,lastChild:s}=t;if(s)s.after(...n);else{const o=Da(e,i),r=i.dom;o?o.before(...n):r.append(...n)}t.lastChild=n[n.length-1]}function Ia(e,t){let n=e;for(;n;)n.dom?t.push(n.dom):n.child&&Ia(n.child,t),n=n.sibling}function vu(e){return typeof e=="function"&&typeof e[wa]?.arePropsEqual=="function"}function m(e,t=null,...n){if(e===Tt)return Tt({children:n,...t});const i={type:e,flags:0,index:0,depth:0,props:{},parent:null,sibling:null,child:null,prev:null,deletions:null};if(vu(e)&&(i.flags|=Sa,i.arePropsEqual=e[wa].arePropsEqual),t!==null){const{key:o,ref:r,...a}=t;Yc(o)&&(i.props.key=o.toString()),Xc(r)&&(i.props.ref=r),Object.assign(i.props,a)}const s=n.length===1?n[0]:n.length>1?n:null;return s!==null&&(i.props.children=s),i}function Tt({children:e,key:t}){return m($e,t?{key:t}:null,e)}function Gs(e,t){return Array.isArray(t)?wu(e,t):_u(e,t)}function _u(e,t){const n=e.child;if(n===null)return Na(e,t);const i=n.sibling,s=La(e,n,t);if(s!==null)return n&&n!==s&&!s.prev?ps(e,n):i&&ps(e,i),s;{const o=Ba(n),r=za(o,e,0,t);if(r!==null){const a=r.prev;if(a!==null){const l=a.props.key;o.delete(l===void 0?a.index:l)}hi(r,0,0)}return o.forEach(a=>mi(e,a)),r}}function wu(e,t){let n=null,i=null,s=e.child,o=null,r=0,a=0;for(;s!==null&&a<t.length;a++){s.index>a?(o=s,s=null):o=s.sibling;const c=La(e,s,t[a]);if(c===null){s===null&&(s=o);break}s&&!c.prev&&mi(e,s),r=hi(c,r,a),i===null?n=c:i.sibling=c,i=c,s=o}if(a===t.length)return ps(e,s),n;if(s===null){for(;a<t.length;a++){const c=Na(e,t[a]);c!==null&&(r=hi(c,r,a),i===null?n=c:i.sibling=c,i=c)}return n}const l=Ba(s);for(;a<t.length;a++){const c=za(l,e,a,t[a]);if(c!==null){const u=c.prev;if(u!==null){const f=u.props.key;l.delete(f===void 0?u.index:f)}r=hi(c,r,a),i===null?n=c:i.sibling=c,i=c}}return l.forEach(c=>mi(e,c)),n}function La(e,t,n){const i=t?.props.key;return Fa(n)?i!==void 0||t?.type==="#text"&&W.isSignal(t.props.nodeValue)?null:Bo(e,t,""+n):W.isSignal(n)?t&&t.props.nodeValue!==n?null:Bo(e,t,n):Xs(n)?n.props.key!==i?null:Su(e,t,n):Array.isArray(n)?i!==void 0?null:Ra(e,t,n):null}function Bo(e,t,n){if(t===null||t.type!=="#text"){const s=m("#text",{nodeValue:n});return Nt(s,e),s}return t.props.nodeValue!==n&&(t.props.nodeValue=n,t.flags|=ne),t.sibling=null,t}function Su(e,t,n){let{type:i,props:s}=n;if(i===$e)return Ra(e,t,s.children||[],s);if(t?.type===i)return t.index=0,t.sibling=null,typeof i=="string"?Ha(t.props,s)&&(t.flags|=ne):t.flags|=ne,t.props=s,t.memoizedProps=n.memoizedProps,t;const o=m(i,s);return Nt(o,e),o}function Ra(e,t,n,i={}){if(t===null||t.type!==$e){const s=m($e,{children:n,...i});return Nt(s,e),s}return t.props={...t.props,...i,children:n},t.flags|=ne,t.sibling=null,t}function Na(e,t){if(Fa(t)){const n=m("#text",{nodeValue:""+t});return Nt(n,e),n}if(W.isSignal(t)){const n=m("#text",{nodeValue:t});return Nt(n,e),n}if(Xs(t)){const n=m(t.type,t.props);return Nt(n,e),n.flags|=St,n}if(Array.isArray(t)){const n=Tt({children:t});return Nt(n,e),n}return null}function hi(e,t,n){e.index=n;const i=e.prev;if(i!==null){const s=i.index;return s<t?(e.flags|=St,t):s}else return e.flags|=St,t}function za(e,t,n,i){if(W.isSignal(i)||typeof i=="string"&&i!==""||typeof i=="number"||typeof i=="bigint"){const o=e.get(n);if(o){if(o.props.nodeValue===i)return o;o.type==="#text"&&W.isSignal(o.props.nodeValue)&&o.cleanups?.nodeValue?.()}const r=m("#text",{nodeValue:i});return Nt(r,t),r.flags|=St,r.index=n,r}if(Xs(i)){const{type:o,props:r}=i,a=r.key,l=e.get(a===void 0?n:a);if(l?.type===o)return typeof o=="string"?Ha(l.props,r)&&(l.flags|=ne):l.flags|=ne,l.props=r,l.sibling=null,l.index=n,l;const c=m(i.type,i.props);return Nt(c,t),c.flags|=St,c.index=n,c}if(Array.isArray(i)){const o=e.get(n);if(o)return o.flags|=ne,o.props.children=i,o;const r=Tt({children:i});return Nt(r,t),r.flags|=St,r.index=n,r}return null}function Fa(e){return typeof e=="string"&&e!==""||typeof e=="number"||typeof e=="bigint"}function Ha(e,t){const n=Object.keys(e),i=Object.keys(t);if(n.length!==i.length)return!0;for(let s of n)if(!(s==="children"||s==="key")&&e[s]!==t[s])return!0;return!1}function Nt(e,t){e.parent=t,e.depth=t.depth+1}function Ba(e){const t=new Map;for(;e;){const n=e.props.key;t.set(n===void 0?e.index:n,e),e=e.sibling}return t}function mi(e,t){e.deletions===null?e.deletions=[t]:e.deletions.push(t)}function ps(e,t){for(;t;)mi(e,t),t=t.sibling}let Yt=[],qe=!1,gs=[],ms=[],bs=!1,ys=!1,xs=!1,vs=0,Va=[],_s=[],Wa=-1;function ku(e){if(qe){gs.push(e);return}e()}function ja(){qe&&(window.cancelAnimationFrame(Wa),Ua())}function Vo(e){e.flags|=Ye,Yt.push(e),qe=!0,ja()}function Ai(e){if(Xt.current==="hydrate")return ku(()=>ws(e));ws(e)}function Tu(){qe||(qe=!0,Wa=window.requestAnimationFrame(Ua))}function Mu(){for(qe=!1;gs.length;)gs.shift()()}function ws(e){if(bs&&(ys=!0),De.current===e){xs=!0;return}if(!(e.flags&(Ye|Pi))){if(e.flags|=Ye,!Yt.length)return Yt.push(e),Tu();Yt.push(e)}}function Eu(e){Di(e,t=>t.flags|=Pi),ms.push(e)}const Cu=(e,t)=>t.depth-e.depth;let Jt=null;function Ua(){let e=1;for(Qc();Yt.length;){Yt.length>e&&Yt.sort(Cu),Jt=Yt.shift(),e=Yt.length;const t=Jt.flags;if(!(t&Pi)&&t&Ye){let n=Jt;for(;n=Ou(n););for(;ms.length;)yu(ms.pop());bu(Jt),Jt.flags&=~Ye}}if(Jc(),bs=!0,qi(Va),bs=!1,ys)return Iu(),qi(_s),ys=!1,vs++,ja();vs=0,Mu(),qi(_s)}function Ou(e){let t=!0;try{typeof e.type=="string"?Au(e):Bc(e.type)?Pu(e):t=Du(e)}catch(i){const s=$c(e);if(s){const o=s.error=i instanceof Error?i:new Error(String(i));return s.props.onError?.(o),s.depth<Jt.depth&&(Jt=s),s}if(Xe.isKiruError(i)){if(i.customNodeStack&&setTimeout(()=>{throw new Error(i.customNodeStack)}),i.fatal)throw i;console.error(i);return}setTimeout(()=>{throw i})}if(e.deletions!==null&&(e.deletions.forEach(Eu),e.deletions=null),t&&e.child)return e.child;let n=e;for(;n;){if(n.immediateEffects&&(Va.push(...n.immediateEffects),n.immediateEffects=void 0),n.effects&&(_s.push(...n.effects),n.effects=void 0),n===Jt)return;if(n.sibling)return n.sibling;n=n.parent,Xt.current==="hydrate"&&n?.dom&&On.pop()}}function Pu(e){const{props:t,type:n}=e;let i=t.children;if(n===Oi){const{props:{dependents:s,value:o},prev:r}=e;s.size&&r&&r.props.value!==o&&s.forEach(ws)}else if(n===Ys){const s=e,{error:o}=s;o&&(i=typeof t.fallback=="function"?t.fallback(o):t.fallback,delete s.error)}e.child=Gs(e,i)}function Du(e){const{type:t,props:n,subs:i,prev:s,flags:o}=e;if(o&Sa){if(e.memoizedProps=n,s?.memoizedProps&&e.arePropsEqual(s.memoizedProps,n)&&!e.hmrUpdated)return e.flags|=as,!1;e.flags&=~as}try{De.current=e;let r,a=0;do e.flags&=~Ye,xs=!1,Ta.current=0,i&&(i.forEach(l=>l()),i.clear()),r=t(n);while(xs);return e.child=Gs(e,r),!0}finally{De.current=null}}function Au(e){const{props:t,type:n}=e;e.dom||(Xt.current==="hydrate"?au(e):e.dom=tu(e)),n!=="#text"&&(e.child=Gs(e,t.children),e.child&&Xt.current==="hydrate"&&On.push(e.dom))}function Iu(){if(vs>Ic)throw new Xe("Maximum update depth exceeded. This can happen when a component repeatedly calls setState during render or in useLayoutEffect. Kiru limits the number of nested updates to prevent infinite loops.")}function qi(e){for(let t=0;t<e.length;t++)e[t]();e.length=0}var Wo;(function(e){e.Start="start",e.End="end"})(Wo||(Wo={}));const fe=()=>{const e=De.current;return e||$a("useRequestUpdate"),()=>Ai(e)};function Ft(e,t,n){const i=De.current;i||$a(e);const s=(a,l)=>{if(l?.immediate){(i.immediateEffects??(i.immediateEffects=[])).push(a);return}(i.effects??(i.effects=[])).push(a)},o=Ta.current++;let r=i.hooks?.at(o);try{const a=r??(typeof t=="function"?t():{...t});return i.hooks??(i.hooks=[]),i.hooks[o]=a,n({hook:a,isInit:!r,update:()=>Ai(i),queueEffect:s,vNode:i,index:o})}catch(a){throw a}}function $a(e){throw new Xe(\`Hook "\${e}" must be used at the top level of a component or inside another composite hook.\`)}function Ii(e){e.cleanup&&(e.cleanup(),e.cleanup=void 0)}function tn(e,t){return e===void 0||t===void 0||e.length!==t.length||e.length>0&&t.some((n,i)=>!Object.is(n,e[i]))}var Ya;class W{constructor(t,n){this[Ya]=!0,this.$id=Gc(),this.$value=t,n&&(this.displayName=n),this.$subs=new Set}get value(){return this.onBeforeRead?.(),W.entangle(this),this.$value}set value(t){Object.is(this.$value,t)||(this.$prevValue=this.$value,this.$value=t,this.notify())}peek(){return this.onBeforeRead?.(),this.$value}sneak(t){this.$prevValue=this.$value,this.$value=t}toString(){return this.onBeforeRead?.(),W.entangle(this),\`\${this.$value}\`}subscribe(t){return this.$subs.add(t),()=>this.$subs.delete(t)}notify(t){this.$subs.forEach(n=>{if(!(t?.filter&&!t.filter(n)))return n(this.$value,this.$prevValue)})}static isSignal(t){return typeof t=="object"&&!!t&&va in t}static subscribers(t){return t.$subs}static makeReadonly(t){const n=Object.getOwnPropertyDescriptor(t,"value");return n&&!n.writable?t:Object.defineProperty(t,"value",{get:function(){return W.entangle(this),this.$value},configurable:!0})}static makeWritable(t){const n=Object.getOwnPropertyDescriptor(t,"value");return n&&n.writable?t:Object.defineProperty(t,"value",{get:function(){return W.entangle(this),this.$value},set:function(i){this.$value=i,this.notify()},configurable:!0})}static entangle(t){const n=De.current,i=ls.current();if(i){(!n||n&&kt())&&i.set(t.$id,t);return}if(!n||!kt())return;const s=t.subscribe(()=>Ai(n));(n.subs??(n.subs=new Set)).add(s)}static configure(t,n){t.onBeforeRead=n}static dispose(t){t.$isDisposed=!0,t.$subs.clear()}}Ya=va;const ht=(e,t)=>new W(e,t),J=(e,t)=>Ft("useSignal",{signal:null},({hook:n,isInit:i,isHMR:s})=>(i&&(n.cleanup=()=>W.dispose(n.signal),n.signal=new W(e,t)),n.signal));function Lu(e){const{id:t,subs:n,fn:i,deps:s=[],onDepChanged:o}=e;let r;Ve.delete(t);const a=!!De.current&&!kt();a||(r=new Map,ls.stack.push(r));const l=i(...s.map(c=>c.value));if(!a){for(const[u,f]of n)r.has(u)||(f(),n.delete(u));const c=()=>{Ve.size||queueMicrotask(Kc),Ve.set(t,o)};for(const[u,f]of r){if(n.has(u))continue;const p=f.subscribe(c);n.set(u,p)}ls.stack.pop()}return l}class Be extends W{constructor(t,n){super(void 0,n),this.$getter=t,this.$unsubs=new Map,this.$isDirty=!0,W.configure(this,()=>{this.$isDirty&&Be.run(this)})}get value(){return super.value}set value(t){}subscribe(t){return this.$isDirty&&Be.run(this),super.subscribe(t)}static dispose(t){Be.stop(t),W.dispose(t)}static stop(t){const{$id:n,$unsubs:i}=t;Ve.delete(n),i.forEach(s=>s()),i.clear(),t.$isDirty=!0}static run(t){const n=t,{$id:i,$getter:s,$unsubs:o}=n,r=Lu({id:i,subs:o,fn:()=>s(n.$value),onDepChanged:()=>{n.$isDirty=!0,t.$subs.size&&(Be.run(n),!Object.is(n.$value,n.$prevValue)&&n.notify())}});n.sneak(r),n.$isDirty=!1}}const Xa=(e,t)=>new Be(e,t);function Ru(){const e=new Set,t=new Map;function n(r,a,l){t.get(r)?.forEach(c=>c(a,l))}function i(r,a){t.has(r)||t.set(r,new Set),t.get(r).add(a)}function s(r,a){t.get(r)?.delete(a)}const o={get apps(){return Array.from(e)},emit:n,on:i,off:s};return i("mount",r=>e.add(r)),i("unmount",r=>e.delete(r)),o}let Nu=0;function zu(e,t,n){var i;const s=m(t.nodeName.toLowerCase(),{});s.dom=t,s.flags|=re;const o=Nu++,r=\`App-\${o}\`,a={id:o,name:r,rootNode:s,render:l,unmount:c};function l(u){s.props.children=u,Vo(s)}function c(){s.props.children=null,Vo(s),window.__kiru.emit("unmount",a)}return(i=globalThis.window).__kiru??(i.__kiru=Ru()),l(e),window.__kiru.emit("mount",a),a}function de(e){return kt()?Ft("useState",{state:void 0,dispatch:Fo},({hook:t,isInit:n,update:i,isHMR:s})=>(n&&(t.state=typeof e=="function"?e():e,t.dispatch=o=>{const r=typeof o=="function"?o(t.state):o;Object.is(t.state,r)||(t.state=r,i())}),[t.state,t.dispatch])):[typeof e=="function"?e():e,Fo]}function Fu(e){const t={[Ac]:!0,Provider:({value:n,children:i})=>{const[s]=de(()=>new Set);return m(Oi,{value:n,ctx:t,dependents:s},typeof i=="function"?i(n):i)},default:()=>e,set displayName(n){this.Provider.displayName=n},get displayName(){return this.Provider.displayName||"Anonymous Context"}};return t}function We(e,t){return kt()?Ft("useCallback",{callback:e,deps:t},({hook:n,isHMR:i})=>(tn(t,n.deps)&&(n.deps=t,n.callback=e),n.callback)):e}function Hu(e,t=!0){return Ft("useContext",{context:e,warnIfNotFound:t},Bu)}const Bu=({hook:e,isInit:t,vNode:n})=>{if(t){let i=n.parent;for(;i;){if(i.type===Oi){const s=i,{ctx:o,value:r,dependents:a}=s.props;if(o===e.context)return a.add(n),e.cleanup=()=>a.delete(n),e.provider=s,r}i=i.parent}}return e.provider?e.provider.props.value:e.context.default()};function ut(e,t){if(kt())return Ft("useEffect",{deps:t},({hook:n,isInit:i,isHMR:s,queueEffect:o})=>{(i||tn(t,n.deps))&&(n.deps=t,Ii(n),o(()=>{const r=e();typeof r=="function"&&(n.cleanup=r)}))})}function Ks(e,t){if(kt())return Ft("useLayoutEffect",{deps:t},({hook:n,isInit:i,isHMR:s,queueEffect:o})=>{(i||tn(t,n.deps))&&(n.deps=t,Ii(n),o(()=>{const r=e();typeof r=="function"&&(n.cleanup=r)},{immediate:!0}))})}function bi(e,t){return kt()?Ft("useMemo",{deps:t,value:void 0},({hook:n,isInit:i,isHMR:s})=>((i||tn(t,n.deps))&&(n.deps=t,n.value=e()),n.value)):e()}function Ge(e){return kt()?Ft("useRef",{ref:{current:e}},({hook:t,isInit:n,isHMR:i})=>t.ref):{current:e}}"window"in globalThis&&(window.__KIRU_LAZY_CACHE??(window.__KIRU_LAZY_CACHE=new Map));function Ss(...e){return e.filter(Boolean).join(" ")}function Zs(e,t,n){let i=e;for(let s=0;s<t.length;s++){const o=t[s];s===t.length-1?i[o]=n:i=i[o]}}function qa(e){return e.type.displayName??(e.type.name||"Anonymous Function")}const Vu=e=>e.__devtoolsFileLink??null;function Pn(e){return e.name==="kiru.devtools"}function Ga(e){return Array.from(e.entries())}function Wu(e){return m("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",...e},m("rect",{width:"20",height:"16",x:"2",y:"4",rx:"2"}),m("path",{d:"M12 9v11"}),m("path",{d:"M2 9h13a2 2 0 0 1 2 2v9"}))}function ae(e){return m("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1rem",height:"1rem",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",...e},m("path",{d:"m9 18 6-6-6-6"}))}function ju(e){return m("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",...e},m("path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z"}),m("circle",{cx:"12",cy:"12",r:"3"}))}function Uu(e){return m("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",...e},m("path",{d:"M21 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h6"}),m("path",{d:"m21 3-9 9"}),m("path",{d:"M15 3h6v6"}))}function $u(e){return m("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",...e},m("path",{d:"m12 14 4-4"}),m("path",{d:"M3.34 19a10 10 0 1 1 17.32 0"}))}function Yu(e){return m("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",...e},m("circle",{cx:"12",cy:"12",r:"10"}),m("path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20"}),m("path",{d:"M2 12h20"}))}function Xu(e){return m("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",...e},m("path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8"}),m("path",{d:"M21 3v5h-5"}),m("path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16"}),m("path",{d:"M8 16H3v5"}))}function qu(e){return m("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",...e},m("path",{d:"M22 8.35V20a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V8.35A2 2 0 0 1 3.26 6.5l8-3.2a2 2 0 0 1 1.48 0l8 3.2A2 2 0 0 1 22 8.35Z"}),m("path",{d:"M6 18h12"}),m("path",{d:"M6 14h12"}),m("rect",{width:"12",height:"12",x:"6",y:"10"}))}function Ka(e){return m("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",...e},m("path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3"}),m("path",{d:"M12 9v4"}),m("path",{d:"M12 17h.01"}))}function Za({title:e,children:t,className:n,disabled:i,...s}){const[o,r]=de(!0);ut(()=>{!o&&i&&r(!0)},[i]);const a=We(l=>{l.preventDefault(),l.stopImmediatePropagation(),r(c=>!c)},[]);return m("div",{className:"flex flex-col"},m("button",{onclick:a,disabled:i,className:\`\${i?"opacity-50 cursor-default":"cursor-pointer"}\`},m("span",{className:"flex items-center gap-2 font-medium"},m(ae,{className:\`transition \${o?"":"rotate-90"}\`}),e)),o?null:m("div",{className:\`p-2 \${n||""}\`,...s},t))}const Qs={arrayChunkSize:10,objectKeysChunkSize:100};function Qa(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;const n=new Set([...Object.keys(e),...Object.keys(t)]);for(const i in n)if(typeof t[i]!=typeof e[i]||typeof e[i]=="object"&&!Qa(e[i],t[i]))return!1;return!0}function Ja(e,t,n){for(const i in t)typeof e[i]>"u"&&(e[i]=structuredClone(t[i]));for(const i in e)typeof e[i]=="object"?Ja(e[i],t[i],n):n(e,i,e[i])}let tl={...Qs};const jo=localStorage.getItem("kiru.devtools.userSettings");if(jo)try{const e=JSON.parse(jo);Qa(Qs,e)&&(tl=e)}catch(e){console.error("kiru.devtools.userSettings error",e)}const el=Fu({userSettings:null,saveUserSettings:()=>{}}),Li=()=>Hu(el);function Gu({children:e}){const[t,n]=de(tl),i=s=>{localStorage.setItem("kiru.devtools.userSettings",JSON.stringify(s)),n(s)};return m(el.Provider,{value:{userSettings:t,saveUserSettings:i}},e)}function Ku(){const{userSettings:e,saveUserSettings:t}=Li();return m("div",{className:"rounded bg-neutral-400 bg-opacity-5 border border-white border-opacity-10 overflow-hidden"},m(Ie,{border:!1,data:e,onChange:(n,i)=>{const s={...e};Zs(s,n,i),Ja(s,Qs,(o,r,a)=>{o[r]=a<1?1:a}),t(s)},mutable:!0,objectRefAcc:[]}))}const Zu=Object.freeze(()=>{});function Ie({data:e,onChange:t,mutable:n,objectRefAcc:i,keys:s=[],className:o,border:r=!0}){const{userSettings:{objectKeysChunkSize:a}}=Li(),[l,c]=de(0),u=bi(()=>Object.keys(e).slice(0,(l+1)*a),[l,a,e]),f=()=>{u.forEach(g=>{typeof e[g]=="object"&&i.splice(i.indexOf(e[g]),1)}),c(l+1)},p=u.length<Object.keys(e).length;return m(Tt,null,m("div",{className:Ss("flex flex-col items-start w-full",r&&"border border-neutral-700",Cn(o))},u.map(g=>{const x=s.concat(g),y=x.join(".");return m("div",{key:y,"data-key":y,className:"flex flex-col items-start w-full gap-2 pl-2 py-1 pr-1 border-b border-neutral-700 last:border-b-0"},m(Js,{value:e[g],onChange:t,keys:x,path:y,label:g,mutable:n,objectRefAcc:i}))})),p&&m("button",{onclick:f,title:"Show more",className:"p-1 border font-bold border-neutral-700 hover:bg-neutral-700"},m("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1rem",height:"1rem",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},m("circle",{cx:"12",cy:"12",r:"1"}),m("circle",{cx:"19",cy:"12",r:"1"}),m("circle",{cx:"5",cy:"12",r:"1"}))))}function yi(e,t){Array.isArray(e)?(t(e),e.forEach(n=>yi(n,t))):typeof e=="object"&&e!==null&&(t(e),Object.values(e).forEach(n=>yi(n,t)))}function Js({value:e,onChange:t,keys:n,path:i,mutable:s,objectRefAcc:o,label:r}){const{userSettings:{arrayChunkSize:a}}=Li(),[l,c]=de(!0),u=r!==void 0&&m("label",{htmlFor:i,className:"text-xs truncate",title:i,children:r});if(e===null)return m(mt,null,u,m(Zt,null,"null"));if(e===void 0)return m(mt,null,u,m(Zt,null,"undefined"));const f=window.opener?window.opener.Node:Node;if(e instanceof f)return m(mt,null,u,m(Zt,null,"<",m("span",{style:{color:"#f0a05e"}},e.nodeName),"/>"));const p=window.opener?window.opener.Error:Error;if(e instanceof p)return m(mt,null,u,"cause"in e&&e.cause?m(Zt,null,e.message," (",String(e.cause),")"):m(Zt,null,e.message));const g=x=>t(n,x);switch(typeof e){case"string":return m(mt,null,u,m(Gi,{disabled:!s,id:i,type:"text",value:e,onchange:x=>g(x.target.value)}));case"number":return m(mt,null,u,m(Gi,{disabled:!s,id:i,type:"number",value:e,placeholder:"NaN",onchange:x=>g(Number(x.target.value))}));case"bigint":return m(mt,null,u,m(Gi,{disabled:!s,id:i,type:"number",value:e.toString(),onchange:x=>g(BigInt(x.target.value))}));case"boolean":return m(mt,null,u,m("input",{disabled:!s,id:i,type:"checkbox",checked:e,onchange:x=>g(x.target.checked),className:"accent-red-500"}));case"function":return m(mt,null,u,m(Zt,null,\`\u0192 \${e.name||"anonymous"}()\`));default:return Array.isArray(e)?m(mt,null,m("button",{className:"text-xs flex items-center gap-1 cursor-pointer w-full",title:i,onclick:()=>{yi(e,x=>o.splice(o.indexOf(x),1)),c(x=>!x)}},r,m(ae,{width:10,height:10,className:\`transition \${l?"":"rotate-90"}\`})),l?m(Zt,null,"Array(",e.length,")"):e.length>a?m(Qu,{array:e,objectRefAcc:o}):m("div",{className:"flex flex-col items-start gap-1 w-full"},e.map((x,y)=>m(Js,{value:x,onChange:t,keys:[...n,y.toString()],path:i.concat(".",y.toString()),label:y.toString(),mutable:s,objectRefAcc:o})))):o.includes(e)?m(mt,null,u,m(Zt,null,"Object(circular reference)")):(o.push(e),m(mt,null,m("button",{className:"text-xs flex items-center gap-1 cursor-pointer w-full",title:i,onclick:()=>{yi(e,x=>o.splice(o.indexOf(x),1)),c(x=>!x)}},r,m(ae,{width:10,height:10,className:\`transition \${l?"":"rotate-90"}\`})),l?null:m(Ie,{data:e,onChange:t,keys:n,mutable:s,objectRefAcc:o})))}}function mt({children:e}){return m("div",{className:"flex flex-col items-start gap-1 w-full"},e)}function Gi(e){return m("input",{className:"flex-grow text-xs px-2 py-1 text-neutral-300 w-full",...e})}function Zt({children:e}){return m("small",{className:"text-neutral-300"},m("i",null,e))}function Qu({array:e,objectRefAcc:t}){const{userSettings:{arrayChunkSize:n}}=Li(),i=e.length,s=Math.ceil(i/n);return m("div",{className:"flex flex-col items-start gap-1 w-full"},Array.from({length:s}).map((o,r)=>m(Ju,{array:e,range:{start:r*n,end:(r+1)*n},objectRefAcc:t})))}function Ju({array:e,range:t,objectRefAcc:n}){const[i,s]=de(!0);let o;return i?o=void 0:o=e.slice(t.start,t.end),m("div",{className:"flex flex-col items-start gap-1 w-full"},m("button",{className:"text-xs flex items-center gap-1 cursor-pointer w-full",onclick:()=>{n.splice(n.indexOf(e),1),s(r=>!r)}},"[",t.start,"..",(t.end<e.length?t.end:e.length)-1,"]",m(ae,{width:10,height:10,className:\`transition \${i?"":"rotate-90"}\`})),o&&m("div",{className:"flex flex-col items-start gap-1 w-full"},o.map((r,a)=>m(Js,{value:r,onChange:Zu,label:(t.start+a).toString(),keys:[a.toString()],path:a.toString(),mutable:!1,objectRefAcc:n}))))}const th="kiru-devtools";"window"in globalThis&&(window.__devtoolsSelection??=null);class eh extends BroadcastChannel{send(t){super.postMessage(t)}removeEventListener(t){return super.removeEventListener("message",t)}addEventListener(t){return super.addEventListener("message",t)}}const Ke=new eh(th);function to({fn:e,onclick:t}){const n=bi(()=>Vu(e),[e]);return n?m("a",{className:"flex items-center gap-1 text-[10px] opacity-50 hover:opacity-100 transition-opacity",href:n,onclick:i=>{i.preventDefault(),Ke.send({type:"open-editor",fileLink:n}),t?.(i)},title:"Open in editor"},"Open in editor",m(Uu,{width:"0.65rem",height:"0.65rem"})):null}function nh({selectedApp:e,selectedNode:t,setSelectedNode:n,kiruGlobal:i}){const s=fe();ut(()=>{const l=c=>{c===e&&(Hc(t)?n(null):s())};return i?.on("update",l),()=>i?.off("update",l)},[]);const o=()=>{t&&Ai(t)},r={...t.props};delete r.children;const a=oh(t);return m("div",{className:"flex-grow p-2 sticky top-0"},m("h2",{className:"flex justify-between items-center font-bold mb-2 pb-2 border-b-2 border-neutral-800"},m("div",{className:"flex gap-2 items-center"},"<"+qa(t)+">",m(to,{fn:t.type})),m("button",{onclick:o},m(Xu,{className:"w-5 h-5"}))),m(Za,{title:"props",disabled:Object.keys(r).length===0},m(Ie,{data:r,onChange:()=>{},mutable:!1,objectRefAcc:[]})),m(nl,{node:a,selectedApp:e}))}function ih(e){return e.name==="devtools:useHookDebugGroup"}function sh(e){return ks in e}const ks=Symbol.for("devtools.hookGroup");function oh(e){const t={parent:null,name:"hooks",children:[],[ks]:!0};if(e.hooks?.length){let n=t;for(let i=0;i<e.hooks.length;i++){const s=e.hooks[i];if(ih(s)){switch(s.action){case"start":const o={parent:n,name:s.displayName,children:[],[ks]:!0};n.children.push(o),n=o;break;case"end":if(n.name!==s.displayName||n.parent===null)throw new Error("useHookDebugGroup:end called with no start");n=n.parent;break}continue}n.children.push(s)}}return t}function nl({node:e,selectedApp:t,depth:n=0}){if(sh(e))return m(Za,{title:e.name,className:"bg-[#ffffff04] border border-[#fff1] flex flex-col gap-2 pl-6",disabled:e.children.length===0},e.children.map(u=>m(nl,{node:u,selectedApp:t,depth:n+1})));const{name:i,dev:s,cleanup:o,...r}=e,a=s?.devtools,l=typeof a?.get=="function"?a.get():r;return m("div",null,m("i",{className:"text-neutral-300 text-sm"},i||"anonymous hook"),m("div",{className:"p-2"},m(Ie,{data:l,onChange:(u,f)=>{if(!t||!a?.set||!a?.get)return;const p=a.get();Zs(p,u,f),a.set(p)},mutable:!!a?.set,objectRefAcc:[]})))}const Ce=(e,t,n={})=>{ut(()=>{let i=window;const s=n?.ref?.();return s?i=s:n.ref&&console.warn("useEventListener ref failed, using window"),i.addEventListener(e,t,n),()=>{i.removeEventListener(e,t,n)}},[t])},rh=()=>{const e=J({x:0,y:0}),t=J({x:0,y:0}),n=J({x:0,y:0});return Ce("mousemove",i=>{e.value={x:i.x,y:i.y},t.value={x:i.movementX,y:i.movementY},n.value={x:i.clientX,y:i.clientY}}),{mouse:e,delta:t,client:n}},Xn="window"in globalThis&&"ResizeObserver"in globalThis.window,ah=(e,t,n=void 0)=>kt()?Xn?Ft("useResizeObserver",{resizeObserver:null,deps:[e.current]},({isInit:i,hook:s,queueEffect:o})=>(i&&(s.resizeObserver=new ResizeObserver(t),s.cleanup=()=>{s.resizeObserver?.disconnect?.(),s.resizeObserver=null}),o(()=>{tn([e.current],s.deps)&&(s.deps=[e.current],s.resizeObserver?.disconnect?.(),e.current&&s.resizeObserver?.observe(e.current,n))}),{isSupported:Xn,start:()=>{s.resizeObserver==null&&(s.resizeObserver=new ResizeObserver(t),e.current&&s.resizeObserver.observe(e.current,n),s.cleanup=()=>{s.resizeObserver?.disconnect?.(),s.resizeObserver=null})},stop:()=>{Ii(s)}})):{isSupported:Xn,start:()=>{},stop:()=>{}}:{isSupported:Xn,start:()=>{},stop:()=>{}},qn="window"in globalThis&&"MutationObserver"in globalThis.window,lh=(e,t,n=void 0)=>kt()?qn?Ft("useMutationObserver",{mutationObserver:null,deps:[e.current]},({isInit:i,hook:s,queueEffect:o})=>(i?(o(()=>{s.deps=[e.current],s.mutationObserver=new MutationObserver(t),e.current&&s.mutationObserver.observe(e.current,n)}),s.cleanup=()=>{s.mutationObserver?.disconnect?.(),s.mutationObserver=null}):tn([e.current],s.deps)&&(s.deps=[e.current],s.mutationObserver?.disconnect?.(),e.current&&s.mutationObserver?.observe(e.current,n)),{isSupported:qn,start:()=>{s.mutationObserver==null&&(s.mutationObserver=new MutationObserver(t),e.current&&s.mutationObserver.observe(e.current,n),s.cleanup=()=>{s.mutationObserver?.disconnect?.(),s.mutationObserver=null})},stop:()=>{Ii(s)}})):{isSupported:qn,start:()=>{},stop:()=>{}}:{isSupported:qn,start:()=>{},stop:()=>{}},ch=(e,t={windowScroll:!0,windowResize:!0})=>{const n=t?.windowScroll??!0,i=t?.windowResize??!0,s=t.immediate??!0,o=J(0),r=J(0),a=J(0),l=J(0),c=J(0),u=J(0),f=J(0),p=J(0),g=()=>{const x=e.current;if(!x){o.value=0,r.value=0,a.value=0,l.value=0,c.value=0,u.value=0,f.value=0,p.value=0;return}const y=x.getBoundingClientRect();o.value=y.width,r.value=y.height,a.value=y.top,l.value=y.right,c.value=y.bottom,u.value=y.left,f.value=y.x,p.value=y.y};return ah(e,g),lh(e,g,{attributeFilter:["style","class"]}),Ce("scroll",()=>{n&&g()},{capture:!0,passive:!0}),Ce("resize",()=>{i&&g()},{passive:!0}),Ks(()=>{s&&g()},[]),{width:o,height:r,top:a,right:l,bottom:c,left:u,x:f,y:p,update:g}};function uh(e){return typeof e=="function"?e:typeof e=="string"?t=>t.key===e:Array.isArray(e)?t=>e.includes(t.key):()=>!0}const Uo=(e,t,n={})=>{const{ref:i,eventName:s="keydown",passive:o=!1}=n,r=uh(e);return Ce(s,l=>{l.repeat&&!n.repeat||r(l)&&t(l)},{ref:i,passive:o})};function il({value:e,className:t,...n}){return m("div",{className:Ss("w-full p-2 z-10","bg-[#1d1d1d] border border-white border-opacity-10 rounded",t?.toString()),...n},m("input",{className:Ss("px-2 py-1 w-full rounded focus:outline focus:outline-primary","bg-[#212121] border border-white border-opacity-10 rounded"),placeholder:"Filter...",type:"text","bind:value":e}))}let $;"window"in globalThis&&window.opener&&($=window.opener.__kiru);const je=ht(!1);Ke.addEventListener(e=>{e.data.type==="set-inspect-enabled"&&(je.value=e.data.value)});const sl=($?.apps??[]).filter(e=>!Pn(e)),ie=ht(sl);ht(null);const Lt=ht(sl[0]??null),se=ht(null);$?.on("mount",e=>{Pn(e)||(ie.value=[...ie.peek(),e],Lt.peek()===null&&(Lt.value=e))});$?.on("unmount",e=>{ie.value=ie.peek().filter(t=>t!==e),Lt.peek()===e&&(Lt.value=ie.peek()[0]??null)});const Ts=ht(new Map),Rt=ht(null),eo=ht("");function hh(e){return e.type.displayName??(e.type.name||"Anonymous Function")}function fh(e,t){const n=t.toLowerCase();return e.every(i=>n.includes(i))}function Ms(e){return typeof e.type=="function"&&!Vc(e)&&!Wc(e)&&!jc(e)}function dh(e){let t=[e];for(;t.length;){const n=t.pop();if(Ms(n))return!0;n.child&&t.push(n.child),n.sibling&&t.push(n.sibling)}return!1}const ph=(e,t)=>{const n=[t.parent];for(;n.length;){const i=n.pop();if(e===i)return!0;i?.parent&&n.push(i.parent)}return!1};function Es(e,t){if(!e)return null;const n=t(e),i=Es(e.sibling,t),s=Es(e.child,t);return n?{ref:e,sibling:i??null,child:s??null}:i||s||null}function xi({node:e,traverseSiblings:t=!0}){const[n,i]=de(!0),o=se.value===e,r=bi(()=>crypto.randomUUID(),[]),a=bi(()=>Rt.value==null?null:ph(e,Rt.value),[Rt.value,e]);ut(()=>{a&&i(!1)},[a]),ut(()=>{if(!(!e||!Ms(e)))return Ts.peek().set(r,{vNode:e,setCollapsed:i}),()=>{Ts.peek().delete(r)}});const l=eo.value;if(!e)return null;if(!Ms(e)||l.length>0&&!fh(l.toLowerCase().split(" "),e.type.name))return m(Tt,null,e.child&&m(xi,{node:e.child}),t&&m($o,{node:e}));const c=e.child&&dh(e.child);return m(Tt,null,m("div",{className:"pl-4 mb-1"},m("h2",{onclick:()=>{Rt.value=null,se.value=o?null:e},className:\`flex gap-2 items-center cursor-pointer mb-1 scroll-m-12 \${o?"font-medium bg-primary selected-vnode":""}\`,"data-id":r},c&&m(ae,{className:\`cursor-pointer transition \${n?"":"rotate-90"}\`,onclick:u=>{u.preventDefault(),u.stopImmediatePropagation(),Rt.value=null,i(f=>!f)}}),m("div",{className:c?"":"ml-6"},m("span",{className:o?"":"text-neutral-400"},"<"),m("span",{className:o?"":"text-primary"},hh(e)),m("span",{className:o?"":"text-neutral-400"},">"))),!n&&e.child||a!=null&&a&&e.child?m(xi,{node:e.child}):null),t&&m($o,{node:e}))}function $o({node:e}){if(!e)return null;let t=[],n=e.sibling;for(;n;)t.push(n),n=n.sibling;return m(Tt,null,t.map(i=>m(xi,{node:i,traverseSiblings:!1})))}const gh=()=>{const e=Ge(null),t=r=>{if(!r)return null;const a=r.getAttribute("data-id");if(a!=null)return Ts.peek().get(a)},n=r=>{if(!r)return;const a=t(r);a!=null&&(r.scrollIntoView({behavior:"smooth"}),se.value=a.vNode)},i=r=>{if(!r||r===document.body)return null;const a=r.parentElement,l=a?.nextElementSibling?.querySelector("h2[data-id]");return l||i(a)},s=()=>{const r=document.querySelector("h2[data-id]");n(r)},o=()=>{const r=document.querySelectorAll("h2[data-id]"),a=r.item(r.length-1);a&&n(a)};return Uo(["ArrowDown","ArrowUp","ArrowLeft","ArrowRight"],r=>{if(Rt.value&&(Rt.value=null),document.activeElement&&document.activeElement instanceof HTMLInputElement&&document.activeElement!=e.current)return;r.preventDefault();const a=document.querySelector(".selected-vnode");if(a===null){r.key==="ArrowDown"?s():r.key==="ArrowUp"&&o();return}if(r.key==="ArrowRight"){const l=t(a);l&&l.setCollapsed(!1);return}else if(r.key==="ArrowLeft"){const l=t(a);l&&l.setCollapsed(!0);return}if(r.key==="ArrowDown"){const l=a?.nextElementSibling?.querySelector("h2[data-id]");if(l)return n(l);const c=a.parentElement?.nextElementSibling?.querySelector("h2[data-id]");if(c)return n(c);const u=i(a);return u?n(u):s()}else if(r.key==="ArrowUp"){const l=a.parentElement?.previousElementSibling;if(l?.matches("h2[data-id]"))return n(l);const c=l?.querySelectorAll("h2[data-id]");return c?.length!=null&&c?.length>=1?n(c?.item?.(c.length-1)):o()}}),Uo("l",r=>{r.ctrlKey&&(r.preventDefault(),e.current?.focus({preventScroll:!1}))}),{searchRef:e}},mh=e=>{eo.value=e.target.value,Rt.value&&(Rt.value=null)};function bh(){const{searchRef:e}=gh(),t=Lt.value;return m("div",{className:"flex-grow p-2 sticky top-0"},m("div",{className:"flex gap-4 pb-2 border-b-2 border-neutral-800 mb-2 items-center"},m("input",{ref:e,className:"bg-[#171616] px-1 py-2 w-full focus:outline focus:outline-primary",placeholder:"Search for component",type:"text",value:eo,oninput:mh})),t?.rootNode&&m(xi,{node:t.rootNode}))}const yh=e=>{const{mouse:t}=rh(),n=J(null),i=J(0),s=J(0),o=Ge(null),r=ch(o),a=Ge(null),[l,c]=Array.isArray(e.children)?e.children:[];return Ks(()=>{a.current&&(s.value=a.current.clientWidth/2)},[a.current]),Ce("mouseup",We(()=>n.value=null,[])),Ce("mousemove",We(u=>{if(n.value==null||a.current==null)return;const f=Math.max(i.value+u.x-n.value.x,250);s.value=Math.min(f,a.current.clientWidth-250)},[])),Ce("resize",We(()=>{a.current!=null&&a.current.clientWidth-250<s.value&&(s.value=Math.max(a.current.clientWidth-250,250))},[])),m("div",{onmousemove:u=>{u.x},ref:a,className:"flex-grow grid gap-2 items-start w-full relative",style:{gridTemplateColumns:\`\${s}px 1fr\`}},m("div",{ref:o,className:"firstContainer w-full h-full"},l),r.width.value!=0&&m("div",{className:"w-8 flex justify-center h-full absolute top-0 -translate-x-1/2 cursor-col-resize z-[9999]",style:{left:\`\${r.width}px\`},onmousedown:u=>{u.preventDefault(),n.value={...t.value},i.value=s.value}},m("div",{className:"dividerLine w-[5px] bg-neutral-800 h-full"})),m("div",{className:"secondContainer h-full"},c))},xh=()=>m("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"lucide lucide-square-mouse-pointer"},m("path",{d:"M12.034 12.681a.498.498 0 0 1 .647-.647l9 3.5a.5.5 0 0 1-.033.943l-3.444 1.068a1 1 0 0 0-.66.66l-1.067 3.443a.5.5 0 0 1-.943.033z"}),m("path",{d:"M21 11V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h6"})),vh=()=>{je.value=!je.value,Ke.send({type:"set-inspect-enabled",value:je.value})};function _h(){const e=Lt.value,t=se.value,n=fe();return ut(()=>{const i=s=>{s===e&&n()};return $?.on("update",i),()=>$?.off("update",i)},[Lt]),ut(()=>{const i=s=>{if(s.data.type!=="select-node")return;if(!window.__devtoolsSelection){console.error("no selection ptr");return}const{app:o,node:r}=window.__devtoolsSelection;window.__devtoolsSelection=null,Lt.value=o,se.value=r,Rt.value=r,je.value=!1};return Ke.addEventListener(i),()=>Ke.removeEventListener(i)},[Lt]),m(Tt,null,m("div",{className:"flex items-center justify-between gap-4 p-2 bg-neutral-400 bg-opacity-5 border border-white border-opacity-10 rounded"},m("div",{className:"flex items-center gap-4"},m("select",{className:"px-2 py-1 bg-neutral-800 text-neutral-100 rounded border border-white border-opacity-10",value:e?.name??"",onchange:i=>Lt.value=ie.peek().find(s=>s.name===i.currentTarget.value)??null},m("option",{value:"",disabled:!0},"Select App"),ie.value.map(i=>m("option",{key:i.id,value:i.name},i.name))),m("button",{title:"Toggle Component Inspection",onclick:vh,className:\`p-1 rounded \${je.value?"bg-neutral-900":""}\`},m(xh,null)))),m(yh,null,e&&m(bh,null),t&&e&&m(nh,{selectedApp:e,selectedNode:t,setSelectedNode:i=>se.value=i,kiruGlobal:$})))}const Cs=ht({}),ke=ht([]);$?.stores?.subscribe(e=>{Cs.value=e,ke.value=ke.value.filter(t=>Object.values(Cs.value).includes(t))});const ol=ht(""),wh=Xa(()=>ol.value.toLowerCase().split(" ").filter(e=>e.length>0));function Sh(e){return wh.value.every(t=>e.toLowerCase().includes(t))}function kh(){const e=Object.entries(Cs.value);return e.length===0?m("div",{className:"flex flex-col items-center justify-center h-full text-neutral-400"},m(Ka,null),m("h2",{className:"text-lg italic"},"No stores detected")):m("div",{className:"flex flex-col gap-2 items-start"},m(il,{value:ol,className:"sticky top-0"}),m("div",{className:"flex flex-col gap-2 w-full"},e.filter(([t])=>Sh(t)).map(([t,n])=>m(Th,{key:t,name:t,store:n}))))}function Th({name:e,store:t}){const n=ke.value.includes(t),i=fe(),{value:s}=rl(t);Ks(()=>{const r=t.subscribe(()=>i());return()=>r()},[]);const o=We(()=>{n?ke.value=ke.value.filter(r=>r!==t):ke.value=[...ke.value,t]},[n]);return m("div",{className:"flex flex-col"},m("button",{onclick:o,className:"flex items-center gap-2 justify-between p-2 border border-white border-opacity-10 cursor-pointer"+(n?" bg-white bg-opacity-5 text-neutral-100 rounded-t":" hover:bg-white hover:bg-opacity-10 text-neutral-400 rounded")},e,m("div",{className:"flex gap-2"},m(to,{fn:t,onclick:r=>r.stopPropagation()}),m(ae,{className:"transition-all"+(n?" rotate-90":"")}))),n&&m("div",{className:"flex flex-col gap-2 p-2 border border-white border-opacity-10"},m(Ie,{data:{value:s},mutable:!0,objectRefAcc:[],onChange:(r,a)=>{const l=structuredClone({value:s});Zs(l,r,a),t.setState(l.value)}}),m(Mh,{store:t})))}function Mh({store:e}){const t=ie.value;return t.length===0?null:m(Tt,null,t.map(n=>m(Eh,{store:e,app:n})))}const Yo=Symbol.for("kiru.hmrAccept"),rl=e=>{if(Yo in e)return e[Yo].provide().current;throw new Error("Unable to get store subscribers")};function Eh({store:e,app:t}){const n=fe(),{subscribers:i,nodeStateMap:s}=rl(e),o=t.rootNode.child;if(ut(()=>{const a=l=>{l===t&&n()};return $?.on("update",a),()=>$?.off("update",a)},[]),!o)return null;const r=Es(o,a=>i.has(a));return m("div",{className:"flex flex-col gap-2 p-2 rounded-b border border-white border-opacity-10"},m("b",null,t.name),r&&m("ul",{className:"pl-8"},m(Os,{node:r,nodeStateMap:s})))}function Os({node:e,nodeStateMap:t}){const[n,i]=de(!1),o=t.get(e.ref)?.slices??[];return m(Tt,null,m("li",{className:"flex flex-col gap-2"},m("div",{className:"flex flex-col border border-white border-opacity-10 rounded"+(n?" bg-white bg-opacity-5 text-neutral-100":" hover:bg-white hover:bg-opacity-10 text-neutral-400")},m("button",{onclick:()=>i(!n),className:"flex gap-2 p-2 justify-between cursor-pointer"},m("span",null,"<"+qa(e.ref)+" />"),m("div",{className:"flex gap-2 items-center"},m(to,{fn:e.ref.type,onclick:r=>r.stopPropagation()}),m(ae,{className:"transition-all"+(n?" rotate-90":"")}))),n&&m("div",{className:"flex flex-col gap-2 p-2 bg-[#1a1a1a]"},o.length===0&&m("div",{className:"p-2 bg-black bg-opacity-30 text-sm"},m("h5",{className:"border-b border-white border-opacity-10"},"No slices")),o.map(r=>m("div",{className:"flex flex-col gap-2"},m("div",{className:"p-2 bg-black bg-opacity-30 text-sm"},m("h5",{className:"border-b border-white border-opacity-10"},"Slice:"),m("pre",{className:"text-neutral-400"},m(Ie,{data:{value:r.value},mutable:!1,objectRefAcc:[],onChange:()=>{}}))),m("div",{className:"p-2 bg-black bg-opacity-30 text-sm"},m("h5",{className:"border-b border-white border-opacity-10"},"SliceFn:"),m("pre",{className:"text-neutral-400"},r.sliceFn?r.sliceFn.toString():"null")),r.eq&&m("div",{className:"p-2 bg-black bg-opacity-30 text-sm"},m("h5",{className:"border-b border-white border-opacity-10"},"eq:"),m("pre",{className:"text-neutral-400"},r.eq.toString())))))),e.child&&m("ul",{className:"pl-8 flex flex-col gap-2"},m(Os,{node:e.child,nodeStateMap:t}))),e.sibling&&m(Os,{node:e.sibling,nodeStateMap:t}))}/*!
|
|
1726
|
+
<script type="module" crossorigin>(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))i(s);new MutationObserver(s=>{for(const o of s)if(o.type==="childList")for(const r of o.addedNodes)r.tagName==="LINK"&&r.rel==="modulepreload"&&i(r)}).observe(document,{childList:!0,subtree:!0});function n(s){const o={};return s.integrity&&(o.integrity=s.integrity),s.referrerPolicy&&(o.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?o.credentials="include":s.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function i(s){if(s.ep)return;s.ep=!0;const o=n(s);fetch(s.href,o)}})();const Ic="production",he=Ic==="development",_a=Symbol.for("kiru.signal"),Lc=Symbol.for("kiru.context"),Ci=Symbol.for("kiru.contextProvider"),$e=Symbol.for("kiru.fragment"),wa=Symbol.for("kiru.error"),Sa=Symbol.for("kiru.memo"),Ys=Symbol.for("kiru.errorBoundary"),Rc=50,ne=2,St=4,Pi=8,re=16,ka=32,as=64,Ye=128,Nc=/^on:?/,Ta=new Set(["animateTransform","circle","clipPath","defs","desc","ellipse","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feMerge","feMergeNode","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","filter","foreignObject","g","image","line","linearGradient","marker","path","polygon","polyline","radialGradient","rect","stop","svg","switch","symbol","text","textPath","title","tspan","use"]),zc=new Set(["allowfullscreen","autofocus","autoplay","async","checked","compact","controls","contenteditable","declare","default","defer","disabled","download","hidden","inert","ismap","multiple","nohref","noresize","noshade","novalidate","nowrap","open","popover","readonly","required","sandbox","scoped","selected","sortable","spellcheck","translate","wrap"]),Fc=new Map([["acceptCharset","accept-charset"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["httpEquiv","http-equiv"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),De={current:null},Ma={current:0},Xt={current:"window"in globalThis?"dom":"string"};var Ea;class Xe extends Error{constructor(t){const n=typeof t=="string"?t:t.message;super(n),this[Ea]=!0,typeof t!="string"&&(this.fatal=t?.fatal)}static isKiruError(t){return t instanceof Error&&t[wa]===!0}}Ea=wa;const ls={stack:new Array,current:function(){return this.stack[this.stack.length-1]}},Ve=new Map;function On(e,t=!1){return W.isSignal(e)?t?e.value:e.peek():e}const Hc=()=>{Ve.forEach(e=>e()),Ve.clear()},Cn={parentStack:[],childIdxStack:[],eventDeferrals:new Map,parent:function(){return this.parentStack[this.parentStack.length-1]},clear:function(){this.parentStack.length=0,this.childIdxStack.length=0},pop:function(){this.parentStack.pop(),this.childIdxStack.pop()},push:function(e){this.parentStack.push(e),this.childIdxStack.push(0)},currentChild:function(){return this.parentStack[this.parentStack.length-1].childNodes[this.childIdxStack[this.childIdxStack.length-1]]},nextChild:function(){return this.parentStack[this.parentStack.length-1].childNodes[this.childIdxStack[this.childIdxStack.length-1]++]},bumpChildIndex:function(){this.childIdxStack[this.childIdxStack.length-1]++},captureEvents:function(e){Fo(e,!0),this.eventDeferrals.set(e,[])},resetEvents:function(e){this.eventDeferrals.delete(e)},releaseEvents:function(e){Fo(e,!1);const t=this.eventDeferrals.get(e);for(;t?.length;)t.shift()()}},Bc=e=>{const t=e.target;!e.isTrusted||!t||Cn.eventDeferrals.get(t)?.push(()=>t.dispatchEvent(e))},Fo=(e,t)=>{for(const n in e)if(n.startsWith("on")){const i=n.substring(2);e[t?"addEventListener":"removeEventListener"](i,Bc,{passive:!0})}};let Xs=!1,cs=!1;const Oa=e=>{e.preventDefault(),e.stopPropagation(),cs=!0};let Te=null;function Vc(){Xs=!0,Te=document.activeElement,Te&&Te!==document.body&&Te.addEventListener("blur",Oa)}function Wc(){cs&&(Te.removeEventListener("blur",Oa),Te.isConnected&&Te.focus(),cs=!1),Xs=!1}function us(e,t){if(typeof e=="function"){e(t);return}if(W.isSignal(e)){e.sneak(t),e.notify({filter:n=>typeof n=="function"});return}e.current=t}function jc(e){const t=e.type;return t=="#text"?Uc(e):Ta.has(t)?document.createElementNS("http://www.w3.org/2000/svg",t):document.createElement(t)}function Uc(e){const{nodeValue:t}=e.props;if(!W.isSignal(t))return document.createTextNode(t);const n=t.peek()??"",i=document.createTextNode(n);return fs(e,i,t),i}function $c(e,t,n){const i=hs.get(e)??{},s=i[t]=o=>{if(Xs){o.preventDefault(),o.stopPropagation();return}n(o)};return hs.set(e,i),s}const hs=new WeakMap;function Ca(e){const t=e.dom,n=e.prev?.props??{},i=e.props??{},s=new Set([...Object.keys(n),...Object.keys(i)]),o=Xt.current==="hydrate";s.forEach(r=>{const a=n[r],l=i[r];if(gi.internalProps.includes(r)&&r!=="innerHTML"){r==="ref"&&a!==l&&(a&&us(a,null),l&&us(l,t));return}if(gi.isEvent(r)){if(a!==l||Xt.current==="hydrate"){const c=r.replace(Nc,""),u=c==="focus"||c==="blur";r in n&&t.removeEventListener(c,u?hs.get(e)?.[c]:a),r in i&&t.addEventListener(c,u?$c(e,c,l):l)}return}if(!(t instanceof Text)){if(a===l||o&&t.getAttribute(r)===l)return;if(W.isSignal(a)&&e.cleanups){const c=e.cleanups[r];c&&(c(),delete e.cleanups[r])}if(W.isSignal(l))return Gc(e,t,r,l,a);ui(t,r,l,a);return}W.isSignal(l)||t.nodeValue!==l&&(t.nodeValue=l)})}function Yc(e){return e.multiple?Array.from(e.selectedOptions).map(t=>t.value):e.value}function Pa(e,t){if(!e.multiple||t===void 0||t===null||t===""){e.value=t;return}Array.from(e.options).forEach(n=>{n.selected=t.indexOf(n.value)>-1})}const Xc={value:"input",checked:"change",open:"toggle",volume:"volumechange",playbackRate:"ratechange",currentTime:"timeupdate"},qc=["progress","meter","number","range"];function Gc(e,t,n,i,s){const o=e.cleanups??(e.cleanups={}),[r,a]=n.split(":");if(r!=="bind")return o[n]=i.subscribe((y,v)=>{ui(t,n,y,v)}),ui(t,n,i.peek(),On(s));const l=Xc[a];if(!l)return;const c=t instanceof HTMLSelectElement,u=c?y=>Pa(t,y):y=>t[a]=y,f=y=>{u(y)},p=y=>{i.sneak(y),i.notify({filter:v=>v!==f})};let g;if(a==="value"){const y=qc.indexOf(t.type)!==-1;g=()=>{let v=t.value;c?v=Yc(t):typeof i.peek()=="number"&&y&&(v=t.valueAsNumber),p(v)}}else g=y=>{const v=y.target[a];a==="currentTime"&&i.peek()===v||p(v)};t.addEventListener(l,g);const x=i.subscribe(f);return o[n]=()=>{t.removeEventListener(l,g),x()},ui(t,a,i.peek(),On(s))}function fs(e,t,n){(e.cleanups??(e.cleanups={})).nodeValue=n.subscribe((i,s)=>{i!==s&&(t.nodeValue=i)})}function Kc(e){const t=Cn.nextChild();if(!t)throw new Xe({message:"Hydration mismatch - no node found",vNode:e});let n=t.nodeName;if(Ta.has(n)||(n=n.toLowerCase()),e.type!==n)throw new Xe({message:\`Hydration mismatch - expected node of type \${e.type.toString()} but received \${n}\`,vNode:e});if(e.dom=t,e.type!=="#text"&&!(e.flags&re)){Ca(e);return}W.isSignal(e.props.nodeValue)&&fs(e,t,e.props.nodeValue);let i=e,s=e.sibling;for(;s&&s.type==="#text";){const o=s;Cn.bumpChildIndex();const r=String(On(i.props.nodeValue)??""),a=i.dom.splitText(r.length);o.dom=a,W.isSignal(o.props.nodeValue)&&fs(o,a,o.props.nodeValue),i=s,s=s.sibling}}function Da(e,t,n,i=!1){if(n===null)return e.removeAttribute(t),!0;switch(typeof n){case"undefined":case"function":case"symbol":return e.removeAttribute(t),!0;case"boolean":if(i&&!n)return e.removeAttribute(t),!0}return!1}function Zc(e,t,n){const i=zc.has(t);Da(e,t,n,i)||e.setAttribute(t,i&&typeof n=="boolean"?"":String(n))}const Qc=["INPUT","TEXTAREA"],Jc=e=>Qc.indexOf(e.nodeName)>-1;function ui(e,t,n,i){if(n!==i)switch(t){case"style":return nu(e,n,i);case"className":return eu(e,n);case"innerHTML":return tu(e,n);case"muted":e.muted=!!n;return;case"value":if(e.nodeName==="SELECT")return Pa(e,n);const s=n==null?"":String(n);if(Jc(e)){e.value=s;return}e.setAttribute("value",s);return;case"checked":if(e.nodeName==="INPUT"){e.checked=!!n;return}e.setAttribute("checked",String(n));return;default:return Zc(e,ku(t),n)}}function tu(e,t){if(t==null||typeof t=="boolean"){e.innerHTML="";return}e.innerHTML=String(t)}function eu(e,t){const n=On(t);if(!n)return e.removeAttribute("class");e.setAttribute("class",n)}function nu(e,t,n){if(Da(e,"style",t))return;if(typeof t=="string"){e.setAttribute("style",t);return}let i={};typeof n=="string"?e.setAttribute("style",""):typeof n=="object"&&n&&(i=n);const s=t;new Set([...Object.keys(i),...Object.keys(s)]).forEach(r=>{const a=i[r],l=s[r];if(a!==l){if(l===void 0){e.style[r]="";return}e.style[r]=l}})}function iu(e){let t=e.parent,n=t?.dom;for(;t&&!n;)t=t.parent,n=t?.dom;if(!n||!t){if(!e.parent&&e.dom)return e;throw new Xe({message:"No DOM parent found while attempting to place node.",vNode:e})}return t}function su(e,t){const{node:n,lastChild:i}=t,s=e.dom;if(i){i.after(s);return}const o=Aa(e,n);if(o){n.dom.insertBefore(s,o);return}n.dom.appendChild(s)}function Aa(e,t){let n=e;for(;n;){let i=n.sibling;for(;i;){if(!(i.flags&(St|re))){const s=ou(i);if(s?.isConnected)return s}i=i.sibling}if(n=n.parent,!n||n.flags&re||n===t)return}}function ou(e){let t=e;for(;t;){if(t.dom)return t.dom;if(t.flags&re)return;t=t.child}}function ru(e){if(Xt.current==="hydrate")return Ii(e,mi);const t={node:e.dom?e:iu(e)};ds(e,t,(e.flags&St)>0),e.dom&&!(e.flags&re)&&Ia(e,t,!1),mi(e)}function ds(e,t,n){let i=e.child;for(;i;){if(i.flags&as){i.flags&St&&lu(i,t),mi(i),i=i.sibling;continue}i.dom?(ds(i,{node:i},!1),i.flags&re||Ia(i,t,n)):ds(i,t,(i.flags&St)>0||n),mi(i),i=i.sibling}}function Ia(e,t,n){(n||!e.dom.isConnected||e.flags&St)&&su(e,t),(!e.prev||e.flags&ne)&&Ca(e),t.lastChild=e.dom}function au(e){e===e.parent?.child&&(e.parent.child=e.sibling),Ii(e,t=>{const{hooks:n,subs:i,cleanups:s,dom:o,props:{ref:r}}=t;for(i?.forEach(a=>a()),s&&Object.values(s).forEach(a=>a());n?.length;)n.pop().cleanup?.();o&&(r&&us(r,null),o.isConnected&&!(t.flags&re)&&o.remove(),delete t.dom)}),e.parent=null}function lu(e,t){if(!e.child)return;const n=[];if(La(e.child,n),n.length===0)return;const{node:i,lastChild:s}=t;if(s)s.after(...n);else{const o=Aa(e,i),r=i.dom;o?o.before(...n):r.append(...n)}t.lastChild=n[n.length-1]}function La(e,t){let n=e;for(;n;)n.dom?t.push(n.dom):n.child&&La(n.child,t),n=n.sibling}function cu(e){return typeof e=="function"&&typeof e[Sa]?.arePropsEqual=="function"}function m(e,t=null,...n){if(e===kt)return kt({children:n,...t});const i={type:e,flags:0,index:0,depth:0,props:{},parent:null,sibling:null,child:null,prev:null,deletions:null};if(cu(e)&&(i.flags|=ka,i.arePropsEqual=e[Sa].arePropsEqual),t!==null){const{key:o,ref:r,...a}=t;Au(o)&&(i.props.key=o.toString()),Iu(r)&&(i.props.ref=r),Object.assign(i.props,a)}const s=n.length===1?n[0]:n.length>1?n:null;return s!==null&&(i.props.children=s),i}function kt({children:e,key:t}){return m($e,t?{key:t}:null,e)}function qs(e,t){return Array.isArray(t)?hu(e,t):uu(e,t)}function uu(e,t){const n=e.child;if(n===null)return za(e,t);const i=n.sibling,s=Ra(e,n,t);if(s!==null)return n&&n!==s&&!s.prev?ps(e,n):i&&ps(e,i),s;{const o=Va(n),r=Fa(o,e,0,t);if(r!==null){const a=r.prev;if(a!==null){const l=a.props.key;o.delete(l===void 0?a.index:l)}hi(r,0,0)}return o.forEach(a=>pi(e,a)),r}}function hu(e,t){let n=null,i=null,s=e.child,o=null,r=0,a=0;for(;s!==null&&a<t.length;a++){s.index>a?(o=s,s=null):o=s.sibling;const c=Ra(e,s,t[a]);if(c===null){s===null&&(s=o);break}s&&!c.prev&&pi(e,s),r=hi(c,r,a),i===null?n=c:i.sibling=c,i=c,s=o}if(a===t.length)return ps(e,s),n;if(s===null){for(;a<t.length;a++){const c=za(e,t[a]);c!==null&&(r=hi(c,r,a),i===null?n=c:i.sibling=c,i=c)}return n}const l=Va(s);for(;a<t.length;a++){const c=Fa(l,e,a,t[a]);if(c!==null){const u=c.prev;if(u!==null){const f=u.props.key;l.delete(f===void 0?u.index:f)}r=hi(c,r,a),i===null?n=c:i.sibling=c,i=c}}return l.forEach(c=>pi(e,c)),n}function Ra(e,t,n){const i=t?.props.key;return Ha(n)?i!==void 0||t?.type==="#text"&&W.isSignal(t.props.nodeValue)?null:Ho(e,t,""+n):W.isSignal(n)?t&&t.props.nodeValue!==n?null:Ho(e,t,n):Gs(n)?n.props.key!==i?null:fu(e,t,n):Array.isArray(n)?i!==void 0?null:Na(e,t,n):null}function Ho(e,t,n){if(t===null||t.type!=="#text"){const s=m("#text",{nodeValue:n});return Nt(s,e),s}return t.props.nodeValue!==n&&(t.props.nodeValue=n,t.flags|=ne),t.sibling=null,t}function fu(e,t,n){let{type:i,props:s}=n;if(i===$e)return Na(e,t,s.children||[],s);if(t?.type===i)return t.index=0,t.sibling=null,typeof i=="string"?Ba(t.props,s)&&(t.flags|=ne):t.flags|=ne,t.props=s,t.memoizedProps=n.memoizedProps,t;const o=m(i,s);return Nt(o,e),o}function Na(e,t,n,i={}){if(t===null||t.type!==$e){const s=m($e,{children:n,...i});return Nt(s,e),s}return t.props={...t.props,...i,children:n},t.flags|=ne,t.sibling=null,t}function za(e,t){if(Ha(t)){const n=m("#text",{nodeValue:""+t});return Nt(n,e),n}if(W.isSignal(t)){const n=m("#text",{nodeValue:t});return Nt(n,e),n}if(Gs(t)){const n=m(t.type,t.props);return Nt(n,e),n.flags|=St,n}if(Array.isArray(t)){const n=kt({children:t});return Nt(n,e),n}return null}function hi(e,t,n){e.index=n;const i=e.prev;if(i!==null){const s=i.index;return s<t?(e.flags|=St,t):s}else return e.flags|=St,t}function Fa(e,t,n,i){if(W.isSignal(i)||typeof i=="string"&&i!==""||typeof i=="number"||typeof i=="bigint"){const o=e.get(n);if(o){if(o.props.nodeValue===i)return o;o.type==="#text"&&W.isSignal(o.props.nodeValue)&&o.cleanups?.nodeValue?.()}const r=m("#text",{nodeValue:i});return Nt(r,t),r.flags|=St,r.index=n,r}if(Gs(i)){const{type:o,props:r}=i,a=r.key,l=e.get(a===void 0?n:a);if(l?.type===o)return typeof o=="string"?Ba(l.props,r)&&(l.flags|=ne):l.flags|=ne,l.props=r,l.sibling=null,l.index=n,l;const c=m(i.type,i.props);return Nt(c,t),c.flags|=St,c.index=n,c}if(Array.isArray(i)){const o=e.get(n);if(o)return o.flags|=ne,o.props.children=i,o;const r=kt({children:i});return Nt(r,t),r.flags|=St,r.index=n,r}return null}function Ha(e){return typeof e=="string"&&e!==""||typeof e=="number"||typeof e=="bigint"}function Ba(e,t){const n=Object.keys(e),i=Object.keys(t);if(n.length!==i.length)return!0;for(let s of n)if(!(s==="children"||s==="key")&&e[s]!==t[s])return!0;return!1}function Nt(e,t){e.parent=t,e.depth=t.depth+1}function Va(e){const t=new Map;for(;e;){const n=e.props.key;t.set(n===void 0?e.index:n,e),e=e.sibling}return t}function pi(e,t){e.deletions===null?e.deletions=[t]:e.deletions.push(t)}function ps(e,t){for(;t;)pi(e,t),t=t.sibling}let Yt=[],qe=!1,gs=[],ms=[],bs=!1,ys=!1,xs=!1,vs=0,Wa=[],_s=[],ja=-1;function du(e){if(qe){gs.push(e);return}e()}function Ua(){qe&&(window.cancelAnimationFrame(ja),$a())}function Bo(e){e.flags|=Ye,Yt.push(e),qe=!0,Ua()}function Di(e){if(Xt.current==="hydrate")return du(()=>ws(e));ws(e)}function pu(){qe||(qe=!0,ja=window.requestAnimationFrame($a))}function gu(){for(qe=!1;gs.length;)gs.shift()()}function ws(e){if(bs&&(ys=!0),De.current===e){xs=!0;return}if(!(e.flags&(Ye|Pi))){if(e.flags|=Ye,!Yt.length)return Yt.push(e),pu();Yt.push(e)}}function mu(e){Ii(e,t=>t.flags|=Pi),ms.push(e)}const bu=(e,t)=>t.depth-e.depth;let Jt=null;function $a(){let e=1;for(Vc();Yt.length;){Yt.length>e&&Yt.sort(bu),Jt=Yt.shift(),e=Yt.length;const t=Jt.flags;if(!(t&Pi)&&t&Ye){let n=Jt;for(;n=yu(n););for(;ms.length;)au(ms.pop());ru(Jt),Jt.flags&=~Ye}}if(Wc(),bs=!0,qi(Wa),bs=!1,ys)return wu(),qi(_s),ys=!1,vs++,Ua();vs=0,gu(),qi(_s)}function yu(e){let t=!0;try{typeof e.type=="string"?_u(e):Mu(e.type)?xu(e):t=vu(e)}catch(i){const s=Du(e);if(s){const o=s.error=i instanceof Error?i:new Error(String(i));return s.props.onError?.(o),s.depth<Jt.depth&&(Jt=s),s}if(Xe.isKiruError(i)){if(i.customNodeStack&&setTimeout(()=>{throw new Error(i.customNodeStack)}),i.fatal)throw i;console.error(i);return}setTimeout(()=>{throw i})}if(e.deletions!==null&&(e.deletions.forEach(mu),e.deletions=null),t&&e.child)return e.child;let n=e;for(;n;){if(n.immediateEffects&&(Wa.push(...n.immediateEffects),n.immediateEffects=void 0),n.effects&&(_s.push(...n.effects),n.effects=void 0),n===Jt)return;if(n.sibling)return n.sibling;n=n.parent,Xt.current==="hydrate"&&n?.dom&&Cn.pop()}}function xu(e){const{props:t,type:n}=e;let i=t.children;if(n===Ci){const{props:{dependents:s,value:o},prev:r}=e;s.size&&r&&r.props.value!==o&&s.forEach(ws)}else if(n===Ys){const s=e,{error:o}=s;o&&(i=typeof t.fallback=="function"?t.fallback(o):t.fallback,delete s.error)}e.child=qs(e,i)}function vu(e){const{type:t,props:n,subs:i,prev:s,flags:o}=e;if(o&ka){if(e.memoizedProps=n,s?.memoizedProps&&e.arePropsEqual(s.memoizedProps,n)&&!e.hmrUpdated)return e.flags|=as,!1;e.flags&=~as}try{De.current=e;let r,a=0;do e.flags&=~Ye,xs=!1,Ma.current=0,i&&(i.forEach(l=>l()),i.clear()),r=t(n);while(xs);return e.child=qs(e,r),!0}finally{De.current=null}}function _u(e){const{props:t,type:n}=e;e.dom||(Xt.current==="hydrate"?Kc(e):e.dom=jc(e)),n!=="#text"&&(e.child=qs(e,t.children),e.child&&Xt.current==="hydrate"&&Cn.push(e.dom))}function wu(){if(vs>Rc)throw new Xe("Maximum update depth exceeded. This can happen when a component repeatedly calls setState during render or in useLayoutEffect. Kiru limits the number of nested updates to prevent infinite loops.")}function qi(e){for(let t=0;t<e.length;t++)e[t]();e.length=0}var Vo;(function(e){e.Start="start",e.End="end"})(Vo||(Vo={}));const fe=()=>{const e=De.current;return e||Ya("useRequestUpdate"),()=>Di(e)};function Ft(e,t,n){const i=De.current;i||Ya(e);const s=(a,l)=>{if(l?.immediate){(i.immediateEffects??(i.immediateEffects=[])).push(a);return}(i.effects??(i.effects=[])).push(a)},o=Ma.current++;let r=i.hooks?.at(o);try{const a=r??(typeof t=="function"?t():{...t});return i.hooks??(i.hooks=[]),i.hooks[o]=a,n({hook:a,isInit:!r,update:()=>Di(i),queueEffect:s,vNode:i,index:o})}catch(a){throw a}}function Ya(e){throw new Xe(\`Hook "\${e}" must be used at the top level of a component or inside another composite hook.\`)}function Ai(e){e.cleanup&&(e.cleanup(),e.cleanup=void 0)}function tn(e,t){return e===void 0||t===void 0||e.length!==t.length||e.length>0&&t.some((n,i)=>!Object.is(n,e[i]))}var Xa;class W{constructor(t,n){this[Xa]=!0,this.$id=Ru(),this.$value=t,n&&(this.displayName=n),this.$subs=new Set}get value(){return this.onBeforeRead?.(),W.entangle(this),this.$value}set value(t){Object.is(this.$value,t)||(this.$prevValue=this.$value,this.$value=t,this.notify())}peek(){return this.onBeforeRead?.(),this.$value}sneak(t){this.$prevValue=this.$value,this.$value=t}toString(){return this.onBeforeRead?.(),W.entangle(this),\`\${this.$value}\`}subscribe(t){return this.$subs.add(t),()=>this.$subs.delete(t)}notify(t){this.$subs.forEach(n=>{if(!(t?.filter&&!t.filter(n)))return n(this.$value,this.$prevValue)})}static isSignal(t){return typeof t=="object"&&!!t&&_a in t}static subscribers(t){return t.$subs}static makeReadonly(t){const n=Object.getOwnPropertyDescriptor(t,"value");return n&&!n.writable?t:Object.defineProperty(t,"value",{get:function(){return W.entangle(this),this.$value},configurable:!0})}static makeWritable(t){const n=Object.getOwnPropertyDescriptor(t,"value");return n&&n.writable?t:Object.defineProperty(t,"value",{get:function(){return W.entangle(this),this.$value},set:function(i){this.$value=i,this.notify()},configurable:!0})}static entangle(t){const n=De.current,i=ls.current();if(i){(!n||n&&Tt())&&i.set(t.$id,t);return}if(!n||!Tt())return;const s=t.subscribe(()=>Di(n));(n.subs??(n.subs=new Set)).add(s)}static configure(t,n){t.onBeforeRead=n}static dispose(t){t.$isDisposed=!0,t.$subs.clear()}}Xa=_a;const ht=(e,t)=>new W(e,t),J=(e,t)=>Ft("useSignal",{signal:null},({hook:n,isInit:i,isHMR:s})=>(i&&(n.cleanup=()=>W.dispose(n.signal),n.signal=new W(e,t)),n.signal));function Su(e){const{id:t,subs:n,fn:i,deps:s=[],onDepChanged:o}=e;let r;Ve.delete(t);const a=!!De.current&&!Tt();a||(r=new Map,ls.stack.push(r));const l=i(...s.map(c=>c.value));if(!a){for(const[u,f]of n)r.has(u)||(f(),n.delete(u));const c=()=>{Ve.size||queueMicrotask(Hc),Ve.set(t,o)};for(const[u,f]of r){if(n.has(u))continue;const p=f.subscribe(c);n.set(u,p)}ls.stack.pop()}return l}class Be extends W{constructor(t,n){super(void 0,n),this.$getter=t,this.$unsubs=new Map,this.$isDirty=!0,W.configure(this,()=>{this.$isDirty&&Be.run(this)})}get value(){return super.value}set value(t){}subscribe(t){return this.$isDirty&&Be.run(this),super.subscribe(t)}static dispose(t){Be.stop(t),W.dispose(t)}static stop(t){const{$id:n,$unsubs:i}=t;Ve.delete(n),i.forEach(s=>s()),i.clear(),t.$isDirty=!0}static run(t){const n=t,{$id:i,$getter:s,$unsubs:o}=n,r=Su({id:i,subs:o,fn:()=>s(n.$value),onDepChanged:()=>{n.$isDirty=!0,t.$subs.size&&(Be.run(n),!Object.is(n.$value,n.$prevValue)&&n.notify())}});n.sneak(r),n.$isDirty=!1}}const qa=(e,t)=>new Be(e,t),gi={internalProps:["children","ref","key","innerHTML"],isEvent:e=>e.startsWith("on"),isProperty:e=>!gi.internalProps.includes(e)&&!gi.isEvent(e)};function ku(e){switch(e){case"className":return"class";case"htmlFor":return"for";case"tabIndex":case"formAction":case"formMethod":case"formEncType":case"contentEditable":case"spellCheck":case"allowFullScreen":case"autoPlay":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"noModule":case"noValidate":case"popoverTarget":case"popoverTargetAction":case"playsInline":case"readOnly":case"itemscope":case"rowSpan":case"crossOrigin":return e.toLowerCase();default:return e.indexOf("-")>-1?e:e.startsWith("aria")?"aria-"+e.substring(4).toLowerCase():Fc.get(e)||e}}function Tt(){return Xt.current==="dom"||Xt.current==="hydrate"}function Tu(e){return(e.flags&Pi)!==0}function Gs(e){return typeof e=="object"&&e!==null&&"type"in e}function Mu(e){return e===$e||e===Ci||e===Ys}function Eu(e){return e.type===$e}function Ou(e){return typeof e.type=="function"&&"displayName"in e.type&&e.type.displayName==="Kiru.lazy"}function Cu(e){return typeof e.type=="function"&&"displayName"in e.type&&e.type.displayName==="Kiru.memo"}function mi(e){const{props:{children:t,...n},memoizedProps:i,index:s}=e;e.prev={props:n,memoizedProps:i,index:s},e.flags&=-15}function Ii(e,t){t(e);let n=e.child;for(;n;)t(n),n.child&&Ii(n,t),n=n.sibling}function Pu(e,t){let n=e.parent;for(;n;){if(t(n))return n;n=n.parent}return null}function Du(e){return Pu(e,t=>t.type===Ys)}function Au(e){return typeof e=="string"||typeof e=="number"}function Iu(e){return typeof e=="function"||typeof e=="object"&&!!e&&"current"in e||W.isSignal(e)}const Lu="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz-";function Ru(e=10,t=Lu){let n="";for(let i=0;i<e;i++)n+=t[Math.random()*t.length|0];return n}const Wo=Object.freeze(()=>{});function Nu(){const e=new Set,t=new Map;function n(r,a,l){t.get(r)?.forEach(c=>c(a,l))}function i(r,a){t.has(r)||t.set(r,new Set),t.get(r).add(a)}function s(r,a){t.get(r)?.delete(a)}const o={get apps(){return Array.from(e)},emit:n,on:i,off:s};return i("mount",r=>e.add(r)),i("unmount",r=>e.delete(r)),o}let zu=0;function Fu(e,t,n){const i=m(t.nodeName.toLowerCase(),{});i.dom=t,i.flags|=re;const s=zu++,o=\`App-\${s}\`,r={id:s,name:o,rootNode:i,render:a,unmount:l};function a(c){i.props.children=c,Bo(i)}function l(){i.props.children=null,Bo(i),window.__kiru.emit("unmount",r)}return a(e),window.__kiru.emit("mount",r),r}function de(e){return Tt()?Ft("useState",{state:void 0,dispatch:Wo},({hook:t,isInit:n,update:i,isHMR:s})=>(n&&(t.state=typeof e=="function"?e():e,t.dispatch=o=>{const r=typeof o=="function"?o(t.state):o;Object.is(t.state,r)||(t.state=r,i())}),[t.state,t.dispatch])):[typeof e=="function"?e():e,Wo]}function Hu(e){const t={[Lc]:!0,Provider:({value:n,children:i})=>{const[s]=de(()=>new Set);return m(Ci,{value:n,ctx:t,dependents:s},typeof i=="function"?i(n):i)},default:()=>e,set displayName(n){this.Provider.displayName=n},get displayName(){return this.Provider.displayName||"Anonymous Context"}};return t}function We(e,t){return Tt()?Ft("useCallback",{callback:e,deps:t},({hook:n,isHMR:i})=>(tn(t,n.deps)&&(n.deps=t,n.callback=e),n.callback)):e}function Bu(e,t=!0){return Ft("useContext",{context:e,warnIfNotFound:t},Vu)}const Vu=({hook:e,isInit:t,vNode:n})=>{if(t){let i=n.parent;for(;i;){if(i.type===Ci){const s=i,{ctx:o,value:r,dependents:a}=s.props;if(o===e.context)return a.add(n),e.cleanup=()=>a.delete(n),e.provider=s,r}i=i.parent}}return e.provider?e.provider.props.value:e.context.default()};function ut(e,t){if(Tt())return Ft("useEffect",{deps:t},({hook:n,isInit:i,isHMR:s,queueEffect:o})=>{(i||tn(t,n.deps))&&(n.deps=t,Ai(n),o(()=>{const r=e();typeof r=="function"&&(n.cleanup=r)}))})}function Ks(e,t){if(Tt())return Ft("useLayoutEffect",{deps:t},({hook:n,isInit:i,isHMR:s,queueEffect:o})=>{(i||tn(t,n.deps))&&(n.deps=t,Ai(n),o(()=>{const r=e();typeof r=="function"&&(n.cleanup=r)},{immediate:!0}))})}function bi(e,t){return Tt()?Ft("useMemo",{deps:t,value:void 0},({hook:n,isInit:i,isHMR:s})=>((i||tn(t,n.deps))&&(n.deps=t,n.value=e()),n.value)):e()}function Ge(e){return Tt()?Ft("useRef",{ref:{current:e}},({hook:t,isInit:n,isHMR:i})=>t.ref):{current:e}}"window"in globalThis&&(window.__KIRU_LAZY_CACHE??(window.__KIRU_LAZY_CACHE=new Map));var jo;"window"in globalThis&&!globalThis.__KIRU_DEVTOOLS__&&((jo=globalThis.window).__kiru??(jo.__kiru=Nu()));function Ss(...e){return e.filter(Boolean).join(" ")}function Zs(e,t,n){let i=e;for(let s=0;s<t.length;s++){const o=t[s];s===t.length-1?i[o]=n:i=i[o]}}function Ga(e){return e.type.displayName??(e.type.name||"Anonymous Function")}const Wu=e=>e.__devtoolsFileLink??null;function Pn(e){return e.name==="kiru.devtools"}function Ka(e){return Array.from(e.entries())}function ju(e){return m("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",...e},m("rect",{width:"20",height:"16",x:"2",y:"4",rx:"2"}),m("path",{d:"M12 9v11"}),m("path",{d:"M2 9h13a2 2 0 0 1 2 2v9"}))}function ae(e){return m("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1rem",height:"1rem",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",...e},m("path",{d:"m9 18 6-6-6-6"}))}function Uu(e){return m("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",...e},m("path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z"}),m("circle",{cx:"12",cy:"12",r:"3"}))}function $u(e){return m("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",...e},m("path",{d:"M21 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h6"}),m("path",{d:"m21 3-9 9"}),m("path",{d:"M15 3h6v6"}))}function Yu(e){return m("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",...e},m("path",{d:"m12 14 4-4"}),m("path",{d:"M3.34 19a10 10 0 1 1 17.32 0"}))}function Xu(e){return m("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",...e},m("circle",{cx:"12",cy:"12",r:"10"}),m("path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20"}),m("path",{d:"M2 12h20"}))}function qu(e){return m("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",...e},m("path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8"}),m("path",{d:"M21 3v5h-5"}),m("path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16"}),m("path",{d:"M8 16H3v5"}))}function Gu(e){return m("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",...e},m("path",{d:"M22 8.35V20a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V8.35A2 2 0 0 1 3.26 6.5l8-3.2a2 2 0 0 1 1.48 0l8 3.2A2 2 0 0 1 22 8.35Z"}),m("path",{d:"M6 18h12"}),m("path",{d:"M6 14h12"}),m("rect",{width:"12",height:"12",x:"6",y:"10"}))}function Za(e){return m("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",...e},m("path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3"}),m("path",{d:"M12 9v4"}),m("path",{d:"M12 17h.01"}))}function Qa({title:e,children:t,className:n,disabled:i,...s}){const[o,r]=de(!0);ut(()=>{!o&&i&&r(!0)},[i]);const a=We(l=>{l.preventDefault(),l.stopImmediatePropagation(),r(c=>!c)},[]);return m("div",{className:"flex flex-col"},m("button",{onclick:a,disabled:i,className:\`\${i?"opacity-50 cursor-default":"cursor-pointer"}\`},m("span",{className:"flex items-center gap-2 font-medium"},m(ae,{className:\`transition \${o?"":"rotate-90"}\`}),e)),o?null:m("div",{className:\`p-2 \${n||""}\`,...s},t))}const Qs={arrayChunkSize:10,objectKeysChunkSize:100};function Ja(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;const n=new Set([...Object.keys(e),...Object.keys(t)]);for(const i in n)if(typeof t[i]!=typeof e[i]||typeof e[i]=="object"&&!Ja(e[i],t[i]))return!1;return!0}function tl(e,t,n){for(const i in t)typeof e[i]>"u"&&(e[i]=structuredClone(t[i]));for(const i in e)typeof e[i]=="object"?tl(e[i],t[i],n):n(e,i,e[i])}let el={...Qs};const Uo=localStorage.getItem("kiru.devtools.userSettings");if(Uo)try{const e=JSON.parse(Uo);Ja(Qs,e)&&(el=e)}catch(e){console.error("kiru.devtools.userSettings error",e)}const nl=Hu({userSettings:null,saveUserSettings:()=>{}}),Li=()=>Bu(nl);function Ku({children:e}){const[t,n]=de(el),i=s=>{localStorage.setItem("kiru.devtools.userSettings",JSON.stringify(s)),n(s)};return m(nl.Provider,{value:{userSettings:t,saveUserSettings:i}},e)}function Zu(){const{userSettings:e,saveUserSettings:t}=Li();return m("div",{className:"rounded bg-neutral-400 bg-opacity-5 border border-white border-opacity-10 overflow-hidden"},m(Ie,{border:!1,data:e,onChange:(n,i)=>{const s={...e};Zs(s,n,i),tl(s,Qs,(o,r,a)=>{o[r]=a<1?1:a}),t(s)},mutable:!0,objectRefAcc:[]}))}const Qu=Object.freeze(()=>{});function Ie({data:e,onChange:t,mutable:n,objectRefAcc:i,keys:s=[],className:o,border:r=!0}){const{userSettings:{objectKeysChunkSize:a}}=Li(),[l,c]=de(0),u=bi(()=>Object.keys(e).slice(0,(l+1)*a),[l,a,e]),f=()=>{u.forEach(g=>{typeof e[g]=="object"&&i.splice(i.indexOf(e[g]),1)}),c(l+1)},p=u.length<Object.keys(e).length;return m(kt,null,m("div",{className:Ss("flex flex-col items-start w-full",r&&"border border-neutral-700",On(o))},u.map(g=>{const x=s.concat(g),y=x.join(".");return m("div",{key:y,"data-key":y,className:"flex flex-col items-start w-full gap-2 pl-2 py-1 pr-1 border-b border-neutral-700 last:border-b-0"},m(Js,{value:e[g],onChange:t,keys:x,path:y,label:g,mutable:n,objectRefAcc:i}))})),p&&m("button",{onclick:f,title:"Show more",className:"p-1 border font-bold border-neutral-700 hover:bg-neutral-700"},m("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1rem",height:"1rem",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},m("circle",{cx:"12",cy:"12",r:"1"}),m("circle",{cx:"19",cy:"12",r:"1"}),m("circle",{cx:"5",cy:"12",r:"1"}))))}function yi(e,t){Array.isArray(e)?(t(e),e.forEach(n=>yi(n,t))):typeof e=="object"&&e!==null&&(t(e),Object.values(e).forEach(n=>yi(n,t)))}function Js({value:e,onChange:t,keys:n,path:i,mutable:s,objectRefAcc:o,label:r}){const{userSettings:{arrayChunkSize:a}}=Li(),[l,c]=de(!0),u=r!==void 0&&m("label",{htmlFor:i,className:"text-xs truncate",title:i,children:r});if(e===null)return m(mt,null,u,m(Zt,null,"null"));if(e===void 0)return m(mt,null,u,m(Zt,null,"undefined"));const f=window.opener?window.opener.Node:Node;if(e instanceof f)return m(mt,null,u,m(Zt,null,"<",m("span",{style:{color:"#f0a05e"}},e.nodeName),"/>"));const p=window.opener?window.opener.Error:Error;if(e instanceof p)return m(mt,null,u,"cause"in e&&e.cause?m(Zt,null,e.message," (",String(e.cause),")"):m(Zt,null,e.message));const g=x=>t(n,x);switch(typeof e){case"string":return m(mt,null,u,m(Gi,{disabled:!s,id:i,type:"text",value:e,onchange:x=>g(x.target.value)}));case"number":return m(mt,null,u,m(Gi,{disabled:!s,id:i,type:"number",value:e,placeholder:"NaN",onchange:x=>g(Number(x.target.value))}));case"bigint":return m(mt,null,u,m(Gi,{disabled:!s,id:i,type:"number",value:e.toString(),onchange:x=>g(BigInt(x.target.value))}));case"boolean":return m(mt,null,u,m("input",{disabled:!s,id:i,type:"checkbox",checked:e,onchange:x=>g(x.target.checked),className:"accent-red-500"}));case"function":return m(mt,null,u,m(Zt,null,\`\u0192 \${e.name||"anonymous"}()\`));default:return Array.isArray(e)?m(mt,null,m("button",{className:"text-xs flex items-center gap-1 cursor-pointer w-full",title:i,onclick:()=>{yi(e,x=>o.splice(o.indexOf(x),1)),c(x=>!x)}},r,m(ae,{width:10,height:10,className:\`transition \${l?"":"rotate-90"}\`})),l?m(Zt,null,"Array(",e.length,")"):e.length>a?m(Ju,{array:e,objectRefAcc:o}):m("div",{className:"flex flex-col items-start gap-1 w-full"},e.map((x,y)=>m(Js,{value:x,onChange:t,keys:[...n,y.toString()],path:i.concat(".",y.toString()),label:y.toString(),mutable:s,objectRefAcc:o})))):o.includes(e)?m(mt,null,u,m(Zt,null,"Object(circular reference)")):(o.push(e),m(mt,null,m("button",{className:"text-xs flex items-center gap-1 cursor-pointer w-full",title:i,onclick:()=>{yi(e,x=>o.splice(o.indexOf(x),1)),c(x=>!x)}},r,m(ae,{width:10,height:10,className:\`transition \${l?"":"rotate-90"}\`})),l?null:m(Ie,{data:e,onChange:t,keys:n,mutable:s,objectRefAcc:o})))}}function mt({children:e}){return m("div",{className:"flex flex-col items-start gap-1 w-full"},e)}function Gi(e){return m("input",{className:"flex-grow text-xs px-2 py-1 text-neutral-300 w-full",...e})}function Zt({children:e}){return m("small",{className:"text-neutral-300"},m("i",null,e))}function Ju({array:e,objectRefAcc:t}){const{userSettings:{arrayChunkSize:n}}=Li(),i=e.length,s=Math.ceil(i/n);return m("div",{className:"flex flex-col items-start gap-1 w-full"},Array.from({length:s}).map((o,r)=>m(th,{array:e,range:{start:r*n,end:(r+1)*n},objectRefAcc:t})))}function th({array:e,range:t,objectRefAcc:n}){const[i,s]=de(!0);let o;return i?o=void 0:o=e.slice(t.start,t.end),m("div",{className:"flex flex-col items-start gap-1 w-full"},m("button",{className:"text-xs flex items-center gap-1 cursor-pointer w-full",onclick:()=>{n.splice(n.indexOf(e),1),s(r=>!r)}},"[",t.start,"..",(t.end<e.length?t.end:e.length)-1,"]",m(ae,{width:10,height:10,className:\`transition \${i?"":"rotate-90"}\`})),o&&m("div",{className:"flex flex-col items-start gap-1 w-full"},o.map((r,a)=>m(Js,{value:r,onChange:Qu,label:(t.start+a).toString(),keys:[a.toString()],path:a.toString(),mutable:!1,objectRefAcc:n}))))}const eh="kiru-devtools";"window"in globalThis&&(window.__devtoolsSelection??=null);class nh extends BroadcastChannel{send(t){super.postMessage(t)}removeEventListener(t){return super.removeEventListener("message",t)}addEventListener(t){return super.addEventListener("message",t)}}const Ke=new nh(eh);function to({fn:e,onclick:t}){const n=bi(()=>Wu(e),[e]);return n?m("a",{className:"flex items-center gap-1 text-[10px] opacity-50 hover:opacity-100 transition-opacity",href:n,onclick:i=>{i.preventDefault(),Ke.send({type:"open-editor",fileLink:n}),t?.(i)},title:"Open in editor"},"Open in editor",m($u,{width:"0.65rem",height:"0.65rem"})):null}function ih({selectedApp:e,selectedNode:t,setSelectedNode:n,kiruGlobal:i}){const s=fe();ut(()=>{const l=c=>{c===e&&(Tu(t)?n(null):s())};return i?.on("update",l),()=>i?.off("update",l)},[]);const o=()=>{t&&Di(t)},r={...t.props};delete r.children;const a=rh(t);return m("div",{className:"flex-grow p-2 sticky top-0"},m("h2",{className:"flex justify-between items-center font-bold mb-2 pb-2 border-b-2 border-neutral-800"},m("div",{className:"flex gap-2 items-center"},"<"+Ga(t)+">",m(to,{fn:t.type})),m("button",{onclick:o},m(qu,{className:"w-5 h-5"}))),m(Qa,{title:"props",disabled:Object.keys(r).length===0},m(Ie,{data:r,onChange:()=>{},mutable:!1,objectRefAcc:[]})),m(il,{node:a,selectedApp:e}))}function sh(e){return e.name==="devtools:useHookDebugGroup"}function oh(e){return ks in e}const ks=Symbol.for("devtools.hookGroup");function rh(e){const t={parent:null,name:"hooks",children:[],[ks]:!0};if(e.hooks?.length){let n=t;for(let i=0;i<e.hooks.length;i++){const s=e.hooks[i];if(sh(s)){switch(s.action){case"start":const o={parent:n,name:s.displayName,children:[],[ks]:!0};n.children.push(o),n=o;break;case"end":if(n.name!==s.displayName||n.parent===null)throw new Error("useHookDebugGroup:end called with no start");n=n.parent;break}continue}n.children.push(s)}}return t}function il({node:e,selectedApp:t,depth:n=0}){if(oh(e))return m(Qa,{title:e.name,className:"bg-[#ffffff04] border border-[#fff1] flex flex-col gap-2 pl-6",disabled:e.children.length===0},e.children.map(u=>m(il,{node:u,selectedApp:t,depth:n+1})));const{name:i,dev:s,cleanup:o,...r}=e,a=s?.devtools,l=typeof a?.get=="function"?a.get():r;return m("div",null,m("i",{className:"text-neutral-300 text-sm"},i||"anonymous hook"),m("div",{className:"p-2"},m(Ie,{data:l,onChange:(u,f)=>{if(!t||!a?.set||!a?.get)return;const p=a.get();Zs(p,u,f),a.set(p)},mutable:!!a?.set,objectRefAcc:[]})))}const Oe=(e,t,n={})=>{ut(()=>{let i=window;const s=n?.ref?.();return s?i=s:n.ref&&console.warn("useEventListener ref failed, using window"),i.addEventListener(e,t,n),()=>{i.removeEventListener(e,t,n)}},[t])},ah=()=>{const e=J({x:0,y:0}),t=J({x:0,y:0}),n=J({x:0,y:0});return Oe("mousemove",i=>{e.value={x:i.x,y:i.y},t.value={x:i.movementX,y:i.movementY},n.value={x:i.clientX,y:i.clientY}}),{mouse:e,delta:t,client:n}},Xn="window"in globalThis&&"ResizeObserver"in globalThis.window,lh=(e,t,n=void 0)=>Tt()?Xn?Ft("useResizeObserver",{resizeObserver:null,deps:[e.current]},({isInit:i,hook:s,queueEffect:o})=>(i&&(s.resizeObserver=new ResizeObserver(t),s.cleanup=()=>{s.resizeObserver?.disconnect?.(),s.resizeObserver=null}),o(()=>{tn([e.current],s.deps)&&(s.deps=[e.current],s.resizeObserver?.disconnect?.(),e.current&&s.resizeObserver?.observe(e.current,n))}),{isSupported:Xn,start:()=>{s.resizeObserver==null&&(s.resizeObserver=new ResizeObserver(t),e.current&&s.resizeObserver.observe(e.current,n),s.cleanup=()=>{s.resizeObserver?.disconnect?.(),s.resizeObserver=null})},stop:()=>{Ai(s)}})):{isSupported:Xn,start:()=>{},stop:()=>{}}:{isSupported:Xn,start:()=>{},stop:()=>{}},qn="window"in globalThis&&"MutationObserver"in globalThis.window,ch=(e,t,n=void 0)=>Tt()?qn?Ft("useMutationObserver",{mutationObserver:null,deps:[e.current]},({isInit:i,hook:s,queueEffect:o})=>(i?(o(()=>{s.deps=[e.current],s.mutationObserver=new MutationObserver(t),e.current&&s.mutationObserver.observe(e.current,n)}),s.cleanup=()=>{s.mutationObserver?.disconnect?.(),s.mutationObserver=null}):tn([e.current],s.deps)&&(s.deps=[e.current],s.mutationObserver?.disconnect?.(),e.current&&s.mutationObserver?.observe(e.current,n)),{isSupported:qn,start:()=>{s.mutationObserver==null&&(s.mutationObserver=new MutationObserver(t),e.current&&s.mutationObserver.observe(e.current,n),s.cleanup=()=>{s.mutationObserver?.disconnect?.(),s.mutationObserver=null})},stop:()=>{Ai(s)}})):{isSupported:qn,start:()=>{},stop:()=>{}}:{isSupported:qn,start:()=>{},stop:()=>{}},uh=(e,t={windowScroll:!0,windowResize:!0})=>{const n=t?.windowScroll??!0,i=t?.windowResize??!0,s=t.immediate??!0,o=J(0),r=J(0),a=J(0),l=J(0),c=J(0),u=J(0),f=J(0),p=J(0),g=()=>{const x=e.current;if(!x){o.value=0,r.value=0,a.value=0,l.value=0,c.value=0,u.value=0,f.value=0,p.value=0;return}const y=x.getBoundingClientRect();o.value=y.width,r.value=y.height,a.value=y.top,l.value=y.right,c.value=y.bottom,u.value=y.left,f.value=y.x,p.value=y.y};return lh(e,g),ch(e,g,{attributeFilter:["style","class"]}),Oe("scroll",()=>{n&&g()},{capture:!0,passive:!0}),Oe("resize",()=>{i&&g()},{passive:!0}),Ks(()=>{s&&g()},[]),{width:o,height:r,top:a,right:l,bottom:c,left:u,x:f,y:p,update:g}};function hh(e){return typeof e=="function"?e:typeof e=="string"?t=>t.key===e:Array.isArray(e)?t=>e.includes(t.key):()=>!0}const $o=(e,t,n={})=>{const{ref:i,eventName:s="keydown",passive:o=!1}=n,r=hh(e);return Oe(s,l=>{l.repeat&&!n.repeat||r(l)&&t(l)},{ref:i,passive:o})};function sl({value:e,className:t,...n}){return m("div",{className:Ss("w-full p-2 z-10","bg-[#1d1d1d] border border-white border-opacity-10 rounded",t?.toString()),...n},m("input",{className:Ss("px-2 py-1 w-full rounded focus:outline focus:outline-primary","bg-[#212121] border border-white border-opacity-10 rounded"),placeholder:"Filter...",type:"text","bind:value":e}))}let $;"window"in globalThis&&window.opener&&($=window.opener.__kiru);const je=ht(!1);Ke.addEventListener(e=>{e.data.type==="set-inspect-enabled"&&(je.value=e.data.value)});const ol=($?.apps??[]).filter(e=>!Pn(e)),ie=ht(ol);ht(null);const Lt=ht(ol[0]??null),se=ht(null);$?.on("mount",e=>{Pn(e)||(ie.value=[...ie.peek(),e],Lt.peek()===null&&(Lt.value=e))});$?.on("unmount",e=>{ie.value=ie.peek().filter(t=>t!==e),Lt.peek()===e&&(Lt.value=ie.peek()[0]??null)});const Ts=ht(new Map),Rt=ht(null),eo=ht("");function fh(e){return e.type.displayName??(e.type.name||"Anonymous Function")}function dh(e,t){const n=t.toLowerCase();return e.every(i=>n.includes(i))}function Ms(e){return typeof e.type=="function"&&!Eu(e)&&!Ou(e)&&!Cu(e)}function ph(e){let t=[e];for(;t.length;){const n=t.pop();if(Ms(n))return!0;n.child&&t.push(n.child),n.sibling&&t.push(n.sibling)}return!1}const gh=(e,t)=>{const n=[t.parent];for(;n.length;){const i=n.pop();if(e===i)return!0;i?.parent&&n.push(i.parent)}return!1};function Es(e,t){if(!e)return null;const n=t(e),i=Es(e.sibling,t),s=Es(e.child,t);return n?{ref:e,sibling:i??null,child:s??null}:i||s||null}function xi({node:e,traverseSiblings:t=!0}){const[n,i]=de(!0),o=se.value===e,r=bi(()=>crypto.randomUUID(),[]),a=bi(()=>Rt.value==null?null:gh(e,Rt.value),[Rt.value,e]);ut(()=>{a&&i(!1)},[a]),ut(()=>{if(!(!e||!Ms(e)))return Ts.peek().set(r,{vNode:e,setCollapsed:i}),()=>{Ts.peek().delete(r)}});const l=eo.value;if(!e)return null;if(!Ms(e)||l.length>0&&!dh(l.toLowerCase().split(" "),e.type.name))return m(kt,null,e.child&&m(xi,{node:e.child}),t&&m(Yo,{node:e}));const c=e.child&&ph(e.child);return m(kt,null,m("div",{className:"pl-4 mb-1"},m("h2",{onclick:()=>{Rt.value=null,se.value=o?null:e},className:\`flex gap-2 items-center cursor-pointer mb-1 scroll-m-12 \${o?"font-medium bg-primary selected-vnode":""}\`,"data-id":r},c&&m(ae,{className:\`cursor-pointer transition \${n?"":"rotate-90"}\`,onclick:u=>{u.preventDefault(),u.stopImmediatePropagation(),Rt.value=null,i(f=>!f)}}),m("div",{className:c?"":"ml-6"},m("span",{className:o?"":"text-neutral-400"},"<"),m("span",{className:o?"":"text-primary"},fh(e)),m("span",{className:o?"":"text-neutral-400"},">"))),!n&&e.child||a!=null&&a&&e.child?m(xi,{node:e.child}):null),t&&m(Yo,{node:e}))}function Yo({node:e}){if(!e)return null;let t=[],n=e.sibling;for(;n;)t.push(n),n=n.sibling;return m(kt,null,t.map(i=>m(xi,{node:i,traverseSiblings:!1})))}const mh=()=>{const e=Ge(null),t=r=>{if(!r)return null;const a=r.getAttribute("data-id");if(a!=null)return Ts.peek().get(a)},n=r=>{if(!r)return;const a=t(r);a!=null&&(r.scrollIntoView({behavior:"smooth"}),se.value=a.vNode)},i=r=>{if(!r||r===document.body)return null;const a=r.parentElement,l=a?.nextElementSibling?.querySelector("h2[data-id]");return l||i(a)},s=()=>{const r=document.querySelector("h2[data-id]");n(r)},o=()=>{const r=document.querySelectorAll("h2[data-id]"),a=r.item(r.length-1);a&&n(a)};return $o(["ArrowDown","ArrowUp","ArrowLeft","ArrowRight"],r=>{if(Rt.value&&(Rt.value=null),document.activeElement&&document.activeElement instanceof HTMLInputElement&&document.activeElement!=e.current)return;r.preventDefault();const a=document.querySelector(".selected-vnode");if(a===null){r.key==="ArrowDown"?s():r.key==="ArrowUp"&&o();return}if(r.key==="ArrowRight"){const l=t(a);l&&l.setCollapsed(!1);return}else if(r.key==="ArrowLeft"){const l=t(a);l&&l.setCollapsed(!0);return}if(r.key==="ArrowDown"){const l=a?.nextElementSibling?.querySelector("h2[data-id]");if(l)return n(l);const c=a.parentElement?.nextElementSibling?.querySelector("h2[data-id]");if(c)return n(c);const u=i(a);return u?n(u):s()}else if(r.key==="ArrowUp"){const l=a.parentElement?.previousElementSibling;if(l?.matches("h2[data-id]"))return n(l);const c=l?.querySelectorAll("h2[data-id]");return c?.length!=null&&c?.length>=1?n(c?.item?.(c.length-1)):o()}}),$o("l",r=>{r.ctrlKey&&(r.preventDefault(),e.current?.focus({preventScroll:!1}))}),{searchRef:e}},bh=e=>{eo.value=e.target.value,Rt.value&&(Rt.value=null)};function yh(){const{searchRef:e}=mh(),t=Lt.value;return m("div",{className:"flex-grow p-2 sticky top-0"},m("div",{className:"flex gap-4 pb-2 border-b-2 border-neutral-800 mb-2 items-center"},m("input",{ref:e,className:"bg-[#171616] px-1 py-2 w-full focus:outline focus:outline-primary",placeholder:"Search for component",type:"text",value:eo,oninput:bh})),t?.rootNode&&m(xi,{node:t.rootNode}))}const xh=e=>{const{mouse:t}=ah(),n=J(null),i=J(0),s=J(0),o=Ge(null),r=uh(o),a=Ge(null),[l,c]=Array.isArray(e.children)?e.children:[];return Ks(()=>{a.current&&(s.value=a.current.clientWidth/2)},[a.current]),Oe("mouseup",We(()=>n.value=null,[])),Oe("mousemove",We(u=>{if(n.value==null||a.current==null)return;const f=Math.max(i.value+u.x-n.value.x,250);s.value=Math.min(f,a.current.clientWidth-250)},[])),Oe("resize",We(()=>{a.current!=null&&a.current.clientWidth-250<s.value&&(s.value=Math.max(a.current.clientWidth-250,250))},[])),m("div",{onmousemove:u=>{u.x},ref:a,className:"flex-grow grid gap-2 items-start w-full relative",style:{gridTemplateColumns:\`\${s}px 1fr\`}},m("div",{ref:o,className:"firstContainer w-full h-full"},l),r.width.value!=0&&m("div",{className:"w-8 flex justify-center h-full absolute top-0 -translate-x-1/2 cursor-col-resize z-[9999]",style:{left:\`\${r.width}px\`},onmousedown:u=>{u.preventDefault(),n.value={...t.value},i.value=s.value}},m("div",{className:"dividerLine w-[5px] bg-neutral-800 h-full"})),m("div",{className:"secondContainer h-full"},c))},vh=()=>m("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"lucide lucide-square-mouse-pointer"},m("path",{d:"M12.034 12.681a.498.498 0 0 1 .647-.647l9 3.5a.5.5 0 0 1-.033.943l-3.444 1.068a1 1 0 0 0-.66.66l-1.067 3.443a.5.5 0 0 1-.943.033z"}),m("path",{d:"M21 11V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h6"})),_h=()=>{je.value=!je.value,Ke.send({type:"set-inspect-enabled",value:je.value})};function wh(){const e=Lt.value,t=se.value,n=fe();return ut(()=>{const i=s=>{s===e&&n()};return $?.on("update",i),()=>$?.off("update",i)},[Lt]),ut(()=>{const i=s=>{if(s.data.type!=="select-node")return;if(!window.__devtoolsSelection){console.error("no selection ptr");return}const{app:o,node:r}=window.__devtoolsSelection;window.__devtoolsSelection=null,Lt.value=o,se.value=r,Rt.value=r,je.value=!1};return Ke.addEventListener(i),()=>Ke.removeEventListener(i)},[Lt]),m(kt,null,m("div",{className:"flex items-center justify-between gap-4 p-2 bg-neutral-400 bg-opacity-5 border border-white border-opacity-10 rounded"},m("div",{className:"flex items-center gap-4"},m("select",{className:"px-2 py-1 bg-neutral-800 text-neutral-100 rounded border border-white border-opacity-10",value:e?.name??"",onchange:i=>Lt.value=ie.peek().find(s=>s.name===i.currentTarget.value)??null},m("option",{value:"",disabled:!0},"Select App"),ie.value.map(i=>m("option",{key:i.id,value:i.name},i.name))),m("button",{title:"Toggle Component Inspection",onclick:_h,className:\`p-1 rounded \${je.value?"bg-neutral-900":""}\`},m(vh,null)))),m(xh,null,e&&m(yh,null),t&&e&&m(ih,{selectedApp:e,selectedNode:t,setSelectedNode:i=>se.value=i,kiruGlobal:$})))}const Os=ht({}),ke=ht([]);$?.stores?.subscribe(e=>{Os.value=e,ke.value=ke.value.filter(t=>Object.values(Os.value).includes(t))});const rl=ht(""),Sh=qa(()=>rl.value.toLowerCase().split(" ").filter(e=>e.length>0));function kh(e){return Sh.value.every(t=>e.toLowerCase().includes(t))}function Th(){const e=Object.entries(Os.value);return e.length===0?m("div",{className:"flex flex-col items-center justify-center h-full text-neutral-400"},m(Za,null),m("h2",{className:"text-lg italic"},"No stores detected")):m("div",{className:"flex flex-col gap-2 items-start"},m(sl,{value:rl,className:"sticky top-0"}),m("div",{className:"flex flex-col gap-2 w-full"},e.filter(([t])=>kh(t)).map(([t,n])=>m(Mh,{key:t,name:t,store:n}))))}function Mh({name:e,store:t}){const n=ke.value.includes(t),i=fe(),{value:s}=al(t);Ks(()=>{const r=t.subscribe(()=>i());return()=>r()},[]);const o=We(()=>{n?ke.value=ke.value.filter(r=>r!==t):ke.value=[...ke.value,t]},[n]);return m("div",{className:"flex flex-col"},m("button",{onclick:o,className:"flex items-center gap-2 justify-between p-2 border border-white border-opacity-10 cursor-pointer"+(n?" bg-white bg-opacity-5 text-neutral-100 rounded-t":" hover:bg-white hover:bg-opacity-10 text-neutral-400 rounded")},e,m("div",{className:"flex gap-2"},m(to,{fn:t,onclick:r=>r.stopPropagation()}),m(ae,{className:"transition-all"+(n?" rotate-90":"")}))),n&&m("div",{className:"flex flex-col gap-2 p-2 border border-white border-opacity-10"},m(Ie,{data:{value:s},mutable:!0,objectRefAcc:[],onChange:(r,a)=>{const l=structuredClone({value:s});Zs(l,r,a),t.setState(l.value)}}),m(Eh,{store:t})))}function Eh({store:e}){const t=ie.value;return t.length===0?null:m(kt,null,t.map(n=>m(Oh,{store:e,app:n})))}const Xo=Symbol.for("kiru.hmrAccept"),al=e=>{if(Xo in e)return e[Xo].provide().current;throw new Error("Unable to get store subscribers")};function Oh({store:e,app:t}){const n=fe(),{subscribers:i,nodeStateMap:s}=al(e),o=t.rootNode.child;if(ut(()=>{const a=l=>{l===t&&n()};return $?.on("update",a),()=>$?.off("update",a)},[]),!o)return null;const r=Es(o,a=>i.has(a));return m("div",{className:"flex flex-col gap-2 p-2 rounded-b border border-white border-opacity-10"},m("b",null,t.name),r&&m("ul",{className:"pl-8"},m(Cs,{node:r,nodeStateMap:s})))}function Cs({node:e,nodeStateMap:t}){const[n,i]=de(!1),o=t.get(e.ref)?.slices??[];return m(kt,null,m("li",{className:"flex flex-col gap-2"},m("div",{className:"flex flex-col border border-white border-opacity-10 rounded"+(n?" bg-white bg-opacity-5 text-neutral-100":" hover:bg-white hover:bg-opacity-10 text-neutral-400")},m("button",{onclick:()=>i(!n),className:"flex gap-2 p-2 justify-between cursor-pointer"},m("span",null,"<"+Ga(e.ref)+" />"),m("div",{className:"flex gap-2 items-center"},m(to,{fn:e.ref.type,onclick:r=>r.stopPropagation()}),m(ae,{className:"transition-all"+(n?" rotate-90":"")}))),n&&m("div",{className:"flex flex-col gap-2 p-2 bg-[#1a1a1a]"},o.length===0&&m("div",{className:"p-2 bg-black bg-opacity-30 text-sm"},m("h5",{className:"border-b border-white border-opacity-10"},"No slices")),o.map(r=>m("div",{className:"flex flex-col gap-2"},m("div",{className:"p-2 bg-black bg-opacity-30 text-sm"},m("h5",{className:"border-b border-white border-opacity-10"},"Slice:"),m("pre",{className:"text-neutral-400"},m(Ie,{data:{value:r.value},mutable:!1,objectRefAcc:[],onChange:()=>{}}))),m("div",{className:"p-2 bg-black bg-opacity-30 text-sm"},m("h5",{className:"border-b border-white border-opacity-10"},"SliceFn:"),m("pre",{className:"text-neutral-400"},r.sliceFn?r.sliceFn.toString():"null")),r.eq&&m("div",{className:"p-2 bg-black bg-opacity-30 text-sm"},m("h5",{className:"border-b border-white border-opacity-10"},"eq:"),m("pre",{className:"text-neutral-400"},r.eq.toString())))))),e.child&&m("ul",{className:"pl-8 flex flex-col gap-2"},m(Cs,{node:e.child,nodeStateMap:t}))),e.sibling&&m(Cs,{node:e.sibling,nodeStateMap:t}))}/*!
|
|
1727
1727
|
* @kurkle/color v0.3.4
|
|
1728
1728
|
* https://github.com/kurkle/color#readme
|
|
1729
1729
|
* (c) 2024 Jukka Kurkela
|
|
1730
1730
|
* Released under the MIT License
|
|
1731
|
-
*/function Nn(e){return e+.5|0}const te=(e,t,n)=>Math.max(Math.min(e,n),t);function yn(e){return te(Nn(e*2.55),0,255)}function oe(e){return te(Nn(e*255),0,255)}function $t(e){return te(Nn(e/2.55)/100,0,1)}function
|
|
1731
|
+
*/function Nn(e){return e+.5|0}const te=(e,t,n)=>Math.max(Math.min(e,n),t);function yn(e){return te(Nn(e*2.55),0,255)}function oe(e){return te(Nn(e*255),0,255)}function $t(e){return te(Nn(e/2.55)/100,0,1)}function qo(e){return te(Nn(e*100),0,100)}const bt={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,A:10,B:11,C:12,D:13,E:14,F:15,a:10,b:11,c:12,d:13,e:14,f:15},Ps=[..."0123456789ABCDEF"],Ch=e=>Ps[e&15],Ph=e=>Ps[(e&240)>>4]+Ps[e&15],Gn=e=>(e&240)>>4===(e&15),Dh=e=>Gn(e.r)&&Gn(e.g)&&Gn(e.b)&&Gn(e.a);function Ah(e){var t=e.length,n;return e[0]==="#"&&(t===4||t===5?n={r:255&bt[e[1]]*17,g:255&bt[e[2]]*17,b:255&bt[e[3]]*17,a:t===5?bt[e[4]]*17:255}:(t===7||t===9)&&(n={r:bt[e[1]]<<4|bt[e[2]],g:bt[e[3]]<<4|bt[e[4]],b:bt[e[5]]<<4|bt[e[6]],a:t===9?bt[e[7]]<<4|bt[e[8]]:255})),n}const Ih=(e,t)=>e<255?t(e):"";function Lh(e){var t=Dh(e)?Ch:Ph;return e?"#"+t(e.r)+t(e.g)+t(e.b)+Ih(e.a,t):void 0}const Rh=/^(hsla?|hwb|hsv)\\(\\s*([-+.e\\d]+)(?:deg)?[\\s,]+([-+.e\\d]+)%[\\s,]+([-+.e\\d]+)%(?:[\\s,]+([-+.e\\d]+)(%)?)?\\s*\\)$/;function ll(e,t,n){const i=t*Math.min(n,1-n),s=(o,r=(o+e/30)%12)=>n-i*Math.max(Math.min(r-3,9-r,1),-1);return[s(0),s(8),s(4)]}function Nh(e,t,n){const i=(s,o=(s+e/60)%6)=>n-n*t*Math.max(Math.min(o,4-o,1),0);return[i(5),i(3),i(1)]}function zh(e,t,n){const i=ll(e,1,.5);let s;for(t+n>1&&(s=1/(t+n),t*=s,n*=s),s=0;s<3;s++)i[s]*=1-t-n,i[s]+=t;return i}function Fh(e,t,n,i,s){return e===s?(t-n)/i+(t<n?6:0):t===s?(n-e)/i+2:(e-t)/i+4}function no(e){const n=e.r/255,i=e.g/255,s=e.b/255,o=Math.max(n,i,s),r=Math.min(n,i,s),a=(o+r)/2;let l,c,u;return o!==r&&(u=o-r,c=a>.5?u/(2-o-r):u/(o+r),l=Fh(n,i,s,u,o),l=l*60+.5),[l|0,c||0,a]}function io(e,t,n,i){return(Array.isArray(t)?e(t[0],t[1],t[2]):e(t,n,i)).map(oe)}function so(e,t,n){return io(ll,e,t,n)}function Hh(e,t,n){return io(zh,e,t,n)}function Bh(e,t,n){return io(Nh,e,t,n)}function cl(e){return(e%360+360)%360}function Vh(e){const t=Rh.exec(e);let n=255,i;if(!t)return;t[5]!==i&&(n=t[6]?yn(+t[5]):oe(+t[5]));const s=cl(+t[2]),o=+t[3]/100,r=+t[4]/100;return t[1]==="hwb"?i=Hh(s,o,r):t[1]==="hsv"?i=Bh(s,o,r):i=so(s,o,r),{r:i[0],g:i[1],b:i[2],a:n}}function Wh(e,t){var n=no(e);n[0]=cl(n[0]+t),n=so(n),e.r=n[0],e.g=n[1],e.b=n[2]}function jh(e){if(!e)return;const t=no(e),n=t[0],i=qo(t[1]),s=qo(t[2]);return e.a<255?\`hsla(\${n}, \${i}%, \${s}%, \${$t(e.a)})\`:\`hsl(\${n}, \${i}%, \${s}%)\`}const Go={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"},Ko={OiceXe:"f0f8ff",antiquewEte:"faebd7",aqua:"ffff",aquamarRe:"7fffd4",azuY:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"0",blanKedOmond:"ffebcd",Xe:"ff",XeviTet:"8a2be2",bPwn:"a52a2a",burlywood:"deb887",caMtXe:"5f9ea0",KartYuse:"7fff00",KocTate:"d2691e",cSO:"ff7f50",cSnflowerXe:"6495ed",cSnsilk:"fff8dc",crimson:"dc143c",cyan:"ffff",xXe:"8b",xcyan:"8b8b",xgTMnPd:"b8860b",xWay:"a9a9a9",xgYF:"6400",xgYy:"a9a9a9",xkhaki:"bdb76b",xmagFta:"8b008b",xTivegYF:"556b2f",xSange:"ff8c00",xScEd:"9932cc",xYd:"8b0000",xsOmon:"e9967a",xsHgYF:"8fbc8f",xUXe:"483d8b",xUWay:"2f4f4f",xUgYy:"2f4f4f",xQe:"ced1",xviTet:"9400d3",dAppRk:"ff1493",dApskyXe:"bfff",dimWay:"696969",dimgYy:"696969",dodgerXe:"1e90ff",fiYbrick:"b22222",flSOwEte:"fffaf0",foYstWAn:"228b22",fuKsia:"ff00ff",gaRsbSo:"dcdcdc",ghostwEte:"f8f8ff",gTd:"ffd700",gTMnPd:"daa520",Way:"808080",gYF:"8000",gYFLw:"adff2f",gYy:"808080",honeyMw:"f0fff0",hotpRk:"ff69b4",RdianYd:"cd5c5c",Rdigo:"4b0082",ivSy:"fffff0",khaki:"f0e68c",lavFMr:"e6e6fa",lavFMrXsh:"fff0f5",lawngYF:"7cfc00",NmoncEffon:"fffacd",ZXe:"add8e6",ZcSO:"f08080",Zcyan:"e0ffff",ZgTMnPdLw:"fafad2",ZWay:"d3d3d3",ZgYF:"90ee90",ZgYy:"d3d3d3",ZpRk:"ffb6c1",ZsOmon:"ffa07a",ZsHgYF:"20b2aa",ZskyXe:"87cefa",ZUWay:"778899",ZUgYy:"778899",ZstAlXe:"b0c4de",ZLw:"ffffe0",lime:"ff00",limegYF:"32cd32",lRF:"faf0e6",magFta:"ff00ff",maPon:"800000",VaquamarRe:"66cdaa",VXe:"cd",VScEd:"ba55d3",VpurpN:"9370db",VsHgYF:"3cb371",VUXe:"7b68ee",VsprRggYF:"fa9a",VQe:"48d1cc",VviTetYd:"c71585",midnightXe:"191970",mRtcYam:"f5fffa",mistyPse:"ffe4e1",moccasR:"ffe4b5",navajowEte:"ffdead",navy:"80",Tdlace:"fdf5e6",Tive:"808000",TivedBb:"6b8e23",Sange:"ffa500",SangeYd:"ff4500",ScEd:"da70d6",pOegTMnPd:"eee8aa",pOegYF:"98fb98",pOeQe:"afeeee",pOeviTetYd:"db7093",papayawEp:"ffefd5",pHKpuff:"ffdab9",peru:"cd853f",pRk:"ffc0cb",plum:"dda0dd",powMrXe:"b0e0e6",purpN:"800080",YbeccapurpN:"663399",Yd:"ff0000",Psybrown:"bc8f8f",PyOXe:"4169e1",saddNbPwn:"8b4513",sOmon:"fa8072",sandybPwn:"f4a460",sHgYF:"2e8b57",sHshell:"fff5ee",siFna:"a0522d",silver:"c0c0c0",skyXe:"87ceeb",UXe:"6a5acd",UWay:"708090",UgYy:"708090",snow:"fffafa",sprRggYF:"ff7f",stAlXe:"4682b4",tan:"d2b48c",teO:"8080",tEstN:"d8bfd8",tomato:"ff6347",Qe:"40e0d0",viTet:"ee82ee",JHt:"f5deb3",wEte:"ffffff",wEtesmoke:"f5f5f5",Lw:"ffff00",LwgYF:"9acd32"};function Uh(){const e={},t=Object.keys(Ko),n=Object.keys(Go);let i,s,o,r,a;for(i=0;i<t.length;i++){for(r=a=t[i],s=0;s<n.length;s++)o=n[s],a=a.replace(o,Go[o]);o=parseInt(Ko[r],16),e[a]=[o>>16&255,o>>8&255,o&255]}return e}let Kn;function $h(e){Kn||(Kn=Uh(),Kn.transparent=[0,0,0,0]);const t=Kn[e.toLowerCase()];return t&&{r:t[0],g:t[1],b:t[2],a:t.length===4?t[3]:255}}const Yh=/^rgba?\\(\\s*([-+.\\d]+)(%)?[\\s,]+([-+.e\\d]+)(%)?[\\s,]+([-+.e\\d]+)(%)?(?:[\\s,/]+([-+.e\\d]+)(%)?)?\\s*\\)$/;function Xh(e){const t=Yh.exec(e);let n=255,i,s,o;if(t){if(t[7]!==i){const r=+t[7];n=t[8]?yn(r):te(r*255,0,255)}return i=+t[1],s=+t[3],o=+t[5],i=255&(t[2]?yn(i):te(i,0,255)),s=255&(t[4]?yn(s):te(s,0,255)),o=255&(t[6]?yn(o):te(o,0,255)),{r:i,g:s,b:o,a:n}}}function qh(e){return e&&(e.a<255?\`rgba(\${e.r}, \${e.g}, \${e.b}, \${$t(e.a)})\`:\`rgb(\${e.r}, \${e.g}, \${e.b})\`)}const Ki=e=>e<=.0031308?e*12.92:Math.pow(e,1/2.4)*1.055-.055,He=e=>e<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4);function Gh(e,t,n){const i=He($t(e.r)),s=He($t(e.g)),o=He($t(e.b));return{r:oe(Ki(i+n*(He($t(t.r))-i))),g:oe(Ki(s+n*(He($t(t.g))-s))),b:oe(Ki(o+n*(He($t(t.b))-o))),a:e.a+n*(t.a-e.a)}}function Zn(e,t,n){if(e){let i=no(e);i[t]=Math.max(0,Math.min(i[t]+i[t]*n,t===0?360:1)),i=so(i),e.r=i[0],e.g=i[1],e.b=i[2]}}function ul(e,t){return e&&Object.assign(t||{},e)}function Zo(e){var t={r:0,g:0,b:0,a:255};return Array.isArray(e)?e.length>=3&&(t={r:e[0],g:e[1],b:e[2],a:255},e.length>3&&(t.a=oe(e[3]))):(t=ul(e,{r:0,g:0,b:0,a:1}),t.a=oe(t.a)),t}function Kh(e){return e.charAt(0)==="r"?Xh(e):Vh(e)}class Dn{constructor(t){if(t instanceof Dn)return t;const n=typeof t;let i;n==="object"?i=Zo(t):n==="string"&&(i=Ah(t)||$h(t)||Kh(t)),this._rgb=i,this._valid=!!i}get valid(){return this._valid}get rgb(){var t=ul(this._rgb);return t&&(t.a=$t(t.a)),t}set rgb(t){this._rgb=Zo(t)}rgbString(){return this._valid?qh(this._rgb):void 0}hexString(){return this._valid?Lh(this._rgb):void 0}hslString(){return this._valid?jh(this._rgb):void 0}mix(t,n){if(t){const i=this.rgb,s=t.rgb;let o;const r=n===o?.5:n,a=2*r-1,l=i.a-s.a,c=((a*l===-1?a:(a+l)/(1+a*l))+1)/2;o=1-c,i.r=255&c*i.r+o*s.r+.5,i.g=255&c*i.g+o*s.g+.5,i.b=255&c*i.b+o*s.b+.5,i.a=r*i.a+(1-r)*s.a,this.rgb=i}return this}interpolate(t,n){return t&&(this._rgb=Gh(this._rgb,t._rgb,n)),this}clone(){return new Dn(this.rgb)}alpha(t){return this._rgb.a=oe(t),this}clearer(t){const n=this._rgb;return n.a*=1-t,this}greyscale(){const t=this._rgb,n=Nn(t.r*.3+t.g*.59+t.b*.11);return t.r=t.g=t.b=n,this}opaquer(t){const n=this._rgb;return n.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 Zn(this._rgb,2,t),this}darken(t){return Zn(this._rgb,2,-t),this}saturate(t){return Zn(this._rgb,1,t),this}desaturate(t){return Zn(this._rgb,1,-t),this}rotate(t){return Wh(this._rgb,t),this}}/*!
|
|
1732
1732
|
* Chart.js v4.5.0
|
|
1733
1733
|
* https://www.chartjs.org
|
|
1734
1734
|
* (c) 2025 Chart.js Contributors
|
|
1735
1735
|
* Released under the MIT License
|
|
1736
|
-
*/function Wt(){}const Kh=(()=>{let e=0;return()=>e++})();function V(e){return e==null}function Q(e){if(Array.isArray&&Array.isArray(e))return!0;const t=Object.prototype.toString.call(e);return t.slice(0,7)==="[object"&&t.slice(-6)==="Array]"}function B(e){return e!==null&&Object.prototype.toString.call(e)==="[object Object]"}function xt(e){return(typeof e=="number"||e instanceof Number)&&isFinite(+e)}function Pt(e,t){return xt(e)?e:t}function R(e,t){return typeof e>"u"?t:e}const Zh=(e,t)=>typeof e=="string"&&e.endsWith("%")?parseFloat(e)/100*t:+e;function I(e,t,n){if(e&&typeof e.call=="function")return e.apply(n,t)}function z(e,t,n,i){let s,o,r;if(Q(e))for(o=e.length,s=0;s<o;s++)t.call(n,e[s],s);else if(B(e))for(r=Object.keys(e),o=r.length,s=0;s<o;s++)t.call(n,e[r[s]],r[s])}function vi(e,t){let n,i,s,o;if(!e||!t||e.length!==t.length)return!1;for(n=0,i=e.length;n<i;++n)if(s=e[n],o=t[n],s.datasetIndex!==o.datasetIndex||s.index!==o.index)return!1;return!0}function _i(e){if(Q(e))return e.map(_i);if(B(e)){const t=Object.create(null),n=Object.keys(e),i=n.length;let s=0;for(;s<i;++s)t[n[s]]=_i(e[n[s]]);return t}return e}function ul(e){return["__proto__","prototype","constructor"].indexOf(e)===-1}function Qh(e,t,n,i){if(!ul(e))return;const s=t[e],o=n[e];B(s)&&B(o)?An(s,o,i):t[e]=_i(o)}function An(e,t,n){const i=Q(t)?t:[t],s=i.length;if(!B(e))return e;n=n||{};const o=n.merger||Qh;let r;for(let a=0;a<s;++a){if(r=i[a],!B(r))continue;const l=Object.keys(r);for(let c=0,u=l.length;c<u;++c)o(l[c],e,r,n)}return e}function wn(e,t){return An(e,t,{merger:Jh})}function Jh(e,t,n){if(!ul(e))return;const i=t[e],s=n[e];B(i)&&B(s)?wn(i,s):Object.prototype.hasOwnProperty.call(t,e)||(t[e]=_i(s))}const Zo={"":e=>e,x:e=>e.x,y:e=>e.y};function tf(e){const t=e.split("."),n=[];let i="";for(const s of t)i+=s,i.endsWith("\\\\")?i=i.slice(0,-1)+".":(n.push(i),i="");return n}function ef(e){const t=tf(e);return n=>{for(const i of t){if(i==="")break;n=n&&n[i]}return n}}function wi(e,t){return(Zo[t]||(Zo[t]=ef(t)))(e)}function oo(e){return e.charAt(0).toUpperCase()+e.slice(1)}const Si=e=>typeof e<"u",le=e=>typeof e=="function",Qo=(e,t)=>{if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0};function nf(e){return e.type==="mouseup"||e.type==="click"||e.type==="contextmenu"}const tt=Math.PI,zt=2*tt,sf=zt+tt,ki=Number.POSITIVE_INFINITY,of=tt/180,wt=tt/2,ve=tt/4,Jo=tt*2/3,hl=Math.log10,ce=Math.sign;function Oe(e,t,n){return Math.abs(e-t)<n}function tr(e){const t=Math.round(e);e=Oe(e,t,e/1e3)?t:e;const n=Math.pow(10,Math.floor(hl(e))),i=e/n;return(i<=1?1:i<=2?2:i<=5?5:10)*n}function rf(e){const t=[],n=Math.sqrt(e);let i;for(i=1;i<n;i++)e%i===0&&(t.push(i),t.push(e/i));return n===(n|0)&&t.push(n),t.sort((s,o)=>s-o).pop(),t}function af(e){return typeof e=="symbol"||typeof e=="object"&&e!==null&&!(Symbol.toPrimitive in e||"toString"in e||"valueOf"in e)}function In(e){return!af(e)&&!isNaN(parseFloat(e))&&isFinite(e)}function lf(e,t){const n=Math.round(e);return n-t<=e&&n+t>=e}function cf(e,t,n){let i,s,o;for(i=0,s=e.length;i<s;i++)o=e[i][n],isNaN(o)||(t.min=Math.min(t.min,o),t.max=Math.max(t.max,o))}function Me(e){return e*(tt/180)}function uf(e){return e*(180/tt)}function er(e){if(!xt(e))return;let t=1,n=0;for(;Math.round(e*t)/t!==e;)t*=10,n++;return n}function hf(e,t){const n=t.x-e.x,i=t.y-e.y,s=Math.sqrt(n*n+i*i);let o=Math.atan2(i,n);return o<-.5*tt&&(o+=zt),{angle:o,distance:s}}function Ds(e,t){return Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))}function ff(e,t){return(e-t+sf)%zt-tt}function Qt(e){return(e%zt+zt)%zt}function fl(e,t,n,i){const s=Qt(e),o=Qt(t),r=Qt(n),a=Qt(o-s),l=Qt(r-s),c=Qt(s-o),u=Qt(s-r);return s===o||s===r||i&&o===r||a>l&&c<u}function yt(e,t,n){return Math.max(t,Math.min(n,e))}function df(e){return yt(e,-32768,32767)}function xn(e,t,n,i=1e-6){return e>=Math.min(t,n)-i&&e<=Math.max(t,n)+i}function ro(e,t,n){n=n||(r=>e[r]<t);let i=e.length-1,s=0,o;for(;i-s>1;)o=s+i>>1,n(o)?s=o:i=o;return{lo:s,hi:i}}const Ee=(e,t,n,i)=>ro(e,n,i?s=>{const o=e[s][t];return o<n||o===n&&e[s+1][t]===n}:s=>e[s][t]<n),pf=(e,t,n)=>ro(e,n,i=>e[i][t]>=n);function gf(e,t,n){let i=0,s=e.length;for(;i<s&&e[i]<t;)i++;for(;s>i&&e[s-1]>n;)s--;return i>0||s<e.length?e.slice(i,s):e}const dl=["push","pop","shift","splice","unshift"];function mf(e,t){if(e._chartjs){e._chartjs.listeners.push(t);return}Object.defineProperty(e,"_chartjs",{configurable:!0,enumerable:!1,value:{listeners:[t]}}),dl.forEach(n=>{const i="_onData"+oo(n),s=e[n];Object.defineProperty(e,n,{configurable:!0,enumerable:!1,value(...o){const r=s.apply(this,o);return e._chartjs.listeners.forEach(a=>{typeof a[i]=="function"&&a[i](...o)}),r}})})}function nr(e,t){const n=e._chartjs;if(!n)return;const i=n.listeners,s=i.indexOf(t);s!==-1&&i.splice(s,1),!(i.length>0)&&(dl.forEach(o=>{delete e[o]}),delete e._chartjs)}function bf(e){const t=new Set(e);return t.size===e.length?e:Array.from(t)}const pl=(function(){return typeof window>"u"?function(e){return e()}:window.requestAnimationFrame})();function gl(e,t){let n=[],i=!1;return function(...s){n=s,i||(i=!0,pl.call(window,()=>{i=!1,e.apply(t,n)}))}}function yf(e,t){let n;return function(...i){return t?(clearTimeout(n),n=setTimeout(e,t,i)):e.apply(this,i),t}}const ml=e=>e==="start"?"left":e==="end"?"right":"center",ft=(e,t,n)=>e==="start"?t:e==="end"?n:(t+n)/2,xf=(e,t,n,i)=>e===(i?"left":"right")?n:e==="center"?(t+n)/2:t;function vf(e,t,n){const i=t.length;let s=0,o=i;if(e._sorted){const{iScale:r,vScale:a,_parsed:l}=e,c=e.dataset&&e.dataset.options?e.dataset.options.spanGaps:null,u=r.axis,{min:f,max:p,minDefined:g,maxDefined:x}=r.getUserBounds();if(g){if(s=Math.min(Ee(l,u,f).lo,n?i:Ee(t,u,r.getPixelForValue(f)).lo),c){const y=l.slice(0,s+1).reverse().findIndex(v=>!V(v[a.axis]));s-=Math.max(0,y)}s=yt(s,0,i-1)}if(x){let y=Math.max(Ee(l,r.axis,p,!0).hi+1,n?0:Ee(t,u,r.getPixelForValue(p),!0).hi+1);if(c){const v=l.slice(y-1).findIndex(w=>!V(w[a.axis]));y+=Math.max(0,v)}o=yt(y,s,i)-s}else o=i-s}return{start:s,count:o}}function _f(e){const{xScale:t,yScale:n,_scaleRanges:i}=e,s={xmin:t.min,xmax:t.max,ymin:n.min,ymax:n.max};if(!i)return e._scaleRanges=s,!0;const o=i.xmin!==t.min||i.xmax!==t.max||i.ymin!==n.min||i.ymax!==n.max;return Object.assign(i,s),o}const Qn=e=>e===0||e===1,ir=(e,t,n)=>-(Math.pow(2,10*(e-=1))*Math.sin((e-t)*zt/n)),sr=(e,t,n)=>Math.pow(2,-10*e)*Math.sin((e-t)*zt/n)+1,Sn={linear:e=>e,easeInQuad:e=>e*e,easeOutQuad:e=>-e*(e-2),easeInOutQuad:e=>(e/=.5)<1?.5*e*e:-.5*(--e*(e-2)-1),easeInCubic:e=>e*e*e,easeOutCubic:e=>(e-=1)*e*e+1,easeInOutCubic:e=>(e/=.5)<1?.5*e*e*e:.5*((e-=2)*e*e+2),easeInQuart:e=>e*e*e*e,easeOutQuart:e=>-((e-=1)*e*e*e-1),easeInOutQuart:e=>(e/=.5)<1?.5*e*e*e*e:-.5*((e-=2)*e*e*e-2),easeInQuint:e=>e*e*e*e*e,easeOutQuint:e=>(e-=1)*e*e*e*e+1,easeInOutQuint:e=>(e/=.5)<1?.5*e*e*e*e*e:.5*((e-=2)*e*e*e*e+2),easeInSine:e=>-Math.cos(e*wt)+1,easeOutSine:e=>Math.sin(e*wt),easeInOutSine:e=>-.5*(Math.cos(tt*e)-1),easeInExpo:e=>e===0?0:Math.pow(2,10*(e-1)),easeOutExpo:e=>e===1?1:-Math.pow(2,-10*e)+1,easeInOutExpo:e=>Qn(e)?e:e<.5?.5*Math.pow(2,10*(e*2-1)):.5*(-Math.pow(2,-10*(e*2-1))+2),easeInCirc:e=>e>=1?e:-(Math.sqrt(1-e*e)-1),easeOutCirc:e=>Math.sqrt(1-(e-=1)*e),easeInOutCirc:e=>(e/=.5)<1?-.5*(Math.sqrt(1-e*e)-1):.5*(Math.sqrt(1-(e-=2)*e)+1),easeInElastic:e=>Qn(e)?e:ir(e,.075,.3),easeOutElastic:e=>Qn(e)?e:sr(e,.075,.3),easeInOutElastic(e){return Qn(e)?e:e<.5?.5*ir(e*2,.1125,.45):.5+.5*sr(e*2-1,.1125,.45)},easeInBack(e){return e*e*((1.70158+1)*e-1.70158)},easeOutBack(e){return(e-=1)*e*((1.70158+1)*e+1.70158)+1},easeInOutBack(e){let t=1.70158;return(e/=.5)<1?.5*(e*e*(((t*=1.525)+1)*e-t)):.5*((e-=2)*e*(((t*=1.525)+1)*e+t)+2)},easeInBounce:e=>1-Sn.easeOutBounce(1-e),easeOutBounce(e){return e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375},easeInOutBounce:e=>e<.5?Sn.easeInBounce(e*2)*.5:Sn.easeOutBounce(e*2-1)*.5+.5};function ao(e){if(e&&typeof e=="object"){const t=e.toString();return t==="[object CanvasPattern]"||t==="[object CanvasGradient]"}return!1}function or(e){return ao(e)?e:new Dn(e)}function Zi(e){return ao(e)?e:new Dn(e).saturate(.5).darken(.1).hexString()}const wf=["x","y","borderWidth","radius","tension"],Sf=["color","borderColor","backgroundColor"];function kf(e){e.set("animation",{delay:void 0,duration:1e3,easing:"easeOutQuart",fn:void 0,from:void 0,loop:void 0,to:void 0,type:void 0}),e.describe("animation",{_fallback:!1,_indexable:!1,_scriptable:t=>t!=="onProgress"&&t!=="onComplete"&&t!=="fn"}),e.set("animations",{colors:{type:"color",properties:Sf},numbers:{type:"number",properties:wf}}),e.describe("animations",{_fallback:"animation"}),e.set("transitions",{active:{animation:{duration:400}},resize:{animation:{duration:0}},show:{animations:{colors:{from:"transparent"},visible:{type:"boolean",duration:0}}},hide:{animations:{colors:{to:"transparent"},visible:{type:"boolean",easing:"linear",fn:t=>t|0}}}})}function Tf(e){e.set("layout",{autoPadding:!0,padding:{top:0,right:0,bottom:0,left:0}})}const rr=new Map;function Mf(e,t){t=t||{};const n=e+JSON.stringify(t);let i=rr.get(n);return i||(i=new Intl.NumberFormat(e,t),rr.set(n,i)),i}function bl(e,t,n){return Mf(t,n).format(e)}const Ef={values(e){return Q(e)?e:""+e},numeric(e,t,n){if(e===0)return"0";const i=this.chart.options.locale;let s,o=e;if(n.length>1){const c=Math.max(Math.abs(n[0].value),Math.abs(n[n.length-1].value));(c<1e-4||c>1e15)&&(s="scientific"),o=Cf(e,n)}const r=hl(Math.abs(o)),a=isNaN(r)?1:Math.max(Math.min(-1*Math.floor(r),20),0),l={notation:s,minimumFractionDigits:a,maximumFractionDigits:a};return Object.assign(l,this.options.ticks.format),bl(e,i,l)}};function Cf(e,t){let n=t.length>3?t[2].value-t[1].value:t[1].value-t[0].value;return Math.abs(n)>=1&&e!==Math.floor(e)&&(n=e-Math.floor(e)),n}var yl={formatters:Ef};function Of(e){e.set("scale",{display:!0,offset:!1,reverse:!1,beginAtZero:!1,bounds:"ticks",clip:!0,grace:0,grid:{display:!0,lineWidth:1,drawOnChartArea:!0,drawTicks:!0,tickLength:8,tickWidth:(t,n)=>n.lineWidth,tickColor:(t,n)=>n.color,offset:!1},border:{display:!0,dash:[],dashOffset:0,width:1},title:{display:!1,text:"",padding:{top:4,bottom:4}},ticks:{minRotation:0,maxRotation:50,mirror:!1,textStrokeWidth:0,textStrokeColor:"",padding:3,display:!0,autoSkip:!0,autoSkipPadding:3,labelOffset:0,callback:yl.formatters.values,minor:{},major:{},align:"center",crossAlign:"near",showLabelBackdrop:!1,backdropColor:"rgba(255, 255, 255, 0.75)",backdropPadding:2}}),e.route("scale.ticks","color","","color"),e.route("scale.grid","color","","borderColor"),e.route("scale.border","color","","borderColor"),e.route("scale.title","color","","color"),e.describe("scale",{_fallback:!1,_scriptable:t=>!t.startsWith("before")&&!t.startsWith("after")&&t!=="callback"&&t!=="parser",_indexable:t=>t!=="borderDash"&&t!=="tickBorderDash"&&t!=="dash"}),e.describe("scales",{_fallback:"scale"}),e.describe("scale.ticks",{_scriptable:t=>t!=="backdropPadding"&&t!=="callback",_indexable:t=>t!=="backdropPadding"})}const Ae=Object.create(null),As=Object.create(null);function kn(e,t){if(!t)return e;const n=t.split(".");for(let i=0,s=n.length;i<s;++i){const o=n[i];e=e[o]||(e[o]=Object.create(null))}return e}function Qi(e,t,n){return typeof t=="string"?An(kn(e,t),n):An(kn(e,""),t)}class Pf{constructor(t,n){this.animation=void 0,this.backgroundColor="rgba(0,0,0,0.1)",this.borderColor="rgba(0,0,0,0.1)",this.color="#666",this.datasets={},this.devicePixelRatio=i=>i.chart.platform.getDevicePixelRatio(),this.elements={},this.events=["mousemove","mouseout","click","touchstart","touchmove"],this.font={family:"'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",size:12,style:"normal",lineHeight:1.2,weight:null},this.hover={},this.hoverBackgroundColor=(i,s)=>Zi(s.backgroundColor),this.hoverBorderColor=(i,s)=>Zi(s.borderColor),this.hoverColor=(i,s)=>Zi(s.color),this.indexAxis="x",this.interaction={mode:"nearest",intersect:!0,includeInvisible:!1},this.maintainAspectRatio=!0,this.onHover=null,this.onClick=null,this.parsing=!0,this.plugins={},this.responsive=!0,this.scale=void 0,this.scales={},this.showLine=!0,this.drawActiveElementsOnTop=!0,this.describe(t),this.apply(n)}set(t,n){return Qi(this,t,n)}get(t){return kn(this,t)}describe(t,n){return Qi(As,t,n)}override(t,n){return Qi(Ae,t,n)}route(t,n,i,s){const o=kn(this,t),r=kn(this,i),a="_"+n;Object.defineProperties(o,{[a]:{value:o[n],writable:!0},[n]:{enumerable:!0,get(){const l=this[a],c=r[s];return B(l)?Object.assign({},c,l):R(l,c)},set(l){this[a]=l}}})}apply(t){t.forEach(n=>n(this))}}var Y=new Pf({_scriptable:e=>!e.startsWith("on"),_indexable:e=>e!=="events",hover:{_fallback:"interaction"},interaction:{_scriptable:!1,_indexable:!1}},[kf,Tf,Of]);function Df(e){return!e||V(e.size)||V(e.family)?null:(e.style?e.style+" ":"")+(e.weight?e.weight+" ":"")+e.size+"px "+e.family}function ar(e,t,n,i,s){let o=t[s];return o||(o=t[s]=e.measureText(s).width,n.push(s)),o>i&&(i=o),i}function _e(e,t,n){const i=e.currentDevicePixelRatio,s=n!==0?Math.max(n/2,.5):0;return Math.round((t-s)*i)/i+s}function lr(e,t){!t&&!e||(t=t||e.getContext("2d"),t.save(),t.resetTransform(),t.clearRect(0,0,e.width,e.height),t.restore())}function Is(e,t,n,i){xl(e,t,n,i,null)}function xl(e,t,n,i,s){let o,r,a,l,c,u,f,p;const g=t.pointStyle,x=t.rotation,y=t.radius;let v=(x||0)*of;if(g&&typeof g=="object"&&(o=g.toString(),o==="[object HTMLImageElement]"||o==="[object HTMLCanvasElement]")){e.save(),e.translate(n,i),e.rotate(v),e.drawImage(g,-g.width/2,-g.height/2,g.width,g.height),e.restore();return}if(!(isNaN(y)||y<=0)){switch(e.beginPath(),g){default:s?e.ellipse(n,i,s/2,y,0,0,zt):e.arc(n,i,y,0,zt),e.closePath();break;case"triangle":u=s?s/2:y,e.moveTo(n+Math.sin(v)*u,i-Math.cos(v)*y),v+=Jo,e.lineTo(n+Math.sin(v)*u,i-Math.cos(v)*y),v+=Jo,e.lineTo(n+Math.sin(v)*u,i-Math.cos(v)*y),e.closePath();break;case"rectRounded":c=y*.516,l=y-c,r=Math.cos(v+ve)*l,f=Math.cos(v+ve)*(s?s/2-c:l),a=Math.sin(v+ve)*l,p=Math.sin(v+ve)*(s?s/2-c:l),e.arc(n-f,i-a,c,v-tt,v-wt),e.arc(n+p,i-r,c,v-wt,v),e.arc(n+f,i+a,c,v,v+wt),e.arc(n-p,i+r,c,v+wt,v+tt),e.closePath();break;case"rect":if(!x){l=Math.SQRT1_2*y,u=s?s/2:l,e.rect(n-u,i-l,2*u,2*l);break}v+=ve;case"rectRot":f=Math.cos(v)*(s?s/2:y),r=Math.cos(v)*y,a=Math.sin(v)*y,p=Math.sin(v)*(s?s/2:y),e.moveTo(n-f,i-a),e.lineTo(n+p,i-r),e.lineTo(n+f,i+a),e.lineTo(n-p,i+r),e.closePath();break;case"crossRot":v+=ve;case"cross":f=Math.cos(v)*(s?s/2:y),r=Math.cos(v)*y,a=Math.sin(v)*y,p=Math.sin(v)*(s?s/2:y),e.moveTo(n-f,i-a),e.lineTo(n+f,i+a),e.moveTo(n+p,i-r),e.lineTo(n-p,i+r);break;case"star":f=Math.cos(v)*(s?s/2:y),r=Math.cos(v)*y,a=Math.sin(v)*y,p=Math.sin(v)*(s?s/2:y),e.moveTo(n-f,i-a),e.lineTo(n+f,i+a),e.moveTo(n+p,i-r),e.lineTo(n-p,i+r),v+=ve,f=Math.cos(v)*(s?s/2:y),r=Math.cos(v)*y,a=Math.sin(v)*y,p=Math.sin(v)*(s?s/2:y),e.moveTo(n-f,i-a),e.lineTo(n+f,i+a),e.moveTo(n+p,i-r),e.lineTo(n-p,i+r);break;case"line":r=s?s/2:Math.cos(v)*y,a=Math.sin(v)*y,e.moveTo(n-r,i-a),e.lineTo(n+r,i+a);break;case"dash":e.moveTo(n,i),e.lineTo(n+Math.cos(v)*(s?s/2:y),i+Math.sin(v)*y);break;case!1:e.closePath();break}e.fill(),t.borderWidth>0&&e.stroke()}}function Ze(e,t,n){return n=n||.5,!t||e&&e.x>t.left-n&&e.x<t.right+n&&e.y>t.top-n&&e.y<t.bottom+n}function lo(e,t){e.save(),e.beginPath(),e.rect(t.left,t.top,t.right-t.left,t.bottom-t.top),e.clip()}function co(e){e.restore()}function Af(e,t,n,i,s){if(!t)return e.lineTo(n.x,n.y);if(s==="middle"){const o=(t.x+n.x)/2;e.lineTo(o,t.y),e.lineTo(o,n.y)}else s==="after"!=!!i?e.lineTo(t.x,n.y):e.lineTo(n.x,t.y);e.lineTo(n.x,n.y)}function If(e,t,n,i){if(!t)return e.lineTo(n.x,n.y);e.bezierCurveTo(i?t.cp1x:t.cp2x,i?t.cp1y:t.cp2y,i?n.cp2x:n.cp1x,i?n.cp2y:n.cp1y,n.x,n.y)}function Lf(e,t){t.translation&&e.translate(t.translation[0],t.translation[1]),V(t.rotation)||e.rotate(t.rotation),t.color&&(e.fillStyle=t.color),t.textAlign&&(e.textAlign=t.textAlign),t.textBaseline&&(e.textBaseline=t.textBaseline)}function Rf(e,t,n,i,s){if(s.strikethrough||s.underline){const o=e.measureText(i),r=t-o.actualBoundingBoxLeft,a=t+o.actualBoundingBoxRight,l=n-o.actualBoundingBoxAscent,c=n+o.actualBoundingBoxDescent,u=s.strikethrough?(l+c)/2:c;e.strokeStyle=e.fillStyle,e.beginPath(),e.lineWidth=s.decorationWidth||2,e.moveTo(r,u),e.lineTo(a,u),e.stroke()}}function Nf(e,t){const n=e.fillStyle;e.fillStyle=t.color,e.fillRect(t.left,t.top,t.width,t.height),e.fillStyle=n}function Ti(e,t,n,i,s,o={}){const r=Q(t)?t:[t],a=o.strokeWidth>0&&o.strokeColor!=="";let l,c;for(e.save(),e.font=s.string,Lf(e,o),l=0;l<r.length;++l)c=r[l],o.backdrop&&Nf(e,o.backdrop),a&&(o.strokeColor&&(e.strokeStyle=o.strokeColor),V(o.strokeWidth)||(e.lineWidth=o.strokeWidth),e.strokeText(c,n,i,o.maxWidth)),e.fillText(c,n,i,o.maxWidth),Rf(e,n,i,c,o),i+=Number(s.lineHeight);e.restore()}function Ls(e,t){const{x:n,y:i,w:s,h:o,radius:r}=t;e.arc(n+r.topLeft,i+r.topLeft,r.topLeft,1.5*tt,tt,!0),e.lineTo(n,i+o-r.bottomLeft),e.arc(n+r.bottomLeft,i+o-r.bottomLeft,r.bottomLeft,tt,wt,!0),e.lineTo(n+s-r.bottomRight,i+o),e.arc(n+s-r.bottomRight,i+o-r.bottomRight,r.bottomRight,wt,0,!0),e.lineTo(n+s,i+r.topRight),e.arc(n+s-r.topRight,i+r.topRight,r.topRight,0,-wt,!0),e.lineTo(n+r.topLeft,i)}const zf=/^(normal|(\\d+(?:\\.\\d+)?)(px|em|%)?)$/,Ff=/^(normal|italic|initial|inherit|unset|(oblique( -?[0-9]?[0-9]deg)?))$/;function Hf(e,t){const n=(""+e).match(zf);if(!n||n[1]==="normal")return t*1.2;switch(e=+n[2],n[3]){case"px":return e;case"%":e/=100;break}return t*e}const Bf=e=>+e||0;function vl(e,t){const n={},i=B(t),s=i?Object.keys(t):t,o=B(e)?i?r=>R(e[r],e[t[r]]):r=>e[r]:()=>e;for(const r of s)n[r]=Bf(o(r));return n}function Vf(e){return vl(e,{top:"y",right:"x",bottom:"y",left:"x"})}function Tn(e){return vl(e,["topLeft","topRight","bottomLeft","bottomRight"])}function Mt(e){const t=Vf(e);return t.width=t.left+t.right,t.height=t.top+t.bottom,t}function ct(e,t){e=e||{},t=t||Y.font;let n=R(e.size,t.size);typeof n=="string"&&(n=parseInt(n,10));let i=R(e.style,t.style);i&&!(""+i).match(Ff)&&(console.warn('Invalid font style specified: "'+i+'"'),i=void 0);const s={family:R(e.family,t.family),lineHeight:Hf(R(e.lineHeight,t.lineHeight),n),size:n,style:i,weight:R(e.weight,t.weight),string:""};return s.string=Df(s),s}function Jn(e,t,n,i){let s,o,r;for(s=0,o=e.length;s<o;++s)if(r=e[s],r!==void 0&&r!==void 0)return r}function Wf(e,t,n){const{min:i,max:s}=e,o=Zh(t,(s-i)/2),r=(a,l)=>n&&a===0?0:a+l;return{min:r(i,-Math.abs(o)),max:r(s,o)}}function Le(e,t){return Object.assign(Object.create(e),t)}function uo(e,t=[""],n,i,s=()=>e[0]){const o=n||e;typeof i>"u"&&(i=kl("_fallback",e));const r={[Symbol.toStringTag]:"Object",_cacheable:!0,_scopes:e,_rootScopes:o,_fallback:i,_getTarget:s,override:a=>uo([a,...e],t,o,i)};return new Proxy(r,{deleteProperty(a,l){return delete a[l],delete a._keys,delete e[0][l],!0},get(a,l){return wl(a,l,()=>Kf(l,t,e,a))},getOwnPropertyDescriptor(a,l){return Reflect.getOwnPropertyDescriptor(a._scopes[0],l)},getPrototypeOf(){return Reflect.getPrototypeOf(e[0])},has(a,l){return ur(a).includes(l)},ownKeys(a){return ur(a)},set(a,l,c){const u=a._storage||(a._storage=s());return a[l]=u[l]=c,delete a._keys,!0}})}function Qe(e,t,n,i){const s={_cacheable:!1,_proxy:e,_context:t,_subProxy:n,_stack:new Set,_descriptors:_l(e,i),setContext:o=>Qe(e,o,n,i),override:o=>Qe(e.override(o),t,n,i)};return new Proxy(s,{deleteProperty(o,r){return delete o[r],delete e[r],!0},get(o,r,a){return wl(o,r,()=>Uf(o,r,a))},getOwnPropertyDescriptor(o,r){return o._descriptors.allKeys?Reflect.has(e,r)?{enumerable:!0,configurable:!0}:void 0:Reflect.getOwnPropertyDescriptor(e,r)},getPrototypeOf(){return Reflect.getPrototypeOf(e)},has(o,r){return Reflect.has(e,r)},ownKeys(){return Reflect.ownKeys(e)},set(o,r,a){return e[r]=a,delete o[r],!0}})}function _l(e,t={scriptable:!0,indexable:!0}){const{_scriptable:n=t.scriptable,_indexable:i=t.indexable,_allKeys:s=t.allKeys}=e;return{allKeys:s,scriptable:n,indexable:i,isScriptable:le(n)?n:()=>n,isIndexable:le(i)?i:()=>i}}const jf=(e,t)=>e?e+oo(t):t,ho=(e,t)=>B(t)&&e!=="adapters"&&(Object.getPrototypeOf(t)===null||t.constructor===Object);function wl(e,t,n){if(Object.prototype.hasOwnProperty.call(e,t)||t==="constructor")return e[t];const i=n();return e[t]=i,i}function Uf(e,t,n){const{_proxy:i,_context:s,_subProxy:o,_descriptors:r}=e;let a=i[t];return le(a)&&r.isScriptable(t)&&(a=$f(t,a,e,n)),Q(a)&&a.length&&(a=Yf(t,a,e,r.isIndexable)),ho(t,a)&&(a=Qe(a,s,o&&o[t],r)),a}function $f(e,t,n,i){const{_proxy:s,_context:o,_subProxy:r,_stack:a}=n;if(a.has(e))throw new Error("Recursion detected: "+Array.from(a).join("->")+"->"+e);a.add(e);let l=t(o,r||i);return a.delete(e),ho(e,l)&&(l=fo(s._scopes,s,e,l)),l}function Yf(e,t,n,i){const{_proxy:s,_context:o,_subProxy:r,_descriptors:a}=n;if(typeof o.index<"u"&&i(e))return t[o.index%t.length];if(B(t[0])){const l=t,c=s._scopes.filter(u=>u!==l);t=[];for(const u of l){const f=fo(c,s,e,u);t.push(Qe(f,o,r&&r[e],a))}}return t}function Sl(e,t,n){return le(e)?e(t,n):e}const Xf=(e,t)=>e===!0?t:typeof e=="string"?wi(t,e):void 0;function qf(e,t,n,i,s){for(const o of t){const r=Xf(n,o);if(r){e.add(r);const a=Sl(r._fallback,n,s);if(typeof a<"u"&&a!==n&&a!==i)return a}else if(r===!1&&typeof i<"u"&&n!==i)return null}return!1}function fo(e,t,n,i){const s=t._rootScopes,o=Sl(t._fallback,n,i),r=[...e,...s],a=new Set;a.add(i);let l=cr(a,r,n,o||n,i);return l===null||typeof o<"u"&&o!==n&&(l=cr(a,r,o,l,i),l===null)?!1:uo(Array.from(a),[""],s,o,()=>Gf(t,n,i))}function cr(e,t,n,i,s){for(;n;)n=qf(e,t,n,i,s);return n}function Gf(e,t,n){const i=e._getTarget();t in i||(i[t]={});const s=i[t];return Q(s)&&B(n)?n:s||{}}function Kf(e,t,n,i){let s;for(const o of t)if(s=kl(jf(o,e),n),typeof s<"u")return ho(e,s)?fo(n,i,e,s):s}function kl(e,t){for(const n of t){if(!n)continue;const i=n[e];if(typeof i<"u")return i}}function ur(e){let t=e._keys;return t||(t=e._keys=Zf(e._scopes)),t}function Zf(e){const t=new Set;for(const n of e)for(const i of Object.keys(n).filter(s=>!s.startsWith("_")))t.add(i);return Array.from(t)}const Qf=Number.EPSILON||1e-14,Je=(e,t)=>t<e.length&&!e[t].skip&&e[t],Tl=e=>e==="x"?"y":"x";function Jf(e,t,n,i){const s=e.skip?t:e,o=t,r=n.skip?t:n,a=Ds(o,s),l=Ds(r,o);let c=a/(a+l),u=l/(a+l);c=isNaN(c)?0:c,u=isNaN(u)?0:u;const f=i*c,p=i*u;return{previous:{x:o.x-f*(r.x-s.x),y:o.y-f*(r.y-s.y)},next:{x:o.x+p*(r.x-s.x),y:o.y+p*(r.y-s.y)}}}function td(e,t,n){const i=e.length;let s,o,r,a,l,c=Je(e,0);for(let u=0;u<i-1;++u)if(l=c,c=Je(e,u+1),!(!l||!c)){if(Oe(t[u],0,Qf)){n[u]=n[u+1]=0;continue}s=n[u]/t[u],o=n[u+1]/t[u],a=Math.pow(s,2)+Math.pow(o,2),!(a<=9)&&(r=3/Math.sqrt(a),n[u]=s*r*t[u],n[u+1]=o*r*t[u])}}function ed(e,t,n="x"){const i=Tl(n),s=e.length;let o,r,a,l=Je(e,0);for(let c=0;c<s;++c){if(r=a,a=l,l=Je(e,c+1),!a)continue;const u=a[n],f=a[i];r&&(o=(u-r[n])/3,a[\`cp1\${n}\`]=u-o,a[\`cp1\${i}\`]=f-o*t[c]),l&&(o=(l[n]-u)/3,a[\`cp2\${n}\`]=u+o,a[\`cp2\${i}\`]=f+o*t[c])}}function nd(e,t="x"){const n=Tl(t),i=e.length,s=Array(i).fill(0),o=Array(i);let r,a,l,c=Je(e,0);for(r=0;r<i;++r)if(a=l,l=c,c=Je(e,r+1),!!l){if(c){const u=c[t]-l[t];s[r]=u!==0?(c[n]-l[n])/u:0}o[r]=a?c?ce(s[r-1])!==ce(s[r])?0:(s[r-1]+s[r])/2:s[r-1]:s[r]}td(e,s,o),ed(e,o,t)}function ti(e,t,n){return Math.max(Math.min(e,n),t)}function id(e,t){let n,i,s,o,r,a=Ze(e[0],t);for(n=0,i=e.length;n<i;++n)r=o,o=a,a=n<i-1&&Ze(e[n+1],t),o&&(s=e[n],r&&(s.cp1x=ti(s.cp1x,t.left,t.right),s.cp1y=ti(s.cp1y,t.top,t.bottom)),a&&(s.cp2x=ti(s.cp2x,t.left,t.right),s.cp2y=ti(s.cp2y,t.top,t.bottom)))}function sd(e,t,n,i,s){let o,r,a,l;if(t.spanGaps&&(e=e.filter(c=>!c.skip)),t.cubicInterpolationMode==="monotone")nd(e,s);else{let c=i?e[e.length-1]:e[0];for(o=0,r=e.length;o<r;++o)a=e[o],l=Jf(c,a,e[Math.min(o+1,r-(i?0:1))%r],t.tension),a.cp1x=l.previous.x,a.cp1y=l.previous.y,a.cp2x=l.next.x,a.cp2y=l.next.y,c=a}t.capBezierPoints&&id(e,n)}function po(){return typeof window<"u"&&typeof document<"u"}function go(e){let t=e.parentNode;return t&&t.toString()==="[object ShadowRoot]"&&(t=t.host),t}function Mi(e,t,n){let i;return typeof e=="string"?(i=parseInt(e,10),e.indexOf("%")!==-1&&(i=i/100*t.parentNode[n])):i=e,i}const Ri=e=>e.ownerDocument.defaultView.getComputedStyle(e,null);function od(e,t){return Ri(e).getPropertyValue(t)}const rd=["top","right","bottom","left"];function Pe(e,t,n){const i={};n=n?"-"+n:"";for(let s=0;s<4;s++){const o=rd[s];i[o]=parseFloat(e[t+"-"+o+n])||0}return i.width=i.left+i.right,i.height=i.top+i.bottom,i}const ad=(e,t,n)=>(e>0||t>0)&&(!n||!n.shadowRoot);function ld(e,t){const n=e.touches,i=n&&n.length?n[0]:e,{offsetX:s,offsetY:o}=i;let r=!1,a,l;if(ad(s,o,e.target))a=s,l=o;else{const c=t.getBoundingClientRect();a=i.clientX-c.left,l=i.clientY-c.top,r=!0}return{x:a,y:l,box:r}}function It(e,t){if("native"in e)return e;const{canvas:n,currentDevicePixelRatio:i}=t,s=Ri(n),o=s.boxSizing==="border-box",r=Pe(s,"padding"),a=Pe(s,"border","width"),{x:l,y:c,box:u}=ld(e,n),f=r.left+(u&&a.left),p=r.top+(u&&a.top);let{width:g,height:x}=t;return o&&(g-=r.width+a.width,x-=r.height+a.height),{x:Math.round((l-f)/g*n.width/i),y:Math.round((c-p)/x*n.height/i)}}function cd(e,t,n){let i,s;if(t===void 0||n===void 0){const o=e&&go(e);if(!o)t=e.clientWidth,n=e.clientHeight;else{const r=o.getBoundingClientRect(),a=Ri(o),l=Pe(a,"border","width"),c=Pe(a,"padding");t=r.width-c.width-l.width,n=r.height-c.height-l.height,i=Mi(a.maxWidth,o,"clientWidth"),s=Mi(a.maxHeight,o,"clientHeight")}}return{width:t,height:n,maxWidth:i||ki,maxHeight:s||ki}}const ei=e=>Math.round(e*10)/10;function ud(e,t,n,i){const s=Ri(e),o=Pe(s,"margin"),r=Mi(s.maxWidth,e,"clientWidth")||ki,a=Mi(s.maxHeight,e,"clientHeight")||ki,l=cd(e,t,n);let{width:c,height:u}=l;if(s.boxSizing==="content-box"){const p=Pe(s,"border","width"),g=Pe(s,"padding");c-=g.width+p.width,u-=g.height+p.height}return c=Math.max(0,c-o.width),u=Math.max(0,i?c/i:u-o.height),c=ei(Math.min(c,r,l.maxWidth)),u=ei(Math.min(u,a,l.maxHeight)),c&&!u&&(u=ei(c/2)),(t!==void 0||n!==void 0)&&i&&l.height&&u>l.height&&(u=l.height,c=ei(Math.floor(u*i))),{width:c,height:u}}function hr(e,t,n){const i=t||1,s=Math.floor(e.height*i),o=Math.floor(e.width*i);e.height=Math.floor(e.height),e.width=Math.floor(e.width);const r=e.canvas;return r.style&&(n||!r.style.height&&!r.style.width)&&(r.style.height=\`\${e.height}px\`,r.style.width=\`\${e.width}px\`),e.currentDevicePixelRatio!==i||r.height!==s||r.width!==o?(e.currentDevicePixelRatio=i,r.height=s,r.width=o,e.ctx.setTransform(i,0,0,i,0,0),!0):!1}const hd=(function(){let e=!1;try{const t={get passive(){return e=!0,!1}};po()&&(window.addEventListener("test",null,t),window.removeEventListener("test",null,t))}catch{}return e})();function fr(e,t){const n=od(e,t),i=n&&n.match(/^(\\d+)(\\.\\d+)?px$/);return i?+i[1]:void 0}function Se(e,t,n,i){return{x:e.x+n*(t.x-e.x),y:e.y+n*(t.y-e.y)}}function fd(e,t,n,i){return{x:e.x+n*(t.x-e.x),y:i==="middle"?n<.5?e.y:t.y:i==="after"?n<1?e.y:t.y:n>0?t.y:e.y}}function dd(e,t,n,i){const s={x:e.cp2x,y:e.cp2y},o={x:t.cp1x,y:t.cp1y},r=Se(e,s,n),a=Se(s,o,n),l=Se(o,t,n),c=Se(r,a,n),u=Se(a,l,n);return Se(c,u,n)}const pd=function(e,t){return{x(n){return e+e+t-n},setWidth(n){t=n},textAlign(n){return n==="center"?n:n==="right"?"left":"right"},xPlus(n,i){return n-i},leftForLtr(n,i){return n-i}}},gd=function(){return{x(e){return e},setWidth(e){},textAlign(e){return e},xPlus(e,t){return e+t},leftForLtr(e,t){return e}}};function Ue(e,t,n){return e?pd(t,n):gd()}function Ml(e,t){let n,i;(t==="ltr"||t==="rtl")&&(n=e.canvas.style,i=[n.getPropertyValue("direction"),n.getPropertyPriority("direction")],n.setProperty("direction",t,"important"),e.prevTextDirection=i)}function El(e,t){t!==void 0&&(delete e.prevTextDirection,e.canvas.style.setProperty("direction",t[0],t[1]))}function Cl(e){return e==="angle"?{between:fl,compare:ff,normalize:Qt}:{between:xn,compare:(t,n)=>t-n,normalize:t=>t}}function dr({start:e,end:t,count:n,loop:i,style:s}){return{start:e%n,end:t%n,loop:i&&(t-e+1)%n===0,style:s}}function md(e,t,n){const{property:i,start:s,end:o}=n,{between:r,normalize:a}=Cl(i),l=t.length;let{start:c,end:u,loop:f}=e,p,g;if(f){for(c+=l,u+=l,p=0,g=l;p<g&&r(a(t[c%l][i]),s,o);++p)c--,u--;c%=l,u%=l}return u<c&&(u+=l),{start:c,end:u,loop:f,style:e.style}}function bd(e,t,n){if(!n)return[e];const{property:i,start:s,end:o}=n,r=t.length,{compare:a,between:l,normalize:c}=Cl(i),{start:u,end:f,loop:p,style:g}=md(e,t,n),x=[];let y=!1,v=null,w,k,C;const O=()=>l(s,C,w)&&a(s,C)!==0,T=()=>a(o,w)===0||l(o,C,w),D=()=>y||O(),P=()=>!y||T();for(let E=u,A=u;E<=f;++E)k=t[E%r],!k.skip&&(w=c(k[i]),w!==C&&(y=l(w,s,o),v===null&&D()&&(v=a(w,s)===0?E:A),v!==null&&P()&&(x.push(dr({start:v,end:E,loop:p,count:r,style:g})),v=null),A=E,C=w));return v!==null&&x.push(dr({start:v,end:f,loop:p,count:r,style:g})),x}function yd(e,t){const n=[],i=e.segments;for(let s=0;s<i.length;s++){const o=bd(i[s],e.points,t);o.length&&n.push(...o)}return n}function xd(e,t,n,i){let s=0,o=t-1;if(n&&!i)for(;s<t&&!e[s].skip;)s++;for(;s<t&&e[s].skip;)s++;for(s%=t,n&&(o+=s);o>s&&e[o%t].skip;)o--;return o%=t,{start:s,end:o}}function vd(e,t,n,i){const s=e.length,o=[];let r=t,a=e[t],l;for(l=t+1;l<=n;++l){const c=e[l%s];c.skip||c.stop?a.skip||(i=!1,o.push({start:t%s,end:(l-1)%s,loop:i}),t=r=c.stop?l:null):(r=l,a.skip&&(t=l)),a=c}return r!==null&&o.push({start:t%s,end:r%s,loop:i}),o}function _d(e,t){const n=e.points,i=e.options.spanGaps,s=n.length;if(!s)return[];const o=!!e._loop,{start:r,end:a}=xd(n,s,o,i);if(i===!0)return pr(e,[{start:r,end:a,loop:o}],n,t);const l=a<r?a+s:a,c=!!e._fullLoop&&r===0&&a===s-1;return pr(e,vd(n,r,l,c),n,t)}function pr(e,t,n,i){return!i||!i.setContext||!n?t:wd(e,t,n,i)}function wd(e,t,n,i){const s=e._chart.getContext(),o=gr(e.options),{_datasetIndex:r,options:{spanGaps:a}}=e,l=n.length,c=[];let u=o,f=t[0].start,p=f;function g(x,y,v,w){const k=a?-1:1;if(x!==y){for(x+=l;n[x%l].skip;)x-=k;for(;n[y%l].skip;)y+=k;x%l!==y%l&&(c.push({start:x%l,end:y%l,loop:v,style:w}),u=w,f=y%l)}}for(const x of t){f=a?f:x.start;let y=n[f%l],v;for(p=f+1;p<=x.end;p++){const w=n[p%l];v=gr(i.setContext(Le(s,{type:"segment",p0:y,p1:w,p0DataIndex:(p-1)%l,p1DataIndex:p%l,datasetIndex:r}))),Sd(v,u)&&g(f,p-1,x.loop,u),y=w,u=v}f<p-1&&g(f,p-1,x.loop,u)}return c}function gr(e){return{backgroundColor:e.backgroundColor,borderCapStyle:e.borderCapStyle,borderDash:e.borderDash,borderDashOffset:e.borderDashOffset,borderJoinStyle:e.borderJoinStyle,borderWidth:e.borderWidth,borderColor:e.borderColor}}function Sd(e,t){if(!t)return!1;const n=[],i=function(s,o){return ao(o)?(n.includes(o)||n.push(o),n.indexOf(o)):o};return JSON.stringify(e,i)!==JSON.stringify(t,i)}function ni(e,t,n){return e.options.clip?e[n]:t[n]}function kd(e,t){const{xScale:n,yScale:i}=e;return n&&i?{left:ni(n,t,"left"),right:ni(n,t,"right"),top:ni(i,t,"top"),bottom:ni(i,t,"bottom")}:t}function Td(e,t){const n=t._clip;if(n.disabled)return!1;const i=kd(t,e.chartArea);return{left:n.left===!1?0:i.left-(n.left===!0?0:n.left),right:n.right===!1?e.width:i.right+(n.right===!0?0:n.right),top:n.top===!1?0:i.top-(n.top===!0?0:n.top),bottom:n.bottom===!1?e.height:i.bottom+(n.bottom===!0?0:n.bottom)}}/*!
|
|
1736
|
+
*/function Wt(){}const Zh=(()=>{let e=0;return()=>e++})();function V(e){return e==null}function Q(e){if(Array.isArray&&Array.isArray(e))return!0;const t=Object.prototype.toString.call(e);return t.slice(0,7)==="[object"&&t.slice(-6)==="Array]"}function B(e){return e!==null&&Object.prototype.toString.call(e)==="[object Object]"}function xt(e){return(typeof e=="number"||e instanceof Number)&&isFinite(+e)}function Pt(e,t){return xt(e)?e:t}function R(e,t){return typeof e>"u"?t:e}const Qh=(e,t)=>typeof e=="string"&&e.endsWith("%")?parseFloat(e)/100*t:+e;function I(e,t,n){if(e&&typeof e.call=="function")return e.apply(n,t)}function z(e,t,n,i){let s,o,r;if(Q(e))for(o=e.length,s=0;s<o;s++)t.call(n,e[s],s);else if(B(e))for(r=Object.keys(e),o=r.length,s=0;s<o;s++)t.call(n,e[r[s]],r[s])}function vi(e,t){let n,i,s,o;if(!e||!t||e.length!==t.length)return!1;for(n=0,i=e.length;n<i;++n)if(s=e[n],o=t[n],s.datasetIndex!==o.datasetIndex||s.index!==o.index)return!1;return!0}function _i(e){if(Q(e))return e.map(_i);if(B(e)){const t=Object.create(null),n=Object.keys(e),i=n.length;let s=0;for(;s<i;++s)t[n[s]]=_i(e[n[s]]);return t}return e}function hl(e){return["__proto__","prototype","constructor"].indexOf(e)===-1}function Jh(e,t,n,i){if(!hl(e))return;const s=t[e],o=n[e];B(s)&&B(o)?An(s,o,i):t[e]=_i(o)}function An(e,t,n){const i=Q(t)?t:[t],s=i.length;if(!B(e))return e;n=n||{};const o=n.merger||Jh;let r;for(let a=0;a<s;++a){if(r=i[a],!B(r))continue;const l=Object.keys(r);for(let c=0,u=l.length;c<u;++c)o(l[c],e,r,n)}return e}function wn(e,t){return An(e,t,{merger:tf})}function tf(e,t,n){if(!hl(e))return;const i=t[e],s=n[e];B(i)&&B(s)?wn(i,s):Object.prototype.hasOwnProperty.call(t,e)||(t[e]=_i(s))}const Qo={"":e=>e,x:e=>e.x,y:e=>e.y};function ef(e){const t=e.split("."),n=[];let i="";for(const s of t)i+=s,i.endsWith("\\\\")?i=i.slice(0,-1)+".":(n.push(i),i="");return n}function nf(e){const t=ef(e);return n=>{for(const i of t){if(i==="")break;n=n&&n[i]}return n}}function wi(e,t){return(Qo[t]||(Qo[t]=nf(t)))(e)}function oo(e){return e.charAt(0).toUpperCase()+e.slice(1)}const Si=e=>typeof e<"u",le=e=>typeof e=="function",Jo=(e,t)=>{if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0};function sf(e){return e.type==="mouseup"||e.type==="click"||e.type==="contextmenu"}const tt=Math.PI,zt=2*tt,of=zt+tt,ki=Number.POSITIVE_INFINITY,rf=tt/180,wt=tt/2,ve=tt/4,tr=tt*2/3,fl=Math.log10,ce=Math.sign;function Ce(e,t,n){return Math.abs(e-t)<n}function er(e){const t=Math.round(e);e=Ce(e,t,e/1e3)?t:e;const n=Math.pow(10,Math.floor(fl(e))),i=e/n;return(i<=1?1:i<=2?2:i<=5?5:10)*n}function af(e){const t=[],n=Math.sqrt(e);let i;for(i=1;i<n;i++)e%i===0&&(t.push(i),t.push(e/i));return n===(n|0)&&t.push(n),t.sort((s,o)=>s-o).pop(),t}function lf(e){return typeof e=="symbol"||typeof e=="object"&&e!==null&&!(Symbol.toPrimitive in e||"toString"in e||"valueOf"in e)}function In(e){return!lf(e)&&!isNaN(parseFloat(e))&&isFinite(e)}function cf(e,t){const n=Math.round(e);return n-t<=e&&n+t>=e}function uf(e,t,n){let i,s,o;for(i=0,s=e.length;i<s;i++)o=e[i][n],isNaN(o)||(t.min=Math.min(t.min,o),t.max=Math.max(t.max,o))}function Me(e){return e*(tt/180)}function hf(e){return e*(180/tt)}function nr(e){if(!xt(e))return;let t=1,n=0;for(;Math.round(e*t)/t!==e;)t*=10,n++;return n}function ff(e,t){const n=t.x-e.x,i=t.y-e.y,s=Math.sqrt(n*n+i*i);let o=Math.atan2(i,n);return o<-.5*tt&&(o+=zt),{angle:o,distance:s}}function Ds(e,t){return Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))}function df(e,t){return(e-t+of)%zt-tt}function Qt(e){return(e%zt+zt)%zt}function dl(e,t,n,i){const s=Qt(e),o=Qt(t),r=Qt(n),a=Qt(o-s),l=Qt(r-s),c=Qt(s-o),u=Qt(s-r);return s===o||s===r||i&&o===r||a>l&&c<u}function yt(e,t,n){return Math.max(t,Math.min(n,e))}function pf(e){return yt(e,-32768,32767)}function xn(e,t,n,i=1e-6){return e>=Math.min(t,n)-i&&e<=Math.max(t,n)+i}function ro(e,t,n){n=n||(r=>e[r]<t);let i=e.length-1,s=0,o;for(;i-s>1;)o=s+i>>1,n(o)?s=o:i=o;return{lo:s,hi:i}}const Ee=(e,t,n,i)=>ro(e,n,i?s=>{const o=e[s][t];return o<n||o===n&&e[s+1][t]===n}:s=>e[s][t]<n),gf=(e,t,n)=>ro(e,n,i=>e[i][t]>=n);function mf(e,t,n){let i=0,s=e.length;for(;i<s&&e[i]<t;)i++;for(;s>i&&e[s-1]>n;)s--;return i>0||s<e.length?e.slice(i,s):e}const pl=["push","pop","shift","splice","unshift"];function bf(e,t){if(e._chartjs){e._chartjs.listeners.push(t);return}Object.defineProperty(e,"_chartjs",{configurable:!0,enumerable:!1,value:{listeners:[t]}}),pl.forEach(n=>{const i="_onData"+oo(n),s=e[n];Object.defineProperty(e,n,{configurable:!0,enumerable:!1,value(...o){const r=s.apply(this,o);return e._chartjs.listeners.forEach(a=>{typeof a[i]=="function"&&a[i](...o)}),r}})})}function ir(e,t){const n=e._chartjs;if(!n)return;const i=n.listeners,s=i.indexOf(t);s!==-1&&i.splice(s,1),!(i.length>0)&&(pl.forEach(o=>{delete e[o]}),delete e._chartjs)}function yf(e){const t=new Set(e);return t.size===e.length?e:Array.from(t)}const gl=(function(){return typeof window>"u"?function(e){return e()}:window.requestAnimationFrame})();function ml(e,t){let n=[],i=!1;return function(...s){n=s,i||(i=!0,gl.call(window,()=>{i=!1,e.apply(t,n)}))}}function xf(e,t){let n;return function(...i){return t?(clearTimeout(n),n=setTimeout(e,t,i)):e.apply(this,i),t}}const bl=e=>e==="start"?"left":e==="end"?"right":"center",ft=(e,t,n)=>e==="start"?t:e==="end"?n:(t+n)/2,vf=(e,t,n,i)=>e===(i?"left":"right")?n:e==="center"?(t+n)/2:t;function _f(e,t,n){const i=t.length;let s=0,o=i;if(e._sorted){const{iScale:r,vScale:a,_parsed:l}=e,c=e.dataset&&e.dataset.options?e.dataset.options.spanGaps:null,u=r.axis,{min:f,max:p,minDefined:g,maxDefined:x}=r.getUserBounds();if(g){if(s=Math.min(Ee(l,u,f).lo,n?i:Ee(t,u,r.getPixelForValue(f)).lo),c){const y=l.slice(0,s+1).reverse().findIndex(v=>!V(v[a.axis]));s-=Math.max(0,y)}s=yt(s,0,i-1)}if(x){let y=Math.max(Ee(l,r.axis,p,!0).hi+1,n?0:Ee(t,u,r.getPixelForValue(p),!0).hi+1);if(c){const v=l.slice(y-1).findIndex(w=>!V(w[a.axis]));y+=Math.max(0,v)}o=yt(y,s,i)-s}else o=i-s}return{start:s,count:o}}function wf(e){const{xScale:t,yScale:n,_scaleRanges:i}=e,s={xmin:t.min,xmax:t.max,ymin:n.min,ymax:n.max};if(!i)return e._scaleRanges=s,!0;const o=i.xmin!==t.min||i.xmax!==t.max||i.ymin!==n.min||i.ymax!==n.max;return Object.assign(i,s),o}const Qn=e=>e===0||e===1,sr=(e,t,n)=>-(Math.pow(2,10*(e-=1))*Math.sin((e-t)*zt/n)),or=(e,t,n)=>Math.pow(2,-10*e)*Math.sin((e-t)*zt/n)+1,Sn={linear:e=>e,easeInQuad:e=>e*e,easeOutQuad:e=>-e*(e-2),easeInOutQuad:e=>(e/=.5)<1?.5*e*e:-.5*(--e*(e-2)-1),easeInCubic:e=>e*e*e,easeOutCubic:e=>(e-=1)*e*e+1,easeInOutCubic:e=>(e/=.5)<1?.5*e*e*e:.5*((e-=2)*e*e+2),easeInQuart:e=>e*e*e*e,easeOutQuart:e=>-((e-=1)*e*e*e-1),easeInOutQuart:e=>(e/=.5)<1?.5*e*e*e*e:-.5*((e-=2)*e*e*e-2),easeInQuint:e=>e*e*e*e*e,easeOutQuint:e=>(e-=1)*e*e*e*e+1,easeInOutQuint:e=>(e/=.5)<1?.5*e*e*e*e*e:.5*((e-=2)*e*e*e*e+2),easeInSine:e=>-Math.cos(e*wt)+1,easeOutSine:e=>Math.sin(e*wt),easeInOutSine:e=>-.5*(Math.cos(tt*e)-1),easeInExpo:e=>e===0?0:Math.pow(2,10*(e-1)),easeOutExpo:e=>e===1?1:-Math.pow(2,-10*e)+1,easeInOutExpo:e=>Qn(e)?e:e<.5?.5*Math.pow(2,10*(e*2-1)):.5*(-Math.pow(2,-10*(e*2-1))+2),easeInCirc:e=>e>=1?e:-(Math.sqrt(1-e*e)-1),easeOutCirc:e=>Math.sqrt(1-(e-=1)*e),easeInOutCirc:e=>(e/=.5)<1?-.5*(Math.sqrt(1-e*e)-1):.5*(Math.sqrt(1-(e-=2)*e)+1),easeInElastic:e=>Qn(e)?e:sr(e,.075,.3),easeOutElastic:e=>Qn(e)?e:or(e,.075,.3),easeInOutElastic(e){return Qn(e)?e:e<.5?.5*sr(e*2,.1125,.45):.5+.5*or(e*2-1,.1125,.45)},easeInBack(e){return e*e*((1.70158+1)*e-1.70158)},easeOutBack(e){return(e-=1)*e*((1.70158+1)*e+1.70158)+1},easeInOutBack(e){let t=1.70158;return(e/=.5)<1?.5*(e*e*(((t*=1.525)+1)*e-t)):.5*((e-=2)*e*(((t*=1.525)+1)*e+t)+2)},easeInBounce:e=>1-Sn.easeOutBounce(1-e),easeOutBounce(e){return e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375},easeInOutBounce:e=>e<.5?Sn.easeInBounce(e*2)*.5:Sn.easeOutBounce(e*2-1)*.5+.5};function ao(e){if(e&&typeof e=="object"){const t=e.toString();return t==="[object CanvasPattern]"||t==="[object CanvasGradient]"}return!1}function rr(e){return ao(e)?e:new Dn(e)}function Zi(e){return ao(e)?e:new Dn(e).saturate(.5).darken(.1).hexString()}const Sf=["x","y","borderWidth","radius","tension"],kf=["color","borderColor","backgroundColor"];function Tf(e){e.set("animation",{delay:void 0,duration:1e3,easing:"easeOutQuart",fn:void 0,from:void 0,loop:void 0,to:void 0,type:void 0}),e.describe("animation",{_fallback:!1,_indexable:!1,_scriptable:t=>t!=="onProgress"&&t!=="onComplete"&&t!=="fn"}),e.set("animations",{colors:{type:"color",properties:kf},numbers:{type:"number",properties:Sf}}),e.describe("animations",{_fallback:"animation"}),e.set("transitions",{active:{animation:{duration:400}},resize:{animation:{duration:0}},show:{animations:{colors:{from:"transparent"},visible:{type:"boolean",duration:0}}},hide:{animations:{colors:{to:"transparent"},visible:{type:"boolean",easing:"linear",fn:t=>t|0}}}})}function Mf(e){e.set("layout",{autoPadding:!0,padding:{top:0,right:0,bottom:0,left:0}})}const ar=new Map;function Ef(e,t){t=t||{};const n=e+JSON.stringify(t);let i=ar.get(n);return i||(i=new Intl.NumberFormat(e,t),ar.set(n,i)),i}function yl(e,t,n){return Ef(t,n).format(e)}const Of={values(e){return Q(e)?e:""+e},numeric(e,t,n){if(e===0)return"0";const i=this.chart.options.locale;let s,o=e;if(n.length>1){const c=Math.max(Math.abs(n[0].value),Math.abs(n[n.length-1].value));(c<1e-4||c>1e15)&&(s="scientific"),o=Cf(e,n)}const r=fl(Math.abs(o)),a=isNaN(r)?1:Math.max(Math.min(-1*Math.floor(r),20),0),l={notation:s,minimumFractionDigits:a,maximumFractionDigits:a};return Object.assign(l,this.options.ticks.format),yl(e,i,l)}};function Cf(e,t){let n=t.length>3?t[2].value-t[1].value:t[1].value-t[0].value;return Math.abs(n)>=1&&e!==Math.floor(e)&&(n=e-Math.floor(e)),n}var xl={formatters:Of};function Pf(e){e.set("scale",{display:!0,offset:!1,reverse:!1,beginAtZero:!1,bounds:"ticks",clip:!0,grace:0,grid:{display:!0,lineWidth:1,drawOnChartArea:!0,drawTicks:!0,tickLength:8,tickWidth:(t,n)=>n.lineWidth,tickColor:(t,n)=>n.color,offset:!1},border:{display:!0,dash:[],dashOffset:0,width:1},title:{display:!1,text:"",padding:{top:4,bottom:4}},ticks:{minRotation:0,maxRotation:50,mirror:!1,textStrokeWidth:0,textStrokeColor:"",padding:3,display:!0,autoSkip:!0,autoSkipPadding:3,labelOffset:0,callback:xl.formatters.values,minor:{},major:{},align:"center",crossAlign:"near",showLabelBackdrop:!1,backdropColor:"rgba(255, 255, 255, 0.75)",backdropPadding:2}}),e.route("scale.ticks","color","","color"),e.route("scale.grid","color","","borderColor"),e.route("scale.border","color","","borderColor"),e.route("scale.title","color","","color"),e.describe("scale",{_fallback:!1,_scriptable:t=>!t.startsWith("before")&&!t.startsWith("after")&&t!=="callback"&&t!=="parser",_indexable:t=>t!=="borderDash"&&t!=="tickBorderDash"&&t!=="dash"}),e.describe("scales",{_fallback:"scale"}),e.describe("scale.ticks",{_scriptable:t=>t!=="backdropPadding"&&t!=="callback",_indexable:t=>t!=="backdropPadding"})}const Ae=Object.create(null),As=Object.create(null);function kn(e,t){if(!t)return e;const n=t.split(".");for(let i=0,s=n.length;i<s;++i){const o=n[i];e=e[o]||(e[o]=Object.create(null))}return e}function Qi(e,t,n){return typeof t=="string"?An(kn(e,t),n):An(kn(e,""),t)}class Df{constructor(t,n){this.animation=void 0,this.backgroundColor="rgba(0,0,0,0.1)",this.borderColor="rgba(0,0,0,0.1)",this.color="#666",this.datasets={},this.devicePixelRatio=i=>i.chart.platform.getDevicePixelRatio(),this.elements={},this.events=["mousemove","mouseout","click","touchstart","touchmove"],this.font={family:"'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",size:12,style:"normal",lineHeight:1.2,weight:null},this.hover={},this.hoverBackgroundColor=(i,s)=>Zi(s.backgroundColor),this.hoverBorderColor=(i,s)=>Zi(s.borderColor),this.hoverColor=(i,s)=>Zi(s.color),this.indexAxis="x",this.interaction={mode:"nearest",intersect:!0,includeInvisible:!1},this.maintainAspectRatio=!0,this.onHover=null,this.onClick=null,this.parsing=!0,this.plugins={},this.responsive=!0,this.scale=void 0,this.scales={},this.showLine=!0,this.drawActiveElementsOnTop=!0,this.describe(t),this.apply(n)}set(t,n){return Qi(this,t,n)}get(t){return kn(this,t)}describe(t,n){return Qi(As,t,n)}override(t,n){return Qi(Ae,t,n)}route(t,n,i,s){const o=kn(this,t),r=kn(this,i),a="_"+n;Object.defineProperties(o,{[a]:{value:o[n],writable:!0},[n]:{enumerable:!0,get(){const l=this[a],c=r[s];return B(l)?Object.assign({},c,l):R(l,c)},set(l){this[a]=l}}})}apply(t){t.forEach(n=>n(this))}}var Y=new Df({_scriptable:e=>!e.startsWith("on"),_indexable:e=>e!=="events",hover:{_fallback:"interaction"},interaction:{_scriptable:!1,_indexable:!1}},[Tf,Mf,Pf]);function Af(e){return!e||V(e.size)||V(e.family)?null:(e.style?e.style+" ":"")+(e.weight?e.weight+" ":"")+e.size+"px "+e.family}function lr(e,t,n,i,s){let o=t[s];return o||(o=t[s]=e.measureText(s).width,n.push(s)),o>i&&(i=o),i}function _e(e,t,n){const i=e.currentDevicePixelRatio,s=n!==0?Math.max(n/2,.5):0;return Math.round((t-s)*i)/i+s}function cr(e,t){!t&&!e||(t=t||e.getContext("2d"),t.save(),t.resetTransform(),t.clearRect(0,0,e.width,e.height),t.restore())}function Is(e,t,n,i){vl(e,t,n,i,null)}function vl(e,t,n,i,s){let o,r,a,l,c,u,f,p;const g=t.pointStyle,x=t.rotation,y=t.radius;let v=(x||0)*rf;if(g&&typeof g=="object"&&(o=g.toString(),o==="[object HTMLImageElement]"||o==="[object HTMLCanvasElement]")){e.save(),e.translate(n,i),e.rotate(v),e.drawImage(g,-g.width/2,-g.height/2,g.width,g.height),e.restore();return}if(!(isNaN(y)||y<=0)){switch(e.beginPath(),g){default:s?e.ellipse(n,i,s/2,y,0,0,zt):e.arc(n,i,y,0,zt),e.closePath();break;case"triangle":u=s?s/2:y,e.moveTo(n+Math.sin(v)*u,i-Math.cos(v)*y),v+=tr,e.lineTo(n+Math.sin(v)*u,i-Math.cos(v)*y),v+=tr,e.lineTo(n+Math.sin(v)*u,i-Math.cos(v)*y),e.closePath();break;case"rectRounded":c=y*.516,l=y-c,r=Math.cos(v+ve)*l,f=Math.cos(v+ve)*(s?s/2-c:l),a=Math.sin(v+ve)*l,p=Math.sin(v+ve)*(s?s/2-c:l),e.arc(n-f,i-a,c,v-tt,v-wt),e.arc(n+p,i-r,c,v-wt,v),e.arc(n+f,i+a,c,v,v+wt),e.arc(n-p,i+r,c,v+wt,v+tt),e.closePath();break;case"rect":if(!x){l=Math.SQRT1_2*y,u=s?s/2:l,e.rect(n-u,i-l,2*u,2*l);break}v+=ve;case"rectRot":f=Math.cos(v)*(s?s/2:y),r=Math.cos(v)*y,a=Math.sin(v)*y,p=Math.sin(v)*(s?s/2:y),e.moveTo(n-f,i-a),e.lineTo(n+p,i-r),e.lineTo(n+f,i+a),e.lineTo(n-p,i+r),e.closePath();break;case"crossRot":v+=ve;case"cross":f=Math.cos(v)*(s?s/2:y),r=Math.cos(v)*y,a=Math.sin(v)*y,p=Math.sin(v)*(s?s/2:y),e.moveTo(n-f,i-a),e.lineTo(n+f,i+a),e.moveTo(n+p,i-r),e.lineTo(n-p,i+r);break;case"star":f=Math.cos(v)*(s?s/2:y),r=Math.cos(v)*y,a=Math.sin(v)*y,p=Math.sin(v)*(s?s/2:y),e.moveTo(n-f,i-a),e.lineTo(n+f,i+a),e.moveTo(n+p,i-r),e.lineTo(n-p,i+r),v+=ve,f=Math.cos(v)*(s?s/2:y),r=Math.cos(v)*y,a=Math.sin(v)*y,p=Math.sin(v)*(s?s/2:y),e.moveTo(n-f,i-a),e.lineTo(n+f,i+a),e.moveTo(n+p,i-r),e.lineTo(n-p,i+r);break;case"line":r=s?s/2:Math.cos(v)*y,a=Math.sin(v)*y,e.moveTo(n-r,i-a),e.lineTo(n+r,i+a);break;case"dash":e.moveTo(n,i),e.lineTo(n+Math.cos(v)*(s?s/2:y),i+Math.sin(v)*y);break;case!1:e.closePath();break}e.fill(),t.borderWidth>0&&e.stroke()}}function Ze(e,t,n){return n=n||.5,!t||e&&e.x>t.left-n&&e.x<t.right+n&&e.y>t.top-n&&e.y<t.bottom+n}function lo(e,t){e.save(),e.beginPath(),e.rect(t.left,t.top,t.right-t.left,t.bottom-t.top),e.clip()}function co(e){e.restore()}function If(e,t,n,i,s){if(!t)return e.lineTo(n.x,n.y);if(s==="middle"){const o=(t.x+n.x)/2;e.lineTo(o,t.y),e.lineTo(o,n.y)}else s==="after"!=!!i?e.lineTo(t.x,n.y):e.lineTo(n.x,t.y);e.lineTo(n.x,n.y)}function Lf(e,t,n,i){if(!t)return e.lineTo(n.x,n.y);e.bezierCurveTo(i?t.cp1x:t.cp2x,i?t.cp1y:t.cp2y,i?n.cp2x:n.cp1x,i?n.cp2y:n.cp1y,n.x,n.y)}function Rf(e,t){t.translation&&e.translate(t.translation[0],t.translation[1]),V(t.rotation)||e.rotate(t.rotation),t.color&&(e.fillStyle=t.color),t.textAlign&&(e.textAlign=t.textAlign),t.textBaseline&&(e.textBaseline=t.textBaseline)}function Nf(e,t,n,i,s){if(s.strikethrough||s.underline){const o=e.measureText(i),r=t-o.actualBoundingBoxLeft,a=t+o.actualBoundingBoxRight,l=n-o.actualBoundingBoxAscent,c=n+o.actualBoundingBoxDescent,u=s.strikethrough?(l+c)/2:c;e.strokeStyle=e.fillStyle,e.beginPath(),e.lineWidth=s.decorationWidth||2,e.moveTo(r,u),e.lineTo(a,u),e.stroke()}}function zf(e,t){const n=e.fillStyle;e.fillStyle=t.color,e.fillRect(t.left,t.top,t.width,t.height),e.fillStyle=n}function Ti(e,t,n,i,s,o={}){const r=Q(t)?t:[t],a=o.strokeWidth>0&&o.strokeColor!=="";let l,c;for(e.save(),e.font=s.string,Rf(e,o),l=0;l<r.length;++l)c=r[l],o.backdrop&&zf(e,o.backdrop),a&&(o.strokeColor&&(e.strokeStyle=o.strokeColor),V(o.strokeWidth)||(e.lineWidth=o.strokeWidth),e.strokeText(c,n,i,o.maxWidth)),e.fillText(c,n,i,o.maxWidth),Nf(e,n,i,c,o),i+=Number(s.lineHeight);e.restore()}function Ls(e,t){const{x:n,y:i,w:s,h:o,radius:r}=t;e.arc(n+r.topLeft,i+r.topLeft,r.topLeft,1.5*tt,tt,!0),e.lineTo(n,i+o-r.bottomLeft),e.arc(n+r.bottomLeft,i+o-r.bottomLeft,r.bottomLeft,tt,wt,!0),e.lineTo(n+s-r.bottomRight,i+o),e.arc(n+s-r.bottomRight,i+o-r.bottomRight,r.bottomRight,wt,0,!0),e.lineTo(n+s,i+r.topRight),e.arc(n+s-r.topRight,i+r.topRight,r.topRight,0,-wt,!0),e.lineTo(n+r.topLeft,i)}const Ff=/^(normal|(\\d+(?:\\.\\d+)?)(px|em|%)?)$/,Hf=/^(normal|italic|initial|inherit|unset|(oblique( -?[0-9]?[0-9]deg)?))$/;function Bf(e,t){const n=(""+e).match(Ff);if(!n||n[1]==="normal")return t*1.2;switch(e=+n[2],n[3]){case"px":return e;case"%":e/=100;break}return t*e}const Vf=e=>+e||0;function _l(e,t){const n={},i=B(t),s=i?Object.keys(t):t,o=B(e)?i?r=>R(e[r],e[t[r]]):r=>e[r]:()=>e;for(const r of s)n[r]=Vf(o(r));return n}function Wf(e){return _l(e,{top:"y",right:"x",bottom:"y",left:"x"})}function Tn(e){return _l(e,["topLeft","topRight","bottomLeft","bottomRight"])}function Mt(e){const t=Wf(e);return t.width=t.left+t.right,t.height=t.top+t.bottom,t}function ct(e,t){e=e||{},t=t||Y.font;let n=R(e.size,t.size);typeof n=="string"&&(n=parseInt(n,10));let i=R(e.style,t.style);i&&!(""+i).match(Hf)&&(console.warn('Invalid font style specified: "'+i+'"'),i=void 0);const s={family:R(e.family,t.family),lineHeight:Bf(R(e.lineHeight,t.lineHeight),n),size:n,style:i,weight:R(e.weight,t.weight),string:""};return s.string=Af(s),s}function Jn(e,t,n,i){let s,o,r;for(s=0,o=e.length;s<o;++s)if(r=e[s],r!==void 0&&r!==void 0)return r}function jf(e,t,n){const{min:i,max:s}=e,o=Qh(t,(s-i)/2),r=(a,l)=>n&&a===0?0:a+l;return{min:r(i,-Math.abs(o)),max:r(s,o)}}function Le(e,t){return Object.assign(Object.create(e),t)}function uo(e,t=[""],n,i,s=()=>e[0]){const o=n||e;typeof i>"u"&&(i=Tl("_fallback",e));const r={[Symbol.toStringTag]:"Object",_cacheable:!0,_scopes:e,_rootScopes:o,_fallback:i,_getTarget:s,override:a=>uo([a,...e],t,o,i)};return new Proxy(r,{deleteProperty(a,l){return delete a[l],delete a._keys,delete e[0][l],!0},get(a,l){return Sl(a,l,()=>Zf(l,t,e,a))},getOwnPropertyDescriptor(a,l){return Reflect.getOwnPropertyDescriptor(a._scopes[0],l)},getPrototypeOf(){return Reflect.getPrototypeOf(e[0])},has(a,l){return hr(a).includes(l)},ownKeys(a){return hr(a)},set(a,l,c){const u=a._storage||(a._storage=s());return a[l]=u[l]=c,delete a._keys,!0}})}function Qe(e,t,n,i){const s={_cacheable:!1,_proxy:e,_context:t,_subProxy:n,_stack:new Set,_descriptors:wl(e,i),setContext:o=>Qe(e,o,n,i),override:o=>Qe(e.override(o),t,n,i)};return new Proxy(s,{deleteProperty(o,r){return delete o[r],delete e[r],!0},get(o,r,a){return Sl(o,r,()=>$f(o,r,a))},getOwnPropertyDescriptor(o,r){return o._descriptors.allKeys?Reflect.has(e,r)?{enumerable:!0,configurable:!0}:void 0:Reflect.getOwnPropertyDescriptor(e,r)},getPrototypeOf(){return Reflect.getPrototypeOf(e)},has(o,r){return Reflect.has(e,r)},ownKeys(){return Reflect.ownKeys(e)},set(o,r,a){return e[r]=a,delete o[r],!0}})}function wl(e,t={scriptable:!0,indexable:!0}){const{_scriptable:n=t.scriptable,_indexable:i=t.indexable,_allKeys:s=t.allKeys}=e;return{allKeys:s,scriptable:n,indexable:i,isScriptable:le(n)?n:()=>n,isIndexable:le(i)?i:()=>i}}const Uf=(e,t)=>e?e+oo(t):t,ho=(e,t)=>B(t)&&e!=="adapters"&&(Object.getPrototypeOf(t)===null||t.constructor===Object);function Sl(e,t,n){if(Object.prototype.hasOwnProperty.call(e,t)||t==="constructor")return e[t];const i=n();return e[t]=i,i}function $f(e,t,n){const{_proxy:i,_context:s,_subProxy:o,_descriptors:r}=e;let a=i[t];return le(a)&&r.isScriptable(t)&&(a=Yf(t,a,e,n)),Q(a)&&a.length&&(a=Xf(t,a,e,r.isIndexable)),ho(t,a)&&(a=Qe(a,s,o&&o[t],r)),a}function Yf(e,t,n,i){const{_proxy:s,_context:o,_subProxy:r,_stack:a}=n;if(a.has(e))throw new Error("Recursion detected: "+Array.from(a).join("->")+"->"+e);a.add(e);let l=t(o,r||i);return a.delete(e),ho(e,l)&&(l=fo(s._scopes,s,e,l)),l}function Xf(e,t,n,i){const{_proxy:s,_context:o,_subProxy:r,_descriptors:a}=n;if(typeof o.index<"u"&&i(e))return t[o.index%t.length];if(B(t[0])){const l=t,c=s._scopes.filter(u=>u!==l);t=[];for(const u of l){const f=fo(c,s,e,u);t.push(Qe(f,o,r&&r[e],a))}}return t}function kl(e,t,n){return le(e)?e(t,n):e}const qf=(e,t)=>e===!0?t:typeof e=="string"?wi(t,e):void 0;function Gf(e,t,n,i,s){for(const o of t){const r=qf(n,o);if(r){e.add(r);const a=kl(r._fallback,n,s);if(typeof a<"u"&&a!==n&&a!==i)return a}else if(r===!1&&typeof i<"u"&&n!==i)return null}return!1}function fo(e,t,n,i){const s=t._rootScopes,o=kl(t._fallback,n,i),r=[...e,...s],a=new Set;a.add(i);let l=ur(a,r,n,o||n,i);return l===null||typeof o<"u"&&o!==n&&(l=ur(a,r,o,l,i),l===null)?!1:uo(Array.from(a),[""],s,o,()=>Kf(t,n,i))}function ur(e,t,n,i,s){for(;n;)n=Gf(e,t,n,i,s);return n}function Kf(e,t,n){const i=e._getTarget();t in i||(i[t]={});const s=i[t];return Q(s)&&B(n)?n:s||{}}function Zf(e,t,n,i){let s;for(const o of t)if(s=Tl(Uf(o,e),n),typeof s<"u")return ho(e,s)?fo(n,i,e,s):s}function Tl(e,t){for(const n of t){if(!n)continue;const i=n[e];if(typeof i<"u")return i}}function hr(e){let t=e._keys;return t||(t=e._keys=Qf(e._scopes)),t}function Qf(e){const t=new Set;for(const n of e)for(const i of Object.keys(n).filter(s=>!s.startsWith("_")))t.add(i);return Array.from(t)}const Jf=Number.EPSILON||1e-14,Je=(e,t)=>t<e.length&&!e[t].skip&&e[t],Ml=e=>e==="x"?"y":"x";function td(e,t,n,i){const s=e.skip?t:e,o=t,r=n.skip?t:n,a=Ds(o,s),l=Ds(r,o);let c=a/(a+l),u=l/(a+l);c=isNaN(c)?0:c,u=isNaN(u)?0:u;const f=i*c,p=i*u;return{previous:{x:o.x-f*(r.x-s.x),y:o.y-f*(r.y-s.y)},next:{x:o.x+p*(r.x-s.x),y:o.y+p*(r.y-s.y)}}}function ed(e,t,n){const i=e.length;let s,o,r,a,l,c=Je(e,0);for(let u=0;u<i-1;++u)if(l=c,c=Je(e,u+1),!(!l||!c)){if(Ce(t[u],0,Jf)){n[u]=n[u+1]=0;continue}s=n[u]/t[u],o=n[u+1]/t[u],a=Math.pow(s,2)+Math.pow(o,2),!(a<=9)&&(r=3/Math.sqrt(a),n[u]=s*r*t[u],n[u+1]=o*r*t[u])}}function nd(e,t,n="x"){const i=Ml(n),s=e.length;let o,r,a,l=Je(e,0);for(let c=0;c<s;++c){if(r=a,a=l,l=Je(e,c+1),!a)continue;const u=a[n],f=a[i];r&&(o=(u-r[n])/3,a[\`cp1\${n}\`]=u-o,a[\`cp1\${i}\`]=f-o*t[c]),l&&(o=(l[n]-u)/3,a[\`cp2\${n}\`]=u+o,a[\`cp2\${i}\`]=f+o*t[c])}}function id(e,t="x"){const n=Ml(t),i=e.length,s=Array(i).fill(0),o=Array(i);let r,a,l,c=Je(e,0);for(r=0;r<i;++r)if(a=l,l=c,c=Je(e,r+1),!!l){if(c){const u=c[t]-l[t];s[r]=u!==0?(c[n]-l[n])/u:0}o[r]=a?c?ce(s[r-1])!==ce(s[r])?0:(s[r-1]+s[r])/2:s[r-1]:s[r]}ed(e,s,o),nd(e,o,t)}function ti(e,t,n){return Math.max(Math.min(e,n),t)}function sd(e,t){let n,i,s,o,r,a=Ze(e[0],t);for(n=0,i=e.length;n<i;++n)r=o,o=a,a=n<i-1&&Ze(e[n+1],t),o&&(s=e[n],r&&(s.cp1x=ti(s.cp1x,t.left,t.right),s.cp1y=ti(s.cp1y,t.top,t.bottom)),a&&(s.cp2x=ti(s.cp2x,t.left,t.right),s.cp2y=ti(s.cp2y,t.top,t.bottom)))}function od(e,t,n,i,s){let o,r,a,l;if(t.spanGaps&&(e=e.filter(c=>!c.skip)),t.cubicInterpolationMode==="monotone")id(e,s);else{let c=i?e[e.length-1]:e[0];for(o=0,r=e.length;o<r;++o)a=e[o],l=td(c,a,e[Math.min(o+1,r-(i?0:1))%r],t.tension),a.cp1x=l.previous.x,a.cp1y=l.previous.y,a.cp2x=l.next.x,a.cp2y=l.next.y,c=a}t.capBezierPoints&&sd(e,n)}function po(){return typeof window<"u"&&typeof document<"u"}function go(e){let t=e.parentNode;return t&&t.toString()==="[object ShadowRoot]"&&(t=t.host),t}function Mi(e,t,n){let i;return typeof e=="string"?(i=parseInt(e,10),e.indexOf("%")!==-1&&(i=i/100*t.parentNode[n])):i=e,i}const Ri=e=>e.ownerDocument.defaultView.getComputedStyle(e,null);function rd(e,t){return Ri(e).getPropertyValue(t)}const ad=["top","right","bottom","left"];function Pe(e,t,n){const i={};n=n?"-"+n:"";for(let s=0;s<4;s++){const o=ad[s];i[o]=parseFloat(e[t+"-"+o+n])||0}return i.width=i.left+i.right,i.height=i.top+i.bottom,i}const ld=(e,t,n)=>(e>0||t>0)&&(!n||!n.shadowRoot);function cd(e,t){const n=e.touches,i=n&&n.length?n[0]:e,{offsetX:s,offsetY:o}=i;let r=!1,a,l;if(ld(s,o,e.target))a=s,l=o;else{const c=t.getBoundingClientRect();a=i.clientX-c.left,l=i.clientY-c.top,r=!0}return{x:a,y:l,box:r}}function It(e,t){if("native"in e)return e;const{canvas:n,currentDevicePixelRatio:i}=t,s=Ri(n),o=s.boxSizing==="border-box",r=Pe(s,"padding"),a=Pe(s,"border","width"),{x:l,y:c,box:u}=cd(e,n),f=r.left+(u&&a.left),p=r.top+(u&&a.top);let{width:g,height:x}=t;return o&&(g-=r.width+a.width,x-=r.height+a.height),{x:Math.round((l-f)/g*n.width/i),y:Math.round((c-p)/x*n.height/i)}}function ud(e,t,n){let i,s;if(t===void 0||n===void 0){const o=e&&go(e);if(!o)t=e.clientWidth,n=e.clientHeight;else{const r=o.getBoundingClientRect(),a=Ri(o),l=Pe(a,"border","width"),c=Pe(a,"padding");t=r.width-c.width-l.width,n=r.height-c.height-l.height,i=Mi(a.maxWidth,o,"clientWidth"),s=Mi(a.maxHeight,o,"clientHeight")}}return{width:t,height:n,maxWidth:i||ki,maxHeight:s||ki}}const ei=e=>Math.round(e*10)/10;function hd(e,t,n,i){const s=Ri(e),o=Pe(s,"margin"),r=Mi(s.maxWidth,e,"clientWidth")||ki,a=Mi(s.maxHeight,e,"clientHeight")||ki,l=ud(e,t,n);let{width:c,height:u}=l;if(s.boxSizing==="content-box"){const p=Pe(s,"border","width"),g=Pe(s,"padding");c-=g.width+p.width,u-=g.height+p.height}return c=Math.max(0,c-o.width),u=Math.max(0,i?c/i:u-o.height),c=ei(Math.min(c,r,l.maxWidth)),u=ei(Math.min(u,a,l.maxHeight)),c&&!u&&(u=ei(c/2)),(t!==void 0||n!==void 0)&&i&&l.height&&u>l.height&&(u=l.height,c=ei(Math.floor(u*i))),{width:c,height:u}}function fr(e,t,n){const i=t||1,s=Math.floor(e.height*i),o=Math.floor(e.width*i);e.height=Math.floor(e.height),e.width=Math.floor(e.width);const r=e.canvas;return r.style&&(n||!r.style.height&&!r.style.width)&&(r.style.height=\`\${e.height}px\`,r.style.width=\`\${e.width}px\`),e.currentDevicePixelRatio!==i||r.height!==s||r.width!==o?(e.currentDevicePixelRatio=i,r.height=s,r.width=o,e.ctx.setTransform(i,0,0,i,0,0),!0):!1}const fd=(function(){let e=!1;try{const t={get passive(){return e=!0,!1}};po()&&(window.addEventListener("test",null,t),window.removeEventListener("test",null,t))}catch{}return e})();function dr(e,t){const n=rd(e,t),i=n&&n.match(/^(\\d+)(\\.\\d+)?px$/);return i?+i[1]:void 0}function Se(e,t,n,i){return{x:e.x+n*(t.x-e.x),y:e.y+n*(t.y-e.y)}}function dd(e,t,n,i){return{x:e.x+n*(t.x-e.x),y:i==="middle"?n<.5?e.y:t.y:i==="after"?n<1?e.y:t.y:n>0?t.y:e.y}}function pd(e,t,n,i){const s={x:e.cp2x,y:e.cp2y},o={x:t.cp1x,y:t.cp1y},r=Se(e,s,n),a=Se(s,o,n),l=Se(o,t,n),c=Se(r,a,n),u=Se(a,l,n);return Se(c,u,n)}const gd=function(e,t){return{x(n){return e+e+t-n},setWidth(n){t=n},textAlign(n){return n==="center"?n:n==="right"?"left":"right"},xPlus(n,i){return n-i},leftForLtr(n,i){return n-i}}},md=function(){return{x(e){return e},setWidth(e){},textAlign(e){return e},xPlus(e,t){return e+t},leftForLtr(e,t){return e}}};function Ue(e,t,n){return e?gd(t,n):md()}function El(e,t){let n,i;(t==="ltr"||t==="rtl")&&(n=e.canvas.style,i=[n.getPropertyValue("direction"),n.getPropertyPriority("direction")],n.setProperty("direction",t,"important"),e.prevTextDirection=i)}function Ol(e,t){t!==void 0&&(delete e.prevTextDirection,e.canvas.style.setProperty("direction",t[0],t[1]))}function Cl(e){return e==="angle"?{between:dl,compare:df,normalize:Qt}:{between:xn,compare:(t,n)=>t-n,normalize:t=>t}}function pr({start:e,end:t,count:n,loop:i,style:s}){return{start:e%n,end:t%n,loop:i&&(t-e+1)%n===0,style:s}}function bd(e,t,n){const{property:i,start:s,end:o}=n,{between:r,normalize:a}=Cl(i),l=t.length;let{start:c,end:u,loop:f}=e,p,g;if(f){for(c+=l,u+=l,p=0,g=l;p<g&&r(a(t[c%l][i]),s,o);++p)c--,u--;c%=l,u%=l}return u<c&&(u+=l),{start:c,end:u,loop:f,style:e.style}}function yd(e,t,n){if(!n)return[e];const{property:i,start:s,end:o}=n,r=t.length,{compare:a,between:l,normalize:c}=Cl(i),{start:u,end:f,loop:p,style:g}=bd(e,t,n),x=[];let y=!1,v=null,w,k,O;const C=()=>l(s,O,w)&&a(s,O)!==0,T=()=>a(o,w)===0||l(o,O,w),D=()=>y||C(),P=()=>!y||T();for(let E=u,A=u;E<=f;++E)k=t[E%r],!k.skip&&(w=c(k[i]),w!==O&&(y=l(w,s,o),v===null&&D()&&(v=a(w,s)===0?E:A),v!==null&&P()&&(x.push(pr({start:v,end:E,loop:p,count:r,style:g})),v=null),A=E,O=w));return v!==null&&x.push(pr({start:v,end:f,loop:p,count:r,style:g})),x}function xd(e,t){const n=[],i=e.segments;for(let s=0;s<i.length;s++){const o=yd(i[s],e.points,t);o.length&&n.push(...o)}return n}function vd(e,t,n,i){let s=0,o=t-1;if(n&&!i)for(;s<t&&!e[s].skip;)s++;for(;s<t&&e[s].skip;)s++;for(s%=t,n&&(o+=s);o>s&&e[o%t].skip;)o--;return o%=t,{start:s,end:o}}function _d(e,t,n,i){const s=e.length,o=[];let r=t,a=e[t],l;for(l=t+1;l<=n;++l){const c=e[l%s];c.skip||c.stop?a.skip||(i=!1,o.push({start:t%s,end:(l-1)%s,loop:i}),t=r=c.stop?l:null):(r=l,a.skip&&(t=l)),a=c}return r!==null&&o.push({start:t%s,end:r%s,loop:i}),o}function wd(e,t){const n=e.points,i=e.options.spanGaps,s=n.length;if(!s)return[];const o=!!e._loop,{start:r,end:a}=vd(n,s,o,i);if(i===!0)return gr(e,[{start:r,end:a,loop:o}],n,t);const l=a<r?a+s:a,c=!!e._fullLoop&&r===0&&a===s-1;return gr(e,_d(n,r,l,c),n,t)}function gr(e,t,n,i){return!i||!i.setContext||!n?t:Sd(e,t,n,i)}function Sd(e,t,n,i){const s=e._chart.getContext(),o=mr(e.options),{_datasetIndex:r,options:{spanGaps:a}}=e,l=n.length,c=[];let u=o,f=t[0].start,p=f;function g(x,y,v,w){const k=a?-1:1;if(x!==y){for(x+=l;n[x%l].skip;)x-=k;for(;n[y%l].skip;)y+=k;x%l!==y%l&&(c.push({start:x%l,end:y%l,loop:v,style:w}),u=w,f=y%l)}}for(const x of t){f=a?f:x.start;let y=n[f%l],v;for(p=f+1;p<=x.end;p++){const w=n[p%l];v=mr(i.setContext(Le(s,{type:"segment",p0:y,p1:w,p0DataIndex:(p-1)%l,p1DataIndex:p%l,datasetIndex:r}))),kd(v,u)&&g(f,p-1,x.loop,u),y=w,u=v}f<p-1&&g(f,p-1,x.loop,u)}return c}function mr(e){return{backgroundColor:e.backgroundColor,borderCapStyle:e.borderCapStyle,borderDash:e.borderDash,borderDashOffset:e.borderDashOffset,borderJoinStyle:e.borderJoinStyle,borderWidth:e.borderWidth,borderColor:e.borderColor}}function kd(e,t){if(!t)return!1;const n=[],i=function(s,o){return ao(o)?(n.includes(o)||n.push(o),n.indexOf(o)):o};return JSON.stringify(e,i)!==JSON.stringify(t,i)}function ni(e,t,n){return e.options.clip?e[n]:t[n]}function Td(e,t){const{xScale:n,yScale:i}=e;return n&&i?{left:ni(n,t,"left"),right:ni(n,t,"right"),top:ni(i,t,"top"),bottom:ni(i,t,"bottom")}:t}function Md(e,t){const n=t._clip;if(n.disabled)return!1;const i=Td(t,e.chartArea);return{left:n.left===!1?0:i.left-(n.left===!0?0:n.left),right:n.right===!1?e.width:i.right+(n.right===!0?0:n.right),top:n.top===!1?0:i.top-(n.top===!0?0:n.top),bottom:n.bottom===!1?e.height:i.bottom+(n.bottom===!0?0:n.bottom)}}/*!
|
|
1737
1737
|
* Chart.js v4.5.0
|
|
1738
1738
|
* https://www.chartjs.org
|
|
1739
1739
|
* (c) 2025 Chart.js Contributors
|
|
1740
1740
|
* Released under the MIT License
|
|
1741
|
-
*/class Md{constructor(){this._request=null,this._charts=new Map,this._running=!1,this._lastDate=void 0}_notify(t,n,i,s){const o=n.listeners[s],r=n.duration;o.forEach(a=>a({chart:t,initial:n.initial,numSteps:r,currentStep:Math.min(i-n.start,r)}))}_refresh(){this._request||(this._running=!0,this._request=pl.call(window,()=>{this._update(),this._request=null,this._running&&this._refresh()}))}_update(t=Date.now()){let n=0;this._charts.forEach((i,s)=>{if(!i.running||!i.items.length)return;const o=i.items;let r=o.length-1,a=!1,l;for(;r>=0;--r)l=o[r],l._active?(l._total>i.duration&&(i.duration=l._total),l.tick(t),a=!0):(o[r]=o[o.length-1],o.pop());a&&(s.draw(),this._notify(s,i,t,"progress")),o.length||(i.running=!1,this._notify(s,i,t,"complete"),i.initial=!1),n+=o.length}),this._lastDate=t,n===0&&(this._running=!1)}_getAnims(t){const n=this._charts;let i=n.get(t);return i||(i={running:!1,initial:!0,items:[],listeners:{complete:[],progress:[]}},n.set(t,i)),i}listen(t,n,i){this._getAnims(t).listeners[n].push(i)}add(t,n){!n||!n.length||this._getAnims(t).items.push(...n)}has(t){return this._getAnims(t).items.length>0}start(t){const n=this._charts.get(t);n&&(n.running=!0,n.start=Date.now(),n.duration=n.items.reduce((i,s)=>Math.max(i,s._duration),0),this._refresh())}running(t){if(!this._running)return!1;const n=this._charts.get(t);return!(!n||!n.running||!n.items.length)}stop(t){const n=this._charts.get(t);if(!n||!n.items.length)return;const i=n.items;let s=i.length-1;for(;s>=0;--s)i[s].cancel();n.items=[],this._notify(t,n,Date.now(),"complete")}remove(t){return this._charts.delete(t)}}var jt=new Md;const mr="transparent",Ed={boolean(e,t,n){return n>.5?t:e},color(e,t,n){const i=or(e||mr),s=i.valid&&or(t||mr);return s&&s.valid?s.mix(i,n).hexString():t},number(e,t,n){return e+(t-e)*n}};class Cd{constructor(t,n,i,s){const o=n[i];s=Jn([t.to,s,o,t.from]);const r=Jn([t.from,o,s]);this._active=!0,this._fn=t.fn||Ed[t.type||typeof r],this._easing=Sn[t.easing]||Sn.linear,this._start=Math.floor(Date.now()+(t.delay||0)),this._duration=this._total=Math.floor(t.duration),this._loop=!!t.loop,this._target=n,this._prop=i,this._from=r,this._to=s,this._promises=void 0}active(){return this._active}update(t,n,i){if(this._active){this._notify(!1);const s=this._target[this._prop],o=i-this._start,r=this._duration-o;this._start=i,this._duration=Math.floor(Math.max(r,t.duration)),this._total+=o,this._loop=!!t.loop,this._to=Jn([t.to,n,s,t.from]),this._from=Jn([t.from,s,n])}}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(t){const n=t-this._start,i=this._duration,s=this._prop,o=this._from,r=this._loop,a=this._to;let l;if(this._active=o!==a&&(r||n<i),!this._active){this._target[s]=a,this._notify(!0);return}if(n<0){this._target[s]=o;return}l=n/i%2,l=r&&l>1?2-l:l,l=this._easing(Math.min(1,Math.max(0,l))),this._target[s]=this._fn(o,a,l)}wait(){const t=this._promises||(this._promises=[]);return new Promise((n,i)=>{t.push({res:n,rej:i})})}_notify(t){const n=t?"res":"rej",i=this._promises||[];for(let s=0;s<i.length;s++)i[s][n]()}}class Ol{constructor(t,n){this._chart=t,this._properties=new Map,this.configure(n)}configure(t){if(!B(t))return;const n=Object.keys(Y.animation),i=this._properties;Object.getOwnPropertyNames(t).forEach(s=>{const o=t[s];if(!B(o))return;const r={};for(const a of n)r[a]=o[a];(Q(o.properties)&&o.properties||[s]).forEach(a=>{(a===s||!i.has(a))&&i.set(a,r)})})}_animateOptions(t,n){const i=n.options,s=Pd(t,i);if(!s)return[];const o=this._createAnimations(s,i);return i.$shared&&Od(t.options.$animations,i).then(()=>{t.options=i},()=>{}),o}_createAnimations(t,n){const i=this._properties,s=[],o=t.$animations||(t.$animations={}),r=Object.keys(n),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"){s.push(...this._animateOptions(t,n));continue}const u=n[c];let f=o[c];const p=i.get(c);if(f)if(p&&f.active()){f.update(p,u,a);continue}else f.cancel();if(!p||!p.duration){t[c]=u;continue}o[c]=f=new Cd(p,t,c,u),s.push(f)}return s}update(t,n){if(this._properties.size===0){Object.assign(t,n);return}const i=this._createAnimations(t,n);if(i.length)return jt.add(this._chart,i),!0}}function Od(e,t){const n=[],i=Object.keys(t);for(let s=0;s<i.length;s++){const o=e[i[s]];o&&o.active()&&n.push(o.wait())}return Promise.all(n)}function Pd(e,t){if(!t)return;let n=e.options;if(!n){e.options=t;return}return n.$shared&&(e.options=n=Object.assign({},n,{$shared:!1,$animations:{}})),n}function br(e,t){const n=e&&e.options||{},i=n.reverse,s=n.min===void 0?t:0,o=n.max===void 0?t:0;return{start:i?o:s,end:i?s:o}}function Dd(e,t,n){if(n===!1)return!1;const i=br(e,n),s=br(t,n);return{top:s.end,right:i.end,bottom:s.start,left:i.start}}function Ad(e){let t,n,i,s;return B(e)?(t=e.top,n=e.right,i=e.bottom,s=e.left):t=n=i=s=e,{top:t,right:n,bottom:i,left:s,disabled:e===!1}}function Pl(e,t){const n=[],i=e._getSortedDatasetMetas(t);let s,o;for(s=0,o=i.length;s<o;++s)n.push(i[s].index);return n}function yr(e,t,n,i={}){const s=e.keys,o=i.mode==="single";let r,a,l,c;if(t===null)return;let u=!1;for(r=0,a=s.length;r<a;++r){if(l=+s[r],l===n){if(u=!0,i.all)continue;break}c=e.values[l],xt(c)&&(o||t===0||ce(t)===ce(c))&&(t+=c)}return!u&&!i.all?0:t}function Id(e,t){const{iScale:n,vScale:i}=t,s=n.axis==="x"?"x":"y",o=i.axis==="x"?"x":"y",r=Object.keys(e),a=new Array(r.length);let l,c,u;for(l=0,c=r.length;l<c;++l)u=r[l],a[l]={[s]:u,[o]:e[u]};return a}function Ji(e,t){const n=e&&e.options.stacked;return n||n===void 0&&t.stack!==void 0}function Ld(e,t,n){return\`\${e.id}.\${t.id}.\${n.stack||n.type}\`}function Rd(e){const{min:t,max:n,minDefined:i,maxDefined:s}=e.getUserBounds();return{min:i?t:Number.NEGATIVE_INFINITY,max:s?n:Number.POSITIVE_INFINITY}}function Nd(e,t,n){const i=e[t]||(e[t]={});return i[n]||(i[n]={})}function xr(e,t,n,i){for(const s of t.getMatchingVisibleMetas(i).reverse()){const o=e[s.index];if(n&&o>0||!n&&o<0)return s.index}return null}function vr(e,t){const{chart:n,_cachedMeta:i}=e,s=n._stacks||(n._stacks={}),{iScale:o,vScale:r,index:a}=i,l=o.axis,c=r.axis,u=Ld(o,r,i),f=t.length;let p;for(let g=0;g<f;++g){const x=t[g],{[l]:y,[c]:v}=x,w=x._stacks||(x._stacks={});p=w[c]=Nd(s,u,y),p[a]=v,p._top=xr(p,r,!0,i.type),p._bottom=xr(p,r,!1,i.type);const k=p._visualValues||(p._visualValues={});k[a]=v}}function ts(e,t){const n=e.scales;return Object.keys(n).filter(i=>n[i].axis===t).shift()}function zd(e,t){return Le(e,{active:!1,dataset:void 0,datasetIndex:t,index:t,mode:"default",type:"dataset"})}function Fd(e,t,n){return Le(e,{active:!1,dataIndex:t,parsed:void 0,raw:void 0,element:n,index:t,mode:"default",type:"data"})}function fn(e,t){const n=e.controller.index,i=e.vScale&&e.vScale.axis;if(i){t=t||e._parsed;for(const s of t){const o=s._stacks;if(!o||o[i]===void 0||o[i][n]===void 0)return;delete o[i][n],o[i]._visualValues!==void 0&&o[i]._visualValues[n]!==void 0&&delete o[i]._visualValues[n]}}}const es=e=>e==="reset"||e==="none",_r=(e,t)=>t?e:Object.assign({},e),Hd=(e,t,n)=>e&&!t.hidden&&t._stacked&&{keys:Pl(n,!0),values:null};class Dl{static defaults={};static datasetElementType=null;static dataElementType=null;constructor(t,n){this.chart=t,this._ctx=t.ctx,this.index=n,this._cachedDataOpts={},this._cachedMeta=this.getMeta(),this._type=this._cachedMeta.type,this.options=void 0,this._parsing=!1,this._data=void 0,this._objectData=void 0,this._sharedOptions=void 0,this._drawStart=void 0,this._drawCount=void 0,this.enableOptionSharing=!1,this.supportsDecimation=!1,this.$context=void 0,this._syncList=[],this.datasetElementType=new.target.datasetElementType,this.dataElementType=new.target.dataElementType,this.initialize()}initialize(){const t=this._cachedMeta;this.configure(),this.linkScales(),t._stacked=Ji(t.vScale,t),this.addElements(),this.options.fill&&!this.chart.isPluginEnabled("filler")&&console.warn("Tried to use the 'fill' option without the 'Filler' plugin enabled. Please import and register the 'Filler' plugin and make sure it is not disabled in the options")}updateIndex(t){this.index!==t&&fn(this._cachedMeta),this.index=t}linkScales(){const t=this.chart,n=this._cachedMeta,i=this.getDataset(),s=(f,p,g,x)=>f==="x"?p:f==="r"?x:g,o=n.xAxisID=R(i.xAxisID,ts(t,"x")),r=n.yAxisID=R(i.yAxisID,ts(t,"y")),a=n.rAxisID=R(i.rAxisID,ts(t,"r")),l=n.indexAxis,c=n.iAxisID=s(l,o,r,a),u=n.vAxisID=s(l,r,o,a);n.xScale=this.getScaleForId(o),n.yScale=this.getScaleForId(r),n.rScale=this.getScaleForId(a),n.iScale=this.getScaleForId(c),n.vScale=this.getScaleForId(u)}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 n=this._cachedMeta;return t===n.iScale?n.vScale:n.iScale}reset(){this._update("reset")}_destroy(){const t=this._cachedMeta;this._data&&nr(this._data,this),t._stacked&&fn(t)}_dataCheck(){const t=this.getDataset(),n=t.data||(t.data=[]),i=this._data;if(B(n)){const s=this._cachedMeta;this._data=Id(n,s)}else if(i!==n){if(i){nr(i,this);const s=this._cachedMeta;fn(s),s._parsed=[]}n&&Object.isExtensible(n)&&mf(n,this),this._syncList=[],this._data=n}}addElements(){const t=this._cachedMeta;this._dataCheck(),this.datasetElementType&&(t.dataset=new this.datasetElementType)}buildOrUpdateElements(t){const n=this._cachedMeta,i=this.getDataset();let s=!1;this._dataCheck();const o=n._stacked;n._stacked=Ji(n.vScale,n),n.stack!==i.stack&&(s=!0,fn(n),n.stack=i.stack),this._resyncElements(t),(s||o!==n._stacked)&&(vr(this,n._parsed),n._stacked=Ji(n.vScale,n))}configure(){const t=this.chart.config,n=t.datasetScopeKeys(this._type),i=t.getOptionScopes(this.getDataset(),n,!0);this.options=t.createResolver(i,this.getContext()),this._parsing=this.options.parsing,this._cachedDataOpts={}}parse(t,n){const{_cachedMeta:i,_data:s}=this,{iScale:o,_stacked:r}=i,a=o.axis;let l=t===0&&n===s.length?!0:i._sorted,c=t>0&&i._parsed[t-1],u,f,p;if(this._parsing===!1)i._parsed=s,i._sorted=!0,p=s;else{Q(s[t])?p=this.parseArrayData(i,s,t,n):B(s[t])?p=this.parseObjectData(i,s,t,n):p=this.parsePrimitiveData(i,s,t,n);const g=()=>f[a]===null||c&&f[a]<c[a];for(u=0;u<n;++u)i._parsed[u+t]=f=p[u],l&&(g()&&(l=!1),c=f);i._sorted=l}r&&vr(this,p)}parsePrimitiveData(t,n,i,s){const{iScale:o,vScale:r}=t,a=o.axis,l=r.axis,c=o.getLabels(),u=o===r,f=new Array(s);let p,g,x;for(p=0,g=s;p<g;++p)x=p+i,f[p]={[a]:u||o.parse(c[x],x),[l]:r.parse(n[x],x)};return f}parseArrayData(t,n,i,s){const{xScale:o,yScale:r}=t,a=new Array(s);let l,c,u,f;for(l=0,c=s;l<c;++l)u=l+i,f=n[u],a[l]={x:o.parse(f[0],u),y:r.parse(f[1],u)};return a}parseObjectData(t,n,i,s){const{xScale:o,yScale:r}=t,{xAxisKey:a="x",yAxisKey:l="y"}=this._parsing,c=new Array(s);let u,f,p,g;for(u=0,f=s;u<f;++u)p=u+i,g=n[p],c[u]={x:o.parse(wi(g,a),p),y:r.parse(wi(g,l),p)};return c}getParsed(t){return this._cachedMeta._parsed[t]}getDataElement(t){return this._cachedMeta.data[t]}applyStack(t,n,i){const s=this.chart,o=this._cachedMeta,r=n[t.axis],a={keys:Pl(s,!0),values:n._stacks[t.axis]._visualValues};return yr(a,r,o.index,{mode:i})}updateRangeFromParsed(t,n,i,s){const o=i[n.axis];let r=o===null?NaN:o;const a=s&&i._stacks[n.axis];s&&a&&(s.values=a,r=yr(s,o,this._cachedMeta.index)),t.min=Math.min(t.min,r),t.max=Math.max(t.max,r)}getMinMax(t,n){const i=this._cachedMeta,s=i._parsed,o=i._sorted&&t===i.iScale,r=s.length,a=this._getOtherScale(t),l=Hd(n,i,this.chart),c={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY},{min:u,max:f}=Rd(a);let p,g;function x(){g=s[p];const y=g[a.axis];return!xt(g[t.axis])||u>y||f<y}for(p=0;p<r&&!(!x()&&(this.updateRangeFromParsed(c,t,g,l),o));++p);if(o){for(p=r-1;p>=0;--p)if(!x()){this.updateRangeFromParsed(c,t,g,l);break}}return c}getAllParsedValues(t){const n=this._cachedMeta._parsed,i=[];let s,o,r;for(s=0,o=n.length;s<o;++s)r=n[s][t.axis],xt(r)&&i.push(r);return i}getMaxOverflow(){return!1}getLabelAndValue(t){const n=this._cachedMeta,i=n.iScale,s=n.vScale,o=this.getParsed(t);return{label:i?""+i.getLabelForValue(o[i.axis]):"",value:s?""+s.getLabelForValue(o[s.axis]):""}}_update(t){const n=this._cachedMeta;this.update(t||"default"),n._clip=Ad(R(this.options.clip,Dd(n.xScale,n.yScale,this.getMaxOverflow())))}update(t){}draw(){const t=this._ctx,n=this.chart,i=this._cachedMeta,s=i.data||[],o=n.chartArea,r=[],a=this._drawStart||0,l=this._drawCount||s.length-a,c=this.options.drawActiveElementsOnTop;let u;for(i.dataset&&i.dataset.draw(t,o,a,l),u=a;u<a+l;++u){const f=s[u];f.hidden||(f.active&&c?r.push(f):f.draw(t,o))}for(u=0;u<r.length;++u)r[u].draw(t,o)}getStyle(t,n){const i=n?"active":"default";return t===void 0&&this._cachedMeta.dataset?this.resolveDatasetElementOptions(i):this.resolveDataElementOptions(t||0,i)}getContext(t,n,i){const s=this.getDataset();let o;if(t>=0&&t<this._cachedMeta.data.length){const r=this._cachedMeta.data[t];o=r.$context||(r.$context=Fd(this.getContext(),t,r)),o.parsed=this.getParsed(t),o.raw=s.data[t],o.index=o.dataIndex=t}else o=this.$context||(this.$context=zd(this.chart.getContext(),this.index)),o.dataset=s,o.index=o.datasetIndex=this.index;return o.active=!!n,o.mode=i,o}resolveDatasetElementOptions(t){return this._resolveElementOptions(this.datasetElementType.id,t)}resolveDataElementOptions(t,n){return this._resolveElementOptions(this.dataElementType.id,n,t)}_resolveElementOptions(t,n="default",i){const s=n==="active",o=this._cachedDataOpts,r=t+"-"+n,a=o[r],l=this.enableOptionSharing&&Si(i);if(a)return _r(a,l);const c=this.chart.config,u=c.datasetElementScopeKeys(this._type,t),f=s?[\`\${t}Hover\`,"hover",t,""]:[t,""],p=c.getOptionScopes(this.getDataset(),u),g=Object.keys(Y.elements[t]),x=()=>this.getContext(i,s,n),y=c.resolveNamedOptions(p,g,x,f);return y.$shared&&(y.$shared=l,o[r]=Object.freeze(_r(y,l))),y}_resolveAnimations(t,n,i){const s=this.chart,o=this._cachedDataOpts,r=\`animation-\${n}\`,a=o[r];if(a)return a;let l;if(s.options.animation!==!1){const u=this.chart.config,f=u.datasetAnimationScopeKeys(this._type,n),p=u.getOptionScopes(this.getDataset(),f);l=u.createResolver(p,this.getContext(t,i,n))}const c=new Ol(s,l&&l.animations);return l&&l._cacheable&&(o[r]=Object.freeze(c)),c}getSharedOptions(t){if(t.$shared)return this._sharedOptions||(this._sharedOptions=Object.assign({},t))}includeOptions(t,n){return!n||es(t)||this.chart._animationsDisabled}_getSharedOptions(t,n){const i=this.resolveDataElementOptions(t,n),s=this._sharedOptions,o=this.getSharedOptions(i),r=this.includeOptions(n,o)||o!==s;return this.updateSharedOptions(o,n,i),{sharedOptions:o,includeOptions:r}}updateElement(t,n,i,s){es(s)?Object.assign(t,i):this._resolveAnimations(n,s).update(t,i)}updateSharedOptions(t,n,i){t&&!es(n)&&this._resolveAnimations(void 0,n).update(t,i)}_setStyle(t,n,i,s){t.active=s;const o=this.getStyle(n,s);this._resolveAnimations(n,i,s).update(t,{options:!s&&this.getSharedOptions(o)||o})}removeHoverStyle(t,n,i){this._setStyle(t,i,"active",!1)}setHoverStyle(t,n,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 n=this._data,i=this._cachedMeta.data;for(const[a,l,c]of this._syncList)this[a](l,c);this._syncList=[];const s=i.length,o=n.length,r=Math.min(o,s);r&&this.parse(0,r),o>s?this._insertElements(s,o-s,t):o<s&&this._removeElements(o,s-o)}_insertElements(t,n,i=!0){const s=this._cachedMeta,o=s.data,r=t+n;let a;const l=c=>{for(c.length+=n,a=c.length-1;a>=r;a--)c[a]=c[a-n]};for(l(o),a=t;a<r;++a)o[a]=new this.dataElementType;this._parsing&&l(s._parsed),this.parse(t,n),i&&this.updateElements(o,t,n,"reset")}updateElements(t,n,i,s){}_removeElements(t,n){const i=this._cachedMeta;if(this._parsing){const s=i._parsed.splice(t,n);i._stacked&&fn(i,s)}i.data.splice(t,n)}_sync(t){if(this._parsing)this._syncList.push(t);else{const[n,i,s]=t;this[n](i,s)}this.chart._dataChanges.push([this.index,...t])}_onDataPush(){const t=arguments.length;this._sync(["_insertElements",this.getDataset().data.length-t,t])}_onDataPop(){this._sync(["_removeElements",this._cachedMeta.data.length-1,1])}_onDataShift(){this._sync(["_removeElements",0,1])}_onDataSplice(t,n){n&&this._sync(["_removeElements",t,n]);const i=arguments.length-2;i&&this._sync(["_insertElements",t,i])}_onDataUnshift(){this._sync(["_insertElements",0,arguments.length])}}class Bd extends Dl{static id="line";static defaults={datasetElementType:"line",dataElementType:"point",showLine:!0,spanGaps:!1};static overrides={scales:{_index_:{type:"category"},_value_:{type:"linear"}}};initialize(){this.enableOptionSharing=!0,this.supportsDecimation=!0,super.initialize()}update(t){const n=this._cachedMeta,{dataset:i,data:s=[],_dataset:o}=n,r=this.chart._animationsDisabled;let{start:a,count:l}=vf(n,s,r);this._drawStart=a,this._drawCount=l,_f(n)&&(a=0,l=s.length),i._chart=this.chart,i._datasetIndex=this.index,i._decimated=!!o._decimated,i.points=s;const c=this.resolveDatasetElementOptions(t);this.options.showLine||(c.borderWidth=0),c.segment=this.options.segment,this.updateElement(i,void 0,{animated:!r,options:c},t),this.updateElements(s,a,l,t)}updateElements(t,n,i,s){const o=s==="reset",{iScale:r,vScale:a,_stacked:l,_dataset:c}=this._cachedMeta,{sharedOptions:u,includeOptions:f}=this._getSharedOptions(n,s),p=r.axis,g=a.axis,{spanGaps:x,segment:y}=this.options,v=In(x)?x:Number.POSITIVE_INFINITY,w=this.chart._animationsDisabled||o||s==="none",k=n+i,C=t.length;let O=n>0&&this.getParsed(n-1);for(let T=0;T<C;++T){const D=t[T],P=w?D:{};if(T<n||T>=k){P.skip=!0;continue}const E=this.getParsed(T),A=V(E[g]),F=P[p]=r.getPixelForValue(E[p],T),L=P[g]=o||A?a.getBasePixel():a.getPixelForValue(l?this.applyStack(a,E,l):E[g],T);P.skip=isNaN(F)||isNaN(L)||A,P.stop=T>0&&Math.abs(E[p]-O[p])>v,y&&(P.parsed=E,P.raw=c.data[T]),f&&(P.options=u||this.resolveDataElementOptions(T,D.active?"active":s)),w||this.updateElement(D,T,P,s),O=E}}getMaxOverflow(){const t=this._cachedMeta,n=t.dataset,i=n.options&&n.options.borderWidth||0,s=t.data||[];if(!s.length)return i;const o=s[0].size(this.resolveDataElementOptions(0)),r=s[s.length-1].size(this.resolveDataElementOptions(s.length-1));return Math.max(i,o,r)/2}draw(){const t=this._cachedMeta;t.dataset.updateControlPoints(this.chart.chartArea,t.iScale.axis),super.draw()}}function we(){throw new Error("This method is not implemented: Check that a complete date adapter is provided.")}class mo{static override(t){Object.assign(mo.prototype,t)}options;constructor(t){this.options=t||{}}init(){}formats(){return we()}parse(){return we()}format(){return we()}add(){return we()}diff(){return we()}startOf(){return we()}endOf(){return we()}}var Vd={_date:mo};function Wd(e,t,n,i){const{controller:s,data:o,_sorted:r}=e,a=s._cachedMeta.iScale,l=e.dataset&&e.dataset.options?e.dataset.options.spanGaps:null;if(a&&t===a.axis&&t!=="r"&&r&&o.length){const c=a._reversePixels?pf:Ee;if(i){if(s._sharedOptions){const u=o[0],f=typeof u.getRange=="function"&&u.getRange(t);if(f){const p=c(o,t,n-f),g=c(o,t,n+f);return{lo:p.lo,hi:g.hi}}}}else{const u=c(o,t,n);if(l){const{vScale:f}=s._cachedMeta,{_parsed:p}=e,g=p.slice(0,u.lo+1).reverse().findIndex(y=>!V(y[f.axis]));u.lo-=Math.max(0,g);const x=p.slice(u.hi).findIndex(y=>!V(y[f.axis]));u.hi+=Math.max(0,x)}return u}}return{lo:0,hi:o.length-1}}function Ni(e,t,n,i,s){const o=e.getSortedVisibleDatasetMetas(),r=n[t];for(let a=0,l=o.length;a<l;++a){const{index:c,data:u}=o[a],{lo:f,hi:p}=Wd(o[a],t,r,s);for(let g=f;g<=p;++g){const x=u[g];x.skip||i(x,c,g)}}}function jd(e){const t=e.indexOf("x")!==-1,n=e.indexOf("y")!==-1;return function(i,s){const o=t?Math.abs(i.x-s.x):0,r=n?Math.abs(i.y-s.y):0;return Math.sqrt(Math.pow(o,2)+Math.pow(r,2))}}function ns(e,t,n,i,s){const o=[];return!s&&!e.isPointInArea(t)||Ni(e,n,t,function(a,l,c){!s&&!Ze(a,e.chartArea,0)||a.inRange(t.x,t.y,i)&&o.push({element:a,datasetIndex:l,index:c})},!0),o}function Ud(e,t,n,i){let s=[];function o(r,a,l){const{startAngle:c,endAngle:u}=r.getProps(["startAngle","endAngle"],i),{angle:f}=hf(r,{x:t.x,y:t.y});fl(f,c,u)&&s.push({element:r,datasetIndex:a,index:l})}return Ni(e,n,t,o),s}function $d(e,t,n,i,s,o){let r=[];const a=jd(n);let l=Number.POSITIVE_INFINITY;function c(u,f,p){const g=u.inRange(t.x,t.y,s);if(i&&!g)return;const x=u.getCenterPoint(s);if(!(!!o||e.isPointInArea(x))&&!g)return;const v=a(t,x);v<l?(r=[{element:u,datasetIndex:f,index:p}],l=v):v===l&&r.push({element:u,datasetIndex:f,index:p})}return Ni(e,n,t,c),r}function is(e,t,n,i,s,o){return!o&&!e.isPointInArea(t)?[]:n==="r"&&!i?Ud(e,t,n,s):$d(e,t,n,i,s,o)}function wr(e,t,n,i,s){const o=[],r=n==="x"?"inXRange":"inYRange";let a=!1;return Ni(e,n,t,(l,c,u)=>{l[r]&&l[r](t[n],s)&&(o.push({element:l,datasetIndex:c,index:u}),a=a||l.inRange(t.x,t.y,s))}),i&&!a?[]:o}var Yd={modes:{index(e,t,n,i){const s=It(t,e),o=n.axis||"x",r=n.includeInvisible||!1,a=n.intersect?ns(e,s,o,i,r):is(e,s,o,!1,i,r),l=[];return a.length?(e.getSortedVisibleDatasetMetas().forEach(c=>{const u=a[0].index,f=c.data[u];f&&!f.skip&&l.push({element:f,datasetIndex:c.index,index:u})}),l):[]},dataset(e,t,n,i){const s=It(t,e),o=n.axis||"xy",r=n.includeInvisible||!1;let a=n.intersect?ns(e,s,o,i,r):is(e,s,o,!1,i,r);if(a.length>0){const l=a[0].datasetIndex,c=e.getDatasetMeta(l).data;a=[];for(let u=0;u<c.length;++u)a.push({element:c[u],datasetIndex:l,index:u})}return a},point(e,t,n,i){const s=It(t,e),o=n.axis||"xy",r=n.includeInvisible||!1;return ns(e,s,o,i,r)},nearest(e,t,n,i){const s=It(t,e),o=n.axis||"xy",r=n.includeInvisible||!1;return is(e,s,o,n.intersect,i,r)},x(e,t,n,i){const s=It(t,e);return wr(e,s,"x",n.intersect,i)},y(e,t,n,i){const s=It(t,e);return wr(e,s,"y",n.intersect,i)}}};const Al=["left","top","right","bottom"];function dn(e,t){return e.filter(n=>n.pos===t)}function Sr(e,t){return e.filter(n=>Al.indexOf(n.pos)===-1&&n.box.axis===t)}function pn(e,t){return e.sort((n,i)=>{const s=t?i:n,o=t?n:i;return s.weight===o.weight?s.index-o.index:s.weight-o.weight})}function Xd(e){const t=[];let n,i,s,o,r,a;for(n=0,i=(e||[]).length;n<i;++n)s=e[n],{position:o,options:{stack:r,stackWeight:a=1}}=s,t.push({index:n,box:s,pos:o,horizontal:s.isHorizontal(),weight:s.weight,stack:r&&o+r,stackWeight:a});return t}function qd(e){const t={};for(const n of e){const{stack:i,pos:s,stackWeight:o}=n;if(!i||!Al.includes(s))continue;const r=t[i]||(t[i]={count:0,placed:0,weight:0,size:0});r.count++,r.weight+=o}return t}function Gd(e,t){const n=qd(e),{vBoxMaxWidth:i,hBoxMaxHeight:s}=t;let o,r,a;for(o=0,r=e.length;o<r;++o){a=e[o];const{fullSize:l}=a.box,c=n[a.stack],u=c&&a.stackWeight/c.weight;a.horizontal?(a.width=u?u*i:l&&t.availableWidth,a.height=s):(a.width=i,a.height=u?u*s:l&&t.availableHeight)}return n}function Kd(e){const t=Xd(e),n=pn(t.filter(c=>c.box.fullSize),!0),i=pn(dn(t,"left"),!0),s=pn(dn(t,"right")),o=pn(dn(t,"top"),!0),r=pn(dn(t,"bottom")),a=Sr(t,"x"),l=Sr(t,"y");return{fullSize:n,leftAndTop:i.concat(o),rightAndBottom:s.concat(l).concat(r).concat(a),chartArea:dn(t,"chartArea"),vertical:i.concat(s).concat(l),horizontal:o.concat(r).concat(a)}}function kr(e,t,n,i){return Math.max(e[n],t[n])+Math.max(e[i],t[i])}function Il(e,t){e.top=Math.max(e.top,t.top),e.left=Math.max(e.left,t.left),e.bottom=Math.max(e.bottom,t.bottom),e.right=Math.max(e.right,t.right)}function Zd(e,t,n,i){const{pos:s,box:o}=n,r=e.maxPadding;if(!B(s)){n.size&&(e[s]-=n.size);const f=i[n.stack]||{size:0,count:1};f.size=Math.max(f.size,n.horizontal?o.height:o.width),n.size=f.size/f.count,e[s]+=n.size}o.getPadding&&Il(r,o.getPadding());const a=Math.max(0,t.outerWidth-kr(r,e,"left","right")),l=Math.max(0,t.outerHeight-kr(r,e,"top","bottom")),c=a!==e.w,u=l!==e.h;return e.w=a,e.h=l,n.horizontal?{same:c,other:u}:{same:u,other:c}}function Qd(e){const t=e.maxPadding;function n(i){const s=Math.max(t[i]-e[i],0);return e[i]+=s,s}e.y+=n("top"),e.x+=n("left"),n("right"),n("bottom")}function Jd(e,t){const n=t.maxPadding;function i(s){const o={left:0,top:0,right:0,bottom:0};return s.forEach(r=>{o[r]=Math.max(t[r],n[r])}),o}return i(e?["left","right"]:["top","bottom"])}function vn(e,t,n,i){const s=[];let o,r,a,l,c,u;for(o=0,r=e.length,c=0;o<r;++o){a=e[o],l=a.box,l.update(a.width||t.w,a.height||t.h,Jd(a.horizontal,t));const{same:f,other:p}=Zd(t,n,a,i);c|=f&&s.length,u=u||p,l.fullSize||s.push(a)}return c&&vn(s,t,n,i)||u}function ii(e,t,n,i,s){e.top=n,e.left=t,e.right=t+i,e.bottom=n+s,e.width=i,e.height=s}function Tr(e,t,n,i){const s=n.padding;let{x:o,y:r}=t;for(const a of e){const l=a.box,c=i[a.stack]||{placed:0,weight:1},u=a.stackWeight/c.weight||1;if(a.horizontal){const f=t.w*u,p=c.size||l.height;Si(c.start)&&(r=c.start),l.fullSize?ii(l,s.left,r,n.outerWidth-s.right-s.left,p):ii(l,t.left+c.placed,r,f,p),c.start=r,c.placed+=f,r=l.bottom}else{const f=t.h*u,p=c.size||l.width;Si(c.start)&&(o=c.start),l.fullSize?ii(l,o,s.top,p,n.outerHeight-s.bottom-s.top):ii(l,o,t.top+c.placed,p,f),c.start=o,c.placed+=f,o=l.right}}t.x=o,t.y=r}var ee={addBox(e,t){e.boxes||(e.boxes=[]),t.fullSize=t.fullSize||!1,t.position=t.position||"top",t.weight=t.weight||0,t._layers=t._layers||function(){return[{z:0,draw(n){t.draw(n)}}]},e.boxes.push(t)},removeBox(e,t){const n=e.boxes?e.boxes.indexOf(t):-1;n!==-1&&e.boxes.splice(n,1)},configure(e,t,n){t.fullSize=n.fullSize,t.position=n.position,t.weight=n.weight},update(e,t,n,i){if(!e)return;const s=Mt(e.options.layout.padding),o=Math.max(t-s.width,0),r=Math.max(n-s.height,0),a=Kd(e.boxes),l=a.vertical,c=a.horizontal;z(e.boxes,y=>{typeof y.beforeLayout=="function"&&y.beforeLayout()});const u=l.reduce((y,v)=>v.box.options&&v.box.options.display===!1?y:y+1,0)||1,f=Object.freeze({outerWidth:t,outerHeight:n,padding:s,availableWidth:o,availableHeight:r,vBoxMaxWidth:o/2/u,hBoxMaxHeight:r/2}),p=Object.assign({},s);Il(p,Mt(i));const g=Object.assign({maxPadding:p,w:o,h:r,x:s.left,y:s.top},s),x=Gd(l.concat(c),f);vn(a.fullSize,g,f,x),vn(l,g,f,x),vn(c,g,f,x)&&vn(l,g,f,x),Qd(g),Tr(a.leftAndTop,g,f,x),g.x+=g.w,g.y+=g.h,Tr(a.rightAndBottom,g,f,x),e.chartArea={left:g.left,top:g.top,right:g.left+g.w,bottom:g.top+g.h,height:g.h,width:g.w},z(a.chartArea,y=>{const v=y.box;Object.assign(v,e.chartArea),v.update(g.w,g.h,{left:0,top:0,right:0,bottom:0})})}};class Ll{acquireContext(t,n){}releaseContext(t){return!1}addEventListener(t,n,i){}removeEventListener(t,n,i){}getDevicePixelRatio(){return 1}getMaximumSize(t,n,i,s){return n=Math.max(0,n||t.width),i=i||t.height,{width:n,height:Math.max(0,s?Math.floor(n/s):i)}}isAttached(t){return!0}updateConfig(t){}}class tp extends Ll{acquireContext(t){return t&&t.getContext&&t.getContext("2d")||null}updateConfig(t){t.options.animation=!1}}const fi="$chartjs",ep={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},Mr=e=>e===null||e==="";function np(e,t){const n=e.style,i=e.getAttribute("height"),s=e.getAttribute("width");if(e[fi]={initial:{height:i,width:s,style:{display:n.display,height:n.height,width:n.width}}},n.display=n.display||"block",n.boxSizing=n.boxSizing||"border-box",Mr(s)){const o=fr(e,"width");o!==void 0&&(e.width=o)}if(Mr(i))if(e.style.height==="")e.height=e.width/(t||2);else{const o=fr(e,"height");o!==void 0&&(e.height=o)}return e}const Rl=hd?{passive:!0}:!1;function ip(e,t,n){e&&e.addEventListener(t,n,Rl)}function sp(e,t,n){e&&e.canvas&&e.canvas.removeEventListener(t,n,Rl)}function op(e,t){const n=ep[e.type]||e.type,{x:i,y:s}=It(e,t);return{type:n,chart:t,native:e,x:i!==void 0?i:null,y:s!==void 0?s:null}}function Ei(e,t){for(const n of e)if(n===t||n.contains(t))return!0}function rp(e,t,n){const i=e.canvas,s=new MutationObserver(o=>{let r=!1;for(const a of o)r=r||Ei(a.addedNodes,i),r=r&&!Ei(a.removedNodes,i);r&&n()});return s.observe(document,{childList:!0,subtree:!0}),s}function ap(e,t,n){const i=e.canvas,s=new MutationObserver(o=>{let r=!1;for(const a of o)r=r||Ei(a.removedNodes,i),r=r&&!Ei(a.addedNodes,i);r&&n()});return s.observe(document,{childList:!0,subtree:!0}),s}const Ln=new Map;let Er=0;function Nl(){const e=window.devicePixelRatio;e!==Er&&(Er=e,Ln.forEach((t,n)=>{n.currentDevicePixelRatio!==e&&t()}))}function lp(e,t){Ln.size||window.addEventListener("resize",Nl),Ln.set(e,t)}function cp(e){Ln.delete(e),Ln.size||window.removeEventListener("resize",Nl)}function up(e,t,n){const i=e.canvas,s=i&&go(i);if(!s)return;const o=gl((a,l)=>{const c=s.clientWidth;n(a,l),c<s.clientWidth&&n()},window),r=new ResizeObserver(a=>{const l=a[0],c=l.contentRect.width,u=l.contentRect.height;c===0&&u===0||o(c,u)});return r.observe(s),lp(e,o),r}function ss(e,t,n){n&&n.disconnect(),t==="resize"&&cp(e)}function hp(e,t,n){const i=e.canvas,s=gl(o=>{e.ctx!==null&&n(op(o,e))},e);return ip(i,t,s),s}class fp extends Ll{acquireContext(t,n){const i=t&&t.getContext&&t.getContext("2d");return i&&i.canvas===t?(np(t,n),i):null}releaseContext(t){const n=t.canvas;if(!n[fi])return!1;const i=n[fi].initial;["height","width"].forEach(o=>{const r=i[o];V(r)?n.removeAttribute(o):n.setAttribute(o,r)});const s=i.style||{};return Object.keys(s).forEach(o=>{n.style[o]=s[o]}),n.width=n.width,delete n[fi],!0}addEventListener(t,n,i){this.removeEventListener(t,n);const s=t.$proxies||(t.$proxies={}),r={attach:rp,detach:ap,resize:up}[n]||hp;s[n]=r(t,n,i)}removeEventListener(t,n){const i=t.$proxies||(t.$proxies={}),s=i[n];if(!s)return;({attach:ss,detach:ss,resize:ss}[n]||sp)(t,n,s),i[n]=void 0}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(t,n,i,s){return ud(t,n,i,s)}isAttached(t){const n=t&&go(t);return!!(n&&n.isConnected)}}function dp(e){return!po()||typeof OffscreenCanvas<"u"&&e instanceof OffscreenCanvas?tp:fp}class en{static defaults={};static defaultRoutes=void 0;x;y;active=!1;options;$animations;tooltipPosition(t){const{x:n,y:i}=this.getProps(["x","y"],t);return{x:n,y:i}}hasValue(){return In(this.x)&&In(this.y)}getProps(t,n){const i=this.$animations;if(!n||!i)return this;const s={};return t.forEach(o=>{s[o]=i[o]&&i[o].active()?i[o]._to:this[o]}),s}}function pp(e,t){const n=e.options.ticks,i=gp(e),s=Math.min(n.maxTicksLimit||i,i),o=n.major.enabled?bp(t):[],r=o.length,a=o[0],l=o[r-1],c=[];if(r>s)return yp(t,c,o,r/s),c;const u=mp(o,t,s);if(r>0){let f,p;const g=r>1?Math.round((l-a)/(r-1)):null;for(si(t,c,u,V(g)?0:a-g,a),f=0,p=r-1;f<p;f++)si(t,c,u,o[f],o[f+1]);return si(t,c,u,l,V(g)?t.length:l+g),c}return si(t,c,u),c}function gp(e){const t=e.options.offset,n=e._tickSize(),i=e._length/n+(t?0:1),s=e._maxLength/n;return Math.floor(Math.min(i,s))}function mp(e,t,n){const i=xp(e),s=t.length/n;if(!i)return Math.max(s,1);const o=rf(i);for(let r=0,a=o.length-1;r<a;r++){const l=o[r];if(l>s)return l}return Math.max(s,1)}function bp(e){const t=[];let n,i;for(n=0,i=e.length;n<i;n++)e[n].major&&t.push(n);return t}function yp(e,t,n,i){let s=0,o=n[0],r;for(i=Math.ceil(i),r=0;r<e.length;r++)r===o&&(t.push(e[r]),s++,o=n[s*i])}function si(e,t,n,i,s){const o=R(i,0),r=Math.min(R(s,e.length),e.length);let a=0,l,c,u;for(n=Math.ceil(n),s&&(l=s-i,n=l/Math.floor(l/n)),u=o;u<0;)a++,u=Math.round(o+a*n);for(c=Math.max(o,0);c<r;c++)c===u&&(t.push(e[c]),a++,u=Math.round(o+a*n))}function xp(e){const t=e.length;let n,i;if(t<2)return!1;for(i=e[0],n=1;n<t;++n)if(e[n]-e[n-1]!==i)return!1;return i}const vp=e=>e==="left"?"right":e==="right"?"left":e,Cr=(e,t,n)=>t==="top"||t==="left"?e[t]+n:e[t]-n,Or=(e,t)=>Math.min(t||e,e);function Pr(e,t){const n=[],i=e.length/t,s=e.length;let o=0;for(;o<s;o+=i)n.push(e[Math.floor(o)]);return n}function _p(e,t,n){const i=e.ticks.length,s=Math.min(t,i-1),o=e._startPixel,r=e._endPixel,a=1e-6;let l=e.getPixelForTick(s),c;if(!(n&&(i===1?c=Math.max(l-o,r-l):t===0?c=(e.getPixelForTick(1)-l)/2:c=(l-e.getPixelForTick(s-1))/2,l+=s<t?c:-c,l<o-a||l>r+a)))return l}function wp(e,t){z(e,n=>{const i=n.gc,s=i.length/2;let o;if(s>t){for(o=0;o<s;++o)delete n.data[i[o]];i.splice(0,s)}})}function gn(e){return e.drawTicks?e.tickLength:0}function Dr(e,t){if(!e.display)return 0;const n=ct(e.font,t),i=Mt(e.padding);return(Q(e.text)?e.text.length:1)*n.lineHeight+i.height}function Sp(e,t){return Le(e,{scale:t,type:"scale"})}function kp(e,t,n){return Le(e,{tick:n,index:t,type:"tick"})}function Tp(e,t,n){let i=ml(e);return(n&&t!=="right"||!n&&t==="right")&&(i=vp(i)),i}function Mp(e,t,n,i){const{top:s,left:o,bottom:r,right:a,chart:l}=e,{chartArea:c,scales:u}=l;let f=0,p,g,x;const y=r-s,v=a-o;if(e.isHorizontal()){if(g=ft(i,o,a),B(n)){const w=Object.keys(n)[0],k=n[w];x=u[w].getPixelForValue(k)+y-t}else n==="center"?x=(c.bottom+c.top)/2+y-t:x=Cr(e,n,t);p=a-o}else{if(B(n)){const w=Object.keys(n)[0],k=n[w];g=u[w].getPixelForValue(k)-v+t}else n==="center"?g=(c.left+c.right)/2-v+t:g=Cr(e,n,t);x=ft(i,r,s),f=n==="left"?-wt:wt}return{titleX:g,titleY:x,maxWidth:p,rotation:f}}class nn extends en{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,n){return t}getUserBounds(){let{_userMin:t,_userMax:n,_suggestedMin:i,_suggestedMax:s}=this;return t=Pt(t,Number.POSITIVE_INFINITY),n=Pt(n,Number.NEGATIVE_INFINITY),i=Pt(i,Number.POSITIVE_INFINITY),s=Pt(s,Number.NEGATIVE_INFINITY),{min:Pt(t,i),max:Pt(n,s),minDefined:xt(t),maxDefined:xt(n)}}getMinMax(t){let{min:n,max:i,minDefined:s,maxDefined:o}=this.getUserBounds(),r;if(s&&o)return{min:n,max:i};const a=this.getMatchingVisibleMetas();for(let l=0,c=a.length;l<c;++l)r=a[l].controller.getMinMax(this,t),s||(n=Math.min(n,r.min)),o||(i=Math.max(i,r.max));return n=o&&n>i?i:n,i=s&&n>i?n:i,{min:Pt(n,Pt(i,n)),max:Pt(i,Pt(n,i))}}getPadding(){return{left:this.paddingLeft||0,top:this.paddingTop||0,right:this.paddingRight||0,bottom:this.paddingBottom||0}}getTicks(){return this.ticks}getLabels(){const t=this.chart.data;return this.options.labels||(this.isHorizontal()?t.xLabels:t.yLabels)||t.labels||[]}getLabelItems(t=this.chart.chartArea){return this._labelItems||(this._labelItems=this._computeLabelItems(t))}beforeLayout(){this._cache={},this._dataLimitsCached=!1}beforeUpdate(){I(this.options.beforeUpdate,[this])}update(t,n,i){const{beginAtZero:s,grace:o,ticks:r}=this.options,a=r.sampleSize;this.beforeUpdate(),this.maxWidth=t,this.maxHeight=n,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=Wf(this,o,s),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();const l=a<this.ticks.length;this._convertTicksToLabels(l?Pr(this.ticks,a):this.ticks),this.configure(),this.beforeCalculateLabelRotation(),this.calculateLabelRotation(),this.afterCalculateLabelRotation(),r.display&&(r.autoSkip||r.source==="auto")&&(this.ticks=pp(this,this.ticks),this._labelSizes=null,this.afterAutoSkip()),l&&this._convertTicksToLabels(this.ticks),this.beforeFit(),this.fit(),this.afterFit(),this.afterUpdate()}configure(){let t=this.options.reverse,n,i;this.isHorizontal()?(n=this.left,i=this.right):(n=this.top,i=this.bottom,t=!t),this._startPixel=n,this._endPixel=i,this._reversePixels=t,this._length=i-n,this._alignToPixels=this.options.alignToPixels}afterUpdate(){I(this.options.afterUpdate,[this])}beforeSetDimensions(){I(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(){I(this.options.afterSetDimensions,[this])}_callHooks(t){this.chart.notifyPlugins(t,this.getContext()),I(this.options[t],[this])}beforeDataLimits(){this._callHooks("beforeDataLimits")}determineDataLimits(){}afterDataLimits(){this._callHooks("afterDataLimits")}beforeBuildTicks(){this._callHooks("beforeBuildTicks")}buildTicks(){return[]}afterBuildTicks(){this._callHooks("afterBuildTicks")}beforeTickToLabelConversion(){I(this.options.beforeTickToLabelConversion,[this])}generateTickLabels(t){const n=this.options.ticks;let i,s,o;for(i=0,s=t.length;i<s;i++)o=t[i],o.label=I(n.callback,[o.value,i,t],this)}afterTickToLabelConversion(){I(this.options.afterTickToLabelConversion,[this])}beforeCalculateLabelRotation(){I(this.options.beforeCalculateLabelRotation,[this])}calculateLabelRotation(){const t=this.options,n=t.ticks,i=Or(this.ticks.length,t.ticks.maxTicksLimit),s=n.minRotation||0,o=n.maxRotation;let r=s,a,l,c;if(!this._isVisible()||!n.display||s>=o||i<=1||!this.isHorizontal()){this.labelRotation=s;return}const u=this._getLabelSizes(),f=u.widest.width,p=u.highest.height,g=yt(this.chart.width-f,0,this.maxWidth);a=t.offset?this.maxWidth/i:g/(i-1),f+6>a&&(a=g/(i-(t.offset?.5:1)),l=this.maxHeight-gn(t.grid)-n.padding-Dr(t.title,this.chart.options.font),c=Math.sqrt(f*f+p*p),r=uf(Math.min(Math.asin(yt((u.highest.height+6)/a,-1,1)),Math.asin(yt(l/c,-1,1))-Math.asin(yt(p/c,-1,1)))),r=Math.max(s,Math.min(o,r))),this.labelRotation=r}afterCalculateLabelRotation(){I(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){I(this.options.beforeFit,[this])}fit(){const t={width:0,height:0},{chart:n,options:{ticks:i,title:s,grid:o}}=this,r=this._isVisible(),a=this.isHorizontal();if(r){const l=Dr(s,n.options.font);if(a?(t.width=this.maxWidth,t.height=gn(o)+l):(t.height=this.maxHeight,t.width=gn(o)+l),i.display&&this.ticks.length){const{first:c,last:u,widest:f,highest:p}=this._getLabelSizes(),g=i.padding*2,x=Me(this.labelRotation),y=Math.cos(x),v=Math.sin(x);if(a){const w=i.mirror?0:v*f.width+y*p.height;t.height=Math.min(this.maxHeight,t.height+w+g)}else{const w=i.mirror?0:y*f.width+v*p.height;t.width=Math.min(this.maxWidth,t.width+w+g)}this._calculatePadding(c,u,v,y)}}this._handleMargins(),a?(this.width=this._length=n.width-this._margins.left-this._margins.right,this.height=t.height):(this.width=t.width,this.height=this._length=n.height-this._margins.top-this._margins.bottom)}_calculatePadding(t,n,i,s){const{ticks:{align:o,padding:r},position:a}=this.options,l=this.labelRotation!==0,c=a!=="top"&&this.axis==="x";if(this.isHorizontal()){const u=this.getPixelForTick(0)-this.left,f=this.right-this.getPixelForTick(this.ticks.length-1);let p=0,g=0;l?c?(p=s*t.width,g=i*n.height):(p=i*t.height,g=s*n.width):o==="start"?g=n.width:o==="end"?p=t.width:o!=="inner"&&(p=t.width/2,g=n.width/2),this.paddingLeft=Math.max((p-u+r)*this.width/(this.width-u),0),this.paddingRight=Math.max((g-f+r)*this.width/(this.width-f),0)}else{let u=n.height/2,f=t.height/2;o==="start"?(u=0,f=t.height):o==="end"&&(u=n.height,f=0),this.paddingTop=u+r,this.paddingBottom=f+r}}_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(){I(this.options.afterFit,[this])}isHorizontal(){const{axis:t,position:n}=this.options;return n==="top"||n==="bottom"||t==="x"}isFullSize(){return this.options.fullSize}_convertTicksToLabels(t){this.beforeTickToLabelConversion(),this.generateTickLabels(t);let n,i;for(n=0,i=t.length;n<i;n++)V(t[n].label)&&(t.splice(n,1),i--,n--);this.afterTickToLabelConversion()}_getLabelSizes(){let t=this._labelSizes;if(!t){const n=this.options.ticks.sampleSize;let i=this.ticks;n<i.length&&(i=Pr(i,n)),this._labelSizes=t=this._computeLabelSizes(i,i.length,this.options.ticks.maxTicksLimit)}return t}_computeLabelSizes(t,n,i){const{ctx:s,_longestTextCache:o}=this,r=[],a=[],l=Math.floor(n/Or(n,i));let c=0,u=0,f,p,g,x,y,v,w,k,C,O,T;for(f=0;f<n;f+=l){if(x=t[f].label,y=this._resolveTickFontOptions(f),s.font=v=y.string,w=o[v]=o[v]||{data:{},gc:[]},k=y.lineHeight,C=O=0,!V(x)&&!Q(x))C=ar(s,w.data,w.gc,C,x),O=k;else if(Q(x))for(p=0,g=x.length;p<g;++p)T=x[p],!V(T)&&!Q(T)&&(C=ar(s,w.data,w.gc,C,T),O+=k);r.push(C),a.push(O),c=Math.max(C,c),u=Math.max(O,u)}wp(o,n);const D=r.indexOf(c),P=a.indexOf(u),E=A=>({width:r[A]||0,height:a[A]||0});return{first:E(0),last:E(n-1),widest:E(D),highest:E(P),widths:r,heights:a}}getLabelForValue(t){return t}getPixelForValue(t,n){return NaN}getValueForPixel(t){}getPixelForTick(t){const n=this.ticks;return t<0||t>n.length-1?null:this.getPixelForValue(n[t].value)}getPixelForDecimal(t){this._reversePixels&&(t=1-t);const n=this._startPixel+t*this._length;return df(this._alignToPixels?_e(this.chart,n,0):n)}getDecimalForPixel(t){const n=(t-this._startPixel)/this._length;return this._reversePixels?1-n:n}getBasePixel(){return this.getPixelForValue(this.getBaseValue())}getBaseValue(){const{min:t,max:n}=this;return t<0&&n<0?n:t>0&&n>0?t:0}getContext(t){const n=this.ticks||[];if(t>=0&&t<n.length){const i=n[t];return i.$context||(i.$context=kp(this.getContext(),t,i))}return this.$context||(this.$context=Sp(this.chart.getContext(),this))}_tickSize(){const t=this.options.ticks,n=Me(this.labelRotation),i=Math.abs(Math.cos(n)),s=Math.abs(Math.sin(n)),o=this._getLabelSizes(),r=t.autoSkipPadding||0,a=o?o.widest.width+r:0,l=o?o.highest.height+r:0;return this.isHorizontal()?l*i>a*s?a/i:l/s:l*s<a*i?l/i:a/s}_isVisible(){const t=this.options.display;return t!=="auto"?!!t:this.getMatchingVisibleMetas().length>0}_computeGridLineItems(t){const n=this.axis,i=this.chart,s=this.options,{grid:o,position:r,border:a}=s,l=o.offset,c=this.isHorizontal(),f=this.ticks.length+(l?1:0),p=gn(o),g=[],x=a.setContext(this.getContext()),y=x.display?x.width:0,v=y/2,w=function(q){return _e(i,q,y)};let k,C,O,T,D,P,E,A,F,L,H,K;if(r==="top")k=w(this.bottom),P=this.bottom-p,A=k-v,L=w(t.top)+v,K=t.bottom;else if(r==="bottom")k=w(this.top),L=t.top,K=w(t.bottom)-v,P=k+v,A=this.top+p;else if(r==="left")k=w(this.right),D=this.right-p,E=k-v,F=w(t.left)+v,H=t.right;else if(r==="right")k=w(this.left),F=t.left,H=w(t.right)-v,D=k+v,E=this.left+p;else if(n==="x"){if(r==="center")k=w((t.top+t.bottom)/2+.5);else if(B(r)){const q=Object.keys(r)[0],nt=r[q];k=w(this.chart.scales[q].getPixelForValue(nt))}L=t.top,K=t.bottom,P=k+v,A=P+p}else if(n==="y"){if(r==="center")k=w((t.left+t.right)/2);else if(B(r)){const q=Object.keys(r)[0],nt=r[q];k=w(this.chart.scales[q].getPixelForValue(nt))}D=k-v,E=D-p,F=t.left,H=t.right}const et=R(s.ticks.maxTicksLimit,f),j=Math.max(1,Math.ceil(f/et));for(C=0;C<f;C+=j){const q=this.getContext(C),nt=o.setContext(q),Ne=a.setContext(q),pe=nt.lineWidth,qt=nt.color,ze=Ne.dash||[],dt=Ne.dashOffset,ge=nt.tickWidth,vt=nt.tickColor,me=nt.tickBorderDash||[],Ht=nt.tickBorderDashOffset;O=_p(this,C,l),O!==void 0&&(T=_e(i,O,pe),c?D=E=F=H=T:P=A=L=K=T,g.push({tx1:D,ty1:P,tx2:E,ty2:A,x1:F,y1:L,x2:H,y2:K,width:pe,color:qt,borderDash:ze,borderDashOffset:dt,tickWidth:ge,tickColor:vt,tickBorderDash:me,tickBorderDashOffset:Ht}))}return this._ticksLength=f,this._borderValue=k,g}_computeLabelItems(t){const n=this.axis,i=this.options,{position:s,ticks:o}=i,r=this.isHorizontal(),a=this.ticks,{align:l,crossAlign:c,padding:u,mirror:f}=o,p=gn(i.grid),g=p+u,x=f?-u:g,y=-Me(this.labelRotation),v=[];let w,k,C,O,T,D,P,E,A,F,L,H,K="middle";if(s==="top")D=this.bottom-x,P=this._getXAxisLabelAlignment();else if(s==="bottom")D=this.top+x,P=this._getXAxisLabelAlignment();else if(s==="left"){const j=this._getYAxisLabelAlignment(p);P=j.textAlign,T=j.x}else if(s==="right"){const j=this._getYAxisLabelAlignment(p);P=j.textAlign,T=j.x}else if(n==="x"){if(s==="center")D=(t.top+t.bottom)/2+g;else if(B(s)){const j=Object.keys(s)[0],q=s[j];D=this.chart.scales[j].getPixelForValue(q)+g}P=this._getXAxisLabelAlignment()}else if(n==="y"){if(s==="center")T=(t.left+t.right)/2-g;else if(B(s)){const j=Object.keys(s)[0],q=s[j];T=this.chart.scales[j].getPixelForValue(q)}P=this._getYAxisLabelAlignment(p).textAlign}n==="y"&&(l==="start"?K="top":l==="end"&&(K="bottom"));const et=this._getLabelSizes();for(w=0,k=a.length;w<k;++w){C=a[w],O=C.label;const j=o.setContext(this.getContext(w));E=this.getPixelForTick(w)+o.labelOffset,A=this._resolveTickFontOptions(w),F=A.lineHeight,L=Q(O)?O.length:1;const q=L/2,nt=j.color,Ne=j.textStrokeColor,pe=j.textStrokeWidth;let qt=P;r?(T=E,P==="inner"&&(w===k-1?qt=this.options.reverse?"left":"right":w===0?qt=this.options.reverse?"right":"left":qt="center"),s==="top"?c==="near"||y!==0?H=-L*F+F/2:c==="center"?H=-et.highest.height/2-q*F+F:H=-et.highest.height+F/2:c==="near"||y!==0?H=F/2:c==="center"?H=et.highest.height/2-q*F:H=et.highest.height-L*F,f&&(H*=-1),y!==0&&!j.showLabelBackdrop&&(T+=F/2*Math.sin(y))):(D=E,H=(1-L)*F/2);let ze;if(j.showLabelBackdrop){const dt=Mt(j.backdropPadding),ge=et.heights[w],vt=et.widths[w];let me=H-dt.top,Ht=0-dt.left;switch(K){case"middle":me-=ge/2;break;case"bottom":me-=ge;break}switch(P){case"center":Ht-=vt/2;break;case"right":Ht-=vt;break;case"inner":w===k-1?Ht-=vt:w>0&&(Ht-=vt/2);break}ze={left:Ht,top:me,width:vt+dt.width,height:ge+dt.height,color:j.backdropColor}}v.push({label:O,font:A,textOffset:H,options:{rotation:y,color:nt,strokeColor:Ne,strokeWidth:pe,textAlign:qt,textBaseline:K,translation:[T,D],backdrop:ze}})}return v}_getXAxisLabelAlignment(){const{position:t,ticks:n}=this.options;if(-Me(this.labelRotation))return t==="top"?"left":"right";let s="center";return n.align==="start"?s="left":n.align==="end"?s="right":n.align==="inner"&&(s="inner"),s}_getYAxisLabelAlignment(t){const{position:n,ticks:{crossAlign:i,mirror:s,padding:o}}=this.options,r=this._getLabelSizes(),a=t+o,l=r.widest.width;let c,u;return n==="left"?s?(u=this.right+o,i==="near"?c="left":i==="center"?(c="center",u+=l/2):(c="right",u+=l)):(u=this.right-a,i==="near"?c="right":i==="center"?(c="center",u-=l/2):(c="left",u=this.left)):n==="right"?s?(u=this.left+o,i==="near"?c="right":i==="center"?(c="center",u-=l/2):(c="left",u-=l)):(u=this.left+a,i==="near"?c="left":i==="center"?(c="center",u+=l/2):(c="right",u=this.right)):c="right",{textAlign:c,x:u}}_computeLabelArea(){if(this.options.ticks.mirror)return;const t=this.chart,n=this.options.position;if(n==="left"||n==="right")return{top:0,left:this.left,bottom:t.height,right:this.right};if(n==="top"||n==="bottom")return{top:this.top,left:0,bottom:this.bottom,right:t.width}}drawBackground(){const{ctx:t,options:{backgroundColor:n},left:i,top:s,width:o,height:r}=this;n&&(t.save(),t.fillStyle=n,t.fillRect(i,s,o,r),t.restore())}getLineWidthForValue(t){const n=this.options.grid;if(!this._isVisible()||!n.display)return 0;const s=this.ticks.findIndex(o=>o.value===t);return s>=0?n.setContext(this.getContext(s)).lineWidth:0}drawGrid(t){const n=this.options.grid,i=this.ctx,s=this._gridLineItems||(this._gridLineItems=this._computeGridLineItems(t));let o,r;const a=(l,c,u)=>{!u.width||!u.color||(i.save(),i.lineWidth=u.width,i.strokeStyle=u.color,i.setLineDash(u.borderDash||[]),i.lineDashOffset=u.borderDashOffset,i.beginPath(),i.moveTo(l.x,l.y),i.lineTo(c.x,c.y),i.stroke(),i.restore())};if(n.display)for(o=0,r=s.length;o<r;++o){const l=s[o];n.drawOnChartArea&&a({x:l.x1,y:l.y1},{x:l.x2,y:l.y2},l),n.drawTicks&&a({x:l.tx1,y:l.ty1},{x:l.tx2,y:l.ty2},{color:l.tickColor,width:l.tickWidth,borderDash:l.tickBorderDash,borderDashOffset:l.tickBorderDashOffset})}}drawBorder(){const{chart:t,ctx:n,options:{border:i,grid:s}}=this,o=i.setContext(this.getContext()),r=i.display?o.width:0;if(!r)return;const a=s.setContext(this.getContext(0)).lineWidth,l=this._borderValue;let c,u,f,p;this.isHorizontal()?(c=_e(t,this.left,r)-r/2,u=_e(t,this.right,a)+a/2,f=p=l):(f=_e(t,this.top,r)-r/2,p=_e(t,this.bottom,a)+a/2,c=u=l),n.save(),n.lineWidth=o.width,n.strokeStyle=o.color,n.beginPath(),n.moveTo(c,f),n.lineTo(u,p),n.stroke(),n.restore()}drawLabels(t){if(!this.options.ticks.display)return;const i=this.ctx,s=this._computeLabelArea();s&&lo(i,s);const o=this.getLabelItems(t);for(const r of o){const a=r.options,l=r.font,c=r.label,u=r.textOffset;Ti(i,c,0,u,l,a)}s&&co(i)}drawTitle(){const{ctx:t,options:{position:n,title:i,reverse:s}}=this;if(!i.display)return;const o=ct(i.font),r=Mt(i.padding),a=i.align;let l=o.lineHeight/2;n==="bottom"||n==="center"||B(n)?(l+=r.bottom,Q(i.text)&&(l+=o.lineHeight*(i.text.length-1))):l+=r.top;const{titleX:c,titleY:u,maxWidth:f,rotation:p}=Mp(this,l,n,a);Ti(t,i.text,0,0,o,{color:i.color,maxWidth:f,rotation:p,textAlign:Tp(a,n,s),textBaseline:"middle",translation:[c,u]})}draw(t){this._isVisible()&&(this.drawBackground(),this.drawGrid(t),this.drawBorder(),this.drawTitle(),this.drawLabels(t))}_layers(){const t=this.options,n=t.ticks&&t.ticks.z||0,i=R(t.grid&&t.grid.z,-1),s=R(t.border&&t.border.z,0);return!this._isVisible()||this.draw!==nn.prototype.draw?[{z:n,draw:o=>{this.draw(o)}}]:[{z:i,draw:o=>{this.drawBackground(),this.drawGrid(o),this.drawTitle()}},{z:s,draw:()=>{this.drawBorder()}},{z:n,draw:o=>{this.drawLabels(o)}}]}getMatchingVisibleMetas(t){const n=this.chart.getSortedVisibleDatasetMetas(),i=this.axis+"AxisID",s=[];let o,r;for(o=0,r=n.length;o<r;++o){const a=n[o];a[i]===this.id&&(!t||a.type===t)&&s.push(a)}return s}_resolveTickFontOptions(t){const n=this.options.ticks.setContext(this.getContext(t));return ct(n.font)}_maxDigits(){const t=this._resolveTickFontOptions(0).lineHeight;return(this.isHorizontal()?this.width:this.height)/t}}class oi{constructor(t,n,i){this.type=t,this.scope=n,this.override=i,this.items=Object.create(null)}isForType(t){return Object.prototype.isPrototypeOf.call(this.type.prototype,t.prototype)}register(t){const n=Object.getPrototypeOf(t);let i;Op(n)&&(i=this.register(n));const s=this.items,o=t.id,r=this.scope+"."+o;if(!o)throw new Error("class does not have id: "+t);return o in s||(s[o]=t,Ep(t,r,i),this.override&&Y.override(t.id,t.overrides)),r}get(t){return this.items[t]}unregister(t){const n=this.items,i=t.id,s=this.scope;i in n&&delete n[i],s&&i in Y[s]&&(delete Y[s][i],this.override&&delete Ae[i])}}function Ep(e,t,n){const i=An(Object.create(null),[n?Y.get(n):{},Y.get(t),e.defaults]);Y.set(t,i),e.defaultRoutes&&Cp(t,e.defaultRoutes),e.descriptors&&Y.describe(t,e.descriptors)}function Cp(e,t){Object.keys(t).forEach(n=>{const i=n.split("."),s=i.pop(),o=[e].concat(i).join("."),r=t[n].split("."),a=r.pop(),l=r.join(".");Y.route(o,s,l,a)})}function Op(e){return"id"in e&&"defaults"in e}class Pp{constructor(){this.controllers=new oi(Dl,"datasets",!0),this.elements=new oi(en,"elements"),this.plugins=new oi(Object,"plugins"),this.scales=new oi(nn,"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,n,i){[...n].forEach(s=>{const o=i||this._getRegistryForType(s);i||o.isForType(s)||o===this.plugins&&s.id?this._exec(t,o,s):z(s,r=>{const a=i||this._getRegistryForType(r);this._exec(t,a,r)})})}_exec(t,n,i){const s=oo(t);I(i["before"+s],[],i),n[t](i),I(i["after"+s],[],i)}_getRegistryForType(t){for(let n=0;n<this._typedRegistries.length;n++){const i=this._typedRegistries[n];if(i.isForType(t))return i}return this.plugins}_get(t,n,i){const s=n.get(t);if(s===void 0)throw new Error('"'+t+'" is not a registered '+i+".");return s}}var At=new Pp;class Dp{constructor(){this._init=[]}notify(t,n,i,s){n==="beforeInit"&&(this._init=this._createDescriptors(t,!0),this._notify(this._init,t,"install"));const o=s?this._descriptors(t).filter(s):this._descriptors(t),r=this._notify(o,t,n,i);return n==="afterDestroy"&&(this._notify(o,t,"stop"),this._notify(this._init,t,"uninstall")),r}_notify(t,n,i,s){s=s||{};for(const o of t){const r=o.plugin,a=r[i],l=[n,s,o.options];if(I(a,l,r)===!1&&s.cancelable)return!1}return!0}invalidate(){V(this._cache)||(this._oldCache=this._cache,this._cache=void 0)}_descriptors(t){if(this._cache)return this._cache;const n=this._cache=this._createDescriptors(t);return this._notifyStateChanges(t),n}_createDescriptors(t,n){const i=t&&t.config,s=R(i.options&&i.options.plugins,{}),o=Ap(i);return s===!1&&!n?[]:Lp(t,o,s,n)}_notifyStateChanges(t){const n=this._oldCache||[],i=this._cache,s=(o,r)=>o.filter(a=>!r.some(l=>a.plugin.id===l.plugin.id));this._notify(s(n,i),t,"stop"),this._notify(s(i,n),t,"start")}}function Ap(e){const t={},n=[],i=Object.keys(At.plugins.items);for(let o=0;o<i.length;o++)n.push(At.getPlugin(i[o]));const s=e.plugins||[];for(let o=0;o<s.length;o++){const r=s[o];n.indexOf(r)===-1&&(n.push(r),t[r.id]=!0)}return{plugins:n,localIds:t}}function Ip(e,t){return!t&&e===!1?null:e===!0?{}:e}function Lp(e,{plugins:t,localIds:n},i,s){const o=[],r=e.getContext();for(const a of t){const l=a.id,c=Ip(i[l],s);c!==null&&o.push({plugin:a,options:Rp(e.config,{plugin:a,local:n[l]},c,r)})}return o}function Rp(e,{plugin:t,local:n},i,s){const o=e.pluginScopeKeys(t),r=e.getOptionScopes(i,o);return n&&t.defaults&&r.push(t.defaults),e.createResolver(r,s,[""],{scriptable:!1,indexable:!1,allKeys:!0})}function Rs(e,t){const n=Y.datasets[e]||{};return((t.datasets||{})[e]||{}).indexAxis||t.indexAxis||n.indexAxis||"x"}function Np(e,t){let n=e;return e==="_index_"?n=t:e==="_value_"&&(n=t==="x"?"y":"x"),n}function zp(e,t){return e===t?"_index_":"_value_"}function Ar(e){if(e==="x"||e==="y"||e==="r")return e}function Fp(e){if(e==="top"||e==="bottom")return"x";if(e==="left"||e==="right")return"y"}function Ns(e,...t){if(Ar(e))return e;for(const n of t){const i=n.axis||Fp(n.position)||e.length>1&&Ar(e[0].toLowerCase());if(i)return i}throw new Error(\`Cannot determine type of '\${e}' axis. Please provide 'axis' or 'position' option.\`)}function Ir(e,t,n){if(n[t+"AxisID"]===e)return{axis:t}}function Hp(e,t){if(t.data&&t.data.datasets){const n=t.data.datasets.filter(i=>i.xAxisID===e||i.yAxisID===e);if(n.length)return Ir(e,"x",n[0])||Ir(e,"y",n[0])}return{}}function Bp(e,t){const n=Ae[e.type]||{scales:{}},i=t.scales||{},s=Rs(e.type,t),o=Object.create(null);return Object.keys(i).forEach(r=>{const a=i[r];if(!B(a))return console.error(\`Invalid scale configuration for scale: \${r}\`);if(a._proxy)return console.warn(\`Ignoring resolver passed as options for scale: \${r}\`);const l=Ns(r,a,Hp(r,e),Y.scales[a.type]),c=zp(l,s),u=n.scales||{};o[r]=wn(Object.create(null),[{axis:l},a,u[l],u[c]])}),e.data.datasets.forEach(r=>{const a=r.type||e.type,l=r.indexAxis||Rs(a,t),u=(Ae[a]||{}).scales||{};Object.keys(u).forEach(f=>{const p=Np(f,l),g=r[p+"AxisID"]||p;o[g]=o[g]||Object.create(null),wn(o[g],[{axis:p},i[g],u[f]])})}),Object.keys(o).forEach(r=>{const a=o[r];wn(a,[Y.scales[a.type],Y.scale])}),o}function zl(e){const t=e.options||(e.options={});t.plugins=R(t.plugins,{}),t.scales=Bp(e,t)}function Fl(e){return e=e||{},e.datasets=e.datasets||[],e.labels=e.labels||[],e}function Vp(e){return e=e||{},e.data=Fl(e.data),zl(e),e}const Lr=new Map,Hl=new Set;function ri(e,t){let n=Lr.get(e);return n||(n=t(),Lr.set(e,n),Hl.add(n)),n}const mn=(e,t,n)=>{const i=wi(t,n);i!==void 0&&e.add(i)};class Wp{constructor(t){this._config=Vp(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=Fl(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(),zl(t)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(t){return ri(t,()=>[[\`datasets.\${t}\`,""]])}datasetAnimationScopeKeys(t,n){return ri(\`\${t}.transition.\${n}\`,()=>[[\`datasets.\${t}.transitions.\${n}\`,\`transitions.\${n}\`],[\`datasets.\${t}\`,""]])}datasetElementScopeKeys(t,n){return ri(\`\${t}-\${n}\`,()=>[[\`datasets.\${t}.elements.\${n}\`,\`datasets.\${t}\`,\`elements.\${n}\`,""]])}pluginScopeKeys(t){const n=t.id,i=this.type;return ri(\`\${i}-plugin-\${n}\`,()=>[[\`plugins.\${n}\`,...t.additionalOptionScopes||[]]])}_cachedScopes(t,n){const i=this._scopeCache;let s=i.get(t);return(!s||n)&&(s=new Map,i.set(t,s)),s}getOptionScopes(t,n,i){const{options:s,type:o}=this,r=this._cachedScopes(t,i),a=r.get(n);if(a)return a;const l=new Set;n.forEach(u=>{t&&(l.add(t),u.forEach(f=>mn(l,t,f))),u.forEach(f=>mn(l,s,f)),u.forEach(f=>mn(l,Ae[o]||{},f)),u.forEach(f=>mn(l,Y,f)),u.forEach(f=>mn(l,As,f))});const c=Array.from(l);return c.length===0&&c.push(Object.create(null)),Hl.has(n)&&r.set(n,c),c}chartOptionScopes(){const{options:t,type:n}=this;return[t,Ae[n]||{},Y.datasets[n]||{},{type:n},Y,As]}resolveNamedOptions(t,n,i,s=[""]){const o={$shared:!0},{resolver:r,subPrefixes:a}=Rr(this._resolverCache,t,s);let l=r;if(Up(r,n)){o.$shared=!1,i=le(i)?i():i;const c=this.createResolver(t,i,a);l=Qe(r,i,c)}for(const c of n)o[c]=l[c];return o}createResolver(t,n,i=[""],s){const{resolver:o}=Rr(this._resolverCache,t,i);return B(n)?Qe(o,n,void 0,s):o}}function Rr(e,t,n){let i=e.get(t);i||(i=new Map,e.set(t,i));const s=n.join();let o=i.get(s);return o||(o={resolver:uo(t,n),subPrefixes:n.filter(a=>!a.toLowerCase().includes("hover"))},i.set(s,o)),o}const jp=e=>B(e)&&Object.getOwnPropertyNames(e).some(t=>le(e[t]));function Up(e,t){const{isScriptable:n,isIndexable:i}=_l(e);for(const s of t){const o=n(s),r=i(s),a=(r||o)&&e[s];if(o&&(le(a)||jp(a))||r&&Q(a))return!0}return!1}var $p="4.5.0";const Yp=["top","bottom","left","right","chartArea"];function Nr(e,t){return e==="top"||e==="bottom"||Yp.indexOf(e)===-1&&t==="x"}function zr(e,t){return function(n,i){return n[e]===i[e]?n[t]-i[t]:n[e]-i[e]}}function Fr(e){const t=e.chart,n=t.options.animation;t.notifyPlugins("afterRender"),I(n&&n.onComplete,[e],t)}function Xp(e){const t=e.chart,n=t.options.animation;I(n&&n.onProgress,[e],t)}function Bl(e){return po()&&typeof e=="string"?e=document.getElementById(e):e&&e.length&&(e=e[0]),e&&e.canvas&&(e=e.canvas),e}const di={},Hr=e=>{const t=Bl(e);return Object.values(di).filter(n=>n.canvas===t).pop()};function qp(e,t,n){const i=Object.keys(e);for(const s of i){const o=+s;if(o>=t){const r=e[s];delete e[s],(n>0||o>t)&&(e[o+n]=r)}}}function Gp(e,t,n,i){return!n||e.type==="mouseout"?null:i?t:e}class zs{static defaults=Y;static instances=di;static overrides=Ae;static registry=At;static version=$p;static getChart=Hr;static register(...t){At.add(...t),Br()}static unregister(...t){At.remove(...t),Br()}constructor(t,n){const i=this.config=new Wp(n),s=Bl(t),o=Hr(s);if(o)throw new Error("Canvas is already in use. Chart with ID '"+o.id+"' must be destroyed before the canvas with ID '"+o.canvas.id+"' can be reused.");const r=i.createResolver(i.chartOptionScopes(),this.getContext());this.platform=new(i.platform||dp(s)),this.platform.updateConfig(i);const a=this.platform.acquireContext(s,r.aspectRatio),l=a&&a.canvas,c=l&&l.height,u=l&&l.width;if(this.id=Kh(),this.ctx=a,this.canvas=l,this.width=u,this.height=c,this._options=r,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 Dp,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=yf(f=>this.update(f),r.resizeDelay||0),this._dataChanges=[],di[this.id]=this,!a||!l){console.error("Failed to create chart: can't acquire context from the given item");return}jt.listen(this,"complete",Fr),jt.listen(this,"progress",Xp),this._initialize(),this.attached&&this.update()}get aspectRatio(){const{options:{aspectRatio:t,maintainAspectRatio:n},width:i,height:s,_aspectRatio:o}=this;return V(t)?n&&o?o:s?i/s:null:t}get data(){return this.config.data}set data(t){this.config.data=t}get options(){return this._options}set options(t){this.config.options=t}get registry(){return At}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():hr(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return lr(this.canvas,this.ctx),this}stop(){return jt.stop(this),this}resize(t,n){jt.running(this)?this._resizeBeforeDraw={width:t,height:n}:this._resize(t,n)}_resize(t,n){const i=this.options,s=this.canvas,o=i.maintainAspectRatio&&this.aspectRatio,r=this.platform.getMaximumSize(s,t,n,o),a=i.devicePixelRatio||this.platform.getDevicePixelRatio(),l=this.width?"resize":"attach";this.width=r.width,this.height=r.height,this._aspectRatio=this.aspectRatio,hr(this,a,!0)&&(this.notifyPlugins("resize",{size:r}),I(i.onResize,[this,r],this),this.attached&&this._doResize(l)&&this.render())}ensureScalesHaveIDs(){const n=this.options.scales||{};z(n,(i,s)=>{i.id=s})}buildOrUpdateScales(){const t=this.options,n=t.scales,i=this.scales,s=Object.keys(i).reduce((r,a)=>(r[a]=!1,r),{});let o=[];n&&(o=o.concat(Object.keys(n).map(r=>{const a=n[r],l=Ns(r,a),c=l==="r",u=l==="x";return{options:a,dposition:c?"chartArea":u?"bottom":"left",dtype:c?"radialLinear":u?"category":"linear"}}))),z(o,r=>{const a=r.options,l=a.id,c=Ns(l,a),u=R(a.type,r.dtype);(a.position===void 0||Nr(a.position,c)!==Nr(r.dposition))&&(a.position=r.dposition),s[l]=!0;let f=null;if(l in i&&i[l].type===u)f=i[l];else{const p=At.getScale(u);f=new p({id:l,type:u,ctx:this.ctx,chart:this}),i[f.id]=f}f.init(a,t)}),z(s,(r,a)=>{r||delete i[a]}),z(i,r=>{ee.configure(this,r,r.options),ee.addBox(this,r)})}_updateMetasets(){const t=this._metasets,n=this.data.datasets.length,i=t.length;if(t.sort((s,o)=>s.index-o.index),i>n){for(let s=n;s<i;++s)this._destroyDatasetMeta(s);t.splice(n,i-n)}this._sortedMetasets=t.slice(0).sort(zr("order","index"))}_removeUnreferencedMetasets(){const{_metasets:t,data:{datasets:n}}=this;t.length>n.length&&delete this._stacks,t.forEach((i,s)=>{n.filter(o=>o===i._dataset).length===0&&this._destroyDatasetMeta(s)})}buildOrUpdateControllers(){const t=[],n=this.data.datasets;let i,s;for(this._removeUnreferencedMetasets(),i=0,s=n.length;i<s;i++){const o=n[i];let r=this.getDatasetMeta(i);const a=o.type||this.config.type;if(r.type&&r.type!==a&&(this._destroyDatasetMeta(i),r=this.getDatasetMeta(i)),r.type=a,r.indexAxis=o.indexAxis||Rs(a,this.options),r.order=o.order||0,r.index=i,r.label=""+o.label,r.visible=this.isDatasetVisible(i),r.controller)r.controller.updateIndex(i),r.controller.linkScales();else{const l=At.getController(a),{datasetElementType:c,dataElementType:u}=Y.datasets[a];Object.assign(l,{dataElementType:At.getElement(u),datasetElementType:c&&At.getElement(c)}),r.controller=new l(this,i),t.push(r.controller)}}return this._updateMetasets(),t}_resetElements(){z(this.data.datasets,(t,n)=>{this.getDatasetMeta(n).controller.reset()},this)}reset(){this._resetElements(),this.notifyPlugins("reset")}update(t){const n=this.config;n.update();const i=this._options=n.createResolver(n.chartOptionScopes(),this.getContext()),s=this._animationsDisabled=!i.animation;if(this._updateScales(),this._checkEventBindings(),this._updateHiddenIndices(),this._plugins.invalidate(),this.notifyPlugins("beforeUpdate",{mode:t,cancelable:!0})===!1)return;const o=this.buildOrUpdateControllers();this.notifyPlugins("beforeElementsUpdate");let r=0;for(let c=0,u=this.data.datasets.length;c<u;c++){const{controller:f}=this.getDatasetMeta(c),p=!s&&o.indexOf(f)===-1;f.buildOrUpdateElements(p),r=Math.max(+f.getMaxOverflow(),r)}r=this._minPadding=i.layout.autoPadding?r:0,this._updateLayout(r),s||z(o,c=>{c.reset()}),this._updateDatasets(t),this.notifyPlugins("afterUpdate",{mode:t}),this._layers.sort(zr("z","_idx"));const{_active:a,_lastEvent:l}=this;l?this._eventHandler(l,!0):a.length&&this._updateHoverStyles(a,a,!0),this.render()}_updateScales(){z(this.scales,t=>{ee.removeBox(this,t)}),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){const t=this.options,n=new Set(Object.keys(this._listeners)),i=new Set(t.events);(!Qo(n,i)||!!this._responsiveListeners!==t.responsive)&&(this.unbindEvents(),this.bindEvents())}_updateHiddenIndices(){const{_hiddenIndices:t}=this,n=this._getUniformDataChanges()||[];for(const{method:i,start:s,count:o}of n){const r=i==="_removeElements"?-o:o;qp(t,s,r)}}_getUniformDataChanges(){const t=this._dataChanges;if(!t||!t.length)return;this._dataChanges=[];const n=this.data.datasets.length,i=o=>new Set(t.filter(r=>r[0]===o).map((r,a)=>a+","+r.splice(1).join(","))),s=i(0);for(let o=1;o<n;o++)if(!Qo(s,i(o)))return;return Array.from(s).map(o=>o.split(",")).map(o=>({method:o[1],start:+o[2],count:+o[3]}))}_updateLayout(t){if(this.notifyPlugins("beforeLayout",{cancelable:!0})===!1)return;ee.update(this,this.width,this.height,t);const n=this.chartArea,i=n.width<=0||n.height<=0;this._layers=[],z(this.boxes,s=>{i&&s.position==="chartArea"||(s.configure&&s.configure(),this._layers.push(...s._layers()))},this),this._layers.forEach((s,o)=>{s._idx=o}),this.notifyPlugins("afterLayout")}_updateDatasets(t){if(this.notifyPlugins("beforeDatasetsUpdate",{mode:t,cancelable:!0})!==!1){for(let n=0,i=this.data.datasets.length;n<i;++n)this.getDatasetMeta(n).controller.configure();for(let n=0,i=this.data.datasets.length;n<i;++n)this._updateDataset(n,le(t)?t({datasetIndex:n}):t);this.notifyPlugins("afterDatasetsUpdate",{mode:t})}}_updateDataset(t,n){const i=this.getDatasetMeta(t),s={meta:i,index:t,mode:n,cancelable:!0};this.notifyPlugins("beforeDatasetUpdate",s)!==!1&&(i.controller._update(n),s.cancelable=!1,this.notifyPlugins("afterDatasetUpdate",s))}render(){this.notifyPlugins("beforeRender",{cancelable:!0})!==!1&&(jt.has(this)?this.attached&&!jt.running(this)&&jt.start(this):(this.draw(),Fr({chart:this})))}draw(){let t;if(this._resizeBeforeDraw){const{width:i,height:s}=this._resizeBeforeDraw;this._resizeBeforeDraw=null,this._resize(i,s)}if(this.clear(),this.width<=0||this.height<=0||this.notifyPlugins("beforeDraw",{cancelable:!0})===!1)return;const n=this._layers;for(t=0;t<n.length&&n[t].z<=0;++t)n[t].draw(this.chartArea);for(this._drawDatasets();t<n.length;++t)n[t].draw(this.chartArea);this.notifyPlugins("afterDraw")}_getSortedDatasetMetas(t){const n=this._sortedMetasets,i=[];let s,o;for(s=0,o=n.length;s<o;++s){const r=n[s];(!t||r.visible)&&i.push(r)}return i}getSortedVisibleDatasetMetas(){return this._getSortedDatasetMetas(!0)}_drawDatasets(){if(this.notifyPlugins("beforeDatasetsDraw",{cancelable:!0})===!1)return;const t=this.getSortedVisibleDatasetMetas();for(let n=t.length-1;n>=0;--n)this._drawDataset(t[n]);this.notifyPlugins("afterDatasetsDraw")}_drawDataset(t){const n=this.ctx,i={meta:t,index:t.index,cancelable:!0},s=Td(this,t);this.notifyPlugins("beforeDatasetDraw",i)!==!1&&(s&&lo(n,s),t.controller.draw(),s&&co(n),i.cancelable=!1,this.notifyPlugins("afterDatasetDraw",i))}isPointInArea(t){return Ze(t,this.chartArea,this._minPadding)}getElementsAtEventForMode(t,n,i,s){const o=Yd.modes[n];return typeof o=="function"?o(this,t,i,s):[]}getDatasetMeta(t){const n=this.data.datasets[t],i=this._metasets;let s=i.filter(o=>o&&o._dataset===n).pop();return s||(s={type:null,data:[],dataset:null,controller:null,hidden:null,xAxisID:null,yAxisID:null,order:n&&n.order||0,index:t,_dataset:n,_parsed:[],_sorted:!1},i.push(s)),s}getContext(){return this.$context||(this.$context=Le(null,{chart:this,type:"chart"}))}getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(t){const n=this.data.datasets[t];if(!n)return!1;const i=this.getDatasetMeta(t);return typeof i.hidden=="boolean"?!i.hidden:!n.hidden}setDatasetVisibility(t,n){const i=this.getDatasetMeta(t);i.hidden=!n}toggleDataVisibility(t){this._hiddenIndices[t]=!this._hiddenIndices[t]}getDataVisibility(t){return!this._hiddenIndices[t]}_updateVisibility(t,n,i){const s=i?"show":"hide",o=this.getDatasetMeta(t),r=o.controller._resolveAnimations(void 0,s);Si(n)?(o.data[n].hidden=!i,this.update()):(this.setDatasetVisibility(t,i),r.update(o,{visible:i}),this.update(a=>a.datasetIndex===t?s:void 0))}hide(t,n){this._updateVisibility(t,n,!1)}show(t,n){this._updateVisibility(t,n,!0)}_destroyDatasetMeta(t){const n=this._metasets[t];n&&n.controller&&n.controller._destroy(),delete this._metasets[t]}_stop(){let t,n;for(this.stop(),jt.remove(this),t=0,n=this.data.datasets.length;t<n;++t)this._destroyDatasetMeta(t)}destroy(){this.notifyPlugins("beforeDestroy");const{canvas:t,ctx:n}=this;this._stop(),this.config.clearCache(),t&&(this.unbindEvents(),lr(t,n),this.platform.releaseContext(n),this.canvas=null,this.ctx=null),delete di[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,n=this.platform,i=(o,r)=>{n.addEventListener(this,o,r),t[o]=r},s=(o,r,a)=>{o.offsetX=r,o.offsetY=a,this._eventHandler(o)};z(this.options.events,o=>i(o,s))}bindResponsiveEvents(){this._responsiveListeners||(this._responsiveListeners={});const t=this._responsiveListeners,n=this.platform,i=(l,c)=>{n.addEventListener(this,l,c),t[l]=c},s=(l,c)=>{t[l]&&(n.removeEventListener(this,l,c),delete t[l])},o=(l,c)=>{this.canvas&&this.resize(l,c)};let r;const a=()=>{s("attach",a),this.attached=!0,this.resize(),i("resize",o),i("detach",r)};r=()=>{this.attached=!1,s("resize",o),this._stop(),this._resize(0,0),i("attach",a)},n.isAttached(this.canvas)?a():r()}unbindEvents(){z(this._listeners,(t,n)=>{this.platform.removeEventListener(this,n,t)}),this._listeners={},z(this._responsiveListeners,(t,n)=>{this.platform.removeEventListener(this,n,t)}),this._responsiveListeners=void 0}updateHoverStyle(t,n,i){const s=i?"set":"remove";let o,r,a,l;for(n==="dataset"&&(o=this.getDatasetMeta(t[0].datasetIndex),o.controller["_"+s+"DatasetHoverStyle"]()),a=0,l=t.length;a<l;++a){r=t[a];const c=r&&this.getDatasetMeta(r.datasetIndex).controller;c&&c[s+"HoverStyle"](r.element,r.datasetIndex,r.index)}}getActiveElements(){return this._active||[]}setActiveElements(t){const n=this._active||[],i=t.map(({datasetIndex:o,index:r})=>{const a=this.getDatasetMeta(o);if(!a)throw new Error("No dataset found at index "+o);return{datasetIndex:o,element:a.data[r],index:r}});!vi(i,n)&&(this._active=i,this._lastEvent=null,this._updateHoverStyles(i,n))}notifyPlugins(t,n,i){return this._plugins.notify(this,t,n,i)}isPluginEnabled(t){return this._plugins._cache.filter(n=>n.plugin.id===t).length===1}_updateHoverStyles(t,n,i){const s=this.options.hover,o=(l,c)=>l.filter(u=>!c.some(f=>u.datasetIndex===f.datasetIndex&&u.index===f.index)),r=o(n,t),a=i?t:o(t,n);r.length&&this.updateHoverStyle(r,s.mode,!1),a.length&&s.mode&&this.updateHoverStyle(a,s.mode,!0)}_eventHandler(t,n){const i={event:t,replay:n,cancelable:!0,inChartArea:this.isPointInArea(t)},s=r=>(r.options.events||this.options.events).includes(t.native.type);if(this.notifyPlugins("beforeEvent",i,s)===!1)return;const o=this._handleEvent(t,n,i.inChartArea);return i.cancelable=!1,this.notifyPlugins("afterEvent",i,s),(o||i.changed)&&this.render(),this}_handleEvent(t,n,i){const{_active:s=[],options:o}=this,r=n,a=this._getActiveElements(t,s,i,r),l=nf(t),c=Gp(t,this._lastEvent,i,l);i&&(this._lastEvent=null,I(o.onHover,[t,a,this],this),l&&I(o.onClick,[t,a,this],this));const u=!vi(a,s);return(u||n)&&(this._active=a,this._updateHoverStyles(a,s,n)),this._lastEvent=c,u}_getActiveElements(t,n,i,s){if(t.type==="mouseout")return[];if(!i)return n;const o=this.options.hover;return this.getElementsAtEventForMode(t,o.mode,o,s)}}function Br(){return z(zs.instances,e=>e._plugins.invalidate())}function Vl(e,t,n=t){e.lineCap=R(n.borderCapStyle,t.borderCapStyle),e.setLineDash(R(n.borderDash,t.borderDash)),e.lineDashOffset=R(n.borderDashOffset,t.borderDashOffset),e.lineJoin=R(n.borderJoinStyle,t.borderJoinStyle),e.lineWidth=R(n.borderWidth,t.borderWidth),e.strokeStyle=R(n.borderColor,t.borderColor)}function Kp(e,t,n){e.lineTo(n.x,n.y)}function Zp(e){return e.stepped?Af:e.tension||e.cubicInterpolationMode==="monotone"?If:Kp}function Wl(e,t,n={}){const i=e.length,{start:s=0,end:o=i-1}=n,{start:r,end:a}=t,l=Math.max(s,r),c=Math.min(o,a),u=s<r&&o<r||s>a&&o>a;return{count:i,start:l,loop:t.loop,ilen:c<l&&!u?i+c-l:c-l}}function Qp(e,t,n,i){const{points:s,options:o}=t,{count:r,start:a,loop:l,ilen:c}=Wl(s,n,i),u=Zp(o);let{move:f=!0,reverse:p}=i||{},g,x,y;for(g=0;g<=c;++g)x=s[(a+(p?c-g:g))%r],!x.skip&&(f?(e.moveTo(x.x,x.y),f=!1):u(e,y,x,p,o.stepped),y=x);return l&&(x=s[(a+(p?c:0))%r],u(e,y,x,p,o.stepped)),!!l}function Jp(e,t,n,i){const s=t.points,{count:o,start:r,ilen:a}=Wl(s,n,i),{move:l=!0,reverse:c}=i||{};let u=0,f=0,p,g,x,y,v,w;const k=O=>(r+(c?a-O:O))%o,C=()=>{y!==v&&(e.lineTo(u,v),e.lineTo(u,y),e.lineTo(u,w))};for(l&&(g=s[k(0)],e.moveTo(g.x,g.y)),p=0;p<=a;++p){if(g=s[k(p)],g.skip)continue;const O=g.x,T=g.y,D=O|0;D===x?(T<y?y=T:T>v&&(v=T),u=(f*u+O)/++f):(C(),e.lineTo(O,T),x=D,f=0,y=v=T),w=T}C()}function Fs(e){const t=e.options,n=t.borderDash&&t.borderDash.length;return!e._decimated&&!e._loop&&!t.tension&&t.cubicInterpolationMode!=="monotone"&&!t.stepped&&!n?Jp:Qp}function tg(e){return e.stepped?fd:e.tension||e.cubicInterpolationMode==="monotone"?dd:Se}function eg(e,t,n,i){let s=t._path;s||(s=t._path=new Path2D,t.path(s,n,i)&&s.closePath()),Vl(e,t.options),e.stroke(s)}function ng(e,t,n,i){const{segments:s,options:o}=t,r=Fs(t);for(const a of s)Vl(e,o,a.style),e.beginPath(),r(e,t,a,{start:n,end:n+i-1})&&e.closePath(),e.stroke()}const ig=typeof Path2D=="function";function sg(e,t,n,i){ig&&!t.options.segment?eg(e,t,n,i):ng(e,t,n,i)}class og extends en{static id="line";static defaults={borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderWidth:3,capBezierPoints:!0,cubicInterpolationMode:"default",fill:!1,spanGaps:!1,stepped:!1,tension:0};static defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};static descriptors={_scriptable:!0,_indexable:t=>t!=="borderDash"&&t!=="fill"};constructor(t){super(),this.animated=!0,this.options=void 0,this._chart=void 0,this._loop=void 0,this._fullLoop=void 0,this._path=void 0,this._points=void 0,this._segments=void 0,this._decimated=!1,this._pointsUpdated=!1,this._datasetIndex=void 0,t&&Object.assign(this,t)}updateControlPoints(t,n){const i=this.options;if((i.tension||i.cubicInterpolationMode==="monotone")&&!i.stepped&&!this._pointsUpdated){const s=i.spanGaps?this._loop:this._fullLoop;sd(this._points,i,t,s,n),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=_d(this,this.options.segment))}first(){const t=this.segments,n=this.points;return t.length&&n[t[0].start]}last(){const t=this.segments,n=this.points,i=t.length;return i&&n[t[i-1].end]}interpolate(t,n){const i=this.options,s=t[n],o=this.points,r=yd(this,{property:n,start:s,end:s});if(!r.length)return;const a=[],l=tg(i);let c,u;for(c=0,u=r.length;c<u;++c){const{start:f,end:p}=r[c],g=o[f],x=o[p];if(g===x){a.push(g);continue}const y=Math.abs((s-g[n])/(x[n]-g[n])),v=l(g,x,y,i.stepped);v[n]=t[n],a.push(v)}return a.length===1?a[0]:a}pathSegment(t,n,i){return Fs(this)(t,this,n,i)}path(t,n,i){const s=this.segments,o=Fs(this);let r=this._loop;n=n||0,i=i||this.points.length-n;for(const a of s)r&=o(t,this,a,{start:n,end:n+i-1});return!!r}draw(t,n,i,s){const o=this.options||{};(this.points||[]).length&&o.borderWidth&&(t.save(),sg(t,this,i,s),t.restore()),this.animated&&(this._pointsUpdated=!1,this._path=void 0)}}function Vr(e,t,n,i){const s=e.options,{[n]:o}=e.getProps([n],i);return Math.abs(t-o)<s.radius+s.hitRadius}class rg extends en{static id="point";parsed;skip;stop;static defaults={borderWidth:1,hitRadius:1,hoverBorderWidth:1,hoverRadius:4,pointStyle:"circle",radius:3,rotation:0};static defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};constructor(t){super(),this.options=void 0,this.parsed=void 0,this.skip=void 0,this.stop=void 0,t&&Object.assign(this,t)}inRange(t,n,i){const s=this.options,{x:o,y:r}=this.getProps(["x","y"],i);return Math.pow(t-o,2)+Math.pow(n-r,2)<Math.pow(s.hitRadius+s.radius,2)}inXRange(t,n){return Vr(this,t,"x",n)}inYRange(t,n){return Vr(this,t,"y",n)}getCenterPoint(t){const{x:n,y:i}=this.getProps(["x","y"],t);return{x:n,y:i}}size(t){t=t||this.options||{};let n=t.radius||0;n=Math.max(n,n&&t.hoverRadius||0);const i=n&&t.borderWidth||0;return(n+i)*2}draw(t,n){const i=this.options;this.skip||i.radius<.1||!Ze(this,n,this.size(i)/2)||(t.strokeStyle=i.borderColor,t.lineWidth=i.borderWidth,t.fillStyle=i.backgroundColor,Is(t,i,this.x,this.y))}getRange(){const t=this.options||{};return t.radius+t.hitRadius}}const Wr=(e,t)=>{let{boxHeight:n=t,boxWidth:i=t}=e;return e.usePointStyle&&(n=Math.min(n,t),i=e.pointStyleWidth||Math.min(i,t)),{boxWidth:i,boxHeight:n,itemHeight:Math.max(t,n)}},ag=(e,t)=>e!==null&&t!==null&&e.datasetIndex===t.datasetIndex&&e.index===t.index;class jr extends en{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,n,i){this.maxWidth=t,this.maxHeight=n,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 n=I(t.generateLabels,[this.chart],this)||[];t.filter&&(n=n.filter(i=>t.filter(i,this.chart.data))),t.sort&&(n=n.sort((i,s)=>t.sort(i,s,this.chart.data))),this.options.reverse&&n.reverse(),this.legendItems=n}fit(){const{options:t,ctx:n}=this;if(!t.display){this.width=this.height=0;return}const i=t.labels,s=ct(i.font),o=s.size,r=this._computeTitleHeight(),{boxWidth:a,itemHeight:l}=Wr(i,o);let c,u;n.font=s.string,this.isHorizontal()?(c=this.maxWidth,u=this._fitRows(r,o,a,l)+10):(u=this.maxHeight,c=this._fitCols(r,s,a,l)+10),this.width=Math.min(c,t.maxWidth||this.maxWidth),this.height=Math.min(u,t.maxHeight||this.maxHeight)}_fitRows(t,n,i,s){const{ctx:o,maxWidth:r,options:{labels:{padding:a}}}=this,l=this.legendHitBoxes=[],c=this.lineWidths=[0],u=s+a;let f=t;o.textAlign="left",o.textBaseline="middle";let p=-1,g=-u;return this.legendItems.forEach((x,y)=>{const v=i+n/2+o.measureText(x.text).width;(y===0||c[c.length-1]+v+2*a>r)&&(f+=u,c[c.length-(y>0?0:1)]=0,g+=u,p++),l[y]={left:0,top:g,row:p,width:v,height:s},c[c.length-1]+=v+a}),f}_fitCols(t,n,i,s){const{ctx:o,maxHeight:r,options:{labels:{padding:a}}}=this,l=this.legendHitBoxes=[],c=this.columnSizes=[],u=r-t;let f=a,p=0,g=0,x=0,y=0;return this.legendItems.forEach((v,w)=>{const{itemWidth:k,itemHeight:C}=lg(i,n,o,v,s);w>0&&g+C+2*a>u&&(f+=p+a,c.push({width:p,height:g}),x+=p+a,y++,p=g=0),l[w]={left:x,top:g,col:y,width:k,height:C},p=Math.max(p,k),g+=C+a}),f+=p,c.push({width:p,height:g}),f}adjustHitBoxes(){if(!this.options.display)return;const t=this._computeTitleHeight(),{legendHitBoxes:n,options:{align:i,labels:{padding:s},rtl:o}}=this,r=Ue(o,this.left,this.width);if(this.isHorizontal()){let a=0,l=ft(i,this.left+s,this.right-this.lineWidths[a]);for(const c of n)a!==c.row&&(a=c.row,l=ft(i,this.left+s,this.right-this.lineWidths[a])),c.top+=this.top+t+s,c.left=r.leftForLtr(r.x(l),c.width),l+=c.width+s}else{let a=0,l=ft(i,this.top+t+s,this.bottom-this.columnSizes[a].height);for(const c of n)c.col!==a&&(a=c.col,l=ft(i,this.top+t+s,this.bottom-this.columnSizes[a].height)),c.top=l,c.left+=this.left+s,c.left=r.leftForLtr(r.x(c.left),c.width),l+=c.height+s}}isHorizontal(){return this.options.position==="top"||this.options.position==="bottom"}draw(){if(this.options.display){const t=this.ctx;lo(t,this),this._draw(),co(t)}}_draw(){const{options:t,columnSizes:n,lineWidths:i,ctx:s}=this,{align:o,labels:r}=t,a=Y.color,l=Ue(t.rtl,this.left,this.width),c=ct(r.font),{padding:u}=r,f=c.size,p=f/2;let g;this.drawTitle(),s.textAlign=l.textAlign("left"),s.textBaseline="middle",s.lineWidth=.5,s.font=c.string;const{boxWidth:x,boxHeight:y,itemHeight:v}=Wr(r,f),w=function(D,P,E){if(isNaN(x)||x<=0||isNaN(y)||y<0)return;s.save();const A=R(E.lineWidth,1);if(s.fillStyle=R(E.fillStyle,a),s.lineCap=R(E.lineCap,"butt"),s.lineDashOffset=R(E.lineDashOffset,0),s.lineJoin=R(E.lineJoin,"miter"),s.lineWidth=A,s.strokeStyle=R(E.strokeStyle,a),s.setLineDash(R(E.lineDash,[])),r.usePointStyle){const F={radius:y*Math.SQRT2/2,pointStyle:E.pointStyle,rotation:E.rotation,borderWidth:A},L=l.xPlus(D,x/2),H=P+p;xl(s,F,L,H,r.pointStyleWidth&&x)}else{const F=P+Math.max((f-y)/2,0),L=l.leftForLtr(D,x),H=Tn(E.borderRadius);s.beginPath(),Object.values(H).some(K=>K!==0)?Ls(s,{x:L,y:F,w:x,h:y,radius:H}):s.rect(L,F,x,y),s.fill(),A!==0&&s.stroke()}s.restore()},k=function(D,P,E){Ti(s,E.text,D,P+v/2,c,{strikethrough:E.hidden,textAlign:l.textAlign(E.textAlign)})},C=this.isHorizontal(),O=this._computeTitleHeight();C?g={x:ft(o,this.left+u,this.right-i[0]),y:this.top+u+O,line:0}:g={x:this.left+u,y:ft(o,this.top+O+u,this.bottom-n[0].height),line:0},Ml(this.ctx,t.textDirection);const T=v+u;this.legendItems.forEach((D,P)=>{s.strokeStyle=D.fontColor,s.fillStyle=D.fontColor;const E=s.measureText(D.text).width,A=l.textAlign(D.textAlign||(D.textAlign=r.textAlign)),F=x+p+E;let L=g.x,H=g.y;l.setWidth(this.width),C?P>0&&L+F+u>this.right&&(H=g.y+=T,g.line++,L=g.x=ft(o,this.left+u,this.right-i[g.line])):P>0&&H+T>this.bottom&&(L=g.x=L+n[g.line].width+u,g.line++,H=g.y=ft(o,this.top+O+u,this.bottom-n[g.line].height));const K=l.x(L);if(w(K,H,D),L=xf(A,L+x+p,C?L+F:this.right,t.rtl),k(l.x(L),H,D),C)g.x+=F+u;else if(typeof D.text!="string"){const et=c.lineHeight;g.y+=jl(D,et)+u}else g.y+=T}),El(this.ctx,t.textDirection)}drawTitle(){const t=this.options,n=t.title,i=ct(n.font),s=Mt(n.padding);if(!n.display)return;const o=Ue(t.rtl,this.left,this.width),r=this.ctx,a=n.position,l=i.size/2,c=s.top+l;let u,f=this.left,p=this.width;if(this.isHorizontal())p=Math.max(...this.lineWidths),u=this.top+c,f=ft(t.align,f,this.right-p);else{const x=this.columnSizes.reduce((y,v)=>Math.max(y,v.height),0);u=c+ft(t.align,this.top,this.bottom-x-t.labels.padding-this._computeTitleHeight())}const g=ft(a,f,f+p);r.textAlign=o.textAlign(ml(a)),r.textBaseline="middle",r.strokeStyle=n.color,r.fillStyle=n.color,r.font=i.string,Ti(r,n.text,g,u,i)}_computeTitleHeight(){const t=this.options.title,n=ct(t.font),i=Mt(t.padding);return t.display?n.lineHeight+i.height:0}_getLegendItemAt(t,n){let i,s,o;if(xn(t,this.left,this.right)&&xn(n,this.top,this.bottom)){for(o=this.legendHitBoxes,i=0;i<o.length;++i)if(s=o[i],xn(t,s.left,s.left+s.width)&&xn(n,s.top,s.top+s.height))return this.legendItems[i]}return null}handleEvent(t){const n=this.options;if(!hg(t.type,n))return;const i=this._getLegendItemAt(t.x,t.y);if(t.type==="mousemove"||t.type==="mouseout"){const s=this._hoveredItem,o=ag(s,i);s&&!o&&I(n.onLeave,[t,s,this],this),this._hoveredItem=i,i&&!o&&I(n.onHover,[t,i,this],this)}else i&&I(n.onClick,[t,i,this],this)}}function lg(e,t,n,i,s){const o=cg(i,e,t,n),r=ug(s,i,t.lineHeight);return{itemWidth:o,itemHeight:r}}function cg(e,t,n,i){let s=e.text;return s&&typeof s!="string"&&(s=s.reduce((o,r)=>o.length>r.length?o:r)),t+n.size/2+i.measureText(s).width}function ug(e,t,n){let i=e;return typeof t.text!="string"&&(i=jl(t,n)),i}function jl(e,t){const n=e.text?e.text.length:0;return t*n}function hg(e,t){return!!((e==="mousemove"||e==="mouseout")&&(t.onHover||t.onLeave)||t.onClick&&(e==="click"||e==="mouseup"))}var fg={id:"legend",_element:jr,start(e,t,n){const i=e.legend=new jr({ctx:e.ctx,options:n,chart:e});ee.configure(e,i,n),ee.addBox(e,i)},stop(e){ee.removeBox(e,e.legend),delete e.legend},beforeUpdate(e,t,n){const i=e.legend;ee.configure(e,i,n),i.options=n},afterUpdate(e){const t=e.legend;t.buildLabels(),t.adjustHitBoxes()},afterEvent(e,t){t.replay||e.legend.handleEvent(t.event)},defaults:{display:!0,position:"top",align:"center",fullSize:!0,reverse:!1,weight:1e3,onClick(e,t,n){const i=t.datasetIndex,s=n.chart;s.isDatasetVisible(i)?(s.hide(i),t.hidden=!0):(s.show(i),t.hidden=!1)},onHover:null,onLeave:null,labels:{color:e=>e.chart.options.color,boxWidth:40,padding:10,generateLabels(e){const t=e.data.datasets,{labels:{usePointStyle:n,pointStyle:i,textAlign:s,color:o,useBorderRadius:r,borderRadius:a}}=e.legend.options;return e._getSortedDatasetMetas().map(l=>{const c=l.controller.getStyle(n?0:void 0),u=Mt(c.borderWidth);return{text:t[l.index].label,fillStyle:c.backgroundColor,fontColor:o,hidden:!l.visible,lineCap:c.borderCapStyle,lineDash:c.borderDash,lineDashOffset:c.borderDashOffset,lineJoin:c.borderJoinStyle,lineWidth:(u.width+u.height)/4,strokeStyle:c.borderColor,pointStyle:i||c.pointStyle,rotation:c.rotation,textAlign:s||c.textAlign,borderRadius:r&&(a||c.borderRadius),datasetIndex:l.index}},this)}},title:{color:e=>e.chart.options.color,display:!1,position:"center",text:""}},descriptors:{_scriptable:e=>!e.startsWith("on"),labels:{_scriptable:e=>!["generateLabels","filter","sort"].includes(e)}}};const _n={average(e){if(!e.length)return!1;let t,n,i=new Set,s=0,o=0;for(t=0,n=e.length;t<n;++t){const a=e[t].element;if(a&&a.hasValue()){const l=a.tooltipPosition();i.add(l.x),s+=l.y,++o}}return o===0||i.size===0?!1:{x:[...i].reduce((a,l)=>a+l)/i.size,y:s/o}},nearest(e,t){if(!e.length)return!1;let n=t.x,i=t.y,s=Number.POSITIVE_INFINITY,o,r,a;for(o=0,r=e.length;o<r;++o){const l=e[o].element;if(l&&l.hasValue()){const c=l.getCenterPoint(),u=Ds(t,c);u<s&&(s=u,a=l)}}if(a){const l=a.tooltipPosition();n=l.x,i=l.y}return{x:n,y:i}}};function Dt(e,t){return t&&(Q(t)?Array.prototype.push.apply(e,t):e.push(t)),e}function Ut(e){return(typeof e=="string"||e instanceof String)&&e.indexOf(\`
|
|
1741
|
+
*/class Ed{constructor(){this._request=null,this._charts=new Map,this._running=!1,this._lastDate=void 0}_notify(t,n,i,s){const o=n.listeners[s],r=n.duration;o.forEach(a=>a({chart:t,initial:n.initial,numSteps:r,currentStep:Math.min(i-n.start,r)}))}_refresh(){this._request||(this._running=!0,this._request=gl.call(window,()=>{this._update(),this._request=null,this._running&&this._refresh()}))}_update(t=Date.now()){let n=0;this._charts.forEach((i,s)=>{if(!i.running||!i.items.length)return;const o=i.items;let r=o.length-1,a=!1,l;for(;r>=0;--r)l=o[r],l._active?(l._total>i.duration&&(i.duration=l._total),l.tick(t),a=!0):(o[r]=o[o.length-1],o.pop());a&&(s.draw(),this._notify(s,i,t,"progress")),o.length||(i.running=!1,this._notify(s,i,t,"complete"),i.initial=!1),n+=o.length}),this._lastDate=t,n===0&&(this._running=!1)}_getAnims(t){const n=this._charts;let i=n.get(t);return i||(i={running:!1,initial:!0,items:[],listeners:{complete:[],progress:[]}},n.set(t,i)),i}listen(t,n,i){this._getAnims(t).listeners[n].push(i)}add(t,n){!n||!n.length||this._getAnims(t).items.push(...n)}has(t){return this._getAnims(t).items.length>0}start(t){const n=this._charts.get(t);n&&(n.running=!0,n.start=Date.now(),n.duration=n.items.reduce((i,s)=>Math.max(i,s._duration),0),this._refresh())}running(t){if(!this._running)return!1;const n=this._charts.get(t);return!(!n||!n.running||!n.items.length)}stop(t){const n=this._charts.get(t);if(!n||!n.items.length)return;const i=n.items;let s=i.length-1;for(;s>=0;--s)i[s].cancel();n.items=[],this._notify(t,n,Date.now(),"complete")}remove(t){return this._charts.delete(t)}}var jt=new Ed;const br="transparent",Od={boolean(e,t,n){return n>.5?t:e},color(e,t,n){const i=rr(e||br),s=i.valid&&rr(t||br);return s&&s.valid?s.mix(i,n).hexString():t},number(e,t,n){return e+(t-e)*n}};class Cd{constructor(t,n,i,s){const o=n[i];s=Jn([t.to,s,o,t.from]);const r=Jn([t.from,o,s]);this._active=!0,this._fn=t.fn||Od[t.type||typeof r],this._easing=Sn[t.easing]||Sn.linear,this._start=Math.floor(Date.now()+(t.delay||0)),this._duration=this._total=Math.floor(t.duration),this._loop=!!t.loop,this._target=n,this._prop=i,this._from=r,this._to=s,this._promises=void 0}active(){return this._active}update(t,n,i){if(this._active){this._notify(!1);const s=this._target[this._prop],o=i-this._start,r=this._duration-o;this._start=i,this._duration=Math.floor(Math.max(r,t.duration)),this._total+=o,this._loop=!!t.loop,this._to=Jn([t.to,n,s,t.from]),this._from=Jn([t.from,s,n])}}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(t){const n=t-this._start,i=this._duration,s=this._prop,o=this._from,r=this._loop,a=this._to;let l;if(this._active=o!==a&&(r||n<i),!this._active){this._target[s]=a,this._notify(!0);return}if(n<0){this._target[s]=o;return}l=n/i%2,l=r&&l>1?2-l:l,l=this._easing(Math.min(1,Math.max(0,l))),this._target[s]=this._fn(o,a,l)}wait(){const t=this._promises||(this._promises=[]);return new Promise((n,i)=>{t.push({res:n,rej:i})})}_notify(t){const n=t?"res":"rej",i=this._promises||[];for(let s=0;s<i.length;s++)i[s][n]()}}class Pl{constructor(t,n){this._chart=t,this._properties=new Map,this.configure(n)}configure(t){if(!B(t))return;const n=Object.keys(Y.animation),i=this._properties;Object.getOwnPropertyNames(t).forEach(s=>{const o=t[s];if(!B(o))return;const r={};for(const a of n)r[a]=o[a];(Q(o.properties)&&o.properties||[s]).forEach(a=>{(a===s||!i.has(a))&&i.set(a,r)})})}_animateOptions(t,n){const i=n.options,s=Dd(t,i);if(!s)return[];const o=this._createAnimations(s,i);return i.$shared&&Pd(t.options.$animations,i).then(()=>{t.options=i},()=>{}),o}_createAnimations(t,n){const i=this._properties,s=[],o=t.$animations||(t.$animations={}),r=Object.keys(n),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"){s.push(...this._animateOptions(t,n));continue}const u=n[c];let f=o[c];const p=i.get(c);if(f)if(p&&f.active()){f.update(p,u,a);continue}else f.cancel();if(!p||!p.duration){t[c]=u;continue}o[c]=f=new Cd(p,t,c,u),s.push(f)}return s}update(t,n){if(this._properties.size===0){Object.assign(t,n);return}const i=this._createAnimations(t,n);if(i.length)return jt.add(this._chart,i),!0}}function Pd(e,t){const n=[],i=Object.keys(t);for(let s=0;s<i.length;s++){const o=e[i[s]];o&&o.active()&&n.push(o.wait())}return Promise.all(n)}function Dd(e,t){if(!t)return;let n=e.options;if(!n){e.options=t;return}return n.$shared&&(e.options=n=Object.assign({},n,{$shared:!1,$animations:{}})),n}function yr(e,t){const n=e&&e.options||{},i=n.reverse,s=n.min===void 0?t:0,o=n.max===void 0?t:0;return{start:i?o:s,end:i?s:o}}function Ad(e,t,n){if(n===!1)return!1;const i=yr(e,n),s=yr(t,n);return{top:s.end,right:i.end,bottom:s.start,left:i.start}}function Id(e){let t,n,i,s;return B(e)?(t=e.top,n=e.right,i=e.bottom,s=e.left):t=n=i=s=e,{top:t,right:n,bottom:i,left:s,disabled:e===!1}}function Dl(e,t){const n=[],i=e._getSortedDatasetMetas(t);let s,o;for(s=0,o=i.length;s<o;++s)n.push(i[s].index);return n}function xr(e,t,n,i={}){const s=e.keys,o=i.mode==="single";let r,a,l,c;if(t===null)return;let u=!1;for(r=0,a=s.length;r<a;++r){if(l=+s[r],l===n){if(u=!0,i.all)continue;break}c=e.values[l],xt(c)&&(o||t===0||ce(t)===ce(c))&&(t+=c)}return!u&&!i.all?0:t}function Ld(e,t){const{iScale:n,vScale:i}=t,s=n.axis==="x"?"x":"y",o=i.axis==="x"?"x":"y",r=Object.keys(e),a=new Array(r.length);let l,c,u;for(l=0,c=r.length;l<c;++l)u=r[l],a[l]={[s]:u,[o]:e[u]};return a}function Ji(e,t){const n=e&&e.options.stacked;return n||n===void 0&&t.stack!==void 0}function Rd(e,t,n){return\`\${e.id}.\${t.id}.\${n.stack||n.type}\`}function Nd(e){const{min:t,max:n,minDefined:i,maxDefined:s}=e.getUserBounds();return{min:i?t:Number.NEGATIVE_INFINITY,max:s?n:Number.POSITIVE_INFINITY}}function zd(e,t,n){const i=e[t]||(e[t]={});return i[n]||(i[n]={})}function vr(e,t,n,i){for(const s of t.getMatchingVisibleMetas(i).reverse()){const o=e[s.index];if(n&&o>0||!n&&o<0)return s.index}return null}function _r(e,t){const{chart:n,_cachedMeta:i}=e,s=n._stacks||(n._stacks={}),{iScale:o,vScale:r,index:a}=i,l=o.axis,c=r.axis,u=Rd(o,r,i),f=t.length;let p;for(let g=0;g<f;++g){const x=t[g],{[l]:y,[c]:v}=x,w=x._stacks||(x._stacks={});p=w[c]=zd(s,u,y),p[a]=v,p._top=vr(p,r,!0,i.type),p._bottom=vr(p,r,!1,i.type);const k=p._visualValues||(p._visualValues={});k[a]=v}}function ts(e,t){const n=e.scales;return Object.keys(n).filter(i=>n[i].axis===t).shift()}function Fd(e,t){return Le(e,{active:!1,dataset:void 0,datasetIndex:t,index:t,mode:"default",type:"dataset"})}function Hd(e,t,n){return Le(e,{active:!1,dataIndex:t,parsed:void 0,raw:void 0,element:n,index:t,mode:"default",type:"data"})}function fn(e,t){const n=e.controller.index,i=e.vScale&&e.vScale.axis;if(i){t=t||e._parsed;for(const s of t){const o=s._stacks;if(!o||o[i]===void 0||o[i][n]===void 0)return;delete o[i][n],o[i]._visualValues!==void 0&&o[i]._visualValues[n]!==void 0&&delete o[i]._visualValues[n]}}}const es=e=>e==="reset"||e==="none",wr=(e,t)=>t?e:Object.assign({},e),Bd=(e,t,n)=>e&&!t.hidden&&t._stacked&&{keys:Dl(n,!0),values:null};class Al{static defaults={};static datasetElementType=null;static dataElementType=null;constructor(t,n){this.chart=t,this._ctx=t.ctx,this.index=n,this._cachedDataOpts={},this._cachedMeta=this.getMeta(),this._type=this._cachedMeta.type,this.options=void 0,this._parsing=!1,this._data=void 0,this._objectData=void 0,this._sharedOptions=void 0,this._drawStart=void 0,this._drawCount=void 0,this.enableOptionSharing=!1,this.supportsDecimation=!1,this.$context=void 0,this._syncList=[],this.datasetElementType=new.target.datasetElementType,this.dataElementType=new.target.dataElementType,this.initialize()}initialize(){const t=this._cachedMeta;this.configure(),this.linkScales(),t._stacked=Ji(t.vScale,t),this.addElements(),this.options.fill&&!this.chart.isPluginEnabled("filler")&&console.warn("Tried to use the 'fill' option without the 'Filler' plugin enabled. Please import and register the 'Filler' plugin and make sure it is not disabled in the options")}updateIndex(t){this.index!==t&&fn(this._cachedMeta),this.index=t}linkScales(){const t=this.chart,n=this._cachedMeta,i=this.getDataset(),s=(f,p,g,x)=>f==="x"?p:f==="r"?x:g,o=n.xAxisID=R(i.xAxisID,ts(t,"x")),r=n.yAxisID=R(i.yAxisID,ts(t,"y")),a=n.rAxisID=R(i.rAxisID,ts(t,"r")),l=n.indexAxis,c=n.iAxisID=s(l,o,r,a),u=n.vAxisID=s(l,r,o,a);n.xScale=this.getScaleForId(o),n.yScale=this.getScaleForId(r),n.rScale=this.getScaleForId(a),n.iScale=this.getScaleForId(c),n.vScale=this.getScaleForId(u)}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 n=this._cachedMeta;return t===n.iScale?n.vScale:n.iScale}reset(){this._update("reset")}_destroy(){const t=this._cachedMeta;this._data&&ir(this._data,this),t._stacked&&fn(t)}_dataCheck(){const t=this.getDataset(),n=t.data||(t.data=[]),i=this._data;if(B(n)){const s=this._cachedMeta;this._data=Ld(n,s)}else if(i!==n){if(i){ir(i,this);const s=this._cachedMeta;fn(s),s._parsed=[]}n&&Object.isExtensible(n)&&bf(n,this),this._syncList=[],this._data=n}}addElements(){const t=this._cachedMeta;this._dataCheck(),this.datasetElementType&&(t.dataset=new this.datasetElementType)}buildOrUpdateElements(t){const n=this._cachedMeta,i=this.getDataset();let s=!1;this._dataCheck();const o=n._stacked;n._stacked=Ji(n.vScale,n),n.stack!==i.stack&&(s=!0,fn(n),n.stack=i.stack),this._resyncElements(t),(s||o!==n._stacked)&&(_r(this,n._parsed),n._stacked=Ji(n.vScale,n))}configure(){const t=this.chart.config,n=t.datasetScopeKeys(this._type),i=t.getOptionScopes(this.getDataset(),n,!0);this.options=t.createResolver(i,this.getContext()),this._parsing=this.options.parsing,this._cachedDataOpts={}}parse(t,n){const{_cachedMeta:i,_data:s}=this,{iScale:o,_stacked:r}=i,a=o.axis;let l=t===0&&n===s.length?!0:i._sorted,c=t>0&&i._parsed[t-1],u,f,p;if(this._parsing===!1)i._parsed=s,i._sorted=!0,p=s;else{Q(s[t])?p=this.parseArrayData(i,s,t,n):B(s[t])?p=this.parseObjectData(i,s,t,n):p=this.parsePrimitiveData(i,s,t,n);const g=()=>f[a]===null||c&&f[a]<c[a];for(u=0;u<n;++u)i._parsed[u+t]=f=p[u],l&&(g()&&(l=!1),c=f);i._sorted=l}r&&_r(this,p)}parsePrimitiveData(t,n,i,s){const{iScale:o,vScale:r}=t,a=o.axis,l=r.axis,c=o.getLabels(),u=o===r,f=new Array(s);let p,g,x;for(p=0,g=s;p<g;++p)x=p+i,f[p]={[a]:u||o.parse(c[x],x),[l]:r.parse(n[x],x)};return f}parseArrayData(t,n,i,s){const{xScale:o,yScale:r}=t,a=new Array(s);let l,c,u,f;for(l=0,c=s;l<c;++l)u=l+i,f=n[u],a[l]={x:o.parse(f[0],u),y:r.parse(f[1],u)};return a}parseObjectData(t,n,i,s){const{xScale:o,yScale:r}=t,{xAxisKey:a="x",yAxisKey:l="y"}=this._parsing,c=new Array(s);let u,f,p,g;for(u=0,f=s;u<f;++u)p=u+i,g=n[p],c[u]={x:o.parse(wi(g,a),p),y:r.parse(wi(g,l),p)};return c}getParsed(t){return this._cachedMeta._parsed[t]}getDataElement(t){return this._cachedMeta.data[t]}applyStack(t,n,i){const s=this.chart,o=this._cachedMeta,r=n[t.axis],a={keys:Dl(s,!0),values:n._stacks[t.axis]._visualValues};return xr(a,r,o.index,{mode:i})}updateRangeFromParsed(t,n,i,s){const o=i[n.axis];let r=o===null?NaN:o;const a=s&&i._stacks[n.axis];s&&a&&(s.values=a,r=xr(s,o,this._cachedMeta.index)),t.min=Math.min(t.min,r),t.max=Math.max(t.max,r)}getMinMax(t,n){const i=this._cachedMeta,s=i._parsed,o=i._sorted&&t===i.iScale,r=s.length,a=this._getOtherScale(t),l=Bd(n,i,this.chart),c={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY},{min:u,max:f}=Nd(a);let p,g;function x(){g=s[p];const y=g[a.axis];return!xt(g[t.axis])||u>y||f<y}for(p=0;p<r&&!(!x()&&(this.updateRangeFromParsed(c,t,g,l),o));++p);if(o){for(p=r-1;p>=0;--p)if(!x()){this.updateRangeFromParsed(c,t,g,l);break}}return c}getAllParsedValues(t){const n=this._cachedMeta._parsed,i=[];let s,o,r;for(s=0,o=n.length;s<o;++s)r=n[s][t.axis],xt(r)&&i.push(r);return i}getMaxOverflow(){return!1}getLabelAndValue(t){const n=this._cachedMeta,i=n.iScale,s=n.vScale,o=this.getParsed(t);return{label:i?""+i.getLabelForValue(o[i.axis]):"",value:s?""+s.getLabelForValue(o[s.axis]):""}}_update(t){const n=this._cachedMeta;this.update(t||"default"),n._clip=Id(R(this.options.clip,Ad(n.xScale,n.yScale,this.getMaxOverflow())))}update(t){}draw(){const t=this._ctx,n=this.chart,i=this._cachedMeta,s=i.data||[],o=n.chartArea,r=[],a=this._drawStart||0,l=this._drawCount||s.length-a,c=this.options.drawActiveElementsOnTop;let u;for(i.dataset&&i.dataset.draw(t,o,a,l),u=a;u<a+l;++u){const f=s[u];f.hidden||(f.active&&c?r.push(f):f.draw(t,o))}for(u=0;u<r.length;++u)r[u].draw(t,o)}getStyle(t,n){const i=n?"active":"default";return t===void 0&&this._cachedMeta.dataset?this.resolveDatasetElementOptions(i):this.resolveDataElementOptions(t||0,i)}getContext(t,n,i){const s=this.getDataset();let o;if(t>=0&&t<this._cachedMeta.data.length){const r=this._cachedMeta.data[t];o=r.$context||(r.$context=Hd(this.getContext(),t,r)),o.parsed=this.getParsed(t),o.raw=s.data[t],o.index=o.dataIndex=t}else o=this.$context||(this.$context=Fd(this.chart.getContext(),this.index)),o.dataset=s,o.index=o.datasetIndex=this.index;return o.active=!!n,o.mode=i,o}resolveDatasetElementOptions(t){return this._resolveElementOptions(this.datasetElementType.id,t)}resolveDataElementOptions(t,n){return this._resolveElementOptions(this.dataElementType.id,n,t)}_resolveElementOptions(t,n="default",i){const s=n==="active",o=this._cachedDataOpts,r=t+"-"+n,a=o[r],l=this.enableOptionSharing&&Si(i);if(a)return wr(a,l);const c=this.chart.config,u=c.datasetElementScopeKeys(this._type,t),f=s?[\`\${t}Hover\`,"hover",t,""]:[t,""],p=c.getOptionScopes(this.getDataset(),u),g=Object.keys(Y.elements[t]),x=()=>this.getContext(i,s,n),y=c.resolveNamedOptions(p,g,x,f);return y.$shared&&(y.$shared=l,o[r]=Object.freeze(wr(y,l))),y}_resolveAnimations(t,n,i){const s=this.chart,o=this._cachedDataOpts,r=\`animation-\${n}\`,a=o[r];if(a)return a;let l;if(s.options.animation!==!1){const u=this.chart.config,f=u.datasetAnimationScopeKeys(this._type,n),p=u.getOptionScopes(this.getDataset(),f);l=u.createResolver(p,this.getContext(t,i,n))}const c=new Pl(s,l&&l.animations);return l&&l._cacheable&&(o[r]=Object.freeze(c)),c}getSharedOptions(t){if(t.$shared)return this._sharedOptions||(this._sharedOptions=Object.assign({},t))}includeOptions(t,n){return!n||es(t)||this.chart._animationsDisabled}_getSharedOptions(t,n){const i=this.resolveDataElementOptions(t,n),s=this._sharedOptions,o=this.getSharedOptions(i),r=this.includeOptions(n,o)||o!==s;return this.updateSharedOptions(o,n,i),{sharedOptions:o,includeOptions:r}}updateElement(t,n,i,s){es(s)?Object.assign(t,i):this._resolveAnimations(n,s).update(t,i)}updateSharedOptions(t,n,i){t&&!es(n)&&this._resolveAnimations(void 0,n).update(t,i)}_setStyle(t,n,i,s){t.active=s;const o=this.getStyle(n,s);this._resolveAnimations(n,i,s).update(t,{options:!s&&this.getSharedOptions(o)||o})}removeHoverStyle(t,n,i){this._setStyle(t,i,"active",!1)}setHoverStyle(t,n,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 n=this._data,i=this._cachedMeta.data;for(const[a,l,c]of this._syncList)this[a](l,c);this._syncList=[];const s=i.length,o=n.length,r=Math.min(o,s);r&&this.parse(0,r),o>s?this._insertElements(s,o-s,t):o<s&&this._removeElements(o,s-o)}_insertElements(t,n,i=!0){const s=this._cachedMeta,o=s.data,r=t+n;let a;const l=c=>{for(c.length+=n,a=c.length-1;a>=r;a--)c[a]=c[a-n]};for(l(o),a=t;a<r;++a)o[a]=new this.dataElementType;this._parsing&&l(s._parsed),this.parse(t,n),i&&this.updateElements(o,t,n,"reset")}updateElements(t,n,i,s){}_removeElements(t,n){const i=this._cachedMeta;if(this._parsing){const s=i._parsed.splice(t,n);i._stacked&&fn(i,s)}i.data.splice(t,n)}_sync(t){if(this._parsing)this._syncList.push(t);else{const[n,i,s]=t;this[n](i,s)}this.chart._dataChanges.push([this.index,...t])}_onDataPush(){const t=arguments.length;this._sync(["_insertElements",this.getDataset().data.length-t,t])}_onDataPop(){this._sync(["_removeElements",this._cachedMeta.data.length-1,1])}_onDataShift(){this._sync(["_removeElements",0,1])}_onDataSplice(t,n){n&&this._sync(["_removeElements",t,n]);const i=arguments.length-2;i&&this._sync(["_insertElements",t,i])}_onDataUnshift(){this._sync(["_insertElements",0,arguments.length])}}class Vd extends Al{static id="line";static defaults={datasetElementType:"line",dataElementType:"point",showLine:!0,spanGaps:!1};static overrides={scales:{_index_:{type:"category"},_value_:{type:"linear"}}};initialize(){this.enableOptionSharing=!0,this.supportsDecimation=!0,super.initialize()}update(t){const n=this._cachedMeta,{dataset:i,data:s=[],_dataset:o}=n,r=this.chart._animationsDisabled;let{start:a,count:l}=_f(n,s,r);this._drawStart=a,this._drawCount=l,wf(n)&&(a=0,l=s.length),i._chart=this.chart,i._datasetIndex=this.index,i._decimated=!!o._decimated,i.points=s;const c=this.resolveDatasetElementOptions(t);this.options.showLine||(c.borderWidth=0),c.segment=this.options.segment,this.updateElement(i,void 0,{animated:!r,options:c},t),this.updateElements(s,a,l,t)}updateElements(t,n,i,s){const o=s==="reset",{iScale:r,vScale:a,_stacked:l,_dataset:c}=this._cachedMeta,{sharedOptions:u,includeOptions:f}=this._getSharedOptions(n,s),p=r.axis,g=a.axis,{spanGaps:x,segment:y}=this.options,v=In(x)?x:Number.POSITIVE_INFINITY,w=this.chart._animationsDisabled||o||s==="none",k=n+i,O=t.length;let C=n>0&&this.getParsed(n-1);for(let T=0;T<O;++T){const D=t[T],P=w?D:{};if(T<n||T>=k){P.skip=!0;continue}const E=this.getParsed(T),A=V(E[g]),F=P[p]=r.getPixelForValue(E[p],T),L=P[g]=o||A?a.getBasePixel():a.getPixelForValue(l?this.applyStack(a,E,l):E[g],T);P.skip=isNaN(F)||isNaN(L)||A,P.stop=T>0&&Math.abs(E[p]-C[p])>v,y&&(P.parsed=E,P.raw=c.data[T]),f&&(P.options=u||this.resolveDataElementOptions(T,D.active?"active":s)),w||this.updateElement(D,T,P,s),C=E}}getMaxOverflow(){const t=this._cachedMeta,n=t.dataset,i=n.options&&n.options.borderWidth||0,s=t.data||[];if(!s.length)return i;const o=s[0].size(this.resolveDataElementOptions(0)),r=s[s.length-1].size(this.resolveDataElementOptions(s.length-1));return Math.max(i,o,r)/2}draw(){const t=this._cachedMeta;t.dataset.updateControlPoints(this.chart.chartArea,t.iScale.axis),super.draw()}}function we(){throw new Error("This method is not implemented: Check that a complete date adapter is provided.")}class mo{static override(t){Object.assign(mo.prototype,t)}options;constructor(t){this.options=t||{}}init(){}formats(){return we()}parse(){return we()}format(){return we()}add(){return we()}diff(){return we()}startOf(){return we()}endOf(){return we()}}var Wd={_date:mo};function jd(e,t,n,i){const{controller:s,data:o,_sorted:r}=e,a=s._cachedMeta.iScale,l=e.dataset&&e.dataset.options?e.dataset.options.spanGaps:null;if(a&&t===a.axis&&t!=="r"&&r&&o.length){const c=a._reversePixels?gf:Ee;if(i){if(s._sharedOptions){const u=o[0],f=typeof u.getRange=="function"&&u.getRange(t);if(f){const p=c(o,t,n-f),g=c(o,t,n+f);return{lo:p.lo,hi:g.hi}}}}else{const u=c(o,t,n);if(l){const{vScale:f}=s._cachedMeta,{_parsed:p}=e,g=p.slice(0,u.lo+1).reverse().findIndex(y=>!V(y[f.axis]));u.lo-=Math.max(0,g);const x=p.slice(u.hi).findIndex(y=>!V(y[f.axis]));u.hi+=Math.max(0,x)}return u}}return{lo:0,hi:o.length-1}}function Ni(e,t,n,i,s){const o=e.getSortedVisibleDatasetMetas(),r=n[t];for(let a=0,l=o.length;a<l;++a){const{index:c,data:u}=o[a],{lo:f,hi:p}=jd(o[a],t,r,s);for(let g=f;g<=p;++g){const x=u[g];x.skip||i(x,c,g)}}}function Ud(e){const t=e.indexOf("x")!==-1,n=e.indexOf("y")!==-1;return function(i,s){const o=t?Math.abs(i.x-s.x):0,r=n?Math.abs(i.y-s.y):0;return Math.sqrt(Math.pow(o,2)+Math.pow(r,2))}}function ns(e,t,n,i,s){const o=[];return!s&&!e.isPointInArea(t)||Ni(e,n,t,function(a,l,c){!s&&!Ze(a,e.chartArea,0)||a.inRange(t.x,t.y,i)&&o.push({element:a,datasetIndex:l,index:c})},!0),o}function $d(e,t,n,i){let s=[];function o(r,a,l){const{startAngle:c,endAngle:u}=r.getProps(["startAngle","endAngle"],i),{angle:f}=ff(r,{x:t.x,y:t.y});dl(f,c,u)&&s.push({element:r,datasetIndex:a,index:l})}return Ni(e,n,t,o),s}function Yd(e,t,n,i,s,o){let r=[];const a=Ud(n);let l=Number.POSITIVE_INFINITY;function c(u,f,p){const g=u.inRange(t.x,t.y,s);if(i&&!g)return;const x=u.getCenterPoint(s);if(!(!!o||e.isPointInArea(x))&&!g)return;const v=a(t,x);v<l?(r=[{element:u,datasetIndex:f,index:p}],l=v):v===l&&r.push({element:u,datasetIndex:f,index:p})}return Ni(e,n,t,c),r}function is(e,t,n,i,s,o){return!o&&!e.isPointInArea(t)?[]:n==="r"&&!i?$d(e,t,n,s):Yd(e,t,n,i,s,o)}function Sr(e,t,n,i,s){const o=[],r=n==="x"?"inXRange":"inYRange";let a=!1;return Ni(e,n,t,(l,c,u)=>{l[r]&&l[r](t[n],s)&&(o.push({element:l,datasetIndex:c,index:u}),a=a||l.inRange(t.x,t.y,s))}),i&&!a?[]:o}var Xd={modes:{index(e,t,n,i){const s=It(t,e),o=n.axis||"x",r=n.includeInvisible||!1,a=n.intersect?ns(e,s,o,i,r):is(e,s,o,!1,i,r),l=[];return a.length?(e.getSortedVisibleDatasetMetas().forEach(c=>{const u=a[0].index,f=c.data[u];f&&!f.skip&&l.push({element:f,datasetIndex:c.index,index:u})}),l):[]},dataset(e,t,n,i){const s=It(t,e),o=n.axis||"xy",r=n.includeInvisible||!1;let a=n.intersect?ns(e,s,o,i,r):is(e,s,o,!1,i,r);if(a.length>0){const l=a[0].datasetIndex,c=e.getDatasetMeta(l).data;a=[];for(let u=0;u<c.length;++u)a.push({element:c[u],datasetIndex:l,index:u})}return a},point(e,t,n,i){const s=It(t,e),o=n.axis||"xy",r=n.includeInvisible||!1;return ns(e,s,o,i,r)},nearest(e,t,n,i){const s=It(t,e),o=n.axis||"xy",r=n.includeInvisible||!1;return is(e,s,o,n.intersect,i,r)},x(e,t,n,i){const s=It(t,e);return Sr(e,s,"x",n.intersect,i)},y(e,t,n,i){const s=It(t,e);return Sr(e,s,"y",n.intersect,i)}}};const Il=["left","top","right","bottom"];function dn(e,t){return e.filter(n=>n.pos===t)}function kr(e,t){return e.filter(n=>Il.indexOf(n.pos)===-1&&n.box.axis===t)}function pn(e,t){return e.sort((n,i)=>{const s=t?i:n,o=t?n:i;return s.weight===o.weight?s.index-o.index:s.weight-o.weight})}function qd(e){const t=[];let n,i,s,o,r,a;for(n=0,i=(e||[]).length;n<i;++n)s=e[n],{position:o,options:{stack:r,stackWeight:a=1}}=s,t.push({index:n,box:s,pos:o,horizontal:s.isHorizontal(),weight:s.weight,stack:r&&o+r,stackWeight:a});return t}function Gd(e){const t={};for(const n of e){const{stack:i,pos:s,stackWeight:o}=n;if(!i||!Il.includes(s))continue;const r=t[i]||(t[i]={count:0,placed:0,weight:0,size:0});r.count++,r.weight+=o}return t}function Kd(e,t){const n=Gd(e),{vBoxMaxWidth:i,hBoxMaxHeight:s}=t;let o,r,a;for(o=0,r=e.length;o<r;++o){a=e[o];const{fullSize:l}=a.box,c=n[a.stack],u=c&&a.stackWeight/c.weight;a.horizontal?(a.width=u?u*i:l&&t.availableWidth,a.height=s):(a.width=i,a.height=u?u*s:l&&t.availableHeight)}return n}function Zd(e){const t=qd(e),n=pn(t.filter(c=>c.box.fullSize),!0),i=pn(dn(t,"left"),!0),s=pn(dn(t,"right")),o=pn(dn(t,"top"),!0),r=pn(dn(t,"bottom")),a=kr(t,"x"),l=kr(t,"y");return{fullSize:n,leftAndTop:i.concat(o),rightAndBottom:s.concat(l).concat(r).concat(a),chartArea:dn(t,"chartArea"),vertical:i.concat(s).concat(l),horizontal:o.concat(r).concat(a)}}function Tr(e,t,n,i){return Math.max(e[n],t[n])+Math.max(e[i],t[i])}function Ll(e,t){e.top=Math.max(e.top,t.top),e.left=Math.max(e.left,t.left),e.bottom=Math.max(e.bottom,t.bottom),e.right=Math.max(e.right,t.right)}function Qd(e,t,n,i){const{pos:s,box:o}=n,r=e.maxPadding;if(!B(s)){n.size&&(e[s]-=n.size);const f=i[n.stack]||{size:0,count:1};f.size=Math.max(f.size,n.horizontal?o.height:o.width),n.size=f.size/f.count,e[s]+=n.size}o.getPadding&&Ll(r,o.getPadding());const a=Math.max(0,t.outerWidth-Tr(r,e,"left","right")),l=Math.max(0,t.outerHeight-Tr(r,e,"top","bottom")),c=a!==e.w,u=l!==e.h;return e.w=a,e.h=l,n.horizontal?{same:c,other:u}:{same:u,other:c}}function Jd(e){const t=e.maxPadding;function n(i){const s=Math.max(t[i]-e[i],0);return e[i]+=s,s}e.y+=n("top"),e.x+=n("left"),n("right"),n("bottom")}function tp(e,t){const n=t.maxPadding;function i(s){const o={left:0,top:0,right:0,bottom:0};return s.forEach(r=>{o[r]=Math.max(t[r],n[r])}),o}return i(e?["left","right"]:["top","bottom"])}function vn(e,t,n,i){const s=[];let o,r,a,l,c,u;for(o=0,r=e.length,c=0;o<r;++o){a=e[o],l=a.box,l.update(a.width||t.w,a.height||t.h,tp(a.horizontal,t));const{same:f,other:p}=Qd(t,n,a,i);c|=f&&s.length,u=u||p,l.fullSize||s.push(a)}return c&&vn(s,t,n,i)||u}function ii(e,t,n,i,s){e.top=n,e.left=t,e.right=t+i,e.bottom=n+s,e.width=i,e.height=s}function Mr(e,t,n,i){const s=n.padding;let{x:o,y:r}=t;for(const a of e){const l=a.box,c=i[a.stack]||{placed:0,weight:1},u=a.stackWeight/c.weight||1;if(a.horizontal){const f=t.w*u,p=c.size||l.height;Si(c.start)&&(r=c.start),l.fullSize?ii(l,s.left,r,n.outerWidth-s.right-s.left,p):ii(l,t.left+c.placed,r,f,p),c.start=r,c.placed+=f,r=l.bottom}else{const f=t.h*u,p=c.size||l.width;Si(c.start)&&(o=c.start),l.fullSize?ii(l,o,s.top,p,n.outerHeight-s.bottom-s.top):ii(l,o,t.top+c.placed,p,f),c.start=o,c.placed+=f,o=l.right}}t.x=o,t.y=r}var ee={addBox(e,t){e.boxes||(e.boxes=[]),t.fullSize=t.fullSize||!1,t.position=t.position||"top",t.weight=t.weight||0,t._layers=t._layers||function(){return[{z:0,draw(n){t.draw(n)}}]},e.boxes.push(t)},removeBox(e,t){const n=e.boxes?e.boxes.indexOf(t):-1;n!==-1&&e.boxes.splice(n,1)},configure(e,t,n){t.fullSize=n.fullSize,t.position=n.position,t.weight=n.weight},update(e,t,n,i){if(!e)return;const s=Mt(e.options.layout.padding),o=Math.max(t-s.width,0),r=Math.max(n-s.height,0),a=Zd(e.boxes),l=a.vertical,c=a.horizontal;z(e.boxes,y=>{typeof y.beforeLayout=="function"&&y.beforeLayout()});const u=l.reduce((y,v)=>v.box.options&&v.box.options.display===!1?y:y+1,0)||1,f=Object.freeze({outerWidth:t,outerHeight:n,padding:s,availableWidth:o,availableHeight:r,vBoxMaxWidth:o/2/u,hBoxMaxHeight:r/2}),p=Object.assign({},s);Ll(p,Mt(i));const g=Object.assign({maxPadding:p,w:o,h:r,x:s.left,y:s.top},s),x=Kd(l.concat(c),f);vn(a.fullSize,g,f,x),vn(l,g,f,x),vn(c,g,f,x)&&vn(l,g,f,x),Jd(g),Mr(a.leftAndTop,g,f,x),g.x+=g.w,g.y+=g.h,Mr(a.rightAndBottom,g,f,x),e.chartArea={left:g.left,top:g.top,right:g.left+g.w,bottom:g.top+g.h,height:g.h,width:g.w},z(a.chartArea,y=>{const v=y.box;Object.assign(v,e.chartArea),v.update(g.w,g.h,{left:0,top:0,right:0,bottom:0})})}};class Rl{acquireContext(t,n){}releaseContext(t){return!1}addEventListener(t,n,i){}removeEventListener(t,n,i){}getDevicePixelRatio(){return 1}getMaximumSize(t,n,i,s){return n=Math.max(0,n||t.width),i=i||t.height,{width:n,height:Math.max(0,s?Math.floor(n/s):i)}}isAttached(t){return!0}updateConfig(t){}}class ep extends Rl{acquireContext(t){return t&&t.getContext&&t.getContext("2d")||null}updateConfig(t){t.options.animation=!1}}const fi="$chartjs",np={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},Er=e=>e===null||e==="";function ip(e,t){const n=e.style,i=e.getAttribute("height"),s=e.getAttribute("width");if(e[fi]={initial:{height:i,width:s,style:{display:n.display,height:n.height,width:n.width}}},n.display=n.display||"block",n.boxSizing=n.boxSizing||"border-box",Er(s)){const o=dr(e,"width");o!==void 0&&(e.width=o)}if(Er(i))if(e.style.height==="")e.height=e.width/(t||2);else{const o=dr(e,"height");o!==void 0&&(e.height=o)}return e}const Nl=fd?{passive:!0}:!1;function sp(e,t,n){e&&e.addEventListener(t,n,Nl)}function op(e,t,n){e&&e.canvas&&e.canvas.removeEventListener(t,n,Nl)}function rp(e,t){const n=np[e.type]||e.type,{x:i,y:s}=It(e,t);return{type:n,chart:t,native:e,x:i!==void 0?i:null,y:s!==void 0?s:null}}function Ei(e,t){for(const n of e)if(n===t||n.contains(t))return!0}function ap(e,t,n){const i=e.canvas,s=new MutationObserver(o=>{let r=!1;for(const a of o)r=r||Ei(a.addedNodes,i),r=r&&!Ei(a.removedNodes,i);r&&n()});return s.observe(document,{childList:!0,subtree:!0}),s}function lp(e,t,n){const i=e.canvas,s=new MutationObserver(o=>{let r=!1;for(const a of o)r=r||Ei(a.removedNodes,i),r=r&&!Ei(a.addedNodes,i);r&&n()});return s.observe(document,{childList:!0,subtree:!0}),s}const Ln=new Map;let Or=0;function zl(){const e=window.devicePixelRatio;e!==Or&&(Or=e,Ln.forEach((t,n)=>{n.currentDevicePixelRatio!==e&&t()}))}function cp(e,t){Ln.size||window.addEventListener("resize",zl),Ln.set(e,t)}function up(e){Ln.delete(e),Ln.size||window.removeEventListener("resize",zl)}function hp(e,t,n){const i=e.canvas,s=i&&go(i);if(!s)return;const o=ml((a,l)=>{const c=s.clientWidth;n(a,l),c<s.clientWidth&&n()},window),r=new ResizeObserver(a=>{const l=a[0],c=l.contentRect.width,u=l.contentRect.height;c===0&&u===0||o(c,u)});return r.observe(s),cp(e,o),r}function ss(e,t,n){n&&n.disconnect(),t==="resize"&&up(e)}function fp(e,t,n){const i=e.canvas,s=ml(o=>{e.ctx!==null&&n(rp(o,e))},e);return sp(i,t,s),s}class dp extends Rl{acquireContext(t,n){const i=t&&t.getContext&&t.getContext("2d");return i&&i.canvas===t?(ip(t,n),i):null}releaseContext(t){const n=t.canvas;if(!n[fi])return!1;const i=n[fi].initial;["height","width"].forEach(o=>{const r=i[o];V(r)?n.removeAttribute(o):n.setAttribute(o,r)});const s=i.style||{};return Object.keys(s).forEach(o=>{n.style[o]=s[o]}),n.width=n.width,delete n[fi],!0}addEventListener(t,n,i){this.removeEventListener(t,n);const s=t.$proxies||(t.$proxies={}),r={attach:ap,detach:lp,resize:hp}[n]||fp;s[n]=r(t,n,i)}removeEventListener(t,n){const i=t.$proxies||(t.$proxies={}),s=i[n];if(!s)return;({attach:ss,detach:ss,resize:ss}[n]||op)(t,n,s),i[n]=void 0}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(t,n,i,s){return hd(t,n,i,s)}isAttached(t){const n=t&&go(t);return!!(n&&n.isConnected)}}function pp(e){return!po()||typeof OffscreenCanvas<"u"&&e instanceof OffscreenCanvas?ep:dp}class en{static defaults={};static defaultRoutes=void 0;x;y;active=!1;options;$animations;tooltipPosition(t){const{x:n,y:i}=this.getProps(["x","y"],t);return{x:n,y:i}}hasValue(){return In(this.x)&&In(this.y)}getProps(t,n){const i=this.$animations;if(!n||!i)return this;const s={};return t.forEach(o=>{s[o]=i[o]&&i[o].active()?i[o]._to:this[o]}),s}}function gp(e,t){const n=e.options.ticks,i=mp(e),s=Math.min(n.maxTicksLimit||i,i),o=n.major.enabled?yp(t):[],r=o.length,a=o[0],l=o[r-1],c=[];if(r>s)return xp(t,c,o,r/s),c;const u=bp(o,t,s);if(r>0){let f,p;const g=r>1?Math.round((l-a)/(r-1)):null;for(si(t,c,u,V(g)?0:a-g,a),f=0,p=r-1;f<p;f++)si(t,c,u,o[f],o[f+1]);return si(t,c,u,l,V(g)?t.length:l+g),c}return si(t,c,u),c}function mp(e){const t=e.options.offset,n=e._tickSize(),i=e._length/n+(t?0:1),s=e._maxLength/n;return Math.floor(Math.min(i,s))}function bp(e,t,n){const i=vp(e),s=t.length/n;if(!i)return Math.max(s,1);const o=af(i);for(let r=0,a=o.length-1;r<a;r++){const l=o[r];if(l>s)return l}return Math.max(s,1)}function yp(e){const t=[];let n,i;for(n=0,i=e.length;n<i;n++)e[n].major&&t.push(n);return t}function xp(e,t,n,i){let s=0,o=n[0],r;for(i=Math.ceil(i),r=0;r<e.length;r++)r===o&&(t.push(e[r]),s++,o=n[s*i])}function si(e,t,n,i,s){const o=R(i,0),r=Math.min(R(s,e.length),e.length);let a=0,l,c,u;for(n=Math.ceil(n),s&&(l=s-i,n=l/Math.floor(l/n)),u=o;u<0;)a++,u=Math.round(o+a*n);for(c=Math.max(o,0);c<r;c++)c===u&&(t.push(e[c]),a++,u=Math.round(o+a*n))}function vp(e){const t=e.length;let n,i;if(t<2)return!1;for(i=e[0],n=1;n<t;++n)if(e[n]-e[n-1]!==i)return!1;return i}const _p=e=>e==="left"?"right":e==="right"?"left":e,Cr=(e,t,n)=>t==="top"||t==="left"?e[t]+n:e[t]-n,Pr=(e,t)=>Math.min(t||e,e);function Dr(e,t){const n=[],i=e.length/t,s=e.length;let o=0;for(;o<s;o+=i)n.push(e[Math.floor(o)]);return n}function wp(e,t,n){const i=e.ticks.length,s=Math.min(t,i-1),o=e._startPixel,r=e._endPixel,a=1e-6;let l=e.getPixelForTick(s),c;if(!(n&&(i===1?c=Math.max(l-o,r-l):t===0?c=(e.getPixelForTick(1)-l)/2:c=(l-e.getPixelForTick(s-1))/2,l+=s<t?c:-c,l<o-a||l>r+a)))return l}function Sp(e,t){z(e,n=>{const i=n.gc,s=i.length/2;let o;if(s>t){for(o=0;o<s;++o)delete n.data[i[o]];i.splice(0,s)}})}function gn(e){return e.drawTicks?e.tickLength:0}function Ar(e,t){if(!e.display)return 0;const n=ct(e.font,t),i=Mt(e.padding);return(Q(e.text)?e.text.length:1)*n.lineHeight+i.height}function kp(e,t){return Le(e,{scale:t,type:"scale"})}function Tp(e,t,n){return Le(e,{tick:n,index:t,type:"tick"})}function Mp(e,t,n){let i=bl(e);return(n&&t!=="right"||!n&&t==="right")&&(i=_p(i)),i}function Ep(e,t,n,i){const{top:s,left:o,bottom:r,right:a,chart:l}=e,{chartArea:c,scales:u}=l;let f=0,p,g,x;const y=r-s,v=a-o;if(e.isHorizontal()){if(g=ft(i,o,a),B(n)){const w=Object.keys(n)[0],k=n[w];x=u[w].getPixelForValue(k)+y-t}else n==="center"?x=(c.bottom+c.top)/2+y-t:x=Cr(e,n,t);p=a-o}else{if(B(n)){const w=Object.keys(n)[0],k=n[w];g=u[w].getPixelForValue(k)-v+t}else n==="center"?g=(c.left+c.right)/2-v+t:g=Cr(e,n,t);x=ft(i,r,s),f=n==="left"?-wt:wt}return{titleX:g,titleY:x,maxWidth:p,rotation:f}}class nn extends en{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,n){return t}getUserBounds(){let{_userMin:t,_userMax:n,_suggestedMin:i,_suggestedMax:s}=this;return t=Pt(t,Number.POSITIVE_INFINITY),n=Pt(n,Number.NEGATIVE_INFINITY),i=Pt(i,Number.POSITIVE_INFINITY),s=Pt(s,Number.NEGATIVE_INFINITY),{min:Pt(t,i),max:Pt(n,s),minDefined:xt(t),maxDefined:xt(n)}}getMinMax(t){let{min:n,max:i,minDefined:s,maxDefined:o}=this.getUserBounds(),r;if(s&&o)return{min:n,max:i};const a=this.getMatchingVisibleMetas();for(let l=0,c=a.length;l<c;++l)r=a[l].controller.getMinMax(this,t),s||(n=Math.min(n,r.min)),o||(i=Math.max(i,r.max));return n=o&&n>i?i:n,i=s&&n>i?n:i,{min:Pt(n,Pt(i,n)),max:Pt(i,Pt(n,i))}}getPadding(){return{left:this.paddingLeft||0,top:this.paddingTop||0,right:this.paddingRight||0,bottom:this.paddingBottom||0}}getTicks(){return this.ticks}getLabels(){const t=this.chart.data;return this.options.labels||(this.isHorizontal()?t.xLabels:t.yLabels)||t.labels||[]}getLabelItems(t=this.chart.chartArea){return this._labelItems||(this._labelItems=this._computeLabelItems(t))}beforeLayout(){this._cache={},this._dataLimitsCached=!1}beforeUpdate(){I(this.options.beforeUpdate,[this])}update(t,n,i){const{beginAtZero:s,grace:o,ticks:r}=this.options,a=r.sampleSize;this.beforeUpdate(),this.maxWidth=t,this.maxHeight=n,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=jf(this,o,s),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();const l=a<this.ticks.length;this._convertTicksToLabels(l?Dr(this.ticks,a):this.ticks),this.configure(),this.beforeCalculateLabelRotation(),this.calculateLabelRotation(),this.afterCalculateLabelRotation(),r.display&&(r.autoSkip||r.source==="auto")&&(this.ticks=gp(this,this.ticks),this._labelSizes=null,this.afterAutoSkip()),l&&this._convertTicksToLabels(this.ticks),this.beforeFit(),this.fit(),this.afterFit(),this.afterUpdate()}configure(){let t=this.options.reverse,n,i;this.isHorizontal()?(n=this.left,i=this.right):(n=this.top,i=this.bottom,t=!t),this._startPixel=n,this._endPixel=i,this._reversePixels=t,this._length=i-n,this._alignToPixels=this.options.alignToPixels}afterUpdate(){I(this.options.afterUpdate,[this])}beforeSetDimensions(){I(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(){I(this.options.afterSetDimensions,[this])}_callHooks(t){this.chart.notifyPlugins(t,this.getContext()),I(this.options[t],[this])}beforeDataLimits(){this._callHooks("beforeDataLimits")}determineDataLimits(){}afterDataLimits(){this._callHooks("afterDataLimits")}beforeBuildTicks(){this._callHooks("beforeBuildTicks")}buildTicks(){return[]}afterBuildTicks(){this._callHooks("afterBuildTicks")}beforeTickToLabelConversion(){I(this.options.beforeTickToLabelConversion,[this])}generateTickLabels(t){const n=this.options.ticks;let i,s,o;for(i=0,s=t.length;i<s;i++)o=t[i],o.label=I(n.callback,[o.value,i,t],this)}afterTickToLabelConversion(){I(this.options.afterTickToLabelConversion,[this])}beforeCalculateLabelRotation(){I(this.options.beforeCalculateLabelRotation,[this])}calculateLabelRotation(){const t=this.options,n=t.ticks,i=Pr(this.ticks.length,t.ticks.maxTicksLimit),s=n.minRotation||0,o=n.maxRotation;let r=s,a,l,c;if(!this._isVisible()||!n.display||s>=o||i<=1||!this.isHorizontal()){this.labelRotation=s;return}const u=this._getLabelSizes(),f=u.widest.width,p=u.highest.height,g=yt(this.chart.width-f,0,this.maxWidth);a=t.offset?this.maxWidth/i:g/(i-1),f+6>a&&(a=g/(i-(t.offset?.5:1)),l=this.maxHeight-gn(t.grid)-n.padding-Ar(t.title,this.chart.options.font),c=Math.sqrt(f*f+p*p),r=hf(Math.min(Math.asin(yt((u.highest.height+6)/a,-1,1)),Math.asin(yt(l/c,-1,1))-Math.asin(yt(p/c,-1,1)))),r=Math.max(s,Math.min(o,r))),this.labelRotation=r}afterCalculateLabelRotation(){I(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){I(this.options.beforeFit,[this])}fit(){const t={width:0,height:0},{chart:n,options:{ticks:i,title:s,grid:o}}=this,r=this._isVisible(),a=this.isHorizontal();if(r){const l=Ar(s,n.options.font);if(a?(t.width=this.maxWidth,t.height=gn(o)+l):(t.height=this.maxHeight,t.width=gn(o)+l),i.display&&this.ticks.length){const{first:c,last:u,widest:f,highest:p}=this._getLabelSizes(),g=i.padding*2,x=Me(this.labelRotation),y=Math.cos(x),v=Math.sin(x);if(a){const w=i.mirror?0:v*f.width+y*p.height;t.height=Math.min(this.maxHeight,t.height+w+g)}else{const w=i.mirror?0:y*f.width+v*p.height;t.width=Math.min(this.maxWidth,t.width+w+g)}this._calculatePadding(c,u,v,y)}}this._handleMargins(),a?(this.width=this._length=n.width-this._margins.left-this._margins.right,this.height=t.height):(this.width=t.width,this.height=this._length=n.height-this._margins.top-this._margins.bottom)}_calculatePadding(t,n,i,s){const{ticks:{align:o,padding:r},position:a}=this.options,l=this.labelRotation!==0,c=a!=="top"&&this.axis==="x";if(this.isHorizontal()){const u=this.getPixelForTick(0)-this.left,f=this.right-this.getPixelForTick(this.ticks.length-1);let p=0,g=0;l?c?(p=s*t.width,g=i*n.height):(p=i*t.height,g=s*n.width):o==="start"?g=n.width:o==="end"?p=t.width:o!=="inner"&&(p=t.width/2,g=n.width/2),this.paddingLeft=Math.max((p-u+r)*this.width/(this.width-u),0),this.paddingRight=Math.max((g-f+r)*this.width/(this.width-f),0)}else{let u=n.height/2,f=t.height/2;o==="start"?(u=0,f=t.height):o==="end"&&(u=n.height,f=0),this.paddingTop=u+r,this.paddingBottom=f+r}}_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(){I(this.options.afterFit,[this])}isHorizontal(){const{axis:t,position:n}=this.options;return n==="top"||n==="bottom"||t==="x"}isFullSize(){return this.options.fullSize}_convertTicksToLabels(t){this.beforeTickToLabelConversion(),this.generateTickLabels(t);let n,i;for(n=0,i=t.length;n<i;n++)V(t[n].label)&&(t.splice(n,1),i--,n--);this.afterTickToLabelConversion()}_getLabelSizes(){let t=this._labelSizes;if(!t){const n=this.options.ticks.sampleSize;let i=this.ticks;n<i.length&&(i=Dr(i,n)),this._labelSizes=t=this._computeLabelSizes(i,i.length,this.options.ticks.maxTicksLimit)}return t}_computeLabelSizes(t,n,i){const{ctx:s,_longestTextCache:o}=this,r=[],a=[],l=Math.floor(n/Pr(n,i));let c=0,u=0,f,p,g,x,y,v,w,k,O,C,T;for(f=0;f<n;f+=l){if(x=t[f].label,y=this._resolveTickFontOptions(f),s.font=v=y.string,w=o[v]=o[v]||{data:{},gc:[]},k=y.lineHeight,O=C=0,!V(x)&&!Q(x))O=lr(s,w.data,w.gc,O,x),C=k;else if(Q(x))for(p=0,g=x.length;p<g;++p)T=x[p],!V(T)&&!Q(T)&&(O=lr(s,w.data,w.gc,O,T),C+=k);r.push(O),a.push(C),c=Math.max(O,c),u=Math.max(C,u)}Sp(o,n);const D=r.indexOf(c),P=a.indexOf(u),E=A=>({width:r[A]||0,height:a[A]||0});return{first:E(0),last:E(n-1),widest:E(D),highest:E(P),widths:r,heights:a}}getLabelForValue(t){return t}getPixelForValue(t,n){return NaN}getValueForPixel(t){}getPixelForTick(t){const n=this.ticks;return t<0||t>n.length-1?null:this.getPixelForValue(n[t].value)}getPixelForDecimal(t){this._reversePixels&&(t=1-t);const n=this._startPixel+t*this._length;return pf(this._alignToPixels?_e(this.chart,n,0):n)}getDecimalForPixel(t){const n=(t-this._startPixel)/this._length;return this._reversePixels?1-n:n}getBasePixel(){return this.getPixelForValue(this.getBaseValue())}getBaseValue(){const{min:t,max:n}=this;return t<0&&n<0?n:t>0&&n>0?t:0}getContext(t){const n=this.ticks||[];if(t>=0&&t<n.length){const i=n[t];return i.$context||(i.$context=Tp(this.getContext(),t,i))}return this.$context||(this.$context=kp(this.chart.getContext(),this))}_tickSize(){const t=this.options.ticks,n=Me(this.labelRotation),i=Math.abs(Math.cos(n)),s=Math.abs(Math.sin(n)),o=this._getLabelSizes(),r=t.autoSkipPadding||0,a=o?o.widest.width+r:0,l=o?o.highest.height+r:0;return this.isHorizontal()?l*i>a*s?a/i:l/s:l*s<a*i?l/i:a/s}_isVisible(){const t=this.options.display;return t!=="auto"?!!t:this.getMatchingVisibleMetas().length>0}_computeGridLineItems(t){const n=this.axis,i=this.chart,s=this.options,{grid:o,position:r,border:a}=s,l=o.offset,c=this.isHorizontal(),f=this.ticks.length+(l?1:0),p=gn(o),g=[],x=a.setContext(this.getContext()),y=x.display?x.width:0,v=y/2,w=function(q){return _e(i,q,y)};let k,O,C,T,D,P,E,A,F,L,H,K;if(r==="top")k=w(this.bottom),P=this.bottom-p,A=k-v,L=w(t.top)+v,K=t.bottom;else if(r==="bottom")k=w(this.top),L=t.top,K=w(t.bottom)-v,P=k+v,A=this.top+p;else if(r==="left")k=w(this.right),D=this.right-p,E=k-v,F=w(t.left)+v,H=t.right;else if(r==="right")k=w(this.left),F=t.left,H=w(t.right)-v,D=k+v,E=this.left+p;else if(n==="x"){if(r==="center")k=w((t.top+t.bottom)/2+.5);else if(B(r)){const q=Object.keys(r)[0],nt=r[q];k=w(this.chart.scales[q].getPixelForValue(nt))}L=t.top,K=t.bottom,P=k+v,A=P+p}else if(n==="y"){if(r==="center")k=w((t.left+t.right)/2);else if(B(r)){const q=Object.keys(r)[0],nt=r[q];k=w(this.chart.scales[q].getPixelForValue(nt))}D=k-v,E=D-p,F=t.left,H=t.right}const et=R(s.ticks.maxTicksLimit,f),j=Math.max(1,Math.ceil(f/et));for(O=0;O<f;O+=j){const q=this.getContext(O),nt=o.setContext(q),Ne=a.setContext(q),pe=nt.lineWidth,qt=nt.color,ze=Ne.dash||[],dt=Ne.dashOffset,ge=nt.tickWidth,vt=nt.tickColor,me=nt.tickBorderDash||[],Ht=nt.tickBorderDashOffset;C=wp(this,O,l),C!==void 0&&(T=_e(i,C,pe),c?D=E=F=H=T:P=A=L=K=T,g.push({tx1:D,ty1:P,tx2:E,ty2:A,x1:F,y1:L,x2:H,y2:K,width:pe,color:qt,borderDash:ze,borderDashOffset:dt,tickWidth:ge,tickColor:vt,tickBorderDash:me,tickBorderDashOffset:Ht}))}return this._ticksLength=f,this._borderValue=k,g}_computeLabelItems(t){const n=this.axis,i=this.options,{position:s,ticks:o}=i,r=this.isHorizontal(),a=this.ticks,{align:l,crossAlign:c,padding:u,mirror:f}=o,p=gn(i.grid),g=p+u,x=f?-u:g,y=-Me(this.labelRotation),v=[];let w,k,O,C,T,D,P,E,A,F,L,H,K="middle";if(s==="top")D=this.bottom-x,P=this._getXAxisLabelAlignment();else if(s==="bottom")D=this.top+x,P=this._getXAxisLabelAlignment();else if(s==="left"){const j=this._getYAxisLabelAlignment(p);P=j.textAlign,T=j.x}else if(s==="right"){const j=this._getYAxisLabelAlignment(p);P=j.textAlign,T=j.x}else if(n==="x"){if(s==="center")D=(t.top+t.bottom)/2+g;else if(B(s)){const j=Object.keys(s)[0],q=s[j];D=this.chart.scales[j].getPixelForValue(q)+g}P=this._getXAxisLabelAlignment()}else if(n==="y"){if(s==="center")T=(t.left+t.right)/2-g;else if(B(s)){const j=Object.keys(s)[0],q=s[j];T=this.chart.scales[j].getPixelForValue(q)}P=this._getYAxisLabelAlignment(p).textAlign}n==="y"&&(l==="start"?K="top":l==="end"&&(K="bottom"));const et=this._getLabelSizes();for(w=0,k=a.length;w<k;++w){O=a[w],C=O.label;const j=o.setContext(this.getContext(w));E=this.getPixelForTick(w)+o.labelOffset,A=this._resolveTickFontOptions(w),F=A.lineHeight,L=Q(C)?C.length:1;const q=L/2,nt=j.color,Ne=j.textStrokeColor,pe=j.textStrokeWidth;let qt=P;r?(T=E,P==="inner"&&(w===k-1?qt=this.options.reverse?"left":"right":w===0?qt=this.options.reverse?"right":"left":qt="center"),s==="top"?c==="near"||y!==0?H=-L*F+F/2:c==="center"?H=-et.highest.height/2-q*F+F:H=-et.highest.height+F/2:c==="near"||y!==0?H=F/2:c==="center"?H=et.highest.height/2-q*F:H=et.highest.height-L*F,f&&(H*=-1),y!==0&&!j.showLabelBackdrop&&(T+=F/2*Math.sin(y))):(D=E,H=(1-L)*F/2);let ze;if(j.showLabelBackdrop){const dt=Mt(j.backdropPadding),ge=et.heights[w],vt=et.widths[w];let me=H-dt.top,Ht=0-dt.left;switch(K){case"middle":me-=ge/2;break;case"bottom":me-=ge;break}switch(P){case"center":Ht-=vt/2;break;case"right":Ht-=vt;break;case"inner":w===k-1?Ht-=vt:w>0&&(Ht-=vt/2);break}ze={left:Ht,top:me,width:vt+dt.width,height:ge+dt.height,color:j.backdropColor}}v.push({label:C,font:A,textOffset:H,options:{rotation:y,color:nt,strokeColor:Ne,strokeWidth:pe,textAlign:qt,textBaseline:K,translation:[T,D],backdrop:ze}})}return v}_getXAxisLabelAlignment(){const{position:t,ticks:n}=this.options;if(-Me(this.labelRotation))return t==="top"?"left":"right";let s="center";return n.align==="start"?s="left":n.align==="end"?s="right":n.align==="inner"&&(s="inner"),s}_getYAxisLabelAlignment(t){const{position:n,ticks:{crossAlign:i,mirror:s,padding:o}}=this.options,r=this._getLabelSizes(),a=t+o,l=r.widest.width;let c,u;return n==="left"?s?(u=this.right+o,i==="near"?c="left":i==="center"?(c="center",u+=l/2):(c="right",u+=l)):(u=this.right-a,i==="near"?c="right":i==="center"?(c="center",u-=l/2):(c="left",u=this.left)):n==="right"?s?(u=this.left+o,i==="near"?c="right":i==="center"?(c="center",u-=l/2):(c="left",u-=l)):(u=this.left+a,i==="near"?c="left":i==="center"?(c="center",u+=l/2):(c="right",u=this.right)):c="right",{textAlign:c,x:u}}_computeLabelArea(){if(this.options.ticks.mirror)return;const t=this.chart,n=this.options.position;if(n==="left"||n==="right")return{top:0,left:this.left,bottom:t.height,right:this.right};if(n==="top"||n==="bottom")return{top:this.top,left:0,bottom:this.bottom,right:t.width}}drawBackground(){const{ctx:t,options:{backgroundColor:n},left:i,top:s,width:o,height:r}=this;n&&(t.save(),t.fillStyle=n,t.fillRect(i,s,o,r),t.restore())}getLineWidthForValue(t){const n=this.options.grid;if(!this._isVisible()||!n.display)return 0;const s=this.ticks.findIndex(o=>o.value===t);return s>=0?n.setContext(this.getContext(s)).lineWidth:0}drawGrid(t){const n=this.options.grid,i=this.ctx,s=this._gridLineItems||(this._gridLineItems=this._computeGridLineItems(t));let o,r;const a=(l,c,u)=>{!u.width||!u.color||(i.save(),i.lineWidth=u.width,i.strokeStyle=u.color,i.setLineDash(u.borderDash||[]),i.lineDashOffset=u.borderDashOffset,i.beginPath(),i.moveTo(l.x,l.y),i.lineTo(c.x,c.y),i.stroke(),i.restore())};if(n.display)for(o=0,r=s.length;o<r;++o){const l=s[o];n.drawOnChartArea&&a({x:l.x1,y:l.y1},{x:l.x2,y:l.y2},l),n.drawTicks&&a({x:l.tx1,y:l.ty1},{x:l.tx2,y:l.ty2},{color:l.tickColor,width:l.tickWidth,borderDash:l.tickBorderDash,borderDashOffset:l.tickBorderDashOffset})}}drawBorder(){const{chart:t,ctx:n,options:{border:i,grid:s}}=this,o=i.setContext(this.getContext()),r=i.display?o.width:0;if(!r)return;const a=s.setContext(this.getContext(0)).lineWidth,l=this._borderValue;let c,u,f,p;this.isHorizontal()?(c=_e(t,this.left,r)-r/2,u=_e(t,this.right,a)+a/2,f=p=l):(f=_e(t,this.top,r)-r/2,p=_e(t,this.bottom,a)+a/2,c=u=l),n.save(),n.lineWidth=o.width,n.strokeStyle=o.color,n.beginPath(),n.moveTo(c,f),n.lineTo(u,p),n.stroke(),n.restore()}drawLabels(t){if(!this.options.ticks.display)return;const i=this.ctx,s=this._computeLabelArea();s&&lo(i,s);const o=this.getLabelItems(t);for(const r of o){const a=r.options,l=r.font,c=r.label,u=r.textOffset;Ti(i,c,0,u,l,a)}s&&co(i)}drawTitle(){const{ctx:t,options:{position:n,title:i,reverse:s}}=this;if(!i.display)return;const o=ct(i.font),r=Mt(i.padding),a=i.align;let l=o.lineHeight/2;n==="bottom"||n==="center"||B(n)?(l+=r.bottom,Q(i.text)&&(l+=o.lineHeight*(i.text.length-1))):l+=r.top;const{titleX:c,titleY:u,maxWidth:f,rotation:p}=Ep(this,l,n,a);Ti(t,i.text,0,0,o,{color:i.color,maxWidth:f,rotation:p,textAlign:Mp(a,n,s),textBaseline:"middle",translation:[c,u]})}draw(t){this._isVisible()&&(this.drawBackground(),this.drawGrid(t),this.drawBorder(),this.drawTitle(),this.drawLabels(t))}_layers(){const t=this.options,n=t.ticks&&t.ticks.z||0,i=R(t.grid&&t.grid.z,-1),s=R(t.border&&t.border.z,0);return!this._isVisible()||this.draw!==nn.prototype.draw?[{z:n,draw:o=>{this.draw(o)}}]:[{z:i,draw:o=>{this.drawBackground(),this.drawGrid(o),this.drawTitle()}},{z:s,draw:()=>{this.drawBorder()}},{z:n,draw:o=>{this.drawLabels(o)}}]}getMatchingVisibleMetas(t){const n=this.chart.getSortedVisibleDatasetMetas(),i=this.axis+"AxisID",s=[];let o,r;for(o=0,r=n.length;o<r;++o){const a=n[o];a[i]===this.id&&(!t||a.type===t)&&s.push(a)}return s}_resolveTickFontOptions(t){const n=this.options.ticks.setContext(this.getContext(t));return ct(n.font)}_maxDigits(){const t=this._resolveTickFontOptions(0).lineHeight;return(this.isHorizontal()?this.width:this.height)/t}}class oi{constructor(t,n,i){this.type=t,this.scope=n,this.override=i,this.items=Object.create(null)}isForType(t){return Object.prototype.isPrototypeOf.call(this.type.prototype,t.prototype)}register(t){const n=Object.getPrototypeOf(t);let i;Pp(n)&&(i=this.register(n));const s=this.items,o=t.id,r=this.scope+"."+o;if(!o)throw new Error("class does not have id: "+t);return o in s||(s[o]=t,Op(t,r,i),this.override&&Y.override(t.id,t.overrides)),r}get(t){return this.items[t]}unregister(t){const n=this.items,i=t.id,s=this.scope;i in n&&delete n[i],s&&i in Y[s]&&(delete Y[s][i],this.override&&delete Ae[i])}}function Op(e,t,n){const i=An(Object.create(null),[n?Y.get(n):{},Y.get(t),e.defaults]);Y.set(t,i),e.defaultRoutes&&Cp(t,e.defaultRoutes),e.descriptors&&Y.describe(t,e.descriptors)}function Cp(e,t){Object.keys(t).forEach(n=>{const i=n.split("."),s=i.pop(),o=[e].concat(i).join("."),r=t[n].split("."),a=r.pop(),l=r.join(".");Y.route(o,s,l,a)})}function Pp(e){return"id"in e&&"defaults"in e}class Dp{constructor(){this.controllers=new oi(Al,"datasets",!0),this.elements=new oi(en,"elements"),this.plugins=new oi(Object,"plugins"),this.scales=new oi(nn,"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,n,i){[...n].forEach(s=>{const o=i||this._getRegistryForType(s);i||o.isForType(s)||o===this.plugins&&s.id?this._exec(t,o,s):z(s,r=>{const a=i||this._getRegistryForType(r);this._exec(t,a,r)})})}_exec(t,n,i){const s=oo(t);I(i["before"+s],[],i),n[t](i),I(i["after"+s],[],i)}_getRegistryForType(t){for(let n=0;n<this._typedRegistries.length;n++){const i=this._typedRegistries[n];if(i.isForType(t))return i}return this.plugins}_get(t,n,i){const s=n.get(t);if(s===void 0)throw new Error('"'+t+'" is not a registered '+i+".");return s}}var At=new Dp;class Ap{constructor(){this._init=[]}notify(t,n,i,s){n==="beforeInit"&&(this._init=this._createDescriptors(t,!0),this._notify(this._init,t,"install"));const o=s?this._descriptors(t).filter(s):this._descriptors(t),r=this._notify(o,t,n,i);return n==="afterDestroy"&&(this._notify(o,t,"stop"),this._notify(this._init,t,"uninstall")),r}_notify(t,n,i,s){s=s||{};for(const o of t){const r=o.plugin,a=r[i],l=[n,s,o.options];if(I(a,l,r)===!1&&s.cancelable)return!1}return!0}invalidate(){V(this._cache)||(this._oldCache=this._cache,this._cache=void 0)}_descriptors(t){if(this._cache)return this._cache;const n=this._cache=this._createDescriptors(t);return this._notifyStateChanges(t),n}_createDescriptors(t,n){const i=t&&t.config,s=R(i.options&&i.options.plugins,{}),o=Ip(i);return s===!1&&!n?[]:Rp(t,o,s,n)}_notifyStateChanges(t){const n=this._oldCache||[],i=this._cache,s=(o,r)=>o.filter(a=>!r.some(l=>a.plugin.id===l.plugin.id));this._notify(s(n,i),t,"stop"),this._notify(s(i,n),t,"start")}}function Ip(e){const t={},n=[],i=Object.keys(At.plugins.items);for(let o=0;o<i.length;o++)n.push(At.getPlugin(i[o]));const s=e.plugins||[];for(let o=0;o<s.length;o++){const r=s[o];n.indexOf(r)===-1&&(n.push(r),t[r.id]=!0)}return{plugins:n,localIds:t}}function Lp(e,t){return!t&&e===!1?null:e===!0?{}:e}function Rp(e,{plugins:t,localIds:n},i,s){const o=[],r=e.getContext();for(const a of t){const l=a.id,c=Lp(i[l],s);c!==null&&o.push({plugin:a,options:Np(e.config,{plugin:a,local:n[l]},c,r)})}return o}function Np(e,{plugin:t,local:n},i,s){const o=e.pluginScopeKeys(t),r=e.getOptionScopes(i,o);return n&&t.defaults&&r.push(t.defaults),e.createResolver(r,s,[""],{scriptable:!1,indexable:!1,allKeys:!0})}function Rs(e,t){const n=Y.datasets[e]||{};return((t.datasets||{})[e]||{}).indexAxis||t.indexAxis||n.indexAxis||"x"}function zp(e,t){let n=e;return e==="_index_"?n=t:e==="_value_"&&(n=t==="x"?"y":"x"),n}function Fp(e,t){return e===t?"_index_":"_value_"}function Ir(e){if(e==="x"||e==="y"||e==="r")return e}function Hp(e){if(e==="top"||e==="bottom")return"x";if(e==="left"||e==="right")return"y"}function Ns(e,...t){if(Ir(e))return e;for(const n of t){const i=n.axis||Hp(n.position)||e.length>1&&Ir(e[0].toLowerCase());if(i)return i}throw new Error(\`Cannot determine type of '\${e}' axis. Please provide 'axis' or 'position' option.\`)}function Lr(e,t,n){if(n[t+"AxisID"]===e)return{axis:t}}function Bp(e,t){if(t.data&&t.data.datasets){const n=t.data.datasets.filter(i=>i.xAxisID===e||i.yAxisID===e);if(n.length)return Lr(e,"x",n[0])||Lr(e,"y",n[0])}return{}}function Vp(e,t){const n=Ae[e.type]||{scales:{}},i=t.scales||{},s=Rs(e.type,t),o=Object.create(null);return Object.keys(i).forEach(r=>{const a=i[r];if(!B(a))return console.error(\`Invalid scale configuration for scale: \${r}\`);if(a._proxy)return console.warn(\`Ignoring resolver passed as options for scale: \${r}\`);const l=Ns(r,a,Bp(r,e),Y.scales[a.type]),c=Fp(l,s),u=n.scales||{};o[r]=wn(Object.create(null),[{axis:l},a,u[l],u[c]])}),e.data.datasets.forEach(r=>{const a=r.type||e.type,l=r.indexAxis||Rs(a,t),u=(Ae[a]||{}).scales||{};Object.keys(u).forEach(f=>{const p=zp(f,l),g=r[p+"AxisID"]||p;o[g]=o[g]||Object.create(null),wn(o[g],[{axis:p},i[g],u[f]])})}),Object.keys(o).forEach(r=>{const a=o[r];wn(a,[Y.scales[a.type],Y.scale])}),o}function Fl(e){const t=e.options||(e.options={});t.plugins=R(t.plugins,{}),t.scales=Vp(e,t)}function Hl(e){return e=e||{},e.datasets=e.datasets||[],e.labels=e.labels||[],e}function Wp(e){return e=e||{},e.data=Hl(e.data),Fl(e),e}const Rr=new Map,Bl=new Set;function ri(e,t){let n=Rr.get(e);return n||(n=t(),Rr.set(e,n),Bl.add(n)),n}const mn=(e,t,n)=>{const i=wi(t,n);i!==void 0&&e.add(i)};class jp{constructor(t){this._config=Wp(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=Hl(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(),Fl(t)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(t){return ri(t,()=>[[\`datasets.\${t}\`,""]])}datasetAnimationScopeKeys(t,n){return ri(\`\${t}.transition.\${n}\`,()=>[[\`datasets.\${t}.transitions.\${n}\`,\`transitions.\${n}\`],[\`datasets.\${t}\`,""]])}datasetElementScopeKeys(t,n){return ri(\`\${t}-\${n}\`,()=>[[\`datasets.\${t}.elements.\${n}\`,\`datasets.\${t}\`,\`elements.\${n}\`,""]])}pluginScopeKeys(t){const n=t.id,i=this.type;return ri(\`\${i}-plugin-\${n}\`,()=>[[\`plugins.\${n}\`,...t.additionalOptionScopes||[]]])}_cachedScopes(t,n){const i=this._scopeCache;let s=i.get(t);return(!s||n)&&(s=new Map,i.set(t,s)),s}getOptionScopes(t,n,i){const{options:s,type:o}=this,r=this._cachedScopes(t,i),a=r.get(n);if(a)return a;const l=new Set;n.forEach(u=>{t&&(l.add(t),u.forEach(f=>mn(l,t,f))),u.forEach(f=>mn(l,s,f)),u.forEach(f=>mn(l,Ae[o]||{},f)),u.forEach(f=>mn(l,Y,f)),u.forEach(f=>mn(l,As,f))});const c=Array.from(l);return c.length===0&&c.push(Object.create(null)),Bl.has(n)&&r.set(n,c),c}chartOptionScopes(){const{options:t,type:n}=this;return[t,Ae[n]||{},Y.datasets[n]||{},{type:n},Y,As]}resolveNamedOptions(t,n,i,s=[""]){const o={$shared:!0},{resolver:r,subPrefixes:a}=Nr(this._resolverCache,t,s);let l=r;if($p(r,n)){o.$shared=!1,i=le(i)?i():i;const c=this.createResolver(t,i,a);l=Qe(r,i,c)}for(const c of n)o[c]=l[c];return o}createResolver(t,n,i=[""],s){const{resolver:o}=Nr(this._resolverCache,t,i);return B(n)?Qe(o,n,void 0,s):o}}function Nr(e,t,n){let i=e.get(t);i||(i=new Map,e.set(t,i));const s=n.join();let o=i.get(s);return o||(o={resolver:uo(t,n),subPrefixes:n.filter(a=>!a.toLowerCase().includes("hover"))},i.set(s,o)),o}const Up=e=>B(e)&&Object.getOwnPropertyNames(e).some(t=>le(e[t]));function $p(e,t){const{isScriptable:n,isIndexable:i}=wl(e);for(const s of t){const o=n(s),r=i(s),a=(r||o)&&e[s];if(o&&(le(a)||Up(a))||r&&Q(a))return!0}return!1}var Yp="4.5.0";const Xp=["top","bottom","left","right","chartArea"];function zr(e,t){return e==="top"||e==="bottom"||Xp.indexOf(e)===-1&&t==="x"}function Fr(e,t){return function(n,i){return n[e]===i[e]?n[t]-i[t]:n[e]-i[e]}}function Hr(e){const t=e.chart,n=t.options.animation;t.notifyPlugins("afterRender"),I(n&&n.onComplete,[e],t)}function qp(e){const t=e.chart,n=t.options.animation;I(n&&n.onProgress,[e],t)}function Vl(e){return po()&&typeof e=="string"?e=document.getElementById(e):e&&e.length&&(e=e[0]),e&&e.canvas&&(e=e.canvas),e}const di={},Br=e=>{const t=Vl(e);return Object.values(di).filter(n=>n.canvas===t).pop()};function Gp(e,t,n){const i=Object.keys(e);for(const s of i){const o=+s;if(o>=t){const r=e[s];delete e[s],(n>0||o>t)&&(e[o+n]=r)}}}function Kp(e,t,n,i){return!n||e.type==="mouseout"?null:i?t:e}class zs{static defaults=Y;static instances=di;static overrides=Ae;static registry=At;static version=Yp;static getChart=Br;static register(...t){At.add(...t),Vr()}static unregister(...t){At.remove(...t),Vr()}constructor(t,n){const i=this.config=new jp(n),s=Vl(t),o=Br(s);if(o)throw new Error("Canvas is already in use. Chart with ID '"+o.id+"' must be destroyed before the canvas with ID '"+o.canvas.id+"' can be reused.");const r=i.createResolver(i.chartOptionScopes(),this.getContext());this.platform=new(i.platform||pp(s)),this.platform.updateConfig(i);const a=this.platform.acquireContext(s,r.aspectRatio),l=a&&a.canvas,c=l&&l.height,u=l&&l.width;if(this.id=Zh(),this.ctx=a,this.canvas=l,this.width=u,this.height=c,this._options=r,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 Ap,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=xf(f=>this.update(f),r.resizeDelay||0),this._dataChanges=[],di[this.id]=this,!a||!l){console.error("Failed to create chart: can't acquire context from the given item");return}jt.listen(this,"complete",Hr),jt.listen(this,"progress",qp),this._initialize(),this.attached&&this.update()}get aspectRatio(){const{options:{aspectRatio:t,maintainAspectRatio:n},width:i,height:s,_aspectRatio:o}=this;return V(t)?n&&o?o:s?i/s:null:t}get data(){return this.config.data}set data(t){this.config.data=t}get options(){return this._options}set options(t){this.config.options=t}get registry(){return At}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():fr(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return cr(this.canvas,this.ctx),this}stop(){return jt.stop(this),this}resize(t,n){jt.running(this)?this._resizeBeforeDraw={width:t,height:n}:this._resize(t,n)}_resize(t,n){const i=this.options,s=this.canvas,o=i.maintainAspectRatio&&this.aspectRatio,r=this.platform.getMaximumSize(s,t,n,o),a=i.devicePixelRatio||this.platform.getDevicePixelRatio(),l=this.width?"resize":"attach";this.width=r.width,this.height=r.height,this._aspectRatio=this.aspectRatio,fr(this,a,!0)&&(this.notifyPlugins("resize",{size:r}),I(i.onResize,[this,r],this),this.attached&&this._doResize(l)&&this.render())}ensureScalesHaveIDs(){const n=this.options.scales||{};z(n,(i,s)=>{i.id=s})}buildOrUpdateScales(){const t=this.options,n=t.scales,i=this.scales,s=Object.keys(i).reduce((r,a)=>(r[a]=!1,r),{});let o=[];n&&(o=o.concat(Object.keys(n).map(r=>{const a=n[r],l=Ns(r,a),c=l==="r",u=l==="x";return{options:a,dposition:c?"chartArea":u?"bottom":"left",dtype:c?"radialLinear":u?"category":"linear"}}))),z(o,r=>{const a=r.options,l=a.id,c=Ns(l,a),u=R(a.type,r.dtype);(a.position===void 0||zr(a.position,c)!==zr(r.dposition))&&(a.position=r.dposition),s[l]=!0;let f=null;if(l in i&&i[l].type===u)f=i[l];else{const p=At.getScale(u);f=new p({id:l,type:u,ctx:this.ctx,chart:this}),i[f.id]=f}f.init(a,t)}),z(s,(r,a)=>{r||delete i[a]}),z(i,r=>{ee.configure(this,r,r.options),ee.addBox(this,r)})}_updateMetasets(){const t=this._metasets,n=this.data.datasets.length,i=t.length;if(t.sort((s,o)=>s.index-o.index),i>n){for(let s=n;s<i;++s)this._destroyDatasetMeta(s);t.splice(n,i-n)}this._sortedMetasets=t.slice(0).sort(Fr("order","index"))}_removeUnreferencedMetasets(){const{_metasets:t,data:{datasets:n}}=this;t.length>n.length&&delete this._stacks,t.forEach((i,s)=>{n.filter(o=>o===i._dataset).length===0&&this._destroyDatasetMeta(s)})}buildOrUpdateControllers(){const t=[],n=this.data.datasets;let i,s;for(this._removeUnreferencedMetasets(),i=0,s=n.length;i<s;i++){const o=n[i];let r=this.getDatasetMeta(i);const a=o.type||this.config.type;if(r.type&&r.type!==a&&(this._destroyDatasetMeta(i),r=this.getDatasetMeta(i)),r.type=a,r.indexAxis=o.indexAxis||Rs(a,this.options),r.order=o.order||0,r.index=i,r.label=""+o.label,r.visible=this.isDatasetVisible(i),r.controller)r.controller.updateIndex(i),r.controller.linkScales();else{const l=At.getController(a),{datasetElementType:c,dataElementType:u}=Y.datasets[a];Object.assign(l,{dataElementType:At.getElement(u),datasetElementType:c&&At.getElement(c)}),r.controller=new l(this,i),t.push(r.controller)}}return this._updateMetasets(),t}_resetElements(){z(this.data.datasets,(t,n)=>{this.getDatasetMeta(n).controller.reset()},this)}reset(){this._resetElements(),this.notifyPlugins("reset")}update(t){const n=this.config;n.update();const i=this._options=n.createResolver(n.chartOptionScopes(),this.getContext()),s=this._animationsDisabled=!i.animation;if(this._updateScales(),this._checkEventBindings(),this._updateHiddenIndices(),this._plugins.invalidate(),this.notifyPlugins("beforeUpdate",{mode:t,cancelable:!0})===!1)return;const o=this.buildOrUpdateControllers();this.notifyPlugins("beforeElementsUpdate");let r=0;for(let c=0,u=this.data.datasets.length;c<u;c++){const{controller:f}=this.getDatasetMeta(c),p=!s&&o.indexOf(f)===-1;f.buildOrUpdateElements(p),r=Math.max(+f.getMaxOverflow(),r)}r=this._minPadding=i.layout.autoPadding?r:0,this._updateLayout(r),s||z(o,c=>{c.reset()}),this._updateDatasets(t),this.notifyPlugins("afterUpdate",{mode:t}),this._layers.sort(Fr("z","_idx"));const{_active:a,_lastEvent:l}=this;l?this._eventHandler(l,!0):a.length&&this._updateHoverStyles(a,a,!0),this.render()}_updateScales(){z(this.scales,t=>{ee.removeBox(this,t)}),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){const t=this.options,n=new Set(Object.keys(this._listeners)),i=new Set(t.events);(!Jo(n,i)||!!this._responsiveListeners!==t.responsive)&&(this.unbindEvents(),this.bindEvents())}_updateHiddenIndices(){const{_hiddenIndices:t}=this,n=this._getUniformDataChanges()||[];for(const{method:i,start:s,count:o}of n){const r=i==="_removeElements"?-o:o;Gp(t,s,r)}}_getUniformDataChanges(){const t=this._dataChanges;if(!t||!t.length)return;this._dataChanges=[];const n=this.data.datasets.length,i=o=>new Set(t.filter(r=>r[0]===o).map((r,a)=>a+","+r.splice(1).join(","))),s=i(0);for(let o=1;o<n;o++)if(!Jo(s,i(o)))return;return Array.from(s).map(o=>o.split(",")).map(o=>({method:o[1],start:+o[2],count:+o[3]}))}_updateLayout(t){if(this.notifyPlugins("beforeLayout",{cancelable:!0})===!1)return;ee.update(this,this.width,this.height,t);const n=this.chartArea,i=n.width<=0||n.height<=0;this._layers=[],z(this.boxes,s=>{i&&s.position==="chartArea"||(s.configure&&s.configure(),this._layers.push(...s._layers()))},this),this._layers.forEach((s,o)=>{s._idx=o}),this.notifyPlugins("afterLayout")}_updateDatasets(t){if(this.notifyPlugins("beforeDatasetsUpdate",{mode:t,cancelable:!0})!==!1){for(let n=0,i=this.data.datasets.length;n<i;++n)this.getDatasetMeta(n).controller.configure();for(let n=0,i=this.data.datasets.length;n<i;++n)this._updateDataset(n,le(t)?t({datasetIndex:n}):t);this.notifyPlugins("afterDatasetsUpdate",{mode:t})}}_updateDataset(t,n){const i=this.getDatasetMeta(t),s={meta:i,index:t,mode:n,cancelable:!0};this.notifyPlugins("beforeDatasetUpdate",s)!==!1&&(i.controller._update(n),s.cancelable=!1,this.notifyPlugins("afterDatasetUpdate",s))}render(){this.notifyPlugins("beforeRender",{cancelable:!0})!==!1&&(jt.has(this)?this.attached&&!jt.running(this)&&jt.start(this):(this.draw(),Hr({chart:this})))}draw(){let t;if(this._resizeBeforeDraw){const{width:i,height:s}=this._resizeBeforeDraw;this._resizeBeforeDraw=null,this._resize(i,s)}if(this.clear(),this.width<=0||this.height<=0||this.notifyPlugins("beforeDraw",{cancelable:!0})===!1)return;const n=this._layers;for(t=0;t<n.length&&n[t].z<=0;++t)n[t].draw(this.chartArea);for(this._drawDatasets();t<n.length;++t)n[t].draw(this.chartArea);this.notifyPlugins("afterDraw")}_getSortedDatasetMetas(t){const n=this._sortedMetasets,i=[];let s,o;for(s=0,o=n.length;s<o;++s){const r=n[s];(!t||r.visible)&&i.push(r)}return i}getSortedVisibleDatasetMetas(){return this._getSortedDatasetMetas(!0)}_drawDatasets(){if(this.notifyPlugins("beforeDatasetsDraw",{cancelable:!0})===!1)return;const t=this.getSortedVisibleDatasetMetas();for(let n=t.length-1;n>=0;--n)this._drawDataset(t[n]);this.notifyPlugins("afterDatasetsDraw")}_drawDataset(t){const n=this.ctx,i={meta:t,index:t.index,cancelable:!0},s=Md(this,t);this.notifyPlugins("beforeDatasetDraw",i)!==!1&&(s&&lo(n,s),t.controller.draw(),s&&co(n),i.cancelable=!1,this.notifyPlugins("afterDatasetDraw",i))}isPointInArea(t){return Ze(t,this.chartArea,this._minPadding)}getElementsAtEventForMode(t,n,i,s){const o=Xd.modes[n];return typeof o=="function"?o(this,t,i,s):[]}getDatasetMeta(t){const n=this.data.datasets[t],i=this._metasets;let s=i.filter(o=>o&&o._dataset===n).pop();return s||(s={type:null,data:[],dataset:null,controller:null,hidden:null,xAxisID:null,yAxisID:null,order:n&&n.order||0,index:t,_dataset:n,_parsed:[],_sorted:!1},i.push(s)),s}getContext(){return this.$context||(this.$context=Le(null,{chart:this,type:"chart"}))}getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(t){const n=this.data.datasets[t];if(!n)return!1;const i=this.getDatasetMeta(t);return typeof i.hidden=="boolean"?!i.hidden:!n.hidden}setDatasetVisibility(t,n){const i=this.getDatasetMeta(t);i.hidden=!n}toggleDataVisibility(t){this._hiddenIndices[t]=!this._hiddenIndices[t]}getDataVisibility(t){return!this._hiddenIndices[t]}_updateVisibility(t,n,i){const s=i?"show":"hide",o=this.getDatasetMeta(t),r=o.controller._resolveAnimations(void 0,s);Si(n)?(o.data[n].hidden=!i,this.update()):(this.setDatasetVisibility(t,i),r.update(o,{visible:i}),this.update(a=>a.datasetIndex===t?s:void 0))}hide(t,n){this._updateVisibility(t,n,!1)}show(t,n){this._updateVisibility(t,n,!0)}_destroyDatasetMeta(t){const n=this._metasets[t];n&&n.controller&&n.controller._destroy(),delete this._metasets[t]}_stop(){let t,n;for(this.stop(),jt.remove(this),t=0,n=this.data.datasets.length;t<n;++t)this._destroyDatasetMeta(t)}destroy(){this.notifyPlugins("beforeDestroy");const{canvas:t,ctx:n}=this;this._stop(),this.config.clearCache(),t&&(this.unbindEvents(),cr(t,n),this.platform.releaseContext(n),this.canvas=null,this.ctx=null),delete di[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,n=this.platform,i=(o,r)=>{n.addEventListener(this,o,r),t[o]=r},s=(o,r,a)=>{o.offsetX=r,o.offsetY=a,this._eventHandler(o)};z(this.options.events,o=>i(o,s))}bindResponsiveEvents(){this._responsiveListeners||(this._responsiveListeners={});const t=this._responsiveListeners,n=this.platform,i=(l,c)=>{n.addEventListener(this,l,c),t[l]=c},s=(l,c)=>{t[l]&&(n.removeEventListener(this,l,c),delete t[l])},o=(l,c)=>{this.canvas&&this.resize(l,c)};let r;const a=()=>{s("attach",a),this.attached=!0,this.resize(),i("resize",o),i("detach",r)};r=()=>{this.attached=!1,s("resize",o),this._stop(),this._resize(0,0),i("attach",a)},n.isAttached(this.canvas)?a():r()}unbindEvents(){z(this._listeners,(t,n)=>{this.platform.removeEventListener(this,n,t)}),this._listeners={},z(this._responsiveListeners,(t,n)=>{this.platform.removeEventListener(this,n,t)}),this._responsiveListeners=void 0}updateHoverStyle(t,n,i){const s=i?"set":"remove";let o,r,a,l;for(n==="dataset"&&(o=this.getDatasetMeta(t[0].datasetIndex),o.controller["_"+s+"DatasetHoverStyle"]()),a=0,l=t.length;a<l;++a){r=t[a];const c=r&&this.getDatasetMeta(r.datasetIndex).controller;c&&c[s+"HoverStyle"](r.element,r.datasetIndex,r.index)}}getActiveElements(){return this._active||[]}setActiveElements(t){const n=this._active||[],i=t.map(({datasetIndex:o,index:r})=>{const a=this.getDatasetMeta(o);if(!a)throw new Error("No dataset found at index "+o);return{datasetIndex:o,element:a.data[r],index:r}});!vi(i,n)&&(this._active=i,this._lastEvent=null,this._updateHoverStyles(i,n))}notifyPlugins(t,n,i){return this._plugins.notify(this,t,n,i)}isPluginEnabled(t){return this._plugins._cache.filter(n=>n.plugin.id===t).length===1}_updateHoverStyles(t,n,i){const s=this.options.hover,o=(l,c)=>l.filter(u=>!c.some(f=>u.datasetIndex===f.datasetIndex&&u.index===f.index)),r=o(n,t),a=i?t:o(t,n);r.length&&this.updateHoverStyle(r,s.mode,!1),a.length&&s.mode&&this.updateHoverStyle(a,s.mode,!0)}_eventHandler(t,n){const i={event:t,replay:n,cancelable:!0,inChartArea:this.isPointInArea(t)},s=r=>(r.options.events||this.options.events).includes(t.native.type);if(this.notifyPlugins("beforeEvent",i,s)===!1)return;const o=this._handleEvent(t,n,i.inChartArea);return i.cancelable=!1,this.notifyPlugins("afterEvent",i,s),(o||i.changed)&&this.render(),this}_handleEvent(t,n,i){const{_active:s=[],options:o}=this,r=n,a=this._getActiveElements(t,s,i,r),l=sf(t),c=Kp(t,this._lastEvent,i,l);i&&(this._lastEvent=null,I(o.onHover,[t,a,this],this),l&&I(o.onClick,[t,a,this],this));const u=!vi(a,s);return(u||n)&&(this._active=a,this._updateHoverStyles(a,s,n)),this._lastEvent=c,u}_getActiveElements(t,n,i,s){if(t.type==="mouseout")return[];if(!i)return n;const o=this.options.hover;return this.getElementsAtEventForMode(t,o.mode,o,s)}}function Vr(){return z(zs.instances,e=>e._plugins.invalidate())}function Wl(e,t,n=t){e.lineCap=R(n.borderCapStyle,t.borderCapStyle),e.setLineDash(R(n.borderDash,t.borderDash)),e.lineDashOffset=R(n.borderDashOffset,t.borderDashOffset),e.lineJoin=R(n.borderJoinStyle,t.borderJoinStyle),e.lineWidth=R(n.borderWidth,t.borderWidth),e.strokeStyle=R(n.borderColor,t.borderColor)}function Zp(e,t,n){e.lineTo(n.x,n.y)}function Qp(e){return e.stepped?If:e.tension||e.cubicInterpolationMode==="monotone"?Lf:Zp}function jl(e,t,n={}){const i=e.length,{start:s=0,end:o=i-1}=n,{start:r,end:a}=t,l=Math.max(s,r),c=Math.min(o,a),u=s<r&&o<r||s>a&&o>a;return{count:i,start:l,loop:t.loop,ilen:c<l&&!u?i+c-l:c-l}}function Jp(e,t,n,i){const{points:s,options:o}=t,{count:r,start:a,loop:l,ilen:c}=jl(s,n,i),u=Qp(o);let{move:f=!0,reverse:p}=i||{},g,x,y;for(g=0;g<=c;++g)x=s[(a+(p?c-g:g))%r],!x.skip&&(f?(e.moveTo(x.x,x.y),f=!1):u(e,y,x,p,o.stepped),y=x);return l&&(x=s[(a+(p?c:0))%r],u(e,y,x,p,o.stepped)),!!l}function tg(e,t,n,i){const s=t.points,{count:o,start:r,ilen:a}=jl(s,n,i),{move:l=!0,reverse:c}=i||{};let u=0,f=0,p,g,x,y,v,w;const k=C=>(r+(c?a-C:C))%o,O=()=>{y!==v&&(e.lineTo(u,v),e.lineTo(u,y),e.lineTo(u,w))};for(l&&(g=s[k(0)],e.moveTo(g.x,g.y)),p=0;p<=a;++p){if(g=s[k(p)],g.skip)continue;const C=g.x,T=g.y,D=C|0;D===x?(T<y?y=T:T>v&&(v=T),u=(f*u+C)/++f):(O(),e.lineTo(C,T),x=D,f=0,y=v=T),w=T}O()}function Fs(e){const t=e.options,n=t.borderDash&&t.borderDash.length;return!e._decimated&&!e._loop&&!t.tension&&t.cubicInterpolationMode!=="monotone"&&!t.stepped&&!n?tg:Jp}function eg(e){return e.stepped?dd:e.tension||e.cubicInterpolationMode==="monotone"?pd:Se}function ng(e,t,n,i){let s=t._path;s||(s=t._path=new Path2D,t.path(s,n,i)&&s.closePath()),Wl(e,t.options),e.stroke(s)}function ig(e,t,n,i){const{segments:s,options:o}=t,r=Fs(t);for(const a of s)Wl(e,o,a.style),e.beginPath(),r(e,t,a,{start:n,end:n+i-1})&&e.closePath(),e.stroke()}const sg=typeof Path2D=="function";function og(e,t,n,i){sg&&!t.options.segment?ng(e,t,n,i):ig(e,t,n,i)}class rg extends en{static id="line";static defaults={borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderWidth:3,capBezierPoints:!0,cubicInterpolationMode:"default",fill:!1,spanGaps:!1,stepped:!1,tension:0};static defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};static descriptors={_scriptable:!0,_indexable:t=>t!=="borderDash"&&t!=="fill"};constructor(t){super(),this.animated=!0,this.options=void 0,this._chart=void 0,this._loop=void 0,this._fullLoop=void 0,this._path=void 0,this._points=void 0,this._segments=void 0,this._decimated=!1,this._pointsUpdated=!1,this._datasetIndex=void 0,t&&Object.assign(this,t)}updateControlPoints(t,n){const i=this.options;if((i.tension||i.cubicInterpolationMode==="monotone")&&!i.stepped&&!this._pointsUpdated){const s=i.spanGaps?this._loop:this._fullLoop;od(this._points,i,t,s,n),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=wd(this,this.options.segment))}first(){const t=this.segments,n=this.points;return t.length&&n[t[0].start]}last(){const t=this.segments,n=this.points,i=t.length;return i&&n[t[i-1].end]}interpolate(t,n){const i=this.options,s=t[n],o=this.points,r=xd(this,{property:n,start:s,end:s});if(!r.length)return;const a=[],l=eg(i);let c,u;for(c=0,u=r.length;c<u;++c){const{start:f,end:p}=r[c],g=o[f],x=o[p];if(g===x){a.push(g);continue}const y=Math.abs((s-g[n])/(x[n]-g[n])),v=l(g,x,y,i.stepped);v[n]=t[n],a.push(v)}return a.length===1?a[0]:a}pathSegment(t,n,i){return Fs(this)(t,this,n,i)}path(t,n,i){const s=this.segments,o=Fs(this);let r=this._loop;n=n||0,i=i||this.points.length-n;for(const a of s)r&=o(t,this,a,{start:n,end:n+i-1});return!!r}draw(t,n,i,s){const o=this.options||{};(this.points||[]).length&&o.borderWidth&&(t.save(),og(t,this,i,s),t.restore()),this.animated&&(this._pointsUpdated=!1,this._path=void 0)}}function Wr(e,t,n,i){const s=e.options,{[n]:o}=e.getProps([n],i);return Math.abs(t-o)<s.radius+s.hitRadius}class ag extends en{static id="point";parsed;skip;stop;static defaults={borderWidth:1,hitRadius:1,hoverBorderWidth:1,hoverRadius:4,pointStyle:"circle",radius:3,rotation:0};static defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};constructor(t){super(),this.options=void 0,this.parsed=void 0,this.skip=void 0,this.stop=void 0,t&&Object.assign(this,t)}inRange(t,n,i){const s=this.options,{x:o,y:r}=this.getProps(["x","y"],i);return Math.pow(t-o,2)+Math.pow(n-r,2)<Math.pow(s.hitRadius+s.radius,2)}inXRange(t,n){return Wr(this,t,"x",n)}inYRange(t,n){return Wr(this,t,"y",n)}getCenterPoint(t){const{x:n,y:i}=this.getProps(["x","y"],t);return{x:n,y:i}}size(t){t=t||this.options||{};let n=t.radius||0;n=Math.max(n,n&&t.hoverRadius||0);const i=n&&t.borderWidth||0;return(n+i)*2}draw(t,n){const i=this.options;this.skip||i.radius<.1||!Ze(this,n,this.size(i)/2)||(t.strokeStyle=i.borderColor,t.lineWidth=i.borderWidth,t.fillStyle=i.backgroundColor,Is(t,i,this.x,this.y))}getRange(){const t=this.options||{};return t.radius+t.hitRadius}}const jr=(e,t)=>{let{boxHeight:n=t,boxWidth:i=t}=e;return e.usePointStyle&&(n=Math.min(n,t),i=e.pointStyleWidth||Math.min(i,t)),{boxWidth:i,boxHeight:n,itemHeight:Math.max(t,n)}},lg=(e,t)=>e!==null&&t!==null&&e.datasetIndex===t.datasetIndex&&e.index===t.index;class Ur extends en{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,n,i){this.maxWidth=t,this.maxHeight=n,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 n=I(t.generateLabels,[this.chart],this)||[];t.filter&&(n=n.filter(i=>t.filter(i,this.chart.data))),t.sort&&(n=n.sort((i,s)=>t.sort(i,s,this.chart.data))),this.options.reverse&&n.reverse(),this.legendItems=n}fit(){const{options:t,ctx:n}=this;if(!t.display){this.width=this.height=0;return}const i=t.labels,s=ct(i.font),o=s.size,r=this._computeTitleHeight(),{boxWidth:a,itemHeight:l}=jr(i,o);let c,u;n.font=s.string,this.isHorizontal()?(c=this.maxWidth,u=this._fitRows(r,o,a,l)+10):(u=this.maxHeight,c=this._fitCols(r,s,a,l)+10),this.width=Math.min(c,t.maxWidth||this.maxWidth),this.height=Math.min(u,t.maxHeight||this.maxHeight)}_fitRows(t,n,i,s){const{ctx:o,maxWidth:r,options:{labels:{padding:a}}}=this,l=this.legendHitBoxes=[],c=this.lineWidths=[0],u=s+a;let f=t;o.textAlign="left",o.textBaseline="middle";let p=-1,g=-u;return this.legendItems.forEach((x,y)=>{const v=i+n/2+o.measureText(x.text).width;(y===0||c[c.length-1]+v+2*a>r)&&(f+=u,c[c.length-(y>0?0:1)]=0,g+=u,p++),l[y]={left:0,top:g,row:p,width:v,height:s},c[c.length-1]+=v+a}),f}_fitCols(t,n,i,s){const{ctx:o,maxHeight:r,options:{labels:{padding:a}}}=this,l=this.legendHitBoxes=[],c=this.columnSizes=[],u=r-t;let f=a,p=0,g=0,x=0,y=0;return this.legendItems.forEach((v,w)=>{const{itemWidth:k,itemHeight:O}=cg(i,n,o,v,s);w>0&&g+O+2*a>u&&(f+=p+a,c.push({width:p,height:g}),x+=p+a,y++,p=g=0),l[w]={left:x,top:g,col:y,width:k,height:O},p=Math.max(p,k),g+=O+a}),f+=p,c.push({width:p,height:g}),f}adjustHitBoxes(){if(!this.options.display)return;const t=this._computeTitleHeight(),{legendHitBoxes:n,options:{align:i,labels:{padding:s},rtl:o}}=this,r=Ue(o,this.left,this.width);if(this.isHorizontal()){let a=0,l=ft(i,this.left+s,this.right-this.lineWidths[a]);for(const c of n)a!==c.row&&(a=c.row,l=ft(i,this.left+s,this.right-this.lineWidths[a])),c.top+=this.top+t+s,c.left=r.leftForLtr(r.x(l),c.width),l+=c.width+s}else{let a=0,l=ft(i,this.top+t+s,this.bottom-this.columnSizes[a].height);for(const c of n)c.col!==a&&(a=c.col,l=ft(i,this.top+t+s,this.bottom-this.columnSizes[a].height)),c.top=l,c.left+=this.left+s,c.left=r.leftForLtr(r.x(c.left),c.width),l+=c.height+s}}isHorizontal(){return this.options.position==="top"||this.options.position==="bottom"}draw(){if(this.options.display){const t=this.ctx;lo(t,this),this._draw(),co(t)}}_draw(){const{options:t,columnSizes:n,lineWidths:i,ctx:s}=this,{align:o,labels:r}=t,a=Y.color,l=Ue(t.rtl,this.left,this.width),c=ct(r.font),{padding:u}=r,f=c.size,p=f/2;let g;this.drawTitle(),s.textAlign=l.textAlign("left"),s.textBaseline="middle",s.lineWidth=.5,s.font=c.string;const{boxWidth:x,boxHeight:y,itemHeight:v}=jr(r,f),w=function(D,P,E){if(isNaN(x)||x<=0||isNaN(y)||y<0)return;s.save();const A=R(E.lineWidth,1);if(s.fillStyle=R(E.fillStyle,a),s.lineCap=R(E.lineCap,"butt"),s.lineDashOffset=R(E.lineDashOffset,0),s.lineJoin=R(E.lineJoin,"miter"),s.lineWidth=A,s.strokeStyle=R(E.strokeStyle,a),s.setLineDash(R(E.lineDash,[])),r.usePointStyle){const F={radius:y*Math.SQRT2/2,pointStyle:E.pointStyle,rotation:E.rotation,borderWidth:A},L=l.xPlus(D,x/2),H=P+p;vl(s,F,L,H,r.pointStyleWidth&&x)}else{const F=P+Math.max((f-y)/2,0),L=l.leftForLtr(D,x),H=Tn(E.borderRadius);s.beginPath(),Object.values(H).some(K=>K!==0)?Ls(s,{x:L,y:F,w:x,h:y,radius:H}):s.rect(L,F,x,y),s.fill(),A!==0&&s.stroke()}s.restore()},k=function(D,P,E){Ti(s,E.text,D,P+v/2,c,{strikethrough:E.hidden,textAlign:l.textAlign(E.textAlign)})},O=this.isHorizontal(),C=this._computeTitleHeight();O?g={x:ft(o,this.left+u,this.right-i[0]),y:this.top+u+C,line:0}:g={x:this.left+u,y:ft(o,this.top+C+u,this.bottom-n[0].height),line:0},El(this.ctx,t.textDirection);const T=v+u;this.legendItems.forEach((D,P)=>{s.strokeStyle=D.fontColor,s.fillStyle=D.fontColor;const E=s.measureText(D.text).width,A=l.textAlign(D.textAlign||(D.textAlign=r.textAlign)),F=x+p+E;let L=g.x,H=g.y;l.setWidth(this.width),O?P>0&&L+F+u>this.right&&(H=g.y+=T,g.line++,L=g.x=ft(o,this.left+u,this.right-i[g.line])):P>0&&H+T>this.bottom&&(L=g.x=L+n[g.line].width+u,g.line++,H=g.y=ft(o,this.top+C+u,this.bottom-n[g.line].height));const K=l.x(L);if(w(K,H,D),L=vf(A,L+x+p,O?L+F:this.right,t.rtl),k(l.x(L),H,D),O)g.x+=F+u;else if(typeof D.text!="string"){const et=c.lineHeight;g.y+=Ul(D,et)+u}else g.y+=T}),Ol(this.ctx,t.textDirection)}drawTitle(){const t=this.options,n=t.title,i=ct(n.font),s=Mt(n.padding);if(!n.display)return;const o=Ue(t.rtl,this.left,this.width),r=this.ctx,a=n.position,l=i.size/2,c=s.top+l;let u,f=this.left,p=this.width;if(this.isHorizontal())p=Math.max(...this.lineWidths),u=this.top+c,f=ft(t.align,f,this.right-p);else{const x=this.columnSizes.reduce((y,v)=>Math.max(y,v.height),0);u=c+ft(t.align,this.top,this.bottom-x-t.labels.padding-this._computeTitleHeight())}const g=ft(a,f,f+p);r.textAlign=o.textAlign(bl(a)),r.textBaseline="middle",r.strokeStyle=n.color,r.fillStyle=n.color,r.font=i.string,Ti(r,n.text,g,u,i)}_computeTitleHeight(){const t=this.options.title,n=ct(t.font),i=Mt(t.padding);return t.display?n.lineHeight+i.height:0}_getLegendItemAt(t,n){let i,s,o;if(xn(t,this.left,this.right)&&xn(n,this.top,this.bottom)){for(o=this.legendHitBoxes,i=0;i<o.length;++i)if(s=o[i],xn(t,s.left,s.left+s.width)&&xn(n,s.top,s.top+s.height))return this.legendItems[i]}return null}handleEvent(t){const n=this.options;if(!fg(t.type,n))return;const i=this._getLegendItemAt(t.x,t.y);if(t.type==="mousemove"||t.type==="mouseout"){const s=this._hoveredItem,o=lg(s,i);s&&!o&&I(n.onLeave,[t,s,this],this),this._hoveredItem=i,i&&!o&&I(n.onHover,[t,i,this],this)}else i&&I(n.onClick,[t,i,this],this)}}function cg(e,t,n,i,s){const o=ug(i,e,t,n),r=hg(s,i,t.lineHeight);return{itemWidth:o,itemHeight:r}}function ug(e,t,n,i){let s=e.text;return s&&typeof s!="string"&&(s=s.reduce((o,r)=>o.length>r.length?o:r)),t+n.size/2+i.measureText(s).width}function hg(e,t,n){let i=e;return typeof t.text!="string"&&(i=Ul(t,n)),i}function Ul(e,t){const n=e.text?e.text.length:0;return t*n}function fg(e,t){return!!((e==="mousemove"||e==="mouseout")&&(t.onHover||t.onLeave)||t.onClick&&(e==="click"||e==="mouseup"))}var dg={id:"legend",_element:Ur,start(e,t,n){const i=e.legend=new Ur({ctx:e.ctx,options:n,chart:e});ee.configure(e,i,n),ee.addBox(e,i)},stop(e){ee.removeBox(e,e.legend),delete e.legend},beforeUpdate(e,t,n){const i=e.legend;ee.configure(e,i,n),i.options=n},afterUpdate(e){const t=e.legend;t.buildLabels(),t.adjustHitBoxes()},afterEvent(e,t){t.replay||e.legend.handleEvent(t.event)},defaults:{display:!0,position:"top",align:"center",fullSize:!0,reverse:!1,weight:1e3,onClick(e,t,n){const i=t.datasetIndex,s=n.chart;s.isDatasetVisible(i)?(s.hide(i),t.hidden=!0):(s.show(i),t.hidden=!1)},onHover:null,onLeave:null,labels:{color:e=>e.chart.options.color,boxWidth:40,padding:10,generateLabels(e){const t=e.data.datasets,{labels:{usePointStyle:n,pointStyle:i,textAlign:s,color:o,useBorderRadius:r,borderRadius:a}}=e.legend.options;return e._getSortedDatasetMetas().map(l=>{const c=l.controller.getStyle(n?0:void 0),u=Mt(c.borderWidth);return{text:t[l.index].label,fillStyle:c.backgroundColor,fontColor:o,hidden:!l.visible,lineCap:c.borderCapStyle,lineDash:c.borderDash,lineDashOffset:c.borderDashOffset,lineJoin:c.borderJoinStyle,lineWidth:(u.width+u.height)/4,strokeStyle:c.borderColor,pointStyle:i||c.pointStyle,rotation:c.rotation,textAlign:s||c.textAlign,borderRadius:r&&(a||c.borderRadius),datasetIndex:l.index}},this)}},title:{color:e=>e.chart.options.color,display:!1,position:"center",text:""}},descriptors:{_scriptable:e=>!e.startsWith("on"),labels:{_scriptable:e=>!["generateLabels","filter","sort"].includes(e)}}};const _n={average(e){if(!e.length)return!1;let t,n,i=new Set,s=0,o=0;for(t=0,n=e.length;t<n;++t){const a=e[t].element;if(a&&a.hasValue()){const l=a.tooltipPosition();i.add(l.x),s+=l.y,++o}}return o===0||i.size===0?!1:{x:[...i].reduce((a,l)=>a+l)/i.size,y:s/o}},nearest(e,t){if(!e.length)return!1;let n=t.x,i=t.y,s=Number.POSITIVE_INFINITY,o,r,a;for(o=0,r=e.length;o<r;++o){const l=e[o].element;if(l&&l.hasValue()){const c=l.getCenterPoint(),u=Ds(t,c);u<s&&(s=u,a=l)}}if(a){const l=a.tooltipPosition();n=l.x,i=l.y}return{x:n,y:i}}};function Dt(e,t){return t&&(Q(t)?Array.prototype.push.apply(e,t):e.push(t)),e}function Ut(e){return(typeof e=="string"||e instanceof String)&&e.indexOf(\`
|
|
1742
1742
|
\`)>-1?e.split(\`
|
|
1743
|
-
\`):e}function dg(e,t){const{element:n,datasetIndex:i,index:s}=t,o=e.getDatasetMeta(i).controller,{label:r,value:a}=o.getLabelAndValue(s);return{chart:e,label:r,parsed:o.getParsed(s),raw:e.data.datasets[i].data[s],formattedValue:a,dataset:o.getDataset(),dataIndex:s,datasetIndex:i,element:n}}function Ur(e,t){const n=e.chart.ctx,{body:i,footer:s,title:o}=e,{boxWidth:r,boxHeight:a}=t,l=ct(t.bodyFont),c=ct(t.titleFont),u=ct(t.footerFont),f=o.length,p=s.length,g=i.length,x=Mt(t.padding);let y=x.height,v=0,w=i.reduce((O,T)=>O+T.before.length+T.lines.length+T.after.length,0);if(w+=e.beforeBody.length+e.afterBody.length,f&&(y+=f*c.lineHeight+(f-1)*t.titleSpacing+t.titleMarginBottom),w){const O=t.displayColors?Math.max(a,l.lineHeight):l.lineHeight;y+=g*O+(w-g)*l.lineHeight+(w-1)*t.bodySpacing}p&&(y+=t.footerMarginTop+p*u.lineHeight+(p-1)*t.footerSpacing);let k=0;const C=function(O){v=Math.max(v,n.measureText(O).width+k)};return n.save(),n.font=c.string,z(e.title,C),n.font=l.string,z(e.beforeBody.concat(e.afterBody),C),k=t.displayColors?r+2+t.boxPadding:0,z(i,O=>{z(O.before,C),z(O.lines,C),z(O.after,C)}),k=0,n.font=u.string,z(e.footer,C),n.restore(),v+=x.width,{width:v,height:y}}function pg(e,t){const{y:n,height:i}=t;return n<i/2?"top":n>e.height-i/2?"bottom":"center"}function gg(e,t,n,i){const{x:s,width:o}=i,r=n.caretSize+n.caretPadding;if(e==="left"&&s+o+r>t.width||e==="right"&&s-o-r<0)return!0}function mg(e,t,n,i){const{x:s,width:o}=n,{width:r,chartArea:{left:a,right:l}}=e;let c="center";return i==="center"?c=s<=(a+l)/2?"left":"right":s<=o/2?c="left":s>=r-o/2&&(c="right"),gg(c,e,t,n)&&(c="center"),c}function $r(e,t,n){const i=n.yAlign||t.yAlign||pg(e,n);return{xAlign:n.xAlign||t.xAlign||mg(e,t,n,i),yAlign:i}}function bg(e,t){let{x:n,width:i}=e;return t==="right"?n-=i:t==="center"&&(n-=i/2),n}function yg(e,t,n){let{y:i,height:s}=e;return t==="top"?i+=n:t==="bottom"?i-=s+n:i-=s/2,i}function Yr(e,t,n,i){const{caretSize:s,caretPadding:o,cornerRadius:r}=e,{xAlign:a,yAlign:l}=n,c=s+o,{topLeft:u,topRight:f,bottomLeft:p,bottomRight:g}=Tn(r);let x=bg(t,a);const y=yg(t,l,c);return l==="center"?a==="left"?x+=c:a==="right"&&(x-=c):a==="left"?x-=Math.max(u,p)+s:a==="right"&&(x+=Math.max(f,g)+s),{x:yt(x,0,i.width-t.width),y:yt(y,0,i.height-t.height)}}function ai(e,t,n){const i=Mt(n.padding);return t==="center"?e.x+e.width/2:t==="right"?e.x+e.width-i.right:e.x+i.left}function Xr(e){return Dt([],Ut(e))}function xg(e,t,n){return Le(e,{tooltip:t,tooltipItems:n,type:"tooltip"})}function qr(e,t){const n=t&&t.dataset&&t.dataset.tooltip&&t.dataset.tooltip.callbacks;return n?e.override(n):e}const Ul={beforeTitle:Wt,title(e){if(e.length>0){const t=e[0],n=t.chart.data.labels,i=n?n.length:0;if(this&&this.options&&this.options.mode==="dataset")return t.dataset.label||"";if(t.label)return t.label;if(i>0&&t.dataIndex<i)return n[t.dataIndex]}return""},afterTitle:Wt,beforeBody:Wt,beforeLabel:Wt,label(e){if(this&&this.options&&this.options.mode==="dataset")return e.label+": "+e.formattedValue||e.formattedValue;let t=e.dataset.label||"";t&&(t+=": ");const n=e.formattedValue;return V(n)||(t+=n),t},labelColor(e){const n=e.chart.getDatasetMeta(e.datasetIndex).controller.getStyle(e.dataIndex);return{borderColor:n.borderColor,backgroundColor:n.backgroundColor,borderWidth:n.borderWidth,borderDash:n.borderDash,borderDashOffset:n.borderDashOffset,borderRadius:0}},labelTextColor(){return this.options.bodyColor},labelPointStyle(e){const n=e.chart.getDatasetMeta(e.datasetIndex).controller.getStyle(e.dataIndex);return{pointStyle:n.pointStyle,rotation:n.rotation}},afterLabel:Wt,afterBody:Wt,beforeFooter:Wt,footer:Wt,afterFooter:Wt};function rt(e,t,n,i){const s=e[t].call(n,i);return typeof s>"u"?Ul[t].call(n,i):s}class Gr extends en{static positioners=_n;constructor(t){super(),this.opacity=0,this._active=[],this._eventPosition=void 0,this._size=void 0,this._cachedAnimations=void 0,this._tooltipItems=[],this.$animations=void 0,this.$context=void 0,this.chart=t.chart,this.options=t.options,this.dataPoints=void 0,this.title=void 0,this.beforeBody=void 0,this.body=void 0,this.afterBody=void 0,this.footer=void 0,this.xAlign=void 0,this.yAlign=void 0,this.x=void 0,this.y=void 0,this.height=void 0,this.width=void 0,this.caretX=void 0,this.caretY=void 0,this.labelColors=void 0,this.labelPointStyles=void 0,this.labelTextColors=void 0}initialize(t){this.options=t,this._cachedAnimations=void 0,this.$context=void 0}_resolveAnimations(){const t=this._cachedAnimations;if(t)return t;const n=this.chart,i=this.options.setContext(this.getContext()),s=i.enabled&&n.options.animation&&i.animations,o=new Ol(this.chart,s);return s._cacheable&&(this._cachedAnimations=Object.freeze(o)),o}getContext(){return this.$context||(this.$context=xg(this.chart.getContext(),this,this._tooltipItems))}getTitle(t,n){const{callbacks:i}=n,s=rt(i,"beforeTitle",this,t),o=rt(i,"title",this,t),r=rt(i,"afterTitle",this,t);let a=[];return a=Dt(a,Ut(s)),a=Dt(a,Ut(o)),a=Dt(a,Ut(r)),a}getBeforeBody(t,n){return Xr(rt(n.callbacks,"beforeBody",this,t))}getBody(t,n){const{callbacks:i}=n,s=[];return z(t,o=>{const r={before:[],lines:[],after:[]},a=qr(i,o);Dt(r.before,Ut(rt(a,"beforeLabel",this,o))),Dt(r.lines,rt(a,"label",this,o)),Dt(r.after,Ut(rt(a,"afterLabel",this,o))),s.push(r)}),s}getAfterBody(t,n){return Xr(rt(n.callbacks,"afterBody",this,t))}getFooter(t,n){const{callbacks:i}=n,s=rt(i,"beforeFooter",this,t),o=rt(i,"footer",this,t),r=rt(i,"afterFooter",this,t);let a=[];return a=Dt(a,Ut(s)),a=Dt(a,Ut(o)),a=Dt(a,Ut(r)),a}_createItems(t){const n=this._active,i=this.chart.data,s=[],o=[],r=[];let a=[],l,c;for(l=0,c=n.length;l<c;++l)a.push(dg(this.chart,n[l]));return t.filter&&(a=a.filter((u,f,p)=>t.filter(u,f,p,i))),t.itemSort&&(a=a.sort((u,f)=>t.itemSort(u,f,i))),z(a,u=>{const f=qr(t.callbacks,u);s.push(rt(f,"labelColor",this,u)),o.push(rt(f,"labelPointStyle",this,u)),r.push(rt(f,"labelTextColor",this,u))}),this.labelColors=s,this.labelPointStyles=o,this.labelTextColors=r,this.dataPoints=a,a}update(t,n){const i=this.options.setContext(this.getContext()),s=this._active;let o,r=[];if(!s.length)this.opacity!==0&&(o={opacity:0});else{const a=_n[i.position].call(this,s,this._eventPosition);r=this._createItems(i),this.title=this.getTitle(r,i),this.beforeBody=this.getBeforeBody(r,i),this.body=this.getBody(r,i),this.afterBody=this.getAfterBody(r,i),this.footer=this.getFooter(r,i);const l=this._size=Ur(this,i),c=Object.assign({},a,l),u=$r(this.chart,i,c),f=Yr(i,c,u,this.chart);this.xAlign=u.xAlign,this.yAlign=u.yAlign,o={opacity:1,x:f.x,y:f.y,width:l.width,height:l.height,caretX:a.x,caretY:a.y}}this._tooltipItems=r,this.$context=void 0,o&&this._resolveAnimations().update(this,o),t&&i.external&&i.external.call(this,{chart:this.chart,tooltip:this,replay:n})}drawCaret(t,n,i,s){const o=this.getCaretPosition(t,i,s);n.lineTo(o.x1,o.y1),n.lineTo(o.x2,o.y2),n.lineTo(o.x3,o.y3)}getCaretPosition(t,n,i){const{xAlign:s,yAlign:o}=this,{caretSize:r,cornerRadius:a}=i,{topLeft:l,topRight:c,bottomLeft:u,bottomRight:f}=Tn(a),{x:p,y:g}=t,{width:x,height:y}=n;let v,w,k,C,O,T;return o==="center"?(O=g+y/2,s==="left"?(v=p,w=v-r,C=O+r,T=O-r):(v=p+x,w=v+r,C=O-r,T=O+r),k=v):(s==="left"?w=p+Math.max(l,u)+r:s==="right"?w=p+x-Math.max(c,f)-r:w=this.caretX,o==="top"?(C=g,O=C-r,v=w-r,k=w+r):(C=g+y,O=C+r,v=w+r,k=w-r),T=C),{x1:v,x2:w,x3:k,y1:C,y2:O,y3:T}}drawTitle(t,n,i){const s=this.title,o=s.length;let r,a,l;if(o){const c=Ue(i.rtl,this.x,this.width);for(t.x=ai(this,i.titleAlign,i),n.textAlign=c.textAlign(i.titleAlign),n.textBaseline="middle",r=ct(i.titleFont),a=i.titleSpacing,n.fillStyle=i.titleColor,n.font=r.string,l=0;l<o;++l)n.fillText(s[l],c.x(t.x),t.y+r.lineHeight/2),t.y+=r.lineHeight+a,l+1===o&&(t.y+=i.titleMarginBottom-a)}}_drawColorBox(t,n,i,s,o){const r=this.labelColors[i],a=this.labelPointStyles[i],{boxHeight:l,boxWidth:c}=o,u=ct(o.bodyFont),f=ai(this,"left",o),p=s.x(f),g=l<u.lineHeight?(u.lineHeight-l)/2:0,x=n.y+g;if(o.usePointStyle){const y={radius:Math.min(c,l)/2,pointStyle:a.pointStyle,rotation:a.rotation,borderWidth:1},v=s.leftForLtr(p,c)+c/2,w=x+l/2;t.strokeStyle=o.multiKeyBackground,t.fillStyle=o.multiKeyBackground,Is(t,y,v,w),t.strokeStyle=r.borderColor,t.fillStyle=r.backgroundColor,Is(t,y,v,w)}else{t.lineWidth=B(r.borderWidth)?Math.max(...Object.values(r.borderWidth)):r.borderWidth||1,t.strokeStyle=r.borderColor,t.setLineDash(r.borderDash||[]),t.lineDashOffset=r.borderDashOffset||0;const y=s.leftForLtr(p,c),v=s.leftForLtr(s.xPlus(p,1),c-2),w=Tn(r.borderRadius);Object.values(w).some(k=>k!==0)?(t.beginPath(),t.fillStyle=o.multiKeyBackground,Ls(t,{x:y,y:x,w:c,h:l,radius:w}),t.fill(),t.stroke(),t.fillStyle=r.backgroundColor,t.beginPath(),Ls(t,{x:v,y:x+1,w:c-2,h:l-2,radius:w}),t.fill()):(t.fillStyle=o.multiKeyBackground,t.fillRect(y,x,c,l),t.strokeRect(y,x,c,l),t.fillStyle=r.backgroundColor,t.fillRect(v,x+1,c-2,l-2))}t.fillStyle=this.labelTextColors[i]}drawBody(t,n,i){const{body:s}=this,{bodySpacing:o,bodyAlign:r,displayColors:a,boxHeight:l,boxWidth:c,boxPadding:u}=i,f=ct(i.bodyFont);let p=f.lineHeight,g=0;const x=Ue(i.rtl,this.x,this.width),y=function(E){n.fillText(E,x.x(t.x+g),t.y+p/2),t.y+=p+o},v=x.textAlign(r);let w,k,C,O,T,D,P;for(n.textAlign=r,n.textBaseline="middle",n.font=f.string,t.x=ai(this,v,i),n.fillStyle=i.bodyColor,z(this.beforeBody,y),g=a&&v!=="right"?r==="center"?c/2+u:c+2+u:0,O=0,D=s.length;O<D;++O){for(w=s[O],k=this.labelTextColors[O],n.fillStyle=k,z(w.before,y),C=w.lines,a&&C.length&&(this._drawColorBox(n,t,O,x,i),p=Math.max(f.lineHeight,l)),T=0,P=C.length;T<P;++T)y(C[T]),p=f.lineHeight;z(w.after,y)}g=0,p=f.lineHeight,z(this.afterBody,y),t.y-=o}drawFooter(t,n,i){const s=this.footer,o=s.length;let r,a;if(o){const l=Ue(i.rtl,this.x,this.width);for(t.x=ai(this,i.footerAlign,i),t.y+=i.footerMarginTop,n.textAlign=l.textAlign(i.footerAlign),n.textBaseline="middle",r=ct(i.footerFont),n.fillStyle=i.footerColor,n.font=r.string,a=0;a<o;++a)n.fillText(s[a],l.x(t.x),t.y+r.lineHeight/2),t.y+=r.lineHeight+i.footerSpacing}}drawBackground(t,n,i,s){const{xAlign:o,yAlign:r}=this,{x:a,y:l}=t,{width:c,height:u}=i,{topLeft:f,topRight:p,bottomLeft:g,bottomRight:x}=Tn(s.cornerRadius);n.fillStyle=s.backgroundColor,n.strokeStyle=s.borderColor,n.lineWidth=s.borderWidth,n.beginPath(),n.moveTo(a+f,l),r==="top"&&this.drawCaret(t,n,i,s),n.lineTo(a+c-p,l),n.quadraticCurveTo(a+c,l,a+c,l+p),r==="center"&&o==="right"&&this.drawCaret(t,n,i,s),n.lineTo(a+c,l+u-x),n.quadraticCurveTo(a+c,l+u,a+c-x,l+u),r==="bottom"&&this.drawCaret(t,n,i,s),n.lineTo(a+g,l+u),n.quadraticCurveTo(a,l+u,a,l+u-g),r==="center"&&o==="left"&&this.drawCaret(t,n,i,s),n.lineTo(a,l+f),n.quadraticCurveTo(a,l,a+f,l),n.closePath(),n.fill(),s.borderWidth>0&&n.stroke()}_updateAnimationTarget(t){const n=this.chart,i=this.$animations,s=i&&i.x,o=i&&i.y;if(s||o){const r=_n[t.position].call(this,this._active,this._eventPosition);if(!r)return;const a=this._size=Ur(this,t),l=Object.assign({},r,this._size),c=$r(n,t,l),u=Yr(t,l,c,n);(s._to!==u.x||o._to!==u.y)&&(this.xAlign=c.xAlign,this.yAlign=c.yAlign,this.width=a.width,this.height=a.height,this.caretX=r.x,this.caretY=r.y,this._resolveAnimations().update(this,u))}}_willRender(){return!!this.opacity}draw(t){const n=this.options.setContext(this.getContext());let i=this.opacity;if(!i)return;this._updateAnimationTarget(n);const s={width:this.width,height:this.height},o={x:this.x,y:this.y};i=Math.abs(i)<.001?0:i;const r=Mt(n.padding),a=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;n.enabled&&a&&(t.save(),t.globalAlpha=i,this.drawBackground(o,t,s,n),Ml(t,n.textDirection),o.y+=r.top,this.drawTitle(o,t,n),this.drawBody(o,t,n),this.drawFooter(o,t,n),El(t,n.textDirection),t.restore())}getActiveElements(){return this._active||[]}setActiveElements(t,n){const i=this._active,s=t.map(({datasetIndex:a,index:l})=>{const c=this.chart.getDatasetMeta(a);if(!c)throw new Error("Cannot find a dataset at index "+a);return{datasetIndex:a,element:c.data[l],index:l}}),o=!vi(i,s),r=this._positionChanged(s,n);(o||r)&&(this._active=s,this._eventPosition=n,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(t,n,i=!0){if(n&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;const s=this.options,o=this._active||[],r=this._getActiveElements(t,o,n,i),a=this._positionChanged(r,t),l=n||!vi(r,o)||a;return l&&(this._active=r,(s.enabled||s.external)&&(this._eventPosition={x:t.x,y:t.y},this.update(!0,n))),l}_getActiveElements(t,n,i,s){const o=this.options;if(t.type==="mouseout")return[];if(!s)return n.filter(a=>this.chart.data.datasets[a.datasetIndex]&&this.chart.getDatasetMeta(a.datasetIndex).controller.getParsed(a.index)!==void 0);const r=this.chart.getElementsAtEventForMode(t,o.mode,o,i);return o.reverse&&r.reverse(),r}_positionChanged(t,n){const{caretX:i,caretY:s,options:o}=this,r=_n[o.position].call(this,t,n);return r!==!1&&(i!==r.x||s!==r.y)}}var vg={id:"tooltip",_element:Gr,positioners:_n,afterInit(e,t,n){n&&(e.tooltip=new Gr({chart:e,options:n}))},beforeUpdate(e,t,n){e.tooltip&&e.tooltip.initialize(n)},reset(e,t,n){e.tooltip&&e.tooltip.initialize(n)},afterDraw(e){const t=e.tooltip;if(t&&t._willRender()){const n={tooltip:t};if(e.notifyPlugins("beforeTooltipDraw",{...n,cancelable:!0})===!1)return;t.draw(e.ctx),e.notifyPlugins("afterTooltipDraw",n)}},afterEvent(e,t){if(e.tooltip){const n=t.replay;e.tooltip.handleEvent(t.event,n,t.inChartArea)&&(t.changed=!0)}},defaults:{enabled:!0,external:null,position:"average",backgroundColor:"rgba(0,0,0,0.8)",titleColor:"#fff",titleFont:{weight:"bold"},titleSpacing:2,titleMarginBottom:6,titleAlign:"left",bodyColor:"#fff",bodySpacing:2,bodyFont:{},bodyAlign:"left",footerColor:"#fff",footerSpacing:2,footerMarginTop:6,footerFont:{weight:"bold"},footerAlign:"left",padding:6,caretPadding:2,caretSize:5,cornerRadius:6,boxHeight:(e,t)=>t.bodyFont.size,boxWidth:(e,t)=>t.bodyFont.size,multiKeyBackground:"#fff",displayColors:!0,boxPadding:0,borderColor:"rgba(0,0,0,0)",borderWidth:0,animation:{duration:400,easing:"easeOutQuart"},animations:{numbers:{type:"number",properties:["x","y","width","height","caretX","caretY"]},opacity:{easing:"linear",duration:200}},callbacks:Ul},defaultRoutes:{bodyFont:"font",footerFont:"font",titleFont:"font"},descriptors:{_scriptable:e=>e!=="filter"&&e!=="itemSort"&&e!=="external",_indexable:!1,callbacks:{_scriptable:!1,_indexable:!1},animation:{_fallback:!1},animations:{_fallback:"animation"}},additionalOptionScopes:["interaction"]};const _g=(e,t,n,i)=>(typeof t=="string"?(n=e.push(t)-1,i.unshift({index:n,label:t})):isNaN(t)&&(n=null),n);function wg(e,t,n,i){const s=e.indexOf(t);if(s===-1)return _g(e,t,n,i);const o=e.lastIndexOf(t);return s!==o?n:s}const Sg=(e,t)=>e===null?null:yt(Math.round(e),0,t);function Kr(e){const t=this.getLabels();return e>=0&&e<t.length?t[e]:e}class kg extends nn{static id="category";static defaults={ticks:{callback:Kr}};constructor(t){super(t),this._startValue=void 0,this._valueRange=0,this._addedLabels=[]}init(t){const n=this._addedLabels;if(n.length){const i=this.getLabels();for(const{index:s,label:o}of n)i[s]===o&&i.splice(s,1);this._addedLabels=[]}super.init(t)}parse(t,n){if(V(t))return null;const i=this.getLabels();return n=isFinite(n)&&i[n]===t?n:wg(i,t,R(n,t),this._addedLabels),Sg(n,i.length-1)}determineDataLimits(){const{minDefined:t,maxDefined:n}=this.getUserBounds();let{min:i,max:s}=this.getMinMax(!0);this.options.bounds==="ticks"&&(t||(i=0),n||(s=this.getLabels().length-1)),this.min=i,this.max=s}buildTicks(){const t=this.min,n=this.max,i=this.options.offset,s=[];let o=this.getLabels();o=t===0&&n===o.length-1?o:o.slice(t,n+1),this._valueRange=Math.max(o.length-(i?0:1),1),this._startValue=this.min-(i?.5:0);for(let r=t;r<=n;r++)s.push({value:r});return s}getLabelForValue(t){return Kr.call(this,t)}configure(){super.configure(),this.isHorizontal()||(this._reversePixels=!this._reversePixels)}getPixelForValue(t){return typeof t!="number"&&(t=this.parse(t)),t===null?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getPixelForTick(t){const n=this.ticks;return t<0||t>n.length-1?null:this.getPixelForValue(n[t].value)}getValueForPixel(t){return Math.round(this._startValue+this.getDecimalForPixel(t)*this._valueRange)}getBasePixel(){return this.bottom}}function Tg(e,t){const n=[],{bounds:s,step:o,min:r,max:a,precision:l,count:c,maxTicks:u,maxDigits:f,includeBounds:p}=e,g=o||1,x=u-1,{min:y,max:v}=t,w=!V(r),k=!V(a),C=!V(c),O=(v-y)/(f+1);let T=tr((v-y)/x/g)*g,D,P,E,A;if(T<1e-14&&!w&&!k)return[{value:y},{value:v}];A=Math.ceil(v/T)-Math.floor(y/T),A>x&&(T=tr(A*T/x/g)*g),V(l)||(D=Math.pow(10,l),T=Math.ceil(T*D)/D),s==="ticks"?(P=Math.floor(y/T)*T,E=Math.ceil(v/T)*T):(P=y,E=v),w&&k&&o&&lf((a-r)/o,T/1e3)?(A=Math.round(Math.min((a-r)/T,u)),T=(a-r)/A,P=r,E=a):C?(P=w?r:P,E=k?a:E,A=c-1,T=(E-P)/A):(A=(E-P)/T,Oe(A,Math.round(A),T/1e3)?A=Math.round(A):A=Math.ceil(A));const F=Math.max(er(T),er(P));D=Math.pow(10,V(l)?F:l),P=Math.round(P*D)/D,E=Math.round(E*D)/D;let L=0;for(w&&(p&&P!==r?(n.push({value:r}),P<r&&L++,Oe(Math.round((P+L*T)*D)/D,r,Zr(r,O,e))&&L++):P<r&&L++);L<A;++L){const H=Math.round((P+L*T)*D)/D;if(k&&H>a)break;n.push({value:H})}return k&&p&&E!==a?n.length&&Oe(n[n.length-1].value,a,Zr(a,O,e))?n[n.length-1].value=a:n.push({value:a}):(!k||E===a)&&n.push({value:E}),n}function Zr(e,t,{horizontal:n,minRotation:i}){const s=Me(i),o=(n?Math.sin(s):Math.cos(s))||.001,r=.75*t*(""+e).length;return Math.min(t/o,r)}class Mg extends nn{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,n){return V(t)||(typeof t=="number"||t instanceof Number)&&!isFinite(+t)?null:+t}handleTickRangeOptions(){const{beginAtZero:t}=this.options,{minDefined:n,maxDefined:i}=this.getUserBounds();let{min:s,max:o}=this;const r=l=>s=n?s:l,a=l=>o=i?o:l;if(t){const l=ce(s),c=ce(o);l<0&&c<0?a(0):l>0&&c>0&&r(0)}if(s===o){let l=o===0?1:Math.abs(o*.05);a(o+l),t||r(s-l)}this.min=s,this.max=o}getTickLimit(){const t=this.options.ticks;let{maxTicksLimit:n,stepSize:i}=t,s;return i?(s=Math.ceil(this.max/i)-Math.floor(this.min/i)+1,s>1e3&&(console.warn(\`scales.\${this.id}.ticks.stepSize: \${i} would result generating up to \${s} ticks. Limiting to 1000.\`),s=1e3)):(s=this.computeTickLimit(),n=n||11),n&&(s=Math.min(n,s)),s}computeTickLimit(){return Number.POSITIVE_INFINITY}buildTicks(){const t=this.options,n=t.ticks;let i=this.getTickLimit();i=Math.max(2,i);const s={maxTicks:i,bounds:t.bounds,min:t.min,max:t.max,precision:n.precision,step:n.stepSize,count:n.count,maxDigits:this._maxDigits(),horizontal:this.isHorizontal(),minRotation:n.minRotation||0,includeBounds:n.includeBounds!==!1},o=this._range||this,r=Tg(s,o);return t.bounds==="ticks"&&cf(r,this,"value"),t.reverse?(r.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),r}configure(){const t=this.ticks;let n=this.min,i=this.max;if(super.configure(),this.options.offset&&t.length){const s=(i-n)/Math.max(t.length-1,1)/2;n-=s,i+=s}this._startValue=n,this._endValue=i,this._valueRange=i-n}getLabelForValue(t){return bl(t,this.chart.options.locale,this.options.ticks.format)}}class Eg extends Mg{static id="linear";static defaults={ticks:{callback:yl.formatters.numeric}};determineDataLimits(){const{min:t,max:n}=this.getMinMax(!0);this.min=xt(t)?t:0,this.max=xt(n)?n:1,this.handleTickRangeOptions()}computeTickLimit(){const t=this.isHorizontal(),n=t?this.width:this.height,i=Me(this.options.ticks.minRotation),s=(t?Math.sin(i):Math.cos(i))||.001,o=this._resolveTickFontOptions(0);return Math.ceil(n/Math.min(40,o.lineHeight/s))}getPixelForValue(t){return t===null?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getValueForPixel(t){return this._startValue+this.getDecimalForPixel(t)*this._valueRange}}const zi={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}},lt=Object.keys(zi);function Qr(e,t){return e-t}function Jr(e,t){if(V(t))return null;const n=e._adapter,{parser:i,round:s,isoWeekday:o}=e._parseOpts;let r=t;return typeof i=="function"&&(r=i(r)),xt(r)||(r=typeof i=="string"?n.parse(r,i):n.parse(r)),r===null?null:(s&&(r=s==="week"&&(In(o)||o===!0)?n.startOf(r,"isoWeek",o):n.startOf(r,s)),+r)}function ta(e,t,n,i){const s=lt.length;for(let o=lt.indexOf(e);o<s-1;++o){const r=zi[lt[o]],a=r.steps?r.steps:Number.MAX_SAFE_INTEGER;if(r.common&&Math.ceil((n-t)/(a*r.size))<=i)return lt[o]}return lt[s-1]}function Cg(e,t,n,i,s){for(let o=lt.length-1;o>=lt.indexOf(n);o--){const r=lt[o];if(zi[r].common&&e._adapter.diff(s,i,r)>=t-1)return r}return lt[n?lt.indexOf(n):0]}function Og(e){for(let t=lt.indexOf(e)+1,n=lt.length;t<n;++t)if(zi[lt[t]].common)return lt[t]}function ea(e,t,n){if(!n)e[t]=!0;else if(n.length){const{lo:i,hi:s}=ro(n,t),o=n[i]>=t?n[i]:n[s];e[o]=!0}}function Pg(e,t,n,i){const s=e._adapter,o=+s.startOf(t[0].value,i),r=t[t.length-1].value;let a,l;for(a=o;a<=r;a=+s.add(a,1,i))l=n[a],l>=0&&(t[l].major=!0);return t}function na(e,t,n){const i=[],s={},o=t.length;let r,a;for(r=0;r<o;++r)a=t[r],s[a]=r,i.push({value:a,major:!1});return o===0||!n?i:Pg(e,i,s,n)}class ia extends nn{static id="time";static defaults={bounds:"data",adapters:{},time:{parser:!1,unit:!1,round:!1,isoWeekday:!1,minUnit:"millisecond",displayFormats:{}},ticks:{source:"auto",callback:!1,major:{enabled:!1}}};constructor(t){super(t),this._cache={data:[],labels:[],all:[]},this._unit="day",this._majorUnit=void 0,this._offsets={},this._normalized=!1,this._parseOpts=void 0}init(t,n={}){const i=t.time||(t.time={}),s=this._adapter=new Vd._date(t.adapters.date);s.init(n),wn(i.displayFormats,s.formats()),this._parseOpts={parser:i.parser,round:i.round,isoWeekday:i.isoWeekday},super.init(t),this._normalized=n.normalized}parse(t,n){return t===void 0?null:Jr(this,t)}beforeLayout(){super.beforeLayout(),this._cache={data:[],labels:[],all:[]}}determineDataLimits(){const t=this.options,n=this._adapter,i=t.time.unit||"day";let{min:s,max:o,minDefined:r,maxDefined:a}=this.getUserBounds();function l(c){!r&&!isNaN(c.min)&&(s=Math.min(s,c.min)),!a&&!isNaN(c.max)&&(o=Math.max(o,c.max))}(!r||!a)&&(l(this._getLabelBounds()),(t.bounds!=="ticks"||t.ticks.source!=="labels")&&l(this.getMinMax(!1))),s=xt(s)&&!isNaN(s)?s:+n.startOf(Date.now(),i),o=xt(o)&&!isNaN(o)?o:+n.endOf(Date.now(),i)+1,this.min=Math.min(s,o-1),this.max=Math.max(s+1,o)}_getLabelBounds(){const t=this.getLabelTimestamps();let n=Number.POSITIVE_INFINITY,i=Number.NEGATIVE_INFINITY;return t.length&&(n=t[0],i=t[t.length-1]),{min:n,max:i}}buildTicks(){const t=this.options,n=t.time,i=t.ticks,s=i.source==="labels"?this.getLabelTimestamps():this._generate();t.bounds==="ticks"&&s.length&&(this.min=this._userMin||s[0],this.max=this._userMax||s[s.length-1]);const o=this.min,r=this.max,a=gf(s,o,r);return this._unit=n.unit||(i.autoSkip?ta(n.minUnit,this.min,this.max,this._getLabelCapacity(o)):Cg(this,a.length,n.minUnit,this.min,this.max)),this._majorUnit=!i.major.enabled||this._unit==="year"?void 0:Og(this._unit),this.initOffsets(s),t.reverse&&a.reverse(),na(this,a,this._majorUnit)}afterAutoSkip(){this.options.offsetAfterAutoskip&&this.initOffsets(this.ticks.map(t=>+t.value))}initOffsets(t=[]){let n=0,i=0,s,o;this.options.offset&&t.length&&(s=this.getDecimalForValue(t[0]),t.length===1?n=1-s:n=(this.getDecimalForValue(t[1])-s)/2,o=this.getDecimalForValue(t[t.length-1]),t.length===1?i=o:i=(o-this.getDecimalForValue(t[t.length-2]))/2);const r=t.length<3?.5:.25;n=yt(n,0,r),i=yt(i,0,r),this._offsets={start:n,end:i,factor:1/(n+1+i)}}_generate(){const t=this._adapter,n=this.min,i=this.max,s=this.options,o=s.time,r=o.unit||ta(o.minUnit,n,i,this._getLabelCapacity(n)),a=R(s.ticks.stepSize,1),l=r==="week"?o.isoWeekday:!1,c=In(l)||l===!0,u={};let f=n,p,g;if(c&&(f=+t.startOf(f,"isoWeek",l)),f=+t.startOf(f,c?"day":r),t.diff(i,n,r)>1e5*a)throw new Error(n+" and "+i+" are too far apart with stepSize of "+a+" "+r);const x=s.ticks.source==="data"&&this.getDataTimestamps();for(p=f,g=0;p<i;p=+t.add(p,a,r),g++)ea(u,p,x);return(p===i||s.bounds==="ticks"||g===1)&&ea(u,p,x),Object.keys(u).sort(Qr).map(y=>+y)}getLabelForValue(t){const n=this._adapter,i=this.options.time;return i.tooltipFormat?n.format(t,i.tooltipFormat):n.format(t,i.displayFormats.datetime)}format(t,n){const s=this.options.time.displayFormats,o=this._unit,r=n||s[o];return this._adapter.format(t,r)}_tickFormatFunction(t,n,i,s){const o=this.options,r=o.ticks.callback;if(r)return I(r,[t,n,i],this);const a=o.time.displayFormats,l=this._unit,c=this._majorUnit,u=l&&a[l],f=c&&a[c],p=i[n],g=c&&f&&p&&p.major;return this._adapter.format(t,s||(g?f:u))}generateTickLabels(t){let n,i,s;for(n=0,i=t.length;n<i;++n)s=t[n],s.label=this._tickFormatFunction(s.value,n,t)}getDecimalForValue(t){return t===null?NaN:(t-this.min)/(this.max-this.min)}getPixelForValue(t){const n=this._offsets,i=this.getDecimalForValue(t);return this.getPixelForDecimal((n.start+i)*n.factor)}getValueForPixel(t){const n=this._offsets,i=this.getDecimalForPixel(t)/n.factor-n.end;return this.min+i*(this.max-this.min)}_getLabelSize(t){const n=this.options.ticks,i=this.ctx.measureText(t).width,s=Me(this.isHorizontal()?n.maxRotation:n.minRotation),o=Math.cos(s),r=Math.sin(s),a=this._resolveTickFontOptions(0).size;return{w:i*o+a*r,h:i*r+a*o}}_getLabelCapacity(t){const n=this.options.time,i=n.displayFormats,s=i[n.unit]||i.millisecond,o=this._tickFormatFunction(t,0,na(this,[t],this._majorUnit),s),r=this._getLabelSize(o),a=Math.floor(this.isHorizontal()?this.width/r.w:this.height/r.h)-1;return a>0?a:1}getDataTimestamps(){let t=this._cache.data||[],n,i;if(t.length)return t;const s=this.getMatchingVisibleMetas();if(this._normalized&&s.length)return this._cache.data=s[0].controller.getAllParsedValues(this);for(n=0,i=s.length;n<i;++n)t=t.concat(s[n].controller.getAllParsedValues(this));return this._cache.data=this.normalize(t)}getLabelTimestamps(){const t=this._cache.labels||[];let n,i;if(t.length)return t;const s=this.getLabels();for(n=0,i=s.length;n<i;++n)t.push(Jr(this,s[n]));return this._cache.labels=this._normalized?t:this.normalize(t)}normalize(t){return bf(t.sort(Qr))}}function li(e,t,n){let i=0,s=e.length-1,o,r,a,l;n?(t>=e[i].pos&&t<=e[s].pos&&({lo:i,hi:s}=Ee(e,"pos",t)),{pos:o,time:a}=e[i],{pos:r,time:l}=e[s]):(t>=e[i].time&&t<=e[s].time&&({lo:i,hi:s}=Ee(e,"time",t)),{time:o,pos:a}=e[i],{time:r,pos:l}=e[s]);const c=r-o;return c?a+(l-a)*(t-o)/c:a}class Im extends ia{static id="timeseries";static defaults=ia.defaults;constructor(t){super(t),this._table=[],this._minPos=void 0,this._tableRange=void 0}initOffsets(){const t=this._getTimestampsForTable(),n=this._table=this.buildLookupTable(t);this._minPos=li(n,this.min),this._tableRange=li(n,this.max)-this._minPos,super.initOffsets(t)}buildLookupTable(t){const{min:n,max:i}=this,s=[],o=[];let r,a,l,c,u;for(r=0,a=t.length;r<a;++r)c=t[r],c>=n&&c<=i&&s.push(c);if(s.length<2)return[{time:n,pos:0},{time:i,pos:1}];for(r=0,a=s.length;r<a;++r)u=s[r+1],l=s[r-1],c=s[r],Math.round((u+l)/2)!==c&&o.push({time:c,pos:r/(a-1)});return o}_generate(){const t=this.min,n=this.max;let i=super.getDataTimestamps();return(!i.includes(t)||!i.length)&&i.splice(0,0,t),(!i.includes(n)||i.length===1)&&i.push(n),i.sort((s,o)=>s-o)}_getTimestampsForTable(){let t=this._cache.all||[];if(t.length)return t;const n=this.getDataTimestamps(),i=this.getLabelTimestamps();return n.length&&i.length?t=this.normalize(n.concat(i)):t=n.length?n:i,t=this._cache.all=t,t}getDecimalForValue(t){return(li(this._table,t)-this._minPos)/this._tableRange}getValueForPixel(t){const n=this._offsets,i=this.getDecimalForPixel(t)/n.factor-n.end;return li(this._table,i*this._tableRange+this._minPos,!0)}}function Dg(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var os={exports:{}};/*! Hammer.JS - v2.0.7 - 2016-04-22
|
|
1743
|
+
\`):e}function pg(e,t){const{element:n,datasetIndex:i,index:s}=t,o=e.getDatasetMeta(i).controller,{label:r,value:a}=o.getLabelAndValue(s);return{chart:e,label:r,parsed:o.getParsed(s),raw:e.data.datasets[i].data[s],formattedValue:a,dataset:o.getDataset(),dataIndex:s,datasetIndex:i,element:n}}function $r(e,t){const n=e.chart.ctx,{body:i,footer:s,title:o}=e,{boxWidth:r,boxHeight:a}=t,l=ct(t.bodyFont),c=ct(t.titleFont),u=ct(t.footerFont),f=o.length,p=s.length,g=i.length,x=Mt(t.padding);let y=x.height,v=0,w=i.reduce((C,T)=>C+T.before.length+T.lines.length+T.after.length,0);if(w+=e.beforeBody.length+e.afterBody.length,f&&(y+=f*c.lineHeight+(f-1)*t.titleSpacing+t.titleMarginBottom),w){const C=t.displayColors?Math.max(a,l.lineHeight):l.lineHeight;y+=g*C+(w-g)*l.lineHeight+(w-1)*t.bodySpacing}p&&(y+=t.footerMarginTop+p*u.lineHeight+(p-1)*t.footerSpacing);let k=0;const O=function(C){v=Math.max(v,n.measureText(C).width+k)};return n.save(),n.font=c.string,z(e.title,O),n.font=l.string,z(e.beforeBody.concat(e.afterBody),O),k=t.displayColors?r+2+t.boxPadding:0,z(i,C=>{z(C.before,O),z(C.lines,O),z(C.after,O)}),k=0,n.font=u.string,z(e.footer,O),n.restore(),v+=x.width,{width:v,height:y}}function gg(e,t){const{y:n,height:i}=t;return n<i/2?"top":n>e.height-i/2?"bottom":"center"}function mg(e,t,n,i){const{x:s,width:o}=i,r=n.caretSize+n.caretPadding;if(e==="left"&&s+o+r>t.width||e==="right"&&s-o-r<0)return!0}function bg(e,t,n,i){const{x:s,width:o}=n,{width:r,chartArea:{left:a,right:l}}=e;let c="center";return i==="center"?c=s<=(a+l)/2?"left":"right":s<=o/2?c="left":s>=r-o/2&&(c="right"),mg(c,e,t,n)&&(c="center"),c}function Yr(e,t,n){const i=n.yAlign||t.yAlign||gg(e,n);return{xAlign:n.xAlign||t.xAlign||bg(e,t,n,i),yAlign:i}}function yg(e,t){let{x:n,width:i}=e;return t==="right"?n-=i:t==="center"&&(n-=i/2),n}function xg(e,t,n){let{y:i,height:s}=e;return t==="top"?i+=n:t==="bottom"?i-=s+n:i-=s/2,i}function Xr(e,t,n,i){const{caretSize:s,caretPadding:o,cornerRadius:r}=e,{xAlign:a,yAlign:l}=n,c=s+o,{topLeft:u,topRight:f,bottomLeft:p,bottomRight:g}=Tn(r);let x=yg(t,a);const y=xg(t,l,c);return l==="center"?a==="left"?x+=c:a==="right"&&(x-=c):a==="left"?x-=Math.max(u,p)+s:a==="right"&&(x+=Math.max(f,g)+s),{x:yt(x,0,i.width-t.width),y:yt(y,0,i.height-t.height)}}function ai(e,t,n){const i=Mt(n.padding);return t==="center"?e.x+e.width/2:t==="right"?e.x+e.width-i.right:e.x+i.left}function qr(e){return Dt([],Ut(e))}function vg(e,t,n){return Le(e,{tooltip:t,tooltipItems:n,type:"tooltip"})}function Gr(e,t){const n=t&&t.dataset&&t.dataset.tooltip&&t.dataset.tooltip.callbacks;return n?e.override(n):e}const $l={beforeTitle:Wt,title(e){if(e.length>0){const t=e[0],n=t.chart.data.labels,i=n?n.length:0;if(this&&this.options&&this.options.mode==="dataset")return t.dataset.label||"";if(t.label)return t.label;if(i>0&&t.dataIndex<i)return n[t.dataIndex]}return""},afterTitle:Wt,beforeBody:Wt,beforeLabel:Wt,label(e){if(this&&this.options&&this.options.mode==="dataset")return e.label+": "+e.formattedValue||e.formattedValue;let t=e.dataset.label||"";t&&(t+=": ");const n=e.formattedValue;return V(n)||(t+=n),t},labelColor(e){const n=e.chart.getDatasetMeta(e.datasetIndex).controller.getStyle(e.dataIndex);return{borderColor:n.borderColor,backgroundColor:n.backgroundColor,borderWidth:n.borderWidth,borderDash:n.borderDash,borderDashOffset:n.borderDashOffset,borderRadius:0}},labelTextColor(){return this.options.bodyColor},labelPointStyle(e){const n=e.chart.getDatasetMeta(e.datasetIndex).controller.getStyle(e.dataIndex);return{pointStyle:n.pointStyle,rotation:n.rotation}},afterLabel:Wt,afterBody:Wt,beforeFooter:Wt,footer:Wt,afterFooter:Wt};function rt(e,t,n,i){const s=e[t].call(n,i);return typeof s>"u"?$l[t].call(n,i):s}class Kr extends en{static positioners=_n;constructor(t){super(),this.opacity=0,this._active=[],this._eventPosition=void 0,this._size=void 0,this._cachedAnimations=void 0,this._tooltipItems=[],this.$animations=void 0,this.$context=void 0,this.chart=t.chart,this.options=t.options,this.dataPoints=void 0,this.title=void 0,this.beforeBody=void 0,this.body=void 0,this.afterBody=void 0,this.footer=void 0,this.xAlign=void 0,this.yAlign=void 0,this.x=void 0,this.y=void 0,this.height=void 0,this.width=void 0,this.caretX=void 0,this.caretY=void 0,this.labelColors=void 0,this.labelPointStyles=void 0,this.labelTextColors=void 0}initialize(t){this.options=t,this._cachedAnimations=void 0,this.$context=void 0}_resolveAnimations(){const t=this._cachedAnimations;if(t)return t;const n=this.chart,i=this.options.setContext(this.getContext()),s=i.enabled&&n.options.animation&&i.animations,o=new Pl(this.chart,s);return s._cacheable&&(this._cachedAnimations=Object.freeze(o)),o}getContext(){return this.$context||(this.$context=vg(this.chart.getContext(),this,this._tooltipItems))}getTitle(t,n){const{callbacks:i}=n,s=rt(i,"beforeTitle",this,t),o=rt(i,"title",this,t),r=rt(i,"afterTitle",this,t);let a=[];return a=Dt(a,Ut(s)),a=Dt(a,Ut(o)),a=Dt(a,Ut(r)),a}getBeforeBody(t,n){return qr(rt(n.callbacks,"beforeBody",this,t))}getBody(t,n){const{callbacks:i}=n,s=[];return z(t,o=>{const r={before:[],lines:[],after:[]},a=Gr(i,o);Dt(r.before,Ut(rt(a,"beforeLabel",this,o))),Dt(r.lines,rt(a,"label",this,o)),Dt(r.after,Ut(rt(a,"afterLabel",this,o))),s.push(r)}),s}getAfterBody(t,n){return qr(rt(n.callbacks,"afterBody",this,t))}getFooter(t,n){const{callbacks:i}=n,s=rt(i,"beforeFooter",this,t),o=rt(i,"footer",this,t),r=rt(i,"afterFooter",this,t);let a=[];return a=Dt(a,Ut(s)),a=Dt(a,Ut(o)),a=Dt(a,Ut(r)),a}_createItems(t){const n=this._active,i=this.chart.data,s=[],o=[],r=[];let a=[],l,c;for(l=0,c=n.length;l<c;++l)a.push(pg(this.chart,n[l]));return t.filter&&(a=a.filter((u,f,p)=>t.filter(u,f,p,i))),t.itemSort&&(a=a.sort((u,f)=>t.itemSort(u,f,i))),z(a,u=>{const f=Gr(t.callbacks,u);s.push(rt(f,"labelColor",this,u)),o.push(rt(f,"labelPointStyle",this,u)),r.push(rt(f,"labelTextColor",this,u))}),this.labelColors=s,this.labelPointStyles=o,this.labelTextColors=r,this.dataPoints=a,a}update(t,n){const i=this.options.setContext(this.getContext()),s=this._active;let o,r=[];if(!s.length)this.opacity!==0&&(o={opacity:0});else{const a=_n[i.position].call(this,s,this._eventPosition);r=this._createItems(i),this.title=this.getTitle(r,i),this.beforeBody=this.getBeforeBody(r,i),this.body=this.getBody(r,i),this.afterBody=this.getAfterBody(r,i),this.footer=this.getFooter(r,i);const l=this._size=$r(this,i),c=Object.assign({},a,l),u=Yr(this.chart,i,c),f=Xr(i,c,u,this.chart);this.xAlign=u.xAlign,this.yAlign=u.yAlign,o={opacity:1,x:f.x,y:f.y,width:l.width,height:l.height,caretX:a.x,caretY:a.y}}this._tooltipItems=r,this.$context=void 0,o&&this._resolveAnimations().update(this,o),t&&i.external&&i.external.call(this,{chart:this.chart,tooltip:this,replay:n})}drawCaret(t,n,i,s){const o=this.getCaretPosition(t,i,s);n.lineTo(o.x1,o.y1),n.lineTo(o.x2,o.y2),n.lineTo(o.x3,o.y3)}getCaretPosition(t,n,i){const{xAlign:s,yAlign:o}=this,{caretSize:r,cornerRadius:a}=i,{topLeft:l,topRight:c,bottomLeft:u,bottomRight:f}=Tn(a),{x:p,y:g}=t,{width:x,height:y}=n;let v,w,k,O,C,T;return o==="center"?(C=g+y/2,s==="left"?(v=p,w=v-r,O=C+r,T=C-r):(v=p+x,w=v+r,O=C-r,T=C+r),k=v):(s==="left"?w=p+Math.max(l,u)+r:s==="right"?w=p+x-Math.max(c,f)-r:w=this.caretX,o==="top"?(O=g,C=O-r,v=w-r,k=w+r):(O=g+y,C=O+r,v=w+r,k=w-r),T=O),{x1:v,x2:w,x3:k,y1:O,y2:C,y3:T}}drawTitle(t,n,i){const s=this.title,o=s.length;let r,a,l;if(o){const c=Ue(i.rtl,this.x,this.width);for(t.x=ai(this,i.titleAlign,i),n.textAlign=c.textAlign(i.titleAlign),n.textBaseline="middle",r=ct(i.titleFont),a=i.titleSpacing,n.fillStyle=i.titleColor,n.font=r.string,l=0;l<o;++l)n.fillText(s[l],c.x(t.x),t.y+r.lineHeight/2),t.y+=r.lineHeight+a,l+1===o&&(t.y+=i.titleMarginBottom-a)}}_drawColorBox(t,n,i,s,o){const r=this.labelColors[i],a=this.labelPointStyles[i],{boxHeight:l,boxWidth:c}=o,u=ct(o.bodyFont),f=ai(this,"left",o),p=s.x(f),g=l<u.lineHeight?(u.lineHeight-l)/2:0,x=n.y+g;if(o.usePointStyle){const y={radius:Math.min(c,l)/2,pointStyle:a.pointStyle,rotation:a.rotation,borderWidth:1},v=s.leftForLtr(p,c)+c/2,w=x+l/2;t.strokeStyle=o.multiKeyBackground,t.fillStyle=o.multiKeyBackground,Is(t,y,v,w),t.strokeStyle=r.borderColor,t.fillStyle=r.backgroundColor,Is(t,y,v,w)}else{t.lineWidth=B(r.borderWidth)?Math.max(...Object.values(r.borderWidth)):r.borderWidth||1,t.strokeStyle=r.borderColor,t.setLineDash(r.borderDash||[]),t.lineDashOffset=r.borderDashOffset||0;const y=s.leftForLtr(p,c),v=s.leftForLtr(s.xPlus(p,1),c-2),w=Tn(r.borderRadius);Object.values(w).some(k=>k!==0)?(t.beginPath(),t.fillStyle=o.multiKeyBackground,Ls(t,{x:y,y:x,w:c,h:l,radius:w}),t.fill(),t.stroke(),t.fillStyle=r.backgroundColor,t.beginPath(),Ls(t,{x:v,y:x+1,w:c-2,h:l-2,radius:w}),t.fill()):(t.fillStyle=o.multiKeyBackground,t.fillRect(y,x,c,l),t.strokeRect(y,x,c,l),t.fillStyle=r.backgroundColor,t.fillRect(v,x+1,c-2,l-2))}t.fillStyle=this.labelTextColors[i]}drawBody(t,n,i){const{body:s}=this,{bodySpacing:o,bodyAlign:r,displayColors:a,boxHeight:l,boxWidth:c,boxPadding:u}=i,f=ct(i.bodyFont);let p=f.lineHeight,g=0;const x=Ue(i.rtl,this.x,this.width),y=function(E){n.fillText(E,x.x(t.x+g),t.y+p/2),t.y+=p+o},v=x.textAlign(r);let w,k,O,C,T,D,P;for(n.textAlign=r,n.textBaseline="middle",n.font=f.string,t.x=ai(this,v,i),n.fillStyle=i.bodyColor,z(this.beforeBody,y),g=a&&v!=="right"?r==="center"?c/2+u:c+2+u:0,C=0,D=s.length;C<D;++C){for(w=s[C],k=this.labelTextColors[C],n.fillStyle=k,z(w.before,y),O=w.lines,a&&O.length&&(this._drawColorBox(n,t,C,x,i),p=Math.max(f.lineHeight,l)),T=0,P=O.length;T<P;++T)y(O[T]),p=f.lineHeight;z(w.after,y)}g=0,p=f.lineHeight,z(this.afterBody,y),t.y-=o}drawFooter(t,n,i){const s=this.footer,o=s.length;let r,a;if(o){const l=Ue(i.rtl,this.x,this.width);for(t.x=ai(this,i.footerAlign,i),t.y+=i.footerMarginTop,n.textAlign=l.textAlign(i.footerAlign),n.textBaseline="middle",r=ct(i.footerFont),n.fillStyle=i.footerColor,n.font=r.string,a=0;a<o;++a)n.fillText(s[a],l.x(t.x),t.y+r.lineHeight/2),t.y+=r.lineHeight+i.footerSpacing}}drawBackground(t,n,i,s){const{xAlign:o,yAlign:r}=this,{x:a,y:l}=t,{width:c,height:u}=i,{topLeft:f,topRight:p,bottomLeft:g,bottomRight:x}=Tn(s.cornerRadius);n.fillStyle=s.backgroundColor,n.strokeStyle=s.borderColor,n.lineWidth=s.borderWidth,n.beginPath(),n.moveTo(a+f,l),r==="top"&&this.drawCaret(t,n,i,s),n.lineTo(a+c-p,l),n.quadraticCurveTo(a+c,l,a+c,l+p),r==="center"&&o==="right"&&this.drawCaret(t,n,i,s),n.lineTo(a+c,l+u-x),n.quadraticCurveTo(a+c,l+u,a+c-x,l+u),r==="bottom"&&this.drawCaret(t,n,i,s),n.lineTo(a+g,l+u),n.quadraticCurveTo(a,l+u,a,l+u-g),r==="center"&&o==="left"&&this.drawCaret(t,n,i,s),n.lineTo(a,l+f),n.quadraticCurveTo(a,l,a+f,l),n.closePath(),n.fill(),s.borderWidth>0&&n.stroke()}_updateAnimationTarget(t){const n=this.chart,i=this.$animations,s=i&&i.x,o=i&&i.y;if(s||o){const r=_n[t.position].call(this,this._active,this._eventPosition);if(!r)return;const a=this._size=$r(this,t),l=Object.assign({},r,this._size),c=Yr(n,t,l),u=Xr(t,l,c,n);(s._to!==u.x||o._to!==u.y)&&(this.xAlign=c.xAlign,this.yAlign=c.yAlign,this.width=a.width,this.height=a.height,this.caretX=r.x,this.caretY=r.y,this._resolveAnimations().update(this,u))}}_willRender(){return!!this.opacity}draw(t){const n=this.options.setContext(this.getContext());let i=this.opacity;if(!i)return;this._updateAnimationTarget(n);const s={width:this.width,height:this.height},o={x:this.x,y:this.y};i=Math.abs(i)<.001?0:i;const r=Mt(n.padding),a=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;n.enabled&&a&&(t.save(),t.globalAlpha=i,this.drawBackground(o,t,s,n),El(t,n.textDirection),o.y+=r.top,this.drawTitle(o,t,n),this.drawBody(o,t,n),this.drawFooter(o,t,n),Ol(t,n.textDirection),t.restore())}getActiveElements(){return this._active||[]}setActiveElements(t,n){const i=this._active,s=t.map(({datasetIndex:a,index:l})=>{const c=this.chart.getDatasetMeta(a);if(!c)throw new Error("Cannot find a dataset at index "+a);return{datasetIndex:a,element:c.data[l],index:l}}),o=!vi(i,s),r=this._positionChanged(s,n);(o||r)&&(this._active=s,this._eventPosition=n,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(t,n,i=!0){if(n&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;const s=this.options,o=this._active||[],r=this._getActiveElements(t,o,n,i),a=this._positionChanged(r,t),l=n||!vi(r,o)||a;return l&&(this._active=r,(s.enabled||s.external)&&(this._eventPosition={x:t.x,y:t.y},this.update(!0,n))),l}_getActiveElements(t,n,i,s){const o=this.options;if(t.type==="mouseout")return[];if(!s)return n.filter(a=>this.chart.data.datasets[a.datasetIndex]&&this.chart.getDatasetMeta(a.datasetIndex).controller.getParsed(a.index)!==void 0);const r=this.chart.getElementsAtEventForMode(t,o.mode,o,i);return o.reverse&&r.reverse(),r}_positionChanged(t,n){const{caretX:i,caretY:s,options:o}=this,r=_n[o.position].call(this,t,n);return r!==!1&&(i!==r.x||s!==r.y)}}var _g={id:"tooltip",_element:Kr,positioners:_n,afterInit(e,t,n){n&&(e.tooltip=new Kr({chart:e,options:n}))},beforeUpdate(e,t,n){e.tooltip&&e.tooltip.initialize(n)},reset(e,t,n){e.tooltip&&e.tooltip.initialize(n)},afterDraw(e){const t=e.tooltip;if(t&&t._willRender()){const n={tooltip:t};if(e.notifyPlugins("beforeTooltipDraw",{...n,cancelable:!0})===!1)return;t.draw(e.ctx),e.notifyPlugins("afterTooltipDraw",n)}},afterEvent(e,t){if(e.tooltip){const n=t.replay;e.tooltip.handleEvent(t.event,n,t.inChartArea)&&(t.changed=!0)}},defaults:{enabled:!0,external:null,position:"average",backgroundColor:"rgba(0,0,0,0.8)",titleColor:"#fff",titleFont:{weight:"bold"},titleSpacing:2,titleMarginBottom:6,titleAlign:"left",bodyColor:"#fff",bodySpacing:2,bodyFont:{},bodyAlign:"left",footerColor:"#fff",footerSpacing:2,footerMarginTop:6,footerFont:{weight:"bold"},footerAlign:"left",padding:6,caretPadding:2,caretSize:5,cornerRadius:6,boxHeight:(e,t)=>t.bodyFont.size,boxWidth:(e,t)=>t.bodyFont.size,multiKeyBackground:"#fff",displayColors:!0,boxPadding:0,borderColor:"rgba(0,0,0,0)",borderWidth:0,animation:{duration:400,easing:"easeOutQuart"},animations:{numbers:{type:"number",properties:["x","y","width","height","caretX","caretY"]},opacity:{easing:"linear",duration:200}},callbacks:$l},defaultRoutes:{bodyFont:"font",footerFont:"font",titleFont:"font"},descriptors:{_scriptable:e=>e!=="filter"&&e!=="itemSort"&&e!=="external",_indexable:!1,callbacks:{_scriptable:!1,_indexable:!1},animation:{_fallback:!1},animations:{_fallback:"animation"}},additionalOptionScopes:["interaction"]};const wg=(e,t,n,i)=>(typeof t=="string"?(n=e.push(t)-1,i.unshift({index:n,label:t})):isNaN(t)&&(n=null),n);function Sg(e,t,n,i){const s=e.indexOf(t);if(s===-1)return wg(e,t,n,i);const o=e.lastIndexOf(t);return s!==o?n:s}const kg=(e,t)=>e===null?null:yt(Math.round(e),0,t);function Zr(e){const t=this.getLabels();return e>=0&&e<t.length?t[e]:e}class Tg extends nn{static id="category";static defaults={ticks:{callback:Zr}};constructor(t){super(t),this._startValue=void 0,this._valueRange=0,this._addedLabels=[]}init(t){const n=this._addedLabels;if(n.length){const i=this.getLabels();for(const{index:s,label:o}of n)i[s]===o&&i.splice(s,1);this._addedLabels=[]}super.init(t)}parse(t,n){if(V(t))return null;const i=this.getLabels();return n=isFinite(n)&&i[n]===t?n:Sg(i,t,R(n,t),this._addedLabels),kg(n,i.length-1)}determineDataLimits(){const{minDefined:t,maxDefined:n}=this.getUserBounds();let{min:i,max:s}=this.getMinMax(!0);this.options.bounds==="ticks"&&(t||(i=0),n||(s=this.getLabels().length-1)),this.min=i,this.max=s}buildTicks(){const t=this.min,n=this.max,i=this.options.offset,s=[];let o=this.getLabels();o=t===0&&n===o.length-1?o:o.slice(t,n+1),this._valueRange=Math.max(o.length-(i?0:1),1),this._startValue=this.min-(i?.5:0);for(let r=t;r<=n;r++)s.push({value:r});return s}getLabelForValue(t){return Zr.call(this,t)}configure(){super.configure(),this.isHorizontal()||(this._reversePixels=!this._reversePixels)}getPixelForValue(t){return typeof t!="number"&&(t=this.parse(t)),t===null?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getPixelForTick(t){const n=this.ticks;return t<0||t>n.length-1?null:this.getPixelForValue(n[t].value)}getValueForPixel(t){return Math.round(this._startValue+this.getDecimalForPixel(t)*this._valueRange)}getBasePixel(){return this.bottom}}function Mg(e,t){const n=[],{bounds:s,step:o,min:r,max:a,precision:l,count:c,maxTicks:u,maxDigits:f,includeBounds:p}=e,g=o||1,x=u-1,{min:y,max:v}=t,w=!V(r),k=!V(a),O=!V(c),C=(v-y)/(f+1);let T=er((v-y)/x/g)*g,D,P,E,A;if(T<1e-14&&!w&&!k)return[{value:y},{value:v}];A=Math.ceil(v/T)-Math.floor(y/T),A>x&&(T=er(A*T/x/g)*g),V(l)||(D=Math.pow(10,l),T=Math.ceil(T*D)/D),s==="ticks"?(P=Math.floor(y/T)*T,E=Math.ceil(v/T)*T):(P=y,E=v),w&&k&&o&&cf((a-r)/o,T/1e3)?(A=Math.round(Math.min((a-r)/T,u)),T=(a-r)/A,P=r,E=a):O?(P=w?r:P,E=k?a:E,A=c-1,T=(E-P)/A):(A=(E-P)/T,Ce(A,Math.round(A),T/1e3)?A=Math.round(A):A=Math.ceil(A));const F=Math.max(nr(T),nr(P));D=Math.pow(10,V(l)?F:l),P=Math.round(P*D)/D,E=Math.round(E*D)/D;let L=0;for(w&&(p&&P!==r?(n.push({value:r}),P<r&&L++,Ce(Math.round((P+L*T)*D)/D,r,Qr(r,C,e))&&L++):P<r&&L++);L<A;++L){const H=Math.round((P+L*T)*D)/D;if(k&&H>a)break;n.push({value:H})}return k&&p&&E!==a?n.length&&Ce(n[n.length-1].value,a,Qr(a,C,e))?n[n.length-1].value=a:n.push({value:a}):(!k||E===a)&&n.push({value:E}),n}function Qr(e,t,{horizontal:n,minRotation:i}){const s=Me(i),o=(n?Math.sin(s):Math.cos(s))||.001,r=.75*t*(""+e).length;return Math.min(t/o,r)}class Eg extends nn{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,n){return V(t)||(typeof t=="number"||t instanceof Number)&&!isFinite(+t)?null:+t}handleTickRangeOptions(){const{beginAtZero:t}=this.options,{minDefined:n,maxDefined:i}=this.getUserBounds();let{min:s,max:o}=this;const r=l=>s=n?s:l,a=l=>o=i?o:l;if(t){const l=ce(s),c=ce(o);l<0&&c<0?a(0):l>0&&c>0&&r(0)}if(s===o){let l=o===0?1:Math.abs(o*.05);a(o+l),t||r(s-l)}this.min=s,this.max=o}getTickLimit(){const t=this.options.ticks;let{maxTicksLimit:n,stepSize:i}=t,s;return i?(s=Math.ceil(this.max/i)-Math.floor(this.min/i)+1,s>1e3&&(console.warn(\`scales.\${this.id}.ticks.stepSize: \${i} would result generating up to \${s} ticks. Limiting to 1000.\`),s=1e3)):(s=this.computeTickLimit(),n=n||11),n&&(s=Math.min(n,s)),s}computeTickLimit(){return Number.POSITIVE_INFINITY}buildTicks(){const t=this.options,n=t.ticks;let i=this.getTickLimit();i=Math.max(2,i);const s={maxTicks:i,bounds:t.bounds,min:t.min,max:t.max,precision:n.precision,step:n.stepSize,count:n.count,maxDigits:this._maxDigits(),horizontal:this.isHorizontal(),minRotation:n.minRotation||0,includeBounds:n.includeBounds!==!1},o=this._range||this,r=Mg(s,o);return t.bounds==="ticks"&&uf(r,this,"value"),t.reverse?(r.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),r}configure(){const t=this.ticks;let n=this.min,i=this.max;if(super.configure(),this.options.offset&&t.length){const s=(i-n)/Math.max(t.length-1,1)/2;n-=s,i+=s}this._startValue=n,this._endValue=i,this._valueRange=i-n}getLabelForValue(t){return yl(t,this.chart.options.locale,this.options.ticks.format)}}class Og extends Eg{static id="linear";static defaults={ticks:{callback:xl.formatters.numeric}};determineDataLimits(){const{min:t,max:n}=this.getMinMax(!0);this.min=xt(t)?t:0,this.max=xt(n)?n:1,this.handleTickRangeOptions()}computeTickLimit(){const t=this.isHorizontal(),n=t?this.width:this.height,i=Me(this.options.ticks.minRotation),s=(t?Math.sin(i):Math.cos(i))||.001,o=this._resolveTickFontOptions(0);return Math.ceil(n/Math.min(40,o.lineHeight/s))}getPixelForValue(t){return t===null?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getValueForPixel(t){return this._startValue+this.getDecimalForPixel(t)*this._valueRange}}const zi={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}},lt=Object.keys(zi);function Jr(e,t){return e-t}function ta(e,t){if(V(t))return null;const n=e._adapter,{parser:i,round:s,isoWeekday:o}=e._parseOpts;let r=t;return typeof i=="function"&&(r=i(r)),xt(r)||(r=typeof i=="string"?n.parse(r,i):n.parse(r)),r===null?null:(s&&(r=s==="week"&&(In(o)||o===!0)?n.startOf(r,"isoWeek",o):n.startOf(r,s)),+r)}function ea(e,t,n,i){const s=lt.length;for(let o=lt.indexOf(e);o<s-1;++o){const r=zi[lt[o]],a=r.steps?r.steps:Number.MAX_SAFE_INTEGER;if(r.common&&Math.ceil((n-t)/(a*r.size))<=i)return lt[o]}return lt[s-1]}function Cg(e,t,n,i,s){for(let o=lt.length-1;o>=lt.indexOf(n);o--){const r=lt[o];if(zi[r].common&&e._adapter.diff(s,i,r)>=t-1)return r}return lt[n?lt.indexOf(n):0]}function Pg(e){for(let t=lt.indexOf(e)+1,n=lt.length;t<n;++t)if(zi[lt[t]].common)return lt[t]}function na(e,t,n){if(!n)e[t]=!0;else if(n.length){const{lo:i,hi:s}=ro(n,t),o=n[i]>=t?n[i]:n[s];e[o]=!0}}function Dg(e,t,n,i){const s=e._adapter,o=+s.startOf(t[0].value,i),r=t[t.length-1].value;let a,l;for(a=o;a<=r;a=+s.add(a,1,i))l=n[a],l>=0&&(t[l].major=!0);return t}function ia(e,t,n){const i=[],s={},o=t.length;let r,a;for(r=0;r<o;++r)a=t[r],s[a]=r,i.push({value:a,major:!1});return o===0||!n?i:Dg(e,i,s,n)}class sa extends nn{static id="time";static defaults={bounds:"data",adapters:{},time:{parser:!1,unit:!1,round:!1,isoWeekday:!1,minUnit:"millisecond",displayFormats:{}},ticks:{source:"auto",callback:!1,major:{enabled:!1}}};constructor(t){super(t),this._cache={data:[],labels:[],all:[]},this._unit="day",this._majorUnit=void 0,this._offsets={},this._normalized=!1,this._parseOpts=void 0}init(t,n={}){const i=t.time||(t.time={}),s=this._adapter=new Wd._date(t.adapters.date);s.init(n),wn(i.displayFormats,s.formats()),this._parseOpts={parser:i.parser,round:i.round,isoWeekday:i.isoWeekday},super.init(t),this._normalized=n.normalized}parse(t,n){return t===void 0?null:ta(this,t)}beforeLayout(){super.beforeLayout(),this._cache={data:[],labels:[],all:[]}}determineDataLimits(){const t=this.options,n=this._adapter,i=t.time.unit||"day";let{min:s,max:o,minDefined:r,maxDefined:a}=this.getUserBounds();function l(c){!r&&!isNaN(c.min)&&(s=Math.min(s,c.min)),!a&&!isNaN(c.max)&&(o=Math.max(o,c.max))}(!r||!a)&&(l(this._getLabelBounds()),(t.bounds!=="ticks"||t.ticks.source!=="labels")&&l(this.getMinMax(!1))),s=xt(s)&&!isNaN(s)?s:+n.startOf(Date.now(),i),o=xt(o)&&!isNaN(o)?o:+n.endOf(Date.now(),i)+1,this.min=Math.min(s,o-1),this.max=Math.max(s+1,o)}_getLabelBounds(){const t=this.getLabelTimestamps();let n=Number.POSITIVE_INFINITY,i=Number.NEGATIVE_INFINITY;return t.length&&(n=t[0],i=t[t.length-1]),{min:n,max:i}}buildTicks(){const t=this.options,n=t.time,i=t.ticks,s=i.source==="labels"?this.getLabelTimestamps():this._generate();t.bounds==="ticks"&&s.length&&(this.min=this._userMin||s[0],this.max=this._userMax||s[s.length-1]);const o=this.min,r=this.max,a=mf(s,o,r);return this._unit=n.unit||(i.autoSkip?ea(n.minUnit,this.min,this.max,this._getLabelCapacity(o)):Cg(this,a.length,n.minUnit,this.min,this.max)),this._majorUnit=!i.major.enabled||this._unit==="year"?void 0:Pg(this._unit),this.initOffsets(s),t.reverse&&a.reverse(),ia(this,a,this._majorUnit)}afterAutoSkip(){this.options.offsetAfterAutoskip&&this.initOffsets(this.ticks.map(t=>+t.value))}initOffsets(t=[]){let n=0,i=0,s,o;this.options.offset&&t.length&&(s=this.getDecimalForValue(t[0]),t.length===1?n=1-s:n=(this.getDecimalForValue(t[1])-s)/2,o=this.getDecimalForValue(t[t.length-1]),t.length===1?i=o:i=(o-this.getDecimalForValue(t[t.length-2]))/2);const r=t.length<3?.5:.25;n=yt(n,0,r),i=yt(i,0,r),this._offsets={start:n,end:i,factor:1/(n+1+i)}}_generate(){const t=this._adapter,n=this.min,i=this.max,s=this.options,o=s.time,r=o.unit||ea(o.minUnit,n,i,this._getLabelCapacity(n)),a=R(s.ticks.stepSize,1),l=r==="week"?o.isoWeekday:!1,c=In(l)||l===!0,u={};let f=n,p,g;if(c&&(f=+t.startOf(f,"isoWeek",l)),f=+t.startOf(f,c?"day":r),t.diff(i,n,r)>1e5*a)throw new Error(n+" and "+i+" are too far apart with stepSize of "+a+" "+r);const x=s.ticks.source==="data"&&this.getDataTimestamps();for(p=f,g=0;p<i;p=+t.add(p,a,r),g++)na(u,p,x);return(p===i||s.bounds==="ticks"||g===1)&&na(u,p,x),Object.keys(u).sort(Jr).map(y=>+y)}getLabelForValue(t){const n=this._adapter,i=this.options.time;return i.tooltipFormat?n.format(t,i.tooltipFormat):n.format(t,i.displayFormats.datetime)}format(t,n){const s=this.options.time.displayFormats,o=this._unit,r=n||s[o];return this._adapter.format(t,r)}_tickFormatFunction(t,n,i,s){const o=this.options,r=o.ticks.callback;if(r)return I(r,[t,n,i],this);const a=o.time.displayFormats,l=this._unit,c=this._majorUnit,u=l&&a[l],f=c&&a[c],p=i[n],g=c&&f&&p&&p.major;return this._adapter.format(t,s||(g?f:u))}generateTickLabels(t){let n,i,s;for(n=0,i=t.length;n<i;++n)s=t[n],s.label=this._tickFormatFunction(s.value,n,t)}getDecimalForValue(t){return t===null?NaN:(t-this.min)/(this.max-this.min)}getPixelForValue(t){const n=this._offsets,i=this.getDecimalForValue(t);return this.getPixelForDecimal((n.start+i)*n.factor)}getValueForPixel(t){const n=this._offsets,i=this.getDecimalForPixel(t)/n.factor-n.end;return this.min+i*(this.max-this.min)}_getLabelSize(t){const n=this.options.ticks,i=this.ctx.measureText(t).width,s=Me(this.isHorizontal()?n.maxRotation:n.minRotation),o=Math.cos(s),r=Math.sin(s),a=this._resolveTickFontOptions(0).size;return{w:i*o+a*r,h:i*r+a*o}}_getLabelCapacity(t){const n=this.options.time,i=n.displayFormats,s=i[n.unit]||i.millisecond,o=this._tickFormatFunction(t,0,ia(this,[t],this._majorUnit),s),r=this._getLabelSize(o),a=Math.floor(this.isHorizontal()?this.width/r.w:this.height/r.h)-1;return a>0?a:1}getDataTimestamps(){let t=this._cache.data||[],n,i;if(t.length)return t;const s=this.getMatchingVisibleMetas();if(this._normalized&&s.length)return this._cache.data=s[0].controller.getAllParsedValues(this);for(n=0,i=s.length;n<i;++n)t=t.concat(s[n].controller.getAllParsedValues(this));return this._cache.data=this.normalize(t)}getLabelTimestamps(){const t=this._cache.labels||[];let n,i;if(t.length)return t;const s=this.getLabels();for(n=0,i=s.length;n<i;++n)t.push(ta(this,s[n]));return this._cache.labels=this._normalized?t:this.normalize(t)}normalize(t){return yf(t.sort(Jr))}}function li(e,t,n){let i=0,s=e.length-1,o,r,a,l;n?(t>=e[i].pos&&t<=e[s].pos&&({lo:i,hi:s}=Ee(e,"pos",t)),{pos:o,time:a}=e[i],{pos:r,time:l}=e[s]):(t>=e[i].time&&t<=e[s].time&&({lo:i,hi:s}=Ee(e,"time",t)),{time:o,pos:a}=e[i],{time:r,pos:l}=e[s]);const c=r-o;return c?a+(l-a)*(t-o)/c:a}class Lm extends sa{static id="timeseries";static defaults=sa.defaults;constructor(t){super(t),this._table=[],this._minPos=void 0,this._tableRange=void 0}initOffsets(){const t=this._getTimestampsForTable(),n=this._table=this.buildLookupTable(t);this._minPos=li(n,this.min),this._tableRange=li(n,this.max)-this._minPos,super.initOffsets(t)}buildLookupTable(t){const{min:n,max:i}=this,s=[],o=[];let r,a,l,c,u;for(r=0,a=t.length;r<a;++r)c=t[r],c>=n&&c<=i&&s.push(c);if(s.length<2)return[{time:n,pos:0},{time:i,pos:1}];for(r=0,a=s.length;r<a;++r)u=s[r+1],l=s[r-1],c=s[r],Math.round((u+l)/2)!==c&&o.push({time:c,pos:r/(a-1)});return o}_generate(){const t=this.min,n=this.max;let i=super.getDataTimestamps();return(!i.includes(t)||!i.length)&&i.splice(0,0,t),(!i.includes(n)||i.length===1)&&i.push(n),i.sort((s,o)=>s-o)}_getTimestampsForTable(){let t=this._cache.all||[];if(t.length)return t;const n=this.getDataTimestamps(),i=this.getLabelTimestamps();return n.length&&i.length?t=this.normalize(n.concat(i)):t=n.length?n:i,t=this._cache.all=t,t}getDecimalForValue(t){return(li(this._table,t)-this._minPos)/this._tableRange}getValueForPixel(t){const n=this._offsets,i=this.getDecimalForPixel(t)/n.factor-n.end;return li(this._table,i*this._tableRange+this._minPos,!0)}}function Ag(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var os={exports:{}};/*! Hammer.JS - v2.0.7 - 2016-04-22
|
|
1744
1744
|
* http://hammerjs.github.io/
|
|
1745
1745
|
*
|
|
1746
1746
|
* Copyright (c) 2016 Jorik Tangelder;
|
|
1747
|
-
* Licensed under the MIT license */var
|
|
1747
|
+
* Licensed under the MIT license */var oa;function Ig(){return oa||(oa=1,(function(e){(function(t,n,i,s){var o=["","webkit","Moz","MS","ms","o"],r=n.createElement("div"),a="function",l=Math.round,c=Math.abs,u=Date.now;function f(h,d,b){return setTimeout(O(h,b),d)}function p(h,d,b){return Array.isArray(h)?(g(h,b[d],b),!0):!1}function g(h,d,b){var _;if(h)if(h.forEach)h.forEach(d,b);else if(h.length!==s)for(_=0;_<h.length;)d.call(b,h[_],_,h),_++;else for(_ in h)h.hasOwnProperty(_)&&d.call(b,h[_],_,h)}function x(h,d,b){var _="DEPRECATED METHOD: "+d+\`
|
|
1748
1748
|
\`+b+\` AT
|
|
1749
|
-
\`;return function(){var S=new Error("get-stack-trace"),M=S&&S.stack?S.stack.replace(/^[^\\(]+?[\\n$]/gm,"").replace(/^\\s+at\\s+/gm,"").replace(/^Object.<anonymous>\\s*\\(/gm,"{anonymous}()@"):"Unknown Stack Trace",N=t.console&&(t.console.warn||t.console.log);return N&&N.call(t.console,_,M),h.apply(this,arguments)}}var y;typeof Object.assign!="function"?y=function(d){if(d===s||d===null)throw new TypeError("Cannot convert undefined or null to object");for(var b=Object(d),_=1;_<arguments.length;_++){var S=arguments[_];if(S!==s&&S!==null)for(var M in S)S.hasOwnProperty(M)&&(b[M]=S[M])}return b}:y=Object.assign;var v=x(function(d,b,_){for(var S=Object.keys(b),M=0;M<S.length;)(!_||_&&d[S[M]]===s)&&(d[S[M]]=b[S[M]]),M++;return d},"extend","Use \`assign\`."),w=x(function(d,b){return v(d,b,!0)},"merge","Use \`assign\`.");function k(h,d,b){var _=d.prototype,S;S=h.prototype=Object.create(_),S.constructor=h,S._super=_,b&&y(S,b)}function C(h,d){return function(){return h.apply(d,arguments)}}function O(h,d){return typeof h==a?h.apply(d&&d[0]||s,d):h}function T(h,d){return h===s?d:h}function D(h,d,b){g(F(d),function(_){h.addEventListener(_,b,!1)})}function P(h,d,b){g(F(d),function(_){h.removeEventListener(_,b,!1)})}function E(h,d){for(;h;){if(h==d)return!0;h=h.parentNode}return!1}function A(h,d){return h.indexOf(d)>-1}function F(h){return h.trim().split(/\\s+/g)}function L(h,d,b){if(h.indexOf&&!b)return h.indexOf(d);for(var _=0;_<h.length;){if(b&&h[_][b]==d||!b&&h[_]===d)return _;_++}return-1}function H(h){return Array.prototype.slice.call(h,0)}function K(h,d,b){for(var _=[],S=[],M=0;M<h.length;){var N=h[M][d];L(S,N)<0&&_.push(h[M]),S[M]=N,M++}return _=_.sort(function(Z,st){return Z[d]>st[d]}),_}function et(h,d){for(var b,_,S=d[0].toUpperCase()+d.slice(1),M=0;M<o.length;){if(b=o[M],_=b?b+S:d,_ in h)return _;M++}return s}var j=1;function q(){return j++}function nt(h){var d=h.ownerDocument||h;return d.defaultView||d.parentWindow||t}var Ne=/mobile|tablet|ip(ad|hone|od)|android/i,pe="ontouchstart"in t,qt=et(t,"PointerEvent")!==s,ze=pe&&Ne.test(navigator.userAgent),dt="touch",ge="pen",vt="mouse",me="kinect",Ht=25,it=1,be=2,X=4,ot=8,zn=1,on=2,rn=4,an=8,ln=16,Et=on|rn,ye=an|ln,xo=Et|ye,vo=["x","y"],Fn=["clientX","clientY"];function pt(h,d){var b=this;this.manager=h,this.callback=d,this.element=h.element,this.target=h.options.inputTarget,this.domHandler=function(_){O(h.options.enable,[h])&&b.handler(_)},this.init()}pt.prototype={handler:function(){},init:function(){this.evEl&&D(this.element,this.evEl,this.domHandler),this.evTarget&&D(this.target,this.evTarget,this.domHandler),this.evWin&&D(nt(this.element),this.evWin,this.domHandler)},destroy:function(){this.evEl&&P(this.element,this.evEl,this.domHandler),this.evTarget&&P(this.target,this.evTarget,this.domHandler),this.evWin&&P(nt(this.element),this.evWin,this.domHandler)}};function oc(h){var d,b=h.options.inputClass;return b?d=b:qt?d=Hi:ze?d=Vn:pe?d=Bi:d=Bn,new d(h,rc)}function rc(h,d,b){var _=b.pointers.length,S=b.changedPointers.length,M=d&it&&_-S===0,N=d&(X|ot)&&_-S===0;b.isFirst=!!M,b.isFinal=!!N,M&&(h.session={}),b.eventType=d,ac(h,b),h.emit("hammer.input",b),h.recognize(b),h.session.prevInput=b}function ac(h,d){var b=h.session,_=d.pointers,S=_.length;b.firstInput||(b.firstInput=_o(d)),S>1&&!b.firstMultiple?b.firstMultiple=_o(d):S===1&&(b.firstMultiple=!1);var M=b.firstInput,N=b.firstMultiple,G=N?N.center:M.center,Z=d.center=wo(_);d.timeStamp=u(),d.deltaTime=d.timeStamp-M.timeStamp,d.angle=Fi(G,Z),d.distance=Hn(G,Z),lc(b,d),d.offsetDirection=ko(d.deltaX,d.deltaY);var st=So(d.deltaTime,d.deltaX,d.deltaY);d.overallVelocityX=st.x,d.overallVelocityY=st.y,d.overallVelocity=c(st.x)>c(st.y)?st.x:st.y,d.scale=N?hc(N.pointers,_):1,d.rotation=N?uc(N.pointers,_):0,d.maxPointers=b.prevInput?d.pointers.length>b.prevInput.maxPointers?d.pointers.length:b.prevInput.maxPointers:d.pointers.length,cc(b,d);var Ot=h.element;E(d.srcEvent.target,Ot)&&(Ot=d.srcEvent.target),d.target=Ot}function lc(h,d){var b=d.center,_=h.offsetDelta||{},S=h.prevDelta||{},M=h.prevInput||{};(d.eventType===it||M.eventType===X)&&(S=h.prevDelta={x:M.deltaX||0,y:M.deltaY||0},_=h.offsetDelta={x:b.x,y:b.y}),d.deltaX=S.x+(b.x-_.x),d.deltaY=S.y+(b.y-_.y)}function cc(h,d){var b=h.lastInterval||d,_=d.timeStamp-b.timeStamp,S,M,N,G;if(d.eventType!=ot&&(_>Ht||b.velocity===s)){var Z=d.deltaX-b.deltaX,st=d.deltaY-b.deltaY,Ot=So(_,Z,st);M=Ot.x,N=Ot.y,S=c(Ot.x)>c(Ot.y)?Ot.x:Ot.y,G=ko(Z,st),h.lastInterval=d}else S=b.velocity,M=b.velocityX,N=b.velocityY,G=b.direction;d.velocity=S,d.velocityX=M,d.velocityY=N,d.direction=G}function _o(h){for(var d=[],b=0;b<h.pointers.length;)d[b]={clientX:l(h.pointers[b].clientX),clientY:l(h.pointers[b].clientY)},b++;return{timeStamp:u(),pointers:d,center:wo(d),deltaX:h.deltaX,deltaY:h.deltaY}}function wo(h){var d=h.length;if(d===1)return{x:l(h[0].clientX),y:l(h[0].clientY)};for(var b=0,_=0,S=0;S<d;)b+=h[S].clientX,_+=h[S].clientY,S++;return{x:l(b/d),y:l(_/d)}}function So(h,d,b){return{x:d/h||0,y:b/h||0}}function ko(h,d){return h===d?zn:c(h)>=c(d)?h<0?on:rn:d<0?an:ln}function Hn(h,d,b){b||(b=vo);var _=d[b[0]]-h[b[0]],S=d[b[1]]-h[b[1]];return Math.sqrt(_*_+S*S)}function Fi(h,d,b){b||(b=vo);var _=d[b[0]]-h[b[0]],S=d[b[1]]-h[b[1]];return Math.atan2(S,_)*180/Math.PI}function uc(h,d){return Fi(d[1],d[0],Fn)+Fi(h[1],h[0],Fn)}function hc(h,d){return Hn(d[0],d[1],Fn)/Hn(h[0],h[1],Fn)}var fc={mousedown:it,mousemove:be,mouseup:X},dc="mousedown",pc="mousemove mouseup";function Bn(){this.evEl=dc,this.evWin=pc,this.pressed=!1,pt.apply(this,arguments)}k(Bn,pt,{handler:function(d){var b=fc[d.type];b&it&&d.button===0&&(this.pressed=!0),b&be&&d.which!==1&&(b=X),this.pressed&&(b&X&&(this.pressed=!1),this.callback(this.manager,b,{pointers:[d],changedPointers:[d],pointerType:vt,srcEvent:d}))}});var gc={pointerdown:it,pointermove:be,pointerup:X,pointercancel:ot,pointerout:ot},mc={2:dt,3:ge,4:vt,5:me},To="pointerdown",Mo="pointermove pointerup pointercancel";t.MSPointerEvent&&!t.PointerEvent&&(To="MSPointerDown",Mo="MSPointerMove MSPointerUp MSPointerCancel");function Hi(){this.evEl=To,this.evWin=Mo,pt.apply(this,arguments),this.store=this.manager.session.pointerEvents=[]}k(Hi,pt,{handler:function(d){var b=this.store,_=!1,S=d.type.toLowerCase().replace("ms",""),M=gc[S],N=mc[d.pointerType]||d.pointerType,G=N==dt,Z=L(b,d.pointerId,"pointerId");M&it&&(d.button===0||G)?Z<0&&(b.push(d),Z=b.length-1):M&(X|ot)&&(_=!0),!(Z<0)&&(b[Z]=d,this.callback(this.manager,M,{pointers:b,changedPointers:[d],pointerType:N,srcEvent:d}),_&&b.splice(Z,1))}});var bc={touchstart:it,touchmove:be,touchend:X,touchcancel:ot},yc="touchstart",xc="touchstart touchmove touchend touchcancel";function Eo(){this.evTarget=yc,this.evWin=xc,this.started=!1,pt.apply(this,arguments)}k(Eo,pt,{handler:function(d){var b=bc[d.type];if(b===it&&(this.started=!0),!!this.started){var _=vc.call(this,d,b);b&(X|ot)&&_[0].length-_[1].length===0&&(this.started=!1),this.callback(this.manager,b,{pointers:_[0],changedPointers:_[1],pointerType:dt,srcEvent:d})}}});function vc(h,d){var b=H(h.touches),_=H(h.changedTouches);return d&(X|ot)&&(b=K(b.concat(_),"identifier")),[b,_]}var _c={touchstart:it,touchmove:be,touchend:X,touchcancel:ot},wc="touchstart touchmove touchend touchcancel";function Vn(){this.evTarget=wc,this.targetIds={},pt.apply(this,arguments)}k(Vn,pt,{handler:function(d){var b=_c[d.type],_=Sc.call(this,d,b);_&&this.callback(this.manager,b,{pointers:_[0],changedPointers:_[1],pointerType:dt,srcEvent:d})}});function Sc(h,d){var b=H(h.touches),_=this.targetIds;if(d&(it|be)&&b.length===1)return _[b[0].identifier]=!0,[b,b];var S,M,N=H(h.changedTouches),G=[],Z=this.target;if(M=b.filter(function(st){return E(st.target,Z)}),d===it)for(S=0;S<M.length;)_[M[S].identifier]=!0,S++;for(S=0;S<N.length;)_[N[S].identifier]&&G.push(N[S]),d&(X|ot)&&delete _[N[S].identifier],S++;if(G.length)return[K(M.concat(G),"identifier"),G]}var kc=2500,Co=25;function Bi(){pt.apply(this,arguments);var h=C(this.handler,this);this.touch=new Vn(this.manager,h),this.mouse=new Bn(this.manager,h),this.primaryTouch=null,this.lastTouches=[]}k(Bi,pt,{handler:function(d,b,_){var S=_.pointerType==dt,M=_.pointerType==vt;if(!(M&&_.sourceCapabilities&&_.sourceCapabilities.firesTouchEvents)){if(S)Tc.call(this,b,_);else if(M&&Mc.call(this,_))return;this.callback(d,b,_)}},destroy:function(){this.touch.destroy(),this.mouse.destroy()}});function Tc(h,d){h&it?(this.primaryTouch=d.changedPointers[0].identifier,Oo.call(this,d)):h&(X|ot)&&Oo.call(this,d)}function Oo(h){var d=h.changedPointers[0];if(d.identifier===this.primaryTouch){var b={x:d.clientX,y:d.clientY};this.lastTouches.push(b);var _=this.lastTouches,S=function(){var M=_.indexOf(b);M>-1&&_.splice(M,1)};setTimeout(S,kc)}}function Mc(h){for(var d=h.srcEvent.clientX,b=h.srcEvent.clientY,_=0;_<this.lastTouches.length;_++){var S=this.lastTouches[_],M=Math.abs(d-S.x),N=Math.abs(b-S.y);if(M<=Co&&N<=Co)return!0}return!1}var Po=et(r.style,"touchAction"),Do=Po!==s,Ao="compute",Io="auto",Vi="manipulation",xe="none",cn="pan-x",un="pan-y",Wn=Cc();function Wi(h,d){this.manager=h,this.set(d)}Wi.prototype={set:function(h){h==Ao&&(h=this.compute()),Do&&this.manager.element.style&&Wn[h]&&(this.manager.element.style[Po]=h),this.actions=h.toLowerCase().trim()},update:function(){this.set(this.manager.options.touchAction)},compute:function(){var h=[];return g(this.manager.recognizers,function(d){O(d.options.enable,[d])&&(h=h.concat(d.getTouchAction()))}),Ec(h.join(" "))},preventDefaults:function(h){var d=h.srcEvent,b=h.offsetDirection;if(this.manager.session.prevented){d.preventDefault();return}var _=this.actions,S=A(_,xe)&&!Wn[xe],M=A(_,un)&&!Wn[un],N=A(_,cn)&&!Wn[cn];if(S){var G=h.pointers.length===1,Z=h.distance<2,st=h.deltaTime<250;if(G&&Z&&st)return}if(!(N&&M)&&(S||M&&b&Et||N&&b&ye))return this.preventSrc(d)},preventSrc:function(h){this.manager.session.prevented=!0,h.preventDefault()}};function Ec(h){if(A(h,xe))return xe;var d=A(h,cn),b=A(h,un);return d&&b?xe:d||b?d?cn:un:A(h,Vi)?Vi:Io}function Cc(){if(!Do)return!1;var h={},d=t.CSS&&t.CSS.supports;return["auto","manipulation","pan-y","pan-x","pan-x pan-y","none"].forEach(function(b){h[b]=d?t.CSS.supports("touch-action",b):!0}),h}var jn=1,gt=2,Fe=4,Gt=8,Bt=Gt,hn=16,Ct=32;function Vt(h){this.options=y({},this.defaults,h||{}),this.id=q(),this.manager=null,this.options.enable=T(this.options.enable,!0),this.state=jn,this.simultaneous={},this.requireFail=[]}Vt.prototype={defaults:{},set:function(h){return y(this.options,h),this.manager&&this.manager.touchAction.update(),this},recognizeWith:function(h){if(p(h,"recognizeWith",this))return this;var d=this.simultaneous;return h=Un(h,this),d[h.id]||(d[h.id]=h,h.recognizeWith(this)),this},dropRecognizeWith:function(h){return p(h,"dropRecognizeWith",this)?this:(h=Un(h,this),delete this.simultaneous[h.id],this)},requireFailure:function(h){if(p(h,"requireFailure",this))return this;var d=this.requireFail;return h=Un(h,this),L(d,h)===-1&&(d.push(h),h.requireFailure(this)),this},dropRequireFailure:function(h){if(p(h,"dropRequireFailure",this))return this;h=Un(h,this);var d=L(this.requireFail,h);return d>-1&&this.requireFail.splice(d,1),this},hasRequireFailures:function(){return this.requireFail.length>0},canRecognizeWith:function(h){return!!this.simultaneous[h.id]},emit:function(h){var d=this,b=this.state;function _(S){d.manager.emit(S,h)}b<Gt&&_(d.options.event+Lo(b)),_(d.options.event),h.additionalEvent&&_(h.additionalEvent),b>=Gt&&_(d.options.event+Lo(b))},tryEmit:function(h){if(this.canEmit())return this.emit(h);this.state=Ct},canEmit:function(){for(var h=0;h<this.requireFail.length;){if(!(this.requireFail[h].state&(Ct|jn)))return!1;h++}return!0},recognize:function(h){var d=y({},h);if(!O(this.options.enable,[this,d])){this.reset(),this.state=Ct;return}this.state&(Bt|hn|Ct)&&(this.state=jn),this.state=this.process(d),this.state&(gt|Fe|Gt|hn)&&this.tryEmit(d)},process:function(h){},getTouchAction:function(){},reset:function(){}};function Lo(h){return h&hn?"cancel":h&Gt?"end":h&Fe?"move":h>?"start":""}function Ro(h){return h==ln?"down":h==an?"up":h==on?"left":h==rn?"right":""}function Un(h,d){var b=d.manager;return b?b.get(h):h}function _t(){Vt.apply(this,arguments)}k(_t,Vt,{defaults:{pointers:1},attrTest:function(h){var d=this.options.pointers;return d===0||h.pointers.length===d},process:function(h){var d=this.state,b=h.eventType,_=d&(gt|Fe),S=this.attrTest(h);return _&&(b&ot||!S)?d|hn:_||S?b&X?d|Gt:d>?d|Fe:gt:Ct}});function $n(){_t.apply(this,arguments),this.pX=null,this.pY=null}k($n,_t,{defaults:{event:"pan",threshold:10,pointers:1,direction:xo},getTouchAction:function(){var h=this.options.direction,d=[];return h&Et&&d.push(un),h&ye&&d.push(cn),d},directionTest:function(h){var d=this.options,b=!0,_=h.distance,S=h.direction,M=h.deltaX,N=h.deltaY;return S&d.direction||(d.direction&Et?(S=M===0?zn:M<0?on:rn,b=M!=this.pX,_=Math.abs(h.deltaX)):(S=N===0?zn:N<0?an:ln,b=N!=this.pY,_=Math.abs(h.deltaY))),h.direction=S,b&&_>d.threshold&&S&d.direction},attrTest:function(h){return _t.prototype.attrTest.call(this,h)&&(this.state>||!(this.state>)&&this.directionTest(h))},emit:function(h){this.pX=h.deltaX,this.pY=h.deltaY;var d=Ro(h.direction);d&&(h.additionalEvent=this.options.event+d),this._super.emit.call(this,h)}});function ji(){_t.apply(this,arguments)}k(ji,_t,{defaults:{event:"pinch",threshold:0,pointers:2},getTouchAction:function(){return[xe]},attrTest:function(h){return this._super.attrTest.call(this,h)&&(Math.abs(h.scale-1)>this.options.threshold||this.state>)},emit:function(h){if(h.scale!==1){var d=h.scale<1?"in":"out";h.additionalEvent=this.options.event+d}this._super.emit.call(this,h)}});function Ui(){Vt.apply(this,arguments),this._timer=null,this._input=null}k(Ui,Vt,{defaults:{event:"press",pointers:1,time:251,threshold:9},getTouchAction:function(){return[Io]},process:function(h){var d=this.options,b=h.pointers.length===d.pointers,_=h.distance<d.threshold,S=h.deltaTime>d.time;if(this._input=h,!_||!b||h.eventType&(X|ot)&&!S)this.reset();else if(h.eventType&it)this.reset(),this._timer=f(function(){this.state=Bt,this.tryEmit()},d.time,this);else if(h.eventType&X)return Bt;return Ct},reset:function(){clearTimeout(this._timer)},emit:function(h){this.state===Bt&&(h&&h.eventType&X?this.manager.emit(this.options.event+"up",h):(this._input.timeStamp=u(),this.manager.emit(this.options.event,this._input)))}});function $i(){_t.apply(this,arguments)}k($i,_t,{defaults:{event:"rotate",threshold:0,pointers:2},getTouchAction:function(){return[xe]},attrTest:function(h){return this._super.attrTest.call(this,h)&&(Math.abs(h.rotation)>this.options.threshold||this.state>)}});function Yi(){_t.apply(this,arguments)}k(Yi,_t,{defaults:{event:"swipe",threshold:10,velocity:.3,direction:Et|ye,pointers:1},getTouchAction:function(){return $n.prototype.getTouchAction.call(this)},attrTest:function(h){var d=this.options.direction,b;return d&(Et|ye)?b=h.overallVelocity:d&Et?b=h.overallVelocityX:d&ye&&(b=h.overallVelocityY),this._super.attrTest.call(this,h)&&d&h.offsetDirection&&h.distance>this.options.threshold&&h.maxPointers==this.options.pointers&&c(b)>this.options.velocity&&h.eventType&X},emit:function(h){var d=Ro(h.offsetDirection);d&&this.manager.emit(this.options.event+d,h),this.manager.emit(this.options.event,h)}});function Yn(){Vt.apply(this,arguments),this.pTime=!1,this.pCenter=!1,this._timer=null,this._input=null,this.count=0}k(Yn,Vt,{defaults:{event:"tap",pointers:1,taps:1,interval:300,time:250,threshold:9,posThreshold:10},getTouchAction:function(){return[Vi]},process:function(h){var d=this.options,b=h.pointers.length===d.pointers,_=h.distance<d.threshold,S=h.deltaTime<d.time;if(this.reset(),h.eventType&it&&this.count===0)return this.failTimeout();if(_&&S&&b){if(h.eventType!=X)return this.failTimeout();var M=this.pTime?h.timeStamp-this.pTime<d.interval:!0,N=!this.pCenter||Hn(this.pCenter,h.center)<d.posThreshold;this.pTime=h.timeStamp,this.pCenter=h.center,!N||!M?this.count=1:this.count+=1,this._input=h;var G=this.count%d.taps;if(G===0)return this.hasRequireFailures()?(this._timer=f(function(){this.state=Bt,this.tryEmit()},d.interval,this),gt):Bt}return Ct},failTimeout:function(){return this._timer=f(function(){this.state=Ct},this.options.interval,this),Ct},reset:function(){clearTimeout(this._timer)},emit:function(){this.state==Bt&&(this._input.tapCount=this.count,this.manager.emit(this.options.event,this._input))}});function Kt(h,d){return d=d||{},d.recognizers=T(d.recognizers,Kt.defaults.preset),new Xi(h,d)}Kt.VERSION="2.0.7",Kt.defaults={domEvents:!1,touchAction:Ao,enable:!0,inputTarget:null,inputClass:null,preset:[[$i,{enable:!1}],[ji,{enable:!1},["rotate"]],[Yi,{direction:Et}],[$n,{direction:Et},["swipe"]],[Yn],[Yn,{event:"doubletap",taps:2},["tap"]],[Ui]],cssProps:{userSelect:"none",touchSelect:"none",touchCallout:"none",contentZooming:"none",userDrag:"none",tapHighlightColor:"rgba(0,0,0,0)"}};var Oc=1,No=2;function Xi(h,d){this.options=y({},Kt.defaults,d||{}),this.options.inputTarget=this.options.inputTarget||h,this.handlers={},this.session={},this.recognizers=[],this.oldCssProps={},this.element=h,this.input=oc(this),this.touchAction=new Wi(this,this.options.touchAction),zo(this,!0),g(this.options.recognizers,function(b){var _=this.add(new b[0](b[1]));b[2]&&_.recognizeWith(b[2]),b[3]&&_.requireFailure(b[3])},this)}Xi.prototype={set:function(h){return y(this.options,h),h.touchAction&&this.touchAction.update(),h.inputTarget&&(this.input.destroy(),this.input.target=h.inputTarget,this.input.init()),this},stop:function(h){this.session.stopped=h?No:Oc},recognize:function(h){var d=this.session;if(!d.stopped){this.touchAction.preventDefaults(h);var b,_=this.recognizers,S=d.curRecognizer;(!S||S&&S.state&Bt)&&(S=d.curRecognizer=null);for(var M=0;M<_.length;)b=_[M],d.stopped!==No&&(!S||b==S||b.canRecognizeWith(S))?b.recognize(h):b.reset(),!S&&b.state&(gt|Fe|Gt)&&(S=d.curRecognizer=b),M++}},get:function(h){if(h instanceof Vt)return h;for(var d=this.recognizers,b=0;b<d.length;b++)if(d[b].options.event==h)return d[b];return null},add:function(h){if(p(h,"add",this))return this;var d=this.get(h.options.event);return d&&this.remove(d),this.recognizers.push(h),h.manager=this,this.touchAction.update(),h},remove:function(h){if(p(h,"remove",this))return this;if(h=this.get(h),h){var d=this.recognizers,b=L(d,h);b!==-1&&(d.splice(b,1),this.touchAction.update())}return this},on:function(h,d){if(h!==s&&d!==s){var b=this.handlers;return g(F(h),function(_){b[_]=b[_]||[],b[_].push(d)}),this}},off:function(h,d){if(h!==s){var b=this.handlers;return g(F(h),function(_){d?b[_]&&b[_].splice(L(b[_],d),1):delete b[_]}),this}},emit:function(h,d){this.options.domEvents&&Pc(h,d);var b=this.handlers[h]&&this.handlers[h].slice();if(!(!b||!b.length)){d.type=h,d.preventDefault=function(){d.srcEvent.preventDefault()};for(var _=0;_<b.length;)b[_](d),_++}},destroy:function(){this.element&&zo(this,!1),this.handlers={},this.session={},this.input.destroy(),this.element=null}};function zo(h,d){var b=h.element;if(b.style){var _;g(h.options.cssProps,function(S,M){_=et(b.style,M),d?(h.oldCssProps[_]=b.style[_],b.style[_]=S):b.style[_]=h.oldCssProps[_]||""}),d||(h.oldCssProps={})}}function Pc(h,d){var b=n.createEvent("Event");b.initEvent(h,!0,!0),b.gesture=d,d.target.dispatchEvent(b)}y(Kt,{INPUT_START:it,INPUT_MOVE:be,INPUT_END:X,INPUT_CANCEL:ot,STATE_POSSIBLE:jn,STATE_BEGAN:gt,STATE_CHANGED:Fe,STATE_ENDED:Gt,STATE_RECOGNIZED:Bt,STATE_CANCELLED:hn,STATE_FAILED:Ct,DIRECTION_NONE:zn,DIRECTION_LEFT:on,DIRECTION_RIGHT:rn,DIRECTION_UP:an,DIRECTION_DOWN:ln,DIRECTION_HORIZONTAL:Et,DIRECTION_VERTICAL:ye,DIRECTION_ALL:xo,Manager:Xi,Input:pt,TouchAction:Wi,TouchInput:Vn,MouseInput:Bn,PointerEventInput:Hi,TouchMouseInput:Bi,SingleTouchInput:Eo,Recognizer:Vt,AttrRecognizer:_t,Tap:Yn,Pan:$n,Swipe:Yi,Pinch:ji,Rotate:$i,Press:Ui,on:D,off:P,each:g,merge:w,extend:v,assign:y,inherit:k,bindFn:C,prefixed:et});var Dc=typeof t<"u"?t:typeof self<"u"?self:{};Dc.Hammer=Kt,e.exports?e.exports=Kt:t[i]=Kt})(window,document,"Hammer")})(os)),os.exports}var Ig=Ag();const Mn=Dg(Ig);/*!
|
|
1749
|
+
\`;return function(){var S=new Error("get-stack-trace"),M=S&&S.stack?S.stack.replace(/^[^\\(]+?[\\n$]/gm,"").replace(/^\\s+at\\s+/gm,"").replace(/^Object.<anonymous>\\s*\\(/gm,"{anonymous}()@"):"Unknown Stack Trace",N=t.console&&(t.console.warn||t.console.log);return N&&N.call(t.console,_,M),h.apply(this,arguments)}}var y;typeof Object.assign!="function"?y=function(d){if(d===s||d===null)throw new TypeError("Cannot convert undefined or null to object");for(var b=Object(d),_=1;_<arguments.length;_++){var S=arguments[_];if(S!==s&&S!==null)for(var M in S)S.hasOwnProperty(M)&&(b[M]=S[M])}return b}:y=Object.assign;var v=x(function(d,b,_){for(var S=Object.keys(b),M=0;M<S.length;)(!_||_&&d[S[M]]===s)&&(d[S[M]]=b[S[M]]),M++;return d},"extend","Use \`assign\`."),w=x(function(d,b){return v(d,b,!0)},"merge","Use \`assign\`.");function k(h,d,b){var _=d.prototype,S;S=h.prototype=Object.create(_),S.constructor=h,S._super=_,b&&y(S,b)}function O(h,d){return function(){return h.apply(d,arguments)}}function C(h,d){return typeof h==a?h.apply(d&&d[0]||s,d):h}function T(h,d){return h===s?d:h}function D(h,d,b){g(F(d),function(_){h.addEventListener(_,b,!1)})}function P(h,d,b){g(F(d),function(_){h.removeEventListener(_,b,!1)})}function E(h,d){for(;h;){if(h==d)return!0;h=h.parentNode}return!1}function A(h,d){return h.indexOf(d)>-1}function F(h){return h.trim().split(/\\s+/g)}function L(h,d,b){if(h.indexOf&&!b)return h.indexOf(d);for(var _=0;_<h.length;){if(b&&h[_][b]==d||!b&&h[_]===d)return _;_++}return-1}function H(h){return Array.prototype.slice.call(h,0)}function K(h,d,b){for(var _=[],S=[],M=0;M<h.length;){var N=h[M][d];L(S,N)<0&&_.push(h[M]),S[M]=N,M++}return _=_.sort(function(Z,st){return Z[d]>st[d]}),_}function et(h,d){for(var b,_,S=d[0].toUpperCase()+d.slice(1),M=0;M<o.length;){if(b=o[M],_=b?b+S:d,_ in h)return _;M++}return s}var j=1;function q(){return j++}function nt(h){var d=h.ownerDocument||h;return d.defaultView||d.parentWindow||t}var Ne=/mobile|tablet|ip(ad|hone|od)|android/i,pe="ontouchstart"in t,qt=et(t,"PointerEvent")!==s,ze=pe&&Ne.test(navigator.userAgent),dt="touch",ge="pen",vt="mouse",me="kinect",Ht=25,it=1,be=2,X=4,ot=8,zn=1,on=2,rn=4,an=8,ln=16,Et=on|rn,ye=an|ln,xo=Et|ye,vo=["x","y"],Fn=["clientX","clientY"];function pt(h,d){var b=this;this.manager=h,this.callback=d,this.element=h.element,this.target=h.options.inputTarget,this.domHandler=function(_){C(h.options.enable,[h])&&b.handler(_)},this.init()}pt.prototype={handler:function(){},init:function(){this.evEl&&D(this.element,this.evEl,this.domHandler),this.evTarget&&D(this.target,this.evTarget,this.domHandler),this.evWin&&D(nt(this.element),this.evWin,this.domHandler)},destroy:function(){this.evEl&&P(this.element,this.evEl,this.domHandler),this.evTarget&&P(this.target,this.evTarget,this.domHandler),this.evWin&&P(nt(this.element),this.evWin,this.domHandler)}};function rc(h){var d,b=h.options.inputClass;return b?d=b:qt?d=Hi:ze?d=Vn:pe?d=Bi:d=Bn,new d(h,ac)}function ac(h,d,b){var _=b.pointers.length,S=b.changedPointers.length,M=d&it&&_-S===0,N=d&(X|ot)&&_-S===0;b.isFirst=!!M,b.isFinal=!!N,M&&(h.session={}),b.eventType=d,lc(h,b),h.emit("hammer.input",b),h.recognize(b),h.session.prevInput=b}function lc(h,d){var b=h.session,_=d.pointers,S=_.length;b.firstInput||(b.firstInput=_o(d)),S>1&&!b.firstMultiple?b.firstMultiple=_o(d):S===1&&(b.firstMultiple=!1);var M=b.firstInput,N=b.firstMultiple,G=N?N.center:M.center,Z=d.center=wo(_);d.timeStamp=u(),d.deltaTime=d.timeStamp-M.timeStamp,d.angle=Fi(G,Z),d.distance=Hn(G,Z),cc(b,d),d.offsetDirection=ko(d.deltaX,d.deltaY);var st=So(d.deltaTime,d.deltaX,d.deltaY);d.overallVelocityX=st.x,d.overallVelocityY=st.y,d.overallVelocity=c(st.x)>c(st.y)?st.x:st.y,d.scale=N?fc(N.pointers,_):1,d.rotation=N?hc(N.pointers,_):0,d.maxPointers=b.prevInput?d.pointers.length>b.prevInput.maxPointers?d.pointers.length:b.prevInput.maxPointers:d.pointers.length,uc(b,d);var Ct=h.element;E(d.srcEvent.target,Ct)&&(Ct=d.srcEvent.target),d.target=Ct}function cc(h,d){var b=d.center,_=h.offsetDelta||{},S=h.prevDelta||{},M=h.prevInput||{};(d.eventType===it||M.eventType===X)&&(S=h.prevDelta={x:M.deltaX||0,y:M.deltaY||0},_=h.offsetDelta={x:b.x,y:b.y}),d.deltaX=S.x+(b.x-_.x),d.deltaY=S.y+(b.y-_.y)}function uc(h,d){var b=h.lastInterval||d,_=d.timeStamp-b.timeStamp,S,M,N,G;if(d.eventType!=ot&&(_>Ht||b.velocity===s)){var Z=d.deltaX-b.deltaX,st=d.deltaY-b.deltaY,Ct=So(_,Z,st);M=Ct.x,N=Ct.y,S=c(Ct.x)>c(Ct.y)?Ct.x:Ct.y,G=ko(Z,st),h.lastInterval=d}else S=b.velocity,M=b.velocityX,N=b.velocityY,G=b.direction;d.velocity=S,d.velocityX=M,d.velocityY=N,d.direction=G}function _o(h){for(var d=[],b=0;b<h.pointers.length;)d[b]={clientX:l(h.pointers[b].clientX),clientY:l(h.pointers[b].clientY)},b++;return{timeStamp:u(),pointers:d,center:wo(d),deltaX:h.deltaX,deltaY:h.deltaY}}function wo(h){var d=h.length;if(d===1)return{x:l(h[0].clientX),y:l(h[0].clientY)};for(var b=0,_=0,S=0;S<d;)b+=h[S].clientX,_+=h[S].clientY,S++;return{x:l(b/d),y:l(_/d)}}function So(h,d,b){return{x:d/h||0,y:b/h||0}}function ko(h,d){return h===d?zn:c(h)>=c(d)?h<0?on:rn:d<0?an:ln}function Hn(h,d,b){b||(b=vo);var _=d[b[0]]-h[b[0]],S=d[b[1]]-h[b[1]];return Math.sqrt(_*_+S*S)}function Fi(h,d,b){b||(b=vo);var _=d[b[0]]-h[b[0]],S=d[b[1]]-h[b[1]];return Math.atan2(S,_)*180/Math.PI}function hc(h,d){return Fi(d[1],d[0],Fn)+Fi(h[1],h[0],Fn)}function fc(h,d){return Hn(d[0],d[1],Fn)/Hn(h[0],h[1],Fn)}var dc={mousedown:it,mousemove:be,mouseup:X},pc="mousedown",gc="mousemove mouseup";function Bn(){this.evEl=pc,this.evWin=gc,this.pressed=!1,pt.apply(this,arguments)}k(Bn,pt,{handler:function(d){var b=dc[d.type];b&it&&d.button===0&&(this.pressed=!0),b&be&&d.which!==1&&(b=X),this.pressed&&(b&X&&(this.pressed=!1),this.callback(this.manager,b,{pointers:[d],changedPointers:[d],pointerType:vt,srcEvent:d}))}});var mc={pointerdown:it,pointermove:be,pointerup:X,pointercancel:ot,pointerout:ot},bc={2:dt,3:ge,4:vt,5:me},To="pointerdown",Mo="pointermove pointerup pointercancel";t.MSPointerEvent&&!t.PointerEvent&&(To="MSPointerDown",Mo="MSPointerMove MSPointerUp MSPointerCancel");function Hi(){this.evEl=To,this.evWin=Mo,pt.apply(this,arguments),this.store=this.manager.session.pointerEvents=[]}k(Hi,pt,{handler:function(d){var b=this.store,_=!1,S=d.type.toLowerCase().replace("ms",""),M=mc[S],N=bc[d.pointerType]||d.pointerType,G=N==dt,Z=L(b,d.pointerId,"pointerId");M&it&&(d.button===0||G)?Z<0&&(b.push(d),Z=b.length-1):M&(X|ot)&&(_=!0),!(Z<0)&&(b[Z]=d,this.callback(this.manager,M,{pointers:b,changedPointers:[d],pointerType:N,srcEvent:d}),_&&b.splice(Z,1))}});var yc={touchstart:it,touchmove:be,touchend:X,touchcancel:ot},xc="touchstart",vc="touchstart touchmove touchend touchcancel";function Eo(){this.evTarget=xc,this.evWin=vc,this.started=!1,pt.apply(this,arguments)}k(Eo,pt,{handler:function(d){var b=yc[d.type];if(b===it&&(this.started=!0),!!this.started){var _=_c.call(this,d,b);b&(X|ot)&&_[0].length-_[1].length===0&&(this.started=!1),this.callback(this.manager,b,{pointers:_[0],changedPointers:_[1],pointerType:dt,srcEvent:d})}}});function _c(h,d){var b=H(h.touches),_=H(h.changedTouches);return d&(X|ot)&&(b=K(b.concat(_),"identifier")),[b,_]}var wc={touchstart:it,touchmove:be,touchend:X,touchcancel:ot},Sc="touchstart touchmove touchend touchcancel";function Vn(){this.evTarget=Sc,this.targetIds={},pt.apply(this,arguments)}k(Vn,pt,{handler:function(d){var b=wc[d.type],_=kc.call(this,d,b);_&&this.callback(this.manager,b,{pointers:_[0],changedPointers:_[1],pointerType:dt,srcEvent:d})}});function kc(h,d){var b=H(h.touches),_=this.targetIds;if(d&(it|be)&&b.length===1)return _[b[0].identifier]=!0,[b,b];var S,M,N=H(h.changedTouches),G=[],Z=this.target;if(M=b.filter(function(st){return E(st.target,Z)}),d===it)for(S=0;S<M.length;)_[M[S].identifier]=!0,S++;for(S=0;S<N.length;)_[N[S].identifier]&&G.push(N[S]),d&(X|ot)&&delete _[N[S].identifier],S++;if(G.length)return[K(M.concat(G),"identifier"),G]}var Tc=2500,Oo=25;function Bi(){pt.apply(this,arguments);var h=O(this.handler,this);this.touch=new Vn(this.manager,h),this.mouse=new Bn(this.manager,h),this.primaryTouch=null,this.lastTouches=[]}k(Bi,pt,{handler:function(d,b,_){var S=_.pointerType==dt,M=_.pointerType==vt;if(!(M&&_.sourceCapabilities&&_.sourceCapabilities.firesTouchEvents)){if(S)Mc.call(this,b,_);else if(M&&Ec.call(this,_))return;this.callback(d,b,_)}},destroy:function(){this.touch.destroy(),this.mouse.destroy()}});function Mc(h,d){h&it?(this.primaryTouch=d.changedPointers[0].identifier,Co.call(this,d)):h&(X|ot)&&Co.call(this,d)}function Co(h){var d=h.changedPointers[0];if(d.identifier===this.primaryTouch){var b={x:d.clientX,y:d.clientY};this.lastTouches.push(b);var _=this.lastTouches,S=function(){var M=_.indexOf(b);M>-1&&_.splice(M,1)};setTimeout(S,Tc)}}function Ec(h){for(var d=h.srcEvent.clientX,b=h.srcEvent.clientY,_=0;_<this.lastTouches.length;_++){var S=this.lastTouches[_],M=Math.abs(d-S.x),N=Math.abs(b-S.y);if(M<=Oo&&N<=Oo)return!0}return!1}var Po=et(r.style,"touchAction"),Do=Po!==s,Ao="compute",Io="auto",Vi="manipulation",xe="none",cn="pan-x",un="pan-y",Wn=Cc();function Wi(h,d){this.manager=h,this.set(d)}Wi.prototype={set:function(h){h==Ao&&(h=this.compute()),Do&&this.manager.element.style&&Wn[h]&&(this.manager.element.style[Po]=h),this.actions=h.toLowerCase().trim()},update:function(){this.set(this.manager.options.touchAction)},compute:function(){var h=[];return g(this.manager.recognizers,function(d){C(d.options.enable,[d])&&(h=h.concat(d.getTouchAction()))}),Oc(h.join(" "))},preventDefaults:function(h){var d=h.srcEvent,b=h.offsetDirection;if(this.manager.session.prevented){d.preventDefault();return}var _=this.actions,S=A(_,xe)&&!Wn[xe],M=A(_,un)&&!Wn[un],N=A(_,cn)&&!Wn[cn];if(S){var G=h.pointers.length===1,Z=h.distance<2,st=h.deltaTime<250;if(G&&Z&&st)return}if(!(N&&M)&&(S||M&&b&Et||N&&b&ye))return this.preventSrc(d)},preventSrc:function(h){this.manager.session.prevented=!0,h.preventDefault()}};function Oc(h){if(A(h,xe))return xe;var d=A(h,cn),b=A(h,un);return d&&b?xe:d||b?d?cn:un:A(h,Vi)?Vi:Io}function Cc(){if(!Do)return!1;var h={},d=t.CSS&&t.CSS.supports;return["auto","manipulation","pan-y","pan-x","pan-x pan-y","none"].forEach(function(b){h[b]=d?t.CSS.supports("touch-action",b):!0}),h}var jn=1,gt=2,Fe=4,Gt=8,Bt=Gt,hn=16,Ot=32;function Vt(h){this.options=y({},this.defaults,h||{}),this.id=q(),this.manager=null,this.options.enable=T(this.options.enable,!0),this.state=jn,this.simultaneous={},this.requireFail=[]}Vt.prototype={defaults:{},set:function(h){return y(this.options,h),this.manager&&this.manager.touchAction.update(),this},recognizeWith:function(h){if(p(h,"recognizeWith",this))return this;var d=this.simultaneous;return h=Un(h,this),d[h.id]||(d[h.id]=h,h.recognizeWith(this)),this},dropRecognizeWith:function(h){return p(h,"dropRecognizeWith",this)?this:(h=Un(h,this),delete this.simultaneous[h.id],this)},requireFailure:function(h){if(p(h,"requireFailure",this))return this;var d=this.requireFail;return h=Un(h,this),L(d,h)===-1&&(d.push(h),h.requireFailure(this)),this},dropRequireFailure:function(h){if(p(h,"dropRequireFailure",this))return this;h=Un(h,this);var d=L(this.requireFail,h);return d>-1&&this.requireFail.splice(d,1),this},hasRequireFailures:function(){return this.requireFail.length>0},canRecognizeWith:function(h){return!!this.simultaneous[h.id]},emit:function(h){var d=this,b=this.state;function _(S){d.manager.emit(S,h)}b<Gt&&_(d.options.event+Lo(b)),_(d.options.event),h.additionalEvent&&_(h.additionalEvent),b>=Gt&&_(d.options.event+Lo(b))},tryEmit:function(h){if(this.canEmit())return this.emit(h);this.state=Ot},canEmit:function(){for(var h=0;h<this.requireFail.length;){if(!(this.requireFail[h].state&(Ot|jn)))return!1;h++}return!0},recognize:function(h){var d=y({},h);if(!C(this.options.enable,[this,d])){this.reset(),this.state=Ot;return}this.state&(Bt|hn|Ot)&&(this.state=jn),this.state=this.process(d),this.state&(gt|Fe|Gt|hn)&&this.tryEmit(d)},process:function(h){},getTouchAction:function(){},reset:function(){}};function Lo(h){return h&hn?"cancel":h&Gt?"end":h&Fe?"move":h>?"start":""}function Ro(h){return h==ln?"down":h==an?"up":h==on?"left":h==rn?"right":""}function Un(h,d){var b=d.manager;return b?b.get(h):h}function _t(){Vt.apply(this,arguments)}k(_t,Vt,{defaults:{pointers:1},attrTest:function(h){var d=this.options.pointers;return d===0||h.pointers.length===d},process:function(h){var d=this.state,b=h.eventType,_=d&(gt|Fe),S=this.attrTest(h);return _&&(b&ot||!S)?d|hn:_||S?b&X?d|Gt:d>?d|Fe:gt:Ot}});function $n(){_t.apply(this,arguments),this.pX=null,this.pY=null}k($n,_t,{defaults:{event:"pan",threshold:10,pointers:1,direction:xo},getTouchAction:function(){var h=this.options.direction,d=[];return h&Et&&d.push(un),h&ye&&d.push(cn),d},directionTest:function(h){var d=this.options,b=!0,_=h.distance,S=h.direction,M=h.deltaX,N=h.deltaY;return S&d.direction||(d.direction&Et?(S=M===0?zn:M<0?on:rn,b=M!=this.pX,_=Math.abs(h.deltaX)):(S=N===0?zn:N<0?an:ln,b=N!=this.pY,_=Math.abs(h.deltaY))),h.direction=S,b&&_>d.threshold&&S&d.direction},attrTest:function(h){return _t.prototype.attrTest.call(this,h)&&(this.state>||!(this.state>)&&this.directionTest(h))},emit:function(h){this.pX=h.deltaX,this.pY=h.deltaY;var d=Ro(h.direction);d&&(h.additionalEvent=this.options.event+d),this._super.emit.call(this,h)}});function ji(){_t.apply(this,arguments)}k(ji,_t,{defaults:{event:"pinch",threshold:0,pointers:2},getTouchAction:function(){return[xe]},attrTest:function(h){return this._super.attrTest.call(this,h)&&(Math.abs(h.scale-1)>this.options.threshold||this.state>)},emit:function(h){if(h.scale!==1){var d=h.scale<1?"in":"out";h.additionalEvent=this.options.event+d}this._super.emit.call(this,h)}});function Ui(){Vt.apply(this,arguments),this._timer=null,this._input=null}k(Ui,Vt,{defaults:{event:"press",pointers:1,time:251,threshold:9},getTouchAction:function(){return[Io]},process:function(h){var d=this.options,b=h.pointers.length===d.pointers,_=h.distance<d.threshold,S=h.deltaTime>d.time;if(this._input=h,!_||!b||h.eventType&(X|ot)&&!S)this.reset();else if(h.eventType&it)this.reset(),this._timer=f(function(){this.state=Bt,this.tryEmit()},d.time,this);else if(h.eventType&X)return Bt;return Ot},reset:function(){clearTimeout(this._timer)},emit:function(h){this.state===Bt&&(h&&h.eventType&X?this.manager.emit(this.options.event+"up",h):(this._input.timeStamp=u(),this.manager.emit(this.options.event,this._input)))}});function $i(){_t.apply(this,arguments)}k($i,_t,{defaults:{event:"rotate",threshold:0,pointers:2},getTouchAction:function(){return[xe]},attrTest:function(h){return this._super.attrTest.call(this,h)&&(Math.abs(h.rotation)>this.options.threshold||this.state>)}});function Yi(){_t.apply(this,arguments)}k(Yi,_t,{defaults:{event:"swipe",threshold:10,velocity:.3,direction:Et|ye,pointers:1},getTouchAction:function(){return $n.prototype.getTouchAction.call(this)},attrTest:function(h){var d=this.options.direction,b;return d&(Et|ye)?b=h.overallVelocity:d&Et?b=h.overallVelocityX:d&ye&&(b=h.overallVelocityY),this._super.attrTest.call(this,h)&&d&h.offsetDirection&&h.distance>this.options.threshold&&h.maxPointers==this.options.pointers&&c(b)>this.options.velocity&&h.eventType&X},emit:function(h){var d=Ro(h.offsetDirection);d&&this.manager.emit(this.options.event+d,h),this.manager.emit(this.options.event,h)}});function Yn(){Vt.apply(this,arguments),this.pTime=!1,this.pCenter=!1,this._timer=null,this._input=null,this.count=0}k(Yn,Vt,{defaults:{event:"tap",pointers:1,taps:1,interval:300,time:250,threshold:9,posThreshold:10},getTouchAction:function(){return[Vi]},process:function(h){var d=this.options,b=h.pointers.length===d.pointers,_=h.distance<d.threshold,S=h.deltaTime<d.time;if(this.reset(),h.eventType&it&&this.count===0)return this.failTimeout();if(_&&S&&b){if(h.eventType!=X)return this.failTimeout();var M=this.pTime?h.timeStamp-this.pTime<d.interval:!0,N=!this.pCenter||Hn(this.pCenter,h.center)<d.posThreshold;this.pTime=h.timeStamp,this.pCenter=h.center,!N||!M?this.count=1:this.count+=1,this._input=h;var G=this.count%d.taps;if(G===0)return this.hasRequireFailures()?(this._timer=f(function(){this.state=Bt,this.tryEmit()},d.interval,this),gt):Bt}return Ot},failTimeout:function(){return this._timer=f(function(){this.state=Ot},this.options.interval,this),Ot},reset:function(){clearTimeout(this._timer)},emit:function(){this.state==Bt&&(this._input.tapCount=this.count,this.manager.emit(this.options.event,this._input))}});function Kt(h,d){return d=d||{},d.recognizers=T(d.recognizers,Kt.defaults.preset),new Xi(h,d)}Kt.VERSION="2.0.7",Kt.defaults={domEvents:!1,touchAction:Ao,enable:!0,inputTarget:null,inputClass:null,preset:[[$i,{enable:!1}],[ji,{enable:!1},["rotate"]],[Yi,{direction:Et}],[$n,{direction:Et},["swipe"]],[Yn],[Yn,{event:"doubletap",taps:2},["tap"]],[Ui]],cssProps:{userSelect:"none",touchSelect:"none",touchCallout:"none",contentZooming:"none",userDrag:"none",tapHighlightColor:"rgba(0,0,0,0)"}};var Pc=1,No=2;function Xi(h,d){this.options=y({},Kt.defaults,d||{}),this.options.inputTarget=this.options.inputTarget||h,this.handlers={},this.session={},this.recognizers=[],this.oldCssProps={},this.element=h,this.input=rc(this),this.touchAction=new Wi(this,this.options.touchAction),zo(this,!0),g(this.options.recognizers,function(b){var _=this.add(new b[0](b[1]));b[2]&&_.recognizeWith(b[2]),b[3]&&_.requireFailure(b[3])},this)}Xi.prototype={set:function(h){return y(this.options,h),h.touchAction&&this.touchAction.update(),h.inputTarget&&(this.input.destroy(),this.input.target=h.inputTarget,this.input.init()),this},stop:function(h){this.session.stopped=h?No:Pc},recognize:function(h){var d=this.session;if(!d.stopped){this.touchAction.preventDefaults(h);var b,_=this.recognizers,S=d.curRecognizer;(!S||S&&S.state&Bt)&&(S=d.curRecognizer=null);for(var M=0;M<_.length;)b=_[M],d.stopped!==No&&(!S||b==S||b.canRecognizeWith(S))?b.recognize(h):b.reset(),!S&&b.state&(gt|Fe|Gt)&&(S=d.curRecognizer=b),M++}},get:function(h){if(h instanceof Vt)return h;for(var d=this.recognizers,b=0;b<d.length;b++)if(d[b].options.event==h)return d[b];return null},add:function(h){if(p(h,"add",this))return this;var d=this.get(h.options.event);return d&&this.remove(d),this.recognizers.push(h),h.manager=this,this.touchAction.update(),h},remove:function(h){if(p(h,"remove",this))return this;if(h=this.get(h),h){var d=this.recognizers,b=L(d,h);b!==-1&&(d.splice(b,1),this.touchAction.update())}return this},on:function(h,d){if(h!==s&&d!==s){var b=this.handlers;return g(F(h),function(_){b[_]=b[_]||[],b[_].push(d)}),this}},off:function(h,d){if(h!==s){var b=this.handlers;return g(F(h),function(_){d?b[_]&&b[_].splice(L(b[_],d),1):delete b[_]}),this}},emit:function(h,d){this.options.domEvents&&Dc(h,d);var b=this.handlers[h]&&this.handlers[h].slice();if(!(!b||!b.length)){d.type=h,d.preventDefault=function(){d.srcEvent.preventDefault()};for(var _=0;_<b.length;)b[_](d),_++}},destroy:function(){this.element&&zo(this,!1),this.handlers={},this.session={},this.input.destroy(),this.element=null}};function zo(h,d){var b=h.element;if(b.style){var _;g(h.options.cssProps,function(S,M){_=et(b.style,M),d?(h.oldCssProps[_]=b.style[_],b.style[_]=S):b.style[_]=h.oldCssProps[_]||""}),d||(h.oldCssProps={})}}function Dc(h,d){var b=n.createEvent("Event");b.initEvent(h,!0,!0),b.gesture=d,d.target.dispatchEvent(b)}y(Kt,{INPUT_START:it,INPUT_MOVE:be,INPUT_END:X,INPUT_CANCEL:ot,STATE_POSSIBLE:jn,STATE_BEGAN:gt,STATE_CHANGED:Fe,STATE_ENDED:Gt,STATE_RECOGNIZED:Bt,STATE_CANCELLED:hn,STATE_FAILED:Ot,DIRECTION_NONE:zn,DIRECTION_LEFT:on,DIRECTION_RIGHT:rn,DIRECTION_UP:an,DIRECTION_DOWN:ln,DIRECTION_HORIZONTAL:Et,DIRECTION_VERTICAL:ye,DIRECTION_ALL:xo,Manager:Xi,Input:pt,TouchAction:Wi,TouchInput:Vn,MouseInput:Bn,PointerEventInput:Hi,TouchMouseInput:Bi,SingleTouchInput:Eo,Recognizer:Vt,AttrRecognizer:_t,Tap:Yn,Pan:$n,Swipe:Yi,Pinch:ji,Rotate:$i,Press:Ui,on:D,off:P,each:g,merge:w,extend:v,assign:y,inherit:k,bindFn:O,prefixed:et});var Ac=typeof t<"u"?t:typeof self<"u"?self:{};Ac.Hammer=Kt,e.exports?e.exports=Kt:t[i]=Kt})(window,document,"Hammer")})(os)),os.exports}var Lg=Ig();const Mn=Ag(Lg);/*!
|
|
1750
1750
|
* chartjs-plugin-zoom v2.2.0
|
|
1751
1751
|
* https://www.chartjs.org/chartjs-plugin-zoom/2.2.0/
|
|
1752
1752
|
* (c) 2016-2024 chartjs-plugin-zoom Contributors
|
|
1753
1753
|
* Released under the MIT License
|
|
1754
|
-
*/const Rn=e=>e&&e.enabled&&e.modifierKey,$l=(e,t)=>e&&t[e+"Key"],bo=(e,t)=>e&&!t[e+"Key"];function ue(e,t,n){return e===void 0?!0:typeof e=="string"?e.indexOf(t)!==-1:typeof e=="function"?e({chart:n}).indexOf(t)!==-1:!1}function rs(e,t){return typeof e=="function"&&(e=e({chart:t})),typeof e=="string"?{x:e.indexOf("x")!==-1,y:e.indexOf("y")!==-1}:{x:!1,y:!1}}function Lg(e,t){let n;return function(){return clearTimeout(n),n=setTimeout(e,t),t}}function Rg({x:e,y:t},n){const i=n.scales,s=Object.keys(i);for(let o=0;o<s.length;o++){const r=i[s[o]];if(t>=r.top&&t<=r.bottom&&e>=r.left&&e<=r.right)return r}return null}function Yl(e,t,n){const{mode:i="xy",scaleMode:s,overScaleMode:o}=e||{},r=Rg(t,n),a=rs(i,n),l=rs(s,n);if(o){const u=rs(o,n);for(const f of["x","y"])u[f]&&(l[f]=a[f],a[f]=!1)}if(r&&l[r.axis])return[r];const c=[];return z(n.scales,function(u){a[u.axis]&&c.push(u)}),c}const Hs=new WeakMap;function U(e){let t=Hs.get(e);return t||(t={originalScaleLimits:{},updatedScaleLimits:{},handlers:{},panDelta:{},dragging:!1,panning:!1},Hs.set(e,t)),t}function Ng(e){Hs.delete(e)}function Xl(e,t,n,i){const s=Math.max(0,Math.min(1,(e-t)/n||0)),o=1-s;return{min:i*s,max:i*o}}function ql(e,t){const n=e.isHorizontal()?t.x:t.y;return e.getValueForPixel(n)}function Gl(e,t,n){const i=e.max-e.min,s=i*(t-1),o=ql(e,n);return Xl(o,e.min,i,s)}function zg(e,t,n){const i=ql(e,n);if(i===void 0)return{min:e.min,max:e.max};const s=Math.log10(e.min),o=Math.log10(e.max),r=Math.log10(i),a=o-s,l=a*(t-1),c=Xl(r,s,a,l);return{min:Math.pow(10,s+c.min),max:Math.pow(10,o-c.max)}}function Fg(e,t){return t&&(t[e.id]||t[e.axis])||{}}function oa(e,t,n,i,s){let o=n[i];if(o==="original"){const r=e.originalScaleLimits[t.id][i];o=R(r.options,r.scale)}return R(o,s)}function Hg(e,t,n){const i=e.getValueForPixel(t),s=e.getValueForPixel(n);return{min:Math.min(i,s),max:Math.max(i,s)}}function Bg(e,{min:t,max:n,minLimit:i,maxLimit:s},o){const r=(e-n+t)/2;t-=r,n+=r;const a=o.min.options??o.min.scale,l=o.max.options??o.max.scale,c=e/1e6;return Oe(t,a,c)&&(t=a),Oe(n,l,c)&&(n=l),t<i?(t=i,n=Math.min(i+e,s)):n>s&&(n=s,t=Math.max(s-e,i)),{min:t,max:n}}function Re(e,{min:t,max:n},i,s=!1){const o=U(e.chart),{options:r}=e,a=Fg(e,i),{minRange:l=0}=a,c=oa(o,e,a,"min",-1/0),u=oa(o,e,a,"max",1/0);if(s==="pan"&&(t<c||n>u))return!0;const f=e.max-e.min,p=s?Math.max(n-t,l):f;if(s&&p===l&&f<=l)return!0;const g=Bg(p,{min:t,max:n,minLimit:c,maxLimit:u},o.originalScaleLimits[e.id]);return r.min=g.min,r.max=g.max,o.updatedScaleLimits[e.id]=g,e.parse(g.min)!==e.min||e.parse(g.max)!==e.max}function Vg(e,t,n,i){const s=Gl(e,t,n),o={min:e.min+s.min,max:e.max-s.max};return Re(e,o,i,!0)}function Wg(e,t,n,i){const s=zg(e,t,n);return Re(e,s,i,!0)}function jg(e,t,n,i){Re(e,Hg(e,t,n),i,!0)}const ra=e=>e===0||isNaN(e)?0:e<0?Math.min(Math.round(e),-1):Math.max(Math.round(e),1);function Ug(e){const n=e.getLabels().length-1;e.min>0&&(e.min-=1),e.max<n&&(e.max+=1)}function $g(e,t,n,i){const s=Gl(e,t,n);e.min===e.max&&t<1&&Ug(e);const o={min:e.min+ra(s.min),max:e.max-ra(s.max)};return Re(e,o,i,!0)}function Yg(e){return e.isHorizontal()?e.width:e.height}function Xg(e,t,n){const s=e.getLabels().length-1;let{min:o,max:r}=e;const a=Math.max(r-o,1),l=Math.round(Yg(e)/Math.max(a,10)),c=Math.round(Math.abs(t/l));let u;return t<-l?(r=Math.min(r+c,s),o=a===1?r:r-a,u=r===s):t>l&&(o=Math.max(0,o-c),r=a===1?o:o+a,u=o===0),Re(e,{min:o,max:r},n)||u}const qg={second:500,minute:30*1e3,hour:1800*1e3,day:720*60*1e3,week:3.5*24*60*60*1e3,month:360*60*60*1e3,quarter:1440*60*60*1e3,year:4368*60*60*1e3};function Kl(e,t,n,i=!1){const{min:s,max:o,options:r}=e,a=r.time&&r.time.round,l=qg[a]||0,c=e.getValueForPixel(e.getPixelForValue(s+l)-t),u=e.getValueForPixel(e.getPixelForValue(o+l)-t);return isNaN(c)||isNaN(u)?!0:Re(e,{min:c,max:u},n,i?"pan":!1)}function aa(e,t,n){return Kl(e,t,n,!0)}const Bs={category:$g,default:Vg,logarithmic:Wg},Vs={default:jg},Ws={category:Xg,default:Kl,logarithmic:aa,timeseries:aa};function Gg(e,t,n){const{id:i,options:{min:s,max:o}}=e;if(!t[i]||!n[i])return!0;const r=n[i];return r.min!==s||r.max!==o}function la(e,t){z(e,(n,i)=>{t[i]||delete e[i]})}function sn(e,t){const{scales:n}=e,{originalScaleLimits:i,updatedScaleLimits:s}=t;return z(n,function(o){Gg(o,i,s)&&(i[o.id]={min:{scale:o.min,options:o.options.min},max:{scale:o.max,options:o.options.max}})}),la(i,n),la(s,n),i}function ca(e,t,n,i){const s=Bs[e.type]||Bs.default;I(s,[e,t,n,i])}function ua(e,t,n,i){const s=Vs[e.type]||Vs.default;I(s,[e,t,n,i])}function Kg(e){const t=e.chartArea;return{x:(t.left+t.right)/2,y:(t.top+t.bottom)/2}}function yo(e,t,n="none",i="api"){const{x:s=1,y:o=1,focalPoint:r=Kg(e)}=typeof t=="number"?{x:t,y:t}:t,a=U(e),{options:{limits:l,zoom:c}}=a;sn(e,a);const u=s!==1,f=o!==1,p=Yl(c,r,e);z(p||e.scales,function(g){g.isHorizontal()&&u?ca(g,s,r,l):!g.isHorizontal()&&f&&ca(g,o,r,l)}),e.update(n),I(c.onZoom,[{chart:e,trigger:i}])}function Zl(e,t,n,i="none",s="api"){const o=U(e),{options:{limits:r,zoom:a}}=o,{mode:l="xy"}=a;sn(e,o);const c=ue(l,"x",e),u=ue(l,"y",e);z(e.scales,function(f){f.isHorizontal()&&c?ua(f,t.x,n.x,r):!f.isHorizontal()&&u&&ua(f,t.y,n.y,r)}),e.update(i),I(a.onZoom,[{chart:e,trigger:s}])}function Zg(e,t,n,i="none",s="api"){const o=U(e);sn(e,o);const r=e.scales[t];Re(r,n,void 0,!0),e.update(i),I(o.options.zoom?.onZoom,[{chart:e,trigger:s}])}function Qg(e,t="default"){const n=U(e),i=sn(e,n);z(e.scales,function(s){const o=s.options;i[s.id]?(o.min=i[s.id].min.options,o.max=i[s.id].max.options):(delete o.min,delete o.max),delete n.updatedScaleLimits[s.id]}),e.update(t),I(n.options.zoom.onZoomComplete,[{chart:e}])}function Jg(e,t){const n=e.originalScaleLimits[t];if(!n)return;const{min:i,max:s}=n;return R(s.options,s.scale)-R(i.options,i.scale)}function tm(e){const t=U(e);let n=1,i=1;return z(e.scales,function(s){const o=Jg(t,s.id);if(o){const r=Math.round(o/(s.max-s.min)*100)/100;n=Math.min(n,r),i=Math.max(i,r)}}),n<1?n:i}function ha(e,t,n,i){const{panDelta:s}=i,o=s[e.id]||0;ce(o)===ce(t)&&(t+=o);const r=Ws[e.type]||Ws.default;I(r,[e,t,n])?s[e.id]=0:s[e.id]=t}function Ql(e,t,n,i="none"){const{x:s=0,y:o=0}=typeof t=="number"?{x:t,y:t}:t,r=U(e),{options:{pan:a,limits:l}}=r,{onPan:c}=a||{};sn(e,r);const u=s!==0,f=o!==0;z(n||e.scales,function(p){p.isHorizontal()&&u?ha(p,s,l,r):!p.isHorizontal()&&f&&ha(p,o,l,r)}),e.update(i),I(c,[{chart:e}])}function Jl(e){const t=U(e);sn(e,t);const n={};for(const i of Object.keys(e.scales)){const{min:s,max:o}=t.originalScaleLimits[i]||{min:{},max:{}};n[i]={min:s.scale,max:o.scale}}return n}function em(e){const t=U(e),n={};for(const i of Object.keys(e.scales))n[i]=t.updatedScaleLimits[i];return n}function nm(e){const t=Jl(e);for(const n of Object.keys(e.scales)){const{min:i,max:s}=t[n];if(i!==void 0&&e.scales[n].min!==i||s!==void 0&&e.scales[n].max!==s)return!0}return!1}function fa(e){const t=U(e);return t.panning||t.dragging}const da=(e,t,n)=>Math.min(n,Math.max(t,e));function at(e,t){const{handlers:n}=U(e),i=n[t];i&&i.target&&(i.target.removeEventListener(t,i),delete n[t])}function En(e,t,n,i){const{handlers:s,options:o}=U(e),r=s[n];if(r&&r.target===t)return;at(e,n),s[n]=l=>i(e,l,o),s[n].target=t;const a=n==="wheel"?!1:void 0;t.addEventListener(n,s[n],{passive:a})}function im(e,t){const n=U(e);n.dragStart&&(n.dragging=!0,n.dragEnd=t,e.update("none"))}function sm(e,t){const n=U(e);!n.dragStart||t.key!=="Escape"||(at(e,"keydown"),n.dragging=!1,n.dragStart=n.dragEnd=null,e.update("none"))}function js(e,t){if(e.target!==t.canvas){const n=t.canvas.getBoundingClientRect();return{x:e.clientX-n.left,y:e.clientY-n.top}}return It(e,t)}function tc(e,t,n){const{onZoomStart:i,onZoomRejected:s}=n;if(i){const o=js(t,e);if(I(i,[{chart:e,event:t,point:o}])===!1)return I(s,[{chart:e,event:t}]),!1}}function om(e,t){if(e.legend){const o=It(t,e);if(Ze(o,e.legend))return}const n=U(e),{pan:i,zoom:s={}}=n.options;if(t.button!==0||$l(Rn(i),t)||bo(Rn(s.drag),t))return I(s.onZoomRejected,[{chart:e,event:t}]);tc(e,t,s)!==!1&&(n.dragStart=t,En(e,e.canvas.ownerDocument,"mousemove",im),En(e,window.document,"keydown",sm))}function rm({begin:e,end:t},n){let i=t.x-e.x,s=t.y-e.y;const o=Math.abs(i/s);o>n?i=Math.sign(i)*Math.abs(s*n):o<n&&(s=Math.sign(s)*Math.abs(i/n)),t.x=e.x+i,t.y=e.y+s}function pa(e,t,n,{min:i,max:s,prop:o}){e[i]=da(Math.min(n.begin[o],n.end[o]),t[i],t[s]),e[s]=da(Math.max(n.begin[o],n.end[o]),t[i],t[s])}function am(e,t,n){const i={begin:js(t.dragStart,e),end:js(t.dragEnd,e)};if(n){const s=e.chartArea.width/e.chartArea.height;rm(i,s)}return i}function ec(e,t,n,i){const s=ue(t,"x",e),o=ue(t,"y",e),{top:r,left:a,right:l,bottom:c,width:u,height:f}=e.chartArea,p={top:r,left:a,right:l,bottom:c},g=am(e,n,i&&s&&o);s&&pa(p,e.chartArea,g,{min:"left",max:"right",prop:"x"}),o&&pa(p,e.chartArea,g,{min:"top",max:"bottom",prop:"y"});const x=p.right-p.left,y=p.bottom-p.top;return{...p,width:x,height:y,zoomX:s&&x?1+(u-x)/u:1,zoomY:o&&y?1+(f-y)/f:1}}function lm(e,t){const n=U(e);if(!n.dragStart)return;at(e,"mousemove");const{mode:i,onZoomComplete:s,drag:{threshold:o=0,maintainAspectRatio:r}}=n.options.zoom,a=ec(e,i,{dragStart:n.dragStart,dragEnd:t},r),l=ue(i,"x",e)?a.width:0,c=ue(i,"y",e)?a.height:0,u=Math.sqrt(l*l+c*c);if(n.dragStart=n.dragEnd=null,u<=o){n.dragging=!1,e.update("none");return}Zl(e,{x:a.left,y:a.top},{x:a.right,y:a.bottom},"zoom","drag"),n.dragging=!1,n.filterNextClick=!0,I(s,[{chart:e}])}function cm(e,t,n){if(bo(Rn(n.wheel),t)){I(n.onZoomRejected,[{chart:e,event:t}]);return}if(tc(e,t,n)!==!1&&(t.cancelable&&t.preventDefault(),t.deltaY!==void 0))return!0}function um(e,t){const{handlers:{onZoomComplete:n},options:{zoom:i}}=U(e);if(!cm(e,t,i))return;const s=t.target.getBoundingClientRect(),o=i.wheel.speed,r=t.deltaY>=0?2-1/(1-o):1+o,a={x:r,y:r,focalPoint:{x:t.clientX-s.left,y:t.clientY-s.top}};yo(e,a,"zoom","wheel"),I(n,[{chart:e}])}function hm(e,t,n,i){n&&(U(e).handlers[t]=Lg(()=>I(n,[{chart:e}]),i))}function fm(e,t){const n=e.canvas,{wheel:i,drag:s,onZoomComplete:o}=t.zoom;i.enabled?(En(e,n,"wheel",um),hm(e,"onZoomComplete",o,250)):at(e,"wheel"),s.enabled?(En(e,n,"mousedown",om),En(e,n.ownerDocument,"mouseup",lm)):(at(e,"mousedown"),at(e,"mousemove"),at(e,"mouseup"),at(e,"keydown"))}function dm(e){at(e,"mousedown"),at(e,"mousemove"),at(e,"mouseup"),at(e,"wheel"),at(e,"click"),at(e,"keydown")}function pm(e,t){return function(n,i){const{pan:s,zoom:o={}}=t.options;if(!s||!s.enabled)return!1;const r=i&&i.srcEvent;return r&&!t.panning&&i.pointerType==="mouse"&&(bo(Rn(s),r)||$l(Rn(o.drag),r))?(I(s.onPanRejected,[{chart:e,event:i}]),!1):!0}}function gm(e,t){const n=Math.abs(e.clientX-t.clientX),i=Math.abs(e.clientY-t.clientY),s=n/i;let o,r;return s>.3&&s<1.7?o=r=!0:n>i?o=!0:r=!0,{x:o,y:r}}function nc(e,t,n){if(t.scale){const{center:i,pointers:s}=n,o=1/t.scale*n.scale,r=n.target.getBoundingClientRect(),a=gm(s[0],s[1]),l=t.options.zoom.mode,c={x:a.x&&ue(l,"x",e)?o:1,y:a.y&&ue(l,"y",e)?o:1,focalPoint:{x:i.x-r.left,y:i.y-r.top}};yo(e,c,"zoom","pinch"),t.scale=n.scale}}function mm(e,t,n){if(t.options.zoom.pinch.enabled){const i=It(n,e);I(t.options.zoom.onZoomStart,[{chart:e,event:n,point:i}])===!1?(t.scale=null,I(t.options.zoom.onZoomRejected,[{chart:e,event:n}])):t.scale=1}}function bm(e,t,n){t.scale&&(nc(e,t,n),t.scale=null,I(t.options.zoom.onZoomComplete,[{chart:e}]))}function ic(e,t,n){const i=t.delta;i&&(t.panning=!0,Ql(e,{x:n.deltaX-i.x,y:n.deltaY-i.y},t.panScales),t.delta={x:n.deltaX,y:n.deltaY})}function ym(e,t,n){const{enabled:i,onPanStart:s,onPanRejected:o}=t.options.pan;if(!i)return;const r=n.target.getBoundingClientRect(),a={x:n.center.x-r.left,y:n.center.y-r.top};if(I(s,[{chart:e,event:n,point:a}])===!1)return I(o,[{chart:e,event:n}]);t.panScales=Yl(t.options.pan,a,e),t.delta={x:0,y:0},ic(e,t,n)}function xm(e,t){t.delta=null,t.panning&&(t.panning=!1,t.filterNextClick=!0,I(t.options.pan.onPanComplete,[{chart:e}]))}const Us=new WeakMap;function ga(e,t){const n=U(e),i=e.canvas,{pan:s,zoom:o}=t,r=new Mn.Manager(i);o&&o.pinch.enabled&&(r.add(new Mn.Pinch),r.on("pinchstart",a=>mm(e,n,a)),r.on("pinch",a=>nc(e,n,a)),r.on("pinchend",a=>bm(e,n,a))),s&&s.enabled&&(r.add(new Mn.Pan({threshold:s.threshold,enable:pm(e,n)})),r.on("panstart",a=>ym(e,n,a)),r.on("panmove",a=>ic(e,n,a)),r.on("panend",()=>xm(e,n))),Us.set(e,r)}function ma(e){const t=Us.get(e);t&&(t.remove("pinchstart"),t.remove("pinch"),t.remove("pinchend"),t.remove("panstart"),t.remove("pan"),t.remove("panend"),t.destroy(),Us.delete(e))}function vm(e,t){const{pan:n,zoom:i}=e,{pan:s,zoom:o}=t;return i?.zoom?.pinch?.enabled!==o?.zoom?.pinch?.enabled||n?.enabled!==s?.enabled||n?.threshold!==s?.threshold}var _m="2.2.0";function ci(e,t,n){const i=n.zoom.drag,{dragStart:s,dragEnd:o}=U(e);if(i.drawTime!==t||!o)return;const{left:r,top:a,width:l,height:c}=ec(e,n.zoom.mode,{dragStart:s,dragEnd:o},i.maintainAspectRatio),u=e.ctx;u.save(),u.beginPath(),u.fillStyle=i.backgroundColor||"rgba(225,225,225,0.3)",u.fillRect(r,a,l,c),i.borderWidth>0&&(u.lineWidth=i.borderWidth,u.strokeStyle=i.borderColor||"rgba(225,225,225)",u.strokeRect(r,a,l,c)),u.restore()}var wm={id:"zoom",version:_m,defaults:{pan:{enabled:!1,mode:"xy",threshold:10,modifierKey:null},zoom:{wheel:{enabled:!1,speed:.1,modifierKey:null},drag:{enabled:!1,drawTime:"beforeDatasetsDraw",modifierKey:null},pinch:{enabled:!1},mode:"xy"}},start:function(e,t,n){const i=U(e);i.options=n,Object.prototype.hasOwnProperty.call(n.zoom,"enabled")&&console.warn("The option \`zoom.enabled\` is no longer supported. Please use \`zoom.wheel.enabled\`, \`zoom.drag.enabled\`, or \`zoom.pinch.enabled\`."),(Object.prototype.hasOwnProperty.call(n.zoom,"overScaleMode")||Object.prototype.hasOwnProperty.call(n.pan,"overScaleMode"))&&console.warn("The option \`overScaleMode\` is deprecated. Please use \`scaleMode\` instead (and update \`mode\` as desired)."),Mn&&ga(e,n),e.pan=(s,o,r)=>Ql(e,s,o,r),e.zoom=(s,o)=>yo(e,s,o),e.zoomRect=(s,o,r)=>Zl(e,s,o,r),e.zoomScale=(s,o,r)=>Zg(e,s,o,r),e.resetZoom=s=>Qg(e,s),e.getZoomLevel=()=>tm(e),e.getInitialScaleBounds=()=>Jl(e),e.getZoomedScaleBounds=()=>em(e),e.isZoomedOrPanned=()=>nm(e),e.isZoomingOrPanning=()=>fa(e)},beforeEvent(e,{event:t}){if(fa(e))return!1;if(t.type==="click"||t.type==="mouseup"){const n=U(e);if(n.filterNextClick)return n.filterNextClick=!1,!1}},beforeUpdate:function(e,t,n){const i=U(e),s=i.options;i.options=n,vm(s,n)&&(ma(e),ga(e,n)),fm(e,n)},beforeDatasetsDraw(e,t,n){ci(e,"beforeDatasetsDraw",n)},afterDatasetsDraw(e,t,n){ci(e,"afterDatasetsDraw",n)},beforeDraw(e,t,n){ci(e,"beforeDraw",n)},afterDraw(e,t,n){ci(e,"afterDraw",n)},stop:function(e){dm(e),Mn&&ma(e),Ng(e)},panFunctions:Ws,zoomFunctions:Bs,zoomRectFunctions:Vs};function Sm({data:e,...t}){const n=Ge(null),i=Ge(null);return ut(()=>{zs.register(wm,Eg,Bd,kg,rg,og,fg,vg);const s=i.current,o=n.current=new zs(s,{type:"line",data:e.peek(),options:{scales:{y:{min:0}},animation:!1,responsive:!0,plugins:{zoom:{pan:{enabled:!0,mode:"x"},zoom:{wheel:{enabled:!0},mode:"x"}},legend:{position:"top"},title:{display:!1}}}}),r=e.subscribe(a=>{o.data=a,o.update()});return()=>{o.destroy(),r()}},[]),m("canvas",{ref:i,...t})}function km(){const e=fe();ut(()=>{const n=i=>{Pn(i)||e()};return $?.on("mount",n),$?.on("unmount",n),()=>{$?.off("mount",n),$?.off("unmount",n)}},[]);const t=$?.profilingContext;return m("div",{className:"flex flex-col gap-2"},Ga(t.appStats).filter(([n])=>!Pn(n)).map(([n])=>m(Tm,{key:n.id,app:n})))}const ba=100,ya=e=>Object.entries(e).map(([t,{values:n,color:i}])=>({label:t,data:n,fill:!1,borderColor:i,tension:.1}));function Tm({app:e}){const t=fe(),n=Ge({update:{values:[0],color:"#ad981f"},updateDirtied:{values:[0],color:"#b21f3a"},createNode:{values:[0],color:"#198019"},removeNode:{values:[0],color:"#5F3691"},updateNode:{values:[0],color:"#2f2f9d"},signalAttrUpdate:{values:[0],color:"#28888f"},signalTextUpdate:{values:[0],color:"#9b3b98"}}),i=J({labels:[(performance.now()/1e3).toFixed(2)],datasets:ya(n.current)}),s=J(!1),o=$?.profilingContext;return ut(()=>{const r=a=>{a.id===e.id&&t()};return $?.on("update",r),()=>$?.off("update",r)},[]),ut(()=>{const r=[];Object.entries(n.current).forEach(([l,{values:c}])=>{const u=p=>{p.id===e.id&&s.peek()!==!0&&c[c.length-1]++},f=l;o.addEventListener(f,u),r.push(()=>o.removeEventListener(f,u))});const a=setInterval(()=>{if(s.peek()===!0)return;const l=[...i.value.labels];Object.values(n.current).forEach(c=>{c.values.push(0),c.values.length>ba&&c.values.shift()}),l.push((performance.now()/1e3).toFixed(2)),l.length>ba&&l.shift(),i.value={labels:l,datasets:ya(n.current)}},100);return()=>{r.forEach(l=>l()),clearInterval(a)}},[]),m("div",{className:"flex flex-col gap-2 border border-white border-opacity-10 rounded bg-neutral-400 bg-opacity-5 text-neutral-400 p-2"},m("div",{className:"grid items-start gap-2",style:"grid-template-columns: 1fr max-content;"},m("div",{className:"flex flex-col gap-2"},m("span",null,e.name),m(Sm,{data:i,className:"w-full max-w-full min-h-20 bg-black bg-opacity-30",onmouseenter:()=>s.value=!0,onmouseleave:()=>s.value=!1})),m("div",{className:"text-xs grid grid-cols-2 gap-x-4",style:"grid-template-columns: auto auto;"},m("span",{className:"text-right"},"Mount duration:"),o.mountDuration(e).toFixed(2)," ms",m("span",{className:"text-right"},"Total updates:"),m("span",null,o.totalTicks(e).toLocaleString()),m("span",{className:"text-right"},"Avg. update duration:"),o.averageTickDuration(e).toFixed(2)," ms",m("span",{className:"text-right"},"Latest update:"),m("span",null,o.lastTickDuration(e).toFixed(2)," ms"))))}const bn=ht([]),sc=ht(""),Mm=Xa(()=>sc.value.toLowerCase().split(" ").filter(e=>e.length>0));function Em(e){return Mm.value.every(t=>e.toLowerCase().includes(t))}function Cm(){const e=fe();ut(()=>{const n=i=>{Pn(i)||e()};return $?.on("update",n),()=>$?.off("update",n)},[]);const t=$?.SWRGlobalCache??new Map;return t.size===0?m("div",{className:"flex flex-col items-center justify-center h-full text-neutral-400"},m(Ka,null),m("h2",{className:"text-lg italic"},"No SWR detected")):m("div",{className:"flex flex-col gap-2 items-start"},m(il,{value:sc,className:"sticky top-0"}),m("div",{className:"flex flex-col gap-2 w-full"},Ga(t).filter(([n])=>Em(n)).map(([n,i])=>m(Om,{key:n,entry:i}))))}function Om({key:e,entry:t}){const n=bn.value.includes(e),i=fe();ut(()=>{const{resource:o,isValidating:r,isMutating:a}=t,l=[o.subscribe(i),r.subscribe(i),a.subscribe(i)];return()=>l.forEach(c=>c())},[]);const s=We(()=>{n?bn.value=bn.value.filter(o=>o!==e):bn.value=[...bn.value,e]},[n]);return m("div",{className:"flex flex-col"},m("button",{onclick:s,className:"flex items-center gap-2 justify-between p-2 border border-white border-opacity-10 cursor-pointer"+(n?" bg-white bg-opacity-5 text-neutral-100 rounded-t":" hover:bg-white hover:bg-opacity-10 text-neutral-400 rounded")},e,m(ae,{className:"transition-all"+(n?" rotate-90":"")})),n&&m("div",{className:"flex flex-col gap-2 p-2 border border-white border-opacity-10"},m(Ie,{data:{resource:t.resource.peek(),isMutating:t.isMutating.peek(),isValidating:t.isValidating.peek()},mutable:!1,objectRefAcc:[],keys:[],onChange:()=>{}})))}const Pm=e=>m("main",{className:"flex flex-col flex-1 max-h-[calc(100vh-1rem)] overflow-y-auto",style:e.active?{}:{display:"none"}},e.children),$s={Apps:{Icon:Wu,View:_h},Stores:{Icon:qu,View:kh},SWR:{Icon:Yu,View:Cm},Profiling:{Icon:$u,View:km},Settings:{Icon:ju,View:Ku}},Ci=ht("Apps");let xa=se.peek();se.subscribe(e=>{e!==xa&&e!==null&&(Ci.value="Apps"),xa=e});function Dm(){return m(Gu,null,m("nav",{className:"flex flex-col gap-2 justify-between p-2 bg-neutral-400 bg-opacity-5 border border-white border-opacity-10 rounded"},m("div",{className:"flex flex-col gap-2"},Object.keys($s).map(e=>m(Am,{key:e,title:e})))),Object.entries($s).map(([e,{View:t}])=>m(Pm,{key:e,active:Ci.value===e},m(t,null))))}function Am({title:e}){const{Icon:t}=$s[e];return m("button",{key:e,onclick:()=>{Ci.value=e},className:"flex items-center px-2 py-1 gap-2 rounded border text-xs border-white border-opacity-10"+(Ci.value===e?" bg-white bg-opacity-5 text-neutral-100":" hover:bg-white hover:bg-opacity-10 text-neutral-400"),title:e},m(t,{className:"text-primary"}),m("span",{className:"hidden sm:inline"},e))}zu(m(Dm,null),document.getElementById("app"));Ke.send({type:"ready"});setInterval(()=>{window.opener||window.close()},250);</script>
|
|
1754
|
+
*/const Rn=e=>e&&e.enabled&&e.modifierKey,Yl=(e,t)=>e&&t[e+"Key"],bo=(e,t)=>e&&!t[e+"Key"];function ue(e,t,n){return e===void 0?!0:typeof e=="string"?e.indexOf(t)!==-1:typeof e=="function"?e({chart:n}).indexOf(t)!==-1:!1}function rs(e,t){return typeof e=="function"&&(e=e({chart:t})),typeof e=="string"?{x:e.indexOf("x")!==-1,y:e.indexOf("y")!==-1}:{x:!1,y:!1}}function Rg(e,t){let n;return function(){return clearTimeout(n),n=setTimeout(e,t),t}}function Ng({x:e,y:t},n){const i=n.scales,s=Object.keys(i);for(let o=0;o<s.length;o++){const r=i[s[o]];if(t>=r.top&&t<=r.bottom&&e>=r.left&&e<=r.right)return r}return null}function Xl(e,t,n){const{mode:i="xy",scaleMode:s,overScaleMode:o}=e||{},r=Ng(t,n),a=rs(i,n),l=rs(s,n);if(o){const u=rs(o,n);for(const f of["x","y"])u[f]&&(l[f]=a[f],a[f]=!1)}if(r&&l[r.axis])return[r];const c=[];return z(n.scales,function(u){a[u.axis]&&c.push(u)}),c}const Hs=new WeakMap;function U(e){let t=Hs.get(e);return t||(t={originalScaleLimits:{},updatedScaleLimits:{},handlers:{},panDelta:{},dragging:!1,panning:!1},Hs.set(e,t)),t}function zg(e){Hs.delete(e)}function ql(e,t,n,i){const s=Math.max(0,Math.min(1,(e-t)/n||0)),o=1-s;return{min:i*s,max:i*o}}function Gl(e,t){const n=e.isHorizontal()?t.x:t.y;return e.getValueForPixel(n)}function Kl(e,t,n){const i=e.max-e.min,s=i*(t-1),o=Gl(e,n);return ql(o,e.min,i,s)}function Fg(e,t,n){const i=Gl(e,n);if(i===void 0)return{min:e.min,max:e.max};const s=Math.log10(e.min),o=Math.log10(e.max),r=Math.log10(i),a=o-s,l=a*(t-1),c=ql(r,s,a,l);return{min:Math.pow(10,s+c.min),max:Math.pow(10,o-c.max)}}function Hg(e,t){return t&&(t[e.id]||t[e.axis])||{}}function ra(e,t,n,i,s){let o=n[i];if(o==="original"){const r=e.originalScaleLimits[t.id][i];o=R(r.options,r.scale)}return R(o,s)}function Bg(e,t,n){const i=e.getValueForPixel(t),s=e.getValueForPixel(n);return{min:Math.min(i,s),max:Math.max(i,s)}}function Vg(e,{min:t,max:n,minLimit:i,maxLimit:s},o){const r=(e-n+t)/2;t-=r,n+=r;const a=o.min.options??o.min.scale,l=o.max.options??o.max.scale,c=e/1e6;return Ce(t,a,c)&&(t=a),Ce(n,l,c)&&(n=l),t<i?(t=i,n=Math.min(i+e,s)):n>s&&(n=s,t=Math.max(s-e,i)),{min:t,max:n}}function Re(e,{min:t,max:n},i,s=!1){const o=U(e.chart),{options:r}=e,a=Hg(e,i),{minRange:l=0}=a,c=ra(o,e,a,"min",-1/0),u=ra(o,e,a,"max",1/0);if(s==="pan"&&(t<c||n>u))return!0;const f=e.max-e.min,p=s?Math.max(n-t,l):f;if(s&&p===l&&f<=l)return!0;const g=Vg(p,{min:t,max:n,minLimit:c,maxLimit:u},o.originalScaleLimits[e.id]);return r.min=g.min,r.max=g.max,o.updatedScaleLimits[e.id]=g,e.parse(g.min)!==e.min||e.parse(g.max)!==e.max}function Wg(e,t,n,i){const s=Kl(e,t,n),o={min:e.min+s.min,max:e.max-s.max};return Re(e,o,i,!0)}function jg(e,t,n,i){const s=Fg(e,t,n);return Re(e,s,i,!0)}function Ug(e,t,n,i){Re(e,Bg(e,t,n),i,!0)}const aa=e=>e===0||isNaN(e)?0:e<0?Math.min(Math.round(e),-1):Math.max(Math.round(e),1);function $g(e){const n=e.getLabels().length-1;e.min>0&&(e.min-=1),e.max<n&&(e.max+=1)}function Yg(e,t,n,i){const s=Kl(e,t,n);e.min===e.max&&t<1&&$g(e);const o={min:e.min+aa(s.min),max:e.max-aa(s.max)};return Re(e,o,i,!0)}function Xg(e){return e.isHorizontal()?e.width:e.height}function qg(e,t,n){const s=e.getLabels().length-1;let{min:o,max:r}=e;const a=Math.max(r-o,1),l=Math.round(Xg(e)/Math.max(a,10)),c=Math.round(Math.abs(t/l));let u;return t<-l?(r=Math.min(r+c,s),o=a===1?r:r-a,u=r===s):t>l&&(o=Math.max(0,o-c),r=a===1?o:o+a,u=o===0),Re(e,{min:o,max:r},n)||u}const Gg={second:500,minute:30*1e3,hour:1800*1e3,day:720*60*1e3,week:3.5*24*60*60*1e3,month:360*60*60*1e3,quarter:1440*60*60*1e3,year:4368*60*60*1e3};function Zl(e,t,n,i=!1){const{min:s,max:o,options:r}=e,a=r.time&&r.time.round,l=Gg[a]||0,c=e.getValueForPixel(e.getPixelForValue(s+l)-t),u=e.getValueForPixel(e.getPixelForValue(o+l)-t);return isNaN(c)||isNaN(u)?!0:Re(e,{min:c,max:u},n,i?"pan":!1)}function la(e,t,n){return Zl(e,t,n,!0)}const Bs={category:Yg,default:Wg,logarithmic:jg},Vs={default:Ug},Ws={category:qg,default:Zl,logarithmic:la,timeseries:la};function Kg(e,t,n){const{id:i,options:{min:s,max:o}}=e;if(!t[i]||!n[i])return!0;const r=n[i];return r.min!==s||r.max!==o}function ca(e,t){z(e,(n,i)=>{t[i]||delete e[i]})}function sn(e,t){const{scales:n}=e,{originalScaleLimits:i,updatedScaleLimits:s}=t;return z(n,function(o){Kg(o,i,s)&&(i[o.id]={min:{scale:o.min,options:o.options.min},max:{scale:o.max,options:o.options.max}})}),ca(i,n),ca(s,n),i}function ua(e,t,n,i){const s=Bs[e.type]||Bs.default;I(s,[e,t,n,i])}function ha(e,t,n,i){const s=Vs[e.type]||Vs.default;I(s,[e,t,n,i])}function Zg(e){const t=e.chartArea;return{x:(t.left+t.right)/2,y:(t.top+t.bottom)/2}}function yo(e,t,n="none",i="api"){const{x:s=1,y:o=1,focalPoint:r=Zg(e)}=typeof t=="number"?{x:t,y:t}:t,a=U(e),{options:{limits:l,zoom:c}}=a;sn(e,a);const u=s!==1,f=o!==1,p=Xl(c,r,e);z(p||e.scales,function(g){g.isHorizontal()&&u?ua(g,s,r,l):!g.isHorizontal()&&f&&ua(g,o,r,l)}),e.update(n),I(c.onZoom,[{chart:e,trigger:i}])}function Ql(e,t,n,i="none",s="api"){const o=U(e),{options:{limits:r,zoom:a}}=o,{mode:l="xy"}=a;sn(e,o);const c=ue(l,"x",e),u=ue(l,"y",e);z(e.scales,function(f){f.isHorizontal()&&c?ha(f,t.x,n.x,r):!f.isHorizontal()&&u&&ha(f,t.y,n.y,r)}),e.update(i),I(a.onZoom,[{chart:e,trigger:s}])}function Qg(e,t,n,i="none",s="api"){const o=U(e);sn(e,o);const r=e.scales[t];Re(r,n,void 0,!0),e.update(i),I(o.options.zoom?.onZoom,[{chart:e,trigger:s}])}function Jg(e,t="default"){const n=U(e),i=sn(e,n);z(e.scales,function(s){const o=s.options;i[s.id]?(o.min=i[s.id].min.options,o.max=i[s.id].max.options):(delete o.min,delete o.max),delete n.updatedScaleLimits[s.id]}),e.update(t),I(n.options.zoom.onZoomComplete,[{chart:e}])}function tm(e,t){const n=e.originalScaleLimits[t];if(!n)return;const{min:i,max:s}=n;return R(s.options,s.scale)-R(i.options,i.scale)}function em(e){const t=U(e);let n=1,i=1;return z(e.scales,function(s){const o=tm(t,s.id);if(o){const r=Math.round(o/(s.max-s.min)*100)/100;n=Math.min(n,r),i=Math.max(i,r)}}),n<1?n:i}function fa(e,t,n,i){const{panDelta:s}=i,o=s[e.id]||0;ce(o)===ce(t)&&(t+=o);const r=Ws[e.type]||Ws.default;I(r,[e,t,n])?s[e.id]=0:s[e.id]=t}function Jl(e,t,n,i="none"){const{x:s=0,y:o=0}=typeof t=="number"?{x:t,y:t}:t,r=U(e),{options:{pan:a,limits:l}}=r,{onPan:c}=a||{};sn(e,r);const u=s!==0,f=o!==0;z(n||e.scales,function(p){p.isHorizontal()&&u?fa(p,s,l,r):!p.isHorizontal()&&f&&fa(p,o,l,r)}),e.update(i),I(c,[{chart:e}])}function tc(e){const t=U(e);sn(e,t);const n={};for(const i of Object.keys(e.scales)){const{min:s,max:o}=t.originalScaleLimits[i]||{min:{},max:{}};n[i]={min:s.scale,max:o.scale}}return n}function nm(e){const t=U(e),n={};for(const i of Object.keys(e.scales))n[i]=t.updatedScaleLimits[i];return n}function im(e){const t=tc(e);for(const n of Object.keys(e.scales)){const{min:i,max:s}=t[n];if(i!==void 0&&e.scales[n].min!==i||s!==void 0&&e.scales[n].max!==s)return!0}return!1}function da(e){const t=U(e);return t.panning||t.dragging}const pa=(e,t,n)=>Math.min(n,Math.max(t,e));function at(e,t){const{handlers:n}=U(e),i=n[t];i&&i.target&&(i.target.removeEventListener(t,i),delete n[t])}function En(e,t,n,i){const{handlers:s,options:o}=U(e),r=s[n];if(r&&r.target===t)return;at(e,n),s[n]=l=>i(e,l,o),s[n].target=t;const a=n==="wheel"?!1:void 0;t.addEventListener(n,s[n],{passive:a})}function sm(e,t){const n=U(e);n.dragStart&&(n.dragging=!0,n.dragEnd=t,e.update("none"))}function om(e,t){const n=U(e);!n.dragStart||t.key!=="Escape"||(at(e,"keydown"),n.dragging=!1,n.dragStart=n.dragEnd=null,e.update("none"))}function js(e,t){if(e.target!==t.canvas){const n=t.canvas.getBoundingClientRect();return{x:e.clientX-n.left,y:e.clientY-n.top}}return It(e,t)}function ec(e,t,n){const{onZoomStart:i,onZoomRejected:s}=n;if(i){const o=js(t,e);if(I(i,[{chart:e,event:t,point:o}])===!1)return I(s,[{chart:e,event:t}]),!1}}function rm(e,t){if(e.legend){const o=It(t,e);if(Ze(o,e.legend))return}const n=U(e),{pan:i,zoom:s={}}=n.options;if(t.button!==0||Yl(Rn(i),t)||bo(Rn(s.drag),t))return I(s.onZoomRejected,[{chart:e,event:t}]);ec(e,t,s)!==!1&&(n.dragStart=t,En(e,e.canvas.ownerDocument,"mousemove",sm),En(e,window.document,"keydown",om))}function am({begin:e,end:t},n){let i=t.x-e.x,s=t.y-e.y;const o=Math.abs(i/s);o>n?i=Math.sign(i)*Math.abs(s*n):o<n&&(s=Math.sign(s)*Math.abs(i/n)),t.x=e.x+i,t.y=e.y+s}function ga(e,t,n,{min:i,max:s,prop:o}){e[i]=pa(Math.min(n.begin[o],n.end[o]),t[i],t[s]),e[s]=pa(Math.max(n.begin[o],n.end[o]),t[i],t[s])}function lm(e,t,n){const i={begin:js(t.dragStart,e),end:js(t.dragEnd,e)};if(n){const s=e.chartArea.width/e.chartArea.height;am(i,s)}return i}function nc(e,t,n,i){const s=ue(t,"x",e),o=ue(t,"y",e),{top:r,left:a,right:l,bottom:c,width:u,height:f}=e.chartArea,p={top:r,left:a,right:l,bottom:c},g=lm(e,n,i&&s&&o);s&&ga(p,e.chartArea,g,{min:"left",max:"right",prop:"x"}),o&&ga(p,e.chartArea,g,{min:"top",max:"bottom",prop:"y"});const x=p.right-p.left,y=p.bottom-p.top;return{...p,width:x,height:y,zoomX:s&&x?1+(u-x)/u:1,zoomY:o&&y?1+(f-y)/f:1}}function cm(e,t){const n=U(e);if(!n.dragStart)return;at(e,"mousemove");const{mode:i,onZoomComplete:s,drag:{threshold:o=0,maintainAspectRatio:r}}=n.options.zoom,a=nc(e,i,{dragStart:n.dragStart,dragEnd:t},r),l=ue(i,"x",e)?a.width:0,c=ue(i,"y",e)?a.height:0,u=Math.sqrt(l*l+c*c);if(n.dragStart=n.dragEnd=null,u<=o){n.dragging=!1,e.update("none");return}Ql(e,{x:a.left,y:a.top},{x:a.right,y:a.bottom},"zoom","drag"),n.dragging=!1,n.filterNextClick=!0,I(s,[{chart:e}])}function um(e,t,n){if(bo(Rn(n.wheel),t)){I(n.onZoomRejected,[{chart:e,event:t}]);return}if(ec(e,t,n)!==!1&&(t.cancelable&&t.preventDefault(),t.deltaY!==void 0))return!0}function hm(e,t){const{handlers:{onZoomComplete:n},options:{zoom:i}}=U(e);if(!um(e,t,i))return;const s=t.target.getBoundingClientRect(),o=i.wheel.speed,r=t.deltaY>=0?2-1/(1-o):1+o,a={x:r,y:r,focalPoint:{x:t.clientX-s.left,y:t.clientY-s.top}};yo(e,a,"zoom","wheel"),I(n,[{chart:e}])}function fm(e,t,n,i){n&&(U(e).handlers[t]=Rg(()=>I(n,[{chart:e}]),i))}function dm(e,t){const n=e.canvas,{wheel:i,drag:s,onZoomComplete:o}=t.zoom;i.enabled?(En(e,n,"wheel",hm),fm(e,"onZoomComplete",o,250)):at(e,"wheel"),s.enabled?(En(e,n,"mousedown",rm),En(e,n.ownerDocument,"mouseup",cm)):(at(e,"mousedown"),at(e,"mousemove"),at(e,"mouseup"),at(e,"keydown"))}function pm(e){at(e,"mousedown"),at(e,"mousemove"),at(e,"mouseup"),at(e,"wheel"),at(e,"click"),at(e,"keydown")}function gm(e,t){return function(n,i){const{pan:s,zoom:o={}}=t.options;if(!s||!s.enabled)return!1;const r=i&&i.srcEvent;return r&&!t.panning&&i.pointerType==="mouse"&&(bo(Rn(s),r)||Yl(Rn(o.drag),r))?(I(s.onPanRejected,[{chart:e,event:i}]),!1):!0}}function mm(e,t){const n=Math.abs(e.clientX-t.clientX),i=Math.abs(e.clientY-t.clientY),s=n/i;let o,r;return s>.3&&s<1.7?o=r=!0:n>i?o=!0:r=!0,{x:o,y:r}}function ic(e,t,n){if(t.scale){const{center:i,pointers:s}=n,o=1/t.scale*n.scale,r=n.target.getBoundingClientRect(),a=mm(s[0],s[1]),l=t.options.zoom.mode,c={x:a.x&&ue(l,"x",e)?o:1,y:a.y&&ue(l,"y",e)?o:1,focalPoint:{x:i.x-r.left,y:i.y-r.top}};yo(e,c,"zoom","pinch"),t.scale=n.scale}}function bm(e,t,n){if(t.options.zoom.pinch.enabled){const i=It(n,e);I(t.options.zoom.onZoomStart,[{chart:e,event:n,point:i}])===!1?(t.scale=null,I(t.options.zoom.onZoomRejected,[{chart:e,event:n}])):t.scale=1}}function ym(e,t,n){t.scale&&(ic(e,t,n),t.scale=null,I(t.options.zoom.onZoomComplete,[{chart:e}]))}function sc(e,t,n){const i=t.delta;i&&(t.panning=!0,Jl(e,{x:n.deltaX-i.x,y:n.deltaY-i.y},t.panScales),t.delta={x:n.deltaX,y:n.deltaY})}function xm(e,t,n){const{enabled:i,onPanStart:s,onPanRejected:o}=t.options.pan;if(!i)return;const r=n.target.getBoundingClientRect(),a={x:n.center.x-r.left,y:n.center.y-r.top};if(I(s,[{chart:e,event:n,point:a}])===!1)return I(o,[{chart:e,event:n}]);t.panScales=Xl(t.options.pan,a,e),t.delta={x:0,y:0},sc(e,t,n)}function vm(e,t){t.delta=null,t.panning&&(t.panning=!1,t.filterNextClick=!0,I(t.options.pan.onPanComplete,[{chart:e}]))}const Us=new WeakMap;function ma(e,t){const n=U(e),i=e.canvas,{pan:s,zoom:o}=t,r=new Mn.Manager(i);o&&o.pinch.enabled&&(r.add(new Mn.Pinch),r.on("pinchstart",a=>bm(e,n,a)),r.on("pinch",a=>ic(e,n,a)),r.on("pinchend",a=>ym(e,n,a))),s&&s.enabled&&(r.add(new Mn.Pan({threshold:s.threshold,enable:gm(e,n)})),r.on("panstart",a=>xm(e,n,a)),r.on("panmove",a=>sc(e,n,a)),r.on("panend",()=>vm(e,n))),Us.set(e,r)}function ba(e){const t=Us.get(e);t&&(t.remove("pinchstart"),t.remove("pinch"),t.remove("pinchend"),t.remove("panstart"),t.remove("pan"),t.remove("panend"),t.destroy(),Us.delete(e))}function _m(e,t){const{pan:n,zoom:i}=e,{pan:s,zoom:o}=t;return i?.zoom?.pinch?.enabled!==o?.zoom?.pinch?.enabled||n?.enabled!==s?.enabled||n?.threshold!==s?.threshold}var wm="2.2.0";function ci(e,t,n){const i=n.zoom.drag,{dragStart:s,dragEnd:o}=U(e);if(i.drawTime!==t||!o)return;const{left:r,top:a,width:l,height:c}=nc(e,n.zoom.mode,{dragStart:s,dragEnd:o},i.maintainAspectRatio),u=e.ctx;u.save(),u.beginPath(),u.fillStyle=i.backgroundColor||"rgba(225,225,225,0.3)",u.fillRect(r,a,l,c),i.borderWidth>0&&(u.lineWidth=i.borderWidth,u.strokeStyle=i.borderColor||"rgba(225,225,225)",u.strokeRect(r,a,l,c)),u.restore()}var Sm={id:"zoom",version:wm,defaults:{pan:{enabled:!1,mode:"xy",threshold:10,modifierKey:null},zoom:{wheel:{enabled:!1,speed:.1,modifierKey:null},drag:{enabled:!1,drawTime:"beforeDatasetsDraw",modifierKey:null},pinch:{enabled:!1},mode:"xy"}},start:function(e,t,n){const i=U(e);i.options=n,Object.prototype.hasOwnProperty.call(n.zoom,"enabled")&&console.warn("The option \`zoom.enabled\` is no longer supported. Please use \`zoom.wheel.enabled\`, \`zoom.drag.enabled\`, or \`zoom.pinch.enabled\`."),(Object.prototype.hasOwnProperty.call(n.zoom,"overScaleMode")||Object.prototype.hasOwnProperty.call(n.pan,"overScaleMode"))&&console.warn("The option \`overScaleMode\` is deprecated. Please use \`scaleMode\` instead (and update \`mode\` as desired)."),Mn&&ma(e,n),e.pan=(s,o,r)=>Jl(e,s,o,r),e.zoom=(s,o)=>yo(e,s,o),e.zoomRect=(s,o,r)=>Ql(e,s,o,r),e.zoomScale=(s,o,r)=>Qg(e,s,o,r),e.resetZoom=s=>Jg(e,s),e.getZoomLevel=()=>em(e),e.getInitialScaleBounds=()=>tc(e),e.getZoomedScaleBounds=()=>nm(e),e.isZoomedOrPanned=()=>im(e),e.isZoomingOrPanning=()=>da(e)},beforeEvent(e,{event:t}){if(da(e))return!1;if(t.type==="click"||t.type==="mouseup"){const n=U(e);if(n.filterNextClick)return n.filterNextClick=!1,!1}},beforeUpdate:function(e,t,n){const i=U(e),s=i.options;i.options=n,_m(s,n)&&(ba(e),ma(e,n)),dm(e,n)},beforeDatasetsDraw(e,t,n){ci(e,"beforeDatasetsDraw",n)},afterDatasetsDraw(e,t,n){ci(e,"afterDatasetsDraw",n)},beforeDraw(e,t,n){ci(e,"beforeDraw",n)},afterDraw(e,t,n){ci(e,"afterDraw",n)},stop:function(e){pm(e),Mn&&ba(e),zg(e)},panFunctions:Ws,zoomFunctions:Bs,zoomRectFunctions:Vs};function km({data:e,...t}){const n=Ge(null),i=Ge(null);return ut(()=>{zs.register(Sm,Og,Vd,Tg,ag,rg,dg,_g);const s=i.current,o=n.current=new zs(s,{type:"line",data:e.peek(),options:{scales:{y:{min:0}},animation:!1,responsive:!0,plugins:{zoom:{pan:{enabled:!0,mode:"x"},zoom:{wheel:{enabled:!0},mode:"x"}},legend:{position:"top"},title:{display:!1}}}}),r=e.subscribe(a=>{o.data=a,o.update()});return()=>{o.destroy(),r()}},[]),m("canvas",{ref:i,...t})}function Tm(){const e=fe();ut(()=>{const n=i=>{Pn(i)||e()};return $?.on("mount",n),$?.on("unmount",n),()=>{$?.off("mount",n),$?.off("unmount",n)}},[]);const t=$?.profilingContext;return m("div",{className:"flex flex-col gap-2"},Ka(t.appStats).filter(([n])=>!Pn(n)).map(([n])=>m(Mm,{key:n.id,app:n})))}const ya=100,xa=e=>Object.entries(e).map(([t,{values:n,color:i}])=>({label:t,data:n,fill:!1,borderColor:i,tension:.1}));function Mm({app:e}){const t=fe(),n=Ge({update:{values:[0],color:"#ad981f"},updateDirtied:{values:[0],color:"#b21f3a"},createNode:{values:[0],color:"#198019"},removeNode:{values:[0],color:"#5F3691"},updateNode:{values:[0],color:"#2f2f9d"},signalAttrUpdate:{values:[0],color:"#28888f"},signalTextUpdate:{values:[0],color:"#9b3b98"}}),i=J({labels:[(performance.now()/1e3).toFixed(2)],datasets:xa(n.current)}),s=J(!1),o=$?.profilingContext;return ut(()=>{const r=a=>{a.id===e.id&&t()};return $?.on("update",r),()=>$?.off("update",r)},[]),ut(()=>{const r=[];Object.entries(n.current).forEach(([l,{values:c}])=>{const u=p=>{p.id===e.id&&s.peek()!==!0&&c[c.length-1]++},f=l;o.addEventListener(f,u),r.push(()=>o.removeEventListener(f,u))});const a=setInterval(()=>{if(s.peek()===!0)return;const l=[...i.value.labels];Object.values(n.current).forEach(c=>{c.values.push(0),c.values.length>ya&&c.values.shift()}),l.push((performance.now()/1e3).toFixed(2)),l.length>ya&&l.shift(),i.value={labels:l,datasets:xa(n.current)}},100);return()=>{r.forEach(l=>l()),clearInterval(a)}},[]),m("div",{className:"flex flex-col gap-2 border border-white border-opacity-10 rounded bg-neutral-400 bg-opacity-5 text-neutral-400 p-2"},m("div",{className:"grid items-start gap-2",style:"grid-template-columns: 1fr max-content;"},m("div",{className:"flex flex-col gap-2"},m("span",null,e.name),m(km,{data:i,className:"w-full max-w-full min-h-20 bg-black bg-opacity-30",onmouseenter:()=>s.value=!0,onmouseleave:()=>s.value=!1})),m("div",{className:"text-xs grid grid-cols-2 gap-x-4",style:"grid-template-columns: auto auto;"},m("span",{className:"text-right"},"Mount duration:"),o.mountDuration(e).toFixed(2)," ms",m("span",{className:"text-right"},"Total updates:"),m("span",null,o.totalTicks(e).toLocaleString()),m("span",{className:"text-right"},"Avg. update duration:"),o.averageTickDuration(e).toFixed(2)," ms",m("span",{className:"text-right"},"Latest update:"),m("span",null,o.lastTickDuration(e).toFixed(2)," ms"))))}const bn=ht([]),oc=ht(""),Em=qa(()=>oc.value.toLowerCase().split(" ").filter(e=>e.length>0));function Om(e){return Em.value.every(t=>e.toLowerCase().includes(t))}function Cm(){const e=fe();ut(()=>{const n=i=>{Pn(i)||e()};return $?.on("update",n),()=>$?.off("update",n)},[]);const t=$?.SWRGlobalCache??new Map;return t.size===0?m("div",{className:"flex flex-col items-center justify-center h-full text-neutral-400"},m(Za,null),m("h2",{className:"text-lg italic"},"No SWR detected")):m("div",{className:"flex flex-col gap-2 items-start"},m(sl,{value:oc,className:"sticky top-0"}),m("div",{className:"flex flex-col gap-2 w-full"},Ka(t).filter(([n])=>Om(n)).map(([n,i])=>m(Pm,{key:n,entry:i}))))}function Pm({key:e,entry:t}){const n=bn.value.includes(e),i=fe();ut(()=>{const{resource:o,isValidating:r,isMutating:a}=t,l=[o.subscribe(i),r.subscribe(i),a.subscribe(i)];return()=>l.forEach(c=>c())},[]);const s=We(()=>{n?bn.value=bn.value.filter(o=>o!==e):bn.value=[...bn.value,e]},[n]);return m("div",{className:"flex flex-col"},m("button",{onclick:s,className:"flex items-center gap-2 justify-between p-2 border border-white border-opacity-10 cursor-pointer"+(n?" bg-white bg-opacity-5 text-neutral-100 rounded-t":" hover:bg-white hover:bg-opacity-10 text-neutral-400 rounded")},e,m(ae,{className:"transition-all"+(n?" rotate-90":"")})),n&&m("div",{className:"flex flex-col gap-2 p-2 border border-white border-opacity-10"},m(Ie,{data:{resource:t.resource.peek(),isMutating:t.isMutating.peek(),isValidating:t.isValidating.peek()},mutable:!1,objectRefAcc:[],keys:[],onChange:()=>{}})))}const Dm=e=>m("main",{className:"flex flex-col flex-1 max-h-[calc(100vh-1rem)] overflow-y-auto",style:e.active?{}:{display:"none"}},e.children),$s={Apps:{Icon:ju,View:wh},Stores:{Icon:Gu,View:Th},SWR:{Icon:Xu,View:Cm},Profiling:{Icon:Yu,View:Tm},Settings:{Icon:Uu,View:Zu}},Oi=ht("Apps");let va=se.peek();se.subscribe(e=>{e!==va&&e!==null&&(Oi.value="Apps"),va=e});function Am(){return m(Ku,null,m("nav",{className:"flex flex-col gap-2 justify-between p-2 bg-neutral-400 bg-opacity-5 border border-white border-opacity-10 rounded"},m("div",{className:"flex flex-col gap-2"},Object.keys($s).map(e=>m(Im,{key:e,title:e})))),Object.entries($s).map(([e,{View:t}])=>m(Dm,{key:e,active:Oi.value===e},m(t,null))))}function Im({title:e}){const{Icon:t}=$s[e];return m("button",{key:e,onclick:()=>{Oi.value=e},className:"flex items-center px-2 py-1 gap-2 rounded border text-xs border-white border-opacity-10"+(Oi.value===e?" bg-white bg-opacity-5 text-neutral-100":" hover:bg-white hover:bg-opacity-10 text-neutral-400"),title:e},m(t,{className:"text-primary"}),m("span",{className:"hidden sm:inline"},e))}Fu(m(Am,null),document.getElementById("app"));Ke.send({type:"ready"});setInterval(()=>{window.opener||window.close()},250);</script>
|
|
1755
1755
|
<style rel="stylesheet" crossorigin>*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}.absolute{position:absolute}.relative{position:relative}.sticky{position:sticky}.top-0{top:0}.z-10{z-index:10}.z-\\[9999\\]{z-index:9999}.mb-1{margin-bottom:.25rem}.mb-2{margin-bottom:.5rem}.ml-6{margin-left:1.5rem}.flex{display:flex}.grid{display:grid}.hidden{display:none}.h-5{height:1.25rem}.h-full{height:100%}.max-h-\\[calc\\(100vh-1rem\\)\\]{max-height:calc(100vh - 1rem)}.min-h-20{min-height:5rem}.min-h-screen{min-height:100vh}.w-5{width:1.25rem}.w-8{width:2rem}.w-\\[5px\\]{width:5px}.w-full{width:100%}.max-w-full{max-width:100%}.flex-1{flex:1 1 0%}.flex-grow{flex-grow:1}.-translate-x-1\\/2{--tw-translate-x: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rotate-90{--tw-rotate: 90deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.cursor-col-resize{cursor:col-resize}.cursor-default{cursor:default}.cursor-pointer{cursor:pointer}.resize{resize:both}.scroll-m-12{scroll-margin:3rem}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.flex-col{flex-direction:column}.items-start{align-items:flex-start}.items-center{align-items:center}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-1{gap:.25rem}.gap-2{gap:.5rem}.gap-4{gap:1rem}.gap-x-4{-moz-column-gap:1rem;column-gap:1rem}.overflow-hidden{overflow:hidden}.overflow-y-auto{overflow-y:auto}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.rounded{border-radius:.25rem}.rounded-b{border-bottom-right-radius:.25rem;border-bottom-left-radius:.25rem}.rounded-t{border-top-left-radius:.25rem;border-top-right-radius:.25rem}.border{border-width:1px}.border-b{border-bottom-width:1px}.border-b-2{border-bottom-width:2px}.border-\\[\\#fff1\\]{border-color:#fff1}.border-neutral-700{--tw-border-opacity: 1;border-color:rgb(64 64 64 / var(--tw-border-opacity, 1))}.border-neutral-800{--tw-border-opacity: 1;border-color:rgb(38 38 38 / var(--tw-border-opacity, 1))}.border-white{--tw-border-opacity: 1;border-color:rgb(255 255 255 / var(--tw-border-opacity, 1))}.border-opacity-10{--tw-border-opacity: .1}.bg-\\[\\#171616\\]{--tw-bg-opacity: 1;background-color:rgb(23 22 22 / var(--tw-bg-opacity, 1))}.bg-\\[\\#1a1a1a\\]{--tw-bg-opacity: 1;background-color:rgb(26 26 26 / var(--tw-bg-opacity, 1))}.bg-\\[\\#1d1d1d\\]{--tw-bg-opacity: 1;background-color:rgb(29 29 29 / var(--tw-bg-opacity, 1))}.bg-\\[\\#212121\\]{--tw-bg-opacity: 1;background-color:rgb(33 33 33 / var(--tw-bg-opacity, 1))}.bg-\\[\\#ffffff04\\]{background-color:#ffffff04}.bg-black{--tw-bg-opacity: 1;background-color:rgb(0 0 0 / var(--tw-bg-opacity, 1))}.bg-neutral-400{--tw-bg-opacity: 1;background-color:rgb(163 163 163 / var(--tw-bg-opacity, 1))}.bg-neutral-800{--tw-bg-opacity: 1;background-color:rgb(38 38 38 / var(--tw-bg-opacity, 1))}.bg-neutral-900{--tw-bg-opacity: 1;background-color:rgb(23 23 23 / var(--tw-bg-opacity, 1))}.bg-primary{--tw-bg-opacity: 1;background-color:rgb(220 20 60 / var(--tw-bg-opacity, 1))}.bg-white{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.bg-opacity-30{--tw-bg-opacity: .3}.bg-opacity-5{--tw-bg-opacity: .05}.p-1{padding:.25rem}.p-2{padding:.5rem}.px-1{padding-left:.25rem;padding-right:.25rem}.px-2{padding-left:.5rem;padding-right:.5rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.pb-2{padding-bottom:.5rem}.pl-2{padding-left:.5rem}.pl-4{padding-left:1rem}.pl-6{padding-left:1.5rem}.pl-8{padding-left:2rem}.pr-1{padding-right:.25rem}.text-right{text-align:right}.text-\\[10px\\]{font-size:10px}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xs{font-size:.75rem;line-height:1rem}.font-bold{font-weight:700}.font-medium{font-weight:500}.italic{font-style:italic}.text-neutral-100{--tw-text-opacity: 1;color:rgb(245 245 245 / var(--tw-text-opacity, 1))}.text-neutral-300{--tw-text-opacity: 1;color:rgb(212 212 212 / var(--tw-text-opacity, 1))}.text-neutral-400{--tw-text-opacity: 1;color:rgb(163 163 163 / var(--tw-text-opacity, 1))}.text-primary{--tw-text-opacity: 1;color:rgb(220 20 60 / var(--tw-text-opacity, 1))}.accent-red-500{accent-color:#ef4444}.opacity-50{opacity:.5}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-opacity{transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}:root{color-scheme:dark}#app{min-width:-moz-fit-content;min-width:fit-content;background-image:linear-gradient(#171616,#0e0e0e);color:#fff;min-height:100vh;width:100%;display:flex;flex-direction:row;padding:.5rem;gap:.5rem}select{background:url("data:image/svg+xml,<svg height='10px' width='10px' viewBox='0 0 16 16' fill='white' xmlns='http://www.w3.org/2000/svg'><path d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/></svg>") no-repeat;background-position:calc(100% - .75rem) center!important;-moz-appearance:none!important;-webkit-appearance:none!important;appearance:none!important;padding-right:2rem!important}select:not([disabled]){cursor:pointer}.last\\:border-b-0:last-child{border-bottom-width:0px}.hover\\:bg-neutral-700:hover{--tw-bg-opacity: 1;background-color:rgb(64 64 64 / var(--tw-bg-opacity, 1))}.hover\\:bg-white:hover{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.hover\\:bg-opacity-10:hover{--tw-bg-opacity: .1}.hover\\:opacity-100:hover{opacity:1}.focus\\:outline:focus{outline-style:solid}.focus\\:outline-primary:focus{outline-color:#dc143c}@media (min-width: 640px){.sm\\:inline{display:inline}}</style>
|
|
1756
1756
|
</head>
|
|
1757
1757
|
<body class="w-full min-h-screen">
|
|
@@ -1762,11 +1762,11 @@ var dist_default = `<!DOCTYPE html>
|
|
|
1762
1762
|
`;
|
|
1763
1763
|
|
|
1764
1764
|
// ../devtools-host/dist/index.js
|
|
1765
|
-
var dist_default2 = `var
|
|
1765
|
+
var dist_default2 = `var je="production";if(je!=="development"&&je!=="production")throw new Error("NODE_ENV must either be set to development or production.");var l=je==="development";var Ke=Symbol.for("kiru.signal"),kt=Symbol.for("kiru.context"),oe=Symbol.for("kiru.contextProvider"),q=Symbol.for("kiru.fragment"),Ue=Symbol.for("kiru.error"),L=Symbol.for("kiru.hmrAccept"),ke=Symbol.for("kiru.memo"),ie=Symbol.for("kiru.errorBoundary"),_t=Symbol.for("kiru.suspenseThrow"),We=50;var O=2,C=4,fe=8,V=16,_e=32,me=64,se=128,Ct=/^on:?/;var Be=new Set(["animateTransform","circle","clipPath","defs","desc","ellipse","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feMerge","feMergeNode","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","filter","foreignObject","g","image","line","linearGradient","marker","path","polygon","polyline","radialGradient","rect","stop","svg","switch","symbol","text","textPath","title","tspan","use"]),Ge=new Set(["allowfullscreen","autofocus","autoplay","async","checked","compact","controls","contenteditable","declare","default","defer","disabled","download","hidden","inert","ismap","multiple","nohref","noresize","noshade","novalidate","nowrap","open","popover","readonly","required","sandbox","scoped","selected","sortable","spellcheck","translate","wrap"]),Tt=new Map([["acceptCharset","accept-charset"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["httpEquiv","http-equiv"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]);var T={current:null},X={current:0},S={current:"window"in globalThis?"dom":"string"};var At,E=class extends Error{constructor(t){let r=typeof t=="string"?t:t.message;super(r),this[At]=!0,typeof t!="string"&&(l&&t?.vNode&&(this.customNodeStack=Ir(t.vNode)),this.fatal=t?.fatal)}static isKiruError(t){return t instanceof Error&&t[Ue]===!0}};At=Ue;function Ir(e){let t=e,r=[];for(;t&&t.parent;)typeof t.type=="function"?r.push(zr(t.type)):typeof t.type=="string"&&r.push(t.type),t=t.parent;let n=typeof e.type=="function"?e:qe(e,o=>typeof o.type=="function");return\`The above error occurred in the <\${Mt(n?.type||j)}> component:
|
|
1766
1766
|
|
|
1767
1767
|
\${r.map(o=>\` at \${o}\`).join(\`
|
|
1768
1768
|
\`)}
|
|
1769
|
-
\`}function Ur(e){let t=Ot(e);if(l){let r=Br(e);r&&(t=\`\${t} (\${r})\`)}return t}function Ot(e){return e.displayName??(e.name||"Anonymous Function")}function Br(e){return e.toString().match(/\\/\\/ \\[kiru_devtools\\]:(.*)/)?.[1]??null}function ae(e){return typeof e=="object"&&e!==null&&"type"in e}function Je(e){return e===X||e===oe||e===ie}function Pt(e){return e.type===X}function J(e){let t=e;for(;t;){if(t.app)return e.app=t.app;t=t.parent}return null}function be(e){let{props:{children:t,...r},memoizedProps:n,index:o}=e;e.prev={props:r,memoizedProps:n,index:o},e.flags&=~(D|A|pe)}function Dt(e,t){if(t.depth<e.depth)return!1;if(e===t)return!0;let r=!1,n=[e];for(;n.length;){let o=n.pop();if(o===t)return!0;o.child&&n.push(o.child),r&&o.sibling&&n.push(o.sibling),r=!0}return!1}function W(e,t){t(e);let r=e.child;for(;r;)t(r),r.child&&W(r,t),r=r.sibling}function Ye(e,t){let r=e.parent;for(;r;){if(t(r))return r;r=r.parent}return null}function Lt(e){return Ye(e,t=>t.type===ie)}function Ze(e){if("children"in e.props&&e.props.innerHTML)throw new _({message:"Cannot use both children and innerHTML on an element",vNode:e});for(let t in e.props)if("bind:"+t in e.props)throw new _({message:\`Cannot use both bind:\${t} and \${t} on an element\`,vNode:e})}function Vt(e){return typeof e=="string"||typeof e=="number"}function $t(e){return typeof e=="function"||typeof e=="object"&&!!e&&"current"in e||y.isSignal(e)}var Gr="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz-";function Ae(e=10,t=Gr){let r="";for(let n=0;n<e;n++)r+=t[Math.random()*t.length|0];return r}var j=Object.freeze(()=>{});var ye={stack:new Array,current:function(){return this.stack[this.stack.length-1]}},$=new Map,H=new Map;function ee(e,t=!1){return y.isSignal(e)?t?e.value:e.peek():e}var Qe=()=>{$.forEach(e=>e()),$.clear()};var le={parentStack:[],childIdxStack:[],eventDeferrals:new Map,parent:function(){return this.parentStack[this.parentStack.length-1]},clear:function(){this.parentStack.length=0,this.childIdxStack.length=0},pop:function(){this.parentStack.pop(),this.childIdxStack.pop()},push:function(e){this.parentStack.push(e),this.childIdxStack.push(0)},currentChild:function(){return this.parentStack[this.parentStack.length-1].childNodes[this.childIdxStack[this.childIdxStack.length-1]]},nextChild:function(){return this.parentStack[this.parentStack.length-1].childNodes[this.childIdxStack[this.childIdxStack.length-1]++]},bumpChildIndex:function(){this.childIdxStack[this.childIdxStack.length-1]++},captureEvents:function(e){Ht(e,!0),this.eventDeferrals.set(e,[])},resetEvents:function(e){this.eventDeferrals.delete(e)},releaseEvents:function(e){Ht(e,!1);let t=this.eventDeferrals.get(e);for(;t?.length;)t.shift()()}},qr=e=>{let t=e.target;!e.isTrusted||!t||le.eventDeferrals.get(t)?.push(()=>t.dispatchEvent(e))},Ht=(e,t)=>{for(let r in e)if(r.startsWith("on")){let n=r.substring(2);e[t?"addEventListener":"removeEventListener"](n,qr,{passive:!0})}};var it=!1,et=!1,Ft=e=>{e.preventDefault(),e.stopPropagation(),et=!0},ue=null;function Nt(){it=!0,ue=document.activeElement,ue&&ue!==document.body&&ue.addEventListener("blur",Ft)}function It(){et&&(ue.removeEventListener("blur",Ft),ue.isConnected&&ue.focus(),et=!1),it=!1}function tt(e,t){if(typeof e=="function"){e(t);return}if(y.isSignal(e)){e.sneak(t),e.notify({filter:r=>typeof r=="function"});return}e.current=t}function zt(e){let t=e.type;return t=="#text"?Xr(e):Be.has(t)?document.createElementNS("http://www.w3.org/2000/svg",t):document.createElement(t)}function Xr(e){let{nodeValue:t}=e.props;if(!y.isSignal(t))return document.createTextNode(t);let r=t.peek()??"",n=document.createTextNode(r);return nt(e,n,t),n}function Yr(e,t,r){let n=rt.get(e)??{},o=n[t]=s=>{if(it){s.preventDefault(),s.stopPropagation();return}r(s)};return rt.set(e,n),o}var rt=new WeakMap;function jt(e){let t=e.dom,r=e.prev?.props??{},n=e.props??{},o=new Set([...Object.keys(r),...Object.keys(n)]),s=C.current==="hydrate";o.forEach(i=>{let a=r[i],u=n[i];if(we.internalProps.includes(i)&&i!=="innerHTML"){i==="ref"&&a!==u&&(a&&tt(a,null),u&&tt(u,t));return}if(we.isEvent(i)){if(a!==u||C.current==="hydrate"){let c=i.replace(Tt,""),m=c==="focus"||c==="blur";i in r&&t.removeEventListener(c,m?rt.get(e)?.[c]:a),i in n&&t.addEventListener(c,m?Yr(e,c,u):u)}return}if(!(t instanceof Text)){if(a===u||s&&t.getAttribute(i)===u)return;if(y.isSignal(a)&&e.cleanups){let c=e.cleanups[i];c&&(c(),delete e.cleanups[i])}if(y.isSignal(u))return en(e,t,i,u,a);Me(t,i,u,a);return}y.isSignal(u)||t.nodeValue!==u&&(t.nodeValue=u)})}function Jr(e){return e.multiple?Array.from(e.selectedOptions).map(t=>t.value):e.value}function Wt(e,t){if(!e.multiple||t===void 0||t===null||t===""){e.value=t;return}Array.from(e.options).forEach(r=>{r.selected=t.indexOf(r.value)>-1})}var Zr={value:"input",checked:"change",open:"toggle",volume:"volumechange",playbackRate:"ratechange",currentTime:"timeupdate"},Qr=["progress","meter","number","range"];function en(e,t,r,n,o){let s=e.cleanups??(e.cleanups={}),[i,a]=r.split(":");if(i!=="bind")return s[r]=n.subscribe((p,v)=>{Me(t,r,p,v),l&&window.__kiru.profilingContext?.emit("signalAttrUpdate",J(e))}),Me(t,r,n.peek(),ee(o));let u=Zr[a];if(!u){l&&console.error(\`[kiru]: \${a} is not a valid element binding attribute.\`);return}let c=t instanceof HTMLSelectElement,m=c?p=>Wt(t,p):p=>t[a]=p,E=p=>{m(p),l&&window.__kiru.profilingContext?.emit("signalAttrUpdate",J(e))},S=p=>{n.sneak(p),n.notify({filter:v=>v!==E})},d;if(a==="value"){let p=Qr.indexOf(t.type)!==-1;d=()=>{let v=t.value;c?v=Jr(t):typeof n.peek()=="number"&&p&&(v=t.valueAsNumber),S(v)}}else d=p=>{let v=p.target[a];a==="currentTime"&&n.peek()===v||S(v)};t.addEventListener(u,d);let g=n.subscribe(E);return s[r]=()=>{t.removeEventListener(u,d),g()},Me(t,a,n.peek(),ee(o))}function nt(e,t,r){(e.cleanups??(e.cleanups={})).nodeValue=r.subscribe((n,o)=>{n!==o&&(t.nodeValue=n,l&&window.__kiru.profilingContext?.emit("signalTextUpdate",J(e)))})}function Kt(e){let t=le.nextChild();if(!t)throw new _({message:"Hydration mismatch - no node found",vNode:e});let r=t.nodeName;if(Be.has(r)||(r=r.toLowerCase()),e.type!==r)throw new _({message:\`Hydration mismatch - expected node of type \${e.type.toString()} but received \${r}\`,vNode:e});if(e.dom=t,e.type!=="#text"&&!(e.flags&V)){jt(e);return}y.isSignal(e.props.nodeValue)&&nt(e,t,e.props.nodeValue);let n=e,o=e.sibling;for(;o&&o.type==="#text";){let s=o;le.bumpChildIndex();let i=String(ee(n.props.nodeValue)??""),a=n.dom.splitText(i.length);s.dom=a,y.isSignal(s.props.nodeValue)&&nt(s,a,s.props.nodeValue),n=o,o=o.sibling}}function Ut(e,t,r,n=!1){if(r===null)return e.removeAttribute(t),!0;switch(typeof r){case"undefined":case"function":case"symbol":return e.removeAttribute(t),!0;case"boolean":if(n&&!r)return e.removeAttribute(t),!0}return!1}function tn(e,t,r){let n=Ge.has(t);Ut(e,t,r,n)||e.setAttribute(t,n&&typeof r=="boolean"?"":String(r))}var rn=["INPUT","TEXTAREA"],nn=e=>rn.indexOf(e.nodeName)>-1;function Me(e,t,r,n){if(r!==n)switch(t){case"style":return an(e,r,n);case"className":return sn(e,r);case"innerHTML":return on(e,r);case"muted":e.muted=!!r;return;case"value":if(e.nodeName==="SELECT")return Wt(e,r);let o=r==null?"":String(r);if(nn(e)){e.value=o;return}e.setAttribute("value",o);return;case"checked":if(e.nodeName==="INPUT"){e.checked=!!r;return}e.setAttribute("checked",String(r));return;default:return tn(e,Mt(t),r)}}function on(e,t){if(t==null||typeof t=="boolean"){e.innerHTML="";return}e.innerHTML=String(t)}function sn(e,t){let r=ee(t);if(!r)return e.removeAttribute("class");e.setAttribute("class",r)}function an(e,t,r){if(Ut(e,"style",t))return;if(typeof t=="string"){e.setAttribute("style",t);return}let n={};typeof r=="string"?e.setAttribute("style",""):typeof r=="object"&&r&&(n=r);let o=t;new Set([...Object.keys(n),...Object.keys(o)]).forEach(i=>{let a=n[i],u=o[i];if(a!==u){if(u===void 0){e.style[i]="";return}e.style[i]=u}})}function ln(e){let t=e.parent,r=t?.dom;for(;t&&!r;)t=t.parent,r=t?.dom;if(!r||!t){if(!e.parent&&e.dom)return e;throw new _({message:"No DOM parent found while attempting to place node.",vNode:e})}return t}function un(e,t){let{node:r,lastChild:n}=t,o=e.dom;if(n){n.after(o);return}let s=Bt(e,r);if(s){r.dom.insertBefore(o,s);return}r.dom.appendChild(o)}function Bt(e,t){let r=e;for(;r;){let n=r.sibling;for(;n;){if(!(n.flags&(A|V))){let o=cn(n);if(o?.isConnected)return o}n=n.sibling}if(r=r.parent,!r||r.flags&V||r===t)return}}function cn(e){let t=e;for(;t;){if(t.dom)return t.dom;if(t.flags&V)return;t=t.child}}function Gt(e){if(C.current==="hydrate")return W(e,be);let t={node:e.dom?e:ln(e)};ot(e,t,(e.flags&A)>0),e.dom&&!(e.flags&V)&&qt(e,t,!1),be(e)}function ot(e,t,r){let n=e.child;for(;n;){if(n.flags&he){n.flags&A&&fn(n,t),be(n),n=n.sibling;continue}n.dom?(ot(n,{node:n},!1),n.flags&V||qt(n,t,r)):ot(n,t,(n.flags&A)>0||r),be(n),n=n.sibling}}function qt(e,t,r){(r||!e.dom.isConnected||e.flags&A)&&un(e,t),(!e.prev||e.flags&D)&&jt(e),t.lastChild=e.dom}function Xt(e){e===e.parent?.child&&(e.parent.child=e.sibling);let t;l&&(t=J(e)),W(e,r=>{let{hooks:n,subs:o,cleanups:s,dom:i,props:{ref:a}}=r;for(o?.forEach(u=>u()),s&&Object.values(s).forEach(u=>u());n?.length;)n.pop().cleanup?.();l&&(window.__kiru.profilingContext?.emit("removeNode",t),i instanceof Element&&delete i.__kiruNode),i&&(a&&tt(a,null),i.isConnected&&!(r.flags&V)&&i.remove(),delete r.dom)}),e.parent=null}function fn(e,t){if(!e.child)return;let r=[];if(Yt(e.child,r),r.length===0)return;let{node:n,lastChild:o}=t;if(o)o.after(...r);else{let s=Bt(e,n),i=n.dom;s?s.before(...r):i.append(...r)}t.lastChild=r[r.length-1]}function Yt(e,t){let r=e;for(;r;)r.dom?t.push(r.dom):r.child&&Yt(r.child,t),r=r.sibling}function Jt(e){return typeof e=="function"&&typeof e[Ce]?.arePropsEqual=="function"}function f(e,t=null,...r){if(e===Z)return Z({children:r,...t});let n={type:e,flags:0,index:0,depth:0,props:{},parent:null,sibling:null,child:null,prev:null,deletions:null};if(Jt(e)&&(n.flags|=Te,n.arePropsEqual=e[Ce].arePropsEqual),t!==null){let{key:s,ref:i,...a}=t;Vt(s)&&(n.props.key=s.toString()),$t(i)&&(n.props.ref=i),Object.assign(n.props,a)}let o=r.length===1?r[0]:r.length>1?r:null;return o!==null&&(n.props.children=o),n}function Z({children:e,key:t}){return f(X,t?{key:t}:null,e)}var lt;function Pe(e,t){return l&&(lt=J(e)),Array.isArray(t)?(l&&(ir in t&&hn(e,t),gn(e,t)),dn(e,t)):pn(e,t)}function pn(e,t){let r=e.child;if(r===null)return tr(e,t);let n=r.sibling,o=Qt(e,r,t);if(o!==null)return r&&r!==o&&!o.prev?at(e,r):n&&at(e,n),o;{let s=sr(r),i=rr(s,e,0,t);if(i!==null){let a=i.prev;if(a!==null){let u=a.props.key;s.delete(u===void 0?a.index:u)}Re(i,0,0)}return s.forEach(a=>Oe(e,a)),i}}function dn(e,t){let r=null,n=null,o=e.child,s=null,i=0,a=0;for(;o!==null&&a<t.length;a++){o.index>a?(s=o,o=null):s=o.sibling;let c=Qt(e,o,t[a]);if(c===null){o===null&&(o=s);break}o&&!c.prev&&Oe(e,o),i=Re(c,i,a),n===null?r=c:n.sibling=c,n=c,o=s}if(a===t.length)return at(e,o),r;if(o===null){for(;a<t.length;a++){let c=tr(e,t[a]);c!==null&&(i=Re(c,i,a),n===null?r=c:n.sibling=c,n=c)}return r}let u=sr(o);for(;a<t.length;a++){let c=rr(u,e,a,t[a]);if(c!==null){let m=c.prev;if(m!==null){let E=m.props.key;u.delete(E===void 0?m.index:E)}i=Re(c,i,a),n===null?r=c:n.sibling=c,n=c}}return u.forEach(c=>Oe(e,c)),r}function Qt(e,t,r){let n=t?.props.key;return nr(r)?n!==void 0||t?.type==="#text"&&y.isSignal(t.props.nodeValue)?null:Zt(e,t,""+r):y.isSignal(r)?t&&t.props.nodeValue!==r?null:Zt(e,t,r):ae(r)?r.props.key!==n?null:mn(e,t,r):Array.isArray(r)?n!==void 0?null:(l&&ut(r),er(e,t,r)):null}function Zt(e,t,r){if(t===null||t.type!=="#text"){l&&U();let o=f("#text",{nodeValue:r});return K(o,e),o}return l&&ve(),t.props.nodeValue!==r&&(t.props.nodeValue=r,t.flags|=D),t.sibling=null,t}function mn(e,t,r){let{type:n,props:o}=r;if(l&&typeof n=="function"&&(n=T(n)),n===X)return er(e,t,o.children||[],o);if(t?.type===n)return l&&ve(),t.index=0,t.sibling=null,typeof n=="string"?or(t.props,o)&&(t.flags|=D):t.flags|=D,t.props=o,t.memoizedProps=r.memoizedProps,t;l&&U();let s=f(n,o);return K(s,e),s}function er(e,t,r,n={}){if(t===null||t.type!==X){l&&U();let o=f(X,{children:r,...n});return K(o,e),o}return l&&ve(),t.props={...t.props,...n,children:r},t.flags|=D,t.sibling=null,t}function tr(e,t){if(nr(t)){l&&U();let r=f("#text",{nodeValue:""+t});return K(r,e),r}if(y.isSignal(t)){l&&U();let r=f("#text",{nodeValue:t});return K(r,e),r}if(ae(t)){l&&U();let r=f(t.type,t.props);return K(r,e),r.flags|=A,r}if(Array.isArray(t)){l&&(U(),ut(t));let r=Z({children:t});return K(r,e),r}return null}function Re(e,t,r){e.index=r;let n=e.prev;if(n!==null){let o=n.index;return o<t?(e.flags|=A,t):o}else return e.flags|=A,t}function rr(e,t,r,n){if(y.isSignal(n)||typeof n=="string"&&n!==""||typeof n=="number"||typeof n=="bigint"){let s=e.get(r);if(s){if(s.props.nodeValue===n)return s;s.type==="#text"&&y.isSignal(s.props.nodeValue)&&s.cleanups?.nodeValue?.()}l&&U();let i=f("#text",{nodeValue:n});return K(i,t),i.flags|=A,i.index=r,i}if(ae(n)){let{type:s,props:i}=n,a=i.key,u=e.get(a===void 0?r:a);if(u?.type===s)return l&&ve(),typeof s=="string"?or(u.props,i)&&(u.flags|=D):u.flags|=D,u.props=i,u.sibling=null,u.index=r,u;l&&U();let c=f(n.type,n.props);return K(c,t),c.flags|=A,c.index=r,c}if(Array.isArray(n)){let s=e.get(r);if(l&&ut(n),s)return l&&ve(),s.flags|=D,s.props.children=n,s;l&&U();let i=Z({children:n});return K(i,t),i.flags|=A,i.index=r,i}return null}function nr(e){return typeof e=="string"&&e!==""||typeof e=="number"||typeof e=="bigint"}function or(e,t){let r=Object.keys(e),n=Object.keys(t);if(r.length!==n.length)return!0;for(let o of r)if(!(o==="children"||o==="key")&&e[o]!==t[o])return!0;return!1}function K(e,t){e.parent=t,e.depth=t.depth+1}function ve(){"window"in globalThis&&window.__kiru.profilingContext?.emit("updateNode",lt)}function U(){"window"in globalThis&&window.__kiru.profilingContext?.emit("createNode",lt)}var ir=Symbol("kiru:marked-list-child");function ut(e){Object.assign(e,{[ir]:!0})}function sr(e){let t=new Map;for(;e;){let r=e.props.key;t.set(r===void 0?e.index:r,e),e=e.sibling}return t}function Oe(e,t){e.deletions===null?e.deletions=[t]:e.deletions.push(t)}function at(e,t){for(;t;)Oe(e,t),t=t.sibling}function gn(e,t){let r=new Set,n=!1;for(let o of t){if(!ae(o))continue;let s=o.props.key;if(typeof s=="string"){if(!n&&r.has(s)){let i=lr(e);ar(\`\${i} component produced a child in a list with a duplicate key prop: "\${s}". Keys should be unique so that components maintain their identity across updates\`),n=!0}r.add(s)}}}function hn(e,t){let r=!1,n=!1;for(let o of t){if(!ae(o))continue;typeof o.props.key=="string"?r=!0:n=!0}if(n&&r){let o=lr(e);ar(\`\${o} component produced a child in a list without a valid key prop\`)}}function ar(e){let t=\`[kiru]: \${e}. See https://kirujs.dev/keys-warning for more information.\`;console.error(t)}var st=new WeakMap;function lr(e){if(st.has(e))return st.get(e);let t=e.parent,r;for(;!r&&t;)typeof t.type=="function"&&(r=t.type),t=t.parent;let n=\`<\${r?.displayName||r?.name||"Anonymous Function"} />\`;return st.set(e,n),n}var B,G=[],de=!1,ft=[],De=[],pt=!1,dt=!1,mt=!1,gt=0,ur=[],ht=[],cr=-1;function bt(e){if(de){ft.push(e);return}e()}function Le(){de&&(window.cancelAnimationFrame(cr),fr())}function yt(e){e.flags|=se,G.push(e),de=!0,Le()}function O(e){if(C.current==="hydrate")return bt(()=>wt(e));wt(e)}function wn(){de||(de=!0,cr=window.requestAnimationFrame(fr))}function bn(){for(de=!1;ft.length;)ft.shift()()}function wt(e){if(pt&&(dt=!0),M.current===e){l&&window.__kiru.profilingContext?.emit("updateDirtied",B),mt=!0;return}if(!(e.flags&(se|pe))){if(e.flags|=se,!G.length)return G.push(e),wn();G.push(e)}}function yn(e){W(e,t=>t.flags|=pe),De.push(e)}var vn=(e,t)=>t.depth-e.depth,te=null;function fr(){if(l){let t=De[0]??G[0];t?(B=J(t),window.__kiru.profilingContext?.beginTick(B)):B=null}let e=1;for(Nt();G.length;){G.length>e&&G.sort(vn),te=G.shift(),e=G.length;let t=te.flags;if(!(t&pe)&&t&se){let r=te;for(;r=xn(r););for(;De.length;)Xt(De.pop());Gt(te),te.flags&=~se}}if(It(),pt=!0,ct(ur),pt=!1,dt)return _n(),ct(ht),dt=!1,gt++,l&&(window.__kiru.profilingContext?.endTick(B),window.__kiru.profilingContext?.emit("updateDirtied",B)),Le();gt=0,bn(),ct(ht),l&&(window.__kiru.emit("update",B),window.__kiru.profilingContext?.emit("update",B),window.__kiru.profilingContext?.endTick(B))}function xn(e){let t=!0;try{typeof e.type=="string"?kn(e):Je(e.type)?En(e):t=Sn(e)}catch(n){l&&window.__kiru.emit("error",B,n instanceof Error?n:new Error(String(n)));let o=Lt(e);if(o){let s=o.error=n instanceof Error?n:new Error(String(n));return o.props.onError?.(s),o.depth<te.depth&&(te=o),o}if(_.isKiruError(n)){if(n.customNodeStack&&setTimeout(()=>{throw new Error(n.customNodeStack)}),n.fatal)throw n;console.error(n);return}setTimeout(()=>{throw n})}if(e.deletions!==null&&(e.deletions.forEach(yn),e.deletions=null),t&&e.child)return e.child;let r=e;for(;r;){if(r.immediateEffects&&(ur.push(...r.immediateEffects),r.immediateEffects=void 0),r.effects&&(ht.push(...r.effects),r.effects=void 0),r===te)return;if(r.sibling)return r.sibling;r=r.parent,C.current==="hydrate"&&r?.dom&&le.pop()}}function En(e){let{props:t,type:r}=e,n=t.children;if(r===oe){let{props:{dependents:o,value:s},prev:i}=e;o.size&&i&&i.props.value!==s&&o.forEach(wt)}else if(r===ie){let o=e,{error:s}=o;s&&(n=typeof t.fallback=="function"?t.fallback(s):t.fallback,delete o.error)}e.child=Pe(e,n)}function Sn(e){let{type:t,props:r,subs:n,prev:o,flags:s}=e;if(s&Te){if(e.memoizedProps=r,o?.memoizedProps&&e.arePropsEqual(o.memoizedProps,r)&&!e.hmrUpdated)return e.flags|=he,!1;e.flags&=~he}try{M.current=e;let i,a=0;do{if(e.flags&=~se,mt=!1,Y.current=0,n&&(n.forEach(u=>u()),n.clear()),l){if(i=T(t)(r),e.hmrUpdated&&e.hooks&&e.hookSig){let u=e.hooks.length;if(Y.current<u){for(let c=Y.current;c<u;c++)e.hooks[c].cleanup?.();e.hooks.length=Y.current,e.hookSig.length=Y.current}}if(delete e.hmrUpdated,++a>Ue)throw new _({message:"Too many re-renders. Kiru limits the number of renders to prevent an infinite loop.",fatal:!0,vNode:e});continue}i=t(r)}while(mt);return e.child=Pe(e,i),!0}finally{M.current=null}}function kn(e){let{props:t,type:r}=e;l&&Ze(e),e.dom||(C.current==="hydrate"?Kt(e):e.dom=zt(e),l&&e.dom instanceof Element&&(e.dom.__kiruNode=e)),r!=="#text"&&(e.child=Pe(e,t.children),e.child&&C.current==="hydrate"&&le.push(e.dom))}function _n(){if(gt>Ue)throw new _("Maximum update depth exceeded. This can happen when a component repeatedly calls setState during render or in useLayoutEffect. Kiru limits the number of nested updates to prevent infinite loops.")}function ct(e){for(let t=0;t<e.length;t++)e[t]();e.length=0}var pr;(function(e){e.Start="start",e.End="end"})(pr||(pr={}));var me=null,dr=new Set;function h(e,t,r){let n=M.current;if(n||Cn(e),l&&me!==null&&!dr.has(e+me))throw dr.add(e+me),new _({message:\`Nested primitive "useHook" calls are not supported. "\${e}" was called inside "\${me}". Strange will most certainly happen.\`,vNode:n});let o=(a,u)=>{if(u?.immediate){(n.immediateEffects??(n.immediateEffects=[])).push(a);return}(n.effects??(n.effects=[])).push(a)},s=Y.current++,i=n.hooks?.at(s);if(l){me=e,n.hooks??(n.hooks=[]),n.hookSig??(n.hookSig=[]),n.hookSig[s]?n.hookSig[s]!==e&&(console.warn(\`[kiru]: hooks must be called in the same order. Hook "\${e}" was called in place of "\${n.hookSig[s]}". Strange things may happen.\`),i?.cleanup?.(),n.hooks.length=s,n.hookSig.length=s,i=void 0):n.hookSig[s]=e;let a;i?a=i:(a=typeof t=="function"?t():{...t},a.name=e),n.hooks[s]=a;try{return r({hook:a,isInit:!i,isHMR:n.hmrUpdated,update:()=>O(n),queueEffect:o,vNode:n,index:s})}catch(u){throw u}finally{me=null}}try{let a=i??(typeof t=="function"?t():{...t});return n.hooks??(n.hooks=[]),n.hooks[s]=a,r({hook:a,isInit:!i,update:()=>O(n),queueEffect:o,vNode:n,index:s})}catch(a){throw a}}function Cn(e){throw new _(\`Hook "\${e}" must be used at the top level of a component or inside another composite hook.\`)}function F(e){e.cleanup&&(e.cleanup(),e.cleanup=void 0)}function R(e,t){return e===void 0||t===void 0||e.length!==t.length||e.length>0&&t.some((r,n)=>!Object.is(r,e[n]))}var mr,y=class e{constructor(t,r){this[mr]=!0,this.$id=Ae(),this.$value=t,r&&(this.displayName=r),l?(H.set(this.$id,new Set),this.$initialValue=qe(t),this[k]={provide:()=>this,inject:n=>{H.get(this.$id)?.clear?.(),H.delete(this.$id),this.$id=n.$id,n.__next=this,this.$initialValue===n.$initialValue?this.$value=n.$value:this.notify()},destroy:()=>{}}):this.$subs=new Set}get value(){if(this.onBeforeRead?.(),l){let t=T(this);return e.entangle(t),t.$value}return e.entangle(this),this.$value}set value(t){if(l){let r=T(this);if(Object.is(r.$value,t))return;r.$prevValue=r.$value,r.$value=t,r.notify();return}Object.is(this.$value,t)||(this.$prevValue=this.$value,this.$value=t,this.notify())}peek(){return this.onBeforeRead?.(),l?T(this).$value:this.$value}sneak(t){if(l){let r=T(this);r.$prevValue=r.$value,r.$value=t;return}this.$prevValue=this.$value,this.$value=t}toString(){if(this.onBeforeRead?.(),l){let t=T(this);return e.entangle(t),\`\${t.$value}\`}return e.entangle(this),\`\${this.$value}\`}subscribe(t){return l?(H.get(this.$id).add(t),()=>H.get(this.$id)?.delete(t)):(this.$subs.add(t),()=>this.$subs.delete(t))}notify(t){if(l)return H.get(this.$id)?.forEach(r=>{if(t?.filter&&!t.filter(r))return;let{$value:n,$prevValue:o}=T(this);return r(n,o)});this.$subs.forEach(r=>{if(!(t?.filter&&!t.filter(r)))return r(this.$value,this.$prevValue)})}static isSignal(t){return typeof t=="object"&&!!t&&We in t}static subscribers(t){return l?H.get(t.$id):t.$subs}static makeReadonly(t){let r=Object.getOwnPropertyDescriptor(t,"value");return r&&!r.writable?t:Object.defineProperty(t,"value",{get:function(){return e.entangle(this),this.$value},configurable:!0})}static makeWritable(t){let r=Object.getOwnPropertyDescriptor(t,"value");return r&&r.writable?t:Object.defineProperty(t,"value",{get:function(){return e.entangle(this),this.$value},set:function(n){this.$value=n,this.notify()},configurable:!0})}static entangle(t){let r=M.current,n=ye.current();if(n){(!r||r&&w())&&n.set(t.$id,t);return}if(!r||!w())return;let o=t.subscribe(()=>O(r));(r.subs??(r.subs=new Set)).add(o)}static configure(t,r){t.onBeforeRead=r}static dispose(t){if(t.$isDisposed=!0,l){H.delete(t.$id);return}t.$subs.clear()}};mr=We;var Ve=(e,t)=>new y(e,t),x=(e,t)=>h("useSignal",{signal:null},({hook:r,isInit:n,isHMR:o})=>{if(l&&(n&&(r.dev={devtools:{get:()=>({displayName:r.signal.displayName,value:r.signal.peek()}),set:({value:s})=>{r.signal.value=s}},initialArgs:[e,t]}),o)){let[s,i]=r.dev.initialArgs;(s!==e||i!==t)&&(r.cleanup?.(),n=!0,r.dev.initialArgs=[e,t])}return n&&(r.cleanup=()=>y.dispose(r.signal),r.signal=new y(e,t)),r.signal});function $e(e){let{id:t,subs:r,fn:n,deps:o=[],onDepChanged:s}=e,i;$.delete(t);let a=!!M.current&&!w();a||(i=new Map,ye.stack.push(i));let u=n(...o.map(c=>c.value));if(!a){for(let[m,E]of r)i.has(m)||(E(),r.delete(m));let c=()=>{$.size||queueMicrotask(Qe),$.set(t,s)};for(let[m,E]of i){if(r.has(m))continue;let S=E.subscribe(c);r.set(m,S)}ye.stack.pop()}return u}var xe=class e extends y{constructor(t,r){if(super(void 0,r),this.$getter=t,this.$unsubs=new Map,this.$isDirty=!0,l){let n=this[k].inject;this[k]={provide:()=>this,inject:o=>{n(o),e.stop(o),this.$isDirty=o.$isDirty},destroy:()=>{}}}y.configure(this,()=>{this.$isDirty&&(l&&this.$isDisposed||e.run(this))})}get value(){return super.value}set value(t){}subscribe(t){return this.$isDirty&&e.run(this),super.subscribe(t)}static dispose(t){e.stop(t),y.dispose(t)}static stop(t){let{$id:r,$unsubs:n}=T(t);$.delete(r),n.forEach(o=>o()),n.clear(),t.$isDirty=!0}static run(t){let r=T(t),{$id:n,$getter:o,$unsubs:s}=r,i=$e({id:n,subs:s,fn:()=>o(r.$value),onDepChanged:()=>{if(r.$isDirty=!0,l){if(!H?.get(n)?.size)return}else if(!t.$subs.size)return;e.run(r),!Object.is(r.$value,r.$prevValue)&&r.notify()}});r.sneak(i),r.$isDirty=!1}},gr=(e,t)=>new xe(e,t),vt=(e,t)=>h("useComputedSignal",{signal:null},({hook:r,isInit:n,isHMR:o})=>(l&&(r.dev={devtools:{get:()=>({displayName:r.signal.displayName,value:r.signal.peek()})}},o&&(r.cleanup?.(),n=!0)),n&&(r.cleanup=()=>xe.dispose(r.signal),r.signal=gr(e,t)),r.signal));var Ee=class e{constructor(t,r){if(this.id=Ae(),this.getter=t,this.deps=r,this.unsubs=new Map,this.isRunning=!1,this.cleanup=null,l&&(this[k]={provide:()=>this,inject:n=>{n.isRunning||this.stop()},destroy:()=>{this.stop()}},"window"in globalThis)){let n=window.__kiru.HMRContext.signals;n.isWaitingForNextWatchCall()&&n.pushWatch(this)}this.start()}start(){if(!this.isRunning){if(this.isRunning=!0,l&&"window"in globalThis&&window.__kiru.HMRContext?.isReplacement())return queueMicrotask(()=>{this.isRunning&&e.run(this)});e.run(this)}}stop(){$.delete(this.id),this.unsubs.forEach(t=>t()),this.unsubs.clear(),this.cleanup?.(),this.cleanup=null,this.isRunning=!1}static run(t){let r=T(t),{id:n,getter:o,unsubs:s,deps:i}=r;r.cleanup=$e({id:n,subs:s,fn:o,deps:i,onDepChanged:()=>{r.cleanup?.(),e.run(r)}})??null}};function hr(e,t){if(typeof e=="function")return new Ee(e);let r=e,n=t;return new Ee(n,r)}function Se(e,t){if(w())return h("useWatch",{watcher:null},({hook:r,isInit:n,isHMR:o})=>{if(l&&o&&(r.cleanup?.(),n=!0),n){let s=r.watcher=hr(e,t);r.cleanup=()=>s.stop()}return r.watcher})}function wr(e){return!!e&&(typeof e=="object"||typeof e=="function")&&k in e&&typeof e[k]=="object"&&!!e[k]}function br(){let e=new Map,t=null,r=null,n=!1,o=()=>n,s=!1,i=[],a=[];return{register:S=>{if(r===null)throw new Error("[kiru]: HMR could not register: No active module");let d=new Set;for(let[g,p]of Object.entries(S)){let v=r.hotVars.get(g);if(p.value.__devtoolsFileLink=p.link,typeof p.value=="function"&&v?.value&&(v.value.__next=p.value),p.type==="createStore"&&window.__kiru.stores.add(g,p.value),r.hotVars.set(g,p),!!v){if(wr(v.value)&&wr(p.value)){p.value[k].inject(v.value[k].provide()),v.value[k].destroy();continue}v.type==="component"&&p.type==="component"&&window.__kiru.apps.forEach(fe=>{W(fe.rootNode,ge=>{ge.type===v.value&&(ge.type=p.value,d.add(fe),ge.hmrUpdated=!0)})})}}if(d.forEach(g=>g.rootNode&&O(g.rootNode)),n=!1,i.length){let g=0;for(;g<i.length;g++){let p=i[g],v=r.unnamedWatchers[g];v&&(p[k].inject(v[k].provide()),v[k].destroy()),r.unnamedWatchers[g]=p}for(;g<r.unnamedWatchers.length;g++)r.unnamedWatchers[g][k].destroy();r.unnamedWatchers.length=i.length,i.length=0}r=null,t=null},prepare:S=>{let d=e.get(S);if(n=!!d,!d)d={hotVars:new Map,unnamedWatchers:[]},e.set(S,d);else for(;a.length;)a.shift()();r=d,t=S},isReplacement:o,signals:{registerNextWatch(){s=!0},isWaitingForNextWatchCall(){return s},pushWatch(S){i.push(S),s=!1}},onHmr:S=>{a.push(S)},getCurrentFilePath(){return t}}}function yr(){let e=new Map,t=new Map;return{appStats:t,emit:(r,n)=>{e.get(r)?.forEach(o=>o(n))},addEventListener:(r,n)=>{e.has(r)||e.set(r,new Set),e.get(r).add(n)},removeEventListener:(r,n)=>{e.has(r)&&e.get(r).delete(n)},mountDuration:r=>{let n=t.get(r);return n?n.mountDuration:0},totalTicks:r=>{let n=t.get(r);return n?n.totalTicks:0},lastTickDuration:r=>{let n=t.get(r);if(!n)return 0;let o=n.timestamps[n.timestamps.length-1];return o.end-o.start},averageTickDuration:r=>{let n=t.get(r);if(!n)return 0;let o=n.timestamps.filter(s=>s.end!==1/0);return o.reduce((s,i)=>s+(i.end-i.start),0)/o.length},beginTick:r=>{t.has(r)||t.set(r,{mountDuration:1/0,timestamps:[],totalTicks:0});let n=t.get(r);n.totalTicks++,n.timestamps.push({start:performance.now(),end:1/0})},endTick:r=>{if(!t.has(r))return;let n=t.get(r),o=n.timestamps[n.timestamps.length-1];o.end=performance.now(),n.mountDuration===1/0&&(n.mountDuration=o.end-o.start),n.timestamps.length>100&&n.timestamps.shift()}}}function Tn(){let e=new Map,t=new Set;function r(i,a){e.has(i)||(e.set(i,a),o())}function n(i){e.has(i)&&(e.delete(i),o())}function o(){let i=Object.fromEntries(e);t.forEach(a=>a(i))}function s(i){return t.add(i),i(Object.fromEntries(e)),()=>t.delete(i)}return{add:r,delete:n,subscribe:s,get size(){return e.size}}}function vr(){let e=new Set,t=new Map;function r(i,a,u){t.get(i)?.forEach(c=>c(a,u))}function n(i,a){t.has(i)||t.set(i,new Set),t.get(i).add(a)}function o(i,a){t.get(i)?.delete(a)}let s={get apps(){return Array.from(e)},emit:r,on:n,off:o};return n("mount",i=>e.add(i)),n("unmount",i=>e.delete(i)),l&&(s.HMRContext=br(),s.profilingContext=yr(),s.stores=Tn()),s}var An=0;function xr(e,t,r){var n;if(l&&t.__kiruNode)throw new Error("[kiru]: container in use - call unmount on the previous app first.");let o=f(t.nodeName.toLowerCase(),{});l&&(t.__kiruNode=o),o.dom=t,o.flags|=V;let s=An++,i=r?.name??\`App-\${s}\`,a={id:s,name:i,rootNode:o,render:u,unmount:c};function u(m){o.props.children=m,yt(o)}function c(){o.props.children=null,yt(o),l&&(delete t.__kiruNode,delete o.app),window.__kiru.emit("unmount",a)}return l&&(o.app=a),(n=globalThis.window).__kiru??(n.__kiru=vr()),u(e),window.__kiru.emit("mount",a),a}function ce(e){return w()?h("useState",{state:void 0,dispatch:j},({hook:t,isInit:r,update:n,isHMR:o})=>{if(l&&(r&&(t.dev={devtools:{get:()=>({value:t.state}),set:({value:s})=>t.state=s},initialArgs:[e]}),o)){let[s]=t.dev.initialArgs;s!==e&&(r=!0,t.dev.initialArgs=[e])}return r&&(t.state=typeof e=="function"?e():e,t.dispatch=s=>{let i=typeof s=="function"?s(t.state):s;Object.is(t.state,i)||(t.state=i,n())}),[t.state,t.dispatch]}):[typeof e=="function"?e():e,j]}function Er(e){let t={[_t]:!0,Provider:({value:r,children:n})=>{let[o]=ce(()=>new Set);return f(oe,{value:r,ctx:t,dependents:o},typeof n=="function"?n(r):n)},default:()=>e,set displayName(r){this.Provider.displayName=r},get displayName(){return this.Provider.displayName||"Anonymous Context"}};if(l){let r=t;r[k]={inject:n=>{let o=t.Provider;window.__kiru.apps.forEach(s=>{W(s.rootNode,i=>{i.type===n.Provider&&(i.type=o,i.hmrUpdated=!0,O(i))})})},destroy:()=>{},provide:()=>t}}return t}function Q(e,t){return w()?h("useCallback",{callback:e,deps:t},({hook:r,isHMR:n})=>(l&&(r.dev={devtools:{get:()=>({callback:r.callback,dependencies:r.deps})}},n&&(r.deps=[])),R(t,r.deps)&&(r.deps=t,r.callback=e),r.callback)):e}function N(e,t){if(w())return h("useEffect",{deps:t},({hook:r,isInit:n,isHMR:o,queueEffect:s})=>{l&&(r.dev={devtools:{get:()=>({callback:e,dependencies:r.deps})}},o&&(n=!0)),(n||R(t,r.deps))&&(r.deps=t,F(r),s(()=>{let i=e();typeof i=="function"&&(r.cleanup=i)}))})}function re(e,t){if(w())return h("useLayoutEffect",{deps:t},({hook:r,isInit:n,isHMR:o,queueEffect:s})=>{l&&(r.dev={devtools:{get:()=>({callback:e,dependencies:r.deps})}},o&&(n=!0)),(n||R(t,r.deps))&&(r.deps=t,F(r),s(()=>{let i=e();typeof i=="function"&&(r.cleanup=i)},{immediate:!0}))})}function ke(e,t){return w()?h("useMemo",{deps:t,value:void 0},({hook:r,isInit:n,isHMR:o})=>(l&&(r.dev={devtools:{get:()=>({value:r.value,dependencies:r.deps})}},o&&(n=!0)),(n||R(t,r.deps))&&(r.deps=t,r.value=e()),r.value)):e()}function I(e){return w()?h("useRef",{ref:{current:e}},({hook:t,isInit:r,isHMR:n})=>{if(l&&(r&&(t.dev={devtools:{get:()=>({value:t.ref.current}),set:({value:o})=>t.ref.current=o},initialArgs:[t.ref.current]}),n)){let[o]=t.dev.initialArgs;o!==e&&(t.ref={current:e},t.dev.initialArgs=[e])}return t.ref}):{current:e}}var Pa="window"in globalThis?window.__KIRU_LAZY_CACHE??(window.__KIRU_LAZY_CACHE=new Map):new Map;function _r(e){let[t,r]=ce(e.initialState||"exited"),n=I(null);re(()=>{e.in&&t!=="entered"&&t!=="entering"?(o("entering"),s("entered")):!e.in&&t!=="exited"&&t!=="exiting"&&(o("exiting"),s("exited"))},[e.in,t]),N(()=>()=>kr(n.current),[]);let o=Q(i=>{kr(n.current),r(i),(i==="entered"||i==="exited")&&e.onTransitionEnd&&e.onTransitionEnd(i)},[]),s=Q(i=>{n.current=window.setTimeout(()=>o(i),Rn(i,e.duration))},[e.duration]);return e.element(t)}var Sr=150;function Rn(e,t){if(typeof t=="number")return t;switch(e){case"entered":return t?.in??Sr;case"exited":return t?.out??Sr}}function kr(e){e!=null&&window.clearTimeout(e)}var Cr=()=>f("svg",{xmlns:"http://www.w3.org/2000/svg",width:20,height:20,viewBox:"0 0 24 24",fill:"none",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},f("path",{d:"M8.5 14.5A2.5 2.5 0 0 0 11 12c0-1.38-.5-2-1-3-1.072-2.143-.224-4.054 2-6 .5 2.5 2 4.9 4 6.5 2 1.6 3 3.5 3 5.5a7 7 0 1 1-14 0c0-1.153.433-2.294 1-3a2.5 2.5 0 0 0 2.5 2.5z"}));var He="kiru.devtools.anchorPosition",Tr={x:-16,y:-16};var xt=(e,t,r)=>{if(!t.current)return{...Tr};let n=window.innerWidth/e.width,o=window.innerHeight/e.height,s=null,i=null;return e.snapSide==="left"?s=(t.current.offsetWidth-r.width.value)*-1+16:e.snapSide==="right"?s=-16:e.snapSide==="bottom"?i=-16:e.snapSide==="top"&&(i=(window.innerHeight-r.height.value)*-1+16),{x:s??e.x*n,y:i??e.y*o}},Ar=e=>{if(e==null)return null;let t=null,r=e?.__kiruNode?.parent;for(;r;){if(typeof r.type=="function"&&!Pt(r)){t=r;break}r=r.parent}return t},Mr=(e,t)=>{let r=[],n=[t.__kiruNode];for(;n.length;){let s=n.pop();if(s===e)break;s?.dom&&r.push(s),s?.parent&&n.push(s.parent)}if(r.length===0)return;let o=r[r.length-1].dom;return o instanceof Element?o:void 0};var Or={arrayChunkSize:10,objectKeysChunkSize:100};function Pr(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;let r=new Set([...Object.keys(e),...Object.keys(t)]);for(let n in r)if(typeof t[n]!=typeof e[n]||typeof e[n]=="object"&&!Pr(e[n],t[n]))return!1;return!0}var Dn={...Or},Rr=localStorage.getItem("kiru.devtools.userSettings");if(Rr)try{let e=JSON.parse(Rr);Pr(Or,e)&&(Dn=e)}catch(e){console.error("kiru.devtools.userSettings error",e)}var _u=Er({userSettings:null,saveUserSettings:()=>{}});var Pu=Object.freeze(()=>{});var Hn="kiru-devtools";"window"in globalThis&&(window.__devtoolsSelection??(window.__devtoolsSelection=null));var Et=class extends BroadcastChannel{send(t){super.postMessage(t)}removeEventListener(t){return super.removeEventListener("message",t)}addEventListener(t){return super.addEventListener("message",t)}},P=new Et(Hn);var tc=Symbol.for("devtools.hookGroup");var L=(e,t,r={})=>{N(()=>{let n=window,o=r?.ref?.();return o?n=o:r.ref&&console.warn("useEventListener ref failed, using window"),n.addEventListener(e,t,r),()=>{n.removeEventListener(e,t,r)}},[t])};var Fe=()=>{let e=x({x:0,y:0}),t=x({x:0,y:0}),r=x({x:0,y:0});return L("mousemove",n=>{e.value={x:n.x,y:n.y},t.value={x:n.movementX,y:n.movementY},r.value={x:n.clientX,y:n.clientY}}),{mouse:e,delta:t,client:r}};var Ne="window"in globalThis&&"ResizeObserver"in globalThis.window,Dr=(e,t,r=void 0)=>w()?Ne?h("useResizeObserver",{resizeObserver:null,deps:[e.current]},({isInit:n,hook:o,queueEffect:s})=>(n&&(o.resizeObserver=new ResizeObserver(t),o.cleanup=()=>{o.resizeObserver?.disconnect?.(),o.resizeObserver=null}),s(()=>{R([e.current],o.deps)&&(o.deps=[e.current],o.resizeObserver?.disconnect?.(),e.current&&o.resizeObserver?.observe(e.current,r))}),{isSupported:Ne,start:()=>{o.resizeObserver==null&&(o.resizeObserver=new ResizeObserver(t),e.current&&o.resizeObserver.observe(e.current,r),o.cleanup=()=>{o.resizeObserver?.disconnect?.(),o.resizeObserver=null})},stop:()=>{F(o)}})):{isSupported:Ne,start:()=>{},stop:()=>{}}:{isSupported:Ne,start:()=>{},stop:()=>{}};var Ie="window"in globalThis&&"MutationObserver"in globalThis.window,Lr=(e,t,r=void 0)=>w()?Ie?h("useMutationObserver",{mutationObserver:null,deps:[e.current]},({isInit:n,hook:o,queueEffect:s})=>(n?(s(()=>{o.deps=[e.current],o.mutationObserver=new MutationObserver(t),e.current&&o.mutationObserver.observe(e.current,r)}),o.cleanup=()=>{o.mutationObserver?.disconnect?.(),o.mutationObserver=null}):R([e.current],o.deps)&&(o.deps=[e.current],o.mutationObserver?.disconnect?.(),e.current&&o.mutationObserver?.observe(e.current,r)),{isSupported:Ie,start:()=>{o.mutationObserver==null&&(o.mutationObserver=new MutationObserver(t),e.current&&o.mutationObserver.observe(e.current,r),o.cleanup=()=>{o.mutationObserver?.disconnect?.(),o.mutationObserver=null})},stop:()=>{F(o)}})):{isSupported:Ie,start:()=>{},stop:()=>{}}:{isSupported:Ie,start:()=>{},stop:()=>{}};var ze=(e,t={windowScroll:!0,windowResize:!0})=>{let r=t?.windowScroll??!0,n=t?.windowResize??!0,o=t.immediate??!0,s=x(0),i=x(0),a=x(0),u=x(0),c=x(0),m=x(0),E=x(0),S=x(0),d=()=>{let g=e.current;if(!g){s.value=0,i.value=0,a.value=0,u.value=0,c.value=0,m.value=0,E.value=0,S.value=0;return}let p=g.getBoundingClientRect();s.value=p.width,i.value=p.height,a.value=p.top,u.value=p.right,c.value=p.bottom,m.value=p.left,E.value=p.x,S.value=p.y};return Dr(e,d),Lr(e,d,{attributeFilter:["style","class"]}),L("scroll",()=>{r&&d()},{capture:!0,passive:!0}),L("resize",()=>{n&&d()},{passive:!0}),re(()=>{o&&d()},[]),{width:s,height:i,top:a,right:u,bottom:c,left:m,x:E,y:S,update:d}};var Vr=(e,t)=>{if(!w())return{isActive:t?.immediate??!1,start:()=>null,stop:()=>null};let r=t?.fpsLimit?1e3/t.fpsLimit:null;return h("useRafFn",()=>({callback:e,refId:null,previousFrameTimestamp:0,isActive:t?.immediate??!1,rafLoop:()=>{}}),({isInit:n,hook:o,update:s})=>(o.callback=e,n&&(o.rafLoop=i=>{if(o.isActive===!1)return;o.previousFrameTimestamp||(o.previousFrameTimestamp=i);let a=i-o.previousFrameTimestamp;if(r&&a<r){o.refId=window.requestAnimationFrame(o.rafLoop);return}o.previousFrameTimestamp=i,o.callback({delta:a,timestamp:i}),o.refId=window.requestAnimationFrame(o.rafLoop)}),n&&t?.immediate&&(o.isActive=!0,o.refId=window.requestAnimationFrame(o.rafLoop),o.cleanup=()=>{o.refId!=null&&window.cancelAnimationFrame(o.refId),o.isActive=!1},s()),{isActive:o.isActive,start:()=>{o.isActive!==!0&&(o.isActive=!0,o.refId=window.requestAnimationFrame(o.rafLoop),o.cleanup=()=>{o.refId!=null&&window.cancelAnimationFrame(o.refId),o.isActive=!1},s())},stop:()=>{F(o),s()}}))};var $r=e=>{let{x:t,y:r,multiple:n,immediate:o=!0}=e,s=x(null),a=Vr(()=>{s.value=n?document.elementsFromPoint(t,r)??[]:document.elementFromPoint(t,r)??null},{immediate:o});return{element:s,...a}};var Hr=()=>{let{mouse:e}=Fe(),t=x(null),r=I(null),n=I(null),o=ze(r),s=x({x:-16,y:-16}),i=x({x:-16,y:-16}),a=x({width:window.innerWidth,height:window.innerHeight}),u=x("bottom"),c=I(null);re(()=>{let d=localStorage.getItem(He);if(d==null)return;let g=JSON.parse(d);a.value.width=window.innerWidth,a.value.height=window.innerHeight,u.value=g.snapSide,i.value=xt(g,n,o)},[Math.round(o.width.value),Math.round(o.height.value)]);let m=vt(()=>{let{x:d,y:g}=e.value;if(t.value===null)return null;let{x:p,y:v}=t.value;return{x:d-p,y:g-v}});L("dragstart",d=>{d.preventDefault(),t.value={x:d.x,y:d.y},s.value=i.value},{ref:()=>r.current}),L("mouseup",()=>{c.current&&(clearTimeout(c.current),c.current=null),t.peek()&&(t.value=null,localStorage.setItem(He,JSON.stringify({...i.value,...a.value,snapSide:u.value})))});let E=Q(()=>{if(n.current==null)return;let d=n.current.offsetWidth;if(u.value==="right"){let g=Math.min(-16,i.value.y);i.value={x:-16,y:Math.max(g,(window.innerHeight-o.height.value)*-1+16)}}else if(u.value==="left"){let g=Math.min(0,i.value.y);i.value={x:(d-o.width.value)*-1+16,y:Math.max(g,(window.innerHeight-o.height.value)*-1+16)}}else if(u.value==="top"){let g=Math.min(-16,i.value.x);i.value={x:Math.max(g,(d-o.width.value)*-1+16),y:(window.innerHeight-o.height.value)*-1+16};return}else{let g=Math.min(-16,i.value.x);i.value={x:Math.max(g,(d-o.width.value)*-1+16),y:-16}}},[]);Se([m,e],(d,g)=>{if(d===null||!n.current)return;let{x:p,y:v}=g,fe=n.current.offsetWidth,ge=v>=window.innerHeight-100,kt=v<=100;if(!kt&&!ge){let ne=p>window.innerWidth/2;u.value=ne?"right":"left"}else u.value=kt?"top":"bottom";if(u.value==="right"){let ne=Math.min(-16,s.value.y+d.y);i.value={x:-16,y:Math.max(ne,(window.innerHeight-o.height.value)*-1+16)};return}else if(u.value==="left"){let ne=Math.min(0,s.value.y+d.y);i.value={x:(fe-o.width.value)*-1+16,y:Math.max(ne,(window.innerHeight-o.height.value)*-1+16)};return}else if(u.value==="top"){let ne=Math.min(-16,s.value.x+d.x);i.value={x:Math.max(ne,(fe-o.width.value)*-1+16),y:(window.innerHeight-o.height.value)*-1+16};return}let Wr=Math.min(-16,s.value.x+d.x);i.value={y:-16,x:Math.max(Wr,(fe-o.width.value)*-1+16)}});let S=Q(()=>{n.current!==null&&(i.value=xt({width:a.value.width,height:a.value.height,x:i.value.x,y:i.value.y,snapSide:u.value},n,o),a.value.width=window.innerWidth,a.value.height=window.innerHeight,localStorage.setItem(He,JSON.stringify({...i.value,...a.value,snapSide:u.value})))},[Math.round(o.width.value),Math.round(o.height.value)]);return L("resize",S),{anchorRef:r,anchorCoords:i,viewPortRef:n,startMouse:t,elementBound:o,snapSide:u,updateAnchorPos:E}};var z=Ve(!1);"window"in globalThis&&P.addEventListener(e=>{e.data.type==="set-inspect-enabled"&&(z.value=e.data.value)});var q=Ve(null);var Fr="kiru-devtools-popup-size",je=()=>{let e=q.value;return Q(()=>new Promise((r,n)=>{if(e)if(e.closed)q.value=null;else return e.focus(),r(e);let o=sessionStorage.getItem(Fr),s=o?JSON.parse(o):{width:Math.floor(Math.min(1920,window.screen.width)/2),height:Math.floor(Math.min(1080,window.screen.height)/2)},i=\`popup,width=\${s.width},height=\${s.height};\`,a=window.open(window.__KIRU_DEVTOOLS_PATHNAME__,"_blank",i);if(!a)return console.error("[kiru]: Unable to open devtools window"),n();let u=c=>{c.data.type==="ready"&&(P.removeEventListener(u),console.debug("[kiru]: devtools window opened"),r(a),q.value=a,a.onbeforeunload=()=>{console.debug("[kiru]: devtools window closed"),q.value=null})};P.addEventListener(u),a.onresize=()=>{sessionStorage.setItem(Fr,JSON.stringify({width:a.innerWidth,height:a.innerHeight}))}}),[e])};var Nr=()=>{let e=je(),{mouse:t}=Fe(),r=$r({x:t.value.x,y:t.value.y,immediate:!1}),n=r.element.value,o=z.value?n:null,s=ke(()=>{if(o&&window.__kiru){let c=window.__kiru.apps.find(m=>m.rootNode==null||o.__kiruNode==null?!1:Dt(m.rootNode,o.__kiruNode));return c?.rootNode==null?null:c}return null},[o]),i=ke(()=>o?Ar(o):null,[o]),a=I(null),u=ze(a);return N(()=>z.subscribe(m=>{r[m?"start":"stop"]()}),[]),N(()=>{i&&o?a.current=Mr(i,o)??null:a.current=null},[i,o]),L("click",c=>{if(z.value===!0&&i&&s){c.preventDefault();let m=E=>{E.__devtoolsSelection={node:i,app:s},P.send({type:"select-node"}),P.send({type:"set-inspect-enabled",value:!1}),z.value=!1,a.current=null,E.focus()};q.value?m(q.value):e().then(E=>m(E))}}),i&&f("div",{className:"bg-[crimson]/80 fixed grid place-content-center pointer-events-none z-10 top-0 left-0",style:{width:\`\${u?.width}px\`,height:\`\${u?.height}px\`,transform:\`translate(\${u.x}px, \${u.y}px)\`}},f("p",null,i.type.name))};function Ir(e){return f("svg",{xmlns:"http://www.w3.org/2000/svg",width:20,height:20,viewBox:"0 -960 960 960",fill:"currentColor",...e},f("path",{d:"M710-150q-63 0-106.5-43.5T560-300q0-63 43.5-106.5T710-450q63 0 106.5 43.5T860-300q0 63-43.5 106.5T710-150Zm0-80q29 0 49.5-20.5T780-300q0-29-20.5-49.5T710-370q-29 0-49.5 20.5T640-300q0 29 20.5 49.5T710-230Zm-270-30H200q-17 0-28.5-11.5T160-300q0-17 11.5-28.5T200-340h240q17 0 28.5 11.5T480-300q0 17-11.5 28.5T440-260ZM250-510q-63 0-106.5-43.5T100-660q0-63 43.5-106.5T250-810q63 0 106.5 43.5T400-660q0 63-43.5 106.5T250-510Zm0-80q29 0 49.5-20.5T320-660q0-29-20.5-49.5T250-730q-29 0-49.5 20.5T180-660q0 29 20.5 49.5T250-590Zm510-30H520q-17 0-28.5-11.5T480-660q0-17 11.5-28.5T520-700h240q17 0 28.5 11.5T800-660q0 17-11.5 28.5T760-620Zm-50 320ZM250-660Z"}))}function zr(e){return f("svg",{xmlns:"http://www.w3.org/2000/svg",width:20,height:20,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"lucide lucide-square-mouse-pointer",...e},f("path",{d:"M12.034 12.681a.498.498 0 0 1 .647-.647l9 3.5a.5.5 0 0 1-.033.943l-3.444 1.068a1 1 0 0 0-.66.66l-1.067 3.443a.5.5 0 0 1-.943.033z"}),f("path",{d:"M21 11V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h6"}))}var Fn=()=>{z.value=!z.value,P.send({type:"set-inspect-enabled",value:z.value})};function Nn(e,t){let{damping:r}=t,n=x(e),o=I(e);return N(()=>{let s=null,i=()=>{if(Math.sqrt(Math.pow(o.current.x-n.value.x,2)+Math.pow(o.current.y-n.value.y,2))<5)return;let u=n.value.x+(o.current.x-n.value.x)*r,c=n.value.y+(o.current.y-n.value.y)*r;n.value={x:u,y:c},s=window.requestAnimationFrame(i)};return s=window.requestAnimationFrame(i),()=>{s!=null&&window.cancelAnimationFrame(s)}},[e.x,e.y]),Object.assign(n,{set:(s,i)=>{o.current=s,i?.hard&&(n.value=s)}})}function St(){let e=x(!1),t=je(),{anchorCoords:r,anchorRef:n,viewPortRef:o,startMouse:s,snapSide:i}=Hr(),a=i.value==="left"||i.value==="right",u=I(!1),c=Nn(r.value,{damping:.4});return Se([r],c.set),re(()=>{u.current===!1&&c.set(r.value,{hard:!0}),u.current=!0},[]),f(Z,null,f("div",{ref:o,className:"w-full h-0 fixed top-0 left-0 z-[-9999] overflow-scroll pointer-events-none"}),f("div",{ref:n,draggable:!0,className:\`flex \${a?"flex-col":""} \${e.value?"rounded-3xl":"rounded-full"} p-1 gap-1 items-center will-change-transform bg-crimson\`,style:{transform:\`translate3d(\${Math.round(c.value.x)}px, \${Math.round(c.value.y)}px, 0)\`}},f(_r,{in:e.value,duration:{in:40,out:150},element:m=>{if(m==="exited")return null;let E=m==="entered"?"1":"0.5",S=m==="entered"?"1":"0";return f(Z,null,f("button",{title:"Open Devtools",onclick:t,style:{transform:\`scale(\${E})\`,opacity:S},className:"transition text-white rounded-full p-1 hover:bg-[#0003]"},f(Ir,{width:16,height:16})),f("button",{title:"Toggle Component Inspection",onclick:Fn,style:{transform:\`scale(\${E})\`,opacity:S},className:\`transition text-white rounded-full p-1 hover:bg-[#0003] \${z.value?"bg-[#0003]":""}\`},f(zr,{width:16,height:16})))}}),f("button",{className:"bg-crimson rounded-full p-1"+(s.value?" pointer-events-none":""),onclick:()=>e.value=!e.value,tabIndex:-1},f(Cr,null))),f(Nr,null))}var jr=\`*, ::before, ::after {
|
|
1769
|
+
\`}function zr(e){let t=Mt(e);if(l){let r=jr(e);r&&(t=\`\${t} (\${r})\`)}return t}function Mt(e){return e.displayName??(e.name||"Anonymous Function")}function jr(e){return e.toString().match(/\\/\\/ \\[kiru_devtools\\]:(.*)/)?.[1]??null}var ge={stack:new Array,current:function(){return this.stack[this.stack.length-1]}},$=new Map,H=new Map;function ee(e,t=!1){return w.isSignal(e)?t?e.value:e.peek():e}var Xe=()=>{$.forEach(e=>e()),$.clear()};var ae={parentStack:[],childIdxStack:[],eventDeferrals:new Map,parent:function(){return this.parentStack[this.parentStack.length-1]},clear:function(){this.parentStack.length=0,this.childIdxStack.length=0},pop:function(){this.parentStack.pop(),this.childIdxStack.pop()},push:function(e){this.parentStack.push(e),this.childIdxStack.push(0)},currentChild:function(){return this.parentStack[this.parentStack.length-1].childNodes[this.childIdxStack[this.childIdxStack.length-1]]},nextChild:function(){return this.parentStack[this.parentStack.length-1].childNodes[this.childIdxStack[this.childIdxStack.length-1]++]},bumpChildIndex:function(){this.childIdxStack[this.childIdxStack.length-1]++},captureEvents:function(e){Rt(e,!0),this.eventDeferrals.set(e,[])},resetEvents:function(e){this.eventDeferrals.delete(e)},releaseEvents:function(e){Rt(e,!1);let t=this.eventDeferrals.get(e);for(;t?.length;)t.shift()()}},Kr=e=>{let t=e.target;!e.isTrusted||!t||ae.eventDeferrals.get(t)?.push(()=>t.dispatchEvent(e))},Rt=(e,t)=>{for(let r in e)if(r.startsWith("on")){let n=r.substring(2);e[t?"addEventListener":"removeEventListener"](n,Kr,{passive:!0})}};var tt=!1,Ye=!1,Ot=e=>{e.preventDefault(),e.stopPropagation(),Ye=!0},le=null;function Dt(){tt=!0,le=document.activeElement,le&&le!==document.body&&le.addEventListener("blur",Ot)}function Pt(){Ye&&(le.removeEventListener("blur",Ot),le.isConnected&&le.focus(),Ye=!1),tt=!1}function Je(e,t){if(typeof e=="function"){e(t);return}if(w.isSignal(e)){e.sneak(t),e.notify({filter:r=>typeof r=="function"});return}e.current=t}function Lt(e){let t=e.type;return t=="#text"?Ur(e):Be.has(t)?document.createElementNS("http://www.w3.org/2000/svg",t):document.createElement(t)}function Ur(e){let{nodeValue:t}=e.props;if(!w.isSignal(t))return document.createTextNode(t);let r=t.peek()??"",n=document.createTextNode(r);return Qe(e,n,t),n}function Wr(e,t,r){let n=Ze.get(e)??{},o=n[t]=s=>{if(tt){s.preventDefault(),s.stopPropagation();return}r(s)};return Ze.set(e,n),o}var Ze=new WeakMap;function Vt(e){let t=e.dom,r=e.prev?.props??{},n=e.props??{},o=new Set([...Object.keys(r),...Object.keys(n)]),s=S.current==="hydrate";o.forEach(i=>{let a=r[i],u=n[i];if(he.internalProps.includes(i)&&i!=="innerHTML"){i==="ref"&&a!==u&&(a&&Je(a,null),u&&Je(u,t));return}if(he.isEvent(i)){if(a!==u||S.current==="hydrate"){let c=i.replace(Ct,""),p=c==="focus"||c==="blur";i in r&&t.removeEventListener(c,p?Ze.get(e)?.[c]:a),i in n&&t.addEventListener(c,p?Wr(e,c,u):u)}return}if(!(t instanceof Text)){if(a===u||s&&t.getAttribute(i)===u)return;if(w.isSignal(a)&&e.cleanups){let c=e.cleanups[i];c&&(c(),delete e.cleanups[i])}if(w.isSignal(u))return Xr(e,t,i,u,a);Ce(t,i,u,a);return}w.isSignal(u)||t.nodeValue!==u&&(t.nodeValue=u)})}function Br(e){return e.multiple?Array.from(e.selectedOptions).map(t=>t.value):e.value}function $t(e,t){if(!e.multiple||t===void 0||t===null||t===""){e.value=t;return}Array.from(e.options).forEach(r=>{r.selected=t.indexOf(r.value)>-1})}var Gr={value:"input",checked:"change",open:"toggle",volume:"volumechange",playbackRate:"ratechange",currentTime:"timeupdate"},qr=["progress","meter","number","range"];function Xr(e,t,r,n,o){let s=e.cleanups??(e.cleanups={}),[i,a]=r.split(":");if(i!=="bind")return s[r]=n.subscribe((b,_)=>{Ce(t,r,b,_),l&&window.__kiru.profilingContext?.emit("signalAttrUpdate",Y(e))}),Ce(t,r,n.peek(),ee(o));let u=Gr[a];if(!u){l&&console.error(\`[kiru]: \${a} is not a valid element binding attribute.\`);return}let c=t instanceof HTMLSelectElement,p=c?b=>$t(t,b):b=>t[a]=b,v=b=>{p(b),l&&window.__kiru.profilingContext?.emit("signalAttrUpdate",Y(e))},M=b=>{n.sneak(b),n.notify({filter:_=>_!==v})},h;if(a==="value"){let b=qr.indexOf(t.type)!==-1;h=()=>{let _=t.value;c?_=Br(t):typeof n.peek()=="number"&&b&&(_=t.valueAsNumber),M(_)}}else h=b=>{let _=b.target[a];a==="currentTime"&&n.peek()===_||M(_)};t.addEventListener(u,h);let x=n.subscribe(v);return s[r]=()=>{t.removeEventListener(u,h),x()},Ce(t,a,n.peek(),ee(o))}function Qe(e,t,r){(e.cleanups??(e.cleanups={})).nodeValue=r.subscribe((n,o)=>{n!==o&&(t.nodeValue=n,l&&window.__kiru.profilingContext?.emit("signalTextUpdate",Y(e)))})}function Ht(e){let t=ae.nextChild();if(!t)throw new E({message:"Hydration mismatch - no node found",vNode:e});let r=t.nodeName;if(Be.has(r)||(r=r.toLowerCase()),e.type!==r)throw new E({message:\`Hydration mismatch - expected node of type \${e.type.toString()} but received \${r}\`,vNode:e});if(e.dom=t,e.type!=="#text"&&!(e.flags&V)){Vt(e);return}w.isSignal(e.props.nodeValue)&&Qe(e,t,e.props.nodeValue);let n=e,o=e.sibling;for(;o&&o.type==="#text";){let s=o;ae.bumpChildIndex();let i=String(ee(n.props.nodeValue)??""),a=n.dom.splitText(i.length);s.dom=a,w.isSignal(s.props.nodeValue)&&Qe(s,a,s.props.nodeValue),n=o,o=o.sibling}}function Ft(e,t,r,n=!1){if(r===null)return e.removeAttribute(t),!0;switch(typeof r){case"undefined":case"function":case"symbol":return e.removeAttribute(t),!0;case"boolean":if(n&&!r)return e.removeAttribute(t),!0}return!1}function Yr(e,t,r){let n=Ge.has(t);Ft(e,t,r,n)||e.setAttribute(t,n&&typeof r=="boolean"?"":String(r))}var Jr=["INPUT","TEXTAREA"],Zr=e=>Jr.indexOf(e.nodeName)>-1;function Ce(e,t,r,n){if(r!==n)switch(t){case"style":return tn(e,r,n);case"className":return en(e,r);case"innerHTML":return Qr(e,r);case"muted":e.muted=!!r;return;case"value":if(e.nodeName==="SELECT")return $t(e,r);let o=r==null?"":String(r);if(Zr(e)){e.value=o;return}e.setAttribute("value",o);return;case"checked":if(e.nodeName==="INPUT"){e.checked=!!r;return}e.setAttribute("checked",String(r));return;default:return Yr(e,Ut(t),r)}}function Qr(e,t){if(t==null||typeof t=="boolean"){e.innerHTML="";return}e.innerHTML=String(t)}function en(e,t){let r=ee(t);if(!r)return e.removeAttribute("class");e.setAttribute("class",r)}function tn(e,t,r){if(Ft(e,"style",t))return;if(typeof t=="string"){e.setAttribute("style",t);return}let n={};typeof r=="string"?e.setAttribute("style",""):typeof r=="object"&&r&&(n=r);let o=t;new Set([...Object.keys(n),...Object.keys(o)]).forEach(i=>{let a=n[i],u=o[i];if(a!==u){if(u===void 0){e.style[i]="";return}e.style[i]=u}})}function rn(e){let t=e.parent,r=t?.dom;for(;t&&!r;)t=t.parent,r=t?.dom;if(!r||!t){if(!e.parent&&e.dom)return e;throw new E({message:"No DOM parent found while attempting to place node.",vNode:e})}return t}function nn(e,t){let{node:r,lastChild:n}=t,o=e.dom;if(n){n.after(o);return}let s=Nt(e,r);if(s){r.dom.insertBefore(o,s);return}r.dom.appendChild(o)}function Nt(e,t){let r=e;for(;r;){let n=r.sibling;for(;n;){if(!(n.flags&(C|V))){let o=on(n);if(o?.isConnected)return o}n=n.sibling}if(r=r.parent,!r||r.flags&V||r===t)return}}function on(e){let t=e;for(;t;){if(t.dom)return t.dom;if(t.flags&V)return;t=t.child}}function It(e){if(S.current==="hydrate")return J(e,we);let t={node:e.dom?e:rn(e)};et(e,t,(e.flags&C)>0),e.dom&&!(e.flags&V)&&zt(e,t,!1),we(e)}function et(e,t,r){let n=e.child;for(;n;){if(n.flags&me){n.flags&C&&sn(n,t),we(n),n=n.sibling;continue}n.dom?(et(n,{node:n},!1),n.flags&V||zt(n,t,r)):et(n,t,(n.flags&C)>0||r),we(n),n=n.sibling}}function zt(e,t,r){(r||!e.dom.isConnected||e.flags&C)&&nn(e,t),(!e.prev||e.flags&O)&&Vt(e),t.lastChild=e.dom}function jt(e){e===e.parent?.child&&(e.parent.child=e.sibling);let t;l&&(t=Y(e)),J(e,r=>{let{hooks:n,subs:o,cleanups:s,dom:i,props:{ref:a}}=r;for(o?.forEach(u=>u()),s&&Object.values(s).forEach(u=>u());n?.length;)n.pop().cleanup?.();l&&(window.__kiru.profilingContext?.emit("removeNode",t),i instanceof Element&&delete i.__kiruNode),i&&(a&&Je(a,null),i.isConnected&&!(r.flags&V)&&i.remove(),delete r.dom)}),e.parent=null}function sn(e,t){if(!e.child)return;let r=[];if(Kt(e.child,r),r.length===0)return;let{node:n,lastChild:o}=t;if(o)o.after(...r);else{let s=Nt(e,n),i=n.dom;s?s.before(...r):i.append(...r)}t.lastChild=r[r.length-1]}function Kt(e,t){let r=e;for(;r;)r.dom?t.push(r.dom):r.child&&Kt(r.child,t),r=r.sibling}function Wt(e){return typeof e=="function"&&typeof e[ke]?.arePropsEqual=="function"}function f(e,t=null,...r){if(e===Z)return Z({children:r,...t});let n={type:e,flags:0,index:0,depth:0,props:{},parent:null,sibling:null,child:null,prev:null,deletions:null};if(Wt(e)&&(n.flags|=_e,n.arePropsEqual=e[ke].arePropsEqual),t!==null){let{key:s,ref:i,...a}=t;Bt(s)&&(n.props.key=s.toString()),Gt(i)&&(n.props.ref=i),Object.assign(n.props,a)}let o=r.length===1?r[0]:r.length>1?r:null;return o!==null&&(n.props.children=o),n}function Z({children:e,key:t}){return f(q,t?{key:t}:null,e)}var ot;function Me(e,t){return l&&(ot=Y(e)),Array.isArray(t)?(l&&(tr in t&&fn(e,t),cn(e,t)),ln(e,t)):an(e,t)}function an(e,t){let r=e.child;if(r===null)return Jt(e,t);let n=r.sibling,o=Xt(e,r,t);if(o!==null)return r&&r!==o&&!o.prev?nt(e,r):n&&nt(e,n),o;{let s=rr(r),i=Zt(s,e,0,t);if(i!==null){let a=i.prev;if(a!==null){let u=a.props.key;s.delete(u===void 0?a.index:u)}Te(i,0,0)}return s.forEach(a=>Ae(e,a)),i}}function ln(e,t){let r=null,n=null,o=e.child,s=null,i=0,a=0;for(;o!==null&&a<t.length;a++){o.index>a?(s=o,o=null):s=o.sibling;let c=Xt(e,o,t[a]);if(c===null){o===null&&(o=s);break}o&&!c.prev&&Ae(e,o),i=Te(c,i,a),n===null?r=c:n.sibling=c,n=c,o=s}if(a===t.length)return nt(e,o),r;if(o===null){for(;a<t.length;a++){let c=Jt(e,t[a]);c!==null&&(i=Te(c,i,a),n===null?r=c:n.sibling=c,n=c)}return r}let u=rr(o);for(;a<t.length;a++){let c=Zt(u,e,a,t[a]);if(c!==null){let p=c.prev;if(p!==null){let v=p.props.key;u.delete(v===void 0?p.index:v)}i=Te(c,i,a),n===null?r=c:n.sibling=c,n=c}}return u.forEach(c=>Ae(e,c)),r}function Xt(e,t,r){let n=t?.props.key;return Qt(r)?n!==void 0||t?.type==="#text"&&w.isSignal(t.props.nodeValue)?null:qt(e,t,""+r):w.isSignal(r)?t&&t.props.nodeValue!==r?null:qt(e,t,r):ue(r)?r.props.key!==n?null:un(e,t,r):Array.isArray(r)?n!==void 0?null:(l&&it(r),Yt(e,t,r)):null}function qt(e,t,r){if(t===null||t.type!=="#text"){l&&U();let o=f("#text",{nodeValue:r});return K(o,e),o}return l&&be(),t.props.nodeValue!==r&&(t.props.nodeValue=r,t.flags|=O),t.sibling=null,t}function un(e,t,r){let{type:n,props:o}=r;if(l&&typeof n=="function"&&(n=k(n)),n===q)return Yt(e,t,o.children||[],o);if(t?.type===n)return l&&be(),t.index=0,t.sibling=null,typeof n=="string"?er(t.props,o)&&(t.flags|=O):t.flags|=O,t.props=o,t.memoizedProps=r.memoizedProps,t;l&&U();let s=f(n,o);return K(s,e),s}function Yt(e,t,r,n={}){if(t===null||t.type!==q){l&&U();let o=f(q,{children:r,...n});return K(o,e),o}return l&&be(),t.props={...t.props,...n,children:r},t.flags|=O,t.sibling=null,t}function Jt(e,t){if(Qt(t)){l&&U();let r=f("#text",{nodeValue:""+t});return K(r,e),r}if(w.isSignal(t)){l&&U();let r=f("#text",{nodeValue:t});return K(r,e),r}if(ue(t)){l&&U();let r=f(t.type,t.props);return K(r,e),r.flags|=C,r}if(Array.isArray(t)){l&&(U(),it(t));let r=Z({children:t});return K(r,e),r}return null}function Te(e,t,r){e.index=r;let n=e.prev;if(n!==null){let o=n.index;return o<t?(e.flags|=C,t):o}else return e.flags|=C,t}function Zt(e,t,r,n){if(w.isSignal(n)||typeof n=="string"&&n!==""||typeof n=="number"||typeof n=="bigint"){let s=e.get(r);if(s){if(s.props.nodeValue===n)return s;s.type==="#text"&&w.isSignal(s.props.nodeValue)&&s.cleanups?.nodeValue?.()}l&&U();let i=f("#text",{nodeValue:n});return K(i,t),i.flags|=C,i.index=r,i}if(ue(n)){let{type:s,props:i}=n,a=i.key,u=e.get(a===void 0?r:a);if(u?.type===s)return l&&be(),typeof s=="string"?er(u.props,i)&&(u.flags|=O):u.flags|=O,u.props=i,u.sibling=null,u.index=r,u;l&&U();let c=f(n.type,n.props);return K(c,t),c.flags|=C,c.index=r,c}if(Array.isArray(n)){let s=e.get(r);if(l&&it(n),s)return l&&be(),s.flags|=O,s.props.children=n,s;l&&U();let i=Z({children:n});return K(i,t),i.flags|=C,i.index=r,i}return null}function Qt(e){return typeof e=="string"&&e!==""||typeof e=="number"||typeof e=="bigint"}function er(e,t){let r=Object.keys(e),n=Object.keys(t);if(r.length!==n.length)return!0;for(let o of r)if(!(o==="children"||o==="key")&&e[o]!==t[o])return!0;return!1}function K(e,t){e.parent=t,e.depth=t.depth+1}function be(){"window"in globalThis&&window.__kiru.profilingContext?.emit("updateNode",ot)}function U(){"window"in globalThis&&window.__kiru.profilingContext?.emit("createNode",ot)}var tr=Symbol("kiru:marked-list-child");function it(e){Object.assign(e,{[tr]:!0})}function rr(e){let t=new Map;for(;e;){let r=e.props.key;t.set(r===void 0?e.index:r,e),e=e.sibling}return t}function Ae(e,t){e.deletions===null?e.deletions=[t]:e.deletions.push(t)}function nt(e,t){for(;t;)Ae(e,t),t=t.sibling}function cn(e,t){let r=new Set,n=!1;for(let o of t){if(!ue(o))continue;let s=o.props.key;if(typeof s=="string"){if(!n&&r.has(s)){let i=or(e);nr(\`\${i} component produced a child in a list with a duplicate key prop: "\${s}". Keys should be unique so that components maintain their identity across updates\`),n=!0}r.add(s)}}}function fn(e,t){let r=!1,n=!1;for(let o of t){if(!ue(o))continue;typeof o.props.key=="string"?r=!0:n=!0}if(n&&r){let o=or(e);nr(\`\${o} component produced a child in a list without a valid key prop\`)}}function nr(e){let t=\`[kiru]: \${e}. See https://kirujs.dev/keys-warning for more information.\`;console.error(t)}var rt=new WeakMap;function or(e){if(rt.has(e))return rt.get(e);let t=e.parent,r;for(;!r&&t;)typeof t.type=="function"&&(r=t.type),t=t.parent;let n=\`<\${r?.displayName||r?.name||"Anonymous Function"} />\`;return rt.set(e,n),n}var W,B=[],pe=!1,at=[],Re=[],lt=!1,ut=!1,ct=!1,ft=0,ir=[],pt=[],sr=-1;function mt(e){if(pe){at.push(e);return}e()}function Oe(){pe&&(window.cancelAnimationFrame(sr),ar())}function gt(e){e.flags|=se,B.push(e),pe=!0,Oe()}function D(e){if(S.current==="hydrate")return mt(()=>dt(e));dt(e)}function pn(){pe||(pe=!0,sr=window.requestAnimationFrame(ar))}function dn(){for(pe=!1;at.length;)at.shift()()}function dt(e){if(lt&&(ut=!0),T.current===e){l&&window.__kiru.profilingContext?.emit("updateDirtied",W),ct=!0;return}if(!(e.flags&(se|fe))){if(e.flags|=se,!B.length)return B.push(e),pn();B.push(e)}}function mn(e){J(e,t=>t.flags|=fe),Re.push(e)}var gn=(e,t)=>t.depth-e.depth,te=null;function ar(){if(l){let t=Re[0]??B[0];t?(W=Y(t),window.__kiru.profilingContext?.beginTick(W)):W=null}let e=1;for(Dt();B.length;){B.length>e&&B.sort(gn),te=B.shift(),e=B.length;let t=te.flags;if(!(t&fe)&&t&se){let r=te;for(;r=hn(r););for(;Re.length;)jt(Re.pop());It(te),te.flags&=~se}}if(Pt(),lt=!0,st(ir),lt=!1,ut)return vn(),st(pt),ut=!1,ft++,l&&(window.__kiru.profilingContext?.endTick(W),window.__kiru.profilingContext?.emit("updateDirtied",W)),Oe();ft=0,dn(),st(pt),l&&(window.__kiru.emit("update",W),window.__kiru.profilingContext?.emit("update",W),window.__kiru.profilingContext?.endTick(W))}function hn(e){let t=!0;try{typeof e.type=="string"?yn(e):ht(e.type)?wn(e):t=bn(e)}catch(n){l&&window.__kiru.emit("error",W,n instanceof Error?n:new Error(String(n)));let o=lr(e);if(o){let s=o.error=n instanceof Error?n:new Error(String(n));return o.props.onError?.(s),o.depth<te.depth&&(te=o),o}if(E.isKiruError(n)){if(n.customNodeStack&&setTimeout(()=>{throw new Error(n.customNodeStack)}),n.fatal)throw n;console.error(n);return}setTimeout(()=>{throw n})}if(e.deletions!==null&&(e.deletions.forEach(mn),e.deletions=null),t&&e.child)return e.child;let r=e;for(;r;){if(r.immediateEffects&&(ir.push(...r.immediateEffects),r.immediateEffects=void 0),r.effects&&(pt.push(...r.effects),r.effects=void 0),r===te)return;if(r.sibling)return r.sibling;r=r.parent,S.current==="hydrate"&&r?.dom&&ae.pop()}}function wn(e){let{props:t,type:r}=e,n=t.children;if(r===oe){let{props:{dependents:o,value:s},prev:i}=e;o.size&&i&&i.props.value!==s&&o.forEach(dt)}else if(r===ie){let o=e,{error:s}=o;s&&(n=typeof t.fallback=="function"?t.fallback(s):t.fallback,delete o.error)}e.child=Me(e,n)}function bn(e){let{type:t,props:r,subs:n,prev:o,flags:s}=e;if(s&_e){if(e.memoizedProps=r,o?.memoizedProps&&e.arePropsEqual(o.memoizedProps,r)&&!e.hmrUpdated)return e.flags|=me,!1;e.flags&=~me}try{T.current=e;let i,a=0;do{if(e.flags&=~se,ct=!1,X.current=0,n&&(n.forEach(u=>u()),n.clear()),l){if(i=k(t)(r),e.hmrUpdated&&e.hooks&&e.hookSig){let u=e.hooks.length;if(X.current<u){for(let c=X.current;c<u;c++)e.hooks[c].cleanup?.();e.hooks.length=X.current,e.hookSig.length=X.current}}if(delete e.hmrUpdated,++a>We)throw new E({message:"Too many re-renders. Kiru limits the number of renders to prevent an infinite loop.",fatal:!0,vNode:e});continue}i=t(r)}while(ct);return e.child=Me(e,i),!0}finally{T.current=null}}function yn(e){let{props:t,type:r}=e;l&&wt(e),e.dom||(S.current==="hydrate"?Ht(e):e.dom=Lt(e),l&&e.dom instanceof Element&&(e.dom.__kiruNode=e)),r!=="#text"&&(e.child=Me(e,t.children),e.child&&S.current==="hydrate"&&ae.push(e.dom))}function vn(){if(ft>We)throw new E("Maximum update depth exceeded. This can happen when a component repeatedly calls setState during render or in useLayoutEffect. Kiru limits the number of nested updates to prevent infinite loops.")}function st(e){for(let t=0;t<e.length;t++)e[t]();e.length=0}var ur;(function(e){e.Start="start",e.End="end"})(ur||(ur={}));var de=null,cr=new Set;function d(e,t,r){let n=T.current;if(n||xn(e),l&&de!==null&&!cr.has(e+de))throw cr.add(e+de),new E({message:\`Nested primitive "useHook" calls are not supported. "\${e}" was called inside "\${de}". Strange will most certainly happen.\`,vNode:n});let o=(a,u)=>{if(u?.immediate){(n.immediateEffects??(n.immediateEffects=[])).push(a);return}(n.effects??(n.effects=[])).push(a)},s=X.current++,i=n.hooks?.at(s);if(l){de=e,n.hooks??(n.hooks=[]),n.hookSig??(n.hookSig=[]),n.hookSig[s]?n.hookSig[s]!==e&&(console.warn(\`[kiru]: hooks must be called in the same order. Hook "\${e}" was called in place of "\${n.hookSig[s]}". Strange things may happen.\`),i?.cleanup?.(),n.hooks.length=s,n.hookSig.length=s,i=void 0):n.hookSig[s]=e;let a;i?a=i:(a=typeof t=="function"?t():{...t},a.name=e),n.hooks[s]=a;try{return r({hook:a,isInit:!i,isHMR:n.hmrUpdated,update:()=>D(n),queueEffect:o,vNode:n,index:s})}catch(u){throw u}finally{de=null}}try{let a=i??(typeof t=="function"?t():{...t});return n.hooks??(n.hooks=[]),n.hooks[s]=a,r({hook:a,isInit:!i,update:()=>D(n),queueEffect:o,vNode:n,index:s})}catch(a){throw a}}function xn(e){throw new E(\`Hook "\${e}" must be used at the top level of a component or inside another composite hook.\`)}function F(e){e.cleanup&&(e.cleanup(),e.cleanup=void 0)}function A(e,t){return e===void 0||t===void 0||e.length!==t.length||e.length>0&&t.some((r,n)=>!Object.is(r,e[n]))}var fr,w=class e{constructor(t,r){this[fr]=!0,this.$id=Pe(),this.$value=t,r&&(this.displayName=r),l?(H.set(this.$id,new Set),this.$initialValue=bt(t),this[L]={provide:()=>this,inject:n=>{H.get(this.$id)?.clear?.(),H.delete(this.$id),this.$id=n.$id,n.__next=this,this.$initialValue===n.$initialValue?this.$value=n.$value:this.notify()},destroy:()=>{}}):this.$subs=new Set}get value(){if(this.onBeforeRead?.(),l){let t=k(this);return e.entangle(t),t.$value}return e.entangle(this),this.$value}set value(t){if(l){let r=k(this);if(Object.is(r.$value,t))return;r.$prevValue=r.$value,r.$value=t,r.notify();return}Object.is(this.$value,t)||(this.$prevValue=this.$value,this.$value=t,this.notify())}peek(){return this.onBeforeRead?.(),l?k(this).$value:this.$value}sneak(t){if(l){let r=k(this);r.$prevValue=r.$value,r.$value=t;return}this.$prevValue=this.$value,this.$value=t}toString(){if(this.onBeforeRead?.(),l){let t=k(this);return e.entangle(t),\`\${t.$value}\`}return e.entangle(this),\`\${this.$value}\`}subscribe(t){return l?(H.get(this.$id).add(t),()=>H.get(this.$id)?.delete(t)):(this.$subs.add(t),()=>this.$subs.delete(t))}notify(t){if(l)return H.get(this.$id)?.forEach(r=>{if(t?.filter&&!t.filter(r))return;let{$value:n,$prevValue:o}=k(this);return r(n,o)});this.$subs.forEach(r=>{if(!(t?.filter&&!t.filter(r)))return r(this.$value,this.$prevValue)})}static isSignal(t){return typeof t=="object"&&!!t&&Ke in t}static subscribers(t){return l?H.get(t.$id):t.$subs}static makeReadonly(t){let r=Object.getOwnPropertyDescriptor(t,"value");return r&&!r.writable?t:Object.defineProperty(t,"value",{get:function(){return e.entangle(this),this.$value},configurable:!0})}static makeWritable(t){let r=Object.getOwnPropertyDescriptor(t,"value");return r&&r.writable?t:Object.defineProperty(t,"value",{get:function(){return e.entangle(this),this.$value},set:function(n){this.$value=n,this.notify()},configurable:!0})}static entangle(t){let r=T.current,n=ge.current();if(n){(!r||r&&m())&&n.set(t.$id,t);return}if(!r||!m())return;let o=t.subscribe(()=>D(r));(r.subs??(r.subs=new Set)).add(o)}static configure(t,r){t.onBeforeRead=r}static dispose(t){if(t.$isDisposed=!0,l){H.delete(t.$id);return}t.$subs.clear()}};fr=Ke;var De=(e,t)=>new w(e,t),y=(e,t)=>d("useSignal",{signal:null},({hook:r,isInit:n,isHMR:o})=>{if(l&&(n&&(r.dev={devtools:{get:()=>({displayName:r.signal.displayName,value:r.signal.peek()}),set:({value:s})=>{r.signal.value=s}},initialArgs:[e,t]}),o)){let[s,i]=r.dev.initialArgs;(s!==e||i!==t)&&(r.cleanup?.(),n=!0,r.dev.initialArgs=[e,t])}return n&&(r.cleanup=()=>w.dispose(r.signal),r.signal=new w(e,t)),r.signal});function Le(e){let{id:t,subs:r,fn:n,deps:o=[],onDepChanged:s}=e,i;$.delete(t);let a=!!T.current&&!m();a||(i=new Map,ge.stack.push(i));let u=n(...o.map(c=>c.value));if(!a){for(let[p,v]of r)i.has(p)||(v(),r.delete(p));let c=()=>{$.size||queueMicrotask(Xe),$.set(t,s)};for(let[p,v]of i){if(r.has(p))continue;let M=v.subscribe(c);r.set(p,M)}ge.stack.pop()}return u}var ye=class e extends w{constructor(t,r){if(super(void 0,r),this.$getter=t,this.$unsubs=new Map,this.$isDirty=!0,l){let n=this[L].inject;this[L]={provide:()=>this,inject:o=>{n(o),e.stop(o),this.$isDirty=o.$isDirty},destroy:()=>{}}}w.configure(this,()=>{this.$isDirty&&(l&&this.$isDisposed||e.run(this))})}get value(){return super.value}set value(t){}subscribe(t){return this.$isDirty&&e.run(this),super.subscribe(t)}static dispose(t){e.stop(t),w.dispose(t)}static stop(t){let{$id:r,$unsubs:n}=k(t);$.delete(r),n.forEach(o=>o()),n.clear(),t.$isDirty=!0}static run(t){let r=k(t),{$id:n,$getter:o,$unsubs:s}=r,i=Le({id:n,subs:s,fn:()=>o(r.$value),onDepChanged:()=>{if(r.$isDirty=!0,l){if(!H?.get(n)?.size)return}else if(!t.$subs.size)return;e.run(r),!Object.is(r.$value,r.$prevValue)&&r.notify()}});r.sneak(i),r.$isDirty=!1}},pr=(e,t)=>new ye(e,t),yt=(e,t)=>d("useComputedSignal",{signal:null},({hook:r,isInit:n,isHMR:o})=>(l&&(r.dev={devtools:{get:()=>({displayName:r.signal.displayName,value:r.signal.peek()})}},o&&(r.cleanup?.(),n=!0)),n&&(r.cleanup=()=>ye.dispose(r.signal),r.signal=pr(e,t)),r.signal));var ve=class e{constructor(t,r){if(this.id=Pe(),this.getter=t,this.deps=r,this.unsubs=new Map,this.isRunning=!1,this.cleanup=null,l&&(this[L]={provide:()=>this,inject:n=>{n.isRunning||this.stop()},destroy:()=>{this.stop()}},"window"in globalThis)){let n=window.__kiru.HMRContext.signals;n.isWaitingForNextWatchCall()&&n.pushWatch(this)}this.start()}start(){if(!this.isRunning){if(this.isRunning=!0,l&&"window"in globalThis&&window.__kiru.HMRContext?.isReplacement())return queueMicrotask(()=>{this.isRunning&&e.run(this)});e.run(this)}}stop(){$.delete(this.id),this.unsubs.forEach(t=>t()),this.unsubs.clear(),this.cleanup?.(),this.cleanup=null,this.isRunning=!1}static run(t){let r=k(t),{id:n,getter:o,unsubs:s,deps:i}=r;r.cleanup=Le({id:n,subs:s,fn:o,deps:i,onDepChanged:()=>{r.cleanup?.(),e.run(r)}})??null}};function dr(e,t){if(typeof e=="function")return new ve(e);let r=e,n=t;return new ve(n,r)}function xe(e,t){if(m())return d("useWatch",{watcher:null},({hook:r,isInit:n,isHMR:o})=>{if(l&&o&&(r.cleanup?.(),n=!0),n){let s=r.watcher=dr(e,t);r.cleanup=()=>s.stop()}return r.watcher})}var he={internalProps:["children","ref","key","innerHTML"],isEvent:e=>e.startsWith("on"),isProperty:e=>!he.internalProps.includes(e)&&!he.isEvent(e)};function Ut(e){switch(e){case"className":return"class";case"htmlFor":return"for";case"tabIndex":case"formAction":case"formMethod":case"formEncType":case"contentEditable":case"spellCheck":case"allowFullScreen":case"autoPlay":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"noModule":case"noValidate":case"popoverTarget":case"popoverTargetAction":case"playsInline":case"readOnly":case"itemscope":case"rowSpan":case"crossOrigin":return e.toLowerCase();default:return e.indexOf("-")>-1?e:e.startsWith("aria")?"aria-"+e.substring(4).toLowerCase():Tt.get(e)||e}}function bt(e,t={functions:!0}){let r=new WeakSet;return JSON.stringify(e,(n,o)=>{if(typeof o=="object"&&o!==null){if(r.has(o))return"[CIRCULAR]";r.add(o)}return typeof o=="function"?t.functions?o.toString():\`[FUNCTION (\${o.name||"anonymous"})]\`:o})}function k(e){let t=e;if(l)for(;"__next"in t;)t=t.__next;return t}function m(){return S.current==="dom"||S.current==="hydrate"}function ue(e){return typeof e=="object"&&e!==null&&"type"in e}function ht(e){return e===q||e===oe||e===ie}function mr(e){return e.type===q}function Y(e){let t=e;for(;t;){if(t.app)return e.app=t.app;t=t.parent}return null}function we(e){let{props:{children:t,...r},memoizedProps:n,index:o}=e;e.prev={props:r,memoizedProps:n,index:o},e.flags&=~(O|C|fe)}function gr(e,t){if(t.depth<e.depth)return!1;if(e===t)return!0;let r=!1,n=[e];for(;n.length;){let o=n.pop();if(o===t)return!0;o.child&&n.push(o.child),r&&o.sibling&&n.push(o.sibling),r=!0}return!1}function J(e,t){t(e);let r=e.child;for(;r;)t(r),r.child&&J(r,t),r=r.sibling}function qe(e,t){let r=e.parent;for(;r;){if(t(r))return r;r=r.parent}return null}function lr(e){return qe(e,t=>t.type===ie)}function wt(e){if("children"in e.props&&e.props.innerHTML)throw new E({message:"Cannot use both children and innerHTML on an element",vNode:e});for(let t in e.props)if("bind:"+t in e.props)throw new E({message:\`Cannot use both bind:\${t} and \${t} on an element\`,vNode:e})}function Bt(e){return typeof e=="string"||typeof e=="number"}function Gt(e){return typeof e=="function"||typeof e=="object"&&!!e&&"current"in e||w.isSignal(e)}var En="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz-";function Pe(e=10,t=En){let r="";for(let n=0;n<e;n++)r+=t[Math.random()*t.length|0];return r}var j=Object.freeze(()=>{});var Sn=0;function hr(e,t,r){if(l&&t.__kiruNode)throw new Error("[kiru]: container in use - call unmount on the previous app first.");let n=f(t.nodeName.toLowerCase(),{});l&&(t.__kiruNode=n),n.dom=t,n.flags|=V;let o=Sn++,s=r?.name??\`App-\${o}\`,i={id:o,name:s,rootNode:n,render:a,unmount:u};function a(c){n.props.children=c,gt(n)}function u(){n.props.children=null,gt(n),l&&(delete t.__kiruNode,delete n.app),window.__kiru.emit("unmount",i)}return l&&(n.app=i),a(e),window.__kiru.emit("mount",i),l&&queueMicrotask(()=>{window.dispatchEvent(new Event("kiru:ready"))}),i}function ce(e){return m()?d("useState",{state:void 0,dispatch:j},({hook:t,isInit:r,update:n,isHMR:o})=>{if(l&&(r&&(t.dev={devtools:{get:()=>({value:t.state}),set:({value:s})=>t.state=s},initialArgs:[e]}),o)){let[s]=t.dev.initialArgs;s!==e&&(r=!0,t.dev.initialArgs=[e])}return r&&(t.state=typeof e=="function"?e():e,t.dispatch=s=>{let i=typeof s=="function"?s(t.state):s;Object.is(t.state,i)||(t.state=i,n())}),[t.state,t.dispatch]}):[typeof e=="function"?e():e,j]}function wr(e){let t={[kt]:!0,Provider:({value:r,children:n})=>{let[o]=ce(()=>new Set);return f(oe,{value:r,ctx:t,dependents:o},typeof n=="function"?n(r):n)},default:()=>e,set displayName(r){this.Provider.displayName=r},get displayName(){return this.Provider.displayName||"Anonymous Context"}};if(l){let r=t;r[L]={inject:n=>{let o=t.Provider;window.__kiru.apps.forEach(s=>{J(s.rootNode,i=>{i.type===n.Provider&&(i.type=o,i.hmrUpdated=!0,D(i))})})},destroy:()=>{},provide:()=>t}}return t}function Q(e,t){return m()?d("useCallback",{callback:e,deps:t},({hook:r,isHMR:n})=>(l&&(r.dev={devtools:{get:()=>({callback:r.callback,dependencies:r.deps})}},n&&(r.deps=[])),A(t,r.deps)&&(r.deps=t,r.callback=e),r.callback)):e}function N(e,t){if(m())return d("useEffect",{deps:t},({hook:r,isInit:n,isHMR:o,queueEffect:s})=>{l&&(r.dev={devtools:{get:()=>({callback:e,dependencies:r.deps})}},o&&(n=!0)),(n||A(t,r.deps))&&(r.deps=t,F(r),s(()=>{let i=e();typeof i=="function"&&(r.cleanup=i)}))})}function re(e,t){if(m())return d("useLayoutEffect",{deps:t},({hook:r,isInit:n,isHMR:o,queueEffect:s})=>{l&&(r.dev={devtools:{get:()=>({callback:e,dependencies:r.deps})}},o&&(n=!0)),(n||A(t,r.deps))&&(r.deps=t,F(r),s(()=>{let i=e();typeof i=="function"&&(r.cleanup=i)},{immediate:!0}))})}function Ee(e,t){return m()?d("useMemo",{deps:t,value:void 0},({hook:r,isInit:n,isHMR:o})=>(l&&(r.dev={devtools:{get:()=>({value:r.value,dependencies:r.deps})}},o&&(n=!0)),(n||A(t,r.deps))&&(r.deps=t,r.value=e()),r.value)):e()}function I(e){return m()?d("useRef",{ref:{current:e}},({hook:t,isInit:r,isHMR:n})=>{if(l&&(r&&(t.dev={devtools:{get:()=>({value:t.ref.current}),set:({value:o})=>t.ref.current=o},initialArgs:[t.ref.current]}),n)){let[o]=t.dev.initialArgs;o!==e&&(t.ref={current:e},t.dev.initialArgs=[e])}return t.ref}):{current:e}}var Ma="window"in globalThis?window.__KIRU_LAZY_CACHE??(window.__KIRU_LAZY_CACHE=new Map):new Map;function vr(e){let[t,r]=ce(e.initialState||"exited"),n=I(null);re(()=>{e.in&&t!=="entered"&&t!=="entering"?(o("entering"),s("entered")):!e.in&&t!=="exited"&&t!=="exiting"&&(o("exiting"),s("exited"))},[e.in,t]),N(()=>()=>yr(n.current),[]);let o=Q(i=>{yr(n.current),r(i),(i==="entered"||i==="exited")&&e.onTransitionEnd&&e.onTransitionEnd(i)},[]),s=Q(i=>{n.current=window.setTimeout(()=>o(i),_n(i,e.duration))},[e.duration]);return e.element(t)}var br=150;function _n(e,t){if(typeof t=="number")return t;switch(e){case"entered":return t?.in??br;case"exited":return t?.out??br}}function yr(e){e!=null&&window.clearTimeout(e)}"window"in globalThis;var xr=()=>f("svg",{xmlns:"http://www.w3.org/2000/svg",width:20,height:20,viewBox:"0 0 24 24",fill:"none",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},f("path",{d:"M8.5 14.5A2.5 2.5 0 0 0 11 12c0-1.38-.5-2-1-3-1.072-2.143-.224-4.054 2-6 .5 2.5 2 4.9 4 6.5 2 1.6 3 3.5 3 5.5a7 7 0 1 1-14 0c0-1.153.433-2.294 1-3a2.5 2.5 0 0 0 2.5 2.5z"}));var Ve="kiru.devtools.anchorPosition",Er={x:-16,y:-16};var vt=(e,t,r)=>{if(!t.current)return{...Er};let n=window.innerWidth/e.width,o=window.innerHeight/e.height,s=null,i=null;return e.snapSide==="left"?s=(t.current.offsetWidth-r.width.value)*-1+16:e.snapSide==="right"?s=-16:e.snapSide==="bottom"?i=-16:e.snapSide==="top"&&(i=(window.innerHeight-r.height.value)*-1+16),{x:s??e.x*n,y:i??e.y*o}},Sr=e=>{if(e==null)return null;let t=null,r=e?.__kiruNode?.parent;for(;r;){if(typeof r.type=="function"&&!mr(r)){t=r;break}r=r.parent}return t},kr=(e,t)=>{let r=[],n=[t.__kiruNode];for(;n.length;){let s=n.pop();if(s===e)break;s?.dom&&r.push(s),s?.parent&&n.push(s.parent)}if(r.length===0)return;let o=r[r.length-1].dom;return o instanceof Element?o:void 0};var Cr={arrayChunkSize:10,objectKeysChunkSize:100};function Tr(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;let r=new Set([...Object.keys(e),...Object.keys(t)]);for(let n in r)if(typeof t[n]!=typeof e[n]||typeof e[n]=="object"&&!Tr(e[n],t[n]))return!1;return!0}var An={...Cr},_r=localStorage.getItem("kiru.devtools.userSettings");if(_r)try{let e=JSON.parse(_r);Tr(Cr,e)&&(An=e)}catch(e){console.error("kiru.devtools.userSettings error",e)}var ku=wr({userSettings:null,saveUserSettings:()=>{}});var Ou=Object.freeze(()=>{});var Dn="kiru-devtools";"window"in globalThis&&(window.__devtoolsSelection??(window.__devtoolsSelection=null));var xt=class extends BroadcastChannel{send(t){super.postMessage(t)}removeEventListener(t){return super.removeEventListener("message",t)}addEventListener(t){return super.addEventListener("message",t)}},R=new xt(Dn);var ec=Symbol.for("devtools.hookGroup");var P=(e,t,r={})=>{N(()=>{let n=window,o=r?.ref?.();return o?n=o:r.ref&&console.warn("useEventListener ref failed, using window"),n.addEventListener(e,t,r),()=>{n.removeEventListener(e,t,r)}},[t])};var $e=()=>{let e=y({x:0,y:0}),t=y({x:0,y:0}),r=y({x:0,y:0});return P("mousemove",n=>{e.value={x:n.x,y:n.y},t.value={x:n.movementX,y:n.movementY},r.value={x:n.clientX,y:n.clientY}}),{mouse:e,delta:t,client:r}};var He="window"in globalThis&&"ResizeObserver"in globalThis.window,Ar=(e,t,r=void 0)=>m()?He?d("useResizeObserver",{resizeObserver:null,deps:[e.current]},({isInit:n,hook:o,queueEffect:s})=>(n&&(o.resizeObserver=new ResizeObserver(t),o.cleanup=()=>{o.resizeObserver?.disconnect?.(),o.resizeObserver=null}),s(()=>{A([e.current],o.deps)&&(o.deps=[e.current],o.resizeObserver?.disconnect?.(),e.current&&o.resizeObserver?.observe(e.current,r))}),{isSupported:He,start:()=>{o.resizeObserver==null&&(o.resizeObserver=new ResizeObserver(t),e.current&&o.resizeObserver.observe(e.current,r),o.cleanup=()=>{o.resizeObserver?.disconnect?.(),o.resizeObserver=null})},stop:()=>{F(o)}})):{isSupported:He,start:()=>{},stop:()=>{}}:{isSupported:He,start:()=>{},stop:()=>{}};var Fe="window"in globalThis&&"MutationObserver"in globalThis.window,Mr=(e,t,r=void 0)=>m()?Fe?d("useMutationObserver",{mutationObserver:null,deps:[e.current]},({isInit:n,hook:o,queueEffect:s})=>(n?(s(()=>{o.deps=[e.current],o.mutationObserver=new MutationObserver(t),e.current&&o.mutationObserver.observe(e.current,r)}),o.cleanup=()=>{o.mutationObserver?.disconnect?.(),o.mutationObserver=null}):A([e.current],o.deps)&&(o.deps=[e.current],o.mutationObserver?.disconnect?.(),e.current&&o.mutationObserver?.observe(e.current,r)),{isSupported:Fe,start:()=>{o.mutationObserver==null&&(o.mutationObserver=new MutationObserver(t),e.current&&o.mutationObserver.observe(e.current,r),o.cleanup=()=>{o.mutationObserver?.disconnect?.(),o.mutationObserver=null})},stop:()=>{F(o)}})):{isSupported:Fe,start:()=>{},stop:()=>{}}:{isSupported:Fe,start:()=>{},stop:()=>{}};var Ne=(e,t={windowScroll:!0,windowResize:!0})=>{let r=t?.windowScroll??!0,n=t?.windowResize??!0,o=t.immediate??!0,s=y(0),i=y(0),a=y(0),u=y(0),c=y(0),p=y(0),v=y(0),M=y(0),h=()=>{let x=e.current;if(!x){s.value=0,i.value=0,a.value=0,u.value=0,c.value=0,p.value=0,v.value=0,M.value=0;return}let b=x.getBoundingClientRect();s.value=b.width,i.value=b.height,a.value=b.top,u.value=b.right,c.value=b.bottom,p.value=b.left,v.value=b.x,M.value=b.y};return Ar(e,h),Mr(e,h,{attributeFilter:["style","class"]}),P("scroll",()=>{r&&h()},{capture:!0,passive:!0}),P("resize",()=>{n&&h()},{passive:!0}),re(()=>{o&&h()},[]),{width:s,height:i,top:a,right:u,bottom:c,left:p,x:v,y:M,update:h}};var Rr=(e,t)=>{if(!m())return{isActive:t?.immediate??!1,start:()=>null,stop:()=>null};let r=t?.fpsLimit?1e3/t.fpsLimit:null;return d("useRafFn",()=>({callback:e,refId:null,previousFrameTimestamp:0,isActive:t?.immediate??!1,rafLoop:()=>{}}),({isInit:n,hook:o,update:s})=>(o.callback=e,n&&(o.rafLoop=i=>{if(o.isActive===!1)return;o.previousFrameTimestamp||(o.previousFrameTimestamp=i);let a=i-o.previousFrameTimestamp;if(r&&a<r){o.refId=window.requestAnimationFrame(o.rafLoop);return}o.previousFrameTimestamp=i,o.callback({delta:a,timestamp:i}),o.refId=window.requestAnimationFrame(o.rafLoop)}),n&&t?.immediate&&(o.isActive=!0,o.refId=window.requestAnimationFrame(o.rafLoop),o.cleanup=()=>{o.refId!=null&&window.cancelAnimationFrame(o.refId),o.isActive=!1},s()),{isActive:o.isActive,start:()=>{o.isActive!==!0&&(o.isActive=!0,o.refId=window.requestAnimationFrame(o.rafLoop),o.cleanup=()=>{o.refId!=null&&window.cancelAnimationFrame(o.refId),o.isActive=!1},s())},stop:()=>{F(o),s()}}))};var Or=e=>{let{x:t,y:r,multiple:n,immediate:o=!0}=e,s=y(null),a=Rr(()=>{s.value=n?document.elementsFromPoint(t,r)??[]:document.elementFromPoint(t,r)??null},{immediate:o});return{element:s,...a}};var Dr=()=>{let{mouse:e}=$e(),t=y(null),r=I(null),n=I(null),o=Ne(r),s=y({x:-16,y:-16}),i=y({x:-16,y:-16}),a=y({width:window.innerWidth,height:window.innerHeight}),u=y("bottom"),c=I(null);re(()=>{let h=localStorage.getItem(Ve);if(h==null)return;let x=JSON.parse(h);a.value.width=window.innerWidth,a.value.height=window.innerHeight,u.value=x.snapSide,i.value=vt(x,n,o)},[Math.round(o.width.value),Math.round(o.height.value)]);let p=yt(()=>{let{x:h,y:x}=e.value;if(t.value===null)return null;let{x:b,y:_}=t.value;return{x:h-b,y:x-_}});P("dragstart",h=>{h.preventDefault(),t.value={x:h.x,y:h.y},s.value=i.value},{ref:()=>r.current}),P("mouseup",()=>{c.current&&(clearTimeout(c.current),c.current=null),t.peek()&&(t.value=null,localStorage.setItem(Ve,JSON.stringify({...i.value,...a.value,snapSide:u.value})))});let v=Q(()=>{if(n.current==null)return;let h=n.current.offsetWidth;if(u.value==="right"){let x=Math.min(-16,i.value.y);i.value={x:-16,y:Math.max(x,(window.innerHeight-o.height.value)*-1+16)}}else if(u.value==="left"){let x=Math.min(0,i.value.y);i.value={x:(h-o.width.value)*-1+16,y:Math.max(x,(window.innerHeight-o.height.value)*-1+16)}}else if(u.value==="top"){let x=Math.min(-16,i.value.x);i.value={x:Math.max(x,(h-o.width.value)*-1+16),y:(window.innerHeight-o.height.value)*-1+16};return}else{let x=Math.min(-16,i.value.x);i.value={x:Math.max(x,(h-o.width.value)*-1+16),y:-16}}},[]);xe([p,e],(h,x)=>{if(h===null||!n.current)return;let{x:b,y:_}=x,ze=n.current.offsetWidth,Fr=_>=window.innerHeight-100,St=_<=100;if(!St&&!Fr){let ne=b>window.innerWidth/2;u.value=ne?"right":"left"}else u.value=St?"top":"bottom";if(u.value==="right"){let ne=Math.min(-16,s.value.y+h.y);i.value={x:-16,y:Math.max(ne,(window.innerHeight-o.height.value)*-1+16)};return}else if(u.value==="left"){let ne=Math.min(0,s.value.y+h.y);i.value={x:(ze-o.width.value)*-1+16,y:Math.max(ne,(window.innerHeight-o.height.value)*-1+16)};return}else if(u.value==="top"){let ne=Math.min(-16,s.value.x+h.x);i.value={x:Math.max(ne,(ze-o.width.value)*-1+16),y:(window.innerHeight-o.height.value)*-1+16};return}let Nr=Math.min(-16,s.value.x+h.x);i.value={y:-16,x:Math.max(Nr,(ze-o.width.value)*-1+16)}});let M=Q(()=>{n.current!==null&&(i.value=vt({width:a.value.width,height:a.value.height,x:i.value.x,y:i.value.y,snapSide:u.value},n,o),a.value.width=window.innerWidth,a.value.height=window.innerHeight,localStorage.setItem(Ve,JSON.stringify({...i.value,...a.value,snapSide:u.value})))},[Math.round(o.width.value),Math.round(o.height.value)]);return P("resize",M),{anchorRef:r,anchorCoords:i,viewPortRef:n,startMouse:t,elementBound:o,snapSide:u,updateAnchorPos:v}};var z=De(!1);"window"in globalThis&&R.addEventListener(e=>{e.data.type==="set-inspect-enabled"&&(z.value=e.data.value)});var G=De(null);var Pr="kiru-devtools-popup-size",Ie=()=>{let e=G.value;return Q(()=>new Promise((r,n)=>{if(e)if(e.closed)G.value=null;else return e.focus(),r(e);let o=sessionStorage.getItem(Pr),s=o?JSON.parse(o):{width:Math.floor(Math.min(1920,window.screen.width)/2),height:Math.floor(Math.min(1080,window.screen.height)/2)},i=\`popup,width=\${s.width},height=\${s.height};\`,a=window.open(window.__KIRU_DEVTOOLS_PATHNAME__,"_blank",i);if(!a)return console.error("[kiru]: Unable to open devtools window"),n();let u=c=>{c.data.type==="ready"&&(R.removeEventListener(u),console.debug("[kiru]: devtools window opened"),r(a),G.value=a,a.onbeforeunload=()=>{console.debug("[kiru]: devtools window closed"),G.value=null})};R.addEventListener(u),a.onresize=()=>{sessionStorage.setItem(Pr,JSON.stringify({width:a.innerWidth,height:a.innerHeight}))}}),[e])};var Lr=()=>{let e=Ie(),{mouse:t}=$e(),r=Or({x:t.value.x,y:t.value.y,immediate:!1}),n=r.element.value,o=z.value?n:null,s=Ee(()=>{if(o&&window.__kiru){let c=window.__kiru.apps.find(p=>p.rootNode==null||o.__kiruNode==null?!1:gr(p.rootNode,o.__kiruNode));return c?.rootNode==null?null:c}return null},[o]),i=Ee(()=>o?Sr(o):null,[o]),a=I(null),u=Ne(a);return N(()=>z.subscribe(p=>{r[p?"start":"stop"]()}),[]),N(()=>{i&&o?a.current=kr(i,o)??null:a.current=null},[i,o]),P("click",c=>{if(z.value===!0&&i&&s){c.preventDefault();let p=v=>{v.__devtoolsSelection={node:i,app:s},R.send({type:"select-node"}),R.send({type:"set-inspect-enabled",value:!1}),z.value=!1,a.current=null,v.focus()};G.value?p(G.value):e().then(v=>p(v))}}),i&&f("div",{className:"bg-[crimson]/80 fixed grid place-content-center pointer-events-none z-10 top-0 left-0",style:{width:\`\${u?.width}px\`,height:\`\${u?.height}px\`,transform:\`translate(\${u.x}px, \${u.y}px)\`}},f("p",null,i.type.name))};function Vr(e){return f("svg",{xmlns:"http://www.w3.org/2000/svg",width:20,height:20,viewBox:"0 -960 960 960",fill:"currentColor",...e},f("path",{d:"M710-150q-63 0-106.5-43.5T560-300q0-63 43.5-106.5T710-450q63 0 106.5 43.5T860-300q0 63-43.5 106.5T710-150Zm0-80q29 0 49.5-20.5T780-300q0-29-20.5-49.5T710-370q-29 0-49.5 20.5T640-300q0 29 20.5 49.5T710-230Zm-270-30H200q-17 0-28.5-11.5T160-300q0-17 11.5-28.5T200-340h240q17 0 28.5 11.5T480-300q0 17-11.5 28.5T440-260ZM250-510q-63 0-106.5-43.5T100-660q0-63 43.5-106.5T250-810q63 0 106.5 43.5T400-660q0 63-43.5 106.5T250-510Zm0-80q29 0 49.5-20.5T320-660q0-29-20.5-49.5T250-730q-29 0-49.5 20.5T180-660q0 29 20.5 49.5T250-590Zm510-30H520q-17 0-28.5-11.5T480-660q0-17 11.5-28.5T520-700h240q17 0 28.5 11.5T800-660q0 17-11.5 28.5T760-620Zm-50 320ZM250-660Z"}))}function $r(e){return f("svg",{xmlns:"http://www.w3.org/2000/svg",width:20,height:20,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"lucide lucide-square-mouse-pointer",...e},f("path",{d:"M12.034 12.681a.498.498 0 0 1 .647-.647l9 3.5a.5.5 0 0 1-.033.943l-3.444 1.068a1 1 0 0 0-.66.66l-1.067 3.443a.5.5 0 0 1-.943.033z"}),f("path",{d:"M21 11V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h6"}))}var Pn=()=>{z.value=!z.value,R.send({type:"set-inspect-enabled",value:z.value})};function Ln(e,t){let{damping:r}=t,n=y(e),o=I(e);return N(()=>{let s=null,i=()=>{if(Math.sqrt(Math.pow(o.current.x-n.value.x,2)+Math.pow(o.current.y-n.value.y,2))<5)return;let u=n.value.x+(o.current.x-n.value.x)*r,c=n.value.y+(o.current.y-n.value.y)*r;n.value={x:u,y:c},s=window.requestAnimationFrame(i)};return s=window.requestAnimationFrame(i),()=>{s!=null&&window.cancelAnimationFrame(s)}},[e.x,e.y]),Object.assign(n,{set:(s,i)=>{o.current=s,i?.hard&&(n.value=s)}})}function Et(){let e=y(!1),t=Ie(),{anchorCoords:r,anchorRef:n,viewPortRef:o,startMouse:s,snapSide:i}=Dr(),a=i.value==="left"||i.value==="right",u=I(!1),c=Ln(r.value,{damping:.4});return xe([r],c.set),re(()=>{u.current===!1&&c.set(r.value,{hard:!0}),u.current=!0},[]),f(Z,null,f("div",{ref:o,className:"w-full h-0 fixed top-0 left-0 z-[-9999] overflow-scroll pointer-events-none"}),f("div",{ref:n,draggable:!0,className:\`flex \${a?"flex-col":""} \${e.value?"rounded-3xl":"rounded-full"} p-1 gap-1 items-center will-change-transform bg-crimson\`,style:{transform:\`translate3d(\${Math.round(c.value.x)}px, \${Math.round(c.value.y)}px, 0)\`}},f(vr,{in:e.value,duration:{in:40,out:150},element:p=>{if(p==="exited")return null;let v=p==="entered"?"1":"0.5",M=p==="entered"?"1":"0";return f(Z,null,f("button",{title:"Open Devtools",onclick:t,style:{transform:\`scale(\${v})\`,opacity:M},className:"transition text-white rounded-full p-1 hover:bg-[#0003]"},f(Vr,{width:16,height:16})),f("button",{title:"Toggle Component Inspection",onclick:Pn,style:{transform:\`scale(\${v})\`,opacity:M},className:\`transition text-white rounded-full p-1 hover:bg-[#0003] \${z.value?"bg-[#0003]":""}\`},f($r,{width:16,height:16})))}}),f("button",{className:"bg-crimson rounded-full p-1"+(s.value?" pointer-events-none":""),onclick:()=>e.value=!e.value,tabIndex:-1},f(xr,null))),f(Lr,null))}var Hr=\`*, ::before, ::after {
|
|
1770
1770
|
--tw-border-spacing-x: 0;
|
|
1771
1771
|
--tw-border-spacing-y: 0;
|
|
1772
1772
|
--tw-translate-x: 0;
|
|
@@ -2533,7 +2533,7 @@ video {
|
|
|
2533
2533
|
.focus\\\\:outline:focus {
|
|
2534
2534
|
outline-style: solid;
|
|
2535
2535
|
}
|
|
2536
|
-
\`;if("window"in globalThis){let e=document.createElement("kiru-devtools");
|
|
2536
|
+
\`;if("window"in globalThis){let e=function(){let t=document.createElement("kiru-devtools");t.setAttribute("style","display: contents"),document.body.appendChild(t);let r=t.attachShadow({mode:"open"}),n=new CSSStyleSheet;n.replaceSync(Hr),r.adoptedStyleSheets=[n];let o=Object.assign(document.createElement("div"),{id:"devtools-root",className:"fixed flex bottom-0 right-0 z-[9999999]"});r.appendChild(o),hr(f(Et,{}),o,{name:"kiru.devtools"});let s=()=>G.value?.close();window.addEventListener("close",s),window.addEventListener("beforeunload",s),R.addEventListener(i=>{i.data.type==="open-editor"&&window.open(i.data.fileLink)})};$n=e,window.addEventListener("kiru:ready",e,{once:!0})}var $n;
|
|
2537
2537
|
|
|
2538
2538
|
`;
|
|
2539
2539
|
|
|
@@ -3045,7 +3045,6 @@ function kiru(opts = {}) {
|
|
|
3045
3045
|
},
|
|
3046
3046
|
{
|
|
3047
3047
|
tag: "script",
|
|
3048
|
-
injectTo: "body",
|
|
3049
3048
|
attrs: {
|
|
3050
3049
|
type: "module",
|
|
3051
3050
|
src: dtHostScriptPath
|