@maplezzk/llm-proxy 0.21.1 → 0.23.2

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.
Files changed (102) hide show
  1. package/dist/adapter/router.d.ts.map +1 -1
  2. package/dist/adapter/router.js +1 -0
  3. package/dist/adapter/router.js.map +1 -1
  4. package/dist/api/admin-ui.html +166 -1129
  5. package/dist/api/handlers/adapter-crud.d.ts.map +1 -1
  6. package/dist/api/handlers/adapter-crud.js +5 -3
  7. package/dist/api/handlers/adapter-crud.js.map +1 -1
  8. package/dist/api/handlers/base.d.ts +2 -2
  9. package/dist/api/handlers/base.d.ts.map +1 -1
  10. package/dist/api/handlers/base.js +11 -4
  11. package/dist/api/handlers/base.js.map +1 -1
  12. package/dist/api/server.d.ts.map +1 -1
  13. package/dist/api/server.js +0 -26
  14. package/dist/api/server.js.map +1 -1
  15. package/dist/cli/commands.d.ts +3 -1
  16. package/dist/cli/commands.d.ts.map +1 -1
  17. package/dist/cli/commands.js +154 -39
  18. package/dist/cli/commands.js.map +1 -1
  19. package/dist/config/parser.d.ts.map +1 -1
  20. package/dist/config/parser.js +4 -0
  21. package/dist/config/parser.js.map +1 -1
  22. package/dist/config/types.d.ts +3 -0
  23. package/dist/config/types.d.ts.map +1 -1
  24. package/dist/index.js +5 -1
  25. package/dist/index.js.map +1 -1
  26. package/dist/proxy/provider.d.ts.map +1 -1
  27. package/dist/proxy/provider.js +31 -21
  28. package/dist/proxy/provider.js.map +1 -1
  29. package/dist/proxy/stream-converter.d.ts.map +1 -1
  30. package/dist/proxy/stream-converter.js +121 -76
  31. package/dist/proxy/stream-converter.js.map +1 -1
  32. package/dist/proxy/translation.d.ts.map +1 -1
  33. package/dist/proxy/translation.js +92 -21
  34. package/dist/proxy/translation.js.map +1 -1
  35. package/dist/proxy/types.d.ts +2 -0
  36. package/dist/proxy/types.d.ts.map +1 -1
  37. package/dist/status/usage-store.d.ts +8 -1
  38. package/dist/status/usage-store.d.ts.map +1 -1
  39. package/dist/status/usage-store.js +26 -3
  40. package/dist/status/usage-store.js.map +1 -1
  41. package/dist/types/i18n.generated.d.ts +1 -1
  42. package/dist/types/i18n.generated.d.ts.map +1 -1
  43. package/locales/en/translation.json +46 -11
  44. package/locales/zh/translation.json +46 -11
  45. package/package.json +19 -7
  46. package/dist/api/admin/app.d.ts +0 -2
  47. package/dist/api/admin/app.d.ts.map +0 -1
  48. package/dist/api/admin/app.js +0 -47
  49. package/dist/api/admin/app.js.map +0 -1
  50. package/dist/api/admin/components/adapters.d.ts +0 -36
  51. package/dist/api/admin/components/adapters.d.ts.map +0 -1
  52. package/dist/api/admin/components/adapters.js +0 -213
  53. package/dist/api/admin/components/adapters.js.map +0 -1
  54. package/dist/api/admin/components/capture.d.ts +0 -29
  55. package/dist/api/admin/components/capture.d.ts.map +0 -1
  56. package/dist/api/admin/components/capture.js +0 -190
  57. package/dist/api/admin/components/capture.js.map +0 -1
  58. package/dist/api/admin/components/dashboard.d.ts +0 -72
  59. package/dist/api/admin/components/dashboard.d.ts.map +0 -1
  60. package/dist/api/admin/components/dashboard.js +0 -263
  61. package/dist/api/admin/components/dashboard.js.map +0 -1
  62. package/dist/api/admin/components/logs.d.ts +0 -24
  63. package/dist/api/admin/components/logs.d.ts.map +0 -1
  64. package/dist/api/admin/components/logs.js +0 -90
  65. package/dist/api/admin/components/logs.js.map +0 -1
  66. package/dist/api/admin/components/port-setting.d.ts +0 -12
  67. package/dist/api/admin/components/port-setting.d.ts.map +0 -1
  68. package/dist/api/admin/components/port-setting.js +0 -49
  69. package/dist/api/admin/components/port-setting.js.map +0 -1
  70. package/dist/api/admin/components/providers.d.ts +0 -44
  71. package/dist/api/admin/components/providers.d.ts.map +0 -1
  72. package/dist/api/admin/components/providers.js +0 -256
  73. package/dist/api/admin/components/providers.js.map +0 -1
  74. package/dist/api/admin/components/proxy-key.d.ts +0 -10
  75. package/dist/api/admin/components/proxy-key.d.ts.map +0 -1
  76. package/dist/api/admin/components/proxy-key.js +0 -35
  77. package/dist/api/admin/components/proxy-key.js.map +0 -1
  78. package/dist/api/admin/components/test-panel.d.ts +0 -14
  79. package/dist/api/admin/components/test-panel.d.ts.map +0 -1
  80. package/dist/api/admin/components/test-panel.js +0 -60
  81. package/dist/api/admin/components/test-panel.js.map +0 -1
  82. package/dist/api/admin/components/usage-charts.d.ts +0 -26
  83. package/dist/api/admin/components/usage-charts.d.ts.map +0 -1
  84. package/dist/api/admin/components/usage-charts.js +0 -215
  85. package/dist/api/admin/components/usage-charts.js.map +0 -1
  86. package/dist/api/admin/components/vision-setting.d.ts +0 -41
  87. package/dist/api/admin/components/vision-setting.d.ts.map +0 -1
  88. package/dist/api/admin/components/vision-setting.js +0 -121
  89. package/dist/api/admin/components/vision-setting.js.map +0 -1
  90. package/dist/api/admin/i18n.d.ts +0 -19
  91. package/dist/api/admin/i18n.d.ts.map +0 -1
  92. package/dist/api/admin/i18n.js +0 -71
  93. package/dist/api/admin/i18n.js.map +0 -1
  94. package/dist/api/admin/store.d.ts +0 -2
  95. package/dist/api/admin/store.d.ts.map +0 -1
  96. package/dist/api/admin/store.js +0 -113
  97. package/dist/api/admin/store.js.map +0 -1
  98. package/dist/api/admin/types.d.ts +0 -41
  99. package/dist/api/admin/types.d.ts.map +0 -1
  100. package/dist/api/admin/types.js +0 -2
  101. package/dist/api/admin/types.js.map +0 -1
  102. package/dist/api/admin-app.js +0 -33
@@ -1,33 +0,0 @@
1
- var Kn=!1,Un=!1,ae=[],qn=-1,as=!1;function ud(e){gd(e)}function fd(){as=!0}function pd(){as=!1,rr()}function gd(e){ae.includes(e)||ae.push(e),rr()}function md(e){let t=ae.indexOf(e);t!==-1&&t>qn&&ae.splice(t,1)}function rr(){if(!Un&&!Kn){if(as)return;Kn=!0,queueMicrotask(bd)}}function bd(){Kn=!1,Un=!0;for(let e=0;e<ae.length;e++)ae[e](),qn=e;ae.length=0,qn=-1,Un=!1}var Ae,pe,Oe,ar,Yn=!0;function yd(e){Yn=!1,e(),Yn=!0}function xd(e){Ae=e.reactive,Oe=e.release,pe=t=>e.effect(t,{scheduler:i=>{Yn?ud(i):i()}}),ar=e.raw}function Yo(e){pe=e}function _d(e){let t=()=>{};return[n=>{let s=pe(n);return e._x_effects||(e._x_effects=new Set,e._x_runEffects=()=>{e._x_effects.forEach(o=>o())}),e._x_effects.add(s),t=()=>{s!==void 0&&(e._x_effects.delete(s),Oe(s))},s},()=>{t()}]}function lr(e,t){let i=!0,n,s,o=pe(()=>{let r=e(),a=JSON.stringify(r);if(!i&&(typeof r=="object"||r!==n)){let l=typeof n=="object"?JSON.parse(s):n;queueMicrotask(()=>{t(r,l)})}n=r,s=a,i=!1});return()=>Oe(o)}async function vd(e){fd();try{await e(),await Promise.resolve()}finally{pd()}}var cr=[],dr=[],hr=[];function wd(e){hr.push(e)}function ls(e,t){typeof t=="function"?(e._x_cleanups||(e._x_cleanups=[]),e._x_cleanups.push(t)):(t=e,dr.push(t))}function ur(e){cr.push(e)}function fr(e,t,i){e._x_attributeCleanups||(e._x_attributeCleanups={}),e._x_attributeCleanups[t]||(e._x_attributeCleanups[t]=[]),e._x_attributeCleanups[t].push(i)}function pr(e,t){e._x_attributeCleanups&&Object.entries(e._x_attributeCleanups).forEach(([i,n])=>{(t===void 0||t.includes(i))&&(n.forEach(s=>s()),delete e._x_attributeCleanups[i])})}function Sd(e){for(e._x_effects?.forEach(md);e._x_cleanups?.length;)e._x_cleanups.pop()()}var cs=new MutationObserver(fs),ds=!1;function hs(){cs.observe(document,{subtree:!0,childList:!0,attributes:!0,attributeOldValue:!0}),ds=!0}function gr(){Md(),cs.disconnect(),ds=!1}var qe=[];function Md(){let e=cs.takeRecords();qe.push(()=>e.length>0&&fs(e));let t=qe.length;queueMicrotask(()=>{if(qe.length===t)for(;qe.length>0;)qe.shift()()})}function K(e){if(!ds)return e();gr();let t=e();return hs(),t}var us=!1,Ei=[];function kd(){us=!0}function Pd(){us=!1,fs(Ei),Ei=[]}function fs(e){if(us){Ei=Ei.concat(e);return}let t=[],i=new Set,n=new Map,s=new Map;for(let o=0;o<e.length;o++)if(!e[o].target._x_ignoreMutationObserver&&(e[o].type==="childList"&&(e[o].removedNodes.forEach(r=>{r.nodeType===1&&r._x_marker&&i.add(r)}),e[o].addedNodes.forEach(r=>{if(r.nodeType===1){if(i.has(r)){i.delete(r);return}r._x_marker||t.push(r)}})),e[o].type==="attributes")){let r=e[o].target,a=e[o].attributeName,l=e[o].oldValue,c=()=>{n.has(r)||n.set(r,[]),n.get(r).push({name:a,value:r.getAttribute(a)})},d=()=>{s.has(r)||s.set(r,[]),s.get(r).push(a)};r.hasAttribute(a)&&l===null?c():r.hasAttribute(a)?(d(),c()):d()}s.forEach((o,r)=>{pr(r,o)}),n.forEach((o,r)=>{cr.forEach(a=>a(r,o))});for(let o of i)t.some(r=>r.contains(o))||dr.forEach(r=>r(o));for(let o of t)o.isConnected&&hr.forEach(r=>r(o));t=null,i=null,n=null,s=null}function mr(e){return ue(he(e))}function ii(e,t,i){return e._x_dataStack=[t,...he(i||e)],()=>{e._x_dataStack=e._x_dataStack.filter(n=>n!==t)}}function he(e){return e._x_dataStack?e._x_dataStack:typeof ShadowRoot=="function"&&e instanceof ShadowRoot?he(e.host):e.parentNode?he(e.parentNode):[]}function ue(e){return new Proxy({objects:e},Cd)}function br(e,t){return e===null||e===Object.prototype?null:Object.prototype.hasOwnProperty.call(e,t)?e:br(Object.getPrototypeOf(e),t)}var Cd={ownKeys({objects:e}){return Array.from(new Set(e.flatMap(t=>Object.keys(t))))},has({objects:e},t){return t==Symbol.unscopables?!1:e.some(i=>Object.prototype.hasOwnProperty.call(i,t)||Reflect.has(i,t))},get({objects:e},t,i){return t=="toJSON"?Ad:Reflect.get(e.find(n=>Reflect.has(n,t))||{},t,i)},set({objects:e},t,i,n){let s;for(let r of e)if(s=br(r,t),s)break;s||(s=e[e.length-1]);let o=Object.getOwnPropertyDescriptor(s,t);return o?.set&&o?.get?o.set.call(n,i)||!0:Reflect.set(s,t,i)}};function Ad(){return Reflect.ownKeys(this).reduce((t,i)=>(t[i]=Reflect.get(this,i),t),{})}function ps(e){let t=n=>typeof n=="object"&&!Array.isArray(n)&&n!==null,i=(n,s="")=>{Object.entries(Object.getOwnPropertyDescriptors(n)).forEach(([o,{value:r,enumerable:a}])=>{if(a===!1||r===void 0||typeof r=="object"&&r!==null&&r.__v_skip)return;let l=s===""?o:`${s}.${o}`;typeof r=="object"&&r!==null&&r._x_interceptor?n[o]=r.initialize(e,l,o):t(r)&&r!==n&&!(r instanceof Element)&&i(r,l)})};return i(e)}function yr(e,t=()=>{}){let i={initialValue:void 0,_x_interceptor:!0,initialize(n,s,o){return e(this.initialValue,()=>Od(n,s),r=>Xn(n,s,r),s,o)}};return t(i),n=>{if(typeof n=="object"&&n!==null&&n._x_interceptor){let s=i.initialize.bind(i);i.initialize=(o,r,a)=>{let l=n.initialize(o,r,a);return i.initialValue=l,s(o,r,a)}}else i.initialValue=n;return i}}function Od(e,t){return t.split(".").reduce((i,n)=>i[n],e)}function Xn(e,t,i){if(typeof t=="string"&&(t=t.split(".")),t.length===1)e[t[0]]=i;else{if(t.length===0)throw error;return e[t[0]]||(e[t[0]]={}),Xn(e[t[0]],t.slice(1),i)}}var xr={};function pt(e,t){xr[e]=t}function Qe(e,t){let i=Ld(t);return Object.entries(xr).forEach(([n,s])=>{Object.defineProperty(e,`$${n}`,{get(){return s(t,i)},enumerable:!1})}),e}function Ld(e){let[t,i]=Pr(e),n={interceptor:yr,...t};return ls(e,i),n}function Td(e,t,i,...n){try{return i(...n)}catch(s){ti(s,e,t)}}function ti(...e){return _r(...e)}var _r=Rd;function Dd(e){_r=e}function Rd(e,t,i=void 0){e=Object.assign(e??{message:"No error message given."},{el:t,expression:i}),console.warn(`Alpine Expression Error: ${e.message}
2
-
3
- ${i?'Expression: "'+i+`"
4
-
5
- `:""}`,t),setTimeout(()=>{throw e},0)}var Pe=!0;function vr(e){let t=Pe;Pe=!1;let i=e();return Pe=t,i}function le(e,t,i={}){let n;return et(e,t)(s=>n=s,i),n}function et(...e){return wr(...e)}var wr=()=>{};function Ed(e){wr=e}var Sr;function Id(e){Sr=e}function Fd(e,t){let i={};Qe(i,e);let n=[i,...he(e)],s=typeof t=="function"?Nd(n,t):Bd(n,t,e);return Td.bind(null,e,t,s)}function Nd(e,t){return(i=()=>{},{scope:n={},params:s=[],context:o}={})=>{if(!Pe){ei(i,t,ue([n,...e]),s);return}let r=t.apply(ue([n,...e]),s);ei(i,r)}}var jn={};function zd(e,t){if(jn[e])return jn[e];let i=Object.getPrototypeOf(async function(){}).constructor,n=/^[\n\s]*if.*\(.*\)/.test(e.trim())||/^(let|const)\s/.test(e.trim())?`(async()=>{ ${e} })()`:e,o=(()=>{try{let r=new i(["__self","scope"],`with (scope) { __self.result = ${n} }; __self.finished = true; return __self.result;`);return Object.defineProperty(r,"name",{value:`[Alpine] ${e}`}),r}catch(r){return ti(r,t,e),Promise.resolve()}})();return jn[e]=o,o}function Bd(e,t,i){let n=zd(t,i);return(s=()=>{},{scope:o={},params:r=[],context:a}={})=>{n.result=void 0,n.finished=!1;let l=ue([o,...e]);if(typeof n=="function"){let c=n.call(a,n,l).catch(d=>ti(d,i,t));n.finished?(ei(s,n.result,l,r,i),n.result=void 0):c.then(d=>{ei(s,d,l,r,i)}).catch(d=>ti(d,i,t)).finally(()=>n.result=void 0)}}}function ei(e,t,i,n,s){if(Pe&&typeof t=="function"){let o=t.apply(i,n);o instanceof Promise?o.then(r=>ei(e,r,i,n)).catch(r=>ti(r,s,t)):e(o)}else typeof t=="object"&&t instanceof Promise?t.then(o=>e(o)):e(t)}function $d(...e){return Sr(...e)}function jd(e,t,i={}){let n={};Qe(n,e);let s=[n,...he(e)],o=ue([i.scope??{},...s]),r=i.params??[];if(t.includes("await")){let a=Object.getPrototypeOf(async function(){}).constructor,l=/^[\n\s]*if.*\(.*\)/.test(t.trim())||/^(let|const)\s/.test(t.trim())?`(async()=>{ ${t} })()`:t;return new a(["scope"],`with (scope) { let __result = ${l}; return __result }`).call(i.context,o)}else{let a=/^[\n\s]*if.*\(.*\)/.test(t.trim())||/^(let|const)\s/.test(t.trim())?`(()=>{ ${t} })()`:t,c=new Function(["scope"],`with (scope) { let __result = ${a}; return __result }`).call(i.context,o);return typeof c=="function"&&Pe?c.apply(o,r):c}}var gs="x-";function Le(e=""){return gs+e}function Vd(e){gs=e}var Ii={};function q(e,t){return Ii[e]=t,{before(i){if(!Ii[i]){console.warn(String.raw`Cannot find directive \`${i}\`. \`${e}\` will use the default order of execution`);return}let n=re.indexOf(i);re.splice(n>=0?n:re.indexOf("DEFAULT"),0,e)}}}function Hd(e){return Object.keys(Ii).includes(e)}function ms(e,t,i){if(t=Array.from(t),e._x_virtualDirectives){let o=Object.entries(e._x_virtualDirectives).map(([a,l])=>({name:a,value:l})),r=Mr(o);o=o.map(a=>r.find(l=>l.name===a.name)?{name:`x-bind:${a.name}`,value:`"${a.value}"`}:a),t=t.concat(o)}let n={};return t.map(Or((o,r)=>n[o]=r)).filter(Tr).map(Ud(n,i)).sort(qd).map(o=>Kd(e,o))}function Mr(e){return Array.from(e).map(Or()).filter(t=>!Tr(t))}var Jn=!1,Je=new Map,kr=Symbol();function Wd(e){Jn=!0;let t=Symbol();kr=t,Je.set(t,[]);let i=()=>{for(;Je.get(t).length;)Je.get(t).shift()();Je.delete(t)},n=()=>{Jn=!1,i()};e(i),n()}function Pr(e){let t=[],i=a=>t.push(a),[n,s]=_d(e);return t.push(s),[{Alpine:De,effect:n,cleanup:i,evaluateLater:et.bind(et,e),evaluate:le.bind(le,e)},()=>t.forEach(a=>a())]}function Kd(e,t){let i=()=>{},n=Ii[t.type]||i,[s,o]=Pr(e);fr(e,t.original,o);let r=()=>{e._x_ignore||e._x_ignoreSelf||(n.inline&&n.inline(e,t,s),n=n.bind(n,e,t,s),Jn?Je.get(kr).push(n):n())};return r.runCleanups=o,r}var Cr=(e,t)=>({name:i,value:n})=>(i.startsWith(e)&&(i=i.replace(e,t)),{name:i,value:n}),Ar=e=>e;function Or(e=()=>{}){return({name:t,value:i})=>{let{name:n,value:s}=Lr.reduce((o,r)=>r(o),{name:t,value:i});return n!==t&&e(n,t),{name:n,value:s}}}var Lr=[];function bs(e){Lr.push(e)}function Tr({name:e}){return Dr().test(e)}var Dr=()=>new RegExp(`^${gs}([^:^.]+)\\b`);function Ud(e,t){return({name:i,value:n})=>{i===n&&(n="");let s=i.match(Dr()),o=i.match(/:([a-zA-Z0-9\-_:]+)/),r=i.match(/\.[^.\]]+(?=[^\]]*$)/g)||[],a=t||e[i]||i;return{type:s?s[1]:null,value:o?o[1]:null,modifiers:r.map(l=>l.replace(".","")),expression:n,original:a}}}var Gn="DEFAULT",re=["ignore","ref","data","id","anchor","bind","init","for","model","modelable","transition","show","if",Gn,"teleport"];function qd(e,t){let i=re.indexOf(e.type)===-1?Gn:e.type,n=re.indexOf(t.type)===-1?Gn:t.type;return re.indexOf(i)-re.indexOf(n)}function Ge(e,t,i={},n={}){return e.dispatchEvent(new CustomEvent(t,{detail:i,bubbles:!0,composed:!0,cancelable:!0,...n}))}function fe(e,t){if(typeof ShadowRoot=="function"&&e instanceof ShadowRoot){Array.from(e.children).forEach(s=>fe(s,t));return}let i=!1;if(t(e,()=>i=!0),i)return;let n=e.firstElementChild;for(;n;)fe(n,t,!1),n=n.nextElementSibling}function vt(e,...t){console.warn(`Alpine Warning: ${e}`,...t)}var Xo=!1;function Yd(){Xo&&vt("Alpine has already been initialized on this page. Calling Alpine.start() more than once can cause problems."),Xo=!0,document.body||vt("Unable to initialize. Trying to load Alpine before `<body>` is available. Did you forget to add `defer` in Alpine's `<script>` tag?"),Ge(document,"alpine:init"),Ge(document,"alpine:initializing"),hs(),wd(t=>Tt(t,fe)),ls(t=>Te(t)),ur((t,i)=>{ms(t,i).forEach(n=>n())});let e=t=>!zi(t.parentElement,!0);Array.from(document.querySelectorAll(Ir().join(","))).filter(e).forEach(t=>{Tt(t)}),Ge(document,"alpine:initialized"),setTimeout(()=>{Zd()})}var ys=[],Rr=[];function Er(){return ys.map(e=>e())}function Ir(){return ys.concat(Rr).map(e=>e())}function Fr(e){ys.push(e)}function Nr(e){Rr.push(e)}function zi(e,t=!1){return Lt(e,i=>{if((t?Ir():Er()).some(s=>i.matches(s)))return!0})}function Lt(e,t){if(e){if(t(e))return e;if(e._x_teleportBack)return Lt(e._x_teleportBack,t);if(e.parentNode instanceof ShadowRoot)return Lt(e.parentNode.host,t);if(e.parentElement)return Lt(e.parentElement,t)}}function Xd(e){return Er().some(t=>e.matches(t))}var zr=[];function Jd(e){zr.push(e)}var Gd=1;function Tt(e,t=fe,i=()=>{}){Lt(e,n=>n._x_ignore)||Wd(()=>{t(e,(n,s)=>{n._x_marker||(i(n,s),zr.forEach(o=>o(n,s)),ms(n,n.attributes).forEach(o=>o()),n._x_ignore||(n._x_marker=Gd++),n._x_ignore&&s())})})}function Te(e,t=fe){t(e,i=>{Sd(i),pr(i),delete i._x_marker})}function Zd(){[["ui","dialog",["[x-dialog], [x-popover]"]],["anchor","anchor",["[x-anchor]"]],["sort","sort",["[x-sort]"]]].forEach(([t,i,n])=>{Hd(i)||n.some(s=>{if(document.querySelector(s))return vt(`found "${s}", but missing ${t} plugin`),!0})})}var Zn=[],xs=!1;function _s(e=()=>{}){return queueMicrotask(()=>{xs||setTimeout(()=>{Qn()})}),new Promise(t=>{Zn.push(()=>{e(),t()})})}function Qn(){for(xs=!1;Zn.length;)Zn.shift()()}function Qd(){xs=!0}function vs(e,t){return Array.isArray(t)?Jo(e,t.join(" ")):typeof t=="object"&&t!==null?th(e,t):typeof t=="function"?vs(e,t()):Jo(e,t)}function ts(e){return e.split(/\s/).filter(Boolean)}function Jo(e,t){let i=s=>ts(s).filter(o=>!e.classList.contains(o)).filter(Boolean),n=s=>(e.classList.add(...s),()=>{e.classList.remove(...s)});return t=t===!0?t="":t||"",n(i(t))}function th(e,t){let i=Object.entries(t).flatMap(([r,a])=>a?ts(r):!1).filter(Boolean),n=Object.entries(t).flatMap(([r,a])=>a?!1:ts(r)).filter(Boolean),s=[],o=[];return n.forEach(r=>{e.classList.contains(r)&&(e.classList.remove(r),o.push(r))}),i.forEach(r=>{e.classList.contains(r)||(e.classList.add(r),s.push(r))}),()=>{o.forEach(r=>e.classList.add(r)),s.forEach(r=>e.classList.remove(r))}}function Bi(e,t){return typeof t=="object"&&t!==null?eh(e,t):ih(e,t)}function eh(e,t){let i={};return Object.entries(t).forEach(([n,s])=>{i[n]=e.style[n],n.startsWith("--")||(n=nh(n)),e.style.setProperty(n,s)}),setTimeout(()=>{e.style.length===0&&e.removeAttribute("style")}),()=>{Bi(e,i)}}function ih(e,t){let i=e.getAttribute("style",t);return e.setAttribute("style",t),()=>{e.setAttribute("style",i||"")}}function nh(e){return e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}function es(e,t=()=>{}){let i=!1;return function(){i?t.apply(this,arguments):(i=!0,e.apply(this,arguments))}}q("transition",(e,{value:t,modifiers:i,expression:n},{evaluate:s})=>{typeof n=="function"&&(n=s(n)),n!==!1&&(!n||typeof n=="boolean"?oh(e,i,t):sh(e,n,t))});function sh(e,t,i){Br(e,vs,""),{enter:s=>{e._x_transition.enter.during=s},"enter-start":s=>{e._x_transition.enter.start=s},"enter-end":s=>{e._x_transition.enter.end=s},leave:s=>{e._x_transition.leave.during=s},"leave-start":s=>{e._x_transition.leave.start=s},"leave-end":s=>{e._x_transition.leave.end=s}}[i](t)}function oh(e,t,i){Br(e,Bi);let n=!t.includes("in")&&!t.includes("out")&&!i,s=n||t.includes("in")||["enter"].includes(i),o=n||t.includes("out")||["leave"].includes(i);t.includes("in")&&!n&&(t=t.filter((b,y)=>y<t.indexOf("out"))),t.includes("out")&&!n&&(t=t.filter((b,y)=>y>t.indexOf("out")));let r=!t.includes("opacity")&&!t.includes("scale"),a=r||t.includes("opacity"),l=r||t.includes("scale"),c=a?0:1,d=l?Ye(t,"scale",95)/100:1,h=Ye(t,"delay",0)/1e3,u=Ye(t,"origin","center"),f="opacity, transform",g=Ye(t,"duration",150)/1e3,p=Ye(t,"duration",75)/1e3,m="cubic-bezier(0.4, 0.0, 0.2, 1)";s&&(e._x_transition.enter.during={transformOrigin:u,transitionDelay:`${h}s`,transitionProperty:f,transitionDuration:`${g}s`,transitionTimingFunction:m},e._x_transition.enter.start={opacity:c,transform:`scale(${d})`},e._x_transition.enter.end={opacity:1,transform:"scale(1)"}),o&&(e._x_transition.leave.during={transformOrigin:u,transitionDelay:`${h}s`,transitionProperty:f,transitionDuration:`${p}s`,transitionTimingFunction:m},e._x_transition.leave.start={opacity:1,transform:"scale(1)"},e._x_transition.leave.end={opacity:c,transform:`scale(${d})`})}function Br(e,t,i={}){e._x_transition||(e._x_transition={enter:{during:i,start:i,end:i},leave:{during:i,start:i,end:i},in(n=()=>{},s=()=>{}){is(e,t,{during:this.enter.during,start:this.enter.start,end:this.enter.end},n,s)},out(n=()=>{},s=()=>{}){is(e,t,{during:this.leave.during,start:this.leave.start,end:this.leave.end},n,s)}})}window.Element.prototype._x_toggleAndCascadeWithTransitions=function(e,t,i,n){let s=document.visibilityState==="visible"?requestAnimationFrame:setTimeout,o=()=>s(i);if(t){e._x_transition&&(e._x_transition.enter||e._x_transition.leave)?e._x_transition.enter&&(Object.entries(e._x_transition.enter.during).length||Object.entries(e._x_transition.enter.start).length||Object.entries(e._x_transition.enter.end).length)?e._x_transition.in(i):o():e._x_transition?e._x_transition.in(i):o();return}e._x_hidePromise=e._x_transition?new Promise((r,a)=>{e._x_transition.out(()=>{},()=>r(n)),e._x_transitioning&&e._x_transitioning.beforeCancel(()=>a({isFromCancelledTransition:!0}))}):Promise.resolve(n),queueMicrotask(()=>{let r=$r(e);r?(r._x_hideChildren||(r._x_hideChildren=[]),r._x_hideChildren.push(e)):s(()=>{let a=l=>{let c=Promise.all([l._x_hidePromise,...(l._x_hideChildren||[]).map(a)]).then(([d])=>d?.());return delete l._x_hidePromise,delete l._x_hideChildren,c};a(e).catch(l=>{if(!l.isFromCancelledTransition)throw l})})})};function $r(e){let t=e.parentNode;if(t)return t._x_hidePromise?t:$r(t)}function is(e,t,{during:i,start:n,end:s}={},o=()=>{},r=()=>{}){if(e._x_transitioning&&e._x_transitioning.cancel(),Object.keys(i).length===0&&Object.keys(n).length===0&&Object.keys(s).length===0){o(),r();return}let a,l,c;rh(e,{start(){a=t(e,n)},during(){l=t(e,i)},before:o,end(){a(),c=t(e,s)},after:r,cleanup(){l(),c()}})}function rh(e,t){let i,n,s,o=es(()=>{K(()=>{i=!0,n||t.before(),s||(t.end(),Qn()),t.after(),e.isConnected&&t.cleanup(),delete e._x_transitioning})});e._x_transitioning={beforeCancels:[],beforeCancel(r){this.beforeCancels.push(r)},cancel:es(function(){for(;this.beforeCancels.length;)this.beforeCancels.shift()();o()}),finish:o},K(()=>{t.start(),t.during()}),Qd(),requestAnimationFrame(()=>{if(i)return;let r=Number(getComputedStyle(e).transitionDuration.replace(/,.*/,"").replace("s",""))*1e3,a=Number(getComputedStyle(e).transitionDelay.replace(/,.*/,"").replace("s",""))*1e3;r===0&&(r=Number(getComputedStyle(e).animationDuration.replace("s",""))*1e3),K(()=>{t.before()}),n=!0,requestAnimationFrame(()=>{i||(K(()=>{t.end()}),Qn(),setTimeout(e._x_transitioning.finish,r+a),s=!0)})})}function Ye(e,t,i){if(e.indexOf(t)===-1)return i;let n=e[e.indexOf(t)+1];if(!n||t==="scale"&&isNaN(n))return i;if(t==="duration"||t==="delay"){let s=n.match(/([0-9]+)ms/);if(s)return s[1]}return t==="origin"&&["top","right","left","center","bottom"].includes(e[e.indexOf(t)+2])?[n,e[e.indexOf(t)+2]].join(" "):n}var Wt=!1;function Ut(e,t=()=>{}){return(...i)=>Wt?t(...i):e(...i)}function ah(e){return(...t)=>Wt&&e(...t)}var jr=[];function $i(e){jr.push(e)}function lh(e,t){jr.forEach(i=>i(e,t)),Wt=!0,Vr(()=>{Tt(t,(i,n)=>{n(i,()=>{})})}),Wt=!1}var ns=!1;function ch(e,t){t._x_dataStack||(t._x_dataStack=e._x_dataStack),Wt=!0,ns=!0,Vr(()=>{dh(t)}),Wt=!1,ns=!1}function dh(e){let t=!1;Tt(e,(n,s)=>{fe(n,(o,r)=>{if(t&&Xd(o))return r();t=!0,s(o,r)})})}function Vr(e){let t=pe;Yo((i,n)=>{let s=t(i);return Oe(s),()=>{}}),e(),Yo(t)}function Hr(e,t,i,n=[]){switch(e._x_bindings||(e._x_bindings=Ae({})),e._x_bindings[t]=i,t=n.includes("camel")?yh(t):t,t){case"value":hh(e,i);break;case"style":fh(e,i);break;case"class":uh(e,i);break;case"selected":case"checked":ph(e,t,i);break;default:Wr(e,t,i);break}}function hh(e,t){if(ws(e))e.attributes.value===void 0&&(e.value=t);else if(Fi(e))Number.isInteger(t)?e.value=t:!Array.isArray(t)&&typeof t!="boolean"&&![null,void 0].includes(t)?e.value=String(t):Array.isArray(t)?e.checked=t.some(i=>xh(i,e.value)):e.checked=!!t;else if(e.tagName==="SELECT")bh(e,t);else{if(e.value===t)return;e.value=t===void 0?"":t}}function uh(e,t){e._x_undoAddedClasses&&e._x_undoAddedClasses(),e._x_undoAddedClasses=vs(e,t)}function fh(e,t){e._x_undoAddedStyles&&e._x_undoAddedStyles(),e._x_undoAddedStyles=Bi(e,t)}function ph(e,t,i){Wr(e,t,i),mh(e,t,i)}function Wr(e,t,i){[null,void 0,!1].includes(i)&&vh(t)?e.removeAttribute(t):(Kr(t)&&(i=t),gh(e,t,i))}function gh(e,t,i){e.getAttribute(t)!=i&&e.setAttribute(t,i)}function mh(e,t,i){e[t]!==i&&(e[t]=i)}function bh(e,t){let i=[].concat(t).map(n=>n+"");Array.from(e.options).forEach(n=>{n.selected=i.includes(n.value)})}function yh(e){return e.toLowerCase().replace(/-(\w)/g,(t,i)=>i.toUpperCase())}function xh(e,t){return e==t}function Ri(e){return[1,"1","true","on","yes",!0].includes(e)?!0:[0,"0","false","off","no",!1].includes(e)?!1:e?!!e:null}var _h=new Set(["allowfullscreen","async","autofocus","autoplay","checked","controls","default","defer","disabled","formnovalidate","inert","ismap","itemscope","loop","multiple","muted","nomodule","novalidate","open","playsinline","readonly","required","reversed","selected","shadowrootclonable","shadowrootdelegatesfocus","shadowrootserializable"]);function Kr(e){return _h.has(e)}function vh(e){return!["aria-pressed","aria-checked","aria-expanded","aria-selected"].includes(e)}function wh(e,t,i){return e._x_bindings&&e._x_bindings[t]!==void 0?e._x_bindings[t]:Ur(e,t,i)}function Sh(e,t,i,n=!0){if(e._x_bindings&&e._x_bindings[t]!==void 0)return e._x_bindings[t];if(e._x_inlineBindings&&e._x_inlineBindings[t]!==void 0){let s=e._x_inlineBindings[t];return s.extract=n,vr(()=>le(e,s.expression))}return Ur(e,t,i)}function Ur(e,t,i){let n=e.getAttribute(t);return n===null?typeof i=="function"?i():i:n===""?!0:Kr(t)?!![t,"true"].includes(n):n}function Fi(e){return e.type==="checkbox"||e.localName==="ui-checkbox"||e.localName==="ui-switch"}function ws(e){return e.type==="radio"||e.localName==="ui-radio"}function qr(e,t){let i;return function(){let n=this,s=arguments,o=function(){i=null,e.apply(n,s)};clearTimeout(i),i=setTimeout(o,t)}}function Yr(e,t){let i;return function(){let n=this,s=arguments;i||(e.apply(n,s),i=!0,setTimeout(()=>i=!1,t))}}function Xr({get:e,set:t},{get:i,set:n}){let s=!0,o,r,a=pe(()=>{let l=e(),c=i();if(s)n(Vn(l)),s=!1;else{let d=JSON.stringify(l),h=JSON.stringify(c);d!==o?n(Vn(l)):d!==h&&t(Vn(c))}o=JSON.stringify(e()),r=JSON.stringify(i())});return()=>{Oe(a)}}function Vn(e){return typeof e=="object"?JSON.parse(JSON.stringify(e)):e}function Mh(e){(Array.isArray(e)?e:[e]).forEach(i=>i(De))}var oe={},Go=!1;function kh(e,t){if(Go||(oe=Ae(oe),Go=!0),t===void 0)return oe[e];oe[e]=t,ps(oe[e]),typeof t=="object"&&t!==null&&t.hasOwnProperty("init")&&typeof t.init=="function"&&oe[e].init()}function Ph(){return oe}var Jr={};function Ch(e,t){let i=typeof t!="function"?()=>t:t;return e instanceof Element?Gr(e,i()):(Jr[e]=i,()=>{})}function Ah(e){return Object.entries(Jr).forEach(([t,i])=>{Object.defineProperty(e,t,{get(){return(...n)=>i(...n)}})}),e}function Gr(e,t,i){let n=[];for(;n.length;)n.pop()();let s=Object.entries(t).map(([r,a])=>({name:r,value:a})),o=Mr(s);return s=s.map(r=>o.find(a=>a.name===r.name)?{name:`x-bind:${r.name}`,value:`"${r.value}"`}:r),ms(e,s,i).map(r=>{n.push(r.runCleanups),r()}),()=>{for(;n.length;)n.pop()()}}var Zr={};function Oh(e,t){Zr[e]=t}function Lh(e,t){return Object.entries(Zr).forEach(([i,n])=>{Object.defineProperty(e,i,{get(){return(...s)=>n.bind(t)(...s)},enumerable:!1})}),e}var Th={get reactive(){return Ae},get release(){return Oe},get effect(){return pe},get raw(){return ar},get transaction(){return vd},version:"3.15.11",flushAndStopDeferringMutations:Pd,dontAutoEvaluateFunctions:vr,disableEffectScheduling:yd,startObservingMutations:hs,stopObservingMutations:gr,setReactivityEngine:xd,onAttributeRemoved:fr,onAttributesAdded:ur,closestDataStack:he,skipDuringClone:Ut,onlyDuringClone:ah,addRootSelector:Fr,addInitSelector:Nr,setErrorHandler:Dd,interceptClone:$i,addScopeToNode:ii,deferMutations:kd,mapAttributes:bs,evaluateLater:et,interceptInit:Jd,initInterceptors:ps,injectMagics:Qe,setEvaluator:Ed,setRawEvaluator:Id,mergeProxies:ue,extractProp:Sh,findClosest:Lt,onElRemoved:ls,closestRoot:zi,destroyTree:Te,interceptor:yr,transition:is,setStyles:Bi,mutateDom:K,directive:q,entangle:Xr,throttle:Yr,debounce:qr,evaluate:le,evaluateRaw:$d,initTree:Tt,nextTick:_s,prefixed:Le,prefix:Vd,plugin:Mh,magic:pt,store:kh,start:Yd,clone:ch,cloneNode:lh,bound:wh,$data:mr,watch:lr,walk:fe,data:Oh,bind:Ch},De=Th;function Qr(e,t){let i=Object.create(null),n=e.split(",");for(let s=0;s<n.length;s++)i[n[s]]=!0;return t?s=>!!i[s.toLowerCase()]:s=>!!i[s]}var Dh="itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly",hb=Qr(Dh+",async,autofocus,autoplay,controls,default,defer,disabled,hidden,loop,open,required,reversed,scoped,seamless,checked,muted,multiple,selected"),Rh=Object.freeze({}),ub=Object.freeze([]),Eh=Object.prototype.hasOwnProperty,ji=(e,t)=>Eh.call(e,t),ce=Array.isArray,Ze=e=>ta(e)==="[object Map]",Ih=e=>typeof e=="string",Ss=e=>typeof e=="symbol",Vi=e=>e!==null&&typeof e=="object",Fh=Object.prototype.toString,ta=e=>Fh.call(e),ea=e=>ta(e).slice(8,-1),Ms=e=>Ih(e)&&e!=="NaN"&&e[0]!=="-"&&""+parseInt(e,10)===e,Hi=e=>{let t=Object.create(null);return i=>t[i]||(t[i]=e(i))},Nh=/-(\w)/g,fb=Hi(e=>e.replace(Nh,(t,i)=>i?i.toUpperCase():"")),zh=/\B([A-Z])/g,pb=Hi(e=>e.replace(zh,"-$1").toLowerCase()),ia=Hi(e=>e.charAt(0).toUpperCase()+e.slice(1)),gb=Hi(e=>e?`on${ia(e)}`:""),na=(e,t)=>e!==t&&(e===e||t===t),ss=new WeakMap,Xe=[],_t,de=Symbol("iterate"),os=Symbol("Map key iterate");function Bh(e){return e&&e._isEffect===!0}function $h(e,t=Rh){Bh(e)&&(e=e.raw);let i=Hh(e,t);return t.lazy||i(),i}function jh(e){e.active&&(sa(e),e.options.onStop&&e.options.onStop(),e.active=!1)}var Vh=0;function Hh(e,t){let i=function(){if(!i.active)return e();if(!Xe.includes(i)){sa(i);try{return Kh(),Xe.push(i),_t=i,e()}finally{Xe.pop(),oa(),_t=Xe[Xe.length-1]}}};return i.id=Vh++,i.allowRecurse=!!t.allowRecurse,i._isEffect=!0,i.active=!0,i.raw=e,i.deps=[],i.options=t,i}function sa(e){let{deps:t}=e;if(t.length){for(let i=0;i<t.length;i++)t[i].delete(e);t.length=0}}var Ce=!0,ks=[];function Wh(){ks.push(Ce),Ce=!1}function Kh(){ks.push(Ce),Ce=!0}function oa(){let e=ks.pop();Ce=e===void 0?!0:e}function ft(e,t,i){if(!Ce||_t===void 0)return;let n=ss.get(e);n||ss.set(e,n=new Map);let s=n.get(i);s||n.set(i,s=new Set),s.has(_t)||(s.add(_t),_t.deps.push(s),_t.options.onTrack&&_t.options.onTrack({effect:_t,target:e,type:t,key:i}))}function Kt(e,t,i,n,s,o){let r=ss.get(e);if(!r)return;let a=new Set,l=d=>{d&&d.forEach(h=>{(h!==_t||h.allowRecurse)&&a.add(h)})};if(t==="clear")r.forEach(l);else if(i==="length"&&ce(e))r.forEach((d,h)=>{(h==="length"||h>=n)&&l(d)});else switch(i!==void 0&&l(r.get(i)),t){case"add":ce(e)?Ms(i)&&l(r.get("length")):(l(r.get(de)),Ze(e)&&l(r.get(os)));break;case"delete":ce(e)||(l(r.get(de)),Ze(e)&&l(r.get(os)));break;case"set":Ze(e)&&l(r.get(de));break}let c=d=>{d.options.onTrigger&&d.options.onTrigger({effect:d,target:e,key:i,type:t,newValue:n,oldValue:s,oldTarget:o}),d.options.scheduler?d.options.scheduler(d):d()};a.forEach(c)}var Uh=Qr("__proto__,__v_isRef,__isVue"),ra=new Set(Object.getOwnPropertyNames(Symbol).map(e=>Symbol[e]).filter(Ss)),qh=aa(),Yh=aa(!0),Zo=Xh();function Xh(){let e={};return["includes","indexOf","lastIndexOf"].forEach(t=>{e[t]=function(...i){let n=z(this);for(let o=0,r=this.length;o<r;o++)ft(n,"get",o+"");let s=n[t](...i);return s===-1||s===!1?n[t](...i.map(z)):s}}),["push","pop","shift","unshift","splice"].forEach(t=>{e[t]=function(...i){Wh();let n=z(this)[t].apply(this,i);return oa(),n}}),e}function aa(e=!1,t=!1){return function(n,s,o){if(s==="__v_isReactive")return!e;if(s==="__v_isReadonly")return e;if(s==="__v_raw"&&o===(e?t?hu:ha:t?du:da).get(n))return n;let r=ce(n);if(!e&&r&&ji(Zo,s))return Reflect.get(Zo,s,o);let a=Reflect.get(n,s,o);return(Ss(s)?ra.has(s):Uh(s))||(e||ft(n,"get",s),t)?a:rs(a)?!r||!Ms(s)?a.value:a:Vi(a)?e?ua(a):Os(a):a}}var Jh=Gh();function Gh(e=!1){return function(i,n,s,o){let r=i[n];if(!e&&(s=z(s),r=z(r),!ce(i)&&rs(r)&&!rs(s)))return r.value=s,!0;let a=ce(i)&&Ms(n)?Number(n)<i.length:ji(i,n),l=Reflect.set(i,n,s,o);return i===z(o)&&(a?na(s,r)&&Kt(i,"set",n,s,r):Kt(i,"add",n,s)),l}}function Zh(e,t){let i=ji(e,t),n=e[t],s=Reflect.deleteProperty(e,t);return s&&i&&Kt(e,"delete",t,void 0,n),s}function Qh(e,t){let i=Reflect.has(e,t);return(!Ss(t)||!ra.has(t))&&ft(e,"has",t),i}function tu(e){return ft(e,"iterate",ce(e)?"length":de),Reflect.ownKeys(e)}var eu={get:qh,set:Jh,deleteProperty:Zh,has:Qh,ownKeys:tu},iu={get:Yh,set(e,t){return console.warn(`Set operation on key "${String(t)}" failed: target is readonly.`,e),!0},deleteProperty(e,t){return console.warn(`Delete operation on key "${String(t)}" failed: target is readonly.`,e),!0}},Ps=e=>Vi(e)?Os(e):e,Cs=e=>Vi(e)?ua(e):e,As=e=>e,Wi=e=>Reflect.getPrototypeOf(e);function Ci(e,t,i=!1,n=!1){e=e.__v_raw;let s=z(e),o=z(t);t!==o&&!i&&ft(s,"get",t),!i&&ft(s,"get",o);let{has:r}=Wi(s),a=n?As:i?Cs:Ps;if(r.call(s,t))return a(e.get(t));if(r.call(s,o))return a(e.get(o));e!==s&&e.get(t)}function Ai(e,t=!1){let i=this.__v_raw,n=z(i),s=z(e);return e!==s&&!t&&ft(n,"has",e),!t&&ft(n,"has",s),e===s?i.has(e):i.has(e)||i.has(s)}function Oi(e,t=!1){return e=e.__v_raw,!t&&ft(z(e),"iterate",de),Reflect.get(e,"size",e)}function Qo(e){e=z(e);let t=z(this);return Wi(t).has.call(t,e)||(t.add(e),Kt(t,"add",e,e)),this}function tr(e,t){t=z(t);let i=z(this),{has:n,get:s}=Wi(i),o=n.call(i,e);o?ca(i,n,e):(e=z(e),o=n.call(i,e));let r=s.call(i,e);return i.set(e,t),o?na(t,r)&&Kt(i,"set",e,t,r):Kt(i,"add",e,t),this}function er(e){let t=z(this),{has:i,get:n}=Wi(t),s=i.call(t,e);s?ca(t,i,e):(e=z(e),s=i.call(t,e));let o=n?n.call(t,e):void 0,r=t.delete(e);return s&&Kt(t,"delete",e,void 0,o),r}function ir(){let e=z(this),t=e.size!==0,i=Ze(e)?new Map(e):new Set(e),n=e.clear();return t&&Kt(e,"clear",void 0,void 0,i),n}function Li(e,t){return function(n,s){let o=this,r=o.__v_raw,a=z(r),l=t?As:e?Cs:Ps;return!e&&ft(a,"iterate",de),r.forEach((c,d)=>n.call(s,l(c),l(d),o))}}function Ti(e,t,i){return function(...n){let s=this.__v_raw,o=z(s),r=Ze(o),a=e==="entries"||e===Symbol.iterator&&r,l=e==="keys"&&r,c=s[e](...n),d=i?As:t?Cs:Ps;return!t&&ft(o,"iterate",l?os:de),{next(){let{value:h,done:u}=c.next();return u?{value:h,done:u}:{value:a?[d(h[0]),d(h[1])]:d(h),done:u}},[Symbol.iterator](){return this}}}}function Ht(e){return function(...t){{let i=t[0]?`on key "${t[0]}" `:"";console.warn(`${ia(e)} operation ${i}failed: target is readonly.`,z(this))}return e==="delete"?!1:this}}function nu(){let e={get(o){return Ci(this,o)},get size(){return Oi(this)},has:Ai,add:Qo,set:tr,delete:er,clear:ir,forEach:Li(!1,!1)},t={get(o){return Ci(this,o,!1,!0)},get size(){return Oi(this)},has:Ai,add:Qo,set:tr,delete:er,clear:ir,forEach:Li(!1,!0)},i={get(o){return Ci(this,o,!0)},get size(){return Oi(this,!0)},has(o){return Ai.call(this,o,!0)},add:Ht("add"),set:Ht("set"),delete:Ht("delete"),clear:Ht("clear"),forEach:Li(!0,!1)},n={get(o){return Ci(this,o,!0,!0)},get size(){return Oi(this,!0)},has(o){return Ai.call(this,o,!0)},add:Ht("add"),set:Ht("set"),delete:Ht("delete"),clear:Ht("clear"),forEach:Li(!0,!0)};return["keys","values","entries",Symbol.iterator].forEach(o=>{e[o]=Ti(o,!1,!1),i[o]=Ti(o,!0,!1),t[o]=Ti(o,!1,!0),n[o]=Ti(o,!0,!0)}),[e,i,t,n]}var[su,ou,ru,au]=nu();function la(e,t){let i=t?e?au:ru:e?ou:su;return(n,s,o)=>s==="__v_isReactive"?!e:s==="__v_isReadonly"?e:s==="__v_raw"?n:Reflect.get(ji(i,s)&&s in n?i:n,s,o)}var lu={get:la(!1,!1)},cu={get:la(!0,!1)};function ca(e,t,i){let n=z(i);if(n!==i&&t.call(e,n)){let s=ea(e);console.warn(`Reactive ${s} contains both the raw and reactive versions of the same object${s==="Map"?" as keys":""}, which can lead to inconsistencies. Avoid differentiating between the raw and reactive versions of an object and only use the reactive version if possible.`)}}var da=new WeakMap,du=new WeakMap,ha=new WeakMap,hu=new WeakMap;function uu(e){switch(e){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function fu(e){return e.__v_skip||!Object.isExtensible(e)?0:uu(ea(e))}function Os(e){return e&&e.__v_isReadonly?e:fa(e,!1,eu,lu,da)}function ua(e){return fa(e,!0,iu,cu,ha)}function fa(e,t,i,n,s){if(!Vi(e))return console.warn(`value cannot be made reactive: ${String(e)}`),e;if(e.__v_raw&&!(t&&e.__v_isReactive))return e;let o=s.get(e);if(o)return o;let r=fu(e);if(r===0)return e;let a=new Proxy(e,r===2?n:i);return s.set(e,a),a}function z(e){return e&&z(e.__v_raw)||e}function rs(e){return!!(e&&e.__v_isRef===!0)}pt("nextTick",()=>_s);pt("dispatch",e=>Ge.bind(Ge,e));pt("watch",(e,{evaluateLater:t,cleanup:i})=>(n,s)=>{let o=t(n),a=lr(()=>{let l;return o(c=>l=c),l},s);i(a)});pt("store",Ph);pt("data",e=>mr(e));pt("root",e=>zi(e));pt("refs",e=>(e._x_refs_proxy||(e._x_refs_proxy=ue(pu(e))),e._x_refs_proxy));function pu(e){let t=[];return Lt(e,i=>{i._x_refs&&t.push(i._x_refs)}),t}var Hn={};function pa(e){return Hn[e]||(Hn[e]=0),++Hn[e]}function gu(e,t){return Lt(e,i=>{if(i._x_ids&&i._x_ids[t])return!0})}function mu(e,t){e._x_ids||(e._x_ids={}),e._x_ids[t]||(e._x_ids[t]=pa(t))}pt("id",(e,{cleanup:t})=>(i,n=null)=>{let s=`${i}${n?`-${n}`:""}`;return bu(e,s,t,()=>{let o=gu(e,i),r=o?o._x_ids[i]:pa(i);return n?`${i}-${r}-${n}`:`${i}-${r}`})});$i((e,t)=>{e._x_id&&(t._x_id=e._x_id)});function bu(e,t,i,n){if(e._x_id||(e._x_id={}),e._x_id[t])return e._x_id[t];let s=n();return e._x_id[t]=s,i(()=>{delete e._x_id[t]}),s}pt("el",e=>e);ga("Focus","focus","focus");ga("Persist","persist","persist");function ga(e,t,i){pt(t,n=>vt(`You can't use [$${t}] without first installing the "${e}" plugin here: https://alpinejs.dev/plugins/${i}`,n))}q("modelable",(e,{expression:t},{effect:i,evaluateLater:n,cleanup:s})=>{let o=n(t),r=()=>{let d;return o(h=>d=h),d},a=n(`${t} = __placeholder`),l=d=>a(()=>{},{scope:{__placeholder:d}}),c=r();l(c),queueMicrotask(()=>{if(!e._x_model)return;e._x_removeModelListeners.default();let d=e._x_model.get,h=e._x_model.setWithModifiers,u=Xr({get(){return d()},set(f){h(f)}},{get(){return r()},set(f){l(f)}});s(u)})});q("teleport",(e,{modifiers:t,expression:i},{cleanup:n})=>{e.tagName.toLowerCase()!=="template"&&vt("x-teleport can only be used on a <template> tag",e);let s=nr(i),o=e.content.cloneNode(!0).firstElementChild;e._x_teleport=o,o._x_teleportBack=e,e.setAttribute("data-teleport-template",!0),o.setAttribute("data-teleport-target",!0),e._x_forwardEvents&&e._x_forwardEvents.forEach(a=>{o.addEventListener(a,l=>{l.stopPropagation(),e.dispatchEvent(new l.constructor(l.type,l))})}),ii(o,{},e);let r=(a,l,c)=>{c.includes("prepend")?l.parentNode.insertBefore(a,l):c.includes("append")?l.parentNode.insertBefore(a,l.nextSibling):l.appendChild(a)};K(()=>{r(o,s,t),Ut(()=>{Tt(o)})()}),e._x_teleportPutBack=()=>{let a=nr(i);K(()=>{r(e._x_teleport,a,t)})},n(()=>K(()=>{o.remove(),Te(o)}))});var yu=document.createElement("div");function nr(e){let t=Ut(()=>document.querySelector(e),()=>yu)();return t||vt(`Cannot find x-teleport element for selector: "${e}"`),t}var ma=()=>{};ma.inline=(e,{modifiers:t},{cleanup:i})=>{t.includes("self")?e._x_ignoreSelf=!0:e._x_ignore=!0,i(()=>{t.includes("self")?delete e._x_ignoreSelf:delete e._x_ignore})};q("ignore",ma);q("effect",Ut((e,{expression:t},{effect:i})=>{i(et(e,t))}));function ke(e,t,i,n){let s=e,o=l=>n(l),r={},a=(l,c)=>d=>c(l,d);return i.includes("dot")&&(t=xu(t)),i.includes("camel")&&(t=_u(t)),i.includes("capture")&&(r.capture=!0),i.includes("window")&&(s=window),i.includes("document")&&(s=document),i.includes("passive")&&(r.passive=i[i.indexOf("passive")+1]!=="false"),o=ba(i,o),i.includes("prevent")&&(o=a(o,(l,c)=>{c.preventDefault(),l(c)})),i.includes("stop")&&(o=a(o,(l,c)=>{c.stopPropagation(),l(c)})),i.includes("once")&&(o=a(o,(l,c)=>{l(c),s.removeEventListener(t,o,r)})),(i.includes("away")||i.includes("outside"))&&(s=document,o=a(o,(l,c)=>{e.contains(c.target)||c.target.isConnected!==!1&&(e.offsetWidth<1&&e.offsetHeight<1||e._x_isShown!==!1&&l(c))})),i.includes("self")&&(o=a(o,(l,c)=>{c.target===e&&l(c)})),t==="submit"&&(o=a(o,(l,c)=>{c.target._x_pendingModelUpdates&&c.target._x_pendingModelUpdates.forEach(d=>d()),l(c)})),(wu(t)||ya(t))&&(o=a(o,(l,c)=>{Su(c,i)||l(c)})),s.addEventListener(t,o,r),()=>{s.removeEventListener(t,o,r)}}function ba(e,t){if(e.includes("debounce")){let i=e[e.indexOf("debounce")+1]||"invalid-wait",n=Ni(i.split("ms")[0])?Number(i.split("ms")[0]):250;t=qr(t,n)}if(e.includes("throttle")){let i=e[e.indexOf("throttle")+1]||"invalid-wait",n=Ni(i.split("ms")[0])?Number(i.split("ms")[0]):250;t=Yr(t,n)}return t}function xu(e){return e.replace(/-/g,".")}function _u(e){return e.toLowerCase().replace(/-(\w)/g,(t,i)=>i.toUpperCase())}function Ni(e){return!Array.isArray(e)&&!isNaN(e)}function vu(e){return[" ","_"].includes(e)?e:e.replace(/([a-z])([A-Z])/g,"$1-$2").replace(/[_\s]/,"-").toLowerCase()}function wu(e){return["keydown","keyup"].includes(e)}function ya(e){return["contextmenu","click","mouse"].some(t=>e.includes(t))}function Su(e,t){let i=t.filter(o=>!["window","document","prevent","stop","once","capture","self","away","outside","passive","preserve-scroll","blur","change","lazy"].includes(o));if(i.includes("debounce")){let o=i.indexOf("debounce");i.splice(o,Ni((i[o+1]||"invalid-wait").split("ms")[0])?2:1)}if(i.includes("throttle")){let o=i.indexOf("throttle");i.splice(o,Ni((i[o+1]||"invalid-wait").split("ms")[0])?2:1)}if(i.length===0||i.length===1&&sr(e.key).includes(i[0]))return!1;let s=["ctrl","shift","alt","meta","cmd","super"].filter(o=>i.includes(o));return i=i.filter(o=>!s.includes(o)),!(s.length>0&&s.filter(r=>((r==="cmd"||r==="super")&&(r="meta"),e[`${r}Key`])).length===s.length&&(ya(e.type)||sr(e.key).includes(i[0])))}function sr(e){if(!e)return[];e=vu(e);let t={ctrl:"control",slash:"/",space:" ",spacebar:" ",cmd:"meta",esc:"escape",up:"arrow-up",down:"arrow-down",left:"arrow-left",right:"arrow-right",period:".",comma:",",equal:"=",minus:"-",underscore:"_"};return t[e]=e,Object.keys(t).map(i=>{if(t[i]===e)return i}).filter(i=>i)}q("model",(e,{modifiers:t,expression:i},{effect:n,cleanup:s})=>{let o=e;t.includes("parent")&&(o=Lt(e,p=>p!==e));let r=et(o,i),a;typeof i=="string"?a=et(o,`${i} = __placeholder`):typeof i=="function"&&typeof i()=="string"?a=et(o,`${i()} = __placeholder`):a=()=>{};let l=()=>{let p;return r(m=>p=m),or(p)?p.get():p},c=p=>{let m;r(b=>m=b),or(m)?m.set(p):a(()=>{},{scope:{__placeholder:p}})};typeof i=="string"&&e.type==="radio"&&K(()=>{e.hasAttribute("name")||e.setAttribute("name",i)});let d=t.includes("change")||t.includes("lazy"),h=t.includes("blur"),u=t.includes("enter"),f=d||h||u,g;if(Wt)g=()=>{};else if(f){let p=[],m=b=>c(Di(e,t,b,l()));if(d&&p.push(ke(e,"change",t,m)),h&&(p.push(ke(e,"blur",t,m)),e.form)){let b=e.form,y=()=>m({target:e});b._x_pendingModelUpdates||(b._x_pendingModelUpdates=[]),b._x_pendingModelUpdates.push(y),s(()=>{b._x_pendingModelUpdates&&b._x_pendingModelUpdates.splice(b._x_pendingModelUpdates.indexOf(y),1)})}u&&p.push(ke(e,"keydown",t,b=>{b.key==="Enter"&&m(b)})),g=()=>p.forEach(b=>b())}else{let p=e.tagName.toLowerCase()==="select"||["checkbox","radio"].includes(e.type)?"change":"input";g=ke(e,p,t,m=>{c(Di(e,t,m,l()))})}if(t.includes("fill")&&([void 0,null,""].includes(l())||Fi(e)&&Array.isArray(l())||e.tagName.toLowerCase()==="select"&&e.multiple)&&c(Di(e,t,{target:e},l())),e._x_removeModelListeners||(e._x_removeModelListeners={}),e._x_removeModelListeners.default=g,s(()=>e._x_removeModelListeners.default()),e.form){let p=ke(e.form,"reset",[],m=>{_s(()=>e._x_model&&e._x_model.set(Di(e,t,{target:e},l())))});s(()=>p())}e._x_model={get(){return l()},set(p){c(p)},setWithModifiers:ba(t,c)},e._x_forceModelUpdate=p=>{p===void 0&&typeof i=="string"&&i.match(/\./)&&(p=""),K(()=>{Fi(e)?Array.isArray(p)?e.checked=p.some(m=>m==e.value):e.checked=!!p:ws(e)?typeof p=="boolean"?e.checked=Ri(e.value)===p:e.checked=e.value==p:Hr(e,"value",p)})},n(()=>{let p=l();t.includes("unintrusive")&&document.activeElement.isSameNode(e)||e._x_forceModelUpdate(p)})});function Di(e,t,i,n){return K(()=>{if(i instanceof CustomEvent&&i.detail!==void 0)return i.detail!==null&&i.detail!==void 0?i.detail:i.target.value;if(Fi(e))if(Array.isArray(n)){let s=null;return t.includes("number")?s=Wn(i.target.value):t.includes("boolean")?s=Ri(i.target.value):s=i.target.value,i.target.checked?n.includes(s)?n:n.concat([s]):n.filter(o=>!Mu(o,s))}else return i.target.checked;else{if(e.tagName.toLowerCase()==="select"&&e.multiple)return t.includes("number")?Array.from(i.target.selectedOptions).map(s=>{let o=s.value||s.text;return Wn(o)}):t.includes("boolean")?Array.from(i.target.selectedOptions).map(s=>{let o=s.value||s.text;return Ri(o)}):Array.from(i.target.selectedOptions).map(s=>s.value||s.text);{let s;return ws(e)?i.target.checked?s=i.target.value:s=n:s=i.target.value,t.includes("number")?Wn(s):t.includes("boolean")?Ri(s):t.includes("trim")?s.trim():s}}})}function Wn(e){let t=e?parseFloat(e):null;return ku(t)?t:e}function Mu(e,t){return e==t}function ku(e){return!Array.isArray(e)&&!isNaN(e)}function or(e){return e!==null&&typeof e=="object"&&typeof e.get=="function"&&typeof e.set=="function"}q("cloak",e=>queueMicrotask(()=>K(()=>e.removeAttribute(Le("cloak")))));Nr(()=>`[${Le("init")}]`);q("init",Ut((e,{expression:t},{evaluate:i})=>typeof t=="string"?!!t.trim()&&i(t,{},!1):i(t,{},!1)));q("text",(e,{expression:t},{effect:i,evaluateLater:n})=>{let s=n(t);i(()=>{s(o=>{K(()=>{e.textContent=o})})})});q("html",(e,{expression:t},{effect:i,evaluateLater:n})=>{let s=n(t);i(()=>{s(o=>{K(()=>{e.innerHTML=o??"",e._x_ignoreSelf=!0,Tt(e),delete e._x_ignoreSelf})})})});bs(Cr(":",Ar(Le("bind:"))));var xa=(e,{value:t,modifiers:i,expression:n,original:s},{effect:o,cleanup:r})=>{if(!t){let l={};Ah(l),et(e,n)(d=>{Gr(e,d,s)},{scope:l});return}if(t==="key")return Pu(e,n);if(e._x_inlineBindings&&e._x_inlineBindings[t]&&e._x_inlineBindings[t].extract)return;let a=et(e,n);o(()=>a(l=>{l===void 0&&typeof n=="string"&&n.match(/\./)&&(l=""),K(()=>Hr(e,t,l,i))})),r(()=>{e._x_undoAddedClasses&&e._x_undoAddedClasses(),e._x_undoAddedStyles&&e._x_undoAddedStyles()})};xa.inline=(e,{value:t,modifiers:i,expression:n})=>{t&&(e._x_inlineBindings||(e._x_inlineBindings={}),e._x_inlineBindings[t]={expression:n,extract:!1})};q("bind",xa);function Pu(e,t){e._x_keyExpression=t}Fr(()=>`[${Le("data")}]`);q("data",(e,{expression:t},{cleanup:i})=>{if(Cu(e))return;t=t===""?"{}":t;let n={};Qe(n,e);let s={};Lh(s,n);let o=le(e,t,{scope:s});(o===void 0||o===!0)&&(o={}),Qe(o,e);let r=Ae(o);ps(r);let a=ii(e,r);r.init&&le(e,r.init),i(()=>{r.destroy&&le(e,r.destroy),a()})});$i((e,t)=>{e._x_dataStack&&(t._x_dataStack=e._x_dataStack,t.setAttribute("data-has-alpine-state",!0))});function Cu(e){return Wt?ns?!0:e.hasAttribute("data-has-alpine-state"):!1}q("show",(e,{modifiers:t,expression:i},{effect:n})=>{let s=et(e,i);e._x_doHide||(e._x_doHide=()=>{K(()=>{e.style.setProperty("display","none",t.includes("important")?"important":void 0)})}),e._x_doShow||(e._x_doShow=()=>{K(()=>{e.style.length===1&&e.style.display==="none"?e.removeAttribute("style"):e.style.removeProperty("display")})});let o=()=>{e._x_doHide(),e._x_isShown=!1},r=()=>{e._x_doShow(),e._x_isShown=!0},a=()=>setTimeout(r),l=es(h=>h?r():o(),h=>{typeof e._x_toggleAndCascadeWithTransitions=="function"?e._x_toggleAndCascadeWithTransitions(e,h,r,o):h?a():o()}),c,d=!0;n(()=>s(h=>{!d&&h===c||(t.includes("immediate")&&(h?a():o()),l(h),c=h,d=!1)}))});q("for",(e,{expression:t},{effect:i,cleanup:n})=>{let s=Lu(t),o=et(e,s.items),r=et(e,e._x_keyExpression||"index");e._x_lookup=new Map,i(()=>Ou(e,s,o,r)),n(()=>{e._x_lookup.forEach(a=>K(()=>{Te(a),a.remove()})),delete e._x_lookup})});function Au(e){return t=>{Object.entries(t).forEach(([i,n])=>{e[i]=n})}}function Ou(e,t,i,n){i(s=>{Du(s)&&(s=Array.from({length:s},(c,d)=>d+1)),s===void 0&&(s=[]),s instanceof Set&&(s=Array.from(s)),s instanceof Map&&(s=Array.from(s));let o=e._x_lookup,r=new Map;e._x_lookup=r;let a=Ru(s),l=Object.entries(s).map(([c,d])=>{a||(c=parseInt(c));let h=Tu(t,d,c,s),u;return n(f=>{typeof f=="object"&&vt("x-for key cannot be an object, it must be a string or an integer",e),o.has(f)&&(r.set(f,o.get(f)),o.delete(f)),u=f},{scope:{index:c,...h}}),[u,h]});K(()=>{o.forEach(h=>{Te(h),h.remove()});let c=new Set,d=e;l.forEach(([h,u])=>{if(r.has(h)){let p=r.get(h);p._x_refreshXForScope(u),d.nextElementSibling!==p&&(d.nextElementSibling&&p.replaceWith(d.nextElementSibling),d.after(p)),d=p,p._x_currentIfEl&&(p.nextElementSibling!==p._x_currentIfEl&&d.after(p._x_currentIfEl),d=p._x_currentIfEl);return}e.content.children.length>1&&vt("x-for templates require a single root element, additional elements will be ignored.",e);let f=document.importNode(e.content,!0).firstElementChild,g=Ae(u);ii(f,g,e),f._x_refreshXForScope=Au(g),r.set(h,f),c.add(f),d.after(f),d=f}),Ut(()=>c.forEach(h=>Tt(h)))()})})}function Lu(e){let t=/,([^,\}\]]*)(?:,([^,\}\]]*))?$/,i=/^\s*\(|\)\s*$/g,n=/([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/,s=e.match(n);if(!s)return;let o={};o.items=s[2].trim();let r=s[1].replace(i,"").trim(),a=r.match(t);return a?(o.item=r.replace(t,"").trim(),o.index=a[1].trim(),a[2]&&(o.collection=a[2].trim())):o.item=r,o}function Tu(e,t,i,n){let s={};return/^\[.*\]$/.test(e.item)&&Array.isArray(t)?e.item.replace("[","").replace("]","").split(",").map(r=>r.trim()).forEach((r,a)=>{s[r]=t[a]}):/^\{.*\}$/.test(e.item)&&!Array.isArray(t)&&typeof t=="object"?e.item.replace("{","").replace("}","").split(",").map(r=>r.trim()).forEach(r=>{s[r]=t[r]}):s[e.item]=t,e.index&&(s[e.index]=i),e.collection&&(s[e.collection]=n),s}function Du(e){return!Array.isArray(e)&&!isNaN(e)}function Ru(e){return typeof e=="object"&&!Array.isArray(e)}function _a(){}_a.inline=(e,{expression:t},{cleanup:i})=>{let n=zi(e);n&&(n._x_refs||(n._x_refs={}),n._x_refs[t]=e,i(()=>delete n._x_refs[t]))};q("ref",_a);q("if",(e,{expression:t},{effect:i,cleanup:n})=>{e.tagName.toLowerCase()!=="template"&&vt("x-if can only be used on a <template> tag",e);let s=et(e,t),o=()=>{if(e._x_currentIfEl)return e._x_currentIfEl;let a=e.content.cloneNode(!0).firstElementChild;return ii(a,{},e),K(()=>{e.after(a),Ut(()=>Tt(a))()}),e._x_currentIfEl=a,e._x_undoIf=()=>{K(()=>{Te(a),a.remove()}),delete e._x_currentIfEl},a},r=()=>{e._x_undoIf&&(e._x_undoIf(),delete e._x_undoIf)};i(()=>s(a=>{a?o():r()})),n(()=>e._x_undoIf&&e._x_undoIf())});q("id",(e,{expression:t},{evaluate:i})=>{i(t).forEach(s=>mu(e,s))});$i((e,t)=>{e._x_ids&&(t._x_ids=e._x_ids)});bs(Cr("@",Ar(Le("on:"))));q("on",Ut((e,{value:t,modifiers:i,expression:n},{cleanup:s})=>{let o=n?et(e,n):()=>{};e.tagName.toLowerCase()==="template"&&(e._x_forwardEvents||(e._x_forwardEvents=[]),e._x_forwardEvents.includes(t)||e._x_forwardEvents.push(t));let r=ke(e,t,i,a=>{o(()=>{},{scope:{$event:a},params:[a]})});s(()=>r())}));Ki("Collapse","collapse","collapse");Ki("Intersect","intersect","intersect");Ki("Focus","trap","focus");Ki("Mask","mask","mask");function Ki(e,t,i){q(t,n=>vt(`You can't use [x-${t}] without first installing the "${e}" plugin here: https://alpinejs.dev/plugins/${i}`,n))}De.setEvaluator(Fd);De.setRawEvaluator(jd);De.setReactivityEngine({reactive:Os,effect:$h,release:jh,raw:z});var Eu=De,Z=Eu;var C=e=>typeof e=="string",ni=()=>{let e,t,i=new Promise((n,s)=>{e=n,t=s});return i.resolve=e,i.reject=t,i},va=e=>e==null?"":String(e),Iu=(e,t,i)=>{e.forEach(n=>{t[n]&&(i[n]=t[n])})},Fu=/###/g,wa=e=>e&&e.includes("###")?e.replace(Fu,"."):e,Sa=e=>!e||C(e),si=(e,t,i)=>{let n=C(t)?t.split("."):t,s=0;for(;s<n.length-1;){if(Sa(e))return{};let o=wa(n[s]);!e[o]&&i&&(e[o]=new i),Object.prototype.hasOwnProperty.call(e,o)?e=e[o]:e={},++s}return Sa(e)?{}:{obj:e,k:wa(n[s])}},Ma=(e,t,i)=>{let{obj:n,k:s}=si(e,t,Object);if(n!==void 0||t.length===1){n[s]=i;return}let o=t[t.length-1],r=t.slice(0,t.length-1),a=si(e,r,Object);for(;a.obj===void 0&&r.length;)o=`${r[r.length-1]}.${o}`,r=r.slice(0,r.length-1),a=si(e,r,Object),a?.obj&&typeof a.obj[`${a.k}.${o}`]<"u"&&(a.obj=void 0);a.obj[`${a.k}.${o}`]=i},Nu=(e,t,i,n)=>{let{obj:s,k:o}=si(e,t,Object);s[o]=s[o]||[],s[o].push(i)},qi=(e,t)=>{let{obj:i,k:n}=si(e,t);if(i&&Object.prototype.hasOwnProperty.call(i,n))return i[n]},zu=(e,t,i)=>{let n=qi(e,i);return n!==void 0?n:qi(t,i)},La=(e,t,i)=>{for(let n in t)n!=="__proto__"&&n!=="constructor"&&(n in e?C(e[n])||e[n]instanceof String||C(t[n])||t[n]instanceof String?i&&(e[n]=t[n]):La(e[n],t[n],i):e[n]=t[n]);return e},Dt=e=>e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"),Bu={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;"},$u=e=>C(e)?e.replace(/[&<>"'\/]/g,t=>Bu[t]):e,Rs=class{constructor(t){this.capacity=t,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(t){let i=this.regExpMap.get(t);if(i!==void 0)return i;let n=new RegExp(t);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(t,n),this.regExpQueue.push(t),n}},ju=[" ",",","?","!",";"],Vu=new Rs(20),Hu=(e,t,i)=>{t=t||"",i=i||"";let n=ju.filter(r=>!t.includes(r)&&!i.includes(r));if(n.length===0)return!0;let s=Vu.getRegExp(`(${n.map(r=>r==="?"?"\\?":r).join("|")})`),o=!s.test(e);if(!o){let r=e.indexOf(i);r>0&&!s.test(e.substring(0,r))&&(o=!0)}return o},Es=(e,t,i=".")=>{if(!e)return;if(e[t])return Object.prototype.hasOwnProperty.call(e,t)?e[t]:void 0;let n=t.split(i),s=e;for(let o=0;o<n.length;){if(!s||typeof s!="object")return;let r,a="";for(let l=o;l<n.length;++l)if(l!==o&&(a+=i),a+=n[l],r=s[a],r!==void 0){if(["string","number","boolean"].includes(typeof r)&&l<n.length-1)continue;o+=l-o+1;break}s=r}return s},oi=e=>e?.replace(/_/g,"-"),Wu={type:"logger",log(e){this.output("log",e)},warn(e){this.output("warn",e)},error(e){this.output("error",e)},output(e,t){console?.[e]?.apply?.(console,t)}},Is=class e{constructor(t,i={}){this.init(t,i)}init(t,i={}){this.prefix=i.prefix||"i18next:",this.logger=t||Wu,this.options=i,this.debug=i.debug}log(...t){return this.forward(t,"log","",!0)}warn(...t){return this.forward(t,"warn","",!0)}error(...t){return this.forward(t,"error","")}deprecate(...t){return this.forward(t,"warn","WARNING DEPRECATED: ",!0)}forward(t,i,n,s){return s&&!this.debug?null:(t=t.map(o=>C(o)?o.replace(/[\r\n\x00-\x1F\x7F]/g," "):o),C(t[0])&&(t[0]=`${n}${this.prefix} ${t[0]}`),this.logger[i](t))}create(t){return new e(this.logger,{prefix:`${this.prefix}:${t}:`,...this.options})}clone(t){return t=t||this.options,t.prefix=t.prefix||this.prefix,new e(this.logger,t)}},wt=new Is,Ee=class{constructor(){this.observers={}}on(t,i){return t.split(" ").forEach(n=>{this.observers[n]||(this.observers[n]=new Map);let s=this.observers[n].get(i)||0;this.observers[n].set(i,s+1)}),this}off(t,i){if(this.observers[t]){if(!i){delete this.observers[t];return}this.observers[t].delete(i)}}once(t,i){let n=(...s)=>{i(...s),this.off(t,n)};return this.on(t,n),this}emit(t,...i){this.observers[t]&&Array.from(this.observers[t].entries()).forEach(([s,o])=>{for(let r=0;r<o;r++)s(...i)}),this.observers["*"]&&Array.from(this.observers["*"].entries()).forEach(([s,o])=>{for(let r=0;r<o;r++)s(t,...i)})}},Yi=class extends Ee{constructor(t,i={ns:["translation"],defaultNS:"translation"}){super(),this.data=t||{},this.options=i,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.options.ignoreJSONStructure===void 0&&(this.options.ignoreJSONStructure=!0)}addNamespaces(t){this.options.ns.includes(t)||this.options.ns.push(t)}removeNamespaces(t){let i=this.options.ns.indexOf(t);i>-1&&this.options.ns.splice(i,1)}getResource(t,i,n,s={}){let o=s.keySeparator!==void 0?s.keySeparator:this.options.keySeparator,r=s.ignoreJSONStructure!==void 0?s.ignoreJSONStructure:this.options.ignoreJSONStructure,a;t.includes(".")?a=t.split("."):(a=[t,i],n&&(Array.isArray(n)?a.push(...n):C(n)&&o?a.push(...n.split(o)):a.push(n)));let l=qi(this.data,a);return!l&&!i&&!n&&t.includes(".")&&(t=a[0],i=a[1],n=a.slice(2).join(".")),l||!r||!C(n)?l:Es(this.data?.[t]?.[i],n,o)}addResource(t,i,n,s,o={silent:!1}){let r=o.keySeparator!==void 0?o.keySeparator:this.options.keySeparator,a=[t,i];n&&(a=a.concat(r?n.split(r):n)),t.includes(".")&&(a=t.split("."),s=i,i=a[1]),this.addNamespaces(i),Ma(this.data,a,s),o.silent||this.emit("added",t,i,n,s)}addResources(t,i,n,s={silent:!1}){for(let o in n)(C(n[o])||Array.isArray(n[o]))&&this.addResource(t,i,o,n[o],{silent:!0});s.silent||this.emit("added",t,i,n)}addResourceBundle(t,i,n,s,o,r={silent:!1,skipCopy:!1}){let a=[t,i];t.includes(".")&&(a=t.split("."),s=n,n=i,i=a[1]),this.addNamespaces(i);let l=qi(this.data,a)||{};r.skipCopy||(n=JSON.parse(JSON.stringify(n))),s?La(l,n,o):l={...l,...n},Ma(this.data,a,l),r.silent||this.emit("added",t,i,n)}removeResourceBundle(t,i){this.hasResourceBundle(t,i)&&delete this.data[t][i],this.removeNamespaces(i),this.emit("removed",t,i)}hasResourceBundle(t,i){return this.getResource(t,i)!==void 0}getResourceBundle(t,i){return i||(i=this.options.defaultNS),this.getResource(t,i)}getDataByLanguage(t){return this.data[t]}hasLanguageSomeTranslations(t){let i=this.getDataByLanguage(t);return!!(i&&Object.keys(i)||[]).find(s=>i[s]&&Object.keys(i[s]).length>0)}toJSON(){return this.data}},Ta={processors:{},addPostProcessor(e){this.processors[e.name]=e},handle(e,t,i,n,s){return e.forEach(o=>{t=this.processors[o]?.process(t,i,n,s)??t}),t}},Da=Symbol("i18next/PATH_KEY");function Ku(){let e=[],t=Object.create(null),i;return t.get=(n,s)=>(i?.revoke?.(),s===Da?e:(e.push(s),i=Proxy.revocable(n,t),i.proxy)),Proxy.revocable(Object.create(null),t).proxy}function Re(e,t){let{[Da]:i}=e(Ku()),n=t?.keySeparator??".",s=t?.nsSeparator??":";if(i.length>1&&s){let o=t?.ns,r=Array.isArray(o)?o:null;if(r&&r.length>1&&r.slice(1).includes(i[0]))return`${i[0]}${s}${i.slice(1).join(n)}`}return i.join(n)}var Ls=e=>!C(e)&&typeof e!="boolean"&&typeof e!="number",Xi=class e extends Ee{constructor(t,i={}){super(),Iu(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],t,this),this.options=i,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=wt.create("translator"),this.checkedLoadedFor={}}changeLanguage(t){t&&(this.language=t)}exists(t,i={interpolation:{}}){let n={...i};if(t==null)return!1;let s=this.resolve(t,n);if(s?.res===void 0)return!1;let o=Ls(s.res);return!(n.returnObjects===!1&&o)}extractFromKey(t,i){let n=i.nsSeparator!==void 0?i.nsSeparator:this.options.nsSeparator;n===void 0&&(n=":");let s=i.keySeparator!==void 0?i.keySeparator:this.options.keySeparator,o=i.ns||this.options.defaultNS||[],r=n&&t.includes(n),a=!this.options.userDefinedKeySeparator&&!i.keySeparator&&!this.options.userDefinedNsSeparator&&!i.nsSeparator&&!Hu(t,n,s);if(r&&!a){let l=t.match(this.interpolator.nestingRegexp);if(l&&l.length>0)return{key:t,namespaces:C(o)?[o]:o};let c=t.split(n);(n!==s||n===s&&this.options.ns.includes(c[0]))&&(o=c.shift()),t=c.join(s)}return{key:t,namespaces:C(o)?[o]:o}}translate(t,i,n){let s=typeof i=="object"?{...i}:i;if(typeof s!="object"&&this.options.overloadTranslationOptionHandler&&(s=this.options.overloadTranslationOptionHandler(arguments)),typeof s=="object"&&(s={...s}),s||(s={}),t==null)return"";typeof t=="function"&&(t=Re(t,{...this.options,...s})),Array.isArray(t)||(t=[String(t)]),t=t.map(I=>typeof I=="function"?Re(I,{...this.options,...s}):String(I));let o=s.returnDetails!==void 0?s.returnDetails:this.options.returnDetails,r=s.keySeparator!==void 0?s.keySeparator:this.options.keySeparator,{key:a,namespaces:l}=this.extractFromKey(t[t.length-1],s),c=l[l.length-1],d=s.nsSeparator!==void 0?s.nsSeparator:this.options.nsSeparator;d===void 0&&(d=":");let h=s.lng||this.language,u=s.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(h?.toLowerCase()==="cimode")return u?o?{res:`${c}${d}${a}`,usedKey:a,exactUsedKey:a,usedLng:h,usedNS:c,usedParams:this.getUsedParamsDetails(s)}:`${c}${d}${a}`:o?{res:a,usedKey:a,exactUsedKey:a,usedLng:h,usedNS:c,usedParams:this.getUsedParamsDetails(s)}:a;let f=this.resolve(t,s),g=f?.res,p=f?.usedKey||a,m=f?.exactUsedKey||a,b=["[object Number]","[object Function]","[object RegExp]"],y=s.joinArrays!==void 0?s.joinArrays:this.options.joinArrays,v=!this.i18nFormat||this.i18nFormat.handleAsObject,_=s.count!==void 0&&!C(s.count),x=e.hasDefaultValue(s),M=_?this.pluralResolver.getSuffix(h,s.count,s):"",w=s.ordinal&&_?this.pluralResolver.getSuffix(h,s.count,{ordinal:!1}):"",S=_&&!s.ordinal&&s.count===0,P=S&&s[`defaultValue${this.options.pluralSeparator}zero`]||s[`defaultValue${M}`]||s[`defaultValue${w}`]||s.defaultValue,A=g;v&&!g&&x&&(A=P);let L=Ls(A),R=Object.prototype.toString.apply(A);if(v&&A&&L&&!b.includes(R)&&!(C(y)&&Array.isArray(A))){if(!s.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");let I=this.options.returnedObjectHandler?this.options.returnedObjectHandler(p,A,{...s,ns:l}):`key '${a} (${this.language})' returned an object instead of string.`;return o?(f.res=I,f.usedParams=this.getUsedParamsDetails(s),f):I}if(r){let I=Array.isArray(A),W=I?[]:{},$=I?m:p;for(let F in A)if(Object.prototype.hasOwnProperty.call(A,F)){let j=`${$}${r}${F}`;x&&!g?W[F]=this.translate(j,{...s,defaultValue:Ls(P)?P[F]:void 0,joinArrays:!1,ns:l}):W[F]=this.translate(j,{...s,joinArrays:!1,ns:l}),W[F]===j&&(W[F]=A[F])}g=W}}else if(v&&C(y)&&Array.isArray(g))g=g.join(y),g&&(g=this.extendTranslation(g,t,s,n));else{let I=!1,W=!1;!this.isValidLookup(g)&&x&&(I=!0,g=P),this.isValidLookup(g)||(W=!0,g=a);let F=(s.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&W?void 0:g,j=x&&P!==g&&this.options.updateMissing;if(W||I||j){if(this.logger.log(j?"updateKey":"missingKey",h,c,_&&!j?`${a}${this.pluralResolver.getSuffix(h,s.count,s)}`:a,j?P:g),r){let J=this.resolve(a,{...s,keySeparator:!1});J&&J.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}let yt=[],At=this.languageUtils.getFallbackCodes(this.options.fallbackLng,s.lng||this.language);if(this.options.saveMissingTo==="fallback"&&At&&At[0])for(let J=0;J<At.length;J++)yt.push(At[J]);else this.options.saveMissingTo==="all"?yt=this.languageUtils.toResolveHierarchy(s.lng||this.language):yt.push(s.lng||this.language);let Ot=(J,it,ut)=>{let xt=x&&ut!==g?ut:F;this.options.missingKeyHandler?this.options.missingKeyHandler(J,c,it,xt,j,s):this.backendConnector?.saveMissing&&this.backendConnector.saveMissing(J,c,it,xt,j,s),this.emit("missingKey",J,c,it,g)};this.options.saveMissing&&(this.options.saveMissingPlurals&&_?yt.forEach(J=>{let it=this.pluralResolver.getSuffixes(J,s);S&&s[`defaultValue${this.options.pluralSeparator}zero`]&&!it.includes(`${this.options.pluralSeparator}zero`)&&it.push(`${this.options.pluralSeparator}zero`),it.forEach(ut=>{Ot([J],a+ut,s[`defaultValue${ut}`]||P)})}):Ot(yt,a,P))}g=this.extendTranslation(g,t,s,f,n),W&&g===a&&this.options.appendNamespaceToMissingKey&&(g=`${c}${d}${a}`),(W||I)&&this.options.parseMissingKeyHandler&&(g=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${c}${d}${a}`:a,I?g:void 0,s))}return o?(f.res=g,f.usedParams=this.getUsedParamsDetails(s),f):g}extendTranslation(t,i,n,s,o){if(this.i18nFormat?.parse)t=this.i18nFormat.parse(t,{...this.options.interpolation.defaultVariables,...n},n.lng||this.language||s.usedLng,s.usedNS,s.usedKey,{resolved:s});else if(!n.skipInterpolation){n.interpolation&&this.interpolator.init({...n,interpolation:{...this.options.interpolation,...n.interpolation}});let l=C(t)&&(n?.interpolation?.skipOnVariables!==void 0?n.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables),c;if(l){let h=t.match(this.interpolator.nestingRegexp);c=h&&h.length}let d=n.replace&&!C(n.replace)?n.replace:n;if(this.options.interpolation.defaultVariables&&(d={...this.options.interpolation.defaultVariables,...d}),t=this.interpolator.interpolate(t,d,n.lng||this.language||s.usedLng,n),l){let h=t.match(this.interpolator.nestingRegexp),u=h&&h.length;c<u&&(n.nest=!1)}!n.lng&&s&&s.res&&(n.lng=this.language||s.usedLng),n.nest!==!1&&(t=this.interpolator.nest(t,(...h)=>o?.[0]===h[0]&&!n.context?(this.logger.warn(`It seems you are nesting recursively key: ${h[0]} in key: ${i[0]}`),null):this.translate(...h,i),n)),n.interpolation&&this.interpolator.reset()}let r=n.postProcess||this.options.postProcess,a=C(r)?[r]:r;return t!=null&&a?.length&&n.applyPostProcessor!==!1&&(t=Ta.handle(a,t,i,this.options&&this.options.postProcessPassResolved?{i18nResolved:{...s,usedParams:this.getUsedParamsDetails(n)},...n}:n,this)),t}resolve(t,i={}){let n,s,o,r,a;return C(t)&&(t=[t]),Array.isArray(t)&&(t=t.map(l=>typeof l=="function"?Re(l,{...this.options,...i}):l)),t.forEach(l=>{if(this.isValidLookup(n))return;let c=this.extractFromKey(l,i),d=c.key;s=d;let h=c.namespaces;this.options.fallbackNS&&(h=h.concat(this.options.fallbackNS));let u=i.count!==void 0&&!C(i.count),f=u&&!i.ordinal&&i.count===0,g=i.context!==void 0&&(C(i.context)||typeof i.context=="number")&&i.context!=="",p=i.lngs?i.lngs:this.languageUtils.toResolveHierarchy(i.lng||this.language,i.fallbackLng);h.forEach(m=>{this.isValidLookup(n)||(a=m,!this.checkedLoadedFor[`${p[0]}-${m}`]&&this.utils?.hasLoadedNamespace&&!this.utils?.hasLoadedNamespace(a)&&(this.checkedLoadedFor[`${p[0]}-${m}`]=!0,this.logger.warn(`key "${s}" for languages "${p.join(", ")}" won't get resolved as namespace "${a}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),p.forEach(b=>{if(this.isValidLookup(n))return;r=b;let y=[d];if(this.i18nFormat?.addLookupKeys)this.i18nFormat.addLookupKeys(y,d,b,m,i);else{let _;u&&(_=this.pluralResolver.getSuffix(b,i.count,i));let x=`${this.options.pluralSeparator}zero`,M=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(u&&(i.ordinal&&_.startsWith(M)&&y.push(d+_.replace(M,this.options.pluralSeparator)),y.push(d+_),f&&y.push(d+x)),g){let w=`${d}${this.options.contextSeparator||"_"}${i.context}`;y.push(w),u&&(i.ordinal&&_.startsWith(M)&&y.push(w+_.replace(M,this.options.pluralSeparator)),y.push(w+_),f&&y.push(w+x))}}let v;for(;v=y.pop();)this.isValidLookup(n)||(o=v,n=this.getResource(b,m,v,i))}))})}),{res:n,usedKey:s,exactUsedKey:o,usedLng:r,usedNS:a}}isValidLookup(t){return t!==void 0&&!(!this.options.returnNull&&t===null)&&!(!this.options.returnEmptyString&&t==="")}getResource(t,i,n,s={}){return this.i18nFormat?.getResource?this.i18nFormat.getResource(t,i,n,s):this.resourceStore.getResource(t,i,n,s)}getUsedParamsDetails(t={}){let i=["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"],n=t.replace&&!C(t.replace),s=n?t.replace:t;if(n&&typeof t.count<"u"&&(s.count=t.count),this.options.interpolation.defaultVariables&&(s={...this.options.interpolation.defaultVariables,...s}),!n){s={...s};for(let o of i)delete s[o]}return s}static hasDefaultValue(t){let i="defaultValue";for(let n in t)if(Object.prototype.hasOwnProperty.call(t,n)&&n.startsWith(i)&&t[n]!==void 0)return!0;return!1}},Ji=class{constructor(t){this.options=t,this.supportedLngs=this.options.supportedLngs||!1,this.logger=wt.create("languageUtils")}getScriptPartFromCode(t){if(t=oi(t),!t||!t.includes("-"))return null;let i=t.split("-");return i.length===2||(i.pop(),i[i.length-1].toLowerCase()==="x")?null:this.formatLanguageCode(i.join("-"))}getLanguagePartFromCode(t){if(t=oi(t),!t||!t.includes("-"))return t;let i=t.split("-");return this.formatLanguageCode(i[0])}formatLanguageCode(t){if(C(t)&&t.includes("-")){let i;try{i=Intl.getCanonicalLocales(t)[0]}catch{}return i&&this.options.lowerCaseLng&&(i=i.toLowerCase()),i||(this.options.lowerCaseLng?t.toLowerCase():t)}return this.options.cleanCode||this.options.lowerCaseLng?t.toLowerCase():t}isSupportedCode(t){return(this.options.load==="languageOnly"||this.options.nonExplicitSupportedLngs)&&(t=this.getLanguagePartFromCode(t)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.includes(t)}getBestMatchFromCodes(t){if(!t)return null;let i;return t.forEach(n=>{if(i)return;let s=this.formatLanguageCode(n);(!this.options.supportedLngs||this.isSupportedCode(s))&&(i=s)}),!i&&this.options.supportedLngs&&t.forEach(n=>{if(i)return;let s=this.getScriptPartFromCode(n);if(this.isSupportedCode(s))return i=s;let o=this.getLanguagePartFromCode(n);if(this.isSupportedCode(o))return i=o;i=this.options.supportedLngs.find(r=>r===o?!0:!r.includes("-")&&!o.includes("-")?!1:!!(r.includes("-")&&!o.includes("-")&&r.slice(0,r.indexOf("-"))===o||r.startsWith(o)&&o.length>1))}),i||(i=this.getFallbackCodes(this.options.fallbackLng)[0]),i}getFallbackCodes(t,i){if(!t)return[];if(typeof t=="function"&&(t=t(i)),C(t)&&(t=[t]),Array.isArray(t))return t;if(!i)return t.default||[];let n=t[i];return n||(n=t[this.getScriptPartFromCode(i)]),n||(n=t[this.formatLanguageCode(i)]),n||(n=t[this.getLanguagePartFromCode(i)]),n||(n=t.default),n||[]}toResolveHierarchy(t,i){let n=this.getFallbackCodes((i===!1?[]:i)||this.options.fallbackLng||[],t),s=[],o=r=>{r&&(this.isSupportedCode(r)?s.push(r):this.logger.warn(`rejecting language code not found in supportedLngs: ${r}`))};return C(t)&&(t.includes("-")||t.includes("_"))?(this.options.load!=="languageOnly"&&o(this.formatLanguageCode(t)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&o(this.getScriptPartFromCode(t)),this.options.load!=="currentOnly"&&o(this.getLanguagePartFromCode(t))):C(t)&&o(this.formatLanguageCode(t)),n.forEach(r=>{s.includes(r)||o(this.formatLanguageCode(r))}),s}},ka={zero:0,one:1,two:2,few:3,many:4,other:5},Pa={select:e=>e===1?"one":"other",resolvedOptions:()=>({pluralCategories:["one","other"]})},Fs=class{constructor(t,i={}){this.languageUtils=t,this.options=i,this.logger=wt.create("pluralResolver"),this.pluralRulesCache={}}clearCache(){this.pluralRulesCache={}}getRule(t,i={}){let n=oi(t==="dev"?"en":t),s=i.ordinal?"ordinal":"cardinal",o=JSON.stringify({cleanedCode:n,type:s});if(o in this.pluralRulesCache)return this.pluralRulesCache[o];let r;try{r=new Intl.PluralRules(n,{type:s})}catch{if(typeof Intl>"u")return this.logger.error("No Intl support, please use an Intl polyfill!"),Pa;if(!t.match(/-|_/))return Pa;let l=this.languageUtils.getLanguagePartFromCode(t);r=this.getRule(l,i)}return this.pluralRulesCache[o]=r,r}needsPlural(t,i={}){let n=this.getRule(t,i);return n||(n=this.getRule("dev",i)),n?.resolvedOptions().pluralCategories.length>1}getPluralFormsOfKey(t,i,n={}){return this.getSuffixes(t,n).map(s=>`${i}${s}`)}getSuffixes(t,i={}){let n=this.getRule(t,i);return n||(n=this.getRule("dev",i)),n?n.resolvedOptions().pluralCategories.sort((s,o)=>ka[s]-ka[o]).map(s=>`${this.options.prepend}${i.ordinal?`ordinal${this.options.prepend}`:""}${s}`):[]}getSuffix(t,i,n={}){let s=this.getRule(t,n);return s?`${this.options.prepend}${n.ordinal?`ordinal${this.options.prepend}`:""}${s.select(i)}`:(this.logger.warn(`no plural rule found for: ${t}`),this.getSuffix("dev",i,n))}},Ca=(e,t,i,n=".",s=!0)=>{let o=zu(e,t,i);return!o&&s&&C(i)&&(o=Es(e,i,n),o===void 0&&(o=Es(t,i,n))),o},Ts=e=>e.replace(/\$/g,"$$$$"),Gi=class{constructor(t={}){this.logger=wt.create("interpolator"),this.options=t,this.format=t?.interpolation?.format||(i=>i),this.init(t)}init(t={}){t.interpolation||(t.interpolation={escapeValue:!0});let{escape:i,escapeValue:n,useRawValueToEscape:s,prefix:o,prefixEscaped:r,suffix:a,suffixEscaped:l,formatSeparator:c,unescapeSuffix:d,unescapePrefix:h,nestingPrefix:u,nestingPrefixEscaped:f,nestingSuffix:g,nestingSuffixEscaped:p,nestingOptionsSeparator:m,maxReplaces:b,alwaysFormat:y}=t.interpolation;this.escape=i!==void 0?i:$u,this.escapeValue=n!==void 0?n:!0,this.useRawValueToEscape=s!==void 0?s:!1,this.prefix=o?Dt(o):r||"{{",this.suffix=a?Dt(a):l||"}}",this.formatSeparator=c||",",this.unescapePrefix=d?"":h?Dt(h):"-",this.unescapeSuffix=this.unescapePrefix?"":d?Dt(d):"",this.nestingPrefix=u?Dt(u):f||Dt("$t("),this.nestingSuffix=g?Dt(g):p||Dt(")"),this.nestingOptionsSeparator=m||",",this.maxReplaces=b||1e3,this.alwaysFormat=y!==void 0?y:!1,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){let t=(i,n)=>i?.source===n?(i.lastIndex=0,i):new RegExp(n,"g");this.regexp=t(this.regexp,`${this.prefix}(.+?)${this.suffix}`),this.regexpUnescape=t(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`),this.nestingRegexp=t(this.nestingRegexp,`${this.nestingPrefix}((?:[^()"']+|"[^"]*"|'[^']*'|\\((?:[^()]|"[^"]*"|'[^']*')*\\))*?)${this.nestingSuffix}`)}interpolate(t,i,n,s){let o,r,a,l=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},c=f=>{if(!f.includes(this.formatSeparator)){let b=Ca(i,l,f,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(b,void 0,n,{...s,...i,interpolationkey:f}):b}let g=f.split(this.formatSeparator),p=g.shift().trim(),m=g.join(this.formatSeparator).trim();return this.format(Ca(i,l,p,this.options.keySeparator,this.options.ignoreJSONStructure),m,n,{...s,...i,interpolationkey:p})};this.resetRegExp(),!this.escapeValue&&typeof t=="string"&&/\$t\([^)]*\{[^}]*\{\{/.test(t)&&this.logger.warn("nesting options string contains interpolated variables with escapeValue: false \u2014 if any of those values are attacker-controlled they can inject additional nesting options (e.g. redirect lng/ns). Sanitise untrusted input before passing it to t(), or keep escapeValue: true.");let d=s?.missingInterpolationHandler||this.options.missingInterpolationHandler,h=s?.interpolation?.skipOnVariables!==void 0?s.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:f=>Ts(f)},{regex:this.regexp,safeValue:f=>this.escapeValue?Ts(this.escape(f)):Ts(f)}].forEach(f=>{for(a=0;o=f.regex.exec(t);){let g=o[1].trim();if(r=c(g),r===void 0)if(typeof d=="function"){let m=d(t,o,s);r=C(m)?m:""}else if(s&&Object.prototype.hasOwnProperty.call(s,g))r="";else if(h){r=o[0];continue}else this.logger.warn(`missed to pass in variable ${g} for interpolating ${t}`),r="";else!C(r)&&!this.useRawValueToEscape&&(r=va(r));let p=f.safeValue(r);if(t=t.replace(o[0],p),h?(f.regex.lastIndex+=r.length,f.regex.lastIndex-=o[0].length):f.regex.lastIndex=0,a++,a>=this.maxReplaces)break}}),t}nest(t,i,n={}){let s,o,r,a=(l,c)=>{let d=this.nestingOptionsSeparator;if(!l.includes(d))return l;let h=l.split(new RegExp(`${Dt(d)}[ ]*{`)),u=`{${h[1]}`;l=h[0],u=this.interpolate(u,r);let f=u.match(/'/g),g=u.match(/"/g);((f?.length??0)%2===0&&!g||(g?.length??0)%2!==0)&&(u=u.replace(/'/g,'"'));try{r=JSON.parse(u),c&&(r={...c,...r})}catch(p){return this.logger.warn(`failed parsing options string in nesting for key ${l}`,p),`${l}${d}${u}`}return r.defaultValue&&r.defaultValue.includes(this.prefix)&&delete r.defaultValue,l};for(;s=this.nestingRegexp.exec(t);){let l=[];r={...n},r=r.replace&&!C(r.replace)?r.replace:r,r.applyPostProcessor=!1,delete r.defaultValue;let c=/{.*}/.test(s[1])?s[1].lastIndexOf("}")+1:s[1].indexOf(this.formatSeparator);if(c!==-1&&(l=s[1].slice(c).split(this.formatSeparator).map(d=>d.trim()).filter(Boolean),s[1]=s[1].slice(0,c)),o=i(a.call(this,s[1].trim(),r),r),o&&s[0]===t&&!C(o))return o;C(o)||(o=va(o)),o||(this.logger.warn(`missed to resolve ${s[1]} for nesting ${t}`),o=""),l.length&&(o=l.reduce((d,h)=>this.format(d,h,n.lng,{...n,interpolationkey:s[1].trim()}),o.trim())),t=t.replace(s[0],o),this.regexp.lastIndex=0}return t}},Uu=e=>{let t=e.toLowerCase().trim(),i={};if(e.includes("(")){let n=e.split("(");t=n[0].toLowerCase().trim();let s=n[1].slice(0,-1);t==="currency"&&!s.includes(":")?i.currency||(i.currency=s.trim()):t==="relativetime"&&!s.includes(":")?i.range||(i.range=s.trim()):s.split(";").forEach(r=>{if(r){let[a,...l]=r.split(":"),c=l.join(":").trim().replace(/^'+|'+$/g,""),d=a.trim();i[d]||(i[d]=c),c==="false"&&(i[d]=!1),c==="true"&&(i[d]=!0),isNaN(c)||(i[d]=parseInt(c,10))}})}return{formatName:t,formatOptions:i}},Aa=e=>{let t={};return(i,n,s)=>{let o=s;s&&s.interpolationkey&&s.formatParams&&s.formatParams[s.interpolationkey]&&s[s.interpolationkey]&&(o={...o,[s.interpolationkey]:void 0});let r=n+JSON.stringify(o),a=t[r];return a||(a=e(oi(n),s),t[r]=a),a(i)}},qu=e=>(t,i,n)=>e(oi(i),n)(t),Ns=class{constructor(t={}){this.logger=wt.create("formatter"),this.options=t,this.init(t)}init(t,i={interpolation:{}}){this.formatSeparator=i.interpolation.formatSeparator||",";let n=i.cacheInBuiltFormats?Aa:qu;this.formats={number:n((s,o)=>{let r=new Intl.NumberFormat(s,{...o});return a=>r.format(a)}),currency:n((s,o)=>{let r=new Intl.NumberFormat(s,{...o,style:"currency"});return a=>r.format(a)}),datetime:n((s,o)=>{let r=new Intl.DateTimeFormat(s,{...o});return a=>r.format(a)}),relativetime:n((s,o)=>{let r=new Intl.RelativeTimeFormat(s,{...o});return a=>r.format(a,o.range||"day")}),list:n((s,o)=>{let r=new Intl.ListFormat(s,{...o});return a=>r.format(a)})}}add(t,i){this.formats[t.toLowerCase().trim()]=i}addCached(t,i){this.formats[t.toLowerCase().trim()]=Aa(i)}format(t,i,n,s={}){if(!i||t==null)return t;let o=i.split(this.formatSeparator);if(o.length>1&&o[0].indexOf("(")>1&&!o[0].includes(")")&&o.find(a=>a.includes(")"))){let a=o.findIndex(l=>l.includes(")"));o[0]=[o[0],...o.splice(1,a)].join(this.formatSeparator)}return o.reduce((a,l)=>{let{formatName:c,formatOptions:d}=Uu(l);if(this.formats[c]){let h=a;try{let u=s?.formatParams?.[s.interpolationkey]||{},f=u.locale||u.lng||s.locale||s.lng||n;h=this.formats[c](a,f,{...d,...s,...u})}catch(u){this.logger.warn(u)}return h}else this.logger.warn(`there was no format function for ${c}`);return a},t)}},Yu=(e,t)=>{e.pending[t]!==void 0&&(delete e.pending[t],e.pendingCount--)},zs=class extends Ee{constructor(t,i,n,s={}){super(),this.backend=t,this.store=i,this.services=n,this.languageUtils=n.languageUtils,this.options=s,this.logger=wt.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=s.maxParallelReads||10,this.readingCalls=0,this.maxRetries=s.maxRetries>=0?s.maxRetries:5,this.retryTimeout=s.retryTimeout>=1?s.retryTimeout:350,this.state={},this.queue=[],this.backend?.init?.(n,s.backend,s)}queueLoad(t,i,n,s){let o={},r={},a={},l={};return t.forEach(c=>{let d=!0;i.forEach(h=>{let u=`${c}|${h}`;!n.reload&&this.store.hasResourceBundle(c,h)?this.state[u]=2:this.state[u]<0||(this.state[u]===1?r[u]===void 0&&(r[u]=!0):(this.state[u]=1,d=!1,r[u]===void 0&&(r[u]=!0),o[u]===void 0&&(o[u]=!0),l[h]===void 0&&(l[h]=!0)))}),d||(a[c]=!0)}),(Object.keys(o).length||Object.keys(r).length)&&this.queue.push({pending:r,pendingCount:Object.keys(r).length,loaded:{},errors:[],callback:s}),{toLoad:Object.keys(o),pending:Object.keys(r),toLoadLanguages:Object.keys(a),toLoadNamespaces:Object.keys(l)}}loaded(t,i,n){let s=t.split("|"),o=s[0],r=s[1];i&&this.emit("failedLoading",o,r,i),!i&&n&&this.store.addResourceBundle(o,r,n,void 0,void 0,{skipCopy:!0}),this.state[t]=i?-1:2,i&&n&&(this.state[t]=0);let a={};this.queue.forEach(l=>{Nu(l.loaded,[o],r),Yu(l,t),i&&l.errors.push(i),l.pendingCount===0&&!l.done&&(Object.keys(l.loaded).forEach(c=>{a[c]||(a[c]={});let d=l.loaded[c];d.length&&d.forEach(h=>{a[c][h]===void 0&&(a[c][h]=!0)})}),l.done=!0,l.errors.length?l.callback(l.errors):l.callback())}),this.emit("loaded",a),this.queue=this.queue.filter(l=>!l.done)}read(t,i,n,s=0,o=this.retryTimeout,r){if(!t.length)return r(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:t,ns:i,fcName:n,tried:s,wait:o,callback:r});return}this.readingCalls++;let a=(c,d)=>{if(this.readingCalls--,this.waitingReads.length>0){let h=this.waitingReads.shift();this.read(h.lng,h.ns,h.fcName,h.tried,h.wait,h.callback)}if(c&&d&&s<this.maxRetries){setTimeout(()=>{this.read(t,i,n,s+1,o*2,r)},o);return}r(c,d)},l=this.backend[n].bind(this.backend);if(l.length===2){try{let c=l(t,i);c&&typeof c.then=="function"?c.then(d=>a(null,d)).catch(a):a(null,c)}catch(c){a(c)}return}return l(t,i,a)}prepareLoading(t,i,n={},s){if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),s&&s();C(t)&&(t=this.languageUtils.toResolveHierarchy(t)),C(i)&&(i=[i]);let o=this.queueLoad(t,i,n,s);if(!o.toLoad.length)return o.pending.length||s(),null;o.toLoad.forEach(r=>{this.loadOne(r)})}load(t,i,n){this.prepareLoading(t,i,{},n)}reload(t,i,n){this.prepareLoading(t,i,{reload:!0},n)}loadOne(t,i=""){let n=t.split("|"),s=n[0],o=n[1];this.read(s,o,"read",void 0,void 0,(r,a)=>{r&&this.logger.warn(`${i}loading namespace ${o} for language ${s} failed`,r),!r&&a&&this.logger.log(`${i}loaded namespace ${o} for language ${s}`,a),this.loaded(t,r,a)})}saveMissing(t,i,n,s,o,r={},a=()=>{}){if(this.services?.utils?.hasLoadedNamespace&&!this.services?.utils?.hasLoadedNamespace(i)){this.logger.warn(`did not save key "${n}" as the namespace "${i}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");return}if(!(n==null||n==="")){if(this.backend?.create){let l={...r,isUpdate:o},c=this.backend.create.bind(this.backend);if(c.length<6)try{let d;c.length===5?d=c(t,i,n,s,l):d=c(t,i,n,s),d&&typeof d.then=="function"?d.then(h=>a(null,h)).catch(a):a(null,d)}catch(d){a(d)}else c(t,i,n,s,a,l)}!t||!t[0]||this.store.addResource(t[0],i,n,s)}}},Ds=()=>({debug:!1,initAsync:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:e=>{let t={};if(typeof e[1]=="object"&&(t=e[1]),C(e[1])&&(t.defaultValue=e[1]),C(e[2])&&(t.tDescription=e[2]),typeof e[2]=="object"||typeof e[3]=="object"){let i=e[3]||e[2];Object.keys(i).forEach(n=>{t[n]=i[n]})}return t},interpolation:{escapeValue:!0,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0},cacheInBuiltFormats:!0}),Oa=e=>(C(e.ns)&&(e.ns=[e.ns]),C(e.fallbackLng)&&(e.fallbackLng=[e.fallbackLng]),C(e.fallbackNS)&&(e.fallbackNS=[e.fallbackNS]),e.supportedLngs&&!e.supportedLngs.includes("cimode")&&(e.supportedLngs=e.supportedLngs.concat(["cimode"])),e),Ui=()=>{},Xu=e=>{Object.getOwnPropertyNames(Object.getPrototypeOf(e)).forEach(i=>{typeof e[i]=="function"&&(e[i]=e[i].bind(e))})},Bs=class e extends Ee{constructor(t={},i){if(super(),this.options=Oa(t),this.services={},this.logger=wt,this.modules={external:[]},Xu(this),i&&!this.isInitialized&&!t.isClone){if(!this.options.initAsync)return this.init(t,i),this;setTimeout(()=>{this.init(t,i)},0)}}init(t={},i){this.isInitializing=!0,typeof t=="function"&&(i=t,t={}),t.defaultNS==null&&t.ns&&(C(t.ns)?t.defaultNS=t.ns:t.ns.includes("translation")||(t.defaultNS=t.ns[0]));let n=Ds();this.options={...n,...this.options,...Oa(t)},this.options.interpolation={...n.interpolation,...this.options.interpolation},t.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=t.keySeparator),t.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=t.nsSeparator),typeof this.options.overloadTranslationOptionHandler!="function"&&(this.options.overloadTranslationOptionHandler=n.overloadTranslationOptionHandler);let s=c=>c?typeof c=="function"?new c:c:null;if(!this.options.isClone){this.modules.logger?wt.init(s(this.modules.logger),this.options):wt.init(null,this.options);let c;this.modules.formatter?c=this.modules.formatter:c=Ns;let d=new Ji(this.options);this.store=new Yi(this.options.resources,this.options);let h=this.services;h.logger=wt,h.resourceStore=this.store,h.languageUtils=d,h.pluralResolver=new Fs(d,{prepend:this.options.pluralSeparator}),c&&(h.formatter=s(c),h.formatter.init&&h.formatter.init(h,this.options),this.options.interpolation.format=h.formatter.format.bind(h.formatter)),h.interpolator=new Gi(this.options),h.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},h.backendConnector=new zs(s(this.modules.backend),h.resourceStore,h,this.options),h.backendConnector.on("*",(u,...f)=>{this.emit(u,...f)}),this.modules.languageDetector&&(h.languageDetector=s(this.modules.languageDetector),h.languageDetector.init&&h.languageDetector.init(h,this.options.detection,this.options)),this.modules.i18nFormat&&(h.i18nFormat=s(this.modules.i18nFormat),h.i18nFormat.init&&h.i18nFormat.init(this)),this.translator=new Xi(this.services,this.options),this.translator.on("*",(u,...f)=>{this.emit(u,...f)}),this.modules.external.forEach(u=>{u.init&&u.init(this)})}if(this.format=this.options.interpolation.format,i||(i=Ui),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){let c=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);c.length>0&&c[0]!=="dev"&&(this.options.lng=c[0])}!this.services.languageDetector&&!this.options.lng&&this.logger.warn("init: no languageDetector is used and no lng is defined"),["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach(c=>{this[c]=(...d)=>this.store[c](...d)}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(c=>{this[c]=(...d)=>(this.store[c](...d),this)});let a=ni(),l=()=>{let c=(d,h)=>{this.isInitializing=!1,this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn("init: i18next is already initialized. You should call init just once!"),this.isInitialized=!0,this.options.isClone||this.logger.log("initialized",this.options),this.emit("initialized",this.options),a.resolve(h),i(d,h)};if((this.languages||this.isLanguageChangingTo)&&!this.isInitialized)return c(null,this.t.bind(this));this.changeLanguage(this.options.lng,c)};return this.options.resources||!this.options.initAsync?l():setTimeout(l,0),a}loadResources(t,i=Ui){let n=i,s=C(t)?t:this.language;if(typeof t=="function"&&(n=t),!this.options.resources||this.options.partialBundledLanguages){if(s?.toLowerCase()==="cimode"&&(!this.options.preload||this.options.preload.length===0))return n();let o=[],r=a=>{if(!a||a==="cimode")return;this.services.languageUtils.toResolveHierarchy(a).forEach(c=>{c!=="cimode"&&(o.includes(c)||o.push(c))})};s?r(s):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(l=>r(l)),this.options.preload?.forEach?.(a=>r(a)),this.services.backendConnector.load(o,this.options.ns,a=>{!a&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),n(a)})}else n(null)}reloadResources(t,i,n){let s=ni();return typeof t=="function"&&(n=t,t=void 0),typeof i=="function"&&(n=i,i=void 0),t||(t=this.languages),i||(i=this.options.ns),n||(n=Ui),this.services.backendConnector.reload(t,i,o=>{s.resolve(),n(o)}),s}use(t){if(!t)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!t.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return t.type==="backend"&&(this.modules.backend=t),(t.type==="logger"||t.log&&t.warn&&t.error)&&(this.modules.logger=t),t.type==="languageDetector"&&(this.modules.languageDetector=t),t.type==="i18nFormat"&&(this.modules.i18nFormat=t),t.type==="postProcessor"&&Ta.addPostProcessor(t),t.type==="formatter"&&(this.modules.formatter=t),t.type==="3rdParty"&&this.modules.external.push(t),this}setResolvedLanguage(t){if(!(!t||!this.languages)&&!["cimode","dev"].includes(t)){for(let i=0;i<this.languages.length;i++){let n=this.languages[i];if(!["cimode","dev"].includes(n)&&this.store.hasLanguageSomeTranslations(n)){this.resolvedLanguage=n;break}}!this.resolvedLanguage&&!this.languages.includes(t)&&this.store.hasLanguageSomeTranslations(t)&&(this.resolvedLanguage=t,this.languages.unshift(t))}}changeLanguage(t,i){this.isLanguageChangingTo=t;let n=ni();this.emit("languageChanging",t);let s=a=>{this.language=a,this.languages=this.services.languageUtils.toResolveHierarchy(a),this.resolvedLanguage=void 0,this.setResolvedLanguage(a)},o=(a,l)=>{l?this.isLanguageChangingTo===t&&(s(l),this.translator.changeLanguage(l),this.isLanguageChangingTo=void 0,this.emit("languageChanged",l),this.logger.log("languageChanged",l)):this.isLanguageChangingTo=void 0,n.resolve((...c)=>this.t(...c)),i&&i(a,(...c)=>this.t(...c))},r=a=>{!t&&!a&&this.services.languageDetector&&(a=[]);let l=C(a)?a:a&&a[0],c=this.store.hasLanguageSomeTranslations(l)?l:this.services.languageUtils.getBestMatchFromCodes(C(a)?[a]:a);c&&(this.language||s(c),this.translator.language||this.translator.changeLanguage(c),this.services.languageDetector?.cacheUserLanguage?.(c)),this.loadResources(c,d=>{o(d,c)})};return!t&&this.services.languageDetector&&!this.services.languageDetector.async?r(this.services.languageDetector.detect()):!t&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(r):this.services.languageDetector.detect(r):r(t),n}getFixedT(t,i,n){let s=(o,r,...a)=>{let l;typeof r!="object"?l=this.options.overloadTranslationOptionHandler([o,r].concat(a)):l={...r},l.lng=l.lng||s.lng,l.lngs=l.lngs||s.lngs,l.ns=l.ns||s.ns,l.keyPrefix!==""&&(l.keyPrefix=l.keyPrefix||n||s.keyPrefix);let c={...this.options,...l};typeof l.keyPrefix=="function"&&(l.keyPrefix=Re(l.keyPrefix,c));let d=this.options.keySeparator||".",h;return l.keyPrefix&&Array.isArray(o)?h=o.map(u=>(typeof u=="function"&&(u=Re(u,c)),`${l.keyPrefix}${d}${u}`)):(typeof o=="function"&&(o=Re(o,c)),h=l.keyPrefix?`${l.keyPrefix}${d}${o}`:o),this.t(h,l)};return C(t)?s.lng=t:s.lngs=t,s.ns=i,s.keyPrefix=n,s}t(...t){return this.translator?.translate(...t)}exists(...t){return this.translator?.exists(...t)}setDefaultNamespace(t){this.options.defaultNS=t}hasLoadedNamespace(t,i={}){if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;let n=i.lng||this.resolvedLanguage||this.languages[0],s=this.options?this.options.fallbackLng:!1,o=this.languages[this.languages.length-1];if(n.toLowerCase()==="cimode")return!0;let r=(a,l)=>{let c=this.services.backendConnector.state[`${a}|${l}`];return c===-1||c===0||c===2};if(i.precheck){let a=i.precheck(this,r);if(a!==void 0)return a}return!!(this.hasResourceBundle(n,t)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||r(n,t)&&(!s||r(o,t)))}loadNamespaces(t,i){let n=ni();return this.options.ns?(C(t)&&(t=[t]),t.forEach(s=>{this.options.ns.includes(s)||this.options.ns.push(s)}),this.loadResources(s=>{n.resolve(),i&&i(s)}),n):(i&&i(),Promise.resolve())}loadLanguages(t,i){let n=ni();C(t)&&(t=[t]);let s=this.options.preload||[],o=t.filter(r=>!s.includes(r)&&this.services.languageUtils.isSupportedCode(r));return o.length?(this.options.preload=s.concat(o),this.loadResources(r=>{n.resolve(),i&&i(r)}),n):(i&&i(),Promise.resolve())}dir(t){if(t||(t=this.resolvedLanguage||(this.languages?.length>0?this.languages[0]:this.language)),!t)return"rtl";try{let s=new Intl.Locale(t);if(s&&s.getTextInfo){let o=s.getTextInfo();if(o&&o.direction)return o.direction}}catch{}let i=["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"],n=this.services?.languageUtils||new Ji(Ds());return t.toLowerCase().indexOf("-latn")>1?"ltr":i.includes(n.getLanguagePartFromCode(t))||t.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(t={},i){let n=new e(t,i);return n.createInstance=e.createInstance,n}cloneInstance(t={},i=Ui){let n=t.forkResourceStore;n&&delete t.forkResourceStore;let s={...this.options,...t,isClone:!0},o=new e(s);if((t.debug!==void 0||t.prefix!==void 0)&&(o.logger=o.logger.clone(t)),["store","services","language"].forEach(a=>{o[a]=this[a]}),o.services={...this.services},o.services.utils={hasLoadedNamespace:o.hasLoadedNamespace.bind(o)},n){let a=Object.keys(this.store.data).reduce((l,c)=>(l[c]={...this.store.data[c]},l[c]=Object.keys(l[c]).reduce((d,h)=>(d[h]={...l[c][h]},d),l[c]),l),{});o.store=new Yi(a,s),o.services.resourceStore=o.store}if(t.interpolation){let l={...Ds().interpolation,...this.options.interpolation,...t.interpolation},c={...s,interpolation:l};o.services.interpolator=new Gi(c)}return o.translator=new Xi(o.services,s),o.translator.on("*",(a,...l)=>{o.emit(a,...l)}),o.init(s,i),o.translator.options=s,o.translator.backendConnector.services.utils={hasLoadedNamespace:o.hasLoadedNamespace.bind(o)},o}toJSON(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}},k=Bs.createInstance(),bb=k.createInstance,yb=k.dir,xb=k.init,_b=k.loadResources,vb=k.reloadResources,wb=k.use,Sb=k.changeLanguage,Mb=k.getFixedT,kb=k.t,Pb=k.exists,Cb=k.setDefaultNamespace,Ab=k.hasLoadedNamespace,Ob=k.loadNamespaces,Lb=k.loadLanguages;var Ra={admin:{nav:{dashboard:"\u4EEA\u8868\u76D8",providers:"\u6A21\u578B\u4F9B\u5E94\u5546",adapters:"\u9002\u914D\u5668",logs:"\u65E5\u5FD7",capture:"\u534F\u8BAE\u6293\u5305",settings:"\u8BBE\u7F6E"},sidebar:{running:"\u8FD0\u884C\u4E2D",offline:"\u672A\u8FDE\u63A5",loading:"\u52A0\u8F7D\u4E2D",switchLang:"\u5207\u6362\u8BED\u8A00",port:"\u7AEF\u53E3",portPlaceholder:"\u7559\u7A7A\u4F7F\u7528\u9ED8\u8BA4 9000",portSetSuccess:"\u7AEF\u53E3\u5DF2\u4FDD\u5B58\uFF08\u91CD\u542F\u540E\u751F\u6548\uFF09",portSetSuccessWithRestart:"\u7AEF\u53E3\u5DF2\u4FDD\u5B58\uFF0C\u8BF7\u91CD\u542F\u670D\u52A1\u751F\u6548",portRestartHint:"\u91CD\u542F\u540E\u751F\u6548"},common:{save:"\u4FDD\u5B58",cancel:"\u53D6\u6D88",delete:"\u5220\u9664",edit:"\u7F16\u8F91",add:"\u6DFB\u52A0",test:"\u6D4B\u8BD5",run:"\u8FD0\u884C",close:"\u5173\u95ED",confirm:"\u786E\u5B9A",search:"\u641C\u7D22",refresh:"\u5237\u65B0",expand:"\u5C55\u5F00",collapse:"\u6536\u8D77",copy:"\u590D\u5236",clear:"\u6E05\u9664",saving:"\u4FDD\u5B58\u4E2D...",testing:"\u6D4B\u8BD5\u4E2D",none:"\u6682\u65E0\u6570\u636E",noMatch:"\u6CA1\u6709\u5339\u914D\u7684{{name}}",normal:"\u6B63\u5E38",error:"\u5F02\u5E38",remove:"\u79FB\u9664",hide:"\u9690\u85CF",view:"\u67E5\u770B",reloadConfig:"\u91CD\u8F7D\u914D\u7F6E",configReloaded:"\u914D\u7F6E\u5DF2\u91CD\u8F7D",reloadFailed:"\u91CD\u8F7D\u5931\u8D25"},dashboard:{status:"\u8FD0\u884C\u72B6\u6001",providerCount:"\u4F9B\u5E94\u5546\u6570",modelCount:"\u6A21\u578B\u603B\u6570",adapterCount:"\u9002\u914D\u5668\u6570",requests:"\u8BF7\u6C42\u6570",inputTokens:"\u8F93\u5165 Token",cacheHits:"\u7F13\u5B58\u547D\u4E2D",cacheCreation:"\u7F13\u5B58\u521B\u5EFA",today:"\u4ECA\u65E5",output:"\u8F93\u51FA",total:"\u603B\u8BA1",hitRate:"\u547D\u4E2D\u7387 {{rate}}",newCacheTokens:"\u65B0\u5199\u5165\u7F13\u5B58 token",proxyKey:"\u4EE3\u7406 API Key",proxyKeyPlaceholder:"\u4E0D\u8BBE\u7F6E\u5219\u65E0\u9700\u9274\u6743",proxyKeySet:"\u5DF2\u8BBE\u7F6E (\u8BF7\u6C42\u9700\u5E26 Authorization: Bearer <key> \u6216 x-api-key \u5934)",proxyKeyNotSet:"\u672A\u8BBE\u7F6E \u2014 \u6240\u6709\u8BF7\u6C42\u53EF\u76F4\u63A5\u8BBF\u95EE",proxyKeySetSuccess:"\u4EE3\u7406 Key \u5DF2\u8BBE\u7F6E",proxyKeyRemoveSuccess:"\u4EE3\u7406 Key \u5DF2\u79FB\u9664",loadMore:"\u52A0\u8F7D\u66F4\u591A",usage:{trendTitle:"Token \u7528\u91CF\u8D8B\u52BF",trendDesc:"\u8F93\u5165/\u8F93\u51FA/\u7F13\u5B58\u547D\u4E2D/\u7F13\u5B58\u521B\u5EFA \u6309\u65E5\u805A\u5408",breakdownTitle:"\u5206\u7EF4\u5EA6\u5BF9\u6BD4",dimProvider:"\u4F9B\u5E94\u5546",dimAdapter:"\u9002\u914D\u5668",dimModel:"\u6A21\u578B",days1:"\u4ECA\u65E5",days7:"7 \u5929",days30:"30 \u5929",days90:"90 \u5929",daysUnit:"\u5929",emptyTitle:"\u6682\u65E0\u7528\u91CF\u6570\u636E",emptyDesc:"\u5728 {{range}} \u8303\u56F4\u5185\u6CA1\u6709\u4EE3\u7406\u8BF7\u6C42\u8BB0\u5F55\u3002\u53D1\u8D77\u4E00\u6B21\u8BF7\u6C42\u5373\u53EF\u770B\u5230\u8D8B\u52BF\u3002",storageTitle:"\u7528\u91CF\u6570\u636E\u5B58\u50A8",storageDesc:"{{events}} \u6761\u4E8B\u4EF6 \xB7 {{aggregates}} \u6761\u9884\u805A\u5408 \xB7 {{size}}",cleanupBtn:"\u6E05\u7406 90 \u5929\u524D\u7684\u6570\u636E",cleanupConfirm:"\u786E\u5B9A\u8981\u6E05\u7406 {{days}} \u5929\u524D\u7684\u6240\u6709\u5386\u53F2\u7528\u91CF\u6570\u636E\u5417\uFF1F\u6B64\u64CD\u4F5C\u4E0D\u53EF\u6062\u590D\u3002",cleanupDone:"\u5DF2\u6E05\u7406 {{events}} \u6761\u4E8B\u4EF6 / {{aggregates}} \u6761\u9884\u805A\u5408",cleanupFailed:"\u6E05\u7406\u5931\u8D25"}},logs:{title:"\u65E5\u5FD7",matchCount:"\u5171 {{count}} \u6761\u5339\u914D \xB7 \u7B2C {{page}}/{{totalPages}} \u9875",filterAll:"\u5168\u90E8",filterRequest:"\u8BF7\u6C42",filterSystem:"\u7CFB\u7EDF",filterError:"error",filterWarn:"warn",filterInfo:"info",filterDebug:"debug",logLevel:"\u8BB0\u5F55\u7EA7\u522B",searchPlaceholder:"\u641C\u7D22\u2026",time:"\u65F6\u95F4",level:"\u7EA7\u522B",message:"\u6D88\u606F",detail:"\u8BE6\u60C5",empty:"\u6682\u65E0\u65E5\u5FD7",noMatch:"\u6CA1\u6709\u5339\u914D\u7684\u65E5\u5FD7",pagePrev:"\u25C0",pageNext:"\u25B6",pageFirst:"\u23EE",pageLast:"\u23ED"},providers:{title:"\u6A21\u578B\u4F9B\u5E94\u5546",searchPlaceholder:"\u641C\u7D22\u6A21\u578B\u4F9B\u5E94\u5546...",add:"+ \u6DFB\u52A0",name:"\u540D\u79F0",type:"\u7C7B\u578B",modelCount:"\u6A21\u578B\u6570",status:"\u72B6\u6001",actions:"\u64CD\u4F5C",empty:"\u6682\u65E0\u6570\u636E",noMatch:"\u6CA1\u6709\u5339\u914D\u7684\u4F9B\u5E94\u5546",editTitle:"\u7F16\u8F91\u6A21\u578B\u4F9B\u5E94\u5546",addTitle:"\u6DFB\u52A0\u6A21\u578B\u4F9B\u5E94\u5546",formName:"\u540D\u79F0",formNamePlaceholder:"my-provider",formType:"\u7C7B\u578B",formApiKey:"API Key",formApiKeyPlaceholder:"sk-...",formApiBase:"API Base\uFF08\u53EF\u9009\uFF09",formApiBasePlaceholder:"https://api.openai.com",formModels:"\u6A21\u578B\u5217\u8868",formModelId:"\u6A21\u578B ID",formModelIdPlaceholder:"\u5982 gpt-4o",addModel:"+ \u6DFB\u52A0\u6A21\u578B",thinkingBudget:"\u601D\u8003\u9884\u7B97",reasoningEffort:"\u63A8\u7406\u529B\u5EA6",defaultEffort:"\u9ED8\u8BA4",lowEffort:"\u4F4E",mediumEffort:"\u4E2D",highEffort:"\u9AD8",xhighEffort:"\u8D85\u9AD8",maxEffort:"\u6700\u5927",thinkingType:"\u6A21\u5F0F",defaultType:"\u65E0",hideKey:"\u9690\u85CF",showKey:"\u67E5\u770B",keepEmptyHint:"\u7559\u7A7A\u5219\u4FDD\u7559\u539F\u503C",pullModels:"\u62C9\u53D6\u8FDC\u7A0B\u6A21\u578B",pullModelsTitle:"\u8FDC\u7A0B\u6A21\u578B\u5217\u8868",pullModelsCount:"\u5171 {{count}} \u4E2A\u6A21\u578B\uFF0C{{existing}} \u4E2A\u5DF2\u5B58\u5728",pullModelsLoading:"\u52A0\u8F7D\u4E2D...",pullModelsNone:"\u672A\u627E\u5230\u53EF\u7528\u6A21\u578B",pullModelsError:"\u8BF7\u6C42\u5931\u8D25",pullModelsImport:"\u5BFC\u5165\u9009\u4E2D",importedModels:"\u5DF2\u5BFC\u5165 {{added}} \u4E2A\u6A21\u578B",importedModelsSkip:"\uFF08\u8DF3\u8FC7 {{skipped}} \u4E2A\u5DF2\u5B58\u5728\uFF09",deleteConfirm:'\u786E\u5B9A\u5220\u9664\u6A21\u578B\u4F9B\u5E94\u5546 "{{name}}" \u5417\uFF1F',saveFailed:"\u4FDD\u5B58\u5931\u8D25",deleteFailed:"\u5220\u9664\u5931\u8D25",notFound:"\u4F9B\u5E94\u5546\u672A\u627E\u5230",updated:"\u6A21\u578B\u4F9B\u5E94\u5546\u5DF2\u66F4\u65B0",created:"\u6A21\u578B\u4F9B\u5E94\u5546\u5DF2\u521B\u5EFA",deleted:"\u6A21\u578B\u4F9B\u5E94\u5546\u5DF2\u5220\u9664",validationName:"\u8BF7\u586B\u5199\u540D\u79F0",validationModels:"\u8BF7\u586B\u5199\u81F3\u5C11\u4E00\u4E2A\u6A21\u578B",validationApiKey:"\u8BF7\u586B\u5199 API Key",inputModalities:"\u8F93\u5165\u6A21\u6001",inputModalitiesHint:"\u52FE\u9009\u6A21\u578B\u652F\u6301\u7684\u8F93\u5165\u6A21\u6001\u3002\u672A\u52FE\u9009 image \u65F6\uFF0C\u8BF7\u6C42\u4E2D\u7684\u56FE\u7247\u4F1A\u8D70\u5916\u6302\u8BC6\u56FE\u3002",visionBadgeTitle:"\u652F\u6301\u56FE\u7247\u8F93\u5165\u7684\u6A21\u578B\uFF1A",validationProviderName:"\u8BF7\u5148\u586B\u5199\u4F9B\u5E94\u5546\u540D\u79F0",keepOriginal:"\u7559\u7A7A\u5219\u4FDD\u7559\u539F\u503C"},vision:{title:"\u5916\u6302\u8BC6\u56FE",desc:"\u4E3A\u4E0D\u652F\u6301\u56FE\u7247\u8F93\u5165\u7684\u6A21\u578B\u63D0\u4F9B\u81EA\u52A8\u8BC6\u56FE\u80FD\u529B\uFF1A\u8BF7\u6C42\u542B\u56FE\u7247\u65F6\uFF0C\u81EA\u52A8\u8C03\u7528\u4E0B\u65B9\u914D\u7F6E\u7684\u8BC6\u56FE\u6A21\u578B\u751F\u6210\u6587\u5B57\u63CF\u8FF0\uFF0C\u518D\u8F6C\u53D1\u7ED9\u539F\u6A21\u578B\u3002",enable:"\u542F\u7528\u5916\u6302\u8BC6\u56FE",selectProvider:"\u9009\u62E9 Provider",selectModel:"\u9009\u62E9\u6A21\u578B",promptPlaceholder:"\u53EF\u9009\uFF1A\u81EA\u5B9A\u4E49\u8BC6\u56FE\u63D0\u793A\u8BCD\uFF08\u7559\u7A7A\u4F7F\u7528\u9ED8\u8BA4\uFF09",noVisionModel:"\u6682\u65E0\u53EF\u7528\u8BC6\u56FE\u6A21\u578B\uFF1A\u8BF7\u5148\u5728 Providers \u4E2D\u4E3A\u6A21\u578B\u52FE\u9009\u201C\u56FE\u7247\u201D\u6A21\u6001",modelNotImageWarning:"\u8BE5\u6A21\u578B\u672A\u58F0\u660E\u652F\u6301\u56FE\u7247\u8F93\u5165\uFF0C\u4FDD\u5B58\u5C06\u88AB\u62D2\u7EDD\u3002\u8BF7\u5148\u5728 Providers \u4E2D\u4E3A\u8BE5\u6A21\u578B\u52FE\u9009\u201C\u56FE\u7247\u201D\u6A21\u6001\u3002",saved:"\u5916\u6302\u8BC6\u56FE\u5DF2\u542F\u7528",removed:"\u5916\u6302\u8BC6\u56FE\u5DF2\u7981\u7528",saveFailed:"\u4FDD\u5B58\u5931\u8D25",cache:{title:"\u8BC6\u56FE\u7ED3\u679C\u7F13\u5B58",desc:"\u6309\u56FE\u7247\u5185\u5BB9\u7F13\u5B58\u8BC6\u56FE\u63CF\u8FF0\uFF1A\u76F8\u540C\u56FE\u7247\u518D\u6B21\u8BF7\u6C42\u65F6\u76F4\u63A5\u590D\u7528\uFF0C\u907F\u514D\u91CD\u590D\u8C03\u7528\u8BC6\u56FE\u6A21\u578B\u3002",stats:"\u547D\u4E2D {{hits}} / \u672A\u547D\u4E2D {{misses}} \xB7 \u547D\u4E2D\u7387 {{rate}} \xB7 \u5DF2\u7F13\u5B58 {{size}}/{{max}}",disabled:"\u670D\u52A1\u672A\u542F\u7528\u7F13\u5B58",clear:"\u6E05\u7A7A\u7F13\u5B58",clearConfirm:"\u786E\u5B9A\u8981\u6E05\u7A7A\u6240\u6709\u8BC6\u56FE\u7F13\u5B58\u5417\uFF1F\u6E05\u7A7A\u540E\u76F8\u540C\u56FE\u7247\u4F1A\u91CD\u65B0\u8BC6\u56FE\u3002",cleared:"\u8BC6\u56FE\u7F13\u5B58\u5DF2\u6E05\u7A7A",clearFailed:"\u6E05\u7A7A\u5931\u8D25"}},adapters:{title:"\u5DE5\u5177\u9002\u914D\u5668\u6620\u5C04",searchPlaceholder:"\u641C\u7D22\u9002\u914D\u5668...",add:"+ \u6DFB\u52A0",adapter:"\u9002\u914D\u5668",type:"\u7C7B\u578B",baseUrl:"Base URL",modelMapping:"\u6A21\u578B\u6620\u5C04",status:"\u72B6\u6001",actions:"\u64CD\u4F5C",empty:"\u6682\u65E0\u9002\u914D\u5668",noMatch:"\u6CA1\u6709\u5339\u914D\u7684\u9002\u914D\u5668",editTitle:"\u7F16\u8F91\u9002\u914D\u5668",addTitle:"\u6DFB\u52A0\u9002\u914D\u5668",formName:"\u540D\u79F0",formNamePlaceholder:"my-tool",formType:"\u7C7B\u578B",formDefaultMaxTokens:"\u9ED8\u8BA4 Max Tokens",defaultMaxTokensHint:"\u7559\u7A7A\u4F7F\u7528\u4E0A\u6E38 API \u7684\u9ED8\u8BA4\u503C",formModelMapping:"\u6A21\u578B\u6620\u5C04",sourceModelId:"\u9002\u914D\u524D\u6A21\u578B ID",targetModelId:"\u9002\u914D\u540E\u6A21\u578B ID",sourcePlaceholder:"\u5DE5\u5177\u53D1\u51FA\u7684\u6A21\u578B\u540D",provider:"\u4F9B\u5E94\u5546",addMapping:"+ \u6DFB\u52A0\u6620\u5C04",bulkImport:"\u4E00\u952E\u5BFC\u5165\u5168\u90E8",selectProviderFirst:"-- \u9009\u62E9\u4F9B\u5E94\u5546 --",noModelsInProvider:'\u4F9B\u5E94\u5546 "{{provider}}" \u6CA1\u6709\u914D\u7F6E\u6A21\u578B',importedModels:"\u5DF2\u5BFC\u5165 {{added}} \u4E2A\u6A21\u578B",importedModelsSkip:"\uFF0C\u8DF3\u8FC7 {{skipped}} \u4E2A\u5DF2\u5B58\u5728",selectProvider:"-- \u9009\u62E9\u4F9B\u5E94\u5546 --",selectModel:"-- \u9009\u62E9\u6A21\u578B --",deleteConfirm:'\u786E\u5B9A\u5220\u9664\u9002\u914D\u5668 "{{name}}" \u5417\uFF1F',saveFailed:"\u4FDD\u5B58\u5931\u8D25",deleteFailed:"\u5220\u9664\u5931\u8D25",updated:"\u9002\u914D\u5668\u5DF2\u66F4\u65B0",created:"\u9002\u914D\u5668\u5DF2\u521B\u5EFA",deleted:"\u9002\u914D\u5668\u5DF2\u5220\u9664",testTitle:"\u6D4B\u8BD5\u9002\u914D\u5668 \u2014 {{name}}",runTest:"\u8FD0\u884C",clearResults:"\u6E05\u9664\u7ED3\u679C",noResults:'\u70B9\u51FB "\u8FD0\u884C" \u6D4B\u8BD5\u6240\u9009\u6620\u5C04\u6A21\u578B',reachable:"\u4E0D\u53EF\u8FBE"},capture:{title:"\u534F\u8BAE\u6570\u636E\u5305\u6355\u83B7",start:"\u25B6 \u5F00\u59CB\u6293\u5305",pause:"\u23F8 \u6682\u505C",stop:"\u25A0 \u7ED3\u675F",entryCount:"{{count}} \u6761",source:"\u6765\u6E90",sourceProxy:"\u4EE3\u7406",filterAll:"\u5168\u90E8",time:"\u65F6\u95F4",sourceCol:"\u6765\u6E90",adapter:"\u9002\u914D\u5668",inboundProtocol:"\u5165\u7AD9\u534F\u8BAE",inboundModel:"\u5165\u7AD9\u6A21\u578B",upstreamProvider:"\u4E0A\u6E38\u4F9B\u5E94\u5546",upstreamProtocol:"\u4E0A\u6E38\u534F\u8BAE",upstreamModel:"\u4E0A\u6E38\u6A21\u578B",requestSize:"\u8BF7\u6C42\u5927\u5C0F",responseSize:"\u54CD\u5E94\u5927\u5C0F",empty:"\u6682\u65E0\u6570\u636E\u5305 \u2014 \u53D1\u8D77\u4E00\u6B21\u4EE3\u7406\u8BF7\u6C42\u5373\u53EF\u6355\u83B7",copyRaw:"\u590D\u5236\u539F\u59CB\u5185\u5BB9"},test:{title:"\u6D4B\u8BD5 \u2014 {{name}}",run:"\u8FD0\u884C",testing:"\u6D4B\u8BD5\u4E2D",clearResults:"\u6E05\u9664\u7ED3\u679C",close:"\u5173\u95ED",noResults:'\u70B9\u51FB "\u8FD0\u884C" \u6D4B\u8BD5\u6240\u9009\u6A21\u578B',unreachable:"\u4E0D\u53EF\u8FBE",requestFailed:"\u8BF7\u6C42\u5931\u8D25"},confirm:{cancel:"\u53D6\u6D88",confirm:"\u786E\u5B9A"}},cli:{start:{configNotFound:"\u9519\u8BEF: \u914D\u7F6E\u6587\u4EF6\u4E0D\u5B58\u5728: {{path}}",alreadyRunning:"\u9519\u8BEF: \u4EE3\u7406\u5DF2\u5728\u8FD0\u884C (PID: {{pid}})",configLoaded:"\u914D\u7F6E\u52A0\u8F7D\u6210\u529F",configLoadFailed:"\u914D\u7F6E\u52A0\u8F7D\u5931\u8D25: {{error}}",started:"\u4EE3\u7406\u5DF2\u542F\u52A8: http://{{host}}:{{port}}",adminApi:" \u7BA1\u7406 API: http://{{host}}:{{port}}/admin/",aiApi:" AI API: http://{{host}}:{{port}}/v1/",pid:"PID: {{pid}}",configFile:"\u914D\u7F6E\u6587\u4EF6: {{configPath}}",sigterm:`
6
- \u6536\u5230 SIGTERM\uFF0C\u6B63\u5728\u5173\u95ED...`,language:"\u5F53\u524D\u8BED\u8A00: {{lang}}"},stop:{notRunning:"\u672A\u627E\u5230\u8FD0\u884C\u4E2D\u7684\u4EE3\u7406",stalePid:"\u53D1\u73B0\u6B8B\u7559 PID \u6587\u4EF6\uFF0C\u6E05\u7406\u4E2D...",stopping:"\u6B63\u5728\u505C\u6B62\u4EE3\u7406 (PID: {{pid}})..."},status:{notRunning:"\u4EE3\u7406\u672A\u8FD0\u884C",running:"\u4EE3\u7406\u6B63\u5728\u8FD0\u884C (PID: {{pid}})",port:"\u7AEF\u53E3: {{port}}"},restart:{stopping:"\u6B63\u5728\u505C\u6B62\u4EE3\u7406 (PID: {{pid}})...",restarting:"\u4EE3\u7406\u5DF2\u505C\u6B62\uFF0C\u6B63\u5728\u91CD\u542F...",stalePid:"\u53D1\u73B0\u6B8B\u7559 PID \u6587\u4EF6\uFF0C\u6E05\u7406\u4E2D..."},reload:{success:"\u914D\u7F6E\u91CD\u8F7D\u6210\u529F (\u7248\u672C: {{version}})",failed:"\u914D\u7F6E\u91CD\u8F7D\u5931\u8D25: {{error}}",errorItem:" - {{message}}",connectionFailed:"\u65E0\u6CD5\u8FDE\u63A5\u5230\u4EE3\u7406: {{error}}"}},backend:{config:{reloadSuccess:"\u914D\u7F6E\u91CD\u8F7D\u6210\u529F",reloadFailed:"\u914D\u7F6E\u91CD\u8F7D\u5931\u8D25",validationFailed:"\u914D\u7F6E\u6821\u9A8C\u5931\u8D25",validationErrors:`\u914D\u7F6E\u6821\u9A8C\u5931\u8D25:
7
- {{errors}}`,duplicateModelId:'\u6A21\u578B ID "{{modelId}}" \u5728\u6A21\u578B\u4F9B\u5E94\u5546 "{{provider}}" \u4E2D\u91CD\u590D',duplicateSourceModelId:'\u9002\u914D\u524D\u6A21\u578B ID "{{sourceModelId}}" \u5728\u9002\u914D\u5668 "{{adapter}}" \u4E2D\u91CD\u590D'},provider:{validationFailed:"\u6821\u9A8C\u5931\u8D25",referencedByAdapter:'\u6A21\u578B\u4F9B\u5E94\u5546 "{{name}}" \u88AB\u9002\u914D\u5668 "{{adapter}}" \u5F15\u7528\uFF0C\u65E0\u6CD5\u5220\u9664',deleteRequest:"\u6536\u5230\u5220\u9664 Provider \u8BF7\u6C42",deleted:"Provider \u5DF2\u5220\u9664",createRequest:"\u6536\u5230\u521B\u5EFA Provider \u8BF7\u6C42",created:"Provider \u5DF2\u521B\u5EFA",updateRequest:"\u6536\u5230\u66F4\u65B0 Provider \u8BF7\u6C42",updated:"Provider \u5DF2\u66F4\u65B0",notFound:"\u6A21\u578B\u672A\u627E\u5230: {{model}}"},adapter:{validationFailed:"\u6821\u9A8C\u5931\u8D25",serverError:"\u670D\u52A1\u5668\u72B6\u6001\u5F02\u5E38",deleteRequest:"\u6536\u5230\u5220\u9664\u9002\u914D\u5668\u8BF7\u6C42",deleted:"\u9002\u914D\u5668\u5DF2\u5220\u9664",createRequest:"\u6536\u5230\u521B\u5EFA\u9002\u914D\u5668\u8BF7\u6C42",created:"\u9002\u914D\u5668\u5DF2\u521B\u5EFA"},model:{testRequest:"\u6536\u5230\u6A21\u578B\u6D4B\u8BD5\u8BF7\u6C42",testResult:"\u6A21\u578B\u6D4B\u8BD5",testFailed:"\u6A21\u578B\u6D4B\u8BD5\u5931\u8D25",testReachable:"\u53EF\u8FBE",testUnreachable:"\u4E0D\u53EF\u8FBE",adapterTestRouteFailed:"\u9002\u914D\u5668\u6D4B\u8BD5\u8DEF\u7531\u89E3\u6790\u5931\u8D25",adapterTestResult:"\u9002\u914D\u5668\u6D4B\u8BD5",adapterTestFailed:"\u9002\u914D\u5668\u6D4B\u8BD5\u5931\u8D25",pullModelsFailed:"\u8FDC\u7A0B\u6A21\u578B\u62C9\u53D6\u5931\u8D25"},proxy:{requestError:"\u5904\u7406\u5F02\u5E38",modelNotFound:"\u6A21\u578B\u672A\u627E\u5230: {{model}}"},errors:{readBodyFailed:"\u8BFB\u53D6\u8BF7\u6C42\u4F53\u5931\u8D25",invalidJson:"\u8BF7\u6C42\u4F53\u4E0D\u662F\u6709\u6548\u7684 JSON"}}};var Ea={admin:{nav:{dashboard:"Dashboard",providers:"Providers",adapters:"Adapters",logs:"Logs",capture:"Capture",settings:"Settings"},sidebar:{running:"Running",offline:"Offline",loading:"Loading...",switchLang:"Switch Language",port:"Port",portPlaceholder:"Leave empty for default 9000",portSetSuccess:"Port saved (restart to take effect)",portSetSuccessWithRestart:"Port saved, please restart the service",portRestartHint:"restart to take effect"},common:{save:"Save",cancel:"Cancel",delete:"Delete",edit:"Edit",add:"Add",test:"Test",run:"Run",close:"Close",confirm:"Confirm",search:"Search",refresh:"Refresh",expand:"Expand",collapse:"Collapse",copy:"Copy",clear:"Clear",saving:"Saving...",testing:"Testing...",none:"No data",noMatch:"No matching {{name}}",normal:"Normal",error:"Error",remove:"Remove",hide:"Hide",view:"View",reloadConfig:"Reload Config",configReloaded:"Config reloaded",reloadFailed:"Reload failed"},dashboard:{status:"Status",providerCount:"Providers",modelCount:"Models",adapterCount:"Adapters",requests:"Requests",inputTokens:"Input Tokens",cacheHits:"Cache Hits",cacheCreation:"Cache Creation",today:"Today",output:"Output",total:"Total",hitRate:"Hit Rate {{rate}}",newCacheTokens:"New cache tokens written",proxyKey:"Proxy API Key",proxyKeyPlaceholder:"Leave empty to skip auth",proxyKeySet:"Set (requests must include Authorization: Bearer <key> or x-api-key header)",proxyKeyNotSet:"Not set \u2014 all requests are accessible directly",proxyKeySetSuccess:"Proxy key set",proxyKeyRemoveSuccess:"Proxy key removed",loadMore:"Load More",usage:{trendTitle:"Token Usage Trend",trendDesc:"Input / Output / Cache Read / Cache Create aggregated by day",breakdownTitle:"Breakdown Comparison",dimProvider:"Provider",dimAdapter:"Adapter",dimModel:"Model",days1:"Today",days7:"7 days",days30:"30 days",days90:"90 days",daysUnit:"days",emptyTitle:"No usage data",emptyDesc:"No proxy requests recorded in {{range}}. Send a request to see the trend here.",storageTitle:"Usage Data Storage",storageDesc:"{{events}} events \xB7 {{aggregates}} aggregates \xB7 {{size}}",cleanupBtn:"Clean up data older than 90 days",cleanupConfirm:"Are you sure you want to delete all usage data older than {{days}} days? This cannot be undone.",cleanupDone:"Cleaned {{events}} events / {{aggregates}} aggregates",cleanupFailed:"Cleanup failed"}},logs:{title:"Logs",matchCount:"{{count}} matches \xB7 Page {{page}}/{{totalPages}}",filterAll:"All",filterRequest:"Request",filterSystem:"System",filterError:"error",filterWarn:"warn",filterInfo:"info",filterDebug:"debug",logLevel:"Log Level",searchPlaceholder:"Search\u2026",time:"Time",level:"Level",message:"Message",detail:"Detail",empty:"No logs yet",noMatch:"No matching logs",pagePrev:"\u25C0",pageNext:"\u25B6",pageFirst:"\u23EE",pageLast:"\u23ED"},providers:{title:"Providers",searchPlaceholder:"Search providers...",add:"+ Add",name:"Name",type:"Type",modelCount:"Models",status:"Status",actions:"Actions",empty:"No data",noMatch:"No matching providers",editTitle:"Edit Provider",addTitle:"Add Provider",formName:"Name",formNamePlaceholder:"my-provider",formType:"Type",formApiKey:"API Key",formApiKeyPlaceholder:"sk-...",formApiBase:"API Base (optional)",formApiBasePlaceholder:"https://api.openai.com",formModels:"Models",formModelId:"Model ID",formModelIdPlaceholder:"e.g. gpt-4o",addModel:"+ Add Model",thinkingBudget:"Thinking Budget",reasoningEffort:"Reasoning Effort",defaultEffort:"Default",lowEffort:"Low",mediumEffort:"Medium",highEffort:"High",xhighEffort:"XHigh",maxEffort:"Max",thinkingType:"Type",defaultType:"None",hideKey:"Hide",showKey:"Show",keepEmptyHint:"Leave empty to keep current value",pullModels:"Pull Remote Models",pullModelsTitle:"Remote Models",pullModelsCount:"{{count}} models, {{existing}} already exist",pullModelsLoading:"Loading...",pullModelsNone:"No models found",pullModelsError:"Request failed",pullModelsImport:"Import Selected",importedModels:"Imported {{added}} models",importedModelsSkip:"(skipped {{skipped}} duplicates)",deleteConfirm:'Delete provider "{{name}}"?',saveFailed:"Save failed",deleteFailed:"Delete failed",notFound:"Provider not found",updated:"Provider updated",created:"Provider created",deleted:"Provider deleted",validationName:"Please enter a name",validationModels:"Please add at least one model",validationApiKey:"Please enter an API Key",inputModalities:"Input",inputModalitiesHint:"Check the input modalities supported by the model. When image is unchecked, images in requests will be routed through a vision fallback model.",visionBadgeTitle:"Models with image input:",validationProviderName:"Please enter a provider name first",keepOriginal:"Leave empty to keep original value"},vision:{title:"Vision Fallback",desc:"Provide automatic image recognition for models that don't support image input. When a request contains images, the configured vision model is called to generate a text description, which is then forwarded to the original model.",enable:"Enable Vision Fallback",selectProvider:"Select Provider",selectModel:"Select Model",promptPlaceholder:"Optional: custom vision prompt (leave empty for default)",noVisionModel:"No vision-capable model available. First mark a model as supporting image input in Providers.",modelNotImageWarning:"This model is not declared as supporting image input. Saving will be rejected. First mark the model as supporting image input in Providers.",saved:"Vision fallback enabled",removed:"Vision fallback disabled",saveFailed:"Save failed",cache:{title:"Vision Result Cache",desc:"Cache image descriptions by content. Repeat requests with the same image reuse the cached description without calling the vision model.",stats:"hits {{hits}} / miss {{misses}} \xB7 hit rate {{rate}} \xB7 cached {{size}}/{{max}}",disabled:"Cache not enabled on server",clear:"Clear Cache",clearConfirm:"Clear all vision cache? Cached images will be re-recognized on next request.",cleared:"Vision cache cleared",clearFailed:"Clear failed"}},adapters:{title:"Adapter Mappings",searchPlaceholder:"Search adapters...",add:"+ Add",adapter:"Adapter",type:"Type",baseUrl:"Base URL",modelMapping:"Model Mapping",status:"Status",actions:"Actions",empty:"No adapters",noMatch:"No matching adapters",editTitle:"Edit Adapter",addTitle:"Add Adapter",formName:"Name",formNamePlaceholder:"my-tool",formType:"Type",formDefaultMaxTokens:"Default Max Tokens",defaultMaxTokensHint:"Leave empty to use the upstream API's default",formModelMapping:"Model Mapping",sourceModelId:"Source Model ID",targetModelId:"Target Model ID",sourcePlaceholder:"Model ID from the tool",provider:"Provider",addMapping:"+ Add Mapping",bulkImport:"Import All",selectProviderFirst:"-- Select Provider --",noModelsInProvider:'Provider "{{provider}}" has no models configured',importedModels:"Imported {{added}} model(s)",importedModelsSkip:", skipped {{skipped}} existing",selectProvider:"-- Select Provider --",selectModel:"-- Select Model --",deleteConfirm:'Delete adapter "{{name}}"?',saveFailed:"Save failed",deleteFailed:"Delete failed",updated:"Adapter updated",created:"Adapter created",deleted:"Adapter deleted",testTitle:"Test Adapter \u2014 {{name}}",runTest:"Run",clearResults:"Clear Results",noResults:'Click "Run" to test the selected model mapping',reachable:"Unreachable"},capture:{title:"Protocol Capture",start:"\u25B6 Start Capture",pause:"\u23F8 Pause",stop:"\u25A0 Stop",entryCount:"{{count}} entries",source:"Source",sourceProxy:"Proxy",filterAll:"All",time:"Time",sourceCol:"Source",adapter:"Adapter",inboundProtocol:"Inbound Protocol",inboundModel:"Inbound Model",upstreamProvider:"Upstream Provider",upstreamProtocol:"Upstream Protocol",upstreamModel:"Upstream Model",requestSize:"Request Size",responseSize:"Response Size",empty:"No packets \u2014 send a proxy request to capture",copyRaw:"Copy Raw"},test:{title:"Test \u2014 {{name}}",run:"Run",testing:"Testing...",clearResults:"Clear Results",close:"Close",noResults:'Click "Run" to test the selected model',unreachable:"Unreachable",requestFailed:"Request failed"},confirm:{cancel:"Cancel",confirm:"Confirm"}},cli:{start:{configNotFound:"Error: config file not found: {{path}}",alreadyRunning:"Error: proxy is already running (PID: {{pid}})",configLoaded:"Configuration loaded successfully",configLoadFailed:"Configuration load failed: {{error}}",started:"Proxy started: http://{{host}}:{{port}}",adminApi:" Admin API: http://{{host}}:{{port}}/admin/",aiApi:" AI API: http://{{host}}:{{port}}/v1/",pid:"PID: {{pid}}",configFile:"Config: {{configPath}}",sigterm:`
8
- SIGTERM received, shutting down...`,language:"Language: {{lang}}"},stop:{notRunning:"No running proxy found",stalePid:"Found stale PID file, cleaning up...",stopping:"Stopping proxy (PID: {{pid}})..."},status:{notRunning:"Proxy is not running",running:"Proxy is running (PID: {{pid}})",port:"Port: {{port}}"},restart:{stopping:"Stopping proxy (PID: {{pid}})...",restarting:"Proxy stopped, restarting...",stalePid:"Found stale PID file, cleaning up..."},reload:{success:"Configuration reloaded (version: {{version}})",failed:"Configuration reload failed: {{error}}",errorItem:" - {{message}}",connectionFailed:"Could not connect to proxy: {{error}}"}},backend:{config:{reloadSuccess:"Configuration reloaded",reloadFailed:"Configuration reload failed",validationFailed:"Configuration validation failed",validationErrors:`Configuration validation failed:
9
- {{errors}}`,duplicateModelId:'Model ID "{{modelId}}" is duplicated in provider "{{provider}}"',duplicateSourceModelId:'Source model ID "{{sourceModelId}}" is duplicated in adapter "{{adapter}}"'},provider:{validationFailed:"Validation failed",referencedByAdapter:'Provider "{{name}}" is referenced by adapter "{{adapter}}" and cannot be deleted',deleteRequest:"Delete provider request received",deleted:"Provider deleted",createRequest:"Create provider request received",created:"Provider created",updateRequest:"Update provider request received",updated:"Provider updated",notFound:"Model not found: {{model}}"},adapter:{validationFailed:"Validation failed",serverError:"Server state error",deleteRequest:"Delete adapter request received",deleted:"Adapter deleted",createRequest:"Create adapter request received",created:"Adapter created"},model:{testRequest:"Model test request received",testResult:"Model test",testFailed:"Model test failed",testReachable:"Reachable",testUnreachable:"Unreachable",adapterTestRouteFailed:"Adapter test route resolution failed",adapterTestResult:"Adapter test",adapterTestFailed:"Adapter test failed",pullModelsFailed:"Failed to pull remote models"},proxy:{requestError:"Request error",modelNotFound:"Model not found: {{model}}"},errors:{readBodyFailed:"Failed to read request body",invalidJson:"Request body is not valid JSON"}}};var Zu=Ra,Qu=Ea;function tf(){let e=localStorage.getItem("llm-proxy-lang");return e==="zh"||e==="en"?e:(navigator.language||"").toLowerCase().startsWith("zh")?"zh":"en"}function Ia(){if(k.isInitialized)return;let e=tf();k.init({resources:{zh:{translation:Zu},en:{translation:Qu}},lng:e,fallbackLng:"en",interpolation:{escapeValue:!1}})}async function Fa(e){localStorage.setItem("llm-proxy-lang",e);try{await fetch("/admin/locale",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({locale:e})})}catch{}k.changeLanguage(e),window.location.reload()}function Na(){let e={config:null,health:null,status:"loading",tokenStats:null,language:k.language?.startsWith("zh")?"zh":"en",currentTab:"dashboard",tabNames:{dashboard:()=>k.t("admin.nav.dashboard"),providers:()=>k.t("admin.nav.providers"),adapters:()=>k.t("admin.nav.adapters"),logs:()=>k.t("admin.nav.logs"),capture:()=>k.t("admin.nav.capture"),settings:()=>k.t("admin.nav.settings")},tabIcons:{dashboard:'<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="3" width="7" height="7" rx="1"/><rect x="14" y="3" width="7" height="7" rx="1"/><rect x="3" y="14" width="7" height="7" rx="1"/><rect x="14" y="14" width="7" height="7" rx="1"/></svg>',logs:'<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M4 6h16M4 10h16M4 14h10M4 18h7"/></svg>',providers:'<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="3"/><path d="M12 3v2M12 19v2M3 12h2M19 12h2M5.64 5.64l1.42 1.42M16.95 16.95l1.41 1.41M5.64 18.36l1.42-1.42M16.95 7.05l1.41-1.41"/></svg>',adapters:'<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M4 9h16M4 15h16"/><circle cx="9" cy="9" r="2"/><circle cx="15" cy="15" r="2"/></svg>',capture:'<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="9"/><circle cx="12" cy="12" r="3"/></svg>',settings:'<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="3"/><path d="M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1z"/></svg>'},confirmResolve:null,showConfirm:!1,confirmMessage:"",async fetch(t,i={}){return(await fetch(t,{...i,headers:{"Content-Type":"application/json",...i.headers}})).json()},toast(t,i="info"){let n=document.createElement("div");n.className="toast toast-"+i,n.textContent=t,document.getElementById("toastContainer").appendChild(n),setTimeout(()=>{n.style.opacity="0",n.style.transition="opacity 0.3s",setTimeout(()=>n.remove(),300)},3e3)},confirm(t){return new Promise(i=>{this.confirmMessage=t,this.confirmResolve=i,this.showConfirm=!0})},switchTab(t){this.currentTab=t,location.hash="#"+t},switchLang(t){this.language=t,Fa(t)},getTabName(t){let i=this.tabNames[t];return typeof i=="function"?i():t},_dashboardInterval:null,startPolling(){this._dashboardInterval||(this._dashboardInterval=setInterval(()=>this.loadDashboard(),1e4))},stopPolling(){this._dashboardInterval&&(clearInterval(this._dashboardInterval),this._dashboardInterval=null)},async reloadConfig(){let t=await this.fetch("/admin/config/reload",{method:"POST"});t.success?(this.toast(k.t("admin.common.configReloaded"),"success"),this.loadDashboard()):t.errors?this.toast(t.errors.map(i=>i.message).join("; "),"error"):this.toast(t.error||k.t("admin.common.reloadFailed"),"error")},async loadDashboard(){let[t,i,n]=await Promise.all([this.fetch("/admin/health").catch(()=>null),this.fetch("/admin/config").catch(()=>null),this.fetch("/admin/token-stats").catch(()=>null)]);this.health=t,this.config=i?.data??null,this.tokenStats=n?.data??null,this.status=t?.success?"running":"offline"}};Z.store("app",e)}function li(e){return e+.5|0}var qt=(e,t,i)=>Math.max(Math.min(e,i),t);function ri(e){return qt(li(e*2.55),0,255)}function Yt(e){return qt(li(e*255),0,255)}function Rt(e){return qt(li(e/2.55)/100,0,1)}function za(e){return qt(li(e*100),0,100)}var ht={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},js=[..."0123456789ABCDEF"],ef=e=>js[e&15],nf=e=>js[(e&240)>>4]+js[e&15],Zi=e=>(e&240)>>4===(e&15),sf=e=>Zi(e.r)&&Zi(e.g)&&Zi(e.b)&&Zi(e.a);function of(e){var t=e.length,i;return e[0]==="#"&&(t===4||t===5?i={r:255&ht[e[1]]*17,g:255&ht[e[2]]*17,b:255&ht[e[3]]*17,a:t===5?ht[e[4]]*17:255}:(t===7||t===9)&&(i={r:ht[e[1]]<<4|ht[e[2]],g:ht[e[3]]<<4|ht[e[4]],b:ht[e[5]]<<4|ht[e[6]],a:t===9?ht[e[7]]<<4|ht[e[8]]:255})),i}var rf=(e,t)=>e<255?t(e):"";function af(e){var t=sf(e)?ef:nf;return e?"#"+t(e.r)+t(e.g)+t(e.b)+rf(e.a,t):void 0}var lf=/^(hsla?|hwb|hsv)\(\s*([-+.e\d]+)(?:deg)?[\s,]+([-+.e\d]+)%[\s,]+([-+.e\d]+)%(?:[\s,]+([-+.e\d]+)(%)?)?\s*\)$/;function Va(e,t,i){let n=t*Math.min(i,1-i),s=(o,r=(o+e/30)%12)=>i-n*Math.max(Math.min(r-3,9-r,1),-1);return[s(0),s(8),s(4)]}function cf(e,t,i){let n=(s,o=(s+e/60)%6)=>i-i*t*Math.max(Math.min(o,4-o,1),0);return[n(5),n(3),n(1)]}function df(e,t,i){let n=Va(e,1,.5),s;for(t+i>1&&(s=1/(t+i),t*=s,i*=s),s=0;s<3;s++)n[s]*=1-t-i,n[s]+=t;return n}function hf(e,t,i,n,s){return e===s?(t-i)/n+(t<i?6:0):t===s?(i-e)/n+2:(e-t)/n+4}function Vs(e){let i=e.r/255,n=e.g/255,s=e.b/255,o=Math.max(i,n,s),r=Math.min(i,n,s),a=(o+r)/2,l,c,d;return o!==r&&(d=o-r,c=a>.5?d/(2-o-r):d/(o+r),l=hf(i,n,s,d,o),l=l*60+.5),[l|0,c||0,a]}function Hs(e,t,i,n){return(Array.isArray(t)?e(t[0],t[1],t[2]):e(t,i,n)).map(Yt)}function Ws(e,t,i){return Hs(Va,e,t,i)}function uf(e,t,i){return Hs(df,e,t,i)}function ff(e,t,i){return Hs(cf,e,t,i)}function Ha(e){return(e%360+360)%360}function pf(e){let t=lf.exec(e),i=255,n;if(!t)return;t[5]!==n&&(i=t[6]?ri(+t[5]):Yt(+t[5]));let s=Ha(+t[2]),o=+t[3]/100,r=+t[4]/100;return t[1]==="hwb"?n=uf(s,o,r):t[1]==="hsv"?n=ff(s,o,r):n=Ws(s,o,r),{r:n[0],g:n[1],b:n[2],a:i}}function gf(e,t){var i=Vs(e);i[0]=Ha(i[0]+t),i=Ws(i),e.r=i[0],e.g=i[1],e.b=i[2]}function mf(e){if(!e)return;let t=Vs(e),i=t[0],n=za(t[1]),s=za(t[2]);return e.a<255?`hsla(${i}, ${n}%, ${s}%, ${Rt(e.a)})`:`hsl(${i}, ${n}%, ${s}%)`}var Ba={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"},$a={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 bf(){let e={},t=Object.keys($a),i=Object.keys(Ba),n,s,o,r,a;for(n=0;n<t.length;n++){for(r=a=t[n],s=0;s<i.length;s++)o=i[s],a=a.replace(o,Ba[o]);o=parseInt($a[r],16),e[a]=[o>>16&255,o>>8&255,o&255]}return e}var Qi;function yf(e){Qi||(Qi=bf(),Qi.transparent=[0,0,0,0]);let t=Qi[e.toLowerCase()];return t&&{r:t[0],g:t[1],b:t[2],a:t.length===4?t[3]:255}}var xf=/^rgba?\(\s*([-+.\d]+)(%)?[\s,]+([-+.e\d]+)(%)?[\s,]+([-+.e\d]+)(%)?(?:[\s,/]+([-+.e\d]+)(%)?)?\s*\)$/;function _f(e){let t=xf.exec(e),i=255,n,s,o;if(t){if(t[7]!==n){let r=+t[7];i=t[8]?ri(r):qt(r*255,0,255)}return n=+t[1],s=+t[3],o=+t[5],n=255&(t[2]?ri(n):qt(n,0,255)),s=255&(t[4]?ri(s):qt(s,0,255)),o=255&(t[6]?ri(o):qt(o,0,255)),{r:n,g:s,b:o,a:i}}}function vf(e){return e&&(e.a<255?`rgba(${e.r}, ${e.g}, ${e.b}, ${Rt(e.a)})`:`rgb(${e.r}, ${e.g}, ${e.b})`)}var $s=e=>e<=.0031308?e*12.92:Math.pow(e,1/2.4)*1.055-.055,Ie=e=>e<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4);function wf(e,t,i){let n=Ie(Rt(e.r)),s=Ie(Rt(e.g)),o=Ie(Rt(e.b));return{r:Yt($s(n+i*(Ie(Rt(t.r))-n))),g:Yt($s(s+i*(Ie(Rt(t.g))-s))),b:Yt($s(o+i*(Ie(Rt(t.b))-o))),a:e.a+i*(t.a-e.a)}}function tn(e,t,i){if(e){let n=Vs(e);n[t]=Math.max(0,Math.min(n[t]+n[t]*i,t===0?360:1)),n=Ws(n),e.r=n[0],e.g=n[1],e.b=n[2]}}function Wa(e,t){return e&&Object.assign(t||{},e)}function ja(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=Yt(e[3]))):(t=Wa(e,{r:0,g:0,b:0,a:1}),t.a=Yt(t.a)),t}function Sf(e){return e.charAt(0)==="r"?_f(e):pf(e)}var ai=class e{constructor(t){if(t instanceof e)return t;let i=typeof t,n;i==="object"?n=ja(t):i==="string"&&(n=of(t)||yf(t)||Sf(t)),this._rgb=n,this._valid=!!n}get valid(){return this._valid}get rgb(){var t=Wa(this._rgb);return t&&(t.a=Rt(t.a)),t}set rgb(t){this._rgb=ja(t)}rgbString(){return this._valid?vf(this._rgb):void 0}hexString(){return this._valid?af(this._rgb):void 0}hslString(){return this._valid?mf(this._rgb):void 0}mix(t,i){if(t){let n=this.rgb,s=t.rgb,o,r=i===o?.5:i,a=2*r-1,l=n.a-s.a,c=((a*l===-1?a:(a+l)/(1+a*l))+1)/2;o=1-c,n.r=255&c*n.r+o*s.r+.5,n.g=255&c*n.g+o*s.g+.5,n.b=255&c*n.b+o*s.b+.5,n.a=r*n.a+(1-r)*s.a,this.rgb=n}return this}interpolate(t,i){return t&&(this._rgb=wf(this._rgb,t._rgb,i)),this}clone(){return new e(this.rgb)}alpha(t){return this._rgb.a=Yt(t),this}clearer(t){let i=this._rgb;return i.a*=1-t,this}greyscale(){let t=this._rgb,i=li(t.r*.3+t.g*.59+t.b*.11);return t.r=t.g=t.b=i,this}opaquer(t){let i=this._rgb;return i.a*=1+t,this}negate(){let t=this._rgb;return t.r=255-t.r,t.g=255-t.g,t.b=255-t.b,this}lighten(t){return tn(this._rgb,2,t),this}darken(t){return tn(this._rgb,2,-t),this}saturate(t){return tn(this._rgb,1,t),this}desaturate(t){return tn(this._rgb,1,-t),this}rotate(t){return gf(this._rgb,t),this}};function Mt(){}var el=(()=>{let e=0;return()=>e++})();function D(e){return e==null}function B(e){if(Array.isArray&&Array.isArray(e))return!0;let t=Object.prototype.toString.call(e);return t.slice(0,7)==="[object"&&t.slice(-6)==="Array]"}function T(e){return e!==null&&Object.prototype.toString.call(e)==="[object Object]"}function V(e){return(typeof e=="number"||e instanceof Number)&&isFinite(+e)}function at(e,t){return V(e)?e:t}function O(e,t){return typeof e>"u"?t:e}var il=(e,t)=>typeof e=="string"&&e.endsWith("%")?parseFloat(e)/100*t:+e;function N(e,t,i){if(e&&typeof e.call=="function")return e.apply(i,t)}function E(e,t,i,n){let s,o,r;if(B(e))if(o=e.length,n)for(s=o-1;s>=0;s--)t.call(i,e[s],s);else for(s=0;s<o;s++)t.call(i,e[s],s);else if(T(e))for(r=Object.keys(e),o=r.length,s=0;s<o;s++)t.call(i,e[r[s]],r[s])}function hi(e,t){let i,n,s,o;if(!e||!t||e.length!==t.length)return!1;for(i=0,n=e.length;i<n;++i)if(s=e[i],o=t[i],s.datasetIndex!==o.datasetIndex||s.index!==o.index)return!1;return!0}function on(e){if(B(e))return e.map(on);if(T(e)){let t=Object.create(null),i=Object.keys(e),n=i.length,s=0;for(;s<n;++s)t[i[s]]=on(e[i[s]]);return t}return e}function nl(e){return["__proto__","prototype","constructor"].indexOf(e)===-1}function Mf(e,t,i,n){if(!nl(e))return;let s=t[e],o=i[e];T(s)&&T(o)?Ne(s,o,n):t[e]=on(o)}function Ne(e,t,i){let n=B(t)?t:[t],s=n.length;if(!T(e))return e;i=i||{};let o=i.merger||Mf,r;for(let a=0;a<s;++a){if(r=n[a],!T(r))continue;let l=Object.keys(r);for(let c=0,d=l.length;c<d;++c)o(l[c],e,r,i)}return e}function Be(e,t){return Ne(e,t,{merger:kf})}function kf(e,t,i){if(!nl(e))return;let n=t[e],s=i[e];T(n)&&T(s)?Be(n,s):Object.prototype.hasOwnProperty.call(t,e)||(t[e]=on(s))}var Ka={"":e=>e,x:e=>e.x,y:e=>e.y};function Pf(e){let t=e.split("."),i=[],n="";for(let s of t)n+=s,n.endsWith("\\")?n=n.slice(0,-1)+".":(i.push(n),n="");return i}function Cf(e){let t=Pf(e);return i=>{for(let n of t){if(n==="")break;i=i&&i[n]}return i}}function ye(e,t){return(Ka[t]||(Ka[t]=Cf(t)))(e)}function cn(e){return e.charAt(0).toUpperCase()+e.slice(1)}var $e=e=>typeof e<"u",Et=e=>typeof e=="function",Ys=(e,t)=>{if(e.size!==t.size)return!1;for(let i of e)if(!t.has(i))return!1;return!0};function sl(e){return e.type==="mouseup"||e.type==="click"||e.type==="contextmenu"}var Y=Math.PI,ot=2*Y,Af=ot+Y,rn=Number.POSITIVE_INFINITY,Of=Y/180,st=Y/2,ge=Y/4,Ua=Y*2/3,It=Math.log10,gt=Math.sign;function je(e,t,i){return Math.abs(e-t)<i}function Xs(e){let t=Math.round(e);e=je(e,t,e/1e3)?t:e;let i=Math.pow(10,Math.floor(It(e))),n=e/i;return(n<=1?1:n<=2?2:n<=5?5:10)*i}function ol(e){let t=[],i=Math.sqrt(e),n;for(n=1;n<i;n++)e%n===0&&(t.push(n),t.push(e/n));return i===(i|0)&&t.push(i),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 Ve(e){return!Lf(e)&&!isNaN(parseFloat(e))&&isFinite(e)}function rl(e,t){let i=Math.round(e);return i-t<=e&&i+t>=e}function Js(e,t,i){let n,s,o;for(n=0,s=e.length;n<s;n++)o=e[n][i],isNaN(o)||(t.min=Math.min(t.min,o),t.max=Math.max(t.max,o))}function Ft(e){return e*(Y/180)}function dn(e){return e*(180/Y)}function Gs(e){if(!V(e))return;let t=1,i=0;for(;Math.round(e*t)/t!==e;)t*=10,i++;return i}function al(e,t){let i=t.x-e.x,n=t.y-e.y,s=Math.sqrt(i*i+n*n),o=Math.atan2(n,i);return o<-.5*Y&&(o+=ot),{angle:o,distance:s}}function an(e,t){return Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))}function Tf(e,t){return(e-t+Af)%ot-Y}function nt(e){return(e%ot+ot)%ot}function Zs(e,t,i,n){let s=nt(e),o=nt(t),r=nt(i),a=nt(o-s),l=nt(r-s),c=nt(s-o),d=nt(s-r);return s===o||s===r||n&&o===r||a>l&&c<d}function rt(e,t,i){return Math.max(t,Math.min(i,e))}function ll(e){return rt(e,-32768,32767)}function Nt(e,t,i,n=1e-6){return e>=Math.min(t,i)-n&&e<=Math.max(t,i)+n}function hn(e,t,i){i=i||(r=>e[r]<t);let n=e.length-1,s=0,o;for(;n-s>1;)o=s+n>>1,i(o)?s=o:n=o;return{lo:s,hi:n}}var Jt=(e,t,i,n)=>hn(e,i,n?s=>{let o=e[s][t];return o<i||o===i&&e[s+1][t]===i}:s=>e[s][t]<i),cl=(e,t,i)=>hn(e,i,n=>e[n][t]>=i);function dl(e,t,i){let n=0,s=e.length;for(;n<s&&e[n]<t;)n++;for(;s>n&&e[s-1]>i;)s--;return n>0||s<e.length?e.slice(n,s):e}var hl=["push","pop","shift","splice","unshift"];function ul(e,t){if(e._chartjs){e._chartjs.listeners.push(t);return}Object.defineProperty(e,"_chartjs",{configurable:!0,enumerable:!1,value:{listeners:[t]}}),hl.forEach(i=>{let n="_onData"+cn(i),s=e[i];Object.defineProperty(e,i,{configurable:!0,enumerable:!1,value(...o){let r=s.apply(this,o);return e._chartjs.listeners.forEach(a=>{typeof a[n]=="function"&&a[n](...o)}),r}})})}function Qs(e,t){let i=e._chartjs;if(!i)return;let n=i.listeners,s=n.indexOf(t);s!==-1&&n.splice(s,1),!(n.length>0)&&(hl.forEach(o=>{delete e[o]}),delete e._chartjs)}function to(e){let t=new Set(e);return t.size===e.length?e:Array.from(t)}var eo=(function(){return typeof window>"u"?function(e){return e()}:window.requestAnimationFrame})();function io(e,t){let i=[],n=!1;return function(...s){i=s,n||(n=!0,eo.call(window,()=>{n=!1,e.apply(t,i)}))}}function fl(e,t){let i;return function(...n){return t?(clearTimeout(i),i=setTimeout(e,t,n)):e.apply(this,n),t}}var no=e=>e==="start"?"left":e==="end"?"right":"center",lt=(e,t,i)=>e==="start"?t:e==="end"?i:(t+i)/2,pl=(e,t,i,n)=>e===(n?"left":"right")?i:e==="center"?(t+i)/2:t;function gl(e,t,i){let n=t.length,s=0,o=n;if(e._sorted){let{iScale:r,vScale:a,_parsed:l}=e,c=e.dataset&&e.dataset.options?e.dataset.options.spanGaps:null,d=r.axis,{min:h,max:u,minDefined:f,maxDefined:g}=r.getUserBounds();if(f){if(s=Math.min(Jt(l,d,h).lo,i?n:Jt(t,d,r.getPixelForValue(h)).lo),c){let p=l.slice(0,s+1).reverse().findIndex(m=>!D(m[a.axis]));s-=Math.max(0,p)}s=rt(s,0,n-1)}if(g){let p=Math.max(Jt(l,r.axis,u,!0).hi+1,i?0:Jt(t,d,r.getPixelForValue(u),!0).hi+1);if(c){let m=l.slice(p-1).findIndex(b=>!D(b[a.axis]));p+=Math.max(0,m)}o=rt(p,s,n)-s}else o=n-s}return{start:s,count:o}}function ml(e){let{xScale:t,yScale:i,_scaleRanges:n}=e,s={xmin:t.min,xmax:t.max,ymin:i.min,ymax:i.max};if(!n)return e._scaleRanges=s,!0;let o=n.xmin!==t.min||n.xmax!==t.max||n.ymin!==i.min||n.ymax!==i.max;return Object.assign(n,s),o}var en=e=>e===0||e===1,qa=(e,t,i)=>-(Math.pow(2,10*(e-=1))*Math.sin((e-t)*ot/i)),Ya=(e,t,i)=>Math.pow(2,-10*e)*Math.sin((e-t)*ot/i)+1,Fe={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*st)+1,easeOutSine:e=>Math.sin(e*st),easeInOutSine:e=>-.5*(Math.cos(Y*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=>en(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=>en(e)?e:qa(e,.075,.3),easeOutElastic:e=>en(e)?e:Ya(e,.075,.3),easeInOutElastic(e){return en(e)?e:e<.5?.5*qa(e*2,.1125,.45):.5+.5*Ya(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-Fe.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?Fe.easeInBounce(e*2)*.5:Fe.easeOutBounce(e*2-1)*.5+.5};function so(e){if(e&&typeof e=="object"){let t=e.toString();return t==="[object CanvasPattern]"||t==="[object CanvasGradient]"}return!1}function oo(e){return so(e)?e:new ai(e)}function Ks(e){return so(e)?e:new ai(e).saturate(.5).darken(.1).hexString()}var Df=["x","y","borderWidth","radius","tension"],Rf=["color","borderColor","backgroundColor"];function Ef(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:Rf},numbers:{type:"number",properties:Df}}),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 If(e){e.set("layout",{autoPadding:!0,padding:{top:0,right:0,bottom:0,left:0}})}var Xa=new Map;function Ff(e,t){t=t||{};let i=e+JSON.stringify(t),n=Xa.get(i);return n||(n=new Intl.NumberFormat(e,t),Xa.set(i,n)),n}function un(e,t,i){return Ff(t,i).format(e)}var bl={values(e){return B(e)?e:""+e},numeric(e,t,i){if(e===0)return"0";let n=this.chart.options.locale,s,o=e;if(i.length>1){let c=Math.max(Math.abs(i[0].value),Math.abs(i[i.length-1].value));(c<1e-4||c>1e15)&&(s="scientific"),o=Nf(e,i)}let r=It(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),un(e,n,l)},logarithmic(e,t,i){if(e===0)return"0";let n=i[t].significand||e/Math.pow(10,Math.floor(It(e)));return[1,2,3,5,10,15].includes(n)||t>.8*i.length?bl.numeric.call(this,e,t,i):""}};function Nf(e,t){let i=t.length>3?t[2].value-t[1].value:t[1].value-t[0].value;return Math.abs(i)>=1&&e!==Math.floor(e)&&(i=e-Math.floor(e)),i}var ui={formatters:bl};function zf(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,i)=>i.lineWidth,tickColor:(t,i)=>i.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:ui.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"})}var Zt=Object.create(null),fn=Object.create(null);function ci(e,t){if(!t)return e;let i=t.split(".");for(let n=0,s=i.length;n<s;++n){let o=i[n];e=e[o]||(e[o]=Object.create(null))}return e}function Us(e,t,i){return typeof t=="string"?Ne(ci(e,t),i):Ne(ci(e,""),t)}var qs=class{constructor(t,i){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=n=>n.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=(n,s)=>Ks(s.backgroundColor),this.hoverBorderColor=(n,s)=>Ks(s.borderColor),this.hoverColor=(n,s)=>Ks(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(i)}set(t,i){return Us(this,t,i)}get(t){return ci(this,t)}describe(t,i){return Us(fn,t,i)}override(t,i){return Us(Zt,t,i)}route(t,i,n,s){let o=ci(this,t),r=ci(this,n),a="_"+i;Object.defineProperties(o,{[a]:{value:o[i],writable:!0},[i]:{enumerable:!0,get(){let l=this[a],c=r[s];return T(l)?Object.assign({},c,l):O(l,c)},set(l){this[a]=l}}})}apply(t){t.forEach(i=>i(this))}},H=new qs({_scriptable:e=>!e.startsWith("on"),_indexable:e=>e!=="events",hover:{_fallback:"interaction"},interaction:{_scriptable:!1,_indexable:!1}},[Ef,If,zf]);function Bf(e){return!e||D(e.size)||D(e.family)?null:(e.style?e.style+" ":"")+(e.weight?e.weight+" ":"")+e.size+"px "+e.family}function di(e,t,i,n,s){let o=t[s];return o||(o=t[s]=e.measureText(s).width,i.push(s)),o>n&&(n=o),n}function yl(e,t,i,n){n=n||{};let s=n.data=n.data||{},o=n.garbageCollect=n.garbageCollect||[];n.font!==t&&(s=n.data={},o=n.garbageCollect=[],n.font=t),e.save(),e.font=t;let r=0,a=i.length,l,c,d,h,u;for(l=0;l<a;l++)if(h=i[l],h!=null&&!B(h))r=di(e,s,o,r,h);else if(B(h))for(c=0,d=h.length;c<d;c++)u=h[c],u!=null&&!B(u)&&(r=di(e,s,o,r,u));e.restore();let f=o.length/2;if(f>i.length){for(l=0;l<f;l++)delete s[o[l]];o.splice(0,f)}return r}function Qt(e,t,i){let n=e.currentDevicePixelRatio,s=i!==0?Math.max(i/2,.5):0;return Math.round((t-s)*n)/n+s}function ro(e,t){!t&&!e||(t=t||e.getContext("2d"),t.save(),t.resetTransform(),t.clearRect(0,0,e.width,e.height),t.restore())}function pn(e,t,i,n){ao(e,t,i,n,null)}function ao(e,t,i,n,s){let o,r,a,l,c,d,h,u,f=t.pointStyle,g=t.rotation,p=t.radius,m=(g||0)*Of;if(f&&typeof f=="object"&&(o=f.toString(),o==="[object HTMLImageElement]"||o==="[object HTMLCanvasElement]")){e.save(),e.translate(i,n),e.rotate(m),e.drawImage(f,-f.width/2,-f.height/2,f.width,f.height),e.restore();return}if(!(isNaN(p)||p<=0)){switch(e.beginPath(),f){default:s?e.ellipse(i,n,s/2,p,0,0,ot):e.arc(i,n,p,0,ot),e.closePath();break;case"triangle":d=s?s/2:p,e.moveTo(i+Math.sin(m)*d,n-Math.cos(m)*p),m+=Ua,e.lineTo(i+Math.sin(m)*d,n-Math.cos(m)*p),m+=Ua,e.lineTo(i+Math.sin(m)*d,n-Math.cos(m)*p),e.closePath();break;case"rectRounded":c=p*.516,l=p-c,r=Math.cos(m+ge)*l,h=Math.cos(m+ge)*(s?s/2-c:l),a=Math.sin(m+ge)*l,u=Math.sin(m+ge)*(s?s/2-c:l),e.arc(i-h,n-a,c,m-Y,m-st),e.arc(i+u,n-r,c,m-st,m),e.arc(i+h,n+a,c,m,m+st),e.arc(i-u,n+r,c,m+st,m+Y),e.closePath();break;case"rect":if(!g){l=Math.SQRT1_2*p,d=s?s/2:l,e.rect(i-d,n-l,2*d,2*l);break}m+=ge;case"rectRot":h=Math.cos(m)*(s?s/2:p),r=Math.cos(m)*p,a=Math.sin(m)*p,u=Math.sin(m)*(s?s/2:p),e.moveTo(i-h,n-a),e.lineTo(i+u,n-r),e.lineTo(i+h,n+a),e.lineTo(i-u,n+r),e.closePath();break;case"crossRot":m+=ge;case"cross":h=Math.cos(m)*(s?s/2:p),r=Math.cos(m)*p,a=Math.sin(m)*p,u=Math.sin(m)*(s?s/2:p),e.moveTo(i-h,n-a),e.lineTo(i+h,n+a),e.moveTo(i+u,n-r),e.lineTo(i-u,n+r);break;case"star":h=Math.cos(m)*(s?s/2:p),r=Math.cos(m)*p,a=Math.sin(m)*p,u=Math.sin(m)*(s?s/2:p),e.moveTo(i-h,n-a),e.lineTo(i+h,n+a),e.moveTo(i+u,n-r),e.lineTo(i-u,n+r),m+=ge,h=Math.cos(m)*(s?s/2:p),r=Math.cos(m)*p,a=Math.sin(m)*p,u=Math.sin(m)*(s?s/2:p),e.moveTo(i-h,n-a),e.lineTo(i+h,n+a),e.moveTo(i+u,n-r),e.lineTo(i-u,n+r);break;case"line":r=s?s/2:Math.cos(m)*p,a=Math.sin(m)*p,e.moveTo(i-r,n-a),e.lineTo(i+r,n+a);break;case"dash":e.moveTo(i,n),e.lineTo(i+Math.cos(m)*(s?s/2:p),n+Math.sin(m)*p);break;case!1:e.closePath();break}e.fill(),t.borderWidth>0&&e.stroke()}}function St(e,t,i){return i=i||.5,!t||e&&e.x>t.left-i&&e.x<t.right+i&&e.y>t.top-i&&e.y<t.bottom+i}function fi(e,t){e.save(),e.beginPath(),e.rect(t.left,t.top,t.right-t.left,t.bottom-t.top),e.clip()}function pi(e){e.restore()}function xl(e,t,i,n,s){if(!t)return e.lineTo(i.x,i.y);if(s==="middle"){let o=(t.x+i.x)/2;e.lineTo(o,t.y),e.lineTo(o,i.y)}else s==="after"!=!!n?e.lineTo(t.x,i.y):e.lineTo(i.x,t.y);e.lineTo(i.x,i.y)}function _l(e,t,i,n){if(!t)return e.lineTo(i.x,i.y);e.bezierCurveTo(n?t.cp1x:t.cp2x,n?t.cp1y:t.cp2y,n?i.cp2x:i.cp1x,n?i.cp2y:i.cp1y,i.x,i.y)}function $f(e,t){t.translation&&e.translate(t.translation[0],t.translation[1]),D(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 jf(e,t,i,n,s){if(s.strikethrough||s.underline){let o=e.measureText(n),r=t-o.actualBoundingBoxLeft,a=t+o.actualBoundingBoxRight,l=i-o.actualBoundingBoxAscent,c=i+o.actualBoundingBoxDescent,d=s.strikethrough?(l+c)/2:c;e.strokeStyle=e.fillStyle,e.beginPath(),e.lineWidth=s.decorationWidth||2,e.moveTo(r,d),e.lineTo(a,d),e.stroke()}}function Vf(e,t){let i=e.fillStyle;e.fillStyle=t.color,e.fillRect(t.left,t.top,t.width,t.height),e.fillStyle=i}function xe(e,t,i,n,s,o={}){let r=B(t)?t:[t],a=o.strokeWidth>0&&o.strokeColor!=="",l,c;for(e.save(),e.font=s.string,$f(e,o),l=0;l<r.length;++l)c=r[l],o.backdrop&&Vf(e,o.backdrop),a&&(o.strokeColor&&(e.strokeStyle=o.strokeColor),D(o.strokeWidth)||(e.lineWidth=o.strokeWidth),e.strokeText(c,i,n,o.maxWidth)),e.fillText(c,i,n,o.maxWidth),jf(e,i,n,c,o),n+=Number(s.lineHeight);e.restore()}function He(e,t){let{x:i,y:n,w:s,h:o,radius:r}=t;e.arc(i+r.topLeft,n+r.topLeft,r.topLeft,1.5*Y,Y,!0),e.lineTo(i,n+o-r.bottomLeft),e.arc(i+r.bottomLeft,n+o-r.bottomLeft,r.bottomLeft,Y,st,!0),e.lineTo(i+s-r.bottomRight,n+o),e.arc(i+s-r.bottomRight,n+o-r.bottomRight,r.bottomRight,st,0,!0),e.lineTo(i+s,n+r.topRight),e.arc(i+s-r.topRight,n+r.topRight,r.topRight,0,-st,!0),e.lineTo(i+r.topLeft,n)}var Hf=/^(normal|(\d+(?:\.\d+)?)(px|em|%)?)$/,Wf=/^(normal|italic|initial|inherit|unset|(oblique( -?[0-9]?[0-9]deg)?))$/;function Kf(e,t){let i=(""+e).match(Hf);if(!i||i[1]==="normal")return t*1.2;switch(e=+i[2],i[3]){case"px":return e;case"%":e/=100;break}return t*e}var Uf=e=>+e||0;function lo(e,t){let i={},n=T(t),s=n?Object.keys(t):t,o=T(e)?n?r=>O(e[r],e[t[r]]):r=>e[r]:()=>e;for(let r of s)i[r]=Uf(o(r));return i}function co(e){return lo(e,{top:"y",right:"x",bottom:"y",left:"x"})}function te(e){return lo(e,["topLeft","topRight","bottomLeft","bottomRight"])}function tt(e){let t=co(e);return t.width=t.left+t.right,t.height=t.top+t.bottom,t}function G(e,t){e=e||{},t=t||H.font;let i=O(e.size,t.size);typeof i=="string"&&(i=parseInt(i,10));let n=O(e.style,t.style);n&&!(""+n).match(Wf)&&(console.warn('Invalid font style specified: "'+n+'"'),n=void 0);let s={family:O(e.family,t.family),lineHeight:Kf(O(e.lineHeight,t.lineHeight),i),size:i,style:n,weight:O(e.weight,t.weight),string:""};return s.string=Bf(s),s}function gi(e,t,i,n){let s=!0,o,r,a;for(o=0,r=e.length;o<r;++o)if(a=e[o],a!==void 0&&(t!==void 0&&typeof a=="function"&&(a=a(t),s=!1),i!==void 0&&B(a)&&(a=a[i%a.length],s=!1),a!==void 0))return n&&!s&&(n.cacheable=!1),a}function vl(e,t,i){let{min:n,max:s}=e,o=il(t,(s-n)/2),r=(a,l)=>i&&a===0?0:a+l;return{min:r(n,-Math.abs(o)),max:r(s,o)}}function zt(e,t){return Object.assign(Object.create(e),t)}function gn(e,t=[""],i,n,s=()=>e[0]){let o=i||e;typeof n>"u"&&(n=Ml("_fallback",e));let r={[Symbol.toStringTag]:"Object",_cacheable:!0,_scopes:e,_rootScopes:o,_fallback:n,_getTarget:s,override:a=>gn([a,...e],t,o,n)};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,()=>tp(l,t,e,a))},getOwnPropertyDescriptor(a,l){return Reflect.getOwnPropertyDescriptor(a._scopes[0],l)},getPrototypeOf(){return Reflect.getPrototypeOf(e[0])},has(a,l){return Ga(a).includes(l)},ownKeys(a){return Ga(a)},set(a,l,c){let d=a._storage||(a._storage=s());return a[l]=d[l]=c,delete a._keys,!0}})}function be(e,t,i,n){let s={_cacheable:!1,_proxy:e,_context:t,_subProxy:i,_stack:new Set,_descriptors:ho(e,n),setContext:o=>be(e,o,i,n),override:o=>be(e.override(o),t,i,n)};return new Proxy(s,{deleteProperty(o,r){return delete o[r],delete e[r],!0},get(o,r,a){return wl(o,r,()=>Yf(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 ho(e,t={scriptable:!0,indexable:!0}){let{_scriptable:i=t.scriptable,_indexable:n=t.indexable,_allKeys:s=t.allKeys}=e;return{allKeys:s,scriptable:i,indexable:n,isScriptable:Et(i)?i:()=>i,isIndexable:Et(n)?n:()=>n}}var qf=(e,t)=>e?e+cn(t):t,uo=(e,t)=>T(t)&&e!=="adapters"&&(Object.getPrototypeOf(t)===null||t.constructor===Object);function wl(e,t,i){if(Object.prototype.hasOwnProperty.call(e,t)||t==="constructor")return e[t];let n=i();return e[t]=n,n}function Yf(e,t,i){let{_proxy:n,_context:s,_subProxy:o,_descriptors:r}=e,a=n[t];return Et(a)&&r.isScriptable(t)&&(a=Xf(t,a,e,i)),B(a)&&a.length&&(a=Jf(t,a,e,r.isIndexable)),uo(t,a)&&(a=be(a,s,o&&o[t],r)),a}function Xf(e,t,i,n){let{_proxy:s,_context:o,_subProxy:r,_stack:a}=i;if(a.has(e))throw new Error("Recursion detected: "+Array.from(a).join("->")+"->"+e);a.add(e);let l=t(o,r||n);return a.delete(e),uo(e,l)&&(l=fo(s._scopes,s,e,l)),l}function Jf(e,t,i,n){let{_proxy:s,_context:o,_subProxy:r,_descriptors:a}=i;if(typeof o.index<"u"&&n(e))return t[o.index%t.length];if(T(t[0])){let l=t,c=s._scopes.filter(d=>d!==l);t=[];for(let d of l){let h=fo(c,s,e,d);t.push(be(h,o,r&&r[e],a))}}return t}function Sl(e,t,i){return Et(e)?e(t,i):e}var Gf=(e,t)=>e===!0?t:typeof e=="string"?ye(t,e):void 0;function Zf(e,t,i,n,s){for(let o of t){let r=Gf(i,o);if(r){e.add(r);let a=Sl(r._fallback,i,s);if(typeof a<"u"&&a!==i&&a!==n)return a}else if(r===!1&&typeof n<"u"&&i!==n)return null}return!1}function fo(e,t,i,n){let s=t._rootScopes,o=Sl(t._fallback,i,n),r=[...e,...s],a=new Set;a.add(n);let l=Ja(a,r,i,o||i,n);return l===null||typeof o<"u"&&o!==i&&(l=Ja(a,r,o,l,n),l===null)?!1:gn(Array.from(a),[""],s,o,()=>Qf(t,i,n))}function Ja(e,t,i,n,s){for(;i;)i=Zf(e,t,i,n,s);return i}function Qf(e,t,i){let n=e._getTarget();t in n||(n[t]={});let s=n[t];return B(s)&&T(i)?i:s||{}}function tp(e,t,i,n){let s;for(let o of t)if(s=Ml(qf(o,e),i),typeof s<"u")return uo(e,s)?fo(i,n,e,s):s}function Ml(e,t){for(let i of t){if(!i)continue;let n=i[e];if(typeof n<"u")return n}}function Ga(e){let t=e._keys;return t||(t=e._keys=ep(e._scopes)),t}function ep(e){let t=new Set;for(let i of e)for(let n of Object.keys(i).filter(s=>!s.startsWith("_")))t.add(n);return Array.from(t)}var ip=Number.EPSILON||1e-14,ze=(e,t)=>t<e.length&&!e[t].skip&&e[t],kl=e=>e==="x"?"y":"x";function np(e,t,i,n){let s=e.skip?t:e,o=t,r=i.skip?t:i,a=an(o,s),l=an(r,o),c=a/(a+l),d=l/(a+l);c=isNaN(c)?0:c,d=isNaN(d)?0:d;let h=n*c,u=n*d;return{previous:{x:o.x-h*(r.x-s.x),y:o.y-h*(r.y-s.y)},next:{x:o.x+u*(r.x-s.x),y:o.y+u*(r.y-s.y)}}}function sp(e,t,i){let n=e.length,s,o,r,a,l,c=ze(e,0);for(let d=0;d<n-1;++d)if(l=c,c=ze(e,d+1),!(!l||!c)){if(je(t[d],0,ip)){i[d]=i[d+1]=0;continue}s=i[d]/t[d],o=i[d+1]/t[d],a=Math.pow(s,2)+Math.pow(o,2),!(a<=9)&&(r=3/Math.sqrt(a),i[d]=s*r*t[d],i[d+1]=o*r*t[d])}}function op(e,t,i="x"){let n=kl(i),s=e.length,o,r,a,l=ze(e,0);for(let c=0;c<s;++c){if(r=a,a=l,l=ze(e,c+1),!a)continue;let d=a[i],h=a[n];r&&(o=(d-r[i])/3,a[`cp1${i}`]=d-o,a[`cp1${n}`]=h-o*t[c]),l&&(o=(l[i]-d)/3,a[`cp2${i}`]=d+o,a[`cp2${n}`]=h+o*t[c])}}function rp(e,t="x"){let i=kl(t),n=e.length,s=Array(n).fill(0),o=Array(n),r,a,l,c=ze(e,0);for(r=0;r<n;++r)if(a=l,l=c,c=ze(e,r+1),!!l){if(c){let d=c[t]-l[t];s[r]=d!==0?(c[i]-l[i])/d:0}o[r]=a?c?gt(s[r-1])!==gt(s[r])?0:(s[r-1]+s[r])/2:s[r-1]:s[r]}sp(e,s,o),op(e,o,t)}function nn(e,t,i){return Math.max(Math.min(e,i),t)}function ap(e,t){let i,n,s,o,r,a=St(e[0],t);for(i=0,n=e.length;i<n;++i)r=o,o=a,a=i<n-1&&St(e[i+1],t),o&&(s=e[i],r&&(s.cp1x=nn(s.cp1x,t.left,t.right),s.cp1y=nn(s.cp1y,t.top,t.bottom)),a&&(s.cp2x=nn(s.cp2x,t.left,t.right),s.cp2y=nn(s.cp2y,t.top,t.bottom)))}function Pl(e,t,i,n,s){let o,r,a,l;if(t.spanGaps&&(e=e.filter(c=>!c.skip)),t.cubicInterpolationMode==="monotone")rp(e,s);else{let c=n?e[e.length-1]:e[0];for(o=0,r=e.length;o<r;++o)a=e[o],l=np(c,a,e[Math.min(o+1,r-(n?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&&ap(e,i)}function mn(){return typeof window<"u"&&typeof document<"u"}function bn(e){let t=e.parentNode;return t&&t.toString()==="[object ShadowRoot]"&&(t=t.host),t}function ln(e,t,i){let n;return typeof e=="string"?(n=parseInt(e,10),e.indexOf("%")!==-1&&(n=n/100*t.parentNode[i])):n=e,n}var yn=e=>e.ownerDocument.defaultView.getComputedStyle(e,null);function lp(e,t){return yn(e).getPropertyValue(t)}var cp=["top","right","bottom","left"];function me(e,t,i){let n={};i=i?"-"+i:"";for(let s=0;s<4;s++){let o=cp[s];n[o]=parseFloat(e[t+"-"+o+i])||0}return n.width=n.left+n.right,n.height=n.top+n.bottom,n}var dp=(e,t,i)=>(e>0||t>0)&&(!i||!i.shadowRoot);function hp(e,t){let i=e.touches,n=i&&i.length?i[0]:e,{offsetX:s,offsetY:o}=n,r=!1,a,l;if(dp(s,o,e.target))a=s,l=o;else{let c=t.getBoundingClientRect();a=n.clientX-c.left,l=n.clientY-c.top,r=!0}return{x:a,y:l,box:r}}function ee(e,t){if("native"in e)return e;let{canvas:i,currentDevicePixelRatio:n}=t,s=yn(i),o=s.boxSizing==="border-box",r=me(s,"padding"),a=me(s,"border","width"),{x:l,y:c,box:d}=hp(e,i),h=r.left+(d&&a.left),u=r.top+(d&&a.top),{width:f,height:g}=t;return o&&(f-=r.width+a.width,g-=r.height+a.height),{x:Math.round((l-h)/f*i.width/n),y:Math.round((c-u)/g*i.height/n)}}function up(e,t,i){let n,s;if(t===void 0||i===void 0){let o=e&&bn(e);if(!o)t=e.clientWidth,i=e.clientHeight;else{let r=o.getBoundingClientRect(),a=yn(o),l=me(a,"border","width"),c=me(a,"padding");t=r.width-c.width-l.width,i=r.height-c.height-l.height,n=ln(a.maxWidth,o,"clientWidth"),s=ln(a.maxHeight,o,"clientHeight")}}return{width:t,height:i,maxWidth:n||rn,maxHeight:s||rn}}var Gt=e=>Math.round(e*10)/10;function Cl(e,t,i,n){let s=yn(e),o=me(s,"margin"),r=ln(s.maxWidth,e,"clientWidth")||rn,a=ln(s.maxHeight,e,"clientHeight")||rn,l=up(e,t,i),{width:c,height:d}=l;if(s.boxSizing==="content-box"){let u=me(s,"border","width"),f=me(s,"padding");c-=f.width+u.width,d-=f.height+u.height}return c=Math.max(0,c-o.width),d=Math.max(0,n?c/n:d-o.height),c=Gt(Math.min(c,r,l.maxWidth)),d=Gt(Math.min(d,a,l.maxHeight)),c&&!d&&(d=Gt(c/2)),(t!==void 0||i!==void 0)&&n&&l.height&&d>l.height&&(d=l.height,c=Gt(Math.floor(d*n))),{width:c,height:d}}function po(e,t,i){let n=t||1,s=Gt(e.height*n),o=Gt(e.width*n);e.height=Gt(e.height),e.width=Gt(e.width);let r=e.canvas;return r.style&&(i||!r.style.height&&!r.style.width)&&(r.style.height=`${e.height}px`,r.style.width=`${e.width}px`),e.currentDevicePixelRatio!==n||r.height!==s||r.width!==o?(e.currentDevicePixelRatio=n,r.height=s,r.width=o,e.ctx.setTransform(n,0,0,n,0,0),!0):!1}var Al=(function(){let e=!1;try{let t={get passive(){return e=!0,!1}};mn()&&(window.addEventListener("test",null,t),window.removeEventListener("test",null,t))}catch{}return e})();function go(e,t){let i=lp(e,t),n=i&&i.match(/^(\d+)(\.\d+)?px$/);return n?+n[1]:void 0}function Xt(e,t,i,n){return{x:e.x+i*(t.x-e.x),y:e.y+i*(t.y-e.y)}}function Ol(e,t,i,n){return{x:e.x+i*(t.x-e.x),y:n==="middle"?i<.5?e.y:t.y:n==="after"?i<1?e.y:t.y:i>0?t.y:e.y}}function Ll(e,t,i,n){let s={x:e.cp2x,y:e.cp2y},o={x:t.cp1x,y:t.cp1y},r=Xt(e,s,i),a=Xt(s,o,i),l=Xt(o,t,i),c=Xt(r,a,i),d=Xt(a,l,i);return Xt(c,d,i)}var fp=function(e,t){return{x(i){return e+e+t-i},setWidth(i){t=i},textAlign(i){return i==="center"?i:i==="right"?"left":"right"},xPlus(i,n){return i-n},leftForLtr(i,n){return i-n}}},pp=function(){return{x(e){return e},setWidth(e){},textAlign(e){return e},xPlus(e,t){return e+t},leftForLtr(e,t){return e}}};function _e(e,t,i){return e?fp(t,i):pp()}function mo(e,t){let i,n;(t==="ltr"||t==="rtl")&&(i=e.canvas.style,n=[i.getPropertyValue("direction"),i.getPropertyPriority("direction")],i.setProperty("direction",t,"important"),e.prevTextDirection=n)}function bo(e,t){t!==void 0&&(delete e.prevTextDirection,e.canvas.style.setProperty("direction",t[0],t[1]))}function Tl(e){return e==="angle"?{between:Zs,compare:Tf,normalize:nt}:{between:Nt,compare:(t,i)=>t-i,normalize:t=>t}}function Za({start:e,end:t,count:i,loop:n,style:s}){return{start:e%i,end:t%i,loop:n&&(t-e+1)%i===0,style:s}}function gp(e,t,i){let{property:n,start:s,end:o}=i,{between:r,normalize:a}=Tl(n),l=t.length,{start:c,end:d,loop:h}=e,u,f;if(h){for(c+=l,d+=l,u=0,f=l;u<f&&r(a(t[c%l][n]),s,o);++u)c--,d--;c%=l,d%=l}return d<c&&(d+=l),{start:c,end:d,loop:h,style:e.style}}function yo(e,t,i){if(!i)return[e];let{property:n,start:s,end:o}=i,r=t.length,{compare:a,between:l,normalize:c}=Tl(n),{start:d,end:h,loop:u,style:f}=gp(e,t,i),g=[],p=!1,m=null,b,y,v,_=()=>l(s,v,b)&&a(s,v)!==0,x=()=>a(o,b)===0||l(o,v,b),M=()=>p||_(),w=()=>!p||x();for(let S=d,P=d;S<=h;++S)y=t[S%r],!y.skip&&(b=c(y[n]),b!==v&&(p=l(b,s,o),m===null&&M()&&(m=a(b,s)===0?S:P),m!==null&&w()&&(g.push(Za({start:m,end:S,loop:u,count:r,style:f})),m=null),P=S,v=b));return m!==null&&g.push(Za({start:m,end:h,loop:u,count:r,style:f})),g}function xo(e,t){let i=[],n=e.segments;for(let s=0;s<n.length;s++){let o=yo(n[s],e.points,t);o.length&&i.push(...o)}return i}function mp(e,t,i,n){let s=0,o=t-1;if(i&&!n)for(;s<t&&!e[s].skip;)s++;for(;s<t&&e[s].skip;)s++;for(s%=t,i&&(o+=s);o>s&&e[o%t].skip;)o--;return o%=t,{start:s,end:o}}function bp(e,t,i,n){let s=e.length,o=[],r=t,a=e[t],l;for(l=t+1;l<=i;++l){let c=e[l%s];c.skip||c.stop?a.skip||(n=!1,o.push({start:t%s,end:(l-1)%s,loop:n}),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:n}),o}function Dl(e,t){let i=e.points,n=e.options.spanGaps,s=i.length;if(!s)return[];let o=!!e._loop,{start:r,end:a}=mp(i,s,o,n);if(n===!0)return Qa(e,[{start:r,end:a,loop:o}],i,t);let l=a<r?a+s:a,c=!!e._fullLoop&&r===0&&a===s-1;return Qa(e,bp(i,r,l,c),i,t)}function Qa(e,t,i,n){return!n||!n.setContext||!i?t:yp(e,t,i,n)}function yp(e,t,i,n){let s=e._chart.getContext(),o=tl(e.options),{_datasetIndex:r,options:{spanGaps:a}}=e,l=i.length,c=[],d=o,h=t[0].start,u=h;function f(g,p,m,b){let y=a?-1:1;if(g!==p){for(g+=l;i[g%l].skip;)g-=y;for(;i[p%l].skip;)p+=y;g%l!==p%l&&(c.push({start:g%l,end:p%l,loop:m,style:b}),d=b,h=p%l)}}for(let g of t){h=a?h:g.start;let p=i[h%l],m;for(u=h+1;u<=g.end;u++){let b=i[u%l];m=tl(n.setContext(zt(s,{type:"segment",p0:p,p1:b,p0DataIndex:(u-1)%l,p1DataIndex:u%l,datasetIndex:r}))),xp(m,d)&&f(h,u-1,g.loop,d),p=b,d=m}h<u-1&&f(h,u-1,g.loop,d)}return c}function tl(e){return{backgroundColor:e.backgroundColor,borderCapStyle:e.borderCapStyle,borderDash:e.borderDash,borderDashOffset:e.borderDashOffset,borderJoinStyle:e.borderJoinStyle,borderWidth:e.borderWidth,borderColor:e.borderColor}}function xp(e,t){if(!t)return!1;let i=[],n=function(s,o){return so(o)?(i.includes(o)||i.push(o),i.indexOf(o)):o};return JSON.stringify(e,n)!==JSON.stringify(t,n)}function sn(e,t,i){return e.options.clip?e[i]:t[i]}function _p(e,t){let{xScale:i,yScale:n}=e;return i&&n?{left:sn(i,t,"left"),right:sn(i,t,"right"),top:sn(n,t,"top"),bottom:sn(n,t,"bottom")}:t}function _o(e,t){let i=t._clip;if(i.disabled)return!1;let n=_p(t,e.chartArea);return{left:i.left===!1?0:n.left-(i.left===!0?0:i.left),right:i.right===!1?e.width:n.right+(i.right===!0?0:i.right),top:i.top===!1?0:n.top-(i.top===!0?0:i.top),bottom:i.bottom===!1?e.height:n.bottom+(i.bottom===!0?0:i.bottom)}}var Do=class{constructor(){this._request=null,this._charts=new Map,this._running=!1,this._lastDate=void 0}_notify(t,i,n,s){let o=i.listeners[s],r=i.duration;o.forEach(a=>a({chart:t,initial:i.initial,numSteps:r,currentStep:Math.min(n-i.start,r)}))}_refresh(){this._request||(this._running=!0,this._request=eo.call(window,()=>{this._update(),this._request=null,this._running&&this._refresh()}))}_update(t=Date.now()){let i=0;this._charts.forEach((n,s)=>{if(!n.running||!n.items.length)return;let o=n.items,r=o.length-1,a=!1,l;for(;r>=0;--r)l=o[r],l._active?(l._total>n.duration&&(n.duration=l._total),l.tick(t),a=!0):(o[r]=o[o.length-1],o.pop());a&&(s.draw(),this._notify(s,n,t,"progress")),o.length||(n.running=!1,this._notify(s,n,t,"complete"),n.initial=!1),i+=o.length}),this._lastDate=t,i===0&&(this._running=!1)}_getAnims(t){let i=this._charts,n=i.get(t);return n||(n={running:!1,initial:!0,items:[],listeners:{complete:[],progress:[]}},i.set(t,n)),n}listen(t,i,n){this._getAnims(t).listeners[i].push(n)}add(t,i){!i||!i.length||this._getAnims(t).items.push(...i)}has(t){return this._getAnims(t).items.length>0}start(t){let i=this._charts.get(t);i&&(i.running=!0,i.start=Date.now(),i.duration=i.items.reduce((n,s)=>Math.max(n,s._duration),0),this._refresh())}running(t){if(!this._running)return!1;let i=this._charts.get(t);return!(!i||!i.running||!i.items.length)}stop(t){let i=this._charts.get(t);if(!i||!i.items.length)return;let n=i.items,s=n.length-1;for(;s>=0;--s)n[s].cancel();i.items=[],this._notify(t,i,Date.now(),"complete")}remove(t){return this._charts.delete(t)}},Bt=new Do,Rl="transparent",vp={boolean(e,t,i){return i>.5?t:e},color(e,t,i){let n=oo(e||Rl),s=n.valid&&oo(t||Rl);return s&&s.valid?s.mix(n,i).hexString():t},number(e,t,i){return e+(t-e)*i}},Ro=class{constructor(t,i,n,s){let o=i[n];s=gi([t.to,s,o,t.from]);let r=gi([t.from,o,s]);this._active=!0,this._fn=t.fn||vp[t.type||typeof r],this._easing=Fe[t.easing]||Fe.linear,this._start=Math.floor(Date.now()+(t.delay||0)),this._duration=this._total=Math.floor(t.duration),this._loop=!!t.loop,this._target=i,this._prop=n,this._from=r,this._to=s,this._promises=void 0}active(){return this._active}update(t,i,n){if(this._active){this._notify(!1);let s=this._target[this._prop],o=n-this._start,r=this._duration-o;this._start=n,this._duration=Math.floor(Math.max(r,t.duration)),this._total+=o,this._loop=!!t.loop,this._to=gi([t.to,i,s,t.from]),this._from=gi([t.from,s,i])}}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(t){let i=t-this._start,n=this._duration,s=this._prop,o=this._from,r=this._loop,a=this._to,l;if(this._active=o!==a&&(r||i<n),!this._active){this._target[s]=a,this._notify(!0);return}if(i<0){this._target[s]=o;return}l=i/n%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(){let t=this._promises||(this._promises=[]);return new Promise((i,n)=>{t.push({res:i,rej:n})})}_notify(t){let i=t?"res":"rej",n=this._promises||[];for(let s=0;s<n.length;s++)n[s][i]()}},Pn=class{constructor(t,i){this._chart=t,this._properties=new Map,this.configure(i)}configure(t){if(!T(t))return;let i=Object.keys(H.animation),n=this._properties;Object.getOwnPropertyNames(t).forEach(s=>{let o=t[s];if(!T(o))return;let r={};for(let a of i)r[a]=o[a];(B(o.properties)&&o.properties||[s]).forEach(a=>{(a===s||!n.has(a))&&n.set(a,r)})})}_animateOptions(t,i){let n=i.options,s=Sp(t,n);if(!s)return[];let o=this._createAnimations(s,n);return n.$shared&&wp(t.options.$animations,n).then(()=>{t.options=n},()=>{}),o}_createAnimations(t,i){let n=this._properties,s=[],o=t.$animations||(t.$animations={}),r=Object.keys(i),a=Date.now(),l;for(l=r.length-1;l>=0;--l){let c=r[l];if(c.charAt(0)==="$")continue;if(c==="options"){s.push(...this._animateOptions(t,i));continue}let d=i[c],h=o[c],u=n.get(c);if(h)if(u&&h.active()){h.update(u,d,a);continue}else h.cancel();if(!u||!u.duration){t[c]=d;continue}o[c]=h=new Ro(u,t,c,d),s.push(h)}return s}update(t,i){if(this._properties.size===0){Object.assign(t,i);return}let n=this._createAnimations(t,i);if(n.length)return Bt.add(this._chart,n),!0}};function wp(e,t){let i=[],n=Object.keys(t);for(let s=0;s<n.length;s++){let o=e[n[s]];o&&o.active()&&i.push(o.wait())}return Promise.all(i)}function Sp(e,t){if(!t)return;let i=e.options;if(!i){e.options=t;return}return i.$shared&&(e.options=i=Object.assign({},i,{$shared:!1,$animations:{}})),i}function El(e,t){let i=e&&e.options||{},n=i.reverse,s=i.min===void 0?t:0,o=i.max===void 0?t:0;return{start:n?o:s,end:n?s:o}}function Mp(e,t,i){if(i===!1)return!1;let n=El(e,i),s=El(t,i);return{top:s.end,right:n.end,bottom:s.start,left:n.start}}function kp(e){let t,i,n,s;return T(e)?(t=e.top,i=e.right,n=e.bottom,s=e.left):t=i=n=s=e,{top:t,right:i,bottom:n,left:s,disabled:e===!1}}function Dc(e,t){let i=[],n=e._getSortedDatasetMetas(t),s,o;for(s=0,o=n.length;s<o;++s)i.push(n[s].index);return i}function Il(e,t,i,n={}){let s=e.keys,o=n.mode==="single",r,a,l,c;if(t===null)return;let d=!1;for(r=0,a=s.length;r<a;++r){if(l=+s[r],l===i){if(d=!0,n.all)continue;break}c=e.values[l],V(c)&&(o||t===0||gt(t)===gt(c))&&(t+=c)}return!d&&!n.all?0:t}function Pp(e,t){let{iScale:i,vScale:n}=t,s=i.axis==="x"?"x":"y",o=n.axis==="x"?"x":"y",r=Object.keys(e),a=new Array(r.length),l,c,d;for(l=0,c=r.length;l<c;++l)d=r[l],a[l]={[s]:d,[o]:e[d]};return a}function vo(e,t){let i=e&&e.options.stacked;return i||i===void 0&&t.stack!==void 0}function Cp(e,t,i){return`${e.id}.${t.id}.${i.stack||i.type}`}function Ap(e){let{min:t,max:i,minDefined:n,maxDefined:s}=e.getUserBounds();return{min:n?t:Number.NEGATIVE_INFINITY,max:s?i:Number.POSITIVE_INFINITY}}function Op(e,t,i){let n=e[t]||(e[t]={});return n[i]||(n[i]={})}function Fl(e,t,i,n){for(let s of t.getMatchingVisibleMetas(n).reverse()){let o=e[s.index];if(i&&o>0||!i&&o<0)return s.index}return null}function Nl(e,t){let{chart:i,_cachedMeta:n}=e,s=i._stacks||(i._stacks={}),{iScale:o,vScale:r,index:a}=n,l=o.axis,c=r.axis,d=Cp(o,r,n),h=t.length,u;for(let f=0;f<h;++f){let g=t[f],{[l]:p,[c]:m}=g,b=g._stacks||(g._stacks={});u=b[c]=Op(s,d,p),u[a]=m,u._top=Fl(u,r,!0,n.type),u._bottom=Fl(u,r,!1,n.type);let y=u._visualValues||(u._visualValues={});y[a]=m}}function wo(e,t){let i=e.scales;return Object.keys(i).filter(n=>i[n].axis===t).shift()}function Lp(e,t){return zt(e,{active:!1,dataset:void 0,datasetIndex:t,index:t,mode:"default",type:"dataset"})}function Tp(e,t,i){return zt(e,{active:!1,dataIndex:t,parsed:void 0,raw:void 0,element:i,index:t,mode:"default",type:"data"})}function mi(e,t){let i=e.controller.index,n=e.vScale&&e.vScale.axis;if(n){t=t||e._parsed;for(let s of t){let o=s._stacks;if(!o||o[n]===void 0||o[n][i]===void 0)return;delete o[n][i],o[n]._visualValues!==void 0&&o[n]._visualValues[i]!==void 0&&delete o[n]._visualValues[i]}}}var So=e=>e==="reset"||e==="none",zl=(e,t)=>t?e:Object.assign({},e),Dp=(e,t,i)=>e&&!t.hidden&&t._stacked&&{keys:Dc(i,!0),values:null},Si=class{static defaults={};static datasetElementType=null;static dataElementType=null;constructor(t,i){this.chart=t,this._ctx=t.ctx,this.index=i,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(){let t=this._cachedMeta;this.configure(),this.linkScales(),t._stacked=vo(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&&mi(this._cachedMeta),this.index=t}linkScales(){let t=this.chart,i=this._cachedMeta,n=this.getDataset(),s=(h,u,f,g)=>h==="x"?u:h==="r"?g:f,o=i.xAxisID=O(n.xAxisID,wo(t,"x")),r=i.yAxisID=O(n.yAxisID,wo(t,"y")),a=i.rAxisID=O(n.rAxisID,wo(t,"r")),l=i.indexAxis,c=i.iAxisID=s(l,o,r,a),d=i.vAxisID=s(l,r,o,a);i.xScale=this.getScaleForId(o),i.yScale=this.getScaleForId(r),i.rScale=this.getScaleForId(a),i.iScale=this.getScaleForId(c),i.vScale=this.getScaleForId(d)}getDataset(){return this.chart.data.datasets[this.index]}getMeta(){return this.chart.getDatasetMeta(this.index)}getScaleForId(t){return this.chart.scales[t]}_getOtherScale(t){let i=this._cachedMeta;return t===i.iScale?i.vScale:i.iScale}reset(){this._update("reset")}_destroy(){let t=this._cachedMeta;this._data&&Qs(this._data,this),t._stacked&&mi(t)}_dataCheck(){let t=this.getDataset(),i=t.data||(t.data=[]),n=this._data;if(T(i)){let s=this._cachedMeta;this._data=Pp(i,s)}else if(n!==i){if(n){Qs(n,this);let s=this._cachedMeta;mi(s),s._parsed=[]}i&&Object.isExtensible(i)&&ul(i,this),this._syncList=[],this._data=i}}addElements(){let t=this._cachedMeta;this._dataCheck(),this.datasetElementType&&(t.dataset=new this.datasetElementType)}buildOrUpdateElements(t){let i=this._cachedMeta,n=this.getDataset(),s=!1;this._dataCheck();let o=i._stacked;i._stacked=vo(i.vScale,i),i.stack!==n.stack&&(s=!0,mi(i),i.stack=n.stack),this._resyncElements(t),(s||o!==i._stacked)&&(Nl(this,i._parsed),i._stacked=vo(i.vScale,i))}configure(){let t=this.chart.config,i=t.datasetScopeKeys(this._type),n=t.getOptionScopes(this.getDataset(),i,!0);this.options=t.createResolver(n,this.getContext()),this._parsing=this.options.parsing,this._cachedDataOpts={}}parse(t,i){let{_cachedMeta:n,_data:s}=this,{iScale:o,_stacked:r}=n,a=o.axis,l=t===0&&i===s.length?!0:n._sorted,c=t>0&&n._parsed[t-1],d,h,u;if(this._parsing===!1)n._parsed=s,n._sorted=!0,u=s;else{B(s[t])?u=this.parseArrayData(n,s,t,i):T(s[t])?u=this.parseObjectData(n,s,t,i):u=this.parsePrimitiveData(n,s,t,i);let f=()=>h[a]===null||c&&h[a]<c[a];for(d=0;d<i;++d)n._parsed[d+t]=h=u[d],l&&(f()&&(l=!1),c=h);n._sorted=l}r&&Nl(this,u)}parsePrimitiveData(t,i,n,s){let{iScale:o,vScale:r}=t,a=o.axis,l=r.axis,c=o.getLabels(),d=o===r,h=new Array(s),u,f,g;for(u=0,f=s;u<f;++u)g=u+n,h[u]={[a]:d||o.parse(c[g],g),[l]:r.parse(i[g],g)};return h}parseArrayData(t,i,n,s){let{xScale:o,yScale:r}=t,a=new Array(s),l,c,d,h;for(l=0,c=s;l<c;++l)d=l+n,h=i[d],a[l]={x:o.parse(h[0],d),y:r.parse(h[1],d)};return a}parseObjectData(t,i,n,s){let{xScale:o,yScale:r}=t,{xAxisKey:a="x",yAxisKey:l="y"}=this._parsing,c=new Array(s),d,h,u,f;for(d=0,h=s;d<h;++d)u=d+n,f=i[u],c[d]={x:o.parse(ye(f,a),u),y:r.parse(ye(f,l),u)};return c}getParsed(t){return this._cachedMeta._parsed[t]}getDataElement(t){return this._cachedMeta.data[t]}applyStack(t,i,n){let s=this.chart,o=this._cachedMeta,r=i[t.axis],a={keys:Dc(s,!0),values:i._stacks[t.axis]._visualValues};return Il(a,r,o.index,{mode:n})}updateRangeFromParsed(t,i,n,s){let o=n[i.axis],r=o===null?NaN:o,a=s&&n._stacks[i.axis];s&&a&&(s.values=a,r=Il(s,o,this._cachedMeta.index)),t.min=Math.min(t.min,r),t.max=Math.max(t.max,r)}getMinMax(t,i){let n=this._cachedMeta,s=n._parsed,o=n._sorted&&t===n.iScale,r=s.length,a=this._getOtherScale(t),l=Dp(i,n,this.chart),c={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY},{min:d,max:h}=Ap(a),u,f;function g(){f=s[u];let p=f[a.axis];return!V(f[t.axis])||d>p||h<p}for(u=0;u<r&&!(!g()&&(this.updateRangeFromParsed(c,t,f,l),o));++u);if(o){for(u=r-1;u>=0;--u)if(!g()){this.updateRangeFromParsed(c,t,f,l);break}}return c}getAllParsedValues(t){let i=this._cachedMeta._parsed,n=[],s,o,r;for(s=0,o=i.length;s<o;++s)r=i[s][t.axis],V(r)&&n.push(r);return n}getMaxOverflow(){return!1}getLabelAndValue(t){let i=this._cachedMeta,n=i.iScale,s=i.vScale,o=this.getParsed(t);return{label:n?""+n.getLabelForValue(o[n.axis]):"",value:s?""+s.getLabelForValue(o[s.axis]):""}}_update(t){let i=this._cachedMeta;this.update(t||"default"),i._clip=kp(O(this.options.clip,Mp(i.xScale,i.yScale,this.getMaxOverflow())))}update(t){}draw(){let t=this._ctx,i=this.chart,n=this._cachedMeta,s=n.data||[],o=i.chartArea,r=[],a=this._drawStart||0,l=this._drawCount||s.length-a,c=this.options.drawActiveElementsOnTop,d;for(n.dataset&&n.dataset.draw(t,o,a,l),d=a;d<a+l;++d){let h=s[d];h.hidden||(h.active&&c?r.push(h):h.draw(t,o))}for(d=0;d<r.length;++d)r[d].draw(t,o)}getStyle(t,i){let n=i?"active":"default";return t===void 0&&this._cachedMeta.dataset?this.resolveDatasetElementOptions(n):this.resolveDataElementOptions(t||0,n)}getContext(t,i,n){let s=this.getDataset(),o;if(t>=0&&t<this._cachedMeta.data.length){let r=this._cachedMeta.data[t];o=r.$context||(r.$context=Tp(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=Lp(this.chart.getContext(),this.index)),o.dataset=s,o.index=o.datasetIndex=this.index;return o.active=!!i,o.mode=n,o}resolveDatasetElementOptions(t){return this._resolveElementOptions(this.datasetElementType.id,t)}resolveDataElementOptions(t,i){return this._resolveElementOptions(this.dataElementType.id,i,t)}_resolveElementOptions(t,i="default",n){let s=i==="active",o=this._cachedDataOpts,r=t+"-"+i,a=o[r],l=this.enableOptionSharing&&$e(n);if(a)return zl(a,l);let c=this.chart.config,d=c.datasetElementScopeKeys(this._type,t),h=s?[`${t}Hover`,"hover",t,""]:[t,""],u=c.getOptionScopes(this.getDataset(),d),f=Object.keys(H.elements[t]),g=()=>this.getContext(n,s,i),p=c.resolveNamedOptions(u,f,g,h);return p.$shared&&(p.$shared=l,o[r]=Object.freeze(zl(p,l))),p}_resolveAnimations(t,i,n){let s=this.chart,o=this._cachedDataOpts,r=`animation-${i}`,a=o[r];if(a)return a;let l;if(s.options.animation!==!1){let d=this.chart.config,h=d.datasetAnimationScopeKeys(this._type,i),u=d.getOptionScopes(this.getDataset(),h);l=d.createResolver(u,this.getContext(t,n,i))}let c=new Pn(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,i){return!i||So(t)||this.chart._animationsDisabled}_getSharedOptions(t,i){let n=this.resolveDataElementOptions(t,i),s=this._sharedOptions,o=this.getSharedOptions(n),r=this.includeOptions(i,o)||o!==s;return this.updateSharedOptions(o,i,n),{sharedOptions:o,includeOptions:r}}updateElement(t,i,n,s){So(s)?Object.assign(t,n):this._resolveAnimations(i,s).update(t,n)}updateSharedOptions(t,i,n){t&&!So(i)&&this._resolveAnimations(void 0,i).update(t,n)}_setStyle(t,i,n,s){t.active=s;let o=this.getStyle(i,s);this._resolveAnimations(i,n,s).update(t,{options:!s&&this.getSharedOptions(o)||o})}removeHoverStyle(t,i,n){this._setStyle(t,n,"active",!1)}setHoverStyle(t,i,n){this._setStyle(t,n,"active",!0)}_removeDatasetHoverStyle(){let t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!1)}_setDatasetHoverStyle(){let t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!0)}_resyncElements(t){let i=this._data,n=this._cachedMeta.data;for(let[a,l,c]of this._syncList)this[a](l,c);this._syncList=[];let s=n.length,o=i.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,i,n=!0){let s=this._cachedMeta,o=s.data,r=t+i,a,l=c=>{for(c.length+=i,a=c.length-1;a>=r;a--)c[a]=c[a-i]};for(l(o),a=t;a<r;++a)o[a]=new this.dataElementType;this._parsing&&l(s._parsed),this.parse(t,i),n&&this.updateElements(o,t,i,"reset")}updateElements(t,i,n,s){}_removeElements(t,i){let n=this._cachedMeta;if(this._parsing){let s=n._parsed.splice(t,i);n._stacked&&mi(n,s)}n.data.splice(t,i)}_sync(t){if(this._parsing)this._syncList.push(t);else{let[i,n,s]=t;this[i](n,s)}this.chart._dataChanges.push([this.index,...t])}_onDataPush(){let 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,i){i&&this._sync(["_removeElements",t,i]);let n=arguments.length-2;n&&this._sync(["_insertElements",t,n])}_onDataUnshift(){this._sync(["_insertElements",0,arguments.length])}};function Rp(e,t){if(!e._cache.$bar){let i=e.getMatchingVisibleMetas(t),n=[];for(let s=0,o=i.length;s<o;s++)n=n.concat(i[s].controller.getAllParsedValues(e));e._cache.$bar=to(n.sort((s,o)=>s-o))}return e._cache.$bar}function Ep(e){let t=e.iScale,i=Rp(t,e.type),n=t._length,s,o,r,a,l=()=>{r===32767||r===-32768||($e(a)&&(n=Math.min(n,Math.abs(r-a)||n)),a=r)};for(s=0,o=i.length;s<o;++s)r=t.getPixelForValue(i[s]),l();for(a=void 0,s=0,o=t.ticks.length;s<o;++s)r=t.getPixelForTick(s),l();return n}function Ip(e,t,i,n){let s=i.barThickness,o,r;return D(s)?(o=t.min*i.categoryPercentage,r=i.barPercentage):(o=s*n,r=1),{chunk:o/n,ratio:r,start:t.pixels[e]-o/2}}function Fp(e,t,i,n){let s=t.pixels,o=s[e],r=e>0?s[e-1]:null,a=e<s.length-1?s[e+1]:null,l=i.categoryPercentage;r===null&&(r=o-(a===null?t.end-t.start:a-o)),a===null&&(a=o+o-r);let c=o-(o-Math.min(r,a))/2*l;return{chunk:Math.abs(a-r)/2*l/n,ratio:i.barPercentage,start:c}}function Np(e,t,i,n){let s=i.parse(e[0],n),o=i.parse(e[1],n),r=Math.min(s,o),a=Math.max(s,o),l=r,c=a;Math.abs(r)>Math.abs(a)&&(l=a,c=r),t[i.axis]=c,t._custom={barStart:l,barEnd:c,start:s,end:o,min:r,max:a}}function Rc(e,t,i,n){return B(e)?Np(e,t,i,n):t[i.axis]=i.parse(e,n),t}function Bl(e,t,i,n){let s=e.iScale,o=e.vScale,r=s.getLabels(),a=s===o,l=[],c,d,h,u;for(c=i,d=i+n;c<d;++c)u=t[c],h={},h[s.axis]=a||s.parse(r[c],c),l.push(Rc(u,h,o,c));return l}function Mo(e){return e&&e.barStart!==void 0&&e.barEnd!==void 0}function zp(e,t,i){return e!==0?gt(e):(t.isHorizontal()?1:-1)*(t.min>=i?1:-1)}function Bp(e){let t,i,n,s,o;return e.horizontal?(t=e.base>e.x,i="left",n="right"):(t=e.base<e.y,i="bottom",n="top"),t?(s="end",o="start"):(s="start",o="end"),{start:i,end:n,reverse:t,top:s,bottom:o}}function $p(e,t,i,n){let s=t.borderSkipped,o={};if(!s){e.borderSkipped=o;return}if(s===!0){e.borderSkipped={top:!0,right:!0,bottom:!0,left:!0};return}let{start:r,end:a,reverse:l,top:c,bottom:d}=Bp(e);s==="middle"&&i&&(e.enableBorderRadius=!0,(i._top||0)===n?s=c:(i._bottom||0)===n?s=d:(o[$l(d,r,a,l)]=!0,s=c)),o[$l(s,r,a,l)]=!0,e.borderSkipped=o}function $l(e,t,i,n){return n?(e=jp(e,t,i),e=jl(e,i,t)):e=jl(e,t,i),e}function jp(e,t,i){return e===t?i:e===i?t:e}function jl(e,t,i){return e==="start"?t:e==="end"?i:e}function Vp(e,{inflateAmount:t},i){e.inflateAmount=t==="auto"?i===1?.33:0:t}var Cn=class extends Si{static id="bar";static defaults={datasetElementType:!1,dataElementType:"bar",categoryPercentage:.8,barPercentage:.9,grouped:!0,animations:{numbers:{type:"number",properties:["x","y","base","width","height"]}}};static overrides={scales:{_index_:{type:"category",offset:!0,grid:{offset:!0}},_value_:{type:"linear",beginAtZero:!0}}};parsePrimitiveData(t,i,n,s){return Bl(t,i,n,s)}parseArrayData(t,i,n,s){return Bl(t,i,n,s)}parseObjectData(t,i,n,s){let{iScale:o,vScale:r}=t,{xAxisKey:a="x",yAxisKey:l="y"}=this._parsing,c=o.axis==="x"?a:l,d=r.axis==="x"?a:l,h=[],u,f,g,p;for(u=n,f=n+s;u<f;++u)p=i[u],g={},g[o.axis]=o.parse(ye(p,c),u),h.push(Rc(ye(p,d),g,r,u));return h}updateRangeFromParsed(t,i,n,s){super.updateRangeFromParsed(t,i,n,s);let o=n._custom;o&&i===this._cachedMeta.vScale&&(t.min=Math.min(t.min,o.min),t.max=Math.max(t.max,o.max))}getMaxOverflow(){return 0}getLabelAndValue(t){let i=this._cachedMeta,{iScale:n,vScale:s}=i,o=this.getParsed(t),r=o._custom,a=Mo(r)?"["+r.start+", "+r.end+"]":""+s.getLabelForValue(o[s.axis]);return{label:""+n.getLabelForValue(o[n.axis]),value:a}}initialize(){this.enableOptionSharing=!0,super.initialize();let t=this._cachedMeta;t.stack=this.getDataset().stack}update(t){let i=this._cachedMeta;this.updateElements(i.data,0,i.data.length,t)}updateElements(t,i,n,s){let o=s==="reset",{index:r,_cachedMeta:{vScale:a}}=this,l=a.getBasePixel(),c=a.isHorizontal(),d=this._getRuler(),{sharedOptions:h,includeOptions:u}=this._getSharedOptions(i,s);for(let f=i;f<i+n;f++){let g=this.getParsed(f),p=o||D(g[a.axis])?{base:l,head:l}:this._calculateBarValuePixels(f),m=this._calculateBarIndexPixels(f,d),b=(g._stacks||{})[a.axis],y={horizontal:c,base:p.base,enableBorderRadius:!b||Mo(g._custom)||r===b._top||r===b._bottom,x:c?p.head:m.center,y:c?m.center:p.head,height:c?m.size:Math.abs(p.size),width:c?Math.abs(p.size):m.size};u&&(y.options=h||this.resolveDataElementOptions(f,t[f].active?"active":s));let v=y.options||t[f].options;$p(y,v,b,r),Vp(y,v,d.ratio),this.updateElement(t[f],f,y,s)}}_getStacks(t,i){let{iScale:n}=this._cachedMeta,s=n.getMatchingVisibleMetas(this._type).filter(d=>d.controller.options.grouped),o=n.options.stacked,r=[],a=this._cachedMeta.controller.getParsed(i),l=a&&a[n.axis],c=d=>{let h=d._parsed.find(f=>f[n.axis]===l),u=h&&h[d.vScale.axis];if(D(u)||isNaN(u))return!0};for(let d of s)if(!(i!==void 0&&c(d))&&((o===!1||r.indexOf(d.stack)===-1||o===void 0&&d.stack===void 0)&&r.push(d.stack),d.index===t))break;return r.length||r.push(void 0),r}_getStackCount(t){return this._getStacks(void 0,t).length}_getAxisCount(){return this._getAxis().length}getFirstScaleIdForIndexAxis(){let t=this.chart.scales,i=this.chart.options.indexAxis;return Object.keys(t).filter(n=>t[n].axis===i).shift()}_getAxis(){let t={},i=this.getFirstScaleIdForIndexAxis();for(let n of this.chart.data.datasets)t[O(this.chart.options.indexAxis==="x"?n.xAxisID:n.yAxisID,i)]=!0;return Object.keys(t)}_getStackIndex(t,i,n){let s=this._getStacks(t,n),o=i!==void 0?s.indexOf(i):-1;return o===-1?s.length-1:o}_getRuler(){let t=this.options,i=this._cachedMeta,n=i.iScale,s=[],o,r;for(o=0,r=i.data.length;o<r;++o)s.push(n.getPixelForValue(this.getParsed(o)[n.axis],o));let a=t.barThickness;return{min:a||Ep(i),pixels:s,start:n._startPixel,end:n._endPixel,stackCount:this._getStackCount(),scale:n,grouped:t.grouped,ratio:a?1:t.categoryPercentage*t.barPercentage}}_calculateBarValuePixels(t){let{_cachedMeta:{vScale:i,_stacked:n,index:s},options:{base:o,minBarLength:r}}=this,a=o||0,l=this.getParsed(t),c=l._custom,d=Mo(c),h=l[i.axis],u=0,f=n?this.applyStack(i,l,n):h,g,p;f!==h&&(u=f-h,f=h),d&&(h=c.barStart,f=c.barEnd-c.barStart,h!==0&&gt(h)!==gt(c.barEnd)&&(u=0),u+=h);let m=!D(o)&&!d?o:u,b=i.getPixelForValue(m);if(this.chart.getDataVisibility(t)?g=i.getPixelForValue(u+f):g=b,p=g-b,Math.abs(p)<r){p=zp(p,i,a)*r,h===a&&(b-=p/2);let y=i.getPixelForDecimal(0),v=i.getPixelForDecimal(1),_=Math.min(y,v),x=Math.max(y,v);b=Math.max(Math.min(b,x),_),g=b+p,n&&!d&&(l._stacks[i.axis]._visualValues[s]=i.getValueForPixel(g)-i.getValueForPixel(b))}if(b===i.getPixelForValue(a)){let y=gt(p)*i.getLineWidthForValue(a)/2;b+=y,p-=y}return{size:p,base:b,head:g,center:g+p/2}}_calculateBarIndexPixels(t,i){let n=i.scale,s=this.options,o=s.skipNull,r=O(s.maxBarThickness,1/0),a,l,c=this._getAxisCount();if(i.grouped){let d=o?this._getStackCount(t):i.stackCount,h=s.barThickness==="flex"?Fp(t,i,s,d*c):Ip(t,i,s,d*c),u=this.chart.options.indexAxis==="x"?this.getDataset().xAxisID:this.getDataset().yAxisID,f=this._getAxis().indexOf(O(u,this.getFirstScaleIdForIndexAxis())),g=this._getStackIndex(this.index,this._cachedMeta.stack,o?t:void 0)+f;a=h.start+h.chunk*g+h.chunk/2,l=Math.min(r,h.chunk*h.ratio)}else a=n.getPixelForValue(this.getParsed(t)[n.axis],t),l=Math.min(r,i.min*i.ratio);return{base:a-l/2,head:a+l/2,center:a,size:l}}draw(){let t=this._cachedMeta,i=t.vScale,n=t.data,s=n.length,o=0;for(;o<s;++o)this.getParsed(o)[i.axis]!==null&&!n[o].hidden&&n[o].draw(this._ctx)}};var An=class extends Si{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){let i=this._cachedMeta,{dataset:n,data:s=[],_dataset:o}=i,r=this.chart._animationsDisabled,{start:a,count:l}=gl(i,s,r);this._drawStart=a,this._drawCount=l,ml(i)&&(a=0,l=s.length),n._chart=this.chart,n._datasetIndex=this.index,n._decimated=!!o._decimated,n.points=s;let c=this.resolveDatasetElementOptions(t);this.options.showLine||(c.borderWidth=0),c.segment=this.options.segment,this.updateElement(n,void 0,{animated:!r,options:c},t),this.updateElements(s,a,l,t)}updateElements(t,i,n,s){let o=s==="reset",{iScale:r,vScale:a,_stacked:l,_dataset:c}=this._cachedMeta,{sharedOptions:d,includeOptions:h}=this._getSharedOptions(i,s),u=r.axis,f=a.axis,{spanGaps:g,segment:p}=this.options,m=Ve(g)?g:Number.POSITIVE_INFINITY,b=this.chart._animationsDisabled||o||s==="none",y=i+n,v=t.length,_=i>0&&this.getParsed(i-1);for(let x=0;x<v;++x){let M=t[x],w=b?M:{};if(x<i||x>=y){w.skip=!0;continue}let S=this.getParsed(x),P=D(S[f]),A=w[u]=r.getPixelForValue(S[u],x),L=w[f]=o||P?a.getBasePixel():a.getPixelForValue(l?this.applyStack(a,S,l):S[f],x);w.skip=isNaN(A)||isNaN(L)||P,w.stop=x>0&&Math.abs(S[u]-_[u])>m,p&&(w.parsed=S,w.raw=c.data[x]),h&&(w.options=d||this.resolveDataElementOptions(x,M.active?"active":s)),b||this.updateElement(M,x,w,s),_=S}}getMaxOverflow(){let t=this._cachedMeta,i=t.dataset,n=i.options&&i.options.borderWidth||0,s=t.data||[];if(!s.length)return n;let o=s[0].size(this.resolveDataElementOptions(0)),r=s[s.length-1].size(this.resolveDataElementOptions(s.length-1));return Math.max(n,o,r)/2}draw(){let t=this._cachedMeta;t.dataset.updateControlPoints(this.chart.chartArea,t.iScale.axis),super.draw()}};function ve(){throw new Error("This method is not implemented: Check that a complete date adapter is provided.")}var Eo=class e{static override(t){Object.assign(e.prototype,t)}options;constructor(t){this.options=t||{}}init(){}formats(){return ve()}parse(){return ve()}format(){return ve()}add(){return ve()}diff(){return ve()}startOf(){return ve()}endOf(){return ve()}},Hp={_date:Eo};function Wp(e,t,i,n){let{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){let c=a._reversePixels?cl:Jt;if(n){if(s._sharedOptions){let d=o[0],h=typeof d.getRange=="function"&&d.getRange(t);if(h){let u=c(o,t,i-h),f=c(o,t,i+h);return{lo:u.lo,hi:f.hi}}}}else{let d=c(o,t,i);if(l){let{vScale:h}=s._cachedMeta,{_parsed:u}=e,f=u.slice(0,d.lo+1).reverse().findIndex(p=>!D(p[h.axis]));d.lo-=Math.max(0,f);let g=u.slice(d.hi).findIndex(p=>!D(p[h.axis]));d.hi+=Math.max(0,g)}return d}}return{lo:0,hi:o.length-1}}function Pi(e,t,i,n,s){let o=e.getSortedVisibleDatasetMetas(),r=i[t];for(let a=0,l=o.length;a<l;++a){let{index:c,data:d}=o[a],{lo:h,hi:u}=Wp(o[a],t,r,s);for(let f=h;f<=u;++f){let g=d[f];g.skip||n(g,c,f)}}}function Kp(e){let t=e.indexOf("x")!==-1,i=e.indexOf("y")!==-1;return function(n,s){let o=t?Math.abs(n.x-s.x):0,r=i?Math.abs(n.y-s.y):0;return Math.sqrt(Math.pow(o,2)+Math.pow(r,2))}}function ko(e,t,i,n,s){let o=[];return!s&&!e.isPointInArea(t)||Pi(e,i,t,function(a,l,c){!s&&!St(a,e.chartArea,0)||a.inRange(t.x,t.y,n)&&o.push({element:a,datasetIndex:l,index:c})},!0),o}function Up(e,t,i,n){let s=[];function o(r,a,l){let{startAngle:c,endAngle:d}=r.getProps(["startAngle","endAngle"],n),{angle:h}=al(r,{x:t.x,y:t.y});Zs(h,c,d)&&s.push({element:r,datasetIndex:a,index:l})}return Pi(e,i,t,o),s}function qp(e,t,i,n,s,o){let r=[],a=Kp(i),l=Number.POSITIVE_INFINITY;function c(d,h,u){let f=d.inRange(t.x,t.y,s);if(n&&!f)return;let g=d.getCenterPoint(s);if(!(!!o||e.isPointInArea(g))&&!f)return;let m=a(t,g);m<l?(r=[{element:d,datasetIndex:h,index:u}],l=m):m===l&&r.push({element:d,datasetIndex:h,index:u})}return Pi(e,i,t,c),r}function Po(e,t,i,n,s,o){return!o&&!e.isPointInArea(t)?[]:i==="r"&&!n?Up(e,t,i,s):qp(e,t,i,n,s,o)}function Vl(e,t,i,n,s){let o=[],r=i==="x"?"inXRange":"inYRange",a=!1;return Pi(e,i,t,(l,c,d)=>{l[r]&&l[r](t[i],s)&&(o.push({element:l,datasetIndex:c,index:d}),a=a||l.inRange(t.x,t.y,s))}),n&&!a?[]:o}var Yp={evaluateInteractionItems:Pi,modes:{index(e,t,i,n){let s=ee(t,e),o=i.axis||"x",r=i.includeInvisible||!1,a=i.intersect?ko(e,s,o,n,r):Po(e,s,o,!1,n,r),l=[];return a.length?(e.getSortedVisibleDatasetMetas().forEach(c=>{let d=a[0].index,h=c.data[d];h&&!h.skip&&l.push({element:h,datasetIndex:c.index,index:d})}),l):[]},dataset(e,t,i,n){let s=ee(t,e),o=i.axis||"xy",r=i.includeInvisible||!1,a=i.intersect?ko(e,s,o,n,r):Po(e,s,o,!1,n,r);if(a.length>0){let l=a[0].datasetIndex,c=e.getDatasetMeta(l).data;a=[];for(let d=0;d<c.length;++d)a.push({element:c[d],datasetIndex:l,index:d})}return a},point(e,t,i,n){let s=ee(t,e),o=i.axis||"xy",r=i.includeInvisible||!1;return ko(e,s,o,n,r)},nearest(e,t,i,n){let s=ee(t,e),o=i.axis||"xy",r=i.includeInvisible||!1;return Po(e,s,o,i.intersect,n,r)},x(e,t,i,n){let s=ee(t,e);return Vl(e,s,"x",i.intersect,n)},y(e,t,i,n){let s=ee(t,e);return Vl(e,s,"y",i.intersect,n)}}},Ec=["left","top","right","bottom"];function bi(e,t){return e.filter(i=>i.pos===t)}function Hl(e,t){return e.filter(i=>Ec.indexOf(i.pos)===-1&&i.box.axis===t)}function yi(e,t){return e.sort((i,n)=>{let s=t?n:i,o=t?i:n;return s.weight===o.weight?s.index-o.index:s.weight-o.weight})}function Xp(e){let t=[],i,n,s,o,r,a;for(i=0,n=(e||[]).length;i<n;++i)s=e[i],{position:o,options:{stack:r,stackWeight:a=1}}=s,t.push({index:i,box:s,pos:o,horizontal:s.isHorizontal(),weight:s.weight,stack:r&&o+r,stackWeight:a});return t}function Jp(e){let t={};for(let i of e){let{stack:n,pos:s,stackWeight:o}=i;if(!n||!Ec.includes(s))continue;let r=t[n]||(t[n]={count:0,placed:0,weight:0,size:0});r.count++,r.weight+=o}return t}function Gp(e,t){let i=Jp(e),{vBoxMaxWidth:n,hBoxMaxHeight:s}=t,o,r,a;for(o=0,r=e.length;o<r;++o){a=e[o];let{fullSize:l}=a.box,c=i[a.stack],d=c&&a.stackWeight/c.weight;a.horizontal?(a.width=d?d*n:l&&t.availableWidth,a.height=s):(a.width=n,a.height=d?d*s:l&&t.availableHeight)}return i}function Zp(e){let t=Xp(e),i=yi(t.filter(c=>c.box.fullSize),!0),n=yi(bi(t,"left"),!0),s=yi(bi(t,"right")),o=yi(bi(t,"top"),!0),r=yi(bi(t,"bottom")),a=Hl(t,"x"),l=Hl(t,"y");return{fullSize:i,leftAndTop:n.concat(o),rightAndBottom:s.concat(l).concat(r).concat(a),chartArea:bi(t,"chartArea"),vertical:n.concat(s).concat(l),horizontal:o.concat(r).concat(a)}}function Wl(e,t,i,n){return Math.max(e[i],t[i])+Math.max(e[n],t[n])}function Ic(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 Qp(e,t,i,n){let{pos:s,box:o}=i,r=e.maxPadding;if(!T(s)){i.size&&(e[s]-=i.size);let h=n[i.stack]||{size:0,count:1};h.size=Math.max(h.size,i.horizontal?o.height:o.width),i.size=h.size/h.count,e[s]+=i.size}o.getPadding&&Ic(r,o.getPadding());let a=Math.max(0,t.outerWidth-Wl(r,e,"left","right")),l=Math.max(0,t.outerHeight-Wl(r,e,"top","bottom")),c=a!==e.w,d=l!==e.h;return e.w=a,e.h=l,i.horizontal?{same:c,other:d}:{same:d,other:c}}function tg(e){let t=e.maxPadding;function i(n){let s=Math.max(t[n]-e[n],0);return e[n]+=s,s}e.y+=i("top"),e.x+=i("left"),i("right"),i("bottom")}function eg(e,t){let i=t.maxPadding;function n(s){let o={left:0,top:0,right:0,bottom:0};return s.forEach(r=>{o[r]=Math.max(t[r],i[r])}),o}return n(e?["left","right"]:["top","bottom"])}function vi(e,t,i,n){let s=[],o,r,a,l,c,d;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,eg(a.horizontal,t));let{same:h,other:u}=Qp(t,i,a,n);c|=h&&s.length,d=d||u,l.fullSize||s.push(a)}return c&&vi(s,t,i,n)||d}function xn(e,t,i,n,s){e.top=i,e.left=t,e.right=t+n,e.bottom=i+s,e.width=n,e.height=s}function Kl(e,t,i,n){let s=i.padding,{x:o,y:r}=t;for(let a of e){let l=a.box,c=n[a.stack]||{count:1,placed:0,weight:1},d=a.stackWeight/c.weight||1;if(a.horizontal){let h=t.w*d,u=c.size||l.height;$e(c.start)&&(r=c.start),l.fullSize?xn(l,s.left,r,i.outerWidth-s.right-s.left,u):xn(l,t.left+c.placed,r,h,u),c.start=r,c.placed+=h,r=l.bottom}else{let h=t.h*d,u=c.size||l.width;$e(c.start)&&(o=c.start),l.fullSize?xn(l,o,s.top,u,i.outerHeight-s.bottom-s.top):xn(l,o,t.top+c.placed,u,h),c.start=o,c.placed+=h,o=l.right}}t.x=o,t.y=r}var ie={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(i){t.draw(i)}}]},e.boxes.push(t)},removeBox(e,t){let i=e.boxes?e.boxes.indexOf(t):-1;i!==-1&&e.boxes.splice(i,1)},configure(e,t,i){t.fullSize=i.fullSize,t.position=i.position,t.weight=i.weight},update(e,t,i,n){if(!e)return;let s=tt(e.options.layout.padding),o=Math.max(t-s.width,0),r=Math.max(i-s.height,0),a=Zp(e.boxes),l=a.vertical,c=a.horizontal;E(e.boxes,p=>{typeof p.beforeLayout=="function"&&p.beforeLayout()});let d=l.reduce((p,m)=>m.box.options&&m.box.options.display===!1?p:p+1,0)||1,h=Object.freeze({outerWidth:t,outerHeight:i,padding:s,availableWidth:o,availableHeight:r,vBoxMaxWidth:o/2/d,hBoxMaxHeight:r/2}),u=Object.assign({},s);Ic(u,tt(n));let f=Object.assign({maxPadding:u,w:o,h:r,x:s.left,y:s.top},s),g=Gp(l.concat(c),h);vi(a.fullSize,f,h,g),vi(l,f,h,g),vi(c,f,h,g)&&vi(l,f,h,g),tg(f),Kl(a.leftAndTop,f,h,g),f.x+=f.w,f.y+=f.h,Kl(a.rightAndBottom,f,h,g),e.chartArea={left:f.left,top:f.top,right:f.left+f.w,bottom:f.top+f.h,height:f.h,width:f.w},E(a.chartArea,p=>{let m=p.box;Object.assign(m,e.chartArea),m.update(f.w,f.h,{left:0,top:0,right:0,bottom:0})})}},On=class{acquireContext(t,i){}releaseContext(t){return!1}addEventListener(t,i,n){}removeEventListener(t,i,n){}getDevicePixelRatio(){return 1}getMaximumSize(t,i,n,s){return i=Math.max(0,i||t.width),n=n||t.height,{width:i,height:Math.max(0,s?Math.floor(i/s):n)}}isAttached(t){return!0}updateConfig(t){}},Io=class extends On{acquireContext(t){return t&&t.getContext&&t.getContext("2d")||null}updateConfig(t){t.options.animation=!1}},Mn="$chartjs",ig={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},Ul=e=>e===null||e==="";function ng(e,t){let i=e.style,n=e.getAttribute("height"),s=e.getAttribute("width");if(e[Mn]={initial:{height:n,width:s,style:{display:i.display,height:i.height,width:i.width}}},i.display=i.display||"block",i.boxSizing=i.boxSizing||"border-box",Ul(s)){let o=go(e,"width");o!==void 0&&(e.width=o)}if(Ul(n))if(e.style.height==="")e.height=e.width/(t||2);else{let o=go(e,"height");o!==void 0&&(e.height=o)}return e}var Fc=Al?{passive:!0}:!1;function sg(e,t,i){e&&e.addEventListener(t,i,Fc)}function og(e,t,i){e&&e.canvas&&e.canvas.removeEventListener(t,i,Fc)}function rg(e,t){let i=ig[e.type]||e.type,{x:n,y:s}=ee(e,t);return{type:i,chart:t,native:e,x:n!==void 0?n:null,y:s!==void 0?s:null}}function Ln(e,t){for(let i of e)if(i===t||i.contains(t))return!0}function ag(e,t,i){let n=e.canvas,s=new MutationObserver(o=>{let r=!1;for(let a of o)r=r||Ln(a.addedNodes,n),r=r&&!Ln(a.removedNodes,n);r&&i()});return s.observe(document,{childList:!0,subtree:!0}),s}function lg(e,t,i){let n=e.canvas,s=new MutationObserver(o=>{let r=!1;for(let a of o)r=r||Ln(a.removedNodes,n),r=r&&!Ln(a.addedNodes,n);r&&i()});return s.observe(document,{childList:!0,subtree:!0}),s}var Mi=new Map,ql=0;function Nc(){let e=window.devicePixelRatio;e!==ql&&(ql=e,Mi.forEach((t,i)=>{i.currentDevicePixelRatio!==e&&t()}))}function cg(e,t){Mi.size||window.addEventListener("resize",Nc),Mi.set(e,t)}function dg(e){Mi.delete(e),Mi.size||window.removeEventListener("resize",Nc)}function hg(e,t,i){let n=e.canvas,s=n&&bn(n);if(!s)return;let o=io((a,l)=>{let c=s.clientWidth;i(a,l),c<s.clientWidth&&i()},window),r=new ResizeObserver(a=>{let l=a[0],c=l.contentRect.width,d=l.contentRect.height;c===0&&d===0||o(c,d)});return r.observe(s),cg(e,o),r}function Co(e,t,i){i&&i.disconnect(),t==="resize"&&dg(e)}function ug(e,t,i){let n=e.canvas,s=io(o=>{e.ctx!==null&&i(rg(o,e))},e);return sg(n,t,s),s}var Fo=class extends On{acquireContext(t,i){let n=t&&t.getContext&&t.getContext("2d");return n&&n.canvas===t?(ng(t,i),n):null}releaseContext(t){let i=t.canvas;if(!i[Mn])return!1;let n=i[Mn].initial;["height","width"].forEach(o=>{let r=n[o];D(r)?i.removeAttribute(o):i.setAttribute(o,r)});let s=n.style||{};return Object.keys(s).forEach(o=>{i.style[o]=s[o]}),i.width=i.width,delete i[Mn],!0}addEventListener(t,i,n){this.removeEventListener(t,i);let s=t.$proxies||(t.$proxies={}),r={attach:ag,detach:lg,resize:hg}[i]||ug;s[i]=r(t,i,n)}removeEventListener(t,i){let n=t.$proxies||(t.$proxies={}),s=n[i];if(!s)return;({attach:Co,detach:Co,resize:Co}[i]||og)(t,i,s),n[i]=void 0}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(t,i,n,s){return Cl(t,i,n,s)}isAttached(t){let i=t&&bn(t);return!!(i&&i.isConnected)}};function fg(e){return!mn()||typeof OffscreenCanvas<"u"&&e instanceof OffscreenCanvas?Io:Fo}var jt=class{static defaults={};static defaultRoutes=void 0;x;y;active=!1;options;$animations;tooltipPosition(t){let{x:i,y:n}=this.getProps(["x","y"],t);return{x:i,y:n}}hasValue(){return Ve(this.x)&&Ve(this.y)}getProps(t,i){let n=this.$animations;if(!i||!n)return this;let s={};return t.forEach(o=>{s[o]=n[o]&&n[o].active()?n[o]._to:this[o]}),s}};function pg(e,t){let i=e.options.ticks,n=gg(e),s=Math.min(i.maxTicksLimit||n,n),o=i.major.enabled?bg(t):[],r=o.length,a=o[0],l=o[r-1],c=[];if(r>s)return yg(t,c,o,r/s),c;let d=mg(o,t,s);if(r>0){let h,u,f=r>1?Math.round((l-a)/(r-1)):null;for(_n(t,c,d,D(f)?0:a-f,a),h=0,u=r-1;h<u;h++)_n(t,c,d,o[h],o[h+1]);return _n(t,c,d,l,D(f)?t.length:l+f),c}return _n(t,c,d),c}function gg(e){let t=e.options.offset,i=e._tickSize(),n=e._length/i+(t?0:1),s=e._maxLength/i;return Math.floor(Math.min(n,s))}function mg(e,t,i){let n=xg(e),s=t.length/i;if(!n)return Math.max(s,1);let o=ol(n);for(let r=0,a=o.length-1;r<a;r++){let l=o[r];if(l>s)return l}return Math.max(s,1)}function bg(e){let t=[],i,n;for(i=0,n=e.length;i<n;i++)e[i].major&&t.push(i);return t}function yg(e,t,i,n){let s=0,o=i[0],r;for(n=Math.ceil(n),r=0;r<e.length;r++)r===o&&(t.push(e[r]),s++,o=i[s*n])}function _n(e,t,i,n,s){let o=O(n,0),r=Math.min(O(s,e.length),e.length),a=0,l,c,d;for(i=Math.ceil(i),s&&(l=s-n,i=l/Math.floor(l/i)),d=o;d<0;)a++,d=Math.round(o+a*i);for(c=Math.max(o,0);c<r;c++)c===d&&(t.push(e[c]),a++,d=Math.round(o+a*i))}function xg(e){let t=e.length,i,n;if(t<2)return!1;for(n=e[0],i=1;i<t;++i)if(e[i]-e[i-1]!==n)return!1;return n}var _g=e=>e==="left"?"right":e==="right"?"left":e,Yl=(e,t,i)=>t==="top"||t==="left"?e[t]+i:e[t]-i,Xl=(e,t)=>Math.min(t||e,e);function Jl(e,t){let i=[],n=e.length/t,s=e.length,o=0;for(;o<s;o+=n)i.push(e[Math.floor(o)]);return i}function vg(e,t,i){let n=e.ticks.length,s=Math.min(t,n-1),o=e._startPixel,r=e._endPixel,a=1e-6,l=e.getPixelForTick(s),c;if(!(i&&(n===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 wg(e,t){E(e,i=>{let n=i.gc,s=n.length/2,o;if(s>t){for(o=0;o<s;++o)delete i.data[n[o]];n.splice(0,s)}})}function xi(e){return e.drawTicks?e.tickLength:0}function Gl(e,t){if(!e.display)return 0;let i=G(e.font,t),n=tt(e.padding);return(B(e.text)?e.text.length:1)*i.lineHeight+n.height}function Sg(e,t){return zt(e,{scale:t,type:"scale"})}function Mg(e,t,i){return zt(e,{tick:i,index:t,type:"tick"})}function kg(e,t,i){let n=no(e);return(i&&t!=="right"||!i&&t==="right")&&(n=_g(n)),n}function Pg(e,t,i,n){let{top:s,left:o,bottom:r,right:a,chart:l}=e,{chartArea:c,scales:d}=l,h=0,u,f,g,p=r-s,m=a-o;if(e.isHorizontal()){if(f=lt(n,o,a),T(i)){let b=Object.keys(i)[0],y=i[b];g=d[b].getPixelForValue(y)+p-t}else i==="center"?g=(c.bottom+c.top)/2+p-t:g=Yl(e,i,t);u=a-o}else{if(T(i)){let b=Object.keys(i)[0],y=i[b];f=d[b].getPixelForValue(y)-m+t}else i==="center"?f=(c.left+c.right)/2-m+t:f=Yl(e,i,t);g=lt(n,r,s),h=i==="left"?-st:st}return{titleX:f,titleY:g,maxWidth:u,rotation:h}}var Se=class e extends jt{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,i){return t}getUserBounds(){let{_userMin:t,_userMax:i,_suggestedMin:n,_suggestedMax:s}=this;return t=at(t,Number.POSITIVE_INFINITY),i=at(i,Number.NEGATIVE_INFINITY),n=at(n,Number.POSITIVE_INFINITY),s=at(s,Number.NEGATIVE_INFINITY),{min:at(t,n),max:at(i,s),minDefined:V(t),maxDefined:V(i)}}getMinMax(t){let{min:i,max:n,minDefined:s,maxDefined:o}=this.getUserBounds(),r;if(s&&o)return{min:i,max:n};let a=this.getMatchingVisibleMetas();for(let l=0,c=a.length;l<c;++l)r=a[l].controller.getMinMax(this,t),s||(i=Math.min(i,r.min)),o||(n=Math.max(n,r.max));return i=o&&i>n?n:i,n=s&&i>n?i:n,{min:at(i,at(n,i)),max:at(n,at(i,n))}}getPadding(){return{left:this.paddingLeft||0,top:this.paddingTop||0,right:this.paddingRight||0,bottom:this.paddingBottom||0}}getTicks(){return this.ticks}getLabels(){let 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(){N(this.options.beforeUpdate,[this])}update(t,i,n){let{beginAtZero:s,grace:o,ticks:r}=this.options,a=r.sampleSize;this.beforeUpdate(),this.maxWidth=t,this.maxHeight=i,this._margins=n=Object.assign({left:0,right:0,top:0,bottom:0},n),this.ticks=null,this._labelSizes=null,this._gridLineItems=null,this._labelItems=null,this.beforeSetDimensions(),this.setDimensions(),this.afterSetDimensions(),this._maxLength=this.isHorizontal()?this.width+n.left+n.right:this.height+n.top+n.bottom,this._dataLimitsCached||(this.beforeDataLimits(),this.determineDataLimits(),this.afterDataLimits(),this._range=vl(this,o,s),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();let l=a<this.ticks.length;this._convertTicksToLabels(l?Jl(this.ticks,a):this.ticks),this.configure(),this.beforeCalculateLabelRotation(),this.calculateLabelRotation(),this.afterCalculateLabelRotation(),r.display&&(r.autoSkip||r.source==="auto")&&(this.ticks=pg(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,i,n;this.isHorizontal()?(i=this.left,n=this.right):(i=this.top,n=this.bottom,t=!t),this._startPixel=i,this._endPixel=n,this._reversePixels=t,this._length=n-i,this._alignToPixels=this.options.alignToPixels}afterUpdate(){N(this.options.afterUpdate,[this])}beforeSetDimensions(){N(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(){N(this.options.afterSetDimensions,[this])}_callHooks(t){this.chart.notifyPlugins(t,this.getContext()),N(this.options[t],[this])}beforeDataLimits(){this._callHooks("beforeDataLimits")}determineDataLimits(){}afterDataLimits(){this._callHooks("afterDataLimits")}beforeBuildTicks(){this._callHooks("beforeBuildTicks")}buildTicks(){return[]}afterBuildTicks(){this._callHooks("afterBuildTicks")}beforeTickToLabelConversion(){N(this.options.beforeTickToLabelConversion,[this])}generateTickLabels(t){let i=this.options.ticks,n,s,o;for(n=0,s=t.length;n<s;n++)o=t[n],o.label=N(i.callback,[o.value,n,t],this)}afterTickToLabelConversion(){N(this.options.afterTickToLabelConversion,[this])}beforeCalculateLabelRotation(){N(this.options.beforeCalculateLabelRotation,[this])}calculateLabelRotation(){let t=this.options,i=t.ticks,n=Xl(this.ticks.length,t.ticks.maxTicksLimit),s=i.minRotation||0,o=i.maxRotation,r=s,a,l,c;if(!this._isVisible()||!i.display||s>=o||n<=1||!this.isHorizontal()){this.labelRotation=s;return}let d=this._getLabelSizes(),h=d.widest.width,u=d.highest.height,f=rt(this.chart.width-h,0,this.maxWidth);a=t.offset?this.maxWidth/n:f/(n-1),h+6>a&&(a=f/(n-(t.offset?.5:1)),l=this.maxHeight-xi(t.grid)-i.padding-Gl(t.title,this.chart.options.font),c=Math.sqrt(h*h+u*u),r=dn(Math.min(Math.asin(rt((d.highest.height+6)/a,-1,1)),Math.asin(rt(l/c,-1,1))-Math.asin(rt(u/c,-1,1)))),r=Math.max(s,Math.min(o,r))),this.labelRotation=r}afterCalculateLabelRotation(){N(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){N(this.options.beforeFit,[this])}fit(){let t={width:0,height:0},{chart:i,options:{ticks:n,title:s,grid:o}}=this,r=this._isVisible(),a=this.isHorizontal();if(r){let l=Gl(s,i.options.font);if(a?(t.width=this.maxWidth,t.height=xi(o)+l):(t.height=this.maxHeight,t.width=xi(o)+l),n.display&&this.ticks.length){let{first:c,last:d,widest:h,highest:u}=this._getLabelSizes(),f=n.padding*2,g=Ft(this.labelRotation),p=Math.cos(g),m=Math.sin(g);if(a){let b=n.mirror?0:m*h.width+p*u.height;t.height=Math.min(this.maxHeight,t.height+b+f)}else{let b=n.mirror?0:p*h.width+m*u.height;t.width=Math.min(this.maxWidth,t.width+b+f)}this._calculatePadding(c,d,m,p)}}this._handleMargins(),a?(this.width=this._length=i.width-this._margins.left-this._margins.right,this.height=t.height):(this.width=t.width,this.height=this._length=i.height-this._margins.top-this._margins.bottom)}_calculatePadding(t,i,n,s){let{ticks:{align:o,padding:r},position:a}=this.options,l=this.labelRotation!==0,c=a!=="top"&&this.axis==="x";if(this.isHorizontal()){let d=this.getPixelForTick(0)-this.left,h=this.right-this.getPixelForTick(this.ticks.length-1),u=0,f=0;l?c?(u=s*t.width,f=n*i.height):(u=n*t.height,f=s*i.width):o==="start"?f=i.width:o==="end"?u=t.width:o!=="inner"&&(u=t.width/2,f=i.width/2),this.paddingLeft=Math.max((u-d+r)*this.width/(this.width-d),0),this.paddingRight=Math.max((f-h+r)*this.width/(this.width-h),0)}else{let d=i.height/2,h=t.height/2;o==="start"?(d=0,h=t.height):o==="end"&&(d=i.height,h=0),this.paddingTop=d+r,this.paddingBottom=h+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(){N(this.options.afterFit,[this])}isHorizontal(){let{axis:t,position:i}=this.options;return i==="top"||i==="bottom"||t==="x"}isFullSize(){return this.options.fullSize}_convertTicksToLabels(t){this.beforeTickToLabelConversion(),this.generateTickLabels(t);let i,n;for(i=0,n=t.length;i<n;i++)D(t[i].label)&&(t.splice(i,1),n--,i--);this.afterTickToLabelConversion()}_getLabelSizes(){let t=this._labelSizes;if(!t){let i=this.options.ticks.sampleSize,n=this.ticks;i<n.length&&(n=Jl(n,i)),this._labelSizes=t=this._computeLabelSizes(n,n.length,this.options.ticks.maxTicksLimit)}return t}_computeLabelSizes(t,i,n){let{ctx:s,_longestTextCache:o}=this,r=[],a=[],l=Math.floor(i/Xl(i,n)),c=0,d=0,h,u,f,g,p,m,b,y,v,_,x;for(h=0;h<i;h+=l){if(g=t[h].label,p=this._resolveTickFontOptions(h),s.font=m=p.string,b=o[m]=o[m]||{data:{},gc:[]},y=p.lineHeight,v=_=0,!D(g)&&!B(g))v=di(s,b.data,b.gc,v,g),_=y;else if(B(g))for(u=0,f=g.length;u<f;++u)x=g[u],!D(x)&&!B(x)&&(v=di(s,b.data,b.gc,v,x),_+=y);r.push(v),a.push(_),c=Math.max(v,c),d=Math.max(_,d)}wg(o,i);let M=r.indexOf(c),w=a.indexOf(d),S=P=>({width:r[P]||0,height:a[P]||0});return{first:S(0),last:S(i-1),widest:S(M),highest:S(w),widths:r,heights:a}}getLabelForValue(t){return t}getPixelForValue(t,i){return NaN}getValueForPixel(t){}getPixelForTick(t){let i=this.ticks;return t<0||t>i.length-1?null:this.getPixelForValue(i[t].value)}getPixelForDecimal(t){this._reversePixels&&(t=1-t);let i=this._startPixel+t*this._length;return ll(this._alignToPixels?Qt(this.chart,i,0):i)}getDecimalForPixel(t){let i=(t-this._startPixel)/this._length;return this._reversePixels?1-i:i}getBasePixel(){return this.getPixelForValue(this.getBaseValue())}getBaseValue(){let{min:t,max:i}=this;return t<0&&i<0?i:t>0&&i>0?t:0}getContext(t){let i=this.ticks||[];if(t>=0&&t<i.length){let n=i[t];return n.$context||(n.$context=Mg(this.getContext(),t,n))}return this.$context||(this.$context=Sg(this.chart.getContext(),this))}_tickSize(){let t=this.options.ticks,i=Ft(this.labelRotation),n=Math.abs(Math.cos(i)),s=Math.abs(Math.sin(i)),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*n>a*s?a/n:l/s:l*s<a*n?l/n:a/s}_isVisible(){let t=this.options.display;return t!=="auto"?!!t:this.getMatchingVisibleMetas().length>0}_computeGridLineItems(t){let i=this.axis,n=this.chart,s=this.options,{grid:o,position:r,border:a}=s,l=o.offset,c=this.isHorizontal(),h=this.ticks.length+(l?1:0),u=xi(o),f=[],g=a.setContext(this.getContext()),p=g.display?g.width:0,m=p/2,b=function(F){return Qt(n,F,p)},y,v,_,x,M,w,S,P,A,L,R,I;if(r==="top")y=b(this.bottom),w=this.bottom-u,P=y-m,L=b(t.top)+m,I=t.bottom;else if(r==="bottom")y=b(this.top),L=t.top,I=b(t.bottom)-m,w=y+m,P=this.top+u;else if(r==="left")y=b(this.right),M=this.right-u,S=y-m,A=b(t.left)+m,R=t.right;else if(r==="right")y=b(this.left),A=t.left,R=b(t.right)-m,M=y+m,S=this.left+u;else if(i==="x"){if(r==="center")y=b((t.top+t.bottom)/2+.5);else if(T(r)){let F=Object.keys(r)[0],j=r[F];y=b(this.chart.scales[F].getPixelForValue(j))}L=t.top,I=t.bottom,w=y+m,P=w+u}else if(i==="y"){if(r==="center")y=b((t.left+t.right)/2);else if(T(r)){let F=Object.keys(r)[0],j=r[F];y=b(this.chart.scales[F].getPixelForValue(j))}M=y-m,S=M-u,A=t.left,R=t.right}let W=O(s.ticks.maxTicksLimit,h),$=Math.max(1,Math.ceil(h/W));for(v=0;v<h;v+=$){let F=this.getContext(v),j=o.setContext(F),yt=a.setContext(F),At=j.lineWidth,Ot=j.color,J=yt.dash||[],it=yt.dashOffset,ut=j.tickWidth,xt=j.tickColor,Ue=j.tickBorderDash||[],se=j.tickBorderDashOffset;_=vg(this,v,l),_!==void 0&&(x=Qt(n,_,At),c?M=S=A=R=x:w=P=L=I=x,f.push({tx1:M,ty1:w,tx2:S,ty2:P,x1:A,y1:L,x2:R,y2:I,width:At,color:Ot,borderDash:J,borderDashOffset:it,tickWidth:ut,tickColor:xt,tickBorderDash:Ue,tickBorderDashOffset:se}))}return this._ticksLength=h,this._borderValue=y,f}_computeLabelItems(t){let i=this.axis,n=this.options,{position:s,ticks:o}=n,r=this.isHorizontal(),a=this.ticks,{align:l,crossAlign:c,padding:d,mirror:h}=o,u=xi(n.grid),f=u+d,g=h?-d:f,p=-Ft(this.labelRotation),m=[],b,y,v,_,x,M,w,S,P,A,L,R,I="middle";if(s==="top")M=this.bottom-g,w=this._getXAxisLabelAlignment();else if(s==="bottom")M=this.top+g,w=this._getXAxisLabelAlignment();else if(s==="left"){let $=this._getYAxisLabelAlignment(u);w=$.textAlign,x=$.x}else if(s==="right"){let $=this._getYAxisLabelAlignment(u);w=$.textAlign,x=$.x}else if(i==="x"){if(s==="center")M=(t.top+t.bottom)/2+f;else if(T(s)){let $=Object.keys(s)[0],F=s[$];M=this.chart.scales[$].getPixelForValue(F)+f}w=this._getXAxisLabelAlignment()}else if(i==="y"){if(s==="center")x=(t.left+t.right)/2-f;else if(T(s)){let $=Object.keys(s)[0],F=s[$];x=this.chart.scales[$].getPixelForValue(F)}w=this._getYAxisLabelAlignment(u).textAlign}i==="y"&&(l==="start"?I="top":l==="end"&&(I="bottom"));let W=this._getLabelSizes();for(b=0,y=a.length;b<y;++b){v=a[b],_=v.label;let $=o.setContext(this.getContext(b));S=this.getPixelForTick(b)+o.labelOffset,P=this._resolveTickFontOptions(b),A=P.lineHeight,L=B(_)?_.length:1;let F=L/2,j=$.color,yt=$.textStrokeColor,At=$.textStrokeWidth,Ot=w;r?(x=S,w==="inner"&&(b===y-1?Ot=this.options.reverse?"left":"right":b===0?Ot=this.options.reverse?"right":"left":Ot="center"),s==="top"?c==="near"||p!==0?R=-L*A+A/2:c==="center"?R=-W.highest.height/2-F*A+A:R=-W.highest.height+A/2:c==="near"||p!==0?R=A/2:c==="center"?R=W.highest.height/2-F*A:R=W.highest.height-L*A,h&&(R*=-1),p!==0&&!$.showLabelBackdrop&&(x+=A/2*Math.sin(p))):(M=S,R=(1-L)*A/2);let J;if($.showLabelBackdrop){let it=tt($.backdropPadding),ut=W.heights[b],xt=W.widths[b],Ue=R-it.top,se=0-it.left;switch(I){case"middle":Ue-=ut/2;break;case"bottom":Ue-=ut;break}switch(w){case"center":se-=xt/2;break;case"right":se-=xt;break;case"inner":b===y-1?se-=xt:b>0&&(se-=xt/2);break}J={left:se,top:Ue,width:xt+it.width,height:ut+it.height,color:$.backdropColor}}m.push({label:_,font:P,textOffset:R,options:{rotation:p,color:j,strokeColor:yt,strokeWidth:At,textAlign:Ot,textBaseline:I,translation:[x,M],backdrop:J}})}return m}_getXAxisLabelAlignment(){let{position:t,ticks:i}=this.options;if(-Ft(this.labelRotation))return t==="top"?"left":"right";let s="center";return i.align==="start"?s="left":i.align==="end"?s="right":i.align==="inner"&&(s="inner"),s}_getYAxisLabelAlignment(t){let{position:i,ticks:{crossAlign:n,mirror:s,padding:o}}=this.options,r=this._getLabelSizes(),a=t+o,l=r.widest.width,c,d;return i==="left"?s?(d=this.right+o,n==="near"?c="left":n==="center"?(c="center",d+=l/2):(c="right",d+=l)):(d=this.right-a,n==="near"?c="right":n==="center"?(c="center",d-=l/2):(c="left",d=this.left)):i==="right"?s?(d=this.left+o,n==="near"?c="right":n==="center"?(c="center",d-=l/2):(c="left",d-=l)):(d=this.left+a,n==="near"?c="left":n==="center"?(c="center",d+=l/2):(c="right",d=this.right)):c="right",{textAlign:c,x:d}}_computeLabelArea(){if(this.options.ticks.mirror)return;let t=this.chart,i=this.options.position;if(i==="left"||i==="right")return{top:0,left:this.left,bottom:t.height,right:this.right};if(i==="top"||i==="bottom")return{top:this.top,left:0,bottom:this.bottom,right:t.width}}drawBackground(){let{ctx:t,options:{backgroundColor:i},left:n,top:s,width:o,height:r}=this;i&&(t.save(),t.fillStyle=i,t.fillRect(n,s,o,r),t.restore())}getLineWidthForValue(t){let i=this.options.grid;if(!this._isVisible()||!i.display)return 0;let s=this.ticks.findIndex(o=>o.value===t);return s>=0?i.setContext(this.getContext(s)).lineWidth:0}drawGrid(t){let i=this.options.grid,n=this.ctx,s=this._gridLineItems||(this._gridLineItems=this._computeGridLineItems(t)),o,r,a=(l,c,d)=>{!d.width||!d.color||(n.save(),n.lineWidth=d.width,n.strokeStyle=d.color,n.setLineDash(d.borderDash||[]),n.lineDashOffset=d.borderDashOffset,n.beginPath(),n.moveTo(l.x,l.y),n.lineTo(c.x,c.y),n.stroke(),n.restore())};if(i.display)for(o=0,r=s.length;o<r;++o){let l=s[o];i.drawOnChartArea&&a({x:l.x1,y:l.y1},{x:l.x2,y:l.y2},l),i.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(){let{chart:t,ctx:i,options:{border:n,grid:s}}=this,o=n.setContext(this.getContext()),r=n.display?o.width:0;if(!r)return;let a=s.setContext(this.getContext(0)).lineWidth,l=this._borderValue,c,d,h,u;this.isHorizontal()?(c=Qt(t,this.left,r)-r/2,d=Qt(t,this.right,a)+a/2,h=u=l):(h=Qt(t,this.top,r)-r/2,u=Qt(t,this.bottom,a)+a/2,c=d=l),i.save(),i.lineWidth=o.width,i.strokeStyle=o.color,i.beginPath(),i.moveTo(c,h),i.lineTo(d,u),i.stroke(),i.restore()}drawLabels(t){if(!this.options.ticks.display)return;let n=this.ctx,s=this._computeLabelArea();s&&fi(n,s);let o=this.getLabelItems(t);for(let r of o){let a=r.options,l=r.font,c=r.label,d=r.textOffset;xe(n,c,0,d,l,a)}s&&pi(n)}drawTitle(){let{ctx:t,options:{position:i,title:n,reverse:s}}=this;if(!n.display)return;let o=G(n.font),r=tt(n.padding),a=n.align,l=o.lineHeight/2;i==="bottom"||i==="center"||T(i)?(l+=r.bottom,B(n.text)&&(l+=o.lineHeight*(n.text.length-1))):l+=r.top;let{titleX:c,titleY:d,maxWidth:h,rotation:u}=Pg(this,l,i,a);xe(t,n.text,0,0,o,{color:n.color,maxWidth:h,rotation:u,textAlign:kg(a,i,s),textBaseline:"middle",translation:[c,d]})}draw(t){this._isVisible()&&(this.drawBackground(),this.drawGrid(t),this.drawBorder(),this.drawTitle(),this.drawLabels(t))}_layers(){let t=this.options,i=t.ticks&&t.ticks.z||0,n=O(t.grid&&t.grid.z,-1),s=O(t.border&&t.border.z,0);return!this._isVisible()||this.draw!==e.prototype.draw?[{z:i,draw:o=>{this.draw(o)}}]:[{z:n,draw:o=>{this.drawBackground(),this.drawGrid(o),this.drawTitle()}},{z:s,draw:()=>{this.drawBorder()}},{z:i,draw:o=>{this.drawLabels(o)}}]}getMatchingVisibleMetas(t){let i=this.chart.getSortedVisibleDatasetMetas(),n=this.axis+"AxisID",s=[],o,r;for(o=0,r=i.length;o<r;++o){let a=i[o];a[n]===this.id&&(!t||a.type===t)&&s.push(a)}return s}_resolveTickFontOptions(t){let i=this.options.ticks.setContext(this.getContext(t));return G(i.font)}_maxDigits(){let t=this._resolveTickFontOptions(0).lineHeight;return(this.isHorizontal()?this.width:this.height)/t}},We=class{constructor(t,i,n){this.type=t,this.scope=i,this.override=n,this.items=Object.create(null)}isForType(t){return Object.prototype.isPrototypeOf.call(this.type.prototype,t.prototype)}register(t){let i=Object.getPrototypeOf(t),n;Og(i)&&(n=this.register(i));let 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,Cg(t,r,n),this.override&&H.override(t.id,t.overrides)),r}get(t){return this.items[t]}unregister(t){let i=this.items,n=t.id,s=this.scope;n in i&&delete i[n],s&&n in H[s]&&(delete H[s][n],this.override&&delete Zt[n])}};function Cg(e,t,i){let n=Ne(Object.create(null),[i?H.get(i):{},H.get(t),e.defaults]);H.set(t,n),e.defaultRoutes&&Ag(t,e.defaultRoutes),e.descriptors&&H.describe(t,e.descriptors)}function Ag(e,t){Object.keys(t).forEach(i=>{let n=i.split("."),s=n.pop(),o=[e].concat(n).join("."),r=t[i].split("."),a=r.pop(),l=r.join(".");H.route(o,s,l,a)})}function Og(e){return"id"in e&&"defaults"in e}var No=class{constructor(){this.controllers=new We(Si,"datasets",!0),this.elements=new We(jt,"elements"),this.plugins=new We(Object,"plugins"),this.scales=new We(Se,"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,i,n){[...i].forEach(s=>{let o=n||this._getRegistryForType(s);n||o.isForType(s)||o===this.plugins&&s.id?this._exec(t,o,s):E(s,r=>{let a=n||this._getRegistryForType(r);this._exec(t,a,r)})})}_exec(t,i,n){let s=cn(t);N(n["before"+s],[],n),i[t](n),N(n["after"+s],[],n)}_getRegistryForType(t){for(let i=0;i<this._typedRegistries.length;i++){let n=this._typedRegistries[i];if(n.isForType(t))return n}return this.plugins}_get(t,i,n){let s=i.get(t);if(s===void 0)throw new Error('"'+t+'" is not a registered '+n+".");return s}},Pt=new No,zo=class{constructor(){this._init=void 0}notify(t,i,n,s){if(i==="beforeInit"&&(this._init=this._createDescriptors(t,!0),this._notify(this._init,t,"install")),this._init===void 0)return;let o=s?this._descriptors(t).filter(s):this._descriptors(t),r=this._notify(o,t,i,n);return i==="afterDestroy"&&(this._notify(o,t,"stop"),this._notify(this._init,t,"uninstall"),this._init=void 0),r}_notify(t,i,n,s){s=s||{};for(let o of t){let r=o.plugin,a=r[n],l=[i,s,o.options];if(N(a,l,r)===!1&&s.cancelable)return!1}return!0}invalidate(){D(this._cache)||(this._oldCache=this._cache,this._cache=void 0)}_descriptors(t){if(this._cache)return this._cache;let i=this._cache=this._createDescriptors(t);return this._notifyStateChanges(t),i}_createDescriptors(t,i){let n=t&&t.config,s=O(n.options&&n.options.plugins,{}),o=Lg(n);return s===!1&&!i?[]:Dg(t,o,s,i)}_notifyStateChanges(t){let i=this._oldCache||[],n=this._cache,s=(o,r)=>o.filter(a=>!r.some(l=>a.plugin.id===l.plugin.id));this._notify(s(i,n),t,"stop"),this._notify(s(n,i),t,"start")}};function Lg(e){let t={},i=[],n=Object.keys(Pt.plugins.items);for(let o=0;o<n.length;o++)i.push(Pt.getPlugin(n[o]));let s=e.plugins||[];for(let o=0;o<s.length;o++){let r=s[o];i.indexOf(r)===-1&&(i.push(r),t[r.id]=!0)}return{plugins:i,localIds:t}}function Tg(e,t){return!t&&e===!1?null:e===!0?{}:e}function Dg(e,{plugins:t,localIds:i},n,s){let o=[],r=e.getContext();for(let a of t){let l=a.id,c=Tg(n[l],s);c!==null&&o.push({plugin:a,options:Rg(e.config,{plugin:a,local:i[l]},c,r)})}return o}function Rg(e,{plugin:t,local:i},n,s){let o=e.pluginScopeKeys(t),r=e.getOptionScopes(n,o);return i&&t.defaults&&r.push(t.defaults),e.createResolver(r,s,[""],{scriptable:!1,indexable:!1,allKeys:!0})}function Bo(e,t){let i=H.datasets[e]||{};return((t.datasets||{})[e]||{}).indexAxis||t.indexAxis||i.indexAxis||"x"}function Eg(e,t){let i=e;return e==="_index_"?i=t:e==="_value_"&&(i=t==="x"?"y":"x"),i}function Ig(e,t){return e===t?"_index_":"_value_"}function Zl(e){if(e==="x"||e==="y"||e==="r")return e}function Fg(e){if(e==="top"||e==="bottom")return"x";if(e==="left"||e==="right")return"y"}function $o(e,...t){if(Zl(e))return e;for(let i of t){let n=i.axis||Fg(i.position)||e.length>1&&Zl(e[0].toLowerCase());if(n)return n}throw new Error(`Cannot determine type of '${e}' axis. Please provide 'axis' or 'position' option.`)}function Ql(e,t,i){if(i[t+"AxisID"]===e)return{axis:t}}function Ng(e,t){if(t.data&&t.data.datasets){let i=t.data.datasets.filter(n=>n.xAxisID===e||n.yAxisID===e);if(i.length)return Ql(e,"x",i[0])||Ql(e,"y",i[0])}return{}}function zg(e,t){let i=Zt[e.type]||{scales:{}},n=t.scales||{},s=Bo(e.type,t),o=Object.create(null);return Object.keys(n).forEach(r=>{let a=n[r];if(!T(a))return console.error(`Invalid scale configuration for scale: ${r}`);if(a._proxy)return console.warn(`Ignoring resolver passed as options for scale: ${r}`);let l=$o(r,a,Ng(r,e),H.scales[a.type]),c=Ig(l,s),d=i.scales||{};o[r]=Be(Object.create(null),[{axis:l},a,d[l],d[c]])}),e.data.datasets.forEach(r=>{let a=r.type||e.type,l=r.indexAxis||Bo(a,t),d=(Zt[a]||{}).scales||{};Object.keys(d).forEach(h=>{let u=Eg(h,l),f=r[u+"AxisID"]||u;o[f]=o[f]||Object.create(null),Be(o[f],[{axis:u},n[f],d[h]])})}),Object.keys(o).forEach(r=>{let a=o[r];Be(a,[H.scales[a.type],H.scale])}),o}function zc(e){let t=e.options||(e.options={});t.plugins=O(t.plugins,{}),t.scales=zg(e,t)}function Bc(e){return e=e||{},e.datasets=e.datasets||[],e.labels=e.labels||[],e}function Bg(e){return e=e||{},e.data=Bc(e.data),zc(e),e}var tc=new Map,$c=new Set;function vn(e,t){let i=tc.get(e);return i||(i=t(),tc.set(e,i),$c.add(i)),i}var _i=(e,t,i)=>{let n=ye(t,i);n!==void 0&&e.add(n)},jo=class{constructor(t){this._config=Bg(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=Bc(t)}get options(){return this._config.options}set options(t){this._config.options=t}get plugins(){return this._config.plugins}update(){let t=this._config;this.clearCache(),zc(t)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(t){return vn(t,()=>[[`datasets.${t}`,""]])}datasetAnimationScopeKeys(t,i){return vn(`${t}.transition.${i}`,()=>[[`datasets.${t}.transitions.${i}`,`transitions.${i}`],[`datasets.${t}`,""]])}datasetElementScopeKeys(t,i){return vn(`${t}-${i}`,()=>[[`datasets.${t}.elements.${i}`,`datasets.${t}`,`elements.${i}`,""]])}pluginScopeKeys(t){let i=t.id,n=this.type;return vn(`${n}-plugin-${i}`,()=>[[`plugins.${i}`,...t.additionalOptionScopes||[]]])}_cachedScopes(t,i){let n=this._scopeCache,s=n.get(t);return(!s||i)&&(s=new Map,n.set(t,s)),s}getOptionScopes(t,i,n){let{options:s,type:o}=this,r=this._cachedScopes(t,n),a=r.get(i);if(a)return a;let l=new Set;i.forEach(d=>{t&&(l.add(t),d.forEach(h=>_i(l,t,h))),d.forEach(h=>_i(l,s,h)),d.forEach(h=>_i(l,Zt[o]||{},h)),d.forEach(h=>_i(l,H,h)),d.forEach(h=>_i(l,fn,h))});let c=Array.from(l);return c.length===0&&c.push(Object.create(null)),$c.has(i)&&r.set(i,c),c}chartOptionScopes(){let{options:t,type:i}=this;return[t,Zt[i]||{},H.datasets[i]||{},{type:i},H,fn]}resolveNamedOptions(t,i,n,s=[""]){let o={$shared:!0},{resolver:r,subPrefixes:a}=ec(this._resolverCache,t,s),l=r;if(jg(r,i)){o.$shared=!1,n=Et(n)?n():n;let c=this.createResolver(t,n,a);l=be(r,n,c)}for(let c of i)o[c]=l[c];return o}createResolver(t,i,n=[""],s){let{resolver:o}=ec(this._resolverCache,t,n);return T(i)?be(o,i,void 0,s):o}};function ec(e,t,i){let n=e.get(t);n||(n=new Map,e.set(t,n));let s=i.join(),o=n.get(s);return o||(o={resolver:gn(t,i),subPrefixes:i.filter(a=>!a.toLowerCase().includes("hover"))},n.set(s,o)),o}var $g=e=>T(e)&&Object.getOwnPropertyNames(e).some(t=>Et(e[t]));function jg(e,t){let{isScriptable:i,isIndexable:n}=ho(e);for(let s of t){let o=i(s),r=n(s),a=(r||o)&&e[s];if(o&&(Et(a)||$g(a))||r&&B(a))return!0}return!1}var Vg="4.5.1",Hg=["top","bottom","left","right","chartArea"];function ic(e,t){return e==="top"||e==="bottom"||Hg.indexOf(e)===-1&&t==="x"}function nc(e,t){return function(i,n){return i[e]===n[e]?i[t]-n[t]:i[e]-n[e]}}function sc(e){let t=e.chart,i=t.options.animation;t.notifyPlugins("afterRender"),N(i&&i.onComplete,[e],t)}function Wg(e){let t=e.chart,i=t.options.animation;N(i&&i.onProgress,[e],t)}function jc(e){return mn()&&typeof e=="string"?e=document.getElementById(e):e&&e.length&&(e=e[0]),e&&e.canvas&&(e=e.canvas),e}var kn={},oc=e=>{let t=jc(e);return Object.values(kn).filter(i=>i.canvas===t).pop()};function Kg(e,t,i){let n=Object.keys(e);for(let s of n){let o=+s;if(o>=t){let r=e[s];delete e[s],(i>0||o>t)&&(e[o+i]=r)}}}function Ug(e,t,i,n){return!i||e.type==="mouseout"?null:n?t:e}var mt=class{static defaults=H;static instances=kn;static overrides=Zt;static registry=Pt;static version=Vg;static getChart=oc;static register(...t){Pt.add(...t),rc()}static unregister(...t){Pt.remove(...t),rc()}constructor(t,i){let n=this.config=new jo(i),s=jc(t),o=oc(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.");let r=n.createResolver(n.chartOptionScopes(),this.getContext());this.platform=new(n.platform||fg(s)),this.platform.updateConfig(n);let a=this.platform.acquireContext(s,r.aspectRatio),l=a&&a.canvas,c=l&&l.height,d=l&&l.width;if(this.id=el(),this.ctx=a,this.canvas=l,this.width=d,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 zo,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=fl(h=>this.update(h),r.resizeDelay||0),this._dataChanges=[],kn[this.id]=this,!a||!l){console.error("Failed to create chart: can't acquire context from the given item");return}Bt.listen(this,"complete",sc),Bt.listen(this,"progress",Wg),this._initialize(),this.attached&&this.update()}get aspectRatio(){let{options:{aspectRatio:t,maintainAspectRatio:i},width:n,height:s,_aspectRatio:o}=this;return D(t)?i&&o?o:s?n/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 Pt}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():po(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return ro(this.canvas,this.ctx),this}stop(){return Bt.stop(this),this}resize(t,i){Bt.running(this)?this._resizeBeforeDraw={width:t,height:i}:this._resize(t,i)}_resize(t,i){let n=this.options,s=this.canvas,o=n.maintainAspectRatio&&this.aspectRatio,r=this.platform.getMaximumSize(s,t,i,o),a=n.devicePixelRatio||this.platform.getDevicePixelRatio(),l=this.width?"resize":"attach";this.width=r.width,this.height=r.height,this._aspectRatio=this.aspectRatio,po(this,a,!0)&&(this.notifyPlugins("resize",{size:r}),N(n.onResize,[this,r],this),this.attached&&this._doResize(l)&&this.render())}ensureScalesHaveIDs(){let i=this.options.scales||{};E(i,(n,s)=>{n.id=s})}buildOrUpdateScales(){let t=this.options,i=t.scales,n=this.scales,s=Object.keys(n).reduce((r,a)=>(r[a]=!1,r),{}),o=[];i&&(o=o.concat(Object.keys(i).map(r=>{let a=i[r],l=$o(r,a),c=l==="r",d=l==="x";return{options:a,dposition:c?"chartArea":d?"bottom":"left",dtype:c?"radialLinear":d?"category":"linear"}}))),E(o,r=>{let a=r.options,l=a.id,c=$o(l,a),d=O(a.type,r.dtype);(a.position===void 0||ic(a.position,c)!==ic(r.dposition))&&(a.position=r.dposition),s[l]=!0;let h=null;if(l in n&&n[l].type===d)h=n[l];else{let u=Pt.getScale(d);h=new u({id:l,type:d,ctx:this.ctx,chart:this}),n[h.id]=h}h.init(a,t)}),E(s,(r,a)=>{r||delete n[a]}),E(n,r=>{ie.configure(this,r,r.options),ie.addBox(this,r)})}_updateMetasets(){let t=this._metasets,i=this.data.datasets.length,n=t.length;if(t.sort((s,o)=>s.index-o.index),n>i){for(let s=i;s<n;++s)this._destroyDatasetMeta(s);t.splice(i,n-i)}this._sortedMetasets=t.slice(0).sort(nc("order","index"))}_removeUnreferencedMetasets(){let{_metasets:t,data:{datasets:i}}=this;t.length>i.length&&delete this._stacks,t.forEach((n,s)=>{i.filter(o=>o===n._dataset).length===0&&this._destroyDatasetMeta(s)})}buildOrUpdateControllers(){let t=[],i=this.data.datasets,n,s;for(this._removeUnreferencedMetasets(),n=0,s=i.length;n<s;n++){let o=i[n],r=this.getDatasetMeta(n),a=o.type||this.config.type;if(r.type&&r.type!==a&&(this._destroyDatasetMeta(n),r=this.getDatasetMeta(n)),r.type=a,r.indexAxis=o.indexAxis||Bo(a,this.options),r.order=o.order||0,r.index=n,r.label=""+o.label,r.visible=this.isDatasetVisible(n),r.controller)r.controller.updateIndex(n),r.controller.linkScales();else{let l=Pt.getController(a),{datasetElementType:c,dataElementType:d}=H.datasets[a];Object.assign(l,{dataElementType:Pt.getElement(d),datasetElementType:c&&Pt.getElement(c)}),r.controller=new l(this,n),t.push(r.controller)}}return this._updateMetasets(),t}_resetElements(){E(this.data.datasets,(t,i)=>{this.getDatasetMeta(i).controller.reset()},this)}reset(){this._resetElements(),this.notifyPlugins("reset")}update(t){let i=this.config;i.update();let n=this._options=i.createResolver(i.chartOptionScopes(),this.getContext()),s=this._animationsDisabled=!n.animation;if(this._updateScales(),this._checkEventBindings(),this._updateHiddenIndices(),this._plugins.invalidate(),this.notifyPlugins("beforeUpdate",{mode:t,cancelable:!0})===!1)return;let o=this.buildOrUpdateControllers();this.notifyPlugins("beforeElementsUpdate");let r=0;for(let c=0,d=this.data.datasets.length;c<d;c++){let{controller:h}=this.getDatasetMeta(c),u=!s&&o.indexOf(h)===-1;h.buildOrUpdateElements(u),r=Math.max(+h.getMaxOverflow(),r)}r=this._minPadding=n.layout.autoPadding?r:0,this._updateLayout(r),s||E(o,c=>{c.reset()}),this._updateDatasets(t),this.notifyPlugins("afterUpdate",{mode:t}),this._layers.sort(nc("z","_idx"));let{_active:a,_lastEvent:l}=this;l?this._eventHandler(l,!0):a.length&&this._updateHoverStyles(a,a,!0),this.render()}_updateScales(){E(this.scales,t=>{ie.removeBox(this,t)}),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){let t=this.options,i=new Set(Object.keys(this._listeners)),n=new Set(t.events);(!Ys(i,n)||!!this._responsiveListeners!==t.responsive)&&(this.unbindEvents(),this.bindEvents())}_updateHiddenIndices(){let{_hiddenIndices:t}=this,i=this._getUniformDataChanges()||[];for(let{method:n,start:s,count:o}of i){let r=n==="_removeElements"?-o:o;Kg(t,s,r)}}_getUniformDataChanges(){let t=this._dataChanges;if(!t||!t.length)return;this._dataChanges=[];let i=this.data.datasets.length,n=o=>new Set(t.filter(r=>r[0]===o).map((r,a)=>a+","+r.splice(1).join(","))),s=n(0);for(let o=1;o<i;o++)if(!Ys(s,n(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;ie.update(this,this.width,this.height,t);let i=this.chartArea,n=i.width<=0||i.height<=0;this._layers=[],E(this.boxes,s=>{n&&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 i=0,n=this.data.datasets.length;i<n;++i)this.getDatasetMeta(i).controller.configure();for(let i=0,n=this.data.datasets.length;i<n;++i)this._updateDataset(i,Et(t)?t({datasetIndex:i}):t);this.notifyPlugins("afterDatasetsUpdate",{mode:t})}}_updateDataset(t,i){let n=this.getDatasetMeta(t),s={meta:n,index:t,mode:i,cancelable:!0};this.notifyPlugins("beforeDatasetUpdate",s)!==!1&&(n.controller._update(i),s.cancelable=!1,this.notifyPlugins("afterDatasetUpdate",s))}render(){this.notifyPlugins("beforeRender",{cancelable:!0})!==!1&&(Bt.has(this)?this.attached&&!Bt.running(this)&&Bt.start(this):(this.draw(),sc({chart:this})))}draw(){let t;if(this._resizeBeforeDraw){let{width:n,height:s}=this._resizeBeforeDraw;this._resizeBeforeDraw=null,this._resize(n,s)}if(this.clear(),this.width<=0||this.height<=0||this.notifyPlugins("beforeDraw",{cancelable:!0})===!1)return;let i=this._layers;for(t=0;t<i.length&&i[t].z<=0;++t)i[t].draw(this.chartArea);for(this._drawDatasets();t<i.length;++t)i[t].draw(this.chartArea);this.notifyPlugins("afterDraw")}_getSortedDatasetMetas(t){let i=this._sortedMetasets,n=[],s,o;for(s=0,o=i.length;s<o;++s){let r=i[s];(!t||r.visible)&&n.push(r)}return n}getSortedVisibleDatasetMetas(){return this._getSortedDatasetMetas(!0)}_drawDatasets(){if(this.notifyPlugins("beforeDatasetsDraw",{cancelable:!0})===!1)return;let t=this.getSortedVisibleDatasetMetas();for(let i=t.length-1;i>=0;--i)this._drawDataset(t[i]);this.notifyPlugins("afterDatasetsDraw")}_drawDataset(t){let i=this.ctx,n={meta:t,index:t.index,cancelable:!0},s=_o(this,t);this.notifyPlugins("beforeDatasetDraw",n)!==!1&&(s&&fi(i,s),t.controller.draw(),s&&pi(i),n.cancelable=!1,this.notifyPlugins("afterDatasetDraw",n))}isPointInArea(t){return St(t,this.chartArea,this._minPadding)}getElementsAtEventForMode(t,i,n,s){let o=Yp.modes[i];return typeof o=="function"?o(this,t,n,s):[]}getDatasetMeta(t){let i=this.data.datasets[t],n=this._metasets,s=n.filter(o=>o&&o._dataset===i).pop();return s||(s={type:null,data:[],dataset:null,controller:null,hidden:null,xAxisID:null,yAxisID:null,order:i&&i.order||0,index:t,_dataset:i,_parsed:[],_sorted:!1},n.push(s)),s}getContext(){return this.$context||(this.$context=zt(null,{chart:this,type:"chart"}))}getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(t){let i=this.data.datasets[t];if(!i)return!1;let n=this.getDatasetMeta(t);return typeof n.hidden=="boolean"?!n.hidden:!i.hidden}setDatasetVisibility(t,i){let n=this.getDatasetMeta(t);n.hidden=!i}toggleDataVisibility(t){this._hiddenIndices[t]=!this._hiddenIndices[t]}getDataVisibility(t){return!this._hiddenIndices[t]}_updateVisibility(t,i,n){let s=n?"show":"hide",o=this.getDatasetMeta(t),r=o.controller._resolveAnimations(void 0,s);$e(i)?(o.data[i].hidden=!n,this.update()):(this.setDatasetVisibility(t,n),r.update(o,{visible:n}),this.update(a=>a.datasetIndex===t?s:void 0))}hide(t,i){this._updateVisibility(t,i,!1)}show(t,i){this._updateVisibility(t,i,!0)}_destroyDatasetMeta(t){let i=this._metasets[t];i&&i.controller&&i.controller._destroy(),delete this._metasets[t]}_stop(){let t,i;for(this.stop(),Bt.remove(this),t=0,i=this.data.datasets.length;t<i;++t)this._destroyDatasetMeta(t)}destroy(){this.notifyPlugins("beforeDestroy");let{canvas:t,ctx:i}=this;this._stop(),this.config.clearCache(),t&&(this.unbindEvents(),ro(t,i),this.platform.releaseContext(i),this.canvas=null,this.ctx=null),delete kn[this.id],this.notifyPlugins("afterDestroy")}toBase64Image(...t){return this.canvas.toDataURL(...t)}bindEvents(){this.bindUserEvents(),this.options.responsive?this.bindResponsiveEvents():this.attached=!0}bindUserEvents(){let t=this._listeners,i=this.platform,n=(o,r)=>{i.addEventListener(this,o,r),t[o]=r},s=(o,r,a)=>{o.offsetX=r,o.offsetY=a,this._eventHandler(o)};E(this.options.events,o=>n(o,s))}bindResponsiveEvents(){this._responsiveListeners||(this._responsiveListeners={});let t=this._responsiveListeners,i=this.platform,n=(l,c)=>{i.addEventListener(this,l,c),t[l]=c},s=(l,c)=>{t[l]&&(i.removeEventListener(this,l,c),delete t[l])},o=(l,c)=>{this.canvas&&this.resize(l,c)},r,a=()=>{s("attach",a),this.attached=!0,this.resize(),n("resize",o),n("detach",r)};r=()=>{this.attached=!1,s("resize",o),this._stop(),this._resize(0,0),n("attach",a)},i.isAttached(this.canvas)?a():r()}unbindEvents(){E(this._listeners,(t,i)=>{this.platform.removeEventListener(this,i,t)}),this._listeners={},E(this._responsiveListeners,(t,i)=>{this.platform.removeEventListener(this,i,t)}),this._responsiveListeners=void 0}updateHoverStyle(t,i,n){let s=n?"set":"remove",o,r,a,l;for(i==="dataset"&&(o=this.getDatasetMeta(t[0].datasetIndex),o.controller["_"+s+"DatasetHoverStyle"]()),a=0,l=t.length;a<l;++a){r=t[a];let c=r&&this.getDatasetMeta(r.datasetIndex).controller;c&&c[s+"HoverStyle"](r.element,r.datasetIndex,r.index)}}getActiveElements(){return this._active||[]}setActiveElements(t){let i=this._active||[],n=t.map(({datasetIndex:o,index:r})=>{let a=this.getDatasetMeta(o);if(!a)throw new Error("No dataset found at index "+o);return{datasetIndex:o,element:a.data[r],index:r}});!hi(n,i)&&(this._active=n,this._lastEvent=null,this._updateHoverStyles(n,i))}notifyPlugins(t,i,n){return this._plugins.notify(this,t,i,n)}isPluginEnabled(t){return this._plugins._cache.filter(i=>i.plugin.id===t).length===1}_updateHoverStyles(t,i,n){let s=this.options.hover,o=(l,c)=>l.filter(d=>!c.some(h=>d.datasetIndex===h.datasetIndex&&d.index===h.index)),r=o(i,t),a=n?t:o(t,i);r.length&&this.updateHoverStyle(r,s.mode,!1),a.length&&s.mode&&this.updateHoverStyle(a,s.mode,!0)}_eventHandler(t,i){let n={event:t,replay:i,cancelable:!0,inChartArea:this.isPointInArea(t)},s=r=>(r.options.events||this.options.events).includes(t.native.type);if(this.notifyPlugins("beforeEvent",n,s)===!1)return;let o=this._handleEvent(t,i,n.inChartArea);return n.cancelable=!1,this.notifyPlugins("afterEvent",n,s),(o||n.changed)&&this.render(),this}_handleEvent(t,i,n){let{_active:s=[],options:o}=this,r=i,a=this._getActiveElements(t,s,n,r),l=sl(t),c=Ug(t,this._lastEvent,n,l);n&&(this._lastEvent=null,N(o.onHover,[t,a,this],this),l&&N(o.onClick,[t,a,this],this));let d=!hi(a,s);return(d||i)&&(this._active=a,this._updateHoverStyles(a,s,i)),this._lastEvent=c,d}_getActiveElements(t,i,n,s){if(t.type==="mouseout")return[];if(!n)return i;let o=this.options.hover;return this.getElementsAtEventForMode(t,o.mode,o,s)}};function rc(){return E(mt.instances,e=>e._plugins.invalidate())}function Vc(e,t,i=t){e.lineCap=O(i.borderCapStyle,t.borderCapStyle),e.setLineDash(O(i.borderDash,t.borderDash)),e.lineDashOffset=O(i.borderDashOffset,t.borderDashOffset),e.lineJoin=O(i.borderJoinStyle,t.borderJoinStyle),e.lineWidth=O(i.borderWidth,t.borderWidth),e.strokeStyle=O(i.borderColor,t.borderColor)}function qg(e,t,i){e.lineTo(i.x,i.y)}function Yg(e){return e.stepped?xl:e.tension||e.cubicInterpolationMode==="monotone"?_l:qg}function Hc(e,t,i={}){let n=e.length,{start:s=0,end:o=n-1}=i,{start:r,end:a}=t,l=Math.max(s,r),c=Math.min(o,a),d=s<r&&o<r||s>a&&o>a;return{count:n,start:l,loop:t.loop,ilen:c<l&&!d?n+c-l:c-l}}function Xg(e,t,i,n){let{points:s,options:o}=t,{count:r,start:a,loop:l,ilen:c}=Hc(s,i,n),d=Yg(o),{move:h=!0,reverse:u}=n||{},f,g,p;for(f=0;f<=c;++f)g=s[(a+(u?c-f:f))%r],!g.skip&&(h?(e.moveTo(g.x,g.y),h=!1):d(e,p,g,u,o.stepped),p=g);return l&&(g=s[(a+(u?c:0))%r],d(e,p,g,u,o.stepped)),!!l}function Jg(e,t,i,n){let s=t.points,{count:o,start:r,ilen:a}=Hc(s,i,n),{move:l=!0,reverse:c}=n||{},d=0,h=0,u,f,g,p,m,b,y=_=>(r+(c?a-_:_))%o,v=()=>{p!==m&&(e.lineTo(d,m),e.lineTo(d,p),e.lineTo(d,b))};for(l&&(f=s[y(0)],e.moveTo(f.x,f.y)),u=0;u<=a;++u){if(f=s[y(u)],f.skip)continue;let _=f.x,x=f.y,M=_|0;M===g?(x<p?p=x:x>m&&(m=x),d=(h*d+_)/++h):(v(),e.lineTo(_,x),g=M,h=0,p=m=x),b=x}v()}function Vo(e){let t=e.options,i=t.borderDash&&t.borderDash.length;return!e._decimated&&!e._loop&&!t.tension&&t.cubicInterpolationMode!=="monotone"&&!t.stepped&&!i?Jg:Xg}function Gg(e){return e.stepped?Ol:e.tension||e.cubicInterpolationMode==="monotone"?Ll:Xt}function Zg(e,t,i,n){let s=t._path;s||(s=t._path=new Path2D,t.path(s,i,n)&&s.closePath()),Vc(e,t.options),e.stroke(s)}function Qg(e,t,i,n){let{segments:s,options:o}=t,r=Vo(t);for(let a of s)Vc(e,o,a.style),e.beginPath(),r(e,t,a,{start:i,end:i+n-1})&&e.closePath(),e.stroke()}var tm=typeof Path2D=="function";function em(e,t,i,n){tm&&!t.options.segment?Zg(e,t,i,n):Qg(e,t,i,n)}var Me=class extends jt{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,i){let n=this.options;if((n.tension||n.cubicInterpolationMode==="monotone")&&!n.stepped&&!this._pointsUpdated){let s=n.spanGaps?this._loop:this._fullLoop;Pl(this._points,n,t,s,i),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=Dl(this,this.options.segment))}first(){let t=this.segments,i=this.points;return t.length&&i[t[0].start]}last(){let t=this.segments,i=this.points,n=t.length;return n&&i[t[n-1].end]}interpolate(t,i){let n=this.options,s=t[i],o=this.points,r=xo(this,{property:i,start:s,end:s});if(!r.length)return;let a=[],l=Gg(n),c,d;for(c=0,d=r.length;c<d;++c){let{start:h,end:u}=r[c],f=o[h],g=o[u];if(f===g){a.push(f);continue}let p=Math.abs((s-f[i])/(g[i]-f[i])),m=l(f,g,p,n.stepped);m[i]=t[i],a.push(m)}return a.length===1?a[0]:a}pathSegment(t,i,n){return Vo(this)(t,this,i,n)}path(t,i,n){let s=this.segments,o=Vo(this),r=this._loop;i=i||0,n=n||this.points.length-i;for(let a of s)r&=o(t,this,a,{start:i,end:i+n-1});return!!r}draw(t,i,n,s){let o=this.options||{};(this.points||[]).length&&o.borderWidth&&(t.save(),em(t,this,n,s),t.restore()),this.animated&&(this._pointsUpdated=!1,this._path=void 0)}};function ac(e,t,i,n){let s=e.options,{[i]:o}=e.getProps([i],n);return Math.abs(t-o)<s.radius+s.hitRadius}var Tn=class extends jt{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,i,n){let s=this.options,{x:o,y:r}=this.getProps(["x","y"],n);return Math.pow(t-o,2)+Math.pow(i-r,2)<Math.pow(s.hitRadius+s.radius,2)}inXRange(t,i){return ac(this,t,"x",i)}inYRange(t,i){return ac(this,t,"y",i)}getCenterPoint(t){let{x:i,y:n}=this.getProps(["x","y"],t);return{x:i,y:n}}size(t){t=t||this.options||{};let i=t.radius||0;i=Math.max(i,i&&t.hoverRadius||0);let n=i&&t.borderWidth||0;return(i+n)*2}draw(t,i){let n=this.options;this.skip||n.radius<.1||!St(this,i,this.size(n)/2)||(t.strokeStyle=n.borderColor,t.lineWidth=n.borderWidth,t.fillStyle=n.backgroundColor,pn(t,n,this.x,this.y))}getRange(){let t=this.options||{};return t.radius+t.hitRadius}};function Wc(e,t){let{x:i,y:n,base:s,width:o,height:r}=e.getProps(["x","y","base","width","height"],t),a,l,c,d,h;return e.horizontal?(h=r/2,a=Math.min(i,s),l=Math.max(i,s),c=n-h,d=n+h):(h=o/2,a=i-h,l=i+h,c=Math.min(n,s),d=Math.max(n,s)),{left:a,top:c,right:l,bottom:d}}function ne(e,t,i,n){return e?0:rt(t,i,n)}function im(e,t,i){let n=e.options.borderWidth,s=e.borderSkipped,o=co(n);return{t:ne(s.top,o.top,0,i),r:ne(s.right,o.right,0,t),b:ne(s.bottom,o.bottom,0,i),l:ne(s.left,o.left,0,t)}}function nm(e,t,i){let{enableBorderRadius:n}=e.getProps(["enableBorderRadius"]),s=e.options.borderRadius,o=te(s),r=Math.min(t,i),a=e.borderSkipped,l=n||T(s);return{topLeft:ne(!l||a.top||a.left,o.topLeft,0,r),topRight:ne(!l||a.top||a.right,o.topRight,0,r),bottomLeft:ne(!l||a.bottom||a.left,o.bottomLeft,0,r),bottomRight:ne(!l||a.bottom||a.right,o.bottomRight,0,r)}}function sm(e){let t=Wc(e),i=t.right-t.left,n=t.bottom-t.top,s=im(e,i/2,n/2),o=nm(e,i/2,n/2);return{outer:{x:t.left,y:t.top,w:i,h:n,radius:o},inner:{x:t.left+s.l,y:t.top+s.t,w:i-s.l-s.r,h:n-s.t-s.b,radius:{topLeft:Math.max(0,o.topLeft-Math.max(s.t,s.l)),topRight:Math.max(0,o.topRight-Math.max(s.t,s.r)),bottomLeft:Math.max(0,o.bottomLeft-Math.max(s.b,s.l)),bottomRight:Math.max(0,o.bottomRight-Math.max(s.b,s.r))}}}}function Ao(e,t,i,n){let s=t===null,o=i===null,a=e&&!(s&&o)&&Wc(e,n);return a&&(s||Nt(t,a.left,a.right))&&(o||Nt(i,a.top,a.bottom))}function om(e){return e.topLeft||e.topRight||e.bottomLeft||e.bottomRight}function rm(e,t){e.rect(t.x,t.y,t.w,t.h)}function Oo(e,t,i={}){let n=e.x!==i.x?-t:0,s=e.y!==i.y?-t:0,o=(e.x+e.w!==i.x+i.w?t:0)-n,r=(e.y+e.h!==i.y+i.h?t:0)-s;return{x:e.x+n,y:e.y+s,w:e.w+o,h:e.h+r,radius:e.radius}}var Dn=class extends jt{static id="bar";static defaults={borderSkipped:"start",borderWidth:0,borderRadius:0,inflateAmount:"auto",pointStyle:void 0};static defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};constructor(t){super(),this.options=void 0,this.horizontal=void 0,this.base=void 0,this.width=void 0,this.height=void 0,this.inflateAmount=void 0,t&&Object.assign(this,t)}draw(t){let{inflateAmount:i,options:{borderColor:n,backgroundColor:s}}=this,{inner:o,outer:r}=sm(this),a=om(r.radius)?He:rm;t.save(),(r.w!==o.w||r.h!==o.h)&&(t.beginPath(),a(t,Oo(r,i,o)),t.clip(),a(t,Oo(o,-i,r)),t.fillStyle=n,t.fill("evenodd")),t.beginPath(),a(t,Oo(o,i)),t.fillStyle=s,t.fill(),t.restore()}inRange(t,i,n){return Ao(this,t,i,n)}inXRange(t,i){return Ao(this,t,null,i)}inYRange(t,i){return Ao(this,null,t,i)}getCenterPoint(t){let{x:i,y:n,base:s,horizontal:o}=this.getProps(["x","y","base","horizontal"],t);return{x:o?(i+s)/2:i,y:o?n:(n+s)/2}}getRange(t){return t==="x"?this.width/2:this.height/2}};function am(e,t,i){let n=e.segments,s=e.points,o=t.points,r=[];for(let a of n){let{start:l,end:c}=a;c=Bn(l,c,s);let d=Ho(i,s[l],s[c],a.loop);if(!t.segments){r.push({source:a,target:d,start:s[l],end:s[c]});continue}let h=xo(t,d);for(let u of h){let f=Ho(i,o[u.start],o[u.end],u.loop),g=yo(a,s,f);for(let p of g)r.push({source:p,target:u,start:{[i]:lc(d,f,"start",Math.max)},end:{[i]:lc(d,f,"end",Math.min)}})}}return r}function Ho(e,t,i,n){if(n)return;let s=t[e],o=i[e];return e==="angle"&&(s=nt(s),o=nt(o)),{property:e,start:s,end:o}}function lm(e,t){let{x:i=null,y:n=null}=e||{},s=t.points,o=[];return t.segments.forEach(({start:r,end:a})=>{a=Bn(r,a,s);let l=s[r],c=s[a];n!==null?(o.push({x:l.x,y:n}),o.push({x:c.x,y:n})):i!==null&&(o.push({x:i,y:l.y}),o.push({x:i,y:c.y}))}),o}function Bn(e,t,i){for(;t>e;t--){let n=i[t];if(!isNaN(n.x)&&!isNaN(n.y))break}return t}function lc(e,t,i,n){return e&&t?n(e[i],t[i]):e?e[i]:t?t[i]:0}function Kc(e,t){let i=[],n=!1;return B(e)?(n=!0,i=e):i=lm(e,t),i.length?new Me({points:i,options:{tension:0},_loop:n,_fullLoop:n}):null}function cc(e){return e&&e.fill!==!1}function cm(e,t,i){let s=e[t].fill,o=[t],r;if(!i)return s;for(;s!==!1&&o.indexOf(s)===-1;){if(!V(s))return s;if(r=e[s],!r)return!1;if(r.visible)return s;o.push(s),s=r.fill}return!1}function dm(e,t,i){let n=pm(e);if(T(n))return isNaN(n.value)?!1:n;let s=parseFloat(n);return V(s)&&Math.floor(s)===s?hm(n[0],t,s,i):["origin","start","end","stack","shape"].indexOf(n)>=0&&n}function hm(e,t,i,n){return(e==="-"||e==="+")&&(i=t+i),i===t||i<0||i>=n?!1:i}function um(e,t){let i=null;return e==="start"?i=t.bottom:e==="end"?i=t.top:T(e)?i=t.getPixelForValue(e.value):t.getBasePixel&&(i=t.getBasePixel()),i}function fm(e,t,i){let n;return e==="start"?n=i:e==="end"?n=t.options.reverse?t.min:t.max:T(e)?n=e.value:n=t.getBaseValue(),n}function pm(e){let t=e.options,i=t.fill,n=O(i&&i.target,i);return n===void 0&&(n=!!t.backgroundColor),n===!1||n===null?!1:n===!0?"origin":n}function gm(e){let{scale:t,index:i,line:n}=e,s=[],o=n.segments,r=n.points,a=mm(t,i);a.push(Kc({x:null,y:t.bottom},n));for(let l=0;l<o.length;l++){let c=o[l];for(let d=c.start;d<=c.end;d++)bm(s,r[d],a)}return new Me({points:s,options:{}})}function mm(e,t){let i=[],n=e.getMatchingVisibleMetas("line");for(let s=0;s<n.length;s++){let o=n[s];if(o.index===t)break;o.hidden||i.unshift(o.dataset)}return i}function bm(e,t,i){let n=[];for(let s=0;s<i.length;s++){let o=i[s],{first:r,last:a,point:l}=ym(o,t,"x");if(!(!l||r&&a)){if(r)n.unshift(l);else if(e.push(l),!a)break}}e.push(...n)}function ym(e,t,i){let n=e.interpolate(t,i);if(!n)return{};let s=n[i],o=e.segments,r=e.points,a=!1,l=!1;for(let c=0;c<o.length;c++){let d=o[c],h=r[d.start][i],u=r[d.end][i];if(Nt(s,h,u)){a=s===h,l=s===u;break}}return{first:a,last:l,point:n}}var Rn=class{constructor(t){this.x=t.x,this.y=t.y,this.radius=t.radius}pathSegment(t,i,n){let{x:s,y:o,radius:r}=this;return i=i||{start:0,end:ot},t.arc(s,o,r,i.end,i.start,!0),!n.bounds}interpolate(t){let{x:i,y:n,radius:s}=this,o=t.angle;return{x:i+Math.cos(o)*s,y:n+Math.sin(o)*s,angle:o}}};function xm(e){let{chart:t,fill:i,line:n}=e;if(V(i))return _m(t,i);if(i==="stack")return gm(e);if(i==="shape")return!0;let s=vm(e);return s instanceof Rn?s:Kc(s,n)}function _m(e,t){let i=e.getDatasetMeta(t);return i&&e.isDatasetVisible(t)?i.dataset:null}function vm(e){return(e.scale||{}).getPointPositionForValue?Sm(e):wm(e)}function wm(e){let{scale:t={},fill:i}=e,n=um(i,t);if(V(n)){let s=t.isHorizontal();return{x:s?n:null,y:s?null:n}}return null}function Sm(e){let{scale:t,fill:i}=e,n=t.options,s=t.getLabels().length,o=n.reverse?t.max:t.min,r=fm(i,t,o),a=[];if(n.grid.circular){let l=t.getPointPositionForValue(0,o);return new Rn({x:l.x,y:l.y,radius:t.getDistanceFromCenterForValue(r)})}for(let l=0;l<s;++l)a.push(t.getPointPositionForValue(l,r));return a}function Lo(e,t,i){let n=xm(t),{chart:s,index:o,line:r,scale:a,axis:l}=t,c=r.options,d=c.fill,h=c.backgroundColor,{above:u=h,below:f=h}=d||{},g=s.getDatasetMeta(o),p=_o(s,g);n&&r.points.length&&(fi(e,i),Mm(e,{line:r,target:n,above:u,below:f,area:i,scale:a,axis:l,clip:p}),pi(e))}function Mm(e,t){let{line:i,target:n,above:s,below:o,area:r,scale:a,clip:l}=t,c=i._loop?"angle":t.axis;e.save();let d=o;o!==s&&(c==="x"?(dc(e,n,r.top),To(e,{line:i,target:n,color:s,scale:a,property:c,clip:l}),e.restore(),e.save(),dc(e,n,r.bottom)):c==="y"&&(hc(e,n,r.left),To(e,{line:i,target:n,color:o,scale:a,property:c,clip:l}),e.restore(),e.save(),hc(e,n,r.right),d=s)),To(e,{line:i,target:n,color:d,scale:a,property:c,clip:l}),e.restore()}function dc(e,t,i){let{segments:n,points:s}=t,o=!0,r=!1;e.beginPath();for(let a of n){let{start:l,end:c}=a,d=s[l],h=s[Bn(l,c,s)];o?(e.moveTo(d.x,d.y),o=!1):(e.lineTo(d.x,i),e.lineTo(d.x,d.y)),r=!!t.pathSegment(e,a,{move:r}),r?e.closePath():e.lineTo(h.x,i)}e.lineTo(t.first().x,i),e.closePath(),e.clip()}function hc(e,t,i){let{segments:n,points:s}=t,o=!0,r=!1;e.beginPath();for(let a of n){let{start:l,end:c}=a,d=s[l],h=s[Bn(l,c,s)];o?(e.moveTo(d.x,d.y),o=!1):(e.lineTo(i,d.y),e.lineTo(d.x,d.y)),r=!!t.pathSegment(e,a,{move:r}),r?e.closePath():e.lineTo(i,h.y)}e.lineTo(i,t.first().y),e.closePath(),e.clip()}function To(e,t){let{line:i,target:n,property:s,color:o,scale:r,clip:a}=t,l=am(i,n,s);for(let{source:c,target:d,start:h,end:u}of l){let{style:{backgroundColor:f=o}={}}=c,g=n!==!0;e.save(),e.fillStyle=f,km(e,r,a,g&&Ho(s,h,u)),e.beginPath();let p=!!i.pathSegment(e,c),m;if(g){p?e.closePath():uc(e,n,u,s);let b=!!n.pathSegment(e,d,{move:p,reverse:!0});m=p&&b,m||uc(e,n,h,s)}e.closePath(),e.fill(m?"evenodd":"nonzero"),e.restore()}}function km(e,t,i,n){let s=t.chart.chartArea,{property:o,start:r,end:a}=n||{};if(o==="x"||o==="y"){let l,c,d,h;o==="x"?(l=r,c=s.top,d=a,h=s.bottom):(l=s.left,c=r,d=s.right,h=a),e.beginPath(),i&&(l=Math.max(l,i.left),d=Math.min(d,i.right),c=Math.max(c,i.top),h=Math.min(h,i.bottom)),e.rect(l,c,d-l,h-c),e.clip()}}function uc(e,t,i,n){let s=t.interpolate(i,n);s&&e.lineTo(s.x,s.y)}var Uc={id:"filler",afterDatasetsUpdate(e,t,i){let n=(e.data.datasets||[]).length,s=[],o,r,a,l;for(r=0;r<n;++r)o=e.getDatasetMeta(r),a=o.dataset,l=null,a&&a.options&&a instanceof Me&&(l={visible:e.isDatasetVisible(r),index:r,fill:dm(a,r,n),chart:e,axis:o.controller.options.indexAxis,scale:o.vScale,line:a}),o.$filler=l,s.push(l);for(r=0;r<n;++r)l=s[r],!(!l||l.fill===!1)&&(l.fill=cm(s,r,i.propagate))},beforeDraw(e,t,i){let n=i.drawTime==="beforeDraw",s=e.getSortedVisibleDatasetMetas(),o=e.chartArea;for(let r=s.length-1;r>=0;--r){let a=s[r].$filler;a&&(a.line.updateControlPoints(o,a.axis),n&&a.fill&&Lo(e.ctx,a,o))}},beforeDatasetsDraw(e,t,i){if(i.drawTime!=="beforeDatasetsDraw")return;let n=e.getSortedVisibleDatasetMetas();for(let s=n.length-1;s>=0;--s){let o=n[s].$filler;cc(o)&&Lo(e.ctx,o,e.chartArea)}},beforeDatasetDraw(e,t,i){let n=t.meta.$filler;!cc(n)||i.drawTime!=="beforeDatasetDraw"||Lo(e.ctx,n,e.chartArea)},defaults:{propagate:!0,drawTime:"beforeDatasetDraw"}},fc=(e,t)=>{let{boxHeight:i=t,boxWidth:n=t}=e;return e.usePointStyle&&(i=Math.min(i,t),n=e.pointStyleWidth||Math.min(n,t)),{boxWidth:n,boxHeight:i,itemHeight:Math.max(t,i)}},Pm=(e,t)=>e!==null&&t!==null&&e.datasetIndex===t.datasetIndex&&e.index===t.index,En=class extends jt{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,i,n){this.maxWidth=t,this.maxHeight=i,this._margins=n,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(){let t=this.options.labels||{},i=N(t.generateLabels,[this.chart],this)||[];t.filter&&(i=i.filter(n=>t.filter(n,this.chart.data))),t.sort&&(i=i.sort((n,s)=>t.sort(n,s,this.chart.data))),this.options.reverse&&i.reverse(),this.legendItems=i}fit(){let{options:t,ctx:i}=this;if(!t.display){this.width=this.height=0;return}let n=t.labels,s=G(n.font),o=s.size,r=this._computeTitleHeight(),{boxWidth:a,itemHeight:l}=fc(n,o),c,d;i.font=s.string,this.isHorizontal()?(c=this.maxWidth,d=this._fitRows(r,o,a,l)+10):(d=this.maxHeight,c=this._fitCols(r,s,a,l)+10),this.width=Math.min(c,t.maxWidth||this.maxWidth),this.height=Math.min(d,t.maxHeight||this.maxHeight)}_fitRows(t,i,n,s){let{ctx:o,maxWidth:r,options:{labels:{padding:a}}}=this,l=this.legendHitBoxes=[],c=this.lineWidths=[0],d=s+a,h=t;o.textAlign="left",o.textBaseline="middle";let u=-1,f=-d;return this.legendItems.forEach((g,p)=>{let m=n+i/2+o.measureText(g.text).width;(p===0||c[c.length-1]+m+2*a>r)&&(h+=d,c[c.length-(p>0?0:1)]=0,f+=d,u++),l[p]={left:0,top:f,row:u,width:m,height:s},c[c.length-1]+=m+a}),h}_fitCols(t,i,n,s){let{ctx:o,maxHeight:r,options:{labels:{padding:a}}}=this,l=this.legendHitBoxes=[],c=this.columnSizes=[],d=r-t,h=a,u=0,f=0,g=0,p=0;return this.legendItems.forEach((m,b)=>{let{itemWidth:y,itemHeight:v}=Cm(n,i,o,m,s);b>0&&f+v+2*a>d&&(h+=u+a,c.push({width:u,height:f}),g+=u+a,p++,u=f=0),l[b]={left:g,top:f,col:p,width:y,height:v},u=Math.max(u,y),f+=v+a}),h+=u,c.push({width:u,height:f}),h}adjustHitBoxes(){if(!this.options.display)return;let t=this._computeTitleHeight(),{legendHitBoxes:i,options:{align:n,labels:{padding:s},rtl:o}}=this,r=_e(o,this.left,this.width);if(this.isHorizontal()){let a=0,l=lt(n,this.left+s,this.right-this.lineWidths[a]);for(let c of i)a!==c.row&&(a=c.row,l=lt(n,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=lt(n,this.top+t+s,this.bottom-this.columnSizes[a].height);for(let c of i)c.col!==a&&(a=c.col,l=lt(n,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){let t=this.ctx;fi(t,this),this._draw(),pi(t)}}_draw(){let{options:t,columnSizes:i,lineWidths:n,ctx:s}=this,{align:o,labels:r}=t,a=H.color,l=_e(t.rtl,this.left,this.width),c=G(r.font),{padding:d}=r,h=c.size,u=h/2,f;this.drawTitle(),s.textAlign=l.textAlign("left"),s.textBaseline="middle",s.lineWidth=.5,s.font=c.string;let{boxWidth:g,boxHeight:p,itemHeight:m}=fc(r,h),b=function(M,w,S){if(isNaN(g)||g<=0||isNaN(p)||p<0)return;s.save();let P=O(S.lineWidth,1);if(s.fillStyle=O(S.fillStyle,a),s.lineCap=O(S.lineCap,"butt"),s.lineDashOffset=O(S.lineDashOffset,0),s.lineJoin=O(S.lineJoin,"miter"),s.lineWidth=P,s.strokeStyle=O(S.strokeStyle,a),s.setLineDash(O(S.lineDash,[])),r.usePointStyle){let A={radius:p*Math.SQRT2/2,pointStyle:S.pointStyle,rotation:S.rotation,borderWidth:P},L=l.xPlus(M,g/2),R=w+u;ao(s,A,L,R,r.pointStyleWidth&&g)}else{let A=w+Math.max((h-p)/2,0),L=l.leftForLtr(M,g),R=te(S.borderRadius);s.beginPath(),Object.values(R).some(I=>I!==0)?He(s,{x:L,y:A,w:g,h:p,radius:R}):s.rect(L,A,g,p),s.fill(),P!==0&&s.stroke()}s.restore()},y=function(M,w,S){xe(s,S.text,M,w+m/2,c,{strikethrough:S.hidden,textAlign:l.textAlign(S.textAlign)})},v=this.isHorizontal(),_=this._computeTitleHeight();v?f={x:lt(o,this.left+d,this.right-n[0]),y:this.top+d+_,line:0}:f={x:this.left+d,y:lt(o,this.top+_+d,this.bottom-i[0].height),line:0},mo(this.ctx,t.textDirection);let x=m+d;this.legendItems.forEach((M,w)=>{s.strokeStyle=M.fontColor,s.fillStyle=M.fontColor;let S=s.measureText(M.text).width,P=l.textAlign(M.textAlign||(M.textAlign=r.textAlign)),A=g+u+S,L=f.x,R=f.y;l.setWidth(this.width),v?w>0&&L+A+d>this.right&&(R=f.y+=x,f.line++,L=f.x=lt(o,this.left+d,this.right-n[f.line])):w>0&&R+x>this.bottom&&(L=f.x=L+i[f.line].width+d,f.line++,R=f.y=lt(o,this.top+_+d,this.bottom-i[f.line].height));let I=l.x(L);if(b(I,R,M),L=pl(P,L+g+u,v?L+A:this.right,t.rtl),y(l.x(L),R,M),v)f.x+=A+d;else if(typeof M.text!="string"){let W=c.lineHeight;f.y+=qc(M,W)+d}else f.y+=x}),bo(this.ctx,t.textDirection)}drawTitle(){let t=this.options,i=t.title,n=G(i.font),s=tt(i.padding);if(!i.display)return;let o=_e(t.rtl,this.left,this.width),r=this.ctx,a=i.position,l=n.size/2,c=s.top+l,d,h=this.left,u=this.width;if(this.isHorizontal())u=Math.max(...this.lineWidths),d=this.top+c,h=lt(t.align,h,this.right-u);else{let g=this.columnSizes.reduce((p,m)=>Math.max(p,m.height),0);d=c+lt(t.align,this.top,this.bottom-g-t.labels.padding-this._computeTitleHeight())}let f=lt(a,h,h+u);r.textAlign=o.textAlign(no(a)),r.textBaseline="middle",r.strokeStyle=i.color,r.fillStyle=i.color,r.font=n.string,xe(r,i.text,f,d,n)}_computeTitleHeight(){let t=this.options.title,i=G(t.font),n=tt(t.padding);return t.display?i.lineHeight+n.height:0}_getLegendItemAt(t,i){let n,s,o;if(Nt(t,this.left,this.right)&&Nt(i,this.top,this.bottom)){for(o=this.legendHitBoxes,n=0;n<o.length;++n)if(s=o[n],Nt(t,s.left,s.left+s.width)&&Nt(i,s.top,s.top+s.height))return this.legendItems[n]}return null}handleEvent(t){let i=this.options;if(!Lm(t.type,i))return;let n=this._getLegendItemAt(t.x,t.y);if(t.type==="mousemove"||t.type==="mouseout"){let s=this._hoveredItem,o=Pm(s,n);s&&!o&&N(i.onLeave,[t,s,this],this),this._hoveredItem=n,n&&!o&&N(i.onHover,[t,n,this],this)}else n&&N(i.onClick,[t,n,this],this)}};function Cm(e,t,i,n,s){let o=Am(n,e,t,i),r=Om(s,n,t.lineHeight);return{itemWidth:o,itemHeight:r}}function Am(e,t,i,n){let s=e.text;return s&&typeof s!="string"&&(s=s.reduce((o,r)=>o.length>r.length?o:r)),t+i.size/2+n.measureText(s).width}function Om(e,t,i){let n=e;return typeof t.text!="string"&&(n=qc(t,i)),n}function qc(e,t){let i=e.text?e.text.length:0;return t*i}function Lm(e,t){return!!((e==="mousemove"||e==="mouseout")&&(t.onHover||t.onLeave)||t.onClick&&(e==="click"||e==="mouseup"))}var Yc={id:"legend",_element:En,start(e,t,i){let n=e.legend=new En({ctx:e.ctx,options:i,chart:e});ie.configure(e,n,i),ie.addBox(e,n)},stop(e){ie.removeBox(e,e.legend),delete e.legend},beforeUpdate(e,t,i){let n=e.legend;ie.configure(e,n,i),n.options=i},afterUpdate(e){let 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,i){let n=t.datasetIndex,s=i.chart;s.isDatasetVisible(n)?(s.hide(n),t.hidden=!0):(s.show(n),t.hidden=!1)},onHover:null,onLeave:null,labels:{color:e=>e.chart.options.color,boxWidth:40,padding:10,generateLabels(e){let t=e.data.datasets,{labels:{usePointStyle:i,pointStyle:n,textAlign:s,color:o,useBorderRadius:r,borderRadius:a}}=e.legend.options;return e._getSortedDatasetMetas().map(l=>{let c=l.controller.getStyle(i?0:void 0),d=tt(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:(d.width+d.height)/4,strokeStyle:c.borderColor,pointStyle:n||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)}}};var wi={average(e){if(!e.length)return!1;let t,i,n=new Set,s=0,o=0;for(t=0,i=e.length;t<i;++t){let a=e[t].element;if(a&&a.hasValue()){let l=a.tooltipPosition();n.add(l.x),s+=l.y,++o}}return o===0||n.size===0?!1:{x:[...n].reduce((a,l)=>a+l)/n.size,y:s/o}},nearest(e,t){if(!e.length)return!1;let i=t.x,n=t.y,s=Number.POSITIVE_INFINITY,o,r,a;for(o=0,r=e.length;o<r;++o){let l=e[o].element;if(l&&l.hasValue()){let c=l.getCenterPoint(),d=an(t,c);d<s&&(s=d,a=l)}}if(a){let l=a.tooltipPosition();i=l.x,n=l.y}return{x:i,y:n}}};function kt(e,t){return t&&(B(t)?Array.prototype.push.apply(e,t):e.push(t)),e}function $t(e){return(typeof e=="string"||e instanceof String)&&e.indexOf(`
10
- `)>-1?e.split(`
11
- `):e}function Tm(e,t){let{element:i,datasetIndex:n,index:s}=t,o=e.getDatasetMeta(n).controller,{label:r,value:a}=o.getLabelAndValue(s);return{chart:e,label:r,parsed:o.getParsed(s),raw:e.data.datasets[n].data[s],formattedValue:a,dataset:o.getDataset(),dataIndex:s,datasetIndex:n,element:i}}function pc(e,t){let i=e.chart.ctx,{body:n,footer:s,title:o}=e,{boxWidth:r,boxHeight:a}=t,l=G(t.bodyFont),c=G(t.titleFont),d=G(t.footerFont),h=o.length,u=s.length,f=n.length,g=tt(t.padding),p=g.height,m=0,b=n.reduce((_,x)=>_+x.before.length+x.lines.length+x.after.length,0);if(b+=e.beforeBody.length+e.afterBody.length,h&&(p+=h*c.lineHeight+(h-1)*t.titleSpacing+t.titleMarginBottom),b){let _=t.displayColors?Math.max(a,l.lineHeight):l.lineHeight;p+=f*_+(b-f)*l.lineHeight+(b-1)*t.bodySpacing}u&&(p+=t.footerMarginTop+u*d.lineHeight+(u-1)*t.footerSpacing);let y=0,v=function(_){m=Math.max(m,i.measureText(_).width+y)};return i.save(),i.font=c.string,E(e.title,v),i.font=l.string,E(e.beforeBody.concat(e.afterBody),v),y=t.displayColors?r+2+t.boxPadding:0,E(n,_=>{E(_.before,v),E(_.lines,v),E(_.after,v)}),y=0,i.font=d.string,E(e.footer,v),i.restore(),m+=g.width,{width:m,height:p}}function Dm(e,t){let{y:i,height:n}=t;return i<n/2?"top":i>e.height-n/2?"bottom":"center"}function Rm(e,t,i,n){let{x:s,width:o}=n,r=i.caretSize+i.caretPadding;if(e==="left"&&s+o+r>t.width||e==="right"&&s-o-r<0)return!0}function Em(e,t,i,n){let{x:s,width:o}=i,{width:r,chartArea:{left:a,right:l}}=e,c="center";return n==="center"?c=s<=(a+l)/2?"left":"right":s<=o/2?c="left":s>=r-o/2&&(c="right"),Rm(c,e,t,i)&&(c="center"),c}function gc(e,t,i){let n=i.yAlign||t.yAlign||Dm(e,i);return{xAlign:i.xAlign||t.xAlign||Em(e,t,i,n),yAlign:n}}function Im(e,t){let{x:i,width:n}=e;return t==="right"?i-=n:t==="center"&&(i-=n/2),i}function Fm(e,t,i){let{y:n,height:s}=e;return t==="top"?n+=i:t==="bottom"?n-=s+i:n-=s/2,n}function mc(e,t,i,n){let{caretSize:s,caretPadding:o,cornerRadius:r}=e,{xAlign:a,yAlign:l}=i,c=s+o,{topLeft:d,topRight:h,bottomLeft:u,bottomRight:f}=te(r),g=Im(t,a),p=Fm(t,l,c);return l==="center"?a==="left"?g+=c:a==="right"&&(g-=c):a==="left"?g-=Math.max(d,u)+s:a==="right"&&(g+=Math.max(h,f)+s),{x:rt(g,0,n.width-t.width),y:rt(p,0,n.height-t.height)}}function wn(e,t,i){let n=tt(i.padding);return t==="center"?e.x+e.width/2:t==="right"?e.x+e.width-n.right:e.x+n.left}function bc(e){return kt([],$t(e))}function Nm(e,t,i){return zt(e,{tooltip:t,tooltipItems:i,type:"tooltip"})}function yc(e,t){let i=t&&t.dataset&&t.dataset.tooltip&&t.dataset.tooltip.callbacks;return i?e.override(i):e}var Xc={beforeTitle:Mt,title(e){if(e.length>0){let t=e[0],i=t.chart.data.labels,n=i?i.length:0;if(this&&this.options&&this.options.mode==="dataset")return t.dataset.label||"";if(t.label)return t.label;if(n>0&&t.dataIndex<n)return i[t.dataIndex]}return""},afterTitle:Mt,beforeBody:Mt,beforeLabel:Mt,label(e){if(this&&this.options&&this.options.mode==="dataset")return e.label+": "+e.formattedValue||e.formattedValue;let t=e.dataset.label||"";t&&(t+=": ");let i=e.formattedValue;return D(i)||(t+=i),t},labelColor(e){let i=e.chart.getDatasetMeta(e.datasetIndex).controller.getStyle(e.dataIndex);return{borderColor:i.borderColor,backgroundColor:i.backgroundColor,borderWidth:i.borderWidth,borderDash:i.borderDash,borderDashOffset:i.borderDashOffset,borderRadius:0}},labelTextColor(){return this.options.bodyColor},labelPointStyle(e){let i=e.chart.getDatasetMeta(e.datasetIndex).controller.getStyle(e.dataIndex);return{pointStyle:i.pointStyle,rotation:i.rotation}},afterLabel:Mt,afterBody:Mt,beforeFooter:Mt,footer:Mt,afterFooter:Mt};function ct(e,t,i,n){let s=e[t].call(i,n);return typeof s>"u"?Xc[t].call(i,n):s}var In=class extends jt{static positioners=wi;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(){let t=this._cachedAnimations;if(t)return t;let i=this.chart,n=this.options.setContext(this.getContext()),s=n.enabled&&i.options.animation&&n.animations,o=new Pn(this.chart,s);return s._cacheable&&(this._cachedAnimations=Object.freeze(o)),o}getContext(){return this.$context||(this.$context=Nm(this.chart.getContext(),this,this._tooltipItems))}getTitle(t,i){let{callbacks:n}=i,s=ct(n,"beforeTitle",this,t),o=ct(n,"title",this,t),r=ct(n,"afterTitle",this,t),a=[];return a=kt(a,$t(s)),a=kt(a,$t(o)),a=kt(a,$t(r)),a}getBeforeBody(t,i){return bc(ct(i.callbacks,"beforeBody",this,t))}getBody(t,i){let{callbacks:n}=i,s=[];return E(t,o=>{let r={before:[],lines:[],after:[]},a=yc(n,o);kt(r.before,$t(ct(a,"beforeLabel",this,o))),kt(r.lines,ct(a,"label",this,o)),kt(r.after,$t(ct(a,"afterLabel",this,o))),s.push(r)}),s}getAfterBody(t,i){return bc(ct(i.callbacks,"afterBody",this,t))}getFooter(t,i){let{callbacks:n}=i,s=ct(n,"beforeFooter",this,t),o=ct(n,"footer",this,t),r=ct(n,"afterFooter",this,t),a=[];return a=kt(a,$t(s)),a=kt(a,$t(o)),a=kt(a,$t(r)),a}_createItems(t){let i=this._active,n=this.chart.data,s=[],o=[],r=[],a=[],l,c;for(l=0,c=i.length;l<c;++l)a.push(Tm(this.chart,i[l]));return t.filter&&(a=a.filter((d,h,u)=>t.filter(d,h,u,n))),t.itemSort&&(a=a.sort((d,h)=>t.itemSort(d,h,n))),E(a,d=>{let h=yc(t.callbacks,d);s.push(ct(h,"labelColor",this,d)),o.push(ct(h,"labelPointStyle",this,d)),r.push(ct(h,"labelTextColor",this,d))}),this.labelColors=s,this.labelPointStyles=o,this.labelTextColors=r,this.dataPoints=a,a}update(t,i){let n=this.options.setContext(this.getContext()),s=this._active,o,r=[];if(!s.length)this.opacity!==0&&(o={opacity:0});else{let a=wi[n.position].call(this,s,this._eventPosition);r=this._createItems(n),this.title=this.getTitle(r,n),this.beforeBody=this.getBeforeBody(r,n),this.body=this.getBody(r,n),this.afterBody=this.getAfterBody(r,n),this.footer=this.getFooter(r,n);let l=this._size=pc(this,n),c=Object.assign({},a,l),d=gc(this.chart,n,c),h=mc(n,c,d,this.chart);this.xAlign=d.xAlign,this.yAlign=d.yAlign,o={opacity:1,x:h.x,y:h.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&&n.external&&n.external.call(this,{chart:this.chart,tooltip:this,replay:i})}drawCaret(t,i,n,s){let o=this.getCaretPosition(t,n,s);i.lineTo(o.x1,o.y1),i.lineTo(o.x2,o.y2),i.lineTo(o.x3,o.y3)}getCaretPosition(t,i,n){let{xAlign:s,yAlign:o}=this,{caretSize:r,cornerRadius:a}=n,{topLeft:l,topRight:c,bottomLeft:d,bottomRight:h}=te(a),{x:u,y:f}=t,{width:g,height:p}=i,m,b,y,v,_,x;return o==="center"?(_=f+p/2,s==="left"?(m=u,b=m-r,v=_+r,x=_-r):(m=u+g,b=m+r,v=_-r,x=_+r),y=m):(s==="left"?b=u+Math.max(l,d)+r:s==="right"?b=u+g-Math.max(c,h)-r:b=this.caretX,o==="top"?(v=f,_=v-r,m=b-r,y=b+r):(v=f+p,_=v+r,m=b+r,y=b-r),x=v),{x1:m,x2:b,x3:y,y1:v,y2:_,y3:x}}drawTitle(t,i,n){let s=this.title,o=s.length,r,a,l;if(o){let c=_e(n.rtl,this.x,this.width);for(t.x=wn(this,n.titleAlign,n),i.textAlign=c.textAlign(n.titleAlign),i.textBaseline="middle",r=G(n.titleFont),a=n.titleSpacing,i.fillStyle=n.titleColor,i.font=r.string,l=0;l<o;++l)i.fillText(s[l],c.x(t.x),t.y+r.lineHeight/2),t.y+=r.lineHeight+a,l+1===o&&(t.y+=n.titleMarginBottom-a)}}_drawColorBox(t,i,n,s,o){let r=this.labelColors[n],a=this.labelPointStyles[n],{boxHeight:l,boxWidth:c}=o,d=G(o.bodyFont),h=wn(this,"left",o),u=s.x(h),f=l<d.lineHeight?(d.lineHeight-l)/2:0,g=i.y+f;if(o.usePointStyle){let p={radius:Math.min(c,l)/2,pointStyle:a.pointStyle,rotation:a.rotation,borderWidth:1},m=s.leftForLtr(u,c)+c/2,b=g+l/2;t.strokeStyle=o.multiKeyBackground,t.fillStyle=o.multiKeyBackground,pn(t,p,m,b),t.strokeStyle=r.borderColor,t.fillStyle=r.backgroundColor,pn(t,p,m,b)}else{t.lineWidth=T(r.borderWidth)?Math.max(...Object.values(r.borderWidth)):r.borderWidth||1,t.strokeStyle=r.borderColor,t.setLineDash(r.borderDash||[]),t.lineDashOffset=r.borderDashOffset||0;let p=s.leftForLtr(u,c),m=s.leftForLtr(s.xPlus(u,1),c-2),b=te(r.borderRadius);Object.values(b).some(y=>y!==0)?(t.beginPath(),t.fillStyle=o.multiKeyBackground,He(t,{x:p,y:g,w:c,h:l,radius:b}),t.fill(),t.stroke(),t.fillStyle=r.backgroundColor,t.beginPath(),He(t,{x:m,y:g+1,w:c-2,h:l-2,radius:b}),t.fill()):(t.fillStyle=o.multiKeyBackground,t.fillRect(p,g,c,l),t.strokeRect(p,g,c,l),t.fillStyle=r.backgroundColor,t.fillRect(m,g+1,c-2,l-2))}t.fillStyle=this.labelTextColors[n]}drawBody(t,i,n){let{body:s}=this,{bodySpacing:o,bodyAlign:r,displayColors:a,boxHeight:l,boxWidth:c,boxPadding:d}=n,h=G(n.bodyFont),u=h.lineHeight,f=0,g=_e(n.rtl,this.x,this.width),p=function(S){i.fillText(S,g.x(t.x+f),t.y+u/2),t.y+=u+o},m=g.textAlign(r),b,y,v,_,x,M,w;for(i.textAlign=r,i.textBaseline="middle",i.font=h.string,t.x=wn(this,m,n),i.fillStyle=n.bodyColor,E(this.beforeBody,p),f=a&&m!=="right"?r==="center"?c/2+d:c+2+d:0,_=0,M=s.length;_<M;++_){for(b=s[_],y=this.labelTextColors[_],i.fillStyle=y,E(b.before,p),v=b.lines,a&&v.length&&(this._drawColorBox(i,t,_,g,n),u=Math.max(h.lineHeight,l)),x=0,w=v.length;x<w;++x)p(v[x]),u=h.lineHeight;E(b.after,p)}f=0,u=h.lineHeight,E(this.afterBody,p),t.y-=o}drawFooter(t,i,n){let s=this.footer,o=s.length,r,a;if(o){let l=_e(n.rtl,this.x,this.width);for(t.x=wn(this,n.footerAlign,n),t.y+=n.footerMarginTop,i.textAlign=l.textAlign(n.footerAlign),i.textBaseline="middle",r=G(n.footerFont),i.fillStyle=n.footerColor,i.font=r.string,a=0;a<o;++a)i.fillText(s[a],l.x(t.x),t.y+r.lineHeight/2),t.y+=r.lineHeight+n.footerSpacing}}drawBackground(t,i,n,s){let{xAlign:o,yAlign:r}=this,{x:a,y:l}=t,{width:c,height:d}=n,{topLeft:h,topRight:u,bottomLeft:f,bottomRight:g}=te(s.cornerRadius);i.fillStyle=s.backgroundColor,i.strokeStyle=s.borderColor,i.lineWidth=s.borderWidth,i.beginPath(),i.moveTo(a+h,l),r==="top"&&this.drawCaret(t,i,n,s),i.lineTo(a+c-u,l),i.quadraticCurveTo(a+c,l,a+c,l+u),r==="center"&&o==="right"&&this.drawCaret(t,i,n,s),i.lineTo(a+c,l+d-g),i.quadraticCurveTo(a+c,l+d,a+c-g,l+d),r==="bottom"&&this.drawCaret(t,i,n,s),i.lineTo(a+f,l+d),i.quadraticCurveTo(a,l+d,a,l+d-f),r==="center"&&o==="left"&&this.drawCaret(t,i,n,s),i.lineTo(a,l+h),i.quadraticCurveTo(a,l,a+h,l),i.closePath(),i.fill(),s.borderWidth>0&&i.stroke()}_updateAnimationTarget(t){let i=this.chart,n=this.$animations,s=n&&n.x,o=n&&n.y;if(s||o){let r=wi[t.position].call(this,this._active,this._eventPosition);if(!r)return;let a=this._size=pc(this,t),l=Object.assign({},r,this._size),c=gc(i,t,l),d=mc(t,l,c,i);(s._to!==d.x||o._to!==d.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,d))}}_willRender(){return!!this.opacity}draw(t){let i=this.options.setContext(this.getContext()),n=this.opacity;if(!n)return;this._updateAnimationTarget(i);let s={width:this.width,height:this.height},o={x:this.x,y:this.y};n=Math.abs(n)<.001?0:n;let r=tt(i.padding),a=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;i.enabled&&a&&(t.save(),t.globalAlpha=n,this.drawBackground(o,t,s,i),mo(t,i.textDirection),o.y+=r.top,this.drawTitle(o,t,i),this.drawBody(o,t,i),this.drawFooter(o,t,i),bo(t,i.textDirection),t.restore())}getActiveElements(){return this._active||[]}setActiveElements(t,i){let n=this._active,s=t.map(({datasetIndex:a,index:l})=>{let 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=!hi(n,s),r=this._positionChanged(s,i);(o||r)&&(this._active=s,this._eventPosition=i,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(t,i,n=!0){if(i&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;let s=this.options,o=this._active||[],r=this._getActiveElements(t,o,i,n),a=this._positionChanged(r,t),l=i||!hi(r,o)||a;return l&&(this._active=r,(s.enabled||s.external)&&(this._eventPosition={x:t.x,y:t.y},this.update(!0,i))),l}_getActiveElements(t,i,n,s){let o=this.options;if(t.type==="mouseout")return[];if(!s)return i.filter(a=>this.chart.data.datasets[a.datasetIndex]&&this.chart.getDatasetMeta(a.datasetIndex).controller.getParsed(a.index)!==void 0);let r=this.chart.getElementsAtEventForMode(t,o.mode,o,n);return o.reverse&&r.reverse(),r}_positionChanged(t,i){let{caretX:n,caretY:s,options:o}=this,r=wi[o.position].call(this,t,i);return r!==!1&&(n!==r.x||s!==r.y)}},Jc={id:"tooltip",_element:In,positioners:wi,afterInit(e,t,i){i&&(e.tooltip=new In({chart:e,options:i}))},beforeUpdate(e,t,i){e.tooltip&&e.tooltip.initialize(i)},reset(e,t,i){e.tooltip&&e.tooltip.initialize(i)},afterDraw(e){let t=e.tooltip;if(t&&t._willRender()){let i={tooltip:t};if(e.notifyPlugins("beforeTooltipDraw",{...i,cancelable:!0})===!1)return;t.draw(e.ctx),e.notifyPlugins("afterTooltipDraw",i)}},afterEvent(e,t){if(e.tooltip){let i=t.replay;e.tooltip.handleEvent(t.event,i,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:Xc},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"]};var zm=(e,t,i,n)=>(typeof t=="string"?(i=e.push(t)-1,n.unshift({index:i,label:t})):isNaN(t)&&(i=null),i);function Bm(e,t,i,n){let s=e.indexOf(t);if(s===-1)return zm(e,t,i,n);let o=e.lastIndexOf(t);return s!==o?i:s}var $m=(e,t)=>e===null?null:rt(Math.round(e),0,t);function xc(e){let t=this.getLabels();return e>=0&&e<t.length?t[e]:e}var Fn=class extends Se{static id="category";static defaults={ticks:{callback:xc}};constructor(t){super(t),this._startValue=void 0,this._valueRange=0,this._addedLabels=[]}init(t){let i=this._addedLabels;if(i.length){let n=this.getLabels();for(let{index:s,label:o}of i)n[s]===o&&n.splice(s,1);this._addedLabels=[]}super.init(t)}parse(t,i){if(D(t))return null;let n=this.getLabels();return i=isFinite(i)&&n[i]===t?i:Bm(n,t,O(i,t),this._addedLabels),$m(i,n.length-1)}determineDataLimits(){let{minDefined:t,maxDefined:i}=this.getUserBounds(),{min:n,max:s}=this.getMinMax(!0);this.options.bounds==="ticks"&&(t||(n=0),i||(s=this.getLabels().length-1)),this.min=n,this.max=s}buildTicks(){let t=this.min,i=this.max,n=this.options.offset,s=[],o=this.getLabels();o=t===0&&i===o.length-1?o:o.slice(t,i+1),this._valueRange=Math.max(o.length-(n?0:1),1),this._startValue=this.min-(n?.5:0);for(let r=t;r<=i;r++)s.push({value:r});return s}getLabelForValue(t){return xc.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){let i=this.ticks;return t<0||t>i.length-1?null:this.getPixelForValue(i[t].value)}getValueForPixel(t){return Math.round(this._startValue+this.getDecimalForPixel(t)*this._valueRange)}getBasePixel(){return this.bottom}};function jm(e,t){let i=[],{bounds:s,step:o,min:r,max:a,precision:l,count:c,maxTicks:d,maxDigits:h,includeBounds:u}=e,f=o||1,g=d-1,{min:p,max:m}=t,b=!D(r),y=!D(a),v=!D(c),_=(m-p)/(h+1),x=Xs((m-p)/g/f)*f,M,w,S,P;if(x<1e-14&&!b&&!y)return[{value:p},{value:m}];P=Math.ceil(m/x)-Math.floor(p/x),P>g&&(x=Xs(P*x/g/f)*f),D(l)||(M=Math.pow(10,l),x=Math.ceil(x*M)/M),s==="ticks"?(w=Math.floor(p/x)*x,S=Math.ceil(m/x)*x):(w=p,S=m),b&&y&&o&&rl((a-r)/o,x/1e3)?(P=Math.round(Math.min((a-r)/x,d)),x=(a-r)/P,w=r,S=a):v?(w=b?r:w,S=y?a:S,P=c-1,x=(S-w)/P):(P=(S-w)/x,je(P,Math.round(P),x/1e3)?P=Math.round(P):P=Math.ceil(P));let A=Math.max(Gs(x),Gs(w));M=Math.pow(10,D(l)?A:l),w=Math.round(w*M)/M,S=Math.round(S*M)/M;let L=0;for(b&&(u&&w!==r?(i.push({value:r}),w<r&&L++,je(Math.round((w+L*x)*M)/M,r,_c(r,_,e))&&L++):w<r&&L++);L<P;++L){let R=Math.round((w+L*x)*M)/M;if(y&&R>a)break;i.push({value:R})}return y&&u&&S!==a?i.length&&je(i[i.length-1].value,a,_c(a,_,e))?i[i.length-1].value=a:i.push({value:a}):(!y||S===a)&&i.push({value:S}),i}function _c(e,t,{horizontal:i,minRotation:n}){let s=Ft(n),o=(i?Math.sin(s):Math.cos(s))||.001,r=.75*t*(""+e).length;return Math.min(t/o,r)}var Ke=class extends Se{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,i){return D(t)||(typeof t=="number"||t instanceof Number)&&!isFinite(+t)?null:+t}handleTickRangeOptions(){let{beginAtZero:t}=this.options,{minDefined:i,maxDefined:n}=this.getUserBounds(),{min:s,max:o}=this,r=l=>s=i?s:l,a=l=>o=n?o:l;if(t){let l=gt(s),c=gt(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(){let t=this.options.ticks,{maxTicksLimit:i,stepSize:n}=t,s;return n?(s=Math.ceil(this.max/n)-Math.floor(this.min/n)+1,s>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${n} would result generating up to ${s} ticks. Limiting to 1000.`),s=1e3)):(s=this.computeTickLimit(),i=i||11),i&&(s=Math.min(i,s)),s}computeTickLimit(){return Number.POSITIVE_INFINITY}buildTicks(){let t=this.options,i=t.ticks,n=this.getTickLimit();n=Math.max(2,n);let s={maxTicks:n,bounds:t.bounds,min:t.min,max:t.max,precision:i.precision,step:i.stepSize,count:i.count,maxDigits:this._maxDigits(),horizontal:this.isHorizontal(),minRotation:i.minRotation||0,includeBounds:i.includeBounds!==!1},o=this._range||this,r=jm(s,o);return t.bounds==="ticks"&&Js(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(){let t=this.ticks,i=this.min,n=this.max;if(super.configure(),this.options.offset&&t.length){let s=(n-i)/Math.max(t.length-1,1)/2;i-=s,n+=s}this._startValue=i,this._endValue=n,this._valueRange=n-i}getLabelForValue(t){return un(t,this.chart.options.locale,this.options.ticks.format)}},Nn=class extends Ke{static id="linear";static defaults={ticks:{callback:ui.formatters.numeric}};determineDataLimits(){let{min:t,max:i}=this.getMinMax(!0);this.min=V(t)?t:0,this.max=V(i)?i:1,this.handleTickRangeOptions()}computeTickLimit(){let t=this.isHorizontal(),i=t?this.width:this.height,n=Ft(this.options.ticks.minRotation),s=(t?Math.sin(n):Math.cos(n))||.001,o=this._resolveTickFontOptions(0);return Math.ceil(i/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}},ki=e=>Math.floor(It(e)),we=(e,t)=>Math.pow(10,ki(e)+t);function vc(e){return e/Math.pow(10,ki(e))===1}function wc(e,t,i){let n=Math.pow(10,i),s=Math.floor(e/n);return Math.ceil(t/n)-s}function Vm(e,t){let i=t-e,n=ki(i);for(;wc(e,t,n)>10;)n++;for(;wc(e,t,n)<10;)n--;return Math.min(n,ki(e))}function Hm(e,{min:t,max:i}){t=at(e.min,t);let n=[],s=ki(t),o=Vm(t,i),r=o<0?Math.pow(10,Math.abs(o)):1,a=Math.pow(10,o),l=s>o?Math.pow(10,s):0,c=Math.round((t-l)*r)/r,d=Math.floor((t-l)/a/10)*a*10,h=Math.floor((c-d)/Math.pow(10,o)),u=at(e.min,Math.round((l+d+h*Math.pow(10,o))*r)/r);for(;u<i;)n.push({value:u,major:vc(u),significand:h}),h>=10?h=h<15?15:20:h++,h>=20&&(o++,h=2,r=o>=0?1:r),u=Math.round((l+d+h*Math.pow(10,o))*r)/r;let f=at(e.max,u);return n.push({value:f,major:vc(f),significand:h}),n}var Sc=class extends Se{static id="logarithmic";static defaults={ticks:{callback:ui.formatters.logarithmic,major:{enabled:!0}}};constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._valueRange=0}parse(t,i){let n=Ke.prototype.parse.apply(this,[t,i]);if(n===0){this._zero=!0;return}return V(n)&&n>0?n:null}determineDataLimits(){let{min:t,max:i}=this.getMinMax(!0);this.min=V(t)?Math.max(0,t):null,this.max=V(i)?Math.max(0,i):null,this.options.beginAtZero&&(this._zero=!0),this._zero&&this.min!==this._suggestedMin&&!V(this._userMin)&&(this.min=t===we(this.min,0)?we(this.min,-1):we(this.min,0)),this.handleTickRangeOptions()}handleTickRangeOptions(){let{minDefined:t,maxDefined:i}=this.getUserBounds(),n=this.min,s=this.max,o=a=>n=t?n:a,r=a=>s=i?s:a;n===s&&(n<=0?(o(1),r(10)):(o(we(n,-1)),r(we(s,1)))),n<=0&&o(we(s,-1)),s<=0&&r(we(n,1)),this.min=n,this.max=s}buildTicks(){let t=this.options,i={min:this._userMin,max:this._userMax},n=Hm(i,this);return t.bounds==="ticks"&&Js(n,this,"value"),t.reverse?(n.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),n}getLabelForValue(t){return t===void 0?"0":un(t,this.chart.options.locale,this.options.ticks.format)}configure(){let t=this.min;super.configure(),this._startValue=It(t),this._valueRange=It(this.max)-It(t)}getPixelForValue(t){return(t===void 0||t===0)&&(t=this.min),t===null||isNaN(t)?NaN:this.getPixelForDecimal(t===this.min?0:(It(t)-this._startValue)/this._valueRange)}getValueForPixel(t){let i=this.getDecimalForPixel(t);return Math.pow(10,this._startValue+i*this._valueRange)}};function Wo(e){let t=e.ticks;if(t.display&&e.display){let i=tt(t.backdropPadding);return O(t.font&&t.font.size,H.font.size)+i.height}return 0}function Wm(e,t,i){return i=B(i)?i:[i],{w:yl(e,t.string,i),h:i.length*t.lineHeight}}function Mc(e,t,i,n,s){return e===n||e===s?{start:t-i/2,end:t+i/2}:e<n||e>s?{start:t-i,end:t}:{start:t,end:t+i}}function Km(e){let t={l:e.left+e._padding.left,r:e.right-e._padding.right,t:e.top+e._padding.top,b:e.bottom-e._padding.bottom},i=Object.assign({},t),n=[],s=[],o=e._pointLabels.length,r=e.options.pointLabels,a=r.centerPointLabels?Y/o:0;for(let l=0;l<o;l++){let c=r.setContext(e.getPointLabelContext(l));s[l]=c.padding;let d=e.getPointPosition(l,e.drawingArea+s[l],a),h=G(c.font),u=Wm(e.ctx,h,e._pointLabels[l]);n[l]=u;let f=nt(e.getIndexAngle(l)+a),g=Math.round(dn(f)),p=Mc(g,d.x,u.w,0,180),m=Mc(g,d.y,u.h,90,270);Um(i,t,f,p,m)}e.setCenterPoint(t.l-i.l,i.r-t.r,t.t-i.t,i.b-t.b),e._pointLabelItems=Xm(e,n,s)}function Um(e,t,i,n,s){let o=Math.abs(Math.sin(i)),r=Math.abs(Math.cos(i)),a=0,l=0;n.start<t.l?(a=(t.l-n.start)/o,e.l=Math.min(e.l,t.l-a)):n.end>t.r&&(a=(n.end-t.r)/o,e.r=Math.max(e.r,t.r+a)),s.start<t.t?(l=(t.t-s.start)/r,e.t=Math.min(e.t,t.t-l)):s.end>t.b&&(l=(s.end-t.b)/r,e.b=Math.max(e.b,t.b+l))}function qm(e,t,i){let n=e.drawingArea,{extra:s,additionalAngle:o,padding:r,size:a}=i,l=e.getPointPosition(t,n+s+r,o),c=Math.round(dn(nt(l.angle+st))),d=Zm(l.y,a.h,c),h=Jm(c),u=Gm(l.x,a.w,h);return{visible:!0,x:l.x,y:d,textAlign:h,left:u,top:d,right:u+a.w,bottom:d+a.h}}function Ym(e,t){if(!t)return!0;let{left:i,top:n,right:s,bottom:o}=e;return!(St({x:i,y:n},t)||St({x:i,y:o},t)||St({x:s,y:n},t)||St({x:s,y:o},t))}function Xm(e,t,i){let n=[],s=e._pointLabels.length,o=e.options,{centerPointLabels:r,display:a}=o.pointLabels,l={extra:Wo(o)/2,additionalAngle:r?Y/s:0},c;for(let d=0;d<s;d++){l.padding=i[d],l.size=t[d];let h=qm(e,d,l);n.push(h),a==="auto"&&(h.visible=Ym(h,c),h.visible&&(c=h))}return n}function Jm(e){return e===0||e===180?"center":e<180?"left":"right"}function Gm(e,t,i){return i==="right"?e-=t:i==="center"&&(e-=t/2),e}function Zm(e,t,i){return i===90||i===270?e-=t/2:(i>270||i<90)&&(e-=t),e}function Qm(e,t,i){let{left:n,top:s,right:o,bottom:r}=i,{backdropColor:a}=t;if(!D(a)){let l=te(t.borderRadius),c=tt(t.backdropPadding);e.fillStyle=a;let d=n-c.left,h=s-c.top,u=o-n+c.width,f=r-s+c.height;Object.values(l).some(g=>g!==0)?(e.beginPath(),He(e,{x:d,y:h,w:u,h:f,radius:l}),e.fill()):e.fillRect(d,h,u,f)}}function tb(e,t){let{ctx:i,options:{pointLabels:n}}=e;for(let s=t-1;s>=0;s--){let o=e._pointLabelItems[s];if(!o.visible)continue;let r=n.setContext(e.getPointLabelContext(s));Qm(i,r,o);let a=G(r.font),{x:l,y:c,textAlign:d}=o;xe(i,e._pointLabels[s],l,c+a.lineHeight/2,a,{color:r.color,textAlign:d,textBaseline:"middle"})}}function Gc(e,t,i,n){let{ctx:s}=e;if(i)s.arc(e.xCenter,e.yCenter,t,0,ot);else{let o=e.getPointPosition(0,t);s.moveTo(o.x,o.y);for(let r=1;r<n;r++)o=e.getPointPosition(r,t),s.lineTo(o.x,o.y)}}function eb(e,t,i,n,s){let o=e.ctx,r=t.circular,{color:a,lineWidth:l}=t;!r&&!n||!a||!l||i<0||(o.save(),o.strokeStyle=a,o.lineWidth=l,o.setLineDash(s.dash||[]),o.lineDashOffset=s.dashOffset,o.beginPath(),Gc(e,i,r,n),o.closePath(),o.stroke(),o.restore())}function ib(e,t,i){return zt(e,{label:i,index:t,type:"pointLabel"})}var kc=class extends Ke{static id="radialLinear";static defaults={display:!0,animate:!0,position:"chartArea",angleLines:{display:!0,lineWidth:1,borderDash:[],borderDashOffset:0},grid:{circular:!1},startAngle:0,ticks:{showLabelBackdrop:!0,callback:ui.formatters.numeric},pointLabels:{backdropColor:void 0,backdropPadding:2,display:!0,font:{size:10},callback(t){return t},padding:5,centerPointLabels:!1}};static defaultRoutes={"angleLines.color":"borderColor","pointLabels.color":"color","ticks.color":"color"};static descriptors={angleLines:{_fallback:"grid"}};constructor(t){super(t),this.xCenter=void 0,this.yCenter=void 0,this.drawingArea=void 0,this._pointLabels=[],this._pointLabelItems=[]}setDimensions(){let t=this._padding=tt(Wo(this.options)/2),i=this.width=this.maxWidth-t.width,n=this.height=this.maxHeight-t.height;this.xCenter=Math.floor(this.left+i/2+t.left),this.yCenter=Math.floor(this.top+n/2+t.top),this.drawingArea=Math.floor(Math.min(i,n)/2)}determineDataLimits(){let{min:t,max:i}=this.getMinMax(!1);this.min=V(t)&&!isNaN(t)?t:0,this.max=V(i)&&!isNaN(i)?i:0,this.handleTickRangeOptions()}computeTickLimit(){return Math.ceil(this.drawingArea/Wo(this.options))}generateTickLabels(t){Ke.prototype.generateTickLabels.call(this,t),this._pointLabels=this.getLabels().map((i,n)=>{let s=N(this.options.pointLabels.callback,[i,n],this);return s||s===0?s:""}).filter((i,n)=>this.chart.getDataVisibility(n))}fit(){let t=this.options;t.display&&t.pointLabels.display?Km(this):this.setCenterPoint(0,0,0,0)}setCenterPoint(t,i,n,s){this.xCenter+=Math.floor((t-i)/2),this.yCenter+=Math.floor((n-s)/2),this.drawingArea-=Math.min(this.drawingArea/2,Math.max(t,i,n,s))}getIndexAngle(t){let i=ot/(this._pointLabels.length||1),n=this.options.startAngle||0;return nt(t*i+Ft(n))}getDistanceFromCenterForValue(t){if(D(t))return NaN;let i=this.drawingArea/(this.max-this.min);return this.options.reverse?(this.max-t)*i:(t-this.min)*i}getValueForDistanceFromCenter(t){if(D(t))return NaN;let i=t/(this.drawingArea/(this.max-this.min));return this.options.reverse?this.max-i:this.min+i}getPointLabelContext(t){let i=this._pointLabels||[];if(t>=0&&t<i.length){let n=i[t];return ib(this.getContext(),t,n)}}getPointPosition(t,i,n=0){let s=this.getIndexAngle(t)-st+n;return{x:Math.cos(s)*i+this.xCenter,y:Math.sin(s)*i+this.yCenter,angle:s}}getPointPositionForValue(t,i){return this.getPointPosition(t,this.getDistanceFromCenterForValue(i))}getBasePosition(t){return this.getPointPositionForValue(t||0,this.getBaseValue())}getPointLabelPosition(t){let{left:i,top:n,right:s,bottom:o}=this._pointLabelItems[t];return{left:i,top:n,right:s,bottom:o}}drawBackground(){let{backgroundColor:t,grid:{circular:i}}=this.options;if(t){let n=this.ctx;n.save(),n.beginPath(),Gc(this,this.getDistanceFromCenterForValue(this._endValue),i,this._pointLabels.length),n.closePath(),n.fillStyle=t,n.fill(),n.restore()}}drawGrid(){let t=this.ctx,i=this.options,{angleLines:n,grid:s,border:o}=i,r=this._pointLabels.length,a,l,c;if(i.pointLabels.display&&tb(this,r),s.display&&this.ticks.forEach((d,h)=>{if(h!==0||h===0&&this.min<0){l=this.getDistanceFromCenterForValue(d.value);let u=this.getContext(h),f=s.setContext(u),g=o.setContext(u);eb(this,f,l,r,g)}}),n.display){for(t.save(),a=r-1;a>=0;a--){let d=n.setContext(this.getPointLabelContext(a)),{color:h,lineWidth:u}=d;!u||!h||(t.lineWidth=u,t.strokeStyle=h,t.setLineDash(d.borderDash),t.lineDashOffset=d.borderDashOffset,l=this.getDistanceFromCenterForValue(i.reverse?this.min:this.max),c=this.getPointPosition(a,l),t.beginPath(),t.moveTo(this.xCenter,this.yCenter),t.lineTo(c.x,c.y),t.stroke())}t.restore()}}drawBorder(){}drawLabels(){let t=this.ctx,i=this.options,n=i.ticks;if(!n.display)return;let s=this.getIndexAngle(0),o,r;t.save(),t.translate(this.xCenter,this.yCenter),t.rotate(s),t.textAlign="center",t.textBaseline="middle",this.ticks.forEach((a,l)=>{if(l===0&&this.min>=0&&!i.reverse)return;let c=n.setContext(this.getContext(l)),d=G(c.font);if(o=this.getDistanceFromCenterForValue(this.ticks[l].value),c.showLabelBackdrop){t.font=d.string,r=t.measureText(a.label).width,t.fillStyle=c.backdropColor;let h=tt(c.backdropPadding);t.fillRect(-r/2-h.left,-o-d.size/2-h.top,r+h.width,d.size+h.height)}xe(t,a.label,0,-o,d,{color:c.color,strokeColor:c.textStrokeColor,strokeWidth:c.textStrokeWidth})}),t.restore()}drawTitle(){}},$n={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}},dt=Object.keys($n);function Pc(e,t){return e-t}function Cc(e,t){if(D(t))return null;let i=e._adapter,{parser:n,round:s,isoWeekday:o}=e._parseOpts,r=t;return typeof n=="function"&&(r=n(r)),V(r)||(r=typeof n=="string"?i.parse(r,n):i.parse(r)),r===null?null:(s&&(r=s==="week"&&(Ve(o)||o===!0)?i.startOf(r,"isoWeek",o):i.startOf(r,s)),+r)}function Ac(e,t,i,n){let s=dt.length;for(let o=dt.indexOf(e);o<s-1;++o){let r=$n[dt[o]],a=r.steps?r.steps:Number.MAX_SAFE_INTEGER;if(r.common&&Math.ceil((i-t)/(a*r.size))<=n)return dt[o]}return dt[s-1]}function nb(e,t,i,n,s){for(let o=dt.length-1;o>=dt.indexOf(i);o--){let r=dt[o];if($n[r].common&&e._adapter.diff(s,n,r)>=t-1)return r}return dt[i?dt.indexOf(i):0]}function sb(e){for(let t=dt.indexOf(e)+1,i=dt.length;t<i;++t)if($n[dt[t]].common)return dt[t]}function Oc(e,t,i){if(!i)e[t]=!0;else if(i.length){let{lo:n,hi:s}=hn(i,t),o=i[n]>=t?i[n]:i[s];e[o]=!0}}function ob(e,t,i,n){let s=e._adapter,o=+s.startOf(t[0].value,n),r=t[t.length-1].value,a,l;for(a=o;a<=r;a=+s.add(a,1,n))l=i[a],l>=0&&(t[l].major=!0);return t}function Lc(e,t,i){let n=[],s={},o=t.length,r,a;for(r=0;r<o;++r)a=t[r],s[a]=r,n.push({value:a,major:!1});return o===0||!i?n:ob(e,n,s,i)}var zn=class extends Se{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,i={}){let n=t.time||(t.time={}),s=this._adapter=new Hp._date(t.adapters.date);s.init(i),Be(n.displayFormats,s.formats()),this._parseOpts={parser:n.parser,round:n.round,isoWeekday:n.isoWeekday},super.init(t),this._normalized=i.normalized}parse(t,i){return t===void 0?null:Cc(this,t)}beforeLayout(){super.beforeLayout(),this._cache={data:[],labels:[],all:[]}}determineDataLimits(){let t=this.options,i=this._adapter,n=t.time.unit||"day",{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=V(s)&&!isNaN(s)?s:+i.startOf(Date.now(),n),o=V(o)&&!isNaN(o)?o:+i.endOf(Date.now(),n)+1,this.min=Math.min(s,o-1),this.max=Math.max(s+1,o)}_getLabelBounds(){let t=this.getLabelTimestamps(),i=Number.POSITIVE_INFINITY,n=Number.NEGATIVE_INFINITY;return t.length&&(i=t[0],n=t[t.length-1]),{min:i,max:n}}buildTicks(){let t=this.options,i=t.time,n=t.ticks,s=n.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]);let o=this.min,r=this.max,a=dl(s,o,r);return this._unit=i.unit||(n.autoSkip?Ac(i.minUnit,this.min,this.max,this._getLabelCapacity(o)):nb(this,a.length,i.minUnit,this.min,this.max)),this._majorUnit=!n.major.enabled||this._unit==="year"?void 0:sb(this._unit),this.initOffsets(s),t.reverse&&a.reverse(),Lc(this,a,this._majorUnit)}afterAutoSkip(){this.options.offsetAfterAutoskip&&this.initOffsets(this.ticks.map(t=>+t.value))}initOffsets(t=[]){let i=0,n=0,s,o;this.options.offset&&t.length&&(s=this.getDecimalForValue(t[0]),t.length===1?i=1-s:i=(this.getDecimalForValue(t[1])-s)/2,o=this.getDecimalForValue(t[t.length-1]),t.length===1?n=o:n=(o-this.getDecimalForValue(t[t.length-2]))/2);let r=t.length<3?.5:.25;i=rt(i,0,r),n=rt(n,0,r),this._offsets={start:i,end:n,factor:1/(i+1+n)}}_generate(){let t=this._adapter,i=this.min,n=this.max,s=this.options,o=s.time,r=o.unit||Ac(o.minUnit,i,n,this._getLabelCapacity(i)),a=O(s.ticks.stepSize,1),l=r==="week"?o.isoWeekday:!1,c=Ve(l)||l===!0,d={},h=i,u,f;if(c&&(h=+t.startOf(h,"isoWeek",l)),h=+t.startOf(h,c?"day":r),t.diff(n,i,r)>1e5*a)throw new Error(i+" and "+n+" are too far apart with stepSize of "+a+" "+r);let g=s.ticks.source==="data"&&this.getDataTimestamps();for(u=h,f=0;u<n;u=+t.add(u,a,r),f++)Oc(d,u,g);return(u===n||s.bounds==="ticks"||f===1)&&Oc(d,u,g),Object.keys(d).sort(Pc).map(p=>+p)}getLabelForValue(t){let i=this._adapter,n=this.options.time;return n.tooltipFormat?i.format(t,n.tooltipFormat):i.format(t,n.displayFormats.datetime)}format(t,i){let s=this.options.time.displayFormats,o=this._unit,r=i||s[o];return this._adapter.format(t,r)}_tickFormatFunction(t,i,n,s){let o=this.options,r=o.ticks.callback;if(r)return N(r,[t,i,n],this);let a=o.time.displayFormats,l=this._unit,c=this._majorUnit,d=l&&a[l],h=c&&a[c],u=n[i],f=c&&h&&u&&u.major;return this._adapter.format(t,s||(f?h:d))}generateTickLabels(t){let i,n,s;for(i=0,n=t.length;i<n;++i)s=t[i],s.label=this._tickFormatFunction(s.value,i,t)}getDecimalForValue(t){return t===null?NaN:(t-this.min)/(this.max-this.min)}getPixelForValue(t){let i=this._offsets,n=this.getDecimalForValue(t);return this.getPixelForDecimal((i.start+n)*i.factor)}getValueForPixel(t){let i=this._offsets,n=this.getDecimalForPixel(t)/i.factor-i.end;return this.min+n*(this.max-this.min)}_getLabelSize(t){let i=this.options.ticks,n=this.ctx.measureText(t).width,s=Ft(this.isHorizontal()?i.maxRotation:i.minRotation),o=Math.cos(s),r=Math.sin(s),a=this._resolveTickFontOptions(0).size;return{w:n*o+a*r,h:n*r+a*o}}_getLabelCapacity(t){let i=this.options.time,n=i.displayFormats,s=n[i.unit]||n.millisecond,o=this._tickFormatFunction(t,0,Lc(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||[],i,n;if(t.length)return t;let s=this.getMatchingVisibleMetas();if(this._normalized&&s.length)return this._cache.data=s[0].controller.getAllParsedValues(this);for(i=0,n=s.length;i<n;++i)t=t.concat(s[i].controller.getAllParsedValues(this));return this._cache.data=this.normalize(t)}getLabelTimestamps(){let t=this._cache.labels||[],i,n;if(t.length)return t;let s=this.getLabels();for(i=0,n=s.length;i<n;++i)t.push(Cc(this,s[i]));return this._cache.labels=this._normalized?t:this.normalize(t)}normalize(t){return to(t.sort(Pc))}};function Sn(e,t,i){let n=0,s=e.length-1,o,r,a,l;i?(t>=e[n].pos&&t<=e[s].pos&&({lo:n,hi:s}=Jt(e,"pos",t)),{pos:o,time:a}=e[n],{pos:r,time:l}=e[s]):(t>=e[n].time&&t<=e[s].time&&({lo:n,hi:s}=Jt(e,"time",t)),{time:o,pos:a}=e[n],{time:r,pos:l}=e[s]);let c=r-o;return c?a+(l-a)*(t-o)/c:a}var Tc=class extends zn{static id="timeseries";static defaults=zn.defaults;constructor(t){super(t),this._table=[],this._minPos=void 0,this._tableRange=void 0}initOffsets(){let t=this._getTimestampsForTable(),i=this._table=this.buildLookupTable(t);this._minPos=Sn(i,this.min),this._tableRange=Sn(i,this.max)-this._minPos,super.initOffsets(t)}buildLookupTable(t){let{min:i,max:n}=this,s=[],o=[],r,a,l,c,d;for(r=0,a=t.length;r<a;++r)c=t[r],c>=i&&c<=n&&s.push(c);if(s.length<2)return[{time:i,pos:0},{time:n,pos:1}];for(r=0,a=s.length;r<a;++r)d=s[r+1],l=s[r-1],c=s[r],Math.round((d+l)/2)!==c&&o.push({time:c,pos:r/(a-1)});return o}_generate(){let t=this.min,i=this.max,n=super.getDataTimestamps();return(!n.includes(t)||!n.length)&&n.splice(0,0,t),(!n.includes(i)||n.length===1)&&n.push(i),n.sort((s,o)=>s-o)}_getTimestampsForTable(){let t=this._cache.all||[];if(t.length)return t;let i=this.getDataTimestamps(),n=this.getLabelTimestamps();return i.length&&n.length?t=this.normalize(i.concat(n)):t=i.length?i:n,t=this._cache.all=t,t}getDecimalForValue(t){return(Sn(this._table,t)-this._minPos)/this._tableRange}getValueForPixel(t){let i=this._offsets,n=this.getDecimalForPixel(t)/i.factor-i.end;return Sn(this._table,n*this._tableRange+this._minPos,!0)}};mt.register(An,Me,Tn,Cn,Dn,Fn,Nn,Jc,Yc,Uc);var U={input:"#3b82f6",output:"#8b5cf6",cacheRead:"#10b981",cacheCreate:"#f59e0b",text:"#cbd5e1",textMuted:"#94a3b8",border:"rgba(148,163,184,0.15)"},Zc={responsive:!0,maintainAspectRatio:!1,animation:!1,events:["mousemove","mouseout","click","touchstart","touchmove"],interaction:{mode:"index",intersect:!1},hover:{mode:"index",intersect:!1}};function Qc(e){let t=Number(e);return t>=1e6?(t/1e6).toFixed(1)+"M":t>=1e3?(t/1e3).toFixed(1)+"K":String(t)}function rb(e){return Qc(e)}function ab(e,t=11){return e.length<=t?e:e.slice(0,t-1)+"\u2026"}function Ko(e){let t=e.map(n=>n.date.slice(5)),i=e.reduce((n,s)=>{let o=Math.max(s.input_tokens,s.output_tokens,s.cache_read_input_tokens,s.cache_creation_input_tokens);return o>n?o:n},0);return{type:"line",data:{labels:t,datasets:[{label:"Input",data:e.map(n=>n.input_tokens),borderColor:U.input,borderWidth:2,fill:!1,tension:.35,pointRadius:e.length>60?0:2,pointHoverRadius:4},{label:"Output",data:e.map(n=>n.output_tokens),borderColor:U.output,borderWidth:2,fill:!1,tension:.35,pointRadius:e.length>60?0:2,pointHoverRadius:4},{label:"Cache Read",data:e.map(n=>n.cache_read_input_tokens),borderColor:U.cacheRead,borderWidth:1.5,borderDash:[4,3],fill:!1,tension:.35,pointRadius:e.length>60?0:2,pointHoverRadius:4},{label:"Cache Create",data:e.map(n=>n.cache_creation_input_tokens),borderColor:U.cacheCreate,borderWidth:1.5,borderDash:[2,2],fill:!1,tension:.35,pointRadius:e.length>60?0:2,pointHoverRadius:4}]},options:{...Zc,plugins:{legend:{position:"top",align:"end",labels:{color:U.text,boxWidth:16,boxHeight:2,padding:12,font:{size:11},generateLabels:n=>mt.defaults.plugins.legend.labels.generateLabels(n).filter(o=>n.data.datasets[o.datasetIndex].data.reduce((l,c)=>l+(c||0),0)>0)}},tooltip:{backgroundColor:"#1e293b",titleColor:U.text,bodyColor:U.text,borderColor:U.border,borderWidth:1,padding:10,titleFont:{size:12,weight:"bold"},bodyFont:{size:11},callbacks:{title:n=>{let s=n[0]?.dataIndex;return s!==void 0?e[s]?.date??"":""},label:n=>`${n.dataset.label}: ${Number(n.parsed.y||0).toLocaleString()}`,afterBody:n=>{let s=n[0]?.dataIndex;if(s===void 0)return[];let o=e[s];return o?["",`Total: ${(o.input_tokens+o.output_tokens+o.cache_read_input_tokens+o.cache_creation_input_tokens).toLocaleString()}`,`Requests: ${o.request_count.toLocaleString()}`]:[]}}}},scales:{x:{ticks:{color:U.textMuted,maxTicksLimit:15,font:{size:10},maxRotation:0,autoSkipPadding:12},grid:{color:U.border,display:!1}},y:{beginAtZero:!0,suggestedMax:i>0?Math.ceil(i*1.1/1e3)*1e3:void 0,ticks:{color:U.textMuted,font:{size:10},callback:Qc,maxTicksLimit:6},grid:{color:U.border}}}}}}function Uo(e,t){let i=[...t].sort((o,r)=>r.input_tokens+r.output_tokens-(o.input_tokens+o.output_tokens)).slice(0,12),n=i.reduce((o,r)=>{let a=r.input_tokens+r.output_tokens+r.cache_read_input_tokens+r.cache_creation_input_tokens;return a>o?a:o},0);return{type:"bar",data:{labels:i.map(o=>ab(o.key)),datasets:[{label:"Input",data:i.map(o=>o.input_tokens),backgroundColor:U.input,stack:"a",borderRadius:2},{label:"Output",data:i.map(o=>o.output_tokens),backgroundColor:U.output,stack:"a",borderRadius:2}]},options:{...Zc,indexAxis:"y",plugins:{legend:{position:"top",align:"end",labels:{color:U.text,boxWidth:12,font:{size:11},padding:12}},tooltip:{backgroundColor:"#1e293b",titleColor:U.text,bodyColor:U.text,borderColor:U.border,borderWidth:1,padding:10,titleFont:{size:12,weight:"bold"},bodyFont:{size:11},callbacks:{title:o=>{let r=o[0]?.dataIndex;return r===void 0?"":i[r]?.key??""},label:o=>`${o.dataset.label}: ${Number(o.parsed.x||0).toLocaleString()}`,afterBody:o=>{let r=o[0]?.dataIndex;if(r===void 0)return[];let a=i[r];return a?["",`Total: ${(a.input_tokens+a.output_tokens+a.cache_read_input_tokens+a.cache_creation_input_tokens).toLocaleString()}`,`Requests: ${a.request_count.toLocaleString()}`]:[]}}}},scales:{x:{stacked:!0,beginAtZero:!0,suggestedMax:n>0?Math.ceil(n*1.1/1e3)*1e3:void 0,ticks:{color:U.textMuted,font:{size:10},callback:rb,maxTicksLimit:6},grid:{color:U.border}},y:{type:"category",stacked:!0,ticks:{color:U.textMuted,font:{size:11},autoSkip:!1},grid:{display:!1}}}}}}function td(e){let t=new Date;return t.setDate(t.getDate()-e),t.toISOString().slice(0,10)}function ed(){let e=()=>window.Alpine.store("app"),t=()=>e().fetch;function i(a){return a>=1e6?(a/1e6).toFixed(1)+"M":a>=1e3?(a/1e3).toFixed(1)+"K":String(a)}function n(a){return a>=1e6?(a/1e6).toFixed(2)+" MB":a>=1e3?(a/1e3).toFixed(1)+" KB":a+" B"}function s(a,l){return l?(a/l*100).toFixed(1)+"%":"0%"}let o=(a,l)=>k.t(a,l),r=new Date().toISOString().slice(0,10);return{dateStart:td(30),dateEnd:r,presetDays:30,timeline:[],breakdown:[],dbInfo:{events:0,aggregates:0,sizeBytes:0},loadingCharts:!1,cleaning:!1,breakdownDimension:"provider",_tl:null,_bd:null,_poll:null,init(){this.ensureCharts(),this.loadCharts(),this._poll=setInterval(()=>this.refreshToday(),3e4)},destroy(){this._tl?.destroy(),this._tl=null,this._bd?.destroy(),this._bd=null,this._poll&&(clearInterval(this._poll),this._poll=null)},async refreshToday(){let a=await t()("/admin/token-stats").catch(()=>null);a?.data&&(e().tokenStats=a.data)},async loadCharts(){this.loadingCharts=!0;let a=`/admin/token-stats/timeline?startDate=${this.dateStart}&endDate=${this.dateEnd}`,l=`/admin/token-stats/breakdown?dimension=${this.breakdownDimension}&startDate=${this.dateStart}&endDate=${this.dateEnd}`,[c,d,h]=await Promise.all([t()(a).catch(()=>null),t()(l).catch(()=>null),t()("/admin/token-stats/db-info").catch(()=>null)]);this.timeline=c?.data??[],this.breakdown=d?.data??[],this.dbInfo=h?.data??this.dbInfo,this.loadingCharts=!1,await window.Alpine.nextTick(),this.renderCharts()},ensureCharts(){if(this.timeline.length>0&&!this._tl){let a=document.getElementById("chart-timeline");a&&(mt.getChart(a)?.destroy(),this._tl=new mt(a,Ko(this.timeline)))}if(this.breakdown.length>0&&!this._bd){let a=document.getElementById("chart-breakdown");a&&(mt.getChart(a)?.destroy(),this._bd=new mt(a,Uo(this.breakdownDimension,this.breakdown)))}},renderCharts(){this.ensureCharts(),this._updateTimeline(),this._updateBreakdown()},_updateTimeline(){let a=this._tl,l=a?.canvas;if(!a||!l?.isConnected){this._tl=null,this.ensureCharts();return}let c=Ko(this.timeline);a.data.labels=c.data.labels,a.data.datasets.forEach((d,h)=>{let u=c.data.datasets[h];u&&(d.data=u.data,d.pointRadius=u.pointRadius)});try{a.update("none")}catch{this._tl=null}},_updateBreakdown(){let a=this._bd,l=a?.canvas;if(!a||!l?.isConnected){this._bd=null,this.ensureCharts();return}let c=Uo(this.breakdownDimension,this.breakdown);a.data.labels=c.data.labels,a.data.datasets.forEach((d,h)=>{let u=c.data.datasets[h];u&&(d.data=u.data,d.backgroundColor=u.backgroundColor)});try{a.update("none")}catch{this._bd=null}},setPreset(a){this.presetDays=a,this.dateStart=td(a-1),this.dateEnd=r,this.loadCharts()},setCustomDate(){this.presetDays=0,!(!this.dateStart||!this.dateEnd)&&(this.dateStart>this.dateEnd&&([this.dateStart,this.dateEnd]=[this.dateEnd,this.dateStart]),this.loadCharts())},setBreakdownDim(a){this.breakdownDimension=a,this.loadCharts()},async cleanupUsage(){if(!window.confirm(o("admin.dashboard.usage.cleanupConfirm",{days:90})))return;this.cleaning=!0;let l=await t()("/admin/token-stats/cleanup",{method:"POST",body:JSON.stringify({days:90})}).catch(()=>null);this.cleaning=!1,l?.success?(e().toast(o("admin.dashboard.usage.cleanupDone",{events:l.data.events,aggregates:l.data.aggregates}),"success"),this.loadCharts()):e().toast(o("admin.dashboard.usage.cleanupFailed"),"error")},get stats(){let a=e().health?.success,l=e().config?.providers??[],c=l.reduce((u,f)=>u+(f.models?.length??0),0),d=e().config?.adapters??[],h=o;return[{label:h("admin.dashboard.status"),value:h(a?"admin.common.normal":"admin.common.error"),clr:a?"var(--success)":"var(--danger)",icon:a?"\u2713":"\u2715",accent:a?"var(--success)":"var(--danger)"},{label:h("admin.dashboard.providerCount"),value:l.length,clr:"var(--text)",icon:"\u25C9",accent:"var(--accent)"},{label:h("admin.dashboard.modelCount"),value:c,clr:"var(--text)",icon:"\u25A3",accent:"#8b5cf6"},{label:h("admin.dashboard.adapterCount"),value:d.length,clr:"var(--text)",icon:"\u21C4",accent:"#0ea5e9"}]},get timelineEmpty(){let a=this.presetDays>0?this.presetDays:null,l=a?`${a} ${o("admin.dashboard.usage.daysUnit")}`:`${this.dateStart} ~ ${this.dateEnd}`;return{icon:"\u{1F4C9}",title:o("admin.dashboard.usage.emptyTitle"),desc:o("admin.dashboard.usage.emptyDesc",{range:l})}},get breakdownEmpty(){let a=this.presetDays>0?this.presetDays:null,l=a?`${a} ${o("admin.dashboard.usage.daysUnit")}`:`${this.dateStart} ~ ${this.dateEnd}`;return{icon:"\u{1F4CA}",title:o("admin.dashboard.usage.emptyTitle"),desc:o("admin.dashboard.usage.emptyDesc",{range:l})}},get tokenCards(){let a=e().tokenStats?.today;if(!a)return[];let l=a.input_tokens||0,c=a.output_tokens||0,d=a.cache_read_input_tokens||0,h=a.cache_creation_input_tokens||0,u=l+c,f=l+c+d+h,g=f>0?s(d,f):"0%",p=o;return[{label:p("admin.dashboard.requests"),value:a.request_count||0,clr:"var(--text)",desc:p("admin.dashboard.today"),icon:"\u2191\u2193",accent:"var(--text-muted)"},{label:p("admin.dashboard.inputTokens"),value:i(l),clr:"var(--accent)",desc:`${p("admin.dashboard.output")} ${i(c)} / ${p("admin.dashboard.total")} ${i(u)}`,icon:"\u25C8",accent:"var(--accent)"},{label:p("admin.dashboard.cacheHits"),value:i(d),clr:"var(--success)",desc:p("admin.dashboard.hitRate",{rate:g}),icon:"\u26A1",accent:"var(--success)"},{label:p("admin.dashboard.cacheCreation"),value:i(h),clr:"var(--warn)",desc:p("admin.dashboard.newCacheTokens"),icon:"\u2737",accent:"var(--warn)"}]},get dimOptions(){return["provider","adapter","model"].map(a=>({v:a,l:o(`admin.dashboard.usage.dim${a[0].toUpperCase()+a.slice(1)}`)}))},get presets(){return[1,7,30,90].map(a=>({v:a,l:o(`admin.dashboard.usage.days${a}`)}))},fmtNum:i,fmtBytes:n}}function id(){function e(){let t=new Date,i=n=>String(n).padStart(2,"0");return`${t.getFullYear()}-${i(t.getMonth()+1)}-${i(t.getDate())}`}return{allLogs:[],filter:"all",levelFilter:"all",dateFilter:"",search:"",page:1,pageSize:50,currentLogLevel:"info",init(){this.load(),this.loadLogLevel()},formatTime(t){let i=new Date(t),n=s=>String(s).padStart(2,"0");return`${i.getFullYear()}-${n(i.getMonth()+1)}-${n(i.getDate())} ${n(i.getHours())}:${n(i.getMinutes())}:${n(i.getSeconds())}.${String(i.getMilliseconds()).padStart(3,"0")}`},get filteredLogs(){let t=this.allLogs.slice().sort((n,s)=>s.timestamp.localeCompare(n.timestamp));if(this.filter!=="all"&&(t=t.filter(n=>n.type===this.filter)),this.levelFilter!=="all"&&(t=t.filter(n=>n.level===this.levelFilter)),this.search){let n=this.search.toLowerCase();t=t.filter(s=>(s.message||"").toLowerCase().includes(n)||(s.details?JSON.stringify(s.details).toLowerCase():"").includes(n))}let i=Math.max(1,Math.ceil(t.length/this.pageSize));return this.page>i&&(this.page=i),t},get pagedLogs(){let t=(this.page-1)*this.pageSize;return this.filteredLogs.slice(t,t+this.pageSize)},get totalPages(){return Math.max(1,Math.ceil(this.filteredLogs.length/this.pageSize))},get totalCount(){return this.filteredLogs.length},prevPage(){this.page>1&&this.page--},nextPage(){this.page<this.totalPages&&this.page++},async loadLogLevel(){let t=await window.Alpine.store("app").fetch("/admin/log-level").catch(()=>null);this.currentLogLevel=t?.data?.level??"info"},async setLogLevel(t){(await window.Alpine.store("app").fetch("/admin/log-level",{method:"PUT",body:JSON.stringify({level:t})}).catch(()=>null))?.success&&(this.currentLogLevel=t,window.Alpine.store("app").toast(`\u65E5\u5FD7\u7EA7\u522B\u5DF2\u8BBE\u4E3A ${t}`,"success"))},async load(){let t=new URLSearchParams({limit:"1000"});this.dateFilter&&t.set("date",this.dateFilter);let i=await window.Alpine.store("app").fetch("/admin/logs?"+t.toString()).catch(()=>null);this.allLogs=i?.data?.logs??[],this.page=1},formatDetails(t){return t?JSON.stringify(t,null,2):""},copyJson(t){navigator.clipboard.writeText(JSON.stringify(t)).then(()=>window.Alpine.store("app").toast("\u5DF2\u590D\u5236","success"),()=>{})}}}function X(e,t){return k.t(e,t)}var bt=(e,t="info")=>window.Alpine.store("app").toast(e,t),lb=e=>window.Alpine.store("app").confirm(e);function Vt(e,t){if(!e)return null;if(typeof e.error=="object"&&e.error!==null)return typeof e.error.message=="string"&&e.error.message?e.error.message:t;if(typeof e.error=="string"&&e.error){if(Array.isArray(e.errors)&&e.errors.length>0){let i=e.errors.map(n=>{let s=n.field||"",o=n.message||"";return s?`\u2022 ${s}: ${o}`:`\u2022 ${o}`});return e.error+`
12
- `+i.join(`
13
- `)}return e.error}return Array.isArray(e.errors)&&e.errors.length>0?e.errors.map(i=>`\u2022 ${i.field||""}: ${i.message||""}`).join(`
14
- `):null}function nd(){return{providers:[],search:"",editingName:null,showModal:!1,showKey:!1,form:{name:"",type:"openai",apiKey:"",apiBase:"",models:[]},pullModal:{visible:!1,models:[],existing:[],loading:!1,error:""},init(){this.load()},get filteredProviders(){let e=this.search.toLowerCase();return e?this.providers.filter(t=>t.name.toLowerCase().includes(e)):this.providers},async load(){let[e,t]=await Promise.all([window.Alpine.store("app").fetch("/admin/status/providers"),window.Alpine.store("app").fetch("/admin/config")]),i=e?.data?.providers??[],n=t?.data?.providers??[];this.providers=i.map((s,o)=>({...s,api_key:n[o]?.api_key,api_base:n[o]?.api_base,models:n[o]?.models??[]})),window.Alpine.store("app").config=t?.data},openForm(e){if(this.showKey=!1,this.editingName=e??null,this.form={name:"",type:"openai",apiKey:"",apiBase:"",models:[]},e){let t=this.providers.find(i=>i.name===e);t&&(this.form={name:t.name,type:t.type,apiKey:t.api_key||"",apiBase:t.api_base||"",models:(t.models||[]).map(i=>({...i,thinking:i.thinking??{},reasoning_effort:i.reasoning_effort??"",input:Array.isArray(i.input)?i.input:[]}))})}this.form.models.length===0&&this.addModelRow(),this.showModal=!0},addModelRow(e){this.form.models.push({id:e||"",thinking:{},reasoning_effort:"",input:[]})},removeModelRow(e){this.form.models.splice(e,1)},toggleModality(e,t,i){Array.isArray(e.input)||(e.input=[]);let n=e.input.includes(t);i&&!n&&e.input.push(t),!i&&n&&(e.input=e.input.filter(s=>s!==t)),e.input.includes("text")||e.input.unshift("text")},async save(){let{name:e,type:t,apiKey:i,apiBase:n,models:s}=this.form,o=s.filter(l=>l.id.trim()).map(l=>{let c={id:l.id.trim()};if(t==="anthropic"){let h=parseInt(l.thinking?.budget_tokens,10);h>0&&(c.thinking={...c.thinking??{},budget_tokens:h}),l.reasoning_effort&&["low","medium","high","xhigh","max"].includes(l.reasoning_effort)&&(c.thinking={...c.thinking??{},reasoning_effort:l.reasoning_effort})}else l.reasoning_effort&&["low","medium","high","xhigh","max"].includes(l.reasoning_effort)&&(c.thinking={reasoning_effort:l.reasoning_effort});l.thinking?.type&&["adaptive","auto","enabled","disabled"].includes(l.thinking.type)&&(c.thinking={...c.thinking??{},type:l.thinking.type});let d=Array.isArray(l.input)?l.input.filter(h=>["text","image"].includes(h)):[];return d.length>0&&(c.input=d),c});if(!e){bt(X("admin.providers.validationName"),"error");return}if(o.length===0){bt(X("admin.providers.validationModels"),"error");return}if(!this.editingName&&!i){bt(X("admin.providers.validationApiKey"),"error");return}let r={name:e,type:t,api_key:i,api_base:n||void 0,models:o},a;if(this.editingName?a=await window.Alpine.store("app").fetch(`/admin/providers/${this.editingName}`,{method:"PUT",body:JSON.stringify(r)}):a=await window.Alpine.store("app").fetch("/admin/providers",{method:"POST",body:JSON.stringify(r)}),!a.success){let l=Vt(a,X("admin.providers.saveFailed"))||X("admin.providers.saveFailed");bt(l,"error");return}bt(this.editingName?X("admin.providers.updated"):X("admin.providers.created"),"success"),this.showModal=!1,this.load()},async confirmDelete(e){if(!await lb(X("admin.providers.deleteConfirm",{name:e})))return;let i=await window.Alpine.store("app").fetch(`/admin/providers/${e}`,{method:"DELETE"});if(!i.success){let n=Vt(i,X("admin.providers.deleteFailed"))||X("admin.providers.deleteFailed");bt(n,"error");return}bt(X("admin.providers.deleted"),"success"),this.load()},async openPullModels(){let{name:e,type:t,apiKey:i,apiBase:n}=this.form,s=e||this.editingName;if(!s){bt(X("admin.providers.validationProviderName"),"error");return}if(!i&&!this.editingName){bt(X("admin.providers.validationApiKey"),"error");return}this.pullModal={visible:!0,models:[],existing:[],loading:!0,error:""};let o={type:t};i&&(o.api_key=i),n&&(o.api_base=n);let r=await window.Alpine.store("app").fetch(`/admin/providers/${s}/pull-models`,{method:"POST",body:JSON.stringify(o)}).catch(()=>null);if(!r?.success){let l=Vt(r,X("admin.providers.pullModelsError"))||X("admin.providers.pullModelsError");this.pullModal={visible:!0,models:[],existing:[],loading:!1,error:l};return}let a=(r.data.models||[]).map(l=>({...l,checked:!r.data.existing?.includes(l.id)}));this.pullModal={visible:!0,models:a,existing:r.data.existing||[],loading:!1,error:""}},importPullModels(){let e=new Set(this.form.models.map(o=>o.id)),t=this.pullModal.models.filter(o=>o.checked),i=0;for(let o of t)e.has(o.id)||(this.form.models.push({id:o.id}),e.add(o.id),i++);let n=t.length,s=n>i?`${X("admin.providers.importedModels",{added:i})}${X("admin.providers.importedModelsSkip",{skipped:n-i})}`:X("admin.providers.importedModels",{added:i});bt(s,"success"),this.pullModal.visible=!1},openTestPanel(e){let i=window.Alpine.store("app").config?.providers?.find(n=>n.name===e);if(!i){bt(X("admin.providers.notFound"),"error");return}window.dispatchEvent(new CustomEvent("open-test-panel",{detail:{providerName:e,provider:i}}))}}}function cb(e,t){return k.t(e,t)}function sd(){return{visible:!1,providerName:"",providerType:"",models:[],selectedModel:"",running:!1,results:[],init(){window.addEventListener("open-test-panel",(e=>{this.providerName=e.detail.providerName,this.providerType=e.detail.provider.type,this.models=e.detail.provider.models??[],this.selectedModel=this.models[0]?.id||"",this.results=[],this.visible=!0}))},get providerNames(){return this.providerName},async run(){if(!this.selectedModel)return;this.running=!0;let e=await window.Alpine.store("app").fetch("/admin/test-model",{method:"POST",body:JSON.stringify({providerName:this.providerName,model:this.selectedModel,type:this.providerType})}).catch(()=>({success:!0,data:{reachable:!1,latency:0,error:cb("admin.test.requestFailed")}}));this.running=!1;let t=e.data||{};this.results.unshift({model:this.selectedModel,ok:t.reachable===!0,latency:t.latency,error:t.error,time:new Date().toLocaleTimeString(),requestUrl:t.requestUrl,requestHeaders:t.requestHeaders,requestBody:t.requestBody,responseStatus:t.responseStatus,responseBody:t.responseBody,_showDetails:!0})},clear(){this.results=[]}}}function Q(e,t){return k.t(e,t)}var Ct=(e,t="info")=>window.Alpine.store("app").toast(e,t),db=e=>window.Alpine.store("app").confirm(e);function od(){return{adapters:[],search:"",editingName:null,showModal:!1,form:{name:"",type:"openai",max_tokens:"",models:[]},bulkImportProvider:"",adapterTestModal:{visible:!1,adapterName:"",selectedModelId:"",models:[],results:[],running:!1},init(){this.load()},get filteredAdapters(){let e=this.search.toLowerCase();return e?this.adapters.filter(t=>t.name.toLowerCase().includes(e)):this.adapters},get providers(){return window.Alpine.store("app").config?.providers??[]},getProviderModels(e){return this.providers.find(i=>i.name===e)?.models??[]},async load(){let e=await window.Alpine.store("app").fetch("/admin/adapters").catch(()=>null);this.adapters=e?.data?.adapters??[]},openForm(e){if(this.editingName=e??null,this.form={name:"",type:"openai",max_tokens:"",models:[]},e){let t=this.adapters.find(i=>i.name===e);t&&(this.form={name:t.name,type:t.type,max_tokens:t.max_tokens??"",models:(t.models||[]).map(i=>({sourceModelId:i.sourceModelId,provider:i.provider,targetModelId:i.targetModelId,thinking:i.thinking?{budget_tokens:i.thinking.budget_tokens,type:i.thinking.type}:{},reasoning_effort:i.reasoning_effort||""}))})}this.form.models.length===0&&this.addMappingRow(),this.showModal=!0},addMappingRow(){this.form.models.push({sourceModelId:"",provider:"",targetModelId:"",thinking:{},reasoning_effort:""})},bulkImportAllModels(){let e=this.bulkImportProvider;if(!e){Ct(Q("admin.adapters.selectProviderFirst"),"error");return}let t=this.providers.find(r=>r.name===e);if(!t?.models?.length){Ct(Q("admin.adapters.noModelsInProvider",{provider:e}),"error");return}let i=new Set(this.form.models.map(r=>r.sourceModelId).filter(Boolean)),n=0;for(let r of t.models)i.has(r.id)||(this.form.models.push({sourceModelId:r.id,provider:e,targetModelId:r.id,thinking:{},reasoning_effort:""}),i.add(r.id),n++);let s=t.models.length-n,o=s>0?`${Q("admin.adapters.importedModels",{added:n})}${Q("admin.adapters.importedModelsSkip",{skipped:s})}`:Q("admin.adapters.importedModels",{added:n});Ct(o,"success"),this.bulkImportProvider=""},removeMappingRow(e){this.form.models.splice(e,1)},onProviderChange(e){let t=this.form.models[e];t&&(t.targetModelId="")},async save(){let{name:e,type:t,models:i}=this.form,n=i.filter(r=>r.sourceModelId.trim()&&r.provider&&r.targetModelId).map(r=>{let a={sourceModelId:r.sourceModelId,provider:r.provider,targetModelId:r.targetModelId};if(t==="anthropic"){let l=parseInt(r.thinking?.budget_tokens,10);l>0&&(a.thinking={...a.thinking??{},budget_tokens:l}),r.reasoning_effort&&["low","medium","high","xhigh","max"].includes(r.reasoning_effort)&&(a.thinking={...a.thinking??{},reasoning_effort:r.reasoning_effort})}else r.reasoning_effort&&["low","medium","high","xhigh","max"].includes(r.reasoning_effort)&&(a.thinking={reasoning_effort:r.reasoning_effort});return r.thinking?.type&&["adaptive","auto","enabled","disabled"].includes(r.thinking.type)&&(a.thinking={...a.thinking??{},type:r.thinking.type}),a});if(!e||n.length===0){Ct(Q("admin.common.validationName"),"error");return}let s={name:e,type:t,max_tokens:parseInt(this.form.max_tokens,10)||void 0,models:n},o;if(this.editingName?o=await window.Alpine.store("app").fetch(`/admin/adapters/${this.editingName}`,{method:"PUT",body:JSON.stringify(s)}):o=await window.Alpine.store("app").fetch("/admin/adapters",{method:"POST",body:JSON.stringify(s)}),!o.success){let r=Vt(o,Q("admin.adapters.saveFailed"))||Q("admin.adapters.saveFailed");Ct(r,"error");return}Ct(this.editingName?Q("admin.adapters.updated"):Q("admin.adapters.created"),"success"),this.showModal=!1,this.load()},async confirmDelete(e){if(!await db(Q("admin.adapters.deleteConfirm",{name:e})))return;let i=await window.Alpine.store("app").fetch(`/admin/adapters/${e}`,{method:"DELETE"});if(!i.success){let n=Vt(i,Q("admin.adapters.deleteFailed"))||Q("admin.adapters.deleteFailed");Ct(n,"error");return}Ct(Q("admin.adapters.deleted"),"success"),this.load()},openTestPanel(e){let t=this.adapters.find(n=>n.name===e);if(!t){Ct(Q("admin.adapters.notFound"),"error");return}let i=(t.models||[]).map(n=>({id:n.sourceModelId,status:n.status}));this.adapterTestModal={visible:!0,adapterName:e,selectedModelId:i[0]?.id||"",models:i,results:[],running:!1}},async runAdapterTest(){let{adapterName:e,selectedModelId:t}=this.adapterTestModal;if(!t){Ct(Q("admin.common.validationName"),"error");return}this.adapterTestModal.running=!0;let i=await window.Alpine.store("app").fetch("/admin/test-adapter",{method:"POST",body:JSON.stringify({adapterName:e,modelId:t})}).catch(()=>({success:!0,data:{reachable:!1,latency:0,error:Q("admin.test.requestFailed")}}));this.adapterTestModal.running=!1;let n=i.data||{};this.adapterTestModal.results.unshift({model:t,ok:n.reachable===!0,latency:n.latency,error:n.error,time:new Date().toLocaleTimeString(),adapterUrl:n.adapterUrl,requestUrl:n.requestUrl,requestHeaders:n.requestHeaders,requestBody:n.requestBody,responseStatus:n.responseStatus,responseBody:n.responseBody,_showDetails:!0})}}}function rd(){return{key:"",hasKey:!1,saving:!1,init(){this.load()},async load(){let e=await window.Alpine.store("app").fetch("/admin/proxy-key").catch(()=>null);this.hasKey=e?.data?.set??!1,this.key=""},async save(){this.saving=!0;let e=await window.Alpine.store("app").fetch("/admin/proxy-key",{method:"PUT",body:JSON.stringify({key:this.key})}).catch(()=>null);this.saving=!1,e?.success&&(this.hasKey=!!this.key,window.Alpine.store("app").toast(this.key?k.t("admin.dashboard.proxyKeySetSuccess"):k.t("admin.dashboard.proxyKeyRemoveSuccess"),"success"),this.key="",this.load())},async remove(){this.key="",await this.save()}}}function ad(){return{port:"",configPort:null,editing:!1,saving:!1,init(){this.load()},async load(){let e=await window.Alpine.store("app").fetch("/admin/port").catch(()=>null);this.configPort=e?.data?.port??null,this.port=this.configPort?String(this.configPort):""},toggleEdit(){this.editing=!this.editing,this.editing||(this.port=this.configPort?String(this.configPort):"")},async save(){this.saving=!0;let e=this.port?parseInt(this.port,10):null;if(this.port&&(isNaN(e)||e<1||e>65535)){window.Alpine.store("app").toast("Port must be between 1 and 65535","error"),this.saving=!1;return}let t=await window.Alpine.store("app").fetch("/admin/port",{method:"PUT",body:JSON.stringify({port:e})}).catch(()=>null);this.saving=!1,t?.success&&(window.Alpine.store("app").toast(k.t("admin.sidebar.portSetSuccess"),"success"),this.configPort=e,this.editing=!1)},async remove(){this.port="",await this.save()}}}var qo="\u8BF7\u8BE6\u7EC6\u63CF\u8FF0\u8FD9\u5F20\u56FE\u7247\u7684\u5185\u5BB9\uFF0C\u5305\u62EC\u5176\u4E2D\u7684\u6587\u5B57\u3001\u7269\u4F53\u3001\u573A\u666F\u3001\u989C\u8272\u7B49\u5173\u952E\u4FE1\u606F\u3002";function ld(){return{form:{enabled:!1,provider:"",model:"",prompt:""},providers:[],loading:!1,saving:!1,cache:{enabled:!1,hits:0,misses:0,size:0,maxEntries:0,hitRate:0},clearing:!1,init(){this.load()},async load(){this.loading=!0;let[e,t,i]=await Promise.all([window.Alpine.store("app").fetch("/admin/vision").catch(()=>null),window.Alpine.store("app").fetch("/admin/config").catch(()=>null),window.Alpine.store("app").fetch("/admin/vision-cache/stats").catch(()=>null)]);this.loading=!1,i?.data&&(this.cache=i.data),this.providers=t?.data?.providers||[];let n=e?.data;if(!(n&&(n.provider||n.model))){this.form={enabled:!1,provider:"",model:"",prompt:qo};return}this.form={enabled:!0,provider:"",model:"",prompt:""},await window.Alpine.nextTick(),this.form.provider=n.provider||"",await window.Alpine.nextTick(),this.form.model=n.model||"",this.form.prompt=n.prompt||qo},get availableModels(){let e=this.providers.find(t=>t.name===this.form.provider);return e?e.models:[]},providerHasImage(e){return(e.models||[]).some(t=>Array.isArray(t.input)&&t.input.includes("image"))},modelHasImage(e){return Array.isArray(e.input)&&e.input.includes("image")},selectedModelHasImage(){let e=this.providers.find(i=>i.name===this.form.provider);if(!e)return!1;let t=e.models.find(i=>i.id===this.form.model);return t?this.modelHasImage(t):!1},async save(){this.saving=!0;let e=this.form.prompt.trim(),t=e===qo?"":e,i=this.form.enabled?{provider:this.form.provider.trim(),model:this.form.model.trim(),prompt:t}:{provider:"",model:"",prompt:""},n=await window.Alpine.store("app").fetch("/admin/vision",{method:"PUT",body:JSON.stringify(i)}).catch(()=>null);if(this.saving=!1,n?.success)window.Alpine.store("app").toast(this.form.enabled?k.t("admin.vision.saved"):k.t("admin.vision.removed"),"success");else{let s=Vt(n,k.t("admin.vision.saveFailed"))||k.t("admin.vision.saveFailed");window.Alpine.store("app").toast(s,"error")}},async clearCache(){if(this.clearing||!window.confirm(k.t("admin.vision.cache.clearConfirm")))return;this.clearing=!0;let e=await window.Alpine.store("app").fetch("/admin/vision-cache/clear",{method:"POST"}).catch(()=>null);if(this.clearing=!1,e?.success)this.cache=e.data,window.Alpine.store("app").toast(k.t("admin.vision.cache.cleared"),"success");else{let t=Vt(e,k.t("admin.vision.cache.clearFailed"))||k.t("admin.vision.cache.clearFailed");window.Alpine.store("app").toast(t,"error")}},formatCacheStats(){if(!this.cache.enabled)return k.t("admin.vision.cache.disabled");let e=(this.cache.hitRate*100).toFixed(1)+"%";return k.t("admin.vision.cache.stats",{hits:this.cache.hits,misses:this.cache.misses,rate:e,size:this.cache.size,max:this.cache.maxEntries})}}}function cd(){let e=[{key:"requestIn",label:"\u5BA2\u6237\u7AEF\u2192\u4EE3\u7406",color:"var(--success)"},{key:"requestOut",label:"\u4EE3\u7406\u2192\u4E0A\u6E38",color:"var(--accent)"},{key:"responseIn",label:"\u4E0A\u6E38\u2192\u4EE3\u7406",color:"var(--success)"},{key:"responseOut",label:"\u4EE3\u7406\u2192\u5BA2\u6237\u7AEF",color:"var(--accent)"}],t=[];return{entries:[],selectedId:null,running:!1,es:null,sourceFilter:"",phases:e,init(){fetch("/admin/debug/captures/status").then(i=>i.json()).then(i=>{i.success&&i.data.enabled&&this.connectSSE()}).catch(()=>{})},async apiControl(i,n=!1){try{await fetch("/admin/debug/captures/control",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({enabled:i,clear:n})})}catch{}},fmtTime(i){let n=new Date(i),s=o=>String(o).padStart(2,"0");return`${n.getFullYear()}-${s(n.getMonth()+1)}-${s(n.getDate())} ${s(n.getHours())}:${s(n.getMinutes())}:${s(n.getSeconds())}`},fmtSize(i){if(!i)return"0B";let n=i.length;return n>1024?(n/1024).toFixed(1)+"KB":n+"B"},get sources(){return[...new Set(this.entries.map(i=>i.source))].sort()},get filteredEntries(){return this.sourceFilter?this.entries.filter(i=>i.source===this.sourceFilter):this.entries},connectSSE(){this.es&&(this.es.close(),this.es=null),this.running=!0,this.entries=[],this.selectedId=null,fetch("/admin/debug/captures").then(i=>i.json()).then(i=>{i.success&&(this.entries=i.data)}).catch(()=>{}),this.es=new EventSource("/admin/debug/captures/stream"),this.es.onmessage=i=>{try{let n=JSON.parse(i.data),s=this.entries.findIndex(o=>o.pairId===n.pairId);s>=0?(this.entries[s]=n,this.entries=this.entries.slice(),this.selectedId===n.id&&setTimeout(()=>this.renderEditors(),50)):(this.entries.push(n),this.entries.length>200&&(this.entries=this.entries.slice(-200)))}catch{}}},startCapture(){this.apiControl(!0,!0),this.connectSSE()},stopCapture(){this.apiControl(!1),this.running=!1,this.es?.close(),this.es=null},endCapture(){this.apiControl(!1,!0),this.running=!1,this.es?.close(),this.es=null,this.entries=[],this.selectedId=null},select(i){this.selectedId=this.selectedId===i?null:i,this.selectedId!==null&&setTimeout(()=>this.renderEditors(),50)},get selected(){return this.selectedId===null?null:this.entries.find(i=>i.id===this.selectedId)??null},renderEditors(){for(let o of t)o?.destroy();t=[];let i=this.selected;if(!i)return;let n=window.JSONEditor;if(!n)return;let s=document.querySelectorAll(".phase-editor-container");s.length!==0&&s.forEach((o,r)=>{let a=o;a.innerHTML="",a.style.cssText="overflow:auto;padding:12px;font-size:11px;font-family:monospace;white-space:pre-wrap;line-height:1.6;background:var(--surface);color:var(--text);border-radius:0;min-height:80px";let l=e[r];if(!l)return;let c=i[l.key];if(!c){a.textContent="(\u6682\u65E0\u6570\u636E)",a.style.display="flex",a.style.alignItems="center",a.style.justifyContent="center",a.style.color="var(--text-dim)";return}if(a.style.display="",l.key==="responseIn"||l.key==="responseOut"){a.textContent=c;return}try{let h=JSON.parse(c),u=new n(a,{mode:"tree",modes:["tree","code","text"],mainMenuBar:!1,navigationBar:!1,statusBar:!1,readOnly:!0},h);t.push(u)}catch{a.textContent=c}})},copyRaw(i){navigator.clipboard.writeText(i).catch(()=>{})}}}Ia();Z.magic("t",()=>(e,t)=>k.t(e,t));Na();Z.data("dashboardPage",ed);Z.data("logsPage",id);Z.data("providersPage",nd);Z.data("adaptersPage",od);Z.data("testPanel",sd);Z.data("proxyKeyForm",rd);Z.data("portSettingForm",ad);Z.data("visionSettingForm",ld);Z.data("capturePage",cd);window.Alpine=Z;document.addEventListener("alpine:init",()=>{let e=Z.store("app");e.loadDashboard(),e.startPolling()});Z.start();var dd=Z.store("app"),hd=()=>{let e=location.hash.slice(1);e&&dd.tabNames[e]&&dd.switchTab(e)};window.addEventListener("hashchange",hd);hd();
15
- /*! Bundled license information:
16
-
17
- @kurkle/color/dist/color.esm.js:
18
- (*!
19
- * @kurkle/color v0.3.4
20
- * https://github.com/kurkle/color#readme
21
- * (c) 2024 Jukka Kurkela
22
- * Released under the MIT License
23
- *)
24
-
25
- chart.js/dist/chunks/helpers.dataset.js:
26
- chart.js/dist/chart.js:
27
- (*!
28
- * Chart.js v4.5.1
29
- * https://www.chartjs.org
30
- * (c) 2025 Chart.js Contributors
31
- * Released under the MIT License
32
- *)
33
- */