PageSourceSearch

https://roboeye.robodost.ai/assets/index-BjrKPHbO.js

js robodost.ai collected 2026-10-05 15:48:03 UTC 1,596,756 bytes, 396 lines download raw bytes

vendor: 6,236 bytes, lines 1-9
1var b1=t=>{throw TypeError(t)};var ky=(t,e,r)=>e.has(t)||b1("Cannot "+r);var X=(t,e,r)=>(ky(t,e,"read from private field"),r?r.call(t):e.get(t)),Le=(t,e,r)=>e.has(t)?b1("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r),we=(t,e,r,n)=>(ky(t,e,"write to private field"),n?n.call(t,r):e.set(t,r),r),xr=(t,e,r)=>(ky(t,e,"access private method"),r);var vh=(t,e,r,n)=>({set _(i){we(t,e,i,r)},get _(){return X(t,e,n)}});function U4(t,e){for(var r=0;r<e.length;r++){const n=e[r];if(typeof n!="string"&&!Array.isArray(n)){for(const i in n)if(i!=="default"&&!(i in t)){const s=Object.getOwnPropertyDescriptor(n,i);s&&Object.defineProperty(t,i,s.get?s:{enumerable:!0,get:()=>n[i]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))n(i);new MutationObserver(i=>{for(const s of i)if(s.type==="childList")for(const a of s.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&n(a)}).observe(document,{childList:!0,subtree:!0});function r(i){const s={};return i.integrity&&(s.integrity=i.integrity),i.referrerPolicy&&(s.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?s.credentials="include":i.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function n(i){if(i.ep)return;i.ep=!0;const s=r(i);fetch(i.href,s)}})();var yh=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function at(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var _L={exports:{}},qg={},AL={exports:{}},Oe={};/**
2 * @license React
3 * react.production.min.js
4 *
5 * Copyright (c) Facebook, Inc. and its affiliates.
6 *
7 * This source code is licensed under the MIT license found in the
8 * LICENSE file in the root directory of this source tree.
9 */var zf=Symbol.for("react.element"),G4=Symbol.for("react.portal"),W4=Symbol.for("react.fragment"),V4=Symbol.for("react.strict_mode"),H4=Symbol.for("react.profiler"),K4=Symbol.for("react.provider"),z4=Symbol.for("react.context"),q4=Symbol.for("react.forward_ref"),Y4=Symbol.for("react.suspense"),X4=Symbol.for("react.memo"),Q4=Symbol.for("react.lazy"),x1=Symbol.iterator;function J4(t){return t===null||typeof t!="object"?null:(t=x1&&t[x1]||t["@@iterator"],typeof t=="function"?t:null)}var PL={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},IL=Object.assign,CL={};function Yc(t,e,r){this.props=t,this.context=e,this.refs=CL,this.updater=r||PL}Yc.prototype.isReactComponent={};Yc.prototype.setState=function(t,e){if(typeof t!="object"&&typeof t!="function"&&t!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,t,e,"setState")};Yc.prototype.forceUpdate=function(t){this.updater.enqueueForceUpdate(this,t,"forceUpdate")};function OL(){}OL.prototype=Yc.prototype;function rE(t,e,r){this.props=t,this.context=e,this.refs=CL,this.updater=r||PL}var nE=rE.prototype=new OL;nE.constructor=rE;IL(nE,Yc.prototype);nE.isPureReactComponent=!0;var w1=Array.isArray,RL=Object.prototype.hasOwnProperty,iE={current:null},kL={key:!0,ref:!0,__self:!0,__source:!0};function LL(t,e,r){var n,i={},s=null,a=null;if(e!=null)for(n in e.ref!==void 0&&(a=e.ref),e.key!==void 0&&(s=""+e.key),e)RL.call(e,n)&&!kL.hasOwnProperty(n)&&(i[n]=e[n]);var o=arguments.length-2;if(o===1)i.children=r;else if(1<o){for(var l=Array(o),c=0;c<o;c++)l[c]=arguments[c+2];i.children=l}if(t&&t.defaultProps)for(n in o=t.defaultProps,o)i[n]===void 0&&(i[n]=o[n]);return{$$typeof:zf,type:t,key:s,ref:a,props:i,_owner:iE.current}}function Z4(t,e){return{$$typeof:zf,type:t.type,key:e,ref:t.ref,props:t.props,_owner:t._owner}}function sE(t){return typeof t=="object"&&t!==null&&t.$$typeof===zf}function e8(t){var e={"=":"=0",":":"=2"};return"$"+t.replace(/[=:]/g,function(r){return e[r]})}var S1=/\/+/g;function Ly(t,e){return typeof t=="object"&&t!==null&&t.key!=null?e8(""+t.key):e.toString(36)}function Ap(t,e,r,n,i){var s=typeof t;(s==="undefined"||s==="boolean")&&(t=null);var a=!1;if(t===null)a=!0;else switch(s){case"string":case"number":a=!0;break;case"object":switch(t.$$typeof){case zf:case G4:a=!0}}if(a)return a=t,i=i(a),t=n===""?"."+Ly(a,0):n,w1(i)?(r="",t!=null&&(r=t.replace(S1,"$&/")+"/"),Ap(i,e,r,"",function(c){return c})):i!=null&&(sE(i)&&(i=Z4(i,r+(!i.key||a&&a.key===i.key?"":(""+i.key).replace(S1,"$&/")+"/")+t)),e.push(i)),1;if(a=0,n=n===""?".":n+":",w1(t))for(var o=0;o<t.length;o++){s=t[o];var l=n+Ly(s,o);a+=Ap(s,e,r,l,i)}else if(l=J4(t),typeof l=="function")for(t=l.call(t),o=0;!(s=t.next()).done;)s=s.value,l=n+Ly(s,o++),a+=Ap(s,e,r,l,i);else if(s==="object")throw e=String(t),Error("Objects are not valid as a React child (found: "+(e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)+"). If you meant to render a collection of children, use an array instead.");return a}function bh(t,e,r){if(t==null)return t;var n=[],i=0;return Ap(t,n,"","",function(s){return e.call(r,s,i++)}),n}function t8(t){if(t._status===-1){var e=t._result;e=e(),e.then(function(r){(t._status===0||t._status===-1)&&(t._status=1,t._result=r)},function(r){(t._status===0||t._status===-1)&&(t._status=2,t._result=r)}),t._status===-1&&(t._status=0,t._result=e)}if(t._status===1)return t._result.default;throw t._result}var Nr={current:null},Pp={transition:null},r8={ReactCurrentDispatcher:Nr,ReactCurrentBatchConfig:Pp,ReactCurrentOwner:iE};function DL(){throw Error("act(...) is not supported in production builds of React.")}Oe.Children={map:bh,forEach:function(t,e,r){bh(t,function(){e.apply(this,arguments)},r)},count:function(t){var e=0;return bh(t,function(){e++}),e},toArray:function(t){return bh(t,function(e){return e})||[]},only:function(t){if(!sE(t))throw Error("React.Children.only expected to receive a single React element child.");return t}};Oe.Component=Yc;Oe.Fragment=W4;Oe.Profiler=H4;Oe.PureComponent=rE;Oe.StrictMode=V4;Oe.Suspense=Y4;
vendor: 5,045 bytes, lines 9-25
9Oe.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=r8;Oe.act=DL;Oe.cloneElement=function(t,e,r){if(t==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+t+".");var n=IL({},t.props),i=t.key,s=t.ref,a=t._owner;if(e!=null){if(e.ref!==void 0&&(s=e.ref,a=iE.current),e.key!==void 0&&(i=""+e.key),t.type&&t.type.defaultProps)var o=t.type.defaultProps;for(l in e)RL.call(e,l)&&!kL.hasOwnProperty(l)&&(n[l]=e[l]===void 0&&o!==void 0?o[l]:e[l])}var l=arguments.length-2;if(l===1)n.children=r;else if(1<l){o=Array(l);for(var c=0;c<l;c++)o[c]=arguments[c+2];n.children=o}return{$$typeof:zf,type:t.type,key:i,ref:s,props:n,_owner:a}};Oe.createContext=function(t){return t={$$typeof:z4,_currentValue:t,_currentValue2:t,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},t.Provider={$$typeof:K4,_context:t},t.Consumer=t};Oe.createElement=LL;Oe.createFactory=function(t){var e=LL.bind(null,t);return e.type=t,e};Oe.createRef=function(){return{current:null}};Oe.forwardRef=function(t){return{$$typeof:q4,render:t}};Oe.isValidElement=sE;Oe.lazy=function(t){return{$$typeof:Q4,_payload:{_status:-1,_result:t},_init:t8}};Oe.memo=function(t,e){return{$$typeof:X4,type:t,compare:e===void 0?null:e}};Oe.startTransition=function(t){var e=Pp.transition;Pp.transition={};try{t()}finally{Pp.transition=e}};Oe.unstable_act=DL;Oe.useCallback=function(t,e){return Nr.current.useCallback(t,e)};Oe.useContext=function(t){return Nr.current.useContext(t)};Oe.useDebugValue=function(){};Oe.useDeferredValue=function(t){return Nr.current.useDeferredValue(t)};Oe.useEffect=function(t,e){return Nr.current.useEffect(t,e)};Oe.useId=function(){return Nr.current.useId()};Oe.useImperativeHandle=function(t,e,r){return Nr.current.useImperativeHandle(t,e,r)};Oe.useInsertionEffect=function(t,e){return Nr.current.useInsertionEffect(t,e)};Oe.useLayoutEffect=function(t,e){return Nr.current.useLayoutEffect(t,e)};Oe.useMemo=function(t,e){return Nr.current.useMemo(t,e)};Oe.useReducer=function(t,e,r){return Nr.current.useReducer(t,e,r)};Oe.useRef=function(t){return Nr.current.useRef(t)};Oe.useState=function(t){return Nr.current.useState(t)};Oe.useSyncExternalStore=function(t,e,r){return Nr.current.useSyncExternalStore(t,e,r)};Oe.useTransition=function(){return Nr.current.useTransition()};Oe.version="18.3.1";AL.exports=Oe;var E=AL.exports;const F=at(E),Yg=U4({__proto__:null,default:F},[E]);/**
10 * @license React
11 * react-jsx-runtime.production.min.js
12 *
13 * Copyright (c) Facebook, Inc. and its affiliates.
14 *
15 * This source code is licensed under the MIT license found in the
16 * LICENSE file in the root directory of this source tree.
17 */var n8=E,i8=Symbol.for("react.element"),s8=Symbol.for("react.fragment"),a8=Object.prototype.hasOwnProperty,o8=n8.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,l8={key:!0,ref:!0,__self:!0,__source:!0};function NL(t,e,r){var n,i={},s=null,a=null;r!==void 0&&(s=""+r),e.key!==void 0&&(s=""+e.key),e.ref!==void 0&&(a=e.ref);for(n in e)a8.call(e,n)&&!l8.hasOwnProperty(n)&&(i[n]=e[n]);if(t&&t.defaultProps)for(n in e=t.defaultProps,e)i[n]===void 0&&(i[n]=e[n]);return{$$typeof:i8,type:t,key:s,ref:a,props:i,_owner:o8.current}}qg.Fragment=s8;qg.jsx=NL;qg.jsxs=NL;_L.exports=qg;var x=_L.exports,ML={exports:{}},gn={},$L={exports:{}},jL={};/**
18 * @license React
19 * scheduler.production.min.js
20 *
21 * Copyright (c) Facebook, Inc. and its affiliates.
22 *
23 * This source code is licensed under the MIT license found in the
24 * LICENSE file in the root directory of this source tree.
25 */(function(t){function e(k,$){var U=k.length;k.push($);e:for(;0<U;){var G=U-1>>>1,B=k[G];if(0<i(B,$))k[G]=$,k[U]=B,U=G;else break e}}function r(k){return k.length===0?null:k[0]}function n(k){if(k.length===0)return null;var $=k[0],U=k.pop();if(U!==$){k[0]=U;e:for(var G=0,B=k.length,K=B>>>1;G<K;){var ee=2*(G+1)-1,H=k[ee],J=ee+1,q=k[J];if(0>i(H,U))J<B&&0>i(q,H)?(k[G]=q,k[J]=U,G=J):(k[G]=H,k[ee]=U,G=ee);else if(J<B&&0>i(q,U))k[G]=q,k[J]=U,G=J;else break e}}return $}function i(k,$){var U=k.sortIndex-$.sortIndex;return U!==0?U:k.id-$.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;t.unstable_now=function(){return s.now()}}else{var a=Date,o=a.now();t.unstable_now=function(){return a.now()-o}}var l=[],c=[],u=1,d=null,f=3,h=!1,p=!1,g=!1,m=typeof setTimeout=="function"?setTimeout:null,v=typeof clearTimeout=="function"?clearTimeout:null,y=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function b(k){for(var $=r(c);$!==null;){if($.callback===null)n(c);else if($.startTime<=k)n(c),$.sortIndex=$.expirationTime,e(l,$);else break;$=r(c)}}function w(k){if(g=!1,b(k),!p)if(r(l)!==null)p=!0,M(S);else{var $=r(c);$!==null&&N(w,$.startTime-k)}}function S(k,$){p=!1,g&&(g=!1,v(A),A=-1),h=!0;var U=f;try{for(b($),d=r(l);d!==null&&(!(d.expirationTime>$)||k&&!O());){var G=d.callback;
vendor: 9,156 bytes, lines 25-34
25if(typeof G=="function"){d.callback=null,f=d.priorityLevel;var B=G(d.expirationTime<=$);$=t.unstable_now(),typeof B=="function"?d.callback=B:d===r(l)&&n(l),b($)}else n(l);d=r(l)}if(d!==null)var K=!0;else{var ee=r(c);ee!==null&&N(w,ee.startTime-$),K=!1}return K}finally{d=null,f=U,h=!1}}var T=!1,_=null,A=-1,P=5,C=-1;function O(){return!(t.unstable_now()-C<P)}function R(){if(_!==null){var k=t.unstable_now();C=k;var $=!0;try{$=_(!0,k)}finally{$?D():(T=!1,_=null)}}else T=!1}var D;if(typeof y=="function")D=function(){y(R)};else if(typeof MessageChannel<"u"){var L=new MessageChannel,j=L.port2;L.port1.onmessage=R,D=function(){j.postMessage(null)}}else D=function(){m(R,0)};function M(k){_=k,T||(T=!0,D())}function N(k,$){A=m(function(){k(t.unstable_now())},$)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(k){k.callback=null},t.unstable_continueExecution=function(){p||h||(p=!0,M(S))},t.unstable_forceFrameRate=function(k){0>k||125<k?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):P=0<k?Math.floor(1e3/k):5},t.unstable_getCurrentPriorityLevel=function(){return f},t.unstable_getFirstCallbackNode=function(){return r(l)},t.unstable_next=function(k){switch(f){case 1:case 2:case 3:var $=3;break;default:$=f}var U=f;f=$;try{return k()}finally{f=U}},t.unstable_pauseExecution=function(){},t.unstable_requestPaint=function(){},t.unstable_runWithPriority=function(k,$){switch(k){case 1:case 2:case 3:case 4:case 5:break;default:k=3}var U=f;f=k;try{return $()}finally{f=U}},t.unstable_scheduleCallback=function(k,$,U){var G=t.unstable_now();switch(typeof U=="object"&&U!==null?(U=U.delay,U=typeof U=="number"&&0<U?G+U:G):U=G,k){case 1:var B=-1;break;case 2:B=250;break;case 5:B=1073741823;break;case 4:B=1e4;break;default:B=5e3}return B=U+B,k={id:u++,callback:$,priorityLevel:k,startTime:U,expirationTime:B,sortIndex:-1},U>G?(k.sortIndex=U,e(c,k),r(l)===null&&k===r(c)&&(g?(v(A),A=-1):g=!0,N(w,U-G))):(k.sortIndex=B,e(l,k),p||h||(p=!0,M(S))),k},t.unstable_shouldYield=O,t.unstable_wrapCallback=function(k){var $=f;return function(){var U=f;f=$;try{return k.apply(this,arguments)}finally{f=U}}}})(jL);$L.exports=jL;var c8=$L.exports;/**
26 * @license React
27 * react-dom.production.min.js
28 *
29 * Copyright (c) Facebook, Inc. and its affiliates.
30 *
31 * This source code is licensed under the MIT license found in the
32 * LICENSE file in the root directory of this source tree.
33 */var u8=E,pn=c8;function te(t){for(var e="https://reactjs.org/docs/error-decoder.html?invariant="+t,r=1;r<arguments.length;r++)e+="&args[]="+encodeURIComponent(arguments[r]);return"Minified React error #"+t+"; visit "+e+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var FL=new Set,Ed={};function Ko(t,e){pc(t,e),pc(t+"Capture",e)}function pc(t,e){for(Ed[t]=e,t=0;t<e.length;t++)FL.add(e[t])}var ms=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Mb=Object.prototype.hasOwnProperty,d8=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,E1={},T1={};function f8(t){return Mb.call(T1,t)?!0:Mb.call(E1,t)?!1:d8.test(t)?T1[t]=!0:(E1[t]=!0,!1)}function h8(t,e,r,n){if(r!==null&&r.type===0)return!1;switch(typeof e){case"function":case"symbol":return!0;case"boolean":return n?!1:r!==null?!r.acceptsBooleans:(t=t.toLowerCase().slice(0,5),t!=="data-"&&t!=="aria-");default:return!1}}function p8(t,e,r,n){if(e===null||typeof e>"u"||h8(t,e,r,n))return!0;if(n)return!1;if(r!==null)switch(r.type){case 3:return!e;case 4:return e===!1;case 5:return isNaN(e);case 6:return isNaN(e)||1>e}return!1}function Mr(t,e,r,n,i,s,a){this.acceptsBooleans=e===2||e===3||e===4,this.attributeName=n,this.attributeNamespace=i,this.mustUseProperty=r,this.propertyName=t,this.type=e,this.sanitizeURL=s,this.removeEmptyString=a}var yr={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(t){yr[t]=new Mr(t,0,!1,t,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(t){var e=t[0];yr[e]=new Mr(e,1,!1,t[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(t){yr[t]=new Mr(t,2,!1,t.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(t){yr[t]=new Mr(t,2,!1,t,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(t){yr[t]=new Mr(t,3,!1,t.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(t){yr[t]=new Mr(t,3,!0,t,null,!1,!1)});["capture","download"].forEach(function(t){yr[t]=new Mr(t,4,!1,t,null,!1,!1)});["cols","rows","size","span"].forEach(function(t){yr[t]=new Mr(t,6,!1,t,null,!1,!1)});["rowSpan","start"].forEach(function(t){yr[t]=new Mr(t,5,!1,t.toLowerCase(),null,!1,!1)});var aE=/[\-:]([a-z])/g;function oE(t){return t[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(t){var e=t.replace(aE,oE);yr[e]=new Mr(e,1,!1,t,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(t){var e=t.replace(aE,oE);yr[e]=new Mr(e,1,!1,t,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(t){var e=t.replace(aE,oE);yr[e]=new Mr(e,1,!1,t,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(t){yr[t]=new Mr(t,1,!1,t.toLowerCase(),null,!1,!1)});yr.xlinkHref=new Mr("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(t){yr[t]=new Mr(t,1,!1,t.toLowerCase(),null,!0,!0)});function lE(t,e,r,n){var i=yr.hasOwnProperty(e)?yr[e]:null;(i!==null?i.type!==0:n||!(2<e.length)||e[0]!=="o"&&e[0]!=="O"||e[1]!=="n"&&e[1]!=="N")&&(p8(e,r,i,n)&&(r=null),n||i===null?f8(e)&&(r===null?t.removeAttribute(e):t.setAttribute(e,""+r)):i.mustUseProperty?t[i.propertyName]=r===null?i.type===3?!1:"":r:(e=i.attributeName,n=i.attributeNamespace,r===null?t.removeAttribute(e):(i=i.type,r=i===3||i===4&&r===!0?"":""+r,n?t.setAttributeNS(n,e,r):t.setAttribute(e,r))))}var _s=u8.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,xh=Symbol.for("react.element"),_l=Symbol.for("react.portal"),Al=Symbol.for("react.fragment"),cE=Symbol.for("react.strict_mode"),$b=Symbol.for("react.profiler"),BL=Symbol.for("react.provider"),UL=Symbol.for("react.context"),uE=Symbol.for("react.forward_ref"),jb=Symbol.for("react.suspense"),Fb=Symbol.for("react.suspense_list"),dE=Symbol.for("react.memo"),Vs=Symbol.for("react.lazy"),GL=Symbol.for("react.offscreen"),_1=Symbol.iterator;function Eu(t){return t===null||typeof t!="object"?null:(t=_1&&t[_1]||t["@@iterator"],typeof t=="function"?t:null)}var At=Object.assign,Dy;function zu(t){if(Dy===void 0)try{throw Error()}catch(r){var e=r.stack.trim().match(/\n( *(at )?)/);Dy=e&&e[1]||""}return`
34`+Dy+t}var Ny=!1;function My(t,e){if(!t||Ny)return"";Ny=!0;var r=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(e)if(e=function(){throw Error()},Object.defineProperty(e.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(e,[])}catch(c){var n=c}Reflect.construct(t,[],e)}else{try{e.call()}catch(c){n=c}t.call(e.prototype)}else{try{throw Error()}catch(c){n=c}t()}}
vendor: 16,599 bytes, lines 34-37
34catch(c){if(c&&n&&typeof c.stack=="string"){for(var i=c.stack.split(`
35`),s=n.stack.split(`
36`),a=i.length-1,o=s.length-1;1<=a&&0<=o&&i[a]!==s[o];)o--;for(;1<=a&&0<=o;a--,o--)if(i[a]!==s[o]){if(a!==1||o!==1)do if(a--,o--,0>o||i[a]!==s[o]){var l=`
37`+i[a].replace(" at new "," at ");return t.displayName&&l.includes("<anonymous>")&&(l=l.replace("<anonymous>",t.displayName)),l}while(1<=a&&0<=o);break}}}finally{Ny=!1,Error.prepareStackTrace=r}return(t=t?t.displayName||t.name:"")?zu(t):""}function m8(t){switch(t.tag){case 5:return zu(t.type);case 16:return zu("Lazy");case 13:return zu("Suspense");case 19:return zu("SuspenseList");case 0:case 2:case 15:return t=My(t.type,!1),t;case 11:return t=My(t.type.render,!1),t;case 1:return t=My(t.type,!0),t;default:return""}}function Bb(t){if(t==null)return null;if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case Al:return"Fragment";case _l:return"Portal";case $b:return"Profiler";case cE:return"StrictMode";case jb:return"Suspense";case Fb:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case UL:return(t.displayName||"Context")+".Consumer";case BL:return(t._context.displayName||"Context")+".Provider";case uE:var e=t.render;return t=t.displayName,t||(t=e.displayName||e.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case dE:return e=t.displayName||null,e!==null?e:Bb(t.type)||"Memo";case Vs:e=t._payload,t=t._init;try{return Bb(t(e))}catch{}}return null}function g8(t){var e=t.type;switch(t.tag){case 24:return"Cache";case 9:return(e.displayName||"Context")+".Consumer";case 10:return(e._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return t=e.render,t=t.displayName||t.name||"",e.displayName||(t!==""?"ForwardRef("+t+")":"ForwardRef");case 7:return"Fragment";case 5:return e;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Bb(e);case 8:return e===cE?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e}return null}function xa(t){switch(typeof t){case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function WL(t){var e=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function v8(t){var e=WL(t)?"checked":"value",r=Object.getOwnPropertyDescriptor(t.constructor.prototype,e),n=""+t[e];if(!t.hasOwnProperty(e)&&typeof r<"u"&&typeof r.get=="function"&&typeof r.set=="function"){var i=r.get,s=r.set;return Object.defineProperty(t,e,{configurable:!0,get:function(){return i.call(this)},set:function(a){n=""+a,s.call(this,a)}}),Object.defineProperty(t,e,{enumerable:r.enumerable}),{getValue:function(){return n},setValue:function(a){n=""+a},stopTracking:function(){t._valueTracker=null,delete t[e]}}}}function wh(t){t._valueTracker||(t._valueTracker=v8(t))}function VL(t){if(!t)return!1;var e=t._valueTracker;if(!e)return!0;var r=e.getValue(),n="";return t&&(n=WL(t)?t.checked?"true":"false":t.value),t=n,t!==r?(e.setValue(t),!0):!1}function em(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}function Ub(t,e){var r=e.checked;return At({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:r??t._wrapperState.initialChecked})}function A1(t,e){var r=e.defaultValue==null?"":e.defaultValue,n=e.checked!=null?e.checked:e.defaultChecked;r=xa(e.value!=null?e.value:r),t._wrapperState={initialChecked:n,initialValue:r,controlled:e.type==="checkbox"||e.type==="radio"?e.checked!=null:e.value!=null}}function HL(t,e){e=e.checked,e!=null&&lE(t,"checked",e,!1)}function Gb(t,e){HL(t,e);var r=xa(e.value),n=e.type;if(r!=null)n==="number"?(r===0&&t.value===""||t.value!=r)&&(t.value=""+r):t.value!==""+r&&(t.value=""+r);else if(n==="submit"||n==="reset"){t.removeAttribute("value");return}e.hasOwnProperty("value")?Wb(t,e.type,r):e.hasOwnProperty("defaultValue")&&Wb(t,e.type,xa(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(t.defaultChecked=!!e.defaultChecked)}function P1(t,e,r){if(e.hasOwnProperty("value")||e.hasOwnProperty("defaultValue")){var n=e.type;if(!(n!=="submit"&&n!=="reset"||e.value!==void 0&&e.value!==null))return;e=""+t._wrapperState.initialValue,r||e===t.value||(t.value=e),t.defaultValue=e}r=t.name,r!==""&&(t.name=""),t.defaultChecked=!!t._wrapperState.initialChecked,r!==""&&(t.name=r)}function Wb(t,e,r){(e!=="number"||em(t.ownerDocument)!==t)&&(r==null?t.defaultValue=""+t._wrapperState.initialValue:t.defaultValue!==""+r&&(t.defaultValue=""+r))}var qu=Array.isArray;function Gl(t,e,r,n){if(t=t.options,e){e={};for(var i=0;i<r.length;i++)e["$"+r[i]]=!0;for(r=0;r<t.length;r++)i=e.hasOwnProperty("$"+t[r].value),t[r].selected!==i&&(t[r].selected=i),i&&n&&(t[r].defaultSelected=!0)}else{for(r=""+xa(r),e=null,i=0;i<t.length;i++){if(t[i].value===r){t[i].selected=!0,n&&(t[i].defaultSelected=!0);return}e!==null||t[i].disabled||(e=t[i])}e!==null&&(e.selected=!0)}}function Vb(t,e){if(e.dangerouslySetInnerHTML!=null)throw Error(te(91));return At({},e,{value:void 0,defaultValue:void 0,children:""+t._wrapperState.initialValue})}function I1(t,e){var r=e.value;if(r==null){if(r=e.children,e=e.defaultValue,r!=null){if(e!=null)throw Error(te(92));if(qu(r)){if(1<r.length)throw Error(te(93));r=r[0]}e=r}e==null&&(e=""),r=e}t._wrapperState={initialValue:xa(r)}}function KL(t,e){var r=xa(e.value),n=xa(e.defaultValue);r!=null&&(r=""+r,r!==t.value&&(t.value=r),e.defaultValue==null&&t.defaultValue!==r&&(t.defaultValue=r)),n!=null&&(t.defaultValue=""+n)}function C1(t){var e=t.textContent;e===t._wrapperState.initialValue&&e!==""&&e!==null&&(t.value=e)}function zL(t){switch(t){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function Hb(t,e){return t==null||t==="http://www.w3.org/1999/xhtml"?zL(e):t==="http://www.w3.org/2000/svg"&&e==="foreignObject"?"http://www.w3.org/1999/xhtml":t}var Sh,qL=function(t){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(e,r,n,i){MSApp.execUnsafeLocalFunction(function(){return t(e,r,n,i)})}:t}(function(t,e){if(t.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in t)t.innerHTML=e;else{for(Sh=Sh||document.createElement("div"),Sh.innerHTML="<svg>"+e.valueOf().toString()+"</svg>",e=Sh.firstChild;t.firstChild;)t.removeChild(t.firstChild);for(;e.firstChild;)t.appendChild(e.firstChild)}});function Td(t,e){if(e){var r=t.firstChild;if(r&&r===t.lastChild&&r.nodeType===3){r.nodeValue=e;return}}t.textContent=e}var nd={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},y8=["Webkit","ms","Moz","O"];Object.keys(nd).forEach(function(t){y8.forEach(function(e){e=e+t.charAt(0).toUpperCase()+t.substring(1),nd[e]=nd[t]})});function YL(t,e,r){return e==null||typeof e=="boolean"||e===""?"":r||typeof e!="number"||e===0||nd.hasOwnProperty(t)&&nd[t]?(""+e).trim():e+"px"}function XL(t,e){t=t.style;for(var r in e)if(e.hasOwnProperty(r)){var n=r.indexOf("--")===0,i=YL(r,e[r],n);r==="float"&&(r="cssFloat"),n?t.setProperty(r,i):t[r]=i}}var b8=At({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function Kb(t,e){if(e){if(b8[t]&&(e.children!=null||e.dangerouslySetInnerHTML!=null))throw Error(te(137,t));if(e.dangerouslySetInnerHTML!=null){if(e.children!=null)throw Error(te(60));if(typeof e.dangerouslySetInnerHTML!="object"||!("__html"in e.dangerouslySetInnerHTML))throw Error(te(61))}if(e.style!=null&&typeof e.style!="object")throw Error(te(62))}}function zb(t,e){if(t.indexOf("-")===-1)return typeof e.is=="string";switch(t){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var qb=null;function fE(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var Yb=null,Wl=null,Vl=null;function O1(t){if(t=Xf(t)){if(typeof Yb!="function")throw Error(te(280));var e=t.stateNode;e&&(e=ev(e),Yb(t.stateNode,t.type,e))}}function QL(t){Wl?Vl?Vl.push(t):Vl=[t]:Wl=t}function JL(){if(Wl){var t=Wl,e=Vl;if(Vl=Wl=null,O1(t),e)for(t=0;t<e.length;t++)O1(e[t])}}function ZL(t,e){return t(e)}function eD(){}var $y=!1;function tD(t,e,r){if($y)return t(e,r);$y=!0;try{return ZL(t,e,r)}finally{$y=!1,(Wl!==null||Vl!==null)&&(eD(),JL())}}function _d(t,e){var r=t.stateNode;if(r===null)return null;var n=ev(r);if(n===null)return null;r=n[e];e:switch(e){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(n=!n.disabled)||(t=t.type,n=!(t==="button"||t==="input"||t==="select"||t==="textarea")),t=!n;break e;default:t=!1}if(t)return null;if(r&&typeof r!="function")throw Error(te(231,e,typeof r));return r}var Xb=!1;if(ms)try{var Tu={};Object.defineProperty(Tu,"passive",{get:function(){Xb=!0}}),window.addEventListener("test",Tu,Tu),window.removeEventListener("test",Tu,Tu)}catch{Xb=!1}function x8(t,e,r,n,i,s,a,o,l){var c=Array.prototype.slice.call(arguments,3);try{e.apply(r,c)}catch(u){this.onError(u)}}var id=!1,tm=null,rm=!1,Qb=null,w8={onError:function(t){id=!0,tm=t}};function S8(t,e,r,n,i,s,a,o,l){id=!1,tm=null,x8.apply(w8,arguments)}function E8(t,e,r,n,i,s,a,o,l){if(S8.apply(this,arguments),id){if(id){var c=tm;id=!1,tm=null}else throw Error(te(198));rm||(rm=!0,Qb=c)}}function zo(t){var e=t,r=t;if(t.alternate)for(;e.return;)e=e.return;else{t=e;do e=t,e.flags&4098&&(r=e.return),t=e.return;while(t)}return e.tag===3?r:null}function rD(t){if(t.tag===13){var e=t.memoizedState;if(e===null&&(t=t.alternate,t!==null&&(e=t.memoizedState)),e!==null)return e.dehydrated}return null}function R1(t){if(zo(t)!==t)throw Error(te(188))}function T8(t){var e=t.alternate;if(!e){if(e=zo(t),e===null)throw Error(te(188));return e!==t?null:t}for(var r=t,n=e;;){var i=r.return;if(i===null)break;var s=i.alternate;if(s===null){if(n=i.return,n!==null){r=n;continue}break}if(i.child===s.child){for(s=i.child;s;){if(s===r)return R1(i),t;if(s===n)return R1(i),e;s=s.sibling}throw Error(te(188))}if(r.return!==n.return)r=i,n=s;else{for(var a=!1,o=i.child;o;){if(o===r){a=!0,r=i,n=s;break}if(o===n){a=!0,n=i,r=s;break}o=o.sibling}if(!a){for(o=s.child;o;){if(o===r){a=!0,r=s,n=i;break}if(o===n){a=!0,n=s,r=i;break}o=o.sibling}if(!a)throw Error(te(189))}}if(r.alternate!==n)throw Error(te(190))}if(r.tag!==3)throw Error(te(188));return r.stateNode.current===r?t:e}function nD(t){return t=T8(t),t!==null?iD(t):null}function iD(t){if(t.tag===5||t.tag===6)return t;for(t=t.child;t!==null;){var e=iD(t);if(e!==null)return e;t=t.sibling}return null}var sD=pn.unstable_scheduleCallback,k1=pn.unstable_cancelCallback,_8=pn.unstable_shouldYield,A8=pn.unstable_requestPaint,Lt=pn.unstable_now,P8=pn.unstable_getCurrentPriorityLevel,hE=pn.unstable_ImmediatePriority,aD=pn.unstable_UserBlockingPriority,nm=pn.unstable_NormalPriority,I8=pn.unstable_LowPriority,oD=pn.unstable_IdlePriority,Xg=null,ki=null;function C8(t){if(ki&&typeof ki.onCommitFiberRoot=="function")try{ki.onCommitFiberRoot(Xg,t,void 0,(t.current.flags&128)===128)}catch{}}var ai=Math.clz32?Math.clz32:k8,O8=Math.log,R8=Math.LN2;function k8(t){return t>>>=0,t===0?32:31-(O8(t)/R8|0)|0}var Eh=64,Th=4194304;function Yu(t){switch(t&-t){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return t&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return t}}function im(t,e){var r=t.pendingLanes;if(r===0)return 0;var n=0,i=t.suspendedLanes,s=t.pingedLanes,a=r&268435455;if(a!==0){var o=a&~i;o!==0?n=Yu(o):(s&=a,s!==0&&(n=Yu(s)))}else a=r&~i,a!==0?n=Yu(a):s!==0&&(n=Yu(s));if(n===0)return 0;if(e!==0&&e!==n&&!(e&i)&&(i=n&-n,s=e&-e,i>=s||i===16&&(s&4194240)!==0))return e;if(n&4&&(n|=r&16),e=t.entangledLanes,e!==0)for(t=t.entanglements,e&=n;0<e;)r=31-ai(e),i=1<<r,n|=t[r],e&=~i;return n}function L8(t,e){switch(t){case 1:case 2:case 4:return e+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function D8(t,e){for(var r=t.suspendedLanes,n=t.pingedLanes,i=t.expirationTimes,s=t.pendingLanes;0<s;){var a=31-ai(s),o=1<<a,l=i[a];l===-1?(!(o&r)||o&n)&&(i[a]=L8(o,e)):l<=e&&(t.expiredLanes|=o),s&=~o}}function Jb(t){return t=t.pendingLanes&-1073741825,t!==0?t:t&1073741824?1073741824:0}function lD(){var t=Eh;return Eh<<=1,!(Eh&4194240)&&(Eh=64),t}function jy(t){for(var e=[],r=0;31>r;r++)e.push(t);return e}function qf(t,e,r){t.pendingLanes|=e,e!==536870912&&(t.suspendedLanes=0,t.pingedLanes=0),t=t.eventTimes,e=31-ai(e),t[e]=r}function N8(t,e){var r=t.pendingLanes&~e;t.pendingLanes=e,t.suspendedLanes=0,t.pingedLanes=0,t.expiredLanes&=e,t.mutableReadLanes&=e,t.entangledLanes&=e,e=t.entanglements;var n=t.eventTimes;for(t=t.expirationTimes;0<r;){var i=31-ai(r),s=1<<i;e[i]=0,n[i]=-1,t[i]=-1,r&=~s}}function pE(t,e){var r=t.entangledLanes|=e;for(t=t.entanglements;r;){var n=31-ai(r),i=1<<n;i&e|t[n]&e&&(t[n]|=e),r&=~i}}var Ye=0;function cD(t){return t&=-t,1<t?4<t?t&268435455?16:536870912:4:1}var uD,mE,dD,fD,hD,Zb=!1,_h=[],ca=null,ua=null,da=null,Ad=new Map,Pd=new Map,Xs=[],M8="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset submit".split(" ");function L1(t,e){switch(t){case"focusin":case"focusout":ca=null;break;case"dragenter":case"dragleave":ua=null;break;case"mouseover":case"mouseout":da=null;break;case"pointerover":case"pointerout":Ad.delete(e.pointerId);break;case"gotpointercapture":case"lostpointercapture":Pd.delete(e.pointerId)}}function _u(t,e,r,n,i,s){return t===null||t.nativeEvent!==s?(t={blockedOn:e,domEventName:r,eventSystemFlags:n,nativeEvent:s,targetContainers:[i]},e!==null&&(e=Xf(e),e!==null&&mE(e)),t):(t.eventSystemFlags|=n,e=t.targetContainers,i!==null&&e.indexOf(i)===-1&&e.push(i),t)}function $8(t,e,r,n,i){switch(e){case"focusin":return ca=_u(ca,t,e,r,n,i),!0;case"dragenter":return ua=_u(ua,t,e,r,n,i),!0;case"mouseover":return da=_u(da,t,e,r,n,i),!0;case"pointerover":var s=i.pointerId;return Ad.set(s,_u(Ad.get(s)||null,t,e,r,n,i)),!0;case"gotpointercapture":return s=i.pointerId,Pd.set(s,_u(Pd.get(s)||null,t,e,r,n,i)),!0}return!1}function pD(t){var e=so(t.target);if(e!==null){var r=zo(e);if(r!==null){if(e=r.tag,e===13){if(e=rD(r),e!==null){t.blockedOn=e,hD(t.priority,function(){dD(r)});return}}else if(e===3&&r.stateNode.current.memoizedState.isDehydrated){t.blockedOn=r.tag===3?r.stateNode.containerInfo:null;return}}}t.blockedOn=null}function Ip(t){if(t.blockedOn!==null)return!1;for(var e=t.targetContainers;0<e.length;){var r=ex(t.domEventName,t.eventSystemFlags,e[0],t.nativeEvent);if(r===null){r=t.nativeEvent;var n=new r.constructor(r.type,r);qb=n,r.target.dispatchEvent(n),qb=null}else return e=Xf(r),e!==null&&mE(e),t.blockedOn=r,!1;e.shift()}return!0}
vendor: 11,995 bytes, line 37
37function D1(t,e,r){Ip(t)&&r.delete(e)}function j8(){Zb=!1,ca!==null&&Ip(ca)&&(ca=null),ua!==null&&Ip(ua)&&(ua=null),da!==null&&Ip(da)&&(da=null),Ad.forEach(D1),Pd.forEach(D1)}function Au(t,e){t.blockedOn===e&&(t.blockedOn=null,Zb||(Zb=!0,pn.unstable_scheduleCallback(pn.unstable_NormalPriority,j8)))}function Id(t){function e(i){return Au(i,t)}if(0<_h.length){Au(_h[0],t);for(var r=1;r<_h.length;r++){var n=_h[r];n.blockedOn===t&&(n.blockedOn=null)}}for(ca!==null&&Au(ca,t),ua!==null&&Au(ua,t),da!==null&&Au(da,t),Ad.forEach(e),Pd.forEach(e),r=0;r<Xs.length;r++)n=Xs[r],n.blockedOn===t&&(n.blockedOn=null);for(;0<Xs.length&&(r=Xs[0],r.blockedOn===null);)pD(r),r.blockedOn===null&&Xs.shift()}var Hl=_s.ReactCurrentBatchConfig,sm=!0;function F8(t,e,r,n){var i=Ye,s=Hl.transition;Hl.transition=null;try{Ye=1,gE(t,e,r,n)}finally{Ye=i,Hl.transition=s}}function B8(t,e,r,n){var i=Ye,s=Hl.transition;Hl.transition=null;try{Ye=4,gE(t,e,r,n)}finally{Ye=i,Hl.transition=s}}function gE(t,e,r,n){if(sm){var i=ex(t,e,r,n);if(i===null)qy(t,e,n,am,r),L1(t,n);else if($8(i,t,e,r,n))n.stopPropagation();else if(L1(t,n),e&4&&-1<M8.indexOf(t)){for(;i!==null;){var s=Xf(i);if(s!==null&&uD(s),s=ex(t,e,r,n),s===null&&qy(t,e,n,am,r),s===i)break;i=s}i!==null&&n.stopPropagation()}else qy(t,e,n,null,r)}}var am=null;function ex(t,e,r,n){if(am=null,t=fE(n),t=so(t),t!==null)if(e=zo(t),e===null)t=null;else if(r=e.tag,r===13){if(t=rD(e),t!==null)return t;t=null}else if(r===3){if(e.stateNode.current.memoizedState.isDehydrated)return e.tag===3?e.stateNode.containerInfo:null;t=null}else e!==t&&(t=null);return am=t,null}function mD(t){switch(t){case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 1;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(P8()){case hE:return 1;case aD:return 4;case nm:case I8:return 16;case oD:return 536870912;default:return 16}default:return 16}}var sa=null,vE=null,Cp=null;function gD(){if(Cp)return Cp;var t,e=vE,r=e.length,n,i="value"in sa?sa.value:sa.textContent,s=i.length;for(t=0;t<r&&e[t]===i[t];t++);var a=r-t;for(n=1;n<=a&&e[r-n]===i[s-n];n++);return Cp=i.slice(t,1<n?1-n:void 0)}function Op(t){var e=t.keyCode;return"charCode"in t?(t=t.charCode,t===0&&e===13&&(t=13)):t=e,t===10&&(t=13),32<=t||t===13?t:0}function Ah(){return!0}function N1(){return!1}function vn(t){function e(r,n,i,s,a){this._reactName=r,this._targetInst=i,this.type=n,this.nativeEvent=s,this.target=a,this.currentTarget=null;for(var o in t)t.hasOwnProperty(o)&&(r=t[o],this[o]=r?r(s):s[o]);return this.isDefaultPrevented=(s.defaultPrevented!=null?s.defaultPrevented:s.returnValue===!1)?Ah:N1,this.isPropagationStopped=N1,this}return At(e.prototype,{preventDefault:function(){this.defaultPrevented=!0;var r=this.nativeEvent;r&&(r.preventDefault?r.preventDefault():typeof r.returnValue!="unknown"&&(r.returnValue=!1),this.isDefaultPrevented=Ah)},stopPropagation:function(){var r=this.nativeEvent;r&&(r.stopPropagation?r.stopPropagation():typeof r.cancelBubble!="unknown"&&(r.cancelBubble=!0),this.isPropagationStopped=Ah)},persist:function(){},isPersistent:Ah}),e}var Xc={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},yE=vn(Xc),Yf=At({},Xc,{view:0,detail:0}),U8=vn(Yf),Fy,By,Pu,Qg=At({},Yf,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:bE,button:0,buttons:0,relatedTarget:function(t){return t.relatedTarget===void 0?t.fromElement===t.srcElement?t.toElement:t.fromElement:t.relatedTarget},movementX:function(t){return"movementX"in t?t.movementX:(t!==Pu&&(Pu&&t.type==="mousemove"?(Fy=t.screenX-Pu.screenX,By=t.screenY-Pu.screenY):By=Fy=0,Pu=t),Fy)},movementY:function(t){return"movementY"in t?t.movementY:By}}),M1=vn(Qg),G8=At({},Qg,{dataTransfer:0}),W8=vn(G8),V8=At({},Yf,{relatedTarget:0}),Uy=vn(V8),H8=At({},Xc,{animationName:0,elapsedTime:0,pseudoElement:0}),K8=vn(H8),z8=At({},Xc,{clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),q8=vn(z8),Y8=At({},Xc,{data:0}),$1=vn(Y8),X8={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Q8={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},J8={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Z8(t){var e=this.nativeEvent;return e.getModifierState?e.getModifierState(t):(t=J8[t])?!!e[t]:!1}function bE(){return Z8}var e5=At({},Yf,{key:function(t){if(t.key){var e=X8[t.key]||t.key;if(e!=="Unidentified")return e}return t.type==="keypress"?(t=Op(t),t===13?"Enter":String.fromCharCode(t)):t.type==="keydown"||t.type==="keyup"?Q8[t.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:bE,charCode:function(t){return t.type==="keypress"?Op(t):0},keyCode:function(t){return t.type==="keydown"||t.type==="keyup"?t.keyCode:0},which:function(t){return t.type==="keypress"?Op(t):t.type==="keydown"||t.type==="keyup"?t.keyCode:0}}),t5=vn(e5),r5=At({},Qg,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),j1=vn(r5),n5=At({},Yf,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:bE}),i5=vn(n5),s5=At({},Xc,{propertyName:0,elapsedTime:0,pseudoElement:0}),a5=vn(s5),o5=At({},Qg,{deltaX:function(t){return"deltaX"in t?t.deltaX:"wheelDeltaX"in t?-t.wheelDeltaX:0},deltaY:function(t){return"deltaY"in t?t.deltaY:"wheelDeltaY"in t?-t.wheelDeltaY:"wheelDelta"in t?-t.wheelDelta:0},deltaZ:0,deltaMode:0}),l5=vn(o5),c5=[9,13,27,32],xE=ms&&"CompositionEvent"in window,sd=null;ms&&"documentMode"in document&&(sd=document.documentMode);var u5=ms&&"TextEvent"in window&&!sd,vD=ms&&(!xE||sd&&8<sd&&11>=sd),F1=" ",B1=!1;function yD(t,e){switch(t){case"keyup":return c5.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function bD(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var Pl=!1;function d5(t,e){switch(t){case"compositionend":return bD(e);case"keypress":return e.which!==32?null:(B1=!0,F1);case"textInput":return t=e.data,t===F1&&B1?null:t;default:return null}}function f5(t,e){if(Pl)return t==="compositionend"||!xE&&yD(t,e)?(t=gD(),Cp=vE=sa=null,Pl=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(e.ctrlKey||e.altKey||e.metaKey)||e.ctrlKey&&e.altKey){if(e.char&&1<e.char.length)return e.char;if(e.which)return String.fromCharCode(e.which)}return null;case"compositionend":return vD&&e.locale!=="ko"?null:e.data;default:return null}}var h5={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function U1(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e==="input"?!!h5[t.type]:e==="textarea"}function xD(t,e,r,n){QL(n),e=om(e,"onChange"),0<e.length&&(r=new yE("onChange","change",null,r,n),t.push({event:r,listeners:e}))}var ad=null,Cd=null;function p5(t){RD(t,0)}function Jg(t){var e=Ol(t);if(VL(e))return t}function m5(t,e){if(t==="change")return e}var wD=!1;if(ms){var Gy;if(ms){var Wy="oninput"in document;if(!Wy){var G1=document.createElement("div");G1.setAttribute("oninput","return;"),Wy=typeof G1.oninput=="function"}Gy=Wy}else Gy=!1;wD=Gy&&(!document.documentMode||9<document.documentMode)}function W1(){ad&&(ad.detachEvent("onpropertychange",SD),Cd=ad=null)}function SD(t){if(t.propertyName==="value"&&Jg(Cd)){var e=[];xD(e,Cd,t,fE(t)),tD(p5,e)}}function g5(t,e,r){t==="focusin"?(W1(),ad=e,Cd=r,ad.attachEvent("onpropertychange",SD)):t==="focusout"&&W1()}function v5(t){if(t==="selectionchange"||t==="keyup"||t==="keydown")return Jg(Cd)}function y5(t,e){if(t==="click")return Jg(e)}function b5(t,e){if(t==="input"||t==="change")return Jg(e)}function x5(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var ci=typeof Object.is=="function"?Object.is:x5;function Od(t,e){if(ci(t,e))return!0;if(typeof t!="object"||t===null||typeof e!="object"||e===null)return!1;var r=Object.keys(t),n=Object.keys(e);if(r.length!==n.length)return!1;for(n=0;n<r.length;n++){var i=r[n];if(!Mb.call(e,i)||!ci(t[i],e[i]))return!1}return!0}function V1(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function H1(t,e){var r=V1(t);t=0;for(var n;r;){if(r.nodeType===3){if(n=t+r.textContent.length,t<=e&&n>=e)return{node:r,offset:e-t};t=n}e:{for(;r;){if(r.nextSibling){r=r.nextSibling;break e}r=r.parentNode}r=void 0}r=V1(r)}}function ED(t,e){return t&&e?t===e?!0:t&&t.nodeType===3?!1:e&&e.nodeType===3?ED(t,e.parentNode):"contains"in t?t.contains(e):t.compareDocumentPosition?!!(t.compareDocumentPosition(e)&16):!1:!1}function TD(){for(var t=window,e=em();e instanceof t.HTMLIFrameElement;){try{var r=typeof e.contentWindow.location.href=="string"}catch{r=!1}if(r)t=e.contentWindow;else break;e=em(t.document)}return e}function wE(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e&&(e==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||e==="textarea"||t.contentEditable==="true")}function w5(t){var e=TD(),r=t.focusedElem,n=t.selectionRange;if(e!==r&&r&&r.ownerDocument&&ED(r.ownerDocument.documentElement,r)){if(n!==null&&wE(r)){if(e=n.start,t=n.end,t===void 0&&(t=e),"selectionStart"in r)r.selectionStart=e,r.selectionEnd=Math.min(t,r.value.length);else if(t=(e=r.ownerDocument||document)&&e.defaultView||window,t.getSelection){t=t.getSelection();var i=r.textContent.length,s=Math.min(n.start,i);n=n.end===void 0?s:Math.min(n.end,i),!t.extend&&s>n&&(i=n,n=s,s=i),i=H1(r,s);var a=H1(r,n);i&&a&&(t.rangeCount!==1||t.anchorNode!==i.node||t.anchorOffset!==i.offset||t.focusNode!==a.node||t.focusOffset!==a.offset)&&(e=e.createRange(),e.setStart(i.node,i.offset),t.removeAllRanges(),s>n?(t.addRange(e),t.extend(a.node,a.offset)):(e.setEnd(a.node,a.offset),t.addRange(e)))}}for(e=[],t=r;t=t.parentNode;)t.nodeType===1&&e.push({element:t,left:t.scrollLeft,top:t.scrollTop});for(typeof r.focus=="function"&&r.focus(),r=0;r<e.length;r++)t=e[r],t.element.scrollLeft=t.left,t.element.scrollTop=t.top}}var S5=ms&&"documentMode"in document&&11>=document.documentMode,Il=null,tx=null,od=null,rx=!1;function K1(t,e,r){var n=r.window===r?r.document:r.nodeType===9?r:r.ownerDocument;rx||Il==null||Il!==em(n)||(n=Il,"selectionStart"in n&&wE(n)?n={start:n.selectionStart,end:n.selectionEnd}:(n=(n.ownerDocument&&n.ownerDocument.defaultView||window).getSelection(),n={anchorNode:n.anchorNode,anchorOffset:n.anchorOffset,focu
vendor: 4,383 bytes, line 37
37sNode:n.focusNode,focusOffset:n.focusOffset}),od&&Od(od,n)||(od=n,n=om(tx,"onSelect"),0<n.length&&(e=new yE("onSelect","select",null,e,r),t.push({event:e,listeners:n}),e.target=Il)))}function Ph(t,e){var r={};return r[t.toLowerCase()]=e.toLowerCase(),r["Webkit"+t]="webkit"+e,r["Moz"+t]="moz"+e,r}var Cl={animationend:Ph("Animation","AnimationEnd"),animationiteration:Ph("Animation","AnimationIteration"),animationstart:Ph("Animation","AnimationStart"),transitionend:Ph("Transition","TransitionEnd")},Vy={},_D={};ms&&(_D=document.createElement("div").style,"AnimationEvent"in window||(delete Cl.animationend.animation,delete Cl.animationiteration.animation,delete Cl.animationstart.animation),"TransitionEvent"in window||delete Cl.transitionend.transition);function Zg(t){if(Vy[t])return Vy[t];if(!Cl[t])return t;var e=Cl[t],r;for(r in e)if(e.hasOwnProperty(r)&&r in _D)return Vy[t]=e[r];return t}var AD=Zg("animationend"),PD=Zg("animationiteration"),ID=Zg("animationstart"),CD=Zg("transitionend"),OD=new Map,z1="abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");function Pa(t,e){OD.set(t,e),Ko(e,[t])}for(var Hy=0;Hy<z1.length;Hy++){var Ky=z1[Hy],E5=Ky.toLowerCase(),T5=Ky[0].toUpperCase()+Ky.slice(1);Pa(E5,"on"+T5)}Pa(AD,"onAnimationEnd");Pa(PD,"onAnimationIteration");Pa(ID,"onAnimationStart");Pa("dblclick","onDoubleClick");Pa("focusin","onFocus");Pa("focusout","onBlur");Pa(CD,"onTransitionEnd");pc("onMouseEnter",["mouseout","mouseover"]);pc("onMouseLeave",["mouseout","mouseover"]);pc("onPointerEnter",["pointerout","pointerover"]);pc("onPointerLeave",["pointerout","pointerover"]);Ko("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));Ko("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));Ko("onBeforeInput",["compositionend","keypress","textInput","paste"]);Ko("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));Ko("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));Ko("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Xu="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),_5=new Set("cancel close invalid load scroll toggle".split(" ").concat(Xu));function q1(t,e,r){var n=t.type||"unknown-event";t.currentTarget=r,E8(n,e,void 0,t),t.currentTarget=null}function RD(t,e){e=(e&4)!==0;for(var r=0;r<t.length;r++){var n=t[r],i=n.event;n=n.listeners;e:{var s=void 0;if(e)for(var a=n.length-1;0<=a;a--){var o=n[a],l=o.instance,c=o.currentTarget;if(o=o.listener,l!==s&&i.isPropagationStopped())break e;q1(i,o,c),s=l}else for(a=0;a<n.length;a++){if(o=n[a],l=o.instance,c=o.currentTarget,o=o.listener,l!==s&&i.isPropagationStopped())break e;q1(i,o,c),s=l}}}if(rm)throw t=Qb,rm=!1,Qb=null,t}function ht(t,e){var r=e[ox];r===void 0&&(r=e[ox]=new Set);var n=t+"__bubble";r.has(n)||(kD(e,t,2,!1),r.add(n))}function zy(t,e,r){var n=0;e&&(n|=4),kD(r,t,n,e)}var Ih="_reactListening"+Math.random().toString(36).slice(2);function Rd(t){if(!t[Ih]){t[Ih]=!0,FL.forEach(function(r){r!=="selectionchange"&&(_5.has(r)||zy(r,!1,t),zy(r,!0,t))});var e=t.nodeType===9?t:t.ownerDocument;e===null||e[Ih]||(e[Ih]=!0,zy("selectionchange",!1,e))}}function kD(t,e,r,n){switch(mD(e)){case 1:var i=F8;break;case 4:i=B8;break;default:i=gE}r=i.bind(null,e,r,t),i=void 0,!Xb||e!=="touchstart"&&e!=="touchmove"&&e!=="wheel"||(i=!0),n?i!==void 0?t.addEventListener(e,r,{capture:!0,passive:i}):t.addEventListener(e,r,!0):i!==void 0?t.addEventListener(e,r,{passive:i}):t.addEventListener(e,r,!1)}function qy(t,e,r,n,i){var s=n;
vendor: 2,645 bytes, line 37
37if(!(e&1)&&!(e&2)&&n!==null)e:for(;;){if(n===null)return;var a=n.tag;if(a===3||a===4){var o=n.stateNode.containerInfo;if(o===i||o.nodeType===8&&o.parentNode===i)break;if(a===4)for(a=n.return;a!==null;){var l=a.tag;if((l===3||l===4)&&(l=a.stateNode.containerInfo,l===i||l.nodeType===8&&l.parentNode===i))return;a=a.return}for(;o!==null;){if(a=so(o),a===null)return;if(l=a.tag,l===5||l===6){n=s=a;continue e}o=o.parentNode}}n=n.return}tD(function(){var c=s,u=fE(r),d=[];e:{var f=OD.get(t);if(f!==void 0){var h=yE,p=t;switch(t){case"keypress":if(Op(r)===0)break e;case"keydown":case"keyup":h=t5;break;case"focusin":p="focus",h=Uy;break;case"focusout":p="blur",h=Uy;break;case"beforeblur":case"afterblur":h=Uy;break;case"click":if(r.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":h=M1;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":h=W8;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":h=i5;break;case AD:case PD:case ID:h=K8;break;case CD:h=a5;break;case"scroll":h=U8;break;case"wheel":h=l5;break;case"copy":case"cut":case"paste":h=q8;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":h=j1}var g=(e&4)!==0,m=!g&&t==="scroll",v=g?f!==null?f+"Capture":null:f;g=[];for(var y=c,b;y!==null;){b=y;var w=b.stateNode;if(b.tag===5&&w!==null&&(b=w,v!==null&&(w=_d(y,v),w!=null&&g.push(kd(y,w,b)))),m)break;y=y.return}0<g.length&&(f=new h(f,p,null,r,u),d.push({event:f,listeners:g}))}}if(!(e&7)){e:{if(f=t==="mouseover"||t==="pointerover",h=t==="mouseout"||t==="pointerout",f&&r!==qb&&(p=r.relatedTarget||r.fromElement)&&(so(p)||p[gs]))break e;if((h||f)&&(f=u.window===u?u:(f=u.ownerDocument)?f.defaultView||f.parentWindow:window,h?(p=r.relatedTarget||r.toElement,h=c,p=p?so(p):null,p!==null&&(m=zo(p),p!==m||p.tag!==5&&p.tag!==6)&&(p=null)):(h=null,p=c),h!==p)){if(g=M1,w="onMouseLeave",v="onMouseEnter",y="mouse",(t==="pointerout"||t==="pointerover")&&(g=j1,w="onPointerLeave",v="onPointerEnter",y="pointer"),m=h==null?f:Ol(h),b=p==null?f:Ol(p),f=new g(w,y+"leave",h,r,u),f.target=m,f.relatedTarget=b,w=null,so(u)===c&&(g=new g(v,y+"enter",p,r,u),g.target=b,g.relatedTarget=m,w=g),m=w,h&&p)t:{for(g=h,v=p,y=0,b=g;b;b=tl(b))y++;for(b=0,w=v;w;w=tl(w))b++;for(;0<y-b;)g=tl(g),y--;for(;0<b-y;)v=tl(v),b--;for(;y--;){if(g===v||v!==null&&g===v.alternate)break t;g=tl(g),v=tl(v)}g=null}else g=null;h!==null&&Y1(d,f,h,g,!1),p!==null&&m!==null&&Y1(d,m,p,g,!0)}}
vendor: 7,622 bytes, lines 37-38
37e:{if(f=c?Ol(c):window,h=f.nodeName&&f.nodeName.toLowerCase(),h==="select"||h==="input"&&f.type==="file")var S=m5;else if(U1(f))if(wD)S=b5;else{S=v5;var T=g5}else(h=f.nodeName)&&h.toLowerCase()==="input"&&(f.type==="checkbox"||f.type==="radio")&&(S=y5);if(S&&(S=S(t,c))){xD(d,S,r,u);break e}T&&T(t,f,c),t==="focusout"&&(T=f._wrapperState)&&T.controlled&&f.type==="number"&&Wb(f,"number",f.value)}switch(T=c?Ol(c):window,t){case"focusin":(U1(T)||T.contentEditable==="true")&&(Il=T,tx=c,od=null);break;case"focusout":od=tx=Il=null;break;case"mousedown":rx=!0;break;case"contextmenu":case"mouseup":case"dragend":rx=!1,K1(d,r,u);break;case"selectionchange":if(S5)break;case"keydown":case"keyup":K1(d,r,u)}var _;if(xE)e:{switch(t){case"compositionstart":var A="onCompositionStart";break e;case"compositionend":A="onCompositionEnd";break e;case"compositionupdate":A="onCompositionUpdate";break e}A=void 0}else Pl?yD(t,r)&&(A="onCompositionEnd"):t==="keydown"&&r.keyCode===229&&(A="onCompositionStart");A&&(vD&&r.locale!=="ko"&&(Pl||A!=="onCompositionStart"?A==="onCompositionEnd"&&Pl&&(_=gD()):(sa=u,vE="value"in sa?sa.value:sa.textContent,Pl=!0)),T=om(c,A),0<T.length&&(A=new $1(A,t,null,r,u),d.push({event:A,listeners:T}),_?A.data=_:(_=bD(r),_!==null&&(A.data=_)))),(_=u5?d5(t,r):f5(t,r))&&(c=om(c,"onBeforeInput"),0<c.length&&(u=new $1("onBeforeInput","beforeinput",null,r,u),d.push({event:u,listeners:c}),u.data=_))}RD(d,e)})}function kd(t,e,r){return{instance:t,listener:e,currentTarget:r}}function om(t,e){for(var r=e+"Capture",n=[];t!==null;){var i=t,s=i.stateNode;i.tag===5&&s!==null&&(i=s,s=_d(t,r),s!=null&&n.unshift(kd(t,s,i)),s=_d(t,e),s!=null&&n.push(kd(t,s,i))),t=t.return}return n}function tl(t){if(t===null)return null;do t=t.return;while(t&&t.tag!==5);return t||null}function Y1(t,e,r,n,i){for(var s=e._reactName,a=[];r!==null&&r!==n;){var o=r,l=o.alternate,c=o.stateNode;if(l!==null&&l===n)break;o.tag===5&&c!==null&&(o=c,i?(l=_d(r,s),l!=null&&a.unshift(kd(r,l,o))):i||(l=_d(r,s),l!=null&&a.push(kd(r,l,o)))),r=r.return}a.length!==0&&t.push({event:e,listeners:a})}var A5=/\r\n?/g,P5=/\u0000|\uFFFD/g;function X1(t){return(typeof t=="string"?t:""+t).replace(A5,`
38`).replace(P5,"")}function Ch(t,e,r){if(e=X1(e),X1(t)!==e&&r)throw Error(te(425))}function lm(){}var nx=null,ix=null;function sx(t,e){return t==="textarea"||t==="noscript"||typeof e.children=="string"||typeof e.children=="number"||typeof e.dangerouslySetInnerHTML=="object"&&e.dangerouslySetInnerHTML!==null&&e.dangerouslySetInnerHTML.__html!=null}var ax=typeof setTimeout=="function"?setTimeout:void 0,I5=typeof clearTimeout=="function"?clearTimeout:void 0,Q1=typeof Promise=="function"?Promise:void 0,C5=typeof queueMicrotask=="function"?queueMicrotask:typeof Q1<"u"?function(t){return Q1.resolve(null).then(t).catch(O5)}:ax;function O5(t){setTimeout(function(){throw t})}function Yy(t,e){var r=e,n=0;do{var i=r.nextSibling;if(t.removeChild(r),i&&i.nodeType===8)if(r=i.data,r==="/$"){if(n===0){t.removeChild(i),Id(e);return}n--}else r!=="$"&&r!=="$?"&&r!=="$!"||n++;r=i}while(r);Id(e)}function fa(t){for(;t!=null;t=t.nextSibling){var e=t.nodeType;if(e===1||e===3)break;if(e===8){if(e=t.data,e==="$"||e==="$!"||e==="$?")break;if(e==="/$")return null}}return t}function J1(t){t=t.previousSibling;for(var e=0;t;){if(t.nodeType===8){var r=t.data;if(r==="$"||r==="$!"||r==="$?"){if(e===0)return t;e--}else r==="/$"&&e++}t=t.previousSibling}return null}var Qc=Math.random().toString(36).slice(2),Ti="__reactFiber$"+Qc,Ld="__reactProps$"+Qc,gs="__reactContainer$"+Qc,ox="__reactEvents$"+Qc,R5="__reactListeners$"+Qc,k5="__reactHandles$"+Qc;function so(t){var e=t[Ti];if(e)return e;for(var r=t.parentNode;r;){if(e=r[gs]||r[Ti]){if(r=e.alternate,e.child!==null||r!==null&&r.child!==null)for(t=J1(t);t!==null;){if(r=t[Ti])return r;t=J1(t)}return e}t=r,r=t.parentNode}return null}function Xf(t){return t=t[Ti]||t[gs],!t||t.tag!==5&&t.tag!==6&&t.tag!==13&&t.tag!==3?null:t}function Ol(t){if(t.tag===5||t.tag===6)return t.stateNode;throw Error(te(33))}function ev(t){return t[Ld]||null}var lx=[],Rl=-1;function Ia(t){return{current:t}}function gt(t){0>Rl||(t.current=lx[Rl],lx[Rl]=null,Rl--)}function ut(t,e){Rl++,lx[Rl]=t.current,t.current=e}var wa={},Pr=Ia(wa),Hr=Ia(!1),Ro=wa;function mc(t,e){var r=t.type.contextTypes;if(!r)return wa;var n=t.stateNode;if(n&&n.__reactInternalMemoizedUnmaskedChildContext===e)return n.__reactInternalMemoizedMaskedChildContext;var i={},s;for(s in r)i[s]=e[s];return n&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=e,t.__reactInternalMemoizedMaskedChildContext=i),i}function Kr(t){return t=t.childContextTypes,t!=null}function cm(){gt(Hr),gt(Pr)}function Z1(t,e,r){if(Pr.current!==wa)throw Error(te(168));ut(Pr,e),ut(Hr,r)}function LD(t,e,r){var n=t.stateNode;if(e=e.childContextTypes,typeof n.getChildContext!="function")return r;n=n.getChildContext();for(var i in n)if(!(i in e))throw Error(te(108,g8(t)||"Unknown",i));return At({},r,n)}function um(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||wa,Ro=Pr.current,ut(Pr,t),ut(Hr,Hr.current),!0}function eA(t,e,r){var n=t.stateNode;if(!n)throw Error(te(169));r?(t=LD(t,e,Ro),n.__reactInternalMemoizedMergedChildContext=t,gt(Hr),gt(Pr),ut(Pr,t)):gt(Hr),ut(Hr,r)}var is=null,tv=!1,Xy=!1;function DD(t){is===null?is=[t]:is.push(t)}function L5(t){tv=!0,DD(t)}function Ca(){if(!Xy&&is!==null){Xy=!0;var t=0,e=Ye;try{var r=is;for(Ye=1;t<r.length;t++){var n=r[t];do n=n(!0);while(n!==null)}is=null,tv=!1}catch(i){throw is!==null&&(is=is.slice(t+1)),sD(hE,Ca),i}finally{Ye=e,Xy=!1}}return null}var kl=[],Ll=0,dm=null,fm=0,En=[],Tn=0,ko=null,as=1,os="";function Ya(t,e){kl[Ll++]=fm,kl[Ll++]=dm,dm=t,fm=e}function ND(t,e,r){En[Tn++]=as,En[Tn++]=os,En[Tn++]=ko,ko=t;var n=as;t=os;var i=32-ai(n)-1;n&=~(1<<i),r+=1;var s=32-ai(e)+i;if(30<s){var a=i-i%5;s=(n&(1<<a)-1).toString(32),n>>=a,i-=a,as=1<<32-ai(e)+i|r<<i|n,os=s+t}else as=1<<s|r<<i|n,os=t}function SE(t){t.return!==null&&(Ya(t,1),ND(t,1,0))}function EE(t){for(;t===dm;)dm=kl[--Ll],kl[Ll]=null,fm=kl[--Ll],kl[Ll]=null;for(;t===ko;)ko=En[--Tn],En[Tn]=null,os=En[--Tn],En[Tn]=null,as=En[--Tn],En[Tn]=null}var dn=null,un=null,bt=!1,ni=null;function MD(t,e){var r=_n(5,null,null,0);r.elementType="DELETED",r.stateNode=e,r.return=t,e=t.deletions,e===null?(t.deletions=[r],t.flags|=16):e.push(r)}function tA(t,e){switch(t.tag){case 5:var r=t.type;return e=e.nodeType!==1||r.toLowerCase()!==e.nodeName.toLowerCase()?null:e,e!==null?(t.stateNode=e,dn=t,un=fa(e.firstChild),!0):!1;case 6:return e=t.pendingProps===""||e.nodeType!==3?null:e,e!==null?(t.stateNode=e,dn=t,un=null,!0):!1;case 13:return e=e.nodeType!==8?null:e,e!==null?(r=ko!==null?{id:as,overflow:os}:null,t.memoizedState={dehydrated:e,treeContext:r,retryLane:1073741824},r=_n(18,null,null,0),r.stateNode=e,r.return=t,t.child=r,dn=t,un=null,!0):!1;default:return!1}}function cx(t){return(t.mode&1)!==0&&(t.flags&128)===0}function ux(t){if(bt){var e=un;if(e){var r=e;if(!tA(t,e)){if(cx(t))throw Error(te(418));e=fa(r.nextSibling);var n=dn;e&&tA(t,e)?MD(n,r):(t.flags=t.flags&-4097|2,bt=!1,dn=t)}}else{if(cx(t))throw Error(te(418));t.flags=t.flags&-4097|2,bt=!1,dn=t}}}function rA(t){for(t=t.return;t!==null&&t.tag!==5&&t.tag!==3&&t.tag!==13;)t=t.return;dn=t}function Oh(t){if(t!==dn)return!1;if(!bt)return rA(t),bt=!0,!1;var e;if((e=t.tag!==3)&&!(e=t.tag!==5)&&(e=t.type,e=e!=="head"&&e!=="body"&&!sx(t.type,t.memoizedProps)),e&&(e=un)){if(cx(t))throw $D(),Error(te(418));for(;e;)MD(t,e),e=fa(e.nextSibling)}if(rA(t),t.tag===13){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(te(317));e:{for(t=t.nextSibling,e=0;t;
vendor: 10,289 bytes, line 38
38){if(t.nodeType===8){var r=t.data;if(r==="/$"){if(e===0){un=fa(t.nextSibling);break e}e--}else r!=="$"&&r!=="$!"&&r!=="$?"||e++}t=t.nextSibling}un=null}}else un=dn?fa(t.stateNode.nextSibling):null;return!0}function $D(){for(var t=un;t;)t=fa(t.nextSibling)}function gc(){un=dn=null,bt=!1}function TE(t){ni===null?ni=[t]:ni.push(t)}var D5=_s.ReactCurrentBatchConfig;function Iu(t,e,r){if(t=r.ref,t!==null&&typeof t!="function"&&typeof t!="object"){if(r._owner){if(r=r._owner,r){if(r.tag!==1)throw Error(te(309));var n=r.stateNode}if(!n)throw Error(te(147,t));var i=n,s=""+t;return e!==null&&e.ref!==null&&typeof e.ref=="function"&&e.ref._stringRef===s?e.ref:(e=function(a){var o=i.refs;a===null?delete o[s]:o[s]=a},e._stringRef=s,e)}if(typeof t!="string")throw Error(te(284));if(!r._owner)throw Error(te(290,t))}return t}function Rh(t,e){throw t=Object.prototype.toString.call(e),Error(te(31,t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t))}function nA(t){var e=t._init;return e(t._payload)}function jD(t){function e(v,y){if(t){var b=v.deletions;b===null?(v.deletions=[y],v.flags|=16):b.push(y)}}function r(v,y){if(!t)return null;for(;y!==null;)e(v,y),y=y.sibling;return null}function n(v,y){for(v=new Map;y!==null;)y.key!==null?v.set(y.key,y):v.set(y.index,y),y=y.sibling;return v}function i(v,y){return v=ga(v,y),v.index=0,v.sibling=null,v}function s(v,y,b){return v.index=b,t?(b=v.alternate,b!==null?(b=b.index,b<y?(v.flags|=2,y):b):(v.flags|=2,y)):(v.flags|=1048576,y)}function a(v){return t&&v.alternate===null&&(v.flags|=2),v}function o(v,y,b,w){return y===null||y.tag!==6?(y=n0(b,v.mode,w),y.return=v,y):(y=i(y,b),y.return=v,y)}function l(v,y,b,w){var S=b.type;return S===Al?u(v,y,b.props.children,w,b.key):y!==null&&(y.elementType===S||typeof S=="object"&&S!==null&&S.$$typeof===Vs&&nA(S)===y.type)?(w=i(y,b.props),w.ref=Iu(v,y,b),w.return=v,w):(w=$p(b.type,b.key,b.props,null,v.mode,w),w.ref=Iu(v,y,b),w.return=v,w)}function c(v,y,b,w){return y===null||y.tag!==4||y.stateNode.containerInfo!==b.containerInfo||y.stateNode.implementation!==b.implementation?(y=i0(b,v.mode,w),y.return=v,y):(y=i(y,b.children||[]),y.return=v,y)}function u(v,y,b,w,S){return y===null||y.tag!==7?(y=wo(b,v.mode,w,S),y.return=v,y):(y=i(y,b),y.return=v,y)}function d(v,y,b){if(typeof y=="string"&&y!==""||typeof y=="number")return y=n0(""+y,v.mode,b),y.return=v,y;if(typeof y=="object"&&y!==null){switch(y.$$typeof){case xh:return b=$p(y.type,y.key,y.props,null,v.mode,b),b.ref=Iu(v,null,y),b.return=v,b;case _l:return y=i0(y,v.mode,b),y.return=v,y;case Vs:var w=y._init;return d(v,w(y._payload),b)}if(qu(y)||Eu(y))return y=wo(y,v.mode,b,null),y.return=v,y;Rh(v,y)}return null}function f(v,y,b,w){var S=y!==null?y.key:null;if(typeof b=="string"&&b!==""||typeof b=="number")return S!==null?null:o(v,y,""+b,w);if(typeof b=="object"&&b!==null){switch(b.$$typeof){case xh:return b.key===S?l(v,y,b,w):null;case _l:return b.key===S?c(v,y,b,w):null;case Vs:return S=b._init,f(v,y,S(b._payload),w)}if(qu(b)||Eu(b))return S!==null?null:u(v,y,b,w,null);Rh(v,b)}return null}function h(v,y,b,w,S){if(typeof w=="string"&&w!==""||typeof w=="number")return v=v.get(b)||null,o(y,v,""+w,S);if(typeof w=="object"&&w!==null){switch(w.$$typeof){case xh:return v=v.get(w.key===null?b:w.key)||null,l(y,v,w,S);case _l:return v=v.get(w.key===null?b:w.key)||null,c(y,v,w,S);case Vs:var T=w._init;return h(v,y,b,T(w._payload),S)}if(qu(w)||Eu(w))return v=v.get(b)||null,u(y,v,w,S,null);Rh(y,w)}return null}function p(v,y,b,w){for(var S=null,T=null,_=y,A=y=0,P=null;_!==null&&A<b.length;A++){_.index>A?(P=_,_=null):P=_.sibling;var C=f(v,_,b[A],w);if(C===null){_===null&&(_=P);break}t&&_&&C.alternate===null&&e(v,_),y=s(C,y,A),T===null?S=C:T.sibling=C,T=C,_=P}if(A===b.length)return r(v,_),bt&&Ya(v,A),S;if(_===null){for(;A<b.length;A++)_=d(v,b[A],w),_!==null&&(y=s(_,y,A),T===null?S=_:T.sibling=_,T=_);return bt&&Ya(v,A),S}for(_=n(v,_);A<b.length;A++)P=h(_,v,A,b[A],w),P!==null&&(t&&P.alternate!==null&&_.delete(P.key===null?A:P.key),y=s(P,y,A),T===null?S=P:T.sibling=P,T=P);return t&&_.forEach(function(O){return e(v,O)}),bt&&Ya(v,A),S}function g(v,y,b,w){var S=Eu(b);if(typeof S!="function")throw Error(te(150));if(b=S.call(b),b==null)throw Error(te(151));for(var T=S=null,_=y,A=y=0,P=null,C=b.next();_!==null&&!C.done;A++,C=b.next()){_.index>A?(P=_,_=null):P=_.sibling;var O=f(v,_,C.value,w);if(O===null){_===null&&(_=P);break}t&&_&&O.alternate===null&&e(v,_),y=s(O,y,A),T===null?S=O:T.sibling=O,T=O,_=P}if(C.done)return r(v,_),bt&&Ya(v,A),S;if(_===null){for(;!C.done;A++,C=b.next())C=d(v,C.value,w),C!==null&&(y=s(C,y,A),T===null?S=C:T.sibling=C,T=C);return bt&&Ya(v,A),S}for(_=n(v,_);!C.done;A++,C=b.next())C=h(_,v,A,C.value,w),C!==null&&(t&&C.alternate!==null&&_.delete(C.key===null?A:C.key),y=s(C,y,A),T===null?S=C:T.sibling=C,T=C);return t&&_.forEach(function(R){return e(v,R)}),bt&&Ya(v,A),S}function m(v,y,b,w){if(typeof b=="object"&&b!==null&&b.type===Al&&b.key===null&&(b=b.props.children),typeof b=="object"&&b!==null){switch(b.$$typeof){case xh:e:{for(var S=b.key,T=y;T!==null;){if(T.key===S){if(S=b.type,S===Al){if(T.tag===7){r(v,T.sibling),y=i(T,b.props.children),y.return=v,v=y;break e}}else if(T.elementType===S||typeof S=="object"&&S!==null&&S.$$typeof===Vs&&nA(S)===T.type){r(v,T.sibling),y=i(T,b.props),y.ref=Iu(v,T,b),y.return=v,v=y;break e}r(v,T);break}else e(v,T);T=T.sibling}b.type===Al?(y=wo(b.props.children,v.mode,w,b.key),y.return=v,v=y):(w=$p(b.type,b.key,b.props,null,v.mode,w),w.ref=Iu(v,y,b),w.return=v,v=w)}return a(v);case _l:e:{for(T=b.key;y!==null;){if(y.key===T)if(y.tag===4&&y.stateNode.containerInfo===b.containerInfo&&y.stateNode.implementation===b.implementation){r(v,y.sibling),y=i(y,b.children||[]),y.return=v,v=y;break e}else{r(v,y);break}else e(v,y);y=y.sibling}y=i0(b,v.mode,w),y.return=v,v=y}return a(v);case Vs:return T=b._init,m(v,y,T(b._payload),w)}if(qu(b))return p(v,y,b,w);if(Eu(b))return g(v,y,b,w);Rh(v,b)}return typeof b=="string"&&b!==""||typeof b=="number"?(b=""+b,y!==null&&y.tag===6?(r(v,y.sibling),y=i(y,b),y.return=v,v=y):(r(v,y),y=n0(b,v.mode,w),y.return=v,v=y),a(v)):r(v,y)}return m}var vc=jD(!0),FD=jD(!1),hm=Ia(null),pm=null,Dl=null,_E=null;function AE(){_E=Dl=pm=null}function PE(t){var e=hm.current;gt(hm),t._currentValue=e}function dx(t,e,r){for(;t!==null;){var n=t.alternate;if((t.childLanes&e)!==e?(t.childLanes|=e,n!==null&&(n.childLanes|=e)):n!==null&&(n.childLanes&e)!==e&&(n.childLanes|=e),t===r)break;t=t.return}}function Kl(t,e){pm=t,_E=Dl=null,t=t.dependencies,t!==null&&t.firstContext!==null&&(t.lanes&e&&(Ur=!0),t.firstContext=null)}function Cn(t){var e=t._currentValue;if(_E!==t)if(t={context:t,memoizedValue:e,next:null},Dl===null){if(pm===null)throw Error(te(308));Dl=t,pm.dependencies={lanes:0,firstContext:t}}else Dl=Dl.next=t;return e}var ao=null;function IE(t){ao===null?ao=[t]:ao.push(t)}function BD(t,e,r,n){var i=e.interleaved;return i===null?(r.next=r,IE(e)):(r.next=i.next,i.next=r),e.interleaved=r,vs(t,n)}function vs(t,e){t.lanes|=e;var r=t.alternate;for(r!==null&&(r.lanes|=e),r=t,t=t.return;t!==null;)t.childLanes|=e,r=t.alternate,r!==null&&(r.childLanes|=e),r=t,t=t.return;return r.tag===3?r.stateNode:null}var Hs=!1;function CE(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function UD(t,e){t=t.updateQueue,e.updateQueue===t&&(e.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,effects:t.effects})}function fs(t,e){return{eventTime:t,lane:e,tag:0,payload:null,callback:null,next:null}}function ha(t,e,r){var n=t.updateQueue;if(n===null)return null;if(n=n.shared,Ne&2){var i=n.pending;return i===null?e.next=e:(e.next=i.next,i.next=e),n.pending=e,vs(t,r)}return i=n.interleaved,i===null?(e.next=e,IE(n)):(e.next=i.next,i.next=e),n.interleaved=e,vs(t,r)}function Rp(t,e,r){if(e=e.updateQueue,e!==null&&(e=e.shared,(r&4194240)!==0)){var n=e.lanes;n&=t.pendingLanes,r|=n,e.lanes=r,pE(t,r)}}function iA(t,e){var r=t.updateQueue,n=t.alternate;if(n!==null&&(n=n.updateQueue,r===n)){var i=null,s=null;if(r=r.firstBaseUpdate,r!==null){do{var a={eventTime:r.eventTime,lane:r.lane,tag:r.tag,payload:r.payload,callback:r.callback,next:null};s===null?i=s=a:s=s.next=a,r=r.next}while(r!==null);s===null?i=s=e:s=s.next=e}else i=s=e;r={baseState:n.baseState,firstBaseUpdate:i,lastBaseUpdate:s,shared:n.shared,effects:n.effects},t.updateQueue=r;return}t=r.lastBaseUpdate,t===null?r.firstBaseUpdate=e:t.next=e,r.lastBaseUpdate=e}function mm(t,e,r,n){var i=t.updateQueue;Hs=!1;var s=i.firstBaseUpdate,a=i.lastBaseUpdate,o=i.shared.pending;if(o!==null){i.shared.pending=null;var l=o,c=l.next;l.next=null,a===null?s=c:a.next=c,a=l;var u=t.alternate;u!==null&&(u=u.updateQueue,o=u.lastBaseUpdate,o!==a&&(o===null?u.firstBaseUpdate=c:o.next=c,u.lastBaseUpdate=l))}if(s!==null){var d=i.baseState;a=0,u=c=l=null,o=s;do{var f=o.lane,h=o.eventTime;if((n&f)===f){u!==null&&(u=u.next={eventTime:h,lane:0,tag:o.tag,payload:o.payload,callback:o.callback,next:null});e:{var p=t,g=o;switch(f=e,h=r,g.tag){case 1:if(p=g.payload,typeof p=="function"){d=p.call(h,d,f);break e}d=p;break e;case 3:p.flags=p.flags&-65537|128;case 0:if(p=g.payload,f=typeof p=="function"?p.call(h,d,f):p,f==null)break e;d=At({},d,f);break e;case 2:Hs=!0}}o.callback!==null&&o.lane!==0&&(t.flags|=64,f=i.effects,f===null?i.effects=[o]:f.push(o))}else h={eventTime:h,lane:f,tag:o.tag,payload:o.payload,callback:o.callback,next:null},u===null?(c=u=h,l=d):u=u.next=h,a|=f;if(o=o.next,o===null){if(o=i.shared.pending,o===null)break;f=o,o=f.next,f.next=null,i.lastBaseUpdate=f,i.shared.pending=null}}while(!0);if(u===null&&(l=d),i.baseState=l,i.firstBaseUpdate=c,i.lastBaseUpdate=u,e=i.shared.interleaved,e!==null){i=e;do a|=i.lane,i=i.next;while(i!==e)}else s===null&&(i.shared.lanes=0);Do|=a,t.lanes=a,t.memoizedState=d}}function sA(t,e,r){if(t=e.effects,e.effects=null,t!==null)for(e=0;e<t.length;e++){var n=t[e],i=n.callback;if(i!==null){if(n.callback=null,n=r,typeof i!="function")throw Error(te(191,i));i.call(n)}}}var Qf={},Li=Ia(Qf),Dd=Ia(Qf),Nd=Ia(Qf);function oo(t){if(t===Qf)throw Error(te(174));return t}function OE(t,e){switch(ut(Nd,e),ut(Dd,t),ut(Li,Qf),t=e.nodeType,t){case 9:case 11:e=(e
vendor: 9,357 bytes, line 38
38=e.documentElement)?e.namespaceURI:Hb(null,"");break;default:t=t===8?e.parentNode:e,e=t.namespaceURI||null,t=t.tagName,e=Hb(e,t)}gt(Li),ut(Li,e)}function yc(){gt(Li),gt(Dd),gt(Nd)}function GD(t){oo(Nd.current);var e=oo(Li.current),r=Hb(e,t.type);e!==r&&(ut(Dd,t),ut(Li,r))}function RE(t){Dd.current===t&&(gt(Li),gt(Dd))}var Et=Ia(0);function gm(t){for(var e=t;e!==null;){if(e.tag===13){var r=e.memoizedState;if(r!==null&&(r=r.dehydrated,r===null||r.data==="$?"||r.data==="$!"))return e}else if(e.tag===19&&e.memoizedProps.revealOrder!==void 0){if(e.flags&128)return e}else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break;for(;e.sibling===null;){if(e.return===null||e.return===t)return null;e=e.return}e.sibling.return=e.return,e=e.sibling}return null}var Qy=[];function kE(){for(var t=0;t<Qy.length;t++)Qy[t]._workInProgressVersionPrimary=null;Qy.length=0}var kp=_s.ReactCurrentDispatcher,Jy=_s.ReactCurrentBatchConfig,Lo=0,_t=null,zt=null,nr=null,vm=!1,ld=!1,Md=0,N5=0;function wr(){throw Error(te(321))}function LE(t,e){if(e===null)return!1;for(var r=0;r<e.length&&r<t.length;r++)if(!ci(t[r],e[r]))return!1;return!0}function DE(t,e,r,n,i,s){if(Lo=s,_t=e,e.memoizedState=null,e.updateQueue=null,e.lanes=0,kp.current=t===null||t.memoizedState===null?F5:B5,t=r(n,i),ld){s=0;do{if(ld=!1,Md=0,25<=s)throw Error(te(301));s+=1,nr=zt=null,e.updateQueue=null,kp.current=U5,t=r(n,i)}while(ld)}if(kp.current=ym,e=zt!==null&&zt.next!==null,Lo=0,nr=zt=_t=null,vm=!1,e)throw Error(te(300));return t}function NE(){var t=Md!==0;return Md=0,t}function yi(){var t={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return nr===null?_t.memoizedState=nr=t:nr=nr.next=t,nr}function On(){if(zt===null){var t=_t.alternate;t=t!==null?t.memoizedState:null}else t=zt.next;var e=nr===null?_t.memoizedState:nr.next;if(e!==null)nr=e,zt=t;else{if(t===null)throw Error(te(310));zt=t,t={memoizedState:zt.memoizedState,baseState:zt.baseState,baseQueue:zt.baseQueue,queue:zt.queue,next:null},nr===null?_t.memoizedState=nr=t:nr=nr.next=t}return nr}function $d(t,e){return typeof e=="function"?e(t):e}function Zy(t){var e=On(),r=e.queue;if(r===null)throw Error(te(311));r.lastRenderedReducer=t;var n=zt,i=n.baseQueue,s=r.pending;if(s!==null){if(i!==null){var a=i.next;i.next=s.next,s.next=a}n.baseQueue=i=s,r.pending=null}if(i!==null){s=i.next,n=n.baseState;var o=a=null,l=null,c=s;do{var u=c.lane;if((Lo&u)===u)l!==null&&(l=l.next={lane:0,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null}),n=c.hasEagerState?c.eagerState:t(n,c.action);else{var d={lane:u,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null};l===null?(o=l=d,a=n):l=l.next=d,_t.lanes|=u,Do|=u}c=c.next}while(c!==null&&c!==s);l===null?a=n:l.next=o,ci(n,e.memoizedState)||(Ur=!0),e.memoizedState=n,e.baseState=a,e.baseQueue=l,r.lastRenderedState=n}if(t=r.interleaved,t!==null){i=t;do s=i.lane,_t.lanes|=s,Do|=s,i=i.next;while(i!==t)}else i===null&&(r.lanes=0);return[e.memoizedState,r.dispatch]}function e0(t){var e=On(),r=e.queue;if(r===null)throw Error(te(311));r.lastRenderedReducer=t;var n=r.dispatch,i=r.pending,s=e.memoizedState;if(i!==null){r.pending=null;var a=i=i.next;do s=t(s,a.action),a=a.next;while(a!==i);ci(s,e.memoizedState)||(Ur=!0),e.memoizedState=s,e.baseQueue===null&&(e.baseState=s),r.lastRenderedState=s}return[s,n]}function WD(){}function VD(t,e){var r=_t,n=On(),i=e(),s=!ci(n.memoizedState,i);if(s&&(n.memoizedState=i,Ur=!0),n=n.queue,ME(zD.bind(null,r,n,t),[t]),n.getSnapshot!==e||s||nr!==null&&nr.memoizedState.tag&1){if(r.flags|=2048,jd(9,KD.bind(null,r,n,i,e),void 0,null),ar===null)throw Error(te(349));Lo&30||HD(r,e,i)}return i}function HD(t,e,r){t.flags|=16384,t={getSnapshot:e,value:r},e=_t.updateQueue,e===null?(e={lastEffect:null,stores:null},_t.updateQueue=e,e.stores=[t]):(r=e.stores,r===null?e.stores=[t]:r.push(t))}function KD(t,e,r,n){e.value=r,e.getSnapshot=n,qD(e)&&YD(t)}function zD(t,e,r){return r(function(){qD(e)&&YD(t)})}function qD(t){var e=t.getSnapshot;t=t.value;try{var r=e();return!ci(t,r)}catch{return!0}}function YD(t){var e=vs(t,1);e!==null&&oi(e,t,1,-1)}function aA(t){var e=yi();return typeof t=="function"&&(t=t()),e.memoizedState=e.baseState=t,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:$d,lastRenderedState:t},e.queue=t,t=t.dispatch=j5.bind(null,_t,t),[e.memoizedState,t]}function jd(t,e,r,n){return t={tag:t,create:e,destroy:r,deps:n,next:null},e=_t.updateQueue,e===null?(e={lastEffect:null,stores:null},_t.updateQueue=e,e.lastEffect=t.next=t):(r=e.lastEffect,r===null?e.lastEffect=t.next=t:(n=r.next,r.next=t,t.next=n,e.lastEffect=t)),t}function XD(){return On().memoizedState}function Lp(t,e,r,n){var i=yi();_t.flags|=t,i.memoizedState=jd(1|e,r,void 0,n===void 0?null:n)}function rv(t,e,r,n){var i=On();n=n===void 0?null:n;var s=void 0;if(zt!==null){var a=zt.memoizedState;if(s=a.destroy,n!==null&&LE(n,a.deps)){i.memoizedState=jd(e,r,s,n);return}}_t.flags|=t,i.memoizedState=jd(1|e,r,s,n)}function oA(t,e){return Lp(8390656,8,t,e)}function ME(t,e){return rv(2048,8,t,e)}function QD(t,e){return rv(4,2,t,e)}function JD(t,e){return rv(4,4,t,e)}function ZD(t,e){if(typeof e=="function")return t=t(),e(t),function(){e(null)};if(e!=null)return t=t(),e.current=t,function(){e.current=null}}function eN(t,e,r){return r=r!=null?r.concat([t]):null,rv(4,4,ZD.bind(null,e,t),r)}function $E(){}function tN(t,e){var r=On();e=e===void 0?null:e;var n=r.memoizedState;return n!==null&&e!==null&&LE(e,n[1])?n[0]:(r.memoizedState=[t,e],t)}function rN(t,e){var r=On();e=e===void 0?null:e;var n=r.memoizedState;return n!==null&&e!==null&&LE(e,n[1])?n[0]:(t=t(),r.memoizedState=[t,e],t)}function nN(t,e,r){return Lo&21?(ci(r,e)||(r=lD(),_t.lanes|=r,Do|=r,t.baseState=!0),e):(t.baseState&&(t.baseState=!1,Ur=!0),t.memoizedState=r)}function M5(t,e){var r=Ye;Ye=r!==0&&4>r?r:4,t(!0);var n=Jy.transition;Jy.transition={};try{t(!1),e()}finally{Ye=r,Jy.transition=n}}function iN(){return On().memoizedState}function $5(t,e,r){var n=ma(t);if(r={lane:n,action:r,hasEagerState:!1,eagerState:null,next:null},sN(t))aN(e,r);else if(r=BD(t,e,r,n),r!==null){var i=Dr();oi(r,t,n,i),oN(r,e,n)}}function j5(t,e,r){var n=ma(t),i={lane:n,action:r,hasEagerState:!1,eagerState:null,next:null};if(sN(t))aN(e,i);else{var s=t.alternate;if(t.lanes===0&&(s===null||s.lanes===0)&&(s=e.lastRenderedReducer,s!==null))try{var a=e.lastRenderedState,o=s(a,r);if(i.hasEagerState=!0,i.eagerState=o,ci(o,a)){var l=e.interleaved;l===null?(i.next=i,IE(e)):(i.next=l.next,l.next=i),e.interleaved=i;return}}catch{}finally{}r=BD(t,e,i,n),r!==null&&(i=Dr(),oi(r,t,n,i),oN(r,e,n))}}function sN(t){var e=t.alternate;return t===_t||e!==null&&e===_t}function aN(t,e){ld=vm=!0;var r=t.pending;r===null?e.next=e:(e.next=r.next,r.next=e),t.pending=e}function oN(t,e,r){if(r&4194240){var n=e.lanes;n&=t.pendingLanes,r|=n,e.lanes=r,pE(t,r)}}var ym={readContext:Cn,useCallback:wr,useContext:wr,useEffect:wr,useImperativeHandle:wr,useInsertionEffect:wr,useLayoutEffect:wr,useMemo:wr,useReducer:wr,useRef:wr,useState:wr,useDebugValue:wr,useDeferredValue:wr,useTransition:wr,useMutableSource:wr,useSyncExternalStore:wr,useId:wr,unstable_isNewReconciler:!1},F5={readContext:Cn,useCallback:function(t,e){return yi().memoizedState=[t,e===void 0?null:e],t},useContext:Cn,useEffect:oA,useImperativeHandle:function(t,e,r){return r=r!=null?r.concat([t]):null,Lp(4194308,4,ZD.bind(null,e,t),r)},useLayoutEffect:function(t,e){return Lp(4194308,4,t,e)},useInsertionEffect:function(t,e){return Lp(4,2,t,e)},useMemo:function(t,e){var r=yi();return e=e===void 0?null:e,t=t(),r.memoizedState=[t,e],t},useReducer:function(t,e,r){var n=yi();return e=r!==void 0?r(e):e,n.memoizedState=n.baseState=e,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:e},n.queue=t,t=t.dispatch=$5.bind(null,_t,t),[n.memoizedState,t]},useRef:function(t){var e=yi();return t={current:t},e.memoizedState=t},useState:aA,useDebugValue:$E,useDeferredValue:function(t){return yi().memoizedState=t},useTransition:function(){var t=aA(!1),e=t[0];return t=M5.bind(null,t[1]),yi().memoizedState=t,[e,t]},useMutableSource:function(){},useSyncExternalStore:function(t,e,r){var n=_t,i=yi();if(bt){if(r===void 0)throw Error(te(407));r=r()}else{if(r=e(),ar===null)throw Error(te(349));Lo&30||HD(n,e,r)}i.memoizedState=r;var s={value:r,getSnapshot:e};return i.queue=s,oA(zD.bind(null,n,s,t),[t]),n.flags|=2048,jd(9,KD.bind(null,n,s,r,e),void 0,null),r},useId:function(){var t=yi(),e=ar.identifierPrefix;if(bt){var r=os,n=as;r=(n&~(1<<32-ai(n)-1)).toString(32)+r,e=":"+e+"R"+r,r=Md++,0<r&&(e+="H"+r.toString(32)),e+=":"}else r=N5++,e=":"+e+"r"+r.toString(32)+":";return t.memoizedState=e},unstable_isNewReconciler:!1},B5={readContext:Cn,useCallback:tN,useContext:Cn,useEffect:ME,useImperativeHandle:eN,useInsertionEffect:QD,useLayoutEffect:JD,useMemo:rN,useReducer:Zy,useRef:XD,useState:function(){return Zy($d)},useDebugValue:$E,useDeferredValue:function(t){var e=On();return nN(e,zt.memoizedState,t)},useTransition:function(){var t=Zy($d)[0],e=On().memoizedState;return[t,e]},useMutableSource:WD,useSyncExternalStore:VD,useId:iN,unstable_isNewReconciler:!1},U5={readContext:Cn,useCallback:tN,useContext:Cn,useEffect:ME,useImperativeHandle:eN,useInsertionEffect:QD,useLayoutEffect:JD,useMemo:rN,useReducer:e0,useRef
vendor: 4,996 bytes, lines 38-40
38:XD,useState:function(){return e0($d)},useDebugValue:$E,useDeferredValue:function(t){var e=On();return zt===null?e.memoizedState=t:nN(e,zt.memoizedState,t)},useTransition:function(){var t=e0($d)[0],e=On().memoizedState;return[t,e]},useMutableSource:WD,useSyncExternalStore:VD,useId:iN,unstable_isNewReconciler:!1};function zn(t,e){if(t&&t.defaultProps){e=At({},e),t=t.defaultProps;for(var r in t)e[r]===void 0&&(e[r]=t[r]);return e}return e}function fx(t,e,r,n){e=t.memoizedState,r=r(n,e),r=r==null?e:At({},e,r),t.memoizedState=r,t.lanes===0&&(t.updateQueue.baseState=r)}var nv={isMounted:function(t){return(t=t._reactInternals)?zo(t)===t:!1},enqueueSetState:function(t,e,r){t=t._reactInternals;var n=Dr(),i=ma(t),s=fs(n,i);s.payload=e,r!=null&&(s.callback=r),e=ha(t,s,i),e!==null&&(oi(e,t,i,n),Rp(e,t,i))},enqueueReplaceState:function(t,e,r){t=t._reactInternals;var n=Dr(),i=ma(t),s=fs(n,i);s.tag=1,s.payload=e,r!=null&&(s.callback=r),e=ha(t,s,i),e!==null&&(oi(e,t,i,n),Rp(e,t,i))},enqueueForceUpdate:function(t,e){t=t._reactInternals;var r=Dr(),n=ma(t),i=fs(r,n);i.tag=2,e!=null&&(i.callback=e),e=ha(t,i,n),e!==null&&(oi(e,t,n,r),Rp(e,t,n))}};function lA(t,e,r,n,i,s,a){return t=t.stateNode,typeof t.shouldComponentUpdate=="function"?t.shouldComponentUpdate(n,s,a):e.prototype&&e.prototype.isPureReactComponent?!Od(r,n)||!Od(i,s):!0}function lN(t,e,r){var n=!1,i=wa,s=e.contextType;return typeof s=="object"&&s!==null?s=Cn(s):(i=Kr(e)?Ro:Pr.current,n=e.contextTypes,s=(n=n!=null)?mc(t,i):wa),e=new e(r,s),t.memoizedState=e.state!==null&&e.state!==void 0?e.state:null,e.updater=nv,t.stateNode=e,e._reactInternals=t,n&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=i,t.__reactInternalMemoizedMaskedChildContext=s),e}function cA(t,e,r,n){t=e.state,typeof e.componentWillReceiveProps=="function"&&e.componentWillReceiveProps(r,n),typeof e.UNSAFE_componentWillReceiveProps=="function"&&e.UNSAFE_componentWillReceiveProps(r,n),e.state!==t&&nv.enqueueReplaceState(e,e.state,null)}function hx(t,e,r,n){var i=t.stateNode;i.props=r,i.state=t.memoizedState,i.refs={},CE(t);var s=e.contextType;typeof s=="object"&&s!==null?i.context=Cn(s):(s=Kr(e)?Ro:Pr.current,i.context=mc(t,s)),i.state=t.memoizedState,s=e.getDerivedStateFromProps,typeof s=="function"&&(fx(t,e,s,r),i.state=t.memoizedState),typeof e.getDerivedStateFromProps=="function"||typeof i.getSnapshotBeforeUpdate=="function"||typeof i.UNSAFE_componentWillMount!="function"&&typeof i.componentWillMount!="function"||(e=i.state,typeof i.componentWillMount=="function"&&i.componentWillMount(),typeof i.UNSAFE_componentWillMount=="function"&&i.UNSAFE_componentWillMount(),e!==i.state&&nv.enqueueReplaceState(i,i.state,null),mm(t,r,i,n),i.state=t.memoizedState),typeof i.componentDidMount=="function"&&(t.flags|=4194308)}function bc(t,e){try{var r="",n=e;do r+=m8(n),n=n.return;while(n);var i=r}catch(s){i=`
39Error generating stack: `+s.message+`
40`+s.stack}return{value:t,source:e,stack:i,digest:null}}function t0(t,e,r){return{value:t,source:null,stack:r??null,digest:e??null}}function px(t,e){try{console.error(e.value)}catch(r){setTimeout(function(){throw r})}}var G5=typeof WeakMap=="function"?WeakMap:Map;function cN(t,e,r){r=fs(-1,r),r.tag=3,r.payload={element:null};var n=e.value;return r.callback=function(){xm||(xm=!0,Tx=n),px(t,e)},r}function uN(t,e,r){r=fs(-1,r),r.tag=3;var n=t.type.getDerivedStateFromError;if(typeof n=="function"){var i=e.value;r.payload=function(){return n(i)},r.callback=function(){px(t,e)}}var s=t.stateNode;return s!==null&&typeof s.componentDidCatch=="function"&&(r.callback=function(){px(t,e),typeof n!="function"&&(pa===null?pa=new Set([this]):pa.add(this));var a=e.stack;this.componentDidCatch(e.value,{componentStack:a!==null?a:""})}),r}function uA(t,e,r){var n=t.pingCache;if(n===null){n=t.pingCache=new G5;var i=new Set;n.set(e,i)}else i=n.get(e),i===void 0&&(i=new Set,n.set(e,i));i.has(r)||(i.add(r),t=r6.bind(null,t,e,r),e.then(t,t))}function dA(t){do{var e;if((e=t.tag===13)&&(e=t.memoizedState,e=e!==null?e.dehydrated!==null:!0),e)return t;t=t.return}while(t!==null);return null}function fA(t,e,r,n,i){return t.mode&1?(t.flags|=65536,t.lanes=i,t):(t===e?t.flags|=65536:(t.flags|=128,r.flags|=131072,r.flags&=-52805,r.tag===1&&(r.alternate===null?r.tag=17:(e=fs(-1,1),e.tag=2,ha(r,e,1))),r.lanes|=1),t)}var W5=_s.ReactCurrentOwner,Ur=!1;function Cr(t,e,r,n){e.child=t===null?FD(e,null,r,n):vc(e,t.child,r,n)}function hA(t,e,r,n,i){r=r.render;var s=e.ref;return Kl(e,i),n=DE(t,e,r,n,s,i),r=NE(),t!==null&&!Ur?(e.updateQueue=t.updateQueue,e.flags&=-2053,t.lanes&=~i,ys(t,e,i)):(bt&&r&&SE(e),e.flags|=1,Cr(t,e,n,i),e.child)}function pA(t,e,r,n,i){if(t===null){var s=r.type;return typeof s=="function"&&!HE(s)&&s.defaultProps===void 0&&r.compare===null&&r.defaultProps===void 0?(e.tag=15,e.type=s,dN(t,e,s,n,i)):(t=$p(r.type,null,n,e,e.mode,i),t.ref=e.ref,t.return=e,e.child=t)}if(s=t.child,!(t.lanes&i)){var a=s.memoizedProps;if(r=r.compare,r=r!==null?r:Od,r(a,n)&&t.ref===e.ref)return ys(t,e,
vendor: 10,009 bytes, line 40
40i)}return e.flags|=1,t=ga(s,n),t.ref=e.ref,t.return=e,e.child=t}function dN(t,e,r,n,i){if(t!==null){var s=t.memoizedProps;if(Od(s,n)&&t.ref===e.ref)if(Ur=!1,e.pendingProps=n=s,(t.lanes&i)!==0)t.flags&131072&&(Ur=!0);else return e.lanes=t.lanes,ys(t,e,i)}return mx(t,e,r,n,i)}function fN(t,e,r){var n=e.pendingProps,i=n.children,s=t!==null?t.memoizedState:null;if(n.mode==="hidden")if(!(e.mode&1))e.memoizedState={baseLanes:0,cachePool:null,transitions:null},ut(Ml,tn),tn|=r;else{if(!(r&1073741824))return t=s!==null?s.baseLanes|r:r,e.lanes=e.childLanes=1073741824,e.memoizedState={baseLanes:t,cachePool:null,transitions:null},e.updateQueue=null,ut(Ml,tn),tn|=t,null;e.memoizedState={baseLanes:0,cachePool:null,transitions:null},n=s!==null?s.baseLanes:r,ut(Ml,tn),tn|=n}else s!==null?(n=s.baseLanes|r,e.memoizedState=null):n=r,ut(Ml,tn),tn|=n;return Cr(t,e,i,r),e.child}function hN(t,e){var r=e.ref;(t===null&&r!==null||t!==null&&t.ref!==r)&&(e.flags|=512,e.flags|=2097152)}function mx(t,e,r,n,i){var s=Kr(r)?Ro:Pr.current;return s=mc(e,s),Kl(e,i),r=DE(t,e,r,n,s,i),n=NE(),t!==null&&!Ur?(e.updateQueue=t.updateQueue,e.flags&=-2053,t.lanes&=~i,ys(t,e,i)):(bt&&n&&SE(e),e.flags|=1,Cr(t,e,r,i),e.child)}function mA(t,e,r,n,i){if(Kr(r)){var s=!0;um(e)}else s=!1;if(Kl(e,i),e.stateNode===null)Dp(t,e),lN(e,r,n),hx(e,r,n,i),n=!0;else if(t===null){var a=e.stateNode,o=e.memoizedProps;a.props=o;var l=a.context,c=r.contextType;typeof c=="object"&&c!==null?c=Cn(c):(c=Kr(r)?Ro:Pr.current,c=mc(e,c));var u=r.getDerivedStateFromProps,d=typeof u=="function"||typeof a.getSnapshotBeforeUpdate=="function";d||typeof a.UNSAFE_componentWillReceiveProps!="function"&&typeof a.componentWillReceiveProps!="function"||(o!==n||l!==c)&&cA(e,a,n,c),Hs=!1;var f=e.memoizedState;a.state=f,mm(e,n,a,i),l=e.memoizedState,o!==n||f!==l||Hr.current||Hs?(typeof u=="function"&&(fx(e,r,u,n),l=e.memoizedState),(o=Hs||lA(e,r,o,n,f,l,c))?(d||typeof a.UNSAFE_componentWillMount!="function"&&typeof a.componentWillMount!="function"||(typeof a.componentWillMount=="function"&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount=="function"&&a.UNSAFE_componentWillMount()),typeof a.componentDidMount=="function"&&(e.flags|=4194308)):(typeof a.componentDidMount=="function"&&(e.flags|=4194308),e.memoizedProps=n,e.memoizedState=l),a.props=n,a.state=l,a.context=c,n=o):(typeof a.componentDidMount=="function"&&(e.flags|=4194308),n=!1)}else{a=e.stateNode,UD(t,e),o=e.memoizedProps,c=e.type===e.elementType?o:zn(e.type,o),a.props=c,d=e.pendingProps,f=a.context,l=r.contextType,typeof l=="object"&&l!==null?l=Cn(l):(l=Kr(r)?Ro:Pr.current,l=mc(e,l));var h=r.getDerivedStateFromProps;(u=typeof h=="function"||typeof a.getSnapshotBeforeUpdate=="function")||typeof a.UNSAFE_componentWillReceiveProps!="function"&&typeof a.componentWillReceiveProps!="function"||(o!==d||f!==l)&&cA(e,a,n,l),Hs=!1,f=e.memoizedState,a.state=f,mm(e,n,a,i);var p=e.memoizedState;o!==d||f!==p||Hr.current||Hs?(typeof h=="function"&&(fx(e,r,h,n),p=e.memoizedState),(c=Hs||lA(e,r,c,n,f,p,l)||!1)?(u||typeof a.UNSAFE_componentWillUpdate!="function"&&typeof a.componentWillUpdate!="function"||(typeof a.componentWillUpdate=="function"&&a.componentWillUpdate(n,p,l),typeof a.UNSAFE_componentWillUpdate=="function"&&a.UNSAFE_componentWillUpdate(n,p,l)),typeof a.componentDidUpdate=="function"&&(e.flags|=4),typeof a.getSnapshotBeforeUpdate=="function"&&(e.flags|=1024)):(typeof a.componentDidUpdate!="function"||o===t.memoizedProps&&f===t.memoizedState||(e.flags|=4),typeof a.getSnapshotBeforeUpdate!="function"||o===t.memoizedProps&&f===t.memoizedState||(e.flags|=1024),e.memoizedProps=n,e.memoizedState=p),a.props=n,a.state=p,a.context=l,n=c):(typeof a.componentDidUpdate!="function"||o===t.memoizedProps&&f===t.memoizedState||(e.flags|=4),typeof a.getSnapshotBeforeUpdate!="function"||o===t.memoizedProps&&f===t.memoizedState||(e.flags|=1024),n=!1)}return gx(t,e,r,n,s,i)}function gx(t,e,r,n,i,s){hN(t,e);var a=(e.flags&128)!==0;if(!n&&!a)return i&&eA(e,r,!1),ys(t,e,s);n=e.stateNode,W5.current=e;var o=a&&typeof r.getDerivedStateFromError!="function"?null:n.render();return e.flags|=1,t!==null&&a?(e.child=vc(e,t.child,null,s),e.child=vc(e,null,o,s)):Cr(t,e,o,s),e.memoizedState=n.state,i&&eA(e,r,!0),e.child}function pN(t){var e=t.stateNode;e.pendingContext?Z1(t,e.pendingContext,e.pendingContext!==e.context):e.context&&Z1(t,e.context,!1),OE(t,e.containerInfo)}function gA(t,e,r,n,i){return gc(),TE(i),e.flags|=256,Cr(t,e,r,n),e.child}var vx={dehydrated:null,treeContext:null,retryLane:0};function yx(t){return{baseLanes:t,cachePool:null,transitions:null}}function mN(t,e,r){var n=e.pendingProps,i=Et.current,s=!1,a=(e.flags&128)!==0,o;if((o=a)||(o=t!==null&&t.memoizedState===null?!1:(i&2)!==0),o?(s=!0,e.flags&=-129):(t===null||t.memoizedState!==null)&&(i|=1),ut(Et,i&1),t===null)return ux(e),t=e.memoizedState,t!==null&&(t=t.dehydrated,t!==null)?(e.mode&1?t.data==="$!"?e.lanes=8:e.lanes=1073741824:e.lanes=1,null):(a=n.children,t=n.fallback,s?(n=e.mode,s=e.child,a={mode:"hidden",children:a},!(n&1)&&s!==null?(s.childLanes=0,s.pendingProps=a):s=av(a,n,0,null),t=wo(t,n,r,null),s.return=e,t.return=e,s.sibling=t,e.child=s,e.child.memoizedState=yx(r),e.memoizedState=vx,t):jE(e,a));if(i=t.memoizedState,i!==null&&(o=i.dehydrated,o!==null))return V5(t,e,a,n,o,i,r);if(s){s=n.fallback,a=e.mode,i=t.child,o=i.sibling;var l={mode:"hidden",children:n.children};return!(a&1)&&e.child!==i?(n=e.child,n.childLanes=0,n.pendingProps=l,e.deletions=null):(n=ga(i,l),n.subtreeFlags=i.subtreeFlags&14680064),o!==null?s=ga(o,s):(s=wo(s,a,r,null),s.flags|=2),s.return=e,n.return=e,n.sibling=s,e.child=n,n=s,s=e.child,a=t.child.memoizedState,a=a===null?yx(r):{baseLanes:a.baseLanes|r,cachePool:null,transitions:a.transitions},s.memoizedState=a,s.childLanes=t.childLanes&~r,e.memoizedState=vx,n}return s=t.child,t=s.sibling,n=ga(s,{mode:"visible",children:n.children}),!(e.mode&1)&&(n.lanes=r),n.return=e,n.sibling=null,t!==null&&(r=e.deletions,r===null?(e.deletions=[t],e.flags|=16):r.push(t)),e.child=n,e.memoizedState=null,n}function jE(t,e){return e=av({mode:"visible",children:e},t.mode,0,null),e.return=t,t.child=e}function kh(t,e,r,n){return n!==null&&TE(n),vc(e,t.child,null,r),t=jE(e,e.pendingProps.children),t.flags|=2,e.memoizedState=null,t}function V5(t,e,r,n,i,s,a){if(r)return e.flags&256?(e.flags&=-257,n=t0(Error(te(422))),kh(t,e,a,n)):e.memoizedState!==null?(e.child=t.child,e.flags|=128,null):(s=n.fallback,i=e.mode,n=av({mode:"visible",children:n.children},i,0,null),s=wo(s,i,a,null),s.flags|=2,n.return=e,s.return=e,n.sibling=s,e.child=n,e.mode&1&&vc(e,t.child,null,a),e.child.memoizedState=yx(a),e.memoizedState=vx,s);if(!(e.mode&1))return kh(t,e,a,null);if(i.data==="$!"){if(n=i.nextSibling&&i.nextSibling.dataset,n)var o=n.dgst;return n=o,s=Error(te(419)),n=t0(s,n,void 0),kh(t,e,a,n)}if(o=(a&t.childLanes)!==0,Ur||o){if(n=ar,n!==null){switch(a&-a){case 4:i=2;break;case 16:i=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:i=32;break;case 536870912:i=268435456;break;default:i=0}i=i&(n.suspendedLanes|a)?0:i,i!==0&&i!==s.retryLane&&(s.retryLane=i,vs(t,i),oi(n,t,i,-1))}return VE(),n=t0(Error(te(421))),kh(t,e,a,n)}return i.data==="$?"?(e.flags|=128,e.child=t.child,e=n6.bind(null,t),i._reactRetry=e,null):(t=s.treeContext,un=fa(i.nextSibling),dn=e,bt=!0,ni=null,t!==null&&(En[Tn++]=as,En[Tn++]=os,En[Tn++]=ko,as=t.id,os=t.overflow,ko=e),e=jE(e,n.children),e.flags|=4096,e)}function vA(t,e,r){t.lanes|=e;var n=t.alternate;n!==null&&(n.lanes|=e),dx(t.return,e,r)}function r0(t,e,r,n,i){var s=t.memoizedState;s===null?t.memoizedState={isBackwards:e,rendering:null,renderingStartTime:0,last:n,tail:r,tailMode:i}:(s.isBackwards=e,s.rendering=null,s.renderingStartTime=0,s.last=n,s.tail=r,s.tailMode=i)}function gN(t,e,r){var n=e.pendingProps,i=n.revealOrder,s=n.tail;if(Cr(t,e,n.children,r),n=Et.current,n&2)n=n&1|2,e.flags|=128;else{if(t!==null&&t.flags&128)e:for(t=e.child;t!==null;){if(t.tag===13)t.memoizedState!==null&&vA(t,r,e);else if(t.tag===19)vA(t,r,e);else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break e;for(;t.sibling===null;){if(t.return===null||t.return===e)break e;t=t.return}t.sibling.return=t.return,t=t.sibling}n&=1}if(ut(Et,n),!(e.mode&1))e.memoizedState=null;else switch(i){case"forwards":for(r=e.child,i=null;r!==null;)t=r.alternate,t!==null&&gm(t)===null&&(i=r),r=r.sibling;r=i,r===null?(i=e.child,e.child=null):(i=r.sibling,r.sibling=null),r0(e,!1,i,r,s);break;case"backwards":for(r=null,i=e.child,e.child=null;i!==null;){if(t=i.alternate,t!==null&&gm(t)===null){e.child=i;break}t=i.sibling,i.sibling=r,r=i,i=t}r0(e,!0,r,null,s);break;case"together":r0(e,!1,null,null,void 0);break;default:e.memoizedState=null}return e.child}function Dp(t,e){!(e.mode&1)&&t!==null&&(t.alternate=null,e.alternate=null,e.flags|=2)}function ys(t,e,r){if(t!==null&&(e.dependencies=t.dependencies),Do|=e.lanes,!(r&e.childLanes))return null;if(t!==null&&e.child!==t.child)throw Error(te(153));if(e.child!==null){for(t=e.child,r=ga(t,t.pendingProps),e.child=r,r.return=e;t.sibling!==null;)t=t.sibling,r=r.sibling=ga(t,t.pendingProps),r.return=e;r.sibling=null}return e.child}function H5(t,e,r){switch(e.tag){case 3:pN(e),gc();break;case 5:GD(e);break;case 1:Kr(e.type)&&um(e);break;case 4:OE(e,e.stateNode.containerInfo);break;case 10:var n=e.type._context,i=e.memoizedProps.value;ut(hm,n._currentValue),n._currentValue=i;break;case 13:if(n=e.memoizedState,n!==null)return n.dehydrated!==null?(ut(Et,Et.current&1),e.flags|=128,null):r&e.child.childLanes?mN(t,e,r):(ut(Et,Et.current&1),t=ys(t,e,r),t!==null?t.sibling:null);ut(Et,Et.current&1);break;case 19:if(n=(r&e.childLanes)!==0,t.flags&128){if(n)return gN(t,e,r);e.flags|=128}if(i=e.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),ut(Et,Et.current),n)break;return null;
vendor: 4,598 bytes, line 40
40case 22:case 23:return e.lanes=0,fN(t,e,r)}return ys(t,e,r)}var vN,bx,yN,bN;vN=function(t,e){for(var r=e.child;r!==null;){if(r.tag===5||r.tag===6)t.appendChild(r.stateNode);else if(r.tag!==4&&r.child!==null){r.child.return=r,r=r.child;continue}if(r===e)break;for(;r.sibling===null;){if(r.return===null||r.return===e)return;r=r.return}r.sibling.return=r.return,r=r.sibling}};bx=function(){};yN=function(t,e,r,n){var i=t.memoizedProps;if(i!==n){t=e.stateNode,oo(Li.current);var s=null;switch(r){case"input":i=Ub(t,i),n=Ub(t,n),s=[];break;case"select":i=At({},i,{value:void 0}),n=At({},n,{value:void 0}),s=[];break;case"textarea":i=Vb(t,i),n=Vb(t,n),s=[];break;default:typeof i.onClick!="function"&&typeof n.onClick=="function"&&(t.onclick=lm)}Kb(r,n);var a;r=null;for(c in i)if(!n.hasOwnProperty(c)&&i.hasOwnProperty(c)&&i[c]!=null)if(c==="style"){var o=i[c];for(a in o)o.hasOwnProperty(a)&&(r||(r={}),r[a]="")}else c!=="dangerouslySetInnerHTML"&&c!=="children"&&c!=="suppressContentEditableWarning"&&c!=="suppressHydrationWarning"&&c!=="autoFocus"&&(Ed.hasOwnProperty(c)?s||(s=[]):(s=s||[]).push(c,null));for(c in n){var l=n[c];if(o=i!=null?i[c]:void 0,n.hasOwnProperty(c)&&l!==o&&(l!=null||o!=null))if(c==="style")if(o){for(a in o)!o.hasOwnProperty(a)||l&&l.hasOwnProperty(a)||(r||(r={}),r[a]="");for(a in l)l.hasOwnProperty(a)&&o[a]!==l[a]&&(r||(r={}),r[a]=l[a])}else r||(s||(s=[]),s.push(c,r)),r=l;else c==="dangerouslySetInnerHTML"?(l=l?l.__html:void 0,o=o?o.__html:void 0,l!=null&&o!==l&&(s=s||[]).push(c,l)):c==="children"?typeof l!="string"&&typeof l!="number"||(s=s||[]).push(c,""+l):c!=="suppressContentEditableWarning"&&c!=="suppressHydrationWarning"&&(Ed.hasOwnProperty(c)?(l!=null&&c==="onScroll"&&ht("scroll",t),s||o===l||(s=[])):(s=s||[]).push(c,l))}r&&(s=s||[]).push("style",r);var c=s;(e.updateQueue=c)&&(e.flags|=4)}};bN=function(t,e,r,n){r!==n&&(e.flags|=4)};function Cu(t,e){if(!bt)switch(t.tailMode){case"hidden":e=t.tail;for(var r=null;e!==null;)e.alternate!==null&&(r=e),e=e.sibling;r===null?t.tail=null:r.sibling=null;break;case"collapsed":r=t.tail;for(var n=null;r!==null;)r.alternate!==null&&(n=r),r=r.sibling;n===null?e||t.tail===null?t.tail=null:t.tail.sibling=null:n.sibling=null}}function Sr(t){var e=t.alternate!==null&&t.alternate.child===t.child,r=0,n=0;if(e)for(var i=t.child;i!==null;)r|=i.lanes|i.childLanes,n|=i.subtreeFlags&14680064,n|=i.flags&14680064,i.return=t,i=i.sibling;else for(i=t.child;i!==null;)r|=i.lanes|i.childLanes,n|=i.subtreeFlags,n|=i.flags,i.return=t,i=i.sibling;return t.subtreeFlags|=n,t.childLanes=r,e}function K5(t,e,r){var n=e.pendingProps;switch(EE(e),e.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Sr(e),null;case 1:return Kr(e.type)&&cm(),Sr(e),null;case 3:return n=e.stateNode,yc(),gt(Hr),gt(Pr),kE(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(t===null||t.child===null)&&(Oh(e)?e.flags|=4:t===null||t.memoizedState.isDehydrated&&!(e.flags&256)||(e.flags|=1024,ni!==null&&(Px(ni),ni=null))),bx(t,e),Sr(e),null;case 5:RE(e);var i=oo(Nd.current);if(r=e.type,t!==null&&e.stateNode!=null)yN(t,e,r,n,i),t.ref!==e.ref&&(e.flags|=512,e.flags|=2097152);else{if(!n){if(e.stateNode===null)throw Error(te(166));return Sr(e),null}if(t=oo(Li.current),Oh(e)){n=e.stateNode,r=e.type;var s=e.memoizedProps;switch(n[Ti]=e,n[Ld]=s,t=(e.mode&1)!==0,r){case"dialog":ht("cancel",n),ht("close",n);break;case"iframe":case"object":case"embed":ht("load",n);break;case"video":case"audio":for(i=0;i<Xu.length;i++)ht(Xu[i],n);break;case"source":ht("error",n);break;case"img":case"image":case"link":ht("error",n),ht("load",n);break;case"details":ht("toggle",n);break;case"input":A1(n,s),ht("invalid",n);break;case"select":n._wrapperState={wasMultiple:!!s.multiple},ht("invalid",n);break;case"textarea":I1(n,s),ht("invalid",n)}Kb(r,s),i=null;for(var a in s)if(s.hasOwnProperty(a)){var o=s[a];a==="children"?typeof o=="string"?n.textContent!==o&&(s.suppressHydrationWarning!==!0&&Ch(n.textContent,o,t),i=["children",o]):typeof o=="number"&&n.textContent!==""+o&&(s.suppressHydrationWarning!==!0&&Ch(n.textContent,o,t),i=["children",""+o]):Ed.hasOwnProperty(a)&&o!=null&&a==="onScroll"&&ht("scroll",n)}switch(r){case"input":wh(n),P1(n,s,!0);break;case"textarea":wh(n),C1(n);break;case"select":case"option":break;default:typeof s.onClick=="function"&&(n.onclick=lm)}n=i,e.updateQueue=n,n!==null&&(e.flags|=4)}else{a=i.nodeType===9?i:i.ownerDocument,t==="http://www.w3.org/1999/xhtml"&&(t=zL(r)),t==="http://www.w3.org/1999/xhtml"?r==="script"?(t=a.createElement("div"),t.innerHTML="<script><\/script>
40",t=t.removeChild(t.firstChild)):typeof n.is=="string"?t=a.createElement(r,{is:n.is}):(t=a.createElement(r),r==="select"&&(a=t,n.multiple?a.multiple=!0:n.size&&(a.size=n.size))):t=a.createElementNS(t,r),t[Ti]=e,t[Ld]=n,vN(t,e,!1,!1),e.stateNode=t;e:{switch(a=zb(r,n),r){case"dialog":ht("cancel",t),ht("close",t),i=n;break;case"iframe":case"object":case"embed":ht("load",t),i=n;break;case"video":case"audio":for(i=0;i<Xu.length;i++)ht(Xu[i],t);i=n;break;case"source":ht("error",t),i=n;break;case"img":case"image":case"link":ht("error",t),ht("load",t),i=n;break;case"details":ht("toggle",t),i=n;break;case"input":A1(t,n),i=Ub(t,n),ht("invalid",t);break;case"option":i=n;break;case"select":t._wrapperState={wasMultiple:!!n.multiple},i=At({},n,{value:void 0}),ht("invalid",t);break;case"textarea":I1(t,n),i=Vb(t,n),ht("invalid",t);break;default:i=n}Kb(r,i),o=i;for(s in o)if(o.hasOwnProperty(s)){var l=o[s];s==="style"?XL(t,l):s==="dangerouslySetInnerHTML"?(l=l?l.__html:void 0,l!=null&&qL(t,l)):s==="children"?typeof l=="string"?(r!=="textarea"||l!=="")&&Td(t,l):typeof l=="number"&&Td(t,""+l):s!=="suppressContentEditableWarning"&&s!=="suppressHydrationWarning"&&s!=="autoFocus"&&(Ed.hasOwnProperty(s)?l!=null&&s==="onScroll"&&ht("scroll",t):l!=null&&lE(t,s,l,a))}switch(r){case"input":wh(t),P1(t,n,!1);break;case"textarea":wh(t),C1(t);break;case"option":n.value!=null&&t.setAttribute("value",""+xa(n.value));break;case"select":t.multiple=!!n.multiple,s=n.value,s!=null?Gl(t,!!n.multiple,s,!1):n.defaultValue!=null&&Gl(t,!!n.multiple,n.defaultValue,!0);break;default:typeof i.onClick=="function"&&(t.onclick=lm)}switch(r){case"button":case"input":case"select":case"textarea":n=!!n.autoFocus;break e;case"img":n=!0;break e;default:n=!1}}n&&(e.flags|=4)}e.ref!==null&&(e.flags|=512,e.flags|=2097152)}return Sr(e),null;case 6:if(t&&e.stateNode!=null)bN(t,e,t.memoizedProps,n);else{if(typeof n!="string"&&e.stateNode===null)throw Error(te(166));if(r=oo(Nd.current),oo(Li.current),Oh(e)){if(n=e.stateNode,r=e.memoizedProps,n[Ti]=e,(s=n.nodeValue!==r)&&(t=dn,t!==null))switch(t.tag){case 3:Ch(n.nodeValue,r,(t.mode&1)!==0);break;case 5:t.memoizedProps.suppressHydrationWarning!==!0&&Ch(n.nodeValue,r,(t.mode&1)!==0)}s&&(e.flags|=4)}else n=(r.nodeType===9?r:r.ownerDocument).createTextNode(n),n[Ti]=e,e.stateNode=n}return Sr(e),null;case 13:if(gt(Et),n=e.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(bt&&un!==null&&e.mode&1&&!(e.flags&128))$D(),gc(),e.flags|=98560,s=!1;else if(s=Oh(e),n!==null&&n.dehydrated!==null){if(t===null){if(!s)throw Error(te(318));if(s=e.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(te(317));s[Ti]=e}else gc(),!(e.flags&128)&&(e.memoizedState=null),e.flags|=4;Sr(e),s=!1}else ni!==null&&(Px(ni),ni=null),s=!0;if(!s)return e.flags&65536?e:null}return e.flags&128?(e.lanes=r,e):(n=n!==null,n!==(t!==null&&t.memoizedState!==null)&&n&&(e.child.flags|=8192,e.mode&1&&(t===null||Et.current&1?Yt===0&&(Yt=3):VE())),e.updateQueue!==null&&(e.flags|=4),Sr(e),null);case 4:return yc(),bx(t,e),t===null&&Rd(e.stateNode.containerInfo),Sr(e),null;case 10:return PE(e.type._context),Sr(e),null;case 17:return Kr(e.type)&&cm(),Sr(e),null;case 19:if(gt(Et),s=e.memoizedState,s===null)return Sr(e),null;if(n=(e.flags&128)!==0,a=s.rendering,a===null)if(n)Cu(s,!1);else{if(Yt!==0||t!==null&&t.flags&128)for(t=e.child;t!==null;){if(a=gm(t),a!==null){for(e.flags|=128,Cu(s,!1),n=a.updateQueue,n!==null&&(e.updateQueue=n,e.flags|=4),e.subtreeFlags=0,n=r,r=e.child;r!==null;)s=r,t=n,s.flags&=14680066,a=s.alternate,a===null?(s.childLanes=0,s.lanes=t,s.child=null,s.subtreeFlags=0,s.memoizedProps=null,s.memoizedState=null,s.updateQueue=null,s.dependencies=null,s.stateNode=null):(s.childLanes=a.childLanes,s.lanes=a.lanes,s.child=a.child,s.subtreeFlags=0,s.deletions=null,s.memoizedProps=a.memoizedProps,s.memoizedState=a.memoizedState,s.updateQueue=a.updateQueue,s.type=a.type,t=a.dependencies,s.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),r=r.sibling;return ut(Et,Et.current&1|2),e.child}t=t.sibling}s.tail!==null&&Lt()>xc&&(e.flags|=128,n=!0,Cu(s,!1),e.lanes=4194304)}else{if(!n)if(t=gm(a),t!==null){if(e.flags|=128,n=!0,r=t.updateQueue,r!==null&&(e.updateQueue=r,e.flags|=4),Cu(s,!0),s.tail===null&&s.tailMode==="hidden"&&!a.alternate&&!bt)return Sr(e),null}else 2*Lt()-s.renderingStartTime>xc&&r!==1073741824&&(e.flags|=128,n=!0,Cu(s,!1),e.lanes=4194304);s.isBackwards?(a.sibling=e.child,e.child=a):(r=s.last,r!==null?r.sibling=a:e.child=a,s.last=a)}return s.tail!==null?(e=s.tail,s.rendering=e,s.tail=e.sibling,s.renderingStartTime=Lt(),e.sibling=null,r=Et.current,ut(Et,n?r&1|2:r&1),e):(Sr(e),null);case 22:case 23:return WE(),n=e.memoizedState!==null,t!==null&&t.memoizedState!==null!==n&&(e.flags|=8192),n&&e.mode&1?tn&1073741824&&(Sr(e),e.subtreeFlags&6&&(e.flags|=8192)):Sr(e),null;case 24:return null;case 25:return null}throw Error(te(156,e.tag))}function z5(t,e){switch(EE(e),e.tag){case 1:return Kr(e.type)&&cm(),t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;
vendor: 13,800 bytes, line 40
40case 3:return yc(),gt(Hr),gt(Pr),kE(),t=e.flags,t&65536&&!(t&128)?(e.flags=t&-65537|128,e):null;case 5:return RE(e),null;case 13:if(gt(Et),t=e.memoizedState,t!==null&&t.dehydrated!==null){if(e.alternate===null)throw Error(te(340));gc()}return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 19:return gt(Et),null;case 4:return yc(),null;case 10:return PE(e.type._context),null;case 22:case 23:return WE(),null;case 24:return null;default:return null}}var Lh=!1,_r=!1,q5=typeof WeakSet=="function"?WeakSet:Set,le=null;function Nl(t,e){var r=t.ref;if(r!==null)if(typeof r=="function")try{r(null)}catch(n){Ot(t,e,n)}else r.current=null}function xx(t,e,r){try{r()}catch(n){Ot(t,e,n)}}var yA=!1;function Y5(t,e){if(nx=sm,t=TD(),wE(t)){if("selectionStart"in t)var r={start:t.selectionStart,end:t.selectionEnd};else e:{r=(r=t.ownerDocument)&&r.defaultView||window;var n=r.getSelection&&r.getSelection();if(n&&n.rangeCount!==0){r=n.anchorNode;var i=n.anchorOffset,s=n.focusNode;n=n.focusOffset;try{r.nodeType,s.nodeType}catch{r=null;break e}var a=0,o=-1,l=-1,c=0,u=0,d=t,f=null;t:for(;;){for(var h;d!==r||i!==0&&d.nodeType!==3||(o=a+i),d!==s||n!==0&&d.nodeType!==3||(l=a+n),d.nodeType===3&&(a+=d.nodeValue.length),(h=d.firstChild)!==null;)f=d,d=h;for(;;){if(d===t)break t;if(f===r&&++c===i&&(o=a),f===s&&++u===n&&(l=a),(h=d.nextSibling)!==null)break;d=f,f=d.parentNode}d=h}r=o===-1||l===-1?null:{start:o,end:l}}else r=null}r=r||{start:0,end:0}}else r=null;for(ix={focusedElem:t,selectionRange:r},sm=!1,le=e;le!==null;)if(e=le,t=e.child,(e.subtreeFlags&1028)!==0&&t!==null)t.return=e,le=t;else for(;le!==null;){e=le;try{var p=e.alternate;if(e.flags&1024)switch(e.tag){case 0:case 11:case 15:break;case 1:if(p!==null){var g=p.memoizedProps,m=p.memoizedState,v=e.stateNode,y=v.getSnapshotBeforeUpdate(e.elementType===e.type?g:zn(e.type,g),m);v.__reactInternalSnapshotBeforeUpdate=y}break;case 3:var b=e.stateNode.containerInfo;b.nodeType===1?b.textContent="":b.nodeType===9&&b.documentElement&&b.removeChild(b.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(te(163))}}catch(w){Ot(e,e.return,w)}if(t=e.sibling,t!==null){t.return=e.return,le=t;break}le=e.return}return p=yA,yA=!1,p}function cd(t,e,r){var n=e.updateQueue;if(n=n!==null?n.lastEffect:null,n!==null){var i=n=n.next;do{if((i.tag&t)===t){var s=i.destroy;i.destroy=void 0,s!==void 0&&xx(e,r,s)}i=i.next}while(i!==n)}}function iv(t,e){if(e=e.updateQueue,e=e!==null?e.lastEffect:null,e!==null){var r=e=e.next;do{if((r.tag&t)===t){var n=r.create;r.destroy=n()}r=r.next}while(r!==e)}}function wx(t){var e=t.ref;if(e!==null){var r=t.stateNode;switch(t.tag){case 5:t=r;break;default:t=r}typeof e=="function"?e(t):e.current=t}}function xN(t){var e=t.alternate;e!==null&&(t.alternate=null,xN(e)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(e=t.stateNode,e!==null&&(delete e[Ti],delete e[Ld],delete e[ox],delete e[R5],delete e[k5])),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}function wN(t){return t.tag===5||t.tag===3||t.tag===4}function bA(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||wN(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function Sx(t,e,r){var n=t.tag;if(n===5||n===6)t=t.stateNode,e?r.nodeType===8?r.parentNode.insertBefore(t,e):r.insertBefore(t,e):(r.nodeType===8?(e=r.parentNode,e.insertBefore(t,r)):(e=r,e.appendChild(t)),r=r._reactRootContainer,r!=null||e.onclick!==null||(e.onclick=lm));else if(n!==4&&(t=t.child,t!==null))for(Sx(t,e,r),t=t.sibling;t!==null;)Sx(t,e,r),t=t.sibling}function Ex(t,e,r){var n=t.tag;if(n===5||n===6)t=t.stateNode,e?r.insertBefore(t,e):r.appendChild(t);else if(n!==4&&(t=t.child,t!==null))for(Ex(t,e,r),t=t.sibling;t!==null;)Ex(t,e,r),t=t.sibling}var fr=null,Zn=!1;function Ms(t,e,r){for(r=r.child;r!==null;)SN(t,e,r),r=r.sibling}function SN(t,e,r){if(ki&&typeof ki.onCommitFiberUnmount=="function")try{ki.onCommitFiberUnmount(Xg,r)}catch{}switch(r.tag){case 5:_r||Nl(r,e);case 6:var n=fr,i=Zn;fr=null,Ms(t,e,r),fr=n,Zn=i,fr!==null&&(Zn?(t=fr,r=r.stateNode,t.nodeType===8?t.parentNode.removeChild(r):t.removeChild(r)):fr.removeChild(r.stateNode));break;case 18:fr!==null&&(Zn?(t=fr,r=r.stateNode,t.nodeType===8?Yy(t.parentNode,r):t.nodeType===1&&Yy(t,r),Id(t)):Yy(fr,r.stateNode));break;case 4:n=fr,i=Zn,fr=r.stateNode.containerInfo,Zn=!0,Ms(t,e,r),fr=n,Zn=i;break;case 0:case 11:case 14:case 15:if(!_r&&(n=r.updateQueue,n!==null&&(n=n.lastEffect,n!==null))){i=n=n.next;do{var s=i,a=s.destroy;s=s.tag,a!==void 0&&(s&2||s&4)&&xx(r,e,a),i=i.next}while(i!==n)}Ms(t,e,r);break;case 1:if(!_r&&(Nl(r,e),n=r.stateNode,typeof n.componentWillUnmount=="function"))try{n.props=r.memoizedProps,n.state=r.memoizedState,n.componentWillUnmount()}catch(o){Ot(r,e,o)}Ms(t,e,r);break;case 21:Ms(t,e,r);break;case 22:r.mode&1?(_r=(n=_r)||r.memoizedState!==null,Ms(t,e,r),_r=n):Ms(t,e,r);break;default:Ms(t,e,r)}}function xA(t){var e=t.updateQueue;if(e!==null){t.updateQueue=null;var r=t.stateNode;r===null&&(r=t.stateNode=new q5),e.forEach(function(n){var i=i6.bind(null,t,n);r.has(n)||(r.add(n),n.then(i,i))})}}function Bn(t,e){var r=e.deletions;if(r!==null)for(var n=0;n<r.length;n++){var i=r[n];try{var s=t,a=e,o=a;e:for(;o!==null;){switch(o.tag){case 5:fr=o.stateNode,Zn=!1;break e;case 3:fr=o.stateNode.containerInfo,Zn=!0;break e;case 4:fr=o.stateNode.containerInfo,Zn=!0;break e}o=o.return}if(fr===null)throw Error(te(160));SN(s,a,i),fr=null,Zn=!1;var l=i.alternate;l!==null&&(l.return=null),i.return=null}catch(c){Ot(i,e,c)}}if(e.subtreeFlags&12854)for(e=e.child;e!==null;)EN(e,t),e=e.sibling}function EN(t,e){var r=t.alternate,n=t.flags;switch(t.tag){case 0:case 11:case 14:case 15:if(Bn(e,t),mi(t),n&4){try{cd(3,t,t.return),iv(3,t)}catch(g){Ot(t,t.return,g)}try{cd(5,t,t.return)}catch(g){Ot(t,t.return,g)}}break;case 1:Bn(e,t),mi(t),n&512&&r!==null&&Nl(r,r.return);break;case 5:if(Bn(e,t),mi(t),n&512&&r!==null&&Nl(r,r.return),t.flags&32){var i=t.stateNode;try{Td(i,"")}catch(g){Ot(t,t.return,g)}}if(n&4&&(i=t.stateNode,i!=null)){var s=t.memoizedProps,a=r!==null?r.memoizedProps:s,o=t.type,l=t.updateQueue;if(t.updateQueue=null,l!==null)try{o==="input"&&s.type==="radio"&&s.name!=null&&HL(i,s),zb(o,a);var c=zb(o,s);for(a=0;a<l.length;a+=2){var u=l[a],d=l[a+1];u==="style"?XL(i,d):u==="dangerouslySetInnerHTML"?qL(i,d):u==="children"?Td(i,d):lE(i,u,d,c)}switch(o){case"input":Gb(i,s);break;case"textarea":KL(i,s);break;case"select":var f=i._wrapperState.wasMultiple;i._wrapperState.wasMultiple=!!s.multiple;var h=s.value;h!=null?Gl(i,!!s.multiple,h,!1):f!==!!s.multiple&&(s.defaultValue!=null?Gl(i,!!s.multiple,s.defaultValue,!0):Gl(i,!!s.multiple,s.multiple?[]:"",!1))}i[Ld]=s}catch(g){Ot(t,t.return,g)}}break;case 6:if(Bn(e,t),mi(t),n&4){if(t.stateNode===null)throw Error(te(162));i=t.stateNode,s=t.memoizedProps;try{i.nodeValue=s}catch(g){Ot(t,t.return,g)}}break;case 3:if(Bn(e,t),mi(t),n&4&&r!==null&&r.memoizedState.isDehydrated)try{Id(e.containerInfo)}catch(g){Ot(t,t.return,g)}break;case 4:Bn(e,t),mi(t);break;case 13:Bn(e,t),mi(t),i=t.child,i.flags&8192&&(s=i.memoizedState!==null,i.stateNode.isHidden=s,!s||i.alternate!==null&&i.alternate.memoizedState!==null||(UE=Lt())),n&4&&xA(t);break;case 22:if(u=r!==null&&r.memoizedState!==null,t.mode&1?(_r=(c=_r)||u,Bn(e,t),_r=c):Bn(e,t),mi(t),n&8192){if(c=t.memoizedState!==null,(t.stateNode.isHidden=c)&&!u&&t.mode&1)for(le=t,u=t.child;u!==null;){for(d=le=u;le!==null;){switch(f=le,h=f.child,f.tag){case 0:case 11:case 14:case 15:cd(4,f,f.return);break;case 1:Nl(f,f.return);var p=f.stateNode;if(typeof p.componentWillUnmount=="function"){n=f,r=f.return;try{e=n,p.props=e.memoizedProps,p.state=e.memoizedState,p.componentWillUnmount()}catch(g){Ot(n,r,g)}}break;case 5:Nl(f,f.return);break;case 22:if(f.memoizedState!==null){SA(d);continue}}h!==null?(h.return=f,le=h):SA(d)}u=u.sibling}e:for(u=null,d=t;;){if(d.tag===5){if(u===null){u=d;try{i=d.stateNode,c?(s=i.style,typeof s.setProperty=="function"?s.setProperty("display","none","important"):s.display="none"):(o=d.stateNode,l=d.memoizedProps.style,a=l!=null&&l.hasOwnProperty("display")?l.display:null,o.style.display=YL("display",a))}catch(g){Ot(t,t.return,g)}}}else if(d.tag===6){if(u===null)try{d.stateNode.nodeValue=c?"":d.memoizedProps}catch(g){Ot(t,t.return,g)}}else if((d.tag!==22&&d.tag!==23||d.memoizedState===null||d===t)&&d.child!==null){d.child.return=d,d=d.child;continue}if(d===t)break e;for(;d.sibling===null;){if(d.return===null||d.return===t)break e;u===d&&(u=null),d=d.return}u===d&&(u=null),d.sibling.return=d.return,d=d.sibling}}break;case 19:Bn(e,t),mi(t),n&4&&xA(t);break;case 21:break;default:Bn(e,t),mi(t)}}function mi(t){var e=t.flags;if(e&2){try{e:{for(var r=t.return;r!==null;){if(wN(r)){var n=r;break e}r=r.return}throw Error(te(160))}switch(n.tag){case 5:var i=n.stateNode;n.flags&32&&(Td(i,""),n.flags&=-33);var s=bA(t);Ex(t,s,i);break;case 3:case 4:var a=n.stateNode.containerInfo,o=bA(t);Sx(t,o,a);break;default:throw Error(te(161))}}catch(l){Ot(t,t.return,l)}t.flags&=-3}e&4096&&(t.flags&=-4097)}function X5(t,e,r){le=t,TN(t)}function TN(t,e,r){for(var n=(t.mode&1)!==0;le!==null;){var i=le,s=i.child;if(i.tag===22&&n){var a=i.memoizedState!==null||Lh;if(!a){var o=i.alternate,l=o!==null&&o.memoizedState!==null||_r;o=Lh;var c=_r;if(Lh=a,(_r=l)&&!c)for(le=i;le!==null;)a=le,l=a.child,a.tag===22&&a.memoizedState!==null?EA(i):l!==null?(l.return=a,le=l):EA(i);for(;s!==null;)le=s,TN(s),s=s.sibling;le=i,Lh=o,_r=c}wA(t)}else i.subtreeFlags&8772&&s!==null?(s.return=i,le=s):wA(t)}}function wA(t){for(;le!==null;){var e=le;if(e.flags&8772){var r=e.alternate;try{if(e.flags&8772)switch(e.tag){case 0:case 11:case 15:_r||iv(5,e);break;case 1:var n=e.stateNode;if(e.flags&4&&!_r)if(r===null)n.componentDidMount();else{var i=e.elementType===e.type?r.memoizedProps:zn(e.type,r.memoizedProps);n.componentDidUpdate(i,r.memoizedState,n.__reactInternalSnapshotBeforeUpdate)}var s=e.updateQueue;s!==null&&sA(e,s,n);break;case 3:var a=e.updateQueue;if(a!==null){if(r=null,e.child!==null)switch(e.child.tag){case 5:r=e.child.stateNode;break;case 1:r=e.child.stateNode}sA(e,a,r)}break;case 5:var o=e.stateNode;if(r===null&&e.flags&4){r=o;var l=e.memoizedProps;switch(e.type){case"button":case"input":case"select":case"textarea":l.autoFocus&&r.focus();break;case"img":l.src&&(r.src=l.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(e.memoizedState===null){var c=e.alternate;if(c!==null){var u=c.memoizedState;if(u!==null){var d=u.dehydrated;d!==null&&Id(d)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(te(163))}_r||e.flags&512&&wx(e)}catch(f){Ot(e,e.return,f)}}if(e===t){le=null;break}if(r=e.sibling,r!==null){r.return=e.return,le=r;break}le=e.return}}function SA(t){for(;le!==null;){var e=le;if(e===t){le=null;break}var r=e.sibling;if(r!==null){r.return=e.return,le=r;break}le=e.return}}function EA(t){for(;le!==null;){var e=le;try{switch(e.tag){case 0:case 11:case 15:var r=e.return;try{iv(4,e)}catch(l){Ot(e,r,l)}break;case 1:var n=e.stateNode;if(typeof n.componentDidMount=="function"){var i=e.return;try{n.componentDidMount()}catch(l){Ot(e,i,l)}}var s=e.return;try{wx(e)}catch(l){Ot(e,s,l)}break;case 5:var a=e.return;try{wx(e)}catch(l){Ot(e,a,l)}}}catch(l){Ot(e,e.return,l)}if(e===t){le=null;break}var o=e.sibling;if(o!==null){o.return=e.return,le=o;break}le=e.return}}var Q5=Math.ceil,bm=_s.ReactCurrentDispatcher,FE=_s.ReactCurrentOwner,Pn=_s.ReactCurrentBatchConfig,Ne=0,ar=null,Bt=null,vr=0,tn=0,Ml=Ia(0),Yt=0,Fd=null,Do=0,sv=0,BE=0,ud=null,Br=null,UE=0,xc=1/0,es=null,xm=!1,Tx=null,pa=null,Dh=!1,aa=null,wm=0,dd=0,_x=null,Np=-1,Mp=0;function Dr(){return Ne&6?Lt():Np!==-1?Np:Np=Lt()}function ma(t){return t.mode&1?Ne&2&&vr!==0?vr&-vr:D5.transition!==null?(Mp===0&&(Mp=lD()),Mp):(t=Ye,t!==0||(t=window.event,t=t===void 0?16:mD(t.type)),t):1}function oi(t,e,r,n){if(50<dd)throw dd=0,_x=null,Error(te(185));qf(t,r,n),(!(Ne&2)||t!==ar)&&(t===ar&&(!(Ne&2)&&(sv|=r),Yt===4&&Qs(t,vr)),zr(t,n),r===1&&Ne===0&&!(e.mode&1)&&(xc=Lt()+500,tv&&Ca()))}function zr(t,e){var r=t.callbackNode;D8(t,e);var n=im(t,t===ar?vr:0);if(n===0)r!==null&&k1(r),t.callbackNode=null,t.callbackPriority=0;else if(e=n&-n,t.callbackPriority!==e){if(r!=null&&k1(r),e===1)t.tag===0?L5(TA.bind(null,t)):DD(TA.bind(null,t)),C5(function(){!(Ne&6)&&Ca()}),r=null;else{switch(cD(n)){case 1:r=hE;break;case 4:r=aD;break;case 16:r=nm;break;case 536870912:r=oD;break;default:r=nm}r=kN(r,_N.bind(null,t))}t.callbackPriority=e,t.callbackNode=r}}function _N(t,e){if(Np=-1,Mp=0,Ne&6)throw Error(te(327));var r=t.callbackNode;if(zl()&&t.callbackNode!==r)return null;var n=im(t,t===ar?vr:0);if(n===0)return null;if(n&30||n&t.expiredLanes||e)e=Sm(t,n);else{e=n;var i=Ne;Ne|=2;var s=PN();(ar!==t||vr!==e)&&(es=null,xc=Lt()+500,xo(t,e));do try{e6();break}catch(o){AN(t,o)}while(!0);AE(),bm.current=s,Ne=i,Bt!==null?e=0:(ar=null,vr=0,e=Yt)}if(e!==0){if(e===2&&(i=Jb(t),i!==0&&(n=i,e=Ax(t,i))),e===1)throw r=Fd,xo(t,0),Qs(t,n),zr(t,Lt()),r;if(e===6)Qs(t,n);else{if(i=t.current.alternate,!(n&30)&&!J5(i)&&(e=Sm(t,n),e===2&&(s=Jb(t),s!==0&&(n=s,e=Ax(t,s))),e===1))throw r=Fd,xo(t,0),Qs(t,n),zr(t,Lt()),r;switch(t.finishedWork=i,t.finishedLanes=n,e){case 0:case 1:throw Error(te(345));case 2:Xa(t,Br,es);break;case 3:if(Qs(t,n),(n&130023424)===n&&(e=UE+500-Lt(),10<e)){if(im(t,0)!==0)break;if(i=t.suspendedLanes,(i&n)!==n){Dr(),t.pingedLanes|=t.suspendedLanes&i;break}t.timeoutHandle=ax(Xa.bind(null,t,Br,es),e);break}Xa(t,Br,es);break;case 4:if(Qs(t,n),(n&4194240)===n)break;for(e=t.eventTimes,i=-1;0<n;){var a=31-ai(n);s=1<<a,a=e[a],a>i&&(i=a),n&=~s}
vendor: 2,261 bytes, line 40
40if(n=i,n=Lt()-n,n=(120>n?120:480>n?480:1080>n?1080:1920>n?1920:3e3>n?3e3:4320>n?4320:1960*Q5(n/1960))-n,10<n){t.timeoutHandle=ax(Xa.bind(null,t,Br,es),n);break}Xa(t,Br,es);break;case 5:Xa(t,Br,es);break;default:throw Error(te(329))}}}return zr(t,Lt()),t.callbackNode===r?_N.bind(null,t):null}function Ax(t,e){var r=ud;return t.current.memoizedState.isDehydrated&&(xo(t,e).flags|=256),t=Sm(t,e),t!==2&&(e=Br,Br=r,e!==null&&Px(e)),t}function Px(t){Br===null?Br=t:Br.push.apply(Br,t)}function J5(t){for(var e=t;;){if(e.flags&16384){var r=e.updateQueue;if(r!==null&&(r=r.stores,r!==null))for(var n=0;n<r.length;n++){var i=r[n],s=i.getSnapshot;i=i.value;try{if(!ci(s(),i))return!1}catch{return!1}}}if(r=e.child,e.subtreeFlags&16384&&r!==null)r.return=e,e=r;else{if(e===t)break;for(;e.sibling===null;){if(e.return===null||e.return===t)return!0;e=e.return}e.sibling.return=e.return,e=e.sibling}}return!0}function Qs(t,e){for(e&=~BE,e&=~sv,t.suspendedLanes|=e,t.pingedLanes&=~e,t=t.expirationTimes;0<e;){var r=31-ai(e),n=1<<r;t[r]=-1,e&=~n}}function TA(t){if(Ne&6)throw Error(te(327));zl();var e=im(t,0);if(!(e&1))return zr(t,Lt()),null;var r=Sm(t,e);if(t.tag!==0&&r===2){var n=Jb(t);n!==0&&(e=n,r=Ax(t,n))}if(r===1)throw r=Fd,xo(t,0),Qs(t,e),zr(t,Lt()),r;if(r===6)throw Error(te(345));return t.finishedWork=t.current.alternate,t.finishedLanes=e,Xa(t,Br,es),zr(t,Lt()),null}function GE(t,e){var r=Ne;Ne|=1;try{return t(e)}finally{Ne=r,Ne===0&&(xc=Lt()+500,tv&&Ca())}}function No(t){aa!==null&&aa.tag===0&&!(Ne&6)&&zl();var e=Ne;Ne|=1;var r=Pn.transition,n=Ye;try{if(Pn.transition=null,Ye=1,t)return t()}finally{Ye=n,Pn.transition=r,Ne=e,!(Ne&6)&&Ca()}}function WE(){tn=Ml.current,gt(Ml)}function xo(t,e){t.finishedWork=null,t.finishedLanes=0;var r=t.timeoutHandle;if(r!==-1&&(t.timeoutHandle=-1,I5(r)),Bt!==null)for(r=Bt.return;r!==null;){var n=r;switch(EE(n),n.tag){case 1:n=n.type.childContextTypes,n!=null&&cm();break;case 3:yc(),gt(Hr),gt(Pr),kE();break;case 5:RE(n);break;case 4:yc();break;case 13:gt(Et);break;case 19:gt(Et);break;case 10:PE(n.type._context);break;case 22:case 23:WE()}r=r.return}if(ar=t,Bt=t=ga(t.current,null),vr=tn=e,Yt=0,Fd=null,BE=sv=Do=0,Br=ud=null,ao!==null){for(e=0;e<ao.length;e++)if(r=ao[e],n=r.interleaved,n!==null){r.interleaved=null;
vendor: 12,950 bytes, line 40
40var i=n.next,s=r.pending;if(s!==null){var a=s.next;s.next=i,n.next=a}r.pending=n}ao=null}return t}function AN(t,e){do{var r=Bt;try{if(AE(),kp.current=ym,vm){for(var n=_t.memoizedState;n!==null;){var i=n.queue;i!==null&&(i.pending=null),n=n.next}vm=!1}if(Lo=0,nr=zt=_t=null,ld=!1,Md=0,FE.current=null,r===null||r.return===null){Yt=1,Fd=e,Bt=null;break}e:{var s=t,a=r.return,o=r,l=e;if(e=vr,o.flags|=32768,l!==null&&typeof l=="object"&&typeof l.then=="function"){var c=l,u=o,d=u.tag;if(!(u.mode&1)&&(d===0||d===11||d===15)){var f=u.alternate;f?(u.updateQueue=f.updateQueue,u.memoizedState=f.memoizedState,u.lanes=f.lanes):(u.updateQueue=null,u.memoizedState=null)}var h=dA(a);if(h!==null){h.flags&=-257,fA(h,a,o,s,e),h.mode&1&&uA(s,c,e),e=h,l=c;var p=e.updateQueue;if(p===null){var g=new Set;g.add(l),e.updateQueue=g}else p.add(l);break e}else{if(!(e&1)){uA(s,c,e),VE();break e}l=Error(te(426))}}else if(bt&&o.mode&1){var m=dA(a);if(m!==null){!(m.flags&65536)&&(m.flags|=256),fA(m,a,o,s,e),TE(bc(l,o));break e}}s=l=bc(l,o),Yt!==4&&(Yt=2),ud===null?ud=[s]:ud.push(s),s=a;do{switch(s.tag){case 3:s.flags|=65536,e&=-e,s.lanes|=e;var v=cN(s,l,e);iA(s,v);break e;case 1:o=l;var y=s.type,b=s.stateNode;if(!(s.flags&128)&&(typeof y.getDerivedStateFromError=="function"||b!==null&&typeof b.componentDidCatch=="function"&&(pa===null||!pa.has(b)))){s.flags|=65536,e&=-e,s.lanes|=e;var w=uN(s,o,e);iA(s,w);break e}}s=s.return}while(s!==null)}CN(r)}catch(S){e=S,Bt===r&&r!==null&&(Bt=r=r.return);continue}break}while(!0)}function PN(){var t=bm.current;return bm.current=ym,t===null?ym:t}function VE(){(Yt===0||Yt===3||Yt===2)&&(Yt=4),ar===null||!(Do&268435455)&&!(sv&268435455)||Qs(ar,vr)}function Sm(t,e){var r=Ne;Ne|=2;var n=PN();(ar!==t||vr!==e)&&(es=null,xo(t,e));do try{Z5();break}catch(i){AN(t,i)}while(!0);if(AE(),Ne=r,bm.current=n,Bt!==null)throw Error(te(261));return ar=null,vr=0,Yt}function Z5(){for(;Bt!==null;)IN(Bt)}function e6(){for(;Bt!==null&&!_8();)IN(Bt)}function IN(t){var e=RN(t.alternate,t,tn);t.memoizedProps=t.pendingProps,e===null?CN(t):Bt=e,FE.current=null}function CN(t){var e=t;do{var r=e.alternate;if(t=e.return,e.flags&32768){if(r=z5(r,e),r!==null){r.flags&=32767,Bt=r;return}if(t!==null)t.flags|=32768,t.subtreeFlags=0,t.deletions=null;else{Yt=6,Bt=null;return}}else if(r=K5(r,e,tn),r!==null){Bt=r;return}if(e=e.sibling,e!==null){Bt=e;return}Bt=e=t}while(e!==null);Yt===0&&(Yt=5)}function Xa(t,e,r){var n=Ye,i=Pn.transition;try{Pn.transition=null,Ye=1,t6(t,e,r,n)}finally{Pn.transition=i,Ye=n}return null}function t6(t,e,r,n){do zl();while(aa!==null);if(Ne&6)throw Error(te(327));r=t.finishedWork;var i=t.finishedLanes;if(r===null)return null;if(t.finishedWork=null,t.finishedLanes=0,r===t.current)throw Error(te(177));t.callbackNode=null,t.callbackPriority=0;var s=r.lanes|r.childLanes;if(N8(t,s),t===ar&&(Bt=ar=null,vr=0),!(r.subtreeFlags&2064)&&!(r.flags&2064)||Dh||(Dh=!0,kN(nm,function(){return zl(),null})),s=(r.flags&15990)!==0,r.subtreeFlags&15990||s){s=Pn.transition,Pn.transition=null;var a=Ye;Ye=1;var o=Ne;Ne|=4,FE.current=null,Y5(t,r),EN(r,t),w5(ix),sm=!!nx,ix=nx=null,t.current=r,X5(r),A8(),Ne=o,Ye=a,Pn.transition=s}else t.current=r;if(Dh&&(Dh=!1,aa=t,wm=i),s=t.pendingLanes,s===0&&(pa=null),C8(r.stateNode),zr(t,Lt()),e!==null)for(n=t.onRecoverableError,r=0;r<e.length;r++)i=e[r],n(i.value,{componentStack:i.stack,digest:i.digest});if(xm)throw xm=!1,t=Tx,Tx=null,t;return wm&1&&t.tag!==0&&zl(),s=t.pendingLanes,s&1?t===_x?dd++:(dd=0,_x=t):dd=0,Ca(),null}function zl(){if(aa!==null){var t=cD(wm),e=Pn.transition,r=Ye;try{if(Pn.transition=null,Ye=16>t?16:t,aa===null)var n=!1;else{if(t=aa,aa=null,wm=0,Ne&6)throw Error(te(331));var i=Ne;for(Ne|=4,le=t.current;le!==null;){var s=le,a=s.child;if(le.flags&16){var o=s.deletions;if(o!==null){for(var l=0;l<o.length;l++){var c=o[l];for(le=c;le!==null;){var u=le;switch(u.tag){case 0:case 11:case 15:cd(8,u,s)}var d=u.child;if(d!==null)d.return=u,le=d;else for(;le!==null;){u=le;var f=u.sibling,h=u.return;if(xN(u),u===c){le=null;break}if(f!==null){f.return=h,le=f;break}le=h}}}var p=s.alternate;if(p!==null){var g=p.child;if(g!==null){p.child=null;do{var m=g.sibling;g.sibling=null,g=m}while(g!==null)}}le=s}}if(s.subtreeFlags&2064&&a!==null)a.return=s,le=a;else e:for(;le!==null;){if(s=le,s.flags&2048)switch(s.tag){case 0:case 11:case 15:cd(9,s,s.return)}var v=s.sibling;if(v!==null){v.return=s.return,le=v;break e}le=s.return}}var y=t.current;for(le=y;le!==null;){a=le;var b=a.child;if(a.subtreeFlags&2064&&b!==null)b.return=a,le=b;else e:for(a=y;le!==null;){if(o=le,o.flags&2048)try{switch(o.tag){case 0:case 11:case 15:iv(9,o)}}catch(S){Ot(o,o.return,S)}if(o===a){le=null;break e}var w=o.sibling;if(w!==null){w.return=o.return,le=w;break e}le=o.return}}if(Ne=i,Ca(),ki&&typeof ki.onPostCommitFiberRoot=="function")try{ki.onPostCommitFiberRoot(Xg,t)}catch{}n=!0}return n}finally{Ye=r,Pn.transition=e}}return!1}function _A(t,e,r){e=bc(r,e),e=cN(t,e,1),t=ha(t,e,1),e=Dr(),t!==null&&(qf(t,1,e),zr(t,e))}function Ot(t,e,r){if(t.tag===3)_A(t,t,r);else for(;e!==null;){if(e.tag===3){_A(e,t,r);break}else if(e.tag===1){var n=e.stateNode;if(typeof e.type.getDerivedStateFromError=="function"||typeof n.componentDidCatch=="function"&&(pa===null||!pa.has(n))){t=bc(r,t),t=uN(e,t,1),e=ha(e,t,1),t=Dr(),e!==null&&(qf(e,1,t),zr(e,t));break}}e=e.return}}function r6(t,e,r){var n=t.pingCache;n!==null&&n.delete(e),e=Dr(),t.pingedLanes|=t.suspendedLanes&r,ar===t&&(vr&r)===r&&(Yt===4||Yt===3&&(vr&130023424)===vr&&500>Lt()-UE?xo(t,0):BE|=r),zr(t,e)}function ON(t,e){e===0&&(t.mode&1?(e=Th,Th<<=1,!(Th&130023424)&&(Th=4194304)):e=1);var r=Dr();t=vs(t,e),t!==null&&(qf(t,e,r),zr(t,r))}function n6(t){var e=t.memoizedState,r=0;e!==null&&(r=e.retryLane),ON(t,r)}function i6(t,e){var r=0;switch(t.tag){case 13:var n=t.stateNode,i=t.memoizedState;i!==null&&(r=i.retryLane);break;case 19:n=t.stateNode;break;default:throw Error(te(314))}n!==null&&n.delete(e),ON(t,r)}var RN;RN=function(t,e,r){if(t!==null)if(t.memoizedProps!==e.pendingProps||Hr.current)Ur=!0;else{if(!(t.lanes&r)&&!(e.flags&128))return Ur=!1,H5(t,e,r);Ur=!!(t.flags&131072)}else Ur=!1,bt&&e.flags&1048576&&ND(e,fm,e.index);switch(e.lanes=0,e.tag){case 2:var n=e.type;Dp(t,e),t=e.pendingProps;var i=mc(e,Pr.current);Kl(e,r),i=DE(null,e,n,t,i,r);var s=NE();return e.flags|=1,typeof i=="object"&&i!==null&&typeof i.render=="function"&&i.$$typeof===void 0?(e.tag=1,e.memoizedState=null,e.updateQueue=null,Kr(n)?(s=!0,um(e)):s=!1,e.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,CE(e),i.updater=nv,e.stateNode=i,i._reactInternals=e,hx(e,n,t,r),e=gx(null,e,n,!0,s,r)):(e.tag=0,bt&&s&&SE(e),Cr(null,e,i,r),e=e.child),e;case 16:n=e.elementType;e:{switch(Dp(t,e),t=e.pendingProps,i=n._init,n=i(n._payload),e.type=n,i=e.tag=a6(n),t=zn(n,t),i){case 0:e=mx(null,e,n,t,r);break e;case 1:e=mA(null,e,n,t,r);break e;case 11:e=hA(null,e,n,t,r);break e;case 14:e=pA(null,e,n,zn(n.type,t),r);break e}throw Error(te(306,n,""))}return e;case 0:return n=e.type,i=e.pendingProps,i=e.elementType===n?i:zn(n,i),mx(t,e,n,i,r);case 1:return n=e.type,i=e.pendingProps,i=e.elementType===n?i:zn(n,i),mA(t,e,n,i,r);case 3:e:{if(pN(e),t===null)throw Error(te(387));n=e.pendingProps,s=e.memoizedState,i=s.element,UD(t,e),mm(e,n,null,r);var a=e.memoizedState;if(n=a.element,s.isDehydrated)if(s={element:n,isDehydrated:!1,cache:a.cache,pendingSuspenseBoundaries:a.pendingSuspenseBoundaries,transitions:a.transitions},e.updateQueue.baseState=s,e.memoizedState=s,e.flags&256){i=bc(Error(te(423)),e),e=gA(t,e,n,r,i);break e}else if(n!==i){i=bc(Error(te(424)),e),e=gA(t,e,n,r,i);break e}else for(un=fa(e.stateNode.containerInfo.firstChild),dn=e,bt=!0,ni=null,r=FD(e,null,n,r),e.child=r;r;)r.flags=r.flags&-3|4096,r=r.sibling;else{if(gc(),n===i){e=ys(t,e,r);break e}Cr(t,e,n,r)}e=e.child}return e;case 5:return GD(e),t===null&&ux(e),n=e.type,i=e.pendingProps,s=t!==null?t.memoizedProps:null,a=i.children,sx(n,i)?a=null:s!==null&&sx(n,s)&&(e.flags|=32),hN(t,e),Cr(t,e,a,r),e.child;case 6:return t===null&&ux(e),null;case 13:return mN(t,e,r);case 4:return OE(e,e.stateNode.containerInfo),n=e.pendingProps,t===null?e.child=vc(e,null,n,r):Cr(t,e,n,r),e.child;case 11:return n=e.type,i=e.pendingProps,i=e.elementType===n?i:zn(n,i),hA(t,e,n,i,r);case 7:return Cr(t,e,e.pendingProps,r),e.child;case 8:return Cr(t,e,e.pendingProps.children,r),e.child;case 12:return Cr(t,e,e.pendingProps.children,r),e.child;case 10:e:{if(n=e.type._context,i=e.pendingProps,s=e.memoizedProps,a=i.value,ut(hm,n._currentValue),n._currentValue=a,s!==null)if(ci(s.value,a)){if(s.children===i.children&&!Hr.current){e=ys(t,e,r);break e}}else for(s=e.child,s!==null&&(s.return=e);s!==null;){var o=s.dependencies;if(o!==null){a=s.child;for(var l=o.firstContext;l!==null;){if(l.context===n){if(s.tag===1){l=fs(-1,r&-r),l.tag=2;var c=s.updateQueue;if(c!==null){c=c.shared;var u=c.pending;u===null?l.next=l:(l.next=u.next,u.next=l),c.pending=l}}s.lanes|=r,l=s.alternate,l!==null&&(l.lanes|=r),dx(s.return,r,e),o.lanes|=r;break}l=l.next}}else if(s.tag===10)a=s.type===e.type?null:s.child;else if(s.tag===18){if(a=s.return,a===null)throw Error(te(341));a.lanes|=r,o=a.alternate,o!==null&&(o.lanes|=r),dx(a,r,e),a=s.sibling}else a=s.child;if(a!==null)a.return=s;else for(a=s;a!==null;){if(a===e){a=null;break}if(s=a.sibling,s!==null){s.return=a.return,a=s;break}a=a.return}s=a}Cr(t,e,i.children,r),e=e.child}return e;case 9:return i=e.type,n=e.pendingProps.children,Kl(e,r),i=Cn(i),n=n(i),e.flags|=1,Cr(t,e,n,r),e.child;case 14:return n=e.type,i=zn(n,e.pendingProps),i=zn(n.type,i),pA(t,e,n,i,r);case 15:return dN(t,e,e.type,e.pendingProps,r);case 17:return n=e.type,i=e.pendingProps,i=e.elementType===n?i:zn(n,i),Dp(t,e),e.tag=1,Kr(n)?(t=!0,um(e)):t=!1,Kl(e,r),lN(e,n,i),hx(e,n,i,r),gx(null,e,n,!0,t,r);case 19:return gN(t,e,r);case 22:return fN(t,e,r)}throw Error(te(156,e.tag))};function kN(t,e){return sD(t,e)}function s6(t,e,r,n){this.tag=t,this.key=r,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=e,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=n,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function _n(t,e,r,n){return new s6(t,e,r,n)}function HE(t){return t=t.prototype,!(!t||!t.isReactComponent)}function a6(t){if(typeof t=="function")return HE(t)?1:0;if(t!=null){if(t=t.$$typeof,t===uE)return 11;if(t===dE)return 14}return 2}function ga(t,e){var r=t.alternate;return r===null?(r=_n(t.tag,e,t.key,t.mode),r.elementType=t.elementType,r.type=t.type,r.stateNode=t.stateNode,r.alternate=t,t.alternate=r):(r.pendingProps=e,r.type=t.type,r.flags=0,r.subtreeFlags=0,r.deletions=null),r.flags=t.flags&14680064,r.childLanes=t.childLanes,r.lanes=t.lanes,r.child=t.child,r.memoizedProps=t.memoizedProps,r.memoizedState=t.memoizedState,r.updateQueue=t.updateQueue,e=t.dependencies,r.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext},r.sibling=t.sibling,r.index=t.index,r.ref=t.ref,r}function $p(t,e,r,n,i,s){var a=2;if(n=t,typeof t=="function")HE(t)&&(a=1);else if(typeof t=="string")a=5;else e:switch(t){case Al:return wo(r.children,i,s,e);case cE:a=8,i|=8;break;case $b:return t=_n(12,r,e,i|2),t.elementType=$b,t.lanes=s,t;case jb:return t=_n(13,r,e,i),t.elementType=jb,t.lanes=s,t;case Fb:return t=_n(19,r,e,i),t.elementType=Fb,t.lanes=s,t;case GL:return av(r,i,s,e);default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case BL:a=10;break e;case UL:a=9;break e;case uE:a=11;break e;case dE:a=14;break e;case Vs:a=16,n=null;break e}throw Error(te(130,t==null?t:typeof t,""))}return e=_n(a,r,e,i),e.elementType=t,e.type=n,e.lanes=s,e}function wo(t,e,r,n){return t=_n(7,t,n,e),t.lanes=r,t}function av(t,e,r,n){return t=_n(22,t,n,e),t.elementType=GL,t.lanes=r,t.stateNode={isHidden:!1},t}function n0(t,e,r){return t=_n(6,t,null,e),t.lanes=r,t}function i0(t,e,r){return e=_n(4,t.children!==null?t.children:[],t.key,e),e.lanes=r,e.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},e}function o6(t,e,r,n,i){this.tag=e,this.containerInfo=t,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=jy(0),this.expirationTimes=jy(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=jy(0),this.identifierPrefix=n,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function KE(t,e,r,n,i,s,a,o,l){return t=new o6(t,e,r,o,l),e===1?(e=1,s===!0&&(e|=8)):e=0,s=_n(3,null,null,e),t.current=s,s.stateNode=t,s.memoizedState={element:n,isDehydrated:r,cache:null,transitions:null,pendingSuspenseBoundaries:null},CE(s),t}function l6(t,e,r){var n=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;
vendor: 4,595 bytes, line 40
40return{$$typeof:_l,key:n==null?null:""+n,children:t,containerInfo:e,implementation:r}}function LN(t){if(!t)return wa;t=t._reactInternals;e:{if(zo(t)!==t||t.tag!==1)throw Error(te(170));var e=t;do{switch(e.tag){case 3:e=e.stateNode.context;break e;case 1:if(Kr(e.type)){e=e.stateNode.__reactInternalMemoizedMergedChildContext;break e}}e=e.return}while(e!==null);throw Error(te(171))}if(t.tag===1){var r=t.type;if(Kr(r))return LD(t,r,e)}return e}function DN(t,e,r,n,i,s,a,o,l){return t=KE(r,n,!0,t,i,s,a,o,l),t.context=LN(null),r=t.current,n=Dr(),i=ma(r),s=fs(n,i),s.callback=e??null,ha(r,s,i),t.current.lanes=i,qf(t,i,n),zr(t,n),t}function ov(t,e,r,n){var i=e.current,s=Dr(),a=ma(i);return r=LN(r),e.context===null?e.context=r:e.pendingContext=r,e=fs(s,a),e.payload={element:t},n=n===void 0?null:n,n!==null&&(e.callback=n),t=ha(i,e,a),t!==null&&(oi(t,i,a,s),Rp(t,i,a)),a}function Em(t){if(t=t.current,!t.child)return null;switch(t.child.tag){case 5:return t.child.stateNode;default:return t.child.stateNode}}function AA(t,e){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var r=t.retryLane;t.retryLane=r!==0&&r<e?r:e}}function zE(t,e){AA(t,e),(t=t.alternate)&&AA(t,e)}function c6(){return null}var NN=typeof reportError=="function"?reportError:function(t){console.error(t)};function qE(t){this._internalRoot=t}lv.prototype.render=qE.prototype.render=function(t){var e=this._internalRoot;if(e===null)throw Error(te(409));ov(t,e,null,null)};lv.prototype.unmount=qE.prototype.unmount=function(){var t=this._internalRoot;if(t!==null){this._internalRoot=null;var e=t.containerInfo;No(function(){ov(null,t,null,null)}),e[gs]=null}};function lv(t){this._internalRoot=t}lv.prototype.unstable_scheduleHydration=function(t){if(t){var e=fD();t={blockedOn:null,target:t,priority:e};for(var r=0;r<Xs.length&&e!==0&&e<Xs[r].priority;r++);Xs.splice(r,0,t),r===0&&pD(t)}};function YE(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)}function cv(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11&&(t.nodeType!==8||t.nodeValue!==" react-mount-point-unstable "))}function PA(){}function u6(t,e,r,n,i){if(i){if(typeof n=="function"){var s=n;n=function(){var c=Em(a);s.call(c)}}var a=DN(e,n,t,0,null,!1,!1,"",PA);return t._reactRootContainer=a,t[gs]=a.current,Rd(t.nodeType===8?t.parentNode:t),No(),a}for(;i=t.lastChild;)t.removeChild(i);if(typeof n=="function"){var o=n;n=function(){var c=Em(l);o.call(c)}}var l=KE(t,0,!1,null,null,!1,!1,"",PA);return t._reactRootContainer=l,t[gs]=l.current,Rd(t.nodeType===8?t.parentNode:t),No(function(){ov(e,l,r,n)}),l}function uv(t,e,r,n,i){var s=r._reactRootContainer;if(s){var a=s;if(typeof i=="function"){var o=i;i=function(){var l=Em(a);o.call(l)}}ov(e,a,t,i)}else a=u6(r,e,t,i,n);return Em(a)}uD=function(t){switch(t.tag){case 3:var e=t.stateNode;if(e.current.memoizedState.isDehydrated){var r=Yu(e.pendingLanes);r!==0&&(pE(e,r|1),zr(e,Lt()),!(Ne&6)&&(xc=Lt()+500,Ca()))}break;case 13:No(function(){var n=vs(t,1);if(n!==null){var i=Dr();oi(n,t,1,i)}}),zE(t,1)}};mE=function(t){if(t.tag===13){var e=vs(t,134217728);if(e!==null){var r=Dr();oi(e,t,134217728,r)}zE(t,134217728)}};dD=function(t){if(t.tag===13){var e=ma(t),r=vs(t,e);if(r!==null){var n=Dr();oi(r,t,e,n)}zE(t,e)}};fD=function(){return Ye};hD=function(t,e){var r=Ye;try{return Ye=t,e()}finally{Ye=r}};Yb=function(t,e,r){switch(e){case"input":if(Gb(t,r),e=r.name,r.type==="radio"&&e!=null){for(r=t;r.parentNode;)r=r.parentNode;for(r=r.querySelectorAll("input[name="+JSON.stringify(""+e)+'][type="radio"]'),e=0;e<r.length;e++){var n=r[e];if(n!==t&&n.form===t.form){var i=ev(n);if(!i)throw Error(te(90));VL(n),Gb(n,i)}}}break;case"textarea":KL(t,r);break;case"select":e=r.value,e!=null&&Gl(t,!!r.multiple,e,!1)}};ZL=GE;eD=No;var d6={usingClientEntryPoint:!1,Events:[Xf,Ol,ev,QL,JL,GE]},Ou={findFiberByHostInstance:so,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},f6={bundleType:Ou.bundleType,version:Ou.version,rendererPackageName:Ou.rendererPackageName,rendererConfig:Ou.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:_s.ReactCurrentDispatcher,findHostInstanceByFiber:function(t){return t=nD(t),t===null?null:t.stateNode},findFiberByHostInstance:Ou.findFiberByHostInstance||c6,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};
40if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Nh=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Nh.isDisabled&&Nh.supportsFiber)try{Xg=Nh.inject(f6),ki=Nh}catch{}}gn.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=d6;gn.createPortal=function(t,e){var r=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!YE(e))throw Error(te(200));return l6(t,e,null,r)};gn.createRoot=function(t,e){if(!YE(t))throw Error(te(299));var r=!1,n="",i=NN;return e!=null&&(e.unstable_strictMode===!0&&(r=!0),e.identifierPrefix!==void 0&&(n=e.identifierPrefix),e.onRecoverableError!==void 0&&(i=e.onRecoverableError)),e=KE(t,1,!1,null,null,r,!1,n,i),t[gs]=e.current,Rd(t.nodeType===8?t.parentNode:t),new qE(e)};gn.findDOMNode=function(t){if(t==null)return null;if(t.nodeType===1)return t;var e=t._reactInternals;if(e===void 0)throw typeof t.render=="function"?Error(te(188)):(t=Object.keys(t).join(","),Error(te(268,t)));return t=nD(e),t=t===null?null:t.stateNode,t};gn.flushSync=function(t){return No(t)};gn.hydrate=function(t,e,r){if(!cv(e))throw Error(te(200));return uv(null,t,e,!0,r)};gn.hydrateRoot=function(t,e,r){if(!YE(t))throw Error(te(405));var n=r!=null&&r.hydratedSources||null,i=!1,s="",a=NN;if(r!=null&&(r.unstable_strictMode===!0&&(i=!0),r.identifierPrefix!==void 0&&(s=r.identifierPrefix),r.onRecoverableError!==void 0&&(a=r.onRecoverableError)),e=DN(e,null,t,1,r??null,i,!1,s,a),t[gs]=e.current,Rd(t),n)for(t=0;t<n.length;t++)r=n[t],i=r._getVersion,i=i(r._source),e.mutableSourceEagerHydrationData==null?e.mutableSourceEagerHydrationData=[r,i]:e.mutableSourceEagerHydrationData.push(r,i);return new lv(e)};gn.render=function(t,e,r){if(!cv(e))throw Error(te(200));return uv(null,t,e,!1,r)};gn.unmountComponentAtNode=function(t){if(!cv(t))throw Error(te(40));return t._reactRootContainer?(No(function(){uv(null,null,t,!1,function(){t._reactRootContainer=null,t[gs]=null})}),!0):!1};gn.unstable_batchedUpdates=GE;gn.unstable_renderSubtreeIntoContainer=function(t,e,r,n){if(!cv(r))throw Error(te(200));if(t==null||t._reactInternals===void 0)throw Error(te(38));return uv(t,e,r,!1,n)};gn.version="18.3.1-next-f1338f8080-20240426";function MN(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(MN)}catch(t){console.error(t)}}MN(),ML.exports=gn;var qo=ML.exports;const $N=at(qo);var jN,IA=qo;jN=IA.createRoot,IA.hydrateRoot;const h6=1,p6=1e6;let s0=0;function m6(){return s0=(s0+1)%Number.MAX_SAFE_INTEGER,s0.toString()}const a0=new Map,CA=t=>{if(a0.has(t))return;const e=setTimeout(()=>{a0.delete(t),fd({type:"REMOVE_TOAST",toastId:t})},p6);a0.set(t,e)},g6=(t,e)=>{switch(e.type){case"ADD_TOAST":return{...t,toasts:[e.toast,...t.toasts].slice(0,h6)};case"UPDATE_TOAST":return{...t,toasts:t.toasts.map(r=>r.id===e.toast.id?{...r,...e.toast}:r)};case"DISMISS_TOAST":{const{toastId:r}=e;return r?CA(r):t.toasts.forEach(n=>{CA(n.id)}),{...t,toasts:t.toasts.map(n=>
vendor: 14,108 bytes, line 40
40n.id===r||r===void 0?{...n,open:!1}:n)}}case"REMOVE_TOAST":return e.toastId===void 0?{...t,toasts:[]}:{...t,toasts:t.toasts.filter(r=>r.id!==e.toastId)}}},jp=[];let Fp={toasts:[]};function fd(t){Fp=g6(Fp,t),jp.forEach(e=>{e(Fp)})}function v6({...t}){const e=m6(),r=i=>fd({type:"UPDATE_TOAST",toast:{...i,id:e}}),n=()=>fd({type:"DISMISS_TOAST",toastId:e});return fd({type:"ADD_TOAST",toast:{...t,id:e,open:!0,onOpenChange:i=>{i||n()}}}),{id:e,dismiss:n,update:r}}function FN(){const[t,e]=E.useState(Fp);return E.useEffect(()=>(jp.push(e),()=>{const r=jp.indexOf(e);r>-1&&jp.splice(r,1)}),[t]),{...t,toast:v6,dismiss:r=>fd({type:"DISMISS_TOAST",toastId:r})}}function ve(t,e,{checkForDefaultPrevented:r=!0}={}){return function(i){if(t==null||t(i),r===!1||!i.defaultPrevented)return e==null?void 0:e(i)}}function OA(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function Jc(...t){return e=>{let r=!1;const n=t.map(i=>{const s=OA(i,e);return!r&&typeof s=="function"&&(r=!0),s});if(r)return()=>{for(let i=0;i<n.length;i++){const s=n[i];typeof s=="function"?s():OA(t[i],null)}}}}function vt(...t){return E.useCallback(Jc(...t),t)}function Oa(t,e=[]){let r=[];function n(s,a){const o=E.createContext(a),l=r.length;r=[...r,a];const c=d=>{var v;const{scope:f,children:h,...p}=d,g=((v=f==null?void 0:f[t])==null?void 0:v[l])||o,m=E.useMemo(()=>p,Object.values(p));return x.jsx(g.Provider,{value:m,children:h})};c.displayName=s+"Provider";function u(d,f){var g;const h=((g=f==null?void 0:f[t])==null?void 0:g[l])||o,p=E.useContext(h);if(p)return p;if(a!==void 0)return a;throw new Error(`\`${d}\` must be used within \`${s}\``)}return[c,u]}const i=()=>{const s=r.map(a=>E.createContext(a));return function(o){const l=(o==null?void 0:o[t])||s;return E.useMemo(()=>({[`__scope${t}`]:{...o,[t]:l}}),[o,l])}};return i.scopeName=t,[n,y6(i,...e)]}function y6(...t){const e=t[0];if(t.length===1)return e;const r=()=>{const n=t.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(s){const a=n.reduce((o,{useScope:l,scopeName:c})=>{const d=l(s)[`__scope${c}`];return{...o,...d}},{});return E.useMemo(()=>({[`__scope${e.scopeName}`]:a}),[a])}};return r.scopeName=e.scopeName,r}function RA(t){const e=b6(t),r=E.forwardRef((n,i)=>{const{children:s,...a}=n,o=E.Children.toArray(s),l=o.find(w6);if(l){const c=l.props.children,u=o.map(d=>d===l?E.Children.count(c)>1?E.Children.only(null):E.isValidElement(c)?c.props.children:null:d);return x.jsx(e,{...a,ref:i,children:E.isValidElement(c)?E.cloneElement(c,void 0,u):null})}return x.jsx(e,{...a,ref:i,children:s})});return r.displayName=`${t}.Slot`,r}function b6(t){const e=E.forwardRef((r,n)=>{const{children:i,...s}=r;if(E.isValidElement(i)){const a=E6(i),o=S6(s,i.props);return i.type!==E.Fragment&&(o.ref=n?Jc(n,a):a),E.cloneElement(i,o)}return E.Children.count(i)>1?E.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var x6=Symbol("radix.slottable");function w6(t){return E.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===x6}function S6(t,e){const r={...e};for(const n in e){const i=t[n],s=e[n];/^on[A-Z]/.test(n)?i&&s?r[n]=(...o)=>{const l=s(...o);return i(...o),l}:i&&(r[n]=i):n==="style"?r[n]={...i,...s}:n==="className"&&(r[n]=[i,s].filter(Boolean).join(" "))}return{...t,...r}}function E6(t){var n,i;let e=(n=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:n.get,r=e&&"isReactWarning"in e&&e.isReactWarning;return r?t.ref:(e=(i=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:i.get,r=e&&"isReactWarning"in e&&e.isReactWarning,r?t.props.ref:t.props.ref||t.ref)}function XE(t){const e=t+"CollectionProvider",[r,n]=Oa(e),[i,s]=r(e,{collectionRef:{current:null},itemMap:new Map}),a=g=>{const{scope:m,children:v}=g,y=F.useRef(null),b=F.useRef(new Map).current;return x.jsx(i,{scope:m,itemMap:b,collectionRef:y,children:v})};a.displayName=e;const o=t+"CollectionSlot",l=RA(o),c=F.forwardRef((g,m)=>{const{scope:v,children:y}=g,b=s(o,v),w=vt(m,b.collectionRef);return x.jsx(l,{ref:w,children:y})});c.displayName=o;const u=t+"CollectionItemSlot",d="data-radix-collection-item",f=RA(u),h=F.forwardRef((g,m)=>{const{scope:v,children:y,...b}=g,w=F.useRef(null),S=vt(m,w),T=s(u,v);return F.useEffect(()=>(T.itemMap.set(w,{ref:w,...b}),()=>void T.itemMap.delete(w))),x.jsx(f,{[d]:"",ref:S,children:y})});h.displayName=u;function p(g){const m=s(t+"CollectionConsumer",g);return F.useCallback(()=>{const y=m.collectionRef.current;if(!y)return[];const b=Array.from(y.querySelectorAll(`[${d}]`));return Array.from(m.itemMap.values()).sort((T,_)=>b.indexOf(T.ref.current)-b.indexOf(_.ref.current))},[m.collectionRef,m.itemMap])}return[{Provider:a,Slot:c,ItemSlot:h},p,n]}function T6(t){const e=_6(t),r=E.forwardRef((n,i)=>{const{children:s,...a}=n,o=E.Children.toArray(s),l=o.find(P6);if(l){const c=l.props.children,u=o.map(d=>d===l?E.Children.count(c)>1?E.Children.only(null):E.isValidElement(c)?c.props.children:null:d);return x.jsx(e,{...a,ref:i,children:E.isValidElement(c)?E.cloneElement(c,void 0,u):null})}return x.jsx(e,{...a,ref:i,children:s})});return r.displayName=`${t}.Slot`,r}function _6(t){const e=E.forwardRef((r,n)=>{const{children:i,...s}=r;if(E.isValidElement(i)){const a=C6(i),o=I6(s,i.props);return i.type!==E.Fragment&&(o.ref=n?Jc(n,a):a),E.cloneElement(i,o)}return E.Children.count(i)>1?E.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var A6=Symbol("radix.slottable");function P6(t){return E.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===A6}function I6(t,e){const r={...e};for(const n in e){const i=t[n],s=e[n];/^on[A-Z]/.test(n)?i&&s?r[n]=(...o)=>{const l=s(...o);return i(...o),l}:i&&(r[n]=i):n==="style"?r[n]={...i,...s}:n==="className"&&(r[n]=[i,s].filter(Boolean).join(" "))}return{...t,...r}}function C6(t){var n,i;let e=(n=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:n.get,r=e&&"isReactWarning"in e&&e.isReactWarning;return r?t.ref:(e=(i=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:i.get,r=e&&"isReactWarning"in e&&e.isReactWarning,r?t.props.ref:t.props.ref||t.ref)}var O6=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],ke=O6.reduce((t,e)=>{const r=T6(`Primitive.${e}`),n=E.forwardRef((i,s)=>{const{asChild:a,...o}=i,l=a?r:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),x.jsx(l,{...o,ref:s})});return n.displayName=`Primitive.${e}`,{...t,[e]:n}},{});function BN(t,e){t&&qo.flushSync(()=>t.dispatchEvent(e))}function Rn(t){const e=E.useRef(t);return E.useEffect(()=>{e.current=t}),E.useMemo(()=>(...r)=>{var n;return(n=e.current)==null?void 0:n.call(e,...r)},[])}function R6(t,e=globalThis==null?void 0:globalThis.document){const r=Rn(t);E.useEffect(()=>{const n=i=>{i.key==="Escape"&&r(i)};return e.addEventListener("keydown",n,{capture:!0}),()=>e.removeEventListener("keydown",n,{capture:!0})},[r,e])}var k6="DismissableLayer",Ix="dismissableLayer.update",L6="dismissableLayer.pointerDownOutside",D6="dismissableLayer.focusOutside",kA,UN=E.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Jf=E.forwardRef((t,e)=>{const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:n,onPointerDownOutside:i,onFocusOutside:s,onInteractOutside:a,onDismiss:o,...l}=t,c=E.useContext(UN),[u,d]=E.useState(null),f=(u==null?void 0:u.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,h]=E.useState({}),p=vt(e,_=>d(_)),g=Array.from(c.layers),[m]=[...c.layersWithOutsidePointerEventsDisabled].slice(-1),v=g.indexOf(m),y=u?g.indexOf(u):-1,b=c.layersWithOutsidePointerEventsDisabled.size>0,w=y>=v,S=M6(_=>{const A=_.target,P=[...c.branches].some(C=>C.contains(A));!w||P||(i==null||i(_),a==null||a(_),_.defaultPrevented||o==null||o())},f),T=$6(_=>{const A=_.target;[...c.branches].some(C=>C.contains(A))||(s==null||s(_),a==null||a(_),_.defaultPrevented||o==null||o())},f);return R6(_=>{y===c.layers.size-1&&(n==null||n(_),!_.defaultPrevented&&o&&(_.preventDefault(),o()))},f),E.useEffect(()=>{if(u)return r&&(c.layersWithOutsidePointerEventsDisabled.size===0&&(kA=f.body.style.pointerEvents,f.body.style.pointerEvents="none"),c.layersWithOutsidePointerEventsDisabled.add(u)),c.layers.add(u),LA(),()=>{r&&c.layersWithOutsidePointerEventsDisabled.size===1&&(f.body.style.pointerEvents=kA)}},[u,f,r,c]),E.useEffect(()=>()=>{u&&(c.layers.delete(u),c.layersWithOutsidePointerEventsDisabled.delete(u),LA())},[u,c]),E.useEffect(()=>{const _=()=>h({});return document.addEventListener(Ix,_),()=>document.removeEventListener(Ix,_)},[]),x.jsx(ke.div,{...l,ref:p,style:{pointerEvents:b?w?"auto":"none":void 0,...t.style},onFocusCapture:ve(t.onFocusCapture,T.onFocusCapture),onBlurCapture:ve(t.onBlurCapture,T.onBlurCapture),onPointerDownCapture:ve(t.onPointerDownCapture,S.onPointerDownCapture)})});Jf.displayName=k6;var N6="DismissableLayerBranch",GN=E.forwardRef((t,e)=>{const r=E.useContext(UN),n=E.useRef(null),i=vt(e,n);return E.useEffect(()=>{const s=n.current;if(s)return r.branches.add(s),()=>{r.branches.delete(s)}},[r.branches]),x.jsx(ke.div,{...t,ref:i})});GN.displayName=N6;function M6(t,e=globalThis==null?void 0:globalThis.document){const r=Rn(t),n=E.useRef(!1),i=E.useRef(()=>{});return E.useEffect(()=>{const s=o=>{if(o.target&&!n.current){let l=function(){WN(L6,r,c,{discrete:!0})};const c={originalEvent:o};o.pointerType==="touch"?(e.removeEventListener("click",i.current),i.current=l,e.addEventListener("click",i.current,{once:!0})):l()}else e.removeEventListener("click",i.current);n.current=!1},a=window.setTimeout(()=>{e.addEventListener("pointerdown",s)},0);return()=>{window.clearTimeout(a),e.removeEventListener("pointerdown",s),e.removeEventListener("click",i.current)}},[e,r]),{onPointerDownCapture:()=>n.current=!0}}function $6(t,e=globalThis==null?void 0:globalThis.document){const r=Rn(t),n=E.useRef(!1);return E.useEffect(()=>{const i=s=>{s.target&&!n.current&&WN(D6,r,{originalEvent:s},{discrete:!1})};return e.addEventListener("focusin",i),()=>e.removeEventListener("focusin",i)},[e,r]),{onFocusCapture:()=>n.current=!0,onBlurCapture:()=>n.current=!1}}function LA(){const t=new CustomEvent(Ix);document.dispatchEvent(t)}function WN(t,e,r,{discrete:n}){const i=r.originalEvent.target,s=new CustomEvent(t,{bubbles:!1,cancelable:!0,detail:r});e&&i.addEventListener(t,e,{once:!0}),n?BN(i,s):i.dispatchEvent(s)}var j6=Jf,F6=GN,br=globalThis!=null&&globalThis.document?E.useLayoutEffect:()=>{},B6="Portal",dv=E.forwardRef((t,e)=>{var o;const{container:r,...n}=t,[i,s]=E.useState(!1);br(()=>s(!0),[]);const a=r||i&&((o=globalThis==null?void 0:globalThis.document)==null?void 0:o.body);return a?$N.createPortal(x.jsx(ke.div,{...n,ref:e}),a):null});dv.displayName=B6;function U6(t,e){return E.useReducer((r,n)=>e[r][n]??r,t)}var Zc=t=>{const{present:e,children:r}=t,n=G6(e),i=typeof r=="function"?r({present:n.isPresent}):E.Children.only(r),s=vt(n.ref,W6(i));return typeof r=="function"||n.isPresent?E.cloneElement(i,{ref:s}):null};Zc.displayName="Presence";function G6(t){const[e,r]=E.useState(),n=E.useRef(null),i=E.useRef(t),s=E.useRef("none"),a=t?"mounted":"unmounted",[o,l]=U6(a,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return E.useEffect(()=>{const c=Mh(n.current);s.current=o==="mounted"?c:"none"},[o]),br(()=>{const c=n.current,u=i.current;if(u!==t){const f=s.current,h=Mh(c);t?l("MOUNT"):h==="none"||(c==null?void 0:c.display)==="none"?l("UNMOUNT"):l(u&&f!==h?"ANIMATION_OUT":"UNMOUNT"),i.current=t}},[t,l]),br(()=>{if(e){let c;const u=e.ownerDocument.defaultView??window,d=h=>{const g=Mh(n.current).includes(CSS.escape(h.animationName));if(h.target===e&&g&&(l("ANIMATION_END"),!i.current)){const m=e.style.animationFillMode;e.style.animationFillMode="forwards",c=u.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=m)})}},f=h=>{h.target===e&&(s.current=Mh(n.current))};return e.addEventListener("animationstart",f),e.addEventListener("animationcancel",d),e.addEventListener("animationend",d),()=>{u.clearTimeout(c),e.removeEventListener("animationstart",f),e.removeEventListener("animationcancel",d),e.removeEventListener("animationend",d)}}else l("ANIMATION_END")},[e,l]),{isPresent:["mounted","unmountSuspended"].includes(o),ref:E.useCallback(c=>{n.current=c?getComputedStyle(c):null,r(c)},[])}}function Mh(t){return(t==null?void 0:t.animationName)||"none"}function W6(t){var n,i;let e=(n=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:n.get,r=e&&"isReactWarning"in e&&e.isReactWarning;return r?t.ref:(e=(i=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:i.get,r=e&&"isReactWarning"in e&&e.isReactWarning,r?t.props.ref:t.props.ref||t.ref)}var V6=Yg[" useInsertionEffect ".trim().toString()]||br;function wc({prop:t,defaultProp:e,onChange:r=()=>{},caller:n}){const[i,s,a]=H6({defaultProp:e,onChange:r}),o=t!==void 0,l=o?t:i;{const u=E.useRef(t!==void 0);E.useEffect(()=>{const d=u.current;d!==o&&console.warn(`${n} is changing from ${d?"controlled":"uncontrolled"} to ${o?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),u.current=o},[o,n])}const c=E.useCallback(u=>{var d;if(o){const f=K6(u)?u(t):u;f!==t&&((d=a.current)==null||d.call(a,f))}else s(u)},[o,t,s,a]);return[l,c]}function H6({defaultProp:t,onChange:e}){const[r,n]=E.useState(t),i=E.useRef(r),s=E.useRef(e);return V6(()=>{s.current=e},[e]),E.useEffect(()=>{var a;i.current!==r&&((a=s.current)==null||a.call(s,r),i.current=r)},[r,i]),[r,n,s]}function K6(t){return typeof t=="function"}var VN=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),z6="VisuallyHidden",fv=E.forwardRef((t,e)=>x.jsx(ke.span,{...t,ref:e,style:{...VN,...t.style}}));fv.displayName=z6;var q6=fv,QE="ToastProvider",[JE,Y6,X6]=XE("Toast"),[HN]=Oa("Toast",[X6]),[Q6,hv]=
40HN(QE),KN=t=>{const{__scopeToast:e,label:r="Notification",duration:n=5e3,swipeDirection:i="right",swipeThreshold:s=50,children:a}=t,[o,l]=E.useState(null),[c,u]=E.useState(0),d=E.useRef(!1),f=E.useRef(!1);return r.trim()||console.error(`Invalid prop \`label\` supplied to \`${QE}\`. Expected non-empty \`string\`.`),x.jsx(JE.Provider,{scope:e,children:x.jsx(Q6,{scope:e,label:r,duration:n,swipeDirection:i,swipeThreshold:s,toastCount:c,viewport:o,onViewportChange:l,onToastAdd:E.useCallback(()=>u(h=>h+1),[]),onToastRemove:E.useCallback(()=>u(h=>h-1),[]),isFocusedToastEscapeKeyDownRef:d,isClosePausedRef:f,children:a})})};KN.displayName=QE;var zN="ToastViewport",J6=["F8"],Cx="toast.viewportPause",Ox="toast.viewportResume",qN=E.forwardRef((t,e)=>{const{__scopeToast:r,hotkey:n=J6,label:i="Notifications ({hotkey})",...s}=t,a=hv(zN,r),o=Y6(r),l=E.useRef(null),c=E.useRef(null),u=E.useRef(null),d=E.useRef(null),f=vt(e,d,a.onViewportChange),h=n.join("+").replace(/Key/g,"").replace(/Digit/g,""),p=a.toastCount>0;E.useEffect(()=>{const m=v=>{var b;n.length!==0&&n.every(w=>v[w]||v.code===w)&&((b=d.current)==null||b.focus())};return document.addEventListener("keydown",m),()=>document.removeEventListener("keydown",m)},[n]),E.useEffect(()=>{const m=l.current,v=d.current;if(p&&m&&v){const y=()=>{if(!a.isClosePausedRef.current){const T=new CustomEvent(Cx);v.dispatchEvent(T),a.isClosePausedRef.current=!0}},b=()=>{if(a.isClosePausedRef.current){const T=new CustomEvent(Ox);v.dispatchEvent(T),a.isClosePausedRef.current=!1}},w=T=>{!m.contains(T.relatedTarget)&&b()},S=()=>{m.contains(document.activeElement)||b()};return m.addEventListener("focusin",y),m.addEventListener("focusout",w),m.addEventListener("pointermove",y),m.addEventListener("pointerleave",S),window.addEventListener("blur",y),window.addEventListener("focus",b),()=>{m.removeEventListener("focusin",y),m.removeEventListener("focusout",w),m.removeEventListener("pointermove",y),m.removeEventListener("pointerleave",S),window.removeEventListener("blur",y),window.removeEventListener("focus",b)}}},[p,a.isClosePausedRef]);const g=E.useCallback(({tabbingDirection:m})=>{const y=o().map(b=>{const w=b.ref.current,S=[w,...dG(w)];return m==="forwards"?S:S.reverse()});return(m==="forwards"?y.reverse():y).flat()},[o]);return E.useEffect(()=>{const m=d.current;if(m){const v=y=>{var S,T,_;const b=y.altKey||y.ctrlKey||y.metaKey;if(y.key==="Tab"&&!b){const A=document.activeElement,P=y.shiftKey;if(y.target===m&&P){(S=c.current)==null||S.focus();return}const R=g({tabbingDirection:P?"backwards":"forwards"}),D=R.findIndex(L=>L===A);o0(R.slice(D+1))?y.preventDefault():P?(T=c.current)==null||T.focus():(_=u.current)==null||_.focus()}};return m.addEventListener("keydown",v),()=>m.removeEventListener("keydown",v)}},[o,g]),x.jsxs(F6,{ref:l,role:"region","aria-label":i.replace("{hotkey}",h),tabIndex:-1,style:{pointerEvents:p?void 0:"none"},children:[p&&x.jsx(Rx,{ref:c,onFocusFromOutsideViewport:()=>{const m=g({tabbingDirection:"forwards"});o0(m)}}),x.jsx(JE.Slot,{scope:r,children:x.jsx(ke.ol,{tabIndex:-1,...s,ref:f})}),p&&x.jsx(Rx,{ref:u,onFocusFromOutsideViewport:()=>{const m=g({tabbingDirection:"backwards"});o0(m)}})]})});qN.displayName=zN;var YN="ToastFocusProxy",Rx=E.forwardRef((t,e)=>{const{__scopeToast:r,onFocusFromOutsideViewport:n,...i}=t,s=hv(YN,r);return x.jsx(fv,{tabIndex:0,...i,ref:e,style:{position:"fixed"},onFocus:a=>{var c;const o=a.relatedTarget;!((c=s.viewport)!=null&&c.contains(o))&&n()}})});Rx.displayName=YN;var Zf="Toast",Z6="toast.swipeStart",eG="toast.swipeMove",tG="toast.swipeCancel",rG="toast.swipeEnd",XN=E.forwardRef((t,e)=>{const{forceMount:r,open:n,defaultOpen:i,onOpenChange:s,...a}=t,[o,l]=wc({prop:n,defaultProp:i??!0,onChange:s,caller:Zf});return x.jsx(Zc,{present:r||o,children:x.jsx(sG,{open:o,...a,ref:e,onClose:()=>l(!1),onPause:Rn(t.onPause),onResume:Rn(t.onResume),onSwipeStart:ve(t.onSwipeStart,c=>{c.currentTarget.setAttribute("data-swipe","start")}),onSwipeMove:ve(t.onSwipeMove,c=>{const{x:u,y:d}=c.detail.delta;c.currentTarget.setAttribute("data-swipe","move"),c.currentTarget.style.setProperty("--radix-toast-swipe-move-x",`${u}px`),c.currentTarget.style.setProperty("--radix-toast-swipe-move-y",`${d}px`)}),onSwipeCancel:ve(t.onSwipeCancel,c=>{c.currentTarget.setAttribute("data-swipe","cancel"),c.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),c.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),c.currentTarget.style.removeProperty("--radix-toast-swipe-end-x"),c.currentTarget.style.removeProperty("--radix-toast-swipe-end-y")}),onSwipeEnd:ve(t.onSwipeEnd,c=>{const{x:u,y:d}=c.detail.delta;c.currentTarget.setAttribute("data-swipe","end"),c.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),c.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),c.currentTarget.style.setProperty("--radix-toast-swipe-end-x",`${u}px`),c.currentTarget.style.setProperty("--radix-toast-swipe-end-y",`${d}px`),l(!1)})})})});XN.displayName=Zf;var[nG,iG]=HN(Zf,{onClose(){}}),sG=E.forwardRef((t,e)=>{const{__scopeToast:r,type:n="foreground",duration:i,open:s,onClose:a,onEscapeKeyDown:o,onPause:l,onResume:c,onSwipeStart:u,onSwipeMove:d,onSwipeCancel:f,onSwipeEnd:h,...p}=t,g=hv(Zf,r),[m,v]=E.useState(null),y=vt(e,L=>v(L)),b=E.useRef(null),w=E.useRef(null),S=i||g.duration,T=E.useRef(0),_=E.useRef(S),A=E.useRef(0),{onToastAdd:P,onToastRemove:C}=g,O=Rn(()=>{var j;(m==null?void 0:m.contains(document.activeElement))&&((j=g.viewport)==null||j.focus()),a()}),R=E.useCallback(L=>
40{!L||L===1/0||(window.clearTimeout(A.current),T.current=new Date().getTime(),A.current=window.setTimeout(O,L))},[O]);E.useEffect(()=>{const L=g.viewport;if(L){const j=()=>{R(_.current),c==null||c()},M=()=>{const N=new Date().getTime()-T.current;_.current=_.current-N,window.clearTimeout(A.current),l==null||l()};return L.addEventListener(Cx,M),L.addEventListener(Ox,j),()=>{L.removeEventListener(Cx,M),L.removeEventListener(Ox,j)}}},[g.viewport,S,l,c,R]),E.useEffect(()=>{s&&!g.isClosePausedRef.current&&R(S)},[s,S,g.isClosePausedRef,R]),E.useEffect(()=>(P(),()=>C()),[P,C]);const D=E.useMemo(()=>m?nM(m):null,[m]);return g.viewport?x.jsxs(x.Fragment,{children:[D&&x.jsx(aG,{__scopeToast:r,role:"status","aria-live":n==="foreground"?"assertive":"polite",children:D}),x.jsx(nG,{scope:r,onClose:O,children:qo.createPortal(x.jsx(JE.ItemSlot,{scope:r,children:x.jsx(j6,{asChild:!0,onEscapeKeyDown:ve(o,()=>{g.isFocusedToastEscapeKeyDownRef.current||O(),g.isFocusedToastEscapeKeyDownRef.current=!1}),children:x.jsx(ke.li,{tabIndex:0,"data-state":s?"open":"closed","data-swipe-direction":g.swipeDirection,...p,ref:y,style:{userSelect:"none",touchAction:"none",...t.style},onKeyDown:ve(t.onKeyDown,L=>{L.key==="Escape"&&(o==null||o(L.nativeEvent),L.nativeEvent.defaultPrevented||(g.isFocusedToastEscapeKeyDownRef.current=!0,O()))}),onPointerDown:ve(t.onPointerDown,L=>{L.button===0&&(b.current={x:L.clientX,y:L.clientY})}),onPointerMove:ve(t.onPointerMove,L=>{if(!b.current)return;const j=L.clientX-b.current.x,M=L.clientY-b.current.y,N=!!w.current,k=["left","right"].includes(g.swipeDirection),$=["left","up"].includes(g.swipeDirection)?Math.min:Math.max,U=k?$(0,j):0,G=k?0:$(0,M),B=L.pointerType==="touch"?10:2,K={x:U,y:G},ee={originalEvent:L,delta:K};N?(w.current=K,$h(eG,d,ee,{discrete:!1})):DA(K,g.swipeDirection,B)?(w.current=K,$h(Z6,u,ee,{discrete:!1}),L.target.setPointerCapture(L.pointerId)):(Math.abs(j)>B||Math.abs(M)>B)&&(b.current=null)}),onPointerUp:ve(t.onPointerUp,L=>{const j=w.current,M=L.target;if(M.hasPointerCapture(L.pointerId)&&M.releasePointerCapture(L.pointerId),w.current=null,b.current=null,j){const N=L.currentTarget,k={originalEvent:L,delta:j};DA(j,g.swipeDirection,g.swipeThreshold)?$h(rG,h,k,{discrete:!0}):$h(tG,f,k,{discrete:!0}),N.addEventListener("click",$=>$.preventDefault(),{once:!0})}})})})}),g.viewport)})]}):null}),aG=t=>{const{__scopeToast:e,children:r,...n}=t,i=hv(Zf,e),[s,a]=E.useState(!1),[o,l]=E.useState(!1);return cG(()=>a(!0)),E.useEffect(()=>{const c=window.setTimeout(()=>l(!0),1e3);return()=>window.clearTimeout(c)},[]),o?null:x.jsx(dv,{asChild:!0,children:x.jsx(fv,{...n,children:s&&x.jsxs(x.Fragment,{children:[i.label," ",r]})})})},oG="ToastTitle",QN=E.forwardRef((t,e)=>{const{__scopeToast:r,...n}=t;return x.jsx(ke.div,{...n,ref:e})});QN.displayName=oG;var lG="ToastDescription",JN=E.forwardRef((t,e)=>{const{__scopeToast:r,...n}=t;return x.jsx(ke.div,{...n,ref:e})});JN.displayName=lG;var ZN="ToastAction",eM=E.forwardRef((t,e)=>{const{altText:r,...n}=t;return r.trim()?x.jsx(rM,{altText:r,asChild:!0,children:x.jsx(ZE,{...n,ref:e})}):(console.error(`Invalid prop \`altText\` supplied to \`${ZN}\`. Expected non-empty \`string\`.`),null)});eM.displayName=ZN;var tM="ToastClose",ZE=E.forwardRef((t,e)=>{const{__scopeToast:r,...n}=t,i=iG(tM,r);return x.jsx(rM,{asChild:!0,children:x.jsx(ke.button,{type:"button",...n,ref:e,onClick:ve(t.onClick,i.onClose)})})});ZE.displayName=tM;var rM=E.forwardRef((t,e)=>{const{__scopeToast:r,altText:n,...i}=t;return x.jsx(ke.div,{"data-radix-toast-announce-exclude":"","data-radix-toast-announce-alt":n||void 0,...i,ref:e})});function nM(t){const e=[];return Array.from(t.childNodes).forEach(n=>{if(n.nodeType===n.TEXT_NODE&&n.textContent&&e.push(n.textContent),uG(n)){const i=n.ariaHidden||n.hidden||n.style.display==="none",s=n.dataset.radixToastAnnounceExclude==="";if(!i)if(s){const a=n.dataset.radixToastAnnounceAlt;a&&e.push(a)}else e.push(...nM(n))}}),e}function $h(t,e,r,{discrete:n}){const i=r.originalEvent.currentTarget,s=new CustomEvent(t,{bubbles:!0,cancelable:!0,detail:r});e&&i.addEventListener(t,e,{once:!0}),n?BN(i,s):i.dispatchEvent(s)}var DA=(t,e,r=0)=>{const n=Math.abs(t.x),i=Math.abs(t.y),s=n>i;return e==="left"||e==="right"?s&&n>r:!s&&i>r};function cG(t=()=>{}){const e=Rn(t);br(()=>{let r=0,n=0;return r=window.requestAnimationFrame(()=>n=window.requestAnimationFrame(e)),()=>{window.cancelAnimationFrame(r),window.cancelAnimationFrame(n)}},[e])}function uG(t){return t.nodeType===t.ELEMENT_NODE}function dG(t){const e=[],r=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:n=>{const i=n.tagName==="INPUT"&&n.type==="hidden";return n.disabled||n.hidden||i?NodeFilter.FILTER_SKIP:n.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)e.push(r.currentNode);return e}function o0(t){const e=document.activeElement;return t.some(r=>r===e?!0:(r.focus(),document.activeElement!==e))}var fG=KN,iM=qN,sM=XN,aM=QN,oM=JN,lM=eM,cM=ZE;function uM(t){var e,r,n="";if(typeof t=="string"||typeof t=="number")n+=t;else if(typeof t=="object")if(Array.isArray(t)){var i=t.length;for(e=0;e<i;e++)t[e]&&(r=uM(t[e]))&&(n&&(n+=" "),n+=r)}else for(r in t)t[r]&&(n&&(n+=" "),n+=r);return n}function Me(){for(var t,e,r=0,n="",i=arguments.length;r<i;r++)(t=arguments[r])&&(e=uM(t))&&(n&&(n+=" "),n+=e);return n}const NA=t=>typeof t=="boolean"?`${t}`:t===0?"0":t,MA=Me,eh=(t,e)=>r=>{var n;if((e==null?void 0:e.variants)==null)return MA(t,r==null?void 0:r.class,r==null?void 0:r.className);const{variants:i,defaultVariants:s}=e,a=Object.keys(i).map(c=>{const u=r==null?void 0:r[c],d=s==null?void 0:s[c];if(u===null)return null;const f=NA(u)||NA(d);return i[c][f]}),o=r&&Object.entries(r).reduce((c,u)=>{let[d,f]=u;return f===void 0||(c[d]=f),c},{}),l=e==null||(n=e.compoundVariants)===null||n===void 0?void 0:n.reduce((c,u)=>{let{class:d,className:f,...h}=u;return Object.entries(h).every(p=>{let[g,m]=p;return Array.isArray(m)?m.includes({...s,...o}[g]):{...s,...o}[g]===m})?[...c,d,f]:c},[]);return MA(t,a,l,r==null?void 0:r.class,r==null?void 0:r.className)};/**
41 * @license lucide-react v0.462.0 - ISC
42 *
43 * This source code is licensed under the ISC license.
44 * See the LICENSE file in the root directory of this source tree.
45 */const hG=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),dM=(...t)=>t.filter((e,r,n)=>!!e&&e.trim()!==""&&n.indexOf(e)===r).join(" ").trim();/**
46 * @license lucide-react v0.462.0 - ISC
47 *
48 * This source code is licensed under the ISC license.
49 * See the LICENSE file in the root directory of this source tree.
50 */var pG={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
51 * @license lucide-react v0.462.0 - ISC
52 *
53 * This source code is licensed under the ISC license.
54 * See the LICENSE file in the root directory of this source tree.
55 */const mG=E.forwardRef(({color:t="currentColor",size:e=24,strokeWidth:r=2,absoluteStrokeWidth:n,className:i="",children:s,iconNode:a,...o},l)=>E.createElement("svg",{ref:l,...pG,width:e,height:e,stroke:t,strokeWidth:n?Number(r)*24/Number(e):r,className:dM("lucide",i),...o},[...a.map(([c,u])=>E.createElement(c,u)),...Array.isArray(s)?s:[s]]));/**
56 * @license lucide-react v0.462.0 - ISC
57 *
58 * This source code is licensed under the ISC license.
59 * See the LICENSE file in the root directory of this source tree.
60 */const wt=(t,e)=>{const r=E.forwardRef(({className:n,...i},s)=>E.createElement(mG,{ref:s,iconNode:e,className:dM(`lucide-${hG(t)}`,n),...i}));return r.displayName=`${t}`,r};/**
61 * @license lucide-react v0.462.0 - ISC
62 *
63 * This source code is licensed under the ISC license.
64 * See the LICENSE file in the root directory of this source tree.
65 */const pv=wt("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);/**
66 * @license lucide-react v0.462.0 - ISC
67 *
68 * This source code is licensed under the ISC license.
69 * See the LICENSE file in the root directory of this source tree.
70 */const gG=wt("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);/**
71 * @license lucide-react v0.462.0 - ISC
72 *
73 * This source code is licensed under the ISC license.
74 * See the LICENSE file in the root directory of this source tree.
75 */const vG=wt("Calendar",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]]);/**
76 * @license lucide-react v0.462.0 - ISC
77 *
78 * This source code is licensed under the ISC license.
79 * See the LICENSE file in the root directory of this source tree.
80 */const kx=wt("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/**
81 * @license lucide-react v0.462.0 - ISC
82 *
83 * This source code is licensed under the ISC license.
84 * See the LICENSE file in the root directory of this source tree.
85 */const fM=wt("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/**
86 * @license lucide-react v0.462.0 - ISC
87 *
88 * This source code is licensed under the ISC license.
89 * See the LICENSE file in the root directory of this source tree.
90 */const yG=wt("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);/**
91 * @license lucide-react v0.462.0 - ISC
92 *
93 * This source code is licensed under the ISC license.
94 * See the LICENSE file in the root directory of this source tree.
95 */const bG=wt("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/**
96 * @license lucide-react v0.462.0 - ISC
97 *
98 * This source code is licensed under the ISC license.
99 * See the LICENSE file in the root directory of this source tree.
100 */const xG=wt("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);/**
101 * @license lucide-react v0.462.0 - ISC
102 *
103 * This source code is licensed under the ISC license.
104 * See the LICENSE file in the root directory of this source tree.
105 */const Tm=wt("CircleAlert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);/**
106 * @license lucide-react v0.462.0 - ISC
107 *
108 * This source code is licensed under the ISC license.
109 * See the LICENSE file in the root directory of this source tree.
110 */const hM=wt("CircleCheckBig",[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]);/**
111 * @license lucide-react v0.462.0 - ISC
112 *
113 * This source code is licensed under the ISC license.
114 * See the LICENSE file in the root directory of this source tree.
115 */const pM=wt("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/**
116 * @license lucide-react v0.462.0 - ISC
117 *
118 * This source code is licensed under the ISC license.
119 * See the LICENSE file in the root directory of this source tree.
120 */const wG=wt("CircleX",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);/**
121 * @license lucide-react v0.462.0 - ISC
122 *
123 * This source code is licensed under the ISC license.
124 * See the LICENSE file in the root directory of this source tree.
125 */const SG=wt("Cloud",[["path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"p7xjir"}]]);/**
126 * @license lucide-react v0.462.0 - ISC
127 *
128 * This source code is licensed under the ISC license.
129 * See the LICENSE file in the root directory of this source tree.
130 */const $A=wt("CreditCard",[["rect",{width:"20",height:"14",x:"2",y:"5",rx:"2",key:"ynyp8z"}],["line",{x1:"2",x2:"22",y1:"10",y2:"10",key:"1b3vmo"}]]);/**
131 * @license lucide-react v0.462.0 - ISC
132 *
133 * This source code is licensed under the ISC license.
134 * See the LICENSE file in the root directory of this source tree.
135 */const eT=wt("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/**
136 * @license lucide-react v0.462.0 - ISC
137 *
138 * This source code is licensed under the ISC license.
139 * See the LICENSE file in the root directory of this source tree.
140 */const Qu=wt("Lock",[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]]);/**
141 * @license lucide-react v0.462.0 - ISC
142 *
143 * This source code is licensed under the ISC license.
144 * See the LICENSE file in the root directory of this source tree.
145 */const Bd=wt("LogOut",[["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}],["polyline",{points:"16 17 21 12 16 7",key:"1gabdz"}],["line",{x1:"21",x2:"9",y1:"12",y2:"12",key:"1uyos4"}]]);/**
146 * @license lucide-react v0.462.0 - ISC
147 *
148 * This source code is licensed under the ISC license.
149 * See the LICENSE file in the root directory of this source tree.
150 */const Lx=wt("Mail",[["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}],["path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7",key:"1ocrg3"}]]);/**
151 * @license lucide-react v0.462.0 - ISC
152 *
153 * This source code is licensed under the ISC license.
154 * See the LICENSE file in the root directory of this source tree.
155 */const mM=wt("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/**
156 * @license lucide-react v0.462.0 - ISC
157 *
158 * This source code is licensed under the ISC license.
159 * See the LICENSE file in the root directory of this source tree.
160 */const EG=wt("Shield",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",ke
vendor: 13,709 bytes, lines 160-180
160y:"oel41y"}]]);/**
161 * @license lucide-react v0.462.0 - ISC
162 *
163 * This source code is licensed under the ISC license.
164 * See the LICENSE file in the root directory of this source tree.
165 */const TG=wt("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);/**
166 * @license lucide-react v0.462.0 - ISC
167 *
168 * This source code is licensed under the ISC license.
169 * See the LICENSE file in the root directory of this source tree.
170 */const gM=wt("User",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]);/**
171 * @license lucide-react v0.462.0 - ISC
172 *
173 * This source code is licensed under the ISC license.
174 * See the LICENSE file in the root directory of this source tree.
175 */const _G=wt("Users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"1da9ce"}]]);/**
176 * @license lucide-react v0.462.0 - ISC
177 *
178 * This source code is licensed under the ISC license.
179 * See the LICENSE file in the root directory of this source tree.
180 */const vM=wt("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),tT="-",AG=t=>{const e=IG(t),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=t;return{getClassGroupId:a=>{const o=a.split(tT);return o[0]===""&&o.length!==1&&o.shift(),yM(o,e)||PG(a)},getConflictingClassGroupIds:(a,o)=>{const l=r[a]||[];return o&&n[a]?[...l,...n[a]]:l}}},yM=(t,e)=>{var a;if(t.length===0)return e.classGroupId;const r=t[0],n=e.nextPart.get(r),i=n?yM(t.slice(1),n):void 0;if(i)return i;if(e.validators.length===0)return;const s=t.join(tT);return(a=e.validators.find(({validator:o})=>o(s)))==null?void 0:a.classGroupId},jA=/^\[(.+)\]$/,PG=t=>{if(jA.test(t)){const e=jA.exec(t)[1],r=e==null?void 0:e.substring(0,e.indexOf(":"));if(r)return"arbitrary.."+r}},IG=t=>{const{theme:e,prefix:r}=t,n={nextPart:new Map,validators:[]};return OG(Object.entries(t.classGroups),r).forEach(([s,a])=>{Dx(a,n,s,e)}),n},Dx=(t,e,r,n)=>{t.forEach(i=>{if(typeof i=="string"){const s=i===""?e:FA(e,i);s.classGroupId=r;return}if(typeof i=="function"){if(CG(i)){Dx(i(n),e,r,n);return}e.validators.push({validator:i,classGroupId:r});return}Object.entries(i).forEach(([s,a])=>{Dx(a,FA(e,s),r,n)})})},FA=(t,e)=>{let r=t;return e.split(tT).forEach(n=>{r.nextPart.has(n)||r.nextPart.set(n,{nextPart:new Map,validators:[]}),r=r.nextPart.get(n)}),r},CG=t=>t.isThemeGetter,OG=(t,e)=>e?t.map(([r,n])=>{const i=n.map(s=>typeof s=="string"?e+s:typeof s=="object"?Object.fromEntries(Object.entries(s).map(([a,o])=>[e+a,o])):s);return[r,i]}):t,RG=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,r=new Map,n=new Map;const i=(s,a)=>{r.set(s,a),e++,e>t&&(e=0,n=r,r=new Map)};return{get(s){let a=r.get(s);if(a!==void 0)return a;if((a=n.get(s))!==void 0)return i(s,a),a},set(s,a){r.has(s)?r.set(s,a):i(s,a)}}},bM="!",kG=t=>{const{separator:e,experimentalParseClassName:r}=t,n=e.length===1,i=e[0],s=e.length,a=o=>{const l=[];let c=0,u=0,d;for(let m=0;m<o.length;m++){let v=o[m];if(c===0){if(v===i&&(n||o.slice(m,m+s)===e)){l.push(o.slice(u,m)),u=m+s;continue}if(v==="/"){d=m;continue}}v==="["?c++:v==="]"&&c--}const f=l.length===0?o:o.substring(u),h=f.startsWith(bM),p=h?f.substring(1):f,g=d&&d>u?d-u:void 0;return{modifiers:l,hasImportantModifier:h,baseClassName:p,maybePostfixModifierPosition:g}};return r?o=>r({className:o,parseClassName:a}):a},LG=t=>{if(t.length<=1)return t;const e=[];let r=[];return t.forEach(n=>{n[0]==="["?(e.push(...r.sort(),n),r=[]):r.push(n)}),e.push(...r.sort()),e},DG=t=>({cache:RG(t.cacheSize),parseClassName:kG(t),...AG(t)}),NG=/\s+/,MG=(t,e)=>{const{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:i}=e,s=[],a=t.trim().split(NG);let o="";for(let l=a.length-1;l>=0;l-=1){const c=a[l],{modifiers:u,hasImportantModifier:d,baseClassName:f,maybePostfixModifierPosition:h}=r(c);let p=!!h,g=n(p?f.substring(0,h):f);if(!g){if(!p){o=c+(o.length>0?" "+o:o);continue}if(g=n(f),!g){o=c+(o.length>0?" "+o:o);continue}p=!1}const m=LG(u).join(":"),v=d?m+bM:m,y=v+g;if(s.includes(y))continue;s.push(y);const b=i(g,p);for(let w=0;w<b.length;++w){const S=b[w];s.push(v+S)}o=c+(o.length>0?" "+o:o)}return o};function $G(){let t=0,e,r,n="";for(;t<arguments.length;)(e=arguments[t++])&&(r=xM(e))&&(n&&(n+=" "),n+=r);return n}const xM=t=>{if(typeof t=="string")return t;let e,r="";for(let n=0;n<t.length;n++)t[n]&&(e=xM(t[n]))&&(r&&(r+=" "),r+=e);return r};function jG(t,...e){let r,n,i,s=a;function a(l){const c=e.reduce((u,d)=>d(u),t());return r=DG(c),n=r.cache.get,i=r.cache.set,s=o,o(l)}function o(l){const c=n(l);if(c)return c;const u=MG(l,r);return i(l,u),u}return function(){return s($G.apply(null,arguments))}}const ft=t=>{const e=r=>r[t]||[];return e.isThemeGetter=!0,e},wM=/^\[(?:([a-z-]+):)?(.+)\]$/i,FG=/^\d+\/\d+$/,BG=new Set(["px","full","screen"]),UG=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,GG=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,WG=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,VG=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,HG=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,zi=t=>ql(t)||BG.has(t)||FG.test(t),$s=t=>eu(t,"length",ZG),ql=t=>!!t&&!Number.isNaN(Number(t)),l0=t=>eu(t,"number",ql),Ru=t=>!!t&&Number.isInteger(Number(t)),KG=t=>t.endsWith("%")&&ql(t.slice(0,-1)),Ae=t=>wM.test(t),js=t=>UG.test(t),zG=new Set(["length","size","percentage"]),qG=t=>eu(t,zG,SM),YG=t=>eu(t,"position",SM),XG=new Set(["image","url"]),QG=t=>eu(t,XG,tW),JG=t=>eu(t,"",eW),ku=()=>!0,eu=(t,e,r)=>{const n=wM.exec(t);return n?n[1]?typeof e=="string"?n[1]===e:e.has(n[1]):r(n[2]):!1},ZG=t=>GG.test(t)&&!WG.test(t),SM=()=>!1,eW=t=>VG.test(t),tW=t=>HG.test(t),rW=()=>{const t=ft("colors"),e=ft("spacing"),r=ft("blur"),n=ft("brightness"),i=ft("borderColor"),s=ft("borderRadius"),a=ft("borderSpacing"),o=ft("borderWidth"),l=ft("contrast"),c=ft("grayscale"),u=ft("hueRotate"),d=ft("invert"),f=ft("gap"),h=ft("gradientColorStops"),p=ft("gradientColorStopPositions"),g=ft("inset"),m=ft("margin"),v=ft("opacity"),y=ft("padding"),b=ft("saturate"),w=ft("scale"),S=ft("sepia"),T=ft("skew"),_=ft("space"),A=ft("translate"),P=()=>["auto","contain","none"],C=()=>["auto","hidden","clip","visible","scroll"],O=()=>["auto",Ae,e],R=()=>[Ae,e],D=()=>["",zi,$s],L=()=>["auto",ql,Ae],j=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],M=()=>["solid","dashed","dotted","double","none"],N=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],k=()=>["start","end","center","between","around","evenly","stretch"],$=()=>["","0",Ae],U=()=>["auto","avoid","all","avoid-page","page","left","right","column"],G=()=>[ql,Ae];return{cacheSize:500,separator:":",theme:{colors:[ku],spacing:[zi,$s],blur:["none","",js,Ae],brightness:G(),borderColor:[t],borderRadius:["none","","full",js,Ae],borderSpacing:R(),borderWidth:D(),contrast:G(),grayscale:$(),hueRotate:G(),invert:$(),gap:R(),gradientColorStops:[t],gradientColorStopPositions:[KG,$s],inset:O(),margin:O(),opacity:G(),padding:R(),saturate:G(),scale:G(),sepia:$(),skew:G(),space:R(),translate:R()},classGroups:{aspect:[{aspect:["auto","square","video",Ae]}],container:["container"],columns:[{columns:[js]}],"break-after":[{"break-after":U()}],"break-before":[{"break-before":U()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...j(),Ae]}],overflow:[{overflow:C()}],"overflow-x":[{"overflow-x":C()}],"overflow-y":[{"overflow-y":C()}],overscroll:[{overscroll:P()}],"overscroll-x":[{"overscroll-x":P()}],"overscroll-y":[{"overscroll-y":P()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[g]}],"inset-x":[{"inset-x":[g]}],"inset-y":[{"inset-y":[g]}],start:[{start:[g]}],end:[{end:[g]}],top:[{top:[g]}],right:[{right:[g]}],bottom:[{bottom:[g]}],left:[{left:[g]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",Ru,Ae]}],basis:[{basis:O()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",Ae]}],grow:[{grow:$()}],shrink:[{shrink:$()}],order:[{order:["first","last","none",Ru,Ae]}],"grid-cols":[{"grid-cols":[ku]}],"col-start-end":[{col:["auto",{span:["full",Ru,Ae]},Ae]}],"col-start":[{"col-start":L()}],"col-end":[{"col-end":L()}],"grid-rows":[{"grid-rows":[ku]}],"row-start-end":[{row:["auto",{span:[Ru,Ae]},Ae]}],"row-start":[{"row-start":L()}],"row-end":[{"row-end":L()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",Ae]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",Ae]}],gap:[{gap:[f]}],"gap-x":[{"gap-x":[f]}],"gap-y":[{"gap-y":[f]}],"justify-content":[{justify:["normal",...k()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...k(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...k(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[y]}],px:[{px:[y]}],py:[{py:[y]}],ps:[{ps:[y]}],pe:[{pe:[y]}],pt:[{pt:[y]}],pr:[{pr:[y]}],pb:[{pb:[y]}],pl:[{pl:[y]}],m:[{m:[m]}],mx:[{mx:[m]}],my:[{my:[m]}],ms:[{ms:[m]}],me:[{me:[m]}],mt:[{mt:[m]}],mr:[{mr:[m]}],mb:[{mb:[m]}],ml:[{ml:[m]}],"space-x":[{"space-x":[_]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[_]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",Ae,e]}],"min-w":[{"min-w":[Ae,e,"min","max","fit"]}],"max-w":[{"max-w":[Ae,e,"none","full","min","max","fit","prose",{screen:[js]},js]}],h:[{h:[Ae,e,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[Ae,e,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[Ae,e,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[Ae,e,"auto","min","max","fit"]}],"font-size":[{text:["base",js,$s]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",l0]}],"font-family":[{font:[ku]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",Ae]}],"line-clamp":[{"line-clamp":["none",ql,l0]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",zi,Ae]}],"list-image":[{"list-image":["none",Ae]}],"list-style-type":[{list:["none","disc","decimal",Ae]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[t]}],"placeholder-opacity":[{"placeholder-opacity":[v]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[t]}],"text-opacity":[{"text-opacity":[v]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...M(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",zi,$s]}],"underline-offset":[{"underline-offset":["auto",zi,Ae]}],"text-decoration-color":[{decoration:[t]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:R()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Ae]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Ae]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[v]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...j(),YG]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",qG]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},QG]}],"bg-color":[{bg:[t]}],"gradient-from-pos":[{from:[p]}
vendor: 5,180 bytes, line 180
180],"gradient-via-pos":[{via:[p]}],"gradient-to-pos":[{to:[p]}],"gradient-from":[{from:[h]}],"gradient-via":[{via:[h]}],"gradient-to":[{to:[h]}],rounded:[{rounded:[s]}],"rounded-s":[{"rounded-s":[s]}],"rounded-e":[{"rounded-e":[s]}],"rounded-t":[{"rounded-t":[s]}],"rounded-r":[{"rounded-r":[s]}],"rounded-b":[{"rounded-b":[s]}],"rounded-l":[{"rounded-l":[s]}],"rounded-ss":[{"rounded-ss":[s]}],"rounded-se":[{"rounded-se":[s]}],"rounded-ee":[{"rounded-ee":[s]}],"rounded-es":[{"rounded-es":[s]}],"rounded-tl":[{"rounded-tl":[s]}],"rounded-tr":[{"rounded-tr":[s]}],"rounded-br":[{"rounded-br":[s]}],"rounded-bl":[{"rounded-bl":[s]}],"border-w":[{border:[o]}],"border-w-x":[{"border-x":[o]}],"border-w-y":[{"border-y":[o]}],"border-w-s":[{"border-s":[o]}],"border-w-e":[{"border-e":[o]}],"border-w-t":[{"border-t":[o]}],"border-w-r":[{"border-r":[o]}],"border-w-b":[{"border-b":[o]}],"border-w-l":[{"border-l":[o]}],"border-opacity":[{"border-opacity":[v]}],"border-style":[{border:[...M(),"hidden"]}],"divide-x":[{"divide-x":[o]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[o]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[v]}],"divide-style":[{divide:M()}],"border-color":[{border:[i]}],"border-color-x":[{"border-x":[i]}],"border-color-y":[{"border-y":[i]}],"border-color-s":[{"border-s":[i]}],"border-color-e":[{"border-e":[i]}],"border-color-t":[{"border-t":[i]}],"border-color-r":[{"border-r":[i]}],"border-color-b":[{"border-b":[i]}],"border-color-l":[{"border-l":[i]}],"divide-color":[{divide:[i]}],"outline-style":[{outline:["",...M()]}],"outline-offset":[{"outline-offset":[zi,Ae]}],"outline-w":[{outline:[zi,$s]}],"outline-color":[{outline:[t]}],"ring-w":[{ring:D()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[t]}],"ring-opacity":[{"ring-opacity":[v]}],"ring-offset-w":[{"ring-offset":[zi,$s]}],"ring-offset-color":[{"ring-offset":[t]}],shadow:[{shadow:["","inner","none",js,JG]}],"shadow-color":[{shadow:[ku]}],opacity:[{opacity:[v]}],"mix-blend":[{"mix-blend":[...N(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":N()}],filter:[{filter:["","none"]}],blur:[{blur:[r]}],brightness:[{brightness:[n]}],contrast:[{contrast:[l]}],"drop-shadow":[{"drop-shadow":["","none",js,Ae]}],grayscale:[{grayscale:[c]}],"hue-rotate":[{"hue-rotate":[u]}],invert:[{invert:[d]}],saturate:[{saturate:[b]}],sepia:[{sepia:[S]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[r]}],"backdrop-brightness":[{"backdrop-brightness":[n]}],"backdrop-contrast":[{"backdrop-contrast":[l]}],"backdrop-grayscale":[{"backdrop-grayscale":[c]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[u]}],"backdrop-invert":[{"backdrop-invert":[d]}],"backdrop-opacity":[{"backdrop-opacity":[v]}],"backdrop-saturate":[{"backdrop-saturate":[b]}],"backdrop-sepia":[{"backdrop-sepia":[S]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[a]}],"border-spacing-x":[{"border-spacing-x":[a]}],"border-spacing-y":[{"border-spacing-y":[a]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",Ae]}],duration:[{duration:G()}],ease:[{ease:["linear","in","out","in-out",Ae]}],delay:[{delay:G()}],animate:[{animate:["none","spin","ping","pulse","bounce",Ae]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[w]}],"scale-x":[{"scale-x":[w]}],"scale-y":[{"scale-y":[w]}],rotate:[{rotate:[Ru,Ae]}],"translate-x":[{"translate-x":[A]}],"translate-y":[{"translate-y":[A]}],"skew-x":[{"skew-x":[T]}],"skew-y":[{"skew-y":[T]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",Ae]}],accent:[{accent:["auto",t]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",Ae]}],"caret-color":[{caret:[t]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":R()}],"scroll-mx":[{"scroll-mx":R()}],"scroll-my":[{"scroll-my":R()}],"scroll-ms":[{"scroll-ms":R()}],"scroll-me":[{"scroll-me":R()}],"scroll-mt":[{"scroll-mt":R()}],"scroll-mr":[{"scroll-mr":R()}],"scroll-mb":[{"scroll-mb":R()}],"scroll-ml":[{"scroll-ml":R()}],"scroll-p":[{"scroll-p":R()}],"scroll-px":[{"scroll-px":R()}],"scroll-py":[{"scroll-py":R()}],"scroll-ps":[{"scroll-ps":R()}],"scroll-pe":[{"scroll-pe":R()}],"scroll-pt":[{"scroll-pt":R()}],"scroll-pr":[{"scroll-pr":R()}],"scroll-pb":[{"scroll-pb":R()}],"scroll-pl":[{"scroll-pl":R()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}
vendor: 4,647 bytes, line 180
180],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",Ae]}],fill:[{fill:[t,"none"]}],"stroke-w":[{stroke:[zi,$s,l0]}],stroke:[{stroke:[t,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}},nW=jG(rW);function be(...t){return nW(Me(t))}const iW=fG,EM=E.forwardRef(({className:t,...e},r)=>x.jsx(iM,{ref:r,className:be("fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]",t),...e}));EM.displayName=iM.displayName;const sW=eh("group pointer-events-auto relative flex w-full items-center justify-between space-x-4 overflow-hidden rounded-md border p-6 pr-8 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full",{variants:{variant:{default:"border bg-background text-foreground",destructive:"destructive group border-destructive bg-destructive text-destructive-foreground"}},defaultVariants:{variant:"default"}}),TM=E.forwardRef(({className:t,variant:e,...r},n)=>x.jsx(sM,{ref:n,className:be(sW({variant:e}),t),...r}));TM.displayName=sM.displayName;const aW=E.forwardRef(({className:t,...e},r)=>x.jsx(lM,{ref:r,className:be("inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium ring-offset-background transition-colors hover:bg-secondary focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:border-muted/40 group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground group-[.destructive]:focus:ring-destructive",t),...e}));aW.displayName=lM.displayName;const _M=E.forwardRef(({className:t,...e},r)=>x.jsx(cM,{ref:r,className:be("absolute right-2 top-2 rounded-md p-1 text-foreground
180/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-none focus:ring-2 group-hover:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600",t),"toast-close":"",...e,children:x.jsx(vM,{className:"h-4 w-4"})}));_M.displayName=cM.displayName;const AM=E.forwardRef(({className:t,...e},r)=>x.jsx(aM,{ref:r,className:be("text-sm font-semibold",t),...e}));AM.displayName=aM.displayName;const PM=E.forwardRef(({className:t,...e},r)=>x.jsx(oM,{ref:r,className:be("text-sm opacity-90",t),...e}));PM.displayName=oM.displayName;function oW(){const{toasts:t}=FN();return x.jsxs(iW,{children:[t.map(function({id:e,title:r,description:n,action:i,...s}){return x.jsxs(TM,{...s,children:[x.jsxs("div",{className:"grid gap-1",children:[r&&x.jsx(AM,{children:r}),n&&x.jsx(PM,{children:n})]}),i,x.jsx(_M,{})]},e)}),x.jsx(EM,{})]})}var BA=["light","dark"],lW="(prefers-color-scheme: dark)",cW=E.createContext(void 0),uW={setTheme:t=>{},themes:[]},dW=()=>{var t;return(t=E.useContext(cW))!=null?t:uW};E.memo(({forcedTheme:t,storageKey:e,attribute:r,enableSystem:n,enableColorScheme:i,defaultTheme:s,value:a,attrs:o,nonce:l})=>{let c=s==="system",u=r==="class"?`var d=document.documentElement,c=d.classList;${`c.remove(${o.map(p=>`'${p}'`).join(",")})`};`:`var d=document.documentElement,n='${r}',s='setAttribute';`,d=i?BA.includes(s)&&s?`if(e==='light'||e==='dark'||!e)d.style.colorScheme=e||'${s}'`:"if(e==='light'||e==='dark')d.style.colorScheme=e":"",f=(p,g=!1,m=!0)=>{let v=a?a[p]:p,y=g?p+"|| ''":`'${v}'`,b="";return i&&m&&!g&&BA.includes(p)&&(b+=`d.style.colorScheme = '${p}';`),r==="class"?g||v?b+=`c.add(${y})`:b+="null":v&&(b+=`d[s](n,${y})`),b},h=t?`!function(){${u}${f(t)}}()`:n?`!function(){try{${u}var e=localStorage.getItem('${e}');if('system'===e||(!e&&${c})){var t='${lW}',m=window.matchMedia(t);if(m.media!==t||m.matches){${f("dark")}}else{${f("light")}}}else if(e){${a?`var x=${JSON.stringify(a)};`:""}${f(a?"x[e]":"e",!0)}}${c?"":"else{"+f(s,!1,!1)+"}"}${d}}catch(e){}}()`:`!function(){try{${u}var e=localStorage.getItem('${e}');if(e){${a?`var x=${JSON.stringify(a)};`:""}${f(a?"x[e]":"e",!0)}}else{${f(s,!1,!1)};}${d}}catch(t){}}();`;return E.createElement("script",{nonce:l,dangerouslySetInnerHTML:{__html:h}})});var fW=t=>{switch(t){case"success":return mW;case"info":return vW;case"warning":return gW;case"error":return yW;default:return null}},hW=Array(12).fill(0),pW=({visible:t,className:e})=>F.createElement("div",{className:["sonner-loading-wrapper",e].filter(Boolean).join(" "),"data-visible":t},F.createElement("div",{className:"sonner-spinner"},hW.map((r,n)=>F.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${n}`})))),mW=F.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},F.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),gW=F.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},F.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),vW=F.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},F.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),yW=F.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},F.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),bW=F.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},F.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),F.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),xW=()=>{let[t,e]=F.useState(document.hidden);return F.useEffect(()=>{let r=()=>{e(document.hidden)};return document.addEventListener("visibilitychange",r),()=>window.removeEventListener("visibilitychange",r)},[]),t},Nx=1,wW=class{constructor(){this.subscribe=t=>(this.subscribers.push(t),()=>{let e=this.subscribers.indexOf(t);this.subscribers.splice(e,1)}),this.publish=t=>
180{this.subscribers.forEach(e=>e(t))},this.addToast=t=>{this.publish(t),this.toasts=[...this.toasts,t]},this.create=t=>{var e;let{message:r,...n}=t,i=typeof(t==null?void 0:t.id)=="number"||((e=t.id)==null?void 0:e.length)>0?t.id:Nx++,s=this.toasts.find(o=>o.id===i),a=t.dismissible===void 0?!0:t.dismissible;return this.dismissedToasts.has(i)&&this.dismissedToasts.delete(i),s?this.toasts=this.toasts.map(o=>o.id===i?(this.publish({...o,...t,id:i,title:r}),{...o,...t,id:i,dismissible:a,title:r}):o):this.addToast({title:r,...n,dismissible:a,id:i}),i},this.dismiss=t=>(this.dismissedToasts.add(t),t||this.toasts.forEach(e=>{this.subscribers.forEach(r=>r({id:e.id,dismiss:!0}))}),this.subscribers.forEach(e=>e({id:t,dismiss:!0})),t),this.message=(t,e)=>this.create({...e,message:t}),this.error=(t,e)=>this.create({...e,message:t,type:"error"}),this.success=(t,e)=>this.create({...e,type:"success",message:t}),this.info=(t,e)=>this.create({...e,type:"info",message:t}),this.warning=(t,e)=>this.create({...e,type:"warning",message:t}),this.loading=(t,e)=>this.create({...e,type:"loading",message:t}),this.promise=(t,e)=>{if(!e)return;let r;e.loading!==void 0&&(r=this.create({...e,promise:t,type:"loading",message:e.loading,description:typeof e.description!="function"?e.description:void 0}));let n=t instanceof Promise?t:t(),i=r!==void 0,s,a=n.then(async l=>{if(s=["resolve",l],F.isValidElement(l))i=!1,this.create({id:r,type:"default",message:l});else if(EW(l)&&!l.ok){i=!1;let c=typeof e.error=="function"?await e.error(`HTTP error! status: ${l.status}`):e.error,u=typeof e.description=="function"?await e.description(`HTTP error! status: ${l.status}`):e.description;this.create({id:r,type:"error",message:c,description:u})}else if(e.success!==void 0){i=!1;let c=typeof e.success=="function"?await e.success(l):e.success,u=typeof e.description=="function"?await e.description(l):e.description;this.create({id:r,type:"success",message:c,description:u})}}).catch(async l=>{if(s=["reject",l],e.error!==void 0){i=!1;let c=typeof e.error=="function"?await e.error(l):e.error,u=typeof e.description=="function"?await e.description(l):e.description;this.create({id:r,type:"error",message:c,description:u})}}).finally(()=>{var l;i&&(this.dismiss(r),r=void 0),(l=e.finally)==null||l.call(e)}),o=()=>new Promise((l,c)=>a.then(()=>s[0]==="reject"?c(s[1]):l(s[1])).catch(c));return typeof r!="string"&&typeof r!="number"?{unwrap:o}:Object.assign(r,{unwrap:o})},this.custom=(t,e)=>{let r=(e==null?void 0:e.id)||Nx++;return this.create({jsx:t(r),id:r,...e}),r},this.getActiveToasts=()=>this.toasts.filter(t=>!this.dismissedToasts.has(t.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}},Fr=new wW,SW=(t,e)=>{let r=(e==null?void 0:e.id)||Nx++;return Fr.addToast({title:t,...e,id:r}),r},EW=t=>t&&typeof t=="object"&&"ok"in t&&typeof t.ok=="boolean"&&"status"in t&&typeof t.status=="number",TW=SW,_W=()=>Fr.toasts,AW=()=>Fr.getActiveToasts(),He=Object.assign(TW,{success:Fr.success,info:Fr.info,warning:Fr.warning,error:Fr.error,custom:Fr.custom,message:Fr.message,promise:Fr.promise,dismiss:Fr.dismiss,loading:Fr.loading},{getHistory:_W,getToasts:AW});function PW(t,{insertAt:e}={}){if(typeof document>"u")return;let r=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css",e==="top"&&r.firstChild?r.insertBefore(n,r.firstChild):r.appendChild(n),n.styleSheet?n.styleSheet.cssText=t:n.appendChild(document.createTextNode(t))}PW(`:where(html[dir="ltr"]),:where([data-sonner-toaster][dir="ltr"]){--toast-icon-margin-start: -3px;--toast-icon-margin-end: 4px;--toast-svg-margin-start: -1px;--toast-svg-margin-end: 0px;--toast-button-margin-start: auto;--toast-button-margin-end: 0;--toast-close-button-start: 0;--toast-close-button-end: unset;--toast-close-button-transform: translate(-35%, -35%)}:where(html[dir="rtl"]),:where([data-sonner-toaster][dir="rtl"]){--toast-icon-margin-start: 4px;--toast-icon-margin-end: -3px;--toast-svg-margin-start: 0px;--toast-svg-margin-end: -1px;--toast-button-margin-start: 0;--toast-button-margin-end: auto;--toast-close-button-start: unset;--toast-close-button-end: 0;--toast-close-button-transform: translate(35%, -35%)}:where([data-sonner-toaster]){position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1: hsl(0, 0%, 99%);--gray2: hsl(0, 0%, 97.3%);--gray3: hsl(0, 0%, 95.1%);--gray4: hsl(0, 0%, 93%);--gray5: hsl(0, 0%, 90.9%);--gray6: hsl(0, 0%, 88.7%);--gray7: hsl(0, 0%, 85.8%);--gray8: hsl(0, 0%, 78%);--gray9: hsl(0, 0%, 56.1%);--gray10: hsl(0, 0%, 52.3%);--gray11: hsl(0, 0%, 43.5%);--gray12: hsl(0, 0%, 9%);--border-radius: 8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:none;z-index:999999999;transition:transform .4s ease}:where([data-sonner-toaster][data-lifted="true"]){transform:translateY(-10px)}@media (hover: none) and (pointer: coarse){:where([data-sonner-toaster][data-lifted="true"]){transform:none}}:where([data-sonner-toaster][data-x-position="right"]){right:var(--offset-right)}:where([data-sonner-toaster][data-x-position="left"]){left:var(--offset-left)}:where([data-sonner-toaster][data-x-position="center"]){left:50%;transform:translate(-50%)}:where([data-sonner-toaster][data-y-position="top"]){top:var(--offset-top)}:where([data-sonner-toaster][data-y-position="bottom"]){bottom:var(--offset-bottom)}:where([data-sonner-toast]){--y: translateY(100%);--lift-amount: calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);filter:blur(0);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:none;overflow-wrap:anywhere}:where([data-sonner-toast][data-styled="true"]){padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px #0000001a;width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}:where([data-sonner-toast]:focus-visible){box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}:where([data-sonner-toast][data-y-position="top"]){top:0;--y: translateY(-100%);--lift: 1;--lift-amount: calc(1 * var(--gap))}:where([data-sonner-toast][data-y-position="bottom"]){bottom:0;--y: translateY(100%);--lift: -1;--lift-amount: calc(var(--lift) * var(--gap))}:where([data-sonner-toast]) :where([data-description]){font-weight:400;line-height:1.4;color:inherit}:where([data-sonner-toast]) :where([data-title]){font-weight:500;line-height:1.5;color:inherit}:where([data-sonner-toast]) :where([data-icon]){display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}:where([data-sonner-toast][data-promise="true"]) :where([data-icon])>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}:where([data-sonner-toast]) :where([data-icon])>*{flex-shrink:0}:where([data-sonner-toast]) :where([data-icon]) svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}:where([data-sonner-toast]) :where([data-content]){display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;cursor:pointer;outline:none;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}:where([data-sonner-toast]) :where([data-button]):focus-visible{box-shadow:0 0 0 2px #0006}:where([data-sonner-toast]) :where([data-button]):first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}:where([data-sonner-toast]) :where([data-cancel]){color:var(--normal-text);background:rgba(0,0,0,.08)}:where([data-sonner-toast][data-theme="dark"]) :where([data-cancel]){background:rgba(255,255,255,.3)}:where([data-sonner-toast]) :where([data-close-button]){position:absolute;
180left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast] [data-close-button]{background:var(--gray1)}:where([data-sonner-toast]) :where([data-close-button]):focus-visible{box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}:where([data-sonner-toast]) :where([data-disabled="true"]){cursor:not-allowed}:where([data-sonner-toast]):hover :where([data-close-button]):hover{background:var(--gray2);border-color:var(--gray5)}:where([data-sonner-toast][data-swiping="true"]):before{content:"";position:absolute;left:-50%;right:-50%;height:100%;z-index:-1}:where([data-sonner-toast][data-y-position="top"][data-swiping="true"]):before{bottom:50%;transform:scaleY(3) translateY(50%)}:where([data-sonner-toast][data-y-position="bottom"][data-swiping="true"]):before{top:50%;transform:scaleY(3) translateY(-50%)}:where([data-sonner-toast][data-swiping="false"][data-removed="true"]):before{content:"";position:absolute;inset:0;transform:scaleY(2)}:where([data-sonner-toast]):after{content:"";position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}:where([data-sonner-toast][data-mounted="true"]){--y: translateY(0);opacity:1}:where([data-sonner-toast][data-expanded="false"][data-front="false"]){--scale: var(--toasts-before) * .05 + 1;--y: translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}:where([data-sonner-toast])>*{transition:opacity .4s}:where([data-sonner-toast][data-expanded="false"][data-front="false"][data-styled="true"])>*{opacity:0}
180:where([data-sonner-toast][data-visible="false"]){opacity:0;pointer-events:none}:where([data-sonner-toast][data-mounted="true"][data-expanded="true"]){--y: translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}:where([data-sonner-toast][data-removed="true"][data-front="true"][data-swipe-out="false"]){--y: translateY(calc(var(--lift) * -100%));opacity:0}:where([data-sonner-toast][data-removed="true"][data-front="false"][data-swipe-out="false"][data-expanded="true"]){--y: translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}:where([data-sonner-toast][data-removed="true"][data-front="false"][data-swipe-out="false"][data-expanded="false"]){--y: translateY(40%);opacity:0;transition:transform .5s,opacity .2s}:where([data-sonner-toast][data-removed="true"][data-front="false"]):before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y, 0px)) translate(var(--swipe-amount-x, 0px));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{0%{transform:var(--y) translate(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translate(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{0%{transform:var(--y) translate(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translate(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{0%{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{0%{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width: 600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-theme=light]{--normal-bg: #fff;--normal-border: var(--gray4);--normal-text: var(--gray12);--success-bg: hsl(143, 85%, 96%);--success-border: hsl(145, 92%, 91%);--success-text: hsl(140, 100%, 27%);--info-bg: hsl(208, 100%, 97%);--info-border: hsl(221, 91%, 91%);--info-text: hsl(210, 92%, 45%);--warning-bg: hsl(49, 100%, 97%);--warning-border: hsl(49, 91%, 91%);--warning-text: hsl(31, 92%, 45%);--error-bg: hsl(359, 100%, 97%);--error-border: hsl(359, 100%, 94%);--error-text: hsl(360, 100%, 45%)}[data-sonner-toaster][data-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg: #000;--normal-border: hsl(0, 0%, 20%);--normal-text: var(--gray1)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg: #fff;--normal-border: var(--gray3);--normal-text: var(--gray12)}[data-sonner-toaster][data-theme=dark]{--normal-bg: #000;--normal-bg-hover: hsl(0, 0%, 12%);--normal-border: hsl(0, 0%, 20%);--normal-border-hover: hsl(0, 0%, 25%);--normal-text: var(--gray1);--success-bg: hsl(150, 100%, 6%);--success-border: hsl(147, 100%, 12%);--success-text: hsl(150, 86%, 65%);--info-bg: hsl(215, 100%, 6%);--info-border: hsl(223, 100%, 12%);--info-text: hsl(216, 87%, 65%);--warning-bg: hsl(64, 100%, 6%);--warning-border: hsl(60, 100%, 12%);--warning-text: hsl(46, 87%, 65%);--error-bg: hsl(358, 76%, 10%);--error-border: hsl(357, 89%, 16%);
180--error-text: hsl(358, 100%, 81%)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success],[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info],[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning],[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error],[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size: 16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:nth-child(1){animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}to{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}to{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}to{opacity:.15}}@media (prefers-reduced-motion){[data-sonner-toast],[data-sonner-toast]>*,.sonner-loading-bar{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}
181`);function jh(t){return t.label!==void 0}var IW=3,CW="32px",OW="16px",UA=4e3,RW=356,kW=14,LW=20,DW=200;function Un(...t){return t.filter(Boolean).join(" ")}function NW(t){let[e,r]=t.split("-"),n=[];return e&&n.push(e),r&&n.push(r),n}var MW=t=>{var e,r,n,i,s,a,o,l,c,u,d;let{invert:f,toast:h,unstyled:p,interacting:g,setHeights:m,visibleToasts:v,heights:y,index:b,toasts:w,expanded:S,removeToast:T,defaultRichColors:_,closeButton:A,style:P,cancelButtonStyle:C,actionButtonStyle:O,className:R="",descriptionClassName:D="",duration:L,position:j,gap:M,loadingIcon:N,expandByDefault:k,classNames:$,icons:U,closeButtonAriaLabel:G="Close toast",pauseWhenPageIsHidden:B}=t,[K,ee]=F.useState(null),[H,J]=F.useState(null),[q,ie]=F.useState(!1),[Z,re]=F.useState(!1),[ne,z]=F.useState(!1),[Ee,me]=F.useState(!1),[Qe,de]=F.useState(!1),[Pe,tt]=F.useState(0),[kt,Gt]=F.useState(0),$t=F.useRef(h.duration||L||UA),Jt=F.useRef(null),$r=F.useRef(null),Hi=b===0,Fa=b+1<=v,Zt=h.type,Ki=h.dism
181issible!==!1,Cy=h.className||"",gh=h.descriptionClassName||"",Ba=F.useMemo(()=>y.findIndex(Te=>Te.toastId===h.id)||0,[y,h.id]),Ua=F.useMemo(()=>{var Te;return(Te=h.closeButton)!=null?Te:A},[h.closeButton,A]),m1=F.useMemo(()=>h.duration||L||UA,[h.duration,L]),Oy=F.useRef(0),Zo=F.useRef(0),g1=F.useRef(0),el=F.useRef(null),[$4,j4]=j.split("-"),v1=F.useMemo(()=>y.reduce((Te,Je,yt)=>yt>=Ba?Te:Te+Je.height,0),[y,Ba]),y1=xW(),F4=h.invert||f,Ry=Zt==="loading";Zo.current=F.useMemo(()=>Ba*M+v1,[Ba,v1]),F.useEffect(()=>{$t.current=m1},[m1]),F.useEffect(()=>{ie(!0)},[]),F.useEffect(()=>{let Te=$r.current;if(Te){let Je=Te.getBoundingClientRect().height;return Gt(Je),m(yt=>[{toastId:h.id,height:Je,position:h.position},...yt]),()=>m(yt=>yt.filter($n=>$n.toastId!==h.id))}},[m,h.id]),F.useLayoutEffect(()=>{if(!q)return;let Te=$r.current,Je=Te.style.height;Te.style.height="auto";let yt=Te.getBoundingClientRect().height;Te.style.height=Je,Gt(yt),m($n=>$n.find(jn=>jn.toastId===h.id)?$n.map(jn=>jn.toastId===h.id?{...jn,height:yt}:jn):[{toastId:h.id,height:yt,position:h.position},...$n])},[q,h.title,h.description,m,h.id]);let Ls=F.useCallback(()=>{re(!0),tt(Zo.current),m(Te=>Te.filter(Je=>Je.toastId!==h.id)),setTimeout(()=>{T(h)},DW)},[h,T,m,Zo]);F.useEffect(()=>{if(h.promise&&Zt==="loading"||h.duration===1/0||h.type==="loading")return;let Te;return S||g||B&&y1?(()=>{if(g1.current<Oy.current){let Je=new Date().getTime()-Oy.current;$t.current=$t.current-Je}g1.current=new Date().getTime()})():$t.current!==1/0&&(Oy.current=new Date().getTime(),Te=setTimeout(()=>{var Je;(Je=h.onAutoClose)==null||Je.call(h,h),Ls()},$t.current)),()=>clearTimeout(Te)},[S,g,h,Zt,B,y1,Ls]),F.useEffect(()=>{h.delete&&Ls()},[Ls,h.delete]);function B4(){var Te,Je,yt;return U!=null&&U.loading?F.createElement("div",{className:Un($==null?void 0:$.loader,(Te=h==null?void 0:h.classNames)==null?void 0:Te.loader,"sonner-loader"),"data-visible":Zt==="loading"},U.loading):N?F.createElement("div",{className:Un($==null?void 0:$.loader,(Je=h==null?void 0:h.classNames)==null?void 0:Je.loader,"sonner-loader"),"data-visible":Zt==="loading"},N):F.createElement(pW,{className:Un($==null?void 0:$.loader,(yt=h==null?void 0:h.classNames)==null?void 0:yt.loader),visible:Zt==="loading"})}return F.createElement("li",{tabIndex:0,ref:$r,className:Un(R,Cy,$==null?void 0:$.toast,(e=h==null?void 0:h.classNames)==null?void 0:e.toast,$==null?void 0:$.default,$==null?void 0:$[Zt],(r=h==null?void 0:h.classNames)==null?void 0:r[Zt]),"data-sonner-toast":"","data-rich-colors":(n=h.richColors)!=null?n:_,"data-styled":!(h.jsx||h.unstyled||p),"data-mounted":q,"data-promise":!!h.promise,"data-swiped":Qe,"data-removed":Z,"data-visible":Fa,"data-y-position":$4,"data-x-position":j4,"data-index":b,"data-front":Hi,"data-swiping":ne,"data-dismissible":Ki,"data-type":Zt,"data-invert":F4,"data-swipe-out":Ee,"data-swipe-direction":H,"data-expanded":!!(S||k&&q),style:{"--index":b,"--toasts-before":b,"--z-index":w.length-b,"--offset":`${Z?Pe:Zo.current}px`,"--initial-height":k?"auto":`${kt}px`,...P,...h.style},onDragEnd:()=>{z(!1),ee(null),el.current=null},onPointerDown:Te=>{Ry||!Ki||(Jt.current=new Date,tt(Zo.current),Te.target.setPointerCapture(Te.pointerId),Te.target.tagName!=="BUTTON"&&(z(!0),el.current={x:Te.clientX,y:Te.clientY}))},onPointerUp:()=>{var Te,Je,yt,$n;if(Ee||!Ki)return;el.current=null;let jn=Number(((Te=$r.current)==null?void 0:Te.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),Ds=Number(((Je=$r.current)==null?void 0:Je.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),Ga=new Date().getTime()-((yt=Jt.current)==null?void 0:yt.getTime()),Fn=K==="x"?jn:Ds,Ns=Math.abs(Fn)/Ga;if(Math.abs(Fn)>=LW||Ns>.11){tt(Zo.current),($n=h.onDismiss)==null||$n.call(h,h),J(K==="x"?jn>0?"right":"left":Ds>0?"down":"up"),Ls(),me(!0),de(!1);return}z(!1),ee(null)},onPointerMove:Te=>{var Je,yt,$n,jn;if(!el.current||!Ki||((Je=window.getSelection())==null?void 0:Je.toString().length)>0)return;let Ds=Te.clientY-el.current.y,Ga=Te.clientX-el.current.x,Fn=(yt=t.swipeDirections)!=null?yt:NW(j);!K&&(Math.abs(Ga)>1||Math.abs(Ds)>1)&&ee(Math.abs(Ga)>Math.abs(Ds)?"x":"y");let Ns={x:0,y:0};K==="y"?(Fn.includes("top")||Fn.includes("bottom"))&&(Fn.includes("top")&&Ds<0||Fn.includes("bottom")&&Ds>0)&&(Ns.y=Ds):K==="x"&&(Fn.includes("left")||Fn.includes("right"))&&(Fn.includes("left")&&Ga<0||Fn.includes("right")&&Ga>0)&&(Ns.x=Ga),(Math.abs(Ns.x)>0||Math.abs(Ns.y)>0)&&de(!0),($n=$r.current)==null||$n.style.setProperty("--swipe-amount-x",`${Ns.x}px`),(jn=$r.current)==null||jn.style.setProperty("--swipe-amount-y",`${Ns.y}px`)}},Ua&&!h.jsx?F.createElement("button",{"aria-label":G,"data-disabled":Ry,"data-close-button":!0,onClick:Ry||!Ki?()=>{}:()=>{var Te;Ls(),(Te=h.onDismiss)==null||Te.call(h,h)},className:Un($==null?void 0:$.closeButton,(i=h==null?void 0:h.classNames)==null?void 0:i.closeButton)},(s=U==null?void 0:U.close)!=null?s:bW):null,h.jsx||E.isValidElement(h.title)?h.jsx?h.jsx:typeof h.title=="function"?h.title():h.title:F.createElement(F.Fragment,null,Zt||h.icon||h.promise?F.createElement("div",{"data-icon":"",className:Un($==null?void 0:$.icon,(a=h==null?void 0:h.classNames)==null?void 0:a.icon)},h.promise||h.type==="loading"&&!h.icon?h.icon||B4():null,h.type!=="loading"?h.icon||(U==null?void 0:U[Zt])||fW(Zt):null):null,F.createElement("div",{"data-content":"",className:Un($==null?void 0:$.content,(o=h==null?void 0:h.classNames)==null?void 0:o.content)},F.createElement("div",{"data-title":"",className:Un($==null?void 0:$.t
vendor: 6,374 bytes, line 181
181itle,(l=h==null?void 0:h.classNames)==null?void 0:l.title)},typeof h.title=="function"?h.title():h.title),h.description?F.createElement("div",{"data-description":"",className:Un(D,gh,$==null?void 0:$.description,(c=h==null?void 0:h.classNames)==null?void 0:c.description)},typeof h.description=="function"?h.description():h.description):null),E.isValidElement(h.cancel)?h.cancel:h.cancel&&jh(h.cancel)?F.createElement("button",{"data-button":!0,"data-cancel":!0,style:h.cancelButtonStyle||C,onClick:Te=>{var Je,yt;jh(h.cancel)&&Ki&&((yt=(Je=h.cancel).onClick)==null||yt.call(Je,Te),Ls())},className:Un($==null?void 0:$.cancelButton,(u=h==null?void 0:h.classNames)==null?void 0:u.cancelButton)},h.cancel.label):null,E.isValidElement(h.action)?h.action:h.action&&jh(h.action)?F.createElement("button",{"data-button":!0,"data-action":!0,style:h.actionButtonStyle||O,onClick:Te=>{var Je,yt;jh(h.action)&&((yt=(Je=h.action).onClick)==null||yt.call(Je,Te),!Te.defaultPrevented&&Ls())},className:Un($==null?void 0:$.actionButton,(d=h==null?void 0:h.classNames)==null?void 0:d.actionButton)},h.action.label):null))};function GA(){if(typeof window>"u"||typeof document>"u")return"ltr";let t=document.documentElement.getAttribute("dir");return t==="auto"||!t?window.getComputedStyle(document.documentElement).direction:t}function $W(t,e){let r={};return[t,e].forEach((n,i)=>{let s=i===1,a=s?"--mobile-offset":"--offset",o=s?OW:CW;function l(c){["top","right","bottom","left"].forEach(u=>{r[`${a}-${u}`]=typeof c=="number"?`${c}px`:c})}typeof n=="number"||typeof n=="string"?l(n):typeof n=="object"?["top","right","bottom","left"].forEach(c=>{n[c]===void 0?r[`${a}-${c}`]=o:r[`${a}-${c}`]=typeof n[c]=="number"?`${n[c]}px`:n[c]}):l(o)}),r}var jW=E.forwardRef(function(t,e){let{invert:r,position:n="bottom-right",hotkey:i=["altKey","KeyT"],expand:s,closeButton:a,className:o,offset:l,mobileOffset:c,theme:u="light",richColors:d,duration:f,style:h,visibleToasts:p=IW,toastOptions:g,dir:m=GA(),gap:v=kW,loadingIcon:y,icons:b,containerAriaLabel:w="Notifications",pauseWhenPageIsHidden:S}=t,[T,_]=F.useState([]),A=F.useMemo(()=>Array.from(new Set([n].concat(T.filter(B=>B.position).map(B=>B.position)))),[T,n]),[P,C]=F.useState([]),[O,R]=F.useState(!1),[D,L]=F.useState(!1),[j,M]=F.useState(u!=="system"?u:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),N=F.useRef(null),k=i.join("+").replace(/Key/g,"").replace(/Digit/g,""),$=F.useRef(null),U=F.useRef(!1),G=F.useCallback(B=>{_(K=>{var ee;return(ee=K.find(H=>H.id===B.id))!=null&&ee.delete||Fr.dismiss(B.id),K.filter(({id:H})=>H!==B.id)})},[]);return F.useEffect(()=>Fr.subscribe(B=>{if(B.dismiss){_(K=>K.map(ee=>ee.id===B.id?{...ee,delete:!0}:ee));return}setTimeout(()=>{$N.flushSync(()=>{_(K=>{let ee=K.findIndex(H=>H.id===B.id);return ee!==-1?[...K.slice(0,ee),{...K[ee],...B},...K.slice(ee+1)]:[B,...K]})})})}),[]),F.useEffect(()=>{if(u!=="system"){M(u);return}if(u==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?M("dark"):M("light")),typeof window>"u")return;let B=window.matchMedia("(prefers-color-scheme: dark)");try{B.addEventListener("change",({matches:K})=>{M(K?"dark":"light")})}catch{B.addListener(({matches:ee})=>{try{M(ee?"dark":"light")}catch(H){console.error(H)}})}},[u]),F.useEffect(()=>{T.length<=1&&R(!1)},[T]),F.useEffect(()=>{let B=K=>{var ee,H;i.every(J=>K[J]||K.code===J)&&(R(!0),(ee=N.current)==null||ee.focus()),K.code==="Escape"&&(document.activeElement===N.current||(H=N.current)!=null&&H.contains(document.activeElement))&&R(!1)};return document.addEventListener("keydown",B),()=>document.removeEventListener("keydown",B)},[i]),F.useEffect(()=>{if(N.current)return()=>{$.current&&($.current.focus({preventScroll:!0}),$.current=null,U.current=!1)}},[N.current]),F.createElement("section",{ref:e,"aria-label":`${w} ${k}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},A.map((B,K)=>{var ee;let[H,J]=B.split("-");return T.length?F.createElement("ol",{key:B,dir:m==="auto"?GA():m,tabIndex:-1,ref:N,className:o,"data-sonner-toaster":!0,"data-theme":j,"data-y-position":H,"data-lifted":O&&T.length>1&&!s,"data-x-position":J,style:{"--front-toast-height":`${((ee=P[0])==null?void 0:ee.height)||0}px`,"--width":`${RW}px`,"--gap":`${v}px`,...h,...$W(l,c)},onBlur:q=>{U.current&&!q.currentTarget.contains(q.relatedTarget)&&(U.current=!1,$.current&&($.current.focus({preventScroll:!0}),$.current=null))},onFocus:q=>{q.target instanceof HTMLElement&&q.target.dataset.dismissible==="false"||U.current||(U.current=!0,$.current=q.relatedTarget)},onMouseEnter:()=>R(!0),onMouseMove:()=>R(!0),onMouseLeave:()=>{D||R(!1)},onDragEnd:()=>R(!1),onPointerDown:q=>{q.target instanceof HTMLElement&&q.target.dataset.dismissible==="false"||L(!0)},onPointerUp:()=>L(!1)},T.filter(q=>!q.position&&K===0||q.position===B).map((q,ie)=>{var Z,re;return F.createElement(MW,{key:q.id,icons:b,index:ie,toast:q,defaultRichColors:d,duration:(Z=g==null?void 0:g.duration)!=null?Z:f,className:g==null?void 0:g.className,descriptionClassName:g==null?void 0:g.descriptionClassName,invert:r,visibleToasts:p,closeButton:(re=g==null?void 0:g.closeButton)!=null?re:a,interacting:D,position:B,style:g==null?void 0:g.style,unstyled:g==null?void 0:g.unstyled,classNames:g==null?void 0:g.classNames,cancelButtonStyle:g==null?void 0:g.cancelButtonStyle,actionButtonStyle:g==null?void 0:g.actionButtonStyle,removeToast:G,toasts:T.filter(ne=>ne.position==q.position),heights:P.filter(ne=>ne.position==q.position),setHeights:C,expandByDefault:s,gap:v,loadingIcon:y,expanded:O,pauseWhenPageIsHidden:S,swipeDirections:t.swipeDirections})})):null}))});const FW=({...t})=>{const{theme:e="system"}=dW();return x.jsx(jW,{theme:e,className:"toaster group",toastOptions:{classNames:{toast:"group toast group-[.toaster]:bg-background group-[.toaster]:text-foreground group-[.toaster]:border-border group-[.toaster]:shadow-lg",description:"group-[.toast]:text-muted-foreground",actionButton:"group-[.toast]:bg-primary group-[.toast]:text-primary-foreground",cancelButton:"group-[.toast]:bg-muted group-[.toast]:text-muted-foreground"}},...t})};var BW=Yg[" useId ".trim().toString()]||(()=>{}),UW=0;function tu(t){const[e,r]=E.useState(BW());return br(()=>{r(n=>n??String(UW++))},[t]),e?`radix-${e}
181`:""}const GW=["top","right","bottom","left"],Sa=Math.min,sn=Math.max,_m=Math.round,Fh=Math.floor,Di=t=>({x:t,y:t}),WW={left:"right",right:"left",bottom:"top",top:"bottom"};function Mx(t,e,r){return sn(t,Sa(e,r))}function bs(t,e){return typeof t=="function"?t(e):t}function xs(t){return t.split("-")[0]}function ru(t){return t.split("-")[1]}function rT(t){return t==="x"?"y":"x"}function nT(t){return t==="y"?"height":"width"}function Pi(t){const e=t[0];return e==="t"||e==="b"?"y":"x"}function iT(t){return rT(Pi(t))}function VW(t,e,r){r===void 0&&(r=!1);const n=ru(t),i=iT(t),s=nT(i);let a=i==="x"?n===(r?"end":"start")?"right":"left":n==="start"?"bottom":"top";return e.reference[s]>e.floating[s]&&(a=Am(a)),[a,Am(a)]}function HW(t){const e=Am(t);return[$x(t),e,$x(e)]}function $x(t){return t.includes("start")?t.replace("start","end"):t.replace("end","start")}const WA=["left","right"],VA=["right","left"],KW=["top","bottom"],zW=["bottom","top"];function qW(t,e,r){switch(t){case"top":case"bottom":return r?e?VA:WA:e?WA:VA;case"left":case"right":return e?KW:zW;default:return[]}}function YW(t,e,r,n){const i=ru(t);let s=qW(xs(t),r==="start",n);return i&&(s=s.map(a=>a+"-"+i),e&&(s=s.concat(s.map($x)))),s}function Am(t){const e=xs(t);return WW[e]+t.slice(e.length)}function XW(t){return{top:0,right:0,bottom:0,left:0,...t}}function IM(t){return typeof t!="number"?XW(t):{top:t,right:t,bottom:t,left:t}}function Pm(t){const{x:e,y:r,width:n,height:i}=t;return{width:n,height:i,top:r,left:e,right:e+n,bottom:r+i,x:e,y:r}}function HA(t,e,r){let{reference:n,floating:i}=t;const s=Pi(e),a=iT(e),o=nT(a),l=xs(e),c=s==="y",u=n.x+n.width/2-i.width/2,d=n.y+n.height/2-i.height/2,f=n[o]/2-i[o]/2;let h;switch(l){case"top":h={x:u,y:n.y-i.height};break;case"bottom":h={x:u,y:n.y+n.height};break;case"right":h={x:n.x+n.width,y:d};break;case"left":h={x:n.x-i.width,y:d};break;default:h={x:n.x,y:n.y}}switch(ru(e)){case"start":h[a]-=f*(r&&c?-1:1);break;case"end":h[a]+=f*(r&&c?-1:1);break}return h}async function QW(t,e){var r;e===void 0&&(e={});const{x:n,y:i,platform:s,rects:a,elements:o,strategy:l}=t,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:d="floating",altBoundary:f=!1,padding:h=0}=bs(e,t),p=IM(h),m=o[f?d==="floating"?"reference":"floating":d],v=Pm(await s.getClippingRect({element:(r=await(s.isElement==null?void 0:s.isElement(m)))==null||r?m:m.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(o.floating)),boundary:c,rootBoundary:u,strategy:l})),y=d==="floating"?{x:n,y:i,width:a.floating.width,height:a.floating.height}:a.reference,b=await(s.getOffsetParent==null?void 0:s.getOffsetParent(o.floating)),w=await(s.isElement==null?void 0:s.isElement(b))?await(s.getScale==null?void 0:s.getScale(b))||{x:1,y:1}:{x:1,y:1},S=Pm(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:y,offsetParent:b,strategy:l}):y);return{top:(v.top-S.top+p.top)/w.y,bottom:(S.bottom-v.bottom+p.bottom)/w.y,left:(v.left-S.left+p.left)/w.x,right:(S.right-v.right+p.right)/w.x}}const JW=50,ZW=async(t,e,r)=>{const{placement:n="bottom",strategy:i="absolute",middleware:s=[],platform:a}=r,o=a.detectOverflow?a:{...a,detectOverflow:QW},l=await(a.isRTL==null?void 0:a.isRTL(e));let c=await a.getElementRects({reference:t,floating:e,strategy:i}),{x:u,y:d}=HA(c,n,l),f=n,h=0;const p={};for(let g=0;g<s.length;g++){const m=s[g];if(!m)continue;const{name:v,fn:y}=m,{x:b,y:w,data:S,reset:T}=await y({x:u,y:d,initialPlacement:n,placement:f,strategy:i,middlewareData:p,rects:c,platform:o,elements:{reference:t,floating:e}});u=b??u,d=w??d,p[v]={...p[v],...S},T&&h<JW&&(h++,typeof T=="object"&&(T.placement&&(f=T.placement),T.rects&&(c=T.rects===!0?await a.getElementRects({reference:t,floating:e,strategy:i}):T.rects),{x:u,y:d}=HA(c,f,l)),g=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:p}},eV=t=>({name:"arrow",options:t,async fn(e){const{x:r,y:n,placement:i,rects:s,platform:a,elements:o,middlewareData:l}=e,{element:c,padding:u=0}=bs(t,e)||{};if(c==null)return{};const d=IM(u),f={x:r,y:n},h=iT(i),p=nT(h),g=await a.getDimensions(c),m=h==="y",v=m?"top":"left",y=m?"bottom":"right",b=m?"clientHeight":"clientWidth",w=s.reference[p]+s.reference[h]-f[h]-s.floating[p],S=f[h]-s.reference[h],T=await(a.getOffsetParent==null?void 0:a.getOffsetParent(c));let _=T?T[b]:0;(!_||!await(a.isElement==null?void 0:a.isElement(T)))&&(_=o.floating[b]||s.floating[p]);const A=w/2-S/2,P=_/2-g[p]/2-1,C=Sa(d[v],P),O=Sa(d[y],P),R=C,D=_-g[p]-O,L=_/2-g[p]/2+A,j=Mx(R,L,D),M=!l.arrow&&ru(i)!=null&&L!==j&&s.reference[p]/2-(L<R?C:O)-g[p]/2<0,N=M?L<R?L-R:L-D:0;return{[h]:f[h]+N,data:{[h]:j,centerOffset:L-j-N,...M&&{alignmentOffset:N}},reset:M}}}),tV=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var r,n;const{placement:i,middlewareData:s,rects:a,initialPlacement:o,platform:l,elements:c}=e,{mainAxis:u=!0,crossAxis:d=!0,fallbackPlacements:f,fallbackStrategy:h="bestFit",fallbackAxisSideDirection:p="none",flipAlignment:g=!0,...m}=bs(t,e);if((r=s.arrow)!=null&&r.alignmentOffset)return{};
vendor: 5,570 bytes, line 181
181const v=xs(i),y=Pi(o),b=xs(o)===o,w=await(l.isRTL==null?void 0:l.isRTL(c.floating)),S=f||(b||!g?[Am(o)]:HW(o)),T=p!=="none";!f&&T&&S.push(...YW(o,g,p,w));const _=[o,...S],A=await l.detectOverflow(e,m),P=[];let C=((n=s.flip)==null?void 0:n.overflows)||[];if(u&&P.push(A[v]),d){const L=VW(i,a,w);P.push(A[L[0]],A[L[1]])}if(C=[...C,{placement:i,overflows:P}],!P.every(L=>L<=0)){var O,R;const L=(((O=s.flip)==null?void 0:O.index)||0)+1,j=_[L];if(j&&(!(d==="alignment"?y!==Pi(j):!1)||C.every(k=>Pi(k.placement)===y?k.overflows[0]>0:!0)))return{data:{index:L,overflows:C},reset:{placement:j}};let M=(R=C.filter(N=>N.overflows[0]<=0).sort((N,k)=>N.overflows[1]-k.overflows[1])[0])==null?void 0:R.placement;if(!M)switch(h){case"bestFit":{var D;const N=(D=C.filter(k=>{if(T){const $=Pi(k.placement);return $===y||$==="y"}return!0}).map(k=>[k.placement,k.overflows.filter($=>$>0).reduce(($,U)=>$+U,0)]).sort((k,$)=>k[1]-$[1])[0])==null?void 0:D[0];N&&(M=N);break}case"initialPlacement":M=o;break}if(i!==M)return{reset:{placement:M}}}return{}}}};function KA(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function zA(t){return GW.some(e=>t[e]>=0)}const rV=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){const{rects:r,platform:n}=e,{strategy:i="referenceHidden",...s}=bs(t,e);switch(i){case"referenceHidden":{const a=await n.detectOverflow(e,{...s,elementContext:"reference"}),o=KA(a,r.reference);return{data:{referenceHiddenOffsets:o,referenceHidden:zA(o)}}}case"escaped":{const a=await n.detectOverflow(e,{...s,altBoundary:!0}),o=KA(a,r.floating);return{data:{escapedOffsets:o,escaped:zA(o)}}}default:return{}}}}},CM=new Set(["left","top"]);async function nV(t,e){const{placement:r,platform:n,elements:i}=t,s=await(n.isRTL==null?void 0:n.isRTL(i.floating)),a=xs(r),o=ru(r),l=Pi(r)==="y",c=CM.has(a)?-1:1,u=s&&l?-1:1,d=bs(e,t);let{mainAxis:f,crossAxis:h,alignmentAxis:p}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return o&&typeof p=="number"&&(h=o==="end"?p*-1:p),l?{x:h*u,y:f*c}:{x:f*c,y:h*u}}const iV=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var r,n;const{x:i,y:s,placement:a,middlewareData:o}=e,l=await nV(e,t);return a===((r=o.offset)==null?void 0:r.placement)&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:i+l.x,y:s+l.y,data:{...l,placement:a}}}}},sV=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:r,y:n,placement:i,platform:s}=e,{mainAxis:a=!0,crossAxis:o=!1,limiter:l={fn:v=>{let{x:y,y:b}=v;return{x:y,y:b}}},...c}=bs(t,e),u={x:r,y:n},d=await s.detectOverflow(e,c),f=Pi(xs(i)),h=rT(f);let p=u[h],g=u[f];if(a){const v=h==="y"?"top":"left",y=h==="y"?"bottom":"right",b=p+d[v],w=p-d[y];p=Mx(b,p,w)}if(o){const v=f==="y"?"top":"left",y=f==="y"?"bottom":"right",b=g+d[v],w=g-d[y];g=Mx(b,g,w)}const m=l.fn({...e,[h]:p,[f]:g});return{...m,data:{x:m.x-r,y:m.y-n,enabled:{[h]:a,[f]:o}}}}}},aV=function(t){return t===void 0&&(t={}),{options:t,fn(e){const{x:r,y:n,placement:i,rects:s,middlewareData:a}=e,{offset:o=0,mainAxis:l=!0,crossAxis:c=!0}=bs(t,e),u={x:r,y:n},d=Pi(i),f=rT(d);let h=u[f],p=u[d];const g=bs(o,e),m=typeof g=="number"?{mainAxis:g,crossAxis:0}:{mainAxis:0,crossAxis:0,...g};if(l){const b=f==="y"?"height":"width",w=s.reference[f]-s.floating[b]+m.mainAxis,S=s.reference[f]+s.reference[b]-m.mainAxis;h<w?h=w:h>S&&(h=S)}if(c){var v,y;const b=f==="y"?"width":"height",w=CM.has(xs(i)),S=s.reference[d]-s.floating[b]+(w&&((v=a.offset)==null?void 0:v[d])||0)+(w?0:m.crossAxis),T=s.reference[d]+s.reference[b]+(w?0:((y=a.offset)==null?void 0:y[d])||0)-(w?m.crossAxis:0);p<S?p=S:p>T&&(p=T)}return{[f]:h,[d]:p}}}},oV=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(e){var r,n;const{placement:i,rects:s,platform:a,elements:o}=e,{apply:l=()=>{},...c}=bs(t,e),u=await a.detectOverflow(e,c),d=xs(i),f=ru(i),h=Pi(i)==="y",{width:p,height:g}=s.floating;let m,v;d==="top"||d==="bottom"?(m=d,v=f===(await(a.isRTL==null?void 0:a.isRTL(o.floating))?"start":"end")?"left":"right"):(v=d,m=f==="end"?"top":"bottom");const y=g-u.top-u.bottom,b=p-u.left-u.right,w=Sa(g-u[m],y),S=Sa(p-u[v],b),T=!e.middlewareData.shift;let _=w,A=S;if((r=e.middlewareData.shift)!=null&&r.enabled.x&&(A=b),(n=e.middlewareData.shift)!=null&&n.enabled.y&&(_=y),T&&!f){const C=sn(u.left,0),O=sn(u.right,0),R=sn(u.top,0),D=sn(u.bottom,0);h?A=p-2*(C!==0||O!==0?C+O:sn(u.left,u.right)):_=g-2*(R!==0||D!==0?R+D:sn(u.top,u.bottom))}await l({...e,availableWidth:A,availableHeight:_});const P=await a.getDimensions(o.floating);return p!==P.width||g!==P.height?{reset:{rects:!0}}:{}}}};function mv(){return typeof window<"u"}function nu(t){return OM(t)?(t.nodeName||"").toLowerCase():"#document"}function fn(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function Wi(t){var e;return(e=(OM(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function OM(t){return mv()?t instanceof Node||t instanceof fn(t).Node:!1}function ui(t){return mv()?t instanceof Element||t instanceof fn(t).Element:!1}function As(t){return mv()?t instanceof HTMLElement||t instanceof fn(t).HTMLElement:!1}function qA(t){return!mv()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof fn(t).ShadowRoot}function th(t){const{overflow:e,overflowX:r,overflowY:n,display:i}=di(t);return/auto|scroll|overlay|hidden|clip/.test(e+n+r)&&i!=="inline"&&i!=="contents"}function lV(t){return/^(table|td|th)$/.test(nu(t))}
181function gv(t){try{if(t.matches(":popover-open"))return!0}catch{}try{return t.matches(":modal")}catch{return!1}}const cV=/transform|translate|scale|rotate|perspective|filter/,uV=/paint|layout|strict|content/,Wa=t=>!!t&&t!=="none";let c0;function sT(t){const e=ui(t)?di(t):t;return Wa(e.transform)||Wa(e.translate)||Wa(e.scale)||Wa(e.rotate)||Wa(e.perspective)||!aT()&&(Wa(e.backdropFilter)||Wa(e.filter))||cV.test(e.willChange||"")||uV.test(e.contain||"")}function dV(t){let e=Ea(t);for(;As(e)&&!Sc(e);){if(sT(e))return e;if(gv(e))return null;e=Ea(e)}return null}function aT(){return c0==null&&(c0=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),c0}function Sc(t){return/^(html|body|#document)$/.test(nu(t))}function di(t){return fn(t).getComputedStyle(t)}function vv(t){return ui(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function Ea(t){if(nu(t)==="html")return t;const e=t.assignedSlot||t.parentNode||qA(t)&&t.host||Wi(t);return qA(e)?e.host:e}function RM(t){const e=Ea(t);return Sc(e)?t.ownerDocument?t.ownerDocument.body:t.body:As(e)&&th(e)?e:RM(e)}function Ud(t,e,r){var n;e===void 0&&(e=[]),r===void 0&&(r=!0);const i=RM(t),s=i===((n=t.ownerDocument)==null?void 0:n.body),a=fn(i);if(s){const o=jx(a);return e.concat(a,a.visualViewport||[],th(i)?i:[],o&&r?Ud(o):[])}else return e.concat(i,Ud(i,[],r))}function jx(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function kM(t){const e=di(t);let r=parseFloat(e.width)||0,n=parseFloat(e.height)||0;const i=As(t),s=i?t.offsetWidth:r,a=i?t.offsetHeight:n,o=_m(r)!==s||_m(n)!==a;return o&&(r=s,n=a),{width:r,height:n,$:o}}function oT(t){return ui(t)?t:t.contextElement}function Yl(t){const e=oT(t);if(!As(e))return Di(1);const r=e.getBoundingClientRect(),{width:n,height:i,$:s}=kM(e);let a=(s?_m(r.width):r.width)/n,o=(s?_m(r.height):r.height)/i;return(!a||!Number.isFinite(a))&&(a=1),(!o||!Number.isFinite(o))&&(o=1),{x:a,y:o}}const fV=Di(0);function LM(t){const e=fn(t);
vendor: 15,705 bytes, line 181
181return!aT()||!e.visualViewport?fV:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function hV(t,e,r){return e===void 0&&(e=!1),!r||e&&r!==fn(t)?!1:e}function Mo(t,e,r,n){e===void 0&&(e=!1),r===void 0&&(r=!1);const i=t.getBoundingClientRect(),s=oT(t);let a=Di(1);e&&(n?ui(n)&&(a=Yl(n)):a=Yl(t));const o=hV(s,r,n)?LM(s):Di(0);let l=(i.left+o.x)/a.x,c=(i.top+o.y)/a.y,u=i.width/a.x,d=i.height/a.y;if(s){const f=fn(s),h=n&&ui(n)?fn(n):n;let p=f,g=jx(p);for(;g&&n&&h!==p;){const m=Yl(g),v=g.getBoundingClientRect(),y=di(g),b=v.left+(g.clientLeft+parseFloat(y.paddingLeft))*m.x,w=v.top+(g.clientTop+parseFloat(y.paddingTop))*m.y;l*=m.x,c*=m.y,u*=m.x,d*=m.y,l+=b,c+=w,p=fn(g),g=jx(p)}}return Pm({width:u,height:d,x:l,y:c})}function yv(t,e){const r=vv(t).scrollLeft;return e?e.left+r:Mo(Wi(t)).left+r}function DM(t,e){const r=t.getBoundingClientRect(),n=r.left+e.scrollLeft-yv(t,r),i=r.top+e.scrollTop;return{x:n,y:i}}function pV(t){let{elements:e,rect:r,offsetParent:n,strategy:i}=t;const s=i==="fixed",a=Wi(n),o=e?gv(e.floating):!1;if(n===a||o&&s)return r;let l={scrollLeft:0,scrollTop:0},c=Di(1);const u=Di(0),d=As(n);if((d||!d&&!s)&&((nu(n)!=="body"||th(a))&&(l=vv(n)),d)){const h=Mo(n);c=Yl(n),u.x=h.x+n.clientLeft,u.y=h.y+n.clientTop}const f=a&&!d&&!s?DM(a,l):Di(0);return{width:r.width*c.x,height:r.height*c.y,x:r.x*c.x-l.scrollLeft*c.x+u.x+f.x,y:r.y*c.y-l.scrollTop*c.y+u.y+f.y}}function mV(t){return Array.from(t.getClientRects())}function gV(t){const e=Wi(t),r=vv(t),n=t.ownerDocument.body,i=sn(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),s=sn(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight);let a=-r.scrollLeft+yv(t);const o=-r.scrollTop;return di(n).direction==="rtl"&&(a+=sn(e.clientWidth,n.clientWidth)-i),{width:i,height:s,x:a,y:o}}const YA=25;function vV(t,e){const r=fn(t),n=Wi(t),i=r.visualViewport;let s=n.clientWidth,a=n.clientHeight,o=0,l=0;if(i){s=i.width,a=i.height;const u=aT();(!u||u&&e==="fixed")&&(o=i.offsetLeft,l=i.offsetTop)}const c=yv(n);if(c<=0){const u=n.ownerDocument,d=u.body,f=getComputedStyle(d),h=u.compatMode==="CSS1Compat"&&parseFloat(f.marginLeft)+parseFloat(f.marginRight)||0,p=Math.abs(n.clientWidth-d.clientWidth-h);p<=YA&&(s-=p)}else c<=YA&&(s+=c);return{width:s,height:a,x:o,y:l}}function yV(t,e){const r=Mo(t,!0,e==="fixed"),n=r.top+t.clientTop,i=r.left+t.clientLeft,s=As(t)?Yl(t):Di(1),a=t.clientWidth*s.x,o=t.clientHeight*s.y,l=i*s.x,c=n*s.y;return{width:a,height:o,x:l,y:c}}function XA(t,e,r){let n;if(e==="viewport")n=vV(t,r);else if(e==="document")n=gV(Wi(t));else if(ui(e))n=yV(e,r);else{const i=LM(t);n={x:e.x-i.x,y:e.y-i.y,width:e.width,height:e.height}}return Pm(n)}function NM(t,e){const r=Ea(t);return r===e||!ui(r)||Sc(r)?!1:di(r).position==="fixed"||NM(r,e)}function bV(t,e){const r=e.get(t);if(r)return r;let n=Ud(t,[],!1).filter(o=>ui(o)&&nu(o)!=="body"),i=null;const s=di(t).position==="fixed";let a=s?Ea(t):t;for(;ui(a)&&!Sc(a);){const o=di(a),l=sT(a);!l&&o.position==="fixed"&&(i=null),(s?!l&&!i:!l&&o.position==="static"&&!!i&&(i.position==="absolute"||i.position==="fixed")||th(a)&&!l&&NM(t,a))?n=n.filter(u=>u!==a):i=o,a=Ea(a)}return e.set(t,n),n}function xV(t){let{element:e,boundary:r,rootBoundary:n,strategy:i}=t;const a=[...r==="clippingAncestors"?gv(e)?[]:bV(e,this._c):[].concat(r),n],o=XA(e,a[0],i);let l=o.top,c=o.right,u=o.bottom,d=o.left;for(let f=1;f<a.length;f++){const h=XA(e,a[f],i);l=sn(h.top,l),c=Sa(h.right,c),u=Sa(h.bottom,u),d=sn(h.left,d)}return{width:c-d,height:u-l,x:d,y:l}}function wV(t){const{width:e,height:r}=kM(t);return{width:e,height:r}}function SV(t,e,r){const n=As(e),i=Wi(e),s=r==="fixed",a=Mo(t,!0,s,e);let o={scrollLeft:0,scrollTop:0};const l=Di(0);function c(){l.x=yv(i)}if(n||!n&&!s)if((nu(e)!=="body"||th(i))&&(o=vv(e)),n){const h=Mo(e,!0,s,e);l.x=h.x+e.clientLeft,l.y=h.y+e.clientTop}else i&&c();s&&!n&&i&&c();const u=i&&!n&&!s?DM(i,o):Di(0),d=a.left+o.scrollLeft-l.x-u.x,f=a.top+o.scrollTop-l.y-u.y;return{x:d,y:f,width:a.width,height:a.height}}function u0(t){return di(t).position==="static"}function QA(t,e){if(!As(t)||di(t).position==="fixed")return null;if(e)return e(t);let r=t.offsetParent;return Wi(t)===r&&(r=r.ownerDocument.body),r}function MM(t,e){const r=fn(t);if(gv(t))return r;if(!As(t)){let i=Ea(t);for(;i&&!Sc(i);){if(ui(i)&&!u0(i))return i;i=Ea(i)}return r}let n=QA(t,e);for(;n&&lV(n)&&u0(n);)n=QA(n,e);return n&&Sc(n)&&u0(n)&&!sT(n)?r:n||dV(t)||r}const EV=async function(t){const e=this.getOffsetParent||MM,r=this.getDimensions,n=await r(t.floating);return{reference:SV(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:n.width,height:n.height}}};function TV(t){return di(t).direction==="rtl"}const _V={convertOffsetParentRelativeRectToViewportRelativeRect:pV,getDocumentElement:Wi,getClippingRect:xV,getOffsetParent:MM,getElementRects:EV,getClientRects:mV,getDimensions:wV,getScale:Yl,isElement:ui,isRTL:TV};function $M(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function AV(t,e){let r=null,n;const i=Wi(t);function s(){var o;clearTimeout(n),(o=r)==null||o.disconnect(),r=null}function a(o,l){o===void 0&&(o=!1),l===void 0&&(l=1),s();const c=t.getBoundingClientRect(),{left:u,top:d,width:f,height:h}=c;if(o||e(),!f||!h)return;const p=Fh(d),g=Fh(i.clientWidth-(u+f)),m=Fh(i.clientHeight-(d+h)),v=Fh(u),b={rootMargin:-p+"px "+-g+"px "+-m+"px "+-v+"px",threshold:sn(0,Sa(1,l))||1};let w=!0;function S(T){const _=T[0].intersectionRatio;if(_!==l){if(!w)return a();_?a(!1,_):n=setTimeout(()=>{a(!1,1e-7)},1e3)}_===1&&!$M(c,t.getBoundingClientRect())&&a(),w=!1}try{r=new IntersectionObserver(S,{...b,root:i.ownerDocument})}catch{r=new IntersectionObserver(S,b)}r.observe(t)}return a(!0),s}function PV(t,e,r,n){n===void 0&&(n={});const{ancestorScroll:i=!0,ancestorResize:s=!0,elementResize:a=typeof ResizeObserver=="function",layoutShift:o=typeof IntersectionObserver=="function",animationFrame:l=!1}=n,c=oT(t),u=i||s?[...c?Ud(c):[],...e?Ud(e):[]]:[];u.forEach(v=>{i&&v.addEventListener("scroll",r,{passive:!0}),s&&v.addEventListener("resize",r)});const d=c&&o?AV(c,r):null;let f=-1,h=null;a&&(h=new ResizeObserver(v=>{let[y]=v;y&&y.target===c&&h&&e&&(h.unobserve(e),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var b;(b=h)==null||b.observe(e)})),r()}),c&&!l&&h.observe(c),e&&h.observe(e));let p,g=l?Mo(t):null;l&&m();function m(){const v=Mo(t);g&&!$M(g,v)&&r(),g=v,p=requestAnimationFrame(m)}return r(),()=>{var v;u.forEach(y=>{i&&y.removeEventListener("scroll",r),s&&y.removeEventListener("resize",r)}),d==null||d(),(v=h)==null||v.disconnect(),h=null,l&&cancelAnimationFrame(p)}}const IV=iV,CV=sV,OV=tV,RV=oV,kV=rV,JA=eV,LV=aV,DV=(t,e,r)=>{const n=new Map,i={platform:_V,...r},s={...i.platform,_c:n};return ZW(t,e,{...i,platform:s})};var NV=typeof document<"u",MV=function(){},Bp=NV?E.useLayoutEffect:MV;function Im(t,e){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(typeof t=="function"&&t.toString()===e.toString())return!0;let r,n,i;if(t&&e&&typeof t=="object"){if(Array.isArray(t)){if(r=t.length,r!==e.length)return!1;for(n=r;n--!==0;)if(!Im(t[n],e[n]))return!1;return!0}if(i=Object.keys(t),r=i.length,r!==Object.keys(e).length)return!1;for(n=r;n--!==0;)if(!{}.hasOwnProperty.call(e,i[n]))return!1;for(n=r;n--!==0;){const s=i[n];if(!(s==="_owner"&&t.$$typeof)&&!Im(t[s],e[s]))return!1}return!0}return t!==t&&e!==e}function jM(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function ZA(t,e){const r=jM(t);return Math.round(e*r)/r}function d0(t){const e=E.useRef(t);return Bp(()=>{e.current=t}),e}function $V(t){t===void 0&&(t={});const{placement:e="bottom",strategy:r="absolute",middleware:n=[],platform:i,elements:{reference:s,floating:a}={},transform:o=!0,whileElementsMounted:l,open:c}=t,[u,d]=E.useState({x:0,y:0,strategy:r,placement:e,middlewareData:{},isPositioned:!1}),[f,h]=E.useState(n);Im(f,n)||h(n);const[p,g]=E.useState(null),[m,v]=E.useState(null),y=E.useCallback(k=>{k!==T.current&&(T.current=k,g(k))},[]),b=E.useCallback(k=>{k!==_.current&&(_.current=k,v(k))},[]),w=s||p,S=a||m,T=E.useRef(null),_=E.useRef(null),A=E.useRef(u),P=l!=null,C=d0(l),O=d0(i),R=d0(c),D=E.useCallback(()=>{if(!T.current||!_.current)return;const k={placement:e,strategy:r,middleware:f};O.current&&(k.platform=O.current),DV(T.current,_.current,k).then($=>{const U={...$,isPositioned:R.current!==!1};L.current&&!Im(A.current,U)&&(A.current=U,qo.flushSync(()=>{d(U)}))})},[f,e,r,O,R]);Bp(()=>{c===!1&&A.current.isPositioned&&(A.current.isPositioned=!1,d(k=>({...k,isPositioned:!1})))},[c]);const L=E.useRef(!1);Bp(()=>(L.current=!0,()=>{L.current=!1}),[]),Bp(()=>{if(w&&(T.current=w),S&&(_.current=S),w&&S){if(C.current)return C.current(w,S,D);D()}},[w,S,D,C,P]);const j=E.useMemo(()=>({reference:T,floating:_,setReference:y,setFloating:b}),[y,b]),M=E.useMemo(()=>({reference:w,floating:S}),[w,S]),N=E.useMemo(()=>{const k={position:r,left:0,top:0};if(!M.floating)return k;const $=ZA(M.floating,u.x),U=ZA(M.floating,u.y);return o?{...k,transform:"translate("+$+"px, "+U+"px)",...jM(M.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:$,top:U}},[r,o,M.floating,u.x,u.y]);return E.useMemo(()=>({...u,update:D,refs:j,elements:M,floatingStyles:N}),[u,D,j,M,N])}const jV=t=>{function e(r){return{}.hasOwnProperty.call(r,"current")}return{name:"arrow",options:t,fn(r){const{element:n,padding:i}=typeof t=="function"?t(r):t;return n&&e(n)?n.current!=null?JA({element:n.current,padding:i}).fn(r):{}:n?JA({element:n,padding:i}).fn(r):{}}}},FV=(t,e)=>{const r=IV(t);return{name:r.name,fn:r.fn,options:[t,e]}},BV=(t,e)=>{const r=CV(t);return{name:r.name,fn:r.fn,options:[t,e]}},UV=(t,e)=>({fn:LV(t).fn,options:[t,e]}),GV=(t,e)=>{const r=OV(t);return{name:r.name,fn:r.fn,options:[t,e]}},WV=(t,e)=>{const r=RV(t);return{name:r.name,fn:r.fn,options:[t,e]}},VV=(t,e)=>{const r=kV(t);return{name:r.name,fn:r.fn,options:[t,e]}},HV=(t,e)=>{const r=jV(t);return{name:r.name,fn:r.fn,options:[t,e]}};var KV="Arrow",FM=E.forwardRef((t,e)=>{const{children:r,width:n=10,height:i=5,...s}=t;return x.jsx(ke.svg,{...s,ref:e,width:n,height:i,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?r:x.jsx("polygon",{points:"0,0 30,0 15,10"})})});FM.displayName=KV;var zV=FM;function qV(t){const[e,r]=E.useState(void 0);return br(()=>{if(t){r({width:t.offsetWidth,height:t.offsetHeight});const n=new ResizeObserver(i=>{if(!Array.isArray(i)||!i.length)return;const s=i[0];let a,o;if("borderBoxSize"in s){const l=s.borderBoxSize,c=Array.isArray(l)?l[0]:l;a=c.inlineSize,o=c.blockSize}else a=t.offsetWidth,o=t.offsetHeight;r({width:a,height:o})});return n.observe(t,{box:"border-box"}),()=>n.unobserve(t)}else r(void 0)},[t]),e}var lT="Popper",[BM,iu]=Oa(lT),[YV,UM]=BM(lT),GM=t=>{const{__scopePopper:e,children:r}=t,[n,i]=E.useState(null);return x.jsx(YV,{scope:e,anchor:n,onAnchorChange:i,children:r})};GM.displayName=lT;var WM="PopperAnchor",VM=E.forwardRef((t,e)=>{const{__scopePopper:r,virtualRef:n,...i}=t,s=UM(WM,r),a=E.useRef(null),o=vt(e,a),l=E.useRef(null);return E.useEffect(()=>{const c=l.current;l.current=(n==null?void 0:n.current)||a.current,c!==l.current&&s.onAnchorChange(l.current)}),n?null:x.jsx(ke.div,{...i,ref:o})});VM.displayName=WM;var cT="PopperContent",[XV,QV]=BM(cT),HM=E.forwardRef((t,e)=>{var q,ie,Z,re,ne,z;const{__scopePopper:r,side:n="bottom",sideOffset:i=0,align:s="center",alignOffset:a=0,arrowPadding:o=0,avoidCollisions:l=!0,collisionBoundary:c=[],collisionPadding:u=0,sticky:d="partial",hideWhenDetached:f=!1,updatePositionStrategy:h="optimized",onPlaced:p,...g}=t,m=UM(cT,r),[v,y]=E.useState(null),b=vt(e,Ee=>y(Ee)),[w,S]=E.useState(null),T=qV(w),_=(T==null?void 0:T.width)??0,A=(T==null?void 0:T.height)??0,P=n+(s!=="center"?"-"+s:""),C=typeof u=="number"?u:{top:0,right:0,bottom:0,left:0,...u},O=Array.isArray(c)?c:[c],R=O.length>0,D={padding:C,boundary:O.filter(ZV),altBoundary:R},{refs:L,floatingStyles:j,placement:M,isPositioned:N,middlewareData:k}=$V({strategy:"fixed",placement:P,whileElementsMounted:(...Ee)=>PV(...Ee,{animationFrame:h==="always"}),elements:{reference:m.anchor},middleware:[FV({mainAxis:i+A,alignmentAxis:a}),l&&BV({mainAxis:!0,crossAxis:!1,limiter:d==="partial"?UV():void 0,...D}),l&&GV({...D}),WV({...D,apply:({elements:Ee,rects:me,availableWidth:Qe,availableHeight:de})=>{const{width:Pe,height:tt}=me.reference,kt=Ee.floating.style;kt.setProperty("--radix-popper-available-width",`${Qe}px`),kt.setProperty("--radix-popper-available-height",`${de}px`),kt.setProperty("--radix-popper-anchor-width",`${Pe}px`),kt.setProperty("--radix-popper-anchor-height",`${tt}px`)}}),w&&HV({element:w,padding:o}),eH({arrowWidth:_,arrowHeight:A}),f&&VV({strategy:"referenceHidden",...D})]}),[$,U]=qM(M),G=Rn(p);br(()=>{N&&(G==null||G())},[N,G]);const B=(q=k.arrow)==null?void 0:q.x,K=(ie=k.arrow)==null?void 0:ie.y,ee=((Z=k.arrow)==null?void 0:Z.centerOffset)!==0,[H,J]=E.useState();return br(()=>{v&&J(window.getComputedStyle(v).zIndex)},[v]),x.jsx("div",{ref:L.setFloating,"data-radix-popper-content-wrapper":"",style:{...j,transform:N?j.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:H,"--radix-popper-transform-origin":[(re=k.transformOrigin)==null?void 0:re.x,(ne=k.transformOrigin)==null?void 0:ne.y].join(" "),...((z=k.hide)==null?void 0:z.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:x.jsx(XV,{scope:r,placedSide:$,onArrowChange:S,arrowX:B,arrowY:K,shouldHideArrow:ee,children:x.jsx(ke.div,{"data-side":$,"data-align":U,...g,ref:b,style:{...g.style,animation:N?void 0:"none"}})})})});HM.displayName=cT;var KM="PopperArrow",JV={top:"bottom",right:"left",bottom:"top",left:"right"},zM=E.forwardRef(function(e,r){const{__scopePopper:n,...i}=e,s=QV(KM,n),a=JV[s.placedSide];return x.jsx("span",{ref:s.onArrowChange,style:{position:"absolute",left:s.arrowX,top:s.arrowY,[a]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[s.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[s.placedSide],visibility:s.shouldHideArrow?"hidden":void 0},children:x.jsx(zV,{...i,ref:r,style:{...i.style,display:"block"}})})});zM.displayName=KM;function ZV(t){return t!==null}var eH=t=>({name:"transformOrigin",options:t,fn(e){var m,v,y;const{placement:r,rects:n,middlewareData:i}=e,a=((m=i.arrow)==null?void 0:m.centerOffset)!==0,o=a?0:t.arrowWidth,l=a?0:t.arrowHeight,[c,u]=qM(r),d={start:"0%",center:"50%",end:"100%"}[u],f=(((v=i.arrow)==null?void 0:v.x)??0)+o/2,h=(((y=i.arrow)==null?void 0:y.y)??0)+l/2;let p="",g="";return c==="bottom"?(p=a?d:`${f}px`,g=`${-l}px`):c==="top"?(p=a?d:`${f}px`,g=`${n.floating.height+l}px`):c==="right"?(p=`${-l}px`,g=a?d:`${h}px`):c==="left"&&(p=`${n.floating.width+l}px`,g=a?d:`${h}px`),{data:{x:p,y:g}}}});function qM(t){const[e,r="center"]=t.split("-");return[e,r]}var YM=GM,bv=VM,uT=HM,dT=zM,tH=Symbol("radix.slottable");function rH(t){const e=({children:r})=>x.jsx(x.Fragment,{children:r});return e.displayName=`${t}.Slottable`,e.__radixId=tH,e}var[xv]=Oa("Tooltip",[iu]),fT=iu(),XM="TooltipProvider",nH=700,eP="tooltip.open",[iH,QM]=xv(XM),JM=t=>{const{__scopeTooltip:e,delayDuration:r=nH,skipDelayDuration:n=300,disableHoverableContent:i=!1,children:s}=t,a=E.useRef(!0),o=E.useRef(!1),l=E.useRef(0);return E.useEffect(()=>{const c=l.current;return()=>window.clearTimeout(c)},[]),x.jsx(iH,{scope:e,isOpenDelayedRef:a,delayDuration:r,onOpen:E.useCallback(()=>{window.clearTimeout(l.current),a.current=!1},[]),onClose:E.useCallback(()=>{window.clearTimeout(l.current),l.current=window.setTimeout(()=>a.current=!0,n)},[n]),isPointerInTransitRef:o,onPointerInTransitChange:E.useCallback(c=>{o.current=c}
vendor: 4,120 bytes, line 181
181,[]),disableHoverableContent:i,children:s})};JM.displayName=XM;var ZM="Tooltip",[XCe,wv]=xv(ZM),Fx="TooltipTrigger",sH=E.forwardRef((t,e)=>{const{__scopeTooltip:r,...n}=t,i=wv(Fx,r),s=QM(Fx,r),a=fT(r),o=E.useRef(null),l=vt(e,o,i.onTriggerChange),c=E.useRef(!1),u=E.useRef(!1),d=E.useCallback(()=>c.current=!1,[]);return E.useEffect(()=>()=>document.removeEventListener("pointerup",d),[d]),x.jsx(bv,{asChild:!0,...a,children:x.jsx(ke.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...n,ref:l,onPointerMove:ve(t.onPointerMove,f=>{f.pointerType!=="touch"&&!u.current&&!s.isPointerInTransitRef.current&&(i.onTriggerEnter(),u.current=!0)}),onPointerLeave:ve(t.onPointerLeave,()=>{i.onTriggerLeave(),u.current=!1}),onPointerDown:ve(t.onPointerDown,()=>{i.open&&i.onClose(),c.current=!0,document.addEventListener("pointerup",d,{once:!0})}),onFocus:ve(t.onFocus,()=>{c.current||i.onOpen()}),onBlur:ve(t.onBlur,i.onClose),onClick:ve(t.onClick,i.onClose)})})});sH.displayName=Fx;var aH="TooltipPortal",[QCe,oH]=xv(aH,{forceMount:void 0}),Ec="TooltipContent",e$=E.forwardRef((t,e)=>{const r=oH(Ec,t.__scopeTooltip),{forceMount:n=r.forceMount,side:i="top",...s}=t,a=wv(Ec,t.__scopeTooltip);return x.jsx(Zc,{present:n||a.open,children:a.disableHoverableContent?x.jsx(t$,{side:i,...s,ref:e}):x.jsx(lH,{side:i,...s,ref:e})})}),lH=E.forwardRef((t,e)=>{const r=wv(Ec,t.__scopeTooltip),n=QM(Ec,t.__scopeTooltip),i=E.useRef(null),s=vt(e,i),[a,o]=E.useState(null),{trigger:l,onClose:c}=r,u=i.current,{onPointerInTransitChange:d}=n,f=E.useCallback(()=>{o(null),d(!1)},[d]),h=E.useCallback((p,g)=>{const m=p.currentTarget,v={x:p.clientX,y:p.clientY},y=hH(v,m.getBoundingClientRect()),b=pH(v,y),w=mH(g.getBoundingClientRect()),S=vH([...b,...w]);o(S),d(!0)},[d]);return E.useEffect(()=>()=>f(),[f]),E.useEffect(()=>{if(l&&u){const p=m=>h(m,u),g=m=>h(m,l);return l.addEventListener("pointerleave",p),u.addEventListener("pointerleave",g),()=>{l.removeEventListener("pointerleave",p),u.removeEventListener("pointerleave",g)}}},[l,u,h,f]),E.useEffect(()=>{if(a){const p=g=>{const m=g.target,v={x:g.clientX,y:g.clientY},y=(l==null?void 0:l.contains(m))||(u==null?void 0:u.contains(m)),b=!gH(v,a);y?f():b&&(f(),c())};return document.addEventListener("pointermove",p),()=>document.removeEventListener("pointermove",p)}},[l,u,a,c,f]),x.jsx(t$,{...t,ref:s})}),[cH,uH]=xv(ZM,{isInside:!1}),dH=rH("TooltipContent"),t$=E.forwardRef((t,e)=>{const{__scopeTooltip:r,children:n,"aria-label":i,onEscapeKeyDown:s,onPointerDownOutside:a,...o}=t,l=wv(Ec,r),c=fT(r),{onClose:u}=l;return E.useEffect(()=>(document.addEventListener(eP,u),()=>document.removeEventListener(eP,u)),[u]),E.useEffect(()=>{if(l.trigger){const d=f=>{const h=f.target;h!=null&&h.contains(l.trigger)&&u()};return window.addEventListener("scroll",d,{capture:!0}),()=>window.removeEventListener("scroll",d,{capture:!0})}},[l.trigger,u]),x.jsx(Jf,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:s,onPointerDownOutside:a,onFocusOutside:d=>d.preventDefault(),onDismiss:u,children:x.jsxs(uT,{"data-state":l.stateAttribute,...c,...o,ref:e,style:{...o.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[x.jsx(dH,{children:n}),x.jsx(cH,{scope:r,isInside:!0,children:x.jsx(q6,{id:l.contentId,role:"tooltip",children:i||n})})]})})});e$.displayName=Ec;var r$="TooltipArrow",fH=E.forwardRef((t,e)=>{const{__scopeTooltip:r,...n}=t,i=fT(r);return uH(r$,r).isInside?null:x.jsx(dT,{...i,...n,ref:e})});fH.displayName=r$;function hH(t,e){const r=Math.abs(e.top-t.y),n=Math.abs(e.bottom-t.y),i=Math.abs(e.right-t.x),s=Math.abs(e.left-t.x);switch(Math.min(r,n,i,s)){case s:return"left";case i:return"right";case r:return"top";case n:return"bottom";default:throw new Error("unreachable")}}function pH(t,e,r=5){const n=[];
181switch(e){case"top":n.push({x:t.x-r,y:t.y+r},{x:t.x+r,y:t.y+r});break;case"bottom":n.push({x:t.x-r,y:t.y-r},{x:t.x+r,y:t.y-r});break;case"left":n.push({x:t.x+r,y:t.y-r},{x:t.x+r,y:t.y+r});break;case"right":n.push({x:t.x-r,y:t.y-r},{x:t.x-r,y:t.y+r});break}return n}function mH(t){const{top:e,right:r,bottom:n,left:i}=t;return[{x:i,y:e},{x:r,y:e},{x:r,y:n},{x:i,y:n}]}function gH(t,e){const{x:r,y:n}=t;let i=!1;for(let s=0,a=e.length-1;s<e.length;a=s++){const o=e[s],l=e[a],c=o.x,u=o.y,d=l.x,f=l.y;u>n!=f>n&&r<(d-c)*(n-u)/(f-u)+c&&(i=!i)}return i}function vH(t){const e=t.slice();return e.sort((r,n)=>r.x<n.x?-1:r.x>n.x?1:r.y<n.y?-1:r.y>n.y?1:0),yH(e)}function yH(t){if(t.length<=1)return t.slice();const e=[];for(let n=0;n<t.length;n++){const i=t[n];for(;e.length>=2;){const s=e[e.length-1],a=e[e.length-2];if((s.x-a.x)*(i.y-a.y)>=(s.y-a.y)*(i.x-a.x))e.pop();else break}e.push(i)}e.pop();const r=[];for(let n=t.length-1;n>=0;n--){const i=t[n];for(;r.length>=2;){const s=r[r.length-1],a=r[r.length-2];if((s.x-a.x)*(i.y-a.y)>=(s.y-a.y)*(i.x-a.x))r.pop();else break}r.push(i)}return r.pop(),e.length===1&&r.length===1&&e[0].x===r[0].x&&e[0].y===r[0].y?e:e.concat(r)}var bH=JM,n$=e$;const xH=bH,wH=E.forwardRef(({className:t,sideOffset:e=4,...r},n)=>x.jsx(n$,{ref:n,sideOffset:e,className:be("z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t),...r}));wH.displayName=n$.displayName;var Sv=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(t){return this.listeners.add(t),this.onSubscribe(),()=>{this.listeners.delete(t),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},SH={setTimeout:(t,e)=>setTimeout(t,e),clearTimeout:t=>clearTimeout(t),setInterval:(t,e)=>setInterval(t,e),clearInterval:t=>clearInterval(t)},Zs,tE,gL,EH=(gL=class{constructor(){Le(this,Zs,SH);Le(this,tE,!1)}setTimeoutProvider(t){we(this,Zs,t)}setTimeout(t,e){return X(this,Zs).setTimeout(t,e)}clearTimeout(t){X(this,Zs).clearTimeout(t)}setInterval(t,e){return X(this,Zs).setInterval(t,e)}clearInterval(t){X(this,Zs).clearInterval(t)}},Zs=new WeakMap,tE=new WeakMap,gL),Bx=new EH;function TH(t){setTimeout(t,0)}var Ev=typeof window>"u"||"Deno"in globalThis;function qn(){}function _H(t,e){return typeof t=="function"?t(e):t}function AH(t){return typeof t=="number"&&t>=0&&t!==1/0}function PH(t,e){return Math.max(t+(e||0)-Date.now(),0)}function Ux(t,e){return typeof t=="function"?t(e):t}function IH(t,e){return typeof t=="function"?t(e):t}function tP(t,e){const{type:r="all",exact:n,fetchStatus:i,predicate:s,queryKey:a,stale:o}=t;if(a){if(n){if(e.queryHash!==hT(a,e.options))return!1}else if(!Wd(e.queryKey,a))return!1}if(r!=="all"){const l=e.isActive();if(r==="active"&&!l||r==="inactive"&&l)return!1}return!(typeof o=="boolean"&&e.isStale()!==o||i&&i!==e.state.fetchStatus||s&&!s(e))}function rP(t,e){const{exact:r,status:n,predicate:i,mutationKey:s}=t;if(s){if(!e.options.mutationKey)return!1;if(r){if(Gd(e.options.mutationKey)!==Gd(s))return!1}else if(!Wd(e.options.mutationKey,s))return!1}return!(n&&e.state.status!==n||i&&!i(e))}function hT(t,e){return((e==null?void 0:e.queryKeyHashFn)||Gd)(t)}function Gd(t){return JSON.stringify(t,(e,r)=>Gx(r)?Object.keys(r).sort().reduce((n,i)=>(n[i]=r[i],n),{}):r)}function Wd(t,e){return t===e?!0:typeof t!=typeof e?!1:t&&e&&typeof t=="object"&&typeof e=="object"?Object.keys(e).every(r=>Wd(t[r],e[r])):!1}var CH=Object.prototype.hasOwnProperty;function i$(t,e,r=0){if(t===e)return t;if(r>500)return e;const n=nP(t)&&nP(e);if(!n&&!(Gx(t)&&Gx(e)))return e;const s=(n?t:Object.keys(t)).length,a=n?e:Object.keys(e),o=a.length,l=n?new Array(o):{};let c=0;for(let u=0;u<o;u++){const d=n?u:a[u],f=t[d],h=e[d];if(f===h){l[d]=f,(n?u<s:CH.call(t,d))&&c++;continue}if(f===null||h===null||typeof f!="object"||typeof h!="object"){l[d]=h;continue}const p=i$(f,h,r+1);l[d]=p,p===f&&c++}return s===o&&c===s?t:l}function nP(t){return Array.isArray(t)&&t.length===Object.keys(t).length}function Gx(t){if(!iP(t))return!1;const e=t.constructor;if(e===void 0)return!0;const r=e.prototype;return!(!iP(r)||!r.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(t)!==Object.prototype)}function iP(t){return Object.prototype.toString.call(t)==="[object Object]"}function OH(t){return new Promise(e=>{Bx.setTimeout(e,t)})}function RH(t,e,r){return typeof r.structuralSharing=="function"?r.structuralSharing(t,e):r.structuralSharing!==!1?i$(t,e):e}function kH(t,e,r=0){const n=[...t,e];return r&&n.length>r?n.slice(1):n}function LH(t,e,r=0){const n=[e,...t];return r&&n.length>r?n.slice(0,-1):n}var pT=Symbol();function s$(t,e){return!t.queryFn&&(e!=null&&e.initialPromise)?()=>e.initialPromise:!t.queryFn||t.queryFn===pT?()=>Promise.reject(new Error(`Missing queryFn: '${t.queryHash}'`)):t.queryFn}function DH(t,e,r){let n=!1,i;return Object.defineProperty(t,"signal",{enumerable:!0,get:()=>(i??(i=e()),n||(n=!0,i.aborted?r():i.addEventListener("abort",r,{once:!0})),i)}),t}var po,ea,ac,vL,NH=(vL=class extends Sv{constructor(){super();Le(this,po);Le(this,ea);Le(this,ac);we(this,ac,e=>{if(!Ev&&window.addEventListener){const r=()=>e();return window.addEventListener("visibilitychange",r,!1),()=>{window.removeEventListener("visibilitychange",r)}}})}onSubscribe(){X(this,ea)||this.setEventListener(X(this,ac))}onUnsubscribe(){var e;this.hasListeners()||((e=X(this,ea))==null||e.call(this),we(this,ea,void 0))}setEventListener(e){var r;we(this,ac,e),(r=X(this,ea))==null||r.call(this),we(this,ea,e(n=>{typeof n=="boolean"?this.setFocused(n):this.onFocus()}))}setFocused(e){X(this,po)!==e&&(we(this,po,e),this.onFocus())}onFocus(){const e=this.isFocused();
vendor: 5,006 bytes, line 181
181this.listeners.forEach(r=>{r(e)})}isFocused(){var e;return typeof X(this,po)=="boolean"?X(this,po):((e=globalThis.document)==null?void 0:e.visibilityState)!=="hidden"}},po=new WeakMap,ea=new WeakMap,ac=new WeakMap,vL),a$=new NH;function MH(){let t,e;const r=new Promise((i,s)=>{t=i,e=s});r.status="pending",r.catch(()=>{});function n(i){Object.assign(r,i),delete r.resolve,delete r.reject}return r.resolve=i=>{n({status:"fulfilled",value:i}),t(i)},r.reject=i=>{n({status:"rejected",reason:i}),e(i)},r}var $H=TH;function jH(){let t=[],e=0,r=o=>{o()},n=o=>{o()},i=$H;const s=o=>{e?t.push(o):i(()=>{r(o)})},a=()=>{const o=t;t=[],o.length&&i(()=>{n(()=>{o.forEach(l=>{r(l)})})})};return{batch:o=>{let l;e++;try{l=o()}finally{e--,e||a()}return l},batchCalls:o=>(...l)=>{s(()=>{o(...l)})},schedule:s,setNotifyFunction:o=>{r=o},setBatchNotifyFunction:o=>{n=o},setScheduler:o=>{i=o}}}var Rr=jH(),oc,ta,lc,yL,FH=(yL=class extends Sv{constructor(){super();Le(this,oc,!0);Le(this,ta);Le(this,lc);we(this,lc,e=>{if(!Ev&&window.addEventListener){const r=()=>e(!0),n=()=>e(!1);return window.addEventListener("online",r,!1),window.addEventListener("offline",n,!1),()=>{window.removeEventListener("online",r),window.removeEventListener("offline",n)}}})}onSubscribe(){X(this,ta)||this.setEventListener(X(this,lc))}onUnsubscribe(){var e;this.hasListeners()||((e=X(this,ta))==null||e.call(this),we(this,ta,void 0))}setEventListener(e){var r;we(this,lc,e),(r=X(this,ta))==null||r.call(this),we(this,ta,e(this.setOnline.bind(this)))}setOnline(e){X(this,oc)!==e&&(we(this,oc,e),this.listeners.forEach(n=>{n(e)}))}isOnline(){return X(this,oc)}},oc=new WeakMap,ta=new WeakMap,lc=new WeakMap,yL),Cm=new FH;function BH(t){return Math.min(1e3*2**t,3e4)}function o$(t){return(t??"online")==="online"?Cm.isOnline():!0}var Wx=class extends Error{constructor(t){super("CancelledError"),this.revert=t==null?void 0:t.revert,this.silent=t==null?void 0:t.silent}};function l$(t){let e=!1,r=0,n;const i=MH(),s=()=>i.status!=="pending",a=g=>{var m;if(!s()){const v=new Wx(g);f(v),(m=t.onCancel)==null||m.call(t,v)}},o=()=>{e=!0},l=()=>{e=!1},c=()=>a$.isFocused()&&(t.networkMode==="always"||Cm.isOnline())&&t.canRun(),u=()=>o$(t.networkMode)&&t.canRun(),d=g=>{s()||(n==null||n(),i.resolve(g))},f=g=>{s()||(n==null||n(),i.reject(g))},h=()=>new Promise(g=>{var m;n=v=>{(s()||c())&&g(v)},(m=t.onPause)==null||m.call(t)}).then(()=>{var g;n=void 0,s()||(g=t.onContinue)==null||g.call(t)}),p=()=>{if(s())return;let g;const m=r===0?t.initialPromise:void 0;try{g=m??t.fn()}catch(v){g=Promise.reject(v)}Promise.resolve(g).then(d).catch(v=>{var T;if(s())return;const y=t.retry??(Ev?0:3),b=t.retryDelay??BH,w=typeof b=="function"?b(r,v):b,S=y===!0||typeof y=="number"&&r<y||typeof y=="function"&&y(r,v);if(e||!S){f(v);return}r++,(T=t.onFail)==null||T.call(t,r,v),OH(w).then(()=>c()?void 0:h()).then(()=>{e?f(v):p()})})};return{promise:i,status:()=>i.status,cancel:a,continue:()=>(n==null||n(),i),cancelRetry:o,continueRetry:l,canStart:u,start:()=>(u()?p():h().then(p),i)}}var mo,bL,c$=(bL=class{constructor(){Le(this,mo)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),AH(this.gcTime)&&we(this,mo,Bx.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(t){this.gcTime=Math.max(this.gcTime||0,t??(Ev?1/0:5*60*1e3))}clearGcTimeout(){X(this,mo)&&(Bx.clearTimeout(X(this,mo)),we(this,mo,void 0))}},mo=new WeakMap,bL),go,cc,Sn,vo,tr,Vf,yo,Qn,Zi,xL,UH=(xL=class extends c${constructor(e){super();Le(this,Qn);Le(this,go);Le(this,cc);Le(this,Sn);Le(this,vo);Le(this,tr);Le(this,Vf);Le(this,yo);we(this,yo,!1),we(this,Vf,e.defaultOptions),this.setOptions(e.options),this.observers=[],we(this,vo,e.client),we(this,Sn,X(this,vo).getQueryCache()),this.queryKey=e.queryKey,this.queryHash=e.queryHash,we(this,go,aP(this.options)),this.state=e.state??X(this,go),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var e;return(e=X(this,tr))==null?void 0:e.promise}setOptions(e){if(this.options={...X(this,Vf),...e},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const r=aP(this.options);r.data!==void 0&&(this.setState(sP(r.data,r.dataUpdatedAt)),we(this,go,r))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&X(this,Sn).remove(this)}setData(e,r){const n=RH(this.state.data,e,this.options);return xr(this,Qn,Zi).call(this,{data:n,type:"success",dataUpdatedAt:r==null?void 0:r.updatedAt,manual:r==null?void 0:r.manual}),n}setState(e,r){xr(this,Qn,Zi).call(this,{type:"setState",state:e,setStateOptions:r})}cancel(e){var n,i;const r=(n=X(this,tr))==null?void 0:n.promise;return(i=X(this,tr))==null||i.cancel(e),r?r.then(qn).catch(qn):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(X(this,go))}isActive(){return this.observers.some(e=>IH(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===pT||this.state.dataUpdateCount+this.state.errorUpdate
181Count===0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>Ux(e.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e==="static"?!1:this.state.isInvalidated?!0:!PH(this.state.dataUpdatedAt,e)}onFocus(){var r;const e=this.observers.find(n=>n.shouldFetchOnWindowFocus());e==null||e.refetch({cancelRefetch:!1}),(r=X(this,tr))==null||r.continue()}onOnline(){var r;const e=this.observers.find(n=>n.shouldFetchOnReconnect());e==null||e.refetch({cancelRefetch:!1}),(r=X(this,tr))==null||r.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),X(this,Sn).notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(r=>r!==e),this.observers.length||(X(this,tr)&&(X(this,yo)?X(this,tr).cancel({revert:!0}):X(this,tr).cancelRetry()),this.scheduleGc()),X(this,Sn).notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||xr(this,Qn,Zi).call(this,{type:"invalidate"})}async fetch(e,r){var l,c,u,d,f,h,p,g,m,v,y,b;if(this.state.fetchStatus!=="idle"&&((l=X(this,tr))==null?void 0:l.status())!=="rejected"){if(this.state.data!==void 0&&(r!=null&&r.cancelRefetch))this.cancel({silent:!0});else if(X(this,tr))return X(this,tr).continueRetry(),X(this,tr).promise}if(e&&this.setOptions(e),!this.options.queryFn){const w=this.observers.find(S=>S.options.queryFn);w&&this.setOptions(w.options)}const n=new AbortController,i=w=>{Object.defineProperty(w,"signal",{enumerable:!0,get:()=>(we(this,yo,!0),n.signal)})},s=()=>{const w=s$(this.options,r),T=(()=>{const _={client:X(this,vo),queryKey:this.queryKey,meta:this.meta};return i(_),_})();return we(this,yo,!1),this.options.persister?this.options.persister(w,T,this):w(T)},o=(()=>{const w={fetchOptions:r,options:this.options,queryKey:this.queryKey,client:X(this,vo),state:this.state,fetchFn:s};return i(w),w})();(c=this.options.behavior)==null||c.onFetch(o,this),we(this,cc,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((u=o.fetchOptions)==null?void 0:u.meta))&&xr(this,Qn,Zi).call(this,{type:"fetch",meta:(d=o.fetchOptions)==null?void 0:d.meta}),we(this,tr,l$({initialPromise:r==null?void 0:r.initialPromise,fn:o.fetchFn,onCancel:w=>{w instanceof Wx&&w.revert&&this.setState({...X(this,cc),fetchStatus:"idle"}),n.abort()},onFail:(w,S)=>{xr(this,Qn,Zi).call(this,{type:"failed",failureCount:w,error:S})},onPause:()=>{xr(this,Qn,Zi).call(this,{type:"pause"})},onContinue:()=>{xr(this,Qn,Zi).call(this,{type:"continue"})},retry:o.options.retry,retryDelay:o.options.retryDelay,networkMode:o.options.networkMode,canRun:()=>!0}));try{const w=await X(this,tr).start();if(w===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(w),(h=(f=X(this,Sn).config).onSuccess)==null||h.call(f,w,this),(g=(p=X(this,Sn).config).onSettled)==null||g.call(p,w,this.state.error,this),w}catch(w){if(w instanceof Wx){if(w.silent)return X(this,tr).promise;if(w.revert){if(this.state.data===void 0)throw w;return this.state.data}}throw xr(this,Qn,Zi).call(this,{type:"error",error:w}),(v=(m=X(this,Sn).config).onError)==null||v.call(m,w,this),(b=(y=X(this,Sn).config).onSettled)==null||b.call(y,this.state.data,w,this),w}finally{this.scheduleGc()}}},go=new WeakMap,cc=new WeakMap,Sn=new WeakMap,vo=new WeakMap,tr=new WeakMap,Vf=new WeakMap,yo=new WeakMap,Qn=new WeakSet,Zi=function(e){const r=n=>{switch(e.type){case"failed":return{...n,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case"pause":return{...n,fetchStatus:"paused"};case"continue":return{...n,fetchStatus:"fetching"};case"fetch":return{...n,...GH(n.data,this.options),fetchMeta:e.meta??null};case"success":const i={...n,...sP(e.data,e.dataUpdatedAt),dataUpdateCount:n.dataUpdateCount+1,...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return we(this,cc,e.manual?i:void 0),i;case"error":const s=e.error;
181return{...n,error:s,errorUpdateCount:n.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:n.fetchFailureCount+1,fetchFailureReason:s,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...n,isInvalidated:!0};case"setState":return{...n,...e.state}}};this.state=r(this.state),Rr.batch(()=>{this.observers.forEach(n=>{n.onQueryUpdate()}),X(this,Sn).notify({query:this,type:"updated",action:e})})},xL);function GH(t,e){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:o$(e.networkMode)?"fetching":"paused",...t===void 0&&{error:null,status:"pending"}}}function sP(t,e){return{data:t,dataUpdatedAt:e??Date.now(),error:null,isInvalidated:!1,status:"success"}}function aP(t){const e=typeof t.initialData=="function"?t.initialData():t.initialData,r=e!==void 0,n=r?typeof t.initialDataUpdatedAt=="function"?t.initialDataUpdatedAt():t.initialDataUpdatedAt:0;return{data:e,dataUpdateCount:0,dataUpdatedAt:r?n??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:r?"success":"pending",fetchStatus:"idle"}}function oP(t){return{onFetch:(e,r)=>{var u,d,f,h,p;const n=e.options,i=(f=(d=(u=e.fetchOptions)==null?void 0:u.meta)==null?void 0:d.fetchMore)==null?void 0:f.direction,s=((h=e.state.data)==null?void 0:h.pages)||[],a=((p=e.state.data)==null?void 0:p.pageParams)||[];let o={pages:[],pageParams:[]},l=0;const c=async()=>{let g=!1;const m=b=>{DH(b,()=>e.signal,()=>g=!0)},v=s$(e.options,e.fetchOptions),y=async(b,w,S)=>{if(g)return Promise.reject();if(w==null&&b.pages.length)return Promise.resolve(b);const _=(()=>{const O={client:e.client,queryKey:e.queryKey,pageParam:w,direction:S?"backward":"forward",meta:e.options.meta};return m(O),O})(),A=await v(_),{maxPages:P}=e.options,C=S?LH:kH;return{pages:C(b.pages,A,P),pageParams:C(b.pageParams,w,P)}};if(i&&s.length){const b=i==="backward",w=b?WH:lP,S={pages:s,pageParams:a},T=w(n,S);o=await y(S,T,b)}else{const b=t??s.length;do{const w=l===0?a[0]??n.initialPageParam:lP(n,o);if(l>0&&w==null)break;o=await y(o,w),l++}while(l<b)}return o};e.options.persister?e.fetchFn=()=>{var g,m;return(m=(g=e.options).persister)==null?void 0:m.call(g,c,{client:e.client,queryKey:e.queryKey,meta:e.options.meta,signal:e.signal},r)}:e.fetchFn=c}}}function lP(t,{pages:e,pageParams:r}){const n=e.length-1;return e.length>0?t.getNextPageParam(e[n],e,r[n],r):void 0}function WH(t,{pages:e,pageParams:r}){var n;return e.length>0?(n=t.getPreviousPageParam)==null?void 0:n.call(t,e[0],e,r[0],r):void 0}var Hf,xi,Er,bo,wi,Gs,wL,VH=(wL=class extends c${constructor(e){super();Le(this,wi);Le(this,Hf);Le(this,xi);Le(this,Er);Le(this,bo);we(this,Hf,e.client),this.mutationId=e.mutationId,we(this,Er,e.mutationCache),we(this,xi,[]),this.state=e.state||HH(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){X(this,xi).includes(e)||(X(this,xi).push(e),this.clearGcTimeout(),X(this,Er).notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){we(this,xi,X(this,xi).filter(r=>r!==e)),this.scheduleGc(),X(this,Er).notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){X(this,xi).length||(this.state.status==="pending"?this.scheduleGc():X(this,Er).remove(this))}continue(){var e;return((e=X(this,bo))==null?void 0:e.continue())??this.execute(this.state.variables)}async execute(e){var a,o,l,c,u,d,f,h,p,g,m,v,y,b,w,S,T,_;const r=()=>{xr(this,wi,Gs).call(this,{type:"continue"})},n={client:X(this,Hf),meta:this.options.meta,mutationKey:this.options.mutationKey};we(this,bo,l$({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(new Error("No mutationFn found")),onFail:(A,P)=>{xr(this,wi,Gs).call(this,{type:"failed",failureCount:A,error:P})},onPause:()=>{xr(this,wi,Gs).call(this,{type:"pause"})},onContinue:r,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>X(this,Er).canRun(this)}));const i=this.state.status==="pending",s=!X(this,bo).canStart();try{if(i)r();else{xr(this,wi,Gs).call(this,{type:"pending",variables:e,isPaused:s}),X(this,Er).config.onMutate&&await X(this,Er).config.onMutate(e,this,n);const P=await((o=(a=this.options).onMutate)==null?void 0:o.call(a,e,n));P!==this.state.context&&xr(this,wi,Gs).call(this,{type:"pending",context:P,variables:e,isPaused:s})}const A=await X(this,bo).start();return await((c=(l=X(this,Er).config).onSuccess)==null?void 0:c.call(l,A,e,this.state.context,this,n)),await((d=(u=this.options).onSuccess)==null?void 0:d.call(u,A,e,this.state.context,n)),await((h=(f=X(this,Er).config).onSettled)==null?void 0:h.call(f,A,null,this.state.variables,this.state.context,this,n)),await((g=(p=this.options).onSettled)==null?void 0:g.call(p,A,null,e,this.state.context,n)),xr(this,wi,Gs).call(this,{type:"success",data:A}),A}catch(A){try{await((v=(m=X(this,Er).config).onError)==null?void 0:v.call(m,A,e,this.state.context,this,n))}catch(P){Promise.reject(P)}try{await((b=(y=this.options).onError)==null?void 0:b.call(y,A,e,this.state.context,n))}catch(P){Promise.reject(P)}try{await((S=(w=X(this,Er).config).onSettled)==null?void 0:S.call(w,void 0,A,this.state.variables,this.state.context,this,n))}catch(P){Promise.reject(P)}try{await((_=(T=this.options).onSettled)==null?void 0:_.call(T,void 0,A,e,this.state.context,n))}catch(P){Promise.reject(P)}throw xr(this,wi,Gs).call(this,{type:"error",error:A}),A}finally{X(this,Er).runNext(this)}}},Hf=new WeakMap,xi=new WeakMap,Er=new WeakMap,bo=new WeakMap,wi=new WeakSet,Gs=function(e){const r=n=>{switch(e.type){case"failed":return{...n,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...n,isPaused:!0};case"continue":return{...n,isPaused:!1};
181case"pending":return{...n,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:"pending",variables:e.variables,submittedAt:Date.now()};case"success":return{...n,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...n,data:void 0,error:e.error,failureCount:n.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}};this.state=r(this.state),Rr.batch(()=>{X(this,xi).forEach(n=>{n.onMutationUpdate(e)}),X(this,Er).notify({mutation:this,type:"updated",action:e})})},wL);function HH(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var ss,Jn,Kf,SL,KH=(SL=class extends Sv{constructor(e={}){super();Le(this,ss);Le(this,Jn);Le(this,Kf);this.config=e,we(this,ss,new Set),we(this,Jn,new Map),we(this,Kf,0)}build(e,r,n){const i=new VH({client:e,mutationCache:this,mutationId:++vh(this,Kf)._,options:e.defaultMutationOptions(r),state:n});return this.add(i),i}add(e){X(this,ss).add(e);const r=Bh(e);if(typeof r=="string"){const n=X(this,Jn).get(r);n?n.push(e):X(this,Jn).set(r,[e])}this.notify({type:"added",mutation:e})}remove(e){if(X(this,ss).delete(e)){const r=Bh(e);if(typeof r=="string"){const n=X(this,Jn).get(r);if(n)if(n.length>1){const i=n.indexOf(e);i!==-1&&n.splice(i,1)}else n[0]===e&&X(this,Jn).delete(r)}}this.notify({type:"removed",mutation:e})}canRun(e){const r=Bh(e);if(typeof r=="string"){const n=X(this,Jn).get(r),i=n==null?void 0:n.find(s=>s.state.status==="pending");return!i||i===e}else return!0}runNext(e){var n;const r=Bh(e);if(typeof r=="string"){const i=(n=X(this,Jn).get(r))==null?void 0:n.find(s=>s!==e&&s.state.isPaused);return(i==null?void 0:i.continue())??Promise.resolve()}else return Promise.resolve()}clear(){Rr.batch(()=>{X(this,ss).forEach(e=>{this.notify({type:"removed",mutation:e})}),X(this,ss).clear(),X(this,Jn).clear()})}getAll(){return Array.from(X(this,ss))}find(e){const r={exact:!0,...e};return this.getAll().find(n=>rP(r,n))}findAll(e={}){return this.getAll().filter(r=>rP(e,r))}notify(e){Rr.batch(()=>{this.listeners.forEach(r=>{r(e)})})}resumePausedMutations(){const e=this.getAll().filter(r=>
vendor: 6,440 bytes, lines 181-190
181r.state.isPaused);return Rr.batch(()=>Promise.all(e.map(r=>r.continue().catch(qn))))}},ss=new WeakMap,Jn=new WeakMap,Kf=new WeakMap,SL);function Bh(t){var e;return(e=t.options.scope)==null?void 0:e.id}var Si,EL,zH=(EL=class extends Sv{constructor(e={}){super();Le(this,Si);this.config=e,we(this,Si,new Map)}build(e,r,n){const i=r.queryKey,s=r.queryHash??hT(i,r);let a=this.get(s);return a||(a=new UH({client:e,queryKey:i,queryHash:s,options:e.defaultQueryOptions(r),state:n,defaultOptions:e.getQueryDefaults(i)}),this.add(a)),a}add(e){X(this,Si).has(e.queryHash)||(X(this,Si).set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){const r=X(this,Si).get(e.queryHash);r&&(e.destroy(),r===e&&X(this,Si).delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){Rr.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return X(this,Si).get(e)}getAll(){return[...X(this,Si).values()]}find(e){const r={exact:!0,...e};return this.getAll().find(n=>tP(r,n))}findAll(e={}){const r=this.getAll();return Object.keys(e).length>0?r.filter(n=>tP(e,n)):r}notify(e){Rr.batch(()=>{this.listeners.forEach(r=>{r(e)})})}onFocus(){Rr.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){Rr.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},Si=new WeakMap,EL),It,ra,na,uc,dc,ia,fc,hc,TL,qH=(TL=class{constructor(t={}){Le(this,It);Le(this,ra);Le(this,na);Le(this,uc);Le(this,dc);Le(this,ia);Le(this,fc);Le(this,hc);we(this,It,t.queryCache||new zH),we(this,ra,t.mutationCache||new KH),we(this,na,t.defaultOptions||{}),we(this,uc,new Map),we(this,dc,new Map),we(this,ia,0)}mount(){vh(this,ia)._++,X(this,ia)===1&&(we(this,fc,a$.subscribe(async t=>{t&&(await this.resumePausedMutations(),X(this,It).onFocus())})),we(this,hc,Cm.subscribe(async t=>{t&&(await this.resumePausedMutations(),X(this,It).onOnline())})))}unmount(){var t,e;vh(this,ia)._--,X(this,ia)===0&&((t=X(this,fc))==null||t.call(this),we(this,fc,void 0),(e=X(this,hc))==null||e.call(this),we(this,hc,void 0))}isFetching(t){return X(this,It).findAll({...t,fetchStatus:"fetching"}).length}isMutating(t){return X(this,ra).findAll({...t,status:"pending"}).length}getQueryData(t){var r;const e=this.defaultQueryOptions({queryKey:t});return(r=X(this,It).get(e.queryHash))==null?void 0:r.state.data}ensureQueryData(t){const e=this.defaultQueryOptions(t),r=X(this,It).build(this,e),n=r.state.data;return n===void 0?this.fetchQuery(t):(t.revalidateIfStale&&r.isStaleByTime(Ux(e.staleTime,r))&&this.prefetchQuery(e),Promise.resolve(n))}getQueriesData(t){return X(this,It).findAll(t).map(({queryKey:e,state:r})=>{const n=r.data;return[e,n]})}setQueryData(t,e,r){const n=this.defaultQueryOptions({queryKey:t}),i=X(this,It).get(n.queryHash),s=i==null?void 0:i.state.data,a=_H(e,s);if(a!==void 0)return X(this,It).build(this,n).setData(a,{...r,manual:!0})}setQueriesData(t,e,r){return Rr.batch(()=>X(this,It).findAll(t).map(({queryKey:n})=>[n,this.setQueryData(n,e,r)]))}getQueryState(t){var r;const e=this.defaultQueryOptions({queryKey:t});return(r=X(this,It).get(e.queryHash))==null?void 0:r.state}removeQueries(t){const e=X(this,It);Rr.batch(()=>{e.findAll(t).forEach(r=>{e.remove(r)})})}resetQueries(t,e){const r=X(this,It);return Rr.batch(()=>(r.findAll(t).forEach(n=>{n.reset()}),this.refetchQueries({type:"active",...t},e)))}cancelQueries(t,e={}){const r={revert:!0,...e},n=Rr.batch(()=>X(this,It).findAll(t).map(i=>i.cancel(r)));return Promise.all(n).then(qn).catch(qn)}invalidateQueries(t,e={}){return Rr.batch(()=>(X(this,It).findAll(t).forEach(r=>{r.invalidate()}),(t==null?void 0:t.refetchType)==="none"?Promise.resolve():this.refetchQueries({...t,type:(t==null?void 0:t.refetchType)??(t==null?void 0:t.type)??"active"},e)))}refetchQueries(t,e={}){const r={...e,cancelRefetch:e.cancelRefetch??!0},n=Rr.batch(()=>X(this,It).findAll(t).filter(i=>!i.isDisabled()&&!i.isStatic()).map(i=>{let s=i.fetch(void 0,r);return r.throwOnError||(s=s.catch(qn)),i.state.fetchStatus==="paused"?Promise.resolve():s}));return Promise.all(n).then(qn)}fetchQuery(t){const e=this.defaultQueryOptions(t);e.retry===void 0&&(e.retry=!1);const r=X(this,It).build(this,e);return r.isStaleByTime(Ux(e.staleTime,r))?r.fetch(e):Promise.resolve(r.state.data)}prefetchQuery(t){return this.fetchQuery(t).then(qn).catch(qn)}fetchInfiniteQuery(t){return t.behavior=oP(t.pages),this.fetchQuery(t)}prefetchInfiniteQuery(t){return this.fetchInfiniteQuery(t).then(qn).catch(qn)}ensureInfiniteQueryData(t){return t.behavior=oP(t.pages),this.ensureQueryData(t)}resumePausedMutations(){return Cm.isOnline()?X(this,ra).resumePausedMutations():Promise.resolve()}getQueryCache(){return X(this,It)}getMutationCache(){return X(this,ra)}getDefaultOptions(){return X(this,na)}setDefaultOptions(t){we(this,na,t)}setQueryDefaults(t,e){X(this,uc).set(Gd(t),{queryKey:t,defaultOptions:e})}getQueryDefaults(t){const e=[...X(this,uc).values()],r={};return e.forEach(n=>{Wd(t,n.queryKey)&&Object.assign(r,n.defaultOptions)}),r}setMutationDefaults(t,e){X(this,dc).set(Gd(t),{mutationKey:t,defaultOptions:e})}getMutationDefaults(t){const e=[...X(this,dc).values()],r={};return e.forEach(n=>{Wd(t,n.mutationKey)&&Object.assign(r,n.defaultOptions)}),r}defaultQueryOptions(t){if(t._defaulted)return t;const e={...X(this,na).queries,...this.getQueryDefaults(t.queryKey),...t,_defaulted:!0};return e.queryHash||(e.queryHash=hT(e.queryKey,e)),e.refetchOnReconnect===void 0&&(e.refetchOnReconnect=e.networkMode!=="always"),e.throwOnError===void 0&&(e.throwOnError=!!e.suspense),!e.networkMode&&e.persister&&(e.networkMode="offlineFirst"),e.queryFn===pT&&(e.enabled=!1),e}defaultMutationOptions(t){return t!=null&&t._defaulted?t:{...X(this,na).mutations,...(t==null?void 0:t.mutationKey)&&this.getMutationDefaults(t.mutationKey),...t,_defaulted:!0}}clear(){X(this,It).clear(),X(this,ra).clear()}},It=new WeakMap,ra=new WeakMap,na=new WeakMap,uc=new WeakMap,dc=new WeakMap,ia=new WeakMap,fc=new WeakMap,hc=new WeakMap,TL),YH=E.createContext(void 0),XH=({client:t,children:e})=>(E.useEffect(()=>(t.mount(),()=>{t.unmount()}),[t]),x.jsx(YH.Provider,{value:t,children:e}));/**
182 * @remix-run/router v1.23.2
183 *
184 * Copyright (c) Remix Software Inc.
185 *
186 * This source code is licensed under the MIT license found in the
187 * LICENSE.md file in the root directory of this source tree.
188 *
189 * @license MIT
190 */function Vd(){return Vd=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];
vendor: 9,249 bytes, lines 190-199
190for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},Vd.apply(this,arguments)}var oa;(function(t){t.Pop="POP",t.Push="PUSH",t.Replace="REPLACE"})(oa||(oa={}));const cP="popstate";function QH(t){t===void 0&&(t={});function e(n,i){let{pathname:s,search:a,hash:o}=n.location;return Vx("",{pathname:s,search:a,hash:o},i.state&&i.state.usr||null,i.state&&i.state.key||"default")}function r(n,i){return typeof i=="string"?i:Om(i)}return ZH(e,r,null,t)}function Mt(t,e){if(t===!1||t===null||typeof t>"u")throw new Error(e)}function mT(t,e){if(!t){typeof console<"u"&&console.warn(e);try{throw new Error(e)}catch{}}}function JH(){return Math.random().toString(36).substr(2,8)}function uP(t,e){return{usr:t.state,key:t.key,idx:e}}function Vx(t,e,r,n){return r===void 0&&(r=null),Vd({pathname:typeof t=="string"?t:t.pathname,search:"",hash:""},typeof e=="string"?su(e):e,{state:r,key:e&&e.key||n||JH()})}function Om(t){let{pathname:e="/",search:r="",hash:n=""}=t;return r&&r!=="?"&&(e+=r.charAt(0)==="?"?r:"?"+r),n&&n!=="#"&&(e+=n.charAt(0)==="#"?n:"#"+n),e}function su(t){let e={};if(t){let r=t.indexOf("#");r>=0&&(e.hash=t.substr(r),t=t.substr(0,r));let n=t.indexOf("?");n>=0&&(e.search=t.substr(n),t=t.substr(0,n)),t&&(e.pathname=t)}return e}function ZH(t,e,r,n){n===void 0&&(n={});let{window:i=document.defaultView,v5Compat:s=!1}=n,a=i.history,o=oa.Pop,l=null,c=u();c==null&&(c=0,a.replaceState(Vd({},a.state,{idx:c}),""));function u(){return(a.state||{idx:null}).idx}function d(){o=oa.Pop;let m=u(),v=m==null?null:m-c;c=m,l&&l({action:o,location:g.location,delta:v})}function f(m,v){o=oa.Push;let y=Vx(g.location,m,v);c=u()+1;let b=uP(y,c),w=g.createHref(y);try{a.pushState(b,"",w)}catch(S){if(S instanceof DOMException&&S.name==="DataCloneError")throw S;i.location.assign(w)}s&&l&&l({action:o,location:g.location,delta:1})}function h(m,v){o=oa.Replace;let y=Vx(g.location,m,v);c=u();let b=uP(y,c),w=g.createHref(y);a.replaceState(b,"",w),s&&l&&l({action:o,location:g.location,delta:0})}function p(m){let v=i.location.origin!=="null"?i.location.origin:i.location.href,y=typeof m=="string"?m:Om(m);return y=y.replace(/ $/,"%20"),Mt(v,"No window.location.(origin|href) available to create URL for href: "+y),new URL(y,v)}let g={get action(){return o},get location(){return t(i,a)},listen(m){if(l)throw new Error("A history only accepts one active listener");return i.addEventListener(cP,d),l=m,()=>{i.removeEventListener(cP,d),l=null}},createHref(m){return e(i,m)},createURL:p,encodeLocation(m){let v=p(m);return{pathname:v.pathname,search:v.search,hash:v.hash}},push:f,replace:h,go(m){return a.go(m)}};return g}var dP;(function(t){t.data="data",t.deferred="deferred",t.redirect="redirect",t.error="error"})(dP||(dP={}));function eK(t,e,r){return r===void 0&&(r="/"),tK(t,e,r)}function tK(t,e,r,n){let i=typeof e=="string"?su(e):e,s=gT(i.pathname||"/",r);if(s==null)return null;let a=u$(t);rK(a);let o=null;for(let l=0;o==null&&l<a.length;++l){let c=pK(s);o=dK(a[l],c)}return o}function u$(t,e,r,n){e===void 0&&(e=[]),r===void 0&&(r=[]),n===void 0&&(n="");let i=(s,a,o)=>{let l={relativePath:o===void 0?s.path||"":o,caseSensitive:s.caseSensitive===!0,childrenIndex:a,route:s};l.relativePath.startsWith("/")&&(Mt(l.relativePath.startsWith(n),'Absolute route path "'+l.relativePath+'" nested under path '+('"'+n+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),l.relativePath=l.relativePath.slice(n.length));let c=va([n,l.relativePath]),u=r.concat(l);s.children&&s.children.length>0&&(Mt(s.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+c+'".')),u$(s.children,e,u,c)),!(s.path==null&&!s.index)&&e.push({path:c,score:cK(c,s.index),routesMeta:u})};return t.forEach((s,a)=>{var o;if(s.path===""||!((o=s.path)!=null&&o.includes("?")))i(s,a);else for(let l of d$(s.path))i(s,a,l)}),e}function d$(t){let e=t.split("/");if(e.length===0)return[];let[r,...n]=e,i=r.endsWith("?"),s=r.replace(/\?$/,"");if(n.length===0)return i?[s,""]:[s];let a=d$(n.join("/")),o=[];return o.push(...a.map(l=>l===""?s:[s,l].join("/"))),i&&o.push(...a),o.map(l=>t.startsWith("/")&&l===""?"/":l)}function rK(t){t.sort((e,r)=>e.score!==r.score?r.score-e.score:uK(e.routesMeta.map(n=>n.childrenIndex),r.routesMeta.map(n=>n.childrenIndex)))}const nK=/^:[\w-]+$/,iK=3,sK=2,aK=1,oK=10,lK=-2,fP=t=>t==="*";function cK(t,e){let r=t.split("/"),n=r.length;return r.some(fP)&&(n+=lK),e&&(n+=sK),r.filter(i=>!fP(i)).reduce((i,s)=>i+(nK.test(s)?iK:s===""?aK:oK),n)}function uK(t,e){return t.length===e.length&&t.slice(0,-1).every((n,i)=>n===e[i])?t[t.length-1]-e[e.length-1]:0}function dK(t,e,r){let{routesMeta:n}=t,i={},s="/",a=[];for(let o=0;o<n.length;++o){let l=n[o],c=o===n.length-1,u=s==="/"?e:e.slice(s.length)||"/",d=fK({path:l.relativePath,caseSensitive:l.caseSensitive,end:c},u),f=l.route;if(!d)return null;Object.assign(i,d.params),a.push({params:i,pathname:va([s,d.pathname]),pathnameBase:bK(va([s,d.pathnameBase])),route:f}),d.pathnameBase!=="/"&&(s=va([s,d.pathnameBase]))}return a}function fK(t,e){typeof t=="string"&&(t={path:t,caseSensitive:!1,end:!0});let[r,n]=hK(t.path,t.caseSensitive,t.end),i=e.match(r);if(!i)return null;let s=i[0],a=s.replace(/(.)\/+$/,"$1"),o=i.slice(1);return{params:n.reduce((c,u,d)=>{let{paramName:f,isOptional:h}=u;if(f==="*"){let g=o[d]||"";a=s.slice(0,s.length-g.length).replace(/(.)\/+$/,"$1")}const p=o[d];return h&&!p?c[f]=void 0:c[f]=(p||"").replace(/%2F/g,"/"),c},{}),pathname:s,pathnameBase:a,pattern:t}}function hK(t,e,r){e===void 0&&(e=!1),r===void 0&&(r=!0),mT(t==="*"||!t.endsWith("*")||t.endsWith("/*"),'Route path "'+t+'" will be treated as if it were '+('"'+t.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+t.replace(/\*$/,"/*")+'".'));let n=[],i="^"+t.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(a,o,l)=>(n.push({paramName:o,isOptional:l!=null}),l?"/?([^\\/]+)?":"/([^\\/]+)"));return t.endsWith("*")?(n.push({paramName:"*"}),i+=t==="*"||t==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?i+="\\/*$":t!==""&&t!=="/"&&(i+="(?:(?=\\/|$))"),[new RegExp(i,e?void 0:"i"),n]}function pK(t){try{return t.split("/").map(e=>decodeURIComponent(e).replace(/\//g,"%2F")).join("/")}catch(e){return mT(!1,'The URL path "'+t+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+e+").")),t}}function gT(t,e){if(e==="/")return t;if(!t.toLowerCase().startsWith(e.toLowerCase()))return null;let r=e.endsWith("/")?e.length-1:e.length,n=t.charAt(r);return n&&n!=="/"?null:t.slice(r)||"/"}const mK=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,gK=t=>mK.test(t);function vK(t,e){e===void 0&&(e="/");let{pathname:r,search:n="",hash:i=""}=typeof t=="string"?su(t):t,s;if(r)if(gK(r))s=r;else{if(r.includes("//")){let a=r;r=r.replace(/\/\/+/g,"/"),mT(!1,"Pathnames cannot have embedded double slashes - normalizing "+(a+" -> "+r))}r.startsWith("/")?s=hP(r.substring(1),"/"):s=hP(r,e)}else s=e;return{pathname:s,search:xK(n),hash:wK(i)}}function hP(t,e){let r=e.replace(/\/+$/,"").split("/");return t.split("/").forEach(i=>{i===".."?r.length>1&&r.pop():i!=="."&&r.push(i)}),r.length>1?r.join("/"):"/"}function f0(t,e,r,n){return"Cannot include a '"+t+"' character in a manually specified "+("`to."+e+"` field ["+JSON.stringify(n)+"].  Please separate it out to the ")+("`to."+r+"` field. Alternatively you may provide the full path as ")+'a string in <Link to="..."> and the router will parse it for you.'}function yK(t){return t.filter((e,r)=>r===0||e.route.path&&e.route.path.length>0)}function vT(t,e){let r=yK(t);return e?r.map((n,i)=>i===r.length-1?n.pathname:n.pathnameBase):r.map(n=>n.pathnameBase)}function yT(t,e,r,n){n===void 0&&(n=!1);let i;typeof t=="string"?i=su(t):(i=Vd({},t),Mt(!i.pathname||!i.pathname.includes("?"),f0("?","pathname","search",i)),Mt(!i.pathname||!i.pathname.includes("#"),f0("#","pathname","hash",i)),Mt(!i.search||!i.search.includes("#"),f0("#","search","hash",i)));let s=t===""||i.pathname==="",a=s?"/":i.pathname,o;if(a==null)o=r;else{let d=e.length-1;if(!n&&a.startsWith("..")){let f=a.split("/");for(;f[0]==="..";)f.shift(),d-=1;i.pathname=f.join("/")}o=d>=0?e[d]:"/"}let l=vK(i,o),c=a&&a!=="/"&&a.endsWith("/"),u=(s||a===".")&&r.endsWith("/");return!l.pathname.endsWith("/")&&(c||u)&&(l.pathname+="/"),l}const va=t=>t.join("/").replace(/\/\/+/g,"/"),bK=t=>t.replace(/\/+$/,"").replace(/^\/*/,"/"),xK=t=>!t||t==="?"?"":t.startsWith("?")?t:"?"+t,wK=t=>!t||t==="#"?"":t.startsWith("#")?t:"#"+t;function SK(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.internal=="boolean"&&"data"in t}const f$=["post","put","patch","delete"];new Set(f$);const EK=["get",...f$];new Set(EK);/**
191 * React Router v6.30.3
192 *
193 * Copyright (c) Remix Software Inc.
194 *
195 * This source code is licensed under the MIT license found in the
196 * LICENSE.md file in the root directory of this source tree.
197 *
198 * @license MIT
199 */function Hd(){return Hd=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];
vendor: 2,981 bytes, line 199
199for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},Hd.apply(this,arguments)}const bT=E.createContext(null),TK=E.createContext(null),Ra=E.createContext(null),Tv=E.createContext(null),Ps=E.createContext({outlet:null,matches:[],isDataRoute:!1}),h$=E.createContext(null);function _K(t,e){let{relative:r}=e===void 0?{}:e;au()||Mt(!1);let{basename:n,navigator:i}=E.useContext(Ra),{hash:s,pathname:a,search:o}=m$(t,{relative:r}),l=a;return n!=="/"&&(l=a==="/"?n:va([n,a])),i.createHref({pathname:l,search:o,hash:s})}function au(){return E.useContext(Tv)!=null}function Is(){return au()||Mt(!1),E.useContext(Tv).location}function p$(t){E.useContext(Ra).static||E.useLayoutEffect(t)}function Ir(){let{isDataRoute:t}=E.useContext(Ps);return t?FK():AK()}function AK(){au()||Mt(!1);let t=E.useContext(bT),{basename:e,future:r,navigator:n}=E.useContext(Ra),{matches:i}=E.useContext(Ps),{pathname:s}=Is(),a=JSON.stringify(vT(i,r.v7_relativeSplatPath)),o=E.useRef(!1);return p$(()=>{o.current=!0}),E.useCallback(function(c,u){if(u===void 0&&(u={}),!o.current)return;if(typeof c=="number"){n.go(c);return}let d=yT(c,JSON.parse(a),s,u.relative==="path");t==null&&e!=="/"&&(d.pathname=d.pathname==="/"?e:va([e,d.pathname])),(u.replace?n.replace:n.push)(d,u.state,u)},[e,n,a,s,t])}function PK(){let{matches:t}=E.useContext(Ps),e=t[t.length-1];return e?e.params:{}}function m$(t,e){let{relative:r}=e===void 0?{}:e,{future:n}=E.useContext(Ra),{matches:i}=E.useContext(Ps),{pathname:s}=Is(),a=JSON.stringify(vT(i,n.v7_relativeSplatPath));return E.useMemo(()=>yT(t,JSON.parse(a),s,r==="path"),[t,a,s,r])}function IK(t,e){return CK(t,e)}function CK(t,e,r,n){au()||Mt(!1);let{navigator:i}=E.useContext(Ra),{matches:s}=E.useContext(Ps),a=s[s.length-1],o=a?a.params:{};a&&a.pathname;let l=a?a.pathnameBase:"/";a&&a.route;let c=Is(),u;if(e){var d;let m=typeof e=="string"?su(e):e;l==="/"||(d=m.pathname)!=null&&d.startsWith(l)||Mt(!1),u=m}else u=c;let f=u.pathname||"/",h=f;if(l!=="/"){let m=l.replace(/^\//,"").split("/");h="/"+f.replace(/^\//,"").split("/").slice(m.length).join("/")}let p=eK(t,{pathname:h}),g=DK(p&&p.map(m=>Object.assign({},m,{params:Object.assign({},o,m.params),pathname:va([l,i.encodeLocation?i.encodeLocation(m.pathname).pathname:m.pathname]),pathnameBase:m.pathnameBase==="/"?l:va([l,i.encodeLocation?i.encodeLocation(m.pathnameBase).pathname:m.pathnameBase])})),s,r,n);return e&&g?E.createElement(Tv.Provider,{value:{location:Hd({pathname:"/",search:"",hash:"",state:null,key:"default"},u),navigationType:oa.Pop}},g):g}function OK(){let t=jK(),e=SK(t)?t.status+" "+t.statusText:t instanceof Error?t.message:JSON.stringify(t),r=t instanceof Error?t.stack:null,i={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return E.createElement(E.Fragment,null,E.createElement("h2",null,"Unexpected Application Error!"),E.createElement("h3",{style:{fontStyle:"italic"}},e),r?E.createElement("pre",{style:i},r):null,null)}const RK=E.createElement(OK,null);
vendor: 2,455 bytes, line 199
199class kK extends E.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,r){return r.location!==e.location||r.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:r.error,location:r.location,revalidation:e.revalidation||r.revalidation}}componentDidCatch(e,r){console.error("React Router caught the following error during render",e,r)}render(){return this.state.error!==void 0?E.createElement(Ps.Provider,{value:this.props.routeContext},E.createElement(h$.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function LK(t){let{routeContext:e,match:r,children:n}=t,i=E.useContext(bT);return i&&i.static&&i.staticContext&&(r.route.errorElement||r.route.ErrorBoundary)&&(i.staticContext._deepestRenderedBoundaryId=r.route.id),E.createElement(Ps.Provider,{value:e},n)}function DK(t,e,r,n){var i;if(e===void 0&&(e=[]),r===void 0&&(r=null),n===void 0&&(n=null),t==null){var s;if(!r)return null;if(r.errors)t=r.matches;else if((s=n)!=null&&s.v7_partialHydration&&e.length===0&&!r.initialized&&r.matches.length>0)t=r.matches;else return null}let a=t,o=(i=r)==null?void 0:i.errors;if(o!=null){let u=a.findIndex(d=>d.route.id&&(o==null?void 0:o[d.route.id])!==void 0);u>=0||Mt(!1),a=a.slice(0,Math.min(a.length,u+1))}let l=!1,c=-1;if(r&&n&&n.v7_partialHydration)for(let u=0;u<a.length;u++){let d=a[u];if((d.route.HydrateFallback||d.route.hydrateFallbackElement)&&(c=u),d.route.id){let{loaderData:f,errors:h}=r,p=d.route.loader&&f[d.route.id]===void 0&&(!h||h[d.route.id]===void 0);if(d.route.lazy||p){l=!0,c>=0?a=a.slice(0,c+1):a=[a[0]];break}}}return a.reduceRight((u,d,f)=>{let h,p=!1,g=null,m=null;r&&(h=o&&d.route.id?o[d.route.id]:void 0,g=d.route.errorElement||RK,l&&(c<0&&f===0?(BK("route-fallback"),p=!0,m=null):c===f&&(p=!0,m=d.route.hydrateFallbackElement||null)));let v=e.concat(a.slice(0,f+1)),y=()=>{let b;return h?b=g:p?b=m:d.route.Component?b=E.createElement(d.route.Component,null):d.route.element?b=d.route.element:b=u,E.createElement(LK,{match:d,routeContext:{outlet:u,matches:v,isDataRoute:r!=null},children:b})};return r&&(d.route.ErrorBoundary||d.route.errorElement||f===0)?E.createElement(kK,{location:r.location,revalidation:r.revalidation,component:g,error:h,children:y(),routeC
199ontext:{outlet:null,matches:v,isDataRoute:!0}}):y()},null)}var g$=function(t){return t.UseBlocker="useBlocker",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t}(g$||{}),v$=function(t){return t.UseBlocker="useBlocker",t.UseLoaderData="useLoaderData",t.UseActionData="useActionData",t.UseRouteError="useRouteError",t.UseNavigation="useNavigation",t.UseRouteLoaderData="useRouteLoaderData",t.UseMatches="useMatches",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t.UseRouteId="useRouteId",t}(v$||{});function NK(t){let e=E.useContext(bT);return e||Mt(!1),e}function MK(t){let e=E.useContext(TK);return e||Mt(!1),e}function $K(t){let e=E.useContext(Ps);return e||Mt(!1),e}function y$(t){let e=$K(),r=e.matches[e.matches.length-1];return r.route.id||Mt(!1),r.route.id}function jK(){var t;let e=E.useContext(h$),r=MK(),n=y$();return e!==void 0?e:(t=r.errors)==null?void 0:t[n]}function FK(){let{router:t}=NK(g$.UseNavigateStable),e=y$(v$.UseNavigateStable),r=E.useRef(!1);return p$(()=>{r.current=!0}),E.useCallback(function(i,s){s===void 0&&(s={}),r.current&&(typeof i=="number"?t.navigate(i):t.navigate(i,Hd({fromRouteId:e},s)))},[t,e])}const pP={};function BK(t,e,r){pP[t]||(pP[t]=!0)}function UK(t,e){t==null||t.v7_startTransition,t==null||t.v7_relativeSplatPath}function GK(t){let{to:e,replace:r,state:n,relative:i}=t;au()||Mt(!1);let{future:s,static:a}=E.useContext(Ra),{matches:o}=E.useContext(Ps),{pathname:l}=Is(),c=Ir(),u=yT(e,vT(o,s.v7_relativeSplatPath),l,i==="path"),d=JSON.stringify(u);return E.useEffect(()=>c(JSON.parse(d),{replace:r,state:n,relative:i}),[c,d,i,r,n]),null}function cr(t){Mt(!1)}function WK(t){let{basename:e="/",children:r=null,location:n,navigationType:i=oa.Pop,navigator:s,static:a=!1,future:o}=t;au()&&Mt(!1);let l=e.replace(/^\/*/,"/"),c=E.useMemo(()=>({basename:l,navigator:s,static:a,future:Hd({v7_relativeSplatPath:!1},o)}),[l,o,s,a]);typeof n=="string"&&(n=su(n));let{pathname:u="/",search:d="",hash:f="",state:h=null,key:p="default"}=n,g=E.useMemo(()=>{let m=gT(u,l);return m==null?null:{location:{pathname:m,search:d,hash:f,state:h,key:p},navigationType:i}},[l,u,d,f,h,p,i]);return g==null?null:E.createElement(Ra.Provider,{value:c},E.createElement(Tv.Provider,{children:r,value:g}))}function VK(t){let{children:e,location:r}=t;return IK(Hx(e),r)}new Promise(()=>{});function Hx(t,e){e===void 0&&(e=[]);let r=[];return E.Children.forEach(t,(n,i)=>{if(!E.isValidElement(n))return;let s=[...e,i];if(n.type===E.Fragment){r.push.apply(r,Hx(n.props.children,s));return}n.type!==cr&&Mt(!1),!n.props.index||!n.props.children||Mt(!1);let a={id:n.props.id||s.join("-"),caseSensitive:n.props.caseSensitive,element:n.props.element,Component:n.props.Component,index:n.props.index,path:n.props.path,loader:n.props.loader,action:n.props.action,errorElement:n.props.errorElement,ErrorBoundary:n.props.ErrorBoundary,hasErrorBoundary:n.props.ErrorBoundary!=null||n.props.errorElement!=null,shouldRevalidate:n.props.shouldRevalidate,handle:n.props.handle,lazy:n.props.lazy};n.props.children&&(a.children=Hx(n.props.children,s)),r.push(a)}),r}/**
200 * React Router DOM v6.30.3
201 *
202 * Copyright (c) Remix Software Inc.
203 *
204 * This source code is licensed under the MIT license found in the
205 * LICENSE.md file in the root directory of this source tree.
206 *
207 * @license MIT
208 */function Kx(){return Kx=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},Kx.apply(this,arguments)}function HK(t,e){if(t==null)return{};var r={},n=Object.keys(t),i,s;for(s=0;s<n.length;s++)i=n[s],!(e.indexOf(i)>=0)&&(r[i]=t[i]);return r}function KK(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function zK(t,e){return t.button===0&&(!e||e==="_self")&&!KK(t)}function zx(t){return t===void 0&&(t=""),new URLSearchParams(typeof t=="string"||Array.isArray(t)||t instanceof URLSearchParams?t:Object.keys(t).reduce((e,r)=>{let n=t[r];return e.concat(Array.isArray(n)?n.map(i=>[r,i]):[[r,n]])},[]))}function qK(t,e){let r=zx(t);return e&&e.forEach((n,i)=>
208{r.has(i)||e.getAll(i).forEach(s=>{r.append(i,s)})}),r}const YK=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],XK="6";try{window.__reactRouterVersion=XK}catch{}const QK="startTransition",mP=Yg[QK];function JK(t){let{basename:e,children:r,future:n,window:i}=t,s=E.useRef();s.current==null&&(s.current=QH({window:i,v5Compat:!0}));let a=s.current,[o,l]=E.useState({action:a.action,location:a.location}),{v7_startTransition:c}=n||{},u=E.useCallback(d=>{c&&mP?mP(()=>l(d)):l(d)},[l,c]);return E.useLayoutEffect(()=>a.listen(u),[a,u]),E.useEffect(()=>UK(n),[n]),E.createElement(WK,{basename:e,children:r,location:o.location,navigationType:o.action,navigator:a,future:n})}const ZK=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",ez=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,_i=E.forwardRef(function(e,r){let{onClick:n,relative:i,reloadDocument:s,replace:a,state:o,target:l,to:c,preventScrollReset:u,viewTransition:d}=e,f=HK(e,YK),{basename:h}=E.useContext(Ra),p,g=!1;if(typeof c=="string"&&ez.test(c)&&(p=c,ZK))try{let b=new URL(window.location.href),w=c.startsWith("//")?new URL(b.protocol+c):new URL(c),S=gT(w.pathname,h);w.origin===b.origin&&S!=null?c=S+w.search+w.hash:g=!0}catch{}let m=_K(c,{relative:i}),v=tz(c,{replace:a,state:o,target:l,preventScrollReset:u,relative:i,viewTransition:d});function y(b){n&&n(b),b.defaultPrevented||v(b)}return E.createElement("a",Kx({},f,{href:p||m,onClick:g||s?n:y,ref:r,target:l}))});var gP;(function(t){t.UseScrollRestoration="useScrollRestoration",t.UseSubmit="useSubmit",t.UseSubmitFetcher="useSubmitFetcher",t.UseFetcher="useFetcher",t.useViewTransitionState="useViewTransitionState"})(gP||(gP={}));var vP;(function(t){t.UseFetcher="useFetcher",t.UseFetchers="useFetchers",t.UseScrollRestoration="useScrollRestoration"})(vP||(vP={}));function tz(t,e){let{target:r,replace:n,state:i,preventScrollReset:s,relative:a,viewTransition:o}=e===void 0?{}:e,l=Ir(),c=Is(),u=m$(t,{relative:a});return E.useCallback(d=>{if(zK(d,r)){d.preventDefault();let f=n!==void 0?n:Om(c)===Om(u);l(t,{replace:f,state:i,preventScrollReset:s,relative:a,viewTransition:o})}},[c,l,u,n,i,r,t,s,a,o])}function _v(t){let e=E.useRef(zx(t)),r=E.useRef(!1),n=Is(),i=E.useMemo(()=>qK(n.search,r.current?null:e.current),[n.search]),s=Ir(),a=E.useCallback((o,l)=>{const c=zx(typeof o=="function"?o(i):o);r.current=!0,s("?"+c,l)},[s,i]);return[i,a]}var Ai=function(){return Ai=Object.assign||function(e){for(var r,n=1,i=arguments.length;n<i;n++){r=arguments[n];
208for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(e[s]=r[s])}return e},Ai.apply(this,arguments)};function ou(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(t);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(t,n[i])&&(r[n[i]]=t[n[i]]);return r}function rz(t,e,r,n){function i(s){return s instanceof r?s:new r(function(a){a(s)})}return new(r||(r=Promise))(function(s,a){function o(u){try{c(n.next(u))}catch(d){a(d)}}function l(u){try{c(n.throw(u))}catch(d){a(d)}}function c(u){u.done?s(u.value):i(u.value).then(o,l)}c((n=n.apply(t,e||[])).next())})}function nz(t,e,r){if(r||arguments.length===2)for(var n=0,i=e.length,s;n<i;n++)(s||!(n in e))&&(s||(s=Array.prototype.slice.call(e,0,n)),s[n]=e[n]);return t.concat(s||Array.prototype.slice.call(e))}const iz=t=>t?(...e)=>t(...e):(...e)=>fetch(...e);class xT extends Error{constructor(e,r="FunctionsError",n){super(e),this.name=r,this.context=n}}class sz extends xT{constructor(e){super("Failed to send a request to the Edge Function","FunctionsFetchError",e)}}class yP extends xT{constructor(e){super("Relay Error invoking the Edge Function","FunctionsRelayError",e)}}class bP extends xT{constructor(e){super("Edge Function returned a non-2xx status code","FunctionsHttpError",e)}}var qx;(function(t){t.Any="any",t.ApNortheast1="ap-northeast-1",t.ApNortheast2="ap-northeast-2",t.ApSouth1="ap-south-1",t.ApSoutheast1="ap-southeast-1",t.ApSoutheast2="ap-southeast-2",t.CaCentral1="ca-central-1",t.EuCentral1="eu-central-1",t.EuWest1="eu-west-1",t.EuWest2="eu-west-2",t.EuWest3="eu-west-3",t.SaEast1="sa-east-1",t.UsEast1="us-east-1",t.UsWest1="us-west-1",t.UsWest2="us-west-2"})(qx||(qx={}));class az{constructor(e,{headers:r={},customFetch:n,region:i=qx.Any}={}){this.url=e,this.headers=r,this.region=i,this.fetch=iz(n)}setAuth(e){this.headers.Authorization=`Bearer ${e}`}invoke(e){return rz(this,arguments,void 0,function*(r,n={}){var i;let s,a;try{const{headers:o,method:l,body:c,signal:u,timeout:d}=n;let f={},{region:h}=n;h||(h=this.region);const p=new URL(`${this.url}/${r}`);h&&h!=="any"&&(f["x-region"]=h,p.searchParams.set("forceFunctionRegion",h));let g;c&&(o&&!Object.prototype.hasOwnProperty.call(o,"Content-Type")||!o)?typeof Blob<"u"&&c instanceof Blob||c instanceof ArrayBuffer?(f["Content-Type"]="application/octet-stream",g=c):typeof c=="string"?(f["Content-Type"]="text/plain",g=c):typeof FormData<"u"&&c instanceof FormData?g=c:(f["Content-Type"]="application/json",g=JSON.stringify(c)):c&&typeof c!="string"&&!(typeof Blob<"u"&&c instanceof Blob)&&!(c instanceof ArrayBuffer)&&!(typeof FormData<"u"&&c instanceof FormData)?g=JSON.stringify(c):g=c;let m=u;d&&(a=new AbortController,s=setTimeout(()=>a.abort(),d),u?(m=a.signal,u.addEventListener("abort",()=>a.abort())):m=a.signal);const v=yield this.fetch(p.toString(),{method:l||"POST",headers:Object.assign(Object.assign(Object.assign({},f),this.headers),o),body:g,signal:m}).catch(S=>{throw new sz(S)}),y=v.headers.get("x-relay-error");if(y&&y==="true")throw new yP(v);if(!v.ok)throw new bP(v);let b=((i=v.headers.get("Content-Type"))!==null&&i!==void 0?i:"text/plain").split(";")[0].trim(),w;return b==="application/json"?w=yield v.json():b==="application/octet-stream"||b==="application/pdf"?w=yield v.blob():b==="text/event-stream"?w=v:b==="multipart/form-data"?w=yield v.formData():w=yield v.text(),{data:w,error:null,response:v}}catch(o){return{data:null,error:o,response:o instanceof bP||o instanceof yP?o.context:void 0}}finally{s&&clearTimeout(s)}})}}var oz=class extends Error{constructor(t){super(t.message),this.name="PostgrestError",this.details=t.details,this.hint=t.hint,this.co
208de=t.code}},lz=class{constructor(t){var e,r,n;this.shouldThrowOnError=!1,this.method=t.method,this.url=t.url,this.headers=new Headers(t.headers),this.schema=t.schema,this.body=t.body,this.shouldThrowOnError=(e=t.shouldThrowOnError)!==null&&e!==void 0?e:!1,this.signal=t.signal,this.isMaybeSingle=(r=t.isMaybeSingle)!==null&&r!==void 0?r:!1,this.urlLengthLimit=(n=t.urlLengthLimit)!==null&&n!==void 0?n:8e3,t.fetch?this.fetch=t.fetch:this.fetch=fetch}throwOnError(){return this.shouldThrowOnError=!0,this}setHeader(t,e){return this.headers=new Headers(this.headers),this.headers.set(t,e),this}then(t,e){var r=this;this.schema===void 0||(["GET","HEAD"].includes(this.method)?this.headers.set("Accept-Profile",this.schema):this.headers.set("Content-Profile",this.schema)),this.method!=="GET"&&this.method!=="HEAD"&&this.headers.set("Content-Type","application/json");const n=this.fetch;let i=n(this.url.toString(),{method:this.method,headers:this.headers,body:JSON.stringify(this.body),signal:this.signal}).then(async s=>{let a=null,o=null,l=null,c=s.status,u=s.statusText;if(s.ok){var d,f;if(r.method!=="HEAD"){var h;const v=await s.text();v===""||(r.headers.get("Accept")==="text/csv"||r.headers.get("Accept")&&(!((h=r.headers.get("Accept"))===null||h===void 0)&&h.includes("application/vnd.pgrst.plan+text"))?o=v:o=JSON.parse(v))}const g=(d=r.headers.get("Prefer"))===null||d===void 0?void 0:d.match(/count=(exact|planned|estimated)/),m=(f=s.headers.get("content-range"))===null||f===void 0?void 0:f.split("/");g&&m&&m.length>1&&(l=parseInt(m[1])),r.isMaybeSingle&&r.method==="GET"&&Array.isArray(o)&&(o.length>1?(a={code:"PGRST116",details:`Results contain ${o.length} rows, application/vnd.pgrst.object+json requires 1 row`,hint:null,message:"JSON object requested, multiple (or no) rows returned"},o=null,l=null,c=406,u="Not Acceptable"):o.length===1?o=o[0]:o=null)}else{var p;const g=await s.text();try{a=JSON.parse(g),Array.isArray(a)&&s.status===404&&(o=[],a=null,c=200,u="OK")}catch{s.status===404&&g===""?(c=204,u="No Content"):a={message:g}}if(a&&r.isMaybeSingle&&(!(a==null||(p=a.details)===null||p===void 0)&&p.includes("0 rows"))&&(a=null,c=200,u="OK"),a&&r.shouldThrowOnError)throw new oz(a)}return{error:a,data:o,count:l,status:c,statusText:u}});return this.shouldThrowOnError||(i=i.catch(s=>{var a;let o="",l="",c="";const u=s==null?void 0:s.cause;if(u){var d,f,h,p;const v=(d=u==null?void 0:u.message)!==null&&d!==void 0?d:"",y=(f=u==null?void 0:u.code)!==null&&f!==void 0?f:"";o=`${(h=s==null?void 0:s.name)!==null&&h!==void 0?h:"FetchError"}: ${s==null?void 0:s.message}`,o+=`
209
210Caused by: ${(p=u==null?void 0:u.name)!==null&&p!==void 0?p:"Error"}: ${v}`,y&&(o+=` (${y})`),u!=null&&u.stack&&(o+=`
211${u.stack}`)}else{var g;o=(g=s==null?void 0:s.stack)!==null&&g!==void 0?g:""}const m=this.url.toString().length;return(s==null?void 0:s.name)==="AbortError"||(s==null?void 0:s.code)==="ABORT_ERR"?(c="",l="Request was aborted (timeout or manual cancellation)",m>this.urlLengthLimit&&(l+=`. Note: Your request URL is ${m} characters, which may exceed server limits. If selecting many fields, consider using views. If filtering with large arrays (e.g., .in('id', [many IDs])), consider using an RPC function to pass values server-side.`)):((u==null?void 0:u.name)==="HeadersOverflowError"||(u==null?void 0:u.code)==="UND_ERR_HEADERS_OVERFLOW")&&(c="",l="HTTP headers exceeded server limits (typically 16KB)",m>this.urlLengthLimit&&(l+=`. Your request URL is ${m} characters. If selecting many fields, consider using views. If filtering with large arrays (e.g., .in('id', [200+ IDs])), consider using an RPC function instead.`)),{error:{message:`${(a=s==null?void 0:s.name)!==null&&a!==void 0?a:"FetchError"}: ${s==null?void 0:s.message}`,details:o,hint:l,code:c},data:null,count:null,status:0,statusText:""}})),i.then(t,e)}returns(){return this}overrideTypes(){return this}},cz=class extends lz{select(t){let e=!1;const r=(t??"*").split("").map(n=>/\s/.test(n)&&!e?"":(n==='"'&&(e=!e),n)).join("");return this.url.searchParams.set("select",r),this.headers.append("Prefer","return=representation"),this}order(t,{ascending:e=!0,nullsFirst:r,foreignTable:n,referencedTable:i=n}={}){const s=i?`${i}.order`:"order",a=this.url.searchParams.get(s);return this.url.searchParams.set(s,`${a?`${a},`:""}${t}.${e?"asc":"desc"}${r===void 0?"":r?".nullsfirst":".nullslast"}`),this}limit(t,{foreignTable:e,referencedTable:r=e}={}){const n=typeof r>"u"?"limit":`${r}.limit`;return this.url.searchParams.set(n,`${t}`),this}range(t,e,{foreignTable:r,referencedTable:n=r}={}){const i=typeof n>"u"?"offset":`${n}.offset`,s=typeof n>"u"?"limit":`${n}.limit`;return this.url.searchParams.set(i,`${t}`),this.url.searchParams.set(s,`${e-t+1}`),this}abortSignal(t){return this.signal=t,this}single(){return this.headers.set("Accept","application/vnd.pgrst.object+json"),this}maybeSingle(){return this.method==="GET"?this.headers.set("Accept","application/json"):this.headers.set("Accept","application/vnd.pgrst.object+json"),this.isMaybeSingle=!0,this}csv(){return this.headers.set("Accept","text/csv"),this}geojson(){return this.headers.set("Accept","application/geo+json"),this}
211explain({analyze:t=!1,verbose:e=!1,settings:r=!1,buffers:n=!1,wal:i=!1,format:s="text"}={}){var a;const o=[t?"analyze":null,e?"verbose":null,r?"settings":null,n?"buffers":null,i?"wal":null].filter(Boolean).join("|"),l=(a=this.headers.get("Accept"))!==null&&a!==void 0?a:"application/json";return this.headers.set("Accept",`application/vnd.pgrst.plan+${s}; for="${l}"; options=${o};`),s==="json"?this:this}rollback(){return this.headers.append("Prefer","tx=rollback"),this}returns(){return this}maxAffected(t){return this.headers.append("Prefer","handling=strict"),this.headers.append("Prefer",`max-affected=${t}`),this}};const xP=new RegExp("[,()]");var xl=class extends cz{eq(t,e){return this.url.searchParams.append(t,`eq.${e}`),this}neq(t,e){return this.url.searchParams.append(t,`neq.${e}`),this}gt(t,e){return this.url.searchParams.append(t,`gt.${e}`),this}gte(t,e){return this.url.searchParams.append(t,`gte.${e}`),this}lt(t,e){return this.url.searchParams.append(t,`lt.${e}`),this}lte(t,e){return this.url.searchParams.append(t,`lte.${e}`),this}like(t,e){return this.url.searchParams.append(t,`like.${e}`),this}likeAllOf(t,e){return this.url.searchParams.append(t,`like(all).{${e.join(",")}}`),this}likeAnyOf(t,e){return this.url.searchParams.append(t,`like(any).{${e.join(",")}}`),this}ilike(t,e){return this.url.searchParams.append(t,`ilike.${e}`),this}ilikeAllOf(t,e){return this.url.searchParams.append(t,`ilike(all).{${e.join(",")}}`),this}ilikeAnyOf(t,e){return this.url.searchParams.append(t,`ilike(any).{${e.join(",")}}`),this}regexMatch(t,e){return this.url.searchParams.append(t,`match.${e}`),this}regexIMatch(t,e){return this.url.searchParams.append(t,`imatch.${e}`),this}is(t,e){return this.url.searchParams.append(t,`is.${e}`),this}isDistinct(t,e){return this.url.searchParams.append(t,`isdistinct.${e}`),this}in(t,e){const r=Array.from(new Set(e)).map(n=>typeof n=="string"&&xP.test(n)?`"${n}"`:`${n}`).join(",");return this.url.searchParams.append(t,`in.(${r})`),this}notIn(t,e){const r=Array.from(new Set(e)).map(n=>typeof n=="string"&&xP.test(n)?`"${n}"`:`${n}`).join(",");return this.url.searchParams.append(t,`not.in.(${r})`),this}contains(t,e){return typeof e=="string"?this.url.searchParams.append(t,`cs.${e}`):Array.isArray(e)?this.url.searchParams.append(t,`cs.{${e.join(",")}}`):this.url.searchParams.append(t,`cs.${JSON.stringify(e)}`),this}containedBy(t,e){return typeof e=="string"?this.url.searchParams.append(t,`cd.${e}`):Array.isArray(e)?this.url.searchParams.append(t,`cd.{${e.join(",")}}`):this.url.searchParams.append(t,`cd.${JSON.stringify(e)}`),this}rangeGt(t,e){return this.url.searchParams.append(t,`sr.${e}`),this}rangeGte(t,e){return this.url.searchParams.append(t,`nxl.${e}`),this}rangeLt(t,e){return this.url.searchParams.append(t,`sl.${e}`),this}rangeLte(t,e){return this.url.searchParams.append(t,`nxr.${e}`),this}rangeAdjacent(t,e){return this.url.searchParams.append(t,`adj.${e}`),this}overlaps(t,e){return typeof e=="string"?this.url.searchParams.append(t,`ov.${e}`):this.url.searchParams.append(t,`ov.{${e.join(",")}}`),this}textSearch(t,e,{config:r,type:n}={}){let i="";n==="plain"?i="pl":n==="phrase"?i="ph":n==="websearch"&&(i="w");const s=r===void 0?"":`(${r})`;return this.url.searchParams.append(t,`${i}fts${s}.${e}`),this}match(t){return Object.entries(t).forEach(([e,r])=>{this.url.searchParams.append(e,`eq.${r}`)}),this}not(t,e,r){return this.url.searchParams.append(t,`not.${e}.${r}`),this}or(t,{foreignTable:e,referencedTable:r=e}={}){const n=r?`${r}.or`:"or";return this.url.searchParams.append(n,`(${t})`),this}filter(t,e,r){return this.url.searchParams.append(t,`${e}.${r}`),this}},uz=class{constructor(t,{headers:e={},schema:r,fetch:n,urlLengthLimit:i=8e3}){this.url=t,this.headers=new Headers(e),this.schema=r,this.fetch=n,this.urlLengthLimit=i}cloneRequestState(){return{url:new URL(this.url.toString()),headers:new Headers(this.headers)}}select(t,e){const{head:r=!1,count:n}=e??{},i=r?"HEAD":"GET";let s=!1;const a=(t??"*").split("").map(c=>/\s/.test(c)&&!s?"":(c==='"'&&(s=!s),c)).join(""),{url:o,headers:l}=this.cloneRequestState();return o.searchParams.set("select",a),n&&l.append("Prefer",`count=${n}`),new xl({method:i,url:o,headers:l,schema:this.schema,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit})}insert(t,{count:e,defaultToNull:r=!0}={}){var n;const i="POST",{url:s,headers:a}=this.cloneRequestState();if(e&&a.append("Prefer",`count=${e}`),r||a.append("Prefer","missing=default"),Array.isArray(t)){const o=t.reduce((l,c)=>l.concat(Object.keys(c)),[]);if(o.length>0){const l=[...new Set(o)].map(c=>`"${c}"`);s.searchParams.set("columns",l.join(","))}}return new xl({method:i,url:s,headers:a,schema:this.schema,body:t,fetch:(n=this.fetch)!==null&&n!==void 0?n:fetch,urlLengthLimit:this.urlLengthLimit})}upsert(t,{onConflict:e,ignoreDuplicates:r=!1,count:n,defaultToNull:i=!0}={}){var s;const a="POST",{url:o,headers:l}=this.cloneRequestState();if(l.append("Prefer",`resolution=${r?"ignore":"merge"}-duplicates`),e!==void 0&&o.searchParams.set("on_conflict",e),n&&l.append("Prefer",`count=${n}`),i||l.append("Prefer","missing=default"),Array.isArray(t)){const c=t.reduce((u,d)=>u.concat(Object.keys(d)),[]);if(c.length>0){const u=[...new Set(c)].map(d=>`"${d}"`);o.searchParams.set("columns",u.join(","))}}return new xl({method:a,url:o,headers:l,schema:this.schema,body:t,fetch:(s=this.fetch)!==null&&s!==void 0?s:fetch,urlLengthLimit:this.urlLengthLimit})}update(t,{count:e}={}){var r;const n="PATCH",{url:i,headers:s}=this.cloneRequestState();return e&&s.append("Prefer",`count=${e}`),new xl({method:n,url:i,headers:s,schema:this.schema,body:t,fetch:(r=this.fetch)!==null&&r!==void 0?r:fetch,urlLengthLimit:this.urlLengthLimit})}delete({count:t}={}){var e;const r="DELETE",{url:n,headers:i}=this.cloneRequestState();return t&&i.append("Prefer",`count=${t}`),new xl({method:r,url:n,headers:i,schema:this.schema,fetch:(e=this.fetch)!==null&&e!==void 0?e:fetch,urlLengthLimit:this.urlLengthLimit})}};function Kd(t){"@babel/helpers - typeof";return Kd=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Kd(t)}function dz(t,e){if(Kd(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(Kd(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function fz(t){var e=dz(t,"string");return Kd(e)=="symbol"?e:e+""}function hz(t,e,r){return(e=fz(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function wP(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function Uh(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};
211e%2?wP(Object(r),!0).forEach(function(n){hz(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):wP(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}var pz=class b${constructor(e,{headers:r={},schema:n,fetch:i,timeout:s,urlLengthLimit:a=8e3}={}){this.url=e,this.headers=new Headers(r),this.schemaName=n,this.urlLengthLimit=a;const o=i??globalThis.fetch;s!==void 0&&s>0?this.fetch=(l,c)=>{const u=new AbortController,d=setTimeout(()=>u.abort(),s),f=c==null?void 0:c.signal;if(f){if(f.aborted)return clearTimeout(d),o(l,c);const h=()=>{clearTimeout(d),u.abort()};return f.addEventListener("abort",h,{once:!0}),o(l,Uh(Uh({},c),{},{signal:u.signal})).finally(()=>{clearTimeout(d),f.removeEventListener("abort",h)})}return o(l,Uh(Uh({},c),{},{signal:u.signal})).finally(()=>clearTimeout(d))}:this.fetch=o}from(e){if(!e||typeof e!="string"||e.trim()==="")throw new Error("Invalid relation name: relation must be a non-empty string.");return new uz(new URL(`${this.url}/${e}`),{headers:new Headers(this.headers),schema:this.schemaName,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit})}schema(e){return new b$(this.url,{headers:this.headers,schema:e,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit})}rpc(e,r={},{head:n=!1,get:i=!1,count:s}={}){var a;let o;const l=new URL(`${this.url}/rpc/${e}`);let c;const u=h=>h!==null&&typeof h=="object"&&(!Array.isArray(h)||h.some(u)),d=n&&Object.values(r).some(u);d?(o="POST",c=r):n||i?(o=n?"HEAD":"GET",Object.entries(r).filter(([h,p])=>p!==void 0).map(([h,p])=>[h,Array.isArray(p)?`{${p.join(",")}}`:`${p}`]).forEach(([h,p])=>{l.searchParams.append(h,p)})):(o="POST",c=r);const f=new Headers(this.headers);return d?f.set("Prefer",s?`count=${s},return=minimal`:"return=minimal"):s&&f.set("Prefer",`count=${s}`),new xl({method:o,url:l,headers:f,schema:this.schemaName,body:c,fetch:(a=this.fetch)!==null&&a!==void 0?a:fetch,urlLengthLimit:this.urlLengthLimit})}};class mz{constructor(){}static detectEnvironment(){var e;if(typeof WebSocket<"u")return{type:"native",constructor:WebSocket};if(typeof globalThis<"u"&&typeof globalThis.WebSocket<"u")return{type:"native",constructor:globalThis.WebSocket};if(typeof global<"u"&&typeof global.WebSocket<"u")return{type:"native",constructor:global.WebSocket};if(typeof globalThis<"u"&&typeof globalThis.WebSocketPair<"u"&&typeof globalThis.WebSocket>"u")return{type:"cloudflare",error:"Cloudflare Workers detected. WebSocket clients are not supported in Cloudflare Workers.",workaround:"Use Cloudflare Workers WebSocket API for server-side WebSocket handling, or deploy to a different runtime."};if(typeof globalThis<"u"&&globalThis.EdgeRuntime||typeof navigator<"u"&&(!((e=navigator.userAgent)===null||e===void 0)&&e.includes("Vercel-Edge")))return{type:"unsupported",error:"Edge runtime detected (Vercel Edge/Netlify Edge). WebSockets are not supported in edge functions.",workaround:"Use serverless functions or a different deployment target for WebSocket functionality."};const r=globalThis.process;if(r){const n=r.versions;if(n&&n.node){const i=n.node,s=parseInt(i.replace(/^v/,"").split(".")[0]);return s>=22?typeof globalThis.WebSocket<"u"?{type:"native",constructor:globalThis.WebSocket}:{type:"unsupported",error:`Node.js ${s} detected but native WebSocket not found.`,workaround:"Provide a WebSocket implementation via the transport option."}:{type:"unsupported",error:`Node.js ${s} detected without native WebSocket support.`,workaround:`For Node.js < 22, install "ws" package and provide it via the transport option:
212import ws from "ws"
213new RealtimeClient(url, { transport: ws })`}}}return{type:"unsupported",error:"Unknown JavaScript runtime without WebSocket support.",workaround:"Ensure you're running in a supported environment (browser, Node.js, Deno) or provide a custom WebSocket implementation."}}static getWebSocketConstructor(){const e=this.detectEnvironment();if(e.constructor)return e.constructor;let r=e.error||"WebSocket not supported in this environment.";throw e.workaround&&(r+=`
214
215Suggested solution: ${e.workaround}`),new Error(r)}static createWebSocket(e,r){const n=this.getWebSocketConstructor();return new n(e,r)}static isWebSocketSupported(){try{const e=this.detectEnvironment();return e.type==="native"||e.type==="ws"}catch{return!1}}}const gz="2.99.1",vz=`realtime-js/${gz}`,yz="1.0.0",x$="2.0.0",SP=x$,Yx=1e4,bz=1e3,xz=100;var Ks;(function(t){t[t.connecting=0]="connecting",t[t.open=1]="open",t[t.closing=2]="closing",t[t.closed=3]="closed"})(Ks||(Ks={}));var Ht;(function(t){t.closed="closed",t.errored="errored",t.joined="joined",t.joining="joining",t.leaving="leaving"})(Ht||(Ht={}));var ei;(function(t){t.close="phx_close",t.error="phx_error",t.join="phx_join",t.reply="phx_reply",t.leave="phx_leave",t.access_token="access_token"})(ei||(ei={}));var Xx;(function(t){t.websocket="websocket"})(Xx||(Xx={}));var no;(function(t){t.Connecting="connecting",t.Open="open",t.Closing="closing",t.Closed="closed"})(no||(no={}));class wz{constructor(e){this.HEADER_LENGTH=1,this.USER_BROADCAST_PUSH_META_LENGTH=6,this.KINDS={userBroadcastPush:3,userBroadcast:4},this.BINARY_ENCODING=0,this.JSON_ENCODING=1,this.BROADCAST_EVENT="broadcast",this.allowedMetadataKeys=[],this.allowedMetadataKeys=e??[]}encode(e,r){if(e.event===this.BROADCAST_EVENT&&!(e.payload instanceof ArrayBuffer)&&typeof e.payload.event=="string")return r(this._binaryEncodeUserBroadcastPush(e));let n=[e.join_ref,e.ref,e.topic,e.event,e.payload];return r(JSON.stringify(n))}_binaryEncodeUserBroadcastPush(e){var r;return this._isArrayBuffer((r=e.payload)===null||r===void 0?void 0:r.payload)?this._encodeBinaryUserBroadcastPush(e):this._encodeJsonUserBroadcastPush(e)}_encodeBinaryUserBroadcastPush(e){var r,n;const i=(n=(r=e.payload)===null||r===void 0?void 0:r.payload)!==null&&n!==void 0?n:new ArrayBuffer(0);return this._encodeUserBroadcastPush(e,this.BINARY_ENCODING,i)}_encodeJsonUserBroadcastPush(e){var r,n;const i=(n=(r=e.payload)===null||r===void 0?void 0:r.payload)!==null&&n!==void 0?n:{},a=new TextEncoder().encode(JSON.stringify(i)).buffer;return this._encodeUserBroadcastPush(e,this.JSON_ENCODING,a)}_encodeUserBroadcastPush(e,r,n){var i,s;const a=e.topic,o=(i=e.ref)!==null&&i!==void 0?i:"",l=(s=e.join_ref)!==null&&s!==void 0?s:"",c=e.payload.event,u=this.allowedMetadataKeys?this._pick(e.payload,this.allowedMetadataKeys):{},d=Object.keys(u).length===0?"":JSON.stringify(u);if(l.length>255)throw new Error(`joinRef length ${l.length} exceeds maximum of 255`);if(o.length>255)throw new Error(`ref length ${o.length} exceeds maximum of 255`);if(a.length>255)throw new Error(`topic length ${a.length} exceeds maximum of 255`);if(c.length>255)throw new Error(`userEvent length ${c.length} exceeds maximum of 255`);if(d.length>255)throw new Error(`metadata length ${d.length} exceeds maximum of 255`);const f=this.USER_BROADCAST_PUSH_META_LENGTH+l.length+o.length+a.length+c.length+d.length,h=new ArrayBuffer(this.HEADER_LENGTH+f);
215let p=new DataView(h),g=0;p.setUint8(g++,this.KINDS.userBroadcastPush),p.setUint8(g++,l.length),p.setUint8(g++,o.length),p.setUint8(g++,a.length),p.setUint8(g++,c.length),p.setUint8(g++,d.length),p.setUint8(g++,r),Array.from(l,v=>p.setUint8(g++,v.charCodeAt(0))),Array.from(o,v=>p.setUint8(g++,v.charCodeAt(0))),Array.from(a,v=>p.setUint8(g++,v.charCodeAt(0))),Array.from(c,v=>p.setUint8(g++,v.charCodeAt(0))),Array.from(d,v=>p.setUint8(g++,v.charCodeAt(0)));var m=new Uint8Array(h.byteLength+n.byteLength);return m.set(new Uint8Array(h),0),m.set(new Uint8Array(n),h.byteLength),m.buffer}decode(e,r){if(this._isArrayBuffer(e)){let n=this._binaryDecode(e);return r(n)}if(typeof e=="string"){const n=JSON.parse(e),[i,s,a,o,l]=n;return r({join_ref:i,ref:s,topic:a,event:o,payload:l})}return r({})}_binaryDecode(e){const r=new DataView(e),n=r.getUint8(0),i=new TextDecoder;switch(n){case this.KINDS.userBroadcast:return this._decodeUserBroadcast(e,r,i)}}_decodeUserBroadcast(e,r,n){const i=r.getUint8(1),s=r.getUint8(2),a=r.getUint8(3),o=r.getUint8(4);let l=this.HEADER_LENGTH+4;const c=n.decode(e.slice(l,l+i));l=l+i;const u=n.decode(e.slice(l,l+s));l=l+s;const d=n.decode(e.slice(l,l+a));l=l+a;const f=e.slice(l,e.byteLength),h=o===this.JSON_ENCODING?JSON.parse(n.decode(f)):f,p={type:this.BROADCAST_EVENT,event:u,payload:h};return a>0&&(p.meta=JSON.parse(d)),{join_ref:null,ref:null,topic:c,event:this.BROADCAST_EVENT,payload:p}}_isArrayBuffer(e){var r;return e instanceof ArrayBuffer||((r=e==null?void 0:e.constructor)===null||r===void 0?void 0:r.name)==="ArrayBuffer"}_pick(e,r){return!e||typeof e!="object"?{}:Object.fromEntries(Object.entries(e).filter(([n])=>r.includes(n)))}}class w${constructor(e,r){this.callback=e,this.timerCalc=r,this.timer=void 0,this.tries=0,this.callback=e,this.timerCalc=r}reset(){this.tries=0,clearTimeout(this.timer),this.timer=void 0}scheduleTimeout(){clearTimeout(this.timer),this.timer=setTimeout(()=>{this.tries=this.tries+1,this.callback()},this.timerCalc(this.tries+1))}}var ot;(function(t){t.abstime="abstime",t.bool="bool",t.date="date",t.daterange="daterange",t.float4="float4",t.float8="float8",t.int2="int2",t.int4="int4",t.int4range="int4range",t.int8="int8",t.int8range="int8range",t.json="json",t.jsonb="jsonb",t.money="money",t.numeric="numeric",t.oid="oid",t.reltime="reltime",t.text="text",t.time="time",t.timestamp="timestamp",t.timestamptz="timestamptz",t.timetz="timetz",t.tsrange="tsrange",t.tstzrange="tstzrange"})(ot||(ot={}));const EP=(t,e,r={})=>{var n;const i=(n=r.skipTypes)!==null&&n!==void 0?n:[];return e?Object.keys(e).reduce((s,a)=>(s[a]=Sz(a,t,e,i),s),{}):{}},Sz=(t,e,r,n)=>{const i=e.find(o=>o.name===t),s=i==null?void 0:i.type,a=r[t];return s&&!n.includes(s)?S$(s,a):Qx(a)},S$=(t,e)=>{if(t.charAt(0)==="_"){const r=t.slice(1,t.length);return Az(e,r)}switch(t){case ot.bool:return Ez(e);case ot.float4:case ot.float8:case ot.int2:case ot.int4:case ot.int8:case ot.numeric:case ot.oid:return Tz(e);case ot.json:case ot.jsonb:return _z(e);case ot.timestamp:return Pz(e);case ot.abstime:case ot.date:case ot.daterange:case ot.int4range:case ot.int8range:case ot.money:case ot.reltime:case ot.text:case ot.time:case ot.timestamptz:case ot.timetz:case ot.tsrange:case ot.tstzrange:return Qx(e);default:return Qx(e)}},Qx=t=>t,Ez=t=>{switch(t){case"t":return!0;case"f":return!1;default:return t}},Tz=t=>{if(typeof t=="string"){const e=parseFloat(t);if(!Number.isNaN(e))return e}return t},_z=t=>{if(typeof t=="string")try{return JSON.parse(t)}catch{return t}return t},Az=(t,e)=>{if(typeof t!="string")return t;const r=t.length-1,n=t[r];if(t[0]==="{"&&n==="}"){let s;const a=t.slice(1,r);try{s=JSON.parse("["+a+"]")}catch{s=a?a.split(","):[]}return s.map(o=>S$(e,o))}return t},Pz=t=>typeof t=="string"?t.replace(" ","T"):t,E$=t=>{const e=new URL(t);return e.protocol=e.protocol.replace(/^ws/i,"http"),e.pathname=e.pathname.replace(/\/+$/,"").replace(/\/socket\/websocket$/i,"").replace(/\/socket$/i,"").replace(/\/websocket$/i,""),e.pathname===""||e.pathname==="/"?e.pathname="/api/broadcast":e.pathname=e.pathname+"/api/broadcast",e.href};class h0{constructor(e,r,n={},i=Yx){this.channel=e,this.event=r,this.payload=n,this.timeout=i,this.sent=!1,this.timeoutTimer=void 0,this.ref="",this.receivedResp=null,this.recHo
vendor: 4,168 bytes, line 215
215oks=[],this.refEvent=null}resend(e){this.timeout=e,this._cancelRefEvent(),this.ref="",this.refEvent=null,this.receivedResp=null,this.sent=!1,this.send()}send(){this._hasReceived("timeout")||(this.startTimeout(),this.sent=!0,this.channel.socket.push({topic:this.channel.topic,event:this.event,payload:this.payload,ref:this.ref,join_ref:this.channel._joinRef()}))}updatePayload(e){this.payload=Object.assign(Object.assign({},this.payload),e)}receive(e,r){var n;return this._hasReceived(e)&&r((n=this.receivedResp)===null||n===void 0?void 0:n.response),this.recHooks.push({status:e,callback:r}),this}startTimeout(){if(this.timeoutTimer)return;this.ref=this.channel.socket._makeRef(),this.refEvent=this.channel._replyEventName(this.ref);const e=r=>{this._cancelRefEvent(),this._cancelTimeout(),this.receivedResp=r,this._matchReceive(r)};this.channel._on(this.refEvent,{},e),this.timeoutTimer=setTimeout(()=>{this.trigger("timeout",{})},this.timeout)}trigger(e,r){this.refEvent&&this.channel._trigger(this.refEvent,{status:e,response:r})}destroy(){this._cancelRefEvent(),this._cancelTimeout()}_cancelRefEvent(){this.refEvent&&this.channel._off(this.refEvent,{})}_cancelTimeout(){clearTimeout(this.timeoutTimer),this.timeoutTimer=void 0}_matchReceive({status:e,response:r}){this.recHooks.filter(n=>n.status===e).forEach(n=>n.callback(r))}_hasReceived(e){return this.receivedResp&&this.receivedResp.status===e}}var TP;(function(t){t.SYNC="sync",t.JOIN="join",t.LEAVE="leave"})(TP||(TP={}));class hd{constructor(e,r){this.channel=e,this.state={},this.pendingDiffs=[],this.joinRef=null,this.enabled=!1,this.caller={onJoin:()=>{},onLeave:()=>{},onSync:()=>{}};const n=(r==null?void 0:r.events)||{state:"presence_state",diff:"presence_diff"};this.channel._on(n.state,{},i=>{const{onJoin:s,onLeave:a,onSync:o}=this.caller;this.joinRef=this.channel._joinRef(),this.state=hd.syncState(this.state,i,s,a),this.pendingDiffs.forEach(l=>{this.state=hd.syncDiff(this.state,l,s,a)}),this.pendingDiffs=[],o()}),this.channel._on(n.diff,{},i=>{const{onJoin:s,onLeave:a,onSync:o}=this.caller;this.inPendingSyncState()?this.pendingDiffs.push(i):(this.state=hd.syncDiff(this.state,i,s,a),o())}),this.onJoin((i,s,a)=>{this.channel._trigger("presence",{event:"join",key:i,currentPresences:s,newPresences:a})}),this.onLeave((i,s,a)=>{this.channel._trigger("presence",{event:"leave",key:i,currentPresences:s,leftPresences:a})}),this.onSync(()=>{this.channel._trigger("presence",{event:"sync"})})}static syncState(e,r,n,i){const s=this.cloneDeep(e),a=this.transformState(r),o={},l={};return this.map(s,(c,u)=>{a[c]||(l[c]=u)}),this.map(a,(c,u)=>{const d=s[c];if(d){const f=u.map(m=>m.presence_ref),h=d.map(m=>m.presence_ref),p=u.filter(m=>h.indexOf(m.presence_ref)<0),g=d.filter(m=>f.indexOf(m.presence_ref)<0);p.length>0&&(o[c]=p),g.length>0&&(l[c]=g)}else o[c]=u}),this.syncDiff(s,{joins:o,leaves:l},n,i)}static syncDiff(e,r,n,i){const{joins:s,leaves:a}={joins:this.transformState(r.joins),leaves:this.transformState(r.leaves)};return n||(n=()=>{}),i||(i=()=>{}),this.map(s,(o,l)=>{var c;const u=(c=e[o])!==null&&c!==void 0?c:[];if(e[o]=this.cloneDeep(l),u.length>0){const d=e[o].map(h=>h.presence_ref),f=u.filter(h=>d.indexOf(h.presence_ref)<0);e[o].unshift(...f)}n(o,u,l)}),this.map(a,(o,l)=>{let c=e[o];if(!c)return;const u=l.map(d=>d.presence_ref);c=c.filter(d=>u.indexOf(d.presence_ref)<0),e[o]=c,i(o,c,l),c.length===0&&delete e[o]}),e}static map(e,r){return Object.getOwnPropertyNames(e).map(n=>r(n,e[n]))}static transformState(e){return e=this.cloneDeep(e),Object.getOwnPropertyNames(e).reduce((r,n)=>{const i=e[n];return"metas"in i?r[n]=i.metas.map(s=>(s.presence_ref=s.phx_ref,delete s.phx_ref,delete s.phx_ref_prev,s)):r[n]=i,r},{})}static cloneDeep(e){return JSON.parse(JSON.stringify(e))}onJoin(e){this.caller.onJoin=e}onLeave(e){this.caller.onLeave=e}onSync(e){this.caller.onSync=e}inPendingSyncState(){return!this.joinRef||this.joinRef!==this.channel._joinRef()}}var _P;(function(t){t.ALL="*",t.INSERT="INSERT",t.UPDATE="UPDATE",t.DELETE="DELETE"})(_P||(_P={}));var pd;(function(t){t.BROADCAST="broadcast",t.PRESENCE="presence",t.POSTGRES_CHANGES="postgres_changes",t.SYSTEM="system"}
215)(pd||(pd={}));var ts;(function(t){t.SUBSCRIBED="SUBSCRIBED",t.TIMED_OUT="TIMED_OUT",t.CLOSED="CLOSED",t.CHANNEL_ERROR="CHANNEL_ERROR"})(ts||(ts={}));class $l{constructor(e,r={config:{}},n){var i,s;if(this.topic=e,this.params=r,this.socket=n,this.bindings={},this.state=Ht.closed,this.joinedOnce=!1,this.pushBuffer=[],this.subTopic=e.replace(/^realtime:/i,""),this.params.config=Object.assign({broadcast:{ack:!1,self:!1},presence:{key:"",enabled:!1},private:!1},r.config),this.timeout=this.socket.timeout,this.joinPush=new h0(this,ei.join,this.params,this.timeout),this.rejoinTimer=new w$(()=>this._rejoinUntilConnected(),this.socket.reconnectAfterMs),this.joinPush.receive("ok",()=>{this.state=Ht.joined,this.rejoinTimer.reset(),this.pushBuffer.forEach(a=>a.send()),this.pushBuffer=[]}),this._onClose(()=>{this.rejoinTimer.reset(),this.socket.log("channel",`close ${this.topic} ${this._joinRef()}`),this.state=Ht.closed,this.socket._remove(this)}),this._onError(a=>{this._isLeaving()||this._isClosed()||(this.socket.log("channel",`error ${this.topic}`,a),this.state=Ht.errored,this.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("timeout",()=>{this._isJoining()&&(this.socket.log("channel",`timeout ${this.topic}`,this.joinPush.timeout),this.state=Ht.errored,this.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("error",a=>{this._isLeaving()||this._isClosed()||(this.socket.log("channel",`error ${this.topic}`,a),this.state=Ht.errored,this.rejoinTimer.scheduleTimeout())}),this._on(ei.reply,{},(a,o)=>{this._trigger(this._replyEventName(o),a)}),this.presence=new hd(this),this.broadcastEndpointURL=E$(this.socket.endPoint),this.private=this.params.config.private||!1,!this.private&&(!((s=(i=this.params.config)===null||i===void 0?void 0:i.broadcast)===null||s===void 0)&&s.replay))throw`tried to use replay on public channel '${this.topic}'. It must be a private channel.`}subscribe(e,r=this.timeout){var n,i,s;if(this.socket.isConnected()||this.socket.connect(),this.state==Ht.closed){const{config:{broadcast:a,presence:o,private:l}}=this.params,c=(i=(n=this.bindings.postgres_changes)===null||n===void 0?void 0:n.map(h=>h.filter))!==null&&i!==void 0?i:[],u=!!this.bindings[pd.PRESENCE]&&this.bindings[pd.PRESENCE].length>0||((s=this.params.config.presence)===null||s===void 0?void 0:s.enabled)===!0,d={},f={broadcast:a,presence:Object.assign(Object.assign({},o),{enabled:u}),postgres_changes:c,private:l};this.socket.accessTokenValue&&(d.access_token=this.socket.accessTokenValue),this._onError(h=>e==null?void 0:e(ts.CHANNEL_ERROR,h)),this._onClose(()=>e==null?void 0:e(ts.CLOSED)),this.updateJoinPayload(Object.assign({config:f},d)),this.joinedOnce=!0,this._rejoin(r),this.joinPush.receive("ok",async({postgres_changes:h})=>{var p;if(this.socket._isManualToken()||this.socket.setAuth(),h===void 0){e==null||e(ts.SUBSCRIBED);return}else{const g=this.bindings.postgres_changes,m=(p=g==null?void 0:g.length)!==null&&p!==void 0?p:0,v=[];for(let y=0;y<m;y++){const b=g[y],{filter:{event:w,schema:S,table:T,filter:_}}=b,A=h&&h[y];if(A&&A.event===w&&$l.isFilterValueEqual(A.schema,S)&&$l.isFilterValueEqual(A.table,T)&&$l.isFilterValueEqual(A.filter,_))v.push(Object.assign(Object.assign({},b),{id:A.id}));else{this.unsubscribe(),this.state=Ht.errored,e==null||e(ts.CHANNEL_ERROR,new Error("mismatch between server and client bindings for postgres changes"));return}}this.bindings.postgres_changes=v,e&&e(ts.SUBSCRIBED);return}}).receive("error",h=>{this.state=Ht.errored,e==null||e(ts.CHANNEL_ERROR,new Error(JSON.stringify(Object.values(h).join(", ")||"error")))}).receive("timeout",()=>{e==null||e(ts.TIMED_OUT)})}return this}presenceState(){return this.presence.state}async track(e,r={}){return await this.send({type:"presence",event:"track",payload:e},r.timeout||this.timeout)}async untrack(e={}){return await this.send({type:"presence",event:"untrack"},e)}on(e,r,n){return this.state===Ht.joined&&e===pd.PRESENCE&&(this.socket.log("channel",`resubscribe to ${this.topic} due to change in presence callbacks on joined channel`),this.unsubscribe().then(async()=>await this.subscribe())),this._on(e,r,n)}async httpSend(e,r,n={}){var i;if(r==null)return Promise.reject("Payload is required for httpSend()");const s={apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"};this.socket.accessTokenValue&&(s.Authorization=`Bearer ${this.socket.accessTokenValue}`);const a={method:"POST",headers:s,body:JSON.stringify({messages:[{topic:this.subTopic,event:e,payload:r,private:this.private}]})},o=await this._fetchWithTimeout(this.broadcastEndpointURL,a,(i=n.timeout)!==null&&i!==void 0?i:this.timeout);if(o.status===202)return{success:!0};let l=o.statusText;
215try{const c=await o.json();l=c.error||c.message||l}catch{}return Promise.reject(new Error(l))}async send(e,r={}){var n,i;if(!this._canPush()&&e.type==="broadcast"){console.warn("Realtime send() is automatically falling back to REST API. This behavior will be deprecated in the future. Please use httpSend() explicitly for REST delivery.");const{event:s,payload:a}=e,o={apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"};this.socket.accessTokenValue&&(o.Authorization=`Bearer ${this.socket.accessTokenValue}`);const l={method:"POST",headers:o,body:JSON.stringify({messages:[{topic:this.subTopic,event:s,payload:a,private:this.private}]})};try{const c=await this._fetchWithTimeout(this.broadcastEndpointURL,l,(n=r.timeout)!==null&&n!==void 0?n:this.timeout);return await((i=c.body)===null||i===void 0?void 0:i.cancel()),c.ok?"ok":"error"}catch(c){return c.name==="AbortError"?"timed out":"error"}}else return new Promise(s=>{var a,o,l;const c=this._push(e.type,e,r.timeout||this.timeout);e.type==="broadcast"&&!(!((l=(o=(a=this.params)===null||a===void 0?void 0:a.config)===null||o===void 0?void 0:o.broadcast)===null||l===void 0)&&l.ack)&&s("ok"),c.receive("ok",()=>s("ok")),c.receive("error",()=>s("error")),c.receive("timeout",()=>s("timed out"))})}updateJoinPayload(e){this.joinPush.updatePayload(e)}unsubscribe(e=this.timeout){this.state=Ht.leaving;const r=()=>{this.socket.log("channel",`leave ${this.topic}`),this._trigger(ei.close,"leave",this._joinRef())};this.joinPush.destroy();let n=null;return new Promise(i=>{n=new h0(this,ei.leave,{},e),n.receive("ok",()=>{r(),i("ok")}).receive("timeout",()=>{r(),i("timed out")}).receive("error",()=>{i("error")}),n.send(),this._canPush()||n.trigger("ok",{})}).finally(()=>{n==null||n.destroy()})}teardown(){this.pushBuffer.forEach(e=>e.destroy()),this.pushBuffer=[],this.rejoinTimer.reset(),this.joinPush.destroy(),this.state=Ht.closed,this.bindings={}}async _fetchWithTimeout(e,r,n){const i=new AbortController,s=setTimeout(()=>i.abort(),n),a=await this.socket.fetch(e,Object.assign(Object.assign({},r),{signal:i.signal}));return clearTimeout(s),a}_push(e,r,n=this.timeout){if(!this.joinedOnce)throw`tried to push '${e}' to '${this.topic}' before joining. Use channel.subscribe() before pushing events`;let i=new h0(this,e,r,n);return this._canPush()?i.send():this._addToPushBuffer(i),i}_addToPushBuffer(e){if(e.startTimeout(),this.pushBuffer.push(e),this.pushBuffer.length>xz){const r=this.pushBuffer.shift();r&&(r.destroy(),this.socket.log("channel",`discarded push due to buffer overflow: ${r.event}`,r.payload))}}_onMessage(e,r,n){return r}_isMember(e){return this.topic===e}_joinRef(){return this.joinPush.ref}_trigger(e,r,n){var i,s;const a=e.toLocaleLowerCase(),{close:o,error:l,leave:c,join:u}=ei;if(n&&[o,l,c,u].indexOf(a)>=0&&n!==this._joinRef())return;let f=this._onMessage(a,r,n);if(r&&!f)throw"channel onMessage callbacks must return the payload, modified or unmodified";["insert","update","delete"].includes(a)?(i=this.bindings.postgres_changes)===null||i===void 0||i.filter(h=>{var p,g,m;return((p=h.filter)===null||p===void 0?void 0:p.event)==="*"||((m=(g=h.filter)===null||g===void 0?void 0:g.event)===null||m===void 0?void 0:m.toLocaleLowerCase())===a}).map(h=>h.callback(f,n)):(s=this.bindings[a])===null||s===void 0||s.filter(h=>{var p,g,m,v,y,b;if(["broadcast","presence","postgres_changes"].includes(a))if("id"in h){const w=h.id,S=(p=h.filter)===null||p===void 0?void 0:p.event;return w&&((g=r.ids)===null||g===void 0?void 0:g.includes(w))&&(S==="*"||(S==null?void 0:S.toLocaleLowerCase())===((m=r.data)===null||m===void 0?void 0:m.type.toLocaleLowerCase()))}else{const w=(y=(v=h==null?void 0:h.filter)===null||v===void 0?void 0:v.event)===null||y===void 0?void 0:y.toLocaleLowerCase();return w==="*"||w===((b=r==null?void 0:r.event)===null||b===void 0?void 0:b.toLocaleLowerCase())}else return h.type.toLocaleLowerCase()===a}).map(h=>{if(typeof f=="object"&&"ids"in f){const p=f.data,{schema:g,table:m,commit_timestamp:v,type:y,errors:b}=p;f=Object.assign(Object.assign({},{schema:g,table:m,commit_timestamp:v,eventType:y,new:{},old:{},errors:b}),this._getPayloadRecords(p))}h.callback(f,n)})}_isClosed(){return this.state===Ht.closed}_isJoined(){return this.state===Ht.joined}_isJoining(){return this.state===Ht.joining}_isLeaving(){return this.state===Ht.leaving}_replyEventName(e){return`chan_reply_${e}`}_on(e,r,n){const i=e.toLocaleLowerCase(),s={type:i,filter:r,callback:n};return this.bindings[i]?this.bindings[i].push(s):this.bindings[i]=[s],this}_off(e,r){const n=e.toLocaleLowerCase();return this.bindings[n]&&(this.bindings[n]=this.bindings[n].filter(i=>{var s;return!(((s=i.type)===null||s===void 0?void 0:s.toLocaleLowerCase())===n&&$l.isEqual(i.filter,r))})),this}static isEqual(e,r){if(Object.keys(e).length!==Object.keys(r).length)return!1;for(const n in e)if(e[n]!==r[n])return!1;return!0}static isFilterValueEqual(e,r){return(e??void 0)===(r??void 0)}_rejoinUntilConnected(){this.rejoinTimer.scheduleTimeout(),this.socket.isConnected()&&this._rejoin()}_onClose(e){this._on(ei.close,{},e)}_onError(e){this._on(ei.error,{},r=>e(r))}_canPush(){return this.socket.isConnected()&&this._isJoined()}_rejoin(e=this.timeout){this._isLeaving()||(this.socket._leaveOpenTopic(this.topic),this.state=Ht.joining,this.joinPush.resend(e))}_getPayloadRecords(e){const r={new:{},old:{}};return(e.type==="INSERT"||e.type==="UPDATE")&&(r.new=EP(e.columns,e.record)),(e.type==="UPDATE"||e.type==="DELETE")&&(r.old=EP(e.columns,e.old_record)),r}}const p0=()=>{},Gh={HEARTBEAT_INTERVAL:25e3,RECONNECT_DELAY:10,HEARTBEAT_TIMEOUT_FALLBACK:100},Iz=[1e3,2e3,5e3,1e4],Cz=1e4,Oz=`
216  addEventListener("message", (e) => {
217    if (e.data.event === "start") {
218      setInterval(() => postMessage({ event: "keepAlive" }), e.data.interval);
219    }
220  });`;class Rz{constructor(e,r){var n;if(this.accessTokenValue=null,this.apiKey=null,this._manuallySetToken=!1,this.channels=new Array,this.endPoint="",this.httpEndpoint="",this.headers={},this.params={},this.timeout=Yx,this.transport=null,this.heartbeatIntervalMs=Gh.HEARTBEAT_INTERVAL,this.heartbeatTimer=void 0,this.pendingHeartbeatRef=null,this.heartbeatCallback=p0,this.ref=0,this.reconnectTimer=null,this.vsn=SP,this.logger=p0,this.conn=null,this.sendBuffer=[],this.serializer
220=new wz,this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.accessToken=null,this._connectionState="disconnected",this._wasManualDisconnect=!1,this._authPromise=null,this._heartbeatSentAt=null,this._resolveFetch=i=>i?(...s)=>i(...s):(...s)=>fetch(...s),!(!((n=r==null?void 0:r.params)===null||n===void 0)&&n.apikey))throw new Error("API key is required to connect to Realtime");this.apiKey=r.params.apikey,this.endPoint=`${e}/${Xx.websocket}`,this.httpEndpoint=E$(e),this._initializeOptions(r),this._setupReconnectionTimer(),this.fetch=this._resolveFetch(r==null?void 0:r.fetch)}connect(){if(!(this.isConnecting()||this.isDisconnecting()||this.conn!==null&&this.isConnected())){if(this._setConnectionState("connecting"),this.accessToken&&!this._authPromise&&this._setAuthSafely("connect"),this.transport)this.conn=new this.transport(this.endpointURL());else try{this.conn=mz.createWebSocket(this.endpointURL())}catch(e){this._setConnectionState("disconnected");const r=e.message;throw r.includes("Node.js")?new Error(`${r}
221
222To use Realtime in Node.js, you need to provide a WebSocket implementation:
223
224Option 1: Use Node.js 22+ which has native WebSocket support
225Option 2: Install and provide the "ws" package:
226
227  npm install ws
228
229  import ws from "ws"
230  const client = new RealtimeClient(url, {
231    ...options,
232    transport: ws
233  })`):new Error(`WebSocket not available: ${r}`)}this._setupConnectionHandlers()}}endpointURL(){return this._appendParams(this.endPoint,Object.assign({},this.params,{vsn:this.vsn}))}disconnect(e,r){if(!this.isDisconnecting())if(this._setConnectionState("disconnecting",!0),this.conn){const n=setTimeout(()=>{this._setConnectionState("disconnected")},100);this.conn.onclose=()=>{clearTimeout(n),this._setConnectionState("disconnected")},typeof this.conn.close=="function"&&(e?this.conn.close(e,r??""):this.conn.close()),this._teardownConnection()}else this._setConnectionState("disconnected")}getChannels(){return this.channels}async removeChannel(e){const r=await e.unsubscribe();return this.channels.length===0&&this.disconnect(),r}async removeAllChannels(){const e=await Promise.all(this.channels.map(r=>r.unsubscribe()));return this.channels=[],this.disconnect(),e}log(e,r,n){this.logger(e,r,n)}connectionState(){switch(this.conn&&this.conn.readyState){case Ks.connecting:return no.Connecting;case Ks.open:return no.Open;case Ks.closing:return no.Closing;default:return no.Closed}}isConnected(){return this.connectionState()===no.Open}isConnecting(){return this._connectionState==="connecting"}isDisconnecting(){return this._connectionState==="disconnecting"}channel(e,r={config:{}}){const n=`realtime:${e}`,i=this.getChannels().find(s=>s.topic===n);if(i)return i;{const s=new $l(`realtime:${e}`,r,this);return this.channels.push(s),s}}push(e){const{topic:r,event:n,payload:i,ref:s}=e,a=()=>{this.encode(e,o=>{var l;(l=this.conn)===null||l===void 0||l.send(o)})};this.log("push",`${r} ${n} (${s})`,i),this.isConnected()?a():this.sendBuffer.push(a)}async setAuth(e=null){this._authPromise=this._performAuth(e);try{await this._authPromise}finally{this._authPromise=null}}_isManualToken(){return this._manuallySetToken}async sendHeartbeat(){var e;if(!this.isConnected()){try{this.heartbeatCallback("disconnected")}catch(r){this.log("error","error in heartbeat callback",r)}return}if(this.pendingHeartbeatRef){this.pendingHeartbeatRef=null,this._heartbeatSentAt=null,this.log("transport","heartbeat timeout. Attempting to re-establish connection");try{this.heartbeatCallback("timeout")}catch(r){this.log("error","error in heartbeat callback",r)}this._wasManualDisconnect=!1,(e=this.conn)===null||e===void 0||e.close(bz,"heartbeat timeout"),setTimeout(()=>{var r;this.isConnected()||(r=this.reconnectTimer)===null||r===void 0||r.sc
233heduleTimeout()},Gh.HEARTBEAT_TIMEOUT_FALLBACK);return}this._heartbeatSentAt=Date.now(),this.pendingHeartbeatRef=this._makeRef(),this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:this.pendingHeartbeatRef});try{this.heartbeatCallback("sent")}catch(r){this.log("error","error in heartbeat callback",r)}this._setAuthSafely("heartbeat")}onHeartbeat(e){this.heartbeatCallback=e}flushSendBuffer(){this.isConnected()&&this.sendBuffer.length>0&&(this.sendBuffer.forEach(e=>e()),this.sendBuffer=[])}_makeRef(){let e=this.ref+1;return e===this.ref?this.ref=0:this.ref=e,this.ref.toString()}_leaveOpenTopic(e){let r=this.channels.find(n=>n.topic===e&&(n._isJoined()||n._isJoining()));r&&(this.log("transport",`leaving duplicate topic "${e}"`),r.unsubscribe())}_remove(e){this.channels=this.channels.filter(r=>r.topic!==e.topic)}_onConnMessage(e){this.decode(e.data,r=>{if(r.topic==="phoenix"&&r.event==="phx_reply"&&r.ref&&r.ref===this.pendingHeartbeatRef){const c=this._heartbeatSentAt?Date.now()-this._heartbeatSentAt:void 0;try{this.heartbeatCallback(r.payload.status==="ok"?"ok":"error",c)}catch(u){this.log("error","error in heartbeat callback",u)}this._heartbeatSentAt=null,this.pendingHeartbeatRef=null}const{topic:n,event:i,payload:s,ref:a}=r,o=a?`(${a})`:"",l=s.status||"";this.log("receive",`${l} ${n} ${i} ${o}`.trim(),s),this.channels.filter(c=>c._isMember(n)).forEach(c=>c._trigger(i,s,a)),this._triggerStateCallbacks("message",r)})}_clearTimer(e){var r;e==="heartbeat"&&this.heartbeatTimer?(clearInterval(this.heartbeatTimer),this.heartbeatTimer=void 0):e==="reconnect"&&((r=this.reconnectTimer)===null||r===void 0||r.reset())}_clearAllTimers(){this._clearTimer("heartbeat"),this._clearTimer("reconnect")}_setupConnectionHandlers(){this.conn&&("binaryType"in this.conn&&(this.conn.binaryType="arraybuffer"),this.conn.onopen=()=>this._onConnOpen(),this.conn.onerror=e=>this._onConnError(e),this.conn.onmessage=e=>this._onConnMessage(e),this.conn.onclose=e=>this._onConnClose(e),this.conn.readyState===Ks.open&&this._onConnOpen())}_teardownConnection(){if(this.conn){if(this.conn.readyState===Ks.open||this.conn.readyState===Ks.connecting)try{this.conn.close()}catch(e){this.log("error","Error closing connection",e)}this.conn.onopen=null,this.conn.onerror=null,this.conn.onmessage=null,this.conn.onclose=null,this.conn=null}this._clearAllTimers(),this._terminateWorker(),this.channels.forEach(e=>e.teardown())}_onConnOpen(){this._setConnectionState("connected"),this.log("transport",`connected to ${this.endpointURL()}`),(this._authPromise||(this.accessToken&&!this.accessTokenValue?this.setAuth():Promise.resolve())).then(()=>{this.accessTokenValue&&(this.channels.forEach(r=>{r.updateJoinPayload({access_token:this.accessTokenValue})}),this.sendBuffer=[],this.channels.forEach(r=>{r._isJoining()&&(r.joinPush.sent=!1,r.joinPush.send())})),this.flushSendBuffer()}).catch(r=>{this.log("error","error waiting for auth on connect",r),this.flushSendBuffer()}),this._clearTimer("reconnect"),this.worker?this.workerRef||this._startWorkerHeartbeat():this._startHeartbeat(),this._triggerStateCallbacks("open")}_startHeartbeat(){this.heartbeatTimer&&clearInterval(this.heartbeatTimer),this.heartbeatTimer=setInterval(()=>this.sendHeartbeat(),this.heartbeatIntervalMs)}_startWorkerHeartbeat(){this.workerUrl?this.log("worker",`starting worker for from ${this.workerUrl}`):this.log("worker","starting default worker");const e=this._workerObjectUrl(this.workerUrl);this.workerRef=new Worker(e),this.workerRef.onerror=r=>{this.log("worker","worker error",r.message),this._terminateWorker()},this.workerRef.onmessage=r=>{r.data.event==="keepAlive"&&this.sendHeartbeat()},this.workerRef.postMessage({event:"start",interval:this.heartbeatIntervalMs})}_terminateWorker(){this.workerRef&&(this.log("worker","terminating worker"),this.workerRef.terminate(),this.workerRef=void 0)}_onConnClose(e){var r;this._setConnectionState("disconnected"),this.log("transport","close",e),this._triggerChanError(),this._clearTimer("heartbeat"),this._wasManualDisconnect||(r=this.reconnectTimer)===null||r===void 0||r.sc
233heduleTimeout(),this._triggerStateCallbacks("close",e)}_onConnError(e){this._setConnectionState("disconnected"),this.log("transport",`${e}`),this._triggerChanError(),this._triggerStateCallbacks("error",e);try{this.heartbeatCallback("error")}catch(r){this.log("error","error in heartbeat callback",r)}}_triggerChanError(){this.channels.forEach(e=>e._trigger(ei.error))}_appendParams(e,r){if(Object.keys(r).length===0)return e;const n=e.match(/\?/)?"&":"?",i=new URLSearchParams(r);return`${e}${n}${i}`}_workerObjectUrl(e){let r;if(e)r=e;else{const n=new Blob([Oz],{type:"application/javascript"});r=URL.createObjectURL(n)}return r}_setConnectionState(e,r=!1){this._connectionState=e,e==="connecting"?this._wasManualDisconnect=!1:e==="disconnecting"&&(this._wasManualDisconnect=r)}async _performAuth(e=null){let r,n=!1;if(e)r=e,n=!0;else if(this.accessToken)try{r=await this.accessToken()}catch(i){this.log("error","Error fetching access token from callback",i),r=this.accessTokenValue}else r=this.accessTokenValue;n?this._manuallySetToken=!0:this.accessToken&&(this._manuallySetToken=!1),this.accessTokenValue!=r&&(this.accessTokenValue=r,this.channels.forEach(i=>{const s={access_token:r,version:vz};r&&i.updateJoinPayload(s),i.joinedOnce&&i._isJoined()&&i._push(ei.access_token,{access_token:r})}))}async _waitForAuthIfNeeded(){this._authPromise&&await this._authPromise}_setAuthSafely(e="general"){this._isManualToken()||this.setAuth().catch(r=>{this.log("error",`Error setting auth in ${e}`,r)})}_triggerStateCallbacks(e,r){try{this.stateChangeCallbacks[e].forEach(n=>{try{n(r)}catch(i){this.log("error",`error in ${e} callback`,i)}})}catch(n){this.log("error",`error triggering ${e} callbacks`,n)}}_setupReconnectionTimer(){this.reconnectTimer=new w$(async()=>{setTimeout(async()=>{await this._waitForAuthIfNeeded(),this.isConnected()||this.connect()},Gh.RECONNECT_DELAY)},this.reconnectAfterMs)}_initializeOptions(e){var r,n,i,s,a,o,l,c,u,d,f,h;switch(this.transport=(r=e==null?void 0:e.transport)!==null&&r!==void 0?r:null,this.timeout=(n=e==null?void 0:e.timeout)!==null&&n!==void 0?n:Yx,this.heartbeatIntervalMs=(i=e==null?void 0:e.heartbeatIntervalMs)!==null&&i!==void 0?i:Gh.HEARTBEAT_INTERVAL,this.worker=(s=e==null?void 0:e.worker)!==null&&s!==void 0?s:!1,this.accessToken=(a=e==null?void 0:e.accessToken)!==null&&a!==void 0?a:null,this.heartbeatCallback=(o=e==null?void 0:e.heartbeatCallback)!==null&&o!==void 0?o:p0,this.vsn=(l=e==null?void 0:e.vsn)!==null&&l!==void 0?l:SP,e!=null&&e.params&&(this.params=e.params),e!=null&&e.logger&&(this.logger=e.logger),(e!=null&&e.logLevel||e!=null&&e.log_level)&&(this.logLevel=e.logLevel||e.log_level,this.params=Object.assign(Object.assign({},this.params),{log_level:this.logLevel})),this.reconnectAfterMs=(c=e==null?void 0:e.reconnectAfterMs)!==null&&c!==void 0?c:p=>Iz[p-1]||Cz,this.vsn){case yz:this.encode=(u=e==null?void 0:e.encode)!==null&&u!==void 0?u:(p,g)=>g(JSON.stringify(p)),this.decode=(d=e==null?void 0:e.decode)!==null&&d!==void 0?d:(p,g)=>g(JSON.parse(p));break;case x$:this.encode=(f=e==null?void 0:e.encode)!==null&&f!==void 0?f:this.serializer.encode.bind(this.serializer),this.decode=(h=e==null?void 0:e.decode)!==null&&h!==void 0?h:this.serializer.decode.bind(this.serializer);break;default:throw new Error(`Unsupported serializer version: ${this.vsn}`)}if(this.worker){if(typeof window<"u"&&!window.Worker)throw new Error("Web Worker is not supported");this.workerUrl=e==null?void 0:e.workerUrl}}}var zd=class extends Error{constructor(t,e){var r;super(t),this.name="IcebergError",this.status=e.status,this.icebergType=e.icebergType,this.icebergCode=e.icebergCode,this.details=e.details,this.isCommitStateUnknown=e.icebergType==="CommitStateUnknownException"||[500,502,504].includes(e.status)&&((r=e.icebergType)==null?void 0:r.includes("CommitState"))===!0}isNotFound(){return this.status===404}isConflict(){return this.status===409}isAuthenticationTimeout(){return this.status===419}};function kz(t,e,r){const n=new URL(e,t);if(r)for(const[i,s]of Object.entries(r))s!==void 0&&n.searchParams.set(i,s);return n.toString()}async function Lz(t){return!t||t.type==="none"?{}:t.type==="bearer"?{Authorization:`Bearer ${t.token}`}:t.type==="header"?{[t.name]:t.value}:t.type==="custom"?await t.getHeaders():{}}function Dz(t){const e=t.fetchImpl??globalThis.fetch;return{async request({method:r,path:n,query:i,body:s,headers:a}){const o=kz(t.baseUrl,n,i),l=await Lz(t.auth),c=await e(o,{method:r,headers:{...s?{"Content-Type":"application/json"}:{},...l,...a},body:s?JSON.stringify(s):void 0}),u=await c.text(),d=(c.headers.get("content-type")||"").includes("application/json"),f=d&&u?JSON.parse(u):u;if(!c.ok){const h=d?f:void 0,p=h==null?void 0:h.error;throw new zd((p==null?void 0:p.message)??`Request failed with status ${c.status}`,{status:c.status,icebergType:p==null?void 0:p.type,icebergCode:p==null?void 0:p.code,details:h})}return{status:c.status,headers:c.headers,data:f}}}}function Wh(t){return t.join("�")}var Nz=class{constructor(t,e=""){this.client=t,this.prefix=e}async listNamespaces(t){const e=t?{parent:Wh(t.namespace)}:void 0;return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces`,query:e})).data.namespaces.map(n=>({namespace:n}))}async createNamespace(t,e){const r={namespace:t.namespace,properties:e==null?void 0:e.properties};return(await this.client.request({method:"POST",path:`${this.prefix}/namespaces`,body:r})).data}async dropNamespace(t){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${Wh(t.namespace)}`})}async loadNamespaceMetadata(t){return{properties:(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${Wh(t.namespace)}`})).data.properties}}async namespaceExists(t){try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${Wh(t.namespace)}`}),!0}catch(e){if(e instanceof zd&&e.status===404)return!1;throw e}}async createNamespaceIfNotExists(t,e){try{return await this.createNamespace(t,e)}catch(r){if(r instanceof zd&&r.status===409)return;throw r}}};function rl(t){return t.join("�")}var Mz=class{constructor(t,e="",r){this.client=t,this.prefix=e,this.accessDelegation=r}async listTables(t){return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${rl(t.namespace)}/tables`})).data.identifiers}async createTable(t,e){const r={};return this.accessDelegation&&(r["X-Iceberg-Access-Delegation"]=this.accessDelegation),(await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${rl(t.namespace)}/tables`,body:e,headers:r})).data.metadata}async updateTable(t,e){const r=await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${rl(t.namespace)}
233/tables/${t.name}`,body:e});return{"metadata-location":r.data["metadata-location"],metadata:r.data.metadata}}async dropTable(t,e){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${rl(t.namespace)}/tables/${t.name}`,query:{purgeRequested:String((e==null?void 0:e.purge)??!1)}})}async loadTable(t){const e={};return this.accessDelegation&&(e["X-Iceberg-Access-Delegation"]=this.accessDelegation),(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${rl(t.namespace)}/tables/${t.name}`,headers:e})).data.metadata}async tableExists(t){const e={};this.accessDelegation&&(e["X-Iceberg-Access-Delegation"]=this.accessDelegation);try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${rl(t.namespace)}/tables/${t.name}`,headers:e}),!0}catch(r){if(r instanceof zd&&r.status===404)return!1;throw r}}async createTableIfNotExists(t,e){try{return await this.createTable(t,e)}catch(r){if(r instanceof zd&&r.status===409)return await this.loadTable({namespace:t.namespace,name:e.name});throw r}}},$z=class{constructor(t){var n;let e="v1";t.catalogName&&(e+=`/${t.catalogName}`);const r=t.baseUrl.endsWith("/")?t.baseUrl:`${t.baseUrl}/`;this.client=Dz({baseUrl:r,auth:t.auth,fetchImpl:t.fetch}),this.accessDelegation=(n=t.accessDelegation)==null?void 0:n.join(","),this.namespaceOps=new Nz(this.client,e),this.tableOps=new Mz(this.client,e,this.accessDelegation)}async listNamespaces(t){return this.namespaceOps.listNamespaces(t)}async createNamespace(t,e){return this.namespaceOps.createNamespace(t,e)}async dropNamespace(t){await this.namespaceOps.dropNamespace(t)}async loadNamespaceMetadata(t){return this.namespaceOps.loadNamespaceMetadata(t)}async listTables(t){return this.tableOps.listTables(t)}async createTable(t,e){return this.tableOps.createTable(t,e)}async updateTable(t,e){return this.tableOps.updateTable(t,e)}async dropTable(t,e){await this.tableOps.dropTable(t,e)}async loadTable(t){return this.tableOps.loadTable(t)}async namespaceExists(t){return this.namespaceOps.namespaceExists(t)}async tableExists(t){return this.tableOps.tableExists(t)}async createNamespaceIfNotExists(t,e){return this.namespaceOps.createNamespaceIfNotExists(t,e)}async createTableIfNotExists(t,e){return this.tableOps.createTableIfNotExists(t,e)}},Av=class extends Error{constructor(t,e="storage",r,n){super(t),this.__isStorageError=!0,this.namespace=e,this.name=e==="vectors"?"StorageVectorsError":"StorageError",this.status=r,this.statusCode=n}};function Pv(t){return typeof t=="object"&&t!==null&&"__isStorageError"in t}var Ju=class extends Av{constructor(t,e,r,n="storage"){super(t,n,e,r),this.name=n==="vectors"?"StorageVectorsApiError":"StorageApiError",this.status=e,this.statusCode=r}toJSON(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}}},T$=class extends Av{constructor(t,e,r="storage"){super(t,r),this.name=r==="vectors"?"StorageVectorsUnknownError":"StorageUnknownError",this.originalError=e}};const jz=t=>t?(...e)=>t(...e):(...e)=>fetch(...e),Fz=t=>{if(typeof t!="object"||t===null)return!1;const e=Object.getPrototypeOf(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)},Jx=t=>{if(Array.isArray(t))return t.map(r=>Jx(r));if(typeof t=="function"||t!==Object(t))return t;const e={};return Object.entries(t).forEach(([r,n])=>{const i=r.replace(/([-_][a-z])/gi,s=>s.toUpperCase().replace(/[-_]/g,""));e[i]=Jx(n)}),e},Bz=t=>!t||typeof t!="string"||t.length===0||t.length>100||t.trim()!==t||t.includes("/")||t.includes("\\")?!1:/^[\w!.\*'() &$@=;:+,?-]+$/.test(t);function qd(t){"@babel/helpers - typeof";return qd=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},qd(t)}function Uz(t,e){if(qd(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(qd(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Gz(t){var e=Uz(t,"string");return qd(e)=="symbol"?e:e+""}function Wz(t,e,r){return(e=Gz(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function AP(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function pe(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};
233e%2?AP(Object(r),!0).forEach(function(n){Wz(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):AP(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}const PP=t=>{var e;return t.msg||t.message||t.error_description||(typeof t.error=="string"?t.error:(e=t.error)===null||e===void 0?void 0:e.message)||JSON.stringify(t)},Vz=async(t,e,r,n)=>{if(t&&typeof t=="object"&&"status"in t&&"ok"in t&&typeof t.status=="number"){const i=t,s=i.status||500;if(typeof i.json=="function")i.json().then(a=>{const o=(a==null?void 0:a.statusCode)||(a==null?void 0:a.code)||s+"";e(new Ju(PP(a),s,o,n))}).catch(()=>{if(n==="vectors"){const a=s+"";e(new Ju(i.statusText||`HTTP ${s} error`,s,a,n))}else{const a=s+"";e(new Ju(i.statusText||`HTTP ${s} error`,s,a,n))}});else{const a=s+"";e(new Ju(i.statusText||`HTTP ${s} error`,s,a,n))}}else e(new T$(PP(t),t,n))},Hz=(t,e,r,n)=>{const i={method:t,headers:(e==null?void 0:e.headers)||{}};return t==="GET"||t==="HEAD"||!n?pe(pe({},i),r):(Fz(n)?(i.headers=pe({"Content-Type":"application/json"},e==null?void 0:e.headers),i.body=JSON.stringify(n)):i.body=n,e!=null&&e.duplex&&(i.duplex=e.duplex),pe(pe({},i),r))};async function Lu(t,e,r,n,i,s,a){return new Promise((o,l)=>{t(r,Hz(e,n,i,s)).then(c=>{if(!c.ok)throw c;if(n!=null&&n.noResolveJson)return c;if(a==="vectors"){const u=c.headers.get("content-type");if(c.headers.get("content-length")==="0"||c.status===204)return{};if(!u||!u.includes("application/json"))return{}}return c.json()}).then(c=>o(c)).catch(c=>Vz(c,l,n,a))})}function _$(t="storage"){return{get:async(e,r,n,i)=>Lu(e,"GET",r,n,i,void 0,t),post:async(e,r,n,i,s)=>Lu(e,"POST",r,i,s,n,t),put:async(e,r,n,i,s)=>Lu(e,"PUT",r,i,s,n,t),head:async(e,r,n,i)=>Lu(e,"HEAD",r,pe(pe({},n),{},{noResolveJson:!0}),i,void 0,t),remove:async(e,r,n,i,s)=>Lu(e,"DELETE",r,i,s,n,t)}}const Kz=_$("storage"),{get:Yd,post:Yn,put:Zx,head:zz,remove:wT}=Kz,on=_$("vectors");var lu=class{constructor(t,e={},r,n="storage"){this.shouldThrowOnError=!1,this.url=t,this.headers=e,this.fetch=jz(r),this.namespace=n}throwOnError(){return this.shouldThrowOnError=!0,this}setHeader(t,e){return this.headers=pe(pe({},this.headers),{},{[t]:e}),this}async handleOperation(t){var e=this;try{return{data:await t(),error:null}}catch(r){if(e.shouldThrowOnError)throw r;if(Pv(r))return{data:null,error:r};throw r}}},qz=class{constructor(t,e){this.downloadFn=t,this.shouldThrowOnError=e}then(t,e){return this.execute().then(t,e)}async execute(){var t=this;try{return{data:(await t.downloadFn()).body,error:null}}catch(e){if(t.shouldThrowOnError)throw e;if(Pv(e))return{data:null,error:e};throw e}}};let A$;A$=Symbol.toStringTag;var Yz=class{constructor(t,e){this.downloadFn=t,this.shouldThrowOnError=e,this[A$]="BlobDownloadBuilder",this.promise=null}asStream(){return new qz(this.downloadFn,this.shouldThrowOnError)}then(t,e){return this.getPromise().then(t,e)}catch(t){return this.getPromise().catch(t)}finally(t){return this.getPromise().finally(t)}getPromise(){return this.promise||(this.promise=this.execute()),this.promise}async execute(){var t=this;try{return{data:await(await t.downloadFn()).blob(),error:null}}catch(e){if(t.shouldThrowOnError)throw e;if(Pv(e))return{data:null,error:e};throw e}}};const Xz={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},IP={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1};var Qz=class extends lu{constructor(t,e={},r,n){super(t,e,n,"storage"),this.bucketId=r}async uploadOrUpdate(t,e,r,n){var i=this;return i.handleOperation(async()=>{let s;const a=pe(pe({},IP),n);let o=pe(pe({},i.headers),t==="POST"&&{"x-upsert":String(a.upsert)});const l=a.metadata;typeof Blob<"u"&&r instanceof Blob?(s=new FormData,s.append("cacheControl",a.cacheControl),l&&s.append("metadata",i.encodeMetadata(l)),s.append("",r)):typeof FormData<"u"&&r instanceof FormData?(s=r,s.has("cacheControl")||s.append("cacheControl",a.cacheControl),l&&!s.has("metadata")&&s.append("metadata",i.encodeMetadata(l))):(s=r,o["cache-control"]=`max-age=${a.cacheControl}`,o["content-type"]=a.contentType,l&&(o["x-metadata"]=i.toBase64(i.encodeMetadata(l))),(typeof ReadableStream<"u"&&s instanceof ReadableStream||s&&typeof s=="object"&&"pipe"in s&&typeof s.pipe=="function")&&!a.duplex&&(a.duplex="half")),n!=null&&n.headers&&(o=pe(pe({},o),n.headers));const c=i._removeEmptyFolders(e),u=i._getFinalPath(c),d=await(t=="PUT"?Zx:Yn)(i.fetch,`${i.url}/object/${u}`,s,pe({headers:o},a!=null&&a.duplex?{duplex:a.duplex}:{}));return{path:c,id:d.Id,fullPath:d.Key}})}async upload(t,e,r){return this.uploadOrUpdate("POST",t,e,r)}
233async uploadToSignedUrl(t,e,r,n){var i=this;const s=i._removeEmptyFolders(t),a=i._getFinalPath(s),o=new URL(i.url+`/object/upload/sign/${a}`);return o.searchParams.set("token",e),i.handleOperation(async()=>{let l;const c=pe({upsert:IP.upsert},n),u=pe(pe({},i.headers),{"x-upsert":String(c.upsert)});return typeof Blob<"u"&&r instanceof Blob?(l=new FormData,l.append("cacheControl",c.cacheControl),l.append("",r)):typeof FormData<"u"&&r instanceof FormData?(l=r,l.append("cacheControl",c.cacheControl)):(l=r,u["cache-control"]=`max-age=${c.cacheControl}`,u["content-type"]=c.contentType),{path:s,fullPath:(await Zx(i.fetch,o.toString(),l,{headers:u})).Key}})}async createSignedUploadUrl(t,e){var r=this;return r.handleOperation(async()=>{let n=r._getFinalPath(t);const i=pe({},r.headers);e!=null&&e.upsert&&(i["x-upsert"]="true");const s=await Yn(r.fetch,`${r.url}/object/upload/sign/${n}`,{},{headers:i}),a=new URL(r.url+s.url),o=a.searchParams.get("token");if(!o)throw new Av("No token returned by API");return{signedUrl:a.toString(),path:t,token:o}})}async update(t,e,r){return this.uploadOrUpdate("PUT",t,e,r)}async move(t,e,r){var n=this;return n.handleOperation(async()=>await Yn(n.fetch,`${n.url}/object/move`,{bucketId:n.bucketId,sourceKey:t,destinationKey:e,destinationBucket:r==null?void 0:r.destinationBucket},{headers:n.headers}))}async copy(t,e,r){var n=this;return n.handleOperation(async()=>({path:(await Yn(n.fetch,`${n.url}/object/copy`,{bucketId:n.bucketId,sourceKey:t,destinationKey:e,destinationBucket:r==null?void 0:r.destinationBucket},{headers:n.headers})).Key}))}async createSignedUrl(t,e,r){var n=this;return n.handleOperation(async()=>{let i=n._getFinalPath(t),s=await Yn(n.fetch,`${n.url}/object/sign/${i}`,pe({expiresIn:e},r!=null&&r.transform?{transform:r.transform}:{}),{headers:n.headers});const a=r!=null&&r.download?`&download=${r.download===!0?"":r.download}`:"",o=r!=null&&r.transform&&s.signedURL.includes("/object/sign/")?s.signedURL.replace("/object/sign/","/render/image/sign/"):s.signedURL;return{signedUrl:encodeURI(`${n.url}${o}${a}`)}})}async createSignedUrls(t,e,r){var n=this;return n.handleOperation(async()=>{const i=await Yn(n.fetch,`${n.url}/object/sign/${n.bucketId}`,{expiresIn:e,paths:t},{headers:n.headers}),s=r!=null&&r.download?`&download=${r.download===!0?"":r.download}`:"";return i.map(a=>pe(pe({},a),{},{signedUrl:a.signedURL?encodeURI(`${n.url}${a.signedURL}${s}`):null}))})}download(t,e,r){const n=typeof(e==null?void 0:e.transform)<"u"?"render/image/authenticated":"object",i=this.transformOptsToQueryString((e==null?void 0:e.transform)||{}),s=i?`?${i}`:"",a=this._getFinalPath(t),o=()=>Yd(this.fetch,`${this.url}/${n}/${a}${s}`,{headers:this.headers,noResolveJson:!0},r);return new Yz(o,this.shouldThrowOnError)}async info(t){var e=this;const r=e._getFinalPath(t);return e.handleOperation(async()=>Jx(await Yd(e.fetch,`${e.url}/object/info/${r}`,{headers:e.headers})))}async exists(t){var e=this;const r=e._getFinalPath(t);try{return await zz(e.fetch,`${e.url}/object/${r}`,{headers:e.headers}),{data:!0,error:null}}catch(i){if(e.shouldThrowOnError)throw i;if(Pv(i)){var n;const s=i instanceof Ju?i.status:i instanceof T$?(n=i.originalError)===null||n===void 0?void 0:n.status:void 0;if(s!==void 0&&[400,404].includes(s))return{data:!1,error:i}}throw i}}getPublicUrl(t,e){const r=this._getFinalPath(t),n=[],i=e!=null&&e.download?`download=${e.download===!0?"":e.download}`:"";i!==""&&n.push(i);const s=typeof(e==null?void 0:e.transform)<"u"?"render/image":"object",a=this.transformOptsToQueryString((e==null?void 0:e.transform)||{});a!==""&&n.push(a);let o=n.join("&");return o!==""&&(o=`?${o}`),{data:{publicUrl:encodeURI(`${this.url}/${s}/public/${r}${o}`)}}}async remove(t){var e=this;return e.handleOperation(async()=>await wT(e.fetch,`${e.url}/object/${e.bucketId}`,{prefixes:t},{headers:e.headers}))}async list(t,e,r){var n=this;return n.handleOperation(async()=>{const i=pe(pe(pe({},Xz),e),{},{prefix:t||""});return await Yn(n.fetch,`${n.url}/object/list/${n.bucketId}`,i,{headers:n.headers},r)})}async listV2(t,e){var r=this;return r.handleOperation(async()=>{const n=pe({},t);return await Yn(r.fetch,`${r.url}/object/list-v2/${r.bucketId}`,n,{headers:r.headers},e)})}encodeMetadata(t){return JSON.stringify(t)}toBase64(t){return typeof Buffer<"u"?Buffer.from(t).toString("base64"):btoa(t)}_getFinalPath(t){return`${this.bucketId}/${t.replace(/^\/+/,"")}`}_removeEmptyFolders(t){return t.replace(/^\/|\/$/g,"").replace(/\/+/g,"/")}transformOptsToQueryString(t){const e=[];return t.width&&e.push(`width=${t.width}`),t.height&&e.push(`height=${t.height}`),t.resize&&e.push(`resize=${t.resize}`),t.format&&e.push(`format=${t.format}`),t.quality&&e.push(`quality=${t.quality}`),e.join("&")}};const Jz="2.99.1",rh={"X-Client-Info":`storage-js/${Jz}`};var Zz=class extends lu{constructor(t,e={},r,n){const i=new URL(t);n!=null&&n.useNewHostname&&/supabase\.(co|in|red)$/.test(i.hostname)&&!i.hostname.includes("storage.supabase.")&&(i.hostname=i.hostname.replace("supabase.","storage.supabase."));const s=i.href.replace(/\/$/,""),a=pe(pe({},rh),e);super(s,a,r,"storage")}async listBuckets(t){var e=this;return e.handleOperation(async()=>{const r=e.listBucketOptionsToQueryString(t);return await Yd(e.fetch,`${e.url}/bucket${r}`,{headers:e.headers})})}async getBucket(t){var e=this;return e.handleOperation(async()=>await Yd(e.fetch,`${e.url}/bucket/${t}`,{headers:e.headers}))}async createBucket(t,e={public:!1}){var r=this;return r.handleOperation(async()=>await Yn(r.fetch,`${r.url}/bucket`,{id:t,name:t,type:e.type,public:e.public,file_size_limit:e.fileSizeLimit,allowed_mime_types:e.allowedMimeTypes},{headers:r.headers}))}async updateBucket(t,e){var r=this;return r.handleOperation(async()=>await Zx(r.fetch,`${r.url}/bucket/${t}`,{id:t,name:t,public:e.public,file_size_limit:e.fileSizeLimit,allowed_mime_types:e.allowedMimeTypes},{headers:r.headers}))}async emptyBucket(t){var e=this;return e.handleOperation(async()=>await Yn(e.fetch,`${e.url}/bucket/${t}/empty`,{},{headers:e.headers}))}async deleteBucket(t){var e=this;return e.handleOperation(async()=>await wT(e.fetch,`${e.url}/bucket/${t}`,{},{headers:e.headers}))}listBucketOptionsToQueryString(t){const e={};return t&&("limit"in t&&(e.limit=String(t.limit)),"offset"in t&&(e.offset=String(t.offset)),t.search&&(e.search=t.search),t.sortColumn&&(e.sortColumn=t.sortColumn),t.sortOrder&&(e.sortOrder=t.sortOrder)),Object.keys(e).length>0?"?"+new URLSearchParams(e).toString():""}},e9=class extends lu{constructor(t,e={},r){const n=t.replace(/\/$/,""),i=pe(pe({},rh),e);super(n,i,r,"storage")}async createBucket(t){var e=this;return e.handleOperation(async()=>await Yn(e.fetch,`${e.url}/bucket`,{name:t},{headers:e.headers}))}async listBuckets(t){var e=this;return e.handleOperation(async()=>
233{const r=new URLSearchParams;(t==null?void 0:t.limit)!==void 0&&r.set("limit",t.limit.toString()),(t==null?void 0:t.offset)!==void 0&&r.set("offset",t.offset.toString()),t!=null&&t.sortColumn&&r.set("sortColumn",t.sortColumn),t!=null&&t.sortOrder&&r.set("sortOrder",t.sortOrder),t!=null&&t.search&&r.set("search",t.search);const n=r.toString(),i=n?`${e.url}/bucket?${n}`:`${e.url}/bucket`;return await Yd(e.fetch,i,{headers:e.headers})})}async deleteBucket(t){var e=this;return e.handleOperation(async()=>await wT(e.fetch,`${e.url}/bucket/${t}`,{},{headers:e.headers}))}from(t){var e=this;if(!Bz(t))throw new Av("Invalid bucket name: File, folder, and bucket names must follow AWS object key naming guidelines and should avoid the use of any other characters.");const r=new $z({baseUrl:this.url,catalogName:t,auth:{type:"custom",getHeaders:async()=>e.headers},fetch:this.fetch}),n=this.shouldThrowOnError;return new Proxy(r,{get(i,s){const a=i[s];return typeof a!="function"?a:async(...o)=>{try{return{data:await a.apply(i,o),error:null}}catch(l){if(n)throw l;return{data:null,error:l}}}}})}},t9=class extends lu{constructor(t,e={},r){const n=t.replace(/\/$/,""),i=pe(pe({},rh),{},{"Content-Type":"application/json"},e);super(n,i,r,"vectors")}async createIndex(t){var e=this;return e.handleOperation(async()=>await on.post(e.fetch,`${e.url}/CreateIndex`,t,{headers:e.headers})||{})}async getIndex(t,e){var r=this;return r.handleOperation(async()=>await on.post(r.fetch,`${r.url}/GetIndex`,{vectorBucketName:t,indexName:e},{headers:r.headers}))}async listIndexes(t){var e=this;return e.handleOperation(async()=>await on.post(e.fetch,`${e.url}/ListIndexes`,t,{headers:e.headers}))}async deleteIndex(t,e){var r=this;return r.handleOperation(async()=>await on.post(r.fetch,`${r.url}/DeleteIndex`,{vectorBucketName:t,indexName:e},{headers:r.headers})||{})}},r9=class extends lu{constructor(t,e={},r){const n=t.replace(/\/$/,""),i=pe(pe({},rh),{},{"Content-Type":"application/json"},e);super(n,i,r,"vectors")}async putVectors(t){var e=this;if(t.vectors.length<1||t.vectors.length>500)throw new Error("Vector batch size must be between 1 and 500 items");return e.handleOperation(async()=>await on.post(e.fetch,`${e.url}/PutVectors`,t,{headers:e.headers})||{})}async getVectors(t){var e=this;return e.handleOperation(async()=>await on.post(e.fetch,`${e.url}/GetVectors`,t,{headers:e.headers}))}async listVectors(t){var e=this;if(t.segmentCount!==void 0){if(t.segmentCount<1||t.segmentCount>16)throw new Error("segmentCount must be between 1 and 16");if(t.segmentIndex!==void 0&&(t.segmentIndex<0||t.segmentIndex>=t.segmentCount))throw new Error(`segmentIndex must be between 0 and ${t.segmentCount-1}`)}return e.handleOperation(async()=>await on.post(e.fetch,`${e.url}/ListVectors`,t,{headers:e.headers}))}async queryVectors(t){var e=this;return e.handleOperation(async()=>await on.post(e.fetch,`${e.url}/QueryVectors`,t,{headers:e.headers}))}async deleteVectors(t){var e=this;if(t.keys.length<1||t.keys.length>500)throw new Error("Keys batch size must be between 1 and 500 items");return e.handleOperation(async()=>await on.post(e.fetch,`${e.url}/DeleteVectors`,t,{headers:e.headers})||{})}},n9=class extends lu{constructor(t,e={},r){const n=t.replace(/\/$/,""),i=pe(pe({},rh),{},{"Content-Type":"application/json"},e);super(n,i,r,"vectors")}async createBucket(t){var e=this;return e.handleOperation(async()=>await on.post(e.fetch,`${e.url}/CreateVectorBucket`,{vectorBucketName:t},{headers:e.headers})||{})}async getBucket(t){var e=this;return e.handleOperation(async()=>await on.post(e.fetch,`${e.url}/GetVectorBucket`,{vectorBucketName:t},{headers:e.headers}))}async listBuckets(t={}){var e=this;return e.handleOperation(async()=>await on.post(e.fetch,`${e.url}/ListVectorBuckets`,t,{headers:e.headers}))}async deleteBucket(t){var e=this;return e.handleOperation(async()=>await on.post(e.fetch,`${e.url}/DeleteVectorBucket`,{vectorBucketName:t},{headers:e.headers})||{})}},i9=class extends n9{constructor(t,e={}){super(t,e.headers||{},e.fetch)}from(t){return new s9(this.url,this.headers,t,this.fetch)}async createBucket(t){var e=()=>super.createBucket,r=this;return e().call(r,t)}async getBucket(t){var e=()=>super.getBucket,r=this;return e().call(r,t)}async listBuckets(t={}){var e=()=>super.listBuckets,r=this;return e().call(r,t)}async deleteBucket(t){var e=()=>super.deleteBucket,r=this;return e().call(r,t)}},s9=class extends t9{constructor(t,e,r,n){super(t,e,n),this.vectorBucketName=r}async createIndex(t){var e=()=>super.createIndex,r=this;return e().call(r,pe(pe({},t),{},{vectorBucketName:r.vectorBucketName}))}async listIndexes(t={}){var e=()=>super.listIndexes,r=this;return e().call(r,pe(pe({},t),{},{vectorBucketName:r.vectorBucketName}))}async getIndex(t){var e=()=>super.getIndex,r=this;return e().call(r,r.vectorBucketName,t)}async deleteIndex(t){var e=()=>super.deleteIndex,r=this;return e().call(r,r.vectorBucketName,t)}index(t){return new a9(this.url,this.headers,this.vectorBucketName,t,this.fetch)}},a9=class extends r9{constructor(t,e,r,n,i){super(t,e,i),this.vectorBucketName=r,this.indexName=n}async putVectors(t){var e=()=>super.putVectors,r=this;return e().call(r,pe(pe({},t),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async getVectors(t){var e=()=>super.getVectors,r=this;return e().call(r,pe(pe({},t),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async listVectors(t={}){var e=()=>super.listVectors,r=this;return e().call(r,pe(pe({},t),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async queryVectors(t){var e=()=>super.queryVectors,r=this;return e().call(r,pe(pe({},t),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async deleteVectors(t){var e=()=>super.deleteVectors,r=this;return e().call(r,pe(pe({},t),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}},o9=class extends Zz{constructor(t,e={},r,n){super(t,e,r,n)}from(t){return new Qz(this.url,this.headers,t,this.fetch)}get vectors(){return new i9(this.url+"/vector",{headers:this.headers,fetch:this.fetch})}get analytics(){return new e9(this.url+"/iceberg",this.headers,this.fetch)}};const P$="2.99.1",wl=30*1e3,ew=3,m0=ew*wl,l9="http://localhost:9999",c9="supabase.auth.token",u9={"X-Client-Info":`gotrue-js/${P$}`},tw="X-Supabase-Api-Version",I$={"2024-01-01":{timestamp:Date.parse("2024-01-01T00:00:00.0Z"),name:"2024-01-01"}},d9=/^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}$|[a-z0-9_-]{2}$)$/i,f9=10*60*1e3;
233class Xd extends Error{constructor(e,r,n){super(e),this.__isAuthError=!0,this.name="AuthError",this.status=r,this.code=n}}function ue(t){return typeof t=="object"&&t!==null&&"__isAuthError"in t}class h9 extends Xd{constructor(e,r,n){super(e,r,n),this.name="AuthApiError",this.status=r,this.code=n}}function p9(t){return ue(t)&&t.name==="AuthApiError"}class io extends Xd{constructor(e,r){super(e),this.name="AuthUnknownError",this.originalError=r}}class Cs extends Xd{constructor(e,r,n,i){super(e,n,i),this.name=r,this.status=n}}class Xr extends Cs{constructor(){super("Auth session missing!","AuthSessionMissingError",400,void 0)}}function g0(t){return ue(t)&&t.name==="AuthSessionMissingError"}class nl extends Cs{constructor(){super("Auth session or user missing","AuthInvalidTokenResponseError",500,void 0)}}class Vh extends Cs{constructor(e){super(e,"AuthInvalidCredentialsError",400,void 0)}}class Hh extends Cs{constructor(e,r=null){super(e,"AuthImplicitGrantRedirectError",500,void 0),this.details=null,this.details=r}toJSON(){return{name:this.name,message:this.message,status:this.status,details:this.details}}}function m9(t){return ue(t)&&t.name==="AuthImplicitGrantRedirectError"}class CP extends Cs{constructor(e,r=null){super(e,"AuthPKCEGrantCodeExchangeError",500,void 0),this.details=null,this.details=r}toJSON(){return{name:this.name,message:this.message,status:this.status,details:this.details}}}class g9 extends Cs{constructor(){super("PKCE code verifier not found in storage. This can happen if the auth flow was initiated in a different browser or device, or if the storage was cleared. For SSR frameworks (Next.js, SvelteKit, etc.), use @supabase/ssr on both the server and client to store the code verifier in cookies.","AuthPKCECodeVerifierMissingError",400,"pkce_code_verifier_not_found")}}class rw extends Cs{constructor(e,r){super(e,"AuthRetryableFetchError",r,void 0)}}function v0(t){return ue(t)&&t.name==="AuthRetryableFetchError"}class OP extends Cs{constructor(e,r,n){super(e,"AuthWeakPasswordError",r,"weak_password"),this.reasons=n}}class nw extends Cs{constructor(e){super(e,"AuthInvalidJwtError",400,"invalid_jwt")}}const Rm="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".split(""),RP=` 	
234\r=`.split(""),v9=(()=>{const t=new Array(128);for(let e=0;e<t.length;e+=1)t[e]=-1;for(let e=0;e<RP.length;e+=1)t[RP[e].charCodeAt(0)]=-2;for(let e=0;e<Rm.length;e+=1)t[Rm[e].charCodeAt(0)]=e;return t})();function kP(t,e,r){if(t!==null)for(e.queue=e.queue<<8|t,e.queuedBits+=8;e.queuedBits>=6;){const n=e.queue>>e.queuedBits-6&63;r(Rm[n]),e.queuedBits-=6}else if(e.queuedBits>0)for(e.queue=e.queue<<6-e.queuedBits,e.queuedBits=6;e.queuedBits>=6;){const n=e.queue>>e.queuedBits-6&63;r(Rm[n]),e.queuedBits-=6}}function C$(t,e,r){const n=v9[t];if(n>-1)for(e.queue=e.queue<<6|n,e.queuedBits+=6;e.queuedBits>=8;)r(e.queue>>e.queuedBits-8&255),e.queuedBits-=8;else{if(n===-2)return;throw new Error(`Invalid Base64-URL character "${String.fromCharCode(t)}"`)}}function LP(t){const e=[],r=a=>{e.push(String.fromCodePoint(a))},n={utf8seq:0,codepoint:0},i={queue:0,queuedBits:0},s=a=>{x9(a,n,r)};for(let a=0;a<t.length;a+=1)C$(t.charCodeAt(a),i,s);return e.join("")}function y9(t,e){if(t<=127){e(t);return}else if(t<=2047){e(192|t>>6),e(128|t&63);return}else if(t<=65535){e(224|t>>12),e(128|t>>6&63),e(128|t&63);return}else if(t<=1114111){e(240|t>>18),e(128|t>>12&63),e(128|t>>6&63),e(128|t&63);return}throw new Error(`Unrecognized Unicode codepoint: ${t.toString(16)}`)}function b9(t,e){for(let r=0;r<t.length;r+=1){let n=t.charCodeAt(r);if(n>55295&&n<=56319){const i=(n-55296)*1024&65535;n=(t.charCodeAt(r+1)-56320&65535|i)+65536,r+=1}y9(n,e)}}function x9(t,e,r){if(e.utf8seq===0){if(t<=127){r(t);return}for(let n=1;n<6;n+=1)if(!(t>>7-n&1)){e.utf8seq=n;break}if(e.utf8seq===2)e.codepoint=t&31;else if(e.utf8seq===3)e.codepoint=t&15;else if(e.utf8seq===4)e.codepoint=t&7;else throw new Error("Invalid UTF-8 sequence");e.utf8seq-=1}else if(e.utf8seq>0){if(t<=127)throw new Error("Invalid UTF-8 sequence");e.codepoint=e.codepoint<<6|t&63,e.utf8seq-=1,e.utf8seq===0&&r(e.codepoint)}}function Xl(t){const e=[],r={queue:0,queuedBits:0},n=i=>{e.push(i)};for(let i=0;i<t.length;
234i+=1)C$(t.charCodeAt(i),r,n);return new Uint8Array(e)}function w9(t){const e=[];return b9(t,r=>e.push(r)),new Uint8Array(e)}function lo(t){const e=[],r={queue:0,queuedBits:0},n=i=>{e.push(i)};return t.forEach(i=>kP(i,r,n)),kP(null,r,n),e.join("")}function S9(t){return Math.round(Date.now()/1e3)+t}function E9(){return Symbol("auth-callback")}const ur=()=>typeof window<"u"&&typeof document<"u",Va={tested:!1,writable:!1},O$=()=>{if(!ur())return!1;try{if(typeof globalThis.localStorage!="object")return!1}catch{return!1}if(Va.tested)return Va.writable;const t=`lswt-${Math.random()}${Math.random()}`;try{globalThis.localStorage.setItem(t,t),globalThis.localStorage.removeItem(t),Va.tested=!0,Va.writable=!0}catch{Va.tested=!0,Va.writable=!1}return Va.writable};function T9(t){const e={},r=new URL(t);if(r.hash&&r.hash[0]==="#")try{new URLSearchParams(r.hash.substring(1)).forEach((i,s)=>{e[s]=i})}catch{}return r.searchParams.forEach((n,i)=>{e[i]=n}),e}const R$=t=>t?(...e)=>t(...e):(...e)=>fetch(...e),_9=t=>typeof t=="object"&&t!==null&&"status"in t&&"ok"in t&&"json"in t&&typeof t.json=="function",Sl=async(t,e,r)=>{await t.setItem(e,JSON.stringify(r))},Ha=async(t,e)=>{const r=await t.getItem(e);if(!r)return null;try{return JSON.parse(r)}catch{return r}},lr=async(t,e)=>{await t.removeItem(e)};class Iv{constructor(){this.promise=new Iv.promiseConstructor((e,r)=>{this.resolve=e,this.reject=r})}}Iv.promiseConstructor=Promise;function Kh(t){const e=t.split(".");if(e.length!==3)throw new nw("Invalid JWT structure");for(let n=0;n<e.length;n++)if(!d9.test(e[n]))throw new nw("JWT not in base64url format");return{header:JSON.parse(LP(e[0])),payload:JSON.parse(LP(e[1])),signature:Xl(e[2]),raw:{header:e[0],payload:e[1]}}}async function A9(t){return await new Promise(e=>{setTimeout(()=>e(null),t)})}function P9(t,e){return new Promise((n,i)=>{(async()=>{for(let s=0;s<1/0;s++)try{const a=await t(s);if(!e(s,null,a)){n(a);return}}catch(a){if(!e(s,a)){i(a);return}}})()})}function I9(t){return("0"+t.toString(16)).substr(-2)}function C9(){const e=new Uint32Array(56);if(typeof crypto>"u"){const r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~",n=r.length;let i="";for(let s=0;s<56;s++)i+=r.charAt(Math.floor(Math.random()*n));return i}return crypto.getRandomValues(e),Array.from(e,I9).join("")}async function O9(t){const r=new TextEncoder().encode(t),n=await crypto.subtle.digest("SHA-256",r),i=new Uint8Array(n);return Array.from(i).map(s=>String.fromCharCode(s)).join("")}async function R9(t){if(!(typeof crypto<"u"&&typeof crypto.subtle<"u"&&typeof TextEncoder<"u"))return console.warn("WebCrypto API is not supported. Code challenge method will default to use plain instead of sha256."),t;const r=await O9(t);return btoa(r).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function il(t,e,r=!1){const n=C9();let i=n;r&&(i+="/PASSWORD_RECOVERY"),await Sl(t,`${e}-code-verifier`,i);const s=await R9(n);return[s,n===s?"plain":"s256"]}const k9=/^2[0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|1[0-9]|2[0-9]|3[0-1])$/i;function L9(t){const e=t.headers.get(tw);if(!e||!e.match(k9))return null;try{return new Date(`${e}T00:00:00.0Z`)}catch{return null}}function D9(t){if(!t)throw new Error("Missing exp claim");const e=Math.floor(Date.now()/1e3);if(t<=e)throw new Error("JWT has expired")}function N9(t){switch(t){case"RS256":return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}};case"ES256":return{name:"ECDSA",namedCurve:"P-256",hash:{name:"SHA-256"}};default:throw new Error("Invalid alg claim")}}const M9=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;function sl(t){if(!M9.test(t))throw new Error("@supabase/auth-js: Expected parameter to be UUID but is not")}function y0(){const t={};return new Proxy(t,{get:(e,r)=>{if(r==="__isUserNotAvailableProxy")return!0;if(typeof r=="symbol"){const n=r.toString();if(n==="Symbol(Symbol.toPrimitive)"||n==="Symbol(Symbol.toStringTag)"||n==="Symbol(util.inspect.custom)")return}throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Accessing the "${r}" property of the session object is not supported. Please use getUser() instead.`)},set:(e,r)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Setting the "${r}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)},deleteProperty:(e,r)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Deleting the "${r}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)}})}function $9(t,e){return new Proxy(t,{get:(r,n,i)=>{if(n==="__isInsecureUserWarningProxy")return!0;
234if(typeof n=="symbol"){const s=n.toString();if(s==="Symbol(Symbol.toPrimitive)"||s==="Symbol(Symbol.toStringTag)"||s==="Symbol(util.inspect.custom)"||s==="Symbol(nodejs.util.inspect.custom)")return Reflect.get(r,n,i)}return!e.value&&typeof n=="string"&&(console.warn("Using the user object as returned from supabase.auth.getSession() or from some supabase.auth.onAuthStateChange() events could be insecure! This value comes directly from the storage medium (usually cookies on the server) and may not be authentic. Use supabase.auth.getUser() instead which authenticates the data by contacting the Supabase Auth server."),e.value=!0),Reflect.get(r,n,i)}})}function DP(t){return JSON.parse(JSON.stringify(t))}const Qa=t=>t.msg||t.message||t.error_description||t.error||JSON.stringify(t),j9=[502,503,504];async function NP(t){var e;if(!_9(t))throw new rw(Qa(t),0);if(j9.includes(t.status))throw new rw(Qa(t),t.status);let r;try{r=await t.json()}catch(s){throw new io(Qa(s),s)}let n;const i=L9(t);if(i&&i.getTime()>=I$["2024-01-01"].timestamp&&typeof r=="object"&&r&&typeof r.code=="string"?n=r.code:typeof r=="object"&&r&&typeof r.error_code=="string"&&(n=r.error_code),n){if(n==="weak_password")throw new OP(Qa(r),t.status,((e=r.weak_password)===null||e===void 0?void 0:e.reasons)||[]);if(n==="session_not_found")throw new Xr}else if(typeof r=="object"&&r&&typeof r.weak_password=="object"&&r.weak_password&&Array.isArray(r.weak_password.reasons)&&r.weak_password.reasons.length&&r.weak_password.reasons.reduce((s,a)=>s&&typeof a=="string",!0))throw new OP(Qa(r),t.status,r.weak_password.reasons);throw new h9(Qa(r),t.status||500,n)}const F9=(t,e,r,n)=>{const i={method:t,headers:(e==null?void 0:e.headers)||{}};return t==="GET"?i:(i.headers=Object.assign({"Content-Type":"application/json;charset=UTF-8"},e==null?void 0:e.headers),i.body=JSON.stringify(n),Object.assign(Object.assign({},i),r))};async function he(t,e,r,n){var i;const s=Object.assign({},n==null?void 0:n.headers);s[tw]||(s[tw]=I$["2024-01-01"].name),n!=null&&n.jwt&&(s.Authorization=`Bearer ${n.jwt}`);const a=(i=n==null?void 0:n.query)!==null&&i!==void 0?i:{};n!=null&&n.redirectTo&&(a.redirect_to=n.redirectTo);const o=Object.keys(a).length?"?"+new URLSearchParams(a).toString():"",l=await B9(t,e,r+o,{headers:s,noResolveJson:n==null?void 0:n.noResolveJson},{},n==null?void 0:n.body);return n!=null&&n.xform?n==null?void 0:n.xform(l):{data:Object.assign({},l),error:null}}async function B9(t,e,r,n,i,s){const a=F9(e,n,i,s);let o;try{o=await t(r,Object.assign({},a))}catch(l){throw console.error(l),new rw(Qa(l),0)}if(o.ok||await NP(o),n!=null&&n.noResolveJson)return o;try{return await o.json()}catch(l){await NP(l)}}function Vn(t){var e;let r=null;W9(t)&&(r=Object.assign({},t),t.expires_at||(r.expires_at=S9(t.expires_in)));const n=(e=t.user)!==null&&e!==void 0?e:t;return{data:{session:r,user:n},error:null}}function MP(t){const e=Vn(t);return!e.error&&t.weak_password&&typeof t.weak_password=="object"&&Array.isArray(t.weak_password.reasons)&&t.weak_password.reasons.length&&t.weak_password.message&&typeof t.weak_password.message=="string"&&t.weak_password.reasons.reduce((r,n)=>r&&typeof n=="string",!0)&&(e.data.weak_password=t.weak_password),e}function Js(t){var e;return{data:{user:(e=t.user)!==null&&e!==void 0?e:t},error:null}}function U9(t){return{data:t,error:null}}function G9(t){const{action_link:e,email_otp:r,hashed_token:n,redirect_to:i,verification_type:s}=t,a=ou(t,["action_link","email_otp","hashed_token","redirect_to","verification_type"]),o={action_link:e,email_otp:r,hashed_token:n,redirect_to:i,verification_type:s},l=Object.assign({},a);return{data:{properties:o,user:l},error:null}}function $P(t){return t}function W9(t){return t.access_token&&t.refresh_token&&t.expires_in}const b0=["global","local","others"];class V9{constructor({url:e="",headers:r={},fetch:n}){this.url=e,this.headers=r,this.fetch=R$(n),this.mfa={listFactors:this._listFactors.bind(this),deleteFactor:this._deleteFactor.bind(this)},this.oauth={listClients:this._listOAuthClients.bind(this),createClient:this._createOAuthClient.bind(this),getClient:this._getOAuthClient.bind(this),updateClient:this._updateOAuthClient.bind(this),deleteClient:this._deleteOAuthClient.bind(this),regenerateClientSecret:this._regenerateOAuthClientSecret.bind(this)},this.customProviders={listProviders:this._listCustomProviders.bind(this),createProvider:this._createCustomProvider.bind(this),getProvider:this._getCustomProvider.bind(this),updateProvider:this._updateCustomProvider.bind(this),deleteProvider:this._deleteCustomProvider.bind(this)}}
vendor: 4,780 bytes, line 234
234async signOut(e,r=b0[0]){if(b0.indexOf(r)<0)throw new Error(`@supabase/auth-js: Parameter scope must be one of ${b0.join(", ")}`);try{return await he(this.fetch,"POST",`${this.url}/logout?scope=${r}`,{headers:this.headers,jwt:e,noResolveJson:!0}),{data:null,error:null}}catch(n){if(ue(n))return{data:null,error:n};throw n}}async inviteUserByEmail(e,r={}){try{return await he(this.fetch,"POST",`${this.url}/invite`,{body:{email:e,data:r.data},headers:this.headers,redirectTo:r.redirectTo,xform:Js})}catch(n){if(ue(n))return{data:{user:null},error:n};throw n}}async generateLink(e){try{const{options:r}=e,n=ou(e,["options"]),i=Object.assign(Object.assign({},n),r);return"newEmail"in n&&(i.new_email=n==null?void 0:n.newEmail,delete i.newEmail),await he(this.fetch,"POST",`${this.url}/admin/generate_link`,{body:i,headers:this.headers,xform:G9,redirectTo:r==null?void 0:r.redirectTo})}catch(r){if(ue(r))return{data:{properties:null,user:null},error:r};throw r}}async createUser(e){try{return await he(this.fetch,"POST",`${this.url}/admin/users`,{body:e,headers:this.headers,xform:Js})}catch(r){if(ue(r))return{data:{user:null},error:r};throw r}}async listUsers(e){var r,n,i,s,a,o,l;try{const c={nextPage:null,lastPage:0,total:0},u=await he(this.fetch,"GET",`${this.url}/admin/users`,{headers:this.headers,noResolveJson:!0,query:{page:(n=(r=e==null?void 0:e.page)===null||r===void 0?void 0:r.toString())!==null&&n!==void 0?n:"",per_page:(s=(i=e==null?void 0:e.perPage)===null||i===void 0?void 0:i.toString())!==null&&s!==void 0?s:""},xform:$P});if(u.error)throw u.error;const d=await u.json(),f=(a=u.headers.get("x-total-count"))!==null&&a!==void 0?a:0,h=(l=(o=u.headers.get("link"))===null||o===void 0?void 0:o.split(","))!==null&&l!==void 0?l:[];return h.length>0&&(h.forEach(p=>{const g=parseInt(p.split(";")[0].split("=")[1].substring(0,1)),m=JSON.parse(p.split(";")[1].split("=")[1]);c[`${m}Page`]=g}),c.total=parseInt(f)),{data:Object.assign(Object.assign({},d),c),error:null}}catch(c){if(ue(c))return{data:{users:[]},error:c};throw c}}async getUserById(e){sl(e);try{return await he(this.fetch,"GET",`${this.url}/admin/users/${e}`,{headers:this.headers,xform:Js})}catch(r){if(ue(r))return{data:{user:null},error:r};throw r}}async updateUserById(e,r){sl(e);try{return await he(this.fetch,"PUT",`${this.url}/admin/users/${e}`,{body:r,headers:this.headers,xform:Js})}catch(n){if(ue(n))return{data:{user:null},error:n};throw n}}async deleteUser(e,r=!1){sl(e);try{return await he(this.fetch,"DELETE",`${this.url}/admin/users/${e}`,{headers:this.headers,body:{should_soft_delete:r},xform:Js})}catch(n){if(ue(n))return{data:{user:null},error:n};throw n}}async _listFactors(e){sl(e.userId);try{const{data:r,error:n}=await he(this.fetch,"GET",`${this.url}/admin/users/${e.userId}/factors`,{headers:this.headers,xform:i=>({data:{factors:i},error:null})});return{data:r,error:n}}catch(r){if(ue(r))return{data:null,error:r};throw r}}async _deleteFactor(e){sl(e.userId),sl(e.id);try{return{data:await he(this.fetch,"DELETE",`${this.url}/admin/users/${e.userId}/factors/${e.id}`,{headers:this.headers}),error:null}}catch(r){if(ue(r))return{data:null,error:r};throw r}}async _listOAuthClients(e){var r,n,i,s,a,o,l;try{const c={nextPage:null,lastPage:0,total:0},u=await he(this.fetch,"GET",`${this.url}/admin/oauth/clients`,{headers:this.headers,noResolveJson:!0,query:{page:(n=(r=e==null?void 0:e.page)===null||r===void 0?void 0:r.toString())!==null&&n!==void 0?n:"",per_page:(s=(i=e==null?void 0:e.perPage)===null||i===void 0?void 0:i.toString())!==null&&s!==void 0?s:""},xform:$P});if(u.error)throw u.error;const d=await u.json(),f=(a=u.headers.get("x-total-count"))!==null&&a!==void 0?a:0,h=(l=(o=u.headers.get("link"))===null||o===void 0?void 0:o.split(","))!==null&&l!==void 0?l:[];return h.length>0&&(h.forEach(p=>{const g=parseInt(p.split(";")[0].split("=")[1].substring(0,1)),m=JSON.parse(p.split(";")[1].split("=")[1]);c[`${m}Page`]=g}),c.total=parseInt(f)),{data:Object.assign(Object.assign({},d),c),error:null}}catch(c){if(ue(c))return{data:{clients:[]},error:c};throw c}}async _createOAuthClient(e){try{return await he(this.fetch,"POST",`${this.url}/admin/oauth/clients`,{body:e,headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(ue(r))return{data:null,error:r};throw r}}async _getOAuthClient(e){try{return await he(this.fetch,"GET",`${this.url}/admin/oauth/clients/${e}`,{headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(ue(r))return{data:null,error:r};throw r}}async _updateOAuthClient(e,r){try{return await he(this.fetch,"PUT",`${this.url}/admin/oauth/clients/${e}`,{body:r,headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(ue(n))return{data:null,error:n};throw n}}async _deleteOAuthClient(e){try{return await he(this.fetch,"DELET
234E",`${this.url}/admin/oauth/clients/${e}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(r){if(ue(r))return{data:null,error:r};throw r}}async _regenerateOAuthClientSecret(e){try{return await he(this.fetch,"POST",`${this.url}/admin/oauth/clients/${e}/regenerate_secret`,{headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(ue(r))return{data:null,error:r};throw r}}async _listCustomProviders(e){try{const r={};return e!=null&&e.type&&(r.type=e.type),await he(this.fetch,"GET",`${this.url}/admin/custom-providers`,{headers:this.headers,query:r,xform:n=>{var i;return{data:{providers:(i=n==null?void 0:n.providers)!==null&&i!==void 0?i:[]},error:null}}})}catch(r){if(ue(r))return{data:{providers:[]},error:r};throw r}}async _createCustomProvider(e){try{return await he(this.fetch,"POST",`${this.url}/admin/custom-providers`,{body:e,headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(ue(r))return{data:null,error:r};throw r}}async _getCustomProvider(e){try{return await he(this.fetch,"GET",`${this.url}/admin/custom-providers/${e}`,{headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(ue(r))return{data:null,error:r};throw r}}async _updateCustomProvider(e,r){try{return await he(this.fetch,"PUT",`${this.url}/admin/custom-providers/${e}`,{body:r,headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(ue(n))return{data:null,error:n};throw n}}async _deleteCustomProvider(e){try{return await he(this.fetch,"DELETE",`${this.url}/admin/custom-providers/${e}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(r){if(ue(r))return{data:null,error:r};throw r}}}function jP(t={}){return{getItem:e=>t[e]||null,setItem:(e,r)=>{t[e]=r},removeItem:e=>{delete t[e]}}}const qi={debug:!!(globalThis&&O$()&&globalThis.localStorage&&globalThis.localStorage.getItem("supabase.gotrue-js.locks.debug")==="true")};class k$ extends Error{constructor(e){super(e),this.isAcquireTimeout=!0}}class H9 extends k${}async function K9(t,e,r){qi.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquire lock",t,e);const n=new globalThis.AbortController;e>0&&setTimeout(()=>{n.abort(),qi.debug&&console.log("@supabase/gotrue-js: navigatorLock acquire timed out",t)},e),await Promise.resolve();try{return await globalThis.navigator.locks.request(t,e===0?{mode:"exclusive",ifAvailable:!0}:{mode:"exclusive",signal:n.signal},async i=>{if(i){qi.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquired",t,i.name);try{return await r()}finally{qi.debug&&console.log("@supabase/gotrue-js: navigatorLock: released",t,i.name)}}else{if(e===0)throw qi.debug&&console.log("@supabase/gotrue-js: navigatorLock: not immediately available",t),new H9(`Acquiring an exclusive Navigator LockManager lock "${t}" immediately failed`);if(qi.debug)try{const s=await globalThis.navigator.locks.query();console.log("@supabase/gotrue-js: Navigator LockManager state",JSON.stringify(s,null,"  "))}catch(s){console.warn("@supabase/gotrue-js: Error when querying Navigator LockManager state",s)}return console.warn("@supabase/gotrue-js: Navigator LockManager returned a null lock when using #request without ifAvailable set to true, it appears this browser is not following the LockManager spec https://developer.mozilla.org/en-US/docs/Web/API/LockManager/request"),await r()}})}catch(i){if((i==null?void 0:i.name)==="AbortError"&&e>0)return qi.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquire timeout, recovering by stealing lock",t),console.warn(`@supabase/gotrue-js: Lock "${t}" was not released within ${e}ms. This may indicate an orphaned lock from a component unmount (e.g., React Strict Mode). Forcefully acquiring the lock to recover.`),await Promise.resolve().then(()=>globalThis.navigator.locks.request(t,{mode:"exclusive",steal:!0},async s=>{if(s){qi.debug&&console.log("@supabase/gotrue-js: navigatorLock: recovered (stolen)",t,s.name);try{return await r()}finally{qi.debug&&console.log("@supabase/gotrue-js: navigatorLock: released (stolen)",t,s.name)}}else return console.warn("@supabase/gotrue-js: Navigator LockManager returned null lock even with steal: true"),await r()}));throw i}}function z9(){if(typeof globalThis!="object")try{Object.defineProperty(Object.prototype,"__magic__",{get:function(){return this},configurable:!0}),__magic__.globalThis=__magic__,delete Object.prototype.__magic__}catch{typeof self<"u"&&(self.globalThis=self)}}function L$(t){if(!/^0x[a-fA-F0-9]{40}$/.test(t))throw new Error(`@supabase/auth-js: Address "${t}
234" is invalid.`);return t.toLowerCase()}function q9(t){return parseInt(t,16)}function Y9(t){const e=new TextEncoder().encode(t);return"0x"+Array.from(e,n=>n.toString(16).padStart(2,"0")).join("")}function X9(t){var e;const{chainId:r,domain:n,expirationTime:i,issuedAt:s=new Date,nonce:a,notBefore:o,requestId:l,resources:c,scheme:u,uri:d,version:f}=t;{if(!Number.isInteger(r))throw new Error(`@supabase/auth-js: Invalid SIWE message field "chainId". Chain ID must be a EIP-155 chain ID. Provided value: ${r}`);if(!n)throw new Error('@supabase/auth-js: Invalid SIWE message field "domain". Domain must be provided.');if(a&&a.length<8)throw new Error(`@supabase/auth-js: Invalid SIWE message field "nonce". Nonce must be at least 8 characters. Provided value: ${a}`);if(!d)throw new Error('@supabase/auth-js: Invalid SIWE message field "uri". URI must be provided.');if(f!=="1")throw new Error(`@supabase/auth-js: Invalid SIWE message field "version". Version must be '1'. Provided value: ${f}`);if(!((e=t.statement)===null||e===void 0)&&e.includes(`
235`))throw new Error(`@supabase/auth-js: Invalid SIWE message field "statement". Statement must not include '\\n'. Provided value: ${t.statement}`)}const h=L$(t.address),p=u?`${u}://${n}`:n,g=t.statement?`${t.statement}
236`:"",m=`${p} wants you to sign in with your Ethereum account:
237${h}
238
239${g}`;let v=`URI: ${d}
240Version: ${f}
241Chain ID: ${r}${a?`
242Nonce: ${a}`:""}
243Issued At: ${s.toISOString()}`;if(i&&(v+=`
244Expiration Time: ${i.toISOString()}`),o&&(v+=`
245Not Before: ${o.toISOString()}`),l&&(v+=`
246Request ID: ${l}`),c){let y=`
247Resources:`;for(const b of c){if(!b||typeof b!="string")throw new Error(`@supabase/auth-js: Invalid SIWE message field "resources". Every resource must be a valid string. Provided value: ${b}`);y+=`
248- ${b}`}v+=y}return`${m}
249${v}`}class Ft extends Error{constructor({message:e,code:r,cause:n,name:i}){var s;super(e,{cause:n}),this.__isWebAuthnError=!0,this.name=(s=i??(n instanceof Error?n.name:void 0))!==null&&s!==void 0?s:"Unknown Error",this.code=r}}class km extends Ft{constructor(e,r){super({code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:r,message:e}),this.name="WebAuthnUnknownError",this.originalError=r}}function Q9({error:t,options:e}){var r,n,i;const{publicKey:s}=e;if(!s)throw Error("options was missing required publicKey property");if(t.name==="AbortError"){if(e.signal instanceof AbortSignal)return new Ft({message:"Registration ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:t})}else if(t.name==="ConstraintError"){if(((r=s.authenticatorSelection)===null||r===void 0?void 0:r.requireResidentKey)===!0)return new Ft({message:"Discoverable credentials were required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_DISCOVERABLE_CREDENTIAL_SUPPORT",cause:t});if(e.mediation==="conditional"&&((n=s.authenticatorSelection)===null||n===void 0?void 0:n.userVerification)==="required")return new Ft({message:"User verification was required during automatic registration but it could not be performed",code:"ERROR_AUTO_REGISTER_USER_VERIFICATION_FAILURE",cause:t});if(((i=s.authenticatorSelection)===null||i===void 0?void 0:i.userVerification)==="required")return new Ft({message:"User verification was required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_USER_VERIFICATION_SUPPORT",cause:t})}else{if(t.name==="InvalidStateError")return new Ft({message:"The authenticator was previously registered",code:"ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED",cause:t});if(t.name==="NotAllowedError")return new Ft({message:t.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t});if(t.name==="NotSupportedError")return s.pubKeyCredParams.filter(o=>o.type==="public-key").length===0?new Ft({message:'No entry in pubKeyCredParams was of type "public-key"',code:"ERROR_MALFORMED_PUBKEYCREDPARAMS",cause:t}):new Ft({message:"No available authenticator supported any of the specified pubKeyCredParams algorithms",code:"ERROR_AUTHENTICATOR_NO_SUPPORTED_PUBKEYCREDPARAMS_ALG",cause:t});if(t.name==="SecurityError"){const a=window.location.hostname;if(D$(a)){if(s.rp.id!==a)return new Ft({message:`The RP ID "${s.rp.id}
249" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:t})}else return new Ft({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:t})}else if(t.name==="TypeError"){if(s.user.id.byteLength<1||s.user.id.byteLength>64)return new Ft({message:"User ID was not between 1 and 64 characters",code:"ERROR_INVALID_USER_ID_LENGTH",cause:t})}else if(t.name==="UnknownError")return new Ft({message:"The authenticator was unable to process the specified options, or could not create a new credential",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:t})}return new Ft({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t})}function J9({error:t,options:e}){const{publicKey:r}=e;if(!r)throw Error("options was missing required publicKey property");if(t.name==="AbortError"){if(e.signal instanceof AbortSignal)return new Ft({message:"Authentication ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:t})}else{if(t.name==="NotAllowedError")return new Ft({message:t.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t});if(t.name==="SecurityError"){const n=window.location.hostname;if(D$(n)){if(r.rpId!==n)return new Ft({message:`The RP ID "${r.rpId}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:t})}else return new Ft({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:t})}else if(t.name==="UnknownError")return new Ft({message:"The authenticator was unable to process the specified options, or could not create a new assertion signature",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:t})}return new Ft({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t})}class Z9{createNewAbortSignal(){if(this.controller){const r=new Error("Cancelling existing WebAuthn API call for new one");r.name="AbortError",this.controller.abort(r)}const e=new AbortController;return this.controller=e,e.signal}cancelCeremony(){if(this.controller){const e=new Error("Manually cancelling existing WebAuthn API call");e.name="AbortError",this.controller.abort(e),this.controller=void 0}}}const eq=new Z9;function tq(t){if(!t)throw new Error("Credential creation options are required");if(typeof PublicKeyCredential<"u"&&"parseCreationOptionsFromJSON"in PublicKeyCredential&&typeof PublicKeyCredential.parseCreationOptionsFromJSON=="function")return PublicKeyCredential.parseCreationOptionsFromJSON(t);const{challenge:e,user:r,excludeCredentials:n}=t,i=ou(t,["challenge","user","excludeCredentials"]),s=Xl(e).buffer,a=Object.assign(Object.assign({},r),{id:Xl(r.id).buffer}),o=Object.assign(Object.assign({},i),{challenge:s,user:a});if(n&&n.length>0){o.excludeCredentials=new Array(n.length);for(let l=0;l<n.length;l++){const c=n[l];o.excludeCredentials[l]=Object.assign(Object.assign({},c),{id:Xl(c.id).buffer,type:c.type||"public-key",transports:c.transports})}}return o}function rq(t){if(!t)throw new Error("Credential request options are required");if(typeof PublicKeyCredential<"u"&&"parseRequestOptionsFromJSON"in PublicKeyCredential&&typeof PublicKeyCredential.parseRequestOptionsFromJSON=="function")return PublicKeyCredential.parseRequestOptionsFromJSON(t);const{challenge:e,allowCredentials:r}=t,n=ou(t,["challenge","allowCredentials"]),i=Xl(e).buffer,s=Object.assign(Object.assign({},n),{challenge:i});if(r&&r.length>0){s.allowCredentials=new Array(r.length);for(let a=0;a<r.length;a++){const o=r[a];s.allowCredentials[a]=Object.assign(Object.assign({},o),{id:Xl(o.id).buffer,type:o.type||"public-key",transports:o.transports})}}return s}function nq(t){var e;if("toJSON"in t&&typeof t.toJSON=="function")return t.toJSON();const r=t;return{id:t.id,rawId:t.id,response:{attestationObject:lo(new Uint8Array(t.response.attestationObject)),clientDataJSON:lo(new Uint8Array(t.response.clientDataJSON))},type:"public-key",clientExtensionResults:t.getClientExtensionResults(),authenticatorAttachment:(e=r.authenticatorAttachment)!==null&&e!==void 0?e:void 0}}function iq(t){var e;if("toJSON"in t&&typeof t.toJSON=="function")return t.toJSON();const r=t,n=t.getClientExtensionResults(),i=t.response;return{id:t.id,rawId:t.id,response:{authenticatorData:lo(new Uint8Array(i.authenticatorData)),clientDataJSON:lo(new Uint8Array(i.clientDataJSON)),signature:lo(new Uint8Array(i.signature)),userHandle:i.userHandle?lo(new Uint8Array(i.userHandle)):void 0},type:"public-key",clientExtensionResults:n,authenticatorAttachment:(e=r.authenticatorAttachment)!==null&&e!==void 0?e:void 0}}function D$(t){return t==="localhost"||/^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/i.test(t)}function FP(){var t,e;return!!(ur()&&"PublicKeyCredential"in window&&window.PublicKeyCredential&&"credentials"in navigator&&typeof((t=navigator==null?void 0:navigator.credentials)===null||t===void 0?void 0:t.create)=="function"&&typeof((e=navigator==null?void 0:navigator.credentials)===null||e===void 0?void 0:e.get)=="function")}async function sq(t){try{const e=await navigator.credentials.create(t);return e?e instanceof PublicKeyCredential?{data:e,error:null}:{data:null,error:new km("Browser returned unexpected credential type",e)}:{data:null,error:new km("Empty credential response",e)}}catch(e){return{data:null,error:Q9({error:e,options:t})}}}async function aq(t){try{const e=await navigator.credentials.get(t);return e?e instanceof PublicKeyCredential?{data:e,error:null}:{data:null,error:new km("Browser returned unexpected credential type",e)}:{data:null,error:new km("Empty credential response",e)}}catch(e){return{data:null,error:J9({error:e,options:t})}}}const oq={hints:["security-key"],authenticatorSelection:{authenticatorAttachment:"cross-platform",requireResidentKey:!1,userVerification:"preferred",residentKey:"discouraged"},attestation:"direct"},lq={userVerification:"preferred",hints:["security-key"],attestation:"direct"};function Lm(...t){const e=i=>i!==null&&typeof i=="object"&&!Array.isArray(i),r=i=>i instanceof ArrayBuffer||ArrayBuffer.isView(i),n={};for(const i of t)if(i)for(const s in i){const a=i[s];if(a!==void 0)if(Array.isArray(a))n[s]=a;
249else if(r(a))n[s]=a;else if(e(a)){const o=n[s];e(o)?n[s]=Lm(o,a):n[s]=Lm(a)}else n[s]=a}return n}function cq(t,e){return Lm(oq,t,e||{})}function uq(t,e){return Lm(lq,t,e||{})}class dq{constructor(e){this.client=e,this.enroll=this._enroll.bind(this),this.challenge=this._challenge.bind(this),this.verify=this._verify.bind(this),this.authenticate=this._authenticate.bind(this),this.register=this._register.bind(this)}async _enroll(e){return this.client.mfa.enroll(Object.assign(Object.assign({},e),{factorType:"webauthn"}))}async _challenge({factorId:e,webauthn:r,friendlyName:n,signal:i},s){var a;try{const{data:o,error:l}=await this.client.mfa.challenge({factorId:e,webauthn:r});if(!o)return{data:null,error:l};const c=i??eq.createNewAbortSignal();if(o.webauthn.type==="create"){const{user:u}=o.webauthn.credential_options.publicKey;if(!u.name){const d=n;if(d)u.name=`${u.id}:${d}`;else{const h=(await this.client.getUser()).data.user,p=((a=h==null?void 0:h.user_metadata)===null||a===void 0?void 0:a.name)||(h==null?void 0:h.email)||(h==null?void 0:h.id)||"User";u.name=`${u.id}:${p}`}}u.displayName||(u.displayName=u.name)}switch(o.webauthn.type){case"create":{const u=cq(o.webauthn.credential_options.publicKey,s==null?void 0:s.create),{data:d,error:f}=await sq({publicKey:u,signal:c});return d?{data:{factorId:e,challengeId:o.id,webauthn:{type:o.webauthn.type,credential_response:d}},error:null}:{data:null,error:f}}case"request":{const u=uq(o.webauthn.credential_options.publicKey,s==null?void 0:s.request),{data:d,error:f}=await aq(Object.assign(Object.assign({},o.webauthn.credential_options),{publicKey:u,signal:c}));return d?{data:{factorId:e,challengeId:o.id,webauthn:{type:o.webauthn.type,credential_response:d}},error:null}:{data:null,error:f}}}}catch(o){return ue(o)?{data:null,error:o}:{data:null,error:new io("Unexpected error in challenge",o)}}}async _verify({challengeId:e,factorId:r,webauthn:n}){return this.client.mfa.verify({factorId:r,challengeId:e,webauthn:n})}async _authenticate({factorId:e,webauthn:{rpId:r=typeof window<"u"?window.location.hostname:void 0,rpOrigins:n=typeof window<"u"?[window.location.origin]:void 0,signal:i}={}},s){if(!r)return{data:null,error:new Xd("rpId is required for WebAuthn authentication")};try{if(!FP())return{data:null,error:new io("Browser does not support WebAuthn",null)};const{data:a,error:o}=await this.challenge({factorId:e,webauthn:{rpId:r,rpOrigins:n},signal:i},{request:s});if(!a)return{data:null,error:o};const{webauthn:l}=a;return this._verify({factorId:e,challengeId:a.challengeId,webauthn:{type:l.type,rpId:r,rpOrigins:n,credential_response:l.credential_response}})}catch(a){return ue(a)?{data:null,error:a}:{data:null,error:new io("Unexpected error in authenticate",a)}}}async _register({friendlyName:e,webauthn:{rpId:r=typeof window<"u"?window.location.hostname:void 0,rpOrigins:n=typeof window<"u"?[window.location.origin]:void 0,signal:i}={}},s){if(!r)return{data:null,error:new Xd("rpId is required for WebAuthn registration")};try{if(!FP())return{data:null,error:new io("Browser does not support WebAuthn",null)};const{data:a,error:o}=await this._enroll({friendlyName:e});if(!a)return await this.client.mfa.listFactors().then(u=>{var d;return(d=u.data)===null||d===void 0?void 0:d.all.find(f=>f.factor_type==="webauthn"&&f.friendly_name===e&&f.status!=="unverified")}).then(u=>u?this.client.mfa.unenroll({factorId:u==null?void 0:u.id}):void 0),{data:null,error:o};const{data:l,error:c}=await this._challenge({factorId:a.id,friendlyName:a.friendly_name,webauthn:{rpId:r,rpOrigins:n},signal:i},{create:s});return l?this._verify({factorId:a.id,challengeId:l.challengeId,webauthn:{rpId:r,rpOrigins:n,type:l.webauthn.type,credential_response:l.webauthn.credential_response}}):{data:null,error:c}}catch(a){return ue(a)?{data:null,error:a}:{data:null,error:new io("Unexpected error in register",a)}}}}z9();const fq={url:l9,storageKey:c9,autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:u9,flowType:"implicit",debug:!1,hasCustomAuthorizationHeader:!1,throwOnError:!1,lockAcquireTimeout:5e3,skipAutoInitialize:!1};async function BP(t,e,r){return await r()}const al={};class Qd{get jwks(){var e,r;return(r=(e=al[this.storageKey])===null||e===void 0?void 0:e.jwks)!==null&&r!==void 0?r:{keys:[]}}set jwks(e){al[this.storageKey]=Object.assign(Object.assign({},al[this.storageKey]),{jwks:e})}get jwks_cached_at(){var e,r;return(r=(e=al[this.storageKey])===null||e===void 0?void 0:e.cachedAt)!==null&&r!==void 0?r:Number.MIN_SAFE_INTEGER}set jwks_cached_at(e){al[this.storageKey]=Object.assign(Object.assign({},al[this.storageKey]),{cachedAt:e})}constructor(e){var r,n,i;this.userStorage=null,this.memoryStorage=null,this.stateChangeEmitters=new Map,this.autoRefreshTicker=null,this.autoRefreshTickTimeout=null,this.visibilityChangedCallback=null,this.refreshingDeferred=null,this.initializePromise=null,this.detectSessionInUrl=!0,this.hasCustomAuthorizationHeader=!1,this.suppressGetSessionWarning=!1,this.lockAcquired=!1,this.pendingInLock=[],this.broadcastChannel=null,this.logger=console.log;const s=Object.assign(Object.assign({},fq),e);if(this.storageKey=s.storageKey,this.instanceID=(r=Qd.nextInstanceID[this.storageKey])!==null&&r!==void 0?r:0,Qd.nextInstanceID[this.storageKey]=this.instanceID+1,this.logDebugMessages=!!s.debug,typeof s.debug=="function"&&(this.logger=s.debug),this.instanceID>0&&ur()){const a=`${this._logPrefix()} Multiple GoTrueClient instances detected in the same browser context. It is not an error, but this should be avoided as it may produce undefined behavior when used concurrently under the same storage key.`;console.warn(a),this.logDebugMessages&&console.trace(a)}if(this.persistSession=s.persistSession,this.autoRefreshToken=s.autoRefreshToken,this.admin=new V9({url:s.url,headers:s.headers,fetch:s.fetch}),this.url=s.url,this.headers=s.headers,this.fetch=R$(s.fetch),this.lock=s.lock||BP,this.detectSessionInUrl=s.detectSessionInUrl,this.flowType=s.flowType,this.hasCustomAuthorizationHeader=s.hasCustomAuthorizationHeader,this.throwOnError=s.throwOnError,this.lockAcquireTimeout=s.lockAcquireTimeout,s.lock?this.lock=s.lock:this.persistSession&&ur()&&(!((n=globalThis==null?void 0:globalThis.navigator)===null||n===void 0)&&n.locks)?this.lock=K9:this.lock=BP,this.jwks||(this.jwks={keys:[]},this.jwks_cached_at=Number.MIN_SAFE_INTEGER),this.mfa={verify:this._verify.bind(this),enroll:this._enroll.bind(this),unenroll:this._unenroll.bind(this),challenge:this._challenge.bind(this),listFactors:this._listFactors.bind(this),challengeAndVerify:this._challengeAndVerify.bind(this),getAuthenticatorAssuranceLevel:this._getAuthenticatorAssuranceLevel.bind(this),webauthn:new dq(this)}
249,this.oauth={getAuthorizationDetails:this._getAuthorizationDetails.bind(this),approveAuthorization:this._approveAuthorization.bind(this),denyAuthorization:this._denyAuthorization.bind(this),listGrants:this._listOAuthGrants.bind(this),revokeGrant:this._revokeOAuthGrant.bind(this)},this.persistSession?(s.storage?this.storage=s.storage:O$()?this.storage=globalThis.localStorage:(this.memoryStorage={},this.storage=jP(this.memoryStorage)),s.userStorage&&(this.userStorage=s.userStorage)):(this.memoryStorage={},this.storage=jP(this.memoryStorage)),ur()&&globalThis.BroadcastChannel&&this.persistSession&&this.storageKey){try{this.broadcastChannel=new globalThis.BroadcastChannel(this.storageKey)}catch(a){console.error("Failed to create a new BroadcastChannel, multi-tab state changes will not be available",a)}(i=this.broadcastChannel)===null||i===void 0||i.addEventListener("message",async a=>{this._debug("received broadcast notification from other tab or client",a);try{await this._notifyAllSubscribers(a.data.event,a.data.session,!1)}catch(o){this._debug("#broadcastChannel","error",o)}})}s.skipAutoInitialize||this.initialize().catch(a=>{this._debug("#initialize()","error",a)})}isThrowOnErrorEnabled(){return this.throwOnError}_returnResult(e){if(this.throwOnError&&e&&e.error)throw e.error;return e}_logPrefix(){return`GoTrueClient@${this.storageKey}:${this.instanceID} (${P$}) ${new Date().toISOString()}`}_debug(...e){return this.logDebugMessages&&this.logger(this._logPrefix(),...e),this}async initialize(){return this.initializePromise?await this.initializePromise:(this.initializePromise=(async()=>await this._acquireLock(this.lockAcquireTimeout,async()=>await this._initialize()))(),await this.initializePromise)}async _initialize(){var e;try{let r={},n="none";if(ur()&&(r=T9(window.location.href),this._isImplicitGrantCallback(r)?n="implicit":await this._isPKCECallback(r)&&(n="pkce")),ur()&&this.detectSessionInUrl&&n!=="none"){const{data:i,error:s}=await this._getSessionFromURL(r,n);if(s){if(this._debug("#_initialize()","error detecting session from URL",s),m9(s)){const l=(e=s.details)===null||e===void 0?void 0:e.code;if(l==="identity_already_exists"||l==="identity_not_found"||l==="single_identity_not_deletable")return{error:s}}return{error:s}}const{session:a,redirectType:o}=i;return this._debug("#_initialize()","detected session in URL",a,"redirect type",o),await this._saveSession(a),setTimeout(async()=>{o==="recovery"?await this._notifyAllSubscribers("PASSWORD_RECOVERY",a):await this._notifyAllSubscribers("SIGNED_IN",a)},0),{error:null}}return await this._recoverAndRefresh(),{error:null}}catch(r){return ue(r)?this._returnResult({error:r}):this._returnResult({error:new io("Unexpected error during initialization",r)})}finally{await this._handleVisibilityChange(),this._debug("#_initialize()","end")}}async signInAnonymously(e){var r,n,i;try{const s=await he(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{data:(n=(r=e==null?void 0:e.options)===null||r===void 0?void 0:r.data)!==null&&n!==void 0?n:{},gotrue_meta_security:{captcha_token:(i=e==null?void 0:e.options)===null||i===void 0?void 0:i.captchaToken}},xform:Vn}),{data:a,error:o}=s;if(o||!a)return this._returnResult({data:{user:null,session:null},error:o});const l=a.session,c=a.user;return a.session&&(await this._saveSession(a.session),await this._notifyAllSubscribers("SIGNED_IN",l)),this._returnResult({data:{user:c,session:l},error:null})}catch(s){if(ue(s))return this._returnResult({data:{user:null,session:null},error:s});throw s}}async signUp(e){var r,n,i;try{let s;if("email"in e){const{email:u,password:d,options:f}=e;let h=null,p=null;this.flowType==="pkce"&&([h,p]=await il(this.storage,this.storageKey)),s=await he(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,redirectTo:f==null?void 0:f.emailRedirectTo,body:{email:u,password:d,data:(r=f==null?void 0:f.data)!==null&&r!==void 0?r:{},gotrue_meta_security:{captcha_token:f==null?void 0:f.captchaToken},code_challenge:h,code_challenge_method:p},xform:Vn})}else if("phone"in e){const{phone:u,password:d,options:f}=e;s=await he(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{phone:u,password:d,data:(n=f==null?void 0:f.data)!==null&&n!==void 0?n:{},channel:(i=f==null?void 0:f.channel)!==null&&i!==void 0?i:"sms",gotrue_meta_security:{captcha_token:f==null?void 0:f.captchaToken}},xform:Vn})}else throw new Vh("You must provide either an email or phone number and a password");const{data:a,error:o}=s;
249if(o||!a)return await lr(this.storage,`${this.storageKey}-code-verifier`),this._returnResult({data:{user:null,session:null},error:o});const l=a.session,c=a.user;return a.session&&(await this._saveSession(a.session),await this._notifyAllSubscribers("SIGNED_IN",l)),this._returnResult({data:{user:c,session:l},error:null})}catch(s){if(await lr(this.storage,`${this.storageKey}-code-verifier`),ue(s))return this._returnResult({data:{user:null,session:null},error:s});throw s}}async signInWithPassword(e){try{let r;if("email"in e){const{email:s,password:a,options:o}=e;r=await he(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{email:s,password:a,gotrue_meta_security:{captcha_token:o==null?void 0:o.captchaToken}},xform:MP})}else if("phone"in e){const{phone:s,password:a,options:o}=e;r=await he(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{phone:s,password:a,gotrue_meta_security:{captcha_token:o==null?void 0:o.captchaToken}},xform:MP})}else throw new Vh("You must provide either an email or phone number and a password");const{data:n,error:i}=r;if(i)return this._returnResult({data:{user:null,session:null},error:i});if(!n||!n.session||!n.user){const s=new nl;return this._returnResult({data:{user:null,session:null},error:s})}return n.session&&(await this._saveSession(n.session),await this._notifyAllSubscribers("SIGNED_IN",n.session)),this._returnResult({data:Object.assign({user:n.user,session:n.session},n.weak_password?{weakPassword:n.weak_password}:null),error:i})}catch(r){if(ue(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}}async signInWithOAuth(e){var r,n,i,s;return await this._handleProviderSignIn(e.provider,{redirectTo:(r=e.options)===null||r===void 0?void 0:r.redirectTo,scopes:(n=e.options)===null||n===void 0?void 0:n.scopes,queryParams:(i=e.options)===null||i===void 0?void 0:i.queryParams,skipBrowserRedirect:(s=e.options)===null||s===void 0?void 0:s.skipBrowserRedirect})}async exchangeCodeForSession(e){return await this.initializePromise,this._acquireLock(this.lockAcquireTimeout,async()=>this._exchangeCodeForSession(e))}async signInWithWeb3(e){const{chain:r}=e;switch(r){case"ethereum":return await this.signInWithEthereum(e);case"solana":return await this.signInWithSolana(e);default:throw new Error(`@supabase/auth-js: Unsupported chain "${r}"`)}}async signInWithEthereum(e){var r,n,i,s,a,o,l,c,u,d,f;let h,p;if("message"in e)h=e.message,p=e.signature;else{const{chain:g,wallet:m,statement:v,options:y}=e;let b;if(ur())if(typeof m=="object")b=m;else{const P=window;if("ethereum"in P&&typeof P.ethereum=="object"&&"request"in P.ethereum&&typeof P.ethereum.request=="function")b=P.ethereum;else throw new Error("@supabase/auth-js: No compatible Ethereum wallet interface on the window object (window.ethereum) detected. Make sure the user already has a wallet installed and connected for this app. Prefer passing the wallet interface object directly to signInWithWeb3({ chain: 'ethereum', wallet: resolvedUserWallet }) instead.")}else{if(typeof m!="object"||!(y!=null&&y.url))throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");b=m}const w=new URL((r=y==null?void 0:y.url)!==null&&r!==void 0?r:window.location.href),S=await b.request({method:"eth_requestAccounts"}).then(P=>P).catch(()=>{throw new Error("@supabase/auth-js: Wallet method eth_requestAccounts is missing or invalid")});if(!S||S.length===0)throw new Error("@supabase/auth-js: No accounts available. Please ensure the wallet is connected.");const T=L$(S[0]);let _=(n=y==null?void 0:y.signInWithEthereum)===null||n===void 0?void 0:n.chainId;if(!_){const P=await b.request({method:"eth_chainId"});_=q9(P)}const A={domain:w.host,address:T,statement:v,uri:w.href,version:"1",chainId:_,nonce:(i=y==null?void 0:y.signInWithEthereum)===null||i===void 0?void 0:i.nonce,issuedAt:(a=(s=y==null?void 0:y.signInWithEthereum)===null||s===void 0?void 0:s.issuedAt)!==null&&a!==void 0?a:new Date,expirationTime:(o=y==null?void 0:y.signInWithEthereum)===null||o===void 0?void 0:o.expirationTime,notBefore:(l=y==null?void 0:y.signInWithEthereum)===null||l===void 0?void 0:l.notBefore,requestId:(c=y==null?void 0:y.signInWithEthereum)===null||c===void 0?void 0:c.requestId,resources:(u=y==null?void 0:y.signInWithEthereum)===null||u===void 0?void 0:u.resources};h=X9(A),p=await b.request({method:"personal_sign",params:[Y9(h),T]})}try{const{data:g,error:m}=await he(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"ethereum",message:h,signature:p},!((d=e.options)===null||d===void 0)&&d.captchaToken?{gotrue_meta_security:{captcha_token:(f=e.options)===null||f===void 0?void 0:f.captchaToken}}:null),xform:Vn});if(m)throw m;if(!g||!g.session||!g.user){const v=new nl;return this._returnResult({data:{user:null,session:null},error:v})}return g.session&&(await this._saveSession(g.session),await this._notifyAllSubscribers("SIGNED_IN",g.session)),this._returnResult({data:Object.assign({},g),error:m})}catch(g){if(ue(g))return this._returnResult({data:{user:null,session:null},error:g});throw g}}async signInWithSolana(e){var r,n,i,s,a,o,l,c,u,d,f,h;let p,g;if("message"in e)p=e.message,g=e.signature;else{const{chain:m,wallet:v,statement:y,options:b}=e;let w;if(ur())if(typeof v=="object")w=v;else{const T=window;if("solana"in T&&typeof T.solana=="object"&&("signIn"in T.solana&&typeof T.solana.signIn=="function"||"signMessage"in T.solana&&typeof T.solana.signMessage=="function"))w=T.solana;else throw new Error("@supabase/auth-js: No compatible Solana wallet interface on the window object (window.solana) detected. Make sure the user already has a wallet installed and connected for this app. Prefer passing the wallet interface object directly to signInWithWeb3({ chain: 'solana', wallet: resolvedUserWallet }) instead.")}else{if(typeof v!="object"||!(b!=null&&b.url))throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");w=v}const S=new URL((r=b==null?void 0:b.url)!==null&&r!==void 0?r:window.location.href);if("signIn"in w&&w.signIn){const T=await w.signIn(Object.assign(Object.assign(Object.assign({issuedAt:new Date().toISOString()},b==null?void 0:b.signInWithSolana),{version:"1",domain:S.host,uri:S.href}),y?{statement:y}:null));let _;if(Array.isArray(T)&&T[0]&&typeof T[0]=="object")_=T[0];else if(T&&typeof T=="object"&&"signedMessage"in T&&"signature"in T)_=T;else throw new Error("@supabase/auth-js: Wallet method signIn() returned unrecognized value");if("signedMessage"in _&&"signature"in _&&(typeof _.signedMessage=="string"||_.signedMessage instanceof Uint8Array)&&_.signature instanceof Uint8Array)p=typeof _.signedMessage=="string"?_.signedMessage:new TextDecoder().decode(_.signedMessage),g=_.signature;else throw new Error("@supabase/auth-js: Wallet method signIn() API returned object without signedMessage and signature fields")}else{if(!("signMessage"in w)||typeof w.signMessage!="function"||!("publicKey"in w)||typeof w!="object"||!w.publicKey||!("toBase58"in w.publicKey)||typeof w.publicKey.toBase58!="function")throw new Error("@supabase/auth-js: Wallet does not have a compatible signMessage() and publicKey.toBase58() API");p=[`${S.host} wants you to sign in with your Solana account:`,w.publicKey.toBase58(),...y?["",y,""]:[""],"Version: 1",`URI: ${S.href}`,`Issued At: ${(i=(n=b==null?void 0:b.signInWithSolana)===null||n===void 0?void 0:n.issuedAt)!==null&&i!==void 0?i:new Date().toISOString()}`,...!((s=b==null?void 0:b.signInWithSolana)===null||s===void 0)&&s.notBefore?[`Not Before: ${b.signInWithSolana.notBefore}`]:[],...!((a=b==null?void 0:b.signInWithSolana)===null||a===void 0)&&a.expirationTime?[`Expiration Time: ${b.signInWithSolana.expirationTime}`]:[],...!((o=b==null?void 0:b.signInWithSolana)===null||o===void 0)&&o.chainId?[`Chain ID: ${b.signInWithSolana.chainId}`]:[],...!((l=b==null?void 0:b.signInWithSolana)===null||l===void 0)&&l.nonce?[`Nonce: ${b.signInWithSolana.nonce}`]:[],...!((c=b==null?void 0:b.signInWithSolana)===null||c===void 0)&&c.requestId?[`Request ID: ${b.signInWithSolana.requestId}`]:[],...!((d=(u=b==null?void 0:b.signInWithSolana)===null||u===void 0?void 0:u.resources)===null||d===void 0)&&d.length?["Resources",...b.signInWithSolana.resources.map(_=>`- ${_}`)]:[]].join(`
250`);const T=await w.signMessage(new TextEncoder().encode(p),"utf8");if(!T||!(T instanceof Uint8Array))throw new Error("@supabase/auth-js: Wallet signMessage() API returned an recognized value");g=T}}try{const{data:m,error:v}=await he(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"solana",message:p,signature:lo(g)},!((f=e.options)===null||f===void 0)&&f.captchaToken?{gotrue_meta_security:{captcha_token:(h=e.options)===null||h===void 0?void 0:h.captchaToken}}:null),xform:Vn});if(v)throw v;if(!m||!m.session||!m.user){const y=new nl;return this._returnResult({data:{user:null,session:null},error:y})}return m.session&&(await this._saveSession(m.session),await this._notifyAllSubscribers("SIGNED_IN",m.session)),this._returnResult({data:Object.assign({},m),error:v})}catch(m){if(ue(m))return this._returnResult({data:{user:null,session:null},error:m});throw m}}async _exchangeCodeForSession(e){const r=await Ha(this.storage,`${this.storageKey}-code-verifier`),[n,i]=(r??"").split("/");try{if(!n&&this.flowType==="pkce")throw new g9;const{data:s,error:a}=await he(this.fetch,"POST",`${this.url}/token?grant_type=pkce`,{headers:this.headers,body:{auth_code:e,code_verifier:n},xform:Vn});if(await lr(this.storage,`${this.storageKey}-code-verifier`),a)throw a;if(!s||!s.session||!s.user){const o=new nl;return this._returnResult({data:{user:null,session:null,redirectType:null},error:o})}return s.session&&(await this._saveSession(s.session),await this._notifyAllSubscribers("SIGNED_IN",s.session)),this._returnResult({data:Object.assign(Object.assign({},s),{redirectType:i??null}),error:a})}catch(s){if(await lr(this.storage,`${this.storageKey}-code-verifier`),ue(s))return this._returnResult({data:{user:null,session:null,redirectType:null},error:s});throw s}}async signInWithIdToken(e){try{const{options:r,provider:n,token:i,access_token:s,nonce:a}=e,o=await he(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,body:{provider:n,id_token:i,access_token:s,nonce:a,gotrue_meta_security:{captcha_token:r==null?void 0:r.captchaToken}},xform:Vn}),{data:l,error:c}=o;if(c)return this._returnResult({data:{user:null,session:null},error:c});if(!l||!l.session||!l.user){const u=new nl;return this._returnResult({data:{user:null,session:null},error:u})}return l.session&&(await this._saveSession(l.session),await this._notifyAllSubscribers("SIGNED_IN",l.session)),this._returnResult({data:l,error:c})}catch(r){if(ue(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}}async signInWithOtp(e){var r,n,i,s,a;try{if("email"in e){const{email:o,options:l}=e;let c=null,u=null;this.flowType==="pkce"&&([c,u]=await il(this.storage,this.storageKey));const{error:d}=await he(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{email:o,data:(r=l==null?void 0:l.data)!==null&&r!==void 0?r:{},create_user:(n=l==null?void 0:l.shouldCreateUser)!==null&&n!==void 0?n:!0,gotrue_meta_security:{captcha_token:l==null?void 0:l.captchaToken},code_challenge:c,code_challenge_method:u},redirectTo:l==null?void 0:l.emailRedirectTo});return this._returnResult({data:{user:null,session:null},error:d})}if("phone"in e){const{phone:o,options:l}=e,{data:c,error:u}=await he(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{phone:o,data:(i=l==null?void 0:l.data)!==null&&i!==void 0?i:{},create_user:(s=l==null?void 0:l.shouldCreateUser)!==null&&s!==void 0?s:!0,gotrue_meta_security:{captcha_token:l==null?void 0:l.captchaToken},channel:(a=l==null?void 0:l.channel)!==null&&a!==void 0?a:"sms"}});return this._returnResult({data:{user:null,session:null,messageId:c==null?void 0:c.message_id},error:u})}throw new Vh("You must provide either an email or phone number.")}catch(o){if(await lr(this.storage,`${this.storageKey}-code-verifier`),ue(o))return this._returnResult({data:{user:null,session:null},error:o});throw o}}async verifyOtp(e){var r,n;try{let i,s;"options"in e&&(i=(r=e.options)===null||r===void 0?void 0:r.redirectTo,s=(n=e.options)===null||n===void 0?void 0:n.captchaToken);const{data:a,error:o}=await he(this.fetch,"POST",`${this.url}/verify`,{headers:this.headers,body:Object.assign(Object.assign({},e),{gotrue_meta_security:{captcha_token:s}}),redirectTo:i,xform:Vn});if(o)throw o;if(!a)throw new Error("An error occurred on token verification.");const l=a.session,c=a.user;return l!=null&&l.access_token&&(await this._saveSession(l),await this._notifyAllSubscribers(e.type=="recovery"?"PASSWORD_RECOVERY":"SIGNED_IN",l)),this._returnResult({data:{user:c,session:l},error:null})}catch(i){if(ue(i))return this._returnResult({data:{user:null,session:null},error:i});throw i}}async signInWithSSO(e){var r,n,i,s,a;try{let o=null,l=null;this.flowType==="pkce"&&([o,l]=await il(this.storage,this.storageKey));const c=await he(this.fetch,"POST",`${this.url}/sso`,{body:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},"providerId"in e?{provider_id:e.providerId}:null),"domain"in e?{domain:e.domain}:null),{redirect_to:(n=(r=e.options)===null||r===void 0?void 0:r.redirectTo)!==null&&n!==void 0?n:void 0}),!((i=e==null?void 0:e.options)===null||i===void 0)&&i.captchaToken?{gotrue_meta_security:{captcha_token:e.options.captchaToken}}
250:null),{skip_http_redirect:!0,code_challenge:o,code_challenge_method:l}),headers:this.headers,xform:U9});return!((s=c.data)===null||s===void 0)&&s.url&&ur()&&!(!((a=e.options)===null||a===void 0)&&a.skipBrowserRedirect)&&window.location.assign(c.data.url),this._returnResult(c)}catch(o){if(await lr(this.storage,`${this.storageKey}-code-verifier`),ue(o))return this._returnResult({data:null,error:o});throw o}}async reauthenticate(){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._reauthenticate())}async _reauthenticate(){try{return await this._useSession(async e=>{const{data:{session:r},error:n}=e;if(n)throw n;if(!r)throw new Xr;const{error:i}=await he(this.fetch,"GET",`${this.url}/reauthenticate`,{headers:this.headers,jwt:r.access_token});return this._returnResult({data:{user:null,session:null},error:i})})}catch(e){if(ue(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async resend(e){try{const r=`${this.url}/resend`;if("email"in e){const{email:n,type:i,options:s}=e,{error:a}=await he(this.fetch,"POST",r,{headers:this.headers,body:{email:n,type:i,gotrue_meta_security:{captcha_token:s==null?void 0:s.captchaToken}},redirectTo:s==null?void 0:s.emailRedirectTo});return this._returnResult({data:{user:null,session:null},error:a})}else if("phone"in e){const{phone:n,type:i,options:s}=e,{data:a,error:o}=await he(this.fetch,"POST",r,{headers:this.headers,body:{phone:n,type:i,gotrue_meta_security:{captcha_token:s==null?void 0:s.captchaToken}}});return this._returnResult({data:{user:null,session:null,messageId:a==null?void 0:a.message_id},error:o})}throw new Vh("You must provide either an email or phone number and a type")}catch(r){if(ue(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}}async getSession(){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>this._useSession(async r=>r))}async _acquireLock(e,r){this._debug("#_acquireLock","begin",e);try{if(this.lockAcquired){const n=this.pendingInLock.length?this.pendingInLock[this.pendingInLock.length-1]:Promise.resolve(),i=(async()=>(await n,await r()))();return this.pendingInLock.push((async()=>{try{await i}catch{}})()),i}return await this.lock(`lock:${this.storageKey}`,e,async()=>{this._debug("#_acquireLock","lock acquired for storage key",this.storageKey);try{this.lockAcquired=!0;const n=r();for(this.pendingInLock.push((async()=>{try{await n}catch{}})()),await n;this.pendingInLock.length;){const i=[...this.pendingInLock];await Promise.all(i),this.pendingInLock.splice(0,i.length)}return await n}finally{this._debug("#_acquireLock","lock released for storage key",this.storageKey),this.lockAcquired=!1}})}finally{this._debug("#_acquireLock","end")}}async _useSession(e){this._debug("#_useSession","begin");try{const r=await this.__loadSession();return await e(r)}finally{this._debug("#_useSession","end")}}async __loadSession(){this._debug("#__loadSession()","begin"),this.lockAcquired||this._debug("#__loadSession()","used outside of an acquired lock!",new Error().stack);try{let e=null;const r=await Ha(this.storage,this.storageKey);if(this._debug("#getSession()","session from storage",r),r!==null&&(this._isValidSession(r)?e=r:(this._debug("#getSession()","session from storage is not valid"),await this._removeSession())),!e)return{data:{session:null},error:null};const n=e.expires_at?e.expires_at*1e3-Date.now()<m0:!1;if(this._debug("#__loadSession()",`session has${n?"":" not"} expired`,"expires_at",e.expires_at),!n){if(this.userStorage){const a=await Ha(this.userStorage,this.storageKey+"-user");a!=null&&a.user?e.user=a.user:e.user=y0()}if(this.storage.isServer&&e.user&&!e.user.__isUserNotAvailableProxy){const a={value:this.suppressGetSessionWarning};e.user=$9(e.user,a),a.value&&(this.suppressGetSessionWarning=!0)}return{data:{session:e},error:null}}const{data:i,error:s}=await this._callRefreshToken(e.refresh_token);return s?this._returnResult({data:{session:null},error:s}):this._returnResult({data:{session:i},error:null})}finally{this._debug("#__loadSession()","end")}}async getUser(e){if(e)return await this._getUser(e);await this.initializePromise;const r=await this._acquireLock(this.lockAcquireTimeout,async()=>await this._getUser());return r.data.user&&(this.suppressGetSessionWarning=!0),r}async _getUser(e){try{return e?await he(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:e,xform:Js}):await this._useSession(async r=>{var n,i,s;const{data:a,error:o}=r;if(o)throw o;return!(!((n=a.session)===null||n===void 0)&&n.access_token)&&!this.hasCustomAuthorizationHeader?{data:{user:null},error:new Xr}:await he(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:(s=(i=a.session)===null||i===void 0?void 0:i.access_token)!==null&&s!==void 0?s:void 0,xform:Js})})}catch(r){if(ue(r))return g0(r)&&(await this._removeSession(),await lr(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({data:{user:null},error:r});throw r}}async updateUser(e,r={}){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._updateUser(e,r))}async _updateUser(e,r={}){try{return await this._useSession(async n=>{const{data:i,error:s}=n;if(s)throw s;if(!i.session)throw new Xr;const a=i.session;let o=null,l=null;this.flowType==="pkce"&&e.email!=null&&([o,l]=await il(this.storage,this.storageKey));const{data:c,error:u}=await he(this.fetch,"PUT",`${this.url}/user`,{headers:this.headers,redirectTo:r==null?void 0:r.emailRedirectTo,body:Object.assign(Object.assign({}
vendor: 4,857 bytes, line 250
250,e),{code_challenge:o,code_challenge_method:l}),jwt:a.access_token,xform:Js});if(u)throw u;return a.user=c.user,await this._saveSession(a),await this._notifyAllSubscribers("USER_UPDATED",a),this._returnResult({data:{user:a.user},error:null})})}catch(n){if(await lr(this.storage,`${this.storageKey}-code-verifier`),ue(n))return this._returnResult({data:{user:null},error:n});throw n}}async setSession(e){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._setSession(e))}async _setSession(e){try{if(!e.access_token||!e.refresh_token)throw new Xr;const r=Date.now()/1e3;let n=r,i=!0,s=null;const{payload:a}=Kh(e.access_token);if(a.exp&&(n=a.exp,i=n<=r),i){const{data:o,error:l}=await this._callRefreshToken(e.refresh_token);if(l)return this._returnResult({data:{user:null,session:null},error:l});if(!o)return{data:{user:null,session:null},error:null};s=o}else{const{data:o,error:l}=await this._getUser(e.access_token);if(l)return this._returnResult({data:{user:null,session:null},error:l});s={access_token:e.access_token,refresh_token:e.refresh_token,user:o.user,token_type:"bearer",expires_in:n-r,expires_at:n},await this._saveSession(s),await this._notifyAllSubscribers("SIGNED_IN",s)}return this._returnResult({data:{user:s.user,session:s},error:null})}catch(r){if(ue(r))return this._returnResult({data:{session:null,user:null},error:r});throw r}}async refreshSession(e){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._refreshSession(e))}async _refreshSession(e){try{return await this._useSession(async r=>{var n;if(!e){const{data:a,error:o}=r;if(o)throw o;e=(n=a.session)!==null&&n!==void 0?n:void 0}if(!(e!=null&&e.refresh_token))throw new Xr;const{data:i,error:s}=await this._callRefreshToken(e.refresh_token);return s?this._returnResult({data:{user:null,session:null},error:s}):i?this._returnResult({data:{user:i.user,session:i},error:null}):this._returnResult({data:{user:null,session:null},error:null})})}catch(r){if(ue(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}}async _getSessionFromURL(e,r){try{if(!ur())throw new Hh("No browser detected.");if(e.error||e.error_description||e.error_code)throw new Hh(e.error_description||"Error in URL with unspecified error_description",{error:e.error||"unspecified_error",code:e.error_code||"unspecified_code"});switch(r){case"implicit":if(this.flowType==="pkce")throw new CP("Not a valid PKCE flow url.");break;case"pkce":if(this.flowType==="implicit")throw new Hh("Not a valid implicit grant flow url.");break;default:}if(r==="pkce"){if(this._debug("#_initialize()","begin","is PKCE flow",!0),!e.code)throw new CP("No code detected.");const{data:y,error:b}=await this._exchangeCodeForSession(e.code);if(b)throw b;const w=new URL(window.location.href);return w.searchParams.delete("code"),window.history.replaceState(window.history.state,"",w.toString()),{data:{session:y.session,redirectType:null},error:null}}const{provider_token:n,provider_refresh_token:i,access_token:s,refresh_token:a,expires_in:o,expires_at:l,token_type:c}=e;if(!s||!o||!a||!c)throw new Hh("No session defined in URL");const u=Math.round(Date.now()/1e3),d=parseInt(o);let f=u+d;l&&(f=parseInt(l));const h=f-u;h*1e3<=wl&&console.warn(`@supabase/gotrue-js: Session as retrieved from URL expires in ${h}s, should have been closer to ${d}s`);const p=f-d;u-p>=120?console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued over 120s ago, URL could be stale",p,f,u):u-p<0&&console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued in the future? Check the device clock for skew",p,f,u);const{data:g,error:m}=await this._getUser(s);if(m)throw m;const v={provider_token:n,provider_refresh_token:i,access_token:s,expires_in:d,expires_at:f,refresh_token:a,token_type:c,user:g.user};return window.location.hash="",this._debug("#_getSessionFromURL()","clearing window.location.hash"),this._returnResult({data:{session:v,redirectType:e.type},error:null})}catch(n){if(ue(n))return this._returnResult({data:{session:null,redirectType:null},error:n});throw n}}_isImplicitGrantCallback(e){return typeof this.detectSessionInUrl=="function"?this.detectSessionInUrl(new URL(window.location.href),e):!!(e.access_token||e.error_description)}async _isPKCECallback(e){const r=await Ha(this.storage,`${this.storageKey}-code-verifier`);return!!(e.code&&r)}async signOut(e={scope:"global"}){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._signOut(e))}async _signOut({scope:e}={scope:"global"}){return await this._useSession(async r=>{var n;const{data:i,error:s}=r;if(s&&!g0(s))return this._returnResult({error:s});const a=(n=i.session)===null||n===void 0?void 0:n.access_token;if(a){const{error:o}=await this.admin.signOut(a,e);
250if(o&&!(p9(o)&&(o.status===404||o.status===401||o.status===403)||g0(o)))return this._returnResult({error:o})}return e!=="others"&&(await this._removeSession(),await lr(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({error:null})})}onAuthStateChange(e){const r=E9(),n={id:r,callback:e,unsubscribe:()=>{this._debug("#unsubscribe()","state change callback with id removed",r),this.stateChangeEmitters.delete(r)}};return this._debug("#onAuthStateChange()","registered callback with id",r),this.stateChangeEmitters.set(r,n),(async()=>(await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>{this._emitInitialSession(r)})))(),{data:{subscription:n}}}async _emitInitialSession(e){return await this._useSession(async r=>{var n,i;try{const{data:{session:s},error:a}=r;if(a)throw a;await((n=this.stateChangeEmitters.get(e))===null||n===void 0?void 0:n.callback("INITIAL_SESSION",s)),this._debug("INITIAL_SESSION","callback id",e,"session",s)}catch(s){await((i=this.stateChangeEmitters.get(e))===null||i===void 0?void 0:i.callback("INITIAL_SESSION",null)),this._debug("INITIAL_SESSION","callback id",e,"error",s),console.error(s)}})}async resetPasswordForEmail(e,r={}){let n=null,i=null;this.flowType==="pkce"&&([n,i]=await il(this.storage,this.storageKey,!0));try{return await he(this.fetch,"POST",`${this.url}/recover`,{body:{email:e,code_challenge:n,code_challenge_method:i,gotrue_meta_security:{captcha_token:r.captchaToken}},headers:this.headers,redirectTo:r.redirectTo})}catch(s){if(await lr(this.storage,`${this.storageKey}-code-verifier`),ue(s))return this._returnResult({data:null,error:s});throw s}}async getUserIdentities(){var e;try{const{data:r,error:n}=await this.getUser();if(n)throw n;return this._returnResult({data:{identities:(e=r.user.identities)!==null&&e!==void 0?e:[]},error:null})}catch(r){if(ue(r))return this._returnResult({data:null,error:r});throw r}}async linkIdentity(e){return"token"in e?this.linkIdentityIdToken(e):this.linkIdentityOAuth(e)}async linkIdentityOAuth(e){var r;try{const{data:n,error:i}=await this._useSession(async s=>{var a,o,l,c,u;const{data:d,error:f}=s;if(f)throw f;const h=await this._getUrlForProvider(`${this.url}/user/identities/authorize`,e.provider,{redirectTo:(a=e.options)===null||a===void 0?void 0:a.redirectTo,scopes:(o=e.options)===null||o===void 0?void 0:o.scopes,queryParams:(l=e.options)===null||l===void 0?void 0:l.queryParams,skipBrowserRedirect:!0});return await he(this.fetch,"GET",h,{headers:this.headers,jwt:(u=(c=d.session)===null||c===void 0?void 0:c.access_token)!==null&&u!==void 0?u:void 0})});if(i)throw i;return ur()&&!(!((r=e.options)===null||r===void 0)&&r.skipBrowserRedirect)&&window.location.assign(n==null?void 0:n.url),this._returnResult({data:{provider:e.provider,url:n==null?void 0:n.url},error:null})}catch(n){if(ue(n))return this._returnResult({data:{provider:e.provider,url:null},error:n});throw n}}async linkIdentityIdToken(e){return await this._useSession(async r=>{var n;try{const{error:i,data:{session:s}}=r;if(i)throw i;const{options:a,provider:o,token:l,access_token:c,nonce:u}=e,d=await he(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,jwt:(n=s==null?void 0:s.access_token)!==null&&n!==void 0?n:void 0,body:{provider:o,id_token:l,access_token:c,nonce:u,link_identity:!0,gotrue_meta_security:{captcha_token:a==null?void 0:a.captchaToken}},xform:Vn}),{data:f,error:h}=d;return h?this._returnResult({data:{user:null,session:null},error:h}):!f||!f.session||!f.user?this._returnResult({data:{user:null,session:null},error:new nl}):(f.session&&(await this._saveSession(f.session),await this._notifyAllSubscribers("USER_UPDATED",f.session)),this._returnResult({data:f,error:h}))}catch(i){if(await lr(this.storage,`${this.storageKey}-code-verifier`),ue(i))return this._returnResult({data:{user:null,session:null},error:i});throw i}})}async unlinkIdentity(e){try{return await this._useSession(async r=>{var n,i;const{data:s,error:a}=r;if(a)throw a;return await he(this.fetch,"DELETE",`${this.url}/user/identities/${e.identity_id}`,{headers:this.headers,jwt:(i=(n=s.session)===null||n===void 0?void 0:n.access_token)!==null&&i!==void 0?i:void 0})})}catch(r){if(ue(r))return this._returnResult({data:null,error:r});throw r}}async _refreshAccessToken(e){const r=`#_refreshAccessToken(${e.substring(0,5)}...)`;this._debug(r,"begin");try{const n=Date.now();return await P9(async i=>(i>0&&await A9(200*Math.pow(2,i-1)),this._debug(r,"refreshing attempt",i),await he(this.fetch,"POST",`${this.url}/token?grant_type=refresh_token`,{body:{refresh_token:e},headers:this.headers,xform:Vn})),(i,s)=>{const a=200*Math.pow(2,i);return s&&v0(s)&&Date.now()+a-n<wl})}catch(n){if(this._debug(r,"error",n),ue(n))return this._returnResult({data:{session:null,user:null},error:n});throw n}finally{this._debug(r,"end")}}_isValidSession(e){return typeof e=="object"&&e!==null&&"access_token"in e&&"refresh_token"in e&&"expires_at"in e}async _handleProviderSignIn(e,r){const n=await this._getUrlForProvider(`${this.url}/authorize`,e,{redirectTo:r.redirectTo,scopes:r.scopes,queryParams:r.queryParams});return this._debug("#_handleProviderSignIn()","provider",e,"options",r,"url",n),ur()&&!r.skipBrowserRedirect&&window.location.assign(n),{data:{provider:e,url:n},error:null}}async _recoverAndRefresh(){var e,r;const n="#_recoverAndRefresh()";this._debug(n,"begin");try{const i=await Ha(this.storage,this.storageKey);if(i&&this.userStorage){let a=await Ha(this.userStorage,this.storageKey+"-user");!this.storage.isServer&&Object.is(this.storage,this.userStorage)&&!a&&(a={user:i.user},await Sl(this.userStorage,this.storageKey+"-user",a)),i.user=(e=a==null?void 0:a.user)!==null&&e!==void 0?e:y0()}else if(i&&!i.user&&!i.user){const a=await Ha(this.storage,this.storageKey+"-user");a&&(a!=null&&a.user)?(i.user=a.user,await lr(this.storage,this.storageKey+"-user"),await Sl(this.storage,this.storageKey,i)):i.user=y0()}
250if(this._debug(n,"session from storage",i),!this._isValidSession(i)){this._debug(n,"session is not valid"),i!==null&&await this._removeSession();return}const s=((r=i.expires_at)!==null&&r!==void 0?r:1/0)*1e3-Date.now()<m0;if(this._debug(n,`session has${s?"":" not"} expired with margin of ${m0}s`),s){if(this.autoRefreshToken&&i.refresh_token){const{error:a}=await this._callRefreshToken(i.refresh_token);a&&(console.error(a),v0(a)||(this._debug(n,"refresh failed with a non-retryable error, removing the session",a),await this._removeSession()))}}else if(i.user&&i.user.__isUserNotAvailableProxy===!0)try{const{data:a,error:o}=await this._getUser(i.access_token);!o&&(a!=null&&a.user)?(i.user=a.user,await this._saveSession(i),await this._notifyAllSubscribers("SIGNED_IN",i)):this._debug(n,"could not get user data, skipping SIGNED_IN notification")}catch(a){console.error("Error getting user data:",a),this._debug(n,"error getting user data, skipping SIGNED_IN notification",a)}else await this._notifyAllSubscribers("SIGNED_IN",i)}catch(i){this._debug(n,"error",i),console.error(i);return}finally{this._debug(n,"end")}}async _callRefreshToken(e){var r,n;if(!e)throw new Xr;if(this.refreshingDeferred)return this.refreshingDeferred.promise;const i=`#_callRefreshToken(${e.substring(0,5)}...)`;this._debug(i,"begin");try{this.refreshingDeferred=new Iv;const{data:s,error:a}=await this._refreshAccessToken(e);if(a)throw a;if(!s.session)throw new Xr;await this._saveSession(s.session),await this._notifyAllSubscribers("TOKEN_REFRESHED",s.session);const o={data:s.session,error:null};return this.refreshingDeferred.resolve(o),o}catch(s){if(this._debug(i,"error",s),ue(s)){const a={data:null,error:s};return v0(s)||await this._removeSession(),(r=this.refreshingDeferred)===null||r===void 0||r.resolve(a),a}throw(n=this.refreshingDeferred)===null||n===void 0||n.reject(s),s}finally{this.refreshingDeferred=null,this._debug(i,"end")}}async _notifyAllSubscribers(e,r,n=!0){const i=`#_notifyAllSubscribers(${e})`;this._debug(i,"begin",r,`broadcast = ${n}`);try{this.broadcastChannel&&n&&this.broadcastChannel.postMessage({event:e,session:r});const s=[],a=Array.from(this.stateChangeEmitters.values()).map(async o=>{try{await o.callback(e,r)}catch(l){s.push(l)}});if(await Promise.all(a),s.length>0){for(let o=0;o<s.length;o+=1)console.error(s[o]);throw s[0]}}finally{this._debug(i,"end")}}async _saveSession(e){this._debug("#_saveSession()",e),this.suppressGetSessionWarning=!0,await lr(this.storage,`${this.storageKey}-code-verifier`);const r=Object.assign({},e),n=r.user&&r.user.__isUserNotAvailableProxy===!0;if(this.userStorage){!n&&r.user&&await Sl(this.userStorage,this.storageKey+"-user",{user:r.user});const i=Object.assign({},r);delete i.user;const s=DP(i);await Sl(this.storage,this.storageKey,s)}else{const i=DP(r);await Sl(this.storage,this.storageKey,i)}}async _removeSession(){this._debug("#_removeSession()"),this.suppressGetSessionWarning=!1,await lr(this.storage,this.storageKey),await lr(this.storage,this.storageKey+"-code-verifier"),await lr(this.storage,this.storageKey+"-user"),this.userStorage&&await lr(this.userStorage,this.storageKey+"-user"),await this._notifyAllSubscribers("SIGNED_OUT",null)}_removeVisibilityChangedCallback(){this._debug("#_removeVisibilityChangedCallback()");const e=this.visibilityChangedCallback;this.visibilityChangedCallback=null;try{e&&ur()&&(window!=null&&window.removeEventListener)&&window.removeEventListener("visibilitychange",e)}catch(r){console.error("removing visibilitychange callback failed",r)}}async _startAutoRefresh(){await this._stopAutoRefresh(),this._debug("#_startAutoRefresh()");const e=setInterval(()=>this._autoRefreshTokenTick(),wl);this.autoRefreshTicker=e,e&&typeof e=="object"&&typeof e.unref=="function"?e.unref():typeof Deno<"u"&&typeof Deno.unrefTimer=="function"&&Deno.unrefTimer(e);const r=setTimeout(async()=>{await this.initializePromise,await this._autoRefreshTokenTick()},0);this.autoRefreshTickTimeout=r,r&&typeof r=="object"&&typeof r.unref=="function"?r.unref():typeof Deno<"u"&&typeof Deno.unrefTimer=="function"&&Deno.unrefTimer(r)}async _stopAutoRefresh(){this._debug("#_stopAutoRefresh()");const e=this.autoRefreshTicker;this.autoRefreshTicker=null,e&&clearInterval(e);const r=this.autoRefreshTickTimeout;this.autoRefreshTickTimeout=null,r&&clearTimeout(r)}async startAutoRefresh(){this._removeVisibilityChangedCallback(),await this._startAutoRefresh()}async stopAutoRefresh(){this._removeVisibilityChangedCallback(),await this._stopAutoRefresh()}async _autoRefreshTokenTick(){this._debug("#_autoRefreshTokenTick()","begin");try{await this._acquireLock(0,async()=>{try{const e=Date.now();try{return await this._useSession(async r=>{const{data:{session:n}}=r;if(!n||!n.refresh_token||!n.expires_at){this._debug("#_autoRefreshTokenTick()","no session");return}const i=Math.floor((n.expires_at*1e3-e)/wl);this._debug("#_autoRefreshTokenTick()",`access token expires in ${i} ticks, a tick lasts ${wl}ms, refresh threshold is ${ew} ticks`),i<=ew&&await this._callRefreshToken(n.refresh_token)})}catch(r){console.error("Auto refresh tick failed with error. This is likely a transient error.",r)}}finally{this._debug("#_autoRefreshTokenTick()","end")}})}catch(e){if(e.isAcquireTimeout||e instanceof k$)this._debug("auto refresh token tick lock not available");else throw e}}async _handleVisibilityChange(){if(this._debug("#_handleVisibilityChange()"),!ur()||!(window!=null&&window.addEventListener))return this.autoRefreshToken&&this.startAutoRefresh(),!1;try{this.visibilityChangedCallback=async()=>{try{await this._onVisibilityChanged(!1)}catch(e){this._debug("#visibilityChangedCallback","error",e)}},window==null||window.addEventListener("visibilitychange",this.visibilityChangedCallback),await this._onVisibilityChanged(!0)}catch(e){console.error("_handleVisibilityChange",e)}}async _onVisibilityChanged(e){const r=`#_onVisibilityChanged(${e})`;this._debug(r,"visibilityState",document.visibilityState),document.visibilityState==="visible"?(this.autoRefreshToken&&this._startAutoRefresh(),e||(
250await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>{if(document.visibilityState!=="visible"){this._debug(r,"acquired the lock to recover the session, but the browser visibilityState is no longer visible, aborting");return}await this._recoverAndRefresh()}))):document.visibilityState==="hidden"&&this.autoRefreshToken&&this._stopAutoRefresh()}async _getUrlForProvider(e,r,n){const i=[`provider=${encodeURIComponent(r)}`];if(n!=null&&n.redirectTo&&i.push(`redirect_to=${encodeURIComponent(n.redirectTo)}`),n!=null&&n.scopes&&i.push(`scopes=${encodeURIComponent(n.scopes)}`),this.flowType==="pkce"){const[s,a]=await il(this.storage,this.storageKey),o=new URLSearchParams({code_challenge:`${encodeURIComponent(s)}`,code_challenge_method:`${encodeURIComponent(a)}`});i.push(o.toString())}if(n!=null&&n.queryParams){const s=new URLSearchParams(n.queryParams);i.push(s.toString())}return n!=null&&n.skipBrowserRedirect&&i.push(`skip_http_redirect=${n.skipBrowserRedirect}`),`${e}?${i.join("&")}`}async _unenroll(e){try{return await this._useSession(async r=>{var n;const{data:i,error:s}=r;return s?this._returnResult({data:null,error:s}):await he(this.fetch,"DELETE",`${this.url}/factors/${e.factorId}`,{headers:this.headers,jwt:(n=i==null?void 0:i.session)===null||n===void 0?void 0:n.access_token})})}catch(r){if(ue(r))return this._returnResult({data:null,error:r});throw r}}async _enroll(e){try{return await this._useSession(async r=>{var n,i;const{data:s,error:a}=r;if(a)return this._returnResult({data:null,error:a});const o=Object.assign({friendly_name:e.friendlyName,factor_type:e.factorType},e.factorType==="phone"?{phone:e.phone}:e.factorType==="totp"?{issuer:e.issuer}:{}),{data:l,error:c}=await he(this.fetch,"POST",`${this.url}/factors`,{body:o,headers:this.headers,jwt:(n=s==null?void 0:s.session)===null||n===void 0?void 0:n.access_token});return c?this._returnResult({data:null,error:c}):(e.factorType==="totp"&&l.type==="totp"&&(!((i=l==null?void 0:l.totp)===null||i===void 0)&&i.qr_code)&&(l.totp.qr_code=`data:image/svg+xml;utf-8,${l.totp.qr_code}`),this._returnResult({data:l,error:null}))})}catch(r){if(ue(r))return this._returnResult({data:null,error:r});throw r}}async _verify(e){return this._acquireLock(this.lockAcquireTimeout,async()=>{try{return await this._useSession(async r=>{var n;const{data:i,error:s}=r;if(s)return this._returnResult({data:null,error:s});const a=Object.assign({challenge_id:e.challengeId},"webauthn"in e?{webauthn:Object.assign(Object.assign({},e.webauthn),{credential_response:e.webauthn.type==="create"?nq(e.webauthn.credential_response):iq(e.webauthn.credential_response)})}:{code:e.code}),{data:o,error:l}=await he(this.fetch,"POST",`${this.url}/factors/${e.factorId}/verify`,{body:a,headers:this.headers,jwt:(n=i==null?void 0:i.session)===null||n===void 0?void 0:n.access_token});return l?this._returnResult({data:null,error:l}):(await this._saveSession(Object.assign({expires_at:Math.round(Date.now()/1e3)+o.expires_in},o)),await this._notifyAllSubscribers("MFA_CHALLENGE_VERIFIED",o),this._returnResult({data:o,error:l}))})}catch(r){if(ue(r))return this._returnResult({data:null,error:r});throw r}})}async _challenge(e){return this._acquireLock(this.lockAcquireTimeout,async()=>{try{return await this._useSession(async r=>{var n;const{data:i,error:s}=r;if(s)return this._returnResult({data:null,error:s});const a=await he(this.fetch,"POST",`${this.url}/factors/${e.factorId}/challenge`,{body:e,headers:this.headers,jwt:(n=i==null?void 0:i.session)===null||n===void 0?void 0:n.access_token});if(a.error)return a;const{data:o}=a;if(o.type!=="webauthn")return{data:o,error:null};switch(o.webauthn.type){case"create":return{data:Object.assign(Object.assign({},o),{webauthn:Object.assign(Object.assign({},o.webauthn),{credential_options:Object.assign(Object.assign({},o.webauthn.credential_options),{publicKey:tq(o.webauthn.credential_options.publicKey)})})}),error:null};case"request":return{data:Object.assign(Object.assign({},o),{webauthn:Object.assign(Object.assign({},o.webauthn),{credential_options:Object.assign(Object.assign({},o.webauthn.credential_options),{publicKey:rq(o.webauthn.credential_options.publicKey)})})}),error:null}}})}catch(r){if(ue(r))return this._returnResult({data:null,error:r});throw r}})}async _challengeAndVerify(e){const{data:r,error:n}=await this._challenge({factorId:e.factorId});return n?this._returnResult({data:null,error:n}):await this._verify({factorId:e.factorId,challengeId:r.id,code:e.code})}async _listFactors(){var e;const{data:{user:r},error:n}=await this.getUser();if(n)return{data:null,error:n};const i={all:[],phone:[],totp:[],webauthn:[]};for(const s of(e=r==null?void 0:r.factors)!==null&&e!==void 0?e:[])i.all.push(s),s.status==="verified"&&i[s.factor_type].push(s);return{data:i,error:null}}async _getAuthenticatorAssuranceLevel(e){var r,n,i,s;if(e)try{const{payload:h}=Kh(e);let p=null;h.aal&&(p=h.aal);let g=p;const{data:{user:m},error:v}=await this.getUser(e);if(v)return this._returnResult({data:null,error:v});((n=(r=m==null?void 0:m.factors)===null||r===void 0?void 0:r.filter(w=>w.status==="verified"))!==null&&n!==void 0?n:[]).length>0&&(g="aal2");const b=h.amr||[];return{data:{currentLevel:p,nextLevel:g,currentAuthenticationMethods:b},error:null}}catch(h){if(ue(h))return this._returnResult({data:null,error:h});throw h}const{data:{session:a},error:o}
250=await this.getSession();if(o)return this._returnResult({data:null,error:o});if(!a)return{data:{currentLevel:null,nextLevel:null,currentAuthenticationMethods:[]},error:null};const{payload:l}=Kh(a.access_token);let c=null;l.aal&&(c=l.aal);let u=c;((s=(i=a.user.factors)===null||i===void 0?void 0:i.filter(h=>h.status==="verified"))!==null&&s!==void 0?s:[]).length>0&&(u="aal2");const f=l.amr||[];return{data:{currentLevel:c,nextLevel:u,currentAuthenticationMethods:f},error:null}}async _getAuthorizationDetails(e){try{return await this._useSession(async r=>{const{data:{session:n},error:i}=r;return i?this._returnResult({data:null,error:i}):n?await he(this.fetch,"GET",`${this.url}/oauth/authorizations/${e}`,{headers:this.headers,jwt:n.access_token,xform:s=>({data:s,error:null})}):this._returnResult({data:null,error:new Xr})})}catch(r){if(ue(r))return this._returnResult({data:null,error:r});throw r}}async _approveAuthorization(e,r){try{return await this._useSession(async n=>{const{data:{session:i},error:s}=n;if(s)return this._returnResult({data:null,error:s});if(!i)return this._returnResult({data:null,error:new Xr});const a=await he(this.fetch,"POST",`${this.url}/oauth/authorizations/${e}/consent`,{headers:this.headers,jwt:i.access_token,body:{action:"approve"},xform:o=>({data:o,error:null})});return a.data&&a.data.redirect_url&&ur()&&!(r!=null&&r.skipBrowserRedirect)&&window.location.assign(a.data.redirect_url),a})}catch(n){if(ue(n))return this._returnResult({data:null,error:n});throw n}}async _denyAuthorization(e,r){try{return await this._useSession(async n=>{const{data:{session:i},error:s}=n;if(s)return this._returnResult({data:null,error:s});if(!i)return this._returnResult({data:null,error:new Xr});const a=await he(this.fetch,"POST",`${this.url}/oauth/authorizations/${e}/consent`,{headers:this.headers,jwt:i.access_token,body:{action:"deny"},xform:o=>({data:o,error:null})});return a.data&&a.data.redirect_url&&ur()&&!(r!=null&&r.skipBrowserRedirect)&&window.location.assign(a.data.redirect_url),a})}catch(n){if(ue(n))return this._returnResult({data:null,error:n});throw n}}async _listOAuthGrants(){try{return await this._useSession(async e=>{const{data:{session:r},error:n}=e;return n?this._returnResult({data:null,error:n}):r?await he(this.fetch,"GET",`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:r.access_token,xform:i=>({data:i,error:null})}):this._returnResult({data:null,error:new Xr})})}catch(e){if(ue(e))return this._returnResult({data:null,error:e});throw e}}async _revokeOAuthGrant(e){try{return await this._useSession(async r=>{const{data:{session:n},error:i}=r;return i?this._returnResult({data:null,error:i}):n?(await he(this.fetch,"DELETE",`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:n.access_token,query:{client_id:e.clientId},noResolveJson:!0}),{data:{},error:null}):this._returnResult({data:null,error:new Xr})})}catch(r){if(ue(r))return this._returnResult({data:null,error:r});throw r}}async fetchJwk(e,r={keys:[]}){let n=r.keys.find(o=>o.kid===e);if(n)return n;const i=Date.now();if(n=this.jwks.keys.find(o=>o.kid===e),n&&this.jwks_cached_at+f9>i)return n;const{data:s,error:a}=await he(this.fetch,"GET",`${this.url}/.well-known/jwks.json`,{headers:this.headers});if(a)throw a;return!s.keys||s.keys.length===0||(this.jwks=s,this.jwks_cached_at=i,n=s.keys.find(o=>o.kid===e),!n)?null:n}async getClaims(e,r={}){try{let n=e;if(!n){const{data:h,error:p}
250=await this.getSession();if(p||!h.session)return this._returnResult({data:null,error:p});n=h.session.access_token}const{header:i,payload:s,signature:a,raw:{header:o,payload:l}}=Kh(n);r!=null&&r.allowExpired||D9(s.exp);const c=!i.alg||i.alg.startsWith("HS")||!i.kid||!("crypto"in globalThis&&"subtle"in globalThis.crypto)?null:await this.fetchJwk(i.kid,r!=null&&r.keys?{keys:r.keys}:r==null?void 0:r.jwks);if(!c){const{error:h}=await this.getUser(n);if(h)throw h;return{data:{claims:s,header:i,signature:a},error:null}}const u=N9(i.alg),d=await crypto.subtle.importKey("jwk",c,u,!0,["verify"]);if(!await crypto.subtle.verify(u,d,a,w9(`${o}.${l}`)))throw new nw("Invalid JWT signature");return{data:{claims:s,header:i,signature:a},error:null}}catch(n){if(ue(n))return this._returnResult({data:null,error:n});throw n}}}Qd.nextInstanceID={};const hq=Qd,pq="2.99.1";let Zu="";typeof Deno<"u"?Zu="deno":typeof document<"u"?Zu="web":typeof navigator<"u"&&navigator.product==="ReactNative"?Zu="react-native":Zu="node";const mq={"X-Client-Info":`supabase-js-${Zu}/${pq}`},gq={headers:mq},vq={schema:"public"},yq={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"},bq={};function Jd(t){"@babel/helpers - typeof";return Jd=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Jd(t)}function xq(t,e){if(Jd(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(Jd(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function wq(t){var e=xq(t,"string");return Jd(e)=="symbol"?e:e+""}function Sq(t,e,r){return(e=wq(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function UP(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function Ct(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?UP(Object(r),!0).forEach(function(n){Sq(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):UP(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}const Eq=t=>t?(...e)=>t(...e):(...e)=>fetch(...e),Tq=()=>Headers,_q=(t,e,r)=>{const n=Eq(r),i=Tq();return async(s,a)=>{var o;const l=(o=await e())!==null&&o!==void 0?o:t;let c=new i(a==null?void 0:a.headers);return c.has("apikey")||c.set("apikey",t),c.has("Authorization")||c.set("Authorization",`Bearer ${l}`),n(s,Ct(Ct({},a),{},{headers:c}))}};function Aq(t){return t.endsWith("/")?t:t+"/"}function Pq(t,e){var r,n;const{db:i,auth:s,realtime:a,global:o}=t,{db:l,auth:c,realtime:u,global:d}=e,f={db:Ct(Ct({},l),i),auth:Ct(Ct({},c),s),realtime:Ct(Ct({},u),a),storage:{},global:Ct(Ct(Ct({},d),o),{},{headers:Ct(Ct({},(r=d==null?void 0:d.headers)!==null&&r!==void 0?r:{}),(n=o==null?void 0:o.headers)!==null&&n!==void 0?n:{})}),accessToken:async()=>""};return t.accessToken?f.accessToken=t.accessToken:delete f.accessToken,f}function Iq(t){const e=t==null?void 0:t.trim();if(!e)throw new Error("supabaseUrl is required.");if(!e.match(/^https?:\/\//i))throw new Error("Invalid supabaseUrl: Must be a valid HTTP or HTTPS URL.");try{return new URL(Aq(e))}catch{throw Error("Invalid supabaseUrl: Provided URL is malformed.")}}var Cq=class extends hq{constructor(t){super(t)}},Oq=class{constructor(t,e,r){var n,i;this.supabaseUrl=t,this.supabaseKey=e;const s=Iq(t);if(!e)throw new Error("supabaseKey is required.");this.realtimeUrl=new URL("realtime/v1",s),this.realtimeUrl.protocol=this.realtimeUrl.protocol.replace("http","ws"),this.authUrl=new URL("auth/v1",s),this.storageUrl=new URL("storage/v1",s),this.functionsUrl=new URL("functions/v1",s);const a=`sb-${s.hostname.split(".")[0]}-auth-token`,o={db:vq,realtime:bq,auth:Ct(Ct({},yq),{},{storageKey:a}),global:gq},l=Pq(r??{},o);if(this.storageKey=(n=l.auth.storageKey)!==null&&n!==void 0?n:"",this.headers=(i=l.global.headers)!==null&&i!==void 0?i:{},l.accessToken)this.accessToken=l.accessToken,this.auth=new Proxy({},{get:(u,d)=>{throw new Error(`@supabase/supabase-js: Supabase Client is configured with the accessToken option, accessing supabase.auth.${String(d)} is not possible`)}});else{var c;this.auth=this._initSupabaseAuthClient((c=l.auth)!==null&&c!==void 0?c:{},this.headers,l.global.fetch)}this.fetch=_q(e,this._getAccessToken.bind(this),l.global.fetch),this.realtime=this._initRealtimeClient(Ct({headers:this.headers,accessToken:this._getAccessToken.bind(this)},l.realtime)),this.accessToken&&Promise.resolve(this.accessToken()).then(u=>this.realtime.setAuth(u)).catch(u=>console.warn("Failed to set initial Realtime auth token:",u)),this.rest=new pz(new URL("rest/v1",s).href,{headers:this.headers,schema:l.db.schema,fetch:this.fetch,timeout:l.db.timeout,urlLengthLimit:l.db.urlLengthLimit}),this.storage=new o9(this.storageUrl.href,this.headers,this.fetch,r==null?void 0:r.storage),l.accessToken||this._listenForAuthEvents()}get functions(){return new az(this.functionsUrl.href,{headers:this.headers,customFetch:this.fetch})}from(t){return this.rest.from(t)}schema(t){return this.rest.schema(t)}rpc(t,e={},r={head:!1,get:!1,count:void 0}){return this.rest.rpc(t,e,r)}channel(t,e={config:{}}){return this.realtime.channel(t,e)}getChannels(){return this.realtime.getChannels()}removeChannel(t){return this.realtime.removeChannel(t)}removeAllChannels(){return this.realtime.removeAllChannels()}async _getAccessToken(){var t=this,e,r;if(t.accessToken)return await t.accessToken();const{data:n}=await t.auth.getSession();return(e=(r=n.session)===null||r===void 0?void 0:r.access_token)!==null&&e!==void 0?e:t.supabaseKey}_initSupabaseAuthClient({autoRefreshToken:t,persistSession:e,detectSessionInUrl:r,storage:n,userStorage:i,storageKey:s,flowType:a,lock:o,debug:l,throwOnError:c},u,d){const f={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new Cq({url:this.authUrl.href,headers:Ct(Ct({},f),u),storageKey:s,autoRefreshToken:t,persistSession:e,detectSessionInUrl:r,storage:n,userStorage:i,flowType:a,lock:o,debug:l,throwOnError:c,fetch:d,hasCustomAuthorizationHeader:Object.keys(this.headers).some(h=>h.toLowerCase()==="authorization")})}_initRealtimeClient(t){return new Rz(this.realtimeUrl.href,Ct(Ct({},t),{},{params:Ct(Ct({},{apikey:this.supabaseKey}),t==null?void 0:t.params)}))}_listenForAuthEvents(){return this.auth.onAuthStateChange((t,e)=>{this._handleTokenChanged(t,"CLIENT",e==null?void 0:e.access_token)})}_handleTokenChanged(t,e,r){(t==="TOKEN_REFRESHED"||t==="SIGNED_IN")&&this.changedAccessToken!==r?(this.changedAccessToken=r,this.realtime.setAuth(r)):t==="SIGNED_OUT"&&(this.realtime.setAuth(),e=="STORAGE"&&this.auth.signOut(),this.changedAccessToken=void 0)}};const Rq=(t,e,r)=>new Oq(t,e,r);function kq(){if(typeof window<"u")return!1;const t=globalThis.process;if(!t)return!1;const e=t.version;if(e==null)return!1;const r=e.match(/^v(\d+)\./);return r?parseInt(r[1],10)<=18:!1}kq()&&console.warn("⚠️  Node.js 18 and below are deprecated and will no longer be supported in future versions of @supabase/supabase-js. Please upgrade to N
250ode.js 20 or later. For more information, visit: https://github.com/orgs/supabase/discussions/37217");const Lq="https://ncdhsbeqkrhrsyledizj.supabase.co",Dq="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6Im5jZGhzYmVxa3JocnN5bGVkaXpqIiwicm9sZSI6ImFub24iLCJpYXQiOjE3NzM1MTgyODgsImV4cCI6MjA4OTA5NDI4OH0.yuH1JwbotJstmfJXnaYDyb6sbQNu4oO6SDRYQsV_s6M",_e=Rq(Lq,Dq,{auth:{storage:localStorage,persistSession:!0,autoRefreshToken:!0}}),N$=E.createContext(void 0),yn=()=>{const t=E.useContext(N$);if(t===void 0)throw new Error("useAuth must be used within an AuthProvider");return t},Nq="demo.robodost.ai",GP=typeof window<"u"&&window.location.hostname===Nq,Mq=({children:t})=>{const[e,r]=E.useState(null),[n,i]=E.useState(null),[s,a]=E.useState(!0),{toast:o}=FN();E.useEffect(()=>{if(GP){a(!1);return}const h=async g=>{try{const m=localStorage.getItem("pendingPlanSelection");if(!m)return;const v=String(m).toLowerCase().trim();if(!new Set(["basic","professional","enterprise"]).has(v))return;const{error:b}=await _e.rpc("upsert_plan_for_current_user",{p_plan:v});b||localStorage.removeItem("pendingPlanSelection")}catch{}},{data:{subscription:p}}=_e.auth.onAuthStateChange((g,m)=>{var v;i(m),r((m==null?void 0:m.user)??null),a(!1),g==="SIGNED_IN"&&(v=m==null?void 0:m.user)!=null&&v.id&&h(m.user.id)});return _e.auth.getSession().then(async({data:{session:g}})=>{var m;g?(i(g),r(g.user),a(!1),(m=g.user)!=null&&m.id&&h(g.user.id)):(i(null),r(null),a(!1))}),()=>p.unsubscribe()},[o]);const f={user:e,session:n,loading:s,isDemo:GP,signUp:async(h,p,g)=>{const{data:m,error:v}=await _e.auth.signUp({email:h,password:p,options:{data:{name:g||h.split("@")[0],full_name:g||h.split("@")[0]}}});if(m!=null&&m.user&&m.user.identities&&m.user.identities.length===0)return await _e.auth.resend({type:"signup",email:h}),o({title:"Account already exists",description:"We re-sent the confirmation link to your email. If you already verified, please sign in instead.",variant:"destructive"}),{error:{message:"User already exists"}};if(v){let y=v.message;v.message.includes("User already registered")||v.message.includes("already been registered")?(await _e.auth.resend({type:"signup",email:h}),y="An account with this email already exists. We re-sent the confirmation link. If already verified, sign in instead."):v.message.includes("email_address_invalid")||v.message.includes("Invalid email")?y="Please enter a valid email address.":v.message.includes("password")&&v.message.includes("weak")?y="Password must be at least 6 characters long.":v.message.includes("signup")&&(y="Unable to create account. Please try again or contact support."),o({title:"Sign up failed",description:y,variant:"destructive"})}else o({title:"Check your email",description:"We've sent you a confirmation link."});return{error:v}},signIn:async(h,p)=>{const{error:g}=await _e.auth.signInWithPassword({email:h,password:p});return g&&o({title:"Sign in failed",description:g.message,variant:"destructive"}),{error:g}},signOut:async()=>{const{error:h}=await _e.auth.signOut();h&&o({title:"Sign out failed",description:h.message,variant:"destructive"})},resetPassword:async h=>{const{error:p}=await _e.auth.resetPasswordForEmail(h,{redirectTo:`${window.location.origin}/reset-password`});return o(p?{title:"Password reset failed",description:p.message,variant:"destructive"}:{title:"Check your email",description:"We've sent you a password reset link."}),{error:p}}};return x.jsx(N$.Provider,{value:f,children:t})},ol=({children:t})=>{const{user:e,loading:r,isDemo:n}=yn(),i=Ir();return E.useEffect(()=>{!r&&!e&&!n&&i("/auth")},[e,r,n,i]),r?x.jsx("div",{className:"min-h-screen flex items-center justify-center",children:x.jsxs("div",{className:"text-center",children:[x.jsx(eT,{className:"h-8 w-8 animate-spin mx-auto mb-4 text-primary"}),x.jsx("p",{className:"text-muted-foreground",children:"Loading..."})]})}):!e&&!n?null:x.jsx(x.Fragment,{children:t})};var $q=Symbol.for("react.lazy"),Dm=Yg[" use ".trim().toString()];function jq(t){return typeof t=="object"&&t!==null&&"then"in t}function M$(t){return t!=null&&typeof t=="object"&&"$$typeof"in t&&t.$$typeof===$q&&"_payload"in t&&jq(t._payload)}function $$(t){const e=Bq(t),r=E.forwardRef((n,i)=>{let{children:s,...a}=n;M$(s)&&typeof Dm=="function"&&(s=Dm(s._payload));const o=E.Children.toArray(s),l=o.find(Gq);if(l){const c=l.props.children,u=o.map(d=>d===l?E.Children.count(c)>1?E.Children.only(null):E.isValidElement(c)?c.props.children:null:d);return x.jsx(e,{...a,ref:i,children:E.isValidElement(c)?E.cloneElement(c,void 0,u):null})}return x.jsx(e,{...a,ref:i,children:s})});return r.displayName=`${t}.Slot`,r}var Fq=$$("Slot");function Bq(t){const e=E.forwardRef((r,n)=>{let{children:i,...s}=r;if(M$(i)&&typeof Dm=="function"&&(i=Dm(i._payload)),E.isValidElement(i)){const a=Vq(i),o=Wq(s,i.props);return i.type!==E.Fragment&&(o.ref=n?Jc(n,a):a),E.cloneElement(i,o)}return E.Children.count(i)>1?E.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var Uq=Symbol("radix.slottable");function Gq(t){return E.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===Uq}function Wq(t,e){const r={...e};for(const n in e){const i=t[n],s=e[n];/^on[A-Z]/.test(n)?i&&s?r[n]=(...o)=>{const l=s(...o);return i(...o),l}:i&&(r[n]=i):n==="style"?r[n]={...i,...s}
250:n==="className"&&(r[n]=[i,s].filter(Boolean).join(" "))}return{...t,...r}}function Vq(t){var n,i;let e=(n=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:n.get,r=e&&"isReactWarning"in e&&e.isReactWarning;return r?t.ref:(e=(i=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:i.get,r=e&&"isReactWarning"in e&&e.isReactWarning,r?t.props.ref:t.props.ref||t.ref)}const iw=eh("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline",hero:"bg-gradient-primary text-primary-foreground hover:shadow-elegant hover:scale-[1.02] transition-all duration-300"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),Re=E.forwardRef(({className:t,variant:e,size:r,asChild:n=!1,...i},s)=>{const a=n?Fq:"button";return x.jsx(a,{className:be(iw({variant:e,size:r,className:t})),ref:s,...i})});Re.displayName="Button";const Ke=E.forwardRef(({className:t,...e},r)=>x.jsx("div",{ref:r,className:be("rounded-lg border bg-card text-card-foreground shadow-sm",t),...e}));Ke.displayName="Card";const rt=E.forwardRef(({className:t,...e},r)=>x.jsx("div",{ref:r,className:be("flex flex-col space-y-1.5 p-6",t),...e}));rt.displayName="CardHeader";const ct=E.forwardRef(({className:t,...e},r)=>x.jsx("h3",{ref:r,className:be("text-2xl font-semibold leading-none tracking-tight",t),...e}));ct.displayName="CardTitle";const ti=E.forwardRef(({className:t,...e},r)=>x.jsx("p",{ref:r,className:be("text-sm text-muted-foreground",t),...e}));ti.displayName="CardDescription";const ze=E.forwardRef(({className:t,...e},r)=>x.jsx("div",{ref:r,className:be("p-6 pt-0",t),...e}));ze.displayName="CardContent";const j$=E.forwardRef(({className:t,...e},r)=>x.jsx("div",{ref:r,className:be("flex items-center p-6 pt-0",t),...e}));j$.displayName="CardFooter";const Hq="/assets/Theft-g6hxAO68.png",Kq="/assets/Vendor_fraud-DE5xQnFO.png",zq="/assets/reconciliation-CjP0CSkf.png",$o="/assets/Roboeye-Cz0BxM9W.jpg",qq="demo.robodost.ai",Yq=typeof window<"u"&&window.location.hostname===qq,Xq=()=>{const t=Ir(),e=Is(),{user:r,loading:n}=yn(),i=async()=>{if(Yq){const s="[email protected]",a="Asdf1234";{const{error:o}=await _e.auth.signInWithPassword({email:s,password:a});o||(window.location.href="/dashboard")}}else t("/auth")};return E.useEffect(()=>{r&&e.pathname!=="/verify"&&t("/dashboard")},[r,t,e.pathname]),x.jsx("div",{className:"min-h-screen bg-gradient-to-br from-background to-secondary/20",children:x.jsxs("div",{className:"container mx-auto px-4 pt-10 pb-16",children:[x.jsxs("div",{className:"text-center mb-16",children:[x.jsx("div",{className:"mx-auto mb-0 -mt-[90pt] flex items-center justify-center",children:x.jsx("img",{src:$o,alt:"RoboEye",className:"w-[28rem] h-[28rem] md:w-[32rem] md:h-[32rem] object-contain"})}),x.jsx("p",{className:"text-xl text-muted-foreground -mt-48 mb-5 leading-tight max-w-2xl mx-auto",children:"Monitor your store from anywhere, reduce shrinkages anytime with enterprise-grade security."}),x.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 justify-center",children:[x.jsxs(Re,{size:"lg",className:"px-8",onClick:i,children:[x.jsx(Qu,{className:"w-4 h-4 mr-2"}),"Try Now"]}),x.jsx(_i,{to:"/plans",className:"w-full sm:w-auto",children:x.jsx(Re,{variant:"outline",size:"lg",className:"px-8 w-full",children:"View Plans"})}),x.jsx(_i,{to:"/auth?mode=admin&redirect=%2Fadmin",className:"w-full sm:w-auto",children:x.jsx(Re,{variant:"secondary",size:"lg",className:"px-8 w-full",children:"Admin Login"})})]})]}),x.jsxs("div",{className:"grid sm:grid-cols-2 md:grid-cols-3 gap-8 mb-16",children:[x.jsxs(Ke,{className:"border-0 shadow-lg bg-card/50 backdrop-blur-sm",children:[x.jsxs(rt,{className:"text-center",children:[x.jsx("div",{className:"w-12 h-12 mx-auto mb-4 rounded-full bg-primary/10 flex items-center justify-center",children:x.jsx("img",{src:Hq,alt:"Theft detection",className:"w-10 h-10 object-contain"})}),x.jsx(ct,{children:"Real Time Theft Detection and Monitoring"})]}),x.jsx(ze,{children:x.jsx(ti,{className:"text-center",children:"Monitor your store 24/7 with high-definition video streaming and get instant alerts for thefts/shoplifting."})})]}),x.jsxs(Ke,{className:"border-0 shadow-lg bg-card/50 backdrop-blur-sm",children:[x.jsxs(rt,{className:"text-center",children:[x.jsx("div",{className:"w-12 h-12 mx-auto mb-4 rounded-full bg-primary/10 flex items-center justify-center",children:x.jsx("img",{src:zq,alt:"Rack monitoring",className:"w-10 h-10 object-contain"})}),x.jsx(ct,{children:"Continuous Rack Checking"})]}),x.jsx(ze,{children:x.jsx(ti,{className:"text-center",children:"Automated monitoring of shelves and racks to detect anomalies and gaps."})})]}),x.jsxs(Ke,{className:"border-0 shadow-lg bg-card/50 backdrop-blur-sm",children:[x.jsxs(rt,{className:"text-center",children:[x.jsx("div",{className:"w-12 h-12 mx-auto mb-4 rounded-full bg-primary/10 flex items-center justify-center",children:x.jsx("img",{src:Kq,alt:"
250Vendor Check",className:"w-10 h-10 object-contain"})}),x.jsx(ct,{children:"Vendor Fraud"})]}),x.jsx(ze,{children:x.jsx(ti,{className:"text-center",children:"Check For vendor frauds, instantly."})})]}),x.jsxs(Ke,{className:"border-0 shadow-lg bg-card/50 backdrop-blur-sm",children:[x.jsxs(rt,{className:"text-center",children:[x.jsx("div",{className:"w-12 h-12 mx-auto mb-4 rounded-full bg-primary/10 flex items-center justify-center",children:x.jsx(EG,{className:"w-6 h-6 text-primary"})}),x.jsx(ct,{children:"Secure Access"})]}),x.jsx(ze,{children:x.jsx(ti,{className:"text-center",children:"Enterprise-grade security with encrypted connections and secure user authentication."})})]}),x.jsxs(Ke,{className:"border-0 shadow-lg bg-card/50 backdrop-blur-sm",children:[x.jsxs(rt,{className:"text-center",children:[x.jsx("div",{className:"w-12 h-12 mx-auto mb-4 rounded-full bg-primary/10 flex items-center justify-center",children:x.jsx(_G,{className:"w-6 h-6 text-primary"})}),x.jsx(ct,{children:"Multi-User Support"})]}),x.jsx(ze,{children:x.jsx(ti,{className:"text-center",children:"Manage multiple users with different access levels and permissions."})})]}),x.jsxs(Ke,{className:"border-0 shadow-lg bg-card/50 backdrop-blur-sm",children:[x.jsxs(rt,{className:"text-center",children:[x.jsx("div",{className:"w-12 h-12 mx-auto mb-4 rounded-full bg-primary/10 flex items-center justify-center",children:x.jsx(SG,{className:"w-6 h-6 text-primary"})}),x.jsx(ct,{children:"24×7 Cloud Backup"})]}),x.jsx(ze,{children:x.jsx(ti,{className:"text-center",children:"Continuous, automated backups to secure cloud storage. Restore footage anytime."})})]})]}),x.jsx("div",{className:"text-center",children:x.jsxs(Ke,{className:"max-w-2xl mx-auto border-0 shadow-lg bg-primary/5 backdrop-blur-sm",children:[x.jsxs(rt,{children:[x.jsx(ct,{className:"text-2xl",children:"Get Started Today"}),x.jsx(ti,{children:"Join thousands of users who trust our platform for their security needs."})]}),x.jsx(ze,{children:x.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 justify-center",children:[x.jsx(_i,{to:"/auth",className:"w-full sm:w-auto",children:x.jsx(Re,{size:"lg",className:"px-8 w-full",children:"Create Account"})}),x.jsx(_i,{to:"/auth",className:"w-full sm:w-auto",children:x.jsx(Re,{variant:"outline",size:"lg",className:"px-8 w-full",children:"Sign In"})}),x.jsx(_i,{to:"/auth?mode=admin&redirect=%2Fadmin",className:"w-full sm:w-auto",children:x.jsx(Re,{variant:"secondary",size:"lg",className:"px-8 w-full",children:"Admin Login"})})]})})]})})]})})},ir=E.forwardRef(({className:t,type:e,...r},n)=>x.jsx("input",{type:e,className:be("flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-base ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",t),ref:n,...r}));ir.displayName="Input";var Qq=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Jq=Qq.reduce((t,e)=>{const r=$$(`Primitive.${e}`),n=E.forwardRef((i,s)=>{const{asChild:a,...o}=i,l=a?r:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),x.jsx(l,{...o,ref:s})});return n.displayName=`Primitive.${e}`,{...t,[e]:n}},{}),Zq="Label",F$=E.forwardRef((t,e)=>x.jsx(Jq.label,{...t,ref:e,onMouseDown:r=>{var i;r.target.closest("button, input, select, textarea")||((i=t.onMouseDown)==null||i.call(t,r),!r.defaultPrevented&&r.detail>1&&r.preventDefault())}}));F$.displayName=Zq;var B$=F$;const eY=eh("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),Dt=E.forwardRef(({className:t,...e},r)=>x.jsx(B$,{ref:r,className:be(eY(),t),...e}));Dt.displayName=B$.displayName;var tY=E.createContext(void 0);function ST(t){const e=E.useContext(tY);return t||e||"ltr"}var x0="rovingFocusGroup.onEntryFocus",rY={bubbles:!1,cancelable:!0},nh="RovingFocusGroup",[sw,U$,nY]=XE(nh),[iY,G$]=Oa(nh,[nY]),[sY,aY]=iY(nh),W$=E.forwardRef((t,e)=>x.jsx(sw.Provider,{scope:t.__scopeRovingFocusGroup,children:x.jsx(sw.Slot,{scope:t.__scopeRovingFocusGroup,children:x.jsx(oY,{...t,ref:e})})}));W$.displayName=nh;var oY=E.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:r,orientation:n,loop:i=!1,dir:s,currentTabStopId:a,defaultCurrentTabStopId:o,onCurrentTabStopIdChange:l,onEntryFocus:c,preventScrollOnEntryFocus:u=!1,...d}=t,f=E.useRef(null),h=vt(e,f),p=ST(s),[g,m]=wc({prop:a,defaultProp:o??null,onChange:l,caller:nh}),[v,y]=E.useState(!1),b=Rn(c),w=U$(r),S=E.useRef(!1),[T,_]=E.useState(0);return E.useEffect(()=>{const A=f.current;if(A)return A.addEventListener(x0,b),()=>A.removeEventListener(x0,b)},[b]),x.jsx(sY,{scope:r,orientation:n,dir:p,loop:i,currentTabStopId:g,onItemFocus:E.useCallback(A=>m(A),[m]),onItemShiftTab:E.useCallback(()=>y(!0),[]),onFocusableItemAdd:E.useCallback(()=>_(A=>A+1),[]),onFocusableItemRemove:E.useCallback(()=>_(A=>A-1),[]),children:x.jsx(ke.div,{tabIndex:v||T===0?-1:0,"data-orientation":n,...d,ref:h,style:{outline:"none",...t.style},onMouseDown:ve(t.onMouseDown,()=>{S.current=!0}),onFocus:ve(t.onFocus,A=>{const P=!S.current;if(A.target===A.currentTarget&&P&&!v){const C=new CustomEvent(x0,rY);if(A.currentTarget.dispatchEvent(C),!C.defaultPrevented){const O=w().filter(M=>M.focusable),R=O.find(M=>M.active),D=O.find(M=>
vendor: 5,496 bytes, line 250
250M.id===g),j=[R,D,...O].filter(Boolean).map(M=>M.ref.current);K$(j,u)}}S.current=!1}),onBlur:ve(t.onBlur,()=>y(!1))})})}),V$="RovingFocusGroupItem",H$=E.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:r,focusable:n=!0,active:i=!1,tabStopId:s,children:a,...o}=t,l=tu(),c=s||l,u=aY(V$,r),d=u.currentTabStopId===c,f=U$(r),{onFocusableItemAdd:h,onFocusableItemRemove:p,currentTabStopId:g}=u;return E.useEffect(()=>{if(n)return h(),()=>p()},[n,h,p]),x.jsx(sw.ItemSlot,{scope:r,id:c,focusable:n,active:i,children:x.jsx(ke.span,{tabIndex:d?0:-1,"data-orientation":u.orientation,...o,ref:e,onMouseDown:ve(t.onMouseDown,m=>{n?u.onItemFocus(c):m.preventDefault()}),onFocus:ve(t.onFocus,()=>u.onItemFocus(c)),onKeyDown:ve(t.onKeyDown,m=>{if(m.key==="Tab"&&m.shiftKey){u.onItemShiftTab();return}if(m.target!==m.currentTarget)return;const v=uY(m,u.orientation,u.dir);if(v!==void 0){if(m.metaKey||m.ctrlKey||m.altKey||m.shiftKey)return;m.preventDefault();let b=f().filter(w=>w.focusable).map(w=>w.ref.current);if(v==="last")b.reverse();else if(v==="prev"||v==="next"){v==="prev"&&b.reverse();const w=b.indexOf(m.currentTarget);b=u.loop?dY(b,w+1):b.slice(w+1)}setTimeout(()=>K$(b))}}),children:typeof a=="function"?a({isCurrentTabStop:d,hasTabStop:g!=null}):a})})});H$.displayName=V$;var lY={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function cY(t,e){return e!=="rtl"?t:t==="ArrowLeft"?"ArrowRight":t==="ArrowRight"?"ArrowLeft":t}function uY(t,e,r){const n=cY(t.key,r);if(!(e==="vertical"&&["ArrowLeft","ArrowRight"].includes(n))&&!(e==="horizontal"&&["ArrowUp","ArrowDown"].includes(n)))return lY[n]}function K$(t,e=!1){const r=document.activeElement;for(const n of t)if(n===r||(n.focus({preventScroll:e}),document.activeElement!==r))return}function dY(t,e){return t.map((r,n)=>t[(e+n)%t.length])}var fY=W$,hY=H$,Cv="Tabs",[pY]=Oa(Cv,[G$]),z$=G$(),[mY,ET]=pY(Cv),q$=E.forwardRef((t,e)=>{const{__scopeTabs:r,value:n,onValueChange:i,defaultValue:s,orientation:a="horizontal",dir:o,activationMode:l="automatic",...c}=t,u=ST(o),[d,f]=wc({prop:n,onChange:i,defaultProp:s??"",caller:Cv});return x.jsx(mY,{scope:r,baseId:tu(),value:d,onValueChange:f,orientation:a,dir:u,activationMode:l,children:x.jsx(ke.div,{dir:u,"data-orientation":a,...c,ref:e})})});q$.displayName=Cv;var Y$="TabsList",X$=E.forwardRef((t,e)=>{const{__scopeTabs:r,loop:n=!0,...i}=t,s=ET(Y$,r),a=z$(r);return x.jsx(fY,{asChild:!0,...a,orientation:s.orientation,dir:s.dir,loop:n,children:x.jsx(ke.div,{role:"tablist","aria-orientation":s.orientation,...i,ref:e})})});X$.displayName=Y$;var Q$="TabsTrigger",J$=E.forwardRef((t,e)=>{const{__scopeTabs:r,value:n,disabled:i=!1,...s}=t,a=ET(Q$,r),o=z$(r),l=tj(a.baseId,n),c=rj(a.baseId,n),u=n===a.value;return x.jsx(hY,{asChild:!0,...o,focusable:!i,active:u,children:x.jsx(ke.button,{type:"button",role:"tab","aria-selected":u,"aria-controls":c,"data-state":u?"active":"inactive","data-disabled":i?"":void 0,disabled:i,id:l,...s,ref:e,onMouseDown:ve(t.onMouseDown,d=>{!i&&d.button===0&&d.ctrlKey===!1?a.onValueChange(n):d.preventDefault()}),onKeyDown:ve(t.onKeyDown,d=>{[" ","Enter"].includes(d.key)&&a.onValueChange(n)}),onFocus:ve(t.onFocus,()=>{const d=a.activationMode!=="manual";!u&&!i&&d&&a.onValueChange(n)})})})});J$.displayName=Q$;var Z$="TabsContent",ej=E.forwardRef((t,e)=>{const{__scopeTabs:r,value:n,forceMount:i,children:s,...a}=t,o=ET(Z$,r),l=tj(o.baseId,n),c=rj(o.baseId,n),u=n===o.value,d=E.useRef(u);return E.useEffect(()=>{const f=requestAnimationFrame(()=>d.current=!1);return()=>cancelAnimationFrame(f)},[]),x.jsx(Zc,{present:i||u,children:({present:f})=>x.jsx(ke.div,{"data-state":u?"active":"inactive","data-orientation":o.orientation,role:"tabpanel","aria-labelledby":l,hidden:!f,id:c,tabIndex:0,...a,ref:e,style:{...t.style,animationDuration:d.current?"0s":void 0},children:f&&s})})});ej.displayName=Z$;function tj(t,e){return`${t}-trigger-${e}`}function rj(t,e){return`${t}-content-${e}`}var gY=q$,nj=X$,ij=J$,sj=ej;const TT=gY,Ov=E.forwardRef(({className:t,...e},r)=>x.jsx(nj,{ref:r,className:be("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",t),...e}));Ov.displayName=nj.displayName;const ls=E.forwardRef(({className:t,...e},r)=>x.jsx(ij,{ref:r,className:be("inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm",t),...e}));ls.displayName=ij.displayName;const cs=E.forwardRef(({className:t,...e},r)=>x.jsx(sj,{ref:r,className:be("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",t),...e}));cs.displayName=sj.displayName;const vY=eh("relative w-full rounded-lg border p-4 [&>svg~*]:pl-7 [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground",{variants:{variant:{default:"bg-background text-foreground",destructive:"border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive"}},defaultVariants:{variant:"default"}}),So=E.forwardRef(({className:t,variant:e,...r},n)=>x.jsx("div",{ref:n,role:"alert",className:be(vY({variant:e}),t),...r}));So.displayName="Alert";
250const yY=E.forwardRef(({className:t,...e},r)=>x.jsx("h5",{ref:r,className:be("mb-1 font-medium leading-none tracking-tight",t),...e}));yY.displayName="AlertTitle";const Eo=E.forwardRef(({className:t,...e},r)=>x.jsx("div",{ref:r,className:be("text-sm [&_p]:leading-relaxed",t),...e}));Eo.displayName="AlertDescription";function cu(t){const[e,r]=E.useState(!1),[n,i]=E.useState(!0),[s,a]=E.useState(null);return E.useEffect(()=>{let o=!1;return(async()=>{i(!0),a(null);try{if(!t){r(!1);return}const{data:c,error:u}=await _e.rpc("is_admin");if(u)throw u;o||r(!!c)}catch(c){o||(r(!1),a((c==null?void 0:c.message)||"Failed to check admin"))}finally{o||i(!1)}})(),()=>{o=!0}},[t==null?void 0:t.id]),{isAdmin:e,checking:n,error:s}}const bY=()=>{const[t,e]=E.useState(!0),[r,n]=E.useState(""),[i,s]=E.useState(""),[a,o]=E.useState(""),[l,c]=E.useState(""),[u,d]=E.useState(!1),[f,h]=E.useState(""),[p,g]=E.useState("none"),{signIn:m,signUp:v,user:y}=yn(),b=Ir(),w=Is(),[S]=_v(),T=E.useMemo(()=>S.get("mode")==="admin",[S]),_=E.useMemo(()=>S.get("redirect")||void 0,[S]),{isAdmin:A,checking:P}=cu(y);E.useEffect(()=>{(async()=>{const D=S.get("token"),L=S.get("type");if(D&&L){g("verifying");try{const{error:j}=await _e.auth.verifyOtp({token_hash:D,type:L});j?(g("error"),h("Email verification failed. The link may have expired.")):(g("success"),setTimeout(()=>{b("/dashboard")},2e3))}catch{g("error"),h("An error occurred during verification.")}}})()},[S,b]),E.useEffect(()=>{y&&w.pathname!=="/verify"&&(P||b(A?_||"/admin":"/dashboard"))},[y,P,A,b,w.pathname,_]);const C=R=>/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(R),O=async R=>{if(R.preventDefault(),h(""),d(!0),!r||!i){h("Please fill in all required fields"),d(!1);return}if(!C(r)){h("Please enter a valid email address"),d(!1);return}if(i.length<6){h("Password must be at least 6 characters long"),d(!1);return}try{if(t){const{error:D}=await m(r,i);D&&h(D.message)}else{if(!a.trim()){h("Please enter your name"),d(!1);return}if(i!==l){h("Passwords do not match"),d(!1);return}const{error:D}=await v(r,i,a.trim());h(D?D.message:"")}}catch(D){h(D.message||"An unexpected error occurred")}finally{d(!1)}};return x.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gradient-to-br from-background to-secondary/20 p-4",children:x.jsx("div",{className:"w-full max-w-md",children:x.jsxs(Ke,{className:"shadow-lg border-0 bg-card/80 backdrop-blur-sm",children:[x.jsxs(rt,{className:"text-center space-y-2",children:[x.jsx("div",{className:"w-12 h-12 mx-auto rounded-full bg-primary/10 flex items-center justify-center",children:x.jsx(Qu,{className:"w-6 h-6 text-primary"})}),x.jsx(ct,{className:"text-2xl font-bold",children:T?"Admin Sign In":t?"Welcome back":"Create your account"}),x.jsx(ti,{children:T?"Enter administrator credentials to access the admin panel":t?"Sign in to your account to continue":"Enter your details to get started"})]}),x.jsxs(ze,{children:[x.jsxs(TT,{value:t?"login":"signup",className:"w-full",children:[!T&&x.jsxs(Ov,{className:"grid w-full grid-cols-2 mb-6",children:[x.jsx(ls,{value:"login",onClick:()=>e(!0),className:"data-[state=active]:bg-primary data-[state=active]:text-primary-foreground",children:"Sign In"}),x.jsx(ls,{value:"signup",onClick:()=>e(!1),className:"data-[state=active]:bg-primary data-[state=active]:text-primary-foreground",children:"Sign Up"})]}),p==="verifying"&&x.jsxs(So,{className:"mb-4",children:[x.jsx(Tm,{className:"h-4 w-4"}),x.jsx(Eo,{children:"Verifying your email..."})]}),p==="success"&&x.jsxs(So,{className:"mb-4 border-green-200 bg-green-50 text-green-700",children:[x.jsx(hM,{className:"h-4 w-4"}),x.jsx(Eo,{children:"Email verified successfully! Redirecting to plans..."})]}),f&&x.jsxs(So,{variant:"destructive",className:"mb-4",children:[x.jsx(Tm,{className:"h-4 w-4"}),x.jsx(Eo,{children:f})]}),x.jsxs("form",{onSubmit:O,className:"space-y-4",children:[x.jsxs(cs,{value:"login",className:"space-y-4 mt-0",children:[x.jsxs("div",{className:"space-y-2",children:[x.jsx(Dt,{htmlFor:"email",children:"Email"}),x.jsxs("div",{className:"relative",children:[x.jsx(Lx,{className:"absolute left-3 top-3 h-4 w-4 text-muted-foreground"}),x.jsx(ir,{id:"email",type:"email",placeholder:T?"Enter admin email":"Enter your email",value:r,onChange:R=>n(R.target.value),className:"pl-10",required:!0})]})]}),x.jsxs("div",{className:"space-y-2",children:[x.jsx(Dt,{htmlFor:"password",children:"Password"}),x.jsxs("div",{className:"relative",children:[x.jsx(Qu,{className:"absolute left-3 top-3 h-4 w-4 text-muted-foreground"}),x.jsx(ir,{id:"password",type:"password",placeholder:"Enter your password",value:i,onChange:R=>s(R.target.value),className:"pl-10",required:!0})]})]})]}
250),!T&&x.jsxs(cs,{value:"signup",className:"space-y-4 mt-0",children:[x.jsxs("div",{className:"space-y-2",children:[x.jsx(Dt,{htmlFor:"name",children:"Full Name"}),x.jsxs("div",{className:"relative",children:[x.jsx(gM,{className:"absolute left-3 top-3 h-4 w-4 text-muted-foreground"}),x.jsx(ir,{id:"name",type:"text",placeholder:"Enter your full name",value:a,onChange:R=>o(R.target.value),className:"pl-10",required:!t})]})]}),x.jsxs("div",{className:"space-y-2",children:[x.jsx(Dt,{htmlFor:"signup-email",children:"Email"}),x.jsxs("div",{className:"relative",children:[x.jsx(Lx,{className:"absolute left-3 top-3 h-4 w-4 text-muted-foreground"}),x.jsx(ir,{id:"signup-email",type:"email",placeholder:"Enter your email",value:r,onChange:R=>n(R.target.value),className:"pl-10",required:!0})]})]}),x.jsxs("div",{className:"space-y-2",children:[x.jsx(Dt,{htmlFor:"signup-password",children:"Password"}),x.jsxs("div",{className:"relative",children:[x.jsx(Qu,{className:"absolute left-3 top-3 h-4 w-4 text-muted-foreground"}),x.jsx(ir,{id:"signup-password",type:"password",placeholder:"Create a password",value:i,onChange:R=>s(R.target.value),className:"pl-10",required:!0})]})]}),x.jsxs("div",{className:"space-y-2",children:[x.jsx(Dt,{htmlFor:"confirm-password",children:"Confirm Password"}),x.jsxs("div",{className:"relative",children:[x.jsx(Qu,{className:"absolute left-3 top-3 h-4 w-4 text-muted-foreground"}),x.jsx(ir,{id:"confirm-password",type:"password",placeholder:"Confirm your password",value:l,onChange:R=>c(R.target.value),className:"pl-10",required:!t})]})]})]}),x.jsx(Re,{type:"submit",className:"w-full",disabled:u,children:u?"Please wait...":t?"Sign In":"Create Account"})]})]}),x.jsx("div",{className:"mt-6 text-center text-sm text-muted-foreground",children:x.jsxs("div",{className:"flex items-center justify-center gap-4",children:[x.jsx(_i,{to:"/",className:"hover:text-primary transition-colors",children:"← Back to home"}),T&&x.jsx(_i,{to:"/auth",className:"hover:text-primary transition-colors",children:"Regular user login"})]})})]})]})})})};function xY(){const{isDemo:t}=yn();return x.jsx(GK,{to:t?"/demo":"/login",replace:!0})}const se=Number.isFinite||function(t){return typeof t=="number"&&isFinite(t)},wY=Number.isSafeInteger||function(t){return typeof t=="number"&&Math.abs(t)<=SY},SY=Number.MAX_SAFE_INTEGER||9007199254740991;let fe=function(t){return t.NETWORK_ERROR="networkError",t.MEDIA_ERROR="mediaError",t.KEY_SYSTEM_ERROR="keySystemError",t.MUX_ERROR="muxError",t.OTHER_ERROR="otherError",t}({}),V=function(t){return t.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",t.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",t.KEY_SYSTEM_NO_SESSION="keySystemNoSession",t.KEY_SYSTEM_NO_CONFIGURED_LICENSE="keySystemNoConfiguredLicense",t.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",t.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED="keySystemServerCertificateRequestFailed",t.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED="keySystemServerCertificateUpdateFailed",t.KEY_SYSTEM_SESSION_UPDATE_FAILED="keySystemSessionUpdateFailed",t.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED="keySystemStatusOutputRestricted",t.KEY_SYSTEM_STATUS_INTERNAL_ERROR="keySystemStatusInternalError",t.KEY_SYSTEM_DESTROY_MEDIA_KEYS_ERROR="keySystemDestroyMediaKeysError",t.KEY_SYSTEM_DESTROY_CLOSE_SESSION_ERROR="keySystemDestroyCloseSessionError",t.KEY_SYSTEM_DESTROY_REMOVE_SESSION_ERROR="keySystemDestroyRemoveSessionError",t.MANIFEST_LOAD_ERROR="manifestLoadError",t.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",t.MANIFEST_PARSING_ERROR="manifestParsingError",t.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",t.LEVEL_EMPTY_ERROR="levelEmptyError",t.LEVEL_LOAD_ERROR="levelLoadError",t.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",t.LEVEL_PARSING_ERROR="levelParsingError",t.LEVEL_SWITCH_ERROR="levelSwitchError",t.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",t.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",t.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",t.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",t.FRAG_LOAD_ERROR="fragLoadError",t.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",t.FRAG_DECRYPT_ERROR="fragDecryptError",t.FRAG_PARSING_ERROR="fragParsingError",t.FRAG_GAP="fragGap",t.REMUX_ALLOC_ER
250ROR="remuxAllocError",t.KEY_LOAD_ERROR="keyLoadError",t.KEY_LOAD_TIMEOUT="keyLoadTimeOut",t.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",t.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",t.BUFFER_APPEND_ERROR="bufferAppendError",t.BUFFER_APPENDING_ERROR="bufferAppendingError",t.BUFFER_STALLED_ERROR="bufferStalledError",t.BUFFER_FULL_ERROR="bufferFullError",t.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",t.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",t.ASSET_LIST_LOAD_ERROR="assetListLoadError",t.ASSET_LIST_LOAD_TIMEOUT="assetListLoadTimeout",t.ASSET_LIST_PARSING_ERROR="assetListParsingError",t.INTERSTITIAL_ASSET_ITEM_ERROR="interstitialAssetItemError",t.INTERNAL_EXCEPTION="internalException",t.INTERNAL_ABORTED="aborted",t.ATTACH_MEDIA_ERROR="attachMediaError",t.UNKNOWN="unknown",t}({}),I=function(t){return t.MEDIA_ATTACHING="hlsMediaAttaching",t.MEDIA_ATTACHED="hlsMediaAttached",t.MEDIA_DETACHING="hlsMediaDetaching",t.MEDIA_DETACHED="hlsMediaDetached",t.MEDIA_ENDED="hlsMediaEnded",t.STALL_RESOLVED="hlsStallResolved",t.BUFFER_RESET="hlsBufferReset",t.BUFFER_CODECS="hlsBufferCodecs",t.BUFFER_CREATED="hlsBufferCreated",t.BUFFER_APPENDING="hlsBufferAppending",t.BUFFER_APPENDED="hlsBufferAppended",t.BUFFER_EOS="hlsBufferEos",t.BUFFERED_TO_END="hlsBufferedToEnd",t.BUFFER_FLUSHING="hlsBufferFlushing",t.BUFFER_FLUSHED="hlsBufferFlushed",t.MANIFEST_LOADING="hlsManifestLoading",t.MANIFEST_LOADED="hlsManifestLoaded",t.MANIFEST_PARSED="hlsManifestParsed",t.LEVEL_SWITCHING="hlsLevelSwitching",t.LEVEL_SWITCHED="hlsLevelSwitched",t.LEVEL_LOADING="hlsLevelLoading",t.LEVEL_LOADED="hlsLevelLoaded",t.LEVEL_UPDATED="hlsLevelUpdated",t.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",t.LEVELS_UPDATED="hlsLevelsUpdated",t.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",t.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",t.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",t.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",t.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",t.AUDIO_TRACK_UPDATED="hlsAudioTrackUpdated",t.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",t.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",t.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",t.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",t.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",t.SUBTITLE_TRACK_UPDATED="hlsSubtitleTrackUpdated",t.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",t.CUES_PARSED="hlsCuesParsed",t.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",t.INIT_PTS_FOUND="hlsInitPtsFound",t.FRAG_LOADING="hlsFragLoading",t.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",t.FRAG_LOADED="hlsFragLoaded",t.FRAG_DECRYPTED="hlsFragDecrypted",t.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",t.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",t.FRAG_PARSING_METADATA="hlsFragParsingMetadata",t.FRAG_PARSED="hlsFragParsed",t.FRAG_BUFFERED="hlsFragBuffered",t.FRAG_CHANGED="hlsFragChanged",t.FPS_DROP="hlsFpsDrop",t.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",t.MAX_AUTO_LEVEL_UPDATED="hlsMaxAutoLevelUpdated",t.ERROR="hlsError",t.DESTROYING="hlsDestroying",t.KEY_LOADING="hlsKeyLoading",t.KEY_LOADED="hlsKeyLoaded",t.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",t.BACK_BUFFER_REACHED="hlsBackBufferReached",t.STEERING_MANIFEST_LOADED="hlsSteeringManifestLoaded",t.ASSET_LIST_LOADING="hlsAssetListLoading",t.ASSET_LIST_LOADED="hlsAssetListLoaded",t.INTERSTITIALS_UPDATED="hlsInterstitialsUpdated",t.INTERSTITIALS_BUFFERED_TO_BOUNDARY="hlsInterstitialsBufferedToBoundary",t.INTERSTITIAL_ASSET_PLAYER_CREATED="hlsInterstitialAssetPlayerCreated",t.INTERSTITIAL_STARTED="hlsInterstitialStarted",t.INTERSTITIAL_ASSET_STARTED="hlsInterstitialAssetStarted",t.INTERSTITIAL_ASSET_ENDED="hlsInterstitialAssetEnded",t.INTERSTITIAL_ASSET_ERROR="hlsInterstitialAssetError",t.INTERSTITIAL_ENDED="hlsInterstitialEnded",t.INTERSTITIALS_PRIMARY_RESUMED="hlsInterstitialsPrimaryResumed",t.PLAYOUT_LIMIT_REACHED="hlsPlayoutLimitReached",t.EVENT_CUE_ENTER="hlsEventCueEnter",t}({});var Ce={MANIFEST:"manifest",LEVEL:"level",AUDIO_TRACK:"audioTrack",SUBTITLE_TRACK:"subtitleTrack"},oe={MAIN:"main",AUDIO:"audio",SUBTITLE:"subtitle"};class ll{constructor(e,r=0,n=0){this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=e,this.alpha_=e?Math.exp(Math.log(.5)/e):0,this.estimate_=r,this.totalWeight_=n}sample(e,r){const n=Math.pow(this.alpha_,e);this.estimate_=r*(1-n)+n*this.estimate_,this.totalWeight_+=e}
vendor: 4,105 bytes, line 250
250getTotalWeight(){return this.totalWeight_}getEstimate(){if(this.alpha_){const e=1-Math.pow(this.alpha_,this.totalWeight_);if(e)return this.estimate_/e}return this.estimate_}}class EY{constructor(e,r,n,i=100){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultTTFB_=void 0,this.ttfb_=void 0,this.defaultEstimate_=n,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new ll(e),this.fast_=new ll(r),this.defaultTTFB_=i,this.ttfb_=new ll(e)}update(e,r){const{slow_:n,fast_:i,ttfb_:s}=this;n.halfLife!==e&&(this.slow_=new ll(e,n.getEstimate(),n.getTotalWeight())),i.halfLife!==r&&(this.fast_=new ll(r,i.getEstimate(),i.getTotalWeight())),s.halfLife!==e&&(this.ttfb_=new ll(e,s.getEstimate(),s.getTotalWeight()))}sample(e,r){e=Math.max(e,this.minDelayMs_);const n=8*r,i=e/1e3,s=n/i;this.fast_.sample(i,s),this.slow_.sample(i,s)}sampleTTFB(e){const r=e/1e3,n=Math.sqrt(2)*Math.exp(-Math.pow(r,2)/2);this.ttfb_.sample(n,Math.max(e,5))}canEstimate(){return this.fast_.getTotalWeight()>=this.minWeight_}getEstimate(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_}getEstimateTTFB(){return this.ttfb_.getTotalWeight()>=this.minWeight_?this.ttfb_.getEstimate():this.defaultTTFB_}get defaultEstimate(){return this.defaultEstimate_}destroy(){}}function TY(t,e,r){return(e=AY(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function et(){return et=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)({}).hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},et.apply(null,arguments)}function WP(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function Ve(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?WP(Object(r),!0).forEach(function(n){TY(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):WP(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function _Y(t,e){if(typeof t!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function AY(t){var e=_Y(t,"string");return typeof e=="symbol"?e:e+""}class Dn{constructor(e,r){this.trace=void 0,this.debug=void 0,this.log=void 0,this.warn=void 0,this.info=void 0,this.error=void 0;const n=`[${e}]:`;this.trace=zs,this.debug=r.debug.bind(null,n),this.log=r.log.bind(null,n),this.warn=r.warn.bind(null,n),this.info=r.info.bind(null,n),this.error=r.error.bind(null,n)}}const zs=function(){},PY={trace:zs,debug:zs,log:zs,warn:zs,info:zs,error:zs};function aw(){return et({},PY)}function IY(t,e){const r=self.console[t];return r?r.bind(self.console,`${e?"["+e+"] ":""}[${t}] >`):zs}function VP(t,e,r){return e[t]?e[t].bind(e):IY(t,r)}const ow=aw();function CY(t,e,r){const n=aw();if(typeof console=="object"&&t===!0||typeof t=="object"){const i=["debug","log","info","warn","error"];i.forEach(s=>{n[s]=VP(s,t,r)});try{n.log(`Debug logs enabled for "${e}" in hls.js version 1.6.15`)}catch{return aw()}i.forEach(s=>{ow[s]=VP(s,t)})}else et(ow,n);return n}const qe=ow;function Ta(t=!0){return typeof self>"u"?void 0:(t||!self.MediaSource)&&self.ManagedMediaSource||self.MediaSource||self.WebKitMediaSource}function OY(t){return typeof self<"u"&&t===self.ManagedMediaSource}function aj(t,e){const r=Object.keys(t),n=Object.keys(e),i=r.length,s=n.length;return!i||!s||i===s&&!r.some(a=>n.indexOf(a)===-1)}function hn(t,e=!1){if(typeof TextDecoder<"u"){const c=new TextDecoder("utf-8").decode(t);if(e){const u=c.indexOf("\0");return u!==-1?c.substring(0,u):c}return c.replace(/\0/g,"")}const r=t.length;let n,i,s,a="",o=0;for(;o<r;){if(n=t[o++],n===0&&e)return a;
vendor: 30,324 bytes, line 250
250if(n===0||n===3)continue;switch(n>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:a+=String.fromCharCode(n);break;case 12:case 13:i=t[o++],a+=String.fromCharCode((n&31)<<6|i&63);break;case 14:i=t[o++],s=t[o++],a+=String.fromCharCode((n&15)<<12|(i&63)<<6|(s&63)<<0);break}}return a}function pr(t){let e="";for(let r=0;r<t.length;r++){let n=t[r].toString(16);n.length<2&&(n="0"+n),e+=n}return e}function oj(t){return Uint8Array.from(t.replace(/^0x/,"").replace(/([\da-fA-F]{2}) ?/g,"0x$1 ").replace(/ +$/,"").split(" ")).buffer}function RY(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var w0={exports:{}},HP;function kY(){return HP||(HP=1,function(t,e){(function(r){var n=/^(?=((?:[a-zA-Z0-9+\-.]+:)?))\1(?=((?:\/\/[^\/?#]*)?))\2(?=((?:(?:[^?#\/]*\/)*[^;?#\/]*)?))\3((?:;[^?#]*)?)(\?[^#]*)?(#[^]*)?$/,i=/^(?=([^\/?#]*))\1([^]*)$/,s=/(?:\/|^)\.(?=\/)/g,a=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,o={buildAbsoluteURL:function(l,c,u){if(u=u||{},l=l.trim(),c=c.trim(),!c){if(!u.alwaysNormalize)return l;var d=o.parseURL(l);if(!d)throw new Error("Error trying to parse base URL.");return d.path=o.normalizePath(d.path),o.buildURLFromParts(d)}var f=o.parseURL(c);if(!f)throw new Error("Error trying to parse relative URL.");if(f.scheme)return u.alwaysNormalize?(f.path=o.normalizePath(f.path),o.buildURLFromParts(f)):c;var h=o.parseURL(l);if(!h)throw new Error("Error trying to parse base URL.");if(!h.netLoc&&h.path&&h.path[0]!=="/"){var p=i.exec(h.path);h.netLoc=p[1],h.path=p[2]}h.netLoc&&!h.path&&(h.path="/");var g={scheme:h.scheme,netLoc:f.netLoc,path:null,params:f.params,query:f.query,fragment:f.fragment};if(!f.netLoc&&(g.netLoc=h.netLoc,f.path[0]!=="/"))if(!f.path)g.path=h.path,f.params||(g.params=h.params,f.query||(g.query=h.query));else{var m=h.path,v=m.substring(0,m.lastIndexOf("/")+1)+f.path;g.path=o.normalizePath(v)}return g.path===null&&(g.path=u.alwaysNormalize?o.normalizePath(f.path):f.path),o.buildURLFromParts(g)},parseURL:function(l){var c=n.exec(l);return c?{scheme:c[1]||"",netLoc:c[2]||"",path:c[3]||"",params:c[4]||"",query:c[5]||"",fragment:c[6]||""}:null},normalizePath:function(l){for(l=l.split("").reverse().join("").replace(s,"");l.length!==(l=l.replace(a,"")).length;);return l.split("").reverse().join("")},buildURLFromParts:function(l){return l.scheme+l.netLoc+l.path+l.params+l.query+l.fragment}};t.exports=o})()}(w0)),w0.exports}var _T=kY();class AT{constructor(){this.aborted=!1,this.loaded=0,this.retry=0,this.total=0,this.chunkCount=0,this.bwEstimate=0,this.loading={start:0,first:0,end:0},this.parsing={start:0,end:0},this.buffering={start:0,first:0,end:0}}}var nt={AUDIO:"audio",VIDEO:"video",AUDIOVIDEO:"audiovideo"};class lj{constructor(e){this._byteRange=null,this._url=null,this._stats=null,this._streams=null,this.base=void 0,this.relurl=void 0,typeof e=="string"&&(e={url:e}),this.base=e,DY(this,"stats")}setByteRange(e,r){const n=e.split("@",2);let i;n.length===1?i=(r==null?void 0:r.byteRangeEndOffset)||0:i=parseInt(n[1]),this._byteRange=[i,parseInt(n[0])+i]}get baseurl(){return this.base.url}get byteRange(){return this._byteRange===null?[]:this._byteRange}get byteRangeStartOffset(){return this.byteRange[0]}get byteRangeEndOffset(){return this.byteRange[1]}get elementaryStreams(){return this._streams===null&&(this._streams={[nt.AUDIO]:null,[nt.VIDEO]:null,[nt.AUDIOVIDEO]:null}),this._streams}set elementaryStreams(e){this._streams=e}get hasStats(){return this._stats!==null}get hasStreams(){return this._streams!==null}get stats(){return this._stats===null&&(this._stats=new AT),this._stats}set stats(e){this._stats=e}get url(){return!this._url&&this.baseurl&&this.relurl&&(this._url=_T.buildAbsoluteURL(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""}set url(e){this._url=e}clearElementaryStreamInfo(){const{elementaryStreams:e}=this;e[nt.AUDIO]=null,e[nt.VIDEO]=null,e[nt.AUDIOVIDEO]=null}}function Nt(t){return t.sn!=="initSegment"}class S0 extends lj{constructor(e,r){super(r),this._decryptdata=null,this._programDateTime=null,this._ref=null,this._bitrate=void 0,this.rawProgramDateTime=null,this.tagList=[],this.duration=0,this.sn=0,this.levelkeys=void 0,this.type=void 0,this.loader=null,this.keyLoader=null,this.level=-1,this.cc=0,this.startPTS=void 0,this.endPTS=void 0,this.startDTS=void 0,this.endDTS=void 0,this.start=0,this.playlistOffset=0,this.deltaPTS=void 0,this.maxStartPTS=void 0,this.minEndPTS=void 0,this.data=void 0,this.bitrateTest=!1,this.title=null,this.initSegment=null,this.endList=void 0,this.gap=void 0,this.urlId=0,this.type=e}get byteLength(){if(this.hasStats){const e=this.stats.total;if(e)return e}if(this.byteRange.length){const e=this.byteRange[0],r=this.byteRange[1];if(se(e)&&se(r))return r-e}return null}get bitrate(){return this.byteLength?this.byteLength*8/this.duration:this._bitrate?this._bitrate:null}set bitrate(e){this._bitrate=e}get decryptdata(){var e;const{levelkeys:r}=this;if(!r||r.NONE)return null;if(r.identity)this._decryptdata||(this._decryptdata=r.identity.getDecryptData(this.sn));else if(!((e=this._decryptdata)!=null&&e.keyId)){const n=Object.keys(r);if(n.length===1){const i=this._decryptdata=r[n[0]]||null;i&&(this._decryptdata=i.getDecryptData(this.sn,r))}}return this._decryptdata}get end(){return this.start+this.duration}get endProgramDateTime(){if(this.programDateTime===null)return null;const e=se(this.duration)?this.duration:0;return this.programDateTime+e*1e3}get encrypted(){var e;if((e=this._decryptdata)!=null&&e.encrypted)return!0;if(this.levelkeys){var r;const n=Object.keys(this.levelkeys),i=n.length;if(i>1||i===1&&(r=this.levelkeys[n[0]])!=null&&r.encrypted)return!0}return!1}get programDateTime(){return this._programDateTime===null&&this.rawProgramDateTime&&(this.programDateTime=Date.parse(this.rawProgramDateTime)),this._programDateTime}set programDateTime(e){if(!se(e)){this._programDateTime=this.rawProgramDateTime=null;return}this._programDateTime=e}get ref(){return Nt(this)?(this._ref||(this._ref={base:this.base,start:this.start,duration:this.duration,sn:this.sn,programDateTime:this.programDateTime}),this._ref):null}addStart(e){this.setStart(this.start+e)}setStart(e){this.start=e,this._ref&&(this._ref.start=e)}setDuration(e){this.duration=e,this._ref&&(this._ref.duration=e)}setKeyFormat(e){const r=this.levelkeys;if(r){var n;const i=r[e];i&&!((n=this._decryptdata)!=null&&n.keyId)&&(this._decryptdata=i.getDecryptData(this.sn,r))}}abortRequests(){var e,r;(e=this.loader)==null||e.abort(),(r=this.keyLoader)==null||r.abort()}setElementaryStreamInfo(e,r,n,i,s,a=!1){const{elementaryStreams:o}=this,l=o[e];if(!l){o[e]={startPTS:r,endPTS:n,startDTS:i,endDTS:s,partial:a};return}l.startPTS=Math.min(l.startPTS,r),l.endPTS=Math.max(l.endPTS,n),l.startDTS=Math.min(l.startDTS,i),l.endDTS=Math.max(l.endDTS,s)}}class LY extends lj{constructor(e,r,n,i,s){super(n),this.fragOffset=0,this.duration=0,this.gap=!1,this.independent=!1,this.relurl=void 0,this.fragment=void 0,this.index=void 0,this.duration=e.decimalFloatingPoint("DURATION"),this.gap=e.bool("GAP"),this.independent=e.bool("INDEPENDENT"),this.relurl=e.enumeratedString("URI"),this.fragment=r,this.index=i;const a=e.enumeratedString("BYTERANGE");a&&this.setByteRange(a,s),s&&(this.fragOffset=s.fragOffset+s.duration)}get start(){return this.fragment.start+this.fragOffset}get end(){return this.start+this.duration}get loaded(){const{elementaryStreams:e}=this;return!!(e.audio||e.video||e.audiovideo)}}function cj(t,e){const r=Object.getPrototypeOf(t);if(r){const n=Object.getOwnPropertyDescriptor(r,e);return n||cj(r,e)}}function DY(t,e){const r=cj(t,e);r&&(r.enumerable=!0,Object.defineProperty(t,e,r))}const KP=Math.pow(2,32)-1,NY=[].push,uj={video:1,audio:2,id3:3,text:4};function Kt(t){return String.fromCharCode.apply(null,t)}function dj(t,e){const r=t[e]<<8|t[e+1];return r<0?65536+r:r}function xe(t,e){const r=fj(t,e);return r<0?4294967296+r:r}function zP(t,e){let r=xe(t,e);return r*=Math.pow(2,32),r+=xe(t,e+4),r}function fj(t,e){return t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3]}function MY(t){const e=t.byteLength;for(let r=0;r<e;){const n=xe(t,r);if(n>8&&t[r+4]===109&&t[r+5]===111&&t[r+6]===111&&t[r+7]===102)return!0;r=n>1?r+n:e}return!1}function Ie(t,e){const r=[];if(!e.length)return r;const n=t.byteLength;for(let i=0;i<n;){const s=xe(t,i),a=Kt(t.subarray(i+4,i+8)),o=s>1?i+s:n;if(a===e[0])if(e.length===1)r.push(t.subarray(i+8,o));else{const l=Ie(t.subarray(i+8,o),e.slice(1));l.length&&NY.apply(r,l)}i=o}return r}function $Y(t){const e=[],r=t[0];let n=8;const i=xe(t,n);n+=4;let s=0,a=0;r===0?(s=xe(t,n),a=xe(t,n+4),n+=8):(s=zP(t,n),a=zP(t,n+8),n+=16),n+=2;let o=t.length+a;const l=dj(t,n);n+=2;for(let c=0;c<l;c++){let u=n;const d=xe(t,u);u+=4;const f=d&2147483647;if((d&2147483648)>>>31===1)return qe.warn("SIDX has hierarchical references (not supported)"),null;const p=xe(t,u);u+=4,e.push({referenceSize:f,subsegmentDuration:p,info:{duration:p/i,start:o,end:o+f-1}}),o+=f,u+=4,n=u}return{earliestPresentationTime:s,timescale:i,version:r,referencesCount:l,references:e}}function hj(t){const e=[],r=Ie(t,["moov","trak"]);for(let i=0;i<r.length;i++){const s=r[i],a=Ie(s,["tkhd"])[0];if(a){let o=a[0];const l=xe(a,o===0?12:20),c=Ie(s,["mdia","mdhd"])[0];if(c){o=c[0];const u=xe(c,o===0?12:20),d=Ie(s,["mdia","hdlr"])[0];if(d){const f=Kt(d.subarray(8,12)),h={soun:nt.AUDIO,vide:nt.VIDEO}[f],p=Ie(s,["mdia","minf","stbl","stsd"])[0],g=jY(p);h?(e[l]={timescale:u,type:h,stsd:g},e[h]=Ve({timescale:u,id:l},g)):e[l]={timescale:u,type:f,stsd:g}}}}}return Ie(t,["moov","mvex","trex"]).forEach(i=>{const s=xe(i,4),a=e[s];a&&(a.default={duration:xe(i,12),flags:xe(i,20)})}),e}function jY(t){const e=t.subarray(8),r=e.subarray(86),n=Kt(e.subarray(4,8));let i=n,s;const a=n==="enca"||n==="encv";if(a){const c=Ie(e,[n])[0].subarray(n==="enca"?28:78);Ie(c,["sinf"]).forEach(d=>{const f=Ie(d,["schm"])[0];if(f){const h=Kt(f.subarray(4,8));if(h==="cbcs"||h==="cenc"){const p=Ie(d,["frma"])[0];p&&(i=Kt(p))}}})}const o=i;switch(i){case"avc1":case"avc2":case"avc3":case"avc4":{const l=Ie(r,["avcC"])[0];l&&l.length>3&&(i+="."+qh(l[1])+qh(l[2])+qh(l[3]),s=zh(o==="avc1"?"dva1":"dvav",r));break}case"mp4a":{const l=Ie(e,[n])[0],c=Ie(l.subarray(28),["esds"])[0];if(c&&c.length>7){let u=4;if(c[u++]!==3)break;u=E0(c,u),u+=2;const d=c[u++];if(d&128&&(u+=2),d&64&&(u+=c[u++]),c[u++]!==4)break;u=E0(c,u);const f=c[u++];if(f===64)i+="."+qh(f);else break;if(u+=12,c[u++]!==5)break;u=E0(c,u);const h=c[u++];let p=(h&248)>>3;p===31&&(p+=1+((h&7)<<3)+((c[u]&224)>>5)),i+="."+p}break}case"hvc1":case"hev1":{const l=Ie(r,["hvcC"])[0];if(l&&l.length>12){const c=l[1],u=["","A","B","C"][c>>6],d=c&31,f=xe(l,2),h=(c&32)>>5?"H":"L",p=l[12],g=l.subarray(6,12);i+="."+u+d,i+="."+FY(f).toString(16).toUpperCase(),i+="."+h+p;let m="";for(let v=g.length;v--;){const y=g[v];(y||m)&&(m="."+y.toString(16).toUpperCase()+m)}i+=m}s=zh(o=="hev1"?"dvhe":"dvh1",r);break}case"dvh1":case"dvhe":case"dvav":case"dva1":case"dav1":{i=zh(i,r)||i;break}case"vp09":{const l=Ie(r,["vpcC"])[0];if(l&&l.length>6){const c=l[4],u=l[5],d=l[6]>>4&15;i+="."+bi(c)+"."+bi(u)+"."+bi(d)}break}case"av01":{const l=Ie(r,["av1C"])[0];if(l&&l.length>2){const c=l[1]>>>5,u=l[1]&31,d=l[2]>>>7?"H":"M",f=(l[2]&64)>>6,h=(l[2]&32)>>5,p=c===2&&f?h?12:10:f?10:8,g=(l[2]&16)>>4,m=(l[2]&8)>>3,v=(l[2]&4)>>2,y=l[2]&3;i+="."+c+"."+bi(u)+d+"."+bi(p)+"."+g+"."+m+v+y+"."+bi(1)+"."+bi(1)+"."+bi(1)+"."+0,s=zh("dav1",r)}break}}return{codec:i,encrypted:a,supplemental:s}}function zh(t,e){const r=Ie(e,["dvvC"]),n=r.length?r[0]:Ie(e,["dvcC"])[0];if(n){const i=n[2]>>1&127,s=n[2]<<5&32|n[3]>>3&31;return t+"."+bi(i)+"."+bi(s)}}function FY(t){let e=0;for(let r=0;r<32;r++)e|=(t>>r&1)<<31-r;return e>>>0}function E0(t,e){const r=e+5;for(;t[e++]&128&&e<r;);return e}function qh(t){return("0"+t.toString(16).toUpperCase()).slice(-2)}function bi(t){return(t<10?"0":"")+t}function BY(t,e){if(!t||!e)return;const r=e.keyId;r&&e.isCommonEncryption&&pj(t,(n,i)=>{const s=n.subarray(8,24);s.some(a=>a!==0)||(qe.log(`[eme] Patching keyId in 'enc${i?"a":"v"}>sinf>>tenc' box: ${pr(s)} -> ${pr(r)}`),n.set(r,8))})}function UY(t){const e=[];return pj(t,r=>e.push(r.subarray(8,24))),e}function pj(t,e){Ie(t,["moov","trak"]).forEach(n=>{const i=Ie(n,["mdia","minf","stbl","stsd"])[0];if(!i)return;const s=i.subarray(8);let a=Ie(s,["enca"]);const o=a.length>0;o||(a=Ie(s,["encv"])),a.forEach(l=>{const c=o?l.subarray(28):l.subarray(78);Ie(c,["sinf"]).forEach(d=>{const f=mj(d);f&&e(f,o)})})})}function mj(t){const e=Ie(t,["schm"])[0];if(e){const r=Kt(e.subarray(4,8));if(r==="cbcs"||r==="cenc"){const n=Ie(t,["schi","tenc"])[0];if(n)return n}}}function GY(t,e,r){const n={},i=Ie(t,["moof","traf"]);for(let s=0;s<i.length;s++){const a=i[s],o=Ie(a,["tfhd"])[0],l=xe(o,4),c=e[l];if(!c)continue;n[l]||(n[l]={start:NaN,duration:0,sampleCount:0,timescale:c.timescale,type:c.type});const u=n[l],d=Ie(a,["tfdt"])[0];if(d){const b=d[0];let w=xe(d,4);b===1&&(w===KP?r.warn("[mp4-demuxer]: Ignoring assumed invalid signed 64-bit track fragment decode time"):(w*=KP+1,w+=xe(d,8))),se(w)&&(!se(u.start)||w<u.start)&&(u.start=w)}const f=c.default,h=xe(o,0)|(f==null?void 0:f.flags);let p=(f==null?void 0:f.duration)||0;h&8&&(h&2?p=xe(o,12):p=xe(o,8));const g=Ie(a,["trun"]);let m=u.start||0,v=0,y=p;for(let b=0;b<g.length;b++){const w=g[b],S=xe(w,4),T=u.sampleCount;u.sampleCount+=S;const _=w[3]&1,A=w[3]&4,P=w[2]&1,C=w[2]&2,O=w[2]&4,R=w[2]&8;let D=8,L=S;for(_&&(D+=4),A&&S&&(!(w[D+1]&1)&&u.keyFrameIndex===void 0&&(u.keyFrameIndex=T),D+=4,P?(y=xe(w,D),D+=4):y=p,C&&(D+=4),R&&(D+=4),m+=y,v+=y,L--);L--;)P?(y=xe(w,D),D+=4):y=p,C&&(D+=4),O&&(w[D+1]&1||u.keyFrameIndex===void 0&&(u.keyFrameIndex=u.sampleCount-(L+1),u.keyFrameStart=m),D+=4),R&&(D+=4),m+=y,v+=y;!v&&p&&(v+=p*S)}u.duration+=v}if(!Object.keys(n).some(s=>n[s].duration)){let s=1/0,a=0;const o=Ie(t,["sidx"]);for(let l=0;l<o.length;l++){const c=$Y(o[l]);if(c!=null&&c.references){s=Math.min(s,c.earliestPresentationTime/c.timescale);const u=c.references.reduce((d,f)=>d+f.info.duration||0,0);a=Math.max(a,u+c.earliestPresentationTime/c.timescale)}}a&&se(a)&&Object.keys(n).forEach(l=>{n[l].duration||(n[l].duration=a*n[l].timescale-n[l].start)})}return n}function WY(t){const e={valid:null,remainder:null},r=Ie(t,["moof"]);if(r.length<2)return e.remainder=t,e;const n=r[r.length-1];return e.valid=t.slice(0,n.byteOffset-8),e.remainder=t.slice(n.byteOffset-8),e}function kn(t,e){const r=new Uint8Array(t.length+e.length);return r.set(t),r.set(e,t.length),r}function qP(t,e){const r=[],n=e.samples,i=e.timescale,s=e.id;let a=!1;return Ie(n,["moof"]).map(l=>{const c=l.byteOffset-8;Ie(l,["traf"]).map(d=>{const f=Ie(d,["tfdt"]).map(h=>{const p=h[0];let g=xe(h,4);return p===1&&(g*=Math.pow(2,32),g+=xe(h,8)),g/i})[0];return f!==void 0&&(t=f),Ie(d,["tfhd"]).map(h=>{const p=xe(h,4),g=xe(h,0)&16777215,m=(g&1)!==0,v=(g&2)!==0,y=(g&8)!==0;let b=0;const w=(g&16)!==0;let S=0;const T=(g&32)!==0;let _=8;p===s&&(m&&(_+=8),v&&(_+=4),y&&(b=xe(h,_),_+=4),w&&(S=xe(h,_),_+=4),T&&(_+=4),e.type==="video"&&(a=Rv(e.codec)),Ie(d,["trun"]).map(A=>{const P=A[0],C=xe(A,0)&16777215,O=(C&1)!==0;let R=0;const D=(C&4)!==0,L=(C&256)!==0;let j=0;const M=(C&512)!==0;let N=0;const k=(C&1024)!==0,$=(C&2048)!==0;let U=0;const G=xe(A,4);let B=8;O&&(R=xe(A,B),B+=4),D&&(B+=4);let K=R+c;for(let ee=0;ee<G;ee++){if(L?(j=xe(A,B),B+=4):j=b,M?(N=xe(A,B),B+=4):N=S,k&&(B+=4),$&&(P===0?U=xe(A,B):U=fj(A,B),B+=4),e.type===nt.VIDEO){let H=0;for(;H<N;){const J=xe(n,K);if(K+=4,VY(a,n[K])){const q=n.subarray(K,K+J);PT(q,a?2:1,t+U/i,r)}K+=J,H+=J+4}}t+=j/i}}))})})}),r}function Rv(t){if(!t)return!1;const e=t.substring(0,4);return e==="hvc1"||e==="hev1"||e==="dvh1"||e==="dvhe"}function VY(t,e){if(t){const r=e>>1&63;return r===39||r===40}else return(e&31)===6}function PT(t,e,r,n){const i=gj(t);let s=0;s+=e;let a=0,o=0,l=0;for(;s<i.length;){a=0;do{if(s>=i.length)break;l=i[s++],a+=l}while(l===255);o=0;do{if(s>=i.length)break;l=i[s++],o+=l}while(l===255);const c=i.length-s;let u=s;if(o<c)s+=o;else if(o>c){qe.error(`Malformed SEI payload. ${o} is too small, only ${c} bytes left to parse.`);break}if(a===4){if(i[u++]===181){const f=dj(i,u);if(u+=2,f===49){const h=xe(i,u);if(u+=4,h===1195456820){const p=i[u++];if(p===3){const g=i[u++],m=31&g,v=64&g,y=v?2+m*3:0,b=new Uint8Array(y);if(v){b[0]=g;for(let w=1;w<y;w++)b[w]=i[u++]}n.push({type:p,payloadType:a,pts:r,bytes:b})}}}}}else if(a===5&&o>16){const d=[];for(let p=0;p<16;p++){const g=i[u++].toString(16);d.push(g.length==1?"0"+g:g),(p===3||p===5||p===7||p===9)&&d.push("-")}const f=o-16,h=new Uint8Array(f);for(let p=0;p<f;p++)h[p]=i[u++];n.push({payloadType:a,pts:r,uuid:d.join(""),userData:hn(h),userDataBytes:h})}}}function gj(t){const e=t.byteLength,r=[];let n=1;for(;n<e-2;)t[n]===0&&t[n+1]===0&&t[n+2]===3?(r.push(n+2),n+=2):n++;if(r.length===0)return t;const i=e-r.length,s=new Uint8Array(i);let a=0;for(n=0;n<i;a++,n++)a===r[0]&&(a++,r.shift()),s[n]=t[a];return s}function HY(t){const e=t[0];let r="",n="",i=0,s=0,a=0,o=0,l=0,c=0;if(e===0){for(;Kt(t.subarray(c,c+1))!=="\0";)r+=Kt(t.subarray(c,c+1)),c+=1;for(r+=Kt(t.subarray(c,c+1)),c+=1;Kt(t.subarray(c,c+1))!=="\0";)n+=Kt(t.subarray(c,c+1)),c+=1;n+=Kt(t.subarray(c,c+1)),c+=1,i=xe(t,12),s=xe(t,16),o=xe(t,20),l=xe(t,24),c=28}else if(e===1){c+=4,i=xe(t,c),c+=4;const d=xe(t,c);c+=4;const f=xe(t,c);for(c+=4,a=2**32*d+f,wY(a)||(a=Number.MAX_SAFE_INTEGER,qe.warn("Presentation time exceeds safe integer limit and wrapped to max safe integer in parsing emsg box")),o=xe(t,c),c+=4,l=xe(t,c),c+=4;Kt(t.subarray(c,c+1))!=="\0";)r+=Kt(t.subarray(c,c+1)),c+=1;for(r+=Kt(t.subarray(c,c+1)),c+=1;Kt(t.subarray(c,c+1))!=="\0";)n+=Kt(t.subarray(c,c+1)),c+=1;n+=Kt(t.subarray(c,c+1)),c+=1}const u=t.subarray(c,t.byteLength);return{schemeIdUri:r,value:n,timeScale:i,presentationTime:a,presentationTimeDelta:s,eventDuration:o,id:l,payload:u}}function KY(t,...e){const r=e.length;let n=8,i=r;for(;i--;)n+=e[i].byteLength;const s=new Uint8Array(n);for(s[0]=n>>24&255,s[1]=n>>16&255,s[2]=n>>8&255,s[3]=n&255,s.set(t,4),i=0,n=8;i<r;i++)s.set(e[i],n),n+=e[i].byteLength;return s}function zY(t,e,r){if(t.byteLength!==16)throw new RangeError("Invalid system id");let n,i;n=0,i=new Uint8Array;let s;n>0?(s=new Uint8Array(4),e.length>0&&new DataView(s.buffer).setUint32(0,e.length,!1)):s=new Uint8Array;const a=new Uint8Array(4);return r.byteLength>0&&new DataView(a.buffer).setUint32(0,r.byteLength,!1),KY([112,115,115,104],new Uint8Array([n,0,0,0]),t,s,i,a,r)}function qY(t){const e=[];if(t instanceof ArrayBuffer){const r=t.byteLength;let n=0;for(;n+32<r;){const i=new DataView(t,n),s=YY(i);e.push(s),n+=s.size}}return e}function YY(t){const e=t.getUint32(0),r=t.byteOffset,n=t.byteLength;if(n<e)return{offset:r,size:n};if(t.getUint32(4)!==1886614376)return{offset:r,size:e};const s=t.getUint32(8)>>>24;if(s!==0&&s!==1)return{offset:r,size:e};const a=t.buffer,o=pr(new Uint8Array(a,r+12,16));let l=null,c=null,u=0;if(s===0)u=28;else{const f=t.getUint32(28);if(!f||n<32+f*16)return{offset:r,size:e};l=[];for(let h=0;h<f;h++)l.push(new Uint8Array(a,r+32+h*16,16));u=32+f*16}if(!u)return{offset:r,size:e};const d=t.getUint32(u);return e-32<d?{offset:r,size:e}:(c=new Uint8Array(a,r+u+4,d),{version:s,systemId:o,kids:l,data:c,offset:r,size:e})}const vj=()=>/\(Windows.+Firefox\//i.test(navigator.userAgent),Tc={audio:{a3ds:1,"ac-3":.95,"ac-4":1,alac:.9,alaw:1,dra1:1,"dts+":1,"dts-":1,dtsc:1,dtse:1,dtsh:1,"ec-3":.9,enca:1,fLaC:.9,flac:.9,FLAC:.9,g719:1,g726:1,m4ae:1,mha1:1,mha2:1,mhm1:1,mhm2:1,mlpa:1,mp4a:1,"raw ":1,Opus:1,opus:1,samr:1,sawb:1,sawp:1,sevc:1,sqcp:1,ssmv:1,twos:1,ulaw:1},video:{avc1:1,avc2:1,avc3:1,avc4:1,avcp:1,av01:.8,dav1:.8,drac:1,dva1:1,dvav:1,dvh1:.7,dvhe:.7,encv:1,hev1:.75,hvc1:.75,mjp2:1,mp4v:1,mvc1:1,mvc2:1,mvc3:1,mvc4:1,resv:1,rv60:1,s263:1,svc1:1,svc2:1,"vc-1":1,vp08:1,vp09:.9},text:{stpp:1,wvtt:1}};function IT(t,e){const r=Tc[e];return!!r&&!!r[t.slice(0,4)]}function Zd(t,e,r=!0){return!t.split(",").some(n=>!CT(n,e,r))}function CT(t,e,r=!0){var n;const i=Ta(r);return(n=i==null?void 0:i.isTypeSupported(ef(t,e)))!=null?n:!1}function ef(t,e){return`${e}/mp4;codecs=${t}`}function YP(t){if(t){const e=t.substring(0,4);return Tc.video[e]}return 2}function Nm(t){const e=vj();return t.split(",").reduce((r,n)=>{const s=e&&Rv(n)?9:Tc.video[n];return s?(s*2+r)/(r?3:2):(Tc.audio[n]+r)/(r?2:1)},0)}const T0={};function XY(t,e=!0){if(T0[t])return T0[t];const r={flac:["flac","fLaC","FLAC"],opus:["opus","Opus"],"mp4a.40.34":["mp3"]}[t];for(let i=0;i<r.length;i++){var n;if(CT(r[i],"audio",e))return T0[t]=r[i],r[i];if(r[i]==="mp3"&&(n=Ta(e))!=null&&n.isTypeSupported("audio/mpeg"))return""}return t}const QY=/flac|opus|mp4a\.40\.34/i;function Mm(t,e=!0){return t.replace(QY,r=>XY(r.toLowerCase(),e))}function JY(t,e){const r=[];if(t){const n=t.split(",");for(let i=0;i<n.length;i++)IT(n[i],"video")||r.push(n[i])}return e&&r.push(e),r.join(",")}function Up(t,e){if(t&&(t.length>4||["ac-3","ec-3","alac","fLaC","Opus"].indexOf(t)!==-1)&&(XP(t,"audio")||XP(t,"video")))return t;if(e){const r=e.split(",");if(r.length>1){if(t){for(let n=r.length;n--;)if(r[n].substring(0,4)===t.substring(0,4))return r[n]}return r[0]}}return e||t}function XP(t,e){return IT(t,e)&&CT(t,e)}function ZY(t){const e=t.split(",");for(let r=0;r<e.length;r++){const n=e[r].split(".");n.length>2&&n[0]==="avc1"&&(e[r]=`avc1.${parseInt(n[1]).toString(16)}${("000"+parseInt(n[2]).toString(16)).slice(-4)}`)}return e.join(",")}function e7(t){if(t.startsWith("av01.")){const e=t.split("."),r=["0","111","01","01","01","0"];for(let n=e.length;n>4&&n<10;n++)e[n]=r[n-4];return e.join(".")}return t}function QP(t){const e=Ta(t)||{isTypeSupported:()=>!1};return{mpeg:e.isTypeSupported("audio/mpeg"),mp3:e.isTypeSupported('audio/mp4; codecs="mp3"'),ac3:e.isTypeSupported('audio/mp4; codecs="ac-3"')}}function lw(t){return t.replace(/^.+codecs=["']?([^"']+).*$/,"$1")}const t7={supported:!0,powerEfficient:!0,smooth:!0},r7={supported:!1,smooth:!1,powerEfficient:!1},yj={supported:!0,configurations:[],decodingInfoResults:[t7]};function bj(t,e){return{supported:!1,configurations:e,decodingInfoResults:[r7],error:t}}function n7(t,e,r,n,i,s){const a=t.videoCodec,o=t.audioCodec?t.audioGroups:null,l=s==null?void 0:s.audioCodec,c=s==null?void 0:s.channels,u=c?parseInt(c):l?1/0:2;let d=null;if(o!=null&&o.length)try{o.length===1&&o[0]?d=e.groups[o[0]].channels:d=o.reduce((f,h)=>{if(h){const p=e.groups[h];if(!p)throw new Error(`Audio track group ${h} not found`);Object.keys(p.channels).forEach(g=>{f[g]=(f[g]||0)+p.channels[g]})}return f},{2:0})}catch{return!0}return a!==void 0&&(a.split(",").some(f=>Rv(f))||t.width>1920&&t.height>1088||t.height>1920&&t.width>1088||t.frameRate>Math.max(n,30)||t.videoRange!=="SDR"&&t.videoRange!==r||t.bitrate>Math.max(i,8e6))||!!d&&se(u)&&Object.keys(d).some(f=>parseInt(f)>u)}function xj(t,e,r,n={}){const i=t.videoCodec;if(!i&&!t.audioCodec||!r)return Promise.resolve(yj);const s=[],a=i7(t),o=a.length,l=s7(t,e,o>0),c=l.length;for(let u=o||1*c||1;u--;){const d={type:"media-source"};if(o&&(d.video=a[u%o]),c){d.audio=l[u%c];const f=d.audio.bitrate;d.video&&f&&(d.video.bitrate-=f)}s.push(d)}if(i){const u=navigator.userAgent;if(i.split(",").some(d=>Rv(d))&&vj())return Promise.resolve(bj(new Error(`Overriding Windows Firefox HEVC MediaCapabilities result based on user-agent string: (${u})`),s))}return Promise.all(s.map(u=>{const d=o7(u);return n[d]||(n[d]=r.decodingInfo(u))})).then(u=>({supported:!u.some(d=>!d.supported),configurations:s,decodingInfoResults:u})).catch(u=>({supported:!1,configurations:s,decodingInfoResults:[],error:u}))}function i7(t){var e;const r=(e=t.videoCodec)==null?void 0:e.split(","),n=wj(t),i=t.width||640,s=t.height||480,a=t.frameRate||30,o=t.videoRange.toLowerCase();return r?r.map(l=>{const c={contentType:ef(e7(l),"video"),width:i,height:s,bitrate:n,framerate:a};return o!=="sdr"&&(c.transferFunction=o),c}):[]}function s7(t,e,r){var n;const i=(n=t.audioCodec)==null?void 0:n.split(","),s=wj(t);return i&&t.audioGroups?t.audioGroups.reduce((a,o)=>{var l;const c=o?(l=e.groups[o])==null?void 0:l.tracks:null;return c?c.reduce((u,d)=>{if(d.groupId===o){const f=parseFloat(d.channels||"");i.forEach(h=>{const p={contentType:ef(h,"audio"),bitrate:r?a7(h,s):s};f&&(p.channels=""+f),u.push(p)})}return u},a):a},[]):[]}function a7(t,e){if(e<=1)return 1;let r=128e3;return t==="ec-3"?r=768e3:t==="ac-3"&&(r=64e4),Math.min(e/2,r)}function wj(t){return Math.ceil(Math.max(t.bitrate*.9,t.averageBitrate)/1e3)*1e3||1}function o7(t){let e="";const{audio:r,video:n}=t;if(n){const i=lw(n.contentType);e+=`${i}_r${n.height}x${n.width}f${Math.ceil(n.framerate)}${n.transferFunction||"sd"}_${Math.ceil(n.bitrate/1e5)}`}if(r){const i=lw(r.contentType);e+=`${n?"_":""}${i}_c${r.channels}`}return e}const cw=["NONE","TYPE-0","TYPE-1",null];function l7(t){return cw.indexOf(t)>-1}const $m=["SDR","PQ","HLG"];function c7(t){return!!t&&$m.indexOf(t)>-1}var Gp={No:"",Yes:"YES",v2:"v2"};function JP(t){const{canSkipUntil:e,canSkipDateRanges:r,age:n}=t,i=n<e/2;return e&&i?r?Gp.v2:Gp.Yes:Gp.No}class ZP{constructor(e,r,n){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=e,this.part=r,this.skip=n}addDirectives(e){const r=new self.URL(e);return this.msn!==void 0&&r.searchParams.set("_HLS_msn",this.msn.toString()),this.part!==void 0&&r.searchParams.set("_HLS_part",this.part.toString()),this.skip&&r.searchParams.set("_HLS_skip",this.skip),r.href}}class tf{constructor(e){if(this._attrs=void 0,this.audioCodec=void 0,this.bitrate=void 0,this.codecSet=void 0,this.url=void 0,this.frameRate=void 0,this.height=void 0,this.id=void 0,this.name=void 0,this.supplemental=void 0,this.videoCodec=void 0,this.width=void 0,this.details=void 0,this.fragmentError=0,this.loadError=0,this.loaded=void 0,this.realBitrate=0,this.supportedPromise=void 0,this.supportedResult=void 0,this._avgBitrate=0,this._audioGroups=void 0,this._subtitleGroups=void 0,this._urlId=0,this.url=[e.url],this._attrs=[e.attrs],this.bitrate=e.bitrate,e.details&&(this.details=e.details),this.id=e.id||0,this.name=e.name,this.width=e.width||0,this.height=e.height||0,this.frameRate=e.attrs.optionalFloat("FRAME-RATE",0),this._avgBitrate=e.attrs.decimalInteger("AVERAGE-BANDWIDTH"),this.audioCodec=e.audioCodec,this.videoCodec=e.videoCodec,this.codecSet=[e.videoCodec,e.audioCodec].filter(n=>!!n).map(n=>n.substring(0,4)).join(","),"supplemental"in e){var r;this.supplemental=e.supplemental;const n=(r=e.supplemental)==null?void 0:r.videoCodec;n&&n!==e.videoCodec&&(this.codecSet+=`,${n.substring(0,4)}`)}this.addGroupId("audio",e.attrs.AUDIO),this.addGroupId("text",e.attrs.SUBTITLES)}get maxBitrate(){return Math.max(this.realBitrate,this.bitrate)}get averageBitrate(){return this._avgBitrate||this.realBitrate||this.bitrate}get attrs(){return this._attrs[0]}get codecs(){return this.attrs.CODECS||""}get pathwayId(){return this.attrs["PATHWAY-ID"]||"."}get videoRange(){return this.attrs["VIDEO-RANGE"]||"SDR"}get score(){return this.attrs.optionalFloat("SCORE",0)}get uri(){return this.url[0]||""}hasAudioGroup(e){return eI(this._audioGroups,e)}hasSubtitleGroup(e){return eI(this._subtitleGroups,e)}get audioGroups(){return this._audioGroups}get subtitleGroups(){return this._subtitleGroups}addGroupId(e,r){if(r){if(e==="audio"){let n=this._audioGroups;n||(n=this._audioGroups=[]),n.indexOf(r)===-1&&n.push(r)}else if(e==="text"){let n=this._subtitleGroups;n||(n=this._subtitleGroups=[]),n.indexOf(r)===-1&&n.push(r)}}}get urlId(){return 0}set urlId(e){}get audioGroupIds(){return this.audioGroups?[this.audioGroupId]:void 0}get textGroupIds(){return this.subtitleGroups?[this.textGroupId]:void 0}get audioGroupId(){var e;return(e=this.audioGroups)==null?void 0:e[0]}get textGroupId(){var e;return(e=this.subtitleGroups)==null?void 0:e[0]}addFallback(){}}function eI(t,e){return!e||!t?!1:t.indexOf(e)!==-1}function u7(){if(typeof matchMedia=="function"){const t=matchMedia("(dynamic-range: high)"),e=matchMedia("bad query");if(t.media!==e.media)return t.matches===!0}return!1}function d7(t,e){let r=!1,n=[];if(t&&(r=t!=="SDR",n=[t]),e){n=e.allowedVideoRanges||$m.slice(0);const i=n.join("")!=="SDR"&&!e.videoCodec;r=e.preferHDR!==void 0?e.preferHDR:i&&u7(),r||(n=["SDR"])}return{preferHDR:r,allowedVideoRanges:n}}const f7=t=>{const e=new WeakSet;return(r,n)=>{if(t&&(n=t(r,n)),typeof n=="object"&&n!==null){if(e.has(n))return;e.add(n)}return n}},it=(t,e)=>JSON.stringify(t,f7(e));function h7(t,e,r,n,i){const s=Object.keys(t),a=n==null?void 0:n.channels,o=n==null?void 0:n.audioCodec,l=i==null?void 0:i.videoCodec,c=a&&parseInt(a)===2;let u=!1,d=!1,f=1/0,h=1/0,p=1/0,g=1/0,m=0,v=[];const{preferHDR:y,allowedVideoRanges:b}=d7(e,i);for(let A=s.length;A--;){const P=t[s[A]];u||(u=P.channels[2]>0),f=Math.min(f,P.minHeight),h=Math.min(h,P.minFramerate),p=Math.min(p,P.minBitrate),b.filter(O=>P.videoRanges[O]>0).length>0&&(d=!0)}f=se(f)?f:0,h=se(h)?h:0;const w=Math.max(1080,f),S=Math.max(30,h);p=se(p)?p:r,r=Math.max(p,r),d||(e=void 0);const T=s.length>1;return{codecSet:s.reduce((A,P)=>{const C=t[P];if(P===A)return A;if(v=d?b.filter(O=>C.videoRanges[O]>0):[],T){if(C.minBitrate>r)return gi(P,`min bitrate of ${C.minBitrate} > current estimate of ${r}`),A;if(!C.hasDefaultAudio)return gi(P,"no renditions with default or auto-select sound found"),A;if(o&&P.indexOf(o.substring(0,4))%5!==0)return gi(P,`audio codec preference "${o}" not found`),A;if(a&&!c){if(!C.channels[a])return gi(P,`no renditions with ${a} channel sound found (channels options: ${Object.keys(C.channels)})`),A}else if((!o||c)&&u&&C.channels[2]===0)return gi(P,"no renditions with stereo sound found"),A;if(C.minHeight>w)return gi(P,`min resolution of ${C.minHeight} > maximum of ${w}`),A;if(C.minFramerate>S)return gi(P,`min framerate of ${C.minFramerate} > maximum of ${S}`),A;if(!v.some(O=>C.videoRanges[O]>0))return gi(P,`no variants with VIDEO-RANGE of ${it(v)} found`),A;if(l&&P.indexOf(l.substring(0,4))%5!==0)return gi(P,`video codec preference "${l}" not found`),A;if(C.maxScore<m)return gi(P,`max score of ${C.maxScore} < selected max of ${m}`),A}return A&&(Nm(P)>=Nm(A)||C.fragmentError>t[A].fragmentError)?A:(g=C.minIndex,m=C.maxScore,P)},void 0),videoRanges:v,preferHDR:y,minFramerate:h,minBitrate:p,minIndex:g}}function gi(t,e){qe.log(`[abr] start candidates with "${t}" ignored because ${e}`)}function Sj(t){return t.reduce((e,r)=>{let n=e.groups[r.groupId];
vendor: 3,271 bytes, line 250
250n||(n=e.groups[r.groupId]={tracks:[],channels:{2:0},hasDefault:!1,hasAutoSelect:!1}),n.tracks.push(r);const i=r.channels||"2";return n.channels[i]=(n.channels[i]||0)+1,n.hasDefault=n.hasDefault||r.default,n.hasAutoSelect=n.hasAutoSelect||r.autoselect,n.hasDefault&&(e.hasDefaultAudio=!0),n.hasAutoSelect&&(e.hasAutoSelectAudio=!0),e},{hasDefaultAudio:!1,hasAutoSelectAudio:!1,groups:{}})}function p7(t,e,r,n){return t.slice(r,n+1).reduce((i,s,a)=>{if(!s.codecSet)return i;const o=s.audioGroups;let l=i[s.codecSet];l||(i[s.codecSet]=l={minBitrate:1/0,minHeight:1/0,minFramerate:1/0,minIndex:a,maxScore:0,videoRanges:{SDR:0},channels:{2:0},hasDefaultAudio:!o,fragmentError:0}),l.minBitrate=Math.min(l.minBitrate,s.bitrate);const c=Math.min(s.height,s.width);return l.minHeight=Math.min(l.minHeight,c),l.minFramerate=Math.min(l.minFramerate,s.frameRate),l.minIndex=Math.min(l.minIndex,a),l.maxScore=Math.max(l.maxScore,s.score),l.fragmentError+=s.fragmentError,l.videoRanges[s.videoRange]=(l.videoRanges[s.videoRange]||0)+1,o&&o.forEach(u=>{if(!u)return;const d=e.groups[u];d&&(l.hasDefaultAudio=l.hasDefaultAudio||e.hasDefaultAudio?d.hasDefault:d.hasAutoSelect||!e.hasDefaultAudio&&!e.hasAutoSelectAudio,Object.keys(d.channels).forEach(f=>{l.channels[f]=(l.channels[f]||0)+d.channels[f]}))}),i},{})}function tI(t){if(!t)return t;const{lang:e,assocLang:r,characteristics:n,channels:i,audioCodec:s}=t;return{lang:e,assocLang:r,characteristics:n,channels:i,audioCodec:s}}function Ii(t,e,r){if("attrs"in t){const n=e.indexOf(t);if(n!==-1)return n}for(let n=0;n<e.length;n++){const i=e[n];if(To(t,i,r))return n}return-1}function To(t,e,r){const{groupId:n,name:i,lang:s,assocLang:a,default:o}=t,l=t.forced;return(n===void 0||e.groupId===n)&&(i===void 0||e.name===i)&&(s===void 0||m7(s,e.lang))&&(s===void 0||e.assocLang===a)&&(o===void 0||e.default===o)&&(l===void 0||e.forced===l)&&(!("characteristics"in t)||g7(t.characteristics||"",e.characteristics))&&(r===void 0||r(t,e))}function m7(t,e="--"){return t.length===e.length?t===e:t.startsWith(e)||e.startsWith(t)}function g7(t,e=""){const r=t.split(","),n=e.split(",");return r.length===n.length&&!r.some(i=>n.indexOf(i)===-1)}function Ja(t,e){const{audioCodec:r,channels:n}=t;return(r===void 0||(e.audioCodec||"").substring(0,4)===r.substring(0,4))&&(n===void 0||n===(e.channels||"2"))}function v7(t,e,r,n,i){const s=e[n],o=e.reduce((f,h,p)=>{const g=h.uri;return(f[g]||(f[g]=[])).push(p),f},{})[s.uri];o.length>1&&(n=Math.max.apply(Math,o));const l=s.videoRange,c=s.frameRate,u=s.codecSet.substring(0,4),d=rI(e,n,f=>{if(f.videoRange!==l||f.frameRate!==c||f.codecSet.substring(0,4)!==u)return!1;const h=f.audioGroups,p=r.filter(g=>!h||h.indexOf(g.groupId)!==-1);return Ii(t,p,i)>-1});return d>-1?d:rI(e,n,f=>{const h=f.audioGroups,p=r.filter(g=>!h||h.indexOf(g.groupId)!==-1);return Ii(t,p,i)>-1})}function rI(t,e,r){for(let n=e;n>-1;n--)if(r(t[n]))return n;for(let n=e+1;n<t.length;n++)if(r(t[n]))return n;return-1}function jm(t,e){var r;return!!t&&t!==((r=e.loadLevelObj)==null?void 0:r.uri)}class y7 extends Dn{constructor(e){super("abr",e.logger),this.hls=void 0,this.lastLevelLoadSec=0,this.lastLoadedFragLevel=-1,this.firstSelection=-1,this._nextAutoLevel=-1,this.nextAutoLevelKey="",this.audioTracksByGroup=null,this.co
vendor: 4,839 bytes, lines 250-260
250decTiers=null,this.timer=-1,this.fragCurrent=null,this.partCurrent=null,this.bitrateTestDelay=0,this.rebufferNotice=-1,this.supportedCache={},this.bwEstimator=void 0,this._abandonRulesCheck=r=>{var n;const{fragCurrent:i,partCurrent:s,hls:a}=this,{autoLevelEnabled:o,media:l}=a;if(!i||!l)return;const c=performance.now(),u=s?s.stats:i.stats,d=s?s.duration:i.duration,f=c-u.loading.start,h=a.minAutoLevel,p=i.level,g=this._nextAutoLevel;if(u.aborted||u.loaded&&u.loaded===u.total||p<=h){this.clearTimer(),this._nextAutoLevel=-1;return}if(!o)return;const m=g>-1&&g!==p,v=!!r||m;if(!v&&(l.paused||!l.playbackRate||!l.readyState))return;const y=a.mainForwardBufferInfo;if(!v&&y===null)return;const b=this.bwEstimator.getEstimateTTFB(),w=Math.abs(l.playbackRate);if(f<=Math.max(b,1e3*(d/(w*2))))return;const S=y?y.len/w:0,T=u.loading.first?u.loading.first-u.loading.start:-1,_=u.loaded&&T>-1,A=this.getBwEstimate(),P=a.levels,C=P[p],O=Math.max(u.loaded,Math.round(d*(i.bitrate||C.averageBitrate)/8));let R=_?f-T:f;R<1&&_&&(R=Math.min(f,u.loaded*8/A));const D=_?u.loaded*1e3/R:0,L=b/1e3,j=D?(O-u.loaded)/D:O*8/A+L;if(j<=S)return;const M=D?D*8:A,N=((n=(r==null?void 0:r.details)||this.hls.latestLevelDetails)==null?void 0:n.live)===!0,k=this.hls.config.abrBandWidthUpFactor;let $=Number.POSITIVE_INFINITY,U;for(U=p-1;U>h;U--){const ee=P[U].maxBitrate,H=!P[U].details||N;if($=this.getTimeToLoadFrag(L,M,d*ee,H),$<Math.min(S,d+L))break}if($>=j||$>d*10)return;_?this.bwEstimator.sample(f-Math.min(b,T),u.loaded):this.bwEstimator.sampleTTFB(f);const G=P[U].maxBitrate;this.getBwEstimate()*k>G&&this.resetEstimator(G);const B=this.findBestLevel(G,h,U,0,S,1,1);B>-1&&(U=B),this.warn(`Fragment ${i.sn}${s?" part "+s.index:""} of level ${p} is loading too slowly;
251      Fragment duration: ${i.duration.toFixed(3)}
252      Time to underbuffer: ${S.toFixed(3)} s
253      Estimated load time for current fragment: ${j.toFixed(3)} s
254      Estimated load time for down switch fragment: ${$.toFixed(3)} s
255      TTFB estimate: ${T|0} ms
256      Current BW estimate: ${se(A)?A|0:"Unknown"} bps
257      New BW estimate: ${this.getBwEstimate()|0} bps
258      Switching to level ${U} @ ${G|0} bps`),a.nextLoadLevel=a.nextAutoLevel=U,this.clearTimer();const K=()=>{if(this.clearTimer(),this.fragCurrent===i&&this.hls.loadLevel===U&&U>0){const ee=this.getStarvationDelay();if(this.warn(`Aborting inflight request ${U>0?"and switching down":""}
259      Fragment duration: ${i.duration.toFixed(3)} s
260      Time to underbuffer: ${ee.toFixed(3)} s`),i.abortRequests(),this.fragCurrent=this.partCurrent=null,U>h){let H=this.findBestLevel(this.hls.levels[h].bitrate,h,U,0,ee,1,1);H===-1&&(H=h),this.hls.nextLoadLevel=this.hls.nextAutoLevel=H,this.resetEstimator(this.hls.levels[H].bitrate)}}};m||j>$*2?K():this.timer=self.setInterval(K,$*1e3),a.trigger(I.FRAG_LOAD_EMERGENCY_ABORTED,{frag:i,part:s,stats:u})},this.hls=e,this.bwEstimator=this.initEstimator(),this.registerListeners()}resetEstimator(e){e&&(this.log(`setting initial bwe to ${e}`),this.hls.config.abrEwmaDefaultEstimate=e),this.firstSelection=-1,this.bwEstimator=this.initEstimator()}initEstimator(){const e=this.hls.config;return new EY(e.abrEwmaSlowVoD,e.abrEwmaFastVoD,e.abrEwmaDefaultEstimate)}registerListeners(){const{hls:e}=this;e.on(I.MANIFEST_LOADING,this.onManifestLoading,this),e.on(I.FRAG_LOADING,this.onFragLoading,this),e.on(I.FRAG_LOADED,this.onFragLoaded,this),e.on(I.FRAG_BUFFERED,this.onFragBuffered,this),e.on(I.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(I.LEVEL_LOADED,this.onLevelLoaded,this),e.on(I.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(I.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),e.on(I.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e&&(e.off(I.MANIFEST_LOADING,this.onManifestLoading,this),e.off(I.FRAG_LOADING,this.onFragLoading,this),e.off(I.FRAG_LOADED,this.onFragLoaded,this),e.off(I.FRAG_BUFFERED,this.onFragBuffered,this),e.off(I.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(I.LEVEL_LOADED,this.onLevelLoaded,this),e.off(I.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(I.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),e.off(I.ERROR,this.onError,this))}destroy(){this.unregisterListeners(),this.clearTimer(),this.hls=this._abandonRulesCheck=this.supportedCache=null,this.fragCurrent=this.partCurrent=null}onManifestLoading(e,r){this.lastLoadedFragLevel=-1,this.firstSelection=-1,this.lastLevelLoadSec=0,this.supportedCache={},this.fragCurrent=this.partCurrent=null,this.onLevelsUpdated(),this.clearTimer()}onLevelsUpdated(){this.lastLoadedFragLevel>-1&&this.fragCurrent&&(this.lastLoadedFragLevel=this.fragCurrent.level),this._nextAutoLevel=-1,this.onMaxAutoLevelUpdated(),this.codecTiers=null,this.audioTracksByGroup=null}onMaxAutoLevelUpdated(){this.firstSelection=-1,this.nextAutoLevelKey=""}onFragLoading(e,r){const n=r.frag;
vendor: 3,237 bytes, line 260
260if(!this.ignoreFragment(n)){if(!n.bitrateTest){var i;this.fragCurrent=n,this.partCurrent=(i=r.part)!=null?i:null}this.clearTimer(),this.timer=self.setInterval(this._abandonRulesCheck,100)}}onLevelSwitching(e,r){this.clearTimer()}onError(e,r){if(!r.fatal)switch(r.details){case V.BUFFER_ADD_CODEC_ERROR:case V.BUFFER_APPEND_ERROR:this.lastLoadedFragLevel=-1,this.firstSelection=-1;break;case V.FRAG_LOAD_TIMEOUT:{const n=r.frag,{fragCurrent:i,partCurrent:s}=this;if(n&&i&&n.sn===i.sn&&n.level===i.level){const a=performance.now(),o=s?s.stats:n.stats,l=a-o.loading.start,c=o.loading.first?o.loading.first-o.loading.start:-1;if(o.loaded&&c>-1){const d=this.bwEstimator.getEstimateTTFB();this.bwEstimator.sample(l-Math.min(d,c),o.loaded)}else this.bwEstimator.sampleTTFB(l)}break}}}getTimeToLoadFrag(e,r,n,i){const s=e+n/r,a=i?e+this.lastLevelLoadSec:0;return s+a}onLevelLoaded(e,r){const n=this.hls.config,{loading:i}=r.stats,s=i.end-i.first;se(s)&&(this.lastLevelLoadSec=s/1e3),r.details.live?this.bwEstimator.update(n.abrEwmaSlowLive,n.abrEwmaFastLive):this.bwEstimator.update(n.abrEwmaSlowVoD,n.abrEwmaFastVoD),this.timer>-1&&this._abandonRulesCheck(r.levelInfo)}onFragLoaded(e,{frag:r,part:n}){const i=n?n.stats:r.stats;if(r.type===oe.MAIN&&this.bwEstimator.sampleTTFB(i.loading.first-i.loading.start),!this.ignoreFragment(r)){if(this.clearTimer(),r.level===this._nextAutoLevel&&(this._nextAutoLevel=-1),this.firstSelection=-1,this.hls.config.abrMaxWithRealBitrate){const s=n?n.duration:r.duration,a=this.hls.levels[r.level],o=(a.loaded?a.loaded.bytes:0)+i.loaded,l=(a.loaded?a.loaded.duration:0)+s;a.loaded={bytes:o,duration:l},a.realBitrate=Math.round(8*o/l)}if(r.bitrateTest){const s={stats:i,frag:r,part:n,id:r.type};this.onFragBuffered(I.FRAG_BUFFERED,s),r.bitrateTest=!1}else this.lastLoadedFragLevel=r.level}}onFragBuffered(e,r){const{frag:n,part:i}=r,s=i!=null&&i.stats.loaded?i.stats:n.stats;if(s.aborted||this.ignoreFragment(n))return;const a=s.parsing.end-s.loading.start-Math.min(s.loading.first-s.loading.start,this.bwEstimator.getEstimateTTFB());this.bwEstimator.sample(a,s.loaded),s.bwEstimate=this.getBwEstimate(),n.bitrateTest?this.bitrateTestDelay=a/1e3:this.bitrateTestDelay=0}ignoreFragment(e){return e.type!==oe.MAIN||e.sn==="initSegment"}clearTimer(){this.timer>-1&&(self.clearInterval(this.timer),this.timer=-1)}get firstAutoLevel(){const{maxAutoLevel:e,minAutoLevel:r}=this.hls,n=this.getBwEstimate(),i=this.hls.config.maxStarvationDelay,s=this.findBestLevel(n,r,e,0,i,1,1);if(s>-1)return s;const a=this.hls.firstLevel,o=Math.min(Math.max(a,r),e);return this.warn(`Could not find best starting auto level. Defaulting to first in playlist ${a} clamped to ${o}`),o}get forcedAutoLevel(){return this.nextAutoLevelKey?-1:this._nextAutoLevel}get nextAutoLevel(){const e=this.forcedAutoLevel,n=this.bwEstimator.canEstimate(),i=this.lastLoadedFragLevel>-1;if(e!==-1&&(!n||!i||this.nextAutoLevelKey===this.getAutoLevelKey()))return e;const s=n&&i?this.getNextABRAutoLevel():this.firstAutoLevel;if(e!==-1){const a=this.hls.levels;if(a.length>Math.max(e,s)&&a[e].loadError<=a[s].loadError)return e}return this._nextAutoLevel=s,this.nextAutoLevelKey=this.getAutoLevelKey(),s}getAutoLevelKey(){return`${this.getBwEstimate()}
260_${this.getStarvationDelay().toFixed(2)}`}getNextABRAutoLevel(){const{fragCurrent:e,partCurrent:r,hls:n}=this;if(n.levels.length<=1)return n.loadLevel;const{maxAutoLevel:i,config:s,minAutoLevel:a}=n,o=r?r.duration:e?e.duration:0,l=this.getBwEstimate(),c=this.getStarvationDelay();let u=s.abrBandWidthFactor,d=s.abrBandWidthUpFactor;if(c){const m=this.findBestLevel(l,a,i,c,0,u,d);if(m>=0)return this.rebufferNotice=-1,m}let f=o?Math.min(o,s.maxStarvationDelay):s.maxStarvationDelay;if(!c){const m=this.bitrateTestDelay;m&&(f=(o?Math.min(o,s.maxLoadingDelay):s.maxLoadingDelay)-m,this.info(`bitrate test took ${Math.round(1e3*m)}ms, set first fragment max fetchDuration to ${Math.round(1e3*f)} ms`),u=d=1)}const h=this.findBestLevel(l,a,i,c,f,u,d);if(this.rebufferNotice!==h&&(this.rebufferNotice=h,this.info(`${c?"rebuffering expected":"buffer is empty"}, optimal quality level ${h}`)),h>-1)return h;const p=n.levels[a],g=n.loadLevelObj;return g&&(p==null?void 0:p.bitrate)<g.bitrate?a:n.loadLevel}getStarvationDelay(){const e=this.hls,r=e.media;if(!r)return 1/0;const n=r&&r.playbackRate!==0?Math.abs(r.playbackRate):1,i=e.mainForwardBufferInfo;return(i?i.len:0)/n}getBwEstimate(){return this.bwEstimator.canEstimate()?this.bwEstimator.getEstimate():this.hls.config.abrEwmaDefaultEstimate}findBestLevel(e,r,n,i,s,a,o){var l;const c=i+s,u=this.lastLoadedFragLevel,d=u===-1?this.hls.firstLevel:u,{fragCurrent:f,partCurrent:h}=this,{levels:p,allAudioTracks:g,loadLevel:m,config:v}=this.hls;if(p.length===1)return 0;const y=p[d],b=!!((l=this.hls.latestLevelDetails)!=null&&l.live),w=m===-1||u===-1;let S,T="SDR",_=(y==null?void 0:y.frameRate)||0;const{audioPreference:A,videoPreference:P}=v,C=this.audioTracksByGroup||(this.audioTracksByGroup=Sj(g));let O=-1;if(w){if(this.firstSelection!==-1)return this.firstSelection;const M=this.codecTiers||(this.codecTiers=p7(p,C,r,n)),N=h7(M,T,e,A,P),{codecSet:k,videoRanges:$,minFramerate:U,minBitrate:G,minIndex:B,preferHDR:K}=N;O=B,S=k,T=K?$[$.length-1]:$[0],_=U,e=Math.max(e,G),this.log(`picked start tier ${it(N)}`)}else S=y==null?void 0:y.codecSet,T=y==null?void 0:y.videoRange;const R=h?h.duration:f?f.duration:0,D=this.bwEstimator.getEstimateTTFB()/1e3,L=[];for(let M=n;M>=r;M--){var j;const N=p[M],k=M>d;if(!N)continue;if(v.useMediaCapabilities&&!N.supportedResult&&!N.supportedPromise){const H=navigator.mediaCapabilities;typeof(H==null?void 0:H.decodingInfo)=="function"&&n7(N,C,T,_,e,A)?(N.supportedPromise=xj(N,C,H,this.supportedCache),N.supportedPromise.then(J=>{if(!this.hls)return;N.supportedResult=J;const q=this.hls.levels,ie=q.indexOf(N);J.error?this.warn(`MediaCapabilities decodingInfo error: "${J.error}" for level ${ie} ${it(J)}`):J.supported?J.decodingInfoResults.some(Z=>Z.smooth===!1||Z.powerEfficient===!1)&&this.log(`MediaCapabilities decodingInfo for level ${ie} not smooth or powerEfficient: ${it(J)}`):(this.warn(`Unsupported MediaCapabilities decodingInfo result for level ${ie} ${it(J)}`),ie>-1&&q.length>1&&(this.log(`Removing unsupported level ${ie}`),this.hls.removeLevel(ie),this.hls.loadLevel===-1&&(this.hls.nextLoadLevel=0)))}).catch(J=>{this.warn(`Error handling MediaCapabilities decodingInfo: ${J}`)})):N.supportedResult=yj}if((S&&N.codecSet!==S||T&&N.videoRange!==T||k&&_>N.frameRate||!k&&_>0&&_<N.frameRate||(j=N.supportedResult)!=null&&(j=j.decodingInfoResults)!=null&&j.some(H=>H.smooth===!1))&&(!w||M!==O)){L.push(M);continue}const $=N.details,U=(h?$==null?void 0:$.partTarget:$==null?void 0:$.averagetargetduration)||R;let G;k?G=o*e:G=a*e;const B=R&&i>=R*2&&s===0?N.averageBitrate:N.maxBitrate,K=this.getTimeToLoadFrag(D,G,B*U,$===void 0);if(G>=B&&(M===u||N.loadError===0&&N.fragmentError===0)&&(K<=D||!se(K)||b&&!this.bitrateTestDelay||K<c)){const H=this.forcedAutoLevel;return M!==m&&(H===-1||H!==m)&&(L.length&&this.trace(`Skipped level(s) ${L.join(",")} of ${n} max with CODECS and VIDEO-RANGE:"${p[L[0]].codecs}" ${p[L[0]].videoRange}; not compatible with "${S}" ${T}`),this.info(`switch candidate:${d}->${M} adjustedbw(${Math.round(G)})-bitrate=${Math.round(G-B)} ttfb:${D.toFixed(1)} avgDuration:${U.toFixed(1)} maxFetchDuration:${c.toFixed(1)} fetchDuration:${K.toFixed(1)}
260 firstSelection:${w} codecSet:${N.codecSet} videoRange:${N.videoRange} hls.loadLevel:${m}`)),w&&(this.firstSelection=M),M}}return-1}set nextAutoLevel(e){const r=this.deriveNextAutoLevel(e);this._nextAutoLevel!==r&&(this.nextAutoLevelKey="",this._nextAutoLevel=r)}deriveNextAutoLevel(e){const{maxAutoLevel:r,minAutoLevel:n}=this.hls;return Math.min(Math.max(e,n),r)}}const Ej={search:function(t,e){let r=0,n=t.length-1,i=null,s=null;for(;r<=n;){i=(r+n)/2|0,s=t[i];const a=e(s);if(a>0)r=i+1;else if(a<0)n=i-1;else return s}return null}};function b7(t,e,r){if(e===null||!Array.isArray(t)||!t.length||!se(e))return null;const n=t[0].programDateTime;if(e<(n||0))return null;const i=t[t.length-1].endProgramDateTime;if(e>=(i||0))return null;for(let s=0;s<t.length;++s){const a=t[s];if(w7(e,r,a))return a}return null}function jo(t,e,r=0,n=0,i=.005){let s=null;if(t){s=e[1+t.sn-e[0].sn]||null;const o=t.endDTS-r;o>0&&o<15e-7&&(r+=15e-7),s&&t.level!==s.level&&s.end<=t.end&&(s=e[2+t.sn-e[0].sn]||null)}else r===0&&e[0].start===0&&(s=e[0]);if(s&&((!t||t.level===s.level)&&nI(r,n,s)===0||x7(s,t,Math.min(i,n))))return s;const a=Ej.search(e,nI.bind(null,r,n));return a&&(a!==t||!s)?a:s}function x7(t,e,r){if(e&&e.start===0&&e.level<t.level&&(e.endPTS||0)>0){const n=e.tagList.reduce((i,s)=>(s[0]==="INF"&&(i+=parseFloat(s[1])),i),r);return t.start<=n}return!1}function nI(t=0,e=0,r){if(r.start<=t&&r.start+r.duration>t)return 0;const n=Math.min(e,r.duration+(r.deltaPTS?r.deltaPTS:0));return r.start+r.duration-n<=t?1:r.start-n>t&&r.start?-1:0}function w7(t,e,r){const n=Math.min(e,r.duration+(r.deltaPTS?r.deltaPTS:0))*1e3;return(r.endProgramDateTime||0)-n>t}function Tj(t,e,r){if(t&&t.startCC<=e&&t.endCC>=e){let n=t.fragments;const{fragmentHint:i}=t;i&&(n=n.concat(i));let s;return Ej.search(n,a=>a.cc<e?1:a.cc>e?-1:(s=a,a.end<=r?1:a.start>r?-1:0)),s||null}return null}function Fm(t){switch(t.details){case V.FRAG_LOAD_TIMEOUT:case V.KEY_LOAD_TIMEOUT:case V.LEVEL_LOAD_TIMEOUT:case V.MANIFEST_LOAD_TIMEOUT:return!0}return!1}function _j(t){return t.details.startsWith("key")}function Aj(t){return _j(t)&&!!t.frag&&!t.frag.decryptdata}function iI(t,e){const r=Fm(e);return t.default[`${r?"timeout":"error"}Retry`]}function OT(t,e){const r=t.backoff==="linear"?1:Math.pow(2,e);return Math.min(r*t.retryDelayMs,t.maxRetryDelayMs)}function sI(t){return Ve(Ve({},t),{errorRetry:null,timeoutRetry:null})}function Bm(t,e,r,n){if(!t)return!1;const i=n==null?void 0:n.code,s=e<t.maxNumRetry&&(S7(i)||!!r);return t.shouldRetry?t.shouldRetry(t,e,r,n,s):s}function S7(t){return uw(t)||!!t&&(t<400||t>499)}function uw(t){return t===0&&navigator.onLine===!1}var hr={DoNothing:0,SendAlternateToPenaltyBox:2,RemoveAlternatePermanently:3,RetryRequest:5},Jr={None:0,MoveAllAlternatesMatchingHost:1,MoveAllAlternatesMatchingHDCP:2,MoveAllAlternatesMatchingKey:4};class E7 extends Dn{constructor(e){super("error-controller",e.logger),this.hls=void 0,this.playlistError=0,this.hls=e,this.registerListeners()}registerListeners(){const e=this.hls;e.on(I.ERROR,this.onError,this),e.on(I.MANIFEST_LOADING,this.onManifestLoading,this),e.on(I.LEVEL_UPDATED,this.onLevelUpdated,this)}unregisterListeners(){const e=this.hls;e&&(e.off(I.ERROR,this.onError,this),e.off(I.ERROR,this.onErrorOut,this),e.off(I.MANIFEST_LOADING,this.onManifestLoading,this),e.off(I.LEVEL_UPDATED,this.onLevelUpdated,this))}destroy(){this.unregisterListeners(),this.hls=null}startLoad(e){}stopLoad(){this.playlistError=0}getVariantLevelIndex(e){return(e==null?void 0:e.type)===oe.MAIN?e.level:this.getVariantIndex()}getVariantIndex(){var e;const r=this.hls,n=r.currentLevel;return(e=r.loadLevelObj)!=null&&e.details||n===-1?r.loadLevel:n}variantHasKey(e,r){if(e){var n;if((n=e.details)!=null&&n.hasKey(r))return!0;const i=e.audioGroups;if(i)return this.hls.allAudioTracks.filter(a=>i.indexOf(a.groupId)>=0).some(a=>{var o;return(o=a.details)==null?void 0:o.hasKey(r)})}return!1}onManifestLoading(){this.playlistError=0}onLevelUpdated(){this.playlistError=0}onError(e,r){var n;if(r.fatal)return;const i=this.hls,s=r.context;switch(r.details){case V.FRAG_LOAD_ERROR:case V.FRAG_LOAD_TIMEOUT:case V.KEY_LOAD_ERROR:case V.KEY_LOAD_TIMEOUT:r.errorAction=this.getFragRetryOrSwitchAction(r);return;case V.FRAG_PARSING_ERROR:if((n=r.frag)!=null&&n.gap){r.errorAction=Ql();return}case V.FRAG_GAP:case V.FRAG_DECRYPT_ERROR:{r.errorAction=this.getFragRetryOrSwitchAction(r),r.errorAction.action=hr.SendAlternateToPenaltyBox;return}case V.LEVEL_EMPTY_ERROR:case V.LEVEL_PARSING_ERROR:{var a;const l=r.parent===oe.MAIN?r.level:i.loadLevel;r.details===V.LEVEL_EMPTY_ERROR&&((a=r.context)!=null&&(a=a.levelDetails)!=null&&a.live)?r.errorAction=this.getPlaylistRetryOrSwitchAction(r,l):(r.levelRetry=!1,r.errorAction=this.getLevelSwitchAction(r,l))}return;case V.LEVEL_LOAD_ERROR:case V.LEVEL_LOAD_TIMEOUT:typeof(s==null?void 0:s.level)=="number"&&(r.errorAction=this.getPlaylistRetryOrSwitchAction(r,s.level));return;case V.AUDIO_TRACK_LOAD_ERROR:case V.AUDIO_TRACK_LOAD_TIMEOUT:case V.SUBTITLE_LOAD_ERROR:case V.SUBTITLE_TRACK_LOAD_TIMEOUT:if(s){const l=i.loadLevelObj;if(l&&(s.type===Ce.AUDIO_TRACK&&l.hasAudioGroup(s.groupId)||s.type===Ce.SUBTITLE_TRACK&&l.hasSubtitleGroup(s.groupId))){r.errorAction=this.getPlaylistRetryOrSwitchAction(r,i.loadLevel),r.errorAction.action=hr.SendAlternateToPenaltyBox,r.errorAction.flags=Jr.MoveAllAlternatesMatchingHost;return}}return;case V.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED:r.errorAction={action:hr.SendAlternateToPenaltyBox,flags:Jr.MoveAllAlternatesMatchingHDCP};return;case V.KEY_SYSTEM_SESSION_UPDATE_FAILED:case V.KEY_SYSTEM_STATUS_INTERNAL_ERROR:case V.KEY_SYSTEM_NO_SESSION:r.errorAction={action:hr.SendAlternateToPenaltyBox,flags:Jr.MoveAllAlternatesMatchingKey};return;
vendor: 11,098 bytes, line 260
260case V.BUFFER_ADD_CODEC_ERROR:case V.REMUX_ALLOC_ERROR:case V.BUFFER_APPEND_ERROR:if(!r.errorAction){var o;r.errorAction=this.getLevelSwitchAction(r,(o=r.level)!=null?o:i.loadLevel)}return;case V.INTERNAL_EXCEPTION:case V.BUFFER_APPENDING_ERROR:case V.BUFFER_FULL_ERROR:case V.LEVEL_SWITCH_ERROR:case V.BUFFER_STALLED_ERROR:case V.BUFFER_SEEK_OVER_HOLE:case V.BUFFER_NUDGE_ON_STALL:r.errorAction=Ql();return}r.type===fe.KEY_SYSTEM_ERROR&&(r.levelRetry=!1,r.errorAction=Ql())}getPlaylistRetryOrSwitchAction(e,r){const n=this.hls,i=iI(n.config.playlistLoadPolicy,e),s=this.playlistError++;if(Bm(i,s,Fm(e),e.response))return{action:hr.RetryRequest,flags:Jr.None,retryConfig:i,retryCount:s};const o=this.getLevelSwitchAction(e,r);return i&&(o.retryConfig=i,o.retryCount=s),o}getFragRetryOrSwitchAction(e){const r=this.hls,n=this.getVariantLevelIndex(e.frag),i=r.levels[n],{fragLoadPolicy:s,keyLoadPolicy:a}=r.config,o=iI(_j(e)?a:s,e),l=r.levels.reduce((u,d)=>u+d.fragmentError,0);if(i&&(e.details!==V.FRAG_GAP&&i.fragmentError++,!Aj(e)&&Bm(o,l,Fm(e),e.response)))return{action:hr.RetryRequest,flags:Jr.None,retryConfig:o,retryCount:l};const c=this.getLevelSwitchAction(e,n);return o&&(c.retryConfig=o,c.retryCount=l),c}getLevelSwitchAction(e,r){const n=this.hls;r==null&&(r=n.loadLevel);const i=this.hls.levels[r];if(i){var s,a;const c=e.details;i.loadError++,c===V.BUFFER_APPEND_ERROR&&i.fragmentError++;let u=-1;const{levels:d,loadLevel:f,minAutoLevel:h,maxAutoLevel:p}=n;!n.autoLevelEnabled&&!n.config.preserveManualLevelOnError&&(n.loadLevel=-1);const g=(s=e.frag)==null?void 0:s.type,v=(g===oe.AUDIO&&c===V.FRAG_PARSING_ERROR||e.sourceBufferName==="audio"&&(c===V.BUFFER_ADD_CODEC_ERROR||c===V.BUFFER_APPEND_ERROR))&&d.some(({audioCodec:T})=>i.audioCodec!==T),b=e.sourceBufferName==="video"&&(c===V.BUFFER_ADD_CODEC_ERROR||c===V.BUFFER_APPEND_ERROR)&&d.some(({codecSet:T,audioCodec:_})=>i.codecSet!==T&&i.audioCodec===_),{type:w,groupId:S}=(a=e.context)!=null?a:{};for(let T=d.length;T--;){const _=(T+f)%d.length;if(_!==f&&_>=h&&_<=p&&d[_].loadError===0){var o,l;const A=d[_];if(c===V.FRAG_GAP&&g===oe.MAIN&&e.frag){const P=d[_].details;if(P){const C=jo(e.frag,P.fragments,e.frag.start);if(C!=null&&C.gap)continue}}else{if(w===Ce.AUDIO_TRACK&&A.hasAudioGroup(S)||w===Ce.SUBTITLE_TRACK&&A.hasSubtitleGroup(S))continue;if(g===oe.AUDIO&&(o=i.audioGroups)!=null&&o.some(P=>A.hasAudioGroup(P))||g===oe.SUBTITLE&&(l=i.subtitleGroups)!=null&&l.some(P=>A.hasSubtitleGroup(P))||v&&i.audioCodec===A.audioCodec||b&&i.codecSet===A.codecSet||!v&&i.codecSet!==A.codecSet)continue}u=_;break}}if(u>-1&&n.loadLevel!==u)return e.levelRetry=!0,this.playlistError=0,{action:hr.SendAlternateToPenaltyBox,flags:Jr.None,nextAutoLevel:u}}return{action:hr.SendAlternateToPenaltyBox,flags:Jr.MoveAllAlternatesMatchingHost}}onErrorOut(e,r){var n;switch((n=r.errorAction)==null?void 0:n.action){case hr.DoNothing:break;case hr.SendAlternateToPenaltyBox:this.sendAlternateToPenaltyBox(r),!r.errorAction.resolved&&r.details!==V.FRAG_GAP?r.fatal=!0:/MediaSource readyState: ended/.test(r.error.message)&&(this.warn(`MediaSource ended after "${r.sourceBufferName}" sourceBuffer append error. Attempting to recover from media error.`),this.hls.recoverMediaError());break}if(r.fatal){this.hls.stopLoad();return}}sendAlternateToPenaltyBox(e){const r=this.hls,n=e.errorAction;if(!n)return;const{flags:i}=n,s=n.nextAutoLevel;switch(i){case Jr.None:this.switchLevel(e,s);break;case Jr.MoveAllAlternatesMatchingHDCP:{const l=this.getVariantLevelIndex(e.frag),c=r.levels[l],u=c==null?void 0:c.attrs["HDCP-LEVEL"];if(n.hdcpLevel=u,u==="NONE")this.warn("HDCP policy resticted output with HDCP-LEVEL=NONE");else if(u){r.maxHdcpLevel=cw[cw.indexOf(u)-1],n.resolved=!0,this.warn(`Restricting playback to HDCP-LEVEL of "${r.maxHdcpLevel}" or lower`);break}}case Jr.MoveAllAlternatesMatchingKey:{const l=e.decryptdata;if(l){const c=this.hls.levels,u=c.length;for(let f=u;f--;)if(this.variantHasKey(c[f],l)){var a,o;this.log(`Banned key found in level ${f} (${c[f].bitrate}bps) or audio group "${(a=c[f].audioGroups)==null?void 0:a.join(",")}" (${(o=e.frag)==null?void 0:o.type} fragment) ${pr(l.keyId||[])}`),c[f].fragmentError++,c[f].loadError++,this.log(`Removing level ${f} with key error (${e.error})`),this.hls.removeLevel(f)}const d=e.frag;if(this.hls.levels.length<u)n.resolved=!0;else if(d&&d.type!==oe.MAIN){const f=d.decryptdata;f&&!l.matches(f)&&(n.resolved=!0)}}break}}n.resolved||this.switchLevel(e,s)}switchLevel(e,r){if(r!==void 0&&e.errorAction&&(this.warn(`switching to level ${r} after ${e.details}`),this.hls.nextAutoLevel=r,e.errorAction.resolved=!0,this.hls.nextLoadLevel=this.hls.nextAutoLevel,e.details===V.BUFFER_ADD_CODEC_ERROR&&e.mimeType&&e.sourceBufferName!=="audiovideo")){const n=lw(e.mimeType),i=this.hls.levels;for(let s=i.length;s--;)i[s][`${e.sourceBufferName}Codec`]===n&&(this.log(`Removing level ${s} for ${e.details} ("${n}" not supported)`),this.hls.removeLevel(s))}}}function Ql(t){const e={action:hr.DoNothing,flags:Jr.None};return t&&(e.resolved=!0),e}var qt={NOT_LOADED:"NOT_LOADED",APPENDING:"APPENDING",PARTIAL:"PARTIAL",OK:"OK"};class T7{constructor(e){this.activePartLists=Object.create(null),this.endListFragments=Object.create(null),this.fragments=Object.create(null),this.timeRanges=Object.create(null),this.bufferPadding=.2,this.hls=void 0,this.hasGaps=!1,this.hls=e,this._registerListeners()}_registerListeners(){const{hls:e}=this;e&&(e.on(I.MANIFEST_LOADING,this.onManifestLoading,this),e.on(I.BUFFER_APPENDED,this.onBufferAppended,this),e.on(I.FRAG_BUFFERED,this.onFragBuffered,this),e.on(I.FRAG_LOADED,this.onFragLoaded,this))}_unregisterListeners(){const{hls:e}=this;e&&(e.off(I.MANIFEST_LOADING,this.onManifestLoading,this),e.off(I.BUFFER_APPENDED,this.onBufferAppended,this),e.off(I.FRAG_BUFFERED,this.onFragBuffered,this),e.off(I.FRAG_LOADED,this.onFragLoaded,this))}destroy(){this._unregisterListeners(),this.hls=this.fragments=this.activePartLists=this.endListFragments=this.timeRanges=null}getAppendedFrag(e,r){const n=this.activePartLists[r];if(n)for(let i=n.length;i--;){const s=n[i];if(!s)break;if(s.start<=e&&e<=s.end&&s.loaded)return s}return this.getBufferedFrag(e,r)}getBufferedFrag(e,r){return this.getFragAtPos(e,r,!0)}getFragAtPos(e,r,n){const{fragments:i}=this,s=Object.keys(i);for(let a=s.length;a--;){const o=i[s[a]];if((o==null?void 0:o.body.type)===r&&(!n||o.buffered)){const l=o.body;if(l.start<=e&&e<=l.end)return l}}return null}detectEvictedFragments(e,r,n,i,s){this.timeRanges&&(this.timeRanges[e]=r);const a=(i==null?void 0:i.fragment.sn)||-1;Object.keys(this.fragments).forEach(o=>{const l=this.fragments[o];if(!l||a>=l.body.sn)return;if(!l.buffered&&(!l.loaded||s)){l.body.type===n&&this.removeFragment(l.body);return}const c=l.range[e];if(c){if(c.time.length===0){this.removeFragment(l.body);return}c.time.some(u=>{const d=!this.isTimeBuffered(u.startPTS,u.endPTS,r);return d&&this.removeFragment(l.body),d})}})}detectPartialFragments(e){const r=this.timeRanges;if(!r||e.frag.sn==="initSegment")return;const n=e.frag,i=cl(n),s=this.fragments[i];if(!s||s.buffered&&n.gap)return;const a=!n.relurl;Object.keys(r).forEach(o=>{const l=n.elementaryStreams[o];if(!l)return;const c=r[o],u=a||l.partial===!0;s.range[o]=this.getBufferedTimes(n,e.part,u,c)}),s.loaded=null,Object.keys(s.range).length?(this.bufferedEnd(s,n),Yh(s)||this.removeParts(n.sn-1,n.type)):this.removeFragment(s.body)}bufferedEnd(e,r){e.buffered=!0,(e.body.endList=r.endList||e.body.endList)&&(this.endListFragments[e.body.type]=e)}removeParts(e,r){const n=this.activePartLists[r];n&&(this.activePartLists[r]=aI(n,i=>i.fragment.sn>=e))}fragBuffered(e,r){const n=cl(e);let i=this.fragments[n];!i&&r&&(i=this.fragments[n]={body:e,appendedPTS:null,loaded:null,buffered:!1,range:Object.create(null)},e.gap&&(this.hasGaps=!0)),i&&(i.loaded=null,this.bufferedEnd(i,e))}getBufferedTimes(e,r,n,i){const s={time:[],partial:n},a=e.start,o=e.end,l=e.minEndPTS||o,c=e.maxStartPTS||a;for(let u=0;u<i.length;u++){const d=i.start(u)-this.bufferPadding,f=i.end(u)+this.bufferPadding;if(c>=d&&l<=f){s.time.push({startPTS:Math.max(a,i.start(u)),endPTS:Math.min(o,i.end(u))});break}else if(a<f&&o>d){const h=Math.max(a,i.start(u)),p=Math.min(o,i.end(u));p>h&&(s.partial=!0,s.time.push({startPTS:h,endPTS:p}))}else if(o<=d)break}return s}getPartialFragment(e){let r=null,n,i,s,a=0;const{bufferPadding:o,fragments:l}=this;return Object.keys(l).forEach(c=>{const u=l[c];u&&Yh(u)&&(i=u.body.start-o,s=u.body.end+o,e>=i&&e<=s&&(n=Math.min(e-i,s-e),a<=n&&(r=u.body,a=n)))}),r}isEndListAppended(e){const r=this.endListFragments[e];return r!==void 0&&(r.buffered||Yh(r))}getState(e){const r=cl(e),n=this.fragments[r];return n?n.buffered?Yh(n)?qt.PARTIAL:qt.OK:qt.APPENDING:qt.NOT_LOADED}isTimeBuffered(e,r,n){let i,s;for(let a=0;a<n.length;a++){if(i=n.start(a)-this.bufferPadding,s=n.end(a)+this.bufferPadding,e>=i&&r<=s)return!0;if(r<=i)return!1}return!1}onManifestLoading(){this.removeAllFragments()}onFragLoaded(e,r){if(r.frag.sn==="initSegment"||r.frag.bitrateTest)return;const n=r.frag,i=r.part?null:r,s=cl(n);this.fragments[s]={body:n,appendedPTS:null,loaded:i,buffered:!1,range:Object.create(null)}}onBufferAppended(e,r){const{frag:n,part:i,timeRanges:s,type:a}=r;if(n.sn==="initSegment")return;const o=n.type;if(i){let c=this.activePartLists[o];c||(this.activePartLists[o]=c=[]),c.push(i)}this.timeRanges=s;const l=s[a];this.detectEvictedFragments(a,l,o,i)}onFragBuffered(e,r){this.detectPartialFragments(r)}hasFragment(e){const r=cl(e);return!!this.fragments[r]}hasFragments(e){const{fragments:r}=this,n=Object.keys(r);if(!e)return n.length>0;for(let i=n.length;i--;){const s=r[n[i]];if((s==null?void 0:s.body.type)===e)return!0}return!1}hasParts(e){var r;return!!((r=this.activePartLists[e])!=null&&r.length)}removeFragmentsInRange(e,r,n,i,s){i&&!this.hasGaps||Object.keys(this.fragments).forEach(a=>{const o=this.fragments[a];if(!o)return;const l=o.body;l.type!==n||i&&!l.gap||l.start<r&&l.end>e&&(o.buffered||s)&&this.removeFragment(l)})}removeFragment(e){const r=cl(e);e.clearElementaryStreamInfo();const n=this.activePartLists[e.type];if(n){const i=e.sn;this.activePartLists[e.type]=aI(n,s=>s.fragment.sn!==i)}delete this.fragments[r],e.endList&&delete this.endListFragments[e.type]}removeAllFragments(){var e;this.fragments=Object.create(null),this.endListFragments=Object.create(null),this.activePartLists=Object.create(null),this.hasGaps=!1;const r=(e=this.hls)==null||(e=e.latestLevelDetails)==null?void 0:e.partList;r&&r.forEach(n=>n.clearElementaryStreamInfo())}}function Yh(t){var e,r,n;return t.buffered&&!!(t.body.gap||(e=t.range.video)!=null&&e.partial||(r=t.range.audio)!=null&&r.partial||(n=t.range.audiovideo)!=null&&n.partial)}function cl(t){return`${t.type}_${t.level}_${t.sn}`}function aI(t,e){return t.filter(r=>{const n=e(r);return n||r.clearElementaryStreamInfo(),n})}var _a={cbc:0,ctr:1};class _7{constructor(e,r,n){this.subtle=void 0,this.aesIV=void 0,this.aesMode=void 0,this.subtle=e,this.aesIV=r,this.aesMode=n}decrypt(e,r){switch(this.aesMode){case _a.cbc:return this.subtle.decrypt({
vendor: 19,628 bytes, line 260
260name:"AES-CBC",iv:this.aesIV},r,e);case _a.ctr:return this.subtle.decrypt({name:"AES-CTR",counter:this.aesIV,length:64},r,e);default:throw new Error(`[AESCrypto] invalid aes mode ${this.aesMode}`)}}}function A7(t){const e=t.byteLength,r=e&&new DataView(t.buffer).getUint8(e-1);return r?t.slice(0,e-r):t}class P7{constructor(){this.rcon=[0,1,2,4,8,16,32,64,128,27,54],this.subMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.invSubMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.sBox=new Uint32Array(256),this.invSBox=new Uint32Array(256),this.key=new Uint32Array(0),this.ksRows=0,this.keySize=0,this.keySchedule=void 0,this.invKeySchedule=void 0,this.initTable()}uint8ArrayToUint32Array_(e){const r=new DataView(e),n=new Uint32Array(4);for(let i=0;i<4;i++)n[i]=r.getUint32(i*4);return n}initTable(){const e=this.sBox,r=this.invSBox,n=this.subMix,i=n[0],s=n[1],a=n[2],o=n[3],l=this.invSubMix,c=l[0],u=l[1],d=l[2],f=l[3],h=new Uint32Array(256);let p=0,g=0,m=0;for(m=0;m<256;m++)m<128?h[m]=m<<1:h[m]=m<<1^283;for(m=0;m<256;m++){let v=g^g<<1^g<<2^g<<3^g<<4;v=v>>>8^v&255^99,e[p]=v,r[v]=p;const y=h[p],b=h[y],w=h[b];let S=h[v]*257^v*16843008;i[p]=S<<24|S>>>8,s[p]=S<<16|S>>>16,a[p]=S<<8|S>>>24,o[p]=S,S=w*16843009^b*65537^y*257^p*16843008,c[v]=S<<24|S>>>8,u[v]=S<<16|S>>>16,d[v]=S<<8|S>>>24,f[v]=S,p?(p=y^h[h[h[w^y]]],g^=h[h[g]]):p=g=1}}expandKey(e){const r=this.uint8ArrayToUint32Array_(e);let n=!0,i=0;for(;i<r.length&&n;)n=r[i]===this.key[i],i++;if(n)return;this.key=r;const s=this.keySize=r.length;if(s!==4&&s!==6&&s!==8)throw new Error("Invalid aes key size="+s);const a=this.ksRows=(s+6+1)*4;let o,l;const c=this.keySchedule=new Uint32Array(a),u=this.invKeySchedule=new Uint32Array(a),d=this.sBox,f=this.rcon,h=this.invSubMix,p=h[0],g=h[1],m=h[2],v=h[3];let y,b;for(o=0;o<a;o++){if(o<s){y=c[o]=r[o];continue}b=y,o%s===0?(b=b<<8|b>>>24,b=d[b>>>24]<<24|d[b>>>16&255]<<16|d[b>>>8&255]<<8|d[b&255],b^=f[o/s|0]<<24):s>6&&o%s===4&&(b=d[b>>>24]<<24|d[b>>>16&255]<<16|d[b>>>8&255]<<8|d[b&255]),c[o]=y=(c[o-s]^b)>>>0}for(l=0;l<a;l++)o=a-l,l&3?b=c[o]:b=c[o-4],l<4||o<=4?u[l]=b:u[l]=p[d[b>>>24]]^g[d[b>>>16&255]]^m[d[b>>>8&255]]^v[d[b&255]],u[l]=u[l]>>>0}networkToHostOrderSwap(e){return e<<24|(e&65280)<<8|(e&16711680)>>8|e>>>24}decrypt(e,r,n){const i=this.keySize+6,s=this.invKeySchedule,a=this.invSBox,o=this.invSubMix,l=o[0],c=o[1],u=o[2],d=o[3],f=this.uint8ArrayToUint32Array_(n);let h=f[0],p=f[1],g=f[2],m=f[3];const v=new Int32Array(e),y=new Int32Array(v.length);let b,w,S,T,_,A,P,C,O,R,D,L,j,M;const N=this.networkToHostOrderSwap;for(;r<v.length;){for(O=N(v[r]),R=N(v[r+1]),D=N(v[r+2]),L=N(v[r+3]),_=O^s[0],A=L^s[1],P=D^s[2],C=R^s[3],j=4,M=1;M<i;M++)b=l[_>>>24]^c[A>>16&255]^u[P>>8&255]^d[C&255]^s[j],w=l[A>>>24]^c[P>>16&255]^u[C>>8&255]^d[_&255]^s[j+1],S=l[P>>>24]^c[C>>16&255]^u[_>>8&255]^d[A&255]^s[j+2],T=l[C>>>24]^c[_>>16&255]^u[A>>8&255]^d[P&255]^s[j+3],_=b,A=w,P=S,C=T,j=j+4;b=a[_>>>24]<<24^a[A>>16&255]<<16^a[P>>8&255]<<8^a[C&255]^s[j],w=a[A>>>24]<<24^a[P>>16&255]<<16^a[C>>8&255]<<8^a[_&255]^s[j+1],S=a[P>>>24]<<24^a[C>>16&255]<<16^a[_>>8&255]<<8^a[A&255]^s[j+2],T=a[C>>>24]<<24^a[_>>16&255]<<16^a[A>>8&255]<<8^a[P&255]^s[j+3],y[r]=N(b^h),y[r+1]=N(T^p),y[r+2]=N(S^g),y[r+3]=N(w^m),h=O,p=R,g=D,m=L,r=r+4}return y.buffer}}class I7{constructor(e,r,n){this.subtle=void 0,this.key=void 0,this.aesMode=void 0,this.subtle=e,this.key=r,this.aesMode=n}expandKey(){const e=C7(this.aesMode);return this.subtle.importKey("raw",this.key,{name:e},!1,["encrypt","decrypt"])}}function C7(t){switch(t){case _a.cbc:return"AES-CBC";case _a.ctr:return"AES-CTR";default:throw new Error(`[FastAESKey] invalid aes mode ${t}`)}}const O7=16;class RT{constructor(e,{removePKCS7Padding:r=!0}={}){if(this.logEnabled=!0,this.removePKCS7Padding=void 0,this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null,this.useSoftware=void 0,this.enableSoftwareAES=void 0,this.enableSoftwareAES=e.enableSoftwareAES,this.removePKCS7Padding=r,r)try{const n=self.crypto;n&&(this.subtle=n.subtle||n.webkitSubtle)}catch{}this.useSoftware=!this.subtle}destroy(){this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null}isSync(){return this.useSoftware}flush(){const{currentResult:e,remainderData:r}=this;if(!e||r)return this.reset(),null;const n=new Uint8Array(e);return this.reset(),this.removePKCS7Padding?A7(n):n}reset(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)}decrypt(e,r,n,i){return this.useSoftware?new Promise((s,a)=>{const o=ArrayBuffer.isView(e)?e:new Uint8Array(e);this.softwareDecrypt(o,r,n,i);const l=this.flush();l?s(l.buffer):a(new Error("[softwareDecrypt] Failed to decrypt data"))}):this.webCryptoDecrypt(new Uint8Array(e),r,n,i)}softwareDecrypt(e,r,n,i){const{currentIV:s,currentResult:a,remainderData:o}=this;if(i!==_a.cbc||r.byteLength!==16)return qe.warn("SoftwareDecrypt: can only handle AES-128-CBC"),null;this.logOnce("JS AES decrypt"),o&&(e=kn(o,e),this.remainderData=null);const l=this.getValidChunk(e);if(!l.length)return null;s&&(n=s);let c=this.softwareDecrypter;c||(c=this.softwareDecrypter=new P7),c.expandKey(r);const u=a;return this.currentResult=c.decrypt(l.buffer,0,n),this.currentIV=l.slice(-16).buffer,u||null}webCryptoDecrypt(e,r,n,i){if(this.key!==r||!this.fastAesKey){if(!this.subtle)return Promise.resolve(this.onWebCryptoError(e,r,n,i));this.key=r,this.fastAesKey=new I7(this.subtle,r,i)}return this.fastAesKey.expandKey().then(s=>this.subtle?(this.logOnce("WebCrypto AES decrypt"),new _7(this.subtle,new Uint8Array(n),i).decrypt(e.buffer,s)):Promise.reject(new Error("web crypto not initialized"))).catch(s=>(qe.warn(`[decrypter]: WebCrypto Error, disable WebCrypto API, ${s.name}: ${s.message}`),this.onWebCryptoError(e,r,n,i)))}onWebCryptoError(e,r,n,i){const s=this.enableSoftwareAES;if(s){this.useSoftware=!0,this.logEnabled=!0,this.softwareDecrypt(e,r,n,i);const a=this.flush();if(a)return a.buffer}throw new Error("WebCrypto"+(s?" and softwareDecrypt":"")+": failed to decrypt data")}getValidChunk(e){let r=e;const n=e.length-e.length%O7;return n!==e.length&&(r=e.slice(0,n),this.remainderData=e.slice(n)),r}logOnce(e){this.logEnabled&&(qe.log(`[decrypter]: ${e}`),this.logEnabled=!1)}}const oI=Math.pow(2,17);class R7{constructor(e){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=e}destroy(){this.loader&&(this.loader.destroy(),this.loader=null)}abort(){this.loader&&this.loader.abort()}load(e,r){const n=e.url;if(!n)return Promise.reject(new rs({type:fe.NETWORK_ERROR,details:V.FRAG_LOAD_ERROR,fatal:!1,frag:e,error:new Error(`Fragment does not have a ${n?"part list":"url"}`),networkDetails:null}));this.abort();const i=this.config,s=i.fLoader,a=i.loader;return new Promise((o,l)=>{if(this.loader&&this.loader.destroy(),e.gap)if(e.tagList.some(p=>p[0]==="GAP")){l(cI(e));return}else e.gap=!1;const c=this.loader=s?new s(i):new a(i),u=lI(e);e.loader=c;const d=sI(i.fragLoadPolicy.default),f={loadPolicy:d,timeout:d.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:e.sn==="initSegment"?1/0:oI};e.stats=c.stats;const h={onSuccess:(p,g,m,v)=>{this.resetLoader(e,c);let y=p.data;m.resetIV&&e.decryptdata&&(e.decryptdata.iv=new Uint8Array(y.slice(0,16)),y=y.slice(16)),o({frag:e,part:null,payload:y,networkDetails:v})},onError:(p,g,m,v)=>{this.resetLoader(e,c),l(new rs({type:fe.NETWORK_ERROR,details:V.FRAG_LOAD_ERROR,fatal:!1,frag:e,response:Ve({url:n,data:void 0},p),error:new Error(`HTTP Error ${p.code} ${p.text}`),networkDetails:m,stats:v}))},onAbort:(p,g,m)=>{this.resetLoader(e,c),l(new rs({type:fe.NETWORK_ERROR,details:V.INTERNAL_ABORTED,fatal:!1,frag:e,error:new Error("Aborted"),networkDetails:m,stats:p}))},onTimeout:(p,g,m)=>{this.resetLoader(e,c),l(new rs({type:fe.NETWORK_ERROR,details:V.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,error:new Error(`Timeout after ${f.timeout}ms`),networkDetails:m,stats:p}))}};r&&(h.onProgress=(p,g,m,v)=>r({frag:e,part:null,payload:m,networkDetails:v})),c.load(u,f,h)})}loadPart(e,r,n){this.abort();const i=this.config,s=i.fLoader,a=i.loader;return new Promise((o,l)=>{if(this.loader&&this.loader.destroy(),e.gap||r.gap){l(cI(e,r));return}const c=this.loader=s?new s(i):new a(i),u=lI(e,r);e.loader=c;const d=sI(i.fragLoadPolicy.default),f={loadPolicy:d,timeout:d.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:oI};r.stats=c.stats,c.load(u,f,{onSuccess:(h,p,g,m)=>{this.resetLoader(e,c),this.updateStatsFromPart(e,r);const v={frag:e,part:r,payload:h.data,networkDetails:m};n(v),o(v)},onError:(h,p,g,m)=>{this.resetLoader(e,c),l(new rs({type:fe.NETWORK_ERROR,details:V.FRAG_LOAD_ERROR,fatal:!1,frag:e,part:r,response:Ve({url:u.url,data:void 0},h),error:new Error(`HTTP Error ${h.code} ${h.text}`),networkDetails:g,stats:m}))},onAbort:(h,p,g)=>{e.stats.aborted=r.stats.aborted,this.resetLoader(e,c),l(new rs({type:fe.NETWORK_ERROR,details:V.INTERNAL_ABORTED,fatal:!1,frag:e,part:r,error:new Error("Aborted"),networkDetails:g,stats:h}))},onTimeout:(h,p,g)=>{this.resetLoader(e,c),l(new rs({type:fe.NETWORK_ERROR,details:V.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,part:r,error:new Error(`Timeout after ${f.timeout}ms`),networkDetails:g,stats:h}))}})})}updateStatsFromPart(e,r){const n=e.stats,i=r.stats,s=i.total;if(n.loaded+=i.loaded,s){const l=Math.round(e.duration/r.duration),c=Math.min(Math.round(n.loaded/s),l),d=(l-c)*Math.round(n.loaded/c);n.total=n.loaded+d}else n.total=Math.max(n.loaded,n.total);const a=n.loading,o=i.loading;a.start?a.first+=o.first-o.start:(a.start=o.start,a.first=o.first),a.end=o.end}resetLoader(e,r){e.loader=null,this.loader===r&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),r.destroy()}}function lI(t,e=null){const r=e||t,n={frag:t,part:e,responseType:"arraybuffer",url:r.url,headers:{},rangeStart:0,rangeEnd:0},i=r.byteRangeStartOffset,s=r.byteRangeEndOffset;if(se(i)&&se(s)){var a;let o=i,l=s;if(t.sn==="initSegment"&&k7((a=t.decryptdata)==null?void 0:a.method)){const c=s-i;c%16&&(l=s+(16-c%16)),i!==0&&(n.resetIV=!0,o=i-16)}n.rangeStart=o,n.rangeEnd=l}return n}function cI(t,e){const r=new Error(`GAP ${t.gap?"tag":"attribute"} found`),n={type:fe.MEDIA_ERROR,details:V.FRAG_GAP,fatal:!1,frag:t,error:r,networkDetails:null};return e&&(n.part=e),(e||t).stats.aborted=!0,new rs(n)}function k7(t){return t==="AES-128"||t==="AES-256"}class rs extends Error{constructor(e){super(e.error.message),this.data=void 0,this.data=e}}class Pj extends Dn{constructor(e,r){super(e,r),this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}destroy(){this.onHandlerDestroying(),this.onHandlerDestroyed()}onHandlerDestroying(){this.clearNextTick(),this.clearInterval()}onHandlerDestroyed(){}hasInterval(){return!!this._tickInterval}hasNextTick(){return!!this._tickTimer}setInterval(e){return this._tickInterval?!1:(this._tickCallCount=0,this._tickInterval=self.setInterval(this._boundTick,e),!0)}clearInterval(){return this._tickInterval?(self.clearInterval(this._tickInterval),this._tickInterval=null,!0):!1}clearNextTick(){return this._tickTimer?(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0):!1}tick(){this._tickCallCount++,this._tickCallCount===1&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)}tickImmediate(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)}doTick(){}}class kT{constructor(e,r,n,i=0,s=-1,a=!1){this.level=void 0,this.sn=void 0,this.part=void 0,this.id=void 0,this.size=void 0,this.partial=void 0,this.transmuxing=Xh(),this.buffering={audio:Xh(),video:Xh(),audiovideo:Xh()},this.level=e,this.sn=r,this.id=n,this.size=i,this.part=s,this.partial=a}}function Xh(){return{start:0,executeStart:0,executeEnd:0,end:0}}const uI={length:0,start:()=>0,end:()=>0};class Se{static isBuffered(e,r){if(e){const n=Se.getBuffered(e);for(let i=n.length;i--;)if(r>=n.start(i)&&r<=n.end(i))return!0}return!1}static bufferedRanges(e){if(e){const r=Se.getBuffered(e);return Se.timeRangesToArray(r)}return[]}static timeRangesToArray(e){const r=[];for(let n=0;n<e.length;n++)r.push({start:e.start(n),end:e.end(n)});return r}static bufferInfo(e,r,n){if(e){const i=Se.bufferedRanges(e);if(i.length)return Se.bufferedInfo(i,r,n)}return{len:0,start:r,end:r,bufferedIndex:-1}}static bufferedInfo(e,r,n){r=Math.max(0,r),e.length>1&&e.sort((u,d)=>u.start-d.start||d.end-u.end);let i=-1,s=[];if(n)for(let u=0;u<e.length;u++){r>=e[u].start&&r<=e[u].end&&(i=u);const d=s.length;if(d){const f=s[d-1].end;e[u].start-f<n?e[u].end>f&&(s[d-1].end=e[u].end):s.push(e[u])}else s.push(e[u])}else s=e;let a=0,o,l=r,c=r;for(let u=0;u<s.length;u++){const d=s[u].start,f=s[u].end;if(i===-1&&r>=d&&r<=f&&(i=u),r+n>=d&&r<f)l=d,c=f,a=c-r;else if(r+n<d){o=d;break}}return{len:a,start:l||0,end:c||0,nextStart:o,buffered:e,bufferedIndex:i}}static getBuffered(e){try{return e.buffered||uI}catch(r){return qe.log("failed to get media.buffered",r),uI}}}const Ij=/\{\$([a-zA-Z0-9-_]+)\}/g;function dI(t){return Ij.test(t)}function dw(t,e){if(t.variableList!==null||t.hasVariableRefs){const r=t.variableList;return e.replace(Ij,n=>{const i=n.substring(2,n.length-1),s=r==null?void 0:r[i];return s===void 0?(t.playlistParsingError||(t.playlistParsingError=new Error(`Missing preceding EXT-X-DEFINE tag for Variable Reference: "${i}"`)),n):s})}return e}function fI(t,e,r){let n=t.variableList;n||(t.variableList=n={});let i,s;if("QUERYPARAM"in e){i=e.QUERYPARAM;try{const a=new self.URL(r).searchParams;if(a.has(i))s=a.get(i);else throw new Error(`"${i}" does not match any query parameter in URI: "${r}"`)}catch(a){t.playlistParsingError||(t.playlistParsingError=new Error(`EXT-X-DEFINE QUERYPARAM: ${a.message}`))}}else i=e.NAME,s=e.VALUE;i in n?t.playlistParsingError||(t.playlistParsingError=new Error(`EXT-X-DEFINE duplicate Variable Name declarations: "${i}"`)):n[i]=s||""}function L7(t,e,r){const n=e.IMPORT;if(r&&n in r){let i=t.variableList;i||(t.variableList=i={}),i[n]=r[n]}else t.playlistParsingError||(t.playlistParsingError=new Error(`EXT-X-DEFINE IMPORT attribute not found in Multivariant Playlist: "${n}"`))}const D7=/^(\d+)x(\d+)$/,hI=/(.+?)=(".*?"|.*?)(?:,|$)/g;class St{constructor(e,r){typeof e=="string"&&(e=St.parseAttrList(e,r)),et(this,e)}get clientAttrs(){return Object.keys(this).filter(e=>e.substring(0,2)==="X-")}decimalInteger(e){const r=parseInt(this[e],10);return r>Number.MAX_SAFE_INTEGER?1/0:r}hexadecimalInteger(e){if(this[e]){let r=(this[e]||"0x").slice(2);r=(r.length&1?"0":"")+r;const n=new Uint8Array(r.length/2);for(let i=0;i<r.length/2;i++)n[i]=parseInt(r.slice(i*2,i*2+2),16);return n}return null}hexadecimalIntegerAsNumber(e){const r=parseInt(this[e],16);return r>Number.MAX_SAFE_INTEGER?1/0:r}decimalFloatingPoint(e){return parseFloat(this[e])}optionalFloat(e,r){const n=this[e];return n?parseFloat(n):r}enumeratedString(e){return this[e]}enumeratedStringList(e,r){const n=this[e];return(n?n.split(/[ ,]+/):[]).reduce((i,s)=>(i[s.toLowerCase()]=!0,i),r)}bool(e){return this[e]==="YES"}decimalResolution(e){const r=D7.exec(this[e]);if(r!==null)return{width:parseInt(r[1],10),height:parseInt(r[2],10)}}static parseAttrList(e,r){let n;const i={},s='"';for(hI.lastIndex=0;(n=hI.exec(e))!==null;){const a=n[1].trim();let o=n[2];const l=o.indexOf(s)===0&&o.lastIndexOf(s)===o.length-1;let c=!1;if(l)o=o.slice(1,-1);else switch(a){case"IV":case"SCTE35-CMD":case"SCTE35-IN":case"SCTE35-OUT":c=!0}if(r&&(l||c))o=dw(r,o);else if(!c&&!l)switch(a){case"CLOSED-CAPTIONS":if(o==="NONE")break;case"ALLOWED-CPC":case"CLASS":case"ASSOC-LANGUAGE":case"AUDIO":case"BYTERANGE":case"CHANNELS":case"CHARACTERISTICS":case"CODECS":case"DATA-ID":case"END-DATE":case"GROUP-ID":case"ID":case"IMPORT":case"INSTREAM-ID":case"KEYFORMAT":case"KEYFORMATVERSIONS":case"LANGUAGE":case"NAME":case"PATHWAY-ID":case"QUERYPARAM":case"RECENTLY-REMOVED-DATERANGES":case"SERVER-URI":case"STABLE-RENDITION-ID":case"STABLE-VARIANT-ID":case"START-DATE":case"SUBTITLES":case"SUPPLEMENTAL-CODECS":case"URI":case"VALUE":case"VIDEO":case"X-ASSET-LIST":case"X-ASSET-URI":qe.warn(`${e}: attribute ${a} is missing quotes`)}i[a]=o}return i}}const N7="com.apple.hls.interstitial";function M7(t){return t!=="ID"&&t!=="CLASS"&&t!=="CUE"&&t!=="START-DATE"&&t!=="DURATION"&&t!=="END-DATE"&&t!=="END-ON-NEXT"}function $7(t){return t==="SCTE35-OUT"||t==="SCTE35-IN"||t==="SCTE35-CMD"}class Cj{constructor(e,r,n=0){var i;if(this.attr=void 0,this.tagAnchor=void 0,this.tagOrder=void 0,this._startDate=void 0,this._endDate=void 0,this._dateAtEnd=void 0,this._cue=void 0,this._badValueForSameId=void 0,this.tagAnchor=(r==null?void 0:r.tagAnchor)||null,this.tagOrder=(i=r==null?void 0:r.tagOrder)!=null?i:n,r){const s=r.attr;for(const a in s)if(Object.prototype.hasOwnProperty.call(e,a)&&e[a]!==s[a]){qe.warn(`DATERANGE tag attribute: "${a}" does not match for tags with ID: "${e.ID}"`),this._badValueForSameId=a;break}e=et(new St({}),s,e)}if(this.attr=e,r?(this._startDate=r._startDate,this._cue=r._cue,this._endDate=r._endDate,this._dateAtEnd=r._dateAtEnd):this._startDate=new Date(e["START-DATE"]),"END-DATE"in this.attr){const s=(r==null?void 0:r.endDate)||new Date(this.attr["END-DATE"]);se(s.getTime())&&(this._endDate=s)}}get id(){return this.attr.ID}get class(){return this.attr.CLASS}get cue(){const e=this._cue;return e===void 0?this._cue=this.attr.enumeratedStringList(this.attr.CUE?"CUE":"X-CUE",{pre:!1,post:!1,once:!1}):e}get startTime(){const{tagAnchor:e}=this;return e===null||e.programDateTime===null?(qe.warn(`Expected tagAnchor Fragment with PDT set for DateRange "${this.id}": ${e}`),NaN):e.start+(this.startDate.getTime()-e.programDateTime)/1e3}get startDate(){return this._startDate}get endDate(){const e=this._endDate||this._dateAtEnd;if(e)return e;const r=this.duration;return r!==null?this._dateAtEnd=new Date(this._startDate.getTime()+r*1e3):null}get duration(){if("DURATION"in this.attr){const e=this.attr.decimalFloatingPoint("DURATION");if(se(e))return e}else if(this._endDate)return(this._endDate.getTime()-this._startDate.getTime())/1e3;return null}get plannedDuration(){return"PLANNED-DURATION"in this.attr?this.attr.decimalFloatingPoint("PLANNED-DURATION"):null}get endOnNext(){return this.attr.bool("END-ON-NEXT")}get isInterstitial(){return this.class===N7}get isValid(){return!!this.id&&!this._badValueForSameId&&se(this.startDate.getTime())&&(this.duration===null||this.duration>=0)&&(!this.endOnNext||!!this.class)&&(!this.attr.CUE||!this.cue.pre&&!this.cue.post||this.cue.pre!==this.cue.post)&&(!this.isInterstitial||"X-ASSET-URI"in this.attr||"X-ASSET-LIST"in this.attr)}}const j7=10;class F7{constructor(e){this.PTSKnown=!1,this.alignedSliding=!1,this.averagetargetduration=void 0,this.endCC=0,this.endSN=0,this.fragments=void 0,this.fragmentHint=void 0,this.partList=null,this.dateRanges=void 0,this.dateRangeTagCount=0,this.live=!0,this.requestScheduled=-1,this.ageHeader=0,this.advancedDateTime=void 0,this.updated=!0,this.advanced=!0,this.misses=0,this.startCC=0,this.startSN=0,this.startTimeOffset=null,this.targetduration=0,this.totalduration=0,this.type=null,this.url=void 0,this.m3u8="",this.version=null,this.canBlockReload=!1,this.canSkipUntil=0,this.canSkipDateRanges=!1,this.skippedSegments=0,this.recentlyRemovedDateranges=void 0,this.partHoldBack=0,this.holdBack=0,this.partTarget=0,this.preloadHint=void 0,this.renditionReports=void 0,this.tuneInGoal=0,this.deltaUpdateFailed=void 0,this.drift
vendor: 4,536 bytes, line 260
260StartTime=0,this.driftEndTime=0,this.driftStart=0,this.driftEnd=0,this.encryptedFragments=void 0,this.playlistParsingError=null,this.variableList=null,this.hasVariableRefs=!1,this.appliedTimelineOffset=void 0,this.fragments=[],this.encryptedFragments=[],this.dateRanges={},this.url=e}reloaded(e){if(!e){this.advanced=!0,this.updated=!0;return}const r=this.lastPartSn-e.lastPartSn,n=this.lastPartIndex-e.lastPartIndex;this.updated=this.endSN!==e.endSN||!!n||!!r||!this.live,this.advanced=this.endSN>e.endSN||r>0||r===0&&n>0,this.updated||this.advanced?this.misses=Math.floor(e.misses*.6):this.misses=e.misses+1}hasKey(e){return this.encryptedFragments.some(r=>{let n=r.decryptdata;return n||(r.setKeyFormat(e.keyFormat),n=r.decryptdata),!!n&&e.matches(n)})}get hasProgramDateTime(){return this.fragments.length?se(this.fragments[this.fragments.length-1].programDateTime):!1}get levelTargetDuration(){return this.averagetargetduration||this.targetduration||j7}get drift(){const e=this.driftEndTime-this.driftStartTime;return e>0?(this.driftEnd-this.driftStart)*1e3/e:1}get edge(){return this.partEnd||this.fragmentEnd}get partEnd(){var e;return(e=this.partList)!=null&&e.length?this.partList[this.partList.length-1].end:this.fragmentEnd}get fragmentEnd(){return this.fragments.length?this.fragments[this.fragments.length-1].end:0}get fragmentStart(){return this.fragments.length?this.fragments[0].start:0}get age(){return this.advancedDateTime?Math.max(Date.now()-this.advancedDateTime,0)/1e3:0}get lastPartIndex(){var e;return(e=this.partList)!=null&&e.length?this.partList[this.partList.length-1].index:-1}get maxPartIndex(){const e=this.partList;if(e){const r=this.lastPartIndex;if(r!==-1){for(let n=e.length;n--;)if(e[n].index>r)return e[n].index;return r}}return 0}get lastPartSn(){var e;return(e=this.partList)!=null&&e.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}get expired(){if(this.live&&this.age&&this.misses<3){const e=this.partEnd-this.fragmentStart;return this.age>Math.max(e,this.totalduration)+this.levelTargetDuration}return!1}}function Um(t,e){return t.length===e.length?!t.some((r,n)=>r!==e[n]):!1}function pI(t,e){return!t&&!e?!0:!t||!e?!1:Um(t,e)}function Jl(t){return t==="AES-128"||t==="AES-256"||t==="AES-256-CTR"}function LT(t){switch(t){case"AES-128":case"AES-256":return _a.cbc;case"AES-256-CTR":return _a.ctr;default:throw new Error(`invalid full segment method ${t}`)}}function DT(t){return Uint8Array.from(atob(t),e=>e.charCodeAt(0))}function fw(t){return Uint8Array.from(unescape(encodeURIComponent(t)),e=>e.charCodeAt(0))}function B7(t){const e=fw(t).subarray(0,16),r=new Uint8Array(16);return r.set(e,16-e.length),r}function Oj(t){const e=function(n,i,s){const a=n[i];n[i]=n[s],n[s]=a};e(t,0,3),e(t,1,2),e(t,4,5),e(t,6,7)}function Rj(t){const e=t.split(":");let r=null;if(e[0]==="data"&&e.length===2){const n=e[1].split(";"),i=n[n.length-1].split(",");if(i.length===2){const s=i[0]==="base64",a=i[1];s?(n.splice(-1,1),r=DT(a)):r=B7(a)}}return r}const Gm=typeof self<"u"?self:void 0;var Tt={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.fps",PLAYREADY:"com.microsoft.playready",WIDEVINE:"com.widevine.alpha"},mr={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.streamingkeydelivery",PLAYREADY:"com.microsoft.playready",WIDEVINE:"urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed"};function Wp(t){switch(t){case mr.FAIRPLAY:return Tt.FAIRPLAY;case mr.PLAYREADY:return Tt.PLAYREADY;case mr.WIDEVINE:return Tt.WIDEVINE;case mr.CLEARKEY:return Tt.CLEARKEY}}function _0(t){switch(t){case Tt.FAIRPLAY:return mr.FAIRPLAY;case Tt.PLAYREADY:return mr.PLAYREADY;case Tt.WIDEVINE:return mr.WIDEVINE;case Tt.CLEARKEY:return mr.CLEARKEY}}function ed(t){const{drmSystems:e,widevineLicenseUrl:r}=t,n=e?[Tt.FAIRPLAY,Tt.WIDEVINE,Tt.PLAYREADY,Tt.CLEARKEY].filter(i=>!!e[i]):[];return!n[Tt.WIDEVINE]&&r&&n.push(Tt.WIDEVINE),n}const kj=function(t){return Gm!=null&&(t=Gm.navigator)!=null&&t.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null}();function U7(t,e,r,n){let i;switch(t){case Tt.FAIRPLAY:i=["cenc","sinf"];break;case Tt.WIDEVINE:case Tt.PLAYREADY:i=["cenc"];break;case Tt.CLEARKEY:i=["cenc","keyids"];break;default:throw new Error(`Unknown key-system: ${t}`)}return G7(i,e,r,n)}function G7(t,e,r,n){return[{initDataTypes:t,persistentState:n.persistentState||"optional",distinctiveIdentifier:n.distinctiveIdentifier||"optional",sessionTypes:n.sessionTypes||[n.sessionType||"temporary"],audioCapabilities:e.map(s=>({contentType:`audio/mp4; codecs=${s}
260`,robustness:n.audioRobustness||"",encryptionScheme:n.audioEncryptionScheme||null})),videoCapabilities:r.map(s=>({contentType:`video/mp4; codecs=${s}`,robustness:n.videoRobustness||"",encryptionScheme:n.videoEncryptionScheme||null}))}]}function W7(t){var e;return!!t&&(t.sessionType==="persistent-license"||!!((e=t.sessionTypes)!=null&&e.some(r=>r==="persistent-license")))}function Lj(t){const e=new Uint16Array(t.buffer,t.byteOffset,t.byteLength/2),r=String.fromCharCode.apply(null,Array.from(e)),n=r.substring(r.indexOf("<"),r.length),a=new DOMParser().parseFromString(n,"text/xml").getElementsByTagName("KID")[0];if(a){const o=a.childNodes[0]?a.childNodes[0].nodeValue:a.getAttribute("VALUE");if(o){const l=DT(o).subarray(0,16);return Oj(l),l}}return null}let ul={};class ya{static clearKeyUriToKeyIdMap(){ul={}}static setKeyIdForUri(e,r){ul[e]=r}static addKeyIdForUri(e){const r=Object.keys(ul).length%Number.MAX_SAFE_INTEGER,n=new Uint8Array(16);return new DataView(n.buffer,12,4).setUint32(0,r),ul[e]=n,n}constructor(e,r,n,i=[1],s=null,a){this.uri=void 0,this.method=void 0,this.keyFormat=void 0,this.keyFormatVersions=void 0,this.encrypted=void 0,this.isCommonEncryption=void 0,this.iv=null,this.key=null,this.keyId=null,this.pssh=null,this.method=e,this.uri=r,this.keyFormat=n,this.keyFormatVersions=i,this.iv=s,this.encrypted=e?e!=="NONE":!1,this.isCommonEncryption=this.encrypted&&!Jl(e),a!=null&&a.startsWith("0x")&&(this.keyId=new Uint8Array(oj(a)))}matches(e){return e.uri===this.uri&&e.method===this.method&&e.encrypted===this.encrypted&&e.keyFormat===this.keyFormat&&Um(e.keyFormatVersions,this.keyFormatVersions)&&pI(e.iv,this.iv)&&pI(e.keyId,this.keyId)}isSupported(){if(this.method){if(Jl(this.method)||this.method==="NONE")return!0;if(this.keyFormat==="identity")return this.method==="SAMPLE-AES";switch(this.keyFormat){case mr.FAIRPLAY:case mr.WIDEVINE:case mr.PLAYREADY:case mr.CLEARKEY:return["SAMPLE-AES","SAMPLE-AES-CENC","SAMPLE-AES-CTR"].indexOf(this.method)!==-1}}return!1}getDecryptData(e,r){if(!this.encrypted||!this.uri)return null;if(Jl(this.method)){let s=this.iv;return s||(typeof e!="number"&&(qe.warn(`missing IV for initialization segment with method="${this.method}" - compliance issue`),e=0),s=H7(e)),new ya(this.method,this.uri,"identity",this.keyFormatVersions,s)}if(this.keyId){const s=ul[this.uri];if(s&&!Um(this.keyId,s)&&ya.setKeyIdForUri(this.uri,this.keyId),this.pssh)return this}const n=Rj(this.uri);if(n)switch(this.keyFormat){case mr.WIDEVINE:if(this.pssh=n,!this.keyId){const s=qY(n.buffer);if(s.length){var i;const a=s[0];this.keyId=(i=a.kids)!=null&&i.length?a.kids[0]:null}}this.keyId||(this.keyId=mI(r));break;case mr.PLAYREADY:{const s=new Uint8Array([154,4,240,121,152,64,66,134,171,146,230,91,224,136,95,149]);this.pssh=zY(s,null,n),this.keyId=Lj(n);break}default:{let s=n.subarray(0,16);if(s.length!==16){const a=new Uint8Array(16);a.set(s,16-s.length),s=a}this.keyId=s;break}}if(!this.keyId||this.keyId.byteLength!==16){let s;s=V7(r),s||(s=mI(r),s||(s=ul[this.uri])),s&&(this.keyId=s,ya.setKeyIdForUri(this.uri,s))}return this}}function V7(t){const e=t==null?void 0:t[mr.WIDEVINE];return e?e.keyId:null}function mI(t){const e=t==null?void 0:t[mr.PLAYREADY];if(e){const r=Rj(e.uri);if(r)return Lj(r)}return null}function H7(t){const e=new Uint8Array(16);for(let r=12;r<16;r++)e[r]=t>>8*(15-r)&255;return e}const gI=/#EXT-X-STREAM-INF:([^\r\n]*)(?:[\r\n](?:#[^\r\n]*)?)*([^\r\n]+)|#EXT-X-(SESSION-DATA|SESSION-KEY|DEFINE|CONTENT-STEERING|START):([^\r\n]*)[\r\n]+/g,vI=/#EXT-X-MEDIA:(.*)/g,K7=/^#EXT(?:INF|-X-TARGETDURATION):/m,A0=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[^\r\n]*)/.source,/#.*/.source].join("|"),"g"),z7=new RegExp([/#EXT-X-(PROGRAM-DATE-TIME|BYTERANGE|DATERANGE|DEFINE|KEY|MAP|PART|PART-INF|PLAYLIST-TYPE|PRELOAD-HINT|RENDITION-REPORT|SERVER-CONTROL|SKIP|START):(.+)/.source,/#EXT-X-(BITRATE|DISCONTINUITY-SEQUENCE|MEDIA-SEQUENCE|TARGETDURATION|VERSION): *(\d+)/.source,/#EXT-X-(DISCONTINUITY|ENDLIST|GAP|INDEPENDENT-SEGMENTS)/.source,/(#)([^:]*):(.*)/.source,/(#)(.*)(?:.*)\r?\n?/.source].join("|"));class Ci{static findGroup(e,r){for(let n=0;n<e.length;n++){const i=e[n];if(i.id===r)return i}}static resolve(e,r){return _T.buildAbsoluteURL(r,e,{alwaysNormalize:!0})}static isMediaPlaylist(e){return K7.test(e)}static parseMasterPlaylist(e,r){const n=dI(e),i={contentSteering:null,levels:[],playlistParsingError:null,sessionData:null,sessionKeys:null,startTimeOffset:null,variableList:null,hasVariableRefs:n},s=[];if(gI.lastIndex=0,!e.startsWith("#EXTM3U"))return i.playlistParsingError=new Error("no EXTM3U delimiter"),i;let a;for(;(a=gI.exec(e))!=null;)if(a[1]){var o;const c=new St(a[1],i),u=dw(i,a[2]),d={attrs:c,bitrate:c.decimalInteger("BANDWIDTH")||c.decimalInteger("AVERAGE-BANDWIDTH"),name:c.NAME,url:Ci.resolve(u,r)},f=c.decimalResolution("RESOLUTION");f&&(d.width=f.width,d.height=f.height),xI(c.CODECS,d);const h=c["SUPPLEMENTAL-CODECS"];h&&(d.supplemental={},xI(h,d.supplemental)),(o=d.unknownCodecs)!=null&&o.length||s.push(d),i.levels.push(d)}else if(a[3]){const c=a[3],u=a[4];switch(c){case"SESSION-DATA":{const d=new St(u,i),f=d["DATA-ID"];f&&(i.sessionData===null&&(i.sessionData={}),i.sessionData[f]=d);break}case"SESSION-KEY":{const d=yI(u,r,i);d.encrypted&&d.isSupported()?(i.sessionKeys===null&&(i.sessionKeys=[]),i.sessionKeys.push(d)):qe.warn(`[Keys] Ignoring invalid EXT-X-SESSION-KEY tag: "${u}"`);break}case"DEFINE":{{const d=new St(u,i);fI(i,d,r)}break}case"CONTENT-STEERING":{const d=new St(u,i);i.contentSteering={uri:Ci.resolve(d["SERVER-URI"],r),pathwayId:d["PATHWAY-ID"]||"."};break}case"START":{i.startTimeOffset=bI(u);break}}}const l=s.length>0&&s.length<i.levels.length;return i.levels=l?s:i.levels,i.levels.length===0&&(i.playlistParsingError=new Error("no levels found in manifest")),i}static parseMasterPlaylistMedia(e,r,n){let i;const s={},a=n.levels,o={AUDIO:a.map(c=>({id:c.attrs.AUDIO,audioCodec:c.audioCodec})),SUBTITLES:a.map(c=>({id:c.attrs.SUBTITLES,textCodec:c.textCodec})),"CLOSED-CAPTIONS":[]};let l=0;for(vI.lastIndex=0;(i=vI.exec(e))!==null;){const c=new St(i[1],n),u=c.TYPE;if(u){const d=o[u],f=s[u]||[];s[u]=f;const h=c.LANGUAGE,p=c["ASSOC-LANGUAGE"],g=c.CHANNELS,m=c.CHARACTERISTICS,v=c["INSTREAM-ID"],y={attrs:c,bitrate:0,id:l++,groupId:c["GROUP-ID"]||"",name:c.NAME||h||"",type:u,default:c.bool("DEFAULT"),autoselect:c.bool("AUTOSELECT"),forced:c.bool("FORCED"),lang:h,url:c.URI?Ci.resolve(c.URI,r):""};if(p&&(y.assocLang=p),g&&(y.channels=g),m&&(y.characteristics=m),v&&(y.instreamId=v),d!=null&&d.length){const b=Ci.findGroup(d,y.groupId)||d[0];wI(y,b,"audioCodec"),wI(y,b,"textCodec")}f.push(y)}}return s}static parseLevelPlaylist(e,r,n,i,s,a){var o;const l={url:r},c=new F7(r),u=c.fragments,d=[];let f=null,h=0,p=0,g=0,m=0,v=0,y=null,b=new S0(i,l),w,S,T,_=-1,A=!1,P=null,C;if(A0.lastIndex=0,c.m3u8=e,c.hasVariableRefs=dI(e),((o=A0.exec(e))==null?void 0:o[0])!=="#EXTM3U")return c.playlistParsingError=new Error("Missing format identifier #EXTM3U"),c;for(;(w=A0.exec(e))!==null;){A&&(A=!1,b=new S0(i,l),b.playlistOffset=g,b.setStart(g),b.sn=h,b.cc=m,v&&(b.bitrate=v),b.level=n,f&&(b.initSegment=f,f.rawProgramDateTime&&(b.rawProgramDateTime=f.rawProgramDateTime,f.rawProgramDateTime=null),P&&(b.setByteRange(P),P=null)));const L=w[1];if(L){b.duration=parseFloat(L);const j=(" "+w[2]).slice(1);b.title=j||null,b.tagList.push(j?["INF",L,j]:["INF",L])}else if(w[3]){if(se(b.duration)){b.playlistOffset=g,b.setStart(g),T&&EI(b,T,c),b.sn=h,b.level=n,b.cc=m,u.push(b);const j=(" "+w[3]).slice(1);b.relurl=dw(c,j),hw(b,y,d),y=b,g+=b.duration,h++,p=0,A=!0}}
vendor: 49,467 bytes, lines 260-265
260else{if(w=w[0].match(z7),!w){qe.warn("No matches on slow regex match for level playlist!");continue}for(S=1;S<w.length&&w[S]===void 0;S++);const j=(" "+w[S]).slice(1),M=(" "+w[S+1]).slice(1),N=w[S+2]?(" "+w[S+2]).slice(1):null;switch(j){case"BYTERANGE":y?b.setByteRange(M,y):b.setByteRange(M);break;case"PROGRAM-DATE-TIME":b.rawProgramDateTime=M,b.tagList.push(["PROGRAM-DATE-TIME",M]),_===-1&&(_=u.length);break;case"PLAYLIST-TYPE":c.type&&Yi(c,j,w),c.type=M.toUpperCase();break;case"MEDIA-SEQUENCE":c.startSN!==0?Yi(c,j,w):u.length>0&&TI(c,j,w),h=c.startSN=parseInt(M);break;case"SKIP":{c.skippedSegments&&Yi(c,j,w);const k=new St(M,c),$=k.decimalInteger("SKIPPED-SEGMENTS");if(se($)){c.skippedSegments+=$;for(let G=$;G--;)u.push(null);h+=$}const U=k.enumeratedString("RECENTLY-REMOVED-DATERANGES");U&&(c.recentlyRemovedDateranges=(c.recentlyRemovedDateranges||[]).concat(U.split("	")));break}case"TARGETDURATION":c.targetduration!==0&&Yi(c,j,w),c.targetduration=Math.max(parseInt(M),1);break;case"VERSION":c.version!==null&&Yi(c,j,w),c.version=parseInt(M);break;case"INDEPENDENT-SEGMENTS":break;case"ENDLIST":c.live||Yi(c,j,w),c.live=!1;break;case"#":(M||N)&&b.tagList.push(N?[M,N]:[M]);break;case"DISCONTINUITY":m++,b.tagList.push(["DIS"]);break;case"GAP":b.gap=!0,b.tagList.push([j]);break;case"BITRATE":b.tagList.push([j,M]),v=parseInt(M)*1e3,se(v)?b.bitrate=v:v=0;break;case"DATERANGE":{const k=new St(M,c),$=new Cj(k,c.dateRanges[k.ID],c.dateRangeTagCount);c.dateRangeTagCount++,$.isValid||c.skippedSegments?c.dateRanges[$.id]=$:qe.warn(`Ignoring invalid DATERANGE tag: "${M}"`),b.tagList.push(["EXT-X-DATERANGE",M]);break}case"DEFINE":{{const k=new St(M,c);"IMPORT"in k?L7(c,k,a):fI(c,k,r)}break}case"DISCONTINUITY-SEQUENCE":c.startCC!==0?Yi(c,j,w):u.length>0&&TI(c,j,w),c.startCC=m=parseInt(M);break;case"KEY":{const k=yI(M,r,c);if(k.isSupported()){if(k.method==="NONE"){T=void 0;break}T||(T={});const $=T[k.keyFormat];$!=null&&$.matches(k)||($&&(T=et({},T)),T[k.keyFormat]=k)}else qe.warn(`[Keys] Ignoring unsupported EXT-X-KEY tag: "${M}"`);break}case"START":c.startTimeOffset=bI(M);break;case"MAP":{const k=new St(M,c);if(b.duration){const $=new S0(i,l);SI($,k,n,T),f=$,b.initSegment=f,f.rawProgramDateTime&&!b.rawProgramDateTime&&(b.rawProgramDateTime=f.rawProgramDateTime)}else{const $=b.byteRangeEndOffset;if($){const U=b.byteRangeStartOffset;P=`${$-U}@${U}`}else P=null;SI(b,k,n,T),f=b,A=!0}f.cc=m;break}case"SERVER-CONTROL":{C&&Yi(c,j,w),C=new St(M),c.canBlockReload=C.bool("CAN-BLOCK-RELOAD"),c.canSkipUntil=C.optionalFloat("CAN-SKIP-UNTIL",0),c.canSkipDateRanges=c.canSkipUntil>0&&C.bool("CAN-SKIP-DATERANGES"),c.partHoldBack=C.optionalFloat("PART-HOLD-BACK",0),c.holdBack=C.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{c.partTarget&&Yi(c,j,w);const k=new St(M);c.partTarget=k.decimalFloatingPoint("PART-TARGET");break}case"PART":{let k=c.partList;k||(k=c.partList=[]);const $=p>0?k[k.length-1]:void 0,U=p++,G=new St(M,c),B=new LY(G,b,l,U,$);k.push(B),b.duration+=B.duration;break}case"PRELOAD-HINT":{const k=new St(M,c);c.preloadHint=k;break}case"RENDITION-REPORT":{const k=new St(M,c);c.renditionReports=c.renditionReports||[],c.renditionReports.push(k);break}default:qe.warn(`line parsed but not handled: ${w}`);break}}}y&&!y.relurl?(u.pop(),g-=y.duration,c.partList&&(c.fragmentHint=y)):c.partList&&(hw(b,y,d),b.cc=m,c.fragmentHint=b,T&&EI(b,T,c)),c.targetduration||(c.playlistParsingError=new Error("Missing Target Duration"));const O=u.length,R=u[0],D=u[O-1];if(g+=c.skippedSegments*c.targetduration,g>0&&O&&D){c.averagetargetduration=g/O;const L=D.sn;c.endSN=L!=="initSegment"?L:0,c.live||(D.endList=!0),_>0&&(Y7(u,_),R&&d.unshift(R))}return c.fragmentHint&&(g+=c.fragmentHint.duration),c.totalduration=g,d.length&&c.dateRangeTagCount&&R&&Dj(d,c),c.endCC=m,c}}function Dj(t,e){let r=t.length;if(!r)if(e.hasProgramDateTime){const o=e.fragments[e.fragments.length-1];t.push(o),r++}else return;const n=t[r-1],i=e.live?1/0:e.totalduration,s=Object.keys(e.dateRanges);for(let o=s.length;o--;){const l=e.dateRanges[s[o]],c=l.startDate.getTime();l.tagAnchor=n.ref;for(let u=r;u--;){var a;if(((a=t[u])==null?void 0:a.sn)<e.startSN)break;const d=q7(e,c,t,u,i);if(d!==-1){l.tagAnchor=e.fragments[d].ref;break}}}}function q7(t,e,r,n,i){const s=r[n];if(s){const o=s.programDateTime;if(e>=o||n===0){var a;const l=(((a=r[n+1])==null?void 0:a.start)||i)-s.start;if(e<=o+l*1e3){const c=r[n].sn-t.startSN;if(c<0)return-1;const u=t.fragments;if(u.length>r.length){const f=(r[n+1]||u[u.length-1]).sn-t.startSN;for(let h=f;h>c;h--){const p=u[h].programDateTime;if(e>=p&&e<p+u[h].duration*1e3)return h}}return c}}}return-1}function yI(t,e,r){var n,i;const s=new St(t,r),a=(n=s.METHOD)!=null?n:"",o=s.URI,l=s.hexadecimalInteger("IV"),c=s.KEYFORMATVERSIONS,u=(i=s.KEYFORMAT)!=null?i:"identity";o&&s.IV&&!l&&qe.error(`Invalid IV: ${s.IV}`);const d=o?Ci.resolve(o,e):"",f=(c||"1").split("/").map(Number).filter(Number.isFinite);return new ya(a,d,u,f,l,s.KEYID)}function bI(t){const r=new St(t).decimalFloatingPoint("TIME-OFFSET");return se(r)?r:null}function xI(t,e){let r=(t||"").split(/[ ,]+/).filter(n=>n);["video","audio","text"].forEach(n=>{const i=r.filter(s=>IT(s,n));i.length&&(e[`${n}Codec`]=i.map(s=>s.split("/")[0]).join(","),r=r.filter(s=>i.indexOf(s)===-1))}),e.unknownCodecs=r}function wI(t,e,r){const n=e[r];n&&(t[r]=n)}function Y7(t,e){let r=t[e];for(let n=e;n--;){const i=t[n];if(!i)return;i.programDateTime=r.programDateTime-i.duration*1e3,r=i}}function hw(t,e,r){t.rawProgramDateTime?r.push(t):e!=null&&e.programDateTime&&(t.programDateTime=e.endProgramDateTime)}function SI(t,e,r,n){t.relurl=e.URI,e.BYTERANGE&&t.setByteRange(e.BYTERANGE),t.level=r,t.sn="initSegment",n&&(t.levelkeys=n),t.initSegment=null}function EI(t,e,r){t.levelkeys=e;const{encryptedFragments:n}=r;(!n.length||n[n.length-1].levelkeys!==e)&&Object.keys(e).some(i=>e[i].isCommonEncryption)&&n.push(t)}function Yi(t,e,r){t.playlistParsingError=new Error(`#EXT-X-${e} must not appear more than once (${r[0]})`)}function TI(t,e,r){t.playlistParsingError=new Error(`#EXT-X-${e} must appear before the first Media Segment (${r[0]})`)}function P0(t,e){const r=e.startPTS;if(se(r)){let n=0,i;e.sn>t.sn?(n=r-t.start,i=t):(n=t.start-r,i=e),i.duration!==n&&i.setDuration(n)}else e.sn>t.sn?t.cc===e.cc&&t.minEndPTS?e.setStart(t.start+(t.minEndPTS-t.start)):e.setStart(t.start+t.duration):e.setStart(Math.max(t.start-e.duration,0))}function Nj(t,e,r,n,i,s,a){n-r<=0&&(a.warn("Fragment should have a positive duration",e),n=r+e.duration,s=i+e.duration);let l=r,c=n;const u=e.startPTS,d=e.endPTS;if(se(u)){const v=Math.abs(u-r);t&&v>t.totalduration?a.warn(`media timestamps and playlist times differ by ${v}s for level ${e.level} ${t.url}`):se(e.deltaPTS)?e.deltaPTS=Math.max(v,e.deltaPTS):e.deltaPTS=v,l=Math.max(r,u),r=Math.min(r,u),i=e.startDTS!==void 0?Math.min(i,e.startDTS):i,c=Math.min(n,d),n=Math.max(n,d),s=e.endDTS!==void 0?Math.max(s,e.endDTS):s}const f=r-e.start;e.start!==0&&e.setStart(r),e.setDuration(n-e.start),e.startPTS=r,e.maxStartPTS=l,e.startDTS=i,e.endPTS=n,e.minEndPTS=c,e.endDTS=s;const h=e.sn;if(!t||h<t.startSN||h>t.endSN)return 0;let p;const g=h-t.startSN,m=t.fragments;for(m[g]=e,p=g;p>0;p--)P0(m[p],m[p-1]);for(p=g;p<m.length-1;p++)P0(m[p],m[p+1]);return t.fragmentHint&&P0(m[m.length-1],t.fragmentHint),t.PTSKnown=t.alignedSliding=!0,f}function X7(t,e,r){if(t===e)return;let n=null;const i=t.fragments;for(let u=i.length-1;u>=0;u--){const d=i[u].initSegment;if(d){n=d;break}}t.fragmentHint&&delete t.fragmentHint.endPTS;let s;Z7(t,e,(u,d,f,h)=>{if((!e.startCC||e.skippedSegments)&&d.cc!==u.cc){const p=u.cc-d.cc;for(let g=f;g<h.length;g++)h[g].cc+=p;e.endCC=h[h.length-1].cc}se(u.startPTS)&&se(u.endPTS)&&(d.setStart(d.startPTS=u.startPTS),d.startDTS=u.startDTS,d.maxStartPTS=u.maxStartPTS,d.endPTS=u.endPTS,d.endDTS=u.endDTS,d.minEndPTS=u.minEndPTS,d.setDuration(u.endPTS-u.startPTS),d.duration&&(s=d),e.PTSKnown=e.alignedSliding=!0),u.hasStreams&&(d.elementaryStreams=u.elementaryStreams),d.loader=u.loader,u.hasStats&&(d.stats=u.stats),u.initSegment&&(d.initSegment=u.initSegment,n=u.initSegment)});const a=e.fragments,o=e.fragmentHint?a.concat(e.fragmentHint):a;if(n&&o.forEach(u=>{var d;u&&(!u.initSegment||u.initSegment.relurl===((d=n)==null?void 0:d.relurl))&&(u.initSegment=n)}),e.skippedSegments){if(e.deltaUpdateFailed=a.some(u=>!u),e.deltaUpdateFailed){r.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(let u=e.skippedSegments;u--;)a.shift();e.startSN=a[0].sn}else{e.canSkipDateRanges&&(e.dateRanges=Q7(t.dateRanges,e,r));const u=t.fragments.filter(d=>d.rawProgramDateTime);if(t.hasProgramDateTime&&!e.hasProgramDateTime)for(let d=1;d<o.length;d++)o[d].programDateTime===null&&hw(o[d],o[d-1],u);Dj(u,e)}e.endCC=a[a.length-1].cc}if(!e.startCC){var l;const u=jj(t,e.startSN-1);e.startCC=(l=u==null?void 0:u.cc)!=null?l:a[0].cc}J7(t.partList,e.partList,(u,d)=>{d.elementaryStreams=u.elementaryStreams,d.stats=u.stats}),s?Nj(e,s,s.startPTS,s.endPTS,s.startDTS,s.endDTS,r):Mj(t,e),a.length&&(e.totalduration=e.edge-a[0].start),e.driftStartTime=t.driftStartTime,e.driftStart=t.driftStart;const c=e.advancedDateTime;if(e.advanced&&c){const u=e.edge;e.driftStart||(e.driftStartTime=c,e.driftStart=u),e.driftEndTime=c,e.driftEnd=u}else e.driftEndTime=t.driftEndTime,e.driftEnd=t.driftEnd,e.advancedDateTime=t.advancedDateTime;e.requestScheduled===-1&&(e.requestScheduled=t.requestScheduled)}function Q7(t,e,r){const{dateRanges:n,recentlyRemovedDateranges:i}=e,s=et({},t);i&&i.forEach(l=>{delete s[l]});const o=Object.keys(s).length;return o?(Object.keys(n).forEach(l=>{const c=s[l],u=new Cj(n[l].attr,c);u.isValid?(s[l]=u,c||(u.tagOrder+=o)):r.warn(`Ignoring invalid Playlist Delta Update DATERANGE tag: "${it(n[l].attr)}"`)}),s):n}function J7(t,e,r){if(t&&e){let n=0;for(let i=0,s=t.length;i<=s;i++){const a=t[i],o=e[i+n];a&&o&&a.index===o.index&&a.fragment.sn===o.fragment.sn?r(a,o):n--}}}function Z7(t,e,r){const n=e.skippedSegments,i=Math.max(t.startSN,e.startSN)-e.startSN,s=(t.fragmentHint?1:0)+(n?e.endSN:Math.min(t.endSN,e.endSN))-e.startSN,a=e.startSN-t.startSN,o=e.fragmentHint?e.fragments.concat(e.fragmentHint):e.fragments,l=t.fragmentHint?t.fragments.concat(t.fragmentHint):t.fragments;for(let c=i;c<=s;c++){const u=l[a+c];let d=o[c];if(n&&!d&&u&&(d=e.fragments[c]=u),u&&d){r(u,d,c,o);const f=u.relurl,h=d.relurl;if(f&&eX(f,h)){e.playlistParsingError=_I(`media sequence mismatch ${d.sn}:`,t,e,u,d);return}else if(u.cc!==d.cc){e.playlistParsingError=_I(`discontinuity sequence mismatch (${u.cc}!=${d.cc})`,t,e,u,d);return}}}}function _I(t,e,r,n,i){return new Error(`${t} ${i.url}
261Playlist starting @${e.startSN}
262${e.m3u8}
263
264Playlist starting @${r.startSN}
265${r.m3u8}`)}function Mj(t,e,r=!0){const n=e.startSN+e.skippedSegments-t.startSN,i=t.fragments,s=n>=0;let a=0;if(s&&n<i.length)a=i[n].start;else if(s&&e.startSN===t.endSN+1)a=t.fragmentEnd;else if(s&&r)a=t.fragmentStart+n*e.levelTargetDuration;else if(!e.skippedSegments&&e.fragmentStart===0)a=t.fragmentStart;else return;pw(e,a)}function pw(t,e){if(e){const r=t.fragments;for(let n=t.skippedSegments;n<r.length;n++)r[n].addStart(e);t.fragmentHint&&t.fragmentHint.addStart(e)}}function $j(t,e=1/0){let r=1e3*t.targetduration;if(t.updated){const n=t.fragments;if(n.length&&r*4>e){const s=n[n.length-1].duration*1e3;s<r&&(r=s)}}else r/=2;return Math.round(r)}function jj(t,e,r){if(!t)return null;let n=t.fragments[e-t.startSN];return n||(n=t.fragmentHint,n&&n.sn===e)?n:e<t.startSN&&r&&r.sn===e?r:null}function AI(t,e,r){return t?Fj(t.partList,e,r):null}function Fj(t,e,r){if(t)for(let n=t.length;n--;){const i=t[n];if(i.index===r&&i.fragment.sn===e)return i}return null}function Bj(t){t.forEach((e,r)=>{var n;(n=e.details)==null||n.fragments.forEach(i=>{i.level=r,i.initSegment&&(i.initSegment.level=r)})})}function eX(t,e){return t!==e&&e?PI(t)!==PI(e):!1}function PI(t){return t.replace(/\?[^?]*$/,"")}function md(t,e){for(let n=0,i=t.length;n<i;n++){var r;if(((r=t[n])==null?void 0:r.cc)===e)return t[n]}return null}function tX(t,e){return!!(t&&e.startCC<t.endCC&&e.endCC>t.startCC)}function II(t,e){const r=t.start+e;t.startPTS=r,t.setStart(r),t.endPTS=r+t.duration}function Uj(t,e){const r=e.fragments;for(let n=0,i=r.length;n<i;n++)II(r[n],t);e.fragmentHint&&II(e.fragmentHint,t),e.alignedSliding=!0}function rX(t,e){t&&(Gj(e,t),e.alignedSliding||Wm(e,t),!e.alignedSliding&&!e.skippedSegments&&Mj(t,e,!1))}function Gj(t,e){if(!tX(e,t))return;const r=Math.min(e.endCC,t.endCC),n=md(e.fragments,r),i=md(t.fragments,r);if(!n||!i)return;qe.log(`Aligning playlist at start of dicontinuity sequence ${r}`);const s=n.start-i.start;Uj(s,t)}function Wm(t,e){if(!t.hasProgramDateTime||!e.hasProgramDateTime)return;const r=t.fragments,n=e.fragments;if(!r.length||!n.length)return;let i,s;const a=Math.min(e.endCC,t.endCC);e.startCC<a&&t.startCC<a&&(i=md(n,a),s=md(r,a)),(!i||!s)&&(i=n[Math.floor(n.length/2)],s=md(r,i.cc)||r[Math.floor(r.length/2)]);const o=i.programDateTime,l=s.programDateTime;if(!o||!l)return;const c=(l-o)/1e3-(s.start-i.start);Uj(c,t)}function kr(t,e,r){Gr(t,e,r),t.addEventListener(e,r)}function Gr(t,e,r){t.removeEventListener(e,r)}const nX={toString:function(t){let e="";const r=t.length;for(let n=0;n<r;n++)e+=`[${t.start(n).toFixed(3)}-${t.end(n).toFixed(3)}]`;return e}},Q={STOPPED:"STOPPED",IDLE:"IDLE",KEY_LOADING:"KEY_LOADING",FRAG_LOADING:"FRAG_LOADING",FRAG_LOADING_WAITING_RETRY:"FRAG_LOADING_WAITING_RETRY",WAITING_TRACK:"WAITING_TRACK",PARSING:"PARSING",PARSED:"PARSED",ENDED:"ENDED",ERROR:"ERROR",WAITING_INIT_PTS:"WAITING_INIT_PTS",WAITING_LEVEL:"WAITING_LEVEL"};class NT extends Pj{constructor(e,r,n,i,s){super(i,e.logger),this.hls=void 0,this.fragPrevious=null,this.fragCurrent=null,this.fragmentTracker=void 0,this.transmuxer=null,this._state=Q.STOPPED,this.playlistType=void 0,this.media=null,this.mediaBuffer=null,this.config=void 0,this.bitrateTest=!1,this.lastCurrentTime=0,this.nextLoadPosition=0,this.startPosition=0,this.startTimeOffset=null,this.retryDate=0,this.levels=null,this.fragmentLoader=void 0,this.keyLoader=void 0,this.levelLastLoaded=null,this.startFragRequested=!1,this.decrypter=void 0,this.initPTS=[],this.buffering=!0,this.loadingParts=!1,this.loopSn=void 0,this.onMediaSeeking=()=>{const{config:a,fragCurrent:o,media:l,mediaBuffer:c,state:u}=this,d=l?l.currentTime:0,f=Se.bufferInfo(c||l,d,a.maxBufferHole),h=!f.len;if(this.log(`Media seeking to ${se(d)?d.toFixed(3):d}, state: ${u}, ${h?"out of":"in"} buffer`),this.state===Q.ENDED)this.resetLoadingState();else if(o){const p=a.maxFragLookUpTolerance,g=o.start-p,m=o.start+o.duration+p;if(h||m<f.start||g>f.end){const v=d>m;(d<g||v)&&(v&&o.loader&&(this.log(`Cancelling fragment load for seek (sn: ${o.sn})`),o.abortRequests(),this.resetLoadingState()),this.fragPrevious=null)}}if(l){this.fragmentTracker.removeFragmentsInRange(d,1/0,this.playlistType,!0);const p=this.lastCurrentTime;if(d>p&&(this.lastCurrentTime=d),!this.loadingParts){const g=Math.max(f.end,d),m=this.shouldLoadParts(this.getLevelDetails(),g);m&&(this.log(`LL-Part loading ON after seeking to ${d.toFixed(2)} with buffer @${g.toFixed(2)}`),this.loadingParts=m)}}this.hls.hasEnoughToStart||(this.log(`Setting ${h?"startPosition":"nextLoadPosition"} to ${d} for seek without enough to start`),this.nextLoadPosition=d,h&&(this.startPosition=d)),h&&this.state===Q.IDLE&&this.tickImmediate()},this.onMediaEnded=()=>{this.log("setting startPosition to 0 because media ended"),this.startPosition=this.lastCurrentTime=0},this.playlistType=s,this.hls=e,this.fragmentLoader=new R7(e.config),this.keyLoader=n,this.fragmentTracker=r,this.config=e.config,this.decrypter=new RT(e.config)}registerListeners(){const{hls:e}=this;e.on(I.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(I.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(I.MANIFEST_LOADING,this.onManifestLoading,this),e.on(I.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(I.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(I.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(I.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(I.MANIFEST_LOADING,this.onManifestLoading,this),e.off(I.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(I.ERROR,this.onError,this)}doTick(){this.onTickEnd()}onTickEnd(){}startLoad(e){}stopLoad(){if(this.state===Q.STOPPED)return;this.fragmentLoader.abort(),this.keyLoader.abort(this.playlistType);const e=this.fragCurrent;e!=null&&e.loader&&(e.abortRequests(),this.fragmentTracker.removeFragment(e)),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=Q.STOPPED}get startPositionValue(){const{nextLoadPosition:e,startPosition:r}=this;return r===-1&&e?e:r}get bufferingEnabled(){return this.buffering}pauseBuffering(){this.buffering=!1}resumeBuffering(){this.buffering=!0}get inFlightFrag(){return{frag:this.fragCurrent,state:this.state}}_streamEnded(e,r){if(r.live||!this.media)return!1;const n=e.end||0,i=this.config.timelineOffset||0;if(n<=i)return!1;const s=e.buffered;this.config.maxBufferHole&&s&&s.length>1&&(e=Se.bufferedInfo(s,e.start,0));const a=e.nextStart;if(a&&a>i&&a<r.edge||this.media.currentTime<e.start)return!1;const l=r.partList;if(l!=null&&l.length){const u=l[l.length-1];return Se.isBuffered(this.media,u.start+u.duration/2)}const c=r.fragments[r.fragments.length-1].type;return this.fragmentTracker.isEndListAppended(c)}getLevelDetails(){if(this.levels&&this.levelLastLoaded!==null)return this.levelLastLoaded.details}get timelineOffset(){const e=this.config.timelineOffset;if(e){var r;return((r=this.getLevelDetails())==null?void 0:r.appliedTimelineOffset)||e}return 0}onMediaAttached(e,r){const n=this.media=this.mediaBuffer=r.media;kr(n,"seeking",this.onMediaSeeking),kr(n,"ended",this.onMediaEnded);const i=this.config;this.levels&&i.autoStartLoad&&this.state===Q.STOPPED&&this.startLoad(i.startPosition)}onMediaDetaching(e,r){const n=!!r.transferMedia,i=this.media;if(i!==null){if(i.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),Gr(i,"seeking",this.onMediaSeeking),Gr(i,"ended",this.onMediaEnded),this.keyLoader&&!n&&this.keyLoader.detach(),this.media=this.mediaBuffer=null,this.loopSn=void 0,n){this.resetLoadingState(),this.resetTransmuxer();return}this.loadingParts=!1,this.fragmentTracker.removeAllFragments(),this.stopLoad()}}onManifestLoading(){this.initPTS=[],this.levels=this.levelLastLoaded=this.fragCurrent=null,this.lastCurrentTime=this.startPosition=0,this.startFragRequested=!1}onError(e,r){}onManifestLoaded(e,r){this.startTimeOffset=r.startTimeOffset}onHandlerDestroying(){this.stopLoad(),this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null),super.onHandlerDestroying(),this.hls=this.onMediaSeeking=this.onMediaEnded=null}onHandlerDestroyed(){this.state=Q.STOPPED,this.fragmentLoader&&this.fragmentLoader.destroy(),this.keyLoader&&this.keyLoader.destroy(),this.decrypter&&this.decrypter.destroy(),this.hls=this.log=this.warn=this.decrypter=this.keyLoader=this.fragmentLoader=this.fragmentTracker=null,super.onHandlerDestroyed()}loadFragment(e,r,n){this.startFragRequested=!0,this._loadFragForPlayback(e,r,n)}_loadFragForPlayback(e,r,n){const i=s=>{const a=s.frag;if(this.fragContextChanged(a)){this.warn(`${a.type} sn: ${a.sn}${s.part?" part: "+s.part.index:""} of ${this.fragInfo(a,!1,s.part)}) was dropped during download.`),this.fragmentTracker.removeFragment(a);return}a.stats.chunkCount++,this._handleFragmentLoadProgress(s)};this._doFragLoad(e,r,n,i).then(s=>{if(!s)return;const a=this.state,o=s.frag;if(this.fragContextChanged(o)){(a===Q.FRAG_LOADING||!this.fragCurrent&&a===Q.PARSING)&&(this.fragmentTracker.removeFragment(o),this.state=Q.IDLE);return}"payload"in s&&(this.log(`Loaded ${o.type} sn: ${o.sn} of ${this.playlistLabel()} ${o.level}`),this.hls.trigger(I.FRAG_LOADED,s)),this._handleFragmentLoadComplete(s)}).catch(s=>{this.state===Q.STOPPED||this.state===Q.ERROR||(this.warn(`Frag error: ${(s==null?void 0:s.message)||s}`),this.resetFragmentLoading(e))})}clearTrackerIfNeeded(e){var r;const{fragmentTracker:n}=this;if(n.getState(e)===qt.APPENDING){const s=e.type,a=this.getFwdBufferInfo(this.mediaBuffer,s),o=Math.max(e.duration,a?a.len:this.config.maxBufferLength),l=this.backtrackFragment;((l?e.sn-l.sn:0)===1||this.reduceMaxBufferLength(o,e.duration))&&n.removeFragment(e)}else((r=this.mediaBuffer)==null?void 0:r.buffered.length)===0?n.removeAllFragments():n.hasParts(e.type)&&(n.detectPartialFragments({frag:e,part:null,stats:e.stats,id:e.type}),n.getState(e)===qt.PARTIAL&&n.removeFragment(e))}checkLiveUpdate(e){if(e.updated&&!e.live){const r=e.fragments[e.fragments.length-1];this.fragmentTracker.detectPartialFragments({frag:r,part:null,stats:r.stats,id:r.type})}e.fragments[0]||(e.deltaUpdateFailed=!0)}waitForLive(e){const r=e.details;return(r==null?void 0:r.live)&&r.type!=="EVENT"&&(this.levelLastLoaded!==e||r.expired)}flushMainBuffer(e,r,n=null){if(!(e-r))return;const i={startOffset:e,endOffset:r,type:n};this.hls.trigger(I.BUFFER_FLUSHING,i)}_loadInitSegment(e,r){this._doFragLoad(e,r).then(n=>{const i=n==null?void 0:n.frag;if(!i||this.fragContextChanged(i)||!this.levels)throw new Error("init load aborted");return n}).then(n=>{const{hls:i}=this,{frag:s,payload:a}=n,o=s.decryptdata;if(a&&a.byteLength>0&&o!=null&&o.key&&o.iv&&Jl(o.method)){const l=self.performance.now();return this.decrypter.decrypt(new Uint8Array(a),o.key.buffer,o.iv.buffer,LT(o.method)).catch(c=>{throw i.trigger(I.ERROR,{type:fe.MEDIA_ERROR,details:V.FRAG_DECRYPT_ERROR,fatal:!1,error:c,reason:c.message,frag:s}),c}).then(c=>{const u=self.performance.now();return i.trigger(I.FRAG_DECRYPTED,{frag:s,payload:c,stats:{tstart:l,tdecrypt:u}}),n.payload=c,this.completeInitSegmentLoad(n)})}return this.completeInitSegmentLoad(n)}).catch(n=>{this.state===Q.STOPPED||this.state===Q.ERROR||(this.warn(n),this.resetFragmentLoading(e))})}completeInitSegmentLoad(e){const{levels:r}=this;if(!r)throw new Error("init load aborted, missing levels");const n=e.frag.stats;this.state!==Q.STOPPED&&(this.state=Q.IDLE),e.frag.data=new Uint8Array(e.payload),n.parsing.start=n.buffering.start=self.performance.now(),n.parsing.end=n.buffering.end=self.performance.now(),this.tick()}unhandledEncryptionError(e,r){var n,i;const s=e.tracks;if(s&&!r.encrypted&&((n=s.audio)!=null&&n.encrypted||(i=s.video)!=null&&i.encrypted)&&(!this.config.emeEnabled||!this.keyLoader.emeController)){const a=this.media,o=new Error(`Encrypted track with no key in ${this.fragInfo(r)} (media ${a?"attached mediaKeys: "+a.mediaKeys:"detached"})`);return this.warn(o.message),!a||a.mediaKeys?!1:(this.hls.trigger(I.ERROR,{type:fe.KEY_SYSTEM_ERROR,details:V.KEY_SYSTEM_NO_KEYS,fatal:!1,error:o,frag:r}),this.resetTransmuxer(),!0)}return!1}fragContextChanged(e){const{fragCurrent:r}=this;return!e||!r||e.sn!==r.sn||e.level!==r.level}fragBufferedComplete(e,r){const n=this.mediaBuffer?this.mediaBuffer:this.media;if(this.log(`Buffered ${e.type} sn: ${e.sn}${r?" part: "+r.index:""} of ${this.fragInfo(e,!1,r)} > buffer:${n?nX.toString(Se.getBuffered(n)):"(detached)"})`),Nt(e)){var i;if(e.type!==oe.SUBTITLE){const a=e.elementaryStreams;if(!Object.keys(a).some(o=>!!a[o])){this.state=Q.IDLE;return}}const s=(i=this.levels)==null?void 0:i[e.level];s!=null&&s.fragmentError&&(this.log(`Resetting level fragment error count of ${s.fragmentError} on frag buffered`),s.fragmentError=0)}this.state=Q.IDLE}_handleFragmentLoadComplete(e){const{transmuxer:r}=this;if(!r)return;const{frag:n,part:i,partsLoaded:s}=e,a=!s||s.length===0||s.some(l=>!l),o=new kT(n.level,n.sn,n.stats.chunkCount+1,0,i?i.index:-1,!a);r.flush(o)}_handleFragmentLoadProgress(e){}_doFragLoad(e,r,n=null,i){var s;this.fragCurrent=e;const a=r.details;if(!this.levels||!a)throw new Error(`frag load aborted, missing level${a?"":" detail"}s`);let o=null;if(e.encrypted&&!((s=e.decryptdata)!=null&&s.key)){if(this.log(`Loading key for ${e.sn} of [${a.startSN}-${a.endSN}], ${this.playlistLabel()} ${e.level}`),this.state=Q.KEY_LOADING,this.fragCurrent=e,o=this.keyLoader.load(e).then(f=>{if(!this.fragContextChanged(f.frag))return this.hls.trigger(I.KEY_LOADED,f),this.state===Q.KEY_LOADING&&(this.state=Q.IDLE),f}),this.hls.trigger(I.KEY_LOADING,{frag:e}),this.fragCurrent===null)return this.log("context changed in KEY_LOADING"),Promise.resolve(null)}else e.encrypted||(o=this.keyLoader.loadClear(e,a.encryptedFragments,this.startFragRequested),o&&this.log("[eme] blocking frag load until media-keys acquired"));const l=this.fragPrevious;if(Nt(e)&&(!l||e.sn!==l.sn)){const f=this.shouldLoadParts(r.details,e.end);f!==this.loadingParts&&(this.log(`LL-Part loading ${f?"ON":"OFF"} loading sn ${l==null?void 0:l.sn}->${e.sn}`),this.loadingParts=f)}if(n=Math.max(e.start,n||0),this.loadingParts&&Nt(e)){const f=a.partList;if(f&&i){n>a.fragmentEnd&&a.fragmentHint&&(e=a.fragmentHint);const h=this.getNextPart(f,e,n);if(h>-1){const p=f[h];e=this.fragCurrent=p.fragment,this.log(`Loading ${e.type} sn: ${e.sn} part: ${p.index} (${h}/${f.length-1}) of ${this.fragInfo(e,!1,p)}) cc: ${e.cc} [${a.startSN}-${a.endSN}], target: ${parseFloat(n.toFixed(3))}`),this.nextLoadPosition=p.start+p.duration,this.state=Q.FRAG_LOADING;let g;return o?g=o.then(m=>!m||this.fragContextChanged(m.frag)?null:this.doFragPartsLoad(e,p,r,i)).catch(m=>this.handleFragLoadError(m)):g=this.doFragPartsLoad(e,p,r,i).catch(m=>this.handleFragLoadError(m)),this.hls.trigger(I.FRAG_LOADING,{frag:e,part:p,targetBufferTime:n}),this.fragCurrent===null?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING parts")):g}else if(!e.url||this.loadedEndOfParts(f,n))return Promise.resolve(null)}}if(Nt(e)&&this.loadingParts){var c;this.log(`LL-Part loading OFF after next part miss @${n.toFixed(2)} Check buffer at sn: ${e.sn} loaded parts: ${(c=a.partList)==null?void 0:c.filter(f=>f.loaded).map(f=>`[${f.start}-${f.end}]`)}`),this.loadingParts=!1}else if(!e.url)return Promise.resolve(null);this.log(`Loading ${e.type} sn: ${e.sn} of ${this.fragInfo(e,!1)}) cc: ${e.cc} ${"["+a.startSN+"-"+a.endSN+"]"}, target: ${parseFloat(n.toFixed(3))}`),se(e.sn)&&!this.bitrateTest&&(this.nextLoadPosition=e.start+e.duration),this.state=Q.FRAG_LOADING;const u=this.config.progressive&&e.type!==oe.SUBTITLE;let d;return u&&o?d=o.then(f=>!f||this.fragContextChanged(f.frag)?null:this.fragmentLoader.load(e,i)).catch(f=>this.handleFragLoadError(f)):d=Promise.all([this.fragmentLoader.load(e,u?i:void 0),o]).then(([f])=>(!u&&i&&i(f),f)).catch(f=>this.handleFragLoadError(f)),this.hls.trigger(I.FRAG_LOADING,{frag:e,targetBufferTime:n}),this.fragCurrent===null?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING")):d}doFragPartsLoad(e,r,n,i){return new Promise((s,a)=>{var o;const l=[],c=(o=n.details)==null?void 0:o.partList,u=d=>{this.fragmentLoader.loadPart(e,d,i).then(f=>{l[d.index]=f;const h=f.part;this.hls.trigger(I.FRAG_LOADED,f);const p=AI(n.details,e.sn,d.index+1)||Fj(c,e.sn,d.index+1);if(p)u(p);else return s({frag:e,part:h,partsLoaded:l})}).catch(a)};u(r)})}handleFragLoadError(e){if("data"in e){const r=e.data;r.frag&&r.details===V.INTERNAL_ABORTED?this.handleFragLoadAborted(r.frag,r.part):r.frag&&r.type===fe.KEY_SYSTEM_ERROR?(r.frag.abortRequests(),this.resetStartWhenNotLoaded(),this.resetFragmentLoading(r.frag)):this.hls.trigger(I.ERROR,r)}else this.hls.trigger(I.ERROR,{type:fe.OTHER_ERROR,details:V.INTERNAL_EXCEPTION,err:e,error:e,fatal:!0});return null}_handleTransmuxerFlush(e){const r=this.getCurrentContext(e);if(!r||this.state!==Q.PARSING){!this.fragCurrent&&this.state!==Q.STOPPED&&this.state!==Q.ERROR&&(this.state=Q.IDLE);return}const{frag:n,part:i,level:s}=r,a=self.performance.now();n.stats.parsing.end=a,i&&(i.stats.parsing.end=a);const o=this.getLevelDetails(),c=o&&n.sn>o.endSN||this.shouldLoadParts(o,n.end);c!==this.loadingParts&&(this.log(`LL-Part loading ${c?"ON":"OFF"} after parsing segment ending @${n.end.toFixed(2)}`),this.loadingParts=c),this.updateLevelTiming(n,i,s,e.partial)}shouldLoadParts(e,r){if(this.config.lowLatencyMode){if(!e)return this.loadingParts;if(e.partList){var n;const s=e.partList[0];if(s.fragment.type===oe.SUBTITLE)return!1;const a=s.end+(((n=e.fragmentHint)==null?void 0:n.duration)||0);if(r>=a){var i;if((this.hls.hasEnoughToStart?((i=this.media)==null?void 0:i.currentTime)||this.lastCurrentTime:this.getLoadPosition())>s.start-s.fragment.duration)return!0}}}return!1}getCurrentContext(e){const{levels:r,fragCurrent:n}=this,{level:i,sn:s,part:a}=e;if(!(r!=null&&r[i]))return this.warn(`Levels object was unset while buffering fragment ${s} of ${this.playlistLabel()} ${i}. The current chunk will not be buffered.`),null;const o=r[i],l=o.details,c=a>-1?AI(l,s,a):null,u=c?c.fragment:jj(l,s,n);return u?(n&&n!==u&&(u.stats=n.stats),{frag:u,part:c,level:o}):null}bufferFragmentData(e,r,n,i,s){if(this.state!==Q.PARSING)return;const{data1:a,data2:o}=e;let l=a;if(o&&(l=kn(a,o)),!l.length)return;const c=this.initPTS[r.cc],u=c?-c.baseTime/c.timescale:void 0,d={type:e.type,frag:r,part:n,chunkMeta:i,offset:u,parent:r.type,data:l};if(this.hls.trigger(I.BUFFER_APPENDING,d),e.dropped&&e.independent&&!n){if(s)return;this.flushBufferGap(r)}}flushBufferGap(e){const r=this.media;if(!r)return;if(!Se.isBuffered(r,r.currentTime)){this.flushMainBuffer(0,e.start);return}const n=r.currentTime,i=Se.bufferInfo(r,n,0),s=e.duration,a=Math.min(this.config.maxFragLookUpTolerance*2,s*.25),o=Math.max(Math.min(e.start-a,i.end-a),n+a);e.start-o>a&&this.flushMainBuffer(o,e.start)}getFwdBufferInfo(e,r){var n;const i=this.getLoadPosition();if(!se(i))return null;const a=this.lastCurrentTime>i||(n=this.media)!=null&&n.paused?0:this.config.maxBufferHole;return this.getFwdBufferInfoAtPos(e,i,r,a)}getFwdBufferInfoAtPos(e,r,n,i){const s=Se.bufferInfo(e,r,i);if(s.len===0&&s.nextStart!==void 0){const a=this.fragmentTracker.getBufferedFrag(r,n);if(a&&(s.nextStart<=a.end||a.gap)){const o=Math.max(Math.min(s.nextStart,a.end)-r,i);return Se.bufferInfo(e,r,o)}}return s}getMaxBufferLength(e){const{config:r}=this;let n;return e?n=Math.max(8*r.maxBufferSize/e,r.maxBufferLength):n=r.maxBufferLength,Math.min(n,r.maxMaxBufferLength)}reduceMaxBufferLength(e,r){const n=this.config,i=Math.max(Math.min(e-r,n.maxBufferLength),r),s=Math.max(e-r*3,n.maxMaxBufferLength/2,i);return s>=i?(n.maxMaxBufferLength=s,this.warn(`Reduce max buffer length to ${s}s`),!0):!1}getAppendedFrag(e,r=oe.MAIN){const n=this.fragmentTracker?this.fragmentTracker.getAppendedFrag(e,r):null;return n&&"fragment"in n?n.fragment:n}getNextFragment(e,r){const n=r.fragments,i=n.length;if(!i)return null;const{config:s}=this,a=n[0].start,o=s.lowLatencyMode&&!!r.partList;let l=null;if(r.live){const d=s.initialLiveManifestSize;if(i<d)return this.warn(`Not enough fragments to start playback (have: ${i}, need: ${d})`),null;if(!r.PTSKnown&&!this.startFragRequested&&this.startPosition===-1||e<a){var c;o&&!this.loadingParts&&(this.log("LL-Part loading ON for initial live fragment"),this.loadingParts=!0),l=this.getInitialLiveFragment(r);const f=this.hls.startPosition,h=this.hls.liveSyncPosition,p=l?(f!==-1&&f>=a?f:h)||l.start:e;this.log(`Setting startPosition to ${p} to match start frag at live edge. mainStart: ${f} liveSyncPosition: ${h} frag.start: ${(c=l)==null?void 0:c.start}`),this.startPosition=this.nextLoadPosition=p}}else e<=a&&(l=n[0]);if(!l){const d=this.loadingParts?r.partEnd:r.fragmentEnd;l=this.getFragmentAtPosition(e,d,r)}let u=this.filterReplacedPrimary(l,r);if(!u&&l){const d=l.sn-r.startSN;u=this.filterReplacedPrimary(n[d+1]||null,r)}return this.mapToInitFragWhenRequired(u)}isLoopLoading(e,r){const n=this.fragmentTracker.getState(e);return(n===qt.OK||n===qt.PARTIAL&&!!e.gap)&&this.nextLoadPosition>r}getNextFragmentLoopLoading(e,r,n,i,s){let a=null;if(e.gap&&(a=this.getNextFragment(this.nextLoadPosition,r),a&&!a.gap&&n.nextStart)){const o=this.getFwdBufferInfoAtPos(this.mediaBuffer?this.mediaBuffer:this.media,n.nextStart,i,0);if(o!==null&&n.len+o.len>=s){const l=a.sn;return this.loopSn!==l&&(this.log(`buffer full after gaps in "${i}" playlist starting at sn: ${l}`),this.loopSn=l),null}}return this.loopSn=void 0,a}get primaryPrefetch(){if(CI(this.config)){var e;if((e=this.hls.interstitialsManager)==null||(e=e.playingItem)==null?void 0:e.event)return!0}return!1}filterReplacedPrimary(e,r){if(!e)return e;if(CI(this.config)&&e.type!==oe.SUBTITLE){const n=this.hls.interstitialsManager,i=n==null?void 0:n.bufferingItem;if(i){const a=i.event;if(a){if(a.appendInPlace||Math.abs(e.start-i.start)>1||i.start===0)return null}else if(e.end<=i.start&&(r==null?void 0:r.live)===!1||e.start>i.end&&i.nextEvent&&(i.nextEvent.appendInPlace||e.start-i.end>1))return null}const s=n==null?void 0:n.playerQueue;if(s)for(let a=s.length;a--;){const o=s[a].interstitial;if(o.appendInPlace&&e.start>=o.startTime&&e.end<=o.resumeTime)return null}}return e}mapToInitFragWhenRequired(e){return e!=null&&e.initSegment&&!e.initSegment.data&&!this.bitrateTest?e.initSegment:e}getNextPart(e,r,n){let i=-1,s=!1,a=!0;for(let o=0,l=e.length;o<l;o++){const c=e[o];if(a=a&&!c.independent,i>-1&&n<c.start)break;const u=c.loaded;u?i=-1:(s||(c.independent||a)&&c.fragment===r)&&(c.fragment!==r&&this.warn(`Need buffer at ${n} but next unloaded part starts at ${c.start}`),i=o),s=u}return i}loadedEndOfParts(e,r){let n;for(let i=e.length;i--;){if(n=e[i],!n.loaded)return!1;if(r>n.start)return!0}return!1}getInitialLiveFragment(e){const r=e.fragments,n=this.fragPrevious;let i=null;if(n){if(e.hasProgramDateTime&&(this.log(`Live playlist, switching playlist, load frag with same PDT: ${n.programDateTime}`),i=b7(r,n.endProgramDateTime,this.config.maxFragLookUpTolerance)),!i){const s=n.sn+1;if(s>=e.startSN&&s<=e.endSN){const a=r[s-e.startSN];n.cc===a.cc&&(i=a,this.log(`Live playlist, switching playlist, load frag with next SN: ${i.sn}`))}i||(i=Tj(e,n.cc,n.end),i&&this.log(`Live playlist, switching playlist, load frag with same CC: ${i.sn}`))}}else{const s=this.hls.liveSyncPosition;s!==null&&(i=this.getFragmentAtPosition(s,this.bitrateTest?e.fragmentEnd:e.edge,e))}return i}getFragmentAtPosition(e,r,n){const{config:i}=this;let{fragPrevious:s}=this,{fragments:a,endSN:o}=n;const{fragmentHint:l}=n,{maxFragLookUpTolerance:c}=i,u=n.partList,d=!!(this.loadingParts&&u!=null&&u.length&&l);d&&!this.bitrateTest&&u[u.length-1].fragment.sn===l.sn&&(a=a.concat(l),o=l.sn);let f;if(e<r){var h;const g=e<this.lastCurrentTime||e>r-c||(h=this.media)!=null&&h.paused||!this.startFragRequested?0:c;f=jo(s,a,e,g)}else f=a[a.length-1];if(f){const p=f.sn-n.startSN,g=this.fragmentTracker.getState(f);if((g===qt.OK||g===qt.PARTIAL&&f.gap)&&(s=f),s&&f.sn===s.sn&&(!d||u[0].fragment.sn>f.sn||!n.live)&&f.level===s.level){const v=a[p+1];f.sn<o&&this.fragmentTracker.getState(v)!==qt.OK?f=v:f=null}}return f}alignPlaylists(e,r,n){const i=e.fragments.length;if(!i)return this.warn("No fragments in live playlist"),0;const s=e.fragmentStart,a=!r,o=e.alignedSliding&&se(s);if(a||!o&&!s){rX(n,e);const l=e.fragmentStart;return this.log(`Live playlist sliding: ${l.toFixed(2)} start-sn: ${r?r.startSN:"na"}->${e.startSN} fragments: ${i}`),l}return s}waitForCdnTuneIn(e){return e.live&&e.canBlockReload&&e.partTarget&&e.tuneInGoal>Math.max(e.partHoldBack,e.partTarget*3)}setStartPosition(e,r){let n=this.startPosition;n<r&&(n=-1);const i=this.timelineOffset;if(n===-1){const s=this.startTimeOffset!==null,a=s?this.startTimeOffset:e.startTimeOffset;a!==null&&se(a)?(n=r+a,a<0&&(n+=e.edge),n=Math.min(Math.max(r,n),r+e.totalduration),this.log(`Setting startPosition to ${n} for start time offset ${a} found in ${s?"multivariant":"media"} playlist`),this.startPosition=n):e.live?(n=this.hls.liveSyncPosition||r,this.log(`Setting startPosition to -1 to start at live edge ${n}`),this.startPosition=-1):(this.log("setting startPosition to 0 by default"),this.startPosition=n=0),this.lastCurrentTime=n+i}this.nextLoadPosition=n+i}getLoadPosition(){var e;const{media:r}=this;let n=0;return(e=this.hls)!=null&&e.hasEnoughToStart&&r?n=r.currentTime:this.nextLoadPosition>=0&&(n=this.nextLoadPosition),n}handleFragLoadAborted(e,r){this.transmuxer&&e.type===this.playlistType&&Nt(e)&&e.stats.aborted&&(this.log(`Fragment ${e.sn}${r?" part "+r.index:""} of ${this.playlistLabel()} ${e.level} was aborted`),this.resetFragmentLoading(e))}resetFragmentLoading(e){(!this.fragCurrent||!this.fragContextChanged(e)&&this.state!==Q.FRAG_LOADING_WAITING_RETRY)&&(this.state=Q.IDLE)}onFragmentOrKeyLoadError(e,r){var n;if(r.chunkMeta&&!r.frag){const v=this.getCurrentContext(r.chunkMeta);v&&(r.frag=v.frag)}const i=r.frag;if(!i||i.type!==e||!this.levels)return;if(this.fragContextChanged(i)){var s;this.warn(`Frag load error must match current frag to retry ${i.url} > ${(s=this.fragCurrent)==null?void 0:s.url}`);return}const a=r.details===V.FRAG_GAP;a&&this.fragmentTracker.fragBuffered(i,!0);const o=r.errorAction;if(!o){this.state=Q.ERROR;return}const{action:l,flags:c,retryCount:u=0,retryConfig:d}=o,f=!!d,h=f&&l===hr.RetryRequest,p=f&&!o.resolved&&c===Jr.MoveAllAlternatesMatchingHost,g=(n=this.hls.latestLevelDetails)==null?void 0:n.live;if(!h&&p&&Nt(i)&&!i.endList&&g&&!Aj(r))this.resetFragmentErrors(e),this.treatAsGap(i),o.resolved=!0;else if((h||p)&&u<d.maxNumRetry){var m;const v=uw((m=r.response)==null?void 0:m.code),y=OT(d,u);if(this.resetStartWhenNotLoaded(),this.retryDate=self.performance.now()+y,this.state=Q.FRAG_LOADING_WAITING_RETRY,o.resolved=!0,v){this.log("Waiting for connection (offline)"),this.retryDate=1/0,r.reason="offline";return}this.warn(`Fragment ${i.sn} of ${e} ${i.level} errored with ${r.details}, retrying loading ${u+1}/${d.maxNumRetry} in ${y}ms`)}else if(d)if(this.resetFragmentErrors(e),u<d.maxNumRetry)!a&&l!==hr.RemoveAlternatePermanently&&(o.resolved=!0);else{this.warn(`${r.details} reached or exceeded max retry (${u})`);return}else l===hr.SendAlternateToPenaltyBox?this.state=Q.WAITING_LEVEL:this.state=Q.ERROR;this.tickImmediate()}checkRetryDate(){const e=self.performance.now(),r=this.retryDate,n=r===1/0;(!r||e>=r||n&&!uw(0))&&(n&&this.log("Connection restored (online)"),this.resetStartWhenNotLoaded(),this.state=Q.IDLE)}reduceLengthAndFlushBuffer(e){if(this.state===Q.PARSING||this.state===Q.PARSED){const r=e.frag,n=e.parent,i=this.getFwdBufferInfo(this.mediaBuffer,n),s=i&&i.len>.5;s&&this.reduceMaxBufferLength(i.len,(r==null?void 0:r.duration)||10);const a=!s;return a&&this.warn(`Buffer full error while media.currentTime (${this.getLoadPosition()}) is not buffered, flush ${n} buffer`),r&&(this.fragmentTracker.removeFragment(r),this.nextLoadPosition=r.start),this.resetLoadingState(),a}return!1}resetFragmentErrors(e){e===oe.AUDIO&&(this.fragCurrent=null),this.hls.hasEnoughToStart||(this.startFragRequested=!1),this.state!==Q.STOPPED&&(this.state=Q.IDLE)}afterBufferFlushed(e,r,n){if(!e)return;const i=Se.getBuffered(e);this.fragmentTracker.detectEvictedFragments(r,i,n),this.state===Q.ENDED&&this.resetLoadingState()}resetLoadingState(){this.log("Reset loading state"),this.fragCurrent=null,this.fragPrevious=null,this.state!==Q.STOPPED&&(this.state=Q.IDLE)}resetStartWhenNotLoaded(){if(!this.hls.hasEnoughToStart){this.startFragRequested=!1;const e=this.levelLastLoaded,r=e?e.details:null;r!=null&&r.live?(this.log("resetting startPosition for live start"),this.startPosition=-1,this.setStartPosition(r,r.fragmentStart),this.resetLoadingState()):this.nextLoadPosition=this.startPosition}}resetWhenMissingContext(e){this.log(`Loading context changed while buffering sn ${e.sn} of ${this.playlistLabel()} ${e.level===-1?"<removed>":e.level}. This chunk will not be buffered.`),this.removeUnbufferedFrags(),this.resetStartWhenNotLoaded(),this.resetLoadingState()}removeUnbufferedFrags(e=0){this.fragmentTracker.removeFragmentsInRange(e,1/0,this.playlistType,!1,!0)}updateLevelTiming(e,r,n,i){const s=n.details;if(!s){this.warn("level.details undefined");return}if(!Object.keys(e.elementaryStreams).reduce((l,c)=>{const u=e.elementaryStreams[c];if(u){const d=u.endPTS-u.startPTS;if(d<=0)return this.warn(`Could not parse fragment ${e.sn} ${c} duration reliably (${d})`),l||!1;const f=i?0:Nj(s,e,u.startPTS,u.endPTS,u.startDTS,u.endDTS,this);return this.hls.trigger(I.LEVEL_PTS_UPDATED,{details:s,level:n,drift:f,type:c,frag:e,start:u.startPTS,end:u.endPTS}),!0}return l},!1)){var o;const l=((o=this.transmuxer)==null?void 0:o.error)===null;if((n.fragmentError===0||l&&(n.fragmentError<2||e.endList))&&this.treatAsGap(e,n),l){const c=new Error(`Found no media in fragment ${e.sn} of ${this.playlistLabel()} ${e.level} resetting transmuxer to fallback to playlist timing`);if(this.warn(c.message),this.hls.trigger(I.ERROR,{type:fe.MEDIA_ERROR,details:V.FRAG_PARSING_ERROR,fatal:!1,error:c,frag:e,reason:`Found no media in msn ${e.sn} of ${this.playlistLabel()} "${n.url}"`}),!this.hls)return;this.resetTransmuxer()}}this.state=Q.PARSED,this.log(`Parsed ${e.type} sn: ${e.sn}${r?" part: "+r.index:""} of ${this.fragInfo(e,!1,r)})`),this.hls.trigger(I.FRAG_PARSED,{frag:e,part:r})}playlistLabel(){return this.playlistType===oe.MAIN?"level":"track"}fragInfo(e,r=!0,n){var i,s;return`${this.playlistLabel()} ${e.level} (${n?"part":"frag"}:[${((i=r&&!n?e.startPTS:(n||e).start)!=null?i:NaN).toFixed(3)}-${((s=r&&!n?e.endPTS:(n||e).end)!=null?s:NaN).toFixed(3)}]${n&&e.type==="main"?"INDEPENDENT="+(n.independent?"YES":"NO"):""}`}treatAsGap(e,r){r&&r.fragmentError++,e.gap=!0,this.fragmentTracker.removeFragment(e),this.fragmentTracker.fragBuffered(e,!0)}resetTransmuxer(){var e;(e=this.transmuxer)==null||e.reset()}recoverWorkerError(e){e.event==="demuxerWorker"&&(this.fragmentTracker.removeAllFragments(),this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null),this.resetStartWhenNotLoaded(),this.resetLoadingState())}set state(e){const r=this._state;r!==e&&(this._state=e,this.log(`${r}->${e}`))}get state(){return this._state}}function CI(t){return!!t.interstitialsController&&t.enableInterstitialPlayback!==!1}class Wj{constructor(){this.chunks=[],this.dataLength=0}push(e){this.chunks.push(e),this.dataLength+=e.length}flush(){const{chunks:e,dataLength:r}=this;let n;if(e.length)e.length===1?n=e[0]:n=iX(e,r);else return new Uint8Array(0);return this.reset(),n}reset(){this.chunks.length=0,this.dataLength=0}}function iX(t,e){const r=new Uint8Array(e);let n=0;for(let i=0;i<t.length;i++){const s=t[i];r.set(s,n),n+=s.length}return r}var I0={exports:{}},OI;function sX(){return OI||(OI=1,function(t){var e=Object.prototype.hasOwnProperty,r="~";function n(){}Object.create&&(n.prototype=Object.create(null),new n().__proto__||(r=!1));function i(l,c,u){this.fn=l,this.context=c,this.once=u||!1}function s(l,c,u,d,f){if(typeof u!="function")throw new TypeError("The listener must be a function");var h=new i(u,d||l,f),p=r?r+c:c;return l._events[p]?l._events[p].fn?l._events[p]=[l._events[p],h]:l._events[p].push(h):(l._events[p]=h,l._eventsCount++),l}function a(l,c){--l._eventsCount===0?l._events=new n:delete l._events[c]}function o(){this._events=new n,this._eventsCount=0}o.prototype.eventNames=function(){var c=[],u,d;if(this._eventsCount===0)return c;for(d in u=this._events)e.call(u,d)&&c.push(r?d.slice(1):d);return Object.getOwnPropertySymbols?c.concat(Object.getOwnPropertySymbols(u)):c},o.prototype.listeners=function(c){var u=r?r+c:c,d=this._events[u];if(!d)return[];if(d.fn)return[d.fn];for(var f=0,h=d.length,p=new Array(h);f<h;f++)p[f]=d[f].fn;return p},o.prototype.listenerCount=function(c){var u=r?r+c:c,d=this._events[u];return d?d.fn?1:d.length:0},o.prototype.emit=function(c,u,d,f,h,p){var g=r?r+c:c;if(!this._events[g])return!1;var m=this._events[g],v=arguments.length,y,b;if(m.fn){switch(m.once&&this.removeListener(c,m.fn,void 0,!0),v){case 1:return m.fn.call(m.context),!0;case 2:return m.fn.call(m.context,u),!0;case 3:return m.fn.call(m.context,u,d),!0;case 4:return m.fn.call(m.context,u,d,f),!0;case 5:return m.fn.call(m.context,u,d,f,h),!0;case 6:return m.fn.call(m.context,u,d,f,h,p),!0}for(b=1,y=new Array(v-1);b<v;b++)y[b-1]=arguments[b];m.fn.apply(m.context,y)}else{var w=m.length,S;for(b=0;b<w;b++)switch(m[b].once&&this.removeListener(c,m[b].fn,void 0,!0),v){case 1:m[b].fn.call(m[b].context);break;case 2:m[b].fn.call(m[b].context,u);break;case 3:m[b].fn.call(m[b].context,u,d);break;case 4:m[b].fn.call(m[b].context,u,d,f);break;default:if(!y)for(S=1,y=new Array(v-1);S<v;S++)y[S-1]=arguments[S];m[b].fn.apply(m[b].context,y)}}return!0},o.prototype.on=function(c,u,d){return s(this,c,u,d,!1)},o.prototype.once=function(c,u,d){return s(this,c,u,d,!0)},o.prototype.removeListener=function(c,u,d,f){var h=r?r+c:c;if(!this._events[h])return this;if(!u)return a(this,h),this;var p=this._events[h];if(p.fn)p.fn===u&&(!f||p.once)&&(!d||p.context===d)&&a(this,h);else{for(var g=0,m=[],v=p.length;g<v;g++)(p[g].fn!==u||f&&!p[g].once||d&&p[g].context!==d)&&m.push(p[g]);m.length?this._events[h]=m.length===1?m[0]:m:a(this,h)}return this},o.prototype.removeAllListeners=function(c){var u;return c?(u=r?r+c:c,this._events[u]&&a(this,u)):(this._events=new n,this._eventsCount=0),this},o.prototype.off=o.prototype.removeListener,o.prototype.addListener=o.prototype.on,o.prefixed=r,o.EventEmitter=o,t.exports=o}(I0)),I0.exports}var aX=sX(),MT=RY(aX);const rf="1.6.15",_c={};function oX(){return typeof __HLS_WORKER_BUNDLE__=="function"}function lX(){const t=_c[rf];if(t)return t.clientCount++,t;const e=new self.Blob([`var exports={};var module={exports:exports};function define(f){f()};define.amd=true;(${__HLS_WORKER_BUNDLE__.toString()})(true);`],{type:"text/javascript"}),r=self.URL.createObjectURL(e),i={worker:new self.Worker(r),objectURL:r,clientCount:1};return _c[rf]=i,i}function cX(t){const e=_c[t];if(e)return e.clientCount++,e;const r=new self.URL(t,self.location.href).href,i={worker:new self.Worker(r),scriptURL:r,clientCount:1};return _c[t]=i,i}function uX(t){const e=_c[t||rf];if(e&&e.clientCount--===1){const{worker:n,objectURL:i}=e;delete _c[t||rf],i&&self.URL.revokeObjectURL(i),n.terminate()}}function Vj(t,e){return e+10<=t.length&&t[e]===51&&t[e+1]===68&&t[e+2]===73&&t[e+3]<255&&t[e+4]<255&&t[e+6]<128&&t[e+7]<128&&t[e+8]<128&&t[e+9]<128}function $T(t,e){return e+10<=t.length&&t[e]===73&&t[e+1]===68&&t[e+2]===51&&t[e+3]<255&&t[e+4]<255&&t[e+6]<128&&t[e+7]<128&&t[e+8]<128&&t[e+9]<128}function kv(t,e){let r=0;return r=(t[e]&127)<<21,r|=(t[e+1]&127)<<14,r|=(t[e+2]&127)<<7,r|=t[e+3]&127,r}function nf(t,e){const r=e;let n=0;for(;$T(t,e);){n+=10;const i=kv(t,e+6);n+=i,Vj(t,e+10)&&(n+=10),e+=n}if(n>0)return t.subarray(r,r+n)}function dX(t,e,r,n){const i=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],s=e[r+2],a=s>>2&15;if(a>12){const h=new Error(`invalid ADTS sampling index:${a}`);t.emit(I.ERROR,I.ERROR,{type:fe.MEDIA_ERROR,details:V.FRAG_PARSING_ERROR,fatal:!0,error:h,reason:h.message});return}const o=(s>>6&3)+1,l=e[r+3]>>6&3|(s&1)<<2,c="mp4a.40."+o,u=i[a];let d=a;(o===5||o===29)&&(d-=3);const f=[o<<3|(d&14)>>1,(d&1)<<7|l<<3];return qe.log(`manifest codec:${n}, parsed codec:${c}, channels:${l}, rate:${u} (ADTS object type:${o} sampling index:${a})`),{config:f,samplerate:u,channelCount:l,codec:c,parsedCodec:c,manifestCodec:n}}function Hj(t,e){return t[e]===255&&(t[e+1]&246)===240}function Kj(t,e){return t[e+1]&1?7:9}function jT(t,e){return(t[e+3]&3)<<11|t[e+4]<<3|(t[e+5]&224)>>>5}function fX(t,e){return e+5<t.length}function Vm(t,e){return e+1<t.length&&Hj(t,e)}function hX(t,e){return fX(t,e)&&Hj(t,e)&&jT(t,e)<=t.length-e}function pX(t,e){if(Vm(t,e)){const r=Kj(t,e);if(e+r>=t.length)return!1;const n=jT(t,e);if(n<=r)return!1;const i=e+n;return i===t.length||Vm(t,i)}return!1}function zj(t,e,r,n,i){if(!t.samplerate){const s=dX(e,r,n,i);if(!s)return;et(t,s)}}function qj(t){return 1024*9e4/t}function mX(t,e){const r=Kj(t,e);if(e+r<=t.length){const n=jT(t,e)-r;if(n>0)return{headerLength:r,frameLength:n}}}function Yj(t,e,r,n,i){const s=qj(t.samplerate),a=n+i*s,o=mX(e,r);let l;if(o){const{frameLength:d,headerLength:f}=o,h=f+d,p=Math.max(0,r+h-e.length);p?(l=new Uint8Array(h-f),l.set(e.subarray(r+f,e.length),0)):l=e.subarray(r+f,r+h);const g={unit:l,pts:a};return p||t.samples.push(g),{sample:g,length:h,missing:p}}const c=e.length-r;return l=new Uint8Array(c),l.set(e.subarray(r,e.length),0),{sample:{unit:l,pts:a},length:c,missing:-1}}function gX(t,e){return $T(t,e)&&kv(t,e+6)+10<=t.length-e}function vX(t){return t instanceof ArrayBuffer?t:t.byteOffset==0&&t.byteLength==t.buffer.byteLength?t.buffer:new Uint8Array(t).buffer}function C0(t,e=0,r=1/0){return yX(t,e,r,Uint8Array)}function yX(t,e,r,n){const i=bX(t);let s=1;"BYTES_PER_ELEMENT"in n&&(s=n.BYTES_PER_ELEMENT);const a=xX(t)?t.byteOffset:0,o=(a+t.byteLength)/s,l=(a+e)/s,c=Math.floor(Math.max(0,Math.min(l,o))),u=Math.floor(Math.min(c+Math.max(r,0),o));return new n(i,c,u-c)}function bX(t){return t instanceof ArrayBuffer?t:t.buffer}function xX(t){return t&&t.buffer instanceof ArrayBuffer&&t.byteLength!==void 0&&t.byteOffset!==void 0}function wX(t){const e={key:t.type,description:"",data:"",mimeType:null,pictureType:null},r=3;if(t.size<2)return;if(t.data[0]!==r){console.log("Ignore frame with unrecognized character encoding");return}const n=t.data.subarray(1).indexOf(0);if(n===-1)return;const i=hn(C0(t.data,1,n)),s=t.data[2+n],a=t.data.subarray(3+n).indexOf(0);if(a===-1)return;const o=hn(C0(t.data,3+n,a));let l;return i==="-->"?l=hn(C0(t.data,4+n+a)):l=vX(t.data.subarray(4+n+a)),e.mimeType=i,e.pictureType=s,e.description=o,e.data=l,e}function SX(t){if(t.size<2)return;
vendor: 6,682 bytes, line 265
265const e=hn(t.data,!0),r=new Uint8Array(t.data.subarray(e.length+1));return{key:t.type,info:e,data:r.buffer}}function EX(t){if(t.size<2)return;if(t.type==="TXXX"){let r=1;const n=hn(t.data.subarray(r),!0);r+=n.length+1;const i=hn(t.data.subarray(r));return{key:t.type,info:n,data:i}}const e=hn(t.data.subarray(1));return{key:t.type,info:"",data:e}}function TX(t){if(t.type==="WXXX"){if(t.size<2)return;let r=1;const n=hn(t.data.subarray(r),!0);r+=n.length+1;const i=hn(t.data.subarray(r));return{key:t.type,info:n,data:i}}const e=hn(t.data);return{key:t.type,info:"",data:e}}function _X(t){return t.type==="PRIV"?SX(t):t.type[0]==="W"?TX(t):t.type==="APIC"?wX(t):EX(t)}function AX(t){const e=String.fromCharCode(t[0],t[1],t[2],t[3]),r=kv(t,4),n=10;return{type:e,size:r,data:t.subarray(n,n+r)}}const Qh=10,PX=10;function Xj(t){let e=0;const r=[];for(;$T(t,e);){const n=kv(t,e+6);t[e+5]>>6&1&&(e+=Qh),e+=Qh;const i=e+n;for(;e+PX<i;){const s=AX(t.subarray(e)),a=_X(s);a&&r.push(a),e+=s.size+Qh}Vj(t,e)&&(e+=Qh)}return r}function Qj(t){return t&&t.key==="PRIV"&&t.info==="com.apple.streaming.transportStreamTimestamp"}function IX(t){if(t.data.byteLength===8){const e=new Uint8Array(t.data),r=e[3]&1;let n=(e[4]<<23)+(e[5]<<15)+(e[6]<<7)+e[7];return n/=45,r&&(n+=4772185884e-2),Math.round(n)}}function FT(t){const e=Xj(t);for(let r=0;r<e.length;r++){const n=e[r];if(Qj(n))return IX(n)}}let an=function(t){return t.audioId3="org.id3",t.dateRange="com.apple.quicktime.HLS",t.emsg="https://aomedia.org/emsg/ID3",t.misbklv="urn:misb:KLV:bin:1910.1",t}({});function Ei(t="",e=9e4){return{type:t,id:-1,pid:-1,inputTimeScale:e,sequenceNumber:-1,samples:[],dropped:0}}class BT{constructor(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.basePTS=null,this.initPTS=null,this.lastPTS=null}resetInitSegment(e,r,n,i){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}}resetTimeStamp(e){this.initPTS=e,this.resetContiguity()}resetContiguity(){this.basePTS=null,this.lastPTS=null,this.frameIndex=0}canParse(e,r){return!1}appendFrame(e,r,n){}demux(e,r){this.cachedData&&(e=kn(this.cachedData,e),this.cachedData=null);let n=nf(e,0),i=n?n.length:0,s;const a=this._audioTrack,o=this._id3Track,l=n?FT(n):void 0,c=e.length;for((this.basePTS===null||this.frameIndex===0&&se(l))&&(this.basePTS=CX(l,r,this.initPTS),this.lastPTS=this.basePTS),this.lastPTS===null&&(this.lastPTS=this.basePTS),n&&n.length>0&&o.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:n,type:an.audioId3,duration:Number.POSITIVE_INFINITY});i<c;){if(this.canParse(e,i)){const u=this.appendFrame(a,e,i);u?(this.frameIndex++,this.lastPTS=u.sample.pts,i+=u.length,s=i):i=c}else gX(e,i)?(n=nf(e,i),o.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:n,type:an.audioId3,duration:Number.POSITIVE_INFINITY}),i+=n.length,s=i):i++;if(i===c&&s!==c){const u=e.slice(s);this.cachedData?this.cachedData=kn(this.cachedData,u):this.cachedData=u}}return{audioTrack:a,videoTrack:Ei(),id3Track:o,textTrack:Ei()}}demuxSampleAes(e,r,n){return Promise.reject(new Error(`[${this}] This demuxer does not support Sample-AES decryption`))}flush(e){const r=this.cachedData;return r&&(this.cachedData=null,this.demux(r,0)),{audioTrack:this._audioTrack,videoTrack:Ei(),id3Track:this._id3Track,textTrack:Ei()}}destroy(){this.cachedData=null,this._audioTrack=this._id3Track=void 0}}const CX=(t,e,r)=>{if(se(t))return t*90;const n=r?r.baseTime*9e4/r.timescale:0;return e*9e4+n};let Jh=null;const OX=[32,64,96,128,160,192,224,256,288,320,352,384,416,448,32,48,56,64,80,96,112,128,160,192,224,256,320,384,32,40,48,56,64,80,96,112,128,160,192,224,256,320,32,48,56,64,80,96,112,128,144,160,176,192,224,256,8,16,24,32,40,48,56,64,80,96,112,128,144,160],RX=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],kX=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],LX=[0,1,1,4];function Jj(t,e,r,n,i){if(r+24>e.length)return;const s=Zj(e,r);if(s&&r+s.frameLength<=e.length){const a=s.samplesPerFrame*9e4/s.sampleRate,o=n+i*a,l={unit:e.subarray(r,r+s.frameLength),pts:o,dts:o};return t.config=[],t.channelCount=s.channelCount,t.samplerate=s.sampleRate,t.samples.push(l),{sample:l,length:s.frameLength,missing:0}}}function Zj(t,e){const r=t[e+1]>>3&3,n=t[e+1]>>1&3,i=t[e+2]>>4&15,s=t[e+2]>>2&3;if(r!==1&&i!==0&&i!==15&&s!==3){const a=t[e+2]>>1&1,o=t[e+3]>>6,l=r===3?3-n:n===3?3:4,c=OX[l*14+i-1]*1e3,d=RX[(r===3?0:r===2?1:2)*3+s],f=o===3?1:2,h=kX[r][n],p=LX[n],g=h*8*p,m=Math.floor(h*c/d+a)*p;if(Jh===null){const b=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);Jh=b?parseInt(b[1]):0}return!!Jh&&Jh<=87&&n===2&&c>=224e3&&o===0&&(t[e+3]=t[e+3]|128),{sampleRate:d,channelCount:f,frameLength:m,samplesPerFrame:g}}}function UT(t,e){return t[e]===255&&(t[e+1]&224)===224&&(t[e+1]&6)!==0}function e2(t,e){return e+1<t.length&&UT(t,e)}function DX(t,e){return UT(t,e)&&4<=t.length-e}function t2(t,e){if(e+1<t.length&&UT(t,e)){const n=Zj(t,e);let i=4;n!=null&&n.frameLength&&(i=n.frameLength);const s=e+i;return s===t.length||e2(t,s)}return!1}class NX extends BT{constructor(e,r){super(),this.observer=void 0,this.config=void 0,this.observer=e,this.config=r}resetInitSegment(e,r,n,i){super.resetInitSegment(e,r,n,i),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"aac",samples:[],manifestCodec:r,duration:i,inputTimeScale:9e4,dropped:0}}static probe(e,r){if(!e)return!1;const n=nf(e,0);let i=(n==null?void 0:n.length)||0;if(t2(e,i))return!1;for(let s=e.length;i<s;i++)if(pX(e,i))return r.log("ADTS sync word found !"),!0;return!1}canParse(e,r){return hX(e,r)}appendFrame(e,r,n){zj(e,this.observer,r,n,e.manifestCodec);const i=Yj(e,r,n,this.basePTS,this.frameIndex);if(i&&i.missing===0)return i}}const r2=(t,e)=>{let r=0,n=5;e+=n;const i=new Uint32Array(1),s=new Uint32Array(1),a=new Uint8Array(1);for(;n>0;){a[0]=t[e];const o=Math.min(n,8),l=8-o;s[0]=4278190080>>>24+l<<l,i[0]=(a[0]&s[0])>>l,r=r?r<<o|i[0]:i[0],e+=1,n-=o}return r};class MX extends BT{constructor(e){super(),this.observer=void 0,this.observer=e}resetInitSegment(e,r,n,i){super.resetInitSegment(e,r,n,i),this._audioTrack={container:"audio/ac-3",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"ac3",samples:[],manifestCodec:r,duration:i,inputTimeScale:9e4,dropped:0}}canParse(e,r){return r+64<e.length}appendFrame(e,r,n){const i=n2(e,r,n,this.basePTS,this.frameIndex);if(i!==-1)return{sample:e.samples[e.samples.length-1],length:i,missing:0}}static probe(e){if(!e)return!1;const r=nf(e,0);if(!r)return!1;const n=r.length;return e[n]===11&&e[n+1]===119&&FT(r)!==void 0&&r2(e,n)<16}}function n2(t,e,r,n,i){if(r+8>e.length||e[r]!==11||e[r+1]!==119)return-1;const s=e[r+4]>
vendor: 6,960 bytes, line 265
265>6;if(s>=3)return-1;const o=[48e3,44100,32e3][s],l=e[r+4]&63,u=[64,69,96,64,70,96,80,87,120,80,88,120,96,104,144,96,105,144,112,121,168,112,122,168,128,139,192,128,140,192,160,174,240,160,175,240,192,208,288,192,209,288,224,243,336,224,244,336,256,278,384,256,279,384,320,348,480,320,349,480,384,417,576,384,418,576,448,487,672,448,488,672,512,557,768,512,558,768,640,696,960,640,697,960,768,835,1152,768,836,1152,896,975,1344,896,976,1344,1024,1114,1536,1024,1115,1536,1152,1253,1728,1152,1254,1728,1280,1393,1920,1280,1394,1920][l*3+s]*2;if(r+u>e.length)return-1;const d=e[r+6]>>5;let f=0;d===2?f+=2:(d&1&&d!==1&&(f+=2),d&4&&(f+=2));const h=(e[r+6]<<8|e[r+7])>>12-f&1,g=[2,1,2,3,3,4,4,5][d]+h,m=e[r+5]>>3,v=e[r+5]&7,y=new Uint8Array([s<<6|m<<1|v>>2,(v&3)<<6|d<<3|h<<2|l>>4,l<<4&224]),b=1536/o*9e4,w=n+i*b,S=e.subarray(r,r+u);return t.config=y,t.channelCount=g,t.samplerate=o,t.samples.push({unit:S,pts:w}),u}class $X extends BT{resetInitSegment(e,r,n,i){super.resetInitSegment(e,r,n,i),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"mp3",samples:[],manifestCodec:r,duration:i,inputTimeScale:9e4,dropped:0}}static probe(e){if(!e)return!1;const r=nf(e,0);let n=(r==null?void 0:r.length)||0;if(r&&e[n]===11&&e[n+1]===119&&FT(r)!==void 0&&r2(e,n)<=16)return!1;for(let i=e.length;n<i;n++)if(t2(e,n))return qe.log("MPEG Audio sync word found !"),!0;return!1}canParse(e,r){return DX(e,r)}appendFrame(e,r,n){if(this.basePTS!==null)return Jj(e,r,n,this.basePTS,this.frameIndex)}}const jX=/\/emsg[-/]ID3/i;class FX{constructor(e,r){this.remainderData=null,this.timeOffset=0,this.config=void 0,this.videoTrack=void 0,this.audioTrack=void 0,this.id3Track=void 0,this.txtTrack=void 0,this.config=r}resetTimeStamp(){}resetInitSegment(e,r,n,i){const s=this.videoTrack=Ei("video",1),a=this.audioTrack=Ei("audio",1),o=this.txtTrack=Ei("text",1);if(this.id3Track=Ei("id3",1),this.timeOffset=0,!(e!=null&&e.byteLength))return;const l=hj(e);if(l.video){const{id:c,timescale:u,codec:d,supplemental:f}=l.video;s.id=c,s.timescale=o.timescale=u,s.codec=d,s.supplemental=f}if(l.audio){const{id:c,timescale:u,codec:d}=l.audio;a.id=c,a.timescale=u,a.codec=d}o.id=uj.text,s.sampleDuration=0,s.duration=a.duration=i}resetContiguity(){this.remainderData=null}static probe(e){return MY(e)}demux(e,r){this.timeOffset=r;let n=e;const i=this.videoTrack,s=this.txtTrack;if(this.config.progressive){this.remainderData&&(n=kn(this.remainderData,e));const o=WY(n);this.remainderData=o.remainder,i.samples=o.valid||new Uint8Array}else i.samples=n;const a=this.extractID3Track(i,r);return s.samples=qP(r,i),{videoTrack:i,audioTrack:this.audioTrack,id3Track:a,textTrack:this.txtTrack}}flush(){const e=this.timeOffset,r=this.videoTrack,n=this.txtTrack;r.samples=this.remainderData||new Uint8Array,this.remainderData=null;const i=this.extractID3Track(r,this.timeOffset);return n.samples=qP(e,r),{videoTrack:r,audioTrack:Ei(),id3Track:i,textTrack:Ei()}}extractID3Track(e,r){const n=this.id3Track;if(e.samples.length){const i=Ie(e.samples,["emsg"]);i&&i.forEach(s=>{const a=HY(s);if(jX.test(a.schemeIdUri)){const o=RI(a,r);let l=a.eventDuration===4294967295?Number.POSITIVE_INFINITY:a.eventDuration/a.timeScale;l<=.001&&(l=Number.POSITIVE_INFINITY);const c=a.payload;n.samples.push({data:c,len:c.byteLength,dts:o,pts:o,type:an.emsg,duration:l})}else if(this.config.enableEmsgKLVMetadata&&a.schemeIdUri.startsWith("urn:misb:KLV:bin:1910.1")){const o=RI(a,r);n.samples.push({data:a.payload,len:a.payload.byteLength,dts:o,pts:o,type:an.misbklv,duration:Number.POSITIVE_INFINITY})}})}return n}demuxSampleAes(e,r,n){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))}destroy(){this.config=null,this.remainderData=null,this.videoTrack=this.audioTrack=this.id3Track=this.txtTrack=void 0}}function RI(t,e){return se(t.presentationTime)?t.presentationTime/t.timeScale:e+t.presentationTimeDelta/t.timeScale}class BX{constructor(e,r,n){this.keyData=void 0,this.decrypter=void 0,this.keyData=n,this.decrypter=new RT(r,{removePKCS7Padding:!1})}decryptBuffer(e){return this.decrypter.decrypt(e,this.keyData.key.buffer,this.keyData.iv.buffer,_a.cbc)}decryptAacSample(e,r,n){const i=e[r].unit;if(i.length<=16)return;const s=i.subarray(16,i.length-i.length%16),a=s.buffer.slice(s.byteOffset,s.byteOffset+s.length);this.decryptBuffer(a).then(o=>{const l=new Uint8Array(o);i.set(l,16),this.decrypter.isSync()||this.decryptAacSamples(e,r+1,n)}).catch(n)}decryptAacSamples(e,r,n){for(;;r++){if(r>=e.length){n();return}if(!(e[r].unit.length<32)&&(this.decryptAacSample(e,r,n),!this.decrypter.isSync()))return}}getAvcEncryptedData(e){const r=Math.floor((e.length-48)/160)*16+16,n=new Int8Array(r);let i=0;for(let s=32;s<e.length-16;s+=160,i+=16)n.set(e.subarray(s,s+16),i);return n}getAvcDecryptedUnit(e,r){const n=new Uint8Array(r);let i=0;for(let s=32;s<e.length-16;s+=160,i+=16)e.set(n.subarray(i,i+16),s);return e}decryptAvcSample(e,r,n,i,s){const a=gj(s.data),o=this.getAvcEncryptedData(a);this.decryptBuffer(o.buffer).then(l=>{s.data=this.getAvcDecryptedUnit(a,l),this.decrypter.isSync()||this.decryptAvcSamples(e,r,n+1,i)}).catch(i)}decryptAvcSamples(e,r,n,i){if(e instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;r++,n=0){if(r>=e.length){i();return}const s=e[r].units;for(;!(n>=s.length);n++){const a=s[n];if(!(a.data.length<=48||a.type!==1&&a.type!==5)&&(this.decryptAvcSample(e,r,n,i,a),!this.decrypter.isSync()))return}}}}class i2{constructor(){this.VideoSample=null}createVideoSample(e,r,n){return{key:e,frame:!1,pts:r,dts:n,units:[],length:0}}getLastNalUnit(e){var r;let n=this.VideoSample,i;if((!n||n.units.length===0)&&(n=e[e.length-1]),(r=n)!=null&&r.units){const s=n.units;i=s[s.length-1]}return i}pushAccessUnit(e,r){if(e.units.length&&e.frame){if(e.pts===void 0){const n=r.samples,i=n.length;if(i){const s=n[i-1];e.pts=s.pts,e.dts=s.dts}else{r.dropped++;return}}r.samples.push(e)}}parseNALu(e,r,n){const i=r.byteLength;let s=e.naluState||0;const a=s,o=[];let l=0,c,u,d,f=-1,h=0;for(s===-1&&(f=0,h=this.getNALuType(r,0),s=0,l=1);l<i;){if(c=r[l++],!s){s=c?0:1;continue}if(s===1){s=c?0:2;continue}if(!c)s=3;else if(c===1){if(u=l-s-1,f>=0){const p={data:r.subarray(f,u),type:h};o.push(p)}else{const p=this.getLastNalUnit(e.samples);p&&(a&&l<=4-a&&p.state&&(p.data=p.data.subarray(0,p.data.byteLength-a)),u>0&&(p.data=kn(p.data,r.subarray(0,u)),p.state=0))}l<i?(d=this.getNALuType(r,l),f=l,h=d,s=0):s=-1}else s=0}if(f>=0&&s>=0){const p={data:r.subarray(f,i),type:h,state:s};o.push(p)}if(o.length===0){const p=this.getLastNalUnit(e.samples);p&&(p.data=kn(p.data,r))}return e.naluState=s,o}}class gd{constructor(e){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=e,this.bytesAvailable=e.byteLength,this.word=0,this.bitsAvailable=0}loadWord(){const e=this.data,r=this.bytesAvailable,n=e.byteLength-r,i=new Uint8Array(4),s=Math.min(4,r);
vendor: 4,441 bytes, line 265
265if(s===0)throw new Error("no bytes available");i.set(e.subarray(n,n+s)),this.word=new DataView(i.buffer).getUint32(0),this.bitsAvailable=s*8,this.bytesAvailable-=s}skipBits(e){let r;e=Math.min(e,this.bytesAvailable*8+this.bitsAvailable),this.bitsAvailable>e?(this.word<<=e,this.bitsAvailable-=e):(e-=this.bitsAvailable,r=e>>3,e-=r<<3,this.bytesAvailable-=r,this.loadWord(),this.word<<=e,this.bitsAvailable-=e)}readBits(e){let r=Math.min(this.bitsAvailable,e);const n=this.word>>>32-r;if(e>32&&qe.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=r,this.bitsAvailable>0)this.word<<=r;else if(this.bytesAvailable>0)this.loadWord();else throw new Error("no bits available");return r=e-r,r>0&&this.bitsAvailable?n<<r|this.readBits(r):n}skipLZ(){let e;for(e=0;e<this.bitsAvailable;++e)if(this.word&2147483648>>>e)return this.word<<=e,this.bitsAvailable-=e,e;return this.loadWord(),e+this.skipLZ()}skipUEG(){this.skipBits(1+this.skipLZ())}skipEG(){this.skipBits(1+this.skipLZ())}readUEG(){const e=this.skipLZ();return this.readBits(e+1)-1}readEG(){const e=this.readUEG();return 1&e?1+e>>>1:-1*(e>>>1)}readBoolean(){return this.readBits(1)===1}readUByte(){return this.readBits(8)}readUShort(){return this.readBits(16)}readUInt(){return this.readBits(32)}}class UX extends i2{parsePES(e,r,n,i){const s=this.parseNALu(e,n.data,i);let a=this.VideoSample,o,l=!1;n.data=null,a&&s.length&&!e.audFound&&(this.pushAccessUnit(a,e),a=this.VideoSample=this.createVideoSample(!1,n.pts,n.dts)),s.forEach(c=>{var u,d;switch(c.type){case 1:{let g=!1;o=!0;const m=c.data;if(l&&m.length>4){const v=this.readSliceType(m);(v===2||v===4||v===7||v===9)&&(g=!0)}if(g){var f;(f=a)!=null&&f.frame&&!a.key&&(this.pushAccessUnit(a,e),a=this.VideoSample=null)}a||(a=this.VideoSample=this.createVideoSample(!0,n.pts,n.dts)),a.frame=!0,a.key=g;break}case 5:o=!0,(u=a)!=null&&u.frame&&!a.key&&(this.pushAccessUnit(a,e),a=this.VideoSample=null),a||(a=this.VideoSample=this.createVideoSample(!0,n.pts,n.dts)),a.key=!0,a.frame=!0;break;case 6:{o=!0,PT(c.data,1,n.pts,r.samples);break}case 7:{var h,p;o=!0,l=!0;const g=c.data,m=this.readSPS(g);if(!e.sps||e.width!==m.width||e.height!==m.height||((h=e.pixelRatio)==null?void 0:h[0])!==m.pixelRatio[0]||((p=e.pixelRatio)==null?void 0:p[1])!==m.pixelRatio[1]){e.width=m.width,e.height=m.height,e.pixelRatio=m.pixelRatio,e.sps=[g];const v=g.subarray(1,4);let y="avc1.";for(let b=0;b<3;b++){let w=v[b].toString(16);w.length<2&&(w="0"+w),y+=w}e.codec=y}break}case 8:o=!0,e.pps=[c.data];break;case 9:o=!0,e.audFound=!0,(d=a)!=null&&d.frame&&(this.pushAccessUnit(a,e),a=null),a||(a=this.VideoSample=this.createVideoSample(!1,n.pts,n.dts));break;case 12:o=!0;break;default:o=!1;break}a&&o&&a.units.push(c)}),i&&a&&(this.pushAccessUnit(a,e),this.VideoSample=null)}getNALuType(e,r){return e[r]&31}readSliceType(e){const r=new gd(e);return r.readUByte(),r.readUEG(),r.readUEG()}skipScalingList(e,r){let n=8,i=8,s;for(let a=0;a<e;a++)i!==0&&(s=r.readEG(),i=(n+s+256)%256),n=i===0?n:i}readSPS(e){const r=new gd(e);let n=0,i=0,s=0,a=0,o,l,c;const u=r.readUByte.bind(r),d=r.readBits.bind(r),f=r.readUEG.bind(r),h=r.readBoolean.bind(r),p=r.skipBits.bind(r),g=r.skipEG.bind(r),m=r.skipUEG.bind(r),v=this.skipScalingList.bind(this);u();const y=u();if(d(5),p(3),u(),m(),y===100||y===110||y===122||y===244||y===44||y===83||y===86||y===118||y===128){const A=f();if(A===3&&p(1),m(),m(),p(1),h())for(l=A!==3?8:12,c=0;c<l;c++)h()&&(c<6?v(16,r):v(64,r))}m();const b=f();if(b===0)f();else if(b===1)for(p(1),g(),g(),o=f(),c=0;c<o;c++)g();m(),p(1);const w=f(),S=f(),T=d(1);T===0&&p(1),p(1),h()&&(n=f(),i=f(),s=f(),a=f());let _=[1,1];if(h()&&h())switch(u()){case 1:_=[1,1];break;case 2:_=[12,11];break;case 3:_=[10,11];break;case 4:_=[16,11];break;case 5:_=[40,33];break;case 6:_=[24,11];break;case 7:_=[20,11];break;case 8:_=[32,11];break;case 9:_=[80,33];break;case 10:_=[18,11];break;case 11:_=[15,11];break;case 12:_=[64,33];break;case 13:_=[160,99];break;case 14:_=[4,3];break;case 15:_=[3,2];break;case 16:_=[2,1];break;case 255:{_=[u()<<8|u(),u()<<8|u()];break}}return{width:Math.ceil((w+1)*16-n*2-i*2),height:(2-T)*(S+1)*16-(T?2:4)*(s+a),pixelRatio:_}}}class GX extends i2{constructor(...e){super(...e),this.initVPS=null}parsePES(e,r,n,i){const s=this.parseNALu(e,n.data,i);let a=this.VideoSample,o,l=!1;n.data=null,a&&s.length&&!e.audFound&&(this.pushAccessUnit(a,e),a=this.VideoSample=this.createVideoSample(!1,n.pts,n.dts)),s.forEac
vendor: 17,790 bytes, line 265
265h(c=>{var u,d;switch(c.type){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 8:case 9:a||(a=this.VideoSample=this.createVideoSample(!1,n.pts,n.dts)),a.frame=!0,o=!0;break;case 16:case 17:case 18:case 21:if(o=!0,l){var f;(f=a)!=null&&f.frame&&!a.key&&(this.pushAccessUnit(a,e),a=this.VideoSample=null)}a||(a=this.VideoSample=this.createVideoSample(!0,n.pts,n.dts)),a.key=!0,a.frame=!0;break;case 19:case 20:o=!0,(u=a)!=null&&u.frame&&!a.key&&(this.pushAccessUnit(a,e),a=this.VideoSample=null),a||(a=this.VideoSample=this.createVideoSample(!0,n.pts,n.dts)),a.key=!0,a.frame=!0;break;case 39:o=!0,PT(c.data,2,n.pts,r.samples);break;case 32:o=!0,e.vps||(typeof e.params!="object"&&(e.params={}),e.params=et(e.params,this.readVPS(c.data)),this.initVPS=c.data),e.vps=[c.data];break;case 33:if(o=!0,l=!0,e.vps!==void 0&&e.vps[0]!==this.initVPS&&e.sps!==void 0&&!this.matchSPS(e.sps[0],c.data)&&(this.initVPS=e.vps[0],e.sps=e.pps=void 0),!e.sps){const h=this.readSPS(c.data);e.width=h.width,e.height=h.height,e.pixelRatio=h.pixelRatio,e.codec=h.codecString,e.sps=[],typeof e.params!="object"&&(e.params={});for(const p in h.params)e.params[p]=h.params[p]}this.pushParameterSet(e.sps,c.data,e.vps),a||(a=this.VideoSample=this.createVideoSample(!0,n.pts,n.dts)),a.key=!0;break;case 34:if(o=!0,typeof e.params=="object"){if(!e.pps){e.pps=[];const h=this.readPPS(c.data);for(const p in h)e.params[p]=h[p]}this.pushParameterSet(e.pps,c.data,e.vps)}break;case 35:o=!0,e.audFound=!0,(d=a)!=null&&d.frame&&(this.pushAccessUnit(a,e),a=null),a||(a=this.VideoSample=this.createVideoSample(!1,n.pts,n.dts));break;default:o=!1;break}a&&o&&a.units.push(c)}),i&&a&&(this.pushAccessUnit(a,e),this.VideoSample=null)}pushParameterSet(e,r,n){(n&&n[0]===this.initVPS||!n&&!e.length)&&e.push(r)}getNALuType(e,r){return(e[r]&126)>>>1}ebsp2rbsp(e){const r=new Uint8Array(e.byteLength);let n=0;for(let i=0;i<e.byteLength;i++)i>=2&&e[i]===3&&e[i-1]===0&&e[i-2]===0||(r[n]=e[i],n++);return new Uint8Array(r.buffer,0,n)}pushAccessUnit(e,r){super.pushAccessUnit(e,r),this.initVPS&&(this.initVPS=null)}readVPS(e){const r=new gd(e);r.readUByte(),r.readUByte(),r.readBits(4),r.skipBits(2),r.readBits(6);const n=r.readBits(3),i=r.readBoolean();return{numTemporalLayers:n+1,temporalIdNested:i}}readSPS(e){const r=new gd(this.ebsp2rbsp(e));r.readUByte(),r.readUByte(),r.readBits(4);const n=r.readBits(3);r.readBoolean();const i=r.readBits(2),s=r.readBoolean(),a=r.readBits(5),o=r.readUByte(),l=r.readUByte(),c=r.readUByte(),u=r.readUByte(),d=r.readUByte(),f=r.readUByte(),h=r.readUByte(),p=r.readUByte(),g=r.readUByte(),m=r.readUByte(),v=r.readUByte(),y=[],b=[];for(let de=0;de<n;de++)y.push(r.readBoolean()),b.push(r.readBoolean());if(n>0)for(let de=n;de<8;de++)r.readBits(2);for(let de=0;de<n;de++)y[de]&&(r.readUByte(),r.readUByte(),r.readUByte(),r.readUByte(),r.readUByte(),r.readUByte(),r.readUByte(),r.readUByte(),r.readUByte(),r.readUByte(),r.readUByte()),b[de]&&r.readUByte();r.readUEG();const w=r.readUEG();w==3&&r.skipBits(1);const S=r.readUEG(),T=r.readUEG(),_=r.readBoolean();let A=0,P=0,C=0,O=0;_&&(A+=r.readUEG(),P+=r.readUEG(),C+=r.readUEG(),O+=r.readUEG());const R=r.readUEG(),D=r.readUEG(),L=r.readUEG(),j=r.readBoolean();for(let de=j?0:n;de<=n;de++)r.skipUEG(),r.skipUEG(),r.skipUEG();if(r.skipUEG(),r.skipUEG(),r.skipUEG(),r.skipUEG(),r.skipUEG(),r.skipUEG(),r.readBoolean()&&r.readBoolean())for(let Pe=0;Pe<4;Pe++)for(let tt=0;tt<(Pe===3?2:6);tt++)if(!r.readBoolean())r.readUEG();else{const Gt=Math.min(64,1<<4+(Pe<<1));Pe>1&&r.readEG();for(let $t=0;$t<Gt;$t++)r.readEG()}r.readBoolean(),r.readBoolean(),r.readBoolean()&&(r.readUByte(),r.skipUEG(),r.skipUEG(),r.readBoolean());const k=r.readUEG();let $=0;for(let de=0;de<k;de++){let Pe=!1;if(de!==0&&(Pe=r.readBoolean()),Pe){de===k&&r.readUEG(),r.readBoolean(),r.readUEG();let tt=0;for(let kt=0;kt<=$;kt++){const Gt=r.readBoolean();let $t=!1;Gt||($t=r.readBoolean()),(Gt||$t)&&tt++}$=tt}else{const tt=r.readUEG(),kt=r.readUEG();$=tt+kt;for(let Gt=0;Gt<tt;Gt++)r.readUEG(),r.readBoolean();for(let Gt=0;Gt<kt;Gt++)r.readUEG(),r.readBoolean()}}if(r.readBoolean()){const de=r.readUEG();for(let Pe=0;Pe<de;Pe++){for(let tt=0;tt<L+4;tt++)r.readBits(1);r.readBits(1)}}let G=0,B=1,K=1,ee=!0,H=1,J=0;r.readBoolean(),r.readBoolean();let q=!1;if(r.readBoolean()){if(r.readBoolean()){const Jt=r.readUByte(),$r=[1,12,10,16,40,24,20,32,80,18,15,64,160,4,3,2],Hi=[1,11,11,11,33,11,11,11,33,11,11,33,99,3,2,1];Jt>0&&Jt<16?(B=$r[Jt-1],K=Hi[Jt-1]):Jt===255&&(B=r.readBits(16),K=r.readBits(16))}if(r.readBoolean()&&r.readBoolean(),r.readBoolean()&&(r.readBits(3),r.readBoolean(),r.readBoolean()&&(r.readUByte(),r.readUByte(),r.readUByte())),r.readBoolean()&&(r.readUEG(),r.readUEG()),r.readBoolean(),r.readBoolean(),r.readBoolean(),q=r.readBoolean(),q&&(r.skipUEG(),r.skipUEG(),r.skipUEG(),r.skipUEG()),r.readBoolean()&&(H=r.readBits(32),J=r.readBits(32),r.readBoolean()&&r.readUEG(),r.readBoolean())){const Hi=r.readBoolean(),Fa=r.readBoolean();let Zt=!1;(Hi||Fa)&&(Zt=r.readBoolean(),Zt&&(r.readUByte(),r.readBits(5),r.readBoolean(),r.readBits(5)),r.readBits(4),r.readBits(4),Zt&&r.readBits(4),r.readBits(5),r.readBits(5),r.readBits(5));for(let Ki=0;Ki<=n;Ki++){ee=r.readBoolean();const Cy=ee||r.readBoolean();let gh=!1;Cy?r.readEG():gh=r.readBoolean();const Ba=gh?1:r.readUEG()+1;if(Hi)for(let Ua=0;Ua<Ba;Ua++)r.readUEG(),r.readUEG(),Zt&&(r.readUEG(),r.readUEG()),r.skipBits(1);if(Fa)for(let Ua=0;Ua<Ba;Ua++)r.readUEG(),r.readUEG(),Zt&&(r.readUEG(),r.readUEG()),r.skipBits(1)}}r.readBoolean()&&(r.readBoolean(),r.readBoolean(),r.readBoolean(),G=r.readUEG())}let Z=S,re=T;if(_){let de=1,Pe=1;w===1?de=Pe=2:w==2&&(de=2),Z=S-de*P-de*A,re=T-Pe*O-Pe*C}const ne=i?["A","B","C"][i]:"",z=o<<24|l<<16|c<<8|u;let Ee=0;for(let de=0;de<32;de++)Ee=(Ee|(z>>de&1)<<31-de)>>>0;let me=Ee.toString(16);return a===1&&me==="2"&&(me="6"),{codecString:`hvc1.${ne}${a}.${me}.${s?"H":"L"}${v}.B0`,params:{general_tier_flag:s,general_profile_idc:a,general_profile_space:i,general_profile_compatibility_flags:[o,l,c,u],general_constraint_indicator_flags:[d,f,h,p,g,m],general_level_idc:v,bit_depth:R+8,bit_depth_luma_minus8:R,bit_depth_chroma_minus8:D,min_spatial_segmentation_idc:G,chroma_format_idc:w,frame_rate:{fixed:ee,fps:J/H}},width:Z,height:re,pixelRatio:[B,K]}}readPPS(e){const r=new gd(this.ebsp2rbsp(e));r.readUByte(),r.readUByte(),r.skipUEG(),r.skipUEG(),r.skipBits(2),r.skipBits(3),r.skipBits(2),r.skipUEG(),r.skipUEG(),r.skipEG(),r.skipBits(2),r.readBoolean()&&r.skipUEG(),r.skipEG(),r.skipEG(),r.skipBits(4);const i=r.readBoolean(),s=r.readBoolean();let a=1;return s&&i?a=0:s?a=3:i&&(a=2),{parallelismType:a}}matchSPS(e,r){return String.fromCharCode.apply(null,e).substr(3)===String.fromCharCode.apply(null,r).substr(3)}}const er=188;class qs{constructor(e,r,n,i){this.logger=void 0,this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.sampleAes=null,this.pmtParsed=!1,this.audioCodec=void 0,this.videoCodec=void 0,this._pmtId=-1,this._videoTrack=void 0,this._audioTrack=void 0,this._id3Track=void 0,this._txtTrack=void 0,this.aacOverFlow=null,this.remainderData=null,this.videoParser=void 0,this.observer=e,this.config=r,this.typeSupported=n,this.logger=i,this.videoParser=null}static probe(e,r){const n=qs.syncOffset(e);return n>0&&r.warn(`MPEG2-TS detected but first sync word found @ offset ${n}`),n!==-1}static syncOffset(e){const r=e.length;let n=Math.min(er*5,r-er)+1,i=0;for(;i<n;){let s=!1,a=-1,o=0;for(let l=i;l<r;l+=er)if(e[l]===71&&(r-l===er||e[l+er]===71)){if(o++,a===-1&&(a=l,a!==0&&(n=Math.min(a+er*99,e.length-er)+1)),s||(s=mw(e,l)===0),s&&o>1&&(a===0&&o>2||l+er>n))return a}else{if(o)return-1;break}i++}return-1}static createTrack(e,r){return{container:e==="video"||e==="audio"?"video/mp2t":void 0,type:e,id:uj[e],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:e==="audio"?r:void 0}}resetInitSegment(e,r,n,i){this.pmtParsed=!1,this._pmtId=-1,this._videoTrack=qs.createTrack("video"),this._videoTrack.duration=i,this._audioTrack=qs.createTrack("audio",i),this._id3Track=qs.createTrack("id3"),this._txtTrack=qs.createTrack("text"),this._audioTrack.segmentCodec="aac",this.videoParser=null,this.aacOverFlow=null,this.remainderData=null,this.audioCodec=r,this.videoCodec=n}resetTimeStamp(){}resetContiguity(){const{_audioTrack:e,_videoTrack:r,_id3Track:n}=this;e&&(e.pesData=null),r&&(r.pesData=null),n&&(n.pesData=null),this.aacOverFlow=null,this.remainderData=null}demux(e,r,n=!1,i=!1){n||(this.sampleAes=null);let s;const a=this._videoTrack,o=this._audioTrack,l=this._id3Track,c=this._txtTrack;let u=a.pid,d=a.pesData,f=o.pid,h=l.pid,p=o.pesData,g=l.pesData,m=null,v=this.pmtParsed,y=this._pmtId,b=e.length;if(this.remainderData&&(e=kn(this.remainderData,e),b=e.length,this.remainderData=null),b<er&&!i)return this.remainderData=e,{audioTrack:o,videoTrack:a,id3Track:l,textTrack:c};const w=Math.max(0,qs.syncOffset(e));b-=(b-w)%er,b<e.byteLength&&!i&&(this.remainderData=new Uint8Array(e.buffer,b,e.buffer.byteLength-b));let S=0;for(let _=w;_<b;_+=er)if(e[_]===71){const A=!!(e[_+1]&64),P=mw(e,_),C=(e[_+3]&48)>>4;let O;if(C>1){if(O=_+5+e[_+4],O===_+er)continue}else O=_+4;switch(P){case u:A&&(d&&(s=dl(d,this.logger))&&(this.readyVideoParser(a.segmentCodec),this.videoParser!==null&&this.videoParser.parsePES(a,c,s,!1)),d={data:[],size:0}),d&&(d.data.push(e.subarray(O,_+er)),d.size+=_+er-O);break;case f:if(A){if(p&&(s=dl(p,this.logger)))switch(o.segmentCodec){case"aac":this.parseAACPES(o,s);break;case"mp3":this.parseMPEGPES(o,s);break;case"ac3":this.parseAC3PES(o,s);break}p={data:[],size:0}}p&&(p.data.push(e.subarray(O,_+er)),p.size+=_+er-O);break;case h:A&&(g&&(s=dl(g,this.logger))&&this.parseID3PES(l,s),g={data:[],size:0}),g&&(g.data.push(e.subarray(O,_+er)),g.size+=_+er-O);break;case 0:A&&(O+=e[O]+1),y=this._pmtId=WX(e,O);break;case y:{A&&(O+=e[O]+1);const R=VX(e,O,this.typeSupported,n,this.observer,this.logger);u=R.videoPid,u>0&&(a.pid=u,a.segmentCodec=R.segmentVideoCodec),f=R.audioPid,f>0&&(o.pid=f,o.segmentCodec=R.segmentAudioCodec),h=R.id3Pid,h>0&&(l.pid=h),m!==null&&!v&&(this.logger.warn(`MPEG-TS PMT found at ${_} after unknown PID '${m}'. Backtracking to sync byte @${w} to parse all TS packets.`),m=null,_=w-188),v=this.pmtParsed=!0;break}case 17:case 8191:break;default:m=P;break}}else S++;S>0&&gw(this.observer,new Error(`Found ${S} TS packet/s that do not start with 0x47`),void 0,this.logger),a.pesData=d,o.pesData=p,l.pesData=g;const T={audioTrack:o,videoTrack:a,id3Track:l,textTrack:c};return i&&this.extractRemainingSamples(T),T}flush(){const{remainderData:e}=this;this.remainderData=null;let r;return e?r=this.demux(e,-1,!1,!0):r={videoTrack:this._videoTrack,audioTrack:this._audioTrack,id3Track:this._id3Track,textTrack:this._txtTrack},this.extractRemainingSamples(r),this.sampleAes?this.decrypt(r,this.sampleAes):r}extractRemainingSamples(e){const{audioTrack:r,videoTrack:n,id3Track:i,textTrack:s}=e,a=n.pesData,o=r.pesData,l=i.pesData;let c;if(a&&(c=dl(a,this.logger))?(this.readyVideoParser(n.segmentCodec),this.videoParser!==null&&(this.videoParser.parsePES(n,s,c,!0),n.pesData=null)):n.pesData=a,o&&(c=dl(o,this.logger))){switch(r.segmentCodec){case"aac":this.parseAACPES(r,c);break;case"mp3":this.parseMPEGPES(r,c);break;case"ac3":this.parseAC3PES(r,c);break}r.pesData=null}else o!=null&&o.size&&this.logger.log("last AAC PES packet truncated,might overlap between fragments"),r.pesData=o;l&&(c=dl(l,this.logger))?(this.parseID3PES(i,c),i.pesData=null):i.pesData=l}demuxSampleAes(e,r,n){const i=this.demux(e,n,!0,!this.config.progressive),s=this.sampleAes=new BX(this.observer,this.config,r);return this.decrypt(i,s)}readyVideoParser(e){this.videoParser===null&&(e==="avc"?this.videoParser=new UX:e==="hevc"&&(this.videoParser=new GX))}decrypt(e,r){return new Promise(n=>{const{audioTrack:i,videoTrack:s}=e;i.samples&&i.segmentCodec==="aac"?r.decryptAacSamples(i.samples,0,()=>{s.samples?r.decryptAvcSamples(s.samples,0,0,()=>{n(e)}):n(e)}):s.samples&&r.decryptAvcSamples(s.samples,0,0,()=>{n(e)})})}destroy(){this.observer&&this.observer.removeAllListeners(),this.config=this.logger=this.observer=null,this.aacOverFlow=this.videoParser=this.remainderData=this.sampleAes=null,this._videoTrack=this._audioTrack=this._id3Track=this._txtTrack=void 0}parseAACPES(e,r){let n=0;const i=this.aacOverFlow;let s=r.data;if(i){this.aacOverFlow=null;const d=i.missing,f=i.sample.unit.byteLength;if(d===-1)s=kn(i.sample.unit,s);else{const h=f-d;i.sample.unit.set(s.subarray(0,d),h),e.samples.push(i.sample),n=i.missing}}let a,o;for(a=n,o=s.length;a<o-1&&!Vm(s,a);a++);if(a!==n){let d;const f=a<o-1;if(f?d=`AAC PES did not start with ADTS header,offset:${a}`:d="No ADTS header found in AAC PES",gw(this.observer,new Error(d),f,this.logger),!f)return}zj(e,this.observer,s,a,this.audioCodec);let l;if(r.pts!==void 0)l=r.pts;else if(i){const d=qj(e.samplerate);l=i.sample.pts+d}else{this.logger.warn("[tsdemuxer]: AAC PES unknown PTS");return}let c=0,u;for(;a<o;)if(u=Yj(e,s,a,l,c),a+=u.length,u.missing){this.aacOverFlow=u;break}else for(c++;a<o-1&&!Vm(s,a);a++);}parseMPEGPES(e,r){const n=r.data,i=n.length;let s=0,a=0;const o=r.pts;if(o===void 0){this.logger.warn("[tsdemuxer]: MPEG PES unknown PTS");return}for(;a<i;)if(e2(n,a)){const l=Jj(e,n,a,o,s);if(l)a+=l.length,s++;else break}else a++}parseAC3PES(e,r){{const n=r.data,i=r.pts;if(i===void 0){this.logger.warn("[tsdemuxer]: AC3 PES unknown PTS");return}const s=n.length;let a=0,o=0,l;for(;o<s&&(l=n2(e,n,o,i,a++))>0;)o+=l}}parseID3PES(e,r){if(r.pts===void 0){this.logger.warn("[tsdemuxer]: ID3 PES unknown PTS");return}const n=et({},r,{type:this._videoTrack?an.emsg:an.audioId3,duration:Number.POSITIVE_INFINITY});e.samples.push(n)}}function mw(t,e){return((t[e+1]&31)<<8)+t[e+2]}function WX(t,e){return(t[e+10]&31)<<8|t[e+11]}function VX(t,e,r,n,i,s){const a={audioPid:-1,videoPid:-1,id3Pid:-1,segmentVideoCodec:"avc",segmentAudioCodec:"aac"},o=(t[e+1]&15)<<8|t[e+2],l=e+3+o-4,c=(t[e+10]&15)<<8|t[e+11];for(e+=12+c;e<l;){const u=mw(t,e),d=(t[e+3]&15)<<8|t[e+4];switch(t[e]){case 207:if(!n){O0("ADTS AAC",s);break}case 15:a.audioPid===-1&&(a.audioPid=u);break;case 21:a.id3Pid===-1&&(a.id3Pid=u);break;case 219:if(!n){O0("H.264",s);break}case 27:a.videoPid===-1&&(a.videoPid=u);break;case 3:case 4:!r.mpeg&&!r.mp3?s.log("MPEG audio found, not supported in this browser"):a.audioPid===-1&&(a.audioPid=u,a.segmentAudioCodec="mp3");break;case 193:if(!n){O0("AC-3",s);break}case 129:r.ac3?a.audioPid===-1&&(a.audioPid=u,a.segmentAudioCodec="ac3"):s.log("AC-3 audio found, not supported in this browser");break;case 6:if(a.audioPid===-1&&d>0){let f=e+5,h=d;for(;h>2;){switch(t[f]){case 106:r.ac3!==!0?s.log("AC-3 audio found, not supported in this browser for now"):(a.audioPid=u,a.segmentAudioCodec="ac3");break}const g=t[f+1]+2;f+=g,h-=g}}break;case 194:case 135:return gw(i,new Error("Unsupported EC-3 in M2TS found"),void 0,s),a;case 36:a.videoPid===-1&&(a.videoPid=u,a.segmentVideoCodec="hevc",s.log("HEVC in M2TS found"));break}e+=d+5}return a}function gw(t,e,r,n){n.warn(`parsing error: ${e.message}`),t.emit(I.ERROR,I.ERROR,{type:fe.MEDIA_ERROR,details:V.FRAG_PARSING_ERROR,fatal:!1,levelRetry:r,error:e,reason:e.message})}function O0(t,e){e.log(`${t} with AES-128-CBC encryption found in unencrypted stream`)}function dl(t,e){let r=0,n,i,s,a,o;const l=t.data;if(!t||t.size===0)return null;for(;l[0].length<19&&l.length>1;)l[0]=kn(l[0],l[1]),l.splice(1,1);if(n=l[0],(n[0]<<16)+(n[1]<<8)+n[2]===1){if(i=(n[4]<<8)+n[5],i&&i>t.size-6)return null;const u=n[7];u&192&&(a=(n[9]&14)*536870912+(n[10]&255)*4194304+(n[11]&254)*16384+(n[12]&255)*128+(n[13]&254)/2,u&64?(o=(n[14]&14)*536870912+(n[15]&255)*4194304+(n[16]&254)*16384+(n[17]&255)*128+(n[18]&254)/2,a-o>60*9e4&&(e.warn(`${Math.round((a-o)/9e4)}s delta between PTS and DTS, align them`),a=o)):o=a),s=n[8];let d=s+9;if(t.size<=d)return null;t.size-=d;const f=new Uint8Array(t.size);for(let h=0,p=l.length;h<p;h++){n=l[h];let g=n.byteLength;if(d)if(d>g){d-=g;continue}else n=n.subarray(d),g-=d,d=0;f.set(n,r),r+=g}return i&&(i-=s+3),{data:f,pts:a,dts:o,len:i}}return null}class HX{static getSilentFrame(e,r){switch(e){case"mp4a.40.2":if(r===1)return new Uint8Array([0,200,0,128,35,128]);if(r===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(r===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(r===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(r===5)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,56]);if(r===6)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,0,178,0,32,8,224]);break;default:if(r===1)return new Uint8Array([1,64,34,128,163,78,230,128,186,8,0,0,0,28,6,241,193,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(r===2)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(r===3)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);break}}}const Fs=Math.pow(2,32)-1;class W{static init(){W.types={avc1:[],avcC:[],hvc1:[],hvcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],".mp3":[],dac3:[],"ac-3":[],mvex:[],mvhd:[],pasp:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[]};let e;for(e in W.types)W.types.hasOwnProperty(e)&&(W.types[e]=[e.charCodeAt(0),e.charCodeAt(1),e.charCodeAt(2),e.charCodeAt(3)]);
vendor: 4,724 bytes, line 265
265const r=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),n=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]);W.HDLR_TYPES={video:r,audio:n};const i=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),s=new Uint8Array([0,0,0,0,0,0,0,0]);W.STTS=W.STSC=W.STCO=s,W.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),W.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),W.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),W.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);const a=new Uint8Array([105,115,111,109]),o=new Uint8Array([97,118,99,49]),l=new Uint8Array([0,0,0,1]);W.FTYP=W.box(W.types.ftyp,a,l,a,o),W.DINF=W.box(W.types.dinf,W.box(W.types.dref,i))}static box(e,...r){let n=8,i=r.length;const s=i;for(;i--;)n+=r[i].byteLength;const a=new Uint8Array(n);for(a[0]=n>>24&255,a[1]=n>>16&255,a[2]=n>>8&255,a[3]=n&255,a.set(e,4),i=0,n=8;i<s;i++)a.set(r[i],n),n+=r[i].byteLength;return a}static hdlr(e){return W.box(W.types.hdlr,W.HDLR_TYPES[e])}static mdat(e){return W.box(W.types.mdat,e)}static mdhd(e,r){r*=e;const n=Math.floor(r/(Fs+1)),i=Math.floor(r%(Fs+1));return W.box(W.types.mdhd,new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,e>>24&255,e>>16&255,e>>8&255,e&255,n>>24,n>>16&255,n>>8&255,n&255,i>>24,i>>16&255,i>>8&255,i&255,85,196,0,0]))}static mdia(e){return W.box(W.types.mdia,W.mdhd(e.timescale||0,e.duration||0),W.hdlr(e.type),W.minf(e))}static mfhd(e){return W.box(W.types.mfhd,new Uint8Array([0,0,0,0,e>>24,e>>16&255,e>>8&255,e&255]))}static minf(e){return e.type==="audio"?W.box(W.types.minf,W.box(W.types.smhd,W.SMHD),W.DINF,W.stbl(e)):W.box(W.types.minf,W.box(W.types.vmhd,W.VMHD),W.DINF,W.stbl(e))}static moof(e,r,n){return W.box(W.types.moof,W.mfhd(e),W.traf(n,r))}static moov(e){let r=e.length;const n=[];for(;r--;)n[r]=W.trak(e[r]);return W.box.apply(null,[W.types.moov,W.mvhd(e[0].timescale||0,e[0].duration||0)].concat(n).concat(W.mvex(e)))}static mvex(e){let r=e.length;const n=[];for(;r--;)n[r]=W.trex(e[r]);return W.box.apply(null,[W.types.mvex,...n])}static mvhd(e,r){r*=e;const n=Math.floor(r/(Fs+1)),i=Math.floor(r%(Fs+1)),s=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,e>>24&255,e>>16&255,e>>8&255,e&255,n>>24,n>>16&255,n>>8&255,n&255,i>>24,i>>16&255,i>>8&255,i&255,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return W.box(W.types.mvhd,s)}static sdtp(e){const r=e.samples||[],n=new Uint8Array(4+r.length);let i,s;for(i=0;i<r.length;i++)s=r[i].flags,n[i+4]=s.dependsOn<<4|s.isDependedOn<<2|s.hasRedundancy;return W.box(W.types.sdtp,n)}static stbl(e){return W.box(W.types.stbl,W.stsd(e),W.box(W.types.stts,W.STTS),W.box(W.types.stsc,W.STSC),W.box(W.types.stsz,W.STSZ),W.box(W.types.stco,W.STCO))}static avc1(e){let r=[],n=[],i,s,a;for(i=0;i<e.sps.length;i++)s=e.sps[i],a=s.byteLength,r.push(a>>>8&255),r.push(a&255),r=r.concat(Array.prototype.slice.call(s));for(i=0;i<e.pps.length;i++)s=e.pps[i],a=s.byteLength,n.push(a>>>8&255),n.push(a&255),n=n.concat(Array.prototype.slice.call(s));const o=W.box(W.types.avcC,new Uint8Array([1,r[3],r[4],r[5],255,224|e.sps.length].concat(r).concat([e.pps.length]).concat(n))),l=e.width,c=e.height,u=e.pixelRatio[0],d=e.pixelRatio[1];return W.box(W.types.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,l>>8&255,l&255,c>>8&255,c&255,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),o,W.box(W.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),W.box(W.types.pasp,new Uint8Array([u>>24,u>>16&255,u>>8&255,u&255,d>>24,d>>16&255,d>>8&255,d&255])))}static esds(e){const r=e.config;return new Uint8Array([0,0,0,0,3,25,0,1,0,4,17,64,21,0,0,0,0,0,0,0,0,0,0,0,5,2,...r,6,1,2])}static audioStsd(e){const r=e.samplerate||0;return new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,e.channelCount||0,0,16,0,0,0,0,r>>8&255,r&255,0,0])}static mp4a(e){return W.box(W.types.mp4a,W.audioStsd(e),W.box(W.types.esds,W.esds(e)))}static mp3(e){return W.box(W.types[".mp3"],W.audioStsd(e))}static ac3(e){return W.box(W.types["ac-3"],W.audioStsd(e),W.box(W.types.dac3,e.config))}static stsd(e){const{segmentCodec:r}=e;if(e.type==="audio"){if(r==="aac")return W.box(W.types.stsd,W.STSD,W.mp4a(e));if(r==="ac3"&&e.config)return W.box(W.types.stsd,W.STSD,W.ac3(e));if(r==="mp3"&&e.codec==="mp3")return W.box(W.types.stsd,W.STSD,W.mp3(e))}else if(e.pps&&e.sps){if(r==="avc")return W.box(W.types.stsd,W.STSD,W.avc1(e));if(r==="hevc"&&e.vps)return W.box(W.types.stsd,W.STSD,W.hvc1(e))}
vendor: 4,087 bytes, line 265
265else throw new Error("video track missing pps or sps");throw new Error(`unsupported ${e.type} segment codec (${r}/${e.codec})`)}static tkhd(e){const r=e.id,n=(e.duration||0)*(e.timescale||0),i=e.width||0,s=e.height||0,a=Math.floor(n/(Fs+1)),o=Math.floor(n%(Fs+1));return W.box(W.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,r>>24&255,r>>16&255,r>>8&255,r&255,0,0,0,0,a>>24,a>>16&255,a>>8&255,a&255,o>>24,o>>16&255,o>>8&255,o&255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,i>>8&255,i&255,0,0,s>>8&255,s&255,0,0]))}static traf(e,r){const n=W.sdtp(e),i=e.id,s=Math.floor(r/(Fs+1)),a=Math.floor(r%(Fs+1));return W.box(W.types.traf,W.box(W.types.tfhd,new Uint8Array([0,0,0,0,i>>24,i>>16&255,i>>8&255,i&255])),W.box(W.types.tfdt,new Uint8Array([1,0,0,0,s>>24,s>>16&255,s>>8&255,s&255,a>>24,a>>16&255,a>>8&255,a&255])),W.trun(e,n.length+16+20+8+16+8+8),n)}static trak(e){return e.duration=e.duration||4294967295,W.box(W.types.trak,W.tkhd(e),W.mdia(e))}static trex(e){const r=e.id;return W.box(W.types.trex,new Uint8Array([0,0,0,0,r>>24,r>>16&255,r>>8&255,r&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))}static trun(e,r){const n=e.samples||[],i=n.length,s=12+16*i,a=new Uint8Array(s);let o,l,c,u,d,f;for(r+=8+s,a.set([e.type==="video"?1:0,0,15,1,i>>>24&255,i>>>16&255,i>>>8&255,i&255,r>>>24&255,r>>>16&255,r>>>8&255,r&255],0),o=0;o<i;o++)l=n[o],c=l.duration,u=l.size,d=l.flags,f=l.cts,a.set([c>>>24&255,c>>>16&255,c>>>8&255,c&255,u>>>24&255,u>>>16&255,u>>>8&255,u&255,d.isLeading<<2|d.dependsOn,d.isDependedOn<<6|d.hasRedundancy<<4|d.paddingValue<<1|d.isNonSync,d.degradPrio&61440,d.degradPrio&15,f>>>24&255,f>>>16&255,f>>>8&255,f&255],12+16*o);return W.box(W.types.trun,a)}static initSegment(e){W.types||W.init();const r=W.moov(e);return kn(W.FTYP,r)}static hvc1(e){const r=e.params,n=[e.vps,e.sps,e.pps],i=4,s=new Uint8Array([1,r.general_profile_space<<6|(r.general_tier_flag?32:0)|r.general_profile_idc,r.general_profile_compatibility_flags[0],r.general_profile_compatibility_flags[1],r.general_profile_compatibility_flags[2],r.general_profile_compatibility_flags[3],r.general_constraint_indicator_flags[0],r.general_constraint_indicator_flags[1],r.general_constraint_indicator_flags[2],r.general_constraint_indicator_flags[3],r.general_constraint_indicator_flags[4],r.general_constraint_indicator_flags[5],r.general_level_idc,240|r.min_spatial_segmentation_idc>>8,255&r.min_spatial_segmentation_idc,252|r.parallelismType,252|r.chroma_format_idc,248|r.bit_depth_luma_minus8,248|r.bit_depth_chroma_minus8,0,parseInt(r.frame_rate.fps),i-1|r.temporal_id_nested<<2|r.num_temporal_layers<<3|(r.frame_rate.fixed?64:0),n.length]);let a=s.length;for(let p=0;p<n.length;p+=1){a+=3;for(let g=0;g<n[p].length;g+=1)a+=2+n[p][g].length}const o=new Uint8Array(a);o.set(s,0),a=s.length;const l=n.length-1;for(let p=0;p<n.length;p+=1){o.set(new Uint8Array([32+p|(p===l?128:0),0,n[p].length]),a),a+=3;for(let g=0;g<n[p].length;g+=1)o.set(new Uint8Array([n[p][g].length>>8,n[p][g].length&255]),a),a+=2,o.set(n[p][g],a),a+=n[p][g].length}const c=W.box(W.types.hvcC,o),u=e.width,d=e.height,f=e.pixelRatio[0],h=e.pixelRatio[1];return W.box(W.types.hvc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,u>>8&255,u&255,d>>8&255,d&255,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),c,W.box(W.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),W.box(W.types.pasp,new Uint8Array([f>>24,f>>16&255,f>>8&255,f&255,h>>24,h>>16&255,h>>8&255,h&255])))}}W.types=void 0;W.HDLR_TYPES=void 0;W.STTS=void 0;W.STSC=void 0;W.STCO=void 0;W.STSZ=void 0;W.VMHD=void 0;W.SMHD=void 0;W.STSD=void 0;W.FTYP=void 0;W.DINF=void 0;const s2=9e4;function GT(t,e,r=1,n=!1){const i=t*e*r;return n?Math.round(i):i}function KX(t,e,r=1,n=!1){return GT(t,e,1/r,n)}function Du(t,e=!1){return GT(t,1e3,1/s2,e)}function zX(t,e=1){return GT(t,s2,1/e)}function kI(t){const{baseTime:e,timescale:r,trackId:n}=t;return`${e/r} (${e}/${r}) trackId: ${n}`}
vendor: 18,559 bytes, line 265
265const qX=10*1e3,YX=1024,XX=1152,QX=1536;let fl=null,R0=null;function LI(t,e,r,n){return{duration:e,size:r,cts:n,flags:{isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,dependsOn:t?2:1,isNonSync:t?0:1}}}class Vp extends Dn{constructor(e,r,n,i){if(super("mp4-remuxer",i),this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.ISGenerated=!1,this._initPTS=null,this._initDTS=null,this.nextVideoTs=null,this.nextAudioTs=null,this.videoSampleDuration=null,this.isAudioContiguous=!1,this.isVideoContiguous=!1,this.videoTrackConfig=void 0,this.observer=e,this.config=r,this.typeSupported=n,this.ISGenerated=!1,fl===null){const a=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);fl=a?parseInt(a[1]):0}if(R0===null){const s=navigator.userAgent.match(/Safari\/(\d+)/i);R0=s?parseInt(s[1]):0}}destroy(){this.config=this.videoTrackConfig=this._initPTS=this._initDTS=null}resetTimeStamp(e){const r=this._initPTS;(!r||!e||e.trackId!==r.trackId||e.baseTime!==r.baseTime||e.timescale!==r.timescale)&&this.log(`Reset initPTS: ${r&&kI(r)} > ${e&&kI(e)}`),this._initPTS=this._initDTS=e}resetNextTimestamp(){this.log("reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1}resetInitSegment(){this.log("ISGenerated flag reset"),this.ISGenerated=!1,this.videoTrackConfig=void 0}getVideoStartPts(e){let r=!1;const n=e[0].pts,i=e.reduce((s,a)=>{let o=a.pts,l=o-s;return l<-4294967296&&(r=!0,o=en(o,n),l=o-s),l>0?s:o},n);return r&&this.debug("PTS rollover detected"),i}remux(e,r,n,i,s,a,o,l){let c,u,d,f,h,p,g=s,m=s;const v=e.pid>-1,y=r.pid>-1,b=r.samples.length,w=e.samples.length>0,S=o&&b>0||b>1;if((!v||w)&&(!y||S)||this.ISGenerated||o){if(this.ISGenerated){var _,A,P,C;const L=this.videoTrackConfig;(L&&(r.width!==L.width||r.height!==L.height||((_=r.pixelRatio)==null?void 0:_[0])!==((A=L.pixelRatio)==null?void 0:A[0])||((P=r.pixelRatio)==null?void 0:P[1])!==((C=L.pixelRatio)==null?void 0:C[1]))||!L&&S||this.nextAudioTs===null&&w)&&this.resetInitSegment()}this.ISGenerated||(d=this.generateIS(e,r,s,a));const O=this.isVideoContiguous;let R=-1,D;if(S&&(R=JX(r.samples),!O&&this.config.forceKeyFrameOnDiscontinuity))if(p=!0,R>0){this.warn(`Dropped ${R} out of ${b} video samples due to a missing keyframe`);const L=this.getVideoStartPts(r.samples);r.samples=r.samples.slice(R),r.dropped+=R,m+=(r.samples[0].pts-L)/r.inputTimeScale,D=m}else R===-1&&(this.warn(`No keyframe found out of ${b} video samples`),p=!1);if(this.ISGenerated){if(w&&S){const L=this.getVideoStartPts(r.samples),M=(en(e.samples[0].pts,L)-L)/r.inputTimeScale;g+=Math.max(0,M),m+=Math.max(0,-M)}if(w){if(e.samplerate||(this.warn("regenerate InitSegment as audio detected"),d=this.generateIS(e,r,s,a)),u=this.remuxAudio(e,g,this.isAudioContiguous,a,y||S||l===oe.AUDIO?m:void 0),S){const L=u?u.endPTS-u.startPTS:0;r.inputTimeScale||(this.warn("regenerate InitSegment as video detected"),d=this.generateIS(e,r,s,a)),c=this.remuxVideo(r,m,O,L)}}else S&&(c=this.remuxVideo(r,m,O,0));c&&(c.firstKeyFrame=R,c.independent=R!==-1,c.firstKeyFramePTS=D)}}return this.ISGenerated&&this._initPTS&&this._initDTS&&(n.samples.length&&(h=a2(n,s,this._initPTS,this._initDTS)),i.samples.length&&(f=o2(i,s,this._initPTS))),{audio:u,video:c,initSegment:d,independent:p,text:f,id3:h}}computeInitPts(e,r,n,i){const s=Math.round(n*r);let a=en(e,s);if(a<s+r)for(this.log(`Adjusting PTS for rollover in timeline near ${(s-a)/r} ${i}`);a<s+r;)a+=8589934592;return a-s}generateIS(e,r,n,i){const s=e.samples,a=r.samples,o=this.typeSupported,l={},c=this._initPTS;let u=!c||i,d="audio/mp4",f,h,p,g=-1;if(u&&(f=h=1/0),e.config&&s.length){switch(e.timescale=e.samplerate,e.segmentCodec){case"mp3":o.mpeg?(d="audio/mpeg",e.codec=""):o.mp3&&(e.codec="mp3");break;case"ac3":e.codec="ac-3";break}l.audio={id:"audio",container:d,codec:e.codec,initSegment:e.segmentCodec==="mp3"&&o.mpeg?new Uint8Array(0):W.initSegment([e]),metadata:{channelCount:e.channelCount}},u&&(g=e.id,p=e.inputTimeScale,!c||p!==c.timescale?f=h=this.computeInitPts(s[0].pts,p,n,"audio"):u=!1)}if(r.sps&&r.pps&&a.length){if(r.timescale=r.inputTimeScale,l.video={id:"main",container:"video/mp4",codec:r.codec,initSegment:W.initSegment([r]),metadata:{width:r.width,height:r.height}},u)if(g=r.id,p=r.inputTimeScale,!c||p!==c.timescale){const m=this.getVideoStartPts(a),v=en(a[0].dts,m),y=this.computeInitPts(v,p,n,"video"),b=this.computeInitPts(m,p,n,"video");h=Math.min(h,y),f=Math.min(f,b)}else u=!1;this.videoTrackConfig={width:r.width,height:r.height,pixelRatio:r.pixelRatio}}if(Object.keys(l).length)return this.ISGenerated=!0,u?(c&&this.warn(`Timestamps at playlist time: ${i?"":"~"}${n} ${f/p} != initPTS: ${c.baseTime/c.timescale} (${c.baseTime}/${c.timescale}) trackId: ${c.trackId}`),this.log(`Found initPTS at playlist time: ${n} offset: ${f/p} (${f}/${p}) trackId: ${g}`),this._initPTS={baseTime:f,timescale:p,trackId:g},this._initDTS={baseTime:h,timescale:p,trackId:g}):f=p=void 0,{tracks:l,initPTS:f,timescale:p,trackId:g}}remuxVideo(e,r,n,i){const s=e.inputTimeScale,a=e.samples,o=[],l=a.length,c=this._initPTS,u=c.baseTime*s/c.timescale;let d=this.nextVideoTs,f=8,h=this.videoSampleDuration,p,g,m=Number.POSITIVE_INFINITY,v=Number.NEGATIVE_INFINITY,y=!1;if(!n||d===null){const G=u+r*s,B=a[0].pts-en(a[0].dts,a[0].pts);fl&&d!==null&&Math.abs(G-B-(d+u))<15e3?n=!0:d=G-B-u}const b=d+u;for(let G=0;G<l;G++){const B=a[G];B.pts=en(B.pts,b),B.dts=en(B.dts,b),B.dts<a[G>0?G-1:G].dts&&(y=!0)}y&&a.sort(function(G,B){const K=G.dts-B.dts,ee=G.pts-B.pts;return K||ee}),p=a[0].dts,g=a[a.length-1].dts;const w=g-p,S=w?Math.round(w/(l-1)):h||e.inputTimeScale/30;if(n){const G=p-b,B=G>S,K=G<-1;if((B||K)&&(B?this.warn(`${(e.segmentCodec||"").toUpperCase()}: ${Du(G,!0)} ms (${G}dts) hole between fragments detected at ${r.toFixed(3)}`):this.warn(`${(e.segmentCodec||"").toUpperCase()}: ${Du(-G,!0)} ms (${G}dts) overlapping between fragments detected at ${r.toFixed(3)}`),!K||b>=a[0].pts||fl)){p=b;const ee=a[0].pts-G;if(B)a[0].dts=p,a[0].pts=ee;else{let H=!0;for(let J=0;J<a.length&&!(a[J].dts>ee&&H);J++){const q=a[J].pts;if(a[J].dts-=G,a[J].pts-=G,J<a.length-1){const ie=a[J+1].pts,Z=a[J].pts,re=ie<=Z,ne=ie<=q;H=re==ne}}}this.log(`Video: Initial PTS/DTS adjusted: ${Du(ee,!0)}/${Du(p,!0)}, delta: ${Du(G,!0)} ms`)}}p=Math.max(0,p);let T=0,_=0,A=p;for(let G=0;G<l;G++){const B=a[G],K=B.units,ee=K.length;let H=0;for(let J=0;J<ee;J++)H+=K[J].data.length;_+=H,T+=ee,B.length=H,B.dts<A?(B.dts=A,A+=S/4|0||1):A=B.dts,m=Math.min(B.pts,m),v=Math.max(B.pts,v)}g=a[l-1].dts;const P=_+4*T+8;let C;try{C=new Uint8Array(P)}catch(G){this.observer.emit(I.ERROR,I.ERROR,{type:fe.MUX_ERROR,details:V.REMUX_ALLOC_ERROR,fatal:!1,error:G,bytes:P,reason:`fail allocating video mdat ${P}`});return}const O=new DataView(C.buffer);O.setUint32(0,P),C.set(W.types.mdat,4);let R=!1,D=Number.POSITIVE_INFINITY,L=Number.POSITIVE_INFINITY,j=Number.NEGATIVE_INFINITY,M=Number.NEGATIVE_INFINITY;for(let G=0;G<l;G++){const B=a[G],K=B.units;let ee=0;for(let q=0,ie=K.length;q<ie;q++){const Z=K[q],re=Z.data,ne=Z.data.byteLength;O.setUint32(f,ne),f+=4,C.set(re,f),f+=ne,ee+=4+ne}let H;if(G<l-1)h=a[G+1].dts-B.dts,H=a[G+1].pts-B.pts;else{const q=this.config,ie=G>0?B.dts-a[G-1].dts:S;if(H=G>0?B.pts-a[G-1].pts:S,q.stretchShortVideoTrack&&this.nextAudioTs!==null){const Z=Math.floor(q.maxBufferHole*s),re=(i?m+i*s:this.nextAudioTs+u)-B.pts;re>Z?(h=re-ie,h<0?h=ie:R=!0,this.log(`It is approximately ${re/90} ms to the next segment; using duration ${h/90} ms for the last video frame.`)):h=ie}else h=ie}const J=Math.round(B.pts-B.dts);D=Math.min(D,h),j=Math.max(j,h),L=Math.min(L,H),M=Math.max(M,H),o.push(LI(B.key,h,ee,J))}if(o.length){if(fl){if(fl<70){const G=o[0].flags;G.dependsOn=2,G.isNonSync=0}}else if(R0&&M-L<j-D&&S/j<.025&&o[0].cts===0){this.warn("Found irregular gaps in sample duration. Using PTS instead of DTS to determine MP4 sample duration.");let G=p;for(let B=0,K=o.length;B<K;B++){const ee=G+o[B].duration,H=G+o[B].cts;if(B<K-1){const J=ee+o[B+1].cts;o[B].duration=J-H}else o[B].duration=B?o[B-1].duration:S;o[B].cts=0,G=ee}}}h=R||!h?S:h;const N=g+h;this.nextVideoTs=d=N-u,this.videoSampleDuration=h,this.isVideoContiguous=!0;const U={data1:W.moof(e.sequenceNumber++,p,et(e,{samples:o})),data2:C,startPTS:(m-u)/s,endPTS:(v+h-u)/s,startDTS:(p-u)/s,endDTS:d/s,type:"video",hasAudio:!1,hasVideo:!0,nb:o.length,dropped:e.dropped};return e.samples=[],e.dropped=0,U}getSamplesPerFrame(e){switch(e.segmentCodec){case"mp3":return XX;case"ac3":return QX;default:return YX}}remuxAudio(e,r,n,i,s){const a=e.inputTimeScale,o=e.samplerate?e.samplerate:a,l=a/o,c=this.getSamplesPerFrame(e),u=c*l,d=this._initPTS,f=e.segmentCodec==="mp3"&&this.typeSupported.mpeg,h=[],p=s!==void 0;let g=e.samples,m=f?0:8,v=this.nextAudioTs||-1;const y=d.baseTime*a/d.timescale,b=y+r*a;if(this.isAudioContiguous=n=n||g.length&&v>0&&(i&&Math.abs(b-(v+y))<9e3||Math.abs(en(g[0].pts,b)-(v+y))<20*u),g.forEach(function(M){M.pts=en(M.pts,b)}),!n||v<0){const M=g.length;if(g=g.filter(N=>N.pts>=0),M!==g.length&&this.warn(`Removed ${g.length-M} of ${M} samples (initPTS ${y} / ${a})`),!g.length)return;s===0?v=0:i&&!p?v=Math.max(0,b-y):v=g[0].pts-y}if(e.segmentCodec==="aac"){const M=this.config.maxAudioFramesDrift;for(let N=0,k=v+y;N<g.length;N++){const $=g[N],U=$.pts,G=U-k,B=Math.abs(1e3*G/a);if(G<=-M*u&&p)N===0&&(this.warn(`Audio frame @ ${(U/a).toFixed(3)}s overlaps marker by ${Math.round(1e3*G/a)} ms.`),this.nextAudioTs=v=U-y,k=U);else if(G>=M*u&&B<qX&&p){let K=Math.round(G/u);for(k=U-K*u;k<0&&K&&u;)K--,k+=u;N===0&&(this.nextAudioTs=v=k-y),this.warn(`Injecting ${K} audio frames @ ${((k-y)/a).toFixed(3)}s due to ${Math.round(1e3*G/a)} ms gap.`);for(let ee=0;ee<K;ee++){let H=HX.getSilentFrame(e.parsedCodec||e.manifestCodec||e.codec,e.channelCount);H||(this.log("Unable to get silent frame for given audio codec; duplicating last frame instead."),H=$.unit.subarray()),g.splice(N,0,{unit:H,pts:k}),k+=u,N++}}$.pts=k,k+=u}}let w=null,S=null,T,_=0,A=g.length;for(;A--;)_+=g[A].unit.byteLength;for(let M=0,N=g.length;M<N;M++){const k=g[M],$=k.unit;let U=k.pts;if(S!==null){const B=h[M-1];B.duration=Math.round((U-S)/l)}else if(n&&e.segmentCodec==="aac"&&(U=v+y),w=U,_>0){_+=m;try{T=new Uint8Array(_)}catch(B){this.observer.emit(I.ERROR,I.ERROR,{type:fe.MUX_ERROR,details:V.REMUX_ALLOC_ERROR,fatal:!1,error:B,bytes:_,reason:`fail allocating audio mdat ${_}`});return}f||(new DataView(T.buffer).setUint32(0,_),T.set(W.types.mdat,4))}else return;T.set($,m);const G=$.byteLength;m+=G,h.push(LI(!0,c,G,0)),S=U}const P=h.length;if(!P)return;const C=h[h.length-1];v=S-y,this.nextAudioTs=v+l*C.duration;const O=f?new Uint8Array(0):W.moof(e.sequenceNumber++,w/l,et({},e,{samples:h}));e.samples=[];const R=(w-y)/a,D=this.nextAudioTs/a,j={data1:O,data2:T,startPTS:R,endPTS:D,startDTS:R,endDTS:D,type:"audio",hasAudio:!0,hasVideo:!1,nb:P};return this.isAudioContiguous=!0,j}}function en(t,e){let r;if(e===null)return t;for(e<t?r=-8589934592:r=8589934592;Math.abs(t-e)>4294967296;)t+=r;return t}function JX(t){for(let e=0;e<t.length;e++)if(t[e].key)return e;return-1}function a2(t,e,r,n){const i=t.samples.length;if(!i)return;const s=t.inputTimeScale;for(let o=0;o<i;o++){const l=t.samples[o];l.pts=en(l.pts-r.baseTime*s/r.timescale,e*s)/s,l.dts=en(l.dts-n.baseTime*s/n.timescale,e*s)/s}const a=t.samples;return t.samples=[],{samples:a}}function o2(t,e,r){const n=t.samples.length;if(!n)return;const i=t.inputTimeScale;for(let a=0;a<n;a++){const o=t.samples[a];o.pts=en(o.pts-r.baseTime*i/r.timescale,e*i)/i}t.samples.sort((a,o)=>a.pts-o.pts);const s=t.samples;return t.samples=[],{samples:s}}class ZX extends Dn{constructor(e,r,n,i){super("passthrough-remuxer",i),this.emitInitSegment=!1,this.audioCodec=void 0,this.videoCodec=void 0,this.initData=void 0,this.initPTS=null,this.initTracks=void 0,this.lastEndTime=null,this.isVideoContiguous=!1}destroy(){}resetTimeStamp(e){this.lastEndTime=null;const r=this.initPTS;r&&e&&r.baseTime===e.baseTime&&r.timescale===e.timescale||(this.initPTS=e)}resetNextTimestamp(){this.isVideoContiguous=!1,this.lastEndTime=null}resetInitSegment(e,r,n,i){this.audioCodec=r,this.videoCodec=n,this.generateInitSegment(e,i),this.emitInitSegment=!0}generateInitSegment(e,r){let{audioCodec:n,videoCodec:i}=this;if(!(e!=null&&e.byteLength)){this.initTracks=void 0,this.initData=void 0;return}const{audio:s,video:a}=this.initData=hj(e);if(r)BY(e,r);else{const l=s||a;l!=null&&l.encrypted&&this.warn(`Init segment with encrypted track with has no key ("${l.codec}")!`)}s&&(n=DI(s,nt.AUDIO,this)),a&&(i=DI(a,nt.VIDEO,this));const o={};s&&a?o.audiovideo={container:"video/mp4",codec:n+","+i,supplemental:a.supplemental,encrypted:a.encrypted,initSegment:e,id:"main"}:s?o.audio={container:"audio/mp4",codec:n,encrypted:s.encrypted,initSegment:e,id:"audio"}:a?o.video={container:"video/mp4",codec:i,supplemental:a.supplemental,encrypted:a.encrypted,initSegment:e,id:"main"}:this.warn("initSegment does not contain moov or trak boxes."),this.initTracks=o}remux(e,r,n,i,s,a){var o,l;let{initPTS:c,lastEndTime:u}=this;const d={audio:void 0,video:void 0,text:i,id3:n,initSegment:void 0};se(u)||(u=this.lastEndTime=s||0);const f=r.samples;if(!f.length)return d;const h={initPTS:void 0,timescale:void 0,trackId:void 0};let p=this.initData;if((o=p)!=null&&o.length||(this.generateInitSegment(f),p=this.initData),!((l=p)!=null&&l.length))return this.warn("Failed to generate initSegment."),d;this.emitInitSegment&&(h.tracks=this.initTracks,this.emitInitSegment=!1);const g=GY(f,p,this),m=p.audio?g[p.audio.id]:null,v=p.video?g[p.video.id]:null,y=Zh(v,1/0),b=Zh(m,1/0),w=Zh(v,0,!0),S=Zh(m,0,!0);let T=s,_=0;const A=m&&(!v||!c&&b<y||c&&c.trackId===p.audio.id),P=A?m:v;if(P){const k=P.timescale,$=P.start-s*k,U=A?p.audio.id:p.video.id;T=P.start/k,_=A?S-b:w-y,(a||!c)&&(eQ(c,T,s,_)||k!==c.timescale)&&(c&&this.warn(`Timestamps at playlist time: ${a?"":"~"}${s} ${$/k} != initPTS: ${c.baseTime/c.timescale} (${c.baseTime}/${c.timescale}) trackId: ${c.trackId}`),this.log(`Found initPTS at playlist time: ${s} offset: ${T-s} (${$}/${k}) trackId: ${U}`),c=null,h.initPTS=$,h.timescale=k,h.trackId=U)}else this.warn(`No audio or video samples found for initPTS at playlist time: ${s}`);c?(h.initPTS=c.baseTime,h.timescale=c.timescale,h.trackId=c.trackId):((!h.timescale||h.trackId===void 0||h.initPTS===void 0)&&(this.warn("Could not set initPTS"),h.initPTS=T,h.timescale=1,h.trackId=-1),this.initPTS=c={baseTime:h.initPTS,timescale:h.timescale,trackId:h.trackId});const C=T-c.baseTime/c.timescale,O=C+_;_>0?this.lastEndTime=O:(this.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());const R=!!p.audio,D=!!p.video;let L="";R&&(L+="audio"),D&&(L+="video");const j=(p.audio?p.audio.encrypted:!1)||(p.video?p.video.encrypted:!1),M={data1:f,startPTS:C,startDTS:C,endPTS:O,endDTS:O,type:L,hasAudio:R,hasVideo:D,nb:1,dropped:0,encrypted:j};d.audio=R&&!D?M:void 0,d.video=D?M:void 0;const N=v==null?void 0:v.sampleCount;if(N){const k=v.keyFrameIndex,$=k!==-1;M.nb=N,M.dropped=k===0||this.isVideoContiguous?0:$?k:N,M.independent=$,M.firstKeyFrame=k,$&&v.keyFrameStart&&(M.firstKeyFramePTS=(v.keyFrameStart-c.baseTime)/c.timescale),this.isVideoContiguous||(d.independent=$),this.isVideoContiguous||(this.isVideoContiguous=$),M.dropped&&this.warn(`fmp4 does not start with IDR: firstIDR ${k}/${N} dropped: ${M.dropped} start: ${M.firstKeyFramePTS||"NA"}`)}return d.initSegment=h,d.id3=a2(n,s,c,c),i.samples.length&&(d.text=o2(i,s,c)),d}}function Zh(t,e,r=!1){return(t==null?void 0:t.start)!==void 0?(t.start+(r?t.duration:0))/t.timescale:e}function eQ(t,e,r,n){if(t===null)return!0;const i=Math.max(n,1),s=e-t.baseTime/t.timescale;return Math.abs(s-r)>i}function DI(t,e,r){const n=t.codec;return n&&n.length>4?n:e===nt.AUDIO?n==="ec-3"||n==="ac-3"||n==="alac"?n:n==="fLaC"||n==="Opus"?Mm(n,!1):(r.warn(`Unhandled audio codec "${n}" in mp4 MAP`),n||"mp4a"):(r.warn(`Unhandled video codec "${n}" in mp4 MAP`),n||"avc1")}let ns;try{ns=self.performance.now.bind(self.performance)}catch{ns=Date.now}const Hp=[{demux:FX,remux:ZX},{demux:qs,remux:Vp},{demux:NX,remux:Vp},{demux:$X,remux:Vp}];Hp.splice(2,0,{demux:MX,remux:Vp});class NI{constructor(e,r,n,i,s,a){this.asyncResult=!1,this.logger=void 0,this.observer=void 0,this.typeSupported=void 0,this.config=void 0,this.id=void 0,this.demuxer=void 0,this.remuxer=void 0,this.decrypter=void 0,this.probe=void 0,this.decryptionPromise=null,this.transmuxConfig=void 0,this.currentTransmuxState=void 0,this.observer=e,this.typeSupported=r,this.config=n,this.id=s,this.logger=a}configure(e){this.transmuxConfig=e,this.decrypter&&this.decrypter.reset()}push(e,r,n,i){const s=n.transmuxing;s.executeStart=ns();let a=new Uint8Array(e);const{currentTransmuxState:o,transmuxConfig:l}=this;i&&(this.currentTransmuxState=i);const{contiguous:c,discontinuity:u,trackSwitch:d,accurateTimeOffset:f,timeOffset:h,initSegmentChange:p}=i||o,{audioCodec:g,videoCodec:m,defaultInitPts:v,duration:y,initSegmentData:b}=l,w=tQ(a,r);if(w&&Jl(w.method)){const A=this.getDecrypter(),P=LT(w.method);if(A.isSync()){let C=A.softwareDecrypt(a,w.key.buffer,w.iv.buffer,P);if(n.part>-1){const R=A.flush();C=R&&R.buffer}if(!C)return s.executeEnd=ns(),k0(n);a=new Uint8Array(C)}else return this.asyncResult=!0,this.decryptionPromise=A.webCryptoDecrypt(a,w.key.buffer,w.iv.buffer,P).then(C=>{const O=this.push(C,null,n);return this.decryptionPromise=null,O}),this.decryptionPromise}const S=this.needsProbing(u,d);if(S){const A=this.configureTransmuxer(a);if(A)return this.logger.warn(`[transmuxer] ${A.message}`),this.observer.emit(I.ERROR,I.ERROR,{type:fe.MEDIA_ERROR,details:V.FRAG_PARSING_ERROR,fatal:!1,error:A,reason:A.message}),s.executeEnd=ns(),k0(n)}(u||d||p||S)&&this.resetInitSegment(b,g,m,y,r),(u||p||S)&&this.resetInitialTimestamp(v),c||this.resetContiguity();const T=this.transmux(a,w,h,f,n);this.asyncResult=sf(T);const _=this.currentTransmuxState;return _.contiguous=!0,_.discontinuity=!1,_.trackSwitch=!1,s.executeEnd=ns(),T}flush(e){const r=e.transmuxing;r.executeStart=ns();const{decrypter:n,currentTransmuxState:i,decryptionPromise:s}=this;if(s)return this.asyncResult=!0,s.then(()=>this.flush(e));const a=[],{timeOffset:o}=i;if(n){const d=n.flush();d&&a.push(this.push(d.buffer,null,e))}const{demuxer:l,remuxer:c}=this;if(!l||!c){r.executeEnd=ns();const d=[k0(e)];return this.asyncResult?Promise.resolve(d):d}const u=l.flush(o);return sf(u)?(this.asyncResult=!0,u.then(d=>(this.flushRemux(a,d,e),a))):(this.flushRemux(a,u,e),this.asyncResult?Promise.resolve(a):a)}flushRemux(e,r,n){const{audioTrack:i,videoTrack:s,id3Track:a,textTrack:o}
vendor: 4,743 bytes, line 265
265=r,{accurateTimeOffset:l,timeOffset:c}=this.currentTransmuxState;this.logger.log(`[transmuxer.ts]: Flushed ${this.id} sn: ${n.sn}${n.part>-1?" part: "+n.part:""} of ${this.id===oe.MAIN?"level":"track"} ${n.level}`);const u=this.remuxer.remux(i,s,a,o,c,l,!0,this.id);e.push({remuxResult:u,chunkMeta:n}),n.transmuxing.executeEnd=ns()}resetInitialTimestamp(e){const{demuxer:r,remuxer:n}=this;!r||!n||(r.resetTimeStamp(e),n.resetTimeStamp(e))}resetContiguity(){const{demuxer:e,remuxer:r}=this;!e||!r||(e.resetContiguity(),r.resetNextTimestamp())}resetInitSegment(e,r,n,i,s){const{demuxer:a,remuxer:o}=this;!a||!o||(a.resetInitSegment(e,r,n,i),o.resetInitSegment(e,r,n,s))}destroy(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)}transmux(e,r,n,i,s){let a;return r&&r.method==="SAMPLE-AES"?a=this.transmuxSampleAes(e,r,n,i,s):a=this.transmuxUnencrypted(e,n,i,s),a}transmuxUnencrypted(e,r,n,i){const{audioTrack:s,videoTrack:a,id3Track:o,textTrack:l}=this.demuxer.demux(e,r,!1,!this.config.progressive);return{remuxResult:this.remuxer.remux(s,a,o,l,r,n,!1,this.id),chunkMeta:i}}transmuxSampleAes(e,r,n,i,s){return this.demuxer.demuxSampleAes(e,r,n).then(a=>({remuxResult:this.remuxer.remux(a.audioTrack,a.videoTrack,a.id3Track,a.textTrack,n,i,!1,this.id),chunkMeta:s}))}configureTransmuxer(e){const{config:r,observer:n,typeSupported:i}=this;let s;for(let d=0,f=Hp.length;d<f;d++){var a;if((a=Hp[d].demux)!=null&&a.probe(e,this.logger)){s=Hp[d];break}}if(!s)return new Error("Failed to find demuxer by probing fragment data");const o=this.demuxer,l=this.remuxer,c=s.remux,u=s.demux;(!l||!(l instanceof c))&&(this.remuxer=new c(n,r,i,this.logger)),(!o||!(o instanceof u))&&(this.demuxer=new u(n,r,i,this.logger),this.probe=u.probe)}needsProbing(e,r){return!this.demuxer||!this.remuxer||e||r}getDecrypter(){let e=this.decrypter;return e||(e=this.decrypter=new RT(this.config)),e}}function tQ(t,e){let r=null;return t.byteLength>0&&(e==null?void 0:e.key)!=null&&e.iv!==null&&e.method!=null&&(r=e),r}const k0=t=>({remuxResult:{},chunkMeta:t});function sf(t){return"then"in t&&t.then instanceof Function}class rQ{constructor(e,r,n,i,s){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=e,this.videoCodec=r,this.initSegmentData=n,this.duration=i,this.defaultInitPts=s||null}}class nQ{constructor(e,r,n,i,s,a){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.initSegmentChange=void 0,this.discontinuity=e,this.contiguous=r,this.accurateTimeOffset=n,this.trackSwitch=i,this.timeOffset=s,this.initSegmentChange=a}}let MI=0;class l2{constructor(e,r,n,i){this.error=null,this.hls=void 0,this.id=void 0,this.instanceNo=MI++,this.observer=void 0,this.frag=null,this.part=null,this.useWorker=void 0,this.workerContext=null,this.transmuxer=null,this.onTransmuxComplete=void 0,this.onFlush=void 0,this.onWorkerMessage=l=>{const c=l.data,u=this.hls;if(!(!u||!(c!=null&&c.event)||c.instanceNo!==this.instanceNo))switch(c.event){case"init":{var d;const f=(d=this.workerContext)==null?void 0:d.objectURL;f&&self.URL.revokeObjectURL(f);break}case"transmuxComplete":{this.handleTransmuxComplete(c.data);break}case"flush":{this.onFlush(c.data);break}case"workerLog":{u.logger[c.data.logType]&&u.logger[c.data.logType](c.data.message);break}default:{c.data=c.data||{},c.data.frag=this.frag,c.data.part=this.part,c.data.id=this.id,u.trigger(c.event,c.data);break}}},this.onWorkerError=l=>{if(!this.hls)return;const c=new Error(`${l.message}  (${l.filename}:${l.lineno})`);this.hls.config.enableWorker=!1,this.hls.logger.warn(`Error in "${this.id}" Web Worker, fallback to inline`),this.hls.trigger(I.ERROR,{type:fe.OTHER_ERROR,details:V.INTERNAL_EXCEPTION,fatal:!1,event:"demuxerWorker",error:c})};const s=e.config;this.hls=e,this.id=r,this.useWorker=!!s.enableWorker,this.onTransmuxComplete=n,this.onFlush=i;const a=(l,c)=>{c=c||{},c.frag=this.frag||void 0,l===I.ERROR&&(c=c,c.parent=this.id,c.part=this.part,this.error=c.error),this.hls.trigger(l,c)};this.observer=new MT,this.observer.on(I.FRAG_DECRYPTED,a),this.observer.on(I.ERROR,a);const o=QP(s.preferManagedMediaSource);if(this.useWorker&&typeof Worker<"u"){const l=this.hls.logger;if(s.workerPath||oX()){try{s.workerPath?(l.log(`loading Web Worker ${s.workerPath} for "${r}"`),this.workerContext=cX(s.workerPath)):(l.log(`injecting Web Worker for "${r}"`),this.workerContext=lX());const{worker:u}=this.workerContext;u.addEventListener("message",this.onWorkerMessage),u.addEventListener("error",this.onWorkerError),u.postMessage({instanceNo:this.instanceNo,cmd:"init",typeSupp
vendor: 20,095 bytes, lines 265-271
265orted:o,id:r,config:it(s)})}catch(u){l.warn(`Error setting up "${r}" Web Worker, fallback to inline`,u),this.terminateWorker(),this.error=null,this.transmuxer=new NI(this.observer,o,s,"",r,e.logger)}return}}this.transmuxer=new NI(this.observer,o,s,"",r,e.logger)}reset(){if(this.frag=null,this.part=null,this.workerContext){const e=this.instanceNo;this.instanceNo=MI++;const r=this.hls.config,n=QP(r.preferManagedMediaSource);this.workerContext.worker.postMessage({instanceNo:this.instanceNo,cmd:"reset",resetNo:e,typeSupported:n,id:this.id,config:it(r)})}}terminateWorker(){if(this.workerContext){const{worker:e}=this.workerContext;this.workerContext=null,e.removeEventListener("message",this.onWorkerMessage),e.removeEventListener("error",this.onWorkerError),uX(this.hls.config.workerPath)}}destroy(){if(this.workerContext)this.terminateWorker(),this.onWorkerMessage=this.onWorkerError=null;else{const r=this.transmuxer;r&&(r.destroy(),this.transmuxer=null)}const e=this.observer;e&&e.removeAllListeners(),this.frag=null,this.part=null,this.observer=null,this.hls=null}push(e,r,n,i,s,a,o,l,c,u){var d,f;c.transmuxing.start=self.performance.now();const{instanceNo:h,transmuxer:p}=this,g=a?a.start:s.start,m=s.decryptdata,v=this.frag,y=!(v&&s.cc===v.cc),b=!(v&&c.level===v.level),w=v?c.sn-v.sn:-1,S=this.part?c.part-this.part.index:-1,T=w===0&&c.id>1&&c.id===(v==null?void 0:v.stats.chunkCount),_=!b&&(w===1||w===0&&(S===1||T&&S<=0)),A=self.performance.now();(b||w||s.stats.parsing.start===0)&&(s.stats.parsing.start=A),a&&(S||!_)&&(a.stats.parsing.start=A);const P=!(v&&((d=s.initSegment)==null?void 0:d.url)===((f=v.initSegment)==null?void 0:f.url)),C=new nQ(y,_,l,b,g,P);if(!_||y||P){this.hls.logger.log(`[transmuxer-interface]: Starting new transmux session for ${s.type} sn: ${c.sn}${c.part>-1?" part: "+c.part:""} ${this.id===oe.MAIN?"level":"track"}: ${c.level} id: ${c.id}
266        discontinuity: ${y}
267        trackSwitch: ${b}
268        contiguous: ${_}
269        accurateTimeOffset: ${l}
270        timeOffset: ${g}
271        initSegmentChange: ${P}`);const O=new rQ(n,i,r,o,u);this.configureTransmuxer(O)}if(this.frag=s,this.part=a,this.workerContext)this.workerContext.worker.postMessage({instanceNo:h,cmd:"demux",data:e,decryptdata:m,chunkMeta:c,state:C},e instanceof ArrayBuffer?[e]:[]);else if(p){const O=p.push(e,m,c,C);sf(O)?O.then(R=>{this.handleTransmuxComplete(R)}).catch(R=>{this.transmuxerError(R,c,"transmuxer-interface push error")}):this.handleTransmuxComplete(O)}}flush(e){e.transmuxing.start=self.performance.now();const{instanceNo:r,transmuxer:n}=this;if(this.workerContext)this.workerContext.worker.postMessage({instanceNo:r,cmd:"flush",chunkMeta:e});else if(n){const i=n.flush(e);sf(i)?i.then(s=>{this.handleFlushResult(s,e)}).catch(s=>{this.transmuxerError(s,e,"transmuxer-interface flush error")}):this.handleFlushResult(i,e)}}transmuxerError(e,r,n){this.hls&&(this.error=e,this.hls.trigger(I.ERROR,{type:fe.MEDIA_ERROR,details:V.FRAG_PARSING_ERROR,chunkMeta:r,frag:this.frag||void 0,part:this.part||void 0,fatal:!1,error:e,err:e,reason:n}))}handleFlushResult(e,r){e.forEach(n=>{this.handleTransmuxComplete(n)}),this.onFlush(r)}configureTransmuxer(e){const{instanceNo:r,transmuxer:n}=this;this.workerContext?this.workerContext.worker.postMessage({instanceNo:r,cmd:"configure",config:e}):n&&n.configure(e)}handleTransmuxComplete(e){e.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(e)}}const $I=100;class iQ extends NT{constructor(e,r,n){super(e,r,n,"audio-stream-controller",oe.AUDIO),this.mainAnchor=null,this.mainFragLoading=null,this.audioOnly=!1,this.bufferedTrack=null,this.switchingTrack=null,this.trackId=-1,this.waitingData=null,this.mainDetails=null,this.flushing=!1,this.bufferFlushed=!1,this.cachedTrackLoadedData=null,this.registerListeners()}onHandlerDestroying(){this.unregisterListeners(),super.onHandlerDestroying(),this.resetItem()}resetItem(){this.mainDetails=this.mainAnchor=this.mainFragLoading=this.bufferedTrack=this.switchingTrack=this.waitingData=this.cachedTrackLoadedData=null}registerListeners(){super.registerListeners();const{hls:e}=this;e.on(I.LEVEL_LOADED,this.onLevelLoaded,this),e.on(I.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),e.on(I.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(I.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.on(I.BUFFER_RESET,this.onBufferReset,this),e.on(I.BUFFER_CREATED,this.onBufferCreated,this),e.on(I.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(I.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(I.INIT_PTS_FOUND,this.onInitPtsFound,this),e.on(I.FRAG_LOADING,this.onFragLoading,this),e.on(I.FRAG_BUFFERED,this.onFragBuffered,this)}unregisterListeners(){const{hls:e}=this;e&&(super.unregisterListeners(),e.off(I.LEVEL_LOADED,this.onLevelLoaded,this),e.off(I.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),e.off(I.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(I.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.off(I.BUFFER_RESET,this.onBufferReset,this),e.off(I.BUFFER_CREATED,this.onBufferCreated,this),e.off(I.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(I.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(I.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(I.FRAG_LOADING,this.onFragLoading,this),e.off(I.FRAG_BUFFERED,this.onFragBuffered,this))}onInitPtsFound(e,{frag:r,id:n,initPTS:i,timescale:s,trackId:a}){if(n===oe.MAIN){const o=r.cc,l=this.fragCurrent;if(this.initPTS[o]={baseTime:i,timescale:s,trackId:a},this.log(`InitPTS for cc: ${o} found from main: ${i/s} (${i}/${s}) trackId: ${a}`),this.mainAnchor=r,this.state===Q.WAITING_INIT_PTS){const c=this.waitingData;(!c&&!this.loadingParts||c&&c.frag.cc!==o)&&this.syncWithAnchor(r,c==null?void 0:c.frag)}else!this.hls.hasEnoughToStart&&l&&l.cc!==o?(l.abortRequests(),this.syncWithAnchor(r,l)):this.state===Q.IDLE&&this.tick()}}getLoadPosition(){return!this.startFragRequested&&this.nextLoadPosition>=0?this.nextLoadPosition:super.getLoadPosition()}syncWithAnchor(e,r){var n;const i=((n=this.mainFragLoading)==null?void 0:n.frag)||null;if(r&&(i==null?void 0:i.cc)===r.cc)return;const s=(i||e).cc,a=this.getLevelDetails(),o=this.getLoadPosition(),l=Tj(a,s,o);l&&(this.log(`Syncing with main frag at ${l.start} cc ${l.cc}`),this.startFragRequested=!1,this.nextLoadPosition=l.start,this.resetLoadingState(),this.state===Q.IDLE&&this.doTickIdle())}startLoad(e,r){if(!this.levels){this.startPosition=e,this.state=Q.STOPPED;return}const n=this.lastCurrentTime;this.stopLoad(),this.setInterval($I),n>0&&e===-1?(this.log(`Override startPosition with lastCurrentTime @${n.toFixed(3)}`),e=n,this.state=Q.IDLE):this.state=Q.WAITING_TRACK,this.nextLoadPosition=this.lastCurrentTime=e+this.timelineOffset,this.startPosition=r?-1:e,this.tick()}doTick(){switch(this.state){case Q.IDLE:this.doTickIdle();break;case Q.WAITING_TRACK:{const{levels:e,trackId:r}=this,n=e==null?void 0:e[r],i=n==null?void 0:n.details;if(i&&!this.waitForLive(n)){if(this.waitForCdnTuneIn(i))break;this.state=Q.WAITING_INIT_PTS}break}case Q.FRAG_LOADING_WAITING_RETRY:{this.checkRetryDate();break}case Q.WAITING_INIT_PTS:{const e=this.waitingData;if(e){const{frag:r,part:n,cache:i,complete:s}=e,a=this.mainAnchor;if(this.initPTS[r.cc]!==void 0){this.waitingData=null,this.state=Q.FRAG_LOADING;const o=i.flush().buffer,l={frag:r,part:n,payload:o,networkDetails:null};this._handleFragmentLoadProgress(l),s&&super._handleFragmentLoadComplete(l)}else a&&a.cc!==e.frag.cc&&this.syncWithAnchor(a,e.frag)}else this.state=Q.IDLE}}this.onTickEnd()}resetLoadingState(){const e=this.waitingData;e&&(this.fragmentTracker.removeFragment(e.frag),this.waitingData=null),super.resetLoadingState()}onTickEnd(){const{media:e}=this;e!=null&&e.readyState&&(this.lastCurrentTime=e.currentTime)}doTickIdle(){var e;const{hls:r,levels:n,media:i,trackId:s}=this,a=r.config;if(!this.buffering||!i&&!this.primaryPrefetch&&(this.startFragRequested||!a.startFragPrefetch)||!(n!=null&&n[s]))return;const o=n[s],l=o.details;if(!l||this.waitForLive(o)||this.waitForCdnTuneIn(l)){this.state=Q.WAITING_TRACK,this.startFragRequested=!1;return}const c=this.mediaBuffer?this.mediaBuffer:this.media;this.bufferFlushed&&c&&(this.bufferFlushed=!1,this.afterBufferFlushed(c,nt.AUDIO,oe.AUDIO));const u=this.getFwdBufferInfo(c,oe.AUDIO);if(u===null)return;if(!this.switchingTrack&&this._streamEnded(u,l)){r.trigger(I.BUFFER_EOS,{type:"audio"}),this.state=Q.ENDED;return}const d=u.len,f=r.maxBufferLength,h=l.fragments,p=h[0].start,g=this.getLoadPosition(),m=this.flushing?g:u.end;if(this.switchingTrack&&i){const b=g;l.PTSKnown&&b<p&&(u.end>p||u.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),i.currentTime=p+.05)}if(d>=f&&!this.switchingTrack&&m<h[h.length-1].start)return;let v=this.getNextFragment(m,l);if(v&&this.isLoopLoading(v,m)&&(v=this.getNextFragmentLoopLoading(v,l,u,oe.MAIN,f)),!v){this.bufferFlushed=!0;return}let y=((e=this.mainFragLoading)==null?void 0:e.frag)||null;if(!this.audioOnly&&this.startFragRequested&&y&&Nt(v)&&!v.endList&&(!l.live||!this.loadingParts&&m<this.hls.liveSyncPosition)&&(this.fragmentTracker.getState(y)===qt.OK&&(this.mainFragLoading=y=null),y&&Nt(y))){if(v.start>y.end){const w=this.fragmentTracker.getFragAtPos(m,oe.MAIN);w&&w.end>y.end&&(y=w,this.mainFragLoading={frag:w,targetBufferTime:null})}if(v.start>y.end)return}this.loadFragment(v,o,m)}onMediaDetaching(e,r){this.bufferFlushed=this.flushing=!1,super.onMediaDetaching(e,r)}onAudioTracksUpdated(e,{audioTracks:r}){this.resetTransmuxer(),this.levels=r.map(n=>new tf(n))}onAudioTrackSwitching(e,r){const n=!!r.url;this.trackId=r.id;const{fragCurrent:i}=this;i&&(i.abortRequests(),this.removeUnbufferedFrags(i.start)),this.resetLoadingState(),n?(this.switchingTrack=r,this.flushAudioIfNeeded(r),this.state!==Q.STOPPED&&(this.setInterval($I),this.state=Q.IDLE,this.tick())):(this.resetTransmuxer(),this.switchingTrack=null,this.bufferedTrack=r,this.clearInterval())}onManifestLoading(){super.onManifestLoading(),this.bufferFlushed=this.flushing=this.audioOnly=!1,this.resetItem(),this.trackId=-1}onLevelLoaded(e,r){this.mainDetails=r.details;const n=this.cachedTrackLoadedData;n&&(this.cachedTrackLoadedData=null,this.onAudioTrackLoaded(I.AUDIO_TRACK_LOADED,n))}onAudioTrackLoaded(e,r){var n;const{levels:i}=this,{details:s,id:a,groupId:o,track:l}=r;if(!i){this.warn(`Audio tracks reset while loading track ${a} "${l.name}" of "${o}"`);return}const c=this.mainDetails;if(!c||s.endCC>c.endCC||c.expired){this.cachedTrackLoadedData=r,this.state!==Q.STOPPED&&(this.state=Q.WAITING_TRACK);return}this.cachedTrackLoadedData=null,this.log(`Audio track ${a} "${l.name}" of "${o}" loaded [${s.startSN},${s.endSN}]${s.lastPartSn?`[part-${s.lastPartSn}-${s.lastPartIndex}]`:""},duration:${s.totalduration}`);const u=i[a];let d=0;if(s.live||(n=u.details)!=null&&n.live){if(this.checkLiveUpdate(s),s.deltaUpdateFailed)return;if(u.details){var f;d=this.alignPlaylists(s,u.details,(f=this.levelLastLoaded)==null?void 0:f.details)}s.alignedSliding||(Gj(s,c),s.alignedSliding||Wm(s,c),d=s.fragmentStart)}u.details=s,this.levelLastLoaded=u,this.startFragRequested||this.setStartPosition(c,d),this.hls.trigger(I.AUDIO_TRACK_UPDATED,{details:s,id:a,groupId:r.groupId}),this.state===Q.WAITING_TRACK&&!this.waitForCdnTuneIn(s)&&(this.state=Q.IDLE),this.tick()}_handleFragmentLoadProgress(e){var r;const n=e.frag,{part:i,payload:s}=e,{config:a,trackId:o,levels:l}=this;if(!l){this.warn(`Audio tracks were reset while fragment load was in progress. Fragment ${n.sn} of level ${n.level} will not be buffered`);return}const c=l[o];if(!c){this.warn("Audio track is undefined on fragment load progress");return}const u=c.details;if(!u){this.warn("Audio track details undefined on fragment load progress"),this.removeUnbufferedFrags(n.start);return}const d=a.defaultAudioCodec||c.audioCodec||"mp4a.40.2";let f=this.transmuxer;f||(f=this.transmuxer=new l2(this.hls,oe.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));const h=this.initPTS[n.cc],p=(r=n.initSegment)==null?void 0:r.data;if(h!==void 0){const m=i?i.index:-1,v=m!==-1,y=new kT(n.level,n.sn,n.stats.chunkCount,s.byteLength,m,v);f.push(s,p,d,"",n,i,u.totalduration,!1,y,h)}else{this.log(`Unknown video PTS for cc ${n.cc}, waiting for video PTS before demuxing audio frag ${n.sn} of [${u.startSN} ,${u.endSN}],track ${o}`);const{cache:g}=this.waitingData=this.waitingData||{frag:n,part:i,cache:new Wj,complete:!1};g.push(new Uint8Array(s)),this.state!==Q.STOPPED&&(this.state=Q.WAITING_INIT_PTS)}}_handleFragmentLoadComplete(e){if(this.waitingData){this.waitingData.complete=!0;return}super._handleFragmentLoadComplete(e)}onBufferReset(){this.mediaBuffer=null}onBufferCreated(e,r){this.bufferFlushed=this.flushing=!1;const n=r.tracks.audio;n&&(this.mediaBuffer=n.buffer||null)}onFragLoading(e,r){!this.audioOnly&&r.frag.type===oe.MAIN&&Nt(r.frag)&&(this.mainFragLoading=r,this.state===Q.IDLE&&this.tick())}onFragBuffered(e,r){const{frag:n,part:i}=r;if(n.type!==oe.AUDIO){!this.audioOnly&&n.type===oe.MAIN&&!n.elementaryStreams.video&&!n.elementaryStreams.audiovideo&&(this.audioOnly=!0,this.mainFragLoading=null);return}if(this.fragContextChanged(n)){this.warn(`Fragment ${n.sn}${i?" p: "+i.index:""} of level ${n.level} finished buffering, but was aborted. state: ${this.state}, audioSwitch: ${this.switchingTrack?this.switchingTrack.name:"false"}`);return}if(Nt(n)){this.fragPrevious=n;const s=this.switchingTrack;s&&(this.bufferedTrack=s,this.switchingTrack=null,this.hls.trigger(I.AUDIO_TRACK_SWITCHED,Ve({},s)))}this.fragBufferedComplete(n,i),this.media&&this.tick()}onError(e,r){var n;if(r.fatal){this.state=Q.ERROR;return}switch(r.details){case V.FRAG_GAP:case V.FRAG_PARSING_ERROR:case V.FRAG_DECRYPT_ERROR:case V.FRAG_LOAD_ERROR:case V.FRAG_LOAD_TIMEOUT:case V.KEY_LOAD_ERROR:case V.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(oe.AUDIO,r);break;case V.AUDIO_TRACK_LOAD_ERROR:case V.AUDIO_TRACK_LOAD_TIMEOUT:case V.LEVEL_PARSING_ERROR:!r.levelRetry&&this.state===Q.WAITING_TRACK&&((n=r.context)==null?void 0:n.type)===Ce.AUDIO_TRACK&&(this.state=Q.IDLE);break;case V.BUFFER_ADD_CODEC_ERROR:case V.BUFFER_APPEND_ERROR:if(r.parent!=="audio")return;this.reduceLengthAndFlushBuffer(r)||this.resetLoadingState();break;case V.BUFFER_FULL_ERROR:if(r.parent!=="audio")return;this.reduceLengthAndFlushBuffer(r)&&(this.bufferedTrack=null,super.flushMainBuffer(0,Number.POSITIVE_INFINITY,"audio"));break;case V.INTERNAL_EXCEPTION:this.recoverWorkerError(r);break}}onBufferFlushing(e,{type:r}){r!==nt.VIDEO&&(this.flushing=!0)}onBufferFlushed(e,{type:r}){if(r!==nt.VIDEO){this.flushing=!1,this.bufferFlushed=!0,this.state===Q.ENDED&&(this.state=Q.IDLE);const n=this.mediaBuffer||this.media;n&&(this.afterBufferFlushed(n,r,oe.AUDIO),this.tick())}}_handleTransmuxComplete(e){var r;const n="audio",{hls:i}=this,{remuxResult:s,chunkMeta:a}=e,o=this.getCurrentContext(a);if(!o){this.resetWhenMissingContext(a);return}const{frag:l,part:c,level:u}=o,{details:d}=u,{audio:f,text:h,id3:p,initSegment:g}=s;if(this.fragContextChanged(l)||!d){this.fragmentTracker.removeFragment(l);return}if(this.state=Q.PARSING,this.switchingTrack&&f&&this.completeAudioSwitch(this.switchingTrack),g!=null&&g.tracks){const m=l.initSegment||l;if(this.unhandledEncryptionError(g,l))return;this._bufferInitSegment(u,g.tracks,m,a),i.trigger(I.FRAG_PARSING_INIT_SEGMENT,{frag:m,id:n,tracks:g.tracks})}if(f){const{startPTS:m,endPTS:v,startDTS:y,endDTS:b}=f;c&&(c.elementaryStreams[nt.AUDIO]={startPTS:m,endPTS:v,startDTS:y,endDTS:b}),l.setElementaryStreamInfo(nt.AUDIO,m,v,y,b),this.bufferFragmentData(f,l,c,a)}if(p!=null&&(r=p.samples)!=null&&r.length){const m=et({id:n,frag:l,details:d},p);i.trigger(I.FRAG_PARSING_METADATA,m)}if(h){const m=et({id:n,frag:l,details:d},h);i.trigger(I.FRAG_PARSING_USERDATA,m)}}_bufferInitSegment(e,r,n,i){if(this.state!==Q.PARSING||(r.video&&delete r.video,r.audiovideo&&delete r.audiovideo,!r.audio))return;const s=r.audio;s.id=oe.AUDIO;const a=e.audioCodec;this.log(`Init audio buffer, container:${s.container}, codecs[level/parsed]=[${a}/${s.codec}]`),a&&a.split(",").length===1&&(s.levelCodec=a),this.hls.trigger(I.BUFFER_CODECS,r);const o=s.initSegment;if(o!=null&&o.byteLength){const l={type:"audio",frag:n,part:null,chunkMeta:i,parent:n.type,data:o};this.hls.trigger(I.BUFFER_APPENDING,l)}this.tickImmediate()}loadFragment(e,r,n){const i=this.fragmentTracker.getState(e);if(this.switchingTrack||i===qt.NOT_LOADED||i===qt.PARTIAL){var s;if(!Nt(e))this._loadInitSegment(e,r);else if((s=r.details)!=null&&s.live&&!this.initPTS[e.cc]){this.log(`Waiting for video PTS in continuity counter ${e.cc} of live stream before loading audio fragment ${e.sn} of level ${this.trackId}`),this.state=Q.WAITING_INIT_PTS;const a=this.mainDetails;a&&a.fragmentStart!==r.details.fragmentStart&&Wm(r.details,a)}else super.loadFragment(e,r,n)}else this.clearTrackerIfNeeded(e)}flushAudioIfNeeded(e){if(this.media&&this.bufferedTrack){const{name:r,lang:n,assocLang:i,characteristics:s,audioCodec:a,channels:o}=this.bufferedTrack;To({name:r,lang:n,assocLang:i,characteristics:s,audioCodec:a,channels:o},e,Ja)||(jm(e.url,this.hls)?(this.log("Switching audio track : flushing all audio"),super.flushMainBuffer(0,Number.POSITIVE_INFINITY,"audio"),this.bufferedTrack=null):this.bufferedTrack=e)}}completeAudioSwitch(e){const{hls:r}=this;this.flushAudioIfNeeded(e),this.bufferedTrack=e,this.switchingTrack=null,r.trigger(I.AUDIO_TRACK_SWITCHED,Ve({},e))}}class WT extends Dn{constructor(e,r){super(r,e.logger),this.hls=void 0,this.canLoad=!1,this.timer=-1,this.hls=e}destroy(){this.clearTimer(),this.hls=this.log=this.warn=null}clearTimer(){this.timer!==-1&&(self.clearTimeout(this.timer),this.timer=-1)}startLoad(){this.canLoad=!0,this.loadPlaylist()}stopLoad(){this.canLoad=!1,this.clearTimer()}switchParams(e,r,n){const i=r==null?void 0:r.renditionReports;if(i){let s=-1;for(let a=0;a<i.length;a++){const o=i[a];let l;try{l=new self.URL(o.URI,r.url).href}catch(c){this.warn(`Could not construct new URL for Rendition Report: ${c}`),l=o.URI||""}if(l===e){s=a;break}else l===e.substring(0,l.length)&&(s=a)}if(s!==-1){const a=i[s],o=parseInt(a["LAST-MSN"])||r.lastPartSn;let l=parseInt(a["LAST-PART"])||r.lastPartIndex;if(this.hls.config.lowLatencyMode){const u=Math.min(r.age-r.partTarget,r.targetduration);l>=0&&u>r.partTarget&&(l+=1)}const c=n&&JP(n);return new ZP(o,l>=0?l:void 0,c)}}}loadPlaylist(e){this.clearTimer()}loadingPlaylist(e,r){this.clearTimer()}shouldLoadPlaylist(e){return this.canLoad&&!!e&&!!e.url&&(!e.details||e.details.live)}getUrlWithDirectives(e,r){if(r)try{return r.addDirectives(e)}catch(n){this.warn(`Could not construct new URL with HLS Delivery Directives: ${n}`)}return e}playlistLoaded(e,r,n){const{details:i,stats:s}=r,a=self.performance.now(),o=s.loading.first?Math.max(0,a-s.loading.first):0;i.advancedDateTime=Date.now()-o;const l=this.hls.config.timelineOffset;if(l!==i.appliedTimelineOffset){const u=Math.max(l||0,0);i.appliedTimelineOffset=u,i.fragments.forEach(d=>{d.setStart(d.playlistOffset+u)})}if(i.live||n!=null&&n.live){const u="levelInfo"in r?r.levelInfo:r.track;if(i.reloaded(n),n&&i.fragments.length>0){X7(n,i,this);const y=i.playlistParsingError;if(y){this.warn(y);const b=this.hls;if(!b.config.ignorePlaylistParsingErrors){var c;const{networkDetails:w}=r;b.trigger(I.ERROR,{type:fe.NETWORK_ERROR,details:V.LEVEL_PARSING_ERROR,fatal:!1,url:i.url,error:y,reason:y.message,level:r.level||void 0,parent:(c=i.fragments[0])==null?void 0:c.type,networkDetails:w,stats:s});return}i.playlistParsingError=null}}i.requestScheduled===-1&&(i.requestScheduled=s.loading.start);const d=this.hls.mainForwardBufferInfo,f=d?d.end-d.len:0,h=(i.edge-f)*1e3,p=$j(i,h);if(i.requestScheduled+p<a?i.requestScheduled=a:i.requestScheduled+=p,this.log(`live playlist ${e} ${i.advanced?"REFRESHED "+i.lastPartSn+"-"+i.lastPartIndex:i.updated?"UPDATED":"MISSED"}`),!this.canLoad||!i.live)return;let g,m,v;if(i.canBlockReload&&i.endSN&&i.advanced){const y=this.hls.config.lowLatencyMode,b=i.lastPartSn,w=i.endSN,S=i.lastPartIndex,T=S!==-1,_=b===w;
vendor: 14,533 bytes, lines 271-274
271T?_?(m=w+1,v=y?0:S):(m=b,v=y?S+1:i.maxPartIndex):m=w+1;const A=i.age,P=A+i.ageHeader;let C=Math.min(P-i.partTarget,i.targetduration*1.5);if(C>0){if(P>i.targetduration*3)this.log(`Playlist last advanced ${A.toFixed(2)}s ago. Omitting segment and part directives.`),m=void 0,v=void 0;else if(n!=null&&n.tuneInGoal&&P-i.partTarget>n.tuneInGoal)this.warn(`CDN Tune-in goal increased from: ${n.tuneInGoal} to: ${C} with playlist age: ${i.age}`),C=0;else{const O=Math.floor(C/i.targetduration);if(m+=O,v!==void 0){const R=Math.round(C%i.targetduration/i.partTarget);v+=R}this.log(`CDN Tune-in age: ${i.ageHeader}s last advanced ${A.toFixed(2)}s goal: ${C} skip sn ${O} to part ${v}`)}i.tuneInGoal=C}if(g=this.getDeliveryDirectives(i,r.deliveryDirectives,m,v),y||!_){i.requestScheduled=a,this.loadingPlaylist(u,g);return}}else(i.canBlockReload||i.canSkipUntil)&&(g=this.getDeliveryDirectives(i,r.deliveryDirectives,m,v));g&&m!==void 0&&i.canBlockReload&&(i.requestScheduled=s.loading.first+Math.max(p-o*2,p/2)),this.scheduleLoading(u,g,i)}else this.clearTimer()}scheduleLoading(e,r,n){const i=n||e.details;if(!i){this.loadingPlaylist(e,r);return}const s=self.performance.now(),a=i.requestScheduled;if(s>=a){this.loadingPlaylist(e,r);return}const o=a-s;this.log(`reload live playlist ${e.name||e.bitrate+"bps"} in ${Math.round(o)} ms`),this.clearTimer(),this.timer=self.setTimeout(()=>this.loadingPlaylist(e,r),o)}getDeliveryDirectives(e,r,n,i){let s=JP(e);return r!=null&&r.skip&&e.deltaUpdateFailed&&(n=r.msn,i=r.part,s=Gp.No),new ZP(n,i,s)}checkRetry(e){const r=e.details,n=Fm(e),i=e.errorAction,{action:s,retryCount:a=0,retryConfig:o}=i||{},l=!!i&&!!o&&(s===hr.RetryRequest||!i.resolved&&s===hr.SendAlternateToPenaltyBox);if(l){var c;if(a>=o.maxNumRetry)return!1;if(n&&(c=e.context)!=null&&c.deliveryDirectives)this.warn(`Retrying playlist loading ${a+1}/${o.maxNumRetry} after "${r}" without delivery-directives`),this.loadPlaylist();else{const u=OT(o,a);this.clearTimer(),this.timer=self.setTimeout(()=>this.loadPlaylist(),u),this.warn(`Retrying playlist loading ${a+1}/${o.maxNumRetry} after "${r}" in ${u}ms`)}e.levelRetry=!0,i.resolved=!0}return l}}function c2(t,e){if(t.length!==e.length)return!1;for(let r=0;r<t.length;r++)if(!af(t[r].attrs,e[r].attrs))return!1;return!0}function af(t,e,r){const n=t["STABLE-RENDITION-ID"];return n&&!r?n===e["STABLE-RENDITION-ID"]:!(r||["LANGUAGE","NAME","CHARACTERISTICS","AUTOSELECT","DEFAULT","FORCED","ASSOC-LANGUAGE"]).some(i=>t[i]!==e[i])}function vw(t,e){return e.label.toLowerCase()===t.name.toLowerCase()&&(!e.language||e.language.toLowerCase()===(t.lang||"").toLowerCase())}class sQ extends WT{constructor(e){super(e,"audio-track-controller"),this.tracks=[],this.groupIds=null,this.tracksInGroup=[],this.trackId=-1,this.currentTrack=null,this.selectDefaultTrack=!0,this.registerListeners()}registerListeners(){const{hls:e}=this;e.on(I.MANIFEST_LOADING,this.onManifestLoading,this),e.on(I.MANIFEST_PARSED,this.onManifestParsed,this),e.on(I.LEVEL_LOADING,this.onLevelLoading,this),e.on(I.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(I.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.on(I.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(I.MANIFEST_LOADING,this.onManifestLoading,this),e.off(I.MANIFEST_PARSED,this.onManifestParsed,this),e.off(I.LEVEL_LOADING,this.onLevelLoading,this),e.off(I.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(I.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.off(I.ERROR,this.onError,this)}destroy(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.currentTrack=null,super.destroy()}onManifestLoading(){this.tracks=[],this.tracksInGroup=[],this.groupIds=null,this.currentTrack=null,this.trackId=-1,this.selectDefaultTrack=!0}onManifestParsed(e,r){this.tracks=r.audioTracks||[]}onAudioTrackLoaded(e,r){const{id:n,groupId:i,details:s}=r,a=this.tracksInGroup[n];if(!a||a.groupId!==i){this.warn(`Audio track with id:${n} and group:${i} not found in active group ${a==null?void 0:a.groupId}`);return}const o=a.details;a.details=r.details,this.log(`Audio track ${n} "${a.name}" lang:${a.lang} group:${i} loaded [${s.startSN}-${s.endSN}]`),n===this.trackId&&this.playlistLoaded(n,r,o)}onLevelLoading(e,r){this.switchLevel(r.level)}onLevelSwitching(e,r){this.switchLevel(r.level)}switchLevel(e){const r=this.hls.levels[e];if(!r)return;const n=r.audioGroups||null,i=this.groupIds;let s=this.currentTrack;if(!n||(i==null?void 0:i.length)!==(n==null?void 0:n.length)||n!=null&&n.some(o=>(i==null?void 0:i.indexOf(o))===-1)){this.groupIds=n,this.trackId=-1,this.currentTrack=null;const o=this.tracks.filter(f=>!n||n.indexOf(f.groupId)!==-1);if(o.length)this.selectDefaultTrack&&!o.some(f=>f.default)&&(this.selectDefaultTrack=!1),o.forEach((f,h)=>{f.id=h});else if(!s&&!this.tracksInGroup.length)return;this.tracksInGroup=o;const l=this.hls.config.audioPreference;if(!s&&l){const f=Ii(l,o,Ja);if(f>-1)s=o[f];else{const h=Ii(l,this.tracks);s=this.tracks[h]}}let c=this.findTrackId(s);c===-1&&s&&(c=this.findTrackId(null));const u={audioTracks:o};this.log(`Updating audio tracks, ${o.length} track(s) found in group(s): ${n==null?void 0:n.join(",")}`),this.hls.trigger(I.AUDIO_TRACKS_UPDATED,u);const d=this.trackId;if(c!==-1&&d===-1)this.setAudioTrack(c);else if(o.length&&d===-1){var a;const f=new Error(`No audio track selected for current audio group-ID(s): ${(a=this.groupIds)==null?void 0:a.join(",")} track count: ${o.length}`);this.warn(f.message),this.hls.trigger(I.ERROR,{type:fe.MEDIA_ERROR,details:V.AUDIO_TRACK_LOAD_ERROR,fatal:!0,error:f})}}}onError(e,r){r.fatal||!r.context||r.context.type===Ce.AUDIO_TRACK&&r.context.id===this.trackId&&(!this.groupIds||this.groupIds.indexOf(r.context.groupId)!==-1)&&this.checkRetry(r)}get allAudioTracks(){return this.tracks}get audioTracks(){return this.tracksInGroup}get audioTrack(){return this.trackId}set audioTrack(e){this.selectDefaultTrack=!1,this.setAudioTrack(e)}setAudioOption(e){const r=this.hls;if(r.config.audioPreference=e,e){const n=this.allAudioTracks;if(this.selectDefaultTrack=!1,n.length){const i=this.currentTrack;if(i&&To(e,i,Ja))return i;const s=Ii(e,this.tracksInGroup,Ja);if(s>-1){const a=this.tracksInGroup[s];return this.setAudioTrack(s),a}else if(i){let a=r.loadLevel;a===-1&&(a=r.firstAutoLevel);const o=v7(e,r.levels,n,a,Ja);if(o===-1)return null;r.nextLoadLevel=o}if(e.channels||e.audioCodec){const a=Ii(e,n);if(a>-1)return n[a]}}}return null}setAudioTrack(e){const r=this.tracksInGroup;if(e<0||e>=r.length){this.warn(`Invalid audio track id: ${e}`);return}this.selectDefaultTrack=!1;const n=this.currentTrack,i=r[e],s=i.details&&!i.details.live;if(e===this.trackId&&i===n&&s||(this.log(`Switching to audio-track ${e} "${i.name}" lang:${i.lang} group:${i.groupId} channels:${i.channels}`),this.trackId=e,this.currentTrack=i,this.hls.trigger(I.AUDIO_TRACK_SWITCHING,Ve({},i)),s))return;const a=this.switchParams(i.url,n==null?void 0:n.details,i.details);this.loadPlaylist(a)}findTrackId(e){const r=this.tracksInGroup;for(let n=0;n<r.length;n++){const i=r[n];if(!(this.selectDefaultTrack&&!i.default)&&(!e||To(e,i,Ja)))return n}if(e){const{name:n,lang:i,assocLang:s,characteristics:a,audioCodec:o,channels:l}=e;for(let c=0;c<r.length;c++){const u=r[c];if(To({name:n,lang:i,assocLang:s,characteristics:a,audioCodec:o,channels:l},u,Ja))return c}for(let c=0;c<r.length;c++){const u=r[c];if(af(e.attrs,u.attrs,["LANGUAGE","ASSOC-LANGUAGE","CHARACTERISTICS"]))return c}for(let c=0;c<r.length;c++){const u=r[c];if(af(e.attrs,u.attrs,["LANGUAGE"]))return c}}return-1}loadPlaylist(e){super.loadPlaylist();const r=this.currentTrack;this.shouldLoadPlaylist(r)&&jm(r.url,this.hls)&&this.scheduleLoading(r,e)}loadingPlaylist(e,r){super.loadingPlaylist(e,r);const n=e.id,i=e.groupId,s=this.getUrlWithDirectives(e.url,r),a=e.details,o=a==null?void 0:a.age;this.log(`Loading audio-track ${n} "${e.name}" lang:${e.lang} group:${i}${(r==null?void 0:r.msn)!==void 0?" at sn "+r.msn+" part "+r.part:""}${o&&a.live?" age "+o.toFixed(1)+(a.type&&" "+a.type||""):""} ${s}`),this.hls.trigger(I.AUDIO_TRACK_LOADING,{url:s,id:n,groupId:i,deliveryDirectives:r||null,track:e})}}class aQ{constructor(e){this.tracks=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.tracks=e}destroy(){this.tracks=this.queues=null}append(e,r,n){if(this.queues===null||this.tracks===null)return;const i=this.queues[r];i.push(e),i.length===1&&!n&&this.executeNext(r)}appendBlocker(e){return new Promise(r=>{const n={label:"async-blocker",execute:r,onStart:()=>{},onComplete:()=>{},onError:()=>{}};this.append(n,e)})}prependBlocker(e){return new Promise(r=>{if(this.queues){const n={label:"async-blocker-prepend",execute:r,onStart:()=>{},onComplete:()=>{},onError:()=>{}};this.queues[e].unshift(n)}})}removeBlockers(){this.queues!==null&&[this.queues.video,this.queues.audio,this.queues.audiovideo].forEach(e=>{var r;const n=(r=e[0])==null?void 0:r.label;(n==="async-blocker"||n==="async-blocker-prepend")&&(e[0].execute(),e.splice(0,1))})}unblockAudio(e){if(this.queues===null)return;this.queues.audio[0]===e&&this.shiftAndExecuteNext("audio")}executeNext(e){if(this.queues===null||this.tracks===null)return;const r=this.queues[e];if(r.length){const i=r[0];try{i.execute()}catch(s){var n;if(i.onError(s),this.queues===null||this.tracks===null)return;const a=(n=this.tracks[e])==null?void 0:n.buffer;a!=null&&a.updating||this.shiftAndExecuteNext(e)}}}shiftAndExecuteNext(e){this.queues!==null&&(this.queues[e].shift(),this.executeNext(e))}current(e){var r;return((r=this.queues)==null?void 0:r[e][0])||null}toString(){const{queues:e,tracks:r}=this;return e===null||r===null?"<destroyed>":`
272${this.list("video")}
273${this.list("audio")}
274${this.list("audiovideo")}}`}list(e){var r,n;return(r=this.queues)!=null&&r[e]||(n=this.tracks)!=null&&n[e]?`${e}: (${this.listSbInfo(e)}) ${this.listOps(e)}`:""}listSbInfo(e){var r;const n=(r=this.tracks)==null?void 0:r[e],i=n==null?void 0:n.buffer;return i?`SourceBuffer${i.updating?" updating":""}${n.ended?" ended":""}${n.ending?" ending":""}`:"none"}listOps(e){var r;return((r=this.queues)==null?void 0:r[e].map(n=>n.label).join(", "))||""}}const jI=/(avc[1234]|hvc1|hev1|dvh[1e]|vp09|av01)(?:\.[^.,]+)+/,u2="HlsJsTrackRemovedError";class oQ extends Error{constructor(e){super(e),this.name=u2}}class lQ extends Dn{constructor(e,r){super("buffer-controller",e.logger),this.hls=void 0,this.fragmentTracker=void 0,this.details=null,this._objectUrl=null,this.operationQueue=null,this.bufferCodecEventsTotal=0,this.media=null,this.mediaSource=null,this.lastMpegAudioChunk=null,this.blockedAudioAppend=null,this.lastVideoAppendEnd=0,this.appendSource=void 0,this.transferData=void 0,this.overrides=void 0,this.appendErrors={audio:0,video:0,audiovideo:0},this.tracks={},this.sourceBuffers=[[null,null],[null,null]],this._onEndStreaming=n=>{var i;this.hls&&((i=this.mediaSource)==null?void 0:i.readyState)==="open"&&this.hls.pauseBuffering()},this._onStartStreaming=n=>{this.hls&&this.hls.resumeBuffering()},this._onMediaSourceOpen=n=>{const{media:i,mediaSource:s}=this;n&&this.log("Media source opened"),!(!i||!s)&&(s.removeEventListener("sourceopen",this._onMediaSourceOpen),i.removeEventListener("emptied",this._onMediaEmptied),this.updateDuration(),this.hls.trigger(I.MEDIA_ATTACHED,{media:i,mediaSource:s}),this.mediaSource!==null&&this.checkPendingTracks())},this._onMediaSourceClose=()=>{this.log("Media source closed")},this._onMediaSourceEnded=()=>{this.log("Media source ended")},this._onMediaEmptied=()=>{const{mediaSrc:n,_objectUrl:i}=this;n!==i&&this.error(`Media element src was set while attaching MediaSource (${i} > ${n})`)},this.hls=e,this.fragmentTracker=r,this.appendSource=OY(Ta(e.config.preferManagedMediaSource)),this.initTracks(),this.registerListeners()}hasSourceTypes(){return Object.keys(this.tracks).length>0}destroy(){this.unregisterListeners(),this.details=null,this.lastMpegAudioChunk=this.blockedAudioAppend=null,this.transferData=this.overrides=void 0,this.operationQueue&&(this.operationQueue.destroy(),this.operationQueue=null),this.hls=this.fragmentTracker=null,this._onMediaSourceOpen=this._onMediaSourceClose=null,this._onMediaSourceEnded=null,this._onStartStreaming=this._onEndStreaming=null}registerListeners(){const{hls:e}=this;e.on(I.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(I.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(I.MANIFEST_LOADING,this.onManifestLoading,this),e.on(I.MANIFEST_PARSED,this.onManifestParsed,this),e.on(I.BUFFER_RESET,this.onBufferReset,this),e.on(I.BUFFER_APPENDING,this.onBufferAppending,this),e.on(I.BUFFER_CODECS,this.onBufferCodecs,this),e.on(I.BUFFER_EOS,this.onBufferEos,this),e.on(I.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(I.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(I.FRAG_PARSED,this.onFragParsed,this),e.on(I.FRAG_CHANGED,this.onFragChanged,this),e.on(I.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(I.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(I.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(I.MANIFEST_LOADING,this.onManifestLoading,this),e.off(I.MANIFEST_PARSED,this.onManifestParsed,this),e.off(I.BUFFER_RESET,this.onBufferReset,this),e.off(I.BUFFER_APPENDING,this.onBufferAppending,this),e.off(I.BUFFER_CODECS,this.onBufferCodecs,this),e.off(I.BUFFER_EOS,this.onBufferEos,this),e.off(I.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(I.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(I.FRAG_PARSED,this.onFragParsed,this),e.off(I.FRAG_CHANGED,this.onFragChanged,this),e.off(I.ERROR,this.onError,this)}transferMedia(){const{media:e,mediaSource:r}=this;if(!e)return null;const n={};if(this.operationQueue){const s=this.isUpdating();s||this.operationQueue.removeBlockers();const a=this.isQueued();(s||a)&&this.warn(`Transfering MediaSource with${a?" operations in queue":""}${s?" updating SourceBuffer(s)":""} ${this.operationQueue}`),this.operationQueue.destroy()}const i=this.transferData;return!this.sourceBufferCount&&i&&i.mediaSource===r?et(n,i.tracks):this.sourceBuffers.forEach(s=>{const[a]=s;a&&(n[a]=et({},this.tracks[a]),this.removeBuffer(a)),s[0]=s[1]=null}),{media:e,mediaSource:r,tracks:n}}initTracks(){const e={};this.sourceBuffers=[[null,null],[null,null]],this.tracks=e,this.resetQueue(),this.resetAppendErrors(),this.lastMpegAudioChunk=this.blockedAudioAppend=null,this.lastVideoAppendEnd=0}onManifestLoading(){this.bufferCodecEventsTotal=0,this.details=null}onManifestParsed(e,r){var n;let i=2;(r.audio&&!r.video||!r.altAudio)&&(i=1),this.bufferCodecEventsTotal=i,this.log(`${i}
274 bufferCodec event(s) expected.`),(n=this.transferData)!=null&&n.mediaSource&&this.sourceBufferCount&&i&&this.bufferCreated()}onMediaAttaching(e,r){const n=this.media=r.media;this.transferData=this.overrides=void 0;const i=Ta(this.appendSource);if(i){const s=!!r.mediaSource;(s||r.overrides)&&(this.transferData=r,this.overrides=r.overrides);const a=this.mediaSource=r.mediaSource||new i;if(this.assignMediaSource(a),s)this._objectUrl=n.src,this.attachTransferred();else{const o=this._objectUrl=self.URL.createObjectURL(a);if(this.appendSource)try{n.removeAttribute("src");const l=self.ManagedMediaSource;n.disableRemotePlayback=n.disableRemotePlayback||l&&a instanceof l,FI(n),cQ(n,o),n.load()}catch{n.src=o}else n.src=o}n.addEventListener("emptied",this._onMediaEmptied)}}assignMediaSource(e){var r,n;this.log(`${((r=this.transferData)==null?void 0:r.mediaSource)===e?"transferred":"created"} media source: ${(n=e.constructor)==null?void 0:n.name}`),e.addEventListener("sourceopen",this._onMediaSourceOpen),e.addEventListener("sourceended",this._onMediaSourceEnded),e.addEventListener("sourceclose",this._onMediaSourceClose),this.appendSource&&(e.addEventListener("startstreaming",this._onStartStreaming),e.addEventListener("endstreaming",this._onEndStreaming))}attachTransferred(){const e=this.media,r=this.transferData;if(!r||!e)return;const n=this.tracks,i=r.tracks,s=i?Object.keys(i):null,a=s?s.length:0,o=()=>{Promise.resolve().then(()=>{this.media&&this.mediaSourceOpenOrEnded&&this._onMediaSourceOpen()})};if(i&&s&&a){if(!this.tracksReady){this.hls.config.startFragPrefetch=!0,this.log("attachTransferred: waiting for SourceBuffer track info");return}if(this.log(`attachTransferred: (bufferCodecEventsTotal ${this.bufferCodecEventsTotal})
275required tracks: ${it(n,(l,c)=>l==="initSegment"?void 0:c)};
276transfer tracks: ${it(i,(l,c)=>l==="initSegment"?void 0:c)}}`),!aj(i,n)){r.mediaSource=null,r.tracks=void 0;const l=e.currentTime,c=this.details,u=Math.max(l,(c==null?void 0:c.fragments[0].start)||0);if(u-l>1){this.log(`attachTransferred: waiting for playback to reach new tracks start time ${l} -> ${u}`);return}this.warn(`attachTransferred: resetting MediaSource for incompatible tracks ("${Object.keys(i)}"->"${Object.keys(n)}") start time: ${u} currentTime: ${l}`),this.onMediaDetaching(I.MEDIA_DETACHING,{}),this.onMediaAttaching(I.MEDIA_ATTACHING,r),e.currentTime=u;return}this.transferData=void 0,s.forEach(l=>{const c=l,u=i[c];if(u){const d=u.buffer;if(d){const f=this.fragmentTracker,h=u.id;if(f.hasFragments(h)||f.hasParts(h)){const m=Se.getBuffered(d);f.detectEvictedFragments(c,m,h,null,!0)}const p=L0(c),g=[c,d];this.sourceBuffers[p]=g,d.updating&&this.operationQueue&&this.operationQueue.prependBlocker(c),this.trackSourceBuffer(c,u)}}}),o(),this.bufferCreated()}else this.log("attachTransferred: MediaSource w/o SourceBuffers"),o()}get mediaSourceOpenOrEnded(){var e;const r=(e=this.mediaSource)==null?void 0:e.readyState;return r==="open"||r==="ended"}onMediaDetaching(e,r){const n=!!r.transferMedia;this.transferData=this.overrides=void 0;const{media:i,mediaSource:s,_objectUrl:a}=this;if(s){if(this.log(`media source ${n?"transferring":"detaching"}`),n)this.sourceBuffers.forEach(([o])=>{o&&this.removeBuffer(o)}),this.resetQueue();else{if(this.mediaSourceOpenOrEnded){const o=s.readyState==="open";try{const l=s.sourceBuffers;for(let c=l.length;c--;)o&&l[c].abort(),s.removeSourceBuffer(l[c]);o&&s.endOfStream()}catch(l){this.warn(`onMediaDetaching: ${l.message} while calling endOfStream`)}}this.sourceBufferCount&&this.onBufferReset()}s.removeEventListener("sourceopen",this._onMediaSourceOpen),s.removeEventListener("sourceended",this._onMediaSourceEnded),s.removeEventListener("sourceclose",this._onMediaSourceClose),this.appendSource&&(s.removeEventListener("startstreaming",this._onStartStreaming),s.removeEventListener("endstreaming",this._onEndStreaming)),this.mediaSource=null,this._objectUrl=null}i&&(i.removeEventListener("emptied",this._onMediaEmptied),n||(a&&self.URL.revokeObjectURL(a),this.mediaSrc===a?(i.removeAttribute("src"),this.appendSource&&FI(i),i.load()):this.warn("media|source.src was changed by a third party - skip cleanup")),this.media=null),this.hls.trigger(I.MEDIA_DETACHED,r)}
vendor: 15,181 bytes, line 276
276onBufferReset(){this.sourceBuffers.forEach(([e])=>{e&&this.resetBuffer(e)}),this.initTracks()}resetBuffer(e){var r;const n=(r=this.tracks[e])==null?void 0:r.buffer;if(this.removeBuffer(e),n)try{var i;(i=this.mediaSource)!=null&&i.sourceBuffers.length&&this.mediaSource.removeSourceBuffer(n)}catch(s){this.warn(`onBufferReset ${e}`,s)}delete this.tracks[e]}removeBuffer(e){this.removeBufferListeners(e),this.sourceBuffers[L0(e)]=[null,null];const r=this.tracks[e];r&&(r.buffer=void 0)}resetQueue(){this.operationQueue&&this.operationQueue.destroy(),this.operationQueue=new aQ(this.tracks)}onBufferCodecs(e,r){var n;const i=this.tracks,s=Object.keys(r);this.log(`BUFFER_CODECS: "${s}" (current SB count ${this.sourceBufferCount})`);const a="audiovideo"in r&&(i.audio||i.video)||i.audiovideo&&("audio"in r||"video"in r),o=!a&&this.sourceBufferCount&&this.media&&s.some(l=>!i[l]);if(a||o){this.warn(`Unsupported transition between "${Object.keys(i)}" and "${s}" SourceBuffers`);return}s.forEach(l=>{var c,u;const d=r[l],{id:f,codec:h,levelCodec:p,container:g,metadata:m,supplemental:v}=d;let y=i[l];const b=(c=this.transferData)==null||(c=c.tracks)==null?void 0:c[l],w=b!=null&&b.buffer?b:y,S=(w==null?void 0:w.pendingCodec)||(w==null?void 0:w.codec),T=w==null?void 0:w.levelCodec;y||(y=i[l]={buffer:void 0,listeners:[],codec:h,supplemental:v,container:g,levelCodec:p,metadata:m,id:f});const _=Up(S,T),A=_==null?void 0:_.replace(jI,"$1");let P=Up(h,p);const C=(u=P)==null?void 0:u.replace(jI,"$1");P&&_&&A!==C&&(l.slice(0,5)==="audio"&&(P=Mm(P,this.appendSource)),this.log(`switching codec ${S} to ${P}`),P!==(y.pendingCodec||y.codec)&&(y.pendingCodec=P),y.container=g,this.appendChangeType(l,g,P))}),(this.tracksReady||this.sourceBufferCount)&&(r.tracks=this.sourceBufferTracks),!this.sourceBufferCount&&(this.bufferCodecEventsTotal>1&&!this.tracks.video&&!r.video&&((n=r.audio)==null?void 0:n.id)==="main"&&(this.log("Main audio-only"),this.bufferCodecEventsTotal=1),this.mediaSourceOpenOrEnded&&this.checkPendingTracks())}get sourceBufferTracks(){return Object.keys(this.tracks).reduce((e,r)=>{const n=this.tracks[r];return e[r]={id:n.id,container:n.container,codec:n.codec,levelCodec:n.levelCodec},e},{})}appendChangeType(e,r,n){const i=`${r};codecs=${n}`,s={label:`change-type=${i}`,execute:()=>{const a=this.tracks[e];if(a){const o=a.buffer;o!=null&&o.changeType&&(this.log(`changing ${e} sourceBuffer type to ${i}`),o.changeType(i),a.codec=n,a.container=r)}this.shiftAndExecuteNext(e)},onStart:()=>{},onComplete:()=>{},onError:a=>{this.warn(`Failed to change ${e} SourceBuffer type`,a)}};this.append(s,e,this.isPending(this.tracks[e]))}blockAudio(e){var r;const n=e.start,i=n+e.duration*.05;if(((r=this.fragmentTracker.getAppendedFrag(n,oe.MAIN))==null?void 0:r.gap)===!0)return;const a={label:"block-audio",execute:()=>{var o;const l=this.tracks.video;(this.lastVideoAppendEnd>i||l!=null&&l.buffer&&Se.isBuffered(l.buffer,i)||((o=this.fragmentTracker.getAppendedFrag(i,oe.MAIN))==null?void 0:o.gap)===!0)&&(this.blockedAudioAppend=null,this.shiftAndExecuteNext("audio"))},onStart:()=>{},onComplete:()=>{},onError:o=>{this.warn("Error executing block-audio operation",o)}};this.blockedAudioAppend={op:a,frag:e},this.append(a,"audio",!0)}unblockAudio(){const{blockedAudioAppend:e,operationQueue:r}=this;e&&r&&(this.blockedAudioAppend=null,r.unblockAudio(e.op))}onBufferAppending(e,r){const{tracks:n}=this,{data:i,type:s,parent:a,frag:o,part:l,chunkMeta:c,offset:u}=r,d=c.buffering[s],{sn:f,cc:h}=o,p=self.performance.now();d.start=p;const g=o.stats.buffering,m=l?l.stats.buffering:null;g.start===0&&(g.start=p),m&&m.start===0&&(m.start=p);const v=n.audio;let y=!1;s==="audio"&&(v==null?void 0:v.container)==="audio/mpeg"&&(y=!this.lastMpegAudioChunk||c.id===1||this.lastMpegAudioChunk.sn!==c.sn,this.lastMpegAudioChunk=c);const b=n.video,w=b==null?void 0:b.buffer;if(w&&f!=="initSegment"){const _=l||o,A=this.blockedAudioAppend;if(s==="audio"&&a!=="main"&&!this.blockedAudioAppend&&!(b.ending||b.ended)){const C=_.start+_.duration*.05,O=w.buffered,R=this.currentOp("video");!O.length&&!R?this.blockAudio(_):!R&&!Se.isBuffered(w,C)&&this.lastVideoAppendEnd<C&&this.blockAudio(_)}else if(s==="video"){const P=_.end;if(A){const C=A.frag.start;(P>C||P<this.lastVideoAppendEnd||Se.isBuffered(w,C))&&this.unblockAudio()}this.lastVideoAppendEnd=P}}const S=(l||o).start,T={label:`append-${s}`,execute:()=>{var _;d.executeStart=self.performance.now();const A=(_=this.tracks[s])==null?void 0:_.buffer;A&&(y?this.updateTimestampOffset(A,S,.1,s,f,h):u!==void 0&&se(u)&&this.updateTimestampOffset(A,u,1e-6,s,f,h)),this.appendExecutor(i,s)},onStart:()=>{},onComplete:()=>{const _=self.performance.now();d.executeEnd=d.end=_,g.first===0&&(g.first=_),m&&m.first===0&&(m.first=_);const A={};this.sourceBuffers.forEach(([P,C])=>{P&&(A[P]=Se.getBuffered(C))}),this.appendErrors[s]=0,s==="audio"||s==="video"?this.appendErrors.audiovideo=0:(this.appendErrors.audio=0,this.appendErrors.video=0),this.hls.trigger(I.BUFFER_APPENDED,{type:s,frag:o,part:l,chunkMeta:c,parent:o.type,timeRanges:A})},onError:_=>{var A;const P={type:fe.MEDIA_ERROR,parent:o.type,details:V.BUFFER_APPEND_ERROR,sourceBufferName:s,frag:o,part:l,chunkMeta:c,error:_,err:_,fatal:!1},C=(A=this.media)==null?void 0:A.error;if(_.code===DOMException.QUOTA_EXCEEDED_ERR||_.name=="QuotaExceededError"||"quota"in _)P.details=V.BUFFER_FULL_ERROR;else if(_.code===DOMException.INVALID_STATE_ERR&&this.mediaSourceOpenOrEnded&&!C)P.errorAction=Ql(!0);else if(_.name===u2&&this.sourceBufferCount===0)P.errorAction=Ql(!0);else{const O=++this.appendErrors[s];this.warn(`Failed ${O}/${this.hls.config.appendErrorMaxRetry} times to append segment in "${s}" sourceBuffer (${C||"no media error"})`),(O>=this.hls.config.appendErrorMaxRetry||C)&&(P.fatal=!0)}this.hls.trigger(I.ERROR,P)}};this.log(`queuing "${s}" append sn: ${f}${l?" p: "+l.index:""} of ${o.type===oe.MAIN?"level":"track"} ${o.level} cc: ${h}`),this.append(T,s,this.isPending(this.tracks[s]))}getFlushOp(e,r,n){return this.log(`queuing "${e}" remove ${r}-${n}`),{label:"remove",execute:()=>{this.removeExecutor(e,r,n)},onStart:()=>{},onComplete:()=>{this.hls.trigger(I.BUFFER_FLUSHED,{type:e})},onError:i=>{this.warn(`Failed to remove ${r}-${n} from "${e}" SourceBuffer`,i)}}}onBufferFlushing(e,r){const{type:n,startOffset:i,endOffset:s}=r;n?this.append(this.getFlushOp(n,i,s),n):this.sourceBuffers.forEach(([a])=>{a&&this.append(this.getFlushOp(a,i,s),a)})}onFragParsed(e,r){const{frag:n,part:i}=r,s=[],a=i?i.elementaryStreams:n.elementaryStreams;a[nt.AUDIOVIDEO]?s.push("audiovideo"):(a[nt.AUDIO]&&s.push("audio"),a[nt.VIDEO]&&s.push("video"));const o=()=>{const l=self.performance.now();n.stats.buffering.end=l,i&&(i.stats.buffering.end=l);const c=i?i.stats:n.stats;this.hls.trigger(I.FRAG_BUFFERED,{frag:n,part:i,stats:c,id:n.type})};s.length===0&&this.warn(`Fragments must have at least one ElementaryStreamType set. type: ${n.type} level: ${n.level} sn: ${n.sn}`),this.blockBuffers(o,s).catch(l=>{this.warn(`Fragment buffered callback ${l}`),this.stepOperationQueue(this.sourceBufferTypes)})}onFragChanged(e,r){this.trimBuffers()}get bufferedToEnd(){return this.sourceBufferCount>0&&!this.sourceBuffers.some(([e])=>{if(e){const r=this.tracks[e];if(r)return!r.ended||r.ending}return!1})}onBufferEos(e,r){var n;this.sourceBuffers.forEach(([a])=>{if(a){const o=this.tracks[a];(!r.type||r.type===a)&&(o.ending=!0,o.ended||(o.ended=!0,this.log(`${a} buffer reached EOS`)))}});const i=((n=this.overrides)==null?void 0:n.endOfStream)!==!1;this.sourceBufferCount>0&&!this.sourceBuffers.some(([a])=>{var o;return a&&!((o=this.tracks[a])!=null&&o.ended)})?i?(this.log("Queueing EOS"),this.blockUntilOpen(()=>{this.tracksEnded();const{mediaSource:a}=this;if(!a||a.readyState!=="open"){a&&this.log(`Could not call mediaSource.endOfStream(). mediaSource.readyState: ${a.readyState}`);return}this.log("Calling mediaSource.endOfStream()"),a.endOfStream(),this.hls.trigger(I.BUFFERED_TO_END,void 0)})):(this.tracksEnded(),this.hls.trigger(I.BUFFERED_TO_END,void 0)):r.type==="video"&&this.unblockAudio()}tracksEnded(){this.sourceBuffers.forEach(([e])=>{if(e!==null){const r=this.tracks[e];r&&(r.ending=!1)}})}onLevelUpdated(e,{details:r}){r.fragments.length&&(this.details=r,this.updateDuration())}updateDuration(){this.blockUntilOpen(()=>{const e=this.getDurationAndRange();e&&this.updateMediaSource(e)})}onError(e,r){if(r.details===V.BUFFER_APPEND_ERROR&&r.frag){var n;const i=(n=r.errorAction)==null?void 0:n.nextAutoLevel;se(i)&&i!==r.frag.level&&this.resetAppendErrors()}}resetAppendErrors(){this.appendErrors={audio:0,video:0,audiovideo:0}}trimBuffers(){const{hls:e,details:r,media:n}=this;if(!n||r===null||!this.sourceBufferCount)return;const i=e.config,s=n.currentTime,a=r.levelTargetDuration,o=r.live&&i.liveBackBufferLength!==null?i.liveBackBufferLength:i.backBufferLength;if(se(o)&&o>=0){const c=Math.max(o,a),u=Math.floor(s/a)*a-c;this.flushBackBuffer(s,a,u)}const l=i.frontBufferFlushThreshold;if(se(l)&&l>0){const c=Math.max(i.maxBufferLength,l),u=Math.max(c,a),d=Math.floor(s/a)*a+u;this.flushFrontBuffer(s,a,d)}}flushBackBuffer(e,r,n){this.sourceBuffers.forEach(([i,s])=>{if(s){const o=Se.getBuffered(s);if(o.length>0&&n>o.start(0)){var a;this.hls.trigger(I.BACK_BUFFER_REACHED,{bufferEnd:n});const l=this.tracks[i];if((a=this.details)!=null&&a.live)this.hls.trigger(I.LIVE_BACK_BUFFER_REACHED,{bufferEnd:n});else if(l!=null&&l.ended){this.log(`Cannot flush ${i} back buffer while SourceBuffer is in ended state`);return}this.hls.trigger(I.BUFFER_FLUSHING,{startOffset:0,endOffset:n,type:i})}}})}flushFrontBuffer(e,r,n){this.sourceBuffers.forEach(([i,s])=>{if(s){const a=Se.getBuffered(s),o=a.length;if(o<2)return;const l=a.start(o-1),c=a.end(o-1);if(n>l||e>=l&&e<=c)return;this.hls.trigger(I.BUFFER_FLUSHING,{startOffset:l,endOffset:1/0,type:i})}})}getDurationAndRange(){var e;const{details:r,mediaSource:n}=this;if(!r||!this.media||(n==null?void 0:n.readyState)!=="open")return null;const i=r.edge;if(r.live&&this.hls.config.liveDurationInfinity){if(r.fragments.length&&n.setLiveSeekableRange){const c=Math.max(0,r.fragmentStart),u=Math.max(c,i);return{duration:1/0,start:c,end:u}}return{duration:1/0}}const s=(e=this.overrides)==null?void 0:e.duration;if(s)return se(s)?{duration:s}:null;const a=this.media.duration,o=se(n.duration)?n.duration:0;return i>o&&i>a||!se(a)?{duration:i}:null}updateMediaSource({duration:e,start:r,end:n}){const i=this.mediaSource;!this.media||!i||i.readyState!=="open"||(i.duration!==e&&(se(e)&&this.log(`Updating MediaSource duration to ${e.toFixed(3)}`),i.duration=e),r!==void 0&&n!==void 0&&(this.log(`MediaSource duration is set to ${i.duration}. Setting seekable range to ${r}-${n}.`),i.setLiveSeekableRange(r,n)))}get tracksReady(){const e=this.pendingTrackCount;return e>0&&(e>=this.bufferCodecEventsTotal||this.isPending(this.tracks.audiovideo))}checkPendingTracks(){const{bufferCodecEventsTotal:e,pendingTrackCount:r,tracks:n}=this;if(this.log(`checkPendingTracks (pending: ${r} codec events expected: ${e}) ${it(n)}`),this.tracksReady){var i;const s=(i=this.transferData)==null?void 0:i.tracks;s&&Object.keys(s).length?this.attachTransferred():this.createSourceBuffers()}}bufferCreated(){if(this.sourceBufferCount){const e={};this.sourceBuffers.forEach(([r,n])=>{if(r){const i=this.tracks[r];e[r]={buffer:n,container:i.container,codec:i.codec,supplemental:i.supplemental,levelCodec:i.levelCodec,id:i.id,metadata:i.metadata}}}),this.hls.trigger(I.BUFFER_CREATED,{tracks:e}),this.log(`SourceBuffers created. Running queue: ${this.operationQueue}`),this.sourceBuffers.forEach(([r])=>{this.executeNext(r)})}else{const e=new Error("could not create source buffer for media codec(s)");this.hls.trigger(I.ERROR,{type:fe.MEDIA_ERROR,details:V.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,error:e,reason:e.message})}}createSourceBuffers(){const{tracks:e,sourceBuffers:r,mediaSource:n}=this;if(!n)throw new Error("createSourceBuffers called when mediaSource was null");for(const s in e){const a=s,o=e[a];if(this.isPending(o)){const l=this.getTrackCodec(o,a),c=`${o.container};codecs=${l}`;o.codec=l,this.log(`creating sourceBuffer(${c})${this.currentOp(a)?" Queued":""} ${it(o)}`);try{const u=n.addSourceBuffer(c),d=L0(a),f=[a,u];r[d]=f,o.buffer=u}catch(u){var i;this.error(`error while trying to add sourceBuffer: ${u.message}`),this.shiftAndExecuteNext(a),(i=this.operationQueue)==null||i.removeBlockers(),delete this.tracks[a],this.hls.trigger(I.ERROR,{type:fe.MEDIA_ERROR,details:V.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:u,sourceBufferName:a,mimeType:c,parent:o.id});return}this.trackSourceBuffer(a,o)}}this.bufferCreated()}getTrackCodec(e,r){const n=e.supplemental;let i=e.codec;n&&(r==="video"||r==="audiovideo")&&Zd(n,"video")&&(i=JY(i,n));const s=Up(i,e.levelCodec);return s?r.slice(0,5)==="audio"?Mm(s,this.appendSource):s:""}trackSourceBuffer(e,r){const n=r.buffer;if(!n)return;const i=this.getTrackCodec(r,e);this.tracks[e]={buffer:n,codec:i,container:r.container,levelCodec:r.levelCodec,supplemental:r.supplemental,metadata:r.metadata,id:r.id,listeners:[]},this.removeBufferListeners(e),this.addBufferListener(e,"updatestart",this.onSBUpdateStart),this.addBufferListener(e,"updateend",this.onSBUpdateEnd),this.addBufferListener(e,"error",this.onSBUpdateError),this.appendSource&&this.addBufferListener(e,"bufferedchange",(s,a)=>{const o=a.removedRanges;o!=null&&o.length&&this.hls.trigger(I.BUFFER_FLUSHED,{type:s})})}get mediaSrc(){var e,r;const n=((e=this.media)==null||(r=e.querySelector)==null?void 0:r.call(e,"source"))||this.media;return n==null?void 0:n.src}onSBUpdateStart(e){const r=this.currentOp(e);r&&r.onStart()}onSBUpdateEnd(e){var r;if(((r=this.mediaSource)==null?void 0:r.readyState)==="closed"){this.resetBuffer(e);return}const n=this.currentOp(e);n&&(n.onComplete(),this.shiftAndExecuteNext(e))}onSBUpdateError(e,r){var n;const i=new Error(`${e} SourceBuffer error. MediaSource readyState: ${(n=this.mediaSource)==null?void 0:n.readyState}`);this.error(`${i}`,r),this.hls.trigger(I.ERROR,{type:fe.MEDIA_ERROR,details:V.BUFFER_APPENDING_ERROR,sourceBufferName:e,error:i,fatal:!1});const s=this.currentOp(e);s&&s.onError(i)}updateTimestampOffset(e,r,n,i,s,a){const o=r-e.timestampOffset;Math.abs(o)>=n&&(this.log(`Updating ${i} SourceBuffer timestampOffset to ${r} (sn: ${s} cc: ${a})`),e.timestampOffset=r)}removeExecutor(e,r,n){const{media:i,mediaSource:s}=this,a=this.tracks[e],o=a==null?void 0:a.buffer;if(!i||!s||!o){this.warn(`Attempting to remove from the ${e} SourceBuffer, but it does not exist`),this.shiftAndExecuteNext(e);return}const l=se(i.duration)?i.duration:1/0,c=se(s.duration)?s.duration:1/0,u=Math.max(0,r),d=Math.min(n,l,c);d>u&&(!a.ending||a.ended)?(a.ended=!1,this.log(`Removing [${u},${d}] from the ${e} SourceBuffer`),o.remove(u,d)):this.shiftAndExecuteNext(e)}appendExecutor(e,r){const n=this.tracks[r],i=n==null?void 0:n.buffer;if(!i)throw new oQ(`Attempting to append to the ${r} SourceBuffer, but it does not exist`);n.ending=!1,n.ended=!1,i.appendBuffer(e)}blockUntilOpen(e){if(this.isUpdating()||this.isQueued())this.blockBuffers(e).catch(r=>{this.warn(`SourceBuffer blocked callback ${r}
276`),this.stepOperationQueue(this.sourceBufferTypes)});else try{e()}catch(r){this.warn(`Callback run without blocking ${this.operationQueue} ${r}`)}}isUpdating(){return this.sourceBuffers.some(([e,r])=>e&&r.updating)}isQueued(){return this.sourceBuffers.some(([e])=>e&&!!this.currentOp(e))}isPending(e){return!!e&&!e.buffer}blockBuffers(e,r=this.sourceBufferTypes){if(!r.length)return this.log("Blocking operation requested, but no SourceBuffers exist"),Promise.resolve().then(e);const{operationQueue:n}=this,i=r.map(a=>this.appendBlocker(a));return r.length>1&&!!this.blockedAudioAppend&&this.unblockAudio(),Promise.all(i).then(a=>{n===this.operationQueue&&(e(),this.stepOperationQueue(this.sourceBufferTypes))})}stepOperationQueue(e){e.forEach(r=>{var n;const i=(n=this.tracks[r])==null?void 0:n.buffer;!i||i.updating||this.shiftAndExecuteNext(r)})}append(e,r,n){this.operationQueue&&this.operationQueue.append(e,r,n)}appendBlocker(e){if(this.operationQueue)return this.operationQueue.appendBlocker(e)}currentOp(e){return this.operationQueue?this.operationQueue.current(e):null}executeNext(e){e&&this.operationQueue&&this.operationQueue.executeNext(e)}shiftAndExecuteNext(e){this.operationQueue&&this.operationQueue.shiftAndExecuteNext(e)}get pendingTrackCount(){return Object.keys(this.tracks).reduce((e,r)=>e+(this.isPending(this.tracks[r])?1:0),0)}get sourceBufferCount(){return this.sourceBuffers.reduce((e,[r])=>e+(r?1:0),0)}get sourceBufferTypes(){return this.sourceBuffers.map(([e])=>e).filter(e=>!!e)}addBufferListener(e,r,n){const i=this.tracks[e];if(!i)return;const s=i.buffer;if(!s)return;const a=n.bind(this,e);i.listeners.push({event:r,listener:a}),s.addEventListener(r,a)}removeBufferListeners(e){const r=this.tracks[e];if(!r)return;const n=r.buffer;n&&(r.listeners.forEach(i=>{n.removeEventListener(i.event,i.listener)}),r.listeners.length=0)}}function FI(t){const e=t.querySelectorAll("source");[].slice.call(e).forEach(r=>{t.removeChild(r)})}function cQ(t,e){const r=self.document.createElement("source");r.type="video/mp4",r.src=e,t.appendChild(r)}function L0(t){return t==="audio"?1:0}class VT{constructor(e){this.hls=void 0,this.autoLevelCapping=void 0,this.firstLevel=void 0,this.media=void 0,this.restrictedLevels=void 0,this.timer=void 0,this.clientRect=void 0,this.streamController=void 0,this.hls=e,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.firstLevel=-1,this.media=null,this.restrictedLevels=[],this.timer=void 0,this.clientRect=null,this.registerListeners()}setStreamController(e){this.streamController=e}destroy(){this.hls&&this.unregisterListener(),this.timer&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null}registerListeners(){const{hls:e}=this;e.on(I.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.on(I.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(I.MANIFEST_PARSED,this.onManifestParsed,this),e.on(I.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(I.BUFFER_CODECS,this.onBufferCodecs,this),e.on(I.MEDIA_DETACHING,this.onMediaDetaching,this)}unregisterListener(){const{hls:e}=this;e.off(I.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.off(I.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(I.MANIFEST_PARSED,this.onManifestParsed,this),e.off(I.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(I.BUFFER_CODECS,this.onBufferCodecs,this),e.off(I.MEDIA_DETACHING,this.onMediaDetaching,this)}onFpsDropLevelCapping(e,r){const n=this.hls.levels[r.droppedLevel];this.isLevelAllowed(n)&&this.restrictedLevels.push({bitrate:n.bitrate,height:n.height,width:n.width})}onMediaAttaching(e,r){this.media=r.media instanceof HTMLVideoElement?r.media:null,this.clientRect=null,this.timer&&this.hls.levels.length&&this.detectPlayerSize()}onManifestParsed(e,r){const n=this.hls;this.restrictedLevels=[],this.firstLevel=r.firstLevel,n.config.capLevelToPlayerSize&&r.video&&this.startCapping()}onLevelsUpdated(e,r){this.timer&&se(this.autoLevelCapping)&&this.detectPlayerSize()}onBufferCodecs(e,r){this.hls.config.capLevelToPlayerSize&&r.video&&this.startCapping()}onMediaDetaching(){this.stopCapping(),this.media=null}detectPlayerSize(){if(this.media){if(this.mediaHeight<=0||this.mediaWidth<=0){this.clientRect=null;return}const e=this.hls.levels;if(e.length){const r=this.hls,n=this.getMaxLevel(e.length-1);n!==this.autoLevelCapping&&r.logger.log(`Setting autoLevelCapping to ${n}: ${e[n].height}p@${e[n].bitrate} for media ${this.mediaWidth}x${this.mediaHeight}`),r.autoLevelCapping=n,r.autoLevelEnabled&&r.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=r.autoLevelCapping}}}getMaxLevel(e){const r=this.hls.levels;if(!r.length)return-1;const n=r.filter((i,s)=>this.isLevelAllowed(i)&&s<=e);return this.clientRect=null,VT.getMaxLevelByMediaSize(n,this.mediaWidth,this.mediaHeight)}startCapping(){this.timer||(this.autoLevelCapping=Number.POSITIVE_INFINITY,self.clearInterval(this.timer),this.timer=self.setInterval(this.detectPlayerSize.bind(this),1e3),this.detectPlayerSize())}stopCapping(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)}getDimensions(){if(this.clientRect)return this.clientRect;const e=this.media,r={width:0,height:0};if(e){const n=e.getBoundingClientRect();r.width=n.width,r.height=n.height,!r.width&&!r.height&&(r.width=n.right-n.left||e.
vendor: 4,444 bytes, line 276
276width||0,r.height=n.bottom-n.top||e.height||0)}return this.clientRect=r,r}get mediaWidth(){return this.getDimensions().width*this.contentScaleFactor}get mediaHeight(){return this.getDimensions().height*this.contentScaleFactor}get contentScaleFactor(){let e=1;if(!this.hls.config.ignoreDevicePixelRatio)try{e=self.devicePixelRatio}catch{}return Math.min(e,this.hls.config.maxDevicePixelRatio)}isLevelAllowed(e){return!this.restrictedLevels.some(n=>e.bitrate===n.bitrate&&e.width===n.width&&e.height===n.height)}static getMaxLevelByMediaSize(e,r,n){if(!(e!=null&&e.length))return-1;const i=(o,l)=>l?o.width!==l.width||o.height!==l.height:!0;let s=e.length-1;const a=Math.max(r,n);for(let o=0;o<e.length;o+=1){const l=e[o];if((l.width>=a||l.height>=a)&&i(l,e[o+1])){s=o;break}}return s}}const uQ={MANIFEST:"m",AUDIO:"a",VIDEO:"v",MUXED:"av",INIT:"i",CAPTION:"c",TIMED_TEXT:"tt",KEY:"k",OTHER:"o"},jr=uQ,dQ={HLS:"h"},fQ=dQ;class ji{constructor(e,r){Array.isArray(e)&&(e=e.map(n=>n instanceof ji?n:new ji(n))),this.value=e,this.params=r}}const hQ="Dict";function pQ(t){return Array.isArray(t)?JSON.stringify(t):t instanceof Map?"Map{}":t instanceof Set?"Set{}":typeof t=="object"?JSON.stringify(t):String(t)}function mQ(t,e,r,n){return new Error(`failed to ${t} "${pQ(e)}" as ${r}`,{cause:n})}function Fi(t,e,r){return mQ("serialize",t,e,r)}class d2{constructor(e){this.description=e}}const BI="Bare Item",gQ="Boolean";function vQ(t){if(typeof t!="boolean")throw Fi(t,gQ);return t?"?1":"?0"}function yQ(t){return btoa(String.fromCharCode(...t))}const bQ="Byte Sequence";function xQ(t){if(ArrayBuffer.isView(t)===!1)throw Fi(t,bQ);return`:${yQ(t)}:`}const wQ="Integer";function SQ(t){return t<-999999999999999||999999999999999<t}function f2(t){if(SQ(t))throw Fi(t,wQ);return t.toString()}function EQ(t){return`@${f2(t.getTime()/1e3)}`}function h2(t,e){if(t<0)return-h2(-t,e);const r=Math.pow(10,e);if(Math.abs(t*r%1-.5)<Number.EPSILON){const i=Math.floor(t*r);return(i%2===0?i:i+1)/r}else return Math.round(t*r)/r}const TQ="Decimal";function _Q(t){const e=h2(t,3);if(Math.floor(Math.abs(e)).toString().length>12)throw Fi(t,TQ);const r=e.toString();return r.includes(".")?r:`${r}.0`}const AQ="String",PQ=/[\x00-\x1f\x7f]+/;function IQ(t){if(PQ.test(t))throw Fi(t,AQ);return`"${t.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`}function CQ(t){return t.description||t.toString().slice(7,-1)}const OQ="Token";function UI(t){const e=CQ(t);if(/^([a-zA-Z*])([!#$%&'*+\-.^_`|~\w:/]*)$/.test(e)===!1)throw Fi(e,OQ);return e}function yw(t){switch(typeof t){case"number":if(!se(t))throw Fi(t,BI);return Number.isInteger(t)?f2(t):_Q(t);case"string":return IQ(t);case"symbol":return UI(t);case"boolean":return vQ(t);case"object":if(t instanceof Date)return EQ(t);if(t instanceof Uint8Array)return xQ(t);if(t instanceof d2)return UI(t);default:throw Fi(t,BI)}}const RQ="Key";function bw(t){if(/^[a-z*][a-z0-9\-_.*]*$/.test(t)===!1)throw Fi(t,RQ);return t}function HT(t){return t==null?"":Object.entries(t).map(([e,r])=>r===!0?`;${bw(e)}`:`;${bw(e)}=${yw(r)}`).join("")}function p2(t){return t instanceof ji?`${yw(t.value)}${HT(t.params)}`:yw(t)}function kQ(t){return`(${t.value.map(p2).join(" ")})${HT(t.params)}`}function LQ(t,e={whitespace:!0}){if(typeof t!="object"||t==null)throw Fi(t,hQ);const r=t instanceof Map?t.entries():Object.entries(t),n=e!=null&&e.whitespace?" ":"";return Array.from(r).map(([i,s])=>{s instanceof ji||(s=new ji(s));let a=bw(i);return s.value===!0?a+=HT(s.params):(a+="=",Array.isArray(s.value)?a+=kQ(s):a+=p2(s)),a}).join(`,${n}`)}function m2(t,e){return LQ(t,e)}const vi="CMCD-Object",Pt="CMCD-Request",Ka="CMCD-Session",Bs="CMCD-Status",DQ={br:vi,ab:vi,d:vi,ot:vi,tb:vi,tpb:vi,lb:vi,tab:vi,lab:vi,url:vi,pb:Pt,bl:Pt,tbl:Pt,dl:Pt,ltc:Pt,mtp:Pt,nor:Pt,nrr:Pt,rc:Pt,sn:Pt,sta:Pt,su:Pt,ttfb:Pt,ttfbb:Pt,ttlb:Pt,cmsdd:Pt,cmsds:Pt,smrt:Pt,df:Pt,cs:Pt,ts:Pt,cid:Ka,pr:Ka,sf:Ka,sid:Ka,st:Ka,v:Ka,msd:Ka,bs:Bs,bsd:Bs,cdn:Bs,rtp:Bs,bg:Bs,pt:Bs,ec:Bs,e:Bs},NQ={REQUEST:Pt};function MQ(t){return Object.keys(t).reduce((e,r)=>{var n;return(n=t[r])===null||n===void 0||n.forEach(i=>e[i]=r),e},{})}function $Q(t,e){const r={};if(!t)return r;const n=Object.keys(t),i=e?MQ(e):{};return n.reduce((s,a)=>{var o;const l=DQ[a]||i[a]||NQ.REQUEST,c=(o=s[l])!==null&&o!==void 0?o:s[l]={};return c[a]=t[a],s},r)}function jQ(t){return["ot","sf","st","e","sta"].includes(t)}function FQ(t){return typeof t=="number"?se(t):t!=null&&t!==""&&t!==!1}const g2="event";
276function BQ(t,e){const r=new URL(t),n=new URL(e);if(r.origin!==n.origin)return t;const i=r.pathname.split("/").slice(1),s=n.pathname.split("/").slice(1,-1);for(;i[0]===s[0];)i.shift(),s.shift();for(;s.length;)s.shift(),i.unshift("..");return i.join("/")+r.search+r.hash}const Kp=t=>Math.round(t),xw=(t,e)=>Array.isArray(t)?t.map(r=>xw(r,e)):t instanceof ji&&typeof t.value=="string"?new ji(xw(t.value,e),t.params):(e.baseUrl&&(t=BQ(t,e.baseUrl)),e.version===1?encodeURIComponent(t):t),ep=t=>Kp(t/100)*100,UQ=(t,e)=>{let r=t;return e.version>=2&&(t instanceof ji&&typeof t.value=="string"?r=new ji([t]):typeof t=="string"&&(r=[t])),xw(r,e)},GQ={br:Kp,d:Kp,bl:ep,dl:ep,mtp:ep,nor:UQ,rtp:ep,tb:Kp},v2="request",y2="response",KT=["ab","bg","bl","br","bs","bsd","cdn","cid","cs","df","ec","lab","lb","ltc","msd","mtp","pb","pr","pt","sf","sid","sn","st","sta","tab","tb","tbl","tpb","ts","v"],WQ=["e"],VQ=/^[a-zA-Z0-9-.]+-[a-zA-Z0-9-.]+$/;function Lv(t){return VQ.test(t)}function HQ(t){return KT.includes(t)||WQ.includes(t)||Lv(t)}const b2=["d","dl","nor","ot","rtp","su"];function KQ(t){return KT.includes(t)||b2.includes(t)||Lv(t)}const zQ=["cmsdd","cmsds","rc","smrt","ttfb","ttfbb","ttlb","url"];function qQ(t){return KT.includes(t)||b2.includes(t)||zQ.includes(t)||Lv(t)}const YQ=["bl","br","bs","cid","d","dl","mtp","nor","nrr","ot","pr","rtp","sf","sid","st","su","tb","v"];function XQ(t){return YQ.includes(t)||Lv(t)}const QQ={[y2]:qQ,[g2]:HQ,[v2]:KQ};function x2(t,e={}){const r={};if(t==null||typeof t!="object")return r;const n=e.version||t.v||1,i=e.reportingMode||v2,s=n===1?XQ:QQ[i];let a=Object.keys(t).filter(s);const o=e.filter;typeof o=="function"&&(a=a.filter(o));const l=i===y2||i===g2;l&&!a.includes("ts")&&a.push("ts"),n>1&&!a.includes("v")&&a.push("v");const c=et({},GQ,e.formatters),u={version:n,reportingMode:i,baseUrl:e.baseUrl};return a.sort().forEach(d=>{let f=t[d];const h=c[d];if(typeof h=="function"&&(f=h(f,u)),d==="v"){if(n===1)return;f=n}d=="pr"&&f===1||(l&&d==="ts"&&!se(f)&&(f=Date.now()),FQ(f)&&(jQ(d)&&typeof f=="string"&&(f=new d2(f)),r[d]=f))}),r}function JQ(t,e={}){const r={};if(!t)return r;const n=x2(t,e),i=$Q(n,e==null?void 0:e.customHeaderMap);return Object.entries(i).reduce((s,[a,o])=>{const l=m2(o,{whitespace:!1});return l&&(s[a]=l),s},r)}function ZQ(t,e,r){return et(t,JQ(e,r))}const eJ="CMCD";function tJ(t,e={}){return t?m2(x2(t,e),{whitespace:!1}):""}function rJ(t,e={}){if(!t)return"";const r=tJ(t,e);return encodeURIComponent(r)}function nJ(t,e={}){if(!t)return"";const r=rJ(t,e);return`${eJ}=${r}`}const GI=/CMCD=[^&#]+/;function iJ(t,e,r){const n=nJ(e,r);if(!n)return t;if(GI.test(t))return t.replace(GI,n);const i=t.includes("?")?"&":"?";return`${t}${i}${n}`}class sJ{constructor(e){this.hls=void 0,this.config=void 0,this.media=void 0,this.sid=void 0,this.cid=void 0,this.useHeaders=!1,this.includeKeys=void 0,this.initialized=!1,this.starved=!1,this.buffering=!0,this.audioBuffer=void 0,this.videoBuffer=void 0,this.onWaiting=()=>{this.initialized&&(this.starved=!0),this.buffering=!0},this.onPlaying=()=>{this.initialized||(this.initialized=!0),this.buffering=!1},this.applyPlaylistData=i=>{try{this.apply(i,{ot:jr.MANIFEST,su:!this.initialized})}catch(s){this.hls.logger.warn("Could not generate manifest CMCD data.",s)}},this.applyFragmentData=i=>{try{const{frag:s,part:a}=i,o=this.hls.levels[s.level],l=this.getObjectType(s),c={d:(a||s).duration*1e3,ot:l};(l===jr.VIDEO||l===jr.AUDIO||l==jr.MUXED)&&(c.br=o.bitrate/1e3,c.tb=this.getTopBandwidth(l)/1e3,c.bl=this.getBufferLength(l));const u=a?this.getNextPart(a):this.getNextFrag(s);u!=null&&u.url&&u.url!==s.url&&(c.nor=u.url),this.apply(i,c)}catch(s){this.hls.logger.warn("Could not generate segment CMCD data.",s)}},this.hls=e;const r=this.config=e.config,{cmcd:n}=r;n!=null&&(r.pLoader=this.createPlaylistLoader(),r.fLoader=this.createFragmentLoader(),this.sid=n.sessionId||e.sessionId,this.cid=n.contentId,this.useHeaders=n.useHeaders===!0,this.includeKeys=n.includeKeys,this.registerListeners())}registerListeners(){const e=this.hls;e.on(I.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(I.MEDIA_DETACHED,this.onMediaDetached,this),e.on(I.BUFFER_CREATED,this.onBufferCreated,this)}unregisterListeners(){const e=this.hls;
276e.off(I.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(I.MEDIA_DETACHED,this.onMediaDetached,this),e.off(I.BUFFER_CREATED,this.onBufferCreated,this)}destroy(){this.unregisterListeners(),this.onMediaDetached(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null,this.onWaiting=this.onPlaying=this.media=null}onMediaAttached(e,r){this.media=r.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)}onMediaDetached(){this.media&&(this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null)}onBufferCreated(e,r){var n,i;this.audioBuffer=(n=r.tracks.audio)==null?void 0:n.buffer,this.videoBuffer=(i=r.tracks.video)==null?void 0:i.buffer}createData(){var e;return{v:1,sf:fQ.HLS,sid:this.sid,cid:this.cid,pr:(e=this.media)==null?void 0:e.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}}apply(e,r={}){et(r,this.createData());const n=r.ot===jr.INIT||r.ot===jr.VIDEO||r.ot===jr.MUXED;this.starved&&n&&(r.bs=!0,r.su=!0,this.starved=!1),r.su==null&&(r.su=this.buffering);const{includeKeys:i}=this;i&&(r=Object.keys(r).reduce((a,o)=>(i.includes(o)&&(a[o]=r[o]),a),{}));const s={baseUrl:e.url};this.useHeaders?(e.headers||(e.headers={}),ZQ(e.headers,r,s)):e.url=iJ(e.url,r,s)}getNextFrag(e){var r;const n=(r=this.hls.levels[e.level])==null?void 0:r.details;if(n){const i=e.sn-n.startSN;return n.fragments[i+1]}}getNextPart(e){var r;const{index:n,fragment:i}=e,s=(r=this.hls.levels[i.level])==null||(r=r.details)==null?void 0:r.partList;if(s){const{sn:a}=i;for(let o=s.length-1;o>=0;o--){const l=s[o];if(l.index===n&&l.fragment.sn===a)return s[o+1]}}}getObjectType(e){const{type:r}=e;if(r==="subtitle")return jr.TIMED_TEXT;if(e.sn==="initSegment")return jr.INIT;if(r==="audio")return jr.AUDIO;if(r==="main")return this.hls.audioTracks.length?jr.VIDEO:jr.MUXED}getTopBandwidth(e){let r=0,n;const i=this.hls;if(e===jr.AUDIO)n=i.audioTracks;else{const s=i.maxAutoLevel,a=s>-1?s+1:i.levels.length;n=i.levels.slice(0,a)}return n.forEach(s=>{s.bitrate>r&&(r=s.bitrate)}),r>0?r:NaN}getBufferLength(e){const r=this.media,n=e===jr.AUDIO?this.audioBuffer:this.videoBuffer;return!n||!r?NaN:Se.bufferInfo(n,r.currentTime,this.config.maxBufferHole).len*1e3}createPlaylistLoader(){const{pLoader:e}=this.config,r=this.applyPlaylistData,n=e||this.config.loader;return class{constructor(s){this.loader=void 0,this.loader=new n(s)}get stats(){return this.loader.stats}get context(){return this.loader.context}destroy(){this.loader.destroy()}abort(){this.loader.abort()}load(s,a,o){r(s),this.loader.load(s,a,o)}}}createFragmentLoader(){const{fLoader:e}=this.config,r=this.applyFragmentData,n=e||this.config.loader;return class{constructor(s){this.loader=void 0,this.loader=new n(s)}get stats(){return this.loader.stats}get context(){return this.loader.context}destroy(){this.loader.destroy()}abort(){this.loader.abort()}load(s,a,o){r(s),this.loader.load(s,a,o)}}}}const aJ=3e5;class oJ extends Dn{constructor(e){super("content-steering",e.logger),this.hls=void 0,this.loader=null,this.uri=null,this.pathwayId=".",this._pathwayPriority=null,this.timeToLoad=300,this.reloadTimer=-1,this.updated=0,this.started=!1,this.enabled=!0,this.levels=null,this.audioTracks=null,this.subtitleTracks=null,this.penalizedPathways={},this.hls=e,this.registerListeners()}registerListeners(){const e=this.hls;e.on(I.MANIFEST_LOADING,this.onManifestLoading,this),e.on(I.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(I.MANIFEST_PARSED,this.onManifestParsed,this),e.on(I.ERROR,this.onError,this)}unregisterListeners(){const e=this.hls;e&&(e.off(I.MANIFEST_LOADING,this.onManifestLoading,this),e.off(I.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(I.MANIFEST_PARSED,this.onManifestParsed,this),e.off(I.ERROR,this.onError,this))}pathways(){return(this.levels||[]).reduce((e,r)=>(e.indexOf(r.pathwayId)===-1&&e.push(r.pathwayId),e),[])}get pathwayPriority(){return this._pathwayPriority}set pathwayPriority(e){this.updatePathwayPriority(e)}startLoad(){if(this.started=!0,this.clearTimeout(),this.enabled&&this.uri){if(this.updated){const e=this.timeToLoad*1e3-(performance.now()-this.updated);if(e>0){this.scheduleRefresh(this.uri,e);return}}this.loadSteeringManifest(this.uri)}}stopLoad(){this.started=!1,this.loader&&(this.loader.destroy(),this.loader=null),this.clearTimeout()}clearTimeout(){this.reloadTimer!==-1&&(self.clearTimeout(this.reloadTimer),this.reloadTimer=-1)}destroy(){this.unregisterListeners(),this.stopLoad(),this.hls=null,this.levels=this.audioTracks=this.subtitleTracks=null}removeLevel(e){const r=this.levels;r&&(this.levels=r.filter(n=>n!==e))}onManifestLoading(){this.stopLoad(),this.enabled=!0,this.timeToLoad=300,this.updated=0,this.uri=null,this.pathwayId=".",this.levels=this.audioTracks=this.subtitleTracks=null}onManifestLoaded(e,r){const{contentSteering:n}=r;n!==null&&(this.pathwayId=n.pathwayId,this.uri=n.uri,this.started&&this.startLoad())}onManifestParsed(e,r){this.audioTracks=r.audioTracks,this.subtitleTracks=r.subtitleTracks}onError(e,r){const{errorAction:n}=r;if((n==null?void 0:n.action)===hr.SendAlternateToPenaltyBox&&n.flags===Jr.MoveAllAlternatesMatchingHost){const i=this.levels;let s=this._pathwayPriority,a=this.pathwayId;if(r.context){const{groupId:o,pathwayId:l,type:c}=r.context;o&&i?a=this.getPathwayForGroupId(o,c,a):l&&(a=l)}a in this.penalizedPathways||(this.penalizedPathways[a]=performance.now()),!s&&i&&(s=this.pathways()),s&&s.length>1&&(this.updatePathwayPriority(s),n.resolved=this.pathwayId!==a),r.details===V.BUFFER_APPEND_ERROR&&!r.fatal?n.resolved=!0:n.resolved||this.warn(`Could not resolve ${r.details} ("${r.error.message}") with content-steering for Pathway: ${a} levels: ${i&&i.length} priorities: ${it(s)} penalized: ${it(this.penalizedPathways)}`)}}filterParsedLevels(e){this.levels=e;let r=this.getLevelsForPathway(this.pathwayId);if(r.length===0){const n=e[0].pathwayId;this.log(`No levels found in Pathway ${this.pathwayId}. Setting initial Pathway to "${n}"`),r=this.getLevelsForPathway(n),this.pathwayId=n}return r.length!==e.length&&this.log(`Found ${r.length}/${e.length} levels in Pathway "${this.pathwayId}"`),r}getLevelsForPathway(e){return this.levels===null?[]:this.levels.filter(r=>e===r.pathwayId)}updatePathwayPriority(e){this._pathwayPriority=e;let r;const n=this.penalizedPathways,i=performance.now();
vendor: 4,390 bytes, line 276
276Object.keys(n).forEach(s=>{i-n[s]>aJ&&delete n[s]});for(let s=0;s<e.length;s++){const a=e[s];if(a in n)continue;if(a===this.pathwayId)return;const o=this.hls.nextLoadLevel,l=this.hls.levels[o];if(r=this.getLevelsForPathway(a),r.length>0){this.log(`Setting Pathway to "${a}"`),this.pathwayId=a,Bj(r),this.hls.trigger(I.LEVELS_UPDATED,{levels:r});const c=this.hls.levels[o];l&&c&&this.levels&&(c.attrs["STABLE-VARIANT-ID"]!==l.attrs["STABLE-VARIANT-ID"]&&c.bitrate!==l.bitrate&&this.log(`Unstable Pathways change from bitrate ${l.bitrate} to ${c.bitrate}`),this.hls.nextLoadLevel=o);break}}}getPathwayForGroupId(e,r,n){const i=this.getLevelsForPathway(n).concat(this.levels||[]);for(let s=0;s<i.length;s++)if(r===Ce.AUDIO_TRACK&&i[s].hasAudioGroup(e)||r===Ce.SUBTITLE_TRACK&&i[s].hasSubtitleGroup(e))return i[s].pathwayId;return n}clonePathways(e){const r=this.levels;if(!r)return;const n={},i={};e.forEach(s=>{const{ID:a,"BASE-ID":o,"URI-REPLACEMENT":l}=s;if(r.some(u=>u.pathwayId===a))return;const c=this.getLevelsForPathway(o).map(u=>{const d=new St(u.attrs);d["PATHWAY-ID"]=a;const f=d.AUDIO&&`${d.AUDIO}_clone_${a}`,h=d.SUBTITLES&&`${d.SUBTITLES}_clone_${a}`;f&&(n[d.AUDIO]=f,d.AUDIO=f),h&&(i[d.SUBTITLES]=h,d.SUBTITLES=h);const p=w2(u.uri,d["STABLE-VARIANT-ID"],"PER-VARIANT-URIS",l),g=new tf({attrs:d,audioCodec:u.audioCodec,bitrate:u.bitrate,height:u.height,name:u.name,url:p,videoCodec:u.videoCodec,width:u.width});if(u.audioGroups)for(let m=1;m<u.audioGroups.length;m++)g.addGroupId("audio",`${u.audioGroups[m]}_clone_${a}`);if(u.subtitleGroups)for(let m=1;m<u.subtitleGroups.length;m++)g.addGroupId("text",`${u.subtitleGroups[m]}_clone_${a}`);return g});r.push(...c),WI(this.audioTracks,n,l,a),WI(this.subtitleTracks,i,l,a)})}loadSteeringManifest(e){const r=this.hls.config,n=r.loader;this.loader&&this.loader.destroy(),this.loader=new n(r);let i;try{i=new self.URL(e)}catch{this.enabled=!1,this.log(`Failed to parse Steering Manifest URI: ${e}`);return}if(i.protocol!=="data:"){const u=(this.hls.bandwidthEstimate||r.abrEwmaDefaultEstimate)|0;i.searchParams.set("_HLS_pathway",this.pathwayId),i.searchParams.set("_HLS_throughput",""+u)}const s={responseType:"json",url:i.href},a=r.steeringManifestLoadPolicy.default,o=a.errorRetry||a.timeoutRetry||{},l={loadPolicy:a,timeout:a.maxLoadTimeMs,maxRetry:o.maxNumRetry||0,retryDelay:o.retryDelayMs||0,maxRetryDelay:o.maxRetryDelayMs||0},c={onSuccess:(u,d,f,h)=>{this.log(`Loaded steering manifest: "${i}"`);const p=u.data;if((p==null?void 0:p.VERSION)!==1){this.log(`Steering VERSION ${p.VERSION} not supported!`);return}this.updated=performance.now(),this.timeToLoad=p.TTL;const{"RELOAD-URI":g,"PATHWAY-CLONES":m,"PATHWAY-PRIORITY":v}=p;if(g)try{this.uri=new self.URL(g,i).href}catch{this.enabled=!1,this.log(`Failed to parse Steering Manifest RELOAD-URI: ${g}`);return}this.scheduleRefresh(this.uri||f.url),m&&this.clonePathways(m);const y={steeringManifest:p,url:i.toString()};this.hls.trigger(I.STEERING_MANIFEST_LOADED,y),v&&this.updatePathwayPriority(v)},onError:(u,d,f,h)=>{if(this.log(`Error loading steering manifest: ${u.code} ${u.text} (${d.url})`),this.stopLoad(),u.code===410){this.enabled=!1,this.log(`Steering manifest ${d.url} no longer available`);return}let p=this.timeToLoad*1e3;if(u.code===429){const g=this.loader;if(typeof(g==null?void 0:g.getResponseHeader)=="function"){const m=g.getResponseHeader("Retry-After");m&&(p=parseFloat(m)*1e3)}this.log(`Steering manifest ${d.url} rate limited`);return}this.scheduleRefresh(this.uri||d.url,p)},onTimeout:(u,d,f)=>{this.log(`Timeout loading steering manifest (${d.url})`),this.scheduleRefresh(this.uri||d.url)}};this.log(`Requesting steering manifest: ${i}`),this.loader.load(s,l,c)}scheduleRefresh(e,r=this.timeToLoad*1e3){this.clearTimeout(),this.reloadTimer=self.setTimeout(()=>{var n;const i=(n=this.hls)==null?void 0:n.media;if(i&&!i.ended){this.loadSteeringManifest(e);return}this.scheduleRefresh(e,this.timeToLoad*1e3)},r)}}function WI(t,e,r,n){t&&Object.keys(e).forEach(i=>{const s=t.filter(a=>a.groupId===i).map(a=>{const o=et({},a);return o.details=void 0,o.attrs=new St(o.attrs),o.url=o.attrs.URI=w2(a.url,a.attrs["STABLE-RENDITION-ID"],"PER-RENDITION-URIS",r),o.groupId=o.attrs["GROUP-ID"]=e[i],o.attrs["PATHWAY-ID"]=n,o});t.push(...s)})}function w2(t,e,r,n){const{HOST:i,PARAMS:s,[r]:a}=n;let o;e&&(o=a==null?void 0:a[e],o&&(t=o));const l=new self.URL(t);
276return i&&!o&&(l.host=i),s&&Object.keys(s).sort().forEach(c=>{c&&l.searchParams.set(c,s[c])}),l.href}class Zl extends Dn{constructor(e){super("eme",e.logger),this.hls=void 0,this.config=void 0,this.media=null,this.mediaResolved=void 0,this.keyFormatPromise=null,this.keySystemAccessPromises={},this._requestLicenseFailureCount=0,this.mediaKeySessions=[],this.keyIdToKeySessionPromise={},this.mediaKeys=null,this.setMediaKeysQueue=Zl.CDMCleanupPromise?[Zl.CDMCleanupPromise]:[],this.bannedKeyIds={},this.onMediaEncrypted=r=>{const{initDataType:n,initData:i}=r,s=`"${r.type}" event: init data type: "${n}"`;if(this.debug(s),i!==null){if(!this.keyFormatPromise){let a=Object.keys(this.keySystemAccessPromises);a.length||(a=ed(this.config));const o=a.map(_0).filter(l=>!!l);this.keyFormatPromise=this.getKeyFormatPromise(o)}this.keyFormatPromise.then(a=>{const o=Wp(a);if(n!=="sinf"||o!==Tt.FAIRPLAY){this.log(`Ignoring "${r.type}" event with init data type: "${n}" for selected key-system ${o}`);return}let l;try{const h=Kt(new Uint8Array(i)),p=DT(JSON.parse(h).sinf),g=mj(p);if(!g)throw new Error("'schm' box missing or not cbcs/cenc with schi > tenc");l=new Uint8Array(g.subarray(8,24))}catch(h){this.warn(`${s} Failed to parse sinf: ${h}`);return}const c=pr(l),{keyIdToKeySessionPromise:u,mediaKeySessions:d}=this;let f=u[c];for(let h=0;h<d.length;h++){const p=d[h],g=p.decryptdata;if(!g.keyId)continue;const m=pr(g.keyId);if(Um(l,g.keyId)||g.uri.replace(/-/g,"").indexOf(c)!==-1){if(f=u[m],!f)continue;if(g.pssh)break;delete u[m],g.pssh=new Uint8Array(i),g.keyId=l,f=u[c]=f.then(()=>this.generateRequestWithPreferredKeySession(p,n,i,"encrypted-event-key-match")),f.catch(v=>this.handleError(v));break}}f||this.handleError(new Error(`Key ID ${c} not encountered in playlist. Key-system sessions ${d.length}.`))}).catch(a=>this.handleError(a))}},this.onWaitingForKey=r=>{this.log(`"${r.type}" event`)},this.hls=e,this.config=e.config,this.registerListeners()}destroy(){this.onDestroying(),this.onMediaDetached();const e=this.config;e.requestMediaKeySystemAccessFunc=null,e.licenseXhrSetup=e.licenseResponseCallback=void 0,e.drmSystems=e.drmSystemOptions={},this.hls=this.config=this.keyIdToKeySessionPromise=null,this.onMediaEncrypted=this.onWaitingForKey=null}registerListeners(){this.hls.on(I.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(I.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(I.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(I.MANIFEST_LOADED,this.onManifestLoaded,this),this.hls.on(I.DESTROYING,this.onDestroying,this)}unregisterListeners(){this.hls.off(I.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(I.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(I.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.off(I.MANIFEST_LOADED,this.onManifestLoaded,this),this.hls.off(I.DESTROYING,this.onDestroying,this)}getLicenseServerUrl(e){const{drmSystems:r,widevineLicenseUrl:n}=this.config,i=r==null?void 0:r[e];if(i)return i.licenseUrl;if(e===Tt.WIDEVINE&&n)return n}getLicenseServerUrlOrThrow(e){const r=this.getLicenseServerUrl(e);if(r===void 0)throw new Error(`no license server URL configured for key-system "${e}"`);return r}getServerCertificateUrl(e){const{drmSystems:r}=this.config,n=r==null?void 0:r[e];if(n)return n.serverCertificateUrl;this.log(`No Server Certificate in config.drmSystems["${e}"]`)}attemptKeySystemAccess(e){const r=this.hls.levels,n=(a,o,l)=>!!a&&l.indexOf(a)===o,i=r.map(a=>a.audioCodec).filter(n),s=r.map(a=>a.videoCodec).filter(n);return i.length+s.length===0&&s.push("avc1.42e01e"),new Promise((a,o)=>{const l=c=>{const u=c.shift();this.getMediaKeysPromise(u,i,s).then(d=>a({keySystem:u,mediaKeys:d})).catch(d=>{c.length?l(c):d instanceof Qr?o(d):o(new Qr({type:fe.KEY_SYSTEM_ERROR,details:V.KEY_SYSTEM_NO_ACCESS,error:d,fatal:!0},d.message))})};l(e)})}requestMediaKeySystemAccess(e,r){const{requestMediaKeySystemAccessFunc:n}=this.config;if(typeof n!="function"){let i=`Configured requestMediaKeySystemAccess is not a function ${n}`;return kj===null&&self.location.protocol==="http:"&&(i=`navigator.requestMediaKeySystemAccess is not available over insecure protocol ${location.protocol}`),Promise.reject(new Error(i))}return n(e,r)}getMediaKeysPromise(e,r,n){var i;const s=U7(e,r,n,this.config.drmSystemOptions||{});let a=this.keySystemAccessPromises[e],o=(i=a)==null?void 0:i.keySystemAccess;if(!o){this.log(`Requesting encrypted media "${e}" key-system access with config: ${it(s)}`),o=this.requestMediaKeySystemAccess(e,s);const l=a=this.keySystemAccessPromises[e]={keySystemAccess:o};return o.catch(c=>{this.log(`Failed to obtain access to key-system "${e}": ${c}`)}),o.then(c=>{this.log(`Access for key-system "${c.keySystem}" obtained`);const u=this.fetchServerCertificate(e);this.log(`Create media-keys for "${e}"`);const d=l.mediaKeys=c.createMediaKeys().then(f=>(this.log(`Media-keys created for "${e}"`),l.hasMediaKeys=!0,u.then(h=>h?this.setMediaKeysServerCertificate(f,e,h):f)));return d.catch(f=>{this.error(`Failed to create media-keys for "${e}"}: ${f}`)}),d})}return o.then(()=>a.mediaKeys)}createMediaKeySessionContext({decryptdata:e,keySystem:r,mediaKeys:n}){this.log(`Creating key-system session "${r}" keyId: ${pr(e.keyId||[])} keyUri: ${e.uri}`);const i=n.createSession(),s={decryptdata:e,keySystem:r,mediaKeys:n,mediaKeysSession:i,keyStatus:"status-pending"};return this.mediaKeySessions.push(s),s}renewKeySession(e){const r=e.decryptdata;if(r.pssh){const n=this.createMediaKeySessionContext(e),i=tp(r),s="cenc";this.keyIdToKeySessionPromise[i]=this.generateRequestWithPreferredKeySession(n,s,r.pssh.buffer,"expired")}else this.warn("Could not renew expired session. Missing pssh initData.");this.removeSession(e)}updateKeySession(e,r){const n=e.mediaKeysSession;return this.log(`Updating key-session "${n.sessionId}" for keyId ${pr(e.decryptdata.keyId||[])}
277      } (data length: ${r.byteLength})`),n.update(r)}getSelectedKeySystemFormats(){return Object.keys(this.keySystemAccessPromises).map(e=>({keySystem:e,hasMediaKeys:this.keySystemAccessPromises[e].hasMediaKeys})).filter(({hasMediaKeys:e})=>!!e).map(({keySystem:e})=>_0(e)).filter(e=>!!e)}getKeySystemAccess(e){return this.getKeySystemSelectionPromise(e).then(({keySystem:r,mediaKeys:n})=>this.attemptSetMediaKeys(r,n))}selectKeySystem(e){return new Promise((r,n)=>{this.getKeySystemSelectionPromise(e).then(({keySystem:i})=>{const s=_0(i);s?r(s):n(new Error(`Unable to find format for key-system "${i}"`))}).catch(n)})}selectKeySystemFormat(e){const r=Object.keys(e.levelkeys||{});return this.keyFormatPromise||(this.log(`Selecting key-system from fragment (sn: ${e.sn} ${e.type}: ${e.level}
vendor: 4,218 bytes, line 277
277) key formats ${r.join(", ")}`),this.keyFormatPromise=this.getKeyFormatPromise(r)),this.keyFormatPromise}getKeyFormatPromise(e){const r=ed(this.config),n=e.map(Wp).filter(i=>!!i&&r.indexOf(i)!==-1);return this.selectKeySystem(n)}getKeyStatus(e){const{mediaKeySessions:r}=this;for(let n=0;n<r.length;n++){const i=lJ(e,r[n]);if(i)return i}}loadKey(e){const r=e.keyInfo.decryptdata,n=tp(r),i=this.bannedKeyIds[n];if(i||this.getKeyStatus(r)==="internal-error"){const o=VI(i||"internal-error",r);return this.handleError(o,e.frag),Promise.reject(o)}const s=`(keyId: ${n} format: "${r.keyFormat}" method: ${r.method} uri: ${r.uri})`;this.log(`Starting session for key ${s}`);const a=this.keyIdToKeySessionPromise[n];if(!a){const o=this.getKeySystemForKeyPromise(r).then(({keySystem:l,mediaKeys:c})=>(this.throwIfDestroyed(),this.log(`Handle encrypted media sn: ${e.frag.sn} ${e.frag.type}: ${e.frag.level} using key ${s}`),this.attemptSetMediaKeys(l,c).then(()=>(this.throwIfDestroyed(),this.createMediaKeySessionContext({keySystem:l,mediaKeys:c,decryptdata:r}))))).then(l=>{const c="cenc",u=r.pssh?r.pssh.buffer:null;return this.generateRequestWithPreferredKeySession(l,c,u,"playlist-key")});return o.catch(l=>this.handleError(l,e.frag)),this.keyIdToKeySessionPromise[n]=o,o}return a.catch(o=>{if(o instanceof Qr){const l=Ve({},o.data);this.getKeyStatus(r)==="internal-error"&&(l.decryptdata=r);const c=new Qr(l,o.message);this.handleError(c,e.frag)}}),a}throwIfDestroyed(e="Invalid state"){if(!this.hls)throw new Error("invalid state")}handleError(e,r){if(this.hls)if(e instanceof Qr){r&&(e.data.frag=r);const n=e.data.decryptdata;this.error(`${e.message}${n?` (${pr(n.keyId||[])})`:""}`),this.hls.trigger(I.ERROR,e.data)}else this.error(e.message),this.hls.trigger(I.ERROR,{type:fe.KEY_SYSTEM_ERROR,details:V.KEY_SYSTEM_NO_KEYS,error:e,fatal:!0})}getKeySystemForKeyPromise(e){const r=tp(e),n=this.keyIdToKeySessionPromise[r];if(!n){const i=Wp(e.keyFormat),s=i?[i]:ed(this.config);return this.attemptKeySystemAccess(s)}return n}getKeySystemSelectionPromise(e){if(e.length||(e=ed(this.config)),e.length===0)throw new Qr({type:fe.KEY_SYSTEM_ERROR,details:V.KEY_SYSTEM_NO_CONFIGURED_LICENSE,fatal:!0},`Missing key-system license configuration options ${it({drmSystems:this.config.drmSystems})}`);return this.attemptKeySystemAccess(e)}attemptSetMediaKeys(e,r){if(this.mediaResolved=void 0,this.mediaKeys===r)return Promise.resolve();const n=this.setMediaKeysQueue.slice();this.log(`Setting media-keys for "${e}"`);const i=Promise.all(n).then(()=>this.media?this.media.setMediaKeys(r):new Promise((s,a)=>{this.mediaResolved=()=>{if(this.mediaResolved=void 0,!this.media)return a(new Error("Attempted to set mediaKeys without media element attached"));this.mediaKeys=r,this.media.setMediaKeys(r).then(s).catch(a)}}));return this.mediaKeys=r,this.setMediaKeysQueue.push(i),i.then(()=>{this.log(`Media-keys set for "${e}"`),n.push(i),this.setMediaKeysQueue=this.setMediaKeysQueue.filter(s=>n.indexOf(s)===-1)})}generateRequestWithPreferredKeySession(e,r,n,i){var s;const a=(s=this.config.drmSystems)==null||(s=s[e.keySystem])==null?void 0:s.generateRequest;if(a)try{const p=a.call(this.hls,r,n,e);if(!p)throw new Error("Invalid response from configured generateRequest filter");r=p.initDataType,n=p.initData?p.initData:null,e.decryptdata.pssh=n?new Uint8Array(n):null}catch(p){if(this.warn(p.message),this.hls&&this.hls.config.debug)throw p}if(n===null)return this.log(`Skipping key-session request for "${i}" (no initData)`),Promise.resolve(e);const o=tp(e.decryptdata),l=e.decryptdata.uri;this.log(`Generating key-session request for "${i}" keyId: ${o} URI: ${l} (init data type: ${r} length: ${n.byteLength})`);const c=new MT,u=e._onmessage=p=>{const g=e.mediaKeysSession;if(!g){c.emit("error",new Error("invalid state"));return}const{messageType:m,message:v}=p;this.log(`"${m}" message event for session "${g.sessionId}" message size: ${v.byteLength}`),m==="license-request"||m==="license-renewal"?this.renewLicense(e,v).catch(y=>{c.eventNames().length?c.emit("error",y):this.handleError(y)}):m==="license-release"?e.keySystem===Tt.FAIRPLAY&&this.updateKeySession(e,fw("acknowledged")).then(()=>this.removeSession(e)).catch(y=>
vendor: 12,461 bytes, line 277
277this.handleError(y)):this.warn(`unhandled media key message type "${m}"`)},d=(p,g)=>{g.keyStatus=p;let m;p.startsWith("usable")?c.emit("resolved"):p==="internal-error"||p==="output-restricted"||p==="output-downscaled"?m=VI(p,g.decryptdata):p==="expired"?m=new Error(`key expired (keyId: ${o})`):p==="released"?m=new Error("key released"):p==="status-pending"||this.warn(`unhandled key status change "${p}" (keyId: ${o})`),m&&(c.eventNames().length?c.emit("error",m):this.handleError(m))},f=e._onkeystatuseschange=p=>{if(!e.mediaKeysSession){c.emit("error",new Error("invalid state"));return}const m=this.getKeyStatuses(e);if(!Object.keys(m).some(w=>m[w]!=="status-pending"))return;if(m[o]==="expired"){this.log(`Expired key ${it(m)} in key-session "${e.mediaKeysSession.sessionId}"`),this.renewKeySession(e);return}let y=m[o];if(y)d(y,e);else{var b;e.keyStatusTimeouts||(e.keyStatusTimeouts={}),(b=e.keyStatusTimeouts)[o]||(b[o]=self.setTimeout(()=>{if(!e.mediaKeysSession||!this.mediaKeys)return;const S=this.getKeyStatus(e.decryptdata);if(S&&S!=="status-pending")return this.log(`No status for keyId ${o} in key-session "${e.mediaKeysSession.sessionId}". Using session key-status ${S} from other session.`),d(S,e);this.log(`key status for ${o} in key-session "${e.mediaKeysSession.sessionId}" timed out after 1000ms`),y="internal-error",d(y,e)},1e3)),this.log(`No status for keyId ${o} (${it(m)}).`)}};kr(e.mediaKeysSession,"message",u),kr(e.mediaKeysSession,"keystatuseschange",f);const h=new Promise((p,g)=>{c.on("error",g),c.on("resolved",p)});return e.mediaKeysSession.generateRequest(r,n).then(()=>{this.log(`Request generated for key-session "${e.mediaKeysSession.sessionId}" keyId: ${o} URI: ${l}`)}).catch(p=>{throw new Qr({type:fe.KEY_SYSTEM_ERROR,details:V.KEY_SYSTEM_NO_SESSION,error:p,decryptdata:e.decryptdata,fatal:!1},`Error generating key-session request: ${p}`)}).then(()=>h).catch(p=>(c.removeAllListeners(),this.removeSession(e).then(()=>{throw p}))).then(()=>(c.removeAllListeners(),e))}getKeyStatuses(e){const r={};return e.mediaKeysSession.keyStatuses.forEach((n,i)=>{if(typeof i=="string"&&typeof n=="object"){const o=i;i=n,n=o}const s="buffer"in i?new Uint8Array(i.buffer,i.byteOffset,i.byteLength):new Uint8Array(i);if(e.keySystem===Tt.PLAYREADY&&s.length===16){const o=pr(s);r[o]=n,Oj(s)}const a=pr(s);n==="internal-error"&&(this.bannedKeyIds[a]=n),this.log(`key status change "${n}" for keyStatuses keyId: ${a} key-session "${e.mediaKeysSession.sessionId}"`),r[a]=n}),r}fetchServerCertificate(e){const r=this.config,n=r.loader,i=new n(r),s=this.getServerCertificateUrl(e);return s?(this.log(`Fetching server certificate for "${e}"`),new Promise((a,o)=>{const l={responseType:"arraybuffer",url:s},c=r.certLoadPolicy.default,u={loadPolicy:c,timeout:c.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},d={onSuccess:(f,h,p,g)=>{a(f.data)},onError:(f,h,p,g)=>{o(new Qr({type:fe.KEY_SYSTEM_ERROR,details:V.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:p,response:Ve({url:l.url,data:void 0},f)},`"${e}" certificate request failed (${s}). Status: ${f.code} (${f.text})`))},onTimeout:(f,h,p)=>{o(new Qr({type:fe.KEY_SYSTEM_ERROR,details:V.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:p,response:{url:l.url,data:void 0}},`"${e}" certificate request timed out (${s})`))},onAbort:(f,h,p)=>{o(new Error("aborted"))}};i.load(l,u,d)})):Promise.resolve()}setMediaKeysServerCertificate(e,r,n){return new Promise((i,s)=>{e.setServerCertificate(n).then(a=>{this.log(`setServerCertificate ${a?"success":"not supported by CDM"} (${n.byteLength}) on "${r}"`),i(e)}).catch(a=>{s(new Qr({type:fe.KEY_SYSTEM_ERROR,details:V.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED,error:a,fatal:!0},a.message))})})}renewLicense(e,r){return this.requestLicense(e,new Uint8Array(r)).then(n=>this.updateKeySession(e,new Uint8Array(n)).catch(i=>{throw new Qr({type:fe.KEY_SYSTEM_ERROR,details:V.KEY_SYSTEM_SESSION_UPDATE_FAILED,decryptdata:e.decryptdata,error:i,fatal:!1},i.message)}))}unpackPlayReadyKeyMessage(e,r){const n=String.fromCharCode.apply(null,new Uint16Array(r.buffer));if(!n.includes("PlayReadyKeyMessage"))return e.setRequestHeader("Content-Type","text/xml; charset=utf-8"),r;const i=new DOMParser().parseFromString(n,"application/xml"),s=i.querySelectorAll("HttpHeader");if(s.length>0){let u;for(let d=0,f=s.length;d<f;d++){var a,o;u=s[d];const h=(a=u.querySelector("name"))==null?void 0:a.textContent,p=(o=u.querySelector("value"))==null?void 0:o.textContent;h&&p&&e.setRequestHeader(h,p)}}const l=i.querySelector("Challenge"),c=l==null?void 0:l.textContent;if(!c)throw new Error("Cannot find <Challenge> in key message");return fw(atob(c))}setupLicenseXHR(e,r,n,i){const s=this.config.licenseXhrSetup;return s?Promise.resolve().then(()=>{if(!n.decryptdata)throw new Error("Key removed");return s.call(this.hls,e,r,n,i)}).catch(a=>{if(!n.decryptdata)throw a;return e.open("POST",r,!0),s.call(this.hls,e,r,n,i)}).then(a=>(e.readyState||e.open("POST",r,!0),{xhr:e,licenseChallenge:a||i})):(e.open("POST",r,!0),Promise.resolve({xhr:e,licenseChallenge:i}))}requestLicense(e,r){const n=this.config.keyLoadPolicy.default;return new Promise((i,s)=>{const a=this.getLicenseServerUrlOrThrow(e.keySystem);this.log(`Sending license request to URL: ${a}`);const o=new XMLHttpRequest;o.responseType="arraybuffer",o.onreadystatechange=()=>{if(!this.hls||!e.mediaKeysSession)return s(new Error("invalid state"));if(o.readyState===4)if(o.status===200){this._requestLicenseFailureCount=0;let l=o.response;this.log(`License received ${l instanceof ArrayBuffer?l.byteLength:l}`);const c=this.config.licenseResponseCallback;if(c)try{l=c.call(this.hls,o,a,e)}catch(u){this.error(u)}i(l)}else{const l=n.errorRetry,c=l?l.maxNumRetry:0;if(this._requestLicenseFailureCount++,this._requestLicenseFailureCount>c||o.status>=400&&o.status<500)s(new Qr({type:fe.KEY_SYSTEM_ERROR,details:V.KEY_SYSTEM_LICENSE_REQUEST_FAILED,decryptdata:e.decryptdata,fatal:!0,networkDetails:o,response:{url:a,data:void 0,code:o.status,text:o.statusText}},`License Request XHR failed (${a}). Status: ${o.status} (${o.statusText})`));else{const u=c-this._requestLicenseFailureCount+1;this.warn(`Retrying license request, ${u} attempts left`),this.requestLicense(e,r).then(i,s)}}},e.licenseXhr&&e.licenseXhr.readyState!==XMLHttpRequest.DONE&&e.licenseXhr.abort(),e.licenseXhr=o,this.setupLicenseXHR(o,a,e,r).then(({xhr:l,licenseChallenge:c})=>{e.keySystem==Tt.PLAYREADY&&(c=this.unpackPlayReadyKeyMessage(l,c)),l.send(c)}).catch(s)})}onDestroying(){this.unregisterListeners(),this._clear()}onMediaAttached(e,r){if(!this.config.emeEnabled)return;const n=r.media;this.media=n,kr(n,"encrypted",this.onMediaEncrypted),kr(n,"waitingforkey",this.onWaitingForKey);const i=this.mediaResolved;i?i():this.mediaKeys=n.mediaKeys}onMediaDetached(){const e=this.media;e&&(Gr(e,"encrypted",this.onMediaEncrypted),Gr(e,"waitingforkey",this.onWaitingForKey),this.media=null,this.mediaKeys=null)}_clear(){var e;this._requestLicenseFailureCount=0,this.keyIdToKeySessionPromise={},this.bannedKeyIds={};const r=this.mediaResolved;if(r&&r(),!this.mediaKeys&&!this.mediaKeySessions.length)return;const n=this.media,i=this.mediaKeySessions.slice();this.mediaKeySessions=[],this.mediaKeys=null,ya.clearKeyUriToKeyIdMap();const s=i.length;Zl.CDMCleanupPromise=Promise.all(i.map(a=>this.removeSession(a)).concat((n==null||(e=n.setMediaKeys(null))==null?void 0:e.catch(a=>{this.log(`Could not clear media keys: ${a}`),this.hls&&this.hls.trigger(I.ERROR,{type:fe.OTHER_ERROR,details:V.KEY_SYSTEM_DESTROY_MEDIA_KEYS_ERROR,fatal:!1,error:new Error(`Could not clear media keys: ${a}`)})}))||Promise.resolve())).catch(a=>{this.log(`Could not close sessions and clear media keys: ${a}`),this.hls&&this.hls.trigger(I.ERROR,{type:fe.OTHER_ERROR,details:V.KEY_SYSTEM_DESTROY_CLOSE_SESSION_ERROR,fatal:!1,error:new Error(`Could not close sessions and clear media keys: ${a}`)})}).then(()=>{s&&this.log("finished closing key sessions and clearing media keys")})}onManifestLoading(){this._clear()}onManifestLoaded(e,{sessionKeys:r}){if(!(!r||!this.config.emeEnabled)&&!this.keyFormatPromise){const n=r.reduce((i,s)=>(i.indexOf(s.keyFormat)===-1&&i.push(s.keyFormat),i),[]);this.log(`Selecting key-system from session-keys ${n.join(", ")}`),this.keyFormatPromise=this.getKeyFormatPromise(n)}}removeSession(e){const{mediaKeysSession:r,licenseXhr:n,decryptdata:i}=e;if(r){this.log(`Remove licenses and keys and close session "${r.sessionId}" keyId: ${pr((i==null?void 0:i.keyId)||[])}`),e._onmessage&&(r.removeEventListener("message",e._onmessage),e._onmessage=void 0),e._onkeystatuseschange&&(r.removeEventListener("keystatuseschange",e._onkeystatuseschange),e._onkeystatuseschange=void 0),n&&n.readyState!==XMLHttpRequest.DONE&&n.abort(),e.mediaKeysSession=e.decryptdata=e.licenseXhr=void 0;const s=this.mediaKeySessions.indexOf(e);s>-1&&this.mediaKeySessions.splice(s,1);const{keyStatusTimeouts:a}=e;a&&Object.keys(a).forEach(c=>self.clearTimeout(a[c]));const{drmSystemOptions:o}=this.config;return(W7(o)?new Promise((c,u)=>{self.setTimeout(()=>u(new Error("MediaKeySession.remove() timeout")),8e3),r.remove().then(c).catch(u)}):Promise.resolve()).catch(c=>{this.log(`Could not remove session: ${c}`),this.hls&&this.hls.trigger(I.ERROR,{type:fe.OTHER_ERROR,details:V.KEY_SYSTEM_DESTROY_REMOVE_SESSION_ERROR,fatal:!1,error:new Error(`Could not remove session: ${c}`)})}).then(()=>r.close()).catch(c=>{this.log(`Could not close session: ${c}`),this.hls&&this.hls.trigger(I.ERROR,{type:fe.OTHER_ERROR,details:V.KEY_SYSTEM_DESTROY_CLOSE_SESSION_ERROR,fatal:!1,error:new Error(`Could not close session: ${c}`)})})}return Promise.resolve()}}Zl.CDMCleanupPromise=void 0;function tp(t){if(!t)throw new Error("Could not read keyId of undefined decryptdata");if(t.keyId===null)throw new Error("keyId is null");return pr(t.keyId)}function lJ(t,e){if(t.keyId&&e.mediaKeysSession.keyStatuses.has(t.keyId))return e.mediaKeysSession.keyStatuses.get(t.keyId);if(t.matches(e.decryptdata))return e.keyStatus}class Qr extends Error{constructor(e,r){super(r),this.data=void 0,e.error||(e.error=new Error(r)),this.data=e,e.err=e.error}}function VI(t,e){const r=t==="output-restricted",n=r?V.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED:V.KEY_SYSTEM_STATUS_INTERNAL_ERROR;return new Qr({type:fe.KEY_SYSTEM_ERROR,details:n,fatal:!1,decryptdata:e},r?"HDCP level output restricted":`key status changed to "${t}"`)}class cJ{constructor(e){this.hls=void 0,this.isVideoPlaybackQualityAvailable=!1,this.timer=void 0,this.media=null,this.lastTime=void 0,this.lastDroppedFrames=0,this.lastDecodedFrames=0,this.streamController=void 0,this.hls=e,this.registerListeners()}setStreamController(e){this.streamController=e}registerListeners(){this.hls.on(I.MEDIA_ATTACHING,this.onMediaAttaching,this),this.hls.on(I.MEDIA_DETACHING,this.onMediaDetaching,this)}unregisterListeners(){this.hls.off(I.MEDIA_ATTACHING,this.onMediaAttaching,this),this.hls.off(I.MEDIA_DETACHING,this.onMediaDetaching,this)}destroy(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null}onMediaAttaching(e,r){const n=this.hls.config;if(n.capLevelOnFPSDrop){const i=r.media instanceof self.HTMLVideoElement?r.media:null;this.media=i,i&&typeof i.getVideoPlaybackQuality=="function"&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),n.fpsDroppedMonitoringPeriod)}}onMediaDetaching(){this.media=null}checkFPS(e,r,n){const i=performance.now();if(r){if(this.lastTime){const s=i-this.lastTime,a=n-this.lastDroppedFrames,o=r-this.lastDecodedFrames,l=1e3*a/s,c=this.hls;if(c.trigger(I.FPS_DROP,{currentDropped:a,currentDecoded:o,totalDroppedFrames:n}),l>0&&a>c.config.fpsDroppedMonitoringThreshold*o){let u=c.currentLevel;c.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+u),u>0&&(c.autoLevelCapping===-1||c.autoLevelCapping>=u)&&(u=u-1,c.trigger(I.FPS_DROP_LEVEL_CAPPING,{level:u,droppedLevel:c.currentLevel}),c.autoLevelCapping=u,this.streamController.nextLevelSwitch())}}this.lastTime=i,this.lastDroppedFrames=n,this.lastDecodedFrames=r}}checkFPSInterval(){const e=this.media;if(e)if(this.isVideoPlaybackQualityAvailable){const r=e.getVideoPlaybackQuality();this.checkFPS(e,r.totalVideoFrames,r.droppedVideoFrames)}else this.checkFPS(e,e.webkitDecodedFrameCount,e.webkitDroppedFrameCount)}
vendor: 4,410 bytes, line 277
277}function S2(t,e){let r;try{r=new Event("addtrack")}catch{r=document.createEvent("Event"),r.initEvent("addtrack",!1,!1)}r.track=t,e.dispatchEvent(r)}function E2(t,e){const r=t.mode;if(r==="disabled"&&(t.mode="hidden"),t.cues&&!t.cues.getCueById(e.id))try{if(t.addCue(e),!t.cues.getCueById(e.id))throw new Error(`addCue is failed for: ${e}`)}catch(n){qe.debug(`[texttrack-utils]: ${n}`);try{const i=new self.TextTrackCue(e.startTime,e.endTime,e.text);i.id=e.id,t.addCue(i)}catch(i){qe.debug(`[texttrack-utils]: Legacy TextTrackCue fallback failed: ${i}`)}}r==="disabled"&&(t.mode=r)}function jl(t,e){const r=t.mode;if(r==="disabled"&&(t.mode="hidden"),t.cues)for(let n=t.cues.length;n--;)e&&t.cues[n].removeEventListener("enter",e),t.removeCue(t.cues[n]);r==="disabled"&&(t.mode=r)}function ww(t,e,r,n){const i=t.mode;if(i==="disabled"&&(t.mode="hidden"),t.cues&&t.cues.length>0){const s=dJ(t.cues,e,r);for(let a=0;a<s.length;a++)(!n||n(s[a]))&&t.removeCue(s[a])}i==="disabled"&&(t.mode=i)}function uJ(t,e){if(e<=t[0].startTime)return 0;const r=t.length-1;if(e>t[r].endTime)return-1;let n=0,i=r,s;for(;n<=i;)if(s=Math.floor((i+n)/2),e<t[s].startTime)i=s-1;else if(e>t[s].startTime&&n<r)n=s+1;else return s;return t[n].startTime-e<e-t[i].startTime?n:i}function dJ(t,e,r){const n=[],i=uJ(t,e);if(i>-1)for(let s=i,a=t.length;s<a;s++){const o=t[s];if(o.startTime>=e&&o.endTime<=r)n.push(o);else if(o.startTime>r)return n}return n}function zp(t){const e=[];for(let r=0;r<t.length;r++){const n=t[r];(n.kind==="subtitles"||n.kind==="captions")&&n.label&&e.push(t[r])}return e}class fJ extends WT{constructor(e){super(e,"subtitle-track-controller"),this.media=null,this.tracks=[],this.groupIds=null,this.tracksInGroup=[],this.trackId=-1,this.currentTrack=null,this.selectDefaultTrack=!0,this.queuedDefaultTrack=-1,this.useTextTrackPolling=!1,this.subtitlePollingInterval=-1,this._subtitleDisplay=!0,this.asyncPollTrackChange=()=>this.pollTrackChange(0),this.onTextTracksChanged=()=>{if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;let r=null;const n=zp(this.media.textTracks);for(let s=0;s<n.length;s++)if(n[s].mode==="hidden")r=n[s];else if(n[s].mode==="showing"){r=n[s];break}const i=this.findTrackForTextTrack(r);this.subtitleTrack!==i&&this.setSubtitleTrack(i)},this.registerListeners()}destroy(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.currentTrack=null,this.onTextTracksChanged=this.asyncPollTrackChange=null,super.destroy()}get subtitleDisplay(){return this._subtitleDisplay}set subtitleDisplay(e){this._subtitleDisplay=e,this.trackId>-1&&this.toggleTrackModes()}registerListeners(){const{hls:e}=this;e.on(I.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(I.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(I.MANIFEST_LOADING,this.onManifestLoading,this),e.on(I.MANIFEST_PARSED,this.onManifestParsed,this),e.on(I.LEVEL_LOADING,this.onLevelLoading,this),e.on(I.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(I.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.on(I.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(I.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(I.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(I.MANIFEST_LOADING,this.onManifestLoading,this),e.off(I.MANIFEST_PARSED,this.onManifestParsed,this),e.off(I.LEVEL_LOADING,this.onLevelLoading,this),e.off(I.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(I.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.off(I.ERROR,this.onError,this)}onMediaAttached(e,r){this.media=r.media,this.media&&(this.queuedDefaultTrack>-1&&(this.subtitleTrack=this.queuedDefaultTrack,this.queuedDefaultTrack=-1),this.useTextTrackPolling=!(this.media.textTracks&&"onchange"in this.media.textTracks),this.useTextTrackPolling?this.pollTrackChange(500):this.media.textTracks.addEventListener("change",this.asyncPollTrackChange))}pollTrackChange(e){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.onTextTracksChanged,e)}onMediaDetaching(e,r){const n=this.media;if(!n)return;const i=!!r.transferMedia;if(self.clearInterval(this.subtitlePollingInterval),this.useTextTrackPolling||n.textTracks.removeEventListener("change",this.asyncPollTrackChange),this.trackId>-1&&(this.queuedDefaultTrack=this.trackId),this.subtitleTrack=-1,this.media=null,i)return;
vendor: 9,404 bytes, line 277
277zp(n.textTracks).forEach(a=>{jl(a)})}onManifestLoading(){this.tracks=[],this.groupIds=null,this.tracksInGroup=[],this.trackId=-1,this.currentTrack=null,this.selectDefaultTrack=!0}onManifestParsed(e,r){this.tracks=r.subtitleTracks}onSubtitleTrackLoaded(e,r){const{id:n,groupId:i,details:s}=r,a=this.tracksInGroup[n];if(!a||a.groupId!==i){this.warn(`Subtitle track with id:${n} and group:${i} not found in active group ${a==null?void 0:a.groupId}`);return}const o=a.details;a.details=r.details,this.log(`Subtitle track ${n} "${a.name}" lang:${a.lang} group:${i} loaded [${s.startSN}-${s.endSN}]`),n===this.trackId&&this.playlistLoaded(n,r,o)}onLevelLoading(e,r){this.switchLevel(r.level)}onLevelSwitching(e,r){this.switchLevel(r.level)}switchLevel(e){const r=this.hls.levels[e];if(!r)return;const n=r.subtitleGroups||null,i=this.groupIds;let s=this.currentTrack;if(!n||(i==null?void 0:i.length)!==(n==null?void 0:n.length)||n!=null&&n.some(a=>(i==null?void 0:i.indexOf(a))===-1)){this.groupIds=n,this.trackId=-1,this.currentTrack=null;const a=this.tracks.filter(u=>!n||n.indexOf(u.groupId)!==-1);if(a.length)this.selectDefaultTrack&&!a.some(u=>u.default)&&(this.selectDefaultTrack=!1),a.forEach((u,d)=>{u.id=d});else if(!s&&!this.tracksInGroup.length)return;this.tracksInGroup=a;const o=this.hls.config.subtitlePreference;if(!s&&o){this.selectDefaultTrack=!1;const u=Ii(o,a);if(u>-1)s=a[u];else{const d=Ii(o,this.tracks);s=this.tracks[d]}}let l=this.findTrackId(s);l===-1&&s&&(l=this.findTrackId(null));const c={subtitleTracks:a};this.log(`Updating subtitle tracks, ${a.length} track(s) found in "${n==null?void 0:n.join(",")}" group-id`),this.hls.trigger(I.SUBTITLE_TRACKS_UPDATED,c),l!==-1&&this.trackId===-1&&this.setSubtitleTrack(l)}}findTrackId(e){const r=this.tracksInGroup,n=this.selectDefaultTrack;for(let i=0;i<r.length;i++){const s=r[i];if(!(n&&!s.default||!n&&!e)&&(!e||To(s,e)))return i}if(e){for(let i=0;i<r.length;i++){const s=r[i];if(af(e.attrs,s.attrs,["LANGUAGE","ASSOC-LANGUAGE","CHARACTERISTICS"]))return i}for(let i=0;i<r.length;i++){const s=r[i];if(af(e.attrs,s.attrs,["LANGUAGE"]))return i}}return-1}findTrackForTextTrack(e){if(e){const r=this.tracksInGroup;for(let n=0;n<r.length;n++){const i=r[n];if(vw(i,e))return n}}return-1}onError(e,r){r.fatal||!r.context||r.context.type===Ce.SUBTITLE_TRACK&&r.context.id===this.trackId&&(!this.groupIds||this.groupIds.indexOf(r.context.groupId)!==-1)&&this.checkRetry(r)}get allSubtitleTracks(){return this.tracks}get subtitleTracks(){return this.tracksInGroup}get subtitleTrack(){return this.trackId}set subtitleTrack(e){this.selectDefaultTrack=!1,this.setSubtitleTrack(e)}setSubtitleOption(e){if(this.hls.config.subtitlePreference=e,e){if(e.id===-1)return this.setSubtitleTrack(-1),null;const r=this.allSubtitleTracks;if(this.selectDefaultTrack=!1,r.length){const n=this.currentTrack;if(n&&To(e,n))return n;const i=Ii(e,this.tracksInGroup);if(i>-1){const s=this.tracksInGroup[i];return this.setSubtitleTrack(i),s}else{if(n)return null;{const s=Ii(e,r);if(s>-1)return r[s]}}}}return null}loadPlaylist(e){super.loadPlaylist(),this.shouldLoadPlaylist(this.currentTrack)&&this.scheduleLoading(this.currentTrack,e)}loadingPlaylist(e,r){super.loadingPlaylist(e,r);const n=e.id,i=e.groupId,s=this.getUrlWithDirectives(e.url,r),a=e.details,o=a==null?void 0:a.age;this.log(`Loading subtitle ${n} "${e.name}" lang:${e.lang} group:${i}${(r==null?void 0:r.msn)!==void 0?" at sn "+r.msn+" part "+r.part:""}${o&&a.live?" age "+o.toFixed(1)+(a.type&&" "+a.type||""):""} ${s}`),this.hls.trigger(I.SUBTITLE_TRACK_LOADING,{url:s,id:n,groupId:i,deliveryDirectives:r||null,track:e})}toggleTrackModes(){const{media:e}=this;if(!e)return;const r=zp(e.textTracks),n=this.currentTrack;let i;if(n&&(i=r.filter(s=>vw(n,s))[0],i||this.warn(`Unable to find subtitle TextTrack with name "${n.name}" and language "${n.lang}"`)),[].slice.call(r).forEach(s=>{s.mode!=="disabled"&&s!==i&&(s.mode="disabled")}),i){const s=this.subtitleDisplay?"showing":"hidden";i.mode!==s&&(i.mode=s)}}setSubtitleTrack(e){const r=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=e;return}if(e<-1||e>=r.length||!se(e)){this.warn(`Invalid subtitle track id: ${e}`);return}this.selectDefaultTrack=!1;const n=this.currentTrack,i=r[e]||null;if(this.trackId=e,this.currentTrack=i,this.toggleTrackModes(),!i){this.hls.trigger(I.SUBTITLE_TRACK_SWITCH,{id:e});return}const s=!!i.details&&!i.details.live;if(e===this.trackId&&i===n&&s)return;this.log(`Switching to subtitle-track ${e}`+(i?` "${i.name}" lang:${i.lang} group:${i.groupId}`:""));const{id:a,groupId:o="",name:l,type:c,url:u}=i;this.hls.trigger(I.SUBTITLE_TRACK_SWITCH,{id:a,groupId:o,name:l,type:c,url:u});const d=this.switchParams(i.url,n==null?void 0:n.details,i.details);this.loadPlaylist(d)}}function hJ(){try{return crypto.randomUUID()}catch{try{const e=URL.createObjectURL(new Blob),r=e.toString();return URL.revokeObjectURL(e),r.slice(r.lastIndexOf("/")+1)}catch{let r=new Date().getTime();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,i=>{const s=(r+Math.random()*16)%16|0;return r=Math.floor(r/16),(i=="x"?s:s&3|8).toString(16)})}}}function vd(t){let e=5381,r=t.length;for(;r;)e=e*33^t.charCodeAt(--r);return(e>>>0).toString()}const ec=.025;let Hm=function(t){return t[t.Point=0]="Point",t[t.Range=1]="Range",t}({});function pJ(t,e,r){return`${t.identifier}-${r+1}-${vd(e)}`}class mJ{constructor(e,r){this.base=void 0,this._duration=null,this._timelineStart=null,this.appendInPlaceDisabled=void 0,this.appendInPlaceStarted=void 0,this.dateRange=void 0,this.hasPlayed=!1,this.cumulativeDuration=0,this.resumeOffset=NaN,this.playoutLimit=NaN,this.restrictions={skip:!1,jump:!1},this.snapOptions={out:!1,in:!1},this.assetList=[],this.assetListLoader=void 0,this.assetListResponse=null,this.resumeAnchor=void 0,this.error=void 0,this.resetOnResume=void 0,this.base=r,this.dateRange=e,this.setDateRange(e)}setDateRange(e){this.dateRange=e,this.resumeOffset=e.attr.optionalFloat("X-RESUME-OFFSET",this.resumeOffset),this.playoutLimit=e.attr.optionalFloat("X-PLAYOUT-LIMIT",this.playoutLimit),this.restrictions=e.attr.enumeratedStringList("X-RESTRICT",this.restrictions),this.snapOptions=e.attr.enumeratedStringList("X-SNAP",this.snapOptions)}reset(){var e;this.appendInPlaceStarted=!1,(e=this.assetListLoader)==null||e.destroy(),this.assetListLoader=void 0,this.supplementsPrimary||(this.assetListResponse=null,this.assetList=[],this._duration=null)}isAssetPastPlayoutLimit(e){var r;if(e>0&&e>=this.assetList.length)return!0;const n=this.playoutLimit;return e<=0||isNaN(n)?!1:n===0?!0:(((r=this.assetList[e])==null?void 0:r.startOffset)||0)>n}findAssetIndex(e){return this.assetList.indexOf(e)}get identifier(){return this.dateRange.id}get startDate(){return this.dateRange.startDate}get startTime(){const e=this.dateRange.startTime;if(this.snapOptions.out){const r=this.dateRange.tagAnchor;if(r)return D0(e,r)}return e}get startOffset(){return this.cue.pre?0:this.startTime}get startIsAligned(){if(this.startTime===0||this.snapOptions.out)return!0;const e=this.dateRange.tagAnchor;if(e){const r=this.dateRange.startTime,n=D0(r,e);return r-n<.1}return!1}get resumptionOffset(){const e=this.resumeOffset,r=se(e)?e:this.duration;return this.cumulativeDuration+r}get resumeTime(){const e=this.startOffset+this.resumptionOffset;if(this.snapOptions.in){const r=this.resumeAnchor;if(r)return D0(e,r)}return e}get appendInPlace(){return this.appendInPlaceStarted?!0:this.appendInPlaceDisabled?!1:!!(!this.cue.once&&!this.cue.pre&&this.startIsAligned&&(isNaN(this.playoutLimit)&&isNaN(this.resumeOffset)||this.resumeOffset&&this.duration&&Math.abs(this.resumeOffset-this.duration)<ec))}set appendInPlace(e){if(this.appendInPlaceStarted){this.resetOnResume=!e;return}this.appendInPlaceDisabled=!e}get timelineStart(){return this._timelineStart!==null?this._timelineStart:this.startTime}set timelineStart(e){this._timelineStart=e}get duration(){const e=this.playoutLimit;let r;return this._duration!==null?r=this._duration:this.dateRange.duration?r=this.dateRange.duration:r=this.dateRange.plannedDuration||0,!isNaN(e)&&e<r&&(r=e),r}set duration(e){this._duration=e}get cue(){return this.dateRange.cue}get timelineOccupancy(){return this.dateRange.attr["X-TIMELINE-OCCUPIES"]==="RANGE"?Hm.Range:Hm.Point}get supplementsPrimary(){return this.dateRange.attr["X-TIMELINE-STYLE"]==="PRIMARY"}get contentMayVary(){return this.dateRange.attr["X-CONTENT-MAY-VARY"]!=="NO"}get assetUrl(){return this.dateRange.attr["X-ASSET-URI"]}get assetListUrl(){return this.dateRange.attr["X-ASSET-LIST"]}get baseUrl(){return this.base.url}get assetListLoaded(){return this.assetList.length>0||this.assetListResponse!==null}toString(){return gJ(this)}}function D0(t,e){return t-e.start<e.duration/2&&!(Math.abs(t-(e.start+e.duration))<ec)?e.start:e.start+e.duration}function T2(t,e,r){const n=new self.URL(t,r);return n.protocol!=="data:"&&n.searchParams.set("_HLS_primary_id",e),n}function N0(t,e){for(;(r=t.assetList[++e])!=null&&r.error;)var r;return e}function gJ(t){return`["${t.identifier}" ${t.cue.pre?"<pre>":t.cue.post?"<post>":""}${t.timelineStart.toFixed(2)}-${t.resumeTime.toFixed(2)}]`}function El(t){const e=t.timelineStart,r=t.duration||0;return`["${t.identifier}" ${e.toFixed(2)}-${(e+r).toFixed(2)}]`}class vJ{constructor(e,r,n,i){this.hls=void 0,this.interstitial=void 0,this.assetItem=void 0,this.tracks=null,this.hasDetail
vendor: 4,234 bytes, line 277
277s=!1,this.mediaAttached=null,this._currentTime=void 0,this._bufferedEosTime=void 0,this.checkPlayout=()=>{this.reachedPlayout(this.currentTime)&&this.hls&&this.hls.trigger(I.PLAYOUT_LIMIT_REACHED,{})};const s=this.hls=new e(r);this.interstitial=n,this.assetItem=i;const a=()=>{this.hasDetails=!0};s.once(I.LEVEL_LOADED,a),s.once(I.AUDIO_TRACK_LOADED,a),s.once(I.SUBTITLE_TRACK_LOADED,a),s.on(I.MEDIA_ATTACHING,(o,{media:l})=>{this.removeMediaListeners(),this.mediaAttached=l,this.interstitial.playoutLimit&&(l.addEventListener("timeupdate",this.checkPlayout),this.appendInPlace&&s.on(I.BUFFER_APPENDED,()=>{const u=this.bufferedEnd;this.reachedPlayout(u)&&(this._bufferedEosTime=u,s.trigger(I.BUFFERED_TO_END,void 0))}))})}get appendInPlace(){return this.interstitial.appendInPlace}loadSource(){const e=this.hls;if(e)if(e.url)e.levels.length&&!e.started&&e.startLoad(-1,!0);else{let r=this.assetItem.uri;try{r=T2(r,e.config.primarySessionId||"").href}catch{}e.loadSource(r)}}bufferedInPlaceToEnd(e){var r;if(!this.appendInPlace)return!1;if((r=this.hls)!=null&&r.bufferedToEnd)return!0;if(!e)return!1;const n=Math.min(this._bufferedEosTime||1/0,this.duration),i=this.timelineOffset,s=Se.bufferInfo(e,i,0);return this.getAssetTime(s.end)>=n-.02}reachedPlayout(e){const n=this.interstitial.playoutLimit;return this.startOffset+e>=n}get destroyed(){var e;return!((e=this.hls)!=null&&e.userConfig)}get assetId(){return this.assetItem.identifier}get interstitialId(){return this.assetItem.parentIdentifier}get media(){var e;return((e=this.hls)==null?void 0:e.media)||null}get bufferedEnd(){const e=this.media||this.mediaAttached;if(!e)return this._bufferedEosTime?this._bufferedEosTime:this.currentTime;const r=Se.bufferInfo(e,e.currentTime,.001);return this.getAssetTime(r.end)}get currentTime(){const e=this.media||this.mediaAttached;return e?this.getAssetTime(e.currentTime):this._currentTime||0}get duration(){const e=this.assetItem.duration;if(!e)return 0;const r=this.interstitial.playoutLimit;if(r){const n=r-this.startOffset;if(n>0&&n<e)return n}return e}get remaining(){const e=this.duration;return e?Math.max(0,e-this.currentTime):0}get startOffset(){return this.assetItem.startOffset}get timelineOffset(){var e;return((e=this.hls)==null?void 0:e.config.timelineOffset)||0}set timelineOffset(e){const r=this.timelineOffset;if(e!==r){const n=e-r;if(Math.abs(n)>1/9e4&&this.hls){if(this.hasDetails)throw new Error("Cannot set timelineOffset after playlists are loaded");this.hls.config.timelineOffset=e}}}getAssetTime(e){const r=this.timelineOffset,n=this.duration;return Math.min(Math.max(0,e-r),n)}removeMediaListeners(){const e=this.mediaAttached;e&&(this._currentTime=e.currentTime,this.bufferSnapShot(),e.removeEventListener("timeupdate",this.checkPlayout))}bufferSnapShot(){if(this.mediaAttached){var e;(e=this.hls)!=null&&e.bufferedToEnd&&(this._bufferedEosTime=this.bufferedEnd)}}destroy(){this.removeMediaListeners(),this.hls&&this.hls.destroy(),this.hls=null,this.tracks=this.mediaAttached=this.checkPlayout=null}attachMedia(e){var r;this.loadSource(),(r=this.hls)==null||r.attachMedia(e)}detachMedia(){var e;this.removeMediaListeners(),this.mediaAttached=null,(e=this.hls)==null||e.detachMedia()}resumeBuffering(){var e;(e=this.hls)==null||e.resumeBuffering()}pauseBuffering(){var e;(e=this.hls)==null||e.pauseBuffering()}transferMedia(){var e;return this.bufferSnapShot(),((e=this.hls)==null?void 0:e.transferMedia())||null}resetDetails(){const e=this.hls;if(e&&this.hasDetails){e.stopLoad();const r=n=>delete n.details;e.levels.forEach(r),e.allAudioTracks.forEach(r),e.allSubtitleTracks.forEach(r),this.hasDetails=!1}}on(e,r,n){var i;(i=this.hls)==null||i.on(e,r)}once(e,r,n){var i;(i=this.hls)==null||i.once(e,r)}off(e,r,n){var i;(i=this.hls)==null||i.off(e,r)}toString(){var e;return`HlsAssetPlayer: ${El(this.assetItem)} ${(e=this.hls)==null?void 0:e.sessionId} ${this.appendInPlace?"append-in-place":""}`}}const HI=.033;class yJ extends Dn{constructor(e,r){super("interstitials-sched",r),this.onScheduleUpdate=void 0,this.eventMap={},this.events=null,this.items=null,this.durations={primary:0,playout:0,integrated:0},this.onScheduleUpdate=e}destroy(){this.reset(),this.onScheduleUpdate=null}reset(){this.eventMap={}
vendor: 11,714 bytes, lines 277-278
277,this.setDurations(0,0,0),this.events&&this.events.forEach(e=>e.reset()),this.events=this.items=null}resetErrorsInRange(e,r){return this.events?this.events.reduce((n,i)=>e<=i.startOffset&&r>i.startOffset?(delete i.error,n+1):n,0):0}get duration(){const e=this.items;return e?e[e.length-1].end:0}get length(){return this.items?this.items.length:0}getEvent(e){return e&&this.eventMap[e]||null}hasEvent(e){return e in this.eventMap}findItemIndex(e,r){if(e.event)return this.findEventIndex(e.event.identifier);let n=-1;e.nextEvent?n=this.findEventIndex(e.nextEvent.identifier)-1:e.previousEvent&&(n=this.findEventIndex(e.previousEvent.identifier)+1);const i=this.items;if(i)for(i[n]||(r===void 0&&(r=e.start),n=this.findItemIndexAtTime(r));n>=0&&(s=i[n])!=null&&s.event;){var s;n--}return n}findItemIndexAtTime(e,r){const n=this.items;if(n)for(let i=0;i<n.length;i++){let s=n[i];if(r&&r!=="primary"&&(s=s[r]),e===s.start||e>s.start&&e<s.end)return i}return-1}findJumpRestrictedIndex(e,r){const n=this.items;if(n)for(let i=e;i<=r&&n[i];i++){const s=n[i].event;if(s!=null&&s.restrictions.jump&&!s.appendInPlace)return i}return-1}findEventIndex(e){const r=this.items;if(r)for(let i=r.length;i--;){var n;if(((n=r[i].event)==null?void 0:n.identifier)===e)return i}return-1}findAssetIndex(e,r){const n=e.assetList,i=n.length;if(i>1)for(let s=0;s<i;s++){const a=n[s];if(!a.error){const o=a.timelineStart;if(r===o||r>o&&(r<o+(a.duration||0)||s===i-1))return s}}return 0}get assetIdAtEnd(){var e;const r=(e=this.items)==null||(e=e[this.length-1])==null?void 0:e.event;if(r){const n=r.assetList,i=n[n.length-1];if(i)return i.identifier}return null}parseInterstitialDateRanges(e,r){const n=e.main.details,{dateRanges:i}=n,s=this.events,a=this.parseDateRanges(i,{url:n.url},r),o=Object.keys(i),l=s?s.filter(c=>!o.includes(c.identifier)):[];a.length&&a.sort((c,u)=>{const d=c.cue.pre,f=c.cue.post,h=u.cue.pre,p=u.cue.post;if(d&&!h)return-1;if(h&&!d||f&&!p)return 1;if(p&&!f)return-1;if(!d&&!h&&!f&&!p){const g=c.startTime,m=u.startTime;if(g!==m)return g-m}return c.dateRange.tagOrder-u.dateRange.tagOrder}),this.events=a,l.forEach(c=>{this.removeEvent(c)}),this.updateSchedule(e,l)}updateSchedule(e,r=[],n=!1){const i=this.events||[];if(i.length||r.length||this.length<2){const s=this.items,a=this.parseSchedule(i,e);(n||r.length||(s==null?void 0:s.length)!==a.length||a.some((l,c)=>Math.abs(l.playout.start-s[c].playout.start)>.005||Math.abs(l.playout.end-s[c].playout.end)>.005))&&(this.items=a,this.onScheduleUpdate(r,s))}}parseDateRanges(e,r,n){const i=[],s=Object.keys(e);for(let a=0;a<s.length;a++){const o=s[a],l=e[o];if(l.isInterstitial){let c=this.eventMap[o];c?c.setDateRange(l):(c=new mJ(l,r),this.eventMap[o]=c,n===!1&&(c.appendInPlace=n)),i.push(c)}}return i}parseSchedule(e,r){const n=[],i=r.main.details,s=i.live?1/0:i.edge;let a=0;if(e=e.filter(l=>!l.error&&!(l.cue.once&&l.hasPlayed)),e.length){this.resolveOffsets(e,r);let l=0,c=0;if(e.forEach((u,d)=>{const f=u.cue.pre,h=u.cue.post,p=e[d-1]||null,g=u.appendInPlace,m=h?s:u.startOffset,v=u.duration,y=u.timelineOccupancy===Hm.Range?v:0,b=u.resumptionOffset,w=(p==null?void 0:p.startTime)===m,S=m+u.cumulativeDuration;let T=g?S+v:m+b;if(f||!h&&m<=0){const A=c;c+=y,u.timelineStart=S;const P=a;a+=v,n.push({event:u,start:S,end:T,playout:{start:P,end:a},integrated:{start:A,end:c}})}else if(m<=s){if(!w){const C=m-l;if(C>HI){const O=l,R=c;c+=C;const D=a;a+=C;const L={previousEvent:e[d-1]||null,nextEvent:u,start:O,end:O+C,playout:{start:D,end:a},integrated:{start:R,end:c}};n.push(L)}else C>0&&p&&(p.cumulativeDuration+=C,n[n.length-1].end=m)}h&&(T=S),u.timelineStart=S;const A=c;c+=y;const P=a;a+=v,n.push({event:u,start:S,end:T,playout:{start:P,end:a},integrated:{start:A,end:c}})}else return;const _=u.resumeTime;h||_>s?l=s:l=_}),l<s){var o;const u=l,d=c,f=s-l;c+=f;const h=a;a+=f,n.push({previousEvent:((o=n[n.length-1])==null?void 0:o.event)||null,nextEvent:null,start:l,end:u+f,playout:{start:h,end:a},integrated:{start:d,end:c}})}this.setDurations(s,a,c)}else n.push({previousEvent:null,nextEvent:null,start:0,end:s,playout:{start:0,end:s},integrated:{start:0,end:s}}),this.setDurations(s,s,s);return n}setDurations(e,r,n){this.durations={primary:e,playout:r,integrated:n}}resolveOffsets(e,r){const n=r.main.details,i=n.live?1/0:n.edge;let s=0,a=-1;e.forEach((o,l)=>{const c=o.cue.pre,u=o.cue.post,d=c?0:u?i:o.startTime;this.updateAssetDurations(o),a===d?o.cumulativeDuration=s:(s=0,a=d),!u&&o.snapOptions.in&&(o.resumeAnchor=jo(null,n.fragments,o.startOffset+o.resumptionOffset,0,0)||void 0),o.appendInPlace&&!o.appendInPlaceStarted&&(this.primaryCanResumeInPlaceAt(o,r)||(o.appendInPlace=!1)),!o.appendInPlace&&l+1<e.length&&e[l+1].startTime-e[l].resumeTime<HI&&(e[l+1].appendInPlace=!1,e[l+1].appendInPlace&&this.warn(`Could not change append strategy for abutting event ${o}`));const h=se(o.resumeOffset)?o.resumeOffset:o.duration;s+=h})}primaryCanResumeInPlaceAt(e,r){const n=e.resumeTime,i=e.startTime+e.resumptionOffset;return Math.abs(n-i)>ec?(this.log(`"${e.identifier}" resumption ${n} not aligned with estimated timeline end ${i}`),!1):!Object.keys(r).some(a=>{const o=r[a].details,l=o.edge;if(n>=l)return this.log(`"${e.identifier}" resumption ${n} past ${a} playlist end ${l}`),!1;const c=jo(null,o.fragments,n);if(!c)return this.log(`"${e.identifier}" resumption ${n} does not align with any fragments in ${a} playlist (${o.fragStart}-${o.fragmentEnd})`),!0;const u=a==="audio"?.175:0;return Math.abs(c.start-n)<ec+u||Math.abs(c.end-n)<ec+u?!1:(this.log(`"${e.identifier}" resumption ${n} not aligned with ${a} fragment bounds (${c.start}-${c.end} sn: ${c.sn} cc: ${c.cc})`),!0)})}updateAssetDurations(e){if(!e.assetListLoaded)return;const r=e.timelineStart;let n=0,i=!1,s=!1;for(let a=0;a<e.assetList.length;a++){const o=e.assetList[a],l=r+n;o.startOffset=n,o.timelineStart=l,i||(i=o.duration===null),s||(s=!!o.error);const c=o.error?0:o.duration||0;n+=c}i&&!s?e.duration=Math.max(n,e.duration):e.duration=n}removeEvent(e){e.reset(),delete this.eventMap[e.identifier]}}function Gn(t){return`[${t.event?'"'+t.event.identifier+'"':"primary"}: ${t.start.toFixed(2)}-${t.end.toFixed(2)}]`}class bJ{constructor(e){this.hls=void 0,this.hls=e}destroy(){this.hls=null}loadAssetList(e,r){const n=e.assetListUrl;let i;try{i=T2(n,this.hls.sessionId,e.baseUrl)}catch(f){const h=this.assignAssetListError(e,V.ASSET_LIST_LOAD_ERROR,f,n);this.hls.trigger(I.ERROR,h);return}r&&i.protocol!=="data:"&&i.searchParams.set("_HLS_start_offset",""+r);const s=this.hls.config,a=s.loader,o=new a(s),l={responseType:"json",url:i.href},c=s.interstitialAssetListLoadPolicy.default,u={loadPolicy:c,timeout:c.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},d={onSuccess:(f,h,p,g)=>{const m=f.data,v=m==null?void 0:m.ASSETS;if(!Array.isArray(v)){const y=this.assignAssetListError(e,V.ASSET_LIST_PARSING_ERROR,new Error("Invalid interstitial asset list"),p.url,h,g);this.hls.trigger(I.ERROR,y);return}e.assetListResponse=m,this.hls.trigger(I.ASSET_LIST_LOADED,{event:e,assetListResponse:m,networkDetails:g})},onError:(f,h,p,g)=>{const m=this.assignAssetListError(e,V.ASSET_LIST_LOAD_ERROR,new Error(`Error loading X-ASSET-LIST: HTTP status ${f.code} ${f.text} (${h.url})`),h.url,g,p);this.hls.trigger(I.ERROR,m)},onTimeout:(f,h,p)=>{const g=this.assignAssetListError(e,V.ASSET_LIST_LOAD_TIMEOUT,new Error(`Timeout loading X-ASSET-LIST (${h.url})`),h.url,f,p);this.hls.trigger(I.ERROR,g)}};return o.load(l,u,d),this.hls.trigger(I.ASSET_LIST_LOADING,{event:e}),o}assignAssetListError(e,r,n,i,s,a){return e.error=n,{type:fe.NETWORK_ERROR,details:r,fatal:!1,interstitial:e,url:i,error:n,networkDetails:a,stats:s}}}function KI(t){var e;t==null||(e=t.play())==null||e.catch(()=>{})}function rp(t,e){return`[${t}] Advancing timeline position to ${e}`}class xJ extends Dn{constructor(e,r){super("interstitials",e.logger),this.HlsPlayerClass=void 0,this.hls=void 0,this.assetListLoader=void 0,this.mediaSelection=null,this.altSelection=null,this.media=null,this.detachedData=null,this.requiredTracks=null,this.manager=null,this.playerQueue=[],this.bufferedPos=-1,this.timelinePos=-1,this.schedule=void 0,this.playingItem=null,this.bufferingItem=null,this.waitingItem=null,this.endedItem=null,this.playingAsset=null,this.endedAsset=null,this.bufferingAsset=null,this.shouldPlay=!1,this.onPlay=()=>{this.shouldPlay=!0},this.onPause=()=>{this.shouldPlay=!1},this.onSeeking=()=>{const n=this.currentTime;if(n===void 0||this.playbackDisabled||!this.schedule)return;const i=n-this.timelinePos;if(Math.abs(i)<1/7056e5)return;const a=i<=-.01;this.timelinePos=n,this.bufferedPos=n;const o=this.playingItem;if(!o){this.checkBuffer();return}if(a&&this.schedule.resetErrorsInRange(n,n-i)&&this.updateSchedule(!0),this.checkBuffer(),a&&n<o.start||n>=o.end){var l;const h=this.findItemIndex(o);let p=this.schedule.findItemIndexAtTime(n);if(p===-1&&(p=h+(a?-1:1),this.log(`seeked ${a?"back ":""}to position not covered by schedule ${n} (resolving from ${h} to ${p})`)),!this.isInterstitial(o)&&(l=this.media)!=null&&l.paused&&(this.shouldPlay=!1),!a&&p>h){const g=this.schedule.findJumpRestrictedIndex(h+1,p);if(g>h){this.setSchedulePosition(g);return}}this.setSchedulePosition(p);return}const c=this.playingAsset;if(!c){if(this.playingLastItem&&this.isInterstitial(o)){const h=o.event.assetList[0];h&&(this.endedItem=this.playingItem,this.playingItem=null,this.setScheduleToAssetAtTime(n,h))}return}const u=c.timelineStart,d=c.duration||0;if(a&&n<u||n>=u+d){var f;(f=o.event)!=null&&f.appendInPlace&&(this.clearAssetPlayers(o.event,o),this.flushFrontBuffer(n)),this.setScheduleToAssetAtTime(n,c)}},this.onTimeupdate=()=>{const n=this.currentTime;if(n===void 0||this.playbackDisabled)return;if(n>this.timelinePos)this.timelinePos=n,n>this.bufferedPos&&this.checkBuffer();else return;const i=this.playingItem;if(!i||this.playingLastItem)return;if(n>=i.end){this.timelinePos=i.end;const o=this.findItemIndex(i);this.setSchedulePosition(o+1)}const s=this.playingAsset;if(!s)return;const a=s.timelineStart+(s.duration||0);n>=a&&this.setScheduleToAssetAtTime(n,s)},this.onScheduleUpdate=(n,i)=>{const s=this.schedule;if(!s)return;const a=this.playingItem,o=s.events||[],l=s.items||[],c=s.durations,u=n.map(g=>g.identifier),d=!!(o.length||u.length);(d||i)&&this.log(`INTERSTITIALS_UPDATED (${o.length}): ${o}
278Schedule: ${l.map(g=>Gn(g))} pos: ${this.timelinePos}`),u.length&&this.log(`Removed events ${u}`);let f=null,h=null;a&&(f=this.updateItem(a,this.timelinePos),this.itemsMatch(a,f)?this.playingItem=f:this.waitingItem=this.endedItem=null),this.waitingItem=this.updateItem(this.waitingItem),this.endedItem=this.updateItem(this.endedItem);const p=this.bufferingItem;if(p&&(h=this.updateItem(p,this.bufferedPos),this.itemsMatch(p,h)?this.bufferingItem=h:p.event&&(this.bufferingItem=this.playingItem,this.clearInterstitial(p.event,null))),n.forEach(g=>{g.assetList.forEach(m=>{this.clearAssetPlayer(m.identifier,null)})}),this.playerQueue.forEach(g=>{if(g.interstitial.appendInPlace){const m=g.assetItem.timelineStart,v=g.timelineOffset-m;if(v)try{g.timelineOffset=m}catch(y){Math.abs(v)>ec&&this.warn(`${y} ("${g.assetId}" ${g.timelineOffset}->${m})`)}}}),d||i){if(this.hls.trigger(I.INTERSTITIALS_UPDATED,{events:o.slice(0),schedule:l.slice(0),durations:c,removedIds:u}),this.isInterstitial(a)&&u.includes(a.event.identifier)){this.warn(`Interstitial "${a.event.identifier}" removed while playing`),this.primaryFallback(a.event);return}a&&this.trimInPlace(f,a),p&&h!==f&&this.trimInPlace(h,p),this.checkBuffer()}},this.hls=e,this.HlsPlayerClass=r,this.assetListLoader=new bJ(e),this.schedule=new yJ(this.onScheduleUpdate,e.logger),this.registerListeners()}registerListeners(){const e=this.hls;
vendor: 4,217 bytes, line 278
278e&&(e.on(I.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(I.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(I.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(I.MANIFEST_LOADING,this.onManifestLoading,this),e.on(I.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(I.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(I.AUDIO_TRACK_UPDATED,this.onAudioTrackUpdated,this),e.on(I.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.on(I.SUBTITLE_TRACK_UPDATED,this.onSubtitleTrackUpdated,this),e.on(I.EVENT_CUE_ENTER,this.onInterstitialCueEnter,this),e.on(I.ASSET_LIST_LOADED,this.onAssetListLoaded,this),e.on(I.BUFFER_APPENDED,this.onBufferAppended,this),e.on(I.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(I.BUFFERED_TO_END,this.onBufferedToEnd,this),e.on(I.MEDIA_ENDED,this.onMediaEnded,this),e.on(I.ERROR,this.onError,this),e.on(I.DESTROYING,this.onDestroying,this))}unregisterListeners(){const e=this.hls;e&&(e.off(I.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(I.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(I.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(I.MANIFEST_LOADING,this.onManifestLoading,this),e.off(I.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(I.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(I.AUDIO_TRACK_UPDATED,this.onAudioTrackUpdated,this),e.off(I.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.off(I.SUBTITLE_TRACK_UPDATED,this.onSubtitleTrackUpdated,this),e.off(I.EVENT_CUE_ENTER,this.onInterstitialCueEnter,this),e.off(I.ASSET_LIST_LOADED,this.onAssetListLoaded,this),e.off(I.BUFFER_CODECS,this.onBufferCodecs,this),e.off(I.BUFFER_APPENDED,this.onBufferAppended,this),e.off(I.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(I.BUFFERED_TO_END,this.onBufferedToEnd,this),e.off(I.MEDIA_ENDED,this.onMediaEnded,this),e.off(I.ERROR,this.onError,this),e.off(I.DESTROYING,this.onDestroying,this))}startLoad(){this.resumeBuffering()}stopLoad(){this.pauseBuffering()}resumeBuffering(){var e;(e=this.getBufferingPlayer())==null||e.resumeBuffering()}pauseBuffering(){var e;(e=this.getBufferingPlayer())==null||e.pauseBuffering()}destroy(){this.unregisterListeners(),this.stopLoad(),this.assetListLoader&&this.assetListLoader.destroy(),this.emptyPlayerQueue(),this.clearScheduleState(),this.schedule&&this.schedule.destroy(),this.media=this.detachedData=this.mediaSelection=this.requiredTracks=this.altSelection=this.schedule=this.manager=null,this.hls=this.HlsPlayerClass=this.log=null,this.assetListLoader=null,this.onPlay=this.onPause=this.onSeeking=this.onTimeupdate=null,this.onScheduleUpdate=null}onDestroying(){const e=this.primaryMedia||this.media;e&&this.removeMediaListeners(e)}removeMediaListeners(e){Gr(e,"play",this.onPlay),Gr(e,"pause",this.onPause),Gr(e,"seeking",this.onSeeking),Gr(e,"timeupdate",this.onTimeupdate)}onMediaAttaching(e,r){const n=this.media=r.media;kr(n,"seeking",this.onSeeking),kr(n,"timeupdate",this.onTimeupdate),kr(n,"play",this.onPlay),kr(n,"pause",this.onPause)}onMediaAttached(e,r){const n=this.effectivePlayingItem,i=this.detachedData;if(this.detachedData=null,n===null)this.checkStart();else if(!i){this.clearScheduleState();const s=this.findItemIndex(n);this.setSchedulePosition(s)}}clearScheduleState(){this.log("clear schedule state"),this.playingItem=this.bufferingItem=this.waitingItem=this.endedItem=this.playingAsset=this.endedAsset=this.bufferingAsset=null}onMediaDetaching(e,r){const n=!!r.transferMedia,i=this.media;if(this.media=null,!n&&(i&&this.removeMediaListeners(i),this.detachedData)){const s=this.getBufferingPlayer();s&&(this.log(`Removing schedule state for detachedData and ${s}`),this.playingAsset=this.endedAsset=this.bufferingAsset=this.bufferingItem=this.waitingItem=this.detachedData=null,s.detachMedia()),this.shouldPlay=!1}}get interstitialsManager(){if(!this.hls)return null;if(this.manager)return this.manager;const e=this,r=()=>e.bufferingItem||e.waitingItem,n=d=>d&&e.getAssetPlayer(d.identifier),i=(d,f,h,p,g)=>{if(d){let m=d[f].start;const v=d.event;if(v){if(f==="playout"||v.timelineOccupancy!==Hm.Point){const y=n(h);(y==null?void 0:y.interstitial)===v&&(m+=y.assetItem.startOffset+y[g])}}else{const y=p==="bufferedPos"?a():e[p];m+=y-d.start}return m}return 0},s=(d,f)=>{var h;
vendor: 35,216 bytes, line 278
278if(d!==0&&f!=="primary"&&(h=e.schedule)!=null&&h.length){var p;const g=e.schedule.findItemIndexAtTime(d),m=(p=e.schedule.items)==null?void 0:p[g];if(m){const v=m[f].start-m.start;return d+v}}return d},a=()=>{const d=e.bufferedPos;return d===Number.MAX_VALUE?o("primary"):Math.max(d,0)},o=d=>{var f,h;return(f=e.primaryDetails)!=null&&f.live?e.primaryDetails.edge:((h=e.schedule)==null?void 0:h.durations[d])||0},l=(d,f)=>{var h,p;const g=e.effectivePlayingItem;if(g!=null&&(h=g.event)!=null&&h.restrictions.skip||!e.schedule)return;e.log(`seek to ${d} "${f}"`);const m=e.effectivePlayingItem,v=e.schedule.findItemIndexAtTime(d,f),y=(p=e.schedule.items)==null?void 0:p[v],b=e.getBufferingPlayer(),w=b==null?void 0:b.interstitial,S=w==null?void 0:w.appendInPlace,T=m&&e.itemsMatch(m,y);if(m&&(S||T)){const _=n(e.playingAsset),A=(_==null?void 0:_.media)||e.primaryMedia;if(A){const P=f==="primary"?A.currentTime:i(m,f,e.playingAsset,"timelinePos","currentTime"),C=d-P,O=(S?P:A.currentTime)+C;if(O>=0&&(!_||S||O<=_.duration)){A.currentTime=O;return}}}if(y){let _=d;if(f!=="primary"){const P=y[f].start,C=d-P;_=y.start+C}const A=!e.isInterstitial(y);if((!e.isInterstitial(m)||m.event.appendInPlace)&&(A||y.event.appendInPlace)){const P=e.media||(S?b==null?void 0:b.media:null);P&&(P.currentTime=_)}else if(m){const P=e.findItemIndex(m);if(v>P){const O=e.schedule.findJumpRestrictedIndex(P+1,v);if(O>P){e.setSchedulePosition(O);return}}let C=0;if(A)e.timelinePos=_,e.checkBuffer();else{const O=y.event.assetList,R=d-(y[f]||y).start;for(let D=O.length;D--;){const L=O[D];if(L.duration&&R>=L.startOffset&&R<L.startOffset+L.duration){C=D;break}}}e.setSchedulePosition(v,C)}}},c=()=>{const d=e.effectivePlayingItem;if(e.isInterstitial(d))return d;const f=r();return e.isInterstitial(f)?f:null},u={get bufferedEnd(){const d=r(),f=e.bufferingItem;if(f&&f===d){var h;return i(f,"playout",e.bufferingAsset,"bufferedPos","bufferedEnd")-f.playout.start||((h=e.bufferingAsset)==null?void 0:h.startOffset)||0}return 0},get currentTime(){const d=c(),f=e.effectivePlayingItem;return f&&f===d?i(f,"playout",e.effectivePlayingAsset,"timelinePos","currentTime")-f.playout.start:0},set currentTime(d){const f=c(),h=e.effectivePlayingItem;h&&h===f&&l(d+h.playout.start,"playout")},get duration(){const d=c();return d?d.playout.end-d.playout.start:0},get assetPlayers(){var d;const f=(d=c())==null?void 0:d.event.assetList;return f?f.map(h=>e.getAssetPlayer(h.identifier)):[]},get playingIndex(){var d;const f=(d=c())==null?void 0:d.event;return f&&e.effectivePlayingAsset?f.findAssetIndex(e.effectivePlayingAsset):-1},get scheduleItem(){return c()}};return this.manager={get events(){var d;return((d=e.schedule)==null||(d=d.events)==null?void 0:d.slice(0))||[]},get schedule(){var d;return((d=e.schedule)==null||(d=d.items)==null?void 0:d.slice(0))||[]},get interstitialPlayer(){return c()?u:null},get playerQueue(){return e.playerQueue.slice(0)},get bufferingAsset(){return e.bufferingAsset},get bufferingItem(){return r()},get bufferingIndex(){const d=r();return e.findItemIndex(d)},get playingAsset(){return e.effectivePlayingAsset},get playingItem(){return e.effectivePlayingItem},get playingIndex(){const d=e.effectivePlayingItem;return e.findItemIndex(d)},primary:{get bufferedEnd(){return a()},get currentTime(){const d=e.timelinePos;return d>0?d:0},set currentTime(d){l(d,"primary")},get duration(){return o("primary")},get seekableStart(){var d;return((d=e.primaryDetails)==null?void 0:d.fragmentStart)||0}},integrated:{get bufferedEnd(){return i(r(),"integrated",e.bufferingAsset,"bufferedPos","bufferedEnd")},get currentTime(){return i(e.effectivePlayingItem,"integrated",e.effectivePlayingAsset,"timelinePos","currentTime")},set currentTime(d){l(d,"integrated")},get duration(){return o("integrated")},get seekableStart(){var d;return s(((d=e.primaryDetails)==null?void 0:d.fragmentStart)||0,"integrated")}},skip:()=>{const d=e.effectivePlayingItem,f=d==null?void 0:d.event;if(f&&!f.restrictions.skip){const h=e.findItemIndex(d);if(f.appendInPlace){const p=d.playout.start+d.event.duration;l(p+.001,"playout")}else e.advanceAfterAssetEnded(f,h,1/0)}}}}get effectivePlayingItem(){return this.waitingItem||this.playingItem||this.endedItem}get effectivePlayingAsset(){return this.playingAsset||this.endedAsset}get playingLastItem(){var e;const r=this.playingItem,n=(e=this.schedule)==null?void 0:e.items;return!this.playbackStarted||!r||!n?!1:this.findItemIndex(r)===n.length-1}get playbackStarted(){return this.effectivePlayingItem!==null}get currentTime(){var e,r;if(this.mediaSelection===null)return;const n=this.waitingItem||this.playingItem;if(this.isInterstitial(n)&&!n.event.appendInPlace)return;let i=this.media;!i&&(e=this.bufferingItem)!=null&&(e=e.event)!=null&&e.appendInPlace&&(i=this.primaryMedia);const s=(r=i)==null?void 0:r.currentTime;if(!(s===void 0||!se(s)))return s}get primaryMedia(){var e;return this.media||((e=this.detachedData)==null?void 0:e.media)||null}isInterstitial(e){return!!(e!=null&&e.event)}retreiveMediaSource(e,r){const n=this.getAssetPlayer(e);n&&this.transferMediaFromPlayer(n,r)}transferMediaFromPlayer(e,r){const n=e.interstitial.appendInPlace,i=e.media;if(n&&i===this.primaryMedia){if(this.bufferingAsset=null,(!r||this.isInterstitial(r)&&!r.event.appendInPlace)&&r&&i){this.detachedData={media:i};return}const s=e.transferMedia();this.log(`transfer MediaSource from ${e} ${it(s)}`),this.detachedData=s}else r&&i&&(this.shouldPlay||(this.shouldPlay=!i.paused))}transferMediaTo(e,r){var n,i;if(e.media===r)return;let s=null;const a=this.hls,o=e!==a,l=o&&e.interstitial.appendInPlace,c=(n=this.detachedData)==null?void 0:n.mediaSource;let u;if(a.media)l&&(s=a.transferMedia(),this.detachedData=s),u="Primary";else if(c){const p=this.getBufferingPlayer();p?(s=p.transferMedia(),u=`${p}`):u="detached MediaSource"}else u="detached media";if(!s){if(c)s=this.detachedData,this.log(`using detachedData: MediaSource ${it(s)}`);else if(!this.detachedData||a.media===r){const p=this.playerQueue;p.length>1&&p.forEach(g=>{if(o&&g.interstitial.appendInPlace!==l){const m=g.interstitial;this.clearInterstitial(g.interstitial,null),m.appendInPlace=!1,m.appendInPlace&&this.warn(`Could not change append strategy for queued assets ${m}`)}}),this.hls.detachMedia(),this.detachedData={media:r}}}const d=s&&"mediaSource"in s&&((i=s.mediaSource)==null?void 0:i.readyState)!=="closed",f=d&&s?s:r;this.log(`${d?"transfering MediaSource":"attaching media"} to ${o?e:"Primary"} from ${u} (media.currentTime: ${r.currentTime})`);const h=this.schedule;if(f===s&&h){const p=o&&e.assetId===h.assetIdAtEnd;f.overrides={duration:h.duration,endOfStream:!o||p,cueRemoval:!o}}e.attachMedia(f)}onInterstitialCueEnter(){this.onTimeupdate()}checkStart(){const e=this.schedule,r=e==null?void 0:e.events;if(!r||this.playbackDisabled||!this.media)return;this.bufferedPos===-1&&(this.bufferedPos=0);const n=this.timelinePos,i=this.effectivePlayingItem;if(n===-1){const s=this.hls.startPosition;if(this.log(rp("checkStart",s)),this.timelinePos=s,r.length&&r[0].cue.pre){const a=e.findEventIndex(r[0].identifier);this.setSchedulePosition(a)}else if(s>=0||!this.primaryLive){const a=this.timelinePos=s>0?s:0,o=e.findItemIndexAtTime(a);this.setSchedulePosition(o)}}else if(i&&!this.playingItem){const s=e.findItemIndex(i);this.setSchedulePosition(s)}}advanceAssetBuffering(e,r){const n=e.event,i=n.findAssetIndex(r),s=N0(n,i);if(!n.isAssetPastPlayoutLimit(s))this.bufferedToEvent(e,s);else if(this.schedule){var a;const o=(a=this.schedule.items)==null?void 0:a[this.findItemIndex(e)+1];o&&this.bufferedToItem(o)}}advanceAfterAssetEnded(e,r,n){const i=N0(e,n);if(e.isAssetPastPlayoutLimit(i)){if(this.schedule){const s=this.schedule.items;if(s){const a=r+1,o=s.length;if(a>=o){this.setSchedulePosition(-1);return}const l=e.resumeTime;this.timelinePos<l&&(this.log(rp("advanceAfterAssetEnded",l)),this.timelinePos=l,e.appendInPlace&&this.advanceInPlace(l),this.checkBuffer(this.bufferedPos<l)),this.setSchedulePosition(a)}}}else{if(e.appendInPlace){const s=e.assetList[i];s&&this.advanceInPlace(s.timelineStart)}this.setSchedulePosition(r,i)}}setScheduleToAssetAtTime(e,r){const n=this.schedule;if(!n)return;const i=r.parentIdentifier,s=n.getEvent(i);if(s){const a=n.findEventIndex(i),o=n.findAssetIndex(s,e);this.advanceAfterAssetEnded(s,a,o-1)}}setSchedulePosition(e,r){var n;const i=(n=this.schedule)==null?void 0:n.items;if(!i||this.playbackDisabled)return;const s=e>=0?i[e]:null;this.log(`setSchedulePosition ${e}, ${r} (${s&&Gn(s)}) pos: ${this.timelinePos}`);const a=this.waitingItem||this.playingItem,o=this.playingLastItem;if(this.isInterstitial(a)){const u=a.event,d=this.playingAsset,f=d==null?void 0:d.identifier,h=f?this.getAssetPlayer(f):null;if(h&&f&&(!this.eventItemsMatch(a,s)||r!==void 0&&f!==u.assetList[r].identifier)){var l;const p=u.findAssetIndex(d);if(this.log(`INTERSTITIAL_ASSET_ENDED ${p+1}/${u.assetList.length} ${El(d)}`),this.endedAsset=d,this.playingAsset=null,this.hls.trigger(I.INTERSTITIAL_ASSET_ENDED,{asset:d,assetListIndex:p,event:u,schedule:i.slice(0),scheduleIndex:e,player:h}),a!==this.playingItem){this.itemsMatch(a,this.playingItem)&&!this.playingAsset&&this.advanceAfterAssetEnded(u,this.findItemIndex(this.playingItem),p);return}this.retreiveMediaSource(f,s),h.media&&!((l=this.detachedData)!=null&&l.mediaSource)&&h.detachMedia()}if(!this.eventItemsMatch(a,s)&&(this.endedItem=a,this.playingItem=null,this.log(`INTERSTITIAL_ENDED ${u} ${Gn(a)}`),u.hasPlayed=!0,this.hls.trigger(I.INTERSTITIAL_ENDED,{event:u,schedule:i.slice(0),scheduleIndex:e}),u.cue.once)){var c;this.updateSchedule();const p=(c=this.schedule)==null?void 0:c.items;if(s&&p){const g=this.findItemIndex(s);this.advanceSchedule(g,p,r,a,o)}return}}this.advanceSchedule(e,i,r,a,o)}advanceSchedule(e,r,n,i,s){const a=this.schedule;if(!a)return;const o=r[e]||null,l=this.primaryMedia,c=this.playerQueue;if(c.length&&c.forEach(u=>{const d=u.interstitial,f=a.findEventIndex(d.identifier);(f<e||f>e+1)&&this.clearInterstitial(d,o)}),this.isInterstitial(o)){this.timelinePos=Math.min(Math.max(this.timelinePos,o.start),o.end);const u=o.event;if(n===void 0){n=a.findAssetIndex(u,this.timelinePos);const p=N0(u,n-1);if(u.isAssetPastPlayoutLimit(p)||u.appendInPlace&&this.timelinePos===o.end){this.advanceAfterAssetEnded(u,e,n);return}n=p}const d=this.waitingItem;this.assetsBuffered(o,l)||this.setBufferingItem(o);let f=this.preloadAssets(u,n);if(this.eventItemsMatch(o,d||i)||(this.waitingItem=o,this.log(`INTERSTITIAL_STARTED ${Gn(o)} ${u.appendInPlace?"append in place":""}`),this.hls.trigger(I.INTERSTITIAL_STARTED,{event:u,schedule:r.slice(0),scheduleIndex:e})),!u.assetListLoaded){this.log(`Waiting for ASSET-LIST to complete loading ${u}`);return}if(u.assetListLoader&&(u.assetListLoader.destroy(),u.assetListLoader=void 0),!l){this.log(`Waiting for attachMedia to start Interstitial ${u}`);return}this.waitingItem=this.endedItem=null,this.playingItem=o;const h=u.assetList[n];if(!h){this.advanceAfterAssetEnded(u,e,n||0);return}if(f||(f=this.getAssetPlayer(h.identifier)),f===null||f.destroyed){const p=u.assetList.length;this.warn(`asset ${n+1}/${p} player destroyed ${u}`),f=this.createAssetPlayer(u,h,n),f.loadSource()}if(!this.eventItemsMatch(o,this.bufferingItem)&&u.appendInPlace&&this.isAssetBuffered(h))return;this.startAssetPlayer(f,n,r,e,l),this.shouldPlay&&KI(f.media)}else o?(this.resumePrimary(o,e,i),this.shouldPlay&&KI(this.hls.media)):s&&this.isInterstitial(i)&&(this.endedItem=null,this.playingItem=i,i.event.appendInPlace||this.attachPrimary(a.durations.primary,null))}get playbackDisabled(){return this.hls.config.enableInterstitialPlayback===!1}get primaryDetails(){var e;return(e=this.mediaSelection)==null?void 0:e.main.details}get primaryLive(){var e;return!!((e=this.primaryDetails)!=null&&e.live)}resumePrimary(e,r,n){var i,s;if(this.playingItem=e,this.playingAsset=this.endedAsset=null,this.waitingItem=this.endedItem=null,this.bufferedToItem(e),this.log(`resuming ${Gn(e)}`),!((i=this.detachedData)!=null&&i.mediaSource)){let o=this.timelinePos;(o<e.start||o>=e.end)&&(o=this.getPrimaryResumption(e,r),this.log(rp("resumePrimary",o)),this.timelinePos=o),this.attachPrimary(o,e)}if(!n)return;const a=(s=this.schedule)==null?void 0:s.items;a&&(this.log(`INTERSTITIALS_PRIMARY_RESUMED ${Gn(e)}`),this.hls.trigger(I.INTERSTITIALS_PRIMARY_RESUMED,{schedule:a.slice(0),scheduleIndex:r}),this.checkBuffer())}getPrimaryResumption(e,r){const n=e.start;if(this.primaryLive){const i=this.primaryDetails;if(r===0)return this.hls.startPosition;if(i&&(n<i.fragmentStart||n>i.edge))return this.hls.liveSyncPosition||-1}return n}isAssetBuffered(e){const r=this.getAssetPlayer(e.identifier);return r!=null&&r.hls?r.hls.bufferedToEnd:Se.bufferInfo(this.primaryMedia,this.timelinePos,0).end+1>=e.timelineStart+(e.duration||0)}attachPrimary(e,r,n){r?this.setBufferingItem(r):this.bufferingItem=this.playingItem,this.bufferingAsset=null;const i=this.primaryMedia;if(!i)return;const s=this.hls;s.media?this.checkBuffer():(this.transferMediaTo(s,i),n&&this.startLoadingPrimaryAt(e,n)),n||(this.log(rp("attachPrimary",e)),this.timelinePos=e,this.startLoadingPrimaryAt(e,n))}startLoadingPrimaryAt(e,r){var n;const i=this.hls;!i.loadingEnabled||!i.media||Math.abs((((n=i.mainForwardBufferInfo)==null?void 0:n.start)||i.media.currentTime)-e)>.5?i.startLoad(e,r):i.bufferingEnabled||i.resumeBuffering()}onManifestLoading(){var e;this.stopLoad(),(e=this.schedule)==null||e.reset(),this.emptyPlayerQueue(),this.clearScheduleState(),this.shouldPlay=!1,this.bufferedPos=this.timelinePos=-1,this.mediaSelection=this.altSelection=this.manager=this.requiredTracks=null,this.hls.off(I.BUFFER_CODECS,this.onBufferCodecs,this),this.hls.on(I.BUFFER_CODECS,this.onBufferCodecs,this)}onLevelUpdated(e,r){if(r.level===-1||!this.schedule)return;const n=this.hls.levels[r.level];if(!n.details)return;const i=Ve(Ve({},this.mediaSelection||this.altSelection),{},{main:n});this.mediaSelection=i,this.schedule.parseInterstitialDateRanges(i,this.hls.config.interstitialAppendInPlace),!this.effectivePlayingItem&&this.schedule.items&&this.checkStart()}onAudioTrackUpdated(e,r){const n=this.hls.audioTracks[r.id],i=this.mediaSelection;if(!i){this.altSelection=Ve(Ve({},this.altSelection),{},{audio:n});return}const s=Ve(Ve({},i),{},{audio:n});this.mediaSelection=s}onSubtitleTrackUpdated(e,r){const n=this.hls.subtitleTracks[r.id],i=this.mediaSelection;if(!i){this.altSelection=Ve(Ve({},this.altSelection),{},{subtitles:n});return}const s=Ve(Ve({},i),{},{subtitles:n});this.mediaSelection=s}onAudioTrackSwitching(e,r){const n=tI(r);this.playerQueue.forEach(({hls:i})=>i&&(i.setAudioOption(r)||i.setAudioOption(n)))}onSubtitleTrackSwitch(e,r){const n=tI(r);this.playerQueue.forEach(({hls:i})=>i&&(i.setSubtitleOption(r)||r.id!==-1&&i.setSubtitleOption(n)))}onBufferCodecs(e,r){const n=r.tracks;n&&(this.requiredTracks=n)}onBufferAppended(e,r){this.checkBuffer()}onBufferFlushed(e,r){const n=this.playingItem;if(n&&!this.itemsMatch(n,this.bufferingItem)&&!this.isInterstitial(n)){const i=this.timelinePos;this.bufferedPos=i,this.checkBuffer()}}onBufferedToEnd(e){if(!this.schedule)return;const r=this.schedule.events;if(this.bufferedPos<Number.MAX_VALUE&&r){for(let i=0;i<r.length;i++){const s=r[i];if(s.cue.post){var n;const a=this.schedule.findEventIndex(s.identifier),o=(n=this.schedule.items)==null?void 0:n[a];this.isInterstitial(o)&&this.eventItemsMatch(o,this.bufferingItem)&&this.bufferedToItem(o,0);break}}this.bufferedPos=Number.MAX_VALUE}}onMediaEnded(e){const r=this.playingItem;if(!this.playingLastItem&&r){const n=this.findItemIndex(r);this.setSchedulePosition(n+1)}else this.shouldPlay=!1}updateItem(e,r){var n;const i=(n=this.schedule)==null?void 0:n.items;if(e&&i){const s=this.findItemIndex(e,r);return i[s]||null}return null}trimInPlace(e,r){if(this.isInterstitial(e)&&e.event.appendInPlace&&r.end-e.end>.25){e.event.assetList.forEach((s,a)=>{e.event.isAssetPastPlayoutLimit(a)&&this.clearAssetPlayer(s.identifier,null)});const n=e.end+.25,i=Se.bufferInfo(this.primaryMedia,n,0);(i.end>n||(i.nextStart||0)>n)&&(this.log(`trim buffered interstitial ${Gn(e)} (was ${Gn(r)})`),this.attachPrimary(n,null,!0),this.flushFrontBuffer(n))}}itemsMatch(e,r){return!!r&&(e===r||e.event&&r.event&&this.eventItemsMatch(e,r)||!e.event&&!r.event&&this.findItemIndex(e)===this.findItemIndex(r))}eventItemsMatch(e,r){var n;return!!r&&(e===r||e.event.identifier===((n=r.event)==null?void 0:n.identifier))}findItemIndex(e,r){return e&&this.schedule?this.schedule.findItemIndex(e,r):-1}updateSchedule(e=!1){var r;const n=this.mediaSelection;n&&((r=this.schedule)==null||r.updateSchedule(n,[],e))}checkBuffer(e){var r;const n=(r=this.schedule)==null?void 0:r.items;if(!n)return;const i=Se.bufferInfo(this.primaryMedia,this.timelinePos,0);e&&(this.bufferedPos=this.timelinePos),e||(e=i.len<1),this.updateBufferedPos(i.end,n,e)}updateBufferedPos(e,r,n){const i=this.schedule,s=this.bufferingItem;if(this.bufferedPos>e||!i)return;if(r.length===1&&this.itemsMatch(r[0],s)){this.bufferedPos=e;return}const a=this.playingItem,o=this.findItemIndex(a);let l=i.findItemIndexAtTime(e);if(this.bufferedPos<e){var c;const u=this.findItemIndex(s),d=Math.min(u+1,r.length-1),f=r[d];if((l===-1&&s&&e>=s.end||(c=f.event)!=null&&c.appendInPlace&&e+.01>=f.start)&&(l=d),this.isInterstitial(s)){const h=s.event;if(d-o>1&&h.appendInPlace===!1||h.assetList.length===0&&h.assetListLoader)return}if(this.bufferedPos=e,l>u&&l>o)this.bufferedToItem(f);else{const h=this.primaryDetails;this.primaryLive&&h&&e>h.edge-h.targetduration&&f.start<h.edge+this.hls.config.interstitialLiveLookAhead&&this.isInterstitial(f)&&this.preloadAssets(f.event,0)}}else n&&a&&!this.itemsMatch(a,s)&&(l===o?this.bufferedToItem(a):l===o+1&&this.bufferedToItem(r[l]))}assetsBuffered(e,r){return e.event.assetList.length===0?!1:!e.event.assetList.some(i=>{const s=this.getAssetPlayer(i.identifier);return!(s!=null&&s.bufferedInPlaceToEnd(r))})}setBufferingItem(e){const r=this.bufferingItem,n=this.schedule;if(!this.itemsMatch(e,r)&&n){const{items:i,events:s}=n;if(!i||!s)return r;const a=this.isInterstitial(e),o=this.getBufferingPlayer();this.bufferingItem=e,this.bufferedPos=Math.max(e.start,Math.min(e.end,this.timelinePos));const l=o?o.remaining:r?r.end-this.timelinePos:0;if(this.log(`INTERSTITIALS_BUFFERED_TO_BOUNDARY ${Gn(e)}`+(r?` (${l.toFixed(2)} remaining)`:"")),!this.playbackDisabled)if(a){const c=n.findAssetIndex(e.event,this.bufferedPos);e.event.assetList.forEach((u,d)=>{const f=this.getAssetPlayer(u.identifier);f&&(d===c&&f.loadSource(),f.resumeBuffering())})}else this.hls.resumeBuffering(),this.playerQueue.forEach(c=>c.pauseBuffering());this.hls.trigger(I.INTERSTITIALS_BUFFERED_TO_BOUNDARY,{events:s.slice(0),schedule:i.slice(0),bufferingIndex:this.findItemIndex(e),playingIndex:this.findItemIndex(this.playingItem)})}else this.bufferingItem!==e&&(this.bufferingItem=e);return r}bufferedToItem(e,r=0){const n=this.setBufferingItem(e);if(!this.playbackDisabled){if(this.isInterstitial(e))this.bufferedToEvent(e,r);else if(n!==null){this.bufferingAsset=null;const i=this.detachedData;i?i.mediaSource?this.attachPrimary(e.start,e,!0):this.preloadPrimary(e):this.preloadPrimary(e)}}}preloadPrimary(e){const r=this.findItemIndex(e),n=this.getPrimaryResumption(e,r);this.startLoadingPrimaryAt(n)}bufferedToEvent(e,r){const n=e.event,i=n.assetList.length===0&&!n.assetListLoader,s=n.cue.once;if(i||!s){const a=this.preloadAssets(n,r);if(a!=null&&a.interstitial.appendInPlace){const o=this.primaryMedia;o&&this.bufferAssetPlayer(a,o)}}}preloadAssets(e,r){const n=e.assetUrl,i=e.assetList.length,s=i===0&&!e.assetListLoader,a=e.cue.once;if(s){const l=e.timelineStart;if(e.appendInPlace){var o;const f=this.playingItem;!this.isInterstitial(f)&&(f==null||(o=f.nextEvent)==null?void 0:o.identifier)===e.identifier&&this.flushFrontBuffer(l+.25)}let c,u=0;if(!this.playingItem&&this.primaryLive&&(u=this.hls.startPosition,u===-1&&(u=this.hls.liveSyncPosition||0)),u&&!(e.cue.pre||e.cue.post)){const f=u-l;f>0&&(c=Math.round(f*1e3)/1e3)}if(this.log(`Load interstitial asset ${r+1}/${n?1:i} ${e}${c?` live-start: ${u} start-offset: ${c}`:""}`),n)return this.createAsset(e,0,0,l,e.duration,n);const d=this.assetListLoader.loadAssetList(e,c);d&&(e.assetListLoader=d)}else if(!a&&i){for(let c=r;c<i;c++){const u=e.assetList[c],d=this.getAssetPlayerQueueIndex(u.identifier);(d===-1||this.playerQueue[d].destroyed)&&!u.error&&this.createAssetPlayer(e,u,c)}const l=e.assetList[r];if(l){const c=this.getAssetPlayer(l.identifier);return c&&c.loadSource(),c}}return null}flushFrontBuffer(e){const r=this.requiredTracks;if(!r)return;this.log(`Removing front buffer starting at ${e}`),Object.keys(r).forEach(i=>{this.hls.trigger(I.BUFFER_FLUSHING,{startOffset:e,endOffset:1/0,type:i})})}getAssetPlayerQueueIndex(e){const r=this.playerQueue;for(let n=0;n<r.length;n++)if(e===r[n].assetId)return n;return-1}getAssetPlayer(e){const r=this.getAssetPlayerQueueIndex(e);return this.playerQueue[r]||null}getBufferingPlayer(){const{playerQueue:e,primaryMedia:r}=this;if(r){for(let n=0;n<e.length;n++)if(e[n].media===r)return e[n]}return null}createAsset(e,r,n,i,s,a){const o={parentIdentifier:e.identifier,identifier:pJ(e,a,r),duration:s,startOffset:n,timelineStart:i,uri:a};return this.createAssetPlayer(e,o,r)}createAssetPlayer(e,r,n){const i=this.hls,s=i.userConfig;let a=s.videoPreference;const o=i.loadLevelObj||i.levels[i.currentLevel];(a||o)&&(a=et({},a),o.videoCodec&&(a.videoCodec=o.videoCodec),o.videoRange&&(a.allowedVideoRanges=[o.videoRange]));const l=i.audioTracks[i.audioTrack],c=i.subtitleTracks[i.subtitleTrack];let u=0;if(this.primaryLive||e.appendInPlace){const w=this.timelinePos-r.timelineStart;if(w>1){const S=r.duration;S&&w<S&&(u=w)}}const d=r.identifier,f=Ve(Ve({},s),{},{maxMaxBufferLength:Math.min(180,i.config.maxMaxBufferLength),autoStartLoad:!0,startFragPrefetch:!0,primarySessionId:i.sessionId,assetPlayerId:d,abrEwmaDefaultEstimate:i.bandwidthEstimate,interstitialsController:void 0,startPosition:u,liveDurationInfinity:!1,testBandwidth:!1,videoPreference:a,audioPreference:l||s.audioPreference,subtitlePreference:c||s.subtitlePreference});e.appendInPlace&&(e.appendInPlaceStarted=!0,r.timelineStart&&(f.timelineOffset=r.timelineStart));const h=f.cmcd;h!=null&&h.sessionId&&h.contentId&&(f.cmcd=et({},h,{contentId:vd(r.uri)})),this.getAssetPlayer(d)&&this.warn(`Duplicate date range identifier ${e} and asset ${d}`);const p=new vJ(this.HlsPlayerClass,f,e,r);this.playerQueue.push(p),e.assetList[n]=r;let g=!0;const m=w=>{if(w.live){var S;const A=new Error(`Interstitials MUST be VOD assets ${e}`),P={fatal:!0,type:fe.OTHER_ERROR,details:V.INTERSTITIAL_ASSET_ITEM_ERROR,error:A},C=((S=this.schedule)==null?void 0:S.findEventIndex(e.identifier))||-1;this.handleAssetItemError(P,e,C,n,A.message);return}const T=w.edge-w.fragmentStart,_=r.duration;(g||_===null||T>_)&&(g=!1,this.log(`Interstitial asset "${d}" duration change ${_} > ${T}`),r.duration=T,this.updateSchedule())};p.on(I.LEVEL_UPDATED,(w,{details:S})=>m(S)),p.on(I.LEVEL_PTS_UPDATED,(w,{details:S})=>m(S)),p.on(I.EVENT_CUE_ENTER,()=>this.onInterstitialCueEnter());const v=(w,S)=>{const T=this.getAssetPlayer(d);if(T&&S.tracks){T.off(I.BUFFER_CODECS,v),T.tracks=S.tracks;const _=this.primaryMedia;this.bufferingAsset===T.assetItem&&_&&!T.media&&this.bufferAssetPlayer(T,_)}};p.on(I.BUFFER_CODECS,v);const y=()=>{var w;const S=this.getAssetPlayer(d);if(this.log(`buffered to end of asset ${S}`),!S||!this.schedule)return;const T=this.schedule.findEventIndex(e.identifier),_=(w=this.schedule.items)==null?void 0:w[T];this.isInterstitial(_)&&this.advanceAssetBuffering(_,r)};p.on(I.BUFFERED_TO_END,y);const b=w=>()=>{if(!this.getAssetPlayer(d)||!this.schedule)return;this.shouldPlay=!0;const T=this.schedule.findEventIndex(e.identifier);this.advanceAfterAssetEnded(e,T,w)};return p.once(I.MEDIA_ENDED,b(n)),p.once(I.PLAYOUT_LIMIT_REACHED,b(1/0)),p.on(I.ERROR,(w,S)=>{if(!this.schedule)return;const T=this.getAssetPlayer(d);if(S.details===V.BUFFER_STALLED_ERROR){if(T!=null&&T.appendInPlace){this.handleInPlaceStall(e);return}this.onTimeupdate(),this.checkBuffer(!0);return}this.handleAssetItemError(S,e,this.schedule.findEventIndex(e.identifier),n,`Asset player error ${S.error} ${e}`)}),p.on(I.DESTROYING,()=>{if(!this.getAssetPlayer(d)||!this.schedule)return;const S=new Error(`Asset player destroyed unexpectedly ${d}`),T={fatal:!0,type:fe.OTHER_ERROR,details:V.INTERSTITIAL_ASSET_ITEM_ERROR,error:S};this.handleAssetItemError(T,e,this.schedule.findEventIndex(e.identifier),n,S.message)}),this.log(`INTERSTITIAL_ASSET_PLAYER_CREATED ${El(r)}`),this.hls.trigger(I.INTERSTITIAL_ASSET_PLAYER_CREATED,{asset:r,assetListIndex:n,event:e,player:p}),p}clearInterstitial(e,r){this.clearAssetPlayers(e,r),e.reset()}clearAssetPlayers(e,r){e.assetList.forEach(n=>{this.clearAssetPlayer(n.identifier,r)})}resetAssetPlayer(e){const r=this.getAssetPlayerQueueIndex(e);if(r!==-1){this.log(`reset asset player "${e}" after error`);const n=this.playerQueue[r];this.transferMediaFromPlayer(n,null),n.resetDetails()}}clearAssetPlayer(e,r){const n=this.getAssetPlayerQueueIndex(e);if(n!==-1){const i=this.playerQueue[n];this.log(`clear ${i} toSegment: ${r&&Gn(r)}`),this.transferMediaFromPlayer(i,r),this.playerQueue.splice(n,1),i.destroy()}}emptyPlayerQueue(){let e;for(;e=this.playerQueue.pop();)e.destroy();this.playerQueue=[]}startAssetPlayer(e,r,n,i,s){const{interstitial:a,assetItem:o,assetId:l}=e,c=a.assetList.length,u=this.playingAsset;this.endedAsset=null,this.playingAsset=o,(!u||u.identifier!==l)&&(u&&(this.clearAssetPlayer(u.identifier,n[i]),delete u.error),this.log(`INTERSTITIAL_ASSET_STARTED ${r+1}/${c} ${El(o)}`),this.hls.trigger(I.INTERSTITIAL_ASSET_STARTED,{asset:o,assetListIndex:r,event:a,schedule:n.slice(0),scheduleIndex:i,player:e})),this.bufferAssetPlayer(e,s)}bufferAssetPlayer(e,r){var n,i;if(!this.schedule)return;const{interstitial:s,assetItem:a}=e,o=this.schedule.findEventIndex(s.identifier),l=(n=this.schedule.items)==null?void 0:n[o];if(!l)return;e.loadSource(),this.setBufferingItem(l),this.bufferingAsset=a;const c=this.getBufferingPlayer();if(c===e)return;const u=s.appendInPlace;if(u&&(c==null?void 0:c.interstitial.appendInPlace)===!1)return;const d=(c==null?void 0:c.tracks)||((i=this.detachedData)==null?void 0:i.tracks)||this.requiredTracks;if(u&&a!==this.playingAsset){if(!e.tracks){this.log(`Waiting for track info before buffering ${e}`);return}if(d&&!aj(d,e.tracks)){const f=new Error(`Asset ${El(a)} SourceBuffer tracks ('${Object.keys(e.tracks)}') are not compatible with primary content tracks ('${Object.keys(d)}')`),h={fatal:!0,type:fe.OTHER_ERROR,details:V.INTERSTITIAL_ASSET_ITEM_ERROR,error:f},p=s.findAssetIndex(a);this.handleAssetItemError(h,s,o,p,f.message);return}}this.transferMediaTo(e,r)}handleInPlaceStall(e){const r=this.schedule,n=this.primaryMedia;if(!r||!n)return;const i=n.currentTime,s=r.findAssetIndex(e,i),a=e.assetList[s];if(a){const o=this.getAssetPlayer(a.identifier);if(o){const l=o.currentTime||i-a.timelineStart,c=o.duration-l;if(this.warn(`Stalled at ${l} of ${l+c} in ${o} ${e} (media.currentTime: ${i})`),l&&(c/n.playbackRate<.5||o.bufferedInPlaceToEnd(n))&&o.hls){const u=r.findEventIndex(e.identifier);this.advanceAfterAssetEnded(e,u,s)}}}}advanceInPlace(e){const r=this.primaryMedia;r&&r.currentTime<e&&(r.currentTime=e)}handleAssetItemError(e,r,n,i,s){if(e.details===V.BUFFER_STALLED_ERROR)return;const a=r.assetList[i]||null;if(this.warn(`INTERSTITIAL_ASSET_ERROR ${a&&El(a)} ${e.error}`),!this.schedule)return;const o=(a==null?void 0:a.identifier)||"",l=this.getAssetPlayerQueueIndex(o),c=this.playerQueue[l]||null,u=this.schedule.items,d=et({},e,{fatal:!1,errorAction:Ql(!0),asset:a,assetListIndex:i,event:r,schedule:u,scheduleIndex:n,player:c});if(this.hls.trigger(I.INTERSTITIAL_ASSET_ERROR,d),!e.fatal)return;const f=this.playingAsset,h=this.bufferingAsset,p=new Error(s);if(a&&(this.clearAssetPlayer(o,null),a.error=p),!r.assetList.some(g=>!g.error))r.error=p;else for(let g=i;g<r.assetList.length;g++)this.resetAssetPlayer(r.assetList[g].identifier);this.updateSchedule(!0),r.error?this.primaryFallback(r):f&&f.identifier===o?this.advanceAfterAssetEnded(r,n,i):h&&h.identifier===o&&this.isInterstitial(this.bufferingItem)&&this.advanceAssetBuffering(this.bufferingItem,h)}primaryFallback(e){const r=e.timelineStart,n=this.effectivePlayingItem;let i=this.timelinePos;if(n){this.log(`Fallback to primary from event "${e.identifier}" start: ${r} pos: ${i} playing: ${Gn(n)} error: ${e.error}`),i===-1&&(i=this.hls.startPosition);const a=this.updateItem(n,i);this.itemsMatch(n,a)&&this.clearInterstitial(e,null),e.appendInPlace&&(this.attachPrimary(r,null),this.flushFrontBuffer(r))}else if(i===-1){this.checkStart();return}if(!this.schedule)return;const s=this.schedule.findItemIndexAtTime(i);this.setSchedulePosition(s)}onAssetListLoaded(e,r){var n,i;const s=r.event,a=s.identifier,o=r.assetListResponse.ASSETS;if(!((n=this.schedule)!=null&&n.hasEvent(a)))return;const l=s.timelineStart,c=s.duration;let u=0;o.forEach((g,m)=>{const v=parseFloat(g.DURATION);this.createAsset(s,m,u,l+u,v,g.URI),u+=v}),s.duration=u,this.log(`Loaded asset-list with duration: ${u} (was: ${c}) ${s}`);const d=this.waitingItem,f=(d==null?void 0:d.event.identifier)===a;this.updateSchedule();const h=(i=this.bufferingItem)==null?void 0:i.event;if(f){var p;const g=this.schedule.findEventIndex(a),m=(p=this.schedule.items)==null?void 0:p[g];if(m){if(!this.playingItem&&this.timelinePos>m.end&&this.schedule.findItemIndexAtTime(this.timelinePos)!==g){s.error=new Error(`Interstitial ${o.length?"no longer within playback range":"asset-list is empty"} ${this.timelinePos} ${s}`),this.log(s.error.message),this.updateSchedule(!0),this.primaryFallback(s);return}this.setBufferingItem(m)}this.setSchedulePosition(g)}else if((h==null?void 0:h.identifier)===a){const g=s.assetList[0];if(g){const m=this.getAssetPlayer(g.identifier);if(h.appendInPlace){const v=this.primaryMedia;m&&v&&this.bufferAssetPlayer(m,v)}else m&&m.loadSource()}}}onError(e,r){if(this.schedule)switch(r.details){case V.ASSET_LIST_PARSING_ERROR:case V.ASSET_LIST_LOAD_ERROR:case V.ASSET_LIST_LOAD_TIMEOUT:{const n=r.interstitial;n&&(this.updateSchedule(!0),this.primaryFallback(n));break}case V.BUFFER_STALLED_ERROR:{const n=this.endedItem||this.waitingItem||this.playingItem;if(this.isInterstitial(n)&&n.event.appendInPlace){this.handleInPlaceStall(n.event);return}this.log(`Primary player stall @${this.timelinePos} bufferedPos: ${this.bufferedPos}`),this.onTimeupdate(),this.checkBuffer(!0);break}}}}const zI=500;class wJ extends NT{constructor(e,r,n){super(e,r,n,"subtitle-stream-controller",oe.SUBTITLE),this.currentTrackId=-1,this.tracksBuffered=[],this.mainDetails=null,this.registerListeners()}onHandlerDestroying(){this.unregisterListeners(),super.onHandlerDestroying(),this.mainDetails=null}registerListeners(){super.registerListeners();const{hls:e}=this;e.on(I.LEVEL_LOADED,this.onLevelLoaded,this),e.on(I.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.on(I.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.on(I.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.on(I.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),e.on(I.BUFFER_FLUSHING,this.onBufferFlushing,this)}unregisterListeners(){super.unregisterListeners();const{hls:e}=this;e.off(I.LEVEL_LOADED,this.onLevelLoaded,this),e.off(I.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off(I.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.off(I.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.off(I.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),e.off(I.BUFFER_FLUSHING,this.onBufferFlushing,this)}startLoad(e,r){this.stopLoad(),this.state=Q.IDLE,this.setInterval(zI),this.nextLoadPosition=this.lastCurrentTime=e+this.timelineOffset,this.startPosition=r?-1:e,this.tick()}onManifestLoading(){super.onManifestLoading(),this.mainDetails=null}onMediaDetaching(e,r){this.tracksBuffered=[],super.onMediaDetaching(e,r)}onLevelLoaded(e,r){this.mainDetails=r.details}onSubtitleFragProcessed(e,r){const{frag:n,success:i}=r;if(this.fragContextChanged(n)||(Nt(n)&&(this.fragPrevious=n),this.state=Q.IDLE),!i)return;const s=this.tracksBuffered[this.currentTrackId];if(!s)return;let a;const o=n.start;for(let c=0;c<s.length;c++)if(o>=s[c].start&&o<=s[c].end){a=s[c];break}const l=n.start+n.duration;a?a.end=l:(a={start:o,end:l},s.push(a)),this.fragmentTracker.fragBuffered(n),this.fragBufferedComplete(n,null),this.media&&this.tick()}onBufferFlushing(e,r){const{startOffset:n,endOffset:i}=r;if(n===0&&i!==Number.POSITIVE_INFINITY){const s=i-1;if(s<=0)return;r.endOffsetSubtitles=Math.max(0,s),this.tracksBuffered.forEach(a=>{for(let o=0;o<a.length;){if(a[o].end<=s){a.shift();continue}else if(a[o].start<s)a[o].start=s;else break;o++}}),this.fragmentTracker.removeFragmentsInRange(n,s,oe.SUBTITLE)}}onError(e,r){const n=r.frag;(n==null?void 0:n.type)===oe.SUBTITLE&&(r.details===V.FRAG_GAP&&this.fragmentTracker.fragBuffered(n,!0),this.fragCurrent&&this.fragCurrent.abortRequests(),this.state!==Q.STOPPED&&(this.state=Q.IDLE))}onSubtitleTracksUpdated(e,{subtitleTracks:r}){if(this.levels&&c2(this.levels,r)){this.levels=r.map(n=>new tf(n));return}this.tracksBuffered=[],this.levels=r.map(n=>{const i=new tf(n);return this.tracksBuffered[i.id]=[],i}),this.fragmentTracker.removeFragmentsInRange(0,Number.POSITIVE_INFINITY,oe.SUBTITLE),this.fragPrevious=null,this.mediaBuffer=null}onSubtitleTrackSwitch(e,r){var n;if(this.currentTrackId=r.id,!((n=this.levels)!=null&&n.length)||this.currentTrackId===-1){this.clearInterval();return}const i=this.levels[this.currentTrackId];i!=null&&i.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,i&&this.state!==Q.STOPPED&&this.setInterval(zI)}onSubtitleTrackLoaded(e,r){var n;const{currentTrackId:i,levels:s}=this,{details:a,id:o}=r;if(!s){this.warn(`Subtitle tracks were reset while loading level ${o}`);return}const l=s[o];if(o>=s.length||!l)return;this.log(`Subtitle track ${o} loaded [${a.startSN},${a.endSN}]${a.lastPartSn?`[part-${a.lastPartSn}-${a.lastPartIndex}]`:""},duration:${a.totalduration}`),this.mediaBuffer=this.mediaBufferTimeRanges;let c=0;if(a.live||(n=l.details)!=null&&n.live){if(a.deltaUpdateFailed)return;const d=this.mainDetails;if(!d){this.startFragRequested=!1;return}const f=d.fragments[0];if(!l.details)a.hasProgramDateTime&&d.hasProgramDateTime?(Wm(a,d),c=a.fragmentStart):f&&(c=f.start,pw(a,c));else{var u;c=this.alignPlaylists(a,l.details,(u=this.levelLastLoaded)==null?void 0:u.details),c===0&&f&&(c=f.start,pw(a,c))}d&&!this.startFragRequested&&this.setStartPosition(d,c)}l.details=a,this.levelLastLoaded=l,o===i&&(this.hls.trigger(I.SUBTITLE_TRACK_UPDATED,{details:a,id:o,groupId:r.groupId}),this.tick(),a.live&&!this.fragCurrent&&this.media&&this.state===Q.IDLE&&(jo(null,a.fragments,this.media.currentTime,0)||(this.warn("Subtitle playlist not aligned with playback"),l.details=void 0)))}_handleFragmentLoadComplete(e){const{frag:r,payload:n}=e,i=r.decryptdata,s=this.hls;if(!this.fragContextChanged(r)&&n&&n.byteLength>0&&i!=null&&i.key&&i.iv&&Jl(i.method)){const a=performance.now();
vendor: 29,671 bytes, lines 278-289
278this.decrypter.decrypt(new Uint8Array(n),i.key.buffer,i.iv.buffer,LT(i.method)).catch(o=>{throw s.trigger(I.ERROR,{type:fe.MEDIA_ERROR,details:V.FRAG_DECRYPT_ERROR,fatal:!1,error:o,reason:o.message,frag:r}),o}).then(o=>{const l=performance.now();s.trigger(I.FRAG_DECRYPTED,{frag:r,payload:o,stats:{tstart:a,tdecrypt:l}})}).catch(o=>{this.warn(`${o.name}: ${o.message}`),this.state=Q.IDLE})}}doTick(){if(!this.media){this.state=Q.IDLE;return}if(this.state===Q.IDLE){const{currentTrackId:e,levels:r}=this,n=r==null?void 0:r[e];if(!n||!r.length||!n.details||this.waitForLive(n))return;const{config:i}=this,s=this.getLoadPosition(),a=Se.bufferedInfo(this.tracksBuffered[this.currentTrackId]||[],s,i.maxBufferHole),{end:o,len:l}=a,c=n.details,u=this.hls.maxBufferLength+c.levelTargetDuration;if(l>u)return;const d=c.fragments,f=d.length,h=c.edge;let p=null;const g=this.fragPrevious;if(o<h){const y=i.maxFragLookUpTolerance,b=o>h-y?0:y;p=jo(g,d,Math.max(d[0].start,o),b),!p&&g&&g.start<d[0].start&&(p=d[0])}else p=d[f-1];if(p=this.filterReplacedPrimary(p,n.details),!p)return;const m=p.sn-c.startSN,v=d[m-1];if(v&&v.cc===p.cc&&this.fragmentTracker.getState(v)===qt.NOT_LOADED&&(p=v),this.fragmentTracker.getState(p)===qt.NOT_LOADED){const y=this.mapToInitFragWhenRequired(p);y&&this.loadFragment(y,n,o)}}}loadFragment(e,r,n){Nt(e)?super.loadFragment(e,r,n):this._loadInitSegment(e,r)}get mediaBufferTimeRanges(){return new SJ(this.tracksBuffered[this.currentTrackId]||[])}}class SJ{constructor(e){this.buffered=void 0;const r=(n,i,s)=>{if(i=i>>>0,i>s-1)throw new DOMException(`Failed to execute '${n}' on 'TimeRanges': The index provided (${i}) is greater than the maximum bound (${s})`);return e[i][n]};this.buffered={get length(){return e.length},end(n){return r("end",n,e.length)},start(n){return r("start",n,e.length)}}}}const EJ={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,128:174,129:176,130:189,131:191,132:8482,133:162,134:163,135:9834,136:224,137:32,138:232,139:226,140:234,141:238,142:244,143:251,144:193,145:201,146:211,147:218,148:220,149:252,150:8216,151:161,152:42,153:8217,154:9473,155:169,156:8480,157:8226,158:8220,159:8221,160:192,161:194,162:199,163:200,164:202,165:203,166:235,167:206,168:207,169:239,170:212,171:217,172:249,173:219,174:171,175:187,176:195,177:227,178:205,179:204,180:236,181:210,182:242,183:213,184:245,185:123,186:125,187:92,188:94,189:95,190:124,191:8764,192:196,193:228,194:214,195:246,196:223,197:165,198:164,199:9475,200:197,201:229,202:216,203:248,204:9487,205:9491,206:9495,207:9499},_2=t=>String.fromCharCode(EJ[t]||t),Hn=15,Xi=100,TJ={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},_J={17:2,18:4,21:6,22:8,23:10,19:13,20:15},AJ={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},PJ={25:2,26:4,29:6,30:8,31:10,27:13,28:15},IJ=["white","green","blue","cyan","red","yellow","magenta","black","transparent"];class CJ{constructor(){this.time=null,this.verboseLevel=0}log(e,r){if(this.verboseLevel>=e){const n=typeof r=="function"?r():r;qe.log(`${this.time} [${e}] ${n}`)}}}const za=function(e){const r=[];for(let n=0;n<e.length;n++)r.push(e[n].toString(16));return r};class A2{constructor(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1}reset(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1}setStyles(e){const r=["foreground","underline","italics","background","flash"];for(let n=0;n<r.length;n++){const i=r[n];e.hasOwnProperty(i)&&(this[i]=e[i])}}isDefault(){return this.foreground==="white"&&!this.underline&&!this.italics&&this.background==="black"&&!this.flash}equals(e){return this.foreground===e.foreground&&this.underline===e.underline&&this.italics===e.italics&&this.background===e.background&&this.flash===e.flash}copy(e){this.foreground=e.foreground,this.underline=e.underline,this.italics=e.italics,this.background=e.background,this.flash=e.flash}toString(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash}}class OJ{constructor(){this.uchar=" ",this.penState=new A2}reset(){this.uchar=" ",this.penState.reset()}setChar(e,r){this.uchar=e,this.penState.copy(r)}setPenState(e){this.penState.copy(e)}equals(e){return this.uchar===e.uchar&&this.penState.equals(e.penState)}copy(e){this.uchar=e.uchar,this.penState.copy(e.penState)}isEmpty(){return this.uchar===" "&&this.penState.isDefault()}}let RJ=class{constructor(e){this.chars=[],this.pos=0,this.currPenState=new A2,this.cueStartTime=null,this.logger=void 0;for(let r=0;r<Xi;r++)this.chars.push(new OJ);this.logger=e}equals(e){for(let r=0;r<Xi;r++)if(!this.chars[r].equals(e.chars[r]))return!1;return!0}copy(e){for(let r=0;r<Xi;r++)this.chars[r].copy(e.chars[r])}isEmpty(){let e=!0;for(let r=0;r<Xi;r++)if(!this.chars[r].isEmpty()){e=!1;break}return e}setCursor(e){this.pos!==e&&(this.pos=e),this.pos<0?(this.logger.log(3,"Negative cursor position "+this.pos),this.pos=0):this.pos>Xi&&(this.logger.log(3,"Too large cursor position "+this.pos),this.pos=Xi)}moveCursor(e){const r=this.pos+e;if(e>1)for(let n=this.pos+1;n<r+1;n++)this.chars[n].setPenState(this.currPenState);this.setCursor(r)}backSpace(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)}insertChar(e){e>=144&&this.backSpace();const r=_2(e);if(this.pos>=Xi){this.logger.log(0,()=>"Cannot insert "+e.toString(16)+" ("+r+") at position "+this.pos+". Skipping it!");return}this.chars[this.pos].setChar(r,this.currPenState),this.moveCursor(1)}clearFromPos(e){let r;for(r=e;r<Xi;r++)this.chars[r].reset()}clear(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()}clearToEndOfRow(){this.clearFromPos(this.pos)}getTextString(){const e=[];let r=!0;for(let n=0;n<Xi;n++){const i=this.chars[n].uchar;i!==" "&&(r=!1),e.push(i)}return r?"":e.join("")}setPenStyles(e){this.currPenState.setStyles(e),this.chars[this.pos].setPenState(this.currPenState)}};class M0{constructor(e){this.rows=[],this.currRow=Hn-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.logger=void 0;for(let r=0;r<Hn;r++)this.rows.push(new RJ(e));this.logger=e}reset(){for(let e=0;e<Hn;e++)this.rows[e].clear();this.currRow=Hn-1}equals(e){let r=!0;for(let n=0;n<Hn;n++)if(!this.rows[n].equals(e.rows[n])){r=!1;break}return r}copy(e){for(let r=0;r<Hn;r++)this.rows[r].copy(e.rows[r])}isEmpty(){let e=!0;for(let r=0;r<Hn;r++)if(!this.rows[r].isEmpty()){e=!1;break}return e}backSpace(){this.rows[this.currRow].backSpace()}clearToEndOfRow(){this.rows[this.currRow].clearToEndOfRow()}insertChar(e){this.rows[this.currRow].insertChar(e)}setPen(e){this.rows[this.currRow].setPenStyles(e)}moveCursor(e){this.rows[this.currRow].moveCursor(e)}setCursor(e){this.logger.log(2,"setCursor: "+e),this.rows[this.currRow].setCursor(e)}setPAC(e){this.logger.log(2,()=>"pacData = "+it(e));let r=e.row-1;if(this.nrRollUpRows&&r<this.nrRollUpRows-1&&(r=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==r){for(let o=0;o<Hn;o++)this.rows[o].clear();const s=this.currRow+1-this.nrRollUpRows,a=this.lastOutputScreen;if(a){const o=a.rows[s].cueStartTime,l=this.logger.time;if(o!==null&&l!==null&&o<l)for(let c=0;c<this.nrRollUpRows;c++)this.rows[r-this.nrRollUpRows+c+1].copy(a.rows[s+c])}}this.currRow=r;const n=this.rows[this.currRow];if(e.indent!==null){const s=e.indent,a=Math.max(s-1,0);n.setCursor(e.indent),e.color=n.chars[a].penState.foreground}const i={foreground:e.color,underline:e.underline,italics:e.italics,background:"black",flash:!1};this.setPen(i)}setBkgData(e){this.logger.log(2,()=>"bkgData = "+it(e)),this.backSpace(),this.setPen(e),this.insertChar(32)}setRollUpRows(e){this.nrRollUpRows=e}rollUp(){if(this.nrRollUpRows===null){this.logger.log(3,"roll_up but nrRollUpRows not set yet");return}this.logger.log(1,()=>this.getDisplayText());const e=this.currRow+1-this.nrRollUpRows,r=this.rows.splice(e,1)[0];r.clear(),this.rows.splice(this.currRow,0,r),this.logger.log(2,"Rolling up")}getDisplayText(e){e=e||!1;const r=[];let n="",i=-1;for(let s=0;s<Hn;s++){const a=this.rows[s].getTextString();a&&(i=s+1,e?r.push("Row "+i+": '"+a+"'"):r.push(a.trim()))}return r.length>0&&(e?n="["+r.join(" | ")+"]":n=r.join(`
279`)),n}getTextAndFormat(){return this.rows}}class qI{constructor(e,r,n){this.chNr=void 0,this.outputFilter=void 0,this.mode=void 0,this.verbose=void 0,this.displayedMemory=void 0,this.nonDisplayedMemory=void 0,this.lastOutputScreen=void 0,this.currRollUpRow=void 0,this.writeScreen=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chNr=e,this.outputFilter=r,this.mode=null,this.verbose=0,this.displayedMemory=new M0(n),this.nonDisplayedMemory=new M0(n),this.lastOutputScreen=new M0(n),this.currRollUpRow=this.displayedMemory.rows[Hn-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=n}reset(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[Hn-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null}getHandler(){return this.outputFilter}setHandler(e){this.outputFilter=e}setPAC(e){this.writeScreen.setPAC(e)}setBkgData(e){this.writeScreen.setBkgData(e)}setMode(e){e!==this.mode&&(this.mode=e,this.logger.log(2,()=>"MODE="+e),this.mode==="MODE_POP-ON"?this.writeScreen=this.nonDisplayedMemory:(this.writeScreen=this.displayedMemory,this.writeScreen.reset()),this.mode!=="MODE_ROLL-UP"&&(this.displayedMemory.nrRollUpRows=null,this.nonDisplayedMemory.nrRollUpRows=null),this.mode=e)}insertChars(e){for(let n=0;n<e.length;n++)this.writeScreen.insertChar(e[n]);const r=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(2,()=>r+": "+this.writeScreen.getDisplayText(!0)),(this.mode==="MODE_PAINT-ON"||this.mode==="MODE_ROLL-UP")&&(this.logger.log(1,()=>"DISPLAYED: "+this.displayedMemory.getDisplayText(!0)),this.outputDataUpdate())}ccRCL(){this.logger.log(2,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")}ccBS(){this.logger.log(2,"BS - BackSpace"),this.mode!=="MODE_TEXT"&&(this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate())}ccAOF(){}ccAON(){}ccDER(){this.logger.log(2,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()}ccRU(e){this.logger.log(2,"RU("+e+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(e)}ccFON(){this.logger.log(2,"FON - Flash On"),this.writeScreen.setPen({flash:!0})}ccRDC(){this.logger.log(2,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")}ccTR(){this.logger.log(2,"TR"),this.setMode("MODE_TEXT")}ccRTD(){this.logger.log(2,"RTD"),this.setMode("MODE_TEXT")}ccEDM(){this.logger.log(2,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)}ccCR(){this.logger.log(2,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)}ccENM(){this.logger.log(2,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()}ccEOC(){if(this.logger.log(2,"EOC - End Of Caption"),this.mode==="MODE_POP-ON"){const e=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=e,this.writeScreen=this.nonDisplayedMemory,this.logger.log(1,()=>"DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate(!0)}ccTO(e){this.logger.log(2,"TO("+e+") - Tab Offset"),this.writeScreen.moveCursor(e)}ccMIDROW(e){const r={flash:!1};if(r.underline=e%2===1,r.italics=e>=46,r.italics)r.foreground="white";else{const n=Math.floor(e/2)-16,i=["white","green","blue","cyan","red","yellow","magenta"];r.foreground=i[n]}this.logger.log(2,"MIDROW: "+it(r)),this.writeScreen.setPen(r)}outputDataUpdate(e=!1){const r=this.logger.time;r!==null&&this.outputFilter&&(this.cueStartTime===null&&!this.displayedMemory.isEmpty()?this.cueStartTime=r:this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,r,this.lastOutputScreen),e&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:r),this.lastOutputScreen.copy(this.displayedMemory))}cueSplitAtTime(e){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,e,this.displayedMemory),this.cueStartTime=e))}}class YI{constructor(e,r,n){this.channels=void 0,this.currentChannel=0,this.cmdHistory=LJ(),this.logger=void 0;const i=this.logger=new CJ;this.channels=[null,new qI(e,r,i),new qI(e+1,n,i)]}getHandler(e){return this.channels[e].getHandler()}setHandler(e,r){this.channels[e].setHandler(r)}addData(e,r){this.logger.time=e;for(let n=0;n<r.length;n+=2){const i=r[n]&127,s=r[n+1]&127;let a=!1,o=null;if(i===0&&s===0)continue;this.logger.log(3,()=>"["+za([r[n],r[n+1]])+"] -> ("+za([i,s])+")");const l=this.cmdHistory;if(i>=16&&i<=31){if(kJ(i,s,l)){np(null,null,l),this.logger.log(3,()=>"Repeated command ("+za([i,s])+") is dropped");continue}np(i,s,this.cmdHistory),a=this.parseCmd(i,s),a||(a=this.parseMidrow(i,s)),a||(a=this.parsePAC(i,s)),a||(a=this.parseBackgroundAttributes(i,s))}else np(null,null,l);if(!a&&(o=this.parseChars(i,s),o)){const u=this.currentChannel;u&&u>0?this.channels[u].insertChars(o):this.logger.log(2,"No channel found yet. TEXT-MODE?")}!a&&!o&&this.logger.log(2,()=>"Couldn't parse cleaned data "+za([i,s])+" orig: "+za([r[n],r[n+1]]))}}parseCmd(e,r){const n=(e===20||e===28||e===21||e===29)&&r>=32&&r<=47,i=(e===23||e===31)&&r>=33&&r<=35;if(!(n||i))return!1;const s=e===20||e===21||e===23?1:2,a=this.channels[s];return e===20||e===21||e===28||e===29?r===32?a.ccRCL():r===33?a.ccBS():r===34?a.ccAOF():r===35?a.ccAON():r===36?a.ccDER():r===37?a.ccRU(2):r===38?a.ccRU(3):r===39?a.ccRU(4):r===40?a.ccFON():r===41?a.ccRDC():r===42?a.ccTR():r===43?a.ccRTD():r===44?a.ccEDM():r===45?a.ccCR():r===46?a.ccENM():r===47&&a.ccEOC():a.ccTO(r-32),this.currentChannel=s,!0}parseMidrow(e,r){let n=0;if((e===17||e===25)&&r>=32&&r<=47){if(e===17?n=1:n=2,n!==this.currentChannel)return this.logger.log(0,"Mismatch channel in midrow parsing"),!1;const i=this.channels[n];return i?(i.ccMIDROW(r),this.logger.log(3,()=>"MIDROW ("+za([e,r])+")"),!0):!1}return!1}parsePAC(e,r){let n;const i=(e>=17&&e<=23||e>=25&&e<=31)&&r>=64&&r<=127,s=(e===16||e===24)&&r>=64&&r<=95;if(!(i||s))return!1;const a=e<=23?1:2;r>=64&&r<=95?n=a===1?TJ[e]:AJ[e]:n=a===1?_J[e]:PJ[e];const o=this.channels[a];return o?(o.setPAC(this.interpretPAC(n,r)),this.currentChannel=a,!0):!1}interpretPAC(e,r){let n;const i={color:null,italics:!1,indent:null,underline:!1,row:e};return r>95?n=r-96:n=r-64,i.underline=(n&1)===1,n<=13?i.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(n/2)]:n<=15?(i.italics=!0,i.color="white"):i.indent=Math.floor((n-16)/2)*4,i}parseChars(e,r){let n,i=null,s=null;if(e>=25?(n=2,s=e-8):(n=1,s=e),s>=17&&s<=19){let a;s===17?a=r+80:s===18?a=r+112:a=r+144,this.logger.log(2,()=>"Special char '"+_2(a)+"' in channel "+n),i=[a]}else e>=32&&e<=127&&(i=r===0?[e]:[e,r]);return i&&this.logger.log(3,()=>"Char codes =  "+za(i).join(",")),i}parseBackgroundAttributes(e,r){const n=(e===16||e===24)&&r>=32&&r<=47,i=(e===23||e===31)&&r>=45&&r<=47;if(!(n||i))return!1;let s;const a={};e===16||e===24?(s=Math.floor((r-32)/2),a.background=IJ[s],r%2===1&&(a.background=a.background+"_semi")):r===45?a.background="transparent":(a.foreground="black",r===47&&(a.underline=!0));const o=e<=23?1:2;return this.channels[o].setBkgData(a),!0}reset(){for(let e=0;e<Object.keys(this.channels).length;e++){const r=this.channels[e];r&&r.reset()}np(null,null,this.cmdHistory)}cueSplitAtTime(e){for(let r=0;r<this.channels.length;r++){const n=this.channels[r];n&&n.cueSplitAtTime(e)}}}function np(t,e,r){r.a=t,r.b=e}function kJ(t,e,r){return r.a===t&&r.b===e}function LJ(){return{a:null,b:null}}var zT=function(){if(Gm!=null&&Gm.VTTCue)return self.VTTCue;const t=["","lr","rl"],e=["start","middle","end","left","right"];function r(o,l){if(typeof l!="string"||!Array.isArray(o))return!1;const c=l.toLowerCase();return~o.indexOf(c)?c:!1}function n(o){return r(t,o)}function i(o){return r(e,o)}function s(o,...l){let c=1;for(;c<arguments.length;c++){const u=arguments[c];for(const d in u)o[d]=u[d]}return o}function a(o,l,c){const u=this,d={enumerable:!0};u.hasBeenReset=!1;let f="",h=!1,p=o,g=l,m=c,v=null,y="",b=!0,w="auto",S="start",T=50,_="middle",A=50,P="middle";Object.defineProperty(u,"id",s({},d,{get:function(){return f},set:function(C){f=""+C}})),Object.defineProperty(u,"pauseOnExit",s({},d,{get:function(){return h},set:function(C){h=!!C}})),Object.defineProperty(u,"startTime",s({},d,{get:function(){return p},set:function(C){if(typeof C!="number")throw new TypeError("Start time must be set to a number.");p=C,this.hasBeenReset=!0}})),Object.defineProperty(u,"endTime",s({},d,{get:function(){return g},set:function(C){if(typeof C!="number")throw new TypeError("End time must be set to a number.");g=C,this.hasBeenReset=!0}})),Object.defineProperty(u,"text",s({},d,{get:function(){return m},set:function(C){m=""+C,this.hasBeenReset=!0}})),Object.defineProperty(u,"region",s({},d,{get:function(){return v},set:function(C){v=C,this.hasBeenReset=!0}})),Object.defineProperty(u,"vertical",s({},d,{get:function(){return y},set:function(C){const O=n(C);if(O===!1)throw new SyntaxError("An invalid or illegal string was specified.");y=O,this.hasBeenReset=!0}})),Object.defineProperty(u,"snapToLines",s({},d,{get:function(){return b},set:function(C){b=!!C,this.hasBeenReset=!0}})),Object.defineProperty(u,"line",s({},d,{get:function(){return w},set:function(C){if(typeof C!="number"&&C!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");w=C,this.hasBeenReset=!0}})),Object.defineProperty(u,"lineAlign",s({},d,{get:function(){return S},set:function(C){const O=i(C);if(!O)throw new SyntaxError("An invalid or illegal string was specified.");S=O,this.hasBeenReset=!0}})),Object.defineProperty(u,"position",s({},d,{get:function(){return T},set:function(C){if(C<0||C>100)throw new Error("Position must be between 0 and 100.");T=C,this.hasBeenReset=!0}})),Object.defineProperty(u,"positionAlign",s({},d,{get:function(){return _},set:function(C){const O=i(C);if(!O)throw new SyntaxError("An invalid or illegal string was specified.");_=O,this.hasBeenReset=!0}})),Object.defineProperty(u,"size",s({},d,{get:function(){return A},set:function(C){if(C<0||C>100)throw new Error("Size must be between 0 and 100.");A=C,this.hasBeenReset=!0}})),Object.defineProperty(u,"align",s({},d,{get:function(){return P},set:function(C){const O=i(C);if(!O)throw new SyntaxError("An invalid or illegal string was specified.");P=O,this.hasBeenReset=!0}})),u.displayState=void 0}return a.prototype.getCueAsHTML=function(){return self.WebVTT.convertCueToDOMTree(self,this.text)},a}();class DJ{decode(e,r){if(!e)return"";if(typeof e!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(e))}}function P2(t){function e(n,i,s,a){return(n|0)*3600+(i|0)*60+(s|0)+parseFloat(a||0)}const r=t.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return r?parseFloat(r[2])>59?e(r[2],r[3],0,r[4]):e(r[1],r[2],r[3],r[4]):null}class NJ{constructor(){this.values=Object.create(null)}set(e,r){!this.get(e)&&r!==""&&(this.values[e]=r)}get(e,r,n){return n?this.has(e)?this.values[e]:r[n]:this.has(e)?this.values[e]:r}has(e){return e in this.values}alt(e,r,n){for(let i=0;i<n.length;++i)if(r===n[i]){this.set(e,r);break}}integer(e,r){/^-?\d+$/.test(r)&&this.set(e,parseInt(r,10))}percent(e,r){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(r)){const n=parseFloat(r);if(n>=0&&n<=100)return this.set(e,n),!0}return!1}}function I2(t,e,r,n){const i=n?t.split(n):[t];for(const s in i){if(typeof i[s]!="string")continue;const a=i[s].split(r);if(a.length!==2)continue;const o=a[0],l=a[1];e(o,l)}}const Sw=new zT(0,0,""),ip=Sw.align==="middle"?"middle":"center";function MJ(t,e,r){const n=t;function i(){const o=P2(t);if(o===null)throw new Error("Malformed timestamp: "+n);return t=t.replace(/^[^\sa-zA-Z-]+/,""),o}function s(o,l){const c=new NJ;I2(o,function(f,h){let p;switch(f){case"region":for(let g=r.length-1;g>=0;g--)if(r[g].id===h){c.set(f,r[g].region);break}break;case"vertical":c.alt(f,h,["rl","lr"]);break;case"line":p=h.split(","),c.integer(f,p[0]),c.percent(f,p[0])&&c.set("snapToLines",!1),c.alt(f,p[0],["auto"]),p.length===2&&c.alt("lineAlign",p[1],["start",ip,"end"]);break;case"position":p=h.split(","),c.percent(f,p[0]),p.length===2&&c.alt("positionAlign",p[1],["start",ip,"end","line-left","line-right","auto"]);break;case"size":c.percent(f,h);break;case"align":c.alt(f,h,["start",ip,"end","left","right"]);break}},/:/,/\s/),l.region=c.get("region",null),l.vertical=c.get("vertical","");let u=c.get("line","auto");u==="auto"&&Sw.line===-1&&(u=-1),l.line=u,l.lineAlign=c.get("lineAlign","start"),l.snapToLines=c.get("snapToLines",!0),l.size=c.get("size",100),l.align=c.get("align",ip);let d=c.get("position","auto");d==="auto"&&Sw.position===50&&(d=l.align==="start"||l.align==="left"?0:l.align==="end"||l.align==="right"?100:50),l.position=d}function a(){t=t.replace(/^\s+/,"")}if(a(),e.startTime=i(),a(),t.slice(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+n);t=t.slice(3),a(),e.endTime=i(),a(),s(t,e)}function C2(t){return t.replace(/<br(?: \/)?>/gi,`
280`)}class $J{constructor(){this.state="INITIAL",this.buffer="",this.decoder=new DJ,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}parse(e){const r=this;e&&(r.buffer+=r.decoder.decode(e,{stream:!0}));function n(){let s=r.buffer,a=0;for(s=C2(s);a<s.length&&s[a]!=="\r"&&s[a]!==`
281`;)++a;const o=s.slice(0,a);return s[a]==="\r"&&++a,s[a]===`
282`&&++a,r.buffer=s.slice(a),o}function i(s){I2(s,function(a,o){},/:/)}try{let s="";if(r.state==="INITIAL"){if(!/\r\n|\n/.test(r.buffer))return this;s=n();const o=s.match(/^()?WEBVTT([ \t].*)?$/);if(!(o!=null&&o[0]))throw new Error("Malformed WebVTT signature.");r.state="HEADER"}let a=!1;for(;r.buffer;){if(!/\r\n|\n/.test(r.buffer))return this;switch(a?a=!1:s=n(),r.state){case"HEADER":/:/.test(s)?i(s):s||(r.state="ID");continue;case"NOTE":s||(r.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(s)){r.state="NOTE";break}if(!s)continue;if(r.cue=new zT(0,0,""),r.state="CUE",s.indexOf("-->")===-1){r.cue.id=s;continue}case"CUE":if(!r.cue){r.state="BADCUE";continue}try{MJ(s,r.cue,r.regionList)}catch{r.cue=null,r.state="BADCUE";continue}r.state="CUETEXT";continue;case"CUETEXT":{const o=s.indexOf("-->")!==-1;if(!s||o&&(a=!0)){r.oncue&&r.cue&&r.oncue(r.cue),r.cue=null,r.state="ID";continue}if(r.cue===null)continue;r.cue.text&&(r.cue.text+=`
283`),r.cue.text+=s}continue;case"BADCUE":s||(r.state="ID")}}}catch{r.state==="CUETEXT"&&r.cue&&r.oncue&&r.oncue(r.cue),r.cue=null,r.state=r.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this}flush(){const e=this;try{if((e.cue||e.state==="HEADER")&&(e.buffer+=`
284
285`,e.parse()),e.state==="INITIAL"||e.state==="BADWEBVTT")throw new Error("Malformed WebVTT signature.")}catch(r){e.onparsingerror&&e.onparsingerror(r)}return e.onflush&&e.onflush(),this}}const jJ=/\r\n|\n\r|\n|\r/g,$0=function(e,r,n=0){return e.slice(n,n+r.length)===r},FJ=function(e){let r=parseInt(e.slice(-3));const n=parseInt(e.slice(-6,-4)),i=parseInt(e.slice(-9,-7)),s=e.length>9?parseInt(e.substring(0,e.indexOf(":"))):0;if(!se(r)||!se(n)||!se(i)||!se(s))throw Error(`Malformed X-TIMESTAMP-MAP: Local:${e}`);return r+=1e3*n,r+=60*1e3*i,r+=60*60*1e3*s,r};function qT(t,e,r){return vd(t.toString())+vd(e.toString())+vd(r)}const BJ=function(e,r,n){let i=e[r],s=e[i.prevCC];if(!s||!s.new&&i.new){e.ccOffset=e.presentationOffset=i.start,i.new=!1;return}for(;(a=s)!=null&&a.new;){var a;e.ccOffset+=i.start-s.start,i.new=!1,i=s,s=e[i.prevCC]}e.presentationOffset=n};function UJ(t,e,r,n,i,s,a){const o=new $J,l=hn(new Uint8Array(t)).trim().replace(jJ,`
286`).split(`
287`),c=[],u=e?zX(e.baseTime,e.timescale):0;let d="00:00.000",f=0,h=0,p,g=!0;o.oncue=function(m){const v=r[n];let y=r.ccOffset;const b=(f-u)/9e4;if(v!=null&&v.new&&(h!==void 0?y=r.ccOffset=v.start:BJ(r,n,b)),b){if(!e){p=new Error("Missing initPTS for VTT MPEGTS");return}y=b-r.presentationOffset}const w=m.endTime-m.startTime,S=en((m.startTime+y-h)*9e4,i*9e4)/9e4;m.startTime=Math.max(S,0),m.endTime=Math.max(S+w,0);const T=m.text.trim();m.text=decodeURIComponent(encodeURIComponent(T)),m.id||(m.id=qT(m.startTime,m.endTime,T)),m.endTime>0&&c.push(m)},o.onparsingerror=function(m){p=m},o.onflush=function(){if(p){a(p);return}s(c)},l.forEach(m=>{if(g)if($0(m,"X-TIMESTAMP-MAP=")){g=!1,m.slice(16).split(",").forEach(v=>{$0(v,"LOCAL:")?d=v.slice(6):$0(v,"MPEGTS:")&&(f=parseInt(v.slice(7)))});try{h=FJ(d)/1e3}catch(v){p=v}return}else m===""&&(g=!1);o.parse(m+`
288`)}),o.flush()}const j0="stpp.ttml.im1t",O2=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,R2=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,GJ={left:"start",center:"center",right:"end",start:"start",end:"end"};function XI(t,e,r,n){const i=Ie(new Uint8Array(t),["mdat"]);if(i.length===0){n(new Error("Could not parse IMSC1 mdat"));return}const s=i.map(o=>hn(o)),a=KX(e.baseTime,1,e.timescale);try{s.forEach(o=>r(WJ(o,a)))}catch(o){n(o)}}function WJ(t,e){const i=new DOMParser().parseFromString(t,"text/xml").getElementsByTagName("tt")[0];if(!i)throw new Error("Invalid ttml");const s={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},a=Object.keys(s).reduce((d,f)=>(d[f]=i.getAttribute(`ttp:${f}`)||s[f],d),{}),o=i.getAttribute("xml:space")!=="preserve",l=QI(F0(i,"styling","style")),c=QI(F0(i,"layout","region")),u=F0(i,"body","[begin]");return[].map.call(u,d=>{const f=k2(d,o);if(!f||!d.hasAttribute("begin"))return null;const h=U0(d.getAttribute("begin"),a),p=U0(d.getAttribute("dur"),a);let g=U0(d.getAttribute("end"),a);if(h===null)throw JI(d);if(g===null){if(p===null)throw JI(d);g=h+p}const m=new zT(h-e,g-e,f);m.id=qT(m.startTime,m.endTime,m.text);const v=c[d.getAttribute("region")],y=l[d.getAttribute("style")],b=VJ(v,y,l),{textAlign:w}=b;if(w){const S=GJ[w];S&&(m.lineAlign=S),m.align=w}return et(m,b),m}).filter(d=>d!==null)}function F0(t,e,r){const n=t.getElementsByTagName(e)[0];return n?[].slice.call(n.querySelectorAll(r)):[]}function QI(t){return t.reduce((e,r)=>{const n=r.getAttribute("xml:id");return n&&(e[n]=r),e},{})}function k2(t,e){return[].slice.call(t.childNodes).reduce((r,n,i)=>{var s;return n.nodeName==="br"&&i?r+`
289`:(s=n.childNodes)!=null&&s.length?k2(n,e):e?r+n.textContent.trim().replace(/\s+/g," "):r+n.textContent},"")}function VJ(t,e,r){const n="http://www.w3.org/ns/ttml#styling";let i=null;const s=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"],a=t!=null&&t.hasAttribute("style")?t.getAttribute("style"):null;return a&&r.hasOwnProperty(a)&&(i=r[a]),s.reduce((o,l)=>{const c=B0(e,n,l)||B0(t,n,l)||B0(i,n,l);return c&&(o[l]=c),o},{})}function B0(t,e,r){return t&&t.hasAttributeNS(e,r)?t.getAttributeNS(e,r):null}function JI(t){return new Error(`Could not parse ttml timestamp ${t}`)}function U0(t,e){if(!t)return null;let r=P2(t);return r===null&&(O2.test(t)?r=HJ(t,e):R2.test(t)&&(r=KJ(t,e))),r}function HJ(t,e){const r=O2.exec(t),n=(r[4]|0)+(r[5]|0)/e.subFrameRate;return(r[1]|0)*3600+(r[2]|0)*60+(r[3]|0)+n/e.frameRate}function KJ(t,e){const r=R2.exec(t),n=Number(r[1]);switch(r[2]){case"h":return n*3600;case"m":return n*60;case"ms":return n*1e3;case"f":return n/e.frameRate;case"t":return n/e.tickRate}return n}class sp{constructor(e,r){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=e,this.trackName=r}dispatchCue(){this.startTime!==null&&(this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null)}newCue(e,r,n){(this.startTime===null||this.startTime>e)&&(this.startTime=e),this.endTime=r,this.screen=n,this.timelineController.createCaptionsTrack(this.trackName)}reset(){this.cueRanges=[],this.startTime=null}}class zJ{constructor(e){this.hls=void 0,this.media=null,this.config=void 0,this.enabled=!0,this.Cues=void 0,this.textTracks=[],this.tracks=[],this.initPTS=[],this.unparsedVttFrags=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.cea608Parser1=void 0,this.cea608Parser2=void 0,this.lastCc=-1,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=eC(),this.captionsProperties=void 0,this.hls=e,this.config=e.config,this.Cues=e.config.cueHandler,this.captionsProperties={textTrack1:{label:this.config.captionsTextTrack1Label,languageCode:this.config.captionsTextTrack1LanguageCode},textTrack2:{label:this.config.captionsTextTrack2Label,languageCode:this.config.captionsTextTrack2LanguageCode},textTrack3:{label:this.config.captionsTextTrack3Label,languageCode:this.config.captionsTextTrack3LanguageCode},textTrack4:{label:this.config.captionsTextTrack4Label,languageCode:this.config.captionsTextTrack4LanguageCode}},e.on(I.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(I.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(I.MANIFEST_LOADING,this.onManifestLoading,this),e.on(I.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(I.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.on(I.FRAG_LOADING,this.onFragLoading,this),e.on(I.FRAG_LOADED,this.onFragLoaded,this),e.on(I.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.on(I.FRAG_DECRYPTED,this.onFragDecrypted,this),e.on(I.INIT_PTS_FOUND,this.onInitPtsFound,this),e.on(I.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.on(I.BUFFER_FLUSHING,this.onBufferFlushing,this)}destroy(){const{hls:e}=this;
vendor: 2,927 bytes, line 289
289e.off(I.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(I.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(I.MANIFEST_LOADING,this.onManifestLoading,this),e.off(I.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(I.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off(I.FRAG_LOADING,this.onFragLoading,this),e.off(I.FRAG_LOADED,this.onFragLoaded,this),e.off(I.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.off(I.FRAG_DECRYPTED,this.onFragDecrypted,this),e.off(I.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(I.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.off(I.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.media=null,this.cea608Parser1=this.cea608Parser2=void 0}initCea608Parsers(){const e=new sp(this,"textTrack1"),r=new sp(this,"textTrack2"),n=new sp(this,"textTrack3"),i=new sp(this,"textTrack4");this.cea608Parser1=new YI(1,e,r),this.cea608Parser2=new YI(3,n,i)}addCues(e,r,n,i,s){let a=!1;for(let o=s.length;o--;){const l=s[o],c=qJ(l[0],l[1],r,n);if(c>=0&&(l[0]=Math.min(l[0],r),l[1]=Math.max(l[1],n),a=!0,c/(n-r)>.5))return}if(a||s.push([r,n]),this.config.renderTextTracksNatively){const o=this.captionsTracks[e];this.Cues.newCue(o,r,n,i)}else{const o=this.Cues.newCue(null,r,n,i);this.hls.trigger(I.CUES_PARSED,{type:"captions",cues:o,track:e})}}onInitPtsFound(e,{frag:r,id:n,initPTS:i,timescale:s,trackId:a}){const{unparsedVttFrags:o}=this;n===oe.MAIN&&(this.initPTS[r.cc]={baseTime:i,timescale:s,trackId:a}),o.length&&(this.unparsedVttFrags=[],o.forEach(l=>{this.initPTS[l.frag.cc]?this.onFragLoaded(I.FRAG_LOADED,l):this.hls.trigger(I.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:l.frag,error:new Error("Subtitle discontinuity domain does not match main")})}))}getExistingTrack(e,r){const{media:n}=this;if(n)for(let i=0;i<n.textTracks.length;i++){const s=n.textTracks[i];if(ZI(s,{name:e,lang:r,characteristics:"transcribes-spoken-dialog,describes-music-and-sound"}))return s}return null}createCaptionsTrack(e){this.config.renderTextTracksNatively?this.createNativeTrack(e):this.createNonNativeTrack(e)}createNativeTrack(e){if(this.captionsTracks[e])return;const{captionsProperties:r,captionsTracks:n,media:i}=this,{label:s,languageCode:a}=r[e],o=this.getExistingTrack(s,a);if(o)n[e]=o,jl(n[e]),S2(n[e],i);else{const l=this.createTextTrack("captions",s,a);l&&(l[e]=!0,n[e]=l)}}createNonNativeTrack(e){if(this.nonNativeCaptionsTracks[e])return;const r=this.captionsProperties[e];if(!r)return;const n=r.label,i={_id:e,label:n,kind:"captions",default:r.media?!!r.media.default:!1,closedCaptions:r.media};this.nonNativeCaptionsTracks[e]=i,this.hls.trigger(I.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[i]})}createTextTrack(e,r,n){const i=this.media;if(i)return i.addTextTrack(e,r,n)}onMediaAttaching(e,r){this.media=r.media,r.mediaSource||this._cleanTracks()}onMediaDetaching(e,r){const n=!!r.transferMedia;if(this.media=null,n)return;const{captionsTracks:i}=this;
vendor: 19,683 bytes, line 289
289Object.keys(i).forEach(s=>{jl(i[s]),delete i[s]}),this.nonNativeCaptionsTracks={}}onManifestLoading(){this.lastCc=-1,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=eC(),this._cleanTracks(),this.tracks=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.textTracks=[],this.unparsedVttFrags=[],this.initPTS=[],this.cea608Parser1&&this.cea608Parser2&&(this.cea608Parser1.reset(),this.cea608Parser2.reset())}_cleanTracks(){const{media:e}=this;if(!e)return;const r=e.textTracks;if(r)for(let n=0;n<r.length;n++)jl(r[n])}onSubtitleTracksUpdated(e,r){const n=r.subtitleTracks||[],i=n.some(s=>s.textCodec===j0);if(this.config.enableWebVTT||i&&this.config.enableIMSC1){if(c2(this.tracks,n)){this.tracks=n;return}if(this.textTracks=[],this.tracks=n,this.config.renderTextTracksNatively){const a=this.media,o=a?zp(a.textTracks):null;if(this.tracks.forEach((l,c)=>{let u;if(o){let d=null;for(let f=0;f<o.length;f++)if(o[f]&&ZI(o[f],l)){d=o[f],o[f]=null;break}d&&(u=d)}if(u)jl(u);else{const d=L2(l);u=this.createTextTrack(d,l.name,l.lang),u&&(u.mode="disabled")}u&&this.textTracks.push(u)}),o!=null&&o.length){const l=o.filter(c=>c!==null).map(c=>c.label);l.length&&this.hls.logger.warn(`Media element contains unused subtitle tracks: ${l.join(", ")}. Replace media element for each source to clear TextTracks and captions menu.`)}}else if(this.tracks.length){const a=this.tracks.map(o=>({label:o.name,kind:o.type.toLowerCase(),default:o.default,subtitleTrack:o}));this.hls.trigger(I.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:a})}}}onManifestLoaded(e,r){this.config.enableCEA708Captions&&r.captions&&r.captions.forEach(n=>{const i=/(?:CC|SERVICE)([1-4])/.exec(n.instreamId);if(!i)return;const s=`textTrack${i[1]}`,a=this.captionsProperties[s];a&&(a.label=n.name,n.lang&&(a.languageCode=n.lang),a.media=n)})}closedCaptionsForLevel(e){const r=this.hls.levels[e.level];return r==null?void 0:r.attrs["CLOSED-CAPTIONS"]}onFragLoading(e,r){if(this.enabled&&r.frag.type===oe.MAIN){var n,i;const{cea608Parser1:s,cea608Parser2:a,lastSn:o}=this,{cc:l,sn:c}=r.frag,u=(n=(i=r.part)==null?void 0:i.index)!=null?n:-1;s&&a&&(c!==o+1||c===o&&u!==this.lastPartIndex+1||l!==this.lastCc)&&(s.reset(),a.reset()),this.lastCc=l,this.lastSn=c,this.lastPartIndex=u}}onFragLoaded(e,r){const{frag:n,payload:i}=r;if(n.type===oe.SUBTITLE)if(i.byteLength){const s=n.decryptdata,a="stats"in r;if(s==null||!s.encrypted||a){const o=this.tracks[n.level],l=this.vttCCs;l[n.cc]||(l[n.cc]={start:n.start,prevCC:this.prevCC,new:!0},this.prevCC=n.cc),o&&o.textCodec===j0?this._parseIMSC1(n,i):this._parseVTTs(r)}}else this.hls.trigger(I.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:n,error:new Error("Empty subtitle payload")})}_parseIMSC1(e,r){const n=this.hls;XI(r,this.initPTS[e.cc],i=>{this._appendCues(i,e.level),n.trigger(I.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:e})},i=>{n.logger.log(`Failed to parse IMSC1: ${i}`),n.trigger(I.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:e,error:i})})}_parseVTTs(e){var r;const{frag:n,payload:i}=e,{initPTS:s,unparsedVttFrags:a}=this,o=s.length-1;if(!s[n.cc]&&o===-1){a.push(e);return}const l=this.hls,c=(r=n.initSegment)!=null&&r.data?kn(n.initSegment.data,new Uint8Array(i)).buffer:i;UJ(c,this.initPTS[n.cc],this.vttCCs,n.cc,n.start,u=>{this._appendCues(u,n.level),l.trigger(I.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:n})},u=>{const d=u.message==="Missing initPTS for VTT MPEGTS";d?a.push(e):this._fallbackToIMSC1(n,i),l.logger.log(`Failed to parse VTT cue: ${u}`),!(d&&o>n.cc)&&l.trigger(I.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:n,error:u})})}_fallbackToIMSC1(e,r){const n=this.tracks[e.level];n.textCodec||XI(r,this.initPTS[e.cc],()=>{n.textCodec=j0,this._parseIMSC1(e,r)},()=>{n.textCodec="wvtt"})}_appendCues(e,r){const n=this.hls;if(this.config.renderTextTracksNatively){const i=this.textTracks[r];if(!i||i.mode==="disabled")return;e.forEach(s=>E2(i,s))}else{const i=this.tracks[r];if(!i)return;const s=i.default?"default":"subtitles"+r;n.trigger(I.CUES_PARSED,{type:"subtitles",cues:e,track:s})}}onFragDecrypted(e,r){const{frag:n}=r;n.type===oe.SUBTITLE&&this.onFragLoaded(I.FRAG_LOADED,r)}onSubtitleTracksCleared(){this.tracks=[],this.captionsTracks={}}onFragParsingUserdata(e,r){if(!this.enabled||!this.config.enableCEA708Captions)return;const{frag:n,samples:i}=r;if(!(n.type===oe.MAIN&&this.closedCaptionsForLevel(n)==="NONE"))for(let s=0;s<i.length;s++){const a=i[s].bytes;if(a){this.cea608Parser1||this.initCea608Parsers();const o=this.extractCea608Data(a);this.cea608Parser1.addData(i[s].pts,o[0]),this.cea608Parser2.addData(i[s].pts,o[1])}}}onBufferFlushing(e,{startOffset:r,endOffset:n,endOffsetSubtitles:i,type:s}){const{media:a}=this;if(!(!a||a.currentTime<n)){if(!s||s==="video"){const{captionsTracks:o}=this;Object.keys(o).forEach(l=>ww(o[l],r,n))}if(this.config.renderTextTracksNatively&&r===0&&i!==void 0){const{textTracks:o}=this;Object.keys(o).forEach(l=>ww(o[l],r,i))}}}extractCea608Data(e){const r=[[],[]],n=e[0]&31;let i=2;for(let s=0;s<n;s++){const a=e[i++],o=127&e[i++],l=127&e[i++];if(o===0&&l===0)continue;if((4&a)!==0){const u=3&a;(u===0||u===1)&&(r[u].push(o),r[u].push(l))}}return r}}function L2(t){return t.characteristics&&/transcribes-spoken-dialog/gi.test(t.characteristics)&&/describes-music-and-sound/gi.test(t.characteristics)?"captions":"subtitles"}function ZI(t,e){return!!t&&t.kind===L2(e)&&vw(e,t)}function qJ(t,e,r,n){return Math.min(e,n)-Math.max(t,r)}function eC(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!0}}}const YJ=/\s/,XJ={newCue(t,e,r,n){const i=[];let s,a,o,l,c;const u=self.VTTCue||self.TextTrackCue;for(let f=0;f<n.rows.length;f++)if(s=n.rows[f],o=!0,l=0,c="",!s.isEmpty()){var d;for(let g=0;g<s.chars.length;g++)YJ.test(s.chars[g].uchar)&&o?l++:(c+=s.chars[g].uchar,o=!1);s.cueStartTime=e,e===r&&(r+=1e-4),l>=16?l--:l++;const h=C2(c.trim()),p=qT(e,r,h);t!=null&&(d=t.cues)!=null&&d.getCueById(p)||(a=new u(e,r,h),a.id=p,a.line=f+1,a.align="left",a.position=10+Math.min(80,Math.floor(l*8/32)*10),i.push(a))}return t&&i.length&&(i.sort((f,h)=>f.line==="auto"||h.line==="auto"?0:f.line>8&&h.line>8?h.line-f.line:f.line-h.line),i.forEach(f=>E2(t,f))),i}};function QJ(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch{}return!1}const JJ=/(\d+)-(\d+)\/(\d+)/;class tC{constructor(e){this.fetchSetup=void 0,this.requestTimeout=void 0,this.request=null,this.response=null,this.controller=void 0,this.context=null,this.config=null,this.callbacks=null,this.stats=void 0,this.loader=null,this.fetchSetup=e.fetchSetup||rZ,this.controller=new self.AbortController,this.stats=new AT}destroy(){this.loader=this.callbacks=this.context=this.config=this.request=null,this.abortInternal(),this.response=null,this.fetchSetup=this.controller=this.stats=null}abortInternal(){this.controller&&!this.stats.loading.end&&(this.stats.aborted=!0,this.controller.abort())}abort(){var e;this.abortInternal(),(e=this.callbacks)!=null&&e.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)}load(e,r,n){const i=this.stats;if(i.loading.start)throw new Error("Loader can only be used once.");i.loading.start=self.performance.now();const s=ZJ(e,this.controller.signal),a=e.responseType==="arraybuffer",o=a?"byteLength":"length",{maxTimeToFirstByteMs:l,maxLoadTimeMs:c}=r.loadPolicy;this.context=e,this.config=r,this.callbacks=n,this.request=this.fetchSetup(e,s),self.clearTimeout(this.requestTimeout),r.timeout=l&&se(l)?l:c,this.requestTimeout=self.setTimeout(()=>{this.callbacks&&(this.abortInternal(),this.callbacks.onTimeout(i,e,this.response))},r.timeout),(sf(this.request)?this.request.then(self.fetch):self.fetch(this.request)).then(d=>{var f;this.response=this.loader=d;const h=Math.max(self.performance.now(),i.loading.start);if(self.clearTimeout(this.requestTimeout),r.timeout=c,this.requestTimeout=self.setTimeout(()=>{this.callbacks&&(this.abortInternal(),this.callbacks.onTimeout(i,e,this.response))},c-(h-i.loading.start)),!d.ok){const{status:g,statusText:m}=d;throw new nZ(m||"fetch, bad network response",g,d)}i.loading.first=h,i.total=tZ(d.headers)||i.total;const p=(f=this.callbacks)==null?void 0:f.onProgress;return p&&se(r.highWaterMark)?this.loadProgressively(d,i,e,r.highWaterMark,p):a?d.arrayBuffer():e.responseType==="json"?d.json():d.text()}).then(d=>{var f,h;const p=this.response;if(!p)throw new Error("loader destroyed");self.clearTimeout(this.requestTimeout),i.loading.end=Math.max(self.performance.now(),i.loading.first);const g=d[o];g&&(i.loaded=i.total=g);const m={url:p.url,data:d,code:p.status},v=(f=this.callbacks)==null?void 0:f.onProgress;v&&!se(r.highWaterMark)&&v(i,e,d,p),(h=this.callbacks)==null||h.onSuccess(m,i,e,p)}).catch(d=>{var f;if(self.clearTimeout(this.requestTimeout),i.aborted)return;const h=d&&d.code||0,p=d?d.message:null;(f=this.callbacks)==null||f.onError({code:h,text:p},e,d?d.details:null,i)})}getCacheAge(){let e=null;if(this.response){const r=this.response.headers.get("age");e=r?parseFloat(r):null}return e}getResponseHeader(e){return this.response?this.response.headers.get(e):null}loadProgressively(e,r,n,i=0,s){const a=new Wj,o=e.body.getReader(),l=()=>o.read().then(c=>{if(c.done)return a.dataLength&&s(r,n,a.flush().buffer,e),Promise.resolve(new ArrayBuffer(0));const u=c.value,d=u.length;return r.loaded+=d,d<i||a.dataLength?(a.push(u),a.dataLength>=i&&s(r,n,a.flush().buffer,e)):s(r,n,u.buffer,e),l()}).catch(()=>Promise.reject());return l()}}function ZJ(t,e){const r={method:"GET",mode:"cors",credentials:"same-origin",signal:e,headers:new self.Headers(et({},t.headers))};return t.rangeEnd&&r.headers.set("Range","bytes="+t.rangeStart+"-"+String(t.rangeEnd-1)),r}function eZ(t){const e=JJ.exec(t);if(e)return parseInt(e[2])-parseInt(e[1])+1}function tZ(t){const e=t.get("Content-Range");if(e){const n=eZ(e);if(se(n))return n}const r=t.get("Content-Length");if(r)return parseInt(r)}function rZ(t,e){return new self.Request(t.url,e)}class nZ extends Error{constructor(e,r,n){super(e),this.code=void 0,this.details=void 0,this.code=r,this.details=n}}const iZ=/^age:\s*[\d.]+\s*$/im;class D2{constructor(e){this.xhrSetup=void 0,this.requestTimeout=void 0,this.retryTimeout=void 0,this.retryDelay=void 0,this.config=null,this.callbacks=null,this.context=null,this.loader=null,this.stats=void 0,this.xhrSetup=e&&e.xhrSetup||null,this.stats=new AT,this.retryDelay=0}destroy(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null,this.context=null,this.xhrSetup=null}abortInternal(){const e=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),e&&(e.onreadystatechange=null,e.onprogress=null,e.readyState!==4&&(this.stats.aborted=!0,e.abort()))}abort(){var e;this.abortInternal(),(e=this.callbacks)!=null&&e.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)}load(e,r,n){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=e,this.config=r,this.callbacks=n,this.loadInternal()}loadInternal(){const{config:e,context:r}=this;if(!e||!r)return;const n=this.loader=new self.XMLHttpRequest,i=this.stats;i.loading.first=0,i.loaded=0,i.aborted=!1;const s=this.xhrSetup;s?Promise.resolve().then(()=>{if(!(this.loader!==n||this.stats.aborted))return s(n,r.url)}).catch(a=>{if(!(this.loader!==n||this.stats.aborted))return n.open("GET",r.url,!0),s(n,r.url)}).then(()=>{this.loader!==n||this.stats.aborted||this.openAndSendXhr(n,r,e)}).catch(a=>{var o;(o=this.callbacks)==null||o.onError({code:n.status,text:a.message},r,n,i)}):this.openAndSendXhr(n,r,e)}openAndSendXhr(e,r,n){e.readyState||e.open("GET",r.url,!0);const i=r.headers,{maxTimeToFirstByteMs:s,maxLoadTimeMs:a}=n.loadPolicy;if(i)for(const o in i)e.setRequestHeader(o,i[o]);r.rangeEnd&&e.setRequestHeader("Range","bytes="+r.rangeStart+"-"+(r.rangeEnd-1)),e.onreadystatechange=this.readystatechange.bind(this),e.onprogress=this.loadprogress.bind(this),e.responseType=r.responseType,self.clearTimeout(this.requestTimeout),n.timeout=s&&se(s)?s:a,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),n.timeout),e.send()}readystatechange(){const{context:e,loader:r,stats:n}=this;if(!e||!r)return;const i=r.readyState,s=this.config;if(!n.aborted&&i>=2&&(n.loading.first===0&&(n.loading.first=Math.max(self.performance.now(),n.loading.start),s.timeout!==s.loadPolicy.maxLoadTimeMs&&(self.clearTimeout(this.requestTimeout),s.timeout=s.loadPolicy.maxLoadTimeMs,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),s.loadPolicy.maxLoadTimeMs-(n.loading.first-n.loading.start)))),i===4)){self.clearTimeout(this.requestTimeout),r.onreadystatechange=null,r.onprogress=null;const c=r.status,u=r.responseType==="text"?r.responseText:null;if(c>=200&&c<300){const p=u??r.response;if(p!=null){var a,o;n.loading.end=Math.max(self.performance.now(),n.loading.first);const g=r.responseType==="arraybuffer"?p.byteLength:p.length;n.loaded=n.total=g,n.bwEstimate=n.total*8e3/(n.loading.end-n.loading.first);const m=(a=this.callbacks)==null?void 0:a.onProgress;m&&m(n,e,p,r);const v={url:r.responseURL,data:p,code:c};(o=this.callbacks)==null||o.onSuccess(v,n,e,r);return}}const d=s.loadPolicy.errorRetry,f=n.retry,h={url:e.url,data:void 0,code:c};if(Bm(d,f,!1,h))this.retry(d);else{var l;qe.error(`${c} while loading ${e.url}`),(l=this.callbacks)==null||l.onError({code:c,text:r.statusText},e,r,n)}}}loadtimeout(){if(!this.config)return;const e=this.config.loadPolicy.timeoutRetry,r=this.stats.retry;if(Bm(e,r,!0))this.retry(e);else{var n;qe.warn(`timeout while loading ${(n=this.context)==null?void 0:n.url}`);const i=this.callbacks;i&&(this.abortInternal(),i.onTimeout(this.stats,this.context,this.loader))}}retry(e){const{context:r,stats:n}=this;this.retryDelay=OT(e,n.retry),n.retry++,qe.warn(`${status?"HTTP Status "+status:"Timeout"} while loading ${r==null?void 0:r.url}, retrying ${n.retry}/${e.maxNumRetry} in ${this.retryDelay}ms`),this.abortInternal(),this.loader=null,self.clearTimeout(this.retryTimeout),this.retryTimeout=self.setTimeout(this.loadInternal.bind(this),this.retryDelay)}loadprogress(e){const r=this.stats;r.loaded=e.loaded,e.lengthComputable&&(r.total=e.total)}getCacheAge(){let e=null;if(this.loader&&iZ.test(this.loader.getAllResponseHeaders())){const r=this.loader.getResponseHeader("age");e=r?parseFloat(r):null}return e}getResponseHeader(e){return this.loader&&new RegExp(`^${e}:\\s*[\\d.]+\\s*$`,"im").test(this.loader.getAllResponseHeaders())?this.loader.getResponseHeader(e):null}}const sZ={maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:null,errorRetry:null},aZ=Ve(Ve({autoStartLoad:!0,startPosition:-1,defaultAudioCodec:void 0,debug:!1,capLevelOnFPSDrop:!1,capLevelToPlayerSize:!1,ignoreDevicePixelRatio:!1,maxDevicePixelRatio:Number.POSITIVE_INFINITY,preferManagedMediaSource:!0,initialLiveManifestSize:1,maxBufferLength:30,backBufferLength:1/0,frontBufferFlushThreshold:1/0,startOnSegmentBoundary:!1,maxBufferSize:60*1e3*1e3,maxFragLookUpTolerance:.25,maxBufferHole:.1,detectStallWithCurrentTimeMs:1250,highBufferWatchdogPeriod:2,nudgeOffset:.1,nudgeMaxRetry:3,nudgeOnVideoHole:!0,liveSyncMode:"edge",liveSyncDurationCount:3,liveSyncOnStallIncrease:1,liveMaxLatencyDurationCount:1/0,liveSyncDuration:void 0,liveMaxLatencyDuration:void 0,maxLiveSyncPlaybackRate:1,liveDurationInfinity:!1,liveBackBufferLength:null,maxMaxBufferLength:600,enableWorker:!0,workerPath:null,enableSoftwareAES:!0,startLevel:void 0,startFragPrefetch:!1,fpsDroppedMonitoringPeriod:5e3,fpsDroppedMonitoringThreshold:.2,appendErrorMaxRetry:3,ignorePlaylistParsingErrors:!1,loader:D2,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:y7,bufferController:lQ,capLevelController:VT,errorController:E7,fpsController:cJ,stretchShortVideoTrack:!1,maxAudioFramesDrift:1,forceKeyFrameOnDiscontinuity:!0,abrEwmaFastLive:3,abrEwmaSlowLive:9,abrEwmaFastVoD:3,abrEwmaSlowVoD:9,abrEwmaDefaultEstimate:5e5,abrEwmaDefaultEstimateMax:5e6,abrBandWidthFactor:.95,abrBandWidthUpFactor:.7,abrMaxWithRealBitrate:!1,maxStarvationDelay:4,maxLoadingDelay:4,minAutoBitrate:0,emeEnabled:!1,widevineLicenseUrl:void 0,drmSystems:{},drmSystemOptions:{},requestMediaKeySystemAccessFunc:kj,requireKeySystemAccessOnStart:!1,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0,enableDateRangeMetadataCues:!0,enableEmsgMetadataCues:!0,enableEmsgKLVMetadata:!1,enableID3MetadataCues:!0,enableInterstitialPlayback:!0,interstitialAppendInPlace:!0,interstitialLiveLookAhead:10,useMediaCapabilities:!0,preserveManualLevelOnError:!1,certLoadPolicy:{default:sZ},keyLoadPolicy:{default:{maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:2e4,backoff:"linear"},errorRetry:{maxNumRetry:8,retryDelayMs:1e3,maxRetryDelayMs:2e4,backoff:"linear"}}},manifestLoadPolicy:{default:{maxTimeToFirstByteMs:1/0,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},playlistLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:2,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},fragLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:12e4,timeoutRetry:{maxNumRetry:4,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:6,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},steeringManifestLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},interstitialAssetListLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:3e4,timeoutRetry:{maxNumRetry:0,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:0,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},manifestLoadingTimeOut:1e4,manifestLoadingMaxRetry:1,manifestLoadingRetryDelay:1e3,manifestLoadingMaxRetryTimeout:64e3,levelLoadingTimeOut:1e4,levelLoadingMaxRetry:4,levelLoadingRetryDelay:1e3,levelLoadingMaxRetryTimeout:64e3,fragLoadingTimeOut:2e4,fragLoadingMaxRetry:6,fragLoadingRetryDelay:1e3,fragLoadingMaxRetryTimeout:64e3},oZ()),{},{subtitleStreamController:wJ,subtitleTrackController:fJ,timelineController:zJ,audioStreamController:iQ,audioTrackController:sQ,emeController:Zl,cmcdController:sJ,contentSteeringController:oJ,interstitialsController:xJ});function oZ(){return{cueHandler:XJ,enableWebVTT:!0,enableIMSC1:!0,enableCEA708Captions:!0,captionsTextTrack1Label:"English",captionsTextTrack1LanguageCode:"en",captionsTextTrack2Label:"Spanish",captionsTextTrack2LanguageCode:"es",captionsTextTrack3Label:"Unknown CC",captionsTextTrack3LanguageCode:"",captionsTextTrack4Label:"Unknown CC",captionsTextTrack4LanguageCode:"",renderTextTracksNatively:!0}}function lZ(t,e,r){if((e.liveSyncDurationCount||e.liveMaxLatencyDurationCount)&&(e.liveSyncDuration||e.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(e.liveMaxLatencyDurationCount!==void 0&&(e.liveSyncDurationCount===void 0||e.liveMaxLatencyDurationCount<=e.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(e.liveMaxLatencyDuration!==void 0&&(e.liveSyncDuration===void 0||e.liveMaxLatencyDuration<=e.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');const n=Ew(t),i=["manifest","level","frag"],s=["TimeOut","MaxRetry","RetryDelay","MaxRetryTimeout"];
vendor: 24,398 bytes, line 289
289return i.forEach(a=>{const o=`${a==="level"?"playlist":a}LoadPolicy`,l=e[o]===void 0,c=[];s.forEach(u=>{const d=`${a}Loading${u}`,f=e[d];if(f!==void 0&&l){c.push(d);const h=n[o].default;switch(e[o]={default:h},u){case"TimeOut":h.maxLoadTimeMs=f,h.maxTimeToFirstByteMs=f;break;case"MaxRetry":h.errorRetry.maxNumRetry=f,h.timeoutRetry.maxNumRetry=f;break;case"RetryDelay":h.errorRetry.retryDelayMs=f,h.timeoutRetry.retryDelayMs=f;break;case"MaxRetryTimeout":h.errorRetry.maxRetryDelayMs=f,h.timeoutRetry.maxRetryDelayMs=f;break}}}),c.length&&r.warn(`hls.js config: "${c.join('", "')}" setting(s) are deprecated, use "${o}": ${it(e[o])}`)}),Ve(Ve({},n),e)}function Ew(t){return t&&typeof t=="object"?Array.isArray(t)?t.map(Ew):Object.keys(t).reduce((e,r)=>(e[r]=Ew(t[r]),e),{}):t}function cZ(t,e){const r=t.loader;r!==tC&&r!==D2?(e.log("[config]: Custom loader detected, cannot enable progressive streaming"),t.progressive=!1):QJ()&&(t.loader=tC,t.progressive=!0,t.enableSoftwareAES=!0,e.log("[config]: Progressive streaming enabled, using FetchLoader"))}const qp=2,uZ=.1,dZ=.05,fZ=100;class hZ extends Pj{constructor(e,r){super("gap-controller",e.logger),this.hls=void 0,this.fragmentTracker=void 0,this.media=null,this.mediaSource=void 0,this.nudgeRetry=0,this.stallReported=!1,this.stalled=null,this.moved=!1,this.seeking=!1,this.buffered={},this.lastCurrentTime=0,this.ended=0,this.waiting=0,this.onMediaPlaying=()=>{this.ended=0,this.waiting=0},this.onMediaWaiting=()=>{var n;(n=this.media)!=null&&n.seeking||(this.waiting=self.performance.now(),this.tick())},this.onMediaEnded=()=>{if(this.hls){var n;this.ended=((n=this.media)==null?void 0:n.currentTime)||1,this.hls.trigger(I.MEDIA_ENDED,{stalled:!1})}},this.hls=e,this.fragmentTracker=r,this.registerListeners()}registerListeners(){const{hls:e}=this;e&&(e.on(I.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(I.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(I.BUFFER_APPENDED,this.onBufferAppended,this))}unregisterListeners(){const{hls:e}=this;e&&(e.off(I.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(I.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(I.BUFFER_APPENDED,this.onBufferAppended,this))}destroy(){super.destroy(),this.unregisterListeners(),this.media=this.hls=this.fragmentTracker=null,this.mediaSource=void 0}onMediaAttached(e,r){this.setInterval(fZ),this.mediaSource=r.mediaSource;const n=this.media=r.media;kr(n,"playing",this.onMediaPlaying),kr(n,"waiting",this.onMediaWaiting),kr(n,"ended",this.onMediaEnded)}onMediaDetaching(e,r){this.clearInterval();const{media:n}=this;n&&(Gr(n,"playing",this.onMediaPlaying),Gr(n,"waiting",this.onMediaWaiting),Gr(n,"ended",this.onMediaEnded),this.media=null),this.mediaSource=void 0}onBufferAppended(e,r){this.buffered=r.timeRanges}get hasBuffered(){return Object.keys(this.buffered).length>0}tick(){var e;if(!((e=this.media)!=null&&e.readyState)||!this.hasBuffered)return;const r=this.media.currentTime;this.poll(r,this.lastCurrentTime),this.lastCurrentTime=r}poll(e,r){var n,i;const s=(n=this.hls)==null?void 0:n.config;if(!s)return;const a=this.media;if(!a)return;const{seeking:o}=a,l=this.seeking&&!o,c=!this.seeking&&o,u=a.paused&&!o||a.ended||a.playbackRate===0;if(this.seeking=o,e!==r){r&&(this.ended=0),this.moved=!0,o||(this.nudgeRetry=0,s.nudgeOnVideoHole&&!u&&e>r&&this.nudgeOnVideoHole(e,r)),this.waiting===0&&this.stallResolved(e);return}if(c||l){l&&this.stallResolved(e);return}if(u){this.nudgeRetry=0,this.stallResolved(e),!this.ended&&a.ended&&this.hls&&(this.ended=e||1,this.hls.trigger(I.MEDIA_ENDED,{stalled:!1}));return}if(!Se.getBuffered(a).length){this.nudgeRetry=0;return}const d=Se.bufferInfo(a,e,0),f=d.nextStart||0,h=this.fragmentTracker;if(o&&h&&this.hls){const T=rC(this.hls.inFlightFragments,e),_=d.len>qp,A=!f||T||f-e>qp&&!h.getPartialFragment(e);if(_||A)return;this.moved=!1}const p=(i=this.hls)==null?void 0:i.latestLevelDetails;if(!this.moved&&this.stalled!==null&&h){if(!(d.len>0)&&!f)return;const _=Math.max(f,d.start||0)-e,P=!!(p!=null&&p.live)?p.targetduration*2:qp,C=ap(e,h);if(_>0&&(_<=P||C)){a.paused||this._trySkipBufferHole(C);return}}const g=s.detectStallWithCurrentTimeMs,m=self.performance.now(),v=this.waiting;let y=this.stalled;if(y===null)if(v>0&&m-v<g)y=this.stalled=v;else{this.stalled=m;return}const b=m-y;if(!o&&(b>=g||v)&&this.hls){var w;if(((w=this.mediaSource)==null?void 0:w.readyState)==="ended"&&!(p!=null&&p.live)&&Math.abs(e-((p==null?void 0:p.edge)||0))<1){if(this.ended)return;this.ended=e||1,this.hls.trigger(I.MEDIA_ENDED,{stalled:!0});return}if(this._reportStall(d),!this.media||!this.hls)return}const S=Se.bufferInfo(a,e,s.maxBufferHole);this._tryFixBufferStall(S,b,e)}stallResolved(e){const r=this.stalled;if(r&&this.hls&&(this.stalled=null,this.stallReported)){const n=self.performance.now()-r;this.log(`playback not stuck anymore @${e}, after ${Math.round(n)}ms`),this.stallReported=!1,this.waiting=0,this.hls.trigger(I.STALL_RESOLVED,{})}}nudgeOnVideoHole(e,r){var n;const i=this.buffered.video;if(this.hls&&this.media&&this.fragmentTracker&&(n=this.buffered.audio)!=null&&n.length&&i&&i.length>1&&e>i.end(0)){const s=Se.bufferedInfo(Se.timeRangesToArray(this.buffered.audio),e,0);if(s.len>1&&r>=s.start){const a=Se.timeRangesToArray(i),o=Se.bufferedInfo(a,r,0).bufferedIndex;if(o>-1&&o<a.length-1){const l=Se.bufferedInfo(a,e,0).bufferedIndex,c=a[o].end,u=a[o+1].start;if((l===-1||l>o)&&u-c<1&&e-c<2){const d=new Error(`nudging playhead to flush pipeline after video hole. currentTime: ${e} hole: ${c} -> ${u} buffered index: ${l}`);this.warn(d.message),this.media.currentTime+=1e-6;let f=ap(e,this.fragmentTracker);f&&"fragment"in f?f=f.fragment:f||(f=void 0);const h=Se.bufferInfo(this.media,e,0);this.hls.trigger(I.ERROR,{type:fe.MEDIA_ERROR,details:V.BUFFER_SEEK_OVER_HOLE,fatal:!1,error:d,reason:d.message,frag:f,buffer:h.len,bufferInfo:h})}}}}}_tryFixBufferStall(e,r,n){var i,s;const{fragmentTracker:a,media:o}=this,l=(i=this.hls)==null?void 0:i.config;if(!o||!a||!l)return;const c=(s=this.hls)==null?void 0:s.latestLevelDetails,u=ap(n,a);if((u||c!=null&&c.live&&n<c.fragmentStart)&&(this._trySkipBufferHole(u)||!this.media))return;const d=e.buffered,f=this.adjacentTraversal(e,n);(d&&d.length>1&&e.len>l.maxBufferHole||e.nextStart&&(e.nextStart-n<l.maxBufferHole||f))&&(r>l.highBufferWatchdogPeriod*1e3||this.waiting)&&(this.warn("Trying to nudge playhead over buffer-hole"),this._tryNudgeBuffer(e))}adjacentTraversal(e,r){const n=this.fragmentTracker,i=e.nextStart;if(n&&i){const s=n.getFragAtPos(r,oe.MAIN),a=n.getFragAtPos(i,oe.MAIN);if(s&&a)return a.sn-s.sn<2}return!1}_reportStall(e){const{hls:r,media:n,stallReported:i,stalled:s}=this;if(!i&&s!==null&&n&&r){this.stallReported=!0;const a=new Error(`Playback stalling at @${n.currentTime} due to low buffer (${it(e)})`);this.warn(a.message),r.trigger(I.ERROR,{type:fe.MEDIA_ERROR,details:V.BUFFER_STALLED_ERROR,fatal:!1,error:a,buffer:e.len,bufferInfo:e,stalled:{start:s}})}}_trySkipBufferHole(e){var r;const{fragmentTracker:n,media:i}=this,s=(r=this.hls)==null?void 0:r.config;if(!i||!n||!s)return 0;const a=i.currentTime,o=Se.bufferInfo(i,a,0),l=a<o.start?o.start:o.nextStart;if(l&&this.hls){const u=o.len<=s.maxBufferHole,d=o.len>0&&o.len<1&&i.readyState<3,f=l-a;if(f>0&&(u||d)){if(f>s.maxBufferHole){let p=!1;if(a===0){const g=n.getAppendedFrag(0,oe.MAIN);g&&l<g.end&&(p=!0)}if(!p&&e){var c;if(!((c=this.hls.loadLevelObj)!=null&&c.details)||rC(this.hls.inFlightFragments,l))return 0;let m=!1,v=e.end;for(;v<l;){const y=ap(v,n);if(y)v+=y.duration;else{m=!0;break}}if(m)return 0}}const h=Math.max(l+dZ,a+uZ);if(this.warn(`skipping hole, adjusting currentTime from ${a} to ${h}`),this.moved=!0,i.currentTime=h,!(e!=null&&e.gap)){const p=new Error(`fragment loaded with buffer holes, seeking from ${a} to ${h}`),g={type:fe.MEDIA_ERROR,details:V.BUFFER_SEEK_OVER_HOLE,fatal:!1,error:p,reason:p.message,buffer:o.len,bufferInfo:o};e&&("fragment"in e?g.part=e:g.frag=e),this.hls.trigger(I.ERROR,g)}return h}}return 0}_tryNudgeBuffer(e){const{hls:r,media:n,nudgeRetry:i}=this,s=r==null?void 0:r.config;if(!n||!s)return 0;const a=n.currentTime;if(this.nudgeRetry++,i<s.nudgeMaxRetry){const o=a+(i+1)*s.nudgeOffset,l=new Error(`Nudging 'currentTime' from ${a} to ${o}`);this.warn(l.message),n.currentTime=o,r.trigger(I.ERROR,{type:fe.MEDIA_ERROR,details:V.BUFFER_NUDGE_ON_STALL,error:l,fatal:!1,buffer:e.len,bufferInfo:e})}else{const o=new Error(`Playhead still not moving while enough data buffered @${a} after ${s.nudgeMaxRetry} nudges`);this.error(o.message),r.trigger(I.ERROR,{type:fe.MEDIA_ERROR,details:V.BUFFER_STALLED_ERROR,error:o,fatal:!0,buffer:e.len,bufferInfo:e})}}}function rC(t,e){const r=nC(t.main);if(r&&r.start<=e)return r;const n=nC(t.audio);return n&&n.start<=e?n:null}function nC(t){if(!t)return null;switch(t.state){case Q.IDLE:case Q.STOPPED:case Q.ENDED:case Q.ERROR:return null}return t.frag}function ap(t,e){return e.getAppendedFrag(t,oe.MAIN)||e.getPartialFragment(t)}const pZ=.25;function Tw(){if(!(typeof self>"u"))return self.VTTCue||self.TextTrackCue}function G0(t,e,r,n,i){let s=new t(e,r,"");try{s.value=n,i&&(s.type=i)}catch{s=new t(e,r,it(i?Ve({type:i},n):n))}return s}const op=(()=>{const t=Tw();try{t&&new t(0,Number.POSITIVE_INFINITY,"")}catch{return Number.MAX_VALUE}return Number.POSITIVE_INFINITY})();class mZ{constructor(e){this.hls=void 0,this.id3Track=null,this.media=null,this.dateRangeCuesAppended={},this.removeCues=!0,this.assetCue=void 0,this.onEventCueEnter=()=>{this.hls&&this.hls.trigger(I.EVENT_CUE_ENTER,{})},this.hls=e,this._registerListeners()}destroy(){this._unregisterListeners(),this.id3Track=null,this.media=null,this.dateRangeCuesAppended={},this.hls=this.onEventCueEnter=null}_registerListeners(){const{hls:e}=this;e&&(e.on(I.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(I.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(I.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(I.MANIFEST_LOADING,this.onManifestLoading,this),e.on(I.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.on(I.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(I.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(I.LEVEL_PTS_UPDATED,this.onLevelPtsUpdated,this))}_unregisterListeners(){const{hls:e}=this;e&&(e.off(I.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(I.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(I.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(I.MANIFEST_LOADING,this.onManifestLoading,this),e.off(I.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.off(I.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(I.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(I.LEVEL_PTS_UPDATED,this.onLevelPtsUpdated,this))}onMediaAttaching(e,r){var n;this.media=r.media,((n=r.overrides)==null?void 0:n.cueRemoval)===!1&&(this.removeCues=!1)}onMediaAttached(){var e;const r=(e=this.hls)==null?void 0:e.latestLevelDetails;r&&this.updateDateRangeCues(r)}onMediaDetaching(e,r){this.media=null,!r.transferMedia&&(this.id3Track&&(this.removeCues&&jl(this.id3Track,this.onEventCueEnter),this.id3Track=null),this.dateRangeCuesAppended={})}onManifestLoading(){this.dateRangeCuesAppended={}}createTrack(e){const r=this.getID3Track(e.textTracks);return r.mode="hidden",r}getID3Track(e){if(this.media){for(let r=0;r<e.length;r++){const n=e[r];if(n.kind==="metadata"&&n.label==="id3")return S2(n,this.media),n}return this.media.addTextTrack("metadata","id3")}}onFragParsingMetadata(e,r){if(!this.media||!this.hls)return;const{enableEmsgMetadataCues:n,enableID3MetadataCues:i}=this.hls.config;if(!n&&!i)return;const{samples:s}=r;this.id3Track||(this.id3Track=this.createTrack(this.media));const a=Tw();if(a)for(let o=0;o<s.length;o++){const l=s[o].type;if(l===an.emsg&&!n||!i)continue;const c=Xj(s[o].data),u=s[o].pts;let d=u+s[o].duration;d>op&&(d=op),d-u<=0&&(d=u+pZ);for(let h=0;h<c.length;h++){const p=c[h];if(!Qj(p)){this.updateId3CueEnds(u,l);const g=G0(a,u,d,p,l);g&&this.id3Track.addCue(g)}}}}updateId3CueEnds(e,r){var n;const i=(n=this.id3Track)==null?void 0:n.cues;if(i)for(let s=i.length;s--;){const a=i[s];a.type===r&&a.startTime<e&&a.endTime===op&&(a.endTime=e)}}onBufferFlushing(e,{startOffset:r,endOffset:n,type:i}){const{id3Track:s,hls:a}=this;if(!a)return;const{config:{enableEmsgMetadataCues:o,enableID3MetadataCues:l}}=a;if(s&&(o||l)){let c;i==="audio"?c=u=>u.type===an.audioId3&&l:i==="video"?c=u=>u.type===an.emsg&&o:c=u=>u.type===an.audioId3&&l||u.type===an.emsg&&o,ww(s,r,n,c)}}onLevelUpdated(e,{details:r}){this.updateDateRangeCues(r,!0)}onLevelPtsUpdated(e,r){Math.abs(r.drift)>.01&&this.updateDateRangeCues(r.details)}updateDateRangeCues(e,r){if(!this.hls||!this.media)return;const{assetPlayerId:n,timelineOffset:i,enableDateRangeMetadataCues:s,interstitialsController:a}=this.hls.config;if(!s)return;const o=Tw();if(n&&i&&!a){const{fragmentStart:g,fragmentEnd:m}=e;let v=this.assetCue;v?(v.startTime=g,v.endTime=m):o&&(v=this.assetCue=G0(o,g,m,{assetPlayerId:this.hls.config.assetPlayerId},"hlsjs.interstitial.asset"),v&&(v.id=n,this.id3Track||(this.id3Track=this.createTrack(this.media)),this.id3Track.addCue(v),v.addEventListener("enter",this.onEventCueEnter)))}if(!e.hasProgramDateTime)return;const{id3Track:l}=this,{dateRanges:c}=e,u=Object.keys(c);let d=this.dateRangeCuesAppended;if(l&&r){var f;if((f=l.cues)!=null&&f.length){const g=Object.keys(d).filter(m=>!u.includes(m));for(let m=g.length;m--;){var h;const v=g[m],y=(h=d[v])==null?void 0:h.cues;delete d[v],y&&Object.keys(y).forEach(b=>{const w=y[b];if(w){w.removeEventListener("enter",this.onEventCueEnter);try{l.removeCue(w)}catch{}}})}}else d=this.dateRangeCuesAppended={}}const p=e.fragments[e.fragments.length-1];if(!(u.length===0||!se(p==null?void 0:p.programDateTime))){this.id3Track||(this.id3Track=this.createTrack(this.media));for(let g=0;g<u.length;g++){const m=u[g],v=c[m],y=v.startTime,b=d[m],w=(b==null?void 0:b.cues)||{};let S=(b==null?void 0:b.durationKnown)||!1,T=op;const{duration:_,endDate:A}=v;if(A&&_!==null)T=y+_,S=!0;else if(v.endOnNext&&!S){const C=u.reduce((O,R)=>{if(R!==v.id){const D=c[R];if(D.class===v.class&&D.startDate>v.startDate&&(!O||v.startDate<O.startDate))return D}return O},null);C&&(T=C.startTime,S=!0)}const P=Object.keys(v.attr);for(let C=0;C<P.length;C++){const O=P[C];if(!M7(O))continue;const R=w[O];if(R)S&&!(b!=null&&b.durationKnown)?R.endTime=T:Math.abs(R.startTime-y)>.01&&(R.startTime=y,R.endTime=T);else if(o){let D=v.attr[O];$7(O)&&(D=oj(D));const j=G0(o,y,T,{key:O,data:D},an.dateRange);j&&(j.id=m,this.id3Track.addCue(j),w[O]=j,a&&(O==="X-ASSET-LIST"||O==="X-ASSET-URL")&&j.addEventListener("enter",this.onEventCueEnter))}}d[m]={cues:w,dateRange:v,durationKnown:S}}}}}class gZ{constructor(e){this.hls=void 0,this.config=void 0,this.media=null,this.currentTime=0,this.stallCount=0,this._latency=null,this._targetLatencyUpdated=!1,this.onTimeupdate=()=>{const{media:r}=this,n=this.levelDetails;if(!r||!n)return;this.currentTime=r.currentTime;const i=this.computeLatency();if(i===null)return;this._latency=i;const{lowLatencyMode:s,maxLiveSyncPlaybackRate:a}=this.config;if(!s||a===1||!n.live)return;const o=this.targetLatency;if(o===null)return;const l=i-o,c=Math.min(this.maxLatency,o+n.targetduration);if(l<c&&l>.05&&this.forwardBufferLength>1){const d=Math.min(2,Math.max(1,a)),f=Math.round(2/(1+Math.exp(-.75*l-this.edgeStalled))*20)/20,h=Math.min(d,Math.max(1,f));this.changeMediaPlaybackRate(r,h)}else r.playbackRate!==1&&r.playbackRate!==0&&this.changeMediaPlaybackRate(r,1)},this.hls=e,this.config=e.config,this.registerListeners()}get levelDetails(){var e;return((e=this.hls)==null?void 0:e.latestLevelDetails)||null}get latency(){return this._latency||0}get maxLatency(){const{config:e}=this;if(e.liveMaxLatencyDuration!==void 0)return e.liveMaxLatencyDuration;const r=this.levelDetails;return r?e.liveMaxLatencyDurationCount*r.targetduration:0}get targetLatency(){const e=this.levelDetails;if(e===null||this.hls===null)return null;const{holdBack:r,partHoldBack:n,targetduration:i}=e,{liveSyncDuration:s,liveSyncDurationCount:a,lowLatencyMode:o}=this.config,l=this.hls.userConfig;let c=o&&n||r;(this._targetLatencyUpdated||l.liveSyncDuration||l.liveSyncDurationCount||c===0)&&(c=s!==void 0?s:a*i);const u=i;return c+Math.min(this.stallCount*this.config.liveSyncOnStallIncrease,u)}set targetLatency(e){this.stallCount=0,this.config.liveSyncDuration=e,this._targetLatencyUpdated=!0}get liveSyncPosition(){const e=this.estimateLiveEdge(),r=this.targetLatency;if(e===null||r===null)return null;const n=this.levelDetails;if(n===null)return null;const i=n.edge,s=e-r-this.edgeStalled,a=i-n.totalduration,o=i-(this.config.lowLatencyMode&&n.partTarget||n.targetduration);return Math.min(Math.max(a,s),o)}get drift(){const e=this.levelDetails;return e===null?1:e.drift}get edgeStalled(){const e=this.levelDetails;if(e===null)return 0;const r=(this.config.lowLatencyMode&&e.partTarget||e.targetduration)*3;return Math.max(e.age-r,0)}get forwardBufferLength(){const{media:e}=this,r=this.levelDetails;if(!e||!r)return 0;const n=e.buffered.length;return(n?e.buffered.end(n-1):r.edge)-this.currentTime}destroy(){this.unregisterListeners(),this.onMediaDetaching(),this.hls=null}registerListeners(){const{hls:e}=this;e&&(e.on(I.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(I.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(I.MANIFEST_LOADING,this.onManifestLoading,this),e.on(I.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(I.ERROR,this.onError,this))}unregisterListeners(){const{hls:e}=this;e&&(e.off(I.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(I.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(I.MANIFEST_LOADING,this.onManifestLoading,this),e.off(I.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(I.ERROR,this.onError,this))}onMediaAttached(e,r){this.media=r.media,this.media.addEventListener("timeupdate",this.onTimeupdate)}onMediaDetaching(){this.media&&(this.media.removeEventListener("timeupdate",this.onTimeupdate),this.media=null)}onManifestLoading(){this._latency=null,this.stallCount=0}onLevelUpdated(e,{details:r}){r.advanced&&this.onTimeupdate(),!r.live&&this.media&&this.media.removeEventListener("timeupdate",this.onTimeupdate)}onError(e,r){var n;r.details===V.BUFFER_STALLED_ERROR&&(this.stallCount++,this.hls&&(n=this.levelDetails)!=null&&n.live&&this.hls.logger.warn("[latency-controller]: Stall detected, adjusting target latency"))}changeMediaPlaybackRate(e,r){var n,i;e.playbackRate!==r&&((n=this.hls)==null||n.logger.debug(`[latency-controller]: latency=${this.latency.toFixed(3)}, targetLatency=${(i=this.targetLatency)==null?void 0:i.toFixed(3)}, forwardBufferLength=${this.forwardBufferLength.toFixed(3)}: adjusting playback rate from ${e.playbackRate} to ${r}`),e.playbackRate=r)}estimateLiveEdge(){const e=this.levelDetails;return e===null?null:e.edge+e.age}computeLatency(){const e=this.estimateLiveEdge();return e===null?null:e-this.currentTime}}class vZ extends WT{constructor(e,r){super(e,"level-controller"),this._levels=[],this._firstLevel=-1,this._maxAutoLevel=-1,this._startLevel=void 0,this.currentLevel=null,this.currentLevelIndex=-1,this.manualLevelIndex=-1,this.steering=void 0,this.onParsedComplete=void 0,this.steering=r,this._registerListeners()}_registerListeners(){const{hls:e}=this;e.on(I.MANIFEST_LOADING,this.onManifestLoading,this),e.on(I.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(I.LEVEL_LOADED,this.onLevelLoaded,this),e.on(I.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(I.FRAG_BUFFERED,this.onFragBuffered,this),e.on(I.ERROR,this.onError,this)}_unregisterListeners(){const{hls:e}=this;e.off(I.MANIFEST_LOADING,this.onManifestLoading,this),e.off(I.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(I.LEVEL_LOADED,this.onLevelLoaded,this),e.off(I.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(I.FRAG_BUFFERED,this.onFragBuffered,this),e.off(I.ERROR,this.onError,this)}destroy(){this._unregisterListeners(),this.steering=null,this.resetLevels(),super.destroy()}stopLoad(){this._levels.forEach(r=>{r.loadError=0,r.fragmentError=0}),super.stopLoad()}resetLevels(){this._startLevel=void 0,this.manualLevelIndex=-1,this.currentLevelIndex=-1,this.currentLevel=null,this._levels=[],this._maxAutoLevel=-1}onManifestLoading(e,r){this.resetLevels()}onManifestLoaded(e,r){const n=this.hls.config.preferManagedMediaSource,i=[],s={},a={};let o=!1,l=!1,c=!1;r.levels.forEach(u=>{const d=u.attrs;let{audioCodec:f,videoCodec:h}=u;f&&(u.audioCodec=f=Mm(f,n)||void 0),h&&(h=u.videoCodec=ZY(h));const{width:p,height:g,unknownCodecs:m}=u,v=(m==null?void 0:m.length)||0;if(o||(o=!!(p&&g)),l||(l=!!h),c||(c=!!f),v||f&&!this.isAudioSupported(f)||h&&!this.isVideoSupported(h)){this.log(`Some or all CODECS not supported "${d.CODECS}"`);return}const{CODECS:y,"FRAME-RATE":b,"HDCP-LEVEL":w,"PATHWAY-ID":S,RESOLUTION:T,"VIDEO-RANGE":_}=d,P=`${`${S||"."}-`}${u.bitrate}-${T}-${b}-${y}-${_}-${w}`;if(s[P])if(s[P].uri!==u.url&&!u.attrs["PATHWAY-ID"]){const C=a[P]+=1;u.attrs["PATHWAY-ID"]=new Array(C+1).join(".");const O=this.createLevel(u);s[P]=O,i.push(O)}else s[P].addGroupId("audio",d.AUDIO),s[P].addGroupId("text",d.SUBTITLES);else{const C=this.createLevel(u);s[P]=C,a[P]=1,i.push(C)}}),this.filterAndSortMediaOptions(i,r,o,l,c)}createLevel(e){const r=new tf(e),n=e.supplemental;if(n!=null&&n.videoCodec&&!this.isVideoSupported(n.videoCodec)){const i=new Error(`SUPPLEMENTAL-CODECS not supported "${n.videoCodec}"`);this.log(i.message),r.supportedResult=bj(i,[])}return r}isAudioSupported(e){return Zd(e,"audio",this.hls.config.preferManagedMediaSource)}isVideoSupported(e){return Zd(e,"video",this.hls.config.preferManagedMediaSource)}filterAndSortMediaOptions(e,r,n,i,s){var a;let o=[],l=[],c=e;const u=((a=r.stats)==null?void 0:a.parsing)||{};if((n||i)&&s&&(c=c.filter(({videoCodec:y,videoRange:b,width:w,height:S})=>(!!y||!!(w&&S))&&c7(b))),c.length===0){Promise.resolve().then(()=>{if(this.hls){let y="no level with compatible codecs found in manifest",b=y;r.levels.length&&(b=`one or more CODECS in variant not supported: ${it(r.levels.map(S=>S.attrs.CODECS).filter((S,T,_)=>_.indexOf(S)===T))}`,this.warn(b),y+=` (${b})`);const w=new Error(y);this.hls.trigger(I.ERROR,{type:fe.MEDIA_ERROR,details:V.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:r.url,error:w,reason:b})}}),u.end=performance.now();return}r.audioTracks&&(o=r.audioTracks.filter(y=>!y.audioCodec||this.isAudioSupported(y.audioCodec)),iC(o)),r.subtitles&&(l=r.subtitles,iC(l));const d=c.slice(0);c.sort((y,b)=>{if(y.attrs["HDCP-LEVEL"]!==b.attrs["HDCP-LEVEL"])return(y.attrs["HDCP-LEVEL"]||"")>(b.attrs["HDCP-LEVEL"]||"")?1:-1;if(n&&y.height!==b.height)return y.height-b.height;if(y.frameRate!==b.frameRate)return y.frameRate-b.frameRate;if(y.videoRange!==b.videoRange)return $m.indexOf(y.videoRange)-$m.indexOf(b.videoRange);if(y.videoCodec!==b.videoCodec){const w=YP(y.videoCodec),S=YP(b.videoCodec);if(w!==S)return S-w}if(y.uri===b.uri&&y.codecSet!==b.codecSet){const w=Nm(y.codecSet),S=Nm(b.codecSet);if(w!==S)return S-w}return y.averageBitrate!==b.averageBitrate?y.averageBitrate-b.averageBitrate:0});let f=d[0];if(this.steering&&(c=this.steering.filterParsedLevels(c),c.length!==d.length)){for(let y=0;y<d.length;y++)if(d[y].pathwayId===c[0].pathwayId){f=d[y];break}}this._levels=c;for(let y=0;y<c.length;y++)if(c[y]===f){var h;this._firstLevel=y;const b=f.bitrate,w=this.hls.bandwidthEstimate;if(this.log(`manifest loaded, ${c.length} level(s) found, first bitrate: ${b}`),((h=this.hls.userConfig)==null?void 0:h.abrEwmaDefaultEstimate)===void 0){const S=Math.min(b,this.hls.config.abrEwmaDefaultEstimateMax);S>w&&w===this.hls.abrEwmaDefaultEstimate&&(this.hls.bandwidthEstimate=S)}break}const p=s&&!i,g=this.hls.config,m=!!(g.audioStreamController&&g.audioTrackController),v={levels:c,audioTracks:o,subtitleTracks:l,sessionData:r.sessionData,sessionKeys:r.sessionKeys,firstLevel:this._firstLevel,stats:r.stats,audio:s,video:i,altAudio:m&&!p&&o.some(y=>!!y.url)};u.end=performance.now(),this.hls.trigger(I.MANIFEST_PARSED,v)}get levels(){return this._levels.length===0?null:this._levels}get loadLevelObj(){return this.currentLevel}get level(){return this.currentLevelIndex}set level(e){const r=this._levels;if(r.length===0)return;if(e<0||e>=r.length){const u=new Error("invalid level idx"),d=e<0;if(this.hls.trigger(I.ERROR,{type:fe.OTHER_ERROR,details:V.LEVEL_SWITCH_ERROR,level:e,fatal:d,error:u,reason:u.message}),d)return;e=Math.min(e,r.length-1)}const n=this.currentLevelIndex,i=this.currentLevel,s=i?i.attrs["PATHWAY-ID"]:void 0,a=r[e],o=a.attrs["PATHWAY-ID"];
vendor: 4,710 bytes, line 289
289if(this.currentLevelIndex=e,this.currentLevel=a,n===e&&i&&s===o)return;this.log(`Switching to level ${e} (${a.height?a.height+"p ":""}${a.videoRange?a.videoRange+" ":""}${a.codecSet?a.codecSet+" ":""}@${a.bitrate})${o?" with Pathway "+o:""} from level ${n}${s?" with Pathway "+s:""}`);const l={level:e,attrs:a.attrs,details:a.details,bitrate:a.bitrate,averageBitrate:a.averageBitrate,maxBitrate:a.maxBitrate,realBitrate:a.realBitrate,width:a.width,height:a.height,codecSet:a.codecSet,audioCodec:a.audioCodec,videoCodec:a.videoCodec,audioGroups:a.audioGroups,subtitleGroups:a.subtitleGroups,loaded:a.loaded,loadError:a.loadError,fragmentError:a.fragmentError,name:a.name,id:a.id,uri:a.uri,url:a.url,urlId:0,audioGroupIds:a.audioGroupIds,textGroupIds:a.textGroupIds};this.hls.trigger(I.LEVEL_SWITCHING,l);const c=a.details;if(!c||c.live){const u=this.switchParams(a.uri,i==null?void 0:i.details,c);this.loadPlaylist(u)}}get manualLevel(){return this.manualLevelIndex}set manualLevel(e){this.manualLevelIndex=e,this._startLevel===void 0&&(this._startLevel=e),e!==-1&&(this.level=e)}get firstLevel(){return this._firstLevel}set firstLevel(e){this._firstLevel=e}get startLevel(){if(this._startLevel===void 0){const e=this.hls.config.startLevel;return e!==void 0?e:this.hls.firstAutoLevel}return this._startLevel}set startLevel(e){this._startLevel=e}get pathways(){return this.steering?this.steering.pathways():[]}get pathwayPriority(){return this.steering?this.steering.pathwayPriority:null}set pathwayPriority(e){if(this.steering){const r=this.steering.pathways(),n=e.filter(i=>r.indexOf(i)!==-1);if(e.length<1){this.warn(`pathwayPriority ${e} should contain at least one pathway from list: ${r}`);return}this.steering.pathwayPriority=n}}onError(e,r){r.fatal||!r.context||r.context.type===Ce.LEVEL&&r.context.level===this.level&&this.checkRetry(r)}onFragBuffered(e,{frag:r}){if(r!==void 0&&r.type===oe.MAIN){const n=r.elementaryStreams;if(!Object.keys(n).some(s=>!!n[s]))return;const i=this._levels[r.level];i!=null&&i.loadError&&(this.log(`Resetting level error count of ${i.loadError} on frag buffered`),i.loadError=0)}}onLevelLoaded(e,r){var n;const{level:i,details:s}=r,a=r.levelInfo;if(!a){var o;this.warn(`Invalid level index ${i}`),(o=r.deliveryDirectives)!=null&&o.skip&&(s.deltaUpdateFailed=!0);return}if(a===this.currentLevel||r.withoutMultiVariant){a.fragmentError===0&&(a.loadError=0);let l=a.details;l===r.details&&l.advanced&&(l=void 0),this.playlistLoaded(i,r,l)}else(n=r.deliveryDirectives)!=null&&n.skip&&(s.deltaUpdateFailed=!0)}loadPlaylist(e){super.loadPlaylist(),this.shouldLoadPlaylist(this.currentLevel)&&this.scheduleLoading(this.currentLevel,e)}loadingPlaylist(e,r){super.loadingPlaylist(e,r);const n=this.getUrlWithDirectives(e.uri,r),i=this.currentLevelIndex,s=e.attrs["PATHWAY-ID"],a=e.details,o=a==null?void 0:a.age;this.log(`Loading level index ${i}${(r==null?void 0:r.msn)!==void 0?" at sn "+r.msn+" part "+r.part:""}${s?" Pathway "+s:""}${o&&a.live?" age "+o.toFixed(1)+(a.type&&" "+a.type||""):""} ${n}`),this.hls.trigger(I.LEVEL_LOADING,{url:n,level:i,levelInfo:e,pathwayId:e.attrs["PATHWAY-ID"],id:0,deliveryDirectives:r||null})}get nextLoadLevel(){return this.manualLevelIndex!==-1?this.manualLevelIndex:this.hls.nextAutoLevel}set nextLoadLevel(e){this.level=e,this.manualLevelIndex===-1&&(this.hls.nextAutoLevel=e)}removeLevel(e){var r;if(this._levels.length===1)return;const n=this._levels.filter((s,a)=>a!==e?!0:(this.steering&&this.steering.removeLevel(s),s===this.currentLevel&&(this.currentLevel=null,this.currentLevelIndex=-1,s.details&&s.details.fragments.forEach(o=>o.level=-1)),!1));Bj(n),this._levels=n,this.currentLevelIndex>-1&&(r=this.currentLevel)!=null&&r.details&&(this.currentLevelIndex=this.currentLevel.details.fragments[0].level),this.manualLevelIndex>-1&&(this.manualLevelIndex=this.currentLevelIndex);const i=n.length-1;this._firstLevel=Math.min(this._firstLevel,i),this._startLevel&&(this._startLevel=Math.min(this._startLevel,i)),this.hls.trigger(I.LEVELS_UPDATED,{levels:n})}onLevelsUpdated(e,{levels:r}){this._levels=r}checkMaxAutoUpdated(){const{autoLevelCapping:e,maxAutoLevel:r,maxHdcpLevel:n}=this.hls;this._maxAutoLevel!==r&&(this._maxAutoLevel=r,this.hls.trigger(I.MAX_AUTO_LEVEL_UPDATED,{autoLevelCapping:e,levels:this.levels,maxAutoLevel:r,minAutoLevel:this.hls.minAutoLevel,maxHdcpLevel:n}))}}function iC(t){const e={};t.forEach(r=>{const n=r.groupId||"";r.id=e[n]=e[n]||0,e[n]++})}function N2(){return self.SourceBuffer||self.WebKitSourceBuffer}function M2(){if(!Ta())return!1;const e=N2();return!e||e.prototype&&typeof e.prototype.appendBuffer=="function"&&typeof e.prototype.remove=="function"}function yZ(){if(!M2())return!1;const t=Ta();
vendor: 38,884 bytes, line 289
289return typeof(t==null?void 0:t.isTypeSupported)=="function"&&(["avc1.42E01E,mp4a.40.2","av01.0.01M.08","vp09.00.50.08"].some(e=>t.isTypeSupported(ef(e,"video")))||["mp4a.40.2","fLaC"].some(e=>t.isTypeSupported(ef(e,"audio"))))}function bZ(){var t;const e=N2();return typeof(e==null||(t=e.prototype)==null?void 0:t.changeType)=="function"}const xZ=100;class wZ extends NT{constructor(e,r,n){super(e,r,n,"stream-controller",oe.MAIN),this.audioCodecSwap=!1,this.level=-1,this._forceStartLoad=!1,this._hasEnoughToStart=!1,this.altAudio=0,this.audioOnly=!1,this.fragPlaying=null,this.fragLastKbps=0,this.couldBacktrack=!1,this.backtrackFragment=null,this.audioCodecSwitch=!1,this.videoBuffer=null,this.onMediaPlaying=()=>{this.tick()},this.onMediaSeeked=()=>{const i=this.media,s=i?i.currentTime:null;if(s===null||!se(s)||(this.log(`Media seeked to ${s.toFixed(3)}`),!this.getBufferedFrag(s)))return;const a=this.getFwdBufferInfoAtPos(i,s,oe.MAIN,0);if(a===null||a.len===0){this.warn(`Main forward buffer length at ${s} on "seeked" event ${a?a.len:"empty"})`);return}this.tick()},this.registerListeners()}registerListeners(){super.registerListeners();const{hls:e}=this;e.on(I.MANIFEST_PARSED,this.onManifestParsed,this),e.on(I.LEVEL_LOADING,this.onLevelLoading,this),e.on(I.LEVEL_LOADED,this.onLevelLoaded,this),e.on(I.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),e.on(I.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(I.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.on(I.BUFFER_CREATED,this.onBufferCreated,this),e.on(I.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(I.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(I.FRAG_BUFFERED,this.onFragBuffered,this)}unregisterListeners(){super.unregisterListeners();const{hls:e}=this;e.off(I.MANIFEST_PARSED,this.onManifestParsed,this),e.off(I.LEVEL_LOADED,this.onLevelLoaded,this),e.off(I.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),e.off(I.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(I.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.off(I.BUFFER_CREATED,this.onBufferCreated,this),e.off(I.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(I.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(I.FRAG_BUFFERED,this.onFragBuffered,this)}onHandlerDestroying(){this.onMediaPlaying=this.onMediaSeeked=null,this.unregisterListeners(),super.onHandlerDestroying()}startLoad(e,r){if(this.levels){const{lastCurrentTime:n,hls:i}=this;if(this.stopLoad(),this.setInterval(xZ),this.level=-1,!this.startFragRequested){let s=i.startLevel;s===-1&&(i.config.testBandwidth&&this.levels.length>1?(s=0,this.bitrateTest=!0):s=i.firstAutoLevel),i.nextLoadLevel=s,this.level=i.loadLevel,this._hasEnoughToStart=!!r}n>0&&e===-1&&!r&&(this.log(`Override startPosition with lastCurrentTime @${n.toFixed(3)}`),e=n),this.state=Q.IDLE,this.nextLoadPosition=this.lastCurrentTime=e+this.timelineOffset,this.startPosition=r?-1:e,this.tick()}else this._forceStartLoad=!0,this.state=Q.STOPPED}stopLoad(){this._forceStartLoad=!1,super.stopLoad()}doTick(){switch(this.state){case Q.WAITING_LEVEL:{const{levels:e,level:r}=this,n=e==null?void 0:e[r],i=n==null?void 0:n.details;if(i&&(!i.live||this.levelLastLoaded===n&&!this.waitForLive(n))){if(this.waitForCdnTuneIn(i))break;this.state=Q.IDLE;break}else if(this.hls.nextLoadLevel!==this.level){this.state=Q.IDLE;break}break}case Q.FRAG_LOADING_WAITING_RETRY:this.checkRetryDate();break}this.state===Q.IDLE&&this.doTickIdle(),this.onTickEnd()}onTickEnd(){var e;super.onTickEnd(),(e=this.media)!=null&&e.readyState&&this.media.seeking===!1&&(this.lastCurrentTime=this.media.currentTime),this.checkFragmentChanged()}doTickIdle(){const{hls:e,levelLastLoaded:r,levels:n,media:i}=this;if(r===null||!i&&!this.primaryPrefetch&&(this.startFragRequested||!e.config.startFragPrefetch)||this.altAudio&&this.audioOnly)return;const s=this.buffering?e.nextLoadLevel:e.loadLevel;if(!(n!=null&&n[s]))return;const a=n[s],o=this.getMainFwdBufferInfo();if(o===null)return;const l=this.getLevelDetails();if(l&&this._streamEnded(o,l)){const g={};this.altAudio===2&&(g.type="video"),this.hls.trigger(I.BUFFER_EOS,g),this.state=Q.ENDED;return}if(!this.buffering)return;e.loadLevel!==s&&e.manualLevel===-1&&this.log(`Adapting to level ${s} from level ${this.level}`),this.level=e.nextLoadLevel=s;const c=a.details;if(!c||this.state===Q.WAITING_LEVEL||this.waitForLive(a)){this.level=s,this.state=Q.WAITING_LEVEL,this.startFragRequested=!1;return}const u=o.len,d=this.getMaxBufferLength(a.maxBitrate);if(u>=d)return;this.backtrackFragment&&this.backtrackFragment.start>o.end&&(this.backtrackFragment=null);const f=this.backtrackFragment?this.backtrackFragment.start:o.end;let h=this.getNextFragment(f,c);if(this.couldBacktrack&&!this.fragPrevious&&h&&Nt(h)&&this.fragmentTracker.getState(h)!==qt.OK){var p;const m=((p=this.backtrackFragment)!=null?p:h).sn-c.startSN,v=c.fragments[m-1];v&&h.cc===v.cc&&(h=v,this.fragmentTracker.removeFragment(v))}else this.backtrackFragment&&o.len&&(this.backtrackFragment=null);if(h&&this.isLoopLoading(h,f)){if(!h.gap){const m=this.audioOnly&&!this.altAudio?nt.AUDIO:nt.VIDEO,v=(m===nt.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;v&&this.afterBufferFlushed(v,m,oe.MAIN)}h=this.getNextFragmentLoopLoading(h,c,o,oe.MAIN,d)}h&&(h.initSegment&&!h.initSegment.data&&!this.bitrateTest&&(h=h.initSegment),this.loadFragment(h,a,f))}loadFragment(e,r,n){const i=this.fragmentTracker.getState(e);i===qt.NOT_LOADED||i===qt.PARTIAL?Nt(e)?this.bitrateTest?(this.log(`Fragment ${e.sn} of level ${e.level} is being downloaded to test bitrate and will not be buffered`),this._loadBitrateTestFrag(e,r)):super.loadFragment(e,r,n):this._loadInitSegment(e,r):this.clearTrackerIfNeeded(e)}getBufferedFrag(e){return this.fragmentTracker.getBufferedFrag(e,oe.MAIN)}followingBufferedFrag(e){return e?this.getBufferedFrag(e.end+.5):null}immediateLevelSwitch(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)}nextLevelSwitch(){const{levels:e,media:r}=this;if(r!=null&&r.readyState){let n;const i=this.getAppendedFrag(r.currentTime);i&&i.start>1&&this.flushMainBuffer(0,i.start-1);const s=this.getLevelDetails();if(s!=null&&s.live){const o=this.getMainFwdBufferInfo();if(!o||o.len<s.targetduration*2)return}if(!r.paused&&e){const o=this.hls.nextLoadLevel,l=e[o],c=this.fragLastKbps;c&&this.fragCurrent?n=this.fragCurrent.duration*l.maxBitrate/(1e3*c)+1:n=0}else n=0;const a=this.getBufferedFrag(r.currentTime+n);if(a){const o=this.followingBufferedFrag(a);if(o){this.abortCurrentFrag();const l=o.maxStartPTS?o.maxStartPTS:o.start,c=o.duration,u=Math.max(a.end,l+Math.min(Math.max(c-this.config.maxFragLookUpTolerance,c*(this.couldBacktrack?.5:.125)),c*(this.couldBacktrack?.75:.25)));this.flushMainBuffer(u,Number.POSITIVE_INFINITY)}}}}abortCurrentFrag(){const e=this.fragCurrent;switch(this.fragCurrent=null,this.backtrackFragment=null,e&&(e.abortRequests(),this.fragmentTracker.removeFragment(e)),this.state){case Q.KEY_LOADING:case Q.FRAG_LOADING:case Q.FRAG_LOADING_WAITING_RETRY:case Q.PARSING:case Q.PARSED:this.state=Q.IDLE;break}this.nextLoadPosition=this.getLoadPosition()}flushMainBuffer(e,r){super.flushMainBuffer(e,r,this.altAudio===2?"video":null)}onMediaAttached(e,r){super.onMediaAttached(e,r);const n=r.media;kr(n,"playing",this.onMediaPlaying),kr(n,"seeked",this.onMediaSeeked)}onMediaDetaching(e,r){const{media:n}=this;n&&(Gr(n,"playing",this.onMediaPlaying),Gr(n,"seeked",this.onMediaSeeked)),this.videoBuffer=null,this.fragPlaying=null,super.onMediaDetaching(e,r),!r.transferMedia&&(this._hasEnoughToStart=!1)}onManifestLoading(){super.onManifestLoading(),this.log("Trigger BUFFER_RESET"),this.hls.trigger(I.BUFFER_RESET,void 0),this.couldBacktrack=!1,this.fragLastKbps=0,this.fragPlaying=this.backtrackFragment=null,this.altAudio=0,this.audioOnly=!1}onManifestParsed(e,r){let n=!1,i=!1;for(let s=0;s<r.levels.length;s++){const a=r.levels[s].audioCodec;a&&(n=n||a.indexOf("mp4a.40.2")!==-1,i=i||a.indexOf("mp4a.40.5")!==-1)}this.audioCodecSwitch=n&&i&&!bZ(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=r.levels,this.startFragRequested=!1}onLevelLoading(e,r){const{levels:n}=this;if(!n||this.state!==Q.IDLE)return;const i=r.levelInfo;(!i.details||i.details.live&&(this.levelLastLoaded!==i||i.details.expired)||this.waitForCdnTuneIn(i.details))&&(this.state=Q.WAITING_LEVEL)}onLevelLoaded(e,r){var n;const{levels:i,startFragRequested:s}=this,a=r.level,o=r.details,l=o.totalduration;if(!i){this.warn(`Levels were reset while loading level ${a}`);return}this.log(`Level ${a} loaded [${o.startSN},${o.endSN}]${o.lastPartSn?`[part-${o.lastPartSn}-${o.lastPartIndex}]`:""}, cc [${o.startCC}, ${o.endCC}] duration:${l}`);const c=r.levelInfo,u=this.fragCurrent;u&&(this.state===Q.FRAG_LOADING||this.state===Q.FRAG_LOADING_WAITING_RETRY)&&u.level!==r.level&&u.loader&&this.abortCurrentFrag();let d=0;if(o.live||(n=c.details)!=null&&n.live){var f;if(this.checkLiveUpdate(o),o.deltaUpdateFailed)return;d=this.alignPlaylists(o,c.details,(f=this.levelLastLoaded)==null?void 0:f.details)}if(c.details=o,this.levelLastLoaded=c,s||this.setStartPosition(o,d),this.hls.trigger(I.LEVEL_UPDATED,{details:o,level:a}),this.state===Q.WAITING_LEVEL){if(this.waitForCdnTuneIn(o))return;this.state=Q.IDLE}s&&o.live&&this.synchronizeToLiveEdge(o),this.tick()}synchronizeToLiveEdge(e){const{config:r,media:n}=this;if(!n)return;const i=this.hls.liveSyncPosition,s=this.getLoadPosition(),a=e.fragmentStart,o=e.edge,l=s>=a-r.maxFragLookUpTolerance&&s<=o;if(i!==null&&n.duration>i&&(s<i||!l)){const u=r.liveMaxLatencyDuration!==void 0?r.liveMaxLatencyDuration:r.liveMaxLatencyDurationCount*e.targetduration;if((!l&&n.readyState<4||s<o-u)&&(this._hasEnoughToStart||(this.nextLoadPosition=i),n.readyState))if(this.warn(`Playback: ${s.toFixed(3)} is located too far from the end of live sliding playlist: ${o}, reset currentTime to : ${i.toFixed(3)}`),this.config.liveSyncMode==="buffered"){var c;const d=Se.bufferInfo(n,i,0);if(!((c=d.buffered)!=null&&c.length)){n.currentTime=i;return}if(d.start<=s){n.currentTime=i;return}const{nextStart:h}=Se.bufferedInfo(d.buffered,s,0);h&&(n.currentTime=h)}else n.currentTime=i}}_handleFragmentLoadProgress(e){var r;const n=e.frag,{part:i,payload:s}=e,{levels:a}=this;if(!a){this.warn(`Levels were reset while fragment load was in progress. Fragment ${n.sn} of level ${n.level} will not be buffered`);return}const o=a[n.level];if(!o){this.warn(`Level ${n.level} not found on progress`);return}const l=o.details;if(!l){this.warn(`Dropping fragment ${n.sn} of level ${n.level} after level details were reset`),this.fragmentTracker.removeFragment(n);return}const c=o.videoCodec,u=l.PTSKnown||!l.live,d=(r=n.initSegment)==null?void 0:r.data,f=this._getAudioCodec(o),h=this.transmuxer=this.transmuxer||new l2(this.hls,oe.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),p=i?i.index:-1,g=p!==-1,m=new kT(n.level,n.sn,n.stats.chunkCount,s.byteLength,p,g),v=this.initPTS[n.cc];h.push(s,d,f,c,n,i,l.totalduration,u,m,v)}onAudioTrackSwitching(e,r){const n=this.hls,i=this.altAudio!==0;if(jm(r.url,n))this.altAudio=1;else{if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;const a=this.fragCurrent;a&&(this.log("Switching to main audio track, cancel main fragment load"),a.abortRequests(),this.fragmentTracker.removeFragment(a)),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();if(i){this.altAudio=0,this.fragmentTracker.removeAllFragments(),n.once(I.BUFFER_FLUSHED,()=>{this.hls&&this.hls.trigger(I.AUDIO_TRACK_SWITCHED,r)}),n.trigger(I.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:null});return}n.trigger(I.AUDIO_TRACK_SWITCHED,r)}}onAudioTrackSwitched(e,r){const n=jm(r.url,this.hls);if(n){const i=this.videoBuffer;i&&this.mediaBuffer!==i&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=i)}this.altAudio=n?2:0,this.tick()}onBufferCreated(e,r){const n=r.tracks;let i,s,a=!1;for(const o in n){const l=n[o];if(l.id==="main"){if(s=o,i=l,o==="video"){const c=n[o];c&&(this.videoBuffer=c.buffer)}}else a=!0}a&&i?(this.log(`Alternate track found, use ${s}.buffered to schedule main fragment loading`),this.mediaBuffer=i.buffer):this.mediaBuffer=this.media}onFragBuffered(e,r){const{frag:n,part:i}=r,s=n.type===oe.MAIN;if(s){if(this.fragContextChanged(n)){this.warn(`Fragment ${n.sn}${i?" p: "+i.index:""} of level ${n.level} finished buffering, but was aborted. state: ${this.state}`),this.state===Q.PARSED&&(this.state=Q.IDLE);return}const o=i?i.stats:n.stats;this.fragLastKbps=Math.round(8*o.total/(o.buffering.end-o.loading.first)),Nt(n)&&(this.fragPrevious=n),this.fragBufferedComplete(n,i)}const a=this.media;a&&(!this._hasEnoughToStart&&Se.getBuffered(a).length&&(this._hasEnoughToStart=!0,this.seekToStartPos()),s&&this.tick())}get hasEnoughToStart(){return this._hasEnoughToStart}onError(e,r){var n;if(r.fatal){this.state=Q.ERROR;return}switch(r.details){case V.FRAG_GAP:case V.FRAG_PARSING_ERROR:case V.FRAG_DECRYPT_ERROR:case V.FRAG_LOAD_ERROR:case V.FRAG_LOAD_TIMEOUT:case V.KEY_LOAD_ERROR:case V.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(oe.MAIN,r);break;case V.LEVEL_LOAD_ERROR:case V.LEVEL_LOAD_TIMEOUT:case V.LEVEL_PARSING_ERROR:!r.levelRetry&&this.state===Q.WAITING_LEVEL&&((n=r.context)==null?void 0:n.type)===Ce.LEVEL&&(this.state=Q.IDLE);break;case V.BUFFER_ADD_CODEC_ERROR:case V.BUFFER_APPEND_ERROR:if(r.parent!=="main")return;this.reduceLengthAndFlushBuffer(r)&&this.resetLoadingState();break;case V.BUFFER_FULL_ERROR:if(r.parent!=="main")return;this.reduceLengthAndFlushBuffer(r)&&(!this.config.interstitialsController&&this.config.assetPlayerId?this._hasEnoughToStart=!0:this.flushMainBuffer(0,Number.POSITIVE_INFINITY));break;case V.INTERNAL_EXCEPTION:this.recoverWorkerError(r);break}}onFragLoadEmergencyAborted(){this.state=Q.IDLE,this._hasEnoughToStart||(this.startFragRequested=!1,this.nextLoadPosition=this.lastCurrentTime),this.tickImmediate()}onBufferFlushed(e,{type:r}){if(r!==nt.AUDIO||!this.altAudio){const n=(r===nt.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;n&&(this.afterBufferFlushed(n,r,oe.MAIN),this.tick())}}onLevelsUpdated(e,r){this.level>-1&&this.fragCurrent&&(this.level=this.fragCurrent.level,this.level===-1&&this.resetWhenMissingContext(this.fragCurrent)),this.levels=r.levels}swapAudioCodec(){this.audioCodecSwap=!this.audioCodecSwap}seekToStartPos(){const{media:e}=this;if(!e)return;const r=e.currentTime;let n=this.startPosition;if(n>=0&&r<n){if(e.seeking){this.log(`could not seek to ${n}, already seeking at ${r}`);return}const i=this.timelineOffset;i&&n&&(n+=i);const s=this.getLevelDetails(),a=Se.getBuffered(e),o=a.length?a.start(0):0,l=o-n,c=Math.max(this.config.maxBufferHole,this.config.maxFragLookUpTolerance);(this.config.startOnSegmentBoundary||l>0&&(l<c||this.loadingParts&&l<2*((s==null?void 0:s.partTarget)||0)))&&(this.log(`adjusting start position by ${l} to match buffer start`),n+=l,this.startPosition=n),r<n&&(this.log(`seek to target start position ${n} from current time ${r} buffer start ${o}`),e.currentTime=n)}}_getAudioCodec(e){let r=this.config.defaultAudioCodec||e.audioCodec;return this.audioCodecSwap&&r&&(this.log("Swapping audio codec"),r.indexOf("mp4a.40.5")!==-1?r="mp4a.40.2":r="mp4a.40.5"),r}_loadBitrateTestFrag(e,r){e.bitrateTest=!0,this._doFragLoad(e,r).then(n=>{const{hls:i}=this,s=n==null?void 0:n.frag;if(!s||this.fragContextChanged(s))return;r.fragmentError=0,this.state=Q.IDLE,this.startFragRequested=!1,this.bitrateTest=!1;const a=s.stats;a.parsing.start=a.parsing.end=a.buffering.start=a.buffering.end=self.performance.now(),i.trigger(I.FRAG_LOADED,n),s.bitrateTest=!1}).catch(n=>{this.state===Q.STOPPED||this.state===Q.ERROR||(this.warn(n),this.resetFragmentLoading(e))})}_handleTransmuxComplete(e){const r=this.playlistType,{hls:n}=this,{remuxResult:i,chunkMeta:s}=e,a=this.getCurrentContext(s);if(!a){this.resetWhenMissingContext(s);return}const{frag:o,part:l,level:c}=a,{video:u,text:d,id3:f,initSegment:h}=i,{details:p}=c,g=this.altAudio?void 0:i.audio;if(this.fragContextChanged(o)){this.fragmentTracker.removeFragment(o);return}if(this.state=Q.PARSING,h){const m=h.tracks;if(m){const w=o.initSegment||o;if(this.unhandledEncryptionError(h,o))return;this._bufferInitSegment(c,m,w,s),n.trigger(I.FRAG_PARSING_INIT_SEGMENT,{frag:w,id:r,tracks:m})}const v=h.initPTS,y=h.timescale,b=this.initPTS[o.cc];if(se(v)&&(!b||b.baseTime!==v||b.timescale!==y)){const w=h.trackId;this.initPTS[o.cc]={baseTime:v,timescale:y,trackId:w},n.trigger(I.INIT_PTS_FOUND,{frag:o,id:r,initPTS:v,timescale:y,trackId:w})}}if(u&&p){g&&u.type==="audiovideo"&&this.logMuxedErr(o);const m=p.fragments[o.sn-1-p.startSN],v=o.sn===p.startSN,y=!m||o.cc>m.cc;if(i.independent!==!1){const{startPTS:b,endPTS:w,startDTS:S,endDTS:T}=u;if(l)l.elementaryStreams[u.type]={startPTS:b,endPTS:w,startDTS:S,endDTS:T};else if(u.firstKeyFrame&&u.independent&&s.id===1&&!y&&(this.couldBacktrack=!0),u.dropped&&u.independent){const _=this.getMainFwdBufferInfo(),A=(_?_.end:this.getLoadPosition())+this.config.maxBufferHole,P=u.firstKeyFramePTS?u.firstKeyFramePTS:b;if(!v&&A<P-this.config.maxBufferHole&&!y){this.backtrack(o);return}else y&&(o.gap=!0);o.setElementaryStreamInfo(u.type,o.start,w,o.start,T,!0)}else v&&b-(p.appliedTimelineOffset||0)>qp&&(o.gap=!0);o.setElementaryStreamInfo(u.type,b,w,S,T),this.backtrackFragment&&(this.backtrackFragment=o),this.bufferFragmentData(u,o,l,s,v||y)}else if(v||y)o.gap=!0;else{this.backtrack(o);return}}if(g){const{startPTS:m,endPTS:v,startDTS:y,endDTS:b}=g;l&&(l.elementaryStreams[nt.AUDIO]={startPTS:m,endPTS:v,startDTS:y,endDTS:b}),o.setElementaryStreamInfo(nt.AUDIO,m,v,y,b),this.bufferFragmentData(g,o,l,s)}if(p&&f!=null&&f.samples.length){const m={id:r,frag:o,details:p,samples:f.samples};n.trigger(I.FRAG_PARSING_METADATA,m)}if(p&&d){const m={id:r,frag:o,details:p,samples:d.samples};n.trigger(I.FRAG_PARSING_USERDATA,m)}}logMuxedErr(e){this.warn(`${Nt(e)?"Media":"Init"} segment with muxed audiovideo where only video expected: ${e.url}`)}_bufferInitSegment(e,r,n,i){if(this.state!==Q.PARSING)return;this.audioOnly=!!r.audio&&!r.video,this.altAudio&&!this.audioOnly&&(delete r.audio,r.audiovideo&&this.logMuxedErr(n));const{audio:s,video:a,audiovideo:o}=r;if(s){const c=e.audioCodec;let u=Up(s.codec,c);u==="mp4a"&&(u="mp4a.40.5");const d=navigator.userAgent.toLowerCase();if(this.audioCodecSwitch){u&&(u.indexOf("mp4a.40.5")!==-1?u="mp4a.40.2":u="mp4a.40.5");const f=s.metadata;f&&"channelCount"in f&&(f.channelCount||1)!==1&&d.indexOf("firefox")===-1&&(u="mp4a.40.5")}u&&u.indexOf("mp4a.40.5")!==-1&&d.indexOf("android")!==-1&&s.container!=="audio/mpeg"&&(u="mp4a.40.2",this.log(`Android: force audio codec to ${u}`)),c&&c!==u&&this.log(`Swapping manifest audio codec "${c}" for "${u}"`),s.levelCodec=u,s.id=oe.MAIN,this.log(`Init audio buffer, container:${s.container}, codecs[selected/level/parsed]=[${u||""}/${c||""}/${s.codec}]`),delete r.audiovideo}if(a){a.levelCodec=e.videoCodec,a.id=oe.MAIN;const c=a.codec;if((c==null?void 0:c.length)===4)switch(c){case"hvc1":case"hev1":a.codec="hvc1.1.6.L120.90";break;case"av01":a.codec="av01.0.04M.08";break;case"avc1":a.codec="avc1.42e01e";break}this.log(`Init video buffer, container:${a.container}, codecs[level/parsed]=[${e.videoCodec||""}/${c}]${a.codec!==c?" parsed-corrected="+a.codec:""}${a.supplemental?" supplemental="+a.supplemental:""}`),delete r.audiovideo}o&&(this.log(`Init audiovideo buffer, container:${o.container}, codecs[level/parsed]=[${e.codecs}/${o.codec}]`),delete r.video,delete r.audio);const l=Object.keys(r);if(l.length){if(this.hls.trigger(I.BUFFER_CODECS,r),!this.hls)return;l.forEach(c=>{const d=r[c].initSegment;d!=null&&d.byteLength&&this.hls.trigger(I.BUFFER_APPENDING,{type:c,data:d,frag:n,part:null,chunkMeta:i,parent:n.type})})}this.tickImmediate()}getMainFwdBufferInfo(){const e=this.mediaBuffer&&this.altAudio===2?this.mediaBuffer:this.media;return this.getFwdBufferInfo(e,oe.MAIN)}get maxBufferLength(){const{levels:e,level:r}=this,n=e==null?void 0:e[r];return n?this.getMaxBufferLength(n.maxBitrate):this.config.maxBufferLength}backtrack(e){this.couldBacktrack=!0,this.backtrackFragment=e,this.resetTransmuxer(),this.flushBufferGap(e),this.fragmentTracker.removeFragment(e),this.fragPrevious=null,this.nextLoadPosition=e.start,this.state=Q.IDLE}checkFragmentChanged(){const e=this.media;let r=null;if(e&&e.readyState>1&&e.seeking===!1){const n=e.currentTime;if(Se.isBuffered(e,n)?r=this.getAppendedFrag(n):Se.isBuffered(e,n+.1)&&(r=this.getAppendedFrag(n+.1)),r){this.backtrackFragment=null;const i=this.fragPlaying,s=r.level;(!i||r.sn!==i.sn||i.level!==s)&&(this.fragPlaying=r,this.hls.trigger(I.FRAG_CHANGED,{frag:r}),(!i||i.level!==s)&&this.hls.trigger(I.LEVEL_SWITCHED,{level:s}))}}}get nextLevel(){const e=this.nextBufferedFrag;return e?e.level:-1}get currentFrag(){var e;if(this.fragPlaying)return this.fragPlaying;const r=((e=this.media)==null?void 0:e.currentTime)||this.lastCurrentTime;return se(r)?this.getAppendedFrag(r):null}get currentProgramDateTime(){var e;const r=((e=this.media)==null?void 0:e.currentTime)||this.lastCurrentTime;if(se(r)){const n=this.getLevelDetails(),i=this.currentFrag||(n?jo(null,n.fragments,r):null);if(i){const s=i.programDateTime;if(s!==null){const a=s+(r-i.start)*1e3;return new Date(a)}}}return null}get currentLevel(){const e=this.currentFrag;return e?e.level:-1}get nextBufferedFrag(){const e=this.currentFrag;return e?this.followingBufferedFrag(e):null}get forceStartLoad(){return this._forceStartLoad}}class SZ extends Dn{constructor(e,r){super("key-loader",r),this.config=void 0,this.keyIdToKeyInfo={},this.emeController=null,this.config=e}abort(e){for(const n in this.keyIdToKeyInfo){const i=this.keyIdToKeyInfo[n].loader;if(i){var r;if(e&&e!==((r=i.context)==null?void 0:r.frag.type))return;i.abort()}}}detach(){for(const e in this.keyIdToKeyInfo){const r=this.keyIdToKeyInfo[e];(r.mediaKeySessionContext||r.decryptdata.isCommonEncryption)&&delete this.keyIdToKeyInfo[e]}}destroy(){this.detach();for(const e in this.keyIdToKeyInfo){const r=this.keyIdToKeyInfo[e].loader;r&&r.destroy()}this.keyIdToKeyInfo={}}createKeyLoadError(e,r=V.KEY_LOAD_ERROR,n,i,s){return new rs({type:fe.NETWORK_ERROR,details:r,fatal:!1,frag:e,response:s,error:n,networkDetails:i})}loadClear(e,r,n){if(this.emeController&&this.config.emeEnabled&&!this.emeController.getSelectedKeySystemFormats().length){if(r.length)for(let i=0,s=r.length;i<s;i++){const a=r[i];if(e.cc<=a.cc&&(!Nt(e)||!Nt(a)||e.sn<a.sn)||!n&&i==s-1)return this.emeController.selectKeySystemFormat(a).then(o=>{if(!this.emeController)return;a.setKeyFormat(o);const l=Wp(o);if(l)return this.emeController.getKeySystemAccess([l])})}if(this.config.requireKeySystemAccessOnStart){const i=ed(this.config);if(i.length)return this.emeController.getKeySystemAccess(i)}}return null}load(e){return!e.decryptdata&&e.encrypted&&this.emeController&&this.config.emeEnabled?this.emeController.selectKeySystemFormat(e).then(r=>this.loadInternal(e,r)):this.loadInternal(e)}loadInternal(e,r){var n,i;r&&e.setKeyFormat(r);const s=e.decryptdata;if(!s){const c=new Error(r?`Expected frag.decryptdata to be defined after setting format ${r}`:`Missing decryption data on fragment in onKeyLoading (emeEnabled with controller: ${this.emeController&&this.config.emeEnabled})`);return Promise.reject(this.createKeyLoadError(e,V.KEY_LOAD_ERROR,c))}const a=s.uri;if(!a)return Promise.reject(this.createKeyLoadError(e,V.KEY_LOAD_ERROR,new Error(`Invalid key URI: "${a}"`)));const o=W0(s);let l=this.keyIdToKeyInfo[o];if((n=l)!=null&&n.decryptdata.key)return s.key=l.decryptdata.key,Promise.resolve({frag:e,keyInfo:l});if(this.emeController&&(i=l)!=null&&i.keyLoadPromise)switch(this.emeController.getKeyStatus(l.decryptdata)){case"usable":case"usable-in-future":return l.keyLoadPromise.then(u=>{const{keyInfo:d}=u;return s.key=d.decryptdata.key,{frag:e,keyInfo:d}})}switch(this.log(`${this.keyIdToKeyInfo[o]?"Rel":"L"}oading${s.keyId?" keyId: "+pr(s.keyId):""} URI: ${s.uri} from ${e.type} ${e.level}`),l=this.keyIdToKeyInfo[o]={decryptdata:s,keyLoadPromise:null,loader:null,mediaKeySessionContext:null},s.method){case"SAMPLE-AES":case"SAMPLE-AES-CENC":case"SAMPLE-AES-CTR":return s.keyFormat==="identity"?this.loadKeyHTTP(l,e):this.loadKeyEME(l,e);case"AES-128":case"AES-256":case"AES-256-CTR":return this.loadKeyHTTP(l,e);default:return Promise.reject(this.createKeyLoadError(e,V.KEY_LOAD_ERROR,new Error(`Key supplied with unsupported METHOD: "${s.method}"`)))}}loadKeyEME(e,r){const n={frag:r,keyInfo:e};if(this.emeController&&this.config.emeEnabled){var i;if(!e.decryptdata.keyId&&(i=r.initSegment)!=null&&i.data){const a=UY(r.initSegment.data);if(a.length){let o=a[0];o.some(l=>l!==0)?(this.log(`Using keyId found in init segment ${pr(o)}`),ya.setKeyIdForUri(e.decryptdata.uri,o)):(o=ya.addKeyIdForUri(e.decryptdata.uri),this.log(`Generating keyId to patch media ${pr(o)}`)),e.decryptdata.keyId=o}}if(!e.decryptdata.keyId&&!Nt(r))return Promise.resolve(n);const s=this.emeController.loadKey(n);return(e.keyLoadPromise=s.then(a=>(e.mediaKeySessionContext=a,n))).catch(a=>{throw e.keyLoadPromise=null,"data"in a&&(a.data.frag=r),a})}return Promise.resolve(n)}loadKeyHTTP(e,r){const n=this.config,i=n.loader,s=new i(n);return r.keyLoader=e.loader=s,e.keyLoadPromise=new Promise((a,o)=>{const l={keyInfo:e,frag:r,responseType:"arraybuffer",url:e.decryptdata.uri},c=n.keyLoadPolicy.default,u={loadPolicy:c,timeout:c.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},d={onSuccess:(f,h,p,g)=>{const{frag:m,keyInfo:v}=p,y=W0(v.decryptdata);if(!m.decryptdata||v!==this.keyIdToKeyInfo[y])return o(this.createKeyLoadError(m,V.KEY_LOAD_ERROR,new Error("after key load, decryptdata unset or changed"),g));v.decryptdata.key=m.decryptdata.key=new Uint8Array(f.data),m.keyLoader=null,v.loader=null,a({frag:m,keyInfo:v})},onError:(f,h,p,g)=>{this.resetLoader(h),o(this.createKeyLoadError(r,V.KEY_LOAD_ERROR,new Error(`HTTP Error ${f.code} loading key ${f.text}`),p,Ve({url:l.url,data:void 0},f)))},onTimeout:(f,h,p)=>{this.resetLoader(h),o(this.createKeyLoadError(r,V.KEY_LOAD_TIMEOUT,new Error("key loading timed out"),p))},onAbort:(f,h,p)=>{this.resetLoader(h),o(this.createKeyLoadError(r,V.INTERNAL_ABORTED,new Error("key loading aborted"),p))}};s.load(l,u,d)})}resetLoader(e){const{frag:r,keyInfo:n,url:i}=e,s=n.loader;r.keyLoader===s&&(r.keyLoader=null,n.loader=null);const a=W0(n.decryptdata)||i;delete this.keyIdToKeyInfo[a],s&&s.destroy()}}function W0(t){if(t.keyFormat!==mr.FAIRPLAY){const e=t.keyId;if(e)return pr(e)}return t.uri}function sC(t){const{type:e}=t;switch(e){case Ce.AUDIO_TRACK:return oe.AUDIO;case Ce.SUBTITLE_TRACK:return oe.SUBTITLE;default:return oe.MAIN}}function V0(t,e){let r=t.url;return(r===void 0||r.indexOf("data:")===0)&&(r=e.url),r}class EZ{constructor(e){this.hls=void 0,this.loaders=Object.create(null),this.variableList=null,this.onManifestLoaded=this.checkAutostartLoad,this.hls=e,this.registerListeners()}startLoad(e){}stopLoad(){this.destroyInternalLoaders()}registerListeners(){const{hls:e}=this;e.on(I.MANIFEST_LOADING,this.onManifestLoading,this),e.on(I.LEVEL_LOADING,this.onLevelLoading,this),e.on(I.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.on(I.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this),e.on(I.LEVELS_UPDATED,this.onLevelsUpdated,this)}unregisterListeners(){const{hls:e}=this;e.off(I.MANIFEST_LOADING,this.onManifestLoading,this),e.off(I.LEVEL_LOADING,this.onLevelLoading,this),e.off(I.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.off(I.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this),e.off(I.LEVELS_UPDATED,this.onLevelsUpdated,this)}createInternalLoader(e){const r=this.hls.config,n=r.pLoader,i=r.loader,s=n||i,a=new s(r);return this.loaders[e.type]=a,a}getInternalLoader(e){return this.loaders[e.type]}resetInternalLoader(e){this.loaders[e]&&delete this.loaders[e]}destroyInternalLoaders(){for(const e in this.loaders){const r=this.loaders[e];r&&r.destroy(),this.resetInternalLoader(e)}}destroy(){this.variableList=null,this.unregisterListeners(),this.destroyInternalLoaders()}onManifestLoading(e,r){const{url:n}=r;this.variableList=null,this.load({id:null,level:0,responseType:"text",type:Ce.MANIFEST,url:n,deliveryDirectives:null,levelOrTrack:null})}onLevelLoading(e,r){const{id:n,level:i,pathwayId:s,url:a,deliveryDirectives:o,levelInfo:l}=r;this.load({id:n,level:i,pathwayId:s,responseType:"text",type:Ce.LEVEL,url:a,deliveryDirectives:o,levelOrTrack:l})}onAudioTrackLoading(e,r){const{id:n,groupId:i,url:s,deliveryDirectives:a,track:o}=r;this.load({id:n,groupId:i,level:null,responseType:"text",type:Ce.AUDIO_TRACK,url:s,deliveryDirectives:a,levelOrTrack:o})}onSubtitleTrackLoading(e,r){const{id:n,groupId:i,url:s,deliveryDirectives:a,track:o}=r;this.load({id:n,groupId:i,level:null,responseType:"text",type:Ce.SUBTITLE_TRACK,url:s,deliveryDirectives:a,levelOrTrack:o})}onLevelsUpdated(e,r){const n=this.loaders[Ce.LEVEL];if(n){const i=n.context;i&&!r.levels.some(s=>s===i.levelOrTrack)&&(n.abort(),delete this.loaders[Ce.LEVEL])}}load(e){var r;const n=this.hls.config;let i=this.getInternalLoader(e);if(i){const c=this.hls.logger,u=i.context;if(u&&u.levelOrTrack===e.levelOrTrack&&(u.url===e.url||u.deliveryDirectives&&!e.deliveryDirectives)){u.url===e.url?c.log(`[playlist-loader]: ignore ${e.url} ongoing request`):c.log(`[playlist-loader]: ignore ${e.url} in favor of ${u.url}`);return}c.log(`[playlist-loader]: aborting previous loader for type: ${e.type}`),i.abort()}let s;if(e.type===Ce.MANIFEST?s=n.manifestLoadPolicy.default:s=et({},n.playlistLoadPolicy.default,{timeoutRetry:null,errorRetry:null}),i=this.createInternalLoader(e),se((r=e.deliveryDirectives)==null?void 0:r.part)){let c;if(e.type===Ce.LEVEL&&e.level!==null?c=this.hls.levels[e.level].details:e.type===Ce.AUDIO_TRACK&&e.id!==null?c=this.hls.audioTracks[e.id].details:e.type===Ce.SUBTITLE_TRACK&&e.id!==null&&(c=this.hls.subtitleTracks[e.id].details),c){const u=c.partTarget,d=c.targetduration;if(u&&d){const f=Math.max(u*3,d*.8)*1e3;s=et({},s,{maxTimeToFirstByteMs:Math.min(f,s.maxTimeToFirstByteMs),maxLoadTimeMs:Math.min(f,s.maxTimeToFirstByteMs)})}}}const a=s.errorRetry||s.timeoutRetry||{},o={loadPolicy:s,timeout:s.maxLoadTimeMs,maxRetry:a.maxNumRetry||0,retryDelay:a.retryDelayMs||0,maxRetryDelay:a.maxRetryDelayMs||0},l={onSuccess:(c,u,d,f)=>{const h=this.getInternalLoader(d);this.resetInternalLoader(d.type);const p=c.data;u.parsing.start=performance.now(),Ci.isMediaPlaylist(p)||d.type!==Ce.MANIFEST?this.handleTrackOrLevelPlaylist(c,u,d,f||null,h):this.handleMasterPlaylist(c,u,d,f)},onError:(c,u,d,f)=>{this.handleNetworkError(u,d,!1,c,f)},onTimeout:(c,u,d)=>{this.handleNetworkError(u,d,!0,void 0,c)}};i.load(e,o,l)}checkAutostartLoad(){if(!this.hls)return;const{config:{autoStartLoad:e,startPosition:r},forceStartLoad:n}=this.hls;(e||n)&&(this.hls.logger.log(`${e?"auto":"force"} startLoad with configured startPosition ${r}`),this.hls.startLoad(r))}handleMasterPlaylist(e,r,n,i){const s=this.hls,a=e.data,o=V0(e,n),l=Ci.parseMasterPlaylist(a,o);if(l.playlistParsingError){r.parsing.end=performance.now(),this.handleManifestParsingError(e,n,l.playlistParsingError,i,r);return}const{contentSteering:c,levels:u,sessionData:d,sessionKeys:f,startTimeOffset:h,variableList:p}=l;this.variableList=p,u.forEach(y=>{const{unknownCodecs:b}=y;if(b){const{preferManagedMediaSource:w}=this.hls.config;let{audioCodec:S,videoCodec:T}=y;for(let _=b.length;_--;){const A=b[_];Zd(A,"audio",w)?(y.audioCodec=S=S?`${S},${A}`:A,Tc.audio[S.substring(0,4)]=2,b.splice(_,1)):Zd(A,"video",w)&&(y.videoCodec=T=T?`${T},${A}`:A,Tc.video[T.substring(0,4)]=2,b.splice(_,1))}}});const{AUDIO:g=[],SUBTITLES:m,"CLOSED-CAPTIONS":v}=Ci.parseMasterPlaylistMedia(a,o,l);g.length&&!g.some(b=>!b.url)&&u[0].audioCodec&&!u[0].attrs.AUDIO&&(this.hls.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),g.unshift({type:"main",name:"main",groupId:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new St({}),bitrate:0,url:""})),s.trigger(I.MANIFEST_LOADED,{levels:u,audioTracks:g,subtitles:m,captions:v,contentSteering:c,url:o,stats:r,networkDetails:i,sessionData:d,sessionKeys:f,startTimeOffset:h,variableList:p})}handleTrackOrLevelPlaylist(e,r,n,i,s){const a=this.hls,{id:o,level:l,type:c}=n,u=V0(e,n),d=se(l)?l:se(o)?o:0,f=sC(n),h=Ci.parseLevelPlaylist(e.data,u,d,f,0,this.variableList);if(c===Ce.MANIFEST){const p={attrs:new St({}),bitrate:0,details:h,name:"",url:u};h.requestScheduled=r.loading.start+$j(h,0),a.trigger(I.MANIFEST_LOADED,{levels:[p],audioTracks:[],url:u,stats:r,networkDetails:i,sessionData:null,sessionKeys:null,contentSteering:null,startTimeOffset:null,variableList:null})}r.parsing.end=performance.now(),n.levelDetails=h,this.handlePlaylistLoaded(h,e,r,n,i,s)}handleManifestParsingError(e,r,n,i,s){this.hls.trigger(I.ERROR,{type:fe.NETWORK_ERROR,details:V.MANIFEST_PARSING_ERROR,fatal:r.type===Ce.MANIFEST,url:e.url,err:n,error:n,reason:n.message,response:e,context:r,networkDetails:i,stats:s})}handleNetworkError(e,r,n=!1,i,s){let a=`A network ${n?"timeout":"error"+(i?" (status "+i.code+")":"")} occurred while loading ${e.type}`;e.type===Ce.LEVEL?a+=`: ${e.level} id: ${e.id}`:(e.type===Ce.AUDIO_TRACK||e.type===Ce.SUBTITLE_TRACK)&&(a+=` id: ${e.id} group-id: "${e.groupId}"`);const o=new Error(a);this.hls.logger.warn(`[playlist-loader]: ${a}`);let l=V.UNKNOWN,c=!1;const u=this.getInternalLoader(e);switch(e.type){case Ce.MANIFEST:l=n?V.MANIFEST_LOAD_TIMEOUT:V.MANIFEST_LOAD_ERROR,c=!0;break;case Ce.LEVEL:l=n?V.LEVEL_LOAD_TIMEOUT:V.LEVEL_LOAD_ERROR,c=!1;break;case Ce.AUDIO_TRACK:l=n?V.AUDIO_TRACK_LOAD_TIMEOUT:V.AUDIO_TRACK_LOAD_ERROR,c=!1;break;case Ce.SUBTITLE_TRACK:l=n?V.SUBTITLE_TRACK_LOAD_TIMEOUT:V.SUBTITLE_LOAD_ERROR,c=!1;break}u&&this.resetInternalLoader(e.type);const d={type:fe.NETWORK_ERROR,details:l,fatal:c,url:e.url,loader:u,context:e,error:o,networkDetails:r,stats:s};if(i){const f=(r==null?void 0:r.url)||e.url;d.response=Ve({url:f,data:void 0},i)}this.hls.trigger(I.ERROR,d)}handlePlaylistLoaded(e,r,n,i,s,a){const o=this.hls,{type:l,level:c,levelOrTrack:u,id:d,groupId:f,deliveryDirectives:h}=i,p=V0(r,i),g=sC(i);let m=typeof i.level=="number"&&g===oe.MAIN?c:void 0;const v=e.playlistParsingError;if(v){if(this.hls.logger.warn(`${v} ${e.url}`),!o.config.ignorePlaylistParsingErrors){o.trigger(I.ERROR,{type:fe.NETWORK_ERROR,details:V.LEVEL_PARSING_ERROR,fatal:!1,url:p,error:v,reason:v.message,response:r,context:i,level:m,parent:g,networkDetails:s,stats:n});return}e.playlistParsingError=null}if(!e.fragments.length){const y=e.playlistParsingError=new Error("No Segments found in Playlist");o.trigger(I.ERROR,{type:fe.NETWORK_ERROR,details:V.LEVEL_EMPTY_ERROR,fatal:!1,url:p,error:y,reason:y.message,response:r,context:i,level:m,parent:g,networkDetails:s,stats:n});return}switch(e.live&&a&&(a.getCacheAge&&(e.ageHeader=a.getCacheAge()||0),(!a.getCacheAge||isNaN(e.ageHeader))&&(e.ageHeader=0)),l){case Ce.MANIFEST:case Ce.LEVEL:if(m){if(!u)m=0;else if(u!==o.levels[m]){const y=o.levels.indexOf(u);y>-1&&(m=y)}}o.trigger(I.LEVEL_LOADED,{details:e,levelInfo:u||o.levels[0],level:m||0,id:d||0,stats:n,networkDetails:s,deliveryDirectives:h,withoutMultiVariant:l===Ce.MANIFEST});break;case Ce.AUDIO_TRACK:o.trigger(I.AUDIO_TRACK_LOADED,{details:e,track:u,id:d||0,groupId:f||"",stats:n,networkDetails:s,deliveryDirectives:h});break;case Ce.SUBTITLE_TRACK:o.trigger(I.SUBTITLE_TRACK_LOADED,{details:e,track:u,id:d||0,groupId:f||"",stats:n,networkDetails:s,deliveryDirectives:h});break}}}class ln{static get version(){return rf}static isMSESupported(){return M2()}static isSupported(){return yZ()}static getMediaSource(){return Ta()}static get Events(){return I}static get MetadataSchema(){return an}static get ErrorTypes(){return fe}static get ErrorDetails(){return V}static get DefaultConfig(){return ln.defaultConfig?ln.defaultConfig:aZ}static set DefaultConfig(e){ln.defaultConfig=e}constructor(e={}){this.config=void 0,this.userConfig=void 0,this.logger=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this._emitter=new MT,this._autoLevelCapping=-1,this._maxHdcpLevel=null,this.abrController=void 0,this.bufferController=void 0,this.capLevelController=void 0,this.latencyController=void 0,this.levelController=void 0,this.streamController=void 0,this.audioStreamController=void 0,this.subtititleStreamController=void 0,this.audioTrackController=void 0,this.subtitleTrackController=void 0,this.interstitialsController=void 0,this.gapController=void 0,this.emeController=void 0,this.cmcdController=void 0,this._media=null,this._url=null,this._sessionId=void 0,this.triggeringException=void 0,this.started=!1;const r=this.logger=CY(e.debug||!1,"Hls instance",e.assetPlayerId),n=this.config=lZ(ln.DefaultConfig,e,r);this.userConfig=e,n.progressive&&cZ(n,r);const{abrController:i,bufferController:s,capLevelController:a,errorController:o,fpsController:l}=n,c=new o(this),u=this.abrController=new i(this),d=new T7(this),f=n.interstitialsController,h=f?this.interstitialsController=new f(this,ln):null,p=this.bufferController=new s(this,d),g=this.capLevelController=new a(this),m=new l(this),v=new EZ(this),y=n.contentSteeringController,b=y?new y(this):null,w=this.levelController=new vZ(this,b),S=new mZ(this),T=new SZ(this.config,this.logger),_=this.streamController=new wZ(this,d,T),A=this.gapController=new hZ(this,d);g.setStreamController(_),m.setStreamController(_);const P=[v,w,_];h&&P.splice(1,0,h),b&&P.splice(1,0,b),this.networkControllers=P;const C=[u,p,A,g,m,S,d];this.audioTrackController=this.createController(n.audioTrackController,P);const O=n.audioStreamController;O&&P.push(this.audioStreamController=new O(this,d,T)),this.subtitleTrackController=this.createController(n.subtitleTrackController,P);const R=n.subtitleStreamController;R&&P.push(this.subtititleStreamController=new R(this,d,T)),this.createController(n.timelineController,C),T.emeController=this.emeController=this.createController(n.emeController,C),this.cmcdController=this.createController(n.cmcdController,C),this.latencyController=this.createController(gZ,C),this.coreComponents=C,P.push(c);const D=c.onErrorOut;typeof D=="function"&&this.on(I.ERROR,D,c),this.on(I.MANIFEST_LOADED,v.onManifestLoaded,v)}createController(e,r){if(e){const n=new e(this);return r&&r.push(n),n}return null}on(e,r,n=this){this._emitter.on(e,r,n)}once(e,r,n=this){this._emitter.once(e,r,n)}removeAllListeners(e){this._emitter.removeAllListeners(e)}off(e,r,n=this,i){this._emitter.off(e,r,n,i)}listeners(e){return this._emitter.listeners(e)}emit(e,r,n){return this._emitter.emit(e,r,n)}
vendor: 6,312 bytes, line 289
289trigger(e,r){if(this.config.debug)return this.emit(e,e,r);try{return this.emit(e,e,r)}catch(n){if(this.logger.error("An internal error happened while handling event "+e+'. Error message: "'+n.message+'". Here is a stacktrace:',n),!this.triggeringException){this.triggeringException=!0;const i=e===I.ERROR;this.trigger(I.ERROR,{type:fe.OTHER_ERROR,details:V.INTERNAL_EXCEPTION,fatal:i,event:e,error:n}),this.triggeringException=!1}}return!1}listenerCount(e){return this._emitter.listenerCount(e)}destroy(){this.logger.log("destroy"),this.trigger(I.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this._url=null,this.networkControllers.forEach(r=>r.destroy()),this.networkControllers.length=0,this.coreComponents.forEach(r=>r.destroy()),this.coreComponents.length=0;const e=this.config;e.xhrSetup=e.fetchSetup=void 0,this.userConfig=null}attachMedia(e){if(!e||"media"in e&&!e.media){const s=new Error(`attachMedia failed: invalid argument (${e})`);this.trigger(I.ERROR,{type:fe.OTHER_ERROR,details:V.ATTACH_MEDIA_ERROR,fatal:!0,error:s});return}this.logger.log("attachMedia"),this._media&&(this.logger.warn("media must be detached before attaching"),this.detachMedia());const r="media"in e,n=r?e.media:e,i=r?e:{media:n};this._media=n,this.trigger(I.MEDIA_ATTACHING,i)}detachMedia(){this.logger.log("detachMedia"),this.trigger(I.MEDIA_DETACHING,{}),this._media=null}transferMedia(){this._media=null;const e=this.bufferController.transferMedia();return this.trigger(I.MEDIA_DETACHING,{transferMedia:e}),e}loadSource(e){this.stopLoad();const r=this.media,n=this._url,i=this._url=_T.buildAbsoluteURL(self.location.href,e,{alwaysNormalize:!0});this._autoLevelCapping=-1,this._maxHdcpLevel=null,this.logger.log(`loadSource:${i}`),r&&n&&(n!==i||this.bufferController.hasSourceTypes())&&(this.detachMedia(),this.attachMedia(r)),this.trigger(I.MANIFEST_LOADING,{url:e})}get url(){return this._url}get hasEnoughToStart(){return this.streamController.hasEnoughToStart}get startPosition(){return this.streamController.startPositionValue}startLoad(e=-1,r){this.logger.log(`startLoad(${e+(r?", <skip seek to start>":"")})`),this.started=!0,this.resumeBuffering();for(let n=0;n<this.networkControllers.length&&(this.networkControllers[n].startLoad(e,r),!(!this.started||!this.networkControllers));n++);}stopLoad(){this.logger.log("stopLoad"),this.started=!1;for(let e=0;e<this.networkControllers.length&&(this.networkControllers[e].stopLoad(),!(this.started||!this.networkControllers));e++);}get loadingEnabled(){return this.started}get bufferingEnabled(){return this.streamController.bufferingEnabled}resumeBuffering(){this.bufferingEnabled||(this.logger.log("resume buffering"),this.networkControllers.forEach(e=>{e.resumeBuffering&&e.resumeBuffering()}))}pauseBuffering(){this.bufferingEnabled&&(this.logger.log("pause buffering"),this.networkControllers.forEach(e=>{e.pauseBuffering&&e.pauseBuffering()}))}get inFlightFragments(){const e={[oe.MAIN]:this.streamController.inFlightFrag};return this.audioStreamController&&(e[oe.AUDIO]=this.audioStreamController.inFlightFrag),this.subtititleStreamController&&(e[oe.SUBTITLE]=this.subtititleStreamController.inFlightFrag),e}swapAudioCodec(){this.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()}recoverMediaError(){this.logger.log("recoverMediaError");const e=this._media,r=e==null?void 0:e.currentTime;this.detachMedia(),e&&(this.attachMedia(e),r&&this.startLoad(r))}removeLevel(e){this.levelController.removeLevel(e)}get sessionId(){let e=this._sessionId;return e||(e=this._sessionId=hJ()),e}get levels(){const e=this.levelController.levels;return e||[]}get latestLevelDetails(){return this.streamController.getLevelDetails()||null}get loadLevelObj(){return this.levelController.loadLevelObj}get currentLevel(){return this.streamController.currentLevel}set currentLevel(e){this.logger.log(`set currentLevel:${e}`),this.levelController.manualLevel=e,this.streamController.immediateLevelSwitch()}get nextLevel(){return this.streamController.nextLevel}set nextLevel(e){this.logger.log(`set nextLevel:${e}`),this.levelController.manualLevel=e,this.streamController.nextLevelSwitch()}get loadLevel(){return this.levelController.level}set loadLevel(e){this.logger.log(`set loadLevel:${e}`),this.levelController.manualLevel=e}get nextLoadLevel(){return this.levelController.nextLoadLevel}set nextLoadLevel(e){this.levelController.nextLoadLevel=e}get firstLevel(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)}set firstLevel(e){this.logger.log(`set firstLevel:${e}`),this.levelController.firstLevel=e}get startLevel(){const e=this.levelController.startLevel;return e===-1&&this.abrController.forcedAutoLevel>-1?this.abrController.forcedAutoLevel:e}set startLevel(e){this.logger.log(`set startLevel:${e}`),e!==-1&&(e=Math.max(e,this.minAutoLevel)),this.levelController.startLevel=e}get capLevelToPlayerSize(){return this.config.capLevelToPlayerSize}set capLevelToPlayerSize(e){const r=!!e;r!==this.config.capLevelToPlayerSize&&(r?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=r)}get autoLevelCapping(){return this._autoLevelCapping}get bandwidthEstimate(){const{bwEstimator:e}=this.abrController;return e?e.getEstimate():NaN}set bandwidthEstimate(e){this.abrController.resetEstimator(e)}get abrEwmaDefaultEstimate(){const{bwEstimator:e}=this.abrController;return e?e.defaultEstimate:NaN}get ttfbEstimate(){const{bwEstimator:e}=this.abrController;return e?e.getEstimateTTFB():NaN}set autoLevelCapping(e){this._autoLevelCapping!==e&&(this.logger.log(`set autoLevelCapping:${e}`),this._autoLevelCapping=e,this.levelController.checkMaxAutoUpdated())}get maxHdcpLevel(){return this._maxHdcpLevel}set maxHdcpLevel(e){l7(e)&&this._maxHdcpLevel!==e&&(this._maxHdcpLevel=e,this.levelController.checkMaxAutoUpdated())}get autoLevelEnabled(){return this.levelController.manualLevel===-1}get manualLevel(){return this.levelController.manualLevel}get minAutoLevel(){const{levels:e,config:{minAutoBitrate:r}}=this;if(!e)return 0;const n=e.length;for(let i=0;i<n;i++)if(e[i].maxBitrate>=r)return i;return 0}get maxAutoLevel(){const{levels:e,autoLevelCapping:r,maxHdcpLevel:n}=this;let i;
289if(r===-1&&e!=null&&e.length?i=e.length-1:i=r,n)for(let s=i;s--;){const a=e[s].attrs["HDCP-LEVEL"];if(a&&a<=n)return s}return i}get firstAutoLevel(){return this.abrController.firstAutoLevel}get nextAutoLevel(){return this.abrController.nextAutoLevel}set nextAutoLevel(e){this.abrController.nextAutoLevel=e}get playingDate(){return this.streamController.currentProgramDateTime}get mainForwardBufferInfo(){return this.streamController.getMainFwdBufferInfo()}get maxBufferLength(){return this.streamController.maxBufferLength}setAudioOption(e){var r;return((r=this.audioTrackController)==null?void 0:r.setAudioOption(e))||null}setSubtitleOption(e){var r;return((r=this.subtitleTrackController)==null?void 0:r.setSubtitleOption(e))||null}get allAudioTracks(){const e=this.audioTrackController;return e?e.allAudioTracks:[]}get audioTracks(){const e=this.audioTrackController;return e?e.audioTracks:[]}get audioTrack(){const e=this.audioTrackController;return e?e.audioTrack:-1}set audioTrack(e){const r=this.audioTrackController;r&&(r.audioTrack=e)}get allSubtitleTracks(){const e=this.subtitleTrackController;return e?e.allSubtitleTracks:[]}get subtitleTracks(){const e=this.subtitleTrackController;return e?e.subtitleTracks:[]}get subtitleTrack(){const e=this.subtitleTrackController;return e?e.subtitleTrack:-1}get media(){return this._media}set subtitleTrack(e){const r=this.subtitleTrackController;r&&(r.subtitleTrack=e)}get subtitleDisplay(){const e=this.subtitleTrackController;return e?e.subtitleDisplay:!1}set subtitleDisplay(e){const r=this.subtitleTrackController;r&&(r.subtitleDisplay=e)}get lowLatencyMode(){return this.config.lowLatencyMode}set lowLatencyMode(e){this.config.lowLatencyMode=e}get liveSyncPosition(){return this.latencyController.liveSyncPosition}get latency(){return this.latencyController.latency}get maxLatency(){return this.latencyController.maxLatency}get targetLatency(){return this.latencyController.targetLatency}set targetLatency(e){this.latencyController.targetLatency=e}get drift(){return this.latencyController.drift}get forceStartLoad(){return this.streamController.forceStartLoad}get pathways(){return this.levelController.pathways}get pathwayPriority(){return this.levelController.pathwayPriority}set pathwayPriority(e){this.levelController.pathwayPriority=e}get bufferedToEnd(){var e;return!!((e=this.bufferController)!=null&&e.bufferedToEnd)}get interstitialsManager(){var e;return((e=this.interstitialsController)==null?void 0:e.interstitialsManager)||null}getMediaDecodingInfo(e,r=this.allAudioTracks){const n=Sj(r);return xj(e,n,navigator.mediaCapabilities)}}ln.defaultConfig=void 0;function TZ(t){const e="http://localhost:8090",[r,n]=E.useState([]),[i,s]=E.useState([]),[a,o]=E.useState(!1),l=E.useRef(null);return E.useEffect(()=>{if(!t)return;const c=new EventSource(`${e}/sse/${t}`);return l.current=c,c.onopen=()=>o(!0),c.onerror=()=>o(!1),c.onmessage=u=>{const d=JSON.parse(u.data);d.type==="tracking"?n(d.persons):d.type==="alert"?s(f=>[d,...f].slice(0,50)):d.type==="person_left"&&n(f=>f.filter(h=>h.track_id!==d.track_id))},()=>{c.close(),o(!1),n([])}},[t,e]),{persons:r,alerts:i,connected:a}}const _Z={shelf:"#facc15",checkout:"#4ade80",exit:"#f87171"};function AZ(t,e,r,n){const{videoWidth:i,videoHeight:s,clientWidth:a,clientHeight:o}=e;if(!i||!s)return;t.width=a,t.height=o;const l=a/i,c=o/s,u=t.getContext("2d");u.clearRect(0,0,t.width,t.height);for(const d of r){const[f,h,p,g]=d.bbox,m=f*l,v=h*c,y=(p-f)*l,b=(g-h)*c,S=d.track_id!==null&&n.has(d.track_id)?"#ef4444":d.zone?_Z[d.zone]??"#22c55e":"#22c55e";u.strokeStyle=S,u.lineWidth=2,u.strokeRect(m,v,y,b);const T=[d.track_id!==null?`#${d.track_id}`:"",d.zone?`[${d.zone}]`:"",d.behaviour&&d.behaviour!=="normal"?d.behaviour.slice(0,3).toUpperCase():""].filter(Boolean).join(" ");T&&(u.font="bold 12px sans-serif",u.fillStyle=S,u.fillText(T,m+2,Math.max(v-4,14)))}}const PZ=["empty_shelf"];function IZ({streamUrl:t,camName:e,onAlert:r,mode:n="theft",loop:i=!1,onTimeUpdate:s,videoElRef:a,initialTime:o=0}){const l=E.useRef(null),c=E.useRef(null);E.useEffect(()=>{a&&l.current&&(a.current=l.current)},[a]);const{persons:u,alerts:d,connected:f}=TZ(e),h=n==="missing"?[]:u,p=n==="missing"?d.filter(m=>PZ.includes(m.event_type)):d;E.useEffect(()=>{const m=l.current;if(m){if(i){if(m.src=t,m.loop=!0,m.play().catch(()=>{}),o>0){const v=()=>{m.currentTime=o,m.play().catch(()=>{})};m.addEventListener("loadedmetadata",v,{once:!0})}if(s){let v=-1;const y=()=>{const b=Math.floor(m.currentTime);b!==v&&(v=b,s(m.currentTime))};return m.addEventListener("timeupdate",y),()=>m.removeEventListener("timeupdate",y)}return}if(ln.isSupported()){const v=new ln;return v.loadSource(t),v.attachMedia(m),()=>v.destroy()}else m.src=t}},[t,i]);const g=E.useRef("");return E.useEffect(()=>{if(!p.length)return;const m=p[0];m.ts!==g.current&&(g.current=m.ts,r==null||r(m))},[p,r]),E.useEffect(()=>{const m=l.current,v=c.current;if(!(!m||!v))if(n==="missing"){const{videoWidth:y,videoHeight:b,clientWidth:w,clientHeight:S}=m;if(!y||!b)return;v.width=w,v.height=S;const T=w/y,_=S/b,A=v.getContext("2d");A.clearRect(0,0,v.width,v.height);for(const P of p.slice(0,10)){const[C,O,R,D]=P.bbox;A.strokeStyle="#f97316",A.lineWidth=2,A.strokeRect(C*T,O*_,(R-C)*T,(D-O)*_),A.font="bold 12px sans-serif",A.fillStyle="#f97316";const L=`EMPTY ${P.confidence!=null?(P.confidence*100).toFixed(0)+"%":""}`;A.fillText(L,C*T+2,Math.max(O*_-4,14))}}else{const y=new Set(p.slice(0,5).flatMap(b=>b.track_id!=null?[b.track_id]:[]));AZ(v,m,h,y)}},[h,p,n]),x.jsxs("div",{className:"relative w-full rounded-lg overflow-hidden bg-black",children:[x.jsx("video",{ref:l,controls:!0,autoPlay:!0,muted:!0,playsInl
vendor: 7,968 bytes, line 289
289ine:!0,className:"w-full block"}),!i&&x.jsx("canvas",{ref:c,className:"absolute top-0 left-0 w-full h-full pointer-events-none"}),!i&&x.jsx("div",{className:`absolute top-2 right-2 text-xs px-2 py-0.5 rounded-full font-medium ${f?"bg-green-500/80 text-white":"bg-red-500/80 text-white"}`,children:f?"LIVE":"OFFLINE"})]})}function CZ(){return(navigator.language||"es").toLowerCase().startsWith("en")?"en":"es"}const OZ={en:{tabHurto:"Theft",tabArticulos:"Missing Items",tabAlertas:"Alerts",tabAnalisis:"Analysis",latestIncidents:"Latest Incidents",noIncidentsYet:"No incidents yet",theft:"Theft",loitering:"Loitering",sectionTheft:"Theft",sectionLoitering:"Loitering",sectionMissingItems:"Missing Items",loading:"Loading...",loadingAlerts:"Loading alerts...",loadingAnalysis:"Loading analysis...",noIncidentsSection:"No incidents yet",missingItemsByShelf:"Missing Items by Shelf",shelf:"Shelf",missing:"Missing",peopleDetected:"People Detected",highestFootfall:"Highest footfall zone",customersPerZone:"Zone activity (%)",zoneActivity:"Zone activity",zones:"Zones",heatmap:"Customer Behaviour",zoneAnalysis:"Zone Analysis",securityAlerts:"Security Alerts",securityIncidents:"Security Incidents",noIncidentsReported:"No incidents reported.",emptyLabel:"Vacío",rotateTip:"🔄 Please rotate your device"},es:{tabHurto:"Hurto",tabArticulos:"Artículos Falta",tabAlertas:"Alertas",tabAnalisis:"Análisis",latestIncidents:"Últimos Incidentes",noIncidentsYet:"Sin incidentes aún",theft:"Hurto",loitering:"Moredero",sectionTheft:"Hurto",sectionLoitering:"Moredero",sectionMissingItems:"Artículos Falta",loading:"Cargando...",loadingAlerts:"Cargando alertas...",loadingAnalysis:"Cargando análisis...",noIncidentsSection:"Sin incidentes aún",missingItemsByShelf:"Artículos Faltantes por Estante",shelf:"Estante",missing:"Faltantes",peopleDetected:"Personas detectadas",highestFootfall:"Zona con mayor afluencia",customersPerZone:"Actividad por zona (%)",zoneActivity:"Actividad de zona",zones:"Zonas",heatmap:"Comportamiento del cliente",zoneAnalysis:"Análisis de Zonas",securityAlerts:"Alertas de Seguridad",securityIncidents:"Incidentes de Seguridad",noIncidentsReported:"Sin incidentes reportados.",emptyLabel:"Vacío",rotateTip:"🔄 Por favor, gire el dispositivo"}};var RZ=Array.isArray,Yr=RZ,kZ=typeof yh=="object"&&yh&&yh.Object===Object&&yh,$2=kZ,LZ=$2,DZ=typeof self=="object"&&self&&self.Object===Object&&self,NZ=LZ||DZ||Function("return this")(),Vi=NZ,MZ=Vi,$Z=MZ.Symbol,ih=$Z,aC=ih,j2=Object.prototype,jZ=j2.hasOwnProperty,FZ=j2.toString,Nu=aC?aC.toStringTag:void 0;function BZ(t){var e=jZ.call(t,Nu),r=t[Nu];try{t[Nu]=void 0;var n=!0}catch{}var i=FZ.call(t);return n&&(e?t[Nu]=r:delete t[Nu]),i}var UZ=BZ,GZ=Object.prototype,WZ=GZ.toString;function VZ(t){return WZ.call(t)}var HZ=VZ,oC=ih,KZ=UZ,zZ=HZ,qZ="[object Null]",YZ="[object Undefined]",lC=oC?oC.toStringTag:void 0;function XZ(t){return t==null?t===void 0?YZ:qZ:lC&&lC in Object(t)?KZ(t):zZ(t)}var Os=XZ;function QZ(t){return t!=null&&typeof t=="object"}var Rs=QZ,JZ=Os,ZZ=Rs,eee="[object Symbol]";function tee(t){return typeof t=="symbol"||ZZ(t)&&JZ(t)==eee}var uu=tee,ree=Yr,nee=uu,iee=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,see=/^\w*$/;function aee(t,e){if(ree(t))return!1;var r=typeof t;return r=="number"||r=="symbol"||r=="boolean"||t==null||nee(t)?!0:see.test(t)||!iee.test(t)||e!=null&&t in Object(e)}var YT=aee;function oee(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var ka=oee;const du=at(ka);var lee=Os,cee=ka,uee="[object AsyncFunction]",dee="[object Function]",fee="[object GeneratorFunction]",hee="[object Proxy]";function pee(t){if(!cee(t))return!1;var e=lee(t);return e==dee||e==fee||e==uee||e==hee}var XT=pee;const De=at(XT);var mee=Vi,gee=mee["__core-js_shared__"],vee=gee,H0=vee,cC=function(){var t=/[^.]+$/.exec(H0&&H0.keys&&H0.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();function yee(t){return!!cC&&cC in t}var bee=yee,xee=Function.prototype,wee=xee.toString;function See(t){if(t!=null){try{return wee.call(t)}catch{}try{return t+""}catch{}}return""}var F2=See,Eee=XT,Tee=bee,_ee=ka,Aee=F2,Pee=/[\\^$.*+?()[\]{}|]/g,Iee=/^\[object .+?Constructor\]$/,Cee=Function.prototype,Oee=Object.prototype,Ree=Cee.toString,kee=Oee.hasOwnProperty,Lee=RegExp("^"+Ree.call(kee).replace(Pee,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Dee(t){if(!_ee(t)||Tee(t))return!1;var e=Eee(t)?Lee:Iee;return e.test(Aee(t))}var Nee=Dee;function Mee(t,e){return t==null?void 0:t[e]}var $ee=Mee,jee=Nee,Fee=$ee;function Bee(t,e){var r=Fee(t,e);return jee(r)?r:void 0}var Yo=Bee,Uee=Yo,Gee=Uee(Object,"create"),Dv=Gee,uC=Dv;function Wee(){this.__data__=uC?uC(null):{},this.size=0}var Vee=Wee;function Hee(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}var Kee=Hee,zee=Dv,qee="__lodash_hash_undefined__",Yee=Object.prototype,Xee=Yee.hasOwnProperty;function Qee(t){var e=this.__data__;if(zee){var r=e[t];return r===qee?void 0:r}return Xee.call(e,t)?e[t]:void 0}var Jee=Qee,Zee=Dv,ete=Object.prototype,tte=ete.hasOwnProperty;function rte(t){var e=this.__data__;return Zee?e[t]!==void 0:tte.call(e,t)}var nte=rte,ite=Dv,ste="__lodash_hash_undefined__";function ate(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=ite&&e===void 0?ste:e,this}var ote=ate,lte=Vee,cte=Kee,ute=Jee,dte=nte,fte=ote;function fu(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}fu.prototype.clear=lte;fu.prototype.delete=cte;fu.prototype.get=ute;fu.prototype.has=dte;fu.prototype.set=fte;var hte=fu;function pte(){this.__data__=[],this.size=0}var mte=pte;function gte(t,e){return t===e||t!==t&&e!==e}var QT=gte,vte=QT;function yte(t,e){for(var r=t.length;r--;)if(vte(t[r][0],e))return r;return-1}var Nv=yte,bte=Nv,xte=Array.prototype,wte=xte.splice;function Ste(t){var e=this.__data__,r=bte(e,t);if(r<0)return!1;var n=e.length-1;return r==n?e.pop():wte.call(e,r,1),--this.size,!0}var Ete=Ste,Tte=Nv;function _te(t){var e=this.__data__,r=Tte(e,t);return r<0?void 0:e[r][1]}var Ate=_te,Pte=Nv;function Ite(t){return Pte(this.__data__,t)>-1}var Cte=Ite,Ote=Nv;function Rte(t,e){var r=this.__data__,n=Ote(r,t);return n<0?(++this.size,r.push([t,e])):r[n][1]=e,this}var kte=Rte,Lte=mte,Dte=Ete,Nte=Ate,Mte=Cte,$te=kte;function hu(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}hu.prototype.clear=Lte;hu.prototype.delete=Dte;hu.prototype.get=Nte;hu.prototype.has=Mte;hu.prototype.set=$te;var Mv=hu,jte=Yo,Fte=Vi,Bte=jte(Fte,"Map"),JT=Bte,dC=hte,Ute=Mv,Gte=JT;function Wte(){this.size=0,this.__data__={hash:new dC,map:new(Gte||Ute),string:new dC}}var Vte=Wte;function Hte(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}var Kte=Hte,zte=Kte;function qte(t,e){var r=t.__data__;return zte(e)?r[typeof e=="string"?"string":"hash"]:r.map}var $v=qte,Yte=$v;function Xte(t){var e=Yte(this,t).delete(t);return this.size-=e?1:0,e}var Qte=Xte,Jte=$v;function Zte(t){return Jte(this,t).get(t)}var ere=Zte,tre=$v;function rre(t){return tre(this,t).has(t)}var nre=rre,ire=$v;function sre(t,e){var r=ire(this,t),n=r.size;return r.set(t,e),this.size+=r.size==n?0:1,this}var are=sre,ore=Vte,lre=Qte,cre=ere,ure=nre,dre=are;function pu(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}pu.prototype.clear=ore;pu.prototype.delete=lre;pu.prototype.get=cre;pu.prototype.has=ure;pu.prototype.set=dre;var ZT=pu,B2=ZT,fre="Expected a function";function e_(t,e){if(typeof t!="function"||e!=null&&typeof e!="function")throw new TypeError(fre);var r=function(){var n=arguments,i=e?e.apply(this,n):n[0],s=r.cache;if(s.has(i))return s.get(i);var a=t.apply(this,n);return r.cache=s.set(i,a)||s,a};return r.cache=new(e_.Cache||B2),r}e_.Cache=B2;var U2=e_;const hre=at(U2);var pre=U2,mre=500;function gre(t){var e=pre(t,function(n){return r.size===mre&&r.clear(),n}
289),r=e.cache;return e}var vre=gre,yre=vre,bre=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,xre=/\\(\\)?/g,wre=yre(function(t){var e=[];return t.charCodeAt(0)===46&&e.push(""),t.replace(bre,function(r,n,i,s){e.push(i?s.replace(xre,"$1"):n||r)}),e}),Sre=wre;function Ere(t,e){for(var r=-1,n=t==null?0:t.length,i=Array(n);++r<n;)i[r]=e(t[r],r,t);return i}var t_=Ere,fC=ih,Tre=t_,_re=Yr,Are=uu,hC=fC?fC.prototype:void 0,pC=hC?hC.toString:void 0;function G2(t){if(typeof t=="string")return t;if(_re(t))return Tre(t,G2)+"";if(Are(t))return pC?pC.call(t):"";var e=t+"";return e=="0"&&1/t==-1/0?"-0":e}var Pre=G2,Ire=Pre;function Cre(t){return t==null?"":Ire(t)}var W2=Cre,Ore=Yr,Rre=YT,kre=Sre,Lre=W2;function Dre(t,e){return Ore(t)?t:Rre(t,e)?[t]:kre(Lre(t))}var V2=Dre,Nre=uu;function Mre(t){if(typeof t=="string"||Nre(t))return t;var e=t+"";return e=="0"&&1/t==-1/0?"-0":e}var jv=Mre,$re=V2,jre=jv;function Fre(t,e){e=$re(e,t);for(var r=0,n=e.length;t!=null&&r<n;)t=t[jre(e[r++])];return r&&r==n?t:void 0}var r_=Fre,Bre=r_;function Ure(t,e,r){var n=t==null?void 0:Bre(t,e);return n===void 0?r:n}var H2=Ure;const In=at(H2);function Gre(t){return t==null}var Wre=Gre;const Fe=at(Wre);var Vre=Os,Hre=Yr,Kre=Rs,zre="[object String]";function qre(t){return typeof t=="string"||!Hre(t)&&Kre(t)&&Vre(t)==zre}var Yre=qre;const Fo=at(Yre);var K2={exports:{}},Xe={};/**
290 * @license React
291 * react-is.production.min.js
292 *
293 * Copyright (c) Facebook, Inc. and its affiliates.
294 *
295 * This source code is licensed under the MIT license found in the
296 * LICENSE file in the root directory of this source tree.
297 */var n_=Symbol.for("react.element"),i_=Symbol.for("react.portal"),Fv=Symbol.for("react.fragment"),Bv=Symbol.for("react.strict_mode"),Uv=Symbol.for("react.profiler"),Gv=Symbol.for("react.provider"),Wv=Symbol.for("react.context"),Xre=Symbol.for("react.server_context"),Vv=Symbol.for("react.forward_ref"),Hv=Symbol.for("react.suspense"),Kv=Symbol.for("react.suspense_list"),zv=Symbol.for("react.memo"),qv=Symbol.for("react.lazy"),Qre=Symbol.for("react.offscreen"),z2;z2=Symbol.for("react.module.reference");function Nn(t){if(typeof t=="object"&&t!==null){var e=t.$$typeof;switch(e){case n_:switch(t=t.type,t){case Fv:case Uv:case Bv:case Hv:case Kv:return t;default:switch(t=t&&t.$$typeof,t){case Xre:case Wv:case Vv:case qv:case zv:case Gv:return t;default:return e}}case i_:return e}}}Xe.ContextConsumer=Wv;Xe.ContextProvider=Gv;Xe.Element=n_;Xe.ForwardRef=Vv;Xe.Fragment=Fv;Xe.Lazy=qv;Xe.Memo=zv;Xe.Portal=i_;Xe.Profiler=Uv;Xe.StrictMode=Bv;Xe.Suspense=Hv;Xe.SuspenseList=Kv;Xe.isAsyncMode=function(){return!1};Xe.isConcurrentMode=function(){return!1};Xe.isContextConsumer=function(t){return Nn(t)===Wv};Xe.isContextProvider=function(t){return Nn(t)===Gv};Xe.isElement=function(t){return typeof t=="object"&&t!==null&&t.$$typeof===n_};Xe.isForwardRef=function(t){return Nn(t)===Vv};Xe.isFragment=function(t){return Nn(t)===Fv};Xe.isLazy=function(t){return Nn(t)===qv};Xe.isMemo=function(t){return Nn(t)===zv};Xe.isPortal=function(t){return Nn(t)===i_};Xe.isProfiler=function(t){return Nn(t)===Uv};Xe.isStrictMode=function(t){return Nn(t)===Bv};Xe.isSuspense=function(t){return Nn(t)===Hv};Xe.isSuspenseList=function(t){return Nn(t)===Kv};Xe.isValidElementType=function(t){return typeof t=="string"||typeof t=="function"||t===Fv||t===Uv||t===Bv||t===Hv||t===Kv||t===Qre||typeof t=="object"&&t!==null&&(t.$$typeof===qv||t.$$typeof===zv||t.$$typeof===Gv||t.$$typeof===Wv||t.$$typeof===Vv||t.$$typeof===z2||t.getModuleId!==void 0)};Xe.typeOf=Nn;K2.exports=Xe;var Jre=K2.exports,Zre=Os,ene=Rs,tne="[object Number]";function rne(t){return typeof t=="number"||ene(t)&&Zre(t)==tne}var q2=rne;const nne=at(q2);var ine=q2;function sne(t){return ine(t)&&t!=+t}var ane=sne;const sh=at(ane);var si=function(e){return e===0?0:e>0?1:-1},co=function(e){return Fo(e)&&e.indexOf("%")===e.length-1},ae=function(e){return nne(e)&&!sh(e)},one=function(e){return Fe(e)},Xt=function(e){return ae(e)||Fo(e)},lne=0,Yv=function(e){var r=++lne;return"".concat(e||"").concat(r)},Bo=function(e,r){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(!ae(e)&&!Fo(e))return n;var s;if(co(e)){var a=e.indexOf("%");s=r*parseFloat(e.slice(0,a))/100}else s=+e;return sh(s)&&(s=n),i&&s>r&&(s=r),s},Tl=function(e){if(!e)return null;var r=Object.keys(e);return r&&r.length?e[r[0]]:null},cne=function(e){if(!Array.isArray(e))return!1;for(var r=e.length,n={},i=0;i<r;i++)if(!n[e[i]])n[e[i]]=!0;else return!0;return!1}
vendor: 15,376 bytes, line 297
297,hl=function(e,r){return ae(e)&&ae(r)?function(n){return e+n*(r-e)}:function(){return r}};function _w(t,e,r){return!t||!t.length?null:t.find(function(n){return n&&(typeof e=="function"?e(n):In(n,e))===r})}var une=function(e,r){return ae(e)&&ae(r)?e-r:Fo(e)&&Fo(r)?e.localeCompare(r):e instanceof Date&&r instanceof Date?e.getTime()-r.getTime():String(e).localeCompare(String(r))};function tc(t,e){for(var r in t)if({}.hasOwnProperty.call(t,r)&&(!{}.hasOwnProperty.call(e,r)||t[r]!==e[r]))return!1;for(var n in e)if({}.hasOwnProperty.call(e,n)&&!{}.hasOwnProperty.call(t,n))return!1;return!0}function Aw(t){"@babel/helpers - typeof";return Aw=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Aw(t)}var dne=["viewBox","children"],fne=["aria-activedescendant","aria-atomic","aria-autocomplete","aria-busy","aria-checked","aria-colcount","aria-colindex","aria-colspan","aria-controls","aria-current","aria-describedby","aria-details","aria-disabled","aria-errormessage","aria-expanded","aria-flowto","aria-haspopup","aria-hidden","aria-invalid","aria-keyshortcuts","aria-label","aria-labelledby","aria-level","aria-live","aria-modal","aria-multiline","aria-multiselectable","aria-orientation","aria-owns","aria-placeholder","aria-posinset","aria-pressed","aria-readonly","aria-relevant","aria-required","aria-roledescription","aria-rowcount","aria-rowindex","aria-rowspan","aria-selected","aria-setsize","aria-sort","aria-valuemax","aria-valuemin","aria-valuenow","aria-valuetext","className","color","height","id","lang","max","media","method","min","name","style","target","width","role","tabIndex","accentHeight","accumulate","additive","alignmentBaseline","allowReorder","alphabetic","amplitude","arabicForm","ascent","attributeName","attributeType","autoReverse","azimuth","baseFrequency","baselineShift","baseProfile","bbox","begin","bias","by","calcMode","capHeight","clip","clipPath","clipPathUnits","clipRule","colorInterpolation","colorInterpolationFilters","colorProfile","colorRendering","contentScriptType","contentStyleType","cursor","cx","cy","d","decelerate","descent","diffuseConstant","direction","display","divisor","dominantBaseline","dur","dx","dy","edgeMode","elevation","enableBackground","end","exponent","externalResourcesRequired","fill","fillOpacity","fillRule","filter","filterRes","filterUnits","floodColor","floodOpacity","focusable","fontFamily","fontSize","fontSizeAdjust","fontStretch","fontStyle","fontVariant","fontWeight","format","from","fx","fy","g1","g2","glyphName","glyphOrientationHorizontal","glyphOrientationVertical","glyphRef","gradientTransform","gradientUnits","hanging","horizAdvX","horizOriginX","href","ideographic","imageRendering","in2","in","intercept","k1","k2","k3","k4","k","kernelMatrix","kernelUnitLength","kerning","keyPoints","keySplines","keyTimes","lengthAdjust","letterSpacing","lightingColor","limitingConeAngle","local","markerEnd","markerHeight","markerMid","markerStart","markerUnits","markerWidth","mask","maskContentUnits","maskUnits","mathematical","mode","numOctaves","offset","opacity","operator","order","orient","orientation","origin","overflow","overlinePosition","overlineThickness","paintOrder","panose1","pathLength","patternContentUnits","patternTransform","patternUnits","pointerEvents","pointsAtX","pointsAtY","pointsAtZ","preserveAlpha","preserveAspectRatio","primitiveUnits","r","radius","refX","refY","renderingIntent","repeatCount","repeatDur","requiredExtensions","requiredFeatures","restart","result","rotate","rx","ry","seed","shapeRendering","slope","spacing","specularConstant","specularExponent","speed","spreadMethod","startOffset","stdDeviation","stemh","stemv","stitchTiles","stopColor","stopOpacity","strikethroughPosition","strikethroughThickness","string","stroke","strokeDasharray","strokeDashoffset","strokeLinecap","strokeLinejoin","strokeMiterlimit","strokeOpacity","strokeWidth","surfaceScale","systemLanguage","tableValues","targetX","targetY","textAnchor","textDecoration","textLength","textRendering","to","transform","u1","u2","underlinePosition","underlineThickness","unicode","unicodeBidi","unicodeRange","unitsPerEm","vAlphabetic","values","vectorEffect","version","vertAdvY","vertOriginX","vertOriginY","vHanging","vIdeographic","viewTarget","visibility","vMathematical","widths","wordSpacing","writingMode","x1","x2","x","xChannelSelector","xHeight","xlinkActuate","xlinkArcrole","xlinkHref","xlinkRole","xlinkShow","xlinkTitle","xlinkType","xmlBase","xmlLang","xmlns","xmlnsXlink","xmlSpace","y1","y2","y","yChannelSelector","z","zoomAndPan","ref","key","angle"],mC=["points","pathLength"],K0={svg:dne,polygon:mC,polyline:mC},s_=["dangerouslySetInnerHTML","onCopy","onCopyCapture","onCut","onCutCapture","onPaste","onPasteCapture","onCompositionEnd","onCompositionEndCapture","onCompositionStart","onCompositionStartCapture","onCompositionUpdate","onCompositionUpdateCapture","onFocus","onFocusCapture","onBlur","onBlurCapture","onChange","onChangeCapture","onBeforeInput","onBeforeInputCapture","onInput","onInputCapture","onReset","onResetCapture","onSubmit","onSubmitCapture","onInvalid","onInvalidCapture","onLoad","onLoadCapture","onError","onErrorCapture","onKeyDown","onKeyDownCapture","onKeyPress","onKeyPressCapture","onKeyUp","onKeyUpCapture","onAbort","onAbortCapture","onCanPlay","onCanPlayCapture","onCanPlayThrough","onCanPlayThroughCapture","onDurationChange","onDurationChangeCapture","onEmptied","onEmptiedCapture","onEncrypted","onEncryptedCapture","onEnded","onEndedCapture","onLoadedData","onLoadedDataCapture","onLoadedMetadata","onLoadedMetadataCapture","onLoadStart","onLoadStartCapture","onPause","onPauseCapture","onPlay","onPlayCapture","onPlaying","onPlayingCapture","onProgress","onProgressCapture","onRateChange","onRateChangeCapture","onSeeked","onSeekedCapture","onSeeking","onSeekingCapture","onStalled","onStalledCapture","onSuspend","onSuspendCapture","onTimeUpdate","onTimeUpdateCapture","onVolumeChange","onVolumeChangeCapture","onWaiting","onWaitingCapture","onAuxClick","onAuxClickCapture","onClick","onClickCapture","onContextMenu","onContextMenuCapture","onDoubleClick","onDoubleClickCapture","onDrag","onDragCapture","onDragEnd","onDragEndCapture","onDragEnter","onDragEnterCapture","onDragExit","onDragExitCapture","onDragLeave","onDragLeaveCapture","onDragOver","onDragOverCapture","onDragStart","onDragStartCapture","onDrop","onDropCapture","onMouseDown","onMouseDownCapture","onMouseEnter","onMouseLeave","onMouseMove","onMouseMoveCapture","onMouseOut","onMouseOutCapture","onMouseOver","onMouseOverCapture","onMouseUp","onMouseUpCapture","onSelect","onSelectCapture","onTouchCancel","onTouchCancelCapture","onTouchEnd","onTouchEndCapture","onTouchMove","onTouchMoveCapture","onTouchStart","onTouchStartCapture","onPointerDown","onPointerDownCapture","onPointerMove","onPointerMoveCapture","onPointerUp","onPointerUpCapture","onPointerCancel","onPointerCancelCapture","onPointerEnter","onPointerEnterCapture","onPointerLeave","onPointerLeaveCapture","onPointerOver","onPointerOverCapture","onPointerOut","onPointerOutCapture","onGotPointerCapture","onGotPointerCaptureCapture","onLostPointerCapture","onLostPointerCaptureCapture","onScroll","onScrollCapture","onWheel","onWheelCapture","onAnimationStart","onAnimationStartCapture","onAnimationEnd","onAnimationEndCapture","onAnimationIteration","onAnimationIterationCapture","onTransitionEnd","onTransitionEndCapture"],Km=function(e,r){if(!e||typeof e=="function"||typeof e=="boolean")return null;var n=e;if(E.isValidElement(e)&&(n=e.props),!du(n))return null;var i={};return Object.keys(n).forEach(function(s){s_.includes(s)&&(i[s]=r||function(a){return n[s](n,a)})}),i},hne=function(e,r,n){return function(i){return e(r,n,i),null}},zm=function(e,r,n){if(!du(e)||Aw(e)!=="object")return null;var i=null;return Object.keys(e).forEach(function(s){var a=e[s];s_.includes(s)&&typeof a=="function"&&(i||(i={}),i[s]=hne(a,r,n))}),i},pne=["children"],mne=["children"];function gC(t,e){if(t==null)return{};var r=gne(t,e),n,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(i=0;i<s.length;i++)n=s[i],!(e.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function gne(t,e){if(t==null)return{};var r={};for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(e.indexOf(n)>=0)continue;r[n]=t[n]}return r}var vC={click:"onClick",mousedown:"onMouseDown",mouseup:"onMouseUp",mouseover:"onMouseOver",mousemove:"onMouseMove",mouseout:"onMouseOut",mouseenter:"onMouseEnter",mouseleave:"onMouseLeave",touchcancel:"onTouchCancel",touchend:"onTouchEnd",touchmove:"onTouchMove",touchstart:"onTouchStart",contextmenu:"onContextMenu",dblclick:"onDoubleClick"},hs=function(e){return typeof e=="string"?e:e?e.displayName||e.name||"Component":""},yC=null,z0=null,a_=function t(e){if(e===yC&&Array.isArray(z0))return z0;var r=[];return E.Children.forEach(e,function(n){Fe(n)||(Jre.isFragment(n)?r=r.concat(t(n.props.children)):r.push(n))}),z0=r,yC=e,r};function li(t,e){var r=[],n=[];return Array.isArray(e)?n=e.map(function(i){return hs(i)}):n=[hs(e)],a_(t).forEach(function(i){var s=In(i,"type.displayName")||In(i,"type.name");n.indexOf(s)!==-1&&r.push(i)}),r}function rn(t,e){var r=li(t,e);return r&&r[0]}var bC=function(e){if(!e||!e.props)return!1;var r=e.props,n=r.width,i=r.height;return!(!ae(n)||n<=0||!ae(i)||i<=0)},vne=["a","altGlyph","altGlyphDef","altGlyphItem","animate","animateColor","animateMotion","animateTransform","circle","clipPath","color-profile","cursor","defs","desc","ellipse","feBlend","feColormatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","filter","font","font-face","font-face-format","font-face-name","font-face-url","foreignObject","g","glyph","glyphRef","hkern","image","line","lineGradient","marker","mask","metadata","missing-glyph","mpath","path","pattern","polygon","polyline","radialGradient","rect","script","set","stop","style","svg","switch","symbol","text","textPath","title","tref","tspan","use","view","vkern"],yne=function(e){return e&&e.type&&Fo(e.type)&&vne.indexOf(e.type)>=0},bne=function(e,r,n,i){var s,a=(s=K0==null?void 0:K0[i])!==null&&s!==void 0?s:[];return r.startsWith("data-")||!De(e)&&(i&&a.includes(r)||fne.includes(r))||n&&s_.includes(r)},Ue=function(e,r,n){if(!e||typeof e=="function"||typeof e=="boolean")return null;var i=e;if(E.isValidElement(e)&&(i=e.props),!du(i))return null;var s={};return Object.keys(i).forEach(function(a){var o;bne((o=i)===null||o===void 0?void 0:o[a],a,r,n)&&(s[a]=i[a])}),s},Pw=function t(e,r){if(e===r)return!0;var n=E.Children.count(e);if(n!==E.Children.count(r))return!1;if(n===0)return!0;if(n===1)return xC(Array.isArray(e)?e[0]:e,Array.isArray(r)?r[0]:r);for(var i=0;i<n;i++){var s=e[i],a=r[i];if(Array.isArray(s)||Array.isArray(a)){if(!t(s,a))return!1}else if(!xC(s,a))return!1}return!0},xC=function(e,r){if(Fe(e)&&Fe(r))return!0;if(!Fe(e)&&!Fe(r)){var n=e.props||{},i=n.children,s=gC(n,pne),a=r.props||{},o=a.children,l=gC(a,mne);return i&&o?tc(s,l)&&Pw(i,o):!i&&!o?tc(s,l):!1}return!1},wC=function(e,r){var n=[],i={};return a_(e).forEach(function(s,a){if(yne(s))n.push(s);else if(s){var o=hs(s.type),l=r[o]||{},c=l.handler,u=l.once;if(c&&(!u||!i[o])){var d=c(s,o,a);n.push(d),i[o]=!0}}}),n},xne=function(e){var r=e&&e.type;return r&&vC[r]?vC[r]:null},wne=function(e,r){return a_(r).indexOf(e)},Sne=["children","width","height","viewBox","className","style","title","desc"];function Iw(){return Iw=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},Iw.apply(this,arguments)}function Ene(t,e){if(t==null)return{};var r=Tne(t,e),n,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(i=0;i<s.length;i++)n=s[i],!(e.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function Tne(t,e){if(t==null)return{};var r={};for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(e.indexOf(n)>=0)continue;r[n]=t[n]}return r}function Cw(t){var e=t.children,r=t.width,n=t.height,i=t.viewBox,s=t.className,a=t.style,o=t.title,l=t.desc,c=Ene(t,Sne),u=i||{width:r,height:n,x:0,y:0},d=Me("recharts-surface",s);return F.createElement("svg",Iw({},Ue(c,!0,"svg"),{className:d,width:r,height:n,style:a,viewBox:"".concat(u.x," ").concat(u.y," ").concat(u.width," ").concat(u.height)}),F.createElement("title",null,o),F.createElement("desc",null,l),e)}var _ne=["children","className"];function Ow(){return Ow=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},Ow.apply(this,arguments)}function Ane(t,e){if(t==null)return{};var r=Pne(t,e),n,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(i=0;i<s.length;i++)n=s[i],!(e.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function Pne(t,e){if(t==null)return{};var r={};for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(e.indexOf(n)>=0)continue;r[n]=t[n]}return r}var sr=F.forwardRef(function(t,e){var r=t.children,n=t.className,i=Ane(t,_ne),s=Me("recharts-layer",n);return F.createElement("g",Ow({className:s},Ue(i,!0),{ref:e}),r)}),_o=function(e,r){for(var n=arguments.length,i=new Array(n>2?n-2:0),s=2;s<n;s++)i[s-2]=arguments[s]};function Ine(t,e,r){var n=-1,i=t.length;e<0&&(e=-e>i?0:i+e),r=r>i?i:r,r<0&&(r+=i),i=e>r?0:r-e>>>0,e>>>=0;for(var s=Array(i);++n<i;)s[n]=t[n+e];return s}var Cne=Ine,One=Cne;function Rne(t,e,r){var n=t.length;return r=r===void 0?n:r,!e&&r>=n?t:One(t,e,r)}var kne=Rne,Lne="\\ud800-\\udfff",Dne="\\u0300-\\u036f",Nne="\\ufe20-\\ufe2f",Mne="\\u20d0-\\u20ff",$ne=Dne+Nne+Mne,jne="\\ufe0e\\ufe0f",Fne="\\u200d",Bne=RegExp("["+Fne+Lne+$ne+jne+"]");function Une(t){return Bne.test(t)}var Y2=Une;function Gne(t){return t.split("")}var Wne=Gne,X2="\\ud800-\\udfff",Vne="\\u0300-\\u036f",Hne="\\ufe20-\\ufe2f",Kne="\\u20d0-\\u20ff",zne=Vne+Hne+Kne,qne="\\ufe0e\\ufe0f",Yne="["+X2+"]",Rw="["+zne+"]",kw="\\ud83c[\\udffb-\\udfff]",Xne="(?:"+Rw+"|"+kw+")",Q2="[^"+X2+"]",J2="(?:\\ud83c[\\udde6-\\uddff]){2}",Z2="[\\ud800-\\udbff][\\udc00-\\udfff]",Qne="\\u200d",eF=Xne+"?",tF="["+qne+"]?",Jne="(?:"+Qne+"(?:"+[Q2,J2,Z2].join("|")+")"+tF+eF+")*",Zne=tF+eF+Jne,eie="(?:"+[Q2+Rw+"?",Rw,J2,Z2,Yne].join("|")+")",tie=RegExp(kw+"(?="+kw+")|"+eie+Zne,"g");function rie(t){return t.match(tie)||[]}var nie=rie,iie=Wne,sie=Y2,aie=nie;function oie(t){return sie(t)?aie(t):iie(t)}var lie=oie,cie=kne,uie=Y2,die=lie,fie=W2;function hie(t){return function(e){e=fie(e);var r=uie(e)?die(e):void 0,n=r?r[0]:e.charAt(0),i=r?cie(r,1).join(""):e.slice(1);return n[t]()+i}}var pie=hie,mie=pie,gie=mie("toUpperCase"),vie=gie;const Xv=at(vie);function lt(t){return function(){return t}}const rF=Math.cos,qm=Math.sin,pi=Math.sqrt,Ym=Math.PI,Qv=2*Ym,Lw=Math.PI,Dw=2*Lw,Za=1e-6,yie=Dw-
vendor: 13,830 bytes, line 297
297Za;function nF(t){this._+=t[0];for(let e=1,r=t.length;e<r;++e)this._+=arguments[e]+t[e]}function bie(t){let e=Math.floor(t);if(!(e>=0))throw new Error(`invalid digits: ${t}`);if(e>15)return nF;const r=10**e;return function(n){this._+=n[0];for(let i=1,s=n.length;i<s;++i)this._+=Math.round(arguments[i]*r)/r+n[i]}}class xie{constructor(e){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=e==null?nF:bie(e)}moveTo(e,r){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+r}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(e,r){this._append`L${this._x1=+e},${this._y1=+r}`}quadraticCurveTo(e,r,n,i){this._append`Q${+e},${+r},${this._x1=+n},${this._y1=+i}`}bezierCurveTo(e,r,n,i,s,a){this._append`C${+e},${+r},${+n},${+i},${this._x1=+s},${this._y1=+a}`}arcTo(e,r,n,i,s){if(e=+e,r=+r,n=+n,i=+i,s=+s,s<0)throw new Error(`negative radius: ${s}`);let a=this._x1,o=this._y1,l=n-e,c=i-r,u=a-e,d=o-r,f=u*u+d*d;if(this._x1===null)this._append`M${this._x1=e},${this._y1=r}`;else if(f>Za)if(!(Math.abs(d*l-c*u)>Za)||!s)this._append`L${this._x1=e},${this._y1=r}`;else{let h=n-a,p=i-o,g=l*l+c*c,m=h*h+p*p,v=Math.sqrt(g),y=Math.sqrt(f),b=s*Math.tan((Lw-Math.acos((g+f-m)/(2*v*y)))/2),w=b/y,S=b/v;Math.abs(w-1)>Za&&this._append`L${e+w*u},${r+w*d}`,this._append`A${s},${s},0,0,${+(d*h>u*p)},${this._x1=e+S*l},${this._y1=r+S*c}`}}arc(e,r,n,i,s,a){if(e=+e,r=+r,n=+n,a=!!a,n<0)throw new Error(`negative radius: ${n}`);let o=n*Math.cos(i),l=n*Math.sin(i),c=e+o,u=r+l,d=1^a,f=a?i-s:s-i;this._x1===null?this._append`M${c},${u}`:(Math.abs(this._x1-c)>Za||Math.abs(this._y1-u)>Za)&&this._append`L${c},${u}`,n&&(f<0&&(f=f%Dw+Dw),f>yie?this._append`A${n},${n},0,1,${d},${e-o},${r-l}A${n},${n},0,1,${d},${this._x1=c},${this._y1=u}`:f>Za&&this._append`A${n},${n},0,${+(f>=Lw)},${d},${this._x1=e+n*Math.cos(s)},${this._y1=r+n*Math.sin(s)}`)}rect(e,r,n,i){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+r}h${n=+n}v${+i}h${-n}Z`}toString(){return this._}}function o_(t){let e=3;return t.digits=function(r){if(!arguments.length)return e;if(r==null)e=null;else{const n=Math.floor(r);if(!(n>=0))throw new RangeError(`invalid digits: ${r}`);e=n}return t},()=>new xie(e)}function l_(t){return typeof t=="object"&&"length"in t?t:Array.from(t)}function iF(t){this._context=t}iF.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:this._context.lineTo(t,e);break}}};function Jv(t){return new iF(t)}function sF(t){return t[0]}function aF(t){return t[1]}function oF(t,e){var r=lt(!0),n=null,i=Jv,s=null,a=o_(o);t=typeof t=="function"?t:t===void 0?sF:lt(t),e=typeof e=="function"?e:e===void 0?aF:lt(e);function o(l){var c,u=(l=l_(l)).length,d,f=!1,h;for(n==null&&(s=i(h=a())),c=0;c<=u;++c)!(c<u&&r(d=l[c],c,l))===f&&((f=!f)?s.lineStart():s.lineEnd()),f&&s.point(+t(d,c,l),+e(d,c,l));if(h)return s=null,h+""||null}return o.x=function(l){return arguments.length?(t=typeof l=="function"?l:lt(+l),o):t},o.y=function(l){return arguments.length?(e=typeof l=="function"?l:lt(+l),o):e},o.defined=function(l){return arguments.length?(r=typeof l=="function"?l:lt(!!l),o):r},o.curve=function(l){return arguments.length?(i=l,n!=null&&(s=i(n)),o):i},o.context=function(l){return arguments.length?(l==null?n=s=null:s=i(n=l),o):n},o}function lp(t,e,r){var n=null,i=lt(!0),s=null,a=Jv,o=null,l=o_(c);t=typeof t=="function"?t:t===void 0?sF:lt(+t),e=typeof e=="function"?e:lt(e===void 0?0:+e),r=typeof r=="function"?r:r===void 0?aF:lt(+r);function c(d){var f,h,p,g=(d=l_(d)).length,m,v=!1,y,b=new Array(g),w=new Array(g);for(s==null&&(o=a(y=l())),f=0;f<=g;++f){if(!(f<g&&i(m=d[f],f,d))===v)if(v=!v)h=f,o.areaStart(),o.lineStart();else{for(o.lineEnd(),o.lineStart(),p=f-1;p>=h;--p)o.point(b[p],w[p]);o.lineEnd(),o.areaEnd()}v&&(b[f]=+t(m,f,d),w[f]=+e(m,f,d),o.point(n?+n(m,f,d):b[f],r?+r(m,f,d):w[f]))}if(y)return o=null,y+""||null}function u(){return oF().defined(i).curve(a).context(s)}return c.x=function(d){return arguments.length?(t=typeof d=="function"?d:lt(+d),n=null,c):t},c.x0=function(d){return arguments.length?(t=typeof d=="function"?d:lt(+d),c):t},c.x1=function(d){return arguments.length?(n=d==null?null:typeof d=="function"?d:lt(+d),c):n},c.y=function(d){return arguments.length?(e=typeof d=="function"?d:lt(+d),r=null,c):e},c.y0=function(d){return arguments.length?(e=typeof d=="function"?d:lt(+d),c):e},c.y1=function(d){return arguments.length?(r=d==null?null:typeof d=="function"?d:lt(+d),c):r},c.lineX0=c.lineY0=function(){return u().x(t).y(e)},c.lineY1=function(){return u().x(t).y(r)},c.lineX1=function(){return u().x(n).y(e)},c.defined=function(d){return arguments.length?(i=typeof d=="function"?d:lt(!!d),c):i},c.curve=function(d){return arguments.length?(a=d,s!=null&&(o=a(s)),c):a},c.context=function(d){return arguments.length?(d==null?s=o=null:o=a(s=d),c):s},c}class lF{constructor(e,r){this._context=e,this._x=r}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line}point(e,r){switch(e=+e,r=+r,this._point){case 0:{this._point=1,this._line?this._context.lineTo(e,r):this._context.moveTo(e,r);break}case 1:this._point=2;default:{this._x?this._context.bezierCurveTo(this._x0=(this._x0+e)/2,this._y0,this._x0,r,e,r):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+r)/2,e,this._y0,e,r);break}}this._x0=e,this._y0=r}}function wie(t){return new lF(t,!0)}function Sie(t){return new lF(t,!1)}const c_={draw(t,e){const r=pi(e/Ym);t.moveTo(r,0),t.arc(0,0,r,0,Qv)}},Eie={draw(t,e){const r=pi(e/5)/2;t.moveTo(-3*r,-r),t.lineTo(-r,-r),t.lineTo(-r,-3*r),t.lineTo(r,-3*r),t.lineTo(r,-r),t.lineTo(3*r,-r),t.lineTo(3*r,r),t.lineTo(r,r),t.lineTo(r,3*r),t.lineTo(-r,3*r),t.lineTo(-r,r),t.lineTo(-3*r,r),t.closePath()}},cF=pi(1/3),Tie=cF*2,_ie={draw(t,e){const r=pi(e/Tie),n=r*cF;t.moveTo(0,-r),t.lineTo(n,0),t.lineTo(0,r),t.lineTo(-n,0),t.closePath()}},Aie={draw(t,e){const r=pi(e),n=-r/2;t.rect(n,n,r,r)}},Pie=.8908130915292852,uF=qm(Ym/10)/qm(7*Ym/10),Iie=qm(Qv/10)*uF,Cie=-rF(Qv/10)*uF,Oie={draw(t,e){const r=pi(e*Pie),n=Iie*r,i=Cie*r;t.moveTo(0,-r),t.lineTo(n,i);for(let s=1;s<5;++s){const a=Qv*s/5,o=rF(a),l=qm(a);t.lineTo(l*r,-o*r),t.lineTo(o*n-l*i,l*n+o*i)}t.closePath()}},q0=pi(3),Rie={draw(t,e){const r=-pi(e/(q0*3));t.moveTo(0,r*2),t.lineTo(-q0*r,-r),t.lineTo(q0*r,-r),t.closePath()}},bn=-.5,xn=pi(3)/2,Nw=1/pi(12),kie=(Nw/2+1)*3,Lie={draw(t,e){const r=pi(e/kie),n=r/2,i=r*Nw,s=n,a=r*Nw+r,o=-s,l=a;t.moveTo(n,i),t.lineTo(s,a),t.lineTo(o,l),t.lineTo(bn*n-xn*i,xn*n+bn*i),t.lineTo(bn*s-xn*a,xn*s+bn*a),t.lineTo(bn*o-xn*l,xn*o+bn*l),t.lineTo(bn*n+xn*i,bn*i-xn*n),t.lineTo(bn*s+xn*a,bn*a-xn*s),t.lineTo(bn*o+xn*l,bn*l-xn*o),t.closePath()}};function Die(t,e){let r=null,n=o_(i);t=typeof t=="function"?t:lt(t||c_),e=typeof e=="function"?e:lt(e===void 0?64:+e);function i(){let s;if(r||(r=s=n()),t.apply(this,arguments).draw(r,+e.apply(this,arguments)),s)return r=null,s+""||null}return i.type=function(s){return arguments.length?(t=typeof s=="function"?s:lt(s),i):t},i.size=function(s){return arguments.length?(e=typeof s=="function"?s:lt(+s),i):e},i.context=function(s){return arguments.length?(r=s??null,i):r},i}function Xm(){}function Qm(t,e,r){t._context.bezierCurveTo((2*t._x0+t._x1)/3,(2*t._y0+t._y1)/3,(t._x0+2*t._x1)/3,(t._y0+2*t._y1)/3,(t._x0+4*t._x1+e)/6,(t._y0+4*t._y1+r)/6)}function dF(t){this._context=t}dF.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:Qm(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:Qm(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function Nie(t){return new dF(t)}function fF(t){this._context=t}fF.prototype={areaStart:Xm,areaEnd:Xm,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x2,this._y2),this._context.closePath();break}case 2:{this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break}case 3:{this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4);break}}},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._x2=t,this._y2=e;break;case 1:this._point=2,this._x3=t,this._y3=e;break;case 2:this._point=3,this._x4=t,this._y4=e,this._context.moveTo((this._x0+4*this._x1+t)/6,(this._y0+4*this._y1+e)/6);break;default:Qm(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function Mie(t){return new fF(t)}function hF(t){this._context=t}hF.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var r=(this._x0+4*this._x1+t)/6,n=(this._y0+4*this._y1+e)/6;this._line?this._context.lineTo(r,n):this._context.moveTo(r,n);break;case 3:this._point=4;default:Qm(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function $ie(t){return new hF(t)}function pF(t){this._context=t}pF.prototype={areaStart:Xm,areaEnd:Xm,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(t,e){t=+t,e=+e,this._point?this._context.lineTo(t,e):(this._point=1,this._context.moveTo(t,e))}};function jie(t){return new pF(t)}function SC(t){return t<0?-1:1}function EC(t,e,r){var n=t._x1-t._x0,i=e-t._x1,s=(t._y1-t._y0)/(n||i<0&&-0),a=(r-t._y1)/(i||n<0&&-0),o=(s*i+a*n)/(n+i);return(SC(s)+SC(a))*Math.min(Math.abs(s),Math.abs(a),.5*Math.abs(o))||0}function TC(t,e){var r=t._x1-t._x0;return r?(3*(t._y1-t._y0)/r-e)/2:e}function Y0(t,e,r){var n=t._x0,i=t._y0,s=t._x1,a=t._y1,o=(s-n)/3;t._context.bezierCurveTo(n+o,i+o*e,s-o,a-o*r,s,a)}function Jm(t){this._context=t}Jm.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:Y0(this,this._t0,TC(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){var r=NaN;if(t=+t,e=+e,!(t===this._x1&&e===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3,Y0(this,TC(this,r=EC(this,t,e)),r);break;default:Y0(this,this._t0,r=EC(this,t,e));break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e,this._t0=r}}};function mF(t){this._context=new gF(t)}(mF.prototype=Object.create(Jm.prototype)).point=function(t,e){Jm.prototype.point.call(this,e,t)};function gF(t){this._context=t}gF.prototype={moveTo:function(t,e){this._context.moveTo(e,t)},closePath:function(){this._context.closePath()},lineTo:function(t,e){this._context.lineTo(e,t)},bezierCurveTo:function(t,e,r,n,i,s){this._context.bezierCurveTo(e,t,n,r,s,i)}};function Fie(t){return new Jm(t)}function Bie(t){return new mF(t)}function vF(t){this._context=t}vF.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var t=this._x,e=this._y,r=t.length;if(r)if(this._line?this._context.lineTo(t[0],e[0]):this._context.moveTo(t[0],e[0]),r===2)this._context.lineTo(t[1],e[1]);else for(var n=_C(t),i=_C(e),s=0,a=1;a<r;++s,++a)this._context.bezierCurveTo(n[0][s],i[0][s],n[1][s],i[1][s],t[a],e[a]);(this._line||this._line!==0&&r===1)&&this._context.closePath(),this._line=1-this._line,this._x=this._y=null},point:function(t,e){this._x.push(+t),this._y.push(+e)}};function _C(t){var e,r=t.length-1,n,i=new Array(r),s=new Array(r),a=new Array(r);for(i[0]=0,s[0]=2,a[0]=t[0]+2*t[1],e=1;e<r-1;++e)i[e]=1,s[e]=4,a[e]=4*t[e]+2*t[e+1];for(i[r-1]=2,s[r-1]=7,a[r-1]=8*t[r-1]+t[r],e=1;e<r;++e)n=i[e]/s[e-1],s[e]-=n,a[e]-=n*a[e-1];for(i[r-1]=a[r-1]/s[r-1],e=r-2;e>=0;--e)i[e]=(a[e]-i[e+1])/s[e];for(s[r-1]=(t[r]+i[r-1])/2,e=0;e<r-1;++e)s[e]=2*t[e+1]-i[e+1];return[i,s]}function Uie(t){return new vF(t)}function Zv(t,e){this._context=t,this._t=e}Zv.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=this._y=NaN,this._point=0},lineEnd:function(){0<this._t&&this._t<1&&this._point===2&&this._context.lineTo(this._x,this._y),(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line>=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;
vendor: 10,630 bytes, lines 297-300
297default:{if(this._t<=0)this._context.lineTo(this._x,e),this._context.lineTo(t,e);else{var r=this._x*(1-this._t)+t*this._t;this._context.lineTo(r,this._y),this._context.lineTo(r,e)}break}}this._x=t,this._y=e}};function Gie(t){return new Zv(t,.5)}function Wie(t){return new Zv(t,0)}function Vie(t){return new Zv(t,1)}function Ac(t,e){if((a=t.length)>1)for(var r=1,n,i,s=t[e[0]],a,o=s.length;r<a;++r)for(i=s,s=t[e[r]],n=0;n<o;++n)s[n][1]+=s[n][0]=isNaN(i[n][1])?i[n][0]:i[n][1]}function Mw(t){for(var e=t.length,r=new Array(e);--e>=0;)r[e]=e;return r}function Hie(t,e){return t[e]}function Kie(t){const e=[];return e.key=t,e}function zie(){var t=lt([]),e=Mw,r=Ac,n=Hie;function i(s){var a=Array.from(t.apply(this,arguments),Kie),o,l=a.length,c=-1,u;for(const d of s)for(o=0,++c;o<l;++o)(a[o][c]=[0,+n(d,a[o].key,c,s)]).data=d;for(o=0,u=l_(e(a));o<l;++o)a[u[o]].index=o;return r(a,u),a}return i.keys=function(s){return arguments.length?(t=typeof s=="function"?s:lt(Array.from(s)),i):t},i.value=function(s){return arguments.length?(n=typeof s=="function"?s:lt(+s),i):n},i.order=function(s){return arguments.length?(e=s==null?Mw:typeof s=="function"?s:lt(Array.from(s)),i):e},i.offset=function(s){return arguments.length?(r=s??Ac,i):r},i}function qie(t,e){if((n=t.length)>0){for(var r,n,i=0,s=t[0].length,a;i<s;++i){for(a=r=0;r<n;++r)a+=t[r][i][1]||0;if(a)for(r=0;r<n;++r)t[r][i][1]/=a}Ac(t,e)}}function Yie(t,e){if((i=t.length)>0){for(var r=0,n=t[e[0]],i,s=n.length;r<s;++r){for(var a=0,o=0;a<i;++a)o+=t[a][r][1]||0;n[r][1]+=n[r][0]=-o/2}Ac(t,e)}}function Xie(t,e){if(!(!((a=t.length)>0)||!((s=(i=t[e[0]]).length)>0))){for(var r=0,n=1,i,s,a;n<s;++n){for(var o=0,l=0,c=0;o<a;++o){for(var u=t[e[o]],d=u[n][1]||0,f=u[n-1][1]||0,h=(d-f)/2,p=0;p<o;++p){var g=t[e[p]],m=g[n][1]||0,v=g[n-1][1]||0;h+=m-v}l+=d,c+=h*d}i[n-1][1]+=i[n-1][0]=r,l&&(r-=c/l)}i[n-1][1]+=i[n-1][0]=r,Ac(t,e)}}function of(t){"@babel/helpers - typeof";return of=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},of(t)}var Qie=["type","size","sizeType"];function $w(){return $w=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},$w.apply(this,arguments)}function AC(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function PC(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?AC(Object(r),!0).forEach(function(n){Jie(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):AC(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function Jie(t,e,r){return e=Zie(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Zie(t){var e=ese(t,"string");return of(e)=="symbol"?e:e+""}function ese(t,e){if(of(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(of(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function tse(t,e){if(t==null)return{};var r=rse(t,e),n,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(i=0;i<s.length;i++)n=s[i],!(e.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function rse(t,e){if(t==null)return{};var r={};for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(e.indexOf(n)>=0)continue;r[n]=t[n]}return r}var yF={symbolCircle:c_,symbolCross:Eie,symbolDiamond:_ie,symbolSquare:Aie,symbolStar:Oie,symbolTriangle:Rie,symbolWye:Lie},nse=Math.PI/180,ise=function(e){var r="symbol".concat(Xv(e));return yF[r]||c_},sse=function(e,r,n){if(r==="area")return e;switch(n){case"cross":return 5*e*e/9;case"diamond":return .5*e*e/Math.sqrt(3);case"square":return e*e;case"star":{var i=18*nse;return 1.25*e*e*(Math.tan(i)-Math.tan(i*2)*Math.pow(Math.tan(i),2))}case"triangle":return Math.sqrt(3)*e*e/4;case"wye":return(21-10*Math.sqrt(3))*e*e/8;default:return Math.PI*e*e/4}},ase=function(e,r){yF["symbol".concat(Xv(e))]=r},u_=function(e){var r=e.type,n=r===void 0?"circle":r,i=e.size,s=i===void 0?64:i,a=e.sizeType,o=a===void 0?"area":a,l=tse(e,Qie),c=PC(PC({},l),{},{type:n,size:s,sizeType:o}),u=function(){var m=ise(n),v=Die().type(m).size(sse(s,o,n));return v()},d=c.className,f=c.cx,h=c.cy,p=Ue(c,!0);return f===+f&&h===+h&&s===+s?F.createElement("path",$w({},p,{className:Me("recharts-symbols",d),transform:"translate(".concat(f,", ").concat(h,")"),d:u()})):null};u_.registerSymbol=ase;function Pc(t){"@babel/helpers - typeof";return Pc=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Pc(t)}function jw(){return jw=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},jw.apply(this,arguments)}function IC(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function ose(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?IC(Object(r),!0).forEach(function(n){lf(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):IC(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function lse(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function cse(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,xF(n.key),n)}}function use(t,e,r){return e&&cse(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function dse(t,e,r){return e=Zm(e),fse(t,bF()?Reflect.construct(e,r||[],Zm(t).constructor):e.apply(t,r))}function fse(t,e){if(e&&(Pc(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return hse(t)}function hse(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function bF(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(bF=function(){return!!t})()}function Zm(t){return Zm=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Zm(t)}function pse(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Fw(t,e)}function Fw(t,e){return Fw=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},Fw(t,e)}function lf(t,e,r){return e=xF(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function xF(t){var e=mse(t,"string");return Pc(e)=="symbol"?e:e+""}function mse(t,e){if(Pc(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(Pc(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}var wn=32,d_=function(t){function e(){return lse(this,e),dse(this,e,arguments)}return pse(e,t),use(e,[{key:"renderIcon",value:function(n){var i=this.props.inactiveColor,s=wn/2,a=wn/6,o=wn/3,l=n.inactive?i:n.color;if(n.type==="plainline")return F.createElement("line",{strokeWidth:4,fill:"none",stroke:l,strokeDasharray:n.payload.strokeDasharray,x1:0,y1:s,x2:wn,y2:s,className:"recharts-legend-icon"});if(n.type==="line")return F.createElement("path",{strokeWidth:4,fill:"none",stroke:l,d:"M0,".concat(s,"h").concat(o,`
298            A`).concat(a,",").concat(a,",0,1,1,").concat(2*o,",").concat(s,`
299            H`).concat(wn,"M").concat(2*o,",").concat(s,`
300            A`).concat(a,",").concat(a,",0,1,1,").concat(o,",").concat(s),className:"recharts-legend-icon"});if(n.type==="rect")return F.createElement("path",{stroke:"none",fill:l,d:"M0,".concat(wn/8,"h").concat(wn,"v").concat(wn*3/4,"h").concat(-wn,"z"),className:"recharts-legend-icon"});if(F.isValidElement(n.legendIcon)){var c=ose({},n);return delete c.legendIcon,F.cloneElement(n.legendIcon,c)}return F.createElement(u_,{fill:l,cx:s,cy:s,size:wn,sizeType:"diameter",type:n.type})}},{key:"renderItems",value:function(){var n=this,i=this.props,s=i.payload,a=i.iconSize,o=i.layout,l=i.formatter,c=i.inactiveColor,u={x:0,y:0,width:wn,height:wn},d={display:o==="horizontal"?"inline-block":"block",marginRight:10},f={display:"inline-block",verticalAlign:"middle",marginRight:4};return s.map(function(h,p){var g=h.formatter||l,m=Me(lf(lf({"recharts-legend-item":!0},"legend-item-".concat(p),!0),"inactive",h.inactive));if(h.type==="none")return null;var v=De(h.value)?null:h.value;_o(!De(h.value),`The name property is also required when using a function for the dataKey of a chart's cartesian components. Ex: <Bar name="Name of my Data"/>`);var y=h.inactive?c:h.color;return F.createElement("li",jw({className:m,style:d,key:"legend-item-".concat(p)},zm(n.props,h,p)),F.createElement(Cw,{width:a,height:a,viewBox:u,style:f},n.renderIcon(h)),F.createElement("span",{className:"recharts-legend-item-text",style:{color:y}},g?g(v,h,p):v))})}},{key:"render",value:function(){var n=this.props,i=n.payload,s=n.layout,a=n.align;if(!i||!i.length)return null;var o={padding:0,margin:0,textAlign:s==="horizontal"?a:"left"};return F.createElement("ul",{className:"recharts-default-legend",style:o},this.renderItems())}}])}(E.PureComponent);lf(d_,"displayName","Legend");lf(d_,"defaultProps",{iconSize:14,layout:"horizontal",align:"center",verticalAlign:"middle",inactiveColor:"#ccc"});var gse=Mv;function vse(){this.__data__=new gse,this.size=0}var yse=vse;function bse(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r}var xse=bse;function wse(t){return this.__data__.get(t)}var Sse=wse;function Ese(t){return this.__data__.has(t)}
vendor: 8,389 bytes, line 300
300var Tse=Ese,_se=Mv,Ase=JT,Pse=ZT,Ise=200;function Cse(t,e){var r=this.__data__;if(r instanceof _se){var n=r.__data__;if(!Ase||n.length<Ise-1)return n.push([t,e]),this.size=++r.size,this;r=this.__data__=new Pse(n)}return r.set(t,e),this.size=r.size,this}var Ose=Cse,Rse=Mv,kse=yse,Lse=xse,Dse=Sse,Nse=Tse,Mse=Ose;function mu(t){var e=this.__data__=new Rse(t);this.size=e.size}mu.prototype.clear=kse;mu.prototype.delete=Lse;mu.prototype.get=Dse;mu.prototype.has=Nse;mu.prototype.set=Mse;var wF=mu,$se="__lodash_hash_undefined__";function jse(t){return this.__data__.set(t,$se),this}var Fse=jse;function Bse(t){return this.__data__.has(t)}var Use=Bse,Gse=ZT,Wse=Fse,Vse=Use;function eg(t){var e=-1,r=t==null?0:t.length;for(this.__data__=new Gse;++e<r;)this.add(t[e])}eg.prototype.add=eg.prototype.push=Wse;eg.prototype.has=Vse;var SF=eg;function Hse(t,e){for(var r=-1,n=t==null?0:t.length;++r<n;)if(e(t[r],r,t))return!0;return!1}var EF=Hse;function Kse(t,e){return t.has(e)}var TF=Kse,zse=SF,qse=EF,Yse=TF,Xse=1,Qse=2;function Jse(t,e,r,n,i,s){var a=r&Xse,o=t.length,l=e.length;if(o!=l&&!(a&&l>o))return!1;var c=s.get(t),u=s.get(e);if(c&&u)return c==e&&u==t;var d=-1,f=!0,h=r&Qse?new zse:void 0;for(s.set(t,e),s.set(e,t);++d<o;){var p=t[d],g=e[d];if(n)var m=a?n(g,p,d,e,t,s):n(p,g,d,t,e,s);if(m!==void 0){if(m)continue;f=!1;break}if(h){if(!qse(e,function(v,y){if(!Yse(h,y)&&(p===v||i(p,v,r,n,s)))return h.push(y)})){f=!1;break}}else if(!(p===g||i(p,g,r,n,s))){f=!1;break}}return s.delete(t),s.delete(e),f}var _F=Jse,Zse=Vi,eae=Zse.Uint8Array,tae=eae;function rae(t){var e=-1,r=Array(t.size);return t.forEach(function(n,i){r[++e]=[i,n]}),r}var nae=rae;function iae(t){var e=-1,r=Array(t.size);return t.forEach(function(n){r[++e]=n}),r}var f_=iae,CC=ih,OC=tae,sae=QT,aae=_F,oae=nae,lae=f_,cae=1,uae=2,dae="[object Boolean]",fae="[object Date]",hae="[object Error]",pae="[object Map]",mae="[object Number]",gae="[object RegExp]",vae="[object Set]",yae="[object String]",bae="[object Symbol]",xae="[object ArrayBuffer]",wae="[object DataView]",RC=CC?CC.prototype:void 0,X0=RC?RC.valueOf:void 0;function Sae(t,e,r,n,i,s,a){switch(r){case wae:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case xae:return!(t.byteLength!=e.byteLength||!s(new OC(t),new OC(e)));case dae:case fae:case mae:return sae(+t,+e);case hae:return t.name==e.name&&t.message==e.message;case gae:case yae:return t==e+"";case pae:var o=oae;case vae:var l=n&cae;if(o||(o=lae),t.size!=e.size&&!l)return!1;var c=a.get(t);if(c)return c==e;n|=uae,a.set(t,e);var u=aae(o(t),o(e),n,i,s,a);return a.delete(t),u;case bae:if(X0)return X0.call(t)==X0.call(e)}return!1}var Eae=Sae;function Tae(t,e){for(var r=-1,n=e.length,i=t.length;++r<n;)t[i+r]=e[r];return t}var AF=Tae,_ae=AF,Aae=Yr;function Pae(t,e,r){var n=e(t);return Aae(t)?n:_ae(n,r(t))}var Iae=Pae;function Cae(t,e){for(var r=-1,n=t==null?0:t.length,i=0,s=[];++r<n;){var a=t[r];e(a,r,t)&&(s[i++]=a)}return s}var Oae=Cae;function Rae(){return[]}var kae=Rae,Lae=Oae,Dae=kae,Nae=Object.prototype,Mae=Nae.propertyIsEnumerable,kC=Object.getOwnPropertySymbols,$ae=kC?function(t){return t==null?[]:(t=Object(t),Lae(kC(t),function(e){return Mae.call(t,e)}))}:Dae,jae=$ae;function Fae(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n}var Bae=Fae,Uae=Os,Gae=Rs,Wae="[object Arguments]";function Vae(t){return Gae(t)&&Uae(t)==Wae}var Hae=Vae,LC=Hae,Kae=Rs,PF=Object.prototype,zae=PF.hasOwnProperty,qae=PF.propertyIsEnumerable,Yae=LC(function(){return arguments}())?LC:function(t){return Kae(t)&&zae.call(t,"callee")&&!qae.call(t,"callee")},h_=Yae,tg={exports:{}};function Xae(){return!1}var Qae=Xae;tg.exports;(function(t,e){var r=Vi,n=Qae,i=e&&!e.nodeType&&e,s=i&&!0&&t&&!t.nodeType&&t,a=s&&s.exports===i,o=a?r.Buffer:void 0,l=o?o.isBuffer:void 0,c=l||n;t.exports=c})(tg,tg.exports);var IF=tg.exports,Jae=9007199254740991,Zae=/^(?:0|[1-9]\d*)$/;function eoe(t,e){var r=typeof t;return e=e??Jae,!!e&&(r=="number"||r!="symbol"&&Zae.test(t))&&t>-1&&t%1==0&&t<e}var p_=eoe,toe=9007199254740991;function roe(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=toe}var m_=roe,noe=Os,ioe=m_,soe=Rs,aoe="[object Arguments]",ooe="[object Array]",loe="[object Boolean]",coe="[object Date]",uoe="[object Error]",doe="[object Function]",foe="[object Map]",hoe="[object Number]",poe="[object Object]",moe="[object RegExp]",goe="[object Set]",voe="[object String]",yoe="[object WeakMap]",boe="[object ArrayBuffer]",xoe="[object DataView]",woe="[object Float32Array]",Soe="[object Float64Array]",Eoe="[object Int8Array]",Toe="[object Int16Array]",_oe="[object Int32Array]",Aoe="[object Uint8Array]",Poe="[object Uint8ClampedArray]",Ioe="[object Uint16Array]",Coe="[object Uint32Array]",pt={};pt[woe]=pt[Soe]=pt[Eoe]=pt[Toe]=pt[_oe]=pt[Aoe]=pt[Poe]=pt[Ioe]=pt[Coe]=!0;pt[aoe]=pt[ooe]=pt[boe]=pt[loe]=pt[xoe]=pt[coe]=pt[uoe]=pt[doe]=pt[foe]=pt[hoe]=pt[poe]=pt[moe]=pt[goe]=pt[voe]=pt[yoe]=!1;function Ooe(t){return soe(t)&&ioe(t.length)&&!!pt[noe(t)]}var Roe=Ooe;function koe(t){return function(e){return t(e)}}var CF=koe,rg={exports:{}};rg.exports;(function(t,e){var r=$2,n=e&&!e.nodeType&&e,i=n&&!0&&t&&!t.nodeType&&t,s=i&&i.exports===n,a=s&&r.process,o=function(){try{var l=i&&i.require&&i.require("util").types;return l||a&&a.binding&&a.binding("util")}catch{}}();t.exports=o})(rg,rg.exports);var Loe=rg.exports,Doe=Roe,Noe=CF,DC=Loe,NC=DC&&DC.isTypedArray,Moe=NC?Noe(NC):Doe,OF=Moe,$oe=Bae,joe=h_,Foe=Yr,Boe=IF,Uoe=p_,Goe=OF,Woe=Object.prototype,Voe=Woe.hasOwnProperty;function Hoe(t,e){var r=Foe(t),n=!r&&joe(t),i=!r&&!n&&Boe(t),s=!r&&!n&&!i&&Goe(t),a=r||n||i||s,o=a?$oe(t.length,String):[],l=o.length;for(var c in t)(e||Voe.call(t,c))&&!(a&&(c=="length"||i&&(c=="offset"||c=="parent")||s&&(c=="buffer"||c=="byteLength"||c=="byteOffset")||Uoe(c,l)))&&o.push(c);return o}var Koe=Hoe,zoe=Object.prototype;function qoe(t){var e=t&&t.constructor,r=typeof e=="function"&&e.prototype||zoe;return t===r}var Yoe=qoe;function Xoe(t,e){return function(r){return t(e(r))}}var RF=Xoe,Qoe=RF,Joe=Qoe(Object.keys,Object),Zoe=Joe,ele=Yoe,tle=Zoe,rle=Object.prototype,nle=rle.hasOwnProperty;function ile(t){if(!ele(t))return tle(t);var e=[];for(var r in Object(t))nle.call(t,r)&&r!="constructor"&&e.push(r);return e}var sle=ile,ale=XT,ole=m_;function lle(t){return t!=null&&ole(t.length)&&!ale(t)}var ey=lle,cle=Koe,ule=sle,dle=ey;function fle(t){return dle(t)?cle(t):ule(t)}var g_=fle,hle=Iae,ple=jae,mle=g_;function gle(t){return hle(t,mle,ple)}var vle=gle,MC=vle,yle=1,ble=Object.prototype,xle=ble.hasOwnProperty;function wle(t,e,r,n,i,s){var a=r&yle,o=MC(t),l=o.length,c=MC(e),u=c.length;if(l!=u&&!a)return!1;for(var d=l;d--;){var f=o[d];if(!(a?f in e:xle.call(e,f)))return!1}var h=s.get(t),p=s.get(e);if(h&&p)return h==e&&p==t;var g=!0;s.set(t,e),s.set(e,t);for(var m=a;++d<l;){f=o[d];var v=t[f],y=e[f];if(n)var b=a?n(y,v,f,e,t,s):n(v,y,f,t,e,s);if(!(b===void 0?v===y||i(v,y,r,n,s):b)){g=!1;break}m||(m=f=="constructor")}if(g&&!m){var w=t.constructor,S=e.constructor;w!=S&&"constructor"in t&&"constructor"in e&&!(typeof w=="function"&&w instanceof w&&typeof S=="function"&&S instanceof S)&&(g=!1)}return s.delete(t),s.delete(e),g}var Sle=wle,Ele=Yo,Tle=Vi,_le=Ele(Tle,"DataView"),Ale=_le,Ple=Yo,Ile=Vi,Cle=Ple(Ile,"Promise"),Ole=Cle,Rle=Yo,kle=Vi,Lle=Rle(kle,"Set"),kF=Lle,Dle=Yo,Nle=Vi,Mle=Dle(Nle,"WeakMap"),$le=Mle,Bw=Ale,Uw=JT,Gw=Ole,Ww=kF,Vw=$le,LF=Os,gu=F2,$C="[object Map]",jle="[object Object]",jC="[object Promise]",FC="[object Set]",BC="[object WeakMap]",UC="[object DataView]",Fle=gu(Bw),Ble=gu(Uw),Ule=gu(Gw),Gle=gu(Ww),Wle=gu(Vw),eo=LF;(Bw&&eo(new Bw(new ArrayBuffer(1)))!=UC||Uw&&eo(new Uw)!=$C||Gw&&eo(Gw.resolve())!=jC||Ww&&eo(new Ww)!=FC||Vw&&eo(new Vw)!=BC)&&(eo=function(t){var e=LF(t),r=e==jle?t.constructor:void 0,n=r?gu(r):"";if(n)switch(n){case Fle:return UC;case Ble:return $C;case Ule:return jC;case Gle:return FC;case Wle:return BC}return e});var Vle=eo,Q0=wF,Hle=_F,Kle=Eae,zle=Sle,GC=Vle,WC=Yr,VC=IF,qle=OF,Yle=1,HC="[object Arguments]",KC="[object Array]",cp="[object Object]",Xle=Object.prototype,zC=Xle.hasOwnProperty;function Qle(t,e,r,n,i,s){var a=WC(t),o=WC(e),l=a?KC:GC(t),c=o?KC:GC(e);l=l==HC?cp:l,c=c==HC?cp:c;var u=l==cp,d=c==cp,f=l==c;if(f&&VC(t)){if(!VC(e))return!1;a=!0,u=!1}if(f&&!u)return s||(s=new Q0),a||qle(t)?Hle(t,e,r,n,i,s):Kle(t,e,l,r,n,i,s);if(!(r&Yle)){var h=u&&zC.call(t,"__wrapped__"),p=d&&zC.call(e,"__wrapped__");
vendor: 4,114 bytes, line 300
300if(h||p){var g=h?t.value():t,m=p?e.value():e;return s||(s=new Q0),i(g,m,r,n,s)}}return f?(s||(s=new Q0),zle(t,e,r,n,i,s)):!1}var Jle=Qle,Zle=Jle,qC=Rs;function DF(t,e,r,n,i){return t===e?!0:t==null||e==null||!qC(t)&&!qC(e)?t!==t&&e!==e:Zle(t,e,r,n,DF,i)}var v_=DF,ece=wF,tce=v_,rce=1,nce=2;function ice(t,e,r,n){var i=r.length,s=i,a=!n;if(t==null)return!s;for(t=Object(t);i--;){var o=r[i];if(a&&o[2]?o[1]!==t[o[0]]:!(o[0]in t))return!1}for(;++i<s;){o=r[i];var l=o[0],c=t[l],u=o[1];if(a&&o[2]){if(c===void 0&&!(l in t))return!1}else{var d=new ece;if(n)var f=n(c,u,l,t,e,d);if(!(f===void 0?tce(u,c,rce|nce,n,d):f))return!1}}return!0}var sce=ice,ace=ka;function oce(t){return t===t&&!ace(t)}var NF=oce,lce=NF,cce=g_;function uce(t){for(var e=cce(t),r=e.length;r--;){var n=e[r],i=t[n];e[r]=[n,i,lce(i)]}return e}var dce=uce;function fce(t,e){return function(r){return r==null?!1:r[t]===e&&(e!==void 0||t in Object(r))}}var MF=fce,hce=sce,pce=dce,mce=MF;function gce(t){var e=pce(t);return e.length==1&&e[0][2]?mce(e[0][0],e[0][1]):function(r){return r===t||hce(r,t,e)}}var vce=gce;function yce(t,e){return t!=null&&e in Object(t)}var bce=yce,xce=V2,wce=h_,Sce=Yr,Ece=p_,Tce=m_,_ce=jv;function Ace(t,e,r){e=xce(e,t);for(var n=-1,i=e.length,s=!1;++n<i;){var a=_ce(e[n]);if(!(s=t!=null&&r(t,a)))break;t=t[a]}return s||++n!=i?s:(i=t==null?0:t.length,!!i&&Tce(i)&&Ece(a,i)&&(Sce(t)||wce(t)))}var Pce=Ace,Ice=bce,Cce=Pce;function Oce(t,e){return t!=null&&Cce(t,e,Ice)}var Rce=Oce,kce=v_,Lce=H2,Dce=Rce,Nce=YT,Mce=NF,$ce=MF,jce=jv,Fce=1,Bce=2;function Uce(t,e){return Nce(t)&&Mce(e)?$ce(jce(t),e):function(r){var n=Lce(r,t);return n===void 0&&n===e?Dce(r,t):kce(e,n,Fce|Bce)}}var Gce=Uce;function Wce(t){return t}var vu=Wce;function Vce(t){return function(e){return e==null?void 0:e[t]}}var Hce=Vce,Kce=r_;function zce(t){return function(e){return Kce(e,t)}}var qce=zce,Yce=Hce,Xce=qce,Qce=YT,Jce=jv;function Zce(t){return Qce(t)?Yce(Jce(t)):Xce(t)}var eue=Zce,tue=vce,rue=Gce,nue=vu,iue=Yr,sue=eue;function aue(t){return typeof t=="function"?t:t==null?nue:typeof t=="object"?iue(t)?rue(t[0],t[1]):tue(t):sue(t)}var yu=aue;function oue(t,e,r,n){for(var i=t.length,s=r+(n?1:-1);n?s--:++s<i;)if(e(t[s],s,t))return s;return-1}var lue=oue;function cue(t){return t!==t}var uue=cue;function due(t,e,r){for(var n=r-1,i=t.length;++n<i;)if(t[n]===e)return n;return-1}var fue=due,hue=lue,pue=uue,mue=fue;function gue(t,e,r){return e===e?mue(t,e,r):hue(t,pue,r)}var vue=gue,yue=vue;function bue(t,e){var r=t==null?0:t.length;return!!r&&yue(t,e,0)>-1}var xue=bue;function wue(t,e,r){for(var n=-1,i=t==null?0:t.length;++n<i;)if(r(e,t[n]))return!0;return!1}var Sue=wue;function Eue(){}var Tue=Eue,J0=kF,_ue=Tue,Aue=f_,Pue=1/0,Iue=J0&&1/Aue(new J0([,-0]))[1]==Pue?function(t){return new J0(t)}:_ue,Cue=Iue,Oue=SF,Rue=xue,kue=Sue,Lue=TF,Due=Cue,Nue=f_,Mue=200;function $ue(t,e,r){var n=-1,i=Rue,s=t.length,a=!0,o=[],l=o;if(r)a=!1,i=kue;else if(s>=Mue){var c=e?null:Due(t);if(c)return Nue(c);a=!1,i=Lue,l=new Oue}else l=e?[]:o;e:for(;++n<s;){var u=t[n],d=e?e(u):u;if(u=r||u!==0?u:0,a&&d===d){for(var f=l.length;f--;)if(l[f]===d)continue e;e&&l.push(d),o.push(u)}else i(l,d,r)||(l!==o&&l.push(d),o.push(u))}return o}var jue=$ue,Fue=yu,Bue=jue;function Uue(t,e){return t&&t.length?Bue(t,Fue(e)):[]}var Gue=Uue;const YC=at(Gue);function $F(t,e,r){return e===!0?YC(t,r):De(e)?YC(t,e):t}function Ic(t){"@babel/helpers - typeof";return Ic=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ic(t)}var Wue=["ref"];function XC(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function Qi(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?XC(Object(r),!0).forEach(function(n){ty(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):XC(Object(r)).forEac
vendor: 4,250 bytes, line 300
300h(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function Vue(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function QC(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,FF(n.key),n)}}function Hue(t,e,r){return e&&QC(t.prototype,e),r&&QC(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function Kue(t,e,r){return e=ng(e),zue(t,jF()?Reflect.construct(e,r||[],ng(t).constructor):e.apply(t,r))}function zue(t,e){if(e&&(Ic(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return que(t)}function que(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function jF(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(jF=function(){return!!t})()}function ng(t){return ng=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},ng(t)}function Yue(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Hw(t,e)}function Hw(t,e){return Hw=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},Hw(t,e)}function ty(t,e,r){return e=FF(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function FF(t){var e=Xue(t,"string");return Ic(e)=="symbol"?e:e+""}function Xue(t,e){if(Ic(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(Ic(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}function Que(t,e){if(t==null)return{};var r=Jue(t,e),n,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(i=0;i<s.length;i++)n=s[i],!(e.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function Jue(t,e){if(t==null)return{};var r={};for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(e.indexOf(n)>=0)continue;r[n]=t[n]}return r}function Zue(t){return t.value}function ede(t,e){if(F.isValidElement(t))return F.cloneElement(t,e);if(typeof t=="function")return F.createElement(t,e);e.ref;var r=Que(e,Wue);return F.createElement(d_,r)}var JC=1,rc=function(t){function e(){var r;Vue(this,e);for(var n=arguments.length,i=new Array(n),s=0;s<n;s++)i[s]=arguments[s];return r=Kue(this,e,[].concat(i)),ty(r,"lastBoundingBox",{width:-1,height:-1}),r}return Yue(e,t),Hue(e,[{key:"componentDidMount",value:function(){this.updateBBox()}},{key:"componentDidUpdate",value:function(){this.updateBBox()}},{key:"getBBox",value:function(){if(this.wrapperNode&&this.wrapperNode.getBoundingClientRect){var n=this.wrapperNode.getBoundingClientRect();return n.height=this.wrapperNode.offsetHeight,n.width=this.wrapperNode.offsetWidth,n}return null}},{key:"updateBBox",value:function(){var n=this.props.onBBoxUpdate,i=this.getBBox();i?(Math.abs(i.width-this.lastBoundingBox.width)>JC||Math.abs(i.height-this.lastBoundingBox.height)>JC)&&(this.lastBoundingBox.width=i.width,this.lastBoundingBox.height=i.height,n&&n(i)):(this.lastBoundingBox.width!==-1||this.lastBoundingBox.height!==-1)&&(this.lastBoundingBox.width=-1,this.lastBoundingBox.height=-1,n&&n(null))}},{key:"getBBoxSnapshot",value:function(){return this.lastBoundingBox.width>=0&&this.lastBoundingBox.height>=0?Qi({},this.lastBoundingBox):{width:0,height:0}}},{key:"getDefaultPosition",value:function(n){var i=this.props,s=i.layout,a=i.align,o=i.verticalAlign,l=i.margin,c=i.chartWidth,u=i.chartHeight,d,f;if(!n||(n.left===void 0||n.left===null)&&(n.right===void 0||n.right===null))if(a==="center"&&s==="vertical"){var h=this.getBBoxSnapshot();d={left:((c||0)-h.width)/2}}else d=a==="right"?{right:l&&l.right||0}:{left:l&&l.left||0};if(!n||(n.top===void 0||n.top===null)&&(n.bottom===void 0||n.bottom===null))if(o==="middle"){var p=this.getBBoxSnapsh
300ot();f={top:((u||0)-p.height)/2}}else f=o==="bottom"?{bottom:l&&l.bottom||0}:{top:l&&l.top||0};return Qi(Qi({},d),f)}},{key:"render",value:function(){var n=this,i=this.props,s=i.content,a=i.width,o=i.height,l=i.wrapperStyle,c=i.payloadUniqBy,u=i.payload,d=Qi(Qi({position:"absolute",width:a||"auto",height:o||"auto"},this.getDefaultPosition(l)),l);return F.createElement("div",{className:"recharts-legend-wrapper",style:d,ref:function(h){n.wrapperNode=h}},ede(s,Qi(Qi({},this.props),{},{payload:$F(u,c,Zue)})))}}],[{key:"getWithHeight",value:function(n,i){var s=Qi(Qi({},this.defaultProps),n.props),a=s.layout;return a==="vertical"&&ae(n.props.height)?{height:n.props.height}:a==="horizontal"?{width:n.props.width||i}:null}}])}(E.PureComponent);ty(rc,"displayName","Legend");ty(rc,"defaultProps",{iconSize:14,layout:"horizontal",align:"center",verticalAlign:"bottom"});var ZC=ih,tde=h_,rde=Yr,eO=ZC?ZC.isConcatSpreadable:void 0;function nde(t){return rde(t)||tde(t)||!!(eO&&t&&t[eO])}var ide=nde,sde=AF,ade=ide;function BF(t,e,r,n,i){var s=-1,a=t.length;for(r||(r=ade),i||(i=[]);++s<a;){var o=t[s];e>0&&r(o)?e>1?BF(o,e-1,r,n,i):sde(i,o):n||(i[i.length]=o)}return i}var UF=BF;function ode(t){return function(e,r,n){for(var i=-1,s=Object(e),a=n(e),o=a.length;o--;){var l=a[t?o:++i];if(r(s[l],l,s)===!1)break}return e}}var lde=ode,cde=lde,ude=cde(),dde=ude,fde=dde,hde=g_;function pde(t,e){return t&&fde(t,e,hde)}var GF=pde,mde=ey;function gde(t,e){return function(r,n){if(r==null)return r;if(!mde(r))return t(r,n);for(var i=r.length,s=e?i:-1,a=Object(r);(e?s--:++s<i)&&n(a[s],s,a)!==!1;);return r}}var vde=gde,yde=GF,bde=vde,xde=bde(yde),y_=xde,wde=y_,Sde=ey;function Ede(t,e){var r=-1,n=Sde(t)?Array(t.length):[];return wde(t,function(i,s,a){n[++r]=e(i,s,a)}),n}var WF=Ede;function Tde(t,e){var r=t.length;for(t.sort(e);r--;)t[r]=t[r].value;return t}var _de=Tde,tO=uu;function Ade(t,e){if(t!==e){var r=t!==void 0,n=t===null,i=t===t,s=tO(t),a=e!==void 0,o=e===null,l=e===e,c=tO(e);if(!o&&!c&&!s&&t>e||s&&a&&l&&!o&&!c||n&&a&&l||!r&&l||!i)return 1;if(!n&&!s&&!c&&t<e||c&&r&&i&&!n&&!s||o&&r&&i||!a&&i||!l)return-1}return 0}var Pde=Ade,Ide=Pde;function Cde(t,e,r){for(var n=-1,i=t.criteria,s=e.criteria,a=i.length,o=r.length;++n<a;){var l=Ide(i[n],s[n]);if(l){if(n>=o)return l;var c=r[n];return l*(c=="desc"?-1:1)}}return t.index-e.index}var Ode=Cde,Z0=t_,Rde=r_,kde=yu,Lde=WF,Dde=_de,Nde=CF,Mde=Ode,$de=vu,jde=Yr;function Fde(t,e,r){e.length?e=Z0(e,function(s){return jde(s)?function(a){return Rde(a,s.length===1?s[0]:s)}:s}):e=[$de];var n=-1;e=Z0(e,Nde(kde));var i=Lde(t,function(s,a,o){var l=Z0(e,function(c){return c(s)});return{criteria:l,index:++n,value:s}});return Dde(i,function(s,a){return Mde(s,a,r)})}var Bde=Fde;function Ude(t,e,r){switch(r.length){case 0:return t.call(e);case 1:return t.call(e,r[0]);case 2:return t.call(e,r[0],r[1]);case 3:return t.call(e,r[0],r[1],r[2])}return t.apply(e,r)}var Gde=Ude,Wde=Gde,rO=Math.max;function Vde(t,e,r){return e=rO(e===void 0?t.length-1:e,0),function(){for(var n=arguments,i=-1,s=rO(n.length-e,0),a=Array(s);++i<s;)a[i]=n[e+i];i=-1;for(var o=Array(e+1);++i<e;)o[i]=n[i];return o[e]=r(a),Wde(t,this,o)}}var Hde=Vde;function Kde(t){return function(){return t}}var zde=Kde,qde=Yo,Yde=function(){try{var t=qde(Object,"defineProperty");return t({},"",{}),t}catch{}}(),VF=Yde,Xde=zde,nO=VF,Qde=vu,Jde=nO?function(t,e){return nO(t,"toString",{configurable:!0,enumerable:!1,value:Xde(e),writable:!0})}:Qde,Zde=Jde,efe=800,tfe=16,rfe=Date.now;function nfe(t){var e=0,r=0;return function(){var n=rfe(),i=tfe-(n-r);if(r=n,i>0){if(++e>=efe)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}var ife=nfe,sfe=Zde,afe=ife,ofe=afe(sfe),lfe=ofe,cfe=vu,ufe=Hde,dfe=lfe;function ffe(t,e){return dfe(ufe(t,e,cfe),t+"")}var hfe=ffe,pfe=QT,mfe=ey,gfe=p_,vfe=ka;function yfe(t,e,r){if(!vfe(r))return!1;var n=typeof e;return(n=="number"?mfe(r)&&gfe(e,r.length):n=="string"&&e in r)?pfe(r[e],t):!1}var ry=yfe,bfe=UF,xfe=Bde,wfe=hfe,iO=ry,Sfe=wfe(function(t,e){if(t==null)return[];var r=e.length;return r>1&&iO(t,e[0],e[1])?e=[]:r>2&&iO(e[0],e[1],e[2])&&(e=[e[0]]),xfe(t,bfe(e,1),[])}),Efe=Sfe;const b_=at(Efe);function cf(t){"@babel/helpers - typeof";return cf=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},cf(t)}function Kw(){return Kw=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];
vendor: 28,889 bytes, lines 300-307
300for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},Kw.apply(this,arguments)}function Tfe(t,e){return Ife(t)||Pfe(t,e)||Afe(t,e)||_fe()}function _fe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
301In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Afe(t,e){if(t){if(typeof t=="string")return sO(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return sO(t,e)}}function sO(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function Pfe(t,e){var r=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r!=null){var n,i,s,a,o=[],l=!0,c=!1;try{if(s=(r=r.call(t)).next,e!==0)for(;!(l=(n=s.call(r)).done)&&(o.push(n.value),o.length!==e);l=!0);}catch(u){c=!0,i=u}finally{try{if(!l&&r.return!=null&&(a=r.return(),Object(a)!==a))return}finally{if(c)throw i}}return o}}function Ife(t){if(Array.isArray(t))return t}function aO(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function eb(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?aO(Object(r),!0).forEach(function(n){Cfe(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):aO(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function Cfe(t,e,r){return e=Ofe(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Ofe(t){var e=Rfe(t,"string");return cf(e)=="symbol"?e:e+""}function Rfe(t,e){if(cf(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(cf(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function kfe(t){return Array.isArray(t)&&Xt(t[0])&&Xt(t[1])?t.join(" ~ "):t}var Lfe=function(e){var r=e.separator,n=r===void 0?" : ":r,i=e.contentStyle,s=i===void 0?{}:i,a=e.itemStyle,o=a===void 0?{}:a,l=e.labelStyle,c=l===void 0?{}:l,u=e.payload,d=e.formatter,f=e.itemSorter,h=e.wrapperClassName,p=e.labelClassName,g=e.label,m=e.labelFormatter,v=e.accessibilityLayer,y=v===void 0?!1:v,b=function(){if(u&&u.length){var R={padding:0,margin:0},D=(f?b_(u,f):u).map(function(L,j){if(L.type==="none")return null;var M=eb({display:"block",paddingTop:4,paddingBottom:4,color:L.color||"#000"},o),N=L.formatter||d||kfe,k=L.value,$=L.name,U=k,G=$;if(N&&U!=null&&G!=null){var B=N(k,$,L,j,u);if(Array.isArray(B)){var K=Tfe(B,2);U=K[0],G=K[1]}else U=B}return F.createElement("li",{className:"recharts-tooltip-item",key:"tooltip-item-".concat(j),style:M},Xt(G)?F.createElement("span",{className:"recharts-tooltip-item-name"},G):null,Xt(G)?F.createElement("span",{className:"recharts-tooltip-item-separator"},n):null,F.createElement("span",{className:"recharts-tooltip-item-value"},U),F.createElement("span",{className:"recharts-tooltip-item-unit"},L.unit||""))});return F.createElement("ul",{className:"recharts-tooltip-item-list",style:R},D)}return null},w=eb({margin:0,padding:10,backgroundColor:"#fff",border:"1px solid #ccc",whiteSpace:"nowrap"},s),S=eb({margin:0},c),T=!Fe(g),_=T?g:"",A=Me("recharts-default-tooltip",h),P=Me("recharts-tooltip-label",p);T&&m&&u!==void 0&&u!==null&&(_=m(g,u));var C=y?{role:"status","aria-live":"assertive"}:{};return F.createElement("div",Kw({className:A,style:w},C),F.createElement("p",{className:P,style:S},F.isValidElement(_)?_:"".concat(_)),b())};function uf(t){"@babel/helpers - typeof";return uf=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},uf(t)}function up(t,e,r){return e=Dfe(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Dfe(t){var e=Nfe(t,"string");return uf(e)=="symbol"?e:e+""}function Nfe(t,e){if(uf(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(uf(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Mu="recharts-tooltip-wrapper",Mfe={visibility:"hidden"};function $fe(t){var e=t.coordinate,r=t.translateX,n=t.translateY;return Me(Mu,up(up(up(up({},"".concat(Mu,"-right"),ae(r)&&e&&ae(e.x)&&r>=e.x),"".concat(Mu,"-left"),ae(r)&&e&&ae(e.x)&&r<e.x),"".concat(Mu,"-bottom"),ae(n)&&e&&ae(e.y)&&n>=e.y),"".concat(Mu,"-top"),ae(n)&&e&&ae(e.y)&&n<e.y))}function oO(t){var e=t.allowEscapeViewBox,r=t.coordinate,n=t.key,i=t.offsetTopLeft,s=t.position,a=t.reverseDirection,o=t.tooltipDimension,l=t.viewBox,c=t.viewBoxDimension;if(s&&ae(s[n]))return s[n];var u=r[n]-o-i,d=r[n]+i;if(e[n])return a[n]?u:d;if(a[n]){var f=u,h=l[n];return f<h?Math.max(d,l[n]):Math.max(u,l[n])}var p=d+o,g=l[n]+c;return p>g?Math.max(u,l[n]):Math.max(d,l[n])}function jfe(t){var e=t.translateX,r=t.translateY,n=t.useTranslate3d;return{transform:n?"translate3d(".concat(e,"px, ").concat(r,"px, 0)"):"translate(".concat(e,"px, ").concat(r,"px)")}}function Ffe(t){var e=t.allowEscapeViewBox,r=t.coordinate,n=t.offsetTopLeft,i=t.position,s=t.reverseDirection,a=t.tooltipBox,o=t.useTranslate3d,l=t.viewBox,c,u,d;return a.height>0&&a.width>0&&r?(u=oO({allowEscapeViewBox:e,coordinate:r,key:"x",offsetTopLeft:n,position:i,reverseDirection:s,tooltipDimension:a.width,viewBox:l,viewBoxDimension:l.width}),d=oO({allowEscapeViewBox:e,coordinate:r,key:"y",offsetTopLeft:n,position:i,reverseDirection:s,tooltipDimension:a.height,viewBox:l,viewBoxDimension:l.height}),c=jfe({translateX:u,translateY:d,useTranslate3d:o})):c=Mfe,{cssProperties:c,cssClasses:$fe({translateX:u,translateY:d,coordinate:r})}}function Cc(t){"@babel/helpers - typeof";return Cc=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Cc(t)}function lO(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function cO(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?lO(Object(r),!0).forEach(function(n){qw(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):lO(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function Bfe(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Ufe(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,KF(n.key),n)}}function Gfe(t,e,r){return e&&Ufe(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function Wfe(t,e,r){return e=ig(e),Vfe(t,HF()?Reflect.construct(e,r||[],ig(t).constructor):e.apply(t,r))}function Vfe(t,e){if(e&&(Cc(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Hfe(t)}function Hfe(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function HF(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(HF=function(){return!!t})()}function ig(t){return ig=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},ig(t)}function Kfe(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&zw(t,e)}function zw(t,e){return zw=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},zw(t,e)}function qw(t,e,r){return e=KF(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function KF(t){var e=zfe(t,"string");return Cc(e)=="symbol"?e:e+""}function zfe(t,e){if(Cc(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(Cc(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}var uO=1,qfe=function(t){function e(){var r;Bfe(this,e);for(var n=arguments.length,i=new Array(n),s=0;s<n;s++)i[s]=arguments[s];return r=Wfe(this,e,[].concat(i)),qw(r,"state",{dismissed:!1,dismissedAtCoordinate:{x:0,y:0},lastBoundingBox:{width:-1,height:-1}}),qw(r,"handleKeyDown",function(a){if(a.key==="Escape"){var o,l,c,u;r.setState({dismissed:!0,dismissedAtCoordinate:{x:(o=(l=r.props.coordinate)===null||l===void 0?void 0:l.x)!==null&&o!==void 0?o:0,y:(c=(u=r.props.coordinate)===null||u===void 0?void 0:u.y)!==null&&c!==void 0?c:0}})}}),r}return Kfe(e,t),Gfe(e,[{key:"updateBBox",value:function(){if(this.wrapperNode&&this.wrapperNode.getBoundingClientRect){var n=this.wrapperNode.getBoundingClientRect();(Math.abs(n.width-this.state.lastBoundingBox.width)>uO||Math.abs(n.height-this.state.lastBoundingBox.height)>uO)&&this.setState({lastBoundingBox:{width:n.width,height:n.height}})}else(this.state.lastBoundingBox.width!==-1||this.state.lastBoundingBox.height!==-1)&&this.setState({lastBoundingBox:{width:-1,height:-1}})}},{key:"componentDidMount",value:function(){document.addEventListener("keydown",this.handleKeyDown),this.updateBBox()}},{key:"componentWillUnmount",value:function(){document.removeEventListener("keydown",this.handleKeyDown)}},{key:"componentDidUpdate",value:function(){var n,i;this.props.active&&this.updateBBox(),this.state.dismissed&&(((n=this.props.coordinate)===null||n===void 0?void 0:n.x)!==this.state.dismissedAtCoordinate.x||((i=this.props.coordinate)===null||i===void 0?void 0:i.y)!==this.state.dismissedAtCoordinate.y)&&(this.state.dismissed=!1)}},{key:"render",value:function(){var n=this,i=this.props,s=i.active,a=i.allowEscapeViewBox,o=i.animationDuration,l=i.animationEasing,c=i.children,u=i.coordinate,d=i.hasPayload,f=i.isAnimationActive,h=i.offset,p=i.position,g=i.reverseDirection,m=i.useTranslate3d,v=i.viewBox,y=i.wrapperStyle,b=Ffe({allowEscapeViewBox:a,coordinate:u,offsetTopLeft:h,position:p,reverseDirection:g,tooltipBox:this.state.lastBoundingBox,useTranslate3d:m,viewBox:v}),w=b.cssClasses,S=b.cssProperties,T=cO(cO({transition:f&&s?"transform ".concat(o,"ms ").concat(l):void 0},S),{},{pointerEvents:"none",visibility:!this.state.dismissed&&s&&d?"visible":"hidden",position:"absolute",top:0,left:0},y);return F.createElement("div",{tabIndex:-1,className:w,style:T,ref:function(A){n.wrapperNode=A}},c)}}])}(E.PureComponent),Yfe=function(){return!(typeof window<"u"&&window.document&&window.document.createElement&&window.setTimeout)},ah={isSsr:Yfe()};function Oc(t){"@babel/helpers - typeof";return Oc=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Oc(t)}function dO(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function fO(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?dO(Object(r),!0).forEach(function(n){x_(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):dO(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function Xfe(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Qfe(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,qF(n.key),n)}}function Jfe(t,e,r){return e&&Qfe(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function Zfe(t,e,r){return e=sg(e),ehe(t,zF()?Reflect.construct(e,r||[],sg(t).constructor):e.apply(t,r))}function ehe(t,e){if(e&&(Oc(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return the(t)}function the(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function zF(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(zF=function(){return!!t})()}function sg(t){return sg=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},sg(t)}function rhe(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Yw(t,e)}function Yw(t,e){return Yw=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},Yw(t,e)}function x_(t,e,r){return e=qF(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function qF(t){var e=nhe(t,"string");return Oc(e)=="symbol"?e:e+""}function nhe(t,e){if(Oc(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(Oc(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}function ihe(t){return t.dataKey}function she(t,e){return F.isValidElement(t)?F.cloneElement(t,e):typeof t=="function"?F.createElement(t,e):F.createElement(Lfe,e)}var nn=function(t){function e(){return Xfe(this,e),Zfe(this,e,arguments)}return rhe(e,t),Jfe(e,[{key:"render",value:function(){var n=this,i=this.props,s=i.active,a=i.allowEscapeViewBox,o=i.animationDuration,l=i.animationEasing,c=i.content,u=i.coordinate,d=i.filterNull,f=i.isAnimationActive,h=i.offset,p=i.payload,g=i.payloadUniqBy,m=i.position,v=i.reverseDirection,y=i.useTranslate3d,b=i.viewBox,w=i.wrapperStyle,S=p??[];d&&S.length&&(S=$F(p.filter(function(_){return _.value!=null&&(_.hide!==!0||n.props.includeHidden)}),g,ihe));var T=S.length>0;return F.createElement(qfe,{allowEscapeViewBox:a,animationDuration:o,animationEasing:l,isAnimationActive:f,active:s,coordinate:u,hasPayload:T,offset:h,position:m,reverseDirection:v,useTranslate3d:y,viewBox:b,wrapperStyle:w},she(c,fO(fO({},this.props),{},{payload:S})))}}])}(E.PureComponent);x_(nn,"displayName","Tooltip");x_(nn,"defaultProps",{accessibilityLayer:!1,allowEscapeViewBox:{x:!1,y:!1},animationDuration:400,animationEasing:"ease",contentStyle:{},coordinate:{x:0,y:0},cursor:!0,cursorStyle:{},filterNull:!0,isAnimationActive:!ah.isSsr,itemStyle:{},labelStyle:{},offset:10,reverseDirection:{x:!1,y:!1},separator:" : ",trigger:"hover",useTranslate3d:!1,viewBox:{x:0,y:0,height:0,width:0},wrapperStyle:{}});var ahe=Vi,ohe=function(){return ahe.Date.now()},lhe=ohe,che=/\s/;function uhe(t){for(var e=t.length;e--&&che.test(t.charAt(e)););return e}var dhe=uhe,fhe=dhe,hhe=/^\s+/;function phe(t){return t&&t.slice(0,fhe(t)+1).replace(hhe,"")}var mhe=phe,ghe=mhe,hO=ka,vhe=uu,pO=NaN,yhe=/^[-+]0x[0-9a-f]+$/i,bhe=/^0b[01]+$/i,xhe=/^0o[0-7]+$/i,whe=parseInt;function She(t){if(typeof t=="number")return t;if(vhe(t))return pO;if(hO(t)){var e=typeof t.valueOf=="function"?t.valueOf():t;t=hO(e)?e+"":e}if(typeof t!="string")return t===0?t:+t;t=ghe(t);var r=bhe.test(t);return r||xhe.test(t)?whe(t.slice(2),r?2:8):yhe.test(t)?pO:+t}var YF=She,Ehe=ka,tb=lhe,mO=YF,The="Expected a function",_he=Math.max,Ahe=Math.min;function Phe(t,e,r){var n,i,s,a,o,l,c=0,u=!1,d=!1,f=!0;if(typeof t!="function")throw new TypeError(The);e=mO(e)||0,Ehe(r)&&(u=!!r.leading,d="maxWait"in r,s=d?_he(mO(r.maxWait)||0,e):s,f="trailing"in r?!!r.trailing:f);function h(T){var _=n,A=i;return n=i=void 0,c=T,a=t.apply(A,_),a}function p(T){return c=T,o=setTimeout(v,e),u?h(T):a}function g(T){var _=T-l,A=T-c,P=e-_;return d?Ahe(P,s-A):P}function m(T){var _=T-l,A=T-c;return l===void 0||_>=e||_<0||d&&A>=s}function v(){var T=tb();if(m(T))return y(T);o=setTimeout(v,g(T))}function y(T){return o=void 0,f&&n?h(T):(n=i=void 0,a)}function b(){o!==void 0&&clearTimeout(o),c=0,n=l=i=o=void 0}function w(){return o===void 0?a:y(tb())}function S(){var T=tb(),_=m(T);if(n=arguments,i=this,l=T,_){if(o===void 0)return p(l);if(d)return clearTimeout(o),o=setTimeout(v,e),h(l)}return o===void 0&&(o=setTimeout(v,e)),a}return S.cancel=b,S.flush=w,S}var Ihe=Phe,Che=Ihe,Ohe=ka,Rhe="Expected a function";function khe(t,e,r){var n=!0,i=!0;if(typeof t!="function")throw new TypeError(Rhe);return Ohe(r)&&(n="leading"in r?!!r.leading:n,i="trailing"in r?!!r.trailing:i),Che(t,e,{leading:n,maxWait:e,trailing:i})}var Lhe=khe;const XF=at(Lhe);function df(t){"@babel/helpers - typeof";return df=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},df(t)}function gO(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function dp(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?gO(Object(r),!0).forEach(function(n){Dhe(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):gO(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function Dhe(t,e,r){return e=Nhe(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Nhe(t){var e=Mhe(t,"string");return df(e)=="symbol"?e:e+""}function Mhe(t,e){if(df(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(df(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function $he(t,e){return Uhe(t)||Bhe(t,e)||Fhe(t,e)||jhe()}function jhe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
302In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Fhe(t,e){if(t){if(typeof t=="string")return vO(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return vO(t,e)}}function vO(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function Bhe(t,e){var r=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r!=null){var n,i,s,a,o=[],l=!0,c=!1;try{if(s=(r=r.call(t)).next,e!==0)for(;!(l=(n=s.call(r)).done)&&(o.push(n.value),o.length!==e);l=!0);}catch(u){c=!0,i=u}finally{try{if(!l&&r.return!=null&&(a=r.return(),Object(a)!==a))return}finally{if(c)throw i}}return o}}function Uhe(t){if(Array.isArray(t))return t}var Yp=E.forwardRef(function(t,e){var r=t.aspect,n=t.initialDimension,i=n===void 0?{width:-1,height:-1}:n,s=t.width,a=s===void 0?"100%":s,o=t.height,l=o===void 0?"100%":o,c=t.minWidth,u=c===void 0?0:c,d=t.minHeight,f=t.maxHeight,h=t.children,p=t.debounce,g=p===void 0?0:p,m=t.id,v=t.className,y=t.onResize,b=t.style,w=b===void 0?{}:b,S=E.useRef(null),T=E.useRef();T.current=y,E.useImperativeHandle(e,function(){return Object.defineProperty(S.current,"current",{get:function(){return console.warn("The usage of ref.current.current is deprecated and will no longer be supported."),S.current},configurable:!0})});var _=E.useState({containerWidth:i.width,containerHeight:i.height}),A=$he(_,2),P=A[0],C=A[1],O=E.useCallback(function(D,L){C(function(j){var M=Math.round(D),N=Math.round(L);return j.containerWidth===M&&j.containerHeight===N?j:{containerWidth:M,containerHeight:N}})},[]);E.useEffect(function(){var D=function($){var U,G=$[0].contentRect,B=G.width,K=G.height;O(B,K),(U=T.current)===null||U===void 0||U.call(T,B,K)};g>0&&(D=XF(D,g,{trailing:!0,leading:!1}));var L=new ResizeObserver(D),j=S.current.getBoundingClientRect(),M=j.width,N=j.height;return O(M,N),L.observe(S.current),function(){L.disconnect()}},[O,g]);var R=E.useMemo(function(){var D=P.containerWidth,L=P.containerHeight;if(D<0||L<0)return null;_o(co(a)||co(l),`The width(%s) and height(%s) are both fixed numbers,
303       maybe you don't need to use a ResponsiveContainer.`,a,l),_o(!r||r>0,"The aspect(%s) must be greater than zero.",r);var j=co(a)?D:a,M=co(l)?L:l;r&&r>0&&(j?M=j/r:M&&(j=M*r),f&&M>f&&(M=f)),_o(j>0||M>0,`The width(%s) and height(%s) of chart should be greater than 0,
304       please check the style of container, or the props width(%s) and height(%s),
305       or add a minWidth(%s) or minHeight(%s) or use aspect(%s) to control the
306       height and width.`,j,M,a,l,u,d,r);var N=!Array.isArray(h)&&hs(h.type).endsWith("Chart");return F.Children.map(h,function(k){return F.isValidElement(k)?E.cloneElement(k,dp({width:j,height:M},N?{style:dp({height:"100%",width:"100%",maxHeight:M,maxWidth:j},k.props.style)}:{})):k})},[r,h,l,f,d,u,P,a]);return F.createElement("div",{id:m?"".concat(m):void 0,className:Me("recharts-responsive-container",v),style:dp(dp({},w),{},{width:a,height:l,minWidth:u,minHeight:d,maxHeight:f}),ref:S},R)}),ff=function(e){return null};ff.displayName="Cell";function hf(t){"@babel/helpers - typeof";return hf=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},hf(t)}function yO(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function Xw(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?yO(Object(r),!0).forEach(function(n){Ghe(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):yO(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function Ghe(t,e,r){return e=Whe(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Whe(t){var e=Vhe(t,"string");return hf(e)=="symbol"?e:e+""}function Vhe(t,e){if(hf(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(hf(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var pl={widthCache:{},cacheCount:0},Hhe=2e3,Khe={position:"absolute",top:"-20000px",left:0,padding:0,margin:0,border:"none",whiteSpace:"pre"},bO="recharts_measurement_span";function zhe(t){var e=Xw({},t);return Object.keys(e).forEach(function(r){e[r]||delete e[r]}),e}var yd=function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(e==null||ah.isSsr)return{width:0,height:0};var n=zhe(r),i=JSON.stringify({text:e,copyStyle:n});if(pl.widthCache[i])return pl.widthCache[i];try{var s=document.getElementById(bO);s||(s=document.createElement("span"),s.setAttribute("id",bO),s.setAttribute("aria-hidden","true"),document.body.appendChild(s));var a=Xw(Xw({},Khe),n);Object.assign(s.style,a),s.textContent="".concat(e);var o=s.getBoundingClientRect(),l={width:o.width,height:o.height};return pl.widthCache[i]=l,++pl.cacheCount>Hhe&&(pl.cacheCount=0,pl.widthCache={}),l}catch{return{width:0,height:0}}},qhe=function(e){return{top:e.top+window.scrollY-document.documentElement.clientTop,left:e.left+window.scrollX-document.documentElement.clientLeft}};function pf(t){"@babel/helpers - typeof";return pf=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},pf(t)}function ag(t,e){return Jhe(t)||Qhe(t,e)||Xhe(t,e)||Yhe()}function Yhe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
307In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Xhe(t,e){if(t){if(typeof t=="string")return xO(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return xO(t,e)}}function xO(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function Qhe(t,e){var r=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r!=null){var n,i,s,a,o=[],l=!0,c=!1;try{if(s=(r=r.call(t)).next,e===0){if(Object(r)!==r)return;l=!1}else for(;!(l=(n=s.call(r)).done)&&(o.push(n.value),o.length!==e);l=!0);}catch(u){c=!0,i=u}finally{try{if(!l&&r.return!=null&&(a=r.return(),Object(a)!==a))return}finally{if(c)throw i}}return o}}function Jhe(t){if(Array.isArray(t))return t}function Zhe(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function wO(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,tpe(n.key),n)}}function epe(t,e,r){return e&&wO(t.prototype,e),r&&wO(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function tpe(t){var e=rpe(t,"string");return pf(e)=="symbol"?e:e+""}function rpe(t,e){if(pf(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(pf(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}var SO=/(-?\d+(?:\.\d+)?[a-zA-Z%]*)([*/])(-?\d+(?:\.\d+)?[a-zA-Z%]*)/,EO=/(-?\d+(?:\.\d+)?[a-zA-Z%]*)([+-])(-?\d+(?:\.\d+)?[a-zA-Z%]*)/,npe=/^px|cm|vh|vw|em|rem|%|mm|in|pt|pc|ex|ch|vmin|vmax|Q$/,ipe=/(-?\d+(?:\.\d+)?)([a-zA-Z%]+)?/,QF={cm:96/2.54,mm:96/25.4,pt:96/72,pc:96/6,in:96,Q:96/(2.54*40),px:1},spe=Object.keys(QF),Fl="NaN";function ape(t,e){return t*QF[e]}var fp=function(){function t(e,r){Zhe(this,t),this.num=e,this.unit=r,this.num=e,this.unit=r,Number.isNaN(e)&&(this.unit=""),r!==""&&!npe.test(r)&&(this.num=NaN,this.unit=""),spe.includes(r)&&(this.num=ape(e,r),this.unit="px")}return epe(t,[{key:"add",value:function(r){return this.unit!==r.unit?new t(NaN,""):new t(this.num+r.num,this.unit)}},{key:"subtract",value:function(r){return this.unit!==r.unit?new t(NaN,""):new t(this.num-r.num,this.unit)}},{key:"multiply",value:function(r){return this.unit!==""&&r.unit!==""&&this.unit!==r.unit?new t(NaN,""):new t(this.num*r.num,this.unit||r.unit)}},{key:"divide",value:function(r){return this.unit!==""&&r.unit!==""&&this.unit!==r.unit?new t(NaN,""):new t(this.num/r.num,this.unit||r.unit)}},{key:"toString",value:function(){return"".concat(this.num).concat(this.unit)}},{key:"isNaN",value:function(){return Number.isNaN(this.num)}}],[{key:"parse",value:function(r){var n,i=(n=ipe.exec(r))!==null&&n!==void 0?n:[],s=ag(i,3),a=s[1],o=s[2];return new t(parseFloat(a),o??"")}}])}();function JF(t){if(t.includes(Fl))return Fl;for(var e=t;e.includes("*")||e.includes("/");){var r,n=(r=SO.exec(e))!==null&&r!==void 0?r:[],i=ag(n,4),s=i[1],a=i[2],o=i[3],l=fp.parse(s??""),c=fp.parse(o??""),u=a==="*"?l.multiply(c):l.divide(c);if(u.isNaN())return Fl;e=e.replace(SO,u.toString())}for(;e.includes("+")||/.-\d+(?:\.\d+)?/.test(e);){var d,f=(d=EO.exec(e))!==null&&d!==void 0?d:[],h=ag(f,4),p=h[1],g=h[2],m=h[3],v=fp.parse(p??""),y=fp.parse(m??""),b=g==="+"?v.add(y):v.subtract(y);if(b.isNaN())return Fl;e=e.replace(EO,b.toString())}return e}var TO=/\(([^()]*)\)/;function ope(t){for(var e=t;e.includes("(");){var r=TO.exec(e),n=ag(r,2),i=n[1];e=e.replace(TO,JF(i))}return e}function lpe(t){var e=t.replace(/\s+/g,"");return e=ope(e),e=JF(e),e}function cpe(t){try{return lpe(t)}catch{return Fl}}function rb(t){var e=cpe(t.slice(5,-1));return e===Fl?"":e}var upe=["x","y","lineHeight","capHeight","scaleToFit","textAnchor","verticalAnchor","fill"],dpe=["dx","dy","angle","className","breakAll"];function Qw(){return Qw=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];
307for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},Qw.apply(this,arguments)}function _O(t,e){if(t==null)return{};var r=fpe(t,e),n,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(i=0;i<s.length;i++)n=s[i],!(e.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function fpe(t,e){if(t==null)return{};var r={};for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(e.indexOf(n)>=0)continue;r[n]=t[n]}return r}function AO(t,e){return gpe(t)||mpe(t,e)||ppe(t,e)||hpe()}function hpe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
308In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ppe(t,e){if(t){if(typeof t=="string")return PO(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return PO(t,e)}}function PO(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function mpe(t,e){var r=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r!=null){var n,i,s,a,o=[],l=!0,c=!1;try{if(s=(r=r.call(t)).next,e===0){if(Object(r)!==r)return;l=!1}else for(;!(l=(n=s.call(r)).done)&&(o.push(n.value),o.length!==e);l=!0);}catch(u){c=!0,i=u}finally{try{if(!l&&r.return!=null&&(a=r.return(),Object(a)!==a))return}finally{if(c)throw i}}return o}}function gpe(t){if(Array.isArray(t))return t}var ZF=/[ \f\n\r\t\v\u2028\u2029]+/,eB=function(e){var r=e.children,n=e.breakAll,i=e.style;try{var s=[];Fe(r)||(n?s=r.toString().split(""):s=r.toString().split(ZF));var a=s.map(function(l){return{word:l,width:yd(l,i).width}}),o=n?0:yd(" ",i).width;return{wordsWithComputedWidth:a,spaceWidth:o}}catch{return null}},vpe=function(e,r,n,i,s){var a=e.maxLines,o=e.children,l=e.style,c=e.breakAll,u=ae(a),d=o,f=function(){var j=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];return j.reduce(function(M,N){var k=N.word,$=N.width,U=M[M.length-1];if(U&&(i==null||s||U.width+$+n<Number(i)))U.words.push(k),U.width+=$+n;else{var G={words:[k],width:$};M.push(G)}return M},[])},h=f(r),p=function(j){return j.reduce(function(M,N){return M.width>N.width?M:N})};if(!u)return h;for(var g="…",m=function(j){var M=d.slice(0,j),N=eB({breakAll:c,style:l,children:M+g}).wordsWithComputedWidth,k=f(N),$=k.length>a||p(k).width>Number(i);return[$,k]},v=0,y=d.length-1,b=0,w;v<=y&&b<=d.length-1;){var S=Math.floor((v+y)/2),T=S-1,_=m(T),A=AO(_,2),P=A[0],C=A[1],O=m(S),R=AO(O,1),D=R[0];if(!P&&!D&&(v=S+1),P&&D&&(y=S-1),!P&&D){w=C;break}b++}return w||h},IO=function(e){var r=Fe(e)?[]:e.toString().split(ZF);return[{words:r}]},ype=function(e){var r=e.width,n=e.scaleToFit,i=e.children,s=e.style,a=e.breakAll,o=e.maxLines;if((r||n)&&!ah.isSsr){var l,c,u=eB({breakAll:a,children:i,style:s});if(u){var d=u.wordsWithComputedWidth,f=u.spaceWidth;l=d,c=f}else return IO(i);return vpe({breakAll:a,children:i,maxLines:o,style:s},l,c,r,n)}return IO(i)},CO="#808080",og=function(e){var r=e.x,n=r===void 0?0:r,i=e.y,s=i===void 0?0:i,a=e.lineHeight,o=a===void 0?"1em":a,l=e.capHeight,c=l===void 0?"0.71em":l,u=e.scaleToFit,d=u===void 0?!1:u,f=e.textAnchor,h=f===void 0?"start":f,p=e.verticalAnchor,g=p===void 0?"end":p,m=e.fill,v=m===void 0?CO:m,y=_O(e,upe),b=E.useMemo(function(){return ype({breakAll:y.breakAll,children:y.children,maxLines:y.maxLines,scaleToFit:d,style:y.style,width:y.width})},[y.breakAll,y.children,y.maxLines,d,y.style,y.width]),w=y.dx,S=y.dy,T=y.angle,_=y.className,A=y.breakAll,P=_O(y,dpe);if(!Xt(n)||!Xt(s))return null;var C=n+(ae(w)?w:0),O=s+(ae(S)?S:0),R;switch(g){case"start":R=rb("calc(".concat(c,")"));break;case"middle":R=rb("calc(".concat((b.length-1)/2," * -").concat(o," + (").concat(c," / 2))"));break;default:R=rb("calc(".concat(b.length-1," * -").concat(o,")"));break}var D=[];if(d){var L=b[0].width,j=y.width;D.push("scale(".concat((ae(j)?j/L:1)/L,")"))}return T&&D.push("rotate(".concat(T,", ").concat(C,", ").concat(O,")")),D.length&&(P.transform=D.join(" ")),F.createElement("text",Qw({},Ue(P,!0),{x:C,y:O,className:Me("recharts-text",_),textAnchor:h,fill:v.includes("url")?CO:v}),b.map(function(M,N){var k=M.words.join(A?"":" ");return F.createElement("tspan",{x:C,dy:N===0?R:o,key:"".concat(k,"-").concat(N)},k)}))};function ba(t,e){return t==null||e==null?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function bpe(t,e){return t==null||e==null?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function w_(t){let e,r,n;t.length!==2?(e=ba,r=(o,l)=>ba(t(o),l),n=(o,l)=>t(o)-l):(e=t===ba||t===bpe?t:xpe,r=t,n=t);function i(o,l,c=0,u=o.length){if(c<u){if(e(l,l)!==0)return u;do{const d=c+u>>>1;r(o[d],l)<0?c=d+1:u=d}while(c<u)}return c}function s(o,l,c=0,u=o.length){if(c<u){if(e(l,l)!==0)return u;do{const d=c+u>>>1;r(o[d],l)<=0?c=d+1:u=d}while(c<u)}return c}function a(o,l,c=0,u=o.length){const d=i(o,l,c,u-1);return d>c&&n(o[d-1],l)>-n(o[d],l)?d-1:d}return{left:i,center:a,right:s}}function xpe(){return 0}function tB(t){return t===null?NaN:+t}function*wpe(t,e){for(let r of t)r!=null&&(r=+r)>=r&&(yield r)}const Spe=w_(ba),oh=Spe.right;w_(tB).center;class OO extends Map{constructor(e,r=_pe){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:r}}),e!=null)for(const[n,i]of e)this.set(n,i)}get(e){return super.get(RO(this,e))}has(e){return super.has(RO(this,e))}set(e,r){return super.set(Epe(this,e),r)}delete(e){return super.delete(Tpe(this,e))}}function RO({_intern:t,_key:e},r){const n=e(r);return t.has(n)?t.get(n):r}function Epe({_intern:t,_key:e},r){const n=e(r);return t.has(n)?t.get(n):(t.set(n,r),r)}function Tpe({_intern:t,_key:e},r){const n=e(r);return t.has(n)&&(r=t.get(n),t.delete(n)),r}function _pe(t){return t!==null&&typeof t=="object"?t.valueOf():t}function Ape(t=ba){if(t===ba)return rB;if(typeof t!="function")throw new TypeError("compare is not a function");return(e,r)=>{const n=t(e,r);return n||n===0?n:(t(r,r)===0)-(t(e,e)===0)}}function rB(t,e){return(t==null||!(t>=t))-(e==null||!(e>=e))||(t<e?-1:t>e?1:0)}const Ppe=Math.sqrt(50),Ipe=Math.sqrt(10),Cpe=Math.sqrt(2);function lg(t,e,r){const n=(e-t)/Math.max(0,r),i=Math.floor(Math.log10(n)),s=n/Math.pow(10,i),a=s>=Ppe?10:s>=Ipe?5:s>=Cpe?2:1;let o,l,c;return i<0?(c=Math.pow(10,-i)/a,o=Math.round(t*c),l=Math.round(e*c),o/c<t&&++o,l/c>e&&--l,c=-c):(c=Math.pow(10,i)*a,o=Math.round(t/c),l=Math.round(e/c),o*c<t&&++o,l*c>
308e&&--l),l<o&&.5<=r&&r<2?lg(t,e,r*2):[o,l,c]}function Jw(t,e,r){if(e=+e,t=+t,r=+r,!(r>0))return[];if(t===e)return[t];const n=e<t,[i,s,a]=n?lg(e,t,r):lg(t,e,r);if(!(s>=i))return[];const o=s-i+1,l=new Array(o);if(n)if(a<0)for(let c=0;c<o;++c)l[c]=(s-c)/-a;else for(let c=0;c<o;++c)l[c]=(s-c)*a;else if(a<0)for(let c=0;c<o;++c)l[c]=(i+c)/-a;else for(let c=0;c<o;++c)l[c]=(i+c)*a;return l}function Zw(t,e,r){return e=+e,t=+t,r=+r,lg(t,e,r)[2]}function eS(t,e,r){e=+e,t=+t,r=+r;const n=e<t,i=n?Zw(e,t,r):Zw(t,e,r);return(n?-1:1)*(i<0?1/-i:i)}function kO(t,e){let r;for(const n of t)n!=null&&(r<n||r===void 0&&n>=n)&&(r=n);return r}function LO(t,e){let r;for(const n of t)n!=null&&(r>n||r===void 0&&n>=n)&&(r=n);return r}function nB(t,e,r=0,n=1/0,i){if(e=Math.floor(e),r=Math.floor(Math.max(0,r)),n=Math.floor(Math.min(t.length-1,n)),!(r<=e&&e<=n))return t;for(i=i===void 0?rB:Ape(i);n>r;){if(n-r>600){const l=n-r+1,c=e-r+1,u=Math.log(l),d=.5*Math.exp(2*u/3),f=.5*Math.sqrt(u*d*(l-d)/l)*(c-l/2<0?-1:1),h=Math.max(r,Math.floor(e-c*d/l+f)),p=Math.min(n,Math.floor(e+(l-c)*d/l+f));nB(t,e,h,p,i)}const s=t[e];let a=r,o=n;for($u(t,r,e),i(t[n],s)>0&&$u(t,r,n);a<o;){for($u(t,a,o),++a,--o;i(t[a],s)<0;)++a;for(;i(t[o],s)>0;)--o}i(t[r],s)===0?$u(t,r,o):(++o,$u(t,o,n)),o<=e&&(r=o+1),e<=o&&(n=o-1)}return t}function $u(t,e,r){const n=t[e];t[e]=t[r],t[r]=n}function Ope(t,e,r){if(t=Float64Array.from(wpe(t)),!(!(n=t.length)||isNaN(e=+e))){if(e<=0||n<2)return LO(t);if(e>=1)return kO(t);var n,i=(n-1)*e,s=Math.floor(i),a=kO(nB(t,s).subarray(0,s+1)),o=LO(t.subarray(s+1));return a+(o-a)*(i-s)}}function Rpe(t,e,r=tB){if(!(!(n=t.length)||isNaN(e=+e))){if(e<=0||n<2)return+r(t[0],0,t);if(e>=1)return+r(t[n-1],n-1,t);var n,i=(n-1)*e,s=Math.floor(i),a=+r(t[s],s,t),o=+r(t[s+1],s+1,t);return a+(o-a)*(i-s)}}function kpe(t,e,r){t=+t,e=+e,r=(i=arguments.length)<2?(e=t,t=0,1):i<3?1:+r;for(var n=-1,i=Math.max(0,Math.ceil((e-t)/r))|0,s=new Array(i);++n<i;)s[n]=t+n*r;return s}function Mn(t,e){switch(arguments.length){case 0:break;case 1:this.range(t);break;default:this.range(e).domain(t);break}return this}function ks(t,e){switch(arguments.length){case 0:break;case 1:{typeof t=="function"?this.interpolator(t):this.range(t);break}default:{this.domain(t),typeof e=="function"?this.interpolator(e):this.range(e);break}}return this}const tS=Symbol("implicit");function S_(){var t=new OO,e=[],r=[],n=tS;function i(s){let a=t.get(s);if(a===void 0){if(n!==tS)return n;t.set(s,a=e.push(s)-1)}return r[a%r.length]}return i.domain=function(s){if(!arguments.length)return e.slice();e=[],t=new OO;for(const a of s)t.has(a)||t.set(a,e.push(a)-1);return i},i.range=function(s){return arguments.length?(r=Array.from(s),i):r.slice()},i.unknown=function(s){return arguments.length?(n=s,i):n},i.copy=function(){return S_(e,r).unknown(n)},Mn.apply(i,arguments),i}function mf(){var t=S_().unknown(void 0),e=t.domain,r=t.range,n=0,i=1,s,a,o=!1,l=0,c=0,u=.5;delete t.unknown;function d(){var f=e().length,h=i<n,p=h?i:n,g=h?n:i;s=(g-p)/Math.max(1,f-l+c*2),o&&(s=Math.floor(s)),p+=(g-p-s*(f-l))*u,a=s*(1-l),o&&(p=Math.round(p),a=Math.round(a));var m=kpe(f).map(function(v){return p+s*v});return r(h?m.reverse():m)}return t.domain=function(f){return arguments.length?(e(f),d()):e()},t.range=function(f){return arguments.length?([n,i]=f,n=+n,i=+i,d()):[n,i]},t.rangeRound=function(f){return[n,i]=f,n=+n,i=+i,o=!0,d()},t.bandwidth=function(){return a},t.step=function(){return s},t.round=function(f){return arguments.length?(o=!!f,d()):o},t.padding=function(f){return arguments.length?(l=Math.min(1,c=+f),d()):l},t.paddingInner=function(f){return arguments.length?(l=Math.min(1,f),d()):l},t.paddingOuter=function(f){return arguments.length?(c=+f,d()):c},t.align=function(f){return arguments.length?(u=Math.max(0,Math.min(1,f)),d()):u},t.copy=function(){return mf(e(),[n,i]).round(o).paddingInner(l).paddingOuter(c).align(u)},Mn.apply(d(),arguments)}function iB(t){var e=t.copy;return t.padding=t.paddingOuter,delete t.paddingInner,delete t.paddingOuter,t.copy=function(){return iB(e())},t}function bd(){return iB(mf.apply(null,arguments).paddingInner(1))}function E_(t,e,r){t.prototype=e.prototype=r,r.constructor=t}function sB(t,e){var r=Object.create(t.prototype);for(var n in e)r[n]=e[n];return r}function lh(){}var gf=.7,cg=1/gf,nc="\\s*([+-]?\\d+)\\s*",vf="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Ni="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Lpe=/^#([0-9a-f]{3,8})$/,Dpe=new RegExp(`^rgb\\(${nc},${nc},${nc}\\)$`),Npe=new RegExp(`^rgb\\(${Ni},${Ni},${Ni}\\)$`),Mpe=new RegExp(`^rgba\\(${nc},${nc},${nc},${vf}\\)$`),$pe=new RegExp(`^rgba\\(${Ni},${Ni},${Ni},${vf}\\)$`),jpe=new RegExp(`^hsl\\(${vf},${Ni},${Ni}\\)$`),Fpe=new RegExp(`^hsla\\(${vf},${Ni},${Ni},${vf}\\)$`),DO={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};E_(lh,yf,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:NO,formatHex:NO,formatHex8:Bpe,formatHsl:Upe,formatRgb:MO,toString:MO});function NO(){return this.rgb().formatHex()}function Bpe(){return this.rgb().formatHex8()}function Upe(){return aB(this).formatHsl()}function MO(){return this.rgb().formatRgb()}function yf(t){var e,r;return t=(t+"").trim().toLowerCase(),(e=Lpe.exec(t))?(r=e[1].length,e=parseInt(e[1],16),r===6?$O(e):r===3?new Wr(e>>8&15|e>>4&240,e>>4&15|e&240,(e&15)<<4|e&15,1):r===8?hp(e>>24&255,e>>16&255,e>>8&255,(e&255)/255):r===4?hp(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|e&240,((e&15)<<4|e&15)/255):null):(e=Dpe.exec(t))?new Wr(e[1],e[2],e[3],1):(e=Npe.exec(t))?new Wr(e[1]*255/100,e[2]*255/100,e[3]*255/100,1):(e=Mpe.exec(t))?hp(e[1],e[2],e[3],e[4]):(e=$pe.exec(t))?hp(e[1]*255/100,e[2]*255/100,e[3]*255/100,e[4]):(e=jpe.exec(t))?BO(e[1],e[2]/100,e[3]/100,1):(e=Fpe.exec(t))?BO(e[1],e[2]/100,e[3]/100,e[4]):DO.hasOwnProperty(t)?$O(DO[t]):t==="transparent"?new Wr(NaN,NaN,NaN,0):null}function $O(t){return new Wr(t>>16&255,t>>8&255,t&255,1)}function hp(t,e,r,n){return n<=0&&(t=e=r=NaN),new Wr(t,e,r,n)}function Gpe(t){return t instanceof lh||(t=yf(t)),t?(t=t.rgb(),new Wr(t.r,t.g,t.b,t.opacity)):new Wr}function rS(t,e,r,n){return arguments.length===1?Gpe(t):new Wr(t,e,r,n??1)}function Wr(t,e,r,n){this.r=+t,this.g=+e,this.b=+r,this.opacity=+n}E_(Wr,rS,sB(lh,{brighter(t){return t=t==null?cg:Math.pow(cg,t),new Wr(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=t==null?gf:Math.pow(gf,t),new Wr(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new Wr(Ao(this.r),Ao(this.g),Ao(this.b),ug(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:jO,formatHex:jO,formatHex8:Wpe,formatRgb:FO,toString:FO}));function jO(){return`#${uo(this.r)}${uo(this.g)}${uo(this.b)}`}function Wpe(){return`#${uo(this.r)}${uo(this.g)}${uo(this.b)}${uo((isNaN(this.opacity)?1:this.opacity)*255)}`}function FO(){const t=ug(this.opacity);return`${t===1?"rgb(":"rgba("}${Ao(this.r)}, ${Ao(this.g)}, ${Ao(this.b)}${t===1?")":`, ${t})`}`}function ug(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function Ao(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function uo(t){return t=Ao(t),(t<16?"0":"")+t.toString(16)}function BO(t,e,r,n){return n<=0?t=e=r=NaN:r<=0||r>=1?t=e=NaN:e<=0&&(t=NaN),new ii(t,e,r,n)}function aB(t){if(t instanceof ii)return new ii(t.h,t.s,t.l,t.opacity);if(t instanceof lh||(t=yf(t)),!t)return new ii;if(t instanceof ii)return t;t=t.rgb();var e=t.r/255,r=t.g/255,n=t.b/255,i=Math.min(e,r,n),s=Math.max(e,r,n),a=NaN,o=s-i,l=(s+i)/2;return o?(e===s?a=(r-n)/o+(r<n)*6:r===s?a=(n-e)/o+2:a=(e-r)/o+4,o/=l<.5?s+i:2-s-i,a*=60):o=l>0&&l<1?0:a,new ii(a,o,l,t.opacity)}function Vpe(t,e,r,n){return arguments.length===1?aB(t):new ii(t,e,r,n??1)}function ii(t,e,r,n){this.h=+t,this.s=+e,this.l=+r,this.opacity=+n}E_(ii,Vpe,sB(lh,{brighter(t){return t=t==null?cg:Math.pow(cg,t),new ii(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=t==null?gf:Math.pow(gf,t),new ii(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+(this.h<0)*360,e=isNaN(t)||isNaN(this.s)?0:this.s,r=this.l,n=r+(r<.5?r:1-r)*e,i=2*r-n;return new Wr(nb(t>=240?t-240:t+120,i,n),nb(t,i,n),nb(t<120?t+240:t-120,i,n),this.opacity)},clamp(){return new ii(UO(this.h),pp(this.s),pp(this.l),ug(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const t=ug(this.opacity);return`${t===1?"hsl(":"hsla("}${UO(this.h)}, ${pp(this.s)*100}%, ${pp(this.l)*100}%${t===1?")":`, ${t})`}`}}));function UO(t){return t=(t||0)%360,t<0?t+360:t}
vendor: 11,480 bytes, line 308
308function pp(t){return Math.max(0,Math.min(1,t||0))}function nb(t,e,r){return(t<60?e+(r-e)*t/60:t<180?r:t<240?e+(r-e)*(240-t)/60:e)*255}const T_=t=>()=>t;function Hpe(t,e){return function(r){return t+r*e}}function Kpe(t,e,r){return t=Math.pow(t,r),e=Math.pow(e,r)-t,r=1/r,function(n){return Math.pow(t+n*e,r)}}function zpe(t){return(t=+t)==1?oB:function(e,r){return r-e?Kpe(e,r,t):T_(isNaN(e)?r:e)}}function oB(t,e){var r=e-t;return r?Hpe(t,r):T_(isNaN(t)?e:t)}const GO=function t(e){var r=zpe(e);function n(i,s){var a=r((i=rS(i)).r,(s=rS(s)).r),o=r(i.g,s.g),l=r(i.b,s.b),c=oB(i.opacity,s.opacity);return function(u){return i.r=a(u),i.g=o(u),i.b=l(u),i.opacity=c(u),i+""}}return n.gamma=t,n}(1);function qpe(t,e){e||(e=[]);var r=t?Math.min(e.length,t.length):0,n=e.slice(),i;return function(s){for(i=0;i<r;++i)n[i]=t[i]*(1-s)+e[i]*s;return n}}function Ype(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function Xpe(t,e){var r=e?e.length:0,n=t?Math.min(r,t.length):0,i=new Array(n),s=new Array(r),a;for(a=0;a<n;++a)i[a]=bu(t[a],e[a]);for(;a<r;++a)s[a]=e[a];return function(o){for(a=0;a<n;++a)s[a]=i[a](o);return s}}function Qpe(t,e){var r=new Date;return t=+t,e=+e,function(n){return r.setTime(t*(1-n)+e*n),r}}function dg(t,e){return t=+t,e=+e,function(r){return t*(1-r)+e*r}}function Jpe(t,e){var r={},n={},i;(t===null||typeof t!="object")&&(t={}),(e===null||typeof e!="object")&&(e={});for(i in e)i in t?r[i]=bu(t[i],e[i]):n[i]=e[i];return function(s){for(i in r)n[i]=r[i](s);return n}}var nS=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,ib=new RegExp(nS.source,"g");function Zpe(t){return function(){return t}}function eme(t){return function(e){return t(e)+""}}function tme(t,e){var r=nS.lastIndex=ib.lastIndex=0,n,i,s,a=-1,o=[],l=[];for(t=t+"",e=e+"";(n=nS.exec(t))&&(i=ib.exec(e));)(s=i.index)>r&&(s=e.slice(r,s),o[a]?o[a]+=s:o[++a]=s),(n=n[0])===(i=i[0])?o[a]?o[a]+=i:o[++a]=i:(o[++a]=null,l.push({i:a,x:dg(n,i)})),r=ib.lastIndex;return r<e.length&&(s=e.slice(r),o[a]?o[a]+=s:o[++a]=s),o.length<2?l[0]?eme(l[0].x):Zpe(e):(e=l.length,function(c){for(var u=0,d;u<e;++u)o[(d=l[u]).i]=d.x(c);return o.join("")})}function bu(t,e){var r=typeof e,n;return e==null||r==="boolean"?T_(e):(r==="number"?dg:r==="string"?(n=yf(e))?(e=n,GO):tme:e instanceof yf?GO:e instanceof Date?Qpe:Ype(e)?qpe:Array.isArray(e)?Xpe:typeof e.valueOf!="function"&&typeof e.toString!="function"||isNaN(e)?Jpe:dg)(t,e)}function __(t,e){return t=+t,e=+e,function(r){return Math.round(t*(1-r)+e*r)}}function rme(t,e){e===void 0&&(e=t,t=bu);for(var r=0,n=e.length-1,i=e[0],s=new Array(n<0?0:n);r<n;)s[r]=t(i,i=e[++r]);return function(a){var o=Math.max(0,Math.min(n-1,Math.floor(a*=n)));return s[o](a-o)}}function nme(t){return function(){return t}}function fg(t){return+t}var WO=[0,1];function Lr(t){return t}function iS(t,e){return(e-=t=+t)?function(r){return(r-t)/e}:nme(isNaN(e)?NaN:.5)}function ime(t,e){var r;return t>e&&(r=t,t=e,e=r),function(n){return Math.max(t,Math.min(e,n))}}function sme(t,e,r){var n=t[0],i=t[1],s=e[0],a=e[1];return i<n?(n=iS(i,n),s=r(a,s)):(n=iS(n,i),s=r(s,a)),function(o){return s(n(o))}}function ame(t,e,r){var n=Math.min(t.length,e.length)-1,i=new Array(n),s=new Array(n),a=-1;for(t[n]<t[0]&&(t=t.slice().reverse(),e=e.slice().reverse());++a<n;)i[a]=iS(t[a],t[a+1]),s[a]=r(e[a],e[a+1]);return function(o){var l=oh(t,o,1,n)-1;return s[l](i[l](o))}}function ch(t,e){return e.domain(t.domain()).range(t.range()).interpolate(t.interpolate()).clamp(t.clamp()).unknown(t.unknown())}function ny(){var t=WO,e=WO,r=bu,n,i,s,a=Lr,o,l,c;function u(){var f=Math.min(t.length,e.length);return a!==Lr&&(a=ime(t[0],t[f-1])),o=f>2?ame:sme,l=c=null,d}function d(f){return f==null||isNaN(f=+f)?s:(l||(l=o(t.map(n),e,r)))(n(a(f)))}return d.invert=function(f){return a(i((c||(c=o(e,t.map(n),dg)))(f)))},d.domain=function(f){return arguments.length?(t=Array.from(f,fg),u()):t.slice()},d.range=function(f){return arguments.length?(e=Array.from(f),u()):e.slice()},d.rangeRound=function(f){return e=Array.from(f),r=__,u()},d.clamp=function(f){return arguments.length?(a=f?!0:Lr,u()):a!==Lr},d.interpolate=function(f){return arguments.length?(r=f,u()):r},d.unknown=function(f){return arguments.length?(s=f,d):s},function(f,h){return n=f,i=h,u()}}function A_(){return ny()(Lr,Lr)}function ome(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)}function hg(t,e){if(!isFinite(t)||t===0)return null;var r=(t=e?t.toExponential(e-1):t.toExponential()).indexOf("e"),n=t.slice(0,r);return[n.length>1?n[0]+n.slice(2):n,+t.slice(r+1)]}function Rc(t){return t=hg(Math.abs(t)),t?t[1]:NaN}function lme(t,e){return function(r,n){for(var i=r.length,s=[],a=0,o=t[0],l=0;i>0&&o>0&&(l+o+1>n&&(o=Math.max(1,n-l)),s.push(r.substring(i-=o,i+o)),!((l+=o+1)>n));)o=t[a=(a+1)%t.length];return s.reverse().join(e)}}function cme(t){return function(e){return e.replace(/[0-9]/g,function(r){return t[+r]})}}var ume=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function bf(t){if(!(e=ume.exec(t)))throw new Error("invalid format: "+t);var e;return new P_({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]})}bf.prototype=P_.prototype;function P_(t){this.fill=t.fill===void 0?" ":t.fill+"",this.align=t.align===void 0?">":t.align+"",this.sign=t.sign===void 0?"-":t.sign+"",this.symbol=t.symbol===void 0?"":t.symbol+"",this.zero=!!t.zero,this.width=t.width===void 0?void 0:+t.width,this.comma=!!t.comma,this.precision=t.precision===void 0?void 0:+t.precision,this.trim=!!t.trim,this.type=t.type===void 0?"":t.type+""}P_.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type};function dme(t){e:for(var e=t.length,r=1,n=-1,i;r<e;++r)switch(t[r]){case".":n=i=r;break;case"0":n===0&&(n=r),i=r;break;default:if(!+t[r])break e;n>0&&(n=0);break}return n>0?t.slice(0,n)+t.slice(i+1):t}var pg;function fme(t,e){var r=hg(t,e);if(!r)return pg=void 0,t.toPrecision(e);var n=r[0],i=r[1],s=i-(pg=Math.max(-8,Math.min(8,Math.floor(i/3)))*3)+1,a=n.length;return s===a?n:s>a?n+new Array(s-a+1).join("0"):s>0?n.slice(0,s)+"."+n.slice(s):"0."+new Array(1-s).join("0")+hg(t,Math.max(0,e+s-1))[0]}function VO(t,e){var r=hg(t,e);if(!r)return t+"";var n=r[0],i=r[1];return i<0?"0."+new Array(-i).join("0")+n:n.length>i+1?n.slice(0,i+1)+"."+n.slice(i+1):n+new Array(i-n.length+2).join("0")}const HO={"%":(t,e)=>(t*100).toFixed(e),b:t=>Math.round(t).toString(2),c:t=>t+"",d:ome,e:(t,e)=>t.toExponential(e),f:(t,e)=>t.toFixed(e),g:(t,e)=>t.toPrecision(e),o:t=>Math.round(t).toString(8),p:(t,e)=>VO(t*100,e),r:VO,s:fme,X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16)};function KO(t){return t}var zO=Array.prototype.map,qO=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function hme(t){var e=t.grouping===void 0||t.thousands===void 0?KO:lme(zO.call(t.grouping,Number),t.thousands+""),r=t.currency===void 0?"":t.currency[0]+"",n=t.currency===void 0?"":t.currency[1]+"",i=t.decimal===void 0?".":t.decimal+"",s=t.numerals===void 0?KO:cme(zO.call(t.numerals,String)),a=t.percent===void 0?"%":t.percent+"",o=t.minus===void 0?"−":t.minus+"",l=t.nan===void 0?"NaN":t.nan+"";function c(d,f){d=bf(d);var h=d.fill,p=d.align,g=d.sign,m=d.symbol,v=d.zero,y=d.width,b=d.comma,w=d.precision,S=d.trim,T=d.type;T==="n"?(b=!0,T="g"):HO[T]||(w===void 0&&(w=12),S=!0,T="g"),(v||h==="0"&&p==="=")&&(v=!0,h="0",p="=");var _=(f&&f.prefix!==void 0?f.prefix:"")+(m==="$"?r:m==="#"&&/[boxX]/.test(T)?"0"+T.toLowerCase():""),A=(m==="$"?n:/[%p]/.test(T)?a:"")+(f&&f.suffix!==void 0?f.suffix:""),P=HO[T],C=/[defgprs%]/.test(T);w=w===void 0?6:/[gprs]/.test(T)?Math.max(1,Math.min(21,w)):Math.max(0,Math.min(20,w));function O(R){var D=_,L=A,j,M,N;if(T==="c")L=P(R)+L,R="";else{R=+R;var k=R<0||1/R<0;if(R=isNaN(R)?l:P(Math.abs(R),w),S&&(R=dme(R)),k&&+R==0&&g!=="+"&&(k=!1),D=(k?g==="("?g:o:g==="-"||g==="("?"":g)+D,L=(T==="s"&&!isNaN(R)&&pg!==void 0?qO[8+pg/3]:"")+L+(k&&g==="("?")":""),C){for(j=-1,M=R.length;++j<M;)if(N=R.charCodeAt(j),48>N||N>57){L=(N===46?i+R.slice(j+1):R.slice(j))+L,R=R.slice(0,j);break}}}b&&!v&&(R=e(R,1/0));var $=D.length+R.length+L.length,U=$<y?new Array(y-$+1).join(h):"";switch(b&&v&&(R=e(U+R,U.length?y-L.length:1/0),U=""),p){case"<":R=D+R+L+U;break;case"=":R=D+U+R+L;break;case"^":R=U.slice(0,$=U.length>>1)+D+R+L+U.slice($);break;default:R=U+D+R+L;break}return s(R)}return O.toString=function(){return d+""},O}function u(d,f){var h=Math.max(-8,Math.min(8,Math.floor(Rc(f)/3)))*3,p=Math.pow(10,-h),g=c((d=bf(d),d.type="f",d),{suffix:qO[8+h/3]});return function(m){return g(p*m)}}return{format:c,formatPrefix:u}}var mp,I_,lB;pme({thousands:",",grouping:[3],currency:["$",""]});function pme(t){return mp=hme(t),I_=mp.format,lB=mp.formatPrefix,mp}function mme(t){return Math.max(0,-Rc(Math.abs(t)))}function gme(t,e){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(Rc(e)/3)))*3-Rc(Math.abs(t)))}function vme(t,e){return t=Math.abs(t),e=Math.abs(e)-t,Math.max(0,Rc(e)-Rc(t))+1}function cB(t,e,r,n){var i=eS(t,e,r),s;switch(n=bf(n??",f"),n.type){case"s":{var a=Math.max(Math.abs(t),Math.abs(e));return n.precision==null&&!isNaN(s=gme(i,a))&&(n.precision=s),lB(n,a)}case"":case"e":case"g":case"p":case"r":{n.precision==null&&!isNaN(s=vme(i,Math.max(Math.abs(t),Math.abs(e))))&&(n.precision=s-(n.type==="e"));break}case"f":case"%":{n.precision==null&&!isNaN(s=mme(i))&&(n.precision=s-(n.type==="%")*2);break}}return I_(n)}function La(t){var e=t.domain;return t.ticks=function(r){var n=e();return Jw(n[0],n[n.length-1],r??10)},t.tickFormat=function(r,n){var i=e();return cB(i[0],i[i.length-1],r??10,n)},t.nice=function(r){r==null&&(r=10);var n=e(),i=0,s=n.length-1,a=n[i],o=n[s],l,c,u=10;for(o<a&&(c=a,a=o,o=c,c=i,i=s,s=c);u-- >0;){if(c=Zw(a,o,r),c===l)return n[i]=a,n[s]=o,e(n);if(c>0)a=Math.floor(a/c)*c,o=Math.ceil(o/c)*c;else if(c<0)a=Math.ceil(a*c)/c,o=Math.floor(o*c)/c;else break;l=c}return t},t}function mg(){var t=A_();return t.copy=function(){return ch(t,mg())},Mn.apply(t,arguments),La(t)}function uB(t){var e;function r(n){return n==null||isNaN(n=+n)?e:n}return r.invert=r,r.domain=r.range=function(n){return arguments.length?(t=Array.from(n,fg),r):t.slice()},r.unknown=function(n){return arguments.length?(e=n,r):e},r.copy=function(){return uB(t).unknown(e)},t=arguments.length?Array.from(t,fg):[0,1],La(r)}function dB(t,e){t=t.slice();var r=0,n=t.length-1,i=t[r],s=t[n],a;return s<i&&(a=r,r=n,n=a,a=i,i=s,s=a),t[r]=e.floor(i),t[n]=e.ceil(s),t}function YO(t){return Math.log(t)}function XO(t){return Math.exp(t)}function yme(t){return-Math.log(-t)}function bme(t){return-Math.exp(-t)}function xme(t){return isFinite(t)?+("1e"+t):t<0?0:t}function wme(t){return t===10?xme:t===Math.E?Math.exp:e=>Math.pow(t,e)}function Sme(t){return t===Math.E?Math.log:t===10&&Math.log10||t===2&&Math.log2||(t=Math.log(t),e=>Math.log(e)/t)}function QO(t){return(e,r)=>-t(-e,r)}function C_(t){const e=t(YO,XO),r=e.domain;let n=10,i,s;function a(){return i=Sme(n),s=wme(n),r()[0]<0?(i=QO(i),s=QO(s),t(yme,bme)):t(YO,XO),e}return e.base=function(o){return arguments.length?(n=+o,a()):n},e.domain=function(o){return arguments.length?(r(o),a()):r()},e.ticks=o=>{const l=r();let c=l[0],u=l[l.length-1];const d=u<c;d&&([c,u]=[u,c]);let f=i(c),h=i(u),p,g;
vendor: 4,772 bytes, line 308
308const m=o==null?10:+o;let v=[];if(!(n%1)&&h-f<m){if(f=Math.floor(f),h=Math.ceil(h),c>0){for(;f<=h;++f)for(p=1;p<n;++p)if(g=f<0?p/s(-f):p*s(f),!(g<c)){if(g>u)break;v.push(g)}}else for(;f<=h;++f)for(p=n-1;p>=1;--p)if(g=f>0?p/s(-f):p*s(f),!(g<c)){if(g>u)break;v.push(g)}v.length*2<m&&(v=Jw(c,u,m))}else v=Jw(f,h,Math.min(h-f,m)).map(s);return d?v.reverse():v},e.tickFormat=(o,l)=>{if(o==null&&(o=10),l==null&&(l=n===10?"s":","),typeof l!="function"&&(!(n%1)&&(l=bf(l)).precision==null&&(l.trim=!0),l=I_(l)),o===1/0)return l;const c=Math.max(1,n*o/e.ticks().length);return u=>{let d=u/s(Math.round(i(u)));return d*n<n-.5&&(d*=n),d<=c?l(u):""}},e.nice=()=>r(dB(r(),{floor:o=>s(Math.floor(i(o))),ceil:o=>s(Math.ceil(i(o)))})),e}function fB(){const t=C_(ny()).domain([1,10]);return t.copy=()=>ch(t,fB()).base(t.base()),Mn.apply(t,arguments),t}function JO(t){return function(e){return Math.sign(e)*Math.log1p(Math.abs(e/t))}}function ZO(t){return function(e){return Math.sign(e)*Math.expm1(Math.abs(e))*t}}function O_(t){var e=1,r=t(JO(e),ZO(e));return r.constant=function(n){return arguments.length?t(JO(e=+n),ZO(e)):e},La(r)}function hB(){var t=O_(ny());return t.copy=function(){return ch(t,hB()).constant(t.constant())},Mn.apply(t,arguments)}function eR(t){return function(e){return e<0?-Math.pow(-e,t):Math.pow(e,t)}}function Eme(t){return t<0?-Math.sqrt(-t):Math.sqrt(t)}function Tme(t){return t<0?-t*t:t*t}function R_(t){var e=t(Lr,Lr),r=1;function n(){return r===1?t(Lr,Lr):r===.5?t(Eme,Tme):t(eR(r),eR(1/r))}return e.exponent=function(i){return arguments.length?(r=+i,n()):r},La(e)}function k_(){var t=R_(ny());return t.copy=function(){return ch(t,k_()).exponent(t.exponent())},Mn.apply(t,arguments),t}function _me(){return k_.apply(null,arguments).exponent(.5)}function tR(t){return Math.sign(t)*t*t}function Ame(t){return Math.sign(t)*Math.sqrt(Math.abs(t))}function pB(){var t=A_(),e=[0,1],r=!1,n;function i(s){var a=Ame(t(s));return isNaN(a)?n:r?Math.round(a):a}return i.invert=function(s){return t.invert(tR(s))},i.domain=function(s){return arguments.length?(t.domain(s),i):t.domain()},i.range=function(s){return arguments.length?(t.range((e=Array.from(s,fg)).map(tR)),i):e.slice()},i.rangeRound=function(s){return i.range(s).round(!0)},i.round=function(s){return arguments.length?(r=!!s,i):r},i.clamp=function(s){return arguments.length?(t.clamp(s),i):t.clamp()},i.unknown=function(s){return arguments.length?(n=s,i):n},i.copy=function(){return pB(t.domain(),e).round(r).clamp(t.clamp()).unknown(n)},Mn.apply(i,arguments),La(i)}function mB(){var t=[],e=[],r=[],n;function i(){var a=0,o=Math.max(1,e.length);for(r=new Array(o-1);++a<o;)r[a-1]=Rpe(t,a/o);return s}function s(a){return a==null||isNaN(a=+a)?n:e[oh(r,a)]}return s.invertExtent=function(a){var o=e.indexOf(a);return o<0?[NaN,NaN]:[o>0?r[o-1]:t[0],o<r.length?r[o]:t[t.length-1]]},s.domain=function(a){if(!arguments.length)return t.slice();t=[];for(let o of a)o!=null&&!isNaN(o=+o)&&t.push(o);return t.sort(ba),i()},s.range=function(a){return arguments.length?(e=Array.from(a),i()):e.slice()},s.unknown=function(a){return arguments.length?(n=a,s):n},s.quantiles=function(){return r.slice()},s.copy=function(){return mB().domain(t).range(e).unknown(n)},Mn.apply(s,arguments)}function gB(){var t=0,e=1,r=1,n=[.5],i=[0,1],s;function a(l){return l!=null&&l<=l?i[oh(n,l,0,r)]:s}function o(){var l=-1;for(n=new Array(r);++l<r;)n[l]=((l+1)*e-(l-r)*t)/(r+1);return a}return a.domain=function(l){return arguments.length?([t,e]=l,t=+t,e=+e,o()):[t,e]},a.range=function(l){return arguments.length?(r=(i=Array.from(l)).length-1,o()):i.slice()},a.invertExtent=function(l){var c=i.indexOf(l);return c<0?[NaN,NaN]:c<1?[t,n[0]]:c>=r?[n[r-1],e]:[n[c-1],n[c]]},a.unknown=function(l){return arguments.length&&(s=l),a},a.thresholds=function(){return n.slice()},a.copy=function(){return gB().domain([t,e]).range(i).unknown(s)},Mn.apply(La(a),arguments)}function vB(){var t=[.5],e=[0,1],r,n=1;function i(s){return s!=null&&s<=s?e[oh(t,s,0,n)]:r}return i.domain=function(s){return arguments.length?(t=Array.from(s),n=Math.min(t.length,e.length-1),i):t.slice()},i.range=function(s){return arguments.length?(e=Array.from(s),n=Math.min(t.length,e.length-1),i):e.slice()},i.invertExtent=function(s){var a=e.indexOf(s);return[t[a-1],t[a]]},i.unknown=function(s){return arguments.length?(r=s,i):r},i.copy=function(){return vB().domain(t).range(e).unknown(r)},Mn.apply(i,arguments)}const sb=new Date,ab=new Date;function Qt(t,e,r,n){function i(s){return t(s=arguments.length===0?new Date:new Date(+s)),s}return i.floor=s=>(t(s=new Date(+s)),s),i.ceil=s=>(t(s=new Date(s-1)),e(s,1),t(s),s),i.round=s=>{const a=i(s),o=i.ceil(s);return s-a<o-s?a:o},i.offset=(s,a)=>(e(s=new Date(+s),a==null?1:Math.floor(a)),s),i.range=(s,a,o)=>{const l=[];
vendor: 6,621 bytes, line 308
308if(s=i.ceil(s),o=o==null?1:Math.floor(o),!(s<a)||!(o>0))return l;let c;do l.push(c=new Date(+s)),e(s,o),t(s);while(c<s&&s<a);return l},i.filter=s=>Qt(a=>{if(a>=a)for(;t(a),!s(a);)a.setTime(a-1)},(a,o)=>{if(a>=a)if(o<0)for(;++o<=0;)for(;e(a,-1),!s(a););else for(;--o>=0;)for(;e(a,1),!s(a););}),r&&(i.count=(s,a)=>(sb.setTime(+s),ab.setTime(+a),t(sb),t(ab),Math.floor(r(sb,ab))),i.every=s=>(s=Math.floor(s),!isFinite(s)||!(s>0)?null:s>1?i.filter(n?a=>n(a)%s===0:a=>i.count(0,a)%s===0):i)),i}const gg=Qt(()=>{},(t,e)=>{t.setTime(+t+e)},(t,e)=>e-t);gg.every=t=>(t=Math.floor(t),!isFinite(t)||!(t>0)?null:t>1?Qt(e=>{e.setTime(Math.floor(e/t)*t)},(e,r)=>{e.setTime(+e+r*t)},(e,r)=>(r-e)/t):gg);gg.range;const us=1e3,An=us*60,ds=An*60,ws=ds*24,L_=ws*7,rR=ws*30,ob=ws*365,fo=Qt(t=>{t.setTime(t-t.getMilliseconds())},(t,e)=>{t.setTime(+t+e*us)},(t,e)=>(e-t)/us,t=>t.getUTCSeconds());fo.range;const D_=Qt(t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*us)},(t,e)=>{t.setTime(+t+e*An)},(t,e)=>(e-t)/An,t=>t.getMinutes());D_.range;const N_=Qt(t=>{t.setUTCSeconds(0,0)},(t,e)=>{t.setTime(+t+e*An)},(t,e)=>(e-t)/An,t=>t.getUTCMinutes());N_.range;const M_=Qt(t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*us-t.getMinutes()*An)},(t,e)=>{t.setTime(+t+e*ds)},(t,e)=>(e-t)/ds,t=>t.getHours());M_.range;const $_=Qt(t=>{t.setUTCMinutes(0,0,0)},(t,e)=>{t.setTime(+t+e*ds)},(t,e)=>(e-t)/ds,t=>t.getUTCHours());$_.range;const uh=Qt(t=>t.setHours(0,0,0,0),(t,e)=>t.setDate(t.getDate()+e),(t,e)=>(e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*An)/ws,t=>t.getDate()-1);uh.range;const iy=Qt(t=>{t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e)},(t,e)=>(e-t)/ws,t=>t.getUTCDate()-1);iy.range;const yB=Qt(t=>{t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e)},(t,e)=>(e-t)/ws,t=>Math.floor(t/ws));yB.range;function Xo(t){return Qt(e=>{e.setDate(e.getDate()-(e.getDay()+7-t)%7),e.setHours(0,0,0,0)},(e,r)=>{e.setDate(e.getDate()+r*7)},(e,r)=>(r-e-(r.getTimezoneOffset()-e.getTimezoneOffset())*An)/L_)}const sy=Xo(0),vg=Xo(1),Pme=Xo(2),Ime=Xo(3),kc=Xo(4),Cme=Xo(5),Ome=Xo(6);sy.range;vg.range;Pme.range;Ime.range;kc.range;Cme.range;Ome.range;function Qo(t){return Qt(e=>{e.setUTCDate(e.getUTCDate()-(e.getUTCDay()+7-t)%7),e.setUTCHours(0,0,0,0)},(e,r)=>{e.setUTCDate(e.getUTCDate()+r*7)},(e,r)=>(r-e)/L_)}const ay=Qo(0),yg=Qo(1),Rme=Qo(2),kme=Qo(3),Lc=Qo(4),Lme=Qo(5),Dme=Qo(6);ay.range;yg.range;Rme.range;kme.range;Lc.range;Lme.range;Dme.range;const j_=Qt(t=>{t.setDate(1),t.setHours(0,0,0,0)},(t,e)=>{t.setMonth(t.getMonth()+e)},(t,e)=>e.getMonth()-t.getMonth()+(e.getFullYear()-t.getFullYear())*12,t=>t.getMonth());j_.range;const F_=Qt(t=>{t.setUTCDate(1),t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCMonth(t.getUTCMonth()+e)},(t,e)=>e.getUTCMonth()-t.getUTCMonth()+(e.getUTCFullYear()-t.getUTCFullYear())*12,t=>t.getUTCMonth());F_.range;const Ss=Qt(t=>{t.setMonth(0,1),t.setHours(0,0,0,0)},(t,e)=>{t.setFullYear(t.getFullYear()+e)},(t,e)=>e.getFullYear()-t.getFullYear(),t=>t.getFullYear());Ss.every=t=>!isFinite(t=Math.floor(t))||!(t>0)?null:Qt(e=>{e.setFullYear(Math.floor(e.getFullYear()/t)*t),e.setMonth(0,1),e.setHours(0,0,0,0)},(e,r)=>{e.setFullYear(e.getFullYear()+r*t)});Ss.range;const Es=Qt(t=>{t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCFullYear(t.getUTCFullYear()+e)},(t,e)=>e.getUTCFullYear()-t.getUTCFullYear(),t=>t.getUTCFullYear());Es.every=t=>!isFinite(t=Math.floor(t))||!(t>0)?null:Qt(e=>{e.setUTCFullYear(Math.floor(e.getUTCFullYear()/t)*t),e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,r)=>{e.setUTCFullYear(e.getUTCFullYear()+r*t)});Es.range;function bB(t,e,r,n,i,s){const a=[[fo,1,us],[fo,5,5*us],[fo,15,15*us],[fo,30,30*us],[s,1,An],[s,5,5*An],[s,15,15*An],[s,30,30*An],[i,1,ds],[i,3,3*ds],[i,6,6*ds],[i,12,12*ds],[n,1,ws],[n,2,2*ws],[r,1,L_],[e,1,rR],[e,3,3*rR],[t,1,ob]];function o(c,u,d){const f=u<c;f&&([c,u]=[u,c]);const h=d&&typeof d.range=="function"?d:l(c,u,d),p=h?h.range(c,+u+1):[];return f?p.reverse():p}function l(c,u,d){const f=Math.abs(u-c)/d,h=w_(([,,m])=>m).right(a,f);if(h===a.length)return t.every(eS(c/ob,u/ob,d));if(h===0)return gg.every(Math.max(eS(c,u,d),1));const[p,g]=a[f/a[h-1][2]<a[h][2]/f?h-1:h];return p.every(g)}return[o,l]}const[Nme,Mme]=bB(Es,F_,ay,yB,$_,N_),[$me,jme]=bB(Ss,j_,sy,uh,M_,D_);function lb(t){if(0<=t.y&&t.y<100){var e=new Date(-1,t.m,t.d,t.H,t.M,t.S,t.L);return e.setFullYear(t.y),e}return new Date(t.y,t.m,t.d,t.H,t.M,t.S,t.L)}function cb(t){if(0<=t.y&&t.y<100){var e=new Date(Date.UTC(-1,t.m,t.d,t.H,t.M,t.S,t.L));return e.setUTCFullYear(t.y),e}return new Date(Date.UTC(t.y,t.m,t.d,t.H,t.M,t.S,t.L))}function ju(t,e,r){return{y:t,m:e,d:r,H:0,M:0,S:0,L:0}}function Fme(t){var e=t.dateTime,r=t.date,n=t.time,i=t.periods,s=t.days,a=t.shortDays,o=t.months,l=t.shortMonths,c=Fu(i),u=Bu(i),d=Fu(s),f=Bu(s),h=Fu(a),p=Bu(a),g=Fu(o),m=Bu(o),v=Fu(l),y=Bu(l),b={a:N,A:k,b:$,B:U,c:null,d:lR,e:lR,f:lge,g:yge,G:xge,H:sge,I:age,j:oge,L:xB,m:cge,M:uge,p:G,q:B,Q:dR,s:fR,S:dge,u:fge,U:hge,V:pge,w:mge,W:gge,x:null,X:null,y:vge,Y:bge,Z:wge,"%":uR},w={a:K,A:ee,b:H,B:J,c:null,d:cR,e:cR,f:_ge,g:Nge,G:$ge,H:Sge,I:Ege,j:Tge,L:SB,m:Age,M:Pge,p:q,q:ie,Q:dR,s:fR,S:Ige,u:Cge,U:Oge,V:Rge,w:kge,W:Lge,x:null,X:null,y:Dge,Y:Mge,Z:jge,"%":uR},S={a:C,A:O,b:R,B:D,c:L,d:aR,e:aR,f:tge,g:sR,G:iR,H:oR,I:oR,j:Qme,L:ege,m:Xme,M:Jme,p:P,q:Yme,Q:nge,s:ige,S:Zme,u:Vme,U:Hme,V:Kme,w:Wme,W:zme,x:j,X:M,y:sR,Y:iR,Z:qme,"%":rge};b.x=T(r,b),b.X=T(n,b),b.c=T(e,b),w.x=T(r,w),w.X=T(n,w),w.c=T(e,w);function T(Z,re){return function(ne){var z=[],Ee=-1,me=0,Qe=Z.length,de,Pe,tt;for(ne instanceof Date||(ne=new Date(+ne));++Ee<Qe;)Z.charCodeAt(Ee)===37&&(z.push(Z.slice(me,Ee)),(Pe=nR[de=Z.charAt(++Ee)])!=null?de=Z.charAt(++Ee):Pe=de==="e"?" ":"0",(tt=re[de])&&(de=tt(ne,Pe)),z.push(de),me=Ee+1);return z.push(Z.slice(me,Ee)),z.join("")}}function _(Z,re){return function(ne){var z=ju(1900,void 0,1),Ee=A(z,Z,ne+="",0),me,Qe;if(Ee!=ne.length)return null;if("Q"in z)return new Date(z.Q);if("s"in z)return new Date(z.s*1e3+("L"in z?z.L:0));if(re&&!("Z"in z)&&(z.Z=0),"p"in z&&(z.H=z.H%12+z.p*12),z.m===void 0&&(z.m="q"in z?z.q:0),"V"in z){if(z.V<1||z.V>53)return null;"w"in z||(z.w=1),"Z"in z?(me=cb(ju(z.y,0,1)),Qe=me.getUTCDay(),me=Qe>4||Qe===0?yg.ceil(me):yg(me),me=iy.offset(me,(z.V-1)*7),z.y=me.getUTCFullYear(),z.m=me.getUTCMonth(),z.d=me.getUTCDate()+(z.w+6)%7):(me=lb(ju(z.y,0,1)),Qe=me.getDay(),me=Qe>4||Qe===0?vg.ceil(me):vg(me),me=uh.offset(me,(z.V-1)*7),z.y=me.getFullYear(),z.m=me.getMonth(),z.d=me.getDate()+(z.w+6)%7)}else("W"in z||"U"in z)&&("w"in z||(z.w="u"in z?z.u%7:"W"in z?1:0),Qe="Z"in z?cb(ju(z.y,0,1)).getUTCDay():lb(ju(z.y,0,1)).getDay(),z.m=0,z.d="W"
vendor: 4,463 bytes, line 308
308in z?(z.w+6)%7+z.W*7-(Qe+5)%7:z.w+z.U*7-(Qe+6)%7);return"Z"in z?(z.H+=z.Z/100|0,z.M+=z.Z%100,cb(z)):lb(z)}}function A(Z,re,ne,z){for(var Ee=0,me=re.length,Qe=ne.length,de,Pe;Ee<me;){if(z>=Qe)return-1;if(de=re.charCodeAt(Ee++),de===37){if(de=re.charAt(Ee++),Pe=S[de in nR?re.charAt(Ee++):de],!Pe||(z=Pe(Z,ne,z))<0)return-1}else if(de!=ne.charCodeAt(z++))return-1}return z}function P(Z,re,ne){var z=c.exec(re.slice(ne));return z?(Z.p=u.get(z[0].toLowerCase()),ne+z[0].length):-1}function C(Z,re,ne){var z=h.exec(re.slice(ne));return z?(Z.w=p.get(z[0].toLowerCase()),ne+z[0].length):-1}function O(Z,re,ne){var z=d.exec(re.slice(ne));return z?(Z.w=f.get(z[0].toLowerCase()),ne+z[0].length):-1}function R(Z,re,ne){var z=v.exec(re.slice(ne));return z?(Z.m=y.get(z[0].toLowerCase()),ne+z[0].length):-1}function D(Z,re,ne){var z=g.exec(re.slice(ne));return z?(Z.m=m.get(z[0].toLowerCase()),ne+z[0].length):-1}function L(Z,re,ne){return A(Z,e,re,ne)}function j(Z,re,ne){return A(Z,r,re,ne)}function M(Z,re,ne){return A(Z,n,re,ne)}function N(Z){return a[Z.getDay()]}function k(Z){return s[Z.getDay()]}function $(Z){return l[Z.getMonth()]}function U(Z){return o[Z.getMonth()]}function G(Z){return i[+(Z.getHours()>=12)]}function B(Z){return 1+~~(Z.getMonth()/3)}function K(Z){return a[Z.getUTCDay()]}function ee(Z){return s[Z.getUTCDay()]}function H(Z){return l[Z.getUTCMonth()]}function J(Z){return o[Z.getUTCMonth()]}function q(Z){return i[+(Z.getUTCHours()>=12)]}function ie(Z){return 1+~~(Z.getUTCMonth()/3)}return{format:function(Z){var re=T(Z+="",b);return re.toString=function(){return Z},re},parse:function(Z){var re=_(Z+="",!1);return re.toString=function(){return Z},re},utcFormat:function(Z){var re=T(Z+="",w);return re.toString=function(){return Z},re},utcParse:function(Z){var re=_(Z+="",!0);return re.toString=function(){return Z},re}}}var nR={"-":"",_:" ",0:"0"},or=/^\s*\d+/,Bme=/^%/,Ume=/[\\^$*+?|[\]().{}]/g;function je(t,e,r){var n=t<0?"-":"",i=(n?-t:t)+"",s=i.length;return n+(s<r?new Array(r-s+1).join(e)+i:i)}function Gme(t){return t.replace(Ume,"\\$&")}function Fu(t){return new RegExp("^(?:"+t.map(Gme).join("|")+")","i")}function Bu(t){return new Map(t.map((e,r)=>[e.toLowerCase(),r]))}function Wme(t,e,r){var n=or.exec(e.slice(r,r+1));return n?(t.w=+n[0],r+n[0].length):-1}function Vme(t,e,r){var n=or.exec(e.slice(r,r+1));return n?(t.u=+n[0],r+n[0].length):-1}function Hme(t,e,r){var n=or.exec(e.slice(r,r+2));return n?(t.U=+n[0],r+n[0].length):-1}function Kme(t,e,r){var n=or.exec(e.slice(r,r+2));return n?(t.V=+n[0],r+n[0].length):-1}function zme(t,e,r){var n=or.exec(e.slice(r,r+2));return n?(t.W=+n[0],r+n[0].length):-1}function iR(t,e,r){var n=or.exec(e.slice(r,r+4));return n?(t.y=+n[0],r+n[0].length):-1}function sR(t,e,r){var n=or.exec(e.slice(r,r+2));return n?(t.y=+n[0]+(+n[0]>68?1900:2e3),r+n[0].length):-1}function qme(t,e,r){var n=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(e.slice(r,r+6));return n?(t.Z=n[1]?0:-(n[2]+(n[3]||"00")),r+n[0].length):-1}function Yme(t,e,r){var n=or.exec(e.slice(r,r+1));return n?(t.q=n[0]*3-3,r+n[0].length):-1}function Xme(t,e,r){var n=or.exec(e.slice(r,r+2));return n?(t.m=n[0]-1,r+n[0].length):-1}function aR(t,e,r){var n=or.exec(e.slice(r,r+2));return n?(t.d=+n[0],r+n[0].length):-1}function Qme(t,e,r){var n=or.exec(e.slice(r,r+3));return n?(t.m=0,t.d=+n[0],r+n[0].length):-1}function oR(t,e,r){var n=or.exec(e.slice(r,r+2));return n?(t.H=+n[0],r+n[0].length):-1}function Jme(t,e,r){var n=or.exec(e.slice(r,r+2));return n?(t.M=+n[0],r+n[0].length):-1}function Zme(t,e,r){var n=or.exec(e.slice(r,r+2));return n?(t.S=+n[0],r+n[0].length):-1}function ege(t,e,r){var n=or.exec(e.slice(r,r+3));return n?(t.L=+n[0],r+n[0].length):-1}function tge(t,e,r){var n=or.exec(e.slice(r,r+6));return n?(t.L=Math.floor(n[0]/1e3),r+n[0].length):-1}function rge(t,e,r){var n=Bme.exec(e.slice(r,r+1));return n?r+n[0].length:-1}function nge(t,e,r){var n=or.exec(e.slice(r));return n?(t.Q=+n[0],r+n[0].length):-1}function ige(t,e,r){var n=or.exec(e.slice(r));return n?(t.s=+n[0],r+n[0].length):-1}function lR(t,e){return je(t.getDate(),e,2)}function sge(t,e){return je(t.getHours(),e,2)}function age(t,e){return je(t.getHours()%12||12,e,2)}function oge(t,e){return je(1+uh.count(Ss(t),t),e,3)}function xB(t,e){return je(t.getMilliseconds(),e,3)}function lge(t,e){return xB(t,e)+"000"}function cge(t,e){return je(t.getMonth()+1,e,2)}function uge(t,e){return je(t.getMinutes(),e,2)}function dge(t,e){return je(t.getSeconds(),e,2)}
308function fge(t){var e=t.getDay();return e===0?7:e}function hge(t,e){return je(sy.count(Ss(t)-1,t),e,2)}function wB(t){var e=t.getDay();return e>=4||e===0?kc(t):kc.ceil(t)}function pge(t,e){return t=wB(t),je(kc.count(Ss(t),t)+(Ss(t).getDay()===4),e,2)}function mge(t){return t.getDay()}function gge(t,e){return je(vg.count(Ss(t)-1,t),e,2)}function vge(t,e){return je(t.getFullYear()%100,e,2)}function yge(t,e){return t=wB(t),je(t.getFullYear()%100,e,2)}function bge(t,e){return je(t.getFullYear()%1e4,e,4)}function xge(t,e){var r=t.getDay();return t=r>=4||r===0?kc(t):kc.ceil(t),je(t.getFullYear()%1e4,e,4)}function wge(t){var e=t.getTimezoneOffset();return(e>0?"-":(e*=-1,"+"))+je(e/60|0,"0",2)+je(e%60,"0",2)}function cR(t,e){return je(t.getUTCDate(),e,2)}function Sge(t,e){return je(t.getUTCHours(),e,2)}function Ege(t,e){return je(t.getUTCHours()%12||12,e,2)}function Tge(t,e){return je(1+iy.count(Es(t),t),e,3)}function SB(t,e){return je(t.getUTCMilliseconds(),e,3)}function _ge(t,e){return SB(t,e)+"000"}function Age(t,e){return je(t.getUTCMonth()+1,e,2)}function Pge(t,e){return je(t.getUTCMinutes(),e,2)}function Ige(t,e){return je(t.getUTCSeconds(),e,2)}function Cge(t){var e=t.getUTCDay();return e===0?7:e}function Oge(t,e){return je(ay.count(Es(t)-1,t),e,2)}function EB(t){var e=t.getUTCDay();return e>=4||e===0?Lc(t):Lc.ceil(t)}function Rge(t,e){return t=EB(t),je(Lc.count(Es(t),t)+(Es(t).getUTCDay()===4),e,2)}function kge(t){return t.getUTCDay()}function Lge(t,e){return je(yg.count(Es(t)-1,t),e,2)}function Dge(t,e){return je(t.getUTCFullYear()%100,e,2)}function Nge(t,e){return t=EB(t),je(t.getUTCFullYear()%100,e,2)}function Mge(t,e){return je(t.getUTCFullYear()%1e4,e,4)}function $ge(t,e){var r=t.getUTCDay();return t=r>=4||r===0?Lc(t):Lc.ceil(t),je(t.getUTCFullYear()%1e4,e,4)}function jge(){return"+0000"}function uR(){return"%"}function dR(t){return+t}function fR(t){return Math.floor(+t/1e3)}var ml,TB,_B;Fge({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});function Fge(t){return ml=Fme(t),TB=ml.format,ml.parse,_B=ml.utcFormat,ml.utcParse,ml}function Bge(t){return new Date(t)}function Uge(t){return t instanceof Date?+t:+new Date(+t)}function B_(t,e,r,n,i,s,a,o,l,c){var u=A_(),d=u.invert,f=u.domain,h=c(".%L"),p=c(":%S"),g=c("%I:%M"),m=c("%I %p"),v=c("%a %d"),y=c("%b %d"),b=c("%B"),w=c("%Y");function S(T){return(l(T)<T?h:o(T)<T?p:a(T)<T?g:s(T)<T?m:n(T)<T?i(T)<T?v:y:r(T)<T?b:w)(T)}return u.invert=function(T){return new Date(d(T))},u.domain=function(T){return arguments.length?f(Array.from(T,Uge)):f().map(Bge)},u.ticks=function(T){var _=f();return t(_[0],_[_.length-1],T??10)},u.tickFormat=function(T,_){return _==null?S:c(_)},u.nice=function(T){var _=f();return(!T||typeof T.range!="function")&&(T=e(_[0],_[_.length-1],T??10)),T?f(dB(_,T)):u},u.copy=function(){return ch(u,B_(t,e,r,n,i,s,a,o,l,c))},u}function Gge(){return Mn.apply(B_($me,jme,Ss,j_,sy,uh,M_,D_,fo,TB).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}function Wge(){return Mn.apply(B_(Nme,Mme,Es,F_,ay,iy,$_,N_,fo,_B).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]),arguments)}function oy(){var t=0,e=1,r,n,i,s,a=Lr,o=!1,l;function c(d){return d==null||isNaN(d=+d)?l:a(i===0?.5:(d=(s(d)-r)*i,o?Math.max(0,Math.min(1,d)):d))}c.domain=function(d){return arguments.length?([t,e]=d,r=s(t=+t),n=s(e=+e),i=r===n?0:1/(n-r),c):[t,e]},c.clamp=function(d){return arguments.length?(o=!!d,c):o},c.interpolator=function(d){return arguments.length?(a=d,c):a};function u(d){return function(f){var h,p;return arguments.length?([h,p]=f,a=d(h,p),c):[a(0),a(1)]}}return c.range=u(bu),c.rangeRound=u(__),c.unknown=function(d){return arguments.length?(l=d,c):l},function(d){return s=d,r=d(t),n=d(e),i=r===n?0:1/(n-r),c}}function Da(t,e){return e.domain(t.domain()).interpolator(t.interpolator()).clamp(t.clamp()).unknown(t.unknown())}function AB(){var t=La(oy()(Lr));return t.copy=function(){return Da(t,AB())},ks.apply(t,arguments)}function PB(){var t=C_(oy()).domain([1,10]);return t.copy=function(){return Da(t,PB()).base(t.base())},ks.apply(t,arguments)}function IB(){var t=O_(oy());return t.copy=function(){return Da(t,IB()).constant(t.constant())},ks.apply(t,arguments)}function U_(){var t=R_(oy());return t.copy=function(){return Da(t,U_()).exponent(t.exponent())},ks.apply(t,arguments)}function Vge(){return U_.apply(null,arguments).exponent(.5)}function CB(){var t=[],e=Lr;function r(n){if(n!=null&&!isNaN(n=+n))return e((oh(t,n,1)-1)/(t.length-1))}return r.domain=function(n){if(!arguments.length)return t.slice();t=[];for(let i of n)i!=null&&!isNaN(i=+i)&&t.push(i);return t.sort(ba),r},r.interpolator=function(n){return arguments.length?(e=n,r):e},r.range=function(){return t.map((n,i)=>e(i/(t.length-1)))},r.quantiles=function(n){return Array.from({length:n+1},(i,s)=>Ope(t,s/n))},r.copy=function(){return CB(e).domain(t)},ks.apply(r,arguments)}function ly(){var t=0,e=.5,r=1,n=1,i,s,a,o,l,c=Lr,u,d=!1,f;function h(g){return isNaN(g=+g)?f:(g=.5+((g=+u(g))-s)*(n*g<n*s?o:l),c(d?Math.max(0,Math.min(1,g)):g))}h.domain=function(g){return arguments.length?([t,e,r]=g,i=u(t=+t),s=u(e=+e),a=u(r=+r),o=i===s?0:.5/(s-i),l=s===a?0:.5/(a-s),n=s<i?-1:1,h):[t,e,r]},h.clamp=function(g){return arguments.length?(d=!!g,h):d},h.interpolator=function(g){return arguments.length?(c=g,h):c};function p(g){return function(m){var v,y,b;return arguments.length?([v,y,b]=m,c=rme(g,[v,y,b]),h):[c(0),c(.5),c(1)]}}return h.range=p(bu),h.rangeRound=p(__),h.unknown=function(g){return arguments.length?(f=g,h):f},function(g){return u=g,i=g(t),s=g(e),a=g(r),o=i===s?0:.5/(s-i),l=s===a?0:.5/(a-s),n=s<i?-1:1,h}}function OB(){var t=La(ly()(Lr));return t.copy=function(){return Da(t,OB())}
vendor: 213,493 bytes, lines 308-356
308,ks.apply(t,arguments)}function RB(){var t=C_(ly()).domain([.1,1,10]);return t.copy=function(){return Da(t,RB()).base(t.base())},ks.apply(t,arguments)}function kB(){var t=O_(ly());return t.copy=function(){return Da(t,kB()).constant(t.constant())},ks.apply(t,arguments)}function G_(){var t=R_(ly());return t.copy=function(){return Da(t,G_()).exponent(t.exponent())},ks.apply(t,arguments)}function Hge(){return G_.apply(null,arguments).exponent(.5)}const hR=Object.freeze(Object.defineProperty({__proto__:null,scaleBand:mf,scaleDiverging:OB,scaleDivergingLog:RB,scaleDivergingPow:G_,scaleDivergingSqrt:Hge,scaleDivergingSymlog:kB,scaleIdentity:uB,scaleImplicit:tS,scaleLinear:mg,scaleLog:fB,scaleOrdinal:S_,scalePoint:bd,scalePow:k_,scaleQuantile:mB,scaleQuantize:gB,scaleRadial:pB,scaleSequential:AB,scaleSequentialLog:PB,scaleSequentialPow:U_,scaleSequentialQuantile:CB,scaleSequentialSqrt:Vge,scaleSequentialSymlog:IB,scaleSqrt:_me,scaleSymlog:hB,scaleThreshold:vB,scaleTime:Gge,scaleUtc:Wge,tickFormat:cB},Symbol.toStringTag,{value:"Module"}));var Kge=uu;function zge(t,e,r){for(var n=-1,i=t.length;++n<i;){var s=t[n],a=e(s);if(a!=null&&(o===void 0?a===a&&!Kge(a):r(a,o)))var o=a,l=s}return l}var LB=zge;function qge(t,e){return t>e}var Yge=qge,Xge=LB,Qge=Yge,Jge=vu;function Zge(t){return t&&t.length?Xge(t,Jge,Qge):void 0}var eve=Zge;const cy=at(eve);function tve(t,e){return t<e}var rve=tve,nve=LB,ive=rve,sve=vu;function ave(t){return t&&t.length?nve(t,sve,ive):void 0}var ove=ave;const uy=at(ove);var lve=t_,cve=yu,uve=WF,dve=Yr;function fve(t,e){var r=dve(t)?lve:uve;return r(t,cve(e))}var hve=fve,pve=UF,mve=hve;function gve(t,e){return pve(mve(t,e),1)}var vve=gve;const yve=at(vve);var bve=v_;function xve(t,e){return bve(t,e)}var wve=xve;const W_=at(wve);var xu=1e9,Sve={precision:20,rounding:4,toExpNeg:-7,toExpPos:21,LN10:"2.302585092994045684017991454684364207601101488628772976033327900967572609677352480235997205089598298341967784042286"},H_,xt=!0,Ln="[DecimalError] ",Po=Ln+"Invalid argument: ",V_=Ln+"Exponent out of range: ",wu=Math.floor,to=Math.pow,Eve=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,cn,rr=1e7,mt=7,DB=9007199254740991,bg=wu(DB/mt),ce={};ce.absoluteValue=ce.abs=function(){var t=new this.constructor(this);return t.s&&(t.s=1),t};ce.comparedTo=ce.cmp=function(t){var e,r,n,i,s=this;if(t=new s.constructor(t),s.s!==t.s)return s.s||-t.s;if(s.e!==t.e)return s.e>t.e^s.s<0?1:-1;for(n=s.d.length,i=t.d.length,e=0,r=n<i?n:i;e<r;++e)if(s.d[e]!==t.d[e])return s.d[e]>t.d[e]^s.s<0?1:-1;return n===i?0:n>i^s.s<0?1:-1};ce.decimalPlaces=ce.dp=function(){var t=this,e=t.d.length-1,r=(e-t.e)*mt;if(e=t.d[e],e)for(;e%10==0;e/=10)r--;return r<0?0:r};ce.dividedBy=ce.div=function(t){return ps(this,new this.constructor(t))};ce.dividedToIntegerBy=ce.idiv=function(t){var e=this,r=e.constructor;return st(ps(e,new r(t),0,1),r.precision)};ce.equals=ce.eq=function(t){return!this.cmp(t)};ce.exponent=function(){return Ut(this)};ce.greaterThan=ce.gt=function(t){return this.cmp(t)>0};ce.greaterThanOrEqualTo=ce.gte=function(t){return this.cmp(t)>=0};ce.isInteger=ce.isint=function(){return this.e>this.d.length-2};ce.isNegative=ce.isneg=function(){return this.s<0};ce.isPositive=ce.ispos=function(){return this.s>0};ce.isZero=function(){return this.s===0};ce.lessThan=ce.lt=function(t){return this.cmp(t)<0};ce.lessThanOrEqualTo=ce.lte=function(t){return this.cmp(t)<1};ce.logarithm=ce.log=function(t){var e,r=this,n=r.constructor,i=n.precision,s=i+5;if(t===void 0)t=new n(10);else if(t=new n(t),t.s<1||t.eq(cn))throw Error(Ln+"NaN");if(r.s<1)throw Error(Ln+(r.s?"NaN":"-Infinity"));return r.eq(cn)?new n(0):(xt=!1,e=ps(xf(r,s),xf(t,s),s),xt=!0,st(e,i))};ce.minus=ce.sub=function(t){var e=this;return t=new e.constructor(t),e.s==t.s?$B(e,t):NB(e,(t.s=-t.s,t))};ce.modulo=ce.mod=function(t){var e,r=this,n=r.constructor,i=n.precision;if(t=new n(t),!t.s)throw Error(Ln+"NaN");return r.s?(xt=!1,e=ps(r,t,0,1).times(t),xt=!0,r.minus(e)):st(new n(r),i)};ce.naturalExponential=ce.exp=function(){return MB(this)};ce.naturalLogarithm=ce.ln=function(){return xf(this)};ce.negated=ce.neg=function(){var t=new this.constructor(this);return t.s=-t.s||0,t};ce.plus=ce.add=function(t){var e=this;return t=new e.constructor(t),e.s==t.s?NB(e,t):$B(e,(t.s=-t.s,t))};ce.precision=ce.sd=function(t){var e,r,n,i=this;if(t!==void 0&&t!==!!t&&t!==1&&t!==0)throw Error(Po+t);if(e=Ut(i)+1,n=i.d.length-1,r=n*mt+1,n=i.d[n],n){for(;n%10==0;n/=10)r--;for(n=i.d[0];n>=10;n/=10)r++}return t&&e>r?e:r};ce.squareRoot=ce.sqrt=function(){var t,e,r,n,i,s,a,o=this,l=o.constructor;if(o.s<1){if(!o.s)return new l(0);throw Error(Ln+"NaN")}for(t=Ut(o),xt=!1,i=Math.sqrt(+o),i==0||i==1/0?(e=Oi(o.d),(e.length+t)%2==0&&(e+="0"),i=Math.sqrt(e),t=wu((t+1)/2)-(t<0||t%2),i==1/0?e="5e"+t:(e=i.toExponential(),e=e.slice(0,e.indexOf("e")+1)+t),n=new l(e)):n=new l(i.toString()),r=l.precision,i=a=r+3;;)if(s=n,n=s.plus(ps(o,s,a+2)).times(.5),Oi(s.d).slice(0,a)===(e=Oi(n.d)).slice(0,a)){if(e=e.slice(a-3,a+1),i==a&&e=="4999"){if(st(s,r+1,0),s.times(s).eq(o)){n=s;break}}else if(e!="9999")break;a+=4}return xt=!0,st(n,r)};ce.times=ce.mul=function(t){var e,r,n,i,s,a,o,l,c,u=this,d=u.constructor,f=u.d,h=(t=new d(t)).d;if(!u.s||!t.s)return new d(0);for(t.s*=u.s,r=u.e+t.e,l=f.length,c=h.length,l<c&&(s=f,f=h,h=s,a=l,l=c,c=a),s=[],a=l+c,n=a;n--;)s.push(0);for(n=c;--n>=0;){for(e=0,i=l+n;i>n;)o=s[i]+h[n]*f[i-n-1]+e,s[i--]=o%rr|0,e=o/rr|0;s[i]=(s[i]+e)%rr|0}for(;!s[--a];)s.pop();return e?++r:s.shift(),t.d=s,t.e=r,xt?st(t,d.precision):t};ce.toDecimalPlaces=ce.todp=function(t,e){var r=this,n=r.constructor;return r=new n(r),t===void 0?r:(Bi(t,0,xu),e===void 0?e=n.rounding:Bi(e,0,8),st(r,t+Ut(r)+1,e))};ce.toExponential=function(t,e){var r,n=this,i=n.constructor;return t===void 0?r=Uo(n,!0):(Bi(t,0,xu),e===void 0?e=i.rounding:Bi(e,0,8),n=st(new i(n),t+1,e),r=Uo(n,!0,t+1)),r};ce.toFixed=function(t,e){var r,n,i=this,s=i.constructor;return t===void 0?Uo(i):(Bi(t,0,xu),e===void 0?e=s.rounding:Bi(e,0,8),n=st(new s(i),t+Ut(i)+1,e),r=Uo(n.abs(),!1,t+Ut(n)+1),i.isneg()&&!i.isZero()?"-"+r:r)};ce.toInteger=ce.toint=function(){var t=this,e=t.constructor;return st(new e(t),Ut(t)+1,e.rounding)};ce.toNumber=function(){return+this};ce.toPower=ce.pow=function(t){var e,r,n,i,s,a,o=this,l=o.constructor,c=12,u=+(t=new l(t));if(!t.s)return new l(cn);if(o=new l(o),!o.s){if(t.s<1)throw Error(Ln+"Infinity");return o}if(o.eq(cn))return o;if(n=l.precision,t.eq(cn))return st(o,n);if(e=t.e,r=t.d.length-1,a=e>=r,s=o.s,a){if((r=u<0?-u:u)<=DB){for(i=new l(cn),e=Math.ceil(n/mt+4),xt=!1;r%2&&(i=i.times(o),mR(i.d,e)),r=wu(r/2),r!==0;)o=o.times(o),mR(o.d,e);return xt=!0,t.s<0?new l(cn).div(i):st(i,n)}}else if(s<0)throw Error(Ln+"NaN");return s=s<0&&t.d[Math.max(e,r)]&1?-1:1,o.s=1,xt=!1,i=t.times(xf(o,n+c)),xt=!0,i=MB(i),i.s=s,i};ce.toPrecision=function(t,e){var r,n,i=this,s=i.constructor;return t===void 0?(r=Ut(i),n=Uo(i,r<=s.toExpNeg||r>=s.toExpPos)):(Bi(t,1,xu),e===void 0?e=s.rounding:Bi(e,0,8),i=st(new s(i),t,e),r=Ut(i),n=Uo(i,t<=r||r<=s.toExpNeg,t)),n};ce.toSignificantDigits=ce.tosd=function(t,e){var r=this,n=r.constructor;return t===void 0?(t=n.precision,e=n.rounding):(Bi(t,1,xu),e===void 0?e=n.rounding:Bi(e,0,8)),st(new n(r),t,e)};ce.toString=ce.valueOf=ce.val=ce.toJSON=ce[Symbol.for("nodejs.util.inspect.custom")]=function(){var t=this,e=Ut(t),r=t.constructor;return Uo(t,e<=r.toExpNeg||e>=r.toExpPos)};function NB(t,e){var r,n,i,s,a,o,l,c,u=t.constructor,d=u.precision;if(!t.s||!e.s)return e.s||(e=new u(t)),xt?st(e,d):e;if(l=t.d,c=e.d,a=t.e,i=e.e,l=l.slice(),s=a-i,s){for(s<0?(n=l,s=-s,o=c.length):(n=c,i=a,o=l.length),a=Math.ceil(d/mt),o=a>o?a+1:o+1,s>o&&(s=o,n.length=1),n.reverse();s--;)n.push(0);n.reverse()}for(o=l.length,s=c.length,o-s<0&&(s=o,n=c,c=l,l=n),r=0;s;)r=(l[--s]=l[s]+c[s]+r)/rr|0,l[s]%=rr;for(r&&(l.unshift(r),++i),o=l.length;l[--o]==0;)l.pop();return e.d=l,e.e=i,xt?st(e,d):e}function Bi(t,e,r){if(t!==~~t||t<e||t>r)throw Error(Po+t)}function Oi(t){var e,r,n,i=t.length-1,s="",a=t[0];if(i>0){for(s+=a,e=1;e<i;e++)n=t[e]+"",r=mt-n.length,r&&(s+=Ys(r)),s+=n;a=t[e],n=a+"",r=mt-n.length,r&&(s+=Ys(r))}else if(a===0)return"0";for(;a%10===0;)a/=10;return s+a}var ps=function(){function t(n,i){var s,a=0,o=n.length;for(n=n.slice();o--;)s=n[o]*i+a,n[o]=s%rr|0,a=s/rr|0;return a&&n.unshift(a),n}function e(n,i,s,a){var o,l;if(s!=a)l=s>a?1:-1;else for(o=l=0;o<s;o++)if(n[o]!=i[o]){l=n[o]>i[o]?1:-1;break}return l}function r(n,i,s){for(var a=0;s--;)n[s]-=a,a=n[s]<i[s]?1:0,n[s]=a*rr+n[s]-i[s];for(;!n[0]&&n.length>1;)n.shift()}return function(n,i,s,a){var o,l,c,u,d,f,h,p,g,m,v,y,b,w,S,T,_,A,P=n.constructor,C=n.s==i.s?1:-1,O=n.d,R=i.d;if(!n.s)return new P(n);if(!i.s)throw Error(Ln+"Division by zero");for(l=n.e-i.e,_=R.length,S=O.length,h=new P(C),p=h.d=[],c=0;R[c]==(O[c]||0);)++c;if(R[c]>(O[c]||0)&&--l,s==null?y=s=P.precision:a?y=s+(Ut(n)-Ut(i))+1:y=s,y<0)return new P(0);if(y=y/mt+2|0,c=0,_==1)for(u=0,R=R[0],y++;(c<S||u)&&y--;c++)b=u*rr+(O[c]||0),p[c]=b/R|0,u=b%R|0;else{for(u=rr/(R[0]+1)|0,u>1&&(R=t(R,u),O=t(O,u),_=R.length,S=O.length),w=_,g=O.slice(0,_),m=g.length;m<_;)g[m++]=0;A=R.slice(),A.unshift(0),T=R[0],R[1]>=rr/2&&++T;do u=0,o=e(R,g,_,m),o<0?(v=g[0],_!=m&&(v=v*rr+(g[1]||0)),u=v/T|0,u>1?(u>=rr&&(u=rr-1),d=t(R,u),f=d.length,m=g.length,o=e(d,g,f,m),o==1&&(u--,r(d,_<f?A:R,f))):(u==0&&(o=u=1),d=R.slice()),f=d.length,f<m&&d.unshift(0),r(g,d,m),o==-1&&(m=g.length,o=e(R,g,_,m),o<1&&(u++,r(g,_<m?A:R,m))),m=g.length):o===0&&(u++,g=[0]),p[c++]=u,o&&g[0]?g[m++]=O[w]||0:(g=[O[w]],m=1);while((w++<S||g[0]!==void 0)&&y--)}return p[0]||p.shift(),h.e=l,st(h,a?s+Ut(h)+1:s)}}();function MB(t,e){var r,n,i,s,a,o,l=0,c=0,u=t.constructor,d=u.precision;if(Ut(t)>16)throw Error(V_+Ut(t));if(!t.s)return new u(cn);for(xt=!1,o=d,a=new u(.03125);t.abs().gte(.1);)t=t.times(a),c+=5;for(n=Math.log(to(2,c))/Math.LN10*2+5|0,o+=n,r=i=s=new u(cn),u.precision=o;;){if(i=st(i.times(t),o),r=r.times(++l),a=s.plus(ps(i,r,o)),Oi(a.d).slice(0,o)===Oi(s.d).slice(0,o)){for(;c--;)s=st(s.times(s),o);return u.precision=d,e==null?(xt=!0,st(s,d)):s}s=a}}function Ut(t){for(var e=t.e*mt,r=t.d[0];r>=10;r/=10)e++;return e}function ub(t,e,r){if(e>t.LN10.sd())throw xt=!0,r&&(t.precision=r),Error(Ln+"LN10 precision limit exceeded");return st(new t(t.LN10),e)}function Ys(t){for(var e="";t--;)e+="0";return e}function xf(t,e){var r,n,i,s,a,o,l,c,u,d=1,f=10,h=t,p=h.d,g=h.constructor,m=g.precision;if(h.s<1)throw Error(Ln+(h.s?"NaN":"-Infinity"));if(h.eq(cn))return new g(0);if(e==null?(xt=!1,c=m):c=e,h.eq(10))return e==null&&(xt=!0),ub(g,c);if(c+=f,g.precision=c,r=Oi(p),n=r.charAt(0),s=Ut(h),Math.abs(s)<15e14){for(;n<7&&n!=1||n==1&&r.charAt(1)>3;)h=h.times(t),r=Oi(h.d),n=r.charAt(0),d++;s=Ut(h),n>1?(h=new g("0."+r),s++):h=new g(n+"."+r.slice(1))}else return l=ub(g,c+2,m).times(s+""),h=xf(new g(n+"."+r.slice(1)),c-f).plus(l),g.precision=m,e==null?(xt=!0,st(h,m)):h;for(o=a=h=ps(h.minus(cn),h.plus(cn),c),u=st(h.times(h),c),i=3;;){if(a=st(a.times(u),c),l=o.plus(ps(a,new g(i),c)),Oi(l.d).slice(0,c)===Oi(o.d).slice(0,c))return o=o.times(2),s!==0&&(o=o.plus(ub(g,c+2,m).times(s+""))),o=ps(o,new g(d),c),g.precision=m,e==null?(xt=!0,st(o,m)):o;o=l,i+=2}}function pR(t,e){var r,n,i;for((r=e.indexOf("."))>-1&&(e=e.replace(".","")),(n=e.search(/e/i))>0?(r<0&&(r=n),r+=+e.slice(n+1),e=e.substring(0,n)):r<0&&(r=e.length),n=0;e.charCodeAt(n)===48;)++n;for(i=e.length;e.charCodeAt(i-1)===48;)--i;if(e=e.slice(n,i),e){if(i-=n,r=r-n-1,t.e=wu(r/mt),t.d=[],n=(r+1)%mt,r<0&&(n+=mt),n<i){for(n&&t.d.push(+e.slice(0,n)),i-=mt;n<i;)t.d.push(+e.slice(n,n+=mt));e=e.slice(n),n=mt-e.length}else n-=i;for(;n--;)e+="0";if(t.d.push(+e),xt&&(t.e>bg||t.e<-bg))throw Error(V_+r)}else t.s=0,t.e=0,t.d=[0];return t}function st(t,e,r){var n,i,s,a,o,l,c,u,d=t.d;for(a=1,s=d[0];s>=10;s/=10)a++;if(n=e-a,n<0)n+=mt,i=e,c=d[u=0];else{if(u=Math.ceil((n+1)/mt),s=d.length,u>=s)return t;for(c=s=d[u],a=1;s>=10;s/=10)a++;n%=mt,i=n-mt+a}if(r!==void 0&&(s=to(10,a-i-1),o=c/s%10|0,l=e<0||d[u+1]!==void 0||c%s,l=r<4?(o||l)&&(r==0||r==(t.s<0?3:2)):o>5||o==5&&(r==4||l||r==6&&(n>0?i>0?c/to(10,a-i):0:d[u-1])%10&1||r==(t.s<0?8:7))),e<1||!d[0])return l?(s=Ut(t),d.length=1,e=e-s-1,d[0]=to(10,(mt-e%mt)%mt),t.e=wu(-e/mt)||0):(d.length=1,d[0]=t.e=t.s=0),t;if(n==0?(d.length=u,s=1,u--):(d.length=u+1,s=to(10,mt-n),d[u]=i>0?(c/to(10,a-i)%to(10,i)|0)*s:0),l)for(;;)if(u==0){(d[0]+=s)==rr&&(d[0]=1,++t.e);break}else{if(d[u]+=s,d[u]!=rr)break;d[u--]=0,s=1}for(n=d.length;d[--n]===0;)d.pop();if(xt&&(t.e>bg||t.e<-bg))throw Error(V_+Ut(t));return t}function $B(t,e){var r,n,i,s,a,o,l,c,u,d,f=t.constructor,h=f.precision;if(!t.s||!e.s)return e.s?e.s=-e.s:e=new f(t),xt?st(e,h):e;if(l=t.d,d=e.d,n=e.e,c=t.e,l=l.slice(),a=c-n,a){for(u=a<0,u?(r=l,a=-a,o=d.length):(r=d,n=c,o=l.length),i=Math.max(Math.ceil(h/mt),o)+2,a>i&&(a=i,r.length=1),r.reverse(),i=a;i--;)r.push(0);r.reverse()}else{for(i=l.length,o=d.length,u=i<o,u&&(o=i),i=0;i<o;i++)if(l[i]!=d[i]){u=l[i]<d[i];break}a=0}for(u&&(r=l,l=d,d=r,e.s=-e.s),o=l.length,i=d.length-o;i>0;--i)l[o++]=0;for(i=d.length;i>a;){if(l[--i]<d[i]){for(s=i;s&&l[--s]===0;)l[s]=rr-1;--l[s],l[i]+=rr}l[i]-=d[i]}for(;l[--o]===0;)l.pop();for(;l[0]===0;l.shift())--n;return l[0]?(e.d=l,e.e=n,xt?st(e,h):e):new f(0)}function Uo(t,e,r){var n,i=Ut(t),s=Oi(t.d),a=s.length;return e?(r&&(n=r-a)>0?s=s.charAt(0)+"."+s.slice(1)+Ys(n):a>1&&(s=s.charAt(0)+"."+s.slice(1)),s=s+(i<0?"e":"e+")+i):i<0?(s="0."+Ys(-i-1)+s,r&&(n=r-a)>0&&(s+=Ys(n))):i>=a?(s+=Ys(i+1-a),r&&(n=r-i-1)>0&&(s=s+"."+Ys(n))):((n=i+1)<a&&(s=s.slice(0,n)+"."+s.slice(n)),r&&(n=r-a)>0&&(i+1===a&&(s+="."),s+=Ys(n))),t.s<0?"-"+s:s}function mR(t,e){if(t.length>e)return t.length=e,!0}function jB(t){var e,r,n;function i(s){var a=this;if(!(a instanceof i))return new i(s);if(a.constructor=i,s instanceof i){a.s=s.s,a.e=s.e,a.d=(s=s.d)?s.slice():s;return}if(typeof s=="number"){if(s*0!==0)throw Error(Po+s);if(s>0)a.s=1;else if(s<0)s=-s,a.s=-1;else{a.s=0,a.e=0,a.d=[0];return}if(s===~~s&&s<1e7){a.e=0,a.d=[s];return}return pR(a,s.toString())}else if(typeof s!="string")throw Error(Po+s);if(s.charCodeAt(0)===45?(s=s.slice(1),a.s=-1):a.s=1,Eve.test(s))pR(a,s);else throw Error(Po+s)}if(i.prototype=ce,i.ROUND_UP=0,i.ROUND_DOWN=1,i.ROUND_CEIL=2,i.ROUND_FLOOR=3,i.ROUND_HALF_UP=4,i.ROUND_HALF_DOWN=5,i.ROUND_HALF_EVEN=6,i.ROUND_HALF_CEIL=7,i.ROUND_HALF_FLOOR=8,i.clone=jB,i.config=i.set=Tve,t===void 0&&(t={}),t)for(n=["precision","rounding","toExpNeg","toExpPos","LN10"],e=0;e<n.length;)t.hasOwnProperty(r=n[e++])||(t[r]=this[r]);return i.config(t),i}function Tve(t){if(!t||typeof t!="object")throw Error(Ln+"Object expected");var e,r,n,i=["precision",1,xu,"rounding",0,8,"toExpNeg",-1/0,0,"toExpPos",0,1/0];for(e=0;e<i.length;e+=3)if((n=t[r=i[e]])!==void 0)if(wu(n)===n&&n>=i[e+1]&&n<=i[e+2])this[r]=n;else throw Error(Po+r+": "+n);if((n=t[r="LN10"])!==void 0)if(n==Math.LN10)this[r]=new this(n);else throw Error(Po+r+": "+n);return this}var H_=jB(Sve);cn=new H_(1);const Ze=H_;function _ve(t){return Cve(t)||Ive(t)||Pve(t)||Ave()}function Ave(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
309In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Pve(t,e){if(t){if(typeof t=="string")return sS(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return sS(t,e)}}function Ive(t){if(typeof Symbol<"u"&&Symbol.iterator in Object(t))return Array.from(t)}function Cve(t){if(Array.isArray(t))return sS(t)}function sS(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var Ove=function(e){return e},FB={},BB=function(e){return e===FB},gR=function(e){return function r(){return arguments.length===0||arguments.length===1&&BB(arguments.length<=0?void 0:arguments[0])?r:e.apply(void 0,arguments)}},Rve=function t(e,r){return e===1?r:gR(function(){for(var n=arguments.length,i=new Array(n),s=0;s<n;s++)i[s]=arguments[s];var a=i.filter(function(o){return o!==FB}).length;return a>=e?r.apply(void 0,i):t(e-a,gR(function(){for(var o=arguments.length,l=new Array(o),c=0;c<o;c++)l[c]=arguments[c];var u=i.map(function(d){return BB(d)?l.shift():d});return r.apply(void 0,_ve(u).concat(l))}))})},dy=function(e){return Rve(e.length,e)},aS=function(e,r){for(var n=[],i=e;i<r;++i)n[i-e]=i;return n},kve=dy(function(t,e){return Array.isArray(e)?e.map(t):Object.keys(e).map(function(r){return e[r]}).map(t)}),Lve=function(){for(var e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];if(!r.length)return Ove;var i=r.reverse(),s=i[0],a=i.slice(1);return function(){return a.reduce(function(o,l){return l(o)},s.apply(void 0,arguments))}},oS=function(e){return Array.isArray(e)?e.reverse():e.split("").reverse.join("")},UB=function(e){var r=null,n=null;return function(){for(var i=arguments.length,s=new Array(i),a=0;a<i;a++)s[a]=arguments[a];return r&&s.every(function(o,l){return o===r[l]})||(r=s,n=e.apply(void 0,s)),n}};function Dve(t){var e;return t===0?e=1:e=Math.floor(new Ze(t).abs().log(10).toNumber())+1,e}function Nve(t,e,r){for(var n=new Ze(t),i=0,s=[];n.lt(e)&&i<1e5;)s.push(n.toNumber()),n=n.add(r),i++;return s}var Mve=dy(function(t,e,r){var n=+t,i=+e;return n+r*(i-n)}),$ve=dy(function(t,e,r){var n=e-+t;return n=n||1/0,(r-t)/n}),jve=dy(function(t,e,r){var n=e-+t;return n=n||1/0,Math.max(0,Math.min(1,(r-t)/n))});const fy={rangeStep:Nve,getDigitCount:Dve,interpolateNumber:Mve,uninterpolateNumber:$ve,uninterpolateTruncation:jve};function lS(t){return Uve(t)||Bve(t)||GB(t)||Fve()}function Fve(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
310In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Bve(t){if(typeof Symbol<"u"&&Symbol.iterator in Object(t))return Array.from(t)}function Uve(t){if(Array.isArray(t))return cS(t)}function wf(t,e){return Vve(t)||Wve(t,e)||GB(t,e)||Gve()}function Gve(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
311In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function GB(t,e){if(t){if(typeof t=="string")return cS(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return cS(t,e)}}function cS(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function Wve(t,e){if(!(typeof Symbol>"u"||!(Symbol.iterator in Object(t)))){var r=[],n=!0,i=!1,s=void 0;try{for(var a=t[Symbol.iterator](),o;!(n=(o=a.next()).done)&&(r.push(o.value),!(e&&r.length===e));n=!0);}catch(l){i=!0,s=l}finally{try{!n&&a.return!=null&&a.return()}finally{if(i)throw s}}return r}}function Vve(t){if(Array.isArray(t))return t}function WB(t){var e=wf(t,2),r=e[0],n=e[1],i=r,s=n;return r>n&&(i=n,s=r),[i,s]}function VB(t,e,r){if(t.lte(0))return new Ze(0);var n=fy.getDigitCount(t.toNumber()),i=new Ze(10).pow(n),s=t.div(i),a=n!==1?.05:.1,o=new Ze(Math.ceil(s.div(a).toNumber())).add(r).mul(a),l=o.mul(i);return e?l:new Ze(Math.ceil(l))}function Hve(t,e,r){var n=1,i=new Ze(t);if(!i.isint()&&r){var s=Math.abs(t);s<1?(n=new Ze(10).pow(fy.getDigitCount(t)-1),i=new Ze(Math.floor(i.div(n).toNumber())).mul(n)):s>1&&(i=new Ze(Math.floor(t)))}else t===0?i=new Ze(Math.floor((e-1)/2)):r||(i=new Ze(Math.floor(t)));var a=Math.floor((e-1)/2),o=Lve(kve(function(l){return i.add(new Ze(l-a).mul(n)).toNumber()}),aS);return o(0,e)}function HB(t,e,r,n){var i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0;if(!Number.isFinite((e-t)/(r-1)))return{step:new Ze(0),tickMin:new Ze(0),tickMax:new Ze(0)};var s=VB(new Ze(e).sub(t).div(r-1),n,i),a;t<=0&&e>=0?a=new Ze(0):(a=new Ze(t).add(e).div(2),a=a.sub(new Ze(a).mod(s)));var o=Math.ceil(a.sub(t).div(s).toNumber()),l=Math.ceil(new Ze(e).sub(a).div(s).toNumber()),c=o+l+1;return c>r?HB(t,e,r,n,i+1):(c<r&&(l=e>0?l+(r-c):l,o=e>0?o:o+(r-c)),{step:s,tickMin:a.sub(new Ze(o).mul(s)),tickMax:a.add(new Ze(l).mul(s))})}function Kve(t){var e=wf(t,2),r=e[0],n=e[1],i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:6,s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,a=Math.max(i,2),o=WB([r,n]),l=wf(o,2),c=l[0],u=l[1];if(c===-1/0||u===1/0){var d=u===1/0?[c].concat(lS(aS(0,i-1).map(function(){return 1/0}))):[].concat(lS(aS(0,i-1).map(function(){return-1/0})),[u]);return r>n?oS(d):d}if(c===u)return Hve(c,i,s);var f=HB(c,u,a,s),h=f.step,p=f.tickMin,g=f.tickMax,m=fy.rangeStep(p,g.add(new Ze(.1).mul(h)),h);return r>n?oS(m):m}function zve(t,e){var r=wf(t,2),n=r[0],i=r[1],s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,a=WB([n,i]),o=wf(a,2),l=o[0],c=o[1];if(l===-1/0||c===1/0)return[n,i];if(l===c)return[l];var u=Math.max(e,2),d=VB(new Ze(c).sub(l).div(u-1),s,0),f=[].concat(lS(fy.rangeStep(new Ze(l),new Ze(c).sub(new Ze(.99).mul(d)),d)),[c]);return n>i?oS(f):f}var qve=UB(Kve),Yve=UB(zve),Xve="Invariant failed";function Go(t,e){throw new Error(Xve)}var Qve=["offset","layout","width","dataKey","data","dataPointFormatter","xAxis","yAxis"];function Dc(t){"@babel/helpers - typeof";return Dc=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Dc(t)}function xg(){return xg=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},xg.apply(this,arguments)}function Jve(t,e){return rye(t)||tye(t,e)||eye(t,e)||Zve()}function Zve(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
312In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function eye(t,e){if(t){if(typeof t=="string")return vR(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return vR(t,e)}}function vR(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function tye(t,e){var r=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r!=null){var n,i,s,a,o=[],l=!0,c=!1;try{if(s=(r=r.call(t)).next,e!==0)for(;!(l=(n=s.call(r)).done)&&(o.push(n.value),o.length!==e);l=!0);}catch(u){c=!0,i=u}finally{try{if(!l&&r.return!=null&&(a=r.return(),Object(a)!==a))return}finally{if(c)throw i}}return o}}function rye(t){if(Array.isArray(t))return t}function nye(t,e){if(t==null)return{};var r=iye(t,e),n,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(i=0;i<s.length;i++)n=s[i],!(e.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function iye(t,e){if(t==null)return{};var r={};for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(e.indexOf(n)>=0)continue;r[n]=t[n]}return r}function sye(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function aye(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,qB(n.key),n)}}function oye(t,e,r){return e&&aye(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function lye(t,e,r){return e=wg(e),cye(t,KB()?Reflect.construct(e,r||[],wg(t).constructor):e.apply(t,r))}function cye(t,e){if(e&&(Dc(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return uye(t)}function uye(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function KB(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(KB=function(){return!!t})()}function wg(t){return wg=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},wg(t)}function dye(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&uS(t,e)}function uS(t,e){return uS=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},uS(t,e)}function zB(t,e,r){return e=qB(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function qB(t){var e=fye(t,"string");return Dc(e)=="symbol"?e:e+""}function fye(t,e){if(Dc(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(Dc(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}var hy=function(t){function e(){return sye(this,e),lye(this,e,arguments)}return dye(e,t),oye(e,[{key:"render",value:function(){var n=this.props,i=n.offset,s=n.layout,a=n.width,o=n.dataKey,l=n.data,c=n.dataPointFormatter,u=n.xAxis,d=n.yAxis,f=nye(n,Qve),h=Ue(f,!1);this.props.direction==="x"&&u.type!=="number"&&Go();var p=l.map(function(g){var m=c(g,o),v=m.x,y=m.y,b=m.value,w=m.errorVal;if(!w)return null;var S=[],T,_;if(Array.isArray(w)){var A=Jve(w,2);T=A[0],_=A[1]}else T=_=w;if(s==="vertical"){var P=u.scale,C=y+i,O=C+a,R=C-a,D=P(b-T),L=P(b+_);S.push({x1:L,y1:O,x2:L,y2:R}),S.push({x1:D,y1:C,x2:L,y2:C}),S.push({x1:D,y1:O,x2:D,y2:R})}else if(s==="horizontal"){var j=d.scale,M=v+i,N=M-a,k=M+a,$=j(b-T),U=j(b+_);S.push({x1:N,y1:U,x2:k,y2:U}),S.push({x1:M,y1:$,x2:M,y2:U}),S.push({x1:N,y1:$,x2:k,y2:$})}return F.createElement(sr,xg({className:"recharts-errorBar",key:"bar-".concat(S.map(function(G){return"".concat(G.x1,"-").concat(G.x2,"-").concat(G.y1,"-").concat(G.y2)}))},h),S.map(function(G){return F.createElement("line",xg({},G,{key:"line-".concat(G.x1,"-").concat(G.x2,"-").concat(G.y1,"-").concat(G.y2)}))}))});return F.createElement(sr,{className:"recharts-errorBars"},p)}}])}(F.Component);zB(hy,"defaultProps",{stroke:"black",strokeWidth:1.5,width:5,offset:0,layout:"horizontal"});zB(hy,"displayName","ErrorBar");function Sf(t){"@babel/helpers - typeof";return Sf=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Sf(t)}function yR(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function qa(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?yR(Object(r),!0).forEach(function(n){hye(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):yR(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function hye(t,e,r){return e=pye(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function pye(t){var e=mye(t,"string");return Sf(e)=="symbol"?e:e+""}function mye(t,e){if(Sf(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(Sf(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var YB=function(e){var r=e.children,n=e.formattedGraphicalItems,i=e.legendWidth,s=e.legendContent,a=rn(r,rc);if(!a)return null;var o=rc.defaultProps,l=o!==void 0?qa(qa({},o),a.props):{},c;return a.props&&a.props.payload?c=a.props&&a.props.payload:s==="children"?c=(n||[]).reduce(function(u,d){var f=d.item,h=d.props,p=h.sectors||h.data||[];return u.concat(p.map(function(g){return{type:a.props.iconType||f.props.legendType,value:g.name,color:g.fill,payload:g}}))},[]):c=(n||[]).map(function(u){var d=u.item,f=d.type.defaultProps,h=f!==void 0?qa(qa({},f),d.props):{},p=h.dataKey,g=h.name,m=h.legendType,v=h.hide;return{inactive:v,dataKey:p,type:l.iconType||m||"square",color:K_(d),value:g||p,payload:h}}),qa(qa(qa({},l),rc.getWithHeight(a,i)),{},{payload:c,item:a})};function Ef(t){"@babel/helpers - typeof";return Ef=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ef(t)}function bR(t){return bye(t)||yye(t)||vye(t)||gye()}function gye(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
313In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function vye(t,e){if(t){if(typeof t=="string")return dS(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return dS(t,e)}}function yye(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function bye(t){if(Array.isArray(t))return dS(t)}function dS(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function xR(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function Rt(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?xR(Object(r),!0).forEach(function(n){ic(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):xR(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function ic(t,e,r){return e=xye(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function xye(t){var e=wye(t,"string");return Ef(e)=="symbol"?e:e+""}function wye(t,e){if(Ef(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(Ef(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Ui(t,e,r){return Fe(t)||Fe(e)?r:Xt(e)?In(t,e,r):De(e)?e(t):r}function xd(t,e,r,n){var i=yve(t,function(o){return Ui(o,e)});if(r==="number"){var s=i.filter(function(o){return ae(o)||parseFloat(o)});return s.length?[uy(s),cy(s)]:[1/0,-1/0]}var a=n?i.filter(function(o){return!Fe(o)}):i;return a.map(function(o){return Xt(o)||o instanceof Date?o:""})}var Sye=function(e){var r,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],i=arguments.length>2?arguments[2]:void 0,s=arguments.length>3?arguments[3]:void 0,a=-1,o=(r=n==null?void 0:n.length)!==null&&r!==void 0?r:0;if(o<=1)return 0;if(s&&s.axisType==="angleAxis"&&Math.abs(Math.abs(s.range[1]-s.range[0])-360)<=1e-6)for(var l=s.range,c=0;c<o;c++){var u=c>0?i[c-1].coordinate:i[o-1].coordinate,d=i[c].coordinate,f=c>=o-1?i[0].coordinate:i[c+1].coordinate,h=void 0;if(si(d-u)!==si(f-d)){var p=[];if(si(f-d)===si(l[1]-l[0])){h=f;var g=d+l[1]-l[0];p[0]=Math.min(g,(g+u)/2),p[1]=Math.max(g,(g+u)/2)}else{h=u;var m=f+l[1]-l[0];p[0]=Math.min(d,(m+d)/2),p[1]=Math.max(d,(m+d)/2)}var v=[Math.min(d,(h+d)/2),Math.max(d,(h+d)/2)];if(e>v[0]&&e<=v[1]||e>=p[0]&&e<=p[1]){a=i[c].index;break}}else{var y=Math.min(u,f),b=Math.max(u,f);if(e>(y+d)/2&&e<=(b+d)/2){a=i[c].index;break}}}else for(var w=0;w<o;w++)if(w===0&&e<=(n[w].coordinate+n[w+1].coordinate)/2||w>0&&w<o-1&&e>(n[w].coordinate+n[w-1].coordinate)/2&&e<=(n[w].coordinate+n[w+1].coordinate)/2||w===o-1&&e>(n[w].coordinate+n[w-1].coordinate)/2){a=n[w].index;break}return a},K_=function(e){var r,n=e,i=n.type.displayName,s=(r=e.type)!==null&&r!==void 0&&r.defaultProps?Rt(Rt({},e.type.defaultProps),e.props):e.props,a=s.stroke,o=s.fill,l;switch(i){case"Line":l=a;break;case"Area":case"Radar":l=a&&a!=="none"?a:o;break;default:l=o;break}return l},Eye=function(e){var r=e.barSize,n=e.totalSize,i=e.stackGroups,s=i===void 0?{}:i;if(!s)return{};for(var a={},o=Object.keys(s),l=0,c=o.length;l<c;l++)for(var u=s[o[l]].stackGroups,d=Object.keys(u),f=0,h=d.length;f<h;f++){var p=u[d[f]],g=p.items,m=p.cateAxisId,v=g.filter(function(_){return hs(_.type).indexOf("Bar")>=0});if(v&&v.length){var y=v[0].type.defaultProps,b=y!==void 0?Rt(Rt({},y),v[0].props):v[0].props,w=b.barSize,S=b[m];a[S]||(a[S]=[]);var T=Fe(w)?r:w;a[S].push({item:v[0],stackList:v.slice(1),barSize:Fe(T)?void 0:Bo(T,n,0)})}}return a},Tye=function(e){var r=e.barGap,n=e.barCategoryGap,i=e.bandSize,s=e.sizeList,a=s===void 0?[]:s,o=e.maxBarSize,l=a.length;if(l<1)return null;var c=Bo(r,i,0,!0),u,d=[];if(a[0].barSize===+a[0].barSize){var f=!1,h=i/l,p=a.reduce(function(w,S){return w+S.barSize||0},0);p+=(l-1)*c,p>=i&&(p-=(l-1)*c,c=0),p>=i&&h>0&&(f=!0,h*=.9,p=l*h);var g=(i-p)/2>>0,m={offset:g-c,size:0};u=a.reduce(function(w,S){var T={item:S.item,position:{offset:m.offset+m.size+c,size:f?h:S.barSize}},_=[].concat(bR(w),[T]);return m=_[_.length-1].position,S.stackList&&S.stackList.length&&S.stackList.forEach(function(A){_.push({item:A,position:m})}),_},d)}else{var v=Bo(n,i,0,!0);i-2*v-(l-1)*c<=0&&(c=0);var y=(i-2*v-(l-1)*c)/l;y>1&&(y>>=0);var b=o===+o?Math.min(y,o):y;u=a.reduce(function(w,S,T){var _=[].concat(bR(w),[{item:S.item,position:{offset:v+(y+c)*T+(y-b)/2,size:b}}]);return S.stackList&&S.stackList.length&&S.stackList.forEach(function(A){_.push({item:A,position:_[_.length-1].position})}),_},d)}return u},_ye=function(e,r,n,i){var s=n.children,a=n.width,o=n.margin,l=a-(o.left||0)-(o.right||0),c=YB({children:s,legendWidth:l});if(c){var u=i||{},d=u.width,f=u.height,h=c.align,p=c.verticalAlign,g=c.layout;if((g==="vertical"||g==="horizontal"&&p==="middle")&&h!=="center"&&ae(e[h]))return Rt(Rt({},e),{},ic({},h,e[h]+(d||0)));if((g==="horizontal"||g==="vertical"&&h==="center")&&p!=="middle"&&ae(e[p]))return Rt(Rt({},e),{},ic({},p,e[p]+(f||0)))}return e},Aye=function(e,r,n){return Fe(r)?!0:e==="horizontal"?r==="yAxis":e==="vertical"||n==="x"?r==="xAxis":n==="y"?r==="yAxis":!0},XB=function(e,r,n,i,s){var a=r.props.children,o=li(a,hy).filter(function(c){return Aye(i,s,c.props.direction)});if(o&&o.length){var l=o.map(function(c){return c.props.dataKey});return e.reduce(function(c,u){var d=Ui(u,n);if(Fe(d))return c;var f=Array.isArray(d)?[uy(d),cy(d)]:[d,d],h=l.reduce(function(p,g){var m=Ui(u,g,0),v=f[0]-Math.abs(Array.isArray(m)?m[0]:m),y=f[1]+Math.abs(Array.isArray(m)?m[1]:m);return[Math.min(v,p[0]),Math.max(y,p[1])]},[1/0,-1/0]);return[Math.min(h[0],c[0]),Math.max(h[1],c[1])]},[1/0,-1/0])}return null},Pye=function(e,r,n,i,s){var a=r.map(function(o){return XB(e,o,n,s,i)}).filter(function(o){return!Fe(o)});return a&&a.length?a.reduce(function(o,l){return[Math.min(o[0],l[0]),Math.max(o[1],l[1])]},[1/0,-1/0]):null},QB=function(e,r,n,i,s){var a=r.map(function(l){var c=l.props.dataKey;return n==="number"&&c&&XB(e,l,c,i)||xd(e,c,n,s)});if(n==="number")return a.reduce(function(l,c){return[Math.min(l[0],c[0]),Math.max(l[1],c[1])]},[1/0,-1/0]);var o={};return a.reduce(function(l,c){for(var u=0,d=c.length;u<d;u++)o[c[u]]||(o[c[u]]=!0,l.push(c[u]));return l},[])},JB=function(e,r){return e==="horizontal"&&r==="xAxis"||e==="vertical"&&r==="yAxis"||e==="centric"&&r==="angleAxis"||e==="radial"&&r==="radiusAxis"},ho=function(e,r,n){if(!e)return null;var i=e.scale,s=e.duplicateDomain,a=e.type,o=e.range,l=e.realScaleType==="scaleBand"?i.bandwidth()/2:2,c=(r||n)&&a==="category"&&i.bandwidth?i.bandwidth()/l:0;if(c=e.axisType==="angleAxis"&&(o==null?void 0:o.length)>=2?si(o[0]-o[1])*2*c:c,r&&(e.ticks||e.niceTicks)){var u=(e.ticks||e.niceTicks).map(function(d){var f=s?s.indexOf(d):d;return{coordinate:i(f)+c,value:d,offset:c}});return u.filter(function(d){return!sh(d.coordinate)})}return e.isCategorical&&e.categoricalDomain?e.categoricalDomain.map(function(d,f){return{coordinate:i(d)+c,value:d,index:f,offset:c}}):i.ticks&&!n?i.ticks(e.tickCount).map(function(d){return{coordinate:i(d)+c,value:d,offset:c}}):i.domain().map(function(d,f){return{coordinate:i(d)+c,value:s?s[d]:d,index:f,offset:c}})},db=new WeakMap,gp=function(e,r){if(typeof r!="function")return e;db.has(e)||db.set(e,new WeakMap);var n=db.get(e);if(n.has(r))return n.get(r);var i=function(){e.apply(void 0,arguments),r.apply(void 0,arguments)};return n.set(r,i),i},Iye=function(e,r,n){var i=e.scale,s=e.type,a=e.layout,o=e.axisType;if(i==="auto")return a==="radial"&&o==="radiusAxis"?{scale:mf(),realScaleType:"band"}:a==="radial"&&o==="angleAxis"?{scale:mg(),realScaleType:"linear"}:s==="category"&&r&&(r.indexOf("LineChart")>=0||r.indexOf("AreaChart")>=0||r.indexOf("ComposedChart")>=0&&!n)?{scale:bd(),realScaleType:"point"}:s==="category"?{scale:mf(),realScaleType:"band"}:{scale:mg(),realScaleType:"linear"};if(Fo(i)){var l="scale".concat(Xv(i));return{scale:(hR[l]||bd)(),realScaleType:hR[l]?l:"point"}}return De(i)?{scale:i}:{scale:bd(),realScaleType:"point"}},wR=1e-4,Cye=function(e){var r=e.domain();if(!(!r||r.length<=2)){var n=r.length,i=e.range(),s=Math.min(i[0],i[1])-wR,a=Math.max(i[0],i[1])+wR,o=e(r[0]),l=e(r[n-1]);(o<s||o>a||l<s||l>a)&&e.domain([r[0],r[n-1]])}},Oye=function(e,r){if(!e)return null;for(var n=0,i=e.length;n<i;n++)if(e[n].item===r)return e[n].position;return null},Rye=function(e,r){if(!r||r.length!==2||!ae(r[0])||!ae(r[1]))return e;var n=Math.min(r[0],r[1]),i=Math.max(r[0],r[1]),s=[e[0],e[1]];return(!ae(e[0])||e[0]<n)&&(s[0]=n),(!ae(e[1])||e[1]>i)&&(s[1]=i),s[0]>i&&(s[0]=i),s[1]<n&&(s[1]=n),s},kye=function(e){var r=e.length;if(!(r<=0))for(var n=0,i=e[0].length;n<i;++n)for(var s=0,a=0,o=0;o<r;++o){var l=sh(e[o][n][1])?e[o][n][0]:e[o][n][1];l>=0?(e[o][n][0]=s,e[o][n][1]=s+l,s=e[o][n][1]):(e[o][n][0]=a,e[o][n][1]=a+l,a=e[o][n][1])}},Lye=function(e){var r=e.length;if(!(r<=0))for(var n=0,i=e[0].length;n<i;++n)for(var s=0,a=0;a<r;++a){var o=sh(e[a][n][1])?e[a][n][0]:e[a][n][1];o>=0?(e[a][n][0]=s,e[a][n][1]=s+o,s=e[a][n][1]):(e[a][n][0]=0,e[a][n][1]=0)}},Dye={sign:kye,expand:qie,none:Ac,silhouette:Yie,wiggle:Xie,positive:Lye},Nye=function(e,r,n){var i=r.map(function(o){return o.props.dataKey}),s=Dye[n],a=zie().keys(i).value(function(o,l){return+Ui(o,l,0)}).order(Mw).offset(s);return a(e)},Mye=function(e,r,n,i,s,a){if(!e)return null;var o=a?r.reverse():r,l={},c=o.reduce(function(d,f){var h,p=(h=f.type)!==null&&h!==void 0&&h.defaultProps?Rt(Rt({},f.type.defaultProps),f.props):f.props,g=p.stackId,m=p.hide;if(m)return d;var v=p[n],y=d[v]||{hasStack:!1,stackGroups:{}};if(Xt(g)){var b=y.stackGroups[g]||{numericAxisId:n,cateAxisId:i,items:[]};b.items.push(f),y.hasStack=!0,y.stackGroups[g]=b}else y.stackGroups[Yv("_stackId_")]={numericAxisId:n,cateAxisId:i,items:[f]};return Rt(Rt({},d),{},ic({},v,y))},l),u={};return Object.keys(c).reduce(function(d,f){var h=c[f];if(h.hasStack){var p={};h.stackGroups=Object.keys(h.stackGroups).reduce(function(g,m){var v=h.stackGroups[m];return Rt(Rt({},g),{},ic({},m,{numericAxisId:n,cateAxisId:i,items:v.items,stackedData:Nye(e,v.items,s)}))},p)}return Rt(Rt({},d),{},ic({},f,h))},u)},$ye=function(e,r){var n=r.realScaleType,i=r.type,s=r.tickCount,a=r.originalDomain,o=r.allowDecimals,l=n||r.scale;if(l!=="auto"&&l!=="linear")return null;if(s&&i==="number"&&a&&(a[0]==="auto"||a[1]==="auto")){var c=e.domain();if(!c.length)return null;var u=qve(c,s,o);return e.domain([uy(u),cy(u)]),{niceTicks:u}}if(s&&i==="number"){var d=e.domain(),f=Yve(d,s,o);return{niceTicks:f}}return null},SR=function(e){var r=e.axis,n=e.ticks,i=e.offset,s=e.bandSize,a=e.entry,o=e.index;if(r.type==="category")return n[o]?n[o].coordinate+i:null;var l=Ui(a,r.dataKey,r.domain[o]);return Fe(l)?null:r.scale(l)-s/2+i},jye=function(e){var r=e.numericAxis,n=r.scale.domain();if(r.type==="number"){var i=Math.min(n[0],n[1]),s=Math.max(n[0],n[1]);return i<=0&&s>=0?0:s<0?s:i}return n[0]},Fye=function(e,r){var n,i=(n=e.type)!==null&&n!==void 0&&n.defaultProps?Rt(Rt({},e.type.defaultProps),e.props):e.props,s=i.stackId;if(Xt(s)){var a=r[s];if(a){var o=a.items.indexOf(e);return o>=0?a.stackedData[o]:null}}return null},Bye=function(e){return e.reduce(function(r,n){return[uy(n.concat([r[0]]).filter(ae)),cy(n.concat([r[1]]).filter(ae))]},[1/0,-1/0])},ZB=function(e,r,n){return Object.keys(e).reduce(function(i,s){var a=e[s],o=a.stackedData,l=o.reduce(function(c,u){var d=Bye(u.slice(r,n+1));return[Math.min(c[0],d[0]),Math.max(c[1],d[1])]},[1/0,-1/0]);return[Math.min(l[0],i[0]),Math.max(l[1],i[1])]},[1/0,-1/0]).map(function(i){return i===1/0||i===-1/0?0:i})},ER=/^dataMin[\s]*-[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,TR=/^dataMax[\s]*\+[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,fS=function(e,r,n){if(De(e))return e(r,n);if(!Array.isArray(e))return r;var i=[];if(ae(e[0]))i[0]=n?e[0]:Math.min(e[0],r[0]);else if(ER.test(e[0])){var s=+ER.exec(e[0])[1];i[0]=r[0]-s}else De(e[0])?i[0]=e[0](r[0]):i[0]=r[0];if(ae(e[1]))i[1]=n?e[1]:Math.max(e[1],r[1]);else if(TR.test(e[1])){var a=+TR.exec(e[1])[1];i[1]=r[1]+a}else De(e[1])?i[1]=e[1](r[1]):i[1]=r[1];return i},Sg=function(e,r,n){if(e&&e.scale&&e.scale.bandwidth){var i=e.scale.bandwidth();if(!n||i>0)return i}if(e&&r&&r.length>=2){for(var s=b_(r,function(d){return d.coordinate}),a=1/0,o=1,l=s.length;o<l;o++){var c=s[o],u=s[o-1];a=Math.min((c.coordinate||0)-(u.coordinate||0),a)}return a===1/0?0:a}return n?void 0:0},_R=function(e,r,n){return!e||!e.length||W_(e,In(n,"type.defaultProps.domain"))?r:e},eU=function(e,r){var n=e.type.defaultProps?Rt(Rt({},e.type.defaultProps),e.props):e.props,i=n.dataKey,s=n.name,a=n.unit,o=n.formatter,l=n.tooltipType,c=n.chartType,u=n.hide;return Rt(Rt({},Ue(e,!1)),{},{dataKey:i,unit:a,formatter:o,name:s||i,color:K_(e),value:Ui(r,i),type:l,payload:r,chartType:c,hide:u})};function Tf(t){"@babel/helpers - typeof";return Tf=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Tf(t)}function AR(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function PR(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?AR(Object(r),!0).forEach(function(n){Uye(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):AR(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function Uye(t,e,r){return e=Gye(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Gye(t){var e=Wye(t,"string");return Tf(e)=="symbol"?e:e+""}function Wye(t,e){if(Tf(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(Tf(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Eg=Math.PI/180,Vye=function(e){return e*180/Math.PI},gr=function(e,r,n,i){return{x:e+Math.cos(-Eg*i)*n,y:r+Math.sin(-Eg*i)*n}},Hye=function(e,r){var n=e.x,i=e.y,s=r.x,a=r.y;return Math.sqrt(Math.pow(n-s,2)+Math.pow(i-a,2))},Kye=function(e,r){var n=e.x,i=e.y,s=r.cx,a=r.cy,o=Hye({x:n,y:i},{x:s,y:a});if(o<=0)return{radius:o};var l=(n-s)/o,c=Math.acos(l);return i>a&&(c=2*Math.PI-c),{radius:o,angle:Vye(c),angleInRadian:c}},zye=function(e){var r=e.startAngle,n=e.endAngle,i=Math.floor(r/360),s=Math.floor(n/360),a=Math.min(i,s);return{startAngle:r-a*360,endAngle:n-a*360}},qye=function(e,r){var n=r.startAngle,i=r.endAngle,s=Math.floor(n/360),a=Math.floor(i/360),o=Math.min(s,a);return e+o*360},IR=function(e,r){var n=e.x,i=e.y,s=Kye({x:n,y:i},r),a=s.radius,o=s.angle,l=r.innerRadius,c=r.outerRadius;if(a<l||a>c)return!1;if(a===0)return!0;var u=zye(r),d=u.startAngle,f=u.endAngle,h=o,p;if(d<=f){for(;h>f;)h-=360;for(;h<d;)h+=360;p=h>=d&&h<=f}else{for(;h>d;)h-=360;for(;h<f;)h+=360;p=h>=f&&h<=d}return p?PR(PR({},r),{},{radius:a,angle:qye(h,r)}):null};function _f(t){"@babel/helpers - typeof";return _f=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_f(t)}var Yye=["offset"];function Xye(t){return e0e(t)||Zye(t)||Jye(t)||Qye()}function Qye(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
314In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Jye(t,e){if(t){if(typeof t=="string")return hS(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return hS(t,e)}}function Zye(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function e0e(t){if(Array.isArray(t))return hS(t)}function hS(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function t0e(t,e){if(t==null)return{};var r=r0e(t,e),n,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(i=0;i<s.length;i++)n=s[i],!(e.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function r0e(t,e){if(t==null)return{};var r={};for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(e.indexOf(n)>=0)continue;r[n]=t[n]}return r}function CR(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function Vt(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?CR(Object(r),!0).forEach(function(n){n0e(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):CR(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function n0e(t,e,r){return e=i0e(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function i0e(t){var e=s0e(t,"string");return _f(e)=="symbol"?e:e+""}function s0e(t,e){if(_f(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(_f(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Af(){return Af=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},Af.apply(this,arguments)}var a0e=function(e){var r=e.value,n=e.formatter,i=Fe(e.children)?r:e.children;return De(n)?n(i):i},o0e=function(e,r){var n=si(r-e),i=Math.min(Math.abs(r-e),360);return n*i},l0e=function(e,r,n){var i=e.position,s=e.viewBox,a=e.offset,o=e.className,l=s,c=l.cx,u=l.cy,d=l.innerRadius,f=l.outerRadius,h=l.startAngle,p=l.endAngle,g=l.clockWise,m=(d+f)/2,v=o0e(h,p),y=v>=0?1:-1,b,w;i==="insideStart"?(b=h+y*a,w=g):i==="insideEnd"?(b=p-y*a,w=!g):i==="end"&&(b=p+y*a,w=g),w=v<=0?w:!w;var S=gr(c,u,m,b),T=gr(c,u,m,b+(w?1:-1)*359),_="M".concat(S.x,",").concat(S.y,`
315    A`).concat(m,",").concat(m,",0,1,").concat(w?0:1,`,
316    `).concat(T.x,",").concat(T.y),A=Fe(e.id)?Yv("recharts-radial-line-"):e.id;return F.createElement("text",Af({},n,{dominantBaseline:"central",className:Me("recharts-radial-bar-label",o)}),F.createElement("defs",null,F.createElement("path",{id:A,d:_})),F.createElement("textPath",{xlinkHref:"#".concat(A)},r))},c0e=function(e){var r=e.viewBox,n=e.offset,i=e.position,s=r,a=s.cx,o=s.cy,l=s.innerRadius,c=s.outerRadius,u=s.startAngle,d=s.endAngle,f=(u+d)/2;if(i==="outside"){var h=gr(a,o,c+n,f),p=h.x,g=h.y;return{x:p,y:g,textAnchor:p>=a?"start":"end",verticalAnchor:"middle"}}if(i==="center")return{x:a,y:o,textAnchor:"middle",verticalAnchor:"middle"};if(i==="centerTop")return{x:a,y:o,textAnchor:"middle",verticalAnchor:"start"};if(i==="centerBottom")return{x:a,y:o,textAnchor:"middle",verticalAnchor:"end"};var m=(l+c)/2,v=gr(a,o,m,f),y=v.x,b=v.y;return{x:y,y:b,textAnchor:"middle",verticalAnchor:"middle"}},u0e=function(e){var r=e.viewBox,n=e.parentViewBox,i=e.offset,s=e.position,a=r,o=a.x,l=a.y,c=a.width,u=a.height,d=u>=0?1:-1,f=d*i,h=d>0?"end":"start",p=d>0?"start":"end",g=c>=0?1:-1,m=g*i,v=g>0?"end":"start",y=g>0?"start":"end";if(s==="top"){var b={x:o+c/2,y:l-d*i,textAnchor:"middle",verticalAnchor:h};return Vt(Vt({},b),n?{height:Math.max(l-n.y,0),width:c}:{})}if(s==="bottom"){var w={x:o+c/2,y:l+u+f,textAnchor:"middle",verticalAnchor:p};return Vt(Vt({},w),n?{height:Math.max(n.y+n.height-(l+u),0),width:c}:{})}if(s==="left"){var S={x:o-m,y:l+u/2,textAnchor:v,verticalAnchor:"middle"};return Vt(Vt({},S),n?{width:Math.max(S.x-n.x,0),height:u}:{})}if(s==="right"){var T={x:o+c+m,y:l+u/2,textAnchor:y,verticalAnchor:"middle"};return Vt(Vt({},T),n?{width:Math.max(n.x+n.width-T.x,0),height:u}:{})}var _=n?{width:c,height:u}:{};return s==="insideLeft"?Vt({x:o+m,y:l+u/2,textAnchor:y,verticalAnchor:"middle"},_):s==="insideRight"?Vt({x:o+c-m,y:l+u/2,textAnchor:v,verticalAnchor:"middle"},_):s==="insideTop"?Vt({x:o+c/2,y:l+f,textAnchor:"middle",verticalAnchor:p},_):s==="insideBottom"?Vt({x:o+c/2,y:l+u-f,textAnchor:"middle",verticalAnchor:h},_):s==="insideTopLeft"?Vt({x:o+m,y:l+f,textAnchor:y,verticalAnchor:p},_):s==="insideTopRight"?Vt({x:o+c-m,y:l+f,textAnchor:v,verticalAnchor:p},_):s==="insideBottomLeft"?Vt({x:o+m,y:l+u-f,textAnchor:y,verticalAnchor:h},_):s==="insideBottomRight"?Vt({x:o+c-m,y:l+u-f,textAnchor:v,verticalAnchor:h},_):du(s)&&(ae(s.x)||co(s.x))&&(ae(s.y)||co(s.y))?Vt({x:o+Bo(s.x,c),y:l+Bo(s.y,u),textAnchor:"end",verticalAnchor:"end"},_):Vt({x:o+c/2,y:l+u/2,textAnchor:"middle",verticalAnchor:"middle"},_)},d0e=function(e){return"cx"in e&&ae(e.cx)};function Ar(t){var e=t.offset,r=e===void 0?5:e,n=t0e(t,Yye),i=Vt({offset:r},n),s=i.viewBox,a=i.position,o=i.value,l=i.children,c=i.content,u=i.className,d=u===void 0?"":u,f=i.textBreakAll;if(!s||Fe(o)&&Fe(l)&&!E.isValidElement(c)&&!De(c))return null;if(E.isValidElement(c))return E.cloneElement(c,i);var h;if(De(c)){if(h=E.createElement(c,i),E.isValidElement(h))return h}else h=a0e(i);var p=d0e(s),g=Ue(i,!0);if(p&&(a==="insideStart"||a==="insideEnd"||a==="end"))return l0e(i,h,g);var m=p?c0e(i):u0e(i);return F.createElement(og,Af({className:Me("recharts-label",d)},g,m,{breakAll:f}),h)}Ar.displayName="Label";var tU=function(e){var r=e.cx,n=e.cy,i=e.angle,s=e.startAngle,a=e.endAngle,o=e.r,l=e.radius,c=e.innerRadius,u=e.outerRadius,d=e.x,f=e.y,h=e.top,p=e.left,g=e.width,m=e.height,v=e.clockWise,y=e.labelViewBox;if(y)return y;if(ae(g)&&ae(m)){if(ae(d)&&ae(f))return{x:d,y:f,width:g,height:m};if(ae(h)&&ae(p))return{x:h,y:p,width:g,height:m}}return ae(d)&&ae(f)?{x:d,y:f,width:0,height:0}:ae(r)&&ae(n)?{cx:r,cy:n,startAngle:s||i||0,endAngle:a||i||0,innerRadius:c||0,outerRadius:u||l||o||0,clockWise:v}:e.viewBox?e.viewBox:{}},f0e=function(e,r){return e?e===!0?F.createElement(Ar,{key:"label-implicit",viewBox:r}):Xt(e)?F.createElement(Ar,{key:"label-implicit",viewBox:r,value:e}):E.isValidElement(e)?e.type===Ar?E.cloneElement(e,{key:"label-implicit",viewBox:r}):F.createElement(Ar,{key:"label-implicit",content:e,viewBox:r}):De(e)?F.createElement(Ar,{key:"label-implicit",content:e,viewBox:r}):du(e)?F.createElement(Ar,Af({viewBox:r},e,{key:"label-implicit"})):null:null},h0e=function(e,r){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(!e||!e.children&&n&&!e.label)return null;var i=e.children,s=tU(e),a=li(i,Ar).map(function(l,c){return E.cloneElement(l,{viewBox:r||s,key:"label-".concat(c)})});if(!n)return a;var o=f0e(e.label,r||s);return[o].concat(Xye(a))};Ar.parseViewBox=tU;Ar.renderCallByParent=h0e;function p0e(t){var e=t==null?0:t.length;return e?t[e-1]:void 0}var m0e=p0e;const g0e=at(m0e);function Pf(t){"@babel/helpers - typeof";return Pf=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Pf(t)}var v0e=["valueAccessor"],y0e=["data","dataKey","clockWise","id","textBreakAll"];function b0e(t){return E0e(t)||S0e(t)||w0e(t)||x0e()}function x0e(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
317In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function w0e(t,e){if(t){if(typeof t=="string")return pS(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return pS(t,e)}}function S0e(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function E0e(t){if(Array.isArray(t))return pS(t)}function pS(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function Tg(){return Tg=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},Tg.apply(this,arguments)}function OR(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function RR(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?OR(Object(r),!0).forEach(function(n){T0e(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):OR(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function T0e(t,e,r){return e=_0e(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function _0e(t){var e=A0e(t,"string");return Pf(e)=="symbol"?e:e+""}function A0e(t,e){if(Pf(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(Pf(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function kR(t,e){if(t==null)return{};var r=P0e(t,e),n,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(i=0;i<s.length;i++)n=s[i],!(e.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function P0e(t,e){if(t==null)return{};var r={};for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(e.indexOf(n)>=0)continue;r[n]=t[n]}return r}var I0e=function(e){return Array.isArray(e.value)?g0e(e.value):e.value};function Io(t){var e=t.valueAccessor,r=e===void 0?I0e:e,n=kR(t,v0e),i=n.data,s=n.dataKey,a=n.clockWise,o=n.id,l=n.textBreakAll,c=kR(n,y0e);return!i||!i.length?null:F.createElement(sr,{className:"recharts-label-list"},i.map(function(u,d){var f=Fe(s)?r(u,d):Ui(u&&u.payload,s),h=Fe(o)?{}:{id:"".concat(o,"-").concat(d)};return F.createElement(Ar,Tg({},Ue(u,!0),c,h,{parentViewBox:u.parentViewBox,value:f,textBreakAll:l,viewBox:Ar.parseViewBox(Fe(a)?u:RR(RR({},u),{},{clockWise:a})),key:"label-".concat(d),index:d}))}))}Io.displayName="LabelList";function C0e(t,e){return t?t===!0?F.createElement(Io,{key:"labelList-implicit",data:e}):F.isValidElement(t)||De(t)?F.createElement(Io,{key:"labelList-implicit",data:e,content:t}):du(t)?F.createElement(Io,Tg({data:e},t,{key:"labelList-implicit"})):null:null}function O0e(t,e){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(!t||!t.children&&r&&!t.label)return null;var n=t.children,i=li(n,Io).map(function(a,o){return E.cloneElement(a,{data:e,key:"labelList-".concat(o)})});if(!r)return i;var s=C0e(t.label,e);return[s].concat(b0e(i))}Io.renderCallByParent=O0e;function If(t){"@babel/helpers - typeof";return If=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},If(t)}function mS(){return mS=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},mS.apply(this,arguments)}function LR(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function DR(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?LR(Object(r),!0).forEach(function(n){R0e(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):LR(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function R0e(t,e,r){return e=k0e(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function k0e(t){var e=L0e(t,"string");return If(e)=="symbol"?e:e+""}function L0e(t,e){if(If(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(If(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var D0e=function(e,r){var n=si(r-e),i=Math.min(Math.abs(r-e),359.999);return n*i},vp=function(e){var r=e.cx,n=e.cy,i=e.radius,s=e.angle,a=e.sign,o=e.isExternal,l=e.cornerRadius,c=e.cornerIsExternal,u=l*(o?1:-1)+i,d=Math.asin(l/u)/Eg,f=c?s:s+a*d,h=gr(r,n,u,f),p=gr(r,n,i,f),g=c?s-a*d:s,m=gr(r,n,u*Math.cos(d*Eg),g);return{center:h,circleTangency:p,lineTangency:m,theta:d}},rU=function(e){var r=e.cx,n=e.cy,i=e.innerRadius,s=e.outerRadius,a=e.startAngle,o=e.endAngle,l=D0e(a,o),c=a+l,u=gr(r,n,s,a),d=gr(r,n,s,c),f="M ".concat(u.x,",").concat(u.y,`
318    A `).concat(s,",").concat(s,`,0,
319    `).concat(+(Math.abs(l)>180),",").concat(+(a>c),`,
320    `).concat(d.x,",").concat(d.y,`
321  `);if(i>0){var h=gr(r,n,i,a),p=gr(r,n,i,c);f+="L ".concat(p.x,",").concat(p.y,`
322            A `).concat(i,",").concat(i,`,0,
323            `).concat(+(Math.abs(l)>180),",").concat(+(a<=c),`,
324            `).concat(h.x,",").concat(h.y," Z")}else f+="L ".concat(r,",").concat(n," Z");return f},N0e=function(e){var r=e.cx,n=e.cy,i=e.innerRadius,s=e.outerRadius,a=e.cornerRadius,o=e.forceCornerRadius,l=e.cornerIsExternal,c=e.startAngle,u=e.endAngle,d=si(u-c),f=vp({cx:r,cy:n,radius:s,angle:c,sign:d,cornerRadius:a,cornerIsExternal:l}),h=f.circleTangency,p=f.lineTangency,g=f.theta,m=vp({cx:r,cy:n,radius:s,angle:u,sign:-d,cornerRadius:a,cornerIsExternal:l}),v=m.circleTangency,y=m.lineTangency,b=m.theta,w=l?Math.abs(c-u):Math.abs(c-u)-g-b;if(w<0)return o?"M ".concat(p.x,",").concat(p.y,`
325        a`).concat(a,",").concat(a,",0,0,1,").concat(a*2,`,0
326        a`).concat(a,",").concat(a,",0,0,1,").concat(-a*2,`,0
327      `):rU({cx:r,cy:n,innerRadius:i,outerRadius:s,startAngle:c,endAngle:u});var S="M ".concat(p.x,",").concat(p.y,`
328    A`).concat(a,",").concat(a,",0,0,").concat(+(d<0),",").concat(h.x,",").concat(h.y,`
329    A`).concat(s,",").concat(s,",0,").concat(+(w>180),",").concat(+(d<0),",").concat(v.x,",").concat(v.y,`
330    A`).concat(a,",").concat(a,",0,0,").concat(+(d<0),",").concat(y.x,",").concat(y.y,`
331  `);if(i>0){var T=vp({cx:r,cy:n,radius:i,angle:c,sign:d,isExternal:!0,cornerRadius:a,cornerIsExternal:l}),_=T.circleTangency,A=T.lineTangency,P=T.theta,C=vp({cx:r,cy:n,radius:i,angle:u,sign:-d,isExternal:!0,cornerRadius:a,cornerIsExternal:l}),O=C.circleTangency,R=C.lineTangency,D=C.theta,L=l?Math.abs(c-u):Math.abs(c-u)-P-D;if(L<0&&a===0)return"".concat(S,"L").concat(r,",").concat(n,"Z");S+="L".concat(R.x,",").concat(R.y,`
332      A`).concat(a,",").concat(a,",0,0,").concat(+(d<0),",").concat(O.x,",").concat(O.y,`
333      A`).concat(i,",").concat(i,",0,").concat(+(L>180),",").concat(+(d>0),",").concat(_.x,",").concat(_.y,`
334      A`).concat(a,",").concat(a,",0,0,").concat(+(d<0),",").concat(A.x,",").concat(A.y,"Z")}else S+="L".concat(r,",").concat(n,"Z");return S},M0e={cx:0,cy:0,innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,cornerRadius:0,forceCornerRadius:!1,cornerIsExternal:!1},nU=function(e){var r=DR(DR({},M0e),e),n=r.cx,i=r.cy,s=r.innerRadius,a=r.outerRadius,o=r.cornerRadius,l=r.forceCornerRadius,c=r.cornerIsExternal,u=r.startAngle,d=r.endAngle,f=r.className;if(a<s||u===d)return null;var h=Me("recharts-sector",f),p=a-s,g=Bo(o,p,0,!0),m;return g>0&&Math.abs(u-d)<360?m=N0e({cx:n,cy:i,innerRadius:s,outerRadius:a,cornerRadius:Math.min(g,p/2),forceCornerRadius:l,cornerIsExternal:c,startAngle:u,endAngle:d}):m=rU({cx:n,cy:i,innerRadius:s,outerRadius:a,startAngle:u,endAngle:d}),F.createElement("path",mS({},Ue(r,!0),{className:h,d:m,role:"img"}))};function Cf(t){"@babel/helpers - typeof";return Cf=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Cf(t)}function gS(){return gS=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},gS.apply(this,arguments)}function NR(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function MR(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?NR(Object(r),!0).forEach(function(n){$0e(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):NR(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function $0e(t,e,r){return e=j0e(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function j0e(t){var e=F0e(t,"string");return Cf(e)=="symbol"?e:e+""}function F0e(t,e){if(Cf(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(Cf(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var $R={curveBasisClosed:Mie,curveBasisOpen:$ie,curveBasis:Nie,curveBumpX:wie,curveBumpY:Sie,curveLinearClosed:jie,curveLinear:Jv,curveMonotoneX:Fie,curveMonotoneY:Bie,curveNatural:Uie,curveStep:Gie,curveStepAfter:Vie,curveStepBefore:Wie},yp=function(e){return e.x===+e.x&&e.y===+e.y},Uu=function(e){return e.x},Gu=function(e){return e.y},B0e=function(e,r){if(De(e))return e;var n="curve".concat(Xv(e));return(n==="curveMonotone"||n==="curveBump")&&r?$R["".concat(n).concat(r==="vertical"?"Y":"X")]:$R[n]||Jv},U0e=function(e){var r=e.type,n=r===void 0?"linear":r,i=e.points,s=i===void 0?[]:i,a=e.baseLine,o=e.layout,l=e.connectNulls,c=l===void 0?!1:l,u=B0e(n,o),d=c?s.filter(function(g){return yp(g)}):s,f;if(Array.isArray(a)){var h=c?a.filter(function(g){return yp(g)}):a,p=d.map(function(g,m){return MR(MR({},g),{},{base:h[m]})});return o==="vertical"?f=lp().y(Gu).x1(Uu).x0(function(g){return g.base.x}):f=lp().x(Uu).y1(Gu).y0(function(g){return g.base.y}),f.defined(yp).curve(u),f(p)}return o==="vertical"&&ae(a)?f=lp().y(Gu).x1(Uu).x0(a):ae(a)?f=lp().x(Uu).y1(Gu).y0(a):f=oF().x(Uu).y(Gu),f.defined(yp).curve(u),f(d)},jR=function(e){var r=e.className,n=e.points,i=e.path,s=e.pathRef;if((!n||!n.length)&&!i)return null;var a=n&&n.length?U0e(e):i;return E.createElement("path",gS({},Ue(e,!1),Km(e),{className:Me("recharts-curve",r),d:a,ref:s}))},iU={exports:{}},G0e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",W0e=G0e,V0e=W0e;function sU(){}function aU(){}aU.resetWarningCache=sU;var H0e=function(){function t(n,i,s,a,o,l){if(l!==V0e){var c=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw c.name="Invariant Violation",c}}t.isRequired=t;function e(){return t}var r={array:t,bigint:t,bool:t,func:t,number:t,object:t,string:t,symbol:t,any:t,arrayOf:e,element:t,elementType:t,instanceOf:e,node:t,objectOf:e,oneOf:e,oneOfType:e,shape:e,exact:e,checkPropTypes:aU,resetWarningCache:sU};return r.PropTypes=r,r};iU.exports=H0e();var K0e=iU.exports;const Be=at(K0e),{getOwnPropertyNames:z0e,getOwnPropertySymbols:q0e}=Object,{hasOwnProperty:Y0e}=Object.prototype;function fb(t,e){return function(n,i,s){return t(n,i,s)&&e(n,i,s)}}function bp(t){return function(r,n,i){if(!r||!n||typeof r!="object"||typeof n!="object")return t(r,n,i);const{cache:s}=i,a=s.get(r),o=s.get(n);if(a&&o)return a===n&&o===r;s.set(r,n),s.set(n,r);const l=t(r,n,i);return s.delete(r),s.delete(n),l}}function X0e(t){return t!=null?t[Symbol.toStringTag]:void 0}function FR(t){return z0e(t).concat(q0e(t))}const Q0e=Object.hasOwn||((t,e)=>Y0e.call(t,e));function Jo(t,e){return t===e||!t&&!e&&t!==t&&e!==e}const J0e="__v",Z0e="__o",ebe="_owner",{getOwnPropertyDescriptor:BR,keys:UR}=Object;function tbe(t,e){return t.byteLength===e.byteLength&&_g(new Uint8Array(t),new Uint8Array(e))}function rbe(t,e,r){let n=t.length;if(e.length!==n)return!1;for(;n-- >0;)if(!r.equals(t[n],e[n],n,n,t,e,r))return!1;return!0}function nbe(t,e){return t.byteLength===e.byteLength&&_g(new Uint8Array(t.buffer,t.byteOffset,t.byteLength),new Uint8Array(e.buffer,e.byteOffset,e.byteLength))}function ibe(t,e){return Jo(t.getTime(),e.getTime())}function sbe(t,e){return t.name===e.name&&t.message===e.message&&t.cause===e.cause&&t.stack===e.stack}function abe(t,e){return t===e}function GR(t,e,r){const n=t.size;if(n!==e.size)return!1;if(!n)return!0;const i=new Array(n),s=t.entries();let a,o,l=0;for(;(a=s.next())&&!a.done;){const c=e.entries();let u=!1,d=0;for(;(o=c.next())&&!o.done;){if(i[d]){d++;continue}const f=a.value,h=o.value;if(r.equals(f[0],h[0],l,d,t,e,r)&&r.equals(f[1],h[1],f[0],h[0],t,e,r)){u=i[d]=!0;break}d++}if(!u)return!1;l++}return!0}const obe=Jo;function lbe(t,e,r){const n=UR(t);let i=n.length;if(UR(e).length!==i)return!1;for(;i-- >0;)if(!oU(t,e,r,n[i]))return!1;return!0}function Wu(t,e,r){const n=FR(t);let i=n.length;if(FR(e).length!==i)return!1;let s,a,o;for(;i-- >0;)if(s=n[i],!oU(t,e,r,s)||(a=BR(t,s),o=BR(e,s),(a||o)&&(!a||!o||a.configurable!==o.configurable||a.enumerable!==o.enumerable||a.writable!==o.writable)))return!1;return!0}function cbe(t,e){return Jo(t.valueOf(),e.valueOf())}function ube(t,e){return t.source===e.source&&t.flags===e.flags}function WR(t,e,r){const n=t.size;if(n!==e.size)return!1;if(!n)return!0;const i=new Array(n),s=t.values();let a,o;for(;(a=s.next())&&!a.done;){const l=e.values();let c=!1,u=0;for(;(o=l.next())&&!o.done;){if(!i[u]&&r.equals(a.value,o.value,a.value,o.value,t,e,r)){c=i[u]=!0;break}u++}if(!c)return!1}return!0}function _g(t,e){let r=t.byteLength;if(e.byteLength!==r||t.byteOffset!==e.byteOffset)return!1;for(;r-- >0;)if(t[r]!==e[r])return!1;return!0}function dbe(t,e){return t.hostname===e.hostname&&t.pathname===e.pathname&&t.protocol===e.protocol&&t.port===e.port&&t.hash===e.hash&&t.username===e.username&&t.password===e.password}function oU(t,e,r,n){return(n===ebe||n===Z0e||n===J0e)&&(t.$$typeof||e.$$typeof)?!0:Q0e(e,n)&&r.equals(t[n],e[n],n,n,t,e,r)}const fbe="[object ArrayBuffer]",hbe="[object Arguments]",pbe="[object Boolean]",mbe="[object DataView]",gbe="[object Date]",vbe="[object Error]",ybe="[object Map]",bbe="[object Number]",xbe="[object Object]",wbe="[object RegExp]",Sbe="[object Set]",Ebe="[object String]",Tbe={"[object Int8Array]":!0,"[object Uint8Array]":!0,"[object Uint8ClampedArray]":!0,"[object Int16Array]":!0,"[object Uint16Array]":!0,"[object Int32Array]":!0,"[object Uint32Array]":!0,"[object Float16Array]":!0,"[object Float32Array]":!0,"[object Float64Array]":!0,"[object BigInt64Array]":!0,"[object BigUint64Array]":!0},_be="[object URL]",Abe=Object.prototype.toString;function Pbe({areArrayBuffersEqual:t,areArraysEqual:e,areDataViewsEqual:r,areDatesEqual:n,areErrorsEqual:i,areFunctionsEqual:s,areMapsEqual:a,areNumbersEqual:o,areObjectsEqual:l,arePrimitiveWrappersEqual:c,areRegExpsEqual:u,areSetsEqual:d,areTypedArraysEqual:f,areUrlsEqual:h,unknownTagComparators:p}){return function(m,v,y){if(m===v)return!0;if(m==null||v==null)return!1;const b=typeof m;if(b!==typeof v)return!1;if(b!=="object")return b==="number"?o(m,v,y):b==="function"?s(m,v,y):!1;const w=m.constructor;if(w!==v.constructor)return!1;if(w===Object)return l(m,v,y);if(Array.isArray(m))return e(m,v,y);if(w===Date)return n(m,v,y);if(w===RegExp)return u(m,v,y);if(w===Map)return a(m,v,y);if(w===Set)return d(m,v,y);const S=Abe.call(m);if(S===gbe)return n(m,v,y);if(S===wbe)return u(m,v,y);if(S===ybe)return a(m,v,y);if(S===Sbe)return d(m,v,y);if(S===xbe)return typeof m.then!="function"&&typeof v.then!="function"&&l(m,v,y);if(S===_be)return h(m,v,y);if(S===vbe)return i(m,v,y);if(S===hbe)return l(m,v,y);if(Tbe[S])return f(m,v,y);if(S===fbe)return t(m,v,y);if(S===mbe)return r(m,v,y);if(S===pbe||S===bbe||S===Ebe)return c(m,v,y);if(p){let T=p[S];if(!T){const _=X0e(m);_&&(T=p[_])}if(T)return T(m,v,y)}return!1}}function Ibe({circular:t,createCustomConfig:e,strict:r}){let n={areArrayBuffersEqual:tbe,areArraysEqual:r?Wu:rbe,areDataViewsEqual:nbe,areDatesEqual:ibe,areErrorsEqual:sbe,areFunctionsEqual:abe,areMapsEqual:r?fb(GR,Wu):GR,areNumbersEqual:obe,areObjectsEqual:r?Wu:lbe,arePrimitiveWrappersEqual:cbe,areRegExpsEqual:ube,areSetsEqual:r?fb(WR,Wu):WR,areTypedArraysEqual:r?fb(_g,Wu):_g,areUrlsEqual:dbe,unknownTagComparators:void 0};if(e&&(n=Object.assign({},n,e(n))),t){const i=bp(n.areArraysEqual),s=bp(n.areMapsEqual),a=bp(n.areObjectsEqual),o=bp(n.areSetsEqual);n=Object.assign({},n,{areArraysEqual:i,areMapsEqual:s,areObjectsEqual:a,areSetsEqual:o})}return n}function Cbe(t){return function(e,r,n,i,s,a,o){return t(e,r,o)}}function Obe({circular:t,comparator:e,createState:r,equals:n,strict:i}){if(r)return function(o,l){const{cache:c=t?new WeakMap:void 0,meta:u}=r();return e(o,l,{cache:c,equals:n,meta:u,strict:i})};if(t)return function(o,l){return e(o,l,{cache:new WeakMap,equals:n,meta:void 0,strict:i})};const s={cache:void 0,equals:n,meta:void 0,strict:i};return function(o,l){return e(o,l,s)}}const Rbe=Na();Na({strict:!0});Na({circular:!0});Na({circular:!0,strict:!0});Na({createInternalComparator:()=>Jo});Na({strict:!0,createInternalComparator:()=>Jo});Na({circular:!0,createInternalComparator:()=>Jo});Na({circular:!0,createInternalComparator:()=>Jo,strict:!0});function Na(t={}){const{circular:e=!1,createInternalComparator:r,createState:n,strict:i=!1}=t,s=Ibe(t),a=Pbe(s),o=r?r(a):Cbe(a);return Obe({circular:e,comparator:a,createState:n,equals:o,strict:i})}function kbe(t){typeof requestAnimationFrame<"u"&&requestAnimationFrame(t)}function VR(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,r=-1,n=function i(s){r<0&&(r=s),s-r>e?(t(s),r=-1):kbe(i)};requestAnimationFrame(n)}function vS(t){"@babel/helpers - typeof";return vS=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},vS(t)}function Lbe(t){return $be(t)||Mbe(t)||Nbe(t)||Dbe()}function Dbe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
335In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Nbe(t,e){if(t){if(typeof t=="string")return HR(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return HR(t,e)}}function HR(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function Mbe(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function $be(t){if(Array.isArray(t))return t}function jbe(){var t={},e=function(){return null},r=!1,n=function i(s){if(!r){if(Array.isArray(s)){if(!s.length)return;var a=s,o=Lbe(a),l=o[0],c=o.slice(1);if(typeof l=="number"){VR(i.bind(null,c),l);return}i(l),VR(i.bind(null,c));return}vS(s)==="object"&&(t=s,e(t)),typeof s=="function"&&s()}};return{stop:function(){r=!0},start:function(s){r=!1,n(s)},subscribe:function(s){return e=s,function(){e=function(){return null}}}}}function Of(t){"@babel/helpers - typeof";return Of=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Of(t)}function KR(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function zR(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?KR(Object(r),!0).forEach(function(n){lU(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):KR(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function lU(t,e,r){return e=Fbe(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Fbe(t){var e=Bbe(t,"string");return Of(e)==="symbol"?e:String(e)}function Bbe(t,e){if(Of(t)!=="object"||t===null)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(Of(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Ube=function(e,r){return[Object.keys(e),Object.keys(r)].reduce(function(n,i){return n.filter(function(s){return i.includes(s)})})},Gbe=function(e){return e},Wbe=function(e){return e.replace(/([A-Z])/g,function(r){return"-".concat(r.toLowerCase())})},wd=function(e,r){return Object.keys(r).reduce(function(n,i){return zR(zR({},n),{},lU({},i,e(i,r[i])))},{})},qR=function(e,r,n){return e.map(function(i){return"".concat(Wbe(i)," ").concat(r,"ms ").concat(n)}).join(",")};function Vbe(t,e){return zbe(t)||Kbe(t,e)||cU(t,e)||Hbe()}function Hbe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
336In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Kbe(t,e){var r=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r!=null){var n,i,s,a,o=[],l=!0,c=!1;try{if(s=(r=r.call(t)).next,e!==0)for(;!(l=(n=s.call(r)).done)&&(o.push(n.value),o.length!==e);l=!0);}catch(u){c=!0,i=u}finally{try{if(!l&&r.return!=null&&(a=r.return(),Object(a)!==a))return}finally{if(c)throw i}}return o}}function zbe(t){if(Array.isArray(t))return t}function qbe(t){return Qbe(t)||Xbe(t)||cU(t)||Ybe()}function Ybe(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
337In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function cU(t,e){if(t){if(typeof t=="string")return yS(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return yS(t,e)}}function Xbe(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function Qbe(t){if(Array.isArray(t))return yS(t)}function yS(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var Ag=1e-4,uU=function(e,r){return[0,3*e,3*r-6*e,3*e-3*r+1]},dU=function(e,r){return e.map(function(n,i){return n*Math.pow(r,i)}).reduce(function(n,i){return n+i})},YR=function(e,r){return function(n){var i=uU(e,r);return dU(i,n)}},Jbe=function(e,r){return function(n){var i=uU(e,r),s=[].concat(qbe(i.map(function(a,o){return a*o}).slice(1)),[0]);return dU(s,n)}},XR=function(){for(var e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];var i=r[0],s=r[1],a=r[2],o=r[3];if(r.length===1)switch(r[0]){case"linear":i=0,s=0,a=1,o=1;break;case"ease":i=.25,s=.1,a=.25,o=1;break;case"ease-in":i=.42,s=0,a=1,o=1;break;case"ease-out":i=.42,s=0,a=.58,o=1;break;case"ease-in-out":i=0,s=0,a=.58,o=1;break;default:{var l=r[0].split("(");if(l[0]==="cubic-bezier"&&l[1].split(")")[0].split(",").length===4){var c=l[1].split(")")[0].split(",").map(function(m){return parseFloat(m)}),u=Vbe(c,4);i=u[0],s=u[1],a=u[2],o=u[3]}}}var d=YR(i,a),f=YR(s,o),h=Jbe(i,a),p=function(v){return v>1?1:v<0?0:v},g=function(v){for(var y=v>1?1:v,b=y,w=0;w<8;++w){var S=d(b)-y,T=h(b);if(Math.abs(S-y)<Ag||T<Ag)return f(b);b=p(b-S/T)}return f(b)};return g.isStepper=!1,g},Zbe=function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r=e.stiff,n=r===void 0?100:r,i=e.damping,s=i===void 0?8:i,a=e.dt,o=a===void 0?17:a,l=function(u,d,f){var h=-(u-d)*n,p=f*s,g=f+(h-p)*o/1e3,m=f*o/1e3+u;return Math.abs(m-d)<Ag&&Math.abs(g)<Ag?[d,0]:[m,g]};return l.isStepper=!0,l.dt=o,l},exe=function(){for(var e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];var i=r[0];if(typeof i=="string")switch(i){case"ease":case"ease-in-out":case"ease-out":case"ease-in":case"linear":return XR(i);case"spring":return Zbe();default:if(i.split("(")[0]==="cubic-bezier")return XR(i)}return typeof i=="function"?i:null};function Rf(t){"@babel/helpers - typeof";return Rf=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Rf(t)}function QR(t){return nxe(t)||rxe(t)||fU(t)||txe()}function txe(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
338In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function rxe(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function nxe(t){if(Array.isArray(t))return xS(t)}function JR(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function dr(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?JR(Object(r),!0).forEach(function(n){bS(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):JR(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function bS(t,e,r){return e=ixe(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function ixe(t){var e=sxe(t,"string");return Rf(e)==="symbol"?e:String(e)}function sxe(t,e){if(Rf(t)!=="object"||t===null)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(Rf(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function axe(t,e){return cxe(t)||lxe(t,e)||fU(t,e)||oxe()}function oxe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
339In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function fU(t,e){if(t){if(typeof t=="string")return xS(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return xS(t,e)}}function xS(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function lxe(t,e){var r=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r!=null){var n,i,s,a,o=[],l=!0,c=!1;try{if(s=(r=r.call(t)).next,e!==0)for(;!(l=(n=s.call(r)).done)&&(o.push(n.value),o.length!==e);l=!0);}catch(u){c=!0,i=u}finally{try{if(!l&&r.return!=null&&(a=r.return(),Object(a)!==a))return}finally{if(c)throw i}}return o}}function cxe(t){if(Array.isArray(t))return t}var Pg=function(e,r,n){return e+(r-e)*n},wS=function(e){var r=e.from,n=e.to;return r!==n},uxe=function t(e,r,n){var i=wd(function(s,a){if(wS(a)){var o=e(a.from,a.to,a.velocity),l=axe(o,2),c=l[0],u=l[1];return dr(dr({},a),{},{from:c,velocity:u})}return a},r);return n<1?wd(function(s,a){return wS(a)?dr(dr({},a),{},{velocity:Pg(a.velocity,i[s].velocity,n),from:Pg(a.from,i[s].from,n)}):a},r):t(e,i,n-1)};const dxe=function(t,e,r,n,i){var s=Ube(t,e),a=s.reduce(function(m,v){return dr(dr({},m),{},bS({},v,[t[v],e[v]]))},{}),o=s.reduce(function(m,v){return dr(dr({},m),{},bS({},v,{from:t[v],velocity:0,to:e[v]}))},{}),l=-1,c,u,d=function(){return null},f=function(){return wd(function(v,y){return y.from},o)},h=function(){return!Object.values(o).filter(wS).length},p=function(v){c||(c=v);var y=v-c,b=y/r.dt;o=uxe(r,o,b),i(dr(dr(dr({},t),e),f())),c=v,h()||(l=requestAnimationFrame(d))},g=function(v){u||(u=v);var y=(v-u)/n,b=wd(function(S,T){return Pg.apply(void 0,QR(T).concat([r(y)]))},a);if(i(dr(dr(dr({},t),e),b)),y<1)l=requestAnimationFrame(d);else{var w=wd(function(S,T){return Pg.apply(void 0,QR(T).concat([r(1)]))},a);i(dr(dr(dr({},t),e),w))}};return d=r.isStepper?p:g,function(){return requestAnimationFrame(d),function(){cancelAnimationFrame(l)}}};function Nc(t){"@babel/helpers - typeof";return Nc=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Nc(t)}var fxe=["children","begin","duration","attributeName","easing","isActive","steps","from","to","canBegin","onAnimationEnd","shouldReAnimate","onAnimationReStart"];function hxe(t,e){if(t==null)return{};var r=pxe(t,e),n,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(i=0;i<s.length;i++)n=s[i],!(e.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function pxe(t,e){if(t==null)return{};var r={},n=Object.keys(t),i,s;for(s=0;s<n.length;s++)i=n[s],!(e.indexOf(i)>=0)&&(r[i]=t[i]);return r}function hb(t){return yxe(t)||vxe(t)||gxe(t)||mxe()}function mxe(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
340In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function gxe(t,e){if(t){if(typeof t=="string")return SS(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return SS(t,e)}}function vxe(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function yxe(t){if(Array.isArray(t))return SS(t)}function SS(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function ZR(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function Wn(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?ZR(Object(r),!0).forEach(function(n){td(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):ZR(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function td(t,e,r){return e=hU(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function bxe(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function xxe(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,hU(n.key),n)}}function wxe(t,e,r){return e&&xxe(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function hU(t){var e=Sxe(t,"string");return Nc(e)==="symbol"?e:String(e)}function Sxe(t,e){if(Nc(t)!=="object"||t===null)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(Nc(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Exe(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&ES(t,e)}function ES(t,e){return ES=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},ES(t,e)}function Txe(t){var e=_xe();return function(){var n=Ig(t),i;if(e){var s=Ig(this).constructor;i=Reflect.construct(n,arguments,s)}else i=n.apply(this,arguments);return TS(this,i)}}function TS(t,e){if(e&&(Nc(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return _S(t)}function _S(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function _xe(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function Ig(t){return Ig=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Ig(t)}var Aa=function(t){Exe(r,t);var e=Txe(r);function r(n,i){var s;bxe(this,r),s=e.call(this,n,i);var a=s.props,o=a.isActive,l=a.attributeName,c=a.from,u=a.to,d=a.steps,f=a.children,h=a.duration;if(s.handleStyleChange=s.handleStyleChange.bind(_S(s)),s.changeStyle=s.changeStyle.bind(_S(s)),!o||h<=0)return s.state={style:{}},typeof f=="function"&&(s.state={style:u}),TS(s);if(d&&d.length)s.state={style:d[0].style};else if(c){if(typeof f=="function")return s.state={style:c},TS(s);s.state={style:l?td({},l,c):c}}else s.state={style:{}};return s}return wxe(r,[{key:"componentDidMount",value:function(){var i=this.props,s=i.isActive,a=i.canBegin;this.mounted=!0,!(!s||!a)&&this.runAnimation(this.props)}},{key:"componentDidUpdate",value:function(i){var s=this.props,a=s.isActive,o=s.canBegin,l=s.attributeName,c=s.shouldReAnimate,u=s.to,d=s.from,f=this.state.style;if(o){if(!a){var h={style:l?td({},l,u):u};this.state&&f&&(l&&f[l]!==u||!l&&f!==u)&&this.setState(h);return}if(!(Rbe(i.to,u)&&i.canBegin&&i.isActive)){var p=!i.canBegin||!i.isActive;this.manager&&this.manager.stop(),this.stopJSAnimation&&this.stopJSAnimation();var g=p||c?d:i.to;if(this.state&&f){var m={style:l?td({},l,g):g};(l&&f[l]!==g||!l&&f!==g)&&this.setState(m)}this.runAnimation(Wn(Wn({},this.props),{},{from:g,begin:0}))}}}},{key:"componentWillUnmount",value:function(){this.mounted=!1;var i=this.props.onAnimationEnd;this.unSubscribe&&this.unSubscribe(),this.manager&&(this.manager.stop(),this.manager=null),this.stopJSAnimation&&this.stopJSAnimation(),i&&i()}},{key:"handleStyleChange",value:function(i){this.changeStyle(i)}},{key:"changeStyle",value:function(i){this.mounted&&this.setState({style:i})}},{key:"runJSAnimation",value:function(i){var s=this,a=i.from,o=i.to,l=i.duration,c=i.easing,u=i.begin,d=i.onAnimationEnd,f=i.onAnimationStart,h=dxe(a,o,exe(c),l,this.changeStyle),p=function(){s.stopJSAnimation=h()};this.manager.start([f,u,p,l,d])}},{key:"runStepAnimation",value:function(i){var s=this,a=i.steps,o=i.begin,l=i.onAnimationStart,c=a[0],u=c.style,d=c.duration,f=d===void 0?0:d,h=function(g,m,v){if(v===0)return g;var y=m.duration,b=m.easing,w=b===void 0?"ease":b,S=m.style,T=m.properties,_=m.onAnimationEnd,A=v>0?a[v-1]:m,P=T||Object.keys(S);if(typeof w=="function"||w==="spring")return[].concat(hb(g),[s.runJSAnimation.bind(s,{from:A.style,to:S,duration:y,easing:w}),y]);var C=qR(P,y,w),O=Wn(Wn(Wn({},A.style),S),{},{transition:C});return[].concat(hb(g),[O,y,_]).filter(Gbe)};return this.manager.start([l].concat(hb(a.reduce(h,[u,Math.max(f,o)])),[i.onAnimationEnd]))}},{key:"runAnimation",value:function(i){this.manager||(this.manager=jbe());var s=i.begin,a=i.duration,o=i.attributeName,l=i.to,c=i.easing,u=i.onAnimationStart,d=i.onAnimationEnd,f=i.steps,h=i.children,p=this.manager;if(this.unSubscribe=p.subscribe(this.handleStyleChange),typeof c=="function"||typeof h=="function"||c==="spring"){this.runJSAnimation(i);return}if(f.length>1){this.runStepAnimation(i);return}var g=o?td({},o,l):l,m=qR(Object.keys(g),a,c);p.start([u,s,Wn(Wn({},g),{},{transition:m}),a,d])}},{key:"render",value:function(){var i=this.props,s=i.children;i.begin;var a=i.duration;i.attributeName,i.easing;var o=i.isActive;i.steps,i.from,i.to,i.canBegin,i.onAnimationEnd,i.shouldReAnimate,i.onAnimationReStart;var l=hxe(i,fxe),c=E.Children.count(s),u=this.state.style;if(typeof s=="function")return s(u);if(!o||c===0||a<=0)return s;var d=function(h){var p=h.props,g=p.style,m=g===void 0?{}:g,v=p.className,y=E.cloneElement(h,Wn(Wn({},l),{},{style:Wn(Wn({},m),u),className:v}));return y};return c===1?d(E.Children.only(s)):F.createElement("div",null,E.Children.map(s,function(f){return d(f)}))}}]),r}(E.PureComponent);Aa.displayName="Animate";Aa.defaultProps={begin:0,duration:1e3,from:"",to:"",attributeName:"",easing:"ease",isActive:!0,canBegin:!0,steps:[],onAnimationEnd:function(){},onAnimationStart:function(){}};Aa.propTypes={from:Be.oneOfType([Be.object,Be.string]),to:Be.oneOfType([Be.object,Be.string]),attributeName:Be.string,duration:Be.number,begin:Be.number,easing:Be.oneOfType([Be.string,Be.func]),steps:Be.arrayOf(Be.shape({duration:Be.number.isRequired,style:Be.object.isRequired,easing:Be.oneOfType([Be.oneOf(["ease","ease-in","ease-out","ease-in-out","linear"]),Be.func]),properties:Be.arrayOf("string"),onAnimationEnd:Be.func})),children:Be.oneOfType([Be.node,Be.func]),isActive:Be.bool,canBegin:Be.bool,onAnimationEnd:Be.func,shouldReAnimate:Be.bool,onAnimationStart:Be.func,onAnimationReStart:Be.func};function kf(t){"@babel/helpers - typeof";return kf=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},kf(t)}function Cg(){return Cg=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},Cg.apply(this,arguments)}function Axe(t,e){return Oxe(t)||Cxe(t,e)||Ixe(t,e)||Pxe()}function Pxe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
341In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Ixe(t,e){if(t){if(typeof t=="string")return ek(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return ek(t,e)}}function ek(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function Cxe(t,e){var r=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r!=null){var n,i,s,a,o=[],l=!0,c=!1;try{if(s=(r=r.call(t)).next,e!==0)for(;!(l=(n=s.call(r)).done)&&(o.push(n.value),o.length!==e);l=!0);}catch(u){c=!0,i=u}finally{try{if(!l&&r.return!=null&&(a=r.return(),Object(a)!==a))return}finally{if(c)throw i}}return o}}function Oxe(t){if(Array.isArray(t))return t}function tk(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function rk(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?tk(Object(r),!0).forEach(function(n){Rxe(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):tk(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function Rxe(t,e,r){return e=kxe(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function kxe(t){var e=Lxe(t,"string");return kf(e)=="symbol"?e:e+""}function Lxe(t,e){if(kf(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(kf(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var nk=function(e,r,n,i,s){var a=Math.min(Math.abs(n)/2,Math.abs(i)/2),o=i>=0?1:-1,l=n>=0?1:-1,c=i>=0&&n>=0||i<0&&n<0?1:0,u;if(a>0&&s instanceof Array){for(var d=[0,0,0,0],f=0,h=4;f<h;f++)d[f]=s[f]>a?a:s[f];u="M".concat(e,",").concat(r+o*d[0]),d[0]>0&&(u+="A ".concat(d[0],",").concat(d[0],",0,0,").concat(c,",").concat(e+l*d[0],",").concat(r)),u+="L ".concat(e+n-l*d[1],",").concat(r),d[1]>0&&(u+="A ".concat(d[1],",").concat(d[1],",0,0,").concat(c,`,
342        `).concat(e+n,",").concat(r+o*d[1])),u+="L ".concat(e+n,",").concat(r+i-o*d[2]),d[2]>0&&(u+="A ".concat(d[2],",").concat(d[2],",0,0,").concat(c,`,
343        `).concat(e+n-l*d[2],",").concat(r+i)),u+="L ".concat(e+l*d[3],",").concat(r+i),d[3]>0&&(u+="A ".concat(d[3],",").concat(d[3],",0,0,").concat(c,`,
344        `).concat(e,",").concat(r+i-o*d[3])),u+="Z"}else if(a>0&&s===+s&&s>0){var p=Math.min(a,s);u="M ".concat(e,",").concat(r+o*p,`
345            A `).concat(p,",").concat(p,",0,0,").concat(c,",").concat(e+l*p,",").concat(r,`
346            L `).concat(e+n-l*p,",").concat(r,`
347            A `).concat(p,",").concat(p,",0,0,").concat(c,",").concat(e+n,",").concat(r+o*p,`
348            L `).concat(e+n,",").concat(r+i-o*p,`
349            A `).concat(p,",").concat(p,",0,0,").concat(c,",").concat(e+n-l*p,",").concat(r+i,`
350            L `).concat(e+l*p,",").concat(r+i,`
351            A `).concat(p,",").concat(p,",0,0,").concat(c,",").concat(e,",").concat(r+i-o*p," Z")}else u="M ".concat(e,",").concat(r," h ").concat(n," v ").concat(i," h ").concat(-n," Z");return u},Dxe=function(e,r){if(!e||!r)return!1;var n=e.x,i=e.y,s=r.x,a=r.y,o=r.width,l=r.height;if(Math.abs(o)>0&&Math.abs(l)>0){var c=Math.min(s,s+o),u=Math.max(s,s+o),d=Math.min(a,a+l),f=Math.max(a,a+l);return n>=c&&n<=u&&i>=d&&i<=f}return!1},Nxe={x:0,y:0,width:0,height:0,radius:0,isAnimationActive:!1,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},z_=function(e){var r=rk(rk({},Nxe),e),n=E.useRef(),i=E.useState(-1),s=Axe(i,2),a=s[0],o=s[1];E.useEffect(function(){if(n.current&&n.current.getTotalLength)try{var w=n.current.getTotalLength();w&&o(w)}catch{}},[]);var l=r.x,c=r.y,u=r.width,d=r.height,f=r.radius,h=r.className,p=r.animationEasing,g=r.animationDuration,m=r.animationBegin,v=r.isAnimationActive,y=r.isUpdateAnimationActive;if(l!==+l||c!==+c||u!==+u||d!==+d||u===0||d===0)return null;var b=Me("recharts-rectangle",h);return y?F.createElement(Aa,{canBegin:a>0,from:{width:u,height:d,x:l,y:c},to:{width:u,height:d,x:l,y:c},duration:g,animationEasing:p,isActive:y},function(w){var S=w.width,T=w.height,_=w.x,A=w.y;return F.createElement(Aa,{canBegin:a>0,from:"0px ".concat(a===-1?1:a,"px"),to:"".concat(a,"px 0px"),attributeName:"strokeDasharray",begin:m,duration:g,isActive:v,easing:p},F.createElement("path",Cg({},Ue(r,!0),{className:b,d:nk(_,A,S,T,f),ref:n})))}):F.createElement("path",Cg({},Ue(r,!0),{className:b,d:nk(l,c,u,d,f)}))};function AS(){return AS=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},AS.apply(this,arguments)}var pU=function(e){var r=e.cx,n=e.cy,i=e.r,s=e.className,a=Me("recharts-dot",s);return r===+r&&n===+n&&i===+i?E.createElement("circle",AS({},Ue(e,!1),Km(e),{className:a,cx:r,cy:n,r:i})):null};function Lf(t){"@babel/helpers - typeof";return Lf=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Lf(t)}var Mxe=["x","y","top","left","width","height","className"];function PS(){return PS=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},PS.apply(this,arguments)}function ik(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function $xe(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?ik(Object(r),!0).forEach(function(n){jxe(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):ik(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function jxe(t,e,r){return e=Fxe(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Fxe(t){var e=Bxe(t,"string");return Lf(e)=="symbol"?e:e+""}function Bxe(t,e){if(Lf(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(Lf(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Uxe(t,e){if(t==null)return{};var r=Gxe(t,e),n,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(i=0;i<s.length;i++)n=s[i],!(e.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function Gxe(t,e){if(t==null)return{};var r={};for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(e.indexOf(n)>=0)continue;r[n]=t[n]}return r}var Wxe=function(e,r,n,i,s,a){return"M".concat(e,",").concat(s,"v").concat(i,"M").concat(a,",").concat(r,"h").concat(n)},Vxe=function(e){var r=e.x,n=r===void 0?0:r,i=e.y,s=i===void 0?0:i,a=e.top,o=a===void 0?0:a,l=e.left,c=l===void 0?0:l,u=e.width,d=u===void 0?0:u,f=e.height,h=f===void 0?0:f,p=e.className,g=Uxe(e,Mxe),m=$xe({x:n,y:s,top:o,left:c,width:d,height:h},g);return!ae(n)||!ae(s)||!ae(d)||!ae(h)||!ae(o)||!ae(c)?null:F.createElement("path",PS({},Ue(m,!0),{className:Me("recharts-cross",p),d:Wxe(n,s,d,h,o,c)}))},Hxe=RF,Kxe=Hxe(Object.getPrototypeOf,Object),zxe=Kxe,qxe=Os,Yxe=zxe,Xxe=Rs,Qxe="[object Object]",Jxe=Function.prototype,Zxe=Object.prototype,mU=Jxe.toString,ewe=Zxe.hasOwnProperty,twe=mU.call(Object);function rwe(t){if(!Xxe(t)||qxe(t)!=Qxe)return!1;var e=Yxe(t);if(e===null)return!0;var r=ewe.call(e,"constructor")&&e.constructor;return typeof r=="function"&&r instanceof r&&mU.call(r)==twe}var nwe=rwe;const iwe=at(nwe);var swe=Os,awe=Rs,owe="[object Boolean]";function lwe(t){return t===!0||t===!1||awe(t)&&swe(t)==owe}var cwe=lwe;const uwe=at(cwe);function Df(t){"@babel/helpers - typeof";return Df=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Df(t)}function Og(){return Og=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},Og.apply(this,arguments)}function dwe(t,e){return mwe(t)||pwe(t,e)||hwe(t,e)||fwe()}function fwe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
352In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function hwe(t,e){if(t){if(typeof t=="string")return sk(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return sk(t,e)}}function sk(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function pwe(t,e){var r=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r!=null){var n,i,s,a,o=[],l=!0,c=!1;try{if(s=(r=r.call(t)).next,e!==0)for(;!(l=(n=s.call(r)).done)&&(o.push(n.value),o.length!==e);l=!0);}catch(u){c=!0,i=u}finally{try{if(!l&&r.return!=null&&(a=r.return(),Object(a)!==a))return}finally{if(c)throw i}}return o}}function mwe(t){if(Array.isArray(t))return t}function ak(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function ok(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?ak(Object(r),!0).forEach(function(n){gwe(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):ak(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function gwe(t,e,r){return e=vwe(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function vwe(t){var e=ywe(t,"string");return Df(e)=="symbol"?e:e+""}function ywe(t,e){if(Df(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(Df(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var lk=function(e,r,n,i,s){var a=n-i,o;return o="M ".concat(e,",").concat(r),o+="L ".concat(e+n,",").concat(r),o+="L ".concat(e+n-a/2,",").concat(r+s),o+="L ".concat(e+n-a/2-i,",").concat(r+s),o+="L ".concat(e,",").concat(r," Z"),o},bwe={x:0,y:0,upperWidth:0,lowerWidth:0,height:0,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},xwe=function(e){var r=ok(ok({},bwe),e),n=E.useRef(),i=E.useState(-1),s=dwe(i,2),a=s[0],o=s[1];E.useEffect(function(){if(n.current&&n.current.getTotalLength)try{var b=n.current.getTotalLength();b&&o(b)}catch{}},[]);var l=r.x,c=r.y,u=r.upperWidth,d=r.lowerWidth,f=r.height,h=r.className,p=r.animationEasing,g=r.animationDuration,m=r.animationBegin,v=r.isUpdateAnimationActive;if(l!==+l||c!==+c||u!==+u||d!==+d||f!==+f||u===0&&d===0||f===0)return null;var y=Me("recharts-trapezoid",h);return v?F.createElement(Aa,{canBegin:a>0,from:{upperWidth:0,lowerWidth:0,height:f,x:l,y:c},to:{upperWidth:u,lowerWidth:d,height:f,x:l,y:c},duration:g,animationEasing:p,isActive:v},function(b){var w=b.upperWidth,S=b.lowerWidth,T=b.height,_=b.x,A=b.y;return F.createElement(Aa,{canBegin:a>0,from:"0px ".concat(a===-1?1:a,"px"),to:"".concat(a,"px 0px"),attributeName:"strokeDasharray",begin:m,duration:g,easing:p},F.createElement("path",Og({},Ue(r,!0),{className:y,d:lk(_,A,w,S,T),ref:n})))}):F.createElement("g",null,F.createElement("path",Og({},Ue(r,!0),{className:y,d:lk(l,c,u,d,f)})))},wwe=["option","shapeType","propTransformer","activeClassName","isActive"];function Nf(t){"@babel/helpers - typeof";return Nf=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Nf(t)}function Swe(t,e){if(t==null)return{};var r=Ewe(t,e),n,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(i=0;i<s.length;i++)n=s[i],!(e.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function Ewe(t,e){if(t==null)return{};var r={};for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(e.indexOf(n)>=0)continue;r[n]=t[n]}return r}function ck(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function Rg(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?ck(Object(r),!0).forEach(function(n){Twe(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):ck(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function Twe(t,e,r){return e=_we(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function _we(t){var e=Awe(t,"string");return Nf(e)=="symbol"?e:e+""}function Awe(t,e){if(Nf(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(Nf(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Pwe(t,e){return Rg(Rg({},e),t)}function Iwe(t,e){return t==="symbols"}function uk(t){var e=t.shapeType,r=t.elementProps;switch(e){case"rectangle":return F.createElement(z_,r);case"trapezoid":return F.createElement(xwe,r);case"sector":return F.createElement(nU,r);case"symbols":if(Iwe(e))return F.createElement(u_,r);break;default:return null}}function Cwe(t){return E.isValidElement(t)?t.props:t}function Owe(t){var e=t.option,r=t.shapeType,n=t.propTransformer,i=n===void 0?Pwe:n,s=t.activeClassName,a=s===void 0?"recharts-active-shape":s,o=t.isActive,l=Swe(t,wwe),c;if(E.isValidElement(e))c=E.cloneElement(e,Rg(Rg({},l),Cwe(e)));else if(De(e))c=e(l);else if(iwe(e)&&!uwe(e)){var u=i(e,l);c=F.createElement(uk,{shapeType:r,elementProps:u})}else{var d=l;c=F.createElement(uk,{shapeType:r,elementProps:d})}return o?F.createElement(sr,{className:a},c):c}function py(t,e){return e!=null&&"trapezoids"in t.props}function my(t,e){return e!=null&&"sectors"in t.props}function Mf(t,e){return e!=null&&"points"in t.props}function Rwe(t,e){var r,n,i=t.x===(e==null||(r=e.labelViewBox)===null||r===void 0?void 0:r.x)||t.x===e.x,s=t.y===(e==null||(n=e.labelViewBox)===null||n===void 0?void 0:n.y)||t.y===e.y;return i&&s}function kwe(t,e){var r=t.endAngle===e.endAngle,n=t.startAngle===e.startAngle;return r&&n}function Lwe(t,e){var r=t.x===e.x,n=t.y===e.y,i=t.z===e.z;return r&&n&&i}function Dwe(t,e){var r;return py(t,e)?r=Rwe:my(t,e)?r=kwe:Mf(t,e)&&(r=Lwe),r}function Nwe(t,e){var r;return py(t,e)?r="trapezoids":my(t,e)?r="sectors":Mf(t,e)&&(r="points"),r}function Mwe(t,e){if(py(t,e)){var r;return(r=e.tooltipPayload)===null||r===void 0||(r=r[0])===null||r===void 0||(r=r.payload)===null||r===void 0?void 0:r.payload}if(my(t,e)){var n;return(n=e.tooltipPayload)===null||n===void 0||(n=n[0])===null||n===void 0||(n=n.payload)===null||n===void 0?void 0:n.payload}return Mf(t,e)?e.payload:{}}function $we(t){var e=t.activeTooltipItem,r=t.graphicalItem,n=t.itemData,i=Nwe(r,e),s=Mwe(r,e),a=n.filter(function(l,c){var u=W_(s,l),d=r.props[i].filter(function(p){var g=Dwe(r,e);return g(p,e)}),f=r.props[i].indexOf(d[d.length-1]),h=c===f;return u&&h}),o=n.indexOf(a[a.length-1]);return o}var jwe=Math.ceil,Fwe=Math.max;function Bwe(t,e,r,n){for(var i=-1,s=Fwe(jwe((e-t)/(r||1)),0),a=Array(s);s--;)a[n?s:++i]=t,t+=r;return a}var Uwe=Bwe,Gwe=YF,dk=1/0,Wwe=17976931348623157e292;function Vwe(t){if(!t)return t===0?t:0;if(t=Gwe(t),t===dk||t===-dk){var e=t<0?-1:1;return e*Wwe}return t===t?t:0}var Hwe=Vwe,Kwe=Uwe,zwe=ry,pb=Hwe;function qwe(t){return function(e,r,n){return n&&typeof n!="number"&&zwe(e,r,n)&&(r=n=void 0),e=pb(e),r===void 0?(r=e,e=0):r=pb(r),n=n===void 0?e<r?1:-1:pb(n),Kwe(e,r,n,t)}}var Ywe=qwe,Xwe=Ywe,Qwe=Xwe(),Jwe=Qwe;const kg=at(Jwe);function $f(t){"@babel/helpers - typeof";return $f=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},$f(t)}function fk(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function hk(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?fk(Object(r),!0).forEach(function(n){gU(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):fk(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function gU(t,e,r){return e=Zwe(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Zwe(t){var e=eSe(t,"string");return $f(e)=="symbol"?e:e+""}function eSe(t,e){if($f(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if($f(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var tSe=["Webkit","Moz","O","ms"],rSe=function(e,r){var n=e.replace(/(\w)/,function(s){return s.toUpperCase()}),i=tSe.reduce(function(s,a){return hk(hk({},s),{},gU({},a+n,r))},{});return i[e]=r,i};function Mc(t){"@babel/helpers - typeof";return Mc=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Mc(t)}function Lg(){return Lg=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},Lg.apply(this,arguments)}function pk(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function mb(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?pk(Object(r),!0).forEach(function(n){Zr(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):pk(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function nSe(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function mk(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,yU(n.key),n)}}function iSe(t,e,r){return e&&mk(t.prototype,e),r&&mk(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function sSe(t,e,r){return e=Dg(e),aSe(t,vU()?Reflect.construct(e,r||[],Dg(t).constructor):e.apply(t,r))}function aSe(t,e){if(e&&(Mc(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return oSe(t)}function oSe(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function vU(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(vU=function(){return!!t})()}function Dg(t){return Dg=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Dg(t)}function lSe(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&IS(t,e)}function IS(t,e){return IS=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},IS(t,e)}function Zr(t,e,r){return e=yU(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function yU(t){var e=cSe(t,"string");return Mc(e)=="symbol"?e:e+""}function cSe(t,e){if(Mc(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(Mc(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}var uSe=function(e){var r=e.data,n=e.startIndex,i=e.endIndex,s=e.x,a=e.width,o=e.travellerWidth;if(!r||!r.length)return{};var l=r.length,c=bd().domain(kg(0,l)).range([s,s+a-o]),u=c.domain().map(function(d){return c(d)});return{isTextActive:!1,isSlideMoving:!1,isTravellerMoving:!1,isTravellerFocused:!1,startX:c(n),endX:c(i),scale:c,scaleValues:u}},gk=function(e){return e.changedTouches&&!!e.changedTouches.length},$c=function(t){function e(r){var n;return nSe(this,e),n=sSe(this,e,[r]),Zr(n,"handleDrag",function(i){n.leaveTimer&&(clearTimeout(n.leaveTimer),n.leaveTimer=null),n.state.isTravellerMoving?n.handleTravellerMove(i):n.state.isSlideMoving&&n.handleSlideDrag(i)}),Zr(n,"handleTouchMove",function(i){i.changedTouches!=null&&i.changedTouches.length>0&&n.handleDrag(i.changedTouches[0])}),Zr(n,"handleDragEnd",function(){n.setState({isTravellerMoving:!1,isSlideMoving:!1},function(){var i=n.props,s=i.endIndex,a=i.onDragEnd,o=i.startIndex;a==null||a({endIndex:s,startIndex:o})}),n.detachDragEndListener()}),Zr(n,"handleLeaveWrapper",function(){(n.state.isTravellerMoving||n.state.isSlideMoving)&&(n.leaveTimer=window.setTimeout(n.handleDragEnd,n.props.leaveTimeOut))}),Zr(n,"handleEnterSlideOrTraveller",function(){n.setState({isTextActive:!0})}),Zr(n,"handleLeaveSlideOrTraveller",function(){n.setState({isTextActive:!1})}),Zr(n,"handleSlideDragStart",function(i){var s=gk(i)?i.changedTouches[0]:i;n.setState({isTravellerMoving:!1,isSlideMoving:!0,slideMoveStartX:s.pageX}),n.attachDragEndListener()}),n.travellerDragStartHandlers={startX:n.handleTravellerDragStart.bind(n,"startX"),endX:n.handleTravellerDragStart.bind(n,"endX")},n.state={},n}return lSe(e,t),iSe(e,[{key:"componentWillUnmount",value:function(){this.leaveTimer&&(clearTimeout(this.leaveTimer),this.leaveTimer=null),this.detachDragEndListener()}},{key:"getIndex",value:function(n){var i=n.startX,s=n.endX,a=this.state.scaleValues,o=this.props,l=o.gap,c=o.data,u=c.length-1,d=Math.min(i,s),f=Math.max(i,s),h=e.getIndexInRange(a,d),p=e.getIndexInRange(a,f);return{startIndex:h-h%l,endIndex:p===u?u:p-p%l}}},{key:"getTextOfTick",value:function(n){var i=this.props,s=i.data,a=i.tickFormatter,o=i.dataKey,l=Ui(s[n],o,n);return De(a)?a(l,n):l}},{key:"attachDragEndListener",value:function(){window.addEventListener("mouseup",this.handleDragEnd,!0),window.addEventListener("touchend",this.handleDragEnd,!0),window.addEventListener("mousemove",this.handleDrag,!0)}},{key:"detachDragEndListener",value:function(){window.removeEventListener("mouseup",this.handleDragEnd,!0),window.removeEventListener("touchend",this.handleDragEnd,!0),window.removeEventListener("mousemove",this.handleDrag,!0)}},{key:"handleSlideDrag",value:function(n){var i=this.state,s=i.slideMoveStartX,a=i.startX,o=i.endX,l=this.props,c=l.x,u=l.width,d=l.travellerWidth,f=l.startIndex,h=l.endIndex,p=l.onChange,g=n.pageX-s;g>0?g=Math.min(g,c+u-d-o,c+u-d-a):g<0&&(g=Math.max(g,c-a,c-o));var m=this.getIndex({startX:a+g,endX:o+g});(m.startIndex!==f||m.endIndex!==h)&&p&&p(m),this.setState({startX:a+g,endX:o+g,slideMoveStartX:n.pageX})}},{key:"handleTravellerDragStart",value:function(n,i){var s=gk(i)?i.changedTouches[0]:i;this.setState({isSlideMoving:!1,isTravellerMoving:!0,movingTravellerId:n,brushMoveStartX:s.pageX}),this.attachDragEndListener()}},{key:"handleTravellerMove",value:function(n){var i=this.state,s=i.brushMoveStartX,a=i.movingTravellerId,o=i.endX,l=i.startX,c=this.state[a],u=this.props,d=u.x,f=u.width,h=u.travellerWidth,p=u.onChange,g=u.gap,m=u.data,v={startX:this.state.startX,endX:this.state.endX},y=n.pageX-s;y>0?y=Math.min(y,d+f-h-c):y<0&&(y=Math.max(y,d-c)),v[a]=c+y;var b=this.getIndex(v),w=b.startIndex,S=b.endIndex,T=function(){var A=m.length-1;return a==="startX"&&(o>l?w%g===0:S%g===0)||o<l&&S===A||a==="endX"&&(o>l?S%g===0:w%g===0)||o>l&&S===A};this.setState(Zr(Zr({},a,c+y),"brushMoveStartX",n.pageX),function(){p&&T()&&p(b)})}},{key:"handleTravellerMoveKeyboard",value:function(n,i){var s=this,a=this.state,o=a.scaleValues,l=a.startX,c=a.endX,u=this.state[i],d=o.indexOf(u);if(d!==-1){var f=d+n;if(!(f===-1||f>=o.length)){var h=o[f];i==="startX"&&h>=c||i==="endX"&&h<=l||this.setState(Zr({},i,h),function(){s.props.onChange(s.getIndex({startX:s.state.startX,endX:s.state.endX}))})}}}},{key:"renderBackground",value:function(){var n=this.props,i=n.x,s=n.y,a=n.width,o=n.height,l=n.fill,c=n.stroke;return F.createElement("rect",{stroke:c,fill:l,x:i,y:s,width:a,height:o})}},{key:"renderPanorama",value:function(){var n=this.props,i=n.x,s=n.y,a=n.width,o=n.height,l=n.data,c=n.children,u=n.padding,d=E.Children.only(c);return d?F.cloneElement(d,{x:i,y:s,width:a,height:o,margin:u,compact:!0,data:l}):null}},{key:"renderTravellerLayer",value:function(n,i){var s,a,o=this,l=this.props,c=l.y,u=l.travellerWidth,d=l.height,f=l.traveller,h=l.ariaLabel,p=l.data,g=l.startIndex,m=l.endIndex,v=Math.max(n,this.props.x),y=mb(mb({},Ue(this.props,!1)),{},{x:v,y:c,width:u,height:d}),b=h||"Min value: ".concat((s=p[g])===null||s===void 0?void 0:s.name,", Max value: ").concat((a=p[m])===null||a===void 0?void 0:a.name);return F.createElement(sr,{tabIndex:0,role:"slider","aria-label":b,"aria-valuenow":n,className:"recharts-brush-traveller",onMouseEnter:this.handleEnterSlideOrTraveller,onMouseLeave:this.handleLeaveSlideOrTraveller,onMouseDown:this.travellerDragStartHandlers[i],onTouchStart:this.travellerDragStartHandlers[i],onKeyDown:function(S){["ArrowLeft","ArrowRight"].includes(S.key)&&(S.preventDefault(),S.stopPropagation(),o.handleTravellerMoveKeyboard(S.key==="ArrowRight"?1:-1,i))},onFocus:function(){o.setState({isTravellerFocused:!0})},onBlur:function(){o.setState({isTravellerFocused:!1})},style:{cursor:"col-resize"}},e.renderTraveller(f,y))}},{key:"renderSlide",value:function(n,i){var s=this.props,a=s.y,o=s.height,l=s.stroke,c=s.travellerWidth,u=Math.min(n,i)+c,d=Math.max(Math.abs(i-n)-c,0);return F.createElement("rect",{className:"recharts-brush-slide",onMouseEnter:this.handleEnterSlideOrTraveller,onMouseLeave:this.handleLeaveSlideOrTraveller,onMouseDown:this.handleSlideDragStart,onTouchStart:this.handleSlideDragStart,style:{cursor:"move"},stroke:"none",fill:l,fillOpacity:.2,x:u,y:a,width:d,height:o})}},{key:"renderText",value:function(){var n=this.props,i=n.startIndex,s=n.endIndex,a=n.y,o=n.height,l=n.travellerWidth,c=n.stroke,u=this.state,d=u.startX,f=u.endX,h=5,p={pointerEvents:"none",fill:c};return F.createElement(sr,{className:"recharts-brush-texts"},F.createElement(og,Lg({textAnchor:"end",verticalAnchor:"middle",x:Math.min(d,f)-h,y:a+o/2},p),this.getTextOfTick(i)),F.createElement(og,Lg({textAnchor:"start",verticalAnchor:"middle",x:Math.max(d,f)+l+h,y:a+o/2},p),this.getTextOfTick(s)))}},{key:"render",value:function(){var n=this.props,i=n.data,s=n.className,a=n.children,o=n.x,l=n.y,c=n.width,u=n.height,d=n.alwaysShowText,f=this.state,h=f.startX,p=f.endX,g=f.isTextActive,m=f.isSlideMoving,v=f.isTravellerMoving,y=f.isTravellerFocused;if(!i||!i.length||!ae(o)||!ae(l)||!ae(c)||!ae(u)||c<=0||u<=0)return null;var b=Me("recharts-brush",s),w=F.Children.count(a)===1,S=rSe("userSelect","none");return F.createElement(sr,{className:b,onMouseLeave:this.handleLeaveWrapper,onTouchMove:this.handleTouchMove,style:S},this.renderBackground(),w&&this.renderPanorama(),this.renderSlide(h,p),this.renderTravellerLayer(h,"startX"),this.renderTravellerLayer(p,"endX"),(g||m||v||y||d)&&this.renderText())}}],[{key:"renderDefaultTraveller",value:function(n){var i=n.x,s=n.y,a=n.width,o=n.height,l=n.stroke,c=Math.floor(s+o/2)-1;return F.createElement(F.Fragment,null,F.createElement("rect",{x:i,y:s,width:a,height:o,fill:l,stroke:"none"}),F.createElement("line",{x1:i+1,y1:c,x2:i+a-1,y2:c,fill:"none",stroke:"#fff"}),F.createElement("line",{x1:i+1,y1:c+2,x2:i+a-1,y2:c+2,fill:"none",stroke:"#fff"}))}},{key:"renderTraveller",value:function(n,i){var s;return F.isValidElement(n)?s=F.cloneElement(n,i):De(n)?s=n(i):s=e.renderDefaultTraveller(i),s}},{key:"getDerivedStateFromProps",value:function(n,i){var s=n.data,a=n.width,o=n.x,l=n.travellerWidth,c=n.updateId,u=n.startIndex,d=n.endIndex;if(s!==i.prevData||c!==i.prevUpdateId)return mb({prevData:s,prevTravellerWidth:l,prevUpdateId:c,prevX:o,prevWidth:a},s&&s.length?uSe({data:s,width:a,x:o,travellerWidth:l,startIndex:u,endIndex:d}):{scale:null,scaleValues:null});if(i.scale&&(a!==i.prevWidth||o!==i.prevX||l!==i.prevTravellerWidth)){i.scale.range([o,o+a-l]);var f=i.scale.domain().map(function(h){return i.scale(h)});return{prevData:s,prevTravellerWidth:l,prevUpdateId:c,prevX:o,prevWidth:a,startX:i.scale(n.startIndex),endX:i.scale(n.endIndex),scaleValues:f}}return null}},{key:"getIndexInRange",value:function(n,i){for(var s=n.length,a=0,o=s-1;o-a>1;){var l=Math.floor((a+o)/2);n[l]>i?o=l:a=l}return i>=n[o]?o:a}}])}(E.PureComponent);Zr($c,"displayName","Brush");Zr($c,"defaultProps",{height:40,travellerWidth:5,gap:1,fill:"#fff",stroke:"#666",padding:{top:1,right:1,bottom:1,left:1},leaveTimeOut:1e3,alwaysShowText:!1});var dSe=y_;function fSe(t,e){var r;return dSe(t,function(n,i,s){return r=e(n,i,s),!r}),!!r}var hSe=fSe,pSe=EF,mSe=yu,gSe=hSe,vSe=Yr,ySe=ry;function bSe(t,e,r){var n=vSe(t)?pSe:gSe;return r&&ySe(t,e,r)&&(e=void 0),n(t,mSe(e))}var xSe=bSe;const wSe=at(xSe);var Mi=function(e,r){var n=e.alwaysShow,i=e.ifOverflow;return n&&(i="extendDomain"),i===r},vk=VF;function SSe(t,e,r){e=="__proto__"&&vk?vk(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[e]=r}var ESe=SSe,TSe=ESe,_Se=GF,ASe=yu;function PSe(t,e){var r={};return e=ASe(e),_Se(t,function(n,i,s){TSe(r,i,e(n,i,s))}),r}var ISe=PSe;const CSe=at(ISe);function OSe(t,e){for(var r=-1,n=t==null?0:t.length;++r<n;)if(!e(t[r],r,t))return!1;return!0}var RSe=OSe,kSe=y_;function LSe(t,e){var r=!0;return kSe(t,function(n,i,s){return r=!!e(n,i,s),r}),r}var DSe=LSe,NSe=RSe,MSe=DSe,$Se=yu,jSe=Yr,FSe=ry;function BSe(t,e,r){var n=jSe(t)?NSe:MSe;return r&&FSe(t,e,r)&&(e=void 0),n(t,$Se(e))}var USe=BSe;const GSe=at(USe);var WSe=["x","y"];function jf(t){"@babel/helpers - typeof";return jf=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},jf(t)}function CS(){return CS=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},CS.apply(this,arguments)}function yk(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function Vu(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?yk(Object(r),!0).forEach(function(n){VSe(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):yk(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function VSe(t,e,r){return e=HSe(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function HSe(t){var e=KSe(t,"string");return jf(e)=="symbol"?e:e+""}function KSe(t,e){if(jf(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(jf(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function zSe(t,e){if(t==null)return{};var r=qSe(t,e),n,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(i=0;i<s.length;i++)n=s[i],!(e.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function qSe(t,e){if(t==null)return{};var r={};for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(e.indexOf(n)>=0)continue;r[n]=t[n]}return r}function YSe(t,e){var r=t.x,n=t.y,i=zSe(t,WSe),s="".concat(r),a=parseInt(s,10),o="".concat(n),l=parseInt(o,10),c="".concat(e.height||i.height),u=parseInt(c,10),d="".concat(e.width||i.width),f=parseInt(d,10);return Vu(Vu(Vu(Vu(Vu({},e),i),a?{x:a}:{}),l?{y:l}:{}),{},{height:u,width:f,name:e.name,radius:e.radius})}function bk(t){return F.createElement(Owe,CS({shapeType:"rectangle",propTransformer:YSe,activeClassName:"recharts-active-bar"},t))}var XSe=function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return function(n,i){if(typeof e=="number")return e;var s=ae(n)||one(n);return s?e(n,i):(s||Go(),r)}},QSe=["value","background"],bU;function jc(t){"@babel/helpers - typeof";return jc=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},jc(t)}function JSe(t,e){if(t==null)return{};var r=ZSe(t,e),n,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(i=0;i<s.length;i++)n=s[i],!(e.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function ZSe(t,e){if(t==null)return{};var r={};for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(e.indexOf(n)>=0)continue;r[n]=t[n]}return r}function Ng(){return Ng=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},Ng.apply(this,arguments)}function xk(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function jt(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?xk(Object(r),!0).forEach(function(n){la(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):xk(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function eEe(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function wk(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,wU(n.key),n)}}function tEe(t,e,r){return e&&wk(t.prototype,e),r&&wk(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function rEe(t,e,r){return e=Mg(e),nEe(t,xU()?Reflect.construct(e,r||[],Mg(t).constructor):e.apply(t,r))}function nEe(t,e){if(e&&(jc(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return iEe(t)}function iEe(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function xU(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(xU=function(){return!!t})()}function Mg(t){return Mg=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Mg(t)}function sEe(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&OS(t,e)}function OS(t,e){return OS=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},OS(t,e)}function la(t,e,r){return e=wU(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function wU(t){var e=aEe(t,"string");return jc(e)=="symbol"?e:e+""}function aEe(t,e){if(jc(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(jc(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}var $i=function(t){function e(){var r;eEe(this,e);for(var n=arguments.length,i=new Array(n),s=0;s<n;s++)i[s]=arguments[s];return r=rEe(this,e,[].concat(i)),la(r,"state",{isAnimationFinished:!1}),la(r,"id",Yv("recharts-bar-")),la(r,"handleAnimationEnd",function(){var a=r.props.onAnimationEnd;r.setState({isAnimationFinished:!0}),a&&a()}),la(r,"handleAnimationStart",function(){var a=r.props.onAnimationStart;r.setState({isAnimationFinished:!1}),a&&a()}),r}return sEe(e,t),tEe(e,[{key:"renderRectanglesStatically",value:function(n){var i=this,s=this.props,a=s.shape,o=s.dataKey,l=s.activeIndex,c=s.activeBar,u=Ue(this.props,!1);return n&&n.map(function(d,f){var h=f===l,p=h?c:a,g=jt(jt(jt({},u),d),{},{isActive:h,option:p,index:f,dataKey:o,onAnimationStart:i.handleAnimationStart,onAnimationEnd:i.handleAnimationEnd});return F.createElement(sr,Ng({className:"recharts-bar-rectangle"},zm(i.props,d,f),{key:"rectangle-".concat(d==null?void 0:d.x,"-").concat(d==null?void 0:d.y,"-").concat(d==null?void 0:d.value,"-").concat(f)}),F.createElement(bk,g))})}},{key:"renderRectanglesWithAnimation",value:function(){var n=this,i=this.props,s=i.data,a=i.layout,o=i.isAnimationActive,l=i.animationBegin,c=i.animationDuration,u=i.animationEasing,d=i.animationId,f=this.state.prevData;return F.createElement(Aa,{begin:l,duration:c,isActive:o,easing:u,from:{t:0},to:{t:1},key:"bar-".concat(d),onAnimationEnd:this.handleAnimationEnd,onAnimationStart:this.handleAnimationStart},function(h){var p=h.t,g=s.map(function(m,v){var y=f&&f[v];if(y){var b=hl(y.x,m.x),w=hl(y.y,m.y),S=hl(y.width,m.width),T=hl(y.height,m.height);return jt(jt({},m),{},{x:b(p),y:w(p),width:S(p),height:T(p)})}if(a==="horizontal"){var _=hl(0,m.height),A=_(p);return jt(jt({},m),{},{y:m.y+m.height-A,height:A})}var P=hl(0,m.width),C=P(p);return jt(jt({},m),{},{width:C})});return F.createElement(sr,null,n.renderRectanglesStatically(g))})}},{key:"renderRectangles",value:function(){var n=this.props,i=n.data,s=n.isAnimationActive,a=this.state.prevData;return s&&i&&i.length&&(!a||!W_(a,i))?this.renderRectanglesWithAnimation():this.renderRectanglesStatically(i)}},{key:"renderBackground",value:function(){var n=this,i=this.props,s=i.data,a=i.dataKey,o=i.activeIndex,l=Ue(this.props.background,!1);return s.map(function(c,u){c.value;var d=c.background,f=JSe(c,QSe);if(!d)return null;var h=jt(jt(jt(jt(jt({},f),{},{fill:"#eee"},d),l),zm(n.props,c,u)),{},{onAnimationStart:n.handleAnimationStart,onAnimationEnd:n.handleAnimationEnd,dataKey:a,index:u,className:"recharts-bar-background-rectangle"});return F.createElement(bk,Ng({key:"background-bar-".concat(u),option:n.props.background,isActive:u===o},h))})}},{key:"renderErrorBar",value:function(n,i){if(this.props.isAnimationActive&&!this.state.isAnimationFinished)return null;var s=this.props,a=s.data,o=s.xAxis,l=s.yAxis,c=s.layout,u=s.children,d=li(u,hy);if(!d)return null;var f=c==="vertical"?a[0].height/2:a[0].width/2,h=function(m,v){var y=Array.isArray(m.value)?m.value[1]:m.value;return{x:m.x,y:m.y,value:y,errorVal:Ui(m,v)}},p={clipPath:n?"url(#clipPath-".concat(i,")"):null};return F.createElement(sr,p,d.map(function(g){return F.cloneElement(g,{key:"error-bar-".concat(i,"-").concat(g.props.dataKey),data:a,xAxis:o,yAxis:l,layout:c,offset:f,dataPointFormatter:h})}))}},{key:"render",value:function(){var n=this.props,i=n.hide,s=n.data,a=n.className,o=n.xAxis,l=n.yAxis,c=n.left,u=n.top,d=n.width,f=n.height,h=n.isAnimationActive,p=n.background,g=n.id;if(i||!s||!s.length)return null;var m=this.state.isAnimationFinished,v=Me("recharts-bar",a),y=o&&o.allowDataOverflow,b=l&&l.allowDataOverflow,w=y||b,S=Fe(g)?this.id:g;return F.createElement(sr,{className:v},y||b?F.createElement("defs",null,F.createElement("clipPath",{id:"clipPath-".concat(S)},F.createElement("rect",{x:y?c:c-d/2,y:b?u:u-f/2,width:y?d:d*2,height:b?f:f*2}))):null,F.createElement(sr,{className:"recharts-bar-rectangles",clipPath:w?"url(#clipPath-".concat(S,")"):null},p?this.renderBackground():null,this.renderRectangles()),this.renderErrorBar(w,S),(!h||m)&&Io.renderCallByParent(this.props,s))}}],[{key:"getDerivedStateFromProps",value:function(n,i){return n.animationId!==i.prevAnimationId?{prevAnimationId:n.animationId,curData:n.data,prevData:i.curData}:n.data!==i.curData?{curData:n.data}:null}}])}(E.PureComponent);bU=$i;la($i,"displayName","Bar");la($i,"defaultProps",{xAxisId:0,yAxisId:0,legendType:"rect",minPointSize:0,hide:!1,data:[],layout:"vertical",activeBar:!1,isAnimationActive:!ah.isSsr,animationBegin:0,animationDuration:400,animationEasing:"ease"});la($i,"getComposedData",function(t){var e=t.props,r=t.item,n=t.barPosition,i=t.bandSize,s=t.xAxis,a=t.yAxis,o=t.xAxisTicks,l=t.yAxisTicks,c=t.stackedData,u=t.dataStartIndex,d=t.displayedData,f=t.offset,h=Oye(n,r);if(!h)return null;var p=e.layout,g=r.type.defaultProps,m=g!==void 0?jt(jt({},g),r.props):r.props,v=m.dataKey,y=m.children,b=m.minPointSize,w=p==="horizontal"?a:s,S=c?w.scale.domain():null,T=jye({numericAxis:w}),_=li(y,ff),A=d.map(function(P,C){var O,R,D,L,j,M;c?O=Rye(c[u+C],S):(O=Ui(P,v),Array.isArray(O)||(O=[T,O]));var N=XSe(b,bU.defaultProps.minPointSize)(O[1],C);if(p==="horizontal"){var k,$=[a.scale(O[0]),a.scale(O[1])],U=$[0],G=$[1];R=SR({axis:s,ticks:o,bandSize:i,offset:h.offset,entry:P,index:C}),D=(k=G??U)!==null&&k!==void 0?k:void 0,L=h.size;var B=U-G;if(j=Number.isNaN(B)?0:B,M={x:R,y:a.y,width:L,height:a.height},Math.abs(N)>0&&Math.abs(j)<Math.abs(N)){var K=si(j||N)*(Math.abs(N)-Math.abs(j));D-=K,j+=K}}else{var ee=[s.scale(O[0]),s.scale(O[1])],H=ee[0],J=ee[1];if(R=H,D=SR({axis:a,ticks:l,bandSize:i,offset:h.offset,entry:P,index:C}),L=J-H,j=h.size,M={x:s.x,y:D,width:s.width,height:j},Math.abs(N)>0&&Math.abs(L)<Math.abs(N)){var q=si(L||N)*(Math.abs(N)-Math.abs(L));L+=q}}return jt(jt(jt({},P),{},{x:R,y:D,width:L,height:j,value:c?O:O[1],payload:P,background:M},_&&_[C]&&_[C].props),{},{tooltipPayload:[eU(r,P)],tooltipPosition:{x:R+L/2,y:D+j/2}})});return jt({data:A,layout:p},f)});function Ff(t){"@babel/helpers - typeof";return Ff=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ff(t)}function oEe(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Sk(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,SU(n.key),n)}}function lEe(t,e,r){return e&&Sk(t.prototype,e),r&&Sk(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function Ek(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function ri(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Ek(Object(r),!0).forEach(function(n){gy(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Ek(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function gy(t,e,r){return e=SU(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function SU(t){var e=cEe(t,"string");return Ff(e)=="symbol"?e:e+""}function cEe(t,e){if(Ff(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(Ff(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var uEe=function(e,r,n,i,s){var a=e.width,o=e.height,l=e.layout,c=e.children,u=Object.keys(r),d={left:n.left,leftMirror:n.left,right:a-n.right,rightMirror:a-n.right,top:n.top,topMirror:n.top,bottom:o-n.bottom,bottomMirror:o-n.bottom},f=!!rn(c,$i);return u.reduce(function(h,p){var g=r[p],m=g.orientation,v=g.domain,y=g.padding,b=y===void 0?{}:y,w=g.mirror,S=g.reversed,T="".concat(m).concat(w?"Mirror":""),_,A,P,C,O;if(g.type==="number"&&(g.padding==="gap"||g.padding==="no-gap")){var R=v[1]-v[0],D=1/0,L=g.categoricalDomain.sort(une);if(L.forEach(function(ee,H){H>0&&(D=Math.min((ee||0)-(L[H-1]||0),D))}),Number.isFinite(D)){var j=D/R,M=g.layout==="vertical"?n.height:n.width;if(g.padding==="gap"&&(_=j*M/2),g.padding==="no-gap"){var N=Bo(e.barCategoryGap,j*M),k=j*M/2;_=k-N-(k-N)/M*N}}}i==="xAxis"?A=[n.left+(b.left||0)+(_||0),n.left+n.width-(b.right||0)-(_||0)]:i==="yAxis"?A=l==="horizontal"?[n.top+n.height-(b.bottom||0),n.top+(b.top||0)]:[n.top+(b.top||0)+(_||0),n.top+n.height-(b.bottom||0)-(_||0)]:A=g.range,S&&(A=[A[1],A[0]]);var $=Iye(g,s,f),U=$.scale,G=$.realScaleType;U.domain(v).range(A),Cye(U);var B=$ye(U,ri(ri({},g),{},{realScaleType:G}));i==="xAxis"?(O=m==="top"&&!w||m==="bottom"&&w,P=n.left,C=d[T]-O*g.height):i==="yAxis"&&(O=m==="left"&&!w||m==="right"&&w,P=d[T]-O*g.width,C=n.top);var K=ri(ri(ri({},g),B),{},{realScaleType:G,x:P,y:C,scale:U,width:i==="xAxis"?n.width:g.width,height:i==="yAxis"?n.height:g.height});return K.bandSize=Sg(K,B),!g.hide&&i==="xAxis"?d[T]+=(O?-1:1)*K.height:g.hide||(d[T]+=(O?-1:1)*K.width),ri(ri({},h),{},gy({},p,K))},{})},EU=function(e,r){var n=e.x,i=e.y,s=r.x,a=r.y;return{x:Math.min(n,s),y:Math.min(i,a),width:Math.abs(s-n),height:Math.abs(a-i)}},dEe=function(e){var r=e.x1,n=e.y1,i=e.x2,s=e.y2;return EU({x:r,y:n},{x:i,y:s})},TU=function(){function t(e){oEe(this,t),this.scale=e}return lEe(t,[{key:"domain",get:function(){return this.scale.domain}},{key:"range",get:function(){return this.scale.range}},{key:"rangeMin",get:function(){return this.range()[0]}},{key:"rangeMax",get:function(){return this.range()[1]}},{key:"bandwidth",get:function(){return this.scale.bandwidth}},{key:"apply",value:function(r){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=n.bandAware,s=n.position;if(r!==void 0){if(s)switch(s){case"start":return this.scale(r);case"middle":{var a=this.bandwidth?this.bandwidth()/2:0;return this.scale(r)+a}case"end":{var o=this.bandwidth?this.bandwidth():0;return this.scale(r)+o}default:return this.scale(r)}if(i){var l=this.bandwidth?this.bandwidth()/2:0;return this.scale(r)+l}return this.scale(r)}}},{key:"isInRange",value:function(r){var n=this.range(),i=n[0],s=n[n.length-1];return i<=s?r>=i&&r<=s:r>=s&&r<=i}}],[{key:"create",value:function(r){return new t(r)}}])}();gy(TU,"EPS",1e-4);var q_=function(e){var r=Object.keys(e).reduce(function(n,i){return ri(ri({},n),{},gy({},i,TU.create(e[i])))},{});return ri(ri({},r),{},{apply:function(i){var s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},a=s.bandAware,o=s.position;return CSe(i,function(l,c){return r[c].apply(l,{bandAware:a,position:o})})},isInRange:function(i){return GSe(i,function(s,a){return r[a].isInRange(s)})}})};function fEe(t){return(t%180+180)%180}var hEe=function(e){var r=e.width,n=e.height,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,s=fEe(i),a=s*Math.PI/180,o=Math.atan(n/r),l=a>o&&a<Math.PI-o?n/Math.sin(a):r/Math.cos(a);return Math.abs(l)},pEe=hre(function(t){return{x:t.left,y:t.top,width:t.width,height:t.height}},function(t){return["l",t.left,"t",t.top,"w",t.width,"h",t.height].join("")}),_U=E.createContext(void 0),AU=E.createContext(void 0),PU=E.createContext(void 0),mEe=E.createContext({}),IU=E.createContext(void 0),CU=E.createContext(0),OU=E.createContext(0),Tk=function(e){var r=e.state,n=r.xAxisMap,i=r.yAxisMap,s=r.offset,a=e.clipPathId,o=e.children,l=e.width,c=e.height,u=pEe(s);return F.createElement(_U.Provider,{value:n},F.createElement(AU.Provider,{value:i},F.createElement(mEe.Provider,{value:s},F.createElement(PU.Provider,{value:u},F.createElement(IU.Provider,{value:a},F.createElement(CU.Provider,{value:c},F.createElement(OU.Provider,{value:l},o)))))))},gEe=function(){return E.useContext(IU)},RU=function(e){var r=E.useContext(_U);r==null&&Go();var n=r[e];return n==null&&Go(),n},kU=function(e){var r=E.useContext(AU);r==null&&Go();var n=r[e];return n==null&&Go(),n},vEe=function(){var e=E.useContext(PU);return e},LU=function(){return E.useContext(OU)},DU=function(){return E.useContext(CU)};function Fc(t){"@babel/helpers - typeof";return Fc=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Fc(t)}function yEe(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function bEe(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,MU(n.key),n)}}function xEe(t,e,r){return e&&bEe(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function wEe(t,e,r){return e=$g(e),SEe(t,NU()?Reflect.construct(e,r||[],$g(t).constructor):e.apply(t,r))}function SEe(t,e){if(e&&(Fc(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return EEe(t)}function EEe(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function NU(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(NU=function(){return!!t})()}function $g(t){return $g=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},$g(t)}function TEe(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&RS(t,e)}function RS(t,e){return RS=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},RS(t,e)}function _k(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function Ak(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?_k(Object(r),!0).forEach(function(n){Y_(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):_k(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function Y_(t,e,r){return e=MU(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function MU(t){var e=_Ee(t,"string");return Fc(e)=="symbol"?e:e+""}function _Ee(t,e){if(Fc(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(Fc(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}function AEe(t,e){return OEe(t)||CEe(t,e)||IEe(t,e)||PEe()}function PEe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
353In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function IEe(t,e){if(t){if(typeof t=="string")return Pk(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Pk(t,e)}}function Pk(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function CEe(t,e){var r=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r!=null){var n,i,s,a,o=[],l=!0,c=!1;try{if(s=(r=r.call(t)).next,e!==0)for(;!(l=(n=s.call(r)).done)&&(o.push(n.value),o.length!==e);l=!0);}catch(u){c=!0,i=u}finally{try{if(!l&&r.return!=null&&(a=r.return(),Object(a)!==a))return}finally{if(c)throw i}}return o}}function OEe(t){if(Array.isArray(t))return t}function kS(){return kS=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},kS.apply(this,arguments)}var REe=function(e,r){var n;return F.isValidElement(e)?n=F.cloneElement(e,r):De(e)?n=e(r):n=F.createElement("line",kS({},r,{className:"recharts-reference-line-line"})),n},kEe=function(e,r,n,i,s,a,o,l,c){var u=s.x,d=s.y,f=s.width,h=s.height;if(n){var p=c.y,g=e.y.apply(p,{position:a});if(Mi(c,"discard")&&!e.y.isInRange(g))return null;var m=[{x:u+f,y:g},{x:u,y:g}];return l==="left"?m.reverse():m}if(r){var v=c.x,y=e.x.apply(v,{position:a});if(Mi(c,"discard")&&!e.x.isInRange(y))return null;var b=[{x:y,y:d+h},{x:y,y:d}];return o==="top"?b.reverse():b}if(i){var w=c.segment,S=w.map(function(T){return e.apply(T,{position:a})});return Mi(c,"discard")&&wSe(S,function(T){return!e.isInRange(T)})?null:S}return null};function LEe(t){var e=t.x,r=t.y,n=t.segment,i=t.xAxisId,s=t.yAxisId,a=t.shape,o=t.className,l=t.alwaysShow,c=gEe(),u=RU(i),d=kU(s),f=vEe();if(!c||!f)return null;_o(l===void 0,'The alwaysShow prop is deprecated. Please use ifOverflow="extendDomain" instead.');var h=q_({x:u.scale,y:d.scale}),p=Xt(e),g=Xt(r),m=n&&n.length===2,v=kEe(h,p,g,m,f,t.position,u.orientation,d.orientation,t);if(!v)return null;var y=AEe(v,2),b=y[0],w=b.x,S=b.y,T=y[1],_=T.x,A=T.y,P=Mi(t,"hidden")?"url(#".concat(c,")"):void 0,C=Ak(Ak({clipPath:P},Ue(t,!0)),{},{x1:w,y1:S,x2:_,y2:A});return F.createElement(sr,{className:Me("recharts-reference-line",o)},REe(a,C),Ar.renderCallByParent(t,dEe({x1:w,y1:S,x2:_,y2:A})))}var X_=function(t){function e(){return yEe(this,e),wEe(this,e,arguments)}return TEe(e,t),xEe(e,[{key:"render",value:function(){return F.createElement(LEe,this.props)}}])}(F.Component);Y_(X_,"displayName","ReferenceLine");Y_(X_,"defaultProps",{isFront:!1,ifOverflow:"discard",xAxisId:0,yAxisId:0,fill:"none",stroke:"#ccc",fillOpacity:1,strokeWidth:1,position:"middle"});function LS(){return LS=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},LS.apply(this,arguments)}function Bc(t){"@babel/helpers - typeof";return Bc=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Bc(t)}function Ik(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function Ck(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Ik(Object(r),!0).forEach(function(n){vy(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Ik(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function DEe(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function NEe(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,jU(n.key),n)}}function MEe(t,e,r){return e&&NEe(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function $Ee(t,e,r){return e=jg(e),jEe(t,$U()?Reflect.construct(e,r||[],jg(t).constructor):e.apply(t,r))}function jEe(t,e){if(e&&(Bc(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return FEe(t)}function FEe(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function $U(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return($U=function(){return!!t})()}function jg(t){return jg=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},jg(t)}function BEe(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&DS(t,e)}function DS(t,e){return DS=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},DS(t,e)}function vy(t,e,r){return e=jU(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function jU(t){var e=UEe(t,"string");return Bc(e)=="symbol"?e:e+""}function UEe(t,e){if(Bc(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(Bc(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}var GEe=function(e){var r=e.x,n=e.y,i=e.xAxis,s=e.yAxis,a=q_({x:i.scale,y:s.scale}),o=a.apply({x:r,y:n},{bandAware:!0});return Mi(e,"discard")&&!a.isInRange(o)?null:o},yy=function(t){function e(){return DEe(this,e),$Ee(this,e,arguments)}return BEe(e,t),MEe(e,[{key:"render",value:function(){var n=this.props,i=n.x,s=n.y,a=n.r,o=n.alwaysShow,l=n.clipPathId,c=Xt(i),u=Xt(s);if(_o(o===void 0,'The alwaysShow prop is deprecated. Please use ifOverflow="extendDomain" instead.'),!c||!u)return null;var d=GEe(this.props);if(!d)return null;var f=d.x,h=d.y,p=this.props,g=p.shape,m=p.className,v=Mi(this.props,"hidden")?"url(#".concat(l,")"):void 0,y=Ck(Ck({clipPath:v},Ue(this.props,!0)),{},{cx:f,cy:h});return F.createElement(sr,{className:Me("recharts-reference-dot",m)},e.renderDot(g,y),Ar.renderCallByParent(this.props,{x:f-a,y:h-a,width:2*a,height:2*a}))}}])}(F.Component);vy(yy,"displayName","ReferenceDot");vy(yy,"defaultProps",{isFront:!1,ifOverflow:"discard",xAxisId:0,yAxisId:0,r:10,fill:"#fff",stroke:"#ccc",fillOpacity:1,strokeWidth:1});vy(yy,"renderDot",function(t,e){var r;return F.isValidElement(t)?r=F.cloneElement(t,e):De(t)?r=t(e):r=F.createElement(pU,LS({},e,{cx:e.cx,cy:e.cy,className:"recharts-reference-dot-dot"})),r});function NS(){return NS=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},NS.apply(this,arguments)}function Uc(t){"@babel/helpers - typeof";return Uc=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Uc(t)}function Ok(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function Rk(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Ok(Object(r),!0).forEach(function(n){by(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Ok(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function WEe(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function VEe(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,BU(n.key),n)}}function HEe(t,e,r){return e&&VEe(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function KEe(t,e,r){return e=Fg(e),zEe(t,FU()?Reflect.construct(e,r||[],Fg(t).constructor):e.apply(t,r))}function zEe(t,e){if(e&&(Uc(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return qEe(t)}function qEe(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function FU(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(FU=function(){return!!t})()}function Fg(t){return Fg=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Fg(t)}function YEe(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&MS(t,e)}function MS(t,e){return MS=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},MS(t,e)}function by(t,e,r){return e=BU(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function BU(t){var e=XEe(t,"string");return Uc(e)=="symbol"?e:e+""}function XEe(t,e){if(Uc(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(Uc(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}var QEe=function(e,r,n,i,s){var a=s.x1,o=s.x2,l=s.y1,c=s.y2,u=s.xAxis,d=s.yAxis;if(!u||!d)return null;var f=q_({x:u.scale,y:d.scale}),h={x:e?f.x.apply(a,{position:"start"}):f.x.rangeMin,y:n?f.y.apply(l,{position:"start"}):f.y.rangeMin},p={x:r?f.x.apply(o,{position:"end"}):f.x.rangeMax,y:i?f.y.apply(c,{position:"end"}):f.y.rangeMax};return Mi(s,"discard")&&(!f.isInRange(h)||!f.isInRange(p))?null:EU(h,p)},xy=function(t){function e(){return WEe(this,e),KEe(this,e,arguments)}return YEe(e,t),HEe(e,[{key:"render",value:function(){var n=this.props,i=n.x1,s=n.x2,a=n.y1,o=n.y2,l=n.className,c=n.alwaysShow,u=n.clipPathId;_o(c===void 0,'The alwaysShow prop is deprecated. Please use ifOverflow="extendDomain" instead.');var d=Xt(i),f=Xt(s),h=Xt(a),p=Xt(o),g=this.props.shape;if(!d&&!f&&!h&&!p&&!g)return null;var m=QEe(d,f,h,p,this.props);if(!m&&!g)return null;var v=Mi(this.props,"hidden")?"url(#".concat(u,")"):void 0;return F.createElement(sr,{className:Me("recharts-reference-area",l)},e.renderRect(g,Rk(Rk({clipPath:v},Ue(this.props,!0)),m)),Ar.renderCallByParent(this.props,m))}}])}(F.Component);by(xy,"displayName","ReferenceArea");by(xy,"defaultProps",{isFront:!1,ifOverflow:"discard",xAxisId:0,yAxisId:0,r:10,fill:"#ccc",fillOpacity:.5,stroke:"none",strokeWidth:1});by(xy,"renderRect",function(t,e){var r;return F.isValidElement(t)?r=F.cloneElement(t,e):De(t)?r=t(e):r=F.createElement(z_,NS({},e,{className:"recharts-reference-area-rect"})),r});function UU(t,e,r){if(e<1)return[];if(e===1&&r===void 0)return t;for(var n=[],i=0;i<t.length;i+=e)n.push(t[i]);return n}function JEe(t,e,r){var n={width:t.width+e.width,height:t.height+e.height};return hEe(n,r)}function ZEe(t,e,r){var n=r==="width",i=t.x,s=t.y,a=t.width,o=t.height;return e===1?{start:n?i:s,end:n?i+a:s+o}:{start:n?i+a:s+o,end:n?i:s}}function Bg(t,e,r,n,i){if(t*e<t*n||t*e>t*i)return!1;var s=r();return t*(e-t*s/2-n)>=0&&t*(e+t*s/2-i)<=0}function eTe(t,e){return UU(t,e+1)}function tTe(t,e,r,n,i){for(var s=(n||[]).slice(),a=e.start,o=e.end,l=0,c=1,u=a,d=function(){var p=n==null?void 0:n[l];if(p===void 0)return{v:UU(n,c)};var g=l,m,v=function(){return m===void 0&&(m=r(p,g)),m},y=p.coordinate,b=l===0||Bg(t,y,v,u,o);b||(l=0,u=a,c+=1),b&&(u=y+t*(v()/2+i),l+=c)},f;c<=s.length;)if(f=d(),f)return f.v;return[]}function Bf(t){"@babel/helpers - typeof";return Bf=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Bf(t)}function kk(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function Tr(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?kk(Object(r),!0).forEach(function(n){rTe(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):kk(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function rTe(t,e,r){return e=nTe(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function nTe(t){var e=iTe(t,"string");return Bf(e)=="symbol"?e:e+""}function iTe(t,e){if(Bf(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(Bf(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function sTe(t,e,r,n,i){for(var s=(n||[]).slice(),a=s.length,o=e.start,l=e.end,c=function(f){var h=s[f],p,g=function(){return p===void 0&&(p=r(h,f)),p};if(f===a-1){var m=t*(h.coordinate+t*g()/2-l);s[f]=h=Tr(Tr({},h),{},{tickCoord:m>0?h.coordinate-m*t:h.coordinate})}else s[f]=h=Tr(Tr({},h),{},{tickCoord:h.coordinate});var v=Bg(t,h.tickCoord,g,o,l);v&&(l=h.tickCoord-t*(g()/2+i),s[f]=Tr(Tr({},h),{},{isShow:!0}))},u=a-1;u>=0;u--)c(u);return s}function aTe(t,e,r,n,i,s){var a=(n||[]).slice(),o=a.length,l=e.start,c=e.end;if(s){var u=n[o-1],d=r(u,o-1),f=t*(u.coordinate+t*d/2-c);a[o-1]=u=Tr(Tr({},u),{},{tickCoord:f>0?u.coordinate-f*t:u.coordinate});var h=Bg(t,u.tickCoord,function(){return d},l,c);h&&(c=u.tickCoord-t*(d/2+i),a[o-1]=Tr(Tr({},u),{},{isShow:!0}))}for(var p=s?o-1:o,g=function(y){var b=a[y],w,S=function(){return w===void 0&&(w=r(b,y)),w};if(y===0){var T=t*(b.coordinate-t*S()/2-l);a[y]=b=Tr(Tr({},b),{},{tickCoord:T<0?b.coordinate-T*t:b.coordinate})}else a[y]=b=Tr(Tr({},b),{},{tickCoord:b.coordinate});var _=Bg(t,b.tickCoord,S,l,c);_&&(l=b.tickCoord+t*(S()/2+i),a[y]=Tr(Tr({},b),{},{isShow:!0}))},m=0;m<p;m++)g(m);return a}function oTe(t,e,r){var n=t.tick,i=t.ticks,s=t.viewBox,a=t.minTickGap,o=t.orientation,l=t.interval,c=t.tickFormatter,u=t.unit,d=t.angle;if(!i||!i.length||!n)return[];if(ae(l)||ah.isSsr)return eTe(i,typeof l=="number"&&ae(l)?l:0);var f=[],h=o==="top"||o==="bottom"?"width":"height",p=u&&h==="width"?yd(u,{fontSize:e,letterSpacing:r}):{width:0,height:0},g=function(b,w){var S=De(c)?c(b.value,w):b.value;return h==="width"?JEe(yd(S,{fontSize:e,letterSpacing:r}),p,d):yd(S,{fontSize:e,letterSpacing:r})[h]},m=i.length>=2?si(i[1].coordinate-i[0].coordinate):1,v=ZEe(s,m,h);return l==="equidistantPreserveStart"?tTe(m,v,g,i,a):(l==="preserveStart"||l==="preserveStartEnd"?f=aTe(m,v,g,i,a,l==="preserveStartEnd"):f=sTe(m,v,g,i,a),f.filter(function(y){return y.isShow}))}var lTe=["viewBox"],cTe=["viewBox"],uTe=["ticks"];function Gc(t){"@babel/helpers - typeof";return Gc=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Gc(t)}function Bl(){return Bl=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},Bl.apply(this,arguments)}function Lk(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function Wt(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Lk(Object(r),!0).forEach(function(n){Q_(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Lk(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function gb(t,e){if(t==null)return{};var r=dTe(t,e),n,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(i=0;i<s.length;i++)n=s[i],!(e.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function dTe(t,e){if(t==null)return{};var r={};for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(e.indexOf(n)>=0)continue;r[n]=t[n]}return r}function fTe(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Dk(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,WU(n.key),n)}}function hTe(t,e,r){return e&&Dk(t.prototype,e),r&&Dk(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function pTe(t,e,r){return e=Ug(e),mTe(t,GU()?Reflect.construct(e,r||[],Ug(t).constructor):e.apply(t,r))}function mTe(t,e){if(e&&(Gc(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return gTe(t)}function gTe(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function GU(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(GU=function(){return!!t})()}function Ug(t){return Ug=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Ug(t)}function vTe(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&$S(t,e)}function $S(t,e){return $S=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},$S(t,e)}function Q_(t,e,r){return e=WU(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function WU(t){var e=yTe(t,"string");return Gc(e)=="symbol"?e:e+""}function yTe(t,e){if(Gc(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(Gc(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}var wy=function(t){function e(r){var n;return fTe(this,e),n=pTe(this,e,[r]),n.state={fontSize:"",letterSpacing:""},n}return vTe(e,t),hTe(e,[{key:"shouldComponentUpdate",value:function(n,i){var s=n.viewBox,a=gb(n,lTe),o=this.props,l=o.viewBox,c=gb(o,cTe);return!tc(s,l)||!tc(a,c)||!tc(i,this.state)}},{key:"componentDidMount",value:function(){var n=this.layerReference;if(n){var i=n.getElementsByClassName("recharts-cartesian-axis-tick-value")[0];i&&this.setState({fontSize:window.getComputedStyle(i).fontSize,letterSpacing:window.getComputedStyle(i).letterSpacing})}}},{key:"getTickLineCoord",value:function(n){var i=this.props,s=i.x,a=i.y,o=i.width,l=i.height,c=i.orientation,u=i.tickSize,d=i.mirror,f=i.tickMargin,h,p,g,m,v,y,b=d?-1:1,w=n.tickSize||u,S=ae(n.tickCoord)?n.tickCoord:n.coordinate;switch(c){case"top":h=p=n.coordinate,m=a+ +!d*l,g=m-b*w,y=g-b*f,v=S;break;case"left":g=m=n.coordinate,p=s+ +!d*o,h=p-b*w,v=h-b*f,y=S;break;case"right":g=m=n.coordinate,p=s+ +d*o,h=p+b*w,v=h+b*f,y=S;break;default:h=p=n.coordinate,m=a+ +d*l,g=m+b*w,y=g+b*f,v=S;break}return{line:{x1:h,y1:g,x2:p,y2:m},tick:{x:v,y}}}},{key:"getTickTextAnchor",value:function(){var n=this.props,i=n.orientation,s=n.mirror,a;switch(i){case"left":a=s?"start":"end";break;case"right":a=s?"end":"start";break;default:a="middle";break}return a}},{key:"getTickVerticalAnchor",value:function(){var n=this.props,i=n.orientation,s=n.mirror,a="end";switch(i){case"left":case"right":a="middle";break;case"top":a=s?"start":"end";break;default:a=s?"end":"start";break}return a}},{key:"renderAxisLine",value:function(){var n=this.props,i=n.x,s=n.y,a=n.width,o=n.height,l=n.orientation,c=n.mirror,u=n.axisLine,d=Wt(Wt(Wt({},Ue(this.props,!1)),Ue(u,!1)),{},{fill:"none"});if(l==="top"||l==="bottom"){var f=+(l==="top"&&!c||l==="bottom"&&c);d=Wt(Wt({},d),{},{x1:i,y1:s+f*o,x2:i+a,y2:s+f*o})}else{var h=+(l==="left"&&!c||l==="right"&&c);d=Wt(Wt({},d),{},{x1:i+h*a,y1:s,x2:i+h*a,y2:s+o})}return F.createElement("line",Bl({},d,{className:Me("recharts-cartesian-axis-line",In(u,"className"))}))}},{key:"renderTicks",value:function(n,i,s){var a=this,o=this.props,l=o.tickLine,c=o.stroke,u=o.tick,d=o.tickFormatter,f=o.unit,h=oTe(Wt(Wt({},this.props),{},{ticks:n}),i,s),p=this.getTickTextAnchor(),g=this.getTickVerticalAnchor(),m=Ue(this.props,!1),v=Ue(u,!1),y=Wt(Wt({},m),{},{fill:"none"},Ue(l,!1)),b=h.map(function(w,S){var T=a.getTickLineCoord(w),_=T.line,A=T.tick,P=Wt(Wt(Wt(Wt({textAnchor:p,verticalAnchor:g},m),{},{stroke:"none",fill:c},v),A),{},{index:S,payload:w,visibleTicksCount:h.length,tickFormatter:d});return F.createElement(sr,Bl({className:"recharts-cartesian-axis-tick",key:"tick-".concat(w.value,"-").concat(w.coordinate,"-").concat(w.tickCoord)},zm(a.props,w,S)),l&&F.createElement("line",Bl({},y,_,{className:Me("recharts-cartesian-axis-tick-line",In(l,"className"))})),u&&e.renderTickItem(u,P,"".concat(De(d)?d(w.value,S):w.value).concat(f||"")))});return F.createElement("g",{className:"recharts-cartesian-axis-ticks"},b)}},{key:"render",value:function(){var n=this,i=this.props,s=i.axisLine,a=i.width,o=i.height,l=i.ticksGenerator,c=i.className,u=i.hide;if(u)return null;var d=this.props,f=d.ticks,h=gb(d,uTe),p=f;return De(l)&&(p=f&&f.length>0?l(this.props):l(h)),a<=0||o<=0||!p||!p.length?null:F.createElement(sr,{className:Me("recharts-cartesian-axis",c),ref:function(m){n.layerReference=m}},s&&this.renderAxisLine(),this.renderTicks(p,this.state.fontSize,this.state.letterSpacing),Ar.renderCallByParent(this.props))}}],[{key:"renderTickItem",value:function(n,i,s){var a,o=Me(i.className,"recharts-cartesian-axis-tick-value");return F.isValidElement(n)?a=F.cloneElement(n,Wt(Wt({},i),{},{className:o})):De(n)?a=n(Wt(Wt({},i),{},{className:o})):a=F.createElement(og,Bl({},i,{className:"recharts-cartesian-axis-tick-value"}),s),a}}])}(E.Component);Q_(wy,"displayName","CartesianAxis");Q_(wy,"defaultProps",{x:0,y:0,width:0,height:0,viewBox:{x:0,y:0,width:0,height:0},orientation:"bottom",ticks:[],stroke:"#666",tickLine:!0,axisLine:!0,tick:!0,mirror:!1,minTickGap:5,tickSize:6,tickMargin:2,interval:"preserveEnd"});function Wc(t){"@babel/helpers - typeof";return Wc=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Wc(t)}function bTe(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function xTe(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,KU(n.key),n)}}function wTe(t,e,r){return e&&xTe(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function STe(t,e,r){return e=Gg(e),ETe(t,VU()?Reflect.construct(e,r||[],Gg(t).constructor):e.apply(t,r))}function ETe(t,e){if(e&&(Wc(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return TTe(t)}function TTe(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function VU(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(VU=function(){return!!t})()}function Gg(t){return Gg=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Gg(t)}function _Te(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&jS(t,e)}function jS(t,e){return jS=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},jS(t,e)}function HU(t,e,r){return e=KU(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function KU(t){var e=ATe(t,"string");return Wc(e)=="symbol"?e:e+""}function ATe(t,e){if(Wc(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(Wc(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}function FS(){return FS=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},FS.apply(this,arguments)}function PTe(t){var e=t.xAxisId,r=LU(),n=DU(),i=RU(e);return i==null?null:E.createElement(wy,FS({},i,{className:Me("recharts-".concat(i.axisType," ").concat(i.axisType),i.className),viewBox:{x:0,y:0,width:r,height:n},ticksGenerator:function(a){return ho(a,!0)}}))}var Co=function(t){function e(){return bTe(this,e),STe(this,e,arguments)}return _Te(e,t),wTe(e,[{key:"render",value:function(){return E.createElement(PTe,this.props)}}])}(E.Component);HU(Co,"displayName","XAxis");HU(Co,"defaultProps",{allowDecimals:!0,hide:!1,orientation:"bottom",width:0,height:30,mirror:!1,xAxisId:0,tickCount:5,type:"category",padding:{left:0,right:0},allowDataOverflow:!1,scale:"auto",reversed:!1,allowDuplicatedCategory:!0});function Vc(t){"@babel/helpers - typeof";return Vc=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Vc(t)}function ITe(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function CTe(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,YU(n.key),n)}}function OTe(t,e,r){return e&&CTe(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function RTe(t,e,r){return e=Wg(e),kTe(t,zU()?Reflect.construct(e,r||[],Wg(t).constructor):e.apply(t,r))}function kTe(t,e){if(e&&(Vc(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return LTe(t)}function LTe(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function zU(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(zU=function(){return!!t})()}function Wg(t){return Wg=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Wg(t)}function DTe(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&BS(t,e)}function BS(t,e){return BS=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},BS(t,e)}function qU(t,e,r){return e=YU(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function YU(t){var e=NTe(t,"string");return Vc(e)=="symbol"?e:e+""}function NTe(t,e){if(Vc(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(Vc(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}function US(){return US=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},US.apply(this,arguments)}var MTe=function(e){var r=e.yAxisId,n=LU(),i=DU(),s=kU(r);return s==null?null:E.createElement(wy,US({},s,{className:Me("recharts-".concat(s.axisType," ").concat(s.axisType),s.className),viewBox:{x:0,y:0,width:n,height:i},ticksGenerator:function(o){return ho(o,!0)}}))},Oo=function(t){function e(){return ITe(this,e),RTe(this,e,arguments)}return DTe(e,t),OTe(e,[{key:"render",value:function(){return E.createElement(MTe,this.props)}}])}(E.Component);qU(Oo,"displayName","YAxis");qU(Oo,"defaultProps",{allowDuplicatedCategory:!0,allowDecimals:!0,hide:!1,orientation:"left",width:60,height:0,mirror:!1,yAxisId:0,tickCount:5,type:"number",padding:{top:0,bottom:0},allowDataOverflow:!1,scale:"auto",reversed:!1});function Nk(t){return BTe(t)||FTe(t)||jTe(t)||$Te()}function $Te(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
354In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function jTe(t,e){if(t){if(typeof t=="string")return GS(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return GS(t,e)}}function FTe(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function BTe(t){if(Array.isArray(t))return GS(t)}function GS(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var WS=function(e,r,n,i,s){var a=li(e,X_),o=li(e,yy),l=[].concat(Nk(a),Nk(o)),c=li(e,xy),u="".concat(i,"Id"),d=i[0],f=r;if(l.length&&(f=l.reduce(function(g,m){if(m.props[u]===n&&Mi(m.props,"extendDomain")&&ae(m.props[d])){var v=m.props[d];return[Math.min(g[0],v),Math.max(g[1],v)]}return g},f)),c.length){var h="".concat(d,"1"),p="".concat(d,"2");f=c.reduce(function(g,m){if(m.props[u]===n&&Mi(m.props,"extendDomain")&&ae(m.props[h])&&ae(m.props[p])){var v=m.props[h],y=m.props[p];return[Math.min(g[0],v,y),Math.max(g[1],v,y)]}return g},f)}return s&&s.length&&(f=s.reduce(function(g,m){return ae(m)?[Math.min(g[0],m),Math.max(g[1],m)]:g},f)),f},XU={exports:{}};(function(t){var e=Object.prototype.hasOwnProperty,r="~";function n(){}Object.create&&(n.prototype=Object.create(null),new n().__proto__||(r=!1));function i(l,c,u){this.fn=l,this.context=c,this.once=u||!1}function s(l,c,u,d,f){if(typeof u!="function")throw new TypeError("The listener must be a function");var h=new i(u,d||l,f),p=r?r+c:c;return l._events[p]?l._events[p].fn?l._events[p]=[l._events[p],h]:l._events[p].push(h):(l._events[p]=h,l._eventsCount++),l}function a(l,c){--l._eventsCount===0?l._events=new n:delete l._events[c]}function o(){this._events=new n,this._eventsCount=0}o.prototype.eventNames=function(){var c=[],u,d;if(this._eventsCount===0)return c;for(d in u=this._events)e.call(u,d)&&c.push(r?d.slice(1):d);return Object.getOwnPropertySymbols?c.concat(Object.getOwnPropertySymbols(u)):c},o.prototype.listeners=function(c){var u=r?r+c:c,d=this._events[u];if(!d)return[];if(d.fn)return[d.fn];for(var f=0,h=d.length,p=new Array(h);f<h;f++)p[f]=d[f].fn;return p},o.prototype.listenerCount=function(c){var u=r?r+c:c,d=this._events[u];return d?d.fn?1:d.length:0},o.prototype.emit=function(c,u,d,f,h,p){var g=r?r+c:c;if(!this._events[g])return!1;var m=this._events[g],v=arguments.length,y,b;if(m.fn){switch(m.once&&this.removeListener(c,m.fn,void 0,!0),v){case 1:return m.fn.call(m.context),!0;case 2:return m.fn.call(m.context,u),!0;case 3:return m.fn.call(m.context,u,d),!0;case 4:return m.fn.call(m.context,u,d,f),!0;case 5:return m.fn.call(m.context,u,d,f,h),!0;case 6:return m.fn.call(m.context,u,d,f,h,p),!0}for(b=1,y=new Array(v-1);b<v;b++)y[b-1]=arguments[b];m.fn.apply(m.context,y)}else{var w=m.length,S;for(b=0;b<w;b++)switch(m[b].once&&this.removeListener(c,m[b].fn,void 0,!0),v){case 1:m[b].fn.call(m[b].context);break;case 2:m[b].fn.call(m[b].context,u);break;case 3:m[b].fn.call(m[b].context,u,d);break;case 4:m[b].fn.call(m[b].context,u,d,f);break;default:if(!y)for(S=1,y=new Array(v-1);S<v;S++)y[S-1]=arguments[S];m[b].fn.apply(m[b].context,y)}}return!0},o.prototype.on=function(c,u,d){return s(this,c,u,d,!1)},o.prototype.once=function(c,u,d){return s(this,c,u,d,!0)},o.prototype.removeListener=function(c,u,d,f){var h=r?r+c:c;if(!this._events[h])return this;if(!u)return a(this,h),this;var p=this._events[h];if(p.fn)p.fn===u&&(!f||p.once)&&(!d||p.context===d)&&a(this,h);else{for(var g=0,m=[],v=p.length;g<v;g++)(p[g].fn!==u||f&&!p[g].once||d&&p[g].context!==d)&&m.push(p[g]);m.length?this._events[h]=m.length===1?m[0]:m:a(this,h)}return this},o.prototype.removeAllListeners=function(c){var u;return c?(u=r?r+c:c,this._events[u]&&a(this,u)):(this._events=new n,this._eventsCount=0),this},o.prototype.off=o.prototype.removeListener,o.prototype.addListener=o.prototype.on,o.prefixed=r,o.EventEmitter=o,t.exports=o})(XU);var UTe=XU.exports;const GTe=at(UTe);var vb=new GTe,yb="recharts.syncMouseEvents";function Uf(t){"@babel/helpers - typeof";return Uf=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Uf(t)}function WTe(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function VTe(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,QU(n.key),n)}}function HTe(t,e,r){return e&&VTe(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function bb(t,e,r){return e=QU(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function QU(t){var e=KTe(t,"string");return Uf(e)=="symbol"?e:e+""}function KTe(t,e){if(Uf(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(Uf(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}var zTe=function(){function t(){WTe(this,t),bb(this,"activeIndex",0),bb(this,"coordinateList",[]),bb(this,"layout","horizontal")}return HTe(t,[{key:"setDetails",value:function(r){var n,i=r.coordinateList,s=i===void 0?null:i,a=r.container,o=a===void 0?null:a,l=r.layout,c=l===void 0?null:l,u=r.offset,d=u===void 0?null:u,f=r.mouseHandlerCallback,h=f===void 0?null:f;this.coordinateList=(n=s??this.coordinateList)!==null&&n!==void 0?n:[],this.container=o??this.container,this.layout=c??this.layout,this.offset=d??this.offset,this.mouseHandlerCallback=h??this.mouseHandlerCallback,this.activeIndex=Math.min(Math.max(this.activeIndex,0),this.coordinateList.length-1)}},{key:"focus",value:function(){this.spoofMouse()}},{key:"keyboardEvent",value:function(r){if(this.coordinateList.length!==0)switch(r.key){case"ArrowRight":{if(this.layout!=="horizontal")return;this.activeIndex=Math.min(this.activeIndex+1,this.coordinateList.length-1),this.spoofMouse();break}case"ArrowLeft":{if(this.layout!=="horizontal")return;this.activeIndex=Math.max(this.activeIndex-1,0),this.spoofMouse();break}}}},{key:"setIndex",value:function(r){this.activeIndex=r}},{key:"spoofMouse",value:function(){var r,n;if(this.layout==="horizontal"&&this.coordinateList.length!==0){var i=this.container.getBoundingClientRect(),s=i.x,a=i.y,o=i.height,l=this.coordinateList[this.activeIndex].coordinate,c=((r=window)===null||r===void 0?void 0:r.scrollX)||0,u=((n=window)===null||n===void 0?void 0:n.scrollY)||0,d=s+l+c,f=a+this.offset.top+o/2+u;this.mouseHandlerCallback({pageX:d,pageY:f})}}}])}();function qTe(t,e,r){if(r==="number"&&e===!0&&Array.isArray(t)){var n=t==null?void 0:t[0],i=t==null?void 0:t[1];if(n&&i&&ae(n)&&ae(i))return!0}return!1}function YTe(t,e,r,n){var i=n/2;return{stroke:"none",fill:"#ccc",x:t==="horizontal"?e.x-i:r.left+.5,y:t==="horizontal"?r.top+.5:e.y-i,width:t==="horizontal"?n:r.width-1,height:t==="horizontal"?r.height-1:n}}function JU(t){var e=t.cx,r=t.cy,n=t.radius,i=t.startAngle,s=t.endAngle,a=gr(e,r,n,i),o=gr(e,r,n,s);return{points:[a,o],cx:e,cy:r,radius:n,startAngle:i,endAngle:s}}function XTe(t,e,r){var n,i,s,a;if(t==="horizontal")n=e.x,s=n,i=r.top,a=r.top+r.height;else if(t==="vertical")i=e.y,a=i,n=r.left,s=r.left+r.width;else if(e.cx!=null&&e.cy!=null)if(t==="centric"){var o=e.cx,l=e.cy,c=e.innerRadius,u=e.outerRadius,d=e.angle,f=gr(o,l,c,d),h=gr(o,l,u,d);n=f.x,i=f.y,s=h.x,a=h.y}else return JU(e);return[{x:n,y:i},{x:s,y:a}]}function Gf(t){"@babel/helpers - typeof";return Gf=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Gf(t)}function Mk(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function xp(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Mk(Object(r),!0).forEach(function(n){QTe(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Mk(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function QTe(t,e,r){return e=JTe(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function JTe(t){var e=ZTe(t,"string");return Gf(e)=="symbol"?e:e+""}function ZTe(t,e){if(Gf(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(Gf(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function e_e(t){var e,r,n=t.element,i=t.tooltipEventType,s=t.isActive,a=t.activeCoordinate,o=t.activePayload,l=t.offset,c=t.activeTooltipIndex,u=t.tooltipAxisBandSize,d=t.layout,f=t.chartName,h=(e=n.props.cursor)!==null&&e!==void 0?e:(r=n.type.defaultProps)===null||r===void 0?void 0:r.cursor;if(!n||!h||!s||!a||f!=="ScatterChart"&&i!=="axis")return null;var p,g=jR;if(f==="ScatterChart")p=a,g=Vxe;else if(f==="BarChart")p=YTe(d,a,l,u),g=z_;else if(d==="radial"){var m=JU(a),v=m.cx,y=m.cy,b=m.radius,w=m.startAngle,S=m.endAngle;p={cx:v,cy:y,startAngle:w,endAngle:S,innerRadius:b,outerRadius:b},g=nU}else p={points:XTe(d,a,l)},g=jR;var T=xp(xp(xp(xp({stroke:"#ccc",pointerEvents:"none"},l),p),Ue(h,!1)),{},{payload:o,payloadIndex:c,className:Me("recharts-tooltip-cursor",h.className)});return E.isValidElement(h)?E.cloneElement(h,T):E.createElement(g,T)}var t_e=["item"],r_e=["children","className","width","height","style","compact","title","desc"];function Hc(t){"@babel/helpers - typeof";return Hc=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Hc(t)}function Ul(){return Ul=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},Ul.apply(this,arguments)}function $k(t,e){return s_e(t)||i_e(t,e)||e3(t,e)||n_e()}function n_e(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
355In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function i_e(t,e){var r=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r!=null){var n,i,s,a,o=[],l=!0,c=!1;try{if(s=(r=r.call(t)).next,e!==0)for(;!(l=(n=s.call(r)).done)&&(o.push(n.value),o.length!==e);l=!0);}catch(u){c=!0,i=u}finally{try{if(!l&&r.return!=null&&(a=r.return(),Object(a)!==a))return}finally{if(c)throw i}}return o}}function s_e(t){if(Array.isArray(t))return t}function jk(t,e){if(t==null)return{};var r=a_e(t,e),n,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(i=0;i<s.length;i++)n=s[i],!(e.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function a_e(t,e){if(t==null)return{};var r={};for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(e.indexOf(n)>=0)continue;r[n]=t[n]}return r}function o_e(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function l_e(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,t3(n.key),n)}}function c_e(t,e,r){return e&&l_e(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function u_e(t,e,r){return e=Vg(e),d_e(t,ZU()?Reflect.construct(e,r||[],Vg(t).constructor):e.apply(t,r))}function d_e(t,e){if(e&&(Hc(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return f_e(t)}function f_e(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function ZU(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(ZU=function(){return!!t})()}function Vg(t){return Vg=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Vg(t)}function h_e(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&VS(t,e)}function VS(t,e){return VS=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},VS(t,e)}function Kc(t){return g_e(t)||m_e(t)||e3(t)||p_e()}function p_e(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
356In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function e3(t,e){if(t){if(typeof t=="string")return HS(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return HS(t,e)}}function m_e(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function g_e(t){if(Array.isArray(t))return HS(t)}function HS(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function Fk(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function Y(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Fk(Object(r),!0).forEach(function(n){ge(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Fk(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function ge(t,e,r){return e=t3(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function t3(t){var e=v_e(t,"string");return Hc(e)=="symbol"?e:e+""}function v_e(t,e){if(Hc(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(Hc(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var y_e={xAxis:["bottom","top"],yAxis:["left","right"]},b_e={width:"100%",height:"100%"},r3={x:0,y:0};function wp(t){return t}var x_e=function(e,r){return r==="horizontal"?e.x:r==="vertical"?e.y:r==="centric"?e.angle:e.radius},w_e=function(e,r,n,i){var s=r.find(function(u){return u&&u.index===n});if(s){if(e==="horizontal")return{x:s.coordinate,y:i.y};if(e==="vertical")return{x:i.x,y:s.coordinate};if(e==="centric"){var a=s.coordinate,o=i.radius;return Y(Y(Y({},i),gr(i.cx,i.cy,o,a)),{},{angle:a,radius:o})}var l=s.coordinate,c=i.angle;return Y(Y(Y({},i),gr(i.cx,i.cy,l,c)),{},{angle:c,radius:l})}return r3},Sy=function(e,r){var n=r.graphicalItems,i=r.dataStartIndex,s=r.dataEndIndex,a=(n??[]).reduce(function(o,l){var c=l.props.data;return c&&c.length?[].concat(Kc(o),Kc(c)):o},[]);return a.length>0?a:e&&e.length&&ae(i)&&ae(s)?e.slice(i,s+1):[]};function n3(t){return t==="number"?[0,"auto"]:void 0}var KS=function(e,r,n,i){var s=e.graphicalItems,a=e.tooltipAxis,o=Sy(r,e);return n<0||!s||!s.length||n>=o.length?null:s.reduce(function(l,c){var u,d=(u=c.props.data)!==null&&u!==void 0?u:r;d&&e.dataStartIndex+e.dataEndIndex!==0&&e.dataEndIndex-e.dataStartIndex>=n&&(d=d.slice(e.dataStartIndex,e.dataEndIndex+1));var f;if(a.dataKey&&!a.allowDuplicatedCategory){var h=d===void 0?o:d;f=_w(h,a.dataKey,i)}else f=d&&d[n]||o[n];return f?[].concat(Kc(l),[eU(c,f)]):l},[])},Bk=function(e,r,n,i){var s=i||{x:e.chartX,y:e.chartY},a=x_e(s,n),o=e.orderedTooltipTicks,l=e.tooltipAxis,c=e.tooltipTicks,u=Sye(a,o,c,l);if(u>=0&&c){var d=c[u]&&c[u].value,f=KS(e,r,u,d),h=w_e(n,o,u,s);return{activeTooltipIndex:u,activeLabel:d,activePayload:f,activeCoordinate:h}}return null},S_e=function(e,r){var n=r.axes,i=r.graphicalItems,s=r.axisType,a=r.axisIdKey,o=r.stackGroups,l=r.dataStartIndex,c=r.dataEndIndex,u=e.layout,d=e.children,f=e.stackOffset,h=JB(u,s);return n.reduce(function(p,g){var m,v=g.type.defaultProps!==void 0?Y(Y({},g.type.defaultProps),g.props):g.props,y=v.type,b=v.dataKey,w=v.allowDataOverflow,S=v.allowDuplicatedCategory,T=v.scale,_=v.ticks,A=v.includeHidden,P=v[a];if(p[P])return p;var C=Sy(e.data,{graphicalItems:i.filter(function(B){var K,ee=a in B.props?B.props[a]:(K=B.type.defaultProps)===null||K===void 0?void 0:K[a];return ee===P}),dataStartIndex:l,dataEndIndex:c}),O=C.length,R,D,L;qTe(v.domain,w,y)&&(R=fS(v.domain,null,w),h&&(y==="number"||T!=="auto")&&(L=xd(C,b,"category")));var j=n3(y);if(!R||R.length===0){var M,N=(M=v.domain)!==null&&M!==void 0?M:j;if(b){if(R=xd(C,b,y),y==="category"&&h){var k=cne(R);S&&k?(D=R,R=kg(0,O)):S||(R=_R(N,R,g).reduce(function(B,K){return B.indexOf(K)>=0?B:[].concat(Kc(B),[K])},[]))}else if(y==="category")S?R=R.filter(function(B){return B!==""&&!Fe(B)}):R=_R(N,R,g).reduce(function(B,K){return B.indexOf(K)>=0||K===""||Fe(K)?B:[].concat(Kc(B),[K])},[]);else if(y==="number"){var $=Pye(C,i.filter(function(B){var K,ee,H=a in B.props?B.props[a]:(K=B.type.defaultProps)===null||K===void 0?void 0:K[a],J="hide"in B.props?B.props.hide:(ee=B.type.defaultProps)===null||ee===void 0?void 0:ee.hide;return H===P&&(A||!J)}),b,s,u);$&&(R=$)}h&&(y==="number"||T!=="auto")&&(L=xd(C,b,"category"))}else h?R=kg(0,O):o&&o[P]&&o[P].hasStack&&y==="number"?R=f==="expand"?[0,1]:ZB(o[P].stackGroups,l,c):R=QB(C,i.filter(function(B){var K=a in B.props?B.props[a]:B.type.defaultProps[a],ee="hide"in B.props?B.props.hide:B.type.defaultProps.hide;return K===P&&(A||!ee)}),y,u,!0);if(y==="number")R=WS(d,R,P,s,_),N&&(R=fS(N,R,w));else if(y==="category"&&N){var U=N,G=R.every(function(B){return U.indexOf(B)>=0});G&&(R=U)}}return Y(Y({},p),{},ge({},P,Y(Y({},v),{},{axisType:s,domain:R,categoricalDomain:L,duplicateDomain:D,originalDomain:(m=v.domain)!==null&&m!==void 0?m:j,isCategorical:h,layout:u})))},{})},E_e=function(e,r){var n=r.graphicalItems,i=r.Axis,s=r.axisType,a=r.axisIdKey,o=r.stackGroups,l=r.dataStartIndex,c=r.dataEndIndex,u=e.layout,d=e.children,f=Sy(e.data,{graphicalItems:n,dataStartIndex:l,dataEndIndex:c}),h=f.length,p=JB(u,s),g=-1;return n.reduce(function(m,v){var y=v.type.defaultProps!==void 0?Y(Y({},v.type.defaultProps),v.props):v.props,b=y[a],w=n3("number");if(!m[b]){g++;var S;return p?S=kg(0,h):o&&o[b]&&o[b].hasStack?(S=ZB(o[b].stackGroups,l,c),S=WS(d,S,b,s)):(S=fS(w,QB(f,n.filter(function(T){var _,A,P=a in T.props?T.props[a]:(_=T.type.defaultProps)===null||_===void 0?void 0:_[a],C="hide"in T.props?T.props.hide:(A=T.type.defaultProps)===null||A===void 0?void 0:A.hide;return P===b&&!C}),"number",u),i.defaultProps.allowDataOverflow),S=WS(d,S,b,s)),Y(Y({},m),{},ge({},b,Y(Y({axisType:s},i.defaultProps),{},{hide:!0,orientation:In(y_e,"".concat(s,".").concat(g%2),null),domain:S,originalDomain:w,isCategorical:p,layout:u})))}return m},{})},T_e=function(e,r){var n=r.axisType,i=n===void 0?"xAxis":n,s=r.AxisComp,a=r.graphicalItems,o=r.stackGroups,l=r.dataStartIndex,c=r.dataEndIndex,u=e.children,d="".concat(i,"Id"),f=li(u,s),h={};return f&&f.length?h=S_e(e,{axes:f,graphicalItems:a,axisType:i,axisIdKey:d,stackGroups:o,dataStartIndex:l,dataEndIndex:c}):a&&a.length&&(h=E_e(e,{Axis:s,graphicalItems:a,axisType:i,axisIdKey:d,stackGroups:o,dataStartIndex:l,dataEndIndex:c})),h},__e=function(e){var r=Tl(e),n=ho(r,!1,!0);return{tooltipTicks:n,orderedTooltipTicks:b_(n,function(i){return i.coordinate}),tooltipAxis:r,tooltipAxisBandSize:Sg(r,n)}},Uk=function(e){var r=e.children,n=e.defaultShowTooltip,i=rn(r,$c),s=0,a=0;return e.data&&e.data.length!==0&&(a=e.data.length-1),i&&i.props&&(i.props.startIndex>=0&&(s=i.props.startIndex),i.props.endIndex>=0&&(a=i.props.endIndex)),{chartX:0,chartY:0,dataStartIndex:s,dataEndIndex:a,activeTooltipIndex:-1,isTooltipActive:!!n}},A_e=function(e){return!e||!e.length?!1:e.some(function(r){var n=hs(r&&r.type);return n&&n.indexOf("Bar")>=0})},Gk=function(e){return e==="horizontal"?{numericAxisName:"yAxis",cateAxisName:"xAxis"}:e==="vertical"?{numericAxisName:"xAxis",cateAxisName:"yAxis"}:e==="centric"?{numericAxisName:"radiusAxis",cateAxisName:"angleAxis"}:{numericAxisName:"angleAxis",cateAxisName:"radiusAxis"}},P_e=function(e,r){var n=e.props,i=e.graphicalItems,s=e.xAxisMap,a=s===void 0?{}:s,o=e.yAxisMap,l=o===void 0?{}:o,c=n.width,u=n.height,d=n.children,f=n.margin||{},h=rn(d,$c),p=rn(d,rc),g=Object.keys(l).reduce(function(S,T){var _=l[T],A=_.orientation;return!_.mirror&&!_.hide?Y(Y({},S),{},ge({},A,S[A]+_.width)):S},{left:f.left||0,right:f.right||0}),m=Object.keys(a).reduce(function(S,T){var _=a[T],A=_.orientation;return!_.mirror&&!_.hide?Y(Y({},S),{},ge({},A,In(S,"".concat(A))+_.height)):S},{top:f.top||0,bottom:f.bottom||0}),v=Y(Y({},m),g),y=v.bottom;h&&(v.bottom+=h.props.height||$c.defaultProps.height),p&&r&&(v=_ye(v,i,n,r));var b=c-v.left-v.right,w=u-v.top-v.bottom;return Y(Y({brushBottom:y},v),{},{width:Math.max(b,0),height:Math.max(w,0)})},I_e=function(e,r){if(r==="xAxis")return e[r].width;if(r==="yAxis")return e[r].height},C_e=function(e){var r=e.chartName,n=e.GraphicalChild,i=e.defaultTooltipEventType,s=i===void 0?"axis":i,a=e.validateTooltipEventTypes,o=a===void 0?["axis"]:a,l=e.axisComponents,c=e.legendContent,u=e.formatAxisMap,d=e.defaultProps,f=function(v,y){var b=y.graphicalItems,w=y.stackGroups,S=y.offset,T=y.updateId,_=y.dataStartIndex,A=y.dataEndIndex,P=v.barSize,C=v.layout,O=v.barGap,R=v.barCategoryGap,D=v.maxBarSize,L=Gk(C),j=L.numericAxisName,M=L.cateAxisName,N=A_e(b),k=[];return b.forEach(function($,U){var G=Sy(v.data,{graphicalItems:[$],dataStartIndex:_,dataEndIndex:A}),B=$.type.defaultProps!==void 0?Y(Y({},$.type.defaultProps),$.props):$.props,K=B.dataKey,ee=B.maxBarSize,H=B["".concat(j,"Id")],J=B["".concat(M,"Id")],q={},ie=l.reduce(function($t,Jt){var $r=y["".concat(Jt.axisType,"Map")],Hi=B["".concat(Jt.axisType,"Id")];$r&&$r[Hi]||Jt.axisType==="zAxis"||Go();var Fa=$r[Hi];return Y(Y({},$t),{},ge(ge({},Jt.axisType,Fa),"".concat(Jt.axisType,"Ticks"),ho(Fa)))},q),Z=ie[M],re=ie["".concat(M,"Ticks")],ne=w&&w[H]&&w[H].hasStack&&Fye($,w[H].stackGroups),z=hs($.type).indexOf("Bar")>=0,Ee=Sg(Z,re),me=[],Qe=N&&Eye({barSize:P,stackGroups:w,totalSize:I_e(ie,M)});if(z){var de,Pe,tt=Fe(ee)?D:ee,kt=(de=(Pe=Sg(Z,re,!0))!==null&&Pe!==void 0?Pe:tt)!==null&&de!==void 0?de:0;me=Tye({barGap:O,barCategoryGap:R,bandSize:kt!==Ee?kt:Ee,sizeList:Qe[J],maxBarSize:tt}),kt!==Ee&&(me=me.map(function($t){return Y(Y({},$t),{},{position:Y(Y({},$t.position),{},{offset:$t.position.offset-kt/2})})}))}var Gt=$&&$.type&&$.type.getComposedData;Gt&&k.push({props:Y(Y({},Gt(Y(Y({},ie),{},{displayedData:G,props:v,dataKey:K,item:$,bandSize:Ee,barPosition:me,offset:S,stackedData:ne,layout:C,dataStartIndex:_,dataEndIndex:A}))),{},ge(ge(ge({key:$.key||"item-".concat(U)},j,ie[j]),M,ie[M]),"animationId",T)),childIndex:wne($,v.children),item:$})}),k},h=function(v,y){var b=v.props,w=v.dataStartIndex,S=v.dataEndIndex,T=v.updateId;if(!bC({props:b}))return null;var _=b.children,A=b.layout,P=b.stackOffset,C=b.data,O=b.reverseStackOrder,R=Gk(A),D=R.numericAxisName,L=R.cateAxisName,j=li(_,n),M=Mye(C,j,"".concat(D,"Id"),"".concat(L,"Id"),P,O),N=l.reduce(function(B,K){var ee="".concat(K.axisType,"Map");return Y(Y({},B),{},ge({},ee,T_e(b,Y(Y({},K),{},{graphicalItems:j,stackGroups:K.axisType===D&&M,dataStartIndex:w,dataEndIndex:S}))))},{}),k=P_e(Y(Y({},N),{},{props:b,graphicalItems:j}),y==null?void 0:y.legendBBox);Object.keys(N).forEach(function(B){N[B]=u(b,N[B],k,B.replace("Map",""),r)});var $=N["".concat(L,"Map")],U=__e($),G=f(b,Y(Y({},N),{},{dataStartIndex:w,dataEndIndex:S,updateId:T,graphicalItems:j,stackGroups:M,offset:k}));return Y(Y({formattedGraphicalItems:G,graphicalItems:j,offset:k,stackGroups:M},U),N)},p=function(m){function v(y){var b,w,S;return o_e(this,v),S=u_e(this,v,[y]),ge(S,"eventEmitterSymbol",Symbol("rechartsEventEmitter")),ge(S,"accessibilityManager",new zTe),ge(S,"handleLegendBBoxUpdate",function(T){if(T){var _=S.state,A=_.dataStartIndex,P=_.dataEndIndex,C=_.updateId;S.setState(Y({legendBBox:T},h({props:S.props,dataStartIndex:A,dataEndIndex:P,updateId:C},Y(Y({},S.state),{},{legendBBox:T}))))}}),ge(S,"handleReceiveSyncEvent",function(T,_,A){if(S.props.syncId===T){if(A===S.eventEmitterSymbol&&typeof S.props.syncMethod!="function")return;S.applySyncEvent(_)}}),ge(S,"handleBrushChange",function(T){var _=T.startIndex,A=T.endIndex;if(_!==S.state.dataStartIndex||A!==S.state.dataEndIndex){var P=S.state.updateId;S.setState(function(){return Y({dataStartIndex:_,dataEndIndex:A},h({props:S.props,dataStartIndex:_,dataEndIndex:A,updateId:P},S.state))}),S.triggerSyncEvent({dataStartIndex:_,dataEndIndex:A})}}),ge(S,"handleMouseEnter",function(T){var _=S.getMouseInfo(T);if(_){var A=Y(Y({},_),{},{isTooltipActive:!0});S.setState(A),S.triggerSyncEvent(A);var P=S.props.onMouseEnter;De(P)&&P(A,T)}}),ge(S,"triggeredAfterMouseMove",function(T){var _=S.getMouseInfo(T),A=_?Y(Y({},_),{},{isTooltipActive:!0}):{isTooltipActive:!1};S.setState(A),S.triggerSyncEvent(A);var P=S.props.onMouseMove;De(P)&&P(A,T)}),ge(S,"handleItemMouseEnter",function(T){S.setState(function(){return{isTooltipActive:!0,activeItem:T,activePayload:T.tooltipPayload,activeCoordinate:T.tooltipPosition||{x:T.cx,y:T.cy}}})}),ge(S,"handleItemMouseLeave",function(){S.setState(function(){return{isTooltipActive:!1}})}),ge(S,"handleMouseMove",function(T){T.persist(),S.throttleTriggeredAfterMouseMove(T)}),ge(S,"handleMouseLeave",function(T){S.throttleTriggeredAfterMouseMove.cancel();var _={isTooltipActive:!1};S.setState(_),S.triggerSyncEvent(_);var A=S.props.onMouseLeave;De(A)&&A(_,T)}),ge(S,"handleOuterEvent",function(T){var _=xne(T),A=In(S.props,"".concat(_));if(_&&De(A)){var P,C;/.*touch.*/i.test(_)?C=S.getMouseInfo(T.changedTouches[0]):C=S.getMouseInfo(T),A((P=C)!==null&&P!==void 0?P:{},T)}}),ge(S,"handleClick",function(T){var _=S.getMouseInfo(T);if(_){var A=Y(Y({},_),{},{isTooltipActive:!0});S.setState(A),S.triggerSyncEvent(A);var P=S.props.onClick;De(P)&&P(A,T)}}),ge(S,"handleMouseDown",function(T){var _=S.props.onMouseDown;if(De(_)){var A=S.getMouseInfo(T);_(A,T)}}),ge(S,"handleMouseUp",function(T){var _=S.props.onMouseUp;if(De(_)){var A=S.getMouseInfo(T);_(A,T)}}),ge(S,"handleTouchMove",function(T){T.changedTouches!=null&&T.changedTouches.length>0&&S.throttleTriggeredAfterMouseMove(T.changedTouches[0])}),ge(S,"handleTouchStart",function(T){T.changedTouches!=null&&T.changedTouches.length>0&&S.handleMouseDown(T.changedTouches[0])}),ge(S,"handleTouchEnd",function(T){T.changedTouches!=null&&T.changedTouches.length>0&&S.handleMouseUp(T.changedTouches[0])}),ge(S,"handleDoubleClick",function(T){var _=S.props.onDoubleClick;if(De(_)){var A=S.getMouseInfo(T);_(A,T)}}),ge(S,"handleContextMenu",function(T){var _=S.props.onContextMenu;if(De(_)){var A=S.getMouseInfo(T);_(A,T)}}),ge(S,"triggerSyncEvent",function(T){S.props.syncId!==void 0&&vb.emit(yb,S.props.syncId,T,S.eventEmitterSymbol)}),ge(S,"applySyncEvent",function(T){var _=S.props,A=_.layout,P=_.syncMethod,C=S.state.updateId,O=T.dataStartIndex,R=T.dataEndIndex;if(T.dataStartIndex!==void 0||T.dataEndIndex!==void 0)S.setState(Y({dataStartIndex:O,dataEndIndex:R},h({props:S.props,dataStartIndex:O,dataEndIndex:R,updateId:C},S.state)));else if(T.activeTooltipIndex!==void 0){var D=T.chartX,L=T.chartY,j=T.activeTooltipIndex,M=S.state,N=M.offset,k=M.tooltipTicks;if(!N)return;if(typeof P=="function")j=P(k,T);else if(P==="value"){j=-1;for(var $=0;$<k.length;$++)if(k[$].value===T.activeLabel){j=$;break}}var U=Y(Y({},N),{},{x:N.left,y:N.top}),G=Math.min(D,U.x+U.width),B=Math.min(L,U.y+U.height),K=k[j]&&k[j].value,ee=KS(S.state,S.props.data,j),H=k[j]?{x:A==="horizontal"?k[j].coordinate:G,y:A==="horizontal"?B:k[j].coordinate}:r3;S.setState(Y(Y({},T),{},{activeLabel:K,activeCoordinate:H,activePayload:ee,activeTooltipIndex:j}))}else S.setState(T)}),ge(S,"renderCursor",function(T){var _,A=S.state,P=A.isTooltipActive,C=A.activeCoordinate,O=A.activePayload,R=A.offset,D=A.activeTooltipIndex,L=A.tooltipAxisBandSize,j=S.getTooltipEventType(),M=(_=T.props.active)!==null&&_!==void 0?_:P,N=S.props.layout,k=T.key||"_recharts-cursor";return F.createElement(e_e,{key:k,activeCoordinate:C,activePayload:O,activeTooltipIndex:D,chartName:r,element:T,isActive:M,layout:N,offset:R,tooltipAxisBandSize:L,tooltipEventType:j})}),ge(S,"renderPolarAxis",function(T,_,A){var P=In(T,"type.axisType"),C=In(S.state,"".concat(P,"Map")),O=T.type.defaultProps,R=O!==void 0?Y(Y({},O),T.props):T.props,D=C&&C[R["".concat(P,"Id")]];return E.cloneElement(T,Y(Y({},D),{},{className:Me(P,D.className),key:T.key||"".concat(_,"-").concat(A),ticks:ho(D,!0)}))}),ge(S,"renderPolarGrid",function(T){var _=T.props,A=_.radialLines,P=_.polarAngles,C=_.polarRadius,O=S.state,R=O.radiusAxisMap,D=O.angleAxisMap,L=Tl(R),j=Tl(D),M=j.cx,N=j.cy,k=j.innerRadius,$=j.outerRadius;return E.cloneElement(T,{polarAngles:Array.isArray(P)?P:ho(j,!0).map(function(U){return U.coordinate}),polarRadius:Array.isArray(C)?C:ho(L,!0).map(function(U){return U.coordinate}),cx:M,cy:N,innerRadius:k,outerRadius:$,key:T.key||"polar-grid",radialLines:A})}),ge(S,"renderLegend",function(){var T=S.state.formattedGraphicalItems,_=S.props,A=_.children,P=_.width,C=_.height,O=S.props.margin||{},R=P-(O.left||0)-(O.right||0),D=YB({children:A,formattedGraphicalItems:T,legendWidth:R,legendContent:c});if(!D)return null;var L=D.item,j=jk(D,t_e);return E.cloneElement(L,Y(Y({},j),{},{chartWidth:P,chartHeight:C,margin:O,onBBoxUpdate:S.handleLegendBBoxUpdate}))}),ge(S,"renderTooltip",function(){var T,_=S.props,A=_.children,P=_.accessibilityLayer,C=rn(A,nn);if(!C)return null;var O=S.state,R=O.isTooltipActive,D=O.activeCoordinate,L=O.activePayload,j=O.activeLabel,M=O.offset,N=(T=C.props.active)!==null&&T!==void 0?T:R;return E.cloneElement(C,{viewBox:Y(Y({},M),{},{x:M.left,y:M.top}),active:N,label:j,payload:N?L:[],coordinate:D,accessibilityLayer:P})}),ge(S,"renderBrush",function(T){var _=S.props,A=_.margin,P=_.data,C=S.state,O=C.offset,R=C.dataStartIndex,D=C.dataEndIndex,L=C.updateId;return E.cloneElement(T,{key:T.key||"_recharts-brush",onChange:gp(S.handleBrushChange,T.props.onChange),data:P,x:ae(T.props.x)?T.props.x:O.left,y:ae(T.props.y)?T.props.y:O.top+O.height+O.brushBottom-(A.bottom||0),width:ae(T.props.width)?T.props.width:O.width,startIndex:R,endIndex:D,updateId:"brush-".concat(L)})}),ge(S,"renderReferenceElement",function(T,_,A){if(!T)return null;var P=S,C=P.clipPathId,O=S.state,R=O.xAxisMap,D=O.yAxisMap,L=O.offset,j=T.type.defaultProps||{},M=T.props,N=M.xAxisId,k=N===void 0?j.xAxisId:N,$=M.yAxisId,U=$===void 0?j.yAxisId:$;return E.cloneElement(T,{key:T.key||"".concat(_,"-").concat(A),xAxis:R[k],yAxis:D[U],viewBox:{x:L.left,y:L.top,width:L.width,height:L.height},clipPathId:C})}),ge(S,"renderActivePoints",function(T){var _=T.item,A=T.activePoint,P=T.basePoint,C=T.childIndex,O=T.isRange,R=[],D=_.props.key,L=_.item.type.defaultProps!==void 0?Y(Y({},_.item.type.defaultProps),_.item.props):_.item.props,j=L.activeDot,M=L.dataKey,N=Y(Y({index:C,dataKey:M,cx:A.x,cy:A.y,r:4,fill:K_(_.item),strokeWidth:2,stroke:"#fff",payload:A.payload,value:A.value},Ue(j,!1)),Km(j));return R.push(v.renderActiveDot(j,N,"".concat(D,"-activePoint-").concat(C))),P?R.push(v.renderActiveDot(j,Y(Y({},N),{},{cx:P.x,cy:P.y}),"".concat(D,"-basePoint-").concat(C))):O&&R.push(null),R}),ge(S,"renderGraphicChild",function(T,_,A){var P=S.filterFormatItem(T,_,A);if(!P)return null;var C=S.getTooltipEventType(),O=S.state,R=O.isTooltipActive,D=O.tooltipAxis,L=O.activeTooltipIndex,j=O.activeLabel,M=S.props.children,N=rn(M,nn),k=P.props,$=k.points,U=k.isRange,G=k.baseLine,B=P.item.type.defaultProps!==void 0?Y(Y({},P.item.type.defaultProps),P.item.props):P.item.props,K=B.activeDot,ee=B.hide,H=B.activeBar,J=B.activeShape,q=!!(!ee&&R&&N&&(K||H||J)),ie={};C!=="axis"&&N&&N.props.trigger==="click"?ie={onClick:gp(S.handleItemMouseEnter,T.props.onClick)}:C!=="axis"&&(ie={onMouseLeave:gp(S.handleItemMouseLeave,T.props.onMouseLeave),onMouseEnter:gp(S.handleItemMouseEnter,T.props.onMouseEnter)});var Z=E.cloneElement(T,Y(Y({},P.props),ie));function re(Jt){return typeof D.dataKey=="function"?D.dataKey(Jt.payload):null}if(q)if(L>=0){var ne,z;if(D.dataKey&&!D.allowDuplicatedCategory){var Ee=typeof D.dataKey=="function"?re:"payload.".concat(D.dataKey.toString());ne=_w($,Ee,j),z=U&&G&&_w(G,Ee,j)}else ne=$==null?void 0:$[L],z=U&&G&&G[L];if(J||H){var me=T.props.activeIndex!==void 0?T.props.activeIndex:L;return[E.cloneElement(T,Y(Y(Y({},P.props),ie),{},{activeIndex:me})),null,null]}if(!Fe(ne))return[Z].concat(Kc(S.renderActivePoints({item:P,activePoint:ne,basePoint:z,childIndex:L,isRange:U})))}else{var Qe,de=(Qe=S.getItemByXY(S.state.activeCoordinate))!==null&&Qe!==void 0?Qe:{graphicalItem:Z},Pe=de.graphicalItem,tt=Pe.item,kt=tt===void 0?T:tt,Gt=Pe.childIndex,$t=Y(Y(Y({},P.props),ie),{},{activeIndex:Gt});return[E.cloneElement(kt,$t),null,null]}return U?[Z,null,null]:[Z,null]}),ge(S,"renderCustomized",function(T,_,A){return E.cloneElement(T,Y(Y({key:"recharts-customized-".concat(A)},S.props),S.state))}),ge(S,"renderMap",{CartesianGrid:{handler:wp,once:!0},ReferenceArea:{handler:S.renderReferenceElement},ReferenceLine:{handler:wp},ReferenceDot:{handler:S.renderReferenceElement},XAxis:{handler:wp},YAxis:{handler:wp},Brush:{handler:S.renderBrush,once:!0},Bar:{handler:S.renderGraphicChild},Line:{handler:S.renderGraphicChild},Area:{handler:S.renderGraphicChild},Radar:{handler:S.renderGraphicChild},RadialBar:{handler:S.renderGraphicChild},Scatter:{handler:S.renderGraphicChild},Pie:{handler:S.renderGraphicChild},Funnel:{handler:S.renderGraphicChild},Tooltip:{handler:S.renderCursor,once:!0},PolarGrid:{handler:S.renderPolarGrid,once:!0},PolarAngleAxis:{handler:S.renderPolarAxis},PolarRadiusAxis:{handler:S.renderPolarAxis},Customized:{handler:S.renderCustomized}}),S.clipPathId="".concat((b=y.id)!==null&&b!==void 0?b:Yv("recharts"),"-clip"),S.throttleTriggeredAfterMouseMove=XF(S.triggeredAfterMouseMove,(w=y.throttleDelay)!==null&&w!==void 0?w:1e3/60),S.state={},S}return h_e(v,m),c_e(v,[{key:"componentDidMount",value:function(){var b,w;this.addListener(),this.accessibilityManager.setDetails({container:this.container,offset:{left:(b=this.props.margin.left)!==null&&b!==void 0?b:0,top:(w=this.props.margin.top)!==null&&w!==void 0?w:0},coordinateList:this.state.tooltipTicks,mouseHandlerCallback:this.triggeredAfterMouseMove,layout:this.props.layout}),this.displayDefaultTooltip()}},{key:"displayDefaultTooltip",value:function(){var b=this.props,w=b.children,S=b.data,T=b.height,_=b.layout,A=rn(w,nn);if(A){var P=A.props.defaultIndex;if(!(typeof P!="number"||P<0||P>this.state.tooltipTicks.length-1)){var C=this.state.tooltipTicks[P]&&this.state.tooltipTicks[P].value,O=KS(this.state,S,P,C),R=this.state.tooltipTicks[P].coordinate,D=(this.state.offset.top+T)/2,L=_==="horizontal",j=L?{x:R,y:D}:{y:R,x:D},M=this.state.formattedGraphicalItems.find(function(k){var $=k.item;return $.type.name==="Scatter"});M&&(j=Y(Y({},j),M.props.points[P].tooltipPosition),O=M.props.points[P].tooltipPayload);var N={activeTooltipIndex:P,isTooltipActive:!0,activeLabel:C,activePayload:O,activeCoordinate:j};this.setState(N),this.renderCursor(A),this.accessibilityManager.setIndex(P)}}}},{key:"getSnapshotBeforeUpdate",value:function(b,w){if(!this.props.accessibilityLayer)return null;if(this.state.tooltipTicks!==w.tooltipTicks&&this.accessibilityManager.setDetails({coordinateList:this.state.tooltipTicks}),this.props.layout!==b.layout&&this.accessibilityManager.setDetails({layout:this.props.layout}),this.props.margin!==b.margin){var S,T;this.accessibilityManager.setDetails({offset:{left:(S=this.props.margin.left)!==null&&S!==void 0?S:0,top:(T=this.props.margin.top)!==null&&T!==void 0?T:0}})}return null}},{key:"componentDidUpdate",value:function(b){Pw([rn(b.children,nn)],[rn(this.props.children,nn)])||this.displayDefaultTooltip()}},{key:"componentWillUnmount",value:function(){this.removeListener(),this.throttleTriggeredAfterMouseMove.cancel()}},{key:"getTooltipEventType",value:function(){var b=rn(this.props.children,nn);if(b&&typeof b.props.shared=="boolean"){var w=b.props.shared?"axis":"item";return o.indexOf(w)>=0?w:s}return s}},{key:"getMouseInfo",value:function(b){if(!this.container)return null;var w=this.container,S=w.getBoundingClientRect(),T=qhe(S),_={chartX:Math.round(b.pageX-T.left),chartY:Math.round(b.pageY-T.top)},A=S.width/w.offsetWidth||1,P=this.inRange(_.chartX,_.chartY,A);if(!P)return null;var C=this.state,O=C.xAxisMap,R=C.yAxisMap,D=this.getTooltipEventType(),L=Bk(this.state,this.props.data,this.props.layout,P);if(D!=="axis"&&O&&R){var j=Tl(O).scale,M=Tl(R).scale,N=j&&j.invert?j.invert(_.chartX):null,k=M&&M.invert?M.invert(_.chartY):null;return Y(Y({},_),{},{xValue:N,yValue:k},L)}return L?Y(Y({},_),L):null}},{key:"inRange",value:function(b,w){var S=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,T=this.props.layout,_=b/S,A=w/S;if(T==="horizontal"||T==="vertical"){var P=this.state.offset,C=_>=P.left&&_<=P.left+P.width&&A>=P.top&&A<=P.top+P.height;return C?{x:_,y:A}:null}var O=this.state,R=O.angleAxisMap,D=O.radiusAxisMap;if(R&&D){var L=Tl(R);return IR({x:_,y:A},L)}return null}},{key:"parseEventsOfWrapper",value:function(){var b=this.props.children,w=this.getTooltipEventType(),S=rn(b,nn),T={};S&&w==="axis"&&(S.props.trigger==="click"?T={onClick:this.handleClick}:T={onMouseEnter:this.handleMouseEnter,onDoubleClick:this.handleDoubleClick,onMouseMove:this.handleMouseMove,onMouseLeave:this.handleMouseLeave,onTouchMove:this.handleTouchMove,onTouchStart:this.handleTouchStart,onTouchEnd:this.handleTouchEnd,onContextMenu:this.handleContextMenu});var _=Km(this.props,this.handleOuterEvent);return Y(Y({},_),T)}},{key:"addListener",value:function(){vb.on(yb,this.handleReceiveSyncEvent)}},{key:"removeListener",value:function(){vb.removeListener(yb,this.handleReceiveSyncEvent)}},{key:"filterFormatItem",value:function(b,w,S){for(var T=this.state.formattedGraphicalItems,_=0,A=T.length;_<A;_++){var P=T[_];if(P.item===b||P.props.key===b.key||w===hs(P.item.type)&&S===P.childIndex)return P}return null}},{key:"renderClipPath",value:function(){var b=this.clipPathId,w=this.state.offset,S=w.left,T=w.top,_=w.height,A=w.width;return F.createElement("defs",null,F.createElement("clipPath",{id:b},F.createElement("rect",{x:S,y:T,height:_,width:A})))}},{key:"getXScales",value:function(){var b=this.state.xAxisMap;return b?Object.entries(b).reduce(function(w,S){var T=$k(S,2),_=T[0],A=T[1];return Y(Y({},w),{},ge({},_,A.scale))},{}):null}},{key:"getYScales",value:function(){var b=this.state.yAxisMap;return b?Object.entries(b).reduce(function(w,S){var T=$k(S,2),_=T[0],A=T[1];return Y(Y({},w),{},ge({},_,A.scale))},{}):null}},{key:"getXScaleByAxisId",value:function(b){var w;return(w=this.state.xAxisMap)===null||w===void 0||(w=w[b])===null||w===void 0?void 0:w.scale}},{key:"getYScaleByAxisId",value:function(b){var w;return(w=this.state.yAxisMap)===null||w===void 0||(w=w[b])===null||w===void 0?void 0:w.scale}},{key:"getItemByXY",value:function(b){var w=this.state,S=w.formattedGraphicalItems,T=w.activeItem;if(S&&S.length)for(var _=0,A=S.length;_<A;_++){var P=S[_],C=P.props,O=P.item,R=O.type.defaultProps!==void 0?Y(Y({},O.type.defaultProps),O.props):O.props,D=hs(O.type);if(D==="Bar"){var L=(C.data||[]).find(function(k){return Dxe(b,k)});if(L)return{graphicalItem:P,payload:L}}else if(D==="RadialBar"){var j=(C.data||[]).find(function(k){return IR(b,k)});if(j)return{graphicalItem:P,payload:j}}else if(py(P,T)||my(P,T)||Mf(P,T)){var M=$we({graphicalItem:P,activeTooltipItem:T,itemData:R.data}),N=R.activeIndex===void 0?M:R.activeIndex;return{graphicalItem:Y(Y({},P),{},{childIndex:N}),payload:Mf(P,T)?R.data[M]:P.props.data[M]}}}return null}},{key:"render",value:function(){var b=this;if(!bC(this))return null;var w=this.props,S=w.children,T=w.className,_=w.width,A=w.height,P=w.style,C=w.compact,O=w.title,R=w.desc,D=jk(w,r_e),L=Ue(D,!1);if(C)return F.createElement(Tk,{state:this.state,width:this.props.width,height:this.props.height,clipPathId:this.clipPathId},F.createElement(Cw,Ul({},L,{width:_,height:A,title:O,desc:R}),this.renderClipPath(),wC(S,this.renderMap)));if(this.props.accessibilityLayer){var j,M;L.tabIndex=(j=this.props.tabIndex)!==null&&j!==void 0?j:0,L.role=(M=this.props.role)!==null&&M!==void 0?M:"application",L.onKeyDown=function(k){b.accessibilityManager.keyboardEvent(k)},L.onFocus=function(){b.accessibilityManager.focus()}}var N=this.parseEventsOfWrapper();return F.createElement(Tk,{state:this.state,width:this.props.width,height:this.props.height,clipPathId:this.clipPathId},F.createElement("div",Ul({className:Me("recharts-wrapper",T),style:Y({position:"relative",curs
356or:"default",width:_,height:A},P)},N,{ref:function($){b.container=$}}),F.createElement(Cw,Ul({},L,{width:_,height:A,title:O,desc:R,style:b_e}),this.renderClipPath(),wC(S,this.renderMap)),this.renderLegend(),this.renderTooltip()))}}])}(E.Component);ge(p,"displayName",r),ge(p,"defaultProps",Y({layout:"horizontal",stackOffset:"none",barCategoryGap:"10%",barGap:4,margin:{top:5,right:5,bottom:5,left:5},reverseStackOrder:!1,syncMethod:"index"},d)),ge(p,"getDerivedStateFromProps",function(m,v){var y=m.dataKey,b=m.data,w=m.children,S=m.width,T=m.height,_=m.layout,A=m.stackOffset,P=m.margin,C=v.dataStartIndex,O=v.dataEndIndex;if(v.updateId===void 0){var R=Uk(m);return Y(Y(Y({},R),{},{updateId:0},h(Y(Y({props:m},R),{},{updateId:0}),v)),{},{prevDataKey:y,prevData:b,prevWidth:S,prevHeight:T,prevLayout:_,prevStackOffset:A,prevMargin:P,prevChildren:w})}if(y!==v.prevDataKey||b!==v.prevData||S!==v.prevWidth||T!==v.prevHeight||_!==v.prevLayout||A!==v.prevStackOffset||!tc(P,v.prevMargin)){var D=Uk(m),L={chartX:v.chartX,chartY:v.chartY,isTooltipActive:v.isTooltipActive},j=Y(Y({},Bk(v,b,_)),{},{updateId:v.updateId+1}),M=Y(Y(Y({},D),L),j);return Y(Y(Y({},M),h(Y({props:m},M),v)),{},{prevDataKey:y,prevData:b,prevWidth:S,prevHeight:T,prevLayout:_,prevStackOffset:A,prevMargin:P,prevChildren:w})}if(!Pw(w,v.prevChildren)){var N,k,$,U,G=rn(w,$c),B=G&&(N=(k=G.props)===null||k===void 0?void 0:k.startIndex)!==null&&N!==void 0?N:C,K=G&&($=(U=G.props)===null||U===void 0?void 0:U.endIndex)!==null&&$!==void 0?$:O,ee=B!==C||K!==O,H=!Fe(b),J=H&&!ee?v.updateId:v.updateId+1;return Y(Y({updateId:J},h(Y(Y({props:m},v),{},{updateId:J,dataStartIndex:B,dataEndIndex:K}),v)),{},{prevChildren:w,dataStartIndex:B,dataEndIndex:K})}return null}),ge(p,"renderActiveDot",function(m,v,y){var b;return E.isValidElement(m)?b=E.cloneElement(m,v):De(m)?b=m(v):b=F.createElement(pU,v),F.createElement(sr,{className:"recharts-active-dot",key:y},b)});var g=E.forwardRef(function(v,y){return F.createElement(p,Ul({},v,{ref:y}))});return g.displayName=p.displayName,g},Xp=C_e({chartName:"BarChart",GraphicalChild:$i,defaultTooltipEventType:"axis",validateTooltipEventTypes:["axis","item"],axisComponents:[{axisType:"xAxis",AxisComp:Co},{axisType:"yAxis",AxisComp:Oo}],formatAxisMap:uEe});const We=OZ[CZ()];function O_e({streamUrl:t}){const e=E.useRef(null);return E.useEffect(()=>{if(e.current&&ln.isSupported()){const r=new ln;return r.loadSource(t),r.attachMedia(e.current),()=>r.destroy()}else e.current&&(e.current.src=t)},[t]),x.jsx("video",{ref:e,controls:!0,autoPlay:!0,className:"w-full h-full object-contain bg-black"})}function R_e({incidents:t,demoTime:e,videoRef:r}){const n=E.useRef(null),i=E.useRef(new Set),s=E.useRef(0);return E.useEffect(()=>{e<s.current-5&&i.current.clear(),s.current=e,t.forEach((f,h)=>{new Date(f.ts).getTime()/1e3<=e&&i.current.add(h)});const a=n.current,o=r.current;if(!a||!o||!o.videoWidth)return;const l=o.clientWidth/o.videoWidth,c=o.clientHeight/o.videoHeight;a.width=o.clientWidth,a.height=o.clientHeight;const u=a.getContext("2d");if(!u)return;u.clearRect(0,0,a.width,a.height);const d=t.filter((f,h)=>i.current.has(h));d.length&&d.forEach(f=>{const[h,p,g,m]=f.bbox,v=h*l,y=p*c,b=(g-h)*l,w=(m-p)*c;u.fillStyle="rgba(234,179,8,0.15)",u.fillRect(v,y,b,w),u.strokeStyle="#EAB308",u.lineWidth=2,u.setLineDash([6,3]),u.strokeRect(v,y,b,w),u.setLineDash([]),u.fillStyle="#EAB308",u.font=`bold ${Math.max(10,Math.round(13*l))}px sans-serif`,u.fillText(We.emptyLabel,v+3,y-4>0?y-4:y+14)})},[e,t,r]),x.jsx("canvas",{ref:n,className:"absolute top-0 left-0 pointer-events-none z-10"})}function Wk({streams:t,streamUrls:e,seqSlot:r,selectedStreamId:n,onSelect:i,isActive:s,onAlert:a,loop:o=!1,demoVideoUrl:l,videoElRef:c,initialTime:u,overlayIncidents:d,overlayTime:f,onTimeUpdate:h}){const p=t.filter(g=>(g.sequence_number-1)%3+1===1);return p.length===0?x.jsx(Ke,{children:x.jsxs(ze,{className:"text-center py-8",children:[x.jsx("p",{className:"text-muted-foreground",children:"No streams found for your account."}),x.jsx("p",{className:"text-sm text-muted-foreground mt-2",children:"Contact your administrator to add streams."})]})}):x.jsx("div",{className:"flex flex-col gap-2 w-full",children:p.map(g=>{const m=l??e[g.stream_id],v=g.stream_id;return x.jsx("div",{className:be("w-full rounded-lg overflow-hidden cursor-pointer transition-all relative",n===g.stream_id&&"ring-2 ring-primary"),onClick:()=>i(g.stream_id),children:m?x.jsxs(x.Fragment,{children:[(s||o&&r===1)&&(r===1||r===2)?x.jsxs(x.Fragment,{children:[x.jsx(IZ,{streamUrl:m,camName:v,onAlert:a,mode:r===2?"missing":"theft",loop:o,videoElRef:c,initialTime:u,onTimeUpdate:r===1?h:void 0}),d&&f!==void 0&&r===2&&c&&x.jsx(R_e,{incidents:d,demoTime:f,videoRef:c})]}):s?x.jsx(O_e,{streamUrl:m}):null,s&&x.jsx("div",{className:"sm:hidden absolute inset-0 flex items-start justify-center pt-[15%] pointer-events-none",children:x.jsx("div",{className:"animate-pulse bg-black/60 text-white text-lg font-medium px-5 py-3 rounded-2xl text-center max-w-[70%]",children:We.rotateTip})})]}):x.jsx("div",{className:"flex items-center justify-center h-full bg-muted rounded-lg",children:x.jsx("p",{className:"text-muted-foreground text-sm",children:"Loading stream..."})})},g.id)})})}function k_e({currentTime:t,maxTime:e,onSeek:r}){const[n,i]=E.useState(null),s=n!==null?n:Math.min(t,Math.ceil(e));return x.jsx("input",{type:"range",min:0,max:Math.ceil(e),value:s,onChange:a=>i(Number(a.target.value)),onMouseUp:a=>{r(Number(a.target.value)),i(null)},onTouchEnd:a=>{r(Number(a.target.value)),i(null)}
356,className:"w-full mt-2 accent-primary cursor-pointer"})}function L_e({incidents:t,currentTime:e,onSeek:r}){const[n,i]=E.useState(null),s=E.useMemo(()=>t.length?new Date(t[0].ts).getTime()/1e3:0,[t]),a=E.useMemo(()=>{if(!t.length)return 60;const p=new Date(t[t.length-1].ts).getTime()/1e3;return Math.max(p-s,1)},[t,s]),o=p=>new Date(p.ts).getTime()/1e3-s,l=p=>`${Math.floor(p/60)}:${Math.floor(p%60).toString().padStart(2,"0")}`,c=p=>t.filter(g=>g.event_type===p&&o(g)<=e).slice(-5).reverse(),u=c("theft_alert"),d=c("suspicious_dwell"),f=t.filter(p=>p.event_type==="empty_shelf"&&o(p)<=e);if(!t.length)return x.jsx("p",{className:"text-muted-foreground text-sm text-center py-8",children:We.loadingAlerts});const h=[{key:"theft",title:We.sectionTheft,color:"text-red-500",border:"border-red-500/30",bg:"bg-red-500/10",dot:"bg-red-500",items:u},{key:"dwell",title:We.sectionLoitering,color:"text-amber-400",border:"border-amber-400/30",bg:"bg-amber-400/10",dot:"bg-amber-400",items:d},{key:"shelf",title:We.sectionMissingItems,color:"text-orange-400",border:"border-orange-400/30",bg:"bg-orange-400/10",dot:"bg-orange-400",items:f}];return x.jsxs("div",{className:"space-y-4",children:[x.jsxs("div",{children:[x.jsxs("div",{className:"flex justify-between text-xs text-muted-foreground mb-1 px-1",children:[x.jsx("span",{children:l(e)}),x.jsx("span",{children:l(a)})]}),r&&x.jsx(k_e,{currentTime:e,maxTime:a,onSeek:r})]}),x.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:h.map(({key:p,title:g,color:m,border:v,bg:y,dot:b,items:w})=>x.jsxs("div",{className:be("rounded-xl border p-3 space-y-2",y,v),children:[x.jsxs("div",{className:"flex items-center justify-between",children:[x.jsx("p",{className:be("text-sm font-semibold",m),children:g}),x.jsx("span",{className:be("text-xs font-bold px-2 py-0.5 rounded-full text-white",b),children:w.length})]}),w.length===0?x.jsx("p",{className:"text-xs text-muted-foreground text-center py-4",children:We.noIncidentsSection}):p==="shelf"?(()=>{const S={};return w.forEach(T=>{const _=T.label??"?";S[_]=(S[_]??0)+1}),x.jsxs("table",{className:"w-full text-xs",children:[x.jsx("thead",{children:x.jsxs("tr",{className:"text-muted-foreground border-b border-border/50",children:[x.jsx("th",{className:"text-left pb-1 font-medium",children:We.shelf}),x.jsx("th",{className:"text-right pb-1 font-medium",children:We.missing})]})}),x.jsx("tbody",{children:Object.entries(S).map(([T,_])=>x.jsxs("tr",{className:"border-b border-border/30 last:border-0",children:[x.jsx("td",{className:"py-1.5 text-orange-400 font-medium",children:T}),x.jsx("td",{className:"py-1.5 text-right font-bold",children:_})]},T))})]})})():x.jsx("div",{className:"space-y-2",children:w.map((S,T)=>{const _=S.snapshot_url?`/${S.snapshot_url}`:null,A=o(S);return x.jsxs("div",{className:"rounded-lg bg-background/60 border border-border/50 p-2 space-y-1.5 text-xs",children:[_&&x.jsx("img",{src:_,alt:"snapshot",className:"w-full rounded object-contain max-h-20 cursor-zoom-in",onClick:()=>i(_)}),x.jsxs("div",{className:"flex justify-between text-muted-foreground",children:[S.track_id!=null?x.jsxs("span",{children:["Track #",S.track_id]}):S.confidence!=null?x.jsxs("span",{children:[(S.confidence*100).toFixed(0),"% conf."]}):x.jsx("span",{}),x.jsx("span",{children:l(A)})]})]},T)})})]},p))}),n&&x.jsx("div",{className:"fixed inset-0 z-50 bg-black/80 flex items-center justify-center p-4",onClick:()=>i(null),children:x.jsx("img",{src:n,alt:"snapshot",className:"max-h-[80vh] max-w-[90vw] rounded-lg shadow-2xl"})})]})}const Vk=["#6366f1","#8b5cf6","#a78bfa","#c4b5fd","#ddd6fe","#ede9fe"],Sd=1920,Xn=1080,Hk={shelf1:[[0,0],[480,0],[480,Xn],[0,Xn]],shelf2:[[480,0],[960,0],[960,Xn],[480,Xn]],shelf3:[[960,0],[1440,0],[1440,Xn],[960,Xn]],shelf4:[[1440,0],[Sd,0],[Sd,Xn],[1440,Xn]],exit:[[960,200],[1160,200],[1160,700],[960,700]],checkout:[[1260,200],[1920,200],[1920,700],[1260,700]]};function D_e(t){const e=Math.round(Math.min(255,t*2*255)),r=Math.round(t<.5?t*2*255:(1-(t-.5)*2)*255),n=Math.round(Math.max(0,(1-t*2)*255));return`${e},${r},${n}`}function N_e({zoneCounts:t}){const e=E.useRef(null);return E.useEffect(()=>{const r=e.current;if(!r)return;r.width=Sd,r.height=Xn;const n=r.getContext("2d");n.clearRect(0,0,Sd,Xn);const i=Math.max(...Object.values(t),1);
356Object.entries(Hk).forEach(([a,o])=>{const l=t[a]??0;if(!l)return;const c=l/i,u=document.createElement("canvas");u.width=Sd,u.height=Xn;const d=u.getContext("2d");d.filter="blur(40px)",d.beginPath(),d.moveTo(o[0][0],o[0][1]),o.slice(1).forEach(([f,h])=>d.lineTo(f,h)),d.closePath(),d.fillStyle=`rgba(${D_e(c)},${(.25+c*.3).toFixed(2)})`,d.fill(),n.drawImage(u,0,0)});const s=Object.values(t).reduce((a,o)=>a+o,0)||1;Object.entries(Hk).forEach(([a,o])=>{const l=t[a]??0;if(!l)return;const c=o.reduce((p,g)=>p+g[0],0)/o.length,u=o.reduce((p,g)=>p+g[1],0)/o.length,d=`${Math.round(l/s*100)}%`;n.font="bold 52px sans-serif";const f=n.measureText(d).width;n.fillStyle="rgba(0,0,0,0.55)",n.fillRect(c-f/2-12,u-44,f+24,64),n.fillStyle="#ffffff",n.textAlign="center",n.textBaseline="middle",n.fillText(d,c,u),n.font="bold 28px sans-serif",n.fillStyle="rgba(255,255,255,0.75)";const h=a.replace(/(\D+)(\d+)/,"$1 $2").trim();n.fillText(h,c,u+46)})},[t]),x.jsx("canvas",{ref:e,className:"absolute inset-0 w-full h-full object-cover pointer-events-none"})}function M_e({zoneSummary:t}){const[e,r]=E.useState(null);if(!t)return x.jsx("p",{className:"text-muted-foreground text-sm text-center py-8",children:We.loadingAnalysis});const n=Object.entries(t.zone_counts).sort((o,l)=>l[1]-o[1]),i=n.slice(0,3),s=n.reduce((o,[,l])=>o+l,0),a=n.map(([o,l])=>({zone:o.replace(/(\D+)(\d+)/,"$1 $2").trim(),pct:Math.round(l/s*100)}));return x.jsxs("div",{className:"flex flex-col sm:flex-row gap-4",children:[x.jsxs("div",{className:"flex-1 min-w-0 space-y-4",children:[x.jsxs("div",{className:"rounded-xl border border-primary/30 bg-primary/5 p-4 flex items-start gap-4",children:[x.jsx("div",{className:"text-4xl font-black text-primary shrink-0",children:t.footfall}),x.jsxs("div",{className:"flex-1 min-w-0",children:[x.jsx("div",{className:"text-xs text-muted-foreground mb-2",children:We.peopleDetected}),x.jsx("div",{className:"space-y-1",children:i.map(([o,l],c)=>{const u=Math.round(l/s*100),d=["🥇","🥈","🥉"];return x.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[x.jsx("span",{children:d[c]}),x.jsx("span",{className:"capitalize font-medium",children:o}),x.jsx("div",{className:"flex-1 h-1.5 bg-muted rounded-full overflow-hidden",children:x.jsx("div",{className:"h-full bg-primary rounded-full",style:{width:`${u}%`}})}),x.jsxs("span",{className:"text-xs text-muted-foreground shrink-0",children:[u,"%"]})]},o)})})]})]}),x.jsxs("div",{className:"space-y-1.5",children:[x.jsx("p",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide",children:We.customersPerZone}),x.jsx(Yp,{width:"100%",height:180,children:x.jsxs(Xp,{data:a,margin:{top:4,right:8,left:-20,bottom:0},children:[x.jsx(Co,{dataKey:"zone",tick:{fontSize:11}}),x.jsx(Oo,{tick:{fontSize:11},unit:"%",domain:[0,100]}),x.jsx(nn,{formatter:o=>[`${o}%`,We.zoneActivity],contentStyle:{background:"hsl(var(--background))",border:"1px solid hsl(var(--border))",borderRadius:8,fontSize:12},cursor:{fill:"hsl(var(--muted))"}}),x.jsx($i,{dataKey:"pct",radius:[4,4,0,0],children:a.map((o,l)=>x.jsx(ff,{fill:Vk[l%Vk.length]},l))})]})})]})]}),x.jsxs("div",{className:"sm:w-[70%] shrink-0 space-y-1.5",children:[x.jsx("p",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide",children:We.heatmap}),x.jsxs("div",{className:"relative w-full rounded-lg overflow-hidden",children:[x.jsx("img",{src:"/demo_output_v5/shelf_zone_preview.jpg",alt:"Store",className:"w-full block"}),x.jsx("img",{src:"/demo_output_v5/shelf_annotated_heatmap.jpg",alt:"",className:"absolute inset-0 w-full h-full object-cover pointer-events-none",style:{mixBlendMode:"screen"}}),x.jsx(N_e,{zoneCounts:t.zone_counts})]})]}),e&&x.jsx("div",{className:"fixed inset-0 z-50 bg-black/80 flex items-center justify-center p-4",onClick:()=>r(null),children:x.jsx("img",{src:e,alt:"analysis",className:"max-h-[80vh] max-w-[90vw] w-auto h-auto rounded-lg shadow-2xl object-contain"})})]})}function Kk(){var G,B,K,ee;const t=Ir(),{isDemo:e}=yn(),[r,n]=E.useState(null),[i,s]=E.useState(null),[a,o]=E.useState([]),[l,c]=E.useState(""),[u,d]=E.useState({}),[f,h]=E.useState(!0),[p,g]=E.useState("hurto"),[m,v]=E.useState([]),[y,b]=E.useState(0),[w,S]=E.useState(0),[T,_]=E.useState(null),A=E.useRef(null),P=E.useRef(null),C=E.useRef(0),{isAdmin:O,checking:R}=cu(r),D=E.useCallback(H=>{C.current=H,b(H)},[]);E.useEffect(()=>{if(!e)return;const H=setInterval(()=>{const J=A.current;J&&!J.paused&&D(J.currentTime)},250);return()=>clearInterval(H)},[e,D]);const L=E.useCallback(H=>
356{v(q=>[H,...q].slice(0,50));const J=H.track_id!=null?` — track #${H.track_id}`:"";He.error(`Alerta: ${H.event_type.replace("_"," ")}${J}`)},[]);E.useEffect(()=>{e&&(fetch("/alerts.json").then(H=>H.json()).then(H=>{const J=H.map(q=>({type:"alert",event_type:q.type,bbox:q.bbox??[0,0,0,0],confidence:q.conf,ts:new Date(q.time_s*1e3).toISOString(),track_id:q.track_id??null,snapshot_url:q.snapshot??null,label:q.shelf_id??q.class??null}));v(J)}).catch(console.error),fetch("/zone_summary.json").then(H=>H.json()).then(H=>_(H)).catch(console.error))},[e]),E.useEffect(()=>{if(e){o([{id:1,stream_id:"demo",sequence_number:1,user_id:null,created_at:null,hls_url:null}]),c("demo"),h(!1);return}(async()=>{try{const{data:{session:J}}=await _e.auth.getSession();if(J!=null&&J.user)n(J.user),s(J);else{const q=localStorage.getItem("customUser");if(q){const ie=JSON.parse(q);n({id:ie.user_id,email:ie.email})}else{t("/auth");return}}h(!1)}catch(J){console.error("Auth check error:",J),t("/auth")}})()},[t,e]);const j=async H=>{try{const{data:J,error:q}=await _e.from("stream_data").select("*").eq("user_id",H).order("sequence_number");if(q){console.error("Error fetching streams:",q),He.error("Failed to fetch your streams");return}o(J||[]),J&&J.length>0&&c(J[0].stream_id)}catch(J){console.error("Error fetching streams:",J)}},M=async()=>{try{i&&await _e.auth.signOut(),localStorage.removeItem("customUser"),o([]),c(""),e?window.location.href="https://roboeye.robodost.ai/login":t("/auth")}catch(H){console.error("Logout error:",H)}},N=async()=>{const H={};try{for(const J of a)if(e)H[J.stream_id]="/shelf_hurto.mp4";else if(J.hls_url)H[J.stream_id]=J.hls_url;else{const q=await fetch(`/api/stream-url?streamId=${J.stream_id}`);if(!q.ok)throw new Error("Failed to fetch stream URL");const ie=await q.json();H[J.stream_id]=ie.url}d(H)}catch(J){console.error("Error fetching stream URLs:",J)}};E.useEffect(()=>{(r||e)&&a.length>0&&N()},[a]),E.useEffect(()=>{r&&(R||(O?t("/admin"):j(r.id)))},[r==null?void 0:r.id,O,R,t]);const k=E.useMemo(()=>m.filter(H=>H.event_type==="empty_shelf"),[m]),$=E.useMemo(()=>{const H=m.filter(J=>J.event_type==="theft_alert"||J.event_type==="suspicious_dwell");return e?H.filter(J=>new Date(J.ts).getTime()/1e3<=y).slice(-5).reverse():H.slice(0,5)},[m,e,y]),U=E.useMemo(()=>{if(m.length<2)return 0;const H=new Date(m[0].ts).getTime()/1e3;return new Date(m[m.length-1].ts).getTime()/1e3-H},[m]);return E.useEffect(()=>{if(!e)return;const H=setInterval(()=>{S(J=>{const q=J+15;return U>0&&q>U?0:q})},15e3);return()=>clearInterval(H)},[e,U]),f||R?x.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gradient-primary",children:x.jsxs("div",{className:"text-center",children:[x.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-primary mx-auto mb-4"}),x.jsx("p",{className:"text-muted-foreground",children:"Loading..."})]})}):!r&&!e?null:x.jsxs("div",{className:"h-screen flex flex-col overflow-hidden bg-background p-4 pb-16 md:p-8 md:pb-20",children:[x.jsxs("div",{className:"flex sm:hidden flex-col mb-4 shrink-0",children:[x.jsxs("div",{className:"flex justify-between items-center",children:[x.jsx("div",{className:"h-8 w-8 rounded-full bg-primary flex items-center justify-center text-primary-foreground text-sm font-bold",children:e?"D":((B=(G=r==null?void 0:r.email)==null?void 0:G[0])==null?void 0:B.toUpperCase())??"?"}),x.jsx(Re,{onClick:M,variant:"ghost",size:"icon",children:x.jsx(Bd,{className:"h-5 w-5"})})]}),x.jsx("div",{className:"flex justify-center mt-1",children:x.jsx("img",{src:$o,alt:"RoboEye",className:"h-[72px] object-contain"})})]}),x.jsxs("div",{className:"hidden sm:flex justify-between items-center mb-8 relative shrink-0",children:[x.jsxs("div",{className:"flex items-center gap-3",children:[x.jsx("div",{className:"h-10 w-10 rounded-full bg-primary flex items-center justify-center text-primary-foreground text-base font-bold",children:e?"D":((ee=(K=r==null?void 0:r.email)==null?void 0:K[0])==null?void 0:ee.toUpperCase())??"?"}),O&&x.jsx(_i,{to:"/admin",children:x.jsx(Re,{variant:"secondary",size:"sm",children:"Admin Panel"})})]}),x.jsx("img",{src:$o,alt:"RoboEye",className:"h-28 object-contain absolute left-1/2 -translate-x-1/2"}),x.jsx(Re,{onClick:M,variant:"ghost",size:"icon",children:x.jsx(Bd,{className:"h-5 w-5"})})]}),x.jsxs(TT,{value:p,onValueChange:g,className:"flex flex-col flex-1 min-h-0 w-full",children:[x.jsxs(Ov,{className:"grid grid-cols-2 sm:grid-cols-4 w-full mb-3 mt-4 h-auto bg-muted/40 rounded-lg p-1 gap-1 shrink-0",children:[x.jsx(ls,{value:"hurto",className:"rounded-md text-lg font-semibold py-2.5 px-3 text-center text-muted-foreground data-[state=active]:bg-primary data-[state=active]:text-primary-foreground data-[state=active]:shadow-sm transition-all",children:We.tabHurto}),x.jsx(ls,{value:"articulos",className:"rounded-md text-lg font-semibold py-2.5 px-3 text-center text-muted-foreground data-[state=active]:bg-primary data-[state=active]:text-primary-foreground data-[state=active]:shadow-sm transition-all",children:We.tabArticulos}),x.jsx(ls,{value:"alertas",className:"rounded-md text-lg font-semibold py-2.5 px-3 text-center text-muted-foreground data-[state=active]:bg-primary data-[state=active]:text-primary-foreground data-[state=active]:shadow-sm transition-all",children:We.tabAlertas}),x.jsx(ls,{value:"analisis",className:"rounded-md text-lg font-semibold py-2.5 px-3 text-center text-muted-foreground data-[state=active]:bg-primary data-[state=active]:text-primary-foreground data-[state=active]:shadow-sm transition-all",children:We.tabAnalisis})]}),x.jsxs(cs,{value:"hurto",forceMount:!0,className:be("flex-1 min-h-0 mt-0 flex flex-col sm:flex-row gap-3",p!=="hurto"&&"hidden"),children:[x.jsx("div",{className:"flex-1 min-h-0 min-w-0 order-1",children:x.jsx(Wk,{streams:a,streamUrls:u,seqSlot:1,selectedStreamId:l,onSelect:c,isActive:p==="hurto",onAlert:L,loop:e,demoVideoUrl:e?"/shelf_hurto.mp4":void 0,videoElRef:A,initialTime:C.current,onTimeUpdate:e?D:void 0})}),x.jsx("div",{className:"sm:w-52 shrink-0 order-2 overflow-y-auto self-start",children:x.jsxs("div",{className:"space-y-2",children:[x.jsx("p",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide px-1",children:We.latestIncidents}),$.length===0?x.jsx("p",{className:"text-xs text-muted-foreground text-center py-6",children:We.noIncidentsYet}):$.map((H,J)=>{const q=H.event_type==="theft_alert",ie=H.snapshot_url?`/${H.snapshot_url}`:null,Z=ne=>`${Math.floor(ne/60)}:${Math.floor(ne%60).toString().padStart(2,"0")}`,re=new Date(H.ts).getTime()/1e3;return x.jsxs("div",{className:be("rounded-lg border p-2 text-xs space-y-1.5",q?"border-red-500/40 bg-red-500/10":"border-amber-400/40 bg-amber-400/10"),
356children:[x.jsxs("div",{className:be("font-semibold",q?"text-red-500":"text-amber-400"),children:[q?We.theft:We.loitering,H.track_id!=null&&x.jsxs("span",{className:"font-normal text-muted-foreground ml-1",children:["#",H.track_id]})]}),ie&&x.jsx("img",{src:ie,alt:"snapshot",className:"w-full rounded object-contain max-h-24"}),x.jsx("div",{className:"text-muted-foreground",children:Z(re)})]},J)})]})})]}),x.jsxs(cs,{value:"articulos",forceMount:!0,className:be("flex-1 min-h-0 mt-0 overflow-y-auto",p!=="articulos"&&"hidden"),children:[x.jsx(Wk,{streams:a,streamUrls:u,seqSlot:2,selectedStreamId:l,onSelect:c,isActive:p==="articulos",loop:e,demoVideoUrl:e?"/shelf_articulos.mp4":void 0,videoElRef:P,initialTime:C.current,overlayIncidents:k,overlayTime:y}),e&&(()=>{const H=k.filter(ie=>{const Z=m.length?new Date(m[0].ts).getTime()/1e3:0;return new Date(ie.ts).getTime()/1e3-Z<=y}),J={};H.forEach(ie=>{J[ie.label??"?"]=(J[ie.label??"?"]??0)+1});const q=Object.entries(J);return q.length?x.jsxs("div",{className:"mt-3 rounded-lg border bg-card p-3",children:[x.jsx("p",{className:"text-xs font-bold uppercase text-muted-foreground mb-2",children:We.missingItemsByShelf}),x.jsxs("table",{className:"w-full text-sm",children:[x.jsx("thead",{children:x.jsxs("tr",{className:"text-muted-foreground border-b border-border/50",children:[x.jsx("th",{className:"text-left pb-1 font-medium",children:We.shelf}),x.jsx("th",{className:"text-right pb-1 font-medium",children:We.missing})]})}),x.jsx("tbody",{children:q.map(([ie,Z])=>x.jsxs("tr",{className:"border-b border-border/30 last:border-0",children:[x.jsx("td",{className:"py-1.5 text-orange-400 font-medium",children:ie}),x.jsx("td",{className:"py-1.5 text-right font-bold",children:Z})]},ie))})]})]}):null})()]}),x.jsx(cs,{value:"alertas",className:"flex-1 min-h-0 mt-0 overflow-y-auto",children:e?x.jsxs(Ke,{children:[x.jsx(rt,{children:x.jsx(ct,{children:We.securityAlerts})}),x.jsx(ze,{children:x.jsx(L_e,{incidents:m,currentTime:w,onSeek:S})})]}):x.jsxs(Ke,{children:[x.jsx(rt,{children:x.jsx(ct,{children:We.securityIncidents})}),x.jsx(ze,{className:"space-y-2",children:m.length===0?x.jsx("p",{className:"text-muted-foreground text-sm text-center py-8",children:We.noIncidentsReported}):m.map((H,J)=>x.jsxs("div",{className:be("rounded-md border p-2 text-sm space-y-0.5",H.event_type==="theft_alert"?"border-red-500/50 bg-red-500/10":H.event_type==="suspicious_dwell"?"border-amber-500/50 bg-amber-500/10":"border-yellow-500/50 bg-yellow-500/10"),children:[x.jsx("div",{className:"font-medium capitalize",children:H.event_type.replace("_"," ")}),x.jsxs("div",{className:"text-muted-foreground text-xs",children:[H.track_id!=null?`Track #${H.track_id} · `:"",new Date(H.ts).toLocaleTimeString()]}),H.snapshot_url&&x.jsx("img",{src:H.snapshot_url,alt:"snapshot",className:"rounded mt-1 w-full object-cover max-h-24"})]},J))})]})}),x.jsx(cs,{value:"analisis",className:"flex-1 min-h-0 mt-0 overflow-y-auto",children:x.jsxs(Ke,{children:[x.jsx(rt,{className:"pb-2 pt-3 px-4",children:x.jsx("p",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide",children:We.zoneAnalysis})}),x.jsx(ze,{children:x.jsx(M_e,{zoneSummary:T})})]})})]})]})}const $_e=eh("inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function j_e({className:t,variant:e,...r}){return x.jsx("div",{className:be($_e({variant:e}),t),...r})}const F_e=typeof navigator<"u"?navigator.language:"en-US";function B_e(t,e="USD"){try{return new Intl.NumberFormat(F_e,{style:"currency",currency:e,maximumFractionDigits:2}).format(t)}catch{return`$${t.toFixed(2)}`}}const zk=[{id:"basic",name:"Basic",price:200,currency:"Euro",period:"per month",description:"Perfect for personal use",features:[{name:"1 Camera Access",included:!0},{name:"7 Days Recording",included:!0},{name:"Mobile App Access",included:!0},{name:"Email Alerts",included:!0},{name:"24/7 Support",included:!1},{name:"AI Detection",included:!1},{name:"Cloud Storage",included:!1}]},{id:"professional",name:"Professional",price:400,currency:"Euro",period:"per month",description:"Ideal for small businesses",popular:!0,features:[{name:"4 Camera Access",included:!0},{name:"30 Days Recording",included:!0},{name:"Mobile App Access",included:!0},{name:"Email & SMS Alerts",included:!0},{name:"24/7 Support",included:!0},{name:"AI Detection",included:!0},{name:"Cloud Storage (100GB)",included:!0}]},{id:"enterprise",name:"Enterprise",price:800,currency:"USD",period:"per month",description:"Complete surveillance solution",features:[{name:"Unlimited Cameras",included:!0},{name:"90 Days Recording",included:!0},{name:"Mobile App Access",included:!0},{name:"All Alert Types",included:!0},{name:"Priority Support",included:!0},{name:"Advanced AI Detection",included:!0},{name:"Unlimited Cloud Storage",included:!0}]}];function U_e(){const[t,e]=E.useState(""),[r,n]=E.useState(null),[i,s]=E.useState(""),a=Ir(),{user:o,loading:l}=yn();E.useEffect(()=>{o&&!l&&(async()=>{var f,h,p,g;if(o)try{const{data:m,error:v}
356=await _e.from("profiles").select("name").eq("id",o.id).maybeSingle();if(!v&&(m!=null&&m.name))s(m.name);else{const y=((f=o.user_metadata)==null?void 0:f.name)||((h=o.user_metadata)==null?void 0:h.full_name);s(y||((p=o.email)==null?void 0:p.split("@")[0])||"User")}}catch(m){console.error("Error fetching user data:",m),s(((g=o.email)==null?void 0:g.split("@")[0])||"User")}})()},[o,l]),E.useEffect(()=>{o&&!l&&(async()=>{if(o)try{const{data:f,error:h}=await _e.from("plan_selections").select("plan").eq("user_id",o.id).maybeSingle();if(!h&&(f!=null&&f.plan)){const p=String(f.plan).toLowerCase();n(p)}else n(null)}catch(f){console.error("Error fetching current plan:",f)}})()},[o,l]);const c=E.useMemo(()=>Object.fromEntries(zk.map(d=>[d.id,d])),[]),u=d=>{e(d);const f=localStorage.getItem("registrationData"),h=f?JSON.parse(f):{},p=new URLSearchParams({plan:d,...h.name&&{name:h.name},...h.email&&{email:h.email},...h.phone&&{phone:h.phone}});a(`/pay?${p.toString()}`)};return x.jsx("div",{className:"min-h-screen bg-gradient-subtle py-12 px-4",children:x.jsxs("div",{className:"container mx-auto max-w-7xl",children:[x.jsxs("div",{className:"text-center mb-12",children:[o&&i&&x.jsx("div",{className:"mb-6",children:x.jsxs("div",{className:"inline-flex items-center gap-2 bg-primary/10 text-primary px-4 py-2 rounded-full",children:[x.jsx(gM,{className:"h-4 w-4"}),x.jsxs("span",{className:"text-sm font-medium",children:["Welcome back, ",i,"!"]})]})}),r&&x.jsxs("div",{className:"mb-6",children:[x.jsxs("div",{className:"inline-flex items-center gap-2 bg-green-100 text-green-800 px-4 py-2 rounded-full",children:[x.jsx(kx,{className:"h-4 w-4"}),x.jsxs("span",{className:"text-sm font-medium",children:["Your current plan: ",c[r].name]})]}),x.jsx("div",{className:"mt-4",children:x.jsx(Re,{onClick:()=>a("/dashboard"),size:"sm",className:"px-4",children:"Go to Dashboard"})})]}),x.jsx("h1",{className:"text-4xl font-bold text-foreground mb-4",children:"Choose Your Plan"}),x.jsx("p",{className:"text-xl text-muted-foreground",children:"Select the perfect surveillance plan for your needs"})]}),x.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-8",children:zk.map(d=>x.jsxs(Ke,{className:`relative transition-all hover:shadow-xl ${d.popular?"ring-2 ring-primary shadow-lg md:scale-105":""}`,"aria-label":`${d.name} plan`,children:[d.popular&&x.jsx(j_e,{className:"absolute -top-3 left-1/2 -translate-x-1/2 px-3 py-1","aria-label":"Most Popular",children:"Most Popular"}),x.jsxs(rt,{className:"text-center pb-8",children:[x.jsx(ct,{className:"text-2xl font-bold",children:d.name}),x.jsx(ti,{className:"mt-2",children:d.description}),x.jsxs("div",{className:"mt-4",children:[x.jsx("span",{className:"text-4xl font-bold text-primary",children:B_e(d.price,d.currency)}),x.jsx("span",{className:"text-muted-foreground ml-2",children:d.period})]})]}),x.jsx(ze,{children:x.jsx("ul",{className:"space-y-3",children:d.features.map((f,h)=>x.jsxs("li",{className:"flex items-center gap-3",children:[f.included?x.jsx(kx,{"aria-hidden":!0,className:"h-5 w-5 text-green-600 flex-shrink-0"}):x.jsx(vM,{"aria-hidden":!0,className:"h-5 w-5 text-muted-foreground/50 flex-shrink-0"}),x.jsx("span",{className:f.included?"":"text-muted-foreground/50",children:f.name})]},h))})}),x.jsx(j$,{children:x.jsx(Re,{onClick:()=>u(d.id),className:"w-full",variant:d.popular?"default":"outline",size:"lg",disabled:t===d.id||r===d.id,"aria-disabled":t===d.id||r===d.id,"aria-label":`Select the ${d.name} plan`,"data-testid":`select-${d.id}`,children:t===d.id?"Processing...":r===d.id?"Current Plan":"Select Plan"})})]},d.id))}),x.jsxs("div",{className:"text-center mt-12",children:[x.jsx("p",{className:"text-muted-foreground",children:"All plans include basic features. Upgrade or downgrade anytime."}),x.jsx(Re,{variant:"link",onClick:()=>a("/"),className:"mt-4",children:"Skip for now →"})]})]})})}const G_e=t=>{const e=t.trim();return e.length>=2&&e.length<=100&&/^[a-zA-Z\s'-]+$/.test(e)},W_e=t=>t.trim()?/^[\+]?[1-9][\d]{0,15}$/.test(t.replace(/[\s\-\(\)]/g,"")):!0,xb=t=>t.trim().replace(/[<>]/g,""),wb=new Map,V_e=(t,e=5,r=15*60*1e3)=>{const n=Date.now(),i=wb.get(t);return i?n-i.lastAttempt>r?(wb.set(t,{count:1,lastAttempt:n}),!0):i.count>
356=e?!1:(i.count++,i.lastAttempt=n,!0):(wb.set(t,{count:1,lastAttempt:n}),!0)},H_e={basic:{label:"Basic Plan",priceText:"€200.0/mo",description:"Perfect for small homes and apartments"},professional:{label:"Professional Plan",priceText:"€400.0/mo",description:"Ideal for businesses and larger properties"},enterprise:{label:"Enterprise Plan",priceText:"€800.0/mo",description:"Complete security solution for large enterprises"}};function qk(t){return/[^\s@]+@[^\s@]+\.[^\s@]+/.test(t)}function K_e(){const t=Ir(),[e]=_v(),{user:r,loading:n}=yn(),i=e.get("plan")||"",s=e.get("name")||"",a=e.get("email")||"",o=e.get("phone")||"",[l,c]=E.useState(s),[u,d]=E.useState(a),[f,h]=E.useState(o),[p,g]=E.useState(!1),[m,v]=E.useState(null);E.useEffect(()=>{r&&!n&&(async()=>{if(r){!u&&r.email&&d(r.email);try{const{data:A,error:P}=await _e.from("profiles").select("name, email").eq("id",r.id).maybeSingle();!P&&A&&(!l&&A.name&&c(A.name),!u&&A.email&&d(A.email))}catch(A){console.error("Error fetching user profile:",A)}if(!l&&r.user_metadata){const A=r.user_metadata.name||r.user_metadata.full_name;A&&c(A)}}})()},[r,n,l,u]),E.useEffect(()=>{!n&&!r&&t("/auth")},[r,n,t]);const y=E.useMemo(()=>H_e[i],[i]),b=!!y,w=u?qk(u):!1,S=async()=>{if(v(null),!V_e("user-session",5,15*60*1e3)){v("Too many payment attempts. Please wait 15 minutes before trying again.");return}if(!b){v("The selected plan is not valid.");return}const A=xb(l),P=xb(u),C=xb(f);if(!G_e(A)){v("Please enter a valid name (2-100 characters, letters only).");return}if(!qk(P)){v("Please enter a valid email address.");return}if(!W_e(C)){v("Please enter a valid phone number or leave it empty.");return}try{g(!0);const{data:O,error:R}=await _e.functions.invoke("create-checkout",{body:{plan:i,name:A,email:P,phone:C,user_id:(r==null?void 0:r.id)||null}});if(R)throw new Error(R.message||"Checkout failed");if(O!=null&&O.url)window.open(O.url,"_blank");else throw new Error("Checkout URL was not received.")}catch(O){console.error("Payment error:",O),v((O==null?void 0:O.message)||"Error processing payment."),He.error((O==null?void 0:O.message)||"Payment processing failed")}finally{g(!1)}},T=()=>{t("/plans")};return x.jsx("div",{className:"min-h-screen bg-gradient-primary flex items-center justify-center p-4",children:x.jsxs(Ke,{className:"max-w-lg w-full shadow-elegant border-0 bg-card/95 backdrop-blur",children:[x.jsxs(rt,{className:"text-center pb-6",children:[x.jsx("div",{className:"mx-auto mb-4 flex h-12 w-12 items-center justify-center rounded-full bg-primary/10",children:x.jsx($A,{className:"h-6 w-6 text-primary"})}),x.jsx(ct,{className:"text-3xl font-bold bg-gradient-to-r from-primary to-primary-glow bg-clip-text text-transparent",children:"Complete Payment"}),b&&x.jsx("p",{className:"text-muted-foreground mt-2",children:y.description})]}),x.jsxs(ze,{className:"space-y-6",children:[m&&x.jsxs(So,{variant:"destructive",className:"border-destructive/20 bg-destructive/5",children:[x.jsx(Tm,{className:"h-4 w-4"}),x.jsx(Eo,{className:"font-medium",children:m})]}),!b&&x.jsxs(So,{variant:"destructive",className:"border-destructive/20 bg-destructive/5",children:[x.jsx(Tm,{className:"h-4 w-4"}),x.jsxs(Eo,{children:['The plan "',i,'" is not recognized. Please go back and choose a valid plan.']})]}),b&&x.jsxs("div",{className:"bg-muted/50 rounded-lg p-4 border",children:[x.jsxs("h3",{className:"font-semibold text-foreground mb-3 flex items-center gap-2",children:[x.jsx(pM,{className:"h-4 w-4 text-primary"}),"Selected Plan"]}),x.jsxs("div",{className:"space-y-2",children:[x.jsxs("div",{className:"flex justify-between items-center",children:[x.jsx("span",{className:"text-sm text-muted-foreground",children:"Plan:"}),x.jsx("span",{className:"font-medium text-foreground",children:y.label})]}),x.jsxs("div",{className:"flex justify-between items-center",children:[x.jsx("span",{className:"text-sm text-muted-foreground",children:"Price:"}),x.jsx("span",{className:"font-bold text-lg text-primary",children:y.priceText})]})]})]}),x.jsxs("div",{className:"space-y-4",children:[x.jsxs("div",{className:"space-y-2",children:[x.jsx(Dt,{htmlFor:"name",className:"text-sm font-medium text-foreground",children:"Full Name *"}),x.jsx(ir,{id:"name",placeholder:"Enter your full name",value:l,onCh
356ange:_=>c(_.target.value),className:"h-11 transition-all duration-200 focus:ring-2 focus:ring-primary/20 disabled:opacity-100 disabled:cursor-not-allowed",disabled:p})]}),x.jsxs("div",{className:"space-y-2",children:[x.jsx(Dt,{htmlFor:"email",className:"text-sm font-medium text-foreground",children:"Email Address *"}),x.jsx(ir,{id:"email",type:"email",placeholder:"Enter your email address",value:u,onChange:_=>d(_.target.value),className:"h-11 transition-all duration-200 focus:ring-2 focus:ring-primary/20 disabled:opacity-100 disabled:cursor-not-allowed",disabled:p})]}),x.jsxs("div",{className:"space-y-2",children:[x.jsx(Dt,{htmlFor:"phone",className:"text-sm font-medium text-foreground",children:"Phone Number"}),x.jsx(ir,{id:"phone",type:"tel",placeholder:"Enter your phone number (optional)",value:f,onChange:_=>h(_.target.value),className:"h-11 transition-all duration-200 focus:ring-2 focus:ring-primary/20",disabled:p})]})]}),x.jsxs("div",{className:"flex gap-3 pt-4",children:[x.jsxs(Re,{onClick:T,variant:"outline",className:"flex-1 h-12",disabled:p,children:[x.jsx(pv,{className:"h-4 w-4 mr-2"}),"Back"]}),x.jsx(Re,{onClick:S,disabled:p||!b||!l.trim()||!w,className:"flex-1 h-12 text-base font-semibold bg-gradient-to-r from-primary to-primary-glow hover:shadow-elegant transition-all duration-300 transform hover:scale-[1.02]",children:p?x.jsxs("div",{className:"flex items-center gap-2",children:[x.jsx("div",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-white"}),"Processing..."]}):x.jsxs(x.Fragment,{children:[x.jsx($A,{className:"h-4 w-4 mr-2"}),"Pay ",y==null?void 0:y.priceText]})})]}),x.jsx("p",{className:"text-xs text-muted-foreground text-center pt-2",children:"You will be redirected to Stripe's secure payment page to complete your purchase."})]})]})})}const z_e=()=>{var d,f;const t=Ir(),[e]=_v(),[r,n]=E.useState(!0),[i,s]=E.useState(!1),[a,o]=E.useState(null),{user:l}=yn(),c=e.get("session_id");E.useEffect(()=>{(async()=>{var p,g,m,v;if(!c){He.error("Invalid payment session"),t("/");return}try{const y=await fetch(`https://affuxodydkokhqjgduvx.supabase.co/functions/v1/get-session?session_id=${c}`,{method:"GET",headers:{"Content-Type":"application/json",apikey:"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6ImFmZnV4b2R5ZGtva2hxamdkdXZ4Iiwicm9sZSI6ImFub24iLCJpYXQiOjE3NTU5Njk1NjQsImV4cCI6MjA3MTU0NTU2NH0.YBSBnrDiSoCT6ercvnXxAKInpW9XPgf5dCRTIY4QOw0"}});if(!y.ok){const C=await y.text();throw new Error("Failed to retrieve payment details: "+C)}const b=await y.json();o(b);const w=b.customer_email||((p=b.customer_details)==null?void 0:p.email),S=((g=b.metadata)==null?void 0:g.name)||((m=b.customer_details)==null?void 0:m.name),_=(((v=b.metadata)==null?void 0:v.plan)||"").toLowerCase().trim(),P=new Set(["basic","professional","enterprise"]).has(_);if(w&&S&&P){const C=await _e.functions.invoke("send-contract",{body:{name:S,email:w,plan:_.charAt(0).toUpperCase()+_.slice(1)+" Plan"}});C.error?(console.error("Error sending contract:",C.error),He.error("Payment successful, but failed to send contract. Please contact support.")):(s(!0),He.success("Payment successful! Contract sent to your email."));try{const O=await _e.functions.invoke("record-plan",{body:{session_id:c}});O.error?(localStorage.setItem("pendingPlanSelection",_),console.error("record-plan error:",O.error)):He.success("Your plan has been recorded.")}catch(O){console.error("Error persisting plan selection via backend:",O),localStorage.setItem("pendingPlanSelection",_)}}else He.error(P?"Payment successful, but missing customer details for contract. Please contact support.":"Payment successful, but received an invalid plan from checkout. Please contact support.")}catch(y){console.error("Error processing payment success:",y),He.error("Payment successful, but failed to process contract. Please contact support.")}finally{n(!1)}})()},[c,t]);const u=h=>({basic:"Basic Plan",professional:"Professional Plan",enterprise:"Enterprise Plan"})[h]||h;return r?x.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gradient-primary",children:x.jsx(Ke,{className:"max-w-md w-full mx-4",children:x.jsxs(ze,{className:"flex flex-col items-center py-8",children:[x.jsx(eT,{className:"h-12 w-12 animate-spin text-primary mb-4"}),x.jsx("h2",{className:"text-lg font-semibold mb-2",children:"Processing your payment..."}),x.jsx("p",{className:"text-muted-foreground text-center",children:"Please wait while we confirm your payment and prepare your contract."})]})})}):x.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gradient-primary",children:x.jsxs(Ke,{className:"max-w-md w-full mx-4",children:[x.jsxs(rt,{className:"text-center",children:[x.jsx("div",{className:"mx-auto mb-4 flex h-16 w-16 items-center justify-center rounded-full bg-green-100",children:x.jsx(pM,{className:"h-8 w-8 text-green-600"})}),x.jsx(ct,{className:"text-2xl text-primary",children:"Payment Successful!"})]}),x.jsxs(ze,{className:"text-center space-y-4",children:[a&&x.jsxs("div",{className:"bg-muted rounded-lg p-4 text-left",children:[x.jsx("h3",{className:"font-semibold mb-2",children:"Payment Details:"}),x.jsxs("div",{className:"space-y-1 text-sm",children:[x.jsxs("p",{children:[x.jsx("span",{className:"font-medium",children:"Plan:"})," ",u(((d=a.metadata)==null?void 0:d.plan)||"N/A")]}),x.jsxs("p",{children:[x.jsx("span",{className:"font-medium",children:"Amount:"})," $",(a.amount_total/100).toFixed(2)]}),x.jsxs("p",{children:[x.jsx("span",{className:"font-medium",children:"Email:"})," ",a.customer_email||((f=a.customer_details)==null?void 0:f.email)]})]})]}),i?x.jsxs("div",{className:"flex items-center justify-center space-x-2 text-green-600",children:[x.jsx(Lx,{className:"h-5 w-5"}),x.jsx("span",{className:"font-medium",children:"Contract sent to your email!"})]}):x.jsx("div",{className:"text-amber-600",children:x.jsx("p",{className:"text-sm",children:"Contract sending failed. Please contact support for your contract."})}),x.jsxs("div",{className:"space-y-3 pt-4",children:[x.jsx("p",{className:"text-muted-foreground text-sm",children:"Your payment has been processed successfully. You should receive a confirmation email shortly."}),x.jsxs("div",{className:"space-y-2",children:[x.jsxs(Re,{onClick:()=>
356t("/dashboard"),className:"w-full",size:"lg",children:["Go to Dashboard",x.jsx(gG,{className:"h-4 w-4 ml-2"})]}),x.jsx(Re,{onClick:()=>t("/"),variant:"outline",className:"w-full",children:"Back to Home"})]})]})]})]})})},q_e=()=>{const t=Ir(),{user:e,loading:r,signOut:n}=yn(),{isAdmin:i,checking:s}=cu(e),[a,o]=E.useState(!1),[l,c]=E.useState({stream_id:"",sequence_number:"",user_id:"",hls_url:""});E.useEffect(()=>{r||s||(!e||!i)&&t("/")},[e,r,s,i,t]);const u=async h=>{var p,g;h.preventDefault(),o(!0);try{if(!l.user_id.trim()){He.error("User ID is required");return}const m={stream_id:l.stream_id,sequence_number:parseInt(l.sequence_number),user_id:l.user_id.trim(),hls_url:l.hls_url.trim()||null};console.log("Attempting to insert stream data:",m);const{error:v}=await _e.from("stream_data").insert([m]);if(v)throw console.error("Supabase error:",v),v;He.success("Stream added successfully!"),c({stream_id:"",sequence_number:"",user_id:"",hls_url:""})}catch(m){console.error("Error adding stream:",m),(p=m==null?void 0:m.message)!=null&&p.includes("foreign key constraint")&&((g=m==null?void 0:m.message)!=null&&g.includes("user_id"))?He.error("User does not exist"):He.error(`Failed to add stream: ${(m==null?void 0:m.message)||"Unknown error"}`)}finally{o(!1)}},d=async()=>{try{await n(),He.success("Logged out successfully"),t("/")}catch(h){console.error("Logout error:",h)}},f=(h,p)=>{c(g=>({...g,[h]:p}))};return r||s?x.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background",children:x.jsxs("div",{className:"text-center",children:[x.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-primary mx-auto mb-4"}),x.jsx("p",{className:"text-muted-foreground",children:"Loading..."})]})}):!e||!i?null:x.jsx("div",{className:"min-h-screen bg-background p-6",children:x.jsxs("div",{className:"max-w-2xl mx-auto",children:[x.jsxs("div",{className:"flex items-center gap-4 mb-6",children:[x.jsx(Re,{variant:"ghost",size:"icon",onClick:()=>t("/"),className:"h-8 w-8",children:x.jsx(pv,{className:"h-4 w-4"})}),x.jsx("h1",{className:"text-2xl font-bold text-foreground",children:"Admin - Add Stream"}),x.jsxs(Re,{onClick:d,variant:"destructive",size:"sm",className:"gap-2 ml-auto",children:[x.jsx(Bd,{className:"h-4 w-4"}),"Logout"]})]}),x.jsxs(Ke,{children:[x.jsxs(rt,{children:[x.jsxs(ct,{className:"flex items-center gap-2",children:[x.jsx(mM,{className:"h-5 w-5"}),"Add New Stream"]}),x.jsx(ti,{children:"Add a new stream to the database"})]}),x.jsx(ze,{children:x.jsxs("form",{onSubmit:u,className:"space-y-4",children:[x.jsxs("div",{className:"space-y-2",children:[x.jsx(Dt,{htmlFor:"stream_id",children:"Stream ID *"}),x.jsx(ir,{id:"stream_id",type:"text",value:l.stream_id,onChange:h=>f("stream_id",h.target.value),placeholder:"Enter stream ID",required:!0})]}),x.jsxs("div",{className:"space-y-2",children:[x.jsx(Dt,{htmlFor:"sequence_number",children:"Sequence Number *"}),x.jsx(ir,{id:"sequence_number",type:"number",value:l.sequence_number,onChange:h=>f("sequence_number",h.target.value),placeholder:"Enter sequence number",required:!0})]}),x.jsxs("div",{className:"space-y-2",children:[x.jsx(Dt,{htmlFor:"user_id",children:"User ID *"}),x.jsx(ir,{id:"user_id",type:"text",value:l.user_id,onChange:h=>f("user_id",h.target.value),placeholder:"Enter user ID",required:!0})]}),x.jsxs("div",{className:"space-y-2",children:[x.jsx(Dt,{htmlFor:"hls_url",children:"HLS URL"}),x.jsx(ir,{id:"hls_url",type:"url",value:l.hls_url,onChange:h=>f("hls_url",h.target.value),placeholder:"e.g. http://mediamtx.local:8888/camera-001/index.m3u8"})]}),x.jsx(Re,{type:"submit",className:"w-full",disabled:a,children:a?"Adding Stream...":"Add Stream"})]})})]})]})})};function Y_e(){const{user:t,loading:e,signOut:r}=yn(),n=Ir(),[i,s]=E.useState([]),[a,o]=E.useState([]),[l,c]=E.useState({user_id:"",name:""}),{isAdmin:u,checking:d}=cu(t),[f,h]=E.useState([]),[p,g]=E.useState(""),[m,v]=E.useState(""),[y,b]=E.useState(""),w=async()=>{try{await r(),He.success("Logged out successfully"),n("/")}catch(P){console.error("Logout error",P)}};E.useEffect(()=>{!e&&!d&&!u&&(He.error("Admin access required"),n("/"))},[e,d,u,n]),E.useEffect(()=>{if(!u||d)return;(async()=>{const{data:C,error:O}=await _e.rpc("admin_list_users_with_plans");O&&(console.error("Failed to load users/plans",O),v(O.message||"Failed to load users and plans"));const R=(C||[]).map(k=>({user_id:k.user_id,email:k.email,name:k.full_name,plan:k.plan||"-",selected_at:k.selected_at||new Date(0).toISOString(),updated_at:k.selected_at||new Date(0).toISOString()}));s(R);const{data:D,error:L}=await _e.from("cameras").select("*").order("created_at",{ascending:!1});L&&(console.error("Failed to load cameras",L),v(k=>k||L.message||"Failed to load cameras")),o(D||[]);const{data:j,error:M}=await _e.from("admins").select("user_id");M&&(console.error("Failed to load admins",M),v(k=>k||M.message||"Failed to load admins"));const N=(j||[]).map(k=>
356k.user_id).filter(Boolean);if(N.length>0){const{data:k}=await _e.from("profiles").select("id, email, name").in("id",N),$=new Map;(k||[]).forEach(U=>$.set(U.id,{email:U.email,name:U.name})),h((j||[]).map(U=>{var G,B;return{user_id:U.user_id,email:(G=$.get(U.user_id))==null?void 0:G.email,name:(B=$.get(U.user_id))==null?void 0:B.name}}))}else h([])})()},[u,d]);const S=async P=>{var R;P.preventDefault();const C=l.user_id.trim(),O=l.name.trim();if(!C||!O){He.error("User ID and Camera Name are required");return}try{const{data:D}=await _e.auth.getSession(),L=(R=D==null?void 0:D.session)==null?void 0:R.access_token;if(!L)throw new Error("Not authenticated");const{data:j,error:M}=await _e.functions.invoke("create-camera-stream",{body:{name:O},headers:{Authorization:`Bearer ${L}`}});if(M)throw new Error(M.message||"Failed to create AWS stream");const N={user_id:C,name:O,aws_stream_name:(j==null?void 0:j.streamName)||null,aws_stream_arn:(j==null?void 0:j.streamArn)||null},{error:k}=await _e.from("cameras").insert(N);if(k)throw k;He.success("Camera created and stream ensured"),c({user_id:"",name:""});const{data:$}=await _e.from("cameras").select("*").order("created_at",{ascending:!1});o($||[])}catch(D){console.error(D),He.error((D==null?void 0:D.message)||"Failed creating camera stream")}},T=async()=>{const{data:P}=await _e.from("admins").select("user_id"),C=(P||[]).map(O=>O.user_id).filter(Boolean);if(C.length>0){const{data:O}=await _e.from("profiles").select("id, email, name").in("id",C),R=new Map;(O||[]).forEach(D=>R.set(D.id,{email:D.email,name:D.name})),h((P||[]).map(D=>{var L,j;return{user_id:D.user_id,email:(L=R.get(D.user_id))==null?void 0:L.email,name:(j=R.get(D.user_id))==null?void 0:j.name}}))}else h([])},_=async P=>{P.preventDefault();const C=p.trim();if(!C){He.error("User ID is required");return}try{const{error:O}=await _e.rpc("add_admin",{target_user_id:C});if(O)throw O;He.success("Admin added"),g(""),await T()}catch(O){console.error(O),He.error((O==null?void 0:O.message)||"Failed to add admin")}},A=async P=>{try{const{error:C}=await _e.rpc("remove_admin",{target_user_id:P});if(C)throw C;He.success("Admin removed"),await T()}catch(C){console.error(C),He.error((C==null?void 0:C.message)||"Failed to remove admin")}};return e||d||!u?null:x.jsx("div",{className:"min-h-screen bg-background p-6",children:x.jsxs("div",{className:"max-w-5xl mx-auto space-y-8",children:[m&&x.jsx(So,{variant:"destructive",children:x.jsx(Eo,{children:m})}),x.jsxs("div",{className:"flex items-center justify-between gap-3",children:[x.jsx("h1",{className:"text-2xl font-bold",children:"Admin Panel"}),x.jsxs("div",{className:"flex items-center gap-2",children:[x.jsx(Re,{variant:"outline",onClick:()=>n("/dashboard"),children:"Back to Dashboard"}),x.jsx(Re,{variant:"destructive",onClick:w,children:"Sign Out"})]})]}),x.jsxs(Ke,{children:[x.jsx(rt,{children:x.jsx(ct,{children:"Admin Management"})}),x.jsxs(ze,{children:[x.jsxs("form",{onSubmit:_,className:"grid grid-cols-1 md:grid-cols-3 gap-4 items-end mb-6",children:[x.jsxs("div",{children:[x.jsx(Dt,{children:"Admin User ID (UUID)"}),x.jsx(ir,{value:p,onChange:P=>g(P.target.value),placeholder:"auth.users id"})]}),x.jsxs("div",{children:[x.jsx(Dt,{children:" "}),x.jsx(Re,{type:"submit",className:"w-full",children:"Add Admin"})]})]}),x.jsx("div",{className:"overflow-x-auto",children:x.jsxs("table",{className:"w-full text-sm",children:[x.jsx("thead",{children:x.jsxs("tr",{className:"text-left text-muted-foreground",children:[x.jsx("th",{className:"py-2",children:"User ID"}),x.jsx("th",{className:"py-2",children:"Email"}),x.jsx("th",{className:"py-2",children:"Name"}),x.jsx("th",{className:"py-2",children:"Actions"})]})}),x.jsxs("tbody",{children:[f.map(P=>x.jsxs("tr",{className:"border-t",children:[x.jsx("td",{className:"py-2 font-mono text-xs pr-2",children:P.user_id}),x.jsx("td",{className:"py-2",children:P.email||"-"}),x.jsx("td",{className:"py-2",children:P.name||"-"}),x.jsx("td",{className:"py-2",children:x.jsx(Re,{variant:"destructive",size:"sm",className:"h-8 px-2",onClick:()=>A(P.user_id),children:x.jsx(TG,{className:"h-4 w-4"})})})]},P.user_id)),f.length===0&&x.jsx("tr",{children:x.jsx("td",{className:"py-4 text-center text-muted-foreground",colSpan:4,children:"No admins yet."})})]})]})})]})]}),x.jsxs(Ke,{children:[x.jsx(rt,{children:x.jsx(ct,{children:"Users and Plans"})}),x.jsx(ze,{children:x.jsx("div",{className:"overflow-x-auto",children:x.jsxs("table",{className:"w-full text-sm",children:[x.jsx("thead",{children:x.jsxs("tr",{className:"text-left text-muted-foreground",children:[x.jsx("th",{className:"py-2",children:"User ID"}),x.jsx("th",{className:"py-2",children:"Email"}),x.jsx("th",{className:"py-2",children:"Name"}),x.jsx("th",{className:"py-2",children:"Plan"}),x.jsx("th",{className:"py-2",children:"Selected At"}),x.jsx("th",{className:"py-2",children:"Actions"})]})}),x.jsxs("tbody",{children:[i.map(P=>x.jsxs("tr",{className:"border-t",children:[x.jsx("td",{className:"py-2 font-mono text-xs pr-2",children:P.user_id}),x.jsx("td",{className:"py-2",children:P.email||"-"}),x.jsx("td",{className:"py-2",children:P.name||"-"}),x.jsx("td",{className:"py-2 capitalize",children:P.plan||"-"}),x.jsx("td",{className:"py-2",children:P.plan&&P.plan!=="-"?new Date(P.selected_at).toLocaleStr
356ing():"-"}),x.jsxs("td",{className:"py-2 flex gap-2",children:[x.jsx(Re,{size:"sm",variant:"outline",disabled:!P.plan||P.plan==="-",onClick:()=>b(P.user_id),children:y===P.user_id?"Selected":"Select"}),x.jsx(_i,{to:`/admin/users/${P.user_id}/streams`,children:x.jsx(Re,{size:"sm",disabled:!P.plan||P.plan==="-",children:"Manage Streams"})})]})]},P.user_id)),i.length===0&&x.jsx("tr",{children:x.jsx("td",{className:"py-4 text-center text-muted-foreground",colSpan:6,children:"No users found."})})]})]})})})]}),x.jsxs(Ke,{children:[x.jsx(rt,{children:x.jsx(ct,{children:"Create Camera + AWS Stream"})}),x.jsxs(ze,{children:[x.jsxs("form",{onSubmit:S,className:"grid grid-cols-1 md:grid-cols-3 gap-4 items-end",children:[x.jsxs("div",{children:[x.jsx(Dt,{children:"User ID"}),x.jsx(ir,{value:l.user_id||y,onChange:P=>c({...l,user_id:P.target.value}),placeholder:"auth.users id (UUID)"}),y&&!l.user_id&&x.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Using selected user from above"})]}),x.jsxs("div",{children:[x.jsx(Dt,{children:"Camera Name"}),x.jsx(ir,{value:l.name,onChange:P=>c({...l,name:P.target.value}),placeholder:"e.g., Front Door"})]}),x.jsx("div",{children:x.jsx(Re,{type:"submit",className:"w-full",children:"Create Stream"})})]}),x.jsxs("div",{className:"mt-6",children:[x.jsx("h3",{className:"font-semibold mb-2",children:"Recent Cameras"}),x.jsx("div",{className:"overflow-x-auto",children:x.jsxs("table",{className:"w-full text-sm",children:[x.jsx("thead",{children:x.jsxs("tr",{className:"text-left text-muted-foreground",children:[x.jsx("th",{className:"py-2",children:"Name"}),x.jsx("th",{className:"py-2",children:"User ID"}),x.jsx("th",{className:"py-2",children:"AWS Stream Name"}),x.jsx("th",{className:"py-2",children:"AWS ARN"})]})}),x.jsxs("tbody",{children:[a.map(P=>x.jsxs("tr",{className:"border-t",children:[x.jsx("td",{className:"py-2",children:P.name}),x.jsx("td",{className:"py-2 font-mono text-xs pr-2",children:P.user_id}),x.jsx("td",{className:"py-2",children:P.aws_stream_name||"-"}),x.jsx("td",{className:"py-2 font-mono text-xs",children:P.aws_stream_arn||"-"})]},P.id)),a.length===0&&x.jsx("tr",{children:x.jsx("td",{className:"py-4 text-center text-muted-foreground",colSpan:4,children:"No cameras yet."})})]})]})})]})]})]})]})})}function X_e(){const{userId:t}=PK(),e=Ir(),{user:r,loading:n,signOut:i}=yn(),{isAdmin:s,checking:a}=cu(r),[o,l]=E.useState(""),[c,u]=E.useState(""),[d,f]=E.useState([]),[h,p]=E.useState(""),[g,m]=E.useState(!1);E.useEffect(()=>{n||a||(!r||!s||!t)&&e("/")},[r,n,a,s,t,e]);const v=async()=>{if(!t)return;const{data:w}=await _e.from("profiles").select("email, name").eq("id",t).maybeSingle();l((w==null?void 0:w.email)||""),u((w==null?void 0:w.name)||"");const{data:S,error:T}=await _e.from("cameras").select("*").eq("user_id",t).order("created_at",{ascending:!1});T&&console.error("Failed to load cameras",T),f(S||[])};E.useEffect(()=>{v()},[t]);const y=async w=>{var T;if(w.preventDefault(),!t)return;const S=h.trim();if(!S){He.error("Camera name is required");return}try{m(!0);const{data:_}=await _e.auth.getSession(),A=(T=_==null?void 0:_.session)==null?void 0:T.access_token;if(!A)throw new Error("Not authenticated");const{data:P,error:C}=await _e.functions.invoke("create-camera-stream",{body:{name:S},headers:{Authorization:`Bearer ${A}`}});if(C)throw new Error(C.message||"Failed to create AWS stream");const O={user_id:t,name:S,aws_stream_name:(P==null?void 0:P.streamName)||null,aws_stream_arn:(P==null?void 0:P.streamArn)||null},{error:R}=await _e.from("cameras").insert(O);if(R)throw R;He.success("Camera added for user"),p(""),await v()}catch(_){console.error(_),He.error((_==null?void 0:_.message)||"Failed to add camera")}finally{m(!1)}},b=async()=>{try{await i(),He.success("Logged out successfully"),e("/")}catch(w){console.error("Logout error",w)}};return n||a||!s?null:x.jsx("div",{className:"min-h-screen bg-background p-6",children:x.jsxs("div",{className:"max-w-4xl mx-auto space-y-8",children:[x.jsxs("div",{className:"flex items-center gap-3",children:[x.jsx(Re,{variant:"ghost",size:"icon",onClick:()=>e("/admin"),className:"h-8 w-8",children:x.jsx(pv,{className:"h-4 w-4"})}),x.jsx("h1",{className:"text-2xl font-bold",children:"Streams for User"}),x.jsx("div",{className:"ml-auto flex items-center gap-2",children:x.jsxs(Re,{variant:"destructive",size:"sm",onClick:b,className:"gap-2",children:[x.jsx(Bd,{className:"h-4 w-4"})," Sign Out"]})})]}),x.jsxs(Ke,{children:[x.jsx(rt,{children:x.jsx(ct,{children:"User Details"})}),x.jsx(ze,{children:x.jsxs("div",{className:"text-sm text-muted-foreground",children:[x.jsxs("div",{children:[x.jsx("span",{className:"font-medium text-foreground",children:"User ID:"})," ",x.jsx("span",{className:"font-mono",children:t})]}),x.jsxs("div",{children:[x.jsx("span",{className:"font-medium text-foreground",children:"Email:"})," ",o||"-"]}
356),x.jsxs("div",{children:[x.jsx("span",{className:"font-medium text-foreground",children:"Name:"})," ",c||"-"]})]})})]}),x.jsxs(Ke,{children:[x.jsx(rt,{children:x.jsx(ct,{children:"Add Camera/Stream"})}),x.jsx(ze,{children:x.jsxs("form",{onSubmit:y,className:"grid grid-cols-1 md:grid-cols-3 gap-4 items-end",children:[x.jsxs("div",{children:[x.jsx(Dt,{children:"Camera Name"}),x.jsx(ir,{value:h,onChange:w=>p(w.target.value),placeholder:"e.g., Entrance"})]}),x.jsx("div",{className:"md:col-span-2",children:x.jsxs(Re,{type:"submit",className:"w-full md:w-auto",disabled:g,children:[x.jsx(mM,{className:"h-4 w-4 mr-2"})," ",g?"Adding...":"Add Camera"]})})]})})]}),x.jsxs(Ke,{children:[x.jsx(rt,{children:x.jsx(ct,{children:"Existing Cameras"})}),x.jsx(ze,{children:x.jsx("div",{className:"overflow-x-auto",children:x.jsxs("table",{className:"w-full text-sm",children:[x.jsx("thead",{children:x.jsxs("tr",{className:"text-left text-muted-foreground",children:[x.jsx("th",{className:"py-2",children:"Name"}),x.jsx("th",{className:"py-2",children:"AWS Stream Name"}),x.jsx("th",{className:"py-2",children:"AWS ARN"})]})}),x.jsxs("tbody",{children:[d.map(w=>x.jsxs("tr",{className:"border-t",children:[x.jsx("td",{className:"py-2",children:w.name}),x.jsx("td",{className:"py-2",children:w.aws_stream_name||"-"}),x.jsx("td",{className:"py-2 font-mono text-xs",children:w.aws_stream_arn||"-"})]},w.id)),d.length===0&&x.jsx("tr",{children:x.jsx("td",{className:"py-4 text-center text-muted-foreground",colSpan:3,children:"No cameras yet."})})]})]})})})]})]})})}function $e(t){const e=Object.prototype.toString.call(t);return t instanceof Date||typeof t=="object"&&e==="[object Date]"?new t.constructor(+t):typeof t=="number"||e==="[object Number]"||typeof t=="string"||e==="[object String]"?new Date(t):new Date(NaN)}function mn(t,e){return t instanceof Date?new t.constructor(e):new Date(e)}function Or(t,e){const r=$e(t);return isNaN(e)?mn(t,NaN):(e&&r.setDate(r.getDate()+e),r)}function fi(t,e){const r=$e(t);if(isNaN(e))return mn(t,NaN);if(!e)return r;const n=r.getDate(),i=mn(t,r.getTime());i.setMonth(r.getMonth()+e+1,0);const s=i.getDate();return n>=s?i:(r.setFullYear(i.getFullYear(),i.getMonth(),n),r)}const J_=6048e5,Q_e=864e5;let J_e={};function dh(){return J_e}function Gi(t,e){var o,l,c,u;const r=dh(),n=(e==null?void 0:e.weekStartsOn)??((l=(o=e==null?void 0:e.locale)==null?void 0:o.options)==null?void 0:l.weekStartsOn)??r.weekStartsOn??((u=(c=r.locale)==null?void 0:c.options)==null?void 0:u.weekStartsOn)??0,i=$e(t),s=i.getDay(),a=(s<n?7:0)+s-n;return i.setDate(i.getDate()-a),i.setHours(0,0,0,0),i}function Wo(t){return Gi(t,{weekStartsOn:1})}function i3(t){const e=$e(t),r=e.getFullYear(),n=mn(t,0);n.setFullYear(r+1,0,4),n.setHours(0,0,0,0);const i=Wo(n),s=mn(t,0);s.setFullYear(r,0,4),s.setHours(0,0,0,0);const a=Wo(s);return e.getTime()>=i.getTime()?r+1:e.getTime()>=a.getTime()?r:r-1}function zc(t){const e=$e(t);return e.setHours(0,0,0,0),e}function Hg(t){const e=$e(t),r=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return r.setUTCFullYear(e.getFullYear()),+t-+r}function Ri(t,e){const r=zc(t),n=zc(e),i=+r-Hg(r),s=+n-Hg(n);return Math.round((i-s)/Q_e)}function Z_e(t){const e=i3(t),r=mn(t,0);return r.setFullYear(e,0,4),r.setHours(0,0,0,0),Wo(r)}function zS(t,e){const r=e*7;return Or(t,r)}function e1e(t,e){return fi(t,e*12)}function t1e(t){let e;return t.forEach(function(r){const n=$e(r);(e===void 0||e<n||isNaN(Number(n)))&&(e=n)}),e||new Date(NaN)}function r1e(t){let e;return t.forEach(r=>{const n=$e(r);(!e||e>n||isNaN(+n))&&(e=n)}),e||new Date(NaN)}function Vr(t,e){const r=zc(t),n=zc(e);return+r==+n}function Z_(t){return t instanceof Date||typeof t=="object"&&Object.prototype.toString.call(t)==="[object Date]"}function n1e(t){if(!Z_(t)&&typeof t!="number")return!1;const e=$e(t);return!isNaN(Number(e))}function Wf(t,e){const r=$e(t),n=$e(e),i=r.getFullYear()-n.getFullYear(),s=r.getMonth()-n.getMonth();return i*12+s}function i1e(t,e,r){const n=Gi(t,r),i=Gi(e,r),s=+n-Hg(n),a=+i-Hg(i);return Math.round((s-a)/J_)}
vendor: 6,538 bytes, line 356
356function e1(t){const e=$e(t),r=e.getMonth();return e.setFullYear(e.getFullYear(),r+1,0),e.setHours(23,59,59,999),e}function qr(t){const e=$e(t);return e.setDate(1),e.setHours(0,0,0,0),e}function s3(t){const e=$e(t),r=mn(t,0);return r.setFullYear(e.getFullYear(),0,1),r.setHours(0,0,0,0),r}function t1(t,e){var o,l,c,u;const r=dh(),n=(e==null?void 0:e.weekStartsOn)??((l=(o=e==null?void 0:e.locale)==null?void 0:o.options)==null?void 0:l.weekStartsOn)??r.weekStartsOn??((u=(c=r.locale)==null?void 0:c.options)==null?void 0:u.weekStartsOn)??0,i=$e(t),s=i.getDay(),a=(s<n?-7:0)+6-(s-n);return i.setDate(i.getDate()+a),i.setHours(23,59,59,999),i}function a3(t){return t1(t,{weekStartsOn:1})}const s1e={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},a1e=(t,e,r)=>{let n;const i=s1e[t];return typeof i=="string"?n=i:e===1?n=i.one:n=i.other.replace("{{count}}",e.toString()),r!=null&&r.addSuffix?r.comparison&&r.comparison>0?"in "+n:n+" ago":n};function Sb(t){return(e={})=>{const r=e.width?String(e.width):t.defaultWidth;return t.formats[r]||t.formats[t.defaultWidth]}}const o1e={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},l1e={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},c1e={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},u1e={date:Sb({formats:o1e,defaultWidth:"full"}),time:Sb({formats:l1e,defaultWidth:"full"}),dateTime:Sb({formats:c1e,defaultWidth:"full"})},d1e={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},f1e=(t,e,r,n)=>d1e[t];function Hu(t){return(e,r)=>{const n=r!=null&&r.context?String(r.context):"standalone";let i;if(n==="formatting"&&t.formattingValues){const a=t.defaultFormattingWidth||t.defaultWidth,o=r!=null&&r.width?String(r.width):a;i=t.formattingValues[o]||t.formattingValues[a]}else{const a=t.defaultWidth,o=r!=null&&r.width?String(r.width):t.defaultWidth;i=t.values[o]||t.values[a]}const s=t.argumentCallback?t.argumentCallback(e):e;return i[s]}}const h1e={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},p1e={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},m1e={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},g1e={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},v1e={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},y1e={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},b1e=(t,e)=>{const r=Number(t),n=r%100;if(n>20||n<10)switch(n%10){case 1:return r+"st";case 2:return r+"nd";case 3:return r+"rd"}return r+"th"},x1e={ordinalNumber:b1e,era:Hu({values:h1e,defaultWidth:"wide"}),quarter:Hu({values:p1e,defaultWidth:"wide",argumentCallback:t=>t-1}),month:Hu({values:m1e,defaultWidth:"wide"}),day:Hu({values:g1e,defaultWidth:"wide"}),dayPeriod:Hu({values:v1e,defaultWidth:"wide",formattingValues:y1e,defaultFormattingWidth:"wide"})};function Ku(t){return(e,r={})=>{const n=r.width,i=n&&t.matchPatterns[n]||t.matchPatterns[t.defaultMatchWidth],s=e.match(i);if(!s)return null;const a=s[0],o=n&&t.parsePatterns[n]||t.parsePatterns[t.defaultParseWidth],l=Array.isArray(o)?S1e(o,d=>d.test(a)):w1e(o,d=>d.test(a));let c;c=t.valueCallback?t.valueCallback(l):l,c=r.valueCallback?r.valueCallback(c):c;const u=e.slice(a.length);return{value:c,rest:u}}}function w1e(t,e){for(const r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&e(t[r]))return r}function S1e(t,e){for(let r=0;r<t.length;r++)if(e(t[r]))return r}function E1e(t){return(e,r={})=>{const n=e.match(t.matchPattern);if(!n)return null;const i=n[0],s=e.match(t.parsePattern);if(!s)return null;let a=t.valueCallback?t.valueCallback(s[0]):s[0];a=r.valueCallback?r.valueCallback(a):a;const o=e.slice(i.length);return{value:a,rest:o}}}const T1e=/^(\d+)(th|st|nd|rd)?/i,_1e=/\d+/i,A1e={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},P1e={any:[/^b/i,/^(a|c)/i]},I1e={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},C1e={any:[/1/i,/2/i,/3/i,/4/i]},O1e={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},R1e={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]}
vendor: 5,371 bytes, line 356
356,k1e={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},L1e={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},D1e={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},N1e={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},M1e={ordinalNumber:E1e({matchPattern:T1e,parsePattern:_1e,valueCallback:t=>parseInt(t,10)}),era:Ku({matchPatterns:A1e,defaultMatchWidth:"wide",parsePatterns:P1e,defaultParseWidth:"any"}),quarter:Ku({matchPatterns:I1e,defaultMatchWidth:"wide",parsePatterns:C1e,defaultParseWidth:"any",valueCallback:t=>t+1}),month:Ku({matchPatterns:O1e,defaultMatchWidth:"wide",parsePatterns:R1e,defaultParseWidth:"any"}),day:Ku({matchPatterns:k1e,defaultMatchWidth:"wide",parsePatterns:L1e,defaultParseWidth:"any"}),dayPeriod:Ku({matchPatterns:D1e,defaultMatchWidth:"any",parsePatterns:N1e,defaultParseWidth:"any"})},o3={code:"en-US",formatDistance:a1e,formatLong:u1e,formatRelative:f1e,localize:x1e,match:M1e,options:{weekStartsOn:0,firstWeekContainsDate:1}};function $1e(t){const e=$e(t);return Ri(e,s3(e))+1}function l3(t){const e=$e(t),r=+Wo(e)-+Z_e(e);return Math.round(r/J_)+1}function c3(t,e){var u,d,f,h;const r=$e(t),n=r.getFullYear(),i=dh(),s=(e==null?void 0:e.firstWeekContainsDate)??((d=(u=e==null?void 0:e.locale)==null?void 0:u.options)==null?void 0:d.firstWeekContainsDate)??i.firstWeekContainsDate??((h=(f=i.locale)==null?void 0:f.options)==null?void 0:h.firstWeekContainsDate)??1,a=mn(t,0);a.setFullYear(n+1,0,s),a.setHours(0,0,0,0);const o=Gi(a,e),l=mn(t,0);l.setFullYear(n,0,s),l.setHours(0,0,0,0);const c=Gi(l,e);return r.getTime()>=o.getTime()?n+1:r.getTime()>=c.getTime()?n:n-1}function j1e(t,e){var o,l,c,u;const r=dh(),n=(e==null?void 0:e.firstWeekContainsDate)??((l=(o=e==null?void 0:e.locale)==null?void 0:o.options)==null?void 0:l.firstWeekContainsDate)??r.firstWeekContainsDate??((u=(c=r.locale)==null?void 0:c.options)==null?void 0:u.firstWeekContainsDate)??1,i=c3(t,e),s=mn(t,0);return s.setFullYear(i,0,n),s.setHours(0,0,0,0),Gi(s,e)}function u3(t,e){const r=$e(t),n=+Gi(r,e)-+j1e(r,e);return Math.round(n/J_)+1}function Ge(t,e){const r=t<0?"-":"",n=Math.abs(t).toString().padStart(e,"0");return r+n}const Us={y(t,e){const r=t.getFullYear(),n=r>0?r:1-r;return Ge(e==="yy"?n%100:n,e.length)},M(t,e){const r=t.getMonth();return e==="M"?String(r+1):Ge(r+1,2)},d(t,e){return Ge(t.getDate(),e.length)},a(t,e){const r=t.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return r.toUpperCase();case"aaa":return r;case"aaaaa":return r[0];case"aaaa":default:return r==="am"?"a.m.":"p.m."}},h(t,e){return Ge(t.getHours()%12||12,e.length)},H(t,e){return Ge(t.getHours(),e.length)},m(t,e){return Ge(t.getMinutes(),e.length)},s(t,e){return Ge(t.getSeconds(),e.length)},S(t,e){const r=e.length,n=t.getMilliseconds(),i=Math.trunc(n*Math.pow(10,r-3));return Ge(i,e.length)}},gl={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},Yk={G:function(t,e,r){const n=t.getFullYear()>0?1:0;switch(e){case"G":case"GG":case"GGG":return r.era(n,{width:"abbreviated"});case"GGGGG":return r.era(n,{width:"narrow"});case"GGGG":default:return r.era(n,{width:"wide"})}},y:function(t,e,r){if(e==="yo"){const n=t.getFullYear(),i=n>0?n:1-n;return r.ordinalNumber(i,{unit:"year"})}return Us.y(t,e)},Y:function(t,e,r,n){const i=c3(t,n),s=i>0?i:1-i;if(e==="YY"){const a=s%100;return Ge(a,2)}return e==="Yo"?r.ordinalNumber(s,{unit:"year"}):Ge(s,e.length)},R:function(t,e){const r=i3(t);return Ge(r,e.length)},u:function(t,e){const r=t.getFullYear();return Ge(r,e.length)},Q:function(t,e,r){const n=Math.ceil((t.getMonth()+1)/3);switch(e){case"Q":return String(n);case"QQ":return Ge(n,2);case"Qo":return r.ordinalNumber(n,{unit:"quarter"});case"QQQ":return r.quarter(n,{width:"abbreviated",context:"formatting"});case"QQQQQ":return r.quarter(n,{width:"narrow",context:"formatting"});case"QQQQ":default:return r.quarter(n,{width:"wide",context:"formatting"})}},q:function(t,e,r){const n=Math.ceil((t.getMonth()+1)/3);switch(e){case"q":return String(n);case"qq":return Ge(n,2);case"qo":return r.ordinalNumber(n,{unit:"quarter"});case"qqq":return r.quarter(n,{width:"abbreviated",context:"standalone"});case"qqqqq":return r.quarter(n,{width:"narrow",context:"standalone"});case"qqqq":default:return r.quarter(n,{width:"wide",context:"standalone"})}},M:function(t,e,r){const n=t.getMonth();switch(e){case"M":case"MM":return Us.M(t,e);case"Mo":return r.ordinalNumber(n+1,{unit:"month"});case"MMM":return r.month(n,{width:"abbreviated",context:"formatting"});case"MMMMM":return r.month(n,{width:"narrow",context:"formatting"});case"MMMM":default:return r.month(n,{width:"wide",context:"formatting"})}},L:function(t,e,r){const n=t.getMonth();switch(e){case"L":return String(n+1);case"LL":return Ge(n+1,2);case"Lo":return r.ordinalNumber(n+1,{unit:"month"});case"LLL":return r.month(n,{width:"abbreviated",context:"standalone"});case"LLLLL":return r.month(n,{width:"narrow",context:"standalone"});case"LLLL":default:return r.month(n,{width:"wide",context:"standalone"})}}
vendor: 4,511 bytes, line 356
356,w:function(t,e,r,n){const i=u3(t,n);return e==="wo"?r.ordinalNumber(i,{unit:"week"}):Ge(i,e.length)},I:function(t,e,r){const n=l3(t);return e==="Io"?r.ordinalNumber(n,{unit:"week"}):Ge(n,e.length)},d:function(t,e,r){return e==="do"?r.ordinalNumber(t.getDate(),{unit:"date"}):Us.d(t,e)},D:function(t,e,r){const n=$1e(t);return e==="Do"?r.ordinalNumber(n,{unit:"dayOfYear"}):Ge(n,e.length)},E:function(t,e,r){const n=t.getDay();switch(e){case"E":case"EE":case"EEE":return r.day(n,{width:"abbreviated",context:"formatting"});case"EEEEE":return r.day(n,{width:"narrow",context:"formatting"});case"EEEEEE":return r.day(n,{width:"short",context:"formatting"});case"EEEE":default:return r.day(n,{width:"wide",context:"formatting"})}},e:function(t,e,r,n){const i=t.getDay(),s=(i-n.weekStartsOn+8)%7||7;switch(e){case"e":return String(s);case"ee":return Ge(s,2);case"eo":return r.ordinalNumber(s,{unit:"day"});case"eee":return r.day(i,{width:"abbreviated",context:"formatting"});case"eeeee":return r.day(i,{width:"narrow",context:"formatting"});case"eeeeee":return r.day(i,{width:"short",context:"formatting"});case"eeee":default:return r.day(i,{width:"wide",context:"formatting"})}},c:function(t,e,r,n){const i=t.getDay(),s=(i-n.weekStartsOn+8)%7||7;switch(e){case"c":return String(s);case"cc":return Ge(s,e.length);case"co":return r.ordinalNumber(s,{unit:"day"});case"ccc":return r.day(i,{width:"abbreviated",context:"standalone"});case"ccccc":return r.day(i,{width:"narrow",context:"standalone"});case"cccccc":return r.day(i,{width:"short",context:"standalone"});case"cccc":default:return r.day(i,{width:"wide",context:"standalone"})}},i:function(t,e,r){const n=t.getDay(),i=n===0?7:n;switch(e){case"i":return String(i);case"ii":return Ge(i,e.length);case"io":return r.ordinalNumber(i,{unit:"day"});case"iii":return r.day(n,{width:"abbreviated",context:"formatting"});case"iiiii":return r.day(n,{width:"narrow",context:"formatting"});case"iiiiii":return r.day(n,{width:"short",context:"formatting"});case"iiii":default:return r.day(n,{width:"wide",context:"formatting"})}},a:function(t,e,r){const i=t.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return r.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"aaa":return r.dayPeriod(i,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return r.dayPeriod(i,{width:"narrow",context:"formatting"});case"aaaa":default:return r.dayPeriod(i,{width:"wide",context:"formatting"})}},b:function(t,e,r){const n=t.getHours();let i;switch(n===12?i=gl.noon:n===0?i=gl.midnight:i=n/12>=1?"pm":"am",e){case"b":case"bb":return r.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"bbb":return r.dayPeriod(i,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return r.dayPeriod(i,{width:"narrow",context:"formatting"});case"bbbb":default:return r.dayPeriod(i,{width:"wide",context:"formatting"})}},B:function(t,e,r){const n=t.getHours();let i;switch(n>=17?i=gl.evening:n>=12?i=gl.afternoon:n>=4?i=gl.morning:i=gl.night,e){case"B":case"BB":case"BBB":return r.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"BBBBB":return r.dayPeriod(i,{width:"narrow",context:"formatting"});case"BBBB":default:return r.dayPeriod(i,{width:"wide",context:"formatting"})}},h:function(t,e,r){if(e==="ho"){let n=t.getHours()%12;return n===0&&(n=12),r.ordinalNumber(n,{unit:"hour"})}return Us.h(t,e)},H:function(t,e,r){return e==="Ho"?r.ordinalNumber(t.getHours(),{unit:"hour"}):Us.H(t,e)},K:function(t,e,r){const n=t.getHours()%12;return e==="Ko"?r.ordinalNumber(n,{unit:"hour"}):Ge(n,e.length)},k:function(t,e,r){let n=t.getHours();return n===0&&(n=24),e==="ko"?r.ordinalNumber(n,{unit:"hour"}):Ge(n,e.length)},m:function(t,e,r){return e==="mo"?r.ordinalNumber(t.getMinutes(),{unit:"minute"}):Us.m(t,e)},s:function(t,e,r){return e==="so"?r.ordinalNumber(t.getSeconds(),{unit:"second"}):Us.s(t,e)},S:function(t,e){return Us.S(t,e)},X:function(t,e,r){const n=t.getTimezoneOffset();if(n===0)return"Z";switch(e){case"X":return Qk(n);case"XXXX":case"XX":return ro(n);case"XXXXX":case"XXX":default:return ro(n,":")}},x:function(t,e,r){const n=t.getTimezoneOffset();switch(e){case"x":return Qk(n);case"xxxx":case"xx":return ro(n);case"xxxxx":case"xxx":default:return ro(n,":")}},O:function(t,e,r){const n=t.getTimezoneOffset();switch(e){case"O":case"OO":case"OOO":return"GMT"+Xk(n,":");case"OOOO":default:return"GMT"+ro(n,":")}},z:function(t,e,r){const n=t.getTimezoneOffset();switch(e){case"z":case"zz":case"zzz":return"GMT"+Xk(n,":");
vendor: 4,363 bytes, line 356
356case"zzzz":default:return"GMT"+ro(n,":")}},t:function(t,e,r){const n=Math.trunc(t.getTime()/1e3);return Ge(n,e.length)},T:function(t,e,r){const n=t.getTime();return Ge(n,e.length)}};function Xk(t,e=""){const r=t>0?"-":"+",n=Math.abs(t),i=Math.trunc(n/60),s=n%60;return s===0?r+String(i):r+String(i)+e+Ge(s,2)}function Qk(t,e){return t%60===0?(t>0?"-":"+")+Ge(Math.abs(t)/60,2):ro(t,e)}function ro(t,e=""){const r=t>0?"-":"+",n=Math.abs(t),i=Ge(Math.trunc(n/60),2),s=Ge(n%60,2);return r+i+e+s}const Jk=(t,e)=>{switch(t){case"P":return e.date({width:"short"});case"PP":return e.date({width:"medium"});case"PPP":return e.date({width:"long"});case"PPPP":default:return e.date({width:"full"})}},d3=(t,e)=>{switch(t){case"p":return e.time({width:"short"});case"pp":return e.time({width:"medium"});case"ppp":return e.time({width:"long"});case"pppp":default:return e.time({width:"full"})}},F1e=(t,e)=>{const r=t.match(/(P+)(p+)?/)||[],n=r[1],i=r[2];if(!i)return Jk(t,e);let s;switch(n){case"P":s=e.dateTime({width:"short"});break;case"PP":s=e.dateTime({width:"medium"});break;case"PPP":s=e.dateTime({width:"long"});break;case"PPPP":default:s=e.dateTime({width:"full"});break}return s.replace("{{date}}",Jk(n,e)).replace("{{time}}",d3(i,e))},B1e={p:d3,P:F1e},U1e=/^D+$/,G1e=/^Y+$/,W1e=["D","DD","YY","YYYY"];function V1e(t){return U1e.test(t)}function H1e(t){return G1e.test(t)}function K1e(t,e,r){const n=z1e(t,e,r);if(console.warn(n),W1e.includes(t))throw new RangeError(n)}function z1e(t,e,r){const n=t[0]==="Y"?"years":"days of the month";return`Use \`${t.toLowerCase()}\` instead of \`${t}\` (in \`${e}\`) for formatting ${n} to the input \`${r}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const q1e=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,Y1e=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,X1e=/^'([^]*?)'?$/,Q1e=/''/g,J1e=/[a-zA-Z]/;function Ts(t,e,r){var u,d,f,h,p,g,m,v;const n=dh(),i=(r==null?void 0:r.locale)??n.locale??o3,s=(r==null?void 0:r.firstWeekContainsDate)??((d=(u=r==null?void 0:r.locale)==null?void 0:u.options)==null?void 0:d.firstWeekContainsDate)??n.firstWeekContainsDate??((h=(f=n.locale)==null?void 0:f.options)==null?void 0:h.firstWeekContainsDate)??1,a=(r==null?void 0:r.weekStartsOn)??((g=(p=r==null?void 0:r.locale)==null?void 0:p.options)==null?void 0:g.weekStartsOn)??n.weekStartsOn??((v=(m=n.locale)==null?void 0:m.options)==null?void 0:v.weekStartsOn)??0,o=$e(t);if(!n1e(o))throw new RangeError("Invalid time value");let l=e.match(Y1e).map(y=>{const b=y[0];if(b==="p"||b==="P"){const w=B1e[b];return w(y,i.formatLong)}return y}).join("").match(q1e).map(y=>{if(y==="''")return{isToken:!1,value:"'"};const b=y[0];if(b==="'")return{isToken:!1,value:Z1e(y)};if(Yk[b])return{isToken:!0,value:y};if(b.match(J1e))throw new RangeError("Format string contains an unescaped latin alphabet character `"+b+"`");return{isToken:!1,value:y}});i.localize.preprocessor&&(l=i.localize.preprocessor(o,l));const c={firstWeekContainsDate:s,weekStartsOn:a,locale:i};return l.map(y=>{if(!y.isToken)return y.value;const b=y.value;(!(r!=null&&r.useAdditionalWeekYearTokens)&&H1e(b)||!(r!=null&&r.useAdditionalDayOfYearTokens)&&V1e(b))&&K1e(b,e,String(t));const w=Yk[b[0]];return w(o,b,i.localize,c)}).join("")}function Z1e(t){const e=t.match(X1e);return e?e[1].replace(Q1e,"'"):t}function eAe(t){const e=$e(t),r=e.getFullYear(),n=e.getMonth(),i=mn(t,0);return i.setFullYear(r,n+1,0),i.setHours(0,0,0,0),i.getDate()}function tAe(t){return Math.trunc(+$e(t)/1e3)}function rAe(t){const e=$e(t),r=e.getMonth();return e.setFullYear(e.getFullYear(),r+1,0),e.setHours(0,0,0,0),e}function nAe(t,e){return i1e(rAe(t),qr(t),e)+1}function qS(t,e){const r=$e(t),n=$e(e);return r.getTime()>n.getTime()}function f3(t,e){const r=$e(t),n=$e(e);return+r<+n}function r1(t,e){const r=$e(t),n=$e(e);return r.getFullYear()===n.getFullYear()&&r.getMonth()===n.getMonth()}function iAe(t,e){const r=$e(t),n=$e(e);return r.getFullYear()===n.getFullYear()}function Eb(t,e){return Or(t,-e)}function Tb(t,e){const r=$e(t),n=r.getFullYear(),i=r.getDate(),s=mn(t,0);s.setFullYear(n,e,15),s.setHours(0,0,0,0);const a=eAe(s);return r.setMonth(e,Math.min(i,a)),r}function Zk(t,e){const r=$e(t);return isNaN(+r)?mn(t,NaN):(r.setFullYear(e),r)}var ye=function(){return ye=Object.assign||function(e){for(var r,n=1,i=arguments.length;n<i;n++){r=arguments[n];
356for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(e[s]=r[s])}return e},ye.apply(this,arguments)};function sAe(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(t);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(t,n[i])&&(r[n[i]]=t[n[i]]);return r}function h3(t,e,r){for(var n=0,i=e.length,s;n<i;n++)(s||!(n in e))&&(s||(s=Array.prototype.slice.call(e,0,n)),s[n]=e[n]);return t.concat(s||Array.prototype.slice.call(e))}function fh(t){return t.mode==="multiple"}function hh(t){return t.mode==="range"}function Ey(t){return t.mode==="single"}var aAe={root:"rdp",multiple_months:"rdp-multiple_months",with_weeknumber:"rdp-with_weeknumber",vhidden:"rdp-vhidden",button_reset:"rdp-button_reset",button:"rdp-button",caption:"rdp-caption",caption_start:"rdp-caption_start",caption_end:"rdp-caption_end",caption_between:"rdp-caption_between",caption_label:"rdp-caption_label",caption_dropdowns:"rdp-caption_dropdowns",dropdown:"rdp-dropdown",dropdown_month:"rdp-dropdown_month",dropdown_year:"rdp-dropdown_year",dropdown_icon:"rdp-dropdown_icon",months:"rdp-months",month:"rdp-month",table:"rdp-table",tbody:"rdp-tbody",tfoot:"rdp-tfoot",head:"rdp-head",head_row:"rdp-head_row",head_cell:"rdp-head_cell",nav:"rdp-nav",nav_button:"rdp-nav_button",nav_button_previous:"rdp-nav_button_previous",nav_button_next:"rdp-nav_button_next",nav_icon:"rdp-nav_icon",row:"rdp-row",weeknumber:"rdp-weeknumber",cell:"rdp-cell",day:"rdp-day",day_today:"rdp-day_today",day_outside:"rdp-day_outside",day_selected:"rdp-day_selected",day_disabled:"rdp-day_disabled",day_hidden:"rdp-day_hidden",day_range_start:"rdp-day_range_start",day_range_end:"rdp-day_range_end",day_range_middle:"rdp-day_range_middle"};function oAe(t,e){return Ts(t,"LLLL y",e)}function lAe(t,e){return Ts(t,"d",e)}function cAe(t,e){return Ts(t,"LLLL",e)}function uAe(t){return"".concat(t)}function dAe(t,e){return Ts(t,"cccccc",e)}function fAe(t,e){return Ts(t,"yyyy",e)}var hAe=Object.freeze({__proto__:null,formatCaption:oAe,formatDay:lAe,formatMonthCaption:cAe,formatWeekNumber:uAe,formatWeekdayName:dAe,formatYearCaption:fAe}),pAe=function(t,e,r){return Ts(t,"do MMMM (EEEE)",r)},mAe=function(){return"Month: "},gAe=function(){return"Go to next month"},vAe=function(){return"Go to previous month"},yAe=function(t,e){return Ts(t,"cccc",e)},bAe=function(t){return"Week n. ".concat(t)},xAe=function(){return"Year: "},wAe=Object.freeze({__proto__:null,labelDay:pAe,labelMonthDropdown:mAe,labelNext:gAe,labelPrevious:vAe,labelWeekNumber:bAe,labelWeekday:yAe,labelYearDropdown:xAe});function SAe(){var t="buttons",e=aAe,r=o3,n={},i={},s=1,a={},o=new Date;return{captionLayout:t,classNames:e,formatters:hAe,labels:wAe,locale:r,modifiersClassNames:n,modifiers:i,numberOfMonths:s,styles:a,today:o,mode:"default"}}function EAe(t){var e=t.fromYear,r=t.toYear,n=t.fromMonth,i=t.toMonth,s=t.fromDate,a=t.toDate;return n?s=qr(n):e&&(s=new Date(e,0,1)),i?a=e1(i):r&&(a=new Date(r,11,31)),{fromDate:s?zc(s):void 0,toDate:a?zc(a):void 0}}var p3=E.createContext(void 0);function TAe(t){var e,r=t.initialProps,n=SAe(),i=EAe(r),s=i.fromDate,a=i.toDate,o=(e=r.captionLayout)!==null&&e!==void 0?e:n.captionLayout;o!=="buttons"&&(!s||!a)&&(o="buttons");var l;(Ey(r)||fh(r)||hh(r))&&(l=r.onSelect);var c=ye(ye(ye({},n),r),{captionLayout:o,classNames:ye(ye({},n.classNames),r.classNames),components:ye({},r.components),formatters:ye(ye({},n.formatters),r.formatters),fromDate:s,labels:ye(ye({},n.labels),r.labels),mode:r.mode||n.mode,modifiers:ye(ye({},n.modifiers),r.modifiers),modifiersClassNames:ye(ye({},n.modifiersClassNames),r.modifiersClassNames),onSelect:l,styles:ye(ye({},n.styles),r.styles),toDate:a});return x.jsx(p3.Provider,{value:c,children:t.children})}function dt(){var t=E.useContext(p3);if(!t)throw new Error("useDayPicker must be used within a DayPickerProvider.");return t}function m3(t){var e=dt(),r=e.locale,n=e.classNames,i=e.styles,s=e.formatters.formatCaption;return x.jsx("div",{className:n.caption_label,style:i.caption_label,"aria-live":"polite",role:"presentation",id:t.id,children:s(t.displayMonth,{locale:r})})}function _Ae(t){return x.jsx("svg",ye({width:"8px",height:"8px",viewBox:"0 0 120 120","data-testid":"iconDropdown"},t,{children:x.jsx("path",{d:"M4.22182541,48.2218254 C8.44222828,44.0014225 15.2388494,43.9273804 19.5496459,47.9996989 L19.7781746,48.2218254 L60,88.443 L100.221825,48.2218254 C104.442228,44.0014225 111.238849,43.9273804 115.549646,47.9996989 L115.7
35678175,48.2218254 C119.998577,52.4422283 120.07262,59.2388494 116.000301,63.5496459 L115.778175,63.7781746 L67.7781746,111.778175 C63.5577717,115.998577 56.7611506,116.07262 52.4503541,112.000301 L52.2218254,111.778175 L4.22182541,63.7781746 C-0.0739418023,59.4824074 -0.0739418023,52.5175926 4.22182541,48.2218254 Z",fill:"currentColor",fillRule:"nonzero"})}))}function g3(t){var e,r,n=t.onChange,i=t.value,s=t.children,a=t.caption,o=t.className,l=t.style,c=dt(),u=(r=(e=c.components)===null||e===void 0?void 0:e.IconDropdown)!==null&&r!==void 0?r:_Ae;return x.jsxs("div",{className:o,style:l,children:[x.jsx("span",{className:c.classNames.vhidden,children:t["aria-label"]}),x.jsx("select",{name:t.name,"aria-label":t["aria-label"],className:c.classNames.dropdown,style:c.styles.dropdown,value:i,onChange:n,children:s}),x.jsxs("div",{className:c.classNames.caption_label,style:c.styles.caption_label,"aria-hidden":"true",children:[a,x.jsx(u,{className:c.classNames.dropdown_icon,style:c.styles.dropdown_icon})]})]})}function AAe(t){var e,r=dt(),n=r.fromDate,i=r.toDate,s=r.styles,a=r.locale,o=r.formatters.formatMonthCaption,l=r.classNames,c=r.components,u=r.labels.labelMonthDropdown;if(!n)return x.jsx(x.Fragment,{});if(!i)return x.jsx(x.Fragment,{});var d=[];if(iAe(n,i))for(var f=qr(n),h=n.getMonth();h<=i.getMonth();h++)d.push(Tb(f,h));else for(var f=qr(new Date),h=0;h<=11;h++)d.push(Tb(f,h));var p=function(m){var v=Number(m.target.value),y=Tb(qr(t.displayMonth),v);t.onChange(y)},g=(e=c==null?void 0:c.Dropdown)!==null&&e!==void 0?e:g3;return x.jsx(g,{name:"months","aria-label":u(),className:l.dropdown_month,style:s.dropdown_month,onChange:p,value:t.displayMonth.getMonth(),caption:o(t.displayMonth,{locale:a}),children:d.map(function(m){return x.jsx("option",{value:m.getMonth(),children:o(m,{locale:a})},m.getMonth())})})}function PAe(t){var e,r=t.displayMonth,n=dt(),i=n.fromDate,s=n.toDate,a=n.locale,o=n.styles,l=n.classNames,c=n.components,u=n.formatters.formatYearCaption,d=n.labels.labelYearDropdown,f=[];if(!i)return x.jsx(x.Fragment,{});if(!s)return x.jsx(x.Fragment,{});for(var h=i.getFullYear(),p=s.getFullYear(),g=h;g<=p;g++)f.push(Zk(s3(new Date),g));var m=function(y){var b=Zk(qr(r),Number(y.target.value));t.onChange(b)},v=(e=c==null?void 0:c.Dropdown)!==null&&e!==void 0?e:g3;return x.jsx(v,{name:"years","aria-label":d(),className:l.dropdown_year,style:o.dropdown_year,onChange:m,value:r.getFullYear(),caption:u(r,{locale:a}),children:f.map(function(y){return x.jsx("option",{value:y.getFullYear(),children:u(y,{locale:a})},y.getFullYear())})})}function IAe(t,e){var r=E.useState(t),n=r[0],i=r[1],s=e===void 0?n:e;return[s,i]}function CAe(t){var e=t.month,r=t.defaultMonth,n=t.today,i=e||r||n||new Date,s=t.toDate,a=t.fromDate,o=t.numberOfMonths,l=o===void 0?1:o;if(s&&Wf(s,i)<0){var c=-1*(l-1);i=fi(s,c)}return a&&Wf(i,a)<0&&(i=a),qr(i)}function OAe(){var t=dt(),e=CAe(t),r=IAe(e,t.month),n=r[0],i=r[1],s=function(a){var o;if(!t.disableNavigation){var l=qr(a);i(l),(o=t.onMonthChange)===null||o===void 0||o.call(t,l)}};return[n,s]}function RAe(t,e){for(var r=e.reverseMonths,n=e.numberOfMonths,i=qr(t),s=qr(fi(i,n)),a=Wf(s,i),o=[],l=0;l<a;l++){var c=fi(i,l);o.push(c)}return r&&(o=o.reverse()),o}function kAe(t,e){if(!e.disableNavigation){var r=e.toDate,n=e.pagedNavigation,i=e.numberOfMonths,s=i===void 0?1:i,a=n?s:1,o=qr(t);if(!r)return fi(o,a);var l=Wf(r,t);if(!(l<s))return fi(o,a)}}function LAe(t,e){if(!e.disableNavigation){var r=e.fromDate,n=e.pagedNavigation,i=e.numberOfMonths,s=i===void 0?1:i,a=n?s:1,o=qr(t);if(!r)return fi(o,-a);var l=Wf(o,r);if(!(l<=0))return fi(o,-a)}}var v3=E.createContext(void 0);function DAe(t){var e=dt(),r=OAe(),n=r[0],i=r[1],s=RAe(n,e),a=kAe(n,e),o=LAe(n,e),l=function(d){return s.some(function(f){return r1(d,f)})},c=function(d,f){l(d)||(f&&f3(d,f)?i(fi(d,1+e.numberOfMonths*-1)):i(d))},u={currentMonth:n,displayMonths:s,goToMonth:i,goToDate:c,previousMonth:o,nextMonth:a,isDateDisplayed:l};return x.jsx(v3.Provider,{value:u,children:t.children})}function ph(){var t=E.useContext(v3);if(!t)throw new Error("useNavigation must be used within a NavigationProvider");return t}function eL(t){var e,r=dt(),n=r.classNames,i=r.styles,s=r.components,a=ph().goToMonth,o=function(u){a(fi(u,t.displayIndex?-t.displayIndex:0))},l=(e=s==null?void 0:s.CaptionLabel)!==null&&e!==void 0?e:m3,c=x.jsx(l,{id:t.id,displayMonth:t.displayMonth});return x.jsxs("div",{className:n.caption_dropdowns,style:i.caption_dropdowns,children:[x.jsx("div",{className:n.vhidden,children:c}),x.jsx(AAe,{onChange:o,displayMonth:t.displayMonth}),x.jsx(PAe,{onChange:o,displayMonth:t.displayMonth})]})}function NAe(t){return x.jsx("svg",ye({width:"16px",height:"16px",viewBox:"0 0 120 120"},t,{children:x.jsx("path",{d:"M69.490332,3.34314575 C72.6145263,0.218951416 77.6798462,0.218951416 80.8040405,3.34314575 C83.8617626,6.40086786 83.9268205,11.3179931 80.9992143,14.4548388 L80.8040405,14.6568542 L35.461,60 L80.8040405,105.343146 C83.8617626,108.400868 83.9268205,113.317993 80.9992143,116.454839 L80.8040405,116.656854 C77.7463184,119.714576 72.8291931,119.779634 69.6923475,116.852028 L69.490332,116.656854 L18.490332,65.6568542 C15.4326099,62.5991321 15.367552,57.6820069 18.2951583,54.5451612 L18.490332,54.3431458 L69.490332,3.34314575 Z",fill:"currentColor",fillRule:"nonzero"})}))}function MAe(t){return x.jsx("svg",ye({width:"16px",height:"16px",viewBox:"0 0 120 120"}
356,t,{children:x.jsx("path",{d:"M49.8040405,3.34314575 C46.6798462,0.218951416 41.6145263,0.218951416 38.490332,3.34314575 C35.4326099,6.40086786 35.367552,11.3179931 38.2951583,14.4548388 L38.490332,14.6568542 L83.8333725,60 L38.490332,105.343146 C35.4326099,108.400868 35.367552,113.317993 38.2951583,116.454839 L38.490332,116.656854 C41.5480541,119.714576 46.4651794,119.779634 49.602025,116.852028 L49.8040405,116.656854 L100.804041,65.6568542 C103.861763,62.5991321 103.926821,57.6820069 100.999214,54.5451612 L100.804041,54.3431458 L49.8040405,3.34314575 Z",fill:"currentColor"})}))}var Kg=E.forwardRef(function(t,e){var r=dt(),n=r.classNames,i=r.styles,s=[n.button_reset,n.button];t.className&&s.push(t.className);var a=s.join(" "),o=ye(ye({},i.button_reset),i.button);return t.style&&Object.assign(o,t.style),x.jsx("button",ye({},t,{ref:e,type:"button",className:a,style:o}))});function $Ae(t){var e,r,n=dt(),i=n.dir,s=n.locale,a=n.classNames,o=n.styles,l=n.labels,c=l.labelPrevious,u=l.labelNext,d=n.components;if(!t.nextMonth&&!t.previousMonth)return x.jsx(x.Fragment,{});var f=c(t.previousMonth,{locale:s}),h=[a.nav_button,a.nav_button_previous].join(" "),p=u(t.nextMonth,{locale:s}),g=[a.nav_button,a.nav_button_next].join(" "),m=(e=d==null?void 0:d.IconRight)!==null&&e!==void 0?e:MAe,v=(r=d==null?void 0:d.IconLeft)!==null&&r!==void 0?r:NAe;return x.jsxs("div",{className:a.nav,style:o.nav,children:[!t.hidePrevious&&x.jsx(Kg,{name:"previous-month","aria-label":f,className:h,style:o.nav_button_previous,disabled:!t.previousMonth,onClick:t.onPreviousClick,children:i==="rtl"?x.jsx(m,{className:a.nav_icon,style:o.nav_icon}):x.jsx(v,{className:a.nav_icon,style:o.nav_icon})}),!t.hideNext&&x.jsx(Kg,{name:"next-month","aria-label":p,className:g,style:o.nav_button_next,disabled:!t.nextMonth,onClick:t.onNextClick,children:i==="rtl"?x.jsx(v,{className:a.nav_icon,style:o.nav_icon}):x.jsx(m,{className:a.nav_icon,style:o.nav_icon})})]})}function tL(t){var e=dt().numberOfMonths,r=ph(),n=r.previousMonth,i=r.nextMonth,s=r.goToMonth,a=r.displayMonths,o=a.findIndex(function(p){return r1(t.displayMonth,p)}),l=o===0,c=o===a.length-1,u=e>1&&(l||!c),d=e>1&&(c||!l),f=function(){n&&s(n)},h=function(){i&&s(i)};return x.jsx($Ae,{displayMonth:t.displayMonth,hideNext:u,hidePrevious:d,nextMonth:i,previousMonth:n,onPreviousClick:f,onNextClick:h})}function jAe(t){var e,r=dt(),n=r.classNames,i=r.disableNavigation,s=r.styles,a=r.captionLayout,o=r.components,l=(e=o==null?void 0:o.CaptionLabel)!==null&&e!==void 0?e:m3,c;return i?c=x.jsx(l,{id:t.id,displayMonth:t.displayMonth}):a==="dropdown"?c=x.jsx(eL,{displayMonth:t.displayMonth,id:t.id}):a==="dropdown-buttons"?c=x.jsxs(x.Fragment,{children:[x.jsx(eL,{displayMonth:t.displayMonth,displayIndex:t.displayIndex,id:t.id}),x.jsx(tL,{displayMonth:t.displayMonth,displayIndex:t.displayIndex,id:t.id})]}):c=x.jsxs(x.Fragment,{children:[x.jsx(l,{id:t.id,displayMonth:t.displayMonth,displayIndex:t.displayIndex}),x.jsx(tL,{displayMonth:t.displayMonth,id:t.id})]}),x.jsx("div",{className:n.caption,style:s.caption,children:c})}function FAe(t){var e=dt(),r=e.footer,n=e.styles,i=e.classNames.tfoot;return r?x.jsx("tfoot",{className:i,style:n.tfoot,children:x.jsx("tr",{children:x.jsx("td",{colSpan:8,children:r})})}):x.jsx(x.Fragment,{})}function BAe(t,e,r){for(var n=r?Wo(new Date):Gi(new Date,{locale:t,weekStartsOn:e}),i=[],s=0;s<7;s++){var a=Or(n,s);i.push(a)}return i}function UAe(){var t=dt(),e=t.classNames,r=t.styles,n=t.showWeekNumber,i=t.locale,s=t.weekStartsOn,a=t.ISOWeek,o=t.formatters.formatWeekdayName,l=t.labels.labelWeekday,c=BAe(i,s,a);return x.jsxs("tr",{style:r.head_row,className:e.head_row,children:[n&&x.jsx("td",{style:r.head_cell,className:e.head_cell}),c.map(function(u,d){return x.jsx("th",{scope:"col",className:e.head_cell,style:r.head_cell,"aria-label":l(u,{locale:i}),children:o(u,{locale:i})},d)})]})}function GAe(){var t,e=dt(),r=e.classNames,n=e.styles,i=e.components,s=(t=i==null?void 0:i.HeadRow)!==null&&t!==void 0?t:UAe;return x.jsx("thead",{style:n.head,className:r.head,children:x.jsx(s,{})})}function WAe(t){var e=dt(),r=e.locale,n=e.formatters.formatDay;return x.jsx(x.Fragment,{children:n(t.date,{locale:r})})}var n1=E.createContext(void 0);function VAe(t){if(!fh(t.initialProps)){var e={selected:void 0,modifiers:{disabled:[]}};return x.jsx(n1.Provider,{value:e,children:t.children})}return x.jsx(HAe,{initialProps:t.initialProps,children:t.children})}function HAe(t){var e=t.initialProps,r=t.children,n=e.selected,i=e.min,s=e.max,a=function(c,u,d){var f,h;(f=e.onDayClick)===null||f===void 0||f.call(e,c,u,d);var p=!!(u.selected&&i&&(n==null?void 0:n.length)===i);if(!p){var g=!!(!u.selected&&s&&(n==null?void 0:n.length)===s);if(!g){var m=n?h3([],n):[];if(u.selected){var v=m.findIndex(function(y){return Vr(c,y)});m.splice(v,1)}else m.push(c);(h=e.onSelect)===null||h===void 0||h.call(e,m,c,u,d)}}},o={disabled:[]};n&&o.disabled.push(function(c){var u=s&&n.length>s-1,d=n.some(function(f){return Vr(f,c)});return!!(u&&!d)});
356var l={selected:n,onDayClick:a,modifiers:o};return x.jsx(n1.Provider,{value:l,children:r})}function i1(){var t=E.useContext(n1);if(!t)throw new Error("useSelectMultiple must be used within a SelectMultipleProvider");return t}function KAe(t,e){var r=e||{},n=r.from,i=r.to;return n&&i?Vr(i,t)&&Vr(n,t)?void 0:Vr(i,t)?{from:i,to:void 0}:Vr(n,t)?void 0:qS(n,t)?{from:t,to:i}:{from:n,to:t}:i?qS(t,i)?{from:i,to:t}:{from:t,to:i}:n?f3(t,n)?{from:t,to:n}:{from:n,to:t}:{from:t,to:void 0}}var s1=E.createContext(void 0);function zAe(t){if(!hh(t.initialProps)){var e={selected:void 0,modifiers:{range_start:[],range_end:[],range_middle:[],disabled:[]}};return x.jsx(s1.Provider,{value:e,children:t.children})}return x.jsx(qAe,{initialProps:t.initialProps,children:t.children})}function qAe(t){var e=t.initialProps,r=t.children,n=e.selected,i=n||{},s=i.from,a=i.to,o=e.min,l=e.max,c=function(h,p,g){var m,v;(m=e.onDayClick)===null||m===void 0||m.call(e,h,p,g);var y=KAe(h,n);(v=e.onSelect)===null||v===void 0||v.call(e,y,h,p,g)},u={range_start:[],range_end:[],range_middle:[],disabled:[]};if(s?(u.range_start=[s],a?(u.range_end=[a],Vr(s,a)||(u.range_middle=[{after:s,before:a}])):u.range_end=[s]):a&&(u.range_start=[a],u.range_end=[a]),o&&(s&&!a&&u.disabled.push({after:Eb(s,o-1),before:Or(s,o-1)}),s&&a&&u.disabled.push({after:s,before:Or(s,o-1)}),!s&&a&&u.disabled.push({after:Eb(a,o-1),before:Or(a,o-1)})),l){if(s&&!a&&(u.disabled.push({before:Or(s,-l+1)}),u.disabled.push({after:Or(s,l-1)})),s&&a){var d=Ri(a,s)+1,f=l-d;u.disabled.push({before:Eb(s,f)}),u.disabled.push({after:Or(a,f)})}!s&&a&&(u.disabled.push({before:Or(a,-l+1)}),u.disabled.push({after:Or(a,l-1)}))}return x.jsx(s1.Provider,{value:{selected:n,onDayClick:c,modifiers:u},children:r})}function a1(){var t=E.useContext(s1);if(!t)throw new Error("useSelectRange must be used within a SelectRangeProvider");return t}function Qp(t){return Array.isArray(t)?h3([],t):t!==void 0?[t]:[]}function YAe(t){var e={};return Object.entries(t).forEach(function(r){var n=r[0],i=r[1];e[n]=Qp(i)}),e}var hi;(function(t){t.Outside="outside",t.Disabled="disabled",t.Selected="selected",t.Hidden="hidden",t.Today="today",t.RangeStart="range_start",t.RangeEnd="range_end",t.RangeMiddle="range_middle"})(hi||(hi={}));var XAe=hi.Selected,Ji=hi.Disabled,QAe=hi.Hidden,JAe=hi.Today,_b=hi.RangeEnd,Ab=hi.RangeMiddle,Pb=hi.RangeStart,ZAe=hi.Outside;function ePe(t,e,r){var n,i=(n={},n[XAe]=Qp(t.selected),n[Ji]=Qp(t.disabled),n[QAe]=Qp(t.hidden),n[JAe]=[t.today],n[_b]=[],n[Ab]=[],n[Pb]=[],n[ZAe]=[],n);return t.fromDate&&i[Ji].push({before:t.fromDate}),t.toDate&&i[Ji].push({after:t.toDate}),fh(t)?i[Ji]=i[Ji].concat(e.modifiers[Ji]):hh(t)&&(i[Ji]=i[Ji].concat(r.modifiers[Ji]),i[Pb]=r.modifiers[Pb],i[Ab]=r.modifiers[Ab],i[_b]=r.modifiers[_b]),i}var y3=E.createContext(void 0);function tPe(t){var e=dt(),r=i1(),n=a1(),i=ePe(e,r,n),s=YAe(e.modifiers),a=ye(ye({},i),s);return x.jsx(y3.Provider,{value:a,children:t.children})}function b3(){var t=E.useContext(y3);if(!t)throw new Error("useModifiers must be used within a ModifiersProvider");return t}function rPe(t){return!!(t&&typeof t=="object"&&"before"in t&&"after"in t)}function nPe(t){return!!(t&&typeof t=="object"&&"from"in t)}function iPe(t){return!!(t&&typeof t=="object"&&"after"in t)}function sPe(t){return!!(t&&typeof t=="object"&&"before"in t)}function aPe(t){return!!(t&&typeof t=="object"&&"dayOfWeek"in t)}function oPe(t,e){var r,n=e.from,i=e.to;if(n&&i){var s=Ri(i,n)<0;s&&(r=[i,n],n=r[0],i=r[1]);var a=Ri(t,n)>=0&&Ri(i,t)>=0;return a}return i?Vr(i,t):n?Vr(n,t):!1}function lPe(t){return Z_(t)}function cPe(t){return Array.isArray(t)&&t.every(Z_)}function uPe(t,e){return e.some(function(r){if(typeof r=="boolean")return r;if(lPe(r))return Vr(t,r);if(cPe(r))return r.includes(t);if(nPe(r))return oPe(t,r);if(aPe(r))return r.dayOfWeek.includes(t.getDay());if(rPe(r)){var n=Ri(r.before,t),i=Ri(r.after,t),s=n>0,a=i<0,o=qS(r.before,r.after);return o?a&&s:s||a}return iPe(r)?Ri(t,r.after)>0:sPe(r)?Ri(r.before,t)>0:typeof r=="function"?r(t):!1})}function o1(t,e,r){var n=Object.keys(e).reduce(function(s,a){var o=e[a];return uPe(t,o)&&s.push(a),s},[]),i={};
356return n.forEach(function(s){return i[s]=!0}),r&&!r1(t,r)&&(i.outside=!0),i}function dPe(t,e){for(var r=qr(t[0]),n=e1(t[t.length-1]),i,s,a=r;a<=n;){var o=o1(a,e),l=!o.disabled&&!o.hidden;if(!l){a=Or(a,1);continue}if(o.selected)return a;o.today&&!s&&(s=a),i||(i=a),a=Or(a,1)}return s||i}var fPe=365;function x3(t,e){var r=e.moveBy,n=e.direction,i=e.context,s=e.modifiers,a=e.retry,o=a===void 0?{count:0,lastFocused:t}:a,l=i.weekStartsOn,c=i.fromDate,u=i.toDate,d=i.locale,f={day:Or,week:zS,month:fi,year:e1e,startOfWeek:function(m){return i.ISOWeek?Wo(m):Gi(m,{locale:d,weekStartsOn:l})},endOfWeek:function(m){return i.ISOWeek?a3(m):t1(m,{locale:d,weekStartsOn:l})}},h=f[r](t,n==="after"?1:-1);n==="before"&&c?h=t1e([c,h]):n==="after"&&u&&(h=r1e([u,h]));var p=!0;if(s){var g=o1(h,s);p=!g.disabled&&!g.hidden}return p?h:o.count>fPe?o.lastFocused:x3(h,{moveBy:r,direction:n,context:i,modifiers:s,retry:ye(ye({},o),{count:o.count+1})})}var w3=E.createContext(void 0);function hPe(t){var e=ph(),r=b3(),n=E.useState(),i=n[0],s=n[1],a=E.useState(),o=a[0],l=a[1],c=dPe(e.displayMonths,r),u=i??(o&&e.isDateDisplayed(o))?o:c,d=function(){l(i),s(void 0)},f=function(m){s(m)}
356,h=dt(),p=function(m,v){if(i){var y=x3(i,{moveBy:m,direction:v,context:h,modifiers:r});Vr(i,y)||(e.goToDate(y,i),f(y))}},g={focusedDay:i,focusTarget:u,blur:d,focus:f,focusDayAfter:function(){return p("day","after")},focusDayBefore:function(){return p("day","before")},focusWeekAfter:function(){return p("week","after")},focusWeekBefore:function(){return p("week","before")},focusMonthBefore:function(){return p("month","before")},focusMonthAfter:function(){return p("month","after")},focusYearBefore:function(){return p("year","before")},focusYearAfter:function(){return p("year","after")},focusStartOfWeek:function(){return p("startOfWeek","before")},focusEndOfWeek:function(){return p("endOfWeek","after")}};return x.jsx(w3.Provider,{value:g,children:t.children})}function l1(){var t=E.useContext(w3);if(!t)throw new Error("useFocusContext must be used within a FocusProvider");return t}function pPe(t,e){var r=b3(),n=o1(t,r,e);return n}var c1=E.createContext(void 0);function mPe(t){if(!Ey(t.initialProps)){var e={selected:void 0};return x.jsx(c1.Provider,{value:e,children:t.children})}return x.jsx(gPe,{initialProps:t.initialProps,children:t.children})}function gPe(t){var e=t.initialProps,r=t.children,n=function(s,a,o){var l,c,u;if((l=e.onDayClick)===null||l===void 0||l.call(e,s,a,o),a.selected&&!e.required){(c=e.onSelect)===null||c===void 0||c.call(e,void 0,s,a,o);return}(u=e.onSelect)===null||u===void 0||u.call(e,s,s,a,o)},i={selected:e.selected,onDayClick:n};return x.jsx(c1.Provider,{value:i,children:r})}function S3(){var t=E.useContext(c1);if(!t)throw new Error("useSelectSingle must be used within a SelectSingleProvider");return t}function vPe(t,e){var r=dt(),n=S3(),i=i1(),s=a1(),a=l1(),o=a.focusDayAfter,l=a.focusDayBefore,c=a.focusWeekAfter,u=a.focusWeekBefore,d=a.blur,f=a.focus,h=a.focusMonthBefore,p=a.focusMonthAfter,g=a.focusYearBefore,m=a.focusYearAfter,v=a.focusStartOfWeek,y=a.focusEndOfWeek,b=function(N){var k,$,U,G;Ey(r)?(k=n.onDayClick)===null||k===void 0||k.call(n,t,e,N):fh(r)?($=i.onDayClick)===null||$===void 0||$.call(i,t,e,N):hh(r)?(U=s.onDayClick)===null||U===void 0||U.call(s,t,e,N):(G=r.onDayClick)===null||G===void 0||G.call(r,t,e,N)},w=function(N){var k;f(t),(k=r.onDayFocus)===null||k===void 0||k.call(r,t,e,N)},S=function(N){var k;d(),(k=r.onDayBlur)===null||k===void 0||k.call(r,t,e,N)},T=function(N){var k;(k=r.onDayMouseEnter)===null||k===void 0||k.call(r,t,e,N)},_=function(N){var k;(k=r.onDayMouseLeave)===null||k===void 0||k.call(r,t,e,N)},A=function(N){var k;(k=r.onDayPointerEnter)===null||k===void 0||k.call(r,t,e,N)},P=function(N){var k;(k=r.onDayPointerLeave)===null||k===void 0||k.call(r,t,e,N)},C=function(N){var k;(k=r.onDayTouchCancel)===null||k===void 0||k.call(r,t,e,N)},O=function(N){var k;(k=r.onDayTouchEnd)===null||k===void 0||k.call(r,t,e,N)},R=function(N){var k;(k=r.onDayTouchMove)===null||k===void 0||k.call(r,t,e,N)},D=function(N){var k;(k=r.onDayTouchStart)===null||k===void 0||k.call(r,t,e,N)},L=function(N){var k;(k=r.onDayKeyUp)===null||k===void 0||k.call(r,t,e,N)},j=function(N){var k;switch(N.key){case"ArrowLeft":N.preventDefault(),N.stopPropagation(),r.dir==="rtl"?o():l();break;case"ArrowRight":N.preventDefault(),N.stopPropagation(),r.dir==="rtl"?l():o();break;case"ArrowDown":N.preventDefault(),N.stopPropagation(),c();break;case"ArrowUp":N.preventDefault(),N.stopPropagation(),u();break;case"PageUp":N.preventDefault(),N.stopPropagation(),N.shiftKey?g():h();break;case"PageDown":N.preventDefault(),N.stopPropagation(),N.shiftKey?m():p();break;case"Home":N.preventDefault(),N.stopPropagation(),v();break;case"End":N.preventDefault(),N.stopPropagation(),y();break}(k=r.onDayKeyDown)===null||k===void 0||k.call(r,t,e,N)},M={onClick:b,onFocus:w,onBlur:S,onKeyDown:j,onKeyUp:L,onMouseEnter:T,onMouseLeave:_,onPointerEnter:A,onPointerLeave:P,onTouchCancel:C,onTouchEnd:O,onTouchMove:R,onTouchStart:D};return M}function yPe(){var t=dt(),e=S3(),r=i1(),n=a1(),i=Ey(t)?e.selected:fh(t)?r.selected:hh(t)?n.selected:void 0;return i}function bPe(t){return Object.values(hi).includes(t)}function xPe(t,e){var r=[t.classNames.day];return Object.keys(e).forEach(function(n){var i=t.modifiersClassNames[n];if(i)r.push(i);else if(bPe(n)){var s=t.classNames["day_".concat(n)];s&&r.push(s)}}),r}function wPe(t,e){var r=ye({},t.styles.day);return Object.keys(e).forEach(function(n){var i;r=ye(ye({},r),(i=t.modifiersStyles)===null||i===void 0?void 0:i[n])}),r}function SPe(t,e,r){var n,i,s,a=dt(),o=l1(),l=pPe(t,e),c=vPe(t,l),u=yPe(),d=!!(a.onDayCl
356ick||a.mode!=="default");E.useEffect(function(){var T;l.outside||o.focusedDay&&d&&Vr(o.focusedDay,t)&&((T=r.current)===null||T===void 0||T.focus())},[o.focusedDay,t,r,d,l.outside]);var f=xPe(a,l).join(" "),h=wPe(a,l),p=!!(l.outside&&!a.showOutsideDays||l.hidden),g=(s=(i=a.components)===null||i===void 0?void 0:i.DayContent)!==null&&s!==void 0?s:WAe,m=x.jsx(g,{date:t,displayMonth:e,activeModifiers:l}),v={style:h,className:f,children:m,role:"gridcell"},y=o.focusTarget&&Vr(o.focusTarget,t)&&!l.outside,b=o.focusedDay&&Vr(o.focusedDay,t),w=ye(ye(ye({},v),(n={disabled:l.disabled,role:"gridcell"},n["aria-selected"]=l.selected,n.tabIndex=b||y?0:-1,n)),c),S={isButton:d,isHidden:p,activeModifiers:l,selectedDays:u,buttonProps:w,divProps:v};return S}function EPe(t){var e=E.useRef(null),r=SPe(t.date,t.displayMonth,e);return r.isHidden?x.jsx("div",{role:"gridcell"}):r.isButton?x.jsx(Kg,ye({name:"day",ref:e},r.buttonProps)):x.jsx("div",ye({},r.divProps))}function TPe(t){var e=t.number,r=t.dates,n=dt(),i=n.onWeekNumberClick,s=n.styles,a=n.classNames,o=n.locale,l=n.labels.labelWeekNumber,c=n.formatters.formatWeekNumber,u=c(Number(e),{locale:o});if(!i)return x.jsx("span",{className:a.weeknumber,style:s.weeknumber,children:u});var d=l(Number(e),{locale:o}),f=function(h){i(e,r,h)};return x.jsx(Kg,{name:"week-number","aria-label":d,className:a.weeknumber,style:s.weeknumber,onClick:f,children:u})}function _Pe(t){var e,r,n=dt(),i=n.styles,s=n.classNames,a=n.showWeekNumber,o=n.components,l=(e=o==null?void 0:o.Day)!==null&&e!==void 0?e:EPe,c=(r=o==null?void 0:o.WeekNumber)!==null&&r!==void 0?r:TPe,u;return a&&(u=x.jsx("td",{className:s.cell,style:i.cell,children:x.jsx(c,{number:t.weekNumber,dates:t.dates})})),x.jsxs("tr",{className:s.row,style:i.row,children:[u,t.dates.map(function(d){return x.jsx("td",{className:s.cell,style:i.cell,role:"presentation",children:x.jsx(l,{displayMonth:t.displayMonth,date:d})},tAe(d))})]})}function rL(t,e,r){for(var n=r!=null&&r.ISOWeek?a3(e):t1(e,r),i=r!=null&&r.ISOWeek?Wo(t):Gi(t,r),s=Ri(n,i),a=[],o=0;o<=s;o++)a.push(Or(i,o));var l=a.reduce(function(c,u){var d=r!=null&&r.ISOWeek?l3(u):u3(u,r),f=c.find(function(h){return h.weekNumber===d});return f?(f.dates.push(u),c):(c.push({weekNumber:d,dates:[u]}),c)},[]);return l}function APe(t,e){var r=rL(qr(t),e1(t),e);if(e!=null&&e.useFixedWeeks){var n=nAe(t,e);if(n<6){var i=r[r.length-1],s=i.dates[i.dates.length-1],a=zS(s,6-n),o=rL(zS(s,1),a,e);r.push.apply(r,o)}}return r}function PPe(t){var e,r,n,i=dt(),s=i.locale,a=i.classNames,o=i.styles,l=i.hideHead,c=i.fixedWeeks,u=i.components,d=i.weekStartsOn,f=i.firstWeekContainsDate,h=i.ISOWeek,p=APe(t.displayMonth,{useFixedWeeks:!!c,ISOWeek:h,locale:s,weekStartsOn:d,firstWeekContainsDate:f}),g=(e=u==null?void 0:u.Head)!==null&&e!==void 0?e:GAe,m=(r=u==null?void 0:u.Row)!==null&&r!==void 0?r:_Pe,v=(n=u==null?void 0:u.Footer)!==null&&n!==void 0?n:FAe;return x.jsxs("table",{id:t.id,className:a.table,style:o.table,role:"grid","aria-labelledby":t["aria-labelledby"],children:[!l&&x.jsx(g,{}),x.jsx("tbody",{className:a.tbody,style:o.tbody,children:p.map(function(y){return x.jsx(m,{displayMonth:t.displayMonth,dates:y.dates,weekNumber:y.weekNumber},y.weekNumber)})}),x.jsx(v,{displayMonth:t.displayMonth})]})}function IPe(){return!!(typeof window<"u"&&window.document&&window.document.createElement)}var CPe=IPe()?E.useLayoutEffect:E.useEffect,Ib=!1,OPe=0;function nL(){return"react-day-picker-".concat(++OPe)}function RPe(t){var e,r=t??(Ib?nL():null),n=E.useState(r),i=n[0],s=n[1];return CPe(function(){i===null&&s(nL())},[]),E.useEffect(function(){Ib===!1&&(Ib=!0)},[]),(e=t??i)!==null&&e!==void 0?e:void 0}function kPe(t){var e,r,n=dt(),i=n.dir,s=n.classNames,a=n.styles,o=n.components,l=ph().displayMonths,c=RPe(n.id?"".concat(n.id,"-").concat(t.displayIndex):void 0),u=n.id?"".concat(n.id,"-grid-").concat(t.displayIndex):void 0,d=[s.month],f=a.month,h=t.displayIndex===0,p=t.displayIndex===l.length-1,g=!h&&!p;i==="rtl"&&(e=[h,p],p=e[0],h=e[1]),h&&(d.push(s.caption_start),f=ye(ye({},f),a.caption_start)),p&&(d.push(s.caption_end),f=ye(ye({},f),a.caption_end)),g&&(d.push(s.caption_between),f=ye(ye({},f),a.caption_between));var m=(r=o==null?void 0:o.Caption)!==null&&r!==void 0?r:jAe;return x.jsxs("div",{className:d.join(" "),style:f,children:[x.jsx(m,{id:c,displayMonth:t.displayMonth,displayIndex:t.displayIndex}),x.jsx(PPe,{id:u,"aria-labelledby":c,displayMonth:t.displayMonth})]},t.displayIndex)}function LPe(t){var e=dt(),r=e.classNames,n=e.styles;return x.jsx("div",{className:r.months,style:n.months,children:t.children})}function DPe(t){var e,r,n=t.initialProps,i=dt(),s=l1(),a=ph(),o=E.useState(!1),l=o[0],c=o[1];E.useEffect(function(){i.initialFocus&&s.focusTarget&&(l||(s.focus(s.focusTarget),c(!0)))},[i.initialFocus,l,s.focus,s.focusTarget,s]);var u=[i.classNames.root,i.className];i.numberOfMonths>1&&u.push(i.classNames.multiple_months),i.showWeekNumber&&u.push(i.classNames.with_weeknumber);var d=ye(ye({},i.styles.root),i.style),f=Object.keys(n).filter(function(p){return p.startsWith("data-")}).reduce(function(p,g){var m;return ye(ye({},p),(m={},m[g]=n[g],m))},{}),h=(r=(e=n.components)===null||e===void 0?void 0:e.Months)!==null&&r!==void 0?r:LPe;return x.jsx("div",ye({className:u.join(" "),style:d,dir:i.dir,id:i.id,nonce:n.nonce,title:n.title,lang:n.lang},f,{children:x.jsx(h,{children:a.displayMonths.map(function(p,g){return x.jsx(kPe,{displayIndex:g,displayMonth:p},g)})})}))}function NPe(t){var e=t.children,r=sAe(t,["children"]);return x.jsx(TAe,{initialProps:r,children:x.jsx(DAe,{children:x.jsx(mPe,{initialProps:r,children:x.jsx(VAe,{initialProps:r,children:x.jsx(zAe,{initialProps:r,children:x.jsx(tPe,{children:x.jsx(hPe,{children:e})})})})})})})}function MPe(t){return x.jsx(NPe,ye({},t,{children:x.jsx(DPe,{initialProps:t})}))}function E3({className:t,classNames:e,showOutsideDays:r=!0,...n}){return x.jsx(MPe,{showOutsideDays:r,className:be("p-3",t),classNames:{months:"flex flex-col sm:flex-row space-y-4 sm:sp
356ace-x-4 sm:space-y-0",month:"space-y-4",caption:"flex justify-center pt-1 relative items-center",caption_label:"text-sm font-medium",nav:"space-x-1 flex items-center",nav_button:be(iw({variant:"outline"}),"h-7 w-7 bg-transparent p-0 opacity-50 hover:opacity-100"),nav_button_previous:"absolute left-1",nav_button_next:"absolute right-1",table:"w-full border-collapse space-y-1",head_row:"flex",head_cell:"text-muted-foreground rounded-md w-9 font-normal text-[0.8rem]",row:"flex w-full mt-2",cell:"h-9 w-9 text-center text-sm p-0 relative [&:has([aria-selected].day-range-end)]:rounded-r-md [&:has([aria-selected].day-outside)]:bg-accent/50 [&:has([aria-selected])]:bg-accent first:[&:has([aria-selected])]:rounded-l-md last:[&:has([aria-selected])]:rounded-r-md focus-within:relative focus-within:z-20",day:be(iw({variant:"ghost"}),"h-9 w-9 p-0 font-normal aria-selected:opacity-100"),day_range_end:"day-range-end",day_selected:"bg-primary text-primary-foreground hover:bg-primary hover:text-primary-foreground focus:bg-primary focus:text-primary-foreground",day_today:"bg-accent text-accent-foreground",day_outside:"day-outside text-muted-foreground opacity-50 aria-selected:bg-accent/50 aria-selected:text-muted-foreground aria-selected:opacity-30",day_disabled:"text-muted-foreground opacity-50",day_range_middle:"aria-selected:bg-accent aria-selected:text-accent-foreground",day_hidden:"invisible",...e},components:{IconLeft:({...i})=>x.jsx(yG,{className:"h-4 w-4"}),IconRight:({...i})=>x.jsx(bG,{className:"h-4 w-4"})},...n})}E3.displayName="Calendar";var Cb=0;function T3(){E.useEffect(()=>{const t=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",t[0]??iL()),document.body.insertAdjacentElement("beforeend",t[1]??iL()),Cb++,()=>{Cb===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),Cb--}},[])}function iL(){const t=document.createElement("span");return t.setAttribute("data-radix-focus-guard",""),t.tabIndex=0,t.style.outline="none",t.style.opacity="0",t.style.position="fixed",t.style.pointerEvents="none",t}var Ob="focusScope.autoFocusOnMount",Rb="focusScope.autoFocusOnUnmount",sL={bubbles:!1,cancelable:!0},$Pe="FocusScope",u1=E.forwardRef((t,e)=>{const{loop:r=!1,trapped:n=!1,onMountAutoFocus:i,onUnmountAutoFocus:s,...a}=t,[o,l]=E.useState(null),c=Rn(i),u=Rn(s),d=E.useRef(null),f=vt(e,g=>l(g)),h=E.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;E.useEffect(()=>{if(n){let g=function(b){if(h.paused||!o)return;const w=b.target;o.contains(w)?d.current=w:Ws(d.current,{select:!0})},m=function(b){if(h.paused||!o)return;const w=b.relatedTarget;w!==null&&(o.contains(w)||Ws(d.current,{select:!0}))},v=function(b){if(document.activeElement===document.body)for(const S of b)S.removedNodes.length>0&&Ws(o)};document.addEventListener("focusin",g),document.addEventListener("focusout",m);const y=new MutationObserver(v);return o&&y.observe(o,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",g),document.removeEventListener("focusout",m),y.disconnect()}}},[n,o,h.paused]),E.useEffect(()=>{if(o){oL.add(h);const g=document.activeElement;if(!o.contains(g)){const v=new CustomEvent(Ob,sL);o.addEventListener(Ob,c),o.dispatchEvent(v),v.defaultPrevented||(jPe(WPe(_3(o)),{select:!0}),document.activeElement===g&&Ws(o))}return()=>{o.removeEventListener(Ob,c),setTimeout(()=>{const v=new CustomEvent(Rb,sL);o.addEventListener(Rb,u),o.dispatchEvent(v),v.defaultPrevented||Ws(g??document.body,{select:!0}),o.removeEventListener(Rb,u),oL.remove(h)},0)}}},[o,c,u,h]);const p=E.useCallback(g=>{if(!r&&!n||h.paused)return;const m=g.key==="Tab"&&!g.altKey&&!g.ctrlKey&&!g.metaKey,v=document.activeElement;if(m&&v){const y=g.currentTarget,[b,w]=FPe(y);b&&w?!g.shiftKey&&v===w?(g.preventDefault(),r&&Ws(b,{select:!0})):g.shiftKey&&v===b&&(g.preventDefault(),r&&Ws(w,{select:!0})):v===y&&g.preventDefault()}},[r,n,h.paused]);return x.jsx(ke.div,{tabIndex:-1,...a,ref:f,onKeyDown:p})});u1.displayName=$Pe;function jPe(t,{select:e=!1}={}){const r=document.activeElement;for(const n of t)if(Ws(n,{select:e}),document.activeElement!==r)return}function FPe(t){const e=_3(t),r=aL(e,t),n=aL(e.reverse(),t);return[r,n]}function _3(t){const e=[],r=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:n=>{const i=n.tagName==="INPUT"&&n.type==="hidden";return n.disabled||n.hidden||i?NodeFilter.FILTER_SKIP:n.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)e.push(r.currentNode);return e}function aL(t,e){for(const r of t)if(!BPe(r,{upTo:e}))return r}function BPe(t,{upTo:e}){if(getComputedStyle(t).visibility==="hidden")return!0;for(;t;){if(e!==void 0&&t===e)return!1;if(getComputedStyle(t).display==="none")return!0;t=t.parentElement}return!1}function UPe(t){return t instanceof HTMLInputElement&&"select"in t}function Ws(t,{select:e=!1}={}){if(t&&t.focus){const r=document.activeElement;t.focus({preventScroll:!0}),t!==r&&UPe(t)&&e&&t.select()}}var oL=GPe();function GPe(){let t=[];return{add(e){const r=t[0];e!==r&&(r==null||r.pause()),t=lL(t,e),t.unshift(e)},remove(e){var r;t=lL(t,e),(r=t[0])==null||r.resume()}}}function lL(t,e){const r=[...t],n=r.indexOf(e);return n!==-1&&r.splice(n,1),r}function WPe(t){return t.filter(e=>e.tagName!=="A")}function VPe(t){const e=HPe(t),r=E.forwardRef((n,i)=>{const{children:s,...a}=n,o=E.Children.toArray(s),l=o.find(zPe);if(l){const c=l.props.children,u=o.map(d=>d===l?E.Children.count(c)>1?E.Children.only(null):E.isValidElement(c)?c.props.children:null:d);return x.jsx(e,{...a,ref:i,children:E.isValidElement(c)?E.cloneElement(c,void 0,u):null})}return x.jsx(e,{...a,ref:i,children:s})});return r.displayName=`${t}.Slot`,r}function HPe(t){const e=E.forwardRef((r,n)=>{const{children:i,...s}=r;if(E.isValidElement(i)){const a=YPe(i),o=qPe(s,i.props);return i.type!==E.Fragment&&(o.ref=n?Jc(n,a):a),E.cloneElement(i,o)}return E.Children.count(i)>1?E.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var KPe=Symbol("radix.slottable");function zPe(t){return E.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===KPe}function qPe(t,e){const r={...e};for(const n in e){const i=t[n],s=e[n];/^on[A-Z]/.test(n)?i&&s?r[n]=(...o)=>{const l=s(...o);return i(...o),l}:i&&(r[n]=i):n==="style"?r[n]={...i,...s}
vendor: 2,529 bytes, line 356
356:n==="className"&&(r[n]=[i,s].filter(Boolean).join(" "))}return{...t,...r}}function YPe(t){var n,i;let e=(n=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:n.get,r=e&&"isReactWarning"in e&&e.isReactWarning;return r?t.ref:(e=(i=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:i.get,r=e&&"isReactWarning"in e&&e.isReactWarning,r?t.props.ref:t.props.ref||t.ref)}var XPe=function(t){if(typeof document>"u")return null;var e=Array.isArray(t)?t[0]:t;return e.ownerDocument.body},vl=new WeakMap,Sp=new WeakMap,Ep={},kb=0,A3=function(t){return t&&(t.host||A3(t.parentNode))},QPe=function(t,e){return e.map(function(r){if(t.contains(r))return r;var n=A3(r);return n&&t.contains(n)?n:(console.error("aria-hidden",r,"in not contained inside",t,". Doing nothing"),null)}).filter(function(r){return!!r})},JPe=function(t,e,r,n){var i=QPe(e,Array.isArray(t)?t:[t]);Ep[r]||(Ep[r]=new WeakMap);var s=Ep[r],a=[],o=new Set,l=new Set(i),c=function(d){!d||o.has(d)||(o.add(d),c(d.parentNode))};i.forEach(c);var u=function(d){!d||l.has(d)||Array.prototype.forEach.call(d.children,function(f){if(o.has(f))u(f);else try{var h=f.getAttribute(n),p=h!==null&&h!=="false",g=(vl.get(f)||0)+1,m=(s.get(f)||0)+1;vl.set(f,g),s.set(f,m),a.push(f),g===1&&p&&Sp.set(f,!0),m===1&&f.setAttribute(r,"true"),p||f.setAttribute(n,"true")}catch(v){console.error("aria-hidden: cannot operate on ",f,v)}})};return u(e),o.clear(),kb++,function(){a.forEach(function(d){var f=vl.get(d)-1,h=s.get(d)-1;vl.set(d,f),s.set(d,h),f||(Sp.has(d)||d.removeAttribute(n),Sp.delete(d)),h||d.removeAttribute(r)}),kb--,kb||(vl=new WeakMap,vl=new WeakMap,Sp=new WeakMap,Ep={})}},P3=function(t,e,r){r===void 0&&(r="data-aria-hidden");var n=Array.from(Array.isArray(t)?t:[t]),i=XPe(t);return i?(n.push.apply(n,Array.from(i.querySelectorAll("[aria-live], script"))),JPe(n,i,r,"aria-hidden")):function(){return null}},Jp="right-scroll-bar-position",Zp="width-before-scroll-bar",ZPe="with-scroll-bars-hidden",eIe="--removed-body-scroll-bar-size";function Lb(t,e){return typeof t=="function"?t(e):t&&(t.current=e),t}function tIe(t,e){var r=E.useState(function(){return{value:t,callback:e,facade:{get current(){return r.value},set current(n){var i=r.value;i!==n&&(r.value=n,r.callback(n,i))}}}})[0];return r.callback=e,r.facade}var rIe=typeof window<"u"?E.useLayoutEffect:E.useEffect,cL=new WeakMap;function nIe(t,e){var r=tIe(null,function(n){return t.forEach(function(i){return Lb(i,n)})});return rIe(function(){var n=cL.get(r);if(n){var i=new Set(n),s=new Set(t),a=r.current;
vendor: 4,224 bytes, lines 356-371
356i.forEach(function(o){s.has(o)||Lb(o,null)}),s.forEach(function(o){i.has(o)||Lb(o,a)})}cL.set(r,t)},[t]),r}function iIe(t){return t}function sIe(t,e){e===void 0&&(e=iIe);var r=[],n=!1,i={read:function(){if(n)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return r.length?r[r.length-1]:t},useMedium:function(s){var a=e(s,n);return r.push(a),function(){r=r.filter(function(o){return o!==a})}},assignSyncMedium:function(s){for(n=!0;r.length;){var a=r;r=[],a.forEach(s)}r={push:function(o){return s(o)},filter:function(){return r}}},assignMedium:function(s){n=!0;var a=[];if(r.length){var o=r;r=[],o.forEach(s),a=r}var l=function(){var u=a;a=[],u.forEach(s)},c=function(){return Promise.resolve().then(l)};c(),r={push:function(u){a.push(u),c()},filter:function(u){return a=a.filter(u),r}}}};return i}function aIe(t){t===void 0&&(t={});var e=sIe(null);return e.options=Ai({async:!0,ssr:!1},t),e}var I3=function(t){var e=t.sideCar,r=ou(t,["sideCar"]);if(!e)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var n=e.read();if(!n)throw new Error("Sidecar medium not found");return E.createElement(n,Ai({},r))};I3.isSideCarExport=!0;function oIe(t,e){return t.useMedium(e),I3}var C3=aIe(),Db=function(){},Ty=E.forwardRef(function(t,e){var r=E.useRef(null),n=E.useState({onScrollCapture:Db,onWheelCapture:Db,onTouchMoveCapture:Db}),i=n[0],s=n[1],a=t.forwardProps,o=t.children,l=t.className,c=t.removeScrollBar,u=t.enabled,d=t.shards,f=t.sideCar,h=t.noRelative,p=t.noIsolation,g=t.inert,m=t.allowPinchZoom,v=t.as,y=v===void 0?"div":v,b=t.gapMode,w=ou(t,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),S=f,T=nIe([r,e]),_=Ai(Ai({},w),i);return E.createElement(E.Fragment,null,u&&E.createElement(S,{sideCar:C3,removeScrollBar:c,shards:d,noRelative:h,noIsolation:p,inert:g,setCallbacks:s,allowPinchZoom:!!m,lockRef:r,gapMode:b}),a?E.cloneElement(E.Children.only(o),Ai(Ai({},_),{ref:T})):E.createElement(y,Ai({},_,{className:l,ref:T}),o))});Ty.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Ty.classNames={fullWidth:Zp,zeroRight:Jp};var lIe=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function cIe(){if(!document)return null;var t=document.createElement("style");t.type="text/css";var e=lIe();return e&&t.setAttribute("nonce",e),t}function uIe(t,e){t.styleSheet?t.styleSheet.cssText=e:t.appendChild(document.createTextNode(e))}function dIe(t){var e=document.head||document.getElementsByTagName("head")[0];e.appendChild(t)}var fIe=function(){var t=0,e=null;return{add:function(r){t==0&&(e=cIe())&&(uIe(e,r),dIe(e)),t++},remove:function(){t--,!t&&e&&(e.parentNode&&e.parentNode.removeChild(e),e=null)}}},hIe=function(){var t=fIe();return function(e,r){E.useEffect(function(){return t.add(e),function(){t.remove()}},[e&&r])}},O3=function(){var t=hIe(),e=function(r){var n=r.styles,i=r.dynamic;return t(n,i),null};return e},pIe={left:0,top:0,right:0,gap:0},Nb=function(t){return parseInt(t||"",10)||0},mIe=function(t){var e=window.getComputedStyle(document.body),r=e[t==="padding"?"paddingLeft":"marginLeft"],n=e[t==="padding"?"paddingTop":"marginTop"],i=e[t==="padding"?"paddingRight":"marginRight"];return[Nb(r),Nb(n),Nb(i)]},gIe=function(t){if(t===void 0&&(t="margin"),typeof window>"u")return pIe;var e=mIe(t),r=document.documentElement.clientWidth,n=window.innerWidth;return{left:e[0],top:e[1],right:e[2],gap:Math.max(0,n-r+e[2]-e[0])}},vIe=O3(),sc="data-scroll-locked",yIe=function(t,e,r,n){var i=t.left,s=t.top,a=t.right,o=t.gap;return r===void 0&&(r="margin"),`
357  .`.concat(ZPe,` {
358   overflow: hidden `).concat(n,`;
359   padding-right: `).concat(o,"px ").concat(n,`;
360  }
361  body[`).concat(sc,`] {
362    overflow: hidden `).concat(n,`;
363    overscroll-behavior: contain;
364    `).concat([e&&"position: relative ".concat(n,";"),r==="margin"&&`
365    padding-left: `.concat(i,`px;
366    padding-top: `).concat(s,`px;
367    padding-right: `).concat(a,`px;
368    margin-left:0;
369    margin-top:0;
370    margin-right: `).concat(o,"px ").concat(n,`;
371    `),r==="padding"&&"padding-right: ".concat(o,"px ").concat(n,";
371")].filter(Boolean).join(""),`
372  }
373  
374  .`).concat(Jp,` {
375    right: `).concat(o,"px ").concat(n,`;
376  }
377  
378  .`).concat(Zp,` {
379    margin-right: `).concat(o,"px ").concat(n,`;
380  }
381  
382  .`).concat(Jp," .").concat(Jp,` {
383    right: 0 `).concat(n,`;
384  }
385  
386  .`).concat(Zp," .").concat(Zp,` {
387    margin-right: 0 `).concat(n,`;
388  }
389  
390  body[`).concat(sc,`] {
391    `).concat(eIe,": ").concat(o,`px;
392  }
393`)},uL=function(){var t=parseInt(document.body.getAttribute(sc)||"0",10);return isFinite(t)?t:0},bIe=function(){E.useEffect(function(){return document.body.setAttribute(sc,(uL()+1).toString()),function(){var t=uL()-1;t<=0?document.body.removeAttribute(sc):document.body.setAttribute(sc,t.toString())}},[])},xIe=function(t){var e=t.noRelative,r=t.noImportant,n=t.gapMode,i=n===void 0?"margin":n;bIe();var s=E.useMemo(function(){return gIe(i)},[i]);return E.createElement(vIe,{styles:yIe(s,!e,i,r?"":"!important")})},YS=!1;if(typeof window<"u")try{var Tp=Object.defineProperty({},"passive",{get:function(){return YS=!0,!0}});window.addEventListener("test",Tp,Tp),window.removeEventListener("test",Tp,Tp)}catch{YS=!1}var yl=YS?{passive:!1}:!1,wIe=function(t){return t.tagName==="TEXTAREA"},R3=function(t,e){if(!(t instanceof Element))return!1;var r=window.getComputedStyle(t);return r[e]!=="hidden"&&!(r.overflowY===r.overflowX&&!wIe(t)&&r[e]==="visible")},SIe=function(t){return R3(t,"overflowY")},EIe=function(t){return R3(t,"overflowX")},dL=function(t,e){var r=e.ownerDocument,n=e;do{typeof ShadowRoot<"u"&&n instanceof ShadowRoot&&(n=n.host);var i=k3(t,n);if(i){var s=L3(t,n),a=s[1],o=s[2];if(a>o)return!0}n=n.parentNode}while(n&&n!==r.body);return!1},TIe=function(t){var e=t.scrollTop,r=t.scrollHeight,n=t.clientHeight;return[e,r,n]},_Ie=function(t){var e=t.scrollLeft,r=t.scrollWidth,n=t.clientWidth;return[e,r,n]},k3=function(t,e){return t==="v"?SIe(e):EIe(e)},L3=function(t,e){return t==="v"?TIe(e):_Ie(e)},AIe=function(t,e){return t==="h"&&e==="rtl"?-1:1},PIe=function(t,e,r,n,i){var s=AIe(t,window.getComputedStyle(e).direction),a=s*n,o=r.target,l=e.contains(o),c=!1,u=a>0,d=0,f=0;do{if(!o)break;var h=L3(t,o),p=h[0],g=h[1],m=h[2],v=g-m-s*p;(p||v)&&k3(t,o)&&(d+=v,f+=p);var y=o.parentNode;o=y&&y.nodeType===Node.DOCUMENT_FRAGMENT_NODE?y.host:y}while(!l&&o!==document.body||l&&(e.contains(o)||e===o));return(u&&Math.abs(d)<1||!u&&Math.abs(f)<1)&&(c=!0),c},_p=function(t){return"changedTouches"in t?[t.changedTouches[0].clientX,t.changedTouches[0].clientY]:[0,0]},fL=function(t){return[t.deltaX,t.deltaY]},hL=function(t){return t&&"current"in t?t.current:t},IIe=function(t,e){return t[0]===e[0]&&t[1]===e[1]},CIe=function(t){return`
394  .block-interactivity-`.concat(t,` {pointer-events: none;}
395  .allow-interactivity-`).concat(t,` {pointer-events: all;}
396`)},OIe=0,bl=[];function RIe(t){var e=E.useRef([]),r=E.useRef([0,0]),n=E.useRef(),i=E.useState(OIe++)[0],s=E.useState(O3)[0],a=E.useRef(t);E.useEffect(function(){a.current=t},[t]),E.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(i));var g=nz([t.lockRef.current],(t.shards||[]).map(hL),!0).filter(Boolean);return g.forEach(function(m){return m.classList.add("allow-interactivity-".concat(i))}),function(){document.body.classList.remove("block-interactivity-".concat(i)),g.forEach(function(m){return m.classList.remove("allow-interactivity-".concat(i))})}}},[t.inert,t.lockRef.current,t.shards]);var o=E.useCallback(function(g,m){if("touches"in g&&g.touches.length===2||g.type==="wheel"&&g.ctrlKey)return!a.current.allowPinchZoom;var v=_p(g),y=r.current,b="deltaX"in g?g.deltaX:y[0]-v[0],w="deltaY"in g?g.deltaY:y[1]-v[1],S,T=g.target,_=Math.abs(b)>Math.abs(w)?"h":"v";if("touches"in g&&_==="h"&&T.type==="range")return!1;var A=window.getSelection(),P=A&&A.anchorNode,C=P?P===T||P.contains(T):!1;if(C)return!1;var O=dL(_,T);if(!O)return!0;if(O?S=_:(S=_==="v"?"h":"v",O=dL(_,T)),!O)return!1;if(!n.current&&"changedTouches"in g&&(b||w)&&(n.current=S),!S)return!0;var R=n.current||S;return PIe(R,m,g,R==="h"?b:w)},[]),l=E.useCallback(function(g){var m=g;if(!(!bl.length||bl[bl.length-1]!==s)){var v="deltaY"in m?fL(m):_p(m),y=e.current.filter(function(S){return S.name===m.type&&(S.target===m.target||m.target===S.shadowParent)&&IIe(S.delta,v)}
vendor: 26,671 bytes, line 396
396)[0];if(y&&y.should){m.cancelable&&m.preventDefault();return}if(!y){var b=(a.current.shards||[]).map(hL).filter(Boolean).filter(function(S){return S.contains(m.target)}),w=b.length>0?o(m,b[0]):!a.current.noIsolation;w&&m.cancelable&&m.preventDefault()}}},[]),c=E.useCallback(function(g,m,v,y){var b={name:g,delta:m,target:v,should:y,shadowParent:kIe(v)};e.current.push(b),setTimeout(function(){e.current=e.current.filter(function(w){return w!==b})},1)},[]),u=E.useCallback(function(g){r.current=_p(g),n.current=void 0},[]),d=E.useCallback(function(g){c(g.type,fL(g),g.target,o(g,t.lockRef.current))},[]),f=E.useCallback(function(g){c(g.type,_p(g),g.target,o(g,t.lockRef.current))},[]);E.useEffect(function(){return bl.push(s),t.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener("wheel",l,yl),document.addEventListener("touchmove",l,yl),document.addEventListener("touchstart",u,yl),function(){bl=bl.filter(function(g){return g!==s}),document.removeEventListener("wheel",l,yl),document.removeEventListener("touchmove",l,yl),document.removeEventListener("touchstart",u,yl)}},[]);var h=t.removeScrollBar,p=t.inert;return E.createElement(E.Fragment,null,p?E.createElement(s,{styles:CIe(i)}):null,h?E.createElement(xIe,{noRelative:t.noRelative,gapMode:t.gapMode}):null)}function kIe(t){for(var e=null;t!==null;)t instanceof ShadowRoot&&(e=t.host,t=t.host),t=t.parentNode;return e}const LIe=oIe(C3,RIe);var d1=E.forwardRef(function(t,e){return E.createElement(Ty,Ai({},t,{ref:e,sideCar:LIe}))});d1.classNames=Ty.classNames;var _y="Popover",[D3]=Oa(_y,[iu]),mh=iu(),[DIe,Ma]=D3(_y),N3=t=>{const{__scopePopover:e,children:r,open:n,defaultOpen:i,onOpenChange:s,modal:a=!1}=t,o=mh(e),l=E.useRef(null),[c,u]=E.useState(!1),[d,f]=wc({prop:n,defaultProp:i??!1,onChange:s,caller:_y});return x.jsx(YM,{...o,children:x.jsx(DIe,{scope:e,contentId:tu(),triggerRef:l,open:d,onOpenChange:f,onOpenToggle:E.useCallback(()=>f(h=>!h),[f]),hasCustomAnchor:c,onCustomAnchorAdd:E.useCallback(()=>u(!0),[]),onCustomAnchorRemove:E.useCallback(()=>u(!1),[]),modal:a,children:r})})};N3.displayName=_y;var M3="PopoverAnchor",NIe=E.forwardRef((t,e)=>{const{__scopePopover:r,...n}=t,i=Ma(M3,r),s=mh(r),{onCustomAnchorAdd:a,onCustomAnchorRemove:o}=i;return E.useEffect(()=>(a(),()=>o()),[a,o]),x.jsx(bv,{...s,...n,ref:e})});NIe.displayName=M3;var $3="PopoverTrigger",j3=E.forwardRef((t,e)=>{const{__scopePopover:r,...n}=t,i=Ma($3,r),s=mh(r),a=vt(e,i.triggerRef),o=x.jsx(ke.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.contentId,"data-state":W3(i.open),...n,ref:a,onClick:ve(t.onClick,i.onOpenToggle)});return i.hasCustomAnchor?o:x.jsx(bv,{asChild:!0,...s,children:o})});j3.displayName=$3;var f1="PopoverPortal",[MIe,$Ie]=D3(f1,{forceMount:void 0}),F3=t=>{const{__scopePopover:e,forceMount:r,children:n,container:i}=t,s=Ma(f1,e);return x.jsx(MIe,{scope:e,forceMount:r,children:x.jsx(Zc,{present:r||s.open,children:x.jsx(dv,{asChild:!0,container:i,children:n})})})};F3.displayName=f1;var qc="PopoverContent",B3=E.forwardRef((t,e)=>{const r=$Ie(qc,t.__scopePopover),{forceMount:n=r.forceMount,...i}=t,s=Ma(qc,t.__scopePopover);return x.jsx(Zc,{present:n||s.open,children:s.modal?x.jsx(FIe,{...i,ref:e}):x.jsx(BIe,{...i,ref:e})})});B3.displayName=qc;var jIe=VPe("PopoverContent.RemoveScroll"),FIe=E.forwardRef((t,e)=>{const r=Ma(qc,t.__scopePopover),n=E.useRef(null),i=vt(e,n),s=E.useRef(!1);return E.useEffect(()=>{const a=n.current;if(a)return P3(a)},[]),x.jsx(d1,{as:jIe,allowPinchZoom:!0,children:x.jsx(U3,{...t,ref:i,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:ve(t.onCloseAutoFocus,a=>{var o;a.preventDefault(),s.current||(o=r.triggerRef.current)==null||o.focus()}),onPointerDownOutside:ve(t.onPointerDownOutside,a=>{const o=a.detail.originalEvent,l=o.button===0&&o.ctrlKey===!0,c=o.button===2||l;s.current=c},{checkForDefaultPrevented:!1}),onFocusOutside:ve(t.onFocusOutside,a=>a.preventDefault(),{checkForDefaultPrevented:!1})})})}),BIe=E.forwardRef((t,e)=>{const r=Ma(qc,t.__scopePopover),n=E.useRef(!1),i=E.useRef(!1);return x.jsx(U3,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:s=>{var a,o;(a=t.onCloseAutoFocus)==null||a.call(t,s),s.defaultPrevented||(n.current||(o=r.triggerRef.current)==null||o.focus(),s.preventDefault()),n.current=!1,i.current=!1},onInteractOutside:s=>{var l,c;(l=t.onInteractOutside)==null||l.call(t,s),s.defaultPrevented||(n.current=!0,s.detail.originalEvent.type==="pointerdown"&&(i.current=!0));const a=s.target;((c=r.triggerRef.current)==null?void 0:c.contains(a))&&s.preventDefault(),s.detail.originalEvent.type==="focusin"&&i.current&&s.preventDefault()}})}),U3=E.forwardRef((t,e)=>{const{__scopePopover:r,trapFocus:n,onOpenAutoFocus:i,onCloseAutoFocus:s,disableOutsidePointerEvents:a,onEscapeKeyDown:o,onPointerDownOutside:l,onFocusOutside:c,onInteractOutside:u,...d}=t,f=Ma(qc,r),h=mh(r);return T3(),x.jsx(u1,{asChild:!0,loop:!0,trapped:n,onMountAutoFocus:i,onUnmountAutoFocus:s,children:x.jsx(Jf,{asChild:!0,disableOutsidePointerEvents:a,onInteractOutside:u,onEscapeKeyDown:o,onPointerDownOutside:l,onFocusOutside:c,onDismiss:()=>f.onOpenChange(!1),children:x.jsx(uT,{"data-state":W3(f.open),role:"dialog",id:f.contentId,...h,...d,ref:e,style:{...d.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),G3="PopoverClose",UIe=E.forwardRef((t,e)=>{const{__scopePopover:r,...n}=t,i=Ma(G3,r);return x.jsx(ke.button,{type:"button",...n,ref:e,onClick:ve(t.onClick,()=>i.onOpenChange(!1))})});UIe.displayName=G3;var GIe="PopoverArrow",WIe=E.forwardRef((t,e)=>{const{__scopePopover:r,...n}=t,i=mh(r);return x.jsx(dT,{...i,...n,ref:e})});WIe.displayName=GIe;function W3(t){return t?"open":"closed"}var VIe=N3,HIe=j3,KIe=F3,V3=B3;const zIe=VIe,qIe=HIe,H3=E.forwardRef(({className:t,align:e="center",sideOffset:r=4,...n},i)=>x.jsx(KIe,{children:x.jsx(V3,{ref:i,align:e,sideOffset:r,className:be("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t),...n})}));H3.displayName=V3.displayName;function pL(t,[e,r]){return Math.min(r,Math.max(e,t))}function YIe(t){const e=XIe(t),r=E.forwardRef((n,i)=>{const{children:s,...a}=n,o=E.Children.toArray(s),l=o.find(JIe);if(l){const c=l.props.children,u=o.map(d=>d===l?E.Children.count(c)>1?E.Children.only(null):E.isValidElement(c)?c.props.children:null:d);return x.jsx(e,{...a,ref:i,children:E.isValidElement(c)?E.cloneElement(c,void 0,u):null})}return x.jsx(e,{...a,ref:i,children:s})});return r.displayName=`${t}.Slot`,r}function XIe(t){const e=E.forwardRef((r,n)=>{const{children:i,...s}=r;if(E.isValidElement(i)){const a=eCe(i),o=ZIe(s,i.props);return i.type!==E.Fragment&&(o.ref=n?Jc(n,a):a),E.cloneElement(i,o)}return E.Children.count(i)>1?E.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var QIe=Symbol("radix.slottable");function JIe(t){return E.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===QIe}function ZIe(t,e){const r={...e};for(const n in e){const i=t[n],s=e[n];/^on[A-Z]/.test(n)?i&&s?r[n]=(...o)=>{const l=s(...o);return i(...o),l}:i&&(r[n]=i):n==="style"?r[n]={...i,...s}:n==="className"&&(r[n]=[i,s].filter(Boolean).join(" "))}return{...t,...r}}function eCe(t){var n,i;let e=(n=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:n.get,r=e&&"isReactWarning"in e&&e.isReactWarning;return r?t.ref:(e=(i=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:i.get,r=e&&"isReactWarning"in e&&e.isReactWarning,r?t.props.ref:t.props.ref||t.ref)}function tCe(t){const e=E.useRef({value:t,previous:t});return E.useMemo(()=>(e.current.value!==t&&(e.current.previous=e.current.value,e.current.value=t),e.current.previous),[t])}var rCe=[" ","Enter","ArrowUp","ArrowDown"],nCe=[" ","Enter"],Vo="Select",[Ay,Py,iCe]=XE(Vo),[Su]=Oa(Vo,[iCe,iu]),Iy=iu(),[sCe,$a]=Su(Vo),[aCe,oCe]=Su(Vo),K3=t=>{const{__scopeSelect:e,children:r,open:n,defaultOpen:i,onOpenChange:s,value:a,defaultValue:o,onValueChange:l,dir:c,name:u,autoComplete:d,disabled:f,required:h,form:p}=t,g=Iy(e),[m,v]=E.useState(null),[y,b]=E.useState(null),[w,S]=E.useState(!1),T=ST(c),[_,A]=wc({prop:n,defaultProp:i??!1,onChange:s,caller:Vo}),[P,C]=wc({prop:a,defaultProp:o,onChange:l,caller:Vo}),O=E.useRef(null),R=m?p||!!m.closest("form"):!0,[D,L]=E.useState(new Set),j=Array.from(D).map(M=>M.props.value).join(";");return x.jsx(YM,{...g,children:x.jsxs(sCe,{required:h,scope:e,trigger:m,onTriggerChange:v,valueNode:y,onValueNodeChange:b,valueNodeHasChildren:w,onValueNodeHasChildrenChange:S,contentId:tu(),value:P,onValueChange:C,open:_,onOpenChange:A,dir:T,triggerPointerDownPosRef:O,disabled:f,children:[x.jsx(Ay.Provider,{scope:e,children:x.jsx(aCe,{scope:t.__scopeSelect,onNativeOptionAdd:E.useCallback(M=>{L(N=>new Set(N).add(M))},[]),onNativeOptionRemove:E.useCallback(M=>{L(N=>{const k=new Set(N);return k.delete(M),k})},[]),children:r})}),R?x.jsxs(g4,{"aria-hidden":!0,required:h,tabIndex:-1,name:u,autoComplete:d,value:P,onChange:M=>C(M.target.value),disabled:f,form:p,children:[P===void 0?x.jsx("option",{value:""}):null,Array.from(D)]},j):null]})})};K3.displayName=Vo;var z3="SelectTrigger",q3=E.forwardRef((t,e)=>{const{__scopeSelect:r,disabled:n=!1,...i}=t,s=Iy(r),a=$a(z3,r),o=a.disabled||n,l=vt(e,a.onTriggerChange),c=Py(r),u=E.useRef("touch"),[d,f,h]=y4(g=>{const m=c().filter(b=>!b.disabled),v=m.find(b=>b.value===a.value),y=b4(m,g,v);y!==void 0&&a.onValueChange(y.value)}),p=g=>{o||(a.onOpenChange(!0),h()),g&&(a.triggerPointerDownPosRef.current={x:Math.round(g.pageX),y:Math.round(g.pageY)})};return x.jsx(bv,{asChild:!0,...s,children:x.jsx(ke.button,{type:"button",role:"combobox","aria-controls":a.contentId,"aria-expanded":a.open,"aria-required":a.required,"aria-autocomplete":"none",dir:a.dir,"data-state":a.open?"open":"closed",disabled:o,"data-disabled":o?"":void 0,"data-placeholder":v4(a.value)?"":void 0,...i,ref:l,onClick:ve(i.onClick,g=>{g.currentTarget.focus(),u.current!=="mouse"&&p(g)}),onPointerDown:ve(i.onPointerDown,g=>{u.current=g.pointerType;const m=g.target;m.hasPointerCapture(g.pointerId)&&m.releasePointerCapture(g.pointerId),g.button===0&&g.ctrlKey===!1&&g.pointerType==="mouse"&&(p(g),g.preventDefault())}),onKeyDown:ve(i.onKeyDown,g=>{const m=d.current!=="";!(g.ctrlKey||g.altKey||g.metaKey)&&g.key.length===1&&f(g.key),!(m&&g.key===" ")&&rCe.includes(g.key)&&(p(),g.preventDefault())})})})});q3.displayName=z3;var Y3="SelectValue",X3=E.forwardRef((t,e)=>{const{__scopeSelect:r,className:n,style:i,children:s,placeholder:a="",...o}=t,l=$a(Y3,r),{onValueNodeHasChildrenChange:c}=l,u=s!==void 0,d=vt(e,l.onValueNodeChange);return br(()=>{c(u)},[c,u]),x.jsx(ke.span,{...o,ref:d,style:{pointerEvents:"none"},children:v4(l.value)?x.jsx(x.Fragment,{children:a}):s})});X3.displayName=Y3;var lCe="SelectIcon",Q3=E.forwardRef((t,e)=>{const{__scopeSelect:r,children:n,...i}=t;return x.jsx(ke.span,{"aria-hidden":!0,...i,ref:e,children:n||"▼"})});Q3.displayName=lCe;var cCe="SelectPortal",J3=t=>x.jsx(dv,{asChild:!0,...t});J3.displayName=cCe;var Ho="SelectContent",Z3=E.forwardRef((t,e)=>{const r=$a(Ho,t.__scopeSelect),[n,i]=E.useState();if(br(()=>{i(new DocumentFragment)},[]),!r.open){const s=n;return s?qo.createPortal(x.jsx(e4,{scope:t.__scopeSelect,children:x.jsx(Ay.Slot,{scope:t.__scopeSelect,children:x.jsx("div",{children:t.children})})}),s):null}return x.jsx(t4,{...t,ref:e})});Z3.displayName=Ho;var Kn=10,[e4,ja]=Su(Ho),uCe="SelectContentImpl",dCe=YIe("SelectContent.RemoveScroll"),t4=E.forwardRef((t,e)=>{const{__scopeSelect:r,position:n="item-aligned",onCloseAutoFocus:i,onEscapeKeyDown:s,onPointerDownOutside:a,side:o,sideOffset:l,align:c,alignOffset:u,arrowPadding:d,collisionBoundary:f,collisionPadding:h,sticky:p,hideWhenDetached:g,avoidCollisions:m,...v}=t,y=$a(Ho,r),[b,w]=E.useState(null),[S,T]=E.useState(null),_=vt(e,q=>w(q)),[A,P]=E.useState(null),[C,O]=E.useState(null),R=Py(r),[D,L]=E.useState(!1),j=E.useRef(!1);E.useEffect(()=>{if(b)return P3(b)},[b]),T3();const M=E.useCallback(q=>{const[ie,...Z]=R().map(z=>z.ref.current),[re]=Z.slice(-1),ne=document.activeElement;for(const z of q)if(z===ne||(z==null||z.scrollIntoView({block:"nearest"}),z===ie&&S&&(S.scrollTop=0),z===re&&S&&(S.scrollTop=S.scrollHeight),z==null||z.focus(),document.activeElement!==ne))return},[R,S]),N=E.useCallback(()=>M([A,b]),[M,A,b]);E.useEffect(()=>{D&&N()},[D,N]);const{onOpenChange:k,triggerPointerDownPosRef:$}=y;E.useEffect(()=>{if(b){let q={x:0,y:0};const ie=re=>{var ne,z;q={x:Math.abs(Math.round(re.pageX)-(((ne=$.current)==null?void 0:ne.x)??0)),y:Math.abs(Math.round(re.pageY)-(((z=$.current)==null?void 0:z.y)??0))}},Z=re=>{q.x<=10&&q.y<=10?re.preventDefault():b.contains(re.target)||k(!1),document.removeEventListener("pointermove",ie),$.current=null};return $.current!==null&&(document.addEventListener("pointermove",ie),document.addEventListener("pointerup",Z,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",ie),document.removeEventListener("pointerup",Z,{capture:!0})}}},[b,k,$]),E.useEffect(()=>{const q=()=>k(!1);return window.addEventListener("blur",q),window.addEventListener("resize",q),()=>{window.removeEventListener("blur",q),window.removeEventListener("resize",q)}},[k]);const[U,G]=y4(q=>{const ie=R().filter(ne=>!ne.disabled),Z=ie.find(ne=>ne.ref.current===document.activeElement),re=b4(ie,q,Z);re&&setTimeout(()=>re.ref.current.focus())}),B=E.useCallback((q,ie,Z)=>{const re=!j.current&&!Z;(y.value!==void 0&&y.value===ie||re)&&(P(q),re&&(j.current=!0))},[y.value]),K=E.useCallback(()=>b==null?void 0:b.focus(),[b]),ee=E.useCallback((q,ie,Z)=>{const re=!j.current&&!Z;(y.value!==void 0&&y.value===ie||re)&&O(q)},[y.value]),H=n==="popper"?XS:r4,J=H===XS?{side:o,sideOffset:l,align:c,alignOffset:u,arrowPadding:d,collisionBoundary:f,collisionPadding:h,sticky:p,hideWhenDetached:g,avoidCollisions:m}:{};return x.jsx(e4,{scope:r,content:b,viewport:S,onViewportChange:T,itemRefCallback:B,selectedItem:A,onItemLeave:K,itemTextRefCallback:ee,focusSelectedItem:N,selectedItemText:C,position:n,isPositioned:D,searchRef:U,children:x.jsx(d1,{as:dCe,allowPinchZoom:!0,children:x.jsx(u1,{asChild:!0,trapped:y.open,onMountAutoFocus:q=>{q.preventDefault()},onUnmountAutoFocus:ve(i,q=>{var ie;(ie=y.trigger)==null||ie.focus({preventScroll:!0}),q.preventDefault()}),children:x.jsx(Jf,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:s,onPointerDownOutside:a,onFocusOutside:q=>q.preventDefault(),onDismiss:()=>y.onOpenChange(!1),children:x.jsx(H,{role:"listbox",id:y.contentId,"data-state":y.open?"open":"closed",dir:y.dir,onContextMenu:q=>q.preventDefault(),...v,...J,onPlaced:()=>L(!0),ref:_,style:{display:"flex",flexDirection:"column",outline:"none",...v.style},onKeyDown:ve(v.onKeyDown,q=>{const ie=q.ctrlKey||q.altKey||q.metaKey;if(q.key==="Tab"&&q.preventDefault(),!ie&&q.key.length===1&&G(q.key),["ArrowUp","ArrowDown","Home","End"].includes(q.key)){let re=R().filter(ne=>!ne.disabled).map(ne=>ne.ref.current);if(["ArrowUp","End"].includes(q.key)&&(re=re.slice().reverse()),["ArrowUp","ArrowDown"].includes(q.key)){const ne=q.target,z=re.indexOf(ne);re=re.slice(z+1)}setTimeout(()=>M(re)),q.preventDefault()}})})})})})})});t4.displayName=uCe;var fCe="SelectItemAlignedPosition",r4=E.forwardRef((t,e)=>{const{__scopeSelect:r,onPlaced:n,...i}=t,s=$a(Ho,r),a=ja(Ho,r),[o,l]=E.useState(null),[c,u]=E.useState(null),d=vt(e,_=>u(_)),f=Py(r),h=E.useRef(!1),p=E.useRef(!0),{viewport:g,selectedItem:m,selectedItemText:v,focusSelectedItem:y}=a,b=E.useCallback(()=>{if(s.trigger&&s.valueNode&&o&&c&&g&&m&&v){const _=s.trigger.getBoundingClientRect(),A=c.getBoundingClientRect(),P=s.valueNode.getBoundingClientRect(),C=v.getBoundingClientRect();if(s.dir!=="rtl"){const ne=C.left-A.left,z=P.left-ne,Ee=_.left-z,me=_.width+Ee,Qe=Math.max(me,A.width),de=window.innerWidth-Kn,Pe=pL(z,[Kn,Math.max(Kn,de-Qe)]);o.style.minWidth=me+"px",o.style.left=Pe+"px"}else{const ne=A.right-C.right,z=window.innerWidth-P.right-ne,Ee=window.innerWidth-_.right-z,me=_.width+Ee,Qe=Math.max(me,A.width),de=window.innerWidth-Kn,Pe=pL(z,[Kn,Math.max(Kn,de-Qe)]);o.style.minWidth=me+"px",o.style.right=Pe+"px"}const O=f(),R=window.innerHeight-Kn*2,D=g.scrollHeight,L=window.getComputedStyle(c),j=parseInt(L.borderTopWidth,10),M=parseInt(L.paddingTop,10),N=parseInt(L.borderBottomWidth,10),k=parseInt(L.paddingBottom,10),$=j+M+D+k+N,U=Math.min(m.offsetHeight*5,$),G=window.getComputedStyle(g),B=parseInt(G.paddingTop,10),K=parseInt(G.paddingBottom,10),ee=_.top+_.height/2-Kn,H=R-ee,J=m.offsetHeight/2,q=m.offsetTop+J,ie=j+M+q,Z=$-ie;if(ie<=ee){const ne=O.length>0&&m===O[O.length-1].ref.current;o.style.bottom="0px";const z=c.clientHeight-g.offsetTop-g.offsetHeight,Ee=Math.max(H,J+(ne?K:0)+z+N),me=ie+Ee;o.style.height=me+"px"}else{const ne=O.length>0&&m===O[0].ref.current;o.style.top="0px";const Ee=Math.max(ee,j+g.offsetTop+(ne?B:0)+J)+Z;o.style.height=Ee+"px",g.scrollTop=ie-ee+g.offsetTop}o.style.margin=`${Kn}px 0`,o.style.minHeight=U+"px",o.style.maxHeight=R+"px",n==null||n(),requestAnimationFrame(()=>h.current=!0)}},[f,s.trigger,s.valueNode,o,c,g,m,v,s.dir,n]);br(()=>b(),[b]);const[w,S]=E.useState();br(()=>{c&&S(window.getComputedStyle(c).zIndex)},[c]);const T=E.useCallback(_=>{_&&p.current===!0&&(b(),y==null||y(),p.current=!1)},[b,y]);return x.jsx(pCe,{scope:r,contentWrapper:o,shouldExpandOnScrollRef:h,onScrollButtonChange:T,children:x.jsx("div",{ref:l,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:w},children:x.jsx(ke.div,{...i,ref:d,style:{boxSizing:"border-box",maxHeight:"100%",...i.style}})})})});r4.displayName=fCe;var hCe="SelectPopperPosition",XS=E.forwardRef((t,e)=>{const{__scopeSelect:r,align:n="start",collisionPadding:i=Kn,...s}=t,a=Iy(r);return x.jsx(uT,{...a,...s,ref:e,align:n,collisionPadding:i,style:{boxSizing:"border-box",...s.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});XS.displayName=hCe;var[pCe,h1]=Su(Ho,{}),QS="SelectViewport",n4=E.forwardRef((t,e)=>{const{__scopeSelect:r,nonce:n,...i}=t,s=ja(QS,r),a=h1(QS,r),o=vt(e,s.onViewportChange),l=E.useRef(0);return x.jsxs(x.Fragment,{children:[x.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:n}),x.jsx(Ay.Slot,{scope:r,children:x.jsx(ke.div,{"data-radix-select-viewport":"",role:"presentation",...i,ref:o,style:{position:"relative",flex:1,overflow:"hidden auto",...i.style},onScroll:ve(i.onScroll,c=>{const u=c.currentTarget,{contentWrapper:d,shouldExpandOnScrollRef:f}=a;if(f!=null&&f.current&&d){const h=Math.abs(l.current-u.scrollTop);if(h>0){const p=window.innerHeight-Kn*2,g=parseFloat(d.style.minHeight),m=parseFloat(d.style.height),v=Math.max(g,m);if(v<p){const y=v+h,b=Math.min(p,y),w=y-b;d.style.height=b+"px",d.style.bottom==="0px"&&(u.scrollTop=w>0?w:0,d.style.justifyContent="flex-end")}}}l.current=u.scrollTop})})})]})});n4.displayName=QS;var i4="SelectGroup",[mCe,gCe]=Su(i4),vCe=E.forwardRef((t,e)=>{const{__scopeSelect:r,...n}=t,i=tu();return x.jsx(mCe,{scope:r,id:i,children:x.jsx(ke.div,{role:"group","aria-labelledby":i,...n,ref:e})})});vCe.displayName=i4;var s4="SelectLabel",a4=E.forwardRef((t,e)=>{const{__scopeSelect:r,...n}=t,i=gCe(s4,r);return x.jsx(ke.div,{id:i.id,...n,ref:e})});a4.displayName=s4;var zg="SelectItem",[yCe,o4]=Su(zg),l4=E.forwardRef((t,e)=>{const{__scopeSelect:r,value:n,disabled:i=!1,textValue:s,...a}=t,o=$a(zg,r),l=ja(zg,r),c=o.value===n,[u,d]=E.useState(s??""),[f,h]=E.useState(!1),p=vt(e,y=>{var b;return(b=l.itemRefCallback)==null?void 0:b.call(l,y,n,i)}),g=tu(),m=E.useRef("touch"),v=()=>{i||(o.onValueChange(n),o.onOpenChange(!1))};if(n==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return x.jsx(yCe,{scope:r,value:n,disabled:i,textId:g,isSelected:c,onItemTextChange:E.useCallback(y=>{d(b=>b||((y==null?void 0:y.textContent)??"").trim())},[]),children:x.jsx(Ay.ItemSlot,{scope:r,value:n,disabled:i,textValue:u,children:x.jsx(ke.div,{role:"option","aria-labelledby":g,"data-highlighted":f?"":void 0,"aria-selected":c&&f,"data-state":c?"checked":"unchecked","aria-disabled":i||void 0,"data-disabled":i?"":void 0,tabIndex:i?void 0:-1,...a,ref:p,onFocus:ve(a.onFocus,()=>h(!0)),onBlur:ve(a.onBlur,()=>h(!1)),onClick:ve(a.onClick,()=>{m.current!=="mouse"&&v()}),onPointerUp:ve(a.onPointerUp,()=>{m.current==="mouse"&&v()}),onPointerDown:ve(a.onPointerDown,y=>{m.current=y.pointerType}),onPointerMove:ve(a.onPointerMove,y=>{var b;m.current=y.pointerType,i?(b=l.onItemLeave)==null||b.call(l):m.current==="mouse"&&y.currentTarget.focus({preventScroll:!0})}),onPointerLeave:ve(a.onPointerLeave,y=>{var b;y.currentTarget===document.activeElement&&((b=l.onItemLeave)==null||b.call(l))}),onKeyDown:ve(a.onKeyDown,y=>{var w;((w=l.searchRef)==null?void 0:w.current)!==""&&y.key===" "||(nCe.includes(y.key)&&v(),y.key===" "&&y.preventDefault())})})})})});l4.displayName=zg;var rd="SelectItemText",c4=E.forwardRef((t,e)=>{const{__scopeSelect:r,className:n,style:i,...s}=t,a=$a(rd,r),o=ja(rd,r),l=o4(rd,r),c=oCe(rd,r),[u,d]=E.useState(null),f=vt(e,v=>d(v),l.onItemTextChange,v=>{var y;return(y=o.itemTextRefCallback)==null?void 0:y.call(o,v,l.value,l.disabled)}),h=u==null?void 0:u.textContent,p=E.useMemo(()=>x.jsx("option",{value:l.value,disabled:l.disabled,children:h},l.value),[l.disabled,l.value,h]),{onNativeOptionAdd:g,onNativeOptionRemove:m}=c;return br(()=>(g(p),()=>m(p)),[g,m,p]),x.jsxs(x.Fragment,{children:[x.jsx(ke.span,{id:l.textId,...s,ref:f}),l.isSelected&&a.valueNode&&!a.valueNodeHasChildren?qo.createPortal(s.children,a.valueNode):null]})});c4.displayName=rd;var u4="SelectItemIndicator",d4=E.forwardRef((t,e)=>{const{__scopeSelect:r,...n}=t;return o4(u4,r).isSelected?x.jsx(ke.span,{"aria-hidden":!0,...n,ref:e}):null});d4.displayName=u4;var JS="SelectScrollUpButton",f4=E.forwardRef((t,e)=>{const r=ja(JS,t.__scopeSelect),n=h1(JS,t.__scopeSelect),[i,s]=E.useState(!1),a=vt(e,n.onScrollButtonChange);return br(()=>{if(r.viewport&&r.isPositioned){let o=function(){const c=l.scrollTop>0;s(c)};const l=r.viewport;return o(),l.addEventListener("scroll",o),()=>l.removeEventListener("scroll",o)}},[r.viewport,r.isPositioned]),i?x.jsx(p4,{...t,ref:a,onAutoScroll:()=>{const{viewport:o,selectedItem:l}=r;o&&l&&(o.scrollTop=o.scrollTop-l.offsetHeight)}}):null});f4.displayName=JS;var ZS="SelectScrollDownButton",h4=E.forwardRef((t,e)=>{const r=ja(ZS,t.__scopeSelect),n=h1(ZS,t.__scopeSelect),[i,s]=E.useState(!1),a=vt(e,n.onScrollButtonChange);return br(()=>{if(r.viewport&&r.isPositioned){let o=function(){const c=l.scrollHeight-l.clientHeight,u=Math.ceil(l.scrollTop)<c;s(u)};const l=r.viewport;return o(),l.addEventListener("scroll",o),()=>l.removeEventListener("scroll",o)}},[r.viewport,r.isPositioned]),i?x.jsx(p4,{...t,ref:a,onAutoScroll:()=>{const{viewport:o,selectedItem:l}=r;o&&l&&(o.scrollTop=o.scrollTop+l.offsetHeight)}}):null});h4.displayName=ZS;var p4=E.forwardRef((t,e)=>{const{__scopeSelect:r,onAutoScroll:n,...i}=t,s=ja("SelectScrollButton",r),a=E.useRef(null),o=Py(r),l=E.useCallback(()=>{a.current!==null&&(window.clearInterval(a.current),a.current=null)},[]);return E.useEffect(()=>()=>l(),[l]),br(()=>{var u;const c=o().find(d=>d.ref.current===document.activeElement);(u=c==null?void 0:c.ref.current)==null||u.scrollIntoView({block:"nearest"})},[o]),x.jsx(ke.div,{"aria-hidden":!0,...i,ref:e,style:{flexShrink:0,...i.style},onPointerDown:ve(i.onPointerDown,()=>{a.current===null&&(a.current=window.setInterval(n,50))}),onPointerMove:ve(i.onPointerMove,()=>{var c;(c=s.onItemLeave)==null||c.call(s),a.current===null&&(a.current=window.setInterval(n,50))}),onPointerLeave:ve(i.onPointerLeave,()=>{l()})})}),bCe="SelectSeparator",m4=E.forwardRef((t,e)=>{const{__scopeSelect:r,...n}=t;return x.jsx(ke.div,{"aria-hidden":!0,...n,ref:e})});m4.displayName=bCe;var eE="SelectArrow",xCe=E.forwardRef((t,e)=>{const{__scopeSelect:r,...n}=t,i=Iy(r),s=$a(eE,r),a=ja(eE,r);return s.open&&a.position==="popper"?x.jsx(dT,{...i,...n,ref:e}):null});xCe.displayName=eE;var wCe="SelectBubbleInput",g4=E.forwardRef(({__scopeSelect:t,value:e,...r},n)=>{const i=E.useRef(null),s=vt(n,i),a=tCe(e);return E.useEffect(()=>{const o=i.current;if(!o)return;const l=window.HTMLSelectElement.prototype,u=Object.getOwnPropertyDescriptor(l,"value").set;if(a!==e&&u){const d=new Event("change",{bubbles:!0});u.call(o,e),o.dispatchEvent(d)}},[a,e]),x.jsx(ke.select,{...r,style:{...VN,...r.style},ref:s,defaultValue:e})});g4.displayName=wCe;function v4(t){return t===""||t===void 0}function y4(t){const e=Rn(t),r=E.useRef(""),n=E.useRef(0),i=E.useCallback(a=>{const o=r.current+a;e(o),function l(c){r.current=c,window.clearTimeout(n.current),c!==""&&(n.current=window.setTimeout(()=>l(""),1e3))}(o)},[e]),s=E.useCallback(()=>{r.current="",window.clearTimeout(n.current)},[]);return E.useEffect(()=>()=>window.clearTimeout(n.current),[]),[r,i,s]}function b4(t,e,r){const i=e.length>1&&Array.from(e).every(c=>c===e[0])?e[0]:e,s=r?t.indexOf(r):-1;let a=SCe(t,Math.max(s,0));i.length===1&&(a=a.filter(c=>c!==r));const l=a.find(c=>c.textValue.toLowerCase().startsWith(i.toLowerCase()));return l!==r?l:void 0}function SCe(t,e){return t.map((r,n)=>t[(e+n)%t.length])}var ECe=K3,x4=q3,TCe=X3,_Ce=Q3,ACe=J3,w4=Z3,PCe=n4,S4=a4,E4=l4,ICe=c4,CCe=d4,T4=f4,_4=h4,A4=m4;const OCe=ECe,RCe=TCe,P4=E.forwardRef(({className:t,children:e,...r},n)=>x.jsxs(x4,{ref:n,className:be("flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm r
396ing-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",t),...r,children:[e,x.jsx(_Ce,{asChild:!0,children:x.jsx(fM,{className:"h-4 w-4 opacity-50"})})]}));P4.displayName=x4.displayName;const I4=E.forwardRef(({className:t,...e},r)=>x.jsx(T4,{ref:r,className:be("flex cursor-default items-center justify-center py-1",t),...e,children:x.jsx(xG,{className:"h-4 w-4"})}));I4.displayName=T4.displayName;const C4=E.forwardRef(({className:t,...e},r)=>x.jsx(_4,{ref:r,className:be("flex cursor-default items-center justify-center py-1",t),...e,children:x.jsx(fM,{className:"h-4 w-4"})}));C4.displayName=_4.displayName;const O4=E.forwardRef(({className:t,children:e,position:r="popper",...n},i)=>x.jsx(ACe,{children:x.jsxs(w4,{ref:i,className:be("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",r==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",t),position:r,...n,children:[x.jsx(I4,{}),x.jsx(PCe,{className:be("p-1",r==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:e}),x.jsx(C4,{})]})}));O4.displayName=w4.displayName;const kCe=E.forwardRef(({className:t,...e},r)=>x.jsx(S4,{ref:r,className:be("py-1.5 pl-8 pr-2 text-sm font-semibold",t),...e}));kCe.displayName=S4.displayName;const R4=E.forwardRef(({className:t,children:e,...r},n)=>x.jsxs(E4,{ref:n,className:be("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),...r,children:[x.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:x.jsx(CCe,{children:x.jsx(kx,{className:"h-4 w-4"})})}),x.jsx(ICe,{children:e})]}));R4.displayName=E4.displayName;const LCe=E.forwardRef(({className:t,...e},r)=>x.jsx(A4,{ref:r,className:be("-mx-1 my-1 h-px bg-muted",t),...e}));LCe.displayName=A4.displayName;function DCe({streamUrl:t}){const e=E.useRef(null);return E.useEffect(()=>{if(e.current&&ln.isSupported()){const r=new ln;return r.loadSource(t),r.attachMedia(e.current),()=>{r.destroy()}}else e.current&&(e.current.src=t)},[t]),x.jsx("video",{ref:e,controls:!0,autoPlay:!0,className:"w-full rounded-lg"})}function NCe(){const t=Ir(),{isDemo:e}=yn(),[r,n]=E.useState(null),[i,s]=E.useState(null),[a,o]=E.useState([]),[l,c]=E.useState(""),[u,d]=E.useState(new Date),[f,h]=E.useState({}),[p,g]=E.useState(!0),{isAdmin:m,checking:v}=cu(r);E.useEffect(()=>{(async()=>{try{const{data:{session:_}}=await _e.auth.getSession();if(_!=null&&_.user)n(_.user),s(_);else{const A=localStorage.getItem("customUser");if(A){const P=JSON.parse(A);n({id:P.user_id,email:P.email})}else{t("/auth");return}}g(!1)}catch{t("/auth")}})()},[t]),E.useEffect(()=>{r&&(v||(m?t("/admin"):y(r.id)))},[r==null?void 0:r.id,m,v,t]);const y=async T=>{const{data:_,error:A}=await _e.from("stream_data").select("*").eq("user_id",T).order("sequence_number");if(A){He.error("Failed to fetch your streams");return}o(_||[]),_&&_.length>0&&c(_[0].stream_id)},b=async()=>{const T={};try{for(const _ of a)if(_.hls_url)T[_.stream_id]=_.hls_url;else{const A=await fetch(`/api/stream-url?streamId=${_.stream_id}`);if(!A.ok)throw new Error("Failed to fetch stream URL");const P=await A.json();T[_.stream_id]=P.url}h(T)}catch(_){console.error("Error fetching stream URLs:",_)}},w=()=>{u&&b()},S=async()=>{try{i&&await _e.auth.signOut(),localStorage.removeItem("customUser"),e?window.location.href="https://roboeye.robodost.ai/login":t("/auth")}catch(T){console.error("Logout error:",T)}};return p||v?x.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gradient-primary",children:x.jsxs("div",{className:"text-center",children:[x.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-primary mx-auto mb-4"}),x.jsx("p",{className:"text-muted-foreground",children:"Loading..."})]})}):r?x.jsxs("div",{className:"min-h-screen bg-background p-4 md:p-8",children:[x.jsxs("div",{className:"flex justify-between items-center mb-8",children:[x.jsxs("div",{className:"flex items-center gap-4",children:[x.jsx(_i,{to:"/dashboard",children:x.jsxs(Re,{variant:"ghost",size:"sm",className:"gap-2",children:[x.jsx(pv,{className:"h-4 w-4"}),"Back"]})}),x.jsx("img",{src:$o,alt:"RoboEye",className:"h-16 object-contain"})]}),x.jsxs("div",{className:"flex items-center gap-4",children:[x.jsx("span",{className:"text-muted-foreground",children:r==null?void 0:r.email}),x.jsxs(Re,{onClick:S,variant:"outline",size:"sm",className:"gap-2",children:[x.jsx(Bd,{className:"h-4 w-4"}),"Logout"]})]})]}),x.jsx("h2",{className:"text-2xl font-semibold mb-6",children:"Archived Footage"}),x.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 items-end mb-6",children:[x.jsxs("div",{className:"flex-1",children:[x.jsx(Dt,{children:"Select Date"}),x.jsxs(zIe,{children:[x.jsx(qIe,{asChild:!0,children:x.jsxs(Re,{variant:"outline",className:be("w-full justify-start text-left font-normal",!u&&"text-muted-foreground"),children:[x.jsx(vG,{className:"mr-2 h-4 w-4"}),u?Ts(u,"PPP"):x.jsx("span",{children:"Pick a date"})]})}),x.jsx(H3,{className:"w-auto p-0",children:x.jsx(E3,{mode:"single",selected:u,onSelect:d,initialFocus:!0})})]})]}),x.jsxs("div",{className:"flex-1",children:[x.jsx(Dt,{children:"Select Stream"}),x.jsxs(OCe,{value:l,onValueChange:c,children:[x.jsx(P4,{children:x.jsx(RCe,{placeholder:"Select a stream"})}),x.jsx(O4,{children:a.map(T=>x.jsxs(R4,{value:T.stream_id,children:["Stream ",T.sequence_number," - ",T.stream_id]},T.id))})]})]}),x.jsx(Re,{onClick:w,children:"Load Footage"})]}),x.jsxs(Ke,{children:[x.jsx(rt,{children:x.jsx(ct,{children:u?Ts(u,"PPP"):"No date selected"})}),x.jsx(ze,{children:f[l]?x.jsx(DCe,{streamUrl:f[l]}):x.jsx("p",{className:"text-muted-foreground text-center py-8",children:"Select a date and stream, then click Load Footage."})})]})]}):null}const MCe=()=>{const t=Is();return E.useEffect(()=>{console.error("404 Error: User attempted to access non-existent route:",t.pathname)},[t.pathname]),x.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gradient-subtle",children:x.jsxs("div",{className:"text-center space-y-6",children:[x.jsxs("div",{className:"space-y-4",children:[x.jsx("h1",{className:"text-6xl font-bold bg-gradient-primary bg-clip-text text-transparent",children:"404"}),x.jsx("h2",{className:"text-2xl font-semibold text-foreground",children:"Page Not Found"}),x.jsx("p",{className:"text-lg text-muted-foreground max-w-md",children:"Oops! The page you're looking for doesn't exist."})]}),x.jsx(Re,{variant:"hero",size:"lg",asChild:!0,children:x.jsx("a",{href:"/",children:"Return to Home"})})]})})},$Ce=()=>{const[t]=_v(),e=Ir(),{user:r,loading:n}=yn(),[i,s]=E.useState("loading"),[a,o]=E.useState("");return E.useEffect(()=>{(async()=>{try{const c=t.get("token"),u=t.get("type");if(c&&u){const{error:d}
396=await _e.auth.verifyOtp({token_hash:c,type:u});d?(s("error"),o("Email verification failed. The link may have expired.")):(s("success"),o("Email verified successfully!"))}else s("error"),o("Invalid verification link.")}catch(c){console.error("Verification error:",c),s("error"),o("An error occurred during verification.")}})()},[t]),E.useEffect(()=>{r&&!n&&i==="success"&&setTimeout(()=>{e("/dashboard")},1500)},[r,n,i,e]),x.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gradient-to-br from-background to-secondary/20 p-4",children:x.jsxs(Ke,{className:"w-full max-w-md text-center",children:[x.jsx(rt,{children:x.jsxs(ct,{className:"flex items-center justify-center gap-2",children:[i==="loading"&&x.jsx(eT,{className:"h-6 w-6 animate-spin text-primary"}),i==="success"&&x.jsx(hM,{className:"h-6 w-6 text-green-600"}),i==="error"&&x.jsx(wG,{className:"h-6 w-6 text-red-600"}),i==="loading"&&"Verifying Email...",i==="success"&&"Email Verified!",i==="error"&&"Verification Failed"]})}),x.jsxs(ze,{children:[x.jsx("p",{className:"text-muted-foreground",children:a}),i==="success"&&x.jsx("div",{className:"mt-4",children:x.jsx("div",{className:"animate-pulse text-sm text-muted-foreground",children:"Redirecting to your dashboard..."})}),i==="error"&&x.jsx("div",{className:"mt-4",children:x.jsx("a",{href:"/auth",className:"text-primary hover:underline",children:"Return to Sign In"})})]})]})})},k4=["walkway_violation"],L4=["unauthorized_machine"],D4=["overload_violation"],N4=["no_helmet","no_vest","no_gloves","no_mask"],p1={walkway_violation:"Walkway Violation",unauthorized_machine:"Unauthorized Access",overload_violation:"Overload Violation",no_helmet:"No Helmet",no_vest:"No Vest",no_gloves:"No Gloves",no_mask:"No Mask"},M4={walkway_violation:"#f97316",unauthorized_machine:"#ef4444",overload_violation:"#eab308",no_helmet:"#ef4444",no_vest:"#f97316",no_gloves:"#eab308",no_mask:"#a855f7"},jCe={walkway_violation:"border-orange-500/50 bg-orange-500/10",unauthorized_machine:"border-red-500/50 bg-red-500/10",overload_violation:"border-yellow-500/50 bg-yellow-500/10",no_helmet:"border-red-500/50 bg-red-500/10",no_vest:"border-orange-500/50 bg-orange-500/10",no_gloves:"border-yellow-500/50 bg-yellow-500/10",no_mask:"border-purple-500/50 bg-purple-500/10"};function FCe(t){const e=Math.floor(t/60),r=Math.floor(t%60);return`${e}:${r.toString().padStart(2,"0")}`}const BCe="/ppe_demo.mp4";function UCe({alerts:t,filterTypes:e,onTimeUpdate:r,demoTime:n,isActive:i}){const s=E.useRef(null),a=E.useRef(null),o=E.useRef(null),l=E.useRef(!1),c=E.useRef(0);return E.useEffect(()=>{const u=s.current;u&&(u.src=BCe,u.loop=!0,u.muted=!0,i?u.play().catch(()=>{}):u.pause())},[i]),E.useEffect(()=>{const u=s.current;if(!u)return;const d=()=>{u.currentTime>0&&(l.current=!0),r(u.currentTime)},f=()=>{l.current=!1,c.current=0},h=()=>{l.current=!0,c.current=Date.now()};return u.addEventListener("timeupdate",d),u.addEventListener("waiting",f),u.addEventListener("playing",h),()=>{u.removeEventListener("timeupdate",d),u.removeEventListener("waiting",f),u.removeEventListener("playing",h)}},[r]),E.useEffect(()=>{const u=s.current,d=a.current,f=o.current;if(!u||!d||!f)return;const h=new Map;for(const m of t){const v=h.get(m.type);(v===void 0||m.time_s<v)&&h.set(m.type,m.time_s)}const g=setInterval(()=>{const m=d.getContext("2d");if(!m)return;if(!l.current||Date.now()-c.current<1e3){m.clearRect(0,0,d.width,d.height);return}const v=u.videoWidth||1920,y=u.videoHeight||1080,b=f.clientWidth,w=f.clientHeight,S=Math.min(b/v,w/y),T=v*S,_=y*S,A=(b-T)/2,P=(w-_)/2;d.width=b,d.height=w,m.clearRect(0,0,b,w);const C=t.filter(D=>e.includes(D.type)&&Math.abs(D.time_s-n)<1.5&&D.time_s!==h.get(D.type)),O=new Map;for(const D of C){const L=O.get(D.type);(!L||Math.abs(D.time_s-n)<Math.abs(L.time_s-n))&&O.set(D.type,D)}const R=Array.from(O.values());for(const D of R){const[L,j,M,N]=D.bbox,k=A+L*S,$=P+j*S,U=(M-L)*S,G=(N-j)*S,B=M4[D.type]??"#ef4444";m.strokeStyle=B,m.lineWidth=2.5,m.strokeRect(k,$,U,G);const K=`${p1[D.type]??D.type}  ${Math.round(D.conf*100)}%`;m.font="bold 13px sans-serif";const ee=m.measureText(K).width+10;m.fillStyle=B+"ee",m.fillRect(k,$-22,ee,22),m.fillStyle="#fff",m.fillText(K,k+5,$-6)}},80);return()=>clearInterval(g)},[t,e,n]),x.jsxs("div",{ref:o,className:"relative w-full h-full bg-black rounded-lg overflow-hidden",children:[x.jsx("video",{ref:s,className:"w-full h-full object-contain",playsInl
396ine:!0}),x.jsx("canvas",{ref:a,className:"absolute inset-0 pointer-events-none"})]})}function GCe({alerts:t,filterTypes:e,demoTime:r}){const n=E.useMemo(()=>t.filter(i=>e.includes(i.type)&&i.time_s<=r+1).slice(-8).reverse(),[t,e,r]);return x.jsxs("div",{className:"flex flex-col h-full",children:[x.jsx("p",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide mb-2 shrink-0",children:"Latest Incidents"}),x.jsx("div",{className:"flex-1 space-y-1.5 overflow-y-auto min-h-0",children:n.length===0?x.jsx("p",{className:"text-muted-foreground text-sm text-center py-6",children:"No incidents yet"}):n.map((i,s)=>x.jsxs("div",{className:be("rounded-md border px-3 py-2 text-sm",jCe[i.type]??"border-border bg-muted/30"),children:[x.jsxs("div",{className:"flex justify-between items-start gap-2",children:[x.jsx("span",{className:"font-medium",children:p1[i.type]??i.type}),x.jsx("span",{className:"text-xs text-muted-foreground font-mono shrink-0",children:FCe(i.time_s)})]}),x.jsxs("div",{className:"text-xs text-muted-foreground mt-0.5",children:[i.worker_id," · ",i.zone," · ",Math.round(i.conf*100),"% conf"]})]},s))})]})}function WCe({alerts:t}){const e=E.useMemo(()=>{const c={};for(const u of t)c[u.type]=(c[u.type]??0)+1;return Object.entries(c).sort((u,d)=>d[1]-u[1]).map(([u,d])=>({name:p1[u]??u,value:d,color:M4[u]??"#888"}))},[t]),r=E.useMemo(()=>{const c={};for(const u of t)c[u.worker_id]=(c[u.worker_id]??0)+1;return Object.entries(c).sort((u,d)=>d[1]-u[1]).slice(0,6).map(([u,d])=>({name:u,value:d}))},[t]),n=E.useMemo(()=>{const c={};for(const u of t)c[u.zone]=(c[u.zone]??0)+1;return Object.entries(c).sort((u,d)=>d[1]-u[1]).map(([u,d])=>({name:u,value:d,color:"#6366f1"}))},[t]),i=t.filter(c=>k4.includes(c.type)).length,s=t.filter(c=>L4.includes(c.type)).length,a=t.filter(c=>D4.includes(c.type)).length,o=t.filter(c=>N4.includes(c.type)).length,l=[{label:"Walkway Violations",value:i,color:"text-orange-500",bg:"bg-orange-500/10 border-orange-500/30"},{label:"Unauthorized Access",value:s,color:"text-red-500",bg:"bg-red-500/10 border-red-500/30"},{label:"Overload Violations",value:a,color:"text-yellow-500",bg:"bg-yellow-400/10 border-yellow-500/30"},{label:"PPE Violations",value:o,color:"text-purple-500",bg:"bg-purple-500/10 border-purple-500/30"}];return x.jsxs("div",{className:"space-y-5 pb-4",children:[x.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-3",children:l.map(({label:c,value:u,color:d,bg:f})=>x.jsxs("div",{className:be("rounded-lg border p-3 text-center",f),children:[x.jsx("div",{className:be("text-2xl font-bold",d),children:u}),x.jsx("div",{className:"text-xs text-muted-foreground mt-0.5 leading-tight",children:c})]},c))}),x.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[x.jsxs(Ke,{children:[x.jsx(rt,{className:"pb-2 pt-3 px-4",children:x.jsx(ct,{className:"text-sm",children:"Violations by Type"})}),x.jsx(ze,{className:"px-2 pb-3",children:x.jsx(Yp,{width:"100%",height:180,children:x.jsxs(Xp,{data:e,margin:{top:4,right:8,left:-16,bottom:40},children:[x.jsx(Co,{dataKey:"name",tick:{fontSize:10},angle:-30,textAnchor:"end",interval:0}),x.jsx(Oo,{tick:{fontSize:10}}),x.jsx(nn,{formatter:c=>[c,"Count"]}),x.jsx($i,{dataKey:"value",radius:[4,4,0,0],children:e.map((c,u)=>x.jsx(ff,{fill:c.color},u))})]})})})]}),x.jsxs(Ke,{children:[x.jsx(rt,{className:"pb-2 pt-3 px-4",children:x.jsx(ct,{className:"text-sm",children:"Violations by Zone"})}),x.jsx(ze,{className:"px-2 pb-3",children:x.jsx(Yp,{width:"100%",height:180,children:x.jsxs(Xp,{data:n,margin:{top:4,right:8,left:-16,bottom:40},children:[x.jsx(Co,{dataKey:"name",tick:{fontSize:10},angle:-30,textAnchor:"end",interval:0}),x.jsx(Oo,{tick:{fontSize:10}}),x.jsx(nn,{formatter:c=>[c,"Count"]}),x.jsx($i,{dataKey:"value",radius:[4,4,0,0],children:n.map((c,u)=>x.jsx(ff,{fill:c.color},u))})]})})})]})]}),x.jsxs(Ke,{children:[x.jsx(rt,{className:"pb-2 pt-3 px-4",children:x.jsx(ct,{className:"text-sm",children:"Top Workers by Violations"})}),x.jsx(ze,{className:"px-2 pb-3",children:x.jsx(Yp,{width:"100%",height:140,children:x.jsxs(Xp,{data:r,layout:"vertical",margin:{top:0,right:16,left:8,bottom:0}
396,children:[x.jsx(Co,{type:"number",tick:{fontSize:10}}),x.jsx(Oo,{dataKey:"name",type:"category",tick:{fontSize:10},width:40}),x.jsx(nn,{formatter:c=>[c,"Violations"]}),x.jsx($i,{dataKey:"value",fill:"#f97316",radius:[0,4,4,0]})]})})})]})]})}const mL=[...k4,...L4,...D4,...N4];function VCe(){const[t,e]=E.useState([]),[r,n]=E.useState(0),[i,s]=E.useState("incidents");E.useEffect(()=>{fetch("/safety_alerts.json").then(o=>o.json()).then(e).catch(console.error)},[]);const a=E.useCallback(o=>n(o),[]);return x.jsxs("div",{className:"h-screen flex flex-col overflow-hidden bg-background p-4 pb-16 md:p-8 md:pb-8",children:[x.jsx("div",{className:"flex sm:hidden justify-center mb-4 shrink-0",children:x.jsx("img",{src:$o,alt:"RoboEye",className:"h-[60px] object-contain"})}),x.jsx("div",{className:"hidden sm:flex justify-center mb-6 shrink-0",children:x.jsx("img",{src:$o,alt:"RoboEye",className:"h-24 object-contain"})}),x.jsxs(TT,{value:i,onValueChange:s,className:"flex flex-col flex-1 min-h-0 w-full",children:[x.jsxs(Ov,{className:"grid grid-cols-2 w-full mb-3 h-auto bg-muted/40 rounded-lg p-1 gap-1 shrink-0",children:[x.jsx(ls,{value:"incidents",className:"rounded-md text-lg font-semibold py-2.5 px-3 text-muted-foreground data-[state=active]:bg-primary data-[state=active]:text-primary-foreground transition-all",children:"Incidents"}),x.jsx(ls,{value:"analysis",className:"rounded-md text-lg font-semibold py-2.5 px-3 text-muted-foreground data-[state=active]:bg-primary data-[state=active]:text-primary-foreground transition-all",children:"Analysis"})]}),x.jsx(cs,{value:"incidents",className:"flex-1 min-h-0 mt-0",children:x.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 h-full",children:[x.jsx("div",{className:"flex-1 min-h-0",children:x.jsx(UCe,{alerts:t,filterTypes:mL,onTimeUpdate:a,demoTime:r,isActive:i==="incidents"})}),x.jsx("div",{className:"sm:w-64 shrink-0 min-h-0 overflow-hidden flex flex-col",children:x.jsx(GCe,{alerts:t,filterTypes:mL,demoTime:r})})]})}),x.jsx(cs,{value:"analysis",className:"flex-1 min-h-0 mt-0 overflow-y-auto",children:x.jsx(WCe,{alerts:t})})]})]})}const HCe=[{path:"/retail",title:"Retail Analytics",description:"Theft detection, missing items, and customer behaviour analysis for retail stores.",icon:"🛒",color:"hover:border-primary/60 hover:bg-primary/5"},{path:"/industrial-safety",title:"Industrial Safety",description:"PPE compliance monitoring and security rule violation detection for industrial sites.",icon:"🦺",color:"hover:border-orange-500/60 hover:bg-orange-500/5"}];function KCe(){const t=Ir();return x.jsxs("div",{className:"min-h-screen flex flex-col items-center justify-center bg-background px-6 py-12",children:[x.jsx("img",{src:$o,alt:"RoboEye",className:"h-24 object-contain mb-10"}),x.jsx("h1",{className:"text-2xl font-bold text-center mb-2",children:"Choose a Demo"}),x.jsx("p",{className:"text-muted-foreground text-center mb-10 max-w-sm",children:"Select an industry to explore RoboEye's AI-powered video analytics."}),x.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-5 w-full max-w-2xl",children:HCe.map(({path:e,title:r,description:n,icon:i,color:s})=>x.jsxs("button",{onClick:()=>t(e),className:`rounded-2xl border border-border bg-card text-left p-6 shadow-sm transition-all duration-150 cursor-pointer ${s}`,children:[x.jsx("div",{className:"text-4xl mb-4",children:i}),x.jsx("h2",{className:"text-lg font-semibold mb-1",children:r}),x.jsx("p",{className:"text-sm text-muted-foreground leading-snug",children:n})]},e))})]})}const zCe=new qH,qCe=()=>x.jsx(XH,{client:zCe,children:x.jsx(Mq,{children:x.jsxs(xH,{children:[x.jsx(oW,{}),x.jsx(FW,{}),x.jsx(JK,{children:x.jsxs(VK,{children:[x.jsx(cr,{path:"/",element:x.jsx(xY,{})}),x.jsx(cr,{path:"/login",element:x.jsx(Xq,{})}),x.jsx(cr,{path:"/auth",element:x.jsx(bY,{})}),x.jsx(cr,{path:"/verify",element:x.jsx($Ce,{})}),x.jsx(cr,{path:"/dashboard",element:x.jsx(ol,{children:x.jsx(Kk,{})})}),x.jsx(cr,{path:"/plans",element:x.jsx(U_e,{})}),x.jsx(cr,{path:"/pay",element:x.jsx(K_e,{})}),x.jsx(cr,{path:"/payment-success",element:x.jsx(z_e,{})}),x.jsx(cr,{path:"/admin/streams",element:x.jsx(ol,{children:x.jsx(q_e,{})})}),x.jsx(cr,{path:"/admin/users/:userId/streams",element:x.jsx(ol,{children:x.jsx(X_e,{})})}),x.jsx(cr,{path:"/admin",element:x.jsx(ol,{children:x.jsx(Y_e,{})})}),x.jsx(cr,{path:"/archived",element:x.jsx(ol,{children:x.jsx(NCe,{})})}),x.jsx(cr,{path:"/industrial-safety",element:x.jsx(VCe,{})}),x.jsx(cr,{path:"/retail",element:x.jsx(ol,{children:x.jsx(Kk,{})})}),x.jsx(cr,{path:"/demo",element:x.jsx(KCe,{})}),x.jsx(cr,{path:"*",element:x.jsx(MCe,{})})]})})]})})});jN(document.getElementById("root")).render(x.jsx(qCe,{}));

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.