PageSourceSearch

https://malayalam-sigma.vercel.app/assets/main-DvDw_IVK.js

js malayalam-sigma.vercel.app collected 2026-10-03 07:16:22 UTC 2,185,917 bytes, 1,068 lines download raw bytes

vendor: 6,589 bytes, lines 1-10
1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-DhsNlDSu.js","assets/index-DNzFMgCo.js","assets/index-CEzHUwVz.js","assets/index-1hbWiJZ8.js"])))=>i.map(i=>d[i]);
2var VV=Object.defineProperty;var HE=e=>{throw TypeError(e)};var HV=(e,t,r)=>t in e?VV(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var qE=(e,t,r)=>HV(e,typeof t!="symbol"?t+"":t,r),mw=(e,t,r)=>t.has(e)||HE("Cannot "+r);var he=(e,t,r)=>(mw(e,t,"read from private field"),r?r.call(e):t.get(e)),tt=(e,t,r)=>t.has(e)?HE("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),Be=(e,t,r,n)=>(mw(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),Tr=(e,t,r)=>(mw(e,t,"access private method"),r);var rg=(e,t,r,n)=>({set _(s){Be(e,t,s,r)},get _(){return he(e,t,n)}});function qV(e,t){for(var r=0;r<t.length;r++){const n=t[r];if(typeof n!="string"&&!Array.isArray(n)){for(const s in n)if(s!=="default"&&!(s in e)){const i=Object.getOwnPropertyDescriptor(n,s);i&&Object.defineProperty(e,s,i.get?i:{enumerable:!0,get:()=>n[s]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))n(s);new MutationObserver(s=>{for(const i of s)if(i.type==="childList")for(const o of i.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&n(o)}).observe(document,{childList:!0,subtree:!0});function r(s){const i={};return s.integrity&&(i.integrity=s.integrity),s.referrerPolicy&&(i.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?i.credentials="include":s.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function n(s){if(s.ep)return;s.ep=!0;const i=r(s);fetch(s.href,i)}})();var Co=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function mt(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var RR={exports:{}},i0={},$R={exports:{}},et={};/**
3 * @license React
4 * react.production.min.js
5 *
6 * Copyright (c) Facebook, Inc. and its affiliates.
7 *
8 * This source code is licensed under the MIT license found in the
9 * LICENSE file in the root directory of this source tree.
10 */var bp=Symbol.for("react.element"),GV=Symbol.for("react.portal"),KV=Symbol.for("react.fragment"),YV=Symbol.for("react.strict_mode"),XV=Symbol.for("react.profiler"),QV=Symbol.for("react.provider"),JV=Symbol.for("react.context"),ZV=Symbol.for("react.forward_ref"),eH=Symbol.for("react.suspense"),tH=Symbol.for("react.memo"),rH=Symbol.for("react.lazy"),GE=Symbol.iterator;function nH(e){return e===null||typeof e!="object"?null:(e=GE&&e[GE]||e["@@iterator"],typeof e=="function"?e:null)}var IR={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},DR=Object.assign,LR={};function Qd(e,t,r){this.props=e,this.context=t,this.refs=LR,this.updater=r||IR}Qd.prototype.isReactComponent={};Qd.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=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,e,t,"setState")};Qd.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function FR(){}FR.prototype=Qd.prototype;function rk(e,t,r){this.props=e,this.context=t,this.refs=LR,this.updater=r||IR}var nk=rk.prototype=new FR;nk.constructor=rk;DR(nk,Qd.prototype);nk.isPureReactComponent=!0;var KE=Array.isArray,zR=Object.prototype.hasOwnProperty,ak={current:null},BR={key:!0,ref:!0,__self:!0,__source:!0};function UR(e,t,r){var n,s={},i=null,o=null;if(t!=null)for(n in t.ref!==void 0&&(o=t.ref),t.key!==void 0&&(i=""+t.key),t)zR.call(t,n)&&!BR.hasOwnProperty(n)&&(s[n]=t[n]);var l=arguments.length-2;if(l===1)s.children=r;else if(1<l){for(var c=Array(l),u=0;u<l;u++)c[u]=arguments[u+2];s.children=c}if(e&&e.defaultProps)for(n in l=e.defaultProps,l)s[n]===void 0&&(s[n]=l[n]);return{$$typeof:bp,type:e,key:i,ref:o,props:s,_owner:ak.current}}function aH(e,t){return{$$typeof:bp,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}function sk(e){return typeof e=="object"&&e!==null&&e.$$typeof===bp}function sH(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(r){return t[r]})}var YE=/\/+/g;function pw(e,t){return typeof e=="object"&&e!==null&&e.key!=null?sH(""+e.key):t.toString(36)}function xy(e,t,r,n,s){var i=typeof e;(i==="undefined"||i==="boolean")&&(e=null);var o=!1;if(e===null)o=!0;else switch(i){case"string":case"number":o=!0;break;case"object":switch(e.$$typeof){case bp:case GV:o=!0}}if(o)return o=e,s=s(o),e=n===""?"."+pw(o,0):n,KE(s)?(r="",e!=null&&(r=e.replace(YE,"$&/")+"/"),xy(s,t,r,"",function(u){return u})):s!=null&&(sk(s)&&(s=aH(s,r+(!s.key||o&&o.key===s.key?"":(""+s.key).replace(YE,"$&/")+"/")+e)),t.push(s)),1;if(o=0,n=n===""?".":n+":",KE(e))for(var l=0;l<e.length;l++){i=e[l];var c=n+pw(i,l);o+=xy(i,t,r,c,s)}else if(c=nH(e),typeof c=="function")for(e=c.call(e),l=0;!(i=e.next()).done;)i=i.value,c=n+pw(i,l++),o+=xy(i,t,r,c,s);else if(i==="object")throw t=String(e),Error("Objects are not valid as a React child (found: "+(t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.");return o}function ng(e,t,r){if(e==null)return e;var n=[],s=0;return xy(e,n,"","",function(i){return t.call(r,i,s++)}),n}function iH(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(r){(e._status===0||e._status===-1)&&(e._status=1,e._result=r)},function(r){(e._status===0||e._status===-1)&&(e._status=2,e._result=r)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var un={current:null},by={transition:null},oH={ReactCurrentDispatcher:un,ReactCurrentBatchConfig:by,ReactCurrentOwner:ak};function WR(){throw Error("act(...) is not supported in production builds of React.")}et.Children={map:ng,forEach:function(e,t,r){ng(e,function(){t.apply(this,arguments)},r)},count:function(e){var t=0;return ng(e,function(){t++}),t},toArray:function(e){return ng(e,function(t){return t})||[]},only:function(e){if(!sk(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};et.Component=Qd;et.Fragment=KV;et.Profiler=XV;et.PureComponent=rk;et.StrictMode=YV;et.Suspense=eH;
vendor: 4,958 bytes, lines 10-26
10et.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=oH;et.act=WR;et.cloneElement=function(e,t,r){if(e==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+e+".");var n=DR({},e.props),s=e.key,i=e.ref,o=e._owner;if(t!=null){if(t.ref!==void 0&&(i=t.ref,o=ak.current),t.key!==void 0&&(s=""+t.key),e.type&&e.type.defaultProps)var l=e.type.defaultProps;for(c in t)zR.call(t,c)&&!BR.hasOwnProperty(c)&&(n[c]=t[c]===void 0&&l!==void 0?l[c]:t[c])}var c=arguments.length-2;if(c===1)n.children=r;else if(1<c){l=Array(c);for(var u=0;u<c;u++)l[u]=arguments[u+2];n.children=l}return{$$typeof:bp,type:e.type,key:s,ref:i,props:n,_owner:o}};et.createContext=function(e){return e={$$typeof:JV,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:QV,_context:e},e.Consumer=e};et.createElement=UR;et.createFactory=function(e){var t=UR.bind(null,e);return t.type=e,t};et.createRef=function(){return{current:null}};et.forwardRef=function(e){return{$$typeof:ZV,render:e}};et.isValidElement=sk;et.lazy=function(e){return{$$typeof:rH,_payload:{_status:-1,_result:e},_init:iH}};et.memo=function(e,t){return{$$typeof:tH,type:e,compare:t===void 0?null:t}};et.startTransition=function(e){var t=by.transition;by.transition={};try{e()}finally{by.transition=t}};et.unstable_act=WR;et.useCallback=function(e,t){return un.current.useCallback(e,t)};et.useContext=function(e){return un.current.useContext(e)};et.useDebugValue=function(){};et.useDeferredValue=function(e){return un.current.useDeferredValue(e)};et.useEffect=function(e,t){return un.current.useEffect(e,t)};et.useId=function(){return un.current.useId()};et.useImperativeHandle=function(e,t,r){return un.current.useImperativeHandle(e,t,r)};et.useInsertionEffect=function(e,t){return un.current.useInsertionEffect(e,t)};et.useLayoutEffect=function(e,t){return un.current.useLayoutEffect(e,t)};et.useMemo=function(e,t){return un.current.useMemo(e,t)};et.useReducer=function(e,t,r){return un.current.useReducer(e,t,r)};et.useRef=function(e){return un.current.useRef(e)};et.useState=function(e){return un.current.useState(e)};et.useSyncExternalStore=function(e,t,r){return un.current.useSyncExternalStore(e,t,r)};et.useTransition=function(){return un.current.useTransition()};et.version="18.3.1";$R.exports=et;var y=$R.exports;const J=mt(y),o0=qV({__proto__:null,default:J},[y]);/**
11 * @license React
12 * react-jsx-runtime.production.min.js
13 *
14 * Copyright (c) Facebook, Inc. and its affiliates.
15 *
16 * This source code is licensed under the MIT license found in the
17 * LICENSE file in the root directory of this source tree.
18 */var lH=y,cH=Symbol.for("react.element"),uH=Symbol.for("react.fragment"),dH=Object.prototype.hasOwnProperty,hH=lH.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,fH={key:!0,ref:!0,__self:!0,__source:!0};function VR(e,t,r){var n,s={},i=null,o=null;r!==void 0&&(i=""+r),t.key!==void 0&&(i=""+t.key),t.ref!==void 0&&(o=t.ref);for(n in t)dH.call(t,n)&&!fH.hasOwnProperty(n)&&(s[n]=t[n]);if(e&&e.defaultProps)for(n in t=e.defaultProps,t)s[n]===void 0&&(s[n]=t[n]);return{$$typeof:cH,type:e,key:i,ref:o,props:s,_owner:hH.current}}i0.Fragment=uH;i0.jsx=VR;i0.jsxs=VR;RR.exports=i0;var a=RR.exports,HR={exports:{}},Zn={},qR={exports:{}},GR={};/**
19 * @license React
20 * scheduler.production.min.js
21 *
22 * Copyright (c) Facebook, Inc. and its affiliates.
23 *
24 * This source code is licensed under the MIT license found in the
25 * LICENSE file in the root directory of this source tree.
26 */(function(e){function t(U,R){var Q=U.length;U.push(R);e:for(;0<Q;){var K=Q-1>>>1,z=U[K];if(0<s(z,R))U[K]=R,U[Q]=z,Q=K;else break e}}function r(U){return U.length===0?null:U[0]}function n(U){if(U.length===0)return null;var R=U[0],Q=U.pop();if(Q!==R){U[0]=Q;e:for(var K=0,z=U.length,N=z>>>1;K<N;){var T=2*(K+1)-1,$=U[T],V=T+1,q=U[V];if(0>s($,Q))V<z&&0>s(q,$)?(U[K]=q,U[V]=Q,K=V):(U[K]=$,U[T]=Q,K=T);else if(V<z&&0>s(q,Q))U[K]=q,U[V]=Q,K=V;else break e}}return R}function s(U,R){var Q=U.sortIndex-R.sortIndex;return Q!==0?Q:U.id-R.id}if(typeof performance=="object"&&typeof performance.now=="function"){var i=performance;e.unstable_now=function(){return i.now()}}else{var o=Date,l=o.now();e.unstable_now=function(){return o.now()-l}}var c=[],u=[],h=1,d=null,f=3,m=!1,g=!1,p=!1,v=typeof setTimeout=="function"?setTimeout:null,x=typeof clearTimeout=="function"?clearTimeout:null,b=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function w(U){for(var R=r(u);R!==null;){if(R.callback===null)n(u);else if(R.startTime<=U)n(u),R.sortIndex=R.expirationTime,t(c,R);else break;R=r(u)}}function j(U){if(p=!1,w(U),!g)if(r(c)!==null)g=!0,W(_);else{var R=r(u);R!==null&&D(j,R.startTime-U)}}function _(U,R){g=!1,p&&(p=!1,x(P),P=-1),m=!0;var Q=f;
vendor: 9,235 bytes, lines 26-35
26try{for(w(R),d=r(c);d!==null&&(!(d.expirationTime>R)||U&&!I());){var K=d.callback;if(typeof K=="function"){d.callback=null,f=d.priorityLevel;var z=K(d.expirationTime<=R);R=e.unstable_now(),typeof z=="function"?d.callback=z:d===r(c)&&n(c),w(R)}else n(c);d=r(c)}if(d!==null)var N=!0;else{var T=r(u);T!==null&&D(j,T.startTime-R),N=!1}return N}finally{d=null,f=Q,m=!1}}var S=!1,k=null,P=-1,C=5,M=-1;function I(){return!(e.unstable_now()-M<C)}function E(){if(k!==null){var U=e.unstable_now();M=U;var R=!0;try{R=k(!0,U)}finally{R?B():(S=!1,k=null)}}else S=!1}var B;if(typeof b=="function")B=function(){b(E)};else if(typeof MessageChannel<"u"){var A=new MessageChannel,L=A.port2;A.port1.onmessage=E,B=function(){L.postMessage(null)}}else B=function(){v(E,0)};function W(U){k=U,S||(S=!0,B())}function D(U,R){P=v(function(){U(e.unstable_now())},R)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(U){U.callback=null},e.unstable_continueExecution=function(){g||m||(g=!0,W(_))},e.unstable_forceFrameRate=function(U){0>U||125<U?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):C=0<U?Math.floor(1e3/U):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_getFirstCallbackNode=function(){return r(c)},e.unstable_next=function(U){switch(f){case 1:case 2:case 3:var R=3;break;default:R=f}var Q=f;f=R;try{return U()}finally{f=Q}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(U,R){switch(U){case 1:case 2:case 3:case 4:case 5:break;default:U=3}var Q=f;f=U;try{return R()}finally{f=Q}},e.unstable_scheduleCallback=function(U,R,Q){var K=e.unstable_now();switch(typeof Q=="object"&&Q!==null?(Q=Q.delay,Q=typeof Q=="number"&&0<Q?K+Q:K):Q=K,U){case 1:var z=-1;break;case 2:z=250;break;case 5:z=1073741823;break;case 4:z=1e4;break;default:z=5e3}return z=Q+z,U={id:h++,callback:R,priorityLevel:U,startTime:Q,expirationTime:z,sortIndex:-1},Q>K?(U.sortIndex=Q,t(u,U),r(c)===null&&U===r(u)&&(p?(x(P),P=-1):p=!0,D(j,Q-K))):(U.sortIndex=z,t(c,U),g||m||(g=!0,W(_))),U},e.unstable_shouldYield=I,e.unstable_wrapCallback=function(U){var R=f;return function(){var Q=f;f=R;try{return U.apply(this,arguments)}finally{f=Q}}}})(GR);qR.exports=GR;var mH=qR.exports;/**
27 * @license React
28 * react-dom.production.min.js
29 *
30 * Copyright (c) Facebook, Inc. and its affiliates.
31 *
32 * This source code is licensed under the MIT license found in the
33 * LICENSE file in the root directory of this source tree.
34 */var pH=y,Yn=mH;function ve(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,r=1;r<arguments.length;r++)t+="&args[]="+encodeURIComponent(arguments[r]);return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var KR=new Set,Uf={};function Sc(e,t){od(e,t),od(e+"Capture",t)}function od(e,t){for(Uf[e]=t,e=0;e<t.length;e++)KR.add(t[e])}var Ai=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),xj=Object.prototype.hasOwnProperty,gH=/^[: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]*$/,XE={},QE={};function yH(e){return xj.call(QE,e)?!0:xj.call(XE,e)?!1:gH.test(e)?QE[e]=!0:(XE[e]=!0,!1)}function vH(e,t,r,n){if(r!==null&&r.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return n?!1:r!==null?!r.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function xH(e,t,r,n){if(t===null||typeof t>"u"||vH(e,t,r,n))return!0;if(n)return!1;if(r!==null)switch(r.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function dn(e,t,r,n,s,i,o){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=n,this.attributeNamespace=s,this.mustUseProperty=r,this.propertyName=e,this.type=t,this.sanitizeURL=i,this.removeEmptyString=o}var zr={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){zr[e]=new dn(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];zr[t]=new dn(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){zr[e]=new dn(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){zr[e]=new dn(e,2,!1,e,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(e){zr[e]=new dn(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){zr[e]=new dn(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){zr[e]=new dn(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){zr[e]=new dn(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){zr[e]=new dn(e,5,!1,e.toLowerCase(),null,!1,!1)});var ik=/[\-:]([a-z])/g;function ok(e){return e[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(e){var t=e.replace(ik,ok);zr[t]=new dn(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(ik,ok);zr[t]=new dn(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(ik,ok);zr[t]=new dn(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){zr[e]=new dn(e,1,!1,e.toLowerCase(),null,!1,!1)});zr.xlinkHref=new dn("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){zr[e]=new dn(e,1,!1,e.toLowerCase(),null,!0,!0)});function lk(e,t,r,n){var s=zr.hasOwnProperty(t)?zr[t]:null;(s!==null?s.type!==0:n||!(2<t.length)||t[0]!=="o"&&t[0]!=="O"||t[1]!=="n"&&t[1]!=="N")&&(xH(t,r,s,n)&&(r=null),n||s===null?yH(t)&&(r===null?e.removeAttribute(t):e.setAttribute(t,""+r)):s.mustUseProperty?e[s.propertyName]=r===null?s.type===3?!1:"":r:(t=s.attributeName,n=s.attributeNamespace,r===null?e.removeAttribute(t):(s=s.type,r=s===3||s===4&&r===!0?"":""+r,n?e.setAttributeNS(n,t,r):e.setAttribute(t,r))))}var Wi=pH.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,ag=Symbol.for("react.element"),du=Symbol.for("react.portal"),hu=Symbol.for("react.fragment"),ck=Symbol.for("react.strict_mode"),bj=Symbol.for("react.profiler"),YR=Symbol.for("react.provider"),XR=Symbol.for("react.context"),uk=Symbol.for("react.forward_ref"),wj=Symbol.for("react.suspense"),jj=Symbol.for("react.suspense_list"),dk=Symbol.for("react.memo"),co=Symbol.for("react.lazy"),QR=Symbol.for("react.offscreen"),JE=Symbol.iterator;function Eh(e){return e===null||typeof e!="object"?null:(e=JE&&e[JE]||e["@@iterator"],typeof e=="function"?e:null)}var Wt=Object.assign,gw;function nf(e){if(gw===void 0)try{throw Error()}catch(r){var t=r.stack.trim().match(/\n( *(at )?)/);gw=t&&t[1]||""}return`
35`+gw+e}var yw=!1;function vw(e,t){if(!e||yw)return"";yw=!0;var r=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(t)if(t=function(){throw Error()},Object.defineProperty(t.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(t,[])}catch(u){var n=u}Reflect.construct(e,[],t)}else{try{t.call()}catch(u){n=u}e.call(t.prototype)}else{try{throw Error()}catch(u){n=u}e()}}
vendor: 14,106 bytes, lines 35-38
35catch(u){if(u&&n&&typeof u.stack=="string"){for(var s=u.stack.split(`
36`),i=n.stack.split(`
37`),o=s.length-1,l=i.length-1;1<=o&&0<=l&&s[o]!==i[l];)l--;for(;1<=o&&0<=l;o--,l--)if(s[o]!==i[l]){if(o!==1||l!==1)do if(o--,l--,0>l||s[o]!==i[l]){var c=`
38`+s[o].replace(" at new "," at ");return e.displayName&&c.includes("<anonymous>")&&(c=c.replace("<anonymous>",e.displayName)),c}while(1<=o&&0<=l);break}}}finally{yw=!1,Error.prepareStackTrace=r}return(e=e?e.displayName||e.name:"")?nf(e):""}function bH(e){switch(e.tag){case 5:return nf(e.type);case 16:return nf("Lazy");case 13:return nf("Suspense");case 19:return nf("SuspenseList");case 0:case 2:case 15:return e=vw(e.type,!1),e;case 11:return e=vw(e.type.render,!1),e;case 1:return e=vw(e.type,!0),e;default:return""}}function _j(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case hu:return"Fragment";case du:return"Portal";case bj:return"Profiler";case ck:return"StrictMode";case wj:return"Suspense";case jj:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case XR:return(e.displayName||"Context")+".Consumer";case YR:return(e._context.displayName||"Context")+".Provider";case uk:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case dk:return t=e.displayName||null,t!==null?t:_j(e.type)||"Memo";case co:t=e._payload,e=e._init;try{return _j(e(t))}catch{}}return null}function wH(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return _j(t);case 8:return t===ck?"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 t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function Ko(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function JR(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function jH(e){var t=JR(e)?"checked":"value",r=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),n=""+e[t];if(!e.hasOwnProperty(t)&&typeof r<"u"&&typeof r.get=="function"&&typeof r.set=="function"){var s=r.get,i=r.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return s.call(this)},set:function(o){n=""+o,i.call(this,o)}}),Object.defineProperty(e,t,{enumerable:r.enumerable}),{getValue:function(){return n},setValue:function(o){n=""+o},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function sg(e){e._valueTracker||(e._valueTracker=jH(e))}function ZR(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var r=t.getValue(),n="";return e&&(n=JR(e)?e.checked?"true":"false":e.value),e=n,e!==r?(t.setValue(e),!0):!1}function Qy(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function Sj(e,t){var r=t.checked;return Wt({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:r??e._wrapperState.initialChecked})}function ZE(e,t){var r=t.defaultValue==null?"":t.defaultValue,n=t.checked!=null?t.checked:t.defaultChecked;r=Ko(t.value!=null?t.value:r),e._wrapperState={initialChecked:n,initialValue:r,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function e$(e,t){t=t.checked,t!=null&&lk(e,"checked",t,!1)}function Nj(e,t){e$(e,t);var r=Ko(t.value),n=t.type;if(r!=null)n==="number"?(r===0&&e.value===""||e.value!=r)&&(e.value=""+r):e.value!==""+r&&(e.value=""+r);else if(n==="submit"||n==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?kj(e,t.type,r):t.hasOwnProperty("defaultValue")&&kj(e,t.type,Ko(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function eT(e,t,r){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var n=t.type;if(!(n!=="submit"&&n!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,r||t===e.value||(e.value=t),e.defaultValue=t}r=e.name,r!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,r!==""&&(e.name=r)}function kj(e,t,r){(t!=="number"||Qy(e.ownerDocument)!==e)&&(r==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+r&&(e.defaultValue=""+r))}var af=Array.isArray;function Tu(e,t,r,n){if(e=e.options,t){t={};for(var s=0;s<r.length;s++)t["$"+r[s]]=!0;for(r=0;r<e.length;r++)s=t.hasOwnProperty("$"+e[r].value),e[r].selected!==s&&(e[r].selected=s),s&&n&&(e[r].defaultSelected=!0)}else{for(r=""+Ko(r),t=null,s=0;s<e.length;s++){if(e[s].value===r){e[s].selected=!0,n&&(e[s].defaultSelected=!0);return}t!==null||e[s].disabled||(t=e[s])}t!==null&&(t.selected=!0)}}function Cj(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(ve(91));return Wt({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function tT(e,t){var r=t.value;if(r==null){if(r=t.children,t=t.defaultValue,r!=null){if(t!=null)throw Error(ve(92));if(af(r)){if(1<r.length)throw Error(ve(93));r=r[0]}t=r}t==null&&(t=""),r=t}e._wrapperState={initialValue:Ko(r)}}function t$(e,t){var r=Ko(t.value),n=Ko(t.defaultValue);r!=null&&(r=""+r,r!==e.value&&(e.value=r),t.defaultValue==null&&e.defaultValue!==r&&(e.defaultValue=r)),n!=null&&(e.defaultValue=""+n)}function rT(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==""&&t!==null&&(e.value=t)}function r$(e){switch(e){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 Ej(e,t){return e==null||e==="http://www.w3.org/1999/xhtml"?r$(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var ig,n$=function(e){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(t,r,n,s){MSApp.execUnsafeLocalFunction(function(){return e(t,r,n,s)})}:e}(function(e,t){if(e.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in e)e.innerHTML=t;else{for(ig=ig||document.createElement("div"),ig.innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=ig.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Wf(e,t){if(t){var r=e.firstChild;if(r&&r===e.lastChild&&r.nodeType===3){r.nodeValue=t;return}}e.textContent=t}var yf={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},_H=["Webkit","ms","Moz","O"];Object.keys(yf).forEach(function(e){_H.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),yf[t]=yf[e]})});function a$(e,t,r){return t==null||typeof t=="boolean"||t===""?"":r||typeof t!="number"||t===0||yf.hasOwnProperty(e)&&yf[e]?(""+t).trim():t+"px"}function s$(e,t){e=e.style;for(var r in t)if(t.hasOwnProperty(r)){var n=r.indexOf("--")===0,s=a$(r,t[r],n);r==="float"&&(r="cssFloat"),n?e.setProperty(r,s):e[r]=s}}var SH=Wt({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 Tj(e,t){if(t){if(SH[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(ve(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(ve(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(ve(61))}if(t.style!=null&&typeof t.style!="object")throw Error(ve(62))}}function Aj(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){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 Pj=null;function hk(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Oj=null,Au=null,Pu=null;function nT(e){if(e=_p(e)){if(typeof Oj!="function")throw Error(ve(280));var t=e.stateNode;t&&(t=h0(t),Oj(e.stateNode,e.type,t))}}function i$(e){Au?Pu?Pu.push(e):Pu=[e]:Au=e}function o$(){if(Au){var e=Au,t=Pu;if(Pu=Au=null,nT(e),t)for(e=0;e<t.length;e++)nT(t[e])}}function l$(e,t){return e(t)}function c$(){}var xw=!1;function u$(e,t,r){if(xw)return e(t,r);xw=!0;try{return l$(e,t,r)}finally{xw=!1,(Au!==null||Pu!==null)&&(c$(),o$())}}function Vf(e,t){var r=e.stateNode;if(r===null)return null;var n=h0(r);if(n===null)return null;r=n[t];e:switch(t){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)||(e=e.type,n=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!n;break e;default:e=!1}if(e)return null;if(r&&typeof r!="function")throw Error(ve(231,t,typeof r));return r}var Mj=!1;if(Ai)try{var Th={};Object.defineProperty(Th,"passive",{get:function(){Mj=!0}}),window.addEventListener("test",Th,Th),window.removeEventListener("test",Th,Th)}catch{Mj=!1}function NH(e,t,r,n,s,i,o,l,c){var u=Array.prototype.slice.call(arguments,3);try{t.apply(r,u)}catch(h){this.onError(h)}}var vf=!1,Jy=null,Zy=!1,Rj=null,kH={onError:function(e){vf=!0,Jy=e}};function CH(e,t,r,n,s,i,o,l,c){vf=!1,Jy=null,NH.apply(kH,arguments)}function EH(e,t,r,n,s,i,o,l,c){if(CH.apply(this,arguments),vf){if(vf){var u=Jy;vf=!1,Jy=null}else throw Error(ve(198));Zy||(Zy=!0,Rj=u)}}function Nc(e){var t=e,r=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(r=t.return),e=t.return;while(e)}return t.tag===3?r:null}function d$(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function aT(e){if(Nc(e)!==e)throw Error(ve(188))}function TH(e){var t=e.alternate;if(!t){if(t=Nc(e),t===null)throw Error(ve(188));return t!==e?null:e}for(var r=e,n=t;;){var s=r.return;if(s===null)break;var i=s.alternate;if(i===null){if(n=s.return,n!==null){r=n;continue}break}if(s.child===i.child){for(i=s.child;i;){if(i===r)return aT(s),e;if(i===n)return aT(s),t;i=i.sibling}throw Error(ve(188))}if(r.return!==n.return)r=s,n=i;else{for(var o=!1,l=s.child;l;){if(l===r){o=!0,r=s,n=i;break}if(l===n){o=!0,n=s,r=i;break}l=l.sibling}if(!o){for(l=i.child;l;){if(l===r){o=!0,r=i,n=s;break}if(l===n){o=!0,n=i,r=s;break}l=l.sibling}if(!o)throw Error(ve(189))}}if(r.alternate!==n)throw Error(ve(190))}if(r.tag!==3)throw Error(ve(188));return r.stateNode.current===r?e:t}function h$(e){return e=TH(e),e!==null?f$(e):null}function f$(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=f$(e);if(t!==null)return t;e=e.sibling}return null}var m$=Yn.unstable_scheduleCallback,sT=Yn.unstable_cancelCallback,AH=Yn.unstable_shouldYield,PH=Yn.unstable_requestPaint,er=Yn.unstable_now,OH=Yn.unstable_getCurrentPriorityLevel,fk=Yn.unstable_ImmediatePriority,p$=Yn.unstable_UserBlockingPriority,ev=Yn.unstable_NormalPriority,MH=Yn.unstable_LowPriority,g$=Yn.unstable_IdlePriority,l0=null,Bs=null;function RH(e){if(Bs&&typeof Bs.onCommitFiberRoot=="function")try{Bs.onCommitFiberRoot(l0,e,void 0,(e.current.flags&128)===128)}catch{}}var es=Math.clz32?Math.clz32:DH,$H=Math.log,IH=Math.LN2;function DH(e){return e>>>=0,e===0?32:31-($H(e)/IH|0)|0}var og=64,lg=4194304;function sf(e){switch(e&-e){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 e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function tv(e,t){var r=e.pendingLanes;if(r===0)return 0;var n=0,s=e.suspendedLanes,i=e.pingedLanes,o=r&268435455;if(o!==0){var l=o&~s;l!==0?n=sf(l):(i&=o,i!==0&&(n=sf(i)))}else o=r&~s,o!==0?n=sf(o):i!==0&&(n=sf(i));if(n===0)return 0;if(t!==0&&t!==n&&!(t&s)&&(s=n&-n,i=t&-t,s>=i||s===16&&(i&4194240)!==0))return t;if(n&4&&(n|=r&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=n;0<t;)r=31-es(t),s=1<<r,n|=e[r],t&=~s;return n}function LH(e,t){switch(e){case 1:case 2:case 4:return t+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 t+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 FH(e,t){for(var r=e.suspendedLanes,n=e.pingedLanes,s=e.expirationTimes,i=e.pendingLanes;0<i;){var o=31-es(i),l=1<<o,c=s[o];c===-1?(!(l&r)||l&n)&&(s[o]=LH(l,t)):c<=t&&(e.expiredLanes|=l),i&=~l}}function $j(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function y$(){var e=og;return og<<=1,!(og&4194240)&&(og=64),e}function bw(e){for(var t=[],r=0;31>r;r++)t.push(e);return t}
vendor: 4,087 bytes, line 38
38function wp(e,t,r){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-es(t),e[t]=r}function zH(e,t){var r=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var n=e.eventTimes;for(e=e.expirationTimes;0<r;){var s=31-es(r),i=1<<s;t[s]=0,n[s]=-1,e[s]=-1,r&=~i}}function mk(e,t){var r=e.entangledLanes|=t;for(e=e.entanglements;r;){var n=31-es(r),s=1<<n;s&t|e[n]&t&&(e[n]|=t),r&=~s}}var ft=0;function v$(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var x$,pk,b$,w$,j$,Ij=!1,cg=[],Mo=null,Ro=null,$o=null,Hf=new Map,qf=new Map,go=[],BH="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 iT(e,t){switch(e){case"focusin":case"focusout":Mo=null;break;case"dragenter":case"dragleave":Ro=null;break;case"mouseover":case"mouseout":$o=null;break;case"pointerover":case"pointerout":Hf.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":qf.delete(t.pointerId)}}function Ah(e,t,r,n,s,i){return e===null||e.nativeEvent!==i?(e={blockedOn:t,domEventName:r,eventSystemFlags:n,nativeEvent:i,targetContainers:[s]},t!==null&&(t=_p(t),t!==null&&pk(t)),e):(e.eventSystemFlags|=n,t=e.targetContainers,s!==null&&t.indexOf(s)===-1&&t.push(s),e)}function UH(e,t,r,n,s){switch(t){case"focusin":return Mo=Ah(Mo,e,t,r,n,s),!0;case"dragenter":return Ro=Ah(Ro,e,t,r,n,s),!0;case"mouseover":return $o=Ah($o,e,t,r,n,s),!0;case"pointerover":var i=s.pointerId;return Hf.set(i,Ah(Hf.get(i)||null,e,t,r,n,s)),!0;case"gotpointercapture":return i=s.pointerId,qf.set(i,Ah(qf.get(i)||null,e,t,r,n,s)),!0}return!1}function _$(e){var t=$l(e.target);if(t!==null){var r=Nc(t);if(r!==null){if(t=r.tag,t===13){if(t=d$(r),t!==null){e.blockedOn=t,j$(e.priority,function(){b$(r)});return}}else if(t===3&&r.stateNode.current.memoizedState.isDehydrated){e.blockedOn=r.tag===3?r.stateNode.containerInfo:null;return}}}e.blockedOn=null}function wy(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var r=Dj(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(r===null){r=e.nativeEvent;var n=new r.constructor(r.type,r);Pj=n,r.target.dispatchEvent(n),Pj=null}else return t=_p(r),t!==null&&pk(t),e.blockedOn=r,!1;t.shift()}return!0}function oT(e,t,r){wy(e)&&r.delete(t)}function WH(){Ij=!1,Mo!==null&&wy(Mo)&&(Mo=null),Ro!==null&&wy(Ro)&&(Ro=null),$o!==null&&wy($o)&&($o=null),Hf.forEach(oT),qf.forEach(oT)}function Ph(e,t){e.blockedOn===t&&(e.blockedOn=null,Ij||(Ij=!0,Yn.unstable_scheduleCallback(Yn.unstable_NormalPriority,WH)))}function Gf(e){function t(s){return Ph(s,e)}if(0<cg.length){Ph(cg[0],e);for(var r=1;r<cg.length;r++){var n=cg[r];n.blockedOn===e&&(n.blockedOn=null)}}for(Mo!==null&&Ph(Mo,e),Ro!==null&&Ph(Ro,e),$o!==null&&Ph($o,e),Hf.forEach(t),qf.forEach(t),r=0;r<go.length;r++)n=go[r],n.blockedOn===e&&(n.blockedOn=null);for(;0<go.length&&(r=go[0],r.blockedOn===null);)_$(r),r.blockedOn===null&&go.shift()}var Ou=Wi.ReactCurrentBatchConfig,rv=!0;function VH(e,t,r,n){var s=ft,i=Ou.transition;Ou.transition=null;try{ft=1,gk(e,t,r,n)}finally{ft=s,Ou.transition=i}}function HH(e,t,r,n){var s=ft,i=Ou.transition;Ou.transition=null;try{ft=4,gk(e,t,r,n)}finally{ft=s,Ou.transition=i}}function gk(e,t,r,n){if(rv){var s=Dj(e,t,r,n);if(s===null)Aw(e,t,n,nv,r),iT(e,n);else if(UH(s,e,t,r,n))n.stopPropagation();else if(iT(e,n),t&4&&-1<BH.indexOf(e)){for(;s!==null;){var i=_p(s);if(i!==null&&x$(i),i=Dj(e,t,r,n),i===null&&Aw(e,t,n,nv,r),i===s)break;s=i}s!==null&&n.stopPropagation()}else Aw(e,t,n,null,r)}}var nv=null;function Dj(e,t,r,n){if(nv=null,e=hk(n),e=$l(e),e!==null)if(t=Nc(e),t===null)e=null;else if(r=t.tag,r===13){if(e=d$(t),e!==null)return e;e=null}else if(r===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null);return nv=e,null}
vendor: 10,401 bytes, line 38
38function S$(e){switch(e){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(OH()){case fk:return 1;case p$:return 4;case ev:case MH:return 16;case g$:return 536870912;default:return 16}default:return 16}}var Eo=null,yk=null,jy=null;function N$(){if(jy)return jy;var e,t=yk,r=t.length,n,s="value"in Eo?Eo.value:Eo.textContent,i=s.length;for(e=0;e<r&&t[e]===s[e];e++);var o=r-e;for(n=1;n<=o&&t[r-n]===s[i-n];n++);return jy=s.slice(e,1<n?1-n:void 0)}function _y(e){var t=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function ug(){return!0}function lT(){return!1}function ea(e){function t(r,n,s,i,o){this._reactName=r,this._targetInst=s,this.type=n,this.nativeEvent=i,this.target=o,this.currentTarget=null;for(var l in e)e.hasOwnProperty(l)&&(r=e[l],this[l]=r?r(i):i[l]);return this.isDefaultPrevented=(i.defaultPrevented!=null?i.defaultPrevented:i.returnValue===!1)?ug:lT,this.isPropagationStopped=lT,this}return Wt(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var r=this.nativeEvent;r&&(r.preventDefault?r.preventDefault():typeof r.returnValue!="unknown"&&(r.returnValue=!1),this.isDefaultPrevented=ug)},stopPropagation:function(){var r=this.nativeEvent;r&&(r.stopPropagation?r.stopPropagation():typeof r.cancelBubble!="unknown"&&(r.cancelBubble=!0),this.isPropagationStopped=ug)},persist:function(){},isPersistent:ug}),t}var Jd={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},vk=ea(Jd),jp=Wt({},Jd,{view:0,detail:0}),qH=ea(jp),ww,jw,Oh,c0=Wt({},jp,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:xk,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==Oh&&(Oh&&e.type==="mousemove"?(ww=e.screenX-Oh.screenX,jw=e.screenY-Oh.screenY):jw=ww=0,Oh=e),ww)},movementY:function(e){return"movementY"in e?e.movementY:jw}}),cT=ea(c0),GH=Wt({},c0,{dataTransfer:0}),KH=ea(GH),YH=Wt({},jp,{relatedTarget:0}),_w=ea(YH),XH=Wt({},Jd,{animationName:0,elapsedTime:0,pseudoElement:0}),QH=ea(XH),JH=Wt({},Jd,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),ZH=ea(JH),eq=Wt({},Jd,{data:0}),uT=ea(eq),tq={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},rq={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"},nq={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function aq(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=nq[e])?!!t[e]:!1}function xk(){return aq}var sq=Wt({},jp,{key:function(e){if(e.key){var t=tq[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=_y(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?rq[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:xk,charCode:function(e){return e.type==="keypress"?_y(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?_y(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),iq=ea(sq),oq=Wt({},c0,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),dT=ea(oq),lq=Wt({},jp,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:xk}),cq=ea(lq),uq=Wt({},Jd,{propertyName:0,elapsedTime:0,pseudoElement:0}),dq=ea(uq),hq=Wt({},c0,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),fq=ea(hq),mq=[9,13,27,32],bk=Ai&&"CompositionEvent"in window,xf=null;Ai&&"documentMode"in document&&(xf=document.documentMode);var pq=Ai&&"TextEvent"in window&&!xf,k$=Ai&&(!bk||xf&&8<xf&&11>=xf),hT=" ",fT=!1;function C$(e,t){switch(e){case"keyup":return mq.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function E$(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var fu=!1;function gq(e,t){switch(e){case"compositionend":return E$(t);case"keypress":return t.which!==32?null:(fT=!0,hT);case"textInput":return e=t.data,e===hT&&fT?null:e;default:return null}}function yq(e,t){if(fu)return e==="compositionend"||!bk&&C$(e,t)?(e=N$(),jy=yk=Eo=null,fu=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return k$&&t.locale!=="ko"?null:t.data;default:return null}}var vq={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 mT(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!vq[e.type]:t==="textarea"}function T$(e,t,r,n){i$(n),t=av(t,"onChange"),0<t.length&&(r=new vk("onChange","change",null,r,n),e.push({event:r,listeners:t}))}var bf=null,Kf=null;function xq(e){z$(e,0)}function u0(e){var t=gu(e);if(ZR(t))return e}function bq(e,t){if(e==="change")return t}var A$=!1;if(Ai){var Sw;if(Ai){var Nw="oninput"in document;if(!Nw){var pT=document.createElement("div");pT.setAttribute("oninput","return;"),Nw=typeof pT.oninput=="function"}Sw=Nw}else Sw=!1;A$=Sw&&(!document.documentMode||9<document.documentMode)}function gT(){bf&&(bf.detachEvent("onpropertychange",P$),Kf=bf=null)}function P$(e){if(e.propertyName==="value"&&u0(Kf)){var t=[];T$(t,Kf,e,hk(e)),u$(xq,t)}}function wq(e,t,r){e==="focusin"?(gT(),bf=t,Kf=r,bf.attachEvent("onpropertychange",P$)):e==="focusout"&&gT()}function jq(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return u0(Kf)}function _q(e,t){if(e==="click")return u0(t)}function Sq(e,t){if(e==="input"||e==="change")return u0(t)}function Nq(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var rs=typeof Object.is=="function"?Object.is:Nq;function Yf(e,t){if(rs(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var r=Object.keys(e),n=Object.keys(t);if(r.length!==n.length)return!1;for(n=0;n<r.length;n++){var s=r[n];if(!xj.call(t,s)||!rs(e[s],t[s]))return!1}return!0}function yT(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function vT(e,t){var r=yT(e);e=0;for(var n;r;){if(r.nodeType===3){if(n=e+r.textContent.length,e<=t&&n>=t)return{node:r,offset:t-e};e=n}e:{for(;r;){if(r.nextSibling){r=r.nextSibling;break e}r=r.parentNode}r=void 0}r=yT(r)}}function O$(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?O$(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function M$(){for(var e=window,t=Qy();t instanceof e.HTMLIFrameElement;){try{var r=typeof t.contentWindow.location.href=="string"}catch{r=!1}if(r)e=t.contentWindow;else break;t=Qy(e.document)}return t}function wk(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function kq(e){var t=M$(),r=e.focusedElem,n=e.selectionRange;if(t!==r&&r&&r.ownerDocument&&O$(r.ownerDocument.documentElement,r)){if(n!==null&&wk(r)){if(t=n.start,e=n.end,e===void 0&&(e=t),"selectionStart"in r)r.selectionStart=t,r.selectionEnd=Math.min(e,r.value.length);else if(e=(t=r.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var s=r.textContent.length,i=Math.min(n.start,s);n=n.end===void 0?i:Math.min(n.end,s),!e.extend&&i>n&&(s=n,n=i,i=s),s=vT(r,i);var o=vT(r,n);s&&o&&(e.rangeCount!==1||e.anchorNode!==s.node||e.anchorOffset!==s.offset||e.focusNode!==o.node||e.focusOffset!==o.offset)&&(t=t.createRange(),t.setStart(s.node,s.offset),e.removeAllRanges(),i>n?(e.addRange(t),e.extend(o.node,o.offset)):(t.setEnd(o.node,o.offset),e.addRange(t)))}}for(t=[],e=r;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof r.focus=="function"&&r.focus(),r=0;r<t.length;r++)e=t[r],e.element.scrollLeft=e.left,e.element.scrollTop=e.top}}var Cq=Ai&&"documentMode"in document&&11>=document.documentMode,mu=null,Lj=null,wf=null,Fj=!1;function xT(e,t,r){var n=r.window===r?r.document:r.nodeType===9?r:r.ownerDocument;Fj||mu==null||mu!==Qy(n)||(n=mu,"selectionStart"in n&&wk(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 38
38sNode:n.focusNode,focusOffset:n.focusOffset}),wf&&Yf(wf,n)||(wf=n,n=av(Lj,"onSelect"),0<n.length&&(t=new vk("onSelect","select",null,t,r),e.push({event:t,listeners:n}),t.target=mu)))}function dg(e,t){var r={};return r[e.toLowerCase()]=t.toLowerCase(),r["Webkit"+e]="webkit"+t,r["Moz"+e]="moz"+t,r}var pu={animationend:dg("Animation","AnimationEnd"),animationiteration:dg("Animation","AnimationIteration"),animationstart:dg("Animation","AnimationStart"),transitionend:dg("Transition","TransitionEnd")},kw={},R$={};Ai&&(R$=document.createElement("div").style,"AnimationEvent"in window||(delete pu.animationend.animation,delete pu.animationiteration.animation,delete pu.animationstart.animation),"TransitionEvent"in window||delete pu.transitionend.transition);function d0(e){if(kw[e])return kw[e];if(!pu[e])return e;var t=pu[e],r;for(r in t)if(t.hasOwnProperty(r)&&r in R$)return kw[e]=t[r];return e}var $$=d0("animationend"),I$=d0("animationiteration"),D$=d0("animationstart"),L$=d0("transitionend"),F$=new Map,bT="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 el(e,t){F$.set(e,t),Sc(t,[e])}for(var Cw=0;Cw<bT.length;Cw++){var Ew=bT[Cw],Eq=Ew.toLowerCase(),Tq=Ew[0].toUpperCase()+Ew.slice(1);el(Eq,"on"+Tq)}el($$,"onAnimationEnd");el(I$,"onAnimationIteration");el(D$,"onAnimationStart");el("dblclick","onDoubleClick");el("focusin","onFocus");el("focusout","onBlur");el(L$,"onTransitionEnd");od("onMouseEnter",["mouseout","mouseover"]);od("onMouseLeave",["mouseout","mouseover"]);od("onPointerEnter",["pointerout","pointerover"]);od("onPointerLeave",["pointerout","pointerover"]);Sc("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));Sc("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));Sc("onBeforeInput",["compositionend","keypress","textInput","paste"]);Sc("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));Sc("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));Sc("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var of="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(" "),Aq=new Set("cancel close invalid load scroll toggle".split(" ").concat(of));function wT(e,t,r){var n=e.type||"unknown-event";e.currentTarget=r,EH(n,t,void 0,e),e.currentTarget=null}function z$(e,t){t=(t&4)!==0;for(var r=0;r<e.length;r++){var n=e[r],s=n.event;n=n.listeners;e:{var i=void 0;if(t)for(var o=n.length-1;0<=o;o--){var l=n[o],c=l.instance,u=l.currentTarget;if(l=l.listener,c!==i&&s.isPropagationStopped())break e;wT(s,l,u),i=c}else for(o=0;o<n.length;o++){if(l=n[o],c=l.instance,u=l.currentTarget,l=l.listener,c!==i&&s.isPropagationStopped())break e;wT(s,l,u),i=c}}}if(Zy)throw e=Rj,Zy=!1,Rj=null,e}function Ot(e,t){var r=t[Vj];r===void 0&&(r=t[Vj]=new Set);var n=e+"__bubble";r.has(n)||(B$(t,e,2,!1),r.add(n))}function Tw(e,t,r){var n=0;t&&(n|=4),B$(r,e,n,t)}var hg="_reactListening"+Math.random().toString(36).slice(2);function Xf(e){if(!e[hg]){e[hg]=!0,KR.forEach(function(r){r!=="selectionchange"&&(Aq.has(r)||Tw(r,!1,e),Tw(r,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[hg]||(t[hg]=!0,Tw("selectionchange",!1,t))}}function B$(e,t,r,n){switch(S$(t)){case 1:var s=VH;break;case 4:s=HH;break;default:s=gk}r=s.bind(null,t,r,e),s=void 0,!Mj||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(s=!0),n?s!==void 0?e.addEventListener(t,r,{capture:!0,passive:s}):e.addEventListener(t,r,!0):s!==void 0?e.addEventListener(t,r,{passive:s}):e.addEventListener(t,r,!1)}function Aw(e,t,r,n,s){var i=n;
vendor: 22,759 bytes, lines 38-39
38if(!(t&1)&&!(t&2)&&n!==null)e:for(;;){if(n===null)return;var o=n.tag;if(o===3||o===4){var l=n.stateNode.containerInfo;if(l===s||l.nodeType===8&&l.parentNode===s)break;if(o===4)for(o=n.return;o!==null;){var c=o.tag;if((c===3||c===4)&&(c=o.stateNode.containerInfo,c===s||c.nodeType===8&&c.parentNode===s))return;o=o.return}for(;l!==null;){if(o=$l(l),o===null)return;if(c=o.tag,c===5||c===6){n=i=o;continue e}l=l.parentNode}}n=n.return}u$(function(){var u=i,h=hk(r),d=[];e:{var f=F$.get(e);if(f!==void 0){var m=vk,g=e;switch(e){case"keypress":if(_y(r)===0)break e;case"keydown":case"keyup":m=iq;break;case"focusin":g="focus",m=_w;break;case"focusout":g="blur",m=_w;break;case"beforeblur":case"afterblur":m=_w;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":m=cT;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":m=KH;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":m=cq;break;case $$:case I$:case D$:m=QH;break;case L$:m=dq;break;case"scroll":m=qH;break;case"wheel":m=fq;break;case"copy":case"cut":case"paste":m=ZH;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":m=dT}var p=(t&4)!==0,v=!p&&e==="scroll",x=p?f!==null?f+"Capture":null:f;p=[];for(var b=u,w;b!==null;){w=b;var j=w.stateNode;if(w.tag===5&&j!==null&&(w=j,x!==null&&(j=Vf(b,x),j!=null&&p.push(Qf(b,j,w)))),v)break;b=b.return}0<p.length&&(f=new m(f,g,null,r,h),d.push({event:f,listeners:p}))}}if(!(t&7)){e:{if(f=e==="mouseover"||e==="pointerover",m=e==="mouseout"||e==="pointerout",f&&r!==Pj&&(g=r.relatedTarget||r.fromElement)&&($l(g)||g[Pi]))break e;if((m||f)&&(f=h.window===h?h:(f=h.ownerDocument)?f.defaultView||f.parentWindow:window,m?(g=r.relatedTarget||r.toElement,m=u,g=g?$l(g):null,g!==null&&(v=Nc(g),g!==v||g.tag!==5&&g.tag!==6)&&(g=null)):(m=null,g=u),m!==g)){if(p=cT,j="onMouseLeave",x="onMouseEnter",b="mouse",(e==="pointerout"||e==="pointerover")&&(p=dT,j="onPointerLeave",x="onPointerEnter",b="pointer"),v=m==null?f:gu(m),w=g==null?f:gu(g),f=new p(j,b+"leave",m,r,h),f.target=v,f.relatedTarget=w,j=null,$l(h)===u&&(p=new p(x,b+"enter",g,r,h),p.target=w,p.relatedTarget=v,j=p),v=j,m&&g)t:{for(p=m,x=g,b=0,w=p;w;w=Fc(w))b++;for(w=0,j=x;j;j=Fc(j))w++;for(;0<b-w;)p=Fc(p),b--;for(;0<w-b;)x=Fc(x),w--;for(;b--;){if(p===x||x!==null&&p===x.alternate)break t;p=Fc(p),x=Fc(x)}p=null}else p=null;m!==null&&jT(d,f,m,p,!1),g!==null&&v!==null&&jT(d,v,g,p,!0)}}e:{if(f=u?gu(u):window,m=f.nodeName&&f.nodeName.toLowerCase(),m==="select"||m==="input"&&f.type==="file")var _=bq;else if(mT(f))if(A$)_=Sq;else{_=jq;var S=wq}else(m=f.nodeName)&&m.toLowerCase()==="input"&&(f.type==="checkbox"||f.type==="radio")&&(_=_q);if(_&&(_=_(e,u))){T$(d,_,r,h);break e}S&&S(e,f,u),e==="focusout"&&(S=f._wrapperState)&&S.controlled&&f.type==="number"&&kj(f,"number",f.value)}switch(S=u?gu(u):window,e){case"focusin":(mT(S)||S.contentEditable==="true")&&(mu=S,Lj=u,wf=null);break;case"focusout":wf=Lj=mu=null;break;case"mousedown":Fj=!0;break;case"contextmenu":case"mouseup":case"dragend":Fj=!1,xT(d,r,h);break;case"selectionchange":if(Cq)break;case"keydown":case"keyup":xT(d,r,h)}var k;if(bk)e:{switch(e){case"compositionstart":var P="onCompositionStart";break e;case"compositionend":P="onCompositionEnd";break e;case"compositionupdate":P="onCompositionUpdate";break e}P=void 0}else fu?C$(e,r)&&(P="onCompositionEnd"):e==="keydown"&&r.keyCode===229&&(P="onCompositionStart");P&&(k$&&r.locale!=="ko"&&(fu||P!=="onCompositionStart"?P==="onCompositionEnd"&&fu&&(k=N$()):(Eo=h,yk="value"in Eo?Eo.value:Eo.textContent,fu=!0)),S=av(u,P),0<S.length&&(P=new uT(P,e,null,r,h),d.push({event:P,listeners:S}),k?P.data=k:(k=E$(r),k!==null&&(P.data=k)))),(k=pq?gq(e,r):yq(e,r))&&(u=av(u,"onBeforeInput"),0<u.length&&(h=new uT("onBeforeInput","beforeinput",null,r,h),d.push({event:h,listeners:u}),h.data=k))}z$(d,t)})}function Qf(e,t,r){return{instance:e,listener:t,currentTarget:r}}function av(e,t){for(var r=t+"Capture",n=[];e!==null;){var s=e,i=s.stateNode;s.tag===5&&i!==null&&(s=i,i=Vf(e,r),i!=null&&n.unshift(Qf(e,i,s)),i=Vf(e,t),i!=null&&n.push(Qf(e,i,s))),e=e.return}return n}function Fc(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function jT(e,t,r,n,s){for(var i=t._reactName,o=[];r!==null&&r!==n;){var l=r,c=l.alternate,u=l.stateNode;if(c!==null&&c===n)break;l.tag===5&&u!==null&&(l=u,s?(c=Vf(r,i),c!=null&&o.unshift(Qf(r,c,l))):s||(c=Vf(r,i),c!=null&&o.push(Qf(r,c,l)))),r=r.return}o.length!==0&&e.push({event:t,listeners:o})}var Pq=/\r\n?/g,Oq=/\u0000|\uFFFD/g;function _T(e){return(typeof e=="string"?e:""+e).replace(Pq,`
39`).replace(Oq,"")}function fg(e,t,r){if(t=_T(t),_T(e)!==t&&r)throw Error(ve(425))}function sv(){}var zj=null,Bj=null;function Uj(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var Wj=typeof setTimeout=="function"?setTimeout:void 0,Mq=typeof clearTimeout=="function"?clearTimeout:void 0,ST=typeof Promise=="function"?Promise:void 0,Rq=typeof queueMicrotask=="function"?queueMicrotask:typeof ST<"u"?function(e){return ST.resolve(null).then(e).catch($q)}:Wj;function $q(e){setTimeout(function(){throw e})}function Pw(e,t){var r=t,n=0;do{var s=r.nextSibling;if(e.removeChild(r),s&&s.nodeType===8)if(r=s.data,r==="/$"){if(n===0){e.removeChild(s),Gf(t);return}n--}else r!=="$"&&r!=="$?"&&r!=="$!"||n++;r=s}while(r);Gf(t)}function Io(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t==="$"||t==="$!"||t==="$?")break;if(t==="/$")return null}}return e}function NT(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var r=e.data;if(r==="$"||r==="$!"||r==="$?"){if(t===0)return e;t--}else r==="/$"&&t++}e=e.previousSibling}return null}var Zd=Math.random().toString(36).slice(2),$s="__reactFiber$"+Zd,Jf="__reactProps$"+Zd,Pi="__reactContainer$"+Zd,Vj="__reactEvents$"+Zd,Iq="__reactListeners$"+Zd,Dq="__reactHandles$"+Zd;function $l(e){var t=e[$s];if(t)return t;for(var r=e.parentNode;r;){if(t=r[Pi]||r[$s]){if(r=t.alternate,t.child!==null||r!==null&&r.child!==null)for(e=NT(e);e!==null;){if(r=e[$s])return r;e=NT(e)}return t}e=r,r=e.parentNode}return null}function _p(e){return e=e[$s]||e[Pi],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function gu(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(ve(33))}function h0(e){return e[Jf]||null}var Hj=[],yu=-1;function tl(e){return{current:e}}function $t(e){0>yu||(e.current=Hj[yu],Hj[yu]=null,yu--)}function Tt(e,t){yu++,Hj[yu]=e.current,e.current=t}var Yo={},Jr=tl(Yo),kn=tl(!1),ac=Yo;function ld(e,t){var r=e.type.contextTypes;if(!r)return Yo;var n=e.stateNode;if(n&&n.__reactInternalMemoizedUnmaskedChildContext===t)return n.__reactInternalMemoizedMaskedChildContext;var s={},i;for(i in r)s[i]=t[i];return n&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=s),s}function Cn(e){return e=e.childContextTypes,e!=null}function iv(){$t(kn),$t(Jr)}function kT(e,t,r){if(Jr.current!==Yo)throw Error(ve(168));Tt(Jr,t),Tt(kn,r)}function U$(e,t,r){var n=e.stateNode;if(t=t.childContextTypes,typeof n.getChildContext!="function")return r;n=n.getChildContext();for(var s in n)if(!(s in t))throw Error(ve(108,wH(e)||"Unknown",s));return Wt({},r,n)}function ov(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Yo,ac=Jr.current,Tt(Jr,e),Tt(kn,kn.current),!0}function CT(e,t,r){var n=e.stateNode;if(!n)throw Error(ve(169));r?(e=U$(e,t,ac),n.__reactInternalMemoizedMergedChildContext=e,$t(kn),$t(Jr),Tt(Jr,e)):$t(kn),Tt(kn,r)}var hi=null,f0=!1,Ow=!1;function W$(e){hi===null?hi=[e]:hi.push(e)}function Lq(e){f0=!0,W$(e)}function rl(){if(!Ow&&hi!==null){Ow=!0;var e=0,t=ft;try{var r=hi;for(ft=1;e<r.length;e++){var n=r[e];do n=n(!0);while(n!==null)}hi=null,f0=!1}catch(s){throw hi!==null&&(hi=hi.slice(e+1)),m$(fk,rl),s}finally{ft=t,Ow=!1}}return null}var vu=[],xu=0,lv=null,cv=0,la=[],ca=0,sc=null,mi=1,pi="";function Nl(e,t){vu[xu++]=cv,vu[xu++]=lv,lv=e,cv=t}function V$(e,t,r){la[ca++]=mi,la[ca++]=pi,la[ca++]=sc,sc=e;var n=mi;e=pi;var s=32-es(n)-1;n&=~(1<<s),r+=1;var i=32-es(t)+s;if(30<i){var o=s-s%5;i=(n&(1<<o)-1).toString(32),n>>=o,s-=o,mi=1<<32-es(t)+s|r<<s|n,pi=i+e}else mi=1<<i|r<<s|n,pi=e}function jk(e){e.return!==null&&(Nl(e,1),V$(e,1,0))}function _k(e){for(;e===lv;)lv=vu[--xu],vu[xu]=null,cv=vu[--xu],vu[xu]=null;for(;e===sc;)sc=la[--ca],la[ca]=null,pi=la[--ca],la[ca]=null,mi=la[--ca],la[ca]=null}var qn=null,Hn=null,Lt=!1,Ga=null;function H$(e,t){var r=ua(5,null,null,0);r.elementType="DELETED",r.stateNode=t,r.return=e,t=e.deletions,t===null?(e.deletions=[r],e.flags|=16):t.push(r)}function ET(e,t){switch(e.tag){case 5:var r=e.type;return t=t.nodeType!==1||r.toLowerCase()!==t.nodeName.toLowerCase()?null:t,t!==null?(e.stateNode=t,qn=e,Hn=Io(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,qn=e,Hn=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(r=sc!==null?{id:mi,overflow:pi}:null,e.memoizedState={dehydrated:t,treeContext:r,retryLane:1073741824},r=ua(18,null,null,0),r.stateNode=t,r.return=e,e.child=r,qn=e,Hn=null,!0):!1;default:return!1}}function qj(e){return(e.mode&1)!==0&&(e.flags&128)===0}function Gj(e){if(Lt){var t=Hn;if(t){var r=t;if(!ET(e,t)){if(qj(e))throw Error(ve(418));t=Io(r.nextSibling);var n=qn;t&&ET(e,t)?H$(n,r):(e.flags=e.flags&-4097|2,Lt=!1,qn=e)}}else{if(qj(e))throw Error(ve(418));e.flags=e.flags&-4097|2,Lt=!1,qn=e}}}function TT(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;qn=e}function mg(e){if(e!==qn)return!1;if(!Lt)return TT(e),Lt=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!=="head"&&t!=="body"&&!Uj(e.type,e.memoizedProps)),t&&(t=Hn)){if(qj(e))throw q$(),Error(ve(418));for(;t;)H$(e,t),t=Io(t.nextSibling)}if(TT(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(ve(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var r=e.data;if(r==="/$"){if(t===0){Hn=Io(e.nextSibling);break e}t--}else r!=="$"&&r!=="$!"&&r!=="$?"||t++}e=e.nextSibling}Hn=null}}else Hn=qn?Io(e.stateNode.nextSibling):null;return!0}function q$(){for(var e=Hn;e;)e=Io(e.nextSibling)}function cd(){Hn=qn=null,Lt=!1}function Sk(e){Ga===null?Ga=[e]:Ga.push(e)}var Fq=Wi.ReactCurrentBatchConfig;function Mh(e,t,r){if(e=r.ref,e!==null&&typeof e!="function"&&typeof e!="object"){if(r._owner){if(r=r._owner,r){if(r.tag!==1)throw Error(ve(309));var n=r.stateNode}if(!n)throw Error(ve(147,e));var s=n,i=""+e;return t!==null&&t.ref!==null&&typeof t.ref=="function"&&t.ref._stringRef===i?t.ref:(t=function(o){var l=s.refs;o===null?delete l[i]:l[i]=o},t._stringRef=i,t)}if(typeof e!="string")throw Error(ve(284));if(!r._owner)throw Error(ve(290,e))}return e}function pg(e,t){throw e=Object.prototype.toString.call(t),Error(ve(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function AT(e){var t=e._init;return t(e._payload)}function G$(e){function t(x,b){if(e){var w=x.deletions;w===null?(x.deletions=[b],x.flags|=16):w.push(b)}}function r(x,b){if(!e)return null;for(;b!==null;)t(x,b),b=b.sibling;return null}function n(x,b){for(x=new Map;b!==null;)b.key!==null?x.set(b.key,b):x.set(b.index,b),b=b.sibling;return x}function s(x,b){return x=zo(x,b),x.index=0,x.sibling=null,x}function i(x,b,w){return x.index=w,e?(w=x.alternate,w!==null?(w=w.index,w<b?(x.flags|=2,b):w):(x.flags|=2,b)):(x.flags|=1048576,b)}function o(x){return e&&x.alternate===null&&(x.flags|=2),x}function l(x,b,w,j){return b===null||b.tag!==6?(b=Fw(w,x.mode,j),b.return=x,b):(b=s(b,w),b.return=x,b)}function c(x,b,w,j){var _=w.type;return _===hu?h(x,b,w.props.children,j,w.key):b!==null&&(b.elementType===_||typeof _=="object"&&_!==null&&_.$$typeof===co&&AT(_)===b.type)?(j=s(b,w.props),j.ref=Mh(x,b,w),j.return=x,j):(j=Ay(w.type,w.key,w.props,null,x.mode,j),j.ref=Mh(x,b,w),j.return=x,j)}function u(x,b,w,j){return b===null||b.tag!==4||b.stateNode.containerInfo!==w.containerInfo||b.stateNode.implementation!==w.implementation?(b=zw(w,x.mode,j),b.return=x,b):(b=s(b,w.children||[]),b.return=x,b)}function h(x,b,w,j,_){return b===null||b.tag!==7?(b=Ql(w,x.mode,j,_),b.return=x,b):(b=s(b,w),b.return=x,b)}function d(x,b,w){if(typeof b=="string"&&b!==""||typeof b=="number")return b=Fw(""+b,x.mode,w),b.return=x,b;if(typeof b=="object"&&b!==null){switch(b.$$typeof){case ag:return w=Ay(b.type,b.key,b.props,null,x.mode,w),w.ref=Mh(x,null,b),w.return=x,w;case du:return b=zw(b,x.mode,w),b.return=x,b;case co:var j=b._init;return d(x,j(b._payload),w)}if(af(b)||Eh(b))return b=Ql(b,x.mode,w,null),b.return=x,b;pg(x,b)}return null}function f(x,b,w,j){var _=b!==null?b.key:null;if(typeof w=="string"&&w!==""||typeof w=="number")return _!==null?null:l(x,b,""+w,j);if(typeof w=="object"&&w!==null){switch(w.$$typeof){case ag:return w.key===_?c(x,b,w,j):null;case du:return w.key===_?u(x,b,w,j):null;case co:return _=w._init,f(x,b,_(w._payload),j)}if(af(w)||Eh(w))return _!==null?null:h(x,b,w,j,null);pg(x,w)}return null}function m(x,b,w,j,_){if(typeof j=="string"&&j!==""||typeof j=="number")return x=x.get(w)||null,l(b,x,""+j,_);if(typeof j=="object"&&j!==null){switch(j.$$typeof){case ag:return x=x.get(j.key===null?w:j.key)||null,c(b,x,j,_);case du:return x=x.get(j.key===null?w:j.key)||null,u(b,x,j,_);case co:var S=j._init;return m(x,b,w,S(j._payload),_)}if(af(j)||Eh(j))return x=x.get(w)||null,h(b,x,j,_,null);pg(b,j)}return null}function g(x,b,w,j){for(var _=null,S=null,k=b,P=b=0,C=null;k!==null&&P<w.length;P++){k.index>P?(C=k,k=null):C=k.sibling;var M=f(x,k,w[P],j);if(M===null){k===null&&(k=C);break}e&&k&&M.alternate===null&&t(x,k),b=i(M,b,P),S===null?_=M:S.sibling=M,S=M,k=C}if(P===w.length)return r(x,k),Lt&&Nl(x,P),_;if(k===null){for(;P<w.length;P++)k=d(x,w[P],j),k!==null&&(b=i(k,b,P),S===null?_=k:S.sibling=k,S=k);return Lt&&Nl(x,P),_}for(k=n(x,k);P<w.length;P++)C=m(k,x,P,w[P],j),C!==null&&(e&&C.alternate!==null&&k.delete(C.key===null?P:C.key),b=i(C,b,P),S===null?_=C:S.sibling=C,S=C);return e&&k.forEach(function(I){return t(x,I)}),Lt&&Nl(x,P),_}function p(x,b,w,j){var _=Eh(w);if(typeof _!="function")throw Error(ve(150));if(w=_.call(w),w==null)throw Error(ve(151));for(var S=_=null,k=b,P=b=0,C=null,M=w.next();k!==null&&!M.done;P++,M=w.next()){k.index>P?(C=k,k=null):C=k.sibling;var I=f(x,k,M.value,j);if(I===null){k===null&&(k=C);break}e&&k&&I.alternate===null&&t(x,k),b=i(I,b,P),S===null?_=I:S.sibling=I,S=I,k=C}if(M.done)return r(x,k),Lt&&Nl(x,P),_;if(k===null){for(;!M.done;P++,M=w.next())M=d(x,M.value,j),M!==null&&(b=i(M,b,P),S===null?_=M:S.sibling=M,S=M);return Lt&&Nl(x,P),_}for(k=n(x,k);!M.done;P++,M=w.next())M=m(k,x,P,M.value,j),M!==null&&(e&&M.alternate!==null&&k.delete(M.key===null?P:M.key),b=i(M,b,P),S===null?_=M:S.sibling=M,S=M);return e&&k.forEach(function(E){return t(x,E)}),Lt&&Nl(x,P),_}function v(x,b,w,j){if(typeof w=="object"&&w!==null&&w.type===hu&&w.key===null&&(w=w.props.children),typeof w=="object"&&w!==null){switch(w.$$typeof){case ag:e:{for(var _=w.key,S=b;S!==null;){if(S.key===_){if(_=w.type,_===hu){if(S.tag===7){r(x,S.sibling),b=s(S,w.props.children),b.return=x,x=b;break e}}else if(S.elementType===_||typeof _=="object"&&_!==null&&_.$$typeof===co&&AT(_)===S.type){r(x,S.sibling),b=s(S,w.props),b.ref=Mh(x,S,w),b.return=x,x=b;break e}r(x,S);break}else t(x,S);S=S.sibling}w.type===hu?(b=Ql(w.props.children,x.mode,j,w.key),b.return=x,x=b):(j=Ay(w.type,w.key,w.props,null,x.mode,j),j.ref=Mh(x,b,w),j.return=x,x=j)}return o(x);case du:e:{for(S=w.key;b!==null;){if(b.key===S)if(b.tag===4&&b.stateNode.containerInfo===w.containerInfo&&b.stateNode.implementation===w.implementation){r(x,b.sibling),b=s(b,w.children||[]),b.return=x,x=b;break e}else{r(x,b);break}else t(x,b);b=b.sibling}b=zw(w,x.mode,j),b.return=x,x=b}return o(x);case co:return S=w._init,v(x,b,S(w._payload),j)}if(af(w))return g(x,b,w,j);if(Eh(w))return p(x,b,w,j);pg(x,w)}return typeof w=="string"&&w!==""||typeof w=="number"?(w=""+w,b!==null&&b.tag===6?(r(x,b.sibling),b=s(b,w),b.return=x,x=b):(r(x,b),b=Fw(w,x.mode,j),b.return=x,x=b),o(x)):r(x,b)}return v}var ud=G$(!0),K$=G$(!1),uv=tl(null),dv=null,bu=null,Nk=null;function kk(){Nk=bu=dv=null}function Ck(e){var t=uv.current;$t(uv),e._currentValue=t}function Kj(e,t,r){for(;e!==null;){var n=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,n!==null&&(n.childLanes|=t)):n!==null&&(n.childLanes&t)!==t&&(n.childLanes|=t),e===r)break;e=e.return}}function Mu(e,t){dv=e,Nk=bu=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(Sn=!0),e.firstContext=null)}function xa(e){var t=e._currentValue;if(Nk!==e)if(e={context:e,memoizedValue:t,next:null},bu===null){if(dv===null)throw Error(ve(308));bu=e,dv.dependencies={lanes:0,firstContext:e}}else bu=bu.next=e;return t}var Il=null;function Ek(e){Il===null?Il=[e]:Il.push(e)}function Y$(e,t,r,n){var s=t.interleaved;return s===null?(r.next=r,Ek(t)):(r.next=s.next,s.next=r),t.interleaved=r,Oi(e,n)}function Oi(e,t){e.lanes|=t;var r=e.alternate;for(r!==null&&(r.lanes|=t),r=e,e=e.return;e!==null;)e.childLanes|=t,r=e.alternate,r!==null&&(r.childLanes|=t),r=e,e=e.return;return r.tag===3?r.stateNode:null}var uo=!1;function Tk(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function X$(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function _i(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function Do(e,t,r){var n=e.updateQueue;if(n===null)return null;if(n=n.shared,lt&2){var s=n.pending;return s===null?t.next=t:(t.next=s.next,s.next=t),n.pending=t,Oi(e,r)}return s=n.interleaved,s===null?(t.next=t,Ek(n)):(t.next=s.next,s.next=t),n.interleaved=t,Oi(e,r)}function Sy(e,t,r){if(t=t.updateQueue,t!==null&&(t=t.shared,(r&4194240)!==0)){var n=t.lanes;n&=e.pendingLanes,r|=n,t.lanes=r,mk(e,r)}}function PT(e,t){var r=e.updateQueue,n=e.alternate;if(n!==null&&(n=n.updateQueue,r===n)){var s=null,i=null;if(r=r.firstBaseUpdate,r!==null){do{var o={eventTime:r.eventTime,lane:r.lane,tag:r.tag,payload:r.payload,callback:r.callback,next:null};i===null?s=i=o:i=i.next=o,r=r.next}while(r!==null);i===null?s=i=t:i=i.next=t}else s=i=t;r={baseState:n.baseState,firstBaseUpdate:s,lastBaseUpdate:i,shared:n.shared,effects:n.effects},e.updateQueue=r;return}e=r.lastBaseUpdate,e===null?r.firstBaseUpdate=t:e.next=t,r.lastBaseUpdate=t}function hv(e,t,r,n){var s=e.updateQueue;uo=!1;var i=s.firstBaseUpdate,o=s.lastBaseUpdate,l=s.shared.pending;if(l!==null){s.shared.pending=null;var c=l,u=c.next;c.next=null,o===null?i=u:o.next=u,o=c;var h=e.alternate;h!==null&&(h=h.updateQueue,l=h.lastBaseUpdate,l!==o&&(l===null?h.firstBaseUpdate=u:l.next=u,h.lastBaseUpdate=c))}if(i!==null){var d=s.baseState;o=0,h=u=c=null,l=i;do{var f=l.lane,m=l.eventTime;if((n&f)===f){h!==null&&(h=h.next={eventTime:m,lane:0,tag:l.tag,payload:l.payload,callback:l.callback,next:null});e:{var g=e,p=l;switch(f=t,m=r,p.tag){case 1:if(g=p.payload,typeof g=="function"){d=g.call(m,d,f);break e}d=g;break e;case 3:g.flags=g.flags&-65537|128;case 0:if(g=p.payload,f=typeof g=="function"?g.call(m,d,f):g,f==null)break e;d=Wt({},d,f);break e;case 2:uo=!0}}l.callback!==null&&l.lane!==0&&(e.flags|=64,f=s.effects,f===null?s.effects=[l]:f.push(l))}else m={eventTime:m,lane:f,tag:l.tag,payload:l.payload,callback:l.callback,next:null},h===null?(u=h=m,c=d):h=h.next=m,o|=f;if(l=l.next,l===null){if(l=s.shared.pending,l===null)break;f=l,l=f.next,f.next=null,s.lastBaseUpdate=f,s.shared.pending=null}}while(!0);if(h===null&&(c=d),s.baseState=c,s.firstBaseUpdate=u,s.lastBaseUpdate=h,t=s.shared.interleaved,t!==null){s=t;do o|=s.lane,s=s.next;while(s!==t)}else i===null&&(s.shared.lanes=0);oc|=o,e.lanes=o,e.memoizedState=d}}function OT(e,t,r){if(e=t.effects,t.effects=null,e!==null)for(t=0;t<e.length;t++){var n=e[t],s=n.callback;if(s!==null){if(n.callback=null,n=r,typeof s!="function")throw Error(ve(191,s));s.call(n)}}}var Sp={},Us=tl(Sp),Zf=tl(Sp),em=tl(Sp);function Dl(e){if(e===Sp)throw Error(ve(174));return e}function Ak(e,t){switch(Tt(em,t),Tt(Zf,e),Tt(Us,Sp),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:Ej(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=Ej(t,e)}$t(Us),Tt(Us,t)}function dd(){$t(Us),$t(Zf),$t(em)}function Q$(e){Dl(em.current);var t=Dl(Us.current),r=Ej(t,e.type);t!==r&&(Tt(Zf,e),Tt(Us,r))}function Pk(e){Zf.current===e&&($t(Us),$t(Zf))}var zt=tl(0);function fv(e){for(var t=e;t!==null;){if(t.tag===13){var r=t.memoizedState;if(r!==null&&(r=r.dehydrated,r===null||r.data==="$?"||r.data==="$!"))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==void 0){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var Mw=[];function Ok(){for(var e=0;e<Mw.length;e++)Mw[e]._workInProgressVersionPrimary=null;Mw.length=0}var Ny=Wi.ReactCurrentDispatcher,Rw=Wi.ReactCurrentBatchConfig,ic=0,Ut=null,dr=null,_r=null,mv=!1,jf=!1,tm=0,zq=0;function Wr(){throw Error(ve(321))}function Mk(e,t){if(t===null)return!1;for(var r=0;r<t.length&&r<e.length;r++)if(!rs(e[r],t[r]))return!1;return!0}function Rk(e,t,r,n,s,i){if(ic=i,Ut=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,Ny.current=e===null||e.memoizedState===null?Vq:Hq,e=r(n,s),jf){i=0;do{if(jf=!1,tm=0,25<=i)throw Error(ve(301));i+=1,_r=dr=null,t.updateQueue=null,Ny.current=qq,e=r(n,s)}while(jf)}if(Ny.current=pv,t=dr!==null&&dr.next!==null,ic=0,_r=dr=Ut=null,mv=!1,t)throw Error(ve(300));return e}function $k(){var e=tm!==0;return tm=0,e}function ks(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return _r===null?Ut.memoizedState=_r=e:_r=_r.next=e,_r}function ba(){if(dr===null){var e=Ut.alternate;e=e!==null?e.memoizedState:null}else e=dr.next;var t=_r===null?Ut.memoizedState:_r.next;if(t!==null)_r=t,dr=e;else{if(e===null)throw Error(ve(310));dr=e,e={memoizedState:dr.memoizedState,baseState:dr.baseState,baseQueue:dr.baseQueue,queue:dr.queue,next:null},_r===null?Ut.memoizedState=_r=e:_r=_r.next=e}return _r}function rm(e,t){return typeof t=="function"?t(e):t}function $w(e){var t=ba(),r=t.queue;if(r===null)throw Error(ve(311));r.lastRenderedReducer=e;
vendor: 5,690 bytes, line 39
39var n=dr,s=n.baseQueue,i=r.pending;if(i!==null){if(s!==null){var o=s.next;s.next=i.next,i.next=o}n.baseQueue=s=i,r.pending=null}if(s!==null){i=s.next,n=n.baseState;var l=o=null,c=null,u=i;do{var h=u.lane;if((ic&h)===h)c!==null&&(c=c.next={lane:0,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),n=u.hasEagerState?u.eagerState:e(n,u.action);else{var d={lane:h,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null};c===null?(l=c=d,o=n):c=c.next=d,Ut.lanes|=h,oc|=h}u=u.next}while(u!==null&&u!==i);c===null?o=n:c.next=l,rs(n,t.memoizedState)||(Sn=!0),t.memoizedState=n,t.baseState=o,t.baseQueue=c,r.lastRenderedState=n}if(e=r.interleaved,e!==null){s=e;do i=s.lane,Ut.lanes|=i,oc|=i,s=s.next;while(s!==e)}else s===null&&(r.lanes=0);return[t.memoizedState,r.dispatch]}function Iw(e){var t=ba(),r=t.queue;if(r===null)throw Error(ve(311));r.lastRenderedReducer=e;var n=r.dispatch,s=r.pending,i=t.memoizedState;if(s!==null){r.pending=null;var o=s=s.next;do i=e(i,o.action),o=o.next;while(o!==s);rs(i,t.memoizedState)||(Sn=!0),t.memoizedState=i,t.baseQueue===null&&(t.baseState=i),r.lastRenderedState=i}return[i,n]}function J$(){}function Z$(e,t){var r=Ut,n=ba(),s=t(),i=!rs(n.memoizedState,s);if(i&&(n.memoizedState=s,Sn=!0),n=n.queue,Ik(rI.bind(null,r,n,e),[e]),n.getSnapshot!==t||i||_r!==null&&_r.memoizedState.tag&1){if(r.flags|=2048,nm(9,tI.bind(null,r,n,s,t),void 0,null),Sr===null)throw Error(ve(349));ic&30||eI(r,t,s)}return s}function eI(e,t,r){e.flags|=16384,e={getSnapshot:t,value:r},t=Ut.updateQueue,t===null?(t={lastEffect:null,stores:null},Ut.updateQueue=t,t.stores=[e]):(r=t.stores,r===null?t.stores=[e]:r.push(e))}function tI(e,t,r,n){t.value=r,t.getSnapshot=n,nI(t)&&aI(e)}function rI(e,t,r){return r(function(){nI(t)&&aI(e)})}function nI(e){var t=e.getSnapshot;e=e.value;try{var r=t();return!rs(e,r)}catch{return!0}}function aI(e){var t=Oi(e,1);t!==null&&ts(t,e,1,-1)}function MT(e){var t=ks();return typeof e=="function"&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:rm,lastRenderedState:e},t.queue=e,e=e.dispatch=Wq.bind(null,Ut,e),[t.memoizedState,e]}function nm(e,t,r,n){return e={tag:e,create:t,destroy:r,deps:n,next:null},t=Ut.updateQueue,t===null?(t={lastEffect:null,stores:null},Ut.updateQueue=t,t.lastEffect=e.next=e):(r=t.lastEffect,r===null?t.lastEffect=e.next=e:(n=r.next,r.next=e,e.next=n,t.lastEffect=e)),e}function sI(){return ba().memoizedState}function ky(e,t,r,n){var s=ks();Ut.flags|=e,s.memoizedState=nm(1|t,r,void 0,n===void 0?null:n)}function m0(e,t,r,n){var s=ba();n=n===void 0?null:n;var i=void 0;if(dr!==null){var o=dr.memoizedState;if(i=o.destroy,n!==null&&Mk(n,o.deps)){s.memoizedState=nm(t,r,i,n);return}}Ut.flags|=e,s.memoizedState=nm(1|t,r,i,n)}function RT(e,t){return ky(8390656,8,e,t)}function Ik(e,t){return m0(2048,8,e,t)}function iI(e,t){return m0(4,2,e,t)}function oI(e,t){return m0(4,4,e,t)}function lI(e,t){if(typeof t=="function")return e=e(),t(e),function(){t(null)};if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function cI(e,t,r){return r=r!=null?r.concat([e]):null,m0(4,4,lI.bind(null,t,e),r)}function Dk(){}function uI(e,t){var r=ba();t=t===void 0?null:t;var n=r.memoizedState;return n!==null&&t!==null&&Mk(t,n[1])?n[0]:(r.memoizedState=[e,t],e)}function dI(e,t){var r=ba();t=t===void 0?null:t;var n=r.memoizedState;return n!==null&&t!==null&&Mk(t,n[1])?n[0]:(e=e(),r.memoizedState=[e,t],e)}function hI(e,t,r){return ic&21?(rs(r,t)||(r=y$(),Ut.lanes|=r,oc|=r,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,Sn=!0),e.memoizedState=r)}function Bq(e,t){var r=ft;ft=r!==0&&4>r?r:4,e(!0);var n=Rw.transition;Rw.transition={};try{e(!1),t()}finally{ft=r,Rw.transition=n}}function fI(){return ba().memoizedState}function Uq(e,t,r){var n=Fo(e);if(r={lane:n,action:r,hasEagerState:!1,eagerState:null,next:null},mI(e))pI(t,r);else if(r=Y$(e,t,r,n),r!==null){var s=on();ts(r,e,n,s),gI(r,t,n)}}function Wq(e,t,r){var n=Fo(e),s={lane:n,action:r,hasEagerState:!1,eagerState:null,next:null};if(mI(e))pI(t,s);else{var i=e.alternate;if(e.lanes===0&&(i===null||i.lanes===0)&&(i=t.lastRenderedReducer,i!==null))try{var o=t.lastRenderedState,l=i(o,r);if(s.hasEagerState=!0,s.eagerState=l,rs(l,o)){var c=t.interleaved;c===null?(s.next=s,Ek(t)):(s.next=c.next,c.next=s),t.interleaved=s;return}}catch{}finally{}r=Y$(e,t,s,n),r!==null&&(s=on(),ts(r,e,n,s),gI(r,t,n))}}function mI(e){var t=e.alternate;return e===Ut||t!==null&&t===Ut}function pI(e,t){jf=mv=!0;var r=e.pending;r===null?t.next=t:(t.next=r.next,r.next=t),e.pending=t}function gI(e,t,r){if(r&4194240){var n=t.lanes;n&=e.pendingLanes,r|=n,t.lanes=r,mk(e,r)}}var pv={readContext:xa,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},Vq={readContext:xa,useCallback:function(e,t){return ks().memoizedState=[e,t===void 0?null:t],e},useContext:xa,useEffect:RT,useImperativeHandle:function(e,t,r){return r=r!=null?r.concat([e]):null,ky(4194308,4,lI.bind(null,t,e),r)},useLayoutEffect:function(e,t){return ky(4194308,4,e,t)},useInsertionEffect:function(e,t){return ky(4,2,e,t)},useMemo:function(e,t){var r=ks();return t=t===void 0?null:t,e=e(),r.memoizedState=[e,t],e},useReducer:function(e,t,r){var n=ks();return t=r!==void 0?r(t):t,n.memoizedState=n.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},n.queue=e,e=e.dispatch=Uq.bind(null,Ut,e),[n.memoizedState,e]}
vendor: 7,433 bytes, lines 39-41
39,useRef:function(e){var t=ks();return e={current:e},t.memoizedState=e},useState:MT,useDebugValue:Dk,useDeferredValue:function(e){return ks().memoizedState=e},useTransition:function(){var e=MT(!1),t=e[0];return e=Bq.bind(null,e[1]),ks().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,r){var n=Ut,s=ks();if(Lt){if(r===void 0)throw Error(ve(407));r=r()}else{if(r=t(),Sr===null)throw Error(ve(349));ic&30||eI(n,t,r)}s.memoizedState=r;var i={value:r,getSnapshot:t};return s.queue=i,RT(rI.bind(null,n,i,e),[e]),n.flags|=2048,nm(9,tI.bind(null,n,i,r,t),void 0,null),r},useId:function(){var e=ks(),t=Sr.identifierPrefix;if(Lt){var r=pi,n=mi;r=(n&~(1<<32-es(n)-1)).toString(32)+r,t=":"+t+"R"+r,r=tm++,0<r&&(t+="H"+r.toString(32)),t+=":"}else r=zq++,t=":"+t+"r"+r.toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},Hq={readContext:xa,useCallback:uI,useContext:xa,useEffect:Ik,useImperativeHandle:cI,useInsertionEffect:iI,useLayoutEffect:oI,useMemo:dI,useReducer:$w,useRef:sI,useState:function(){return $w(rm)},useDebugValue:Dk,useDeferredValue:function(e){var t=ba();return hI(t,dr.memoizedState,e)},useTransition:function(){var e=$w(rm)[0],t=ba().memoizedState;return[e,t]},useMutableSource:J$,useSyncExternalStore:Z$,useId:fI,unstable_isNewReconciler:!1},qq={readContext:xa,useCallback:uI,useContext:xa,useEffect:Ik,useImperativeHandle:cI,useInsertionEffect:iI,useLayoutEffect:oI,useMemo:dI,useReducer:Iw,useRef:sI,useState:function(){return Iw(rm)},useDebugValue:Dk,useDeferredValue:function(e){var t=ba();return dr===null?t.memoizedState=e:hI(t,dr.memoizedState,e)},useTransition:function(){var e=Iw(rm)[0],t=ba().memoizedState;return[e,t]},useMutableSource:J$,useSyncExternalStore:Z$,useId:fI,unstable_isNewReconciler:!1};function za(e,t){if(e&&e.defaultProps){t=Wt({},t),e=e.defaultProps;for(var r in e)t[r]===void 0&&(t[r]=e[r]);return t}return t}function Yj(e,t,r,n){t=e.memoizedState,r=r(n,t),r=r==null?t:Wt({},t,r),e.memoizedState=r,e.lanes===0&&(e.updateQueue.baseState=r)}var p0={isMounted:function(e){return(e=e._reactInternals)?Nc(e)===e:!1},enqueueSetState:function(e,t,r){e=e._reactInternals;var n=on(),s=Fo(e),i=_i(n,s);i.payload=t,r!=null&&(i.callback=r),t=Do(e,i,s),t!==null&&(ts(t,e,s,n),Sy(t,e,s))},enqueueReplaceState:function(e,t,r){e=e._reactInternals;var n=on(),s=Fo(e),i=_i(n,s);i.tag=1,i.payload=t,r!=null&&(i.callback=r),t=Do(e,i,s),t!==null&&(ts(t,e,s,n),Sy(t,e,s))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var r=on(),n=Fo(e),s=_i(r,n);s.tag=2,t!=null&&(s.callback=t),t=Do(e,s,n),t!==null&&(ts(t,e,n,r),Sy(t,e,n))}};function $T(e,t,r,n,s,i,o){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(n,i,o):t.prototype&&t.prototype.isPureReactComponent?!Yf(r,n)||!Yf(s,i):!0}function yI(e,t,r){var n=!1,s=Yo,i=t.contextType;return typeof i=="object"&&i!==null?i=xa(i):(s=Cn(t)?ac:Jr.current,n=t.contextTypes,i=(n=n!=null)?ld(e,s):Yo),t=new t(r,i),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=p0,e.stateNode=t,t._reactInternals=e,n&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=s,e.__reactInternalMemoizedMaskedChildContext=i),t}function IT(e,t,r,n){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(r,n),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(r,n),t.state!==e&&p0.enqueueReplaceState(t,t.state,null)}function Xj(e,t,r,n){var s=e.stateNode;s.props=r,s.state=e.memoizedState,s.refs={},Tk(e);var i=t.contextType;typeof i=="object"&&i!==null?s.context=xa(i):(i=Cn(t)?ac:Jr.current,s.context=ld(e,i)),s.state=e.memoizedState,i=t.getDerivedStateFromProps,typeof i=="function"&&(Yj(e,t,i,r),s.state=e.memoizedState),typeof t.getDerivedStateFromProps=="function"||typeof s.getSnapshotBeforeUpdate=="function"||typeof s.UNSAFE_componentWillMount!="function"&&typeof s.componentWillMount!="function"||(t=s.state,typeof s.componentWillMount=="function"&&s.componentWillMount(),typeof s.UNSAFE_componentWillMount=="function"&&s.UNSAFE_componentWillMount(),t!==s.state&&p0.enqueueReplaceState(s,s.state,null),hv(e,r,s,n),s.state=e.memoizedState),typeof s.componentDidMount=="function"&&(e.flags|=4194308)}function hd(e,t){try{var r="",n=t;do r+=bH(n),n=n.return;while(n);var s=r}catch(i){s=`
40Error generating stack: `+i.message+`
41`+i.stack}return{value:e,source:t,stack:s,digest:null}}function Dw(e,t,r){return{value:e,source:null,stack:r??null,digest:t??null}}function Qj(e,t){try{console.error(t.value)}catch(r){setTimeout(function(){throw r})}}var Gq=typeof WeakMap=="function"?WeakMap:Map;function vI(e,t,r){r=_i(-1,r),r.tag=3,r.payload={element:null};var n=t.value;return r.callback=function(){yv||(yv=!0,o_=n),Qj(e,t)},r}function xI(e,t,r){r=_i(-1,r),r.tag=3;var n=e.type.getDerivedStateFromError;if(typeof n=="function"){var s=t.value;r.payload=function(){return n(s)},r.callback=function(){Qj(e,t)}}var i=e.stateNode;return i!==null&&typeof i.componentDidCatch=="function"&&(r.callback=function(){Qj(e,t),typeof n!="function"&&(Lo===null?Lo=new Set([this]):Lo.add(this));var o=t.stack;this.componentDidCatch(t.value,{componentStack:o!==null?o:""})}),r}function DT(e,t,r){var n=e.pingCache;if(n===null){n=e.pingCache=new Gq;var s=new Set;n.set(t,s)}else s=n.get(t),s===void 0&&(s=new Set,n.set(t,s));s.has(r)||(s.add(r),e=oG.bind(null,e,t,r),t.then(e,e))}function LT(e){do{var t;if((t=e.tag===13)&&(t=e.memoizedState,t=t!==null?t.dehydrated!==null:!0),t)return e;e=e.return}while(e!==null);return null}function FT(e,t,r,n,s){return e.mode&1?(e.flags|=65536,e.lanes=s,e):(e===t?e.flags|=65536:(e.flags|=128,r.flags|=131072,r.flags&=-52805,r.tag===1&&(r.alternate===null?r.tag=17:(t=_i(-1,1),t.tag=2,Do(r,t,1))),r.lanes|=1),e)}var Kq=Wi.ReactCurrentOwner,Sn=!1;function en(e,t,r,n){t.child=e===null?K$(t,null,r,n):ud(t,e.child,r,n)}function zT(e,t,r,n,s){r=r.render;var i=t.ref;return Mu(t,s),n=Rk(e,t,r,n,i,s),r=$k(),e!==null&&!Sn?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~s,Mi(e,t,s)):(Lt&&r&&jk(t),t.flags|=1,en(e,t,n,s),t.child)}function BT(e,t,r,n,s){if(e===null){var i=r.type;return typeof i=="function"&&!Hk(i)&&i.defaultProps===void 0&&r.compare===null&&r.defaultProps===void 0?(t.tag=15,t.type=i,bI(e,t,i,n,s)):(e=Ay(r.type,null,n,t,t.mode,s),e.ref=t.ref,e.return=t,t.child=e)}if(i=e.child,!(e.lanes&s)){var o=i.memoizedProps;if(r=r.compare,r=r!==null?r:Yf,r(o,n)&&e.ref===t.ref)return Mi(e,t,s)}return t.flags|=1,e=zo(i,n),e.ref=t.ref,e.return=t,t.child=e}function bI(e,t,r,n,s){if(e!==null){var i=e.memoizedProps;if(Yf(i,n)&&e.ref===t.ref)if(Sn=!1,t.pendingProps=n=i,(e.lanes&s)!==0)e.flags&131072&&(Sn=!0);else return t.lanes=e.lanes,Mi(e,t,s)}return Jj(e,t,r,n,s)}function wI(e,t,r){var n=t.pendingProps,s=n.children,i=e!==null?e.memoizedState:null;if(n.mode==="hidden")if(!(t.mode&1))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},Tt(ju,Fn),Fn|=r;else{if(!(r&1073741824))return e=i!==null?i.baseLanes|r:r,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,Tt(ju,Fn),Fn|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},n=i!==null?i.baseLanes:r,Tt(ju,Fn),Fn|=n}else i!==null?(n=i.baseLanes|r,t.memoizedState=null):n=r,Tt(ju,Fn),Fn|=n;return en(e,t,s,r),t.child}function jI(e,t){var r=t.ref;(e===null&&r!==null||e!==null&&e.ref!==r)&&(t.flags|=512,t.flags|=2097152)}
vendor: 4,711 bytes, line 41
41function Jj(e,t,r,n,s){var i=Cn(r)?ac:Jr.current;return i=ld(t,i),Mu(t,s),r=Rk(e,t,r,n,i,s),n=$k(),e!==null&&!Sn?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~s,Mi(e,t,s)):(Lt&&n&&jk(t),t.flags|=1,en(e,t,r,s),t.child)}function UT(e,t,r,n,s){if(Cn(r)){var i=!0;ov(t)}else i=!1;if(Mu(t,s),t.stateNode===null)Cy(e,t),yI(t,r,n),Xj(t,r,n,s),n=!0;else if(e===null){var o=t.stateNode,l=t.memoizedProps;o.props=l;var c=o.context,u=r.contextType;typeof u=="object"&&u!==null?u=xa(u):(u=Cn(r)?ac:Jr.current,u=ld(t,u));var h=r.getDerivedStateFromProps,d=typeof h=="function"||typeof o.getSnapshotBeforeUpdate=="function";d||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(l!==n||c!==u)&&IT(t,o,n,u),uo=!1;var f=t.memoizedState;o.state=f,hv(t,n,o,s),c=t.memoizedState,l!==n||f!==c||kn.current||uo?(typeof h=="function"&&(Yj(t,r,h,n),c=t.memoizedState),(l=uo||$T(t,r,l,n,f,c,u))?(d||typeof o.UNSAFE_componentWillMount!="function"&&typeof o.componentWillMount!="function"||(typeof o.componentWillMount=="function"&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount=="function"&&o.UNSAFE_componentWillMount()),typeof o.componentDidMount=="function"&&(t.flags|=4194308)):(typeof o.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=n,t.memoizedState=c),o.props=n,o.state=c,o.context=u,n=l):(typeof o.componentDidMount=="function"&&(t.flags|=4194308),n=!1)}else{o=t.stateNode,X$(e,t),l=t.memoizedProps,u=t.type===t.elementType?l:za(t.type,l),o.props=u,d=t.pendingProps,f=o.context,c=r.contextType,typeof c=="object"&&c!==null?c=xa(c):(c=Cn(r)?ac:Jr.current,c=ld(t,c));var m=r.getDerivedStateFromProps;(h=typeof m=="function"||typeof o.getSnapshotBeforeUpdate=="function")||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(l!==d||f!==c)&&IT(t,o,n,c),uo=!1,f=t.memoizedState,o.state=f,hv(t,n,o,s);var g=t.memoizedState;l!==d||f!==g||kn.current||uo?(typeof m=="function"&&(Yj(t,r,m,n),g=t.memoizedState),(u=uo||$T(t,r,u,n,f,g,c)||!1)?(h||typeof o.UNSAFE_componentWillUpdate!="function"&&typeof o.componentWillUpdate!="function"||(typeof o.componentWillUpdate=="function"&&o.componentWillUpdate(n,g,c),typeof o.UNSAFE_componentWillUpdate=="function"&&o.UNSAFE_componentWillUpdate(n,g,c)),typeof o.componentDidUpdate=="function"&&(t.flags|=4),typeof o.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof o.componentDidUpdate!="function"||l===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||l===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),t.memoizedProps=n,t.memoizedState=g),o.props=n,o.state=g,o.context=c,n=u):(typeof o.componentDidUpdate!="function"||l===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||l===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),n=!1)}return Zj(e,t,r,n,i,s)}function Zj(e,t,r,n,s,i){jI(e,t);var o=(t.flags&128)!==0;if(!n&&!o)return s&&CT(t,r,!1),Mi(e,t,i);n=t.stateNode,Kq.current=t;var l=o&&typeof r.getDerivedStateFromError!="function"?null:n.render();return t.flags|=1,e!==null&&o?(t.child=ud(t,e.child,null,i),t.child=ud(t,null,l,i)):en(e,t,l,i),t.memoizedState=n.state,s&&CT(t,r,!0),t.child}function _I(e){var t=e.stateNode;t.pendingContext?kT(e,t.pendingContext,t.pendingContext!==t.context):t.context&&kT(e,t.context,!1),Ak(e,t.containerInfo)}function WT(e,t,r,n,s){return cd(),Sk(s),t.flags|=256,en(e,t,r,n),t.child}var e_={dehydrated:null,treeContext:null,retryLane:0};function t_(e){return{baseLanes:e,cachePool:null,transitions:null}}function SI(e,t,r){var n=t.pendingProps,s=zt.current,i=!1,o=(t.flags&128)!==0,l;if((l=o)||(l=e!==null&&e.memoizedState===null?!1:(s&2)!==0),l?(i=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(s|=1),Tt(zt,s&1),e===null)return Gj(t),e=t.memoizedState,e!==null&&(e=e.dehydrated,e!==null)?(t.mode&1?e.data==="$!"?t.lanes=8:t.lanes=1073741824:t.lanes=1,null):(o=n.children,e=n.fallback,i?(n=t.mode,i=t.child,o={mode:"hidden",children:o},!(n&1)&&i!==null?(i.childLanes=0,i.pendingProps=o):i=v0(o,n,0,null),e=Ql(e,n,r,null),i.return=t,e.return=t,i.sibling=e,t.child=i,t.child.memoizedState=t_(r),t.memoizedState=e_,e):Lk(t,o));if(s=e.memoizedState,s!==null&&(l=s.dehydrated,l!==null))return Yq(e,t,o,n,l,s,r);if(i){i=n.fallback,o=t.mode,s=e.child,l=s.sibling;var c={mode:"hidden",children:n.children};return!(o&1)&&t.child!==s?(n=t.child,n.childLanes=0,n.pendingProps=c,t.deletions=null):(n=zo(s,c),n.subtreeFlags=s.subtreeFlags&14680064),l!==null?i=zo(l,i):(i=Ql(i,o,r,null),i.flags|=2),i.return=t,n.return=t,n.sibling=i,t.child=n,n=i,i=t.child,o=e.child.memoizedState,o=o===null?t_(r):{base
vendor: 7,574 bytes, line 41
41Lanes:o.baseLanes|r,cachePool:null,transitions:o.transitions},i.memoizedState=o,i.childLanes=e.childLanes&~r,t.memoizedState=e_,n}return i=e.child,e=i.sibling,n=zo(i,{mode:"visible",children:n.children}),!(t.mode&1)&&(n.lanes=r),n.return=t,n.sibling=null,e!==null&&(r=t.deletions,r===null?(t.deletions=[e],t.flags|=16):r.push(e)),t.child=n,t.memoizedState=null,n}function Lk(e,t){return t=v0({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function gg(e,t,r,n){return n!==null&&Sk(n),ud(t,e.child,null,r),e=Lk(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Yq(e,t,r,n,s,i,o){if(r)return t.flags&256?(t.flags&=-257,n=Dw(Error(ve(422))),gg(e,t,o,n)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(i=n.fallback,s=t.mode,n=v0({mode:"visible",children:n.children},s,0,null),i=Ql(i,s,o,null),i.flags|=2,n.return=t,i.return=t,n.sibling=i,t.child=n,t.mode&1&&ud(t,e.child,null,o),t.child.memoizedState=t_(o),t.memoizedState=e_,i);if(!(t.mode&1))return gg(e,t,o,null);if(s.data==="$!"){if(n=s.nextSibling&&s.nextSibling.dataset,n)var l=n.dgst;return n=l,i=Error(ve(419)),n=Dw(i,n,void 0),gg(e,t,o,n)}if(l=(o&e.childLanes)!==0,Sn||l){if(n=Sr,n!==null){switch(o&-o){case 4:s=2;break;case 16:s=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:s=32;break;case 536870912:s=268435456;break;default:s=0}s=s&(n.suspendedLanes|o)?0:s,s!==0&&s!==i.retryLane&&(i.retryLane=s,Oi(e,s),ts(n,e,s,-1))}return Vk(),n=Dw(Error(ve(421))),gg(e,t,o,n)}return s.data==="$?"?(t.flags|=128,t.child=e.child,t=lG.bind(null,e),s._reactRetry=t,null):(e=i.treeContext,Hn=Io(s.nextSibling),qn=t,Lt=!0,Ga=null,e!==null&&(la[ca++]=mi,la[ca++]=pi,la[ca++]=sc,mi=e.id,pi=e.overflow,sc=t),t=Lk(t,n.children),t.flags|=4096,t)}function VT(e,t,r){e.lanes|=t;var n=e.alternate;n!==null&&(n.lanes|=t),Kj(e.return,t,r)}function Lw(e,t,r,n,s){var i=e.memoizedState;i===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:n,tail:r,tailMode:s}:(i.isBackwards=t,i.rendering=null,i.renderingStartTime=0,i.last=n,i.tail=r,i.tailMode=s)}function NI(e,t,r){var n=t.pendingProps,s=n.revealOrder,i=n.tail;if(en(e,t,n.children,r),n=zt.current,n&2)n=n&1|2,t.flags|=128;else{if(e!==null&&e.flags&128)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&VT(e,r,t);else if(e.tag===19)VT(e,r,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}n&=1}if(Tt(zt,n),!(t.mode&1))t.memoizedState=null;else switch(s){case"forwards":for(r=t.child,s=null;r!==null;)e=r.alternate,e!==null&&fv(e)===null&&(s=r),r=r.sibling;r=s,r===null?(s=t.child,t.child=null):(s=r.sibling,r.sibling=null),Lw(t,!1,s,r,i);break;case"backwards":for(r=null,s=t.child,t.child=null;s!==null;){if(e=s.alternate,e!==null&&fv(e)===null){t.child=s;break}e=s.sibling,s.sibling=r,r=s,s=e}Lw(t,!0,r,null,i);break;case"together":Lw(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function Cy(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function Mi(e,t,r){if(e!==null&&(t.dependencies=e.dependencies),oc|=t.lanes,!(r&t.childLanes))return null;if(e!==null&&t.child!==e.child)throw Error(ve(153));if(t.child!==null){for(e=t.child,r=zo(e,e.pendingProps),t.child=r,r.return=t;e.sibling!==null;)e=e.sibling,r=r.sibling=zo(e,e.pendingProps),r.return=t;r.sibling=null}return t.child}function Xq(e,t,r){switch(t.tag){case 3:_I(t),cd();break;case 5:Q$(t);break;case 1:Cn(t.type)&&ov(t);break;case 4:Ak(t,t.stateNode.containerInfo);break;case 10:var n=t.type._context,s=t.memoizedProps.value;Tt(uv,n._currentValue),n._currentValue=s;break;case 13:if(n=t.memoizedState,n!==null)return n.dehydrated!==null?(Tt(zt,zt.current&1),t.flags|=128,null):r&t.child.childLanes?SI(e,t,r):(Tt(zt,zt.current&1),e=Mi(e,t,r),e!==null?e.sibling:null);Tt(zt,zt.current&1);break;case 19:if(n=(r&t.childLanes)!==0,e.flags&128){if(n)return NI(e,t,r);t.flags|=128}if(s=t.memoizedState,s!==null&&(s.rendering=null,s.tail=null,s.lastEffect=null),Tt(zt,zt.current),n)break;return null;case 22:case 23:return t.lanes=0,wI(e,t,r)}return Mi(e,t,r)}var kI,r_,CI,EI;kI=function(e,t){for(var r=t.child;r!==null;){if(r.tag===5||r.tag===6)e.appendChild(r.stateNode);else if(r.tag!==4&&r.child!==null){r.child.return=r,r=r.child;continue}if(r===t)break;for(;r.sibling===null;){if(r.return===null||r.return===t)return;r=r.return}r.sibling.return=r.return,r=r.sibling}};r_=function(){};CI=function(e,t,r,n){var s=e.memoizedProps;if(s!==n){e=t.stateNode,Dl(Us.current);var i=null;switch(r){case"input":s=Sj(e,s),n=Sj(e,n),i=[];break;case"select":s=Wt({},s,{value:void 0}),n=Wt({},n,{value:void 0}),i=[];break;case"textarea":s=Cj(e,s),n=Cj(e,n),i=[];break;default:typeof s.onClick!="function"&&typeof n.onClick=="function"&&(e.onclick=sv)}Tj(r,n);var o;r=null;for(u in s)if(!n.hasOwnProperty(u)&&s.hasOwnProperty(u)&&s[u]!=null)if(u==="style"){var l=s[u];for(o in l)l.hasOwnProperty(o)&&(r||(r={}),r[o]="")}else u!=="dangerouslySetInnerHTML"&&u!=="children"&&u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&u!=="autoFocus"&&(Uf.hasOwnProperty(u)?i||(i=[]):(i=i||[]).push(u,null));for(u in n){var c=n[u];if(l=s!=null?s[u]:void 0,n.hasOwnProperty(u)&&c!==l&&(c!=null||l!=null))if(u==="style")if(l){for(o in l)!l.hasOwnProperty(o)||c&&c.hasOwnProperty(o)||(r||(r={}),r[o]="");for(o in c)c.hasOwnProperty(o)&&l[o]!==c[o]&&(r||(r={}),r[o]=c[o])}else r||(i||(i=[]),i.push(u,r)),r=c;else u==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,l=l?l.__html:void 0,c!=null&&l!==c&&(i=i||[]).push(u,c)):u==="children"?typeof c!="string"&&typeof c!="number"||(i=i||[]).push(u,""+c):u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&(Uf.hasOwnProperty(u)?(c!=null&&u==="onScroll"&&Ot("scroll",e),i||l===c||(i=[])):(i=i||[]).push(u,c))}r&&(i=i||[]).push("style",r);var u=i;(t.updateQueue=u)&&(t.flags|=4)}};EI=function(e,t,r,n){r!==n&&(t.flags|=4)};function Rh(e,t){if(!Lt)switch(e.tailMode){case"hidden":t=e.tail;for(var r=null;t!==null;)t.alternate!==null&&(r=t),t=t.sibling;r===null?e.tail=null:r.sibling=null;break;case"collapsed":r=e.tail;for(var n=null;r!==null;)r.alternate!==null&&(n=r),r=r.sibling;n===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:n.sibling=null}}function Vr(e){var t=e.alternate!==null&&e.alternate.child===e.child,r=0,n=0;if(t)for(var s=e.child;s!==null;)r|=s.lanes|s.childLanes,n|=s.subtreeFlags&14680064,n|=s.flags&14680064,s.return=e,s=s.sibling;else for(s=e.child;s!==null;)r|=s.lanes|s.childLanes,n|=s.subtreeFlags,n|=s.flags,s.return=e,s=s.sibling;return e.subtreeFlags|=n,e.childLanes=r,t}function Qq(e,t,r){var n=t.pendingProps;switch(_k(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Vr(t),null;case 1:return Cn(t.type)&&iv(),Vr(t),null;case 3:return n=t.stateNode,dd(),$t(kn),$t(Jr),Ok(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(mg(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,Ga!==null&&(u_(Ga),Ga=null))),r_(e,t),Vr(t),null;case 5:Pk(t);var s=Dl(em.current);if(r=t.type,e!==null&&t.stateNode!=null)CI(e,t,r,n,s),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!n){if(t.stateNode===null)throw Error(ve(166));return Vr(t),null}
vendor: 32,435 bytes, line 41
41if(e=Dl(Us.current),mg(t)){n=t.stateNode,r=t.type;var i=t.memoizedProps;switch(n[$s]=t,n[Jf]=i,e=(t.mode&1)!==0,r){case"dialog":Ot("cancel",n),Ot("close",n);break;case"iframe":case"object":case"embed":Ot("load",n);break;case"video":case"audio":for(s=0;s<of.length;s++)Ot(of[s],n);break;case"source":Ot("error",n);break;case"img":case"image":case"link":Ot("error",n),Ot("load",n);break;case"details":Ot("toggle",n);break;case"input":ZE(n,i),Ot("invalid",n);break;case"select":n._wrapperState={wasMultiple:!!i.multiple},Ot("invalid",n);break;case"textarea":tT(n,i),Ot("invalid",n)}Tj(r,i),s=null;for(var o in i)if(i.hasOwnProperty(o)){var l=i[o];o==="children"?typeof l=="string"?n.textContent!==l&&(i.suppressHydrationWarning!==!0&&fg(n.textContent,l,e),s=["children",l]):typeof l=="number"&&n.textContent!==""+l&&(i.suppressHydrationWarning!==!0&&fg(n.textContent,l,e),s=["children",""+l]):Uf.hasOwnProperty(o)&&l!=null&&o==="onScroll"&&Ot("scroll",n)}switch(r){case"input":sg(n),eT(n,i,!0);break;case"textarea":sg(n),rT(n);break;case"select":case"option":break;default:typeof i.onClick=="function"&&(n.onclick=sv)}n=s,t.updateQueue=n,n!==null&&(t.flags|=4)}else{o=s.nodeType===9?s:s.ownerDocument,e==="http://www.w3.org/1999/xhtml"&&(e=r$(r)),e==="http://www.w3.org/1999/xhtml"?r==="script"?(e=o.createElement("div"),e.innerHTML="<script><\/script>",e=e.removeChild(e.firstChild)):typeof n.is=="string"?e=o.createElement(r,{is:n.is}):(e=o.createElement(r),r==="select"&&(o=e,n.multiple?o.multiple=!0:n.size&&(o.size=n.size))):e=o.createElementNS(e,r),e[$s]=t,e[Jf]=n,kI(e,t,!1,!1),t.stateNode=e;e:{switch(o=Aj(r,n),r){case"dialog":Ot("cancel",e),Ot("close",e),s=n;break;case"iframe":case"object":case"embed":Ot("load",e),s=n;break;case"video":case"audio":for(s=0;s<of.length;s++)Ot(of[s],e);s=n;break;case"source":Ot("error",e),s=n;break;case"img":case"image":case"link":Ot("error",e),Ot("load",e),s=n;break;case"details":Ot("toggle",e),s=n;break;case"input":ZE(e,n),s=Sj(e,n),Ot("invalid",e);break;case"option":s=n;break;case"select":e._wrapperState={wasMultiple:!!n.multiple},s=Wt({},n,{value:void 0}),Ot("invalid",e);break;case"textarea":tT(e,n),s=Cj(e,n),Ot("invalid",e);break;default:s=n}Tj(r,s),l=s;for(i in l)if(l.hasOwnProperty(i)){var c=l[i];i==="style"?s$(e,c):i==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,c!=null&&n$(e,c)):i==="children"?typeof c=="string"?(r!=="textarea"||c!=="")&&Wf(e,c):typeof c=="number"&&Wf(e,""+c):i!=="suppressContentEditableWarning"&&i!=="suppressHydrationWarning"&&i!=="autoFocus"&&(Uf.hasOwnProperty(i)?c!=null&&i==="onScroll"&&Ot("scroll",e):c!=null&&lk(e,i,c,o))}switch(r){case"input":sg(e),eT(e,n,!1);break;case"textarea":sg(e),rT(e);break;case"option":n.value!=null&&e.setAttribute("value",""+Ko(n.value));break;case"select":e.multiple=!!n.multiple,i=n.value,i!=null?Tu(e,!!n.multiple,i,!1):n.defaultValue!=null&&Tu(e,!!n.multiple,n.defaultValue,!0);break;default:typeof s.onClick=="function"&&(e.onclick=sv)}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&&(t.flags|=4)}t.ref!==null&&(t.flags|=512,t.flags|=2097152)}return Vr(t),null;case 6:if(e&&t.stateNode!=null)EI(e,t,e.memoizedProps,n);else{if(typeof n!="string"&&t.stateNode===null)throw Error(ve(166));if(r=Dl(em.current),Dl(Us.current),mg(t)){if(n=t.stateNode,r=t.memoizedProps,n[$s]=t,(i=n.nodeValue!==r)&&(e=qn,e!==null))switch(e.tag){case 3:fg(n.nodeValue,r,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&fg(n.nodeValue,r,(e.mode&1)!==0)}i&&(t.flags|=4)}else n=(r.nodeType===9?r:r.ownerDocument).createTextNode(n),n[$s]=t,t.stateNode=n}return Vr(t),null;case 13:if($t(zt),n=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(Lt&&Hn!==null&&t.mode&1&&!(t.flags&128))q$(),cd(),t.flags|=98560,i=!1;else if(i=mg(t),n!==null&&n.dehydrated!==null){if(e===null){if(!i)throw Error(ve(318));if(i=t.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(ve(317));i[$s]=t}else cd(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Vr(t),i=!1}else Ga!==null&&(u_(Ga),Ga=null),i=!0;if(!i)return t.flags&65536?t:null}return t.flags&128?(t.lanes=r,t):(n=n!==null,n!==(e!==null&&e.memoizedState!==null)&&n&&(t.child.flags|=8192,t.mode&1&&(e===null||zt.current&1?fr===0&&(fr=3):Vk())),t.updateQueue!==null&&(t.flags|=4),Vr(t),null);case 4:return dd(),r_(e,t),e===null&&Xf(t.stateNode.containerInfo),Vr(t),null;case 10:return Ck(t.type._context),Vr(t),null;case 17:return Cn(t.type)&&iv(),Vr(t),null;case 19:if($t(zt),i=t.memoizedState,i===null)return Vr(t),null;if(n=(t.flags&128)!==0,o=i.rendering,o===null)if(n)Rh(i,!1);else{if(fr!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(o=fv(e),o!==null){for(t.flags|=128,Rh(i,!1),n=o.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),t.subtreeFlags=0,n=r,r=t.child;r!==null;)i=r,e=n,i.flags&=14680066,o=i.alternate,o===null?(i.childLanes=0,i.lanes=e,i.child=null,i.subtreeFlags=0,i.memoizedProps=null,i.memoizedState=null,i.updateQueue=null,i.dependencies=null,i.stateNode=null):(i.childLanes=o.childLanes,i.lanes=o.lanes,i.child=o.child,i.subtreeFlags=0,i.deletions=null,i.memoizedProps=o.memoizedProps,i.memoizedState=o.memoizedState,i.updateQueue=o.updateQueue,i.type=o.type,e=o.dependencies,i.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),r=r.sibling;return Tt(zt,zt.current&1|2),t.child}e=e.sibling}i.tail!==null&&er()>fd&&(t.flags|=128,n=!0,Rh(i,!1),t.lanes=4194304)}else{if(!n)if(e=fv(o),e!==null){if(t.flags|=128,n=!0,r=e.updateQueue,r!==null&&(t.updateQueue=r,t.flags|=4),Rh(i,!0),i.tail===null&&i.tailMode==="hidden"&&!o.alternate&&!Lt)return Vr(t),null}else 2*er()-i.renderingStartTime>fd&&r!==1073741824&&(t.flags|=128,n=!0,Rh(i,!1),t.lanes=4194304);i.isBackwards?(o.sibling=t.child,t.child=o):(r=i.last,r!==null?r.sibling=o:t.child=o,i.last=o)}return i.tail!==null?(t=i.tail,i.rendering=t,i.tail=t.sibling,i.renderingStartTime=er(),t.sibling=null,r=zt.current,Tt(zt,n?r&1|2:r&1),t):(Vr(t),null);case 22:case 23:return Wk(),n=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==n&&(t.flags|=8192),n&&t.mode&1?Fn&1073741824&&(Vr(t),t.subtreeFlags&6&&(t.flags|=8192)):Vr(t),null;case 24:return null;case 25:return null}throw Error(ve(156,t.tag))}function Jq(e,t){switch(_k(t),t.tag){case 1:return Cn(t.type)&&iv(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return dd(),$t(kn),$t(Jr),Ok(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Pk(t),null;case 13:if($t(zt),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(ve(340));cd()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return $t(zt),null;case 4:return dd(),null;case 10:return Ck(t.type._context),null;case 22:case 23:return Wk(),null;case 24:return null;default:return null}}var yg=!1,Kr=!1,Zq=typeof WeakSet=="function"?WeakSet:Set,Ee=null;function wu(e,t){var r=e.ref;if(r!==null)if(typeof r=="function")try{r(null)}catch(n){Gt(e,t,n)}else r.current=null}function n_(e,t,r){try{r()}catch(n){Gt(e,t,n)}}var HT=!1;function eG(e,t){if(zj=rv,e=M$(),wk(e)){if("selectionStart"in e)var r={start:e.selectionStart,end:e.selectionEnd};else e:{r=(r=e.ownerDocument)&&r.defaultView||window;var n=r.getSelection&&r.getSelection();if(n&&n.rangeCount!==0){r=n.anchorNode;var s=n.anchorOffset,i=n.focusNode;n=n.focusOffset;try{r.nodeType,i.nodeType}catch{r=null;break e}var o=0,l=-1,c=-1,u=0,h=0,d=e,f=null;t:for(;;){for(var m;d!==r||s!==0&&d.nodeType!==3||(l=o+s),d!==i||n!==0&&d.nodeType!==3||(c=o+n),d.nodeType===3&&(o+=d.nodeValue.length),(m=d.firstChild)!==null;)f=d,d=m;for(;;){if(d===e)break t;if(f===r&&++u===s&&(l=o),f===i&&++h===n&&(c=o),(m=d.nextSibling)!==null)break;d=f,f=d.parentNode}d=m}r=l===-1||c===-1?null:{start:l,end:c}}else r=null}r=r||{start:0,end:0}}else r=null;for(Bj={focusedElem:e,selectionRange:r},rv=!1,Ee=t;Ee!==null;)if(t=Ee,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,Ee=e;else for(;Ee!==null;){t=Ee;try{var g=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(g!==null){var p=g.memoizedProps,v=g.memoizedState,x=t.stateNode,b=x.getSnapshotBeforeUpdate(t.elementType===t.type?p:za(t.type,p),v);x.__reactInternalSnapshotBeforeUpdate=b}break;case 3:var w=t.stateNode.containerInfo;w.nodeType===1?w.textContent="":w.nodeType===9&&w.documentElement&&w.removeChild(w.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(ve(163))}}catch(j){Gt(t,t.return,j)}if(e=t.sibling,e!==null){e.return=t.return,Ee=e;break}Ee=t.return}return g=HT,HT=!1,g}function _f(e,t,r){var n=t.updateQueue;if(n=n!==null?n.lastEffect:null,n!==null){var s=n=n.next;do{if((s.tag&e)===e){var i=s.destroy;s.destroy=void 0,i!==void 0&&n_(t,r,i)}s=s.next}while(s!==n)}}function g0(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var r=t=t.next;do{if((r.tag&e)===e){var n=r.create;r.destroy=n()}r=r.next}while(r!==t)}}function a_(e){var t=e.ref;if(t!==null){var r=e.stateNode;switch(e.tag){case 5:e=r;break;default:e=r}typeof t=="function"?t(e):t.current=e}}function TI(e){var t=e.alternate;t!==null&&(e.alternate=null,TI(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[$s],delete t[Jf],delete t[Vj],delete t[Iq],delete t[Dq])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function AI(e){return e.tag===5||e.tag===3||e.tag===4}function qT(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||AI(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function s_(e,t,r){var n=e.tag;if(n===5||n===6)e=e.stateNode,t?r.nodeType===8?r.parentNode.insertBefore(e,t):r.insertBefore(e,t):(r.nodeType===8?(t=r.parentNode,t.insertBefore(e,r)):(t=r,t.appendChild(e)),r=r._reactRootContainer,r!=null||t.onclick!==null||(t.onclick=sv));else if(n!==4&&(e=e.child,e!==null))for(s_(e,t,r),e=e.sibling;e!==null;)s_(e,t,r),e=e.sibling}function i_(e,t,r){var n=e.tag;if(n===5||n===6)e=e.stateNode,t?r.insertBefore(e,t):r.appendChild(e);else if(n!==4&&(e=e.child,e!==null))for(i_(e,t,r),e=e.sibling;e!==null;)i_(e,t,r),e=e.sibling}var Mr=null,Va=!1;function eo(e,t,r){for(r=r.child;r!==null;)PI(e,t,r),r=r.sibling}function PI(e,t,r){if(Bs&&typeof Bs.onCommitFiberUnmount=="function")try{Bs.onCommitFiberUnmount(l0,r)}catch{}switch(r.tag){case 5:Kr||wu(r,t);case 6:var n=Mr,s=Va;Mr=null,eo(e,t,r),Mr=n,Va=s,Mr!==null&&(Va?(e=Mr,r=r.stateNode,e.nodeType===8?e.parentNode.removeChild(r):e.removeChild(r)):Mr.removeChild(r.stateNode));break;case 18:Mr!==null&&(Va?(e=Mr,r=r.stateNode,e.nodeType===8?Pw(e.parentNode,r):e.nodeType===1&&Pw(e,r),Gf(e)):Pw(Mr,r.stateNode));break;case 4:n=Mr,s=Va,Mr=r.stateNode.containerInfo,Va=!0,eo(e,t,r),Mr=n,Va=s;break;case 0:case 11:case 14:case 15:if(!Kr&&(n=r.updateQueue,n!==null&&(n=n.lastEffect,n!==null))){s=n=n.next;do{var i=s,o=i.destroy;i=i.tag,o!==void 0&&(i&2||i&4)&&n_(r,t,o),s=s.next}while(s!==n)}eo(e,t,r);break;case 1:if(!Kr&&(wu(r,t),n=r.stateNode,typeof n.componentWillUnmount=="function"))try{n.props=r.memoizedProps,n.state=r.memoizedState,n.componentWillUnmount()}catch(l){Gt(r,t,l)}eo(e,t,r);break;case 21:eo(e,t,r);break;case 22:r.mode&1?(Kr=(n=Kr)||r.memoizedState!==null,eo(e,t,r),Kr=n):eo(e,t,r);break;default:eo(e,t,r)}}function GT(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var r=e.stateNode;r===null&&(r=e.stateNode=new Zq),t.forEach(function(n){var s=cG.bind(null,e,n);r.has(n)||(r.add(n),n.then(s,s))})}}function Ma(e,t){var r=t.deletions;if(r!==null)for(var n=0;n<r.length;n++){var s=r[n];try{var i=e,o=t,l=o;e:for(;l!==null;){switch(l.tag){case 5:Mr=l.stateNode,Va=!1;break e;case 3:Mr=l.stateNode.containerInfo,Va=!0;break e;case 4:Mr=l.stateNode.containerInfo,Va=!0;break e}l=l.return}if(Mr===null)throw Error(ve(160));PI(i,o,s),Mr=null,Va=!1;var c=s.alternate;c!==null&&(c.return=null),s.return=null}catch(u){Gt(s,t,u)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)OI(t,e),t=t.sibling}function OI(e,t){var r=e.alternate,n=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(Ma(t,e),js(e),n&4){try{_f(3,e,e.return),g0(3,e)}catch(p){Gt(e,e.return,p)}try{_f(5,e,e.return)}catch(p){Gt(e,e.return,p)}}break;case 1:Ma(t,e),js(e),n&512&&r!==null&&wu(r,r.return);break;case 5:if(Ma(t,e),js(e),n&512&&r!==null&&wu(r,r.return),e.flags&32){var s=e.stateNode;try{Wf(s,"")}catch(p){Gt(e,e.return,p)}}if(n&4&&(s=e.stateNode,s!=null)){var i=e.memoizedProps,o=r!==null?r.memoizedProps:i,l=e.type,c=e.updateQueue;if(e.updateQueue=null,c!==null)try{l==="input"&&i.type==="radio"&&i.name!=null&&e$(s,i),Aj(l,o);var u=Aj(l,i);for(o=0;o<c.length;o+=2){var h=c[o],d=c[o+1];h==="style"?s$(s,d):h==="dangerouslySetInnerHTML"?n$(s,d):h==="children"?Wf(s,d):lk(s,h,d,u)}switch(l){case"input":Nj(s,i);break;case"textarea":t$(s,i);break;case"select":var f=s._wrapperState.wasMultiple;s._wrapperState.wasMultiple=!!i.multiple;var m=i.value;m!=null?Tu(s,!!i.multiple,m,!1):f!==!!i.multiple&&(i.defaultValue!=null?Tu(s,!!i.multiple,i.defaultValue,!0):Tu(s,!!i.multiple,i.multiple?[]:"",!1))}s[Jf]=i}catch(p){Gt(e,e.return,p)}}break;case 6:if(Ma(t,e),js(e),n&4){if(e.stateNode===null)throw Error(ve(162));s=e.stateNode,i=e.memoizedProps;try{s.nodeValue=i}catch(p){Gt(e,e.return,p)}}break;case 3:if(Ma(t,e),js(e),n&4&&r!==null&&r.memoizedState.isDehydrated)try{Gf(t.containerInfo)}catch(p){Gt(e,e.return,p)}break;case 4:Ma(t,e),js(e);break;case 13:Ma(t,e),js(e),s=e.child,s.flags&8192&&(i=s.memoizedState!==null,s.stateNode.isHidden=i,!i||s.alternate!==null&&s.alternate.memoizedState!==null||(Bk=er())),n&4&&GT(e);break;case 22:if(h=r!==null&&r.memoizedState!==null,e.mode&1?(Kr=(u=Kr)||h,Ma(t,e),Kr=u):Ma(t,e),js(e),n&8192){if(u=e.memoizedState!==null,(e.stateNode.isHidden=u)&&!h&&e.mode&1)for(Ee=e,h=e.child;h!==null;){for(d=Ee=h;Ee!==null;){switch(f=Ee,m=f.child,f.tag){case 0:case 11:case 14:case 15:_f(4,f,f.return);break;case 1:wu(f,f.return);var g=f.stateNode;if(typeof g.componentWillUnmount=="function"){n=f,r=f.return;try{t=n,g.props=t.memoizedProps,g.state=t.memoizedState,g.componentWillUnmount()}catch(p){Gt(n,r,p)}}break;case 5:wu(f,f.return);break;case 22:if(f.memoizedState!==null){YT(d);continue}}m!==null?(m.return=f,Ee=m):YT(d)}h=h.sibling}e:for(h=null,d=e;;){if(d.tag===5){if(h===null){h=d;try{s=d.stateNode,u?(i=s.style,typeof i.setProperty=="function"?i.setProperty("display","none","important"):i.display="none"):(l=d.stateNode,c=d.memoizedProps.style,o=c!=null&&c.hasOwnProperty("display")?c.display:null,l.style.display=a$("display",o))}catch(p){Gt(e,e.return,p)}}}else if(d.tag===6){if(h===null)try{d.stateNode.nodeValue=u?"":d.memoizedProps}catch(p){Gt(e,e.return,p)}}else if((d.tag!==22&&d.tag!==23||d.memoizedState===null||d===e)&&d.child!==null){d.child.return=d,d=d.child;continue}if(d===e)break e;for(;d.sibling===null;){if(d.return===null||d.return===e)break e;h===d&&(h=null),d=d.return}h===d&&(h=null),d.sibling.return=d.return,d=d.sibling}}break;case 19:Ma(t,e),js(e),n&4&&GT(e);break;case 21:break;default:Ma(t,e),js(e)}}function js(e){var t=e.flags;if(t&2){try{e:{for(var r=e.return;r!==null;){if(AI(r)){var n=r;break e}r=r.return}throw Error(ve(160))}switch(n.tag){case 5:var s=n.stateNode;n.flags&32&&(Wf(s,""),n.flags&=-33);var i=qT(e);i_(e,i,s);break;case 3:case 4:var o=n.stateNode.containerInfo,l=qT(e);s_(e,l,o);break;default:throw Error(ve(161))}}catch(c){Gt(e,e.return,c)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function tG(e,t,r){Ee=e,MI(e)}function MI(e,t,r){for(var n=(e.mode&1)!==0;Ee!==null;){var s=Ee,i=s.child;if(s.tag===22&&n){var o=s.memoizedState!==null||yg;if(!o){var l=s.alternate,c=l!==null&&l.memoizedState!==null||Kr;l=yg;var u=Kr;if(yg=o,(Kr=c)&&!u)for(Ee=s;Ee!==null;)o=Ee,c=o.child,o.tag===22&&o.memoizedState!==null?XT(s):c!==null?(c.return=o,Ee=c):XT(s);for(;i!==null;)Ee=i,MI(i),i=i.sibling;Ee=s,yg=l,Kr=u}KT(e)}else s.subtreeFlags&8772&&i!==null?(i.return=s,Ee=i):KT(e)}}function KT(e){for(;Ee!==null;){var t=Ee;if(t.flags&8772){var r=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:Kr||g0(5,t);break;case 1:var n=t.stateNode;if(t.flags&4&&!Kr)if(r===null)n.componentDidMount();else{var s=t.elementType===t.type?r.memoizedProps:za(t.type,r.memoizedProps);n.componentDidUpdate(s,r.memoizedState,n.__reactInternalSnapshotBeforeUpdate)}var i=t.updateQueue;i!==null&&OT(t,i,n);break;case 3:var o=t.updateQueue;if(o!==null){if(r=null,t.child!==null)switch(t.child.tag){case 5:r=t.child.stateNode;break;case 1:r=t.child.stateNode}OT(t,o,r)}break;case 5:var l=t.stateNode;if(r===null&&t.flags&4){r=l;var c=t.memoizedProps;switch(t.type){case"button":case"input":case"select":case"textarea":c.autoFocus&&r.focus();break;case"img":c.src&&(r.src=c.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(t.memoizedState===null){var u=t.alternate;if(u!==null){var h=u.memoizedState;if(h!==null){var d=h.dehydrated;d!==null&&Gf(d)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(ve(163))}Kr||t.flags&512&&a_(t)}catch(f){Gt(t,t.return,f)}}if(t===e){Ee=null;break}if(r=t.sibling,r!==null){r.return=t.return,Ee=r;break}Ee=t.return}}function YT(e){for(;Ee!==null;){var t=Ee;if(t===e){Ee=null;break}var r=t.sibling;if(r!==null){r.return=t.return,Ee=r;break}Ee=t.return}}function XT(e){for(;Ee!==null;){var t=Ee;try{switch(t.tag){case 0:case 11:case 15:var r=t.return;try{g0(4,t)}catch(c){Gt(t,r,c)}break;case 1:var n=t.stateNode;if(typeof n.componentDidMount=="function"){var s=t.return;try{n.componentDidMount()}catch(c){Gt(t,s,c)}}var i=t.return;try{a_(t)}catch(c){Gt(t,i,c)}break;case 5:var o=t.return;try{a_(t)}catch(c){Gt(t,o,c)}}}catch(c){Gt(t,t.return,c)}if(t===e){Ee=null;break}var l=t.sibling;if(l!==null){l.return=t.return,Ee=l;break}Ee=t.return}}var rG=Math.ceil,gv=Wi.ReactCurrentDispatcher,Fk=Wi.ReactCurrentOwner,ha=Wi.ReactCurrentBatchConfig,lt=0,Sr=null,ir=null,Lr=0,Fn=0,ju=tl(0),fr=0,am=null,oc=0,y0=0,zk=0,Sf=null,wn=null,Bk=0,fd=1/0,li=null,yv=!1,o_=null,Lo=null,vg=!1,To=null,vv=0,Nf=0,l_=null,Ey=-1,Ty=0;function on(){return lt&6?er():Ey!==-1?Ey:Ey=er()}function Fo(e){return e.mode&1?lt&2&&Lr!==0?Lr&-Lr:Fq.transition!==null?(Ty===0&&(Ty=y$()),Ty):(e=ft,e!==0||(e=window.event,e=e===void 0?16:S$(e.type)),e):1}function ts(e,t,r,n){if(50<Nf)throw Nf=0,l_=null,Error(ve(185));wp(e,r,n),(!(lt&2)||e!==Sr)&&(e===Sr&&(!(lt&2)&&(y0|=r),fr===4&&yo(e,Lr)),En(e,n),r===1&&lt===0&&!(t.mode&1)&&(fd=er()+500,f0&&rl()))}function En(e,t){var r=e.callbackNode;FH(e,t);var n=tv(e,e===Sr?Lr:0);if(n===0)r!==null&&sT(r),e.callbackNode=null,e.callbackPriority=0;else if(t=n&-n,e.callbackPriority!==t){if(r!=null&&sT(r),t===1)e.tag===0?Lq(QT.bind(null,e)):W$(QT.bind(null,e)),Rq(function(){!(lt&6)&&rl()}),r=null;else{switch(v$(n)){case 1:r=fk;break;case 4:r=p$;break;case 16:r=ev;break;case 536870912:r=g$;break;default:r=ev}r=BI(r,RI.bind(null,e))}e.callbackPriority=t,e.callbackNode=r}}function RI(e,t){if(Ey=-1,Ty=0,lt&6)throw Error(ve(327));var r=e.callbackNode;if(Ru()&&e.callbackNode!==r)return null;var n=tv(e,e===Sr?Lr:0);if(n===0)return null;if(n&30||n&e.expiredLanes||t)t=xv(e,n);else{t=n;var s=lt;lt|=2;var i=II();(Sr!==e||Lr!==t)&&(li=null,fd=er()+500,Xl(e,t));do try{sG();break}catch(l){$I(e,l)}while(!0);kk(),gv.current=i,lt=s,ir!==null?t=0:(Sr=null,Lr=0,t=fr)}if(t!==0){if(t===2&&(s=$j(e),s!==0&&(n=s,t=c_(e,s))),t===1)throw r=am,Xl(e,0),yo(e,n),En(e,er()),r;if(t===6)yo(e,n);else{if(s=e.current.alternate,!(n&30)&&!nG(s)&&(t=xv(e,n),t===2&&(i=$j(e),i!==0&&(n=i,t=c_(e,i))),t===1))throw r=am,Xl(e,0),yo(e,n),En(e,er()),r;switch(e.finishedWork=s,e.finishedLanes=n,t){case 0:case 1:throw Error(ve(345));case 2:kl(e,wn,li);break;case 3:if(yo(e,n),(n&130023424)===n&&(t=Bk+500-er(),10<t)){if(tv(e,0)!==0)break;if(s=e.suspendedLanes,(s&n)!==n){on(),e.pingedLanes|=e.suspendedLanes&s;break}e.timeoutHandle=Wj(kl.bind(null,e,wn,li),t);break}kl(e,wn,li);break;case 4:if(yo(e,n),(n&4194240)===n)break;for(t=e.eventTimes,s=-1;0<n;){var o=31-es(n);i=1<<o,o=t[o],o>s&&(s=o),n&=~i}if(n=s,n=er()-n,n=(120>n?120:480>n?480:1080>n?1080:1920>n?1920:3e3>n?3e3:4320>n?4320:1960*rG(n/1960))-n,10<n){e.timeoutHandle=Wj(kl.bind(null,e,wn,li),n);break}kl(e,wn,li);break;case 5:kl(e,wn,li);break;default:throw Error(ve(329))}}}return En(e,er()),e.callbackNode===r?RI.bind(null,e):null}function c_(e,t){var r=Sf;return e.current.memoizedState.isDehydrated&&(Xl(e,t).flags|=256),e=xv(e,t),e!==2&&(t=wn,wn=r,t!==null&&u_(t)),e}function u_(e){wn===null?wn=e:wn.push.apply(wn,e)}function nG(e){for(var t=e;;){if(t.flags&16384){var r=t.updateQueue;if(r!==null&&(r=r.stores,r!==null))for(var n=0;n<r.length;n++){var s=r[n],i=s.getSnapshot;s=s.value;try{if(!rs(i(),s))return!1}catch{return!1}}}if(r=t.child,t.subtreeFlags&16384&&r!==null)r.return=t,t=r;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function yo(e,t){for(t&=~zk,t&=~y0,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var r=31-es(t),n=1<<r;e[r]=-1,t&=~n}}function QT(e){if(lt&6)throw Error(ve(327));Ru();var t=tv(e,0);if(!(t&1))return En(e,er()),null;var r=xv(e,t);if(e.tag!==0&&r===2){var n=$j(e);n!==0&&(t=n,r=c_(e,n))}if(r===1)throw r=am,Xl(e,0),yo(e,t),En(e,er()),r;if(r===6)throw Error(ve(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,kl(e,wn,li),En(e,er()),null}function Uk(e,t){var r=lt;lt|=1;try{return e(t)}finally{lt=r,lt===0&&(fd=er()+500,f0&&rl())}}function lc(e){To!==null&&To.tag===0&&!(lt&6)&&Ru();var t=lt;lt|=1;var r=ha.transition,n=ft;try{if(ha.transition=null,ft=1,e)return e()}finally{ft=n,ha.transition=r,lt=t,!(lt&6)&&rl()}}function Wk(){Fn=ju.current,$t(ju)}function Xl(e,t){e.finishedWork=null,e.finishedLanes=0;var r=e.timeoutHandle;if(r!==-1&&(e.timeoutHandle=-1,Mq(r)),ir!==null)for(r=ir.return;r!==null;){var n=r;switch(_k(n),n.tag){case 1:n=n.type.childContextTypes,n!=null&&iv();break;case 3:dd(),$t(kn),$t(Jr),Ok();break;case 5:Pk(n);break;case 4:dd();break;case 13:$t(zt);break;case 19:$t(zt);break;case 10:Ck(n.type._context);break;case 22:case 23:Wk()}r=r.return}if(Sr=e,ir=e=zo(e.current,null),Lr=Fn=t,fr=0,am=null,zk=y0=oc=0,wn=Sf=null,Il!==null){for(t=0;t<Il.length;t++)if(r=Il[t],n=r.interleaved,n!==null){r.interleaved=null;var s=n.next,i=r.pending;if(i!==null){var o=i.next;i.next=s,n.next=o}r.pending=n}Il=null}return e}function $I(e,t){do{var r=ir;try{if(kk(),Ny.current=pv,mv){for(var n=Ut.memoizedState;n!==null;){var s=n.queue;s!==null&&(s.pending=null),n=n.next}mv=!1}if(ic=0,_r=dr=Ut=null,jf=!1,tm=0,Fk.current=null,r===null||r.return===null){fr=1,am=t,ir=null;break}e:{var i=e,o=r.return,l=r,c=t;if(t=Lr,l.flags|=32768,c!==null&&typeof c=="object"&&typeof c.then=="function"){var u=c,h=l,d=h.tag;if(!(h.mode&1)&&(d===0||d===11||d===15)){var f=h.alternate;f?(h.updateQueue=f.updateQueue,h.memoizedState=f.memoizedState,h.lanes=f.lanes):(h.updateQueue=null,h.memoizedState=null)}var m=LT(o);if(m!==null){m.flags&=-257,FT(m,o,l,i,t),m.mode&1&&DT(i,u,t),t=m,c=u;var g=t.updateQueue;if(g===null){var p=new Set;p.add(c),t.updateQueue=p}else g.add(c);break e}else{if(!(t&1)){DT(i,u,t),Vk();break e}c=Error(ve(426))}}else if(Lt&&l.mode&1){var v=LT(o);if(v!==null){!(v.flags&65536)&&(v.flags|=256),FT(v,o,l,i,t),Sk(hd(c,l));break e}}i=c=hd(c,l),fr!==4&&(fr=2),Sf===null?Sf=[i]:Sf.push(i),i=o;do{switch(i.tag){case 3:i.flags|=65536,t&=-t,i.lanes|=t;var x=vI(i,c,t);PT(i,x);break e;case 1:l=c;var b=i.type,w=i.stateNode;if(!(i.flags&128)&&(typeof b.getDerivedStateFromError=="function"||w!==null&&typeof w.componentDidCatch=="function"&&(Lo===null||!Lo.has(w)))){i.flags|=65536,t&=-t,i.lanes|=t;var j=xI(i,l,t);PT(i,j);break e}}i=i.return}while(i!==null)}LI(r)}catch(_){t=_,ir===r&&r!==null&&(ir=r=r.return);continue}break}while(!0)}function II(){var e=gv.current;return gv.current=pv,e===null?pv:e}function Vk(){(fr===0||fr===3||fr===2)&&(fr=4),Sr===null||!(oc&268435455)&&!(y0&268435455)||yo(Sr,Lr)}function xv(e,t){var r=lt;lt|=2;var n=II();(Sr!==e||Lr!==t)&&(li=null,Xl(e,t));do try{aG();break}catch(s){$I(e,s)}while(!0);if(kk(),lt=r,gv.current=n,ir!==null)throw Error(ve(261));return Sr=null,Lr=0,fr}function aG(){for(;ir!==null;)DI(ir)}function sG(){for(;ir!==null&&!AH();)DI(ir)}function DI(e){var t=zI(e.alternate,e,Fn);e.memoizedProps=e.pendingProps,t===null?LI(e):ir=t,Fk.current=null}function LI(e){var t=e;do{var r=t.alternate;if(e=t.return,t.flags&32768){if(r=Jq(r,t),r!==null){r.flags&=32767,ir=r;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{fr=6,ir=null;return}}else if(r=Qq(r,t,Fn),r!==null){ir=r;return}if(t=t.sibling,t!==null){ir=t;return}ir=t=e}while(t!==null);fr===0&&(fr=5)}function kl(e,t,r){var n=ft,s=ha.transition;try{ha.transition=null,ft=1,iG(e,t,r,n)}finally{ha.transition=s,ft=n}return null}function iG(e,t,r,n){do Ru();while(To!==null);if(lt&6)throw Error(ve(327));r=e.finishedWork;var s=e.finishedLanes;if(r===null)return null;if(e.finishedWork=null,e.finishedLanes=0,r===e.current)throw Error(ve(177));e.callbackNode=null,e.callbackPriority=0;var i=r.lanes|r.childLanes;if(zH(e,i),e===Sr&&(ir=Sr=null,Lr=0),!(r.subtreeFlags&2064)&&!(r.flags&2064)||vg||(vg=!0,BI(ev,function(){return Ru(),null})),i=(r.flags&15990)!==0,r.subtreeFlags&15990||i){i=ha.transition,ha.transition=null;var o=ft;ft=1;var l=lt;lt|=4,Fk.current=null,eG(e,r),OI(r,e),kq(Bj),rv=!!zj,Bj=zj=null,e.current=r,tG(r),PH(),lt=l,ft=o,ha.transition=i}else e.current=r;if(vg&&(vg=!1,To=e,vv=s),i=e.pendingLanes,i===0&&(Lo=null),RH(r.stateNode),En(e,er()),t!==null)for(n=e.onRecoverableError,r=0;r<t.length;r++)s=t[r],n(s.value,{componentStack:s.stack,digest:s.digest});if(yv)throw yv=!1,e=o_,o_=null,e;return vv&1&&e.tag!==0&&Ru(),i=e.pendingLanes,i&1?e===l_?Nf++:(Nf=0,l_=e):Nf=0,rl(),null}function Ru(){if(To!==null){var e=v$(vv),t=ha.transition,r=ft;try{if(ha.transition=null,ft=16>e?16:e,To===null)var n=!1;else{if(e=To,To=null,vv=0,lt&6)throw Error(ve(331));var s=lt;for(lt|=4,Ee=e.current;Ee!==null;){var i=Ee,o=i.child;if(Ee.flags&16){var l=i.deletions;if(l!==null){for(var c=0;c<l.length;c++){var u=l[c];for(Ee=u;Ee!==null;){var h=Ee;switch(h.tag){case 0:case 11:case 15:_f(8,h,i)}var d=h.child;if(d!==null)d.return=h,Ee=d;else for(;Ee!==null;){h=Ee;var f=h.sibling,m=h.return;if(TI(h),h===u){Ee=null;break}if(f!==null){f.return=m,Ee=f;break}Ee=m}}}var g=i.alternate;if(g!==null){var p=g.child;if(p!==null){g.child=null;do{var v=p.sibling;p.sibling=null,p=v}while(p!==null)}}Ee=i}}if(i.subtreeFlags&2064&&o!==null)o.return=i,Ee=o;else e:for(;Ee!==null;){if(i=Ee,i.flags&2048)switch(i.tag){case 0:case 11:case 15:_f(9,i,i.return)}var x=i.sibling;if(x!==null){x.return=i.return,Ee=x;break e}Ee=i.return}}var b=e.current;for(Ee=b;Ee!==null;){o=Ee;var w=o.child;if(o.subtreeFlags&2064&&w!==null)w.return=o,Ee=w;else e:for(o=b;Ee!==null;){if(l=Ee,l.flags&2048)try{switch(l.tag){case 0:case 11:case 15:g0(9,l)}}catch(_){Gt(l,l.return,_)}if(l===o){Ee=null;break e}var j=l.sibling;if(j!==null){j.return=l.return,Ee=j;break e}Ee=l.return}}if(lt=s,rl(),Bs&&typeof Bs.onPostCommitFiberRoot=="function")try{Bs.onPostCommitFiberRoot(l0,e)}catch{}n=!0}return n}finally{ft=r,ha.transition=t}}return!1}function JT(e,t,r){t=hd(r,t),t=vI(e,t,1),e=Do(e,t,1),t=on(),e!==null&&(wp(e,1,t),En(e,t))}function Gt(e,t,r){if(e.tag===3)JT(e,e,r);else for(;t!==null;){if(t.tag===3){JT(t,e,r);break}else if(t.tag===1){var n=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof n.componentDidCatch=="function"&&(Lo===null||!Lo.has(n))){e=hd(r,e),e=xI(t,e,1),t=Do(t,e,1),e=on(),t!==null&&(wp(t,1,e),En(t,e));break}}t=t.return}}function oG(e,t,r){var n=e.pingCache;n!==null&&n.delete(t),t=on(),e.pingedLanes|=e.suspendedLanes&r,Sr===e&&(Lr&r)===r&&(fr===4||fr===3&&(Lr&130023424)===Lr&&500>er()-Bk?Xl(e,0):zk|=r),En(e,t)}function FI(e,t){t===0&&(e.mode&1?(t=lg,lg<<=1,!(lg&130023424)&&(lg=4194304)):t=1);var r=on();e=Oi(e,t),e!==null&&(wp(e,t,r),En(e,r))}function lG(e){var t=e.memoizedState,r=0;t!==null&&(r=t.retryLane),FI(e,r)}function cG(e,t){var r=0;switch(e.tag){case 13:var n=e.stateNode,s=e.memoizedState;s!==null&&(r=s.retryLane);break;case 19:n=e.stateNode;break;default:throw Error(ve(314))}n!==null&&n.delete(t),FI(e,r)}var zI;zI=function(e,t,r){if(e!==null)if(e.memoizedProps!==t.pendingProps||kn.current)Sn=!0;else{if(!(e.lanes&r)&&!(t.flags&128))return Sn=!1,Xq(e,t,r);Sn=!!(e.flags&131072)}else Sn=!1,Lt&&t.flags&1048576&&V$(t,cv,t.index);switch(t.lanes=0,t.tag){case 2:var n=t.type;Cy(e,t),e=t.pendingProps;var s=ld(t,Jr.current);Mu(t,r),s=Rk(null,t,n,e,s,r);var i=$k();return t.flags|=1,typeof s=="object"&&s!==null&&typeof s.render=="function"&&s.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,Cn(n)?(i=!0,ov(t)):i=!1,t.memoizedState=s.state!==null&&s.state!==void 0?s.state:null,Tk(t),s.updater=p0,t.stateNode=s,s._reactInternals=t,Xj(t,n,e,r),t=Zj(null,t,n,!0,i,r)):(t.tag=0,Lt&&i&&jk(t),en(null,t,s,r),t=t.child),t;case 16:n=t.elementType;e:{switch(Cy(e,t),e=t.pendingProps,s=n._init,n=s(n._payload),t.type=n,s=t.tag=dG(n),e=za(n,e),s){case 0:t=Jj(null,t,n,e,r);break e;case 1:t=UT(null,t,n,e,r);break e;case 11:t=zT(null,t,n,e,r);break e;case 14:t=BT(null,t,n,za(n.type,e),r);break e}throw Error(ve(306,n,""))}return t;case 0:return n=t.type,s=t.pendingProps,s=t.elementType===n?s:za(n,s),Jj(e,t,n,s,r);case 1:return n=t.type,s=t.pendingProps,s=t.elementType===n?s:za(n,s),UT(e,t,n,s,r);case 3:e:{if(_I(t),e===null)throw Error(ve(387));n=t.pendingProps,i=t.memoizedState,s=i.element,X$(e,t),hv(t,n,null,r);var o=t.memoizedState;if(n=o.element,i.isDehydrated)if(i={element:n,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},t.updateQueue.baseState=i,t.memoizedState=i,t.flags&256){s=hd(Error(ve(423)),t),t=WT(e,t,n,r,s);break e}else if(n!==s){s=hd(Error(ve(424)),t),t=WT(e,t,n,r,s);break e}else for(Hn=Io(t.stateNode.containerInfo.firstChild),qn=t,Lt=!0,Ga=null,r=K$(t,null,n,r),t.child=r;r;)r.flags=r.flags&-3|4096,r=r.sibling;else{if(cd(),n===s){t=Mi(e,t,r);break e}en(e,t,n,r)}t=t.child}return t;case 5:return Q$(t),e===null&&Gj(t),n=t.type,s=t.pendingProps,i=e!==null?e.memoizedProps:null,o=s.children,Uj(n,s)?o=null:i!==null&&Uj(n,i)&&(t.flags|=32),jI(e,t),en(e,t,o,r),t.child;case 6:return e===null&&Gj(t),null;case 13:return SI(e,t,r);case 4:return Ak(t,t.stateNode.containerInfo),n=t.pendingProps,e===null?t.child=ud(t,null,n,r):en(e,t,n,r),t.child;case 11:return n=t.type,s=t.pendingProps,s=t.elementType===n?s:za(n,s),zT(e,t,n,s,r);case 7:return en(e,t,t.pendingProps,r),t.child;case 8:return en(e,t,t.pendingProps.children,r),t.child;case 12:return en(e,t,t.pendingProps.children,r),t.child;case 10:e:{if(n=t.type._context,s=t.pendingProps,i=t.memoizedProps,o=s.value,Tt(uv,n._currentValue),n._currentValue=o,i!==null)if(rs(i.value,o)){if(i.children===s.children&&!kn.current){t=Mi(e,t,r);break e}}else for(i=t.child,i!==null&&(i.return=t);i!==null;){var l=i.dependencies;if(l!==null){o=i.child;for(var c=l.firstContext;c!==null;){if(c.context===n){if(i.tag===1){c=_i(-1,r&-r),c.tag=2;var u=i.updateQueue;if(u!==null){u=u.shared;var h=u.pending;h===null?c.next=c:(c.next=h.next,h.next=c),u.pending=c}}i.lanes|=r,c=i.alternate,c!==null&&(c.lanes|=r),Kj(i.return,r,t),l.lanes|=r;break}c=c.next}}else if(i.tag===10)o=i.type===t.type?null:i.child;else if(i.tag===18){if(o=i.return,o===null)throw Error(ve(341));o.lanes|=r,l=o.alternate,l!==null&&(l.lanes|=r),Kj(o,r,t),o=i.sibling}else o=i.child;if(o!==null)o.return=i;else for(o=i;o!==null;){if(o===t){o=null;break}if(i=o.sibling,i!==null){i.return=o.return,o=i;break}o=o.return}i=o}en(e,t,s.children,r),t=t.child}return t;case 9:return s=t.type,n=t.pendingProps.children,Mu(t,r),s=xa(s),n=n(s),t.flags|=1,en(e,t,n,r),t.child;case 14:return n=t.type,s=za(n,t.pendingProps),s=za(n.type,s),BT(e,t,n,s,r);case 15:return bI(e,t,t.type,t.pendingProps,r);case 17:return n=t.type,s=t.pendingProps,s=t.elementType===n?s:za(n,s),Cy(e,t),t.tag=1,Cn(n)?(e=!0,ov(t)):e=!1,Mu(t,r),yI(t,n,s),Xj(t,n,s,r),Zj(null,t,n,!0,e,r);case 19:return NI(e,t,r);case 22:return wI(e,t,r)}throw Error(ve(156,t.tag))};function BI(e,t){return m$(e,t)}function uG(e,t,r,n){this.tag=e,this.key=r,this.sibling=this.child=this.return=this.stateNode=this.t
vendor: 5,778 bytes, line 41
41ype=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,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 ua(e,t,r,n){return new uG(e,t,r,n)}function Hk(e){return e=e.prototype,!(!e||!e.isReactComponent)}function dG(e){if(typeof e=="function")return Hk(e)?1:0;if(e!=null){if(e=e.$$typeof,e===uk)return 11;if(e===dk)return 14}return 2}function zo(e,t){var r=e.alternate;return r===null?(r=ua(e.tag,t,e.key,e.mode),r.elementType=e.elementType,r.type=e.type,r.stateNode=e.stateNode,r.alternate=e,e.alternate=r):(r.pendingProps=t,r.type=e.type,r.flags=0,r.subtreeFlags=0,r.deletions=null),r.flags=e.flags&14680064,r.childLanes=e.childLanes,r.lanes=e.lanes,r.child=e.child,r.memoizedProps=e.memoizedProps,r.memoizedState=e.memoizedState,r.updateQueue=e.updateQueue,t=e.dependencies,r.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},r.sibling=e.sibling,r.index=e.index,r.ref=e.ref,r}function Ay(e,t,r,n,s,i){var o=2;if(n=e,typeof e=="function")Hk(e)&&(o=1);else if(typeof e=="string")o=5;else e:switch(e){case hu:return Ql(r.children,s,i,t);case ck:o=8,s|=8;break;case bj:return e=ua(12,r,t,s|2),e.elementType=bj,e.lanes=i,e;case wj:return e=ua(13,r,t,s),e.elementType=wj,e.lanes=i,e;case jj:return e=ua(19,r,t,s),e.elementType=jj,e.lanes=i,e;case QR:return v0(r,s,i,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case YR:o=10;break e;case XR:o=9;break e;case uk:o=11;break e;case dk:o=14;break e;case co:o=16,n=null;break e}throw Error(ve(130,e==null?e:typeof e,""))}return t=ua(o,r,t,s),t.elementType=e,t.type=n,t.lanes=i,t}function Ql(e,t,r,n){return e=ua(7,e,n,t),e.lanes=r,e}function v0(e,t,r,n){return e=ua(22,e,n,t),e.elementType=QR,e.lanes=r,e.stateNode={isHidden:!1},e}function Fw(e,t,r){return e=ua(6,e,null,t),e.lanes=r,e}function zw(e,t,r){return t=ua(4,e.children!==null?e.children:[],e.key,t),t.lanes=r,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function hG(e,t,r,n,s){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=bw(0),this.expirationTimes=bw(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=bw(0),this.identifierPrefix=n,this.onRecoverableError=s,this.mutableSourceEagerHydrationData=null}function qk(e,t,r,n,s,i,o,l,c){return e=new hG(e,t,r,l,c),t===1?(t=1,i===!0&&(t|=8)):t=0,i=ua(3,null,null,t),e.current=i,i.stateNode=e,i.memoizedState={element:n,isDehydrated:r,cache:null,transitions:null,pendingSuspenseBoundaries:null},Tk(i),e}function fG(e,t,r){var n=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:du,key:n==null?null:""+n,children:e,containerInfo:t,implementation:r}}function UI(e){if(!e)return Yo;e=e._reactInternals;e:{if(Nc(e)!==e||e.tag!==1)throw Error(ve(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(Cn(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(t!==null);throw Error(ve(171))}if(e.tag===1){var r=e.type;if(Cn(r))return U$(e,r,t)}return t}function WI(e,t,r,n,s,i,o,l,c){return e=qk(r,n,!0,e,s,i,o,l,c),e.context=UI(null),r=e.current,n=on(),s=Fo(r),i=_i(n,s),i.callback=t??null,Do(r,i,s),e.current.lanes=s,wp(e,s,n),En(e,n),e}function x0(e,t,r,n){var s=t.current,i=on(),o=Fo(s);return r=UI(r),t.context===null?t.context=r:t.pendingContext=r,t=_i(i,o),t.payload={element:e},n=n===void 0?null:n,n!==null&&(t.callback=n),e=Do(s,t,o),e!==null&&(ts(e,s,o,i),Sy(e,s,o)),o}function bv(e){if(e=e.current,!e.child)return null;switch(e.child.tag){case 5:return e.child.stateNode;default:return e.child.stateNode}}function ZT(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var r=e.retryLane;e.retryLane=r!==0&&r<t?r:t}}function Gk(e,t){ZT(e,t),(e=e.alternate)&&ZT(e,t)}function mG(){return null}var VI=typeof reportError=="function"?reportError:function(e){console.error(e)};function Kk(e){this._internalRoot=e}b0.prototype.render=Kk.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(ve(409));x0(e,t,null,null)};b0.prototype.unmount=Kk.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;lc(function(){x0(null,e,null,null)}),t[Pi]=null}};function b0(e){this._internalRoot=e}b0.prototype.unstable_scheduleHydration=function(e){if(e){var t=w$();e={blockedOn:null,target:e,priority:t};for(var r=0;r<go.length&&t!==0&&t<go[r].priority;r++);go.splice(r,0,e),r===0&&_$(e)}};function Yk(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function w0(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function eA(){}function pG(e,t,r,n,s){if(s){if(typeof n=="function"){var i=n;n=function(){var u=bv(o);i.call(u)}}var o=WI(t,n,e,0,null,!1,!1,"",eA);return e._reactRootContainer=o,e[Pi]=o.current,Xf(e.nodeType===8?e.parentNode:e),lc(),o}for(;s=e.lastChild;)e.removeChild(s);if(typeof n=="function"){var l=n;n=function(){var u=bv(c);l.call(u)}}var c=qk(e,0,!1,null,null,!1,!1,"",eA);return e._reactRootContainer=c,e[Pi]=c.current,Xf(e.nodeType===8?e.parentNode:e),lc(function(){x0(t,c,r,n)}),c}function j0(e,t,r,n,s){var i=r._reactRootContainer;if(i){var o=i;if(typeof s=="function"){var l=s;s=function(){var c=bv(o);l.call(c)}}x0(t,o,e,s)}else o=pG(r,t,e,s,n);return bv(o)}x$=function(e){switch(e.tag){case 3:var t=e.stateNode;
vendor: 4,455 bytes, line 41
41if(t.current.memoizedState.isDehydrated){var r=sf(t.pendingLanes);r!==0&&(mk(t,r|1),En(t,er()),!(lt&6)&&(fd=er()+500,rl()))}break;case 13:lc(function(){var n=Oi(e,1);if(n!==null){var s=on();ts(n,e,1,s)}}),Gk(e,1)}};pk=function(e){if(e.tag===13){var t=Oi(e,134217728);if(t!==null){var r=on();ts(t,e,134217728,r)}Gk(e,134217728)}};b$=function(e){if(e.tag===13){var t=Fo(e),r=Oi(e,t);if(r!==null){var n=on();ts(r,e,t,n)}Gk(e,t)}};w$=function(){return ft};j$=function(e,t){var r=ft;try{return ft=e,t()}finally{ft=r}};Oj=function(e,t,r){switch(t){case"input":if(Nj(e,r),t=r.name,r.type==="radio"&&t!=null){for(r=e;r.parentNode;)r=r.parentNode;for(r=r.querySelectorAll("input[name="+JSON.stringify(""+t)+'][type="radio"]'),t=0;t<r.length;t++){var n=r[t];if(n!==e&&n.form===e.form){var s=h0(n);if(!s)throw Error(ve(90));ZR(n),Nj(n,s)}}}break;case"textarea":t$(e,r);break;case"select":t=r.value,t!=null&&Tu(e,!!r.multiple,t,!1)}};l$=Uk;c$=lc;var gG={usingClientEntryPoint:!1,Events:[_p,gu,h0,i$,o$,Uk]},$h={findFiberByHostInstance:$l,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},yG={bundleType:$h.bundleType,version:$h.version,rendererPackageName:$h.rendererPackageName,rendererConfig:$h.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:Wi.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=h$(e),e===null?null:e.stateNode},findFiberByHostInstance:$h.findFiberByHostInstance||mG,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var xg=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!xg.isDisabled&&xg.supportsFiber)try{l0=xg.inject(yG),Bs=xg}catch{}}Zn.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=gG;Zn.createPortal=function(e,t){var r=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Yk(t))throw Error(ve(200));return fG(e,t,null,r)};Zn.createRoot=function(e,t){if(!Yk(e))throw Error(ve(299));var r=!1,n="",s=VI;return t!=null&&(t.unstable_strictMode===!0&&(r=!0),t.identifierPrefix!==void 0&&(n=t.identifierPrefix),t.onRecoverableError!==void 0&&(s=t.onRecoverableError)),t=qk(e,1,!1,null,null,r,!1,n,s),e[Pi]=t.current,Xf(e.nodeType===8?e.parentNode:e),new Kk(t)};Zn.findDOMNode=function(e){if(e==null)return null;if(e.nodeType===1)return e;var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(ve(188)):(e=Object.keys(e).join(","),Error(ve(268,e)));return e=h$(t),e=e===null?null:e.stateNode,e};Zn.flushSync=function(e){return lc(e)};Zn.hydrate=function(e,t,r){if(!w0(t))throw Error(ve(200));return j0(null,e,t,!0,r)};Zn.hydrateRoot=function(e,t,r){if(!Yk(e))throw Error(ve(405));var n=r!=null&&r.hydratedSources||null,s=!1,i="",o=VI;if(r!=null&&(r.unstable_strictMode===!0&&(s=!0),r.identifierPrefix!==void 0&&(i=r.identifierPrefix),r.onRecoverableError!==void 0&&(o=r.onRecoverableError)),t=WI(t,null,e,1,r??null,s,!1,i,o),e[Pi]=t.current,Xf(e),n)for(e=0;e<n.length;e++)r=n[e],s=r._getVersion,s=s(r._source),t.mutableSourceEagerHydrationData==null?t.mutableSourceEagerHydrationData=[r,s]:t.mutableSourceEagerHydrationData.push(r,s);return new b0(t)};Zn.render=function(e,t,r){if(!w0(t))throw Error(ve(200));return j0(null,e,t,!1,r)};Zn.unmountComponentAtNode=function(e){if(!w0(e))throw Error(ve(40));return e._reactRootContainer?(lc(function(){j0(null,null,e,!1,function(){e._reactRootContainer=null,e[Pi]=null})}),!0):!1};Zn.unstable_batchedUpdates=Uk;Zn.unstable_renderSubtreeIntoContainer=function(e,t,r,n){if(!w0(r))throw Error(ve(200));if(e==null||e._reactInternals===void 0)throw Error(ve(38));return j0(e,t,r,!1,n)};Zn.version="18.3.1-next-f1338f8080-20240426";function HI(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(HI)}catch(e){console.error(e)}}HI(),HR.exports=Zn;var kc=HR.exports;const qI=mt(kc);var GI,tA=kc;GI=tA.createRoot,tA.hydrateRoot;const vG=1,xG=1e6;let Bw=0;function bG(){return Bw=(Bw+1)%Number.MAX_SAFE_INTEGER,Bw.toString()}const Uw=new Map,rA=e=>{if(Uw.has(e))return;const t=setTimeout(()=>{Uw.delete(e),kf({type:"REMOVE_TOAST",toastId:e})},xG);Uw.set(e,t)},wG=(e,t)=>
41{switch(t.type){case"ADD_TOAST":return{...e,toasts:[t.toast,...e.toasts].slice(0,vG)};case"UPDATE_TOAST":return{...e,toasts:e.toasts.map(r=>r.id===t.toast.id?{...r,...t.toast}:r)};case"DISMISS_TOAST":{const{toastId:r}=t;return r?rA(r):e.toasts.forEach(n=>{rA(n.id)}),{...e,toasts:e.toasts.map(n=>n.id===r||r===void 0?{...n,open:!1}:n)}}case"REMOVE_TOAST":return t.toastId===void 0?{...e,toasts:[]}:{...e,toasts:e.toasts.filter(r=>r.id!==t.toastId)}}},Py=[];let Oy={toasts:[]};function kf(e){Oy=wG(Oy,e),Py.forEach(t=>{t(Oy)})}function jG({...e}){const t=bG(),r=s=>kf({type:"UPDATE_TOAST",toast:{...s,id:t}}),n=()=>kf({type:"DISMISS_TOAST",toastId:t});return kf({type:"ADD_TOAST",toast:{...e,id:t,open:!0,onOpenChange:s=>{s||n()}}}),{id:t,dismiss:n,update:r}}function ta(){const[e,t]=y.useState(Oy);return y.useEffect(()=>(Py.push(t),()=>{const r=Py.indexOf(t);r>-1&&Py.splice(r,1)}),[e]),{...e,toast:jG,dismiss:r=>kf({type:"DISMISS_TOAST",toastId:r})}}function ye(e,t,{checkForDefaultPrevented:r=!0}={}){return function(s){if(e==null||e(s),r===!1||!s.defaultPrevented)return t==null?void 0:t(s)}}function nA(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Js(...e){return t=>{let r=!1;const n=e.map(s=>{const i=nA(s,t);return!r&&typeof i=="function"&&(r=!0),i});if(r)return()=>{for(let s=0;s<n.length;s++){const i=n[s];typeof i=="function"?i():nA(e[s],null)}}}}function $e(...e){return y.useCallback(Js(...e),e)}function _G(e,t){const r=y.createContext(t),n=i=>{const{children:o,...l}=i,c=y.useMemo(()=>l,Object.values(l));return a.jsx(r.Provider,{value:c,children:o})};n.displayName=e+"Provider";function s(i){const o=y.useContext(r);if(o)return o;if(t!==void 0)return t;throw new Error(`\`${i}\` must be used within \`${e}\``)}return[n,s]}function Cr(e,t=[]){let r=[];function n(i,o){const l=y.createContext(o),c=r.length;r=[...r,o];const u=d=>{var x;const{scope:f,children:m,...g}=d,p=((x=f==null?void 0:f[e])==null?void 0:x[c])||l,v=y.useMemo(()=>g,Object.values(g));return a.jsx(p.Provider,{value:v,children:m})};u.displayName=i+"Provider";function h(d,f){var p;const m=((p=f==null?void 0:f[e])==null?void 0:p[c])||l,g=y.useContext(m);if(g)return g;if(o!==void 0)return o;throw new Error(`\`${d}\` must be used within \`${i}\``)}return[u,h]}const s=()=>{const i=r.map(o=>y.createContext(o));return function(l){const c=(l==null?void 0:l[e])||i;return y.useMemo(()=>({[`__scope${e}`]:{...l,[e]:c}}),[l,c])}};return s.scopeName=e,[n,SG(s,...t)]}function SG(...e){const t=e[0];if(e.length===1)return t;const r=()=>{const n=e.map(s=>({useScope:s(),scopeName:s.scopeName}));return function(i){const o=n.reduce((l,{useScope:c,scopeName:u})=>{const d=c(i)[`__scope${u}`];return{...l,...d}},{});return y.useMemo(()=>({[`__scope${t.scopeName}`]:o}),[o])}};return r.scopeName=t.scopeName,r}function aA(e){const t=NG(e),r=y.forwardRef((n,s)=>{const{children:i,...o}=n,l=y.Children.toArray(i),c=l.find(CG);if(c){const u=c.props.children,h=l.map(d=>d===c?y.Children.count(u)>1?y.Children.only(null):y.isValidElement(u)?u.props.children:null:d);return a.jsx(t,{...o,ref:s,children:y.isValidElement(u)?y.cloneElement(u,void 0,h):null})}return a.jsx(t,{...o,ref:s,children:i})});return r.displayName=`${e}.Slot`,r}function NG(e){const t=y.forwardRef((r,n)=>{const{children:s,...i}=r;if(y.isValidElement(s)){const o=TG(s),l=EG(i,s.props);return s.type!==y.Fragment&&(l.ref=n?Js(n,o):o),y.cloneElement(s,l)}return y.Children.count(s)>1?y.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var kG=Symbol("radix.slottable");function CG(e){return y.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===kG}function EG(e,t){const r={...t};for(const n in t){const s=e[n],i=t[n];/^on[A-Z]/.test(n)?s&&i?r[n]=(...l)=>{const c=i(...l);return s(...l),c}:s&&(r[n]=s):n==="style"?r[n]={...s,...i}:n==="className"&&(r[n]=[s,i].filter(Boolean).join(" "))}return{...e,...r}}function TG(e){var n,s;let t=(n=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:n.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=(s=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:s.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}function eh(e){const t=e+"CollectionProvider",[r,n]=Cr(t),[s,i]=r(t,{collectionRef:{current:null},itemMap:new Map}),o=p=>{const{scope:v,children:x}=p,b=J.useRef(null),w=J.useRef(new Map).current;return a.jsx(s,{scope:v,itemMap:w,collectionRef:b,children:x})};o.displayName=t;const l=e+"CollectionSlot",c=aA(l),u=J.forwardRef((p,v)=>{const{scope:x,children:b}=p,w=i(l,x),j=$e(v,w.collectionRef);return a.jsx(c,{ref:j,children:b})});u.displayName=l;const h=e+"CollectionItemSlot",d="data-radix-collection-item",f=aA(h),m=J.forwardRef((p,v)=>{const{scope:x,children:b,...w}=p,j=J.useRef(null),_=$e(v,j),S=i(h,x);return J.useEffect(()=>(S.itemMap.set(j,{ref:j,...w}),()=>void S.itemMap.delete(j))),a.jsx(f,{[d]:"",ref:_,children:b})});m.displayName=h;function g(p){const v=i(e+"CollectionConsumer",p);return J.useCallback(()=>{const b=v.collectionRef.current;if(!b)return[];const w=Array.from(b.querySelectorAll(`[${d}]`));return Array.from(v.itemMap.values()).sort((S,k)=>w.indexOf(S.ref.current)-w.indexOf(k.ref.current))},[v.collectionRef,v.itemMap])}return[{Provider:o,Slot:u,ItemSlot:m},g,n]}function AG(e){const t=PG(e),r=y.forwardRef((n,s)=>{const{children:i,...o}=n,l=y.Children.toArray(i),c=l.find(MG);if(c){const u=c.props.children,h=l.map(d=>d===c?y.Children.count(u)>1?y.Children.only(null):y.isValidElement(u)?u.props.children:null:d);return a.jsx(t,{...o,ref:s,children:y.isValidElement(u)?y.cloneElement(u,void 0,h):null})}return a.jsx(t,{...o,ref:s,children:i})});return r.displayName=`${e}.Slot`,r}function PG(e){const t=y.forwardRef((r,n)=>{const{children:s,...i}=r;if(y.isValidElement(s)){const o=$G(s),l=RG(i,s.props);return s.type!==y.Fragment&&(l.ref=n?Js(n,o):o),y.cloneElement(s,l)}return y.Children.count(s)>1?y.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var OG=Symbol("radix.slottable");function MG(e){return y.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===OG}function RG(e,t){const r={...t};for(const n in t){const s=e[n],i=t[n];/^on[A-Z]/.test(n)?s&&i?r[n]=(...l)=>{const c=i(...l);return s(...l),c}:s&&(r[n]=s):n==="style"?r[n]={...s,...i}
vendor: 9,129 bytes, line 41
41:n==="className"&&(r[n]=[s,i].filter(Boolean).join(" "))}return{...e,...r}}function $G(e){var n,s;let t=(n=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:n.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=(s=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:s.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}var IG=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Ce=IG.reduce((e,t)=>{const r=AG(`Primitive.${t}`),n=y.forwardRef((s,i)=>{const{asChild:o,...l}=s,c=o?r:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),a.jsx(c,{...l,ref:i})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{});function Xk(e,t){e&&kc.flushSync(()=>e.dispatchEvent(t))}function Yt(e){const t=y.useRef(e);return y.useEffect(()=>{t.current=e}),y.useMemo(()=>(...r)=>{var n;return(n=t.current)==null?void 0:n.call(t,...r)},[])}function DG(e,t=globalThis==null?void 0:globalThis.document){const r=Yt(e);y.useEffect(()=>{const n=s=>{s.key==="Escape"&&r(s)};return t.addEventListener("keydown",n,{capture:!0}),()=>t.removeEventListener("keydown",n,{capture:!0})},[r,t])}var LG="DismissableLayer",d_="dismissableLayer.update",FG="dismissableLayer.pointerDownOutside",zG="dismissableLayer.focusOutside",sA,KI=y.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Cc=y.forwardRef((e,t)=>{const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:n,onPointerDownOutside:s,onFocusOutside:i,onInteractOutside:o,onDismiss:l,...c}=e,u=y.useContext(KI),[h,d]=y.useState(null),f=(h==null?void 0:h.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,m]=y.useState({}),g=$e(t,k=>d(k)),p=Array.from(u.layers),[v]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),x=p.indexOf(v),b=h?p.indexOf(h):-1,w=u.layersWithOutsidePointerEventsDisabled.size>0,j=b>=x,_=UG(k=>{const P=k.target,C=[...u.branches].some(M=>M.contains(P));!j||C||(s==null||s(k),o==null||o(k),k.defaultPrevented||l==null||l())},f),S=WG(k=>{const P=k.target;[...u.branches].some(M=>M.contains(P))||(i==null||i(k),o==null||o(k),k.defaultPrevented||l==null||l())},f);return DG(k=>{b===u.layers.size-1&&(n==null||n(k),!k.defaultPrevented&&l&&(k.preventDefault(),l()))},f),y.useEffect(()=>{if(h)return r&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(sA=f.body.style.pointerEvents,f.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(h)),u.layers.add(h),iA(),()=>{r&&u.layersWithOutsidePointerEventsDisabled.size===1&&(f.body.style.pointerEvents=sA)}},[h,f,r,u]),y.useEffect(()=>()=>{h&&(u.layers.delete(h),u.layersWithOutsidePointerEventsDisabled.delete(h),iA())},[h,u]),y.useEffect(()=>{const k=()=>m({});return document.addEventListener(d_,k),()=>document.removeEventListener(d_,k)},[]),a.jsx(Ce.div,{...c,ref:g,style:{pointerEvents:w?j?"auto":"none":void 0,...e.style},onFocusCapture:ye(e.onFocusCapture,S.onFocusCapture),onBlurCapture:ye(e.onBlurCapture,S.onBlurCapture),onPointerDownCapture:ye(e.onPointerDownCapture,_.onPointerDownCapture)})});Cc.displayName=LG;var BG="DismissableLayerBranch",YI=y.forwardRef((e,t)=>{const r=y.useContext(KI),n=y.useRef(null),s=$e(t,n);return y.useEffect(()=>{const i=n.current;if(i)return r.branches.add(i),()=>{r.branches.delete(i)}},[r.branches]),a.jsx(Ce.div,{...e,ref:s})});YI.displayName=BG;function UG(e,t=globalThis==null?void 0:globalThis.document){const r=Yt(e),n=y.useRef(!1),s=y.useRef(()=>{});return y.useEffect(()=>{const i=l=>{if(l.target&&!n.current){let c=function(){XI(FG,r,u,{discrete:!0})};const u={originalEvent:l};l.pointerType==="touch"?(t.removeEventListener("click",s.current),s.current=c,t.addEventListener("click",s.current,{once:!0})):c()}else t.removeEventListener("click",s.current);n.current=!1},o=window.setTimeout(()=>{t.addEventListener("pointerdown",i)},0);return()=>{window.clearTimeout(o),t.removeEventListener("pointerdown",i),t.removeEventListener("click",s.current)}},[t,r]),{onPointerDownCapture:()=>n.current=!0}}function WG(e,t=globalThis==null?void 0:globalThis.document){const r=Yt(e),n=y.useRef(!1);return y.useEffect(()=>{const s=i=>{i.target&&!n.current&&XI(zG,r,{originalEvent:i},{discrete:!1})};return t.addEventListener("focusin",s),()=>t.removeEventListener("focusin",s)},[t,r]),{onFocusCapture:()=>n.current=!0,onBlurCapture:()=>n.current=!1}}function iA(){const e=new CustomEvent(d_);document.dispatchEvent(e)}function XI(e,t,r,{discrete:n}){const s=r.originalEvent.target,i=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:r});t&&s.addEventListener(e,t,{once:!0}),n?Xk(s,i):s.dispatchEvent(i)}var VG=Cc,HG=YI,Qt=globalThis!=null&&globalThis.document?y.useLayoutEffect:()=>{},qG="Portal",th=y.forwardRef((e,t)=>{var l;const{container:r,...n}=e,[s,i]=y.useState(!1);Qt(()=>i(!0),[]);const o=r||s&&((l=globalThis==null?void 0:globalThis.document)==null?void 0:l.body);return o?qI.createPortal(a.jsx(Ce.div,{...n,ref:t}),o):null});th.displayName=qG;function GG(e,t){return y.useReducer((r,n)=>t[r][n]??r,e)}var vr=e=>{const{present:t,children:r}=e,n=KG(t),s=typeof r=="function"?r({present:n.isPresent}):y.Children.only(r),i=$e(n.ref,YG(s));return typeof r=="function"||n.isPresent?y.cloneElement(s,{ref:i}):null};vr.displayName="Presence";function KG(e){const[t,r]=y.useState(),n=y.useRef(null),s=y.useRef(e),i=y.useRef("none"),o=e?"mounted":"unmounted",[l,c]=GG(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return y.useEffect(()=>{const u=bg(n.current);i.current=l==="mounted"?u:"none"},[l]),Qt(()=>{const u=n.current,h=s.current;if(h!==e){const f=i.current,m=bg(u);e?c("MOUNT"):m==="none"||(u==null?void 0:u.display)==="none"?c("UNMOUNT"):c(h&&f!==m?"ANIMATION_OUT":"UNMOUNT"),s.current=e}},[e,c]),Qt(()=>{if(t){let u;const h=t.ownerDocument.defaultView??window,d=m=>{const p=bg(n.current).includes(CSS.escape(m.animationName));if(m.target===t&&p&&(c("ANIMATION_END"),!s.current)){const v=t.style.animationFillMode;t.style.animationFillMode="forwards",u=h.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=v)})}},f=m=>{m.target===t&&(i.current=bg(n.current))};return t.addEventListener("animationstart",f),t.addEventListener("animationcancel",d),t.addEventListener("animationend",d),()=>{h.clearTimeout(u),t.removeEventListener("animationstart",f),t.removeEventListener("animationcancel",d),t.removeEventListener("animationend",d)}}else c("ANIMATION_END")},[t,c]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:y.useCallback(u=>{n.current=u?getComputedStyle(u):null,r(u)},[])}}function bg(e){return(e==null?void 0:e.animationName)||"none"}function YG(e){var n,s;let t=(n=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:n.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=(s=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:s.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}var XG=o0[" useInsertionEffect ".trim().toString()]||Qt;function ln({prop:e,defaultProp:t,onChange:r=()=>{},caller:n}){const[s,i,o]=QG({defaultProp:t,onChange:r}),l=e!==void 0,c=l?e:s;{const h=y.useRef(e!==void 0);y.useEffect(()=>{const d=h.current;d!==l&&console.warn(`${n} is changing from ${d?"controlled":"uncontrolled"} to ${l?"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.`),h.current=l},[l,n])}const u=y.useCallback(h=>{var d;if(l){const f=JG(h)?h(e):h;f!==e&&((d=o.current)==null||d.call(o,f))}else i(h)},[l,e,i,o]);return[c,u]}function QG({defaultProp:e,onChange:t}){const[r,n]=y.useState(e),s=y.useRef(r),i=y.useRef(t);return XG(()=>{i.current=t},[t]),y.useEffect(()=>{var o;s.current!==r&&((o=i.current)==null||o.call(i,r),s.current=r)},[r,s]),[r,n,i]}function JG(e){return typeof e=="function"}var QI=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"}),ZG="VisuallyHidden",_0=y.forwardRef((e,t)=>a.jsx(Ce.span,{...e,ref:t,style:{...QI,...e.style}}));_0.displayName=ZG;var eK=_0,Qk="ToastProvider",[Jk,tK,rK]=eh("Toast"),[JI]=Cr("Toast",[rK]),[nK,S0]=JI(Qk),ZI=e=>{const{__scopeToast:t,label:r="Notification",duration:n=5e3,swipeDirection:s="right",swipeThreshold:i=50,children:o}=e,[l,c]=y.useState(null),[u,h]=y.useState(0),d=y.useRef(!1),f=y.useRef(!1);return r.trim()||console.error(`Invalid prop \`label\` supplied to \`${Qk}\`. Expected non-empty \`string\`.`),a.jsx(Jk.Provider,{scope:t,children:a.jsx(nK,{scope:t,label:r,duration:n,swipeDirection:s,swipeThreshold:i,toastCount:u,viewport:l,onViewportChange:c,onToastAdd:y.useCallback(()=>h(m=>m+1),[]),onToastRemove:y.useCallback(()=>h(m=>m-1),[]),isFocusedToastEscapeKeyDownRef:d,isClosePausedRef:f,children:o})})};ZI.displayName=Qk;var eD="ToastViewport",aK=["F8"],h_="toast.viewportPause",f_="toast.viewportResume",tD=y.forwardRef((e,t)=>
41{const{__scopeToast:r,hotkey:n=aK,label:s="Notifications ({hotkey})",...i}=e,o=S0(eD,r),l=tK(r),c=y.useRef(null),u=y.useRef(null),h=y.useRef(null),d=y.useRef(null),f=$e(t,d,o.onViewportChange),m=n.join("+").replace(/Key/g,"").replace(/Digit/g,""),g=o.toastCount>0;y.useEffect(()=>{const v=x=>{var w;n.length!==0&&n.every(j=>x[j]||x.code===j)&&((w=d.current)==null||w.focus())};return document.addEventListener("keydown",v),()=>document.removeEventListener("keydown",v)},[n]),y.useEffect(()=>{const v=c.current,x=d.current;if(g&&v&&x){const b=()=>{if(!o.isClosePausedRef.current){const S=new CustomEvent(h_);x.dispatchEvent(S),o.isClosePausedRef.current=!0}},w=()=>{if(o.isClosePausedRef.current){const S=new CustomEvent(f_);x.dispatchEvent(S),o.isClosePausedRef.current=!1}},j=S=>{!v.contains(S.relatedTarget)&&w()},_=()=>{v.contains(document.activeElement)||w()};return v.addEventListener("focusin",b),v.addEventListener("focusout",j),v.addEventListener("pointermove",b),v.addEventListener("pointerleave",_),window.addEventListener("blur",b),window.addEventListener("focus",w),()=>{v.removeEventListener("focusin",b),v.removeEventListener("focusout",j),v.removeEventListener("pointermove",b),v.removeEventListener("pointerleave",_),window.removeEventListener("blur",b),window.removeEventListener("focus",w)}}},[g,o.isClosePausedRef]);const p=y.useCallback(({tabbingDirection:v})=>{const b=l().map(w=>{const j=w.ref.current,_=[j,...yK(j)];return v==="forwards"?_:_.reverse()});return(v==="forwards"?b.reverse():b).flat()},[l]);return y.useEffect(()=>{const v=d.current;if(v){const x=b=>{var _,S,k;const w=b.altKey||b.ctrlKey||b.metaKey;if(b.key==="Tab"&&!w){const P=document.activeElement,C=b.shiftKey;if(b.target===v&&C){(_=u.current)==null||_.focus();return}const E=p({tabbingDirection:C?"backwards":"forwards"}),B=E.findIndex(A=>A===P);Ww(E.slice(B+1))?b.preventDefault():C?(S=u.current)==null||S.focus():(k=h.current)==null||k.focus()}};return v.addEventListener("keydown",x),()=>v.removeEventListener("keydown",x)}},[l,p]),a.jsxs(HG,{ref:c,role:"region","aria-label":s.replace("{hotkey}",m),tabIndex:-1,style:{pointerEvents:g?void 0:"none"},children:[g&&a.jsx(m_,{ref:u,onFocusFromOutsideViewport:()=>{const v=p({tabbingDirection:"forwards"});Ww(v)}}),a.jsx(Jk.Slot,{scope:r,children:a.jsx(Ce.ol,{tabIndex:-1,...i,ref:f})}),g&&a.jsx(m_,{ref:h,onFocusFromOutsideViewport:()=>{const v=p({tabbingDirection:"backwards"});Ww(v)}})]})});tD.displayName=eD;var rD="ToastFocusProxy",m_=y.forwardRef((e,t)=>{const{__scopeToast:r,onFocusFromOutsideViewport:n,...s}=e,i=S0(rD,r);return a.jsx(_0,{tabIndex:0,...s,ref:t,style:{position:"fixed"},onFocus:o=>{var u;const l=o.relatedTarget;!((u=i.viewport)!=null&&u.contains(l))&&n()}})});m_.displayName=rD;var Np="Toast",sK="toast.swipeStart",iK="toast.swipeMove",oK="toast.swipeCancel",lK="toast.swipeEnd",nD=y.forwardRef((e,t)=>{const{forceMount:r,open:n,defaultOpen:s,onOpenChange:i,...o}=e,[l,c]=ln({prop:n,defaultProp:s??!0,onChange:i,caller:Np});return a.jsx(vr,{present:r||l,children:a.jsx(dK,{open:l,...o,ref:t,onClose:()=>c(!1),onPause:Yt(e.onPause),onResume:Yt(e.onResume),onSwipeStart:ye(e.onSwipeStart,u=>{u.currentTarget.setAttribute("data-swipe","start")}),onSwipeMove:ye(e.onSwipeMove,u=>{const{x:h,y:d}=u.detail.delta;u.currentTarget.setAttribute("data-swipe","move"),u.currentTarget.style.setProperty("--radix-toast-swipe-move-x",`${h}px`),u.currentTarget.style.setProperty("--radix-toast-swipe-move-y",`${d}px`)}),onSwipeCancel:ye(e.onSwipeCancel,u=>{u.currentTarget.setAttribute("data-swipe","cancel"),u.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),u.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),u.currentTarget.style.removeProperty("--radix-toast-swipe-end-x"),u.currentTarget.style.removeProperty("--radix-toast-swipe-end-y")}),onSwipeEnd:ye(e.onSwipeEnd,u=>{const{x:h,y:d}=u.detail.delta;u.currentTarget.setAttribute("data-swipe","end"),u.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),u.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),u.currentTarget.style.setProperty("--radix-toast-swipe-end-x",`${h}px`),u.currentTarget.style.setProperty("--radix-toast-swipe-end-y",`${d}px`),c(!1)})})})});nD.displayName=Np;var[cK,uK]=JI(Np,{onClose(){}}),dK=y.forwardRef((e,t)=>
41{const{__scopeToast:r,type:n="foreground",duration:s,open:i,onClose:o,onEscapeKeyDown:l,onPause:c,onResume:u,onSwipeStart:h,onSwipeMove:d,onSwipeCancel:f,onSwipeEnd:m,...g}=e,p=S0(Np,r),[v,x]=y.useState(null),b=$e(t,A=>x(A)),w=y.useRef(null),j=y.useRef(null),_=s||p.duration,S=y.useRef(0),k=y.useRef(_),P=y.useRef(0),{onToastAdd:C,onToastRemove:M}=p,I=Yt(()=>{var L;(v==null?void 0:v.contains(document.activeElement))&&((L=p.viewport)==null||L.focus()),o()}),E=y.useCallback(A=>{!A||A===1/0||(window.clearTimeout(P.current),S.current=new Date().getTime(),P.current=window.setTimeout(I,A))},[I]);y.useEffect(()=>{const A=p.viewport;if(A){const L=()=>{E(k.current),u==null||u()},W=()=>{const D=new Date().getTime()-S.current;k.current=k.current-D,window.clearTimeout(P.current),c==null||c()};return A.addEventListener(h_,W),A.addEventListener(f_,L),()=>{A.removeEventListener(h_,W),A.removeEventListener(f_,L)}}},[p.viewport,_,c,u,E]),y.useEffect(()=>{i&&!p.isClosePausedRef.current&&E(_)},[i,_,p.isClosePausedRef,E]),y.useEffect(()=>(C(),()=>M()),[C,M]);const B=y.useMemo(()=>v?uD(v):null,[v]);return p.viewport?a.jsxs(a.Fragment,{children:[B&&a.jsx(hK,{__scopeToast:r,role:"status","aria-live":n==="foreground"?"assertive":"polite",children:B}),a.jsx(cK,{scope:r,onClose:I,children:kc.createPortal(a.jsx(Jk.ItemSlot,{scope:r,children:a.jsx(VG,{asChild:!0,onEscapeKeyDown:ye(l,()=>{p.isFocusedToastEscapeKeyDownRef.current||I(),p.isFocusedToastEscapeKeyDownRef.current=!1}),children:a.jsx(Ce.li,{tabIndex:0,"data-state":i?"open":"closed","data-swipe-direction":p.swipeDirection,...g,ref:b,style:{userSelect:"none",touchAction:"none",...e.style},onKeyDown:ye(e.onKeyDown,A=>{A.key==="Escape"&&(l==null||l(A.nativeEvent),A.nativeEvent.defaultPrevented||(p.isFocusedToastEscapeKeyDownRef.current=!0,I()))}),onPointerDown:ye(e.onPointerDown,A=>{A.button===0&&(w.current={x:A.clientX,y:A.clientY})}),onPointerMove:ye(e.onPointerMove,A=>{if(!w.current)return;const L=A.clientX-w.current.x,W=A.clientY-w.current.y,D=!!j.current,U=["left","right"].includes(p.swipeDirection),R=["left","up"].includes(p.swipeDirection)?Math.min:Math.max,Q=U?R(0,L):0,K=U?0:R(0,W),z=A.pointerType==="touch"?10:2,N={x:Q,y:K},T={originalEvent:A,delta:N};D?(j.current=N,wg(iK,d,T,{discrete:!1})):oA(N,p.swipeDirection,z)?(j.current=N,wg(sK,h,T,{discrete:!1}),A.target.setPointerCapture(A.pointerId)):(Math.abs(L)>z||Math.abs(W)>z)&&(w.current=null)}),onPointerUp:ye(e.onPointerUp,A=>{const L=j.current,W=A.target;if(W.hasPointerCapture(A.pointerId)&&W.releasePointerCapture(A.pointerId),j.current=null,w.current=null,L){const D=A.currentTarget,U={originalEvent:A,delta:L};oA(L,p.swipeDirection,p.swipeThreshold)?wg(lK,m,U,{discrete:!0}):wg(oK,f,U,{discrete:!0}),D.addEventListener("click",R=>R.preventDefault(),{once:!0})}})})})}),p.viewport)})]}):null}),hK=e=>{const{__scopeToast:t,children:r,...n}=e,s=S0(Np,t),[i,o]=y.useState(!1),[l,c]=y.useState(!1);return pK(()=>o(!0)),y.useEffect(()=>{const u=window.setTimeout(()=>c(!0),1e3);return()=>window.clearTimeout(u)},[]),l?null:a.jsx(th,{asChild:!0,children:a.jsx(_0,{...n,children:i&&a.jsxs(a.Fragment,{children:[s.label," ",r]})})})},fK="ToastTitle",aD=y.forwardRef((e,t)=>{const{__scopeToast:r,...n}=e;return a.jsx(Ce.div,{...n,ref:t})});aD.displayName=fK;var mK="ToastDescription",sD=y.forwardRef((e,t)=>{const{__scopeToast:r,...n}=e;return a.jsx(Ce.div,{...n,ref:t})});sD.displayName=mK;var iD="ToastAction",oD=y.forwardRef((e,t)=>{const{altText:r,...n}=e;return r.trim()?a.jsx(cD,{altText:r,asChild:!0,children:a.jsx(Zk,{...n,ref:t})}):(console.error(`Invalid prop \`altText\` supplied to \`${iD}\`. Expected non-empty \`string\`.`),null)});oD.displayName=iD;var lD="ToastClose",Zk=y.forwardRef((e,t)=>{const{__scopeToast:r,...n}=e,s=uK(lD,r);return a.jsx(cD,{asChild:!0,children:a.jsx(Ce.button,{type:"button",...n,ref:t,onClick:ye(e.onClick,s.onClose)})})});Zk.displayName=lD;var cD=y.forwardRef((e,t)=>{const{__scopeToast:r,altText:n,...s}=e;return a.jsx(Ce.div,{"data-radix-toast-announce-exclude":"","data-radix-toast-announce-alt":n||void 0,...s,ref:t})});function uD(e){const t=[];
vendor: 4,279 bytes, lines 41-66
41return Array.from(e.childNodes).forEach(n=>{if(n.nodeType===n.TEXT_NODE&&n.textContent&&t.push(n.textContent),gK(n)){const s=n.ariaHidden||n.hidden||n.style.display==="none",i=n.dataset.radixToastAnnounceExclude==="";if(!s)if(i){const o=n.dataset.radixToastAnnounceAlt;o&&t.push(o)}else t.push(...uD(n))}}),t}function wg(e,t,r,{discrete:n}){const s=r.originalEvent.currentTarget,i=new CustomEvent(e,{bubbles:!0,cancelable:!0,detail:r});t&&s.addEventListener(e,t,{once:!0}),n?Xk(s,i):s.dispatchEvent(i)}var oA=(e,t,r=0)=>{const n=Math.abs(e.x),s=Math.abs(e.y),i=n>s;return t==="left"||t==="right"?i&&n>r:!i&&s>r};function pK(e=()=>{}){const t=Yt(e);Qt(()=>{let r=0,n=0;return r=window.requestAnimationFrame(()=>n=window.requestAnimationFrame(t)),()=>{window.cancelAnimationFrame(r),window.cancelAnimationFrame(n)}},[t])}function gK(e){return e.nodeType===e.ELEMENT_NODE}function yK(e){const t=[],r=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:n=>{const s=n.tagName==="INPUT"&&n.type==="hidden";return n.disabled||n.hidden||s?NodeFilter.FILTER_SKIP:n.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)t.push(r.currentNode);return t}function Ww(e){const t=document.activeElement;return e.some(r=>r===t?!0:(r.focus(),document.activeElement!==t))}var vK=ZI,dD=tD,hD=nD,fD=aD,mD=sD,pD=oD,gD=Zk;function yD(e){var t,r,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e)){var s=e.length;for(t=0;t<s;t++)e[t]&&(r=yD(e[t]))&&(n&&(n+=" "),n+=r)}else for(r in e)e[r]&&(n&&(n+=" "),n+=r);return n}function nt(){for(var e,t,r=0,n="",s=arguments.length;r<s;r++)(e=arguments[r])&&(t=yD(e))&&(n&&(n+=" "),n+=t);return n}const lA=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,cA=nt,kp=(e,t)=>r=>{var n;if((t==null?void 0:t.variants)==null)return cA(e,r==null?void 0:r.class,r==null?void 0:r.className);const{variants:s,defaultVariants:i}=t,o=Object.keys(s).map(u=>{const h=r==null?void 0:r[u],d=i==null?void 0:i[u];if(h===null)return null;const f=lA(h)||lA(d);return s[u][f]}),l=r&&Object.entries(r).reduce((u,h)=>{let[d,f]=h;return f===void 0||(u[d]=f),u},{}),c=t==null||(n=t.compoundVariants)===null||n===void 0?void 0:n.reduce((u,h)=>{let{class:d,className:f,...m}=h;return Object.entries(m).every(g=>{let[p,v]=g;return Array.isArray(v)?v.includes({...i,...l}[p]):{...i,...l}[p]===v})?[...u,d,f]:u},[]);return cA(e,o,c,r==null?void 0:r.class,r==null?void 0:r.className)};/**
42 * @license lucide-react v0.462.0 - ISC
43 *
44 * This source code is licensed under the ISC license.
45 * See the LICENSE file in the root directory of this source tree.
46 */const xK=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),vD=(...e)=>e.filter((t,r,n)=>!!t&&t.trim()!==""&&n.indexOf(t)===r).join(" ").trim();/**
47 * @license lucide-react v0.462.0 - ISC
48 *
49 * This source code is licensed under the ISC license.
50 * See the LICENSE file in the root directory of this source tree.
51 */var bK={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"};/**
52 * @license lucide-react v0.462.0 - ISC
53 *
54 * This source code is licensed under the ISC license.
55 * See the LICENSE file in the root directory of this source tree.
56 */const wK=y.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:r=2,absoluteStrokeWidth:n,className:s="",children:i,iconNode:o,...l},c)=>y.createElement("svg",{ref:c,...bK,width:t,height:t,stroke:e,strokeWidth:n?Number(r)*24/Number(t):r,className:vD("lucide",s),...l},[...o.map(([u,h])=>y.createElement(u,h)),...Array.isArray(i)?i:[i]]));/**
57 * @license lucide-react v0.462.0 - ISC
58 *
59 * This source code is licensed under the ISC license.
60 * See the LICENSE file in the root directory of this source tree.
61 */const fe=(e,t)=>{const r=y.forwardRef(({className:n,...s},i)=>y.createElement(wK,{ref:i,iconNode:t,className:vD(`lucide-${xK(e)}`,n),...s}));return r.displayName=`${e}`,r};/**
62 * @license lucide-react v0.462.0 - ISC
63 *
64 * This source code is licensed under the ISC license.
65 * See the LICENSE file in the root directory of this source tree.
66 */const jK=fe("Activity",[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l
66-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]]);/**
67 * @license lucide-react v0.462.0 - ISC
68 *
69 * This source code is licensed under the ISC license.
70 * See the LICENSE file in the root directory of this source tree.
71 */const Ll=fe("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);/**
72 * @license lucide-react v0.462.0 - ISC
73 *
74 * This source code is licensed under the ISC license.
75 * See the LICENSE file in the root directory of this source tree.
76 */const rn=fe("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);/**
77 * @license lucide-react v0.462.0 - ISC
78 *
79 * This source code is licensed under the ISC license.
80 * See the LICENSE file in the root directory of this source tree.
81 */const Ec=fe("Award",[["path",{d:"m15.477 12.89 1.515 8.526a.5.5 0 0 1-.81.47l-3.58-2.687a1 1 0 0 0-1.197 0l-3.586 2.686a.5.5 0 0 1-.81-.469l1.514-8.526",key:"1yiouv"}],["circle",{cx:"12",cy:"8",r:"6",key:"1vp47v"}]]);/**
82 * @license lucide-react v0.462.0 - ISC
83 *
84 * This source code is licensed under the ISC license.
85 * See the LICENSE file in the root directory of this source tree.
86 */const Vw=fe("Bell",[["path",{d:"M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9",key:"1qo2s2"}],["path",{d:"M10.3 21a1.94 1.94 0 0 0 3.4 0",key:"qgo35s"}]]);/**
87 * @license lucide-react v0.462.0 - ISC
88 *
89 * This source code is licensed under the ISC license.
90 * See the LICENSE file in the root directory of this source tree.
91 */const Cf=fe("Bird",[["path",{d:"M16 7h.01",key:"1kdx03"}],["path",{d:"M3.4 18H12a8 8 0 0 0 8-8V7a4 4 0 0 0-7.28-2.3L2 20",key:"oj1oa8"}],["path",{d:"m20 7 2 .5-2 .5",key:"12nv4d"}],["path",{d:"M10 18v3",key:"1yea0a"}],["path",{d:"M14 17.75V21",key:"1pymcb"}],["path",{d:"M7 18a6 6 0 0 0 3.84-10.61",key:"1npnn0"}]]);/**
92 * @license lucide-react v0.462.0 - ISC
93 *
94 * This source code is licensed under the ISC license.
95 * See the LICENSE file in the root directory of this source tree.
96 */const wa=fe("BookOpen",[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]]);/**
97 * @license lucide-react v0.462.0 - ISC
98 *
99 * This source code is licensed under the ISC license.
100 * See the LICENSE file in the root directory of this source tree.
101 */const uA=fe("BookText",[["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20",key:"k3hazp"}],["path",{d:"M8 11h8",key:"vwpz6n"}],["path",{d:"M8 7h6",key:"1f0q6e"}]]);/**
102 * @license lucide-react v0.462.0 - ISC
103 *
104 * This source code is licensed under the ISC license.
105 * See the LICENSE file in the root directory of this source tree.
106 */const dA=fe("Brain",[["path",{d:"M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z",key:"l5xja"}],["path",{d:"M12 5a3 3 0 1 1 5.997.125 4 4 0 0 1 2.526 5.77 4 4 0 0 1-.556 6.588A4 4 0 1 1 12 18Z",key:"ep3f8r"}],["path",{d:"M15 13a4.5 4.5 0 0 1-3-4 4.5 4.5 0 0 1-3 4",key:"1p4c4q"}],["path",{d:"M17.599 6.5a3 3 0 0 0 .399-1.375",key:"tmeiqw"}],["path",{d:"M6.003 5.125A3 3 0 0 0 6.401 6.5",key:"105sqy"}],["path",{d:"M3.477 10.896a4 4 0 0 1 .585-.396",key:"ql3yin"}],["path",{d:"M19.938 10.5a4 4 0 0 1 .585.396",key:"1qfode"}],["path",{d:"M6 18a4 4 0 0 1-1.967-.516",key:"2e4loj"}],["path",{d:"M19.967 17.484A4 4 0 0 1 18 18",key:"159ez6"}]]);/**
107 * @license lucide-react v0.462.0 - ISC
108 *
109 * This source code is licensed under the ISC license.
110 * See the LICENSE file in the root directory of this source tree.
111 */const rh=fe("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"}]]);/**
112 * @license lucide-react v0.462.0 - ISC
113 *
114 * This source code is licensed under the ISC license.
115 * See the LICENSE file in the root directory of this source tree.
116 */const _K=fe("Camera",[["path",{d:"M14.5 4h-5L7 7H4a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-3l-2.5-3z",key:"1tc9qg"}],["circle",{cx:"12",cy:"13",r:"3",key:"1vg3eu"}]]);/**
117 * @license lucide-react v0.462.0 - ISC
118 *
119 * This source code is licensed under the ISC license.
120 * See the LICENSE file in the root directory of this source tree.
121 */const e2=fe("ChartColumn",[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]]);/**
122 * @license lucide-react v0.462.0 - ISC
123 *
124 * This source code is licensed under the ISC license.
125 * See the LICENSE file in the root directory of this source tree.
126 */const Ri=fe("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/**
127 * @license lucide-react v0.462.0 - ISC
128 *
129 * This source code is licensed under the ISC license.
130 * See the LICENSE file in the root directory of this source tree.
131 */const Cp=fe("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/**
132 * @license lucide-react v0.462.0 - ISC
133 *
134 * This source code is licensed under the ISC license.
135 * See the LICENSE file in the root directory of this source tree.
136 */const N0=fe("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);/**
137 * @license lucide-react v0.462.0 - ISC
138 *
139 * This source code is licensed under the ISC license.
140 * See the LICENSE file in the root directory of this source tree.
141 */const ns=fe("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/**
142 * @license lucide-react v0.462.0 - ISC
143 *
144 * This source code is licensed under the ISC license.
145 * See the LICENSE file in the root directory of this source tree.
146 */const xD=fe("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);/**
147 * @license lucide-react v0.462.0 - ISC
148 *
149 * This source code is licensed under the ISC license.
150 * See the LICENSE file in the root directory of this source tree.
151 */const cn=fe("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"}]]);/**
152 * @license lucide-react v0.462.0 - ISC
153 *
154 * This source code is licensed under the ISC license.
155 * See the LICENSE file in the root directory of this source tree.
156 */const ot=fe("CircleCheckBig",[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]);/**
157 * @license lucide-react v0.462.0 - ISC
158 *
159 * This source code is licensed under the ISC license.
160 * See the LICENSE file in the root directory of this source tree.
161 */const mr=fe("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/**
162 * @license lucide-react v0.462.0 - ISC
163 *
164 * This source code is licensed under the ISC license.
165 * See the LICENSE file in the root directory of this source tree.
166 */const SK=fe("CircleHelp",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/**
167 * @license lucide-react v0.462.0 - ISC
168 *
169 * This source code is licensed under the ISC license.
170 * See the LICENSE file in the root directory of this source tree.
171 */const jt=fe("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"}]]);/**
172 * @license lucide-react v0.462.0 - ISC
173 *
174 * This source code is licensed under the ISC license.
175 * See the LICENSE file in the root directory of this source tree.
176 */const bD=fe("Circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/**
177 * @license lucide-react v0.462.0 - ISC
178 *
179 * This source code is licensed under the ISC license.
180 * See the LICENSE file in the root directory of this source tree.
181 */const nh=fe("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);/**
182 * @license lucide-react v0.462.0 - ISC
183 *
184 * This source code is licensed under the ISC license.
185 * See the LICENSE file in the root directory of this source tree.
186 */const NK=fe("Code",[["polyline",{points:"16 18 22 12 16 6",key:"z7tu5w"}],["polyline",{points:"8 6 2 12 8 18",key:"1eg1df"}]]);/**
187 * @license lucide-react v0.462.0 - ISC
188 *
189 * This source code is licensed under the ISC license.
190 * See the LICENSE file in the root directory of this source tree.
191 */const Jl=fe("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);/**
192 * @license lucide-react v0.462.0 - ISC
193 *
194 * This source code is licensed under the ISC license.
195 * See the LICENSE file in the root directory of this source tree.
196 */const hA=fe("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"}]]);/**
197 * @license lucide-react v0.462.0 - ISC
198 *
199 * This source code is licensed under the ISC license.
200 * See the LICENSE file in the root directory of this source tree.
201 */const kK=fe("Crown",[["path",{d:"M11.562 3.266a.5.5 0 0 1 .876 0L15.39 8.87a1 1 0 0 0 1.516.294L21.183 5.5a.5.5 0 0 1 .798.519l-2.834 10.246a1 1 0 0 1-.956.734H5.81a1 1 0 0 1-.957-.734L2.02 6.02a.5.5 0 0 1 .798-.519l4.276 3.664a1 1 0 0 0 1.516-.294z",key:"1vdc57"}],["path",{d:"M5 21h14",key:"11awu3"}]]);/**
202 * @license lucide-react v0.462.0 - ISC
203 *
204 * This source code is licensed under the ISC license.
205 * See the LICENSE file in the root directory of this source tree.
206 */const CK=fe("Database",[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]]);/**
207 * @license lucide-react v0.462.0 - ISC
208 *
209 * This source code is licensed under the ISC license.
210 * See the LICENSE file in the root directory of this source tree.
211 */const fA=fe("DoorOpen",[["path",{d:"M13 4h3a2 2 0 0 1 2 2v14",key:"hrm0s9"}],["path",{d:"M2 20h3",key:"1gaodv"}],["path",{d:"M13 20h9",key:"s90cdi"}],["path",{d:"M10 12v.01",key:"vx6srw"}],["path",{d:"M13 4.562v16.157a1 1 0 0 1-1.242.97L5 20V5.562a2 2 0 0 1 1.515-1.94l4-1A2 2 0 0 1 13 4.561Z",key:"199qr4"}]]);/**
212 * @license lucide-react v0.462.0 - ISC
213 *
214 * This source code is licensed under the ISC license.
215 * See the LICENSE file in the root directory of this source tree.
216 */const as=fe("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]);/**
217 * @license lucide-react v0.462.0 - ISC
218 *
219 * This source code is licensed under the ISC license.
220 * See the LICENSE file in the root directory of this source tree.
221 */const ah=fe("Eraser",[["path",{d:"m7 21-4.3-4.3c-1-1-1-2.5 0-3.4l9.6-9.6c1-1 2.5-1 3.4 0l5.6 5.6c1 1 1 2.5 0 3.4L13 21",key:"182aya"}],["path",{d:"M22 21H7",key:"t4ddhn"}],["path",{d:"m5 11 9 9",key:"1mo9qw"}]]);/**
222 * @license lucide-react v0.462.0 - ISC
223 *
224 * This source code is licensed under the ISC license.
225 * See the LICENSE file in the root directory of this source tree.
226 */const md=fe("ExternalLink",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);/**
227 * @license lucide-react v0.462.0 - ISC
228 *
229 * This source code is licensed under the ISC license.
230 * See the LICENSE file in the root directory of this source tree.
231 */const Ws=fe("EyeOff",[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/**
232 * @license lucide-react v0.462.0 - ISC
233 *
234 * This source code is licensed under the ISC license.
235 * See the LICENSE file in the root directory of this source tree.
236 */const fa=fe("Eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/**
237 * @license lucide-react v0.462.0 - ISC
238 *
239 * This source code is licensed under the ISC license.
240 * See the LICENSE file in the root directory of this source tree.
241 */const wv=fe("FileAudio",[["path",{d:"M17.5 22h.5a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v3",key:"rslqgf"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M2 19a2 2 0 1 1 4 0v1a2 2 0 1 1-4 0v-4a6 6 0 0 1 12 0v4a2 2 0 1 1-4 0v-1a2 2 0 1 1 4 0",key:"9f7x3i"}]]);/**
242 * @license lucide-react v0.462.0 - ISC
243 *
244 * This source code is licensed under the ISC license.
245 * See the LICENSE file in the root directory of this source tree.
246 */const wD=fe("FileText",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);/**
247 * @license lucide-react v0.462.0 - ISC
248 *
249 * This source code is licensed under the ISC license.
250 * See the LICENSE file in the root directory of this source tree.
251 */const EK=fe("FileUp",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M12 12v6",key:"3ahymv"}],["path",{d:"m15 15-3-3-3 3",key:"15xj92"}]]);/**
252 * @license lucide-react v0.462.0 - ISC
253 *
254 * This source code is licensed under the ISC license.
255 * See the LICENSE file in the root directory of this source tree.
256 */const t2=fe("Filter",[["polygon",{points:"22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3",key:"1yg77f"}]]);/**
257 * @license lucide-react v0.462.0 - ISC
258 *
259 * This source code is licensed under the ISC license.
260 * See the LICENSE file in the root directory of this source tree.
261 */const ma=fe("Flame",[["path",{d:"M8.5 14.5A2.5 2.5 0 0 0 11 12c0-1.38-.5-2-1-3-1.072-2.143-.224-4.054 2-6 .5 2.5 2 4.9 4 6.5 2 1.6 3 3.5 3 5.5a7 7 0 1 1-14 0c0-1.153.433-2.294 1-3a2.5 2.5 0 0 0 2.5 2.5z",key:"96xj49"}]]);/**
262 * @license lucide-react v0.462.0 - ISC
263 *
264 * This source code is licensed under the ISC license.
265 * See the LICENSE file in the root directory of this source tree.
266 */const Zl=fe("FolderOpen",[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]]);/**
267 * @license lucide-react v0.462.0 - ISC
268 *
269 * This source code is licensed under the ISC license.
270 * See the LICENSE file in the root directory of this source tree.
271 */const r2=fe("Github",[["path",{d:"M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4",key:"tonef"}],["path",{d:"M9 18c-4.51 2-5-2-7-2",key:"9comsn"}]]);/**
272 * @license lucide-react v0.462.0 - ISC
273 *
274 * This source code is licensed under the ISC license.
275 * See the LICENSE file in the root directory of this source tree.
276 */const jv=fe("GraduationCap",[["path",{d:"M21.42 10.922a1 1 0 0 0-.019-1.838L12.83 5.18a2 2 0 0 0-1.66 0L2.6 9.08a1 1 0 0 0 0 1.832l8.57 3.908a2 2 0 0 0 1.66 0z",key:"j76jl0"}],["path",{d:"M22 10v6",key:"1lu8f3"}],["path",{d:"M6 12.5V16a6 3 0 0 0 12 0v-3.5",key:"1r8lef"}]]);/**
277 * @license lucide-react v0.462.0 - ISC
278 *
279 * This source code is licensed under the ISC license.
280 * See the LICENSE file in the root directory of this source tree.
281 */const TK=fe("Grid3x3",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M3 15h18",key:"5xshup"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"M15 3v18",key:"14nvp0"}]]);/**
282 * @license lucide-react v0.462.0 - ISC
283 *
284 * This source code is licensed under the ISC license.
285 * See the LICENSE file in the root directory of this source tree.
286 */const jD=fe("HardDrive",[["line",{x1:"22",x2:"2",y1:"12",y2:"12",key:"1y58io"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}],["line",{x1:"6",x2:"6.01",y1:"16",y2:"16",key:"sgf278"}],["line",{x1:"10",x2:"10.01",y1:"16",y2:"16",key:"1l4acy"}
286]]);/**
287 * @license lucide-react v0.462.0 - ISC
288 *
289 * This source code is licensed under the ISC license.
290 * See the LICENSE file in the root directory of this source tree.
291 */const pd=fe("Headphones",[["path",{d:"M3 14h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-7a9 9 0 0 1 18 0v7a2 2 0 0 1-2 2h-1a2 2 0 0 1-2-2v-3a2 2 0 0 1 2-2h3",key:"1xhozi"}]]);/**
292 * @license lucide-react v0.462.0 - ISC
293 *
294 * This source code is licensed under the ISC license.
295 * See the LICENSE file in the root directory of this source tree.
296 */const _D=fe("Heart",[["path",{d:"M19 14c1.49-1.46 3-3.21 3-5.5A5.5 5.5 0 0 0 16.5 3c-1.76 0-3 .5-4.5 2-1.5-1.5-2.74-2-4.5-2A5.5 5.5 0 0 0 2 8.5c0 2.3 1.5 4.05 3 5.5l7 7Z",key:"c3ymky"}]]);/**
297 * @license lucide-react v0.462.0 - ISC
298 *
299 * This source code is licensed under the ISC license.
300 * See the LICENSE file in the root directory of this source tree.
301 */const mA=fe("House",[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-5.999a2 2 0 0 1 2.582 0l7 5.999A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"1d0kgt"}]]);/**
302 * @license lucide-react v0.462.0 - ISC
303 *
304 * This source code is licensed under the ISC license.
305 * See the LICENSE file in the root directory of this source tree.
306 */const nl=fe("Info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);/**
307 * @license lucide-react v0.462.0 - ISC
308 *
309 * This source code is licensed under the ISC license.
310 * See the LICENSE file in the root directory of this source tree.
311 */const pA=fe("Languages",[["path",{d:"m5 8 6 6",key:"1wu5hv"}],["path",{d:"m4 14 6-6 2-3",key:"1k1g8d"}],["path",{d:"M2 5h12",key:"or177f"}],["path",{d:"M7 2h1",key:"1t2jsx"}],["path",{d:"m22 22-5-10-5 10",key:"don7ne"}],["path",{d:"M14 18h6",key:"1m8k6r"}]]);/**
312 * @license lucide-react v0.462.0 - ISC
313 *
314 * This source code is licensed under the ISC license.
315 * See the LICENSE file in the root directory of this source tree.
316 */const p_=fe("LayoutDashboard",[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]]);/**
317 * @license lucide-react v0.462.0 - ISC
318 *
319 * This source code is licensed under the ISC license.
320 * See the LICENSE file in the root directory of this source tree.
321 */const ec=fe("Lightbulb",[["path",{d:"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5",key:"1gvzjb"}],["path",{d:"M9 18h6",key:"x1upvd"}],["path",{d:"M10 22h4",key:"ceow96"}]]);/**
322 * @license lucide-react v0.462.0 - ISC
323 *
324 * This source code is licensed under the ISC license.
325 * See the LICENSE file in the root directory of this source tree.
326 */const Fe=fe("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/**
327 * @license lucide-react v0.462.0 - ISC
328 *
329 * This source code is licensed under the ISC license.
330 * See the LICENSE file in the root directory of this source tree.
331 */const Ef=fe("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"}]]);/**
332 * @license lucide-react v0.462.0 - ISC
333 *
334 * This source code is licensed under the ISC license.
335 * See the LICENSE file in the root directory of this source tree.
336 */const g_=fe("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"}]]);/**
337 * @license lucide-react v0.462.0 - ISC
338 *
339 * This source code is licensed under the ISC license.
340 * See the LICENSE file in the root directory of this source tree.
341 */const gd=fe("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"}]]);/**
342 * @license lucide-react v0.462.0 - ISC
343 *
344 * This source code is licensed under the ISC license.
345 * See the LICENSE file in the root directory of this source tree.
346 */const gA=fe("MapPin",[["path",{d:"M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0",key:"1r0f0z"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}]]);/**
347 * @license lucide-react v0.462.0 - ISC
348 *
349 * This source code is licensed under the ISC license.
350 * See the LICENSE file in the root directory of this source tree.
351 */const AK=fe("Map",[["path",{d:"M14.106 5.553a2 2 0 0 0 1.788 0l3.659-1.83A1 1 0 0 1 21 4.619v12.764a1 1 0 0 1-.553.894l-4.553 2.277a2 2 0 0 1-1.788 0l-4.212-2.106a2 2 0 0 0-1.788 0l-3.659 1.83A1 1 0 0 1 3 19.381V6.618a1 1 0 0 1 .553-.894l4.553-2.277a2 2 0 0 1 1.788 0z",key:"169xi5"}],["path",{d:"M15 5.764v15",key:"1pn4in"}],["path",{d:"M9 3.236v15",key:"1uimfh"}]]);/**
352 * @license lucide-react v0.462.0 - ISC
353 *
354 * This source code is licensed under the ISC license.
355 * See the LICENSE file in the root directory of this source tree.
356 */const PK=fe("Maximize",[["path",{d:"M8 3H5a2 2 0 0 0-2 2v3",key:"1dcmit"}],["path",{d:"M21 8V5a2 2 0 0 0-2-2h-3",key:"1e4gt3"}],["path",{d:"M3 16v3a2 2 0 0 0 2 2h3",key:"wsl5sc"}],["path",{d:"M16 21h3a2 2 0 0 0 2-2v-3",key:"18trek"}]]);/**
357 * @license lucide-react v0.462.0 - ISC
358 *
359 * This source code is licensed under the ISC license.
360 * See the LICENSE file in the root directory of this source tree.
361 */const OK=fe("Menu",[["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}],["line",{x1:"4",x2:"20",y1:"6",y2:"6",key:"1owob3"}],["line",{x1:"4",x2:"20",y1:"18",y2:"18",key:"yk5zj1"}]]);/**
362 * @license lucide-react v0.462.0 - ISC
363 *
364 * This source code is licensed under the ISC license.
365 * See the LICENSE file in the root directory of this source tree.
366 */const SD=fe("MessageCircle",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}]]);/**
367 * @license lucide-react v0.462.0 - ISC
368 *
369 * This source code is licensed under the ISC license.
370 * See the LICENSE file in the root directory of this source tree.
371 */const yd=fe("MessageSquare",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}]]);/**
372 * @license lucide-react v0.462.0 - ISC
373 *
374 * This source code is licensed under the ISC license.
375 * See the LICENSE file in the root directory of this source tree.
376 */const ND=fe("MicOff",[["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}],["path",{d:"M18.89 13.23A7.12 7.12 0 0 0 19 12v-2",key:"80xlxr"}],["path",{d:"M5 10v2a7 7 0 0 0 12 5",key:"p2k8kg"}],["path",{d:"M15 9.34V5a3 3 0 0 0-5.68-1.33",key:"1gzdoj"}],["path",{d:"M9 9v3a3 3 0 0 0 5.12 2.12",key:"r2i35w"}],["line",{x1:"12",x2:"12",y1:"19",y2:"22",key:"x3vr5v"}]]);/**
377 * @license lucide-react v0.462.0 - ISC
378 *
379 * This source code is licensed under the ISC license.
380 * See the LICENSE file in the root directory of this source tree.
381 */const cc=fe("Mic",[["path",{d:"M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3Z",key:"131961"}],["path",{d:"M19 10v2a7 7 0 0 1-14 0v-2",key:"1vc78b"}],["line",{x1:"12",x2:"12",y1:"19",y2:"22",key:"x3vr5v"}]]);/**
382 * @license lucide-react v0.462.0 - ISC
383 *
384 * This source code is licensed under the ISC license.
385 * See the LICENSE file in the root directory of this source tree.
386 */const MK=fe("MonitorOff",[["path",{d:"M17 17H4a2 2 0 0 1-2-2V5c0-1.5 1-2 1-2",key:"k0q8oc"}],["path",{d:"M22 15V5a2 2 0 0 0-2-2H9",key:"cp1ac0"}],["path",{d:"M8 21h8",key:"1ev6f3"}],["path",{d:"M12 17v4",key:"1riwvh"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/**
387 * @license lucide-react v0.462.0 - ISC
388 *
389 * This source code is licensed under the ISC license.
390 * See the LICENSE file in the root directory of this source tree.
391 */const RK=fe("Monitor",[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]]);/**
392 * @license lucide-react v0.462.0 - ISC
393 *
394 * This source code is licensed under the ISC license.
395 * See the LICENSE file in the root directory of this source tree.
396 */const $K=fe("MousePointer",[["path",{d:"M12.586 12.586 19 19",key:"ea5xo7"}],["path",{d:"M3.688 3.037a.497.497 0 0 0-.651.651l6.5 15.999a.501.501 0 0 0 .947-.062l1.569-6.083a2 2 0 0 1 1.448-1.479l6.124-1.5
39679a.5.5 0 0 0 .063-.947z",key:"277e5u"}]]);/**
397 * @license lucide-react v0.462.0 - ISC
398 *
399 * This source code is licensed under the ISC license.
400 * See the LICENSE file in the root directory of this source tree.
401 */const vd=fe("Music",[["path",{d:"M9 18V5l12-2v13",key:"1jmyc2"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["circle",{cx:"18",cy:"16",r:"3",key:"1hluhg"}]]);/**
402 * @license lucide-react v0.462.0 - ISC
403 *
404 * This source code is licensed under the ISC license.
405 * See the LICENSE file in the root directory of this source tree.
406 */const _v=fe("Palette",[["circle",{cx:"13.5",cy:"6.5",r:".5",fill:"currentColor",key:"1okk4w"}],["circle",{cx:"17.5",cy:"10.5",r:".5",fill:"currentColor",key:"f64h9f"}],["circle",{cx:"8.5",cy:"7.5",r:".5",fill:"currentColor",key:"fotxhn"}],["circle",{cx:"6.5",cy:"12.5",r:".5",fill:"currentColor",key:"qy21gx"}],["path",{d:"M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10c.926 0 1.648-.746 1.648-1.688 0-.437-.18-.835-.437-1.125-.29-.289-.438-.652-.438-1.125a1.64 1.64 0 0 1 1.668-1.668h1.996c3.051 0 5.555-2.503 5.555-5.554C21.965 6.012 17.461 2 12 2z",key:"12rzf8"}]]);/**
407 * @license lucide-react v0.462.0 - ISC
408 *
409 * This source code is licensed under the ISC license.
410 * See the LICENSE file in the root directory of this source tree.
411 */const ss=fe("Pause",[["rect",{x:"14",y:"4",width:"4",height:"16",rx:"1",key:"zuxfzm"}],["rect",{x:"6",y:"4",width:"4",height:"16",rx:"1",key:"1okwgv"}]]);/**
412 * @license lucide-react v0.462.0 - ISC
413 *
414 * This source code is licensed under the ISC license.
415 * See the LICENSE file in the root directory of this source tree.
416 */const Vs=fe("PenLine",[["path",{d:"M12 20h9",key:"t2du7b"}],["path",{d:"M16.376 3.622a1 1 0 0 1 3.002 3.002L7.368 18.635a2 2 0 0 1-.855.506l-2.872.838a.5.5 0 0 1-.62-.62l.838-2.872a2 2 0 0 1 .506-.854z",key:"1ykcvy"}]]);/**
417 * @license lucide-react v0.462.0 - ISC
418 *
419 * This source code is licensed under the ISC license.
420 * See the LICENSE file in the root directory of this source tree.
421 */const IK=fe("PenTool",[["path",{d:"M15.707 21.293a1 1 0 0 1-1.414 0l-1.586-1.586a1 1 0 0 1 0-1.414l5.586-5.586a1 1 0 0 1 1.414 0l1.586 1.586a1 1 0 0 1 0 1.414z",key:"nt11vn"}],["path",{d:"m18 13-1.375-6.874a1 1 0 0 0-.746-.776L3.235 2.028a1 1 0 0 0-1.207 1.207L5.35 15.879a1 1 0 0 0 .776.746L13 18",key:"15qc1e"}],["path",{d:"m2.3 2.3 7.286 7.286",key:"1wuzzi"}],["circle",{cx:"11",cy:"11",r:"2",key:"xmgehs"}]]);/**
422 * @license lucide-react v0.462.0 - ISC
423 *
424 * This source code is licensed under the ISC license.
425 * See the LICENSE file in the root directory of this source tree.
426 */const DK=fe("Pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]);/**
427 * @license lucide-react v0.462.0 - ISC
428 *
429 * This source code is licensed under the ISC license.
430 * See the LICENSE file in the root directory of this source tree.
431 */const Bt=fe("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]]);/**
432 * @license lucide-react v0.462.0 - ISC
433 *
434 * This source code is licensed under the ISC license.
435 * See the LICENSE file in the root directory of this source tree.
436 */const Ep=fe("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/**
437 * @license lucide-react v0.462.0 - ISC
438 *
439 * This source code is licensed under the ISC license.
440 * See the LICENSE file in the root directory of this source tree.
441 */const Xt=fe("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);/**
442 * @license lucide-react v0.462.0 - ISC
443 *
444 * This source code is licensed under the ISC license.
445 * See the LICENSE file in the root directory of this source tree.
446 */const LK=fe("Rewind",[["polygon",{points:"11 19 2 12 11 5 11 19",key:"14yba5"}],["polygon",{points:"22 19 13 12 22 5 22 19",key:"1pi1cj"}]]);/**
447 * @license lucide-react v0.462.0 - ISC
448 *
449 * This source code is licensed under the ISC license.
450 * See the LICENSE file in the root directory of this source tree.
451 */const Gn=fe("RotateCcw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);/**
452 * @license lucide-react v0.462.0 - ISC
453 *
454 * This source code is licensed under the ISC license.
455 * See the LICENSE file in the root directory of this source tree.
456 */const FK=fe("Ruler",[["path",{d:"M21.3 15.3a2.4 2.4 0 0 1 0 3.4l-2.6 2.6a2.4 2.4 0 0 1-3.4 0L2.7 8.7a2.41 2.41 0 0 1 0-3.4l2.6-2.6a2.41 2.41 0 0 1 3.4 0Z",key:"icamh8"}
456],["path",{d:"m14.5 12.5 2-2",key:"inckbg"}],["path",{d:"m11.5 9.5 2-2",key:"fmmyf7"}],["path",{d:"m8.5 6.5 2-2",key:"vc6u1g"}],["path",{d:"m17.5 15.5 2-2",key:"wo5hmg"}]]);/**
457 * @license lucide-react v0.462.0 - ISC
458 *
459 * This source code is licensed under the ISC license.
460 * See the LICENSE file in the root directory of this source tree.
461 */const zK=fe("Save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]);/**
462 * @license lucide-react v0.462.0 - ISC
463 *
464 * This source code is licensed under the ISC license.
465 * See the LICENSE file in the root directory of this source tree.
466 */const Tp=fe("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/**
467 * @license lucide-react v0.462.0 - ISC
468 *
469 * This source code is licensed under the ISC license.
470 * See the LICENSE file in the root directory of this source tree.
471 */const n2=fe("Send",[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]]);/**
472 * @license lucide-react v0.462.0 - ISC
473 *
474 * This source code is licensed under the ISC license.
475 * See the LICENSE file in the root directory of this source tree.
476 */const Sv=fe("Settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/**
477 * @license lucide-react v0.462.0 - ISC
478 *
479 * This source code is licensed under the ISC license.
480 * See the LICENSE file in the root directory of this source tree.
481 */const kD=fe("Share2",[["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}],["circle",{cx:"6",cy:"12",r:"3",key:"w7nqdw"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49",key:"47mynk"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49",key:"1n3mei"}]]);/**
482 * @license lucide-react v0.462.0 - ISC
483 *
484 * This source code is licensed under the ISC license.
485 * See the LICENSE file in the root directory of this source tree.
486 */const Nv=fe("ShieldAlert",[["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",key:"oel41y"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]]);/**
487 * @license lucide-react v0.462.0 - ISC
488 *
489 * This source code is licensed under the ISC license.
490 * See the LICENSE file in the root directory of this source tree.
491 */const kv=fe("ShieldCheck",[["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",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/**
492 * @license lucide-react v0.462.0 - ISC
493 *
494 * This source code is licensed under the ISC license.
495 * See the LICENSE file in the root directory of this source tree.
496 */const gi=fe("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",key:"oel41y"}]]);/**
497 * @license lucide-react v0.462.0 - ISC
498 *
499 * This source code is licensed under the ISC license.
500 * See the LICENSE file in the root directory of this source tree.
501 */const BK=fe("ShoppingBag",[["path",{d:"M6 2 3 6v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V6l-3-4Z",key:"hou9p0"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M16 10a4 4 0 0 1-8 0",key:"1ltviw"}]]);/**
502 * @license lucide-react v0.462.0 - ISC
503 *
504 * This source code is licensed under the ISC license.
505 * See the LICENSE file in the root directory of this source tree.
506 */const yA=fe("Shuffle",[["path",{d:"m18 14 4 4-4 4",key:"10pe0f"}],["path",{d:"m18 2 4 4-4 4",key:"pucp1d"}],["path",{d:"M2 18h1.973a4 4 0 0 0 3.3-1.7l5.454-8.6a4 4 0 0 1 3.3-1.7H22",key:"1ailkh"}],["path",{d:"M2 6h1.972a4 4 0 0 1 3.6 2.2",key:"km57vx"}],["path",{d:"M22 18h-6.041a4 4 0 0 1-3.3-1.8l-.359-.45",key:"os18l9"}]]);/**
507 * @license lucide-react v0.462.0 - ISC
508 *
509 * This source code is licensed under the ISC license.
510 * See the LICENSE file in the root directory of this source tree.
511 */const UK=fe("SkipForward",[["polygon",{points:"5 4 15 12 5 20 5 4",key:"16p6eg"}],["line",{x1:"19",x2:"19",y1:"5",y2:"19",key:"futhcm"}]]);/**
512 * @license lucide-react v0.462.0 - ISC
513 *
514 * This source code is licensed under the ISC license.
515 * See the LICENSE file in the root directory of this source tree.
516 */const WK=fe("Smile",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}
516],["path",{d:"M8 14s1.5 2 4 2 4-2 4-2",key:"1y1vjs"}],["line",{x1:"9",x2:"9.01",y1:"9",y2:"9",key:"yxxnd0"}],["line",{x1:"15",x2:"15.01",y1:"9",y2:"9",key:"1p4y9e"}]]);/**
517 * @license lucide-react v0.462.0 - ISC
518 *
519 * This source code is licensed under the ISC license.
520 * See the LICENSE file in the root directory of this source tree.
521 */const An=fe("Sparkles",[["path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z",key:"4pj2yx"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}],["path",{d:"M4 17v2",key:"vumght"}],["path",{d:"M5 18H3",key:"zchphs"}]]);/**
522 * @license lucide-react v0.462.0 - ISC
523 *
524 * This source code is licensed under the ISC license.
525 * See the LICENSE file in the root directory of this source tree.
526 */const VK=fe("SquarePen",[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]]);/**
527 * @license lucide-react v0.462.0 - ISC
528 *
529 * This source code is licensed under the ISC license.
530 * See the LICENSE file in the root directory of this source tree.
531 */const a2=fe("Square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);/**
532 * @license lucide-react v0.462.0 - ISC
533 *
534 * This source code is licensed under the ISC license.
535 * See the LICENSE file in the root directory of this source tree.
536 */const is=fe("Star",[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]]);/**
537 * @license lucide-react v0.462.0 - ISC
538 *
539 * This source code is licensed under the ISC license.
540 * See the LICENSE file in the root directory of this source tree.
541 */const os=fe("Target",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"6",key:"1vlfrh"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]]);/**
542 * @license lucide-react v0.462.0 - ISC
543 *
544 * This source code is licensed under the ISC license.
545 * See the LICENSE file in the root directory of this source tree.
546 */const Hw=fe("TestTube",[["path",{d:"M14.5 2v17.5c0 1.4-1.1 2.5-2.5 2.5c-1.4 0-2.5-1.1-2.5-2.5V2",key:"125lnx"}],["path",{d:"M8.5 2h7",key:"csnxdl"}],["path",{d:"M14.5 16h-5",key:"1ox875"}]]);/**
547 * @license lucide-react v0.462.0 - ISC
548 *
549 * This source code is licensed under the ISC license.
550 * See the LICENSE file in the root directory of this source tree.
551 */const Ls=fe("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"}]]);/**
552 * @license lucide-react v0.462.0 - ISC
553 *
554 * This source code is licensed under the ISC license.
555 * See the LICENSE file in the root directory of this source tree.
556 */const HK=fe("TrendingDown",[["polyline",{points:"22 17 13.5 8.5 8.5 13.5 2 7",key:"1r2t7k"}],["polyline",{points:"16 17 22 17 22 11",key:"11uiuu"}]]);/**
557 * @license lucide-react v0.462.0 - ISC
558 *
559 * This source code is licensed under the ISC license.
560 * See the LICENSE file in the root directory of this source tree.
561 */const ja=fe("TrendingUp",[["polyline",{points:"22 7 13.5 15.5 8.5 10.5 2 17",key:"126l90"}],["polyline",{points:"16 7 22 7 22 13",key:"kwv8wd"}]]);/**
562 * @license lucide-react v0.462.0 - ISC
563 *
564 * This source code is licensed under the ISC license.
565 * See the LICENSE file in the root directory of this source tree.
566 */const Qr=fe("TriangleAlert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/**
567 * @license lucide-react v0.462.0 - ISC
568 *
569 * This source code is licensed under the ISC license.
570 * See the LICENSE file in the root directory of this source tree.
571 */const lr=fe("Trophy",[["path",{d:"M6 9H4.5a2.5 2.5 0 0 1 0-5H6",key:"17hqa7"}],["path",{d:"M18 9h1.5a2.5 2.5 0 0 0 0-5H18",key:"lmptdp"}],["path",{d:"M4 22h16",key:"57wxv0"}
571],["path",{d:"M10 14.66V17c0 .55-.47.98-.97 1.21C7.85 18.75 7 20.24 7 22",key:"1nw9bq"}],["path",{d:"M14 14.66V17c0 .55.47.98.97 1.21C16.15 18.75 17 20.24 17 22",key:"1np0yb"}],["path",{d:"M18 2H6v7a6 6 0 0 0 12 0V2Z",key:"u46fv3"}]]);/**
572 * @license lucide-react v0.462.0 - ISC
573 *
574 * This source code is licensed under the ISC license.
575 * See the LICENSE file in the root directory of this source tree.
576 */const qK=fe("Twitter",[["path",{d:"M22 4s-.7 2.1-2 3.4c1.6 10-9.4 17.3-18 11.6 2.2.1 4.4-.6 6-2C3 15.5.5 9.6 3 5c2.2 2.6 5.6 4.1 9 4-.9-4.2 4-6.6 7-3.8 1.1 0 3-1.2 3-1.2z",key:"pff0z6"}]]);/**
577 * @license lucide-react v0.462.0 - ISC
578 *
579 * This source code is licensed under the ISC license.
580 * See the LICENSE file in the root directory of this source tree.
581 */const GK=fe("Type",[["polyline",{points:"4 7 4 4 20 4 20 7",key:"1nosan"}],["line",{x1:"9",x2:"15",y1:"20",y2:"20",key:"swin9y"}],["line",{x1:"12",x2:"12",y1:"4",y2:"20",key:"1tx1rr"}]]);/**
582 * @license lucide-react v0.462.0 - ISC
583 *
584 * This source code is licensed under the ISC license.
585 * See the LICENSE file in the root directory of this source tree.
586 */const sm=fe("Upload",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]]);/**
587 * @license lucide-react v0.462.0 - ISC
588 *
589 * This source code is licensed under the ISC license.
590 * See the LICENSE file in the root directory of this source tree.
591 */const y_=fe("UserPlus",[["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"}],["line",{x1:"19",x2:"19",y1:"8",y2:"14",key:"1bvyxn"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]]);/**
592 * @license lucide-react v0.462.0 - ISC
593 *
594 * This source code is licensed under the ISC license.
595 * See the LICENSE file in the root directory of this source tree.
596 */const vA=fe("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"}]]);/**
597 * @license lucide-react v0.462.0 - ISC
598 *
599 * This source code is licensed under the ISC license.
600 * See the LICENSE file in the root directory of this source tree.
601 */const xA=fe("UsersRound",[["path",{d:"M18 21a8 8 0 0 0-16 0",key:"3ypg7q"}],["circle",{cx:"10",cy:"8",r:"5",key:"o932ke"}],["path",{d:"M22 20c0-3.37-2-6.5-4-8a5 5 0 0 0-.45-8.3",key:"10s06x"}]]);/**
602 * @license lucide-react v0.462.0 - ISC
603 *
604 * This source code is licensed under the ISC license.
605 * See the LICENSE file in the root directory of this source tree.
606 */const Xn=fe("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"}]]);/**
607 * @license lucide-react v0.462.0 - ISC
608 *
609 * This source code is licensed under the ISC license.
610 * See the LICENSE file in the root directory of this source tree.
611 */const KK=fe("VideoOff",[["path",{d:"M10.66 6H14a2 2 0 0 1 2 2v2.5l5.248-3.062A.5.5 0 0 1 22 7.87v8.196",key:"w8jjjt"}],["path",{d:"M16 16a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h2",key:"1xawa7"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/**
612 * @license lucide-react v0.462.0 - ISC
613 *
614 * This source code is licensed under the ISC license.
615 * See the LICENSE file in the root directory of this source tree.
616 */const CD=fe("Video",[["path",{d:"m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5",key:"ftymec"}],["rect",{x:"2",y:"6",width:"14",height:"12",rx:"2",key:"158x01"}]]);/**
617 * @license lucide-react v0.462.0 - ISC
618 *
619 * This source code is licensed under the ISC license.
620 * See the LICENSE file in the root directory of this source tree.
621 */const Xe=fe("Volume2",[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["path",{d:"M16 9a5 5 0 0 1 0 6",key:"1q6k2b"}],["path",{d:"M19.364 18.364a9 9 0 0 0 0-12.728",key:"ijwkga"}]]);/**
622 * @license lucide-react v0.462.0 - ISC
623 *
624 * This source code is licensed under the ISC license.
625 * See the LICENSE file in the root directory of this source tree.
626 */const xd=fe("VolumeX",[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["line",{x1:"22",x2:"16",y1:"9",y2:"15",key:"1ewh16"}],["line",{x1:"16",x2:"22",y1:"9",y2:"15",key:"5ykzw1"}]]);/**
627 * @license lucide-react v0.462.0 - ISC
628 *
629 * This source code is licensed under the ISC license.
630 * See the LICENSE file in the root directory of this source tree.
631 */const YK=fe("WandSparkles",[["path",{d:"m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72",key:"ul74o6"}],["path",{d:"m14 7 3 3",key:"1r5n42"}],["path",{d:"M5 6v4",key:"ilb8ba"}],["path",{d:"M19 14v4",key:"blhpug"}],["path",{d:"M10 2v2",key:"7u0qdc"}],["path",{d:"M7 8H3",key:"zfb6yr"}],["path",{d:"M21 16h-4",key:"1cnmox"}],["path",{d:"M11 3H9",key:"1obp7u"}]]);/**
632 * @license lucide-react v0.462.0 - ISC
633 *
634 * This source code is licensed under the ISC license.
635 * See the LICENSE file in the root directory of this source tree.
636 */const Xo=fe("WifiOff",[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}],["path",{d:"M5 12.859a10 10 0 0 1 5.17-2.69",key:"1dl1wf"}],["path",{d:"M19 12.859a10 10 0 0 0-2.007-1.523",key:"4k23kn"}
vendor: 9,440 bytes, lines 636-661
636],["path",{d:"M2 8.82a15 15 0 0 1 4.177-2.643",key:"1grhjp"}],["path",{d:"M22 8.82a15 15 0 0 0-11.288-3.764",key:"z3jwby"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/**
637 * @license lucide-react v0.462.0 - ISC
638 *
639 * This source code is licensed under the ISC license.
640 * See the LICENSE file in the root directory of this source tree.
641 */const XK=fe("Wifi",[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M2 8.82a15 15 0 0 1 20 0",key:"dnpr2z"}],["path",{d:"M5 12.859a10 10 0 0 1 14 0",key:"1x1e6c"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}]]);/**
642 * @license lucide-react v0.462.0 - ISC
643 *
644 * This source code is licensed under the ISC license.
645 * See the LICENSE file in the root directory of this source tree.
646 */const ls=fe("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);/**
647 * @license lucide-react v0.462.0 - ISC
648 *
649 * This source code is licensed under the ISC license.
650 * See the LICENSE file in the root directory of this source tree.
651 */const ED=fe("Zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]);/**
652 * @license lucide-react v0.462.0 - ISC
653 *
654 * This source code is licensed under the ISC license.
655 * See the LICENSE file in the root directory of this source tree.
656 */const QK=fe("ZoomIn",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"11",x2:"11",y1:"8",y2:"14",key:"1vmskp"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]]);/**
657 * @license lucide-react v0.462.0 - ISC
658 *
659 * This source code is licensed under the ISC license.
660 * See the LICENSE file in the root directory of this source tree.
661 */const JK=fe("ZoomOut",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]]),s2="-",ZK=e=>{const t=tY(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=e;return{getClassGroupId:o=>{const l=o.split(s2);return l[0]===""&&l.length!==1&&l.shift(),TD(l,t)||eY(o)},getConflictingClassGroupIds:(o,l)=>{const c=r[o]||[];return l&&n[o]?[...c,...n[o]]:c}}},TD=(e,t)=>{var o;if(e.length===0)return t.classGroupId;const r=e[0],n=t.nextPart.get(r),s=n?TD(e.slice(1),n):void 0;if(s)return s;if(t.validators.length===0)return;const i=e.join(s2);return(o=t.validators.find(({validator:l})=>l(i)))==null?void 0:o.classGroupId},bA=/^\[(.+)\]$/,eY=e=>{if(bA.test(e)){const t=bA.exec(e)[1],r=t==null?void 0:t.substring(0,t.indexOf(":"));if(r)return"arbitrary.."+r}},tY=e=>{const{theme:t,prefix:r}=e,n={nextPart:new Map,validators:[]};return nY(Object.entries(e.classGroups),r).forEach(([i,o])=>{v_(o,n,i,t)}),n},v_=(e,t,r,n)=>{e.forEach(s=>{if(typeof s=="string"){const i=s===""?t:wA(t,s);i.classGroupId=r;return}if(typeof s=="function"){if(rY(s)){v_(s(n),t,r,n);return}t.validators.push({validator:s,classGroupId:r});return}Object.entries(s).forEach(([i,o])=>{v_(o,wA(t,i),r,n)})})},wA=(e,t)=>{let r=e;return t.split(s2).forEach(n=>{r.nextPart.has(n)||r.nextPart.set(n,{nextPart:new Map,validators:[]}),r=r.nextPart.get(n)}),r},rY=e=>e.isThemeGetter,nY=(e,t)=>t?e.map(([r,n])=>{const s=n.map(i=>typeof i=="string"?t+i:typeof i=="object"?Object.fromEntries(Object.entries(i).map(([o,l])=>[t+o,l])):i);return[r,s]}):e,aY=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,r=new Map,n=new Map;const s=(i,o)=>{r.set(i,o),t++,t>e&&(t=0,n=r,r=new Map)};return{get(i){let o=r.get(i);if(o!==void 0)return o;if((o=n.get(i))!==void 0)return s(i,o),o},set(i,o){r.has(i)?r.set(i,o):s(i,o)}}},AD="!",sY=e=>{const{separator:t,experimentalParseClassName:r}=e,n=t.length===1,s=t[0],i=t.length,o=l=>{const c=[];let u=0,h=0,d;for(let v=0;v<l.length;v++){let x=l[v];if(u===0){if(x===s&&(n||l.slice(v,v+i)===t)){c.push(l.slice(h,v)),h=v+i;continue}if(x==="/"){d=v;continue}}x==="["?u++:x==="]"&&u--}const f=c.length===0?l:l.substring(h),m=f.startsWith(AD),g=m?f.substring(1):f,p=d&&d>h?d-h:void 0;return{modifiers:c,hasImportantModifier:m,baseClassName:g,maybePostfixModifierPosition:p}};return r?l=>r({className:l,parseClassName:o}):o},iY=e=>{if(e.length<=1)return e;const t=[];let r=[];return e.forEach(n=>{n[0]==="["?(t.push(...r.sort(),n),r=[]):r.push(n)}),t.push(...r.sort()),t},oY=e=>({cache:aY(e.cacheSize),parseClassName:sY(e),...ZK(e)}),lY=/\s+/,cY=(e,t)=>{const{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:s}=t,i=[],o=e.trim().split(lY);let l="";for(let c=o.length-1;c>=0;c-=1){const u=o[c],{modifiers:h,hasImportantModifier:d,baseClassName:f,maybePostfixModifierPosition:m}=r(u);let g=!!m,p=n(g?f.substring(0,m):f);if(!p){if(!g){l=u+(l.length>0?" "+l:l);continue}if(p=n(f),!p){l=u+(l.length>0?" "+l:l);continue}g=!1}const v=iY(h).join(":"),x=d?v+AD:v,b=x+p;if(i.includes(b))continue;i.push(b);const w=s(p,g);for(let j=0;j<w.length;++j){const _=w[j];i.push(x+_)}l=u+(l.length>0?" "+l:l)}return l};function uY(){let e=0,t,r,n="";for(;e<arguments.length;)(t=arguments[e++])&&(r=PD(t))&&(n&&(n+=" "),n+=r);return n}const PD=e=>{if(typeof e=="string")return e;let t,r="";for(let n=0;n<e.length;n++)e[n]&&(t=PD(e[n]))&&(r&&(r+=" "),r+=t);return r};function dY(e,...t){let r,n,s,i=o;function o(c){const u=t.reduce((h,d)=>d(h),e());return r=oY(u),n=r.cache.get,s=r.cache.set,i=l,l(c)}function l(c){const u=n(c);if(u)return u;const h=cY(c,r);return s(c,h),h}return function(){return i(uY.apply(null,arguments))}}const Pt=e=>{const t=r=>r[e]||[];return t.isThemeGetter=!0,t},OD=/^\[(?:([a-z-]+):)?(.+)\]$/i,hY=/^\d+\/\d+$/,fY=new Set(["px","full","screen"]),mY=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,pY=/\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$/,gY=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,yY=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,vY=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,ai=e=>$u(e)||fY.has(e)||hY.test(e),to=e=>sh(e,"length",kY),$u=e=>!!e&&!Number.isNaN(Number(e)),qw=e=>sh(e,"number",$u),Ih=e=>!!e&&Number.isInteger(Number(e)),xY=e=>e.endsWith("%")&&$u(e.slice(0,-1)),Ke=e=>OD.test(e),ro=e=>mY.test(e),bY=new Set(["length","size","percentage"]),wY=e=>sh(e,bY,MD),jY=e=>sh(e,"position",MD),_Y=new Set(["image","url"]),SY=e=>sh(e,_Y,EY),NY=e=>sh(e,"",CY),Dh=()=>!0,sh=(e,t,r)=>{const n=OD.exec(e);return n?n[1]?typeof t=="string"?n[1]===t:t.has(n[1]):r(n[2]):!1},kY=e=>pY.test(e)&&!gY.test(e),MD=()=>!1,CY=e=>yY.test(e),EY=e=>vY.test(e),TY=()=>{const e=Pt("colors"),t=Pt("spacing"),r=Pt("blur"),n=Pt("brightness"),s=Pt("borderColor"),i=Pt("borderRadius"),o=Pt("borderSpacing"),l=Pt("borderWidth"),c=Pt("contrast"),u=Pt("grayscale"),h=Pt("hueRotate"),d=Pt("invert"),f=Pt("gap"),m=Pt("gradientColorStops"),g=Pt("gradientColorStopPositions"),p=Pt("inset"),v=Pt("margin"),x=Pt("opacity"),b=Pt("padding"),w=Pt("saturate"),j=Pt("scale"),_=Pt("sepia"),S=Pt("skew"),k=Pt("space"),P=Pt("translate"),C=()=>["auto","contain","none"],M=()=>["auto","hidden","clip","visible","scroll"],I=()=>["auto",Ke,t],E=()=>[Ke,t],B=()=>["",ai,to],A=()=>["auto",$u,Ke],L=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],W=()=>["solid","dashed","dotted","double","none"],D=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],U=()=>["start","end","center","between","around","evenly","stretch"],R=()=>["","0",Ke],Q=()=>["auto","avoid","all","avoid-page","page","left","right","column"],K=()=>[$u,Ke];return{cacheSize:500,separator:":",theme:{colors:[Dh],spacing:[ai,to],blur:["none","",ro,Ke],brightness:K(),borderColor:[e],borderRadius:["none","","full",ro,Ke],borderSpacing:E(),borderWidth:B(),contrast:K(),grayscale:R(),hueRotate:K(),invert:R(),gap:E(),gradientColorStops:[e],gradientColorStopPositions:[xY,to],inset:I(),margin:I(),opacity:K(),padding:E(),saturate:K(),scale:K(),sepia:R(),skew:K(),space:E(),translate:E()},classGroups:{aspect:[{aspect:["auto","square","video",Ke]}],container:["container"],columns:[{columns:[ro]}],"break-after":[{"break-after":Q()}],"break-before":[{"break-before":Q()}],"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:[...L(),Ke]}],overflow:[{overflow:M()}],"overflow-x":[{"overflow-x":M()}],"overflow-y":[{"overflow-y":M()}],overscroll:[{overscroll:C()}],"overscroll-x":[{"overscroll-x":C()}],"overscroll-y":[{"overscroll-y":C()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[p]}],"inset-x":[{"inset-x":[p]}],"inset-y":[{"inset-y":[p]}],start:[{start:[p]}],end:[{end:[p]}],top:[{top:[p]}
vendor: 9,005 bytes, line 661
661],right:[{right:[p]}],bottom:[{bottom:[p]}],left:[{left:[p]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",Ih,Ke]}],basis:[{basis:I()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",Ke]}],grow:[{grow:R()}],shrink:[{shrink:R()}],order:[{order:["first","last","none",Ih,Ke]}],"grid-cols":[{"grid-cols":[Dh]}],"col-start-end":[{col:["auto",{span:["full",Ih,Ke]},Ke]}],"col-start":[{"col-start":A()}],"col-end":[{"col-end":A()}],"grid-rows":[{"grid-rows":[Dh]}],"row-start-end":[{row:["auto",{span:[Ih,Ke]},Ke]}],"row-start":[{"row-start":A()}],"row-end":[{"row-end":A()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",Ke]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",Ke]}],gap:[{gap:[f]}],"gap-x":[{"gap-x":[f]}],"gap-y":[{"gap-y":[f]}],"justify-content":[{justify:["normal",...U()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...U(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...U(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[b]}],px:[{px:[b]}],py:[{py:[b]}],ps:[{ps:[b]}],pe:[{pe:[b]}],pt:[{pt:[b]}],pr:[{pr:[b]}],pb:[{pb:[b]}],pl:[{pl:[b]}],m:[{m:[v]}],mx:[{mx:[v]}],my:[{my:[v]}],ms:[{ms:[v]}],me:[{me:[v]}],mt:[{mt:[v]}],mr:[{mr:[v]}],mb:[{mb:[v]}],ml:[{ml:[v]}],"space-x":[{"space-x":[k]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[k]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",Ke,t]}],"min-w":[{"min-w":[Ke,t,"min","max","fit"]}],"max-w":[{"max-w":[Ke,t,"none","full","min","max","fit","prose",{screen:[ro]},ro]}],h:[{h:[Ke,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[Ke,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[Ke,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[Ke,t,"auto","min","max","fit"]}],"font-size":[{text:["base",ro,to]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",qw]}],"font-family":[{font:[Dh]}],"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",Ke]}],"line-clamp":[{"line-clamp":["none",$u,qw]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",ai,Ke]}],"list-image":[{"list-image":["none",Ke]}],"list-style-type":[{list:["none","disc","decimal",Ke]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[x]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[x]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...W(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",ai,to]}],"underline-offset":[{"underline-offset":["auto",ai,Ke]}],"text-decoration-color":[{decoration:[e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:E()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Ke]}],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",Ke]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[x]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...L(),jY]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",wY]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},SY]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[g]}],"gradient-via-pos":[{via:[g]}],"gradient-to-pos":[{to:[g]}],"gradient-from":[{from:[m]}],"gradient-via":[{via:[m]}],"gradient-to":[{to:[m]}],rounded:[{rounded:[i]}],"rounded-s":[{"rounded-s":[i]}],"rounded-e":[{"rounded-e":[i]}],"rounded-t":[{"rounded-t":[i]}],"rounded-r":[{"rounded-r":[i]}],"rounded-b":[{"rounded-b":[i]}],"rounded-l":[{"rounded-l":[i]}],"rounded-ss":[{"rounded-ss":[i]}],"rounded-se":[{"rounded-se":[i]}],"rounded-ee":[{"rounded-ee":[i]}],"rounded-es":[{"rounded-es":[i]}],"rounded-tl":[{"rounded-tl":[i]}],"rounded-tr":[{"rounded-tr":[i]}],"rounded-br":[{"rounded-br":[i]}],"rounded-bl":[{"rounded-bl":[i]}],"border-w":[{border:[l]}],"border-w-x":[{"border-x":[l]}],"border-w-y":[{"border-y":[l]}],"border-w-s":[{"border-s":[l]}],"border-w-e":[{"border-e":[l]}],"border-w-t":[{"border-t":[l]}],"border-w-r":[{"border-r":[l]}],"border-w-b":[{"border-b":[l]}],"border-w-l":[{"border-l":[l]}],"border-opacity":[{"border-opacity":[x]}],"border-style":[{border:[...W(),"hidden"]}],"divide-x":[{"divide-x":[l]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[l]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[x]}],"divide-style":[{divide:W()}],"border-color":[{border:[s]}],"border-color-x":[{"border-x":[s]}],"border-color-y":[{"border-y":[s]}],"border-color-s":[{"border-s":[s]}],"border-color-e":[{"border-e":[s]}],"border-color-t":[{"border-t":[s]}],"border-color-r":[{"border-r":[s]}],"border-color-b":[{"border-b":[s]}],"border-color-l":[{"border-l":[s]}],"divide-color":[{divide:[s]}],"outline-style":[{outline:["",...W()]}],"outline-offset":[{"outline-offset":[ai,Ke]}],"outline-w":[{outline:[ai,to]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:B()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[x]}],"ring-offset-w":[{"ring-offset":[ai,to]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",ro,NY]}],"shadow-color":[{shadow:[Dh]}],opacity:[{opacity:[x]}],"mix-blend":[{"mix-blend":[...D(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":D()}],filter:[{filter:["","none"]}],blur:[{blur:[r]}],brightness:[{brightness:[n]}],contrast:[{contrast:[c]}],"drop-shadow":[{"drop-shadow":["","none",ro,Ke]}],grayscale:[{grayscale:[u]}],"hue-rotate":[{"hue-rotate":[h]}],invert:[{invert:[d]}],saturate:[{saturate:[w]}],sepia:[{sepia:[_]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[r]}],"backdrop-brightness":[{"backdrop-brightness":[n]}],"backdrop-contrast":[{"backdrop-contrast":[c]}],"backdrop-grayscale":[{"backdrop-grayscale":[u]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[h]}],"backdrop-invert":[{"backdrop-invert":[d]}],"backdrop-opacity":[{"backdrop-opacity":[x]}],"backdrop-saturate":[{"backdrop-saturate":[w]}],"backdrop-sepia":[{"backdrop-sepia":[_]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[o]}],"border-spacing-x":[{"border-spacing-x":[o]}],"border-spacing-y":[{"border-spacing-y":[o]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",Ke]}],duration:[{duration:K()}],ease:[{ease:["linear","in","out","in-out",Ke]}],delay:[{delay:K()}],animate:[{animate:["none","spin","ping","pulse","bounce",Ke]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[j]}],"scale-x":[{"scale-x":[j]}],"scale-y":[{"scale-y":[j]}],rotate:[{rotate:[Ih,Ke]}],"translate-x":[{"translate-x":[P]}],"translate-y":[{"translate-y":[P]}],"skew-x":[{"skew-x":[S]}],"skew-y":[{"skew-y":[S]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",Ke]}],accent:[{accent:["auto",e]}],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",
vendor: 4,741 bytes, line 661
661Ke]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":E()}],"scroll-mx":[{"scroll-mx":E()}],"scroll-my":[{"scroll-my":E()}],"scroll-ms":[{"scroll-ms":E()}],"scroll-me":[{"scroll-me":E()}],"scroll-mt":[{"scroll-mt":E()}],"scroll-mr":[{"scroll-mr":E()}],"scroll-mb":[{"scroll-mb":E()}],"scroll-ml":[{"scroll-ml":E()}],"scroll-p":[{"scroll-p":E()}],"scroll-px":[{"scroll-px":E()}],"scroll-py":[{"scroll-py":E()}],"scroll-ps":[{"scroll-ps":E()}],"scroll-pe":[{"scroll-pe":E()}],"scroll-pt":[{"scroll-pt":E()}],"scroll-pr":[{"scroll-pr":E()}],"scroll-pb":[{"scroll-pb":E()}],"scroll-pl":[{"scroll-pl":E()}],"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"]}],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",Ke]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[ai,to,qw]}],stroke:[{stroke:[e,"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"]}}},AY=dY(TY);function je(...e){return AY(nt(e))}const PY=vK,RD=y.forwardRef(({className:e,...t},r)=>a.jsx(dD,{ref:r,className:je("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]",e),...t}));RD.displayName=dD.displayName;const OY=kp("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"}}),$D=y.forwardRef(({className:e,variant:t,...r},n)=>
661a.jsx(hD,{ref:n,className:je(OY({variant:t}),e),...r}));$D.displayName=hD.displayName;const MY=y.forwardRef(({className:e,...t},r)=>a.jsx(pD,{ref:r,className:je("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",e),...t}));MY.displayName=pD.displayName;const ID=y.forwardRef(({className:e,...t},r)=>a.jsx(gD,{ref:r,className:je("absolute right-2 top-2 rounded-md p-1 text-foreground/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",e),"toast-close":"",...t,children:a.jsx(ls,{className:"h-4 w-4"})}));ID.displayName=gD.displayName;const DD=y.forwardRef(({className:e,...t},r)=>a.jsx(fD,{ref:r,className:je("text-sm font-semibold",e),...t}));DD.displayName=fD.displayName;const LD=y.forwardRef(({className:e,...t},r)=>a.jsx(mD,{ref:r,className:je("text-sm opacity-90",e),...t}));LD.displayName=mD.displayName;function RY(){const{toasts:e}=ta();return a.jsxs(PY,{children:[e.map(function({id:t,title:r,description:n,action:s,...i}){return a.jsxs($D,{...i,children:[a.jsxs("div",{className:"grid gap-1",children:[r&&a.jsx(DD,{children:r}),n&&a.jsx(LD,{children:n})]}),s,a.jsx(ID,{})]},t)}),a.jsx(RD,{})]})}var $Y=e=>{switch(e){case"success":return LY;case"info":return zY;case"warning":return FY;case"error":return BY;default:return null}},IY=Array(12).fill(0),DY=({visible:e,className:t})=>J.createElement("div",{className:["sonner-loading-wrapper",t].filter(Boolean).join(" "),"data-visible":e},J.createElement("div",{className:"sonner-spinner"},IY.map((r,n)=>J.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${n}`})))),LY=J.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},J.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"})),FY=J.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},J.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"})),zY=J.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},J.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"})),BY=J.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},J.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"})),UY=J.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"},J.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),J.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),WY=()=>{let[e,t]=J.useState(document.hidden);return J.useEffect(()=>{let r=()=>{t(document.hidden)};return document.addEventListener("visibilitychange",r),()=>window.removeEventListener("visibilitychange",r)},[]),e},x_=1,VY=class{constructor(){this.subscribe=t=>(this.subscribers.push(t),()=>{let r=this.subscribers.indexOf(t);this.subscribers.splice(r,1)}),this.publish=t=>
661{this.subscribers.forEach(r=>r(t))},this.addToast=t=>{this.publish(t),this.toasts=[...this.toasts,t]},this.create=t=>{var r;let{message:n,...s}=t,i=typeof(t==null?void 0:t.id)=="number"||((r=t.id)==null?void 0:r.length)>0?t.id:x_++,o=this.toasts.find(c=>c.id===i),l=t.dismissible===void 0?!0:t.dismissible;return this.dismissedToasts.has(i)&&this.dismissedToasts.delete(i),o?this.toasts=this.toasts.map(c=>c.id===i?(this.publish({...c,...t,id:i,title:n}),{...c,...t,id:i,dismissible:l,title:n}):c):this.addToast({title:n,...s,dismissible:l,id:i}),i},this.dismiss=t=>(this.dismissedToasts.add(t),t||this.toasts.forEach(r=>{this.subscribers.forEach(n=>n({id:r.id,dismiss:!0}))}),this.subscribers.forEach(r=>r({id:t,dismiss:!0})),t),this.message=(t,r)=>this.create({...r,message:t}),this.error=(t,r)=>this.create({...r,message:t,type:"error"}),this.success=(t,r)=>this.create({...r,type:"success",message:t}),this.info=(t,r)=>this.create({...r,type:"info",message:t}),this.warning=(t,r)=>this.create({...r,type:"warning",message:t}),this.loading=(t,r)=>this.create({...r,type:"loading",message:t}),this.promise=(t,r)=>{if(!r)return;let n;r.loading!==void 0&&(n=this.create({...r,promise:t,type:"loading",message:r.loading,description:typeof r.description!="function"?r.description:void 0}));let s=t instanceof Promise?t:t(),i=n!==void 0,o,l=s.then(async u=>{if(o=["resolve",u],J.isValidElement(u))i=!1,this.create({id:n,type:"default",message:u});else if(qY(u)&&!u.ok){i=!1;let h=typeof r.error=="function"?await r.error(`HTTP error! status: ${u.status}`):r.error,d=typeof r.description=="function"?await r.description(`HTTP error! status: ${u.status}`):r.description;this.create({id:n,type:"error",message:h,description:d})}else if(r.success!==void 0){i=!1;let h=typeof r.success=="function"?await r.success(u):r.success,d=typeof r.description=="function"?await r.description(u):r.description;this.create({id:n,type:"success",message:h,description:d})}}).catch(async u=>{if(o=["reject",u],r.error!==void 0){i=!1;let h=typeof r.error=="function"?await r.error(u):r.error,d=typeof r.description=="function"?await r.description(u):r.description;this.create({id:n,type:"error",message:h,description:d})}}).finally(()=>{var u;i&&(this.dismiss(n),n=void 0),(u=r.finally)==null||u.call(r)}),c=()=>new Promise((u,h)=>l.then(()=>o[0]==="reject"?h(o[1]):u(o[1])).catch(h));return typeof n!="string"&&typeof n!="number"?{unwrap:c}:Object.assign(n,{unwrap:c})},this.custom=(t,r)=>{let n=(r==null?void 0:r.id)||x_++;return this.create({jsx:t(n),id:n,...r}),n},this.getActiveToasts=()=>this.toasts.filter(t=>!this.dismissedToasts.has(t.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}},yn=new VY,HY=(e,t)=>{let r=(t==null?void 0:t.id)||x_++;return yn.addToast({title:e,...t,id:r}),r},qY=e=>e&&typeof e=="object"&&"ok"in e&&typeof e.ok=="boolean"&&"status"in e&&typeof e.status=="number",GY=HY,KY=()=>yn.toasts,YY=()=>yn.getActiveToasts(),Pe=Object.assign(GY,{success:yn.success,info:yn.info,warning:yn.warning,error:yn.error,custom:yn.custom,message:yn.message,promise:yn.promise,dismiss:yn.dismiss,loading:yn.loading},{getHistory:KY,getToasts:YY});function XY(e,{insertAt:t}={}){if(typeof document>"u")return;let r=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css",t==="top"&&r.firstChild?r.insertBefore(n,r.firstChild):r.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}XY(`: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;
661left: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}
661: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%);
661--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%)}
662`);function jg(e){return e.label!==void 0}var QY=3,JY="32px",ZY="16px",jA=4e3,eX=356,tX=14,rX=20,nX=200;function Ra(...e){return e.filter(Boolean).join(" ")}function aX(e){let[t,r]=e.split("-"),n=[];return t&&n.push(t),r&&n.push(r),n}var sX=e=>{var t,r,n,s,i,o,l,c,u,h,d;let{invert:f,toast:m,unstyled:g,interacting:p,setHeights:v,visibleToasts:x,heights:b,index:w,toasts:j,expanded:_,removeToast:S,defaultRichColors:k,closeButton:P,style:C,cancelButtonStyle:M,actionButtonStyle:I,className:E="",descriptionClassName:B="",duration:A,position:L,gap:W,loadingIcon:D,expandByDefault:U,classNames:R,icons:Q,closeButtonAriaLabel:K="Close toast",pauseWhenPageIsHidden:z}=e,[N,T]=J.useState(null),[$,V]=J.useState(null),[q,te]=J.useState(!1),[X,ee]=J.useState(!1),[ie,oe]=J.useState(!1),[we,O]=J.useState(!1),[F,Z]=J.useState(!1),[H,G]=J.useState(0),[re,le]=J.useState(0),ce=J.useRef(m.duration||A||jA),ae=J.useRef(null),me=J.useRef(null),xe=w===0,pe=w+1<=x,be=m.type,We=m.dismissible!==!1,Ve=m.className||"",br=m.descriptionClassName||"",ra=J.useMemo(()=>b.findIndex(He=>He.toastId===m.id)||0,[b,m.id]),mn=J.useMemo(()=>{var He;return(He=m.closeButton)!=null?He:P},[m.closeButton,P]),Qi=J.useMemo(()=>m.duration||A||jA,[m.duration,A]),At=J.useRef(0),Ta=J.useRef(0),Lc=J.useRef(0),Ur=J.useRef(null),[Jp,fw]=L.split("-"),Zp=J.useMemo(()=>b.reduce((He,gt,It)=>It>=ra?He:He+gt.height,0),[b,ra]),eg=WY(),tg=m.invert||f,ni=be==="loading";Ta.current=J.useMemo(()=>ra*W+Zp,[ra,Zp]),J.useEffect(()=>{ce.current=Qi},[Qi]),J.useEffect(()=>{te(!0)},[]),J.useEffect(()=>{let He=me.current;if(He){let gt=He.getBoundingClientRect().height;return le(gt),v(It=>[{toastId:m.id,height:gt,position:m.position},...It]),()=>v(It=>It.filter(Aa=>Aa.toastId!==m.id))}},[v,m.id]),J.useLayoutEffect(()=>{if(!q)return;let He=me.current,gt=He.style.height;He.style.height="auto";let It=He.getBoundingClientRect().height;He.style.height=gt,le(It),v(Aa=>Aa.find(Pa=>Pa.toastId===m.id)?Aa.map(Pa=>Pa.toastId===m.id?{...Pa,height:It}:Pa):[{toastId:m.id,height:It,position:m.position},...Aa])},[q,m.title,m.description,v,m.id]);let Mn=J.useCallback(()=>{ee(!0),G(Ta.current),v(He=>He.filter(gt=>gt.toastId!==m.id)),setTimeout(()=>{S(m)},nX)},[m,S,v,Ta]);J.useEffect(()=>{if(m.promise&&be==="loading"||m.duration===1/0||m.type==="loading")return;let He;return _||p||z&&eg?(()=>{if(Lc.current<At.current){let gt=new Date().getTime()-At.current;ce.current=ce.current-gt}
662Lc.current=new Date().getTime()})():ce.current!==1/0&&(At.current=new Date().getTime(),He=setTimeout(()=>{var gt;(gt=m.onAutoClose)==null||gt.call(m,m),Mn()},ce.current)),()=>clearTimeout(He)},[_,p,m,be,z,eg,Mn]),J.useEffect(()=>{m.delete&&Mn()},[Mn,m.delete]);function WV(){var He,gt,It;return Q!=null&&Q.loading?J.createElement("div",{className:Ra(R==null?void 0:R.loader,(He=m==null?void 0:m.classNames)==null?void 0:He.loader,"sonner-loader"),"data-visible":be==="loading"},Q.loading):D?J.createElement("div",{className:Ra(R==null?void 0:R.loader,(gt=m==null?void 0:m.classNames)==null?void 0:gt.loader,"sonner-loader"),"data-visible":be==="loading"},D):J.createElement(DY,{className:Ra(R==null?void 0:R.loader,(It=m==null?void 0:m.classNames)==null?void 0:It.loader),visible:be==="loading"})}return J.createElement("li",{tabIndex:0,ref:me,className:Ra(E,Ve,R==null?void 0:R.toast,(t=m==null?void 0:m.classNames)==null?void 0:t.toast,R==null?void 0:R.default,R==null?void 0:R[be],(r=m==null?void 0:m.classNames)==null?void 0:r[be]),"data-sonner-toast":"","data-rich-colors":(n=m.richColors)!=null?n:k,"data-styled":!(m.jsx||m.unstyled||g),"data-mounted":q,"data-promise":!!m.promise,"data-swiped":F,"data-removed":X,"data-visible":pe,"data-y-position":Jp,"data-x-position":fw,"data-index":w,"data-front":xe,"data-swiping":ie,"data-dismissible":We,"data-type":be,"data-invert":tg,"data-swipe-out":we,"data-swipe-direction":$,"data-expanded":!!(_||U&&q),style:{"--index":w,"--toasts-before":w,"--z-index":j.length-w,"--offset":`${X?H:Ta.current}px`,"--initial-height":U?"auto":`${re}px`,...C,...m.style},onDragEnd:()=>{oe(!1),T(null),Ur.current=null},onPointerDown:He=>{ni||!We||(ae.current=new Date,G(Ta.current),He.target.setPointerCapture(He.pointerId),He.target.tagName!=="BUTTON"&&(oe(!0),Ur.current={x:He.clientX,y:He.clientY}))},onPointerUp:()=>{var He,gt,It,Aa;if(we||!We)return;Ur.current=null;let Pa=Number(((He=me.current)==null?void 0:He.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),Ji=Number(((gt=me.current)==null?void 0:gt.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),pl=new Date().getTime()-((It=ae.current)==null?void 0:It.getTime()),Oa=N==="x"?Pa:Ji,Zi=Math.abs(Oa)/pl;if(Math.abs(Oa)>=rX||Zi>.11){G(Ta.current),(Aa=m.onDismiss)==null||Aa.call(m,m),V(N==="x"?Pa>0?"right":"left":Ji>0?"down":"up"),Mn(),O(!0),Z(!1);return}oe(!1),T(null)},onPointerMove:He=>{var gt,It,Aa,Pa;if(!Ur.current||!We||((gt=window.getSelection())==null?void 0:gt.toString().length)>0)return;let Ji=He.clientY-Ur.current.y,pl=He.clientX-Ur.current.x,Oa=(It=e.swipeDirections)!=null?It:aX(L);!N&&(Math.abs(pl)>1||Math.abs(Ji)>1)&&T(Math.abs(pl)>Math.abs(Ji)?"x":"y");let Zi={x:0,y:0};N==="y"?(Oa.includes("top")||Oa.includes("bottom"))&&(Oa.includes("top")&&Ji<0||Oa.includes("bottom")&&Ji>0)&&(Zi.y=Ji):N==="x"&&(Oa.includes("left")||Oa.includes("right"))&&(Oa.includes("left")&&pl<0||Oa.includes("right")&&pl>0)&&(Zi.x=pl),(Math.abs(Zi.x)>0||Math.abs(Zi.y)>0)&&Z(!0),(Aa=me.current)==null||Aa.style.setProperty("--swipe-amount-x",`${Zi.x}px`),(Pa=me.current)==null||Pa.style.setProperty("--swipe-amount-y",`${Zi.y}px`)}},mn&&!m.jsx?J.createElement("button",{"aria-label":K,"data-disabled":ni,"data-close-button":!0,onClick:ni||!We?()=>{}:()=>{var He;Mn(),(He=m.onDismiss)==null||He.call(m,m)},className:Ra(R==null?void 0:R.closeButton,(s=m==null?void 0:m.classNames)==null?void 0:s.closeButton)},(i=Q==null?void 0:Q.close)!=null?i:UY):null,m.jsx||y.isValidElement(m.title)?m.jsx?m.jsx:typeof m.title=="function"?m.title():m.title:J.createElement(J.Fragment,null,be||m.icon||m.promise?J.createElement("div",{"data-icon":"",className:Ra(R==null?void 0:R.icon,(o=m==null?void 0:m.classNames)==null?void 0:o.icon)},m.promise||m.type==="loading"&&!m.icon?m.icon||WV():null,m.type!=="loading"?m.
vendor: 5,508 bytes, line 662
662icon||(Q==null?void 0:Q[be])||$Y(be):null):null,J.createElement("div",{"data-content":"",className:Ra(R==null?void 0:R.content,(l=m==null?void 0:m.classNames)==null?void 0:l.content)},J.createElement("div",{"data-title":"",className:Ra(R==null?void 0:R.title,(c=m==null?void 0:m.classNames)==null?void 0:c.title)},typeof m.title=="function"?m.title():m.title),m.description?J.createElement("div",{"data-description":"",className:Ra(B,br,R==null?void 0:R.description,(u=m==null?void 0:m.classNames)==null?void 0:u.description)},typeof m.description=="function"?m.description():m.description):null),y.isValidElement(m.cancel)?m.cancel:m.cancel&&jg(m.cancel)?J.createElement("button",{"data-button":!0,"data-cancel":!0,style:m.cancelButtonStyle||M,onClick:He=>{var gt,It;jg(m.cancel)&&We&&((It=(gt=m.cancel).onClick)==null||It.call(gt,He),Mn())},className:Ra(R==null?void 0:R.cancelButton,(h=m==null?void 0:m.classNames)==null?void 0:h.cancelButton)},m.cancel.label):null,y.isValidElement(m.action)?m.action:m.action&&jg(m.action)?J.createElement("button",{"data-button":!0,"data-action":!0,style:m.actionButtonStyle||I,onClick:He=>{var gt,It;jg(m.action)&&((It=(gt=m.action).onClick)==null||It.call(gt,He),!He.defaultPrevented&&Mn())},className:Ra(R==null?void 0:R.actionButton,(d=m==null?void 0:m.classNames)==null?void 0:d.actionButton)},m.action.label):null))};function _A(){if(typeof window>"u"||typeof document>"u")return"ltr";let e=document.documentElement.getAttribute("dir");return e==="auto"||!e?window.getComputedStyle(document.documentElement).direction:e}function iX(e,t){let r={};return[e,t].forEach((n,s)=>{let i=s===1,o=i?"--mobile-offset":"--offset",l=i?ZY:JY;function c(u){["top","right","bottom","left"].forEach(h=>{r[`${o}-${h}`]=typeof u=="number"?`${u}px`:u})}typeof n=="number"||typeof n=="string"?c(n):typeof n=="object"?["top","right","bottom","left"].forEach(u=>{n[u]===void 0?r[`${o}-${u}`]=l:r[`${o}-${u}`]=typeof n[u]=="number"?`${n[u]}px`:n[u]}):c(l)}),r}var oX=y.forwardRef(function(e,t){let{invert:r,position:n="bottom-right",hotkey:s=["altKey","KeyT"],expand:i,closeButton:o,className:l,offset:c,mobileOffset:u,theme:h="light",richColors:d,duration:f,style:m,visibleToasts:g=QY,toastOptions:p,dir:v=_A(),gap:x=tX,loadingIcon:b,icons:w,containerAriaLabel:j="Notifications",pauseWhenPageIsHidden:_}=e,[S,k]=J.useState([]),P=J.useMemo(()=>Array.from(new Set([n].concat(S.filter(z=>z.position).map(z=>z.position)))),[S,n]),[C,M]=J.useState([]),[I,E]=J.useState(!1),[B,A]=J.useState(!1),[L,W]=J.useState(h!=="system"?h:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),D=J.useRef(null),U=s.join("+").replace(/Key/g,"").replace(/Digit/g,""),R=J.useRef(null),Q=J.useRef(!1),K=J.useCallback(z=>{k(N=>{var T;return(T=N.find($=>$.id===z.id))!=null&&T.delete||yn.dismiss(z.id),N.filter(({id:$})=>$!==z.id)})},[]);return J.useEffect(()=>yn.subscribe(z=>{if(z.dismiss){k(N=>N.map(T=>T.id===z.id?{...T,delete:!0}:T));return}setTimeout(()=>{qI.flushSync(()=>{k(N=>{let T=N.findIndex($=>$.id===z.id);return T!==-1?[...N.slice(0,T),{...N[T],...z},...N.slice(T+1)]:[z,...N]})})})}),[]),J.useEffect(()=>{if(h!=="system"){W(h);return}if(h==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?W("dark"):W("light")),typeof window>"u")return;let z=window.matchMedia("(prefers-color-scheme: dark)");try{z.addEventListener("change",({matches:N})=>{W(N?"dark":"light")})}catch{z.addListener(({matches:T})=>{try{W(T?"dark":"light")}catch($){console.error($)}})}},[h]),J.useEffect(()=>{S.length<=1&&E(!1)},[S]),J.useEffect(()=>{let z=N=>{var T,$;s.every(V=>N[V]||N.code===V)&&(E(!0),(T=D.current)==null||T.focus()),N.code==="Escape"&&(document.activeElement===D.current||($=D.current)!=null&&$.contains(document.activeElement))&&E(!1)};return document.addEventListener("keydown",z),()=>document.removeEventListener("keydown",z)},[s]),J.useEffect(()=>{if(D.current)return()=>{R.current&&(R.current.focus({preventScroll:!0}),R.current=null,Q.current=!1)}},[D.current]),J.createElement("section",{ref:t,"aria-label":`${j} ${U}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},P.map((z,N)=>{var T;let[$,V]=z.split("-");return S.length?J.createElement("ol",{key:z,dir:v==="auto"?_A():v,tabIndex:-1,ref:D,className:l,"data-sonner-toaster":!0,"data-theme":L,"data-y-position":$,"data-lifted":I&&S.length>1&&!i,"data-x-position":V,style:{"--front-toast-height":`${((T=C[0])==null?void 0:T.height)||0}px`,"--width":`${eX}px`,"--gap":`${x}px`,...m,...iX(c,u)},onBlur:q=>{Q.current&&!q.currentTarget.contains(q.relatedTarget)&&(Q.current=!1,R.current&&(R.current.focus({preventScroll:!0}),R.current=null))},onFocus:q=>{q.target instanceof HTMLElement&&q.target.dataset.dismissible==="false"||Q.current||(Q.current=!0,R.current=q.relatedTarget)},onMouseEnter:()=>E(!0),onMouseMove:()=>E(!0),onMouseLeave:()=>{B||E(!1)},onDragEnd:()=>E(!1),onPointerDown:q=>{q.target instanceof HTMLElement&&q.target.dataset.dismissible==="false"||A(!0)},onPointerUp:()=>A(!1)},S.filter(q=>!q.position&&N===0||q.position===z).map((q,te)=>{var X,ee;return J.createElement(sX,{key:q.id,icons:w,index:te,toast:q,defaultRichColors:d,duration:(X=p==null?void 0:p.duration)!=null?X:f,className:p==null?void 0:p.className,descriptionClassName:p==null?void 0:p.descriptionClassName,invert:r,visibleToasts:g,closeButton:(ee=p==null?void 0:p.closeButton)!=null?ee:o,interacting:
662B,position:z,style:p==null?void 0:p.style,unstyled:p==null?void 0:p.unstyled,classNames:p==null?void 0:p.classNames,cancelButtonStyle:p==null?void 0:p.cancelButtonStyle,actionButtonStyle:p==null?void 0:p.actionButtonStyle,removeToast:K,toasts:S.filter(ie=>ie.position==q.position),heights:C.filter(ie=>ie.position==q.position),setHeights:M,expandByDefault:i,gap:x,loadingIcon:b,expanded:I,pauseWhenPageIsHidden:_,swipeDirections:e.swipeDirections})})):null}))});const FD=y.createContext(null);function lX({children:e,defaultTheme:t="system",value:r,...n}){const[s,i]=y.useState(()=>{if(typeof window<"u"){const l=localStorage.getItem("theme");return l&&(l==="dark"||l==="light"||l==="system")?l:t}return t});y.useEffect(()=>{const l=window.document.documentElement;if(l.classList.remove("light","dark"),s==="system"){const c=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";l.classList.add(c);return}l.classList.add(s)},[s]);const o={theme:s,setTheme:l=>{localStorage.setItem("theme",l),i(l)}};return a.jsx(FD.Provider,{value:o,...n,children:e})}const cX=()=>{const e=y.useContext(FD);if(!e)throw new Error("useTheme must be used within a ThemeProvider");return e},uX=({...e})=>{const{theme:t}=cX();return a.jsx(oX,{theme:t,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"}},...e})};var dX=o0[" useId ".trim().toString()]||(()=>{}),hX=0;function Tn(e){const[t,r]=y.useState(dX());return Qt(()=>{r(n=>n??String(hX++))},[e]),t?`radix-${t}`:""}const fX=["top","right","bottom","left"],Qo=Math.min,Un=Math.max,Cv=Math.round,_g=Math.floor,Hs=e=>({x:e,y:e}),mX={left:"right",right:"left",bottom:"top",top:"bottom"};function b_(e,t,r){return Un(e,Qo(t,r))}function $i(e,t){return typeof e=="function"?e(t):e}function Ii(e){return e.split("-")[0]}function ih(e){return e.split("-")[1]}function i2(e){return e==="x"?"y":"x"}function o2(e){return e==="y"?"height":"width"}function Fs(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function l2(e){return i2(Fs(e))}function pX(e,t,r){r===void 0&&(r=!1);const n=ih(e),s=l2(e),i=o2(s);let o=s==="x"?n===(r?"end":"start")?"right":"left":n==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(o=Ev(o)),[o,Ev(o)]}function gX(e){const t=Ev(e);return[w_(e),t,w_(t)]}function w_(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const SA=["left","right"],NA=["right","left"],yX=["top","bottom"],vX=["bottom","top"];function xX(e,t,r){switch(e){case"top":case"bottom":return r?t?NA:SA:t?SA:NA;case"left":case"right":return t?yX:vX;default:return[]}}function bX(e,t,r,n){const s=ih(e);let i=xX(Ii(e),r==="start",n);return s&&(i=i.map(o=>o+"-"+s),t&&(i=i.concat(i.map(w_)))),i}function Ev(e){const t=Ii(e);return mX[t]+e.slice(t.length)}function wX(e){return{top:0,right:0,bottom:0,left:0,...e}}function zD(e){return typeof e!="number"?wX(e):{top:e,right:e,bottom:e,left:e}}function Tv(e){const{x:t,y:r,width:n,height:s}=e;return{width:n,height:s,top:r,left:t,right:t+n,bottom:r+s,x:t,y:r}}function kA(e,t,r){let{reference:n,floating:s}=e;const i=Fs(t),o=l2(t),l=o2(o),c=Ii(t),u=i==="y",h=n.x+n.width/2-s.width/2,d=n.y+n.height/2-s.height/2,f=n[l]/2-s[l]/2;let m;switch(c){case"top":m={x:h,y:n.y-s.height};break;case"bottom":m={x:h,y:n.y+n.height};break;case"right":m={x:n.x+n.width,y:d};break;case"left":m={x:n.x-s.width,y:d};break;default:m={x:n.x,y:n.y}}switch(ih(t)){case"start":m[o]-=f*(r&&u?-1:1);break;case"end":m[o]+=f*(r&&u?-1:1);break}return m}async function jX(e,t){var r;t===void 0&&(t={});const{x:n,y:s,platform:i,rects:o,elements:l,strategy:c}=e,{boundary:u="clippingAncestors",rootBoundary:h="viewport",elementContext:d="floating",altBoundary:f=!1,padding:m=0}=$i(t,e),g=zD(m),v=l[f?d==="floating"?"reference":"floating":d],x=Tv(await i.getClippingRect
vendor: 9,666 bytes, line 662
662({element:(r=await(i.isElement==null?void 0:i.isElement(v)))==null||r?v:v.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(l.floating)),boundary:u,rootBoundary:h,strategy:c})),b=d==="floating"?{x:n,y:s,width:o.floating.width,height:o.floating.height}:o.reference,w=await(i.getOffsetParent==null?void 0:i.getOffsetParent(l.floating)),j=await(i.isElement==null?void 0:i.isElement(w))?await(i.getScale==null?void 0:i.getScale(w))||{x:1,y:1}:{x:1,y:1},_=Tv(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:b,offsetParent:w,strategy:c}):b);return{top:(x.top-_.top+g.top)/j.y,bottom:(_.bottom-x.bottom+g.bottom)/j.y,left:(x.left-_.left+g.left)/j.x,right:(_.right-x.right+g.right)/j.x}}const _X=50,SX=async(e,t,r)=>{const{placement:n="bottom",strategy:s="absolute",middleware:i=[],platform:o}=r,l=o.detectOverflow?o:{...o,detectOverflow:jX},c=await(o.isRTL==null?void 0:o.isRTL(t));let u=await o.getElementRects({reference:e,floating:t,strategy:s}),{x:h,y:d}=kA(u,n,c),f=n,m=0;const g={};for(let p=0;p<i.length;p++){const v=i[p];if(!v)continue;const{name:x,fn:b}=v,{x:w,y:j,data:_,reset:S}=await b({x:h,y:d,initialPlacement:n,placement:f,strategy:s,middlewareData:g,rects:u,platform:l,elements:{reference:e,floating:t}});h=w??h,d=j??d,g[x]={...g[x],..._},S&&m<_X&&(m++,typeof S=="object"&&(S.placement&&(f=S.placement),S.rects&&(u=S.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:s}):S.rects),{x:h,y:d}=kA(u,f,c)),p=-1)}return{x:h,y:d,placement:f,strategy:s,middlewareData:g}},NX=e=>({name:"arrow",options:e,async fn(t){const{x:r,y:n,placement:s,rects:i,platform:o,elements:l,middlewareData:c}=t,{element:u,padding:h=0}=$i(e,t)||{};if(u==null)return{};const d=zD(h),f={x:r,y:n},m=l2(s),g=o2(m),p=await o.getDimensions(u),v=m==="y",x=v?"top":"left",b=v?"bottom":"right",w=v?"clientHeight":"clientWidth",j=i.reference[g]+i.reference[m]-f[m]-i.floating[g],_=f[m]-i.reference[m],S=await(o.getOffsetParent==null?void 0:o.getOffsetParent(u));let k=S?S[w]:0;(!k||!await(o.isElement==null?void 0:o.isElement(S)))&&(k=l.floating[w]||i.floating[g]);const P=j/2-_/2,C=k/2-p[g]/2-1,M=Qo(d[x],C),I=Qo(d[b],C),E=M,B=k-p[g]-I,A=k/2-p[g]/2+P,L=b_(E,A,B),W=!c.arrow&&ih(s)!=null&&A!==L&&i.reference[g]/2-(A<E?M:I)-p[g]/2<0,D=W?A<E?A-E:A-B:0;return{[m]:f[m]+D,data:{[m]:L,centerOffset:A-L-D,...W&&{alignmentOffset:D}},reset:W}}}),kX=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var r,n;const{placement:s,middlewareData:i,rects:o,initialPlacement:l,platform:c,elements:u}=t,{mainAxis:h=!0,crossAxis:d=!0,fallbackPlacements:f,fallbackStrategy:m="bestFit",fallbackAxisSideDirection:g="none",flipAlignment:p=!0,...v}=$i(e,t);if((r=i.arrow)!=null&&r.alignmentOffset)return{};const x=Ii(s),b=Fs(l),w=Ii(l)===l,j=await(c.isRTL==null?void 0:c.isRTL(u.floating)),_=f||(w||!p?[Ev(l)]:gX(l)),S=g!=="none";!f&&S&&_.push(...bX(l,p,g,j));const k=[l,..._],P=await c.detectOverflow(t,v),C=[];let M=((n=i.flip)==null?void 0:n.overflows)||[];if(h&&C.push(P[x]),d){const A=pX(s,o,j);C.push(P[A[0]],P[A[1]])}if(M=[...M,{placement:s,overflows:C}],!C.every(A=>A<=0)){var I,E;const A=(((I=i.flip)==null?void 0:I.index)||0)+1,L=k[A];if(L&&(!(d==="alignment"?b!==Fs(L):!1)||M.every(U=>Fs(U.placement)===b?U.overflows[0]>0:!0)))return{data:{index:A,overflows:M},reset:{placement:L}};let W=(E=M.filter(D=>D.overflows[0]<=0).sort((D,U)=>D.overflows[1]-U.overflows[1])[0])==null?void 0:E.placement;if(!W)switch(m){case"bestFit":{var B;const D=(B=M.filter(U=>{if(S){const R=Fs(U.placement);return R===b||R==="y"}return!0}).map(U=>[U.placement,U.overflows.filter(R=>R>0).reduce((R,Q)=>R+Q,0)]).sort((U,R)=>U[1]-R[1])[0])==null?void 0:B[0];D&&(W=D);break}case"initialPlacement":W=l;break}if(s!==W)return{reset:{placement:W}}}return{}}}};function CA(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function EA(e){return fX.some(t=>e[t]>=0)}const CX=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:r,platform:n}=t,{strategy:s="referenceHidden",...i}=$i(e,t);switch(s){case"referenceHidden":{const o=await n.detectOverflow(t,{...i,elementContext:"reference"}),l=CA(o,r.reference);return{data:{referenceHiddenOffsets:l,referenceHidden:EA(l)}}}case"escaped":{const o=await n.detectOverflow(t,{...i,altBoundary:!0}),l=CA(o,r.floating);return{data:{escapedOffsets:l,escaped:EA(l)}}}default:return{}}}}},BD=new Set(["left","top"]);async function EX(e,t){const{placement:r,platform:n,elements:s}=e,i=await(n.isRTL==null?void 0:n.isRTL(s.floating)),o=Ii(r),l=ih(r),c=Fs(r)==="y",u=BD.has(o)?-1:1,h=i&&c?-1:1,d=$i(t,e);let{mainAxis:f,crossAxis:m,alignmentAxis:g}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return l&&typeof g=="number"&&(m=l==="end"?g*-1:g),c?{x:m*h,y:f*u}:{x:f*u,y:m*h}}const TX=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var r,n;const{x:s,y:i,placement:o,middlewareData:l}=t,c=await EX(t,e);return o===((r=l.offset)==null?void 0:r.placement)&&(n=l.arrow)!=null&&n.alignmentOffset?{}:{x:s+c.x,y:i+c.y,data:{...c,placement:o}}}}},AX=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:r,y:n,placement:s,platform:i}=t,{mainAxis:o=!0,crossAxis:l=!1,limiter:c={fn:x=>{let{x:b,y:w}=x;return{x:b,y:w}}},...u}=$i(e,t),h={x:r,y:n},d=await i.detectOverflow(t,u),f=Fs(Ii(s)),m=i2(f);let g=h[m],p=h[f];if(o){const x=m==="y"?"top":"left",b=m==="y"?"bottom":"right",w=g+d[x],j=g-d[b];g=b_(w,g,j)}if(l){const x=f==="y"?"top":"left",b=f==="y"?"bottom":"right",w=p+d[x],j=p-d[b];p=b_(w,p,j)}const v=c.fn({...t,[m]:g,[f]:p});return{...v,data:{x:v.x-r,y:v.y-n,enabled:{[m]:o,[f]:l}}}}}},PX=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:r,y:n,placement:s,rects:i,middlewareData:o}=t,{offset:l=0,mainAxis:c=!0,crossAxis:u=!0}=$i(e,t),h={x:r,y:n},d=Fs(s),f=i2(d);let m=h[f],g=h[d];const p=$i(l,t),v=typeof p=="number"?{mainAxis:p,crossAxis:0}:{mainAxis:0,crossAxis:0,...p};if(c){const w=f==="y"?"height":"width",j=i.reference[f]-i.floating[w]+v.mainAxis,_=i.reference[f]+i.reference[w]-v.mainAxis;m<j?m=j:m>_&&(m=_)}if(u){var x,b;const w=f==="y"?"width":"height",j=BD.has(Ii(s)),_=i.reference[d]-i.floating[w]+(j&&((x=o.offset)==null?void 0:x[d])||0)+(j?0:v.crossAxis),S=i.reference[d]+i.reference[w]+(j?0:((b=o.offset)==null?void 0:b[d])||0)-(j?v.crossAxis:0);g<_?g=_:g>S&&(g=S)}return{[f]:m,[d]:g}}}},OX=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var r,n;const{placement:s,rects:i,platform:o,elements:l}=t,{apply:c=()=>{},...u}=$i(e,t),h=await o.detectOverflow(t,u),d=Ii(s),f=ih(s),m=Fs(s)==="y",{width:g,height:p}=i.floating;let v,x;d==="top"||d==="bottom"?(v=d,x=f===(await(o.isRTL==null?void 0:o.isRTL(l.floating))?"start":"end")?"left":"right"):(x=d,v=f==="end"?"top":"bottom");const b=p-h.top-h.bottom,w=g-h.left-h.right,j=Qo(p-h[v],b),_=Qo(g-h[x],w),S=!t.middlewareData.shift;let k=j,P=_;if((r=t.middlewareData.shift)!=null&&r.enabled.x&&(P=w),(n=t.middlewareData.shift)!=null&&n.enabled.y&&(k=b),S&&!f){const M=Un(h.left,0),I=Un(h.right,0),E=Un(h.top,0),B=Un(h.bottom,0);m?P=g-2*(M!==0||I!==0?M+I:Un(h.left,h.right)):k=p-2*(E!==0||B!==0?E+B:Un(h.top,h.bottom))}await c({...t,availableWidth:P,availableHeight:k});const C=await o.getDimensions(l.floating);return g!==C.width||p!==C.height?{reset:{rects:!0}}:{}}}};function k0(){return typeof window<"u"}function oh(e){return UD(e)?(e.nodeName||"").toLowerCase():"#document"}function Kn(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Zs(e){var t;return(t=(UD(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function UD(e){return k0()?e instanceof Node||e instanceof Kn(e).Node:!1}function cs(e){return k0()?e instanceof Element||e instanceof Kn(e).Element:!1}function Vi(e){return k0()?e instanceof HTMLElement||e instanceof Kn(e).HTMLElement:!1}function TA(e){return!k0()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Kn(e).ShadowRoot}function Ap(e){const{overflow:t,overflowX:r,overflowY:n,display:s}=us(e);return/auto|scroll|overlay|hidden|clip/.test(t+n+r)&&s!=="inline"&&s!=="contents"}function MX(e){return/^(table|td|th)$/.test(oh(e))}function C0(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const RX=/transform|translate|scale|rotate|perspective|filter/,$X=/paint|layout|strict|content/,gl=e=>!!e&&e!=="none";let Gw;function c2(e){const t=cs(e)?us(e):e;return gl(t.transform)||gl(t.translate)||gl(t.scale)||gl(t.rotate)||gl(t.perspective)||!u2()&&(gl(t.backdropFilter)||gl(t.filter))||RX.test(t.willChange||"")||$X.test(t.contain||"")}function IX(e){let t=Jo(e);for(;Vi(t)&&!bd(t);){if(c2(t))return t;if(C0(t))return null;t=Jo(t)}return null}function u2(){return Gw==null&&(Gw=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),Gw}function bd(e){return/^(html|body|#document)$/.test(oh(e))}function us(e){return Kn(e).getComputedStyle(e)}function E0(e){return cs(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Jo(e){if(oh(e)==="html")return e;const t=e.assignedSlot||e.parentNode||TA(e)&&e.host||Zs(e);return TA(t)?t.host:t}function WD(e){const t=Jo(e);return bd(t)?e.ownerDocument?e.ownerDocument.body:e.body:Vi(t)&&Ap(t)?t:WD(t)}function im(e,t,r){var n;t===void 0&&(t=[]),r===void 0&&(r=!0);const s=WD(e),i=s===((n=e.ownerDocument)==null?void 0:n.body),o=Kn(s);if(i){const l=j_(o);
vendor: 14,848 bytes, line 662
662return t.concat(o,o.visualViewport||[],Ap(s)?s:[],l&&r?im(l):[])}else return t.concat(s,im(s,[],r))}function j_(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function VD(e){const t=us(e);let r=parseFloat(t.width)||0,n=parseFloat(t.height)||0;const s=Vi(e),i=s?e.offsetWidth:r,o=s?e.offsetHeight:n,l=Cv(r)!==i||Cv(n)!==o;return l&&(r=i,n=o),{width:r,height:n,$:l}}function d2(e){return cs(e)?e:e.contextElement}function Iu(e){const t=d2(e);if(!Vi(t))return Hs(1);const r=t.getBoundingClientRect(),{width:n,height:s,$:i}=VD(t);let o=(i?Cv(r.width):r.width)/n,l=(i?Cv(r.height):r.height)/s;return(!o||!Number.isFinite(o))&&(o=1),(!l||!Number.isFinite(l))&&(l=1),{x:o,y:l}}const DX=Hs(0);function HD(e){const t=Kn(e);return!u2()||!t.visualViewport?DX:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function LX(e,t,r){return t===void 0&&(t=!1),!r||t&&r!==Kn(e)?!1:t}function uc(e,t,r,n){t===void 0&&(t=!1),r===void 0&&(r=!1);const s=e.getBoundingClientRect(),i=d2(e);let o=Hs(1);t&&(n?cs(n)&&(o=Iu(n)):o=Iu(e));const l=LX(i,r,n)?HD(i):Hs(0);let c=(s.left+l.x)/o.x,u=(s.top+l.y)/o.y,h=s.width/o.x,d=s.height/o.y;if(i){const f=Kn(i),m=n&&cs(n)?Kn(n):n;let g=f,p=j_(g);for(;p&&n&&m!==g;){const v=Iu(p),x=p.getBoundingClientRect(),b=us(p),w=x.left+(p.clientLeft+parseFloat(b.paddingLeft))*v.x,j=x.top+(p.clientTop+parseFloat(b.paddingTop))*v.y;c*=v.x,u*=v.y,h*=v.x,d*=v.y,c+=w,u+=j,g=Kn(p),p=j_(g)}}return Tv({width:h,height:d,x:c,y:u})}function T0(e,t){const r=E0(e).scrollLeft;return t?t.left+r:uc(Zs(e)).left+r}function qD(e,t){const r=e.getBoundingClientRect(),n=r.left+t.scrollLeft-T0(e,r),s=r.top+t.scrollTop;return{x:n,y:s}}function FX(e){let{elements:t,rect:r,offsetParent:n,strategy:s}=e;const i=s==="fixed",o=Zs(n),l=t?C0(t.floating):!1;if(n===o||l&&i)return r;let c={scrollLeft:0,scrollTop:0},u=Hs(1);const h=Hs(0),d=Vi(n);if((d||!d&&!i)&&((oh(n)!=="body"||Ap(o))&&(c=E0(n)),d)){const m=uc(n);u=Iu(n),h.x=m.x+n.clientLeft,h.y=m.y+n.clientTop}const f=o&&!d&&!i?qD(o,c):Hs(0);return{width:r.width*u.x,height:r.height*u.y,x:r.x*u.x-c.scrollLeft*u.x+h.x+f.x,y:r.y*u.y-c.scrollTop*u.y+h.y+f.y}}function zX(e){return Array.from(e.getClientRects())}function BX(e){const t=Zs(e),r=E0(e),n=e.ownerDocument.body,s=Un(t.scrollWidth,t.clientWidth,n.scrollWidth,n.clientWidth),i=Un(t.scrollHeight,t.clientHeight,n.scrollHeight,n.clientHeight);let o=-r.scrollLeft+T0(e);const l=-r.scrollTop;return us(n).direction==="rtl"&&(o+=Un(t.clientWidth,n.clientWidth)-s),{width:s,height:i,x:o,y:l}}const AA=25;function UX(e,t){const r=Kn(e),n=Zs(e),s=r.visualViewport;let i=n.clientWidth,o=n.clientHeight,l=0,c=0;if(s){i=s.width,o=s.height;const h=u2();(!h||h&&t==="fixed")&&(l=s.offsetLeft,c=s.offsetTop)}const u=T0(n);if(u<=0){const h=n.ownerDocument,d=h.body,f=getComputedStyle(d),m=h.compatMode==="CSS1Compat"&&parseFloat(f.marginLeft)+parseFloat(f.marginRight)||0,g=Math.abs(n.clientWidth-d.clientWidth-m);g<=AA&&(i-=g)}else u<=AA&&(i+=u);return{width:i,height:o,x:l,y:c}}function WX(e,t){const r=uc(e,!0,t==="fixed"),n=r.top+e.clientTop,s=r.left+e.clientLeft,i=Vi(e)?Iu(e):Hs(1),o=e.clientWidth*i.x,l=e.clientHeight*i.y,c=s*i.x,u=n*i.y;return{width:o,height:l,x:c,y:u}}function PA(e,t,r){let n;if(t==="viewport")n=UX(e,r);else if(t==="document")n=BX(Zs(e));else if(cs(t))n=WX(t,r);else{const s=HD(e);n={x:t.x-s.x,y:t.y-s.y,width:t.width,height:t.height}}return Tv(n)}function GD(e,t){const r=Jo(e);return r===t||!cs(r)||bd(r)?!1:us(r).position==="fixed"||GD(r,t)}function VX(e,t){const r=t.get(e);if(r)return r;let n=im(e,[],!1).filter(l=>cs(l)&&oh(l)!=="body"),s=null;const i=us(e).position==="fixed";let o=i?Jo(e):e;for(;cs(o)&&!bd(o);){const l=us(o),c=c2(o);!c&&l.position==="fixed"&&(s=null),(i?!c&&!s:!c&&l.position==="static"&&!!s&&(s.position==="absolute"||s.position==="fixed")||Ap(o)&&!c&&GD(e,o))?n=n.filter(h=>h!==o):s=l,o=Jo(o)}return t.set(e,n),n}function HX(e){let{element:t,boundary:r,rootBoundary:n,strategy:s}=e;const o=[...r==="clippingAncestors"?C0(t)?[]:VX(t,this._c):[].concat(r),n],l=PA(t,o[0],s);let c=l.top,u=l.right,h=l.bottom,d=l.left;for(let f=1;f<o.length;f++){const m=PA(t,o[f],s);c=Un(m.top,c),u=Qo(m.right,u),h=Qo(m.bottom,h),d=Un(m.left,d)}return{width:u-d,height:h-c,x:d,y:c}}function qX(e){const{width:t,height:r}=VD(e);return{width:t,height:r}}function GX(e,t,r){const n=Vi(t),s=Zs(t),i=r==="fixed",o=uc(e,!0,i,t);let l={scrollLeft:0,scrollTop:0};const c=Hs(0);function u(){c.x=T0(s)}if(n||!n&&!i)if((oh(t)!=="body"||Ap(s))&&(l=E0(t)),n){const m=uc(t,!0,i,t);c.x=m.x+t.clientLeft,c.y=m.y+t.clientTop}else s&&u();i&&!n&&s&&u();const h=s&&!n&&!i?qD(s,l):Hs(0),d=o.left+l.scrollLeft-c.x-h.x,f=o.top+l.scrollTop-c.y-h.y;return{x:d,y:f,width:o.width,height:o.height}}function Kw(e){return us(e).position==="static"}function OA(e,t){if(!Vi(e)||us(e).position==="fixed")return null;if(t)return t(e);let r=e.offsetParent;return Zs(e)===r&&(r=r.ownerDocument.body),r}function KD(e,t){const r=Kn(e);if(C0(e))return r;if(!Vi(e)){let s=Jo(e);for(;s&&!bd(s);){if(cs(s)&&!Kw(s))return s;s=Jo(s)}return r}let n=OA(e,t);for(;n&&MX(n)&&Kw(n);)n=OA(n,t);return n&&bd(n)&&Kw(n)&&!c2(n)?r:n||IX(e)||r}const KX=async function(e){const t=this.getOffsetParent||KD,r=this.getDimensions,n=await r(e.floating);return{reference:GX(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:n.width,height:n.height}}};function YX(e){return us(e).direction==="rtl"}const XX={convertOffsetParentRelativeRectToViewportRelativeRect:FX,getDocumentElement:Zs,getClippingRect:HX,getOffsetParent:KD,getElementRects:KX,getClientRects:zX,getDimensions:qX,getScale:Iu,isElement:cs,isRTL:YX};function YD(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function QX(e,t){let r=null,n;const s=Zs(e);function i(){var l;clearTimeout(n),(l=r)==null||l.disconnect(),r=null}function o(l,c){l===void 0&&(l=!1),c===void 0&&(c=1),i();const u=e.getBoundingClientRect(),{left:h,top:d,width:f,height:m}=u;if(l||t(),!f||!m)return;const g=_g(d),p=_g(s.clientWidth-(h+f)),v=_g(s.clientHeight-(d+m)),x=_g(h),w={rootMargin:-g+"px "+-p+"px "+-v+"px "+-x+"px",threshold:Un(0,Qo(1,c))||1};let j=!0;function _(S){const k=S[0].intersectionRatio;if(k!==c){if(!j)return o();k?o(!1,k):n=setTimeout(()=>{o(!1,1e-7)},1e3)}k===1&&!YD(u,e.getBoundingClientRect())&&o(),j=!1}try{r=new IntersectionObserver(_,{...w,root:s.ownerDocument})}catch{r=new IntersectionObserver(_,w)}r.observe(e)}return o(!0),i}function JX(e,t,r,n){n===void 0&&(n={});const{ancestorScroll:s=!0,ancestorResize:i=!0,elementResize:o=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:c=!1}=n,u=d2(e),h=s||i?[...u?im(u):[],...t?im(t):[]]:[];h.forEach(x=>{s&&x.addEventListener("scroll",r,{passive:!0}),i&&x.addEventListener("resize",r)});const d=u&&l?QX(u,r):null;let f=-1,m=null;o&&(m=new ResizeObserver(x=>{let[b]=x;b&&b.target===u&&m&&t&&(m.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var w;(w=m)==null||w.observe(t)})),r()}),u&&!c&&m.observe(u),t&&m.observe(t));let g,p=c?uc(e):null;c&&v();function v(){const x=uc(e);p&&!YD(p,x)&&r(),p=x,g=requestAnimationFrame(v)}return r(),()=>{var x;h.forEach(b=>{s&&b.removeEventListener("scroll",r),i&&b.removeEventListener("resize",r)}),d==null||d(),(x=m)==null||x.disconnect(),m=null,c&&cancelAnimationFrame(g)}}const ZX=TX,eQ=AX,tQ=kX,rQ=OX,nQ=CX,MA=NX,aQ=PX,sQ=(e,t,r)=>{const n=new Map,s={platform:XX,...r},i={...s.platform,_c:n};return SX(e,t,{...s,platform:i})};var iQ=typeof document<"u",oQ=function(){},My=iQ?y.useLayoutEffect:oQ;function Av(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let r,n,s;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(r=e.length,r!==t.length)return!1;for(n=r;n--!==0;)if(!Av(e[n],t[n]))return!1;return!0}if(s=Object.keys(e),r=s.length,r!==Object.keys(t).length)return!1;for(n=r;n--!==0;)if(!{}.hasOwnProperty.call(t,s[n]))return!1;for(n=r;n--!==0;){const i=s[n];if(!(i==="_owner"&&e.$$typeof)&&!Av(e[i],t[i]))return!1}return!0}return e!==e&&t!==t}function XD(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function RA(e,t){const r=XD(e);return Math.round(t*r)/r}function Yw(e){const t=y.useRef(e);return My(()=>{t.current=e}),t}function lQ(e){e===void 0&&(e={});const{placement:t="bottom",strategy:r="absolute",middleware:n=[],platform:s,elements:{reference:i,floating:o}={},transform:l=!0,whileElementsMounted:c,open:u}=e,[h,d]=y.useState({x:0,y:0,strategy:r,placement:t,middlewareData:{},isPositioned:!1}),[f,m]=y.useState(n);Av(f,n)||m(n);const[g,p]=y.useState(null),[v,x]=y.useState(null),b=y.useCallback(U=>{U!==S.current&&(S.current=U,p(U))},[]),w=y.useCallback(U=>{U!==k.current&&(k.current=U,x(U))},[]),j=i||g,_=o||v,S=y.useRef(null),k=y.useRef(null),P=y.useRef(h),C=c!=null,M=Yw(c),I=Yw(s),E=Yw(u),B=y.useCallback(()=>{if(!S.current||!k.current)return;const U={placement:t,strategy:r,middleware:f};I.current&&(U.platform=I.current),sQ(S.current,k.current,U).then(R=>{const Q={...R,isPositioned:E.current!==!1};A.current&&!Av(P.current,Q)&&(P.current=Q,kc.flushSync(()=>{d(Q)}))})},[f,t,r,I,E]);My(()=>{u===!1&&P.current.isPositioned&&(P.current.isPositioned=!1,d(U=>({...U,isPositioned:!1})))},[u]);const A=y.useRef(!1);My(()=>(A.current=!0,()=>{A.current=!1}),[]),My(()=>{if(j&&(S.current=j),_&&(k.current=_),j&&_){if(M.current)return M.current(j,_,B);B()}},[j,_,B,M,C]);const L=y.useMemo(()=>({reference:S,floating:k,setReference:b,setFloating:w}),[b,w]),W=y.useMemo(()=>({reference:j,floating:_}),[j,_]),D=y.useMemo(()=>{const U={position:r,left:0,top:0};if(!W.floating)return U;const R=RA(W.floating,h.x),Q=RA(W.floating,h.y);return l?{...U,transform:"translate("+R+"px, "+Q+"px)",...XD(W.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:R,top:Q}},[r,l,W.floating,h.x,h.y]);return y.useMemo(()=>({...h,update:B,refs:L,elements:W,floatingStyles:D}),[h,B,L,W,D])}const cQ=e=>{function t(r){return{}.hasOwnProperty.call(r,"current")}return{name:"arrow",options:e,fn(r){const{element:n,padding:s}=typeof e=="function"?e(r):e;return n&&t(n)?n.current!=null?MA({element:n.current,padding:s}).fn(r):{}:n?MA({element:n,padding:s}).fn(r):{}}}},uQ=(e,t)=>{const r=ZX(e);return{name:r.name,fn:r.fn,options:[e,t]}},dQ=(e,t)=>{const r=eQ(e);return{name:r.name,fn:r.fn,options:[e,t]}},hQ=(e,t)=>({fn:aQ(e).fn,options:[e,t]}),fQ=(e,t)=>{const r=tQ(e);return{name:r.name,fn:r.fn,options:[e,t]}},mQ=(e,t)=>{const r=rQ(e);return{name:r.name,fn:r.fn,options:[e,t]}},pQ=(e,t)=>{const r=nQ(e);return{name:r.name,fn:r.fn,options:[e,t]}},gQ=(e,t)=>{const r=cQ(e);return{name:r.name,fn:r.fn,options:[e,t]}};var yQ="Arrow",QD=y.forwardRef((e,t)=>{const{children:r,width:n=10,height:s=5,...i}=e;return a.jsx(Ce.svg,{...i,ref:t,width:n,height:s,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?r:a.jsx("polygon",{points:"0,0 30,0 15,10"})})});QD.displayName=yQ;var vQ=QD;function A0(e){const[t,r]=y.useState(void 0);return Qt(()=>{if(e){r({width:e.offsetWidth,height:e.offsetHeight});const n=new ResizeObserver(s=>{if(!Array.isArray(s)||!s.length)return;const i=s[0];let o,l;if("borderBoxSize"in i){const c=i.borderBoxSize,u=Array.isArray(c)?c[0]:c;o=u.inlineSize,l=u.blockSize}else o=e.offsetWidth,l=e.offsetHeight;r({width:o,height:l})});return n.observe(e,{box:"border-box"}),()=>n.unobserve(e)}else r(void 0)},[e]),t}var h2="Popper",[JD,al]=Cr(h2),[xQ,ZD]=JD(h2),eL=e=>{const{__scopePopper:t,children:r}=e,[n,s]=y.useState(null);return a.jsx(xQ,{scope:t,anchor:n,onAnchorChange:s,children:r})};eL.displayName=h2;var tL="PopperAnchor",rL=y.forwardRef((e,t)=>{const{__scopePopper:r,virtualRef:n,...s}=e,i=ZD(tL,r),o=y.useRef(null),l=$e(t,o),c=y.useRef(null);return y.useEffect(()=>{const u=c.current;c.current=(n==null?void 0:n.current)||o.current,u!==c.current&&i.onAnchorChange(c.current)}),n?null:a.jsx(Ce.div,{...s,ref:l})});rL.displayName=tL;var f2="PopperContent",[bQ,wQ]=JD(f2),nL=y.forwardRef((e,t)=>{var q,te,X,ee,ie,oe;const{__scopePopper:r,side:n="bottom",sideOffset:s=0,align:i="center",alignOffset:o=0,arrowPadding:l=0,avoidCollisions:c=!0,collisionBoundary:u=[],collisionPadding:h=0,sticky:d="partial",hideWhenDetached:f=!1,updatePositionStrategy:m="optimized",onPlaced:g,...p}=e,v=ZD(f2,r),[x,b]=y.useState(null),w=$e(t,we=>b(we)),[j,_]=y.useState(null),S=A0(j),k=(S==null?void 0:S.width)??0,P=(S==null?void 0:S.height)??0,C=n+(i!=="center"?"-"+i:""),M=typeof h=="number"?h:{top:0,right:0,bottom:0,left:0,...h},I=Array.isArray(u)?u:[u],E=I.length>0,B={padding:M,boundary:I.filter(_Q),altBoundary:E},{refs:A,floatingStyles:L,placement:W,isPositioned:D,middlewareData:U}=lQ({strategy:"fixed",placement:C,whileElementsMounted:(...we)=>JX(...we,{animationFrame:m==="always"}),elements:{reference:v.anchor},middleware:[uQ({mainAxis:s+P,alignmentAxis:o}),c&&dQ({mainAxis:!0,crossAxis:!1,limiter:d==="partial"?hQ():void 0,...B}),c&&fQ({...B}),mQ({...B,apply:({elements:we,rects:O,availableWidth:F,availableHeight:Z})=>{const{width:H,height:G}=O.reference,re=we.floating.style;re.setProperty("--radix-popper-available-width",`${F}px`),re.setProperty("--radix-popper-available-height",`${Z}px`),re.setProperty("--radix-popper-anchor-width",`${H}px`),re.setProperty("--radix-popper-anchor-height",`${G}px`)}}),j&&gQ({element:j,padding:l}),SQ({arrowWidth:k,arrowHeight:P}),f&&pQ({strategy:"referenceHidden",...B})]}),[R,Q]=iL(W),K=Yt(g);Qt(()=>{D&&(K==null||K())},[D,K]);const z=(q=U.arrow)==null?void 0:q.x,N=(te=U.arrow)==null?void 0:te.y,T=((X=U.arrow)==null?void 0:X.centerOffset)!==0,[$,V]=y.useState();return Qt(()=>{x&&V(window.getComputedStyle(x).zIndex)},[x]),a.jsx("div",{ref:A.setFloating,"data-radix-popper-content-wrapper":"",style:{...L,transform:D?L.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:$,"--radix-popper-transform-origin":[(ee=U.transformOrigin)==null?void 0:ee.x,(ie=U.transformOrigin)==null?void 0:ie.y].join(" "),...((oe=U.hide)==null?void 0:oe.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:a.jsx(bQ,{scope:r,placedSide:R,onArrowChange:_,arrowX:z,arrowY:N,shouldHideArrow:T,children:a.jsx(Ce.div,{"data-side":R,"data-align":Q,...p,ref:w,style:{...p.style,animation:D?void 0:"none"}})})})});nL.displayName=f2;var aL="PopperArrow",jQ={top:"bottom",right:"left",bottom:"top",left:"right"},sL=y.forwardRef(function(t,r){const{__scopePopper:n,...s}=t,i=wQ(aL,n),o=jQ[i.placedSide];return a.jsx("span",{ref:i.onArrowChange,style:{position:"absolute",left:i.arrowX,top:i.arrowY,[o]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[i.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[i.placedSide],visibility:i.shouldHideArrow?"hidden":void 0}
vendor: 8,611 bytes, line 662
662,children:a.jsx(vQ,{...s,ref:r,style:{...s.style,display:"block"}})})});sL.displayName=aL;function _Q(e){return e!==null}var SQ=e=>({name:"transformOrigin",options:e,fn(t){var v,x,b;const{placement:r,rects:n,middlewareData:s}=t,o=((v=s.arrow)==null?void 0:v.centerOffset)!==0,l=o?0:e.arrowWidth,c=o?0:e.arrowHeight,[u,h]=iL(r),d={start:"0%",center:"50%",end:"100%"}[h],f=(((x=s.arrow)==null?void 0:x.x)??0)+l/2,m=(((b=s.arrow)==null?void 0:b.y)??0)+c/2;let g="",p="";return u==="bottom"?(g=o?d:`${f}px`,p=`${-c}px`):u==="top"?(g=o?d:`${f}px`,p=`${n.floating.height+c}px`):u==="right"?(g=`${-c}px`,p=o?d:`${m}px`):u==="left"&&(g=`${n.floating.width+c}px`,p=o?d:`${m}px`),{data:{x:g,y:p}}}});function iL(e){const[t,r="center"]=e.split("-");return[t,r]}var P0=eL,Pp=rL,O0=nL,M0=sL,NQ=Symbol("radix.slottable");function kQ(e){const t=({children:r})=>a.jsx(a.Fragment,{children:r});return t.displayName=`${e}.Slottable`,t.__radixId=NQ,t}var[R0]=Cr("Tooltip",[al]),$0=al(),oL="TooltipProvider",CQ=700,__="tooltip.open",[EQ,m2]=R0(oL),lL=e=>{const{__scopeTooltip:t,delayDuration:r=CQ,skipDelayDuration:n=300,disableHoverableContent:s=!1,children:i}=e,o=y.useRef(!0),l=y.useRef(!1),c=y.useRef(0);return y.useEffect(()=>{const u=c.current;return()=>window.clearTimeout(u)},[]),a.jsx(EQ,{scope:t,isOpenDelayedRef:o,delayDuration:r,onOpen:y.useCallback(()=>{window.clearTimeout(c.current),o.current=!1},[]),onClose:y.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>o.current=!0,n)},[n]),isPointerInTransitRef:l,onPointerInTransitChange:y.useCallback(u=>{l.current=u},[]),disableHoverableContent:s,children:i})};lL.displayName=oL;var om="Tooltip",[TQ,I0]=R0(om),cL=e=>{const{__scopeTooltip:t,children:r,open:n,defaultOpen:s,onOpenChange:i,disableHoverableContent:o,delayDuration:l}=e,c=m2(om,e.__scopeTooltip),u=$0(t),[h,d]=y.useState(null),f=Tn(),m=y.useRef(0),g=o??c.disableHoverableContent,p=l??c.delayDuration,v=y.useRef(!1),[x,b]=ln({prop:n,defaultProp:s??!1,onChange:k=>{k?(c.onOpen(),document.dispatchEvent(new CustomEvent(__))):c.onClose(),i==null||i(k)},caller:om}),w=y.useMemo(()=>x?v.current?"delayed-open":"instant-open":"closed",[x]),j=y.useCallback(()=>{window.clearTimeout(m.current),m.current=0,v.current=!1,b(!0)},[b]),_=y.useCallback(()=>{window.clearTimeout(m.current),m.current=0,b(!1)},[b]),S=y.useCallback(()=>{window.clearTimeout(m.current),m.current=window.setTimeout(()=>{v.current=!0,b(!0),m.current=0},p)},[p,b]);return y.useEffect(()=>()=>{m.current&&(window.clearTimeout(m.current),m.current=0)},[]),a.jsx(P0,{...u,children:a.jsx(TQ,{scope:t,contentId:f,open:x,stateAttribute:w,trigger:h,onTriggerChange:d,onTriggerEnter:y.useCallback(()=>{c.isOpenDelayedRef.current?S():j()},[c.isOpenDelayedRef,S,j]),onTriggerLeave:y.useCallback(()=>{g?_():(window.clearTimeout(m.current),m.current=0)},[_,g]),onOpen:j,onClose:_,disableHoverableContent:g,children:r})})};cL.displayName=om;var S_="TooltipTrigger",uL=y.forwardRef((e,t)=>{const{__scopeTooltip:r,...n}=e,s=I0(S_,r),i=m2(S_,r),o=$0(r),l=y.useRef(null),c=$e(t,l,s.onTriggerChange),u=y.useRef(!1),h=y.useRef(!1),d=y.useCallback(()=>u.current=!1,[]);return y.useEffect(()=>()=>document.removeEventListener("pointerup",d),[d]),a.jsx(Pp,{asChild:!0,...o,children:a.jsx(Ce.button,{"aria-describedby":s.open?s.contentId:void 0,"data-state":s.stateAttribute,...n,ref:c,onPointerMove:ye(e.onPointerMove,f=>{f.pointerType!=="touch"&&!h.current&&!i.isPointerInTransitRef.current&&(s.onTriggerEnter(),h.current=!0)}),onPointerLeave:ye(e.onPointerLeave,()=>{s.onTriggerLeave(),h.current=!1}),onPointerDown:ye(e.onPointerDown,()=>{s.open&&s.onClose(),u.current=!0,document.addEventListener("pointerup",d,{once:!0})}),onFocus:ye(e.onFocus,()=>{u.current||s.onOpen()}),onBlur:ye(e.onBlur,s.onClose),onClick:ye(e.onClick,s.onClose)})})});uL.displayName=S_;var AQ="TooltipPortal",[ULe,PQ]=R0(AQ,{forceMount:void 0}),wd="TooltipContent",dL=y.forwardRef((e,t)=>{const r=PQ(wd,e.__scopeTooltip),{forceMount:n=r.forceMount,side:s="top",...i}=e,o=I0(wd,e.__scopeTooltip);return a.jsx(vr,{present:n||o.open,children:o.disableHoverableContent?a.jsx(hL,{side:s,...i,ref:t}):a.jsx(OQ,{side:s,...i,ref:t})})}),OQ=y.forwardRef((e,t)=>{const r=I0(wd,e.__scopeTooltip),n=m2(wd,e.__scopeTooltip),s=y.useRef(null),i=$e(t,s),[o,l]=y.useState(null),{trigger:c,onClose:u}=r,h=s.current,{onPointerInTransitChange:d}=n,f=y.useCallback(()=>{l(null),d(!1)},[d]),m=y.useCallback((g,p)=>{const v=g.currentTarget,x={x:g.clientX,y:g.clientY},b=DQ(x,v.getBoundingClientRect()),w=LQ(x,b),j=FQ(p.getBoundingClientRect()),_=BQ([...w,...j]);l(_),d(!0)},[d]);return y.useEffect(()=>()=>f(),[f]),y.useEffect(()=>{if(c&&h){const g=v=>m(v,h),p=v=>m(v,c);return c.addEventListener("pointerleave",g),h.addEventListener("pointerleave",p),()=>{c.removeEventListener("pointerleave",g),h.removeEventListener("pointerleave",p)}}},[c,h,m,f]),y.useEffect(()=>{if(o){const g=p=>{const v=p.target,x={x:p.clientX,y:p.clientY},b=(c==null?void 0:c.contains(v))||(h==null?void 0:h.contains(v)),w=!zQ(x,o);b?f():w&&(f(),u())};return document.addEventListener("pointermove",g),()=>document.removeEventListener("pointermove",g)}},[c,h,o,u,f]),a.jsx(hL,{...e,ref:i})}),[MQ,RQ]=R0(om,{isInside:!1}),$Q=kQ("TooltipContent"),hL=y.forwardRef((e,t)=>{const{__scopeTooltip:r,children:n,"aria-label":s,onEscapeKeyDown:i,onPointerDownOutside:o,...l}=e,c=I0(wd,r),u=$0(r),{onClose:h}=c;return y.useEffect(()=>(document.addEventListener(__,h),()=>document.removeEventListener(__,h)),[h]),y.useEffect(()=>{if(c.trigger){const d=f=>{const m=f.target;m!=null&&m.contains(c.trigger)&&h()};return window.addEventListener("scroll",d,{capture:!0}),()=>window.removeEventListener("scroll",d,{capture:!0})}},[c.trigger,h]),a.jsx(Cc,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:i,onPointerDownOutside:o,onFocusOutside:d=>d.preventDefault(),onDismiss:h,children:a.jsxs(O0,{"data-state":c.stateAttribute,...u,...l,ref:t,style:{...l.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:[a.jsx($Q,{children:n}),a.jsx(MQ,{scope:r,isInside:!0,children:a.jsx(eK,{id:c.contentId,role:"tooltip",children:s||n})})]})})});dL.displayName=wd;var fL="TooltipArrow",IQ=y.forwardRef((e,t)=>{const{__scopeTooltip:r,...n}=e,s=$0(r);return RQ(fL,r).isInside?null:a.jsx(M0,{...s,...n,ref:t})});IQ.displayName=fL;function DQ(e,t){const r=Math.abs(t.top-e.y),n=Math.abs(t.bottom-e.y),s=Math.abs(t.right-e.x),i=Math.abs(t.left-e.x);switch(Math.min(r,n,s,i)){case i:return"left";case s:return"right";case r:return"top";case n:return"bottom";default:throw new Error("unreachable")}}function LQ(e,t,r=5){const n=[];switch(t){case"top":n.push({x:e.x-r,y:e.y+r},{x:e.x+r,y:e.y+r});break;case"bottom":n.push({x:e.x-r,y:e.y-r},{x:e.x+r,y:e.y-r});break;case"left":n.push({x:e.x+r,y:e.y-r},{x:e.x+r,y:e.y+r});break;case"right":n.push({x:e.x-r,y:e.y-r},{x:e.x-r,y:e.y+r});break}return n}function FQ(e){const{top:t,right:r,bottom:n,left:s}=e;return[{x:s,y:t},{x:r,y:t},{x:r,y:n},{x:s,y:n}]}function zQ(e,t){const{x:r,y:n}=e;let s=!1;for(let i=0,o=t.length-1;i<t.length;o=i++){const l=t[i],c=t[o],u=l.x,h=l.y,d=c.x,f=c.y;h>n!=f>n&&r<(d-u)*(n-h)/(f-h)+u&&(s=!s)}return s}function BQ(e){const t=e.slice();return t.sort((r,n)=>r.x<n.x?-1:r.x>n.x?1:r.y<n.y?-1:r.y>n.y?1:0),UQ(t)}function UQ(e){if(e.length<=1)return e.slice();const t=[];for(let n=0;n<e.length;n++){const s=e[n];for(;t.length>=2;){const i=t[t.length-1],o=t[t.length-2];if((i.x-o.x)*(s.y-o.y)>=(i.y-o.y)*(s.x-o.x))t.pop();else break}t.push(s)}t.pop();const r=[];for(let n=e.length-1;n>=0;n--){const s=e[n];for(;r.length>=2;){const i=r[r.length-1],o=r[r.length-2];if((i.x-o.x)*(s.y-o.y)>=(i.y-o.y)*(s.x-o.x))r.pop();else break}r.push(s)}return r.pop(),t.length===1&&r.length===1&&t[0].x===r[0].x&&t[0].y===r[0].y?t:t.concat(r)}var WQ=lL,VQ=cL,HQ=uL,mL=dL;const p2=WQ,pL=VQ,gL=HQ,g2=y.forwardRef(({className:e,sideOffset:t=4,...r},n)=>a.jsx(mL,{ref:n,sideOffset:t,className:je("z-50 overflow-hidden rounded-md border border-border/40 bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-lg 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]:sli
662de-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...r}));g2.displayName=mL.displayName;var D0=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},Vl,wo,Zu,NR,qQ=(NR=class extends D0{constructor(){super();tt(this,Vl);tt(this,wo);tt(this,Zu);Be(this,Zu,t=>{if(typeof window<"u"&&window.addEventListener){const r=()=>t();return window.addEventListener("visibilitychange",r,!1),()=>{window.removeEventListener("visibilitychange",r)}}})}onSubscribe(){he(this,wo)||this.setEventListener(he(this,Zu))}onUnsubscribe(){var t;this.hasListeners()||((t=he(this,wo))==null||t.call(this),Be(this,wo,void 0))}setEventListener(t){var r;Be(this,Zu,t),(r=he(this,wo))==null||r.call(this),Be(this,wo,t(n=>{typeof n=="boolean"?this.setFocused(n):this.onFocus()}))}setFocused(t){he(this,Vl)!==t&&(Be(this,Vl,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(r=>{r(t)})}isFocused(){var t;return typeof he(this,Vl)=="boolean"?he(this,Vl):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},Vl=new WeakMap,wo=new WeakMap,Zu=new WeakMap,NR),yL=new qQ,GQ={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},jo,tk,kR,KQ=(kR=class{constructor(){tt(this,jo,GQ);tt(this,tk,!1)}setTimeoutProvider(e){Be(this,jo,e)}setTimeout(e,t){return he(this,jo).setTimeout(e,t)}clearTimeout(e){he(this,jo).clearTimeout(e)}setInterval(e,t){return he(this,jo).setInterval(e,t)}clearInterval(e){he(this,jo).clearInterval(e)}},jo=new WeakMap,tk=new WeakMap,kR),N_=new KQ;function YQ(e){setTimeout(e,0)}var XQ=typeof window>"u"||"Deno"in globalThis;function Ba(){}function QQ(e,t){return typeof e=="function"?e(t):e}function JQ(e){return typeof e=="number"&&e>=0&&e!==1/0}function ZQ(e,t){return Math.max(e+(t||0)-Date.now(),0)}function k_(e,t){return typeof e=="function"?e(t):e}function eJ(e,t){return typeof e=="function"?e(t):e}function $A(e,t){const{type:r="all",exact:n,fetchStatus:s,predicate:i,queryKey:o,stale:l}=e;if(o){if(n){if(t.queryHash!==y2(o,t.options))return!1}else if(!cm(t.queryKey,o))return!1}if(r!=="all"){const c=t.isActive();if(r==="active"&&!c||r==="inactive"&&c)return!1}return!(typeof l=="boolean"&&t.isStale()!==l||s&&s!==t.state.fetchStatus||i&&!i(t))}function IA(e,t){const{exact:r,status:n,predicate:s,mutationKey:i}=e;if(i){if(!t.options.mutationKey)return!1;if(r){if(lm(t.options.mutationKey)!==lm(i))return!1}else if(!cm(t.options.mutationKey,i))return!1}return!(n&&t.state.status!==n||s&&!s(t))}function y2(e,t){return((t==null?void 0:t.queryKeyHashFn)||lm)(e)}function lm(e){return JSON.stringify(e,(t,r)=>C_(r)?Object.keys(r).sort().reduce((n,s)=>(n[s]=r[s],n),{}):r)}function cm(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(r=>cm(e[r],t[r])):!1}var tJ=Object.prototype.hasOwnProperty;function vL(e,t,r=0){if(e===t)return e;if(r>500)return t;const n=DA(e)&&DA(t);if(!n&&!(C_(e)&&C_(t)))return t;const i=(n?e:Object.keys(e)).length,o=n?t:Object.keys(t),l=o.length,c=n?new Array(l):{};let u=0;for(let h=0;h<l;h++){const d=n?h:o[h],f=e[d],m=t[d];if(f===m){c[d]=f,(n?h<i:tJ.call(e,d))&&u++;continue}if(f===null||m===null||typeof f!="object"||typeof m!="object"){c[d]=m;continue}const g=vL(f,m,r+1);c[d]=g,g===f&&u++}return i===l&&u===i?e:c}function DA(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function C_(e){if(!LA(e))return!1;const t=e.constructor;if(t===void 0)return!0;const r=t.prototype;return!(!LA(r)||!r.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function LA(e){return Object.prototype.toString.call(e)==="[object Object]"}function rJ(e){return new Promise(t=>{N_.setTimeout(t,e)})}function nJ(e,t,r){return typeof r.structuralSharing=="function"?r.structuralSharing(e,t):r.structuralSharing!==!1?vL(e,t):t}function aJ(e,t,r=0){const n=[...e,t];return r&&n.length>r?n.slice(1):n}function sJ(e,t,r=0){const n=[t,...e];return r&&n.length>r?n.slice(0,-1):n}var v2=Symbol();function xL(e,t){return!e.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!e.queryFn||e.queryFn===v2?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function iJ(e,t,r){let n=!1,s;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(s??(s=t()),n||(n=!0,s.aborted?r():s.addEventListener("abort",r,{once:!0})),s)}),e}var bL=(()=>{let e=()=>XQ;return{isServer(){return e()},setIsServer(t){e=t}}})();function oJ(){let e,t;const r=new Promise((s,i)=>{e=s,t=i});r.status="pending",r.catch(()=>{});function n(s){Object.assign(r,s),delete r.resolve,delete r.reject}return r.resolve=s=>{n({status:"fulfilled",value:s}),e(s)},r.reject=s=>{n({status:"rejected",reason:s}),t(s)},r}var lJ=YQ;function cJ(){let e=[],t=0,r=l=>{l()},n=l=>{l()},s=lJ;const i=l=>{t?e.push(l):s(()=>{r(l)})},o=()=>{const l=e;e=[],l.length&&s(()=>{n(()=>{l.forEach(c=>{r(c)})})})};return{batch:l=>{let c;t++;try{c=l()}finally{t--,t||o()}return c},batchCalls:l=>(...c)=>{i(()=>{l(...c)})},schedule:i,setNotifyFunction:l=>{r=l},setBatchNotifyFunction:l=>{n=l},setScheduler:l=>{s=l}}}var tn=cJ(),ed,_o,td,CR,uJ=(CR=class extends D0{constructor(){super();tt(this,ed,!0);tt(this,_o);tt(this,td);Be(this,td,t=>{if(typeof window<"u"&&window.addEventListener){const r=()=>t(!0),n=()=>t(!1);return window.addEventListener("online",r,!1),window.addEventListener("offline",n,!1),()=>{window.removeEventListener("online",r),window.removeEventListener("offline",n
vendor: 5,737 bytes, line 662
662)}}})}onSubscribe(){he(this,_o)||this.setEventListener(he(this,td))}onUnsubscribe(){var t;this.hasListeners()||((t=he(this,_o))==null||t.call(this),Be(this,_o,void 0))}setEventListener(t){var r;Be(this,td,t),(r=he(this,_o))==null||r.call(this),Be(this,_o,t(this.setOnline.bind(this)))}setOnline(t){he(this,ed)!==t&&(Be(this,ed,t),this.listeners.forEach(n=>{n(t)}))}isOnline(){return he(this,ed)}},ed=new WeakMap,_o=new WeakMap,td=new WeakMap,CR),Pv=new uJ;function dJ(e){return Math.min(1e3*2**e,3e4)}function wL(e){return(e??"online")==="online"?Pv.isOnline():!0}var E_=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function jL(e){let t=!1,r=0,n;const s=oJ(),i=()=>s.status!=="pending",o=p=>{var v;if(!i()){const x=new E_(p);f(x),(v=e.onCancel)==null||v.call(e,x)}},l=()=>{t=!0},c=()=>{t=!1},u=()=>yL.isFocused()&&(e.networkMode==="always"||Pv.isOnline())&&e.canRun(),h=()=>wL(e.networkMode)&&e.canRun(),d=p=>{i()||(n==null||n(),s.resolve(p))},f=p=>{i()||(n==null||n(),s.reject(p))},m=()=>new Promise(p=>{var v;n=x=>{(i()||u())&&p(x)},(v=e.onPause)==null||v.call(e)}).then(()=>{var p;n=void 0,i()||(p=e.onContinue)==null||p.call(e)}),g=()=>{if(i())return;let p;const v=r===0?e.initialPromise:void 0;try{p=v??e.fn()}catch(x){p=Promise.reject(x)}Promise.resolve(p).then(d).catch(x=>{var S;if(i())return;const b=e.retry??(bL.isServer()?0:3),w=e.retryDelay??dJ,j=typeof w=="function"?w(r,x):w,_=b===!0||typeof b=="number"&&r<b||typeof b=="function"&&b(r,x);if(t||!_){f(x);return}r++,(S=e.onFail)==null||S.call(e,r,x),rJ(j).then(()=>u()?void 0:m()).then(()=>{t?f(x):g()})})};return{promise:s,status:()=>s.status,cancel:o,continue:()=>(n==null||n(),s),cancelRetry:l,continueRetry:c,canStart:h,start:()=>(h()?g():m().then(g),s)}}var Hl,ER,_L=(ER=class{constructor(){tt(this,Hl)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),JQ(this.gcTime)&&Be(this,Hl,N_.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(bL.isServer()?1/0:5*60*1e3))}clearGcTimeout(){he(this,Hl)&&(N_.clearTimeout(he(this,Hl)),Be(this,Hl,void 0))}},Hl=new WeakMap,ER),ql,rd,ia,Gl,wr,yp,Kl,Bn,SL,ii,TR,hJ=(TR=class extends _L{constructor(t){super();tt(this,Bn);tt(this,ql);tt(this,rd);tt(this,ia);tt(this,Gl);tt(this,wr);tt(this,yp);tt(this,Kl);Be(this,Kl,!1),Be(this,yp,t.defaultOptions),this.setOptions(t.options),this.observers=[],Be(this,Gl,t.client),Be(this,ia,he(this,Gl).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,Be(this,ql,zA(this.options)),this.state=t.state??he(this,ql),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var t;return(t=he(this,wr))==null?void 0:t.promise}setOptions(t){if(this.options={...he(this,yp),...t},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const r=zA(this.options);r.data!==void 0&&(this.setState(FA(r.data,r.dataUpdatedAt)),Be(this,ql,r))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&he(this,ia).remove(this)}setData(t,r){const n=nJ(this.state.data,t,this.options);return Tr(this,Bn,ii).call(this,{data:n,type:"success",dataUpdatedAt:r==null?void 0:r.updatedAt,manual:r==null?void 0:r.manual}),n}setState(t,r){Tr(this,Bn,ii).call(this,{type:"setState",state:t,setStateOptions:r})}cancel(t){var n,s;const r=(n=he(this,wr))==null?void 0:n.promise;return(s=he(this,wr))==null||s.cancel(t),r?r.then(Ba).catch(Ba):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return he(this,ql)}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(t=>eJ(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===v2||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>k_(t.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(t=0){return this.state.data===void 0?!0:t==="static"?!1:this.state.isInvalidated?!0:!ZQ(this.state.dataUpdatedAt,t)}onFocus(){var r;const t=this.observers.find(n=>n.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(r=he(this,wr))==null||r.continue()}onOnline(){var r;const t=this.observers.find(n=>n.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(r=he(this,wr))==null||r.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),he(this,ia).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(r=>r!==t),this.observers.length||(he(this,wr)&&(he(this,Kl)||Tr(this,Bn,SL).call(this)?he(this,wr).cancel({revert:!0}):he(this,wr).cancelRetry()),this.scheduleGc()),he(this,ia).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||Tr(this,Bn,ii).call(this,{type:"invalidate"})}async fetch(t,r){var c,u,h,d,f,m,g,p,v,x,b,w;if(this.state.fetchStatus!=="idle"&&((c=he(this,wr))==null?void 0:c.status())!=="rejected"){if(this.state.data!==void 0&&(r!=null&&r.cancelRefetch))this.cancel({silent:!0});else if(he(this,wr))return he(this,wr).continueRetry(),he(this,wr).promise}if(t&&this.setOptions(t),!this.options.queryFn){const j=this.observers.find(_=>_.options.queryFn);j&&this.setOptions(j.options)}const n=new AbortController,s=j=>{Object.defineProperty(j,"signal",{enumerable:!0,get:()=>(Be(this,Kl,!0),n.signal)}
662)},i=()=>{const j=xL(this.options,r),S=(()=>{const k={client:he(this,Gl),queryKey:this.queryKey,meta:this.meta};return s(k),k})();return Be(this,Kl,!1),this.options.persister?this.options.persister(j,S,this):j(S)},l=(()=>{const j={fetchOptions:r,options:this.options,queryKey:this.queryKey,client:he(this,Gl),state:this.state,fetchFn:i};return s(j),j})();(u=this.options.behavior)==null||u.onFetch(l,this),Be(this,rd,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((h=l.fetchOptions)==null?void 0:h.meta))&&Tr(this,Bn,ii).call(this,{type:"fetch",meta:(d=l.fetchOptions)==null?void 0:d.meta}),Be(this,wr,jL({initialPromise:r==null?void 0:r.initialPromise,fn:l.fetchFn,onCancel:j=>{j instanceof E_&&j.revert&&this.setState({...he(this,rd),fetchStatus:"idle"}),n.abort()},onFail:(j,_)=>{Tr(this,Bn,ii).call(this,{type:"failed",failureCount:j,error:_})},onPause:()=>{Tr(this,Bn,ii).call(this,{type:"pause"})},onContinue:()=>{Tr(this,Bn,ii).call(this,{type:"continue"})},retry:l.options.retry,retryDelay:l.options.retryDelay,networkMode:l.options.networkMode,canRun:()=>!0}));try{const j=await he(this,wr).start();if(j===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(j),(m=(f=he(this,ia).config).onSuccess)==null||m.call(f,j,this),(p=(g=he(this,ia).config).onSettled)==null||p.call(g,j,this.state.error,this),j}catch(j){if(j instanceof E_){if(j.silent)return he(this,wr).promise;if(j.revert){if(this.state.data===void 0)throw j;return this.state.data}}throw Tr(this,Bn,ii).call(this,{type:"error",error:j}),(x=(v=he(this,ia).config).onError)==null||x.call(v,j,this),(w=(b=he(this,ia).config).onSettled)==null||w.call(b,this.state.data,j,this),j}finally{this.scheduleGc()}}},ql=new WeakMap,rd=new WeakMap,ia=new WeakMap,Gl=new WeakMap,wr=new WeakMap,yp=new WeakMap,Kl=new WeakMap,Bn=new WeakSet,SL=function(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"},ii=function(t){const r=n=>{switch(t.type){case"failed":return{...n,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...n,fetchStatus:"paused"};case"continue":return{...n,fetchStatus:"fetching"};case"fetch":return{...n,...fJ(n.data,this.options),fetchMeta:t.meta??null};case"success":const s={...n,...FA(t.data,t.dataUpdatedAt),dataUpdateCount:n.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return Be(this,rd,t.manual?s:void 0),s;case"error":const i=t.error;return{...n,error:i,errorUpdateCount:n.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:n.fetchFailureCount+1,fetchFailureReason:i,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...n,isInvalidated:!0};case"setState":return{...n,...t.state}}};this.state=r(this.state),tn.batch(()=>{this.observers.forEach(n=>{n.onQueryUpdate()}),he(this,ia).notify({query:this,type:"updated",action:t})})},TR);function fJ(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:wL(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function FA(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function zA(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,r=t!==void 0,n=r?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,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 BA(e){return{onFetch:(t,r)=>{var h,d,f,m,g;const n=t.options,s=(f=(d=(h=t.fetchOptions)==null?void 0:h.meta)==null?void 0:d.fetchMore)==null?void 0:f.direction,i=((m=t.state.data)==null?void 0:m.pages)||[],o=((g=t.state.data)==null?void 0:g.pageParams)||[];let l={pages:[],pageParams:[]},c=0;const u=async()=>{let p=!1;const v=w=>{iJ(w,()=>t.signal,()=>p=!0)},x=xL(t.options,t.fetchOptions),b=async(w,j,_)=>{if(p)return Promise.reject();if(j==null&&w.pages.length)return Promise.resolve(w);const k=(()=>{const I={client:t.client,queryKey:t.queryKey,pageParam:j,direction:_?"backward":"forward",meta:t.options.meta};return v(I),I})(),P=await x(k),{maxPages:C}=t.options,M=_?sJ:aJ;return{pages:M(w.pages,P,C),pageParams:M(w.pageParams,j,C)}};if(s&&i.length){const w=s==="backward",j=w?mJ:UA,_={pages:i,pageParams:o},S=j(n,_);l=await b(_,S,w)}else{const w=e??i.length;do{const j=c===0?o[0]??n.initialPageParam:UA(n,l);if(c>0&&j==null)break;l=await b(l,j),c++}while(c<w)}return l};t.options.persister?t.fetchFn=()=>{var p,v;return(v=(p=t.options).persister)==null?void 0:v.call(p,u,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},r)}:t.fetchFn=u}}}function UA(e,{pages:t,pageParams:r}){const n=t.length-1;return t.length>0?e.getNextPageParam(t[n],t,r[n],r):void 0}function mJ(e,{pages:t,pageParams:r}){var n;return t.length>0?(n=e.getPreviousPageParam)==null?void 0:n.call(e,t[0],t,r[0],r):void 0}var vp,Ps,qr,Yl,Os,io,AR,pJ=(AR=class extends _L{constructor(t){super();tt(this,Os);tt(this,vp);tt(this,Ps);tt(this,qr);tt(this,Yl);Be(this,vp,t.client),this.mutationId=t.mutationId,Be(this,qr,t.mutationCache),Be(this,Ps,[]),this.state=t.state||gJ(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){he(this,Ps).includes(t)||(he(this,Ps).push(t),this.clearGcTimeout(),he(this,qr).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){Be(this,Ps,he(this,Ps).filter(r=>r!==t)),this.scheduleGc(),he(this,qr).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){he(this,Ps).length||(this.state.status==="pending"?this.scheduleGc():he(this,qr).remove(this))}continue(){var t;return((t=he(this,Yl))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var o,l,c,u,h,d,f,m,g,p,v,x,b,w,j,_,S,k;const r=()=>{Tr(this,Os,io).call(this,{type:"continue"})},n={client:he(this,vp),meta:this.options.meta,mutationKey:this.options.mutationKey};Be(this,Yl,jL({fn:()=>this.options.mutationFn?this.options.mutationFn(t,n):Promise.reject(new Error("No mutationFn found")),onFail:(P,C)=>{Tr(this,Os,io).call(this,{type:"failed",failureCount:P,error:C})},onPause:()=>{Tr(this,Os,io).call(this,{type:"pause"})},onContinue:r,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>he(this,qr).canRun(this)}));const s=this.state.status==="pending",i=!he(this,Yl).canStart();try{if(s)r();else{Tr(this,Os,io).call(this,{type:"pending",variables:t,isPaused:i}),he(this,qr).config.onMutate&&await he(this,qr).config.onMutate(t,this,n);
662const C=await((l=(o=this.options).onMutate)==null?void 0:l.call(o,t,n));C!==this.state.context&&Tr(this,Os,io).call(this,{type:"pending",context:C,variables:t,isPaused:i})}const P=await he(this,Yl).start();return await((u=(c=he(this,qr).config).onSuccess)==null?void 0:u.call(c,P,t,this.state.context,this,n)),await((d=(h=this.options).onSuccess)==null?void 0:d.call(h,P,t,this.state.context,n)),await((m=(f=he(this,qr).config).onSettled)==null?void 0:m.call(f,P,null,this.state.variables,this.state.context,this,n)),await((p=(g=this.options).onSettled)==null?void 0:p.call(g,P,null,t,this.state.context,n)),Tr(this,Os,io).call(this,{type:"success",data:P}),P}catch(P){try{await((x=(v=he(this,qr).config).onError)==null?void 0:x.call(v,P,t,this.state.context,this,n))}catch(C){Promise.reject(C)}try{await((w=(b=this.options).onError)==null?void 0:w.call(b,P,t,this.state.context,n))}catch(C){Promise.reject(C)}try{await((_=(j=he(this,qr).config).onSettled)==null?void 0:_.call(j,void 0,P,this.state.variables,this.state.context,this,n))}catch(C){Promise.reject(C)}try{await((k=(S=this.options).onSettled)==null?void 0:k.call(S,void 0,P,t,this.state.context,n))}catch(C){Promise.reject(C)}throw Tr(this,Os,io).call(this,{type:"error",error:P}),P}finally{he(this,qr).runNext(this)}}},vp=new WeakMap,Ps=new WeakMap,qr=new WeakMap,Yl=new WeakMap,Os=new WeakSet,io=function(t){const r=n=>{switch(t.type){case"failed":return{...n,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...n,isPaused:!0};case"continue":return{...n,isPaused:!1};case"pending":return{...n,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...n,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...n,data:void 0,error:t.error,failureCount:n.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=r(this.state),tn.batch(()=>{he(this,Ps).forEach(n=>{n.onMutationUpdate(t)}),he(this,qr).notify({mutation:this,type:"updated",action:t})})},AR);function gJ(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var fi,Wa,xp,PR,yJ=(PR=class extends D0{constructor(t={}){super();tt(this,fi);tt(this,Wa);tt(this,xp);this.config=t,Be(this,fi,new Set),Be(this,Wa,new Map),Be(this,xp,0)}build(t,r,n){const s=new pJ({client:t,mutationCache:this,mutationId:++rg(this,xp)._,options:t.defaultMutationOptions(r),state:n});return this.add(s),s}add(t){he(this,fi).add(t);const r=Sg(t);if(typeof r=="string"){const n=he(this,Wa).get(r);n?n.push(t):he(this,Wa).set(r,[t])}this.notify({type:"added",mutation:t})}remove(t){if(he(this,fi).delete(t)){const r=Sg(t);if(typeof r=="string"){const n=he(this,Wa).get(r);if(n)if(n.length>1){const s=n.indexOf(t);s!==-1&&n.splice(s,1)}else n[0]===t&&he(this,Wa).delete(r)}}this.notify({type:"removed",mutation:t})}canRun(t){const r=Sg(t);if(typeof r=="string"){const n=he(this,Wa).get(r),s=n==null?void 0:n.find(i=>i.state.status==="pending");return!s||s===t}else return!0}runNext(t){var n;const r=Sg(t);if(typeof r=="string"){const s=(n=he(this,Wa).get(r))==null?void 0:n.find(i=>i!==t&&i.state.isPaused);return(s==null?void 0:s.continue())??Promise.resolve()}else return Promise.resolve()}clear(){tn.batch(()=>{he(this,fi).forEach(t=>{this.notify({type:"removed",mutation:t})}),he(this,fi).clear(),he(this,Wa).clear()})}getAll(){return Array.from(he(this,fi))}find(t){const r={exact:!0,...t};return this.getAll().find(n=>IA(r,n))}findAll(t={}){return this.getAll().filter(r=>IA(t,r))}notify(t){tn.batch(()=>{this.listeners.forEach(r=>{r(t)})})}resumePausedMutations(){const t=this.getAll().filter(r=>
vendor: 4,531 bytes, line 662
662r.state.isPaused);return tn.batch(()=>Promise.all(t.map(r=>r.continue().catch(Ba))))}},fi=new WeakMap,Wa=new WeakMap,xp=new WeakMap,PR);function Sg(e){var t;return(t=e.options.scope)==null?void 0:t.id}var Ms,OR,vJ=(OR=class extends D0{constructor(t={}){super();tt(this,Ms);this.config=t,Be(this,Ms,new Map)}build(t,r,n){const s=r.queryKey,i=r.queryHash??y2(s,r);let o=this.get(i);return o||(o=new hJ({client:t,queryKey:s,queryHash:i,options:t.defaultQueryOptions(r),state:n,defaultOptions:t.getQueryDefaults(s)}),this.add(o)),o}add(t){he(this,Ms).has(t.queryHash)||(he(this,Ms).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const r=he(this,Ms).get(t.queryHash);r&&(t.destroy(),r===t&&he(this,Ms).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){tn.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return he(this,Ms).get(t)}getAll(){return[...he(this,Ms).values()]}find(t){const r={exact:!0,...t};return this.getAll().find(n=>$A(r,n))}findAll(t={}){const r=this.getAll();return Object.keys(t).length>0?r.filter(n=>$A(t,n)):r}notify(t){tn.batch(()=>{this.listeners.forEach(r=>{r(t)})})}onFocus(){tn.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){tn.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},Ms=new WeakMap,OR),Ht,So,No,nd,ad,ko,sd,id,MR,xJ=(MR=class{constructor(e={}){tt(this,Ht);tt(this,So);tt(this,No);tt(this,nd);tt(this,ad);tt(this,ko);tt(this,sd);tt(this,id);Be(this,Ht,e.queryCache||new vJ),Be(this,So,e.mutationCache||new yJ),Be(this,No,e.defaultOptions||{}),Be(this,nd,new Map),Be(this,ad,new Map),Be(this,ko,0)}mount(){rg(this,ko)._++,he(this,ko)===1&&(Be(this,sd,yL.subscribe(async e=>{e&&(await this.resumePausedMutations(),he(this,Ht).onFocus())})),Be(this,id,Pv.subscribe(async e=>{e&&(await this.resumePausedMutations(),he(this,Ht).onOnline())})))}unmount(){var e,t;rg(this,ko)._--,he(this,ko)===0&&((e=he(this,sd))==null||e.call(this),Be(this,sd,void 0),(t=he(this,id))==null||t.call(this),Be(this,id,void 0))}isFetching(e){return he(this,Ht).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return he(this,So).findAll({...e,status:"pending"}).length}getQueryData(e){var r;const t=this.defaultQueryOptions({queryKey:e});return(r=he(this,Ht).get(t.queryHash))==null?void 0:r.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),r=he(this,Ht).build(this,t),n=r.state.data;return n===void 0?this.fetchQuery(e):(e.revalidateIfStale&&r.isStaleByTime(k_(t.staleTime,r))&&this.prefetchQuery(t),Promise.resolve(n))}getQueriesData(e){return he(this,Ht).findAll(e).map(({queryKey:t,state:r})=>{const n=r.data;return[t,n]})}setQueryData(e,t,r){const n=this.defaultQueryOptions({queryKey:e}),s=he(this,Ht).get(n.queryHash),i=s==null?void 0:s.state.data,o=QQ(t,i);if(o!==void 0)return he(this,Ht).build(this,n).setData(o,{...r,manual:!0})}setQueriesData(e,t,r){return tn.batch(()=>he(this,Ht).findAll(e).map(({queryKey:n})=>[n,this.setQueryData(n,t,r)]))}getQueryState(e){var r;const t=this.defaultQueryOptions({queryKey:e});return(r=he(this,Ht).get(t.queryHash))==null?void 0:r.state}removeQueries(e){const t=he(this,Ht);tn.batch(()=>{t.findAll(e).forEach(r=>{t.remove(r)})})}resetQueries(e,t){const r=he(this,Ht);return tn.batch(()=>(r.findAll(e).forEach(n=>{n.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const r={revert:!0,...t},n=tn.batch(()=>he(this,Ht).findAll(e).map(s=>s.cancel(r)));return Promise.all(n).then(Ba).catch(Ba)}invalidateQueries(e,t={}){return tn.batch(()=>(he(this,Ht).findAll(e).forEach(r=>{r.invalidate()}),(e==null?void 0:e.refetchType)==="none"?Promise.resolve():this.refetchQueries({...e,type:(e==null?void 0:e.refetchType)??(e==null?void 0:e.type)??"active"},t)))}refetchQueries(e,t={}){const r={...t,cancelRefetch:t.cancelRefetch??!0},n=tn.batch(()=>he(this,Ht).findAll(e).filter(s=>!s.isDisabled()&&!s.isStatic()).map(s=>{let i=s.fetch(void 0,r);return r.throwOnError||(i=i.catch(Ba)),s.state.fetchStatus==="paused"?Promise.resolve():i}));return Promise.all(n).then(Ba)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const r=he(this,Ht).build(this,t);return r.isStaleByTime(k_(t.staleTime,r))?r.fetch(t):Promise.resolve(r.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Ba).catch(Ba)}fetchInfiniteQuery(e){return e.behavior=BA(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Ba).catch(Ba)}ensureInfiniteQueryData(e){return e.behavior=BA(e.pages),this.ensureQueryData(e)}
662resumePausedMutations(){return Pv.isOnline()?he(this,So).resumePausedMutations():Promise.resolve()}getQueryCache(){return he(this,Ht)}getMutationCache(){return he(this,So)}getDefaultOptions(){return he(this,No)}setDefaultOptions(e){Be(this,No,e)}setQueryDefaults(e,t){he(this,nd).set(lm(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...he(this,nd).values()],r={};return t.forEach(n=>{cm(e,n.queryKey)&&Object.assign(r,n.defaultOptions)}),r}setMutationDefaults(e,t){he(this,ad).set(lm(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...he(this,ad).values()],r={};return t.forEach(n=>{cm(e,n.mutationKey)&&Object.assign(r,n.defaultOptions)}),r}defaultQueryOptions(e){if(e._defaulted)return e;const t={...he(this,No).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=y2(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===v2&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...he(this,No).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){he(this,Ht).clear(),he(this,So).clear()}},Ht=new WeakMap,So=new WeakMap,No=new WeakMap,nd=new WeakMap,ad=new WeakMap,ko=new WeakMap,sd=new WeakMap,id=new WeakMap,MR),bJ=y.createContext(void 0),wJ=({client:e,children:t})=>(y.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),a.jsx(bJ.Provider,{value:e,children:t}));/**
663 * @remix-run/router v1.23.2
664 *
665 * Copyright (c) Remix Software Inc.
666 *
667 * This source code is licensed under the MIT license found in the
668 * LICENSE.md file in the root directory of this source tree.
669 *
670 * @license MIT
671 */function um(){return um=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},um.apply(this,arguments)}var Ao;(function(e){e.Pop="POP",e.Push="PUSH",e.Replace="REPLACE"})(Ao||(Ao={}));const WA="popstate";function jJ(e){e===void 0&&(e={});function t(n,s){let{pathname:i,search:o,hash:l}=n.location;return Ov("",{pathname:i,search:o,hash:l},s.state&&s.state.usr||null,s.state&&s.state.key||"default")}function r(n,s){return typeof s=="string"?s:dm(s)}return NL(t,r,null,e)}function _J(e){e===void 0&&(e={});function t(s,i){let{pathname:o="/",search:l="",hash:c=""}=Tc(s.location.hash.substr(1));return!o.startsWith("/")&&!o.startsWith(".")&&(o="/"+o),Ov("",{pathname:o,search:l,hash:c},i.state&&i.state.usr||null,i.state&&i.state.key||"default")}function r(s,i){let o=s.document.querySelector("base"),l="";if(o&&o.getAttribute("href")){let c=s.location.href,u=c.indexOf("#");l=u===-1?c:c.slice(0,u)}return l+"#"+(typeof i=="string"?i:dm(i))}function n(s,i){L0(s.pathname.charAt(0)==="/","relative pathnames are not supported in hash history.push("+JSON.stringify(i)+")")}return NL(t,r,n,e)}function nr(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function L0(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function SJ(){return Math.random().toString(36).substr(2,8)}function VA(e,t){return{usr:e.state,key:e.key,idx:t}}function Ov(e,t,r,n){return r===void 0&&(r=null),um({pathname:typeof e=="string"?e:e.pathname,search:"",hash:""},typeof t=="string"?Tc(t):t,{state:r,key:t&&t.key||n||SJ()})}function dm(e){let{pathname:t="/",search:r="",hash:n=""}=e;return r&&r!=="?"&&(t+=r.charAt(0)==="?"?r:"?"+r),n&&n!=="#"&&(t+=n.charAt(0)==="#"?n:"#"+n),t}function Tc(e){let t={};if(e){let r=e.indexOf("#");r>=0&&(t.hash=e.substr(r),e=e.substr(0,r));let n=e.indexOf("?");n>=0&&(t.search=e.substr(n),e=e.substr(0,n)),e&&(t.pathname=e)}return t}function NL(e,t,r,n){n===void 0&&(n={});let{window:s=document.defaultView,v5Compat:i=!1}=n,o=s.history,l=Ao.Pop,c=null,u=h();u==null&&(u=0,o.replaceState(um({},o.state,{idx:u}),""));function h(){return(o.state||{idx:null}).idx}function d(){l=Ao.Pop;let v=h(),x=v==null?null:v-u;u=v,c&&c({action:l,location:p.location,delta:x})}function f(v,x){l=Ao.Push;let b=Ov(p.location,v,x);r&&r(b,v),u=h()+1;let w=VA(b,u),j=p.createHref(b);try{o.pushState(w,"",j)}catch(_){if(_ instanceof DOMException&&_.name==="DataCloneError")throw _;s.location.assign(j)}i&&c&&c({action:l,location:p.location,delta:1})}function m(v,x){l=Ao.Replace;let b=Ov(p.location,v,x);r&&r(b,v),u=h();let w=VA(b,u),j=p.createHref(b);o.replaceState(w,"",j),i&&c&&c({action:l,location:p.location,delta:0})}function g(v){let x=s.location.origin!=="null"?s.location.origin:s.location.href,b=typeof v=="string"?v:dm(v);return b=b.replace(/ $/,"%20"),nr(x,"No window.location.(origin|href) available to create URL for href: "+b),new URL(b,x)}let p={get action(){return l},get location(){return e(s,o)},listen(v){if(c)throw new Error("A history only accepts one active listener");return s.addEventListener(WA,d),c=v,()=>{s.removeEventListener(WA,d),c=null}},createHref(v){return t(s,v)},createURL:g,encodeLocation(v){let x=g(v);return{pathname:x.pathname,search:x.search,hash:x.hash}},push:f,replace:m,go(v){return o.go(v)}};return p}var HA;(function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"})(HA||(HA={}));function NJ(e,t,r){return r===void 0&&(r="/"),kJ(e,t,r)}function kJ(e,t,r,n){let s=typeof t=="string"?Tc(t):t,i=x2(s.pathname||"/",r);if(i==null)return null;let o=kL(e);CJ(o);let l=null;for(let c=0;l==null&&c<o.length;++c){let u=FJ(i);
vendor: 1,940 bytes, line 671
671l=IJ(o[c],u)}return l}function kL(e,t,r,n){t===void 0&&(t=[]),r===void 0&&(r=[]),n===void 0&&(n="");let s=(i,o,l)=>{let c={relativePath:l===void 0?i.path||"":l,caseSensitive:i.caseSensitive===!0,childrenIndex:o,route:i};c.relativePath.startsWith("/")&&(nr(c.relativePath.startsWith(n),'Absolute route path "'+c.relativePath+'" nested under path '+('"'+n+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),c.relativePath=c.relativePath.slice(n.length));let u=Bo([n,c.relativePath]),h=r.concat(c);i.children&&i.children.length>0&&(nr(i.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+u+'".')),kL(i.children,t,h,u)),!(i.path==null&&!i.index)&&t.push({path:u,score:RJ(u,i.index),routesMeta:h})};return e.forEach((i,o)=>{var l;if(i.path===""||!((l=i.path)!=null&&l.includes("?")))s(i,o);else for(let c of CL(i.path))s(i,o,c)}),t}function CL(e){let t=e.split("/");if(t.length===0)return[];let[r,...n]=t,s=r.endsWith("?"),i=r.replace(/\?$/,"");if(n.length===0)return s?[i,""]:[i];let o=CL(n.join("/")),l=[];return l.push(...o.map(c=>c===""?i:[i,c].join("/"))),s&&l.push(...o),l.map(c=>e.startsWith("/")&&c===""?"/":c)}function CJ(e){e.sort((t,r)=>t.score!==r.score?r.score-t.score:$J(t.routesMeta.map(n=>n.childrenIndex),r.routesMeta.map(n=>n.childrenIndex)))}const EJ=/^:[\w-]+$/,TJ=3,AJ=2,PJ=1,OJ=10,MJ=-2,qA=e=>e==="*";function RJ(e,t){let r=e.split("/"),n=r.length;return r.some(qA)&&(n+=MJ),t&&(n+=AJ),r.filter(s=>!qA(s)).reduce((s,i)=>s+(EJ.test(i)?TJ:i===""?PJ:OJ),n)}function $J(e,t){return e.length===t.length&&e.slice(0,-1).every((n,s)=>n===t[s])?e[e.length-1]-t[t.length-1]:0}function IJ(e,t,r){let{routesMeta:n}=e,s={},i="/",o=[];for(let l=0;l<n.length;++l){let c=n[l],u=l===n.length-1,h=i==="/"?t:t.slice(i.length)||"/",d=DJ({path:c.relativePath,caseSensitive:c.caseSensitive,end:u},h),f=c.route;if(!d)return null;
vendor: 4,333 bytes, lines 671-680
671Object.assign(s,d.params),o.push({params:s,pathname:Bo([i,d.pathname]),pathnameBase:VJ(Bo([i,d.pathnameBase])),route:f}),d.pathnameBase!=="/"&&(i=Bo([i,d.pathnameBase]))}return o}function DJ(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[r,n]=LJ(e.path,e.caseSensitive,e.end),s=t.match(r);if(!s)return null;let i=s[0],o=i.replace(/(.)\/+$/,"$1"),l=s.slice(1);return{params:n.reduce((u,h,d)=>{let{paramName:f,isOptional:m}=h;if(f==="*"){let p=l[d]||"";o=i.slice(0,i.length-p.length).replace(/(.)\/+$/,"$1")}const g=l[d];return m&&!g?u[f]=void 0:u[f]=(g||"").replace(/%2F/g,"/"),u},{}),pathname:i,pathnameBase:o,pattern:e}}function LJ(e,t,r){t===void 0&&(t=!1),r===void 0&&(r=!0),L0(e==="*"||!e.endsWith("*")||e.endsWith("/*"),'Route path "'+e+'" will be treated as if it were '+('"'+e.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+e.replace(/\*$/,"/*")+'".'));let n=[],s="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(o,l,c)=>(n.push({paramName:l,isOptional:c!=null}),c?"/?([^\\/]+)?":"/([^\\/]+)"));return e.endsWith("*")?(n.push({paramName:"*"}),s+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?s+="\\/*$":e!==""&&e!=="/"&&(s+="(?:(?=\\/|$))"),[new RegExp(s,t?void 0:"i"),n]}function FJ(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return L0(!1,'The URL path "'+e+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+t+").")),e}}function x2(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let r=t.endsWith("/")?t.length-1:t.length,n=e.charAt(r);return n&&n!=="/"?null:e.slice(r)||"/"}const zJ=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,BJ=e=>zJ.test(e);function UJ(e,t){t===void 0&&(t="/");let{pathname:r,search:n="",hash:s=""}=typeof e=="string"?Tc(e):e,i;if(r)if(BJ(r))i=r;else{if(r.includes("//")){let o=r;r=r.replace(/\/\/+/g,"/"),L0(!1,"Pathnames cannot have embedded double slashes - normalizing "+(o+" -> "+r))}r.startsWith("/")?i=GA(r.substring(1),"/"):i=GA(r,t)}else i=t;return{pathname:i,search:HJ(n),hash:qJ(s)}}function GA(e,t){let r=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(s=>{s===".."?r.length>1&&r.pop():s!=="."&&r.push(s)}),r.length>1?r.join("/"):"/"}function Xw(e,t,r,n){return"Cannot include a '"+e+"' character in a manually specified "+("`to."+t+"` 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 WJ(e){return e.filter((t,r)=>r===0||t.route.path&&t.route.path.length>0)}function b2(e,t){let r=WJ(e);return t?r.map((n,s)=>s===r.length-1?n.pathname:n.pathnameBase):r.map(n=>n.pathnameBase)}function w2(e,t,r,n){n===void 0&&(n=!1);let s;typeof e=="string"?s=Tc(e):(s=um({},e),nr(!s.pathname||!s.pathname.includes("?"),Xw("?","pathname","search",s)),nr(!s.pathname||!s.pathname.includes("#"),Xw("#","pathname","hash",s)),nr(!s.search||!s.search.includes("#"),Xw("#","search","hash",s)));let i=e===""||s.pathname==="",o=i?"/":s.pathname,l;if(o==null)l=r;else{let d=t.length-1;if(!n&&o.startsWith("..")){let f=o.split("/");for(;f[0]==="..";)f.shift(),d-=1;s.pathname=f.join("/")}l=d>=0?t[d]:"/"}let c=UJ(s,l),u=o&&o!=="/"&&o.endsWith("/"),h=(i||o===".")&&r.endsWith("/");return!c.pathname.endsWith("/")&&(u||h)&&(c.pathname+="/"),c}const Bo=e=>e.join("/").replace(/\/\/+/g,"/"),VJ=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),HJ=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,qJ=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;function GJ(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}const EL=["post","put","patch","delete"];new Set(EL);const KJ=["get",...EL];new Set(KJ);/**
672 * React Router v6.30.3
673 *
674 * Copyright (c) Remix Software Inc.
675 *
676 * This source code is licensed under the MIT license found in the
677 * LICENSE.md file in the root directory of this source tree.
678 *
679 * @license MIT
680 */function hm(){return hm=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];
vendor: 5,204 bytes, line 680
680for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},hm.apply(this,arguments)}const j2=y.createContext(null),YJ=y.createContext(null),sl=y.createContext(null),F0=y.createContext(null),Hi=y.createContext({outlet:null,matches:[],isDataRoute:!1}),TL=y.createContext(null);function XJ(e,t){let{relative:r}=t===void 0?{}:t;lh()||nr(!1);let{basename:n,navigator:s}=y.useContext(sl),{hash:i,pathname:o,search:l}=PL(e,{relative:r}),c=o;return n!=="/"&&(c=o==="/"?n:Bo([n,o])),s.createHref({pathname:c,search:l,hash:i})}function lh(){return y.useContext(F0)!=null}function il(){return lh()||nr(!1),y.useContext(F0).location}function AL(e){y.useContext(sl).static||y.useLayoutEffect(e)}function ei(){let{isDataRoute:e}=y.useContext(Hi);return e?uZ():QJ()}function QJ(){lh()||nr(!1);let e=y.useContext(j2),{basename:t,future:r,navigator:n}=y.useContext(sl),{matches:s}=y.useContext(Hi),{pathname:i}=il(),o=JSON.stringify(b2(s,r.v7_relativeSplatPath)),l=y.useRef(!1);return AL(()=>{l.current=!0}),y.useCallback(function(u,h){if(h===void 0&&(h={}),!l.current)return;if(typeof u=="number"){n.go(u);return}let d=w2(u,JSON.parse(o),i,h.relative==="path");e==null&&t!=="/"&&(d.pathname=d.pathname==="/"?t:Bo([t,d.pathname])),(h.replace?n.replace:n.push)(d,h.state,h)},[t,n,o,i,e])}function JJ(){let{matches:e}=y.useContext(Hi),t=e[e.length-1];return t?t.params:{}}function PL(e,t){let{relative:r}=t===void 0?{}:t,{future:n}=y.useContext(sl),{matches:s}=y.useContext(Hi),{pathname:i}=il(),o=JSON.stringify(b2(s,n.v7_relativeSplatPath));return y.useMemo(()=>w2(e,JSON.parse(o),i,r==="path"),[e,o,i,r])}function ZJ(e,t){return eZ(e,t)}function eZ(e,t,r,n){lh()||nr(!1);let{navigator:s}=y.useContext(sl),{matches:i}=y.useContext(Hi),o=i[i.length-1],l=o?o.params:{};o&&o.pathname;let c=o?o.pathnameBase:"/";o&&o.route;let u=il(),h;if(t){var d;let v=typeof t=="string"?Tc(t):t;c==="/"||(d=v.pathname)!=null&&d.startsWith(c)||nr(!1),h=v}else h=u;let f=h.pathname||"/",m=f;if(c!=="/"){let v=c.replace(/^\//,"").split("/");m="/"+f.replace(/^\//,"").split("/").slice(v.length).join("/")}let g=NJ(e,{pathname:m}),p=sZ(g&&g.map(v=>Object.assign({},v,{params:Object.assign({},l,v.params),pathname:Bo([c,s.encodeLocation?s.encodeLocation(v.pathname).pathname:v.pathname]),pathnameBase:v.pathnameBase==="/"?c:Bo([c,s.encodeLocation?s.encodeLocation(v.pathnameBase).pathname:v.pathnameBase])})),i,r,n);return t&&p?y.createElement(F0.Provider,{value:{location:hm({pathname:"/",search:"",hash:"",state:null,key:"default"},h),navigationType:Ao.Pop}},p):p}function tZ(){let e=cZ(),t=GJ(e)?e.status+" "+e.statusText:e instanceof Error?e.message:JSON.stringify(e),r=e instanceof Error?e.stack:null,s={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return y.createElement(y.Fragment,null,y.createElement("h2",null,"Unexpected Application Error!"),y.createElement("h3",{style:{fontStyle:"italic"}},t),r?y.createElement("pre",{style:s},r):null,null)}const rZ=y.createElement(tZ,null);class nZ extends y.Component{constructor(t){super(t),this.state={location:t.location,revalidation:t.revalidation,error:t.error}}static getDerivedStateFromError(t){return{error:t}}static getDerivedStateFromProps(t,r){return r.location!==t.location||r.revalidation!=="idle"&&t.revalidation==="idle"?{error:t.error,location:t.location,revalidation:t.revalidation}:{error:t.error!==void 0?t.error:r.error,location:r.location,revalidation:t.revalidation||r.revalidation}}componentDidCatch(t,r){console.error("React Router caught the following error during render",t,r)}render(){return this.state.error!==void 0?y.createElement(Hi.Provider,{value:this.props.routeContext},y.createElement(TL.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function aZ(e){let{routeContext:t,match:r,children:n}=e,s=y.useContext(j2);return s&&s.static&&s.staticContext&&(r.route.errorElement||r.route.ErrorBoundary)&&(s.staticContext._deepestRenderedBoundaryId=r.route.id),y.createElement(Hi.Provider,{value:t},n)}function sZ(e,t,r,n){var s;if(t===void 0&&(t=[]),r===void 0&&(r=null),n===void 0&&(n=null),e==null){var i;if(!r)return null;if(r.errors)e=r.matches;else if((i=n)!=null&&i.v7_partialHydration&&t.length===0&&!r.initialized&&r.matches.length>0)e=r.matches;else return null}let o=e,l=(s=r)==null?void 0:s.errors;if(l!=null){let h=o.findIndex(d=>d.route.id&&(l==null?void 0:l[d.route.id])!==void 0);h>=0||nr(!1),o=o.slice(0,Math.min(o.length,h+1))}let c=!1,u=-1;if(r&&n&&n.v7_partialHydration)for(let h=0;h<o.length;h++){let d=o[h];if((d.route.HydrateFallback||d.route.hydrateFallbackElement)&&(u=h),d.route.id){let{loaderData:f,errors:m}=r,g=d.route.loader&&f[d.route.id]===void 0&&(!m||m[d.route.id]===void 0);if(d.route.lazy||g){c=!0,u>=0?o=o.slice(0,u+1):o=[o[0]];break}}}return o.reduceRight((h,d,f)=>{let m,g=!1,p=null,v=null;r&&(m=l&&d.route.id?l[d.route.id]:void 0,p=d.route.errorElement||rZ,c&&(u<0&&f===0?(dZ("route-fallback"),g=!0,v=null):u===f&&(g=!0,v=d.route.hydrateFallbackElement||null)));let x=t.concat(o.slice(0,f+1)),b=()=>{let w;return m?w=p:g?w=v:d.route.Component?w=y.createElement(d.route.Component,null):d.route.element?w=d.route.element:w=h,y.createElement(aZ,{match:d,routeC
680ontext:{outlet:h,matches:x,isDataRoute:r!=null},children:w})};return r&&(d.route.ErrorBoundary||d.route.errorElement||f===0)?y.createElement(nZ,{location:r.location,revalidation:r.revalidation,component:p,error:m,children:b(),routeContext:{outlet:null,matches:x,isDataRoute:!0}}):b()},null)}var OL=function(e){return e.UseBlocker="useBlocker",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e}(OL||{}),ML=function(e){return e.UseBlocker="useBlocker",e.UseLoaderData="useLoaderData",e.UseActionData="useActionData",e.UseRouteError="useRouteError",e.UseNavigation="useNavigation",e.UseRouteLoaderData="useRouteLoaderData",e.UseMatches="useMatches",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e.UseRouteId="useRouteId",e}(ML||{});function iZ(e){let t=y.useContext(j2);return t||nr(!1),t}function oZ(e){let t=y.useContext(YJ);return t||nr(!1),t}function lZ(e){let t=y.useContext(Hi);return t||nr(!1),t}function RL(e){let t=lZ(),r=t.matches[t.matches.length-1];return r.route.id||nr(!1),r.route.id}function cZ(){var e;let t=y.useContext(TL),r=oZ(),n=RL();return t!==void 0?t:(e=r.errors)==null?void 0:e[n]}function uZ(){let{router:e}=iZ(OL.UseNavigateStable),t=RL(ML.UseNavigateStable),r=y.useRef(!1);return AL(()=>{r.current=!0}),y.useCallback(function(s,i){i===void 0&&(i={}),r.current&&(typeof s=="number"?e.navigate(s):e.navigate(s,hm({fromRouteId:t},i)))},[e,t])}const KA={};function dZ(e,t,r){KA[e]||(KA[e]=!0)}function $L(e,t){e==null||e.v7_startTransition,e==null||e.v7_relativeSplatPath}function hZ(e){let{to:t,replace:r,state:n,relative:s}=e;lh()||nr(!1);let{future:i,static:o}=y.useContext(sl),{matches:l}=y.useContext(Hi),{pathname:c}=il(),u=ei(),h=w2(t,b2(l,i.v7_relativeSplatPath),c,s==="path"),d=JSON.stringify(h);return y.useEffect(()=>u(JSON.parse(d),{replace:r,state:n,relative:s}),[u,d,s,r,n]),null}function bt(e){nr(!1)}function IL(e){let{basename:t="/",children:r=null,location:n,navigationType:s=Ao.Pop,navigator:i,static:o=!1,future:l}=e;lh()&&nr(!1);let c=t.replace(/^\/*/,"/"),u=y.useMemo(()=>({basename:c,navigator:i,static:o,future:hm({v7_relativeSplatPath:!1},l)}),[c,l,i,o]);typeof n=="string"&&(n=Tc(n));let{pathname:h="/",search:d="",hash:f="",state:m=null,key:g="default"}=n,p=y.useMemo(()=>{let v=x2(h,c);return v==null?null:{location:{pathname:v,search:d,hash:f,state:m,key:g},navigationType:s}},[c,h,d,f,m,g,s]);return p==null?null:y.createElement(sl.Provider,{value:u},y.createElement(F0.Provider,{children:r,value:p}))}function fZ(e){let{children:t,location:r}=e;return ZJ(T_(t),r)}new Promise(()=>{});function T_(e,t){t===void 0&&(t=[]);let r=[];return y.Children.forEach(e,(n,s)=>{if(!y.isValidElement(n))return;let i=[...t,s];if(n.type===y.Fragment){r.push.apply(r,T_(n.props.children,i));return}n.type!==bt&&nr(!1),!n.props.index||!n.props.children||nr(!1);let o={id:n.props.id||i.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&&(o.children=T_(n.props.children,i)),r.push(o)}),r}/**
681 * React Router DOM v6.30.3
682 *
683 * Copyright (c) Remix Software Inc.
684 *
685 * This source code is licensed under the MIT license found in the
686 * LICENSE.md file in the root directory of this source tree.
687 *
688 * @license MIT
689 */function A_(){return A_=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},A_.apply(this,arguments)}function mZ(e,t){if(e==null)return{};var r={},n=Object.keys(e),s,i;for(i=0;i<n.length;i++)s=n[i],!(t.indexOf(s)>=0)&&(r[s]=e[s]);return r}function pZ(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function gZ(e,t){return e.button===0&&(!t||t==="_self")&&!pZ(e)}function P_(e){return e===void 0&&(e=""),new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,r)=>{let n=e[r];return t.concat(Array.isArray(n)?n.map(s=>[r,s]):[[r,n]])},[]))}function yZ(e,t){let r=P_(e);return t&&t.forEach((n,s)=>
689{r.has(s)||t.getAll(s).forEach(i=>{r.append(s,i)})}),r}const vZ=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],xZ="6";try{window.__reactRouterVersion=xZ}catch{}const bZ="startTransition",Mv=o0[bZ];function wZ(e){let{basename:t,children:r,future:n,window:s}=e,i=y.useRef();i.current==null&&(i.current=jJ({window:s,v5Compat:!0}));let o=i.current,[l,c]=y.useState({action:o.action,location:o.location}),{v7_startTransition:u}=n||{},h=y.useCallback(d=>{u&&Mv?Mv(()=>c(d)):c(d)},[c,u]);return y.useLayoutEffect(()=>o.listen(h),[o,h]),y.useEffect(()=>$L(n),[n]),y.createElement(IL,{basename:t,children:r,location:l.location,navigationType:l.action,navigator:o,future:n})}function jZ(e){let{basename:t,children:r,future:n,window:s}=e,i=y.useRef();i.current==null&&(i.current=_J({window:s,v5Compat:!0}));let o=i.current,[l,c]=y.useState({action:o.action,location:o.location}),{v7_startTransition:u}=n||{},h=y.useCallback(d=>{u&&Mv?Mv(()=>c(d)):c(d)},[c,u]);return y.useLayoutEffect(()=>o.listen(h),[o,h]),y.useEffect(()=>
689$L(n),[n]),y.createElement(IL,{basename:t,children:r,location:l.location,navigationType:l.action,navigator:o,future:n})}const _Z=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",SZ=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,it=y.forwardRef(function(t,r){let{onClick:n,relative:s,reloadDocument:i,replace:o,state:l,target:c,to:u,preventScrollReset:h,viewTransition:d}=t,f=mZ(t,vZ),{basename:m}=y.useContext(sl),g,p=!1;if(typeof u=="string"&&SZ.test(u)&&(g=u,_Z))try{let w=new URL(window.location.href),j=u.startsWith("//")?new URL(w.protocol+u):new URL(u),_=x2(j.pathname,m);j.origin===w.origin&&_!=null?u=_+j.search+j.hash:p=!0}catch{}let v=XJ(u,{relative:s}),x=NZ(u,{replace:o,state:l,target:c,preventScrollReset:h,relative:s,viewTransition:d});function b(w){n&&n(w),w.defaultPrevented||x(w)}return y.createElement("a",A_({},f,{href:g||v,onClick:p||i?n:b,ref:r,target:c}))});var YA;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})(YA||(YA={}));var XA;(function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})(XA||(XA={}));function NZ(e,t){let{target:r,replace:n,state:s,preventScrollReset:i,relative:o,viewTransition:l}=t===void 0?{}:t,c=ei(),u=il(),h=PL(e,{relative:o});return y.useCallback(d=>{if(gZ(d,r)){d.preventDefault();let f=n!==void 0?n:dm(u)===dm(h);c(e,{replace:f,state:s,preventScrollReset:i,relative:o,viewTransition:l})}},[u,c,h,n,s,r,e,i,o,l])}function DL(e){let t=y.useRef(P_(e)),r=y.useRef(!1),n=il(),s=y.useMemo(()=>yZ(n.search,r.current?null:t.current),[n.search]),i=ei(),o=y.useCallback((l,c)=>{const u=P_(typeof l=="function"?l(s):l);r.current=!0,i("?"+u,c)},[i,s]);return[s,o]}var Is=function(){return Is=Object.assign||function(t){for(var r,n=1,s=arguments.length;n<s;n++){r=arguments[n];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(t[i]=r[i])}return t},Is.apply(this,arguments)};function ch(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,n=Object.getOwnPropertySymbols(e);s<n.length;s++)t.indexOf(n[s])<0&&Object.prototype.propertyIsEnumerable.call(e,n[s])&&(r[n[s]]=e[n[s]]);return r}function kZ(e,t,r,n){function s(i){return i instanceof r?i:new r(function(o){o(i)})}return new(r||(r=Promise))(function(i,o){function l(h){try{u(n.next(h))}catch(d){o(d)}}function c(h){try{u(n.throw(h))}catch(d){o(d)}}function u(h){h.done?i(h.value):s(h.value).then(l,c)}u((n=n.apply(e,t||[])).next())})}function CZ(e,t,r){if(r||arguments.length===2)for(var n=0,s=t.length,i;n<s;n++)(i||!(n in t))&&(i||(i=Array.prototype.slice.call(t,0,n)),i[n]=t[n]);return e.concat(i||Array.prototype.slice.call(t))}const EZ=e=>e?(...t)=>e(...t):(...t)=>fetch(...t);class _2 extends Error{constructor(t,r="FunctionsError",n){super(t),this.name=r,this.context=n}}class TZ extends _2{constructor(t){super("Failed to send a request to the Edge Function","FunctionsFetchError",t)}}class QA extends _2{constructor(t){super("Relay Error invoking the Edge Function","FunctionsRelayError",t)}}class JA extends _2{constructor(t){super("Edge Function returned a non-2xx status code","FunctionsHttpError",t)}}var O_;(function(e){e.Any="any",e.ApNortheast1="ap-northeast-1",e.ApNortheast2="ap-northeast-2",e.ApSouth1="ap-south-1",e.ApSoutheast1="ap-southeast-1",e.ApSoutheast2="ap-southeast-2",e.CaCentral1="ca-central-1",e.EuCentral1="eu-central-1",e.EuWest1="eu-west-1",e.EuWest2="eu-west-2",e.EuWest3="eu-west-3",e.SaEast1="sa-east-1",e.UsEast1="us-east-1",e.UsWest1="us-west-1",e.UsWest2="us-west-2"})(O_||(O_={}));class AZ{constructor(t,{headers:r={},customFetch:n,region:s=O_.Any}={}){this.url=t,this.headers=r,this.region=s,this.fetch=EZ(n)}setAuth(t){this.headers.Authorization=`Bearer ${t}`}invoke(t){return kZ(this,arguments,void 0,function*(r,n={}){var s;let i,o;try{const{headers:l,method:c,body:u,signal:h,timeout:d}=n;let f={},{region:m}=n;m||(m=this.region);const g=new URL(`${this.url}/${r}`);m&&m!=="any"&&(f["x-region"]=m,g.searchParams.set("forceFunctionRegion",m));let p;u&&(l&&!Object.prototype.hasOwnProperty.call(l,"Content-Type")||!l)?typeof Blob<"u"&&u instanceof Blob||u instanceof ArrayBuffer?(f["Content-Type"]="application/octet-stream",p=u):typeof u=="string"?(f["Content-Type"]="text/plain",p=u):typeof FormData<"u"&&u instanceof FormData?p=u:(f["Content-Type"]="application/json",p=JSON.stringify(u)):u&&typeof u!="string"&&!(typeof Blob<"u"&&u instanceof Blob)&&!(u instanceof ArrayBuffer)&&!(typeof FormData<"u"&&u instanceof FormData)?p=JSON.stringify(u):p=u;let v=h;d&&(o=new AbortController,i=setTimeout(()=>
689o.abort(),d),h?(v=o.signal,h.addEventListener("abort",()=>o.abort())):v=o.signal);const x=yield this.fetch(g.toString(),{method:c||"POST",headers:Object.assign(Object.assign(Object.assign({},f),this.headers),l),body:p,signal:v}).catch(_=>{throw new TZ(_)}),b=x.headers.get("x-relay-error");if(b&&b==="true")throw new QA(x);if(!x.ok)throw new JA(x);let w=((s=x.headers.get("Content-Type"))!==null&&s!==void 0?s:"text/plain").split(";")[0].trim(),j;return w==="application/json"?j=yield x.json():w==="application/octet-stream"||w==="application/pdf"?j=yield x.blob():w==="text/event-stream"?j=x:w==="multipart/form-data"?j=yield x.formData():j=yield x.text(),{data:j,error:null,response:x}}catch(l){return{data:null,error:l,response:l instanceof JA||l instanceof QA?l.context:void 0}}finally{i&&clearTimeout(i)}})}}var PZ=class extends Error{constructor(e){super(e.message),this.name="PostgrestError",this.details=e.details,this.hint=e.hint,this.code=e.code}},OZ=class{constructor(e){var t,r,n;this.shouldThrowOnError=!1,this.method=e.method,this.url=e.url,this.headers=new Headers(e.headers),this.schema=e.schema,this.body=e.body,this.shouldThrowOnError=(t=e.shouldThrowOnError)!==null&&t!==void 0?t:!1,this.signal=e.signal,this.isMaybeSingle=(r=e.isMaybeSingle)!==null&&r!==void 0?r:!1,this.urlLengthLimit=(n=e.urlLengthLimit)!==null&&n!==void 0?n:8e3,e.fetch?this.fetch=e.fetch:this.fetch=fetch}throwOnError(){return this.shouldThrowOnError=!0,this}setHeader(e,t){return this.headers=new Headers(this.headers),this.headers.set(e,t),this}then(e,t){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 s=n(this.url.toString(),{method:this.method,headers:this.headers,body:JSON.stringify(this.body),signal:this.signal}).then(async i=>{let o=null,l=null,c=null,u=i.status,h=i.statusText;if(i.ok){var d,f;if(r.method!=="HEAD"){var m;const x=await i.text();x===""||(r.headers.get("Accept")==="text/csv"||r.headers.get("Accept")&&(!((m=r.headers.get("Accept"))===null||m===void 0)&&m.includes("application/vnd.pgrst.plan+text"))?l=x:l=JSON.parse(x))}const p=(d=r.headers.get("Prefer"))===null||d===void 0?void 0:d.match(/count=(exact|planned|estimated)/),v=(f=i.headers.get("content-range"))===null||f===void 0?void 0:f.split("/");p&&v&&v.length>1&&(c=parseInt(v[1])),r.isMaybeSingle&&r.method==="GET"&&Array.isArray(l)&&(l.length>1?(o={code:"PGRST116",details:`Results contain ${l.length} rows, application/vnd.pgrst.object+json requires 1 row`,hint:null,message:"JSON object requested, multiple (or no) rows returned"},l=null,c=null,u=406,h="Not Acceptable"):l.length===1?l=l[0]:l=null)}else{var g;const p=await i.text();try{o=JSON.parse(p),Array.isArray(o)&&i.status===404&&(l=[],o=null,u=200,h="OK")}catch{i.status===404&&p===""?(u=204,h="No Content"):o={message:p}}if(o&&r.isMaybeSingle&&(!(o==null||(g=o.details)===null||g===void 0)&&g.includes("0 rows"))&&(o=null,u=200,h="OK"),o&&r.shouldThrowOnError)throw new PZ(o)}return{error:o,data:l,count:c,status:u,statusText:h}});return this.shouldThrowOnError||(s=s.catch(i=>{var o;let l="",c="",u="";const h=i==null?void 0:i.cause;if(h){var d,f,m,g;const x=(d=h==null?void 0:h.message)!==null&&d!==void 0?d:"",b=(f=h==null?void 0:h.code)!==null&&f!==void 0?f:"";l=`${(m=i==null?void 0:i.name)!==null&&m!==void 0?m:"FetchError"}: ${i==null?void 0:i.message}`,l+=`
690
691Caused by: ${(g=h==null?void 0:h.name)!==null&&g!==void 0?g:"Error"}: ${x}`,b&&(l+=` (${b})`),h!=null&&h.stack&&(l+=`
692${h.stack}`)}else{var p;l=(p=i==null?void 0:i.stack)!==null&&p!==void 0?p:""}const v=this.url.toString().length;return(i==null?void 0:i.name)==="AbortError"||(i==null?void 0:i.code)==="ABORT_ERR"?(u="",c="Request was aborted (timeout or manual cancellation)",v>this.urlLengthLimit&&(c+=`. Note: Your request URL is ${v} 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.`)):((h==null?void 0:h.name)==="HeadersOverflowError"||(h==null?void 0:h.code)==="UND_ERR_HEADERS_OVERFLOW")&&(u="",c="HTTP headers exceeded server limits (typically 16KB)",v>this.urlLengthLimit&&(c+=`. Your request URL is ${v} 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:`${(o=i==null?void 0:i.name)!==null&&o!==void 0?o:"FetchError"}: ${i==null?void 0:i.message}`,details:l,hint:c,code:u},data:null,count:null,status:0,statusText:""}}
692)),s.then(e,t)}returns(){return this}overrideTypes(){return this}},MZ=class extends OZ{select(e){let t=!1;const r=(e??"*").split("").map(n=>/\s/.test(n)&&!t?"":(n==='"'&&(t=!t),n)).join("");return this.url.searchParams.set("select",r),this.headers.append("Prefer","return=representation"),this}order(e,{ascending:t=!0,nullsFirst:r,foreignTable:n,referencedTable:s=n}={}){const i=s?`${s}.order`:"order",o=this.url.searchParams.get(i);return this.url.searchParams.set(i,`${o?`${o},`:""}${e}.${t?"asc":"desc"}${r===void 0?"":r?".nullsfirst":".nullslast"}`),this}limit(e,{foreignTable:t,referencedTable:r=t}={}){const n=typeof r>"u"?"limit":`${r}.limit`;return this.url.searchParams.set(n,`${e}`),this}range(e,t,{foreignTable:r,referencedTable:n=r}={}){const s=typeof n>"u"?"offset":`${n}.offset`,i=typeof n>"u"?"limit":`${n}.limit`;return this.url.searchParams.set(s,`${e}`),this.url.searchParams.set(i,`${t-e+1}`),this}abortSignal(e){return this.signal=e,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}explain({analyze:e=!1,verbose:t=!1,settings:r=!1,buffers:n=!1,wal:s=!1,format:i="text"}={}){var o;const l=[e?"analyze":null,t?"verbose":null,r?"settings":null,n?"buffers":null,s?"wal":null].filter(Boolean).join("|"),c=(o=this.headers.get("Accept"))!==null&&o!==void 0?o:"application/json";return this.headers.set("Accept",`application/vnd.pgrst.plan+${i}; for="${c}"; options=${l};`),i==="json"?this:this}rollback(){return this.headers.append("Prefer","tx=rollback"),this}returns(){return this}maxAffected(e){return this.headers.append("Prefer","handling=strict"),this.headers.append("Prefer",`max-affected=${e}`),this}};const ZA=new RegExp("[,()]");var ou=class extends MZ{eq(e,t){return this.url.searchParams.append(e,`eq.${t}`),this}neq(e,t){return this.url.searchParams.append(e,`neq.${t}`),this}gt(e,t){return this.url.searchParams.append(e,`gt.${t}`),this}gte(e,t){return this.url.searchParams.append(e,`gte.${t}`),this}lt(e,t){return this.url.searchParams.append(e,`lt.${t}`),this}lte(e,t){return this.url.searchParams.append(e,`lte.${t}`),this}like(e,t){return this.url.searchParams.append(e,`like.${t}`),this}likeAllOf(e,t){return this.url.searchParams.append(e,`like(all).{${t.join(",")}}`),this}likeAnyOf(e,t){return this.url.searchParams.append(e,`like(any).{${t.join(",")}}`),this}ilike(e,t){return this.url.searchParams.append(e,`ilike.${t}`),this}ilikeAllOf(e,t){return this.url.searchParams.append(e,`ilike(all).{${t.join(",")}}`),this}ilikeAnyOf(e,t){return this.url.searchParams.append(e,`ilike(any).{${t.join(",")}}`),this}regexMatch(e,t){return this.url.searchParams.append(e,`match.${t}`),this}regexIMatch(e,t){return this.url.searchParams.append(e,`imatch.${t}`),this}is(e,t){return this.url.searchParams.append(e,`is.${t}`),this}isDistinct(e,t){return this.url.searchParams.append(e,`isdistinct.${t}`),this}in(e,t){const r=Array.from(new Set(t)).map(n=>typeof n=="string"&&ZA.test(n)?`"${n}"`:`${n}`).join(",");return this.url.searchParams.append(e,`in.(${r})`),this}notIn(e,t){const r=Array.from(new Set(t)).map(n=>typeof n=="string"&&ZA.test(n)?`"${n}"`:`${n}`).join(",");return this.url.searchParams.append(e,`not.in.(${r})`),this}contains(e,t){return typeof t=="string"?this.url.searchParams.append(e,`cs.${t}`):Array.isArray(t)?this.url.searchParams.append(e,`cs.{${t.join(",")}}`):this.url.searchParams.append(e,`cs.${JSON.stringify(t)}`),this}containedBy(e,t){return typeof t=="string"?this.url.searchParams.append(e,`cd.${t}`):Array.isArray(t)?this.url.searchParams.append(e,`cd.{${t.join(",")}}`):this.url.searchParams.append(e,`cd.${JSON.stringify(t)}`),this}rangeGt(e,t){return this.url.searchParams.append(e,`sr.${t}`),this}rangeGte(e,t){return this.url.searchParams.append(e,`nxl.${t}`),this}rangeLt(e,t){return this.url.searchParams.append(e,`sl.${t}`),this}rangeLte(e,t){return this.url.searchParams.append(e,`nxr.${t}`),this}rangeAdjacent(e,t){return this.url.searchParams.append(e,`adj.${t}`),this}overlaps(e,t){return typeof t=="string"?this.url.searchParams.append(e,`ov.${t}`):this.url.searchParams.append(e,`ov.{${t.join(",")}}`),this}textSearch(e,t,{config:r,type:n}={}){let s="";n==="plain"?s="pl":n==="phrase"?s="ph":n==="websearch"&&(s="w");const i=r===void 0?"":`(${r})`;return this.url.searchParams.append(e,`${s}fts${i}.${t}`),this}match(e){return Object.entries(e).filter(([t,r])=>
692r!==void 0).forEach(([t,r])=>{this.url.searchParams.append(t,`eq.${r}`)}),this}not(e,t,r){return this.url.searchParams.append(e,`not.${t}.${r}`),this}or(e,{foreignTable:t,referencedTable:r=t}={}){const n=r?`${r}.or`:"or";return this.url.searchParams.append(n,`(${e})`),this}filter(e,t,r){return this.url.searchParams.append(e,`${t}.${r}`),this}},RZ=class{constructor(e,{headers:t={},schema:r,fetch:n,urlLengthLimit:s=8e3}){this.url=e,this.headers=new Headers(t),this.schema=r,this.fetch=n,this.urlLengthLimit=s}cloneRequestState(){return{url:new URL(this.url.toString()),headers:new Headers(this.headers)}}select(e,t){const{head:r=!1,count:n}=t??{},s=r?"HEAD":"GET";let i=!1;const o=(e??"*").split("").map(u=>/\s/.test(u)&&!i?"":(u==='"'&&(i=!i),u)).join(""),{url:l,headers:c}=this.cloneRequestState();return l.searchParams.set("select",o),n&&c.append("Prefer",`count=${n}`),new ou({method:s,url:l,headers:c,schema:this.schema,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit})}insert(e,{count:t,defaultToNull:r=!0}={}){var n;const s="POST",{url:i,headers:o}=this.cloneRequestState();if(t&&o.append("Prefer",`count=${t}`),r||o.append("Prefer","missing=default"),Array.isArray(e)){const l=e.reduce((c,u)=>c.concat(Object.keys(u)),[]);if(l.length>0){const c=[...new Set(l)].map(u=>`"${u}"`);i.searchParams.set("columns",c.join(","))}}return new ou({method:s,url:i,headers:o,schema:this.schema,body:e,fetch:(n=this.fetch)!==null&&n!==void 0?n:fetch,urlLengthLimit:this.urlLengthLimit})}upsert(e,{onConflict:t,ignoreDuplicates:r=!1,count:n,defaultToNull:s=!0}={}){var i;const o="POST",{url:l,headers:c}=this.cloneRequestState();if(c.append("Prefer",`resolution=${r?"ignore":"merge"}-duplicates`),t!==void 0&&l.searchParams.set("on_conflict",t),n&&c.append("Prefer",`count=${n}`),s||c.append("Prefer","missing=default"),Array.isArray(e)){const u=e.reduce((h,d)=>h.concat(Object.keys(d)),[]);if(u.length>0){const h=[...new Set(u)].map(d=>`"${d}"`);l.searchParams.set("columns",h.join(","))}}return new ou({method:o,url:l,headers:c,schema:this.schema,body:e,fetch:(i=this.fetch)!==null&&i!==void 0?i:fetch,urlLengthLimit:this.urlLengthLimit})}update(e,{count:t}={}){var r;const n="PATCH",{url:s,headers:i}=this.cloneRequestState();return t&&i.append("Prefer",`count=${t}`),new ou({method:n,url:s,headers:i,schema:this.schema,body:e,fetch:(r=this.fetch)!==null&&r!==void 0?r:fetch,urlLengthLimit:this.urlLengthLimit})}delete({count:e}={}){var t;const r="DELETE",{url:n,headers:s}=this.cloneRequestState();return e&&s.append("Prefer",`count=${e}`),new ou({method:r,url:n,headers:s,schema:this.schema,fetch:(t=this.fetch)!==null&&t!==void 0?t:fetch,urlLengthLimit:this.urlLengthLimit})}};function fm(e){"@babel/helpers - typeof";return fm=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},fm(e)}function $Z(e,t){if(fm(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(fm(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function IZ(e){var t=$Z(e,"string");return fm(t)=="symbol"?t:t+""}function DZ(e,t,r){return(t=IZ(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function eP(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function Ng(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?eP(Object(r),!0).forEach(function(n){DZ(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):eP(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}var LZ=class LL{constructor(t,{headers:r={},schema:n,fetch:s,timeout:i,urlLengthLimit:o=8e3}={}){this.url=t,this.headers=new Headers(r),this.schemaName=n,this.urlLengthLimit=o;const l=s??globalThis.fetch;i!==void 0&&i>0?this.fetch=(c,u)=>{const h=new AbortController,d=setTimeout(()=>h.abort(),i),f=u==null?void 0:u.signal;if(f){if(f.aborted)return clearTimeout(d),l(c,u);const m=()=>{clearTimeout(d),h.abort()};return f.addEventListener("abort",m,{once:!0}),l(c,Ng(Ng({},u),{},{signal:h.signal})).finally(()=>{clearTimeout(d),f.removeEventListener("abort",m)})}return l(c,Ng(Ng({},u),{},{signal:h.signal})).finally(()=>clearTimeout(d))}:this.fetch=l}from(t){if(!t||typeof t!="string"||t.trim()==="")throw new Error("Invalid relation name: relation must be a non-empty string.");return new RZ(new URL(`${this.url}/${t}`),{headers:new Headers(this.headers),schema:this.schemaName,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit})}schema(t){return new LL(this.url,{headers:this.headers,schema:t,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit})}rpc(t,r={},{head:n=!1,get:s=!1,count:i}={}){var o;let l;const c=new URL(`${this.url}/rpc/${t}`);let u;const h=m=>m!==null&&typeof m=="object"&&(!Array.isArray(m)||m.some(h)),d=n&&Object.values(r).some(h);d?(l="POST",u=r):n||s?(l=n?"HEAD":"GET",Object.entries(r).filter(([m,g])=>g!==void 0).map(([m,g])=>[m,Array.isArray(g)?`{${g.join(",")}}`:`${g}
692`]).forEach(([m,g])=>{c.searchParams.append(m,g)})):(l="POST",u=r);const f=new Headers(this.headers);return d?f.set("Prefer",i?`count=${i},return=minimal`:"return=minimal"):i&&f.set("Prefer",`count=${i}`),new ou({method:l,url:c,headers:f,schema:this.schemaName,body:u,fetch:(o=this.fetch)!==null&&o!==void 0?o:fetch,urlLengthLimit:this.urlLengthLimit})}};class FZ{constructor(){}static detectEnvironment(){var t;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"&&(!((t=navigator.userAgent)===null||t===void 0)&&t.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 s=n.node,i=parseInt(s.replace(/^v/,"").split(".")[0]);return i>=22?typeof globalThis.WebSocket<"u"?{type:"native",constructor:globalThis.WebSocket}:{type:"unsupported",error:`Node.js ${i} detected but native WebSocket not found.`,workaround:"Provide a WebSocket implementation via the transport option."}:{type:"unsupported",error:`Node.js ${i} detected without native WebSocket support.`,workaround:`For Node.js < 22, install "ws" package and provide it via the transport option:
693import ws from "ws"
694new 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 t=this.detectEnvironment();if(t.constructor)return t.constructor;let r=t.error||"WebSocket not supported in this environment.";throw t.workaround&&(r+=`
695
696Suggested solution: ${t.workaround}`),new Error(r)}static isWebSocketSupported(){try{const t=this.detectEnvironment();return t.type==="native"||t.type==="ws"}catch{return!1}}}const zZ="2.100.0",BZ=`realtime-js/${zZ}`,UZ="1.0.0",FL="2.0.0",WZ=FL,VZ=1e4,HZ=100,vo={closed:"closed",errored:"errored",joined:"joined",joining:"joining",leaving:"leaving"},zL={close:"phx_close",error:"phx_error",join:"phx_join",leave:"phx_leave",access_token:"access_token"},M_={connecting:"connecting",closing:"closing",closed:"closed"};class qZ{constructor(t){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=t??[]}encode(t,r){if(t.event===this.BROADCAST_EVENT&&!(t.payload instanceof ArrayBuffer)&&typeof t.payload.event=="string")return r(this._binaryEncodeUserBroadcastPush(t));let n=[t.join_ref,t.ref,t.topic,t.event,t.payload];return r(JSON.stringify(n))}_binaryEncodeUserBroadcastPush(t){var r;return this._isArrayBuffer((r=t.payload)===null||r===void 0?void 0:r.payload)?this._encodeBinaryUserBroadcastPush(t):this._encodeJsonUserBroadcastPush(t)}_encodeBinaryUserBroadcastPush(t){var r,n;const s=(n=(r=t.payload)===null||r===void 0?void 0:r.payload)!==null&&n!==void 0?n:new ArrayBuffer(0);return this._encodeUserBroadcastPush(t,this.BINARY_ENCODING,s)}_encodeJsonUserBroadcastPush(t){var r,n;const s=(n=(r=t.payload)===null||r===void 0?void 0:r.payload)!==null&&n!==void 0?n:{},o=new TextEncoder().encode(JSON.stringify(s)).buffer;return this._encodeUserBroadcastPush(t,this.JSON_ENCODING,o)}_encodeUserBroadcastPush(t,r,n){var s,i;const o=t.topic,l=(s=t.ref)!==null&&s!==void 0?s:"",c=(i=t.join_ref)!==null&&i!==void 0?i:"",u=t.payload.event,h=this.allowedMetadataKeys?this._pick(t.payload,this.allowedMetadataKeys):{},d=Object.keys(h).length===0?"":JSON.stringify(h);if(c.length>255)throw new Error(`joinRef length ${c.length} exceeds maximum of 255`);if(l.length>255)throw new Error(`ref length ${l.length} exceeds maximum of 255`);if(o.length>255)throw new Error(`topic length ${o.length} exceeds maximum of 255`);if(u.length>255)throw new Error(`userEvent length ${u.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+c.length+l.length+o.length+u.length+d.length,m=new ArrayBuffer(this.HEADER_LENGTH+f);let g=new DataView(m),p=0;g.setUint8(p++,this.KINDS.userBroadcastPush),g.setUint8(p++,c.length),g.setUint8(p++,l.length),g.setUint8(p++,o.length),g.setUint8(p++,u.length),g.setUint8(p++,d.length),g.setUint8(p++,r),Array.from(c,x=>g.setUint8(p++,x.charCodeAt(0))),Array.from(l,x=>g.setUint8(p++,x.charCodeAt(0))),Array.from(o,x=>g.setUint8(p++,x.charCodeAt(0))),Array.from(u,x=>g.setUint8(p++,x.charCodeAt(0))),Array.from(d,x=>g.setUint8(p++,x.charCodeAt(0)));var v=new Uint8Array(m.byteLength+n.byteLength);return v.set(new Uint8Array(m),0),v.set(new Uint8Array(n),m.byteLength),v.buffer}decode(t,r){if(this._isArrayBuffer(t)){let n=this._binaryDecode(t);return r(n)}if(typeof t=="string"){const n=JSON.parse(t),[s,i,o,l,c]=n;return r({join_ref:s,ref:i,topic:o,event:l,payload:c})}return r({})}_binaryDecode(t){const r=new DataView(t),n=r.getUint8(0),s=new TextDecoder;switch(n){case this.KINDS.userBroadcast:return this._decodeUserBroadcast(t,r,s)}}_decodeUserBroadcast(t,r,n){const s=r.getUint8(1),i=r.getUint8(2),o=r.getUint8(3),l=r.getUint8(4);let c=this.HEADER_LENGTH+4;const u=n.decode(t.slice(c,c+s));c=c+s;const h=n.decode(t.slice(c,c+i));c=c+i;
696const d=n.decode(t.slice(c,c+o));c=c+o;const f=t.slice(c,t.byteLength),m=l===this.JSON_ENCODING?JSON.parse(n.decode(f)):f,g={type:this.BROADCAST_EVENT,event:h,payload:m};return o>0&&(g.meta=JSON.parse(d)),{join_ref:null,ref:null,topic:u,event:this.BROADCAST_EVENT,payload:g}}_isArrayBuffer(t){var r;return t instanceof ArrayBuffer||((r=t==null?void 0:t.constructor)===null||r===void 0?void 0:r.name)==="ArrayBuffer"}_pick(t,r){return!t||typeof t!="object"?{}:Object.fromEntries(Object.entries(t).filter(([n])=>r.includes(n)))}}var Nt;(function(e){e.abstime="abstime",e.bool="bool",e.date="date",e.daterange="daterange",e.float4="float4",e.float8="float8",e.int2="int2",e.int4="int4",e.int4range="int4range",e.int8="int8",e.int8range="int8range",e.json="json",e.jsonb="jsonb",e.money="money",e.numeric="numeric",e.oid="oid",e.reltime="reltime",e.text="text",e.time="time",e.timestamp="timestamp",e.timestamptz="timestamptz",e.timetz="timetz",e.tsrange="tsrange",e.tstzrange="tstzrange"})(Nt||(Nt={}));const tP=(e,t,r={})=>{var n;const s=(n=r.skipTypes)!==null&&n!==void 0?n:[];return t?Object.keys(t).reduce((i,o)=>(i[o]=GZ(o,e,t,s),i),{}):{}},GZ=(e,t,r,n)=>{const s=t.find(l=>
vendor: 5,528 bytes, line 696
696l.name===e),i=s==null?void 0:s.type,o=r[e];return i&&!n.includes(i)?BL(i,o):R_(o)},BL=(e,t)=>{if(e.charAt(0)==="_"){const r=e.slice(1,e.length);return QZ(t,r)}switch(e){case Nt.bool:return KZ(t);case Nt.float4:case Nt.float8:case Nt.int2:case Nt.int4:case Nt.int8:case Nt.numeric:case Nt.oid:return YZ(t);case Nt.json:case Nt.jsonb:return XZ(t);case Nt.timestamp:return JZ(t);case Nt.abstime:case Nt.date:case Nt.daterange:case Nt.int4range:case Nt.int8range:case Nt.money:case Nt.reltime:case Nt.text:case Nt.time:case Nt.timestamptz:case Nt.timetz:case Nt.tsrange:case Nt.tstzrange:return R_(t);default:return R_(t)}},R_=e=>e,KZ=e=>{switch(e){case"t":return!0;case"f":return!1;default:return e}},YZ=e=>{if(typeof e=="string"){const t=parseFloat(e);if(!Number.isNaN(t))return t}return e},XZ=e=>{if(typeof e=="string")try{return JSON.parse(e)}catch{return e}return e},QZ=(e,t)=>{if(typeof e!="string")return e;const r=e.length-1,n=e[r];if(e[0]==="{"&&n==="}"){let i;const o=e.slice(1,r);try{i=JSON.parse("["+o+"]")}catch{i=o?o.split(","):[]}return i.map(l=>BL(t,l))}return e},JZ=e=>typeof e=="string"?e.replace(" ","T"):e,UL=e=>{const t=new URL(e);return t.protocol=t.protocol.replace(/^ws/i,"http"),t.pathname=t.pathname.replace(/\/+$/,"").replace(/\/socket\/websocket$/i,"").replace(/\/socket$/i,"").replace(/\/websocket$/i,""),t.pathname===""||t.pathname==="/"?t.pathname="/api/broadcast":t.pathname=t.pathname+"/api/broadcast",t.href};var Tf=e=>typeof e=="function"?e:function(){return e},ZZ=typeof self<"u"?self:null,lu=typeof window<"u"?window:null,Cs=ZZ||lu||globalThis,eee="2.0.0",tee=1e4,ree=1e3,Rs={connecting:0,open:1,closing:2,closed:3},pn={closed:"closed",errored:"errored",joined:"joined",joining:"joining",leaving:"leaving"},ci={close:"phx_close",error:"phx_error",join:"phx_join",reply:"phx_reply",leave:"phx_leave"},$_={longpoll:"longpoll",websocket:"websocket"},nee={complete:4},I_="base64url.bearer.phx.",kg=class{constructor(e,t,r,n){this.channel=e,this.event=t,this.payload=r||function(){return{}},this.receivedResp=null,this.timeout=n,this.timeoutTimer=null,this.recHooks=[],this.sent=!1,this.ref=void 0}resend(e){this.timeout=e,this.reset(),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()}))}receive(e,t){return this.hasReceived(e)&&t(this.receivedResp.response),this.recHooks.push({status:e,callback:t}),this}reset(){this.cancelRefEvent(),this.ref=null,this.refEvent=null,this.receivedResp=null,this.sent=!1}destroy(){this.cancelRefEvent(),this.cancelTimeout()}matchReceive({status:e,response:t,_ref:r}){this.recHooks.filter(n=>n.status===e).forEach(n=>n.callback(t))}cancelRefEvent(){this.refEvent&&this.channel.off(this.refEvent)}cancelTimeout(){clearTimeout(this.timeoutTimer),this.timeoutTimer=null}startTimeout(){this.timeoutTimer&&this.cancelTimeout(),this.ref=this.channel.socket.makeRef(),this.refEvent=this.channel.replyEventName(this.ref),this.channel.on(this.refEvent,e=>{this.cancelRefEvent(),this.cancelTimeout(),this.receivedResp=e,this.matchReceive(e)}),this.timeoutTimer=setTimeout(()=>{this.trigger("timeout",{})},this.timeout)}hasReceived(e){return this.receivedResp&&this.receivedResp.status===e}trigger(e,t){this.channel.trigger(this.refEvent,{status:e,response:t})}},WL=class{constructor(e,t){this.callback=e,this.timerCalc=t,this.timer=void 0,this.tries=0}reset(){this.tries=0,clearTimeout(this.timer)}scheduleTimeout(){clearTimeout(this.timer),this.timer=setTimeout(()=>{this.tries=this.tries+1,this.callback()},this.timerCalc(this.tries+1))}},aee=class{constructor(e,t,r){this.state=pn.closed,this.topic=e,this.params=Tf(t||{}),this.socket=r,this.bindings=[],this.bindingRef=0,this.timeout=this.socket.timeout,this.joinedOnce=!1,this.joinPush=new kg(this,ci.join,this.params,this.timeout),this.pushBuffer=[],this.stateChangeRefs=[],this.rejoinTimer=new WL(()=>{this.socket.isConnected()&&this.rejoin()},this.socket.rejoinAfterMs),this.stateChangeRefs.push(this.socket.onError(()=>this.rejoinTimer.reset())),this.stateChangeRefs.push(this.socket.onOpen(()=>{this.rejoinTimer.reset(),this.isErrored()&&this.rejoin()})),this.joinPush.receive("ok",()=>{this.state=pn.joined,this.rejoinTimer.reset(),this.pushBuffer.forEach(n=>n.send()),this.pushBuffer=[]}),this.joinPush.receive("error",n=>{this.state=pn.errored,this.socket.hasLogger()&&this.socket.log("channel",`error ${this.topic}`,n),this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.onClose(()=>{this.rejoinTimer.reset(),this.socket.hasLogger()&&this.socket.log("channel",`close ${this.topic}`),this.state=pn.closed,this.socket.remove(this)}),this.onError(n=>{this.socket.hasLogger()&&this.socket.log("channel",`error ${this.topic}`,n),this.isJoining()&&this.joinPush.reset(),this.state=pn.errored,this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.joinPush.receive("timeout",()=>{this.socket.hasLogger()&&this.socket.log("channel",`timeout ${this.topic}`,this.joinPush.timeout),new kg(this,ci.leave,Tf({}),this.timeout).send(),this.state=pn.errored,this.joinPush.reset(),this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.on(ci.reply,(n,s)=>{this.trigger(this.replyEventName(s),n)})}join(e=this.timeout){if(this.joinedOnce)throw new Error("tried to join multiple times. 'join' can only be called a single time per channel instance");return this.timeout=e,this.joinedOnce=!0,this.rejoin(),this.joinPush}
vendor: 5,265 bytes, line 696
696teardown(){this.pushBuffer.forEach(e=>e.destroy()),this.pushBuffer=[],this.rejoinTimer.reset(),this.joinPush.destroy(),this.state=pn.closed,this.bindings=[]}onClose(e){this.on(ci.close,e)}onError(e){return this.on(ci.error,t=>e(t))}on(e,t){let r=this.bindingRef++;return this.bindings.push({event:e,ref:r,callback:t}),r}off(e,t){this.bindings=this.bindings.filter(r=>!(r.event===e&&(typeof t>"u"||t===r.ref)))}canPush(){return this.socket.isConnected()&&this.isJoined()}push(e,t,r=this.timeout){if(t=t||{},!this.joinedOnce)throw new Error(`tried to push '${e}' to '${this.topic}' before joining. Use channel.join() before pushing events`);let n=new kg(this,e,function(){return t},r);return this.canPush()?n.send():(n.startTimeout(),this.pushBuffer.push(n)),n}leave(e=this.timeout){this.rejoinTimer.reset(),this.joinPush.cancelTimeout(),this.state=pn.leaving;let t=()=>{this.socket.hasLogger()&&this.socket.log("channel",`leave ${this.topic}`),this.trigger(ci.close,"leave")},r=new kg(this,ci.leave,Tf({}),e);return r.receive("ok",()=>t()).receive("timeout",()=>t()),r.send(),this.canPush()||r.trigger("ok",{}),r}onMessage(e,t,r){return t}filterBindings(e,t,r){return!0}isMember(e,t,r,n){return this.topic!==e?!1:n&&n!==this.joinRef()?(this.socket.hasLogger()&&this.socket.log("channel","dropping outdated message",{topic:e,event:t,payload:r,joinRef:n}),!1):!0}joinRef(){return this.joinPush.ref}rejoin(e=this.timeout){this.isLeaving()||(this.socket.leaveOpenTopic(this.topic),this.state=pn.joining,this.joinPush.resend(e))}trigger(e,t,r,n){let s=this.onMessage(e,t,r,n);if(t&&!s)throw new Error("channel onMessage callbacks must return the payload, modified or unmodified");let i=this.bindings.filter(o=>o.event===e&&this.filterBindings(o,t,r));for(let o=0;o<i.length;o++)i[o].callback(s,r,n||this.joinRef())}replyEventName(e){return`chan_reply_${e}`}isClosed(){return this.state===pn.closed}isErrored(){return this.state===pn.errored}isJoined(){return this.state===pn.joined}isJoining(){return this.state===pn.joining}isLeaving(){return this.state===pn.leaving}},Rv=class{static request(e,t,r,n,s,i,o){if(Cs.XDomainRequest){let l=new Cs.XDomainRequest;return this.xdomainRequest(l,e,t,n,s,i,o)}else if(Cs.XMLHttpRequest){let l=new Cs.XMLHttpRequest;return this.xhrRequest(l,e,t,r,n,s,i,o)}else{if(Cs.fetch&&Cs.AbortController)return this.fetchRequest(e,t,r,n,s,i,o);throw new Error("No suitable XMLHttpRequest implementation found")}}static fetchRequest(e,t,r,n,s,i,o){let l={method:e,headers:r,body:n},c=null;return s&&(c=new AbortController,setTimeout(()=>c.abort(),s),l.signal=c.signal),Cs.fetch(t,l).then(u=>u.text()).then(u=>this.parseJSON(u)).then(u=>o&&o(u)).catch(u=>{u.name==="AbortError"&&i?i():o&&o(null)}),c}static xdomainRequest(e,t,r,n,s,i,o){return e.timeout=s,e.open(t,r),e.onload=()=>{let l=this.parseJSON(e.responseText);o&&o(l)},i&&(e.ontimeout=i),e.onprogress=()=>{},e.send(n),e}static xhrRequest(e,t,r,n,s,i,o,l){e.open(t,r,!0),e.timeout=i;for(let[c,u]of Object.entries(n))e.setRequestHeader(c,u);return e.onerror=()=>l&&l(null),e.onreadystatechange=()=>{if(e.readyState===nee.complete&&l){let c=this.parseJSON(e.responseText);l(c)}},o&&(e.ontimeout=o),e.send(s),e}static parseJSON(e){if(!e||e==="")return null;try{return JSON.parse(e)}catch{return console&&console.log("failed to parse JSON response",e),null}}static serialize(e,t){let r=[];for(var n in e){if(!Object.prototype.hasOwnProperty.call(e,n))continue;let s=t?`${t}[${n}]`:n,i=e[n];typeof i=="object"?r.push(this.serialize(i,s)):r.push(encodeURIComponent(s)+"="+encodeURIComponent(i))}return r.join("&")}static appendParams(e,t){if(Object.keys(t).length===0)return e;let r=e.match(/\?/)?"&":"?";return`${e}${r}${this.serialize(t)}`}},see=e=>{let t="",r=new Uint8Array(e),n=r.byteLength;for(let s=0;s<n;s++)t+=String.fromCharCode(r[s]);return btoa(t)},zc=class{constructor(e,t){t&&t.length===2&&t[1].startsWith(I_)&&(this.authToken=atob(t[1].slice(I_.length))),this.endPoint=null,this.token=null,this.skipHeartbeat=!0,this.reqs=new Set,this.awaitingBatchAck=!1,this.currentBatch=null,this.currentBatchTimer=null,this.batchBuffer=[],this.onopen=function(){},this.onerror=function(){},this.onmessage=function(){},this.onclose=function(){},this.pollEndpoint=this.normalizeEndpoint(e),this.readyState=Rs.connecting,setTimeout(()=>this.poll(),0)}normalizeEndpoint(e){return e.replace("ws://","http://").replace("wss://","https://").replace(new RegExp("(.*)/"+$_.websocket),"$1/"+$_.longpoll)}endpointURL(){return Rv.appendParams(this.pollEndpoint,{token:this.token})}closeAndRetry(e,t,r){this.close(e,t,r),this.readyState=Rs.connecting}ontimeout(){this.onerror("timeout"),this.closeAndRetry(1005,"timeout",!1)}isActive(){return this.readyState===Rs.open||this.readyState===Rs.connecting}poll(){const e={Accept:"application/json"};this.authToken&&(e["X-Phoenix-AuthToken"]=this.authToken),this.ajax("GET",e,null,()=>this.ontimeout(),t=>{if(t){var{status:r,token:n,messages:s}=t;if(r===410&&this.token!==null){this.onerror(410),this.closeAndRetry(3410,"session_gone",!1);return}this.token=n}else r=0;switch(r){case 200:s.forEach(i=>{setTimeout(()=>this.onmessage({data:i}),0)}),this.poll();break;case 204:this.poll();break;case 410:this.readyState=Rs.open,this.onopen({}),this.poll();break;
696case 403:this.onerror(403),this.close(1008,"forbidden",!1);break;case 0:case 500:this.onerror(500),this.closeAndRetry(1011,"internal server error",500);break;default:throw new Error(`unhandled poll status ${r}`)}})}send(e){typeof e!="string"&&(e=see(e)),this.currentBatch?this.currentBatch.push(e):this.awaitingBatchAck?this.batchBuffer.push(e):(this.currentBatch=[e],this.currentBatchTimer=setTimeout(()=>{this.batchSend(this.currentBatch),this.currentBatch=null},0))}batchSend(e){this.awaitingBatchAck=!0,this.ajax("POST",{"Content-Type":"application/x-ndjson"},e.join(`
697`),()=>this.onerror("timeout"),t=>{this.awaitingBatchAck=!1,!t||t.status!==200?(this.onerror(t&&t.status),this.closeAndRetry(1011,"internal server error",!1)):this.batchBuffer.length>0&&(this.batchSend(this.batchBuffer),this.batchBuffer=[])})}close(e,t,r){for(let s of this.reqs)s.abort();this.readyState=Rs.closed;let n=Object.assign({code:1e3,reason:void 0,wasClean:!0},{code:e,reason:t,wasClean:r});this.batchBuffer=[],clearTimeout(this.currentBatchTimer),this.currentBatchTimer=null,typeof CloseEvent<"u"?this.onclose(new CloseEvent("close",n)):this.onclose(n)}ajax(e,t,r,n,s){let i,o=()=>{this.reqs.delete(i),n()};i=Rv.request(e,this.endpointURL(),t,r,this.timeout,o,l=>{this.reqs.delete(i),this.isActive()&&s(l)}),this.reqs.add(i)}},iee=class lf{constructor(t,r={}){let n=r.events||{state:"presence_state",diff:"presence_diff"};this.state={},this.pendingDiffs=[],this.channel=t,this.joinRef=null,this.caller={onJoin:function(){},onLeave:function(){},onSync:function(){}},this.channel.on(n.state,s=>{let{onJoin:i,onLeave:o,onSync:l}=this.caller;this.joinRef=this.channel.joinRef(),this.state=lf.syncState(this.state,s,i,o),this.pendingDiffs.forEach(c=>{this.state=lf.syncDiff(this.state,c,i,o)}),this.pendingDiffs=[],l()}),this.channel.on(n.diff,s=>{let{onJoin:i,onLeave:o,onSync:l}=this.caller;this.inPendingSyncState()?this.pendingDiffs.push(s):(this.state=lf.syncDiff(this.state,s,i,o),l())})}onJoin(t){this.caller.onJoin=t}onLeave(t){this.caller.onLeave=t}onSync(t){this.caller.onSync=t}list(t){return lf.list(this.state,t)}inPendingSyncState(){return!this.joinRef||this.joinRef!==this.channel.joinRef()}static syncState(t,r,n,s){let i=this.clone(t),o={},l={};return this.map(i,(c,u)=>{r[c]||(l[c]=u)}),this.map(r,(c,u)=>{let h=i[c];if(h){let d=u.metas.map(p=>p.phx_ref),f=h.metas.map(p=>p.phx_ref),m=u.metas.filter(p=>f.indexOf(p.phx_ref)<0),g=h.metas.filter(p=>d.indexOf(p.phx_ref)<0);m.length>0&&(o[c]=u,o[c].metas=m),g.length>0&&(l[c]=this.clone(h),l[c].metas=g)}else o[c]=u}),this.syncDiff(i,{joins:o,leaves:l},n,s)}static syncDiff(t,r,n,s){let{joins:i,leaves:o}=this.clone(r);return n||(n=function(){}),s||(s=function(){}),this.map(i,(l,c)=>{let u=t[l];if(t[l]=this.clone(c),u){let h=t[l].metas.map(f=>f.phx_ref),d=u.metas.filter(f=>h.indexOf(f.phx_ref)<0);t[l].metas.unshift(...d)}n(l,u,c)}),this.map(o,(l,c)=>{let u=t[l];if(!u)return;let h=c.metas.map(d=>d.phx_ref);u.metas=u.metas.filter(d=>h.indexOf(d.phx_ref)<0),s(l,u,c),u.metas.length===0&&delete t[l]}),t}static list(t,r){return r||(r=function(n,s){return s}),this.map(t,(n,s)=>r(n,s))}static map(t,r){return Object.getOwnPropertyNames(t).map(n=>r(n,t[n]))}static clone(t){return JSON.parse(JSON.stringify(t))}},Cg={HEADER_LENGTH:1,META_LENGTH:4,KINDS:{push:0,reply:1,broadcast:2},encode(e,t){if(e.payload.constructor===ArrayBuffer)return t(this.binaryEncode(e));{let r=[e.join_ref,e.ref,e.topic,e.event,e.payload];return t(JSON.stringify(r))}},decode(e,t){if(e.constructor===ArrayBuffer)return t(this.binaryDecode(e));{let[r,n,s,i,o]=JSON.parse(e);return t({join_ref:r,ref:n,topic:s,event:i,payload:o})}},binaryEncode(e){let{join_ref:t,ref:r,event:n,topic:s,payload:i}=e,o=this.META_LENGTH+t.length+r.length+s.length+n.length,l=new ArrayBuffer(this.HEADER_LENGTH+o),c=new DataView(l),u=0;c.setUint8(u++,this.KINDS.push),c.setUint8(u++,t.length),c.setUint8(u++,r.length),c.setUint8(u++,s.length),c.setUint8(u++,n.length),Array.from(t,d=>c.setUint8(u++,d.charCodeAt(0))),Array.from(r,d=>c.setUint8(u++,d.charCodeAt(0))),Array.from(s,d=>c.setUint8(u++,d.charCodeAt(0))),Array.from(n,d=>c.setUint8(u++,d.charCodeAt(0)));var h=new Uint8Array(l.byteLength+i.byteLength);return h.set(new Uint8Array(l),0),h.set(new Uint8Array(i),l.byteLength),h.buffer},binaryDecode(e){let t=new DataView(e),r=t.getUint8(0),n=new TextDecoder;
vendor: 8,599 bytes, line 697
697switch(r){case this.KINDS.push:return this.decodePush(e,t,n);case this.KINDS.reply:return this.decodeReply(e,t,n);case this.KINDS.broadcast:return this.decodeBroadcast(e,t,n)}},decodePush(e,t,r){let n=t.getUint8(1),s=t.getUint8(2),i=t.getUint8(3),o=this.HEADER_LENGTH+this.META_LENGTH-1,l=r.decode(e.slice(o,o+n));o=o+n;let c=r.decode(e.slice(o,o+s));o=o+s;let u=r.decode(e.slice(o,o+i));o=o+i;let h=e.slice(o,e.byteLength);return{join_ref:l,ref:null,topic:c,event:u,payload:h}},decodeReply(e,t,r){let n=t.getUint8(1),s=t.getUint8(2),i=t.getUint8(3),o=t.getUint8(4),l=this.HEADER_LENGTH+this.META_LENGTH,c=r.decode(e.slice(l,l+n));l=l+n;let u=r.decode(e.slice(l,l+s));l=l+s;let h=r.decode(e.slice(l,l+i));l=l+i;let d=r.decode(e.slice(l,l+o));l=l+o;let f=e.slice(l,e.byteLength),m={status:d,response:f};return{join_ref:c,ref:u,topic:h,event:ci.reply,payload:m}},decodeBroadcast(e,t,r){let n=t.getUint8(1),s=t.getUint8(2),i=this.HEADER_LENGTH+2,o=r.decode(e.slice(i,i+n));i=i+n;let l=r.decode(e.slice(i,i+s));i=i+s;let c=e.slice(i,e.byteLength);return{join_ref:null,ref:null,topic:o,event:l,payload:c}}},oee=class{constructor(e,t={}){this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.channels=[],this.sendBuffer=[],this.ref=0,this.fallbackRef=null,this.timeout=t.timeout||tee,this.transport=t.transport||Cs.WebSocket||zc,this.conn=void 0,this.primaryPassedHealthCheck=!1,this.longPollFallbackMs=t.longPollFallbackMs,this.fallbackTimer=null,this.sessionStore=t.sessionStorage||Cs&&Cs.sessionStorage,this.establishedConnections=0,this.defaultEncoder=Cg.encode.bind(Cg),this.defaultDecoder=Cg.decode.bind(Cg),this.closeWasClean=!0,this.disconnecting=!1,this.binaryType=t.binaryType||"arraybuffer",this.connectClock=1,this.pageHidden=!1,this.encode=void 0,this.decode=void 0,this.transport!==zc?(this.encode=t.encode||this.defaultEncoder,this.decode=t.decode||this.defaultDecoder):(this.encode=this.defaultEncoder,this.decode=this.defaultDecoder);let r=null;lu&&lu.addEventListener&&(lu.addEventListener("pagehide",n=>{this.conn&&(this.disconnect(),r=this.connectClock)}),lu.addEventListener("pageshow",n=>{r===this.connectClock&&(r=null,this.connect())}),lu.addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"?this.pageHidden=!0:(this.pageHidden=!1,!this.isConnected()&&!this.closeWasClean&&this.teardown(()=>this.connect()))})),this.heartbeatIntervalMs=t.heartbeatIntervalMs||3e4,this.autoSendHeartbeat=t.autoSendHeartbeat??!0,this.heartbeatCallback=t.heartbeatCallback??(()=>{}),this.rejoinAfterMs=n=>t.rejoinAfterMs?t.rejoinAfterMs(n):[1e3,2e3,5e3][n-1]||1e4,this.reconnectAfterMs=n=>t.reconnectAfterMs?t.reconnectAfterMs(n):[10,50,100,150,200,250,500,1e3,2e3][n-1]||5e3,this.logger=t.logger||null,!this.logger&&t.debug&&(this.logger=(n,s,i)=>{console.log(`${n}: ${s}`,i)}),this.longpollerTimeout=t.longpollerTimeout||2e4,this.params=Tf(t.params||{}),this.endPoint=`${e}/${$_.websocket}`,this.vsn=t.vsn||eee,this.heartbeatTimeoutTimer=null,this.heartbeatTimer=null,this.heartbeatSentAt=null,this.pendingHeartbeatRef=null,this.reconnectTimer=new WL(()=>{if(this.pageHidden){this.log("Not reconnecting as page is hidden!"),this.teardown();return}this.teardown(async()=>{t.beforeReconnect&&await t.beforeReconnect(),this.connect()})},this.reconnectAfterMs),this.authToken=t.authToken}getLongPollTransport(){return zc}replaceTransport(e){this.connectClock++,this.closeWasClean=!0,clearTimeout(this.fallbackTimer),this.reconnectTimer.reset(),this.conn&&(this.conn.close(),this.conn=null),this.transport=e}protocol(){return location.protocol.match(/^https/)?"wss":"ws"}endPointURL(){let e=Rv.appendParams(Rv.appendParams(this.endPoint,this.params()),{vsn:this.vsn});return e.charAt(0)!=="/"?e:e.charAt(1)==="/"?`${this.protocol()}:${e}`:`${this.protocol()}://${location.host}${e}`}disconnect(e,t,r){this.connectClock++,this.disconnecting=!0,this.closeWasClean=!0,clearTimeout(this.fallbackTimer),this.reconnectTimer.reset(),this.teardown(()=>{this.disconnecting=!1,e&&e()},t,r)}connect(e){e&&(console&&console.log("passing params to connect is deprecated. Instead pass :params to the Socket constructor"),this.params=Tf(e)),!(this.conn&&!this.disconnecting)&&(this.longPollFallbackMs&&this.transport!==zc?this.connectWithFallback(zc,this.longPollFallbackMs):this.transportConnect())}log(e,t,r){this.logger&&this.logger(e,t,r)}hasLogger(){return this.logger!==null}onOpen(e){let t=this.makeRef();return this.stateChangeCallbacks.open.push([t,e]),t}onClose(e){let t=this.makeRef();return this.stateChangeCallbacks.close.push([t,e]),t}onError(e){let t=this.makeRef();return this.stateChangeCallbacks.error.push([t,e]),t}onMessage(e){let t=this.makeRef();return this.stateChangeCallbacks.message.push([t,e]),t}onHeartbeat(e){this.heartbeatCallback=e}ping(e){if(!this.isConnected())return!1;let t=this.makeRef(),r=Date.now();this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:t});let n=this.onMessage(s=>{s.ref===t&&(this.off([n]),e(Date.now()-r))});return!0}transportName(e){switch(e){case zc:return"LongPoll";default:return e.name}}transportConnect(){this.connectClock++,this.closeWasClean=!1;let e;this.authToken&&(e=["phoenix",`${I_}${btoa(this.authToken).replace(/=/g,"")}`]),this.conn=new this.transport(this.endPointURL(),e),this.conn.binaryType=this.binaryType,this.conn.timeout=this.longpollerTimeout,this.conn.onopen=()=>this.onConnOpen(),this.conn.onerror=t=>this.onConnError(t),this.conn.onmessage=t=>this.onConnMessage(t),this.conn.onclose=t=>this.onConnClose(t)}getSession(e){return this.sessionStore&&this.sessionStore.getItem(e)}storeSession(e,t){this.sessionStore&&this.sessionStore.setItem(e,t)}connectWithFallback(e,t=2500){clearTimeout(this.fallbackTimer);let r=!1,n=!0,s,i,o=this.transportName(e),l=c=>{this.log("transport",`falling back to ${o}...`,c),this.off([s,i]),n=!1,this.replaceTransport(e),this.transportConnect()};if(this.getSession(`phx:fallback:${o}`))return l("memorized");this.fallbackTimer=setTimeout(l,t),i=this.onError(c=>{this.log("transport","error",c),n&&!r&&(clearTimeout(this.fallbackTimer),l(c))}),this.fallbackRef&&this.off([this.fallbackRef]),this.fallbackRef=this.onOpen(()=>{if(r=!0,!n){let c=this.transportName(e);return this.primaryPassedHealthCheck||this.storeSession(`phx:fallback:${c}`,"true"),this.log("transport",`established ${c} fallback`)}clearTimeout(this.fallbackTimer),this.fallbackTimer=setTimeout(l,t),this.ping(c=>{this.log("transport","connected to primary after",c),this.primaryPassedHealthCheck=!0,clearTimeout(this.fallbackTimer)})}),this.transportConnect()}clearHeartbeats(){clearTimeout(this.heartbeatTimer),clearTimeout(this.heartbeatTimeoutTimer)}onConnOpen(){this.hasLogger()&&this.log("transport",`connected to ${this.endPointURL()}`),this.closeWasClean=!1,this.disconnecting=!1,this.establishedConnections++,this.flushSendBuffer(),this.reconnectTimer.reset(),this.autoSendHeartbeat&&this.resetHeartbeat(),this.triggerStateCallbacks("open")}heartbeatTimeout(){if(this.pendingHeartbeatRef){this.pendingHeartbeatRef=null,this.heartbeatSentAt=null,this.hasLogger()&&this.log("transport","heartbeat timeout. Attempting to re-establish connection");try{this.heartbeatCallback("timeout")}catch(e){this.log("error","error in heartbeat callback",e)}this.triggerChanError(),this.closeWasClean=!1,this.teardown(()=>this.reconnectTimer.scheduleTimeout(),ree,"heartbeat timeout")}}resetHeartbeat(){this.conn&&this.conn.skipHeartbeat||(this.pendingHeartbeatRef=null,this.clearHeartbeats(),this.heartbeatTimer=setTimeout(()=>this.sendHeartbeat(),this.heartbeatIntervalMs))}teardown(e,t,r){if(!this.conn)return e&&e();const n=this.conn;this.waitForBufferDone(n,()=>{t?n.close(t,r||""):n.close(),this.waitForSocketClosed(n,()=>{this.conn===n&&(this.conn.onopen=function(){},this.conn.onerror=function(){},this.conn.onmessage=function(){},this.conn.onclose=function(){},this.conn=null),e&&e()})})}waitForBufferDone(e,t,r=1){if(r===5||!e.bufferedAmount){t();return}setTimeout(()=>{this.waitForBufferDone(e,t,r+1)},150*r)}waitForSocketClosed(e,t,r=1){if(r===5||e.readyState===Rs.closed){t();return}setTimeout(()=>{this.waitForSocketClosed(e,t,r+1)},150*r)}onConnClose(e){this.conn&&(this.conn.onclose=()=>{}),this.hasLogger()&&this.log("transport","close",e),this.triggerChanError(),this.clearHeartbeats(),this.closeWasClean||this.reconnectTimer.scheduleTimeout(),this.triggerStateCallbacks("close",e)}onConnError(e){this.hasLogger()&&this.log("transport",e);let t=this.transport,r=this.establishedConnections;this.triggerStateCallbacks("error",e,t,r),(t===this.transport||r>0)&&this.triggerChanError()}
697triggerChanError(){this.channels.forEach(e=>{e.isErrored()||e.isLeaving()||e.isClosed()||e.trigger(ci.error)})}connectionState(){switch(this.conn&&this.conn.readyState){case Rs.connecting:return"connecting";case Rs.open:return"open";case Rs.closing:return"closing";default:return"closed"}}isConnected(){return this.connectionState()==="open"}remove(e){this.off(e.stateChangeRefs),this.channels=this.channels.filter(t=>t!==e)}off(e){for(let t in this.stateChangeCallbacks)this.stateChangeCallbacks[t]=this.stateChangeCallbacks[t].filter(([r])=>e.indexOf(r)===-1)}channel(e,t={}){let r=new aee(e,t,this);return this.channels.push(r),r}push(e){if(this.hasLogger()){let{topic:t,event:r,payload:n,ref:s,join_ref:i}=e;this.log("push",`${t} ${r} (${i}, ${s})`,n)}this.isConnected()?this.encode(e,t=>this.conn.send(t)):this.sendBuffer.push(()=>this.encode(e,t=>this.conn.send(t)))}makeRef(){let e=this.ref+1;return e===this.ref?this.ref=0:this.ref=e,this.ref.toString()}sendHeartbeat(){if(!this.isConnected()){try{this.heartbeatCallback("disconnected")}catch(e){this.log("error","error in heartbeat callback",e)}return}if(this.pendingHeartbeatRef){this.heartbeatTimeout();return}this.pendingHeartbeatRef=this.makeRef(),this.heartbeatSentAt=Date.now(),this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:this.pendingHeartbeatRef});try{this.heartbeatCallback("sent")}catch(e){this.log("error","error in heartbeat callback",e)}this.heartbeatTimeoutTimer=setTimeout(()=>this.heartbeatTimeout(),this.heartbeatIntervalMs)}flushSendBuffer(){this.isConnected()&&this.sendBuffer.length>0&&(this.sendBuffer.forEach(e=>e()),this.sendBuffer=[])}onConnMessage(e){this.decode(e.data,t=>{let{topic:r,event:n,payload:s,ref:i,join_ref:o}=t;if(i&&i===this.pendingHeartbeatRef){const l=this.heartbeatSentAt?Date.now()-this.heartbeatSentAt:void 0;this.clearHeartbeats();try{this.heartbeatCallback(s.status==="ok"?"ok":"error",l)}catch(c){this.log("error","error in heartbeat callback",c)}this.pendingHeartbeatRef=null,this.heartbeatSentAt=null,this.autoSendHeartbeat&&(this.heartbeatTimer=setTimeout(()=>this.sendHeartbeat(),this.heartbeatIntervalMs))}this.hasLogger()&&this.log("receive",`${s.status||""} ${r} ${n} ${i&&"("+i+")"||""}`.trim(),s);for(let l=0;l<this.channels.length;l++){const c=this.channels[l];c.isMember(r,n,s,o)&&c.trigger(n,s,i,o)}this.triggerStateCallbacks("message",t)})}triggerStateCallbacks(e,...t){try{this.stateChangeCallbacks[e].forEach(([r,n])=>{try{n(...t)}catch(s){this.log("error",`error in ${e} callback`,s)}})}catch(r){this.log("error",`error triggering ${e} callbacks`,r)}}leaveOpenTopic(e){let t=this.channels.find(r=>r.topic===e&&(r.isJoined()||r.isJoining()));t&&(this.hasLogger()&&this.log("transport",`leaving duplicate topic "${e}"`),t.leave())}};class Af{constructor(t,r){const n=cee(r);this.presence=new iee(t.getChannel(),n),this.presence.onJoin((s,i,o)=>{const l=Af.onJoinPayload(s,i,o);t.getChannel().trigger("presence",l)}),this.presence.onLeave((s,i,o)=>{const l=Af.onLeavePayload(s,i,o);t.getChannel().trigger("presence",l)}),this.presence.onSync(()=>{t.getChannel().trigger("presence",{event:"sync"})})}get state(){return Af.transformState(this.presence.state)}static transformState(t){return t=lee(t),Object.getOwnPropertyNames(t).reduce((r,n)=>{const s=t[n];return r[n]=Ry(s),r},{})}static onJoinPayload(t,r,n){const s=rP(r),i=Ry(n);return{event:"join",key:t,currentPresences:s,newPresences:i}}static onLeavePayload(t,r,n){const s=rP(r),i=Ry(n);return{event:"leave",key:t,currentPresences:s,leftPresences:i}}}function Ry(e){return e.metas.map(t=>(t.presence_ref=t.phx_ref,delete t.phx_ref,delete t.phx_ref_prev,t))}function lee(e){return JSON.parse(JSON.stringify(e))}function cee(e){return(e==null?void 0:e.events)&&{events:e.events}}function rP(e){return e!=null&&e.metas?Ry(e):[]}var nP;(function(e){e.SYNC="sync",e.JOIN="join",e.LEAVE="leave"})(nP||(nP={}));class uee{get state(){return this.presenceAdapter.state}constructor(t,r){this.channel=t,this.presenceAdapter=new Af(this.channel.channelAdapter,r)}}class dee{constructor(t,r,n){const s=hee(n);this.channel=t.getSocket().channel(r,s),this.socket=t}get state(){return this.channel.state}set state(t){this.channel.state=t}get joinedOnce(){return this.channel.joinedOnce}get joinPush(){return this.channel.joinPush}get rejoinTimer(){return this.channel.rejoinTimer}on(t,r){return this.channel.on(t,r)}off(t,r){this.channel.off(t,r)}subscribe(t){return this.channel.join(t)}unsubscribe(t){return this.channel.leave(t)}teardown(){this.channel.teardown()}onClose(t){this.channel.onClose(t)}onError(t){return this.channel.onError(t)}push(t,r,n){let s;try{s=this.channel.push(t,r,n)}catch{throw`tried to push '${t}' to '${this.channel.topic}' before joining. Use channel.subscribe() before pushing events`}if(this.channel.pushBuffer.length>HZ){const i=this.channel.pushBuffer.shift();i.cancelTimeout(),this.socket.log("channel",`discarded push due to buffer overflow: ${i.event}`,i.payload())}return s}updateJoinPayload(t){const r=this.channel.joinPush.payload();this.channel.joinPush.payload=()=>Object.assign(Object.assign({},r),t)}canPush(){return this.socket.isConnected()&&this.state===vo.joined}isJoined(){return this.state===vo.joined}isJoining(){return this.state===vo.joining}isClosed(){return this.state===vo.closed}isLeaving(){return this.state===vo.leaving}updateFilterBindings(t){this.channel.filterBindings=t}updatePayloadTransform(t){this.channel.onMessage=t}getChannel(){return this.channel}}function hee(e){return{config:Object.assign({broadcast:{ack:!1,self:!1},presence:{key:"",enabled:!1},private:!1},e.config)}}var aP;(function(e){e.ALL="*",e.INSERT="INSERT",e.UPDATE="UPDATE",e.DELETE="DELETE"})(aP||(aP={}));var Pf;(function(e){e.BROADCAST="broadcast",e.PRESENCE="presence",e.POSTGRES_CHANGES="postgres_changes",e.SYSTEM="system"})(Pf||(Pf={}));var ui;(function(e){e.SUBSCRIBED="SUBSCRIBED",e.TIMED_OUT="TIMED_OUT",e.CLOSED="CLOSED",e.CHANNEL_ERROR="CHANNEL_ERROR"})(ui||(ui={}));class Of{get state(){return this.channelAdapter.state}set state(t){this.channelAdapter.state=t}get joinedOnce(){return this.channelAdapter.joinedOnce}get timeout(){return this.socket.timeout}get joinPush(){return this.channelAdapter.joinPush}get rejoinTimer(){return this.channelAdapter.rejoinTimer}constructor(t,r={config:{}},n){var s,i;if(this.topic=t,this.params=r,this.socket=n,this.bindings={},this.subTopic=t.replace(/^realtime:/i,""),this.params.config=Object.assign({broadcast:{ack:!1,self:!1},presence:{key:"",enabled:!1},private:!1},r.config),this.channelAdapter=new dee(this.socket.socketAdapter,t,this.params),this.presence=new uee(this),this._onClose(()=>{this.socket._remove(this)}),this._updateFilterTransform(),this.broadcastEndpointURL=UL(this.socket.socketAdapter.endPointURL()),this.private=this.params.config.private||!1,!this.private&&(!((i=(s=this.params.config)===null||s===void 0?void 0:s.broadcast)===null||i===void 0)&&i.replay))throw`tried to use replay on public channel '${this.topic}'. It must be a private channel.`}subscribe(t,r=this.timeout){var n,s,i;if(this.socket.isConnected()||this.socket.connect(),this.channelAdapter.isClosed()){const{config:{broadcast:o,presence:l,private:c}}=this.params,u=(s=(n=this.bindings.postgres_changes)===null||n===void 0?void 0:n.map(m=>m.filter))!==null&&s!==void 0?s:[],h=!!this.bindings[Pf.PRESENCE]&&this.bindings[Pf.PRESENCE].length>0||((i=this.params.config.presence)===null||i===void 0?void 0:i.enabled)===!0,d={},f={broadcast:o,presence:Object.assign(Object.assign({},l),{enabled:h}),postgres_changes:u,private:c};this.socket.accessTokenValue&&(d.access_token=this.socket.accessTokenValue),this._onError(m=>{t==null||t(ui.CHANNEL_ERROR,m)}),this._onClose(()=>t==null?void 0:t(ui.CLOSED)),this.updateJoinPayload(Object.assign({config:f},d)),this._updateFilterMessage(),this.channelAdapter.subscribe(r).receive("ok",async({postgres_changes:m})=>
697{if(this.socket._isManualToken()||this.socket.setAuth(),m===void 0){t==null||t(ui.SUBSCRIBED);return}this._updatePostgresBindings(m,t)}).receive("error",m=>{this.state=vo.errored,t==null||t(ui.CHANNEL_ERROR,new Error(JSON.stringify(Object.values(m).join(", ")||"error")))}).receive("timeout",()=>{t==null||t(ui.TIMED_OUT)})}return this}_updatePostgresBindings(t,r){var n;const s=this.bindings.postgres_changes,i=(n=s==null?void 0:s.length)!==null&&n!==void 0?n:0,o=[];for(let l=0;l<i;l++){const c=s[l],{filter:{event:u,schema:h,table:d,filter:f}}=c,m=t&&t[l];if(m&&m.event===u&&Of.isFilterValueEqual(m.schema,h)&&Of.isFilterValueEqual(m.table,d)&&Of.isFilterValueEqual(m.filter,f))o.push(Object.assign(Object.assign({},c),{id:m.id}));else{this.unsubscribe(),this.state=vo.errored,r==null||r(ui.CHANNEL_ERROR,new Error("mismatch between server and client bindings for postgres changes"));return}}this.bindings.postgres_changes=o,this.state!=vo.errored&&r&&r(ui.SUBSCRIBED)}presenceState(){return this.presence.state}async track(t,r={}){return await this.send({type:"presence",event:"track",payload:t},r.timeout||this.timeout)}async untrack(t={}){return await this.send({type:"presence",event:"untrack"},t)}on(t,r,n){if(this.channelAdapter.isJoined()&&t===Pf.PRESENCE)throw this.socket.log("channel",`cannot add presence callbacks for ${this.topic} after joining.`),new Error("cannot add presence callbacks after joining a channel");return this._on(t,r,n)}async httpSend(t,r,n={}){var s;if(r==null)return Promise.reject("Payload is required for httpSend()");const i={apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"};this.socket.accessTokenValue&&(i.Authorization=`Bearer ${this.socket.accessTokenValue}`);const o={method:"POST",headers:i,body:JSON.stringify({messages:[{topic:this.subTopic,event:t,payload:r,private:this.private}]})},l=await this._fetchWithTimeout(this.broadcastEndpointURL,o,(s=n.timeout)!==null&&s!==void 0?s:this.timeout);if(l.status===202)return{success:!0};let c=l.statusText;try{const u=await l.json();c=u.error||u.message||c}catch{}return Promise.reject(new Error(c))}async send(t,r={}){var n,s;if(!this.channelAdapter.canPush()&&t.type==="broadcast"){console.warn("Realtime send() is automatically falling back to REST API. This behavior will be deprecated 
697in the future. Please use httpSend() explicitly for REST delivery.");const{event:i,payload:o}=t,l={apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"};this.socket.accessTokenValue&&(l.Authorization=`Bearer ${this.socket.accessTokenValue}`);const c={method:"POST",headers:l,body:JSON.stringify({messages:[{topic:this.subTopic,event:i,payload:o,private:this.private}]})};try{const u=await this._fetchWithTimeout(this.broadcastEndpointURL,c,(n=r.timeout)!==null&&n!==void 0?n:this.timeout);return await((s=u.body)===null||s===void 0?void 0:s.cancel()),u.ok?"ok":"error"}catch(u){return u.name==="AbortError"?"timed out":"error"}}else return new Promise(i=>{var o,l,c;const u=this.channelAdapter.push(t.type,t,r.timeout||this.timeout);t.type==="broadcast"&&!(!((c=(l=(o=this.params)===null||o===void 0?void 0:o.config)===null||l===void 0?void 0:l.broadcast)===null||c===void 0)&&c.ack)&&i("ok"),u.receive("ok",()=>i("ok")),u.receive("error",()=>i("error")),u.receive("timeout",()=>i("timed out"))})}updateJoinPayload(t){this.channelAdapter.updateJoinPayload(t)}async unsubscribe(t=this.timeout){return new Promise(r=>{this.channelAdapter.unsubscribe(t).receive("ok",()=>r("ok")).receive("timeout",()=>r("timed out")).receive("error",()=>r("error"))})}teardown(){this.channelAdapter.teardown()}async _fetchWithTimeout(t,r,n){const s=new AbortController,i=setTimeout(()=>s.abort(),n),o=await this.socket.fetch(t,Object.assign(Object.assign({},r),{signal:s.signal}));return clearTimeout(i),o}_on(t,r,n){const s=t.toLocaleLowerCase(),i=this.channelAdapter.on(t,n),o={type:s,filter:r,callback:n,ref:i};return this.bindings[s]?this.bindings[s].push(o):this.bindings[s]=[o],this._updateFilterMessage(),this}_onClose(t){this.channelAdapter.onClose(t)}_onError(t){this.channelAdapter.onError(t)}_updateFilterMessage(){this.channelAdapter.updateFilterBindings((t,r,n)=>{var s,i,o,l,c,u,h;const d=t.event.toLocaleLowerCase();if(this._notThisChannelEvent(d,n))return!1;const f=(s=this.bindings[d])===null||s===void 0?void 0:s.find(m=>m.ref===t.ref);if(!f)return!0;if(["broadcast","presence","postgres_changes"].includes(d))if("id"in f){const m=f.id,g=(i=f.filter)===null||i===void 0?void 0:i.event;return m&&((o=r.ids)===null||o===void 0?void 0:o.includes(m))&&(g==="*"||(g==null?void 0:g.toLocaleLowerCase())===((l=r.data)===null||l===void 0?void 0:l.type.toLocaleLowerCase()))}else{const m=(u=(c=f==null?void 0:f.filter)===null||c===void 0?void 0:c.event)===null||u===void 0?void 0:u.toLocaleLowerCase();return m==="*"||m===((h=r==null?void 0:r.event)===null||h===void 0?void 0:h.toLocaleLowerCase())}else return f.type.toLocaleLowerCase()===d})}_notThisChannelEvent(t,r){const{close:n,error:s,leave:i,join:o}=zL;return r&&[n,s,i,o].includes(t)&&r!==this.joinPush.ref}_updateFilterTransform(){this.channelAdapter.updatePayloadTransform((t,r,n)=>{if(typeof r=="object"&&"ids"in r){const s=r.data,{schema:i,table:o,commit_timestamp:l,type:c,errors:u}=s;return Object.assign(Object.assign({},{schema:i,table:o,commit_timestamp:l,eventType:c,new:{},old:{},errors:u}),this._getPayloadRecords(s))}return r})}static isFilterValueEqual(t,r){return(t??void 0)===(r??void 0)}_getPayloadRecords(t){const r={new:{},old:{}};return(t.type==="INSERT"||t.type==="UPDATE")&&(r.new=tP(t.columns,t.record)),(t.type==="UPDATE"||t.type==="DELETE")&&(r.old=tP(t.columns,t.old_record)),r}}class fee{constructor(t,r){this.socket=new oee(t,r)}get timeout(){return this.socket.timeout}get endPoint(){return this.socket.endPoint}get transport(){return this.socket.transport}get heartbeatIntervalMs(){return this.socket.heartbeatIntervalMs}get heartbeatCallback(){return this.socket.heartbeatCallback}set heartbeatCallback(t){this.socket.heartbeatCallback=t}get heartbeatTimer(){return this.socket.heartbeatTimer}get pendingHeartbeatRef(){return this.socket.pendingHeartbeatRef}get reconnectTimer(){return this.socket.reconnectTimer}get vsn(){return this.socket.vsn}get encode(){return this.socket.encode}get decode(){return this.socket.decode}get reconnectAfterMs(){return this.socket.reconnectAfterMs}get sendBuffer(){return this.socket.sendBuffer}get stateChangeCallbacks(){return this.socket.stateChangeCallbacks}connect(){this.socket.connect()}disconnect(t,r,n,s=1e4){return new Promise(i=>{setTimeout(()=>i("timeout"),s),this.socket.disconnect(()=>{t(),i("ok")},r,n)})}push(t){this.socket.push(t)}log(t,r,n){this.socket.log(t,r,n)}makeRef(){return this.socket.makeRef()}onOpen(t){this.socket.onOpen(t)}onClose(t){this.socket.onClose(t)}onError(t){this.socket.onError(t)}onMessage(t){this.socket.onMessage(t)}isConnected(){return this.socket.isConnected()}isConnecting(){return this.socket.connectionState()==M_.connecting}isDisconnecting(){return this.socket.connectionState()==M_.closing}connectionState(){return this.socket.connectionState()}endPointURL(){return this.socket.endPointURL()}sendHeartbeat(){this.socket.sendHeartbeat()}getSocket(){return this.socket}}const mee={HEARTBEAT_INTERVAL:25e3},pee=[1e3,2e3,5e3,1e4],gee=1e4,yee=`
698  addEventListener("message", (e) => {
699    if (e.data.event === "start") {
700      setInterval(() => postMessage({ event: "keepAlive" }), e.data.interval);
701    }
702  });`;class vee{get endPoint(){return this.socketAdapter.endPoint}get timeout(){return this.socketAdapter.timeout}get transport(){return this.socketAdapter.transport}get heartbeatCallback(){return this.socketAdapter.heartbeatCallback}get heartbeatIntervalMs(){return this.socketAdapter.heartbeatIntervalMs}get heartbeatTimer(){return this.worker?this._workerHeartbeatTimer:this.socketAdapter.heartbeatTimer}get pendingHeartbeatRef(){return this.worker?this._pendingWorkerHeartbeatRef:this.socketAdapter.pendingHeartbeatRef}get reconnectTimer(){return this.socketAdapter.reconnectTimer}get vsn(){return this.socketAdapter.vsn}get encode(){return this.socketAdapter.encode}get decode(){return this.socketAdapter.decode}get reconnectAfterMs(){return this.socketAdapter.reconnectAfterMs}get sendBuffer(){return this.socketAdapter.sendBuffer}get stateChangeCallbacks(){return this.socketAdapter.stateChangeCallbacks}constructor(t,r){var n;if(this.channels=new Array,this.accessTokenValue=null,this.accessToken=null,this.apiKey=null,this.httpEndpoint="",this.headers={},this.params={}
702,this.ref=0,this.serializer=new qZ,this._manuallySetToken=!1,this._authPromise=null,this._workerHeartbeatTimer=void 0,this._pendingWorkerHeartbeatRef=null,this._resolveFetch=i=>i?(...o)=>i(...o):(...o)=>fetch(...o),!(!((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;const s=this._initializeOptions(r);this.socketAdapter=new fee(t,s),this.httpEndpoint=UL(t),this.fetch=this._resolveFetch(r==null?void 0:r.fetch)}connect(){if(!(this.isConnecting()||this.isDisconnecting()||this.isConnected())){this.accessToken&&!this._authPromise&&this._setAuthSafely("connect"),this._setupConnectionHandlers();try{this.socketAdapter.connect()}catch(t){const r=t.message;throw r.includes("Node.js")?new Error(`${r}
703
704To use Realtime in Node.js, you need to provide a WebSocket implementation:
705
706Option 1: Use Node.js 22+ which has native WebSocket support
707Option 2: Install and provide the "ws" package:
708
709  npm install ws
710
711  import ws from "ws"
712  const client = new RealtimeClient(url, {
713    ...options,
714    transport: ws
715  })`):new Error(`WebSocket not available: ${r}`)}this._handleNodeJsRaceCondition()}}endpointURL(){return this.socketAdapter.endPointURL()}async disconnect(t,r){return this.isDisconnecting()?"ok":await this.socketAdapter.disconnect(()=>{clearInterval(this._workerHeartbeatTimer),this._terminateWorker()},t,r)}getChannels(){return this.channels}async removeChannel(t){const r=await t.unsubscribe();return r==="ok"&&t.teardown(),this.channels.length===0&&this.disconnect(),r}async removeAllChannels(){const t=this.channels.map(async n=>{const s=await n.unsubscribe();return n.teardown(),s}),r=await Promise.all(t);return this.disconnect(),r}log(t,r,n){this.socketAdapter.log(t,r,n)}connectionState(){return this.socketAdapter.connectionState()||M_.closed}isConnected(){return this.socketAdapter.isConnected()}isConnecting(){return this.socketAdapter.isConnecting()}isDisconnecting(){return this.socketAdapter.isDisconnecting()}channel(t,r={config:{}}){const n=`realtime:${t}`,s=this.getChannels().find(i=>i.topic===n);if(s)return s;{const i=new Of(`realtime:${t}`,r,this);return this.channels.push(i),i}}push(t){this.socketAdapter.push(t)}async setAuth(t=null){this._authPromise=this._performAuth(t);try{await this._authPromise}finally{this._authPromise=null}}_isManualToken(){return this._manuallySetToken}async sendHeartbeat(){this.socketAdapter.sendHeartbeat()}onHeartbeat(t){this.socketAdapter.heartbeatCallback=this._wrapHeartbeatCallback(t)}_makeRef(){return this.socketAdapter.makeRef()}_remove(t){this.channels=this.channels.filter(r=>r.topic!==t.topic)}async _performAuth(t=null){let r,n=!1;if(t)r=t,n=!0;else if(this.accessToken)try{r=await this.accessToken()}catch(s){this.log("error","Error fetching access token from callback",s),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(s=>{const i={access_token:r,version:BZ};r&&s.updateJoinPayload(i),s.joinedOnce&&s.channelAdapter.isJoined()&&s.channelAdapter.push(zL.access_token,{access_token:r})}))}async _waitForAuthIfNeeded(){this._authPromise&&await this._authPromise}_setAuthSafely(t="general"){this._isManualToken()||this.setAuth().catch(r=>{this.log("error",`Error setting auth in ${t}`,r)})}_setupConnectionHandlers(){this.socketAdapter.onOpen(()=>{(this._authPromise||(this.accessToken&&!this.accessTokenValue?this.setAuth():Promise.resolve())).catch(r=>{this.log("error","error waiting for auth on connect",r)}),this.worker&&!this.workerRef&&this._startWorkerHeartbeat()}),this.socketAdapter.onClose(()=>{this.worker&&this.workerRef&&this._terminateWorker()}),this.socketAdapter.onMessage(t=>{t.ref&&t.ref===this._pendingWorkerHeartbeatRef&&(this._pendingWorkerHeartbeatRef=null)})}_handleNodeJsRaceCondition(){this.socketAdapter.isConnected()&&this.socketAdapter.getSocket().onConnOpen()}_wrapHeartbeatCallback(t){return(r,n)=>{r=="sent"&&this._setAuthSafely(),t&&t(r,n)}}_startWorkerHeartbeat(){this.workerUrl?this.log("worker",`starting worker for from ${this.workerUrl}`):this.log("worker","starting default worker");const t=this._workerObjectUrl(this.workerUrl);this.workerRef=new Worker(t),this.workerRef.onerror=r=>{this.log("worker","worker error",r.message),this._terminateWorker(),this.disconnect()},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)}_workerObjectUrl(t){let r;if(t)r=t;else{const n=new Blob([yee],{type:"application/javascript"});r=URL.createObjectURL(n)}return r}_initializeOptions(t){var r,n,s,i,o,l,c,u,h;this.worker=(r=t==null?void 0:t.worker)!==null&&r!==void 0?r:!1,this.accessToken=(n=t==null?void 0:t.accessToken)!==null&&n!==void 0?n:null;const d={};
715d.timeout=(s=t==null?void 0:t.timeout)!==null&&s!==void 0?s:VZ,d.heartbeatIntervalMs=(i=t==null?void 0:t.heartbeatIntervalMs)!==null&&i!==void 0?i:mee.HEARTBEAT_INTERVAL,d.transport=(o=t==null?void 0:t.transport)!==null&&o!==void 0?o:FZ.getWebSocketConstructor(),d.params=t==null?void 0:t.params,d.logger=t==null?void 0:t.logger,d.heartbeatCallback=this._wrapHeartbeatCallback(t==null?void 0:t.heartbeatCallback),d.reconnectAfterMs=(l=t==null?void 0:t.reconnectAfterMs)!==null&&l!==void 0?l:p=>pee[p-1]||gee;let f,m;const g=(c=t==null?void 0:t.vsn)!==null&&c!==void 0?c:WZ;switch(g){case UZ:f=(p,v)=>v(JSON.stringify(p)),m=(p,v)=>v(JSON.parse(p));break;case FL:f=this.serializer.encode.bind(this.serializer),m=this.serializer.decode.bind(this.serializer);break;default:throw new Error(`Unsupported serializer version: ${d.vsn}`)}if(d.vsn=g,d.encode=(u=t==null?void 0:t.encode)!==null&&u!==void 0?u:f,d.decode=(h=t==null?void 0:t.decode)!==null&&h!==void 0?h:m,d.beforeReconnect=this._reconnectAuth.bind(this),(t!=null&&t.logLevel||t!=null&&t.log_level)&&(this.logLevel=t.logLevel||t.log_level,d.params=Object.assign(Object.assign({},d.params),{log_level:this.logLevel})),this.worker){if(typeof window<"u"&&!window.Worker)throw new Error("Web Worker is not supported");this.workerUrl=t==null?void 0:t.workerUrl,d.autoSendHeartbeat=!this.worker}return d}async _reconnectAuth(){await this._waitForAuthIfNeeded(),this.isConnected()||this.connect()}}var mm=class extends Error{constructor(e,t){var r;super(e),this.name="IcebergError",this.status=t.status,this.icebergType=t.icebergType,this.icebergCode=t.icebergCode,this.details=t.details,this.isCommitStateUnknown=t.icebergType==="CommitStateUnknownException"||[500,502,504].includes(t.status)&&((r=t.icebergType)==null?void 0:r.includes("CommitState"))===!0}isNotFound(){return this.status===404}isConflict(){return this.status===409}isAuthenticationTimeout(){return this.status===419}};function xee(e,t,r){const n=new URL(t,e);if(r)for(const[s,i]of Object.entries(r))i!==void 0&&n.searchParams.set(s,i);return n.toString()}async function bee(e){return!e||e.type==="none"?{}:e.type==="bearer"?{Authorization:`Bearer ${e.token}`}:e.type==="header"?{[e.name]:e.value}:e.type==="custom"?await e.getHeaders():{}}function wee(e){const t=e.fetchImpl??globalThis.fetch;return{async request({method:r,path:n,query:s,body:i,headers:o}){const l=xee(e.baseUrl,n,s),c=await bee(e.auth),u=await t(l,{method:r,headers:{...i?{"Content-Type":"application/json"}:{},...c,...o},body:i?JSON.stringify(i):void 0}),h=await u.text(),d=(u.headers.get("content-type")||"").includes("application/json"),f=d&&h?JSON.parse(h):h;if(!u.ok){const m=d?f:void 0,g=m==null?void 0:m.error;throw new mm((g==null?void 0:g.message)??`Request failed with status ${u.status}`,{status:u.status,icebergType:g==null?void 0:g.type,icebergCode:g==null?void 0:g.code,details:m})}return{status:u.status,headers:u.headers,data:f}}}}function Eg(e){return e.join("�")}var jee=class{constructor(e,t=""){this.client=e,this.prefix=t}async listNamespaces(e){const t=e?{parent:Eg(e.namespace)}:void 0;return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces`,query:t})).data.namespaces.map(n=>({namespace:n}))}async createNamespace(e,t){const r={namespace:e.namespace,properties:t==null?void 0:t.properties};return(await this.client.request({method:"POST",path:`${this.prefix}/namespaces`,body:r})).data}async dropNamespace(e){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${Eg(e.namespace)}`})}async loadNamespaceMetadata(e){return{properties:(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${Eg(e.namespace)}`})).data.properties}}async namespaceExists(e){try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${Eg(e.namespace)}`}),!0}catch(t){if(t instanceof mm&&t.status===404)return!1;throw t}}async createNamespaceIfNotExists(e,t){try{return await this.createNamespace(e,t)}catch(r){if(r instanceof mm&&r.status===409)return;throw r}}};function Bc(e){return e.join("�")}var _ee=class{constructor(e,t="",r){this.client=e,this.prefix=t,this.accessDelegation=r}async listTables(e){return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${Bc(e.namespace)}/tables`})).data.identifiers}async createTable(e,t){const r={};return this.accessDelegation&&(r["X-Iceberg-Access-Delegation"]=this.accessDelegation),(await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${Bc(e.namespace)}/tables`,body:t,headers:r})).data.metadata}async updateTable(e,t){const r=await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${Bc(e.namespace)}/tables/${e.name}`,body:t});return{"metadata-location":r.data["metadata-location"],metadata:r.data.metadata}}async dropTable(e,t){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${Bc(e.namespace)}/tables/${e.name}`,query:{purgeRequested:String((t==null?void 0:t.purge)??!1)}})}async loadTable(e){const t={};return this.accessDelegation&&(t["X-Iceberg-Access-Delegation"]=this.accessDelegation),(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${Bc(e.namespace)}/tables/${e.name}`,headers:t})).data.metadata}async tableExists(e){const t={};this.accessDelegation&&(t["X-Iceberg-Access-Delegation"]=this.accessDelegation);try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${Bc(e.namespace)}/tables/${e.name}`,headers:t}),!0}catch(r){if(r instanceof mm&&r.status===404)return!1;throw r}}async createTableIfNotExists(e,t){try{return await this.createTable(e,t)}catch(r){if(r instanceof mm&&r.status===409)return await this.loadTable({namespace:e.namespace,name:t.name});throw r}}},See=class{constructor(e){var n;let t="v1";e.catalogName&&(t+=`/${e.catalogName}`);const r=e.baseUrl.endsWith("/")?e.baseUrl:`${e.baseUrl}/`;this.client=wee({baseUrl:r,auth:e.auth,fetchImpl:e.fetch}),this.accessDelegation=(n=e.accessDelegation)==null?void 0:n.join(","),this.namespaceOps=new jee(this.client,t),this.tableOps=new _ee(this.client,t,this.accessDelegation)}async listNamespaces(e){return this.namespaceOps.listNamespaces(e)}async createNamespace(e,t){return this.namespaceOps.createNamespace(e,t)}async dropNamespace(e){await this.namespaceOps.dropNamespace(e)}async loadNamespaceMetadata(e){return this.namespaceOps.loadNamespaceMetadata(e)}async listTables(e){return this.tableOps.listTables(e)}
715async createTable(e,t){return this.tableOps.createTable(e,t)}async updateTable(e,t){return this.tableOps.updateTable(e,t)}async dropTable(e,t){await this.tableOps.dropTable(e,t)}async loadTable(e){return this.tableOps.loadTable(e)}async namespaceExists(e){return this.namespaceOps.namespaceExists(e)}async tableExists(e){return this.tableOps.tableExists(e)}async createNamespaceIfNotExists(e,t){return this.namespaceOps.createNamespaceIfNotExists(e,t)}async createTableIfNotExists(e,t){return this.tableOps.createTableIfNotExists(e,t)}},z0=class extends Error{constructor(e,t="storage",r,n){super(e),this.__isStorageError=!0,this.namespace=t,this.name=t==="vectors"?"StorageVectorsError":"StorageError",this.status=r,this.statusCode=n}};function B0(e){return typeof e=="object"&&e!==null&&"__isStorageError"in e}var D_=class extends z0{constructor(e,t,r,n="storage"){super(e,n,t,r),this.name=n==="vectors"?"StorageVectorsApiError":"StorageApiError",this.status=t,this.statusCode=r}toJSON(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}}},VL=class extends z0{constructor(e,t,r="storage"){super(e,r),this.name=r==="vectors"?"StorageVectorsUnknownError":"StorageUnknownError",this.originalError=t}};const Nee=e=>e?(...t)=>e(...t):(...t)=>fetch(...t),kee=e=>{if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)},L_=e=>{if(Array.isArray(e))return e.map(r=>L_(r));if(typeof e=="function"||e!==Object(e))return e;const t={};return Object.entries(e).forEach(([r,n])=>{const s=r.replace(/([-_][a-z])/gi,i=>i.toUpperCase().replace(/[-_]/g,""));t[s]=L_(n)}),t},Cee=e=>!e||typeof e!="string"||e.length===0||e.length>100||e.trim()!==e||e.includes("/")||e.includes("\\")?!1:/^[\w!.\*'() &$@=;:+,?-]+$/.test(e);function pm(e){"@babel/helpers - typeof";return pm=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},pm(e)}function Eee(e,t){if(pm(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(pm(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Tee(e){var t=Eee(e,"string");return pm(t)=="symbol"?t:t+""}function Aee(e,t,r){return(t=Tee(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function sP(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function Ie(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?sP(Object(r),!0).forEach(function(n){Aee(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):sP(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}const iP=e=>{var t;return e.msg||e.message||e.error_description||(typeof e.error=="string"?e.error:(t=e.error)===null||t===void 0?void 0:t.message)||JSON.stringify(e)},Pee=async(e,t,r,n)=>{if(e!==null&&typeof e=="object"&&typeof e.json=="function"){const s=e;let i=parseInt(s.status,10);Number.isFinite(i)||(i=500),s.json().then(o=>{const l=(o==null?void 0:o.statusCode)||(o==null?void 0:o.code)||i+"";t(new D_(iP(o),i,l,n))}).catch(()=>{const o=i+"";t(new D_(s.statusText||`HTTP ${i} error`,i,o,n))})}else t(new VL(iP(e),e,n))},Oee=(e,t,r,n)=>{const s={method:e,headers:(t==null?void 0:t.headers)||{}};return e==="GET"||e==="HEAD"||!n?Ie(Ie({},s),r):(kee(n)?(s.headers=Ie({"Content-Type":"application/json"},t==null?void 0:t.headers),s.body=JSON.stringify(n)):s.body=n,t!=null&&t.duplex&&(s.duplex=t.duplex),Ie(Ie({},s),r))};async function Lh(e,t,r,n,s,i,o){return new Promise((l,c)=>{e(r,Oee(t,n,s,i)).then(u=>{if(!u.ok)throw u;if(n!=null&&n.noResolveJson)return u;if(o==="vectors"){const h=u.headers.get("content-type");if(u.headers.get("content-length")==="0"||u.status===204)return{};
715if(!h||!h.includes("application/json"))return{}}return u.json()}).then(u=>l(u)).catch(u=>Pee(u,c,n,o))})}function HL(e="storage"){return{get:async(t,r,n,s)=>Lh(t,"GET",r,n,s,void 0,e),post:async(t,r,n,s,i)=>Lh(t,"POST",r,s,i,n,e),put:async(t,r,n,s,i)=>Lh(t,"PUT",r,s,i,n,e),head:async(t,r,n,s)=>Lh(t,"HEAD",r,Ie(Ie({},n),{},{noResolveJson:!0}),s,void 0,e),remove:async(t,r,n,s,i)=>Lh(t,"DELETE",r,s,i,n,e)}}const Mee=HL("storage"),{get:gm,post:Ua,put:F_,head:Ree,remove:S2}=Mee,Wn=HL("vectors");var uh=class{constructor(e,t={},r,n="storage"){this.shouldThrowOnError=!1,this.url=e,this.headers=t,this.fetch=Nee(r),this.namespace=n}throwOnError(){return this.shouldThrowOnError=!0,this}setHeader(e,t){return this.headers=Ie(Ie({},this.headers),{},{[e]:t}),this}async handleOperation(e){var t=this;try{return{data:await e(),error:null}}catch(r){if(t.shouldThrowOnError)throw r;if(B0(r))return{data:null,error:r};throw r}}},$ee=class{constructor(e,t){this.downloadFn=e,this.shouldThrowOnError=t}then(e,t){return this.execute().then(e,t)}async execute(){var e=this;try{return{data:(await e.downloadFn()).body,error:null}}catch(t){if(e.shouldThrowOnError)throw t;if(B0(t))return{data:null,error:t};throw t}}};let qL;qL=Symbol.toStringTag;var Iee=class{constructor(e,t){this.downloadFn=e,this.shouldThrowOnError=t,this[qL]="BlobDownloadBuilder",this.promise=null}asStream(){return new $ee(this.downloadFn,this.shouldThrowOnError)}then(e,t){return this.getPromise().then(e,t)}catch(e){return this.getPromise().catch(e)}finally(e){return this.getPromise().finally(e)}getPromise(){return this.promise||(this.promise=this.execute()),this.promise}async execute(){var e=this;try{return{data:await(await e.downloadFn()).blob(),error:null}}catch(t){if(e.shouldThrowOnError)throw t;if(B0(t))return{data:null,error:t};throw t}}};const Dee={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},oP={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1};var Lee=class extends uh{constructor(e,t={},r,n){super(e,t,n,"storage"),this.bucketId=r}async uploadOrUpdate(e,t,r,n){var s=this;return s.handleOperation(async()=>{let i;const o=Ie(Ie({},oP),n);let l=Ie(Ie({},s.headers),e==="POST"&&{"x-upsert":String(o.upsert)});const c=o.metadata;typeof Blob<"u"&&r instanceof Blob?(i=new FormData,i.append("cacheControl",o.cacheControl),c&&i.append("metadata",s.encodeMetadata(c)),i.append("",r)):typeof FormData<"u"&&r instanceof FormData?(i=r,i.has("cacheControl")||i.append("cacheControl",o.cacheControl),c&&!i.has("metadata")&&i.append("metadata",s.encodeMetadata(c))):(i=r,l["cache-control"]=`max-age=${o.cacheControl}`,l["content-type"]=o.contentType,c&&(l["x-metadata"]=s.toBase64(s.encodeMetadata(c))),(typeof ReadableStream<"u"&&i instanceof ReadableStream||i&&typeof i=="object"&&"pipe"in i&&typeof i.pipe=="function")&&!o.duplex&&(o.duplex="half")),n!=null&&n.headers&&(l=Ie(Ie({},l),n.headers));const u=s._removeEmptyFolders(t),h=s._getFinalPath(u),d=await(e=="PUT"?F_:Ua)(s.fetch,`${s.url}/object/${h}`,i,Ie({headers:l},o!=null&&o.duplex?{duplex:o.duplex}:{}));return{path:u,id:d.Id,fullPath:d.Key}})}async upload(e,t,r){return this.uploadOrUpdate("POST",e,t,r)}async uploadToSignedUrl(e,t,r,n){var s=this;const i=s._removeEmptyFolders(e),o=s._getFinalPath(i),l=new URL(s.url+`/object/upload/sign/${o}`);return l.searchParams.set("token",t),s.handleOperation(async()=>{let c;const u=Ie({upsert:oP.upsert},n),h=Ie(Ie({},s.headers),{"x-upsert":String(u.upsert)});return typeof Blob<"u"&&r instanceof Blob?(c=new FormData,c.append("cacheControl",u.cacheControl),c.append("",r)):typeof FormData<"u"&&r instanceof FormData?(c=r,c.append("cacheControl",u.cacheControl)):(c=r,h["cache-control"]=`max-age=${u.cacheControl}`,h["content-type"]=u.contentType),{path:i,fullPath:(await F_(s.fetch,l.toString(),c,{headers:h})).Key}})}async createSignedUploadUrl(e,t){var r=this;return r.handleOperation(async()=>{let n=r._getFinalPath(e);const s=Ie({},r.headers);t!=null&&t.upsert&&(s["x-upsert"]="true");const i=await Ua(r.fetch,`${r.url}/object/upload/sign/${n}`,{},{headers:s}),o=new URL(r.url+i.url),l=o.searchParams.get("token");if(!l)throw new z0("No token returned by API");return{signedUrl:o.toString(),path:e,token:l}})}async update(e,t,r){return this.uploadOrUpdate("PUT",e,t,r)}async move(e,t,r){var n=this;return n.handleOperation(async()=>await Ua(n.fetch,`${n.url}/object/move`,{bucketId:n.bucketId,sourceKey:e,destinationKey:t,de
715stinationBucket:r==null?void 0:r.destinationBucket},{headers:n.headers}))}async copy(e,t,r){var n=this;return n.handleOperation(async()=>({path:(await Ua(n.fetch,`${n.url}/object/copy`,{bucketId:n.bucketId,sourceKey:e,destinationKey:t,destinationBucket:r==null?void 0:r.destinationBucket},{headers:n.headers})).Key}))}async createSignedUrl(e,t,r){var n=this;return n.handleOperation(async()=>{let s=n._getFinalPath(e);const i=typeof(r==null?void 0:r.transform)=="object"&&r.transform!==null&&Object.keys(r.transform).length>0;let o=await Ua(n.fetch,`${n.url}/object/sign/${s}`,Ie({expiresIn:t},i?{transform:r.transform}:{}),{headers:n.headers});const l=r!=null&&r.download?`&download=${r.download===!0?"":r.download}`:"",c=i&&o.signedURL.includes("/object/sign/")?o.signedURL.replace("/object/sign/","/render/image/sign/"):o.signedURL;return{signedUrl:encodeURI(`${n.url}${c}${l}`)}})}async createSignedUrls(e,t,r){var n=this;return n.handleOperation(async()=>{const s=await Ua(n.fetch,`${n.url}/object/sign/${n.bucketId}`,{expiresIn:t,paths:e},{headers:n.headers}),i=r!=null&&r.download?`&download=${r.download===!0?"":r.download}`:"";return s.map(o=>Ie(Ie({},o),{},{signedUrl:o.signedURL?encodeURI(`${n.url}${o.signedURL}${i}`):null}))})}download(e,t,r){const n=typeof(t==null?void 0:t.transform)<"u"?"render/image/authenticated":"object",s=this.transformOptsToQueryString((t==null?void 0:t.transform)||{}),i=s?`?${s}`:"",o=this._getFinalPath(e),l=()=>gm(this.fetch,`${this.url}/${n}/${o}${i}`,{headers:this.headers,noResolveJson:!0},r);return new Iee(l,this.shouldThrowOnError)}async info(e){var t=this;const r=t._getFinalPath(e);return t.handleOperation(async()=>L_(await gm(t.fetch,`${t.url}/object/info/${r}`,{headers:t.headers})))}async exists(e){var t=this;const r=t._getFinalPath(e);try{return await Ree(t.fetch,`${t.url}/object/${r}`,{headers:t.headers}),{data:!0,error:null}}catch(s){if(t.shouldThrowOnError)throw s;if(B0(s)){var n;const i=s instanceof D_?s.status:s instanceof VL?(n=s.originalError)===null||n===void 0?void 0:n.status:void 0;if(i!==void 0&&[400,404].includes(i))return{data:!1,error:s}}throw s}}getPublicUrl(e,t){const r=this._getFinalPath(e),n=[],s=t!=null&&t.download?`download=${t.download===!0?"":t.download}`:"";s!==""&&n.push(s);const i=typeof(t==null?void 0:t.transform)<"u"?"render/image":"object",o=this.transformOptsToQueryString((t==null?void 0:t.transform)||{});o!==""&&n.push(o);let l=n.join("&");return l!==""&&(l=`?${l}`),{data:{publicUrl:encodeURI(`${this.url}/${i}/public/${r}${l}`)}}}async remove(e){var t=this;return t.handleOperation(async()=>await S2(t.fetch,`${t.url}/object/${t.bucketId}`,{prefixes:e},{headers:t.headers}))}async list(e,t,r){var n=this;return n.handleOperation(async()=>{const s=Ie(Ie(Ie({},Dee),t),{},{prefix:e||""});return await Ua(n.fetch,`${n.url}/object/list/${n.bucketId}`,s,{headers:n.headers},r)})}async listV2(e,t){var r=this;return r.handleOperation(async()=>{const n=Ie({},e);return await Ua(r.fetch,`${r.url}/object/list-v2/${r.bucketId}`,n,{headers:r.headers},t)})}encodeMetadata(e){return JSON.stringify(e)}toBase64(e){return typeof Buffer<"u"?Buffer.from(e).toString("base64"):btoa(e)}_getFinalPath(e){return`${this.bucketId}/${e.replace(/^\/+/,"")}`}_removeEmptyFolders(e){return e.replace(/^\/|\/$/g,"").replace(/\/+/g,"/")}transformOptsToQueryString(e){const t=[];return e.width&&t.push(`width=${e.width}`),e.height&&t.push(`height=${e.height}`),e.resize&&t.push(`resize=${e.resize}`),e.format&&t.push(`format=${e.format}`),e.quality&&t.push(`quality=${e.quality}`),t.join("&")}};const Fee="2.100.0",Op={"X-Client-Info":`storage-js/${Fee}`};var zee=class extends uh{constructor(e,t={},r,n){const s=new URL(e);n!=null&&n.useNewHostname&&/supabase\.(co|in|red)$/.test(s.hostname)&&!s.hostname.includes("storage.supabase.")&&(s.hostname=s.hostname.replace("supabase.","storage.supabase."));const i=s.href.replace(/\/$/,""),o=Ie(Ie({},Op),t);super(i,o,r,"storage")}async listBuckets(e){var t=this;return t.handleOperation(async()=>{const r=t.listBucketOptionsToQueryString(e);return await gm(t.fetch,`${t.url}/bucket${r}`,{headers:t.headers})})}async getBucket(e){var t=this;return t.handleOperation(async()=>await gm(t.fetch,`${t.url}/bucket/${e}`,{headers:t.headers}))}async createBucket(e,t={public:!1}){var r=this;return r.handleOperation(async()=>await Ua(r.fetch,`${r.url}/bucket`,{id:e,name:e,type:t.type,public:t.public,file_size_limit:t.fileSizeLimit,allowed_mime_types:t.allowedMimeTypes},{headers:r.headers}))}async updateBucket(e,t){var r=this;return r.handleOperation(async()=>await F_(r.fetch,`${r.url}/bucket/${e}`,{id:e,name:e,public:t.public,file_size_limit:t.fileSizeLimit,allowed_mime_types:t.allowedMimeTypes},{headers:r.headers}))}async emptyBucket(e){var t=this;return t.handleOperation(async()=>await Ua(t.fetch,`${t.url}/bucket/${e}/empty`,{},{headers:t.headers}))}async deleteBucket(e){var t=this;return t.handleOperation(async()=>await S2(t.fetch,`${t.url}/bucket/${e}`,{},{headers:t.headers}))}listBucketOptionsToQueryString(e){const t={};return e&&("limit"in e&&(t.limit=String(e.limit)),"offset"in e&&(t.offset=String(e.offset)),e.search&&(t.search=e.search),e.sortColumn&&(t.sortColumn=e.sortColumn),e.sortOrder&&(t.sortOrder=e.sortOrder)),Object.keys(t).length>0?"?"+new URLSearchParams(t).toString():""}},Bee=class extends uh{constructor(e,t={},r){const n=e.replace(/\/$/,""),s=Ie(Ie({},Op),t);super(n,s,r,"storage")}async createBucket(e){var t=this;return t.handleOperation(async()=>await Ua(t.fetch,`${t.url}/bucket`,{name:e},{headers:t.headers}))}async listBuckets(e){var t=this;return t.handleOperation(async()=>
715{const r=new URLSearchParams;(e==null?void 0:e.limit)!==void 0&&r.set("limit",e.limit.toString()),(e==null?void 0:e.offset)!==void 0&&r.set("offset",e.offset.toString()),e!=null&&e.sortColumn&&r.set("sortColumn",e.sortColumn),e!=null&&e.sortOrder&&r.set("sortOrder",e.sortOrder),e!=null&&e.search&&r.set("search",e.search);const n=r.toString(),s=n?`${t.url}/bucket?${n}`:`${t.url}/bucket`;return await gm(t.fetch,s,{headers:t.headers})})}async deleteBucket(e){var t=this;return t.handleOperation(async()=>await S2(t.fetch,`${t.url}/bucket/${e}`,{},{headers:t.headers}))}from(e){var t=this;if(!Cee(e))throw new z0("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 See({baseUrl:this.url,catalogName:e,auth:{type:"custom",getHeaders:async()=>t.headers},fetch:this.fetch}),n=this.shouldThrowOnError;return new Proxy(r,{get(s,i){const o=s[i];return typeof o!="function"?o:async(...l)=>{try{return{data:await o.apply(s,l),error:null}}catch(c){if(n)throw c;return{data:null,error:c}}}}})}},Uee=class extends uh{constructor(e,t={},r){const n=e.replace(/\/$/,""),s=Ie(Ie({},Op),{},{"Content-Type":"application/json"},t);super(n,s,r,"vectors")}async createIndex(e){var t=this;return t.handleOperation(async()=>await Wn.post(t.fetch,`${t.url}/CreateIndex`,e,{headers:t.headers})||{})}async getIndex(e,t){var r=this;return r.handleOperation(async()=>await Wn.post(r.fetch,`${r.url}/GetIndex`,{vectorBucketName:e,indexName:t},{headers:r.headers}))}async listIndexes(e){var t=this;return t.handleOperation(async()=>await Wn.post(t.fetch,`${t.url}/ListIndexes`,e,{headers:t.headers}))}async deleteIndex(e,t){var r=this;return r.handleOperation(async()=>await Wn.post(r.fetch,`${r.url}/DeleteIndex`,{vectorBucketName:e,indexName:t},{headers:r.headers})||{})}},Wee=class extends uh{constructor(e,t={},r){const n=e.replace(/\/$/,""),s=Ie(Ie({},Op),{},{"Content-Type":"application/json"},t);super(n,s,r,"vectors")}async putVectors(e){var t=this;if(e.vectors.length<1||e.vectors.length>500)throw new Error("Vector batch size must be between 1 and 500 items");return t.handleOperation(async()=>await Wn.post(t.fetch,`${t.url}/PutVectors`,e,{headers:t.headers})||{})}async getVectors(e){var t=this;return t.handleOperation(async()=>await Wn.post(t.fetch,`${t.url}/GetVectors`,e,{headers:t.headers}))}async listVectors(e){var t=this;if(e.segmentCount!==void 0){if(e.segmentCount<1||e.segmentCount>16)throw new Error("segmentCount must be between 1 and 16");if(e.segmentIndex!==void 0&&(e.segmentIndex<0||e.segmentIndex>=e.segmentCount))throw new Error(`segmentIndex must be between 0 and ${e.segmentCount-1}`)}return t.handleOperation(async()=>await Wn.post(t.fetch,`${t.url}/ListVectors`,e,{headers:t.headers}))}async queryVectors(e){var t=this;return t.handleOperation(async()=>await Wn.post(t.fetch,`${t.url}/QueryVectors`,e,{headers:t.headers}))}async deleteVectors(e){var t=this;if(e.keys.length<1||e.keys.length>500)throw new Error("Keys batch size must be between 1 and 500 items");return t.handleOperation(async()=>await Wn.post(t.fetch,`${t.url}/DeleteVectors`,e,{headers:t.headers})||{})}},Vee=class extends uh{constructor(e,t={},r){const n=e.replace(/\/$/,""),s=Ie(Ie({},Op),{},{"Content-Type":"application/json"},t);super(n,s,r,"vectors")}async createBucket(e){var t=this;return t.handleOperation(async()=>await Wn.post(t.fetch,`${t.url}/CreateVectorBucket`,{vectorBucketName:e},{headers:t.headers})||{})}async getBucket(e){var t=this;return t.handleOperation(async()=>await Wn.post(t.fetch,`${t.url}/GetVectorBucket`,{vectorBucketName:e},{headers:t.headers}))}async listBuckets(e={}){var t=this;return t.handleOperation(async()=>await Wn.post(t.fetch,`${t.url}/ListVectorBuckets`,e,{headers:t.headers}))}async deleteBucket(e){var t=this;return t.handleOperation(async()=>await Wn.post(t.fetch,`${t.url}/DeleteVectorBucket`,{vectorBucketName:e},{headers:t.headers})||{})}},Hee=class extends Vee{constructor(e,t={}){super(e,t.headers||{},t.fetch)}from(e){return new qee(this.url,this.headers,e,this.fetch)}async createBucket(e){var t=()=>super.createBucket,r=this;return t().call(r,e)}async getBucket(e){var t=()=>super.getBucket,r=this;return t().call(r,e)}async listBuckets(e={}){var t=()=>super.listBuckets,r=this;return t().call(r,e)}async deleteBucket(e){var t=()=>super.deleteBucket,r=this;return t().call(r,e)}},qee=class extends Uee{constructor(e,t,r,n){super(e,t,n),this.vectorBucketName=r}async createIndex(e){var t=()=>super.createIndex,r=this;return t().call(r,Ie(Ie({},e),{},{vectorBucketName:r.vectorBucketName}))}
715async listIndexes(e={}){var t=()=>super.listIndexes,r=this;return t().call(r,Ie(Ie({},e),{},{vectorBucketName:r.vectorBucketName}))}async getIndex(e){var t=()=>super.getIndex,r=this;return t().call(r,r.vectorBucketName,e)}async deleteIndex(e){var t=()=>super.deleteIndex,r=this;return t().call(r,r.vectorBucketName,e)}index(e){return new Gee(this.url,this.headers,this.vectorBucketName,e,this.fetch)}},Gee=class extends Wee{constructor(e,t,r,n,s){super(e,t,s),this.vectorBucketName=r,this.indexName=n}async putVectors(e){var t=()=>super.putVectors,r=this;return t().call(r,Ie(Ie({},e),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async getVectors(e){var t=()=>super.getVectors,r=this;return t().call(r,Ie(Ie({},e),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async listVectors(e={}){var t=()=>super.listVectors,r=this;return t().call(r,Ie(Ie({},e),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async queryVectors(e){var t=()=>super.queryVectors,r=this;return t().call(r,Ie(Ie({},e),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async deleteVectors(e){var t=()=>super.deleteVectors,r=this;return t().call(r,Ie(Ie({},e),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}},Kee=class extends zee{constructor(e,t={},r,n){super(e,t,r,n)}from(e){return new Lee(this.url,this.headers,e,this.fetch)}get vectors(){return new Hee(this.url+"/vector",{headers:this.headers,fetch:this.fetch})}
715get analytics(){return new Bee(this.url+"/iceberg",this.headers,this.fetch)}};const GL="2.100.0",cu=30*1e3,z_=3,Qw=z_*cu,Yee="http://localhost:9999",Xee="supabase.auth.token",Qee={"X-Client-Info":`gotrue-js/${GL}`},B_="X-Supabase-Api-Version",KL={"2024-01-01":{timestamp:Date.parse("2024-01-01T00:00:00.0Z"),name:"2024-01-01"}},Jee=/^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}$|[a-z0-9_-]{2}$)$/i,Zee=10*60*1e3;class ym extends Error{constructor(t,r,n){super(t),this.__isAuthError=!0,this.name="AuthError",this.status=r,this.code=n}}function Ae(e){return typeof e=="object"&&e!==null&&"__isAuthError"in e}class ete extends ym{constructor(t,r,n){super(t,r,n),this.name="AuthApiError",this.status=r,this.code=n}}function tte(e){return Ae(e)&&e.name==="AuthApiError"}class Pl extends ym{constructor(t,r){super(t),this.name="AuthUnknownError",this.originalError=r}}class qi extends ym{constructor(t,r,n,s){super(t,n,s),this.name=r,this.status=n}}class In extends qi{constructor(){super("Auth session missing!","AuthSessionMissingError",400,void 0)}}function Jw(e){return Ae(e)&&e.name==="AuthSessionMissingError"}class Uc extends qi{constructor(){super("Auth session or user missing","AuthInvalidToken
715ResponseError",500,void 0)}}class Tg extends qi{constructor(t){super(t,"AuthInvalidCredentialsError",400,void 0)}}class Ag extends qi{constructor(t,r=null){super(t,"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 rte(e){return Ae(e)&&e.name==="AuthImplicitGrantRedirectError"}class lP extends qi{constructor(t,r=null){super(t,"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 nte extends qi{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 U_ extends qi{constructor(t,r){super(t,"AuthRetryableFetchError",r,void 0)}}function Zw(e){return Ae(e)&&e.name==="AuthRetryableFetchError"}class cP extends qi{constructor(t,r,n){super(t,"AuthWeakPasswordError",r,"weak_password"),this.reasons=n}}class W_ extends qi{constructor(t){super(t,"AuthInvalidJwtError",400,"invalid_jwt")}}const $v="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".split(""),uP=` 	
716\r=`.split(""),ate=(()=>{const e=new Array(128);for(let t=0;t<e.length;t+=1)e[t]=-1;for(let t=0;t<uP.length;t+=1)e[uP[t].charCodeAt(0)]=-2;for(let t=0;t<$v.length;t+=1)e[$v[t].charCodeAt(0)]=t;return e})();function dP(e,t,r){if(e!==null)for(t.queue=t.queue<<8|e,t.queuedBits+=8;t.queuedBits>=6;){const n=t.queue>>t.queuedBits-6&63;r($v[n]),t.queuedBits-=6}else if(t.queuedBits>0)for(t.queue=t.queue<<6-t.queuedBits,t.queuedBits=6;t.queuedBits>=6;){const n=t.queue>>t.queuedBits-6&63;r($v[n]),t.queuedBits-=6}}function YL(e,t,r){const n=ate[e];if(n>-1)for(t.queue=t.queue<<6|n,t.queuedBits+=6;t.queuedBits>=8;)r(t.queue>>t.queuedBits-8&255),t.queuedBits-=8;else{if(n===-2)return;throw new Error(`Invalid Base64-URL character "${String.fromCharCode(e)}"`)}}function hP(e){const t=[],r=o=>{t.push(String.fromCodePoint(o))},n={utf8seq:0,codepoint:0},s={queue:0,queuedBits:0},i=o=>{ote(o,n,r)};for(let o=0;o<e.length;o+=1)YL(e.charCodeAt(o),s,i);return t.join("")}function ste(e,t){if(e<=127){t(e);return}else if(e<=2047){t(192|e>>6),t(128|e&63);return}else if(e<=65535){t(224|e>>12),t(128|e>>6&63),t(128|e&63);return}else if(e<=1114111){t(240|e>>18),t(128|e>>12&63),t(128|e>>6&63),t(128|e&63);return}throw new Error(`Unrecognized Unicode codepoint: ${e.toString(16)}`)}function ite(e,t){for(let r=0;r<e.length;r+=1){let n=e.charCodeAt(r);if(n>55295&&n<=56319){const s=(n-55296)*1024&65535;n=(e.charCodeAt(r+1)-56320&65535|s)+65536,r+=1}ste(n,t)}}function ote(e,t,r){if(t.utf8seq===0){if(e<=127){r(e);return}for(let n=1;n<6;n+=1)if(!(e>>7-n&1)){t.utf8seq=n;break}if(t.utf8seq===2)t.codepoint=e&31;else if(t.utf8seq===3)t.codepoint=e&15;else if(t.utf8seq===4)t.codepoint=e&7;else throw new Error("Invalid UTF-8 sequence");t.utf8seq-=1}else if(t.utf8seq>0){if(e<=127)throw new Error("Invalid UTF-8 sequence");t.codepoint=t.codepoint<<6|e&63,t.utf8seq-=1,t.utf8seq===0&&r(t.codepoint)}}function Du(e){const t=[],r={queue:0,queuedBits:0},n=s=>{t.push(s)};for(let s=0;s<e.length;s+=1)YL(e.charCodeAt(s),r,n);return new Uint8Array(t)}function lte(e){const t=[];return ite(e,r=>t.push(r)),new Uint8Array(t)}function Fl(e){const t=[],r={queue:0,queuedBits:0},n=s=>{t.push(s)};return e.forEach(s=>dP(s,r,n)),dP(null,r,n),t.join("")}function cte(e){return Math.round(Date.now()/1e3)+e}function ute(){return Symbol("auth-callback")}const Pr=()=>typeof window<"u"&&typeof document<"u",yl={tested:!1,writable:!1},XL=()=>{if(!Pr())return!1;try{if(typeof globalThis.localStorage!="object")return!1}catch{return!1}if(yl.tested)return yl.writable;const e=`lswt-${Math.random()}${Math.random()}`;try{globalThis.localStorage.setItem(e,e),globalThis.localStorage.removeItem(e),yl.tested=!0,yl.writable=!0}catch{yl.tested=!0,yl.writable=!1}return yl.writable};function dte(e){const t={},r=new URL(e);if(r.hash&&r.hash[0]==="#")try{new URLSearchParams(r.hash.substring(1)).forEac
716h((s,i)=>{t[i]=s})}catch{}return r.searchParams.forEach((n,s)=>{t[s]=n}),t}const QL=e=>e?(...t)=>e(...t):(...t)=>fetch(...t),hte=e=>typeof e=="object"&&e!==null&&"status"in e&&"ok"in e&&"json"in e&&typeof e.json=="function",uu=async(e,t,r)=>{await e.setItem(t,JSON.stringify(r))},vl=async(e,t)=>{const r=await e.getItem(t);if(!r)return null;try{return JSON.parse(r)}catch{return r}},Ar=async(e,t)=>{await e.removeItem(t)};class U0{constructor(){this.promise=new U0.promiseConstructor((t,r)=>{this.resolve=t,this.reject=r})}}U0.promiseConstructor=Promise;function Pg(e){const t=e.split(".");if(t.length!==3)throw new W_("Invalid JWT structure");for(let n=0;n<t.length;n++)if(!Jee.test(t[n]))throw new W_("JWT not in base64url format");return{header:JSON.parse(hP(t[0])),payload:JSON.parse(hP(t[1])),signature:Du(t[2]),raw:{header:t[0],payload:t[1]}}}async function fte(e){return await new Promise(t=>{setTimeout(()=>t(null),e)})}function mte(e,t){return new Promise((n,s)=>{(async()=>{for(let i=0;i<1/0;i++)try{const o=await e(i);if(!t(i,null,o)){n(o);return}}catch(o){if(!t(i,o)){s(o);return}}})()})}function pte(e){return("0"+e.toString(16)).substr(-2)}function gte(){const t=new Uint32Array(56);if(typeof crypto>"u"){const r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~",n=r.length;let s="";for(let i=0;i<56;i++)s+=r.charAt(Math.floor(Math.random()*n));return s}return crypto.getRandomValues(t),Array.from(t,pte).join("")}async function yte(e){const r=new TextEncoder().encode(e),n=await crypto.subtle.digest("SHA-256",r),s=new Uint8Array(n);return Array.from(s).map(i=>String.fromCharCode(i)).join("")}async function vte(e){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."),e;const r=await yte(e);return btoa(r).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function Wc(e,t,r=!1){const n=gte();let s=n;r&&(s+="/PASSWORD_RECOVERY"),await uu(e,`${t}-code-verifier`,s);const i=await vte(n);return[i,n===i?"plain":"s256"]}const xte=/^2[0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|1[0-9]|2[0-9]|3[0-1])$/i;function bte(e){const t=e.headers.get(B_);if(!t||!t.match(xte))return null;try{return new Date(`${t}T00:00:00.0Z`)}catch{return null}}function wte(e){if(!e)throw new Error("Missing exp claim");const t=Math.floor(Date.now()/1e3);if(e<=t)throw new Error("JWT has expired")}function jte(e){switch(e){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 _te=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;function Vc(e){if(!_te.test(e))throw new Error("@supabase/auth-js: Expected parameter to be UUID but is not")}function e1(){const e={};return new Proxy(e,{get:(t,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:(t,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:(t,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 Ste(e,t){return new Proxy(e,{get:(r,n,s)=>{if(n==="__isInsecureUserWarningProxy")return!0;if(typeof n=="symbol"){const i=n.toString();if(i==="Symbol(Symbol.toPrimitive)"||i==="Symbol(Symbol.toStringTag)"||i==="Symbol(util.inspect.custom)"||i==="Symbol(nodejs.util.inspect.custom)")return Reflect.get(r,n,s)}return!t.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."),t.value=!0),Reflect.get(r,n,s)}})}function fP(e){return JSON.parse(JSON.stringify(e))}const Cl=e=>e.msg||e.message||e.error_description||e.error||JSON.stringify(e),Nte=[502,503,504];async function mP(e){var t;if(!hte(e))throw new U_(Cl(e),0);if(Nte.includes(e.status))throw new U_(Cl(e),e.status);let r;try{r=await e.json()}catch(i){throw new Pl(Cl(i),i)}let n;const s=bte(e);
716if(s&&s.getTime()>=KL["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 cP(Cl(r),e.status,((t=r.weak_password)===null||t===void 0?void 0:t.reasons)||[]);if(n==="session_not_found")throw new In}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((i,o)=>i&&typeof o=="string",!0))throw new cP(Cl(r),e.status,r.weak_password.reasons);throw new ete(Cl(r),e.status||500,n)}const kte=(e,t,r,n)=>{const s={method:e,headers:(t==null?void 0:t.headers)||{}};return e==="GET"?s:(s.headers=Object.assign({"Content-Type":"application/json;charset=UTF-8"},t==null?void 0:t.headers),s.body=JSON.stringify(n),Object.assign(Object.assign({},s),r))};async function Me(e,t,r,n){var s;const i=Object.assign({},n==null?void 0:n.headers);i[B_]||(i[B_]=KL["2024-01-01"].name),n!=null&&n.jwt&&(i.Authorization=`Bearer ${n.jwt}`);const o=(s=n==null?void 0:n.query)!==null&&s!==void 0?s:{};n!=null&&n.redirectTo&&(o.redirect_to=n.redirectTo);const l=Object.keys(o).length?"?"+new URLSearchParams(o).toString():"",c=await Cte(e,t,r+l,{headers:i,noResolveJson:n==null?void 0:n.noResolveJson},{},n==null?void 0:n.body);return n!=null&&n.xform?n==null?void 0:n.xform(c):{data:Object.assign({},c),error:null}}async function Cte(e,t,r,n,s,i){const o=kte(t,n,s,i);let l;try{l=await e(r,Object.assign({},o))}catch(c){throw console.error(c),new U_(Cl(c),0)}if(l.ok||await mP(l),n!=null&&n.noResolveJson)return l;try{return await l.json()}catch(c){await mP(c)}}function Da(e){var t;let r=null;Ate(e)&&(r=Object.assign({},e),e.expires_at||(r.expires_at=cte(e.expires_in)));const n=(t=e.user)!==null&&t!==void 0?t:e;return{data:{session:r,user:n},error:null}}function pP(e){const t=Da(e);return!t.error&&e.weak_password&&typeof e.weak_password=="object"&&Array.isArray(e.weak_password.reasons)&&e.weak_password.reasons.length&&e.weak_password.message&&typeof e.weak_password.message=="string"&&e.weak_password.reasons.reduce((r,n)=>r&&typeof n=="string",!0)&&(t.data.weak_password=e.weak_password),t}function xo(e){var t;return{data:{user:(t=e.user)!==null&&t!==void 0?t:e},error:null}}function Ete(e){return{data:e,error:null}}function Tte(e){const{action_link:t,email_otp:r,hashed_token:n,redirect_to:s,verification_type:i}=e,o=ch(e,["action_link","email_otp","hashed_token","redirect_to","verification_type"]),l={action_link:t,email_otp:r,hashed_token:n,redirect_to:s,verification_type:i},c=Object.assign({},o);return{data:{properties:l,user:c},error:null}}function gP(e){return e}function Ate(e){return e.access_token&&e.refresh_token&&e.expires_in}const t1=["global","local","others"];class Pte{constructor({url:t="",headers:r={},fetch:n}){this.url=t,this.headers=r,this.fetch=QL(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)}}async signOut(t,r=t1[0]){if(t1.indexOf(r)<0)throw new Error(`@supabase/auth-js: Parameter scope must be one of ${t1.join(", ")}`);try{return await Me(this.fetch,"POST",`${this.url}/logout?scope=${r}`,{headers:this.headers,jwt:t,noResolveJson:!0}),{data:null,error:null}}catch(n){if(Ae(n))return{data:null,error:n};throw n}}async inviteUserByEmail(t,r={}){try{return await Me(this.fetch,"POST",`${this.url}/invite`,{body:{email:t,data:r.data},headers:this.headers,redirectTo:r.redirectTo,xform:xo})}catch(n){if(Ae(n))return{data:{user:null},error:n};throw n}}async generateLink(t){try{const{options:r}=t,n=ch(t,["options"]),s=Object.assign(Object.assign({},n),r);return"newEmail"in n&&(s.new_email=n==null?void 0:n.newEmail,delete s.newEmail),await Me(this.fetch,"POST",`${this.url}/admin/generate_link`,{body:s,headers:this.headers,xform:Tte,redirectTo:r==null?void 0:r.redirectTo})}catch(r){if(Ae(r))return{data:{properties:null,user:null},error:r};throw r}}async createUser(t){try{return await Me(this.fetch,"POST",`${this.url}/admin/users`,{body:t,headers:this.headers,xform:xo})}catch(r){if(Ae(r))return{data:{user:null},error:r};throw r}}async listUsers(t){var r,n,s,i,o,l,c;try{const u={nextPage:null,lastPage:0,total:0},h=await Me(this.fetch,"GET",`${this.url}/admin/users`,{headers:this.headers,noResolveJson:!0,query:{page:(n=(r=t==null?void 0:t.page)===null||r===void 0?void 0:r.toString())!==null&&n!==void 0?n:"",per_page:(i=(s=t==null?void 0:t.perPage)===null||s===void 0?void 0:s.toString())!==null&&i!==void 0?i:""},xform:gP});if(h.error)throw h.error;const d=await h.json(),f=(o=h.headers.get("x-total-count"))!==null&&o!==void 0?o:0,m=(c=(l=h.headers.get("link"))===null||l===void 0?void 0:l.split(","))!==null&&c!==void 0?c:[];return m.length>0&&(m.forEach(g=>{const p=parseInt(g.split(";")[0].split("=")[1].substring(0,1)),v=JSON.parse(g.split(";")[1].split("=")[1]);u[`${v}Page`]=p}),u.total=parseInt(f)),{data:Object.assign(Object.assign({},d),u),error:null}}catch(u){if(Ae(u))return{data:{users:[]},error:u};throw u}}async getUserById(t){Vc(t);try{return await Me(this.fetch,"GET",`${this.url}/admin/users/${t}`,{headers:this.headers,xform:xo})}catch(r){if(Ae(r))return{data:{user:null},error:r};throw r}}async updateUserById(t,r){Vc(t);try{return await Me(this.fetch,"PUT",`${this.url}/admin/users/${t}`,{body:r,headers:this.headers,xform:xo})}catch(n){if(Ae(n))return{data:{user:null},error:n};throw n}}async deleteUser(t,r=!1){Vc(t);
716try{return await Me(this.fetch,"DELETE",`${this.url}/admin/users/${t}`,{headers:this.headers,body:{should_soft_delete:r},xform:xo})}catch(n){if(Ae(n))return{data:{user:null},error:n};throw n}}async _listFactors(t){Vc(t.userId);try{const{data:r,error:n}=await Me(this.fetch,"GET",`${this.url}/admin/users/${t.userId}/factors`,{headers:this.headers,xform:s=>({data:{factors:s},error:null})});return{data:r,error:n}}catch(r){if(Ae(r))return{data:null,error:r};throw r}}async _deleteFactor(t){Vc(t.userId),Vc(t.id);try{return{data:await Me(this.fetch,"DELETE",`${this.url}/admin/users/${t.userId}/factors/${t.id}`,{headers:this.headers}),error:null}}catch(r){if(Ae(r))return{data:null,error:r};throw r}}async _listOAuthClients(t){var r,n,s,i,o,l,c;try{const u={nextPage:null,lastPage:0,total:0},h=await Me(this.fetch,"GET",`${this.url}/admin/oauth/clients`,{headers:this.headers,noResolveJson:!0,query:{page:(n=(r=t==null?void 0:t.page)===null||r===void 0?void 0:r.toString())!==null&&n!==void 0?n:"",per_page:(i=(s=t==null?void 0:t.perPage)===null||s===void 0?void 0:s.toString())!==null&&i!==void 0?i:""},xform:gP});if(h.error)throw h.error;const d=await h.json(),f=(o=h.headers.get("x-total-count"))!==null&&o!==void 0?o:0,m=(c=(l=h.headers.get("link"))===null||l===void 0?void 0:l.split(","))!==null&&c!==void 0?c:[];return m.length>0&&(m.forEach(g=>{const p=parseInt(g.split(";")[0].split("=")[1].substring(0,1)),v=JSON.parse(g.split(";")[1].split("=")[1]);u[`${v}Page`]=p}),u.total=parseInt(f)),{data:Object.assign(Object.assign({},d),u),error:null}}catch(u){if(Ae(u))return{data:{clients:[]},error:u};throw u}}async _createOAuthClient(t){try{return await Me(this.fetch,"POST",`${this.url}/admin/oauth/clients`,{body:t,headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(Ae(r))return{data:null,error:r};throw r}}async _getOAuthClient(t){try{return await Me(this.fetch,"GET",`${this.url}/admin/oauth/clients/${t}`,{headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(Ae(r))return{data:null,error:r};throw r}}async _updateOAuthClient(t,r){try{return await Me(this.fetch,"PUT",`${this.url}/admin/oauth/clients/${t}`,{body:r,headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(Ae(n))return{data:null,error:n};throw n}}async _deleteOAuthClient(t){try{return await Me(this.fetch,"DELETE",`${this.url}/admin/oauth/clients/${t}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(r){if(Ae(r))return{data:null,error:r};throw r}}async _regenerateOAuthClientSecret(t){try{return await Me(this.fetch,"POST",`${this.url}/admin/oauth/clients/${t}/regenerate_secret`,{headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(Ae(r))return{data:null,error:r};throw r}}async _listCustomProviders(t){try{const r={};return t!=null&&t.type&&(r.type=t.type),await Me(this.fetch,"GET",`${this.url}/admin/custom-providers`,{headers:this.headers,query:r,xform:n=>{var s;return{data:{providers:(s=n==null?void 0:n.providers)!==null&&s!==void 0?s:[]},error:null}}})}catch(r){if(Ae(r))return{data:{providers:[]},error:r};throw r}}async _createCustomProvider(t){try{return await Me(this.fetch,"POST",`${this.url}/admin/custom-providers`,{body:t,headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(Ae(r))return{data:null,error:r};throw r}}async _getCustomProvider(t){try{return await Me(this.fetch,"GET",`${this.url}/admin/custom-providers/${t}`,{headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(Ae(r))return{data:null,error:r};throw r}}async _updateCustomProvider(t,r){try{return await Me(this.fetch,"PUT",`${this.url}/admin/custom-providers/${t}`,{body:r,headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(Ae(n))return{data:null,error:n};throw n}}async _deleteCustomProvider(t){try{return await Me(this.fetch,"DELETE",`${this.url}/admin/custom-providers/${t}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(r){if(Ae(r))return{data:null,error:r};throw r}}}function yP(e={}){return{getItem:t=>e[t]||null,setItem:(t,r)=>{e[t]=r},removeItem:t=>{delete e[t]}}}const _s={debug:!!(globalThis&&XL()&&globalThis.localStorage&&globalThis.localStorage.getItem("supabase.gotrue-js.locks.debug")==="true")};
716class JL extends Error{constructor(t){super(t),this.isAcquireTimeout=!0}}class vP extends JL{}async function Ote(e,t,r){_s.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquire lock",e,t);const n=new globalThis.AbortController;let s;t>0&&(s=setTimeout(()=>{n.abort(),_s.debug&&console.log("@supabase/gotrue-js: navigatorLock acquire timed out",e)},t)),await Promise.resolve();try{return await globalThis.navigator.locks.request(e,t===0?{mode:"exclusive",ifAvailable:!0}:{mode:"exclusive",signal:n.signal},async i=>{if(i){clearTimeout(s),_s.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquired",e,i.name);try{return await r()}finally{_s.debug&&console.log("@supabase/gotrue-js: navigatorLock: released",e,i.name)}}else{if(t===0)throw _s.debug&&console.log("@supabase/gotrue-js: navigatorLock: not immediately available",e),new vP(`Acquiring an exclusive Navigator LockManager lock "${e}" immediately failed`);if(_s.debug)try{const o=await globalThis.navigator.locks.query();console.log("@supabase/gotrue-js: Navigator LockManager state",JSON.stringify(o,null,"  "))}catch(o){console.warn("@supabase/gotrue-js: Error when querying Navigator LockManager state",o)}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"),clearTimeout(s),await r()}})}catch(i){if(t>0&&clearTimeout(s),(i==null?void 0:i.name)==="AbortError"&&t>0){if(n.signal.aborted)return _s.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquire timeout, recovering by stealing lock",e),console.warn(`@supabase/gotrue-js: Lock "${e}" was not released within ${t}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(e,{mode:"exclusive",steal:!0},async o=>{if(o){_s.debug&&console.log("@supabase/gotrue-js: navigatorLock: recovered (stolen)",e,o.name);try{return await r()}finally{_s.debug&&console.log("@supabase/gotrue-js: navigatorLock: released (stolen)",e,o.name)}}else return console.warn("@supabase/gotrue-js: Navigator LockManager returned null lock even with steal: true"),await r()}));throw _s.debug&&console.log("@supabase/gotrue-js: navigatorLock: lock was stolen by another request",e),new vP(`Lock "${e}" was released because another request stole it`)}throw i}}function Mte(){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 ZL(e){if(!/^0x[a-fA-F0-9]{40}$/.test(e))throw new Error(`@supabase/auth-js: Address "${e}" is invalid.`);return e.toLowerCase()}function Rte(e){return parseInt(e,16)}function $te(e){const t=new TextEncoder().encode(e);return"0x"+Array.from(t,n=>n.toString(16).padStart(2,"0")).join("")}function Ite(e){var t;const{chainId:r,domain:n,expirationTime:s,issuedAt:i=new Date,nonce:o,notBefore:l,requestId:c,resources:u,scheme:h,uri:d,version:f}=e;{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(o&&o.length<8)throw new Error(`@supabase/auth-js: Invalid SIWE message field "nonce". Nonce must be at least 8 characters. Provided value: ${o}`);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(!((t=e.statement)===null||t===void 0)&&t.includes(`
717`))throw new Error(`@supabase/auth-js: Invalid SIWE message field "statement". Statement must not include '\\n'. Provided value: ${e.statement}`)}const m=ZL(e.address),g=h?`${h}://${n}`:n,p=e.statement?`${e.statement}
718`:"",v=`${g} wants you to sign in with your Ethereum account:
719${m}
720
721${p}`;let x=`URI: ${d}
722Version: ${f}
723Chain ID: ${r}${o?`
724Nonce: ${o}`:""}
725Issued At: ${i.toISOString()}`;if(s&&(x+=`
726Expiration Time: ${s.toISOString()}`),l&&(x+=`
727Not Before: ${l.toISOString()}
727`),c&&(x+=`
728Request ID: ${c}`),u){let b=`
729Resources:`;for(const w of u){if(!w||typeof w!="string")throw new Error(`@supabase/auth-js: Invalid SIWE message field "resources". Every resource must be a valid string. Provided value: ${w}`);b+=`
730- ${w}`}x+=b}return`${v}
731${x}`}class sr extends Error{constructor({message:t,code:r,cause:n,name:s}){var i;super(t,{cause:n}),this.__isWebAuthnError=!0,this.name=(i=s??(n instanceof Error?n.name:void 0))!==null&&i!==void 0?i:"Unknown Error",this.code=r}}class Iv extends sr{constructor(t,r){super({code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:r,message:t}),this.name="WebAuthnUnknownError",this.originalError=r}}function Dte({error:e,options:t}){var r,n,s;const{publicKey:i}=t;if(!i)throw Error("options was missing required publicKey property");if(e.name==="AbortError"){if(t.signal instanceof AbortSignal)return new sr({message:"Registration ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:e})}else if(e.name==="ConstraintError"){if(((r=i.authenticatorSelection)===null||r===void 0?void 0:r.requireResidentKey)===!0)return new sr({message:"Discoverable credentials were required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_DISCOVERABLE_CREDENTIAL_SUPPORT",cause:e});if(t.mediation==="conditional"&&((n=i.authenticatorSelection)===null||n===void 0?void 0:n.userVerification)==="required")return new sr({message:"User verification was required during automatic registration but it could not be performed",code:"ERROR_AUTO_REGISTER_USER_VERIFICATION_FAILURE",cause:e});if(((s=i.authenticatorSelection)===null||s===void 0?void 0:s.userVerification)==="required")return new sr({message:"User verification was required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_USER_VERIFICATION_SUPPORT",cause:e})}else{if(e.name==="InvalidStateError")return new sr({message:"The authenticator was previously registered",code:"ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED",cause:e});if(e.name==="NotAllowedError")return new sr({message:e.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e});if(e.name==="NotSupportedError")return i.pubKeyCredParams.filter(l=>l.type==="public-key").length===0?new sr({message:'No entry in pubKeyCredParams was of type "public-key"',code:"ERROR_MALFORMED_PUBKEYCREDPARAMS",cause:e}):new sr({message:"No available authenticator supported any of the specified pubKeyCredParams algorithms",code:"ERROR_AUTHENTICATOR_NO_SUPPORTED_PUBKEYCREDPARAMS_ALG",cause:e});if(e.name==="SecurityError"){const o=window.location.hostname;if(e6(o)){if(i.rp.id!==o)return new sr({message:`The RP ID "${i.rp.id}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:e})}else return new sr({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:e})}else if(e.name==="TypeError"){if(i.user.id.byteLength<1||i.user.id.byteLength>64)return new sr({message:"User ID was not between 1 and 64 characters",code:"ERROR_INVALID_USER_ID_LENGTH",cause:e})}else if(e.name==="UnknownError")return new sr({message:"The authenticator was unable to process the specified options, or could not create a new credential",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:e})}return new sr({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e})}function Lte({error:e,options:t}){const{publicKey:r}=t;if(!r)throw Error("options was missing required publicKey property");if(e.name==="AbortError"){if(t.signal instanceof AbortSignal)return new sr({message:"Authentication ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:e})}else{if(e.name==="NotAllowedError")return new sr({message:e.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e});if(e.name==="SecurityError"){const n=window.location.hostname;if(e6(n)){if(r.rpId!==n)return new sr({message:`The RP ID "${r.rpId}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:e})}else return new sr({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:e})}else if(e.name==="UnknownError")return new sr({message:"The authenticator was unable to process the specified options, or could not create a new assertion signature",code:"ERROR_AUTHENTICATOR_GENERAL_ER
731ROR",cause:e})}return new sr({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e})}class Fte{createNewAbortSignal(){if(this.controller){const r=new Error("Cancelling existing WebAuthn API call for new one");r.name="AbortError",this.controller.abort(r)}const t=new AbortController;return this.controller=t,t.signal}cancelCeremony(){if(this.controller){const t=new Error("Manually cancelling existing WebAuthn API call");t.name="AbortError",this.controller.abort(t),this.controller=void 0}}}const zte=new Fte;function Bte(e){if(!e)throw new Error("Credential creation options are required");if(typeof PublicKeyCredential<"u"&&"parseCreationOptionsFromJSON"in PublicKeyCredential&&typeof PublicKeyCredential.parseCreationOptionsFromJSON=="function")return PublicKeyCredential.parseCreationOptionsFromJSON(e);const{challenge:t,user:r,excludeCredentials:n}=e,s=ch(e,["challenge","user","excludeCredentials"]),i=Du(t).buffer,o=Object.assign(Object.assign({},r),{id:Du(r.id).buffer}),l=Object.assign(Object.assign({},s),{challenge:i,user:o});if(n&&n.length>0){l.excludeCredentials=new Array(n.length);for(let c=0;c<n.length;c++){const u=n[c];l.excludeCredentials[c]=Object.assign(Object.assign({},u),{id:Du(u.id).buffer,type:u.type||"public-key",transports:u.transports})}}return l}function Ute(e){if(!e)throw new Error("Credential request options are required");if(typeof PublicKeyCredential<"u"&&"parseRequestOptionsFromJSON"in PublicKeyCredential&&typeof PublicKeyCredential.parseRequestOptionsFromJSON=="function")return PublicKeyCredential.parseRequestOptionsFromJSON(e);const{challenge:t,allowCredentials:r}=e,n=ch(e,["challenge","allowCredentials"]),s=Du(t).buffer,i=Object.assign(Object.assign({},n),{challenge:s});if(r&&r.length>0){i.allowCredentials=new Array(r.length);for(let o=0;o<r.length;o++){const l=r[o];i.allowCredentials[o]=Object.assign(Object.assign({},l),{id:Du(l.id).buffer,type:l.type||"public-key",transports:l.transports})}}return i}function Wte(e){var t;if("toJSON"in e&&typeof e.toJSON=="function")return e.toJSON();const r=e;return{id:e.id,rawId:e.id,response:{attestationObject:Fl(new Uint8Array(e.response.attestationObject)),clientDataJSON:Fl(new Uint8Array(e.response.clientDataJSON))},type:"public-key",clientExtensionResults:e.getClientExtensionResults(),authenticatorAttachment:(t=r.authenticatorAttachment)!==null&&t!==void 0?t:void 0}}function Vte(e){var t;if("toJSON"in e&&typeof e.toJSON=="function")return e.toJSON();const r=e,n=e.getClientExtensionResults(),s=e.response;return{id:e.id,rawId:e.id,response:{authenticatorData:Fl(new Uint8Array(s.authenticatorData)),clientDataJSON:Fl(new Uint8Array(s.clientDataJSON)),signature:Fl(new Uint8Array(s.signature)),userHandle:s.userHandle?Fl(new Uint8Array(s.userHandle)):void 0},type:"public-key",clientExtensionResults:n,authenticatorAttachment:(t=r.authenticatorAttachment)!==null&&t!==void 0?t:void 0}}function e6(e){return e==="localhost"||/^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/i.test(e)}function xP(){var e,t;return!!(Pr()&&"PublicKeyCredential"in window&&window.PublicKeyCredential&&"credentials"in navigator&&typeof((e=navigator==null?void 0:navigator.credentials)===null||e===void 0?void 0:e.create)=="function"&&typeof((t=navigator==null?void 0:navigator.credentials)===null||t===void 0?void 0:t.get)=="function")}async function Hte(e){try{const t=await navigator.credentials.create(e);return t?t instanceof PublicKeyCredential?{data:t,error:null}:{data:null,error:new Iv("Browser returned unexpected credential type",t)}:{data:null,error:new Iv("Empty credential response",t)}}catch(t){return{data:null,error:Dte({error:t,options:e})}}}async function qte(e){try{const t=await navigator.credentials.get(e);return t?t instanceof PublicKeyCredential?{data:t,error:null}:{data:null,error:new Iv("Browser returned unexpected credential type",t)}:{data:null,error:new Iv("Empty credential response",t)}}catch(t){return{data:null,error:Lte({error:t,options:e})}}}const Gte={hints:["security-key"],authenticatorSelection:{authenticatorAttachment:"cross-platform",requireResidentKey:!1,userVerification:"preferred",residentKey:"discouraged"},attestation:"direct"},Kte={userVerification:"preferred",hints:["security-key"],attestation:"direct"};function Dv(...e){const t=s=>s!==null&&typeof s=="object"&&!Array.isArray(s),r=s=>s instanceof ArrayBuffer||ArrayBuffer.isView(s),n={};for(const s of e)if(s)for(const i in s){const o=s[i];if(o!==void 0)if(Array.isArray(o))n[i]=o;else if(r(o))n[i]=o;else if(t(o)){const l=n[i];t(l)?n[i]=Dv(l,o):n[i]=Dv(o)}else n[i]=o}return n}function Yte(e,t){return Dv(Gte,e,t||{})}function Xte(e,t){return Dv(Kte,e,t||{})}class Qte{constructor(t){this.client=t,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(t){return this.client.mfa.enroll(Object.assign(Object.assign({},t),{factorType:"webauthn"}))}async _challenge({factorId:t,webauthn:r,friendlyName:n,signal:s},i){var o;try{const{data:l,error:c}=await this.client.mfa.challenge({factorId:t,webauthn:r});if(!l)return{data:null,error:c};const u=s??zte.createNewAbortSignal();if(l.webauthn.type==="create"){const{user:h}=l.webauthn.credential_options.publicKey;if(!h.name){const d=n;if(d)h.name=`${h.id}:${d}`;else{const m=(await this.client.getUser()).data.user,g=((o=m==null?void 0:m.user_metadata)===null||o===void 0?void 0:o.name)||(m==null?void 0:m.email)||(m==null?void 0:m.id)||"User";h.name=`${h.id}:${g}`}}h.displayName||(h.displayName=h.name)}switch(l.webauthn.type){case"create":{const h=Yte(l.webauthn.credential_options.publicKey,i==null?void 0:i.create),{data:d,error:f}=await Hte({publicKey:h,signal:u});return d?{data:{factorId:t,challengeId:l.id,webauthn:{type:l.webauthn.type,credential_response:d}},error:null}:{data:null,error:f}}case"request":{const h=Xte(l.webauthn.credential_options.publicKey,i==null?void 0:i.request),{data:d,error:f}=await qte(Object.assign(Object.assign({},l.webauthn.credential_options),{publicKey:h,signal:u}));return d?{data:{factorId:t,challengeId:l.id,webauthn:{type:l.webauthn.type,credential_response:d}},error:null}:{data:null,error:f}}}}catch(l){return Ae(l)?{data:null,error:l}:{data:null,error:new Pl("Unexpected error in challenge",l)}}}async _verify({challengeId:t,factorId:r,webauthn:n}){return this.client.mfa.verify({factorId:r,challengeId:t,webauthn:n})}async _authenticate({factorId:t,webauthn:{rpId:r=typeof window<"u"?window.location.hostname:void 0,rpOrigins:n=typeof window<"u"?[window.location.origin]:void 0,signal:s}={}},i){if(!r)return{data:null,error:new ym("rpId is required for WebAuthn authentication")};try{if(!xP())return{data:null,error:new Pl("Browser does not support WebAuthn",null)};const{data:o,error:l}=await this.challenge({factorId:t,webauthn:{rpId:r,rpOrigins:n},signal:s},{request:i});if(!o)return{data:null,error:l};const{webauthn:c}=o;return this._verify({factorId:t,challengeId:o.challengeId,webauthn:{type:c.type,rpId:r,rpOrigins:n,credential_response:c.credential_response}})}catch(o){return Ae(o)?{data:null,error:o}:{data:null,error:new Pl("Unexpected error in authenticate",o)}}}async _register({friendlyName:t,webauthn:{rpId:r=typeof window<"u"?window.location.hostname:void 0,rpOrigins:n=typeof window<"u"?[window.location.origin]:void 0,signal:s}={}},i){if(!r)return{data:null,error:new ym("rpId is required for WebAuthn registration")};try{if(!xP())return{data:null,error:new Pl("Browser does not support WebAuthn",null)};const{data:o,error:l}=await this._enroll({friendlyName:t});if(!o)return await this.client.mfa.listFactors().then(h=>{var d;return(d=h.data)===null||d===void 0?void 0:d.all.find(f=>f.factor_type==="webauthn"&&f.friendly_name===t&&f.status!=="unverified")}).then(h=>h?this.client.mfa.unenroll({factorId:h==null?void 0:h.id}):void 0),{data:null,error:l};const{data:c,error:u}=await this._challenge({factorId:o.id,friendlyName:o.friendly_name,webauthn:{rpId:r,rpOrigins:n},signal:s},{create:i});return c?this._verify({factorId:o.id,challengeId:c.challengeId,webauthn:{rpId:r,rpOrigins:n,type:c.webauthn.type,credential_response:c.webauthn.credential_response}}):{data:null,error:u}}catch(o){return Ae(o)?{data:null,error:o}:{data:null,error:new Pl("Unexpected error in register",o)}}}}Mte();const Jte={url:Yee,storageKey:Xee,autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:Qee,flowType:"implicit",debug:!1,hasCustomAuthorizationHeader:!1,throwOnError:!1,lockAcquireTimeout:5e3,skipAutoInitialize:!1};async function bP(e,t,r){return await r()}const Hc={};class vm{get jwks(){var t,r;return(r=(t=Hc[this.storageKey])===null||t===void 0?void 0:t.jwks)!==null&&r!==void 0?r:{keys:[]}}set jwks(t){Hc[this.storageKey]=Object.assign(Object.assign({},Hc[this.storageKey]),{jwks:t})}get jwks_cached_at(){var t,r;return(r=(t=Hc[this.storageKey])===null||t===void 0?void 0:t.cachedAt)!==null&&r!==void 0?r:Number.MIN_SAFE_INTEGER}set jwks_cached_at(t){Hc[this.storageKey]=Object.assign(Object.assign({},Hc[this.storageKey]),{cachedAt:t})}constructor(t){var r,n,s;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 i=Object.assign(Object.assign({},Jte),t);if(this.storageKey=i.storageKey,this.instanceID=(r=vm.nextInstanceID[this.storageKey])!==null&&r!==void 0?r:0,vm.nextInstanceID[this.storageKey]=this.instanceID+1,this.logDebugMessages=!!i.debug,typeof i.debug=="function"&&(this.logger=i.debug),this.instanceID>0&&Pr()){const o=`${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(o),this.logDebugMessages&&console.trace(o)}if(this.persistSession=i.persistSession,this.autoRefreshToken=i.autoRefreshToken,this.admin=new Pte({url:i.url,headers:i.headers,fetch:i.fetch}),this.url=i.url,this.headers=i.headers,this.fetch=QL(i.fetch),this.lock=i.lock||bP,this.detectSessionInUrl=i.detectSessionInUrl,this.flowType=i.flowType,this.hasCustomAuthorizationHeader=i.hasCustomAuthorizationHeader,this.throwOnError=i.throwOnError,this.lockAcquireTimeout=i.lockAcquireTimeout,i.lock?this.lock=i.lock:this.persistSession&&Pr()&&(!((n=globalThis==null?void 0:globalThis.navigator)===null||n===void 0)&&n.locks)?this.lock=Ote: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 Qte(this)}
731,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?(i.storage?this.storage=i.storage:XL()?this.storage=globalThis.localStorage:(this.memoryStorage={},this.storage=yP(this.memoryStorage)),i.userStorage&&(this.userStorage=i.userStorage)):(this.memoryStorage={},this.storage=yP(this.memoryStorage)),Pr()&&globalThis.BroadcastChannel&&this.persistSession&&this.storageKey){try{this.broadcastChannel=new globalThis.BroadcastChannel(this.storageKey)}catch(o){console.error("Failed to create a new BroadcastChannel, multi-tab state changes will not be available",o)}(s=this.broadcastChannel)===null||s===void 0||s.addEventListener("message",async o=>{this._debug("received broadcast notification from other tab or client",o);try{await this._notifyAllSubscribers(o.data.event,o.data.session,!1)}catch(l){this._debug("#broadcastChannel","error",l)}})}i.skipAutoInitialize||this.initialize().catch(o=>{this._debug("#initialize()","error",o)})}isThrowOnErrorEnabled(){return this.throwOnError}_returnResult(t){if(this.throwOnError&&t&&t.error)throw t.error;return t}_logPrefix(){return`GoTrueClient@${this.storageKey}:${this.instanceID} (${GL}) ${new Date().toISOString()}`}_debug(...t){return this.logDebugMessages&&this.logger(this._logPrefix(),...t),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 t;try{let r={},n="none";if(Pr()&&(r=dte(window.location.href),this._isImplicitGrantCallback(r)?n="implicit":await this._isPKCECallback(r)&&(n="pkce")),Pr()&&this.detectSessionInUrl&&n!=="none"){const{data:s,error:i}=await this._getSessionFromURL(r,n);if(i){if(this._debug("#_initialize()","error detecting session from URL",i),rte(i)){const c=(t=i.details)===null||t===void 0?void 0:t.code;if(c==="identity_already_exists"||c==="identity_not_found"||c==="single_identity_not_deletable")return{error:i}}return{error:i}}const{session:o,redirectType:l}=s;return this._debug("#_initialize()","detected session in URL",o,"redirect type",l),await this._saveSession(o),setTimeout(async()=>{l==="recovery"?await this._notifyAllSubscribers("PASSWORD_RECOVERY",o):await this._notifyAllSubscribers("SIGNED_IN",o)},0),{error:null}}return await this._recoverAndRefresh(),{error:null}}catch(r){return Ae(r)?this._returnResult({error:r}):this._returnResult({error:new Pl("Unexpected error during initialization",r)})}finally{await this._handleVisibilityChange(),this._debug("#_initialize()","end")}}async signInAnonymously(t){var r,n,s;try{const i=await Me(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{data:(n=(r=t==null?void 0:t.options)===null||r===void 0?void 0:r.data)!==null&&n!==void 0?n:{},gotrue_meta_security:{captcha_token:(s=t==null?void 0:t.options)===null||s===void 0?void 0:s.captchaToken}},xform:Da}),{data:o,error:l}=i;if(l||!o)return this._returnResult({data:{user:null,session:null},error:l});const c=o.session,u=o.user;return o.session&&(await this._saveSession(o.session),await this._notifyAllSubscribers("SIGNED_IN",c)),this._returnResult({data:{user:u,session:c},error:null})}catch(i){if(Ae(i))return this._returnResult({data:{user:null,session:null},error:i});throw i}}async signUp(t){var r,n,s;try{let i;if("email"in t){const{email:h,password:d,options:f}=t;let m=null,g=null;this.flowType==="pkce"&&([m,g]=await Wc(this.storage,this.storageKey)),i=await Me(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,redirectTo:f==null?void 0:f.emailRedirectTo,body:{email:h,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:m,code_challenge_method:g},xform:Da})}else if("phone"in t){const{phone:h,password:d,options:f}=t;i=await Me(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{phone:h,password:d,data:(n=f==null?void 0:f.data)!==null&&n!==void 0?n:{},channel:(s=f==null?void 0:f.channel)!==null&&s!==void 0?s:"sms",gotrue_meta_security:{captcha_token:f==null?void 0:f.captchaToken}},xform:Da})}else throw new Tg("You must provide either an email or phone number and a password");const{data:o,error:l}=i;if(l||!o)return await Ar(this.storage,`${this.storageKey}-code-verifier`),this._returnResult({data:{user:null,session:null},error:l});const c=o.session,u=o.user;return o.session&&(await this._saveSession(o.session),await this._notifyAllSubscribers("SIGNED_IN",c)),this._returnResult({data:{user:u,session:c},error:null})}catch(i){if(await Ar(this.storage,`${this.storageKey}-code-verifier`),Ae(i))return this._returnResult({data:{user:null,session:null},error:i});throw i}}async signInWithPassword(t){try{let r;if("email"in t){const{email:i,password:o,options:l}=t;r=await Me(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{email:i,password:o,gotrue_meta_security:{captcha_token:l==null?void 0:l.captchaToken}},xform:pP})}else if("phone"in t){const{phone:i,password:o,options:l}=t;r=await Me(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{phone:i,password:o,gotrue_meta_security:{captcha_token:l==null?void 0:l.captchaToken}},xform:pP})}else throw new Tg("You must provide either an email or phone number and a password");const{data:n,error:s}=r;if(s)return this._returnResult({data:{user:null,session:null},error:s});if(!n||!n.session||!n.user){const i=new Uc;return this._returnResult({data:{user:null,session:null},error:i})}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:s})}catch(r){if(Ae(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}}async signInWithOAuth(t){var r,n,s,i;return await this._handleProviderSignIn(t.provider,{redirectTo:(r=t.options)===null||r===void 0?void 0:r.redirectTo,scopes:(n=t.options)===null||n===void 0?void 0:n.scopes,queryParams:(s=t.options)===null||s===void 0?void 0:s.queryParams,skipBrowserRedirect:(i=t.options)===null||i===void 0?void 0:i.skipBrowserRedirect})}async exchangeCodeForSession(t){return await this.initializePromise,this._acquireLock(this.lockAcquireTimeout,async()=>this._exchangeCodeForSession(t))}async signInWithWeb3(t){const{chain:r}=t;switch(r){case"ethereum":return await this.signInWithEthereum(t);case"solana":return await this.signInWithSolana(t);default:throw new Error(`@supabase/auth-js: Unsupported chain "${r}"`)}}async signInWithEthereum(t){var r,n,s,i,o,l,c,u,h,d,f;let m,g;if("message"in t)m=t.message,g=t.signature;else{const{chain:p,wallet:v,statement:x,options:b}=t;let w;if(Pr())if(typeof v=="object")w=v;else{const C=window;if("ethereum"in C&&typeof C.ethereum=="object"&&"request"in C.ethereum&&typeof C.ethereum.request=="function")w=C.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 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 j=new URL((r=b==null?void 0:b.url)!==null&&r!==void 0?r:window.location.href),_=await w.request({method:"eth_requestAccounts"}).then(C=>C).catch(()=>{throw new Error("@supabase/auth-js: Wallet method eth_requestAccounts is missing or invalid")});if(!_||_.length===0)throw new Error("@supabase/auth-js: No accounts available. Please ensure the wallet is connected.");const S=ZL(_[0]);let k=(n=b==null?void 0:b.signInWithEthereum)===null||n===void 0?void 0:n.chainId;if(!k){const C=await w.request({method:"eth_chainId"});k=Rte(C)}const P={domain:j.host,address:S,statement:x,uri:j.href,version:"1",chainId:k,nonce:(s=b==null?void 0:b.signInWithEthereum)===null||s===void 0?void 0:s.nonce,issuedAt:(o=(i=b==null?void 0:b.signInWithEthereum)===null||i===void 0?void 0:i.issuedAt)!==null&&o!==void 0?o:new Date,expirationTime:(l=b==null?void 0:b.signInWithEthereum)===null||l===void 0?void 0:l.expirationTime,notBefore:(c=b==null?void 0:b.signInWithEthereum)===null||c===void 0?void 0:c.notBefore,requestId:(u=b==null?void 0:b.signInWithEthereum)===null||u===void 0?void 0:u.requestId,resources:(h=b==null?void 0:b.signInWithEthereum)===null||h===void 0?void 0:h.resources};m=Ite(P),g=await w.request({method:"personal_sign",params:[$te(m),S]})}try{const{data:p,error:v}=await Me(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"ethereum",message:m,signature:g},!((d=t.options)===null||d===void 0)&&d.captchaToken?{gotrue_meta_security:{captcha_token:(f=t.options)===null||f===void 0?void 0:f.captchaToken}}:null),xform:Da});if(v)throw v;
731if(!p||!p.session||!p.user){const x=new Uc;return this._returnResult({data:{user:null,session:null},error:x})}return p.session&&(await this._saveSession(p.session),await this._notifyAllSubscribers("SIGNED_IN",p.session)),this._returnResult({data:Object.assign({},p),error:v})}catch(p){if(Ae(p))return this._returnResult({data:{user:null,session:null},error:p});throw p}}async signInWithSolana(t){var r,n,s,i,o,l,c,u,h,d,f,m;let g,p;if("message"in t)g=t.message,p=t.signature;else{const{chain:v,wallet:x,statement:b,options:w}=t;let j;if(Pr())if(typeof x=="object")j=x;else{const S=window;if("solana"in S&&typeof S.solana=="object"&&("signIn"in S.solana&&typeof S.solana.signIn=="function"||"signMessage"in S.solana&&typeof S.solana.signMessage=="function"))j=S.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 x!="object"||!(w!=null&&w.url))throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");j=x}const _=new URL((r=w==null?void 0:w.url)!==null&&r!==void 0?r:window.location.href);if("signIn"in j&&j.signIn){const S=await j.signIn(Object.assign(Object.assign(Object.assign({issuedAt:new Date().toISOString()},w==null?void 0:w.signInWithSolana),{version:"1",domain:_.host,uri:_.href}),b?{statement:b}:null));let k;if(Array.isArray(S)&&S[0]&&typeof S[0]=="object")k=S[0];else if(S&&typeof S=="object"&&"signedMessage"in S&&"signature"in S)k=S;else throw new Error("@supabase/auth-js: Wallet method signIn() returned unrecognized value");if("signedMessage"in k&&"signature"in k&&(typeof k.signedMessage=="string"||k.signedMessage instanceof Uint8Array)&&k.signature instanceof Uint8Array)g=typeof k.signedMessage=="string"?k.signedMessage:new TextDecoder().decode(k.signedMessage),p=k.signature;else throw new Error("@supabase/auth-js: Wallet method signIn() API returned object without signedMessage and signature fields")}else{if(!("signMessage"in j)||typeof j.signMessage!="function"||!("publicKey"in j)||typeof j!="object"||!j.publicKey||!("toBase58"in j.publicKey)||typeof j.publicKey.toBase58!="function")throw new Error("@supabase/auth-js: Wallet does not have a compatible signMessage() and publicKey.toBase58() API");g=[`${_.host} wants you to sign in with your Solana account:`,j.publicKey.toBase58(),...b?["",b,""]:[""],"Version: 1",`URI: ${_.href}`,`Issued At: ${(s=(n=w==null?void 0:w.signInWithSolana)===null||n===void 0?void 0:n.issuedAt)!==null&&s!==void 0?s:new Date().toISOString()}`,...!((i=w==null?void 0:w.signInWithSolana)===null||i===void 0)&&i.notBefore?[`Not Before: ${w.signInWithSolana.notBefore}`]:[],...!((o=w==null?void 0:w.signInWithSolana)===null||o===void 0)&&o.expirationTime?[`Expiration Time: ${w.signInWithSolana.expirationTime}`]:[],...!((l=w==null?void 0:w.signInWithSolana)===null||l===void 0)&&l.chainId?[`Chain ID: ${w.signInWithSolana.chainId}`]:[],...!((c=w==null?void 0:w.signInWithSolana)===null||c===void 0)&&c.nonce?[`Nonce: ${w.signInWithSolana.nonce}`]:[],...!((u=w==null?void 0:w.signInWithSolana)===null||u===void 0)&&u.requestId?[`Request ID: ${w.signInWithSolana.requestId}`]:[],...!((d=(h=w==null?void 0:w.signInWithSolana)===null||h===void 0?void 0:h.resources)===null||d===void 0)&&d.length?["Resources",...w.signInWithSolana.resources.map(k=>`- ${k}`)]:[]].join(`
732`);const S=await j.signMessage(new TextEncoder().encode(g),"utf8");if(!S||!(S instanceof Uint8Array))throw new Error("@supabase/auth-js: Wallet signMessage() API returned an recognized value");p=S}}try{const{data:v,error:x}=await Me(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"solana",message:g,signature:Fl(p)},!((f=t.options)===null||f===void 0)&&f.captchaToken?{gotrue_meta_security:{captcha_token:(m=t.options)===null||m===void 0?void 0:m.captchaToken}}:null),xform:Da});if(x)throw x;if(!v||!v.session||!v.user){const b=new Uc;return this._returnResult({data:{user:null,session:null},error:b})}return v.session&&(await this._saveSession(v.session),await this._notifyAllSubscribers("SIGNED_IN",v.session)),this._returnResult({data:Object.assign({},v),error:x})}catch(v){if(Ae(v))return this._returnResult({data:{user:null,session:null},error:v});throw v}}async _exchangeCodeForSession(t){const r=await vl(this.storage,`${this.storageKey}-code-verifier`),[n,s]=(r??"").split("/");try{if(!n&&this.flowType==="pkce")throw new nte;const{data:i,error:o}=await Me(this.fetch,"POST",`${this.url}/token?grant_type=pkce`,{headers:this.headers,body:{auth_code:t,code_verifier:n},xform:Da});if(await Ar(this.storage,`${this.storageKey}-code-verifier`),o)throw o;if(!i||!i.session||!i.user){const l=new Uc;return this._returnResult({data:{user:null,session:null,redirectType:null},error:l})}return i.session&&(await this._saveSession(i.session),await this._notifyAllSubscribers("SIGNED_IN",i.session)),this._returnResult({data:Object.assign(Object.assign({},i),{redirectType:s??null}),error:o})}catch(i){if(await Ar(this.storage,`${this.storageKey}-code-verifier`),Ae(i))return this._returnResult({data:{user:null,session:null,redirectType:null},error:i});throw i}}async signInWithIdToken(t){try{const{options:r,provider:n,token:s,access_token:i,nonce:o}=t,l=await Me(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,body:{provider:n,id_token:s,access_token:i,nonce:o,gotrue_meta_security:{captcha_token:r==null?void 0:r.captchaToken}},xform:Da}),{data:c,error:u}=l;if(u)return this._returnResult({data:{user:null,session:null},error:u});if(!c||!c.session||!c.user){const h=new Uc;return this._returnResult({data:{user:null,session:null},error:h})}return c.session&&(await this._saveSession(c.session),await this._notifyAllSubscribers("SIGNED_IN",c.session)),this._returnResult({data:c,error:u})}catch(r){if(Ae(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}}async signInWithOtp(t){var r,n,s,i,o;try{if("email"in t){const{email:l,options:c}=t;let u=null,h=null;this.flowType==="pkce"&&([u,h]=await Wc(this.storage,this.storageKey));const{error:d}=await Me(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{email:l,data:(r=c==null?void 0:c.data)!==null&&r!==void 0?r:{},create_user:(n=c==null?void 0:c.shouldCreateUser)!==null&&n!==void 0?n:!0,gotrue_meta_security:{captcha_token:c==null?void 0:c.captchaToken},code_challenge:u,code_challenge_method:h},redirectTo:c==null?void 0:c.emailRedirectTo});return this._returnResult({data:{user:null,session:null},error:d})}if("phone"in t){const{phone:l,options:c}=t,{data:u,error:h}=await Me(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{phone:l,data:(s=c==null?void 0:c.data)!==null&&s!==void 0?s:{},create_user:(i=c==null?void 0:c.shouldCreateUser)!==null&&i!==void 0?i:!0,gotrue_meta_security:{captcha_token:c==null?void 0:c.captchaToken},channel:(o=c==null?void 0:c.channel)!==null&&o!==void 0?o:"sms"}});return this._returnResult({data:{user:null,session:null,messageId:u==null?void 0:u.message_id},error:h})}throw new Tg("You must provide either an email or phone number.")}catch(l){if(await Ar(this.storage,`${this.storageKey}-code-verifier`),Ae(l))return this._returnResult({data:{user:null,session:null},error:l});throw l}}async verifyOtp(t){var r,n;try{let s,i;"options"in t&&(s=(r=t.options)===null||r===void 0?void 0:r.redirectTo,i=(n=t.options)===null||n===void 0?void 0:n.captchaToken);const{data:o,error:l}=await Me(this.fetch,"POST",`${this.url}/verify`,{headers:this.headers,body:Object.assign(Object.assign({},t),{gotrue_meta_security:{captcha_token:i}}),redirectTo:s,xform:Da});if(l)throw l;if(!o)throw new Error("An error occurred on token verification.");const c=o.session,u=o.user;return c!=null&&c.access_token&&(await this._saveSession(c),await this._notifyAllSubscribers(t.type=="recovery"?"PASSWORD_RECOVERY":"SIGNED_IN",c)),this._returnResult({data:{user:u,session:c},error:null})}catch(s){if(Ae(s))return this._returnResult({data:{user:null,session:null},error:s});throw s}}async signInWithSSO(t){var r,n,s,i,o;try{let l=null,c=null;this.flowType==="pkce"&&([l,c]=await Wc(this.storage,this.storageKey));const u=await Me(this.fetch,"POST",`${this.url}/sso`,{body:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},"providerId"in t?{provider_id:t.providerId}:null),"domain"in t?{domain:t.domain}:null),{redirect_to:(n=(r=t.options)===null||r===void 0?void 0:r.redirectTo)!==null&&n!==void 0?n:void 0}),!((s=t==null?void 0:t.options)===null||s===void 0)&&s.captchaToken?{gotrue_meta_security:{captcha_token:t.options.captchaToken}}:null),{skip_http_redirect:!0,code_challenge:l,code_challenge_method:c}),headers:this.headers,xform:Ete});return!((i=u.data)===null||i===void 0)&&i.url&&Pr()&&!(!((o=t.options)===null||o===void 0)&&o.skipBrowserRedirect)&&window.location.assign(u.data.url),this._returnResult(u)}catch(l){if(await Ar(this.storage,`${this.storageKey}-code-verifier`),Ae(l))return this._returnResult({data:null,error:l});throw l}}async reauthenticate(){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._reauthenticate())}async _reauthenticate(){try{return await this._useSession(async t=>{const{data:{session:r},error:n}=t;if(n)throw n;if(!r)throw new In;const{error:s}=await Me(this.fetch,"GET",`${this.url}/reauthenticate`,{headers:this.headers,jwt:r.access_token});return this._returnResult({data:{user:null,session:null},error:s})})}catch(t){if(Ae(t))return this._returnResult({data:{user:null,session:null},error:t});throw t}}async resend(t){try{const r=`${this.url}/resend`;if("email"in t){const{email:n,type:s,options:i}=t,{error:o}=await Me(this.fetch,"POST",r,{headers:this.headers,body:{email:n,type:s,gotrue_meta_security:{captcha_token:i==null?void 0:i.captchaToken}},redirectTo:i==null?void 0:i.emailRedirectTo});return this._returnResult({data:{user:null,session:null},error:o})}else if("phone"in t){const{phone:n,type:s,options:i}=t,{data:o,error:l}=await Me(this.fetch,"POST",r,{headers:this.headers,body:{phone:n,type:s,gotrue_meta_security:{captcha_token:i==null?void 0:i.captchaToken}}});return this._returnResult({data:{user:null,session:null,messageId:o==null?void 0:o.message_id},error:l})}throw new Tg("You must provide either an email or phone number and a type")}catch(r){if(Ae(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(t,r){this._debug("#_acquireLock","begin",t);try{if(this.lockAcquired){const n=this.pendingInLock.length?this.pendingInLock[this.pendingInLock.length-1]:Promise.resolve(),s=(async()=>(await n,await r()))();return this.pendingInLock.push((async()=>{try{await s}catch{}})()),s}return await this.lock(`lock:${this.storageKey}`,t,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 s=[...this.pendingInLock];await Promise.all(s),this.pendingInLock.splice(0,s.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(t){this._debug("#_useSession","begin");try{const r=await this.__loadSession();return await t(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 t=null;const r=await vl(this.storage,this.storageKey);if(this._debug("#getSession()","session from storage",r),r!==null&&(this._isValidSession(r)?t=r:(this._debug("#getSession()","session from storage is not val
732id"),await this._removeSession())),!t)return{data:{session:null},error:null};const n=t.expires_at?t.expires_at*1e3-Date.now()<Qw:!1;if(this._debug("#__loadSession()",`session has${n?"":" not"} expired`,"expires_at",t.expires_at),!n){if(this.userStorage){const o=await vl(this.userStorage,this.storageKey+"-user");o!=null&&o.user?t.user=o.user:t.user=e1()}if(this.storage.isServer&&t.user&&!t.user.__isUserNotAvailableProxy){const o={value:this.suppressGetSessionWarning};t.user=Ste(t.user,o),o.value&&(this.suppressGetSessionWarning=!0)}return{data:{session:t},error:null}}const{data:s,error:i}=await this._callRefreshToken(t.refresh_token);return i?this._returnResult({data:{session:null},error:i}):this._returnResult({data:{session:s},error:null})}finally{this._debug("#__loadSession()","end")}}async getUser(t){if(t)return await this._getUser(t);await this.initializePromise;const r=await this._acquireLock(this.lockAcquireTimeout,async()=>await this._getUser());return r.data.user&&(this.suppressGetSessionWarning=!0),r}async _getUser(t){try{return t?await Me(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:t,xform:xo}):await this._useSession(async r=>{var n,s,i;const{data:o,error:l}=r;if(l)throw l;return!(!((n=o.session)===null||n===void 0)&&n.access_token)&&!this.hasCustomAuthorizationHeader?{data:{user:null},error:new In}:await Me(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:(i=(s=o.session)===null||s===void 0?void 0:s.access_token)!==null&&i!==void 0?i:void 0,xform:xo})})}catch(r){if(Ae(r))return Jw(r)&&(await this._removeSession(),await Ar(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({data:{user:null},error:r});throw r}}async updateUser(t,r={}){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._updateUser(t,r))}async _updateUser(t,r={}){try{return await this._useSession(async n=>{const{data:s,error:i}=n;if(i)throw i;if(!s.session)throw new In;const o=s.session;let l=null,c=null;this.flowType==="pkce"&&t.email!=null&&([l,c]=await Wc(this.storage,this.storageKey));const{data:u,error:h}=await Me(this.fetch,"PUT",`${this.url}/user`,{headers:this.headers,redirectTo:r==null?void 0:r.emailRedirectTo,body:Object.assign(Object.assign({},t),{code_challenge:l,code_challenge_method:c}),jwt:o.access_token,xform:xo});if(h)throw h;return o.user=u.user,await this._saveSession(o),await this._notifyAllSubscribers("USER_UPDATED",o),this._returnResult({data:{user:o.user},error:null})})}catch(n){if(await Ar(this.storage,`${this.storageKey}-code-verifier`),Ae(n))return this._returnResult({data:{user:null},error:n});throw n}}async setSession(t){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._setSession(t))}async _setSession(t){try{if(!t.access_token||!t.refresh_token)throw new In;const r=Date.now()/1e3;let n=r,s=!0,i=null;const{payload:o}=Pg(t.access_token);if(o.exp&&(n=o.exp,s=n<=r),s){const{data:l,error:c}=await this._callRefreshToken(t.refresh_token);if(c)return this._returnResult({data:{user:null,session:null},error:c});if(!l)return{data:{user:null,session:null},error:null};i=l}else{const{data:l,error:c}=await this._getUser(t.access_token);if(c)return this._returnResult({data:{user:null,session:null},error:c});i={access_token:t.access_token,refresh_token:t.refresh_token,user:l.user,token_type:"bearer",expires_in:n-r,expires_at:n},await this._saveSession(i),await this._notifyAllSubscribers("SIGNED_IN",i)}return this._returnResult({data:{user:i.user,session:i},error:null})}catch(r){if(Ae(r))return this._returnResult({data:{session:null,user:null},error:r});throw r}}async refreshSession(t){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._refreshSession(t))}async _refreshSession(t){try{return await this._useSession(async r=>{var n;if(!t){const{data:o,error:l}=r;if(l)throw l;t=(n=o.session)!==null&&n!==void 0?n:void 0}if(!(t!=null&&t.refresh_token))throw new In;const{data:s,error:i}=await this._callRefreshToken(t.refresh_token);return i?this._returnResult({data:{user:null,session:null},error:i}):s?this._returnResult({data:{user:s.user,session:s},error:null}):this._returnResult({data:{user:null,session:null},error:null})})}catch(r){if(Ae(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}}async _getSessionFromURL(t,r){try{if(!Pr())throw new Ag("No browser detected.");
732if(t.error||t.error_description||t.error_code)throw new Ag(t.error_description||"Error in URL with unspecified error_description",{error:t.error||"unspecified_error",code:t.error_code||"unspecified_code"});switch(r){case"implicit":if(this.flowType==="pkce")throw new lP("Not a valid PKCE flow url.");break;case"pkce":if(this.flowType==="implicit")throw new Ag("Not a valid implicit grant flow url.");break;default:}if(r==="pkce"){if(this._debug("#_initialize()","begin","is PKCE flow",!0),!t.code)throw new lP("No code detected.");const{data:b,error:w}=await this._exchangeCodeForSession(t.code);if(w)throw w;const j=new URL(window.location.href);return j.searchParams.delete("code"),window.history.replaceState(window.history.state,"",j.toString()),{data:{session:b.session,redirectType:null},error:null}}const{provider_token:n,provider_refresh_token:s,access_token:i,refresh_token:o,expires_in:l,expires_at:c,token_type:u}=t;if(!i||!l||!o||!u)throw new Ag("No session defined in URL");const h=Math.round(Date.now()/1e3),d=parseInt(l);let f=h+d;c&&(f=parseInt(c));const m=f-h;m*1e3<=cu&&console.warn(`@supabase/gotrue-js: Session as retrieved from URL expires in ${m}s, should have been closer to ${d}s`);const g=f-d;h-g>=120?console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued over 120s ago, URL could be stale",g,f,h):h-g<0&&console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued in the future? Check the device clock for skew",g,f,h);const{data:p,error:v}=await this._getUser(i);if(v)throw v;const x={provider_token:n,provider_refresh_token:s,access_token:i,expires_in:d,expires_at:f,refresh_token:o,token_type:u,user:p.user};return window.location.hash="",this._debug("#_getSessionFromURL()","clearing window.location.hash"),this._returnResult({data:{session:x,redirectType:t.type},error:null})}catch(n){if(Ae(n))return this._returnResult({data:{session:null,redirectType:null},error:n});throw n}}_isImplicitGrantCallback(t){return typeof this.detectSessionInUrl=="function"?this.detectSessionInUrl(new URL(window.location.href),t):!!(t.access_token||t.error_description)}async _isPKCECallback(t){const r=await vl(this.storage,`${this.storageKey}-code-verifier`);return!!(t.code&&r)}async signOut(t={scope:"global"}){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._signOut(t))}async _signOut({scope:t}={scope:"global"}){return await this._useSession(async r=>{var n;const{data:s,error:i}=r;if(i&&!Jw(i))return this._returnResult({error:i});const o=(n=s.session)===null||n===void 0?void 0:n.access_token;if(o){const{error:l}=await this.admin.signOut(o,t);if(l&&!(tte(l)&&(l.status===404||l.status===401||l.status===403)||Jw(l)))return this._returnResult({error:l})}return t!=="others"&&(await this._removeSession(),await Ar(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({error:null})})}onAuthStateChange(t){const r=ute(),n={id:r,callback:t,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(t){return await this._useSession(async r=>{var n,s;try{const{data:{session:i},error:o}=r;if(o)throw o;await((n=this.stateChangeEmitters.get(t))===null||n===void 0?void 0:n.callback("INITIAL_SESSION",i)),this._debug("INITIAL_SESSION","callback id",t,"session",i)}catch(i){await((s=this.stateChangeEmitters.get(t))===null||s===void 0?void 0:s.callback("INITIAL_SESSION",null)),this._debug("INITIAL_SESSION","callback id",t,"error",i),console.error(i)}})}async resetPasswordForEmail(t,r={}){let n=null,s=null;this.flowType==="pkce"&&([n,s]=await Wc(this.storage,this.storageKey,!0));try{return await Me(this.fetch,"POST",`${this.url}/recover`,{body:{email:t,code_challenge:n,code_challenge_method:s,gotrue_meta_security:{captcha_token:r.captchaToken}},headers:this.headers,redirectTo:r.redirectTo})}catch(i){if(await Ar(this.storage,`${this.storageKey}-code-verifier`),Ae(i))return this._returnResult({data:null,error:i});throw i}}async getUserIdentities(){var t;try{const{data:r,error:n}=await this.getUser();if(n)throw n;return this._returnResult({data:{identities:(t=r.user.identities)!==null&&t!==void 0?t:[]},error:null})}catch(r){if(Ae(r))return this._returnResult({data:null,error:r});throw r}}async linkIdentity(t){return"token"in t?this.linkIdentityIdToken(t):this.linkIdentityOAuth(t)}async linkIdentityOAuth(t){var r;try{const{data:n,error:s}=await this._useSession(async i=>{var o,l,c,u,h;const{data:d,error:f}=i;if(f)throw f;const m=await this._getUrlForProvider(`${this.url}/user/identities/authorize`,t.provider,{redirectTo:(o=t.options)===null||o===void 0?void 0:o.redirectTo,scopes:(l=t.options)===null||l===void 0?void 0:l.scopes,queryParams:(c=t.options)===null||c===void 0?void 0:c.queryParams,skipBrowserRedirect:!0});return await Me(this.fetch,"GET",m,{headers:this.headers,jwt:(h=(u=d.session)===null||u===void 0?void 0:u.access_token)!==null&&h!==void 0?h:void 0})});if(s)throw s;return Pr()&&!(!((r=t.options)===null||r===void 0)&&r.skipBrowserRedirect)&&window.location.assign(n==null?void 0:n.url),this._returnResult({data:{provider:t.provider,url:n==null?void 0:n.url},error:null})}catch(n){if(Ae(n))return this._returnResult({data:{provider:t.provider,url:null},error:n});throw n}}async linkIdentityIdToken(t){return await this._useSession(async r=>{var n;try{const{error:s,data:{session:i}}=r;if(s)throw s;const{options:o,provider:l,token:c,access_token:u,nonce:h}=t,d=await Me(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,jwt:(n=i==null?void 0:i.access_token)!==null&&n!==void 0?n:void 0,body:{provider:l,id_token:c,access_token:u,nonce:h,link_identity:!0,gotrue_meta_security:{captcha_token:o==null?void 0:o.captchaToken}},xform:Da}),{data:f,error:m}=d;return m?this._returnResult({data:{user:null,session:null},error:m}):!f||!f.session||!f.user?this._returnResult({data:{user:null,session:null},error:new Uc}):(f.session&&(await this._saveSession(f.session),await this._notifyAllSubscribers("USER_UPDATED",f.session)),this._returnResult({data:f,error:m}))}catch(s){if(await Ar(this.storage,`${this.storageKey}-code-verifier`),Ae(s))return this._returnResult({data:{user:null,session:null},error:s});throw s}})}async unlinkIdentity(t){try{return await this._useSession(async r=>{var n,s;const{data:i,error:o}=r;if(o)throw o;
732return await Me(this.fetch,"DELETE",`${this.url}/user/identities/${t.identity_id}`,{headers:this.headers,jwt:(s=(n=i.session)===null||n===void 0?void 0:n.access_token)!==null&&s!==void 0?s:void 0})})}catch(r){if(Ae(r))return this._returnResult({data:null,error:r});throw r}}async _refreshAccessToken(t){const r=`#_refreshAccessToken(${t.substring(0,5)}...)`;this._debug(r,"begin");try{const n=Date.now();return await mte(async s=>(s>0&&await fte(200*Math.pow(2,s-1)),this._debug(r,"refreshing attempt",s),await Me(this.fetch,"POST",`${this.url}/token?grant_type=refresh_token`,{body:{refresh_token:t},headers:this.headers,xform:Da})),(s,i)=>{const o=200*Math.pow(2,s);return i&&Zw(i)&&Date.now()+o-n<cu})}catch(n){if(this._debug(r,"error",n),Ae(n))return this._returnResult({data:{session:null,user:null},error:n});throw n}finally{this._debug(r,"end")}}_isValidSession(t){return typeof t=="object"&&t!==null&&"access_token"in t&&"refresh_token"in t&&"expires_at"in t}async _handleProviderSignIn(t,r){const n=await this._getUrlForProvider(`${this.url}/authorize`,t,{redirectTo:r.redirectTo,scopes:r.scopes,queryParams:r.queryParams});return this._debug("#_handleProviderSignIn()","provider",t,"options",r,"url",n),Pr()&&!r.skipBrowserRedirect&&window.location.assign(n),{data:{provider:t,url:n},error:null}}async _recoverAndRefresh(){var t,r;const n="#_recoverAndRefresh()";this._debug(n,"begin");try{const s=await vl(this.storage,this.storageKey);if(s&&this.userStorage){let o=await vl(this.userStorage,this.storageKey+"-user");!this.storage.isServer&&Object.is(this.storage,this.userStorage)&&!o&&(o={user:s.user},await uu(this.userStorage,this.storageKey+"-user",o)),s.user=(t=o==null?void 0:o.user)!==null&&t!==void 0?t:e1()}else if(s&&!s.user&&!s.user){const o=await vl(this.storage,this.storageKey+"-user");o&&(o!=null&&o.user)?(s.user=o.user,await Ar(this.storage,this.storageKey+"-user"),await uu(this.storage,this.storageKey,s)):s.user=e1()}if(this._debug(n,"session from storage",s),!this._isValidSession(s)){this._debug(n,"session is not valid"),s!==null&&await this._removeSession();return}const i=((r=s.expires_at)!==null&&r!==void 0?r:1/0)*1e3-Date.now()<Qw;if(this._debug(n,`session has${i?"":" not"} expired with margin of ${Qw}
732s`),i){if(this.autoRefreshToken&&s.refresh_token){const{error:o}=await this._callRefreshToken(s.refresh_token);o&&(console.error(o),Zw(o)||(this._debug(n,"refresh failed with a non-retryable error, removing the session",o),await this._removeSession()))}}else if(s.user&&s.user.__isUserNotAvailableProxy===!0)try{const{data:o,error:l}=await this._getUser(s.access_token);!l&&(o!=null&&o.user)?(s.user=o.user,await this._saveSession(s),await this._notifyAllSubscribers("SIGNED_IN",s)):this._debug(n,"could not get user data, skipping SIGNED_IN notification")}catch(o){console.error("Error getting user data:",o),this._debug(n,"error getting user data, skipping SIGNED_IN notification",o)}else await this._notifyAllSubscribers("SIGNED_IN",s)}catch(s){this._debug(n,"error",s),console.error(s);return}finally{this._debug(n,"end")}}async _callRefreshToken(t){var r,n;if(!t)throw new In;if(this.refreshingDeferred)return this.refreshingDeferred.promise;const s=`#_callRefreshToken(${t.substring(0,5)}...)`;this._debug(s,"begin");try{this.refreshingDeferred=new U0;const{data:i,error:o}=await this._refreshAccessToken(t);if(o)throw o;if(!i.session)throw new In;await this._saveSession(i.session),await this._notifyAllSubscribers("TOKEN_REFRESHED",i.session);const l={data:i.session,error:null};return this.refreshingDeferred.resolve(l),l}catch(i){if(this._debug(s,"error",i),Ae(i)){const o={data:null,error:i};return Zw(i)||await this._removeSession(),(r=this.refreshingDeferred)===null||r===void 0||r.resolve(o),o}throw(n=this.refreshingDeferred)===null||n===void 0||n.reject(i),i}finally{this.refreshingDeferred=null,this._debug(s,"end")}}async _notifyAllSubscribers(t,r,n=!0){const s=`#_notifyAllSubscribers(${t})`;this._debug(s,"begin",r,`broadcast = ${n}`);try{this.broadcastChannel&&n&&this.broadcastChannel.postMessage({event:t,session:r});const i=[],o=Array.from(this.stateChangeEmitters.values()).map(async l=>{try{await l.callback(t,r)}catch(c){i.push(c)}});if(await Promise.all(o),i.length>0){for(let l=0;l<i.length;l+=1)console.error(i[l]);throw i[0]}}finally{this._debug(s,"end")}}async _saveSession(t){this._debug("#_saveSession()",t),this.suppressGetSessionWarning=!0,await Ar(this.storage,`${this.storageKey}-code-verifier`);const r=Object.assign({},t),n=r.user&&r.user.__isUserNotAvailableProxy===!0;if(this.userStorage){!n&&r.user&&await uu(this.userStorage,this.storageKey+"-user",{user:r.user});const s=Object.assign({},r);delete s.user;const i=fP(s);await uu(this.storage,this.storageKey,i)}else{const s=fP(r);await uu(this.storage,this.storageKey,s)}}async _removeSession(){this._debug("#_removeSession()"),this.suppressGetSessionWarning=!1,await Ar(this.storage,this.storageKey),await Ar(this.storage,this.storageKey+"-code-verifier"),await Ar(this.storage,this.storageKey+"-user"),this.userStorage&&await Ar(this.userStorage,this.storageKey+"-user"),await this._notifyAllSubscribers("SIGNED_OUT",null)}_removeVisibilityChangedCallback(){this._debug("#_removeVisibilityChangedCallback()");const t=this.visibilityChangedCallback;this.visibilityChangedCallback=null;try{t&&Pr()&&(window!=null&&window.removeEventListener)&&window.removeEventListener("visibilitychange",t)}catch(r){console.error("removing visibilitychange callback failed",r)}}async _startAutoRefresh(){await this._stopAutoRefresh(),this._debug("#_startAutoRefresh()");const t=setInterval(()=>this._autoRefreshTokenTick(),cu);this.autoRefreshTicker=t,t&&typeof t=="object"&&typeof t.unref=="function"?t.unref():typeof Deno<"u"&&typeof Deno.unrefTimer=="function"&&Deno.unrefTimer(t);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 t=this.autoRefreshTicker;this.autoRefreshTicker=null,t&&clearInterval(t);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 t=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 s=Math.floor((n.expires_at*1e3-t)/cu);this._debug("#_autoRefreshTokenTick()",`access token expires in ${s} ticks, a tick lasts ${cu}
732ms, refresh threshold is ${z_} ticks`),s<=z_&&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(t){if(t.isAcquireTimeout||t instanceof JL)this._debug("auto refresh token tick lock not available");else throw t}}async _handleVisibilityChange(){if(this._debug("#_handleVisibilityChange()"),!Pr()||!(window!=null&&window.addEventListener))return this.autoRefreshToken&&this.startAutoRefresh(),!1;try{this.visibilityChangedCallback=async()=>{try{await this._onVisibilityChanged(!1)}catch(t){this._debug("#visibilityChangedCallback","error",t)}},window==null||window.addEventListener("visibilitychange",this.visibilityChangedCallback),await this._onVisibilityChanged(!0)}catch(t){console.error("_handleVisibilityChange",t)}}async _onVisibilityChanged(t){const r=`#_onVisibilityChanged(${t})`;this._debug(r,"visibilityState",document.visibilityState),document.visibilityState==="visible"?(this.autoRefreshToken&&this._startAutoRefresh(),t||(await 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(t,r,n){const s=[`provider=${encodeURIComponent(r)}`];if(n!=null&&n.redirectTo&&s.push(`redirect_to=${encodeURIComponent(n.redirectTo)}`),n!=null&&n.scopes&&s.push(`scopes=${encodeURIComponent(n.scopes)}`),this.flowType==="pkce"){const[i,o]=await Wc(this.storage,this.storageKey),l=new URLSearchParams({code_challenge:`${encodeURIComponent(i)}`,code_challenge_method:`${encodeURIComponent(o)}`});s.push(l.toString())}if(n!=null&&n.queryParams){const i=new URLSearchParams(n.queryParams);s.push(i.toString())}return n!=null&&n.skipBrowserRedirect&&s.push(`skip_http_redirect=${n.skipBrowserRedirect}`),`${t}?${s.join("&")}`}async _unenroll(t){try{return await this._useSession(async r=>{var n;const{data:s,error:i}=r;return i?this._returnResult({data:null,error:i}):await Me(this.fetch,"DELETE",`${this.url}/factors/${t.factorId}`,{headers:this.headers,jwt:(n=s==null?void 0:s.session)===null||n===void 0?void 0:n.access_token})})}catch(r){if(Ae(r))return this._returnResult({data:null,error:r});throw r}}async _enroll(t){try{return await this._useSession(async r=>{var n,s;const{data:i,error:o}=r;if(o)return this._returnResult({data:null,error:o});const l=Object.assign({friendly_name:t.friendlyName,factor_type:t.factorType},t.factorType==="phone"?{phone:t.phone}:t.factorType==="totp"?{issuer:t.issuer}:{}),{data:c,error:u}=await Me(this.fetch,"POST",`${this.url}/factors`,{body:l,headers:this.headers,jwt:(n=i==null?void 0:i.session)===null||n===void 0?void 0:n.access_token});return u?this._returnResult({data:null,error:u}):(t.factorType==="totp"&&c.type==="totp"&&(!((s=c==null?void 0:c.totp)===null||s===void 0)&&s.qr_code)&&(c.totp.qr_code=`data:image/svg+xml;utf-8,${c.totp.qr_code}`),this._returnResult({data:c,error:null}))})}catch(r){if(Ae(r))return this._returnResult({data:null,error:r});throw r}}async _verify(t){return this._acquireLock(this.lockAcquireTimeout,async()=>{try{return await this._useSession(async r=>{var n;const{data:s,error:i}=r;if(i)return this._returnResult({data:null,error:i});const o=Object.assign({challenge_id:t.challengeId},"webauthn"in t?{webauthn:Object.assign(Object.assign({},t.webauthn),{credential_response:t.webauthn.type==="create"?Wte(t.webauthn.credential_response):Vte(t.webauthn.credential_response)})}:{code:t.code}),{data:l,error:c}=await Me(this.fetch,"POST",`${this.url}/factors/${t.factorId}/verify`,{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}):(await this._saveSession(Object.assign({expires_at:Math.round(Date.now()/1e3)+l.expires_in},l)),await this._notifyAllSubscribers("MFA_CHALLENGE_VERIFIED",l),this._returnResult({data:l,error:c}))})}catch(r){if(Ae(r))return this._returnResult({data:null,error:r});throw r}})}async _challenge(t){return this._acquireLock(this.lockAcquireTimeout,async()=>{try{return await this._useSession(async r=>{var n;const{data:s,error:i}=r;if(i)return this._returnResult({data:null,error:i});const o=await Me(this.fetch,"POST",`${this.url}/factors/${t.factorId}/challenge`,{body:t,headers:this.headers,jwt:(n=s==null?void 0:s.session)===null||n===void 0?void 0:n.access_token});if(o.error)return o;const{data:l}=o;if(l.type!=="webauthn")return{data:l,error:null};switch(l.webauthn.type){case"create":return{data:Object.assign(Object.assign({},l),{webauthn:Object.assign(Object.assign({},l.webauthn),{credential_options:Object.assign(Object.assign({},l.webauthn.credential_options),{publicKey:Bte(l.webauthn.credential_options.publicKey)})})}),error:null};case"request":return{data:Object.assign(Object.assign({},l),{webauthn:Object.assign(Object.assign({},l.webauthn),{credential_options:Object.assign(Object.assign({},l.webauthn.credential_options),{publicKey:Ute(l.webauthn.credential_options.publicKey)})})}),error:null}}})}catch(r){if(Ae(r))return this._returnResult({data:null,error:r});throw r}})}async _challengeAndVerify(t){const{data:r,error:n}=await this._challenge({factorId:t.factorId});return n?this._returnResult({data:null,error:n}):await this._verify({factorId:t.factorId,challengeId:r.id,code:t.code})}async _listFactors(){var t;const{data:{user:r},error:n}=await this.getUser();if(n)return{data:null,error:n};const s={all:[],phone:[],totp:[],webauthn:[]};for(const i of(t=r==null?void 0:r.factors)!==null&&t!==void 0?t:[])s.all.push(i),i.status==="verified"&&s[i.factor_type].push(i);return{data:s,error:null}}async _getAuthenticatorAssuranceLevel(t){var r,n,s,i;if(t)try{const{payload:m}=Pg(t);let g=null;m.aal&&(g=m.aal);let p=g;const{data:{user:v},error:x}=await this.getUser(t);if(x)return this._returnResult({data:null,error:x});((n=(r=v==null?void 0:v.factors)===null||r===void 0?void 0:r.filter(j=>j.status==="verified"))!==null&&n!==void 0?n:[]).length>0&&(p="aal2");const w=m.amr||[];return{data:{currentLevel:g,nextLevel:p,currentAuthenticationMethods:w},error:null}}catch(m){if(Ae(m))return this._returnResult({data:null,error:m});throw m}const{data:{session:o},error:l}
732=await this.getSession();if(l)return this._returnResult({data:null,error:l});if(!o)return{data:{currentLevel:null,nextLevel:null,currentAuthenticationMethods:[]},error:null};const{payload:c}=Pg(o.access_token);let u=null;c.aal&&(u=c.aal);let h=u;((i=(s=o.user.factors)===null||s===void 0?void 0:s.filter(m=>m.status==="verified"))!==null&&i!==void 0?i:[]).length>0&&(h="aal2");const f=c.amr||[];return{data:{currentLevel:u,nextLevel:h,currentAuthenticationMethods:f},error:null}}async _getAuthorizationDetails(t){try{return await this._useSession(async r=>{const{data:{session:n},error:s}=r;return s?this._returnResult({data:null,error:s}):n?await Me(this.fetch,"GET",`${this.url}/oauth/authorizations/${t}`,{headers:this.headers,jwt:n.access_token,xform:i=>({data:i,error:null})}):this._returnResult({data:null,error:new In})})}catch(r){if(Ae(r))return this._returnResult({data:null,error:r});throw r}}async _approveAuthorization(t,r){try{return await this._useSession(async n=>{const{data:{session:s},error:i}=n;if(i)return this._returnResult({data:null,error:i});if(!s)return this._returnResult({data:null,error:new In});const o=await Me(this.fetch,"POST",`${this.url}/oauth/authorizations/${t}/consent`,{headers:this.headers,jwt:s.access_token,body:{action:"approve"},xform:l=>({data:l,error:null})});return o.data&&o.data.redirect_url&&Pr()&&!(r!=null&&r.skipBrowserRedirect)&&window.location.assign(o.data.redirect_url),o})}catch(n){if(Ae(n))return this._returnResult({data:null,error:n});throw n}}async _denyAuthorization(t,r){try{return await this._useSession(async n=>{const{data:{session:s},error:i}=n;if(i)return this._returnResult({data:null,error:i});if(!s)return this._returnResult({data:null,error:new In});const o=await Me(this.fetch,"POST",`${this.url}/oauth/authorizations/${t}/consent`,{headers:this.headers,jwt:s.access_token,body:{action:"deny"},xform:l=>({data:l,error:null})});return o.data&&o.data.redirect_url&&Pr()&&!(r!=null&&r.skipBrowserRedirect)&&window.location.assign(o.data.redirect_url),o})}catch(n){if(Ae(n))return this._returnResult({data:null,error:n});throw n}}async _listOAuthGrants(){try{return await this._useSession(async t=>{const{data:{session:r},error:n}=t;return n?this._returnResult({data:null,error:n}):r?await Me(this.fetch,"GET",`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:r.access_token,xform:s=>({data:s,error:null})}):this._returnResult({data:null,error:new In})})}catch(t){if(Ae(t))return this._returnResult({data:null,error:t});throw t}}async _revokeOAuthGrant(t){try{return await this._useSession(async r=>{const{data:{session:n},error:s}=r;return s?this._returnResult({data:null,error:s}):n?(await Me(this.fetch,"DELETE",`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:n.access_token,query:{client_id:t.clientId},noResolveJson:!0}),{data:{},error:null}):this._returnResult({data:null,error:new In})})}catch(r){if(Ae(r))return this._returnResult({data:null,error:r});throw r}}async fetchJwk(t,r={keys:[]}){let n=r.keys.find(l=>l.kid===t);if(n)return n;const s=Date.now();if(n=this.jwks.keys.find(l=>l.kid===t),n&&this.jwks_cached_at+Zee>s)return n;const{data:i,error:o}=await Me(this.fetch,"GET",`${this.url}/.well-known/jwks.json`,{headers:this.headers});if(o)throw o;return!i.keys||i.keys.length===0||(this.jwks=i,this.jwks_cached_at=s,n=i.keys.find(l=>l.kid===t),!n)?null:n}async getClaims(t,r={}){try{let n=t;if(!n){const{data:m,error:g}
732=await this.getSession();if(g||!m.session)return this._returnResult({data:null,error:g});n=m.session.access_token}const{header:s,payload:i,signature:o,raw:{header:l,payload:c}}=Pg(n);r!=null&&r.allowExpired||wte(i.exp);const u=!s.alg||s.alg.startsWith("HS")||!s.kid||!("crypto"in globalThis&&"subtle"in globalThis.crypto)?null:await this.fetchJwk(s.kid,r!=null&&r.keys?{keys:r.keys}:r==null?void 0:r.jwks);if(!u){const{error:m}=await this.getUser(n);if(m)throw m;return{data:{claims:i,header:s,signature:o},error:null}}const h=jte(s.alg),d=await crypto.subtle.importKey("jwk",u,h,!0,["verify"]);if(!await crypto.subtle.verify(h,d,o,lte(`${l}.${c}`)))throw new W_("Invalid JWT signature");return{data:{claims:i,header:s,signature:o},error:null}}catch(n){if(Ae(n))return this._returnResult({data:null,error:n});throw n}}}vm.nextInstanceID={};const Zte=vm,ere="2.100.0";let cf="";typeof Deno<"u"?cf="deno":typeof document<"u"?cf="web":typeof navigator<"u"&&navigator.product==="ReactNative"?cf="react-native":cf="node";const tre={"X-Client-Info":`supabase-js-${cf}/${ere}`},rre={headers:tre},nre={schema:"public"},are={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"},sre={};function xm(e){"@babel/helpers - typeof";return xm=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},xm(e)}function ire(e,t){if(xm(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(xm(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function ore(e){var t=ire(e,"string");return xm(t)=="symbol"?t:t+""}function lre(e,t,r){return(t=ore(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function wP(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function qt(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?wP(Object(r),!0).forEach(function(n){lre(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):wP(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}const cre=e=>e?(...t)=>e(...t):(...t)=>fetch(...t),ure=()=>Headers,dre=(e,t,r)=>{const n=cre(r),s=ure();return async(i,o)=>{var l;const c=(l=await t())!==null&&l!==void 0?l:e;let u=new s(o==null?void 0:o.headers);return u.has("apikey")||u.set("apikey",e),u.has("Authorization")||u.set("Authorization",`Bearer ${c}`),n(i,qt(qt({},o),{},{headers:u}))}};function hre(e){return e.endsWith("/")?e:e+"/"}function fre(e,t){var r,n;const{db:s,auth:i,realtime:o,global:l}=e,{db:c,auth:u,realtime:h,global:d}=t,f={db:qt(qt({},c),s),auth:qt(qt({},u),i),realtime:qt(qt({},h),o),storage:{},global:qt(qt(qt({},d),l),{},{headers:qt(qt({},(r=d==null?void 0:d.headers)!==null&&r!==void 0?r:{}),(n=l==null?void 0:l.headers)!==null&&n!==void 0?n:{})}),accessToken:async()=>""};return e.accessToken?f.accessToken=e.accessToken:delete f.accessToken,f}function mre(e){const t=e==null?void 0:e.trim();if(!t)throw new Error("supabaseUrl is required.");if(!t.match(/^https?:\/\//i))throw new Error("Invalid supabaseUrl: Must be a valid HTTP or HTTPS URL.");try{return new URL(hre(t))}catch{throw Error("Invalid supabaseUrl: Provided URL is malformed.")}}var pre=class extends Zte{constructor(e){super(e)}},gre=class{constructor(e,t,r){var n,s;this.supabaseUrl=e,this.supabaseKey=t;const i=mre(e);if(!t)throw new Error("supabaseKey is required.");this.realtimeUrl=new URL("realtime/v1",i),this.realtimeUrl.protocol=this.realtimeUrl.protocol.replace("http","ws"),this.authUrl=new URL("auth/v1",i),this.storageUrl=new URL("storage/v1",i),this.functionsUrl=new URL("functions/v1",i);const o=`sb-${i.hostname.split(".")[0]}-auth-token`,l={db:nre,realtime:sre,auth:qt(qt({},are),{},{storageKey:o}),global:rre},c=fre(r??{},l);if(this.storageKey=(n=c.auth.storageKey)!==null&&n!==void 0?n:"",this.headers=(s=c.global.headers)!==null&&s!==void 0?s:{},c.accessToken)this.accessToken=c.accessToken,this.auth=new Proxy({},{get:(h,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 u;this.auth=this._initSupabaseAuthClient((u=c.auth)!==null&&u!==void 0?u:{},this.headers,c.global.fetch)}this.fetch=dre(t,this._getAccessToken.bind(this),c.global.fetch),this.realtime=this._initRealtimeClient(qt({headers:this.headers,accessToken:this._getAccessToken.bind(this)},c.realtime)),this.accessToken&&Promise.resolve(this.accessToken()).then(h=>this.realtime.setAuth(h)).catch(h=>console.warn("Failed to set initial Realtime auth token:",h)),this.rest=new LZ(new URL("rest/v1",i).href,{headers:this.headers,schema:c.db.schema,fetch:this.fetch,timeout:c.db.timeout,urlLengthLimit:c.db.urlLengthLimit}),this.storage=new Kee(this.storageUrl.href,this.headers,this.fetch,r==null?void 0:r.storage),c.accessToken||this._listenForAuthEvents()}get functions(){return new AZ(this.functionsUrl.href,{headers:this.headers,customFetch:this.fetch})}from(e){return this.rest.from(e)}schema(e){return this.rest.schema(e)}rpc(e,t={},r={head:!1,get:!1,count:void 0}){return this.rest.rpc(e,t,r)}
732channel(e,t={config:{}}){return this.realtime.channel(e,t)}getChannels(){return this.realtime.getChannels()}removeChannel(e){return this.realtime.removeChannel(e)}removeAllChannels(){return this.realtime.removeAllChannels()}async _getAccessToken(){var e=this,t,r;if(e.accessToken)return await e.accessToken();const{data:n}=await e.auth.getSession();return(t=(r=n.session)===null||r===void 0?void 0:r.access_token)!==null&&t!==void 0?t:e.supabaseKey}_initSupabaseAuthClient({autoRefreshToken:e,persistSession:t,detectSessionInUrl:r,storage:n,userStorage:s,storageKey:i,flowType:o,lock:l,debug:c,throwOnError:u},h,d){const f={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new pre({url:this.authUrl.href,headers:qt(qt({},f),h),storageKey:i,autoRefreshToken:e,persistSession:t,detectSessionInUrl:r,storage:n,userStorage:s,flowType:o,lock:l,debug:c,throwOnError:u,fetch:d,hasCustomAuthorizationHeader:Object.keys(this.headers).some(m=>m.toLowerCase()==="authorization")})}_initRealtimeClient(e){return new vee(this.realtimeUrl.href,qt(qt({},e),{},{params:qt(qt({},{apikey:this.supabaseKey}),e==null?void 0:e.params)}))}_listenForAuthEvents(){return this.auth.onAuthStateChange((e,t)=>{this._handleTokenChanged(e,"CLIENT",t==null?void 0:t.access_token)})}_handleTokenChanged(e,t,r){(e==="TOKEN_REFRESHED"||e==="SIGNED_IN")&&this.changedAccessToken!==r?(this.changedAccessToken=r,this.realtime.setAuth(r)):e==="SIGNED_OUT"&&(this.realtime.setAuth(),t=="STORAGE"&&this.auth.signOut(),this.changedAccessToken=void 0)}};const yre=(e,t,r)=>new gre(e,t,r);function vre(){if(typeof window<"u")return!1;const e=globalThis.process;if(!e)return!1;const t=e.version;if(t==null)return!1;const r=t.match(/^v(\d+)\./);return r?parseInt(r[1],10)<=18:!1}vre()&&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 Node.js 20 or later. For more information, visit: https://github.com/orgs/supabase/discussions/37217");const N2="https://eqqzrkrvaonjhjfhdxxk.supabase.co",k2="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6ImVxcXpya3J2YW9uamhqZmhkeHhrIiwicm9sZSI6ImFub24iLCJpYXQiOjE3NjU0ODU1NzgsImV4cCI6MjA4MTA2MTU3OH0.F9pFJK4K4vhQhJ1s2Gt7Ro92VTwIj_MaDbQ3AeBY-HM";let uf=!0,Mp=!0;const ne=yre(N2,k2,{auth:{autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0},realtime:{params:{eventsPerSecond:2}},global:{fetch:(e,t)=>fetch(e,t).catch(r=>{throw console.warn("[Supabase] Fetch error:",r.message),r})}}),xre=console.error;console.error=(...e)=>{var r,n,s;const t=((n=(r=e[0])==null?void 0:r.toString)==null?void 0:n.call(r))||"";if(t.includes("WebSocket")||t.includes("realtime")||t.includes("wss://")||typeof e[0]=="object"&&((s=e[0])==null?void 0:s.type)==="error"){console.warn("[Supabase Realtime] Connection issue (suppressed):",t.substring(0,100));return}xre.apply(console,e)};const tr=N2,C2=k2,st=e=>{if(!e)return!1;const t=(e.message||e.toString()).toLowerCase();return t.includes("failed to fetch")||t.includes("network")||t.includes("cors")||t.includes("connection")||t.includes("timeout")||t.includes("abort")||t.includes("websocket")||e.name==="TypeError"||e.code==="NETWORK_ERROR"},bre=e=>{if(!Mp)return console.warn("[Supabase] Realtime disabled, skipping channel:",e),null;try{return ne.channel(e)}catch(t){return console.warn("[Supabase] Error creating channel:",e,t),null}},wre=e=>{if(!e)return null;try{return e.subscribe((t,r)=>{t==="SUBSCRIBED"?console.log("[Supabase] Channel subscribed successfully"):(t==="CHANNEL_ERROR"||t==="TIMED_OUT")&&(console.warn("[Supabase] Channel subscription failed:",t,r==null?void 0:r.message),Mp=!1)}),e}catch(t){return console.warn("[Supabase] Error subscribing to channel:",t),null}},Lv=()=>{Mp=!1;try{ne.removeAllChannels()}catch{}console.log("[Supabase] Realtime disabled")},jre=()=>{Mp=!0,console.log("[Supabase] Realtime enabled")},Di=()=>Mp,_re={auth:{getUser:async()=>{try{return await ne.auth.getUser()}catch(e){if(st(e))return console.warn("[Supabase] Network error during getUser, returning null user"),{data:{user:null},error:null};throw e}},getSession:async()=>{try{return await ne.auth.getSession()}catch(e){if(st(e))return console.warn("[Supabase] Network error during getSession, returning null session"),{data:{session:null},error:null};throw e}},signInWithPassword:async e=>{try{return await ne.auth.signInWithPassword(e)}catch(t){if(st(t))return{data:{user:null,session:null},error:{message:"Unable to connect to the server. Please check your internet connection.",name:"NetworkError",status:0}};throw t}},signUp:async e=>{try{return await ne.auth.signUp(e)}catch(t){if(st(t))return{data:{user:null,session:null},error:{message:"Unable to connect to the server. Please check your internet connection.",name:"NetworkError",status:0}};throw t}},signOut:async()=>{try{return await ne.auth.signOut()}catch(e){if(st(e))return console.warn("[Supabase] Network error during signOut, clearing local session"),{error:null};throw e}}}},W0=async()=>{try{const e=new AbortController,t=setTimeout(()=>e.abort(),5e3),r=await fetch(`${N2}/rest/v1/`,{method:"HEAD",headers:{apikey:k2},signal:e.signal});return clearTimeout(t),uf=r.ok,uf||Lv(),uf}catch{return uf=!1,Lv(),!1}},$r=()=>uf;W0().then(e=>{e||console.warn("[Supabase] Server unavailable, running in offline mode")});const Sre=Object.freeze(Object.defineProperty({__proto__:null,SUPABASE_ANON_KEY:C2,SUPABASE_URL:tr,checkSupabaseConnection:W0,disableRealtime:Lv,enableRealtime:jre,isNetworkError:st,isRealtimeEnabled:Di,isSupabaseOnline:$r,safeChannel:bre,safeSubscribe:wre,safeSupabase:_re,supabase:ne},Symbol.toStringTag,{value:"Module"})),t6="local_auth_users",qc="local_auth_session",jP={id:"demo_user_001",email:"[email protected]",user_metadata:{full_name:"Demo User"},isDemo:!0}
732,_P=()=>{const e=localStorage.getItem(t6);return e?JSON.parse(e):{}},Nre=e=>{localStorage.setItem(t6,JSON.stringify(e))},Gc={signUp:async(e,t,r)=>{const n=_P();if(n[e])return{user:null,error:new Error("User already exists")};const s={id:`user_${Date.now()}`,email:e,user_metadata:{full_name:r}};return n[e]={email:e,password:t,id:s.id,full_name:r},Nre(n),localStorage.setItem(qc,JSON.stringify(s)),{user:s,error:null}},signIn:async(e,t)=>{const n=_P()[e];if(!n||n.password!==t)return{user:null,error:new Error("Invalid email or password")};const s={id:n.id,email:n.email,user_metadata:{full_name:n.full_name}};return localStorage.setItem(qc,JSON.stringify(s)),{user:s,error:null}},startDemoMode:async()=>(localStorage.setItem(qc,JSON.stringify(jP)),{user:jP,error:null}),isDemoUser:()=>{const e=localStorage.getItem(qc);if(!e)return!1;const t=JSON.parse(e);return(t==null?void 0:t.isDemo)===!0},signOut:async()=>(localStorage.removeItem(qc),{error:null}),getSession:async()=>{const e=localStorage.getItem(qc);return{user:e?JSON.parse(e):null}}},r6=y.createContext(void 0),kre=({children:e})=>{const[t,r]=y.useState(null),[n,s]=y.useState(null),[i,o]=y.useState(!0),[l,c]=y.useState(!1),[u,h]=y.useState(!1),[d,f]=y.useState(!1),m=y.useCallback(async()=>{try{const{user:P}=await Gc.getSession();if(P)return r(P),h(Gc.isDemoUser()),!0}catch(P){console.warn("Error checking local session:",P)}return!1},[]),g=y.useCallback(async()=>{const P=await W0();if(P){f(!1),c(!1);try{const{data:{session:C}}=await ne.auth.getSession();C&&(s(C),r(C.user))}catch(C){console.warn("Failed to get session after reconnection:",C)}}return P},[]);y.useEffect(()=>{let P=!0,C=null;return(async()=>{try{const I=ne.auth.getSession(),E=new Promise((A,L)=>setTimeout(()=>L(new Error("Connection timeout")),8e3)),{data:{session:B}}=await Promise.race([I,E]);if(!P)return;if(B)s(B),r(B.user),o(!1);else{const A=await m();if(!P)return;o(!1)}}catch(I){if(!P)return;console.warn("Supabase unavailable, using local authentication:",(I==null?void 0:I.message)||I),c(!0),f(!0),Lv(),await m(),o(!1)}try{const{data:I}=ne.auth.onAuthStateChange((E,B)=>{P&&(l||(s(B),r((B==null?void 0:B.user)??null),B&&f(!1)),i&&o(!1))});C=I.subscription}catch(I){console.warn("Failed to set up auth state listener:",I)}})(),()=>{P=!1,C==null||C.unsubscribe()}},[m]);const p=async()=>{try{const{user:P}=await Gc.startDemoMode();P&&(r(P),h(!0),c(!0))}catch(P){throw console.error("Failed to start demo mode:",P),P}},v=async(P,C,M)=>{if(l)try{const{user:I,error:E}=await Gc.signUp(P,C,M);return!E&&I&&(r(I),h(!1)),{error:E,isNetworkError:!1}}catch(I){return{error:new Error((I==null?void 0:I.message)||"Failed to sign up"),isNetworkError:!1}}try{const{data:I,error:E}=await ne.auth.signUp({email:P,password:C,options:{data:{full_name:M},emailRedirectTo:`${window.location.origin}/`}});return E?st(E)?(console.log("Network error during signup, offering local auth option"),f(!0),{error:new Error("Unable to connect to the server. You can try again, use Demo Mode, or create a local account."),isNetworkError:!0}):{error:E,isNetworkError:!1}:{error:null,isNetworkError:!1}}catch(I){return console.error("SignUp exception:",I),st(I)?(f(!0),{error:new Error("Unable to connect to the server. You can try again, use Demo Mode, or create a local account."),isNetworkError:!0}):{error:new Error((I==null?void 0:I.message)||"An unexpected error occurred. Please try again."),isNetworkError:!1}}},x=async(P,C)=>{if(l)try{const{user:M,error:I}=await Gc.signIn(P,C);return!I&&M&&(r(M),h(!1)),{error:I,isNetworkError:!1}}catch(M){return{error:new Error((M==null?void 0:M.message)||"Failed to sign in"),isNetworkError:!1}}try{const{error:M}=await ne.auth.signInWithPassword({email:P,password:C});return M?st(M)?(console.log("Network error during login, offering alternatives"),f(!0),{error:new Error("Unable to connect to the server. Please check your internet connection, try Demo Mode, or sign in with a local account."),isNetworkError:!0}):{error:M,isNetworkError:!1}:{error:null,isNetworkError:!1}}catch(M){return console.error("SignIn exception:",M),st(M)?(f(!0),{error:new Error("Unable to connect to the server. Please check your internet connection, try Demo Mode, or sign in with a local account."),isNetworkError:!0}):{error:new Error((M==null?void 0:M.message)||"An unexpected error occurred. Please try again."),isNetworkError:!1}}},b=async()=>
732{if(l||u){await Gc.signOut(),r(null),s(null),h(!1);return}try{await ne.auth.signOut()}catch(P){console.warn("SignOut error (clearing local state anyway):",P)}r(null),s(null)},w=async P=>{try{const{error:C}=await ne.auth.resetPasswordForEmail(P,{redirectTo:`${window.location.origin}/reset-password`});return{error:C}}catch(C){return st(C)?{error:{message:"Unable to connect to the server. Please try again later."}}:{error:{message:(C==null?void 0:C.message)||"Failed to send reset email"}}}},j=async P=>{if(u)return{error:new Error("Demo users cannot update profile. Please sign up for a free account.")};try{const{error:C}=await ne.auth.updateUser({data:P});return!C&&t&&await ne.from("profiles").upsert({id:t.id,...P,updated_at:new Date().toISOString()}).catch(()=>{}),{error:C}}catch(C){return{error:new Error((C==null?void 0:C.message)||"Failed to update profile")}}},_=async()=>{try{const{error:P}=await ne.auth.signInWithOAuth({provider:"google",options:{redirectTo:`${window.location.origin}/`}});if(P)throw P}catch(P){throw console.error("Google OAuth error:",P),st(P)?(f(!0),new Error("Unable to connect. Please check your internet connection.")):P}},S=async()=>{try{const{error:P}=await ne.auth.signInWithOAuth({provider:"github",options:{redirectTo:`${window.location.origin}/`}});if(P)throw P}catch(P){throw console.error("GitHub OAuth error:",P),st(P)?(f(!0),new Error("Unable to connect. Please check your internet connection.")):P}},k=async P=>{try{const{error:C}=await ne.auth.resend({type:"signup",email:P,options:{emailRedirectTo:`${window.location.origin}/`}});return{error:C}}catch(C){return st(C)?{error:{message:"Unable to connect to the server. Please try again later."}}:{error:{message:(C==null?void 0:C.message)||"Failed to resend email"}}}};return a.jsx(r6.Provider,{value:{user:t,session:n,loading:i,isDemo:u,isOfflineMode:d,signUp:v,signIn:x,signOut:b,resetPassword:w,updateProfile:j,signInWithGoogle:_,signInWithGithub:S,resendVerificationEmail:k,startDemoMode:p,retryConnection:g},children:e})},Jt=()=>{const e=y.useContext(r6);if(!e)throw new Error("useAuth must be used within AuthProvider");return e},Cre="MalayalamApp",Ere=3;class Tre{constructor(){qE(this,"db",null)}
732async init(){return new Promise((t,r)=>{const n=indexedDB.open(Cre,Ere);n.onerror=()=>r(n.error),n.onsuccess=()=>{this.db=n.result,t()},n.onupgradeneeded=s=>{const i=s.target.result;if(i.objectStoreNames.contains("lessons")||i.createObjectStore("lessons",{keyPath:"id"}),!i.objectStoreNames.contains("audio")){const o=i.createObjectStore("audio",{keyPath:"id"});o.createIndex("lessonId","lessonId",{unique:!1}),o.createIndex("quality","quality",{unique:!1})}if(i.objectStoreNames.contains("flashcards")||i.createObjectStore("flashcards",{keyPath:"id"}),!i.objectStoreNames.contains("quizResults")){const o=i.createObjectStore("quizResults",{keyPath:"id"});o.createIndex("synced","synced",{unique:!1}),o.createIndex("userId","userId",{unique:!1})}i.objectStoreNames.contains("progress")||i.createObjectStore("progress",{keyPath:"id"}).createIndex("synced","synced",{unique:!1}),i.objectStoreNames.contains("pendingSync")||i.createObjectStore("pendingSync",{keyPath:"id",autoIncrement:!0})}})}async addLesson(t){await this.db.transaction("lessons","readwrite").objectStore("lessons").put(t)}async getLessons(){const t=this.db.transaction("lessons","readonly");return new Promise((r,n)=>{const s=t.objectStore("lessons").getAll();s.onsuccess=()=>r(s.result),s.onerror=()=>n(s.error)})}async getLessonById(t){const r=this.db.transaction("lessons","readonly");return new Promise((n,s)=>{const i=r.objectStore("lessons").get(t);i.onsuccess=()=>n(i.result),i.onerror=()=>s(i.error)})}async getLessonsByType(t){return(await this.getLessons()).filter(n=>n.type===t)}async deleteLesson(t){await this.db.transaction("lessons","readwrite").objectStore("lessons").delete(t)}async deleteLessonsByType(t){const r=await this.getLessonsByType(t),s=this.db.transaction("lessons","readwrite").objectStore("lessons");for(const i of r)await s.delete(i.id)}async addAudio(t){await this.db.transaction("audio","readwrite").objectStore("audio").put(t)}async getAudioByLessonId(t){const n=this.db.transaction("audio","readonly").objectStore("audio").index("lessonId");return new Promise((s,i)=>{const o=n.getAll(t);o.onsuccess=()=>s(o.result),o.onerror=()=>i(o.error)})}async getAudioById(t){const r=this.db.transaction("audio","readonly");return new Promise((n,s)=>{const i=r.objectStore("audio").get(t);i.onsuccess=()=>n(i.result),i.onerror=()=>s(i.error)})}async deleteAudio(t){await this.db.transaction("audio","readwrite").objectStore("audio").delete(t)}async deleteAudioByLessonId(t){const r=await this.getAudioByLessonId(t),s=this.db.transaction("audio","readwrite").objectStore("audio");for(const i of r)await s.delete(i.id)}async getTotalAudioSize(){const t=this.db.transaction("audio","readonly");return new Promise((r,n)=>{const s=t.objectStore("audio").getAll();s.onsuccess=()=>{const i=s.result.reduce((o,l)=>o+l.size,0);r(i)},s.onerror=()=>n(s.error)})}async addFlashcard(t){await this.db.transaction("flashcards","readwrite").objectStore("flashcards").put(t)}async getFlashcards(){const t=this.db.transaction("flashcards","readonly");return new Promise((r,n)=>{const s=t.objectStore("flashcards").getAll();s.onsuccess=()=>r(s.result),s.onerror=()=>n(s.error)})}async saveProgress(t){await this.db.transaction("progress","readwrite").objectStore("progress").put(t)}async getUnsyncedProgress(){const r=this.db.transaction("progress","readonly").objectStore("progress").index("synced");return new Promise((n,s)=>{const i=r.getAll(!1);i.onsuccess=()=>n(i.result),i.onerror=()=>s(i.error)})}async markProgressSynced(t){const n=this.db.transaction("progress","readwrite").objectStore("progress"),s=await new Promise((i,o)=>{const l=n.get(t);l.onsuccess=()=>i(l.result),l.onerror=()=>o(l.error)});s&&(s.synced=!0,await n.put(s))}async saveQuizResult(t){await this.db.transaction("quizResults","readwrite").objectStore("quizResults").put(t)}async getUnsyncedQuizResults(){const r=this.db.transaction("quizResults","readonly").objectStore("quizResults").index("synced");return new Promise((n,s)=>{const i=r.getAll(!1);i.onsuccess=()=>n(i.result),i.onerror=()=>s(i.error)})}async markQuizResultSynced(t){const n=this.db.transaction("quizResults","readwrite").objectStore("quizResults"),s=await new Promise((i,o)=>{const l=n.get(t);l.onsuccess=()=>i(l.result),l.onerror=()=>o(l.error)});s&&(s.synced=!0,await n.put(s))}async clearAll(){const t=["lessons","audio","flashcards","progress","pendingSync","quizResults"];for(const r of t)await this.db.transaction(r,"readwrite").objectStore(r).clear()}}const xn=new Tre,n6=async(e,t)=>{try{await ne.from("practice_sessions").insert({user_id:t,session_type:e.category,score:e.score,total_questions:e.totalQuestions,duration_seconds:e.duration});for(const r of e.results){const n=r.correctAnswer,{data:s}=await ne.from("user_progress").select("*").eq("user_id",t).eq("letter",n).eq("letter_type",e.category).single();s?await ne.from("user_progress").update({correct_count:s.correct_count+(r.correct?1:0),incorrect_count:s.incorrect_count+(r.correct?0:1),last_practiced:new Date().toISOString(),updated_at:new Date().toISOString()}).eq("id",s.id):await ne.from("user_progress").insert({user_id:t,letter:n,letter_type:e.category,correct_count:r.correct?1:0,incorrect_count:r.correct?0:1,last_practiced:new Date().toISOString()})}}catch(r){console.error("Error syncing progress:",r)}},Are=async e=>{try{const{data:t}=await ne.from("user_progress").select("*").eq("user_id",e),{data:r}=await ne.from("practice_sessions").select("*").eq("user_id",e).order("created_at",{ascending:!1}).limit(100);return{progress:t,sessions:r}}catch(t){return console.error("Error loading progress:",t),{progress:[],sessions:[]}}},a6=y.createContext(void 0);function Pre({children:e}){const[t,r]=y.useState(navigator.onLine),[n,s]=y.useState(!1);y.useEffect(()=>{xn.init();const u=()=>{r(!0),i(),o()},h=()=>r(!1);return window.addEventListener("online",u),window.addEventListener("offline",h),"serviceWorker"
732in navigator&&navigator.serviceWorker.register("/sw.js").catch(console.error),()=>{window.removeEventListener("online",u),window.removeEventListener("offline",h)}},[]);const i=async()=>{if(t){s(!0);try{const u=await xn.getUnsyncedProgress();for(const h of u)await fetch("/api/sync-progress",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(h.data)}),await xn.markProgressSynced(h.id)}catch(u){console.error("Sync failed:",u)}finally{s(!1)}}},o=async()=>{if(t){s(!0);try{const u=await xn.getUnsyncedQuizResults();for(const h of u)h.userId&&await n6(h.quizSession,h.userId),await xn.markQuizResultSynced(h.id)}catch(u){console.error("Quiz sync failed:",u)}finally{s(!1)}}},l=async()=>{const u=[{id:"vowels",type:"vowel",content:{},timestamp:Date.now()},{id:"consonants",type:"consonant",content:{},timestamp:Date.now()}];for(const h of u)await xn.addLesson(h)},c=async()=>{if(await xn.clearAll(),"caches"in window){const u=await caches.keys();await Promise.all(u.map(h=>caches.delete(h)))}};return a.jsx(a6.Provider,{value:{isOnline:t,isSyncing:n,syncProgress:i,syncQuizResults:o,cacheContent:l,clearCache:c},children:e})}function s6(){const e=y.useContext(a6);if(!e)throw new Error("useOffline must be used within OfflineProvider");return e}const Ore="modulepreload",Mre=function(e){return"/"+e},SP={},yi=function(t,r,n){let s=Promise.resolve();if(r&&r.length>0){document.getElementsByTagName("link");const o=document.querySelector("meta[property=csp-nonce]"),l=(o==null?void 0:o.nonce)||(o==null?void 0:o.getAttribute("nonce"));s=Promise.allSettled(r.map(c=>{if(c=Mre(c),c in SP)return;SP[c]=!0;const u=c.endsWith(".css"),h=u?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${c}"]${h}`))return;const d=document.createElement("link");if(d.rel=u?"stylesheet":Ore,u||(d.as="script"),d.crossOrigin="",d.href=c,l&&d.setAttribute("nonce",l),document.head.appendChild(d),u)return new Promise((f,m)=>{d.addEventListener("load",f),d.addEventListener("error",()=>m(new Error(`Unable to preload CSS for ${c}`)))})}))}function i(o){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=o,window.dispatchEvent(l),!l.defaultPrevented)throw o}return s.then(o=>{for(const l of o||[])l.status==="rejected"&&i(l.reason);return t().catch(i)})},Br=()=>{var e,t,r;try{return!!((t=(e=window==null?void 0:window.Capacitor)==null?void 0:e.isNativePlatform)!=null&&t.call(e))||!!((r=window==null?void 0:window.Capacitor)!=null&&r.isPluginAvailable)}catch{return!1}},i6=()=>{var e,t;try{return Br()?((t=(e=window==null?void 0:window.Capacitor)==null?void 0:e.getPlatform)==null?void 0:t.call(e))==="ios":/iPad|iPhone|iPod/.test(navigator.userAgent)}catch{return!1}},E2=()=>{var e,t;try{return Br()?((t=(e=window==null?void 0:window.Capacitor)==null?void 0:e.getPlatform)==null?void 0:t.call(e))==="android":/Android/.test(navigator.userAgent)}catch{return!1}},Rre=()=>{var e,t;try{if(Br()){const r=(t=(e=window==null?void 0:window.Capacitor)==null?void 0:e.getPlatform)==null?void 0:t.call(e);if(r==="ios"||r==="android")return r}}catch{}return"web"},$re=e=>{if(!Br()||!E2())return()=>{};const t=r=>{var n,s;(s=(n=r.detail)==null?void 0:n.register)==null||s.call(n,10,()=>{window.history.length>1&&window.history.back()})};return document.addEventListener("ionBackButton",t),()=>document.removeEventListener("ionBackButton",t)},Ire=async()=>{if(Br())try{const{StatusBar:e}=await yi(async()=>{const{StatusBar:t}=await import("./index-DhsNlDSu.js");return{StatusBar:t}},__vite__mapDeps([0,1]));i6()?await e.setStyle({style:"LIGHT"}):(await e.setBackgroundColor({color:"#7c3aed"}),await e.setStyle({style:"LIGHT"}))}catch(e){console.warn("[Capacitor] StatusBar plugin not available:",e)}},Dre=async()=>{if(Br())try{const{SplashScreen:e}=await yi(async()=>{const{SplashScreen:t}=await import("./index-CEzHUwVz.js");return{SplashScreen:t}},__vite__mapDeps([2,1]));await e.hide()}catch(e){console.warn("[Capacitor] SplashScreen plugin not available:",e)}},Lre=async()=>{if(Br())try{const{Keyboard:e}=await yi(async()=>{const{Keyboard:t}=await import("./index-1hbWiJZ8.js");return{Keyboard:t}},__vite__mapDeps([3,1]));e.addListener("keyboardWillShow",t=>{document.body.style.setProperty("--keyboard-height",`${t.keyboardHeight}px`),document.body.classList.add("keyboard-open")}),e.addListener("keyboardWillHide",()=>{document.body.style.setProperty("--keyboard-height","0px"),document.body.classList.remove("keyboard-open")})}catch(e){console.warn("[Capacitor] Keyboard plugin not available:",e)}},Fre=async()=>
732{if(!Br()){console.log("[Platform] Running on web");return}console.log(`[Platform] Running on ${Rre()} via Capacitor`),await Promise.allSettled([Ire(),Lre()]),setTimeout(()=>{Dre()},500),E2()&&$re()},Hr=({children:e})=>{const{user:t,loading:r}=Jt();return r?a.jsx("div",{className:"flex items-center justify-center min-h-screen",children:a.jsx(Fe,{className:"h-8 w-8 animate-spin text-primary"})}):t?a.jsx(a.Fragment,{children:e}):a.jsx(hZ,{to:"/login",replace:!0})};var zre=Symbol.for("react.lazy"),Fv=o0[" use ".trim().toString()];function Bre(e){return typeof e=="object"&&e!==null&&"then"in e}function o6(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===zre&&"_payload"in e&&Bre(e._payload)}function V0(e){const t=Wre(e),r=y.forwardRef((n,s)=>{let{children:i,...o}=n;o6(i)&&typeof Fv=="function"&&(i=Fv(i._payload));const l=y.Children.toArray(i),c=l.find(Hre);if(c){const u=c.props.children,h=l.map(d=>d===c?y.Children.count(u)>1?y.Children.only(null):y.isValidElement(u)?u.props.children:null:d);return a.jsx(t,{...o,ref:s,children:y.isValidElement(u)?y.cloneElement(u,void 0,h):null})}return a.jsx(t,{...o,ref:s,children:i})});return r.displayName=`${e}.Slot`,r}var Ure=V0("Slot");function Wre(e){const t=y.forwardRef((r,n)=>{let{children:s,...i}=r;if(o6(s)&&typeof Fv=="function"&&(s=Fv(s._payload)),y.isValidElement(s)){const o=Gre(s),l=qre(i,s.props);return s.type!==y.Fragment&&(l.ref=n?Js(n,o):o),y.cloneElement(s,l)}return y.Children.count(s)>1?y.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Vre=Symbol("radix.slottable");function Hre(e){return y.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Vre}function qre(e,t){const r={...t};for(const n in t){const s=e[n],i=t[n];/^on[A-Z]/.test(n)?s&&i?r[n]=(...l)=>{const c=i(...l);return s(...l),c}:s&&(r[n]=s):n==="style"?r[n]={...s,...i}:n==="className"&&(r[n]=[s,i].filter(Boolean).join(" "))}return{...e,...r}}function Gre(e){var n,s;let t=(n=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:n.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=(s=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:s.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}const T2=kp("inline-flex items-center justify-center 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",{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"},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"}}),Y=y.forwardRef(({className:e,variant:t,size:r,asChild:n=!1,...s},i)=>{const o=n?Ure:"button";return a.jsx(o,{className:je(T2({variant:t,size:r,className:e})),ref:i,...s})});Y.displayName="Button";const se=y.forwardRef(({className:e,...t},r)=>a.jsx("div",{ref:r,className:je("rounded-lg border border-border/40 bg-background shadow-sm",e),...t}));se.displayName="Card";const _e=y.forwardRef(({className:e,...t},r)=>a.jsx("div",{ref:r,className:je("flex flex-col space-y-1.5 p-6",e),...t}));_e.displayName="CardHeader";const Se=y.forwardRef(({className:e,...t},r)=>a.jsx("h3",{ref:r,className:je("text-2xl font-semibold leading-none tracking-tight text-foreground",e),...t}));Se.displayName="CardTitle";const hr=y.forwardRef(({className:e,...t},r)=>a.jsx("p",{ref:r,className:je("text-sm text-muted-foreground",e),...t}));hr.displayName="CardDescription";const ue=y.forwardRef(({className:e,...t},r)=>a.jsx("div",{ref:r,className:je("p-6 pt-0",e),...t}));
732ue.displayName="CardContent";const Kre=y.forwardRef(({className:e,...t},r)=>a.jsx("div",{ref:r,className:je("flex items-center p-6 pt-0",e),...t}));Kre.displayName="CardFooter";const NP=new Map,Yre=async e=>{if(!Br())try{const t=await fetch(e);return t.ok?await t.blob():null}catch{return null}try{const{CapacitorHttp:t}=await yi(async()=>{const{CapacitorHttp:n}=await import("./index-DNzFMgCo.js");return{CapacitorHttp:n}},[]),r=await t.get({url:e,responseType:"blob",headers:{Accept:"audio/mpeg, audio/*"}});if(r.status===200&&r.data){const n=atob(r.data),s=new Uint8Array(n.length);for(let i=0;i<n.length;i++)s[i]=n.charCodeAt(i);return new Blob([s],{type:"audio/mpeg"})}return null}catch(t){console.warn("[NativeAudio] CapacitorHttp failed, falling back to fetch:",t);try{const r=await fetch(e);return r.ok?await r.blob():null}catch{return null}}},kP=(e,t)=>new Promise(r=>{const n=new Audio(e);n.volume=(t==null?void 0:t.volume)??1,n.playbackRate=(t==null?void 0:t.rate)??1;const s=()=>{n.onplay=null,n.onended=null,n.onerror=null};n.onplay=()=>{t!=null&&t.onStart&&t.onStart()},n.onended=()=>{s(),t!=null&&t.onEnd&&t.onEnd(),r(!0)},n.onerror=()=>{s(),r(!1)};const i=setTimeout(()=>{s(),r(!1)},1e4);n.onended=()=>{clearTimeout(i),s(),t!=null&&t.onEnd&&t.onEnd(),r(!0)},n.play().catch(()=>{clearTimeout(i),s(),r(!1)})}),Xre=(e,t)=>
732new Promise(r=>{const n=new Audio(e);n.volume=(t==null?void 0:t.volume)??1,n.playbackRate=(t==null?void 0:t.rate)??1;const s=()=>{n.onplay=null,n.onended=null,n.onerror=null};n.onplay=()=>{t!=null&&t.onStart&&t.onStart()},n.onended=()=>{s(),t!=null&&t.onEnd&&t.onEnd(),r(!0)},n.onerror=()=>{s(),r(!1)};const i=setTimeout(()=>{s(),r(!1)},1e4);n.onended=()=>{clearTimeout(i),s(),t!=null&&t.onEnd&&t.onEnd(),r(!0)},n.play().catch(()=>{clearTimeout(i),s(),r(!1)})}),Qre=async(e,t)=>{const r=NP.get(e);if(r)return kP(r,t);if(!Br())return Xre(e,t);try{const n=await Yre(e);if(!n||n.size<100)return!1;const s=URL.createObjectURL(n);return NP.set(e,s),kP(s,t)}catch(n){return console.warn("[NativeAudio] Failed to play:",e,n),!1}},Jre=async e=>{if(!Br())return new Promise(t=>{const r=new Audio,n=setTimeout(()=>{r.src="",t(!1)},4e3);r.addEventListener("canplaythrough",()=>{clearTimeout(n),t(!0)},{once:!0}),r.addEventListener("loadeddata",()=>{clearTimeout(n),t(!0)},{once:!0}),r.addEventListener("error",()=>{clearTimeout(n),t(!1)},{once:!0}),r.preload="auto",r.src=e,r.load()});try{const{CapacitorHttp:t}=await yi(async()=>{const{CapacitorHttp:n}=await import("./index-DNzFMgCo.js");return{CapacitorHttp:n}},[]),r=await t.get({url:e,responseType:"blob",headers:{Range:"bytes=0-1"}});return r.status>=200&&r.status<400}catch{try{const t=await fetch(e,{method:"HEAD",mode:"no-cors"});return t.ok||t.type==="opaque"}catch{return!1}}},Og=new Map,bm=new Map,Zre=5*60*1e3,ene=30*60*1e3,tne="audio-files",qe=e=>`${tr}/storage/v1/object/public/${tne}/${e}`,rne=async e=>Br()?Jre(e):new Promise(t=>{const r=new Audio,n=setTimeout(()=>{r.src="",t(!1)},4e3);r.addEventListener("canplaythrough",()=>{clearTimeout(n),t(!0)},{once:!0}),r.addEventListener("loadeddata",()=>{clearTimeout(n),t(!0)},{once:!0}),r.addEventListener("error",()=>{clearTimeout(n),t(!1)},{once:!0}),r.preload="auto",r.src=e,r.load()}),$y=async(e,t)=>Br()?Qre(e,t):new Promise(r=>{const n=`audio:${e}`;let s=Og.get(n);s||(s=new Audio(e),Og.set(n,s)),s.volume=(t==null?void 0:t.volume)??1,s.playbackRate=(t==null?void 0:t.rate)??1,s.currentTime=0;const i=()=>{s.onplay=null,s.onended=null,s.onerror=null};s.onplay=()=>{t!=null&&t.onStart&&t.onStart()},s.onended=()=>{i(),t!=null&&t.onEnd&&t.onEnd(),r(!0)},s.onerror=()=>{i(),Og.delete(n),r(!1)},s.play().catch(()=>{i(),Og.delete(n),r(!1)})}),jd={ക്:"k",ക:"k",ഖ്:"kh",ഖ:"kh",ഗ്:"g",ഗ:"g",ഘ്:"gh",ഘ:"gh",ങ്:"ng",ങ:"ng",ച്:"ch",ച:"ch",ഛ്:"chh",ഛ:"chh",ജ്:"j",ജ:"j",ഝ്:"jh",ഝ:"jh",ഞ്:"ny",ഞ:"ny",ട്:"tt",ട:"tt",ഠ്:"tth",ഠ:"tth",ഡ്:"dd",ഡ:"dd",ഢ്:"ddh",ഢ:"ddh",ണ്:"nn",ണ:"nn",ത്:"th",ത:"th",ഥ്:"thh",ഥ:"thh",ദ്:"d",ദ:"d",ധ്:"dh",ധ:"dh",ന്:"n",ന:"n",പ്:"p",പ:"p",ഫ്:"ph",ഫ:"ph",ബ്:"b",ബ:"b",ഭ്:"bh",ഭ:"bh",മ്:"m",മ:"m",യ്:"y",യ:"y",ര്:"r",ര:"r",ല്:"l",ല:"l",വ്:"v",വ:"v",ശ്:"sh",ശ:"sh",ഷ്:"shh",ഷ:"shh",സ്:"s",സ:"s",ഹ്:"h",ഹ:"h",ള്:"ll",ള:"ll",ഴ്:"zh",ഴ:"zh",റ്:"rr",റ:"rr"},A2={അ:"a",ആ:"aa",ഇ:"i",ഈ:"ii",ഉ:"u",ഊ:"uu",ഋ:"ri",എ:"e",ഏ:"ee",ഐ:"ai",ഒ:"o",ഓ:"oo",ഔ:"au",അം:"am",അഃ:"ah"},H0={"ാ":"aa","ി":"i","ീ":"ii","ു":"u","ൂ":"uu","ൃ":"ri","െ":"e","േ":"ee","ൈ":"ai","ൊ":"o","ോ":"oo","ൗ":"au","ം":"am","ഃ":"ah"},P2={ക്ക:"kka",ത്ത:"ththa",പ്പ:"ppa",ന്ന:"nna",മ്മ:"mma",ല്ല:"lla",ണ്ണ:"nnna",റ്റ:"rtta",സ്സ:"ssa",ച്ച:"ccha",ട്ട:"tttta",ഗ്ഗ:"gga",ജ്ജ:"jja",ബ്ബ:"bba",യ്യ:"yya",വ്വ:"vva",ന്ത:"ntha",മ്പ:"mpa",ങ്ക:"ngka",ഞ്ച:"nycha",ണ്ട:"ndda",ന്ദ:"nda",ങ്ങ:"ngnga",ക്ഷ:"ksha",സ്ത:"stha",സ്ക:"ska",ക്ത:"ktha",ഗ്ന:"gna",ത്ര:"thra",ദ്ര:"dra",പ്ര:"pra",ബ്ര:"bra",ക്ര:"kra",ഗ്ര:"gra",ശ്ര:"shra"},q0={പൂവ്:"puuv",കാട്:"kaatt",കാല്:"kaal",പൂവ:"puuva",കാട:"kaatta",കാല:"kaala",കൈ:"kai",പൈസ:"paisa",വൈകി:"vaiki","പൗരൻ":"pauran",ഔഷധം:"aushadham",ഔദ്യോഗികം:"audyogikam"},nne=e=>{const t=["chh","tth","ddh","thh","shh","kh","gh","ng","ch","jh","ny","tt","dd","nn","th","dh","ph","bh","sh","ll","zh","rr","k","g","j","d","
732n","p","b","m","y","r","l","v","s","h"];for(const r of t)if(e.startsWith(r))return r;return null},l6=e=>{const t=bm.get(e);if(!t)return;const r=t.url?ene:Zre;if(Date.now()-t.timestamp>r){bm.delete(e);return}return t.url},V_=(e,t)=>{bm.set(e,{url:t,timestamp:Date.now()})},ane=e=>{const t=[],r=nne(e);return r&&(t.push(qe(`${r}-series/${e}.mp3`)),t.push(qe(`${r}a-series/${e}.mp3`)),t.push(qe(`${r}_series/${e}.mp3`))),t.push(qe(`${e}.mp3`)),t.push(qe(`combinations/${e}.mp3`)),t.push(qe(`consonant-vowel/${e}.mp3`)),t.push(qe(`cv/${e}.mp3`)),t.push(qe(`consonants/${e}.mp3`)),t.push(qe(`consonants/with-a/${e}.mp3`)),t},O2=(e,t)=>{const r=[];if(t==="vowel"){const n=A2[e];n&&(r.push(qe(`${n}.mp3`)),r.push(qe(`vowels/${n}.mp3`)),r.push(qe(`vowel_${n}.mp3`)),r.push(qe(`vowels/vowel_${n}.mp3`)))}else if(t==="consonant-with-a"||t==="consonant-isolated"){const n=jd[e];if(n){const s=n+"a";t==="consonant-with-a"?(r.push(qe(`${s}-series/${s}.mp3`)),r.push(qe(`${n}-series/${s}.mp3`)),r.push(qe(`${s}_series/${s}.mp3`)),r.push(qe(`${n}_series/${s}.mp3`)),r.push(qe(`${s}.mp3`)),r.push(qe(`consonants/${s}.mp3`)),r.push(qe(`consonants/with-a/${s}.mp3`)),r.push(qe(`consonants/with-a/${s}_with_a.mp3`)),r.push(qe(`${s}_with_a.mp3`))):(r.push(qe(`${n}_isolated.mp3`)),r.push(qe(`consonants/${n}_isolated.mp3`)),r.push(qe(`consonants/isolated/${n}_isolated.mp3`)),r.push(qe(`consonants/isolated/${n}.mp3`)))}}else if(t==="matra"){const n=H0[e];n&&(r.push(qe(`matra_${n}.mp3`)),r.push(qe(`matras/matra_${n}.mp3`)),r.push(qe(`matras/${n}.mp3`)),r.push(qe(`${n}_matra.mp3`)))}return r},sne=e=>{const t=[],r=q0[e];return r&&(t.push(qe(`words/${r}.mp3`)),t.push(qe(`${r}.mp3`)),t.push(qe(`word-${r}.mp3`)),t.push(qe(`words/word-${r}.mp3`)),t.push(qe(`examples/${r}.mp3`)),t.push(qe(`virama/${r}.mp3`))),t},ine=e=>{const t=[],r=P2[e];return r&&(t.push(qe(`conjuncts/${r}.mp3`)),t.push(qe(`${r}.mp3`)),t.push(qe(`conjunct-${r}.mp3`)),t.push(qe(`conjuncts/conjunct-${r}.mp3`)),t.push(qe(`geminated/${r}.mp3`)),t.push(qe(`combined/${r}.mp3`)),t.push(qe(`consonant-clusters/${r}.mp3`))),t},c6=async(e,t)=>{const r=l6(t);if(r!==void 0)return r;for(const n of e)if(await rne(n))return V_(t,n),n;return V_(t,null),null},G0=async(e,t,r)=>{const n=l6(t);if(n){if(await $y(n,r))return!0;bm.delete(t)}for(const i of e)if(await $y(i,r))return V_(t,i),!0;const s=await c6(e,t);return!!(s&&await $y(s,r))},r1=new Map,one=async(e,t,r)=>{const n=`cloudtts:${e}:${t||""}`,s=r1.get(n);if(s){if(await $y(s,r))return!0;r1.delete(n)}try{const{data:{session:i}}=await ne.auth.getSession(),o=await fetch(`${tr}/functions/v1/malayalam-tts`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${(i==null?void 0:i.access_token)||C2}`},body:JSON.stringify({text:e,character:e,romanized:t||e})});if(!o.ok)return console.warn(`[Audio] Cloud TTS failed: ${o.status}`),!1;if((o.headers.get("content-type")||"").includes("application/json"))return console.warn("[Audio] Cloud TTS returned JSON instead of audio"),!1;const c=await o.blob();if(c.size<100)return console.warn("[Audio] Cloud TTS returned tiny audio blob"),!1;const u=URL.createObjectURL(c);return r1.set(n,u),new Promise(h=>{const d=new Audio(u);d.volume=(r==null?void 0:r.volume)??1,d.playbackRate=(r==null?void 0:r.rate)??1,d.onplay=()=>{r!=null&&r.onStart&&r.onStart()},d.onended=()=>{r!=null&&r.onEnd&&r.onEnd(),h(!0)},d.onerror=()=>{r!=null&&r.onEnd&&r.onEnd(),h(!1)},d.play().catch(()=>{h(!1)})})}catch(i){return console.warn("[Audio] Cloud TTS error:",i),!1}},lne=(e,t)=>new Promise(r=>{if(!("speechSynthesis"in window)){r(!1);return}try{const n=new SpeechSynthesisUtterance(e);n.lang="ml-IN",n.rate=(t==null?void 0:t.rate)??.8,n.volume=(t==null?void 0:t.volume)??1;const i=speechSynthesis.getVoices().find(o=>o.lang.startsWith("ml"));i&&(n.voice=i),n.onstart=()=>{t!=null&&t.onStart&&t.onStart()},n.onend=()=>{t!=null&&t.onEnd&&t.onEnd(),r(!0)},n.onerror=()=>{t!=null&&t.onEnd&&t.onEnd(),r(!1)},speechSynthesis.cancel(),speechSynthesis.speak(n),setTimeout(()=>r(!0),5e3)}catch{r(!1)}}),K0=e=>{e!=null&&e.onStart&&e.onStart(),e!=null&&e.onEnd&&setTimeout(e.onEnd,300)},cne=e=>jd[e]?jd[e]+"a":A2[e]||H0[e]||P2[e]||q0[e]||void 0,Y0=async(e,t)=>{const r=cne(e);return!!(await one(e,r,t)||await lne(e,t))},M2=async(e,t)=>{const r=ane(e);await G0(r,`romanized:${e}`,t)||(console.warn(`[Audio] No stored file for romanized "${e}", trying Cloud TTS…`),await Y0(e,t)||K0(t))},R2=async(e,t)=>{const r=sne(e);await G0(r,`word:${e}`,t)||(console.warn(`[Audio] No stored file for word "${e}", trying ElevenLabs TTS…`),await Y0(e,t)||K0(t))},u6=async(e,t)=>{const r=ine(e);await G0(r,`conjunct:${e}`,t)||(console.warn(`[Audio] No stored file for conjunct "${e}", trying ElevenLabs TTS…`),await Y0(e,t)||K0(t))},Fr=async(e,t)=>{const r=(t==null?void 0:t.type)||"consonant-with-a";if(P2[e])return u6(e,t);if(q0[e])return R2(e,t);if(e.length>=2&&!(t!=null&&t.type)){const i=e.charAt(0),o=jd[i];if(o){const l=e.substring(1),c=H0[l];if(c)return M2(o+c,t)}}const n=O2(e,r);await G0(n,`${e}:${r}`,t)||(console.warn(`[Audio] No stored file for "${e}" (${r}
732), trying ElevenLabs TTS…`),await Y0(e,t)||K0(t))},CP=async(e,t="consonant-with-a")=>{const r=O2(e,t);return await c6(r,`${e}:${t}`)!==null},$2=()=>{bm.clear()},une=(e,t="consonant-with-a")=>O2(e,t),dne=(e,t="consonant-with-a")=>{let r,n="",s="";return t==="vowel"?(r=A2[e],r&&(n="vowels",s=`${r}.mp3`)):t==="consonant-with-a"?(r=jd[e],r&&(n="consonants/with-a",s=`${r}a.mp3`)):t==="consonant-isolated"?(r=jd[e],r&&(n="consonants/isolated",s=`${r}_isolated.mp3`)):t==="matra"&&(r=H0[e],r&&(n="matras",s=`matra_${r}.mp3`)),r?{supabaseFilename:s,localFilename:s.replace(/_/g,"-"),directory:n}:null},n1=e=>{const t=q0[e];return t?`word-${t}.mp3`:null},d6="neela-streak-data",hne=[{days:3,title:"Getting Started",titleMl:"തുടക്കം",description:"3 day streak!",reward:"Neela waves at you!",rewardXP:50,achieved:!1,icon:"wave"},{days:7,title:"One Week Wonder",titleMl:"ഒരാഴ്ച",description:"7 day streak!",reward:"Streak freeze earned!",rewardXP:100,achieved:!1,icon:"fire"},{days:14,title:"Two Week Champion",titleMl:"രണ്ടാഴ്ച",description:"14 day streak!",reward:"Neela celebrates!",rewardXP:200,achieved:!1,icon:"trophy"},{days:30,title:"Monthly Master",titleMl:"ഒരു മാസം",description:"30 day streak!",reward:"Golden feather badge!",rewardXP:500,achieved:!1,icon:"star"},{days:50,title:"Dedicated Learner",titleMl:"സമർപ്പിതം",description:"50 day streak!",reward:"Neela gets a crown!",rewardXP:750,achieved:!1,icon:"crown"},{days:100,title:"Century Club",titleMl:"നൂറ് ദിനം",description:"100 day streak!",reward:"Legendary status!",rewardXP:1500,achieved:!1,icon:"diamond"},{days:365,title:"Year of Malayalam",titleMl:"ഒരു വർഷം",description:"365 day streak!",reward:"Ultimate mastery!",rewardXP:5e3,achieved:!1,icon:"infinity"}],Ac=()=>{const e=localStorage.getItem(d6);if(e)try{return JSON.parse(e)}catch{}return{currentStreak:0,longestStreak:0,lastActiveDate:"",totalDaysActive:0,streakHistory:[],weeklyGoal:5,weeklyProgress:0,streakFreezes:1,freezeUsedDates:[],milestones:[...hne],xpFromStreaks:0}},fne=e=>{localStorage.setItem(d6,JSON.stringify(e))},h6=()=>new Date().toISOString().split("T")[0],f6=()=>{const e=new Date;return e.setDate(e.getDate()-1),e.toISOString().split("T")[0]},mne=(e,t)=>{const r=new Date(e),n=new Date(t),s=Math.abs(n.getTime()-r.getTime());return Math.floor(s/(1e3*60*60*24))},m6=()=>{const e=Ac(),t=h6(),r=f6();let n=!1,s=!1;if(e.lastActiveDate===t)return{streakData:e,newMilestones:[],streakBroken:!1,streakExtended:!1};e.lastActiveDate===r?(e.currentStreak+=1,s=!0):e.lastActiveDate===""?(e.currentStreak=1,s=!0):mne(e.lastActiveDate,t)===2&&e.streakFreezes>0?(e.streakFreezes-=1,e.freezeUsedDates.push(r),e.currentStreak+=1,s=!0):(n=e.currentStreak>0,e.currentStreak=1,s=!0),e.lastActiveDate=t,e.totalDaysActive+=1,e.streakHistory.includes(t)||e.streakHistory.push(t),e.longestStreak=Math.max(e.longestStreak,e.currentStreak);const i=new Date;i.setDate(i.getDate()-i.getDay());const o=i.toISOString().split("T")[0];e.weeklyProgress=e.streakHistory.filter(c=>c>=o).length;const l=[];return e.milestones.forEach(c=>{!c.achieved&&e.currentStreak>=c.days&&(c.achieved=!0,c.achievedDate=t,e.xpFromStreaks+=c.rewardXP,l.push(c),c.days===7&&(e.streakFreezes+=1))}),fne(e),{streakData:e,newMilestones:l,streakBroken:n,streakExtended:s}},pne=(e=30)=>{const t=Ac(),r=[];for(let n=e-1;n>=0;n--){const s=new Date;s.setDate(s.getDate()-n);const i=s.toISOString().split("T")[0];r.push({date:i,active:t.streakHistory.includes(i),frozen:t.freezeUsedDates.includes(i)})}return r},I2=()=>{const e=Ac(),t=h6();if(e.lastActiveDate===t&&e.currentStreak>=7)return"celebrating";if(e.lastActiveDate===t)return"happy";if(e.currentStreak===0)return"sad";const r=f6();return e.lastActiveDate!==t&&e.lastActiveDate!==r?"sad":"thinking"},H_=e=>{const t=Ac(),r=I2(),s={greeting:{happy:[{en:"Welcome back! Let's learn together!",ml:"സ്വാഗതം! നമുക്ക് ഒരുമിച്ച് പഠിക്കാം!"},{en:"Hi there! Ready for today's lesson?",ml:"ഹായ്! ഇന്നത്തെ പാഠത്തിന് തയ്യാറാണോ?"},{en:"Great to see you! Shall we begin?",ml:"നിങ്ങളെ കണ്ടതിൽ സന്തോഷം!"}],celebrating:[{en:`Amazing! ${t.currentStreak} day streak! Keep it up!`,ml:`അത്ഭുതം! ${t.currentStreak} ദിവസത്തെ സ്ട്രീക്ക്!`}
732,{en:"You're on fire! Neela is so proud!",ml:"നിങ്ങൾ അഗ്നിയാണ്! നീല വളരെ അഭിമാനിക്കുന്നു!"}],thinking:[{en:"Hmm, it's been a while. Let's get back on track!",ml:"ഹ്മ്മ്, കുറച്ച് സമയമായി. നമുക്ക് തിരിച്ചുവരാം!"},{en:"I was wondering when you'd come back!",ml:"നിങ്ങൾ എപ്പോൾ തിരിച്ചുവരുമെന്ന് ഞാൻ ആലോചിച്ചു!"}],sad:[{en:"I missed you! Let's start fresh today!",ml:"എനിക്ക് നിങ്ങളെ നഷ്ടമായി! ഇന്ന് പുതുതായി തുടങ്ങാം!"},{en:"Don't worry about the streak. Every day is a new chance!",ml:"സ്ട്രീക്കിനെ കുറിച്ച് വിഷമിക്കേണ്ട!"}],reading:[{en:"I've been studying while you were away!",ml:"നിങ്ങൾ ഇല്ലാത്തപ്പോൾ ഞാൻ പഠിക്കുകയായിരുന്നു!"}]},streak:{happy:[{en:`${t.currentStreak} days and counting! You're doing great!`,ml:`${t.currentStreak} ദിവസം! നിങ്ങൾ മികച്ചത് ചെയ്യുന്നു!`}],celebrating:[{en:`WOW! ${t.currentStreak} day streak! You're unstoppable!`,ml:`വാവ്! ${t.currentStreak} ദിവസത്തെ സ്ട്രീക്ക്!`}],thinking:[{en:"Practice today to keep your streak alive!",ml:"സ്ട്രീക്ക് നിലനിർത്താൻ ഇന്ന് പരിശീലിക്കൂ!"}],sad:[{en:"Let's build a new streak together!",ml:"നമുക്ക് ഒരുമിച്ച് പുതിയ സ്ട്രീക്ക് ഉണ്ടാക്കാം!"}],reading:[{en:"Consistency is the key to mastery!",ml:"സ്ഥിരത മാസ്റ്ററിയുടെ താക്കോലാണ്!"}]},lesson:{happy:[{en:"Let's learn something new today!",ml:"ഇന്ന് പുതിയ എന്തെങ്കിലും പഠിക്കാം!"},{en:"This is going to be fun!",ml:"ഇത് രസകരമായിരിക്കും!"}],celebrating:[{en:"You're learning so fast! Amazing!",ml:"നിങ്ങൾ വളരെ വേഗം പഠിക്കുന്നു!"}],thinking:[{en:"Take your time, I'm here to help!",ml:"സമയമെടുക്കൂ, ഞാൻ സഹായിക്കാൻ ഇവിടെയുണ്ട്!"}],sad:[{en:"Don't give up! Malayalam is beautiful!",ml:"ഉപേക്ഷിക്കരുത്! മലയാളം മനോഹരമാണ്!"}],reading:[{en:"I found some great tips for you!",ml:"നിങ്ങൾക്കായി ചില മികച്ച നുറുങ്ങുകൾ ഞാൻ കണ്ടെത്തി!"}]},quiz:{happy:[{en:"You can do this! I believe in you!",ml:"നിങ്ങൾക്ക് ഇത് ചെയ്യാൻ കഴിയും!"}],celebrating:[{en:"Perfect score! Neela is dancing!",ml:"പെർഫെക്ട് സ്കോർ! നീല നൃത്തം ചെയ്യുന്നു!"}],thinking:[{en:"Think carefully... you know this!",ml:"ശ്രദ്ധയോടെ ചിന്തിക്കൂ... നിങ്ങൾക്ക് ഇത് അറിയാം!"}],sad:[{en:"Mistakes help us learn! Try again!",ml:"തെറ്റുകൾ നമ്മെ പഠിക്കാൻ സഹായിക്കുന്നു!"}],reading:[{en:"Let me review the answers with you!",ml:"ഉത്തരങ്ങൾ ഒരുമിച്ച് പരിശോധിക്കാം!"}]},achievement:{happy:[{en:"You earned a new achievement!",ml:"നിങ്ങൾ ഒരു പുതിയ നേട്ടം നേടി!"}],celebrating:[{en:"INCREDIBLE! Look at that achievement!",ml:"അവിശ്വസനീയം! ആ നേട്ടം നോക്കൂ!"}],thinking:[{en:"So close to the next milestone!",ml:"അടുത്ത നാഴികക്കല്ലിന് വളരെ അടുത്ത്!"}],sad:[{en:"Keep going, achievements await!",ml:"തുടരൂ, നേട്ടങ്ങൾ കാത്തിരിക്കുന്നു!"}],reading:[{en:"I'm tracking your progress!",ml:"ഞാൻ നിങ്ങളുടെ പുരോഗതി ട്രാക്ക് ചെയ്യുന്നു!"}]}}[e||"greeting"],i=s[r]||s.happy;return i[Math.floor(Math.random()*i.length)]},Ds={happy:"https://d64gsuwffb70l.cloudfront.net/68e98d36a8cedcd8009fab27_1771871814918_901c82f2.jpg",celebrating:"https://d64gsuwffb70l.cloudfront.net/68e98d36a8cedcd8009fab27_1771871829541_92944522.jpg",thinking:"https://d64gsuwffb70l.cloudfront.net/68e98d36a8cedcd8009fab27_1771871845243_5d8b3612.jpg",sad:"https://d64gsuwffb70l.cloudfront.net/68e98d36a8cedcd8009fab27_1771871860917_3aff7d9c.jpg",reading:"https://d64gsuwffb70l.cloudfront.net/68e98d36a8cedcd8009fab27_1771871879294_ec0654ed.jpg"},Po="https://d64gsuwffb70l.cloudfront.net/68e64a5696b54c9b8a539624_1771872632838_7debac71.png",p6="https://d64gsuwffb70l.cloudfront.net/68e64a5696b54c9b8a539624_1771872697047_cefd106e.jpg",g6={sm:"w-12 h-12",md:"w-20 h-20",lg:"w-32 h-32",xl:"w-48 h-48"},gne=({mood:e,size:t="md",showSpeechBubble:r=!1,message:n,messageMl:s,context:i="greeting",floating:o=!1,animate:l=!0,onClick:c,className:u="",autoHideBubble:h=!0})=>{const[d,f]=y.useState(e||"happy"),[m,g]=y.useState(r),[p,v]=y.useState({en:"",ml:""}),[x,b]=y.useState(!1),[w,j]=y.useState(!1);y.useEffect(()=>{f(e||I2())},[e]),y.useEffect(()=>{if(n)v({en:n,ml:s||""});else if(r||m){const P=H_(i);v(P)}},[n,s,i,r,m]),y.useEffect(()=>{if(g(r),r&&h){const P=setTimeout(()=>g(!1),8e3);return()=>clearTimeout(P)}},[r,h]),y.useEffect(()=>{if(!l)return;const P=setInterval(()=>{j(!0),setTimeout(()=>j(!1),600)},5e3);return()=>clearInterval(P)},[l]);const _=y.useCallback(()=>
732{if(c)c();else{const P=H_(i);v(P),g(C=>!C),j(!0),setTimeout(()=>j(!1),600)}},[c,i]),S=()=>{b(P=>!P)},k=l?d==="celebrating"?"animate-bounce":d==="thinking"?"animate-pulse":w?"animate-bounce":"hover:scale-110 transition-transform duration-300":"";return o?a.jsx(yne,{mood:d,size:t,bubbleVisible:m,currentMessage:p,showMl:x,animationClass:k,onClickNeela:_,onToggleLanguage:S,onCloseBubble:()=>g(!1),className:u}):a.jsxs("div",{className:`inline-flex flex-col items-center gap-2 ${u}`,children:[m&&p.en&&a.jsx(y6,{message:x&&p.ml?p.ml:p.en,hasMl:!!p.ml,showMl:x,onToggleLanguage:S,onClose:()=>g(!1),position:"top"}),a.jsxs("button",{onClick:_,className:`relative ${g6[t]} rounded-full overflow-hidden cursor-pointer ${k} focus:outline-none focus:ring-2 focus:ring-blue-400 focus:ring-offset-2`,"aria-label":"Neela the Macaw mascot",children:[a.jsx("img",{src:Ds[d],alt:`Neela the Hyacinth Macaw - ${d}`,className:"w-full h-full object-cover rounded-full"}),a.jsx("div",{className:`absolute inset-0 rounded-full ${d==="celebrating"?"ring-4 ring-yellow-400/50 animate-pulse":d==="happy"?"ring-2 ring-blue-300/30":""}`})]}),t!=="sm"&&a.jsx("span",{className:"text-xs font-bold text-blue-600 bg-blue-50 px-2 py-0.5 rounded-full",children:"Neela"})]})},yne=({mood:e,size:t,bubbleVisible:r,currentMessage:n,showMl:s,animationClass:i,onClickNeela:o,onToggleLanguage:l,onCloseBubble:c,className:u})=>{const[h,d]=y.useState(!1);return h?a.jsx("button",{onClick:()=>d(!1),className:"fixed bottom-6 right-6 z-50 w-14 h-14 rounded-full bg-gradient-to-br from-blue-500 to-indigo-600 shadow-lg hover:shadow-xl transition-all duration-300 hover:scale-110 flex items-center justify-center","aria-label":"Show Neela",children:a.jsx(SD,{className:"w-6 h-6 text-white"})}):a.jsxs("div",{className:`fixed bottom-6 right-6 z-50 flex flex-col items-end gap-3 ${u}`,children:[r&&n.en&&a.jsx("div",{className:"animate-in slide-in-from-bottom-2 fade-in duration-300",children:a.jsx(y6,{message:s&&n.ml?n.ml:n.en,hasMl:!!n.ml,showMl:s,onToggleLanguage:l,onClose:c,position:"top"})}),a.jsxs("div",{className:"flex items-end gap-2",children:[a.jsx("button",{onClick:()=>d(!0),className:"w-8 h-8 rounded-full bg-gray-200 hover:bg-gray-300 flex items-center justify-center text-gray-500 transition-colors mb-2","aria-label":"Minimize Neela",children:a.jsx(ls,{className:"w-4 h-4"})}),a.jsxs("button",{onClick:o,className:`relative ${g6[t]} rounded-full overflow-hidden cursor-pointer shadow-2xl ${i} focus:outline-none ring-4 ring-white`,"aria-label":"Talk to Neela",children:[a.jsx("img",{src:Ds[e],alt:`Neela - ${e}`,className:"w-full h-full object-cover"}),a.jsx(vne,{})]})]})]})},y6=({message:e,hasMl:t,showMl:r,onToggleLanguage:n,onClose:s,position:i})=>a.jsxs("div",{className:`relative bg-white rounded-2xl shadow-xl border border-blue-100 p-4 max-w-[280px] ${i==="top"?"mb-2":"mr-2"}`,children:[a.jsx("button",{onClick:s,className:"absolute top-1 right-1 w-6 h-6 rounded-full bg-gray-100 hover:bg-gray-200 flex items-center justify-center",children:a.jsx(ls,{className:"w-3 h-3 text-gray-500"})}),a.jsx("p",{className:`text-sm leading-relaxed pr-6 ${r?"font-medium":""}`,children:e}),t&&a.jsx("button",{onClick:n,className:"mt-2 text-xs text-blue-500 hover:text-blue-700 font-medium transition-colors",children:r?"Show English":"മലയാളത്തിൽ കാണുക"}),a.jsx("div",{className:`absolute ${i==="top"?"bottom-0 right-8 translate-y-full":"right-0 bottom-4 translate-x-full"}`,children:a.jsx("svg",{width:"20",height:"12",viewBox:"0 0 20 12",className:i==="left"?"rotate-90":"",children:a.jsx("path",{d:"M0 0 L10 12 L20 0",fill:"white",stroke:"#dbeafe",strokeWidth:"1"})})})]}),vne=()=>{const e=Ac();return e.currentStreak<=0?null:a.jsx("div",{className:"absolute -top-1 -left-1 bg-gradient-to-r from-orange-500 to-red-500 text-white text-xs font-bold rounded-full w-7 h-7 flex items-center justify-center shadow-lg border-2 border-white",children:e.currentStreak})},EP=["അ","ആ","ക","മ","ന"],xne=()=>{const e=ei(),{startDemoMode:t}=Jt(),[r,n]=y.useState(!1),[s,i]=y.useState(!1),o=y.useRef(0),l=async()=>{n(!0);try{await t(),e("/app")}catch(d){console.error("Failed to start demo mode:",d)}finally{n(!1)}},c=y.useCallback(()=>{const d=Date.now();if(d-o.current<1500||s)return;o.current=d,i(!0);const f=EP[Math.floor(Math.random()*EP.length)],m=["അ","ആ"].includes(f);Fr(f,{type:m?"vowel":"consonant-with-a",volume:.7,onEnd:()=>i(!1)}).catch(()=>i(!1))},[s]),u=[{icon:wa,title:"Complete Script Learning",description:"Master all Malayalam vowels, consonants, and conjuncts with Neela guiding every lesson",color:"from-blue-500 to-indigo-500",bg:"bg-blue-50"},{icon:dA,title:"Interactive Quizzes",description:"Test your knowledge with engaging quizzes and instant feedback from Neela",color:"from-purple-500 to-pink-500",bg:"bg-purple-50"},{icon:ja,title:"Track Your Progress",description:"Monitor your learning journey with detailed statistics and achievements",color:"from-green-500 to-emerald-500",bg:"bg-green-50"},{icon:pd,title:"AI Pronunciation",description:"Hear native pronunciation and get AI-powered feedback on your speaking",color:"from-orange-500 to-red-500",bg:"bg-orange-50"},{icon:Vs,title:"Writing Canvas",description:"Trace and practice writing Malayalam characters with stroke guidance",color:"from-cyan-500 to-blue-500",bg:"bg-cyan-50"},{icon:Xn,title:"Community & Teams",description:"Learn together with friends, join teams, and compete on leaderboards",color:"from-violet-500 to-purple-500",bg:"bg-violet-50"}],h=[{number:"50+",label:"Characters",icon:wa},{number:"200+",label:"Quiz Questions",icon:dA},{number:"15+",label:"Lesson Types",icon:jv},{number:"7",label:"Streak Milestones",icon:ma}];return a.jsxs("div",{className:"min-h-screen bg-gradient-to-b from-blue-50 via-white to-blue-50",children:[a.jsx("nav",{className:"bg-white/80 backdrop-blur-md shadow-sm sticky top-0 z-50 border-b border-blue-100/50",children:a.jsxs("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-2 flex justify-between items-center",children:[a.jsx("div",{className:"flex items-center gap-3",children:a.jsx("img",{src:Po,alt:"Neela Malayalam",className:"h-12 sm:h-14 w-auto object-contain"})}),a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsxs(Y,{onClick:()=>e("/audio-admin"),onMouseEnter:c,size:"sm",className:`bg-green-500 hover:bg-green-600 text-white font-bold shadow-lg border-2 border-green-400 transition-all duration-300 hidden sm:flex ${s?"animate-pulse ring-2 ring-green-300 ring-offset-1 scale-105":""}`,children:[a.jsx(Xe,{className:`w-4 h-4 mr-1.5 ${s?"animate-bounce":""}`}),"Audio"]}),a.jsxs(Y,{onClick:l,variant:"ghost",size:"sm",disabled:r,className:"text-blue-600 hover:text-blue-700 hover:bg-blue-50",children:[a.jsx(Bt,{className:"w-4 h-4 mr-1.5"}),r?"Loading...":"Try Demo"]}),a.jsx(Y,{onClick:()=>e("/login"),size:"sm",variant:"outline",className:"border-blue-200",children:"Login"}),a.jsx(Y,{onClick:()=>e("/login?view=signup"),size:"sm",className:"bg-gradient-to-r from-blue-600 to-indigo-600 hover:from-blue-700 hover:to-indigo-700 shadow-md",children:"Sign Up"})]})]})}),a.jsxs("section",{className:"relative overflow-hidden",children:[a.jsxs("div",{className:"relative w-full",children:[a.jsx("img",{src:p6,alt:"Neela Malayalam - Learn Malayalam with Neela the Hyacinth Macaw",className:"w-full h-auto object-cover",style:{maxHeight:"520px",objectPosition:"center"}}),a.jsx("div",{className:"absolute bottom-0 left-0 right-0 h-32 bg-gradient-to-t from-blue-50 to-transparent"}),a.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-blue-900/20 via-trans
732parent to-blue-900/20"})]}),a.jsxs("div",{className:"relative bg-gradient-to-b from-blue-50 to-white py-12 md:py-16 px-4",children:[a.jsx("div",{className:"absolute top-0 right-0 w-96 h-96 bg-blue-200/20 rounded-full blur-3xl -translate-y-1/2 translate-x-1/2"}),a.jsx("div",{className:"absolute bottom-0 left-0 w-72 h-72 bg-indigo-200/20 rounded-full blur-3xl translate-y-1/2 -translate-x-1/2"}),a.jsxs("div",{className:"max-w-5xl mx-auto text-center relative",children:[a.jsxs("div",{className:"inline-flex items-center gap-2 bg-gradient-to-r from-blue-100 to-indigo-100 text-blue-700 px-4 py-2 rounded-full text-sm font-medium mb-6 border border-blue-200/50",children:[a.jsx(Cf,{className:"w-4 h-4"}),"Powered by AI & Guided by Neela"]}),a.jsxs("h2",{className:"text-4xl md:text-6xl font-bold text-gray-900 mb-6 leading-tight",children:["Master Malayalam Script with"," ",a.jsx("span",{className:"text-transparent bg-clip-text bg-gradient-to-r from-blue-600 via-indigo-600 to-blue-500",children:"Neela"})]}),a.jsxs("p",{className:"text-xl text-gray-600 mb-8 leading-relaxed max-w-3xl mx-auto",children:["Learn to read and write Malayalam through interactive lessons, AI-powered pronunciation feedback, and your personal"," ",a.jsx("span",{className:"font-semibold text-blue-600",children:"Hyacinth Macaw"})," companion who celebrates every milestone with you."]}),a.jsxs("div",{className:"flex flex-wrap gap-4 justify-center",children:[a.jsx(Y,{onClick:()=>e("/login?view=signup"),size:"lg",className:"bg-gradient-to-r from-blue-600 to-indigo-600 hover:from-blue-700 hover:to-indigo-700 text-lg px-8 py-6 shadow-lg shadow-blue-200 rounded-xl",children:"Get Started Free"}),a.jsxs(Y,{onClick:l,size:"lg",variant:"outline",disabled:r,className:"text-lg px-8 py-6 border-blue-300 text-blue-600 hover:bg-blue-50 rounded-xl",children:[a.jsx(Bt,{className:"w-5 h-5 mr-2"}),r?"Loading...":"Try Demo"]})]}),a.jsx("div",{className:"flex items-center gap-6 mt-10 flex-wrap justify-center",children:[{icon:ma,label:"Daily Streaks",desc:"Stay motivated",color:"text-orange-500",bg:"bg-orange-100"},{icon:pd,label:"AI Feedback",desc:"Pronunciation",color:"text-green-500",bg:"bg-green-100"},{icon:Vs,label:"Writing Canvas",desc:"Trace & learn",color:"text-purple-500",bg:"bg-purple-100"}].map((d,f)=>a.jsxs("div",{className:"flex items-center gap-2 bg-white rounded-xl px-4 py-2 shadow-sm border border-gray-100",children:[a.jsx("div",{className:`w-10 h-10 ${d.bg} rounded-full flex items-center justify-center`,children:a.jsx(d.icon,{className:`w-5 h-5 ${d.color}`})}),a.jsxs("div",{className:"text-left",children:[a.jsx("p",{className:"text-sm font-bold text-gray-800",children:d.label}),a.jsx("p",{className:"text-xs text-gray-500",children:d.desc})]})]},f))})]})]})]}),a.jsx("section",{className:"py-8 px-4 bg-gradient-to-r from-blue-600 via-indigo-600 to-blue-700",children:a.jsx("div",{className:"max-w-5xl mx-auto",children:a.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-6",children:h.map((d,f)=>a.jsxs("div",{className:"text-center text-white",children:[a.jsx(d.icon,{className:"w-6 h-6 mx-auto mb-2 text-blue-200"}),a.jsx("p",{className:"text-3xl font-bold",children:d.number}),a.jsx("p",{className:"text-sm text-blue-200",children:d.label})]},f))})})}),a.jsx("section",{className:"py-20 px-4 bg-white",children:a.jsxs("div",{className:"max-w-6xl mx-auto",children:[a.jsxs("div",{className:"text-center mb-12",children:[a.jsxs("div",{className:"inline-flex items-center gap-2 bg-blue-100 text-blue-700 px-4 py-2 rounded-full text-sm font-medium mb-4",children:[a.jsx(Cf,{className:"w-4 h-4"}),"Your Learning Companion"]}),a.jsx("h3",{className:"text-4xl font-bold text-gray-900 mb-4",children:"Meet Neela, Your Hyacinth Macaw"}),a.jsx("p",{className:"text-lg text-gray-600 max-w-2xl mx-auto",children:"Neela adapts to your learning journey — celebrating wins, encouraging practice, and guiding you through every lesson with bilingual tips."})]}),a.jsx("div",{className:"grid md:grid-cols-2 lg:grid-cols-4 gap-6",children:[{img:Ds.happy,label:"Happy",desc:"When you practice daily",color:"from-blue-400 to-cyan-400",border:"border-blue-200"},{img:Ds.celebrating,label:"Celebrating",desc:"Perfect scores & milestones!",color:"from-yellow-400 to-amber-400",border:"border-yellow-200"},{img:Ds.thinking,label:"Thinking",desc:"Helping you solve problems",color:"from-purple-400 to-indigo-400",border:"border-purple-200"},{img:Ds.reading,label:"Reading",desc:"Studying alongside you",color:"from-green-400 to-emerald-400",border:"border-green-200"}].map((d,f)=>a.jsxs("div",{className:`text-center p-6 rounded-2xl bg-white shadow-lg border ${d.border} hover:shadow-xl transition-all duration-300 hover:-translate-y-1`,children:[a.jsxs("div",{className:"relative mx-auto w-24 h-24 mb-4",children:[a.jsx("div",{className:`absolute inset-0 bg-gradient-to-br ${d.color} rounded-full opacity-20 scale-110`}),a.jsx("img",{src:d.img,alt:d.label,className:"w-24 h-24 rounded-full object-cover mx-auto border-3 border-white shadow-md relative z-10"})]}),a.jsx("p",{className:"text-lg font-bold text-gray-800",children:d.label}),a.jsx("p",{className:"text-sm text-gray-500 mt-1",children:d.desc})]},f))})]})}),a.jsx("section",{className:"py-8 px-4 bg-gradient-to-r from-amber-400 via-yellow-400 to-amber-400",children:a.jsx("div",{className:"max-w-4xl mx-auto text-center",children:a.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-center gap-4",children:[a.jsx("img",{src:Ds.celebrating,alt:"Neela",className:"w-12 h-12 rounded-full object-cover border-2 border-white shadow-lg"}),a.jsxs("div",{className:"text-amber-900",children:[a.jsx("h3",{className:"text-xl font-semibold",children:"Want to see how it works?"}),a.jsx("p",{className:"text-amber-800",children:"Try the full app instantly — no sign up required"})]}),a.jsxs(Y,{onClick:l,size:"lg",disabled:r,className:"bg-amber-900 hover:bg-amber-950 text-white whitespace-nowrap shadow-lg",children:[a.jsx(Bt,{className:"w-5 h-5 mr-2"}),r?"Loading...":"Launch Demo"]})]})})}),a.jsx("section",{className:"py-20 px-4 bg-gradient-to-b from-white to-blue-50",children:a.jsxs("div",{className:"max-w-7xl mx-auto",children:[a.jsxs("div",{className:"text-center mb-12",children:[a.jsx("h3",{className:"text-4xl font-bold mb-4 text-gray-900",children:"Everything You Need to Learn Malayalam"}),a.jsx("p",{className:"text-lg text-gray-600",children:"Comprehensive tools designed for effective learning with Neela"})]}),a.jsx("div",{className:"grid md:grid-cols-2 lg:grid-cols-3 gap-6",children:u.map((d,f)=>a.jsx(se,{className:"hover:shadow-xl transition-all duration-300 hover:-translate-y-1 border-0 shadow-lg overflow-hidden group",children:a.jsxs(ue,{className:"p-6",children:[a.jsx("div",{className:`w-14 h-14 ${d.bg} rounded-2xl flex items-center justify-center mb-4 group-hover:scale-110 transition-transform duration-300`,children:a.jsx(d.icon,{className:`w-7 h-7 bg-gradient-to-r ${d.color} bg-clip-text`,style:{color:d.color.includes("blue")?"#3b82f6":d.color.includes("purple")?"#8b5cf6":d.color.includes("green")?"#22c55e":d.color.includes("orange")?"#f97316":d.color.includes("cyan")?"#06b6d4":"#8b5cf6"}})}),a.jsx("h4",{className:"text-xl font-semibold mb-2 text-gray-800",children:d.title}),a.jsx("p",{className:"text-gray-600",children:d.description})]})},f))})]})}),a.jsx("section",{className:"py-20 px-4 bg-white",children:a.jsxs("div",{className:"max-w-5xl mx-auto",children:[a.jsxs("div",{className:"text-center mb-12",children:[a.jsx("h3",{className:"text-4xl font-bold mb-4 text-gray-900",children:"How Neela Malayalam Works"}),a.jsx("p",{className:"text-lg text-gray-600",children:"Three simple steps to start your Malayalam journey"})]}),a.jsx("div",{className:"grid md:grid-cols-3 gap-8",children:[{step:"1",title:"Meet Neela",desc:"Sign up and meet your Hyacinth Macaw companion who adapts to your learning style",icon:Cf,color:"from-blue-500 to-indigo-500"},{step:"2",title:"Learn & Practice",desc:"Interactive lessons with writing canvas, audio pronunciation, and Neela's bilingual tips",icon:jv,color:"from-purple-500 to-pink-500"},{step:"3",title:"Track & Celebrate",desc:"Build daily streaks, earn badges, and watch Neela celebrate your achievements",icon:Ec,color:"from-
732amber-500 to-orange-500"}].map((d,f)=>a.jsxs("div",{className:"text-center relative",children:[a.jsx("div",{className:`w-16 h-16 bg-gradient-to-r ${d.color} rounded-2xl flex items-center justify-center mx-auto mb-4 shadow-lg`,children:a.jsx(d.icon,{className:"w-8 h-8 text-white"})}),a.jsx("div",{className:"absolute -top-2 -right-2 md:right-auto md:left-1/2 md:translate-x-6 w-8 h-8 bg-white border-2 border-blue-200 rounded-full flex items-center justify-center text-sm font-bold text-blue-600 shadow-sm",children:d.step}),a.jsx("h4",{className:"text-xl font-bold text-gray-800 mb-2",children:d.title}),a.jsx("p",{className:"text-gray-600",children:d.desc})]},f))})]})}),a.jsx("section",{className:"py-16 px-4 bg-gradient-to-r from-orange-50 to-amber-50",children:a.jsx("div",{className:"max-w-5xl mx-auto",children:a.jsxs("div",{className:"grid md:grid-cols-2 gap-12 items-center",children:[a.jsxs("div",{children:[a.jsxs("div",{className:"inline-flex items-center gap-2 bg-orange-100 text-orange-700 px-3 py-1.5 rounded-full text-sm font-medium mb-4",children:[a.jsx(ma,{className:"w-4 h-4"}),"Streak System"]}),a.jsx("h3",{className:"text-3xl font-bold text-gray-900 mb-4",children:"Build Habits with Daily Streaks"}),a.jsx("p",{className:"text-gray-600 mb-6 leading-relaxed",children:"Neela tracks your daily practice and celebrates milestones with you. Earn streak freezes, unlock badges, and watch Neela get happier the more you learn!"}),a.jsx("div",{className:"space-y-3",children:[{days:"3 days",reward:"Neela waves at you!",xp:"+50 XP"},{days:"7 days",reward:"Streak freeze earned!",xp:"+100 XP"},{days:"30 days",reward:"Golden feather badge!",xp:"+500 XP"},{days:"100 days",reward:"Legendary status!",xp:"+1500 XP"}].map((d,f)=>a.jsxs("div",{className:"flex items-center gap-3 bg-white rounded-xl p-3 shadow-sm border border-orange-100",children:[a.jsx("div",{className:"w-10 h-10 bg-gradient-to-r from-orange-400 to-red-400 rounded-full flex items-center justify-center text-white font-bold text-sm shadow-md",children:d.days.split(" ")[0]}),a.jsxs("div",{className:"flex-1",children:[a.jsx("p",{className:"text-sm font-semibold text-gray-800",children:d.days}),a.jsx("p",{className:"text-xs text-gray-500",children:d.reward})]}),a.jsx("span",{className:"text-xs font-bold text-orange-600 bg-orange-50 px-2 py-1 rounded-full",children:d.xp})]},f))})]}),a.jsx("div",{className:"flex justify-center",children:a.jsxs("div",{className:"relative",children:[a.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-orange-300 to-amber-300 rounded-3xl blur-xl opacity-20 scale-110"}),a.jsxs("div",{className:"relative bg-white rounded-3xl p-6 shadow-xl border border-orange-100",children:[a.jsx("img",{src:Po,alt:"Neela Malayalam Logo",className:"w-64 h-64 object-contain mx-auto"}),a.jsx("p",{className:"text-center text-sm text-gray-500 mt-3 font-medium",children:"Your companion on every step"})]})]})})]})})}),a.jsxs("section",{className:"py-20 px-4 bg-gradient-to-br from-blue-600 via-indigo-600 to-blue-700 text-white relative overflow-hidden",children:[a.jsx("div",{className:"absolute top-0 right-0 w-64 h-64 bg-white/5 rounded-full blur-2xl"}),a.jsx("div",{className:"absolute bottom-0 left-0 w-48 h-48 bg-white/5 rounded-full blur-2xl"}),a.jsx("div",{className:"absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-96 h-96 bg-white/3 rounded-full blur-3xl"}),a.jsxs("div",{className:"max-w-4xl mx-auto text-center relative",children:[a.jsx("div",{className:"flex justify-center mb-6",children:a.jsxs("div",{className:"relative",children:[a.jsx("div",{className:"absolute inset-0 bg-white/20 rounded-3xl blur-xl scale-150"}),a.jsx("img",{src:Po,alt:"Neela Malayalam",className:"w-32 h-32 object-contain relative z-10 drop-shadow-2xl"})]})}),a.jsx("h3",{className:"text-4xl md:text-5xl font-bold mb-6",children:"Ready to Start Learning?"}),a.jsx("p",{className:"text-xl mb-8 text-blue-100 max-w-2xl mx-auto",children:"Join learners mastering Malayalam script with Neela by their side. Start your journey today!"}),a.jsxs("div",{className:"flex flex-wrap justify-center gap-4",children:[a.jsx(Y,{onClick:()=>e("/login?view=signup"),size:"lg",className:"bg-white text-blue-600 hover:bg-blue-50 text-lg px-8 py-6 shadow-xl rounded-xl font-bold",children:"Get Started Now"}),a.jsxs(Y,{onClick:l,size:"lg",variant:"outline",disabled:r,className:"text-lg px-8 py-6 border-white/50 text-white hover:bg-white/10 rounded-xl",children:[a.jsx(Bt,{className:"w-5 h-5 mr-2"}),r?"Loading...":"Try Demo First"]})]})]})]}),a.jsx("footer",{className:"bg-gray-900 text-white py-12 px-4",children:a.jsxs("div",{className:"max-w-7xl mx-auto",children:[a.jsxs("div",{className:"grid md:grid-cols-4 gap-8 mb-8",children:[a.jsxs("div",{children:[a.jsx("div",{className:"flex items-center gap-3 mb-4",children:a.jsx("img",{src:Po,alt:"Neela Malayalam",className:"h-12 w-auto object-contain"})}),a.jsx("p",{className:"text-sm text-gray-400",children:"Your comprehensive Malayalam script learning platform with AI-powered tools and a friendly Hyacinth Macaw companion."})]}),a.jsxs("div",{children:[a.jsx("h5",{className:"font-semibold mb-3",children:"Learning"}),a.jsxs("ul",{className:"space-y-2 text-sm text-gray-400",children:[a.jsx("li",{children:a.jsx("button",{onClick:()=>
732e("/login"),className:"hover:text-blue-400 transition-colors",children:"Vowels & Consonants"})}),a.jsx("li",{children:a.jsx("button",{onClick:()=>e("/login"),className:"hover:text-blue-400 transition-colors",children:"Conjunct Consonants"})}),a.jsx("li",{children:a.jsx("button",{onClick:()=>e("/login"),className:"hover:text-blue-400 transition-colors",children:"Phonetics"})}),a.jsx("li",{children:a.jsx("button",{onClick:()=>e("/login"),className:"hover:text-blue-400 transition-colors",children:"Writing Practice"})})]})]}),a.jsxs("div",{children:[a.jsx("h5",{className:"font-semibold mb-3",children:"Features"}),a.jsxs("ul",{className:"space-y-2 text-sm text-gray-400",children:[a.jsx("li",{children:a.jsx("button",{onClick:()=>e("/login"),className:"hover:text-blue-400 transition-colors",children:"Interactive Quizzes"})}),a.jsx("li",{children:a.jsx("button",{onClick:()=>e("/login"),className:"hover:text-blue-400 transition-colors",children:"AI Pronunciation"})}),a.jsx("li",{children:a.jsx("button",{onClick:()=>e("/login"),className:"hover:text-blue-400 transition-colors",children:"Daily Streaks"})}),a.jsx("li",{children:a.jsx("button",{onClick:()=>e("/login"),className:"hover:text-blue-400 transition-colors",children:"Community"})})]})]}),a.jsxs("div",{children:[a.jsx("h5",{className:"font-semibold mb-3",children:"Get Started"}),a.jsxs("ul",{className:"space-y-2 text-sm text-gray-400",children:[a.jsx("li",{children:a.jsx("button",{onClick:()=>e("/login?view=signup"),className:"hover:text-blue-400 transition-colors",children:"Create Account"})}),a.jsx("li",{children:a.jsx("button",{onClick:l,className:"hover:text-blue-400 transition-colors",children:"Try Demo"})}),a.jsx("li",{children:a.jsx("button",{onClick:()=>e("/login"),className:"hover:text-blue-400 transition-colors",children:"Sign In"})}),a.jsx("li",{children:a.jsx("a",{href:"https://github.com/Rxhulrxj/Neela-Usa-Malayalee-App",target:"_blank",rel:"noopener noreferrer",className:"hover:text-blue-400 transition-colors",children:"GitHub"})})]})]})]}),a.jsx("div",{className:"border-t border-gray-800 pt-6 text-center text-sm text-gray-500",children:a.jsx("p",{children:"© 2026 Neela Malayalam. All rights reserved."})})]})})]})},bne=e=>e?e.startsWith("demo_")||e==="demo_user_001":!1,wne=()=>{const[e,t]=y.useState(0),{user:r}=Jt();return y.useEffect(()=>{if(!r)return;if(bne(r.id)){t(0);return}if(!$r()){console.log("[useUnreadMessages] Supabase offline, skipping message fetch");return}"Notification"in window&&Notification.permission==="default"&&Notification.requestPermission();const n=async()=>{if($r())try{const{count:s,error:i}=await ne.from("messages").select("*",{count:"exact",head:!0}).eq("receiver_id",r.id).eq("read",!1);if(i){if(st(i)){console.warn("[useUnreadMessages] Network error, will retry later");return}throw i}t(s||0)}catch(s){if(st(s)){console.warn("[useUnreadMessages] Network error fetching unread count");return}console.warn("[useUnreadMessages] Failed to fetch unread count:",s)}};if(n(),!Di()||!$r()){const s=setInterval(()=>{$r()&&n()},3e4);return()=>clearInterval(s)}try{const s=ne.channel("unread-messages").on("postgres_changes",{event:"*",schema:"public",table:"messages",filter:`receiver_id=eq.${r.id}`},async i=>{if(i.eventType==="INSERT"){const o=i.new;if(t(l=>l+1),"Notification"in window&&Notification.permission==="granted")try{const{data:l}=await ne.from("profiles").select("full_name").eq("id",o.sender_id).single();new Notification("New Message",{body:`${(l==null?void 0:l.full_name)||"Someone"}: ${o.content.substring(0,50)}${o.content.length>50?"...":""}`,icon:"/placeholder.svg"})}catch{}}else i.eventType==="UPDATE"&&i.new.read&&!i.old.read&&t(l=>Math.max(0,l-1))}).subscribe(i=>{(i==="CHANNEL_ERROR"||i==="TIMED_OUT")&&console.warn("[useUnreadMessages] Realtime subscription failed")});return()=>{try{ne.removeChannel(s)}catch{}}}catch(s){console.warn("[useUnreadMessages] Failed to set up realtime:",s);const i=setInterval(()=>{$r()&&n()},3e4);return()=>clearInterval(i)}},[r]),e};var a1=0;function X0(){y.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??TP()),document.body.insertAdjacentElement("beforeend",e[1]??TP()),a1++,()=>{a1===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),a1--}},[])}function TP(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.
vendor: 8,784 bytes, line 732
732style.position="fixed",e.style.pointerEvents="none",e}var s1="focusScope.autoFocusOnMount",i1="focusScope.autoFocusOnUnmount",AP={bubbles:!1,cancelable:!0},jne="FocusScope",Rp=y.forwardRef((e,t)=>{const{loop:r=!1,trapped:n=!1,onMountAutoFocus:s,onUnmountAutoFocus:i,...o}=e,[l,c]=y.useState(null),u=Yt(s),h=Yt(i),d=y.useRef(null),f=$e(t,p=>c(p)),m=y.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;y.useEffect(()=>{if(n){let p=function(w){if(m.paused||!l)return;const j=w.target;l.contains(j)?d.current=j:oo(d.current,{select:!0})},v=function(w){if(m.paused||!l)return;const j=w.relatedTarget;j!==null&&(l.contains(j)||oo(d.current,{select:!0}))},x=function(w){if(document.activeElement===document.body)for(const _ of w)_.removedNodes.length>0&&oo(l)};document.addEventListener("focusin",p),document.addEventListener("focusout",v);const b=new MutationObserver(x);return l&&b.observe(l,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",p),document.removeEventListener("focusout",v),b.disconnect()}}},[n,l,m.paused]),y.useEffect(()=>{if(l){OP.add(m);const p=document.activeElement;if(!l.contains(p)){const x=new CustomEvent(s1,AP);l.addEventListener(s1,u),l.dispatchEvent(x),x.defaultPrevented||(_ne(Ene(v6(l)),{select:!0}),document.activeElement===p&&oo(l))}return()=>{l.removeEventListener(s1,u),setTimeout(()=>{const x=new CustomEvent(i1,AP);l.addEventListener(i1,h),l.dispatchEvent(x),x.defaultPrevented||oo(p??document.body,{select:!0}),l.removeEventListener(i1,h),OP.remove(m)},0)}}},[l,u,h,m]);const g=y.useCallback(p=>{if(!r&&!n||m.paused)return;const v=p.key==="Tab"&&!p.altKey&&!p.ctrlKey&&!p.metaKey,x=document.activeElement;if(v&&x){const b=p.currentTarget,[w,j]=Sne(b);w&&j?!p.shiftKey&&x===j?(p.preventDefault(),r&&oo(w,{select:!0})):p.shiftKey&&x===w&&(p.preventDefault(),r&&oo(j,{select:!0})):x===b&&p.preventDefault()}},[r,n,m.paused]);return a.jsx(Ce.div,{tabIndex:-1,...o,ref:f,onKeyDown:g})});Rp.displayName=jne;function _ne(e,{select:t=!1}={}){const r=document.activeElement;for(const n of e)if(oo(n,{select:t}),document.activeElement!==r)return}function Sne(e){const t=v6(e),r=PP(t,e),n=PP(t.reverse(),e);return[r,n]}function v6(e){const t=[],r=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:n=>{const s=n.tagName==="INPUT"&&n.type==="hidden";return n.disabled||n.hidden||s?NodeFilter.FILTER_SKIP:n.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)t.push(r.currentNode);return t}function PP(e,t){for(const r of e)if(!Nne(r,{upTo:t}))return r}function Nne(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function kne(e){return e instanceof HTMLInputElement&&"select"in e}function oo(e,{select:t=!1}={}){if(e&&e.focus){const r=document.activeElement;e.focus({preventScroll:!0}),e!==r&&kne(e)&&t&&e.select()}}var OP=Cne();function Cne(){let e=[];return{add(t){const r=e[0];t!==r&&(r==null||r.pause()),e=MP(e,t),e.unshift(t)},remove(t){var r;e=MP(e,t),(r=e[0])==null||r.resume()}}}function MP(e,t){const r=[...e],n=r.indexOf(t);return n!==-1&&r.splice(n,1),r}function Ene(e){return e.filter(t=>t.tagName!=="A")}function Tne(e){const t=Ane(e),r=y.forwardRef((n,s)=>{const{children:i,...o}=n,l=y.Children.toArray(i),c=l.find(One);if(c){const u=c.props.children,h=l.map(d=>d===c?y.Children.count(u)>1?y.Children.only(null):y.isValidElement(u)?u.props.children:null:d);return a.jsx(t,{...o,ref:s,children:y.isValidElement(u)?y.cloneElement(u,void 0,h):null})}return a.jsx(t,{...o,ref:s,children:i})});return r.displayName=`${e}.Slot`,r}function Ane(e){const t=y.forwardRef((r,n)=>{const{children:s,...i}=r;if(y.isValidElement(s)){const o=Rne(s),l=Mne(i,s.props);return s.type!==y.Fragment&&(l.ref=n?Js(n,o):o),y.cloneElement(s,l)}return y.Children.count(s)>1?y.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Pne=Symbol("radix.slottable");function One(e){return y.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Pne}function Mne(e,t){const r={...t};for(const n in t){const s=e[n],i=t[n];/^on[A-Z]/.test(n)?s&&i?r[n]=(...l)=>{const c=i(...l);return s(...l),c}:s&&(r[n]=s):n==="style"?r[n]={...s,...i}:n==="className"&&(r[n]=[s,i].filter(Boolean).join(" "))}return{...e,...r}}function Rne(e){var n,s;let t=(n=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:n.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=(s=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:s.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}var $ne=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Kc=new WeakMap,Mg=new WeakMap,Rg={},o1=0,x6=function(e){return e&&(e.host||x6(e.parentNode))},Ine=function(e,t){return t.map(function(r){if(e.contains(r))return r;var n=x6(r);return n&&e.contains(n)?n:(console.error("aria-hidden",r,"in not contained inside",e,". Doing nothing"),null)}).filter(function(r){return!!r})},Dne=function(e,t,r,n){var s=Ine(t,Array.isArray(e)?e:[e]);Rg[r]||(Rg[r]=new WeakMap);var i=Rg[r],o=[],l=new Set,c=new Set(s),u=function(d){!d||l.has(d)||(l.add(d),u(d.parentNode))};s.forEach(u);var h=function(d){!d||c.has(d)||Array.prototype.forEach.call(d.children,function(f){if(l.has(f))h(f);else try{var m=f.getAttribute(n),g=m!==null&&m!=="false",p=(Kc.get(f)||0)+1,v=(i.get(f)||0)+1;Kc.set(f,p),i.set(f,v),o.push(f),p===1&&g&&Mg.set(f,!0),v===1&&f.setAttribute(r,"true"),g||f.setAttribute(n,"true")}catch(x){console.error("aria-hidden: cannot operate on ",f,x)}})};return h(t),l.clear(),o1++,function(){o.forEach(function(d){var f=Kc.get(d)-1,m=i.get(d)-1;Kc.set(d,f),i.set(d,m),f||(Mg.has(d)||d.removeAttribute(n),Mg.delete(d)),m||d.removeAttribute(r)}),o1--,o1||(Kc=new WeakMap,Kc=new WeakMap,Mg=new WeakMap,Rg={})}},Q0=function(e,t,r){r===void 0&&(r="data-aria-hidden");var n=Array.from(Array.isArray(e)?e:[e]),s=$ne(e);return s?(n.push.apply(n,Array.from(s.querySelectorAll("[aria-live], script"))),Dne(n,s,r,"aria-hidden")):function(){return null}},Iy="right-scroll-bar-position",Dy="width-before-scroll-bar",Lne="with-scroll-bars-hidden",Fne="--removed-body-scroll-bar-size";function l1(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function zne(e,t){var r=y.useState(function(){return{value:e,callback:t,facade:{get current(){return r.value},set current(n){var s=r.value;s!==n&&(r.value=n,r.callback(n,s))}}}})[0];return r.callback=t,r.facade}var Bne=typeof window<"u"?y.useLayoutEffect:y.useEffect,RP=new WeakMap;function Une(e,t){var r=zne(null,function(n){return e.forEach(function(s){return l1(s,n)})});return Bne(function(){var n=RP.get(r);if(n){var s=new Set(n),i=new Set(e),o=r.current;s.forEach(function(l){i.has(l)||l1(l,null)}),i.forEach(function(l){s.has(l)||l1(l,o)})}RP.set(r,e)},[e]),r}function Wne(e){return e}function Vne(e,t){t===void 0&&(t=Wne);var r=[],n=!1,s={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]:e},useMedium:function(i){var o=t(i,n);return r.push(o),function(){r=r.filter(function(l){return l!==o})}},assignSyncMedium:function(i){for(n=!0;r.length;){var o=r;r=[],o.forEach(i)}r={push:function(l){return i(l)},filter:function(){return r}}},assignMedium:function(i){n=!0;var o=[];if(r.length){var l=r;r=[],l.forEach(i),o=r}var c=function(){var h=o;o=[],h.forEach(i)},u=function(){return Promise.resolve().then(c)};u(),r={push:function(h){o.push(h),u()},filter:function(h){return o=o.filter(h),r}}}};return s}function Hne(e){e===void 0&&(e={});var t=Vne(null);return t.options=Is({async:!0,ssr:!1},e),t}var b6=function(e){var t=e.sideCar,r=ch(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var n=t.read();if(!n)throw new Error("Sidecar medium not found");return y.createElement(n,Is({},r))};b6.isSideCarExport=!0;function qne(e,t){return e.useMedium(t),b6}var w6=Hne(),c1=function(){},J0=y.forwardRef(function(e,t){var r=y.useRef(null),n=y.useState({onScrollCapture:c1,onWheelCapture:c1,onTouchMoveCapture:c1}),s=n[0],i=n[1],o=e.forwardProps,l=e.children,c=e.className,u=e.removeScrollBar,h=e.enabled,d=e.shards,f=e.sideCar,m=e.noRelative,g=e.noIsolation,p=e.inert,v=e.allowPinchZoom,x=e.as,b=x===void 0?"div":x,w=e.gapMode,j=ch(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),_=f,S=Une([r,t]),k=Is(Is({},j),s);return y.createElement(y.Fragment,null,h&&y.createElement(_,{sideCar:w6,removeScrollBar:u,shards:d,noRelative:m,n
vendor: 8,079 bytes, lines 732-772
732oIsolation:g,inert:p,setCallbacks:i,allowPinchZoom:!!v,lockRef:r,gapMode:w}),o?y.cloneElement(y.Children.only(l),Is(Is({},k),{ref:S})):y.createElement(b,Is({},k,{className:c,ref:S}),l))});J0.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};J0.classNames={fullWidth:Dy,zeroRight:Iy};var Gne=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function Kne(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=Gne();return t&&e.setAttribute("nonce",t),e}function Yne(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function Xne(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var Qne=function(){var e=0,t=null;return{add:function(r){e==0&&(t=Kne())&&(Yne(t,r),Xne(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},Jne=function(){var e=Qne();return function(t,r){y.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&r])}},j6=function(){var e=Jne(),t=function(r){var n=r.styles,s=r.dynamic;return e(n,s),null};return t},Zne={left:0,top:0,right:0,gap:0},u1=function(e){return parseInt(e||"",10)||0},eae=function(e){var t=window.getComputedStyle(document.body),r=t[e==="padding"?"paddingLeft":"marginLeft"],n=t[e==="padding"?"paddingTop":"marginTop"],s=t[e==="padding"?"paddingRight":"marginRight"];return[u1(r),u1(n),u1(s)]},tae=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return Zne;var t=eae(e),r=document.documentElement.clientWidth,n=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,n-r+t[2]-t[0])}},rae=j6(),Lu="data-scroll-locked",nae=function(e,t,r,n){var s=e.left,i=e.top,o=e.right,l=e.gap;return r===void 0&&(r="margin"),`
733  .`.concat(Lne,` {
734   overflow: hidden `).concat(n,`;
735   padding-right: `).concat(l,"px ").concat(n,`;
736  }
737  body[`).concat(Lu,`] {
738    overflow: hidden `).concat(n,`;
739    overscroll-behavior: contain;
740    `).concat([t&&"position: relative ".concat(n,";"),r==="margin"&&`
741    padding-left: `.concat(s,`px;
742    padding-top: `).concat(i,`px;
743    padding-right: `).concat(o,`px;
744    margin-left:0;
745    margin-top:0;
746    margin-right: `).concat(l,"px ").concat(n,`;
747    `),r==="padding"&&"padding-right: ".concat(l,"px ").concat(n,";")].filter(Boolean).join(""),`
748  }
749  
750  .`).concat(Iy,` {
751    right: `).concat(l,"px ").concat(n,`;
752  }
753  
754  .`).concat(Dy,` {
755    margin-right: `).concat(l,"px ").concat(n,`;
756  }
757  
758  .`).concat(Iy," .").concat(Iy,` {
759    right: 0 `).concat(n,`;
760  }
761  
762  .`).concat(Dy," .").concat(Dy,` {
763    margin-right: 0 `).concat(n,`;
764  }
765  
766  body[`).concat(Lu,`] {
767    `).concat(Fne,": ").concat(l,`px;
768  }
769`)},$P=function(){var e=parseInt(document.body.getAttribute(Lu)||"0",10);return isFinite(e)?e:0},aae=function(){y.useEffect(function(){return document.body.setAttribute(Lu,($P()+1).toString()),function(){var e=$P()-1;e<=0?document.body.removeAttribute(Lu):document.body.setAttribute(Lu,e.toString())}},[])},sae=function(e){var t=e.noRelative,r=e.noImportant,n=e.gapMode,s=n===void 0?"margin":n;aae();var i=y.useMemo(function(){return tae(s)},[s]);return y.createElement(rae,{styles:nae(i,!t,s,r?"":"!important")})},q_=!1;if(typeof window<"u")try{var $g=Object.defineProperty({},"passive",{get:function(){return q_=!0,!0}});window.addEventListener("test",$g,$g),window.removeEventListener("test",$g,$g)}catch{q_=!1}var Yc=q_?{passive:!1}:!1,iae=function(e){return e.tagName==="TEXTAREA"},_6=function(e,t){if(!(e instanceof Element))return!1;var r=window.getComputedStyle(e);return r[t]!=="hidden"&&!(r.overflowY===r.overflowX&&!iae(e)&&r[t]==="visible")},oae=function(e){return _6(e,"overflowY")},lae=function(e){return _6(e,"overflowX")},IP=function(e,t){var r=t.ownerDocument,n=t;do{typeof ShadowRoot<"u"&&n instanceof ShadowRoot&&(n=n.host);var s=S6(e,n);if(s){var i=N6(e,n),o=i[1],l=i[2];if(o>l)return!0}n=n.parentNode}while(n&&n!==r.body);return!1},cae=function(e){var t=e.scrollTop,r=e.scrollHeight,n=e.clientHeight;return[t,r,n]},uae=function(e){var t=e.scrollLeft,r=e.scrollWidth,n=e.clientWidth;return[t,r,n]},S6=function(e,t){return e==="v"?oae(t):lae(t)},N6=function(e,t){return e==="v"?cae(t):uae(t)},dae=function(e,t){return e==="h"&&t==="rtl"?-1:1},hae=function(e,t,r,n,s){var i=dae(e,window.getComputedStyle(t).direction),o=i*n,l=r.target,c=t.contains(l),u=!1,h=o>0,d=0,f=0;do{if(!l)break;var m=N6(e,l),g=m[0],p=m[1],v=m[2],x=p-v-i*g;(g||x)&&S6(e,l)&&(d+=x,f+=g);var b=l.parentNode;l=b&&b.nodeType===Node.DOCUMENT_FRAGMENT_NODE?b.host:b}while(!c&&l!==document.body||c&&(t.contains(l)||t===l));return(h&&Math.abs(d)<1||!h&&Math.abs(f)<1)&&(u=!0),u},Ig=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},DP=function(e){return[e.deltaX,e.deltaY]},LP=function(e){return e&&"current"in e?e.current:e},fae=function(e,t){return e[0]===t[0]&&e[1]===t[1]},mae=function(e){return`
770  .block-interactivity-`.concat(e,` {pointer-events: none;}
771  .allow-interactivity-`).concat(e,` {pointer-events: all;}
772`)},pae=0,Xc=[];function gae(e){var t=y.useRef([]),r=y.useRef([0,0]),n=y.useRef(),s=y.useState(pae++)[0],i=y.useState(j6)[0],o=y.useRef(e);y.useEffect(function(){o.current=e},[e]),y.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(s));var p=CZ([e.lockRef.current],(e.shards||[]).map(LP),!0).filter(Boolean);return p.forEach(function(v){return v.classList.add("allow-interactivity-".concat(s))}),function(){document.body.classList.remove("block-interactivity-".concat(s)),p.forEach(function(v){return v.classList.remove("allow-interactivity-".concat(s))})}}},[e.inert,e.lockRef.current,e.shards]);var l=y.useCallback(function(p,v){if("touches"in p&&p.touches.length===2||p.type==="wheel"&&p.ctrlKey)return!o.current.allowPinchZoom;var x=Ig(p),b=r.current,w="deltaX"in p?p.deltaX:b[0]-x[0],j="deltaY"in p?p.deltaY:b[1]-x[1],_,S=p.target,k=Math.abs(w)>Math.abs(j)?"h":"v";if("touches"in p&&k==="h"&&S.type==="range")return!1;var P=window.getSelection(),C=P&&P.anchorNode,M=C?C===S||C.contains(S):!1;if(M)return!1;var I=IP(k,S);if(!I)return!0;if(I?_=k:(_=k==="v"?"h":"v",I=IP(k,S)),!I)return!1;if(!n.current&&"changedTouches"in p&&(w||j)&&(n.current=_),!_)return!0;var E=n.current||_;return hae(E,v,p,E==="h"?w:j)},[]),c=y.useCallback(function(p){var v=p;if(!(!Xc.length||Xc[Xc.length-1]!==i)){var x="deltaY"in v?DP(v):Ig(v),b=t.current.filter(function(_){return _.name===v.type&&(_.target===v.target||v.target===_.shadowParent)&&fae(_.delta,x)})[0];if(b&&b.should){v.cancelable&&v.preventDefault();return}if(!b){var w=(o.current.shards||[]).map(LP).filter(Boolean).filter(function(_){return _.contains(v.target)}),j=w.length>0?l(v,w[0]):!o.current.noIsolation;j&&v.cancelable&&v.preventDefault()}}},[]),u=y.useCallback(function(p,v,x,b){var w={name:p,delta:v,target:x,should:b,shadowParent:yae(x)};t.current.push(w),setTimeout(function(){t.current=t.current.filter(function(j){return j!==w})},1)},[]),h=y.useCallback(function(p){r.current=Ig(p),n.current=void 0},[]),d=y.useCallback(function(p){u(p.type,DP(p),p.target,l(p,e.lockRef.current))},[]),f=y.useCallback(function(p){u(p.type,Ig(p),p.target,l(p,e.lockRef.current))},[]);y.useEffect(function(){return Xc.push(i),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener("wheel",c,Yc),document.addEventListener("touchmove",c,Yc),document.addEventListener("touchstart",h,Yc),function(){Xc=Xc.filter(function(p){return p!==i}),document.removeEventListener("wheel",c,Yc),document.removeEventListener("touchmove",c,Yc),document.removeEventListener("touchstart",h,Yc)}},[]);var m=e.removeScrollBar,g=e.inert;return y.createElement(y.Fragment,null,g?y.createElement(i,{styles:mae(s)}):null,m?y.createElement(sae,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function yae(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const vae=qne(w6,gae);var $p=y.forwardRef(function(e,t){return y.createElement(J0,Is({},e,{ref:t,sideCar:vae}))});$p.classNames=J0.classNames;
vendor: 13,925 bytes, line 772
772var Z0="Popover",[k6]=Cr(Z0,[al]),Ip=al(),[xae,ol]=k6(Z0),C6=e=>{const{__scopePopover:t,children:r,open:n,defaultOpen:s,onOpenChange:i,modal:o=!1}=e,l=Ip(t),c=y.useRef(null),[u,h]=y.useState(!1),[d,f]=ln({prop:n,defaultProp:s??!1,onChange:i,caller:Z0});return a.jsx(P0,{...l,children:a.jsx(xae,{scope:t,contentId:Tn(),triggerRef:c,open:d,onOpenChange:f,onOpenToggle:y.useCallback(()=>f(m=>!m),[f]),hasCustomAnchor:u,onCustomAnchorAdd:y.useCallback(()=>h(!0),[]),onCustomAnchorRemove:y.useCallback(()=>h(!1),[]),modal:o,children:r})})};C6.displayName=Z0;var E6="PopoverAnchor",bae=y.forwardRef((e,t)=>{const{__scopePopover:r,...n}=e,s=ol(E6,r),i=Ip(r),{onCustomAnchorAdd:o,onCustomAnchorRemove:l}=s;return y.useEffect(()=>(o(),()=>l()),[o,l]),a.jsx(Pp,{...i,...n,ref:t})});bae.displayName=E6;var T6="PopoverTrigger",A6=y.forwardRef((e,t)=>{const{__scopePopover:r,...n}=e,s=ol(T6,r),i=Ip(r),o=$e(t,s.triggerRef),l=a.jsx(Ce.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":$6(s.open),...n,ref:o,onClick:ye(e.onClick,s.onOpenToggle)});return s.hasCustomAnchor?l:a.jsx(Pp,{asChild:!0,...i,children:l})});A6.displayName=T6;var D2="PopoverPortal",[wae,jae]=k6(D2,{forceMount:void 0}),P6=e=>{const{__scopePopover:t,forceMount:r,children:n,container:s}=e,i=ol(D2,t);return a.jsx(wae,{scope:t,forceMount:r,children:a.jsx(vr,{present:r||i.open,children:a.jsx(th,{asChild:!0,container:s,children:n})})})};P6.displayName=D2;var _d="PopoverContent",O6=y.forwardRef((e,t)=>{const r=jae(_d,e.__scopePopover),{forceMount:n=r.forceMount,...s}=e,i=ol(_d,e.__scopePopover);return a.jsx(vr,{present:n||i.open,children:i.modal?a.jsx(Sae,{...s,ref:t}):a.jsx(Nae,{...s,ref:t})})});O6.displayName=_d;var _ae=Tne("PopoverContent.RemoveScroll"),Sae=y.forwardRef((e,t)=>{const r=ol(_d,e.__scopePopover),n=y.useRef(null),s=$e(t,n),i=y.useRef(!1);return y.useEffect(()=>{const o=n.current;if(o)return Q0(o)},[]),a.jsx($p,{as:_ae,allowPinchZoom:!0,children:a.jsx(M6,{...e,ref:s,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:ye(e.onCloseAutoFocus,o=>{var l;o.preventDefault(),i.current||(l=r.triggerRef.current)==null||l.focus()}),onPointerDownOutside:ye(e.onPointerDownOutside,o=>{const l=o.detail.originalEvent,c=l.button===0&&l.ctrlKey===!0,u=l.button===2||c;i.current=u},{checkForDefaultPrevented:!1}),onFocusOutside:ye(e.onFocusOutside,o=>o.preventDefault(),{checkForDefaultPrevented:!1})})})}),Nae=y.forwardRef((e,t)=>{const r=ol(_d,e.__scopePopover),n=y.useRef(!1),s=y.useRef(!1);return a.jsx(M6,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{var o,l;(o=e.onCloseAutoFocus)==null||o.call(e,i),i.defaultPrevented||(n.current||(l=r.triggerRef.current)==null||l.focus(),i.preventDefault()),n.current=!1,s.current=!1},onInteractOutside:i=>{var c,u;(c=e.onInteractOutside)==null||c.call(e,i),i.defaultPrevented||(n.current=!0,i.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const o=i.target;((u=r.triggerRef.current)==null?void 0:u.contains(o))&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&s.current&&i.preventDefault()}})}),M6=y.forwardRef((e,t)=>{const{__scopePopover:r,trapFocus:n,onOpenAutoFocus:s,onCloseAutoFocus:i,disableOutsidePointerEvents:o,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:u,onInteractOutside:h,...d}=e,f=ol(_d,r),m=Ip(r);return X0(),a.jsx(Rp,{asChild:!0,loop:!0,trapped:n,onMountAutoFocus:s,onUnmountAutoFocus:i,children:a.jsx(Cc,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:h,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:u,onDismiss:()=>f.onOpenChange(!1),children:a.jsx(O0,{"data-state":$6(f.open),role:"dialog",id:f.contentId,...m,...d,ref:t,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)"}})})})}),R6="PopoverClose",kae=y.forwardRef((e,t)=>{const{__scopePopover:r,...n}=e,s=ol(R6,r);return a.jsx(Ce.button,{type:"button",...n,ref:t,onClick:ye(e.onClick,()=>s.onOpenChange(!1))})});kae.displayName=R6;var Cae="PopoverArrow",Eae=y.forwardRef((e,t)=>{const{__scopePopover:r,...n}=e,s=Ip(r);return a.jsx(M0,{...s,...n,ref:t})});Eae.displayName=Cae;function $6(e){return e?"open":"closed"}var Tae=C6,Aae=A6,Pae=P6,I6=O6;const zv=Tae,Bv=Aae,wm=y.forwardRef(({className:e,align:t="center",sideOffset:r=4,...n},s)=>a.jsx(Pae,{children:a.jsx(I6,{ref:s,align:t,sideOffset:r,className:je("z-50 w-72 rounded-md border border-border/40 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 duration-200",e),...n})}));wm.displayName=I6.displayName;var Oae=y.createContext(void 0);function Pc(e){const t=y.useContext(Oae);return e||t||"ltr"}function jm(e,[t,r]){return Math.min(r,Math.max(t,e))}function Mae(e,t){return y.useReducer((r,n)=>t[r][n]??r,e)}var L2="ScrollArea",[D6]=Cr(L2),[Rae,ka]=D6(L2),L6=y.forwardRef((e,t)=>{const{__scopeScrollArea:r,type:n="hover",dir:s,scrollHideDelay:i=600,...o}=e,[l,c]=y.useState(null),[u,h]=y.useState(null),[d,f]=y.useState(null),[m,g]=y.useState(null),[p,v]=y.useState(null),[x,b]=y.useState(0),[w,j]=y.useState(0),[_,S]=y.useState(!1),[k,P]=y.useState(!1),C=$e(t,I=>c(I)),M=Pc(s);return a.jsx(Rae,{scope:r,type:n,dir:M,scrollHideDelay:i,scrollArea:l,viewport:u,onViewportChange:h,content:d,onContentChange:f,scrollbarX:m,onScrollbarXChange:g,scrollbarXEnabled:_,onScrollbarXEnabledChange:S,scrollbarY:p,onScrollbarYChange:v,scrollbarYEnabled:k,onScrollbarYEnabledChange:P,onCornerWidthChange:b,onCornerHeightChange:j,children:a.jsx(Ce.div,{dir:M,...o,ref:C,style:{position:"relative","--radix-scroll-area-corner-width":x+"px","--radix-scroll-area-corner-height":w+"px",...e.style}})})});L6.displayName=L2;var F6="ScrollAreaViewport",z6=y.forwardRef((e,t)=>{const{__scopeScrollArea:r,children:n,nonce:s,...i}=e,o=ka(F6,r),l=y.useRef(null),c=$e(t,l,o.onViewportChange);return a.jsxs(a.Fragment,{children:[a.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:s}),a.jsx(Ce.div,{"data-radix-scroll-area-viewport":"",...i,ref:c,style:{overflowX:o.scrollbarXEnabled?"scroll":"hidden",overflowY:o.scrollbarYEnabled?"scroll":"hidden",...e.style},children:a.jsx("div",{ref:o.onContentChange,style:{minWidth:"100%",display:"table"},children:n})})]})});z6.displayName=F6;var ti="ScrollAreaScrollbar",F2=y.forwardRef((e,t)=>{const{forceMount:r,...n}=e,s=ka(ti,e.__scopeScrollArea),{onScrollbarXEnabledChange:i,onScrollbarYEnabledChange:o}=s,l=e.orientation==="horizontal";return y.useEffect(()=>(l?i(!0):o(!0),()=>{l?i(!1):o(!1)}),[l,i,o]),s.type==="hover"?a.jsx($ae,{...n,ref:t,forceMount:r}):s.type==="scroll"?a.jsx(Iae,{...n,ref:t,forceMount:r}):s.type==="auto"?a.jsx(B6,{...n,ref:t,forceMount:r}):s.type==="always"?a.jsx(z2,{...n,ref:t}):null});F2.displayName=ti;var $ae=y.forwardRef((e,t)=>{const{forceMount:r,...n}=e,s=ka(ti,e.__scopeScrollArea),[i,o]=y.useState(!1);return y.useEffect(()=>{const l=s.scrollArea;let c=0;if(l){const u=()=>{window.clearTimeout(c),o(!0)},h=()=>{c=window.setTimeout(()=>o(!1),s.scrollHideDelay)};return l.addEventListener("pointerenter",u),l.addEventListener("pointerleave",h),()=>{window.clearTimeout(c),l.removeEventListener("pointerenter",u),l.removeEventListener("pointerleave",h)}}},[s.scrollArea,s.scrollHideDelay]),a.jsx(vr,{present:r||i,children:a.jsx(B6,{"data-state":i?"visible":"hidden",...n,ref:t})})}),Iae=y.forwardRef((e,t)=>{const{forceMount:r,...n}=e,s=ka(ti,e.__scopeScrollArea),i=e.orientation==="horizontal",o=tb(()=>c("SCROLL_END"),100),[l,c]=Mae("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return y.useEffect(()=>{if(l==="idle"){const u=window.setTimeout(()=>c("HIDE"),s.scrollHideDelay);return()=>window.clearTimeout(u)}},[l,s.scrollHideDelay,c]),y.useEffect(()=>{const u=s.viewport,h=i?"scrollLeft":"scrollTop";if(u){let d=u[h];const f=()=>{const m=u[h];d!==m&&(c("SCROLL"),o()),d=m};return u.addEventListener("scroll",f),()=>u.removeEventListener("scroll",f)}},[s.viewport,i,c,o]),a.jsx(vr,{present:r||l!=="hidden",children:a.jsx(z2,{"data-state":l==="hidden"?"hidden":"visible",...n,ref:t,onPointerEnter:ye(e.onPointerEnter,()=>c("POINTER_ENTER")),onPointerLeave:ye(e.onPointerLeave,()=>c("POINTER_LEAVE"))})})}),B6=y.forwardRef((e,t)=>{const r=ka(ti,e.__scopeScrollArea),{forceMount:n,...s}=e,[i,o]=y.useState(!1),l=e.orientation==="horizontal",c=tb(()=>{if(r.viewport){const u=r.viewport.offsetWidth<r.viewport.scrollWidth,h=r.viewport.offsetHeight<r.viewport.scrollHeight;o(l?u:h)}},10);return Sd(r.viewport,c),Sd(r.content,c),a.jsx(vr,{present:n||i,children:a.jsx(z2,{"data-state":i?"visible":"hidden",...s,ref:t})})}),z2=y.forwardRef((e,t)=>{const{orientation:r="vertical",...n}=e,s=ka(ti,e.__scopeScrollArea),i=y.useRef(null),o=y.useRef(0),[l,c]=y.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),u=q6(l.viewport,l.content),h={...n,sizes:l,onSizesChange:c,hasThumb:u>0&&u<1,onThumbChange:f=>i.current=f,onThumbPointerUp:()=>o.current=0,onThumbPointerDown:f=>o.current=f};function d(f,m){return Uae(f,o.current,l,m)}return r==="horizontal"?a.jsx(Dae,{...h,ref:t,onThumbPositionChange:()=>{if(s.viewport&&i.current){const f=s.viewport.scrollLeft,m=FP(f,l,s.dir);i.current.style.transform=`translate3d(${m}px, 0, 0)`}},onWheelScroll:f=>{s.viewport&&(s.viewport.scrollLeft=f)},onDragScroll:f=>{s.viewport&&(s.viewport.scrollLeft=d(f,s.dir))}}):r==="vertical"?a.jsx(Lae,{...h,ref:t,onThumbPositionChange:()=>{if(s.viewport&&i.current){const f=s.viewport.scrollTop,m=FP(f,l);i.current.style.transform=`translate3d(0, ${m}px, 0)`}},onWheelScroll:f=>{s.viewport&&(s.viewport.scrollTop=f)},onDragScroll:f=>{s.viewport&&(s.viewport.scrollTop=d(f))}}):null}),Dae=y.forwardRef((e,t)=>{const{sizes:r,onSizesChange:n,...s}=e,i=ka(ti,e.__scopeScrollArea),[o,l]=y.useState(),c=y.useRef(null),u=$e(t,c,i.onScrollbarXChange);return y.useEffect(()=>{c.current&&l(getComputedStyle(c.current))},[c]),a.jsx(W6,{"data-orientation":"horizontal",...s,ref:u,sizes:r,style:{bottom:0,left:i.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:i.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":eb(r)+"px",...e.style},onThumbPointerDown:h=>e.onThumbPointerDown(h.x),onDragScroll:h=>e.onDragScroll(h.x),onWheelScroll:(h,d)=>{if(i.viewport){const f=i.viewport.scrollLeft+h.deltaX;e.onWheelScroll(f),K6(f,d)&&h.preventDefault()}},onResize:()=>{c.current&&i.viewport&&o&&n({content:i.viewport.scrollWidth,viewport:i.viewport.offsetWidth,scrollbar:{size:c.current.clientWidth,paddingStart:Wv(o.paddingLeft),paddingEnd:Wv(o.paddingRight)}})}})}),Lae=y.forwardRef((e,t)=>{const{sizes:r,onSizesChange:n,...s}=e,i=ka(ti,e.__scopeScrollArea),[o,l]=y.useState(),c=y.useRef(null),u=$e(t,c,i.onScrollbarYChange);return y.useEffect(()=>{c.current&&l(getComputedStyle(c.current))},[c]),a.jsx(W6,{"data-orientation":"vertical",...s,ref:u,sizes:r,style:{top:0,right:i.dir==="ltr"?0:void 0,left:i.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":eb(r)+"px",...e.style},onThumbPointerDown:h=>e.onThumbPointerDown(h.y),onDragScroll:h=>e.onDragScroll(h.y),onWheelScroll:(h,d)=>{if(i.viewport){const f=i.viewport.scrollTop+h.deltaY;e.onWheelScroll(f),K6(f,d)&&h.preventDefault()}},onResize:()=>{c.current&&i.viewport&&o&&n({content:i.viewport.scrollHeight,viewport:i.viewport.offsetHeight,scrollbar:{size:c.current.clientHeight,paddingStart:Wv(o.paddingTop),paddingEnd:Wv(o.paddingBottom)}})}})}),[Fae,U6]=D6(ti),W6=y.forwardRef((e,t)=>{const{__scopeScrollArea:r,sizes:n,hasThumb:s,onThumbChange:i,onThumbPointerUp:o,onThumbPointerDown:l,onThumbPositionChange:c,onDragScroll:u,onWheelScroll:h,onResize:d,...f}=e,m=ka(ti,r),[g,p]=y.useState(null),v=$e(t,C=>p(C)),x=y.useRef(null),b=y.useRef(""),w=m.viewport,j=n.content-n.viewport,_=Yt(h),S=Yt(c),k=tb(d,10);function P(C){if(x.current){const M=C.clientX-x.current.left,I=C.clientY-x.current.top;u({x:M,y:I})}}return y.useEffect(()=>{const C=M=>{const I=M.target;(g==null?void 0:g.contains(I))&&_(M,j)};return document.addEventListener("wheel",C,{passive:!1}),()=>document.removeEventListener("wheel",C,{passive:!1})},[w,g,j,_]),y.useEffect(S,[n,S]),Sd(g,k),Sd(m.content,k),a.jsx(Fae,{scope:r,scrollbar:g,hasThumb:s,onThumbChange:Yt(i),onThumbPointerUp:Yt(o),onThumbPositionChange:S,onThumbPointerDown:Yt(l),children:a.jsx(Ce.div,{...f,ref:v,style:{position:"absolute",...f.style},onPointerDown:ye(e.onPointerDown,C=>{C.button===0&&(C.target.setPointerCapture(C.pointerId),x.current=g.getBoundingClientRect(),b.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",m.viewport&&(m.viewport.style.scrollBehavior="auto"),P(C))}),onPointerMove:ye(e.onPointerMove,P),onPointerUp:ye(e.onPointerUp,C=>{const M=C.target;M.hasPointerCapture(C.pointerId)&&M.releasePointerCapture(C.pointerId),document.body.style.webkitUserSelect=b.current,m.viewport&&(m.viewport.style.scrollBehavior=""),x.current=null})})})}),Uv="ScrollAreaThumb",V6=y.forwardRef((e,t)=>
772{const{forceMount:r,...n}=e,s=U6(Uv,e.__scopeScrollArea);return a.jsx(vr,{present:r||s.hasThumb,children:a.jsx(zae,{ref:t,...n})})}),zae=y.forwardRef((e,t)=>{const{__scopeScrollArea:r,style:n,...s}=e,i=ka(Uv,r),o=U6(Uv,r),{onThumbPositionChange:l}=o,c=$e(t,d=>o.onThumbChange(d)),u=y.useRef(void 0),h=tb(()=>{u.current&&(u.current(),u.current=void 0)},100);return y.useEffect(()=>{const d=i.viewport;if(d){const f=()=>{if(h(),!u.current){const m=Wae(d,l);u.current=m,l()}};return l(),d.addEventListener("scroll",f),()=>d.removeEventListener("scroll",f)}},[i.viewport,h,l]),a.jsx(Ce.div,{"data-state":o.hasThumb?"visible":"hidden",...s,ref:c,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...n},onPointerDownCapture:ye(e.onPointerDownCapture,d=>{const m=d.target.getBoundingClientRect(),g=d.clientX-m.left,p=d.clientY-m.top;o.onThumbPointerDown({x:g,y:p})}),onPointerUp:ye(e.onPointerUp,o.onThumbPointerUp)})});V6.displayName=Uv;var B2="ScrollAreaCorner",H6=y.forwardRef((e,t)=>{const r=ka(B2,e.__scopeScrollArea),n=!!(r.scrollbarX&&r.scrollbarY);return r.type!=="scroll"&&n?a.jsx(Bae,{...e,ref:t}):null});H6.displayName=B2;var Bae=y.forwardRef((e,t)=>{const{__scopeScrollArea:r,...n}=e,s=ka(B2,r),[i,o]=y.useState(0),[l,c]=y.useState(0),u=!!(i&&l);return Sd(s.scrollbarX,()=>{var d;const h=((d=s.scrollbarX)==null?void 0:d.offsetHeight)||0;s.onCornerHeightChange(h),c(h)}),Sd(s.scrollbarY,()=>{var d;const h=((d=s.scrollbarY)==null?void 0:d.offsetWidth)||0;s.onCornerWidthChange(h),o(h)}),u?a.jsx(Ce.div,{...n,ref:t,style:{width:i,height:l,position:"absolute",right:s.dir==="ltr"?0:void 0,left:s.dir==="rtl"?0:void 0,bottom:0,...e.style}}):null});function Wv(e){return e?parseInt(e,10):0}function q6(e,t){const r=e/t;return isNaN(r)?0:r}function eb(e){const t=q6(e.viewport,e.content),r=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,n=(e.scrollbar.size-r)*t;return Math.max(n,18)}function Uae(e,t,r,n="ltr"){const s=eb(r),i=s/2,o=t||i,l=s-o,c=r.scrollbar.paddingStart+o,u=r.scrollbar.size-r.scrollbar.paddingEnd-l,h=r.content-r.viewport,d=n==="ltr"?[0,h]:[h*-1,0];return G6([c,u],d)(e)}function FP(e,t,r="ltr"){const n=eb(t),s=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,i=t.scrollbar.size-s,o=t.content-t.viewport,l=i-n,c=r==="ltr"?[0,o]:[o*-1,0],u=jm(e,c);return G6([0,o],[0,l])(u)}function G6(e,t){return r=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const n=(t[1]-t[0])/(e[1]-e[0]);return t[0]+n*(r-e[0])}}function K6(e,t){return e>0&&e<t}var Wae=(e,t=()=>{})=>{let r={left:e.scrollLeft,top:e.scrollTop},n=0;return function s(){const i={left:e.scrollLeft,top:e.scrollTop},o=r.left!==i.left,l=r.top!==i.top;(o||l)&&t(),r=i,n=window.requestAnimationFrame(s)}(),()=>window.cancelAnimationFrame(n)};function tb(e,t){const r=Yt(e),n=y.useRef(0);return y.useEffect(()=>()=>window.clearTimeout(n.current),[]),y.useCallback(()=>{window.clearTimeout(n.current),n.current=window.setTimeout(r,t)},[r,t])}function Sd(e,t){const r=Yt(t);Qt(()=>{let n=0;if(e){const s=new ResizeObserver(()=>{cancelAnimationFrame(n),n=window.requestAnimationFrame(r)});return s.observe(e),()=>{window.cancelAnimationFrame(n),s.unobserve(e)}}},[e,r])}var Y6=L6,Vae=z6,Hae=H6;const Dp=y.forwardRef(({className:e,children:t,hideScrollbar:r=!1,...n},s)=>a.jsxs(Y6,{ref:s,className:je("relative overflow-hidden",e),...n,children:[a.jsx(Vae,{className:"h-full w-full rounded-[inherit]",children:t}),!r&&a.jsx(X6,{}),a.jsx(Hae,{})]}));Dp.displayName=Y6.displayName;const X6=y.forwardRef(({className:e,orientation:t="vertical",...r},n)=>a.jsx(F2,{ref:n,orientation:t,className:je("flex touch-none select-none transition-colors duration-300",t==="vertical"&&"h-full w-2 border-l border-l-transparent p-[1px] hover:w-2.5",t==="horizontal"&&"h-2 flex-col border-t border-t-transparent p-[1px] hover:h-2.5",e),...r,children:a.jsx(V6,{className:"relative flex-1 rounded-full bg-border/50 hover:bg-border/80 transition-colors"})}));X6.displayName=F2.displayName;const qae=kp("inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-all focus:outline-none focus:ring-2 focus:ring-primary 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 border-border",success:"border-transparent bg-green-500/20 text-green-700 dark:text-green-300 border-green-500/30",warning:"border-transparent bg-yellow-500/20 text-yellow-700 dark:text-yellow-300 border-yellow-500/30",info:"border-transparent bg-primary/10 text-primary border-primary/30"},size:{default:"px-2.5 py-0.5 text-xs",sm:"px-2 py-0.5 text-[10px]",lg:"px-3 py-0.5 text-sm"}},defaultVariants:{variant:"default",size:"default"}});function ke({className:e,variant:t,size:r,...n}){return a.jsx("div",{className:je(qae({variant:t,size:r}),e),...n})}const dh=e=>e.startsWith("demo_")||e==="demo_user_001";async function U2(e,t,r,n,s={}){if(dh(e))return console.log("[Notifications] Skipping notification for demo user"),{id:"demo",user_id:e,type:t,title:r,message:n,data:s,read:!1,created_at:new Date().toISOString()};if(!$r())return console.warn("[Notifications] Offline - cannot create notification"),null;try{const{data:i,error:o}=await ne.from("notifications").insert({user_id:e,type:t,title:r,message:n,data:s}).select().single();if(o){if(st(o))return console.warn("[Notifications] Network error creating notification"),null;throw o}return i}catch(i){if(st(i))return console.warn("[Notifications] Network error creating notification"),null;throw i}}async function Gae(e){if(dh(e)||!$r())return 0;try{const{count:t,error:r}=await ne.from("notifications").select("*",{count:"exact",head:!0}).eq("user_id",e).eq("read",!1);if(r){if(st(r))return console.warn("[Notifications] Network error getting unread count"),0;throw r}return t||0}catch(t){if(st(t))return console.warn("[Notifications] Network error getting unread count"),0;throw t}}async function Kae(e){if(dh(e))return[];if(!$r())return[];try{const{data:t,error:r}=await ne.from("notifications").select("*").eq("user_id",e).order("created_at",{ascending:!1}).limit(50);if(r){if(st(r))return console.warn("[Notifications] Network error getting notifications"),[];throw r}return t}catch(t){if(st(t))return console.warn("[Notifications] Network error getting notifications"),[];throw t}}async function Yae(e){if(!(e==="demo"||e.startsWith("demo_"))){if(!$r()){console.warn("[Notifications] Offline - cannot mark as read");return}try{const{error:t}=await ne.from("notifications").update({read:!0}).eq("id",e);if(t){if(st(t)){console.warn("[Notifications] Network error marking as read");return}throw t}}catch(t){if(st(t)){console.warn("[Notifications] Network error marking as read");return}throw t}}}async function Xae(e){if(!dh(e)){if(!$r()){console.warn("[Notifications] Offline - cannot mark all as read");return}try{const{error:t}=await ne.from("notifications").update({read:!0}).eq("user_id",e).eq("read",!1);if(t){if(st(t)){console.warn("[Notifications] Network error marking all as read");return}throw t}}catch(t){if(st(t)){console.warn("[Notifications] Network error marking all as read");return}throw t}}}async function rb(e){if(dh(e))return{user_id:e,challenge_completed:!0,challenge_expiring:!0,new_challenge:!0,member_contribution:!0,push_enabled:!1,email_enabled:!1,email_frequency:"off"};if(!$r())return null;try{const{data:t,error:r}=await ne.from("notification_preferences").select("*").eq("user_id",e).single();if(r&&r.code!=="PGRST116"){if(st(r))return console.warn("[Notifications] Network error getting preferences"),null;throw r}return t}catch(t){if(st(t))return console.warn("[Notifications] Network error getting preferences"),null;throw t}}async function zP(e,t){if(dh(e))return console.log("[Notifications] Skipping preference update for demo user"),{user_id:e,...t};if(!$r())return console.warn("[Notifications] Offline - cannot update preferences"),null;try{const{data:r,error:n}=await ne.from("notification_preferences").upsert({user_id:e,...t,updated_at:new Date().toISOString()}).select().single();if(n){if(st(n))return console.warn("[Notifications] Network error updating preferences"),null;throw n}return r}catch(r){if(st(r))return console.warn("[Notifications] Network error updating preferences"),null;throw r}}function Ir(e){const t=Object.prototype.toString.call(e);return e instanceof Date||typeof e=="object"&&t==="[object Date]"?new e.constructor(+e):typeof e=="number"||t==="[object Number]"||typeof e=="string"||t==="[object String]"?new Date(e):new Date(NaN)}function Qae(e,t){return e instanceof Date?new e.constructor(t):new Date(t)}const Dg=43200,BP=1440;let Jae={};function Zae(){return Jae}function UP(e){const t=Ir(e),r=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return r.setUTCFullYear(t.getFullYear()),+e-+r}function Ly(e,t){const r=Ir(e),n=Ir(t),s=r.getTime()-n.getTime();return s<0?-1:s>0?1:s}function ese(e){return Qae(e,Date.now())}function tse(e,t){const r=Ir(e),n=Ir(t),s=r.getFullYear()-n.getFullYear(),i=r.getMonth()-n.getMonth();return s*12+i}function rse(e){return t=>{const n=(e?Math[e]:Math.trunc)(t);return n===0?0:n}}function nse(e,t){return+Ir(e)-+Ir(t)}
772function ase(e){const t=Ir(e);return t.setHours(23,59,59,999),t}function sse(e){const t=Ir(e),r=t.getMonth();return t.setFullYear(t.getFullYear(),r+1,0),t.setHours(23,59,59,999),t}function ise(e){const t=Ir(e);return+ase(t)==+sse(t)}function ose(e,t){const r=Ir(e),n=Ir(t),s=Ly(r,n),i=Math.abs(tse(r,n));let o;if(i<1)o=0;else{r.getMonth()===1&&r.getDate()>27&&r.setDate(30),r.setMonth(r.getMonth()-s*i);let l=Ly(r,n)===-s;ise(Ir(e))&&i===1&&Ly(e,n)===1&&(l=!1),o=s*(i-Number(l))}return o===0?0:o}function lse(e,t,r){const n=nse(e,t)/1e3;return rse(r==null?void 0:r.roundingMethod)(n)}const cse={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"}},use=(e,t,r)=>{let n;const s=cse[e];return typeof s=="string"?n=s:t===1?n=s.one:n=s.other.replace("{{count}}",t.toString()),r!=null&&r.addSuffix?r.comparison&&r.comparison>0?"in "+n:n+" ago":n};function d1(e){return(t={})=>{const r=t.width?String(t.width):e.defaultWidth;return e.formats[r]||e.formats[e.defaultWidth]}}const dse={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},hse={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},fse={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},mse={date:d1({formats:dse,defaultWidth:"full"}),time:d1({formats:hse,defaultWidth:"full"}),dateTime:d1({formats:fse,defaultWidth:"full"})},pse={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},gse=(e,t,r,n)=>pse[e];function Fh(e){return(t,r)=>{const n=r!=null&&r.context?String(r.context):"standalone";let s;if(n==="formatting"&&e.formattingValues){const o=e.defaultFormattingWidth||e.defaultWidth,l=r!=null&&r.width?String(r.width):o;s=e.formattingValues[l]||e.formattingValues[o]}else{const o=e.defaultWidth,l=r!=null&&r.width?String(r.width):e.defaultWidth;s=e.values[l]||e.values[o]}const i=e.argumentCallback?e.argumentCallback(t):t;return s[i]}}const yse={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},vse={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},xse={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"]},bse={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"]},wse={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"}},jse={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"}},_se=(e,t)=>{const r=Number(e),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"},Sse={ordinalNumber:_se,era:Fh({values:yse,defaultWidth:"wide"}),quarter:Fh({values:vse,defaultWidth:"wide",argumentCallback:e=>e-1}),month:Fh({values:xse,defaultWidth:"wide"}),day:Fh({values:bse,defaultWidth:"wide"}),dayPeriod:Fh({values:wse,defaultWidth:"wide",formattingValues:jse,defaultFormattingWidth:"wide"})};function zh(e){return(t,r={})=>{const n=r.width,s=n&&e.matchPatterns[n]||e.matchPatterns[e.defaultMatchWidth],i=t.match(s);if(!i)return null;const o=i[0],l=n&&e.parsePatterns[n]||e.parsePatterns[e.defaultParseWidth],c=Array.isArray(l)?kse(l,d=>d.test(o)):Nse(l,d=>d.test(o));let u;u=e.valueCallback?e.valueCallback(c):c,u=r.valueCallback?r.valueCallback(u):u;const h=t.slice(o.length);return{value:u,rest:h}}}function Nse(e,t){for(const r in e)if(Object.prototype.hasOwnProperty.call(e,r)&&t(e[r]))return r}function kse(e,t){for(let r=0;r<e.length;r++)if(t(e[r]))return r}function Cse(e){return(t,r={})=>{const n=t.match(e.matchPattern);if(!n)return null;const s=n[0],i=t.match(e.parsePattern);if(!i)return null;let o=e.valueCallback?e.valueCallback(i[0]):i[0];o=r.valueCallback?r.valueCallback(o):o;const l=t.slice(s.length);return{value:o,rest:l}}}const Ese=/^(\d+)(th|st|nd|rd)?/i,Tse=/\d+/i,Ase={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},Pse={any:[/^b/i,/^(a|c)/i]},Ose={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},Mse={any:[/1/i,/2/i,/3/i,/4/i]},Rse={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},$se={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]},Ise={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},Dse={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]},Lse={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},Fse={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}},zse={ordinalNumber:Cse({matchPattern:Ese,parsePattern:Tse,valueCallback:e=>parseInt(e,10)}),era:zh({matchPatterns:Ase,defaultMatchWidth:"wide",parsePatterns:Pse,defaultParseWidth:"any"}),quarter:zh({matchPatterns:Ose,defaultMatchWidth:"wide",parsePatterns:Mse,defaultParseWidth:"any",valueCallback:e=>e+1}),month:zh({matchPatterns:Rse,defaultMatchWidth:"wide",parsePatterns:$se,defaultParseWidth:"any"}),day:zh({matchPatterns:Ise,defaultMatchWidth:"wide",parsePatterns:Dse,defaultParseWidth:"any"}),dayPeriod:zh({matchPatterns:Lse,defaultMatchWidth:"any",parsePatterns:Fse,defaultParseWidth:"any"})},Bse={code:"en-US",formatDistance:use,formatLong:mse,formatRelative:gse,localize:Sse,match:zse,options:{weekStartsOn:0,firstWeekContainsDate:1}};function Use(e,t,r){const n=Zae(),s=(r==null?void 0:r.locale)??n.locale??Bse,i=2520,o=Ly(e,t);if(isNaN(o))throw new RangeError("Invalid time value");const l=Object.assign({},r,{addSuffix:r==null?void 0:r.addSuffix,comparison:o});let c,u;o>0?(c=Ir(t),u=Ir(e)):(c=Ir(e),u=Ir(t));const h=lse(u,c),d=(UP(u)-UP(c))/1e3,f=Math.round((h-d)/60);let m;if(f<2)return r!=null&&r.includeSeconds?h<5?s.formatDistance("lessThanXSeconds",5,l):h<10?s.formatDistance("lessThanXSeconds",10,l):h<20?s.formatDistance("lessThanXSeconds",20,l):h<40?s.formatDistance("halfAMinute",0,l):h<60?s.formatDistance("lessThanXMinutes",1,l):s.formatDistance("xMinutes",1,l):f===0?s.formatDistance("lessThanXMinutes",1,l):s.formatDistance("xMinutes",f,l);if(f<45)return s.formatDistance("xMinutes",f,l);if(f<90)return s.formatDistance("aboutXHours",1,l);if(f<BP){const g=Math.round(f/60);return s.formatDistance("aboutXHours",g,l)}else{if(f<i)return s.formatDistance("xDays",1,l);if(f<Dg){const g=Math.round(f/BP);return s.formatDistance("xDays",g,l)}else if(f<Dg*2)return m=Math.round(f/Dg),s.formatDistance("aboutXMonths",m,l)}if(m=ose(u,c),m<12){const g=Math.round(f/Dg);return s.formatDistance("xMonths",g,l)}else{const g=m%12,p=Math.trunc(m/12);return g<3?s.formatDistance("aboutXYears",p,l):g<9?s.formatDistance("overXYears",p,l):s.formatDistance("almostXYears",p+1,l)}}function W2(e,t){return Use(e,ese(e),t)}const Lg=e=>e?e.startsWith("demo_")||e==="demo_user_001":!1;function WP(){const{user:e}=Jt(),[t,r]=y.useState([]),[n,s]=y.useState(0),[i,o]=y.useState(!1),[l,c]=y.useState(!1);y.useEffect(()=>{if(e){if(Lg(e.id)){r([]),s(0);return}if(!$r()){console.log("[NotificationBell] Supabase offline, skipping notification fetch");return}if(u(),h(),!Di()||!$r()){const m=setInterval(()=>{$r()&&(u(),h())},3e4);return()=>clearInterval(m)}try{const m=ne.channel("notifications").on("postgres_changes",{event:"*",schema:"public",table:"notifications",filter:`user_id=eq.${e.id}`},()=>{u(),h()}).subscribe(g=>{(g==="CHANNEL_ERROR"||g==="TIMED_OUT")&&console.warn("[NotificationBell] Realtime subscription failed")});return()=>{try{ne.removeChannel(m)}catch{}}}catch(m){console.warn("[NotificationBell] Failed to set up realtime:",m);const g=setInterval(()=>{$r()&&(u(),h())},3e4);return()=>clearInterval(g)}}},[e]);const u=async()=>
772{if(!(!e||Lg(e.id))){c(!0);try{const m=await Kae(e.id);r(m)}catch{}finally{c(!1)}}},h=async()=>{if(!(!e||Lg(e.id)))try{const m=await Gae(e.id);s(m)}catch{}},d=async m=>{try{await Yae(m),u(),h()}catch(g){console.warn("[NotificationBell] Failed to mark as read:",g)}},f=async()=>{if(e)try{await Xae(e.id),u(),h()}catch(m){console.warn("[NotificationBell] Failed to mark all as read:",m)}};return e?Lg(e.id)?a.jsxs(zv,{children:[a.jsx(Bv,{asChild:!0,children:a.jsx(Y,{variant:"ghost",size:"icon",className:"relative",children:a.jsx(Vw,{className:"h-5 w-5"})})}),a.jsxs(wm,{className:"w-80 p-0",align:"end",children:[a.jsx("div",{className:"p-4 border-b",children:a.jsx("h3",{className:"font-semibold",children:"Notifications"})}),a.jsxs("div",{className:"p-8 text-center text-muted-foreground",children:[a.jsx(Vw,{className:"h-8 w-8 mx-auto mb-2 opacity-50"}),a.jsx("p",{className:"text-sm",children:"Demo Mode"}),a.jsx("p",{className:"text-xs mt-1",children:"Sign in to receive notifications"})]})]})]}):a.jsxs(zv,{open:i,onOpenChange:o,children:[a.jsx(Bv,{asChild:!0,children:a.jsxs(Y,{variant:"ghost",size:"icon",className:"relative",children:[a.jsx(Vw,{className:"h-5 w-5"}),n>0&&a.jsx(ke,{className:"absolute -top-1 -right-1 h-5 w-5 flex items-center justify-center p-0 text-xs",children:n>9?"9+":n})]})}),a.jsxs(wm,{className:"w-80 p-0",align:"end",children:[a.jsxs("div",{className:"flex items-center justify-between p-4 border-b",children:[a.jsx("h3",{className:"font-semibold",children:"Notifications"}),n>0&&a.jsx(Y,{variant:"ghost",size:"sm",onClick:f,children:"Mark all read"})]}),a.jsx(Dp,{className:"h-96",children:l?a.jsx("div",{className:"p-8 text-center text-muted-foreground",children:a.jsx("div",{className:"animate-pulse",children:"Loading..."})}):t.length===0?a.jsx("div",{className:"p-8 text-center text-muted-foreground",children:"No notifications yet"}):a.jsx("div",{className:"divide-y",children:t.map(m=>a.jsxs("div",{className:`p-4 cursor-pointer hover:bg-accent ${m.read?"":"bg-blue-50"}`,onClick:()=>d(m.id),children:[a.jsx("div",{className:"font-medium",children:m.title}),a.jsx("div",{className:"text-sm text-muted-foreground mt-1",children:m.message}),a.jsx("div",{className:"text-xs text-muted-foreground mt-2",children:W2(new Date(m.created_at),{addSuffix:!0})})]},m.id))})})]})]}):null}function Wse(e,t=[]){let r=[];function n(i,o){const l=y.createContext(o);l.displayName=i+"Context";const c=r.length;r=[...r,o];const u=d=>{var x;const{scope:f,children:m,...g}=d,p=((x=f==null?void 0:f[e])==null?void 0:x[c])||l,v=y.useMemo(()=>g,Object.values(g));return a.jsx(p.Provider,{value:v,children:m})};u.displayName=i+"Provider";function h(d,f){var p;const m=((p=f==null?void 0:f[e])==null?void 0:p[c])||l,g=y.useContext(m);if(g)return g;if(o!==void 0)return o;throw new Error(`\`${d}\` must be used within \`${i}\``)}return[u,h]}const s=()=>{const i=r.map(o=>y.createContext(o));return function(l){const c=(l==null?void 0:l[e])||i;return y.useMemo(()=>({[`__scope${e}`]:{...l,[e]:c}}),[l,c])}};return s.scopeName=e,[n,Vse(s,...t)]}function Vse(...e){const t=e[0];if(e.length===1)return t;const r=()=>{const n=e.map(s=>({useScope:s(),scopeName:s.scopeName}));return function(i){const o=n.reduce((l,{useScope:c,scopeName:u})=>{const d=c(i)[`__scope${u}`];return{...l,...d}},{});return y.useMemo(()=>({[`__scope${t.scopeName}`]:o}),[o])}};return r.scopeName=t.scopeName,r}var Hse=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Q6=Hse.reduce((e,t)=>{const r=V0(`Primitive.${t}`),n=y.forwardRef((s,i)=>{const{asChild:o,...l}=s,c=o?r:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),a.jsx(c,{...l,ref:i})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{}),V2="Progress",H2=100,[qse]=Wse(V2),[Gse,Kse]=qse(V2),J6=y.forwardRef((e,t)=>{const{__scopeProgress:r,value:n=null,max:s,getValueLabel:i=Yse,...o}=e;(s||s===0)&&!VP(s)&&console.error(Xse(`${s}`,"Progress"));const l=VP(s)?s:H2;n!==null&&!HP(n,l)&&console.error(Qse(`${n}`,"Progress"));const c=HP(n,l)?n:null,u=Vv(c)?i(c,l):void 0;return a.jsx(Gse,{scope:r,value:c,max:l,children:a.jsx(Q6.div,{"aria-valuemax":l,"aria-valuemin":0,"aria-valuenow":Vv(c)?c:void 0,"aria-valuetext":u,role:"progressbar","data-state":t8(c,l),"data-value":c??void 0,"data-max":l,...o,ref:t})})});J6.displayName=V2;var Z6="ProgressIndicator",e8=y.forwardRef((e,t)=>
772{const{__scopeProgress:r,...n}=e,s=Kse(Z6,r);return a.jsx(Q6.div,{"data-state":t8(s.value,s.max),"data-value":s.value??void 0,"data-max":s.max,...n,ref:t})});e8.displayName=Z6;function Yse(e,t){return`${Math.round(e/t*100)}%`}function t8(e,t){return e==null?"indeterminate":e===t?"complete":"loading"}function Vv(e){return typeof e=="number"}function VP(e){return Vv(e)&&!isNaN(e)&&e>0}function HP(e,t){return Vv(e)&&!isNaN(e)&&e<=t&&e>=0}function Xse(e,t){return`Invalid prop \`max\` of value \`${e}\` supplied to \`${t}\`. Only numbers greater than 0 are valid max values. Defaulting to \`${H2}\`.`}function Qse(e,t){return`Invalid prop \`value\` of value \`${e}\` supplied to \`${t}\`. The \`value\` prop must be:
773  - a positive number
774  - less than the value passed to \`max\` (or ${H2} if no \`max\` prop is set)
775  - \`null\` or \`undefined\` if the progress is indeterminate.
776
777Defaulting to \`null\`.`}var r8=J6,Jse=e8;const _t=y.forwardRef(({className:e,value:t,variant:r="default",...n},s)=>a.jsx(r8,{ref:s,className:je("relative h-2 w-full overflow-hidden rounded-full bg-secondary/40",e),...n,children:a.jsx(Jse,{className:je("h-full w-full flex-1 transition-all duration-300 ease-in-out",r==="default"&&"bg-primary",r==="success"&&"bg-green-500",r==="warning"&&"bg-yellow-500",r==="error"&&"bg-destructive"),style:{transform:`translateX(-${100-(t||0)}%)`}})}));_t.displayName=r8.displayName;const qP=()=>{const[e,t]=y.useState(Ac()),[r,n]=y.useState(!1),[s,i]=y.useState([]);y.useEffect(()=>{const h=m6();t(h.streakData),h.newMilestones.length>0&&(i(h.newMilestones),n(!0),setTimeout(()=>n(!1),5e3))},[]);const o=pne(28),l=Math.min(100,e.weeklyProgress/e.weeklyGoal*100),c=()=>e.currentStreak>=30?"text-orange-500":e.currentStreak>=7?"text-red-500":e.currentStreak>=3?"text-amber-500":"text-gray-400",u=()=>e.currentStreak>=30?"bg-gradient-to-r from-orange-500 to-red-500":e.currentStreak>=7?"bg-gradient-to-r from-red-500 to-orange-500":e.currentStreak>=3?"bg-gradient-to-r from-amber-500 to-orange-500":"bg-gray-300";return a.jsxs(a.Fragment,{children:[r&&s.length>0&&a.jsx("div",{className:"fixed top-20 left-1/2 -translate-x-1/2 z-[100] animate-in slide-in-from-top-4 fade-in duration-500",children:a.jsxs("div",{className:"bg-gradient-to-r from-yellow-400 via-amber-400 to-orange-400 text-white px-6 py-4 rounded-2xl shadow-2xl flex items-center gap-3",children:[a.jsx(Ec,{className:"w-8 h-8 animate-bounce"}),a.jsxs("div",{children:[a.jsx("p",{className:"font-bold text-lg",children:s[0].title}),a.jsxs("p",{className:"text-sm opacity-90",children:[s[0].description," +",s[0].rewardXP," XP"]})]}),a.jsx("button",{onClick:()=>n(!1),className:"ml-4 hover:opacity-70",children:a.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]})}),a.jsxs(zv,{children:[a.jsx(Bv,{asChild:!0,children:a.jsxs(Y,{variant:"ghost",size:"sm",className:`relative flex items-center gap-1.5 px-3 py-2 rounded-full ${e.currentStreak>0?"hover:bg-orange-50":"hover:bg-gray-50"}`,children:[a.jsx(ma,{className:`w-5 h-5 ${c()} ${e.currentStreak>=7?"animate-pulse":""}`}),a.jsx("span",{className:`text-sm font-bold ${e.currentStreak>0?"text-gray-800":"text-gray-400"}`,children:e.currentStreak}),e.streakFreezes>0&&a.jsx(gi,{className:"w-3.5 h-3.5 text-blue-400"})]})}),a.jsx(wm,{className:"w-80 p-0",align:"end",children:a.jsxs("div",{className:"p-4",children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"font-bold text-lg text-gray-800",children:"Daily Streak"}),a.jsx("p",{className:"text-xs text-gray-500",children:"Keep learning every day!"})]}),a.jsxs("div",{className:`${u()} text-white px-4 py-2 rounded-xl flex items-center gap-2`,children:[a.jsx(ma,{className:"w-5 h-5"}),a.jsx("span",{className:"text-xl font-bold",children:e.currentStreak})]})]}),a.jsxs("div",{className:"grid grid-cols-3 gap-3 mb-4",children:[a.jsxs("div",{className:"bg-orange-50 rounded-lg p-2 text-center",children:[a.jsx("p",{className:"text-lg font-bold text-orange-600",children:e.longestStreak}),a.jsx("p",{className:"text-[10px] text-gray-500",children:"Best Streak"})]}),a.jsxs("div",{className:"bg-blue-50 rounded-lg p-2 text-center",children:[a.jsx("p",{className:"text-lg font-bold text-blue-600",children:e.totalDaysActive}),a.jsx("p",{className:"text-[10px] text-gray-500",children:"Total Days"})]}),a.jsxs("div",{className:"bg-purple-50 rounded-lg p-2 text-center",children:[a.jsx("p",{className:"text-lg font-bold text-purple-600",children:e.streakFreezes}),a.jsxs("p",{className:"text-[10px] text-gray-500 flex items-center justify-center gap-0.5",children:[a.jsx(gi,{className:"w-3 h-3"})," Freezes"]})]})]}),a.jsxs("div",{className:"mb-4",children:[a.jsxs("div",{className:"flex items-center justify-between mb-1.5",children:[a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx(os,{className:"w-4 h-4 text-green-500"}),a.jsx("span",{className:"text-sm font-medium text-gray-700",children:"Weekly Goal"})]}),a.jsxs("span",{className:"text-xs text-gray-500",children:[e.weeklyProgress,"/",e.weeklyGoal," days"]})]}),a.jsx(_t,{value:l,className:"h-2"})]}),a.jsxs("div",{className:"mb-3",children:[a.jsxs("div",{className:"flex items-center gap-1.5 mb-2",children:[a.jsx(rh,{className:"w-4 h-4 text-gray-500"}),a.jsx("span",{className:"text-sm font-medium text-gray-700",children:"Last 4 Weeks"})]}),a.jsxs("div",{className:"grid grid-cols-7 gap-1",children:[["S","M","T","W","T","F","S"].map((h,d)=>a.jsx("div",{className:"text-[9px] text-gray-400 text-center font-medium",children:h},d)),o.map((h,d)=>a.jsx("div",{className:`w-full aspect-square rounded-sm flex items-center justify-center text-[8px] ${h.active?"bg-green-500 text-white":h.frozen?"bg-blue-200 text-blue-600":"bg-gray-100 text-gray-300"}`,title:`${h.date}${h.active?" - Active":h.frozen?" - Freeze used":""}`,children:new Date(h.date).getDate()},d))]}),a.jsxs("div",{className:"flex items-center gap-3 mt-2 text-[10px] text-gray-400",children:[a.jsxs("span",{className:"flex items-center gap-1",children:[a.jsx("span",{className:"w-2 h-2 rounded-sm bg-green-500"})," Active"]}),a.jsxs("span",{className:"flex items-center gap-1",children:[a.jsx("span",{className:"w-2 h-2 rounded-sm bg-blue-200"})," Freeze"]}),a.jsxs("span",{className:"flex items-center gap-1",children:[a.jsx("span",{className:"w-2 h-2 rounded-sm bg-gray-100"})," Missed"]})]})]}),(()=>{const h=e.milestones.find(f=>!f.achieved);if(!h)return null;const d=Math.min(100,e.currentStreak/h.days*100);return a.jsxs("div",{className:"bg-gradient-to-r from-purple-50 to-indigo-50 rounded-lg p-3",children:[a.jsxs("div",{className:"flex items-center justify-between mb-1",children:[a.jsxs("span",{className:"text-xs font-medium text-purple-700",children:["Next: ",h.title]}),a.jsxs("span",{className:"text-xs text-purple-500",children:[e.currentStreak,"/",h.days," days"]})]}),a.jsx(_t,{value:d,className:"h-1.5 mb-1"}),a.jsxs("p",{className:"text-[10px] text-purple-500",children:[h.reward," • +",h.rewardXP," XP"]})]})})()]})})]})]})};var h1="rovingFocusGroup.onEntryFocus",Zse={bubbles:!1,cancelable:!0},Lp="RovingFocusGroup",[G_,n8,eie]=eh(Lp),[tie,nb]=Cr(Lp,[eie]),[rie,nie]=tie(Lp),a8=y.forwardRef((e,t)=>
vendor: 27,167 bytes, lines 777-785
777a.jsx(G_.Provider,{scope:e.__scopeRovingFocusGroup,children:a.jsx(G_.Slot,{scope:e.__scopeRovingFocusGroup,children:a.jsx(aie,{...e,ref:t})})}));a8.displayName=Lp;var aie=y.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:r,orientation:n,loop:s=!1,dir:i,currentTabStopId:o,defaultCurrentTabStopId:l,onCurrentTabStopIdChange:c,onEntryFocus:u,preventScrollOnEntryFocus:h=!1,...d}=e,f=y.useRef(null),m=$e(t,f),g=Pc(i),[p,v]=ln({prop:o,defaultProp:l??null,onChange:c,caller:Lp}),[x,b]=y.useState(!1),w=Yt(u),j=n8(r),_=y.useRef(!1),[S,k]=y.useState(0);return y.useEffect(()=>{const P=f.current;if(P)return P.addEventListener(h1,w),()=>P.removeEventListener(h1,w)},[w]),a.jsx(rie,{scope:r,orientation:n,dir:g,loop:s,currentTabStopId:p,onItemFocus:y.useCallback(P=>v(P),[v]),onItemShiftTab:y.useCallback(()=>b(!0),[]),onFocusableItemAdd:y.useCallback(()=>k(P=>P+1),[]),onFocusableItemRemove:y.useCallback(()=>k(P=>P-1),[]),children:a.jsx(Ce.div,{tabIndex:x||S===0?-1:0,"data-orientation":n,...d,ref:m,style:{outline:"none",...e.style},onMouseDown:ye(e.onMouseDown,()=>{_.current=!0}),onFocus:ye(e.onFocus,P=>{const C=!_.current;if(P.target===P.currentTarget&&C&&!x){const M=new CustomEvent(h1,Zse);if(P.currentTarget.dispatchEvent(M),!M.defaultPrevented){const I=j().filter(W=>W.focusable),E=I.find(W=>W.active),B=I.find(W=>W.id===p),L=[E,B,...I].filter(Boolean).map(W=>W.ref.current);o8(L,h)}}_.current=!1}),onBlur:ye(e.onBlur,()=>b(!1))})})}),s8="RovingFocusGroupItem",i8=y.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:r,focusable:n=!0,active:s=!1,tabStopId:i,children:o,...l}=e,c=Tn(),u=i||c,h=nie(s8,r),d=h.currentTabStopId===u,f=n8(r),{onFocusableItemAdd:m,onFocusableItemRemove:g,currentTabStopId:p}=h;return y.useEffect(()=>{if(n)return m(),()=>g()},[n,m,g]),a.jsx(G_.ItemSlot,{scope:r,id:u,focusable:n,active:s,children:a.jsx(Ce.span,{tabIndex:d?0:-1,"data-orientation":h.orientation,...l,ref:t,onMouseDown:ye(e.onMouseDown,v=>{n?h.onItemFocus(u):v.preventDefault()}),onFocus:ye(e.onFocus,()=>h.onItemFocus(u)),onKeyDown:ye(e.onKeyDown,v=>{if(v.key==="Tab"&&v.shiftKey){h.onItemShiftTab();return}if(v.target!==v.currentTarget)return;const x=oie(v,h.orientation,h.dir);if(x!==void 0){if(v.metaKey||v.ctrlKey||v.altKey||v.shiftKey)return;v.preventDefault();let w=f().filter(j=>j.focusable).map(j=>j.ref.current);if(x==="last")w.reverse();else if(x==="prev"||x==="next"){x==="prev"&&w.reverse();const j=w.indexOf(v.currentTarget);w=h.loop?lie(w,j+1):w.slice(j+1)}setTimeout(()=>o8(w))}}),children:typeof o=="function"?o({isCurrentTabStop:d,hasTabStop:p!=null}):o})})});i8.displayName=s8;var sie={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function iie(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function oie(e,t,r){const n=iie(e.key,r);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(n))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(n)))return sie[n]}function o8(e,t=!1){const r=document.activeElement;for(const n of e)if(n===r||(n.focus({preventScroll:t}),document.activeElement!==r))return}function lie(e,t){return e.map((r,n)=>e[(t+n)%e.length])}var l8=a8,c8=i8;function cie(e){const t=uie(e),r=y.forwardRef((n,s)=>{const{children:i,...o}=n,l=y.Children.toArray(i),c=l.find(hie);if(c){const u=c.props.children,h=l.map(d=>d===c?y.Children.count(u)>1?y.Children.only(null):y.isValidElement(u)?u.props.children:null:d);return a.jsx(t,{...o,ref:s,children:y.isValidElement(u)?y.cloneElement(u,void 0,h):null})}return a.jsx(t,{...o,ref:s,children:i})});return r.displayName=`${e}.Slot`,r}function uie(e){const t=y.forwardRef((r,n)=>{const{children:s,...i}=r;if(y.isValidElement(s)){const o=mie(s),l=fie(i,s.props);return s.type!==y.Fragment&&(l.ref=n?Js(n,o):o),y.cloneElement(s,l)}return y.Children.count(s)>1?y.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var die=Symbol("radix.slottable");function hie(e){return y.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===die}function fie(e,t){const r={...t};for(const n in t){const s=e[n],i=t[n];/^on[A-Z]/.test(n)?s&&i?r[n]=(...l)=>{const c=i(...l);return s(...l),c}:s&&(r[n]=s):n==="style"?r[n]={...s,...i}:n==="className"&&(r[n]=[s,i].filter(Boolean).join(" "))}return{...e,...r}}function mie(e){var n,s;let t=(n=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:n.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=(s=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:s.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}var K_=["Enter"," "],pie=["ArrowDown","PageUp","Home"],u8=["ArrowUp","PageDown","End"],gie=[...pie,...u8],yie={ltr:[...K_,"ArrowRight"],rtl:[...K_,"ArrowLeft"]},vie={ltr:["ArrowLeft"],rtl:["ArrowRight"]},Fp="Menu",[_m,xie,bie]=eh(Fp),[Oc,d8]=Cr(Fp,[bie,al,nb]),ab=al(),h8=nb(),[wie,Mc]=Oc(Fp),[jie,zp]=Oc(Fp),f8=e=>{const{__scopeMenu:t,open:r=!1,children:n,dir:s,onOpenChange:i,modal:o=!0}=e,l=ab(t),[c,u]=y.useState(null),h=y.useRef(!1),d=Yt(i),f=Pc(s);return y.useEffect(()=>{const m=()=>{h.current=!0,document.addEventListener("pointerdown",g,{capture:!0,once:!0}),document.addEventListener("pointermove",g,{capture:!0,once:!0})},g=()=>h.current=!1;return document.addEventListener("keydown",m,{capture:!0}),()=>{document.removeEventListener("keydown",m,{capture:!0}),document.removeEventListener("pointerdown",g,{capture:!0}),document.removeEventListener("pointermove",g,{capture:!0})}},[]),a.jsx(P0,{...l,children:a.jsx(wie,{scope:t,open:r,onOpenChange:d,content:c,onContentChange:u,children:a.jsx(jie,{scope:t,onClose:y.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:h,dir:f,modal:o,children:n})})})};f8.displayName=Fp;var _ie="MenuAnchor",q2=y.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e,s=ab(r);return a.jsx(Pp,{...s,...n,ref:t})});q2.displayName=_ie;var G2="MenuPortal",[Sie,m8]=Oc(G2,{forceMount:void 0}),p8=e=>{const{__scopeMenu:t,forceMount:r,children:n,container:s}=e,i=Mc(G2,t);return a.jsx(Sie,{scope:t,forceMount:r,children:a.jsx(vr,{present:r||i.open,children:a.jsx(th,{asChild:!0,container:s,children:n})})})};p8.displayName=G2;var pa="MenuContent",[Nie,K2]=Oc(pa),g8=y.forwardRef((e,t)=>{const r=m8(pa,e.__scopeMenu),{forceMount:n=r.forceMount,...s}=e,i=Mc(pa,e.__scopeMenu),o=zp(pa,e.__scopeMenu);return a.jsx(_m.Provider,{scope:e.__scopeMenu,children:a.jsx(vr,{present:n||i.open,children:a.jsx(_m.Slot,{scope:e.__scopeMenu,children:o.modal?a.jsx(kie,{...s,ref:t}):a.jsx(Cie,{...s,ref:t})})})})}),kie=y.forwardRef((e,t)=>{const r=Mc(pa,e.__scopeMenu),n=y.useRef(null),s=$e(t,n);return y.useEffect(()=>{const i=n.current;if(i)return Q0(i)},[]),a.jsx(Y2,{...e,ref:s,trapFocus:r.open,disableOutsidePointerEvents:r.open,disableOutsideScroll:!0,onFocusOutside:ye(e.onFocusOutside,i=>i.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>r.onOpenChange(!1)})}),Cie=y.forwardRef((e,t)=>{const r=Mc(pa,e.__scopeMenu);return a.jsx(Y2,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>r.onOpenChange(!1)})}),Eie=cie("MenuContent.ScrollLock"),Y2=y.forwardRef((e,t)=>{const{__scopeMenu:r,loop:n=!1,trapFocus:s,onOpenAutoFocus:i,onCloseAutoFocus:o,disableOutsidePointerEvents:l,onEntryFocus:c,onEscapeKeyDown:u,onPointerDownOutside:h,onFocusOutside:d,onInteractOutside:f,onDismiss:m,disableOutsideScroll:g,...p}=e,v=Mc(pa,r),x=zp(pa,r),b=ab(r),w=h8(r),j=xie(r),[_,S]=y.useState(null),k=y.useRef(null),P=$e(t,k,v.onContentChange),C=y.useRef(0),M=y.useRef(""),I=y.useRef(0),E=y.useRef(null),B=y.useRef("right"),A=y.useRef(0),L=g?$p:y.Fragment,W=g?{as:Eie,allowPinchZoom:!0}:void 0,D=R=>{var q,te;const Q=M.current+R,K=j().filter(X=>!X.disabled),z=document.activeElement,N=(q=K.find(X=>X.ref.current===z))==null?void 0:q.textValue,T=K.map(X=>X.textValue),$=zie(T,Q,N),V=(te=K.find(X=>X.textValue===$))==null?void 0:te.ref.current;(function X(ee){M.current=ee,window.clearTimeout(C.current),ee!==""&&(C.current=window.setTimeout(()=>X(""),1e3))})(Q),V&&setTimeout(()=>V.focus())};y.useEffect(()=>()=>window.clearTimeout(C.current),[]),X0();const U=y.useCallback(R=>{var K,z;return B.current===((K=E.current)==null?void 0:K.side)&&Uie(R,(z=E.current)==null?void 0:z.area)},[]);return a.jsx(Nie,{scope:r,searchRef:M,onItemEnter:y.useCallback(R=>{U(R)&&R.preventDefault()},[U]),onItemLeave:y.useCallback(R=>{var Q;U(R)||((Q=k.current)==null||Q.focus(),S(null))},[U]),onTriggerLeave:y.useCallback(R=>{U(R)&&R.preventDefault()},[U]),pointerGraceTimerRef:I,onPointerGraceIntentChange:y.useCallback(R=>{E.current=R},[]),children:a.jsx(L,{...W,children:a.jsx(Rp,{asChild:!0,trapped:s,onMountAutoFocus:ye(i,R=>{var Q;R.preventDefault(),(Q=k.current)==null||Q.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:a.jsx(Cc,{asChild:!0,disableOutsidePointerEvents:l,onEscapeKeyDown:u,onPointerDownOutside:h,onFocusOutside:d,onInteractOutside:f,onDismiss:m,children:a.jsx(l8,{asChild:!0,...w,dir:x.dir,orientation:"vertical",loop:n,currentTabStopId:_,onCurrentTabStopIdChange:S,onEntryFocus:ye(c,R=>{x.isUsingKeyboardRef.current||R.preventDefault()}),preventScrollOnEntryFocus:!0,children:a.jsx(O0,{role:"menu","aria-orientation":"vertical","data-state":O8(v.open),"data-radix-menu-content":"",dir:x.dir,...b,...p,ref:P,style:{outline:"none",...p.style},onKeyDown:ye(p.onKeyDown,R=>{const K=R.target.closest("[data-radix-menu-content]")===R.currentTarget,z=R.ctrlKey||R.altKey||R.metaKey,N=R.key.length===1;K&&(R.key==="Tab"&&R.preventDefault(),!z&&N&&D(R.key));const T=k.current;if(R.target!==T||!gie.includes(R.key))return;R.preventDefault();const V=j().filter(q=>!q.disabled).map(q=>q.ref.current);u8.includes(R.key)&&V.reverse(),Lie(V)}),onBlur:ye(e.onBlur,R=>{R.currentTarget.contains(R.target)||(window.clearTimeout(C.current),M.current="")}),onPointerMove:ye(e.onPointerMove,Sm(R=>{const Q=R.target,K=A.current!==R.clientX;if(R.currentTarget.contains(Q)&&K){const z=R.clientX>A.current?"right":"left";B.current=z,A.current=R.clientX}}))})})})})})})});g8.displayName=pa;var Tie="MenuGroup",X2=y.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e;return a.jsx(Ce.div,{role:"group",...n,ref:t})});X2.displayName=Tie;var Aie="MenuLabel",y8=y.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e;return a.jsx(Ce.div,{...n,ref:t})});y8.displayName=Aie;var Hv="MenuItem",GP="menu.itemSelect",sb=y.forwardRef((e,t)=>{const{disabled:r=!1,onSelect:n,...s}=e,i=y.useRef(null),o=zp(Hv,e.__scopeMenu),l=K2(Hv,e.__scopeMenu),c=$e(t,i),u=y.useRef(!1),h=()=>{const d=i.current;if(!r&&d){const f=new CustomEvent(GP,{bubbles:!0,cancelable:!0});d.addEventListener(GP,m=>n==null?void 0:n(m),{once:!0}),Xk(d,f),f.defaultPrevented?u.current=!1:o.onClose()}};return a.jsx(v8,{...s,ref:c,disabled:r,onClick:ye(e.onClick,h),onPointerDown:d=>{var f;(f=e.onPointerDown)==null||f.call(e,d),u.current=!0},onPointerUp:ye(e.onPointerUp,d=>{var f;u.current||(f=d.currentTarget)==null||f.click()}),onKeyDown:ye(e.onKeyDown,d=>{const f=l.searchRef.current!=="";r||f&&d.key===" "||K_.includes(d.key)&&(d.currentTarget.click(),d.preventDefault())})})});sb.displayName=Hv;var v8=y.forwardRef((e,t)=>{const{__scopeMenu:r,disabled:n=!1,textValue:s,...i}=e,o=K2(Hv,r),l=h8(r),c=y.useRef(null),u=$e(t,c),[h,d]=y.useState(!1),[f,m]=y.useState("");return y.useEffect(()=>{const g=c.current;g&&m((g.textContent??"").trim())},[i.children]),a.jsx(_m.ItemSlot,{scope:r,disabled:n,textValue:s??f,children:a.jsx(c8,{asChild:!0,...l,focusable:!n,children:a.jsx(Ce.div,{role:"menuitem","data-highlighted":h?"":void 0,"aria-disabled":n||void 0,"data-disabled":n?"":void 0,...i,ref:u,onPointerMove:ye(e.onPointerMove,Sm(g=>{n?o.onItemLeave(g):(o.onItemEnter(g),g.defaultPrevented||g.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:ye(e.onPointerLeave,Sm(g=>o.onItemLeave(g))),onFocus:ye(e.onFocus,()=>d(!0)),onBlur:ye(e.onBlur,()=>d(!1))})})})}),Pie="MenuCheckboxItem",x8=y.forwardRef((e,t)=>{const{checked:r=!1,onCheckedChange:n,...s}=e;return a.jsx(S8,{scope:e.__scopeMenu,checked:r,children:a.jsx(sb,{role:"menuitemcheckbox","aria-checked":qv(r)?"mixed":r,...s,ref:t,"data-state":J2(r),onSelect:ye(s.onSelect,()=>n==null?void 0:n(qv(r)?!0:!r),{checkForDefaultPrevented:!1})})})});x8.displayName=Pie;var b8="MenuRadioGroup",[Oie,Mie]=Oc(b8,{value:void 0,onValueChange:()=>{}}),w8=y.forwardRef((e,t)=>{const{value:r,onValueChange:n,...s}=e,i=Yt(n);return a.jsx(Oie,{scope:e.__scopeMenu,value:r,onValueChange:i,children:a.jsx(X2,{...s,ref:t})})});w8.displayName=b8;var j8="MenuRadioItem",_8=y.forwardRef((e,t)=>{const{value:r,...n}=e,s=Mie(j8,e.__scopeMenu),i=r===s.value;return a.jsx(S8,{scope:e.__scopeMenu,checked:i,children:a.jsx(sb,{role:"menuitemradio","aria-checked":i,...n,ref:t,"data-state":J2(i),onSelect:ye(n.onSelect,()=>{var o;return(o=s.onValueChange)==null?void 0:o.call(s,r)},{checkForDefaultPrevented:!1})})})});_8.displayName=j8;var Q2="MenuItemIndicator",[S8,Rie]=Oc(Q2,{checked:!1}),N8=y.forwardRef((e,t)=>{const{__scopeMenu:r,forceMount:n,...s}=e,i=Rie(Q2,r);return a.jsx(vr,{present:n||qv(i.checked)||i.checked===!0,children:a.jsx(Ce.span,{...s,ref:t,"data-state":J2(i.checked)})})});N8.displayName=Q2;var $ie="MenuSeparator",k8=y.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e;return a.jsx(Ce.div,{role:"separator","aria-orientation":"horizontal",...n,ref:t})});k8.displayName=$ie;var Iie="MenuArrow",C8=y.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e,s=ab(r);return a.jsx(M0,{...s,...n,ref:t})});C8.displayName=Iie;var Die="MenuSub",[WLe,E8]=Oc(Die),df="MenuSubTrigger",T8=y.forwardRef((e,t)=>{const r=Mc(df,e.__scopeMenu),n=zp(df,e.__scopeMenu),s=E8(df,e.__scopeMenu),i=K2(df,e.__scopeMenu),o=y.useRef(null),{pointerGraceTimerRef:l,onPointerGraceIntentChange:c}=i,u={__scopeMenu:e.__scopeMenu},h=y.useCallback(()=>{o.current&&window.clearTimeout(o.current),o.current=null},[]);return y.useEffect(()=>h,[h]),y.useEffect(()=>{const d=l.current;return()=>{window.clearTimeout(d),c(null)}},[l,c]),a.jsx(q2,{asChild:!0,...u,children:a.jsx(v8,{id:s.triggerId,"aria-haspopup":"menu","aria-expanded":r.open,"aria-controls":s.contentId,"data-state":O8(r.open),...e,ref:Js(t,s.onTriggerChange),onClick:d=>{var f;(f=e.onClick)==null||f.call(e,d),!(e.disabled||d.defaultPrevented)&&(d.currentTarget.focus(),r.open||r.onOpenChange(!0))},onPointerMove:ye(e.onPointerMove,Sm(d=>{i.onItemEnter(d),!d.defaultPrevented&&!e.disabled&&!r.open&&!o.current&&(i.onPointerGraceIntentChange(null),o.current=window.setTimeout(()=>{r.onOpenChange(!0),h()},100))})),onPointerLeave:ye(e.onPointerLeave,Sm(d=>{var m,g;h();const f=(m=r.content)==null?void 0:m.getBoundingClientRect();if(f){const p=(g=r.content)==null?void 0:g.dataset.side,v=p==="right",x=v?-5:5,b=f[v?"left":"right"],w=f[v?"right":"left"];i.onPointerGraceIntentChange({area:[{x:d.clientX+x,y:d.clientY},{x:b,y:f.top},{x:w,y:f.top},{x:w,y:f.bottom},{x:b,y:f.bottom}],side:p}),window.clearTimeout(l.current),l.current=window.setTimeout(()=>i.onPointerGraceIntentChange(null),300)}else{if(i.onTriggerLeave(d),d.defaultPrevented)return;i.onPointerGraceIntentChange(null)}})),onKeyDown:ye(e.onKeyDown,d=>{var m;const f=i.searchRef.current!=="";e.disabled||f&&d.key===" "||yie[n.dir].includes(d.key)&&(r.onOpenChange(!0),(m=r.content)==null||m.focus(),d.preventDefault())})})})});T8.displayName=df;var A8="MenuSubContent",P8=y.forwardRef((e,t)=>{const r=m8(pa,e.__scopeMenu),{forceMount:n=r.forceMount,...s}=e,i=Mc(pa,e.__scopeMenu),o=zp(pa,e.__scopeMenu),l=E8(A8,e.__scopeMenu),c=y.useRef(null),u=$e(t,c);return a.jsx(_m.Provider,{scope:e.__scopeMenu,children:a.jsx(vr,{present:n||i.open,children:a.jsx(_m.Slot,{scope:e.__scopeMenu,children:a.jsx(Y2,{id:l.contentId,"aria-labelledby":l.triggerId,...s,ref:u,align:"start",side:o.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:h=>{var d;o.isUsingKeyboardRef.current&&((d=c.current)==null||d.focus()),h.preventDefault()},onCloseAutoFocus:h=>h.preventDefault(),onFocusOutside:ye(e.onFocusOutside,h=>{h.target!==l.trigger&&i.onOpenChange(!1)}),onEscapeKeyDown:ye(e.onEscapeKeyDown,h=>{o.onClose(),h.preventDefault()}),onKeyDown:ye(e.onKeyDown,h=>{var m;const d=h.currentTarget.contains(h.target),f=vie[o.dir].includes(h.key);d&&f&&(i.onOpenChange(!1),(m=l.trigger)==null||m.focus(),h.preventDefault())})})})})})});P8.displayName=A8;function O8(e){return e?"open":"closed"}function qv(e){return e==="indeterminate"}function J2(e){return qv(e)?"indeterminate":e?"checked":"unchecked"}function Lie(e){const t=document.activeElement;for(const r of e)if(r===t||(r.focus(),document.activeElement!==t))return}function Fie(e,t){return e.map((r,n)=>e[(t+n)%e.length])}function zie(e,t,r){const s=t.length>1&&Array.from(t).every(u=>u===t[0])?t[0]:t,i=r?e.indexOf(r):-1;let o=Fie(e,Math.max(i,0));s.length===1&&(o=o.filter(u=>u!==r));const c=o.find(u=>u.toLowerCase().startsWith(s.toLowerCase()));return c!==r?c:void 0}function Bie(e,t){const{x:r,y:n}=e;let s=!1;for(let i=0,o=t.length-1;i<t.length;o=i++){const l=t[i],c=t[o],u=l.x,h=l.y,d=c.x,f=c.y;h>n!=f>n&&r<(d-u)*(n-h)/(f-h)+u&&(s=!s)}return s}function Uie(e,t){if(!t)return!1;const r={x:e.clientX,y:e.clientY};return Bie(r,t)}function Sm(e){return t=>t.pointerType==="mouse"?e(t):void 0}var Wie=f8,Vie=q2,Hie=p8,qie=g8,Gie=X2,Kie=y8,Yie=sb,Xie=x8,Qie=w8,Jie=_8,Zie=N8,eoe=k8,toe=C8,roe=T8,noe=P8,ib="DropdownMenu",[aoe]=Cr(ib,[d8]),hn=d8(),[soe,M8]=aoe(ib),R8=e=>{const{__scopeDropdownMenu:t,children:r,dir:n,open:s,defaultOpen:i,onOpenChange:o,modal:l=!0}=e,c=hn(t),u=y.useRef(null),[h,d]=ln({prop:s,defaultProp:i??!1,onChange:o,caller:ib});return a.jsx(soe,{scope:t,triggerId:Tn(),triggerRef:u,contentId:Tn(),open:h,onOpenChange:d,onOpenToggle:y.useCallback(()=>d(f=>!f),[d]),modal:l,children:a.jsx(Wie,{...c,open:h,onOpenChange:d,dir:n,modal:l,children:r})})};R8.displayName=ib;var $8="DropdownMenuTrigger",I8=y.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,disabled:n=!1,...s}=e,i=M8($8,r),o=hn(r);return a.jsx(Vie,{asChild:!0,...o,children:a.jsx(Ce.button,{type:"button",id:i.triggerId,"aria-haspopup":"menu","aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":i.open?"open":"closed","data-disabled":n?"":void 0,disabled:n,...s,ref:Js(t,i.triggerRef),onPointerDown:ye(e.onPointerDown,l=>{!n&&l.button===0&&l.ctrlKey===!1&&(i.onOpenToggle(),i.open||l.preventDefault())}),onKeyDown:ye(e.onKeyDown,l=>{n||(["Enter"," "].includes(l.key)&&i.onOpenToggle(),l.key==="ArrowDown"&&i.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(l.key)&&l.preventDefault())})})})});I8.displayName=$8;var ioe="DropdownMenuPortal",D8=e=>{const{__scopeDropdownMenu:t,...r}=e,n=hn(t);return a.jsx(Hie,{...n,...r})};D8.displayName=ioe;var L8="DropdownMenuContent",F8=y.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,s=M8(L8,r),i=hn(r),o=y.useRef(!1);return a.jsx(qie,{id:s.contentId,"aria-labelledby":s.triggerId,...i,...n,ref:t,onCloseAutoFocus:ye(e.onCloseAutoFocus,l=>{var c;o.current||(c=s.triggerRef.current)==null||c.focus(),o.current=!1,l.preventDefault()}),onInteractOutside:ye(e.onInteractOutside,l=>{const c=l.detail.originalEvent,u=c.button===0&&c.ctrlKey===!0,h=c.button===2||u;(!s.modal||h)&&(o.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});F8.displayName=L8;var ooe="DropdownMenuGroup",loe=y.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,s=hn(r);return a.jsx(Gie,{...s,...n,ref:t})});loe.displayName=ooe;var coe="DropdownMenuLabel",z8=y.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,s=hn(r);return a.jsx(Kie,{...s,...n,ref:t})});z8.displayName=coe;var uoe="DropdownMenuItem",B8=y.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,s=hn(r);return a.jsx(Yie,{...s,...n,ref:t})});B8.displayName=uoe;var doe="DropdownMenuCheckboxItem",U8=y.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,s=hn(r);return a.jsx(Xie,{...s,...n,ref:t})});U8.displayName=doe;var hoe="DropdownMenuRadioGroup",foe=y.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,s=hn(r);return a.jsx(Qie,{...s,...n,ref:t})});foe.displayName=hoe;var moe="DropdownMenuRadioItem",W8=y.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,s=hn(r);return a.jsx(Jie,{...s,...n,ref:t})});W8.displayName=moe;var poe="DropdownMenuItemIndicator",V8=y.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,s=hn(r);return a.jsx(Zie,{...s,...n,ref:t})});V8.displayName=poe;var goe="DropdownMenuSeparator",H8=y.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,s=hn(r);return a.jsx(eoe,{...s,...n,ref:t})});H8.displayName=goe;var yoe="DropdownMenuArrow",voe=y.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,s=hn(r);return a.jsx(toe,{...s,...n,ref:t})});voe.displayName=yoe;var xoe="DropdownMenuSubTrigger",q8=y.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,s=hn(r);return a.jsx(roe,{...s,...n,ref:t})});q8.displayName=xoe;var boe="DropdownMenuSubContent",G8=y.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,s=hn(r);return a.jsx(noe,{...s,...n,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});G8.displayName=boe;var woe=R8,joe=I8,_oe=D8,K8=F8,Y8=z8,X8=B8,Q8=U8,J8=W8,Z8=V8,eF=H8,tF=q8,rF=G8;const Soe=woe,Noe=joe,koe=y.forwardRef(({className:e,inset:t,children:r,...n},s)=>a.jsxs(tF,{ref:s,className:je("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent/60 focus:text-accent-foreground data-[state=open]:bg-accent/60 data-[state=open]:text-accent-foreground transition-colors",t&&"pl-8",e),...n,children:[r,a.jsx(ns,{className:"ml-auto h-4 w-4"})]}));koe.displayName=tF.displayName;const Coe=y.forwardRef(({className:e,...t},r)=>a.jsx(rF,{ref:r,className:je("z-50 min-w-[8rem] overflow-hidden rounded-md border border-border/40 bg-popover p-1 text-popover-foreground shadow-lg 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 duration-200",e),...t}));Coe.displayName=rF.displayName;const nF=y.forwardRef(({className:e,sideOffset:t=4,...r},n)=>a.jsx(_oe,{children:a.jsx(K8,{ref:n,sideOffset:t,className:je("z-50 min-w-[8rem] overflow-hidden rounded-md border border-border/40 bg-popover/95 backdrop-blur-sm p-1 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 duration-200",e),...r})}));nF.displayName=K8.displayName;const Fy=y.forwardRef(({className:e,inset:t,...r},n)=>a.jsx(X8,{ref:n,className:je("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent/60 focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t&&"pl-8",e),...r}));Fy.displayName=X8.displayName;const Eoe=y.forwardRef(({className:e,children:t,checked:r,...n},s)=>a.jsxs(Q8,{ref:s,className:je("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent/60 focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),checked:r,...n,children:[a.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:a.jsx(Z8,{children:a.jsx(Ri,{className:"h-4 w-4 text-primary"})})}),t]}));Eoe.displayName=Q8.displayName;const Toe=y.forwardRef(({className:e,children:t,...r},n)=>a.jsxs(J8,{ref:n,className:je("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent/60 focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...r,children:[a.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:a.jsx(Z8,{children:a.jsx(bD,{className:"h-2 w-2 fill-current text-primary"})})}),t]}));Toe.displayName=J8.displayName;const aF=y.forwardRef(({className:e,inset:t,...r},n)=>a.jsx(Y8,{ref:n,className:je("px-2 py-1.5 text-sm font-medium text-foreground/80",t&&"pl-8",e),...r}));aF.displayName=Y8.displayName;const zy=y.forwardRef(({className:e,...t},r)=>a.jsx(eF,{ref:r,className:je("-mx-1 my-1 h-px bg-border/60",e),...t}));zy.displayName=eF.displayName;function Aoe(e,t=[]){let r=[];function n(i,o){const l=y.createContext(o);l.displayName=i+"Context";const c=r.length;r=[...r,o];const u=d=>{var x;const{scope:f,children:m,...g}=d,p=((x=f==null?void 0:f[e])==null?void 0:x[c])||l,v=y.useMemo(()=>g,Object.values(g));return a.jsx(p.Provider,{value:v,children:m})};u.displayName=i+"Provider";function h(d,f){var p;const m=((p=f==null?void 0:f[e])==null?void 0:p[c])||l,g=y.useContext(m);if(g)return g;if(o!==void 0)return o;throw new Error(`\`${d}\` must be used within \`${i}\``)}return[u,h]}const s=()=>{const i=r.map(o=>y.createContext(o));return function(l){const c=(l==null?void 0:l[e])||i;return y.useMemo(()=>({[`__scope${e}`]:{...l,[e]:c}}),[l,c])}};return s.scopeName=e,[n,Poe(s,...t)]}function Poe(...e){const t=e[0];if(e.length===1)return t;const r=()=>{const n=e.map(s=>({useScope:s(),scopeName:s.scopeName}));return function(i){const o=n.reduce((l,{useScope:c,scopeName:u})=>{const d=c(i)[`__scope${u}`];return{...l,...d}},{});return y.useMemo(()=>({[`__scope${t.scopeName}`]:o}),[o])}};return r.scopeName=t.scopeName,r}var Ooe=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Z2=Ooe.reduce((e,t)=>{const r=V0(`Primitive.${t}`),n=y.forwardRef((s,i)=>{const{asChild:o,...l}=s,c=o?r:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),a.jsx(c,{...l,ref:i})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{}),sF={exports:{}},iF={};/**
778 * @license React
779 * use-sync-external-store-shim.production.js
780 *
781 * Copyright (c) Meta Platforms, Inc. and affiliates.
782 *
783 * This source code is licensed under the MIT license found in the
784 * LICENSE file in the root directory of this source tree.
785 */var Nd=y;function Moe(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}
785var Roe=typeof Object.is=="function"?Object.is:Moe,$oe=Nd.useState,Ioe=Nd.useEffect,Doe=Nd.useLayoutEffect,Loe=Nd.useDebugValue;function Foe(e,t){var r=t(),n=$oe({inst:{value:r,getSnapshot:t}}),s=n[0].inst,i=n[1];return Doe(function(){s.value=r,s.getSnapshot=t,f1(s)&&i({inst:s})},[e,r,t]),Ioe(function(){return f1(s)&&i({inst:s}),e(function(){f1(s)&&i({inst:s})})},[e]),Loe(r),r}function f1(e){var t=e.getSnapshot;e=e.value;try{var r=t();return!Roe(e,r)}catch{return!0}}function zoe(e,t){return t()}var Boe=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?zoe:Foe;iF.useSyncExternalStore=Nd.useSyncExternalStore!==void 0?Nd.useSyncExternalStore:Boe;sF.exports=iF;var Uoe=sF.exports;function Woe(){return Uoe.useSyncExternalStore(Voe,()=>!0,()=>!1)}function Voe(){return()=>{}}var eC="Avatar",[Hoe]=Aoe(eC),[qoe,oF]=Hoe(eC),lF=y.forwardRef((e,t)=>{const{__scopeAvatar:r,...n}=e,[s,i]=y.useState("idle");return a.jsx(qoe,{scope:r,imageLoadingStatus:s,onImageLoadingStatusChange:i,children:a.jsx(Z2.span,{...n,ref:t})})});lF.displayName=eC;var cF="AvatarImage",uF=y.forwardRef((e,t)=>{const{__scopeAvatar:r,src:n,onLoadingStatusChange:s=()=>{},...i}=e,o=oF(cF,r),l=Goe(n,i),c=Yt(u=>{s(u),o.onImageLoadingStatusChange(u)});return Qt(()=>{l!=="idle"&&c(l)},[l,c]),l==="loaded"?a.jsx(Z2.img,{...i,ref:t,src:n}):null});uF.displayName=cF;var dF="AvatarFallback",hF=y.forwardRef((e,t)=>{const{__scopeAvatar:r,delayMs:n,...s}=e,i=oF(dF,r),[o,l]=y.useState(n===void 0);return y.useEffect(()=>{if(n!==void 0){const c=window.setTimeout(()=>l(!0),n);return()=>window.clearTimeout(c)}},[n]),o&&i.imageLoadingStatus!=="loaded"?a.jsx(Z2.span,{...s,ref:t}):null});hF.displayName=dF;function KP(e,t){return e?t?(e.src!==t&&(e.src=t),e.complete&&e.naturalWidth>0?"loaded":"loading"):"error":"idle"}function Goe(e,{referrerPolicy:t,crossOrigin:r}){const n=Woe(),s=y.useRef(null),i=n?(s.current||(s.current=new window.Image),s.current):null,[o,l]=y.useState(()=>KP(i,e));return Qt(()=>{l(KP(i,e))},[i,e]),Qt(()=>{const c=d=>()=>{l(d)};if(!i)return;const u=c("loaded"),h=c("error");return i.addEventListener("load",u),i.addEventListener("error",h),t&&(i.referrerPolicy=t),typeof r=="string"&&(i.crossOrigin=r),()=>{i.removeEventListener("load",u),i.removeEventListener("error",h)}},[i,r,t]),o}var fF=lF,mF=uF,pF=hF;const _a=y.forwardRef(({className:e,size:t="md",...r},n)=>a.jsx(fF,{ref:n,className:je("relative flex shrink-0 overflow-hidden rounded-full border border-border/30 ring-offset-background",t==="sm"&&"h-8 w-8",t==="md"&&"h-10 w-10",t==="lg"&&"h-12 w-12",t==="xl"&&"h-16 w-16",e),...r}));_a.displayName=fF.displayName;const ds=y.forwardRef(({className:e,...t},r)=>a.jsx(mF,{ref:r,className:je("aspect-square h-full w-full object-cover",e),...t}));ds.displayName=mF.displayName;const Sa=y.forwardRef(({className:e,...t},r)=>a.jsx(pF,{ref:r,className:je("flex h-full w-full items-center justify-center rounded-full bg-muted text-muted-foreground",e),...t}));Sa.displayName=pF.displayName;const YP=["അ","ആ","ക","മ","ന"],hs=()=>{var v;const e=il(),t=ei(),{user:r,signOut:n,isDemo:s}=Jt(),i=wne(),[o,l]=y.useState(!1),[c,u]=y.useState(!1);y.useRef(null);const h=y.useRef(0),d=x=>e.pathname===x,f=()=>{var x,b;return s?"D":(x=r==null?void 0:r.user_metadata)!=null&&x.full_name?r.user_metadata.full_name.split(" ").map(w=>w[0]).join("").toUpperCase():((b=r==null?void 0:r.email)==null?void 0:b[0].toUpperCase())||"U"},m=async()=>{await n(),t("/")},g=()=>l(!1),p=y.useCallback(()=>{const x=Date.now();if(x-h.current<1500||c)return;h.current=x,u(!0);const b=YP[Math.floor(Math.random()*YP.length)],w=["അ","ആ"].includes(b);Fr(b,{type:w?"vowel":"consonant-with-a",volume:.7,onEnd:()=>{u(!1)}}).catch(()=>{u(!1)})},[c]);return a.jsxs(a.Fragment,{children:[a.jsx("nav",{className:"sticky top-0 z-50 bg-white border-b shadow-sm",children:a.jsx("div",{className:"max-w-7xl mx-auto px-4",children:a.jsxs("div",{className:"flex items-center justify-between h-16",children:[a.jsxs(it,{to:"/app",className:"flex items-center gap-2",children:[a.jsx("img",{src:Po,alt:"Neela Malayalam",className:"h-11 w-auto object-contain"}),s&&a.jsx(ke,{className:"ml-0 bg-amber-400 text-amber-900 text-[10px]",children:"Demo"})]}),a.jsxs("div",{className:"hidden lg:flex items-center gap-1",children:[a.jsx(it,{to:"/app",children:a.jsxs(Y,{variant:d("/app")?"secondary":"ghost",size:"sm",children:[a.jsx(mA,{className:"h-4 w-4 mr-1.5"}),"Learn"]})}),a.jsx(it,{to:"/flashcards",children:a.jsxs(Y,{variant:d("/flashcards")?"secondary":"ghost",size:"sm",children:[a.jsx(hA,{className:"h-4 w-4 mr-1.5"}),"Flashcards"]})}),a.jsx(it,{to:"/review",children:a.jsxs(Y,{variant:d("/review")?"secondary":"ghost",size:"sm",children:[a.jsx(Xt,{className:"h-4 w-4 mr-1.5"}),"Review"]})}),a.jsx(it,{to:"/audio-admin",children:a.jsxs(Y,{size:"sm",onMouseEnter:p,className:`bg-green-500 hover:bg-green-600 text-white font-semibold shadow-lg border-2 border-green-400 ml-1 mr-1 transition-all duration-300 ${c?"animate-pulse ring-2 ring-green-300 ring-offset-1 scale-105":""}`,children:[a.jsx(Xe,{className:`h-4 w-4 mr-1.5 ${c?"animate-bounce":""}`}),"Audio",c&&a.jsxs("span",{className:"ml-1 flex items-center",children:[a.jsx("span",{className:"w-1 h-3 bg-white rounded-full mx-0.5 animate-pulse",style:{animationDelay:"0ms"}}),a.jsx("span",{className:"w-1 h-4 bg-white rounded-full mx-0.5 animate-pulse",style:{animationDelay:"150ms"}}),a.jsx("span",{className:"w-1 h-2 bg-white rounded-full mx-0.5 animate-pulse",style:{animationDelay:"300ms"}})]})]})}),a.jsx(it,{to:"/interactive-learning",children:a.jsxs(Y,{size:"sm",className:`bg-gradient-to-r from-purple-500 to-indigo-600 hover:from-purple-600 hover:to-indigo-700 text-white font-semibold shadow-lg ml-1 mr-1 transition-all duration-300 ${d("/interactive-learning")?"ring-2 ring-purple-300 ring-offset-1":""}`,children:[a.jsx(jv,{className:"h-4 w-4 mr-1.5"}),"Interactive"]})}),a.jsx(it,{to:"/uncle-b-writing-lab",children:a.jsxs(Y,{size:"sm",className:`bg-gradient-to-r from-amber-500 to-orange-600 hover:from-amber-600 hover:to-orange-700 text-white font-semibold shadow-lg ml-1 mr-1 transition-all duration-300 ${d("/uncle-b-writing-lab")?"ring-2 ring-amber-300 ring-offset-1":""}`,children:[a.jsx(Vs,{className:"h-4 w-4 mr-1.5"}),"Uncle B's Lab"]})}),a.jsx(it,{to:"/neela-mozhi",children:a.jsxs(Y,{size:"sm",className:`bg-gradient-to-r from-teal-500 to-emerald-600 hover:from-teal-600 hover:to-emerald-700 text-white font-semibold shadow-lg ml-1 mr-1 transition-all duration-300 ${d("/neela-mozhi")?"ring-2 ring-teal-300 ring-offset-1":""}`,children:[a.jsx(Vs,{className:"h-4 w-4 mr-1.5"}),"Neela Mozhi"]})}),a.jsx(it,{to:"/phonetics",children:a.jsxs(Y,{variant:d("/phonetics")?"secondary":"ghost",size:"sm",children:[a.jsx(uA,{className:"h-4 w-4 mr-1.5"}
785),"Phonetics"]})}),a.jsx(it,{to:"/settings",children:a.jsxs(Y,{variant:d("/settings")?"secondary":"ghost",size:"sm",children:[a.jsx(Sv,{className:"h-4 w-4 mr-1.5"}),"Settings"]})}),a.jsx(it,{to:"/progress",children:a.jsxs(Y,{variant:d("/progress")?"secondary":"ghost",size:"sm",children:[a.jsx(ja,{className:"h-4 w-4 mr-1.5"}),"Progress"]})}),a.jsx(it,{to:"/community",children:a.jsxs(Y,{variant:d("/community")?"secondary":"ghost",size:"sm",children:[a.jsx(Xn,{className:"h-4 w-4 mr-1.5"}),"Community"]})}),a.jsx(it,{to:"/messages",children:a.jsxs(Y,{variant:d("/messages")?"secondary":"ghost",size:"sm",className:"relative",children:[a.jsx(yd,{className:"h-4 w-4 mr-1.5"}),"Messages",i>0&&a.jsx("span",{className:"absolute -top-1 -right-1 bg-red-500 text-white text-xs font-bold rounded-full h-5 w-5 flex items-center justify-center",children:i>9?"9+":i})]})}),a.jsx(it,{to:"/teams",children:a.jsxs(Y,{variant:d("/teams")?"secondary":"ghost",size:"sm",children:[a.jsx(xA,{className:"h-4 w-4 mr-1.5"}),"Teams"]})}),a.jsx("div",{className:"ml-1",children:a.jsx(qP,{})}),a.jsx("div",{className:"ml-1",children:a.jsx(WP,{})}),a.jsxs(Soe,{children:[a.jsx(Noe,{asChild:!0,children:a.jsx(Y,{variant:"ghost",className:"relative h-10 w-10 rounded-full p-0 ml-2",children:a.jsx(_a,{className:`h-9 w-9 border-2 ${s?"border-amber-400":"border-purple-200"}`,children:a.jsx(Sa,{className:`text-sm font-bold ${s?"bg-amber-400 text-amber-900":"bg-purple-100 text-purple-700"}`,children:f()})})})}),a.jsxs(nF,{align:"end",className:"w-56",children:[a.jsx(aF,{children:a.jsx("div",{className:"flex flex-col space-y-1",children:s?a.jsxs(a.Fragment,{children:[a.jsxs("p",{className:"text-sm font-medium flex items-center",children:[a.jsx(An,{className:"w-4 h-4 mr-1.5 text-amber-500"}),"Demo Mode"]}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Exploring the app"})]}):a.jsxs(a.Fragment,{children:[a.jsx("p",{className:"text-sm font-medium",children:((v=r==null?void 0:r.user_metadata)==null?void 0:v.full_name)||"User"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:r==null?void 0:r.email})]})})}),a.jsx(zy,{}),s&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"px-2 py-3 bg-gradient-to-r from-purple-50 to-indigo-50 rounded-md mx-2 mb-2",children:[a.jsx("p",{className:"text-xs text-gray-600 mb-2",children:"Create a free account to save your progress!"}),a.jsx(Y,{size:"sm",className:"w-full bg-purple-600 hover:bg-purple-700 text-xs",onClick:()=>t("/login?view=signup"),children:"Sign Up Free"})]}),a.jsx(zy,{})]}),!s&&a.jsxs(a.Fragment,{children:[a.jsx(Fy,{asChild:!0,children:a.jsxs(it,{to:"/profile",className:"flex items-center cursor-pointer",children:[a.jsx(vA,{className:"mr-2 h-4 w-4"}),"Profile"]})}),a.jsx(Fy,{asChild:!0,children:a.jsxs(it,{to:"/admin",className:"flex items-center cursor-pointer",children:[a.jsx(p_,{className:"mr-2 h-4 w-4"}),"Admin Dashboard"]})}),a.jsx(zy,{})]}),a.jsxs(Fy,{onClick:m,className:"cursor-pointer text-red-600",children:[a.jsx(g_,{className:"mr-2 h-4 w-4"}),s?"Exit Demo":"Log out"]})]})]})]}),a.jsxs("div",{className:"flex items-center gap-1 lg:hidden",children:[a.jsx(qP,{}),a.jsx(WP,{}),a.jsx(Y,{variant:"ghost",size:"sm",onClick:()=>l(!o),className:"p-2",children:o?a.jsx(ls,{className:"h-6 w-6"}):a.jsx(OK,{className:"h-6 w-6"})})]})]})})}),o&&a.jsx("div",{className:"lg:hidden fixed inset-0 z-40 bg-black/50",onClick:g}),o&&a.jsx("div",{className:"lg:hidden fixed top-16 left-0 right-0 z-50 bg-white shadow-2xl max-h-[calc(100vh-4rem)] overflow-y-auto",children:a.jsxs("div",{className:"p-4 space-y-1",children:[a.jsx(it,{to:"/audio-admin",onClick:g,children:a.jsxs(Y,{className:"w-full justify-start h-12 bg-green-500 hover:bg-green-600 text-white font-bold shadow-lg mb-2",children:[a.jsx(Xe,{className:"h-5 w-5 mr-3"}),"Audio Admin"]})}),a.jsx(it,{to:"/interactive-learning",onClick:g,children:a.jsxs(Y,{className:"w-full justify-start h-12 bg-gradient-to-r from-purple-500 to-indigo-600 hover:from-purple-600 hover:to-indigo-700 text-white font-bold shadow-lg mb-2",children:[a.jsx(jv,{className:"h-5 w-5 mr-3"}),"Interactive Learning"]})}),a.jsx(it,{to:"/neela-mozhi",onClick:g,children:a.jsxs(Y,{className:"w-full justify-start h-12 bg-gradient-to-r from-teal-500 to-emerald-600 hover:from-teal-600 hover:to-emerald-700 text-white font-bold shadow-lg mb-2",children:[a.jsx(Vs,{className:"h-5 w-5 mr-3"}),"Neela Mozhi Advanced"]})}),a.jsx(it,{to:"/app",onClick:g,children:a.jsxs(Y,{variant:d("/app")?"secondary":"ghost",className:"w-full justify-start h-12",children:[a.jsx(mA,{className:"h-5 w-5 mr-3"}),"Learn"]})}),a.jsx(it,{to:"/flashcards",onClick:g,children:a.jsxs(Y,{variant:d("/flashcards")?"secondary":"ghost",className:"w-full justify-start h-12",children:[a.jsx(hA,{className:"h-5 w-5 mr-3"}),"Flashcards"]})}),a.jsx(it,{to:"/review",onClick:g,children:a.jsxs(Y,{variant:d("/review")?"secondary":"ghost",className:"w-full justify-start h-12",children:[a.jsx(Xt,{className:"h-5 w-5 mr-3"}),"Review"]})}),a.jsx(it,{to:"/phonetics",onClick:g,children:a.jsxs(Y,{variant:d("/phonetics")?"secondary":"ghost",className:"w-full justify-start h-12",children:[a.jsx(uA,{className:"h-5 w-5 mr-3"}
785),"Phonetics"]})}),a.jsx(it,{to:"/settings",onClick:g,children:a.jsxs(Y,{variant:d("/settings")?"secondary":"ghost",className:"w-full justify-start h-12",children:[a.jsx(Sv,{className:"h-5 w-5 mr-3"}),"Settings"]})}),a.jsx(it,{to:"/progress",onClick:g,children:a.jsxs(Y,{variant:d("/progress")?"secondary":"ghost",className:"w-full justify-start h-12",children:[a.jsx(ja,{className:"h-5 w-5 mr-3"}),"Progress"]})}),a.jsx(it,{to:"/community",onClick:g,children:a.jsxs(Y,{variant:d("/community")?"secondary":"ghost",className:"w-full justify-start h-12",children:[a.jsx(Xn,{className:"h-5 w-5 mr-3"}),"Community"]})}),a.jsx(it,{to:"/messages",onClick:g,children:a.jsxs(Y,{variant:d("/messages")?"secondary":"ghost",className:"w-full justify-start h-12",children:[a.jsx(yd,{className:"h-5 w-5 mr-3"}),"Messages",i>0&&a.jsx("span",{className:"ml-auto bg-red-500 text-white text-xs font-bold rounded-full h-5 w-5 flex items-center justify-center",children:i})]})}),a.jsx(it,{to:"/teams",onClick:g,children:a.jsxs(Y,{variant:d("/teams")?"secondary":"ghost",className:"w-full justify-start h-12",children:[a.jsx(xA,{className:"h-5 w-5 mr-3"}),"Teams"]})}),a.jsxs("div",{className:"border-t pt-3 mt-3",children:[s&&a.jsxs("div",{className:"mb-3 p-3 bg-gradient-to-r from-purple-50 to-indigo-50 rounded-lg",children:[a.jsx("p",{className:"text-sm text-gray-600 mb-2",children:"Create a free account to save progress!"}),a.jsx(Y,{className:"w-full bg-purple-600 hover:bg-purple-700",onClick:()=>{t("/login?view=signup"),g()},children:"Sign Up Free"})]}),!s&&a.jsxs(a.Fragment,{children:[a.jsx(it,{to:"/profile",onClick:g,children:a.jsxs(Y,{variant:"ghost",className:"w-full justify-start h-12",children:[a.jsx(vA,{className:"h-5 w-5 mr-3"}),"Profile"]})}),a.jsx(it,{to:"/admin",onClick:g,children:a.jsxs(Y,{variant:"ghost",className:"w-full justify-start h-12",children:[a.jsx(p_,{className:"h-5 w-5 mr-3"}),"Admin Dashboard"]})})]}),a.jsxs(Y,{variant:"ghost",className:"w-full justify-start h-12 text-red-600 hover:bg-red-50",onClick:()=>{m(),g()},children:[a.jsx(g_,{className:"h-5 w-5 mr-3"}),s?"Exit Demo":"Log out"]})]})]})}),s&&a.jsx("div",{className:"bg-gradient-to-r from-amber-400 via-yellow-400 to-amber-400 px-4 py-2 shadow-md",children:a.jsxs("div",{className:"max-w-7xl mx-auto flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(An,{className:"w-5 h-5 text-amber-800"}),a.jsx("span",{className:"text-sm font-semibold text-amber-900",children:"Demo Mode - Your progress won't be saved"})]}),a.jsx(Y,{size:"sm",className:"bg-amber-800 hover:bg-amber-900 text-white",onClick:()=>t("/login?view=signup"),children:"Create Account"})]})})]})},Koe=()=>{const[e,t]=y.useState({en:"",ml:""}),[r,n]=y.useState(!1),s=Ac();y.useEffect(()=>{const o=setTimeout(()=>{const l=H_("greeting");t(l),n(!0)},1500);return()=>clearTimeout(o)},[]);const i=()=>{var o;(o=document.getElementById("learn-section"))==null||o.scrollIntoView({behavior:"smooth"})};return a.jsxs("div",{className:"relative bg-gradient-to-br from-blue-900 via-indigo-900 to-blue-800 text-white overflow-hidden",children:[a.jsx("div",{className:"absolute inset-0",children:a.jsx("img",{src:p6,alt:"",className:"w-full h-full object-cover opacity-20"})}),a.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-blue-900/80 via-indigo-900/60 to-blue-900/70"}),a.jsx("div",{className:"relative max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-20 md:py-28",children:a.jsxs("div",{className:"grid md:grid-cols-[1fr_auto] gap-8 items-center",children:[a.jsxs("div",{className:"text-center md:text-left",children:[a.jsxs("div",{className:"flex items-center justify-center md:justify-start gap-2 mb-6",children:[a.jsx(Cf,{className:"w-6 h-6 text-blue-300"}),a.jsx("span",{className:"text-blue-300 font-semibold text-lg",children:"Neela Malayalam"}),s.currentStreak>0&&a.jsxs("span",{className:"ml-2 bg-orange-500/30 text-orange-300 px-3 py-1 rounded-full text-sm font-medium flex items-center gap-1",children:[a.jsx(ma,{className:"w-4 h-4"}),s.currentStreak," day streak"]})]}),a.jsxs("h1",{className:"text-5xl md:text-7xl font-bold mb-6 leading-tight",children:["Learn Malayalam",a.jsx("br",{}),a.jsx("span",{className:"text-transparent bg-clip-text bg-gradient-to-r from-blue-300 via-cyan-300 to-blue-200",children:"with Neela"})]}),a.jsx("p",{className:"text-xl md:text-2xl text-blue-200 mb-8 max-w-3xl",children:"Your Hyacinth Macaw companion guides you through every letter, sound, and word of the beautiful Malayalam script"}),a.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 justify-center md:justify-start",children:[a.jsxs("button",{onClick:i,className:"bg-gradient-to-r from-blue-500 to-indigo-500 hover:from-blue-600 hover:to-indigo-600 text-white px-8 py-4 rounded-xl text-lg font-semibold transition-all duration-300 flex items-center justify-center gap-2 shadow-lg shadow-blue-500/30 hover:shadow-xl hover:shadow-blue-500/40",children:[a.jsx(wa,{className:"w-5 h-5"}),"Start Learning"]}),a.jsxs("button",{onClick:()=>{var o;return(o=document.getElementById("quiz-section"))==null?void 0:o.scrollIntoView({behavior:"smooth"})},className:"bg-white/10 backdrop-blur-sm hover:bg-white/20 text-white px-8 py-4 rounded-xl text-lg font-semibold transition-all duration-300 flex items-center justify-center gap-2 border border-white/20",children:[a.jsx(An,{className:"w-5 h-5"}),"Take a Quiz"]})]})]}),a.jsx("div",{className:"hidden md:flex flex-col items-center",children:a.jsxs("div",{className:"relative",children:[a.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-blue-400 to-cyan-400 rounded-3xl blur-2xl opacity-25 scale-125"}),a.jsx("img",{src:Po,alt:"Neela Malayalam - Learn Malayalam with Neela",className:"relative w-72 h-72 object-contain drop-shadow-2xl"})]})})]})})]})};function Yoe(){return a.jsx("div",{className:"py-8 px-4",children:a.jsx(se,{className:"max-w-4xl mx-auto p-8 bg-gradient-to-r from-blue-50 to-indigo-50 border-2 border-blue-200",children:a.jsxs("div",{className:"text-center space-y-6",children:[a.jsx("h3",{className:"text-2xl font-bold text-gray-800",children:"Writing Direction"}),a.jsxs("p",{className:"text-lg text-gray-700",children:["Malayalam is written from ",a.jsx("span",{className:"font-bold text-blue-600",children:"left to right"}),", just like English."]}),a.jsxs("div",{className:"flex items-center justify-center gap-3 py-6",children:[a.jsx("div",{className:"w-3 h-3 rounded-full bg-blue-400 animate-pulse"}),a.jsx("div",{className:"w-3 h-3 rounded-full bg-blue-500 animate-pulse",style:{animationDelay:"0.2s"}}),a.jsx("div",{className:"w-3 h-3 rounded-full bg-blue-600 animate-pulse",style:{animationDelay:"0.4s"}}),a.jsx(rn,{className:"w-8 h-8 text-blue-600 animate-bounce",style:{animationDelay:"0.6s"}})]}),a.jsxs("div",{className:"bg-white rounded-lg p-6 shadow-inner",children:[a.jsxs("div",{className:"flex items-center justify-center gap-4",children:[a.jsx("span",{className:"text-4xl font-bold text-gray-800",children:"മലയാളം"}),a.jsx(rn,{className:"w-6 h-6 text-blue-500"}),a.jsx("span",{className:"text-lg text-gray-600",children:"(Malayalam)"})]}),a.jsxs("div",{className:"mt-4 flex items-center justify-center gap-2",children:[a.jsx("span",{className:"text-2xl text-gray-700",children:"മ"}),a.jsx(rn,{className:"w-4 h-4 text-blue-400"}),a.jsx("span",{className:"text-2xl text-gray-700",children:"ല"}),a.jsx(rn,{className:"w-4 h-4 text-blue-400"}),a.jsx("span",{className:"text-2xl text-gray-700",children:"യാ"}),a.jsx(rn,{className:"w-4 h-4 text-blue-400"}),a.jsx("span",{className:"text-2xl text-gray-700",children:"ളം"})]})]}),a.jsx("p",{className:"text-sm text-gray-600 italic",children:"Each letter or syllable is written one after another from left to right"})]})})})}const Xoe=()=>a.jsx("div",{className:"bg-gradient-to-r from-amber-50 to-orange-50 py-16 px-4",children:a.jsx("div",{className:"max-w-5xl mx-auto",children:a.jsxs("div",{className:"bg-white rounded-2xl shadow-xl p-8 md:p-12",children:[a.jsxs("div",{className:"flex items-start gap-4 mb-6",children:[a.jsx("div",{className:"bg-amber-500 rounded-full p-3",children:a.jsx(nl,{className:"w-6 h-6 text-white"})}),a.jsxs("div",{children:[a.jsx("h2",{className:"text-3xl md:text-4xl font-bold text-indigo-900 mb-4",children:"The Built-in 'A' Sound"}),a.jsx("p",{className:"text-lg text-gray-700 leading-relaxed",children:`In Malayalam, every consonant comes with an inherent 'a' sound (like the 'a' in "America"). This means when you write a consonant by itself, it's automatically pronounced with this vowel sound.`})]})]}),a.jsxs("div",{className:"grid md:grid-cols-2 gap-6 mt-8",children:[a.jsxs("div",{className:"bg-indigo-50 rounded-lg p-6",children:[a.jsxs("h3",{className:"text-xl font-bold text-indigo-900 mb-3 flex items-center gap-2",children:[a.jsx(ot,{className:"w-5 h-5 text-indigo-600"}),"For Example:"]}),a.jsxs("ul",{className:"space-y-2 text-gray-700",children:[a.jsxs("li",{children:[a.jsx("span",{className:"text-2xl font-bold text-indigo-900",children:"ക"}),' = "ka" (not just "k")']}),a.jsxs("li",{children:[a.jsx("span",{className:"text-2xl font-bold text-indigo-900",children:"മ"}),' = "ma" (not just "m")']}),a.jsxs("li",{children:[a.jsx("span",{className:"text-2xl font-bold text-indigo-900",children:"ല"}),' = "la" (not just "l")']})]})]}),a.jsxs("div",{className:"bg-amber-50 rounded-lg p-6",children:[a.jsx("h3",{className:"text-xl font-bold text-amber-900 mb
785-3",children:"Why This Matters:"}),a.jsx("p",{className:"text-gray-700",children:"Understanding this concept is key to reading Malayalam correctly. It's different from English where consonants need separate vowels to be pronounced."})]})]})]})})}),Qoe=()=>{const e=[{word:"പൂവ്",transliteration:"pūv",meaning:"flower",withVirama:"പൂവ്",withoutVirama:"പൂവ",pronunciationWith:"pūv",pronunciationWithout:"pūva"},{word:"കാട്",transliteration:"kāṭ",meaning:"forest",withVirama:"കാട്",withoutVirama:"കാട",pronunciationWith:"kāṭ",pronunciationWithout:"kāṭa"},{word:"കാല്",transliteration:"kāl",meaning:"leg/foot",withVirama:"കാല്",withoutVirama:"കാല",pronunciationWith:"kāl",pronunciationWithout:"kāla"}],t=r=>{const n=n1(r);console.log(`🎵 Playing audio for word: ${r}, expected filename: ${n}`),R2(r)};return a.jsx("div",{className:"bg-gradient-to-r from-rose-50 to-pink-50 py-16 px-4",children:a.jsx("div",{className:"max-w-6xl mx-auto",children:a.jsxs("div",{className:"bg-white rounded-2xl shadow-xl p-8 md:p-12",children:[a.jsxs("div",{className:"text-center mb-8",children:[a.jsx("div",{className:"inline-block bg-rose-500 rounded-full p-4 mb-4",children:a.jsx(ls,{className:"w-8 h-8 text-white"})}),a.jsx("h2",{className:"text-3xl md:text-4xl font-bold text-rose-900 mb-4",children:"The Virama: Removing the 'A' Sound"}),a.jsxs("p",{className:"text-lg text-gray-700 max-w-3xl mx-auto",children:["The symbol ",a.jsx("span",{className:"text-3xl font-bold text-rose-600",children:"്"})," (called ",a.jsx("strong",{children:"chandrakkala"})," or ",a.jsx("strong",{children:"virama"}),") removes the inherent 'a' sound from a consonant. Compare the difference:"]})]}),a.jsx("div",{className:"grid md:grid-cols-3 gap-6",children:e.map((r,n)=>a.jsxs("div",{className:"bg-gradient-to-br from-rose-50 to-white rounded-xl p-6 border-2 border-rose-200",children:[a.jsxs("div",{className:"text-center mb-4",children:[a.jsx("div",{className:"text-5xl font-bold text-rose-900 mb-2",children:r.word}),a.jsx("div",{className:"text-sm text-gray-600 mb-1",children:r.transliteration}),a.jsxs("div",{className:"text-sm font-semibold text-rose-700",children:["(",r.meaning,")"]})]}),a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"bg-green-50 rounded-lg p-3 border border-green-200",children:[a.jsxs("div",{className:"flex items-center justify-between mb-2",children:[a.jsx("span",{className:"text-sm font-semibold text-green-800",children:"With ് (correct)"}),a.jsx("button",{onClick:()=>t(r.withVirama),className:"bg-green-500 hover:bg-green-600 text-white p-2 rounded-full transition-colors",title:`Play audio: ${n1(r.withVirama)||"not available"}`,children:a.jsx(Xe,{className:"w-4 h-4"})})]}),a.jsx("div",{className:"text-2xl font-bold text-green-900",children:r.withVirama}),a.jsxs("div",{className:"text-sm text-green-700",children:["→ ",r.pronunciationWith]})]}),a.jsxs("div",{className:"bg-red-50 rounded-lg p-3 border border-red-200",children:[a.jsxs("div",{className:"flex items-center justify-between mb-2",children:[a.jsx("span",{className:"text-sm font-semibold text-red-800",children:"Without ് (wrong)"}),a.jsx("button",{onClick:()=>t(r.withoutVirama),className:"bg-red-500 hover:bg-red-600 text-white p-2 rounded-full transition-colors",title:`Play audio: ${n1(r.withoutVirama)||"not available"}`,children:a.jsx(Xe,{className:"w-4 h-4"})})]}),a.jsx("div",{className:"text-2xl font-bold text-red-900",children:r.withoutVirama}),a.jsxs("div",{className:"text-sm text-red-700",children:["→ ",r.pronunciationWithout]})]})]})]},n))})]})})})};function Joe({vowel:e,transliteration:t,type:r}){const[n,s]=y.useState(!1),[i,o]=y.useState(!1),[l,c]=y.useState("unknown"),u=()=>{switch(r){case"short":return"bg-blue-50 border-blue-200 hover:border-blue-400";case"long":return"bg-green-50 border-green-200 hover:border-green-400";case"diphthong":return"bg-purple-50 border-purple-200 hover:border-purple-400";case"special":return"bg-orange-50 border-orange-200 hover:border-orange-400"}},h=()=>{switch(r){case"short":return"Short";case"long":return"Long";case"diphthong":return"Diphthong";case"special":return"Special"}},d=()=>({അ:"a.mp3",ആ:"aa.mp3",ഇ:"i.mp3",ഈ:"ii.mp3",ഉ:"u.mp3",ഊ:"uu.mp3",ഋ:"ri.mp3",എ:"e.mp3",ഏ:"ee.mp3",ഐ:"ai.mp3",ഒ:"o.mp3",ഓ:"oo.mp3",ഔ:"au.mp3",അം:"am.mp3",അഃ:"ah.mp3"})[e]||"unknown",f=async()=>{var p,v;s(!0),o(!1),c("unknown");try{await Fr(e,{type:"vowel",onStart:()=>s(!0),onEnd:()=>s(!1)})}catch(x){console.error("Error playing audio:",x),o(!0),s(!1),st(x)?c("network"):(p=x==null?void 0:x.message)!=null&&p.includes("404")||(v=x==null?void 0:x.message)!=null&&v.includes("not found")?c("notfound"):c("unknown")}},m=()=>{switch(l){case"network":return"Network error - check your connection";case"notfound":return`Audio file not found. Expected: ${d()}`;default:return"Audio unavailable - click to retry"}},g=()=>n?a.jsxs(a.Fragment,{children:[a.jsx(Fe,{className:"w-4 h-4 mr-2 animate-spin"}),"Playing..."]}):i?a.jsxs(a.Fragment,{children:[l==="network"?a.jsx(Xo,{className:"w-4 h-4 mr-2"}):a.jsx(cn,{className:"w-4 h-4 mr-2"}),"Retry"]}):a.jsxs(a.Fragment,{children:[a.jsx(Xe,{className:"w-4 h-4 mr-2"}),"Play"]});return a.jsx(se,{className:`p-4 transition-all ${u()}`,children:a.jsxs("div",{className:"flex flex-col items-center gap-3",children:[a.jsx("div",{className:"text-5xl font-bold text-gray-800",children:e}),a.jsx("div",{className:"text-sm font-medium text-gray-600",children:t}),a.jsx("div",{className:"text-xs text-gray-500",children:h()}),a.jsx(p2,{children:a.jsxs(pL,{children:[a.jsx(gL,{asChild:!0,children:a.jsx(Y,{size:"sm",variant:i?"destructive":n?"secondary":"outline",onClick:f,disabled:n,className:"w-full",children:g()})}),i&&a.jsxs(g2,{children:[a.jsx("p",{className:"text-xs",children:m()}),a.jsxs("p",{className:"text-xs text-gray-400 mt-1",children:["File: vowels/",d()]})]})]})})]})})}const Zoe=[{vowel:"അ",transliteration:"a",type:"short"},{vowel:"ആ",transliteration:"ā",type:"long"},{vowel:"ഇ",transliteration:"i",type:"short"},{vowel:"ഈ",transliteration:"ī",type:"long"},{vowel:"ഉ",transliteration:"u",type:"short"},{vowel:"ഊ",transliteration:"ū",type:"long"},{vowel:"ഋ",transliteration:"ṛ",type:"short"},{vowel:"എ",transliteration:"e",type:"short"},{vowel:"ഏ",transliteration:"ē",type:"long"},{vowel:"ഐ",transliteration:"ai",type:"diphthong"},{vowel:"ഒ",transliteration:"o",type:"short"},{vowel:"ഓ",transliteration:"ō",type:"long"},{vowel:"ഔ",transliteration:"au",type:"diphthong"},{vowel:"അം",transliteration:"aṃ",type:"special"},{vowel:"അഃ",transliteration:"aḥ",type:"special"}];function ele(){return a.jsxs("div",{className:"space-y-8",children:[a.jsxs("div",{className:"text-center space-y-4",children:[a.jsx("h2",{className:"text-3xl font-bold text-gray-800",children:"Malayalam Vowels"}),a.jsx("p",{className:"text-gray-600 max-w-2xl mx-auto",children:"Malayalam has 15 vowel sounds. Click the play button to hear each vowel's pronunciation."}),a.jsxs("div",{className:"flex flex-wrap justify-center gap-4 text-sm",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("div",{className:"w-4 h-4 bg-blue-200 rounded"}),a.jsx("span",{children:"Short Vowels"})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("div",{className:"w-4 h-4 bg-green-200 rounded"}),a.jsx("span",{children:"Long Vowels"})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("div",{className:"w-4 h-4 bg-purple-200 rounded"}),a.jsx("span",{children:"Diphthongs"})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("div",{className:"w-4 h-4 bg-orange-200 rounded"}),a.jsx("span",{children:"Special"})]})]})]}),a.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 ga
785p-4",children:Zoe.map(e=>a.jsx(Joe,{...e},e.vowel))})]})}const tle={അ:[{order:1,points:[{x:100,y:80},{x:120,y:60},{x:150,y:60},{x:170,y:80},{x:170,y:120}]},{order:2,points:[{x:80,y:140},{x:120,y:120},{x:170,y:140},{x:180,y:180}]}],ആ:[{order:1,points:[{x:90,y:80},{x:110,y:60},{x:140,y:60},{x:160,y:80},{x:160,y:120}]},{order:2,points:[{x:70,y:140},{x:110,y:120},{x:160,y:140},{x:200,y:120},{x:220,y:140}]}],ഇ:[{order:1,points:[{x:120,y:70},{x:140,y:60},{x:160,y:70},{x:160,y:100}]},{order:2,points:[{x:100,y:130},{x:140,y:110},{x:180,y:130}]}],ഈ:[{order:1,points:[{x:110,y:70},{x:130,y:60},{x:150,y:70},{x:150,y:100}]},{order:2,points:[{x:90,y:130},{x:130,y:110},{x:170,y:130},{x:200,y:110}]}],ഉ:[{order:1,points:[{x:120,y:80},{x:140,y:70},{x:160,y:80},{x:160,y:110}]},{order:2,points:[{x:100,y:140},{x:140,y:120},{x:180,y:140},{x:180,y:170}]}],ഊ:[{order:1,points:[{x:110,y:80},{x:130,y:70},{x:150,y:80},{x:150,y:110}]},{order:2,points:[{x:90,y:140},{x:130,y:120},{x:170,y:140},{x:210,y:120},{x:220,y:150}]}]},m1=[{char:"അ",trans:"a",strokes:2},{char:"ആ",trans:"ā",strokes:2},{char:"ഇ",trans:"i",strokes:2},{char:"ഈ",trans:"ī",strokes:2},{char:"ഉ",trans:"u",strokes:2},{char:"ഊ",trans:"ū",strokes:2}],rle=()=>{const e=y.useRef(null),[t,r]=y.useState(!1),[n,s]=y.useState(0),[i,o]=y.useState(!1),[l,c]=y.useState(""),[u,h]=y.useState(!0),d=(j,_,S,k,P)=>{const M=Math.atan2(P-S,k-_);j.lineTo(k,P),j.moveTo(k,P),j.lineTo(k-10*Math.cos(M-Math.PI/6),P-10*Math.sin(M-Math.PI/6)),j.moveTo(k,P),j.lineTo(k-10*Math.cos(M+Math.PI/6),P-10*Math.sin(M+Math.PI/6))},f=()=>{const j=e.current;if(!j)return;const _=j.getContext("2d");if(!_)return;const S=m1[n],k=tle[S.char];k&&(k.forEach(P=>{_.strokeStyle="#94a3b8",_.lineWidth=2,_.setLineDash([5,5]),_.beginPath(),P.points.forEach((I,E)=>{E===0?_.moveTo(I.x,I.y):_.lineTo(I.x,I.y)}),_.stroke();const C=P.points[P.points.length-1],M=P.points[P.points.length-2];_.setLineDash([]),_.beginPath(),d(_,M.x,M.y,C.x,C.y),_.stroke(),_.fillStyle="#3b82f6",_.font="bold 16px sans-serif",_.fillText(P.order.toString(),P.points[0].x-20,P.points[0].y)}),_.setLineDash([]))};y.useEffect(()=>{const j=e.current;if(!j)return;const _=j.getContext("2d");_&&(_.clearRect(0,0,j.width,j.height),u&&f())},[n,u]);const m=j=>{r(!0),o(!0);const _=e.current;if(!_)return;const S=_.getBoundingClientRect(),k=_.getContext("2d");k&&(k.strokeStyle="#3b82f6",k.lineWidth=3,k.lineCap="round",k.lineJoin="round",k.setLineDash([]),k.beginPath(),k.moveTo(j.clientX-S.left,j.clientY-S.top))},g=j=>{if(!t)return;const _=e.current;if(!_)return;const S=_.getBoundingClientRect(),k=_.getContext("2d");k&&(k.lineTo(j.clientX-S.left,j.clientY-S.top),k.stroke())},p=()=>r(!1),v=()=>{const j=e.current;if(!j)return;const _=j.getContext("2d");_&&(_.clearRect(0,0,j.width,j.height),u&&f(),o(!1),c(""))},x=()=>{if(!i){c("Please draw the vowel first!");return}c("Great effort! Keep practicing to improve your strokes.")},b=()=>{s(j=>(j+1)%m1.length),o(!1),c("")},w=m1[n];return a.jsxs(se,{className:"p-8",children:[a.jsx("h3",{className:"text-2xl font-bold text-gray-900 mb-6",children:"Vowel Writing Practice"}),a.jsxs("div",{className:"grid md:grid-cols-2 gap-8",children:[a.jsxs("div",{children:[a.jsxs("div",{className:"text-center mb-4",children:[a.jsx("div",{className:"text-8xl font-bold text-blue-600 mb-2",children:w.char}),a.jsx("p",{className:"text-xl text-gray-600",children:w.trans}),a.jsxs("p",{className:"text-sm text-gray-500 mt-2",children:[w.strokes," strokes"]})]}),a.jsx("div",{className:"mt-6 p-4 bg-blue-50 rounded-lg",children:a.jsxs("p",{className:"text-sm text-gray-700",children:[a.jsx("strong",{children:"Tip:"})," Follow the numbered strokes in order. The arrows show the direction to draw each stroke."]})})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"mb-4",children:[a.jsxs("div",{className:"flex justify-between items-center mb-2",children:[a.jsx("p",{className:"text-sm text-gray-600",children:"Trace the vowel below:"}),a.jsxs(Y,{onClick:()=>h(!u),variant:"outline",size:"sm",children:[u?a.jsx(Ws,{className:"w-4 h-4 mr-2"}):a.jsx(fa,{className:"w-4 h-4 mr-2"}),u?"Hide":"Show"," Guide"]})]}),a.jsx("canvas",{ref:e,width:300,height:250,className:"border-2 border-gray-300 rounded-lg cursor-crosshair bg-white",onMouseDown:m,onMouseMove:g,onMouseUp:p,onMouseLeave:p})]}),a.jsxs("div",{className:"flex gap-2 mb-4",children:[a.jsxs(Y,{onClick:v,variant:"outline",size:"sm",children:[a.jsx(ah,{className:"w-4 h-4 mr-2"}),"Clear"]}),a.jsxs(Y,{onClick:x,variant:"default",size:"sm",children:[a.jsx(mr,{className:"w-4 h-4 mr-2"}),"Check"]}),a.jsxs(Y,{onClick:b,variant:"outline",size:"sm",children:[a.jsx(Gn,{className:"w-4 h-4 mr-2"}),"Next"]})]}),l&&a.jsx("div",{className:"p-3 bg-blue-50 border border-blue-200 rounded-lg text-sm text-blue-800",children:l})]})]})]})},nle=[{char:"ഐ",name:"ai",combination:"അ + ഇ",sound:"like 'ai' in aisle",examples:[{word:"കൈ",trans:"kai",meaning:"hand"},{word:"പൈസ",trans:"paisa",meaning:"money"},{word:"വൈകി",trans:"vaiki",meaning:"late"}]},{char:"ഔ",name:"au",combination:"അ + ഉ",sound:"like 'ou' in house",examples:[{word:"പൗരൻ",trans:"pauran",meaning:"citizen"},{word:"ഔഷധം",trans:"aushadham",meaning:"medicine"},{word:"ഔദ്യോഗികം",trans:"audyogikam",meaning:"official"}]}];
785function ale(){return a.jsxs("div",{className:"space-y-6",children:[a.jsxs(se,{className:"border-purple-200 bg-gradient-to-br from-purple-50 to-pink-50",children:[a.jsx(_e,{children:a.jsx(Se,{className:"text-2xl text-purple-900",children:"Malayalam Diphthongs"})}),a.jsx(ue,{className:"space-y-4",children:a.jsx("p",{className:"text-gray-700",children:"Diphthongs are vowel sounds formed by combining two vowels. Malayalam has two main diphthongs that create unique sounds different from simple vowels."})})]}),a.jsx("div",{className:"grid md:grid-cols-2 gap-6",children:nle.map(e=>a.jsxs(se,{className:"border-purple-300",children:[a.jsxs(_e,{className:"bg-purple-100",children:[a.jsx(Se,{className:"text-4xl text-center text-purple-900",children:e.char}),a.jsx("p",{className:"text-center text-purple-700 font-semibold",children:e.name})]}),a.jsxs(ue,{className:"space-y-4 pt-4",children:[a.jsxs("div",{className:"bg-purple-50 p-3 rounded",children:[a.jsx("p",{className:"text-sm font-semibold text-purple-900",children:"Combination:"}),a.jsx("p",{className:"text-lg text-purple-700",children:e.combination})]}),a.jsxs("div",{className:"bg-pink-50 p-3 rounded",children:[a.jsx("p",{className:"text-sm font-semibold text-pink-900",children:"Sound:"}),a.jsx("p",{className:"text-gray-700",children:e.sound})]}),a.jsxs(Y,{onClick:()=>Fr(e.char,{type:"vowel"}),className:"w-full bg-purple-600 hover:bg-purple-700",children:[a.jsx(Xe,{className:"mr-2 h-4 w-4"}),"Play Sound"]}),a.jsxs("div",{className:"space-y-2 pt-2",children:[a.jsx("p",{className:"font-semibold text-purple-900",children:"Example Words:"}),e.examples.map((t,r)=>a.jsxs("div",{className:"flex items-center justify-between bg-white p-2 rounded border",children:[a.jsxs("div",{children:[a.jsx("span",{className:"text-xl font-semibold",children:t.word}),a.jsxs("span",{className:"text-sm text-gray-600 ml-2",children:["(",t.trans,")"]}),a.jsx("p",{className:"text-xs text-gray-500",children:t.meaning})]}),a.jsx(Y,{size:"sm",variant:"outline",onClick:()=>R2(t.word),children:a.jsx(Xe,{className:"h-3 w-3"})})]},r))]})]})]},e.char))})]})}const Fg=[{word:"കൈ",options:["kai","ka","ki"],correct:"kai",meaning:"hand"},{word:"പൗരൻ",options:["paran","pauran","puran"],correct:"pauran",meaning:"citizen"},{word:"വൈകി",options:["vaiki","vaki","viki"],correct:"vaiki",meaning:"late"},{word:"ഔഷധം",options:["ashadham","aushadham","oshadham"],correct:"aushadham",meaning:"medicine"}];function sle(){const[e,t]=y.useState(0),[r,n]=y.useState(null),[s,i]=y.useState(0),o=Fg[e];o.correct;const l=u=>{r||(n(u),u===o.correct&&i(s+1))},c=()=>{e<Fg.length-1?(t(e+1),n(null)):(t(0),n(null),i(0))};return a.jsxs(se,{className:"border-purple-300 bg-gradient-to-br from-purple-50 to-white",children:[a.jsxs(_e,{className:"bg-purple-100",children:[a.jsx(Se,{className:"text-xl text-purple-900",children:"Practice: Identify the Pronunciation"}),a.jsxs("p",{className:"text-sm text-purple-700",children:["Score: ",s,"/",Fg.length]})]}),a.jsxs(ue,{className:"space-y-6 pt-6",children:[a.jsxs("div",{className:"text-center space-y-4",children:[a.jsxs("div",{className:"flex items-center justify-center gap-4",children:[a.jsx("span",{className:"text-6xl font-bold text-purple-900",children:o.word}),a.jsx(Y,{size:"icon",variant:"outline",onClick:()=>Fr(o.word),className:"border-purple-300",children:a.jsx(Xe,{className:"h-5 w-5"})})]}),a.jsx("p",{className:"text-gray-600 italic",children:o.meaning})]}),a.jsx("div",{className:"space-y-3",children:o.options.map(u=>a.jsxs(Y,{onClick:()=>l(u),disabled:!!r,className:`w-full h-14 text-lg ${r===u?u===o.correct?"bg-green-500 hover:bg-green-600":"bg-red-500 hover:bg-red-600":"bg-purple-600 hover:bg-purple-700"}`,children:[u,r===u&&(u===o.correct?a.jsx(mr,{className:"ml-2 h-5 w-5"}):a.jsx(jt,{className:"ml-2 h-5 w-5"}))]},u))}),r&&a.jsx(Y,{onClick:c,className:"w-full bg-purple-700 hover:bg-purple-800",children:e<Fg.length-1?"Next Word":"Restart Practice"})]})]})}const ile=[{group:"Velar (കണ്ഠ്യം)",consonants:[{letter:"ക",romanization:"ka",isolated:"k"},{letter:"ഖ",romanization:"kha",isolated:"kh"},{letter:"ഗ",romanization:"ga",isolated:"g"},{letter:"ഘ",romanization:"gha",isolated:"gh"},{letter:"ങ",romanization:"ṅa",isolated:"ṅ"}]},{group:"Palatal (താലവ്യം)",consonants:[{letter:"ച",romanization:"ca",isolated:"c"},{letter:"ഛ",romanization:"cha",isolated:"ch"},{letter:"ജ",romanization:"ja",isolated:"j"},{letter:"ഝ",romanization:"jha",isolated:"jh"},{letter:"ഞ",romanization:"ña",isolated:"ñ"}]},{group:"Retroflex (മൂർദ്ധന്യം)",consonants:[{letter:"ട",romanization:"ṭa",isolated:"ṭ"},{letter:"ഠ",romanization:"ṭha",isolated:"ṭh"},{letter:"ഡ",romanization:"ḍa",isolated:"ḍ"},{letter:"ഢ",romanization:"ḍha",isolated:"ḍh"},{letter:"ണ",romanization:"ṇa",isolated:"ṇ"}]},{group:"Dental (ദന്ത്യം)",consonants:[{letter:"ത",romanization:"ta",isolated:"t"},{letter:"ഥ",romanization:"tha",isolated:"th"},{letter:"ദ",romanization:"da",isolated:"d"},{letter:"ധ",romanization:"dha",isolated:"dh"},{letter:"ന",romanization:"na",isolated:"n"}]},{group:"Labial (ഓഷ്ഠ്യം)",consonants:[{letter:"പ",romanization:"pa",isolated:"p"},{letter:"ഫ",romanization:"pha",isolated:"ph"},{letter:"ബ",romanization:"ba",isolated:"b"},{letter:"ഭ",romanization:"bha",isolated:"bh"},{letter:"മ",romanization:"ma",isolated:"m"}]}],ole=()=>{const[e,t]=y.useState(null),r=(n,s,i)=>{const o=s?n:n+"്";Fr(o,{type:s?"consonant-with-a":"consonant-isolated",onStart:()=>t(i),onEnd:()=>t(null)})};return a.jsx("div",{id:"learn-section",className:"py-16 px-4 bg-gradient-to-br from-indigo-50 to-purple-50",children:a.jsxs("div",{className:"max-w-7xl mx-auto",children:[a.jsxs("div",{className:"text-center mb-12",children:[a.jsx("h2",{className:"text-4xl md:text-5xl font-bold text-indigo-900 mb-4",children:"Malayalam Consonants by Articulation"}),a.jsx("p",{className:"text-xl text-gray-600 max-w-3xl mx-auto mb-4",children:"Organized by place of articulation and voicing (വർഗ്ഗം - Vargam System)"}),a.jsxs("div",{className:"flex items-center justify-center gap-2 text-sm text-gray-600",children:[a.jsx(Xe,{className:"w-4 h-4"}),a.jsx("span",{children:"Click any consonant to hear pronunciation"})]})]}),a.jsx("div",{className:"space-y-8",children:ile.map((n,s)=>a.jsxs(se,{className:"p-6 bg-white shadow-lg",children:[a.jsx("h3",{className:"text-2xl font-bold text-indigo-800 mb
785-6",children:n.group}),a.jsx("div",{className:"overflow-x-auto",children:a.jsxs("table",{className:"w-full border-collapse",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"bg-indigo-100",children:[a.jsx("th",{className:"border border-indigo-200 px-4 py-3 text-left font-semibold text-indigo-900",children:"Voiceless Unaspirated"}),a.jsx("th",{className:"border border-indigo-200 px-4 py-3 text-left font-semibold text-indigo-900",children:"Voiceless Aspirated"}),a.jsx("th",{className:"border border-indigo-200 px-4 py-3 text-left font-semibold text-indigo-900",children:"Voiced Unaspirated"}),a.jsx("th",{className:"border border-indigo-200 px-4 py-3 text-left font-semibold text-indigo-900",children:"Voiced Aspirated"}),a.jsx("th",{className:"border border-indigo-200 px-4 py-3 text-left font-semibold text-indigo-900",children:"Nasal"})]})}),a.jsx("tbody",{children:a.jsx("tr",{children:n.consonants.map((i,o)=>{const l=`${s}-${o}`,c=e===l;return a.jsx("td",{className:"border border-indigo-200 px-4 py-6",children:a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:`text-6xl font-bold text-indigo-900 mb-3 cursor-pointer transition-all ${c?"scale-110 text-amber-500":"hover:scale-105 hover:text-indigo-700"}`,onClick:()=>r(i.letter,!0,l),children:i.letter}),a.jsx("div",{className:"text-lg text-gray-600 mb-3",children:i.romanization}),a.jsxs("div",{className:"flex gap-2 justify-center",children:[a.jsxs("button",{onClick:()=>r(i.letter,!1,l),className:"px-3 py-1.5 bg-indigo-100 hover:bg-indigo-200 rounded-lg text-xs font-medium text-indigo-900 transition-colors flex items-center gap-1",title:"Play isolated consonant sound",children:[a.jsx(xd,{className:"w-3 h-3"}),i.isolated]}),a.jsxs("button",{onClick:()=>r(i.letter,!0,l),className:"px-3 py-1.5 bg-amber-100 hover:bg-amber-200 rounded-lg text-xs font-medium text-amber-900 transition-colors flex items-center gap-1",title:"Play with inherent 'a' vowel",children:[a.jsx(Xe,{className:"w-3 h-3"}),i.romanization]})]})]})},o)})})})]})})]},s))})]})})},lle={ക:[{order:1,points:[{x:100,y:60},{x:130,y:50},{x:160,y:60}]},{order:2,points:[{x:90,y:100},{x:130,y:80},{x:170,y:100},{x:180,y:140}]}],ഖ:[{order:1,points:[{x:95,y:60},{x:125,y:50},{x:155,y:60}]},{order:2,points:[{x:85,y:100},{x:125,y:80},{x:165,y:100},{x:190,y:140}]}],ഗ:[{order:1,points:[{x:100,y:65},{x:130,y:55},{x:160,y:65}]},{order:2,points:[{x:90,y:105},{x:130,y:85},{x:170,y:105},{x:175,y:145}]}],ഘ:[{order:1,points:[{x:95,y:65},{x:125,y:55},{x:155,y:65}]},{order:2,points:[{x:85,y:105},{x:125,y:85},{x:165,y:105},{x:185,y:145}]}],ങ:[{order:1,points:[{x:100,y:70},{x:130,y:60},{x:160,y:70}]},{order:2,points:[{x:90,y:110},{x:130,y:90},{x:170,y:110},{x:180,y:150}]}],ച:[{order:1,points:[{x:80,y:80},{x:110,y:60},{x:140,y:80}]},{order:2,points:[{x:140,y:80},{x:170,y:100},{x:180,y:140}]}],ഛ:[{order:1,points:[{x:75,y:85},{x:105,y:65},{x:135,y:85}]},{order:2,points:[{x:135,y:85},{x:165,y:105},{x:185,y:145}]}],ജ:[{order:1,points:[{x:85,y:75},{x:115,y:55},{x:145,y:75}]},{order:2,points:[{x:145,y:75},{x:175,y:95},{x:175,y:135}]}],ഝ:[{order:1,points:[{x:80,y:80},{x:110,y:60},{x:140,y:80}]},{order:2,points:[{x:140,y:80},{x:170,y:100},{x:190,y:140}]}],ഞ:[{order:1,points:[{x:90,y:70},{x:120,y:50},{x:150,y:70}]},{order:2,points:[{x:150,y:70},{x:180,y:90},{x:185,y:130}]}],ട:[{order:1,points:[{x:90,y:60},{x:120,y:50},{x:150,y:60},{x:170,y:80}]},{order:2,points:[{x:100,y:100},{x:130,y:120},{x:160,y:140}]}],ഠ:[{order:1,points:[{x:85,y:65},{x:115,y:55},{x:145,y:65},{x:165,y:85}]},{order:2,points:[{x:95,y:105},{x:125,y:125},{x:165,y:145}]}],ഡ:[{order:1,points:[{x:95,y:60},{x:125,y:50},{x:155,y:60},{x:175,y:80}]},{order:2,points:[{x:105,y:100},{x:135,y:120},{x:155,y:140}]}],ഢ:[{order:1,points:[{x:90,y:65},{x:120,y:55},{x:150,y:65},{x:170,y:85}]},{order:2,points:[{x:100,y:105},{x:130,y:125},{x:170,y:145}]}],ണ:[{order:1,points:[{x:85,y:70},{x:115,y:60},{x:145,y:70},{x:165,y:90}]},{order:2,points:[{x:95,y:110},{x:125,y:130},{x:165,y:150}]}],ത:[{order:1,points:[{x:80,y:70},{x:110,y:55},{x:140,y:70}]},{order:2,points:[{x:90,y:100},{x:120,y:120},{x:150,y:140}]}],ഥ:[{order:1,points:[{x:75,y:75},{x:105,y:60},{x:135,y:75}]},{order:2,points:[{x:85,y:105},{x:115,y:125},{x:155,y:145}]}],ദ:[{order:1,points:[{x:85,y:70},{x:115,y:55},{x:145,y:70}]},{order:2,points:[{x:95,y:100},{x:125,y:120},{x:145,y:140}]}],ധ:[{order:1,points:[{x:80,y:75},{x:110,y:60},{x:140,y:75}]},{order:2,points:[{x:90,y:105},{x:120,y:125},{x:160,y:145}]}],ന:[{order:1,points:[{x:90,y:65},{x:120,y:50},{x:150,y:65}]},{order:2,points:[{x:100,y:95},{x:130,y:115},{x:150,y:135}]}],പ:[{order:1,points:[{x:85,y:60},{x:115,y:50},{x:145,y:60}]},{order:2,points:[{x:95,y:90},{x:125,y:110},{x:155,y:130},{x:170,y:150}]}],ഫ:[{order:1,points:[{x:80,y:65},{x:110,y:55},{x:140,y:65}]},{order:2,points:[{x:90,y:95},{x:120,y:115},{x:160,y:135},{x:180,y:155}]}],ബ:[{order:1,points:[{x:90,y:60},{x:120,y:50},{x:150,y:60}]},{order:2,points:[{x:100,y:90},{x:130,y:110},{x:150,y:130},{x:165,y:150}]}],ഭ:[{order:1,points:[{x:85,y:65},{x:115,y:55},{x:145,y:65}]},{order:2,points:[{x:95,y:95},{x:125,y:115},{x:165,y:135},{x:185,y:155}]}],മ:[{order:1,points:[{x:80,y:70},{x:110,y:60},{x:140,y:70}]},{order:2,points:[{x:90,y:100},{x:120,y:120},{x:160,y:140},{x:180,y:160}]}]},Bh=[{name:"Velar",consonants:[{char:"ക",trans:"ka"},{char:"ഖ",trans:"kha"},{char:"ഗ",trans:"ga"},{char:"ഘ",trans:"gha"},{char:"ങ",trans:"ṅa"}],color:"red"},{name:"Palatal",consonants:[{char:"ച",trans:"ca"},{char:"ഛ",trans:"cha"},{char:"ജ",trans:"ja"},{char:"ഝ",trans:"jha"},{char:"ഞ",trans:"ña"}],color:"orange"},{name:"Retroflex",consonants:[{char:"ട",trans:"ṭa"},{char:"ഠ",trans:"ṭha"},{char:"ഡ",trans:"ḍa"},{char:"ഢ",trans:"ḍha"},{char:"ണ",trans:"ṇa"}],color:"yellow"},{name:"Dental",consonants:[{char:"ത",trans:"ta"},{char:"ഥ",trans:"tha"},{char:"ദ",trans:"da"},{char:"ധ",trans:"dha"},{char:"ന",trans:"na"}],color:"green"},{name:"Labial",consonants:[{char:"പ",trans:"pa"},{char:"ഫ",trans:"pha"},{char:"ബ",trans:"ba"},{char:"ഭ",trans:"bha"},{char:"മ",trans:"ma"}],color:"blue"}],cle=()=>{const e=y.useRef(null),[t,r]=y.useState(!1),[n,s]=y.useState(0),[i,o]=y.useState(0),[l,c]=y.useState(!1),[u,h]=y.useState(""),[d,f]=y.useState(!0),m=(S,k,P,C,M)=>{const E=Math.atan2(M-P,C-k);S.lineTo(C,M),S.moveTo(C,M),S.lineTo(C-10*Math.cos(E-Math.PI/6),M-10*Math.sin(E-Math.PI/6)),S.moveTo(C,M),S.lineTo(C-10*Math.cos(E+Math.PI/6),M-10*Math.sin(E+Math.PI/6))},g=()=>{const S=e.current;if(!S)return;const k=S.getContext("2d");if(!k)return;const P=Bh[n].consonants[i],C=lle[P.char];C&&(C.forEach(M=>{k.strokeStyle="#94a3b8",k.lineWidth=2,k.setLineDash([5,5]),k.beginPath(),M.points.forEac
785h((B,A)=>{A===0?k.moveTo(B.x,B.y):k.lineTo(B.x,B.y)}),k.stroke();const I=M.points[M.points.length-1],E=M.points[M.points.length-2];k.setLineDash([]),k.beginPath(),m(k,E.x,E.y,I.x,I.y),k.stroke(),k.fillStyle="#3b82f6",k.font="bold 16px sans-serif",k.fillText(M.order.toString(),M.points[0].x-20,M.points[0].y)}),k.setLineDash([]))};y.useEffect(()=>{const S=e.current;if(!S)return;const k=S.getContext("2d");k&&(k.clearRect(0,0,S.width,S.height),d&&g())},[n,i,d]);const p=S=>{r(!0),c(!0);const k=e.current;if(!k)return;const P=k.getBoundingClientRect(),C=k.getContext("2d");C&&(C.strokeStyle="#3b82f6",C.lineWidth=3,C.lineCap="round",C.setLineDash([]),C.beginPath(),C.moveTo(S.clientX-P.left,S.clientY-P.top))},v=S=>{if(!t)return;const k=e.current;if(!k)return;const P=k.getBoundingClientRect(),C=k.getContext("2d");C&&(C.lineTo(S.clientX-P.left,S.clientY-P.top),C.stroke())},x=()=>r(!1),b=()=>{const S=e.current;if(!S)return;const k=S.getContext("2d");k&&(k.clearRect(0,0,S.width,S.height),d&&g(),c(!1),h(""))},w=()=>{if(!l){h("Please draw the consonant first!");return}h("Great effort! Keep practicing.")},j=()=>{const S=Bh[n];i<S.consonants.length-1?o(i+1):(s((n+1)%Bh.length),o(0)),c(!1),h("")},_=Bh[n].consonants[i];return a.jsxs(se,{className:"p-8",children:[a.jsx("h3",{className:"text-2xl font-bold mb-6",children:"Consonant Writing Practice"}),a.jsxs("div",{className:"mb-4",children:[a.jsx("p",{className:"text-sm font-semibold text-gray-600 mb-2",children:"Articulation Group:"}),a.jsx("div",{className:"flex gap-2",children:Bh.map((S,k)=>a.jsx(Y,{onClick:()=>{s(k),o(0),c(!1),h("")},variant:n===k?"default":"outline",size:"sm",children:S.name},k))})]}),a.jsxs("div",{className:"grid md:grid-cols-2 gap-8",children:[a.jsxs("div",{children:[a.jsxs("div",{className:"text-center mb-4",children:[a.jsx("div",{className:"text-8xl font-bold text-indigo-600 mb-2",children:_.char}),a.jsx("p",{className:"text-xl text-gray-600",children:_.trans})]}),a.jsx("div",{className:"mt-6 p-4 bg-indigo-50 rounded-lg",children:a.jsxs("p",{className:"text-sm text-gray-700",children:[a.jsx("strong",{children:"Tip:"})," Follow numbered strokes. Arrows show direction."]})})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"mb-4",children:[a.jsxs("div",{className:"flex justify-between items-center mb-2",children:[a.jsx("p",{className:"text-sm text-gray-600",children:"Trace below:"}),a.jsxs(Y,{onClick:()=>f(!d),variant:"outline",size:"sm",children:[d?a.jsx(Ws,{className:"w-4 h-4 mr-2"}):a.jsx(fa,{className:"w-4 h-4 mr-2"}),d?"Hide":"Show"]})]}),a.jsx("canvas",{ref:e,width:300,height:250,className:"border-2 border-gray-300 rounded-lg cursor-crosshair bg-white",onMouseDown:p,onMouseMove:v,onMouseUp:x,onMouseLeave:x})]}),a.jsxs("div",{className:"flex gap-2 mb-4",children:[a.jsxs(Y,{onClick:b,variant:"outline",size:"sm",children:[a.jsx(ah,{className:"w-4 h-4 mr-2"}),"Clear"]}),a.jsxs(Y,{onClick:w,variant:"default",size:"sm",children:[a.jsx(mr,{className:"w-4 h-4 mr-2"}),"Check"]}),a.jsxs(Y,{onClick:j,variant:"outline",size:"sm",children:[a.jsx(ns,{className:"w-4 h-4 mr-2"}),"Next"]})]}),u&&a.jsx("div",{className:"p-3 bg-indigo-50 border border-indigo-200 rounded-lg text-sm text-indigo-800",children:u})]})]})]})},no=[{question:"What sound does à´® make?",options:["ma","me","m","mu"],correct:0},{question:"What sound does à´² make?",options:["l","la","li","le"],correct:1},{question:"What sound does à´ª make?",options:["p","pi","pa","pe"],correct:2},{question:"What sound does à´¨ make?",options:["ni","ne","n","na"],correct:3}],ule=()=>{const[e,t]=y.useState(0),[r,n]=y.useState(0),[s,i]=y.useState(!1),[o,l]=y.useState(null),c=d=>{s||(l(d),i(!0),d===no[e].correct&&n(r+1))},u=()=>{e<no.length-1&&(t(e+1),i(!1),l(null))},h=()=>{t(0),n(0),i(!1),l(null)};return a.jsx("div",{className:"py-16 px-4 bg-white",children:a.jsxs("div",{className:"max-w-3xl mx-auto",children:[a.jsx("h2",{className:"text-4xl font-bold text-indigo-900 mb-8 text-center",children:"Practice Quiz"}),a.jsxs("div",{className:"bg-gradient-to-br from-indigo-50 to-purple-50 rounded-2xl shadow-xl p-8",children:[a.jsxs("div",{className:"mb-6",children:[a.jsxs("div",{className:"flex justify-between items-center mb-4",children:[a.jsxs("span",{className:"text-sm font-semibold text-indigo-600",children:["Question ",e+1," of ",no.length]}),a.jsxs("span",{className:"text-sm font-semibold text-amber-600",children:["Score: ",r]})]}
785),a.jsx("h3",{className:"text-2xl font-bold text-gray-800 mb-6",children:no[e].question})]}),a.jsx("div",{className:"grid grid-cols-2 gap-4 mb-6",children:no[e].options.map((d,f)=>a.jsx("button",{onClick:()=>c(f),disabled:s,className:`p-4 rounded-lg font-semibold text-lg transition-all ${s&&f===no[e].correct?"bg-green-500 text-white":s&&f===o?"bg-red-500 text-white":"bg-white hover:bg-indigo-100 text-gray-800"}`,children:d},f))}),a.jsxs("div",{className:"flex gap-4",children:[s&&e<no.length-1&&a.jsx("button",{onClick:u,className:"flex-1 bg-indigo-600 hover:bg-indigo-700 text-white py-3 rounded-lg font-semibold",children:"Next Question"}),s&&e===no.length-1&&a.jsxs("button",{onClick:h,className:"flex-1 bg-amber-500 hover:bg-amber-600 text-white py-3 rounded-lg font-semibold flex items-center justify-center gap-2",children:[a.jsx(Gn,{className:"w-5 h-5"}),"Try Again"]})]})]})]})})},dle=()=>a.jsx("section",{className:"py-16 px-4 bg-gradient-to-br from-purple-50 to-pink-50",children:a.jsxs("div",{className:"max-w-6xl mx-auto",children:[a.jsx("h2",{className:"text-4xl font-bold text-center mb-4 text-purple-900",children:"Malayalam Vowel Signs (Matras)"}),a.jsxs("p",{className:"text-lg text-center text-gray-700 mb-12 max-w-3xl mx-auto",children:["Vowel signs, called ",a.jsx("span",{className:"font-bold text-purple-700",children:"matras"}),", are symbols that attach to consonants to change their vowel sound. Remember, consonants have a built-in 'a' sound, but matras modify this to create different sounds like 'i', 'u', 'e', 'o', etc."]}),a.jsxs("div",{className:"grid md:grid-cols-3 gap-6 mb-8",children:[a.jsxs(se,{className:"p-6 bg-white shadow-lg hover:shadow-xl transition-shadow",children:[a.jsx("div",{className:"text-4xl mb-3 text-center",children:"📝"}),a.jsx("h3",{className:"text-xl font-bold mb-2 text-purple-800",children:"What are Matras?"}),a.jsx("p",{className:"text-gray-700",children:"Matras are diacritical marks that attach to consonants to change the vowel sound from the default 'a' to other vowels."})]}),a.jsxs(se,{className:"p-6 bg-white shadow-lg hover:shadow-xl transition-shadow",children:[a.jsx("div",{className:"text-4xl mb-3 text-center",children:"🔄"}),a.jsx("h3",{className:"text-xl font-bold mb-2 text-purple-800",children:"How They Work"}),a.jsx("p",{className:"text-gray-700",children:"Matras can appear above, below, before, or after the consonant. Each position creates a different vowel sound."})]}),a.jsxs(se,{className:"p-6 bg-white shadow-lg hover:shadow-xl transition-shadow",children:[a.jsx("div",{className:"text-4xl mb-3 text-center",children:"🎯"}),a.jsx("h3",{className:"text-xl font-bold mb-2 text-purple-800",children:"Master the Pattern"}),a.jsx("p",{className:"text-gray-700",children:"Once you learn the matra patterns, you can read any Malayalam word by combining consonants with their vowel signs!"})]})]})]})}),hle=()=>{const[e,t]=y.useState(null),r=[{name:"No matra (a)",consonant:"ക",sound:"ka",position:"inherent",example:"കമല (kamala)"},{name:"ാ (aa)",consonant:"കാ",sound:"kaa",position:"right",example:"കാല (kaala)"},{name:"ി (i)",consonant:"കി",sound:"ki",position:"left",example:"കിണർ (kinar)"},{name:"ീ (ii)",consonant:"കീ",sound:"kii",position:"left",example:"കീറ (keera)"},{name:"ു (u)",consonant:"കു",sound:"ku",position:"below",example:"കുട (kuda)"},{name:"ൂ (uu)",consonant:"കൂ",sound:"kuu",position:"below",example:"കൂട (kooda)"},{name:"െ (e)",consonant:"കെ",sound:"ke",position:"left",example:"കെട്ട് (kettu)"},{name:"േ (ee)",consonant:"കേ",sound:"kay",position:"left",example:"കേരളം (keralam)"},{name:"ൈ (ai)",consonant:"കൈ",sound:"kai",position:"left",example:"കൈ (kai)"},{name:"ൊ (o)",consonant:"കൊ",sound:"ko",position:"left+right",example:"കൊടി (kodi)"},{name:"ോ (oo)",consonant:"കോ",sound:"koh",position:"left+right",example:"കോട (kota)"},{name:"ൗ (au)",consonant:"കൗ",sound:"kau",position:"right",example:"കൗതുകം (kauthukam)"}],n=async s=>{if(!e){t(s);try{await M2(s,{onStart:()=>console.log(`Playing audio for ${s}`),onEnd:()=>t(null)})}catch(i){console.error("Error playing audio:",i),t(null)}}};return a.jsx("section",{className:"py-16 px-4 bg-white",children:a.jsxs("div",{className:"max-w-7xl mx-auto",children:[a.jsx("h2",{className:"text-3xl font-bold text-center mb-4 text-purple-900",children:"Vowel Sign Positions"}),a.jsx("p",{className:"text-center text-gray-700 mb-12 max-w-2xl mx-auto",children:"See how different vowel signs attach to the consonant 'ക' (ka) to create different sounds. Click on any card to hear the pronunciation!"}),a.jsx("div",{className:"grid md:grid-cols-3 lg:grid-cols-4 gap-4",children:r.map((s,i)=>{const o=e===s.sound;return a.jsx(se,{onClick:()=>n(s.sound),className:`p-6 hover:shadow-lg transition-all cursor-pointer bg-gradient-to-br from-purple-50 to-white border-2 border-purple-200 hover:border-purple-400 ${o?"scale-105 border-purple-500 shadow-lg ring-2 ring-purple-300":""}`,children:a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"text-5xl font-bold mb-2 text-purple-900",children:s.consonant}),a.jsxs("div",{className:"flex items-center justify-center gap-2 mb-1",children:[a.jsx("div",{className:`text-xl font-semibold text-purple-700 ${o?"text-purple-500":""}`,children:s.sound}),a.jsx(Xe,{className:`w-5 h-5 transition-all ${o?"text-purple-500 animate-pulse":"text-purple-400 hover:text-purple-600"}`})]}),a.jsx("div",{className:"text-sm text-gray-600 mb-2",children:s.name}),a.jsx("div",{className:"text-xs bg-purple-100 rounded-full px-3 py-1 inline-block mb-2",children:s.position}),a.jsx("div",{className:"text-sm text-gray-700 mt-2 font-medium",children:s.example}),o&&a.jsx("div",{className:"text-xs text-purple-500 mt-2 animate-pulse",children:"Playing..."})]})},i)})})]})})},fle=()=>{const e=[{letter:"ക",roman:"k"},{letter:"ഖ",roman:"kh"},{letter:"ഗ",roman:"g"},{letter:"ഘ",roman:"gh"},{letter:"ങ",roman:"ng"},{letter:"ച",roman:"ch"},{letter:"ത",roman:"th"},{letter:"പ",roman:"p"},{letter:"മ",roman:"m"},{letter:"ല",roman:"l"},{letter:"വ",roman:"v"},{letter:"ന",roman:"n"}],t=[{vowel:"a",suffix:"",example:"ക"},{vowel:"aa",suffix:"ാ",example:"കാ"},{vowel:"i",suffix:"ി",example:"കി"},{vowel:"ii",suffix:"ീ",example:"കീ"},{vowel:"u",suffix:"ു",example:"കു"},{vowel:"uu",suffix:"ൂ",example:"കൂ"},{vowel:"e",suffix:"െ",example:"കെ"},{vowel:"ee",suffix:"േ",example:"കേ"},{vowel:"ai",suffix:"ൈ",example:"കൈ"}
785,{vowel:"o",suffix:"ൊ",example:"കൊ"},{vowel:"oo",suffix:"ോ",example:"കോ"},{vowel:"au",suffix:"ൗ",example:"കൗ"}],[r,n]=y.useState(e[0]),[s,i]=y.useState(null),o=(c,u)=>{M2(c,{onStart:()=>i(u),onEnd:()=>i(null)})},l=(c,u)=>u===""?c:c+u;return a.jsx("section",{className:"py-16 px-4 bg-gradient-to-br from-blue-50 to-purple-50",children:a.jsxs("div",{className:"max-w-6xl mx-auto",children:[a.jsx("h2",{className:"text-3xl font-bold text-center mb-4 text-purple-900",children:"Interactive Consonant-Vowel Combinations"}),a.jsx("p",{className:"text-center text-gray-700 mb-8",children:"Select a consonant and see all its vowel combinations. Click any card to hear the pronunciation."}),a.jsx("div",{className:"flex flex-wrap justify-center gap-3 mb-8",children:e.map(c=>a.jsx(Y,{onClick:()=>n(c),variant:r.letter===c.letter?"default":"outline",className:"text-2xl px-6 py-6",children:c.letter},c.letter))}),a.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 lg:grid-cols-6 gap-4",children:t.map((c,u)=>{const h=l(r.letter,c.suffix),d=r.roman+c.vowel,f=s===u;return a.jsx(se,{className:`p-6 bg-white hover:shadow-xl transition-all cursor-pointer border-2 ${f?"border-purple-600 bg-purple-50 scale-105":"hover:border-purple-400"}`,onClick:()=>o(d,u),children:a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"text-5xl font-bold mb-3 text-purple-900",children:h}),a.jsx("div",{className:"text-xl font-semibold text-purple-700 mb-2",children:d}),a.jsxs(Y,{size:"sm",variant:"ghost",className:"mt-2",children:[a.jsx(Xe,{className:`w-4 h-4 mr-1 ${f?"text-purple-600 animate-pulse":""}`}),f?"Playing...":"Listen"]})]})},u)})}),a.jsxs("div",{className:"mt-8 p-4 bg-white/80 rounded-lg border border-purple-200",children:[a.jsx("h3",{className:"text-lg font-semibold text-purple-900 mb-2",children:"Audio File Format"}),a.jsxs("p",{className:"text-gray-700 text-sm mb-2",children:["Audio files should be named using romanization: ",a.jsx("code",{className:"bg-purple-100 px-2 py-1 rounded",children:"ka.mp3"}),", ",a.jsx("code",{className:"bg-purple-100 px-2 py-1 rounded",children:"kaa.mp3"}),", ",a.jsx("code",{className:"bg-purple-100 px-2 py-1 rounded",children:"ki.mp3"}),", ",a.jsx("code",{className:"bg-purple-100 px-2 py-1 rounded",children:"kii.mp3"}),", etc."]}),a.jsxs("p",{className:"text-gray-600 text-xs",children:["Files can be uploaded to the root of the audio-files bucket, or organized in folders like ",a.jsx("code",{className:"bg-purple-100 px-1 rounded",children:"k-series/"}),", ",a.jsx("code",{className:"bg-purple-100 px-1 rounded",children:"ch-series/"}),", ",a.jsx("code",{className:"bg-purple-100 px-1 rounded",children:"th-series/"}),", etc."]})]})]})})},mle=()=>{const e=[{malayalam:"കി",sound:"ki",options:["ka","ki","ku","ke"]},{malayalam:"മാ",sound:"maa",options:["ma","maa","mi","mu"]},{malayalam:"തു",sound:"thu",options:["tha","thi","thu","the"]},{malayalam:"പേ",sound:"pay",options:["pa","pe","pay","po"]},{malayalam:"ലൂ",sound:"loo",options:["la","lu","loo","le"]},{malayalam:"വെ",sound:"ve",options:["va","ve","vi","vo"]},{malayalam:"നൈ",sound:"nai",options:["na","ne","nai","no"]},{malayalam:"രോ",sound:"roh",options:["ra","re","ro","roh"]}],[t,r]=y.useState(0),[n,s]=y.useState(0),[i,o]=y.useState(null),[l,c]=y.useState(!1),u=f=>{const m=f===e[t].sound;o(m?"correct":"incorrect"),m&&s(n+1),setTimeout(()=>{t<e.length-1?(r(t+1),o(null)):c(!0)},1e3)},h=()=>{r(0),s(0),o(null),c(!1)};if(l)return a.jsx("section",{className:"py-16 px-4 bg-white",children:a.jsx("div",{className:"max-w-2xl mx-auto text-center",children:a.jsxs(se,{className:"p-12 bg-gradient-to-br from-green-50 to-blue-50",children:[a.jsx("div",{className:"text-6xl mb-4",children:"🎉"}),a.jsx("h3",{className:"text-3xl font-bold mb-4 text-purple-900",children:"Practice Complete!"}),a.jsxs("p",{className:"text-2xl mb-6 text-gray-700",children:["Your Score: ",a.jsxs("span",{className:"font-bold text-purple-700",children:[n,"/",e.length]})]}),a.jsx(Y,{onClick:h,size:"lg",className:"bg-purple-600 hover:bg-purple-700",children:"Practice Again"})]})})});const d=e[t];return a.jsx("section",{className:"py-16 px-4 bg-white",children:a.jsxs("div",{className:"max-w-3xl mx-auto",children:[a.jsx("h2",{className:"text-3xl font-bold text-center mb-8 text-purple-900",children:"Match the Sound - Practice Exercise"}),a.jsx("div",{className:"mb-6 text-center",children:a.jsxs("span",{className:"text-lg text-gray-600",children:["Question ",t+1," of ",e.length," | Score: ",n]})}),a.jsx(se,{className:"p-12 mb-8 bg-gradient-to-br from-purple-50 to-pink-50",children:a.jsxs("div",{className:"text-center",children:[a.jsx("p",{className:"text-lg text-gray-700 mb-4",children:"What sound does this make?"}),a.jsx("div",{className:"text-8xl font-bold text-purple-900 mb-6",children:d.malayalam}),a.jsxs(Y,{onClick:()=>Fr(d.malayalam),variant:"outline",className:"mt-4",children:[a.jsx(Xe,{className:"w-5 h-5 mr-2"}),"Listen to Pronunciation"]})]})}),a.jsx("div",{className:"grid grid-cols-2 gap-4",children:d.options.map((f,m)=>a.jsx(Y,{onClick:()=>u(f),disabled:i!==null,size:"lg",variant:"outline",className:"text-2xl py-8 hover:bg-purple-100 hover:border-purple-400 transition-all",children:f},m))}),i&&a.jsx("div",{className:`mt-6 p-4 rounded-lg text-center ${i==="correct"?"bg-green-100 text-green-800":"bg-red-100 text-red-800"}`,children:i==="correct"?a.jsxs("div",{className:"flex items-center justify-center gap-2",children:[a.jsx(mr,{className:"w-6 h-6"}),a.jsx("span",{className:"text-xl font-semibold",children:"Correct!"})]}):a.jsxs("div",{className:"flex items-center justify-center gap-2",children:[a.jsx(jt,{className:"w-6 h-6"}),a.jsxs("span",{className:"text-xl font-semibold",children:['Incorrect. The answer is "',d.sound,'"']})]})})]})})};function ple(){return a.jsxs(se,{className:"p-6 bg-gradient-to-br from-purple-50 to-pink-50 border-purple-200",children:[a.jsx("h3",{className:"text-2xl font-bold text-purple-900 mb-4",children:"What are Conjunct Consonants?"}),a.jsxs("div",{className:"space-y-4 text-gray-700",children:[a.jsxs("p",{className:"text-lg",children:[a.jsx("strong",{children:"Conjunct consonants"})," (സംയുക്താക്ഷരങ്ങൾ) are formed when two or more consonants combine together without a vowel sound between them."]}),a.jsxs("div",{className:"bg-amber-50 p-4 rounded-lg border-2 border-amber-300",children:[a.jsx("p",{className:"font-bold text-amber-900 mb
785-2 text-lg",children:"⚠️ Important Pronunciation Difference:"}),a.jsxs("p",{className:"text-gray-800 leading-relaxed",children:["Unlike English where doubling consonants adds ",a.jsx("strong",{children:"stress or accent"}),' (like "better" or "summer"), in Malayalam, doubling consonants creates an ',a.jsx("strong",{children:"unstressed, softer pronunciation"})," with no emphasis."]})]}),a.jsxs("div",{className:"bg-white p-4 rounded-lg border-2 border-purple-200",children:[a.jsx("p",{className:"font-semibold text-purple-800 mb-2",children:"How They Work:"}),a.jsxs("ul",{className:"list-disc list-inside space-y-2",children:[a.jsx("li",{children:"The first consonant loses its inherent 'a' sound"}),a.jsxs("li",{children:["A special mark (്) called ",a.jsx("strong",{children:"chandrakkala"})," removes the vowel"]}),a.jsxs("li",{children:["The consonants merge: ",a.jsx("span",{className:"text-xl font-bold text-purple-900",children:"ക + ക = ക്ക"})," (ka + ka = kka - pronounced softly, no stress)"]}),a.jsxs("li",{children:["Example: ",a.jsx("span",{className:"text-xl",children:"പ + പ = പ്പ"})," (pa + pa = ppa - gentle, unstressed)"]}),a.jsx("li",{children:"Common in Malayalam words like പക്ഷി (pakshi - bird), സ്കൂൾ (school)"})]})]}),a.jsx("p",{className:"text-sm italic text-purple-700",children:"Remember: Doubling in Malayalam = softer sound, NOT stronger accent!"})]})]})}const gle=[{parts:["ക","+","ക"],result:"ക്ക",sound:"kka",formula:"ka + ka",example:"പക്ഷി (bird)",note:"Soft, no stress"},{parts:["ത","+","ത"],result:"ത്ത",sound:"tta",formula:"ta + ta",example:"പത്തു (ten)",note:"Gentle pronunciation"},{parts:["പ","+","പ"],result:"പ്പ",sound:"ppa",formula:"pa + pa",example:"പപ്പ (lentil)",note:"Unstressed double"},{parts:["ന","+","ന"],result:"ന്ന",sound:"nna",formula:"na + na",example:"പെണ്ണ് (girl)",note:"Soft combination"}];function yle(){return a.jsxs("div",{className:"space-y-4",children:[a.jsx("h3",{className:"text-2xl font-bold text-gray-900",children:"Visual Breakdown: How Consonants Combine"}),a.jsxs("p",{className:"text-gray-600 mb-4",children:["Each conjunct is formed by combining two consonants. Remember: this creates a ",a.jsx("strong",{children:"softer, unstressed"})," sound!"]}),a.jsx("div",{className:"grid md:grid-cols-2 gap-4",children:gle.map((e,t)=>a.jsxs(se,{className:"p-5 hover:shadow-lg transition-shadow border-2 border-purple-100",children:[a.jsxs("div",{className:"flex items-center justify-between mb-3",children:[a.jsx("div",{className:"flex items-center gap-2 text-3xl font-bold text-gray-800",children:e.parts.map((r,n)=>a.jsx("span",{className:r==="+"?"text-purple-600 text-2xl":"",children:r},n))}),a.jsx(rn,{className:"text-purple-600",size:28}),a.jsx("div",{className:"text-4xl font-bold text-purple-700",children:e.result})]}),a.jsxs("div",{className:"text-sm text-gray-700 space-y-1 bg-purple-50 p-3 rounded",children:[a.jsxs("p",{children:[a.jsx("strong",{children:"Formula:"})," ",a.jsx("span",{className:"text-purple-800",children:e.formula})," = ",e.sound]}),a.jsxs("p",{children:[a.jsx("strong",{children:"Example:"})," ",e.example]}),a.jsxs("p",{className:"text-xs italic text-amber-700",children:["💡 ",e.note]})]})]},t))})]})}function vle({malayalam:e,romanization:t,components:r,example:n,exampleMeaning:s}){const[i,o]=y.useState(!1),l=()=>{u6(e,{onStart:()=>o(!0),onEnd:()=>o(!1)})};return a.jsx(se,{className:"p-6 hover:shadow-xl transition-all hover:scale-105 bg-gradient-to-br from-white to-purple-50",children:a.jsxs("div",{className:"text-center space-y-3",children:[a.jsx("div",{className:"text-6xl font-bold text-purple-700 mb-2",children:e}),a.jsx("div",{className:"text-sm text-gray-600 font-mono",children:r}),a.jsxs(Y,{onClick:l,variant:"outline",size:"sm",className:`w-full ${i?"bg-purple-100 border-purple-400":""}`,disabled:i,children:[a.jsx(Xe,{className:`w-4 h-4 mr-2 ${i?"animate-pulse text-purple-600":""}`}),t]}),a.jsxs("div",{className:"pt-2 border-t border-purple-200",children:[a.jsx("p",{className:"text-sm font-semibold text-gray-700",children:n}),a.jsx("p",{className:"text-xs text-gray-500 italic",children:s})]})]})})}const xle=[{malayalam:"ക്ക",romanization:"kka",components:"ക + ് + ക",example:"പക്ഷി",meaning:"bird"},{malayalam:"ത്ത",romanization:"tta",components:"ത + ് + ത",example:"പത്തു",meaning:"ten"},{malayalam:"പ്പ",romanization:"ppa",components:"പ + ് + പ",example:"പപ്പ",meaning:"lentil"},{malayalam:"ന്ന",romanization:"nna",components:"ന + ് + ന",example:"പെണ്ണ്",meaning:"girl"},{malayalam:"മ്മ",romanization:"mma",components:"മ + ് + മ",example:"അമ്മ",meaning:"mother"},{malayalam:"ല്ല",romanization:"lla",components:"ല + ് + ല",example:"പല്ല്",meaning:"tooth"},{malayalam:"ണ്ണ",romanization:"nna",components:"ണ + ് + ണ",example:"കണ്ണ്",meaning:"eye"},{malayalam:"റ്റ",romanization:"tta",components:"റ + ് + റ",example:"പറ്റി",meaning:"about"},{malayalam:"സ്സ",romanization:"ssa",components:"സ + ് + സ",example:"പൈസ്സ",meaning:"money"},{malayalam:"ന്ത",romanization:"ntha",components:"ന + ് + ത",example:"സന്തോഷം",meaning:"happiness"},{malayalam:"മ്പ",romanization:"mpa",components:"മ + ് + പ",example:"കമ്പി",meaning:"wire"},{malayalam:"ങ്ക",romanization:"nka",components:"ങ + ് + ക",example:"അങ്കം",meaning:"number"}];function ble(){return a.jsxs("div",{className:"space-y-4",children:[a.jsx("h3",{className:"text-2xl font-bold text-gray-900",children:"Common Conjunct Consonants"}),a.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-4",children:xle.map((e,t)=>a.jsx(vle,{malayalam:e.malayalam,romanization:e.romanization,components:e.components,example:e.example,exampleMeaning:e.meaning},t))})]})}const Rn=[{conjunct:"ക്ക",options:["kka","ka","kaa","kka"],correct:"kka"},{conjunct:"ത്ത",options:["ta","tta","thha","taa"],correct:"tta"},{conjunct:"പ്പ",options:["pa","ppa","pha","paa"],correct:"ppa"},{conjunct:"ന്ന",options:["na","nna","naa","nha"],correct:"nna"},{conjunct:"മ്മ",options:["ma","mma","maa","mha"],correct:"mma"},{conjunct:"ല്ല",options:["la","lla","laa","lha"],correct:"lla"},{conjunct:"ന്ത",options:["ntha","nta","nda","nha"],correct:"ntha"},{conjunct:"മ്പ",options:["mpa","mba","ma","mpha"],correct:"mpa"}];function wle(){const[e,t]=y.useState(0),[r,n]=y.useState(0),[s,i]=y.useState(null),[o,l]=y.useState(!1),c=f=>{i(f),l(!0),f===Rn[e].correct&&n(r+1)},u=()=>{e<Rn.length-1&&(t(e+1),i(null),l(!1))},h=()=>{t(0),n(0),i(null),l(!1)},d=e===Rn.length-1&&o;return a.jsxs(se,{className:"p-8 bg-gradient-to-br from-purple-50 to-pink-50",children:[a.jsx("h3",{className:"text-2xl font-bold text-gray-900 mb-6",children:"Practice: Match the Sound"}),d?a.jsxs("div",{className:"text-center space-y-4",children:[a.jsx("h4",{className:"text-3xl font-bold text-purple-700",children:"Complete!"}),a.jsxs("p",{className:"text-xl",children:["Your Score: ",r,"/",Rn.length]}),a.jsx(Y,{onClick:h,size:"lg",children:"Try Again"})]}):a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"text-7xl font-bold text-purple-700 mb-4",children:Rn[e].conjunct}),a.jsx("p",{className:"text-gray-600 mb-3",children:"How is this pronounced?"}),a.jsxs(Y,{onClick:()=>Fr(Rn[e].conjunct),variant:"outline",size:"sm",children:[a.jsx(Xe,{className:"w-4 h-4 mr-2"}),"Listen"]})]}),a.jsx("div",{className:"grid grid-cols-2 gap-3",children:Rn[e].options.map((f,m)=>a.jsxs(Y,{onClick:()=>c(f),disabled:o,variant:o&&f===Rn[e].correct?"default":"outline",className:`h-16 text-lg ${o&&f===s&&f!==Rn[e].correct?"bg-red-100 border-red-400":o&&f===Rn[e].correct?"bg-green-500 text-white":""}`,children:[f,o&&f===Rn[e].correct&&a.jsx(mr,{className:"ml-2 w-5 h-5"}),o&&f===s&&f!==Rn[e].correct&&a.jsx(jt,{className:"ml-2 w-5 h-5"})]},m))}),o&&a.jsx(Y,{onClick:u,className:"w-full",size:"lg",children:"Next Question"}),a.jsxs("p",{className:"text-center text-gray-600",children:["Question ",e+1," of ",Rn.length," | Score: ",r]})]})]})}const jle=[{name:"Velar Consonants",description:"Produced at the back of the mouth with the back of the tongue against the soft palate (velum)",placement:"Back of tongue touches soft palate",consonants:[{ml:"ക",roman:"ka"},{ml:"ഖ",roman:"kha"},{ml:"ഗ",roman:"ga"},{ml:"ഘ",roman:"gha"},{ml:"ങ",roman:"ṅa"}],color:"bg-red-50 border-red-200"},{name:"Palatal Consonants",description:"Produced with the middle of the tongue raised toward the hard palate",placement:"Middle of tongue touches hard palate",consonants:[{ml:"ച",roman:"ca"},{ml:"ഛ",roman:"cha"},{ml:"ജ",roman:"ja"},{ml:"ഝ",roman:"jha"},{ml:"ഞ",roman:"ña"}],color:"bg-orange-50 border-orange-200"},{name:"Retroflex Consonants",description:"Produced with the tongue curled back toward the roof of the mouth",placement:"Tongue tip curls back to roof of mouth",consonants:[{ml:"ട",roman:"ṭa"},{ml:"ഠ",roman:"ṭha"},{ml:"ഡ",roman:"ḍa"},{ml:"ഢ",roman:"ḍha"},{ml:"ണ",roman:"ṇa"}],color:"bg-yellow-50 border-yellow-200"},{name:"Dental Consonants",description:"Produced with the tongue tip touching the upper teeth",placement:"Tongue tip touches upper teeth",consonants:[{ml:"ത",roman:"ta"},{ml:"ഥ",roman:"tha"},{ml:"ദ",roman:"da"},{ml:"ധ",roman:"dha"},{ml:"ന",roman:"na"}],color:"bg-green-50 border-green-200",specialNote:{character:"ന",note:'The letter ന has two pronunciations: dental sound when at the beginning of a word (e.g., നാട്), but pronounced like the "n" in English "now" when not at the beginning.'}},{name:"Labial Consonants",description:"Produced with both lips coming together",placement:"Both lips come together",consonants:[{ml:"പ",roman:"pa"},{ml:"ഫ",roman:"pha"},{ml:"ബ",roman:"ba"},{ml:"ഭ",roman:"bha"},{ml:"മ",roman:"ma"}],color:"bg-blue-50 border-blue-200"},{name:"Semi-vowels",description:"Consonants that have vowel-like qualities, acting as a bridge between vowels and consonants",placement:"Palatal (യ) and Labial (വ) positions",consonants:[{ml:"യ",roman:"ya"},{ml:"വ",roman:"va"}],color:"bg-purple-50 border-purple-200"},{name:"Trills and Laterals",description:"Consonants produced with vibration or lateral airflow",placement:"Various positions - alveolar, retroflex, and dental",consonants:[{ml:"ര",roman:"ra"},{ml:"ല",roman:"la"},{ml:"ള",roman:"ḷa"},{ml:"ഴ",roman:"zha"},{ml:"റ",roman:"ṟa"}],color:"bg-teal-50 border-teal-200"},{name:"Fricatives",description:"Consonants produced by forcing air through a narrow channel, creating friction",placement:"Palatal, retroflex, alveolar, and glottal positions",consonants:[{ml:"ശ",roman:"sha"},{ml:"ഷ",roman:"ṣha"},{ml:"സ",roman:"sa"},{ml:"ഹ",roman:"ha"}],color:"bg-pink-50 border-pink-200"}
785];function _le(){const[e,t]=y.useState(null),r=async n=>{t(n),await Fr(n),t(null)};return a.jsxs("div",{className:"space-y-8",children:[a.jsxs("div",{className:"text-center space-y-4",children:[a.jsx("h2",{className:"text-3xl font-bold",children:"Consonants by Tongue Placement"}),a.jsx("p",{className:"text-lg text-muted-foreground max-w-3xl mx-auto",children:"Malayalam consonants are organized by where your tongue is positioned in your mouth. Understanding these groups helps you pronounce each letter correctly."})]}),a.jsx("div",{className:"grid gap-6",children:jle.map(n=>a.jsxs(se,{className:`border-2 ${n.color}`,children:[a.jsxs(_e,{children:[a.jsx(Se,{className:"text-xl",children:n.name}),a.jsx("p",{className:"text-sm text-muted-foreground",children:n.description}),a.jsxs("p",{className:"text-sm font-semibold text-primary",children:["📍 ",n.placement]})]}),a.jsxs(ue,{className:"space-y-4",children:[a.jsx("div",{className:"grid grid-cols-5 gap-4",children:n.consonants.map(s=>a.jsxs("div",{className:"flex flex-col items-center space-y-2 p-4 bg-white rounded-lg border-2 hover:shadow-md transition-shadow",children:[a.jsx("span",{className:"text-4xl font-bold",children:s.ml}),a.jsx("span",{className:"text-sm text-muted-foreground",children:s.roman}),a.jsx(Y,{size:"sm",variant:"outline",onClick:()=>r(s.ml),className:e===s.ml?"bg-primary text-white":"",children:a.jsx(Xe,{className:"h-4 w-4"})})]},s.ml))}),n.specialNote&&a.jsx("div",{className:"mt-4 p-4 bg-amber-50 border-2 border-amber-200 rounded-lg",children:a.jsxs("div",{className:"flex items-start gap-2",children:[a.jsx("span",{className:"text-2xl font-bold text-amber-600",children:n.specialNote.character}),a.jsxs("div",{className:"flex-1",children:[a.jsx("p",{className:"text-sm font-semibold text-amber-900 mb-1",children:"Special Pronunciation Note:"}),a.jsx("p",{className:"text-sm text-amber-800",children:n.specialNote.note})]})]})})]})]},n.name))})]})}const _u=new Map,jn="audio-files",Nm=async(e,t,r,n)=>{try{const s=`${t}/${r}`,{data:i,error:o}=await ne.storage.from(jn).upload(s,e,{cacheControl:"3600",upsert:!0});if(o)throw o;const l=Bp(t,r);return n&&n(100),_u.delete(`${t}/${r}`),{success:!0,url:l}}catch(s){return console.error("Upload error:",s),{success:!1,error:s.message}}},Bp=(e,t)=>{const r=e?`${e}/${t}`:t;return`${tr}/storage/v1/object/public/${jn}/${r}`},Mf=async(e,t)=>{const r=`${e}/${t}`;if(_u.has(r))return _u.get(r);try{const n=Bp(e,t),s=await fetch(n,{method:"HEAD",cache:"no-cache"}),i=s.ok&&s.status===200;return _u.set(r,i),i||console.log(`Audio file not found: ${n} (status: ${s.status})`),i}catch(n){return console.warn(`Error checking audio file: ${e}/${t}`,n),_u.set(r,!1),!1}},p1=async e=>{try{return(await fetch(e,{method:"HEAD",cache:"no-cache"})).ok}catch{return!1}},Sle=async()=>{const e=[];try{const{data:t,error:r}=await ne.storage.from(jn).list("",{limit:500});if(!r&&t)for(const n of t)if(n.metadata!==null)e.push({path:"",name:n.name});else{const{data:s}=await ne.storage.from(jn).list(n.name,{limit:500});if(s)for(const i of s)if(i.metadata!==null)e.push({path:n.name,name:i.name});else{const{data:o}=await ne.storage.from(jn).list(`${n.name}/${i.name}`,{limit:500});if(o)for(const l of o)l.metadata!==null&&e.push({path:`${n.name}/${i.name}`,name:l.name})}}}catch(t){console.error("Error listing all audio files:",t)}return e},gF=()=>{_u.clear()},Uh=[{malayalam:"നാട്",transliteration:"nāṭ",meaning:"country/place",position:"beginning",audioFile:"word-naadu"},{malayalam:"നല്ല",transliteration:"nalla",meaning:"good",position:"beginning",audioFile:"word-nalla"},{malayalam:"നീല",transliteration:"nīla",meaning:"blue",position:"beginning",audioFile:"word-neela"},{malayalam:"മനസ്സ്",transliteration:"manassu",meaning:"mind",position:"middle",audioFile:"word-manassu"},{malayalam:"പണം",transliteration:"paṇaṃ",meaning:"money",position:"middle",audioFile:"word-panam"},{malayalam:"വനം",transliteration:"vana",meaning:"forest",position:"middle",audioFile:"word-vana"}];function Nle(){const[e,t]=y.useState(null),[r,n]=y.useState(null),[s,i]=y.useState({}),[o,l]=y.useState(!0),c=y.useRef(null);y.useEffect(()=>{(async()=>
785{l(!0);const g={};for(const p of Uh){const v=await Mf("words",`${p.audioFile}.mp3`);g[p.audioFile]=v}i(g),l(!1)})()},[]);const u=async m=>{var g;if(e===m.malayalam){(g=c.current)==null||g.pause(),t(null);return}if(!s[m.audioFile]){Pe.error(`Audio not available for "${m.transliteration}". Upload ${m.audioFile}.mp3 to enable playback.`);return}n(m.malayalam);try{const p=Bp("words",`${m.audioFile}.mp3`);c.current&&(c.current.src=p,c.current.oncanplaythrough=()=>{var v;n(null),t(m.malayalam),(v=c.current)==null||v.play()},c.current.onended=()=>{t(null)},c.current.onerror=()=>{n(null),t(null),Pe.error(`Failed to load audio for "${m.transliteration}"`)},c.current.load())}catch{n(null),Pe.error(`Error playing audio for "${m.transliteration}"`)}},h=Uh.filter(m=>m.position==="beginning"),d=Uh.filter(m=>m.position!=="beginning"),f=(m,g)=>{const p=e===m.malayalam,v=r===m.malayalam,x=s[m.audioFile];return a.jsxs("div",{className:`flex items-center justify-between p-3 ${g} rounded-lg`,children:[a.jsxs("div",{children:[a.jsx("div",{className:"text-2xl font-bold",children:m.malayalam}),a.jsx("div",{className:"text-sm text-gray-600",children:m.transliteration}),a.jsx("div",{className:"text-xs text-gray-500",children:m.meaning})]}),a.jsxs(Y,{size:"sm",variant:p?"default":"outline",onClick:()=>u(m),disabled:v||o,className:"relative",title:x?"Play audio":`Audio not uploaded (${m.audioFile}.mp3)`,children:[v?a.jsx(Fe,{className:"w-4 h-4 animate-spin"}):!x&&!o?a.jsx(xd,{className:"w-4 h-4 text-gray-400"}):a.jsx(Xe,{className:"w-4 h-4"}),!x&&!o&&a.jsx("span",{className:"absolute -top-1 -right-1 w-2 h-2 bg-orange-500 rounded-full",title:"Audio not uploaded"})]})]},m.malayalam)};return a.jsx("section",{className:"py-16 bg-gradient-to-br from-amber-50 to-orange-50",children:a.jsxs("div",{className:"container mx-auto px-4",children:[a.jsx("audio",{ref:c,className:"hidden"}),a.jsx("h2",{className:"text-3xl font-bold text-center mb-4",children:"Special Pronunciation: ന"}),a.jsx("p",{className:"text-center text-gray-600 mb-8 max-w-3xl mx-auto",children:"The consonant ന has two different pronunciations depending on its position in a word"}),o?a.jsxs("div",{className:"text-center text-sm text-gray-500 mb-4",children:[a.jsx(Fe,{className:"w-4 h-4 inline-block animate-spin mr-2"}),"Checking audio availability..."]}):a.jsxs("div",{className:"text-center text-sm text-gray-500 mb-4",children:[Object.values(s).filter(Boolean).length," of ",Uh.length," audio files available",Object.values(s).some(m=>!m)&&a.jsx("span",{className:"ml-2 text-orange-600",children:"(Upload missing files via Audio Admin)"})]}),a.jsxs("div",{className:"grid md:grid-cols-2 gap-8 max-w-5xl mx-auto",children:[a.jsxs(se,{className:"p-6 bg-white shadow-lg",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[a.jsx("div",{className:"w-3 h-3 bg-blue-500 rounded-full"}),a.jsx("h3",{className:"text-xl font-bold",children:"Beginning of Word"})]}),a.jsx("p",{className:"text-sm text-gray-600 mb-4",children:"Dental pronunciation: tongue touches upper teeth"}),a.jsx("div",{className:"space-y-3",children:h.map(m=>f(m,"bg-blue-50"))})]}),a.jsxs(se,{className:"p-6 bg-white shadow-lg",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[a.jsx("div",{className:"w-3 h-3 bg-green-500 rounded-full"}),a.jsx("h3",{className:"text-xl font-bold",children:"Middle/End of Word"})]}),a.jsx("p",{className:"text-sm text-gray-600 mb-4",children:'Alveolar pronunciation: like English "now"'}),a.jsx("div",{className:"space-y-3",children:d.map(m=>f(m,"bg-green-50"))})]})]}),a.jsx("div",{className:"mt-8 max-w-3xl mx-auto",children:a.jsxs("details",{className:"bg-white rounded-lg shadow p-4",children:[a.jsx("summary",{className:"cursor-pointer font-semibold text-gray-700",children:"How to upload audio for these words"}),a.jsxs("div",{className:"mt-4 text-sm text-gray-600 space-y-2",children:[a.jsxs("p",{children:["Go to ",a.jsx("strong",{children:"Audio Admin"})," and use the Batch Upload feature with these file names:"]}),a.jsx("ul",{className:"list-disc list-inside space-y-1 ml-4",children:Uh.map(m=>a.jsxs("li",{children:[a.jsxs("code",{className:"bg-gray-100 px-1 rounded",children:[m.audioFile,".mp3"]}),a.jsxs("span",{className:"text-gray-500 ml-2",children:["→ ",m.malayalam," (",m.meaning,")"]})]},m.audioFile))}),a.jsxs("p",{className:"mt-3 text-xs text-gray-500",children:["Files will be automatically placed in the ",a.jsx("code",{className:"bg-gray-100 px-1 rounded",children:"words/"})," directory."]})]})]})})]})})}const XP=[{malayalam:"ക",romanization:"ka",articulationGroup:"Velar",articulationGroupMalayalam:"കണ്ഠ്യം",isolated:"ക്",withA:"ക"},{malayalam:"ഖ",romanization:"kha",articulationGroup:"Velar",articulationGroupMalayalam:"കണ്ഠ്യം",isolated:"ഖ്",withA:"ഖ"},{malayalam:"ഗ",romanization:"ga",articulationGroup:"Velar",articulationGroupMalayalam:"കണ്ഠ്യം",isolated:"ഗ്",withA:"ഗ"},{malayalam:"ഘ",romanization:"gha",articulationGroup:"Velar",articulationGroupMalayalam:"കണ്ഠ്യം",isolated:"ഘ്",withA:"ഘ"},{malayalam:"ങ",romanization:"nga",articulationGroup:"Velar",articulationGroupMalayalam:"കണ്ഠ്യം",isolated:"ങ്",withA:"ങ"},{malayalam:"ച",romanization:"cha",articulationGroup:"Palatal",articulationGroupMalayalam:"താലവ്യം",isolated:"ച്",withA:"ച"},{malayalam:"ഛ",romanization:"chha",articulationGroup:"Palatal",articulationGroupMalayalam:"താലവ്യം",isolated:"ഛ്",withA:"ഛ"},{malayalam:"ജ",romanization:"ja",articulationGroup:"Palatal",articulationGroupMalayalam:"താലവ്യം",isolated:"ജ്",withA:"ജ"},{malayalam:"ഝ",romanization:"jha",articulationGroup:"Palatal",articulationGroupMalayalam:"താലവ്യം",isolated:"ഝ്",withA:"ഝ"},{malayalam:"ഞ",romanization:"nya",articulationGroup:"Palatal",articulationGroupMalayalam:"താലവ്യം",isolated:"ഞ്",withA:"ഞ"},{malayalam:"ട",romanization:"ṭa",articulationGroup:"Retroflex",articulationGroupMalayalam:"മൂർദ്ധന്യം",isolated:"ട്",withA:"ട"},{malayalam:"ഠ",romanization:"ṭha",articulationGroup:"Retroflex",articulationGroupMalayalam:"മൂർദ്ധന്യം",isolated:"ഠ്",withA:"ഠ"},{malayalam:"ഡ",romanization:"ḍa",articulationGroup:"Retroflex",articulationGroupMalayalam:"മൂർദ്ധന്യം",isolated:"ഡ്",withA:"ഡ"},{malayalam:"ഢ",romanization:"ḍha",articulationGroup:"Retroflex",articulationGroupMalayalam:"മൂർദ്ധന്യം",isolated:"ഢ്",withA:"ഢ"},{malayalam:"ണ",romanization:"ṇa",articulationGroup:"Retroflex",articulationGroupMalayalam:"മൂർദ്ധന്യം",isolated:"ണ്",withA:"ണ"},{malayalam:"ത",romanization:"ta",articulationGroup:"Dental",articulationGroupMalayalam:"ദന്ത്യം",isolated:"ത്",withA:"ത"},{malayalam:"ഥ",romanization:"tha",articulationGroup:"Dental",articulationGroupMalayalam:"ദന്ത്യം",isolated:"ഥ്",withA:"ഥ"},{malayalam:"ദ",romanization:"da",articulationGroup:"Dental",articulationGroupMalayalam:"ദന്ത്യം",isolated:"ദ്",withA:"ദ"},{malayalam:"ധ",romanization:"dha",articulationGroup:"Dental",articulationGroupMalayalam:"ദന്ത്യം",isolated:"ധ്",withA:"ധ"},{malayalam:"ന",romanization:"na",articulationGroup:"Dental",articulationGroupMalayalam:"ദന്ത്യം",isolated:"ന്",withA:"ന"},{malayalam:"പ",romanization:"pa",articulationGroup:"Labial",articulationGroupMalayalam:"ഓഷ്ഠ്യം",isolated:"പ്",withA:"പ"},{malayalam:"ഫ",romanization:"pha",articulationGroup:"Labial",articulationGroupMalayalam:"ഓഷ്ഠ്യം",isolated:"ഫ്",withA:"ഫ"},{malayalam:"ബ",romanization:"ba",articulationGroup:"Labial",articulationGroupMalayalam:"ഓഷ്ഠ്യം",isolated:"ബ്",withA:"ബ"},{malayalam:"ഭ",romanization:"bha",articulationGroup:"Labial",articulationGroupMalayalam:"ഓഷ്ഠ്യം",isolated:"ഭ്",withA:"ഭ"},{malayalam:"മ",romanization:"ma",articulationGroup:"Labial",articulationGroupMalayalam:"ഓഷ്ഠ്യം",isolated:"മ്",withA:"മ"},{malayalam:"യ",romanization:"ya",articulationGroup:"Semi-vowel Palatal",articulationGroupMalayalam:"അർദ്ധസ്വരം താലവ്യം",isolated:"യ്",withA:"യ"},{malayalam:"വ",romanization:"va",articulationGroup:"Semi-vowel Labial",articulationGroupMalayalam:"അർദ്ധസ്വരം ഓഷ്ഠ്യം",isolated:"വ്",withA:"വ"},{malayalam:"ര",romanization:"ra",articulationGroup:"Trill Alveolar",articulationGroupMalayalam:"കമ്പനം വർത്സ്യം",isolated:"ര്",withA:"ര"},{malayalam:"ല",romanization:"la",articulationGroup:"Lateral Alveolar",articulationGroupMalayalam:"പാർശ്വികം വർത്സ്യം",isolated:"ല്",withA:"ല"},{malayalam:"ള",romanization:"ḷa",articulationGroup:"Lateral Retroflex",articulationGroupMalayalam:"പാർശ്വികം മൂർദ്ധന്യം",isolated:"ള്",withA:"ള"},{malayalam:"ഴ",romanization:"zha",articulationGroup:"Rolled Retroflex",articulationGroupMalayalam:"ഉരുട
785്ടൽ മൂർദ്ധന്യം",isolated:"ഴ്",withA:"ഴ"},{malayalam:"റ",romanization:"ṟa",articulationGroup:"Trill Dental",articulationGroupMalayalam:"കമ്പനം ദന്ത്യം",isolated:"റ്",withA:"റ"},{malayalam:"ശ",romanization:"sha",articulationGroup:"Fricative Palatal",articulationGroupMalayalam:"ഘർഷണം താലവ്യം",isolated:"ശ്",withA:"ശ"},{malayalam:"ഷ",romanization:"ṣha",articulationGroup:"Fricative Retroflex",articulationGroupMalayalam:"ഘർഷണം മൂർദ്ധന്യം",isolated:"ഷ്",withA:"ഷ"},{malayalam:"സ",romanization:"sa",articulationGroup:"Fricative Alveolar",articulationGroupMalayalam:"ഘർഷണം വർത്സ്യം",isolated:"സ്",withA:"സ"},{malayalam:"ഹ",romanization:"ha",articulationGroup:"Fricative Glottal",articulationGroupMalayalam:"ഘർഷണം കണ്ഠനാളം",isolated:"ഹ്",withA:"ഹ"}];function kle({consonant:e,options:t,onAnswer:r,disabled:n}){const[s,i]=y.useState(!1),o=()=>{if("speechSynthesis"in window){i(!0);const l=new SpeechSynthesisUtterance(e.withA);l.lang="ml-IN",l.rate=.7,l.onend=()=>i(!1),speechSynthesis.speak(l)}};return y.useEffect(()=>{o()},[e]),a.jsx(se,{className:"p-6",children:a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"text-center",children:[a.jsx("h3",{className:"text-xl font-semibold mb-4",children:"Listen and Select"}),a.jsxs(Y,{onClick:o,disabled:s,size:"lg",className:"bg-indigo-600 hover:bg-indigo-700",children:[a.jsx(Xe,{className:"mr-2 h-5 w-5"}),s?"Playing...":"Play Sound"]})]}),a.jsx("div",{className:"grid grid-cols-2 gap-3",children:t.map(l=>a.jsx(Y,{onClick:()=>r(l),disabled:n,variant:"outline",className:"h-20 text-4xl hover:bg-indigo-50 hover:border-indigo-500",children:l},l))})]})})}function Cle({consonant:e,options:t,onAnswer:r,disabled:n}){return a.jsx(se,{className:"p-6",children:a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"text-center",children:[a.jsx("h3",{className:"text-xl font-semibold mb-4",children:"Match Romanization"}),a.jsx("div",{className:"text-8xl font-bold text-indigo-600 mb-4",children:e.malayalam}),a.jsx("p",{className:"text-gray-600",children:"Select the correct romanization"})]}),a.jsx("div",{className:"grid grid-cols-2 gap-3",children:t.map(s=>a.jsx(Y,{onClick:()=>r(s),disabled:n,variant:"outline",className:"h-16 text-xl hover:bg-indigo-50 hover:border-indigo-500",children:s},s))})]})})}function Ele({consonant:e,options:t,onAnswer:r,disabled:n}){return a.jsx(se,{className:"p-6",children:a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"text-center",children:[a.jsx("h3",{className:"text-xl font-semibold mb-4",children:"Identify Articulation Group"}),a.jsx("div",{className:"text-8xl font-bold text-indigo-600 mb-4",children:e.malayalam}),a.jsx("p",{className:"text-gray-600",children:"Which articulation group does this belong to?"})]}),a.jsx("div",{className:"grid grid-cols-1 gap-3",children:t.map(s=>a.jsx(Y,{onClick:()=>r(s),disabled:n,variant:"outline",className:"h-16 text-lg hover:bg-indigo-50 hover:border-indigo-500",children:s},s))})]})})}function Tle({consonant:e,onAnswer:t,disabled:r}){const[n,s]=y.useState(0),[i,o]=y.useState(!1),l=()=>{s(u=>u+1)},c=()=>{o(!0);const u=n>=2&&n<=4;setTimeout(()=>{t(u),s(0),o(!1)},1500)};return a.jsx(se,{className:"p-6",children:a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"text-center",children:[a.jsx("h3",{className:"text-xl font-semibold mb-4",children:"Stroke Order Practice"}),a.jsxs("p",{className:"text-gray-600 mb-4",children:["Trace the letter: ",e.malayalam]}),a.jsx("div",{className:"text-8xl font-bold text-indigo-600 mb-4",children:e.malayalam})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"text-center text-lg",children:["Strokes: ",a.jsx("span",{className:"font-bold text-indigo-600",children:n})]}),i?a.jsx("div",{className:"text-center py-8",children:n>=2&&n<=4?a.jsxs("div",{className:"text-green-600 flex items-center justify-center gap-2",children:[a.jsx(mr,{className:"h-12 w-12"}),a.jsx("span",{className:"text-2xl font-bold",children:"Correct!"})]}):a.jsxs("div",{className:"text-red-600 flex items-center justify-center gap-2",children:[a.jsx(jt,{className:"h-12 w-12"}),a.jsx("span",{className:"text-2xl font-bold",children:"Try Again"})]})}):a.jsxs(a.Fragment,{children:[a.jsx(Y,{onClick:l,disabled:r,className:"w-full h-16 bg-indigo-600 hover:bg-indigo-700",children:"Add Stroke"}),a.jsx(Y,{onClick:c,disabled:r||n===0,variant:"outline",className:"w-full h-16",children:"Validate"})]})]})]})})}function Ale({quizState:e,results:t,onRestart:r}){const n=e.score/e.totalQuestions*100,s=t.reduce((l,c)=>(l[c.type]||(l[c.type]={correct:0,total:0}),l[c.type].total++,c.correct&&l[c.type].correct++,l),{}),o=(l=>l>=90?{grade:"A+",color:"text-green-600",message:"Excellent!"}:l>=80?{grade:"A",color:"text-green-500",message:"Great job!"}:l>=70?{grade:"B",color:"text-blue-600",message:"Good work!"}:l>=60?{grade:"C",color:"text-yellow-600",message:"Keep practicing!"}:{grade:"D",color:"text-red-600",message:"More practice needed"})(n);
785return a.jsxs("div",{className:"max-w-4xl mx-auto space-y-6",children:[a.jsxs(se,{className:"p-8",children:[a.jsxs("div",{className:"text-center space-y-4",children:[a.jsx(lr,{className:"h-20 w-20 mx-auto text-yellow-500"}),a.jsx("h2",{className:"text-3xl font-bold",children:"Quiz Complete!"}),a.jsx("div",{className:`text-6xl font-bold ${o.color}`,children:o.grade}),a.jsx("p",{className:"text-xl text-gray-600",children:o.message})]}),a.jsxs("div",{className:"mt-8 space-y-4",children:[a.jsxs("div",{className:"flex justify-between items-center",children:[a.jsx("span",{className:"text-lg font-semibold",children:"Score:"}),a.jsxs("span",{className:"text-2xl font-bold text-indigo-600",children:[e.score," / ",e.totalQuestions]})]}),a.jsx(_t,{value:n,className:"h-4"}),a.jsxs("div",{className:"text-center text-gray-600",children:[n.toFixed(0),"% Correct"]})]})]}),a.jsxs(se,{className:"p-6",children:[a.jsxs("h3",{className:"text-xl font-semibold mb-4 flex items-center gap-2",children:[a.jsx(os,{className:"h-5 w-5"}),"Performance by Quiz Type"]}),a.jsx("div",{className:"space-y-3",children:Object.entries(s).map(([l,c])=>a.jsxs("div",{className:"flex justify-between items-center",children:[a.jsxs("span",{className:"capitalize font-medium",children:[l,":"]}),a.jsxs("span",{className:"text-indigo-600 font-semibold",children:[c.correct," / ",c.total," (",(c.correct/c.total*100).toFixed(0),"%)"]})]},l))})]}),a.jsxs(se,{className:"p-6",children:[a.jsxs("h3",{className:"text-xl font-semibold mb-4 flex items-center gap-2",children:[a.jsx(ja,{className:"h-5 w-5"}),"Areas for Improvement"]}),a.jsxs("ul",{className:"space-y-2 text-gray-700",children:[n<70&&a.jsx("li",{children:"• Practice more with audio recognition"}),s.articulation&&s.articulation.correct/s.articulation.total<.7&&a.jsx("li",{children:"• Review articulation groups (Velar, Palatal, etc.)"}),s.romanization&&s.romanization.correct/s.romanization.total<.7&&a.jsx("li",{children:"• Study romanization patterns more carefully"}),n>=90&&a.jsx("li",{children:"• Excellent work! Try a harder difficulty level"})]})]}),a.jsxs(Y,{onClick:r,className:"w-full h-14 text-lg bg-indigo-600 hover:bg-indigo-700",children:[a.jsx(Gn,{className:"mr-2 h-5 w-5"}),"Take Another Quiz"]})]})}function yF({quizCategory:e,onStartQuiz:t,onBack:r}){const[n,s]=y.useState("beginner"),[i,o]=y.useState("mixed"),[l,c]=y.useState(10);y.useEffect(()=>{const m=localStorage.getItem(`${e}QuizConfig`);if(m){const g=JSON.parse(m);s(g.difficulty),o(g.quizType),c(g.numberOfQuestions)}},[e]);const u=()=>{const m={difficulty:n,quizType:i,numberOfQuestions:l};localStorage.setItem(`${e}QuizConfig`,JSON.stringify(m)),t(m)},f=e==="consonant"?[{value:"mixed",label:"Mixed",icon:An,desc:"All question types"},{value:"audio",label:"Audio",icon:pd,desc:"Listen & identify"},{value:"romanization",label:"Romanization",icon:pA,desc:"Match to English"},{value:"articulation",label:"Articulation",icon:Xe,desc:"Group by sound"},{value:"strokeOrder",label:"Stroke Order",icon:IK,desc:"Writing practice"}]:[{value:"mixed",label:"Mixed",icon:An,desc:"All question types"},{value:"audio",label:"Audio",icon:pd,desc:"Listen & identify"},{value:"matraMatching",label:"Matra Match",icon:GK,desc:"Match vowel signs"},{value:"vowelLength",label:"Vowel Length",icon:FK,desc:"Short vs long"},{value:"romanization",label:"Romanization",icon:pA,desc:"Match to English"}];return a.jsxs("div",{className:"max-w-4xl mx-auto p-6 space-y-8",children:[a.jsxs("div",{className:"text-center",children:[a.jsxs("h2",{className:"text-3xl font-bold mb-2",children:["Configure Your ",e==="consonant"?"Consonant":"Vowel"," Quiz"]}),a.jsx("p",{className:"text-muted-foreground",children:"Customize your learning experience"})]}),a.jsxs(se,{children:[a.jsxs(_e,{children:[a.jsx(Se,{children:"Difficulty Level"}),a.jsx(hr,{children:"Choose your challenge level"})]}),a.jsx(ue,{children:a.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:["beginner","intermediate","advanced"].map(m=>a.jsx(se,{className:`cursor-pointer transition-all hover:shadow-lg ${n===m?"ring-2 ring-primary":""}`,onClick:()=>s(m),children:a.jsxs(ue,{className:"p-6 text-center",children:[a.jsx(wa,{className:`w-12 h-12 mx-auto mb-3 ${n===m?"text-primary":"text-muted-foreground"}`}),a.jsx("h3",{className:"font-semibold capitalize mb-2",children:m}),a.jsxs("p",{className:"text-sm text-muted-foreground",children:[m==="beginner"&&"Perfect for starting out",m==="intermediate"&&"Build your skills",m==="advanced"&&"Master the script"]})]})},m))})})]}),a.jsxs(se,{children:[a.jsxs(_e,{children:[a.jsx(Se,{children:"Qu
785iz Type"}),a.jsx(hr,{children:"Select the type of questions"})]}),a.jsx(ue,{children:a.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 lg:grid-cols-5 gap-4",children:f.map(m=>{const g=m.icon;return a.jsx(se,{className:`cursor-pointer transition-all hover:shadow-lg ${i===m.value?"ring-2 ring-primary":""}`,onClick:()=>o(m.value),children:a.jsxs(ue,{className:"p-4 text-center",children:[a.jsx(g,{className:`w-10 h-10 mx-auto mb-2 ${i===m.value?"text-primary":"text-muted-foreground"}`}),a.jsx("h3",{className:"font-semibold text-sm mb-1",children:m.label}),a.jsx("p",{className:"text-xs text-muted-foreground",children:m.desc})]})},m.value)})})})]}),a.jsxs(se,{children:[a.jsxs(_e,{children:[a.jsx(Se,{children:"Number of Questions"}),a.jsx(hr,{children:"How many questions do you want?"})]}),a.jsx(ue,{children:a.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[5,10,15,20].map(m=>a.jsx(se,{className:`cursor-pointer transition-all hover:shadow-lg ${l===m?"ring-2 ring-primary":""}`,onClick:()=>c(m),children:a.jsxs(ue,{className:"p-6 text-center",children:[a.jsx("div",{className:`text-3xl font-bold mb-2 ${l===m?"text-primary":"text-muted-foreground"}`,children:m}),a.jsxs(ke,{variant:l===m?"default":"secondary",children:[m===5&&"Quick",m===10&&"Standard",m===15&&"Extended",m===20&&"Marathon"]})]})},m))})})]}),a.jsxs("div",{className:"flex gap-4 justify-center",children:[a.jsx(Y,{variant:"outline",size:"lg",onClick:r,children:"Back"}),a.jsx(Y,{size:"lg",onClick:u,className:"px-8",children:"Start Quiz"})]})]})}const vF=(e,t,r)=>{let n=t+(.1-(5-r)*(.08+(5-r)*.02));n=Math.max(1.3,Math.min(2.5,n));let s;return r<3||e===0?s=1:e===1?s=3:s=Math.round(e*n),{interval:s,easeFactor:n}},Ple=(e,t)=>e?t>=90?5:t>=70?4:3:t>50?2:1,Ole=(e,t)=>{const r=new Date().toISOString().split("T")[0],n=e.filter(i=>i.nextReviewDate<=r),s=t.filter(i=>i.nextReviewDate<=r);return{consonants:n.sort((i,o)=>i.nextReviewDate.localeCompare(o.nextReviewDate)||i.masteryLevel-o.masteryLevel),vowels:s.sort((i,o)=>i.nextReviewDate.localeCompare(o.nextReviewDate)||i.masteryLevel-o.masteryLevel),total:n.length+s.length}},QP=async(e,t)=>{const r={id:`quiz-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,quizSession:e,userId:t,synced:!1,timestamp:Date.now()};await xn.saveQuizResult(r)};async function Mle(e){const{data:t,error:r}=await ne.from("email_templates").select("*").eq("template_type",e).eq("is_active",!0).order("version",{ascending:!1}).limit(1).single();return r||!t?null:t}function Rf(e,t){let r=e;return Object.entries(t).forEach(([n,s])=>{const i=new RegExp(`{{${n}}}`,"g");r=r.replace(i,String(s))}),r}async function Rle(e,t){const r=await Mle(e);return r?{subject:Rf(r.subject,t),html:Rf(r.html_content,t),text:Rf(r.text_content||"",t)}:null}async function $le(){const{data:e,error:t}=await ne.from("email_templates").select("*").order("created_at",{ascending:!1});return t||!e?[]:e}async function Ile(e){const{error:t}=await ne.from("email_templates").insert([e]);return!t}async function Dle(e,t){const{error:r}=await ne.from("email_templates").update({...t,updated_at:new Date().toISOString()}).eq("id",e);return!r}async function Lle(e,t){await ne.from("email_templates").update({is_active:!1}).eq("template_type",t);const{error:r}=await ne.from("email_templates").update({is_active:!0}).eq("id",e);return!r}async function Fle(e){const{data:t,error:r}=await ne.from("email_template_tests").select("*").eq("template_type",e).eq("status","active").single();return r?null:t}async function Gv(e,t){const{data:r,error:n}=await ne.from("email_template_test_results").select("*").eq("test_id",e).eq("variant",t);if(n||!r)return{variant:t,sent:0,opened:0,clicked:0,openRate:0,clickRate:0,ctr:0};const s=r.length,i=r.filter(l=>l.opened_at).length,o=r.filter(l=>l.clicked_at).length;return{variant:t,sent:s,opened:i,clicked:o,openRate:s>0?i/s*100:0,clickRate:s>0?o/s*100:0,ctr:i>0?o/i*100:0}}async function zle(e){const t=await Gv(e,"a"),r=await Gv(e,"b");return t.sent<50||r.sent<50||Math.abs(t.openRate-r.openRate)<10?"none":t.openRate>r.openRate?"a":"b"}async function Ble(e){const t=await zle(e);if(t==="none")return{success:!1,message:"No clear winner yet"};const{data:r}=await ne.from("email_template_tests").select("*").eq("id",e).single();if(!r)return{success:!1,message:"Test not found"};const n=t==="a"?r.variant_a_id:r.variant_b_id;return await ne.from("email_templates").update({is_active:!0}).eq("id",n),await ne.from("email_template_tests").update({status:"completed",winner_variant:t}).eq("id",e),{success:!0,winner:t}}function Ule(e,t,r,n,s){return`
786    <!DOCTYPE html>
787    <html>
788    <head>
789      <style>
790        body { font-family: Arial, sans-serif; line-height: 1.6; color: #333; max-width: 600px; margin: 0 auto; padding: 20px; }
791        .header { background: #10b981; color: white; padding: 20px; text-align: center; border-radius: 8px 8px 0 0; }
792        .content { background: #f9fafb; padding: 20px; border-radius: 0 0 8px 8px; }
793        .button { display: inline-block; background: #10b981; color: white; padding: 12px 24px; text-decoration: none; border-radius: 6px; margin: 10px 0; }
794        .highlight { background: white; padding: 15px; margin: 15px 0; border-radius: 6px; border-left: 4px solid #10b981; }
795      </style>
796    </head>
797    <body>
798      <div class="header">
799        <h1>🎉 Challenge Completed!</h1>
800      </div>
801      <div class="content">
802        <p>Hi ${e},</p>
803        <p>Great news! <strong>${n}</strong> has completed a challenge for <strong>${t}</strong>!</p>
804        <div class="highlight">
805          <h2>${r}</h2>
806          <p>Your team is making excellent progress. Keep up the momentum!</p>
807        </div>
808        <p><a href="${window.location.origin}/teams?team=${s}" class="button">View Team Progress</a></p>
809        <p>Keep learning together!</p>
810      </div>
811    </body>
812    </html>
813  `}function Wle(e,t,r,n,s,i,o){const l=new Date(s).toLocaleDateString();return`
814    <!DOCTYPE html>
815    <html>
816    <head>
817      <style>
818        body { font-family: Arial, sans-serif; line-height: 1.6; color: #333; max-width: 600px; margin: 0 auto; padding: 20px; }
819        .header { background: #f59e0b; color: white; padding: 20px; text-align: center; border-radius: 8px 8px 0 0; }
820        .content { background: #f9fafb; padding: 20px; border-radius: 0 0 8px 8px; }
821        .button { display: inline-block; background: #f59e0b; color: white; padding: 12px 24px; text-decoration: none; border-radius: 6px; margin: 10px 0; }
822        .challenge-box { background: white; padding: 15px; margin: 15px 0; border-radius: 6px; border: 2px solid #f59e0b; }
823      </style>
824    </head>
825    <body>
826      <div class="header">
827        <h1>🏆 New Challenge Created!</h1>
828      </div>
829      <div class="content">
830        <p>Hi ${e},</p>
831        <p><strong>${i}</strong> created a new challenge for <strong>${t}</strong>!</p>
832        <div class="challenge-box">
833          <h2>${r}</h2>
834          <p>${n}</p>
835          <p><strong>Due Date:</strong> ${l}</p>
836        </div>
837        <p><a href="${window.location.origin}/teams?team=${o}" class="button">Accept Challenge</a></p>
838      </div>
839    </body>
840    </html>
841  `}async function Vle(e,t,r,n){await Fle(e);const s=await Rle(e,t);if(s)return s;const i=String(t.username||t.userName||"User"),o=String(t.teamName||t.team_name||"Your Team");
841switch(e){case"challenge_completed":return{subject:`Challenge Completed in ${o}!`,html:Ule(i,o,String(t.challengeName||t.challenge_name||"Challenge"),String(t.completedBy||t.completed_by||"A team member"),String(t.teamId||t.team_id||"")),text:`Hi ${i}, ${t.completedBy} completed ${t.challengeName} in ${o}!`};case"challenge_created":return{subject:`New Challenge: ${t.challengeName||t.challenge_name}`,html:Wle(i,o,String(t.challengeName||t.challenge_name||"New Challenge"),String(t.description||t.challenge_description||""),String(t.dueDate||t.due_date||new Date().toISOString()),String(t.createdBy||t.created_by||"A team member"),String(t.teamId||t.team_id||"")),text:`Hi ${i}, A new challenge has been created in ${o}!`};default:return null}}async function Hle(e,t,r){var n,s,i,o,l,c,u,h,d,f,m,g,p,v,x,b,w,j,_,S;try{const k=r||"Team Member",P={username:k,userName:k,teamName:((n=t.data)==null?void 0:n.teamName)||"Your Team",team_name:((s=t.data)==null?void 0:s.teamName)||"Your Team",challengeName:((i=t.data)==null?void 0:i.challengeName)||"Challenge",challenge_name:((o=t.data)==null?void 0:o.challengeName)||"Challenge",completedBy:((l=t.data)==null?void 0:l.completedBy)||"A team member",completed_by:((c=t.data)==null?void 0:c.completedBy)||"A team member",description:((u=t.data)==null?void 0:u.description)||t.message,challenge_description:((h=t.data)==null?void 0:h.description)||t.message,dueDate:((d=t.data)==null?void 0:d.dueDate)||new Date().toISOString(),due_date:((f=t.data)==null?void 0:f.dueDate)||new Date().toISOString(),createdBy:((m=t.data)==null?void 0:m.createdBy)||"A team member",created_by:((g=t.data)==null?void 0:g.createdBy)||"A team member",teamId:((p=t.data)==null?void 0:p.teamId)||"",team_id:((v=t.data)==null?void 0:v.teamId)||"",hoursRemaining:((x=t.data)==null?void 0:x.hoursRemaining)||24,hours_remaining:((b=t.data)==null?void 0:b.hoursRemaining)||24,contributorName:((w=t.data)==null?void 0:w.contributorName)||"A team member",contributor_name:((j=t.data)==null?void 0:j.contributorName)||"A team member",contributionType:((_=t.data)==null?void 0:_.contributionType)||"made a contribution",contribution_type:((S=t.data)==null?void 0:S.contributionType)||"made a contribution",app_url:window.location.origin};let C=await Vle(t.type,P);C||(C={subject:t.title,html:`<h2>${t.title}</h2><p>${t.message}</p>`,text:`${t.title}
842
843${t.message}`});const{data:M,error:I}=await ne.functions.invoke("send-email",{body:{to:e,subject:C.subject,html:C.html,text:C.text,tags:{user_id:t.user_id,notification_type:t.type}}});if(I)throw console.error("Edge function error:",I),I;return console.log("✅ Email sent successfully:",M),M}catch(k){return console.error("Failed to send email notification:",k),null}}async function tC(e,t,r){const{data:n}=await ne.from("profiles").select("full_name").eq("id",e).single(),{data:s}=await ne.from("notification_preferences").select("email_enabled, email_frequency").eq("user_id",e).single();if(!(s!=null&&s.email_enabled)||s.email_frequency==="off")return;const{data:i}=await ne.from("email_unsubscribes").select("id").eq("user_id",e).single();i||s.email_frequency==="immediate"&&await Hle(t,r,n==null?void 0:n.full_name)}async function qle(e,t,r){const{data:n}=await ne.from("team_members").select("user_id").eq("team_id",t);if(n)for(const s of n){const i=await rb(s.user_id);if(!i||i.challenge_completed){const o=await U2(s.user_id,"challenge_completed","🎉 Challenge Completed!",`Your team completed the challenge: ${r}`,{challenge_id:e,team_id:t,challengeName:r}),{data:l}
843=await ne.from("profiles").select("email").eq("id",s.user_id).single();l!=null&&l.email&&await tC(s.user_id,l.email,o)}}}async function Gle(e,t,r,n){const{data:s}=await ne.from("team_members").select("user_id").eq("team_id",e);if(s)for(const i of s){const o=await rb(i.user_id);if(!o||o.new_challenge){const l=await U2(i.user_id,"challenge_created","🎯 New Challenge Available!",`New challenge: ${t}`,{challenge_id:r,team_id:e,challengeName:t,description:n}),{data:c}=await ne.from("profiles").select("email").eq("id",i.user_id).single();c!=null&&c.email&&await tC(i.user_id,c.email,l)}}}async function Kle(e,t,r,n){const{data:s}=await ne.from("team_members").select("user_id").eq("team_id",e);if(s)for(const i of s){const o=await rb(i.user_id);if(!o||o.member_contribution){const l=await U2(i.user_id,"significant_contribution","🌟 Team Member Achievement!",`${t} contributed ${r} XP today!`,{team_id:e,xp_amount:r,userName:t,challengeName:n}),{data:c}=await ne.from("profiles").select("email").eq("id",i.user_id).single();c!=null&&c.email&&await tC(i.user_id,c.email,l)}}}const xF="malayalam-progress",Yle=[{id:"first_quiz",title:"First Steps",description:"Complete your first quiz",icon:"🎯",target:1},{id:"quiz_10",title:"Dedicated Learner",description:"Complete 10 quizzes",icon:"📚",target:10},{id:"quiz_50",title:"Quiz Master",description:"Complete 50 quizzes",icon:"🏆",target:50},{id:"perfect_score",title:"Perfect Score",description:"Get 100% on any quiz",icon:"💯",target:1},{id:"streak_7",title:"Week Warrior",description:"Practice 7 days in a row",icon:"🔥",target:7},{id:"streak_30",title:"Monthly Master",description:"Practice 30 days in a row",icon:"⭐",target:30},{id:"consonant_master",title:"Consonant Champion",description:"Master all consonants",icon:"🅰️",target:1},{id:"vowel_master",title:"Vowel Virtuoso",description:"Master all vowels",icon:"🔤",target:1}],vi=()=>{const e=localStorage.getItem(xF);return e?JSON.parse(e):{totalQuizzes:0,totalQuestions:0,totalCorrect:0,averageScore:0,currentStreak:0,longestStreak:0,lastPracticeDate:"",consonantMastery:[],vowelMastery:[],quizHistory:[],achievements:Yle.map(t=>({...t})),practiceCalendar:{}}},Xle=e=>{localStorage.setItem(xF,JSON.stringify(e))},bF=async(e,t)=>{var s;const r=vi();r.quizHistory.push(e),r.totalQuizzes++,r.totalQuestions+=e.totalQuestions,r.totalCorrect+=e.score,r.averageScore=r.totalCorrect/r.totalQuestions*100;const n=new Date().toISOString().split("T")[0];if(r.practiceCalendar[n]=(r.practiceCalendar[n]||0)+1,r.currentStreak=Jle(r.practiceCalendar),r.longestStreak=Math.max(r.longestStreak,r.currentStreak),r.lastPracticeDate=n,Qle(r,e),Zle(r),Xle(r),t){const{awardXP:i,XP_REWARDS:o}=await yi(async()=>{const{awardXP:c,XP_REWARDS:u}=await Promise.resolve().then(()=>_ce);return{awardXP:c,XP_REWARDS:u}},void 0),l=e.score===e.totalQuestions?o.PERFECT_QUIZ:o.QUIZ_COMPLETE;try{const c=await i(t,l);c.leveledUp&&localStorage.setItem("pending_level_up",JSON.stringify({level:c.newLevel}));const{contributeXP:u}=await yi(async()=>{const{contributeXP:g}=await Promise.resolve().then(()=>vDe);return{contributeXP:g}},void 0),{supabase:h}=await yi(async()=>{const{supabase:g}=await Promise.resolve().then(()=>Sre);return{supabase:g}},void 0),{data:d}=await h.from("team_members").select("team_id").eq("user_id",t);if(d){for(const g of d)await u(g.team_id,l);if(l>=100){const g=((s=(await h.from("profiles").select("full_name").eq("id",t).single()).data)==null?void 0:s.full_name)||"A team member";for(const p of d)await Kle(p.team_id,g,l)}}const{contributeToChallenges:f}=await yi(async()=>{const{contributeToChallenges:g}=await Promise.resolve().then(()=>NDe);return{contributeToChallenges:g}},void 0),m=(d==null?void 0:d.map(g=>g.team_id))||[];m.length>0&&(await f(t,m,"quiz_completion",1),await f(t,m,"xp_target",l),e.score===e.totalQuestions&&await f(t,m,"accuracy_goal",100))}catch(c){console.error("Failed to award XP:",c)}}if(navigator.onLine&&t)try{await n6(e,t)}catch{await QP(e,t)}else t&&await QP(e,t)},Qle=(e,t)=>{const r=t.category==="consonant"?e.consonantMastery:e.vowelMastery,n=new Date().toISOString().split("T")[0];
843t.results.forEach(s=>{const i=s.correctAnswer;let o=r.find(d=>d.letter===i);o||(o={letter:i,attempts:0,correct:0,lastPracticed:"",masteryLevel:0,nextReviewDate:n,reviewInterval:0,easeFactor:2.5,reviewCount:0,retentionRate:0},r.push(o)),o.attempts++,s.correct&&o.correct++,o.lastPracticed=new Date().toISOString(),o.masteryLevel=Math.round(o.correct/o.attempts*100),o.retentionRate=o.masteryLevel;const l=Ple(s.correct,o.masteryLevel),{interval:c,easeFactor:u}=vF(o.reviewInterval,o.easeFactor,l);o.reviewInterval=c,o.easeFactor=u,o.reviewCount++;const h=new Date;h.setDate(h.getDate()+c),o.nextReviewDate=h.toISOString().split("T")[0]})},Jle=e=>{let t=0;const r=new Date;for(let n=0;n<365;n++){const s=new Date(r);s.setDate(s.getDate()-n);const i=s.toISOString().split("T")[0];if(e[i])t++;else break}return t},Zle=e=>{e.achievements.forEach(t=>{if(t.unlockedDate)return;let r=!1;switch(t.id){case"first_quiz":r=e.totalQuizzes>=1;break;case"quiz_10":t.progress=e.totalQuizzes,r=e.totalQuizzes>=10;break;case"quiz_50":t.progress=e.totalQuizzes,r=e.totalQuizzes>=50;break;case"perfect_score":r=e.quizHistory.some(i=>i.score===i.totalQuestions);break;case"streak_7":t.progress=e.currentStreak,r=e.currentStreak>=7;break;case"streak_30":t.progress=e.currentStreak,r=e.currentStreak>=30;break;case"consonant_master":const n=e.consonantMastery.filter(i=>i.masteryLevel>=80).length;t.progress=n,r=n>=36;break;case"vowel_master":const s=e.vowelMastery.filter(i=>i.masteryLevel>=80).length;t.progress=s,r=s>=15;break}r&&(t.unlockedDate=new Date().toISOString())})};function ece(){const{user:e}=Jt(),[t,r]=y.useState({currentQuestionIndex:0,results:[],score:0,totalQuestions:10,difficulty:"beginner",quizType:"mixed",isComplete:!1}),[n,s]=y.useState([]),[i,o]=y.useState(!1),[l,c]=y.useState(!1),[u,h]=y.useState(!0),d=(p,v,x)=>[...XP].sort(()=>Math.random()-.5).slice(0,x).map(w=>{const j=v==="mixed"?["audio","romanization","articulation","strokeOrder"][Math.floor(Math.random()*4)]:v;let _=[];return j==="audio"||j==="romanization"?_=[...XP.filter(k=>k.malayalam!==w.malayalam).sort(()=>Math.random()-.5).slice(0,3).map(k=>j==="audio"?k.malayalam:k.romanization),j==="audio"?w.malayalam:w.romanization].sort(()=>Math.random()-.5):j==="articulation"&&(_=["Velar","Palatal","Retroflex","Dental","Labial"]),{consonant:w,type:j,options:_}}),f=p=>{r(v=>({...v,difficulty:p.difficulty,quizType:p.quizType,totalQuestions:p.numberOfQuestions})),s(d(p.difficulty,p.quizType,p.numberOfQuestions)),h(!1)},m=p=>{const v=n[t.currentQuestionIndex];let x=!1;typeof p=="boolean"?x=p:v.type==="audio"?x=p===v.consonant.malayalam:v.type==="romanization"?x=p===v.consonant.romanization:v.type==="articulation"&&(x=p===v.consonant.articulationGroup),c(x),o(!0),setTimeout(()=>{const b=[...t.results,{questionId:`${v.consonant.malayalam}-${t.currentQuestionIndex}`,correct:x,userAnswer:typeof p=="boolean"?p?"correct":"incorrect":p,correctAnswer:v.type==="audio"?v.consonant.malayalam:v.type==="romanization"?v.consonant.romanization:v.consonant.articulationGroup,type:v.type}],w=x?t.score+1:t.score,j=t.currentQuestionIndex+1>=t.totalQuestions;if(r(_=>({..._,results:b,score:w,currentQuestionIndex:_.currentQuestionIndex+1,isComplete:j})),j){const _={id:`consonant-${Date.now()}`,date:new Date().toISOString(),category:"consonant",difficulty:t.difficulty,quizType:t.quizType,score:w,totalQuestions:t.totalQuestions,results:b};bF(_,e==null?void 0:e.id)}o(!1)},1500)},g=n[t.currentQuestionIndex];return u?a.jsx(yF,{quizCategory:"consonant",onStartQuiz:f,onBack:()=>{}}):t.isComplete?a.jsx(Ale,{quizState:t,results:t.results,onRestart:()=>{h(!0),r({currentQuestionIndex:0,results:[],score:0,totalQuestions:10,difficulty:"beginner",quizType:"mixed",isComplete:!1})}}):g?a.jsxs("div",{className:"max-w-2xl mx-auto space-y-6",children:[a.jsx(se,{className:"p-4",children:a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex justify-between text-sm text-gray-600",children:[a.jsxs("span",{children:["Question ",t.currentQuestionIndex+1," of ",t.totalQuestions]}),a.jsxs("span",{children:["Score: ",t.score]})]}),a.jsx(_t,{value:(t.currentQuestionIndex+1)/t.totalQuestions*100,className:"h-2"})]})}),i&&a.jsx(se,{className:`p-6 ${l?"bg-green-50 border-green-500":"bg-red-50 border-red-500"}`,children:a.jsx("div",{className:"flex items-center justify-center gap-3",children:l?a.jsxs(a.Fragment,{children:[a.jsx(mr,{className:"h-8 w-8 text-green-600"}),a.jsx("span",{className:"text-2xl font-bold text-green-600",children:"Correct!"})]}):a.jsxs(a.Fragment,{children:[a.jsx(jt,{className:"h-8 w-8 text-red-600"}),a.jsx("span",{className:"text-2xl font-bold text-red-600",children:"Incorrect"})]})})}),!i&&a.jsxs(a.Fragment,{children:[g.type==="audio"&&a.jsx(kle,{consonant:g.consonant,options:g.options,onAnswer:m,disabled:i}),g.type==="romanization"&&a.jsx(Cle,{consonant:g.consonant,options:g.options,onAnswer:m,disabled:i}),g.type==="articulation"&&a.jsx(Ele,{consonant:g.consonant,options:g.options,onAnswer:m,disabled:i}),g.type==="strokeOrder"&&a.jsx(Tle,{consonant:g.consonant,onAnswer:m,disabled:i})]})]}):null}const g1=[{malayalam:"അ",romanization:"a",matra:"",length:"short",type:"Simple",example:"ക"},{malayalam:"ആ",romanization:"ā",matra:"ാ",length:"long",type:"Simple",example:"കാ"},{malayalam:"ഇ",romanization:"i",matra:"ി",length:"short",type:"Simple",example:"കി"},{malayalam:"ഈ",romanization:"ī",matra:"ീ",length:"long",type:"Simple",example:"കീ"},{malayalam:"ഉ",romanization:"u",matra:"ു",length:"short",type:"Simple",example:"കു"},{malayalam:"ഊ",romanization:"ū",matra:"ൂ",length:"long",type:"Simple",example:"കൂ"},{malayalam:"ഋ",romanization:"r̥",matra:"ൃ",length:"special",type:"Vocalic",example:"കൃ"},{malayalam:"എ",romanization:"e",matra:"െ",length:"short",type:"Simple",example:"കെ"},{malayalam:"ഏ",romanization:"ē",matra:"േ",length:"long",type:"Simple",example:"കേ"},{malayalam:"ഐ",romanization:"ai",matra:"ൈ",length:"long",type:"Diphthong",example:"കൈ"},{malayalam:"ഒ",romanization:"o",matra:"ൊ",length:"short",type:"Simple",example:"കൊ"},{malayalam:"ഓ",romanization:"ō",matra:"ോ",length:"long",type:"Simple",example:"കോ"},{malayalam:"ഔ",romanization:"au",matra:"ൗ",length:"long",type:"Diphthong",example:"കൗ"},{malayalam:"അം",romanization:"aṃ",matra:"ം",length:"special",type:"Anusvara",example:"കം"},{malayalam:"അഃ",romanization:"aḥ",matra:"ഃ",length:"special",type:"Visarga",example:"കഃ"}];function tce({vowel:e,options:t,onAnswer:r,selectedAnswer:n,showResult:s}){return a.jsxs("div",{className:"space-y-6",children:[a.jsx(se,{className:"p-8 text-center bg-gradient-to-br from-purple-50 to-pink-50",children:a.jsxs(Y,{size:"lg",onClick:()=>Fr(e.malayalam),className:"bg-purple-600 hover:bg-purple-700",children:[a.jsx(Xe,{className:"mr-2 h-5 w-5"}),"Play Vowel Sound"]})}),a.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-4",children:t.map(i=>a.jsx(Y,{onClick:()=>!s&&r(i),disabled:s,variant:n===i&&s&&i===e.malayalam?"default":"outline",className:`h-24 text-4xl ${s&&i===e.malayalam?"bg-green-500 hover:bg-green-600 text-white":s&&n===i?"bg-red-500 text-white":""}`,children:i},i))})]})}function rce({vowel:e,options:t,onAnswer:r,selectedAnswer:n,showResult:s}){return a.jsxs("div",{className:"space-y-6",children:[a.jsxs(se,{className:"p-8 text-center bg-gradient-to-br from-blue-50 to-cyan-50",children:[a.jsx("p",{className:"text-lg text-gray-700 mb-4",children:"Match the matra (vowel sign) to this independent vowel:"}),a.jsx("div",{className:"text-8xl font-bold text-blue-600 mb-2",children:e.malayalam}),a.jsxs("p",{className:"text-xl text-gray-600",children:["(",e.romanization,")"]})]}),a.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-4",children:t.map(i=>a.jsx(Y,{onClick:()=>!s&&r(i),disabled:s,variant:n===i&&s&&i===e.matra?"default":"outline",className:`h-32 text-5xl ${s&&i===e.matra?"bg-green-500 hover:bg-green-600 text-white":s&&n===i?"bg-red-500 text-white":""}`,children:i||"(none)"},i))})]})}function nce({vowel:e,onAnswer:t,selectedAnswer:r,showResult:n}){const s=["short","long","special"],i={short:"Short Vowel",long:"Long Vowel",special:"Special (Anusvara/Visarga/Vocalic)"};return a.jsxs("div",{className:"space-y-6",children:[a.jsxs(se,{className:"p-8 text-center bg-gradient-to-br from-green-50 to-emerald-50",children:[a.jsx("p",{className:"text-lg text-gray-700 mb-4",children:"Identify the length of this vowel:"}),a.jsx("div",{className:"text-8xl font-bold text-green-600 mb-2",children:e.malayalam}),a.jsxs("p",{className:"text-xl text-gray-600",children:["(",e.romanization,")"]})]}),a.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:s.map(o=>a.jsx(Y,{onClick:()=>!n&&t(o),disabled:n,variant:r===o?"default":"outline",className:`h-20 text-lg ${n&&o===e.length?"bg-green-500 hover:bg-green-600 text-white":n&&r===o?"bg-red-500 text-white":""}`,children:i[o]},o))})]})}function ace({vowel:e,options:t,onAnswer:r,selectedAnswer:n,showResult:s}){return a.jsxs("div",{className:"space-y-6",children:[a.jsxs(se,{className:"p-8 text-center bg-gradient-to-br from-orange-50 to-amber-50",children:[a.jsx("p",{className:"text-lg text-gray-700 mb-4",children:"What is the romanization of this vowel?"}),a.jsx("div",{className:"text-8xl font-bold text-orange-600 mb-2",children:e.malayalam})]}),a.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-4",children:t.map(i=>a.jsx(Y,{onClick:()=>!s&&r(i),disabled:s,variant:n===i?"default":"outline",className:`h-20 text-2xl ${s&&i===e.romanization?"bg-green-500 hover:bg-green-600 text-white":s&&n===i?"bg-red-500 text-white":""}`,children:i},i))})]})}function sce({results:e,score:t,totalQuestions:r,onRestart:n}){const s=Math.round(t/r*100),i=s>=90?"A+":s>=80?"A":s>=70?"B":s>=60?"C":"D",o=e.reduce((c,u)=>(c[u.type]||(c[u.type]={correct:0,total:0}),c[u.type].total++,u.correct&&c[u.type].correct++,c),{}),l=c=>({audio:"Audio Recognition",matraMatching:"Matra Matching",vowelLength:"Vowel Length",romanization:"Romanization"})[c];return a.jsxs("div",{className:"space-y-6",children:[a.jsxs(se,{className:"p-8 text-center bg-gradient-to-br from-purple-50 to-pink-50",children:[a.jsx(lr,{className:"w-16 h-16 mx-auto mb-4 text-yellow-500"}
843),a.jsx("h2",{className:"text-3xl font-bold mb-2",children:"Quiz Complete!"}),a.jsxs("div",{className:"text-6xl font-bold text-purple-600 my-4",children:[s,"%"]}),a.jsx(ke,{className:"text-2xl px-6 py-2",children:i}),a.jsxs("p",{className:"text-xl mt-4 text-gray-700",children:[t," out of ",r," correct"]})]}),a.jsxs(se,{className:"p-6",children:[a.jsxs("h3",{className:"text-xl font-bold mb-4 flex items-center gap-2",children:[a.jsx(os,{className:"w-5 h-5"}),"Performance by Quiz Type"]}),a.jsx("div",{className:"space-y-3",children:Object.entries(o).map(([c,u])=>a.jsxs("div",{className:"flex justify-between items-center p-3 bg-gray-50 rounded-lg",children:[a.jsx("span",{className:"font-medium",children:l(c)}),a.jsxs(ke,{variant:u.correct===u.total?"default":"secondary",children:[u.correct,"/",u.total," (",Math.round(u.correct/u.total*100),"%)"]})]},c))})]}),a.jsxs(se,{className:"p-6",children:[a.jsxs("h3",{className:"text-xl font-bold mb-4 flex items-center gap-2",children:[a.jsx(ja,{className:"w-5 h-5"}),"Areas for Improvement"]}),a.jsxs("ul",{className:"space-y-2 text-gray-700",children:[s<70&&a.jsx("li",{children:"• Practice vowel recognition with audio exercises"}),o.matraMatching&&o.matraMatching.correct/o.matraMatching.total<.7&&a.jsx("li",{children:"• Review matra forms and their corresponding independent vowels"}),o.vowelLength&&o.vowelLength.correct/o.vowelLength.total<.7&&a.jsx("li",{children:"• Study the difference between short and long vowels"})]})]}),a.jsxs(Y,{onClick:n,size:"lg",className:"w-full",children:[a.jsx(Gn,{className:"mr-2 h-5 w-5"}),"Restart Quiz"]})]})}function ice(){const{user:e}=Jt(),[t,r]=y.useState({currentQuestionIndex:0,results:[],score:0,totalQuestions:10,difficulty:"beginner",quizType:"mixed",isComplete:!1}),[n,s]=y.useState([]),[i,o]=y.useState(null),[l,c]=y.useState(!1),[u,h]=y.useState(!0),d=(p,v,x)=>{const b=p==="beginner"?g1.slice(0,8):p==="intermediate"?g1.slice(0,12):g1,w=v==="mixed"?["audio","matraMatching","vowelLength","romanization"]:[v],j=[];for(let _=0;_<x;_++){const S=w[Math.floor(Math.random()*w.length)],k=b[Math.floor(Math.random()*b.length)],P=b.filter(I=>I!==k).sort(()=>.5-Math.random()).slice(0,5);let C=[],M="";S==="audio"?(C=[k.malayalam,...P.map(I=>I.malayalam)].sort(()=>.5-Math.random()),M=k.malayalam):S==="matraMatching"?(C=[k.matra,...P.map(I=>I.matra)].sort(()=>.5-Math.random()),M=k.matra):S==="vowelLength"?M=k.length:(C=[k.romanization,...P.map(I=>I.romanization)].sort(()=>.5-Math.random()),M=k.romanization),j.push({id:`q${_}`,type:S,question:"",options:C,correctAnswer:M,vowelData:k})}return j},f=p=>{r(v=>({...v,difficulty:p.difficulty,quizType:p.quizType,totalQuestions:p.numberOfQuestions})),s(d(p.difficulty,p.quizType,p.numberOfQuestions)),h(!1)},m=p=>{o(p),c(!0);const v=n[t.currentQuestionIndex],x=p===v.correctAnswer;setTimeout(()=>{const b={questionId:v.id,correct:x,userAnswer:p,correctAnswer:v.correctAnswer,type:v.type},w=[...t.results,b],j=x?t.score+1:t.score;if(t.currentQuestionIndex+1>=t.totalQuestions){r({...t,results:w,score:j,isComplete:!0});const S={id:`vowel-${Date.now()}`,date:new Date().toISOString(),category:"vowel",difficulty:t.difficulty,quizType:t.quizType,score:j,totalQuestions:t.totalQuestions,results:w};bF(S,e==null?void 0:e.id)}else r({...t,currentQuestionIndex:t.currentQuestionIndex+1,results:w,score:j}),o(null),c(!1)},1500)};if(u)return a.jsx(yF,{quizCategory:"vowel",onStartQuiz:f,onBack:()=>{}});if(t.isComplete)return a.jsx(sce,{results:t.results,score:t.score,totalQuestions:t.totalQuestions,onRestart:()=>{h(!0),r({currentQuestionIndex:0,results:[],score:0,totalQuestions:10,difficulty:"beginner",quizType:"mixed",isComplete:!1}),o(null),c(!1)}});const g=n[t.currentQuestionIndex];return g?a.jsxs("div",{className:"space-y-6",children:[a.jsxs(se,{className:"p-6",children:[a.jsxs("div",{className:"flex justify-between items-center mb-4",children:[a.jsxs(ke,{variant:"outline",children:["Question ",t.currentQuestionIndex+1," of ",t.totalQuestions]}),a.jsxs(ke,{children:["Score: ",t.score,"/",t.currentQuestionIndex]})]}),a.jsx(_t,{value:t.currentQuestionIndex/t.totalQuestions*100,className:"mb-4"})]}),g.type==="audio"&&g.vowelData&&a.jsx(tce,{vowel:g.vowelData,options:g.options,onAnswer:m,selectedAnswer:i,showResult:l}),g.type==="matraMatching"&&g.vowelData&&a.jsx(rce,{vowel:g.vowelData,options:g.options,onAnswer:m,selectedAnswer:i,showResult:l}),g.type==="vowelLength"&&g.vowelData&&a.jsx(nce,{vowel:g.vowelData,onAnswer:m,selectedAnswer:i,showResult:l}),g.type==="romanization"&&g.vowelData&&a.jsx(ace,{vowel:g.vowelData,options:g.options,onAnswer:m,selectedAnswer:i,showResult:l})]}):null}const oce=[{icon:wa,title:"Writing Guide",description:"Step-by-step instructions for writing each letter correctly",color:"bg-blue-500"}
843,{icon:CD,title:"Video Lessons",description:"Watch native speakers demonstrate proper pronunciation",color:"bg-purple-500"},{icon:pd,title:"Audio Practice",description:"Listen and repeat exercises to perfect your accent",color:"bg-green-500"},{icon:wD,title:"Worksheets",description:"Downloadable practice sheets for offline learning",color:"bg-orange-500"}],lce=()=>{const e=t=>{alert(`Opening ${t}... (Feature coming soon!)`)};return a.jsx("div",{className:"py-16 px-4 bg-gradient-to-br from-indigo-50 to-purple-50",children:a.jsxs("div",{className:"max-w-7xl mx-auto",children:[a.jsxs("div",{className:"text-center mb-12",children:[a.jsx("h2",{className:"text-4xl md:text-5xl font-bold text-indigo-900 mb-4",children:"Learning Resources"}),a.jsx("p",{className:"text-xl text-gray-600",children:"Everything you need to master Malayalam script"})]}),a.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6",children:oce.map((t,r)=>{const n=t.icon;return a.jsxs("button",{onClick:()=>e(t.title),className:"bg-white rounded-xl shadow-lg p-6 hover:shadow-2xl transition-all duration-300 hover:-translate-y-1 text-left",children:[a.jsx("div",{className:`${t.color} w-12 h-12 rounded-lg flex items-center justify-center mb-4`,children:a.jsx(n,{className:"w-6 h-6 text-white"})}),a.jsx("h3",{className:"text-xl font-bold text-gray-800 mb-2",children:t.title}),a.jsx("p",{className:"text-gray-600",children:t.description})]},r)})})]})})},ob=()=>{const e=t=>{t.preventDefault(),alert("Thank you for subscribing! You will receive Malayalam learning tips from Neela.")};return a.jsx("footer",{className:"bg-gray-900 text-white py-12 px-4",children:a.jsxs("div",{className:"max-w-7xl mx-auto",children:[a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-8 mb-8",children:[a.jsxs("div",{children:[a.jsx("div",{className:"flex items-center gap-3 mb-4",children:a.jsx("img",{src:Po,alt:"Neela Malayalam",className:"h-14 w-auto object-contain"})}),a.jsx("p",{className:"text-gray-400 text-sm",children:"Master the beautiful Malayalam script with Neela, your Hyacinth Macaw learning companion. Interactive lessons, AI feedback, and daily streaks."})]}),a.jsxs("div",{children:[a.jsx("h3",{className:"font-bold text-lg mb-4",children:"Learn"}),a.jsxs("ul",{className:"space-y-2 text-gray-400",children:[a.jsx("li",{children:a.jsx("a",{href:"#",className:"hover:text-blue-400 transition-colors",children:"Consonants"})}),a.jsx("li",{children:a.jsx("a",{href:"#",className:"hover:text-blue-400 transition-colors",children:"Vowels"})}),a.jsx("li",{children:a.jsx("a",{href:"#",className:"hover:text-blue-400 transition-colors",children:"Practice"})}),a.jsx("li",{children:a.jsx("a",{href:"#",className:"hover:text-blue-400 transition-colors",children:"Resources"})})]})]}),a.jsxs("div",{children:[a.jsx("h3",{className:"font-bold text-lg mb-4",children:"About"}),a.jsxs("ul",{className:"space-y-2 text-gray-400",children:[a.jsx("li",{children:a.jsx("a",{href:"#",className:"hover:text-blue-400 transition-colors",children:"Our Mission"})}),a.jsx("li",{children:a.jsx("a",{href:"#",className:"hover:text-blue-400 transition-colors",children:"Meet Neela"})}),a.jsx("li",{children:a.jsx("a",{href:"#",className:"hover:text-blue-400 transition-colors",children:"FAQ"})}),a.jsx("li",{children:a.jsx("a",{href:"#",className:"hover:text-blue-400 transition-colors",children:"Privacy"})})]})]}),a.jsxs("div",{children:[a.jsx("h3",{className:"font-bold text-lg mb-4",children:"Newsletter"}),a.jsx("p",{className:"text-gray-400 text-sm mb-3",children:"Get weekly Malayalam tips from Neela!"}),a.jsxs("form",{onSubmit:e,className:"space-y-2",children:[a.jsx("input",{type:"email",placeholder:"Your email",className:"w-full px-4 py-2 rounded-lg text-gray-900 bg-gray-100 focus:ring-2 focus:ring-blue-400 focus:outline-none",required:!0}),a.jsx("button",{type:"submit",className:"w-full bg-gradient-to-r from-blue-500 to-indigo-600 hover:from-blue-600 hover:to-indigo-700 text-white py-2 rounded-lg font-semibold transition-all duration-300",children:"Subscribe"})]})]})]}),a.jsxs("div",{className:"border-t border-gray-800 pt-8 flex flex-col md:flex-row justify-between items-center",children:[a.jsxs("p",{className:"text-gray-400 text-sm mb-4 md:mb-0 flex items-center gap-1",children:["© 2026 Neela Malayalam. Made with ",a.jsx(_D,{className:"w-4 h-4 inline text-red-400"})," by the Neela team."]}),a.jsxs("div",{className:"flex gap-4",children:[a.jsx("a",{href:"#",className:"text-gray-400 hover:text-blue-400 transition-colors",children:a.jsx(qK,{className:"w-5 h-5"})}),a.jsx("a",{href:"https://github.com/Rxhulrxj/Neela-Usa-Malayalee-App",target:"_blank",rel:"noopener noreferrer",className:"text-gray-400 hover:text-blue-400 transition-colors",children:a.jsx(r2,{className:"w-5 h-5"})}),a.jsx("a",{href:"#",className:"text-gray-400 hover:text-blue-400 transition-colors",children:a.jsx(gd,{className:"w-5 h-5"})})]})]})]})})},cce={vowels:{tip:"Malayalam has 15 vowels (സ്വരങ്ങൾ). Start with the short vowels first — they're the building blocks for everything else!",tipMl:"മലയാളത്തിൽ 15 സ്വരങ്ങൾ ഉണ്ട്. ആദ്യം ഹ്രസ്വ സ്വരങ്ങൾ പഠിക്കൂ — അവ മറ്റെല്ലാറ്റിന്റെയും അടിസ്ഥാനമാണ്!",encouragement:"You're doing great! Each vowel you learn opens up dozens of new words!",encouragementMl:"നിങ്ങൾ മികച്ചത് ചെയ്യുന്നു! ഓരോ സ്വരവും ഡസൻ കണക്കിന് പുതിയ വാക്കുകൾ തുറക്കുന്നു!",funFact:"Did you know? Malayalam vowels can stand alone as independent letters AND modify consonants as signs (matras)!",mood:"happy"},consonants:{tip:"Malayalam consonants are organized by where in your mouth you make the sound. This is called 'articulation point'. Try feeling where your tongue touches!",tipMl:"മലയാള വ്യഞ്ജനങ്ങൾ ശബ്ദം ഉണ്ടാക്കുന്ന സ്ഥാനം അനുസരിച്ചà
843µ ക്രമീകരിച്ചിരിക്കുന്നു. നിങ്ങളുടെ നാവ് എവിടെ തൊടുന്നു എന്ന് ശ്രദ്ധിക്കൂ!",encouragement:"Every consonant you master is a huge step! Malayalam has a beautiful logical system.",encouragementMl:"ഓരോ വ്യഞ്ജനവും വലിയ ചുവടുവെപ്പാണ്! മലയാളത്തിന് മനോഹരമായ യുക്തിപരമായ സമ്പ്രദായമുണ്ട്.",funFact:"Malayalam has 36 consonants — more than English's 21! Each has an inherent 'a' sound built in.",mood:"reading"},matras:{tip:"Matras (vowel signs) change how a consonant sounds. Think of them as 'accessories' that dress up consonants with different vowel sounds!",tipMl:"മാത്രകൾ (സ്വര ചിഹ്നങ്ങൾ) വ്യഞ്ജനത്തിന്റെ ശബ്ദം മാറ്റുന്നു. അവ വ്യഞ്ജനങ്ങളെ വ്യത്യസ്ത സ്വര ശബ്ദങ്ങളാൽ അലങ്കരിക്കുന്ന 'ആഭരണങ്ങൾ' ആണ്!",encouragement:"Matras are the key to reading fluently. Once you get these, you'll read much faster!",encouragementMl:"മാത്രകൾ ഒഴുക്കോടെ വായിക്കാനുള്ള താക്കോലാണ്. ഇവ മനസ്സിലാക്കിയാൽ, നിങ്ങൾ വളരെ വേഗം വായിക്കും!",funFact:"Each matra can appear before, after, above, or below the consonant — their position is unique to Malayalam!",mood:"thinking"},conjuncts:{tip:"Conjunct consonants (കൂട്ടക്ഷരങ്ങൾ) are formed when two or more consonants join together. They look complex but follow patterns!",tipMl:"കൂട്ടക്ഷരങ്ങൾ രണ്ടോ അതിലധികമോ വ്യഞ്ജനങ്ങൾ ചേരുമ്പോൾ ഉണ്ടാകുന്നു. അവ സങ്കീർണ്ണമായി തോന്നാം, പക്ഷേ പാറ്റേണുകൾ പിന്തുടരുന്നു!",encouragement:"Conjuncts are the advanced level — you're really progressing! Take your time with each one.",encouragementMl:"കൂട്ടക്ഷരങ്ങൾ ഉയർന്ന തലമാണ് — നിങ്ങൾ ശരിക്കും പുരോഗമിക്കുന്നു! ഓരോന്നിനും സമയമെടുക്കൂ.",funFact:"The word 'Malayalam' itself contains a conjunct: à´² + à´¯ = ല്യ. You're already familiar with one!",mood:"reading"},diphthongs:{tip:"Diphthongs are vowel combinations where two vowel sounds blend together. Malayalam has two main diphthongs: ഐ (ai) and ഔ (au).",tipMl:"ഡിഫ്‌തോങ്ങുകൾ രണ്ട് സ്വര ശബ്ദങ്ങൾ ഒന്നിച്ചു ചേരുന്ന സ്വര സംയോജനങ്ങളാണ്. മലയാളത്തിൽ രണ്ട് പ്രധാന ഡിഫ്‌തോങ്ങുകൾ ഉണ്ട്: ഐ, ഔ.",encouragement:"Diphthongs are like the finishing touches — you're almost there!",encouragementMl:"ഡിഫ്‌തോങ്ങുകൾ അവസാന സ്പർശങ്ങൾ പോലെയാണ് — നിങ്ങൾ ഏതാണ്ട് എത്തിക്കഴിഞ്ഞു!",funFact:"In everyday Malayalam speech, diphthongs often get simplified — 'ai' might sound more like 'e' in casual conversation!",mood:"happy"},quiz:{tip:"Take your time with each question. It's not about speed — it's about understanding the patterns!",tipMl:"ഓരോ ചോദ്യത്തിനും സമയമെടുക്കൂ. വേഗതയല്ല — പാറ്റേണുകൾ മനസ്സിലാക്കലാണ് പ്രധാനം!",encouragement:"Every quiz attempt makes you stronger. Mistakes are just learning in disguise!",encouragementMl:"ഓരോ ക്വിസ് ശ്രമവും നിങ്ങളെ ശക്തരാക്കുന്നു. തെറ്റുകൾ വേഷം മാറിയ പഠനമാണ്!",funFact:"Research shows that testing yourself is one of the most effective ways to learn — you're doing it right!",mood:"thinking"}},Qc=({section:e,className:t=""})=>{const[r,n]=y.useState(!1),[s,i]=y.useState(!1),o=cce[e];return o?a.jsxs("div",{className:`bg-gradient-to-r from-blue-50 via-indigo-50 to-purple-50 rounded-2xl border border-blue-200/50 overflow-hidden shadow-sm ${t}`,children:[a.jsxs("button",{onClick:()=>n(!r),className:"w-full flex items-center gap-3 p-4 hover:bg-blue-100/30 transition-colors",children:[a.jsxs("div",{className:"relative flex-shrink-0",children:[a.jsx("img",{src:Ds[o.mood],alt:"Neela",className:"w-12 h-12 rounded-full object-cover border-2 border-blue-300 shadow-sm"}),a.jsx("div",{className:"absolute -bottom-0.5 -right-0.5 w-5 h-5 bg-blue-500 rounded-full flex items-center justify-center",children:a.jsx(ec,{className:"w-3 h-3 text-white"})})]}),a.jsxs("div",{className:"flex-1 text-left",children:[a.jsxs("p",{className:"text-sm font-bold text-blue-800 flex items-center gap-1.5",children:[a.jsx(Cf,{className:"w-4 h-4 text-blue-500"}),"Neela's Tip"]}),a.jsx("p",{className:"text-xs text-blue-600/70 line-clamp-1",children:s?o.tipMl:o.tip})]}),a.jsx("div",{className:"flex-shrink-0 text-blue-400",children:r?a.jsx(xD,{className:"w-5 h-5"}):a.jsx(Cp,{className:"w-5 h-5"})})]}),r&&a.jsxs("div",{className:"px-4 pb-4 space-y-3 animate-in slide-in-from-top-2 duration-200",children:[a.jsx("div",{className:"bg-white rounded-xl p-4 border border-blue-100",children:a.jsxs("div",{className:"flex items-start gap-2 mb-2",children:[a.jsx(ec,{className:"w-4 h-4 text-amber-500 mt-0.5 flex-shrink-0"}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-semibold text-gray-800 mb
843-1",children:"Learning Tip"}),a.jsx("p",{className:"text-sm text-gray-600 leading-relaxed",children:s?o.tipMl:o.tip})]})]})}),a.jsx("div",{className:"bg-gradient-to-r from-green-50 to-emerald-50 rounded-xl p-4 border border-green-100",children:a.jsxs("div",{className:"flex items-start gap-2",children:[a.jsx("img",{src:Ds.happy,alt:"Neela encouraging",className:"w-8 h-8 rounded-full object-cover border border-green-200 flex-shrink-0"}),a.jsxs("p",{className:"text-sm text-green-700 leading-relaxed italic",children:['"',s?o.encouragementMl:o.encouragement,'"']})]})}),a.jsxs("div",{className:"bg-gradient-to-r from-purple-50 to-pink-50 rounded-xl p-4 border border-purple-100",children:[a.jsx("p",{className:"text-xs font-bold text-purple-700 mb-1 uppercase tracking-wide",children:"Fun Fact"}),a.jsx("p",{className:"text-sm text-purple-600 leading-relaxed",children:o.funFact})]}),a.jsx("div",{className:"flex justify-center",children:a.jsx("button",{onClick:()=>i(!s),className:"text-xs text-blue-500 hover:text-blue-700 font-medium transition-colors bg-blue-50 px-3 py-1.5 rounded-full",children:s?"Show in English":"മലയാളത്തിൽ കാണുക"})})]})]}):null},uce=({show:e,onClose:t,title:r="Amazing Job!",titleMl:n="അത്ഭുതകരം!",message:s="Neela is so proud of you!",messageMl:i="നീല നിങ്ങളിൽ വളരെ അഭിമാനിക്കുന്നു!",xpEarned:o=0,type:l="achievement"})=>{const[c,u]=y.useState([]),[h,d]=y.useState(!1),[f,m]=y.useState(0);if(y.useEffect(()=>{if(e){const v=Array.from({length:40},(b,w)=>({id:w,x:Math.random()*100,y:-10-Math.random()*20,color:["#FFD700","#FF6B6B","#4ECDC4","#45B7D1","#96CEB4","#FFEAA7","#DDA0DD","#98D8C8"][Math.floor(Math.random()*8)],delay:Math.random()*2,size:4+Math.random()*8}));u(v),setTimeout(()=>m(1),200);const x=setTimeout(()=>t(),6e3);return()=>clearTimeout(x)}else m(0),u([])},[e,t]),!e)return null;const p={streak:{icon:"🔥",gradient:"from-orange-500 to-red-500",label:"Streak"},quiz:{icon:"🧠",gradient:"from-purple-500 to-indigo-500",label:"Quiz Complete"},lesson:{icon:"📚",gradient:"from-blue-500 to-cyan-500",label:"Lesson Done"},milestone:{icon:"🏆",gradient:"from-yellow-500 to-amber-500",label:"Milestone"},achievement:{icon:"⭐",gradient:"from-pink-500 to-rose-500",label:"Achievement"}}[l];return a.jsxs("div",{className:"fixed inset-0 z-[200] flex items-center justify-center",children:[a.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:t}),a.jsx("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:c.map(v=>a.jsx("div",{className:"absolute rounded-full",style:{left:`${v.x}%`,top:`${v.y}%`,width:`${v.size}px`,height:`${v.size}px`,backgroundColor:v.color,animation:`confettiFall 3s ease-in ${v.delay}s forwards`}},v.id))}),a.jsxs("div",{className:"relative z-10 bg-white rounded-3xl shadow-2xl p-8 max-w-md w-full mx-4 text-center overflow-hidden",style:{transform:`scale(${f})`,transition:"transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275)"},children:[a.jsx("button",{onClick:t,className:"absolute top-4 right-4 w-8 h-8 rounded-full bg-gray-100 hover:bg-gray-200 flex items-center justify-center z-20",children:a.jsx(ls,{className:"w-4 h-4 text-gray-500"})}),a.jsx("div",{className:"absolute top-4 left-8",children:a.jsx(An,{className:"w-6 h-6 text-yellow-400 animate-spin",style:{animationDuration:"3s"}})}),a.jsx("div",{className:"absolute top-12 right-12",children:a.jsx(is,{className:"w-5 h-5 text-yellow-400 animate-pulse"})}),a.jsx("div",{className:"absolute bottom-8 left-6",children:a.jsx(is,{className:"w-4 h-4 text-blue-400 animate-pulse",style:{animationDelay:"0.5s"}})}),a.jsxs("div",{className:"relative mx-auto w-32 h-32 mb-4",children:[a.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-yellow-300 to-amber-400 rounded-full animate-pulse opacity-30 scale-125"}),a.jsx("img",{src:Ds.celebrating,alt:"Neela celebrating",className:"w-32 h-32 rounded-full object-cover border-4 border-yellow-400 shadow-xl relative z-10 animate-bounce",style:{animationDuration:"1s"}}),a.jsx("div",{className:"absolute inset-0 rounded-full border-4 border-dashed border-yellow-300 animate-spin",style:{animationDuration:"8s"}})]}),a.jsxs("div",{className:`inline-flex items-center gap-2 bg-gradient-to-r ${p.gradient} text-white px-4 py-1.5 rounded-full text-sm font-bold mb-3 shadow-lg`,children:[a.jsx(lr,{className:"w-4 h-4"}),p.label]}),a.jsx("h2",{className:"text-3xl font-bold text-gray-900 mb-2",children:h?n:r}),a.jsx("p",{className:"text-gray-600 text-lg mb-4",children:h?i:s}),o>0&&a.jsxs("div",{className:"inline-flex items-center gap-2 bg-gradient-to-r from-purple-100 to-indigo-100 text-purple-700 px-5 py-2 rounded-full font-bold text-lg mb-4 shadow-inner",children:[a.jsx(An,{className:"w-5 h-5 text-purple-500"}),"+",o," XP"]}),a.jsx("div",{className:"mt-2",children:a.jsx("button",{onClick:()=>d(!h),className:"text-sm text-blue-500 hover:text-blue-700 font-medium transition-colors",children:h?"Show English":"മലയാളത്തിൽ കാണുക"})}),a.jsx("button",{onClick:t,className:`mt-6 w-full bg-gradient-to-r ${p.gradient} text-white py-3 rounded-xl font-bold text-lg shadow-lg hover:shadow-xl transition-all duration-300 hover:scale-[1.02]`,children:"Continue Learning"})]}),a.jsx("style",{children:`
844        @keyframes confettiFall {
845          0% { transform: translateY(0) rotate(0deg); opacity: 1; }
846          100% { transform: translateY(100vh) rotate(720deg); opacity: 0; }
847        }
848      `})]})},dce=()=>{const[e,t]=y.useState("happy"),[r,n]=y.useState(!1),[s,i]=y.useState({title:"Welcome Back!",titleMl:"സ്വാഗതം!",message:"Neela is happy to see you!",messageMl:"നീല നിങ്ങളെ കണ്ടതിൽ സന്തോഷി
848ക്കുന്നു!",xp:0,type:"achievement"});y.useEffect(()=>{const l=m6();if(t(I2()),l.newMilestones.length>0){const c=l.newMilestones[0];i({title:c.title,titleMl:c.titleMl,message:`${c.description} ${c.reward}`,messageMl:`${c.description} ${c.reward}`,xp:c.rewardXP,type:"milestone"}),setTimeout(()=>n(!0),1e3)}else l.streakExtended&&l.streakData.currentStreak>1&&(i({title:`${l.streakData.currentStreak} Day Streak!`,titleMl:`${l.streakData.currentStreak} ദിവസത്തെ സ്ട്രീക്ക്!`,message:"Neela is dancing with joy! Keep it up!",messageMl:"നീല സന്തോഷത്തോടെ നൃത്തം ചെയ്യുന്നു! തുടരൂ!",xp:10,type:"streak"}),setTimeout(()=>n(!0),2e3))},[]);const o=y.useCallback(()=>{n(!1)},[]);return a.jsxs("div",{className:"min-h-screen bg-white",children:[a.jsx(hs,{}),a.jsx(Koe,{}),a.jsx(Yoe,{}),a.jsx("section",{id:"learn-section",className:"py-16 px-4 bg-gradient-to-b from-white to-blue-50",children:a.jsxs("div",{className:"max-w-7xl mx-auto space-y-8",children:[a.jsx(Qc,{section:"vowels"}),a.jsx(ele,{}),a.jsx(rle,{})]})}),a.jsx(Xoe,{}),a.jsx(Qoe,{}),a.jsx("section",{className:"py-2",children:a.jsx("div",{className:"max-w-7xl mx-auto px-4",children:a.jsx(Qc,{section:"consonants"})})}),a.jsx(ole,{}),a.jsx("section",{className:"py-16 px-4 bg-gradient-to-b from-white to-indigo-50",children:a.jsxs("div",{className:"max-w-7xl mx-auto space-y-12",children:[a.jsx(_le,{}),a.jsx(cle,{})]})}),a.jsx(Nle,{}),a.jsx(ule,{}),a.jsx("section",{className:"py-2",children:a.jsx("div",{className:"max-w-7xl mx-auto px-4",children:a.jsx(Qc,{section:"matras"})})}),a.jsx(dle,{}),a.jsx(hle,{}),a.jsx(fle,{}),a.jsx(mle,{}),a.jsx("section",{className:"py-16 px-4 bg-gradient-to-b from-white to-purple-50",children:a.jsxs("div",{className:"max-w-7xl mx-auto space-y-8",children:[a.jsxs("div",{className:"text-center mb-8",children:[a.jsx("h2",{className:"text-4xl font-bold text-gray-900 mb-4",children:"Vowel Combinations & Diphthongs"}),a.jsx("p",{className:"text-xl text-gray-600",children:"Learn how vowels combine to create unique sounds"})]}),a.jsx(Qc,{section:"diphthongs"}),a.jsx(ale,{}),a.jsx(sle,{})]})}),a.jsx("section",{className:"py-16 px-4 bg-gradient-to-b from-white to-purple-50",children:a.jsxs("div",{className:"max-w-7xl mx-auto space-y-8",children:[a.jsxs("div",{className:"text-center mb-8",children:[a.jsx("h2",{className:"text-4xl font-bold text-gray-900 mb-4",children:"Conjunct Consonants"}),a.jsx("p",{className:"text-xl text-gray-600",children:"Learn how consonants combine to form complex sounds"})]}),a.jsx(Qc,{section:"conjuncts"}),a.jsx(ple,{}),a.jsx(yle,{}),a.jsx(ble,{}),a.jsx(wle,{})]})}),a.jsx("section",{id:"quiz-section",className:"py-16 px-4 bg-gradient-to-b from-white to-indigo-50",children:a.jsxs("div",{className:"max-w-7xl mx-auto space-y-8",children:[a.jsxs("div",{className:"text-center mb-8",children:[a.jsx("h2",{className:"text-4xl font-bold text-gray-900 mb-4",children:"Test Your Consonant Knowledge"}),a.jsx("p",{className:"text-xl text-gray-600",children:"Take interactive quizzes to master Malayalam consonants"})]}),a.jsx(Qc,{section:"quiz"}),a.jsx(ece,{})]})}),a.jsx("section",{className:"py-16 px-4 bg-gradient-to-b from-indigo-50 to-purple-50",children:a.jsxs("div",{className:"max-w-7xl mx-auto space-y-12",children:[a.jsxs("div",{className:"text-center mb-12",children:[a.jsx("h2",{className:"text-4xl font-bold text-gray-900 mb-4",children:"Test Your Vowel Knowledge"}),a.jsx("p",{className:"text-xl text-gray-600",children:"Master Malayalam vowels with audio recognition, matra matching, and more"})]}),a.jsx(ice,{})]})}),a.jsx(lce,{}),a.jsx(ob,{}),a.jsx(gne,{mood:e,size:"lg",floating:!0,context:"lesson",animate:!0}),a.jsx(uce,{show:r,onClose:o,title:s.title,titleMl:s.titleMl,message:s.message,messageMl:s.messageMl,xpEarned:s.xp,type:s.type})]})},hce={sidebarOpen:!1,toggleSidebar:()=>{}},fce=y.createContext(hce),mce=({children:e})=>{const[t,r]=y.useState(!1),n=()=>{r(s=>!s)};return a.jsx(fce.Provider,{value:{sidebarOpen:t,toggleSidebar:n},children:e})},pce=()=>a.jsx(mce,{children:a.jsx(dce,{})});var lb="Tabs",[gce]=Cr(lb,[nb]),wF=nb(),[yce,rC]=gce(lb),jF=y.forwardRef((e,t)=>
848{const{__scopeTabs:r,value:n,onValueChange:s,defaultValue:i,orientation:o="horizontal",dir:l,activationMode:c="automatic",...u}=e,h=Pc(l),[d,f]=ln({prop:n,onChange:s,defaultProp:i??"",caller:lb});return a.jsx(yce,{scope:r,baseId:Tn(),value:d,onValueChange:f,orientation:o,dir:h,activationMode:c,children:a.jsx(Ce.div,{dir:h,"data-orientation":o,...u,ref:t})})});jF.displayName=lb;var _F="TabsList",SF=y.forwardRef((e,t)=>{const{__scopeTabs:r,loop:n=!0,...s}=e,i=rC(_F,r),o=wF(r);return a.jsx(l8,{asChild:!0,...o,orientation:i.orientation,dir:i.dir,loop:n,children:a.jsx(Ce.div,{role:"tablist","aria-orientation":i.orientation,...s,ref:t})})});SF.displayName=_F;var NF="TabsTrigger",kF=y.forwardRef((e,t)=>{const{__scopeTabs:r,value:n,disabled:s=!1,...i}=e,o=rC(NF,r),l=wF(r),c=TF(o.baseId,n),u=AF(o.baseId,n),h=n===o.value;return a.jsx(c8,{asChild:!0,...l,focusable:!s,active:h,children:a.jsx(Ce.button,{type:"button",role:"tab","aria-selected":h,"aria-controls":u,"data-state":h?"active":"inactive","data-disabled":s?"":void 0,disabled:s,id:c,...i,ref:t,onMouseDown:ye(e.onMouseDown,d=>{!s&&d.button===0&&d.ctrlKey===!1?o.onValueChange(n):d.preventDefault()}),onKeyDown:ye(e.onKeyDown,d=>{[" ","Enter"].includes(d.key)&&o.onValueChange(n)}),onFocus:ye(e.onFocus,()=>{const d=o.activationMode!=="manual";!h&&!s&&d&&o.onValueChange(n)})})})});kF.displayName=NF;var CF="TabsContent",EF=y.forwardRef((e,t)=>{const{__scopeTabs:r,value:n,forceMount:s,children:i,...o}=e,l=rC(CF,r),c=TF(l.baseId,n),u=AF(l.baseId,n),h=n===l.value,d=y.useRef(h);return y.useEffect(()=>{const f=requestAnimationFrame(()=>d.current=!1);return()=>cancelAnimationFrame(f)},[]),a.jsx(vr,{present:s||h,children:({present:f})=>a.jsx(Ce.div,{"data-state":h?"active":"inactive","data-orientation":l.orientation,role:"tabpanel","aria-labelledby":c,hidden:!f,id:u,tabIndex:0,...o,ref:t,style:{...e.style,animationDuration:d.current?"0s":void 0},children:f&&i})})});EF.displayName=CF;function TF(e,t){return`${e}-trigger-${t}`}function AF(e,t){return`${e}-content-${t}`}var vce=jF,PF=SF,OF=kF,MF=EF;const Pn=vce,fn=y.forwardRef(({className:e,...t},r)=>a.jsx(PF,{ref:r,className:je("inline-flex h-10 items-center justify-center rounded-md bg-muted/50 p-1 text-muted-foreground",e),...t}));fn.displayName=PF.displayName;const Oe=y.forwardRef(({className:e,...t},r)=>a.jsx(OF,{ref:r,className:je("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-primary focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-primary data-[state=active]:shadow-sm hover:text-foreground",e),...t}));Oe.displayName=OF.displayName;const ze=y.forwardRef(({className:e,...t},r)=>a.jsx(MF,{ref:r,className:je("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-2 animate-in fade-in-0 data-[state=inactive]:animate-out data-[state=inactive]:fade-out-0 duration-200",e),...t}));ze.displayName=MF.displayName;function xce({stats:e}){return a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4",children:[a.jsx(se,{className:"p-6",children:a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"p-3 bg-blue-100 rounded-lg",children:a.jsx(os,{className:"h-6 w-6 text-blue-600"})}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm text-gray-600",children:"Total Quizzes"}),a.jsx("p",{className:"text-2xl font-bold",children:e.totalQuizzes})]})]})}),a.jsx(se,{className:"p-6",children:a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"p-3 bg-green-100 rounded-lg",children:a.jsx(ja,{className:"h-6 w-6 text-green-600"})}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm text-gray-600",children:"Average Score"}),a.jsxs("p",{className:"text-2xl font-bold",children:[e.averageScore.toFixed(1),"%"]})]})]})}),a.jsx(se,{className:"p-6",children:a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"p-3 bg-orange-100 rounded-lg",children:a.jsx(ma,{className:"h-6 w-6 text-orange-600"})}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm text-gray-600",children:"Current Streak"}),a.jsxs("p",{className:"text-2xl font-bold",children:[e.currentStreak," days"]})]})]})}),a.jsx(se,{className:"p-6",children:a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"p-3 bg-purple-100 rounded-lg",children:a.jsx(Ec,{className:"h-6 w-6 text-purple-600"})}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm text-gray-600",children:"Achievements"}),a.jsxs("p",{className:"text-2xl font-bold",children:[e.achievements.filter(t=>t.unlockedDate).length,"/",e.achievements.length]})]})]})})]})}function bce({stats:e}){const t=new Date,r=42,n=[];for(let i=r-1;i>=0;i--){const o=new Date(t);o.setDate(o.getDate()-i);const l=o.toISOString().split("T")[0],c=e.practiceCalendar[l]||0;n.push({date:l,count:c,day:o.getDate(),month:o.getMonth()})}const s=i=>i===0?"bg-gray-100":i===1?"bg-green-200":i===2?"bg-green-400":"bg-green-600";return a.jsxs(se,{className:"p-6",children:[a.jsx("h3",{className:"text-lg font-semibold mb-4",children:"Practice Calendar"}),a.jsxs("div",{className:"grid grid-cols-7 gap-2",children:[["Sun","Mon","Tue","Wed","Thu","Fri","Sat"].map(i=>a.jsx("div",{className:"text-xs text-center text-gray-600 font-medium",children:i},i)),n.map((i,o)=>a.jsx("div",{className:`aspect-square rounded ${s(i.count)} flex items-center justify-center text-xs font-medium ${i.count>0?"text-white":"text-gray-400"}`,title:`${i.date}: ${i.count} quiz${i.count!==1?"zes":""}`,children:i.day},o))]}),a.jsxs("div",{className:"flex items-center gap-4 mt-4 text-sm text-gray-600",children:[a.jsx("span",{children:"Less"}),a.jsxs("div",{className:"flex gap-1",children:[a.jsx("div",{className:"w-4 h-4 bg-gray-100 rounded"}),a.jsx("div",{className:"w-4 h-4 bg-green-200 rounded"}),a.jsx("div",{className:"w-4 h-4 bg-green-400 rounded"}),a.jsx("div",{className:"w-4 h-4 bg-green-600 rounded"})]}),a.jsx("span",{children:"More"})]})]})}const cb=e=>Math.floor(100*Math.pow(1.5,e-1)),RF=e=>{let t=1,r=0;for(;r<=e;)r+=cb(t),r<=e&&t++;return t},wce={QUIZ_COMPLETE:50,PERFECT_QUIZ:100,DAILY_PRACTICE:25,STREAK_MILESTONE:150,FLASHCARD_SESSION:30,WRITING_PRACTICE:40,CHALLENGE_COMPLETE:75},nC=[{id:"first_quiz",name:"First Steps",description:"Complete your first quiz",icon:"🎯",requirement:"quiz_1"},{id:"perfect_score",name:"Perfectionist",description:"Get 100% on any quiz",icon:"💯",requirement:"perfect_1"},{id:"streak_7",name:"Week Warrior",description:"7 day practice streak",icon:"🔥",requirement:"streak_7"},{id:"streak_30",name:"Month Master",description:"30 day practice streak",icon:"⭐",requirement:"streak_30"},{id:"level_5",name:"Rising Star",description:"Reach level 5",icon:"🌟",requirement:"level_5"},{id:"level_10",name:"Expert Learner",description:"Reach level 10",icon:"👑",requirement:"level_10"},{id:"challenges_10",name:"Challenge Seeker",description:"Complete 10 daily challenges",icon:"🏆",requirement:"challenges_10"},{id:"xp_1000",name:"XP Collector",description:"Earn 1000 total XP",icon:"💎",requirement:"xp_1000"}],jce=async(e,t)=>{const{data:r}=await ne.from("user_gamification").select("*").eq("user_id",e).single();r!=null&&r.xp;const n=(r==null?void 0:r.level)||1,s=(r==null?void 0:r.total_xp)||0,i=(r==null?void 0:r.weekly_xp)||0,o=s+t,l=i+t,c=RF(o),u=c>n,h=Array.from({length:c-1},(m,g)=>cb(g+1)).reduce((m,g)=>m+g,0),d=o-h,{data:f}=await ne.from("user_gamification").upsert({user_id:e,xp:d,level:c,total_xp:o,weekly_xp:l,updated_at:new Date().toISOString()}).select().single();return{leveledUp:u,newLevel:c,data:{xp:d,level:c,totalXp:o,streakDays:(f==null?void 0:f.streak_days)||0,lastPracticeDate:(f==null?void 0:f.last_practice_date)||null}}},_ce=Object.freeze(Object.defineProperty({__proto__:null,BADGES:nC,XP_REWARDS:wce,awardXP:jce,getLevelFromXP:RF,getXPForLevel:cb},Symbol.toStringTag,{value:"Module"}));function Sce({currentXP:e,level:t,showLabel:r=!0}){const n=cb(t),s=e/n*100;return a.jsxs("div",{className:"space-y-2",children:[r&&a.jsxs("div",{className:"flex items-center justify-between text-sm",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(An,{className:"w-4 h-4 text-yellow-500"}),a.jsxs("span",{className:"font-semibold",children:["Level ",t]})]}),a.jsxs("span",{className:"text-muted-foreground",children:[e," / ",n," XP"]})]}),a.jsx(_t,{value:s,className:"h-3"})]})}function Nce(e){const t=kce(e),r=y.forwardRef((n,s)=>{const{children:i,...o}=n,l=y.Children.toArray(i),c=l.find(Ece);if(c){const u=c.props.children,h=l.map(d=>d===c?y.Children.count(u)>1?y.Children.only(null):y.isValidElement(u)?u.props.children:null:d);return a.jsx(t,{...o,ref:s,children:y.isValidElement(u)?y.cloneElement(u,void 0,h):null})}return a.jsx(t,{...o,ref:s,children:i})});return r.displayName=`${e}.Slot`,r}function kce(e){const t=y.forwardRef((r,n)=>{const{children:s,...i}=r;if(y.isValidElement(s)){const o=Ace(s),l=Tce(i,s.props);return s.type!==y.Fragment&&(l.ref=n?Js(n,o):o),y.cloneElement(s,l)}return y.Children.count(s)>1?y.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Cce=Symbol("radix.slottable");function Ece(e){return y.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Cce}function Tce(e,t){const r={...t};for(const n in t){const s=e[n],i=t[n];/^on[A-Z]/.test(n)?s&&i?r[n]=(...l)=>{const c=i(...l);return s(...l),c}:s&&(r[n]=s):n==="style"?r[n]={...s,...i}
vendor: 6,521 bytes, lines 848-852
848:n==="className"&&(r[n]=[s,i].filter(Boolean).join(" "))}return{...e,...r}}function Ace(e){var n,s;let t=(n=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:n.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=(s=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:s.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}var ub="Dialog",[$F,IF]=Cr(ub),[Pce,ys]=$F(ub),DF=e=>{const{__scopeDialog:t,children:r,open:n,defaultOpen:s,onOpenChange:i,modal:o=!0}=e,l=y.useRef(null),c=y.useRef(null),[u,h]=ln({prop:n,defaultProp:s??!1,onChange:i,caller:ub});return a.jsx(Pce,{scope:t,triggerRef:l,contentRef:c,contentId:Tn(),titleId:Tn(),descriptionId:Tn(),open:u,onOpenChange:h,onOpenToggle:y.useCallback(()=>h(d=>!d),[h]),modal:o,children:r})};DF.displayName=ub;var LF="DialogTrigger",FF=y.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,s=ys(LF,r),i=$e(t,s.triggerRef);return a.jsx(Ce.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":iC(s.open),...n,ref:i,onClick:ye(e.onClick,s.onOpenToggle)})});FF.displayName=LF;var aC="DialogPortal",[Oce,zF]=$F(aC,{forceMount:void 0}),BF=e=>{const{__scopeDialog:t,forceMount:r,children:n,container:s}=e,i=ys(aC,t);return a.jsx(Oce,{scope:t,forceMount:r,children:y.Children.map(n,o=>a.jsx(vr,{present:r||i.open,children:a.jsx(th,{asChild:!0,container:s,children:o})}))})};BF.displayName=aC;var Kv="DialogOverlay",UF=y.forwardRef((e,t)=>{const r=zF(Kv,e.__scopeDialog),{forceMount:n=r.forceMount,...s}=e,i=ys(Kv,e.__scopeDialog);return i.modal?a.jsx(vr,{present:n||i.open,children:a.jsx(Rce,{...s,ref:t})}):null});UF.displayName=Kv;var Mce=Nce("DialogOverlay.RemoveScroll"),Rce=y.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,s=ys(Kv,r);return a.jsx($p,{as:Mce,allowPinchZoom:!0,shards:[s.contentRef],children:a.jsx(Ce.div,{"data-state":iC(s.open),...n,ref:t,style:{pointerEvents:"auto",...n.style}})})}),dc="DialogContent",WF=y.forwardRef((e,t)=>{const r=zF(dc,e.__scopeDialog),{forceMount:n=r.forceMount,...s}=e,i=ys(dc,e.__scopeDialog);return a.jsx(vr,{present:n||i.open,children:i.modal?a.jsx($ce,{...s,ref:t}):a.jsx(Ice,{...s,ref:t})})});WF.displayName=dc;var $ce=y.forwardRef((e,t)=>{const r=ys(dc,e.__scopeDialog),n=y.useRef(null),s=$e(t,r.contentRef,n);return y.useEffect(()=>{const i=n.current;if(i)return Q0(i)},[]),a.jsx(VF,{...e,ref:s,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:ye(e.onCloseAutoFocus,i=>{var o;i.preventDefault(),(o=r.triggerRef.current)==null||o.focus()}),onPointerDownOutside:ye(e.onPointerDownOutside,i=>{const o=i.detail.originalEvent,l=o.button===0&&o.ctrlKey===!0;(o.button===2||l)&&i.preventDefault()}),onFocusOutside:ye(e.onFocusOutside,i=>i.preventDefault())})}),Ice=y.forwardRef((e,t)=>{const r=ys(dc,e.__scopeDialog),n=y.useRef(!1),s=y.useRef(!1);return a.jsx(VF,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{var o,l;(o=e.onCloseAutoFocus)==null||o.call(e,i),i.defaultPrevented||(n.current||(l=r.triggerRef.current)==null||l.focus(),i.preventDefault()),n.current=!1,s.current=!1},onInteractOutside:i=>{var c,u;(c=e.onInteractOutside)==null||c.call(e,i),i.defaultPrevented||(n.current=!0,i.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const o=i.target;((u=r.triggerRef.current)==null?void 0:u.contains(o))&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&s.current&&i.preventDefault()}})}),VF=y.forwardRef((e,t)=>{const{__scopeDialog:r,trapFocus:n,onOpenAutoFocus:s,onCloseAutoFocus:i,...o}=e,l=ys(dc,r),c=y.useRef(null),u=$e(t,c);return X0(),a.jsxs(a.Fragment,{children:[a.jsx(Rp,{asChild:!0,loop:!0,trapped:n,onMountAutoFocus:s,onUnmountAutoFocus:i,children:a.jsx(Cc,{role:"dialog",id:l.contentId,"aria-describedby":l.descriptionId,"aria-labelledby":l.titleId,"data-state":iC(l.open),...o,ref:u,onDismiss:()=>l.onOpenChange(!1)})}),a.jsxs(a.Fragment,{children:[a.jsx(Lce,{titleId:l.titleId}),a.jsx(zce,{contentRef:c,descriptionId:l.descriptionId})]})]})}),sC="DialogTitle",HF=y.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,s=ys(sC,r);return a.jsx(Ce.h2,{id:s.titleId,...n,ref:t})});HF.displayName=sC;var qF="DialogDescription",GF=y.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,s=ys(qF,r);return a.jsx(Ce.p,{id:s.descriptionId,...n,ref:t})});GF.displayName=qF;var KF="DialogClose",YF=y.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,s=ys(KF,r);return a.jsx(Ce.button,{type:"button",...n,ref:t,onClick:ye(e.onClick,()=>s.onOpenChange(!1))})});YF.displayName=KF;function iC(e){return e?"open":"closed"}var XF="DialogTitleWarning",[Dce,QF]=_G(XF,{contentName:dc,titleName:sC,docsSlug:"dialog"}),Lce=({titleId:e})=>{const t=QF(XF),r=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
849
850If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
851
852For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return y.useEffect(()=>{e&&(document.getElementById(e)||console.error(r))},[r,e]),null},Fce="DialogDescriptionWarning",zce=({contentRef:e,descriptionId:t})=>{const n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${QF(Fce).contentName}}.`;return y.useEffect(()=>{var i;const s=(i=e.current)==null?void 0:i.getAttribute("aria-describedby");t&&s&&(document.getElementById(t)||console.warn(n))},[n,e,t]),null},JF=DF,ZF=FF,ez=BF,oC=UF,lC=WF,cC=HF,uC=GF,dC=YF;const Ks=JF,tz=ZF,Bce=ez,rz=y.forwardRef(({className:e,...t},r)=>a.jsx(oC,{ref:r,className:je("fixed inset-0 z-50 bg-background/80 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t}));rz.displayName=oC.displayName;const fs=y.forwardRef(({className:e,children:t,...r},n)=>a.jsxs(Bce,{children:[a.jsx(rz,{}),a.jsxs(lC,{ref:n,className:je("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border border-border/40 bg-background p-6 shadow-lg duration-200 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-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",e),...r,children:[t,a.jsxs(dC,{className:"absolute right-4 top-4 roun
852ded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[a.jsx(ls,{className:"h-4 w-4"}),a.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));fs.displayName=lC.displayName;const Ys=({className:e,...t})=>a.jsx("div",{className:je("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});Ys.displayName="DialogHeader";const Xs=y.forwardRef(({className:e,...t},r)=>a.jsx(cC,{ref:r,className:je("text-lg font-semibold leading-none tracking-tight text-foreground",e),...t}));Xs.displayName=cC.displayName;const Uce=y.forwardRef(({className:e,...t},r)=>a.jsx(uC,{ref:r,className:je("text-sm text-muted-foreground",e),...t}));Uce.displayName=uC.displayName;function Wce({open:e,onClose:t,newLevel:r}){return a.jsx(Ks,{open:e,onOpenChange:t,children:a.jsx(fs,{className:"sm:max-w-md",children:a.jsxs("div",{className:"flex flex-col items-center justify-center py-8 space-y-6",children:[a.jsxs("div",{className:"relative",children:[a.jsx("div",{className:"absolute inset-0 animate-ping",children:a.jsx(lr,{className:"w-24 h-24 text-yellow-500 opacity-75"})}),a.jsx(lr,{className:"w-24 h-24 text-yellow-500 relative z-10"})]}),a.jsxs("div",{className:"text-center space-y-2",children:[a.jsx("h2",{className:"text-3xl font-bold",children:"Level Up!"}),a.jsxs("div",{className:"flex items-center justify-center gap-2",children:[a.jsx(is,{className:"w-6 h-6 text-yellow-500 animate-pulse"}),a.jsx("p",{className:"text-5xl font-bold text-yellow-500",children:r}),a.jsx(is,{className:"w-6 h-6 text-yellow-500 animate-pulse"})]}),a.jsxs("p",{className:"text-muted-foreground",children:["You've reached level ",r,"! Keep up the great work!"]})]}),a.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[a.jsx(An,{className:"w-4 h-4"}),a.jsx("span",{children:"New rewards unlocked in the shop!"})]}),a.jsx(Y,{onClick:t,size:"lg",className:"w-full",children:"Continue Learning"})]})})})}function Vce({earnedBadges:e}){return a.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-4",children:a.jsx(p2,{children:nC.map(t=>{const r=e.includes(t.id);return a.jsxs(pL,{children:[a.jsx(gL,{asChild:!0,children:a.jsxs(se,{className:`p-4 flex flex-col items-center justify-center space-y-2 cursor-pointer transition-all ${r?"bg-gradient-to-br from-yellow-50 to-orange-50 border-yellow-300":"opacity-50 grayscale"}`,children:[a.jsxs("div",{className:"text-4xl relative",children:[t.icon,!r&&a.jsx(Ef,{className:"w-4 h-4 absolute -top-1 -right-1 text-gray-400"})]}),a.jsx("p",{className:"text-xs font-medium text-center",children:t.name})]})}),a.jsxs(g2,{children:[a.jsx("p",{className:"font-medium",children:t.name}),a.jsx("p",{className:"text-sm text-muted-foreground",children:t.description})]})]},t.id)})})})}function Hce({challenges:e,onChallengeClick:t}){return a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(os,{className:"w-5 h-5 text-primary"}),a.jsx("h3",{className:"text-lg font-semibold",children:"Daily Challenges"})]}),a.jsx("div",{className:"grid gap-3",children:e.map(r=>{const n=r.currentProgress/r.targetValue*100;return a.jsx(se,{className:`p-4 ${r.completed?"bg-green-50 border-green-300":""}`,children:a.jsxs("div",{className:"flex items-start justify-between gap-4",children:[a.jsxs("div",{className:"flex-1 space-y-2",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[r.completed?a.jsx(mr,{className:"w-5 h-5 text-green-600"}):a.jsx("div",{className:"w-5 h-5 rounded-full border-2 border-gray-300"}),a.jsx("p",{className:"font-medium",children:r.description})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsx(_t,{value:n,className:"h-2"}),a.jsxs("div",{className:"flex items-center justify-between text-xs text-muted-foreground",children:[a.jsxs("span",{children:[r.currentProgress," / ",r.targetValue]}),a.jsxs("span",{className:"flex items-center gap-1",children:[a.jsx(lr,{className:"w-3 h-3"}),r.xpReward," XP"]})]})]})]}),!r.completed&&t&&a.jsx(Y,{size:"sm",onClick:()=>t(r),children:"Start"})]})},r.id)})})]})}const nz=[{id:"avatar_scholar",name:"Scholar Avatar",description:"Wise scholar avatar frame",cost:500,category:"avatar",icon:"👨‍🎓"},{id:"avatar_master",name:"Master Avatar",description:"Master learner avatar frame",cost:1e3,category:"avatar",icon:"🧙‍♂️"},{id:"avatar_crown",name:"Crown Avatar",description:"Royal crown avatar decoration",cost:750,category:"avatar",icon:"👑"},{id:"theme_dark",name:"Dark Mode",description:"Unlock dark theme",cost:300,category:"theme",icon:"🌙"},{id:"theme_ocean",name:"Ocean Theme",description:"Calming ocean colors",cost:400,category:"theme",icon:"🌊"},{id:"theme_forest",name:"Forest Theme",description:"Nature-inspired theme",cost:400,category:"theme",icon:"🌲"}
852,{id:"bonus_advanced",name:"Advanced Lessons",description:"Unlock advanced content",cost:2e3,category:"bonus",icon:"📚"},{id:"bonus_stories",name:"Story Mode",description:"Learn through stories",cost:1500,category:"bonus",icon:"📖"},{id:"bonus_games",name:"Mini Games",description:"Fun learning games",cost:1200,category:"bonus",icon:"🎮"},{id:"bonus_hints",name:"Unlimited Hints",description:"Never get stuck",cost:800,category:"bonus",icon:"💡"}],Y_=()=>{const e=localStorage.getItem("purchased_rewards");return e?JSON.parse(e):[]},qce=(e,t)=>{const r=nz.find(s=>s.id===e);if(!r)return{success:!1,newXp:t,message:"Item not found"};const n=Y_();return n.includes(e)?{success:!1,newXp:t,message:"Already owned"}:t<r.cost?{success:!1,newXp:t,message:"Not enough XP"}:(n.push(e),localStorage.setItem("purchased_rewards",JSON.stringify(n)),{success:!0,newXp:t-r.cost,message:"Purchase successful!"})};function Gce({currentXP:e,onPurchase:t}){const[r,n]=y.useState(Y_()),{toast:s}=ta(),i=o=>{const l=qce(o,e);l.success?(n(Y_()),t(l.newXP),s({title:"Purchase Successful!",description:l.message})):s({title:"Purchase Failed",description:l.message,variant:"destructive"})};return a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(BK,{className:"w-5 h-5 text-primary"}),a.jsx("h3",{className:"text-lg font-semibold",children:"Rewards Shop"})]}),a.jsxs(ke,{variant:"secondary",className:"text-base",children:[a.jsx(An,{className:"w-4 h-4 mr-1"}),e," XP"]})]}),a.jsxs(Pn,{defaultValue:"all",children:[a.jsxs(fn,{className:"grid w-full grid-cols-4",children:[a.jsx(Oe,{value:"all",children:"All"}),a.jsx(Oe,{value:"avatar",children:"Avatars"}),a.jsx(Oe,{value:"theme",children:"Themes"}),a.jsx(Oe,{value:"bonus",children:"Bonus"})]}),["all","avatar","theme","bonus"].map(o=>a.jsx(ze,{value:o,className:"space-y-3",children:a.jsx("div",{className:"grid sm:grid-cols-2 gap-3",children:nz.filter(l=>o==="all"||l.category===o).map(l=>{const c=r.includes(l.id),u=e>=l.cost;return a.jsx(se,{className:"p-4",children:a.jsxs("div",{className:"flex gap-3",children:[a.jsx("div",{className:"text-4xl",children:l.icon}),a.jsxs("div",{className:"flex-1 space-y-2",children:[a.jsxs("div",{children:[a.jsx("h4",{className:"font-semibold",children:l.name}),a.jsx("p",{className:"text-sm text-muted-foreground",children:l.description})]}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("span",{className:"text-sm font-medium",children:[l.cost," XP"]}),c?a.jsxs(ke,{variant:"secondary",children:[a.jsx(Ri,{className:"w-3 h-3 mr-1"}),"Owned"]}):a.jsx(Y,{size:"sm",onClick:()=>i(l.id),disabled:!u,children:"Buy"})]})]})]})},l.id)})})},o))]})]})}function Kce(){const{user:e}=Jt(),[t,r]=y.useState(vi()),[n,s]=y.useState(!0),[i,o]=y.useState({xp:0,level:1,totalXp:0,streakDays:0,lastPracticeDate:null}),[l,c]=y.useState([]),[u,h]=y.useState([]),[d,f]=y.useState(!1),[m,g]=y.useState(1);y.useEffect(()=>{(async()=>{const b=vi();if(e!=null&&e.id){const{progress:w}=await Are(e.id);w&&w.length>0&&w.forEach(P=>{const C=P.letter_type==="consonant"?b.consonantMastery:b.vowelMastery;let M=C.find(I=>I.letter===P.letter);M?(M.attempts=Math.max(M.attempts,P.correct_count+P.incorrect_count),M.correct=Math.max(M.correct,P.correct_count),M.masteryLevel=Math.round(M.correct/M.attempts*100)):C.push({letter:P.letter,attempts:P.correct_count+P.incorrect_count,correct:P.correct_count,lastPracticed:P.last_practiced,masteryLevel:Math.round(P.correct_count/(P.correct_count+P.incorrect_count)*100),nextReviewDate:"",reviewInterval:0,easeFactor:2.5,reviewCount:0,retentionRate:0})});const{data:j}=await ne.from("user_gamification").select("*").eq("user_id",e.id).single();j&&o({xp:j.xp,level:j.level,totalXp:j.total_xp,streakDays:j.streak_days,lastPracticeDate:j.last_practice_date});const{data:_}=await ne.from("user_badges").select("badge_id").eq("user_id",e.id);_&&c(_.map(P=>P.badge_id));const S=new Date().toISOString().split("T")[0],{data:k}=await ne.from("daily_challenges").select("*").eq("user_id",e.id).eq("challenge_date",S);if(k)h(k.map(P=>({id:P.id,type:P.challenge_type,description:p(P.challenge_type),targetValue:P.target_value,currentProgress:P.current_progress,xpReward:P.xp_reward,completed:P.completed})));else{const P=v();for(const C of P)await ne.from("daily_challenges").insert({user_id:e.id,challenge_date:S,challenge_type:C.type,target_value:C.targetValue,xp_reward:C.xpReward});h(P)}}r(b),s(!1)})()},[e]);const p=x=>({quiz_complete:"Complete 3 quizzes",perfect_quiz:"Get a perfect score",practice_30min:"Practice for 30 minutes"})[x]||x,v=()=>[{id:"1",type:"quiz_complete",description:"Complete 3 quizzes",targetValue:3,currentProgress:0,xpReward:75,completed:!1},{id:"2",type:"perfect_quiz",description:"Get a perfect score",targetValue:1,currentProgress:0,xpReward:100,completed:!1},{id:"3",type:"practice_30min",description:"Practice for 30 minutes",targetValue:30,currentProgress:0,xpReward:50,completed:!1}];return n?a.jsxs("div",{className:"min-h-screen bg-white",children:[a.jsx(hs,{}),a.jsx("div",{className:"container mx-auto px-4 py-8",children:a.jsx("p",{children:"Loading progress..."})})]}):a.jsxs("div",{className:"min-h-screen bg-white",children:[a.jsx(hs,{}),a.jsxs("div",{className:"container mx-auto px-4 py-8 space-y-8",children:[a.jsxs("div",{className:"text-center",children:[a.jsx("h1",{className:"text-4xl font-bold mb-2",children:"Your Progress"}),a.jsxs("p",{className:"text-gray-600",children:["Track your Malayalam learning journey",e?" (synced across devices)":""]})]}),e&&a.jsx(se,{className:"p-6 bg-gradient-to-r from-purple-50 to-blue-50",children:a.jsx(Sce,{currentXP:i.xp,level:i.level})}),a.jsxs(Pn,{defaultValue:"progress",className:"w-full",children:[a.jsxs(fn,{className:"grid w-full grid-cols-4",children:[a.jsx(Oe,{value:"progress",children:"Progress"}),a.jsx(Oe,{value:"badges",children:"Badges"}),a.jsx(Oe,{value:"challenges",children:"Challenges"}),a.jsx(Oe,{value:"shop",children:"Shop"})]}),a.jsxs(ze,{value:"progress",className:"space-y-6",children:[a.jsx(xce,{stats:t}),a.jsx(bce,{stats:t}),a.jsxs("div",{className:"grid md:grid-cols-2 gap-6",children:[a.jsxs(se,{className:"p-6",children:[a.jsx("h3",{className:"text-xl font-semibold mb-4",children:"Consonant Mastery"}),a.jsx("div",{className:"grid grid-cols-6 gap-2",children:t.consonantMastery.slice(0,36).map((x,b)=>a.jsx("div",{className:`p-2 rounded text-center text-xl font-bold ${x.masteryLevel>=80?"bg-green-100":x.masteryLevel>=50?"bg-yellow-100":"bg-gray-100"}`,children:x.letter},b))})]}),a.jsxs(se,{className:"p-6",children:[a.jsx("h3",{className:"text-xl font-semibold mb-4",children:"Vowel Mastery"}
852),a.jsx("div",{className:"grid grid-cols-5 gap-2",children:t.vowelMastery.slice(0,15).map((x,b)=>a.jsx("div",{className:`p-2 rounded text-center text-xl font-bold ${x.masteryLevel>=80?"bg-green-100":x.masteryLevel>=50?"bg-yellow-100":"bg-gray-100"}`,children:x.letter},b))})]})]})]}),a.jsx(ze,{value:"badges",children:a.jsx(se,{className:"p-6",children:a.jsx(Vce,{earnedBadges:l})})}),a.jsx(ze,{value:"challenges",children:a.jsx(se,{className:"p-6",children:a.jsx(Hce,{challenges:u})})}),a.jsx(ze,{value:"shop",children:a.jsx(se,{className:"p-6",children:a.jsx(Gce,{currentXP:i.totalXp,onPurchase:x=>o({...i,totalXp:x})})})})]})]}),a.jsx(ob,{}),a.jsx(Wce,{open:d,onClose:()=>f(!1),newLevel:m})]})}const JP=({letters:e,category:t,onStartReview:r})=>{const n=i=>i===1?{text:"1 day",color:"bg-red-100 text-red-800"}:i===3?{text:"3 days",color:"bg-orange-100 text-orange-800"}:i===7?{text:"1 week",color:"bg-yellow-100 text-yellow-800"}:i===14?{text:"2 weeks",color:"bg-green-100 text-green-800"}:{text:`${i} days`,color:"bg-blue-100 text-blue-800"},s=i=>{const o=new Date,l=new Date(i),c=o.getTime()-l.getTime();return Math.ceil(c/(1e3*60*60*24))};return a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("h3",{className:"text-lg font-semibold",children:[t==="consonant"?"Consonants":"Vowels"," Due for Review (",e.length,")"]}),e.length>0&&a.jsx("button",{onClick:()=>r(e),className:"px-4 py-2 bg-primary text-white rounded-lg hover:bg-primary/90",children:"Start Review"})]}),a.jsx("div",{className:"grid gap-3",children:e.slice(0,10).map(i=>{const o=n(i.reviewInterval),l=s(i.nextReviewDate);return a.jsx(se,{className:"p-4",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-4",children:[a.jsx("div",{className:"text-4xl font-bold",children:i.letter}),a.jsxs("div",{className:"space-y-1",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(ke,{className:o.color,children:o.text}),l>0&&a.jsxs(ke,{variant:"destructive",children:[l," day",l>1?"s":""," overdue"]})]}),a.jsxs("div",{className:"flex items-center gap-4 text-sm text-muted-foreground",children:[a.jsxs("span",{className:"flex items-center gap-1",children:[a.jsx(ja,{className:"w-4 h-4"}),i.masteryLevel,"% mastery"]}),a.jsxs("span",{className:"flex items-center gap-1",children:[a.jsx(nh,{className:"w-4 h-4"}),i.reviewCount," reviews"]})]})]})]}),a.jsx("div",{className:"text-right text-sm text-muted-foreground",children:a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx(rh,{className:"w-4 h-4"}),"Next: ",i.nextReviewDate]})})]})},i.letter)})})]})};function Yce(){const[e,t]=y.useState({consonants:[],vowels:[],total:0});y.useEffect(()=>{const i=vi(),o=Ole(i.consonantMastery,i.vowelMastery);t(o)},[]);const r=i=>{console.log("Starting review for:",i)},s=(()=>{const i=vi(),o=[...i.consonantMastery,...i.vowelMastery],l=new Date().toISOString().split("T")[0];return o.filter(c=>c.nextReviewDate>l).sort((c,u)=>c.nextReviewDate.localeCompare(u.nextReviewDate)).slice(0,5)})();return a.jsxs("div",{className:"min-h-screen flex flex-col bg-gradient-to-b from-blue-50 to-white",children:[a.jsx(hs,{}),a.jsx("main",{className:"flex-1 container mx-auto px-4 py-8",children:a.jsxs("div",{className:"max-w-6xl mx-auto space-y-8",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"text-4xl font-bold mb-2",children:"Review Queue"}),a.jsx("p",{className:"text-muted-foreground",children:"Practice letters that are due for review based on spaced repetition"})]}),a.jsxs("div",{className:"grid md:grid-cols-3 gap-4",children:[a.jsx(se,{className:"p-6",children:a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(cn,{className:"w-8 h-8 text-red-500"}),a.jsxs("div",{children:[a.jsx("div",{className:"text-2xl font-bold",children:e.total}),a.jsx("div",{className:"text-sm text-muted-foreground",children:"Due Today"})]})]})}),a.jsx(se,{className:"p-6",children:a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(nh,{className:"w-8 h-8 text-orange-500"}),a.jsxs("div",{children:[a.jsx("div",{className:"text-2xl font-bold",children:s.length}),a.jsx("div",{className:"text-sm text-muted-foreground",children:"Upcoming"})]})]})}),a.jsx(se,{className:"p-6",children:a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(ot,{className:"w-8 h-8 text-green-500"}),a.jsxs("div",{children:[a.jsx("div",{className:"text-2xl font-bold",children:vi().consonantMastery.length+vi().vowelMastery.length}),a.jsx("div",{className:"text-sm text-muted-foreground",children:"Total Learned"})]})]})})]}),e.total===0?a.jsxs(se,{className:"p-12 text-center",children:[a.jsx(ot,{className:"w-16 h-16 text-green-500 mx-auto mb-4"}),a.jsx("h2",{className:"text-2xl font-bold mb-2",children:"All Caught Up!"}),a.jsx("p",{className:"text-muted-foreground",children:"No letters are due for review today. Come back tomorrow!"})]}):a.jsxs("div",{className:"space-y-8",children:[e.consonants.length>0&&a.jsx(JP,{letters:e.consonants,category:"consonant",onStartReview:r}),e.vowels.length>0&&a.jsx(JP,{letters:e.vowels,category:"vowel",onStartReview:r})]})]})}),a.jsx(ob,{})]})}function db(e){const t=y.useRef({value:e,previous:e});return y.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var hb="Switch",[Xce]=Cr(hb),[Qce,Jce]=Xce(hb),az=y.forwardRef((e,t)=>
852{const{__scopeSwitch:r,name:n,checked:s,defaultChecked:i,required:o,disabled:l,value:c="on",onCheckedChange:u,form:h,...d}=e,[f,m]=y.useState(null),g=$e(t,w=>m(w)),p=y.useRef(!1),v=f?h||!!f.closest("form"):!0,[x,b]=ln({prop:s,defaultProp:i??!1,onChange:u,caller:hb});return a.jsxs(Qce,{scope:r,checked:x,disabled:l,children:[a.jsx(Ce.button,{type:"button",role:"switch","aria-checked":x,"aria-required":o,"data-state":lz(x),"data-disabled":l?"":void 0,disabled:l,value:c,...d,ref:g,onClick:ye(e.onClick,w=>{b(j=>!j),v&&(p.current=w.isPropagationStopped(),p.current||w.stopPropagation())})}),v&&a.jsx(oz,{control:f,bubbles:!p.current,name:n,value:c,checked:x,required:o,disabled:l,form:h,style:{transform:"translateX(-100%)"}})]})});az.displayName=hb;var sz="SwitchThumb",iz=y.forwardRef((e,t)=>{const{__scopeSwitch:r,...n}=e,s=Jce(sz,r);return a.jsx(Ce.span,{"data-state":lz(s.checked),"data-disabled":s.disabled?"":void 0,...n,ref:t})});iz.displayName=sz;var Zce="SwitchBubbleInput",oz=y.forwardRef(({__scopeSwitch:e,control:t,checked:r,bubbles:n=!0,...s},i)=>{const o=y.useRef(null),l=$e(o,i),c=db(r),u=A0(t);return y.useEffect(()=>{const h=o.current;if(!h)return;const d=window.HTMLInputElement.prototype,m=Object.getOwnPropertyDescriptor(d,"checked").set;if(c!==r&&m){const g=new Event("click",{bubbles:n});m.call(h,r),h.dispatchEvent(g)}},[c,r,n]),a.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:r,...s,tabIndex:-1,ref:l,style:{...s.style,...u,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});oz.displayName=Zce;function lz(e){return e?"checked":"unchecked"}var cz=az,eue=iz;const _n=y.forwardRef(({className:e,...t},r)=>a.jsx(cz,{className:je("peer inline-flex h-5 w-10 shrink-0 cursor-pointer items-center rounded-full border border-transparent transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",e),...t,ref:r,children:a.jsx(eue,{className:je("pointer-events-none block h-4 w-4 rounded-full bg-background shadow-md ring-0 transition-transform duration-200 ease-in-out data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0.5 data-[state=checked]:bg-white")})}));_n.displayName=cz.displayName;var tue=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],rue=tue.reduce((e,t)=>{const r=V0(`Primitive.${t}`),n=y.forwardRef((s,i)=>{const{asChild:o,...l}=s,c=o?r:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),a.jsx(c,{...l,ref:i})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{}),nue="Label",uz=y.forwardRef((e,t)=>a.jsx(rue.label,{...e,ref:t,onMouseDown:r=>{var s;r.target.closest("button, input, select, textarea")||((s=e.onMouseDown)==null||s.call(e,r),!r.defaultPrevented&&r.detail>1&&r.preventDefault())}}));uz.displayName=nue;var dz=uz;const aue=kp("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",{variants:{variant:{default:"text-foreground",muted:"text-muted-foreground",accent:"text-primary"},size:{default:"text-sm",xs:"text-xs",sm:"text-sm",lg:"text-base"}},defaultVariants:{variant:"default",size:"default"}}),Re=y.forwardRef(({className:e,variant:t,size:r,...n},s)=>a.jsx(dz,{ref:s,className:je(aue({variant:t,size:r}),e),...n}));Re.displayName=dz.displayName;const sue=(e,t)=>{const n={again:0,hard:2,good:4,easy:5}[t],{interval:s,easeFactor:i}=vF(e.reviewInterval,e.easeFactor,n),o=new Date;return o.setDate(o.getDate()+s),{...e,reviewInterval:s,easeFactor:i,reviewCount:e.reviewCount+1,lastPracticed:new Date().toISOString(),nextReviewDate:o.toISOString().split("T")[0],attempts:e.attempts+1,correct:t!=="again"?e.correct+1:e.correct,masteryLevel:Math.round((t!=="again"?e.correct+1:e.correct)/(e.attempts+1)*100)}},iue=({letters:e,category:t,onComplete:r})=>{const[n,s]=y.useState(0),[i,o]=y.useState(!1),[l,c]=y.useState([]),u=e[n],h=(n+l.length)/e.length*100;y.useEffect(()=>{const f=m=>{!i&&m.key===" "?(m.preventDefault(),o(!0)):i&&(m.key==="1"?d("again"):m.key==="2"?d("hard"):m.key==="3"?d("good"):m.key==="4"&&d("easy"))};return window.addEventListener("keydown",f),()=>window.removeEventListener("keydown",f)},[i,n]);const d=f=>{const m=sue(u,f);c([...l,m]),n<e.length-1?(s(n+1),o(!1)):r([...l,m])};return a.jsxs("div",{className:"max-w-2xl mx-auto p-6 space-y-6",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex justify-between text-sm",children:[a.jsxs("span",{children:[n+1," / ",e.length]}),a.jsxs("span",{children:[Math.round(h),"% Complete"]})]}),a.jsx(_t,{value:h})]}),a.jsx(se,{className:`relative h-96 cursor-pointer transition-transform ${i?"scale-105":""}`,onClick:()=>!i&&o(!0),children:a.jsx("div",{className:"h-full flex flex-col items-center justify-center p-8",children:i?a.jsxs("div",{className:"w-full space-y-6",children:[a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"text-6xl mb-4",children:u.letter}),a.jsxs(ke,{children:["Mastery: ",u.masteryLevel,"%"]})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[a.jsx(Y,{variant:"destructive",onClick:()=>d("again"),children:"Again (1)"}),a.jsx(Y,{variant:"secondary",onClick:()=>d("hard"),children:"Hard (2)"}),a.jsx(Y,{variant:"default",onClick:()=>d("good"),children:"Good (3)"}),a.jsx(Y,{variant:"default",className:"bg-green-600",onClick:()=>d("easy"),children:"Easy (4)"})]})]}):a.jsxs("div",{className:"text-center space-y-4",children:[a.jsx("div",{className:"text-8xl font-bold",children:u.letter}),a.jsxs(Y,{variant:"ghost",onClick:f=>{f.stopPropagation(),Fr(u.letter,t)},children:[a.jsx(Xe,{className:"mr-2"})," Play Audio"]}),a.jsx("p",{className:"text-muted-foreground",children:"Click or press Space to reveal"})]})})})]})};function oue(){const[e,t]=y.useState(!1),[r,n]=y.useState("consonant"),[s,i]=y.useState(!1),[o,l]=y.useState([]),c=vi(),u=new Date().toISOString().split("T")[0],h=v=>v.filter(x=>x.nextReviewDate<=u),d=v=>{const x=new Date;return x.setDate(x.getDate()+7),v.filter(b=>b.nextReviewDate>u&&b.nextReviewDate<=x.toISOString().split("T")[0])},f=v=>{const x=v==="consonant"?c.consonantMastery:c.vowelMastery;let b=h(x);s&&(b=[...b,...d(x)]),l(b),n(v),t(!0)},m=v=>{const x=vi(),b=r==="consonant"?x.consonantMastery:x.vowelMastery;v.forEach(w=>{const j=b.findIndex(_=>_.letter===w.letter);j>=0&&(b[j]=w)}),localStorage.setItem("malayalam_progress",JSON.stringify(x)),t(!1)};if(e)return a.jsx(iue,{letters:o,category:r,onComplete:m});
vendor: 21,308 bytes, line 852
852const g=h(c.consonantMastery).length,p=h(c.vowelMastery).length;return a.jsxs("div",{className:"container mx-auto p-6 max-w-4xl space-y-6",children:[a.jsxs("div",{className:"text-center space-y-2",children:[a.jsx("h1",{className:"text-4xl font-bold",children:"Flashcard Study"}),a.jsx("p",{className:"text-muted-foreground",children:"Review letters using spaced repetition"})]}),a.jsxs("div",{className:"flex items-center space-x-2 justify-center",children:[a.jsx(_n,{checked:s,onCheckedChange:i,id:"upcoming"}),a.jsx(Re,{htmlFor:"upcoming",children:"Include upcoming reviews (next 7 days)"})]}),a.jsxs("div",{className:"grid md:grid-cols-2 gap-6",children:[a.jsxs(se,{children:[a.jsx(_e,{children:a.jsxs(Se,{className:"flex items-center gap-2",children:[a.jsx(wa,{className:"w-5 h-5"}),"Consonants"]})}),a.jsxs(ue,{className:"space-y-4",children:[a.jsxs("div",{className:"flex justify-between items-center",children:[a.jsx("span",{children:"Due for review:"}),a.jsx(ke,{variant:g>0?"destructive":"secondary",children:g})]}),a.jsx(Y,{className:"w-full",onClick:()=>f("consonant"),disabled:g===0&&!s,children:"Start Study Session"})]})]}),a.jsxs(se,{children:[a.jsx(_e,{children:a.jsxs(Se,{className:"flex items-center gap-2",children:[a.jsx(rh,{className:"w-5 h-5"}),"Vowels"]})}),a.jsxs(ue,{className:"space-y-4",children:[a.jsxs("div",{className:"flex justify-between items-center",children:[a.jsx("span",{children:"Due for review:"}),a.jsx(ke,{variant:p>0?"destructive":"secondary",children:p})]}),a.jsx(Y,{className:"w-full",onClick:()=>f("vowel"),disabled:p===0&&!s,children:"Start Study Session"})]})]})]})]})}function lue(e){const t=cue(e),r=y.forwardRef((n,s)=>{const{children:i,...o}=n,l=y.Children.toArray(i),c=l.find(due);if(c){const u=c.props.children,h=l.map(d=>d===c?y.Children.count(u)>1?y.Children.only(null):y.isValidElement(u)?u.props.children:null:d);return a.jsx(t,{...o,ref:s,children:y.isValidElement(u)?y.cloneElement(u,void 0,h):null})}return a.jsx(t,{...o,ref:s,children:i})});return r.displayName=`${e}.Slot`,r}function cue(e){const t=y.forwardRef((r,n)=>{const{children:s,...i}=r;if(y.isValidElement(s)){const o=fue(s),l=hue(i,s.props);return s.type!==y.Fragment&&(l.ref=n?Js(n,o):o),y.cloneElement(s,l)}return y.Children.count(s)>1?y.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var uue=Symbol("radix.slottable");function due(e){return y.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===uue}function hue(e,t){const r={...t};for(const n in t){const s=e[n],i=t[n];/^on[A-Z]/.test(n)?s&&i?r[n]=(...l)=>{const c=i(...l);return s(...l),c}:s&&(r[n]=s):n==="style"?r[n]={...s,...i}:n==="className"&&(r[n]=[s,i].filter(Boolean).join(" "))}return{...e,...r}}function fue(e){var n,s;let t=(n=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:n.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=(s=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:s.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}var mue=[" ","Enter","ArrowUp","ArrowDown"],pue=[" ","Enter"],hc="Select",[fb,mb,gue]=eh(hc),[hh]=Cr(hc,[gue,al]),pb=al(),[yue,ll]=hh(hc),[vue,xue]=hh(hc),hz=e=>{const{__scopeSelect:t,children:r,open:n,defaultOpen:s,onOpenChange:i,value:o,defaultValue:l,onValueChange:c,dir:u,name:h,autoComplete:d,disabled:f,required:m,form:g}=e,p=pb(t),[v,x]=y.useState(null),[b,w]=y.useState(null),[j,_]=y.useState(!1),S=Pc(u),[k,P]=ln({prop:n,defaultProp:s??!1,onChange:i,caller:hc}),[C,M]=ln({prop:o,defaultProp:l,onChange:c,caller:hc}),I=y.useRef(null),E=v?g||!!v.closest("form"):!0,[B,A]=y.useState(new Set),L=Array.from(B).map(W=>W.props.value).join(";");return a.jsx(P0,{...p,children:a.jsxs(yue,{required:m,scope:t,trigger:v,onTriggerChange:x,valueNode:b,onValueNodeChange:w,valueNodeHasChildren:j,onValueNodeHasChildrenChange:_,contentId:Tn(),value:C,onValueChange:M,open:k,onOpenChange:P,dir:S,triggerPointerDownPosRef:I,disabled:f,children:[a.jsx(fb.Provider,{scope:t,children:a.jsx(vue,{scope:e.__scopeSelect,onNativeOptionAdd:y.useCallback(W=>{A(D=>new Set(D).add(W))},[]),onNativeOptionRemove:y.useCallback(W=>{A(D=>{const U=new Set(D);return U.delete(W),U})},[]),children:r})}),E?a.jsxs(Iz,{"aria-hidden":!0,required:m,tabIndex:-1,name:h,autoComplete:d,value:C,onChange:W=>M(W.target.value),disabled:f,form:g,children:[C===void 0?a.jsx("option",{value:""}):null,Array.from(B)]},L):null]})})};hz.displayName=hc;var fz="SelectTrigger",mz=y.forwardRef((e,t)=>{const{__scopeSelect:r,disabled:n=!1,...s}=e,i=pb(r),o=ll(fz,r),l=o.disabled||n,c=$e(t,o.onTriggerChange),u=mb(r),h=y.useRef("touch"),[d,f,m]=Lz(p=>{const v=u().filter(w=>!w.disabled),x=v.find(w=>w.value===o.value),b=Fz(v,p,x);b!==void 0&&o.onValueChange(b.value)}),g=p=>{l||(o.onOpenChange(!0),m()),p&&(o.triggerPointerDownPosRef.current={x:Math.round(p.pageX),y:Math.round(p.pageY)})};return a.jsx(Pp,{asChild:!0,...i,children:a.jsx(Ce.button,{type:"button",role:"combobox","aria-controls":o.contentId,"aria-expanded":o.open,"aria-required":o.required,"aria-autocomplete":"none",dir:o.dir,"data-state":o.open?"open":"closed",disabled:l,"data-disabled":l?"":void 0,"data-placeholder":Dz(o.value)?"":void 0,...s,ref:c,onClick:ye(s.onClick,p=>{p.currentTarget.focus(),h.current!=="mouse"&&g(p)}),onPointerDown:ye(s.onPointerDown,p=>{h.current=p.pointerType;const v=p.target;v.hasPointerCapture(p.pointerId)&&v.releasePointerCapture(p.pointerId),p.button===0&&p.ctrlKey===!1&&p.pointerType==="mouse"&&(g(p),p.preventDefault())}),onKeyDown:ye(s.onKeyDown,p=>{const v=d.current!=="";!(p.ctrlKey||p.altKey||p.metaKey)&&p.key.length===1&&f(p.key),!(v&&p.key===" ")&&mue.includes(p.key)&&(g(),p.preventDefault())})})})});mz.displayName=fz;var pz="SelectValue",gz=y.forwardRef((e,t)=>{const{__scopeSelect:r,className:n,style:s,children:i,placeholder:o="",...l}=e,c=ll(pz,r),{onValueNodeHasChildrenChange:u}=c,h=i!==void 0,d=$e(t,c.onValueNodeChange);return Qt(()=>{u(h)},[u,h]),a.jsx(Ce.span,{...l,ref:d,style:{pointerEvents:"none"},children:Dz(c.value)?a.jsx(a.Fragment,{children:o}):i})});gz.displayName=pz;var bue="SelectIcon",yz=y.forwardRef((e,t)=>{const{__scopeSelect:r,children:n,...s}=e;return a.jsx(Ce.span,{"aria-hidden":!0,...s,ref:t,children:n||"▼"})});yz.displayName=bue;var wue="SelectPortal",vz=e=>a.jsx(th,{asChild:!0,...e});vz.displayName=wue;var fc="SelectContent",xz=y.forwardRef((e,t)=>{const r=ll(fc,e.__scopeSelect),[n,s]=y.useState();if(Qt(()=>{s(new DocumentFragment)},[]),!r.open){const i=n;return i?kc.createPortal(a.jsx(bz,{scope:e.__scopeSelect,children:a.jsx(fb.Slot,{scope:e.__scopeSelect,children:a.jsx("div",{children:e.children})})}),i):null}return a.jsx(wz,{...e,ref:t})});xz.displayName=fc;var La=10,[bz,cl]=hh(fc),jue="SelectContentImpl",_ue=lue("SelectContent.RemoveScroll"),wz=y.forwardRef((e,t)=>{const{__scopeSelect:r,position:n="item-aligned",onCloseAutoFocus:s,onEscapeKeyDown:i,onPointerDownOutside:o,side:l,sideOffset:c,align:u,alignOffset:h,arrowPadding:d,collisionBoundary:f,collisionPadding:m,sticky:g,hideWhenDetached:p,avoidCollisions:v,...x}=e,b=ll(fc,r),[w,j]=y.useState(null),[_,S]=y.useState(null),k=$e(t,q=>j(q)),[P,C]=y.useState(null),[M,I]=y.useState(null),E=mb(r),[B,A]=y.useState(!1),L=y.useRef(!1);y.useEffect(()=>{if(w)return Q0(w)},[w]),X0();const W=y.useCallback(q=>{const[te,...X]=E().map(oe=>oe.ref.current),[ee]=X.slice(-1),ie=document.activeElement;for(const oe of q)if(oe===ie||(oe==null||oe.scrollIntoView({block:"nearest"}),oe===te&&_&&(_.scrollTop=0),oe===ee&&_&&(_.scrollTop=_.scrollHeight),oe==null||oe.focus(),document.activeElement!==ie))return},[E,_]),D=y.useCallback(()=>W([P,w]),[W,P,w]);y.useEffect(()=>{B&&D()},[B,D]);const{onOpenChange:U,triggerPointerDownPosRef:R}=b;y.useEffect(()=>{if(w){let q={x:0,y:0};const te=ee=>{var ie,oe;q={x:Math.abs(Math.round(ee.pageX)-(((ie=R.current)==null?void 0:ie.x)??0)),y:Math.abs(Math.round(ee.pageY)-(((oe=R.current)==null?void 0:oe.y)??0))}},X=ee=>{q.x<=10&&q.y<=10?ee.preventDefault():w.contains(ee.target)||U(!1),document.removeEventListener("pointermove",te),R.current=null};return R.current!==null&&(document.addEventListener("pointermove",te),document.addEventListener("pointerup",X,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",te),document.removeEventListener("pointerup",X,{capture:!0})}}},[w,U,R]),y.useEffect(()=>{const q=()=>U(!1);return window.addEventListener("blur",q),window.addEventListener("resize",q),()=>{window.removeEventListener("blur",q),window.removeEventListener("resize",q)}},[U]);const[Q,K]=Lz(q=>{const te=E().filter(ie=>!ie.disabled),X=te.find(ie=>ie.ref.current===document.activeElement),ee=Fz(te,q,X);ee&&setTimeout(()=>ee.ref.current.focus())}),z=y.useCallback((q,te,X)=>{const ee=!L.current&&!X;(b.value!==void 0&&b.value===te||ee)&&(C(q),ee&&(L.current=!0))},[b.value]),N=y.useCallback(()=>w==null?void 0:w.focus(),[w]),T=y.useCallback((q,te,X)=>{const ee=!L.current&&!X;(b.value!==void 0&&b.value===te||ee)&&I(q)},[b.value]),$=n==="popper"?X_:jz,V=$===X_?{side:l,sideOffset:c,align:u,alignOffset:h,arrowPadding:d,collisionBoundary:f,collisionPadding:m,sticky:g,hideWhenDetached:p,avoidCollisions:v}:{};return a.jsx(bz,{scope:r,content:w,viewport:_,onViewportChange:S,itemRefCallback:z,selectedItem:P,onItemLeave:N,itemTextRefCallback:T,focusSelectedItem:D,selectedItemText:M,position:n,isPositioned:B,searchRef:Q,children:a.jsx($p,{as:_ue,allowPinchZoom:!0,children:a.jsx(Rp,{asChild:!0,trapped:b.open,onMountAutoFocus:q=>{q.preventDefault()},onUnmountAutoFocus:ye(s,q=>{var te;(te=b.trigger)==null||te.focus({preventScroll:!0}),q.preventDefault()}),children:a.jsx(Cc,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:i,onPointerDownOutside:o,onFocusOutside:q=>q.preventDefault(),onDismiss:()=>b.onOpenChange(!1),children:a.jsx($,{role:"listbox",id:b.contentId,"data-state":b.open?"open":"closed",dir:b.dir,onContextMenu:q=>q.preventDefault(),...x,...V,onPlaced:()=>A(!0),ref:k,style:{display:"flex",flexDirection:"column",outline:"none",...x.style},onKeyDown:ye(x.onKeyDown,q=>{const te=q.ctrlKey||q.altKey||q.metaKey;if(q.key==="Tab"&&q.preventDefault(),!te&&q.key.length===1&&K(q.key),["ArrowUp","ArrowDown","Home","End"].includes(q.key)){let ee=E().filter(ie=>!ie.disabled).map(ie=>ie.ref.current);if(["ArrowUp","End"].includes(q.key)&&(ee=ee.slice().reverse()),["ArrowUp","ArrowDown"].includes(q.key)){const ie=q.target,oe=ee.indexOf(ie);ee=ee.slice(oe+1)}setTimeout(()=>W(ee)),q.preventDefault()}})})})})})})});wz.displayName=jue;var Sue="SelectItemAlignedPosition",jz=y.forwardRef((e,t)=>{const{__scopeSelect:r,onPlaced:n,...s}=e,i=ll(fc,r),o=cl(fc,r),[l,c]=y.useState(null),[u,h]=y.useState(null),d=$e(t,k=>h(k)),f=mb(r),m=y.useRef(!1),g=y.useRef(!0),{viewport:p,selectedItem:v,selectedItemText:x,focusSelectedItem:b}=o,w=y.useCallback(()=>{if(i.trigger&&i.valueNode&&l&&u&&p&&v&&x){const k=i.trigger.getBoundingClientRect(),P=u.getBoundingClientRect(),C=i.valueNode.getBoundingClientRect(),M=x.getBoundingClientRect();if(i.dir!=="rtl"){const ie=M.left-P.left,oe=C.left-ie,we=k.left-oe,O=k.width+we,F=Math.max(O,P.width),Z=window.innerWidth-La,H=jm(oe,[La,Math.max(La,Z-F)]);l.style.minWidth=O+"px",l.style.left=H+"px"}else{const ie=P.right-M.right,oe=window.innerWidth-C.right-ie,we=window.innerWidth-k.right-oe,O=k.width+we,F=Math.max(O,P.width),Z=window.innerWidth-La,H=jm(oe,[La,Math.max(La,Z-F)]);l.style.minWidth=O+"px",l.style.right=H+"px"}const I=f(),E=window.innerHeight-La*2,B=p.scrollHeight,A=window.getComputedStyle(u),L=parseInt(A.borderTopWidth,10),W=parseInt(A.paddingTop,10),D=parseInt(A.borderBottomWidth,10),U=parseInt(A.paddingBottom,10),R=L+W+B+U+D,Q=Math.min(v.offsetHeight*5,R),K=window.getComputedStyle(p),z=parseInt(K.paddingTop,10),N=parseInt(K.paddingBottom,10),T=k.top+k.height/2-La,$=E-T,V=v.offsetHeight/2,q=v.offsetTop+V,te=L+W+q,X=R-te;if(te<=T){const ie=I.length>0&&v===I[I.length-1].ref.current;l.style.bottom="0px";const oe=u.clientHeight-p.offsetTop-p.offsetHeight,we=Math.max($,V+(ie?N:0)+oe+D),O=te+we;l.style.height=O+"px"}else{const ie=I.length>0&&v===I[0].ref.current;l.style.top="0px";const we=Math.max(T,L+p.offsetTop+(ie?z:0)+V)+X;l.style.height=we+"px",p.scrollTop=te-T+p.offsetTop}l.style.margin=`${La}px 0`,l.style.minHeight=Q+"px",l.style.maxHeight=E+"px",n==null||n(),requestAnimationFrame(()=>m.current=!0)}},[f,i.trigger,i.valueNode,l,u,p,v,x,i.dir,n]);Qt(()=>w(),[w]);const[j,_]=y.useState();Qt(()=>{u&&_(window.getComputedStyle(u).zIndex)},[u]);const S=y.useCallback(k=>{k&&g.current===!0&&(w(),b==null||b(),g.current=!1)},[w,b]);return a.jsx(kue,{scope:r,contentWrapper:l,shouldExpandOnScrollRef:m,onScrollButtonChange:S,children:a.jsx("div",{ref:c,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:j},children:a.jsx(Ce.div,{...s,ref:d,style:{boxSizing:"border-box",maxHeight:"100%",...s.style}})})})});jz.displayName=Sue;var Nue="SelectPopperPosition",X_=y.forwardRef((e,t)=>{const{__scopeSelect:r,align:n="start",collisionPadding:s=La,...i}=e,o=pb(r);return a.jsx(O0,{...o,...i,ref:t,align:n,collisionPadding:s,style:{boxSizing:"border-box",...i.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)"}})});X_.displayName=Nue;var[kue,hC]=hh(fc,{}),Q_="SelectViewport",_z=y.forwardRef((e,t)=>{const{__scopeSelect:r,nonce:n,...s}=e,i=cl(Q_,r),o=hC(Q_,r),l=$e(t,i.onViewportChange),c=y.useRef(0);return a.jsxs(a.Fragment,{children:[a.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}),a.jsx(fb.Slot,{scope:r,children:a.jsx(Ce.div,{"data-radix-select-viewport":"",role:"presentation",...s,ref:l,style:{position:"relative",flex:1,overflow:"hidden auto",...s.style},onScroll:ye(s.onScroll,u=>{const h=u.currentTarget,{contentWrapper:d,shouldExpandOnScrollRef:f}=o;if(f!=null&&f.current&&d){const m=Math.abs(c.current-h.scrollTop);if(m>0){const g=window.innerHeight-La*2,p=parseFloat(d.style.minHeight),v=parseFloat(d.style.height),x=Math.max(p,v);if(x<g){const b=x+m,w=Math.min(g,b),j=b-w;d.style.height=w+"px",d.style.bottom==="0px"&&(h.scrollTop=j>0?j:0,d.style.justifyContent="flex-end")}}}c.current=h.scrollTop})})})]})});_z.displayName=Q_;var Sz="SelectGroup",[Cue,Eue]=hh(Sz),Tue=y.forwardRef((e,t)=>{const{__scopeSelect:r,...n}=e,s=Tn();return a.jsx(Cue,{scope:r,id:s,children:a.jsx(Ce.div,{role:"group","aria-labelledby":s,...n,ref:t})})});Tue.displayName=Sz;var Nz="SelectLabel",kz=y.forwardRef((e,t)=>{const{__scopeSelect:r,...n}=e,s=Eue(Nz,r);return a.jsx(Ce.div,{id:s.id,...n,ref:t})});kz.displayName=Nz;var Yv="SelectItem",[Aue,Cz]=hh(Yv),Ez=y.forwardRef((e,t)=>{const{__scopeSelect:r,value:n,disabled:s=!1,textValue:i,...o}=e,l=ll(Yv,r),c=cl(Yv,r),u=l.value===n,[h,d]=y.useState(i??""),[f,m]=y.useState(!1),g=$e(t,b=>{var w;return(w=c.itemRefCallback)==null?void 0:w.call(c,b,n,s)}),p=Tn(),v=y.useRef("touch"),x=()=>{s||(l.onValueChange(n),l.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 a.jsx(Aue,{scope:r,value:n,disabled:s,textId:p,isSelected:u,onItemTextChange:y.useCallback(b=>{d(w=>w||((b==null?void 0:b.textContent)??"").trim())},[]),children:a.jsx(fb.ItemSlot,{scope:r,value:n,disabled:s,textValue:h,children:a.jsx(Ce.div,{role:"option","aria-labelledby":p,"data-highlighted":f?"":void 0,"aria-selected":u&&f,"data-state":u?"checked":"unchecked","aria-disabled":s||void 0,"data-disabled":s?"":void 0,tabIndex:s?void 0:-1,...o,ref:g,onFocus:ye(o.onFocus,()=>m(!0)),onBlur:ye(o.onBlur,()=>m(!1)),onClick:ye(o.onClick,()=>{v.current!=="mouse"&&x()}),onPointerUp:ye(o.onPointerUp,()=>{v.current==="mouse"&&x()}),onPointerDown:ye(o.onPointerDown,b=>{v.current=b.pointerType}),onPointerMove:ye(o.onPointerMove,b=>{var w;v.current=b.pointerType,s?(w=c.onItemLeave)==null||w.call(c):v.current==="mouse"&&b.currentTarget.focus({preventScroll:!0})}),onPointerLeave:ye(o.onPointerLeave,b=>{var w;b.currentTarget===document.activeElement&&((w=c.onItemLeave)==null||w.call(c))}),onKeyDown:ye(o.onKeyDown,b=>{var j;((j=c.searchRef)==null?void 0:j.current)!==""&&b.key===" "||(pue.includes(b.key)&&x(),b.key===" "&&b.preventDefault())})})})})});Ez.displayName=Yv;var hf="SelectItemText",Tz=y.forwardRef((e,t)=>{const{__scopeSelect:r,className:n,style:s,...i}=e,o=ll(hf,r),l=cl(hf,r),c=Cz(hf,r),u=xue(hf,r),[h,d]=y.useState(null),f=$e(t,x=>d(x),c.onItemTextChange,x=>{var b;return(b=l.itemTextRefCallback)==null?void 0:b.call(l,x,c.value,c.disabled)}),m=h==null?void 0:h.textContent,g=y.useMemo(()=>a.jsx("option",{value:c.value,disabled:c.disabled,children:m},c.value),[c.disabled,c.value,m]),{onNativeOptionAdd:p,onNativeOptionRemove:v}=u;return Qt(()=>(p(g),()=>v(g)),[p,v,g]),a.jsxs(a.Fragment,{children:[a.jsx(Ce.span,{id:c.textId,...i,ref:f}),c.isSelected&&o.valueNode&&!o.valueNodeHasChildren?kc.createPortal(i.children,o.valueNode):null]})});Tz.displayName=hf;var Az="SelectItemIndicator",Pz=y.forwardRef((e,t)=>{const{__scopeSelect:r,...n}=e;return Cz(Az,r).isSelected?a.jsx(Ce.span,{"aria-hidden":!0,...n,ref:t}):null});Pz.displayName=Az;var J_="SelectScrollUpButton",Oz=y.forwardRef((e,t)=>{const r=cl(J_,e.__scopeSelect),n=hC(J_,e.__scopeSelect),[s,i]=y.useState(!1),o=$e(t,n.onScrollButtonChange);return Qt(()=>{if(r.viewport&&r.isPositioned){let l=function(){const u=c.scrollTop>0;i(u)};const c=r.viewport;return l(),c.addEventListener("scroll",l),()=>c.removeEventListener("scroll",l)}},[r.viewport,r.isPositioned]),s?a.jsx(Rz,{...e,ref:o,onAutoScroll:()=>{const{viewport:l,selectedItem:c}=r;l&&c&&(l.scrollTop=l.scrollTop-c.offsetHeight)}}):null});Oz.displayName=J_;var Z_="SelectScrollDownButton",Mz=y.forwardRef((e,t)=>{const r=cl(Z_,e.__scopeSelect),n=hC(Z_,e.__scopeSelect),[s,i]=y.useState(!1),o=$e(t,n.onScrollButtonChange);return Qt(()=>{if(r.viewport&&r.isPositioned){let l=function(){const u=c.scrollHeight-c.clientHeight,h=Math.ceil(c.scrollTop)<u;i(h)};const c=r.viewport;return l(),c.addEventListener("scroll",l),()=>c.removeEventListener("scroll",l)}},[r.viewport,r.isPositioned]),s?a.jsx(Rz,{...e,ref:o,onAutoScroll:()=>{const{viewport:l,selectedItem:c}=r;l&&c&&(l.scrollTop=l.scrollTop+c.offsetHeight)}}):null});Mz.displayName=Z_;var Rz=y.forwardRef((e,t)=>{const{__scopeSelect:r,onAutoScroll:n,...s}=e,i=cl("SelectScrollButton",r),o=y.useRef(null),l=mb(r),c=y.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return y.useEffect(()=>()=>c(),[c]),Qt(()=>{var h;const u=l().find(d=>d.ref.current===document.activeElement);(h=u==null?void 0:u.ref.current)==null||h.scrollIntoView({block:"nearest"})},[l]),a.jsx(Ce.div,{"aria-hidden":!0,...s,ref:t,style:{flexShrink:0,...s.style},onPointerDown:ye(s.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(n,50))}),onPointerMove:ye(s.onPointerMove,()=>{var u;(u=i.onItemLeave)==null||u.call(i),o.current===null&&(o.current=window.setInterval(n,50))}),onPointerLeave:ye(s.onPointerLeave,()=>{c()})})}),Pue="SelectSeparator",$z=y.forwardRef((e,t)=>{const{__scopeSelect:r,...n}=e;return a.jsx(Ce.div,{"aria-hidden":!0,...n,ref:t})});$z.displayName=Pue;var eS="SelectArrow",Oue=y.forwardRef((e,t)=>{const{__scopeSelect:r,...n}=e,s=pb(r),i=ll(eS,r),o=cl(eS,r);return i.open&&o.position==="popper"?a.jsx(M0,{...s,...n,ref:t}):null});Oue.displayName=eS;var Mue="SelectBubbleInput",Iz=y.forwardRef(({__scopeSelect:e,value:t,...r},n)=>{const s=y.useRef(null),i=$e(n,s),o=db(t);return y.useEffect(()=>{const l=s.current;if(!l)return;const c=window.HTMLSelectElement.prototype,h=Object.getOwnPropertyDescriptor(c,"value").set;if(o!==t&&h){const d=new Event("change",{bubbles:!0});h.call(l,t),l.dispatchEvent(d)}},[o,t]),a.jsx(Ce.select,{...r,style:{...QI,...r.style},ref:i,defaultValue:t})});Iz.displayName=Mue;function Dz(e){return e===""||e===void 0}function Lz(e){const t=Yt(e),r=y.useRef(""),n=y.useRef(0),s=y.useCallback(o=>{const l=r.current+o;t(l),function c(u){r.current=u,window.clearTimeout(n.current),u!==""&&(n.current=window.setTimeout(()=>c(""),1e3))}(l)},[t]),i=y.useCallback(()=>{r.current="",window.clearTimeout(n.current)},[]);return y.useEffect(()=>()=>window.clearTimeout(n.current),[]),[r,s,i]}function Fz(e,t,r){const s=t.length>1&&Array.from(t).every(u=>u===t[0])?t[0]:t,i=r?e.indexOf(r):-1;let o=Rue(e,Math.max(i,0));s.length===1&&(o=o.filter(u=>u!==r));const c=o.find(u=>u.textValue.toLowerCase().startsWith(s.toLowerCase()));return c!==r?c:void 0}function Rue(e,t){return e.map((r,n)=>e[(t+n)%e.length])}var $ue=hz,zz=mz,Iue=gz,Due=yz,Lue=vz,Bz=xz,Fue=_z,Uz=kz,Wz=Ez,zue=Tz,Bue=Pz,Vz=Oz,Hz=Mz,qz=$z;const Nr=$ue,kr=Iue,gr=y.forwardRef(({className:e,children:t,...r},n)=>a.jsxs(zz,{ref:n,className:je("flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm r
852ing-offset-background placeholder:text-muted-foreground/60 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-primary focus-visible:border-primary/50 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1 transition-colors",e),...r,children:[t,a.jsx(Due,{asChild:!0,children:a.jsx(Cp,{className:"h-4 w-4 opacity-50 transition-transform duration-200 ease-in-out group-data-[state=open]:rotate-180"})})]}));gr.displayName=zz.displayName;const Gz=y.forwardRef(({className:e,...t},r)=>a.jsx(Vz,{ref:r,className:je("flex cursor-default items-center justify-center py-1 text-muted-foreground",e),...t,children:a.jsx(xD,{className:"h-4 w-4"})}));Gz.displayName=Vz.displayName;const Kz=y.forwardRef(({className:e,...t},r)=>a.jsx(Hz,{ref:r,className:je("flex cursor-default items-center justify-center py-1 text-muted-foreground",e),...t,children:a.jsx(Cp,{className:"h-4 w-4"})}));Kz.displayName=Hz.displayName;const yr=y.forwardRef(({className:e,children:t,position:r="popper",...n},s)=>a.jsx(Lue,{children:a.jsxs(Bz,{ref:s,className:je("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border border-border/40 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 duration-200",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",e),position:r,...n,children:[a.jsx(Gz,{}),a.jsx(Fue,{className:je("p-1",r==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),a.jsx(Kz,{})]})}));yr.displayName=Bz.displayName;const Uue=y.forwardRef(({className:e,...t},r)=>a.jsx(Uz,{ref:r,className:je("py-1.5 pl-8 pr-2 text-sm font-medium text-muted-foreground",e),...t}));Uue.displayName=Uz.displayName;const Le=y.forwardRef(({className:e,children:t,...r},n)=>a.jsxs(Wz,{ref:n,className:je("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/50 focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 transition-colors",e),...r,children:[a.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:a.jsx(Bue,{children:a.jsx(Ri,{className:"h-4 w-4 text-primary"})})}),a.jsx(zue,{children:t})]}));Le.displayName=Wz.displayName;const Wue=y.forwardRef(({className:e,...t},r)=>a.jsx(qz,{ref:r,className:je("-mx-1 my-1 h-px bg-muted",e),...t}));Wue.displayName=qz.displayName;const Vue=({onRecordingComplete:e,suggestedFilename:t})=>{const[r,n]=y.useState(!1),[s,i]=y.useState(null),[o,l]=y.useState(null),c=y.useRef(null),u=y.useRef([]),h=y.useRef(null),d=y.useRef(),f=y.useRef(null),m=async()=>{try{const x=await navigator.mediaDevices.getUserMedia({audio:!0}),b=new AudioContext,w=b.createMediaStreamSource(x),j=b.createAnalyser();j.fftSize=2048,w.connect(j),f.current=j;const _=new MediaRecorder(x);c.current=_,u.current=[],_.ondataavailable=S=>u.current.push(S.data),_.onstop=()=>{const S=new Blob(u.current,{type:"audio/mp3"});i(S),l(URL.createObjectURL(S)),x.getTracks().forEach(k=>k.stop())},_.start(),n(!0),p()}catch(x){console.error("Error accessing microphone:",x)}},g=()=>{var x;(x=c.current)==null||x.stop(),n(!1),d.current&&cancelAnimationFrame(d.current)},p=()=>{const x=h.current,b=f.current;if(!x||!b)return;const w=x.getContext("2d"),j=b.frequencyBinCount,_=new Uint8Array(j),S=()=>{d.current=requestAnimationFrame(S),b.getByteTimeDomainData(_),w.fillStyle="rgb(15, 23, 42)",w.fillRect(0,0,x.width,x.height),w.lineWidth=2,w.strokeStyle="rgb(59, 130, 246)",w.beginPath();const k=x.width/j;let P=0;for(let C=0;C<j;C++){const I=_[C]/128*x.height/2;C===0?w.moveTo(P,I):w.lineTo(P,I),P+=k}w.lineTo(x.width,x.height/2),w.stroke()};S()},v=()=>{s&&e(s,t)};return a.jsxs("div",{className:"space-y-4",children:[a.jsx("canvas",{ref:h,width:600,height:100,className:"w-full border rounded"}),a.jsxs("div",{className:"flex gap-2",children:[r?a.jsxs(Y,{onClick:g,variant:"destructive",children:[a.jsx(a2,{className:"w-4 h-4 mr-2"}),"Stop"]}):a.jsxs(Y,{onClick:m,children:[a.jsx(cc,{className:"w-4 h-4 mr-2"}),"Record"]}),o&&a.jsxs(a.Fragment,{children:[a.jsxs(Y,{onClick:()=>new Audio(o).play(),variant:"outline",children:[a.jsx(Bt,{className:"w-4 h-4 mr-2"}),"Play"]}),a.jsxs(Y,{onClick:v,children:[a.jsx(as,{className:"w-4 h-4 mr-2"}),"Save"]})]})]})]})},Hue=()=>{const e=tr.match(/https:\/\/([^.]+)\.supabase\.co/);return e?e[1]:""},que=()=>{const[e,t]=y.useState(!1),[r,n]=y.useState([]),[s,i]=y.useState(null),[o,l]=y.useState("unknown"),c=async()=>{try{const{data:m,error:g}=await ne.storage.getBucket("audio-files");return g?(console.error("Bucket error:",g),l("error"),!1):(l("connected"),!0)}catch(m){return console.error("Connection error:",m),l("error"),!1}},u=async()=>
852{if(t(!0),n([]),!await c()){t(!1);return}const g=[],p=[{name:"Vowels",path:"vowels"},{name:"Consonants (Isolated)",path:"consonants/isolated"},{name:"Consonants (With A)",path:"consonants/with-a"},{name:"Matras",path:"matras"}];for(const v of p)try{const{data:x,error:b}=await ne.storage.from("audio-files").list(v.path,{limit:100,offset:0});if(b)g.push({category:v.name,path:v.path,fileCount:0,error:b.message,files:[]});else{const w=(x==null?void 0:x.filter(j=>j.name.endsWith(".mp3")))||[];g.push({category:v.name,path:v.path,fileCount:w.length,files:w.map(j=>j.name).slice(0,10)})}}catch(x){g.push({category:v.name,path:v.path,fileCount:0,error:x.message,files:[]})}n(g),t(!1)},h=async(m,g)=>{const p=`${m}/${g}`;i(p);try{const v=Bp(m,g);console.log("Playing audio from URL:",v);const x=new Audio(v);x.onended=()=>i(null),x.onerror=b=>{console.error("Audio playback error:",b),i(null),alert(`Error playing audio: ${g}
853URL: ${v}
854
855Please check:
8561. The file exists in Supabase storage
8572. The bucket is set to public
8583. CORS is properly configured`)},await x.play()}catch(v){console.error("Error playing audio:",v),i(null)}},d=()=>{const m=Hue();window.open(`https://supabase.com/dashboard/project/${m}/storage/buckets/audio-files`,"_blank")},f=()=>{gF(),$2(),alert("Audio cache cleared! Audio files will be re-fetched on next play.")};return a.jsxs(se,{className:"p-6",children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsx("h2",{className:"text-2xl font-bold",children:"Audio File Diagnostics"}),a.jsxs("div",{className:"flex items-center gap-2",children:[o==="connected"&&a.jsxs("span",{className:"flex items-center gap-1 text-green-600 text-sm",children:[a.jsx(ot,{className:"h-4 w-4"})," Connected"]}),o==="error"&&a.jsxs("span",{className:"flex items-center gap-1 text-red-600 text-sm",children:[a.jsx(cn,{className:"h-4 w-4"})," Connection Error"]})]})]}),a.jsxs("div",{className:"bg-amber-50 border border-amber-200 rounded-lg p-4 mb-4",children:[a.jsx("h3",{className:"font-semibold text-amber-800 mb-2",children:"Supabase Storage Setup Checklist:"}),a.jsxs("ul",{className:"text-sm text-amber-700 space-y-1",children:[a.jsxs("li",{children:["1. Bucket name must be: ",a.jsx("code",{className:"bg-amber-100 px-1 rounded",children:"audio-files"})]}),a.jsxs("li",{children:["2. Bucket must be set to ",a.jsx("strong",{children:"Public"})]}),a.jsxs("li",{children:["3. File structure should be:",a.jsxs("ul",{className:"ml-4 mt-1",children:[a.jsxs("li",{children:["• ",a.jsx("code",{children:"vowels/a.mp3, aa.mp3, i.mp3..."})]}),a.jsxs("li",{children:["• ",a.jsx("code",{children:"consonants/isolated/ka_isolated.mp3..."})]}),a.jsxs("li",{children:["• ",a.jsx("code",{children:"consonants/with-a/ka_with_a.mp3..."})]}),a.jsxs("li",{children:["• ",a.jsx("code",{children:"matras/matra_aa.mp3..."})]})]})]}),a.jsxs("li",{children:["4. File names use ",a.jsx("strong",{children:"underscores"})," (e.g., ka_isolated.mp3, ka_with_a.mp3)"]})]})]}),a.jsxs("div",{className:"flex gap-2 mb-6",children:[a.jsxs(Y,{onClick:u,disabled:e,children:[e?a.jsx(Fe,{className:"animate-spin mr-2 h-4 w-4"}):null,"Test Audio Files"]}),a.jsxs(Y,{variant:"outline",onClick:f,children:[a.jsx(Xt,{className:"mr-2 h-4 w-4"}),"Clear Cache"]}),a.jsxs(Y,{variant:"outline",onClick:d,children:[a.jsx(md,{className:"mr-2 h-4 w-4"}),"Open Supabase Storage"]})]}),o==="error"&&a.jsxs("div",{className:"bg-red-50 border border-red-200 rounded-lg p-4 mb-4",children:[a.jsx("h3",{className:"font-semibold text-red-800 mb-2",children:"Connection Error"}),a.jsx("p",{className:"text-sm text-red-700",children:"Could not connect to Supabase storage. Please check:"}),a.jsxs("ul",{className:"text-sm text-red-700 list-disc ml-4 mt-2",children:[a.jsx("li",{children:'The bucket "audio-files" exists in your Supabase project'}),a.jsx("li",{children:"The bucket is set to Public access"}),a.jsx("li",{children:"Your Supabase credentials are correct in src/lib/supabase.ts"})]})]}),a.jsx("div",{className:"space-y-4",children:r.map((m,g)=>a.jsxs("div",{className:"border rounded-lg p-4",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[m.fileCount>0?a.jsx(ot,{className:"text-green-500 h-5 w-5"}):a.jsx(cn,{className:"text-red-500 h-5 w-5"}),a.jsx("h3",{className:"font-bold",children:m.category}),a.jsxs("span",{className:"text-sm text-gray-500",children:["(",m.fileCount," files in ",m.path,")"]})]}),m.error&&a.jsxs("p",{className:"text-red-500 text-sm mb-2 bg-red-50 p-2 rounded",children:["Error: ",m.error]}),m.files.length>0?a.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-2",children:[m.files.map(p=>a.jsxs("div",{className:"flex items-center gap-2 text-sm bg-gray-50 rounded p-2",children:[a.jsx(Y,{size:"sm",variant:s===`${m.path}/${p}`?"default":"ghost",onClick:()=>h(m.path,p),disabled:s!==null,className:"h-8 w-8 p-0",children:a.jsx(Xe,{className:"h-4 w-4"})}),a.jsx("span",{className:"truncate text-xs",children:p})]},p)),m.fileCount>10&&a.jsxs("div",{className:"text-sm text-gray-500 col-span-full",children:["... and ",m.fileCount-10," more files"]})]}):a.jsxs("p",{className:"text-sm text-gray-500",children:["No audio files found in this directory.",m.path.includes("isolated")&&a.jsx("span",{children:" Expected files like: ka_isolated.mp3, pa_isolated.mp3"}),m.path.includes("with-a")&&a.jsx("span",{children:" Expected files like: ka_with_a.mp3, pa_with_a.mp3"}),m.path==="vowels"&&a.jsx("span",{children:" Expected files like: a.mp3, aa.mp3, i.mp3"}),m.path==="matras"&&a.jsx("span",{children:" Expected files like: matra_aa.mp3, matra_i.mp3"})]})]},g))}),r.length>0&&a.jsxs("div",{className:"mt-6 p-4 bg-blue-50 border border-blue-200 rounded-lg",children:[a.jsx("h3",{className:"font-semibold text-blue-800 mb-2",children:"Expected File Names:"}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 text-sm text-blue-700",children:[a.jsxs("div",{children:[a.jsx("strong",{children:"Consonants (36 letters):"}
858),a.jsx("p",{className:"text-xs mt-1",children:"ka, kha, ga, gha, nga, cha, chha, ja, jha, nya, ta, thha, da, dhha, nna, tha, ttha, dha, ddha, na, pa, pha, ba, bha, ma, ya, ra, la, va, sha, shha, sa, ha, lla, zha, rra"})]}),a.jsxs("div",{children:[a.jsx("strong",{children:"Vowels (13 letters):"}),a.jsx("p",{className:"text-xs mt-1",children:"a, aa, i, ii, u, uu, ri, e, ee, ai, o, oo, au"})]})]})]})]})},Je=y.forwardRef(({className:e,type:t,...r},n)=>a.jsx("input",{type:t,className:je("flex h-10 w-full rounded-md border border-border/60 bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium 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",e),ref:n,...r}));Je.displayName="Input";const Gue=()=>{var g,p;const[e,t]=y.useState("ക"),[r,n]=y.useState("consonant-with-a"),[s,i]=y.useState(null),[o,l]=y.useState(!1),[c,u]=y.useState(!1),h=async()=>{l(!0),i(null);const v={character:e,type:r,steps:[]},x=dne(e,r);if(!x){v.steps.push({name:"Character Mapping",status:"error",message:`Character "${e}" not found in mapping for type "${r}"`}),i(v),l(!1);return}v.expectedFile=x,v.steps.push({name:"Character Mapping",status:"success",message:`Expected file: ${x.supabaseFilename} in ${x.directory}`});try{const{data:w,error:j}=await ne.storage.listBuckets(),_=w==null?void 0:w.find(S=>S.name==="audio-files");j?v.steps.push({name:"Bucket Check",status:"error",message:`Error checking buckets: ${j.message}`}):_?(v.steps.push({name:"Bucket Check",status:"success",message:`Bucket "audio-files" exists (public: ${_.public})`}),v.bucketPublic=_.public):v.steps.push({name:"Bucket Check",status:"error",message:'Bucket "audio-files" not found. Please create it in Supabase Storage.'})}catch(w){v.steps.push({name:"Bucket Check",status:"warning",message:`Could not verify bucket: ${w.message}`})}try{const{data:w,error:j}=await ne.storage.from("audio-files").list(x.directory,{limit:100});if(j)v.steps.push({name:"Directory Check",status:"error",message:`Error listing directory: ${j.message}`});else{const _=w==null?void 0:w.some(S=>S.name===x.supabaseFilename);v.steps.push({name:"Directory Check",status:_?"success":"error",message:_?`File "${x.supabaseFilename}" found in directory`:`File "${x.supabaseFilename}" NOT found. Files in directory: ${(w==null?void 0:w.map(S=>S.name).slice(0,5).join(", "))||"none"}${((w==null?void 0:w.length)||0)>5?"...":""}`}),v.fileExists=_,v.filesInDir=(w==null?void 0:w.map(S=>S.name))||[]}}catch(w){v.steps.push({name:"Directory Check",status:"error",message:`Error: ${w.message}`})}const b=Bp(x.directory,x.supabaseFilename);v.publicUrl=b;try{const w=await fetch(b,{method:"HEAD"});v.steps.push({name:"URL Accessibility",status:w.ok?"success":"error",message:w.ok?`URL is accessible (status: ${w.status})`:`URL returned status ${w.status}. The bucket might not be public.`}),v.urlAccessible=w.ok}catch(w){v.steps.push({name:"URL Accessibility",status:"error",message:`Could not access URL: ${w.message}. Check CORS settings.`})}i(v),l(!1)},d=async()=>{u(!0);try{await Fr(e,{type:r,onStart:()=>console.log("Audio started"),onEnd:()=>u(!1)})}catch(v){console.error("Play error:",v),u(!1)}},f=v=>{navigator.clipboard.writeText(v)},m=v=>{switch(v){case"success":return a.jsx(ot,{className:"h-5 w-5 text-green-500"});case"error":return a.jsx(jt,{className:"h-5 w-5 text-red-500"});case"warning":return a.jsx(Qr,{className:"h-5 w-5 text-yellow-500"});default:return null}};return a.jsxs(se,{children:[a.jsx(_e,{children:a.jsx(Se,{children:"Audio Troubleshooter"})}),a.jsxs(ue,{className:"space-y-6",children:[a.jsxs("div",{className:"bg-blue-50 border border-blue-200 rounded-lg p-4",children:[a.jsx("h3",{className:"font-semibold text-blue-800 mb-2",children:"Test a specific character"}),a.jsx("p",{className:"text-sm text-blue-700 mb-4",children:"Enter a Malayalam character to diagnose why its audio might not be playing."}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium mb-1",children:"Character"}
858),a.jsx(Je,{value:e,onChange:v=>t(v.target.value),className:"text-2xl text-center",placeholder:"ക"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium mb-1",children:"Type"}),a.jsxs("select",{value:r,onChange:v=>n(v.target.value),className:"w-full border rounded-md p-2",children:[a.jsx("option",{value:"consonant-with-a",children:"Consonant (with a)"}),a.jsx("option",{value:"consonant-isolated",children:"Consonant (isolated)"}),a.jsx("option",{value:"vowel",children:"Vowel"}),a.jsx("option",{value:"matra",children:"Matra"})]})]}),a.jsxs("div",{className:"flex items-end gap-2",children:[a.jsxs(Y,{onClick:h,disabled:o||!e,children:[o?a.jsx(Fe,{className:"animate-spin mr-2 h-4 w-4"}):null,"Diagnose"]}),a.jsxs(Y,{variant:"outline",onClick:d,disabled:c||!e,children:[a.jsx(Xe,{className:"h-4 w-4 mr-2"}),"Play"]})]})]})]}),s&&a.jsxs("div",{className:"space-y-4",children:[a.jsxs("h3",{className:"font-semibold",children:['Diagnostic Results for "',s.character,'"']}),a.jsx("div",{className:"space-y-2",children:s.steps.map((v,x)=>a.jsxs("div",{className:`p-3 rounded-lg border ${v.status==="success"?"bg-green-50 border-green-200":v.status==="error"?"bg-red-50 border-red-200":"bg-yellow-50 border-yellow-200"}`,children:[a.jsxs("div",{className:"flex items-center gap-2",children:[m(v.status),a.jsx("span",{className:"font-medium",children:v.name})]}),a.jsx("p",{className:"text-sm mt-1 ml-7",children:v.message})]},x))}),s.expectedFile&&a.jsxs("div",{className:"bg-gray-50 p-4 rounded-lg",children:[a.jsx("h4",{className:"font-medium mb-2",children:"Expected File Information:"}),a.jsxs("div",{className:"text-sm space-y-1",children:[a.jsxs("p",{children:[a.jsx("strong",{children:"Supabase filename:"})," ",s.expectedFile.supabaseFilename]}),a.jsxs("p",{children:[a.jsx("strong",{children:"Directory:"})," ",s.expectedFile.directory]}),a.jsxs("p",{children:[a.jsx("strong",{children:"Full path:"})," ",s.expectedFile.directory,"/",s.expectedFile.supabaseFilename]})]})]}),s.publicUrl&&a.jsxs("div",{className:"bg-gray-50 p-4 rounded-lg",children:[a.jsx("h4",{className:"font-medium mb-2",children:"Public URL:"}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("code",{className:"text-xs bg-gray-200 p-2 rounded flex-1 overflow-x-auto",children:s.publicUrl}),a.jsx(Y,{size:"sm",variant:"ghost",onClick:()=>f(s.publicUrl),children:a.jsx(Jl,{className:"h-4 w-4"})}),a.jsx(Y,{size:"sm",variant:"ghost",onClick:()=>window.open(s.publicUrl,"_blank"),children:a.jsx(md,{className:"h-4 w-4"})})]})]}),!s.urlAccessible&&s.fileExists&&a.jsxs("div",{className:"bg-amber-50 border border-amber-200 p-4 rounded-lg",children:[a.jsx("h4",{className:"font-semibold text-amber-800 mb-2",children:"Fix Required: Make Bucket Public"}),a.jsxs("ol",{className:"text-sm text-amber-700 list-decimal ml-4 space-y-1",children:[a.jsx("li",{children:"Go to Supabase Dashboard → Storage"}),a.jsx("li",{children:'Click on the "audio-files" bucket'}),a.jsx("li",{children:"Click the settings icon (gear)"}),a.jsx("li",{children:'Enable "Public bucket"'}),a.jsx("li",{children:"Save changes"})]})]}),!s.fileExists&&s.filesInDir&&a.jsxs("div",{className:"bg-amber-50 border border-amber-200 p-4 rounded-lg",children:[a.jsx("h4",{className:"font-semibold text-amber-800 mb-2",children:"Fix Required: Upload the File"}),a.jsxs("p",{className:"text-sm text-amber-700 mb-2",children:["The file ",a.jsx("code",{className:"bg-amber-100 px-1 rounded",children:(g=s.expectedFile)==null?void 0:g.supabaseFilename})," is missing."]}),a.jsxs("p",{className:"text-sm text-amber-700",children:["Upload it to: ",a.jsxs("code",{className:"bg-amber-100 px-1 rounded",children:[(p=s.expectedFile)==null?void 0:p.directory,"/"]})]}),s.filesInDir.length>0&&a.jsxs("div",{className:"mt-2",children:[a.jsx("p",{className:"text-xs text-amber-600",children:"Files currently in directory:"}),a.jsx("p",{className:"text-xs text-amber-600",children:s.filesInDir.slice(0,10).join(", ")})]})]})]}),a.jsxs("div",{className:"bg-gray-50 border rounded-lg p-4",children:[a.jsx("h3",{className:"font-semibold mb-2",children:"Qu
858ick Reference: File Naming"}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 text-sm",children:[a.jsxs("div",{children:[a.jsx("strong",{children:"Consonants (36 total):"}),a.jsxs("ul",{className:"mt-1 space-y-0.5 text-xs",children:[a.jsxs("li",{children:["Isolated: ",a.jsx("code",{children:"ka_isolated.mp3"}),", ",a.jsx("code",{children:"kha_isolated.mp3"}),"..."]}),a.jsxs("li",{children:["With A: ",a.jsx("code",{children:"ka_with_a.mp3"}),", ",a.jsx("code",{children:"kha_with_a.mp3"}),"..."]})]})]}),a.jsxs("div",{children:[a.jsx("strong",{children:"Vowels (13 total):"}),a.jsx("ul",{className:"mt-1 space-y-0.5 text-xs",children:a.jsxs("li",{children:[a.jsx("code",{children:"a.mp3"}),", ",a.jsx("code",{children:"aa.mp3"}),", ",a.jsx("code",{children:"i.mp3"}),", ",a.jsx("code",{children:"ii.mp3"}),"..."]})})]})]}),a.jsxs("div",{className:"mt-3 text-xs text-gray-600",children:[a.jsx("strong",{children:"Note:"})," Retroflex consonants use unique names:",a.jsx("code",{className:"ml-1",children:"tta, ttha, dda, ddha, nna"})," (not ta, tha, da, dha, na)"]})]})]})]})},Jc={vowels:[{char:"അ",text:"അ",file:"a.mp3"},{char:"ആ",text:"ആ",file:"aa.mp3"},{char:"ഇ",text:"ഇ",file:"i.mp3"},{char:"ഈ",text:"ഈ",file:"ii.mp3"},{char:"ഉ",text:"ഉ",file:"u.mp3"},{char:"ഊ",text:"ഊ",file:"uu.mp3"},{char:"എ",text:"എ",file:"e.mp3"},{char:"ഏ",text:"ഏ",file:"ee.mp3"},{char:"ഐ",text:"ഐ",file:"ai.mp3"},{char:"ഒ",text:"ഒ",file:"o.mp3"},{char:"ഓ",text:"ഓ",file:"oo.mp3"},{char:"ഔ",text:"ഔ",file:"au.mp3"}],consonants:[{char:"ക",text:"ക",file:"ka.mp3"},{char:"പ",text:"പ",file:"pa.mp3"},{char:"മ",text:"മ",file:"ma.mp3"},{char:"ന",text:"ന",file:"na.mp3"},{char:"ര",text:"ര",file:"ra.mp3"},{char:"ല",text:"ല",file:"la.mp3"},{char:"വ",text:"വ",file:"va.mp3"},{char:"യ",text:"യ",file:"ya.mp3"},{char:"ത",text:"ത",file:"tha.mp3"},{char:"ച",text:"ച",file:"cha.mp3"}]},y1=async e=>{try{const{data:t}=await ne.storage.from("audio-files").createSignedUrl(e,5);return!!(t!=null&&t.signedUrl)}catch{return!1}};function Kue(){const[e,t]=y.useState(!1),[r,n]=y.useState(!1),[s,i]=y.useState(0),[o,l]=y.useState([]),[c,u]=y.useState(""),h=async()=>{n(!0),l([]),u("");const g=[...Jc.vowels,...Jc.consonants];for(let p=0;p<g.length;p++){const v=g[p],b=`${p<Jc.vowels.length?"vowels":"consonants/with-a"}/${v.file}`,w=await y1(b),j=w?!1:await y1(v.file);l(_=>[..._,{char:v.char,success:w||j}]),i((p+1)/g.length*100)}n(!1)},d=async()=>{t(!0),l([]),u("");const g=[...Jc.vowels,...Jc.consonants];for(let v=0;v<g.length;v++){const x=g[v],b=v<Jc.vowels.length?"vowels":"consonants/with-a",w=`${b}/${x.file}`;try{if(await y1(w)){l(S=>[...S,{char:x.char,success:!0,skipped:!0}]),i((v+1)/g.length*100);continue}let _=!1;try{const{data:S,error:k}=await ne.functions.invoke("generate-malayalam-audio",{body:{text:x.text,character:x.char,category:b}});if(!k&&(S!=null&&S.audioContent)){const P=Yue(S.audioContent,"audio/mp3"),{error:C}=await ne.storage.from("audio-files").upload(w,P,{upsert:!0});_=!C}}catch{}l(_?S=>[...S,{char:x.char,success:!0}]:S=>[...S,{char:x.char,success:!1}])}catch(j){console.error(`Error for ${x.char}:`,j),l(_=>[..._,{char:x.char,success:!1}])}i((v+1)/g.length*100)}const p=o.filter(v=>!v.success).length;p>0&&u(`${p} file(s) could not be generated. You can upload them manually via the Audio Admin page or Supabase dashboard.`),t(!1)},f=o.filter(g=>g.success).length,m=o.filter(g=>!g.success).length;return a.jsxs(se,{className:"p-6",children:[a.jsx("h3",{className:"text-xl font-bold mb-4",children:"Audio File Manager"}),a.jsx("p",{className:"text-sm text-gray-600 mb-4",children:"Check which audio files exist in Supabase storage, or attempt to generate missing ones."}),a.jsxs("div",{className:"flex gap-3 mb-4",children:[a.jsxs(Y,{onClick:h,disabled:e||r,variant:"outline",children:[r&&a.jsx(Fe,{className:"mr-2 h-4 w-4 animate-spin"}),"Check Existing Files"]}),a.jsxs(Y,{onClick:d,disabled:e||r,children:[e&&a.jsx(Fe,{className:"mr-2 h-4 w-4 animate-spin"}),"Generate Missing Audio"]})]}),(e||r)&&a.jsx(_t,{value:s,className:"mb-4"}),o.length>0&&a.jsxs("div",{className:"mb-3 text-sm",children:[a.jsxs("span",{className:"text-green-600 font-medium",children:[f," found"]}
858),m>0&&a.jsxs("span",{className:"text-red-600 font-medium ml-3",children:[m," missing"]})]}),c&&a.jsxs("div",{className:"flex items-start gap-2 p-3 mb-4 bg-amber-50 border border-amber-200 rounded-lg text-sm text-amber-800",children:[a.jsx(Qr,{className:"h-4 w-4 mt-0.5 flex-shrink-0"}),a.jsx("span",{children:c})]}),a.jsx("div",{className:"grid grid-cols-6 gap-2",children:o.map((g,p)=>a.jsxs("div",{className:`flex items-center gap-1 p-1 rounded ${g.skipped?"bg-blue-50":""}`,children:[g.success?a.jsx(ot,{className:"h-4 w-4 text-green-500 flex-shrink-0"}):a.jsx(jt,{className:"h-4 w-4 text-red-500 flex-shrink-0"}),a.jsx("span",{className:"text-lg",children:g.char})]},p))})]})}function Yue(e,t){const r=atob(e),n=new Uint8Array(r.length);for(let s=0;s<r.length;s++)n[s]=r.charCodeAt(s);return new Blob([n],{type:t})}const ZP=[{char:"അ",file:"a.mp3",folder:"vowels",text:"അ"},{char:"ആ",file:"aa.mp3",folder:"vowels",text:"ആ"},{char:"ഇ",file:"i.mp3",folder:"vowels",text:"ഇ"},{char:"ഈ",file:"ii.mp3",folder:"vowels",text:"ഈ"},{char:"ഉ",file:"u.mp3",folder:"vowels",text:"ഉ"},{char:"ക",file:"ka.mp3",folder:"consonants/with-a",text:"ക"},{char:"പ",file:"pa.mp3",folder:"consonants/with-a",text:"പ"},{char:"മ",file:"ma.mp3",folder:"consonants/with-a",text:"മ"},{char:"ന",file:"na.mp3",folder:"consonants/with-a",text:"ന"},{char:"ത",file:"tha.mp3",folder:"consonants/with-a",text:"ത"}],Xue=e=>{if(!("speechSynthesis"in window))return;speechSynthesis.cancel();const t=new SpeechSynthesisUtterance(e);t.lang="ml-IN",t.rate=.7;const n=speechSynthesis.getVoices().find(s=>s.lang.startsWith("ml"));n&&(t.voice=n),speechSynthesis.speak(t)};function Que(){const[e,t]=y.useState({}),[r,n]=y.useState(!1),s=async()=>{n(!0);for(const l of ZP){t(u=>({...u,[l.char]:"pending"}));const c=`${l.folder}/${l.file}`;try{const{data:u}=await ne.storage.from("audio-files").createSignedUrl(c,5);if(u!=null&&u.signedUrl)t(h=>({...h,[l.char]:"exists"}));else{const{data:h}=await ne.storage.from("audio-files").createSignedUrl(l.file,5);t(d=>({...d,[l.char]:h!=null&&h.signedUrl?"exists":"error"}))}}catch(u){console.error(`Error checking ${l.char}:`,u),t(h=>({...h,[l.char]:"error"}))}}n(!1)},i=Object.values(e).filter(l=>l==="exists"||l==="success").length,o=Object.values(e).filter(l=>l==="error").length;return a.jsxs("div",{className:"space-y-4",children:[a.jsxs(Y,{onClick:s,disabled:r,className:"w-full",children:[r?a.jsx(Fe,{className:"animate-spin mr-2 h-4 w-4"}):a.jsx(Xe,{className:"mr-2 h-4 w-4"}),"Check 10 Core Audio Files"]}),Object.keys(e).length>0&&a.jsxs("div",{className:"text-sm flex gap-4",children:[a.jsxs("span",{className:"text-green-600 font-medium",children:[i," found"]}),o>0&&a.jsxs("span",{className:"text-red-600 font-medium",children:[o," missing"]})]}),o>0&&a.jsxs("div",{className:"flex items-start gap-2 p-3 bg-amber-50 border border-amber-200 rounded-lg text-sm text-amber-800",children:[a.jsx(Qr,{className:"h-4 w-4 mt-0.5 flex-shrink-0"}),a.jsxs("span",{children:["Missing files need to be uploaded manually to the ",a.jsx("strong",{children:"audio-files"})," bucket in Supabase Storage. Use the folder structure: ",a.jsx("code",{children:"vowels/a.mp3"}),", ",a.jsx("code",{children:"consonants/with-a/ka.mp3"}),", etc."]})]}),a.jsx("div",{className:"grid grid-cols-5 gap-2",children:ZP.map(l=>a.jsxs("div",{className:"text-center p-2 border rounded cursor-pointer hover:bg-gray-50 transition-colors",onClick:()=>Xue(l.text),title:`Click to preview "${l.char}" via TTS`,children:[a.jsx("div",{className:"text-2xl mb-1",children:l.char}),e[l.char]==="exists"&&a.jsx(ot,{className:"w-4 h-4 text-green-500 mx-auto"}),e[l.char]==="success"&&a.jsx(ot,{className:"w-4 h-4 text-green-500 mx-auto"}),e[l.char]==="error"&&a.jsx(jt,{className:"w-4 h-4 text-red-500 mx-auto"}),e[l.char]==="pending"&&a.jsx(Fe,{className:"w-4 h-4 animate-spin mx-auto"})]},l.char))}),a.jsx("p",{className:"text-xs text-gray-500",children:"Click any character above to hear a browser TTS preview. For production audio, upload proper MP3 files to Supabase Storage."})]})}const Yz=({coverageData:e})=>{const t=e.reduce((s,i)=>
858s+i.total,0),r=e.reduce((s,i)=>s+i.recorded,0),n=Math.round(r/t*100);return a.jsxs("div",{className:"space-y-6",children:[a.jsxs(se,{children:[a.jsx(_e,{children:a.jsx(Se,{children:"Overall Coverage"})}),a.jsx(ue,{children:a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex justify-between text-sm",children:[a.jsxs("span",{children:[r," of ",t," files"]}),a.jsxs("span",{className:"font-bold",children:[n,"%"]})]}),a.jsx(_t,{value:n})]})})]}),e.map(s=>{const i=Math.round(s.recorded/s.total*100);return a.jsxs(se,{children:[a.jsx(_e,{children:a.jsxs("div",{className:"flex justify-between items-center",children:[a.jsx(Se,{className:"text-lg",children:s.category}),a.jsxs(ke,{variant:i===100?"default":"secondary",children:[s.recorded,"/",s.total]})]})}),a.jsxs(ue,{children:[a.jsx(_t,{value:i,className:"mb-4"}),s.missing.length>0&&a.jsxs("div",{className:"mt-4",children:[a.jsx("p",{className:"text-sm font-medium mb-2",children:"Missing Files:"}),a.jsx("div",{className:"flex flex-wrap gap-2",children:s.missing.map(o=>a.jsx(ke,{variant:"outline",className:"text-xs",children:o},o))})]})]})]},s.category)})]})};function Xz({onUploadComplete:e}){const[t,r]=y.useState([]),[n,s]=y.useState(!1),[i,o]=y.useState(!1),[l,c]=y.useState({}),[u,h]=y.useState({}),[d,f]=y.useState(null),[m,g]=y.useState(!1),p=y.useRef(null),v=y.useRef(null),x=["chh","tth","ddh","thh","shh","kh","gh","ng","ch","jh","ny","tt","dd","nn","th","dh","ph","bh","sh","ll","zh","rr","k","g","j","d","
858n","p","b","m","y","r","l","v","s","h"],b=["aa","ii","uu","ee","ai","oo","au","a","i","u","e","o"],w=["a","aa","i","ii","u","uu","ri","e","ee","ai","o","oo","au"],j=E=>{for(const B of x)if(E.startsWith(B)){const A=E.slice(B.length);if(b.includes(A))return`${B}-series`}return null},_=E=>{if(!E.endsWith(".mp3")&&!E.endsWith(".wav")&&!E.endsWith(".ogg"))return{directory:"",isValid:!1,error:"Must be audio file (.mp3, .wav, .ogg)"};const B=E.replace(/\.(mp3|wav|ogg)$/i,"").toLowerCase();if(E.includes("-isolated.mp3")||E.includes("_isolated.mp3"))return{directory:"consonants/isolated",isValid:!0};if(E.includes("-with-a.mp3")||E.includes("_with_a.mp3")||E.includes("-with_a.mp3"))return{directory:"consonants/with-a",isValid:!0};if(E.startsWith("matra-")||E.startsWith("matra_"))return{directory:"matras",isValid:!0};if(E.startsWith("word-")||E.startsWith("word_"))return{directory:"words",isValid:!0};{const A=j(B);if(A)return{directory:A,isValid:!0}}return w.includes(B)?{directory:"vowels",isValid:!0}:{directory:"",isValid:!1,error:"Invalid naming convention. See naming guide below for valid formats."}},S=E=>Array.from(E).map(B=>{const A=_(B.name);return{file:B,isValid:A.isValid,directory:A.directory,error:A.error}}),k=E=>{E.preventDefault(),s(!1);const B=S(E.dataTransfer.files);r(A=>[...A,...B])},P=E=>{if(E.target.files){const B=S(E.target.files);r(A=>[...A,...B])}},C=E=>{r(B=>B.filter((A,L)=>L!==E))},M=E=>{var B;if(d===E.name)(B=p.current)==null||B.pause(),f(null);else{const A=URL.createObjectURL(E);p.current&&(p.current.src=A,p.current.play(),f(E.name),p.current.onended=()=>f(null))}},I=async()=>{const E=t.filter(A=>A.isValid);if(E.length===0){Pe.error("No valid files to upload");return}o(!0);const B={};E.forEach(A=>B[A.file.name]="pending"),h(B);for(const A of E){h(W=>({...W,[A.file.name]:"uploading"}));const L=await Nm(A.file,A.directory,A.file.name,W=>c(D=>({...D,[A.file.name]:W})));h(W=>({...W,[A.file.name]:L.success?"success":"error"})),L.success||Pe.error(`Failed: ${A.file.name}`)}o(!1),Pe.success(`Uploaded ${E.length} files!`),e()};return a.jsxs("div",{className:"space-y-4",children:[a.jsx("audio",{ref:p,className:"hidden"}),a.jsx(se,{className:"bg-blue-50 border-blue-200",children:a.jsxs(ue,{className:"p-4",children:[a.jsxs("button",{onClick:()=>g(!m),className:"flex items-center gap-2 w-full text-left font-semibold text-blue-800",children:[a.jsx(nl,{className:"w-5 h-5"}),"File Naming Guide",a.jsx("span",{className:"ml-auto text-sm font-normal",children:m?"Click to hide":"Click to expand"})]}),m&&a.jsxs("div",{className:"mt-4 space-y-4 text-sm",children:[a.jsxs("div",{children:[a.jsx("h4",{className:"font-semibold text-blue-900 mb-1",children:"K-Series (ക combinations) → k-series/"}),a.jsx("p",{className:"text-blue-700 mb-1",children:"Consonant 'k' + vowel combinations"}),a.jsx("code",{className:"bg-blue-100 px-2 py-1 rounded text-xs block",children:"ka.mp3, kaa.mp3, ki.mp3, kii.mp3, ku.mp3, kuu.mp3, ke.mp3, kee.mp3, kai.mp3, ko.mp3, koo.mp3, kau.mp3"})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-semibold text-blue-900 mb-1",children:"CH-Series (ച combinations) → ch-series/"}),a.jsx("p",{className:"text-blue-700 mb-1",children:"Consonant 'ch' + vowel combinations"}),a.jsx("code",{className:"bg-blue-100 px-2 py-1 rounded text-xs block",children:"cha.mp3, chaa.mp3, chi.mp3, chii.mp3, chu.mp3, chuu.mp3, che.mp3, chee.mp3, chai.mp3, cho.mp3, choo.mp3, chau.mp3"})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-semibold text-blue-900 mb-1",children:"Other Consonant Series"}),a.jsx("p",{className:"text-blue-700 mb-1",children:"Each consonant has its own series folder: [consonant]-series/"}),a.jsx("code",{className:"bg-blue-100 px-2 py-1 rounded text-xs block",children:"kh-series/, g-series/, gh-series/, ng-series/, j-series/, th-series/, n-series/, p-series/, m-series/, etc."})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-semibold text-blue-900 mb-1",children:"Pure Vowels → vowels/"}),a.jsx("p",{className:"text-blue-700 mb-1",children:"Standalone vowel sounds (NOT consonant combinations)"}),a.jsx("code",{className:"bg-blue-100 px-2 py-1 rounded text-xs block",children:"a.mp3, aa.mp3, i.mp3, ii.mp3, u.mp3, uu.mp3, e.mp3, ee.mp3, ai.mp3, o.mp3, oo.mp3, au.mp3, ri.mp3"})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-semibold text-blue-900 mb-1",children:"Consonants (Isolated) → consonants/isolated/"}),a.jsx("p",{className:"text-blue-700 mb-1",children:"Use -isolated or _isolated suffix"}),a.jsx("code",{className:"bg-blue-100 px-2 py-1 rounded text-xs block",children:"ka-isolated.mp3, kha-isolated.mp3, ga-isolated.mp3, nga-isolated.mp3..."})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-semibold text-blue-900 mb-1",children:"Consonants (With Inherent A) → consonants/with-a/"}),a.jsx("p",{className:"text-blue-700 mb-1",children:"Use -with-a or _with_a suffix"}),a.jsx("code",{className:"bg-blue-100 px-2 py-1 rounded text-xs block",children:"ka-with-a.mp3, kha-with-a.mp3, ga-with-a.mp3, nga-with-a.mp3..."})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-semibold text-blue-900 mb-1",children:"Matras (Vowel Signs) → matras/"}),a.jsx("p",{className:"text-blue-700 mb-1",children:"Use matra- or matra_ prefix"}),a.jsx("code",{className:"bg-blue-100 px-2 py-1 rounded text-xs block",children:"matra-aa.mp3, matra-i.mp3, matra-ii.mp3, matra-u.mp3, matra-uu.mp3..."})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-semibold text-blue-900 mb-1",children:"Words (Example Words) → words/"}),a.jsx("p",{className:"text-blue-700 mb-1",children:"Use word- or word_ prefix with transliteration"}),a.jsx("code",{className:"bg-blue-100 px-2 py-1 rounded text-xs block",children:"word-naadu.mp3, word-nalla.mp3, word-neela.mp3, word-manassu.mp3"})]})]})]})}),a.jsxs("div",{onDrop:k,onDragOver:E=>{E.preventDefault(),s(!0)},onDragLeave:()=>s(!1),className:`border-2 border-dashed rounded-lg p-8 text-center transition-colors ${n?"border-blue-500 bg-blue-50":"border-gray-300 hover:border-gray-400"}`,children:[a.jsx(sm,{className:"w-12 h-12 mx-auto mb-4 text-gray-400"}),a.jsx("p",{className:"text-lg font-medium mb-2",children:"Drag & drop audio files here"}),a.jsx("p",{className:"text-sm text-gray-500 mb-4",children:"or"}),a.jsx(Y,{onClick:()=>{var E;
vendor: 5,665 bytes, line 858
858return(E=v.current)==null?void 0:E.click()},variant:"outline",children:"Browse Files"}),a.jsx("input",{ref:v,type:"file",multiple:!0,accept:"audio/*",onChange:P,className:"hidden"})]}),t.length>0&&a.jsx(se,{children:a.jsxs(ue,{className:"p-4 space-y-3",children:[a.jsxs("div",{className:"flex justify-between items-center",children:[a.jsxs("h3",{className:"font-semibold",children:["Files (",t.length,")"]}),a.jsx(Y,{onClick:I,disabled:i||!t.some(E=>E.isValid),children:"Upload Valid Files"})]}),t.map((E,B)=>a.jsxs("div",{className:`border rounded-lg p-3 ${E.isValid?"":"bg-red-50 border-red-200"}`,children:[a.jsxs("div",{className:"flex items-center gap-3",children:[E.isValid?a.jsx(ot,{className:"w-5 h-5 text-green-600 flex-shrink-0"}):a.jsx(cn,{className:"w-5 h-5 text-red-600 flex-shrink-0"}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("p",{className:"text-sm font-medium truncate",children:E.file.name}),E.isValid?a.jsxs("p",{className:"text-xs text-gray-500",children:["→ ",E.directory]}):a.jsx("p",{className:"text-xs text-red-600",children:E.error})]}),a.jsx(Y,{size:"sm",variant:"ghost",onClick:()=>M(E.file),disabled:i,children:d===E.file.name?a.jsx(ss,{className:"w-4 h-4"}):a.jsx(Bt,{className:"w-4 h-4"})}),a.jsx(Y,{size:"sm",variant:"ghost",onClick:()=>C(B),disabled:i,children:a.jsx(ls,{className:"w-4 h-4"})}),u[E.file.name]==="success"&&a.jsx(ot,{className:"w-5 h-5 text-green-600"}),u[E.file.name]==="error"&&a.jsx(jt,{className:"w-5 h-5 text-red-600"})]}),u[E.file.name]==="uploading"&&a.jsx(_t,{value:l[E.file.name]||0,className:"h-2 mt-2"})]},B))]})})]})}var gb="Checkbox",[Jue]=Cr(gb),[Zue,fC]=Jue(gb);function ede(e){const{__scopeCheckbox:t,checked:r,children:n,defaultChecked:s,disabled:i,form:o,name:l,onCheckedChange:c,required:u,value:h="on",internal_do_not_use_render:d}=e,[f,m]=ln({prop:r,defaultProp:s??!1,onChange:c,caller:gb}),[g,p]=y.useState(null),[v,x]=y.useState(null),b=y.useRef(!1),w=g?!!o||!!g.closest("form"):!0,j={checked:f,disabled:i,setChecked:m,control:g,setControl:p,name:l,form:o,value:h,hasConsumerStoppedPropagationRef:b,required:u,defaultChecked:Uo(s)?!1:s,isFormControl:w,bubbleInput:v,setBubbleInput:x};return a.jsx(Zue,{scope:t,...j,children:tde(d)?d(j):n})}var Qz="CheckboxTrigger",Jz=y.forwardRef(({__scopeCheckbox:e,onKeyDown:t,onClick:r,...n},s)=>{const{control:i,value:o,disabled:l,checked:c,required:u,setControl:h,setChecked:d,hasConsumerStoppedPropagationRef:f,isFormControl:m,bubbleInput:g}=fC(Qz,e),p=$e(s,h),v=y.useRef(c);return y.useEffect(()=>{const x=i==null?void 0:i.form;if(x){const b=()=>d(v.current);return x.addEventListener("reset",b),()=>x.removeEventListener("reset",b)}},[i,d]),a.jsx(Ce.button,{type:"button",role:"checkbox","aria-checked":Uo(c)?"mixed":c,"aria-required":u,"data-state":nB(c),"data-disabled":l?"":void 0,disabled:l,value:o,...n,ref:p,onKeyDown:ye(t,x=>{x.key==="Enter"&&x.preventDefault()}),onClick:ye(r,x=>{d(b=>Uo(b)?!0:!b),g&&m&&(f.current=x.isPropagationStopped(),f.current||x.stopPropagation())})})});Jz.displayName=Qz;var mC=y.forwardRef((e,t)=>{const{__scopeCheckbox:r,name:n,checked:s,defaultChecked:i,required:o,disabled:l,value:c,onCheckedChange:u,form:h,...d}=e;return a.jsx(ede,{__scopeCheckbox:r,checked:s,defaultChecked:i,disabled:l,required:o,onCheckedChange:u,name:n,form:h,value:c,internal_do_not_use_render:({isFormControl:f})=>a.jsxs(a.Fragment,{children:[a.jsx(Jz,{...d,ref:t,__scopeCheckbox:r}),f&&a.jsx(rB,{__scopeCheckbox:r})]})})});mC.displayName=gb;var Zz="CheckboxIndicator",eB=y.forwardRef((e,t)=>{const{__scopeCheckbox:r,forceMount:n,...s}=e,i=fC(Zz,r);return a.jsx(vr,{present:n||Uo(i.checked)||i.checked===!0,children:a.jsx(Ce.span,{"data-state":nB(i.checked),"data-disabled":i.disabled?"":void 0,...s,ref:t,style:{pointerEvents:"none",...e.style}})})});eB.displayName=Zz;var tB="CheckboxBubbleInput",rB=y.forwardRef(({__scopeCheckbox:e,...t},r)=>{const{control:n,hasConsumerStoppedPropagationRef:s,checked:i,defaultChecked:o,required:l,disabled:c,name:u,value:h,form:d,bubbleInput:f,setBubbleInput:m}=fC(tB,e),g=$e(r,m),p=db(i),v=A0(n);y.useEffect(()=>{const b=f;if(!b)return;const w=window.HTMLInputElement.prototype,_=Object.getOwnPropertyDescriptor(w,"checked").set,S=!s.current;if(p!==i&&_){const k=new Event("click",{bubbles:S});b.indeterminate=Uo(i),_.call(b,Uo(i)?!1:i),b.dispatchEvent(k)}},[f,p,i,s]);const x=y.useRef(Uo(i)?!1:i);return a.jsx(Ce.input,{type:"checkbox","aria-hidden":!0,defaultChecked:o??x.current,required:l,disabled:c,name:u,value:h,form:d,...t,tabIndex:-1,ref:g,style:{...t.style,...v,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});rB.displayName=tB;function tde(e){return typeof e=="function"}function Uo(e){return e==="indeterminate"}function nB(e){return Uo(e)?"indeterminate":e?"checked":"unchecked"}const pC=y.forwardRef(({className:e,...t},r)=>a.jsx(mC,{ref:r,className:je("peer h-4 w-4 shrink-0 rounded-sm border border-primary/60 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground transition-colors duration-200",e),...t,children:a.jsx(eB,{className:je("flex items-center justify-center text-current"),children:a.jsx(Ri,{className:"h-3.5 w-3.5 transition-transform duration-200"})})}));pC.displayName=mC.displayName;function zg(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}
vendor: 4,793 bytes, lines 858-868
858var aB={exports:{}};/*!
859
860JSZip v3.10.1 - A JavaScript class for generating and reading zip files
861<http://stuartk.com/jszip>
862
863(c) 2009-2016 Stuart Knightley <stuart [at] stuartk.com>
864Dual licenced under the MIT license or GPLv3. See https://raw.github.com/Stuk/jszip/main/LICENSE.markdown.
865
866JSZip uses the library pako released under the MIT license :
867https://github.com/nodeca/pako/blob/main/LICENSE
868*/(function(e,t){(function(r){e.exports=r()})(function(){return function r(n,s,i){function o(u,h){if(!s[u]){if(!n[u]){var d=typeof zg=="function"&&zg;if(!h&&d)return d(u,!0);if(l)return l(u,!0);var f=new Error("Cannot find module '"+u+"'");throw f.code="MODULE_NOT_FOUND",f}var m=s[u]={exports:{}};n[u][0].call(m.exports,function(g){var p=n[u][1][g];return o(p||g)},m,m.exports,r,n,s,i)}return s[u].exports}for(var l=typeof zg=="function"&&zg,c=0;c<i.length;c++)o(i[c]);return o}({1:[function(r,n,s){var i=r("./utils"),o=r("./support"),l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";s.encode=function(c){for(var u,h,d,f,m,g,p,v=[],x=0,b=c.length,w=b,j=i.getTypeOf(c)!=="string";x<c.length;)w=b-x,d=j?(u=c[x++],h=x<b?c[x++]:0,x<b?c[x++]:0):(u=c.charCodeAt(x++),h=x<b?c.charCodeAt(x++):0,x<b?c.charCodeAt(x++):0),f=u>>2,m=(3&u)<<4|h>>4,g=1<w?(15&h)<<2|d>>6:64,p=2<w?63&d:64,v.push(l.charAt(f)+l.charAt(m)+l.charAt(g)+l.charAt(p));return v.join("")},s.decode=function(c){var u,h,d,f,m,g,p=0,v=0,x="data:";if(c.substr(0,x.length)===x)throw new Error("Invalid base64 input, it looks like a data url.");var b,w=3*(c=c.replace(/[^A-Za-z0-9+/=]/g,"")).length/4;if(c.charAt(c.length-1)===l.charAt(64)&&w--,c.charAt(c.length-2)===l.charAt(64)&&w--,w%1!=0)throw new Error("Invalid base64 input, bad content length.");for(b=o.uint8array?new Uint8Array(0|w):new Array(0|w);p<c.length;)u=l.indexOf(c.charAt(p++))<<2|(f=l.indexOf(c.charAt(p++)))>>4,h=(15&f)<<4|(m=l.indexOf(c.charAt(p++)))>>2,d=(3&m)<<6|(g=l.indexOf(c.charAt(p++))),b[v++]=u,m!==64&&(b[v++]=h),g!==64&&(b[v++]=d);return b}},{"./support":30,"./utils":32}],2:[function(r,n,s){var i=r("./external"),o=r("./stream/DataWorker"),l=r("./stream/Crc32Probe"),c=r("./stream/DataLengthProbe");function u(h,d,f,m,g){this.compressedSize=h,this.uncompressedSize=d,this.crc32=f,this.compression=m,this.compressedContent=g}u.prototype={getContentWorker:function(){var h=new o(i.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new c("data_length")),d=this;return h.on("end",function(){if(this.streamInfo.data_length!==d.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),h},getCompressedWorker:function(){return new o(i.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},u.createWorkerFrom=function(h,d,f){return h.pipe(new l).pipe(new c("uncompressedSize")).pipe(d.compressWorker(f)).pipe(new c("compressedSize")).withStreamInfo("compression",d)},n.exports=u},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(r,n,s){var i=r("./stream/GenericWorker");s.STORE={magic:"\0\0",compressWorker:function(){return new i("STORE compression")},uncompressWorker:function(){return new i("STORE decompression")}},s.DEFLATE=r("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(r,n,s){var i=r("./utils"),o=function(){for(var l,c=[],u=0;u<256;u++){l=u;for(var h=0;h<8;h++)l=1&l?3988292384^l>>>1:l>>>1;c[u]=l}return c}();n.exports=function(l,c){return l!==void 0&&l.length?i.getTypeOf(l)!=="string"?function(u,h,d,f){var m=o,g=f+d;u^=-1;for(var p=f;p<g;p++)u=u>>>8^m[255&(u^h[p])];return-1^u}(0|c,l,l.length,0):function(u,h,d,f){var m=o,g=f+d;u^=-1;for(var p=f;p<g;p++)u=u>>>8^m[255&(u^h.charCodeAt(p))];return-1^u}(0|c,l,l.length,0):0}},{"./utils":32}],5:[function(r,n,s){s.base64=!1,s.binary=!1,s.dir=!1,s.createFolders=!0,s.date=null,s.compression=null,s.compressionOptions=null,s.comment=null,s.unixPermissions=null,s.dosPermissions=null},{}],6:[function(r,n,s){var i=null;i=typeof Promise<"u"?Promise:r("lie"),n.exports={Promise:i}},{lie:37}],7:[function(r,n,s){var i=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",o=r("pako"),l=r("./utils"),c=r("./stream/GenericWorker"),u=i?"uint8array":"array";function h(d,f){c.call(this,"FlateWorker/"+d),this._pako=null,this._pakoAction=d,this._pakoOptions=f,this.meta={}}s.magic="\b\0",l.inherits(h,c),h.prototype.processChunk=function(d){this.meta=d.meta,this._pako===null&&this._createPako(),this._pako.push(l.transformTo(u,d.data),!1)},h.prototype.flush=function(){c.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)}
vendor: 4,736 bytes, lines 868-869
868,h.prototype.cleanUp=function(){c.prototype.cleanUp.call(this),this._pako=null},h.prototype._createPako=function(){this._pako=new o[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var d=this;this._pako.onData=function(f){d.push({data:f,meta:d.meta})}},s.compressWorker=function(d){return new h("Deflate",d)},s.uncompressWorker=function(){return new h("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(r,n,s){function i(m,g){var p,v="";for(p=0;p<g;p++)v+=String.fromCharCode(255&m),m>>>=8;return v}function o(m,g,p,v,x,b){var w,j,_=m.file,S=m.compression,k=b!==u.utf8encode,P=l.transformTo("string",b(_.name)),C=l.transformTo("string",u.utf8encode(_.name)),M=_.comment,I=l.transformTo("string",b(M)),E=l.transformTo("string",u.utf8encode(M)),B=C.length!==_.name.length,A=E.length!==M.length,L="",W="",D="",U=_.dir,R=_.date,Q={crc32:0,compressedSize:0,uncompressedSize:0};g&&!p||(Q.crc32=m.crc32,Q.compressedSize=m.compressedSize,Q.uncompressedSize=m.uncompressedSize);var K=0;g&&(K|=8),k||!B&&!A||(K|=2048);var z=0,N=0;U&&(z|=16),x==="UNIX"?(N=798,z|=function($,V){var q=$;return $||(q=V?16893:33204),(65535&q)<<16}(_.unixPermissions,U)):(N=20,z|=function($){return 63&($||0)}(_.dosPermissions)),w=R.getUTCHours(),w<<=6,w|=R.getUTCMinutes(),w<<=5,w|=R.getUTCSeconds()/2,j=R.getUTCFullYear()-1980,j<<=4,j|=R.getUTCMonth()+1,j<<=5,j|=R.getUTCDate(),B&&(W=i(1,1)+i(h(P),4)+C,L+="up"+i(W.length,2)+W),A&&(D=i(1,1)+i(h(I),4)+E,L+="uc"+i(D.length,2)+D);var T="";return T+=`
869\0`,T+=i(K,2),T+=S.magic,T+=i(w,2),T+=i(j,2),T+=i(Q.crc32,4),T+=i(Q.compressedSize,4),T+=i(Q.uncompressedSize,4),T+=i(P.length,2),T+=i(L.length,2),{fileRecord:d.LOCAL_FILE_HEADER+T+P+L,dirRecord:d.CENTRAL_FILE_HEADER+i(N,2)+T+i(I.length,2)+"\0\0\0\0"+i(z,4)+i(v,4)+P+L+I}}var l=r("../utils"),c=r("../stream/GenericWorker"),u=r("../utf8"),h=r("../crc32"),d=r("../signature");function f(m,g,p,v){c.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=g,this.zipPlatform=p,this.encodeFileName=v,this.streamFiles=m,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}l.inherits(f,c),f.prototype.push=function(m){var g=m.meta.percent||0,p=this.entriesCount,v=this._sources.length;this.accumulate?this.contentBuffer.push(m):(this.bytesWritten+=m.data.length,c.prototype.push.call(this,{data:m.data,meta:{currentFile:this.currentFile,percent:p?(g+100*(p-v-1))/p:100}}))},f.prototype.openedSource=function(m){this.currentSourceOffset=this.bytesWritten,this.currentFile=m.file.name;var g=this.streamFiles&&!m.file.dir;if(g){var p=o(m,g,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:p.fileRecord,meta:{percent:0}})}else this.accumulate=!0},f.prototype.closedSource=function(m){this.accumulate=!1;var g=this.streamFiles&&!m.file.dir,p=o(m,g,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(p.dirRecord),g)this.push({data:function(v){return d.DATA_DESCRIPTOR+i(v.crc32,4)+i(v.compressedSize,4)+i(v.uncompressedSize,4)}(m),meta:{percent:100}});else for(this.push({data:p.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},f.prototype.flush=function(){for(var m=this.bytesWritten,g=0;g<this.dirRecords.length;g++)this.push({data:this.dirRecords[g],meta:{percent:100}});var p=this.bytesWritten-m,v=function(x,b,w,j,_){var S=l.transformTo("string",_(j));return d.CENTRAL_DIRECTORY_END+"\0\0\0\0"+i(x,2)+i(x,2)+i(b,4)+i(w,4)+i(S.length,2)+S}(this.dirRecords.length,p,m,this.zipComment,this.encodeFileName);this.push({data:v,meta:{percent:100}})},f.prototype.prepareNextSource=function(){this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused?this.previous.pause():this.previous.resume()},f.prototype.registerPrevious=function(m){this._sources.push(m);var g=this;return m.on("data",function(p){g.processChunk(p)}),m.on("end",function(){g.closedSource(g.previous.streamInfo),g._sources.length?g.prepareNextSource():g.end()}),m.on("error",function(p){g.error(p)}),this},f.prototype.resume=function(){return!!c.prototype.resume.call(this)&&(!this.previous&&this._sources.length?(this.prepareNextSource(),!0):this.previous||this._sources.length||this.generatedError?void 0:(this.end(),!0))},f.prototype.error=function(m){var g=this._sources;if(!c.prototype.error.call(this,m))return!1;for(var p=0;p<g.length;p++)try{g[p].error(m)}catch{}return!0},f.prototype.lock=function(){c.prototype.lock.call(this);for(var m=this._sources,g=0;g<m.length;g++)m[g].lock()},n.exports=f},{"../crc32":4,"../signature":23,"../stream/GenericWorker":28,"../utf8":31,"../utils":32}
vendor: 29,087 bytes, line 869
869],9:[function(r,n,s){var i=r("../compressions"),o=r("./ZipFileWorker");s.generateWorker=function(l,c,u){var h=new o(c.streamFiles,u,c.platform,c.encodeFileName),d=0;try{l.forEach(function(f,m){d++;var g=function(b,w){var j=b||w,_=i[j];if(!_)throw new Error(j+" is not a valid compression method !");return _}(m.options.compression,c.compression),p=m.options.compressionOptions||c.compressionOptions||{},v=m.dir,x=m.date;m._compressWorker(g,p).withStreamInfo("file",{name:f,dir:v,date:x,comment:m.comment||"",unixPermissions:m.unixPermissions,dosPermissions:m.dosPermissions}).pipe(h)}),h.entriesCount=d}catch(f){h.error(f)}return h}},{"../compressions":3,"./ZipFileWorker":8}],10:[function(r,n,s){function i(){if(!(this instanceof i))return new i;if(arguments.length)throw new Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide.");this.files=Object.create(null),this.comment=null,this.root="",this.clone=function(){var o=new i;for(var l in this)typeof this[l]!="function"&&(o[l]=this[l]);return o}}(i.prototype=r("./object")).loadAsync=r("./load"),i.support=r("./support"),i.defaults=r("./defaults"),i.version="3.10.1",i.loadAsync=function(o,l){return new i().loadAsync(o,l)},i.external=r("./external"),n.exports=i},{"./defaults":5,"./external":6,"./load":11,"./object":15,"./support":30}],11:[function(r,n,s){var i=r("./utils"),o=r("./external"),l=r("./utf8"),c=r("./zipEntries"),u=r("./stream/Crc32Probe"),h=r("./nodejsUtils");function d(f){return new o.Promise(function(m,g){var p=f.decompressed.getContentWorker().pipe(new u);p.on("error",function(v){g(v)}).on("end",function(){p.streamInfo.crc32!==f.decompressed.crc32?g(new Error("Corrupted zip : CRC32 mismatch")):m()}).resume()})}n.exports=function(f,m){var g=this;return m=i.extend(m||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:l.utf8decode}),h.isNode&&h.isStream(f)?o.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")):i.prepareContent("the loaded zip file",f,!0,m.optimizedBinaryString,m.base64).then(function(p){var v=new c(m);return v.load(p),v}).then(function(p){var v=[o.Promise.resolve(p)],x=p.files;if(m.checkCRC32)for(var b=0;b<x.length;b++)v.push(d(x[b]));return o.Promise.all(v)}).then(function(p){for(var v=p.shift(),x=v.files,b=0;b<x.length;b++){var w=x[b],j=w.fileNameStr,_=i.resolve(w.fileNameStr);g.file(_,w.decompressed,{binary:!0,optimizedBinaryString:!0,date:w.date,dir:w.dir,comment:w.fileCommentStr.length?w.fileCommentStr:null,unixPermissions:w.unixPermissions,dosPermissions:w.dosPermissions,createFolders:m.createFolders}),w.dir||(g.file(_).unsafeOriginalName=j)}return v.zipComment.length&&(g.comment=v.zipComment),g})}},{"./external":6,"./nodejsUtils":14,"./stream/Crc32Probe":25,"./utf8":31,"./utils":32,"./zipEntries":33}],12:[function(r,n,s){var i=r("../utils"),o=r("../stream/GenericWorker");function l(c,u){o.call(this,"Nodejs stream input adapter for "+c),this._upstreamEnded=!1,this._bindStream(u)}i.inherits(l,o),l.prototype._bindStream=function(c){var u=this;(this._stream=c).pause(),c.on("data",function(h){u.push({data:h,meta:{percent:0}})}).on("error",function(h){u.isPaused?this.generatedError=h:u.error(h)}).on("end",function(){u.isPaused?u._upstreamEnded=!0:u.end()})},l.prototype.pause=function(){return!!o.prototype.pause.call(this)&&(this._stream.pause(),!0)},l.prototype.resume=function(){return!!o.prototype.resume.call(this)&&(this._upstreamEnded?this.end():this._stream.resume(),!0)},n.exports=l},{"../stream/GenericWorker":28,"../utils":32}],13:[function(r,n,s){var i=r("readable-stream").Readable;function o(l,c,u){i.call(this,c),this._helper=l;var h=this;l.on("data",function(d,f){h.push(d)||h._helper.pause(),u&&u(f)}).on("error",function(d){h.emit("error",d)}).on("end",function(){h.push(null)})}r("../utils").inherits(o,i),o.prototype._read=function(){this._helper.resume()},n.exports=o},{"../utils":32,"readable-stream":16}],14:[function(r,n,s){n.exports={isNode:typeof Buffer<"u",newBufferFrom:function(i,o){if(Buffer.from&&Buffer.from!==Uint8Array.from)return Buffer.from(i,o);if(typeof i=="number")throw new Error('The "data" argument must not be a number');return new Buffer(i,o)},allocBuffer:function(i){if(Buffer.alloc)return Buffer.alloc(i);var o=new Buffer(i);return o.fill(0),o},isBuffer:function(i){return Buffer.isBuffer(i)},isStream:function(i){return i&&typeof i.on=="function"&&typeof i.pause=="function"&&typeof i.resume=="function"}}},{}],15:[function(r,n,s){function i(_,S,k){var P,C=l.getTypeOf(S),M=l.extend(k||{},h);M.date=M.date||new Date,M.compression!==null&&(M.compression=M.compression.toUpperCase()),typeof M.unixPermissions=="string"&&(M.unixPermissions=parseInt(M.unixPermissions,8)),M.unixPermissions&&16384&M.unixPermissions&&(M.dir=!0),M.dosPermissions&&16&M.dosPermissions&&(M.dir=!0),M.dir&&(_=x(_)),M.createFolders&&(P=v(_))&&b.call(this,P,!0);var I=C==="string"&&M.binary===!1&&M.base64===!1;k&&k.binary!==void 0||(M.binary=!I),(S instanceof d&&S.uncompressedSize===0||M.dir||!S||S.length===0)&&(M.base64=!1,M.binary=!0,S="",M.compression="STORE",C="string");var E=null;E=S instanceof d||S instanceof c?S:g.isNode&&g.isStream(S)?new p(_,S):l.prepareContent(_,S,M.binary,M.optimizedBinaryString,M.base64);var B=new f(_,E,M);this.files[_]=B}var o=r("./utf8"),l=r("./utils"),c=r("./stream/GenericWorker"),u=r("./stream/StreamHelper"),h=r("./defaults"),d=r("./compressedObject"),f=r("./zipObject"),m=r("./generate"),g=r("./nodejsUtils"),p=r("./nodejs/NodejsStreamInputAdapter"),v=function(_){_.slice(-1)==="/"&&(_=_.substring(0,_.length-1));var S=_.lastIndexOf("/");return 0<S?_.substring(0,S):""},x=function(_){return _.slice(-1)!=="/"&&(_+="/"),_},b=function(_,S){return S=S!==void 0?S:h.createFolders,_=x(_),this.files[_]||i.call(this,_,null,{dir:!0,createFolders:S}),this.files[_]};function w(_){return Object.prototype.toString.call(_)==="[object RegExp]"}var j={load:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function(_){var S,k,P;for(S in this.files)P=this.files[S],(k=S.slice(this.root.length,S.length))&&S.slice(0,this.root.length)===this.root&&_(k,P)},filter:function(_){var S=[];return this.forEach(function(k,P){_(k,P)&&S.push(P)}),S},file:function(_,S,k){if(arguments.length!==1)return _=this.root+_,i.call(this,_,S,k),this;if(w(_)){var P=_;return this.filter(function(M,I){return!I.dir&&P.test(M)})}var C=this.files[this.root+_];return C&&!C.dir?C:null},folder:function(_){if(!_)return this;if(w(_))return this.filter(function(C,M){return M.dir&&_.test(C)});var S=this.root+_,k=b.call(this,S),P=this.clone();return P.root=k.name,P},remove:function(_){_=this.root+_;var S=this.files[_];if(S||(_.slice(-1)!=="/"&&(_+="/"),S=this.files[_]),S&&!S.dir)delete this.files[_];else for(var k=this.filter(function(C,M){return M.name.slice(0,_.length)===_}),P=0;P<k.length;P++)delete this.files[k[P].name];return this},generate:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},generateInternalStream:function(_){var S,k={};try{if((k=l.extend(_||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:o.utf8encode})).type=k.type.toLowerCase(),k.compression=k.compression.toUpperCase(),k.type==="binarystring"&&(k.type="string"),!k.type)throw new Error("No output type specified.");l.checkSupport(k.type),k.platform!=="darwin"&&k.platform!=="freebsd"&&k.platform!=="linux"&&k.platform!=="sunos"||(k.platform="UNIX"),k.platform==="win32"&&(k.platform="DOS");var P=k.comment||this.comment||"";S=m.generateWorker(this,k,P)}catch(C){(S=new c("error")).error(C)}return new u(S,k.type||"string",k.mimeType)},generateAsync:function(_,S){return this.generateInternalStream(_).accumulate(S)},generateNodeStream:function(_,S){return(_=_||{}).type||(_.type="nodebuffer"),this.generateInternalStream(_).toNodejsStream(S)}};n.exports=j},{"./compressedObject":2,"./defaults":5,"./generate":9,"./nodejs/NodejsStreamInputAdapter":12,"./nodejsUtils":14,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31,"./utils":32,"./zipObject":35}],16:[function(r,n,s){n.exports=r("stream")},{stream:void 0}],17:[function(r,n,s){var i=r("./DataReader");function o(l){i.call(this,l);for(var c=0;c<this.data.length;c++)l[c]=255&l[c]}r("../utils").inherits(o,i),o.prototype.byteAt=function(l){return this.data[this.zero+l]},o.prototype.lastIndexOfSignature=function(l){for(var c=l.charCodeAt(0),u=l.charCodeAt(1),h=l.charCodeAt(2),d=l.charCodeAt(3),f=this.length-4;0<=f;--f)if(this.data[f]===c&&this.data[f+1]===u&&this.data[f+2]===h&&this.data[f+3]===d)return f-this.zero;return-1},o.prototype.readAndCheckSignature=function(l){var c=l.charCodeAt(0),u=l.charCodeAt(1),h=l.charCodeAt(2),d=l.charCodeAt(3),f=this.readData(4);return c===f[0]&&u===f[1]&&h===f[2]&&d===f[3]},o.prototype.readData=function(l){if(this.checkOffset(l),l===0)return[];var c=this.data.slice(this.zero+this.index,this.zero+this.index+l);return this.index+=l,c},n.exports=o},{"../utils":32,"./DataReader":18}],18:[function(r,n,s){var i=r("../utils");function o(l){this.data=l,this.length=l.length,this.index=0,this.zero=0}o.prototype={checkOffset:function(l){this.checkIndex(this.index+l)},checkIndex:function(l){if(this.length<this.zero+l||l<0)throw new Error("End of data reached (data length = "+this.length+", asked index = "+l+"). Corrupted zip ?")},setIndex:function(l){this.checkIndex(l),this.index=l},skip:function(l){this.setIndex(this.index+l)},byteAt:function(){},readInt:function(l){var c,u=0;for(this.checkOffset(l),c=this.index+l-1;c>=this.index;c--)u=(u<<8)+this.byteAt(c);return this.index+=l,u},readString:function(l){return i.transformTo("string",this.readData(l))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var l=this.readInt(4);return new Date(Date.UTC(1980+(l>>25&127),(l>>21&15)-1,l>>16&31,l>>11&31,l>>5&63,(31&l)<<1))}},n.exports=o},{"../utils":32}],19:[function(r,n,s){var i=r("./Uint8ArrayReader");function o(l){i.call(this,l)}r("../utils").inherits(o,i),o.prototype.readData=function(l){this.checkOffset(l);var c=this.data.slice(this.zero+this.index,this.zero+this.index+l);return this.index+=l,c},n.exports=o},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(r,n,s){var i=r("./DataReader");function o(l){i.call(this,l)}r("../utils").inherits(o,i),o.prototype.byteAt=function(l){return this.data.charCodeAt(this.zero+l)},o.prototype.lastIndexOfSignature=function(l){return this.data.lastIndexOf(l)-this.zero},o.prototype.readAndCheckSignature=function(l){return l===this.readData(4)},o.prototype.readData=function(l){this.checkOffset(l);var c=this.data.slice(this.zero+this.index,this.zero+this.index+l);return this.index+=l,c},n.exports=o},{"../utils":32,"./DataReader":18}],21:[function(r,n,s){var i=r("./ArrayReader");function o(l){i.call(this,l)}r("../utils").inherits(o,i),o.prototype.readData=function(l){if(this.checkOffset(l),l===0)return new Uint8Array(0);var c=this.data.subarray(this.zero+this.index,this.zero+this.index+l);return this.index+=l,c},n.exports=o},{"../utils":32,"./ArrayReader":17}],22:[function(r,n,s){var i=r("../utils"),o=r("../support"),l=r("./ArrayReader"),c=r("./StringReader"),u=r("./NodeBufferReader"),h=r("./Uint8ArrayReader");n.exports=function(d){var f=i.getTypeOf(d);return i.checkSupport(f),f!=="string"||o.uint8array?f==="nodebuffer"?new u(d):o.uint8array?new h(i.transformTo("uint8array",d)):new l(i.transformTo("array",d)):new c(d)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(r,n,s){s.LOCAL_FILE_HEADER="PK��",s.CENTRAL_FILE_HEADER="PK��",s.CENTRAL_DIRECTORY_END="PK��",s.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK�\x07",s.ZIP64_CENTRAL_DIRECTORY_END="PK��",s.DATA_DESCRIPTOR="PK\x07\b"},{}],24:[function(r,n,s){var i=r("./GenericWorker"),o=r("../utils");function l(c){i.call(this,"ConvertWorker to "+c),this.destType=c}o.inherits(l,i),l.prototype.processChunk=function(c){this.push({data:o.transformTo(this.destType,c.data),meta:c.meta})},n.exports=l},{"../utils":32,"./GenericWorker":28}],25:[function(r,n,s){var i=r("./GenericWorker"),o=r("../crc32");function l(){i.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}r("../utils").inherits(l,i),l.prototype.processChunk=function(c){this.streamInfo.crc32=o(c.data,this.streamInfo.crc32||0),this.push(c)},n.exports=l},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(r,n,s){var i=r("../utils"),o=r("./GenericWorker");function l(c){o.call(this,"DataLengthProbe for "+c),this.propName=c,this.withStreamInfo(c,0)}i.inherits(l,o),l.prototype.processChunk=function(c){if(c){var u=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=u+c.data.length}o.prototype.processChunk.call(this,c)},n.exports=l},{"../utils":32,"./GenericWorker":28}],27:[function(r,n,s){var i=r("../utils"),o=r("./GenericWorker");function l(c){o.call(this,"DataWorker");var u=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,c.then(function(h){u.dataIsReady=!0,u.data=h,u.max=h&&h.length||0,u.type=i.getTypeOf(h),u.isPaused||u._tickAndRepeat()},function(h){u.error(h)})}i.inherits(l,o),l.prototype.cleanUp=function(){o.prototype.cleanUp.call(this),this.data=null},l.prototype.resume=function(){return!!o.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,i.delay(this._tickAndRepeat,[],this)),!0)},l.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(i.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},l.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var c=null,u=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":c=this.data.substring(this.index,u);break;case"uint8array":c=this.data.subarray(this.index,u);break;case"array":case"nodebuffer":c=this.data.slice(this.index,u)}return this.index=u,this.push({data:c,meta:{percent:this.max?this.index/this.max*100:0}})},n.exports=l},{"../utils":32,"./GenericWorker":28}],28:[function(r,n,s){function i(o){this.name=o||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}i.prototype={push:function(o){this.emit("data",o)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(o){this.emit("error",o)}return!0},error:function(o){return!this.isFinished&&(this.isPaused?this.generatedError=o:(this.isFinished=!0,this.emit("error",o),this.previous&&this.previous.error(o),this.cleanUp()),!0)},on:function(o,l){return this._listeners[o].push(l),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(o,l){if(this._listeners[o])for(var c=0;c<this._listeners[o].length;c++)this._listeners[o][c].call(this,l)},pipe:function(o){return o.registerPrevious(this)},registerPrevious:function(o){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.streamInfo=o.streamInfo,this.mergeStreamInfo(),this.previous=o;var l=this;return o.on("data",function(c){l.processChunk(c)}),o.on("end",function(){l.end()}),o.on("error",function(c){l.error(c)}),this},pause:function(){return!this.isPaused&&!this.isFinished&&(this.isPaused=!0,this.previous&&this.previous.pause(),!0)},resume:function(){if(!this.isPaused||this.isFinished)return!1;var o=this.isPaused=!1;return this.generatedError&&(this.error(this.generatedError),o=!0),this.previous&&this.previous.resume(),!o},flush:function(){},processChunk:function(o){this.push(o)},withStreamInfo:function(o,l){return this.extraStreamInfo[o]=l,this.mergeStreamInfo(),this},mergeStreamInfo:function(){for(var o in this.extraStreamInfo)Object.prototype.hasOwnProperty.call(this.extraStreamInfo,o)&&(this.streamInfo[o]=this.extraStreamInfo[o])},lock:function(){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.isLocked=!0,this.previous&&this.previous.lock()},toString:function(){var o="Worker "+this.name;return this.previous?this.previous+" -> "+o:o}},n.exports=i},{}],29:[function(r,n,s){var i=r("../utils"),o=r("./ConvertWorker"),l=r("./GenericWorker"),c=r("../base64"),u=r("../support"),h=r("../external"),d=null;if(u.nodestream)try{d=r("../nodejs/NodejsStreamOutputAdapter")}catch{}function f(g,p){return new h.Promise(function(v,x){var b=[],w=g._internalType,j=g._outputType,_=g._mimeType;g.on("data",function(S,k){b.push(S),p&&p(k)}).on("error",function(S){b=[],x(S)}).on("end",function(){try{var S=function(k,P,C){switch(k){case"blob":return i.newBlob(i.transformTo("arraybuffer",P),C);case"base64":return c.encode(P);default:return i.transformTo(k,P)}}(j,function(k,P){var C,M=0,I=null,E=0;for(C=0;C<P.length;C++)E+=P[C].length;switch(k){case"string":return P.join("");case"array":return Array.prototype.concat.apply([],P);case"uint8array":for(I=new Uint8Array(E),C=0;C<P.length;C++)I.set(P[C],M),M+=P[C].length;return I;case"nodebuffer":return Buffer.concat(P);default:throw new Error("concat : unsupported type '"+k+"'")}}(w,b),_);v(S)}catch(k){x(k)}b=[]}).resume()})}function m(g,p,v){var x=p;switch(p){case"blob":case"arraybuffer":x="uint8array";break;case"base64":x="string"}try{this._internalType=x,this._outputType=p,this._mimeType=v,i.checkSupport(x),this._worker=g.pipe(new o(x)),g.lock()}catch(b){this._worker=new l("error"),this._worker.error(b)}}m.prototype={accumulate:function(g){return f(this,g)},on:function(g,p){var v=this;return g==="data"?this._worker.on(g,function(x){p.call(v,x.data,x.meta)}):this._worker.on(g,function(){i.delay(p,arguments,v)}),this},resume:function(){return i.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(g){if(i.checkSupport("nodestream"),this._outputType!=="nodebuffer")throw new Error(this._outputType+" is not supported by this method");return new d(this,{objectMode:this._outputType!=="nodebuffer"},g)}},n.exports=m},{"../base64":1,"../external":6,"../nodejs/NodejsStreamOutputAdapter":13,"../support":30,"../utils":32,"./ConvertWorker":24,"./GenericWorker":28}],30:[function(r,n,s){if(s.base64=!0,s.array=!0,s.string=!0,s.arraybuffer=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u",s.nodebuffer=typeof Buffer<"u",s.uint8array=typeof Uint8Array<"u",typeof ArrayBuffer>"u")s.blob=!1;else{var i=new ArrayBuffer(0);try{s.blob=new Blob([i],{type:"application/zip"}).size===0}catch{try{var o=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);o.append(i),s.blob=o.getBlob("application/zip").size===0}catch{s.blob=!1}}}try{s.nodestream=!!r("readable-stream").Readable}catch{s.nodestream=!1}},{"readable-stream":16}],31:[function(r,n,s){for(var i=r("./utils"),o=r("./support"),l=r("./nodejsUtils"),c=r("./stream/GenericWorker"),u=new Array(256),h=0;h<256;h++)u[h]=252<=h?6:248<=h?5:240<=h?4:224<=h?3:192<=h?2:1;u[254]=u[254]=1;function d(){c.call(this,"utf-8 decode"),this.leftOver=null}function f(){c.call(this,"utf-8 encode")}s.utf8encode=function(m){return o.nodebuffer?l.newBufferFrom(m,"utf-8"):function(g){var p,v,x,b,w,j=g.length,_=0;for(b=0;b<j;b++)(64512&(v=g.charCodeAt(b)))==55296&&b+1<j&&(64512&(x=g.charCodeAt(b+1)))==56320&&(v=65536+(v-55296<<10)+(x-56320),b++),_+=v<128?1:v<2048?2:v<65536?3:4;for(p=o.uint8array?new Uint8Array(_):new Array(_),b=w=0;w<_;b++)(64512&(v=g.charCodeAt(b)))==55296&&b+1<j&&(64512&(x=g.charCodeAt(b+1)))==56320&&(v=65536+(v-55296<<10)+(x-56320),b++),v<128?p[w++]=v:(v<2048?p[w++]=192|v>>>6:(v<65536?p[w++]=224|v>>>12:(p[w++]=240|v>>>18,p[w++]=128|v>>>12&63),p[w++]=128|v>>>6&63),p[w++]=128|63&v);return p}(m)},s.utf8decode=function(m){return o.nodebuffer?i.transformTo("nodebuffer",m).toString("utf-8"):function(g){var p,v,x,b,w=g.length,j=new Array(2*w);for(p=v=0;p<w;)if((x=g[p++])<128)j[v++]=x;else if(4<(b=u[x]))j[v++]=65533,p+=b-1;else{for(x&=b===2?31:b===3?15:7;1<b&&p<w;)x=x<<6|63&g[p++],b--;1<b?j[v++]=65533:x<65536?j[v++]=x:(x-=65536,j[v++]=55296|x>>10&1023,j[v++]=56320|1023&x)}return j.length!==v&&(j.subarray?j=j.subarray(0,v):j.length=v),i.applyFromCharCode(j)}(m=i.transformTo(o.uint8array?"uint8array":"array",m))},i.inherits(d,c),d.prototype.processChunk=function(m){var g=i.transformTo(o.uint8array?"uint8array":"array",m.data);if(this.leftOver&&this.leftOver.length){if(o.uint8array){var p=g;(g=new Uint8Array(p.length+this.leftOver.length)).set(this.leftOver,0),g.set(p,this.leftOver.length)}else g=this.leftOver.concat(g);this.leftOver=null}var v=function(b,w){var j;for((w=w||b.length)>b.length&&(w=b.length),j=w-1;0<=j&&(192&b[j])==128;)j--;return j<0||j===0?w:j+u[b[j]]>w?j:w}(g),x=g;v!==g.length&&(o.uint8array?(x=g.subarray(0,v),this.leftOver=g.subarray(v,g.length)):(x=g.slice(0,v),this.leftOver=g.slice(v,g.length))),this.push({data:s.utf8decode(x),meta:m.meta})},d.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:s.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},s.Utf8DecodeWorker=d,i.inherits(f,c),f.prototype.processChunk=function(m){this.push({data:s.utf8encode(m.data),meta:m.meta})},s.Utf8EncodeWorker=f},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(r,n,s){var i=r("./support"),o=r("./base64"),l=r("./nodejsUtils"),c=r("./external");function u(p){return p}function h(p,v){for(var x=0;x<p.length;++x)v[x]=255&p.charCodeAt(x);return v}r("setimmediate"),s.newBlob=function(p,v){s.checkSupport("blob");try{return new Blob([p],{type:v})}catch{try{var x=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);return x.append(p),x.getBlob(v)}catch{throw new Error("Bug : can't construct the Blob.")}}};var d={stringifyByChunk:function(p,v,x){var b=[],w=0,j=p.length;if(j<=x)return String.fromCharCode.apply(null,p);for(;w<j;)v==="array"||v==="nodebuffer"?b.push(String.fromCharCode.apply(null,p.slice(w,Math.min(w+x,j)))):b.push(String.fromCharCode.apply(null,p.subarray(w,Math.min(w+x,j)))),w+=x;return b.join("")},stringifyByChar:function(p){for(var v="",x=0;x<p.length;x++)v+=String.fromCharCode(p[x]);return v},applyCanBeUsed:{uint8array:function(){try{return i.uint8array&&String.fromCharCode.apply(null,new Uint8Array(1)).length===1}catch{return!1}}(),nodebuffer:function(){try{return i.nodebuffer&&String.fromCharCode.apply(null,l.allocBuffer(1)).length===1}catch{return!1}}()}};function f(p){var v=65536,x=s.getTypeOf(p),b=!0;if(x==="uint8array"?b=d.applyCanBeUsed.uint8array:x==="nodebuffer"&&(b=d.applyCanBeUsed.nodebuffer),b)for(;1<v;)try{return d.stringifyByChunk(p,x,v)}catch{v=Math.floor(v/2)}return d.stringifyByChar(p)}function m(p,v){for(var x=0;x<p.length;x++)v[x]=p[x];return v}s.applyFromCharCode=f;var g={};g.string={string:u,array:function(p){return h(p,new Array(p.length))},arraybuffer:function(p){return g.string.uint8array(p).buffer},uint8array:function(p){return h(p,new Uint8Array(p.length))},nodebuffer:function(p){return h(p,l.allocBuffer(p.length))}},g.array={string:f,array:u,arraybuffer:function(p){return new Uint8Array(p).buffer},uint8array:function(p){return new Uint8Array(p)},nodebuffer:function(p){return l.newBufferFrom(p)}},g.arraybuffer={string:function(p){return f(new Uint8Array(p))},array:function(p){return m(new Uint8Array(p),new Array(p.byteLength))},arraybuffer:u,uint8array:function(p){return new Uint8Array(p)},nodebuffer:function(p){return l.newBufferFrom(new Uint8Array(p))}},g.uint8array={string:f,array:function(p){return m(p,new Array(p.length))},arraybuffer:function(p){return p.buffer},uint8array:u,nodebuffer:function(p){return l.newBufferFrom(p)}},g.nodebuffer={string:f,array:function(p){return m(p,new Array(p.length))},arraybuffer:function(p){return g.nodebuffer.uint8array(p).buffer},uint8array:function(p){return m(p,new Uint8Array(p.length))},nodebuffer:u},s.transformTo=function(p,v){if(v=v||"",!p)return v;s.checkSupport(p);var x=s.getTypeOf(v);return g[x][p](v)},s.resolve=function(p){for(var v=p.split("/"),x=[],b=0;b<v.length;b++){var w=v[b];w==="."||w===""&&b!==0&&b!==v.length-1||(w===".."?x.pop():x.push(w))}return x.join("/")},s.getTypeOf=function(p){return typeof p=="string"?"string":Object.prototype.toString.call(p)==="[object Array]"?"array":i.nodebuffer&&l.isBuffer(p)?"nodebuffer":i.uint8array&&p instanceof Uint8Array?"uint8array":i.arraybuffer&&p instanceof ArrayBuffer?"arraybuffer":void 0},s.checkSupport=function(p){if(!i[p.toLowerCase()])throw new Error(p+" is not supported by this platform")},s.MAX_VALUE_16BITS=65535,s.MAX_VALUE_32BITS=-1,s.pretty=function(p){var v,x,b="";for(x=0;x<(p||"").length;x++)b+="\\x"+((v=p.charCodeAt(x))<16?"0":"")+v.toString(16).toUpperCase();return b},s.delay=function(p,v,x){setImmediate(function(){p.apply(x||null,v||[])})},s.inherits=function(p,v){function x(){}x.prototype=v.prototype,p.prototype=new x},s.extend=function(){var p,v,x={};for(p=0;p<arguments.length;p++)for(v in arguments[p])Object.prototype.hasOwnProperty.call(arguments[p],v)&&x[v]===void 0&&(x[v]=arguments[p][v]);return x},s.prepareContent=function(p,v,x,b,w){return c.Promise.resolve(v).then(function(j){return i.blob&&(j instanceof Blob||["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(j))!==-1)&&typeof FileReader<"u"?new c.Promise(function(_,S){var k=new FileReader;k.onload=function(P){_(P.target.result)},k.onerror=function(P){S(P.target.error)},k.readAsArrayBuffer(j)}):j}).then(function(j){var _=s.getTypeOf(j);return _?(_==="arraybuffer"?j=s.transformTo("uint8array",j):_==="string"&&(w?j=o.decode(j):x&&b!==!0&&(j=function(S){return h(S,i.uint8array?new Uint8Array(S.length):new Array(S.length))}(j))),j):c.Promise.reject(new Error("Can't read the data of '"+p+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"))})}},{"./base64":1,"./external":6,"./nodejsUtils":14,"./support":30,setimmediate:54}],33:[function(r,n,s){var i=r("./reader/readerFor"),o=r("./utils"),l=r("./signature"),c=r("./zipEntry"),u=r("./support");function h(d){this.files=[],this.loadOptions=d}h.prototype={checkSignature:function(d){if(!this.reader.readAndCheckSignature(d)){this.reader.index-=4;var f=this.reader.readString(4);throw new Error("Corrupted zip or bug: unexpected signature ("+o.pretty(f)+", expected "+o.pretty(d)+")")}},isSignature:function(d,f){var m=this.reader.index;this.reader.setIndex(d);var g=this.reader.readString(4)===f;return this.reader.setIndex(m),g},readBlockEndOfCentral:function(){this.diskNumber=this.reader.readInt(2),this.diskWithCentralDirStart=this.reader.readInt(2),this.centralDirRecordsOnThisDisk=this.reader.readInt(2),this.centralDirRecords=this.reader.readInt(2),this.centralDirSize=this.reader.readInt(4),this.centralDirOffset=this.reader.readInt(4),this.zipCommentLength=this.reader.readInt(2);var d=this.reader.readData(this.zipCommentLength),f=u.uint8array?"uint8array":"array",m=o.transformTo(f,d);this.zipComment=this.loadOptions.decodeFileName(m)},readBlockZip64EndOfCentral:function(){this.zip64EndOfCentralSize=this.reader.readInt(8),this.reader.skip(4),this.diskNumber=this.reader.readInt(4),this.diskWithCentralDirStart=this.reader.readInt(4),this.centralDirRecordsOnThisDisk=this.reader.readInt(8),this.centralDirRecords=this.reader.readInt(8),this.centralDirSize=this.reader.readInt(8),this.centralDirOffset=this.reader.readInt(8),this.zip64ExtensibleData={};for(var d,f,m,g=this.zip64EndOfCentralSize-44;0<g;)d=this.reader.readInt(2),f=this.reader.readInt(4),m=this.reader.readData(f),this.zip64ExtensibleData[d]={id:d,length:f,value:m}},readBlockZip64EndOfCentralLocator:function(){if(this.diskWithZip64CentralDirStart=this.reader.readInt(4),this.relativeOffsetEndOfZip64CentralDir=this.reader.readInt(8),this.disksCount=this.reader.readInt(4),1<this.disksCount)throw new Error("Multi-volumes zip are not supported")},readLocalFiles:function(){var d,f;for(d=0;d<this.files.length;d++)f=this.files[d],this.reader.setIndex(f.localHeaderOffset),this.checkSignature(l.LOCAL_FILE_HEADER),f.readLocalPart(this.reader),f.handleUTF8(),f.processAttributes()},readCentralDir:function(){var d;for(this.reader.setIndex(this.centralDirOffset);this.reader.readAndCheckSignature(l.CENTRAL_FILE_HEADER);)(d=new c({zip64:this.zip64},this.loadOptions)).readCentralPart(this.reader),this.files.push(d);if(this.centralDirRecords!==this.files.length&&this.centralDirRecords!==0&&this.files.length===0)throw new Error("Corrupted zip or bug: expected "+this.centralDirRecords+" records in central dir, got "+this.files.length)},readEndOfCentral:function(){var d=this.reader.lastIndexOfSignature(l.CENTRAL_DIRECTORY_END);if(d<0)throw this.isSignature(0,l.LOCAL_FILE_HEADER)?new Error("Corrupted zip: can't find end of central directory"):new Error("Can't find end of central directory : is this a zip f
869ile ? If it is, see https://stuk.github.io/jszip/documentation/howto/read_zip.html");this.reader.setIndex(d);var f=d;if(this.checkSignature(l.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===o.MAX_VALUE_16BITS||this.diskWithCentralDirStart===o.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===o.MAX_VALUE_16BITS||this.centralDirRecords===o.MAX_VALUE_16BITS||this.centralDirSize===o.MAX_VALUE_32BITS||this.centralDirOffset===o.MAX_VALUE_32BITS){if(this.zip64=!0,(d=this.reader.lastIndexOfSignature(l.ZIP64_CENTRAL_DIRECTORY_LOCATOR))<0)throw new Error("Corrupted zip: can't find the ZIP64 end of central directory locator");if(this.reader.setIndex(d),this.checkSignature(l.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,l.ZIP64_CENTRAL_DIRECTORY_END)&&(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(l.ZIP64_CENTRAL_DIRECTORY_END),this.relativeOffsetEndOfZip64CentralDir<0))throw new Error("Corrupted zip: can't find the ZIP64 end of central directory");this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir),this.checkSignature(l.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}var m=this.centralDirOffset+this.centralDirSize;this.zip64&&(m+=20,m+=12+this.zip64EndOfCentralSize);var g=f-m;if(0<g)this.isSignature(f,l.CENTRAL_FILE_HEADER)||(this.reader.zero=g);else if(g<0)throw new Error("Corrupted zip: missing "+Math.abs(g)+" bytes.")},prepareReader:function(d){this.reader=i(d)},load:function(d){this.prepareReader(d),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}},n.exports=h},{"./reader/readerFor":22,"./signature":23,"./support":30,"./utils":32,"./zipEntry":34}],34:[function(r,n,s){var i=r("./reader/readerFor"),o=r("./utils"),l=r("./compressedObject"),c=r("./crc32"),u=r("./utf8"),h=r("./compressions"),d=r("./support");function f(m,g){this.options=m,this.loadOptions=g}f.prototype={isEncrypted:function(){return(1&this.bitFlag)==1},useUTF8:function(){return(2048&this.bitFlag)==2048},readLocalPart:function(m){var g,p;if(m.skip(22),this.fileNameLength=m.readInt(2),p=m.readInt(2),this.fileName=m.readData(this.fileNameLength),m.skip(p),this.compressedSize===-1||this.uncompressedSize===-1)throw new Error("Bug or corrupted zip : didn't get enough information from the central directory (compressedSize === -1 || uncompressedSize === -1)");if((g=function(v){for(var x in h)if(Object.prototype.hasOwnProperty.call(h,x)&&h[x].magic===v)return h[x];return null}(this.compressionMethod))===null)throw new Error("Corrupted zip : compression "+o.pretty(this.compressionMethod)+" unknown (inner file : "+o.transformTo("string",this.fileName)+")");this.decompressed=new l(this.compressedSize,this.uncompressedSize,this.crc32,g,m.readData(this.compressedSize))},readCentralPart:function(m){this.versionMadeBy=m.readInt(2),m.skip(2),this.bitFlag=m.readInt(2),this.compressionMethod=m.readString(2),this.date=m.readDate(),this.crc32=m.readInt(4),this.compressedSize=m.readInt(4),this.uncompressedSize=m.readInt(4);var g=m.readInt(2);if(this.extraFieldsLength=m.readInt(2),this.fileCommentLength=m.readInt(2),this.diskNumberStart=m.readInt(2),this.internalFileAttributes=m.readInt(2),this.externalFileAttributes=m.readInt(4),this.localHeaderOffset=m.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");m.skip(g),this.readExtraFields(m),this.parseZIP64ExtraField(m),this.fileComment=m.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var m=this.versionMadeBy>>8;this.dir=!!(16&this.externalFileAttributes),m==0&&(this.dosPermissions=63&this.externalFileAttributes),m==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var m=i(this.extraFields[1].value);this.uncompressedSize===o.MAX_VALUE_32BITS&&(this.uncompressedSize=m.readInt(8)),this.compressedSize===o.MAX_VALUE_32BITS&&(this.compressedSize=m.readInt(8)),this.localHeaderOffset===o.MAX_VALUE_32BITS&&
vendor: 7,719 bytes, line 869
869(this.localHeaderOffset=m.readInt(8)),this.diskNumberStart===o.MAX_VALUE_32BITS&&(this.diskNumberStart=m.readInt(4))}},readExtraFields:function(m){var g,p,v,x=m.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});m.index+4<x;)g=m.readInt(2),p=m.readInt(2),v=m.readData(p),this.extraFields[g]={id:g,length:p,value:v};m.setIndex(x)},handleUTF8:function(){var m=d.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=u.utf8decode(this.fileName),this.fileCommentStr=u.utf8decode(this.fileComment);else{var g=this.findExtraFieldUnicodePath();if(g!==null)this.fileNameStr=g;else{var p=o.transformTo(m,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(p)}var v=this.findExtraFieldUnicodeComment();if(v!==null)this.fileCommentStr=v;else{var x=o.transformTo(m,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(x)}}},findExtraFieldUnicodePath:function(){var m=this.extraFields[28789];if(m){var g=i(m.value);return g.readInt(1)!==1||c(this.fileName)!==g.readInt(4)?null:u.utf8decode(g.readData(m.length-5))}return null},findExtraFieldUnicodeComment:function(){var m=this.extraFields[25461];if(m){var g=i(m.value);return g.readInt(1)!==1||c(this.fileComment)!==g.readInt(4)?null:u.utf8decode(g.readData(m.length-5))}return null}},n.exports=f},{"./compressedObject":2,"./compressions":3,"./crc32":4,"./reader/readerFor":22,"./support":30,"./utf8":31,"./utils":32}],35:[function(r,n,s){function i(g,p,v){this.name=g,this.dir=v.dir,this.date=v.date,this.comment=v.comment,this.unixPermissions=v.unixPermissions,this.dosPermissions=v.dosPermissions,this._data=p,this._dataBinary=v.binary,this.options={compression:v.compression,compressionOptions:v.compressionOptions}}var o=r("./stream/StreamHelper"),l=r("./stream/DataWorker"),c=r("./utf8"),u=r("./compressedObject"),h=r("./stream/GenericWorker");i.prototype={internalStream:function(g){var p=null,v="string";try{if(!g)throw new Error("No output type specified.");var x=(v=g.toLowerCase())==="string"||v==="text";v!=="binarystring"&&v!=="text"||(v="string"),p=this._decompressWorker();var b=!this._dataBinary;b&&!x&&(p=p.pipe(new c.Utf8EncodeWorker)),!b&&x&&(p=p.pipe(new c.Utf8DecodeWorker))}catch(w){(p=new h("error")).error(w)}return new o(p,v,"")},async:function(g,p){return this.internalStream(g).accumulate(p)},nodeStream:function(g,p){return this.internalStream(g||"nodebuffer").toNodejsStream(p)},_compressWorker:function(g,p){if(this._data instanceof u&&this._data.compression.magic===g.magic)return this._data.getCompressedWorker();var v=this._decompressWorker();return this._dataBinary||(v=v.pipe(new c.Utf8EncodeWorker)),u.createWorkerFrom(v,g,p)},_decompressWorker:function(){return this._data instanceof u?this._data.getContentWorker():this._data instanceof h?this._data:new l(this._data)}};for(var d=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],f=function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},m=0;m<d.length;m++)i.prototype[d[m]]=f;n.exports=i},{"./compressedObject":2,"./stream/DataWorker":27,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31}],36:[function(r,n,s){(function(i){var o,l,c=i.MutationObserver||i.WebKitMutationObserver;if(c){var u=0,h=new c(g),d=i.document.createTextNode("");h.observe(d,{characterData:!0}),o=function(){d.data=u=++u%2}}else if(i.setImmediate||i.MessageChannel===void 0)o="document"in i&&"onreadystatechange"in i.document.createElement("script")?function(){var p=i.document.createElement("script");p.onreadystatechange=function(){g(),p.onreadystatechange=null,p.parentNode.removeChild(p),p=null},i.document.documentElement.appendChild(p)}:function(){setTimeout(g,0)};else{var f=new i.MessageChannel;f.port1.onmessage=g,o=function(){f.port2.postMessage(0)}}var m=[];function g(){var p,v;l=!0;for(var x=m.length;x;){for(v=m,m=[],p=-1;++p<x;)v[p]();x=m.length}l=!1}n.exports=function(p){m.push(p)!==1||l||o()}}).call(this,typeof Co<"u"?Co:typeof self<"u"?self:typeof window<"u"?window:{})},{}],37:[function(r,n,s){var i=r("immediate");function o(){}var l={},c=["REJECTED"],u=["FULFILLED"],h=["PENDING"];function d(x){if(typeof x!="function")throw new TypeError("resolver must be a function");this.state=h,this.queue=[],this.outcome=void 0,x!==o&&p(this,x)}function f(x,b,w){this.promise=x,typeof b=="function"&&(this.onFulfilled=b,this.callFulfilled=this.otherCallFulfilled),typeof w=="function"&&(this.onRejected=w,this.callRejected=this.otherCallRejected)}function m(x,b,w){i(function(){var j;try{j=b(w)}catch(_){return l.reject(x,_)}j===x?l.reject(x,new TypeError("Cannot resolve promise with itself")):l.resolve(x,j)})}function g(x){var b=x&&x.then;if(x&&(typeof x=="object"||typeof x=="function")&&typeof b=="function")return function(){b.apply(x,arguments)}}function p(x,b){var w=!1;function j(k){w||(w=!0,l.reject(x,k))}function _(k){w||(w=!0,l.resolve(x,k))}var S=v(function(){b(_,j)});S.status==="error"&&j(S.value)}function v(x,b){var w={};try{w.value=x(b),w.status="success"}catch(j){w.status="error",w.value=j}return w}(n.exports=d).prototype.finally=function(x){if(typeof x!="function")return this;var b=this.constructor;return this.then(function(w){return b.resolve(x()).then(function(){return w})},function(w){return b.resolve(x()).then(function(){throw w})})},d.prototype.catch=function(x){return this.then(null,x)},d.prototype.then=function(x,b){if(typeof x!="function"&&this.state===u||typeof b!="function"&&this.state===c)return this;var w=new this.constructor(o);return this.state!==h?m(w,this.state===u?x:b,this.outcome):this.queue.push(new f(w,x,b)),w},f.prototype.callFulfilled=function(x){l.resolve(this.promise,x)},f.prototype.otherCallFulfilled=function(x){m(this.promise,this.onFulfilled,x)},f.prototype.callRejected=function(x){l.reject(this.promise,x)},f.prototype.otherCallRejected=function(x){m(this.promise,this.onRejected,x)},l.resolve=function(x,b){var w=v(g,b);if(w.status==="error")return l.reject(x,w.value);var j=w.value;if(j)p(x,j);else{x.state=u,x.outcome=b;for(var _=-1,S=x.queue.length;++_<S;)x.queue[_].callFulfilled(b)}return x},l.reject=function(x,b){x.state=c,x.outcome=b;for(var w=-1,j=x.queue.length;++w<j;)x.queue[w].callRejected(b);return x},d.resolve=function(x){return x instanceof this?x:l.resolve(new this(o),x)},d.reject=function(x){var b=new this(o);return l.reject(b,x)},d.all=function(x){var b=this;if(Object.prototype.toString.call(x)!=="[object Array]")return this.reject(new TypeError("must be an array"));var w=x.length,j=!1;if(!w)return this.resolve([]);for(var _=new Array(w),S=0,k=-1,P=new this(o);++k<w;)C(x[k],k);return P;function C(M,I){b.resolve(M).then(function(E){_[I]=E,++S!==w||j||(j=!0,l.resolve(P,_))},function(E){j||(j=!0,l.reject(P,E))})}},d.race=function(x){var b=this;if(Object.prototype.toString.call(x)!=="[object Array]")return this.reject(new TypeError("must be an array"));var w=x.length,j=!1;if(!w)return this.resolve([]);for(var _=-1,S=new this(o);++_<w;)k=x[_],b.resolve(k).then(function(P){j||(j=!0,l.resolve(S,P))},function(P){j||(j=!0,l.reject(S,P))});var k;return S}},{immediate:36}],38:[function(r,n,s){var i={};(0,r("./lib/utils/common").assign)(i,r("./lib/deflate"),r("./lib/inflate"),r("./lib/zlib/constants")),n.exports=i},{"./lib/deflate":39,"./lib/inflate":40,"./lib/utils/common":41,"./lib/zlib/constants":44}],39:[function(r,n,s){var i=r("./zlib/deflate"),o=r("./utils/common"),l=r("./utils/strings"),c=r("./zlib/messages"),u=r("./zlib/zstream"),h=Object.prototype.toString,d=0,f=-1,m=0,g=8;function p(x){if(!(this instanceof p))return new p(x);this.options=o.assign({level:f,method:g,chunkSize:16384,windowBits:15,memLevel:8,strategy:m,to:""},x||{});var b=this.options;
vendor: 4,869 bytes, line 869
869b.raw&&0<b.windowBits?b.windowBits=-b.windowBits:b.gzip&&0<b.windowBits&&b.windowBits<16&&(b.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new u,this.strm.avail_out=0;var w=i.deflateInit2(this.strm,b.level,b.method,b.windowBits,b.memLevel,b.strategy);if(w!==d)throw new Error(c[w]);if(b.header&&i.deflateSetHeader(this.strm,b.header),b.dictionary){var j;if(j=typeof b.dictionary=="string"?l.string2buf(b.dictionary):h.call(b.dictionary)==="[object ArrayBuffer]"?new Uint8Array(b.dictionary):b.dictionary,(w=i.deflateSetDictionary(this.strm,j))!==d)throw new Error(c[w]);this._dict_set=!0}}function v(x,b){var w=new p(b);if(w.push(x,!0),w.err)throw w.msg||c[w.err];return w.result}p.prototype.push=function(x,b){var w,j,_=this.strm,S=this.options.chunkSize;if(this.ended)return!1;j=b===~~b?b:b===!0?4:0,typeof x=="string"?_.input=l.string2buf(x):h.call(x)==="[object ArrayBuffer]"?_.input=new Uint8Array(x):_.input=x,_.next_in=0,_.avail_in=_.input.length;do{if(_.avail_out===0&&(_.output=new o.Buf8(S),_.next_out=0,_.avail_out=S),(w=i.deflate(_,j))!==1&&w!==d)return this.onEnd(w),!(this.ended=!0);_.avail_out!==0&&(_.avail_in!==0||j!==4&&j!==2)||(this.options.to==="string"?this.onData(l.buf2binstring(o.shrinkBuf(_.output,_.next_out))):this.onData(o.shrinkBuf(_.output,_.next_out)))}while((0<_.avail_in||_.avail_out===0)&&w!==1);return j===4?(w=i.deflateEnd(this.strm),this.onEnd(w),this.ended=!0,w===d):j!==2||(this.onEnd(d),!(_.avail_out=0))},p.prototype.onData=function(x){this.chunks.push(x)},p.prototype.onEnd=function(x){x===d&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=o.flattenChunks(this.chunks)),this.chunks=[],this.err=x,this.msg=this.strm.msg},s.Deflate=p,s.deflate=v,s.deflateRaw=function(x,b){return(b=b||{}).raw=!0,v(x,b)},s.gzip=function(x,b){return(b=b||{}).gzip=!0,v(x,b)}},{"./utils/common":41,"./utils/strings":42,"./zlib/deflate":46,"./zlib/messages":51,"./zlib/zstream":53}],40:[function(r,n,s){var i=r("./zlib/inflate"),o=r("./utils/common"),l=r("./utils/strings"),c=r("./zlib/constants"),u=r("./zlib/messages"),h=r("./zlib/zstream"),d=r("./zlib/gzheader"),f=Object.prototype.toString;function m(p){if(!(this instanceof m))return new m(p);this.options=o.assign({chunkSize:16384,windowBits:0,to:""},p||{});var v=this.options;v.raw&&0<=v.windowBits&&v.windowBits<16&&(v.windowBits=-v.windowBits,v.windowBits===0&&(v.windowBits=-15)),!(0<=v.windowBits&&v.windowBits<16)||p&&p.windowBits||(v.windowBits+=32),15<v.windowBits&&v.windowBits<48&&!(15&v.windowBits)&&(v.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new h,this.strm.avail_out=0;var x=i.inflateInit2(this.strm,v.windowBits);if(x!==c.Z_OK)throw new Error(u[x]);this.header=new d,i.inflateGetHeader(this.strm,this.header)}function g(p,v){var x=new m(v);if(x.push(p,!0),x.err)throw x.msg||u[x.err];return x.result}m.prototype.push=function(p,v){var x,b,w,j,_,S,k=this.strm,P=this.options.chunkSize,C=this.options.dictionary,M=!1;if(this.ended)return!1;b=v===~~v?v:v===!0?c.Z_FINISH:c.Z_NO_FLUSH,typeof p=="string"?k.input=l.binstring2buf(p):f.call(p)==="[object ArrayBuffer]"?k.input=new Uint8Array(p):k.input=p,k.next_in=0,k.avail_in=k.input.length;do{if(k.avail_out===0&&(k.output=new o.Buf8(P),k.next_out=0,k.avail_out=P),(x=i.inflate(k,c.Z_NO_FLUSH))===c.Z_NEED_DICT&&C&&(S=typeof C=="string"?l.string2buf(C):f.call(C)==="[object ArrayBuffer]"?new Uint8Array(C):C,x=i.inflateSetDictionary(this.strm,S)),x===c.Z_BUF_ERROR&&M===!0&&(x=c.Z_OK,M=!1),x!==c.Z_STREAM_END&&x!==c.Z_OK)return this.onEnd(x),!(this.ended=!0);k.next_out&&(k.avail_out!==0&&x!==c.Z_STREAM_END&&(k.avail_in!==0||b!==c.Z_FINISH&&b!==c.Z_SYNC_FLUSH)||(this.options.to==="string"?(w=l.utf8border(k.output,k.next_out),j=k.next_out-w,_=l.buf2string(k.output,w),k.next_out=j,k.avail_out=P-j,j&&o.arraySet(k.output,k.output,w,j,0),this.onData(_)):this.onData(o.shrinkBuf(k.output,k.next_out)))),k.avail_in===0&&k.avail_out===0&&(M=!0)}while((0<k.avail_in||k.avail_out===0)&&x!==c.Z_STREAM_END);return x===c.Z_STREAM_END&&(b=c.Z_FINISH),b===c.Z_FINISH?(x=i.inflateEnd(this.strm),this.onEnd(x),this.ended=!0,x===c.Z_OK):b!==c.Z_SYNC_FLUSH||(this.onEnd(c.Z_OK),!(k.avail_out=0))},m.prototype.onData=function(p){this.chunks.push(p)},m.prototype.onEnd=function(p){p===c.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=o.flattenChunks(this.chunks)),this.chunks=[],this.err=p,this.msg=this.strm.msg},s.Inflate=m,s.inflate=g,s.inflateRaw=function(p,v){return(v=v||{}).raw=!0,g(p,v)},s.ungzip=g},{"./utils/common":41,"./utils/strings":42,"./zlib/constants":44,"./zlib/gzheader":47,"./zlib/inflate":49,"./zlib/messages":51,"./zlib/zstream":53}],41:[function(r,n,s){var i=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Int32Array<"u";s.assign=function(c){for(var u=Array.prototype.slice.call(arguments,1
vendor: 17,342 bytes, line 869
869);u.length;){var h=u.shift();if(h){if(typeof h!="object")throw new TypeError(h+"must be non-object");for(var d in h)h.hasOwnProperty(d)&&(c[d]=h[d])}}return c},s.shrinkBuf=function(c,u){return c.length===u?c:c.subarray?c.subarray(0,u):(c.length=u,c)};var o={arraySet:function(c,u,h,d,f){if(u.subarray&&c.subarray)c.set(u.subarray(h,h+d),f);else for(var m=0;m<d;m++)c[f+m]=u[h+m]},flattenChunks:function(c){var u,h,d,f,m,g;for(u=d=0,h=c.length;u<h;u++)d+=c[u].length;for(g=new Uint8Array(d),u=f=0,h=c.length;u<h;u++)m=c[u],g.set(m,f),f+=m.length;return g}},l={arraySet:function(c,u,h,d,f){for(var m=0;m<d;m++)c[f+m]=u[h+m]},flattenChunks:function(c){return[].concat.apply([],c)}};s.setTyped=function(c){c?(s.Buf8=Uint8Array,s.Buf16=Uint16Array,s.Buf32=Int32Array,s.assign(s,o)):(s.Buf8=Array,s.Buf16=Array,s.Buf32=Array,s.assign(s,l))},s.setTyped(i)},{}],42:[function(r,n,s){var i=r("./common"),o=!0,l=!0;try{String.fromCharCode.apply(null,[0])}catch{o=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{l=!1}for(var c=new i.Buf8(256),u=0;u<256;u++)c[u]=252<=u?6:248<=u?5:240<=u?4:224<=u?3:192<=u?2:1;function h(d,f){if(f<65537&&(d.subarray&&l||!d.subarray&&o))return String.fromCharCode.apply(null,i.shrinkBuf(d,f));for(var m="",g=0;g<f;g++)m+=String.fromCharCode(d[g]);return m}c[254]=c[254]=1,s.string2buf=function(d){var f,m,g,p,v,x=d.length,b=0;for(p=0;p<x;p++)(64512&(m=d.charCodeAt(p)))==55296&&p+1<x&&(64512&(g=d.charCodeAt(p+1)))==56320&&(m=65536+(m-55296<<10)+(g-56320),p++),b+=m<128?1:m<2048?2:m<65536?3:4;for(f=new i.Buf8(b),p=v=0;v<b;p++)(64512&(m=d.charCodeAt(p)))==55296&&p+1<x&&(64512&(g=d.charCodeAt(p+1)))==56320&&(m=65536+(m-55296<<10)+(g-56320),p++),m<128?f[v++]=m:(m<2048?f[v++]=192|m>>>6:(m<65536?f[v++]=224|m>>>12:(f[v++]=240|m>>>18,f[v++]=128|m>>>12&63),f[v++]=128|m>>>6&63),f[v++]=128|63&m);return f},s.buf2binstring=function(d){return h(d,d.length)},s.binstring2buf=function(d){for(var f=new i.Buf8(d.length),m=0,g=f.length;m<g;m++)f[m]=d.charCodeAt(m);return f},s.buf2string=function(d,f){var m,g,p,v,x=f||d.length,b=new Array(2*x);for(m=g=0;m<x;)if((p=d[m++])<128)b[g++]=p;else if(4<(v=c[p]))b[g++]=65533,m+=v-1;else{for(p&=v===2?31:v===3?15:7;1<v&&m<x;)p=p<<6|63&d[m++],v--;1<v?b[g++]=65533:p<65536?b[g++]=p:(p-=65536,b[g++]=55296|p>>10&1023,b[g++]=56320|1023&p)}return h(b,g)},s.utf8border=function(d,f){var m;for((f=f||d.length)>d.length&&(f=d.length),m=f-1;0<=m&&(192&d[m])==128;)m--;return m<0||m===0?f:m+c[d[m]]>f?m:f}},{"./common":41}],43:[function(r,n,s){n.exports=function(i,o,l,c){for(var u=65535&i|0,h=i>>>16&65535|0,d=0;l!==0;){for(l-=d=2e3<l?2e3:l;h=h+(u=u+o[c++]|0)|0,--d;);u%=65521,h%=65521}return u|h<<16|0}},{}],44:[function(r,n,s){n.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},{}],45:[function(r,n,s){var i=function(){for(var o,l=[],c=0;c<256;c++){o=c;for(var u=0;u<8;u++)o=1&o?3988292384^o>>>1:o>>>1;l[c]=o}return l}();n.exports=function(o,l,c,u){var h=i,d=u+c;o^=-1;for(var f=u;f<d;f++)o=o>>>8^h[255&(o^l[f])];return-1^o}},{}],46:[function(r,n,s){var i,o=r("../utils/common"),l=r("./trees"),c=r("./adler32"),u=r("./crc32"),h=r("./messages"),d=0,f=4,m=0,g=-2,p=-1,v=4,x=2,b=8,w=9,j=286,_=30,S=19,k=2*j+1,P=15,C=3,M=258,I=M+C+1,E=42,B=113,A=1,L=2,W=3,D=4;function U(O,F){return O.msg=h[F],F}function R(O){return(O<<1)-(4<O?9:0)}function Q(O){for(var F=O.length;0<=--F;)O[F]=0}function K(O){var F=O.state,Z=F.pending;Z>O.avail_out&&(Z=O.avail_out),Z!==0&&(o.arraySet(O.output,F.pending_buf,F.pending_out,Z,O.next_out),O.next_out+=Z,F.pending_out+=Z,O.total_out+=Z,O.avail_out-=Z,F.pending-=Z,F.pending===0&&(F.pending_out=0))}function z(O,F){l._tr_flush_block(O,0<=O.block_start?O.block_start:-1,O.strstart-O.block_start,F),O.block_start=O.strstart,K(O.strm)}function N(O,F){O.pending_buf[O.pending++]=F}function T(O,F){O.pending_buf[O.pending++]=F>>>8&255,O.pending_buf[O.pending++]=255&F}function $(O,F){var Z,H,G=O.max_chain_length,re=O.strstart,le=O.prev_length,ce=O.nice_match,ae=O.strstart>O.w_size-I?O.strstart-(O.w_size-I):0,me=O.window,xe=O.w_mask,pe=O.prev,be=O.strstart+M,We=me[re+le-1],Ve=me[re+le];O.prev_length>=O.good_match&&(G>>=2),ce>O.lookahead&&(ce=O.lookahead);do if(me[(Z=F)+le]===Ve&&me[Z+le-1]===We&&me[Z]===me[re]&&me[++Z]===me[re+1]){re+=2,Z++;do;while(me[++re]===me[++Z]&&me[++re]===me[++Z]&&me[++re]===me[++Z]&&me[++re]===me[++Z]&&me[++re]===me[++Z]&&me[++re]===me[++Z]&&me[++re]===me[++Z]&&me[++re]===me[++Z]&&re<be);if(H=M-(be-re),re=be-M,le<H){if(O.match_start=F,ce<=(le=H))break;We=me[re+le-1],Ve=me[re+le]}}while((F=pe[F&xe])>ae&&--G!=0);return le<=O.lookahead?le:O.lookahead}function V(O){var F,Z,H,G,re,le,ce,ae,me,xe,pe=O.w_size;do{if(G=O.window_size-O.lookahead-O.strstart,O.strstart>=pe+(pe-I)){for(o.arraySet(O.window,O.window,pe,pe,0),O.match_start-=pe,O.strstart-=pe,O.block_start-=pe,F=Z=O.hash_size;H=O.head[--F],O.head[F]=pe<=H?H-pe:0,--Z;);for(F=Z=pe;H=O.prev[--F],O.prev[F]=pe<=H?H-pe:0,--Z;);G+=pe}if(O.strm.avail_in===0)break;if(le=O.strm,ce=O.window,ae=O.strstart+O.lookahead,me=G,xe=void 0,xe=le.avail_in,me<xe&&(xe=me),Z=xe===0?0:(le.avail_in-=xe,o.arraySet(ce,le.input,le.next_in,xe,ae),le.state.wrap===1?le.adler=c(le.adler,ce,xe,ae):le.state.wrap===2&&(le.adler=u(le.adler,ce,xe,ae)),le.next_in+=xe,le.total_in+=xe,xe),O.lookahead+=Z,O.lookahead+O.insert>=C)for(re=O.strstart-O.insert,O.ins_h=O.window[re],O.ins_h=(O.ins_h<<O.hash_shift^O.window[re+1])&O.hash_mask;O.insert&&(O.ins_h=(O.ins_h<<O.hash_shift^O.window[re+C-1])&O.hash_mask,O.prev[re&O.w_mask]=O.head[O.ins_h],O.head[O.ins_h]=re,re++,O.insert--,!(O.lookahead+O.insert<C)););}while(O.lookahead<I&&O.strm.avail_in!==0)}function q(O,F){for(var Z,H;;){if(O.lookahead<I){if(V(O),O.lookahead<I&&F===d)return A;if(O.lookahead===0)break}if(Z=0,O.lookahead>=C&&(O.ins_h=(O.ins_h<<O.hash_shift^O.window[O.strstart+C-1])&O.hash_mask,Z=O.prev[O.strstart&O.w_mask]=O.head[O.ins_h],O.head[O.ins_h]=O.strstart),Z!==0&&O.strstart-Z<=O.w_size-I&&(O.match_length=$(O,Z)),O.match_length>=C)if(H=l._tr_tally(O,O.strstart-O.match_start,O.match_length-C),O.lookahead-=O.match_length,O.match_length<=O.max_lazy_match&&O.lookahead>=C){for(O.match_length--;O.strstart++,O.ins_h=(O.ins_h<<O.hash_shift^O.window[O.strstart+C-1])&O.hash_mask,Z=O.prev[O.strstart&O.w_mask]=O.head[O.ins_h],O.head[O.ins_h]=O.strstart,--O.match_length!=0;);O.strstart++}else O.strstart+=O.match_length,O.match_length=0,O.ins_h=O.window[O.strstart],O.ins_h=(O.ins_h<<O.hash_shift^O.window[O.strstart+1])&O.hash_mask;else H=l._tr_tally(O,0,O.window[O.strstart]),O.lookahead--,O.strstart++;if(H&&(z(O,!1),O.strm.avail_out===0))return A}return O.insert=O.strstart<C-1?O.strstart:C-1,F===f?(z(O,!0),O.strm.avail_out===0?W:D):O.last_lit&&(z(O,!1),O.strm.avail_out===0)?A:L}function te(O,F){for(var Z,H,G;;){if(O.lookahead<I){if(V(O),O.lookahead<I&&F===d)return A;if(O.lookahead===0)break}if(Z=0,O.lookahead>=C&&(O.ins_h=(O.ins_h<<O.hash_shift^O.window[O.strstart+C-1])&O.hash_mask,Z=O.prev[O.strstart&O.w_mask]=O.head[O.ins_h],O.head[O.ins_h]=O.strstart),O.prev_length=O.match_length,O.prev_match=O.match_start,O.match_length=C-1,Z!==0&&O.prev_length<O.max_lazy_match&&O.strstart-Z<=O.w_size-I&&(O.match_length=$(O,Z),O.match_length<=5&&(O.strategy===1||O.match_length===C&&4096<O.strstart-O.match_start)&&(O.match_length=C-1)),O.prev_length>=C&&O.match_length<=O.prev_length){for(G=O.strstart+O.lookahead-C,H=l._tr_tally(O,O.strstart-1-O.prev_match,O.prev_length-C),O.lookahead-=O.prev_length-1,O.prev_length-=2;++O.strstart<=G&&(O.ins_h=(O.ins_h<<O.hash_shift^O.window[O.strstart+C-1])&O.hash_mask,Z=O.prev[O.strstart&O.w_mask]=O.head[O.ins_h],O.head[O.ins_h]=O.strstart),--O.prev_length!=0;);if(O.match_available=0,O.match_length=C-1,O.strstart++,H&&(z(O,!1),O.strm.avail_out===0))return A}else if(O.match_available){if((H=l._tr_tally(O,0,O.window[O.strstart-1]))&&z(O,!1),O.strstart++,O.lookahead--,O.strm.avail_out===0)return A}else O.match_available=1,O.strstart++,O.lookahead--}return O.match_available&&(H=l._tr_tally(O,0,O.window[O.strstart-1]),O.match_available=0),O.insert=O.strstart<C-1?O.strstart:C-1,F===f?(z(O,!0),O.strm.avail_out===0?W:D):O.last_lit&&(z(O,!1),O.strm.avail_out===0)?A:L}function X(O,F,Z,H,G){this.good_length=O,this.max_lazy=F,this.nice_length=Z,this.max_chain=H,this.func=G}function ee(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=b,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new o.Buf16(2*k),this.dyn_dtree=new o.Buf16(2*(2*_+1)),this.bl_tree=new o.Buf16(2*(2*S+1)),Q(this.dyn_ltree),Q(this.dyn_dtree),Q(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new o.Buf16(P+1),this.heap=new o.Buf16(2*j+1),Q(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new o.Buf16(2*j+1),Q(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function ie(O){var F;return O&&O.state?(O.total_in=O.total_out=0,O.data_type=x,(F=O.state).pending=0,F.pending_out=0,F.wrap<0&&(F.wrap=-F.wrap),F.status=F.wrap?E:B,O.adler=F.wrap===2?0:1,F.last_flush=d,l._tr_init(F),m):U(O,g)}function oe(O){var F=ie(O);return F===m&&function(Z){Z.window_size=2*Z.w_size,Q(Z.head),Z.max_lazy_match=i[Z.level].max_lazy,Z.good_match=i[Z.level].good_length,Z.nice_match=i[Z.level].nice_length,Z.max_chain_length=i[Z.level].max_chain,Z.strstart=0,Z.block_start=0,Z.lookahead=0,Z.insert=0,Z.match_length=Z.prev_length=C-1,Z.match_available=0,Z.ins_h=0}(O.state),F}function we(O,F,Z,H,G,re){if(!O)return g;var le=1;if(F===p&&(F=6),H<0?(le=0,H=-H):15<H&&(le=2,H-=16),G<1||w<G||Z!==b||H<8||15<H||F<0||9<F||re<0||v<re)return U(O,g);H===8&&(H=9);var ce=new ee;return(O.state=ce).strm=O,ce.wrap=le,ce.gzhead=null,ce.w_bits=H,ce.w_size=1<<ce.w_bits,ce.w_mask=ce.w_size-1,ce.hash_bits=G+7,ce.hash_size=1<<ce.hash_bits,ce.hash_mask=ce.hash_size-1,ce.hash_shift=~~((ce.hash_bits+C-1)/C),ce.window=new o.Buf8(2*ce.w_size),ce.head=new o.Buf16(ce.hash_size),ce.prev=new o.Buf16(ce.w_size),ce.lit_bufsize=1<<G+6,ce.pending_buf_size=4*ce.lit_bufsize,ce.pending_buf=new o.Buf8(ce.pending_buf_size),ce.d_buf=1*ce.lit_bufsize,ce.l_buf=3*ce.lit_bufsize,ce.level=F,ce.strategy=re,ce.method=Z,oe(O)}i=[new X(0,0,0,0,function(O,F){var Z=65535;for(Z>O.pending_buf_size-5&&(Z=O.pending_buf_size-5);;){if(O.lookahead<=1){if(V(O),O.lookahead===0&&F===d)return A;if(O.lookahead===0)break}O.strstart+=O.lookahead,O.lookahead=0;var H=O.block_start+Z;if((O.strstart===0||O.strstart>=H)&&(O.lookahead=O.strstart-H,O.strstart=H,z(O,!1),O.strm.avail_out===0)||O.strstart-O.block_start>=O.w_size-I&&(z(O,!1),O.strm.avail_out===0))return A}return O.insert=0,F===f?(z(O,!0),O.strm.avail_out===0?W:D):(O.strstart>O.block_start&&(z(O,!1),O.strm.avail_out),A)}),new X(4,4,8,4,q),new X(4,5,16,8,q),new X(4,6,32,32,q),new X(4,4,16,16,te),new X(8,16,32,32,te),new X(8,16,128,128,te),new X(8,32,128,256,te),new X(32,128,258,1024,te),new X(32,258,258,4096,te)],s.deflateInit=function(O,F){return we(O,F,b,15,8,0)},s.deflateInit2=we,s.deflateReset=oe,s.deflateResetKeep=ie,s.deflateSetHeader=function(O,F){return O&&O.state?O.state.wrap!==2?g:(O.state.gzhead=F,m):g},s.deflate=function(O,F){var Z,H,G,re;if(!O||!O.state||5<F||F<0)return O?U(O,g):g;if(H=O.state,!O.output||!O.input&&O.avail_in!==0||H.status===666&&F!==f)return U(O,O.avail_out===0?-5:g);if(H.strm=O,Z=H.last_flush,H.last_flush=F,H.status===E)if(H.wrap===2)O.adler=0,N(H,31),N(H,139),N(H,8),H.gzhead?(N(H,(H.gzhead.text?1:0)+(H.gzhead.hcrc?2:0)+(H.gzhead.extra?4:0)+(H.gzhead.name?8:0)+(H.gzhead.comment?16:0)),N(H,255&H.gzhead.time),N(H,H.gzhead.time>>8&255),N(H,H.gzhead.time>>16&255),N(H,H.gzhead.time>>24&255),N(H,H.level===9?2:2<=H.strategy||H.level<2?4:0),N(H,255&H.gzhead.os),H.gzhead.extra&&H.gzhead.extra.length&&(N(H,255&H.gzhead.extra.length),N(H,H.gzhead.extra.length>>8&255)),H.gzhead.hcrc&&(O.adler=u(O.adler,H.pending_buf,H.pending,0)),H.gzindex=0,H.status=69):(N(H,0),N(H,0),N(H,0),N(H,0),N(H,0),N(H,H.level===9?2:2<=H.strategy||H.level<2?4:0),N(H,3),H.status=B);else{var le=b+(H.w_bits-8<<4)<<8;le|=(2<=H.strategy||H.level<2?0:H.level<6?1:H.level===6?2:3)<<6,H.strstart!==0&&(le|=32),le+=31-le%31,H.status=B,T(H,le),H.strstart!==0&&(T(H,O.adler>>>16),T(H,65535&O.adler)),O.adler=1}if(H.status===69)if(H.gzhead.extra){for(G=H.pending;H.gzindex<(65535&H.gzhead.extra.length)&&(H.pending!==H.pending_buf_size||(H.gzhead.hcrc&&H.pending>G&&(O.adler=u(O.adler,H.pending_buf,H.pending-G,G)),K(O),G=H.pending,H.pending!==H.pending_buf_size));)N(H,255&H.gzhead.extra[H.gzindex]),H.gzindex++;H.gzhead.hcrc&&H.pending>G&&(O.adler=u(O.adler,H.pending_buf,H.pending-G,G)),H.gzindex===H.gzhead.extra.length&&(H.gzindex=0,H.status=73)}else H.status=73;if(H.status===73)if(H.gzhead.name){G=H.pending;do{if(H.pending===H.pending_buf_size&&(H.gzhead.hcrc&&H.pending>G&&(O.adler=u(O.adler,H.pending_buf,H.pending-G,G)),K(O),G=H.pending,H.pending===H.pending_buf_size)){re=1;break}re=H.gzindex<H.gzhead.name.length?255&H.gzhead.name.charCodeAt(H.gzindex++):0,N(H,re)}while(re!==0);H.gzhead.hcrc&&H.pending>G&&(O.adler=u(O.adler,H.pending_buf,H.pending-G,G)),re===0&&(H.gzindex=0,H.status=91)}else H.status=91;if(H.status===91)if(H.gzhead.comment){G=H.pending;do{if(H.pending===H.pending_buf_size&&(H.gzhead.hcrc&&H.pending>G&&(O.adler=u(O.adler,H.pending_buf,H.pending-G,G)),K(O),G=H.pending,H.pending===H.pending_buf_size)){re=1;break}re=H.gzindex<H.gzhead.comment.length?255&H.gzhead.comment.charCodeAt(H.gzindex++):0,N(H,re)}while(re!==0);H.gzhead.hcrc&&H.pending>G&&(O.adler=u(O.adler,H.pending_buf,H.pending-G,G)),re===0&&(H.status=103)}else H.status=103;if(H.status===103&&(H.gzhead.hcrc?(H.pending+2>H.pending_buf_size&&K(O),H.pending+2<=H.pending_buf_size&&(N(H,255&O.adler),N(H,O.adler>>8&255),O.adler=0,H.status=B)):H.status=B),H.pending!==0){if(K(O),O.avail_out===0)return H.last_flush=-1,m}else if(O.avail_in===0&&R(F)<=R(Z)&&F!==f)return U(O,-5);if(H.status===666&&O.avail_in!==0)return U(O,-5);if(O.avail_in!==0||H.lookahead!==0||F!==d&&H.status!==666){var ce=H.strategy===2?function(ae,me){for(var xe;;){if(ae.lookahead===0&&(V(ae),ae.lookahead===0)){if(me===d)return A;break}if(ae.match_length=0,xe=l._tr_tally(ae,0,ae.window[ae.strstart]),ae.lookahead--,ae.strstart++,xe&&(z(ae,!1),ae.strm.avail_out===0))return A}return ae.insert=0,me===f?(z(ae,!0),ae.strm.avail_out===0?W:D):ae.last_lit&&(z(ae,!1),ae.strm.avail_out===0)?A:L}(H,F):H.strategy===3?function(ae,me){for(var xe,pe,be,We,Ve=ae.window;;){if(ae.lookahead<=M){if(V(ae),ae.lookahead<=M&&me===d)return A;if(ae.lookahead===0)break}if(ae.match_length=0,ae.lookahead>=C&&0<ae.strstart&&(pe=Ve[be=ae.strstart-1])===Ve[++be]&&pe===Ve[++be]&&pe===Ve[++be]){We=ae.strstart+M;do;while(pe===Ve[++be]&&pe===Ve[++be]&&pe===Ve[++be]&&pe===Ve[++be]&&pe===Ve[++be]&&pe===Ve[++be]&&pe===Ve[++be]&&pe===Ve[++be]&&be<We);ae.match_length=M-(We-be),ae.match_length>ae.lookahead&&(ae.match_length=ae.lookahead)}if(ae.match_length>=C?(xe=l._tr_tally(ae,1,ae.match_length-C),ae.lookahead-=ae.match_length,ae.strstart+=ae.match_length,ae.match_length=0):(xe=l._tr_tally(ae,0,ae.window[ae.strstart]),ae.lookahead--,ae.strstart++),xe&&(z(ae,!1),ae.strm.avail_out===0))return A}return ae.insert=0,me===f?(z(ae,!0),ae.strm.avail_out===0?W:D):ae.last_lit&&(z(ae,!1),ae.strm.avail_out===0)?A:L}(H,F):i[H.level].func(H,F);if(ce!==W&&ce!==D||(H.status=666),ce===A||ce===W)return O.avail_out===0&&(H.last_flush=-1),m;if(ce===L&&(F===1?l._tr_align(H):F!==5&&(l._tr_stored_block(H,0,0,!1),F===3&&(Q(H.head),H.lookahead===0&&(H.strstart=0,H.block_start=0,H.insert=0))),K(O),O.avail_out===0))return H.last_flush=-1,m}return F!==f?m:H.wrap<=0?1:(H.wrap===2?(N(H,255&O.adler),N(H,O.adler>>8&255),N(H,O.adler>>16&255),N(H,O.adler>>24&255),N(H,255&O.total_in),N(H,O.total_in>>8&255),N(H,O.total_in>>16&255),N(H,O.total_in>>24&255)):(T(H,O.adler>>>16),T(H,65535&O.adler)),K(O),0<H.wrap&&(H.wrap=-H.wrap),H.pending!==0?m:1)},s.deflateEnd=function(O){var F;return O&&O.state?(F=O.state.status)!==E&&F!==69&&F!==73&&F!==91&&F!==103&&F!==B&&F!==666?U(O,g):(O.state=null,F===B?U(O,-3):m):g},s.deflateSetDictionary=function(O,F){var Z,H,G,re,le,ce,ae,me,xe=F.length;if(!O||!O.state||(re=(Z=O.state).wrap)===2||re===1&&Z.status!==E||Z.lookahead)return g;for(re===1&&(O.adler=c(O.adler,F,xe,0)),Z.wrap=0,xe>=Z.w_size&&(re===0&&(Q(Z.head),Z.strstart=0,Z.block_start=0,Z.insert=0),me=new o.Buf8(Z.w_size),o.arraySet(me,F,xe-Z.w_size,Z.w_size,0),F=me,xe=Z.w_size),le=O.avail_in,ce=O.next_in,ae=O.input,O.avail_in=xe,O.next_in=0,O.input
vendor: 4,385 bytes, line 869
869=F,V(Z);Z.lookahead>=C;){for(H=Z.strstart,G=Z.lookahead-(C-1);Z.ins_h=(Z.ins_h<<Z.hash_shift^Z.window[H+C-1])&Z.hash_mask,Z.prev[H&Z.w_mask]=Z.head[Z.ins_h],Z.head[Z.ins_h]=H,H++,--G;);Z.strstart=H,Z.lookahead=C-1,V(Z)}return Z.strstart+=Z.lookahead,Z.block_start=Z.strstart,Z.insert=Z.lookahead,Z.lookahead=0,Z.match_length=Z.prev_length=C-1,Z.match_available=0,O.next_in=ce,O.input=ae,O.avail_in=le,Z.wrap=re,m},s.deflateInfo="pako deflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./messages":51,"./trees":52}],47:[function(r,n,s){n.exports=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}},{}],48:[function(r,n,s){n.exports=function(i,o){var l,c,u,h,d,f,m,g,p,v,x,b,w,j,_,S,k,P,C,M,I,E,B,A,L;l=i.state,c=i.next_in,A=i.input,u=c+(i.avail_in-5),h=i.next_out,L=i.output,d=h-(o-i.avail_out),f=h+(i.avail_out-257),m=l.dmax,g=l.wsize,p=l.whave,v=l.wnext,x=l.window,b=l.hold,w=l.bits,j=l.lencode,_=l.distcode,S=(1<<l.lenbits)-1,k=(1<<l.distbits)-1;e:do{w<15&&(b+=A[c++]<<w,w+=8,b+=A[c++]<<w,w+=8),P=j[b&S];t:for(;;){if(b>>>=C=P>>>24,w-=C,(C=P>>>16&255)===0)L[h++]=65535&P;else{if(!(16&C)){if(!(64&C)){P=j[(65535&P)+(b&(1<<C)-1)];continue t}if(32&C){l.mode=12;break e}i.msg="invalid literal/length code",l.mode=30;break e}M=65535&P,(C&=15)&&(w<C&&(b+=A[c++]<<w,w+=8),M+=b&(1<<C)-1,b>>>=C,w-=C),w<15&&(b+=A[c++]<<w,w+=8,b+=A[c++]<<w,w+=8),P=_[b&k];r:for(;;){if(b>>>=C=P>>>24,w-=C,!(16&(C=P>>>16&255))){if(!(64&C)){P=_[(65535&P)+(b&(1<<C)-1)];continue r}i.msg="invalid distance code",l.mode=30;break e}if(I=65535&P,w<(C&=15)&&(b+=A[c++]<<w,(w+=8)<C&&(b+=A[c++]<<w,w+=8)),m<(I+=b&(1<<C)-1)){i.msg="invalid distance too far back",l.mode=30;break e}if(b>>>=C,w-=C,(C=h-d)<I){if(p<(C=I-C)&&l.sane){i.msg="invalid distance too far back",l.mode=30;break e}if(B=x,(E=0)===v){if(E+=g-C,C<M){for(M-=C;L[h++]=x[E++],--C;);E=h-I,B=L}}else if(v<C){if(E+=g+v-C,(C-=v)<M){for(M-=C;L[h++]=x[E++],--C;);if(E=0,v<M){for(M-=C=v;L[h++]=x[E++],--C;);E=h-I,B=L}}}else if(E+=v-C,C<M){for(M-=C;L[h++]=x[E++],--C;);E=h-I,B=L}for(;2<M;)L[h++]=B[E++],L[h++]=B[E++],L[h++]=B[E++],M-=3;M&&(L[h++]=B[E++],1<M&&(L[h++]=B[E++]))}else{for(E=h-I;L[h++]=L[E++],L[h++]=L[E++],L[h++]=L[E++],2<(M-=3););M&&(L[h++]=L[E++],1<M&&(L[h++]=L[E++]))}break}}break}}while(c<u&&h<f);c-=M=w>>3,b&=(1<<(w-=M<<3))-1,i.next_in=c,i.next_out=h,i.avail_in=c<u?u-c+5:5-(c-u),i.avail_out=h<f?f-h+257:257-(h-f),l.hold=b,l.bits=w}},{}],49:[function(r,n,s){var i=r("../utils/common"),o=r("./adler32"),l=r("./crc32"),c=r("./inffast"),u=r("./inftrees"),h=1,d=2,f=0,m=-2,g=1,p=852,v=592;function x(E){return(E>>>24&255)+(E>>>8&65280)+((65280&E)<<8)+((255&E)<<24)}function b(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new i.Buf16(320),this.work=new i.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function w(E){var B;return E&&E.state?(B=E.state,E.total_in=E.total_out=B.total=0,E.msg="",B.wrap&&(E.adler=1&B.wrap),B.mode=g,B.last=0,B.havedict=0,B.dmax=32768,B.head=null,B.hold=0,B.bits=0,B.lencode=B.lendyn=new i.Buf32(p),B.distcode=B.distdyn=new i.Buf32(v),B.sane=1,B.back=-1,f):m}function j(E){var B;return E&&E.state?((B=E.state).wsize=0,B.whave=0,B.wnext=0,w(E)):m}function _(E,B){var A,L;return E&&E.state?(L=E.state,B<0?(A=0,B=-B):(A=1+(B>>4),B<48&&(B&=15)),B&&(B<8||15<B)?m:(L.window!==null&&L.wbits!==B&&(L.window=null),L.wrap=A,L.wbits=B,j(E))):m}function S(E,B){var A,L;return E?(L=new b,(E.state=L).window=null,(A=_(E,B))!==f&&(E.state=null),A):m}var k,P,C=!0;function M(E){if(C){var B;for(k=new i.Buf32(512),P=new i.Buf32(32),B=0;B<144;)E.lens[B++]=8;for(;B<256;)E.lens[B++]=9;for(;B<280;)E.lens[B++]=7;for(;B<288;)E.lens[B++]=8;for(u(h,E.lens,0,288,k,0,E.work,{bits:9}),B=0;B<32;)E.lens[B++]=5;u(d,E.lens,0,32,P,0,E.work,{bits:5}),C=!1}E.lencode=k,E.lenbits=9,E.distcode=P,E.distbits=5}function I(E,B,A,L){var W,D=E.state;return D.window===null&&(D.wsize=1<<D.wbits,D.wnext=0,D.whave=0,D.window=new i.Buf8(D.wsize)),L>
vendor: 4,293 bytes, line 869
869=D.wsize?(i.arraySet(D.window,B,A-D.wsize,D.wsize,0),D.wnext=0,D.whave=D.wsize):(L<(W=D.wsize-D.wnext)&&(W=L),i.arraySet(D.window,B,A-L,W,D.wnext),(L-=W)?(i.arraySet(D.window,B,A-L,L,0),D.wnext=L,D.whave=D.wsize):(D.wnext+=W,D.wnext===D.wsize&&(D.wnext=0),D.whave<D.wsize&&(D.whave+=W))),0}s.inflateReset=j,s.inflateReset2=_,s.inflateResetKeep=w,s.inflateInit=function(E){return S(E,15)},s.inflateInit2=S,s.inflate=function(E,B){var A,L,W,D,U,R,Q,K,z,N,T,$,V,q,te,X,ee,ie,oe,we,O,F,Z,H,G=0,re=new i.Buf8(4),le=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!E||!E.state||!E.output||!E.input&&E.avail_in!==0)return m;(A=E.state).mode===12&&(A.mode=13),U=E.next_out,W=E.output,Q=E.avail_out,D=E.next_in,L=E.input,R=E.avail_in,K=A.hold,z=A.bits,N=R,T=Q,F=f;e:for(;;)switch(A.mode){case g:if(A.wrap===0){A.mode=13;break}for(;z<16;){if(R===0)break e;R--,K+=L[D++]<<z,z+=8}if(2&A.wrap&&K===35615){re[A.check=0]=255&K,re[1]=K>>>8&255,A.check=l(A.check,re,2,0),z=K=0,A.mode=2;break}if(A.flags=0,A.head&&(A.head.done=!1),!(1&A.wrap)||(((255&K)<<8)+(K>>8))%31){E.msg="incorrect header check",A.mode=30;break}if((15&K)!=8){E.msg="unknown compression method",A.mode=30;break}if(z-=4,O=8+(15&(K>>>=4)),A.wbits===0)A.wbits=O;else if(O>A.wbits){E.msg="invalid window size",A.mode=30;break}A.dmax=1<<O,E.adler=A.check=1,A.mode=512&K?10:12,z=K=0;break;case 2:for(;z<16;){if(R===0)break e;R--,K+=L[D++]<<z,z+=8}if(A.flags=K,(255&A.flags)!=8){E.msg="unknown compression method",A.mode=30;break}if(57344&A.flags){E.msg="unknown header flags set",A.mode=30;break}A.head&&(A.head.text=K>>8&1),512&A.flags&&(re[0]=255&K,re[1]=K>>>8&255,A.check=l(A.check,re,2,0)),z=K=0,A.mode=3;case 3:for(;z<32;){if(R===0)break e;R--,K+=L[D++]<<z,z+=8}A.head&&(A.head.time=K),512&A.flags&&(re[0]=255&K,re[1]=K>>>8&255,re[2]=K>>>16&255,re[3]=K>>>24&255,A.check=l(A.check,re,4,0)),z=K=0,A.mode=4;case 4:for(;z<16;){if(R===0)break e;R--,K+=L[D++]<<z,z+=8}A.head&&(A.head.xflags=255&K,A.head.os=K>>8),512&A.flags&&(re[0]=255&K,re[1]=K>>>8&255,A.check=l(A.check,re,2,0)),z=K=0,A.mode=5;case 5:if(1024&A.flags){for(;z<16;){if(R===0)break e;R--,K+=L[D++]<<z,z+=8}A.length=K,A.head&&(A.head.extra_len=K),512&A.flags&&(re[0]=255&K,re[1]=K>>>8&255,A.check=l(A.check,re,2,0)),z=K=0}else A.head&&(A.head.extra=null);A.mode=6;case 6:if(1024&A.flags&&(R<($=A.length)&&($=R),$&&(A.head&&(O=A.head.extra_len-A.length,A.head.extra||(A.head.extra=new Array(A.head.extra_len)),i.arraySet(A.head.extra,L,D,$,O)),512&A.flags&&(A.check=l(A.check,L,$,D)),R-=$,D+=$,A.length-=$),A.length))break e;A.length=0,A.mode=7;case 7:if(2048&A.flags){if(R===0)break e;for($=0;O=L[D+$++],A.head&&O&&A.length<65536&&(A.head.name+=String.fromCharCode(O)),O&&$<R;);if(512&A.flags&&(A.check=l(A.check,L,$,D)),R-=$,D+=$,O)break e}else A.head&&(A.head.name=null);A.length=0,A.mode=8;case 8:if(4096&A.flags){if(R===0)break e;for($=0;O=L[D+$++],A.head&&O&&A.length<65536&&(A.head.comment+=String.fromCharCode(O)),O&&$<R;);if(512&A.flags&&(A.check=l(A.check,L,$,D)),R-=$,D+=$,O)break e}else A.head&&(A.head.comment=null);A.mode=9;case 9:if(512&A.flags){for(;z<16;){if(R===0)break e;R--,K+=L[D++]<<z,z+=8}if(K!==(65535&A.check)){E.msg="header crc mismatch",A.mode=30;break}z=K=0}A.head&&(A.head.hcrc=A.flags>>9&1,A.head.done=!0),E.adler=A.check=0,A.mode=12;break;case 10:for(;z<32;){if(R===0)break e;R--,K+=L[D++]<<z,z+=8}E.adler=A.check=x(K),z=K=0,A.mode=11;case 11:if(A.havedict===0)return E.next_out=U,E.avail_out=Q,E.next_in=D,E.avail_in=R,A.hold=K,A.bits=z,2;E.adler=A.check=1,A.mode=12;case 12:if(B===5||B===6)break e;case 13:if(A.last){K>>>=7&z,z-=7&z,A.mode=27;break}for(;z<3;){if(R===0)break e;R--,K+=L[D++]<<z,z+=8}switch(A.last=1&K,z-=1,3&(K>>>=1)){case 0:A.mode=14;break;case 1:if(M(A),A.mode=20,B!==6)break;K>>>=2,z-=2;break e;case 2:A.mode=17;break;case 3:E.msg="invalid block type",A.mode=30}K>>>=2,z-=2;break;case 14:for(K>>>=7&z,z-=7&z;z<32;){if(R===0)break e;R--,K+=L[D++]<<z,z+=8}if((65535&K)!=(K>>>16^65535)){E.msg="invalid stored block lengths",A.mode=30;break}if(A.length=65535&K,z=K=0,A.mode=15,B===6)break e;case 15:A.mode=16;case 16:if($=A.length){if(R<$&&($=R),Q<$&&($=Q),$===0)break e;i.arraySet(W,L,D,$,U),R-=$,D+=$,Q-=$,U+=$,A.length-=$;break}A.mode=12;break;case 17:for(;z<14;){if(R===0)break e;R--,K+=L[D++]<<z,z+=8}if(A.nlen=257+(31&K),K>>>
vendor: 5,639 bytes, line 869
869=5,z-=5,A.ndist=1+(31&K),K>>>=5,z-=5,A.ncode=4+(15&K),K>>>=4,z-=4,286<A.nlen||30<A.ndist){E.msg="too many length or distance symbols",A.mode=30;break}A.have=0,A.mode=18;case 18:for(;A.have<A.ncode;){for(;z<3;){if(R===0)break e;R--,K+=L[D++]<<z,z+=8}A.lens[le[A.have++]]=7&K,K>>>=3,z-=3}for(;A.have<19;)A.lens[le[A.have++]]=0;if(A.lencode=A.lendyn,A.lenbits=7,Z={bits:A.lenbits},F=u(0,A.lens,0,19,A.lencode,0,A.work,Z),A.lenbits=Z.bits,F){E.msg="invalid code lengths set",A.mode=30;break}A.have=0,A.mode=19;case 19:for(;A.have<A.nlen+A.ndist;){for(;X=(G=A.lencode[K&(1<<A.lenbits)-1])>>>16&255,ee=65535&G,!((te=G>>>24)<=z);){if(R===0)break e;R--,K+=L[D++]<<z,z+=8}if(ee<16)K>>>=te,z-=te,A.lens[A.have++]=ee;else{if(ee===16){for(H=te+2;z<H;){if(R===0)break e;R--,K+=L[D++]<<z,z+=8}if(K>>>=te,z-=te,A.have===0){E.msg="invalid bit length repeat",A.mode=30;break}O=A.lens[A.have-1],$=3+(3&K),K>>>=2,z-=2}else if(ee===17){for(H=te+3;z<H;){if(R===0)break e;R--,K+=L[D++]<<z,z+=8}z-=te,O=0,$=3+(7&(K>>>=te)),K>>>=3,z-=3}else{for(H=te+7;z<H;){if(R===0)break e;R--,K+=L[D++]<<z,z+=8}z-=te,O=0,$=11+(127&(K>>>=te)),K>>>=7,z-=7}if(A.have+$>A.nlen+A.ndist){E.msg="invalid bit length repeat",A.mode=30;break}for(;$--;)A.lens[A.have++]=O}}if(A.mode===30)break;if(A.lens[256]===0){E.msg="invalid code -- missing end-of-block",A.mode=30;break}if(A.lenbits=9,Z={bits:A.lenbits},F=u(h,A.lens,0,A.nlen,A.lencode,0,A.work,Z),A.lenbits=Z.bits,F){E.msg="invalid literal/lengths set",A.mode=30;break}if(A.distbits=6,A.distcode=A.distdyn,Z={bits:A.distbits},F=u(d,A.lens,A.nlen,A.ndist,A.distcode,0,A.work,Z),A.distbits=Z.bits,F){E.msg="invalid distances set",A.mode=30;break}if(A.mode=20,B===6)break e;case 20:A.mode=21;case 21:if(6<=R&&258<=Q){E.next_out=U,E.avail_out=Q,E.next_in=D,E.avail_in=R,A.hold=K,A.bits=z,c(E,T),U=E.next_out,W=E.output,Q=E.avail_out,D=E.next_in,L=E.input,R=E.avail_in,K=A.hold,z=A.bits,A.mode===12&&(A.back=-1);break}for(A.back=0;X=(G=A.lencode[K&(1<<A.lenbits)-1])>>>16&255,ee=65535&G,!((te=G>>>24)<=z);){if(R===0)break e;R--,K+=L[D++]<<z,z+=8}if(X&&!(240&X)){for(ie=te,oe=X,we=ee;X=(G=A.lencode[we+((K&(1<<ie+oe)-1)>>ie)])>>>16&255,ee=65535&G,!(ie+(te=G>>>24)<=z);){if(R===0)break e;R--,K+=L[D++]<<z,z+=8}K>>>=ie,z-=ie,A.back+=ie}if(K>>>=te,z-=te,A.back+=te,A.length=ee,X===0){A.mode=26;break}if(32&X){A.back=-1,A.mode=12;break}if(64&X){E.msg="invalid literal/length code",A.mode=30;break}A.extra=15&X,A.mode=22;case 22:if(A.extra){for(H=A.extra;z<H;){if(R===0)break e;R--,K+=L[D++]<<z,z+=8}A.length+=K&(1<<A.extra)-1,K>>>=A.extra,z-=A.extra,A.back+=A.extra}A.was=A.length,A.mode=23;case 23:for(;X=(G=A.distcode[K&(1<<A.distbits)-1])>>>16&255,ee=65535&G,!((te=G>>>24)<=z);){if(R===0)break e;R--,K+=L[D++]<<z,z+=8}if(!(240&X)){for(ie=te,oe=X,we=ee;X=(G=A.distcode[we+((K&(1<<ie+oe)-1)>>ie)])>>>16&255,ee=65535&G,!(ie+(te=G>>>24)<=z);){if(R===0)break e;R--,K+=L[D++]<<z,z+=8}K>>>=ie,z-=ie,A.back+=ie}if(K>>>=te,z-=te,A.back+=te,64&X){E.msg="invalid distance code",A.mode=30;break}A.offset=ee,A.extra=15&X,A.mode=24;case 24:if(A.extra){for(H=A.extra;z<H;){if(R===0)break e;R--,K+=L[D++]<<z,z+=8}A.offset+=K&(1<<A.extra)-1,K>>>=A.extra,z-=A.extra,A.back+=A.extra}if(A.offset>A.dmax){E.msg="invalid distance too far back",A.mode=30;break}A.mode=25;case 25:if(Q===0)break e;if($=T-Q,A.offset>$){if(($=A.offset-$)>A.whave&&A.sane){E.msg="invalid distance too far back",A.mode=30;break}V=$>A.wnext?($-=A.wnext,A.wsize-$):A.wnext-$,$>A.length&&($=A.length),q=A.window}else q=W,V=U-A.offset,$=A.length;for(Q<$&&($=Q),Q-=$,A.length-=$;W[U++]=q[V++],--$;);A.length===0&&(A.mode=21);break;case 26:if(Q===0)break e;W[U++]=A.length,Q--,A.mode=21;break;case 27:if(A.wrap){for(;z<32;){if(R===0)break e;R--,K|=L[D++]<<z,z+=8}if(T-=Q,E.total_out+=T,A.total+=T,T&&(E.adler=A.check=A.flags?l(A.check,W,T,U-T):o(A.check,W,T,U-T)),T=Q,(A.flags?K:x(K))!==A.check){E.msg="incorrect data check",A.mode=30;break}z=K=0}A.mode=28;case 28:if(A.wrap&&A.flags){for(;z<32;){if(R===0)break e;R--,K+=L[D++]<<z,z+=8}if(K!==(4294967295&A.total)){E.msg="incorrect length check",A.mode=30;break}z=K=0}A.mode=29;case 29:F=1;break e;case 30:F=-3;break e;case 31:return-4;case 32:default:return m}return E.next_out=U,E.avail_out=Q,E.next_in=D,E.avail_in=R,A.hold=K,A.bits=z,(A.wsize||T!==E.avail_out&&A.mode<30&&(A.mode<27||B!==4))&&I(E,E.output,E.next_out,T-E.avail_out)?(A.mode=31,-4):(N-=E.avail_in,T-=E.avail_out,E.total_in+=N,E.total_out+=T,A.total+=T,A.wrap&&T&&(E.adler=A.check=A.flags?l(A.check,W,T,E.next_out-T):o(A.check,W,T,E.next_out-T)),E.data_type=A.bits+(A.last?64:0)+(A.mode===12?128:0)+(A.mode===20||A.mode===15?256:0),(N==0&&T===0||B===4)&&F===f&&(F=-5),F)},s.inflateEnd=function(E){if(!E||!E.state)return m;var B=E.state;return B.window&&(B.window=null),E.state=null,f},s.inflateGetHeader=function(E,B){var A;return E&&E.state&&2&(A=E.state).wrap?((A.head=B).done=!1,f):m},s.inflateSetDictionary=function(E,B){var A,L=B.length;return E&&E.state?(A=E.state).wrap!==0&&A.mode!==11?m:A.mode===11&&o(1,B,L,0)!==A.check?-3:I(E,B,L,L)?(A.mode=31,-4):(A.havedict=1,f):m},s.inflateInfo="pako inflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./inffast":48,"./inftrees":50}],50:[function(r,n,s){var i=r("../utils/common"),o=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],l=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],c=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],u=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];
vendor: 10,216 bytes, line 869
869n.exports=function(h,d,f,m,g,p,v,x){var b,w,j,_,S,k,P,C,M,I=x.bits,E=0,B=0,A=0,L=0,W=0,D=0,U=0,R=0,Q=0,K=0,z=null,N=0,T=new i.Buf16(16),$=new i.Buf16(16),V=null,q=0;for(E=0;E<=15;E++)T[E]=0;for(B=0;B<m;B++)T[d[f+B]]++;for(W=I,L=15;1<=L&&T[L]===0;L--);if(L<W&&(W=L),L===0)return g[p++]=20971520,g[p++]=20971520,x.bits=1,0;for(A=1;A<L&&T[A]===0;A++);for(W<A&&(W=A),E=R=1;E<=15;E++)if(R<<=1,(R-=T[E])<0)return-1;if(0<R&&(h===0||L!==1))return-1;for($[1]=0,E=1;E<15;E++)$[E+1]=$[E]+T[E];for(B=0;B<m;B++)d[f+B]!==0&&(v[$[d[f+B]]++]=B);if(k=h===0?(z=V=v,19):h===1?(z=o,N-=257,V=l,q-=257,256):(z=c,V=u,-1),E=A,S=p,U=B=K=0,j=-1,_=(Q=1<<(D=W))-1,h===1&&852<Q||h===2&&592<Q)return 1;for(;;){for(P=E-U,M=v[B]<k?(C=0,v[B]):v[B]>k?(C=V[q+v[B]],z[N+v[B]]):(C=96,0),b=1<<E-U,A=w=1<<D;g[S+(K>>U)+(w-=b)]=P<<24|C<<16|M|0,w!==0;);for(b=1<<E-1;K&b;)b>>=1;if(b!==0?(K&=b-1,K+=b):K=0,B++,--T[E]==0){if(E===L)break;E=d[f+v[B]]}if(W<E&&(K&_)!==j){for(U===0&&(U=W),S+=A,R=1<<(D=E-U);D+U<L&&!((R-=T[D+U])<=0);)D++,R<<=1;if(Q+=1<<D,h===1&&852<Q||h===2&&592<Q)return 1;g[j=K&_]=W<<24|D<<16|S-p|0}}return K!==0&&(g[S+K]=E-U<<24|64<<16|0),x.bits=W,0}},{"../utils/common":41}],51:[function(r,n,s){n.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},{}],52:[function(r,n,s){var i=r("../utils/common"),o=0,l=1;function c(G){for(var re=G.length;0<=--re;)G[re]=0}var u=0,h=29,d=256,f=d+1+h,m=30,g=19,p=2*f+1,v=15,x=16,b=7,w=256,j=16,_=17,S=18,k=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],P=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],C=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],M=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],I=new Array(2*(f+2));c(I);var E=new Array(2*m);c(E);var B=new Array(512);c(B);var A=new Array(256);c(A);var L=new Array(h);c(L);var W,D,U,R=new Array(m);function Q(G,re,le,ce,ae){this.static_tree=G,this.extra_bits=re,this.extra_base=le,this.elems=ce,this.max_length=ae,this.has_stree=G&&G.length}function K(G,re){this.dyn_tree=G,this.max_code=0,this.stat_desc=re}function z(G){return G<256?B[G]:B[256+(G>>>7)]}function N(G,re){G.pending_buf[G.pending++]=255&re,G.pending_buf[G.pending++]=re>>>8&255}function T(G,re,le){G.bi_valid>x-le?(G.bi_buf|=re<<G.bi_valid&65535,N(G,G.bi_buf),G.bi_buf=re>>x-G.bi_valid,G.bi_valid+=le-x):(G.bi_buf|=re<<G.bi_valid&65535,G.bi_valid+=le)}function $(G,re,le){T(G,le[2*re],le[2*re+1])}function V(G,re){for(var le=0;le|=1&G,G>>>=1,le<<=1,0<--re;);return le>>>1}function q(G,re,le){var ce,ae,me=new Array(v+1),xe=0;for(ce=1;ce<=v;ce++)me[ce]=xe=xe+le[ce-1]<<1;for(ae=0;ae<=re;ae++){var pe=G[2*ae+1];pe!==0&&(G[2*ae]=V(me[pe]++,pe))}}function te(G){var re;for(re=0;re<f;re++)G.dyn_ltree[2*re]=0;for(re=0;re<m;re++)G.dyn_dtree[2*re]=0;for(re=0;re<g;re++)G.bl_tree[2*re]=0;G.dyn_ltree[2*w]=1,G.opt_len=G.static_len=0,G.last_lit=G.matches=0}function X(G){8<G.bi_valid?N(G,G.bi_buf):0<G.bi_valid&&(G.pending_buf[G.pending++]=G.bi_buf),G.bi_buf=0,G.bi_valid=0}function ee(G,re,le,ce){var ae=2*re,me=2*le;return G[ae]<G[me]||G[ae]===G[me]&&ce[re]<=ce[le]}function ie(G,re,le){for(var ce=G.heap[le],ae=le<<1;ae<=G.heap_len&&(ae<G.heap_len&&ee(re,G.heap[ae+1],G.heap[ae],G.depth)&&ae++,!ee(re,ce,G.heap[ae],G.depth));)G.heap[le]=G.heap[ae],le=ae,ae<<=1;G.heap[le]=ce}function oe(G,re,le){var ce,ae,me,xe,pe=0;if(G.last_lit!==0)for(;ce=G.pending_buf[G.d_buf+2*pe]<<8|G.pending_buf[G.d_buf+2*pe+1],ae=G.pending_buf[G.l_buf+pe],pe++,ce===0?$(G,ae,re):($(G,(me=A[ae])+d+1,re),(xe=k[me])!==0&&T(G,ae-=L[me],xe),$(G,me=z(--ce),le),(xe=P[me])!==0&&T(G,ce-=R[me],xe)),pe<G.last_lit;);$(G,w,re)}function we(G,re){var le,ce,ae,me=re.dyn_tree,xe=re.stat_desc.static_tree,pe=re.stat_desc.has_stree,be=re.stat_desc.elems,We=-1;for(G.heap_len=0,G.heap_max=p,le=0;le<be;le++)me[2*le]!==0?(G.heap[++G.heap_len]=We=le,G.depth[le]=0):me[2*le+1]=0;for(;G.heap_len<2;)me[2*(ae=G.heap[++G.heap_len]=We<2?++We:0)]=1,G.depth[ae]=0,G.opt_len--,pe&&(G.static_len-=xe[2*ae+1]);for(re.max_code=We,le=G.heap_len>>1;1<=le;le--)ie(G,me,le);for(ae=be;le=G.heap[1],G.heap[1]=G.heap[G.heap_len--],ie(G,me,1),ce=G.heap[1],G.heap[--G.heap_max]=le,G.heap[--G.heap_max]=ce,me[2*ae]=me[2*le]+me[2*ce],G.depth[ae]=(G.depth[le]>=G.depth[ce]?G.depth[le]:G.depth[ce])+1,me[2*le+1]=me[2*ce+1]=ae,G.heap[1]=ae++,ie(G,me,1),2<=G.heap_len;);G.heap[--G.heap_max]=G.heap[1],function(Ve,br){var ra,mn,Qi,At,Ta,Lc,Ur=br.dyn_tree,Jp=br.max_code,fw=br.stat_desc.static_tree,Zp=br.stat_desc.has_stree,eg=br.stat_desc.extra_bits,tg=br.stat_desc.extra_base,ni=br.stat_desc.max_length,Mn=0;for(At=0;At<=v;At++)Ve.bl_count[At]=0;for(Ur[2*Ve.heap[Ve.heap_max]+1]=0,ra=Ve.heap_max+1;ra<p;ra++)ni<(At=Ur[2*Ur[2*(mn=Ve.heap[ra])+1]+1]+1)&&(At=ni,Mn++),Ur[2*mn+1]=At,Jp<mn||(Ve.bl_count[At]++,Ta=0,tg<=mn&&(Ta=eg[mn-tg]),Lc=Ur[2*mn],Ve.opt_len+=Lc*(At+Ta),Zp&&(Ve.static_len+=Lc*(fw[2*mn+1]+Ta)));if(Mn!==0){do{for(At=ni-1;Ve.bl_count[At]===0;)At--;Ve.bl_count[At]--,Ve.bl_count[At+1]+=2,Ve.bl_count[ni]--,Mn-=2}while(0<Mn);for(At=ni;At!==0;At--)for(mn=Ve.bl_count[At];mn!==0;)Jp<(Qi=Ve.heap[--ra])||(Ur[2*Qi+1]!==At&&(Ve.opt_len+=(At-Ur[2*Qi+1])*Ur[2*Qi],Ur[2*Qi+1]=At),mn--)}}(G,re),q(me,We,G.bl_count)}function O(G,re,le){var ce,ae,me=-1,xe=re[1],pe=0,be=7,We=4;for(xe===0&&(be=138,We=3),re[2*(le+1)+1]=65535,ce=0;ce<=le;ce++)ae=xe,xe=re[2*(ce+1)+1],++pe<be&&ae===xe||(pe<We?G.bl_tree[2*ae]+=pe:ae!==0?(ae!==me&&G.bl_tree[2*ae]++,G.bl_tree[2*j]++):pe<=10?G.bl_tree[2*_]++:G.bl_tree[2*S]++,me=ae,We=(pe=0)===xe?(be=138,3):ae===xe?(be=6,3):(be=7,4))}function F(G,re,le){var ce,ae,me=-1,xe=re[1],pe=0,be=7,We=4;for(xe===0&&(be=138,We=3),ce=0;ce<=le;ce++)if(ae=xe,xe=re[2*(ce+1)+1],!(++pe<be&&ae===xe)){if(pe<We)for(;$(G,ae,G.bl_tree),--pe!=0;);else ae!==0?(ae!==me&&($(G,ae,G.bl_tree),pe--),$(G,j,G.bl_tree),T(G,pe-3,2)):pe<=10?($(G,_,G.bl_tree),T(G,pe-3,3)):($(G,S,G.bl_tree),T(G,pe-11,7));me=ae,We=(pe=0)===xe?(be=138,3):ae===xe?(be=6,3):(be=7,4)}}c(R);var Z=!1;function H(G,re,le,ce){T(G,(u<<1)+(ce?1:0),3),function(ae,me,xe,pe){X(ae),N(ae,xe),N(ae,~xe),i.arraySet(ae.pending_buf,ae.window,me,xe,ae.pending),ae.pending+=xe}(G,re,le)}s._tr_init=function(G){Z||(function(){var re,le,ce,ae,me,xe=new Array(v+1);for(ae=ce=0;ae<h-1;ae++)for(L[ae]=ce,re=0;re<1<<k[ae];re++)A[ce++]=ae;for(A[ce-1]=ae,ae=me=0;ae<16;ae++)for(R[ae]=me,re=0;re<1<<P[ae];re++)B[me++]=ae;for(me>>=7;ae<m;ae++)for(R[ae]=me<<7,re=0;re<1<<P[ae]-7;re++)B[256+me++]=ae;for(le=0;le<=v;le++)xe[le]=0;for(re=0;re<=143;)I[2*re+1]=8,re++,xe[8]++;for(;re<=255;)I[2*re+1]=9,re++,xe[9]++;for(;re<=279;)I[2*re+1]=7,re++,xe[7]++;for(;re<=287;)I[2*re+1]=8,re++,xe[8]++;for(q(I,f+1,xe),re=0;re<m;re++)E[2*re+1]=5,E[2*re]=V(re,5);W=new Q(I,k,d+1,f,v),D=new Q(E,P,0,m,v),U=new Q(new Array(0),C,0,g,b)}(),Z=!0),G.l_desc=new K(G.dyn_ltree,W),G.d_desc=new K(G.dyn_dtree,D),G.bl_desc=new K(G.bl_tree,U),G.bi_buf=0,G.bi_valid=0,te(G)},s._tr_stored_block=H,s._tr_flush_block=function(G,re,le,ce){var ae,me,xe=0;0<G.level?(G.strm.data_type===2&&(G.strm.data_type=function(pe){var be,We=4093624447;for(be=0;be<=31;be++,We>>>=1)if(1&We&&pe.dyn_ltree[2*be]!==0)return o;if(pe.dyn_ltree[18]!==0||pe.dyn_ltree[20]!==0||pe.dyn_ltree[26]!==0)return l;for(be=32;be<d;be++)if(pe.dyn_ltree[2*be]!==0)return l;return o}(G)),we(G,G.l_desc),we(G,G.d_desc),xe=function(pe){var be;for(O(pe,pe.dyn_ltree,pe.l_desc.max_code),O(pe,pe.dyn_dtree,pe.d_desc.max_code),we(pe,pe.bl_desc),be=g-1;3<=be&&pe.bl_tree[2*M[be]+1]===0;be--);return pe.opt_len+=3*(be+1)+5+5+4,be}(G),ae=G.opt_len+3+7>>>3,(me=G.static_len+3+7>>>3)<=ae&&(ae=me)):ae=me=le+5,le+4<=ae&&re!==-1?H(G,re,le,ce):G.strategy===4||me===ae?(T(G,2+(ce?1:0),3),oe(G,I,E)):(T(G,4+(ce?1:0),3),function(pe,be,We,Ve){var br;for(T(pe,be-257,5),T(pe,We-1,5),T(pe,Ve-4,4),br=0;br<Ve;br++)T(pe,pe.bl_tree[2*M[br]+1],3);F(pe,pe.dyn_ltree,be-1),F(pe,pe.dyn_dtree,We-1)}(G,G.l_desc.max_code+1,G.d_desc.max_code+1,xe+1),oe(G,G.dyn_ltree,G.dyn_dtree)),te(G),ce&&X(G)},s._tr_tally=function(G,re,le){return G.pending_buf[G.d_buf+2*G.last_lit]=re>>>8&255,G.pending_buf[G.d_buf+2*G.last_lit+1]=255&re,G.pending_buf[G.l_buf+G.last_lit]=255&le,G.last_lit++,re===0?G.dyn_ltree[2*le]++:(G.matches++,re--,G.dyn_ltree[2*(A[le]+d+1)]++,G.dyn_dtree[2*z(re)]++),G.last_lit===G.lit_bufsize-1},s._tr_align=function(G){T(G,2,3),$(G,w,I),function(re){re.bi_valid===16?(N(re,re.bi_buf),re.bi_buf=0,re.bi_valid=0):8<=re.bi_valid&&(re.pending_buf[re.pending++]=255&re.bi_buf,re.bi_buf>>=8,re.bi_valid-=8)}(G)}},{"../utils/common":41}],53:[function(r,n,s){n.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(r,n,s){(function(i){(function(o,l){if(!o.setImmediate){var c,u,h,d,f=1,m={},g=!1,p=o.document,v=Object.getPrototypeOf&&Object.getPrototypeOf(o);v=v&&v.setTimeout?v:o,c={}.toString.call(o.process)==="[object process]"?function(j){process.nextTick(function(){b(j)})}:function(){if(o.postMessage&&!o.importScripts){var j=!0,_=o.onmessage;return o.onmessage=function(){j=!1},o.postMessage("","*"),o.onmessage=_,j}}()?(d="setImmediate$"+Math.random()+"$",o.addEventListener?o.addEventListener("message",w,!1):o.attachEvent("onmessage",w),function(j){o.postMessage(d+j,"*")}):o.MessageChannel?((h=new MessageChannel).port1.onmessage=function(j){b(j.data)},function(j){h.port2.postMessage(j)}):p&&"onreadystatechange"in p.createElement("script")?(u=p.documentElement,function(j){var _=p.createElement("script");_.onreadystatechange=function(){b(j),_.onreadystatechange=null,u.removeChild(_),_=null},u.appendChild(_)}):function(j){setTimeout(b,0,j)},v.setImmediate=function(j){typeof j!="function"&&(j=new Function(""+j));for(var _=new Array(arguments.length-1),S=0;S<_.length;S++)_[S]=arguments[S+1];var k={callback:j,args:_};return m[f]=k,c(f),f++},v.clearImmediate=x}function x(j){delete m[j]}function b(j){if(g)setTimeout(b,0,j);else{var _=m[j];if(_){g=!0;try{(function(S){var k=S.callback,P=S.args;switch(P.length){case 0:k();break;case 1:k(P[0]);break;case 2:k(P[0],P[1]);break;case 3:k(P[0],P[1],P[2]);break;default:k.apply(l,P)}})(_)}finally{x(j),g=!1}}}}
869function w(j){j.source===o&&typeof j.data=="string"&&j.data.indexOf(d)===0&&b(+j.data.slice(d.length))}})(typeof self>"u"?i===void 0?this:i:self)}).call(this,typeof Co<"u"?Co:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})})(aB);var rde=aB.exports;const nde=mt(rde),Bg=[{id:"consonants-isolated",label:"Consonants (Isolated)",path:"consonants/isolated"},{id:"consonants-with-a",label:"Consonants (With A)",path:"consonants/with-a"},{id:"vowels",label:"Vowels",path:"vowels"},{id:"matras",label:"Matras",path:"matras"}];function sB(){const[e,t]=y.useState(Bg.map(f=>f.id)),[r,n]=y.useState(!1),[s,i]=y.useState(0),[o,l]=y.useState(""),c=f=>{t(m=>m.includes(f)?m.filter(g=>g!==f):[...m,f])},u=()=>t(Bg.map(f=>f.id)),h=()=>t([]),d=async()=>{if(e.length===0){Pe.error("Please select at least one category");return}n(!0),i(0),l("Initializing...");try{const f=new nde,m=Bg.filter(w=>e.includes(w.id));let g=0,p=0;for(const w of m){const{data:j,error:_}=await ne.storage.from("audio-files").list(w.path);!_&&j&&(g+=j.length)}if(g===0){Pe.error("No files found in selected categories"),n(!1);return}for(const w of m){l(`Downloading ${w.label}...`);const{data:j,error:_}=await ne.storage.from("audio-files").list(w.path);if(_||!j)continue;const S=f.folder(w.path);for(const k of j){const P=`${w.path}/${k.name}`,{data:C,error:M}=await ne.storage.from("audio-files").download(P);!M&&C&&(S==null||S.file(k.name,C)),p++,i(Math.round(p/g*100))}}l("Creating ZIP archive...");const v=await f.generateAsync({type:"blob"});l("Downloading...");const x=URL.createObjectURL(v),b=document.createElement("a");b.href=x,b.download=`malayalam-audio-backup-${new Date().toISOString().split("T")[0]}.zip`,document.body.appendChild(b),b.click(),document.body.removeChild(b),URL.revokeObjectURL(x),Pe.success(`Successfully downloaded ${p} audio files`)}catch(f){Pe.error(`Download failed: ${f.message}`)}finally{n(!1),i(0),l("")}};return a.jsxs(se,{children:[a.jsx(_e,{children:a.jsx(Se,{children:"Download Audio Backup"})}),a.jsxs(ue,{className:"space-y-4",children:[a.jsx("p",{className:"text-sm text-gray-600",children:"Download all audio files from Supabase Storage as a ZIP archive for backup purposes."}),a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"flex justify-between items-center",children:[a.jsx("h3",{className:"font-semibold",children:"Select Categories"}),a.jsxs("div",{className:"space-x-2",children:[a.jsx(Y,{variant:"ghost",size:"sm",onClick:u,children:"Select All"}),a.jsx(Y,{variant:"ghost",size:"sm",onClick:h,children:"Deselect All"})]})]}),Bg.map(f=>a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(pC,{id:f.id,checked:e.includes(f.id),onCheckedChange:()=>c(f.id),disabled:r}),a.jsx("label",{htmlFor:f.id,className:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70 cursor-pointer",children:f.label})]},f.id))]}),r&&a.jsxs("div",{className:"space-y-2",children:[a.jsx(_t,{value:s,className:"h-2"}),a.jsx("p",{className:"text-sm text-gray-600",children:o})]}),a.jsx(Y,{onClick:d,disabled:r||e.length===0,className:"w-full",children:r?a.jsxs(a.Fragment,{children:[a.jsx(Fe,{className:"w-4 h-4 mr-2 animate-spin"}),"Downloading..."]}):a.jsxs(a.Fragment,{children:[a.jsx(as,{className:"w-4 h-4 mr-2"}),"Download Backup (",e.length," ",e.length===1?"category":"categories",")"]})})]})]})}const Fu=[{ml:"ക്",rom:"ka"},{ml:"ഖ്",rom:"kha"},{ml:"ഗ്",rom:"ga"},{ml:"ഘ്",rom:"gha"},{ml:"ങ്",rom:"nga"},{ml:"ച്",rom:"cha"},{ml:"ഛ്",rom:"chha"},{ml:"ജ്",rom:"ja"},{ml:"ഝ്",rom:"jha"},{ml:"ഞ്",rom:"nya"},{ml:"ട്",rom:"tta"},{ml:"ഠ്",rom:"ttha"},{ml:"ഡ്",rom:"dda"},{ml:"ഢ്",rom:"ddha"},{ml:"ണ്",rom:"nna"},{ml:"ത്",rom:"tha"},{ml:"ഥ്",rom:"thha"},{ml:"ദ്",rom:"dha"},{ml:"ധ്",rom:"dhha"},{ml:"ന്",rom:"na"},{ml:"പ്",rom:"pa"},{ml:"ഫ്",rom:"pha"},{ml:"ബ്",rom:"ba"},{ml:"ഭ്",rom:"bha"},{ml:"മ്",rom:"ma"},{ml:"യ്",rom:"ya"},{ml:"ര്",rom:"ra"},{ml:"ല്",rom:"la"},{ml:"വ്",rom:"va"},{ml:"ശ്",rom:"sha"},{ml:"ഷ്",rom:"shha"},{ml:"സ്",rom:"sa"},{ml:"ഹ്",rom:"ha"},{ml:"ള്",rom:"lla"},{ml:"ഴ്",rom:"zha"},{ml:"റ്",rom:"rra"}],km=[{ml:"അ",rom:"a"},{ml:"ആ",rom:"aa"},{ml:"ഇ",rom:"i"},{ml:"ഈ",rom:"ii"},{ml:"ഉ",rom:"u"},{ml:"ഊ",rom:"uu"},{ml:"ഋ",rom:"ri"},{ml:"എ",rom:"e"},{ml:"ഏ",rom:"ee"},{ml:"ഐ",rom:"ai"},{ml:"ഒ",rom:"o"},{ml:"ഓ",rom:"oo"},{ml:"ഔ",rom:"au"}],Cm=[{ml:"ാ",rom:"aa"},{ml:"ി",rom:"i"},{ml:"ീ",rom:"ii"},{ml:"ു",rom:"u"},{ml:"ൂ",rom:"uu"},{ml:"ൃ",rom:"ri"},{ml:"െ",rom:"e"},{ml:"േ",rom:"ee"},{ml:"ൈ",rom:"ai"},{ml:"ൊ",rom:"o"},{ml:"ോ",rom:"oo"},{ml:"ൗ",rom:"au"}],By=e=>{let t="",r="";return e.type==="consonant-isolated"?(t=`${e.romanization}_isolated.mp3`,r="consonants/isolated"):e.type==="consonant-with-a"?(t=`${e.romanization}_with_a.mp3`,r="consonants/with-a"):e.type==="vowel"?(t=`${e.romanization}.mp3`,r="vowels"):e.type==="matra"&&(t=`matra_${e.romanization}.mp3`,r="matras"),{...e,filename:t,directory:r}},Ug=async(e,t)=>await Mf(e,t),iB=async()=>{const e=[],t={category:"Consonants (Isolated)",total:Fu.length,recorded:0,missing:[]},r={category:"Consonants (With A)",total:Fu.length,recorded:0,missing:[]};for(const i of Fu){const o=await Ug("consonants/isolated",`${i.rom}_isolated.mp3`),l=await Ug("consonants/with-a",`${i.rom}_with_a.mp3`);o?t.recorded++:t.missing.push(`${i.rom}_isolated.mp3`),l?r.recorded++:r.missing.push(`${i.rom}_with_a.mp3`)}e.push(t,r);const n={category:"Vowels",total:km.length,recorded:0,missing:[]};for(const i of km)await Ug("vowels",`${i.rom}.mp3`)?n.recorded++:n.missing.push(`${i.rom}.mp3`);e.push(n);const s={category:"Matras",total:Cm.length,recorded:0,missing:[]};for(const i of Cm)await Ug("matras",`matra_${i.rom}.mp3`)?s.recorded++:s.missing.push(`matra_${i.rom}.mp3`);return e.push(s),e};function ade(){var f;const[e,t]=y.useState("consonant-with-a"),[r,n]=y.useState(""),[s,i]=y.useState([]),[o,l]=y.useState(!1);y.useEffect(()=>{c()},[]);const c=async()=>
869{l(!0),gF(),$2();const m=await iB();i(m),l(!1)},u=()=>e.startsWith("consonant")?Fu:e==="vowel"?km:Cm,h=async(m,g)=>{if(!d)return;Pe.info("Uploading to cloud storage...");const p=await Nm(m,d.directory,d.filename,v=>console.log(`Upload progress: ${v}%`));p.success?(Pe.success(`Recording uploaded successfully: ${g}`),c()):Pe.error(`Upload failed: ${p.error}`)},d=r?By({malayalamChar:r,romanization:((f=u().find(m=>m.ml===r))==null?void 0:f.rom)||"",type:e}):null;return a.jsxs("div",{className:"min-h-screen bg-gray-50",children:[a.jsx(hs,{}),a.jsxs("div",{className:"container mx-auto py-8 px-4",children:[a.jsx(it,{to:"/audio-manager",children:a.jsx("div",{className:"mb-6 bg-gradient-to-r from-blue-600 to-indigo-600 rounded-2xl p-5 text-white shadow-lg hover:shadow-xl transition-all hover:scale-[1.01] cursor-pointer group",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-4",children:[a.jsx("div",{className:"w-12 h-12 rounded-xl bg-white/20 flex items-center justify-center",children:a.jsx(sm,{className:"w-6 h-6"})}),a.jsxs("div",{children:[a.jsx("h2",{className:"text-lg font-bold",children:"Drag & Drop Audio Upload Manager"}),a.jsx("p",{className:"text-blue-100 text-sm",children:"Bulk-upload MP3 files with auto-matching to Malayalam characters. See which files exist at a glance."})]})]}),a.jsx(rn,{className:"w-6 h-6 text-white/70 group-hover:translate-x-1 transition-transform"})]})})}),a.jsx("h1",{className:"text-4xl font-bold mb-8",children:"Audio Recording Admin"}),a.jsxs(Pn,{defaultValue:"troubleshoot",className:"space-y-6",children:[a.jsxs(fn,{className:"flex-wrap",children:[a.jsx(Oe,{value:"troubleshoot",children:"Audio File Diagnostics"}),a.jsx(Oe,{value:"diagnostics",children:"Test Audio Files"}),a.jsx(Oe,{value:"auto-generate",children:"Auto-Generate"}),a.jsx(Oe,{value:"record",children:"Record Audio"}),a.jsx(Oe,{value:"batch",children:"Batch Upload"}),a.jsx(Oe,{value:"coverage",children:"Coverage Stats"}),a.jsx(Oe,{value:"download",children:"Download Backup"})]}),a.jsx(ze,{value:"troubleshoot",children:a.jsx(Gue,{})}),a.jsx(ze,{value:"diagnostics",children:a.jsx(que,{})}),a.jsxs(ze,{value:"auto-generate",children:[a.jsxs(se,{children:[a.jsx(_e,{children:a.jsx(Se,{children:"Quick Start: Generate 10 Core Audio Files"})}),a.jsxs(ue,{children:[a.jsxs("div",{className:"mb-6 p-4 bg-blue-50 rounded-lg",children:[a.jsxs("p",{className:"text-sm text-blue-900 mb-2",children:[a.jsx("strong",{children:"Instant Solution:"})," Click below to instantly create placeholder audio files for the 10 most common Malayalam characters. This will make the audio buttons work immediately."]}),a.jsx("p",{className:"text-xs text-blue-700",children:'Note: These are temporary files. For best quality, use the "Record Audio" tab to record proper pronunciations, or upload professional audio via "Batch Upload".'})]}),a.jsx(Que,{})]})]}),a.jsxs(se,{className:"mt-6",children:[a.jsx(_e,{children:a.jsx(Se,{children:"Advanced: Google TTS Auto-Generation"})}),a.jsx(ue,{children:a.jsx(Kue,{})})]})]}),a.jsx(ze,{value:"record",children:a.jsxs(se,{children:[a.jsx(_e,{children:a.jsx(Se,{children:"Record Native Speaker Audio"})}),a.jsxs(ue,{className:"space-y-6",children:[a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium mb-2",children:"Audio Type"}),a.jsxs(Nr,{value:e,onValueChange:m=>t(m),children:[a.jsx(gr,{children:a.jsx(kr,{})}),a.jsxs(yr,{children:[a.jsx(Le,{value:"consonant-isolated",children:"Consonant (Isolated)"}),a.jsx(Le,{value:"consonant-with-a",children:"Consonant (With A)"}),a.jsx(Le,{value:"vowel",children:"Vowel"}),a.jsx(Le,{value:"matra",children:"Matra"})]})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium mb-2",children:"Character"}),a.jsxs(Nr,{value:r,onValueChange:n,children:[a.jsx(gr,{children:a.jsx(kr,{placeholder:"Select character"})}),a.jsx(yr,{children:u().map(m=>a.jsxs(Le,{value:m.ml,children:[m.ml," (",m.rom,")"]},m.ml))})]})]})]}),d&&a.jsxs("div",{className:"bg-blue-50 p-4 rounded-lg",children:[a.jsx("p",{className:"text-sm font-medium",children:"File will be saved as:"}),a.jsx("p",{className:"text-lg font-mono mt-1",children:d.filename}),a.jsxs("p",{className:"text-sm text-gray-600 mt-1",children:["Directory: /audio/",d.directory,"/"]})]}),r&&a.jsx(Vue,{suggestedFilename:(d==null?void 0:d.filename)||"audio.mp3",onRecordingComplete:h})]})]})}),a.jsx(ze,{value:"batch",children:a.jsxs(se,{children:[a.jsx(_e,{children:a.jsx(Se,{children:"Enhanced Batch Upload"})}),a.jsxs(ue,{children:[a.jsxs("div",{className:"mb-4",children:[a.jsx("h3",{className:"font-semibold mb-2",children:"Naming Conventions:"}),a.jsxs("ul",{className:"text-sm text-gray-600 space-y-1",children:[a.jsxs("li",{children:["• Consonants (isolated): ",a.jsx("code",{className:"bg-gray-100 px-1 rounded",children:"ka_isolated.mp3"})]}),a.jsxs("li",{children:["• Consonants (with 'a'): ",a.jsx("code",{className:"bg-gray-100 px-1 rounded",children:"ka_with_a.mp3"})]}),a.jsxs("li",{children:["• Vowels: ",a.jsx("code",{className:"bg-gray-100 px-1 rounded",children:"a.mp3"}),", ",a.jsx("code",{className:"bg-gray-100 px-1 rounded",children:"aa.mp3"})]}),a.jsxs("li",{children:["• Matras: ",a.jsx("code",{className:"bg-gray-100 px-1 rounded",children:"matra_aa.mp3"})]})]})]}),a.jsx(Xz,{onUploadComplete:c})]})]})}),a.jsxs(ze,{value:"coverage",children:[a.jsxs("div",{className:"flex justify-between items-center mb-4",children:[a.jsx("h2",{className:"text-2xl font-bold",children:"Audio File Coverage"}),a.jsxs(Y,{onClick:c,variant:"outline",disabled:o,children:[a.jsx(Xt,{className:`w-4 h-4 mr-2 ${o?"animate-spin":""}`}),"Refresh"]})]}),a.jsx(Yz,{coverageData:s})]}),a.jsx(ze,{value:"download",children:a.jsx(sB,{})})]})]})]})}const sde=[{malayalam:"ഇ",ipa:"/i/",length:"short",position:"front",height:"close"},{malayalam:"ഈ",ipa:"/iː/",length:"long",position:"front",height:"close"},{malayalam:"ഉ",ipa:"/u/",length:"short",position:"central",height:"close"},{malayalam:"ഊ",ipa:"/uː/",length:"long",position:"central",height:"close"},{malayalam:"ഉ",ipa:"/u/",length:"short",position:"back",height:"close"},{malayalam:"ഊ",ipa:"/uː/",length:"long",position:"back",height:"close"},{malayalam:"എ",ipa:"/e/",length:"short",position:"front",height:"mid"},{malayalam:"ഏ",ipa:"/eː/",length:"long",position:"front",height:"mid"},{malayalam:"ഒ",ipa:"/o/",length:"short",position:"central",height:"mid"},{malayalam:"ഓ",ipa:"/oː/",length:"long",position:"central",height:"mid"},{malayalam:"അ",ipa:"/a/",length:"short",position:"central",height:"open"},{malayalam:"ആ",ipa:"/aː/",length:"long",position:"central",height:"open"}],ide=[{malayalam:"മ",ipa:"/m/",manner:"nasal",place:"labial"},{malayalam:"ന",ipa:"/n̪/",manner:"nasal",place:"dental"},{malayalam:"ന",ipa:"/n/",manner:"nasal",place:"alveolar"},{malayalam:"ണ",ipa:"/ɳ/",manner:"nasal",place:"retroflex"},{malayalam:"ഞ",ipa:"/ɲ/",manner:"nasal",place:"palatal"},{malayalam:"ങ",ipa:"/ŋ/",manner:"nasal",place:"velar"},{malayalam:"പ",ipa:"/p/",manner:"stop",place:"labial",aspirated:!1},{malayalam:"ബ",ipa:"/b/",manner:"stop",place:"labial",aspirated:!1},{malayalam:"ത",ipa:"/t̪/",manner:"stop",place:"dental",aspirated:!1},{malayalam:"ദ",ipa:"/d̪/",manner:"stop",place:"dental",aspirated:!1},{malayalam:"ട",ipa:"/ʈ/",manner:"stop",place:"retroflex",aspirated:!1},{malayalam:"ഡ",ipa:"/ɖ/",manner:"stop",place:"retroflex",aspirated:!1},{malayalam:"ച",ipa:"/t͡ʃ/",manner:"stop",place:"palatal",aspirated:!1},{malayalam:"ജ",ipa:"/d͡ʒ/",manner:"stop",place:"palatal",aspirated:!1},{malayalam:"ക",ipa:"/k/",manner:"stop",place:"velar",aspirated:!1},{malayalam:"ഗ",ipa:"/ɡ/",manner:"stop",place:"velar",aspirated:!1},{malayalam:"ഫ",ipa:"/pʰ/",manner:"stop",place:"labial",aspirated:!0},{malayalam:"ഭ",ipa:"/bʰ/",manner:"stop",place:"labial",aspirated:!0},{malayalam:"ഥ",ipa:"/t̪ʰ/",manner:"stop",place:"dental",aspirated:!0},{malayalam:"ധ",ipa:"/d̪ʰ/",manner:"stop",place:"dental",aspirated:!0},{malayalam:"ഠ",ipa:"/ʈʰ/",manner:"stop",place:"retroflex",aspirated:!0},{malayalam:"ഢ",ipa:"/ɖʰ/",manner:"stop",place:"retroflex",aspirated:!0},{malayalam:"ഛ",ipa:"/t͡ʃʰ/",manner:"stop",place:"palatal",aspirated:!0},{malayalam:"ഝ",ipa:"/d͡ʒʰ/",manner:"stop",place:"palatal",aspirated:!0},{malayalam:"ഖ",ipa:"/kʰ/",manner:"stop",place:"velar",aspirated:!0},{malayalam:"ഘ",ipa:"/ɡʰ/",manner:"stop",place:"velar",aspirated:!0},{malayalam:"ഫ",ipa:"/f/",manner:"fricative",place:"labial"},{malayalam:"സ",ipa:"/s/",manner:"fricative",place:"alveolar"},{malayalam:"ഷ",ipa:"/ʂ/",manner:"fricative",place:"retroflex"},{malayalam:"ശ",ipa:"/ɕ/",manner:"fricative",place:"palatal"},{malayalam:"ഹ",ipa:"/h/",manner:"fricative",place:"glottal"},{malayalam:"വ",ipa:"/ʋ/",manner:"approximant-central",place:"labial"},{malayalam:"ഴ",ipa:"/ɻ/",manner:"approximant-central",place:"retroflex"},{malayalam:"യ",ipa:"/j/",manner:"approximant-central",place:"palatal"},{malayalam:"ല",ipa:"/l/",manner:"approximant-lateral",place:"alveolar"},{malayalam:"ള",ipa:"/ɭ/",manner:"approximant-lateral",place:"retroflex"},{malayalam:"ര",ipa:"/r/",manner:"rhotic",place:"alveolar"},{malayalam:"റ",ipa:"/r/",manner:"rhotic",place:"alveolar"}],ode=()=>{const[e,t]=y.useState(null),r=async(l,c)=>{t(l);try{await Fr(l,{type:c,onEnd:()=>t(null)})}catch(u){console.error("Error playing audio:",u),t(null)}},n={close:{front:[],central:[],back:[]},mid:{front:[],central:[],back:[]},open:{front:[],central:[],back:[]}};sde.forEach(l=>{n[l.height]&&n[l.height][l.position]&&n[l.height][l.position].push(l)});
869const s=["labial","dental","alveolar","retroflex","palatal","velar","glottal"],i=(l,c,u)=>ide.filter(h=>h.manner===l&&h.place===c&&(u===void 0||h.aspirated===u)),o=({letter:l,type:c})=>{const u=e===l.malayalam;return a.jsxs("div",{onClick:()=>r(l.malayalam,c),className:`cursor-pointer transition-all duration-200 hover:bg-blue-100 rounded p-1 ${u?"bg-blue-200 scale-110 shadow-lg":""}`,title:"Click to hear pronunciation",children:[a.jsxs("div",{className:"text-2xl mb-1 flex items-center justify-center gap-1",children:[l.malayalam,u&&a.jsx(Xe,{className:"w-4 h-4 text-blue-600 animate-pulse"})]}),a.jsx("div",{className:"text-sm text-gray-600",children:l.ipa})]})};return a.jsxs("div",{className:"space-y-8",children:[a.jsx("div",{className:"bg-gradient-to-r from-blue-50 to-indigo-50 p-4 rounded-lg border border-blue-200",children:a.jsxs("p",{className:"text-sm text-gray-700 flex items-center gap-2",children:[a.jsx(Xe,{className:"w-5 h-5 text-blue-600"}),a.jsx("strong",{children:"Click on any letter"})," to hear its pronunciation"]})}),a.jsxs(se,{children:[a.jsx(_e,{children:a.jsx(Se,{className:"text-2xl",children:"Vowel Classification"})}),a.jsx(ue,{children:a.jsx("div",{className:"overflow-x-auto",children:a.jsxs("table",{className:"w-full border-collapse",children:[a.jsxs("thead",{children:[a.jsxs("tr",{className:"bg-gray-100",children:[a.jsx("th",{className:"border p-3 text-left font-semibold"}),a.jsx("th",{className:"border p-3 text-center font-semibold",colSpan:2,children:"Front"}),a.jsx("th",{className:"border p-3 text-center font-semibold",colSpan:2,children:"Central"}),a.jsx("th",{className:"border p-3 text-center font-semibold",colSpan:2,children:"Back"})]}),a.jsxs("tr",{className:"bg-gray-50",children:[a.jsx("th",{className:"border p-2"}),a.jsx("th",{className:"border p-2 text-sm",children:"Short"}),a.jsx("th",{className:"border p-2 text-sm",children:"Long"}),a.jsx("th",{className:"border p-2 text-sm",children:"Short"}),a.jsx("th",{className:"border p-2 text-sm",children:"Long"}),a.jsx("th",{className:"border p-2 text-sm",children:"Short"}),a.jsx("th",{className:"border p-2 text-sm",children:"Long"})]})]}),a.jsx("tbody",{children:["close","mid","open"].map(l=>a.jsxs("tr",{children:[a.jsx("td",{className:"border p-3 font-semibold capitalize bg-gray-50",children:l}),["front","central","back"].map(c=>{var d,f;const u=(d=n[l][c])==null?void 0:d.find(m=>m.length==="short"),h=(f=n[l][c])==null?void 0:f.find(m=>m.length==="long");return a.jsxs(J.Fragment,{children:[a.jsx("td",{className:"border p-3 text-center",children:u&&a.jsx(o,{letter:u,type:"vowel"})}),a.jsx("td",{className:"border p-3 text-center",children:h&&a.jsx(o,{letter:h,type:"vowel"})})]},c)})]},l))})]})})})]}),a.jsxs(se,{children:[a.jsx(_e,{children:a.jsx(Se,{className:"text-2xl",children:"Consonant Classification"})}),a.jsxs(ue,{children:[a.jsx("div",{className:"overflow-x-auto",children:a.jsxs("table",{className:"w-full border-collapse text-sm",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"bg-gray-100",children:[a.jsx("th",{className:"border p-2 text-left font-semibold",children:"Manner"}),s.map(l=>a.jsx("th",{className:"border p-2 text-center font-semibold capitalize",children:l},l))]})}),a.jsxs("tbody",{children:[a.jsxs("tr",{children:[a.jsx("td",{className:"border p-2 font-semibold bg-gray-50",children:"Nasal"}),s.map(l=>{const c=i("nasal",l);return a.jsx("td",{className:"border p-2 text-center",children:c.map((u,h)=>a.jsx("div",{className:"mb-1",children:a.jsx(o,{letter:u,type:"consonant-with-a"})},h))},l)})]}),a.jsxs("tr",{children:[a.jsx("td",{className:"border p-2 font-semibold bg-gray-50",children:"Stop (plain)"}),s.map(l=>{const c=i("stop",l,!1);return a.jsx("td",{className:"border p-2 text-center",children:a.jsx("div",{className:"flex flex-wrap justify-center gap-1",children:c.map((u,h)=>a.jsx(o,{letter:u,type:"consonant-with-a"},h))})},l)})]}),a.jsxs("tr",{children:[a.jsx("td",{className:"border p-2 font-semibold bg-gray-50",children:"Stop (aspirated)"}),s.map(l=>{const c=i("stop",l,!0);return a.jsx("td",{className:"border p-2 text-center",children:a.jsx("div",{className:"flex flex-wrap justify-center gap-1",children:c.map((u,h)=>a.jsx(o,{letter:u,type:"consonant-with-a"},h))})},l)})]}),a.jsxs("tr",{children:[a.jsx("td",{className:"border p-2 font-semibold bg-gray-50",children:"Fricative"}
869),s.map(l=>{const c=i("fricative",l);return a.jsx("td",{className:"border p-2 text-center",children:c.map((u,h)=>a.jsx("div",{className:"mb-1",children:a.jsx(o,{letter:u,type:"consonant-with-a"})},h))},l)})]}),a.jsxs("tr",{children:[a.jsx("td",{className:"border p-2 font-semibold bg-gray-50",children:"Approximant (central)"}),s.map(l=>{const c=i("approximant-central",l);return a.jsx("td",{className:"border p-2 text-center",children:c.map((u,h)=>a.jsx("div",{className:"mb-1",children:a.jsx(o,{letter:u,type:"consonant-with-a"})},h))},l)})]}),a.jsxs("tr",{children:[a.jsx("td",{className:"border p-2 font-semibold bg-gray-50",children:"Approximant (lateral)"}),s.map(l=>{const c=i("approximant-lateral",l);return a.jsx("td",{className:"border p-2 text-center",children:c.map((u,h)=>a.jsx("div",{className:"mb-1",children:a.jsx(o,{letter:u,type:"consonant-with-a"})},h))},l)})]}),a.jsxs("tr",{children:[a.jsx("td",{className:"border p-2 font-semibold bg-gray-50",children:"Rhotic"}),s.map(l=>{const c=i("rhotic",l);return a.jsx("td",{className:"border p-2 text-center",children:c.map((u,h)=>a.jsx("div",{className:"mb-1",children:a.jsx(o,{letter:u,type:"consonant-with-a"})},h))},l)})]})]})]})}),a.jsxs("div",{className:"mt-6 p-4 bg-blue-50 rounded-lg",children:[a.jsx("h3",{className:"font-semibold mb-2",children:"Pronunciation Guide"}),a.jsxs("p",{className:"text-sm text-gray-700",children:[a.jsx("strong",{children:"Alveolar:"})," Sound articulated by the tongue on or near the upper alveoli (small pit or depression - the socket of a tooth). Examples: English consonants t, d, s, z, n."]})]})]})]})]})},lde=()=>a.jsxs("div",{className:"min-h-screen bg-gradient-to-br from-blue-50 via-indigo-50 to-purple-50",children:[a.jsx(hs,{}),a.jsxs("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-12",children:[a.jsxs("div",{className:"text-center mb-12",children:[a.jsx("h1",{className:"text-4xl md:text-5xl font-bold text-gray-900 mb-4",children:"Malayalam Phonetic Classification"}),a.jsx("p",{className:"text-lg text-gray-600 max-w-3xl mx-auto",children:"Complete reference guide showing how Malayalam letters are organized by their pronunciation characteristics and articulation points. Use this chart to understand the phonetic relationships between different letters."})]}),a.jsx(ode,{}),a.jsxs("div",{className:"mt-12 grid md:grid-cols-2 gap-6",children:[a.jsxs("div",{className:"bg-white rounded-lg shadow-md p-6",children:[a.jsx("h3",{className:"text-xl font-semibold mb-3 text-indigo-600",children:"Understanding Vowels"}),a.jsx("p",{className:"text-gray-700 mb-3",children:"Malayalam vowels are classified by three main characteristics:"}),a.jsxs("ul",{className:"list-disc list-inside space-y-2 text-gray-700",children:[a.jsxs("li",{children:[a.jsx("strong",{children:"Height:"})," How high the tongue is (close, mid, open)"]}),a.jsxs("li",{children:[a.jsx("strong",{children:"Position:"})," Where the tongue is (front, central, back)"]}),a.jsxs("li",{children:[a.jsx("strong",{children:"Length:"})," Duration of the sound (short or long)"]})]})]}),a.jsxs("div",{className:"bg-white rounded-lg shadow-md p-6",children:[a.jsx("h3",{className:"text-xl font-semibold mb-3 text-indigo-600",children:"Understanding Consonants"}),a.jsx("p",{className:"text-gray-700 mb-3",children:"Malayalam consonants are classified by:"}),a.jsxs("ul",{className:"list-disc list-inside space-y-2 text-gray-700",children:[a.jsxs("li",{children:[a.jsx("strong",{children:"Manner:"})," How the sound is produced (nasal, stop, fricative, etc.)"]}),a.jsxs("li",{children:[a.jsx("strong",{children:"Place:"})," Where in the mouth the sound is made"]}),a.jsxs("li",{children:[a.jsx("strong",{children:"Aspiration:"})," Whether the sound has a burst of air"]})]})]})]})]}),a.jsx(ob,{})]}),ff=[{id:"vowels",name:"Vowels",path:"vowels",description:"All vowel sounds"},{id:"consonants-isolated",name:"Consonants (Isolated)",path:"consonants/isolated",description:"Consonant sounds in isolation"},{id:"consonants-with-a",name:"Consonants (with അ)",path:"consonants/with-a",description:"Consonants with inherent vowel"},{id:"matras",name:"Matras",path:"matras",description:"Vowel signs (matras)"}];async function cde(e){const t=ff.find(i=>i.id===e);if(!t)return[];const r=[],{data:n,error:s}=await ne.storage.from("malayalam-audio").list(t.path);if(n&&!s)for(const i of n){const{data:o}=ne.storage.from("malayalam-audio").getPublicUrl(`${t.path}/${i.name}`);o!=null&&o.publicUrl&&r.push(o.publicUrl)}return r}function ude(e){if(e===0)return"0 Bytes";const t=1024,r=["Bytes","KB","MB","GB"],n=Math.floor(Math.log(e)/Math.log(t));return Math.round(e/Math.pow(t,n)*100)/100+" "+r[n]}
869async function dde(){return"serviceWorker"in navigator&&navigator.serviceWorker.controller?new Promise(e=>{const t=new MessageChannel;t.port1.onmessage=r=>{e(r.data.size||0)},navigator.serviceWorker.controller.postMessage({type:"GET_CACHE_SIZE"},[t.port2])}):0}async function hde(e){"serviceWorker"in navigator&&navigator.serviceWorker.controller&&navigator.serviceWorker.controller.postMessage({type:"CACHE_AUDIO",urls:e})}async function fde(){"serviceWorker"in navigator&&navigator.serviceWorker.controller&&navigator.serviceWorker.controller.postMessage({type:"CLEAR_CACHE"})}const mde=kp("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 shadow-sm",{variants:{variant:{default:"bg-background text-foreground",destructive:"border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive",success:"border-green-500/50 text-green-600 dark:text-green-400 [&>svg]:text-green-600 dark:[&>svg]:text-green-400 bg-green-50 dark:bg-green-950/20",warning:"border-yellow-500/50 text-yellow-600 dark:text-yellow-400 [&>svg]:text-yellow-600 dark:[&>svg]:text-yellow-400 bg-yellow-50 dark:bg-yellow-950/20",info:"border-primary/50 text-primary dark:text-primary-foreground [&>svg]:text-primary bg-primary/10 dark:bg-primary/20"}},defaultVariants:{variant:"default"}}),nn=y.forwardRef(({className:e,variant:t,...r},n)=>a.jsx("div",{ref:n,role:"alert",className:je(mde({variant:t}),e),...r}));nn.displayName="Alert";const pde=y.forwardRef(({className:e,...t},r)=>a.jsx("h5",{ref:r,className:je("mb-1 font-medium leading-none tracking-tight",e),...t}));pde.displayName="AlertTitle";const an=y.forwardRef(({className:e,...t},r)=>a.jsx("div",{ref:r,className:je("text-sm [&_p]:leading-relaxed opacity-90",e),...t}));an.displayName="AlertDescription";function gde(){const{cacheContent:e,clearCache:t}=s6(),[r,n]=y.useState(0),[s,i]=y.useState(!1),[o,l]=y.useState(0),[c,u]=y.useState(!1);y.useEffect(()=>{h()},[]);const h=async()=>{if("caches"in window){const g=await caches.keys();let p=0;for(const v of g){const x=await caches.open(v),b=await x.keys();for(const w of b){const j=await x.match(w);if(j){const _=await j.blob();p+=_.size}}}n(p)}},d=async()=>{i(!0),l(0);try{await e();for(let g=0;g<=100;g+=10)l(g),await new Promise(p=>setTimeout(p,200));await h(),u(!0),setTimeout(()=>u(!1),3e3)}catch(g){console.error("Download failed:",g)}finally{i(!1)}},f=async()=>{await t(),n(0)},m=g=>{if(g===0)return"0 B";const p=1024,v=["B","KB","MB","GB"],x=Math.floor(Math.log(g)/Math.log(p));return Math.round(g/Math.pow(p,x)*100)/100+" "+v[x]};return a.jsxs(se,{children:[a.jsxs(_e,{children:[a.jsxs(Se,{className:"flex items-center gap-2",children:[a.jsx(jD,{className:"h-5 w-5"}),"Offline Content"]}),a.jsx(hr,{children:"Download lessons and exercises for offline access"})]}),a.jsxs(ue,{className:"space-y-4",children:[c&&a.jsxs(nn,{className:"bg-green-50 border-green-200",children:[a.jsx(ot,{className:"h-4 w-4 text-green-600"}),a.jsx(an,{className:"text-green-800",children:"Content downloaded successfully!"})]}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-medium",children:"Cached Content"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:m(r)})]}),a.jsxs("div",{className:"flex gap-2",children:[a.jsxs(Y,{onClick:d,disabled:s,size:"sm",className:"gap-2",children:[a.jsx(as,{className:"h-4 w-4"}),"Download"]}),a.jsxs(Y,{onClick:f,disabled:s,variant:"outline",size:"sm",className:"gap-2",children:[a.jsx(Ls,{className:"h-4 w-4"}),"Clear"]})]})]}),s&&a.jsxs("div",{className:"space-y-2",children:[a.jsx(_t,{value:o}),a.jsxs("p",{className:"text-xs text-center text-muted-foreground",children:["Downloading content... ",o,"%"]})]}),a.jsxs("div",{className:"text-xs text-muted-foreground space-y-1",children:[a.jsx("p",{children:"• Vowels and consonants lessons"}),a.jsx("p",{children:"• Practice exercises and quizzes"}),a.jsx("p",{children:"• Flashcard sets"}),a.jsx("p",{children:"• Audio pronunciations"})]})]})]})}function yde(){const{isOnline:e,isSyncing:t,syncProgress:r}=s6();return e&&!t?null:a.jsxs("div",{className:"fixed bottom-4 right-4 z-50 max-w-md",children:[!e&&a.jsxs(nn,{className:"bg-yellow-50 border-yellow-200",children:[a.jsx(Xo,{className:"h-4 w-4 text-yellow-600"}),a.jsx(an,{className:"text-yellow-800",children:"You're offline. Changes will sync 
869when connection is restored."})]}),t&&a.jsxs(nn,{className:"bg-blue-50 border-blue-200",children:[a.jsx(Xt,{className:"h-4 w-4 text-blue-600 animate-spin"}),a.jsx(an,{className:"text-blue-800",children:"Syncing your progress..."})]}),e&&!t&&a.jsxs(Y,{onClick:r,variant:"outline",size:"sm",className:"gap-2",children:[a.jsx(XK,{className:"h-4 w-4"}),"Sync Now"]})]})}var yb="Collapsible",[vde,oB]=Cr(yb),[xde,gC]=vde(yb),lB=y.forwardRef((e,t)=>{const{__scopeCollapsible:r,open:n,defaultOpen:s,disabled:i,onOpenChange:o,...l}=e,[c,u]=ln({prop:n,defaultProp:s??!1,onChange:o,caller:yb});return a.jsx(xde,{scope:r,disabled:i,contentId:Tn(),open:c,onOpenToggle:y.useCallback(()=>u(h=>!h),[u]),children:a.jsx(Ce.div,{"data-state":vC(c),"data-disabled":i?"":void 0,...l,ref:t})})});lB.displayName=yb;var cB="CollapsibleTrigger",uB=y.forwardRef((e,t)=>{const{__scopeCollapsible:r,...n}=e,s=gC(cB,r);return a.jsx(Ce.button,{type:"button","aria-controls":s.contentId,"aria-expanded":s.open||!1,"data-state":vC(s.open),"data-disabled":s.disabled?"":void 0,disabled:s.disabled,...n,ref:t,onClick:ye(e.onClick,s.onOpenToggle)})});uB.displayName=cB;var yC="CollapsibleContent",dB=y.forwardRef((e,t)=>{const{forceMount:r,...n}=e,s=gC(yC,e.__scopeCollapsible);return a.jsx(vr,{present:r||s.open,children:({present:i})=>a.jsx(bde,{...n,ref:t,present:i})})});dB.displayName=yC;var bde=y.forwardRef((e,t)=>{const{__scopeCollapsible:r,present:n,children:s,...i}=e,o=gC(yC,r),[l,c]=y.useState(n),u=y.useRef(null),h=$e(t,u),d=y.useRef(0),f=d.current,m=y.useRef(0),g=m.current,p=o.open||l,v=y.useRef(p),x=y.useRef(void 0);return y.useEffect(()=>{const b=requestAnimationFrame(()=>v.current=!1);return()=>cancelAnimationFrame(b)},[]),Qt(()=>{const b=u.current;if(b){x.current=x.current||{transitionDuration:b.style.transitionDuration,animationName:b.style.animationName},b.style.transitionDuration="0s",b.style.animationName="none";const w=b.getBoundingClientRect();d.current=w.height,m.current=w.width,v.current||(b.style.transitionDuration=x.current.transitionDuration,b.style.animationName=x.current.animationName),c(n)}},[o.open,n]),a.jsx(Ce.div,{"data-state":vC(o.open),"data-disabled":o.disabled?"":void 0,id:o.contentId,hidden:!p,...i,ref:h,style:{"--radix-collapsible-content-height":f?`${f}px`:void 0,"--radix-collapsible-content-width":g?`${g}px`:void 0,...e.style},children:p&&s})});function vC(e){return e?"open":"closed"}var wde=lB,jde=uB,_de=dB,vs="Accordion",Sde=["Home","End","ArrowDown","ArrowUp","ArrowLeft","ArrowRight"],[xC,Nde,kde]=eh(vs),[vb]=Cr(vs,[kde,oB]),bC=oB(),hB=J.forwardRef((e,t)=>{const{type:r,...n}=e,s=n,i=n;return a.jsx(xC.Provider,{scope:e.__scopeAccordion,children:r==="multiple"?a.jsx(Ade,{...i,ref:t}):a.jsx(Tde,{...s,ref:t})})});hB.displayName=vs;var[fB,Cde]=vb(vs),[mB,Ede]=vb(vs,{collapsible:!1}),Tde=J.forwardRef((e,t)=>{const{value:r,defaultValue:n,onValueChange:s=()=>{},collapsible:i=!1,...o}=e,[l,c]=ln({prop:r,defaultProp:n??"",onChange:s,caller:vs});return a.jsx(fB,{scope:e.__scopeAccordion,value:J.useMemo(()=>l?[l]:[],[l]),onItemOpen:c,onItemClose:J.useCallback(()=>i&&c(""),[i,c]),children:a.jsx(mB,{scope:e.__scopeAccordion,collapsible:i,children:a.jsx(pB,{...o,ref:t})})})}),Ade=J.forwardRef((e,t)=>{const{value:r,defaultValue:n,onValueChange:s=()=>{},...i}=e,[o,l]=ln({prop:r,defaultProp:n??[],onChange:s,caller:vs}),c=J.useCallback(h=>l((d=[])=>[...d,h]),[l]),u=J.useCallback(h=>l((d=[])=>d.filter(f=>f!==h)),[l]);return a.jsx(fB,{scope:e.__scopeAccordion,value:o,onItemOpen:c,onItemClose:u,children:a.jsx(mB,{scope:e.__scopeAccordion,collapsible:!0,children:a.jsx(pB,{...i,ref:t})})})}),[Pde,xb]=vb(vs),pB=J.forwardRef((e,t)=>{const{__scopeAccordion:r,disabled:n,dir:s,orientation:i="vertical",...o}=e,l=J.useRef(null),c=$e(l,t),u=Nde(r),d=Pc(s)==="ltr",f=ye(e.onKeyDown,m=>{var P;if(!Sde.includes(m.key))return;const g=m.target,p=u().filter(C=>{var M;return!((M=C.ref.current)!=null&&M.disabled)}),v=p.findIndex(C=>C.ref.current===g),x=p.length;if(v===-1)return;m.preventDefault();let b=v;const w=0,j=x-1,_=()=>{b=v+1,b>j&&(b=w)},S=()=>{b=v-1,b<w&&(b=j)};switch(m.key){case"Home":b=w;break;case"End":b=j;break;case"ArrowRight":i==="horizontal"&&(d?_():S());break;case"ArrowDown":i==="vertical"&&_();break;case"ArrowLeft":i==="horizontal"&&(d?S():_());break;case"ArrowUp":i==="vertical"&&S();break}const k=b%x;(P=p[k].ref.current)==null||P.focus()});return a.jsx(Pde,{scope:r,disabled:n,direction:s,orientation:i,children:a.jsx(xC.Slot,{scope:r,children:a.jsx(Ce.div,{...o,"data-orientation":i,ref:c,onKeyDown:n?void 0:f})})})}),Xv="AccordionItem",[Ode,wC]=vb(Xv),gB=J.forwardRef((e,t)=>
869{const{__scopeAccordion:r,value:n,...s}=e,i=xb(Xv,r),o=Cde(Xv,r),l=bC(r),c=Tn(),u=n&&o.value.includes(n)||!1,h=i.disabled||e.disabled;return a.jsx(Ode,{scope:r,open:u,disabled:h,triggerId:c,children:a.jsx(wde,{"data-orientation":i.orientation,"data-state":jB(u),...l,...s,ref:t,disabled:h,open:u,onOpenChange:d=>{d?o.onItemOpen(n):o.onItemClose(n)}})})});gB.displayName=Xv;var yB="AccordionHeader",vB=J.forwardRef((e,t)=>{const{__scopeAccordion:r,...n}=e,s=xb(vs,r),i=wC(yB,r);return a.jsx(Ce.h3,{"data-orientation":s.orientation,"data-state":jB(i.open),"data-disabled":i.disabled?"":void 0,...n,ref:t})});vB.displayName=yB;var tS="AccordionTrigger",xB=J.forwardRef((e,t)=>{const{__scopeAccordion:r,...n}=e,s=xb(vs,r),i=wC(tS,r),o=Ede(tS,r),l=bC(r);return a.jsx(xC.ItemSlot,{scope:r,children:a.jsx(jde,{"aria-disabled":i.open&&!o.collapsible||void 0,"data-orientation":s.orientation,id:i.triggerId,...l,...n,ref:t})})});xB.displayName=tS;var bB="AccordionContent",wB=J.forwardRef((e,t)=>{const{__scopeAccordion:r,...n}=e,s=xb(vs,r),i=wC(bB,r),o=bC(r);return a.jsx(_de,{role:"region","aria-labelledby":i.triggerId,"data-orientation":s.orientation,...o,...n,ref:t,style:{"--radix-accordion-content-height":"var(--radix-collapsible-content-height)","--radix-accordion-content-width":"var(--radix-collapsible-content-width)",...e.style}})});wB.displayName=bB;function jB(e){return e?"open":"closed"}var Mde=hB,Rde=gB,$de=vB,_B=xB,SB=wB;const Ide=Mde,NB=y.forwardRef(({className:e,...t},r)=>a.jsx(Rde,{ref:r,className:je("border-b border-border/50",e),...t}));NB.displayName="AccordionItem";const kB=y.forwardRef(({className:e,children:t,...r},n)=>a.jsx($de,{className:"flex",children:a.jsxs(_B,{ref:n,className:je("flex flex-1 items-center justify-between py-4 font-medium transition-all hover:text-primary [&[data-state=open]>svg]:rotate-180 [&[data-state=open]]:text-primary",e),...r,children:[t,a.jsx(Cp,{className:"h-4 w-4 shrink-0 transition-transform duration-300 ease-in-out text-muted-foreground"})]})}));kB.displayName=_B.displayName;const CB=y.forwardRef(({className:e,children:t,...r},n)=>a.jsx(SB,{ref:n,className:"overflow-hidden text-sm text-muted-foreground transition-all data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down",...r,children:a.jsx("div",{className:je("pb-4 pt-0",e),children:t})}));CB.displayName=SB.displayName;const v1={low:{bitrate:32,sampleRate:22050,estimatedSize:240},medium:{bitrate:64,sampleRate:44100,estimatedSize:480},high:{bitrate:128,sampleRate:44100,estimatedSize:960}};async function Dde(e,t,r="medium"){try{const n=await fetch(e);if(!n.ok)throw new Error("Failed to download audio");const s=await n.blob(),i={id:`${t}-${r}`,lessonId:t,url:e,blob:s,quality:r,size:s.size,timestamp:Date.now()};await xn.addAudio(i)}catch(n){throw console.error("Error downloading audio:",n),n}}function Uy(e){if(e===0)return"0 B";const t=1024,r=["B","KB","MB","GB"],n=Math.floor(Math.log(e)/Math.log(t));return Math.round(e/Math.pow(t,n)*100)/100+" "+r[n]}var Lde=Symbol("radix.slottable");function Fde(e){const t=({children:r})=>a.jsx(a.Fragment,{children:r});return t.displayName=`${e}.Slottable`,t.__radixId=Lde,t}var EB="AlertDialog",[zde]=Cr(EB,[IF]),Gi=IF(),TB=e=>{const{__scopeAlertDialog:t,...r}=e,n=Gi(t);return a.jsx(JF,{...n,...r,modal:!0})};TB.displayName=EB;var Bde="AlertDialogTrigger",Ude=y.forwardRef((e,t)=>{const{__scopeAlertDialog:r,...n}=e,s=Gi(r);return a.jsx(ZF,{...s,...n,ref:t})});Ude.displayName=Bde;var Wde="AlertDialogPortal",AB=e=>{const{__scopeAlertDialog:t,...r}=e,n=Gi(t);return a.jsx(ez,{...n,...r})};AB.displayName=Wde;var Vde="AlertDialogOverlay",PB=y.forwardRef((e,t)=>{const{__scopeAlertDialog:r,...n}=e,s=Gi(r);return a.jsx(oC,{...s,...n,ref:t})});PB.displayName=Vde;var zu="AlertDialogContent",[Hde,qde]=zde(zu),Gde=Fde("AlertDialogContent"),OB=y.forwardRef((e,t)=>{const{__scopeAlertDialog:r,children:n,...s}=e,i=Gi(r),o=y.useRef(null),l=$e(t,o),c=y.useRef(null);return a.jsx(Dce,{contentName:zu,titleName:MB,docsSlug:"alert-dialog",children:a.jsx(Hde,{scope:r,cancelRef:c,children:a.jsxs(lC,{role:"alertdialog",...i,...s,ref:l,onOpenAutoFocus:ye(s.onOpenAutoFocus,u=>{var h;u.preventDefault(),(h=c.current)==null||h.focus({preventScroll:!0})}),onPointerDownOutside:u=>u.preventDefault(),onInteractOutside:u=>u.preventDefault(),children:[a.jsx(Gde,{children:n}),a.jsx(Yde,{contentRef:o})]})})})});OB.displayName=zu;var MB="AlertDialogTitle",RB=y.forwardRef((e,t)=>
869{const{__scopeAlertDialog:r,...n}=e,s=Gi(r);return a.jsx(cC,{...s,...n,ref:t})});RB.displayName=MB;var $B="AlertDialogDescription",IB=y.forwardRef((e,t)=>{const{__scopeAlertDialog:r,...n}=e,s=Gi(r);return a.jsx(uC,{...s,...n,ref:t})});IB.displayName=$B;var Kde="AlertDialogAction",DB=y.forwardRef((e,t)=>{const{__scopeAlertDialog:r,...n}=e,s=Gi(r);return a.jsx(dC,{...s,...n,ref:t})});DB.displayName=Kde;var LB="AlertDialogCancel",FB=y.forwardRef((e,t)=>{const{__scopeAlertDialog:r,...n}=e,{cancelRef:s}=qde(LB,r),i=Gi(r),o=$e(t,s);return a.jsx(dC,{...i,...n,ref:o})});FB.displayName=LB;var Yde=({contentRef:e})=>{const t=`\`${zu}\` requires a description for the component to be accessible for screen reader users.
870
871You can add a description to the \`${zu}\` by passing a \`${$B}\` component as a child, which also benefits sighted users by adding visible context to the dialog.
872
873Alternatively, you can use your own component as a description by assigning it an \`id\` and passing the same value to the \`aria-describedby\` prop in \`${zu}\`. If the description is confusing or duplicative for sighted users, you can use the \`@radix-ui/react-visually-hidden\` primitive as a wrapper around your description component.
874
875For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return y.useEffect(()=>{var n;document.getElementById((n=e.current)==null?void 0:n.getAttribute("aria-describedby"))||console.warn(t)},[t,e]),null},Xde=TB,Qde=AB,zB=PB,BB=OB,UB=DB,WB=FB,VB=RB,HB=IB;const Jde=Xde,Zde=Qde,qB=y.forwardRef(({className:e,...t},r)=>a.jsx(zB,{className:je("fixed inset-0 z-50 bg-background/80 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t,ref:r}));qB.displayName=zB.displayName;const GB=y.forwardRef(({className:e,...t},r)=>a.jsxs(Zde,{children:[a.jsx(qB,{}),a.jsx(BB,{ref:r,className:je("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-card p-6 shadow-lg duration-200 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-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",e),...t})]}));GB.displayName=BB.displayName;const KB=({className:e,...t})=>a.jsx("div",{className:je("flex flex-col space-y-2 text-center sm:text-left",e),...t});KB.displayName="AlertDialogHeader";const YB=({className:e,...t})=>a.jsx("div",{className:je("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2 mt-4",e),...t});YB.displayName="AlertDialogFooter";const XB=y.forwardRef(({className:e,...t},r)=>a.jsx(VB,{ref:r,className:je("text-lg font-semibold text-primary/90",e),...t}));XB.displayName=VB.displayName;const QB=y.forwardRef(({className:e,...t},r)=>a.jsx(HB,{ref:r,className:je("text-sm text-muted-foreground mt-2",e),...t}));QB.displayName=HB.displayName;const JB=y.forwardRef(({className:e,...t},r)=>a.jsx(UB,{ref:r,className:je(T2(),e),...t}));JB.displayName=UB.displayName;const ZB=y.forwardRef(({className:e,...t},r)=>a.jsx(WB,{ref:r,className:je(T2({variant:"outline"}),"mt-2 sm:mt-0",e),...t}));ZB.displayName=WB.displayName;function ehe({open:e,onOpenChange:t,onConfirm:r,title:n,itemCount:s,totalSize:i,type:o}){return a.jsx(Jde,{open:e,onOpenChange:t,children:a.jsxs(GB,{children:[a.jsxs(KB,{children:[a.jsx(XB,{children:n}),a.jsxs(QB,{className:"space-y-2",children:[a.jsxs("p",{children:["This will download ",s," ",o," files."]}),a.jsxs("p",{className:"font-semibold",children:["Total storage required: ",Uy(i)]}),a.jsx("p",{className:"text-xs",children:"Download progress will be shown in the category header."})]})]}),a.jsxs(YB,{children:[a.jsx(ZB,{children:"Cancel"}),a.jsx(JB,{onClick:r,children:"Download All"})]})]})})}const eO=[{id:"vowel-a",name:"അ (a)",character:"അ",type:"vowel",estimatedSize:45e3,audioCount:1},{id:"vowel-aa",name:"ആ (ā)",character:"ആ",type:"vowel",estimatedSize:45e3,audioCount:1},{id:"vowel-i",name:"ഇ (i)",character:"ഇ",type:"vowel",estimatedSize:45e3,audioCount:1},{id:"vowel-ii",name:"ഈ (ī)",character:"ഈ",type:"vowel",estimatedSize:45e3,audioCount:1},{id:"cons-ka",name:"ക (ka)",character:"ക",type:"consonant",estimatedSize:5e4,audioCount:2},{id:"cons-kha",name:"ഖ (kha)",character:"ഖ",type:"consonant",estimatedSize:5e4,audioCount:2},{id:"matra-aa",name:"ാ (ā matra)",character:"ാ",type:"matra",estimatedSize:4e4,audioCount:1},{id:"conjunct-kka",name:"ക്ക (kka)",character:"ക്ക",type:"conjunct",estimatedSize:55e3,audioCount:1}];function the(){const[e,t]=y.useState(new Set),[r,n]=y.useState(new Map),[s,i]=y.useState(new Set),[o,l]=y.useState("medium"),[c,u]=y.useState(new Map),[h,d]=y.useState(!1),[f,m]=y.useState(null);y.useEffect(()=>{g()},[]);const g=async()=>{try{const M=await xn.getLessons();t(new Set(M.map(E=>E.id)));const I=new Map;for(const E of eO){const B=await xn.getAudioByLessonId(E.id);B.length>0&&I.set(E.id,B[0].quality)}n(I)}catch(M){console.error("Failed to load cached data:",M)}},p=async M=>{i(I=>new Set(I).add(M.id));try{const I={id:M.id,type:M.type,content:{name:M.name,character:M.character},timestamp:Date.now()};await xn.addLesson(I),t(E=>new Set(E).add(M.id)),Pe.success(`${M.name} lesson downloaded`)}catch{Pe.error(`Failed to download ${M.name}`)}finally{i(I=>{const E=new Set(I);return E.delete(M.id),E})}},v=async M=>{const I=`${M.id}-audio`;i(E=>new Set(E).add(I));try{const E=`/audio/${M.type}/${M.id}.mp3`;await Dde(E,M.id,o),n(B=>new Map(B).set(M.id,o)),Pe.success(`${M.name} audio (${o}) downloaded`)}catch{Pe.error(`Failed to download audio for ${M.name}`)}finally{i(E=>{const B=new Set(E);return B.delete(I),B})}},x=async M=>{try{await xn.deleteLesson(M.id),t(I=>{const E=new Set(I);return E.delete(M.id),E}),Pe.success(`${M.name} lesson removed`)}catch{Pe.error(`Failed to remove ${M.name}`)}},b=async M=>{try{await xn.deleteAudioByLessonId(M.id),n(I=>{const E=new Map(I);return E.delete(M.id),E}),Pe.success(`${M.name} audio removed`)}catch{Pe.error("Failed to remove audio")}},w=async M=>{const I=P[M].filter(E=>!e.has(E.id));u(E=>new Map(E).set(`${M}-lessons`,{current:0,total:I.length}));for(let E=0;E<I.length;E++)await p(I[E]),u(B=>new Map(B).set(`${M}-lessons`,{current:E+1,total:I.length}));u(E=>{const B=new Map(E);return B.delete(`${M}-lessons`),B}),Pe.success(`Downloaded ${I.length} lessons`)},j=async M=>{const I=P[M].filter(E=>!r.has(E.id));u(E=>new Map(E).set(`${M}-audio`,{current:0,total:I.length}));for(let E=0;E<I.length;E++)await v(I[E]),u(B=>new Map(B).set(`${M}-audio`,{current:E+1,total:I.length}));u(E=>{const B=new Map(E);return B.delete(`${M}-audio`),B}),Pe.success(`Downloaded ${I.length} audio files`)},_=async M=>{const I=P[M].filter(E=>e.has(E.id));for(const E of I)await x(E);Pe.success(`Deleted ${I.length} lessons`)},S=async M=>{const I=P[M].filter(E=>r.has(E.id));for(const E of I)await b(E);Pe.success(`Deleted ${I.length} audio files`)},k=()=>{f&&(d(!1),f.action==="lessons"?w(f.type):j(f.type))},P=eO.reduce((M,I)=>(M[I.type]||(M[I.type]=[]),M[I.type].push(I),M),{}),C=M=>{const I=P[M]||[],E=I.filter(W=>e.has(W.id)).length,B=I.filter(W=>r.has(W.id)).length,A=I.reduce((W,D)=>W+D.estimatedSize,0),L=I.reduce((W,D)=>W+(D.audioCount||0)*v1[o].estimatedSize*60,0);return{total:I.length,cachedL:E,cachedA:B,totalSize:A,audioSize:L}};return a.jsxs(se,{children:[a.jsxs(_e,{children:[a.jsx(Se,{children:"Selective Lesson Downloads"}),a.jsx(hr,{children:"Download lessons and audio separately with quality control"})]}),a.jsxs(ue,{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center gap-4 p-4 bg-muted rounded-lg",children:[a.jsx("label",{className:"text-sm font-medium",children:"Audio Quality:"}),a.jsxs(Nr,{value:o,onValueChange:M=>l(M),children:[a.jsx(gr,{className:"w-[180px]",children:a.jsx(kr,{})}),a.jsxs(yr,{children:[a.jsx(Le,{value:"low",children:"Low (32 kbps)"}),a.jsx(Le,{value:"medium",children:"Medium (64 kbps)"}),a.jsx(Le,{value:"high",children:"High (128 kbps)"})]})]}),a.jsxs("span",{className:"text-xs text-muted-foreground",children:["~",v1[o].estimatedSize," KB/min"]})]}),a.jsx(Ide,{type:"single",collapsible:!0,className:"w-full",children:Object.entries(P).map(([M,I])=>{var B,A,L,W;const E=C(M);return a.jsxs(NB,{value:M,children:[a.jsx(kB,{children:a.jsxs("div",{className:"flex items-center justify-between w-full pr-4",children:[a.jsxs("span",{className:"font-medium capitalize",children:[M,"s"]}),a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsxs(ke,{variant:"outline",children:[a.jsx(wD,{className:"h-3 w-3 mr-1"}),E.cachedL,"/",E.total]}),a.jsxs(ke,{variant:"outline",children:[a.jsx(Xe,{className:"h-3 w-3 mr-1"}),E.cachedA,"/",E.total]}),a.jsx("span",{className:"text-xs text-muted-foreground",children:Uy(E.totalSize+E.audioSize)})]})]})}),a.jsx(CB,{children:a.jsxs("div",{className:"space-y-3 pt-2",children:[a.jsxs("div",{className:"flex gap-2 pb-3 border-b",children:[a.jsxs(Y,{size:"sm",onClick:()=>{m({type:M,action:"lessons"}),d(!0)},disabled:E.cachedL===E.total,children:[a.jsx(as,{className:"h-3 w-3 mr-1"}),"Download All Lessons"]}),a.jsxs(Y,{size:"sm",variant:"outline",onClick:()=>_(M),disabled:E.cachedL===0,children:[a.jsx(Ls,{className:"h-3 w-3 mr-1"}),"Delete All Lessons"]}),a.jsxs(Y,{size:"sm",onClick:()=>{m({type:M,action:"audio"}),d(!0)},disabled:E.cachedA===E.total,children:[a.jsx(Xe,{className:"h-3 w-3 mr-1"}),"Download All Audio"]}),a.jsxs(Y,{size:"sm",variant:"outline",onClick:()=>S(M),disabled:E.cachedA===0,children:[a.jsx(Ls,{className:"h-3 w-3 mr-1"}),"Delete All Audio"]})]}),c.has(`${M}-lessons`)&&a.jsxs("div",{className:"space-y-1",children:[a.jsxs("div",{className:"flex justify-between text-xs",children:[a.jsx("span",{children:"Downloading lessons..."}),a.jsxs("span",{children:[(B=c.get(`${M}-lessons`))==null?void 0:B.current,"/",(A=c.get(`${M}-lessons`))==null?void 0:A.total]})]}),a.jsx(_t,{value:c.get(`${M}-lessons`).current/c.get(`${M}-lessons`).total*100})]}),c.has(`${M}-audio`)&&a.jsxs("div",{className:"space-y-1",children:[a.jsxs("div",{className:"flex justify-between text-xs",children:[a.jsx("span",{children:"Downloading audio..."}),a.jsxs("span",{children:[(L=c.get(`${M}-audio`))==null?void 0:L.current,"/",(W=c.get(`${M}-audio`))==null?void 0:W.total]})]}),a.jsx(_t,{value:c.get(`${M}-audio`).current/c.get(`${M}-audio`).total*100})]}),I.map(D=>{const U=e.has(D.id),R=r.has(D.id),Q=r.get(D.id);return a.jsxs("div",{className:"border rounded-lg p-3 space-y-2",children:[a.jsx("div",{className:"flex items-center justify-between",children:a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("span",{className:"text-2xl font-bold",children:D.character}),a.jsxs("div",{children:[a.jsx("p",{className:"font-medium text-sm",children:D.name}),a.jsxs("p",{className:"text-xs text-muted-foreground",children:["Lesson: ",Uy(D.estimatedSize)," | Audio: ",Uy((D.audioCount||0)*3e4)]})]})]})}),a.jsxs("div",{className:"flex gap-2",children:[a.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[U&&a.jsx(mr,{className:"h-4 w-4 text-green-600"}),U?a.jsxs(Y,{size:"sm",variant:"outline",onClick:()=>x(D),children:[a.jsx(Ls,{className:"h-3 w-3 mr-1"}),"Remove Lesson"]}):a.jsxs(Y,{size:"sm",onClick:()=>p(D),disabled:s.has(D.id),children:[s.has(D.id)?a.jsx(Fe,{className:"h-3 w-3 animate-spin mr-1"}):a.jsx(as,{className:"h-3 w-3 mr-1"}),"Download Lesson"]})]}),a.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[R&&a.jsx(ke,{variant:"secondary",className:"text-xs",children:Q}),R?a.jsxs(Y,{size:"sm",variant:"outline",onClick:()=>b(D),children:[a.jsx(Ls,{className:"h-3 w-3 mr-1"}),"Remove Audio"]}):a.jsxs(Y,{size:"sm",onClick:()=>v(D),disabled:s.has(`${D.id}-audio`),children:[s.has(`${D.id}-audio`)?a.jsx(Fe,{className:"h-3 w-3 animate-spin mr-1"}):a.jsx(Xe,{className:"h-3 w-3 mr-1"}),"Download Audio"]})]})]})]},D.id)})]})})]},M)})}),f&&a.jsx(ehe,{open:h,onOpenChange:d,onConfirm:k,title:`Download All ${f.type} ${f.action}`,itemCount:P[f.type].filter(M=>f.action==="lessons"?!e.has(M.id):!r.has(M.id)).length,totalSize:P[f.type].filter(M=>f.action==="lessons"?!e.has(M.id):!r.has(M.id)).reduce((M,I)=>M+(f.action==="lessons"?I.estimatedSize:(I.audioCount||0)*v1[o].estimatedSize*60),0),type:f.action})]})]})}function rhe(){const{user:e}=Jt(),{toast:t}=ta(),[r,n]=y.useState({challenge_completed:!0,challenge_expiring:!0,new_challenge:!0,member_contribution:!0,push_enabled:!1,email_enabled:!0,email_frequency:"immediate"});y.useEffect(()=>{s()},[e]);const s=async()=>
875{if(!e)return;const l=await rb(e.id);l&&n(l)},i=async l=>{if(!e)return;const c={...r,[l]:!r[l]};n(c);try{await zP(e.id,c),t({title:"Preferences updated",description:"Your notification preferences have been saved."})}catch{t({title:"Error",description:"Failed to update preferences.",variant:"destructive"})}},o=async l=>{if(!e)return;const c={...r,email_frequency:l};n(c);try{await zP(e.id,c),t({title:"Preferences updated",description:"Email frequency has been updated."})}catch{t({title:"Error",description:"Failed to update preferences.",variant:"destructive"})}};return a.jsxs(se,{children:[a.jsxs(_e,{children:[a.jsx(Se,{children:"Notification Preferences"}),a.jsx(hr,{children:"Choose which notifications you want to receive"})]}),a.jsxs(ue,{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs(Re,{htmlFor:"challenge_completed",className:"flex flex-col space-y-1",children:[a.jsx("span",{children:"Challenge Completed"}),a.jsx("span",{className:"text-sm text-muted-foreground font-normal",children:"When your team completes a challenge"})]}),a.jsx(_n,{id:"challenge_completed",checked:r.challenge_completed,onCheckedChange:()=>i("challenge_completed")})]}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs(Re,{htmlFor:"challenge_expiring",className:"flex flex-col space-y-1",children:[a.jsx("span",{children:"Challenge Expiring"}),a.jsx("span",{className:"text-sm text-muted-foreground font-normal",children:"24-hour warning before challenges expire"})]}),a.jsx(_n,{id:"challenge_expiring",checked:r.challenge_expiring,onCheckedChange:()=>i("challenge_expiring")})]}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs(Re,{htmlFor:"new_challenge",className:"flex flex-col space-y-1",children:[a.jsx("span",{children:"New Challenges"}),a.jsx("span",{className:"text-sm text-muted-foreground font-normal",children:"When new challenges are created"})]}),a.jsx(_n,{id:"new_challenge",checked:r.new_challenge,onCheckedChange:()=>i("new_challenge")})]}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs(Re,{htmlFor:"member_contribution",className:"flex flex-col space-y-1",children:[a.jsx("span",{children:"Member Contributions"}),a.jsx("span",{className:"text-sm text-muted-foreground font-normal",children:"When team members make significant contributions"})]}),a.jsx(_n,{id:"member_contribution",checked:r.member_contribution,onCheckedChange:()=>i("member_contribution")})]}),a.jsxs("div",{className:"border-t pt-4 mt-4",children:[a.jsx("h3",{className:"font-semibold mb-4",children:"Email Notifications"}),a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsxs(Re,{htmlFor:"email_enabled",className:"flex flex-col space-y-1",children:[a.jsx("span",{children:"Email Notifications"}),a.jsx("span",{className:"text-sm text-muted-foreground font-normal",children:"Receive notifications via email"})]}),a.jsx(_n,{id:"email_enabled",checked:r.email_enabled,onCheckedChange:()=>i("email_enabled")})]}),r.email_enabled&&a.jsxs("div",{className:"space-y-2",children:[a.jsx(Re,{htmlFor:"email_frequency",children:"Email Frequency"}),a.jsxs(Nr,{value:r.email_frequency,onValueChange:o,children:[a.jsx(gr,{id:"email_frequency",children:a.jsx(kr,{})}),a.jsxs(yr,{children:[a.jsx(Le,{value:"immediate",children:"Immediate"}),a.jsx(Le,{value:"daily_digest",children:"Daily Digest"}),a.jsx(Le,{value:"off",children:"Off"})]})]})]})]})]})]})}function Wg({title:e,value:t,change:r,icon:n,trend:s}){return a.jsxs(se,{children:[a.jsxs(_e,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[a.jsx(Se,{className:"text-sm font-medium",children:e}),n]}),a.jsxs(ue,{children:[a.jsx("div",{className:"text-2xl font-bold",children:t}),r!==void 0&&a.jsxs("p",{className:"text-xs text-muted-foreground flex items-center gap-1 mt-1",children:[s==="up"?a.jsx(ja,{className:"h-3 w-3 text-green-500"}):a.jsx(HK,{className:"h-3 w-3 text-red-500"}),a.jsxs("span",{className:s==="up"?"text-green-500":"text-red-500",children:[r>0?"+":"",r,"%"]}),a.jsx("span",{children:"from last period"})]})]})]})}function nhe(e){if(e.length===0)return"No data available";const t=["Date","Time","Notification Type","Event Type","Recipient Email","Email ID","Metadata"],r=e.map(s=>{const i=new Date(s.created_at);return[i.toLocaleDateString(),i.toLocaleTimeString(),s.notification_type.replace(/_/g," ").toUpperCase(),s.event_type.toUpperCase(),s.recipient_email,s.email_id,s.metadata?JSON.stringify(s.metadata):""]});return[t.join(","),...r.map(s=>s.map(i=>`"${i}"`).join(","))].join(`
876`)}function ahe(e,t){const r=new Blob([e],{type:"text/csv;charset=utf-8;"}),n=document.createElement("a");if(n.download!==void 0){const s=URL.createObjectURL(r);n.setAttribute("href",s),n.setAttribute("download",t),n.style.visibility="hidden",document.body.appendChild(n),n.click(),document.body.removeChild(n)}}function she({rawData:e,dateRange:t,notificationType:r}){const{toast:n}=ta(),[s,i]=y.useState([]),[o,l]=y.useState(!1),[c,u]=y.useState({frequency:"weekly",recipientEmail:"",isActive:!0});y.useEffect(()=>{d(),h()},[]);const h=async()=>{const{data:{user:p}}=await ne.auth.getUser();if(p){const{data:v}=await ne.from("profiles").select("email").eq("id",p.id).single();v!=null&&v.email&&u(x=>({...x,recipientEmail:v.email}))}},d=async()=>{const{data:{user:p}}=await ne.auth.getUser();if(!p)return;const{data:v}=await ne.from("email_report_schedules").select("*").eq("user_id",p.id);i(v||[])},f=()=>{if(e.length===0){n({title:"No data to export",variant:"destructive"});return}const p=nhe(e),v=`analytics-${t}days-${r}-${new Date().toISOString().split("T")[0]}.csv`;ahe(p,v),n({title:"CSV exported successfully!"})},m=async()=>{const{data:{user:p}}=await ne.auth.getUser();if(!p)return;const{error:v}=await ne.from("email_report_schedules").insert({user_id:p.id,frequency:c.frequency,recipient_email:c.recipientEmail,is_active:c.isActive});if(v){n({title:"Error creating schedule",variant:"destructive"});return}n({title:"Report schedule created!"}),l(!1),d()},g=async p=>{await ne.from("email_report_schedules").delete().eq("id",p),n({title:"Schedule deleted"}),d()};return a.jsxs("div",{className:"flex gap-2 flex-wrap",children:[a.jsxs(Y,{onClick:f,variant:"outline",children:[a.jsx(as,{className:"h-4 w-4 mr-2"}),"Export CSV"]}),a.jsxs(Ks,{open:o,onOpenChange:l,children:[a.jsx(tz,{asChild:!0,children:a.jsxs(Y,{variant:"outline",children:[a.jsx(rh,{className:"h-4 w-4 mr-2"}),"Schedule Reports"]})}),a.jsxs(fs,{children:[a.jsx(Ys,{children:a.jsx(Xs,{children:"Schedule Automated Reports"})}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx(Re,{children:"Frequency"}),a.jsxs(Nr,{value:c.frequency,onValueChange:p=>u({...c,frequency:p}),children:[a.jsx(gr,{children:a.jsx(kr,{})}),a.jsxs(yr,{children:[a.jsx(Le,{value:"weekly",children:"Weekly"}),a.jsx(Le,{value:"monthly",children:"Monthly"})]})]})]}),a.jsxs("div",{children:[a.jsx(Re,{children:"Email"}),a.jsx(Je,{type:"email",value:c.recipientEmail,onChange:p=>u({...c,recipientEmail:p.target.value})})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(_n,{checked:c.isActive,onCheckedChange:p=>u({...c,isActive:p})}),a.jsx(Re,{children:"Active"})]}),a.jsx(Y,{onClick:m,className:"w-full",children:"Create Schedule"}),s.length>0&&a.jsxs("div",{className:"mt-4 space-y-2",children:[a.jsx(Re,{children:"Active Schedules"}),s.map(p=>a.jsxs("div",{className:"flex justify-between items-center p-2 border rounded",children:[a.jsxs("span",{className:"text-sm",children:[p.frequency," - ",p.recipient_email]}),a.jsx(Y,{size:"sm",variant:"ghost",onClick:()=>g(p.id),children:a.jsx(Ls,{className:"h-4 w-4"})})]}
vendor: 5,767 bytes, line 876
876,p.id))]})]})]})]})]})}var ihe=Array.isArray,On=ihe,ohe=typeof Co=="object"&&Co&&Co.Object===Object&&Co,eU=ohe,lhe=eU,che=typeof self=="object"&&self&&self.Object===Object&&self,uhe=lhe||che||Function("return this")(),ri=uhe,dhe=ri,hhe=dhe.Symbol,Up=hhe,tO=Up,tU=Object.prototype,fhe=tU.hasOwnProperty,mhe=tU.toString,Wh=tO?tO.toStringTag:void 0;function phe(e){var t=fhe.call(e,Wh),r=e[Wh];try{e[Wh]=void 0;var n=!0}catch{}var s=mhe.call(e);return n&&(t?e[Wh]=r:delete e[Wh]),s}var ghe=phe,yhe=Object.prototype,vhe=yhe.toString;function xhe(e){return vhe.call(e)}var bhe=xhe,rO=Up,whe=ghe,jhe=bhe,_he="[object Null]",She="[object Undefined]",nO=rO?rO.toStringTag:void 0;function Nhe(e){return e==null?e===void 0?She:_he:nO&&nO in Object(e)?whe(e):jhe(e)}var Ki=Nhe;function khe(e){return e!=null&&typeof e=="object"}var Yi=khe,Che=Ki,Ehe=Yi,The="[object Symbol]";function Ahe(e){return typeof e=="symbol"||Ehe(e)&&Che(e)==The}var fh=Ahe,Phe=On,Ohe=fh,Mhe=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Rhe=/^\w*$/;function $he(e,t){if(Phe(e))return!1;var r=typeof e;return r=="number"||r=="symbol"||r=="boolean"||e==null||Ohe(e)?!0:Rhe.test(e)||!Mhe.test(e)||t!=null&&e in Object(t)}var jC=$he;function Ihe(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var ul=Ihe;const mh=mt(ul);var Dhe=Ki,Lhe=ul,Fhe="[object AsyncFunction]",zhe="[object Function]",Bhe="[object GeneratorFunction]",Uhe="[object Proxy]";function Whe(e){if(!Lhe(e))return!1;var t=Dhe(e);return t==zhe||t==Bhe||t==Fhe||t==Uhe}var _C=Whe;const Qe=mt(_C);var Vhe=ri,Hhe=Vhe["__core-js_shared__"],qhe=Hhe,x1=qhe,aO=function(){var e=/[^.]+$/.exec(x1&&x1.keys&&x1.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function Ghe(e){return!!aO&&aO in e}var Khe=Ghe,Yhe=Function.prototype,Xhe=Yhe.toString;function Qhe(e){if(e!=null){try{return Xhe.call(e)}catch{}try{return e+""}catch{}}return""}var rU=Qhe,Jhe=_C,Zhe=Khe,efe=ul,tfe=rU,rfe=/[\\^$.*+?()[\]{}|]/g,nfe=/^\[object .+?Constructor\]$/,afe=Function.prototype,sfe=Object.prototype,ife=afe.toString,ofe=sfe.hasOwnProperty,lfe=RegExp("^"+ife.call(ofe).replace(rfe,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function cfe(e){if(!efe(e)||Zhe(e))return!1;var t=Jhe(e)?lfe:nfe;return t.test(tfe(e))}var ufe=cfe;function dfe(e,t){return e==null?void 0:e[t]}var hfe=dfe,ffe=ufe,mfe=hfe;function pfe(e,t){var r=mfe(e,t);return ffe(r)?r:void 0}var Rc=pfe,gfe=Rc,yfe=gfe(Object,"create"),bb=yfe,sO=bb;function vfe(){this.__data__=sO?sO(null):{},this.size=0}var xfe=vfe;function bfe(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var wfe=bfe,jfe=bb,_fe="__lodash_hash_undefined__",Sfe=Object.prototype,Nfe=Sfe.hasOwnProperty;function kfe(e){var t=this.__data__;if(jfe){var r=t[e];return r===_fe?void 0:r}return Nfe.call(t,e)?t[e]:void 0}var Cfe=kfe,Efe=bb,Tfe=Object.prototype,Afe=Tfe.hasOwnProperty;function Pfe(e){var t=this.__data__;return Efe?t[e]!==void 0:Afe.call(t,e)}var Ofe=Pfe,Mfe=bb,Rfe="__lodash_hash_undefined__";function $fe(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=Mfe&&t===void 0?Rfe:t,this}var Ife=$fe,Dfe=xfe,Lfe=wfe,Ffe=Cfe,zfe=Ofe,Bfe=Ife;function ph(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}ph.prototype.clear=Dfe;ph.prototype.delete=Lfe;ph.prototype.get=Ffe;ph.prototype.has=zfe;ph.prototype.set=Bfe;var Ufe=ph;function Wfe(){this.__data__=[],this.size=0}var Vfe=Wfe;function Hfe(e,t){return e===t||e!==e&&t!==t}var SC=Hfe,qfe=SC;function Gfe(e,t){for(var r=e.length;r--;)if(qfe(e[r][0],t))return r;return-1}var wb=Gfe,Kfe=wb,Yfe=Array.prototype,Xfe=Yfe.splice;function Qfe(e){var t=this.__data__,r=Kfe(t,e);if(r<0)return!1;var n=t.length-1;return r==n?t.pop():Xfe.call(t,r,1),--this.size,!0}var Jfe=Qfe,Zfe=wb;function eme(e){var t=this.__data__,r=Zfe(t,e);return r<0?void 0:t[r][1]}var tme=eme,rme=wb;function nme(e){return rme(this.__data__,e)>-1}var ame=nme,sme=wb;function ime(e,t){var r=this.__data__,n=sme(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this}var ome=ime,lme=Vfe,cme=Jfe,ume=tme,dme=ame,hme=ome;function gh(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}gh.prototype.clear=lme;gh.prototype.delete=cme;gh.prototype.get=ume;gh.prototype.has=dme;gh.prototype.set=hme;var jb=gh,fme=Rc,mme=ri,pme=fme(mme,"Map"),NC=pme,iO=Ufe,gme=jb,yme=NC;function vme(){this.size=0,this.__data__={hash:new iO,map:new(yme||gme),string:new iO}}var xme=vme;function bme(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}var wme=bme,jme=wme;function _me(e,t){var r=e.__data__;return jme(t)?r[typeof t=="string"?"string":"hash"]:r.map}var _b=_me,Sme=_b;function Nme(e){var t=Sme(this,e).delete(e);return this.size-=t?1:0,t}var kme=Nme,Cme=_b;function Eme(e){return Cme(this,e).get(e)}var Tme=Eme,Ame=_b;function Pme(e){return Ame(this,e).has(e)}var Ome=Pme,Mme=_b;function Rme(e,t){var r=Mme(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this}var $me=Rme,Ime=xme,Dme=kme,Lme=Tme,Fme=Ome,zme=$me;function yh(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}yh.prototype.clear=Ime;yh.prototype.delete=Dme;yh.prototype.get=Lme;yh.prototype.has=Fme;yh.prototype.set=zme;var kC=yh,nU=kC,Bme="Expected a function";function CC(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new TypeError(Bme);var r=function(){var n=arguments,s=t?t.apply(this,n):n[0],i=r.cache;if(i.has(s))return i.get(s);var o=e.apply(this,n);return r.cache=i.set(s,o)||i,o};return r.cache=new(CC.Cache||nU),r}CC.Cache=nU;var aU=CC;const Ume=mt(aU);var Wme=aU,Vme=500;function Hme(e){var t=Wme(e,function(n){return r.size===Vme&&r.clear(),n}
876),r=t.cache;return t}var qme=Hme,Gme=qme,Kme=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Yme=/\\(\\)?/g,Xme=Gme(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(""),e.replace(Kme,function(r,n,s,i){t.push(s?i.replace(Yme,"$1"):n||r)}),t}),Qme=Xme;function Jme(e,t){for(var r=-1,n=e==null?0:e.length,s=Array(n);++r<n;)s[r]=t(e[r],r,e);return s}var EC=Jme,oO=Up,Zme=EC,epe=On,tpe=fh,lO=oO?oO.prototype:void 0,cO=lO?lO.toString:void 0;function sU(e){if(typeof e=="string")return e;if(epe(e))return Zme(e,sU)+"";if(tpe(e))return cO?cO.call(e):"";var t=e+"";return t=="0"&&1/e==-1/0?"-0":t}var rpe=sU,npe=rpe;function ape(e){return e==null?"":npe(e)}var iU=ape,spe=On,ipe=jC,ope=Qme,lpe=iU;function cpe(e,t){return spe(e)?e:ipe(e,t)?[e]:ope(lpe(e))}var oU=cpe,upe=fh;function dpe(e){if(typeof e=="string"||upe(e))return e;var t=e+"";return t=="0"&&1/e==-1/0?"-0":t}var Sb=dpe,hpe=oU,fpe=Sb;function mpe(e,t){t=hpe(t,e);for(var r=0,n=t.length;e!=null&&r<n;)e=e[fpe(t[r++])];return r&&r==n?e:void 0}var TC=mpe,ppe=TC;function gpe(e,t,r){var n=e==null?void 0:ppe(e,t);return n===void 0?r:n}var lU=gpe;const ga=mt(lU);function ype(e){return e==null}var vpe=ype;const Ze=mt(vpe);var xpe=Ki,bpe=On,wpe=Yi,jpe="[object String]";function _pe(e){return typeof e=="string"||!bpe(e)&&wpe(e)&&xpe(e)==jpe}var Spe=_pe;const mc=mt(Spe);var cU={exports:{}},pt={};/**
877 * @license React
878 * react-is.production.min.js
879 *
880 * Copyright (c) Facebook, Inc. and its affiliates.
881 *
882 * This source code is licensed under the MIT license found in the
883 * LICENSE file in the root directory of this source tree.
884 */var AC=Symbol.for("react.element"),PC=Symbol.for("react.portal"),Nb=Symbol.for("react.fragment"),kb=Symbol.for("react.strict_mode"),Cb=Symbol.for("react.profiler"),Eb=Symbol.for("react.provider"),Tb=Symbol.for("react.context"),Npe=Symbol.for("react.server_context"),Ab=Symbol.for("react.forward_ref"),Pb=Symbol.for("react.suspense"),Ob=Symbol.for("react.suspense_list"),Mb=Symbol.for("react.memo"),Rb=Symbol.for("react.lazy"),kpe=Symbol.for("react.offscreen"),uU;uU=Symbol.for("react.module.reference");function Ca(e){if(typeof e=="object"&&e!==null){var t=e.$$typeof;switch(t){case AC:switch(e=e.type,e){case Nb:case Cb:case kb:case Pb:case Ob:return e;default:switch(e=e&&e.$$typeof,e){case Npe:case Tb:case Ab:case Rb:case Mb:case Eb:return e;default:return t}}case PC:return t}}}pt.ContextConsumer=Tb;pt.ContextProvider=Eb;pt.Element=AC;pt.ForwardRef=Ab;pt.Fragment=Nb;pt.Lazy=Rb;pt.Memo=Mb;pt.Portal=PC;pt.Profiler=Cb;pt.StrictMode=kb;pt.Suspense=Pb;pt.SuspenseList=Ob;pt.isAsyncMode=function(){return!1};pt.isConcurrentMode=function(){return!1};pt.isContextConsumer=function(e){return Ca(e)===Tb};pt.isContextProvider=function(e){return Ca(e)===Eb};pt.isElement=function(e){return typeof e=="object"&&e!==null&&e.$$typeof===AC};pt.isForwardRef=function(e){return Ca(e)===Ab};pt.isFragment=function(e){return Ca(e)===Nb};pt.isLazy=function(e){return Ca(e)===Rb};pt.isMemo=function(e){return Ca(e)===Mb};pt.isPortal=function(e){return Ca(e)===PC};pt.isProfiler=function(e){return Ca(e)===Cb};pt.isStrictMode=function(e){return Ca(e)===kb};pt.isSuspense=function(e){return Ca(e)===Pb};pt.isSuspenseList=function(e){return Ca(e)===Ob};pt.isValidElementType=function(e){return typeof e=="string"||typeof e=="function"||e===Nb||e===Cb||e===kb||e===Pb||e===Ob||e===kpe||typeof e=="object"&&e!==null&&(e.$$typeof===Rb||e.$$typeof===Mb||e.$$typeof===Eb||e.$$typeof===Tb||e.$$typeof===Ab||e.$$typeof===uU||e.getModuleId!==void 0)};pt.typeOf=Ca;cU.exports=pt;
vendor: 6,037 bytes, line 884
884var Cpe=cU.exports,Epe=Ki,Tpe=Yi,Ape="[object Number]";function Ppe(e){return typeof e=="number"||Tpe(e)&&Epe(e)==Ape}var dU=Ppe;const Ope=mt(dU);var Mpe=dU;function Rpe(e){return Mpe(e)&&e!=+e}var $pe=Rpe;const Wp=mt($pe);var Ja=function(t){return t===0?0:t>0?1:-1},zl=function(t){return mc(t)&&t.indexOf("%")===t.length-1},Ne=function(t){return Ope(t)&&!Wp(t)},Ipe=function(t){return Ze(t)},pr=function(t){return Ne(t)||mc(t)},Dpe=0,Vp=function(t){var r=++Dpe;return"".concat(t||"").concat(r)},pc=function(t,r){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(!Ne(t)&&!mc(t))return n;var i;if(zl(t)){var o=t.indexOf("%");i=r*parseFloat(t.slice(0,o))/100}else i=+t;return Wp(i)&&(i=n),s&&i>r&&(i=r),i},bo=function(t){if(!t)return null;var r=Object.keys(t);return r&&r.length?t[r[0]]:null},Lpe=function(t){if(!Array.isArray(t))return!1;for(var r=t.length,n={},s=0;s<r;s++)if(!n[t[s]])n[t[s]]=!0;else return!0;return!1},Ka=function(t,r){return Ne(t)&&Ne(r)?function(n){return t+n*(r-t)}:function(){return r}};function Qv(e,t,r){return!e||!e.length?null:e.find(function(n){return n&&(typeof t=="function"?t(n):ga(n,t))===r})}var Fpe=function(t,r){return Ne(t)&&Ne(r)?t-r:mc(t)&&mc(r)?t.localeCompare(r):t instanceof Date&&r instanceof Date?t.getTime()-r.getTime():String(t).localeCompare(String(r))};function Bu(e,t){for(var r in e)if({}.hasOwnProperty.call(e,r)&&(!{}.hasOwnProperty.call(t,r)||e[r]!==t[r]))return!1;for(var n in t)if({}.hasOwnProperty.call(t,n)&&!{}.hasOwnProperty.call(e,n))return!1;return!0}function rS(e){"@babel/helpers - typeof";return rS=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},rS(e)}var zpe=["viewBox","children"],Bpe=["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"],uO=["points","pathLength"],b1={svg:zpe,polygon:uO,polyline:uO},OC=["dangerouslySetInnerHTML","onCopy","onCopyCapture","onCut","onCutCapture","onPaste","onPasteCapture","onCompositionEnd","onCompositionEndCapture","onCompositionStart","onCompositionStartCapture","onCompositionUpdate","onCompositionUpdateCapture","onF
884ocus","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"],Jv=function(t,r){if(!t||typeof t=="function"||typeof t=="boolean")return null;var n=t;if(y.isValidElement(t)&&(n=t.props),!mh(n))return null;var s={};return Object.keys(n).forEach(function(i){OC.includes(i)&&(s[i]=r||function(o){return n[i](n,o)})}),s},Upe=function(t,r,n){return function(s){return t(r,n,s),null}},Zv=function(t,r,n){if(!mh(t)||rS(t)!=="object")return null;var s=null;return Object.keys(t).forEach(function(i){var o=t[i];OC.includes(i)&&typeof o=="function"&&(s||(s={}),s[i]=Upe(o,r,n))}),s},Wpe=["children"],Vpe=["children"];function dO(e,t){if(e==null)return{};var r=Hpe(e,t),n,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(s=0;s<i.length;s++)n=i[s],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function Hpe(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function nS(e){"@babel/helpers - typeof";return nS=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},nS(e)}var hO={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"}
vendor: 6,101 bytes, line 884
884,Si=function(t){return typeof t=="string"?t:t?t.displayName||t.name||"Component":""},fO=null,w1=null,MC=function e(t){if(t===fO&&Array.isArray(w1))return w1;var r=[];return y.Children.forEach(t,function(n){Ze(n)||(Cpe.isFragment(n)?r=r.concat(e(n.props.children)):r.push(n))}),w1=r,fO=t,r};function ya(e,t){var r=[],n=[];return Array.isArray(t)?n=t.map(function(s){return Si(s)}):n=[Si(t)],MC(e).forEach(function(s){var i=ga(s,"type.displayName")||ga(s,"type.name");n.indexOf(i)!==-1&&r.push(s)}),r}function zn(e,t){var r=ya(e,t);return r&&r[0]}var mO=function(t){if(!t||!t.props)return!1;var r=t.props,n=r.width,s=r.height;return!(!Ne(n)||n<=0||!Ne(s)||s<=0)},qpe=["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"],Gpe=function(t){return t&&t.type&&mc(t.type)&&qpe.indexOf(t.type)>=0},Kpe=function(t){return t&&nS(t)==="object"&&"clipDot"in t},Ype=function(t,r,n,s){var i,o=(i=b1==null?void 0:b1[s])!==null&&i!==void 0?i:[];return r.startsWith("data-")||!Qe(t)&&(s&&o.includes(r)||Bpe.includes(r))||n&&OC.includes(r)},rt=function(t,r,n){if(!t||typeof t=="function"||typeof t=="boolean")return null;var s=t;if(y.isValidElement(t)&&(s=t.props),!mh(s))return null;var i={};return Object.keys(s).forEach(function(o){var l;Ype((l=s)===null||l===void 0?void 0:l[o],o,r,n)&&(i[o]=s[o])}),i},aS=function e(t,r){if(t===r)return!0;var n=y.Children.count(t);if(n!==y.Children.count(r))return!1;if(n===0)return!0;if(n===1)return pO(Array.isArray(t)?t[0]:t,Array.isArray(r)?r[0]:r);for(var s=0;s<n;s++){var i=t[s],o=r[s];if(Array.isArray(i)||Array.isArray(o)){if(!e(i,o))return!1}else if(!pO(i,o))return!1}return!0},pO=function(t,r){if(Ze(t)&&Ze(r))return!0;if(!Ze(t)&&!Ze(r)){var n=t.props||{},s=n.children,i=dO(n,Wpe),o=r.props||{},l=o.children,c=dO(o,Vpe);return s&&l?Bu(i,c)&&aS(s,l):!s&&!l?Bu(i,c):!1}return!1},gO=function(t,r){var n=[],s={};return MC(t).forEach(function(i,o){if(Gpe(i))n.push(i);else if(i){var l=Si(i.type),c=r[l]||{},u=c.handler,h=c.once;if(u&&(!h||!s[l])){var d=u(i,l,o);n.push(d),s[l]=!0}}}),n},Xpe=function(t){var r=t&&t.type;return r&&hO[r]?hO[r]:null},Qpe=function(t,r){return MC(r).indexOf(t)},Jpe=["children","width","height","viewBox","className","style","title","desc"];function sS(){return sS=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},sS.apply(this,arguments)}function Zpe(e,t){if(e==null)return{};var r=ege(e,t),n,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(s=0;s<i.length;s++)n=i[s],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function ege(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function iS(e){var t=e.children,r=e.width,n=e.height,s=e.viewBox,i=e.className,o=e.style,l=e.title,c=e.desc,u=Zpe(e,Jpe),h=s||{width:r,height:n,x:0,y:0},d=nt("recharts-surface",i);return J.createElement("svg",sS({},rt(u,!0,"svg"),{className:d,width:r,height:n,style:o,viewBox:"".concat(h.x," ").concat(h.y," ").concat(h.width," ").concat(h.height)}),J.createElement("title",null,l),J.createElement("desc",null,c),t)}var tge=["children","className"];function oS(){return oS=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},oS.apply(this,arguments)}function rge(e,t){if(e==null)return{};var r=nge(e,t),n,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(s=0;s<i.length;s++)n=i[s],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function nge(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}var rr=J.forwardRef(function(e,t){var r=e.children,n=e.className,s=rge(e,tge),i=nt("recharts-layer",n);return J.createElement("g",oS({className:i},rt(s,!0),{ref:t}),r)}),Ni=function(t,r){for(var n=arguments.length,s=new Array(n>2?n-2:0),i=2;i<n;i++)s[i-2]=arguments[i]};function age(e,t,r){var n=-1,s=e.length;t<0&&(t=-t>s?0:s+t),r=r>s?s:r,r<0&&(r+=s),s=t>r?0:r-t>>>0,t>>>=0;for(var i=Array(s);++n<s;)i[n]=e[n+t];return i}var sge=age,ige=sge;function oge(e,t,r){var n=e.length;return r=r===void 0?n:r,!t&&r>=n?e:ige(e,t,r)}var lge=oge,cge="\\ud800-\\udfff",uge="\\u0300-\\u036f",dge="\\ufe20-\\ufe2f",hge="\\u20d0-\\u20ff",fge=uge+dge+hge,mge="\\ufe0e\\ufe0f",pge="\\u200d",gge=RegExp("["+pge+cge+fge+mge+"]");function yge(e){return gge.test(e)}var hU=yge;function vge(e){return e.split("")}var xge=vge,fU="\\ud800-\\udfff",bge="\\u0300-\\u036f",wge="\\ufe20-\\ufe2f",jge="\\u20d0-\\u20ff",_ge=bge+wge+jge,Sge="\\ufe0e\\ufe0f",Nge="["+fU+"]",lS="["+_ge+"]",cS="\\ud83c[\\udffb-\\udfff]",kge="(?:"+lS+"|"+cS+")",mU="[^"+fU+"]",pU="(?:\\ud83c[\\udde6-\\uddff]){2}",gU="[\\ud800-\\udbff][\\udc00-\\udfff]",Cge="\\u200d",yU=kge+"?",vU="["+Sge+"]?",Ege="(?:"+Cge+"(?:"+[mU,pU,gU].join("|")+")"+vU+yU+")*",Tge=vU+yU+Ege,Age="(?:"+[mU+lS+"?",lS,pU,gU,Nge].join("|")+")",Pge=RegExp(cS+"(?="+cS+")|"+Age+Tge,"g");function Oge(e){return e.match(Pge)||[]}
884var Mge=Oge,Rge=xge,$ge=hU,Ige=Mge;function Dge(e){return $ge(e)?Ige(e):Rge(e)}var Lge=Dge,Fge=lge,zge=hU,Bge=Lge,Uge=iU;function Wge(e){return function(t){t=Uge(t);var r=zge(t)?Bge(t):void 0,n=r?r[0]:t.charAt(0),s=r?Fge(r,1).join(""):t.slice(1);return n[e]()+s}}var Vge=Wge,Hge=Vge,qge=Hge("toUpperCase"),Gge=qge;const $b=mt(Gge);function kt(e){return function(){return e}}const xU=Math.cos,ex=Math.sin,xs=Math.sqrt,tx=Math.PI,Ib=2*tx,uS=Math.PI,dS=2*uS,El=1e-6,Kge=dS-El;function bU(e){this._+=e[0];for(let t=1,r=e.length;t<r;++t)this._+=arguments[t]+e[t]}function Yge(e){let t=Math.floor(e);if(!(t>=0))throw new Error(`invalid digits: ${e}`);if(t>15)return bU;const r=10**t;return function(n){this._+=n[0];for(let s=1,i=n.length;s<i;++s)this._+=Math.round(arguments[s]*r)/r+n[s]}}class Xge{constructor(t){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=t==null?bU:Yge(t)}moveTo(t,r){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+r}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(t,r){this._append`L${this._x1=+t},${this._y1=+r}`}quadraticCurveTo(t,r,n,s){this._append`Q${+t},${+r},${this._x1=+n},${this._y1=+s}`}bezierCurveTo(t,r,n,s,i,o){this._append`C${+t},${+r},${+n},${+s},${this._x1=+i},${this._y1=+o}`}arcTo(t,r,n,s,i){if(t=+t,r=+r,n=+n,s=+s,i=+i,i<0)throw new Error(`negative radius: ${i}`);let o=this._x1,l=this._y1,c=n-t,u=s-r,h=o-t,d=l-r,f=h*h+d*d;if(this._x1===null)this._append`M${this._x1=t},${this._y1=r}`;else if(f>El)if(!(Math.abs(d*c-u*h)>El)||!i)this._append`L${this._x1=t},${this._y1=r}`;else{let m=n-o,g=s-l,p=c*c+u*u,v=m*m+g*g,x=Math.sqrt(p),b=Math.sqrt(f),w=i*Math.tan((uS-Math.acos((p+f-v)/(2*x*b)))/2),j=w/b,_=w/x;Math.abs(j-1)>El&&this._append`L${t+j*h},${r+j*d}`,this._append`A${i},${i},0,0,${+(d*m>h*g)},${this._x1=t+_*c},${this._y1=r+_*u}`}}arc(t,r,n,s,i,o){if(t=+t,r=+r,n=+n,o=!!o,n<0)throw new Error(`negative radius: ${n}`);let l=n*Math.cos(s),c=n*Math.sin(s),u=t+l,h=r+c,d=1^o,f=o?s-i:i-s;this._x1===null?this._append`M${u},${h}`:(Math.abs(this._x1-u)>El||Math.abs(this._y1-h)>El)&&this._append`L${u},${h}`,n&&(f<0&&(f=f%dS+dS),f>Kge?this._append`A${n},${n},0,1,${d},${t-l},${r-c}A${n},${n},0,1,${d},${this._x1=u},${this._y1=h}`:f>El&&this._append`A${n},${n},0,${+(f>=uS)},${d},${this._x1=t+n*Math.cos(i)},${this._y1=r+n*Math.sin(i)}`)}rect(t,r,n,s){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+r}h${n=+n}v${+s}h${-n}Z`}toString(){return this._}}function RC(e){let t=3;return e.digits=function(r){if(!arguments.length)return t;if(r==null)t=null;else{const n=Math.floor(r);if(!(n>=0))throw new RangeError(`invalid digits: ${r}`);t=n}return e},()=>new Xge(t)}function $C(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function wU(e){this._context=e}wU.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(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._context.lineTo(e,t);break}}};function Db(e){return new wU(e)}function jU(e){return e[0]}function _U(e){return e[1]}function SU(e,t){var r=kt(!0),n=null,s=Db,i=null,o=RC(l);e=typeof e=="function"?e:e===void 0?jU:kt(e),t=typeof t=="function"?t:t===void 0?_U:kt(t);function l(c){var u,h=(c=$C(c)).length,d,f=!1,m;for(n==null&&(i=s(m=o())),u=0;u<=h;++u)!(u<h&&r(d=c[u],u,c))===f&&((f=!f)?i.lineStart():i.lineEnd()),f&&i.point(+e(d,u,c),+t(d,u,c));if(m)return i=null,m+""||null}return l.x=function(c){return arguments.length?(e=typeof c=="function"?c:kt(+c),l):e},l.y=function(c){return arguments.length?(t=typeof c=="function"?c:kt(+c),l):t},l.defined=function(c){return arguments.length?(r=typeof c=="function"?c:kt(!!c),l):r},l.curve=function(c){return arguments.length?(s=c,n!=null&&(i=s(n)),l):s},l.context=function(c){return arguments.length?(c==null?n=i=null:i=s(n=c),l):n},l}function Vg(e,t,r){var n=null,s=kt(!0),i=null,o=Db,l=null,c=RC(u);e=typeof e=="function"?e:e===void 0?jU:kt(+e),t=typeof t=="function"?t:kt(t===void 0?0:+t),r=typeof r=="function"?r:r===void 0?_U:kt(+r);function u(d){var f,m,g,p=(d=$C(d)).length,v,x=!1,b,w=new Array(p),j=new Array(p);for(i==null&&(l=o(b=c())),f=0;f<=p;++f){if(!(f<p&&s(v=d[f],f,d))===x)if(x=!x)m=f,l.areaStart(),l.lineStart();else{for(l.lineEnd(),l.lineStart(),g=f-1;g>=m;--g)l.point(w[g],j[g]);l.lineEnd(),l.areaEnd()}x&&(w[f]=+e(v,f,d),j[f]=+t(v,f,d),l.point(n?+n(v,f,d):w[f],r?+r(v,f,d):j[f]))}if(b)return l=null,b+""||null}function h(){return SU().defined(s).curve(o).context(i)}return u.x=function(d){return arguments.length?(e=typeof d=="function"?d:kt(+d),n=null,u):e},u.x0=function(d){return arguments.length?(e=typeof d=="function"?d:kt(+d),u):e},u.x1=function(d){return arguments.length?(n=d==null?null:typeof d=="function"?d:kt(+d),u):n},u.y=function(d){return arguments.length?(t=typeof d=="function"?d:kt(+d),r=null,u):t},u.y0=function(d){return arguments.length?(t=typeof d=="function"?d:kt(+d),u):t},u.y1=function(d){return arguments.length?(r=d==null?null:typeof d=="function"?d:kt(+d),u):r},u.lineX0=u.lineY0=function(){return h().x(e).y(t)},u.lineY1=function(){return h().x(e).y(r)},u.lineX1=function(){return h().x(n).y(t)},u.defined=function(d){return arguments.length?(s=typeof d=="function"?d:kt(!!d),u):s},u.curve=function(d){return arguments.length?(o=d,i!=null&&(l=o(i)),u):o},u.context=function(d){return arguments.length?(d==null?i=l=null:l=o(i=d),u):i},u}class NU{constructor(t,r){this._context=t,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(t,r){switch(t=+t,r=+r,this._point){case 0:{this._point=1,this._line?this._context.lineTo(t,r):this._context.moveTo(t,r);break}case 1:this._point=2;default:{this._x?this._context.bezierCurveTo(this._x0=(this._x0+t)/2,this._y0,this._x0,r,t,r):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+r)/2,t,this._y0,t,r);break}}this._x0=t,this._y0=r}}function Qge(e){return new NU(e,!0)}function Jge(e){return new NU(e,!1)}const IC={draw(e,t){const r=xs(t/tx);e.moveTo(r,0),e.arc(0,0,r,0,Ib)}},Zge={draw(e,t){const r=xs(t/5)/2;e.moveTo(-3*r,-r),e.lineTo(-r,-r),e.lineTo(-r,-3*r),e.lineTo(r,-3*r),e.lineTo(r,-r),e.lineTo(3*r,-r),e.lineTo(3*r,r),e.lineTo(r,r),e.lineTo(r,3*r),e.lineTo(-r,3*r),e.lineTo(-r,r),e.lineTo(-3*r,r),e.closePath()}},kU=xs(1/3),eye=kU*2,tye={draw(e,t){const r=xs(t/eye),n=r*kU;e.moveTo(0,-r),e.lineTo(n,0),e.lineTo(0,r),e.lineTo(-n,0),e.closePath()}},rye={draw(e,t){const r=xs(t),n=-r/2;e.rect(n,n,r,r)}},nye=.8908130915292852,CU=ex(tx/10)/ex(7*tx/10),aye=ex(Ib/10)*CU,sye=-xU(Ib/10)*CU,iye={draw(e,t){const r=xs(t*nye),n=aye*r,s=sye*r;e.moveTo(0,-r),e.lineTo(n,s);for(let i=1;i<5;++i){const o=Ib*i/5,l=xU(o),c=ex(o);
vendor: 6,728 bytes, line 884
884e.lineTo(c*r,-l*r),e.lineTo(l*n-c*s,c*n+l*s)}e.closePath()}},j1=xs(3),oye={draw(e,t){const r=-xs(t/(j1*3));e.moveTo(0,r*2),e.lineTo(-j1*r,-r),e.lineTo(j1*r,-r),e.closePath()}},na=-.5,aa=xs(3)/2,hS=1/xs(12),lye=(hS/2+1)*3,cye={draw(e,t){const r=xs(t/lye),n=r/2,s=r*hS,i=n,o=r*hS+r,l=-i,c=o;e.moveTo(n,s),e.lineTo(i,o),e.lineTo(l,c),e.lineTo(na*n-aa*s,aa*n+na*s),e.lineTo(na*i-aa*o,aa*i+na*o),e.lineTo(na*l-aa*c,aa*l+na*c),e.lineTo(na*n+aa*s,na*s-aa*n),e.lineTo(na*i+aa*o,na*o-aa*i),e.lineTo(na*l+aa*c,na*c-aa*l),e.closePath()}};function uye(e,t){let r=null,n=RC(s);e=typeof e=="function"?e:kt(e||IC),t=typeof t=="function"?t:kt(t===void 0?64:+t);function s(){let i;if(r||(r=i=n()),e.apply(this,arguments).draw(r,+t.apply(this,arguments)),i)return r=null,i+""||null}return s.type=function(i){return arguments.length?(e=typeof i=="function"?i:kt(i),s):e},s.size=function(i){return arguments.length?(t=typeof i=="function"?i:kt(+i),s):t},s.context=function(i){return arguments.length?(r=i??null,s):r},s}function rx(){}function nx(e,t,r){e._context.bezierCurveTo((2*e._x0+e._x1)/3,(2*e._y0+e._y1)/3,(e._x0+2*e._x1)/3,(e._y0+2*e._y1)/3,(e._x0+4*e._x1+t)/6,(e._y0+4*e._y1+r)/6)}function EU(e){this._context=e}EU.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:nx(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(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);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:nx(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function dye(e){return new EU(e)}function TU(e){this._context=e}TU.prototype={areaStart:rx,areaEnd:rx,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(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x2=e,this._y2=t;break;case 1:this._point=2,this._x3=e,this._y3=t;break;case 2:this._point=3,this._x4=e,this._y4=t,this._context.moveTo((this._x0+4*this._x1+e)/6,(this._y0+4*this._y1+t)/6);break;default:nx(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function hye(e){return new TU(e)}function AU(e){this._context=e}AU.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(e,t){switch(e=+e,t=+t,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+e)/6,n=(this._y0+4*this._y1+t)/6;this._line?this._context.lineTo(r,n):this._context.moveTo(r,n);break;case 3:this._point=4;default:nx(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function fye(e){return new AU(e)}function PU(e){this._context=e}PU.prototype={areaStart:rx,areaEnd:rx,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(e,t){e=+e,t=+t,this._point?this._context.lineTo(e,t):(this._point=1,this._context.moveTo(e,t))}};function mye(e){return new PU(e)}function yO(e){return e<0?-1:1}function vO(e,t,r){var n=e._x1-e._x0,s=t-e._x1,i=(e._y1-e._y0)/(n||s<0&&-0),o=(r-e._y1)/(s||n<0&&-0),l=(i*s+o*n)/(n+s);return(yO(i)+yO(o))*Math.min(Math.abs(i),Math.abs(o),.5*Math.abs(l))||0}function xO(e,t){var r=e._x1-e._x0;return r?(3*(e._y1-e._y0)/r-t)/2:t}function _1(e,t,r){var n=e._x0,s=e._y0,i=e._x1,o=e._y1,l=(i-n)/3;e._context.bezierCurveTo(n+l,s+l*t,i-l,o-l*r,i,o)}function ax(e){this._context=e}ax.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:_1(this,this._t0,xO(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){var r=NaN;if(e=+e,t=+t,!(e===this._x1&&t===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,_1(this,xO(this,r=vO(this,e,t)),r);break;default:_1(this,this._t0,r=vO(this,e,t));break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=r}}};function OU(e){this._context=new MU(e)}(OU.prototype=Object.create(ax.prototype)).point=function(e,t){ax.prototype.point.call(this,t,e)};function MU(e){this._context=e}MU.prototype={moveTo:function(e,t){this._context.moveTo(t,e)},closePath:function(){this._context.closePath()},lineTo:function(e,t){this._context.lineTo(t,e)},bezierCurveTo:function(e,t,r,n,s,i){this._context.bezierCurveTo(t,e,n,r,i,s)}};function pye(e){return new ax(e)}function gye(e){return new OU(e)}function RU(e){this._context=e}RU.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var e=this._x,t=this._y,r=e.length;if(r)if(this._line?this._context.lineTo(e[0],t[0]):this._context.moveTo(e[0],t[0]),r===2)this._context.lineTo(e[1],t[1]);else for(var n=bO(e),s=bO(t),i=0,o=1;o<r;++i,++o)this._context.bezierCurveTo(n[0][i],s[0][i],n[1][i],s[1][i],e[o],t[o]);(this._line||this._line!==0&&r===1)&&this._context.closePath(),this._line=1-this._line,this._x=this._y=null},point:function(e,t){this._x.push(+e),this._y.push(+t)}};function bO(e){var t,r=e.length-1,n,s=new Array(r),i=new Array(r),o=new Array(r);for(s[0]=0,i[0]=2,o[0]=e[0]+2*e[1],t=1;t<r-1;++t)s[t]=1,i[t]=4,o[t]=4*e[t]+2*e[t+1];for(s[r-1]=2,i[r-1]=7,o[r-1]=8*e[r-1]+e[r],t=1;t<r;++t)n=s[t]/i[t-1],i[t]-=n,o[t]-=n*o[t-1];for(s[r-1]=o[r-1]/i[r-1],t=r-2;t>=0;--t)s[t]=(o[t]-s[t+1])/i[t];for(i[r-1]=(e[r]+s[r-1])/2,t=0;t<r-1;++t)i[t]=2*e[t+1]-s[t+1];return[s,i]}function yye(e){return new RU(e)}
vendor: 9,717 bytes, lines 884-887
884function Lb(e,t){this._context=e,this._t=t}Lb.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(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:{if(this._t<=0)this._context.lineTo(this._x,t),this._context.lineTo(e,t);else{var r=this._x*(1-this._t)+e*this._t;this._context.lineTo(r,this._y),this._context.lineTo(r,t)}break}}this._x=e,this._y=t}};function vye(e){return new Lb(e,.5)}function xye(e){return new Lb(e,0)}function bye(e){return new Lb(e,1)}function kd(e,t){if((o=e.length)>1)for(var r=1,n,s,i=e[t[0]],o,l=i.length;r<o;++r)for(s=i,i=e[t[r]],n=0;n<l;++n)i[n][1]+=i[n][0]=isNaN(s[n][1])?s[n][0]:s[n][1]}function fS(e){for(var t=e.length,r=new Array(t);--t>=0;)r[t]=t;return r}function wye(e,t){return e[t]}function jye(e){const t=[];return t.key=e,t}function _ye(){var e=kt([]),t=fS,r=kd,n=wye;function s(i){var o=Array.from(e.apply(this,arguments),jye),l,c=o.length,u=-1,h;for(const d of i)for(l=0,++u;l<c;++l)(o[l][u]=[0,+n(d,o[l].key,u,i)]).data=d;for(l=0,h=$C(t(o));l<c;++l)o[h[l]].index=l;return r(o,h),o}return s.keys=function(i){return arguments.length?(e=typeof i=="function"?i:kt(Array.from(i)),s):e},s.value=function(i){return arguments.length?(n=typeof i=="function"?i:kt(+i),s):n},s.order=function(i){return arguments.length?(t=i==null?fS:typeof i=="function"?i:kt(Array.from(i)),s):t},s.offset=function(i){return arguments.length?(r=i??kd,s):r},s}function Sye(e,t){if((n=e.length)>0){for(var r,n,s=0,i=e[0].length,o;s<i;++s){for(o=r=0;r<n;++r)o+=e[r][s][1]||0;if(o)for(r=0;r<n;++r)e[r][s][1]/=o}kd(e,t)}}function Nye(e,t){if((s=e.length)>0){for(var r=0,n=e[t[0]],s,i=n.length;r<i;++r){for(var o=0,l=0;o<s;++o)l+=e[o][r][1]||0;n[r][1]+=n[r][0]=-l/2}kd(e,t)}}function kye(e,t){if(!(!((o=e.length)>0)||!((i=(s=e[t[0]]).length)>0))){for(var r=0,n=1,s,i,o;n<i;++n){for(var l=0,c=0,u=0;l<o;++l){for(var h=e[t[l]],d=h[n][1]||0,f=h[n-1][1]||0,m=(d-f)/2,g=0;g<l;++g){var p=e[t[g]],v=p[n][1]||0,x=p[n-1][1]||0;m+=v-x}c+=d,u+=m*d}s[n-1][1]+=s[n-1][0]=r,c&&(r-=u/c)}s[n-1][1]+=s[n-1][0]=r,kd(e,t)}}function Em(e){"@babel/helpers - typeof";return Em=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Em(e)}var Cye=["type","size","sizeType"];function mS(){return mS=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},mS.apply(this,arguments)}function wO(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function jO(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?wO(Object(r),!0).forEach(function(n){Eye(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):wO(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Eye(e,t,r){return t=Tye(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Tye(e){var t=Aye(e,"string");return Em(t)=="symbol"?t:t+""}function Aye(e,t){if(Em(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(Em(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Pye(e,t){if(e==null)return{};var r=Oye(e,t),n,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(s=0;s<i.length;s++)n=i[s],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function Oye(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}var $U={symbolCircle:IC,symbolCross:Zge,symbolDiamond:tye,symbolSquare:rye,symbolStar:iye,symbolTriangle:oye,symbolWye:cye},Mye=Math.PI/180,Rye=function(t){var r="symbol".concat($b(t));return $U[r]||IC},$ye=function(t,r,n){if(r==="area")return t;switch(n){case"cross":return 5*t*t/9;case"diamond":return .5*t*t/Math.sqrt(3);case"square":return t*t;case"star":{var s=18*Mye;return 1.25*t*t*(Math.tan(s)-Math.tan(s*2)*Math.pow(Math.tan(s),2))}case"triangle":return Math.sqrt(3)*t*t/4;case"wye":return(21-10*Math.sqrt(3))*t*t/8;default:return Math.PI*t*t/4}},Iye=function(t,r){$U["symbol".concat($b(t))]=r},DC=function(t){var r=t.type,n=r===void 0?"circle":r,s=t.size,i=s===void 0?64:s,o=t.sizeType,l=o===void 0?"area":o,c=Pye(t,Cye),u=jO(jO({},c),{},{type:n,size:i,sizeType:l}),h=function(){var v=Rye(n),x=uye().type(v).size($ye(i,l,n));return x()},d=u.className,f=u.cx,m=u.cy,g=rt(u,!0);return f===+f&&m===+m&&i===+i?J.createElement("path",mS({},g,{className:nt("recharts-symbols",d),transform:"translate(".concat(f,", ").concat(m,")"),d:h()})):null};DC.registerSymbol=Iye;function Cd(e){"@babel/helpers - typeof";return Cd=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Cd(e)}function pS(){return pS=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},pS.apply(this,arguments)}function _O(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function Dye(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?_O(Object(r),!0).forEach(function(n){Tm(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):_O(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Lye(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Fye(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,DU(n.key),n)}}function zye(e,t,r){return t&&Fye(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function Bye(e,t,r){return t=sx(t),Uye(e,IU()?Reflect.construct(t,r||[],sx(e).constructor):t.apply(e,r))}function Uye(e,t){if(t&&(Cd(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Wye(e)}function Wye(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function IU(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(IU=function(){return!!e})()}function sx(e){return sx=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},sx(e)}function Vye(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&gS(e,t)}function gS(e,t){return gS=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,s){return n.__proto__=s,n},gS(e,t)}function Tm(e,t,r){return t=DU(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function DU(e){var t=Hye(e,"string");return Cd(t)=="symbol"?t:t+""}function Hye(e,t){if(Cd(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(Cd(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var sa=32,LC=function(e){function t(){return Lye(this,t),Bye(this,t,arguments)}return Vye(t,e),zye(t,[{key:"renderIcon",value:function(n){var s=this.props.inactiveColor,i=sa/2,o=sa/6,l=sa/3,c=n.inactive?s:n.color;if(n.type==="plainline")return J.createElement("line",{strokeWidth:4,fill:"none",stroke:c,strokeDasharray:n.payload.strokeDasharray,x1:0,y1:i,x2:sa,y2:i,className:"recharts-legend-icon"});if(n.type==="line")return J.createElement("path",{strokeWidth:4,fill:"none",stroke:c,d:"M0,".concat(i,"h").concat(l,`
885            A`).concat(o,",").concat(o,",0,1,1,").concat(2*l,",").concat(i,`
886            H`).concat(sa,"M").concat(2*l,",").concat(i,`
887            A`).concat(o,",").concat(o,",0,1,1,").concat(l,",").concat(i),className:"recharts-legend-icon"});if(n.type==="rect")return J.createElement("path",{stroke:"none",fill:c,d:"M0,".concat(sa/8,"h").concat(sa,"v").concat(sa*3/4,"h").concat(-sa,"z"),className:"recharts-legend-icon"});if(J.isValidElement(n.legendIcon)){var u=Dye({},n);return delete u.legendIcon,J.cloneElement(n.legendIcon,u)}return J.createElement(DC,{fill:c,cx:i,cy:i,size:sa,sizeType:"diameter",type:n.type})}},{key:"renderItems",value:function(){var n=this,s=this.props,i=s.payload,o=s.iconSize,l=s.layout,c=s.formatter,u=s.inactiveColor,h={x:0,y:0,width:sa,height:sa}
887,d={display:l==="horizontal"?"inline-block":"block",marginRight:10},f={display:"inline-block",verticalAlign:"middle",marginRight:4};return i.map(function(m,g){var p=m.formatter||c,v=nt(Tm(Tm({"recharts-legend-item":!0},"legend-item-".concat(g),!0),"inactive",m.inactive));if(m.type==="none")return null;var x=Qe(m.value)?null:m.value;Ni(!Qe(m.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 b=m.inactive?u:m.color;return J.createElement("li",pS({className:v,style:d,key:"legend-item-".concat(g)},Zv(n.props,m,g)),J.createElement(iS,{width:o,height:o,viewBox:h,style:f},n.renderIcon(m)),J.createElement("span",{className:"recharts-legend-item-text",style:{color:b}},p?p(x,m,g):x))})}},{key:"render",value:function(){var n=this.props,s=n.payload,i=n.layout,o=n.align;if(!s||!s.length)return null;var l={padding:0,margin:0,textAlign:i==="horizontal"?o:"left"};return J.createElement("ul",{className:"recharts-default-legend",style:l},this.renderItems())}}])}(y.PureComponent);Tm(LC,"displayName","Legend");Tm(LC,"defaultProps",{iconSize:14,layout:"horizontal",align:"center",verticalAlign:"middle",inactiveColor:"#ccc"});var qye=jb;function Gye(){this.__data__=new qye,this.size=0}var Kye=Gye;function Yye(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r}var Xye=Yye;function Qye(e){return this.__data__.get(e)}var Jye=Qye;function Zye(e){return this.__data__.has(e)}var eve=Zye,tve=jb,rve=NC,nve=kC,ave=200;function sve(e,t){var r=this.__data__;if(r instanceof tve){var n=r.__data__;if(!rve||n.length<ave-1)return n.push([e,t]),this.size=++r.size,this;r=this.__data__=new nve(n)}return r.set(e,t),this.size=r.size,this}var ive=sve,ove=jb,lve=Kye,cve=Xye,uve=Jye,dve=eve,hve=ive;function vh(e){var t=this.__data__=new ove(e);this.size=t.size}vh.prototype.clear=lve;vh.prototype.delete=cve;vh.prototype.get=uve;vh.prototype.has=dve;vh.prototype.set=hve;var LU=vh,fve="__lodash_hash_undefined__";function mve(e){return this.__data__.set(e,fve),this}var pve=mve;function gve(e){return this.__data__.has(e)}var yve=gve,vve=kC,xve=pve,bve=yve;function ix(e){var t=-1,r=e==null?0:e.length;for(this.__data__=new vve;++t<r;)this.add(e[t])}ix.prototype.add=ix.prototype.push=xve;ix.prototype.has=bve;var FU=ix;function wve(e,t){for(var r=-1,n=e==null?0:e.length;++r<n;)if(t(e[r],r,e))return!0;return!1}var zU=wve;function jve(e,t){return e.has(t)}var BU=jve,_ve=FU,Sve=zU,Nve=BU,kve=1,Cve=2;function Eve(e,t,r,n,s,i){var o=r&kve,l=e.length,c=t.length;if(l!=c&&!(o&&c>l))return!1;var u=i.get(e),h=i.get(t);if(u&&h)return u==t&&h==e;var d=-1,f=!0,m=r&Cve?new _ve:void 0;for(i.set(e,t),i.set(t,e);++d<l;){var g=e[d],p=t[d];if(n)var v=o?n(p,g,d,t,e,i):n(g,p,d,e,t,i);if(v!==void 0){if(v)continue;f=!1;break}if(m){if(!Sve(t,function(x,b){if(!Nve(m,b)&&(g===x||s(g,x,r,n,i)))return m.push(b)})){f=!1;break}}else if(!(g===p||s(g,p,r,n,i))){f=!1;break}}return i.delete(e),i.delete(t),f}var UU=Eve,Tve=ri,Ave=Tve.Uint8Array,Pve=Ave;function Ove(e){var t=-1,r=Array(e.size);return e.forEach(function(n,s){r[++t]=[s,n]}),r}var Mve=Ove;function Rve(e){var t=-1,r=Array(e.size);return e.forEach(function(n){r[++t]=n}),r}var FC=Rve,SO=Up,NO=Pve,$ve=SC,Ive=UU,Dve=Mve,Lve=FC,Fve=1,zve=2,Bve="[object Boolean]",Uve="[object Date]",Wve="[object Error]",Vve="[object Map]",Hve="[object Number]",qve="[object RegExp]",Gve="[object Set]",Kve="[object String]",Yve="[object Symbol]",Xve="[object ArrayBuffer]",Qve="[object DataView]",kO=SO?SO.prototype:void 0,S1=kO?kO.valueOf:void 0;function Jve(e,t,r,n,s,i,o){switch(r){case Qve:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case Xve:return!(e.byteLength!=t.byteLength||!i(new NO(e),new NO(t)));case Bve:case Uve:case Hve:return $ve(+e,+t);case Wve:return e.name==t.name&&e.message==t.message;case qve:case Kve:return e==t+"";case Vve:var l=Dve;case Gve:var c=n&Fve;if(l||(l=Lve),e.size!=t.size&&!c)return!1;var u=o.get(e);if(u)return u==t;n|=zve,o.set(e,t);var h=Ive(l(e),l(t),n,s,i,o);return o.delete(e),h;case Yve:if(S1)return S1.call(e)==S1.call(t)}return!1}var Zve=Jve;function exe(e,t){for(var r=-1,n=t.length,s=e.length;++r<n;)e[s+r]=t[r];return e}var WU=exe,txe=WU,rxe=On;function nxe(e,t,r){var n=t(e);return rxe(e)?n:txe(n,r(e))}var axe=nxe;function sxe(e,t){for(var r=-1,n=e==null?0:e.length,s=0,i=[];++r<n;){var o=e[r];t(o,r,e)&&(i[s++]=o)}return i}var ixe=sxe;function oxe(){return[]}var lxe=oxe,cxe=ixe,uxe=lxe,dxe=Object.prototype,hxe=dxe.propertyIsEnumerable,CO=Object.getOwnPropertySymbols,fxe=CO?function(e){return e==null?[]:(e=Object(e),cxe(CO(e),function(t){return hxe.call(e,t)}))}:uxe,mxe=fxe;function pxe(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}var gxe=pxe,yxe=Ki,vxe=Yi,xxe="[object Arguments]";function bxe(e){return vxe(e)&&yxe(e)==xxe}var wxe=bxe,EO=wxe,jxe=Yi,VU=Object.prototype,_xe=VU.hasOwnProperty,Sxe=VU.propertyIsEnumerable,Nxe=EO(function(){return arguments}())?EO:function(e){return jxe(e)&&_xe.call(e,"callee")&&!Sxe.call(e,"callee")},zC=Nxe,ox={exports:{}};function kxe(){return!1}var Cxe=kxe;ox.exports;(function(e,t){var r=ri,n=Cxe,s=t&&!t.nodeType&&t,i=s&&!0&&e&&!e.nodeType&&e,o=i&&i.exports===s,l=o?r.Buffer:void 0,c=l?l.isBuffer:void 0,u=c||n;e.exports=u}
vendor: 4,423 bytes, line 887
887)(ox,ox.exports);var HU=ox.exports,Exe=9007199254740991,Txe=/^(?:0|[1-9]\d*)$/;function Axe(e,t){var r=typeof e;return t=t??Exe,!!t&&(r=="number"||r!="symbol"&&Txe.test(e))&&e>-1&&e%1==0&&e<t}var BC=Axe,Pxe=9007199254740991;function Oxe(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=Pxe}var UC=Oxe,Mxe=Ki,Rxe=UC,$xe=Yi,Ixe="[object Arguments]",Dxe="[object Array]",Lxe="[object Boolean]",Fxe="[object Date]",zxe="[object Error]",Bxe="[object Function]",Uxe="[object Map]",Wxe="[object Number]",Vxe="[object Object]",Hxe="[object RegExp]",qxe="[object Set]",Gxe="[object String]",Kxe="[object WeakMap]",Yxe="[object ArrayBuffer]",Xxe="[object DataView]",Qxe="[object Float32Array]",Jxe="[object Float64Array]",Zxe="[object Int8Array]",e0e="[object Int16Array]",t0e="[object Int32Array]",r0e="[object Uint8Array]",n0e="[object Uint8ClampedArray]",a0e="[object Uint16Array]",s0e="[object Uint32Array]",Mt={};Mt[Qxe]=Mt[Jxe]=Mt[Zxe]=Mt[e0e]=Mt[t0e]=Mt[r0e]=Mt[n0e]=Mt[a0e]=Mt[s0e]=!0;Mt[Ixe]=Mt[Dxe]=Mt[Yxe]=Mt[Lxe]=Mt[Xxe]=Mt[Fxe]=Mt[zxe]=Mt[Bxe]=Mt[Uxe]=Mt[Wxe]=Mt[Vxe]=Mt[Hxe]=Mt[qxe]=Mt[Gxe]=Mt[Kxe]=!1;function i0e(e){return $xe(e)&&Rxe(e.length)&&!!Mt[Mxe(e)]}var o0e=i0e;function l0e(e){return function(t){return e(t)}}var qU=l0e,lx={exports:{}};lx.exports;(function(e,t){var r=eU,n=t&&!t.nodeType&&t,s=n&&!0&&e&&!e.nodeType&&e,i=s&&s.exports===n,o=i&&r.process,l=function(){try{var c=s&&s.require&&s.require("util").types;return c||o&&o.binding&&o.binding("util")}catch{}}();e.exports=l})(lx,lx.exports);var c0e=lx.exports,u0e=o0e,d0e=qU,TO=c0e,AO=TO&&TO.isTypedArray,h0e=AO?d0e(AO):u0e,GU=h0e,f0e=gxe,m0e=zC,p0e=On,g0e=HU,y0e=BC,v0e=GU,x0e=Object.prototype,b0e=x0e.hasOwnProperty;function w0e(e,t){var r=p0e(e),n=!r&&m0e(e),s=!r&&!n&&g0e(e),i=!r&&!n&&!s&&v0e(e),o=r||n||s||i,l=o?f0e(e.length,String):[],c=l.length;for(var u in e)(t||b0e.call(e,u))&&!(o&&(u=="length"||s&&(u=="offset"||u=="parent")||i&&(u=="buffer"||u=="byteLength"||u=="byteOffset")||y0e(u,c)))&&l.push(u);return l}var j0e=w0e,_0e=Object.prototype;function S0e(e){var t=e&&e.constructor,r=typeof t=="function"&&t.prototype||_0e;return e===r}var N0e=S0e;function k0e(e,t){return function(r){return e(t(r))}}var KU=k0e,C0e=KU,E0e=C0e(Object.keys,Object),T0e=E0e,A0e=N0e,P0e=T0e,O0e=Object.prototype,M0e=O0e.hasOwnProperty;function R0e(e){if(!A0e(e))return P0e(e);var t=[];for(var r in Object(e))M0e.call(e,r)&&r!="constructor"&&t.push(r);return t}var $0e=R0e,I0e=_C,D0e=UC;function L0e(e){return e!=null&&D0e(e.length)&&!I0e(e)}var Hp=L0e,F0e=j0e,z0e=$0e,B0e=Hp;function U0e(e){return B0e(e)?F0e(e):z0e(e)}var Fb=U0e,W0e=axe,V0e=mxe,H0e=Fb;function q0e(e){return W0e(e,H0e,V0e)}var G0e=q0e,PO=G0e,K0e=1,Y0e=Object.prototype,X0e=Y0e.hasOwnProperty;function Q0e(e,t,r,n,s,i){var o=r&K0e,l=PO(e),c=l.length,u=PO(t),h=u.length;if(c!=h&&!o)return!1;for(var d=c;d--;){var f=l[d];if(!(o?f in t:X0e.call(t,f)))return!1}var m=i.get(e),g=i.get(t);if(m&&g)return m==t&&g==e;var p=!0;i.set(e,t),i.set(t,e);for(var v=o;++d<c;){f=l[d];var x=e[f],b=t[f];if(n)var w=o?n(b,x,f,t,e,i):n(x,b,f,e,t,i);if(!(w===void 0?x===b||s(x,b,r,n,i):w)){p=!1;break}v||(v=f=="constructor")}if(p&&!v){var j=e.constructor,_=t.constructor;j!=_&&"constructor"in e&&"constructor"in t&&!(typeof j=="function"&&j instanceof j&&typeof _=="function"&&_ instanceof _)&&(p=!1)}return i.delete(e),i.delete(t),p}var J0e=Q0e,Z0e=Rc,ebe=ri,tbe=Z0e(ebe,"DataView"),rbe=tbe,nbe=Rc,abe=ri,sbe=nbe(abe,"Promise"),ibe=sbe,obe=Rc,lbe=ri,cbe=obe(lbe,"Set"),YU=cbe,ube=Rc,dbe=ri,hbe=ube(dbe,"WeakMap"),fbe=hbe,yS=rbe,vS=NC,xS=ibe,bS=YU,wS=fbe,XU=Ki,xh=rU,OO="[object Map]",mbe="[object Object]",MO="[object Promise]",RO="[object Set]",$O="[object WeakMap]",IO="[object DataView]",pbe=xh(yS),gbe=xh(vS),ybe=xh(xS),vbe=xh(bS),xbe=xh(wS),Tl=XU;(yS&&Tl(new yS(new ArrayBuffer(1)))!=IO||vS&&Tl(new vS)!=OO||xS&&Tl(xS.resolve())!=MO||bS&&Tl(new bS)!=RO||wS&&Tl(new wS)!=$O)&&(Tl=function(e){var t=XU(e),r=t==mbe?e.constructor:void 0,n=r?xh(r):"";if(n)switch(n){case pbe:return IO;case gbe:return OO;case ybe:return MO;case vbe:return RO;case xbe:return $O}return t});var bbe=Tl,N1=LU,wbe=UU,jbe=Zve,_be=J0e,DO=bbe,LO=On,FO=HU,Sbe=GU,Nbe=1,zO="[object Arguments]",BO="[object Array]",Hg="[object Object]",kbe=Object.prototype,UO=kbe.hasOwnProperty;function Cbe(e,t,r,n,s,i){var o=LO(e),l=LO(t),c=o?BO:DO(e),u=l?BO:DO(t);c=c==zO?Hg:c,u=u==zO?Hg:u;var h=c==Hg,d=u==Hg,f=c==u;if(f&&FO(e)){if(!FO(t))return!1;o=!0,h=!1}
vendor: 4,093 bytes, line 887
887if(f&&!h)return i||(i=new N1),o||Sbe(e)?wbe(e,t,r,n,s,i):jbe(e,t,c,r,n,s,i);if(!(r&Nbe)){var m=h&&UO.call(e,"__wrapped__"),g=d&&UO.call(t,"__wrapped__");if(m||g){var p=m?e.value():e,v=g?t.value():t;return i||(i=new N1),s(p,v,r,n,i)}}return f?(i||(i=new N1),_be(e,t,r,n,s,i)):!1}var Ebe=Cbe,Tbe=Ebe,WO=Yi;function QU(e,t,r,n,s){return e===t?!0:e==null||t==null||!WO(e)&&!WO(t)?e!==e&&t!==t:Tbe(e,t,r,n,QU,s)}var WC=QU,Abe=LU,Pbe=WC,Obe=1,Mbe=2;function Rbe(e,t,r,n){var s=r.length,i=s,o=!n;if(e==null)return!i;for(e=Object(e);s--;){var l=r[s];if(o&&l[2]?l[1]!==e[l[0]]:!(l[0]in e))return!1}for(;++s<i;){l=r[s];var c=l[0],u=e[c],h=l[1];if(o&&l[2]){if(u===void 0&&!(c in e))return!1}else{var d=new Abe;if(n)var f=n(u,h,c,e,t,d);if(!(f===void 0?Pbe(h,u,Obe|Mbe,n,d):f))return!1}}return!0}var $be=Rbe,Ibe=ul;function Dbe(e){return e===e&&!Ibe(e)}var JU=Dbe,Lbe=JU,Fbe=Fb;function zbe(e){for(var t=Fbe(e),r=t.length;r--;){var n=t[r],s=e[n];t[r]=[n,s,Lbe(s)]}return t}var Bbe=zbe;function Ube(e,t){return function(r){return r==null?!1:r[e]===t&&(t!==void 0||e in Object(r))}}var ZU=Ube,Wbe=$be,Vbe=Bbe,Hbe=ZU;function qbe(e){var t=Vbe(e);return t.length==1&&t[0][2]?Hbe(t[0][0],t[0][1]):function(r){return r===e||Wbe(r,e,t)}}var Gbe=qbe;function Kbe(e,t){return e!=null&&t in Object(e)}var Ybe=Kbe,Xbe=oU,Qbe=zC,Jbe=On,Zbe=BC,ewe=UC,twe=Sb;function rwe(e,t,r){t=Xbe(t,e);for(var n=-1,s=t.length,i=!1;++n<s;){var o=twe(t[n]);if(!(i=e!=null&&r(e,o)))break;e=e[o]}return i||++n!=s?i:(s=e==null?0:e.length,!!s&&ewe(s)&&Zbe(o,s)&&(Jbe(e)||Qbe(e)))}var nwe=rwe,awe=Ybe,swe=nwe;function iwe(e,t){return e!=null&&swe(e,t,awe)}var owe=iwe,lwe=WC,cwe=lU,uwe=owe,dwe=jC,hwe=JU,fwe=ZU,mwe=Sb,pwe=1,gwe=2;function ywe(e,t){return dwe(e)&&hwe(t)?fwe(mwe(e),t):function(r){var n=cwe(r,e);return n===void 0&&n===t?uwe(r,e):lwe(t,n,pwe|gwe)}}var vwe=ywe;function xwe(e){return e}var bh=xwe;function bwe(e){return function(t){return t==null?void 0:t[e]}}var wwe=bwe,jwe=TC;function _we(e){return function(t){return jwe(t,e)}}var Swe=_we,Nwe=wwe,kwe=Swe,Cwe=jC,Ewe=Sb;function Twe(e){return Cwe(e)?Nwe(Ewe(e)):kwe(e)}var Awe=Twe,Pwe=Gbe,Owe=vwe,Mwe=bh,Rwe=On,$we=Awe;function Iwe(e){return typeof e=="function"?e:e==null?Mwe:typeof e=="object"?Rwe(e)?Owe(e[0],e[1]):Pwe(e):$we(e)}var dl=Iwe;function Dwe(e,t,r,n){for(var s=e.length,i=r+(n?1:-1);n?i--:++i<s;)if(t(e[i],i,e))return i;return-1}var e7=Dwe;function Lwe(e){return e!==e}var Fwe=Lwe;function zwe(e,t,r){for(var n=r-1,s=e.length;++n<s;)if(e[n]===t)return n;return-1}var Bwe=zwe,Uwe=e7,Wwe=Fwe,Vwe=Bwe;function Hwe(e,t,r){return t===t?Vwe(e,t,r):Uwe(e,Wwe,r)}var qwe=Hwe,Gwe=qwe;function Kwe(e,t){var r=e==null?0:e.length;return!!r&&Gwe(e,t,0)>-1}var Ywe=Kwe;function Xwe(e,t,r){for(var n=-1,s=e==null?0:e.length;++n<s;)if(r(t,e[n]))return!0;return!1}var Qwe=Xwe;function Jwe(){}var Zwe=Jwe,k1=YU,e1e=Zwe,t1e=FC,r1e=1/0,n1e=k1&&1/t1e(new k1([,-0]))[1]==r1e?function(e){return new k1(e)}:e1e,a1e=n1e,s1e=FU,i1e=Ywe,o1e=Qwe,l1e=BU,c1e=a1e,u1e=FC,d1e=200;function h1e(e,t,r){var n=-1,s=i1e,i=e.length,o=!0,l=[],c=l;if(r)o=!1,s=o1e;else if(i>=d1e){var u=t?null:c1e(e);if(u)return u1e(u);o=!1,s=l1e,c=new s1e}else c=t?[]:l;e:for(;++n<i;){var h=e[n],d=t?t(h):h;if(h=r||h!==0?h:0,o&&d===d){for(var f=c.length;f--;)if(c[f]===d)continue e;t&&c.push(d),l.push(h)}else s(c,d,r)||(c!==l&&c.push(d),l.push(h))}return l}var f1e=h1e,m1e=dl,p1e=f1e;function g1e(e,t){return e&&e.length?p1e(e,m1e(t)):[]}var y1e=g1e;const VO=mt(y1e);function t7(e,t,r){return t===!0?VO(e,r):Qe(t)?VO(e,t):e}function Ed(e){"@babel/helpers - typeof";return Ed=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ed(e)}var v1e=["ref"];function HO(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function si(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};
vendor: 4,211 bytes, line 887
887t%2?HO(Object(r),!0).forEach(function(n){zb(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):HO(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function x1e(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function qO(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n7(n.key),n)}}function b1e(e,t,r){return t&&qO(e.prototype,t),r&&qO(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function w1e(e,t,r){return t=cx(t),j1e(e,r7()?Reflect.construct(t,r||[],cx(e).constructor):t.apply(e,r))}function j1e(e,t){if(t&&(Ed(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return _1e(e)}function _1e(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function r7(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(r7=function(){return!!e})()}function cx(e){return cx=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},cx(e)}function S1e(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&jS(e,t)}function jS(e,t){return jS=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,s){return n.__proto__=s,n},jS(e,t)}function zb(e,t,r){return t=n7(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function n7(e){var t=N1e(e,"string");return Ed(t)=="symbol"?t:t+""}function N1e(e,t){if(Ed(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(Ed(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function k1e(e,t){if(e==null)return{};var r=C1e(e,t),n,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(s=0;s<i.length;s++)n=i[s],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function C1e(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function E1e(e){return e.value}function T1e(e,t){if(J.isValidElement(e))return J.cloneElement(e,t);if(typeof e=="function")return J.createElement(e,t);t.ref;var r=k1e(t,v1e);return J.createElement(LC,r)}var GO=1,Wo=function(e){function t(){var r;x1e(this,t);for(var n=arguments.length,s=new Array(n),i=0;i<n;i++)s[i]=arguments[i];return r=w1e(this,t,[].concat(s)),zb(r,"lastBoundingBox",{width:-1,height:-1}),r}return S1e(t,e),b1e(t,[{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,s=this.getBBox();s?(Math.abs(s.width-this.lastBoundingBox.width)>GO||Math.abs(s.height-this.lastBoundingBox.height)>GO)&&(this.lastBoundingBox.width=s.width,this.lastBoundingBox.height=s.height,n&&n(s)):(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?si({},this.lastBoundingBox):{width:0,height:0}}},{key:"getDefaultPosition",value:function(n){var s=this.props,i=s.layout,o=s.align,l=s.verticalAlign,c=s.margin,u=s.chartWidth,h=s.chartHeight,d,f;if(!n||(n.left===void 0||n.left===null)&&(n.right===void 0||n.right===null))if(o==="center"&&i==="vertical"){var m=this.getBBoxSnapsh
887ot();d={left:((u||0)-m.width)/2}}else d=o==="right"?{right:c&&c.right||0}:{left:c&&c.left||0};if(!n||(n.top===void 0||n.top===null)&&(n.bottom===void 0||n.bottom===null))if(l==="middle"){var g=this.getBBoxSnapshot();f={top:((h||0)-g.height)/2}}else f=l==="bottom"?{bottom:c&&c.bottom||0}:{top:c&&c.top||0};return si(si({},d),f)}},{key:"render",value:function(){var n=this,s=this.props,i=s.content,o=s.width,l=s.height,c=s.wrapperStyle,u=s.payloadUniqBy,h=s.payload,d=si(si({position:"absolute",width:o||"auto",height:l||"auto"},this.getDefaultPosition(c)),c);return J.createElement("div",{className:"recharts-legend-wrapper",style:d,ref:function(m){n.wrapperNode=m}},T1e(i,si(si({},this.props),{},{payload:t7(h,u,E1e)})))}}],[{key:"getWithHeight",value:function(n,s){var i=si(si({},this.defaultProps),n.props),o=i.layout;return o==="vertical"&&Ne(n.props.height)?{height:n.props.height}:o==="horizontal"?{width:n.props.width||s}:null}}])}(y.PureComponent);zb(Wo,"displayName","Legend");zb(Wo,"defaultProps",{iconSize:14,layout:"horizontal",align:"center",verticalAlign:"bottom"});var KO=Up,A1e=zC,P1e=On,YO=KO?KO.isConcatSpreadable:void 0;function O1e(e){return P1e(e)||A1e(e)||!!(YO&&e&&e[YO])}var M1e=O1e,R1e=WU,$1e=M1e;function a7(e,t,r,n,s){var i=-1,o=e.length;for(r||(r=$1e),s||(s=[]);++i<o;){var l=e[i];t>0&&r(l)?t>1?a7(l,t-1,r,n,s):R1e(s,l):n||(s[s.length]=l)}return s}var s7=a7;function I1e(e){return function(t,r,n){for(var s=-1,i=Object(t),o=n(t),l=o.length;l--;){var c=o[e?l:++s];if(r(i[c],c,i)===!1)break}return t}}var D1e=I1e,L1e=D1e,F1e=L1e(),z1e=F1e,B1e=z1e,U1e=Fb;function W1e(e,t){return e&&B1e(e,t,U1e)}var i7=W1e,V1e=Hp;function H1e(e,t){return function(r,n){if(r==null)return r;if(!V1e(r))return e(r,n);for(var s=r.length,i=t?s:-1,o=Object(r);(t?i--:++i<s)&&n(o[i],i,o)!==!1;);return r}}var q1e=H1e,G1e=i7,K1e=q1e,Y1e=K1e(G1e),VC=Y1e,X1e=VC,Q1e=Hp;function J1e(e,t){var r=-1,n=Q1e(e)?Array(e.length):[];return X1e(e,function(s,i,o){n[++r]=t(s,i,o)}),n}var o7=J1e;function Z1e(e,t){var r=e.length;for(e.sort(t);r--;)e[r]=e[r].value;return e}var eje=Z1e,XO=fh;function tje(e,t){if(e!==t){var r=e!==void 0,n=e===null,s=e===e,i=XO(e),o=t!==void 0,l=t===null,c=t===t,u=XO(t);if(!l&&!u&&!i&&e>t||i&&o&&c&&!l&&!u||n&&o&&c||!r&&c||!s)return 1;if(!n&&!i&&!u&&e<t||u&&r&&s&&!n&&!i||l&&r&&s||!o&&s||!c)return-1}return 0}var rje=tje,nje=rje;function aje(e,t,r){for(var n=-1,s=e.criteria,i=t.criteria,o=s.length,l=r.length;++n<o;){var c=nje(s[n],i[n]);if(c){if(n>=l)return c;var u=r[n];return c*(u=="desc"?-1:1)}}return e.index-t.index}var sje=aje,C1=EC,ije=TC,oje=dl,lje=o7,cje=eje,uje=qU,dje=sje,hje=bh,fje=On;function mje(e,t,r){t.length?t=C1(t,function(i){return fje(i)?function(o){return ije(o,i.length===1?i[0]:i)}:i}):t=[hje];var n=-1;t=C1(t,uje(oje));var s=lje(e,function(i,o,l){var c=C1(t,function(u){return u(i)});return{criteria:c,index:++n,value:i}});return cje(s,function(i,o){return dje(i,o,r)})}var pje=mje;function gje(e,t,r){switch(r.length){case 0:return e.call(t);case 1:return e.call(t,r[0]);case 2:return e.call(t,r[0],r[1]);case 3:return e.call(t,r[0],r[1],r[2])}return e.apply(t,r)}var yje=gje,vje=yje,QO=Math.max;function xje(e,t,r){return t=QO(t===void 0?e.length-1:t,0),function(){for(var n=arguments,s=-1,i=QO(n.length-t,0),o=Array(i);++s<i;)o[s]=n[t+s];s=-1;for(var l=Array(t+1);++s<t;)l[s]=n[s];return l[t]=r(o),vje(e,this,l)}}var bje=xje;function wje(e){return function(){return e}}var jje=wje,_je=Rc,Sje=function(){try{var e=_je(Object,"defineProperty");return e({},"",{}),e}catch{}}(),l7=Sje,Nje=jje,JO=l7,kje=bh,Cje=JO?function(e,t){return JO(e,"toString",{configurable:!0,enumerable:!1,value:Nje(t),writable:!0})}:kje,Eje=Cje,Tje=800,Aje=16,Pje=Date.now;function Oje(e){var t=0,r=0;return function(){var n=Pje(),s=Aje-(n-r);if(r=n,s>0){if(++t>=Tje)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}var Mje=Oje,Rje=Eje,$je=Mje,Ije=$je(Rje),Dje=Ije,Lje=bh,Fje=bje,zje=Dje;function Bje(e,t){return zje(Fje(e,t,Lje),e+"")}var Uje=Bje,Wje=SC,Vje=Hp,Hje=BC,qje=ul;function Gje(e,t,r){if(!qje(r))return!1;var n=typeof t;return(n=="number"?Vje(r)&&Hje(t,r.length):n=="string"&&t in r)?Wje(r[t],e):!1}var Bb=Gje,Kje=s7,Yje=pje,Xje=Uje,ZO=Bb,Qje=Xje(function(e,t){if(e==null)return[];var r=t.length;return r>1&&ZO(e,t[0],t[1])?t=[]:r>2&&ZO(t[0],t[1],t[2])&&(t=[t[0]]),Yje(e,Kje(t,1),[])}),Jje=Qje;const HC=mt(Jje);function Am(e){"@babel/helpers - typeof";return Am=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Am(e)}function _S(){return _S=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];
vendor: 31,530 bytes, lines 887-895
887for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},_S.apply(this,arguments)}function Zje(e,t){return n_e(e)||r_e(e,t)||t_e(e,t)||e_e()}function e_e(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
888In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function t_e(e,t){if(e){if(typeof e=="string")return e5(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return e5(e,t)}}function e5(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function r_e(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,s,i,o,l=[],c=!0,u=!1;try{if(i=(r=r.call(e)).next,t!==0)for(;!(c=(n=i.call(r)).done)&&(l.push(n.value),l.length!==t);c=!0);}catch(h){u=!0,s=h}finally{try{if(!c&&r.return!=null&&(o=r.return(),Object(o)!==o))return}finally{if(u)throw s}}return l}}function n_e(e){if(Array.isArray(e))return e}function t5(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function E1(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?t5(Object(r),!0).forEach(function(n){a_e(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):t5(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function a_e(e,t,r){return t=s_e(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function s_e(e){var t=i_e(e,"string");return Am(t)=="symbol"?t:t+""}function i_e(e,t){if(Am(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(Am(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function o_e(e){return Array.isArray(e)&&pr(e[0])&&pr(e[1])?e.join(" ~ "):e}var l_e=function(t){var r=t.separator,n=r===void 0?" : ":r,s=t.contentStyle,i=s===void 0?{}:s,o=t.itemStyle,l=o===void 0?{}:o,c=t.labelStyle,u=c===void 0?{}:c,h=t.payload,d=t.formatter,f=t.itemSorter,m=t.wrapperClassName,g=t.labelClassName,p=t.label,v=t.labelFormatter,x=t.accessibilityLayer,b=x===void 0?!1:x,w=function(){if(h&&h.length){var E={padding:0,margin:0},B=(f?HC(h,f):h).map(function(A,L){if(A.type==="none")return null;var W=E1({display:"block",paddingTop:4,paddingBottom:4,color:A.color||"#000"},l),D=A.formatter||d||o_e,U=A.value,R=A.name,Q=U,K=R;if(D&&Q!=null&&K!=null){var z=D(U,R,A,L,h);if(Array.isArray(z)){var N=Zje(z,2);Q=N[0],K=N[1]}else Q=z}return J.createElement("li",{className:"recharts-tooltip-item",key:"tooltip-item-".concat(L),style:W},pr(K)?J.createElement("span",{className:"recharts-tooltip-item-name"},K):null,pr(K)?J.createElement("span",{className:"recharts-tooltip-item-separator"},n):null,J.createElement("span",{className:"recharts-tooltip-item-value"},Q),J.createElement("span",{className:"recharts-tooltip-item-unit"},A.unit||""))});return J.createElement("ul",{className:"recharts-tooltip-item-list",style:E},B)}return null},j=E1({margin:0,padding:10,backgroundColor:"#fff",border:"1px solid #ccc",whiteSpace:"nowrap"},i),_=E1({margin:0},u),S=!Ze(p),k=S?p:"",P=nt("recharts-default-tooltip",m),C=nt("recharts-tooltip-label",g);S&&v&&h!==void 0&&h!==null&&(k=v(p,h));var M=b?{role:"status","aria-live":"assertive"}:{};return J.createElement("div",_S({className:P,style:j},M),J.createElement("p",{className:C,style:_},J.isValidElement(k)?k:"".concat(k)),w())};function Pm(e){"@babel/helpers - typeof";return Pm=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Pm(e)}function qg(e,t,r){return t=c_e(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function c_e(e){var t=u_e(e,"string");return Pm(t)=="symbol"?t:t+""}function u_e(e,t){if(Pm(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(Pm(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Vh="recharts-tooltip-wrapper",d_e={visibility:"hidden"};function h_e(e){var t=e.coordinate,r=e.translateX,n=e.translateY;return nt(Vh,qg(qg(qg(qg({},"".concat(Vh,"-right"),Ne(r)&&t&&Ne(t.x)&&r>=t.x),"".concat(Vh,"-left"),Ne(r)&&t&&Ne(t.x)&&r<t.x),"".concat(Vh,"-bottom"),Ne(n)&&t&&Ne(t.y)&&n>=t.y),"".concat(Vh,"-top"),Ne(n)&&t&&Ne(t.y)&&n<t.y))}function r5(e){var t=e.allowEscapeViewBox,r=e.coordinate,n=e.key,s=e.offsetTopLeft,i=e.position,o=e.reverseDirection,l=e.tooltipDimension,c=e.viewBox,u=e.viewBoxDimension;if(i&&Ne(i[n]))return i[n];var h=r[n]-l-s,d=r[n]+s;if(t[n])return o[n]?h:d;if(o[n]){var f=h,m=c[n];return f<m?Math.max(d,c[n]):Math.max(h,c[n])}var g=d+l,p=c[n]+u;return g>p?Math.max(h,c[n]):Math.max(d,c[n])}function f_e(e){var t=e.translateX,r=e.translateY,n=e.useTranslate3d;return{transform:n?"translate3d(".concat(t,"px, ").concat(r,"px, 0)"):"translate(".concat(t,"px, ").concat(r,"px)")}}function m_e(e){var t=e.allowEscapeViewBox,r=e.coordinate,n=e.offsetTopLeft,s=e.position,i=e.reverseDirection,o=e.tooltipBox,l=e.useTranslate3d,c=e.viewBox,u,h,d;return o.height>0&&o.width>0&&r?(h=r5({allowEscapeViewBox:t,coordinate:r,key:"x",offsetTopLeft:n,position:s,reverseDirection:i,tooltipDimension:o.width,viewBox:c,viewBoxDimension:c.width}),d=r5({allowEscapeViewBox:t,coordinate:r,key:"y",offsetTopLeft:n,position:s,reverseDirection:i,tooltipDimension:o.height,viewBox:c,viewBoxDimension:c.height}),u=f_e({translateX:h,translateY:d,useTranslate3d:l})):u=d_e,{cssProperties:u,cssClasses:h_e({translateX:h,translateY:d,coordinate:r})}}function Td(e){"@babel/helpers - typeof";return Td=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Td(e)}function n5(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function a5(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?n5(Object(r),!0).forEach(function(n){NS(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):n5(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function p_e(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function g_e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,u7(n.key),n)}}function y_e(e,t,r){return t&&g_e(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function v_e(e,t,r){return t=ux(t),x_e(e,c7()?Reflect.construct(t,r||[],ux(e).constructor):t.apply(e,r))}function x_e(e,t){if(t&&(Td(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return b_e(e)}function b_e(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function c7(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(c7=function(){return!!e})()}function ux(e){return ux=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},ux(e)}function w_e(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&SS(e,t)}function SS(e,t){return SS=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,s){return n.__proto__=s,n},SS(e,t)}function NS(e,t,r){return t=u7(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function u7(e){var t=j_e(e,"string");return Td(t)=="symbol"?t:t+""}function j_e(e,t){if(Td(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(Td(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var s5=1,__e=function(e){function t(){var r;p_e(this,t);for(var n=arguments.length,s=new Array(n),i=0;i<n;i++)s[i]=arguments[i];return r=v_e(this,t,[].concat(s)),NS(r,"state",{dismissed:!1,dismissedAtCoordinate:{x:0,y:0},lastBoundingBox:{width:-1,height:-1}}),NS(r,"handleKeyDown",function(o){if(o.key==="Escape"){var l,c,u,h;r.setState({dismissed:!0,dismissedAtCoordinate:{x:(l=(c=r.props.coordinate)===null||c===void 0?void 0:c.x)!==null&&l!==void 0?l:0,y:(u=(h=r.props.coordinate)===null||h===void 0?void 0:h.y)!==null&&u!==void 0?u:0}})}}),r}return w_e(t,e),y_e(t,[{key:"updateBBox",value:function(){if(this.wrapperNode&&this.wrapperNode.getBoundingClientRect){var n=this.wrapperNode.getBoundingClientRect();(Math.abs(n.width-this.state.lastBoundingBox.width)>s5||Math.abs(n.height-this.state.lastBoundingBox.height)>s5)&&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,s;this.props.active&&this.updateBBox(),this.state.dismissed&&(((n=this.props.coordinate)===null||n===void 0?void 0:n.x)!==this.state.dismissedAtCoordinate.x||((s=this.props.coordinate)===null||s===void 0?void 0:s.y)!==this.state.dismissedAtCoordinate.y)&&(this.state.dismissed=!1)}},{key:"render",value:function(){var n=this,s=this.props,i=s.active,o=s.allowEscapeViewBox,l=s.animationDuration,c=s.animationEasing,u=s.children,h=s.coordinate,d=s.hasPayload,f=s.isAnimationActive,m=s.offset,g=s.position,p=s.reverseDirection,v=s.useTranslate3d,x=s.viewBox,b=s.wrapperStyle,w=m_e({allowEscapeViewBox:o,coordinate:h,offsetTopLeft:m,position:g,reverseDirection:p,tooltipBox:this.state.lastBoundingBox,useTranslate3d:v,viewBox:x}),j=w.cssClasses,_=w.cssProperties,S=a5(a5({transition:f&&i?"transform ".concat(l,"ms ").concat(c):void 0},_),{},{pointerEvents:"none",visibility:!this.state.dismissed&&i&&d?"visible":"hidden",position:"absolute",top:0,left:0},b);return J.createElement("div",{tabIndex:-1,className:j,style:S,ref:function(P){n.wrapperNode=P}},u)}}])}(y.PureComponent),S_e=function(){return!(typeof window<"u"&&window.document&&window.document.createElement&&window.setTimeout)},wh={isSsr:S_e()};function Ad(e){"@babel/helpers - typeof";return Ad=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ad(e)}function i5(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function o5(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?i5(Object(r),!0).forEach(function(n){qC(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):i5(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function N_e(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function k_e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,h7(n.key),n)}}function C_e(e,t,r){return t&&k_e(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function E_e(e,t,r){return t=dx(t),T_e(e,d7()?Reflect.construct(t,r||[],dx(e).constructor):t.apply(e,r))}function T_e(e,t){if(t&&(Ad(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return A_e(e)}function A_e(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function d7(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(d7=function(){return!!e})()}function dx(e){return dx=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},dx(e)}function P_e(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&kS(e,t)}function kS(e,t){return kS=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,s){return n.__proto__=s,n},kS(e,t)}function qC(e,t,r){return t=h7(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function h7(e){var t=O_e(e,"string");return Ad(t)=="symbol"?t:t+""}function O_e(e,t){if(Ad(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(Ad(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function M_e(e){return e.dataKey}function R_e(e,t){return J.isValidElement(e)?J.cloneElement(e,t):typeof e=="function"?J.createElement(e,t):J.createElement(l_e,t)}var oa=function(e){function t(){return N_e(this,t),E_e(this,t,arguments)}return P_e(t,e),C_e(t,[{key:"render",value:function(){var n=this,s=this.props,i=s.active,o=s.allowEscapeViewBox,l=s.animationDuration,c=s.animationEasing,u=s.content,h=s.coordinate,d=s.filterNull,f=s.isAnimationActive,m=s.offset,g=s.payload,p=s.payloadUniqBy,v=s.position,x=s.reverseDirection,b=s.useTranslate3d,w=s.viewBox,j=s.wrapperStyle,_=g??[];d&&_.length&&(_=t7(g.filter(function(k){return k.value!=null&&(k.hide!==!0||n.props.includeHidden)}),p,M_e));var S=_.length>0;return J.createElement(__e,{allowEscapeViewBox:o,animationDuration:l,animationEasing:c,isAnimationActive:f,active:i,coordinate:h,hasPayload:S,offset:m,position:v,reverseDirection:x,useTranslate3d:b,viewBox:w,wrapperStyle:j},R_e(u,o5(o5({},this.props),{},{payload:_})))}}])}(y.PureComponent);qC(oa,"displayName","Tooltip");qC(oa,"defaultProps",{accessibilityLayer:!1,allowEscapeViewBox:{x:!1,y:!1},animationDuration:400,animationEasing:"ease",contentStyle:{},coordinate:{x:0,y:0},cursor:!0,cursorStyle:{},filterNull:!0,isAnimationActive:!wh.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 $_e=ri,I_e=function(){return $_e.Date.now()},D_e=I_e,L_e=/\s/;function F_e(e){for(var t=e.length;t--&&L_e.test(e.charAt(t)););return t}var z_e=F_e,B_e=z_e,U_e=/^\s+/;function W_e(e){return e&&e.slice(0,B_e(e)+1).replace(U_e,"")}var V_e=W_e,H_e=V_e,l5=ul,q_e=fh,c5=NaN,G_e=/^[-+]0x[0-9a-f]+$/i,K_e=/^0b[01]+$/i,Y_e=/^0o[0-7]+$/i,X_e=parseInt;function Q_e(e){if(typeof e=="number")return e;if(q_e(e))return c5;if(l5(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=l5(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=H_e(e);var r=K_e.test(e);return r||Y_e.test(e)?X_e(e.slice(2),r?2:8):G_e.test(e)?c5:+e}var f7=Q_e,J_e=ul,T1=D_e,u5=f7,Z_e="Expected a function",eSe=Math.max,tSe=Math.min;function rSe(e,t,r){var n,s,i,o,l,c,u=0,h=!1,d=!1,f=!0;if(typeof e!="function")throw new TypeError(Z_e);t=u5(t)||0,J_e(r)&&(h=!!r.leading,d="maxWait"in r,i=d?eSe(u5(r.maxWait)||0,t):i,f="trailing"in r?!!r.trailing:f);function m(S){var k=n,P=s;return n=s=void 0,u=S,o=e.apply(P,k),o}function g(S){return u=S,l=setTimeout(x,t),h?m(S):o}function p(S){var k=S-c,P=S-u,C=t-k;return d?tSe(C,i-P):C}function v(S){var k=S-c,P=S-u;return c===void 0||k>=t||k<0||d&&P>=i}function x(){var S=T1();if(v(S))return b(S);l=setTimeout(x,p(S))}function b(S){return l=void 0,f&&n?m(S):(n=s=void 0,o)}function w(){l!==void 0&&clearTimeout(l),u=0,n=c=s=l=void 0}function j(){return l===void 0?o:b(T1())}function _(){var S=T1(),k=v(S);if(n=arguments,s=this,c=S,k){if(l===void 0)return g(c);if(d)return clearTimeout(l),l=setTimeout(x,t),m(c)}return l===void 0&&(l=setTimeout(x,t)),o}return _.cancel=w,_.flush=j,_}var nSe=rSe,aSe=nSe,sSe=ul,iSe="Expected a function";function oSe(e,t,r){var n=!0,s=!0;if(typeof e!="function")throw new TypeError(iSe);return sSe(r)&&(n="leading"in r?!!r.leading:n,s="trailing"in r?!!r.trailing:s),aSe(e,t,{leading:n,maxWait:t,trailing:s})}var lSe=oSe;const m7=mt(lSe);function Om(e){"@babel/helpers - typeof";return Om=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Om(e)}function d5(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function Gg(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?d5(Object(r),!0).forEach(function(n){cSe(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):d5(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function cSe(e,t,r){return t=uSe(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function uSe(e){var t=dSe(e,"string");return Om(t)=="symbol"?t:t+""}function dSe(e,t){if(Om(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(Om(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function hSe(e,t){return gSe(e)||pSe(e,t)||mSe(e,t)||fSe()}function fSe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
889In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function mSe(e,t){if(e){if(typeof e=="string")return h5(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return h5(e,t)}}function h5(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function pSe(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,s,i,o,l=[],c=!0,u=!1;try{if(i=(r=r.call(e)).next,t!==0)for(;!(c=(n=i.call(r)).done)&&(l.push(n.value),l.length!==t);c=!0);}catch(h){u=!0,s=h}finally{try{if(!c&&r.return!=null&&(o=r.return(),Object(o)!==o))return}finally{if(u)throw s}}return l}}function gSe(e){if(Array.isArray(e))return e}var Uu=y.forwardRef(function(e,t){var r=e.aspect,n=e.initialDimension,s=n===void 0?{width:-1,height:-1}:n,i=e.width,o=i===void 0?"100%":i,l=e.height,c=l===void 0?"100%":l,u=e.minWidth,h=u===void 0?0:u,d=e.minHeight,f=e.maxHeight,m=e.children,g=e.debounce,p=g===void 0?0:g,v=e.id,x=e.className,b=e.onResize,w=e.style,j=w===void 0?{}:w,_=y.useRef(null),S=y.useRef();S.current=b,y.useImperativeHandle(t,function(){return Object.defineProperty(_.current,"current",{get:function(){return console.warn("The usage of ref.current.current is deprecated and will no longer be supported."),_.current},configurable:!0})});var k=y.useState({containerWidth:s.width,containerHeight:s.height}),P=hSe(k,2),C=P[0],M=P[1],I=y.useCallback(function(B,A){M(function(L){var W=Math.round(B),D=Math.round(A);return L.containerWidth===W&&L.containerHeight===D?L:{containerWidth:W,containerHeight:D}})},[]);y.useEffect(function(){var B=function(R){var Q,K=R[0].contentRect,z=K.width,N=K.height;I(z,N),(Q=S.current)===null||Q===void 0||Q.call(S,z,N)};p>0&&(B=m7(B,p,{trailing:!0,leading:!1}));var A=new ResizeObserver(B),L=_.current.getBoundingClientRect(),W=L.width,D=L.height;return I(W,D),A.observe(_.current),function(){A.disconnect()}},[I,p]);var E=y.useMemo(function(){var B=C.containerWidth,A=C.containerHeight;if(B<0||A<0)return null;Ni(zl(o)||zl(c),`The width(%s) and height(%s) are both fixed numbers,
890       maybe you don't need to use a ResponsiveContainer.`,o,c),Ni(!r||r>0,"The aspect(%s) must be greater than zero.",r);var L=zl(o)?B:o,W=zl(c)?A:c;r&&r>0&&(L?W=L/r:W&&(L=W*r),f&&W>f&&(W=f)),Ni(L>0||W>0,`The width(%s) and height(%s) of chart should be greater than 0,
891       please check the style of container, or the props width(%s) and height(%s),
892       or add a minWidth(%s) or minHeight(%s) or use aspect(%s) to control the
893       height and width.`,L,W,o,c,h,d,r);var D=!Array.isArray(m)&&Si(m.type).endsWith("Chart");return J.Children.map(m,function(U){return J.isValidElement(U)?y.cloneElement(U,Gg({width:L,height:W},D?{style:Gg({height:"100%",width:"100%",maxHeight:W,maxWidth:L},U.props.style)}:{})):U})},[r,m,c,f,d,h,C,o]);return J.createElement("div",{id:v?"".concat(v):void 0,className:nt("recharts-responsive-container",x),style:Gg(Gg({},j),{},{width:o,height:c,minWidth:h,minHeight:d,maxHeight:f}),ref:_},E)}),p7=function(t){return null};p7.displayName="Cell";function Mm(e){"@babel/helpers - typeof";return Mm=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Mm(e)}function f5(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function CS(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?f5(Object(r),!0).forEach(function(n){ySe(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):f5(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function ySe(e,t,r){return t=vSe(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function vSe(e){var t=xSe(e,"string");return Mm(t)=="symbol"?t:t+""}function xSe(e,t){if(Mm(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(Mm(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Zc={widthCache:{},cacheCount:0},bSe=2e3,wSe={position:"absolute",top:"-20000px",left:0,padding:0,margin:0,border:"none",whiteSpace:"pre"},m5="recharts_measurement_span";function jSe(e){var t=CS({},e);return Object.keys(t).forEach(function(r){t[r]||delete t[r]}),t}var $f=function(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(t==null||wh.isSsr)return{width:0,height:0};var n=jSe(r),s=JSON.stringify({text:t,copyStyle:n});if(Zc.widthCache[s])return Zc.widthCache[s];try{var i=document.getElementById(m5);i||(i=document.createElement("span"),i.setAttribute("id",m5),i.setAttribute("aria-hidden","true"),document.body.appendChild(i));var o=CS(CS({},wSe),n);Object.assign(i.style,o),i.textContent="".concat(t);var l=i.getBoundingClientRect(),c={width:l.width,height:l.height};return Zc.widthCache[s]=c,++Zc.cacheCount>bSe&&(Zc.cacheCount=0,Zc.widthCache={}),c}catch{return{width:0,height:0}}},_Se=function(t){return{top:t.top+window.scrollY-document.documentElement.clientTop,left:t.left+window.scrollX-document.documentElement.clientLeft}};function Rm(e){"@babel/helpers - typeof";return Rm=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Rm(e)}function hx(e,t){return CSe(e)||kSe(e,t)||NSe(e,t)||SSe()}function SSe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
894In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function NSe(e,t){if(e){if(typeof e=="string")return p5(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return p5(e,t)}}function p5(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function kSe(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,s,i,o,l=[],c=!0,u=!1;try{if(i=(r=r.call(e)).next,t===0){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=i.call(r)).done)&&(l.push(n.value),l.length!==t);c=!0);}catch(h){u=!0,s=h}finally{try{if(!c&&r.return!=null&&(o=r.return(),Object(o)!==o))return}finally{if(u)throw s}}return l}}function CSe(e){if(Array.isArray(e))return e}function ESe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function g5(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,ASe(n.key),n)}}function TSe(e,t,r){return t&&g5(e.prototype,t),r&&g5(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function ASe(e){var t=PSe(e,"string");return Rm(t)=="symbol"?t:t+""}function PSe(e,t){if(Rm(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(Rm(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var y5=/(-?\d+(?:\.\d+)?[a-zA-Z%]*)([*/])(-?\d+(?:\.\d+)?[a-zA-Z%]*)/,v5=/(-?\d+(?:\.\d+)?[a-zA-Z%]*)([+-])(-?\d+(?:\.\d+)?[a-zA-Z%]*)/,OSe=/^px|cm|vh|vw|em|rem|%|mm|in|pt|pc|ex|ch|vmin|vmax|Q$/,MSe=/(-?\d+(?:\.\d+)?)([a-zA-Z%]+)?/,g7={cm:96/2.54,mm:96/25.4,pt:96/72,pc:96/6,in:96,Q:96/(2.54*40),px:1},RSe=Object.keys(g7),Su="NaN";function $Se(e,t){return e*g7[t]}var Kg=function(){function e(t,r){ESe(this,e),this.num=t,this.unit=r,this.num=t,this.unit=r,Number.isNaN(t)&&(this.unit=""),r!==""&&!OSe.test(r)&&(this.num=NaN,this.unit=""),RSe.includes(r)&&(this.num=$Se(t,r),this.unit="px")}return TSe(e,[{key:"add",value:function(r){return this.unit!==r.unit?new e(NaN,""):new e(this.num+r.num,this.unit)}},{key:"subtract",value:function(r){return this.unit!==r.unit?new e(NaN,""):new e(this.num-r.num,this.unit)}},{key:"multiply",value:function(r){return this.unit!==""&&r.unit!==""&&this.unit!==r.unit?new e(NaN,""):new e(this.num*r.num,this.unit||r.unit)}},{key:"divide",value:function(r){return this.unit!==""&&r.unit!==""&&this.unit!==r.unit?new e(NaN,""):new e(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,s=(n=MSe.exec(r))!==null&&n!==void 0?n:[],i=hx(s,3),o=i[1],l=i[2];return new e(parseFloat(o),l??"")}}])}();function y7(e){if(e.includes(Su))return Su;for(var t=e;t.includes("*")||t.includes("/");){var r,n=(r=y5.exec(t))!==null&&r!==void 0?r:[],s=hx(n,4),i=s[1],o=s[2],l=s[3],c=Kg.parse(i??""),u=Kg.parse(l??""),h=o==="*"?c.multiply(u):c.divide(u);if(h.isNaN())return Su;t=t.replace(y5,h.toString())}for(;t.includes("+")||/.-\d+(?:\.\d+)?/.test(t);){var d,f=(d=v5.exec(t))!==null&&d!==void 0?d:[],m=hx(f,4),g=m[1],p=m[2],v=m[3],x=Kg.parse(g??""),b=Kg.parse(v??""),w=p==="+"?x.add(b):x.subtract(b);if(w.isNaN())return Su;t=t.replace(v5,w.toString())}return t}var x5=/\(([^()]*)\)/;function ISe(e){for(var t=e;t.includes("(");){var r=x5.exec(t),n=hx(r,2),s=n[1];t=t.replace(x5,y7(s))}return t}function DSe(e){var t=e.replace(/\s+/g,"");return t=ISe(t),t=y7(t),t}function LSe(e){try{return DSe(e)}catch{return Su}}function A1(e){var t=LSe(e.slice(5,-1));return t===Su?"":t}var FSe=["x","y","lineHeight","capHeight","scaleToFit","textAnchor","verticalAnchor","fill"],zSe=["dx","dy","angle","className","breakAll"];function ES(){return ES=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},ES.apply(this,arguments)}function b5(e,t){if(e==null)return{};var r=BSe(e,t),n,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(s=0;s<i.length;s++)n=i[s],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function BSe(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function w5(e,t){return HSe(e)||VSe(e,t)||WSe(e,t)||USe()}function USe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
895In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function WSe(e,t){if(e){if(typeof e=="string")return j5(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return j5(e,t)}}function j5(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function VSe(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,s,i,o,l=[],c=!0,u=!1;try{if(i=(r=r.call(e)).next,t===0){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=i.call(r)).done)&&(l.push(n.value),l.length!==t);c=!0);}catch(h){u=!0,s=h}finally{try{if(!c&&r.return!=null&&(o=r.return(),Object(o)!==o))return}finally{if(u)throw s}}return l}}function HSe(e){if(Array.isArray(e))return e}var v7=/[ \f\n\r\t\v\u2028\u2029]+/,x7=function(t){var r=t.children,n=t.breakAll,s=t.style;try{var i=[];Ze(r)||(n?i=r.toString().split(""):i=r.toString().split(v7));var o=i.map(function(c){return{word:c,width:$f(c,s).width}}),l=n?0:$f(" ",s).width;return{wordsWithComputedWidth:o,spaceWidth:l}}catch{return null}},qSe=function(t,r,n,s,i){var o=t.maxLines,l=t.children,c=t.style,u=t.breakAll,h=Ne(o),d=l,f=function(){var L=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];return L.reduce(function(W,D){var U=D.word,R=D.width,Q=W[W.length-1];if(Q&&(s==null||i||Q.width+R+n<Number(s)))Q.words.push(U),Q.width+=R+n;else{var K={words:[U],width:R};W.push(K)}return W},[])},m=f(r),g=function(L){return L.reduce(function(W,D){return W.width>D.width?W:D})};if(!h)return m;for(var p="…",v=function(L){var W=d.slice(0,L),D=x7({breakAll:u,style:c,children:W+p}).wordsWithComputedWidth,U=f(D),R=U.length>o||g(U).width>Number(s);return[R,U]},x=0,b=d.length-1,w=0,j;x<=b&&w<=d.length-1;){var _=Math.floor((x+b)/2),S=_-1,k=v(S),P=w5(k,2),C=P[0],M=P[1],I=v(_),E=w5(I,1
895),B=E[0];if(!C&&!B&&(x=_+1),C&&B&&(b=_-1),!C&&B){j=M;break}w++}return j||m},_5=function(t){var r=Ze(t)?[]:t.toString().split(v7);return[{words:r}]},GSe=function(t){var r=t.width,n=t.scaleToFit,s=t.children,i=t.style,o=t.breakAll,l=t.maxLines;if((r||n)&&!wh.isSsr){var c,u,h=x7({breakAll:o,children:s,style:i});if(h){var d=h.wordsWithComputedWidth,f=h.spaceWidth;c=d,u=f}else return _5(s);return qSe({breakAll:o,children:s,maxLines:l,style:i},c,u,r,n)}return _5(s)},S5="#808080",fx=function(t){var r=t.x,n=r===void 0?0:r,s=t.y,i=s===void 0?0:s,o=t.lineHeight,l=o===void 0?"1em":o,c=t.capHeight,u=c===void 0?"0.71em":c,h=t.scaleToFit,d=h===void 0?!1:h,f=t.textAnchor,m=f===void 0?"start":f,g=t.verticalAnchor,p=g===void 0?"end":g,v=t.fill,x=v===void 0?S5:v,b=b5(t,FSe),w=y.useMemo(function(){return GSe({breakAll:b.breakAll,children:b.children,maxLines:b.maxLines,scaleToFit:d,style:b.style,width:b.width})},[b.breakAll,b.children,b.maxLines,d,b.style,b.width]),j=b.dx,_=b.dy,S=b.angle,k=b.className,P=b.breakAll,C=b5(b,zSe);if(!pr(n)||!pr(i))return null;var M=n+(Ne(j)?j:0),I=i+(Ne(_)?_:0),E;switch(p){case"start":E=A1("calc(".concat(u,")"));break;case"middle":E=A1("calc(".concat((w.length-1)/2," * -").concat(l," + (").concat(u," / 2))"));break;default:E=A1("calc(".concat(w.length-1," * -").concat(l,")"));break}var B=[];if(d){var A=w[0].width,L=b.width;B.push("scale(".concat((Ne(L)?L/A:1)/A,")"))}return S&&B.push("rotate(".concat(S,", ").concat(M,", ").concat(I,")")),B.length&&(C.transform=B.join(" ")),J.createElement("text",ES({},rt(C,!0),{x:M,y:I,className:nt("recharts-text",k),textAnchor:m,fill:x.includes("url")?S5:x}),w.map(function(W,D){var U=W.words.join(P?"":" ");return J.createElement("tspan",{x:M,dy:D===0?E:l,key:"".concat(U,"-").concat(D)},U)}))};function Vo(e,t){return e==null||t==null?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function KSe(e,t){return e==null||t==null?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function GC(e){let t,r,n;e.length!==2?(t=Vo,r=(l,c)=>Vo(e(l),c),n=(l,c)=>e(l)-c):(t=e===Vo||e===KSe?e:YSe,r=e,n=e);function s(l,c,u=0,h=l.length){if(u<h){if(t(c,c)!==0)return h;do{const d=u+h>>>1;r(l[d],c)<0?u=d+1:h=d}while(u<h)}return u}function i(l,c,u=0,h=l.length){if(u<h){if(t(c,c)!==0)return h;do{const d=u+h>>>1;r(l[d],c)<=0?u=d+1:h=d}while(u<h)}return u}function o(l,c,u=0,h=l.length){const d=s(l,c,u,h-1);return d>u&&n(l[d-1],c)>-n(l[d],c)?d-1:d}return{left:s,center:o,right:i}}function YSe(){return 0}function b7(e){return e===null?NaN:+e}function*XSe(e,t){for(let r of e)r!=null&&(r=+r)>=r&&(yield r)}const QSe=GC(Vo),qp=QSe.right;GC(b7).center;class N5 extends Map{constructor(t,r=eNe){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:r}}),t!=null)for(const[n,s]of t)this.set(n,s)}get(t){return super.get(k5(this,t))}has(t){return super.has(k5(this,t))}set(t,r){return super.set(JSe(this,t),r)}delete(t){return super.delete(ZSe(this,t))}}function k5({_intern:e,_key:t},r){const n=t(r);return e.has(n)?e.get(n):r}function JSe({_intern:e,_key:t},r){const n=t(r);return e.has(n)?e.get(n):(e.set(n,r),r)}function ZSe({_intern:e,_key:t},r){const n=t(r);return e.has(n)&&(r=e.get(n),e.delete(n)),r}function eNe(e){return e!==null&&typeof e=="object"?e.valueOf():e}function tNe(e=Vo){if(e===Vo)return w7;if(typeof e!="function")throw new TypeError("compare is not a function");return(t,r)=>{const n=e(t,r);return n||n===0?n:(e(r,r)===0)-(e(t,t)===0)}}function w7(e,t){return(e==null||!(e>=e))-(t==null||!(t>=t))||(e<t?-1:e>t?1:0)}const rNe=Math.sqrt(50),nNe=Math.sqrt(10),aNe=Math.sqrt(2);function mx(e,t,r){const n=(t-e)/Math.max(0,r),s=Math.floor(Math.log10(n)),i=n/Math.pow(10,s),o=i>=rNe?10:i>=nNe?5:i>=aNe?2:1;let l,c,u;return s<0?(u=Math.pow(10,-s)/o,l=Math.round(e*u),c=Math.round(t*u),l/u<e&&++l,c/u>t&&--c,u=-u):(u=Math.pow(10,s)*o,l=Math.round(e/u),c=Math.round(t/u),l*u<e&&++l,c*u>t&&--c),c<l&&.5<=r&&r<2?mx(e,t,r*2):[l,c,u]}function TS(e,t,r){if(t=+t,e=+e,r=+r,!(r>0))return[];if(e===t)return[e];const n=t<e,[s,i,o]=n?mx(t,e,r):mx(e,t,r);if(!(i>=s))return[];const l=i-s+1,c=new Array(l);if(n)if(o<0)for(let u=0;u<l;++u)c[u]=(i-u)/-o;else for(let u=0;u<l;++u)c[u]=(i-u)*o;else if(o<0)for(let u=0;u<l;++u)c[u]=(s+u)/-o;else for(let u=0;u<l;++u)c[u]=(s+u)*o;return c}function AS(e,t,r){return t=+t,e=+e,r=+r,mx(e,t,r)[2]}function PS(e,t,r){t=+t,e=+e,r=+r;const n=t<e,s=n?AS(t,e,r):AS(e,t,r);return(n?-1:1)*(s<0?1/-s:s)}function C5(e,t){let r;for(const n of e)n!=null&&(r<n||r===void 0&&n>=n)&&(r=n);return r}function E5(e,t){let r;for(const n of e)n!=null&&(r>n||r===void 0&&n>=n)&&(r=n);return r}function j7(e,t,r=0,n=1/0,s){if(t=Math.floor(t),r=Math.floor(Math.max(0,r)),n=Math.floor(Math.min(e.length-1,n)),!(r<=t&&t<=n))return e;for(s=s===void 0?w7:tNe(s);n>r;){if(n-r>600){const c=n-r+1,u=t-r+1,h=Math.log(c),d=.5*Math.exp(2*h/3),f=.5*Math.sqrt(h*d*(c-d)/c)*(u-c/2<0?-1:1),m=Math.max(r,Math.floor(t-u*d/c+f)),g=Math.min(n,Math.floor(t+(c-u)*d/c+f));j7(e,t,m,g,s)}const i=e[t];let o=r,l=n;for(Hh(e,r,t),s(e[n],i)>0&&Hh(e,r,n);o<l;){for(Hh(e,o,l),++o,--l;s(e[o],i)<0;)++o;for(;s(e[l],i)>0;)--l}s(e[r],i)===0?Hh(e,r,l):(++l,Hh(e,l,n)),l<=t&&(r=l+1),t<=l&&(n=l-1)}return e}function Hh(e,t,r){const n=e[t];e[t]=e[r],e[r]=n}function sNe(e,t,r){if(e=Float64Array.from(XSe(e)),!(!(n=e.length)||isNaN(t=+t))){if(t<=0||n<2)return E5(e);if(t>=1)return C5(e);var n,s=(n-1)*t,i=Math.floor(s),o=C5(j7(e,i).subarray(0,i+1)),l=E5(e.subarray(i+1));return o+(l-o)*(s-i)}}function iNe(e,t,r=b7){if(!(!(n=e.length)||isNaN(t=+t))){if(t<=0||n<2)return+r(e[0],0,e);if(t>=1)return+r(e[n-1],n-1,e);var n,s=(n-1)*t,i=Math.floor(s),o=+r(e[i],i,e),l=+r(e[i+1],i+1,e);return o+(l-o)*(s-i)}}function oNe(e,t,r){e=+e,t=+t,r=(s=arguments.length)<2?(t=e,e=0,1):s<3?1:+r;for(var n=-1,s=Math.max(0,Math.ceil((t-e)/r))|0,i=new Array(s);++n<s;)i[n]=e+n*r;return i}function Ea(e,t){switch(arguments.length){case 0:break;case 1:this.range(e);break;default:this.range(t).domain(e);break}return this}function Xi(e,t){switch(arguments.length){case 0:break;case 1:{typeof e=="function"?this.interpolator(e):this.range(e);break}default:{this.domain(e),typeof t=="function"?this.interpolator(t):this.range(t);break}}return this}
vendor: 5,794 bytes, line 895
895const OS=Symbol("implicit");function KC(){var e=new N5,t=[],r=[],n=OS;function s(i){let o=e.get(i);if(o===void 0){if(n!==OS)return n;e.set(i,o=t.push(i)-1)}return r[o%r.length]}return s.domain=function(i){if(!arguments.length)return t.slice();t=[],e=new N5;for(const o of i)e.has(o)||e.set(o,t.push(o)-1);return s},s.range=function(i){return arguments.length?(r=Array.from(i),s):r.slice()},s.unknown=function(i){return arguments.length?(n=i,s):n},s.copy=function(){return KC(t,r).unknown(n)},Ea.apply(s,arguments),s}function $m(){var e=KC().unknown(void 0),t=e.domain,r=e.range,n=0,s=1,i,o,l=!1,c=0,u=0,h=.5;delete e.unknown;function d(){var f=t().length,m=s<n,g=m?s:n,p=m?n:s;i=(p-g)/Math.max(1,f-c+u*2),l&&(i=Math.floor(i)),g+=(p-g-i*(f-c))*h,o=i*(1-c),l&&(g=Math.round(g),o=Math.round(o));var v=oNe(f).map(function(x){return g+i*x});return r(m?v.reverse():v)}return e.domain=function(f){return arguments.length?(t(f),d()):t()},e.range=function(f){return arguments.length?([n,s]=f,n=+n,s=+s,d()):[n,s]},e.rangeRound=function(f){return[n,s]=f,n=+n,s=+s,l=!0,d()},e.bandwidth=function(){return o},e.step=function(){return i},e.round=function(f){return arguments.length?(l=!!f,d()):l},e.padding=function(f){return arguments.length?(c=Math.min(1,u=+f),d()):c},e.paddingInner=function(f){return arguments.length?(c=Math.min(1,f),d()):c},e.paddingOuter=function(f){return arguments.length?(u=+f,d()):u},e.align=function(f){return arguments.length?(h=Math.max(0,Math.min(1,f)),d()):h},e.copy=function(){return $m(t(),[n,s]).round(l).paddingInner(c).paddingOuter(u).align(h)},Ea.apply(d(),arguments)}function _7(e){var t=e.copy;return e.padding=e.paddingOuter,delete e.paddingInner,delete e.paddingOuter,e.copy=function(){return _7(t())},e}function If(){return _7($m.apply(null,arguments).paddingInner(1))}function YC(e,t,r){e.prototype=t.prototype=r,r.constructor=e}function S7(e,t){var r=Object.create(e.prototype);for(var n in t)r[n]=t[n];return r}function Gp(){}var Im=.7,px=1/Im,Wu="\\s*([+-]?\\d+)\\s*",Dm="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",qs="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",lNe=/^#([0-9a-f]{3,8})$/,cNe=new RegExp(`^rgb\\(${Wu},${Wu},${Wu}\\)$`),uNe=new RegExp(`^rgb\\(${qs},${qs},${qs}\\)$`),dNe=new RegExp(`^rgba\\(${Wu},${Wu},${Wu},${Dm}\\)$`),hNe=new RegExp(`^rgba\\(${qs},${qs},${qs},${Dm}\\)$`),fNe=new RegExp(`^hsl\\(${Dm},${qs},${qs}\\)$`),mNe=new RegExp(`^hsla\\(${Dm},${qs},${qs},${Dm}\\)$`),T5={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};YC(Gp,Lm,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:A5,formatHex:A5,formatHex8:pNe,formatHsl:gNe,formatRgb:P5,toString:P5});function A5(){return this.rgb().formatHex()}function pNe(){return this.rgb().formatHex8()}function gNe(){return N7(this).formatHsl()}function P5(){return this.rgb().formatRgb()}function Lm(e){var t,r;return e=(e+"").trim().toLowerCase(),(t=lNe.exec(e))?(r=t[1].length,t=parseInt(t[1],16),r===6?O5(t):r===3?new Nn(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):r===8?Yg(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):r===4?Yg(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>
vendor: 9,469 bytes, line 895
8954&15|t&240,((t&15)<<4|t&15)/255):null):(t=cNe.exec(e))?new Nn(t[1],t[2],t[3],1):(t=uNe.exec(e))?new Nn(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=dNe.exec(e))?Yg(t[1],t[2],t[3],t[4]):(t=hNe.exec(e))?Yg(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=fNe.exec(e))?$5(t[1],t[2]/100,t[3]/100,1):(t=mNe.exec(e))?$5(t[1],t[2]/100,t[3]/100,t[4]):T5.hasOwnProperty(e)?O5(T5[e]):e==="transparent"?new Nn(NaN,NaN,NaN,0):null}function O5(e){return new Nn(e>>16&255,e>>8&255,e&255,1)}function Yg(e,t,r,n){return n<=0&&(e=t=r=NaN),new Nn(e,t,r,n)}function yNe(e){return e instanceof Gp||(e=Lm(e)),e?(e=e.rgb(),new Nn(e.r,e.g,e.b,e.opacity)):new Nn}function MS(e,t,r,n){return arguments.length===1?yNe(e):new Nn(e,t,r,n??1)}function Nn(e,t,r,n){this.r=+e,this.g=+t,this.b=+r,this.opacity=+n}YC(Nn,MS,S7(Gp,{brighter(e){return e=e==null?px:Math.pow(px,e),new Nn(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Im:Math.pow(Im,e),new Nn(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Nn(tc(this.r),tc(this.g),tc(this.b),gx(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:M5,formatHex:M5,formatHex8:vNe,formatRgb:R5,toString:R5}));function M5(){return`#${Bl(this.r)}${Bl(this.g)}${Bl(this.b)}`}function vNe(){return`#${Bl(this.r)}${Bl(this.g)}${Bl(this.b)}${Bl((isNaN(this.opacity)?1:this.opacity)*255)}`}function R5(){const e=gx(this.opacity);return`${e===1?"rgb(":"rgba("}${tc(this.r)}, ${tc(this.g)}, ${tc(this.b)}${e===1?")":`, ${e})`}`}function gx(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function tc(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Bl(e){return e=tc(e),(e<16?"0":"")+e.toString(16)}function $5(e,t,r,n){return n<=0?e=t=r=NaN:r<=0||r>=1?e=t=NaN:t<=0&&(e=NaN),new Qa(e,t,r,n)}function N7(e){if(e instanceof Qa)return new Qa(e.h,e.s,e.l,e.opacity);if(e instanceof Gp||(e=Lm(e)),!e)return new Qa;if(e instanceof Qa)return e;e=e.rgb();var t=e.r/255,r=e.g/255,n=e.b/255,s=Math.min(t,r,n),i=Math.max(t,r,n),o=NaN,l=i-s,c=(i+s)/2;return l?(t===i?o=(r-n)/l+(r<n)*6:r===i?o=(n-t)/l+2:o=(t-r)/l+4,l/=c<.5?i+s:2-i-s,o*=60):l=c>0&&c<1?0:o,new Qa(o,l,c,e.opacity)}function xNe(e,t,r,n){return arguments.length===1?N7(e):new Qa(e,t,r,n??1)}function Qa(e,t,r,n){this.h=+e,this.s=+t,this.l=+r,this.opacity=+n}YC(Qa,xNe,S7(Gp,{brighter(e){return e=e==null?px:Math.pow(px,e),new Qa(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Im:Math.pow(Im,e),new Qa(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,r=this.l,n=r+(r<.5?r:1-r)*t,s=2*r-n;return new Nn(P1(e>=240?e-240:e+120,s,n),P1(e,s,n),P1(e<120?e+240:e-120,s,n),this.opacity)},clamp(){return new Qa(I5(this.h),Xg(this.s),Xg(this.l),gx(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 e=gx(this.opacity);return`${e===1?"hsl(":"hsla("}${I5(this.h)}, ${Xg(this.s)*100}%, ${Xg(this.l)*100}%${e===1?")":`, ${e})`}`}}));function I5(e){return e=(e||0)%360,e<0?e+360:e}function Xg(e){return Math.max(0,Math.min(1,e||0))}function P1(e,t,r){return(e<60?t+(r-t)*e/60:e<180?r:e<240?t+(r-t)*(240-e)/60:t)*255}const XC=e=>()=>e;function bNe(e,t){return function(r){return e+r*t}}function wNe(e,t,r){return e=Math.pow(e,r),t=Math.pow(t,r)-e,r=1/r,function(n){return Math.pow(e+n*t,r)}}function jNe(e){return(e=+e)==1?k7:function(t,r){return r-t?wNe(t,r,e):XC(isNaN(t)?r:t)}}function k7(e,t){var r=t-e;return r?bNe(e,r):XC(isNaN(e)?t:e)}const D5=function e(t){var r=jNe(t);function n(s,i){var o=r((s=MS(s)).r,(i=MS(i)).r),l=r(s.g,i.g),c=r(s.b,i.b),u=k7(s.opacity,i.opacity);return function(h){return s.r=o(h),s.g=l(h),s.b=c(h),s.opacity=u(h),s+""}}return n.gamma=e,n}(1);function _Ne(e,t){t||(t=[]);var r=e?Math.min(t.length,e.length):0,n=t.slice(),s;return function(i){for(s=0;s<r;++s)n[s]=e[s]*(1-i)+t[s]*i;return n}}function SNe(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function NNe(e,t){var r=t?t.length:0,n=e?Math.min(r,e.length):0,s=new Array(n),i=new Array(r),o;for(o=0;o<n;++o)s[o]=jh(e[o],t[o]);for(;o<r;++o)i[o]=t[o];return function(l){for(o=0;o<n;++o)i[o]=s[o](l);return i}}function kNe(e,t){var r=new Date;return e=+e,t=+t,function(n){return r.setTime(e*(1-n)+t*n),r}}function yx(e,t){return e=+e,t=+t,function(r){return e*(1-r)+t*r}}function CNe(e,t){var r={},n={},s;(e===null||typeof e!="object")&&(e={}),(t===null||typeof t!="object")&&(t={});for(s in t)s in e?r[s]=jh(e[s],t[s]):n[s]=t[s];return function(i){for(s in r)n[s]=r[s](i);return n}}var RS=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,O1=new RegExp(RS.source,"g");function ENe(e){return function(){return e}}function TNe(e){return function(t){return e(t)+""}}function ANe(e,t){var r=RS.lastIndex=O1.lastIndex=0,n,s,i,o=-1,l=[],c=[];for(e=e+"",t=t+"";(n=RS.exec(e))&&(s=O1.exec(t));)(i=s.index)>r&&(i=t.slice(r,i),l[o]?l[o]+=i:l[++o]=i),(n=n[0])===(s=s[0])?l[o]?l[o]+=s:l[++o]=s:(l[++o]=null,c.push({i:o,x:yx(n,s)})),r=O1.lastIndex;return r<t.length&&(i=t.slice(r),l[o]?l[o]+=i:l[++o]=i),l.length<2?c[0]?TNe(c[0].x):ENe(t):(t=c.length,function(u){for(var h=0,d;h<t;++h)l[(d=c[h]).i]=d.x(u);return l.join("")})}function jh(e,t){var r=typeof t,n;return t==null||r==="boolean"?XC(t):(r==="number"?yx:r==="string"?(n=Lm(t))?(t=n,D5):ANe:t instanceof Lm?D5:t instanceof Date?kNe:SNe(t)?_Ne:Array.isArray(t)?NNe:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?CNe:yx)(e,t)}function QC(e,t){return e=+e,t=+t,function(r){return Math.round(e*(1-r)+t*r)}}function PNe(e,t){t===void 0&&(t=e,e=jh);for(var r=0,n=t.length-1,s=t[0],i=new Array(n<0?0:n);r<n;)i[r]=e(s,s=t[++r]);return function(o){var l=Math.max(0,Math.min(n-1,Math.floor(o*=n)));return i[l](o-l)}}function ONe(e){return function(){return e}}function vx(e){return+e}var L5=[0,1];function sn(e){return e}function $S(e,t){return(t-=e=+e)?function(r){return(r-e)/t}:ONe(isNaN(t)?NaN:.5)}function MNe(e,t){var r;return e>t&&(r=e,e=t,t=r),function(n){return Math.max(e,Math.min(t,n))}}function RNe(e,t,r){var n=e[0],s=e[1],i=t[0],o=t[1];return s<n?(n=$S(s,n),i=r(o,i)):(n=$S(n,s),i=r(i,o)),function(l){return i(n(l))}}function $Ne(e,t,r){var n=Math.min(e.length,t.length)-1,s=new Array(n),i=new Array(n),o=-1;for(e[n]<e[0]&&(e=e.slice().reverse(),t=t.slice().reverse());++o<n;)s[o]=$S(e[o],e[o+1]),i[o]=r(t[o],t[o+1]);return function(l){var c=qp(e,l,1,n)-1;return i[c](s[c](l))}}function Kp(e,t){return t.domain(e.domain()).range(e.range()).interpolate(e.interpolate()).clamp(e.clamp()).unknown(e.unknown())}function Ub(){var e=L5,t=L5,r=jh,n,s,i,o=sn,l,c,u;function h(){var f=Math.min(e.length,t.length);return o!==sn&&(o=MNe(e[0],e[f-1])),l=f>2?$Ne:RNe,c=u=null,d}function d(f){return f==null||isNaN(f=+f)?i:(c||(c=l(e.map(n),t,r)))(n(o(f)))}return d.invert=function(f){return o(s((u||(u=l(t,e.map(n),yx)))(f)))},d.domain=function(f){return arguments.length?(e=Array.from(f,vx),h()):e.slice()},d.range=function(f){return arguments.length?(t=Array.from(f),h()):t.slice()},d.rangeRound=function(f){return t=Array.from(f),r=QC,h()},d.clamp=function(f){return arguments.length?(o=f?!0:sn,h()):o!==sn},d.interpolate=function(f){return arguments.length?(r=f,h()):r},d.unknown=function(f){return arguments.length?(i=f,d):i},function(f,m){return n=f,s=m,h()}}function JC(){return Ub()(sn,sn)}function INe(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)}function xx(e,t){if(!isFinite(e)||e===0)return null;var r=(e=t?e.toExponential(t-1):e.toExponential()).indexOf("e"),n=e.slice(0,r);return[n.length>1?n[0]+n.slice(2):n,+e.slice(r+1)]}function Pd(e){return e=xx(Math.abs(e)),e?e[1]:NaN}function DNe(e,t){return function(r,n){for(var s=r.length,i=[],o=0,l=e[0],c=0;s>0&&l>0&&(c+l+1>n&&(l=Math.max(1,n-c)),i.push(r.substring(s-=l,s+l)),!((c+=l+1)>n));)l=e[o=(o+1)%e.length];return i.reverse().join(t)}}function LNe(e){return function(t){return t.replace(/[0-9]/g,function(r){return e[+r]})}}var FNe=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Fm(e){if(!(t=FNe.exec(e)))throw new Error("invalid format: "+e);var t;return new ZC({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}Fm.prototype=ZC.prototype;function ZC(e){this.fill=e.fill===void 0?" ":e.fill+"",this.align=e.align===void 0?">":e.align+"",this.sign=e.sign===void 0?"-":e.sign+"",this.symbol=e.symbol===void 0?"":e.symbol+"",this.zero=!!e.zero,this.width=e.width===void 0?void 0:+e.width,this.comma=!!e.comma,this.precision=e.precision===void 0?void 0:+e.precision,this.trim=!!e.trim,this.type=e.type===void 0?"":e.type+""}ZC.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 zNe(e){e:for(var t=e.length,r=1,n=-1,s;r<t;++r)switch(e[r]){case".":n=s=r;break;case"0":n===0&&(n=r),s=r;break;default:if(!+e[r])break e;n>0&&(n=0);break}return n>0?e.slice(0,n)+e.slice(s+1):e}var bx;function BNe(e,t){var r=xx(e,t);if(!r)return bx=void 0,e.toPrecision(t);var n=r[0],s=r[1],i=s-(bx=Math.max(-8,Math.min(8,Math.floor(s/3)))*3)+1,o=n.length;return i===o?n:i>o?n+new Array(i-o+1).join("0"):i>
vendor: 6,011 bytes, line 895
8950?n.slice(0,i)+"."+n.slice(i):"0."+new Array(1-i).join("0")+xx(e,Math.max(0,t+i-1))[0]}function F5(e,t){var r=xx(e,t);if(!r)return e+"";var n=r[0],s=r[1];return s<0?"0."+new Array(-s).join("0")+n:n.length>s+1?n.slice(0,s+1)+"."+n.slice(s+1):n+new Array(s-n.length+2).join("0")}const z5={"%":(e,t)=>(e*100).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+"",d:INe,e:(e,t)=>e.toExponential(t),f:(e,t)=>e.toFixed(t),g:(e,t)=>e.toPrecision(t),o:e=>Math.round(e).toString(8),p:(e,t)=>F5(e*100,t),r:F5,s:BNe,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function B5(e){return e}var U5=Array.prototype.map,W5=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function UNe(e){var t=e.grouping===void 0||e.thousands===void 0?B5:DNe(U5.call(e.grouping,Number),e.thousands+""),r=e.currency===void 0?"":e.currency[0]+"",n=e.currency===void 0?"":e.currency[1]+"",s=e.decimal===void 0?".":e.decimal+"",i=e.numerals===void 0?B5:LNe(U5.call(e.numerals,String)),o=e.percent===void 0?"%":e.percent+"",l=e.minus===void 0?"−":e.minus+"",c=e.nan===void 0?"NaN":e.nan+"";function u(d,f){d=Fm(d);var m=d.fill,g=d.align,p=d.sign,v=d.symbol,x=d.zero,b=d.width,w=d.comma,j=d.precision,_=d.trim,S=d.type;S==="n"?(w=!0,S="g"):z5[S]||(j===void 0&&(j=12),_=!0,S="g"),(x||m==="0"&&g==="=")&&(x=!0,m="0",g="=");var k=(f&&f.prefix!==void 0?f.prefix:"")+(v==="$"?r:v==="#"&&/[boxX]/.test(S)?"0"+S.toLowerCase():""),P=(v==="$"?n:/[%p]/.test(S)?o:"")+(f&&f.suffix!==void 0?f.suffix:""),C=z5[S],M=/[defgprs%]/.test(S);j=j===void 0?6:/[gprs]/.test(S)?Math.max(1,Math.min(21,j)):Math.max(0,Math.min(20,j));function I(E){var B=k,A=P,L,W,D;if(S==="c")A=C(E)+A,E="";else{E=+E;var U=E<0||1/E<0;if(E=isNaN(E)?c:C(Math.abs(E),j),_&&(E=zNe(E)),U&&+E==0&&p!=="+"&&(U=!1),B=(U?p==="("?p:l:p==="-"||p==="("?"":p)+B,A=(S==="s"&&!isNaN(E)&&bx!==void 0?W5[8+bx/3]:"")+A+(U&&p==="("?")":""),M){for(L=-1,W=E.length;++L<W;)if(D=E.charCodeAt(L),48>D||D>57){A=(D===46?s+E.slice(L+1):E.slice(L))+A,E=E.slice(0,L);break}}}w&&!x&&(E=t(E,1/0));var R=B.length+E.length+A.length,Q=R<b?new Array(b-R+1).join(m):"";switch(w&&x&&(E=t(Q+E,Q.length?b-A.length:1/0),Q=""),g){case"<":E=B+E+A+Q;break;case"=":E=B+Q+E+A;break;case"^":E=Q.slice(0,R=Q.length>>1)+B+E+A+Q.slice(R);break;default:E=Q+B+E+A;break}return i(E)}return I.toString=function(){return d+""},I}function h(d,f){var m=Math.max(-8,Math.min(8,Math.floor(Pd(f)/3)))*3,g=Math.pow(10,-m),p=u((d=Fm(d),d.type="f",d),{suffix:W5[8+m/3]});return function(v){return p(g*v)}}return{format:u,formatPrefix:h}}var Qg,eE,C7;WNe({thousands:",",grouping:[3],currency:["$",""]});function WNe(e){return Qg=UNe(e),eE=Qg.format,C7=Qg.formatPrefix,Qg}function VNe(e){return Math.max(0,-Pd(Math.abs(e)))}function HNe(e,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(Pd(t)/3)))*3-Pd(Math.abs(e)))}function qNe(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,Pd(t)-Pd(e))+1}function E7(e,t,r,n){var s=PS(e,t,r),i;switch(n=Fm(n??",f"),n.type){case"s":{var o=Math.max(Math.abs(e),Math.abs(t));return n.precision==null&&!isNaN(i=HNe(s,o))&&(n.precision=i),C7(n,o)}case"":case"e":case"g":case"p":case"r":{n.precision==null&&!isNaN(i=qNe(s,Math.max(Math.abs(e),Math.abs(t))))&&(n.precision=i-(n.type==="e"));break}case"f":case"%":{n.precision==null&&!isNaN(i=VNe(s))&&(n.precision=i-(n.type==="%")*2);break}}return eE(n)}function hl(e){var t=e.domain;return e.ticks=function(r){var n=t();return TS(n[0],n[n.length-1],r??10)},e.tickFormat=function(r,n){var s=t();return E7(s[0],s[s.length-1],r??10,n)},e.nice=function(r){r==null&&(r=10);var n=t(),s=0,i=n.length-1,o=n[s],l=n[i],c,u,h=10;for(l<o&&(u=o,o=l,l=u,u=s,s=i,i=u);h-- >0;){if(u=AS(o,l,r),u===c)return n[s]=o,n[i]=l,t(n);if(u>0)o=Math.floor(o/u)*u,l=Math.ceil(l/u)*u;else if(u<0)o=Math.ceil(o*u)/u,l=Math.floor(l*u)/u;else break;c=u}return e},e}function wx(){var e=JC();return e.copy=function(){return Kp(e,wx())},Ea.apply(e,arguments),hl(e)}function T7(e){var t;function r(n){return n==null||isNaN(n=+n)?t:n}return r.invert=r,r.domain=r.range=function(n){return arguments.length?(e=Array.from(n,vx),r):e.slice()},r.unknown=function(n){return arguments.length?(t=n,r):t},r.copy=function(){return T7(e).unknown(t)},e=arguments.length?Array.from(e,vx):[0,1],hl(r)}function A7(e,t){e=e.slice();var r=0,n=e.length-1,s=e[r],i=e[n],o;return i<s&&(o=r,r=n,n=o,o=s,s=i,i=o),e[r]=t.floor(s),e[n]=t.ceil(i),e}function V5(e){return Math.log(e)}function H5(e){return Math.exp(e)}function GNe(e){return-Math.log(-e)}function KNe(e){return-Math.exp(-e)}function YNe(e){return isFinite(e)?+("1e"+e):e<0?0:e}function XNe(e){return e===10?YNe:e===Math.E?Math.exp:t=>Math.pow(e,t)}function QNe(e){return e===Math.E?Math.log:e===10&&Math.log10||e===2&&Math.log2||(e=Math.log(e),t=>Math.log(t)/e)}function q5(e){return(t,r)=>-e(-t,r)}function tE(e){const t=e(V5,H5),r=t.domain;let n=10,s,i;function o(){return s=QNe(n),i=XNe(n),r()[0]<0?(s=q5(s),i=q5(i),e(GNe,KNe)):e(V5,H5),t}return t.base=function(l){return arguments.length?(n=+l,o()):n},t.domain=function(l){return arguments.length?(r(l),o()):r()},t.ticks=l=>{const c=r();let u=c[0],h=c[c.length-1];const d=h<u;d&&([u,h]=[h,u]);let f=s(u),m=s(h),g,p;const v=l==null?10:+l;let x=[];if(!(n%1)&&m-f<v){if(f=Math.floor(f),m=Math.ceil(m),u>0){for(;f<=m;++f)for(g=1;g<n;++g)if(p=f<0?g/i(-f):g*i(f),!(p<u)){if(p>h)break;x.push(p)}}else for(;f<=m;++f)for(g=n-1;g>=1;--g)if(p=f>0?g/i(-f):g*i(f),!(p<u)){if(p>h)break;x.push(p)}x.length*2<v&&(x=TS(u,h,v))}else x=TS(f,m,Math.min(m-f,v)).map(i);return d?x.reverse():x},t.tickFormat=(l,c)=>{if(l==null&&(l=10),c==null&&(c=n===10?"s":","),typeof c!="function"&&(!(n%1)&&(c=Fm(c)).precision==null&&(c.trim=!0),c=eE(c)),l===1/0)return c;const u=Math.max(1,n*l/t.ticks().length);return h=>{let d=h/i(Math.round(s(h)));return d*n<n-.5&&(d*=n),d<=u?c(h):""}},t.nice=()=>r(A7(r(),{floor:l=>i(Math.floor(s(l))),ceil:l=>i(Math.ceil(s(l)))})),t}function P7(){const e=tE(Ub()).domain([1,10]);return e.copy=()=>Kp(e,P7()).base(e.base()),Ea.apply(e,arguments),e}
895function G5(e){return function(t){return Math.sign(t)*Math.log1p(Math.abs(t/e))}}function K5(e){return function(t){return Math.sign(t)*Math.expm1(Math.abs(t))*e}}function rE(e){var t=1,r=e(G5(t),K5(t));return r.constant=function(n){return arguments.length?e(G5(t=+n),K5(t)):t},hl(r)}function O7(){var e=rE(Ub());return e.copy=function(){return Kp(e,O7()).constant(e.constant())},Ea.apply(e,arguments)}function Y5(e){return function(t){return t<0?-Math.pow(-t,e):Math.pow(t,e)}}function JNe(e){return e<0?-Math.sqrt(-e):Math.sqrt(e)}function ZNe(e){return e<0?-e*e:e*e}function nE(e){var t=e(sn,sn),r=1;function n(){return r===1?e(sn,sn):r===.5?e(JNe,ZNe):e(Y5(r),Y5(1/r))}return t.exponent=function(s){return arguments.length?(r=+s,n()):r},hl(t)}function aE(){var e=nE(Ub());return e.copy=function(){return Kp(e,aE()).exponent(e.exponent())},Ea.apply(e,arguments),e}function eke(){return aE.apply(null,arguments).exponent(.5)}function X5(e){return Math.sign(e)*e*e}function tke(e){return Math.sign(e)*Math.sqrt(Math.abs(e))}function M7(){var e=JC(),t=[0,1],r=!1,n;function s(i){var o=tke(e(i));return isNaN(o)?n:r?Math.round(o):o}return s.invert=function(i){return e.invert(X5(i))},s.domain=function(i){return arguments.length?(e.domain(i),s):e.domain()},s.range=function(i){return arguments.length?(e.range((t=Array.from(i,vx)).map(X5)),s):t.slice()},s.rangeRound=function(i){return s.range(i).round(!0)},s.round=function(i){return arguments.length?(r=!!i,s):r},s.clamp=function(i){return arguments.length?(e.clamp(i),s):e.clamp()},s.unknown=function(i){return arguments.length?(n=i,s):n},s.copy=function(){return M7(e.domain(),t).round(r).clamp(e.clamp()).unknown(n)},Ea.apply(s,arguments),hl(s)}function R7(){var e=[],t=[],r=[],n;function s(){var o=0,l=Math.max(1,t.length);for(r=new Array(l-1);++o<l;)r[o-1]=iNe(e,o/l);return i}function i(o){return o==null||isNaN(o=+o)?n:t[qp(r,o)]}return i.invertExtent=function(o){var l=t.indexOf(o);return l<0?[NaN,NaN]:[l>0?r[l-1]:e[0],l<r.length?r[l]:e[e.length-1]]},i.domain=function(o){if(!arguments.length)return e.slice();e=[];for(let l of o)l!=null&&!isNaN(l=+l)&&e.push(l);return e.sort(Vo),s()},i.range=function(o){return arguments.length?(t=Array.from(o),s()):t.slice()},i.unknown=function(o){return arguments.length?(n=o,i):n},i.quantiles=function(){return r.slice()},i.copy=function(){return R7().domain(e).range(t).unknown(n)},Ea.apply(i,arguments)}function $7(){var e=0,t=1,r=1,n=[.5],s=[0,1],i;function o(c){return c!=null&&c<=c?s[qp(n,c,0,r)]:i}function l(){var c=-1;for(n=new Array(r);++c<r;)n[c]=((c+1)*t-(c-r)*e)/(r+1);return o}return o.domain=function(c){return arguments.length?([e,t]=c,e=+e,t=+t,l()):[e,t]},o.range=function(c){return arguments.length?(r=(s=Array.from(c)).length-1,l()):s.slice()},o.invertExtent=function(c){var u=s.indexOf(c);return u<0?[NaN,NaN]:u<1?[e,n[0]]:u>=r?[n[r-1],t]:[n[u-1],n[u]]},o.unknown=function(c){return arguments.length&&(i=c),o},o.thresholds=function(){return n.slice()},o.copy=function(){return $7().domain([e,t]).range(s).unknown(i)},Ea.apply(hl(o),arguments)}function I7(){var e=[.5],t=[0,1],r,n=1;function s(i){return i!=null&&i<=i?t[qp(e,i,0,n)]:r}return s.domain=function(i){return arguments.length?(e=Array.from(i),n=Math.min(e.length,t.length-1),s):e.slice()},s.range=function(i){return arguments.length?(t=Array.from(i),n=Math.min(e.length,t.length-1),s):t.slice()},s.invertExtent=function(i){var o=t.indexOf(i);return[e[o-1],e[o]]},s.unknown=function(i){return arguments.length?(r=i,s):r},s.copy=function(){return I7().domain(e).range(t).unknown(r)},Ea.apply(s,arguments)}const M1=new Date,R1=new Date;function xr(e,t,r,n){function s(i){return e(i=arguments.length===0?new Date:new Date(+i)),i}return s.floor=i=>(e(i=new Date(+i)),i),s.ceil=i=>(e(i=new Date(i-1)),t(i,1),e(i),i),s.round=i=>{const o=s(i),l=s.ceil(i);return i-o<l-i?o:l},s.offset=(i,o)=>(t(i=new Date(+i),o==null?1:Math.floor(o)),i),s.range=(i,o,l)=>{const c=[];if(i=s.ceil(i),l=l==null?1:Math.floor(l),!(i<o)||!(l>0))return c;let u;do c.push(u=new Date(+i)),t(i,l),e(i);while(u<i&&i<o);return c},s.filter=i=>xr(o=>{if(o>=o)for(;e(o),!i(o);)o.setTime(o-1)},(o,l)=>{if(o>=o)if(l<0)for(;++l<=0;)for(;t(o,-1),!i(o););else for(;--l>=0;)for(;t(o,1),!i(o););}),r&&(s.count=(i,o)=>(M1.setTime(+i),R1.setTime(+o),e(M1),e(R1),Math.floor(r(M1,R1))),s.every=i=>(i=Math.floor(i),!isFinite(i)||!(i>0)?null:i>1?s.filter(n?o=>n(o)%i===0:o=>s.count(0,o)%i===0):s)),s}const jx=xr(()=>{},(e,t)=>{e.setTime(+e+t)},(e,t)=>t-e);jx.every=e=>(e=Math.floor(e),!isFinite(e)||!(e>0)?null:e>1?xr(t=>{t.setTime(Math.floor(t/e)*e)},(t,r)=>{t.setTime(+t+r*e)},(t,r)=>(r-t)/e):jx);jx.range;const xi=1e3,da=xi*60,bi=da*60,Li=bi*24,sE=Li*7,Q5=Li*30,$1=Li*365,Ul=xr(e=>{e.setTime(e-e.getMilliseconds())},(e,t)=>{e.setTime(+e+t*xi)},(e,t)=>(t-e)/xi,e=>e.getUTCSeconds());Ul.range;const iE=xr(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*xi)},(e,t)=>{e.setTime(+e+t*da)},(e,t)=>(t-e)/da,e=>e.getMinutes());iE.range;const oE=xr(e=>{e.setUTCSeconds(0,0)},(e,t)=>{e.setTime(+e+t*da)},(e,t)=>(t-e)/da,e=>e.getUTCMinutes());oE.range;const lE=xr(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*xi-e.getMinutes()*da)},(e,t)=>{e.setTime(+e+t*bi)},(e,t)=>(t-e)/bi,e=>e.getHours());lE.range;const cE=xr(e=>{e.setUTCMinutes(0,0,0)},(e,t)=>{e.setTime(+e+t*bi)},(e,t)=>(t-e)/bi,e=>e.getUTCHours());cE.range;const Yp=xr(e=>e.setHours(0,0,0,0),(e,t)=>e.setDate(e.getDate()+t),(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*da)/Li,e=>e.getDate()-1);Yp.range;const Wb=xr(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/Li,e=>e.getUTCDate()-1);Wb.range;const D7=xr(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/Li,e=>Math.floor(e/Li));
vendor: 4,307 bytes, line 895
895D7.range;function $c(e){return xr(t=>{t.setDate(t.getDate()-(t.getDay()+7-e)%7),t.setHours(0,0,0,0)},(t,r)=>{t.setDate(t.getDate()+r*7)},(t,r)=>(r-t-(r.getTimezoneOffset()-t.getTimezoneOffset())*da)/sE)}const Vb=$c(0),_x=$c(1),rke=$c(2),nke=$c(3),Od=$c(4),ake=$c(5),ske=$c(6);Vb.range;_x.range;rke.range;nke.range;Od.range;ake.range;ske.range;function Ic(e){return xr(t=>{t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7),t.setUTCHours(0,0,0,0)},(t,r)=>{t.setUTCDate(t.getUTCDate()+r*7)},(t,r)=>(r-t)/sE)}const Hb=Ic(0),Sx=Ic(1),ike=Ic(2),oke=Ic(3),Md=Ic(4),lke=Ic(5),cke=Ic(6);Hb.range;Sx.range;ike.range;oke.range;Md.range;lke.range;cke.range;const uE=xr(e=>{e.setDate(1),e.setHours(0,0,0,0)},(e,t)=>{e.setMonth(e.getMonth()+t)},(e,t)=>t.getMonth()-e.getMonth()+(t.getFullYear()-e.getFullYear())*12,e=>e.getMonth());uE.range;const dE=xr(e=>{e.setUTCDate(1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCMonth(e.getUTCMonth()+t)},(e,t)=>t.getUTCMonth()-e.getUTCMonth()+(t.getUTCFullYear()-e.getUTCFullYear())*12,e=>e.getUTCMonth());dE.range;const Fi=xr(e=>{e.setMonth(0,1),e.setHours(0,0,0,0)},(e,t)=>{e.setFullYear(e.getFullYear()+t)},(e,t)=>t.getFullYear()-e.getFullYear(),e=>e.getFullYear());Fi.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:xr(t=>{t.setFullYear(Math.floor(t.getFullYear()/e)*e),t.setMonth(0,1),t.setHours(0,0,0,0)},(t,r)=>{t.setFullYear(t.getFullYear()+r*e)});Fi.range;const zi=xr(e=>{e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCFullYear(e.getUTCFullYear()+t)},(e,t)=>t.getUTCFullYear()-e.getUTCFullYear(),e=>e.getUTCFullYear());zi.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:xr(t=>{t.setUTCFullYear(Math.floor(t.getUTCFullYear()/e)*e),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,r)=>{t.setUTCFullYear(t.getUTCFullYear()+r*e)});zi.range;function L7(e,t,r,n,s,i){const o=[[Ul,1,xi],[Ul,5,5*xi],[Ul,15,15*xi],[Ul,30,30*xi],[i,1,da],[i,5,5*da],[i,15,15*da],[i,30,30*da],[s,1,bi],[s,3,3*bi],[s,6,6*bi],[s,12,12*bi],[n,1,Li],[n,2,2*Li],[r,1,sE],[t,1,Q5],[t,3,3*Q5],[e,1,$1]];function l(u,h,d){const f=h<u;f&&([u,h]=[h,u]);const m=d&&typeof d.range=="function"?d:c(u,h,d),g=m?m.range(u,+h+1):[];return f?g.reverse():g}function c(u,h,d){const f=Math.abs(h-u)/d,m=GC(([,,v])=>v).right(o,f);if(m===o.length)return e.every(PS(u/$1,h/$1,d));if(m===0)return jx.every(Math.max(PS(u,h,d),1));const[g,p]=o[f/o[m-1][2]<o[m][2]/f?m-1:m];return g.every(p)}return[l,c]}const[uke,dke]=L7(zi,dE,Hb,D7,cE,oE),[hke,fke]=L7(Fi,uE,Vb,Yp,lE,iE);function I1(e){if(0<=e.y&&e.y<100){var t=new Date(-1,e.m,e.d,e.H,e.M,e.S,e.L);return t.setFullYear(e.y),t}return new Date(e.y,e.m,e.d,e.H,e.M,e.S,e.L)}function D1(e){if(0<=e.y&&e.y<100){var t=new Date(Date.UTC(-1,e.m,e.d,e.H,e.M,e.S,e.L));return t.setUTCFullYear(e.y),t}return new Date(Date.UTC(e.y,e.m,e.d,e.H,e.M,e.S,e.L))}function qh(e,t,r){return{y:e,m:t,d:r,H:0,M:0,S:0,L:0}}function mke(e){var t=e.dateTime,r=e.date,n=e.time,s=e.periods,i=e.days,o=e.shortDays,l=e.months,c=e.shortMonths,u=Gh(s),h=Kh(s),d=Gh(i),f=Kh(i),m=Gh(o),g=Kh(o),p=Gh(l),v=Kh(l),x=Gh(c),b=Kh(c),w={a:D,A:U,b:R,B:Q,c:null,d:nM,e:nM,f:Dke,g:Gke,G:Yke,H:Rke,I:$ke,j:Ike,L:F7,m:Lke,M:Fke,p:K,q:z,Q:iM,s:oM,S:zke,u:Bke,U:Uke,V:Wke,w:Vke,W:Hke,x:null,X:null,y:qke,Y:Kke,Z:Xke,"%":sM},j={a:N,A:T,b:$,B:V,c:null,d:aM,e:aM,f:e2e,g:u2e,G:h2e,H:Qke,I:Jke,j:Zke,L:B7,m:t2e,M:r2e,p:q,q:te,Q:iM,s:oM,S:n2e,u:a2e,U:s2e,V:i2e,w:o2e,W:l2e,x:null,X:null,y:c2e,Y:d2e,Z:f2e,"%":sM},_={a:M,A:I,b:E,B,c:A,d:tM,e:tM,f:Ake,g:eM,G:Z5,H:rM,I:rM,j:kke,L:Tke,m:Nke,M:Cke,p:C,q:Ske,Q:Oke,s:Mke,S:Eke,u:xke,U:bke,V:wke,w:vke,W:jke,x:L,X:W,y:eM,Y:Z5,Z:_ke,"%":Pke};w.x=S(r,w),w.X=S(n,w),w.c=S(t,w),j.x=S(r,j),j.X=S(n,j),j.c=S(t,j);function S(X,ee){return function(ie){var oe=[],we=-1,O=0,F=X.length,Z,H,G;for(ie instanceof Date||(ie=new Date(+ie));++we<F;)X.charCodeAt(we)===37&&(oe.push(X.slice(O,we)),(H=J5[Z=X.charAt(++we)])!=null?Z=X.charAt(++we):H=Z==="e"?" ":"0",(G=ee[Z])&&(Z=G(ie,H)),oe.push(Z),O=we+1);return oe.push(X.slice(O,we)),oe.join("")}}function k(X,ee){return function(ie){var oe=qh(1900,void 0,1),we=P(oe,X,ie+="",0),O,F;if(we!=ie.length)return null;if("Q"in oe)return new Date(oe.Q);if("s"in oe)return new Date(oe.s*1e3+("L"in oe?oe.L:0));if(ee&&!("Z"in oe)&&(oe.Z=0),"p"in oe&&(oe.H=oe.H%12+oe.p*12),oe.m===void 0&&(oe.m="q"in oe?oe.q:0),"V"in oe){if(oe.V<1||oe.V>53)return null;
vendor: 7,060 bytes, line 895
895"w"in oe||(oe.w=1),"Z"in oe?(O=D1(qh(oe.y,0,1)),F=O.getUTCDay(),O=F>4||F===0?Sx.ceil(O):Sx(O),O=Wb.offset(O,(oe.V-1)*7),oe.y=O.getUTCFullYear(),oe.m=O.getUTCMonth(),oe.d=O.getUTCDate()+(oe.w+6)%7):(O=I1(qh(oe.y,0,1)),F=O.getDay(),O=F>4||F===0?_x.ceil(O):_x(O),O=Yp.offset(O,(oe.V-1)*7),oe.y=O.getFullYear(),oe.m=O.getMonth(),oe.d=O.getDate()+(oe.w+6)%7)}else("W"in oe||"U"in oe)&&("w"in oe||(oe.w="u"in oe?oe.u%7:"W"in oe?1:0),F="Z"in oe?D1(qh(oe.y,0,1)).getUTCDay():I1(qh(oe.y,0,1)).getDay(),oe.m=0,oe.d="W"in oe?(oe.w+6)%7+oe.W*7-(F+5)%7:oe.w+oe.U*7-(F+6)%7);return"Z"in oe?(oe.H+=oe.Z/100|0,oe.M+=oe.Z%100,D1(oe)):I1(oe)}}function P(X,ee,ie,oe){for(var we=0,O=ee.length,F=ie.length,Z,H;we<O;){if(oe>=F)return-1;if(Z=ee.charCodeAt(we++),Z===37){if(Z=ee.charAt(we++),H=_[Z in J5?ee.charAt(we++):Z],!H||(oe=H(X,ie,oe))<0)return-1}else if(Z!=ie.charCodeAt(oe++))return-1}return oe}function C(X,ee,ie){var oe=u.exec(ee.slice(ie));return oe?(X.p=h.get(oe[0].toLowerCase()),ie+oe[0].length):-1}function M(X,ee,ie){var oe=m.exec(ee.slice(ie));return oe?(X.w=g.get(oe[0].toLowerCase()),ie+oe[0].length):-1}function I(X,ee,ie){var oe=d.exec(ee.slice(ie));return oe?(X.w=f.get(oe[0].toLowerCase()),ie+oe[0].length):-1}function E(X,ee,ie){var oe=x.exec(ee.slice(ie));return oe?(X.m=b.get(oe[0].toLowerCase()),ie+oe[0].length):-1}function B(X,ee,ie){var oe=p.exec(ee.slice(ie));return oe?(X.m=v.get(oe[0].toLowerCase()),ie+oe[0].length):-1}function A(X,ee,ie){return P(X,t,ee,ie)}function L(X,ee,ie){return P(X,r,ee,ie)}function W(X,ee,ie){return P(X,n,ee,ie)}function D(X){return o[X.getDay()]}function U(X){return i[X.getDay()]}function R(X){return c[X.getMonth()]}function Q(X){return l[X.getMonth()]}function K(X){return s[+(X.getHours()>=12)]}function z(X){return 1+~~(X.getMonth()/3)}function N(X){return o[X.getUTCDay()]}function T(X){return i[X.getUTCDay()]}function $(X){return c[X.getUTCMonth()]}function V(X){return l[X.getUTCMonth()]}function q(X){return s[+(X.getUTCHours()>=12)]}function te(X){return 1+~~(X.getUTCMonth()/3)}return{format:function(X){var ee=S(X+="",w);return ee.toString=function(){return X},ee},parse:function(X){var ee=k(X+="",!1);return ee.toString=function(){return X},ee},utcFormat:function(X){var ee=S(X+="",j);return ee.toString=function(){return X},ee},utcParse:function(X){var ee=k(X+="",!0);return ee.toString=function(){return X},ee}}}var J5={"-":"",_:" ",0:"0"},Er=/^\s*\d+/,pke=/^%/,gke=/[\\^$*+?|[\]().{}]/g;function ut(e,t,r){var n=e<0?"-":"",s=(n?-e:e)+"",i=s.length;return n+(i<r?new Array(r-i+1).join(t)+s:s)}function yke(e){return e.replace(gke,"\\$&")}function Gh(e){return new RegExp("^(?:"+e.map(yke).join("|")+")","i")}function Kh(e){return new Map(e.map((t,r)=>[t.toLowerCase(),r]))}function vke(e,t,r){var n=Er.exec(t.slice(r,r+1));return n?(e.w=+n[0],r+n[0].length):-1}function xke(e,t,r){var n=Er.exec(t.slice(r,r+1));return n?(e.u=+n[0],r+n[0].length):-1}function bke(e,t,r){var n=Er.exec(t.slice(r,r+2));return n?(e.U=+n[0],r+n[0].length):-1}function wke(e,t,r){var n=Er.exec(t.slice(r,r+2));return n?(e.V=+n[0],r+n[0].length):-1}function jke(e,t,r){var n=Er.exec(t.slice(r,r+2));return n?(e.W=+n[0],r+n[0].length):-1}function Z5(e,t,r){var n=Er.exec(t.slice(r,r+4));return n?(e.y=+n[0],r+n[0].length):-1}function eM(e,t,r){var n=Er.exec(t.slice(r,r+2));return n?(e.y=+n[0]+(+n[0]>68?1900:2e3),r+n[0].length):-1}function _ke(e,t,r){var n=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(t.slice(r,r+6));return n?(e.Z=n[1]?0:-(n[2]+(n[3]||"00")),r+n[0].length):-1}function Ske(e,t,r){var n=Er.exec(t.slice(r,r+1));return n?(e.q=n[0]*3-3,r+n[0].length):-1}function Nke(e,t,r){var n=Er.exec(t.slice(r,r+2));return n?(e.m=n[0]-1,r+n[0].length):-1}function tM(e,t,r){var n=Er.exec(t.slice(r,r+2));return n?(e.d=+n[0],r+n[0].length):-1}function kke(e,t,r){var n=Er.exec(t.slice(r,r+3));return n?(e.m=0,e.d=+n[0],r+n[0].length):-1}function rM(e,t,r){var n=Er.exec(t.slice(r,r+2));return n?(e.H=+n[0],r+n[0].length):-1}function Cke(e,t,r){var n=Er.exec(t.slice(r,r+2));return n?(e.M=+n[0],r+n[0].length):-1}function Eke(e,t,r){var n=Er.exec(t.slice(r,r+2));return n?(e.S=+n[0],r+n[0].length):-1}function Tke(e,t,r){var n=Er.exec(t.slice(r,r+3));return n?(e.L=+n[0],r+n[0].length):-1}function Ake(e,t,r){var n=Er.exec(t.slice(r,r+6));return n?(e.L=Math.floor(n[0]/1e3),r+n[0].length):-1}function Pke(e,t,r){var n=pke.exec(t.slice(r,r+1));return n?r+n[0].length:-1}function Oke(e,t,r){var n=Er.exec(t.slice(r));return n?(e.Q=+n[0],r+n[0].length):-1}function Mke(e,t,r){var n=Er.exec(t.slice(r));return n?(e.s=+n[0],r+n[0].length):-1}function nM(e,t){return ut(e.getDate(),t,2)}function Rke(e,t){return ut(e.getHours(),t,2)}function $ke(e,t){return ut(e.getHours()%12||12,t,2)}function Ike(e,t){return ut(1+Yp.count(Fi(e),e),t,3)}function F7(e,t){return ut(e.getMilliseconds(),t,3)}function Dke(e,t){return F7(e,t)+"000"}function Lke(e,t){return ut(e.getMonth()+1,t,2)}function Fke(e,t){return ut(e.getMinutes(),t,2)}function zke(e,t){return ut(e.getSeconds(),t,2)}function Bke(e){var t=e.getDay();return t===0?7:t}function Uke(e,t){return ut(Vb.count(Fi(e)-1,e),t,2)}function z7(e){var t=e.getDay();return t>=4||t===0?Od(e):Od.ceil(e)}function Wke(e,t){return e=z7(e),ut(Od.count(Fi(e),e)+(Fi(e).getDay()===4),t,2)}function Vke(e){return e.getDay()}function Hke(e,t){return ut(_x.count(Fi(e)-1,e),t,2)}function qke(e,t){return ut(e.getFullYear()%100,t,2)}function Gke(e,t){return e=z7(e),ut(e.getFullYear()%100,t,2)}function Kke(e,t){return ut(e.getFullYear()%1e4,t,4)}function Yke(e,t){var r=e.getDay();return e=r>=4||r===0?Od(e):Od.ceil(e),ut(e.getFullYear()%1e4,t,4)}function Xke(e){var t=e.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+ut(t/60|0,"0",2)+ut(t%60,"0",2)}function aM(e,t){return ut(e.getUTCDate(),t,2)}function Qke(e,t){return ut(e.getUTCHours(),t,2)}function Jke(e,t){return ut(e.getUTCHours()%12||12,t,2)}function Zke(e,t){return ut(1+Wb.count(zi(e),e),t,3)}function B7(e,t){return ut(e.getUTCMilliseconds(),t,3)}function e2e(e,t){return B7(e,t)+"000"}function t2e(e,t){return ut(e.getUTCMonth()+1,t,2)}function r2e(e,t){return ut(e.getUTCMinutes(),t,2)}function n2e(e,t){return ut(e.getUTCSeconds(),t,2)}function a2e(e){var t=e.getUTCDay();return t===0?7:t}function s2e(e,t){return ut(Hb.count(zi(e)-1,e),t,2)}function U7(e){var t=e.getUTCDay();return t>=4||t===0?Md(e):Md.ceil(e)}function i2e(e,t){return e=U7(e),ut(Md.count(zi(e),e)+(zi(e).getUTCDay()===4),t,2)}function o2e(e){return e.getUTCDay()}function l2e(e,t){return ut(Sx.count(zi(e)-1,e),t,2)}function c2e(e,t){return ut(e.getUTCFullYear()%100,t,2)}function u2e(e,t){return e=U7(e),ut(e.getUTCFullYear()%100,t,2)}function d2e(e,t){return ut(e.getUTCFullYear()%1e4,t,4)}function h2e(e,t){var r=e.getUTCDay();return e=r>=4||r===0?Md(e):Md.ceil(e),ut(e.getUTCFullYear()%1e4,t,4)}function f2e(){return"+0000"}function sM(){return"%"}function iM(e){return+e}function oM(e){return Math.floor(+e/1e3)}var eu,W7,V7;m2e({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Frid
895ay","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 m2e(e){return eu=mke(e),W7=eu.format,eu.parse,V7=eu.utcFormat,eu.utcParse,eu}function p2e(e){return new Date(e)}function g2e(e){return e instanceof Date?+e:+new Date(+e)}function hE(e,t,r,n,s,i,o,l,c,u){var h=JC(),d=h.invert,f=h.domain,m=u(".%L"),g=u(":%S"),p=u("%I:%M"),v=u("%I %p"),x=u("%a %d"),b=u("%b %d"),w=u("%B"),j=u("%Y");function _(S){return(c(S)<S?m:l(S)<S?g:o(S)<S?p:i(S)<S?v:n(S)<S?s(S)<S?x:b:r(S)<S?w:j)(S)}return h.invert=function(S){return new Date(d(S))},h.domain=function(S){return arguments.length?f(Array.from(S,g2e)):f().map(p2e)},h.ticks=function(S){var k=f();return e(k[0],k[k.length-1],S??10)},h.tickFormat=function(S,k){return k==null?_:u(k)},h.nice=function(S){var k=f();return(!S||typeof S.range!="function")&&(S=t(k[0],k[k.length-1],S??10)),S?f(A7(k,S)):h},h.copy=function(){return Kp(h,hE(e,t,r,n,s,i,o,l,c,u))},h}function y2e(){return Ea.apply(hE(hke,fke,Fi,uE,Vb,Yp,lE,iE,Ul,W7).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}function v2e(){return Ea.apply(hE(uke,dke,zi,dE,Hb,Wb,cE,oE,Ul,V7).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]),arguments)}function qb(){var e=0,t=1,r,n,s,i,o=sn,l=!1,c;function u(d){return d==null||isNaN(d=+d)?c:o(s===0?.5:(d=(i(d)-r)*s,l?Math.max(0,Math.min(1,d)):d))}u.domain=function(d){return arguments.length?([e,t]=d,r=i(e=+e),n=i(t=+t),s=r===n?0:1/(n-r),u):[e,t]},u.clamp=function(d){return arguments.length?(l=!!d,u):l},u.interpolator=function(d){return arguments.length?(o=d,u):o};function h(d){return function(f){var m,g;return arguments.length?([m,g]=f,o=d(m,g),u):[o(0),o(1)]}}return u.range=h(jh),u.rangeRound=h(QC),u.unknown=function(d){return arguments.length?(c=d,u):c},function(d){return i=d,r=d(e),n=d(t),s=r===n?0:1/(n-r),u}}function fl(e,t){return t.domain(e.domain()).interpolator(e.interpolator()).clamp(e.clamp()).unknown(e.unknown())}function H7(){var e=hl(qb()(sn));return e.copy=function(){return fl(e,H7())},Xi.apply(e,arguments)}function q7(){var e=tE(qb()).domain([1,10]);return e.copy=function(){return fl(e,q7()).base(e.base())},Xi.apply(e,arguments)}function G7(){var e=rE(qb());return e.copy=function(){return fl(e,G7()).constant(e.constant())},Xi.apply(e,arguments)}function fE(){var e=nE(qb());return e.copy=function(){return fl(e,fE()).exponent(e.exponent())},Xi.apply(e,arguments)}function x2e(){return fE.apply(null,arguments).exponent(.5)}function K7(){var e=[],t=sn;function r(n){if(n!=null&&!isNaN(n=+n))return t((qp(e,n,1)-1)/(e.length-1))}return r.domain=function(n){if(!arguments.length)return e.slice();e=[];for(let s of n)s!=null&&!isNaN(s=+s)&&e.push(s);return e.sort(Vo),r},r.interpolator=function(n){return arguments.length?(t=n,r):t},r.range=function(){return e.map((n,s)=>t(s/(e.length-1)))},r.quantiles=function(n){return Array.from({length:n+1},(s,i)=>sNe(e,i/n))},r.copy=function(){return K7(t).domain(e)},Xi.apply(r,arguments)}function Gb(){var e=0,t=.5,r=1,n=1,s,i,o,l,c,u=sn,h,d=!1,f;function m(p){return isNaN(p=+p)?f:(p=.5+((p=+h(p))-i)*(n*p<n*i?l:c),u(d?Math.max(0,Math.min(1,p)):p))}m.domain=function(p){return arguments.length?([e,t,r]=p,s=h(e=+e),i=h(t=+t),o=h(r=+r),l=s===i?0:.5/(i-s),c=i===o?0:.5/(o-i),n=i<s?-1:1,m):[e,t,r]},m.clamp=function(p){return arguments.length?(d=!!p,m):d},m.interpolator=function(p){return arguments.length?(u=p,m):u};function g(p){return function(v){var x,b,w;return arguments.length?([x,b,w]=v,u=PNe(p,[x,b,w]),m):[u(0),u(.5),u(1)]}}return m.range=g(jh),m.rangeRound=g(QC),m.unknown=function(p){return arguments.length?(f=p,m):f},function(p){return h=p,s=p(e),i=p(t),o=p(r),l=s===i?0:.5/(i-s),c=i===o?0:.5/(o-i),n=i<s?-1:1,m}}function Y7(){var e=hl(Gb()(sn));return e.copy=function(){return fl(e,Y7())},Xi.apply(e,arguments)}function X7(){var e=tE(Gb()).domain([.1,1,10]);return e.copy=function(){return fl(e,X7()).base(e.base())},Xi.apply(e,arguments)}function Q7(){var e=rE(Gb());return e.copy=function(){return fl(e,Q7()).constant(e.constant())},Xi.apply(e,arguments)}function mE(){var e=nE(Gb());return e.copy=function(){return fl(e,mE()).exponent(e.exponent())},Xi.apply(e,arguments)}function b2e(){return mE.apply(null,arguments).exponent(.5)}const lM=Object.freeze(Object.defineProperty({__proto__:null,scaleBand:$m,scaleDiverging:Y7,scaleDivergingLog:X7,scaleDivergingPow:mE,scaleDivergingSqrt:b2e,scaleDivergingSymlog:Q7,scaleIdentity:T7,scaleImplicit:OS,scaleLinear:wx,scaleLog:P7,scaleOrdinal:KC,scalePoint:If,scalePow:aE,scaleQuantile:R7,scaleQuantize:$7,scaleRadial:M7,scaleSequential:H7,scaleSequentialLog:q7,scaleSequentialPow:fE,scaleSequentialQuantile:K7,scaleSequentialSqrt:x2e,scaleSequentialSymlog:G7,scaleSqrt:eke,scaleSymlog:O7,scaleThreshold:I7,scaleTime:y2e,scaleUtc:v2e,tickFormat:E7},Symbol.toStringTag,{value:"Module"}));var w2e=fh;function j2e(e,t,r){for(var n=-1,s=e.length;++n<s;){var i=e[n],o=t(i);if(o!=null&&(l===void 0?o===o&&!w2e(o):r(o,l)))var l=o,c=i}return c}var J7=j2e;function _2e(e,t){return e>t}var S2e=_2e,N2e=J7,k2e=S2e,C2e=bh;function E2e(e){return e&&e.length?N2e(e,C2e,k2e):void 0}var T2e=E2e;const Kb=mt(T2e);function A2e(e,t){return e<t}var P2e=A2e,O2e=J7,M2e=P2e,R2e=bh;function $2e(e){return e&&e.length?O2e(e,R2e,M2e):void 0}var I2e=$2e;const Yb=mt(I2e);var D2e=EC,L2e=dl,F2e=o7,z2e=On;function B2e(e,t){var r=z2e(e)?D2e:F2e;return r(e,L2e(t))}var U2e=B2e,W2e=s7,V2e=U2e;function H2e(e,t){return W2e(V2e(e,t),1)}var q2e=H2e;const G2e=mt(q2e);var K2e=WC;function Y2e(e,t){return K2e(e,t)}var X2e=Y2e;const Xb=mt(X2e);
vendor: 229,501 bytes, lines 895-944
895var _h=1e9,Q2e={precision:20,rounding:4,toExpNeg:-7,toExpPos:21,LN10:"2.302585092994045684017991454684364207601101488628772976033327900967572609677352480235997205089598298341967784042286"},gE,Ft=!0,Na="[DecimalError] ",rc=Na+"Invalid argument: ",pE=Na+"Exponent out of range: ",Sh=Math.floor,Al=Math.pow,J2e=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,Vn,jr=1e7,Rt=7,Z7=9007199254740991,Nx=Sh(Z7/Rt),Te={};Te.absoluteValue=Te.abs=function(){var e=new this.constructor(this);return e.s&&(e.s=1),e};Te.comparedTo=Te.cmp=function(e){var t,r,n,s,i=this;if(e=new i.constructor(e),i.s!==e.s)return i.s||-e.s;if(i.e!==e.e)return i.e>e.e^i.s<0?1:-1;for(n=i.d.length,s=e.d.length,t=0,r=n<s?n:s;t<r;++t)if(i.d[t]!==e.d[t])return i.d[t]>e.d[t]^i.s<0?1:-1;return n===s?0:n>s^i.s<0?1:-1};Te.decimalPlaces=Te.dp=function(){var e=this,t=e.d.length-1,r=(t-e.e)*Rt;if(t=e.d[t],t)for(;t%10==0;t/=10)r--;return r<0?0:r};Te.dividedBy=Te.div=function(e){return ki(this,new this.constructor(e))};Te.dividedToIntegerBy=Te.idiv=function(e){var t=this,r=t.constructor;return St(ki(t,new r(e),0,1),r.precision)};Te.equals=Te.eq=function(e){return!this.cmp(e)};Te.exponent=function(){return or(this)};Te.greaterThan=Te.gt=function(e){return this.cmp(e)>0};Te.greaterThanOrEqualTo=Te.gte=function(e){return this.cmp(e)>=0};Te.isInteger=Te.isint=function(){return this.e>this.d.length-2};Te.isNegative=Te.isneg=function(){return this.s<0};Te.isPositive=Te.ispos=function(){return this.s>0};Te.isZero=function(){return this.s===0};Te.lessThan=Te.lt=function(e){return this.cmp(e)<0};Te.lessThanOrEqualTo=Te.lte=function(e){return this.cmp(e)<1};Te.logarithm=Te.log=function(e){var t,r=this,n=r.constructor,s=n.precision,i=s+5;if(e===void 0)e=new n(10);else if(e=new n(e),e.s<1||e.eq(Vn))throw Error(Na+"NaN");if(r.s<1)throw Error(Na+(r.s?"NaN":"-Infinity"));return r.eq(Vn)?new n(0):(Ft=!1,t=ki(zm(r,i),zm(e,i),i),Ft=!0,St(t,s))};Te.minus=Te.sub=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?r9(t,e):e9(t,(e.s=-e.s,e))};Te.modulo=Te.mod=function(e){var t,r=this,n=r.constructor,s=n.precision;if(e=new n(e),!e.s)throw Error(Na+"NaN");return r.s?(Ft=!1,t=ki(r,e,0,1).times(e),Ft=!0,r.minus(t)):St(new n(r),s)};Te.naturalExponential=Te.exp=function(){return t9(this)};Te.naturalLogarithm=Te.ln=function(){return zm(this)};Te.negated=Te.neg=function(){var e=new this.constructor(this);return e.s=-e.s||0,e};Te.plus=Te.add=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?e9(t,e):r9(t,(e.s=-e.s,e))};Te.precision=Te.sd=function(e){var t,r,n,s=this;if(e!==void 0&&e!==!!e&&e!==1&&e!==0)throw Error(rc+e);if(t=or(s)+1,n=s.d.length-1,r=n*Rt+1,n=s.d[n],n){for(;n%10==0;n/=10)r--;for(n=s.d[0];n>=10;n/=10)r++}return e&&t>r?t:r};Te.squareRoot=Te.sqrt=function(){var e,t,r,n,s,i,o,l=this,c=l.constructor;if(l.s<1){if(!l.s)return new c(0);throw Error(Na+"NaN")}for(e=or(l),Ft=!1,s=Math.sqrt(+l),s==0||s==1/0?(t=zs(l.d),(t.length+e)%2==0&&(t+="0"),s=Math.sqrt(t),e=Sh((e+1)/2)-(e<0||e%2),s==1/0?t="5e"+e:(t=s.toExponential(),t=t.slice(0,t.indexOf("e")+1)+e),n=new c(t)):n=new c(s.toString()),r=c.precision,s=o=r+3;;)if(i=n,n=i.plus(ki(l,i,o+2)).times(.5),zs(i.d).slice(0,o)===(t=zs(n.d)).slice(0,o)){if(t=t.slice(o-3,o+1),s==o&&t=="4999"){if(St(i,r+1,0),i.times(i).eq(l)){n=i;break}}else if(t!="9999")break;o+=4}return Ft=!0,St(n,r)};Te.times=Te.mul=function(e){var t,r,n,s,i,o,l,c,u,h=this,d=h.constructor,f=h.d,m=(e=new d(e)).d;if(!h.s||!e.s)return new d(0);for(e.s*=h.s,r=h.e+e.e,c=f.length,u=m.length,c<u&&(i=f,f=m,m=i,o=c,c=u,u=o),i=[],o=c+u,n=o;n--;)i.push(0);for(n=u;--n>=0;){for(t=0,s=c+n;s>n;)l=i[s]+m[n]*f[s-n-1]+t,i[s--]=l%jr|0,t=l/jr|0;i[s]=(i[s]+t)%jr|0}for(;!i[--o];)i.pop();return t?++r:i.shift(),e.d=i,e.e=r,Ft?St(e,d.precision):e};Te.toDecimalPlaces=Te.todp=function(e,t){var r=this,n=r.constructor;return r=new n(r),e===void 0?r:(Qs(e,0,_h),t===void 0?t=n.rounding:Qs(t,0,8),St(r,e+or(r)+1,t))};Te.toExponential=function(e,t){var r,n=this,s=n.constructor;return e===void 0?r=gc(n,!0):(Qs(e,0,_h),t===void 0?t=s.rounding:Qs(t,0,8),n=St(new s(n),e+1,t),r=gc(n,!0,e+1)),r};Te.toFixed=function(e,t){var r,n,s=this,i=s.constructor;return e===void 0?gc(s):(Qs(e,0,_h),t===void 0?t=i.rounding:Qs(t,0,8),n=St(new i(s),e+or(s)+1,t),r=gc(n.abs(),!1,e+or(n)+1),s.isneg()&&!s.isZero()?"-"+r:r)};Te.toInteger=Te.toint=function(){var e=this,t=e.constructor;return St(new t(e),or(e)+1,t.rounding)};Te.toNumber=function(){return+this};Te.toPower=Te.pow=function(e){var t,r,n,s,i,o,l=this,c=l.constructor,u=12,h=+(e=new c(e));if(!e.s)return new c(Vn);if(l=new c(l),!l.s){if(e.s<1)throw Error(Na+"Infinity");return l}if(l.eq(Vn))return l;if(n=c.precision,e.eq(Vn))return St(l,n);if(t=e.e,r=e.d.length-1,o=t>=r,i=l.s,o){if((r=h<0?-h:h)<=Z7){for(s=new c(Vn),t=Math.ceil(n/Rt+4),Ft=!1;r%2&&(s=s.times(l),uM(s.d,t)),r=Sh(r/2),r!==0;)l=l.times(l),uM(l.d,t);return Ft=!0,e.s<0?new c(Vn).div(s):St(s,n)}}else if(i<0)throw Error(Na+"NaN");return i=i<0&&e.d[Math.max(t,r)]&1?-1:1,l.s=1,Ft=!1,s=e.times(zm(l,n+u)),Ft=!0,s=t9(s),s.s=i,s};Te.toPrecision=function(e,t){var r,n,s=this,i=s.constructor;return e===void 0?(r=or(s),n=gc(s,r<=i.toExpNeg||r>=i.toExpPos)):(Qs(e,1,_h),t===void 0?t=i.rounding:Qs(t,0,8),s=St(new i(s),e,t),r=or(s),n=gc(s,e<=r||r<=i.toExpNeg,e)),n};Te.toSignificantDigits=Te.tosd=function(e,t){var r=this,n=r.constructor;return e===void 0?(e=n.precision,t=n.rounding):(Qs(e,1,_h),t===void 0?t=n.rounding:Qs(t,0,8)),St(new n(r),e,t)};Te.toString=Te.valueOf=Te.val=Te.toJSON=Te[Symbol.for("nodejs.util.inspect.custom")]=function(){var e=this,t=or(e),r=e.constructor;return gc(e,t<=r.toExpNeg||t>=r.toExpPos)};function e9(e,t){var r,n,s,i,o,l,c,u,h=e.constructor,d=h.precision;if(!e.s||!t.s)return t.s||(t=new h(e)),Ft?St(t,d):t;if(c=e.d,u=t.d,o=e.e,s=t.e,c=c.slice(),i=o-s,i){for(i<0?(n=c,i=-i,l=u.length):(n=u,s=o,l=c.length),o=Math.ceil(d/Rt),l=o>l?o+1:l+1,i>l&&(i=l,n.length=1),n.reverse();i--;)n.push(0);n.reverse()}for(l=c.length,i=u.length,l-i<0&&(i=l,n=u,u=c,c=n),r=0;i;)r=(c[--i]=c[i]+u[i]+r)/jr|0,c[i]%=jr;for(r&&(c.unshift(r),++s),l=c.length;c[--l]==0;)c.pop();return t.d=c,t.e=s,Ft?St(t,d):t}function Qs(e,t,r){if(e!==~~e||e<t||e>r)throw Error(rc+e)}function zs(e){var t,r,n,s=e.length-1,i="",o=e[0];if(s>0){for(i+=o,t=1;t<s;t++)n=e[t]+"",r=Rt-n.length,r&&(i+=ho(r)),i+=n;o=e[t],n=o+"",r=Rt-n.length,r&&(i+=ho(r))}else if(o===0)return"0";for(;o%10===0;)o/=10;return i+o}var ki=function(){function e(n,s){var i,o=0,l=n.length;for(n=n.slice();l--;)i=n[l]*s+o,n[l]=i%jr|0,o=i/jr|0;return o&&n.unshift(o),n}function t(n,s,i,o){var l,c;if(i!=o)c=i>o?1:-1;else for(l=c=0;l<i;l++)if(n[l]!=s[l]){c=n[l]>s[l]?1:-1;break}return c}function r(n,s,i){for(var o=0;i--;)n[i]-=o,o=n[i]<s[i]?1:0,n[i]=o*jr+n[i]-s[i];for(;!n[0]&&n.length>1;)n.shift()}return function(n,s,i,o){var l,c,u,h,d,f,m,g,p,v,x,b,w,j,_,S,k,P,C=n.constructor,M=n.s==s.s?1:-1,I=n.d,E=s.d;if(!n.s)return new C(n);if(!s.s)throw Error(Na+"Division by zero");for(c=n.e-s.e,k=E.length,_=I.length,m=new C(M),g=m.d=[],u=0;E[u]==(I[u]||0);)++u;if(E[u]>(I[u]||0)&&--c,i==null?b=i=C.precision:o?b=i+(or(n)-or(s))+1:b=i,b<0)return new C(0);if(b=b/Rt+2|0,u=0,k==1)for(h=0,E=E[0],b++;(u<_||h)&&b--;u++)w=h*jr+(I[u]||0),g[u]=w/E|0,h=w%E|0;else{for(h=jr/(E[0]+1)|0,h>1&&(E=e(E,h),I=e(I,h),k=E.length,_=I.length),j=k,p=I.slice(0,k),v=p.length;v<k;)p[v++]=0;P=E.slice(),P.unshift(0),S=E[0],E[1]>=jr/2&&++S;do h=0,l=t(E,p,k,v),l<0?(x=p[0],k!=v&&(x=x*jr+(p[1]||0)),h=x/S|0,h>1?(h>=jr&&(h=jr-1),d=e(E,h),f=d.length,v=p.length,l=t(d,p,f,v),l==1&&(h--,r(d,k<f?P:E,f))):(h==0&&(l=h=1),d=E.slice()),f=d.length,f<v&&d.unshift(0),r(p,d,v),l==-1&&(v=p.length,l=t(E,p,k,v),l<1&&(h++,r(p,k<v?P:E,v))),v=p.length):l===0&&(h++,p=[0]),g[u++]=h,l&&p[0]?p[v++]=I[j]||0:(p=[I[j]],v=1);while((j++<_||p[0]!==void 0)&&b--)}return g[0]||g.shift(),m.e=c,St(m,o?i+or(m)+1:i)}}();function t9(e,t){var r,n,s,i,o,l,c=0,u=0,h=e.constructor,d=h.precision;if(or(e)>16)throw Error(pE+or(e));if(!e.s)return new h(Vn);for(Ft=!1,l=d,o=new h(.03125);e.abs().gte(.1);)e=e.times(o),u+=5;for(n=Math.log(Al(2,u))/Math.LN10*2+5|0,l+=n,r=s=i=new h(Vn),h.precision=l;;){if(s=St(s.times(e),l),r=r.times(++c),o=i.plus(ki(s,r,l)),zs(o.d).slice(0,l)===zs(i.d).slice(0,l)){for(;u--;)i=St(i.times(i),l);return h.precision=d,t==null?(Ft=!0,St(i,d)):i}i=o}}function or(e){for(var t=e.e*Rt,r=e.d[0];r>=10;r/=10)t++;return t}function L1(e,t,r){if(t>e.LN10.sd())throw Ft=!0,r&&(e.precision=r),Error(Na+"LN10 precision limit exceeded");return St(new e(e.LN10),t)}function ho(e){for(var t="";e--;)t+="0";return t}function zm(e,t){var r,n,s,i,o,l,c,u,h,d=1,f=10,m=e,g=m.d,p=m.constructor,v=p.precision;if(m.s<1)throw Error(Na+(m.s?"NaN":"-Infinity"));if(m.eq(Vn))return new p(0);if(t==null?(Ft=!1,u=v):u=t,m.eq(10))return t==null&&(Ft=!0),L1(p,u);if(u+=f,p.precision=u,r=zs(g),n=r.charAt(0),i=or(m),Math.abs(i)<15e14){for(;n<7&&n!=1||n==1&&r.charAt(1)>3;)m=m.times(e),r=zs(m.d),n=r.charAt(0),d++;i=or(m),n>1?(m=new p("0."+r),i++):m=new p(n+"."+r.slice(1))}else return c=L1(p,u+2,v).times(i+""),m=zm(new p(n+"."+r.slice(1)),u-f).plus(c),p.precision=v,t==null?(Ft=!0,St(m,v)):m;for(l=o=m=ki(m.minus(Vn),m.plus(Vn),u),h=St(m.times(m),u),s=3;;){if(o=St(o.times(h),u),c=l.plus(ki(o,new p(s),u)),zs(c.d).slice(0,u)===zs(l.d).slice(0,u))return l=l.times(2),i!==0&&(l=l.plus(L1(p,u+2,v).times(i+""))),l=ki(l,new p(d),u),p.precision=v,t==null?(Ft=!0,St(l,v)):l;l=c,s+=2}}function cM(e,t){var r,n,s;for((r=t.indexOf("."))>-1&&(t=t.replace(".","")),(n=t.search(/e/i))>0?(r<0&&(r=n),r+=+t.slice(n+1),t=t.substring(0,n)):r<0&&(r=t.length),n=0;t.charCodeAt(n)===48;)++n;for(s=t.length;t.charCodeAt(s-1)===48;)--s;if(t=t.slice(n,s),t){if(s-=n,r=r-n-1,e.e=Sh(r/Rt),e.d=[],n=(r+1)%Rt,r<0&&(n+=Rt),n<s){for(n&&e.d.push(+t.slice(0,n)),s-=Rt;n<s;)e.d.push(+t.slice(n,n+=Rt));t=t.slice(n),n=Rt-t.length}else n-=s;for(;n--;)t+="0";if(e.d.push(+t),Ft&&(e.e>Nx||e.e<-Nx))throw Error(pE+r)}else e.s=0,e.e=0,e.d=[0];return e}function St(e,t,r){var n,s,i,o,l,c,u,h,d=e.d;for(o=1,i=d[0];i>=10;i/=10)o++;if(n=t-o,n<0)n+=Rt,s=t,u=d[h=0];else{if(h=Math.ceil((n+1)/Rt),i=d.length,h>=i)return e;for(u=i=d[h],o=1;i>=10;i/=10)o++;n%=Rt,s=n-Rt+o}if(r!==void 0&&(i=Al(10,o-s-1),l=u/i%10|0,c=t<0||d[h+1]!==void 0||u%i,c=r<4?(l||c)&&(r==0||r==(e.s<0?3:2)):l>5||l==5&&(r==4||c||r==6&&(n>0?s>0?u/Al(10,o-s):0:d[h-1])%10&1||r==(e.s<0?8:7))),t<1||!d[0])return c?(i=or(e),d.length=1,t=t-i-1,d[0]=Al(10,(Rt-t%Rt)%Rt),e.e=Sh(-t/Rt)||0):(d.length=1,d[0]=e.e=e.s=0),e;if(n==0?(d.length=h,i=1,h--):(d.length=h+1,i=Al(10,Rt-n),d[h]=s>0?(u/Al(10,o-s)%Al(10,s)|0)*i:0),c)for(;;)if(h==0){(d[0]+=i)==jr&&(d[0]=1,++e.e);break}else{if(d[h]+=i,d[h]!=jr)break;d[h--]=0,i=1}for(n=d.length;d[--n]===0;)d.pop();if(Ft&&(e.e>Nx||e.e<-Nx))throw Error(pE+or(e));return e}function r9(e,t){var r,n,s,i,o,l,c,u,h,d,f=e.constructor,m=f.precision;if(!e.s||!t.s)return t.s?t.s=-t.s:t=new f(e),Ft?St(t,m):t;if(c=e.d,d=t.d,n=t.e,u=e.e,c=c.slice(),o=u-n,o){for(h=o<0,h?(r=c,o=-o,l=d.length):(r=d,n=u,l=c.length),s=Math.max(Math.ceil(m/Rt),l)+2,o>s&&(o=s,r.length=1),r.reverse(),s=o;s--;)r.push(0);r.reverse()}else{for(s=c.length,l=d.length,h=s<l,h&&(l=s),s=0;s<l;s++)if(c[s]!=d[s]){h=c[s]<d[s];break}o=0}for(h&&(r=c,c=d,d=r,t.s=-t.s),l=c.length,s=d.length-l;s>0;--s)c[l++]=0;for(s=d.length;s>o;){if(c[--s]<d[s]){for(i=s;i&&c[--i]===0;)c[i]=jr-1;--c[i],c[s]+=jr}c[s]-=d[s]}for(;c[--l]===0;)c.pop();for(;c[0]===0;c.shift())--n;return c[0]?(t.d=c,t.e=n,Ft?St(t,m):t):new f(0)}function gc(e,t,r){var n,s=or(e),i=zs(e.d),o=i.length;return t?(r&&(n=r-o)>0?i=i.charAt(0)+"."+i.slice(1)+ho(n):o>1&&(i=i.charAt(0)+"."+i.slice(1)),i=i+(s<0?"e":"e+")+s):s<0?(i="0."+ho(-s-1)+i,r&&(n=r-o)>0&&(i+=ho(n))):s>=o?(i+=ho(s+1-o),r&&(n=r-s-1)>0&&(i=i+"."+ho(n))):((n=s+1)<o&&(i=i.slice(0,n)+"."+i.slice(n)),r&&(n=r-o)>0&&(s+1===o&&(i+="."),i+=ho(n))),e.s<0?"-"+i:i}function uM(e,t){if(e.length>t)return e.length=t,!0}function n9(e){var t,r,n;function s(i){var o=this;if(!(o instanceof s))return new s(i);if(o.constructor=s,i instanceof s){o.s=i.s,o.e=i.e,o.d=(i=i.d)?i.slice():i;return}if(typeof i=="number"){if(i*0!==0)throw Error(rc+i);if(i>0)o.s=1;else if(i<0)i=-i,o.s=-1;else{o.s=0,o.e=0,o.d=[0];return}if(i===~~i&&i<1e7){o.e=0,o.d=[i];return}return cM(o,i.toString())}else if(typeof i!="string")throw Error(rc+i);if(i.charCodeAt(0)===45?(i=i.slice(1),o.s=-1):o.s=1,J2e.test(i))cM(o,i);else throw Error(rc+i)}if(s.prototype=Te,s.ROUND_UP=0,s.ROUND_DOWN=1,s.ROUND_CEIL=2,s.ROUND_FLOOR=3,s.ROUND_HALF_UP=4,s.ROUND_HALF_DOWN=5,s.ROUND_HALF_EVEN=6,s.ROUND_HALF_CEIL=7,s.ROUND_HALF_FLOOR=8,s.clone=n9,s.config=s.set=Z2e,e===void 0&&(e={}),e)for(n=["precision","rounding","toExpNeg","toExpPos","LN10"],t=0;t<n.length;)e.hasOwnProperty(r=n[t++])||(e[r]=this[r]);return s.config(e),s}function Z2e(e){if(!e||typeof e!="object")throw Error(Na+"Object expected");var t,r,n,s=["precision",1,_h,"rounding",0,8,"toExpNeg",-1/0,0,"toExpPos",0,1/0];for(t=0;t<s.length;t+=3)if((n=e[r=s[t]])!==void 0)if(Sh(n)===n&&n>=s[t+1]&&n<=s[t+2])this[r]=n;else throw Error(rc+r+": "+n);if((n=e[r="LN10"])!==void 0)if(n==Math.LN10)this[r]=new this(n);else throw Error(rc+r+": "+n);return this}var gE=n9(Q2e);Vn=new gE(1);const vt=gE;function eCe(e){return aCe(e)||nCe(e)||rCe(e)||tCe()}function tCe(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
896In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function rCe(e,t){if(e){if(typeof e=="string")return IS(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return IS(e,t)}}function nCe(e){if(typeof Symbol<"u"&&Symbol.iterator in Object(e))return Array.from(e)}function aCe(e){if(Array.isArray(e))return IS(e)}function IS(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var sCe=function(t){return t},a9={},s9=function(t){return t===a9},dM=function(t){return function r(){return arguments.length===0||arguments.length===1&&s9(arguments.length<=0?void 0:arguments[0])?r:t.apply(void 0,arguments)}},iCe=function e(t,r){return t===1?r:dM(function(){for(var n=arguments.length,s=new Array(n),i=0;i<n;i++)s[i]=arguments[i];var o=s.filter(function(l){return l!==a9}).length;return o>=t?r.apply(void 0,s):e(t-o,dM(function(){for(var l=arguments.length,c=new Array(l),u=0;u<l;u++)c[u]=arguments[u];var h=s.map(function(d){return s9(d)?c.shift():d});return r.apply(void 0,eCe(h).concat(c))}))})},Qb=function(t){return iCe(t.length,t)},DS=function(t,r){for(var n=[],s=t;s<r;++s)n[s-t]=s;return n},oCe=Qb(function(e,t){return Array.isArray(t)?t.map(e):Object.keys(t).map(function(r){return t[r]}).map(e)}),lCe=function(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];if(!r.length)return sCe;var s=r.reverse(),i=s[0],o=s.slice(1);return function(){return o.reduce(function(l,c){return c(l)},i.apply(void 0,arguments))}},LS=function(t){return Array.isArray(t)?t.reverse():t.split("").reverse.join("")},i9=function(t){var r=null,n=null;return function(){for(var s=arguments.length,i=new Array(s),o=0;o<s;o++)i[o]=arguments[o];return r&&i.every(function(l,c){return l===r[c]})||(r=i,n=t.apply(void 0,i)),n}};function cCe(e){var t;return e===0?t=1:t=Math.floor(new vt(e).abs().log(10).toNumber())+1,t}function uCe(e,t,r){for(var n=new vt(e),s=0,i=[];n.lt(t)&&s<1e5;)i.push(n.toNumber()),n=n.add(r),s++;return i}var dCe=Qb(function(e,t,r){var n=+e,s=+t;return n+r*(s-n)}),hCe=Qb(function(e,t,r){var n=t-+e;return n=n||1/0,(r-e)/n}),fCe=Qb(function(e,t,r){var n=t-+e;return n=n||1/0,Math.max(0,Math.min(1,(r-e)/n))});const Jb={rangeStep:uCe,getDigitCount:cCe,interpolateNumber:dCe,uninterpolateNumber:hCe,uninterpolateTruncation:fCe};function FS(e){return gCe(e)||pCe(e)||o9(e)||mCe()}function mCe(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
897In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function pCe(e){if(typeof Symbol<"u"&&Symbol.iterator in Object(e))return Array.from(e)}function gCe(e){if(Array.isArray(e))return zS(e)}function Bm(e,t){return xCe(e)||vCe(e,t)||o9(e,t)||yCe()}function yCe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
898In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function o9(e,t){if(e){if(typeof e=="string")return zS(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return zS(e,t)}}function zS(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function vCe(e,t){if(!(typeof Symbol>"u"||!(Symbol.iterator in Object(e)))){var r=[],n=!0,s=!1,i=void 0;try{for(var o=e[Symbol.iterator](),l;!(n=(l=o.next()).done)&&(r.push(l.value),!(t&&r.length===t));n=!0);}catch(c){s=!0,i=c}finally{try{!n&&o.return!=null&&o.return()}finally{if(s)throw i}}return r}}function xCe(e){if(Array.isArray(e))return e}function l9(e){var t=Bm(e,2),r=t[0],n=t[1],s=r,i=n;return r>n&&(s=n,i=r),[s,i]}function c9(e,t,r){if(e.lte(0))return new vt(0);var n=Jb.getDigitCount(e.toNumber()),s=new vt(10).pow(n),i=e.div(s),o=n!==1?.05:.1,l=new vt(Math.ceil(i.div(o).toNumber())).add(r).mul(o),c=l.mul(s);return t?c:new vt(Math.ceil(c))}function bCe(e,t,r){var n=1,s=new vt(e);if(!s.isint()&&r){var i=Math.abs(e);i<1?(n=new vt(10).pow(Jb.getDigitCount(e)-1),s=new vt(Math.floor(s.div(n).toNumber())).mul(n)):i>1&&(s=new vt(Math.floor(e)))}else e===0?s=new vt(Math.floor((t-1)/2)):r||(s=new vt(Math.floor(e)));var o=Math.floor((t-1)/2),l=lCe(oCe(function(c){return s.add(new vt(c-o).mul(n)).toNumber()}),DS);return l(0,t)}function u9(e,t,r,n){var s=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0;if(!Number.isFinite((t-e)/(r-1)))return{step:new vt(0),tickMin:new vt(0),tickMax:new vt(0)};var i=c9(new vt(t).sub(e).div(r-1),n,s),o;e<=0&&t>=0?o=new vt(0):(o=new vt(e).add(t).div(2),o=o.sub(new vt(o).mod(i)));var l=Math.ceil(o.sub(e).div(i).toNumber()),c=Math.ceil(new vt(t).sub(o).div(i).toNumber()),u=l+c+1;return u>r?u9(e,t,r,n,s+1):(u<r&&(c=t>0?c+(r-u):c,l=t>0?l:l+(r-u)),{step:i,tickMin:o.sub(new vt(l).mul(i)),tickMax:o.add(new vt(c).mul(i))})}function wCe(e){var t=Bm(e,2),r=t[0],n=t[1],s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:6,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,o=Math.max(s,2),l=l9([r,n]),c=Bm(l,2),u=c[0],h=c[1];if(u===-1/0||h===1/0){var d=h===1/0?[u].concat(FS(DS(0,s-1).map(function(){return 1/0}))):[].concat(FS(DS(0,s-1).map(function(){return-1/0})),[h]);return r>n?LS(d):d}if(u===h)return bCe(u,s,i);var f=u9(u,h,o,i),m=f.step,g=f.tickMin,p=f.tickMax,v=Jb.rangeStep(g,p.add(new vt(.1).mul(m)),m);return r>n?LS(v):v}function jCe(e,t){var r=Bm(e,2),n=r[0],s=r[1],i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,o=l9([n,s]),l=Bm(o,2),c=l[0],u=l[1];if(c===-1/0||u===1/0)return[n,s];if(c===u)return[c];var h=Math.max(t,2),d=c9(new vt(u).sub(c).div(h-1),i,0),f=[].concat(FS(Jb.rangeStep(new vt(c),new vt(u).sub(new vt(.99).mul(d)),d)),[u]);return n>s?LS(f):f}var _Ce=i9(wCe),SCe=i9(jCe),NCe="Invariant failed";function yc(e,t){throw new Error(NCe)}var kCe=["offset","layout","width","dataKey","data","dataPointFormatter","xAxis","yAxis"];function Rd(e){"@babel/helpers - typeof";return Rd=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Rd(e)}function kx(){return kx=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},kx.apply(this,arguments)}function CCe(e,t){return PCe(e)||ACe(e,t)||TCe(e,t)||ECe()}function ECe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
899In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function TCe(e,t){if(e){if(typeof e=="string")return hM(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return hM(e,t)}}function hM(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function ACe(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,s,i,o,l=[],c=!0,u=!1;try{if(i=(r=r.call(e)).next,t!==0)for(;!(c=(n=i.call(r)).done)&&(l.push(n.value),l.length!==t);c=!0);}catch(h){u=!0,s=h}finally{try{if(!c&&r.return!=null&&(o=r.return(),Object(o)!==o))return}finally{if(u)throw s}}return l}}function PCe(e){if(Array.isArray(e))return e}function OCe(e,t){if(e==null)return{};var r=MCe(e,t),n,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(s=0;s<i.length;s++)n=i[s],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function MCe(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function RCe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function $Ce(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,f9(n.key),n)}}function ICe(e,t,r){return t&&$Ce(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function DCe(e,t,r){return t=Cx(t),LCe(e,d9()?Reflect.construct(t,r||[],Cx(e).constructor):t.apply(e,r))}function LCe(e,t){if(t&&(Rd(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return FCe(e)}function FCe(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function d9(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(d9=function(){return!!e})()}function Cx(e){return Cx=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Cx(e)}function zCe(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&BS(e,t)}function BS(e,t){return BS=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,s){return n.__proto__=s,n},BS(e,t)}function h9(e,t,r){return t=f9(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function f9(e){var t=BCe(e,"string");return Rd(t)=="symbol"?t:t+""}function BCe(e,t){if(Rd(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(Rd(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var Xp=function(e){function t(){return RCe(this,t),DCe(this,t,arguments)}return zCe(t,e),ICe(t,[{key:"render",value:function(){var n=this.props,s=n.offset,i=n.layout,o=n.width,l=n.dataKey,c=n.data,u=n.dataPointFormatter,h=n.xAxis,d=n.yAxis,f=OCe(n,kCe),m=rt(f,!1);this.props.direction==="x"&&h.type!=="number"&&yc();var g=c.map(function(p){var v=u(p,l),x=v.x,b=v.y,w=v.value,j=v.errorVal;if(!j)return null;var _=[],S,k;if(Array.isArray(j)){var P=CCe(j,2);S=P[0],k=P[1]}else S=k=j;if(i==="vertical"){var C=h.scale,M=b+s,I=M+o,E=M-o,B=C(w-S),A=C(w+k);_.push({x1:A,y1:I,x2:A,y2:E}),_.push({x1:B,y1:M,x2:A,y2:M}),_.push({x1:B,y1:I,x2:B,y2:E})}else if(i==="horizontal"){var L=d.scale,W=x+s,D=W-o,U=W+o,R=L(w-S),Q=L(w+k);_.push({x1:D,y1:Q,x2:U,y2:Q}),_.push({x1:W,y1:R,x2:W,y2:Q}),_.push({x1:D,y1:R,x2:U,y2:R})}return J.createElement(rr,kx({className:"recharts-errorBar",key:"bar-".concat(_.map(function(K){return"".concat(K.x1,"-").concat(K.x2,"-").concat(K.y1,"-").concat(K.y2)}))},m),_.map(function(K){return J.createElement("line",kx({},K,{key:"line-".concat(K.x1,"-").concat(K.x2,"-").concat(K.y1,"-").concat(K.y2)}))}))});return J.createElement(rr,{className:"recharts-errorBars"},g)}}])}(J.Component);h9(Xp,"defaultProps",{stroke:"black",strokeWidth:1.5,width:5,offset:0,layout:"horizontal"});h9(Xp,"displayName","ErrorBar");function Um(e){"@babel/helpers - typeof";return Um=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Um(e)}function fM(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function xl(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?fM(Object(r),!0).forEach(function(n){UCe(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):fM(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function UCe(e,t,r){return t=WCe(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function WCe(e){var t=VCe(e,"string");return Um(t)=="symbol"?t:t+""}function VCe(e,t){if(Um(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(Um(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var m9=function(t){var r=t.children,n=t.formattedGraphicalItems,s=t.legendWidth,i=t.legendContent,o=zn(r,Wo);if(!o)return null;var l=Wo.defaultProps,c=l!==void 0?xl(xl({},l),o.props):{},u;return o.props&&o.props.payload?u=o.props&&o.props.payload:i==="children"?u=(n||[]).reduce(function(h,d){var f=d.item,m=d.props,g=m.sectors||m.data||[];return h.concat(g.map(function(p){return{type:o.props.iconType||f.props.legendType,value:p.name,color:p.fill,payload:p}}))},[]):u=(n||[]).map(function(h){var d=h.item,f=d.type.defaultProps,m=f!==void 0?xl(xl({},f),d.props):{},g=m.dataKey,p=m.name,v=m.legendType,x=m.hide;return{inactive:x,dataKey:g,type:c.iconType||v||"square",color:yE(d),value:p||g,payload:m}}),xl(xl(xl({},c),Wo.getWithHeight(o,s)),{},{payload:u,item:o})};function Wm(e){"@babel/helpers - typeof";return Wm=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Wm(e)}function mM(e){return KCe(e)||GCe(e)||qCe(e)||HCe()}function HCe(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
900In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function qCe(e,t){if(e){if(typeof e=="string")return US(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return US(e,t)}}function GCe(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function KCe(e){if(Array.isArray(e))return US(e)}function US(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function pM(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function Kt(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?pM(Object(r),!0).forEach(function(n){Vu(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):pM(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Vu(e,t,r){return t=YCe(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function YCe(e){var t=XCe(e,"string");return Wm(t)=="symbol"?t:t+""}function XCe(e,t){if(Wm(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(Wm(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Qn(e,t,r){return Ze(e)||Ze(t)?r:pr(t)?ga(e,t,r):Qe(t)?t(e):r}function Df(e,t,r,n){var s=G2e(e,function(l){return Qn(l,t)});if(r==="number"){var i=s.filter(function(l){return Ne(l)||parseFloat(l)});return i.length?[Yb(i),Kb(i)]:[1/0,-1/0]}var o=n?s.filter(function(l){return!Ze(l)}):s;return o.map(function(l){return pr(l)||l instanceof Date?l:""})}var QCe=function(t){var r,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],s=arguments.length>2?arguments[2]:void 0,i=arguments.length>3?arguments[3]:void 0,o=-1,l=(r=n==null?void 0:n.length)!==null&&r!==void 0?r:0;if(l<=1)return 0;if(i&&i.axisType==="angleAxis"&&Math.abs(Math.abs(i.range[1]-i.range[0])-360)<=1e-6)for(var c=i.range,u=0;u<l;u++){var h=u>0?s[u-1].coordinate:s[l-1].coordinate,d=s[u].coordinate,f=u>=l-1?s[0].coordinate:s[u+1].coordinate,m=void 0;if(Ja(d-h)!==Ja(f-d)){var g=[];if(Ja(f-d)===Ja(c[1]-c[0])){m=f;var p=d+c[1]-c[0];g[0]=Math.min(p,(p+h)/2),g[1]=Math.max(p,(p+h)/2)}else{m=h;var v=f+c[1]-c[0];g[0]=Math.min(d,(v+d)/2),g[1]=Math.max(d,(v+d)/2)}var x=[Math.min(d,(m+d)/2),Math.max(d,(m+d)/2)];if(t>x[0]&&t<=x[1]||t>=g[0]&&t<=g[1]){o=s[u].index;break}}else{var b=Math.min(h,f),w=Math.max(h,f);if(t>(b+d)/2&&t<=(w+d)/2){o=s[u].index;break}}}else for(var j=0;j<l;j++)if(j===0&&t<=(n[j].coordinate+n[j+1].coordinate)/2||j>0&&j<l-1&&t>(n[j].coordinate+n[j-1].coordinate)/2&&t<=(n[j].coordinate+n[j+1].coordinate)/2||j===l-1&&t>(n[j].coordinate+n[j-1].coordinate)/2){o=n[j].index;break}return o},yE=function(t){var r,n=t,s=n.type.displayName,i=(r=t.type)!==null&&r!==void 0&&r.defaultProps?Kt(Kt({},t.type.defaultProps),t.props):t.props,o=i.stroke,l=i.fill,c;switch(s){case"Line":c=o;break;case"Area":case"Radar":c=o&&o!=="none"?o:l;break;default:c=l;break}return c},JCe=function(t){var r=t.barSize,n=t.totalSize,s=t.stackGroups,i=s===void 0?{}:s;if(!i)return{};for(var o={},l=Object.keys(i),c=0,u=l.length;c<u;c++)for(var h=i[l[c]].stackGroups,d=Object.keys(h),f=0,m=d.length;f<m;f++){var g=h[d[f]],p=g.items,v=g.cateAxisId,x=p.filter(function(k){return Si(k.type).indexOf("Bar")>=0});if(x&&x.length){var b=x[0].type.defaultProps,w=b!==void 0?Kt(Kt({},b),x[0].props):x[0].props,j=w.barSize,_=w[v];o[_]||(o[_]=[]);var S=Ze(j)?r:j;o[_].push({item:x[0],stackList:x.slice(1),barSize:Ze(S)?void 0:pc(S,n,0)})}}return o},ZCe=function(t){var r=t.barGap,n=t.barCategoryGap,s=t.bandSize,i=t.sizeList,o=i===void 0?[]:i,l=t.maxBarSize,c=o.length;if(c<1)return null;var u=pc(r,s,0,!0),h,d=[];if(o[0].barSize===+o[0].barSize){var f=!1,m=s/c,g=o.reduce(function(j,_){return j+_.barSize||0},0);g+=(c-1)*u,g>=s&&(g-=(c-1)*u,u=0),g>=s&&m>0&&(f=!0,m*=.9,g=c*m);var p=(s-g)/2>>0,v={offset:p-u,size:0};h=o.reduce(function(j,_){var S={item:_.item,position:{offset:v.offset+v.size+u,size:f?m:_.barSize}},k=[].concat(mM(j),[S]);return v=k[k.length-1].position,_.stackList&&_.stackList.length&&_.stackList.forEach(function(P){k.push({item:P,position:v})}),k},d)}else{var x=pc(n,s,0,!0);s-2*x-(c-1)*u<=0&&(u=0);var b=(s-2*x-(c-1)*u)/c;b>1&&(b>>=0);var w=l===+l?Math.min(b,l):b;h=o.reduce(function(j,_,S){var k=[].concat(mM(j),[{item:_.item,position:{offset:x+(b+u)*S+(b-w)/2,size:w}}]);return _.stackList&&_.stackList.length&&_.stackList.forEach(function(P){k.push({item:P,position:k[k.length-1].position})}),k},d)}return h},eEe=function(t,r,n,s){var i=n.children,o=n.width,l=n.margin,c=o-(l.left||0)-(l.right||0),u=m9({children:i,legendWidth:c});if(u){var h=s||{},d=h.width,f=h.height,m=u.align,g=u.verticalAlign,p=u.layout;if((p==="vertical"||p==="horizontal"&&g==="middle")&&m!=="center"&&Ne(t[m]))return Kt(Kt({},t),{},Vu({},m,t[m]+(d||0)));if((p==="horizontal"||p==="vertical"&&m==="center")&&g!=="middle"&&Ne(t[g]))return Kt(Kt({},t),{},Vu({},g,t[g]+(f||0)))}return t},tEe=function(t,r,n){return Ze(r)?!0:t==="horizontal"?r==="yAxis":t==="vertical"||n==="x"?r==="xAxis":n==="y"?r==="yAxis":!0},p9=function(t,r,n,s,i){var o=r.props.children,l=ya(o,Xp).filter(function(u){return tEe(s,i,u.props.direction)});if(l&&l.length){var c=l.map(function(u){return u.props.dataKey});return t.reduce(function(u,h){var d=Qn(h,n);if(Ze(d))return u;var f=Array.isArray(d)?[Yb(d),Kb(d)]:[d,d],m=c.reduce(function(g,p){var v=Qn(h,p,0),x=f[0]-Math.abs(Array.isArray(v)?v[0]:v),b=f[1]+Math.abs(Array.isArray(v)?v[1]:v);return[Math.min(x,g[0]),Math.max(b,g[1])]},[1/0,-1/0]);return[Math.min(m[0],u[0]),Math.max(m[1],u[1])]},[1/0,-1/0])}return null},rEe=function(t,r,n,s,i){var o=r.map(function(l){return p9(t,l,n,i,s)}).filter(function(l){return!Ze(l)});return o&&o.length?o.reduce(function(l,c){return[Math.min(l[0],c[0]),Math.max(l[1],c[1])]},[1/0,-1/0]):null},g9=function(t,r,n,s,i){var o=r.map(function(c){var u=c.props.dataKey;return n==="number"&&u&&p9(t,c,u,s)||Df(t,u,n,i)});if(n==="number")return o.reduce(function(c,u){return[Math.min(c[0],u[0]),Math.max(c[1],u[1])]},[1/0,-1/0]);var l={};return o.reduce(function(c,u){for(var h=0,d=u.length;h<d;h++)l[u[h]]||(l[u[h]]=!0,c.push(u[h]));return c},[])},y9=function(t,r){return t==="horizontal"&&r==="xAxis"||t==="vertical"&&r==="yAxis"||t==="centric"&&r==="angleAxis"||t==="radial"&&r==="radiusAxis"},v9=function(t,r,n,s){if(s)return t.map(function(c){return c.coordinate});var i,o,l=t.map(function(c){return c.coordinate===r&&(i=!0),c.coordinate===n&&(o=!0),c.coordinate});return i||l.push(r),o||l.push(n),l},wi=function(t,r,n){if(!t)return null;var s=t.scale,i=t.duplicateDomain,o=t.type,l=t.range,c=t.realScaleType==="scaleBand"?s.bandwidth()/2:2,u=(r||n)&&o==="category"&&s.bandwidth?s.bandwidth()/c:0;if(u=t.axisType==="angleAxis"&&(l==null?void 0:l.length)>=2?Ja(l[0]-l[1])*2*u:u,r&&(t.ticks||t.niceTicks)){var h=(t.ticks||t.niceTicks).map(function(d){var f=i?i.indexOf(d):d;return{coordinate:s(f)+u,value:d,offset:u}});return h.filter(function(d){return!Wp(d.coordinate)})}return t.isCategorical&&t.categoricalDomain?t.categoricalDomain.map(function(d,f){return{coordinate:s(d)+u,value:d,index:f,offset:u}}):s.ticks&&!n?s.ticks(t.tickCount).map(function(d){return{coordinate:s(d)+u,value:d,offset:u}}):s.domain().map(function(d,f){return{coordinate:s(d)+u,value:i?i[d]:d,index:f,offset:u}})},F1=new WeakMap,Jg=function(t,r){if(typeof r!="function")return t;F1.has(t)||F1.set(t,new WeakMap);var n=F1.get(t);if(n.has(r))return n.get(r);var s=function(){t.apply(void 0,arguments),r.apply(void 0,arguments)};return n.set(r,s),s},nEe=function(t,r,n){var s=t.scale,i=t.type,o=t.layout,l=t.axisType;if(s==="auto")return o==="radial"&&l==="radiusAxis"?{scale:$m(),realScaleType:"band"}:o==="radial"&&l==="angleAxis"?{scale:wx(),realScaleType:"linear"}:i==="category"&&r&&(r.indexOf("LineChart")>=0||r.indexOf("AreaChart")>=0||r.indexOf("ComposedChart")>=0&&!n)?{scale:If(),realScaleType:"point"}:i==="category"?{scale:$m(),realScaleType:"band"}:{scale:wx(),realScaleType:"linear"};if(mc(s)){var c="scale".concat($b(s));return{scale:(lM[c]||If)(),realScaleType:lM[c]?c:"point"}}return Qe(s)?{scale:s}:{scale:If(),realScaleType:"point"}},gM=1e-4,aEe=function(t){var r=t.domain();if(!(!r||r.length<=2)){var n=r.length,s=t.range(),i=Math.min(s[0],s[1])-gM,o=Math.max(s[0],s[1])+gM,l=t(r[0]),c=t(r[n-1]);(l<i||l>o||c<i||c>o)&&t.domain([r[0],r[n-1]])}},sEe=function(t,r){if(!t)return null;for(var n=0,s=t.length;n<s;n++)if(t[n].item===r)return t[n].position;return null},iEe=function(t,r){if(!r||r.length!==2||!Ne(r[0])||!Ne(r[1]))return t;var n=Math.min(r[0],r[1]),s=Math.max(r[0],r[1]),i=[t[0],t[1]];return(!Ne(t[0])||t[0]<n)&&(i[0]=n),(!Ne(t[1])||t[1]>s)&&(i[1]=s),i[0]>s&&(i[0]=s),i[1]<n&&(i[1]=n),i},oEe=function(t){var r=t.length;if(!(r<=0))for(var n=0,s=t[0].length;n<s;++n)for(var i=0,o=0,l=0;l<r;++l){var c=Wp(t[l][n][1])?t[l][n][0]:t[l][n][1];c>=0?(t[l][n][0]=i,t[l][n][1]=i+c,i=t[l][n][1]):(t[l][n][0]=o,t[l][n][1]=o+c,o=t[l][n][1])}},lEe=function(t){var r=t.length;if(!(r<=0))for(var n=0,s=t[0].length;n<s;++n)for(var i=0,o=0;o<r;++o){var l=Wp(t[o][n][1])?t[o][n][0]:t[o][n][1];l>=0?(t[o][n][0]=i,t[o][n][1]=i+l,i=t[o][n][1]):(t[o][n][0]=0,t[o][n][1]=0)}},cEe={sign:oEe,expand:Sye,none:kd,silhouette:Nye,wiggle:kye,positive:lEe},uEe=function(t,r,n){var s=r.map(function(l){return l.props.dataKey}),i=cEe[n],o=_ye().keys(s).value(function(l,c){return+Qn(l,c,0)}).order(fS).offset(i);return o(t)},dEe=function(t,r,n,s,i,o){if(!t)return null;var l=o?r.reverse():r,c={},u=l.reduce(function(d,f){var m,g=(m=f.type)!==null&&m!==void 0&&m.defaultProps?Kt(Kt({},f.type.defaultProps),f.props):f.props,p=g.stackId,v=g.hide;if(v)return d;var x=g[n],b=d[x]||{hasStack:!1,stackGroups:{}};if(pr(p)){var w=b.stackGroups[p]||{numericAxisId:n,cateAxisId:s,items:[]};w.items.push(f),b.hasStack=!0,b.stackGroups[p]=w}else b.stackGroups[Vp("_stackId_")]={numericAxisId:n,cateAxisId:s,items:[f]};return Kt(Kt({},d),{},Vu({},x,b))},c),h={};return Object.keys(u).reduce(function(d,f){var m=u[f];if(m.hasStack){var g={};m.stackGroups=Object.keys(m.stackGroups).reduce(function(p,v){var x=m.stackGroups[v];return Kt(Kt({},p),{},Vu({},v,{numericAxisId:n,cateAxisId:s,items:x.items,stackedData:uEe(t,x.items,i)}))},g)}return Kt(Kt({},d),{},Vu({},f,m))},h)},hEe=function(t,r){var n=r.realScaleType,s=r.type,i=r.tickCount,o=r.originalDomain,l=r.allowDecimals,c=n||r.scale;if(c!=="auto"&&c!=="linear")return null;if(i&&s==="number"&&o&&(o[0]==="auto"||o[1]==="auto")){var u=t.domain();if(!u.length)return null;var h=_Ce(u,i,l);return t.domain([Yb(h),Kb(h)]),{niceTicks:h}}if(i&&s==="number"){var d=t.domain(),f=SCe(d,i,l);return{niceTicks:f}}return null};function yM(e){var t=e.axis,r=e.ticks,n=e.bandSize,s=e.entry,i=e.index,o=e.dataKey;if(t.type==="category"){if(!t.allowDuplicatedCategory&&t.dataKey&&!Ze(s[t.dataKey])){var l=Qv(r,"value",s[t.dataKey]);if(l)return l.coordinate+n/2}return r[i]?r[i].coordinate+n/2:null}var c=Qn(s,Ze(o)?t.dataKey:o);return Ze(c)?null:t.scale(c)}var vM=function(t){var r=t.axis,n=t.ticks,s=t.offset,i=t.bandSize,o=t.entry,l=t.index;if(r.type==="category")return n[l]?n[l].coordinate+s:null;var c=Qn(o,r.dataKey,r.domain[l]);return Ze(c)?null:r.scale(c)-i/2+s},fEe=function(t){var r=t.numericAxis,n=r.scale.domain();if(r.type==="number"){var s=Math.min(n[0],n[1]),i=Math.max(n[0],n[1]);return s<=0&&i>=0?0:i<0?i:s}return n[0]},mEe=function(t,r){var n,s=(n=t.type)!==null&&n!==void 0&&n.defaultProps?Kt(Kt({},t.type.defaultProps),t.props):t.props,i=s.stackId;if(pr(i)){var o=r[i];if(o){var l=o.items.indexOf(t);return l>=0?o.stackedData[l]:null}}return null},pEe=function(t){return t.reduce(function(r,n){return[Yb(n.concat([r[0]]).filter(Ne)),Kb(n.concat([r[1]]).filter(Ne))]},[1/0,-1/0])},x9=function(t,r,n){return Object.keys(t).reduce(function(s,i){var o=t[i],l=o.stackedData,c=l.reduce(function(u,h){var d=pEe(h.slice(r,n+1));return[Math.min(u[0],d[0]),Math.max(u[1],d[1])]},[1/0,-1/0]);return[Math.min(c[0],s[0]),Math.max(c[1],s[1])]},[1/0,-1/0]).map(function(s){return s===1/0||s===-1/0?0:s})},xM=/^dataMin[\s]*-[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,bM=/^dataMax[\s]*\+[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,WS=function(t,r,n){if(Qe(t))return t(r,n);if(!Array.isArray(t))return r;var s=[];if(Ne(t[0]))s[0]=n?t[0]:Math.min(t[0],r[0]);else if(xM.test(t[0])){var i=+xM.exec(t[0])[1];s[0]=r[0]-i}else Qe(t[0])?s[0]=t[0](r[0]):s[0]=r[0];if(Ne(t[1]))s[1]=n?t[1]:Math.max(t[1],r[1]);else if(bM.test(t[1])){var o=+bM.exec(t[1])[1];s[1]=r[1]+o}else Qe(t[1])?s[1]=t[1](r[1]):s[1]=r[1];return s},Ex=function(t,r,n){if(t&&t.scale&&t.scale.bandwidth){var s=t.scale.bandwidth();if(!n||s>0)return s}if(t&&r&&r.length>=2){for(var i=HC(r,function(d){return d.coordinate}),o=1/0,l=1,c=i.length;l<c;l++){var u=i[l],h=i[l-1];o=Math.min((u.coordinate||0)-(h.coordinate||0),o)}return o===1/0?0:o}return n?void 0:0},wM=function(t,r,n){return!t||!t.length||Xb(t,ga(n,"type.defaultProps.domain"))?r:t},b9=function(t,r){var n=t.type.defaultProps?Kt(Kt({},t.type.defaultProps),t.props):t.props,s=n.dataKey,i=n.name,o=n.unit,l=n.formatter,c=n.tooltipType,u=n.chartType,h=n.hide;return Kt(Kt({},rt(t,!1)),{},{dataKey:s,unit:o,formatter:l,name:i||s,color:yE(t),value:Qn(r,s),type:c,payload:r,chartType:u,hide:h})};function Vm(e){"@babel/helpers - typeof";return Vm=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Vm(e)}function jM(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function _M(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?jM(Object(r),!0).forEach(function(n){gEe(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):jM(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function gEe(e,t,r){return t=yEe(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function yEe(e){var t=vEe(e,"string");return Vm(t)=="symbol"?t:t+""}function vEe(e,t){if(Vm(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(Vm(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Tx=Math.PI/180,xEe=function(t){return t*180/Math.PI},Dr=function(t,r,n,s){return{x:t+Math.cos(-Tx*s)*n,y:r+Math.sin(-Tx*s)*n}},bEe=function(t,r){var n=t.x,s=t.y,i=r.x,o=r.y;return Math.sqrt(Math.pow(n-i,2)+Math.pow(s-o,2))},wEe=function(t,r){var n=t.x,s=t.y,i=r.cx,o=r.cy,l=bEe({x:n,y:s},{x:i,y:o});if(l<=0)return{radius:l};var c=(n-i)/l,u=Math.acos(c);return s>o&&(u=2*Math.PI-u),{radius:l,angle:xEe(u),angleInRadian:u}},jEe=function(t){var r=t.startAngle,n=t.endAngle,s=Math.floor(r/360),i=Math.floor(n/360),o=Math.min(s,i);return{startAngle:r-o*360,endAngle:n-o*360}},_Ee=function(t,r){var n=r.startAngle,s=r.endAngle,i=Math.floor(n/360),o=Math.floor(s/360),l=Math.min(i,o);return t+l*360},SM=function(t,r){var n=t.x,s=t.y,i=wEe({x:n,y:s},r),o=i.radius,l=i.angle,c=r.innerRadius,u=r.outerRadius;if(o<c||o>u)return!1;if(o===0)return!0;var h=jEe(r),d=h.startAngle,f=h.endAngle,m=l,g;if(d<=f){for(;m>f;)m-=360;for(;m<d;)m+=360;g=m>=d&&m<=f}else{for(;m>d;)m-=360;for(;m<f;)m+=360;g=m>=f&&m<=d}return g?_M(_M({},r),{},{radius:o,angle:_Ee(m,r)}):null};function Hm(e){"@babel/helpers - typeof";return Hm=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Hm(e)}var SEe=["offset"];function NEe(e){return TEe(e)||EEe(e)||CEe(e)||kEe()}function kEe(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
901In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function CEe(e,t){if(e){if(typeof e=="string")return VS(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return VS(e,t)}}function EEe(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function TEe(e){if(Array.isArray(e))return VS(e)}function VS(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function AEe(e,t){if(e==null)return{};var r=PEe(e,t),n,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(s=0;s<i.length;s++)n=i[s],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function PEe(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function NM(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function ur(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?NM(Object(r),!0).forEach(function(n){OEe(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):NM(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function OEe(e,t,r){return t=MEe(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function MEe(e){var t=REe(e,"string");return Hm(t)=="symbol"?t:t+""}function REe(e,t){if(Hm(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(Hm(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function qm(){return qm=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},qm.apply(this,arguments)}var $Ee=function(t){var r=t.value,n=t.formatter,s=Ze(t.children)?r:t.children;return Qe(n)?n(s):s},IEe=function(t,r){var n=Ja(r-t),s=Math.min(Math.abs(r-t),360);return n*s},DEe=function(t,r,n){var s=t.position,i=t.viewBox,o=t.offset,l=t.className,c=i,u=c.cx,h=c.cy,d=c.innerRadius,f=c.outerRadius,m=c.startAngle,g=c.endAngle,p=c.clockWise,v=(d+f)/2,x=IEe(m,g),b=x>=0?1:-1,w,j;s==="insideStart"?(w=m+b*o,j=p):s==="insideEnd"?(w=g-b*o,j=!p):s==="end"&&(w=g+b*o,j=p),j=x<=0?j:!j;var _=Dr(u,h,v,w),S=Dr(u,h,v,w+(j?1:-1)*359),k="M".concat(_.x,",").concat(_.y,`
902    A`).concat(v,",").concat(v,",0,1,").concat(j?0:1,`,
903    `).concat(S.x,",").concat(S.y),P=Ze(t.id)?Vp("recharts-radial-line-"):t.id;return J.createElement("text",qm({},n,{dominantBaseline:"central",className:nt("recharts-radial-bar-label",l)}),J.createElement("defs",null,J.createElement("path",{id:P,d:k})),J.createElement("textPath",{xlinkHref:"#".concat(P)},r))},LEe=function(t){var r=t.viewBox,n=t.offset,s=t.position,i=r,o=i.cx,l=i.cy,c=i.innerRadius,u=i.outerRadius,h=i.startAngle,d=i.endAngle,f=(h+d)/2;if(s==="outside"){var m=Dr(o,l,u+n,f),g=m.x,p=m.y;return{x:g,y:p,textAnchor:g>=o?"start":"end",verticalAnchor:"middle"}}if(s==="center")return{x:o,y:l,textAnchor:"middle",verticalAnchor:"middle"};if(s==="centerTop")return{x:o,y:l,textAnchor:"middle",verticalAnchor:"start"};if(s==="centerBottom")return{x:o,y:l,textAnchor:"middle",verticalAnchor:"end"};var v=(c+u)/2,x=Dr(o,l,v,f),b=x.x,w=x.y;return{x:b,y:w,textAnchor:"middle",verticalAnchor:"middle"}},FEe=function(t){var r=t.viewBox,n=t.parentViewBox,s=t.offset,i=t.position,o=r,l=o.x,c=o.y,u=o.width,h=o.height,d=h>=0?1:-1,f=d*s,m=d>0?"end":"start",g=d>0?"start":"end",p=u>=0?1:-1,v=p*s,x=p>0?"end":"start",b=p>0?"start":"end";if(i==="top"){var w={x:l+u/2,y:c-d*s,textAnchor:"middle",verticalAnchor:m};return ur(ur({},w),n?{height:Math.max(c-n.y,0),width:u}:{})}if(i==="bottom"){var j={x:l+u/2,y:c+h+f,textAnchor:"middle",verticalAnchor:g};return ur(ur({},j),n?{height:Math.max(n.y+n.height-(c+h),0),width:u}:{})}if(i==="left"){var _={x:l-v,y:c+h/2,textAnchor:x,verticalAnchor:"middle"};return ur(ur({},_),n?{width:Math.max(_.x-n.x,0),height:h}:{})}if(i==="right"){var S={x:l+u+v,y:c+h/2,textAnchor:b,verticalAnchor:"middle"};return ur(ur({},S),n?{width:Math.max(n.x+n.width-S.x,0),height:h}:{})}var k=n?{width:u,height:h}:{};return i==="insideLeft"?ur({x:l+v,y:c+h/2,textAnchor:b,verticalAnchor:"middle"},k):i==="insideRight"?ur({x:l+u-v,y:c+h/2,textAnchor:x,verticalAnchor:"middle"},k):i==="insideTop"?ur({x:l+u/2,y:c+f,textAnchor:"middle",verticalAnchor:g},k):i==="insideBottom"?ur({x:l+u/2,y:c+h-f,textAnchor:"middle",verticalAnchor:m},k):i==="insideTopLeft"?ur({x:l+v,y:c+f,textAnchor:b,verticalAnchor:g},k):i==="insideTopRight"?ur({x:l+u-v,y:c+f,textAnchor:x,verticalAnchor:g},k):i==="insideBottomLeft"?ur({x:l+v,y:c+h-f,textAnchor:b,verticalAnchor:m},k):i==="insideBottomRight"?ur({x:l+u-v,y:c+h-f,textAnchor:x,verticalAnchor:m},k):mh(i)&&(Ne(i.x)||zl(i.x))&&(Ne(i.y)||zl(i.y))?ur({x:l+pc(i.x,u),y:c+pc(i.y,h),textAnchor:"end",verticalAnchor:"end"},k):ur({x:l+u/2,y:c+h/2,textAnchor:"middle",verticalAnchor:"middle"},k)},zEe=function(t){return"cx"in t&&Ne(t.cx)};function Yr(e){var t=e.offset,r=t===void 0?5:t,n=AEe(e,SEe),s=ur({offset:r},n),i=s.viewBox,o=s.position,l=s.value,c=s.children,u=s.content,h=s.className,d=h===void 0?"":h,f=s.textBreakAll;if(!i||Ze(l)&&Ze(c)&&!y.isValidElement(u)&&!Qe(u))return null;if(y.isValidElement(u))return y.cloneElement(u,s);var m;if(Qe(u)){if(m=y.createElement(u,s),y.isValidElement(m))return m}else m=$Ee(s);var g=zEe(i),p=rt(s,!0);if(g&&(o==="insideStart"||o==="insideEnd"||o==="end"))return DEe(s,m,p);var v=g?LEe(s):FEe(s);return J.createElement(fx,qm({className:nt("recharts-label",d)},p,v,{breakAll:f}),m)}Yr.displayName="Label";var w9=function(t){var r=t.cx,n=t.cy,s=t.angle,i=t.startAngle,o=t.endAngle,l=t.r,c=t.radius,u=t.innerRadius,h=t.outerRadius,d=t.x,f=t.y,m=t.top,g=t.left,p=t.width,v=t.height,x=t.clockWise,b=t.labelViewBox;if(b)return b;if(Ne(p)&&Ne(v)){if(Ne(d)&&Ne(f))return{x:d,y:f,width:p,height:v};if(Ne(m)&&Ne(g))return{x:m,y:g,width:p,height:v}}return Ne(d)&&Ne(f)?{x:d,y:f,width:0,height:0}:Ne(r)&&Ne(n)?{cx:r,cy:n,startAngle:i||s||0,endAngle:o||s||0,innerRadius:u||0,outerRadius:h||c||l||0,clockWise:x}:t.viewBox?t.viewBox:{}},BEe=function(t,r){return t?t===!0?J.createElement(Yr,{key:"label-implicit",viewBox:r}):pr(t)?J.createElement(Yr,{key:"label-implicit",viewBox:r,value:t}):y.isValidElement(t)?t.type===Yr?y.cloneElement(t,{key:"label-implicit",viewBox:r}):J.createElement(Yr,{key:"label-implicit",content:t,viewBox:r}):Qe(t)?J.createElement(Yr,{key:"label-implicit",content:t,viewBox:r}):mh(t)?J.createElement(Yr,qm({viewBox:r},t,{key:"label-implicit"})):null:null},UEe=function(t,r){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(!t||!t.children&&n&&!t.label)return null;var s=t.children,i=w9(t),o=ya(s,Yr).map(function(c,u){return y.cloneElement(c,{viewBox:r||i,key:"label-".concat(u)})});if(!n)return o;var l=BEe(t.label,r||i);return[l].concat(NEe(o))};Yr.parseViewBox=w9;Yr.renderCallByParent=UEe;function WEe(e){var t=e==null?0:e.length;return t?e[t-1]:void 0}var VEe=WEe;const HEe=mt(VEe);function Gm(e){"@babel/helpers - typeof";return Gm=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Gm(e)}var qEe=["valueAccessor"],GEe=["data","dataKey","clockWise","id","textBreakAll"];function KEe(e){return JEe(e)||QEe(e)||XEe(e)||YEe()}function YEe(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
904In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function XEe(e,t){if(e){if(typeof e=="string")return HS(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return HS(e,t)}}function QEe(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function JEe(e){if(Array.isArray(e))return HS(e)}function HS(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function Ax(){return Ax=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Ax.apply(this,arguments)}function kM(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function CM(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?kM(Object(r),!0).forEach(function(n){ZEe(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):kM(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function ZEe(e,t,r){return t=eTe(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function eTe(e){var t=tTe(e,"string");return Gm(t)=="symbol"?t:t+""}function tTe(e,t){if(Gm(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(Gm(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function EM(e,t){if(e==null)return{};var r=rTe(e,t),n,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(s=0;s<i.length;s++)n=i[s],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function rTe(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}var nTe=function(t){return Array.isArray(t.value)?HEe(t.value):t.value};function Ho(e){var t=e.valueAccessor,r=t===void 0?nTe:t,n=EM(e,qEe),s=n.data,i=n.dataKey,o=n.clockWise,l=n.id,c=n.textBreakAll,u=EM(n,GEe);return!s||!s.length?null:J.createElement(rr,{className:"recharts-label-list"},s.map(function(h,d){var f=Ze(i)?r(h,d):Qn(h&&h.payload,i),m=Ze(l)?{}:{id:"".concat(l,"-").concat(d)};return J.createElement(Yr,Ax({},rt(h,!0),u,m,{parentViewBox:h.parentViewBox,value:f,textBreakAll:c,viewBox:Yr.parseViewBox(Ze(o)?h:CM(CM({},h),{},{clockWise:o})),key:"label-".concat(d),index:d}))}))}Ho.displayName="LabelList";function aTe(e,t){return e?e===!0?J.createElement(Ho,{key:"labelList-implicit",data:t}):J.isValidElement(e)||Qe(e)?J.createElement(Ho,{key:"labelList-implicit",data:t,content:e}):mh(e)?J.createElement(Ho,Ax({data:t},e,{key:"labelList-implicit"})):null:null}function sTe(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(!e||!e.children&&r&&!e.label)return null;var n=e.children,s=ya(n,Ho).map(function(o,l){return y.cloneElement(o,{data:t,key:"labelList-".concat(l)})});if(!r)return s;var i=aTe(e.label,t);return[i].concat(KEe(s))}Ho.renderCallByParent=sTe;function Km(e){"@babel/helpers - typeof";return Km=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Km(e)}function qS(){return qS=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},qS.apply(this,arguments)}function TM(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function AM(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?TM(Object(r),!0).forEach(function(n){iTe(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):TM(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function iTe(e,t,r){return t=oTe(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function oTe(e){var t=lTe(e,"string");return Km(t)=="symbol"?t:t+""}function lTe(e,t){if(Km(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(Km(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var cTe=function(t,r){var n=Ja(r-t),s=Math.min(Math.abs(r-t),359.999);return n*s},Zg=function(t){var r=t.cx,n=t.cy,s=t.radius,i=t.angle,o=t.sign,l=t.isExternal,c=t.cornerRadius,u=t.cornerIsExternal,h=c*(l?1:-1)+s,d=Math.asin(c/h)/Tx,f=u?i:i+o*d,m=Dr(r,n,h,f),g=Dr(r,n,s,f),p=u?i-o*d:i,v=Dr(r,n,h*Math.cos(d*Tx),p);return{center:m,circleTangency:g,lineTangency:v,theta:d}},j9=function(t){var r=t.cx,n=t.cy,s=t.innerRadius,i=t.outerRadius,o=t.startAngle,l=t.endAngle,c=cTe(o,l),u=o+c,h=Dr(r,n,i,o),d=Dr(r,n,i,u),f="M ".concat(h.x,",").concat(h.y,`
905    A `).concat(i,",").concat(i,`,0,
906    `).concat(+(Math.abs(c)>180),",").concat(+(o>u),`,
907    `).concat(d.x,",").concat(d.y,`
908  `);if(s>0){var m=Dr(r,n,s,o),g=Dr(r,n,s,u);f+="L ".concat(g.x,",").concat(g.y,`
909            A `).concat(s,",").concat(s,`,0,
910            `).concat(+(Math.abs(c)>180),",").concat(+(o<=u),`,
911            `).concat(m.x,",").concat(m.y," Z")}else f+="L ".concat(r,",").concat(n," Z");return f},uTe=function(t){var r=t.cx,n=t.cy,s=t.innerRadius,i=t.outerRadius,o=t.cornerRadius,l=t.forceCornerRadius,c=t.cornerIsExternal,u=t.startAngle,h=t.endAngle,d=Ja(h-u),f=Zg({cx:r,cy:n,radius:i,angle:u,sign:d,cornerRadius:o,cornerIsExternal:c}),m=f.circleTangency,g=f.lineTangency,p=f.theta,v=Zg({cx:r,cy:n,radius:i,angle:h,sign:-d,cornerRadius:o,cornerIsExternal:c}),x=v.circleTangency,b=v.lineTangency,w=v.theta,j=c?Math.abs(u-h):Math.abs(u-h)-p-w;if(j<0)return l?"M ".concat(g.x,",").concat(g.y,`
912        a`).concat(o,",").concat(o,",0,0,1,").concat(o*2,`,0
913        a`).concat(o,",").concat(o,",0,0,1,").concat(-o*2,`,0
914      `):j9({cx:r,cy:n,innerRadius:s,outerRadius:i,startAngle:u,endAngle:h});var _="M ".concat(g.x,",").concat(g.y,`
915    A`).concat(o,",").concat(o,",0,0,").concat(+(d<0),",").concat(m.x,",").concat(m.y,`
916    A`).concat(i,",").concat(i,",0,").concat(+(j>180),",").concat(+(d<0),",").concat(x.x,",").concat(x.y,`
917    A`).concat(o,",").concat(o,",0,0,").concat(+(d<0),",").concat(b.x,",").concat(b.y,`
918  `);if(s>0){var S=Zg({cx:r,cy:n,radius:s,angle:u,sign:d,isExternal:!0,cornerRadius:o,cornerIsExternal:c}),k=S.circleTangency,P=S.lineTangency,C=S.theta,M=Zg({cx:r,cy:n,radius:s,angle:h,sign:-d,isExternal:!0,cornerRadius:o,cornerIsExternal:c}),I=M.circleTangency,E=M.lineTangency,B=M.theta,A=c?Math.abs(u-h):Math.abs(u-h)-C-B;if(A<0&&o===0)return"".concat(_,"L").concat(r,",").concat(n,"Z");_+="L".concat(E.x,",").concat(E.y,`
919      A`).concat(o,",").concat(o,",0,0,").concat(+(d<0),",").concat(I.x,",").concat(I.y,`
920      A`).concat(s,",").concat(s,",0,").concat(+(A>180),",").concat(+(d>0),",").concat(k.x,",").concat(k.y,`
921      A`).concat(o,",").concat(o,",0,0,").concat(+(d<0),",").concat(P.x,",").concat(P.y,"Z")}else _+="L".concat(r,",").concat(n,"Z");return _},dTe={cx:0,cy:0,innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,cornerRadius:0,forceCornerRadius:!1,cornerIsExternal:!1},_9=function(t){var r=AM(AM({},dTe),t),n=r.cx,s=r.cy,i=r.innerRadius,o=r.outerRadius,l=r.cornerRadius,c=r.forceCornerRadius,u=r.cornerIsExternal,h=r.startAngle,d=r.endAngle,f=r.className;if(o<i||h===d)return null;var m=nt("recharts-sector",f),g=o-i,p=pc(l,g,0,!0),v;return p>0&&Math.abs(h-d)<360?v=uTe({cx:n,cy:s,innerRadius:i,outerRadius:o,cornerRadius:Math.min(p,g/2),forceCornerRadius:c,cornerIsExternal:u,startAngle:h,endAngle:d}):v=j9({cx:n,cy:s,innerRadius:i,outerRadius:o,startAngle:h,endAngle:d}),J.createElement("path",qS({},rt(r,!0),{className:m,d:v,role:"img"}))};function Ym(e){"@babel/helpers - typeof";return Ym=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ym(e)}function GS(){return GS=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},GS.apply(this,arguments)}function PM(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function OM(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?PM(Object(r),!0).forEach(function(n){hTe(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):PM(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function hTe(e,t,r){return t=fTe(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function fTe(e){var t=mTe(e,"string");return Ym(t)=="symbol"?t:t+""}function mTe(e,t){if(Ym(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(Ym(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var MM={curveBasisClosed:hye,curveBasisOpen:fye,curveBasis:dye,curveBumpX:Qge,curveBumpY:Jge,curveLinearClosed:mye,curveLinear:Db,curveMonotoneX:pye,curveMonotoneY:gye,curveNatural:yye,curveStep:vye,curveStepAfter:bye,curveStepBefore:xye},ey=function(t){return t.x===+t.x&&t.y===+t.y},Yh=function(t){return t.x},Xh=function(t){return t.y},pTe=function(t,r){if(Qe(t))return t;var n="curve".concat($b(t));return(n==="curveMonotone"||n==="curveBump")&&r?MM["".concat(n).concat(r==="vertical"?"Y":"X")]:MM[n]||Db},gTe=function(t){var r=t.type,n=r===void 0?"linear":r,s=t.points,i=s===void 0?[]:s,o=t.baseLine,l=t.layout,c=t.connectNulls,u=c===void 0?!1:c,h=pTe(n,l),d=u?i.filter(function(p){return ey(p)}):i,f;if(Array.isArray(o)){var m=u?o.filter(function(p){return ey(p)}):o,g=d.map(function(p,v){return OM(OM({},p),{},{base:m[v]})});return l==="vertical"?f=Vg().y(Xh).x1(Yh).x0(function(p){return p.base.x}):f=Vg().x(Yh).y1(Xh).y0(function(p){return p.base.y}),f.defined(ey).curve(h),f(g)}return l==="vertical"&&Ne(o)?f=Vg().y(Xh).x1(Yh).x0(o):Ne(o)?f=Vg().x(Yh).y1(Xh).y0(o):f=SU().x(Yh).y(Xh),f.defined(ey).curve(h),f(d)},KS=function(t){var r=t.className,n=t.points,s=t.path,i=t.pathRef;if((!n||!n.length)&&!s)return null;var o=n&&n.length?gTe(t):s;return y.createElement("path",GS({},rt(t,!1),Jv(t),{className:nt("recharts-curve",r),d:o,ref:i}))},S9={exports:{}},yTe="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",vTe=yTe,xTe=vTe;function N9(){}function k9(){}k9.resetWarningCache=N9;var bTe=function(){function e(n,s,i,o,l,c){if(c!==xTe){var u=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 u.name="Invariant Violation",u}}e.isRequired=e;function t(){return e}var r={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:k9,resetWarningCache:N9};return r.PropTypes=r,r};S9.exports=bTe();var wTe=S9.exports;const dt=mt(wTe),{getOwnPropertyNames:jTe,getOwnPropertySymbols:_Te}=Object,{hasOwnProperty:STe}=Object.prototype;function z1(e,t){return function(n,s,i){return e(n,s,i)&&t(n,s,i)}}function ty(e){return function(r,n,s){if(!r||!n||typeof r!="object"||typeof n!="object")return e(r,n,s);const{cache:i}=s,o=i.get(r),l=i.get(n);if(o&&l)return o===n&&l===r;i.set(r,n),i.set(n,r);const c=e(r,n,s);return i.delete(r),i.delete(n),c}}function NTe(e){return e!=null?e[Symbol.toStringTag]:void 0}function RM(e){return jTe(e).concat(_Te(e))}const kTe=Object.hasOwn||((e,t)=>STe.call(e,t));function Dc(e,t){return e===t||!e&&!t&&e!==e&&t!==t}const CTe="__v",ETe="__o",TTe="_owner",{getOwnPropertyDescriptor:$M,keys:IM}=Object;function ATe(e,t){return e.byteLength===t.byteLength&&Px(new Uint8Array(e),new Uint8Array(t))}function PTe(e,t,r){let n=e.length;if(t.length!==n)return!1;for(;n-- >0;)if(!r.equals(e[n],t[n],n,n,e,t,r))return!1;return!0}function OTe(e,t){return e.byteLength===t.byteLength&&Px(new Uint8Array(e.buffer,e.byteOffset,e.byteLength),new Uint8Array(t.buffer,t.byteOffset,t.byteLength))}function MTe(e,t){return Dc(e.getTime(),t.getTime())}function RTe(e,t){return e.name===t.name&&e.message===t.message&&e.cause===t.cause&&e.stack===t.stack}function $Te(e,t){return e===t}function DM(e,t,r){const n=e.size;if(n!==t.size)return!1;if(!n)return!0;const s=new Array(n),i=e.entries();let o,l,c=0;for(;(o=i.next())&&!o.done;){const u=t.entries();let h=!1,d=0;for(;(l=u.next())&&!l.done;){if(s[d]){d++;continue}const f=o.value,m=l.value;if(r.equals(f[0],m[0],c,d,e,t,r)&&r.equals(f[1],m[1],f[0],m[0],e,t,r)){h=s[d]=!0;break}d++}if(!h)return!1;c++}return!0}const ITe=Dc;function DTe(e,t,r){const n=IM(e);let s=n.length;if(IM(t).length!==s)return!1;for(;s-- >0;)if(!C9(e,t,r,n[s]))return!1;return!0}function Qh(e,t,r){const n=RM(e);let s=n.length;if(RM(t).length!==s)return!1;let i,o,l;for(;s-- >0;)if(i=n[s],!C9(e,t,r,i)||(o=$M(e,i),l=$M(t,i),(o||l)&&(!o||!l||o.configurable!==l.configurable||o.enumerable!==l.enumerable||o.writable!==l.writable)))return!1;return!0}function LTe(e,t){return Dc(e.valueOf(),t.valueOf())}function FTe(e,t){return e.source===t.source&&e.flags===t.flags}function LM(e,t,r){const n=e.size;if(n!==t.size)return!1;if(!n)return!0;const s=new Array(n),i=e.values();let o,l;for(;(o=i.next())&&!o.done;){const c=t.values();let u=!1,h=0;for(;(l=c.next())&&!l.done;){if(!s[h]&&r.equals(o.value,l.value,o.value,l.value,e,t,r)){u=s[h]=!0;break}h++}if(!u)return!1}return!0}function Px(e,t){let r=e.byteLength;if(t.byteLength!==r||e.byteOffset!==t.byteOffset)return!1;for(;r-- >0;)if(e[r]!==t[r])return!1;return!0}function zTe(e,t){return e.hostname===t.hostname&&e.pathname===t.pathname&&e.protocol===t.protocol&&e.port===t.port&&e.hash===t.hash&&e.username===t.username&&e.password===t.password}function C9(e,t,r,n){return(n===TTe||n===ETe||n===CTe)&&(e.$$typeof||t.$$typeof)?!0:kTe(t,n)&&r.equals(e[n],t[n],n,n,e,t,r)}const BTe="[object ArrayBuffer]",UTe="[object Arguments]",WTe="[object Boolean]",VTe="[object DataView]",HTe="[object Date]",qTe="[object Error]",GTe="[object Map]",KTe="[object Number]",YTe="[object Object]",XTe="[object RegExp]",QTe="[object Set]",JTe="[object String]",ZTe={"[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},eAe="[object URL]",tAe=Object.prototype.toString;function rAe({areArrayBuffersEqual:e,areArraysEqual:t,areDataViewsEqual:r,areDatesEqual:n,areErrorsEqual:s,areFunctionsEqual:i,areMapsEqual:o,areNumbersEqual:l,areObjectsEqual:c,arePrimitiveWrappersEqual:u,areRegExpsEqual:h,areSetsEqual:d,areTypedArraysEqual:f,areUrlsEqual:m,unknownTagComparators:g}){return function(v,x,b){if(v===x)return!0;if(v==null||x==null)return!1;const w=typeof v;if(w!==typeof x)return!1;if(w!=="object")return w==="number"?l(v,x,b):w==="function"?i(v,x,b):!1;const j=v.constructor;if(j!==x.constructor)return!1;if(j===Object)return c(v,x,b);if(Array.isArray(v))return t(v,x,b);if(j===Date)return n(v,x,b);if(j===RegExp)return h(v,x,b);if(j===Map)return o(v,x,b);if(j===Set)return d(v,x,b);const _=tAe.call(v);if(_===HTe)return n(v,x,b);if(_===XTe)return h(v,x,b);if(_===GTe)return o(v,x,b);if(_===QTe)return d(v,x,b);if(_===YTe)return typeof v.then!="function"&&typeof x.then!="function"&&c(v,x,b);if(_===eAe)return m(v,x,b);if(_===qTe)return s(v,x,b);if(_===UTe)return c(v,x,b);if(ZTe[_])return f(v,x,b);if(_===BTe)return e(v,x,b);if(_===VTe)return r(v,x,b);if(_===WTe||_===KTe||_===JTe)return u(v,x,b);if(g){let S=g[_];if(!S){const k=NTe(v);k&&(S=g[k])}if(S)return S(v,x,b)}return!1}}function nAe({circular:e,createCustomConfig:t,strict:r}){let n={areArrayBuffersEqual:ATe,areArraysEqual:r?Qh:PTe,areDataViewsEqual:OTe,areDatesEqual:MTe,areErrorsEqual:RTe,areFunctionsEqual:$Te,areMapsEqual:r?z1(DM,Qh):DM,areNumbersEqual:ITe,areObjectsEqual:r?Qh:DTe,arePrimitiveWrappersEqual:LTe,areRegExpsEqual:FTe,areSetsEqual:r?z1(LM,Qh):LM,areTypedArraysEqual:r?z1(Px,Qh):Px,areUrlsEqual:zTe,unknownTagComparators:void 0};if(t&&(n=Object.assign({},n,t(n))),e){const s=ty(n.areArraysEqual),i=ty(n.areMapsEqual),o=ty(n.areObjectsEqual),l=ty(n.areSetsEqual);n=Object.assign({},n,{areArraysEqual:s,areMapsEqual:i,areObjectsEqual:o,areSetsEqual:l})}return n}function aAe(e){return function(t,r,n,s,i,o,l){return e(t,r,l)}}function sAe({circular:e,comparator:t,createState:r,equals:n,strict:s}){if(r)return function(l,c){const{cache:u=e?new WeakMap:void 0,meta:h}=r();return t(l,c,{cache:u,equals:n,meta:h,strict:s})};if(e)return function(l,c){return t(l,c,{cache:new WeakMap,equals:n,meta:void 0,strict:s})};const i={cache:void 0,equals:n,meta:void 0,strict:s};return function(l,c){return t(l,c,i)}}const iAe=ml();ml({strict:!0});ml({circular:!0});ml({circular:!0,strict:!0});ml({createInternalComparator:()=>Dc});ml({strict:!0,createInternalComparator:()=>Dc});ml({circular:!0,createInternalComparator:()=>Dc});ml({circular:!0,createInternalComparator:()=>Dc,strict:!0});function ml(e={}){const{circular:t=!1,createInternalComparator:r,createState:n,strict:s=!1}=e,i=nAe(e),o=rAe(i),l=r?r(o):aAe(o);return sAe({circular:t,comparator:o,createState:n,equals:l,strict:s})}function oAe(e){typeof requestAnimationFrame<"u"&&requestAnimationFrame(e)}function FM(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,r=-1,n=function s(i){r<0&&(r=i),i-r>t?(e(i),r=-1):oAe(s)};requestAnimationFrame(n)}function YS(e){"@babel/helpers - typeof";return YS=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},YS(e)}function lAe(e){return hAe(e)||dAe(e)||uAe(e)||cAe()}function cAe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
922In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function uAe(e,t){if(e){if(typeof e=="string")return zM(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return zM(e,t)}}function zM(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function dAe(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function hAe(e){if(Array.isArray(e))return e}function fAe(){var e={},t=function(){return null},r=!1,n=function s(i){if(!r){if(Array.isArray(i)){if(!i.length)return;var o=i,l=lAe(o),c=l[0],u=l.slice(1);if(typeof c=="number"){FM(s.bind(null,u),c);return}s(c),FM(s.bind(null,u));return}YS(i)==="object"&&(e=i,t(e)),typeof i=="function"&&i()}};return{stop:function(){r=!0},start:function(i){r=!1,n(i)},subscribe:function(i){return t=i,function(){t=function(){return null}}}}}function Xm(e){"@babel/helpers - typeof";return Xm=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Xm(e)}function BM(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function UM(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?BM(Object(r),!0).forEach(function(n){E9(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):BM(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function E9(e,t,r){return t=mAe(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function mAe(e){var t=pAe(e,"string");return Xm(t)==="symbol"?t:String(t)}function pAe(e,t){if(Xm(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(Xm(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var gAe=function(t,r){return[Object.keys(t),Object.keys(r)].reduce(function(n,s){return n.filter(function(i){return s.includes(i)})})},yAe=function(t){return t},vAe=function(t){return t.replace(/([A-Z])/g,function(r){return"-".concat(r.toLowerCase())})},Lf=function(t,r){return Object.keys(r).reduce(function(n,s){return UM(UM({},n),{},E9({},s,t(s,r[s])))},{})},WM=function(t,r,n){return t.map(function(s){return"".concat(vAe(s)," ").concat(r,"ms ").concat(n)}).join(",")};function xAe(e,t){return jAe(e)||wAe(e,t)||T9(e,t)||bAe()}function bAe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
923In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function wAe(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,s,i,o,l=[],c=!0,u=!1;try{if(i=(r=r.call(e)).next,t!==0)for(;!(c=(n=i.call(r)).done)&&(l.push(n.value),l.length!==t);c=!0);}catch(h){u=!0,s=h}finally{try{if(!c&&r.return!=null&&(o=r.return(),Object(o)!==o))return}finally{if(u)throw s}}return l}}function jAe(e){if(Array.isArray(e))return e}function _Ae(e){return kAe(e)||NAe(e)||T9(e)||SAe()}function SAe(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
924In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function T9(e,t){if(e){if(typeof e=="string")return XS(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return XS(e,t)}}function NAe(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function kAe(e){if(Array.isArray(e))return XS(e)}function XS(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var Ox=1e-4,A9=function(t,r){return[0,3*t,3*r-6*t,3*t-3*r+1]},P9=function(t,r){return t.map(function(n,s){return n*Math.pow(r,s)}).reduce(function(n,s){return n+s})},VM=function(t,r){return function(n){var s=A9(t,r);return P9(s,n)}},CAe=function(t,r){return function(n){var s=A9(t,r),i=[].concat(_Ae(s.map(function(o,l){return o*l}).slice(1)),[0]);return P9(i,n)}},HM=function(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];var s=r[0],i=r[1],o=r[2],l=r[3];if(r.length===1)switch(r[0]){case"linear":s=0,i=0,o=1,l=1;break;case"ease":s=.25,i=.1,o=.25,l=1;break;case"ease-in":s=.42,i=0,o=1,l=1;break;case"ease-out":s=.42,i=0,o=.58,l=1;break;case"ease-in-out":s=0,i=0,o=.58,l=1;break;default:{var c=r[0].split("(");if(c[0]==="cubic-bezier"&&c[1].split(")")[0].split(",").length===4){var u=c[1].split(")")[0].split(",").map(function(v){return parseFloat(v)}),h=xAe(u,4);s=h[0],i=h[1],o=h[2],l=h[3]}}}var d=VM(s,o),f=VM(i,l),m=CAe(s,o),g=function(x){return x>1?1:x<0?0:x},p=function(x){for(var b=x>1?1:x,w=b,j=0;j<8;++j){var _=d(w)-b,S=m(w);if(Math.abs(_-b)<Ox||S<Ox)return f(w);w=g(w-_/S)}return f(w)};return p.isStepper=!1,p},EAe=function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r=t.stiff,n=r===void 0?100:r,s=t.damping,i=s===void 0?8:s,o=t.dt,l=o===void 0?17:o,c=function(h,d,f){var m=-(h-d)*n,g=f*i,p=f+(m-g)*l/1e3,v=f*l/1e3+h;return Math.abs(v-d)<Ox&&Math.abs(p)<Ox?[d,0]:[v,p]};return c.isStepper=!0,c.dt=l,c},TAe=function(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];var s=r[0];if(typeof s=="string")switch(s){case"ease":case"ease-in-out":case"ease-out":case"ease-in":case"linear":return HM(s);case"spring":return EAe();default:if(s.split("(")[0]==="cubic-bezier")return HM(s)}return typeof s=="function"?s:null};function Qm(e){"@babel/helpers - typeof";return Qm=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Qm(e)}function qM(e){return OAe(e)||PAe(e)||O9(e)||AAe()}function AAe(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
925In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function PAe(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function OAe(e){if(Array.isArray(e))return JS(e)}function GM(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function Or(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?GM(Object(r),!0).forEach(function(n){QS(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):GM(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function QS(e,t,r){return t=MAe(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function MAe(e){var t=RAe(e,"string");return Qm(t)==="symbol"?t:String(t)}function RAe(e,t){if(Qm(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(Qm(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function $Ae(e,t){return LAe(e)||DAe(e,t)||O9(e,t)||IAe()}function IAe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
926In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function O9(e,t){if(e){if(typeof e=="string")return JS(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return JS(e,t)}}function JS(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function DAe(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,s,i,o,l=[],c=!0,u=!1;try{if(i=(r=r.call(e)).next,t!==0)for(;!(c=(n=i.call(r)).done)&&(l.push(n.value),l.length!==t);c=!0);}catch(h){u=!0,s=h}finally{try{if(!c&&r.return!=null&&(o=r.return(),Object(o)!==o))return}finally{if(u)throw s}}return l}}function LAe(e){if(Array.isArray(e))return e}var Mx=function(t,r,n){return t+(r-t)*n},ZS=function(t){var r=t.from,n=t.to;return r!==n},FAe=function e(t,r,n){var s=Lf(function(i,o){if(ZS(o)){var l=t(o.from,o.to,o.velocity),c=$Ae(l,2),u=c[0],h=c[1];return Or(Or({},o),{},{from:u,velocity:h})}return o},r);return n<1?Lf(function(i,o){return ZS(o)?Or(Or({},o),{},{velocity:Mx(o.velocity,s[i].velocity,n),from:Mx(o.from,s[i].from,n)}):o},r):e(t,s,n-1)};const zAe=function(e,t,r,n,s){var i=gAe(e,t),o=i.reduce(function(v,x){return Or(Or({},v),{},QS({},x,[e[x],t[x]]))},{}),l=i.reduce(function(v,x){return Or(Or({},v),{},QS({},x,{from:e[x],velocity:0,to:t[x]}))},{}),c=-1,u,h,d=function(){return null},f=function(){return Lf(function(x,b){return b.from},l)},m=function(){return!Object.values(l).filter(ZS).length},g=function(x){u||(u=x);var b=x-u,w=b/r.dt;l=FAe(r,l,w),s(Or(Or(Or({},e),t),f())),u=x,m()||(c=requestAnimationFrame(d))},p=function(x){h||(h=x);var b=(x-h)/n,w=Lf(function(_,S){return Mx.apply(void 0,qM(S).concat([r(b)]))},o);if(s(Or(Or(Or({},e),t),w)),b<1)c=requestAnimationFrame(d);else{var j=Lf(function(_,S){return Mx.apply(void 0,qM(S).concat([r(1)]))},o);s(Or(Or(Or({},e),t),j))}};return d=r.isStepper?g:p,function(){return requestAnimationFrame(d),function(){cancelAnimationFrame(c)}}};function $d(e){"@babel/helpers - typeof";return $d=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},$d(e)}var BAe=["children","begin","duration","attributeName","easing","isActive","steps","from","to","canBegin","onAnimationEnd","shouldReAnimate","onAnimationReStart"];function UAe(e,t){if(e==null)return{};var r=WAe(e,t),n,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(s=0;s<i.length;s++)n=i[s],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function WAe(e,t){if(e==null)return{};var r={},n=Object.keys(e),s,i;for(i=0;i<n.length;i++)s=n[i],!(t.indexOf(s)>=0)&&(r[s]=e[s]);return r}function B1(e){return GAe(e)||qAe(e)||HAe(e)||VAe()}function VAe(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
927In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function HAe(e,t){if(e){if(typeof e=="string")return eN(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return eN(e,t)}}function qAe(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function GAe(e){if(Array.isArray(e))return eN(e)}function eN(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function KM(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function $a(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?KM(Object(r),!0).forEach(function(n){mf(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):KM(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function mf(e,t,r){return t=M9(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function KAe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function YAe(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,M9(n.key),n)}}function XAe(e,t,r){return t&&YAe(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function M9(e){var t=QAe(e,"string");return $d(t)==="symbol"?t:String(t)}function QAe(e,t){if($d(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if($d(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function JAe(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&tN(e,t)}function tN(e,t){return tN=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,s){return n.__proto__=s,n},tN(e,t)}function ZAe(e){var t=ePe();return function(){var n=Rx(e),s;if(t){var i=Rx(this).constructor;s=Reflect.construct(n,arguments,i)}else s=n.apply(this,arguments);return rN(this,s)}}function rN(e,t){if(t&&($d(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return nN(e)}function nN(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function ePe(){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 Rx(e){return Rx=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Rx(e)}var Bi=function(e){JAe(r,e);var t=ZAe(r);function r(n,s){var i;KAe(this,r),i=t.call(this,n,s);var o=i.props,l=o.isActive,c=o.attributeName,u=o.from,h=o.to,d=o.steps,f=o.children,m=o.duration;if(i.handleStyleChange=i.handleStyleChange.bind(nN(i)),i.changeStyle=i.changeStyle.bind(nN(i)),!l||m<=0)return i.state={style:{}},typeof f=="function"&&(i.state={style:h}),rN(i);if(d&&d.length)i.state={style:d[0].style};else if(u){if(typeof f=="function")return i.state={style:u},rN(i);i.state={style:c?mf({},c,u):u}}else i.state={style:{}};return i}return XAe(r,[{key:"componentDidMount",value:function(){var s=this.props,i=s.isActive,o=s.canBegin;this.mounted=!0,!(!i||!o)&&this.runAnimation(this.props)}},{key:"componentDidUpdate",value:function(s){var i=this.props,o=i.isActive,l=i.canBegin,c=i.attributeName,u=i.shouldReAnimate,h=i.to,d=i.from,f=this.state.style;if(l){if(!o){var m={style:c?mf({},c,h):h};this.state&&f&&(c&&f[c]!==h||!c&&f!==h)&&this.setState(m);return}if(!(iAe(s.to,h)&&s.canBegin&&s.isActive)){var g=!s.canBegin||!s.isActive;this.manager&&this.manager.stop(),this.stopJSAnimation&&this.stopJSAnimation();var p=g||u?d:s.to;if(this.state&&f){var v={style:c?mf({},c,p):p};(c&&f[c]!==p||!c&&f!==p)&&this.setState(v)}this.runAnimation($a($a({},this.props),{},{from:p,begin:0}))}}}},{key:"componentWillUnmount",value:function(){this.mounted=!1;var s=this.props.onAnimationEnd;this.unSubscribe&&this.unSubscribe(),this.manager&&(this.manager.stop(),this.manager=null),this.stopJSAnimation&&this.stopJSAnimation(),s&&s()}},{key:"handleStyleChange",value:function(s){this.changeStyle(s)}},{key:"changeStyle",value:function(s){this.mounted&&this.setState({style:s})}},{key:"runJSAnimation",value:function(s){var i=this,o=s.from,l=s.to,c=s.duration,u=s.easing,h=s.begin,d=s.onAnimationEnd,f=s.onAnimationStart,m=zAe(o,l,TAe(u),c,this.changeStyle),g=function(){i.stopJSAnimation=m()};this.manager.start([f,h,g,c,d])}},{key:"runStepAnimation",value:function(s){var i=this,o=s.steps,l=s.begin,c=s.onAnimationStart,u=o[0],h=u.style,d=u.duration,f=d===void 0?0:d,m=function(p,v,x){if(x===0)return p;var b=v.duration,w=v.easing,j=w===void 0?"ease":w,_=v.style,S=v.properties,k=v.onAnimationEnd,P=x>0?o[x-1]:v,C=S||Object.keys(_);if(typeof j=="function"||j==="spring")return[].concat(B1(p),[i.runJSAnimation.bind(i,{from:P.style,to:_,duration:b,easing:j}),b]);var M=WM(C,b,j),I=$a($a($a({},P.style),_),{},{transition:M});return[].concat(B1(p),[I,b,k]).filter(yAe)};return this.manager.start([c].concat(B1(o.reduce(m,[h,Math.max(f,l)])),[s.onAnimationEnd]))}},{key:"runAnimation",value:function(s){this.manager||(this.manager=fAe());var i=s.begin,o=s.duration,l=s.attributeName,c=s.to,u=s.easing,h=s.onAnimationStart,d=s.onAnimationEnd,f=s.steps,m=s.children,g=this.manager;if(this.unSubscribe=g.subscribe(this.handleStyleChange),typeof u=="function"||typeof m=="function"||u==="spring"){this.runJSAnimation(s);return}if(f.length>1){this.runStepAnimation(s);return}var p=l?mf({},l,c):c,v=WM(Object.keys(p),o,u);g.start([h,i,$a($a({},p),{},{transition:v}),o,d])}},{key:"render",value:function(){var s=this.props,i=s.children;s.begin;var o=s.duration;s.attributeName,s.easing;var l=s.isActive;s.steps,s.from,s.to,s.canBegin,s.onAnimationEnd,s.shouldReAnimate,s.onAnimationReStart;var c=UAe(s,BAe),u=y.Children.count(i),h=this.state.style;if(typeof i=="function")return i(h);if(!l||u===0||o<=0)return i;var d=function(m){var g=m.props,p=g.style,v=p===void 0?{}:p,x=g.className,b=y.cloneElement(m,$a($a({},c),{},{style:$a($a({},v),h),className:x}));return b};return u===1?d(y.Children.only(i)):J.createElement("div",null,y.Children.map(i,function(f){return d(f)}))}}]),r}(y.PureComponent);Bi.displayName="Animate";Bi.defaultProps={begin:0,duration:1e3,from:"",to:"",attributeName:"",easing:"ease",isActive:!0,canBegin:!0,steps:[],onAnimationEnd:function(){},onAnimationStart:function(){}};Bi.propTypes={from:dt.oneOfType([dt.object,dt.string]),to:dt.oneOfType([dt.object,dt.string]),attributeName:dt.string,duration:dt.number,begin:dt.number,easing:dt.oneOfType([dt.string,dt.func]),steps:dt.arrayOf(dt.shape({duration:dt.number.isRequired,style:dt.object.isRequired,easing:dt.oneOfType([dt.oneOf(["ease","ease-in","ease-out","ease-in-out","linear"]),dt.func]),properties:dt.arrayOf("string"),onAnimationEnd:dt.func})),children:dt.oneOfType([dt.node,dt.func]),isActive:dt.bool,canBegin:dt.bool,onAnimationEnd:dt.func,shouldReAnimate:dt.bool,onAnimationStart:dt.func,onAnimationReStart:dt.func};function Jm(e){"@babel/helpers - typeof";return Jm=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Jm(e)}function $x(){return $x=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},$x.apply(this,arguments)}function tPe(e,t){return sPe(e)||aPe(e,t)||nPe(e,t)||rPe()}function rPe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
928In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function nPe(e,t){if(e){if(typeof e=="string")return YM(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return YM(e,t)}}function YM(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function aPe(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,s,i,o,l=[],c=!0,u=!1;try{if(i=(r=r.call(e)).next,t!==0)for(;!(c=(n=i.call(r)).done)&&(l.push(n.value),l.length!==t);c=!0);}catch(h){u=!0,s=h}finally{try{if(!c&&r.return!=null&&(o=r.return(),Object(o)!==o))return}finally{if(u)throw s}}return l}}function sPe(e){if(Array.isArray(e))return e}function XM(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function QM(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?XM(Object(r),!0).forEach(function(n){iPe(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):XM(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function iPe(e,t,r){return t=oPe(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function oPe(e){var t=lPe(e,"string");return Jm(t)=="symbol"?t:t+""}function lPe(e,t){if(Jm(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(Jm(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var JM=function(t,r,n,s,i){var o=Math.min(Math.abs(n)/2,Math.abs(s)/2),l=s>=0?1:-1,c=n>=0?1:-1,u=s>=0&&n>=0||s<0&&n<0?1:0,h;if(o>0&&i instanceof Array){for(var d=[0,0,0,0],f=0,m=4;f<m;f++)d[f]=i[f]>o?o:i[f];h="M".concat(t,",").concat(r+l*d[0]),d[0]>0&&(h+="A ".concat(d[0],",").concat(d[0],",0,0,").concat(u,",").concat(t+c*d[0],",").concat(r)),h+="L ".concat(t+n-c*d[1],",").concat(r),d[1]>0&&(h+="A ".concat(d[1],",").concat(d[1],",0,0,").concat(u,`,
929        `).concat(t+n,",").concat(r+l*d[1])),h+="L ".concat(t+n,",").concat(r+s-l*d[2]),d[2]>0&&(h+="A ".concat(d[2],",").concat(d[2],",0,0,").concat(u,`,
930        `).concat(t+n-c*d[2],",").concat(r+s)),h+="L ".concat(t+c*d[3],",").concat(r+s),d[3]>0&&(h+="A ".concat(d[3],",").concat(d[3],",0,0,").concat(u,`,
931        `).concat(t,",").concat(r+s-l*d[3])),h+="Z"}else if(o>0&&i===+i&&i>0){var g=Math.min(o,i);h="M ".concat(t,",").concat(r+l*g,`
932            A `).concat(g,",").concat(g,",0,0,").concat(u,",").concat(t+c*g,",").concat(r,`
933            L `).concat(t+n-c*g,",").concat(r,`
934            A `).concat(g,",").concat(g,",0,0,").concat(u,",").concat(t+n,",").concat(r+l*g,`
935            L `).concat(t+n,",").concat(r+s-l*g,`
936            A `).concat(g,",").concat(g,",0,0,").concat(u,",").concat(t+n-c*g,",").concat(r+s,`
937            L `).concat(t+c*g,",").concat(r+s,`
938            A `).concat(g,",").concat(g,",0,0,").concat(u,",").concat(t,",").concat(r+s-l*g," Z")}else h="M ".concat(t,",").concat(r," h ").concat(n," v ").concat(s," h ").concat(-n," Z");return h},cPe=function(t,r){if(!t||!r)return!1;var n=t.x,s=t.y,i=r.x,o=r.y,l=r.width,c=r.height;if(Math.abs(l)>0&&Math.abs(c)>0){var u=Math.min(i,i+l),h=Math.max(i,i+l),d=Math.min(o,o+c),f=Math.max(o,o+c);return n>=u&&n<=h&&s>=d&&s<=f}return!1},uPe={x:0,y:0,width:0,height:0,radius:0,isAnimationActive:!1,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},vE=function(t){var r=QM(QM({},uPe),t),n=y.useRef(),s=y.useState(-1),i=tPe(s,2),o=i[0],l=i[1];y.useEffect(function(){if(n.current&&n.current.getTotalLength)try{var j=n.current.getTotalLength();j&&l(j)}catch{}},[]);var c=r.x,u=r.y,h=r.width,d=r.height,f=r.radius,m=r.className,g=r.animationEasing,p=r.animationDuration,v=r.animationBegin,x=r.isAnimationActive,b=r.isUpdateAnimationActive;if(c!==+c||u!==+u||h!==+h||d!==+d||h===0||d===0)return null;var w=nt("recharts-rectangle",m);return b?J.createElement(Bi,{canBegin:o>0,from:{width:h,height:d,x:c,y:u},to:{width:h,height:d,x:c,y:u},duration:p,animationEasing:g,isActive:b},function(j){var _=j.width,S=j.height,k=j.x,P=j.y;return J.createElement(Bi,{canBegin:o>0,from:"0px ".concat(o===-1?1:o,"px"),to:"".concat(o,"px 0px"),attributeName:"strokeDasharray",begin:v,duration:p,isActive:x,easing:g},J.createElement("path",$x({},rt(r,!0),{className:w,d:JM(k,P,_,S,f),ref:n})))}):J.createElement("path",$x({},rt(r,!0),{className:w,d:JM(c,u,h,d,f)}))};function aN(){return aN=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},aN.apply(this,arguments)}var xE=function(t){var r=t.cx,n=t.cy,s=t.r,i=t.className,o=nt("recharts-dot",i);return r===+r&&n===+n&&s===+s?y.createElement("circle",aN({},rt(t,!1),Jv(t),{className:o,cx:r,cy:n,r:s})):null};function Zm(e){"@babel/helpers - typeof";return Zm=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Zm(e)}var dPe=["x","y","top","left","width","height","className"];function sN(){return sN=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},sN.apply(this,arguments)}function ZM(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function hPe(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?ZM(Object(r),!0).forEach(function(n){fPe(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ZM(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function fPe(e,t,r){return t=mPe(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function mPe(e){var t=pPe(e,"string");return Zm(t)=="symbol"?t:t+""}function pPe(e,t){if(Zm(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(Zm(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function gPe(e,t){if(e==null)return{};var r=yPe(e,t),n,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(s=0;s<i.length;s++)n=i[s],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function yPe(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}var vPe=function(t,r,n,s,i,o){return"M".concat(t,",").concat(i,"v").concat(s,"M").concat(o,",").concat(r,"h").concat(n)},xPe=function(t){var r=t.x,n=r===void 0?0:r,s=t.y,i=s===void 0?0:s,o=t.top,l=o===void 0?0:o,c=t.left,u=c===void 0?0:c,h=t.width,d=h===void 0?0:h,f=t.height,m=f===void 0?0:f,g=t.className,p=gPe(t,dPe),v=hPe({x:n,y:i,top:l,left:u,width:d,height:m},p);return!Ne(n)||!Ne(i)||!Ne(d)||!Ne(m)||!Ne(l)||!Ne(u)?null:J.createElement("path",sN({},rt(v,!0),{className:nt("recharts-cross",g),d:vPe(n,i,d,m,l,u)}))},bPe=KU,wPe=bPe(Object.getPrototypeOf,Object),jPe=wPe,_Pe=Ki,SPe=jPe,NPe=Yi,kPe="[object Object]",CPe=Function.prototype,EPe=Object.prototype,R9=CPe.toString,TPe=EPe.hasOwnProperty,APe=R9.call(Object);function PPe(e){if(!NPe(e)||_Pe(e)!=kPe)return!1;var t=SPe(e);if(t===null)return!0;var r=TPe.call(t,"constructor")&&t.constructor;return typeof r=="function"&&r instanceof r&&R9.call(r)==APe}var OPe=PPe;const MPe=mt(OPe);var RPe=Ki,$Pe=Yi,IPe="[object Boolean]";function DPe(e){return e===!0||e===!1||$Pe(e)&&RPe(e)==IPe}var LPe=DPe;const FPe=mt(LPe);function ep(e){"@babel/helpers - typeof";return ep=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ep(e)}function Ix(){return Ix=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Ix.apply(this,arguments)}function zPe(e,t){return VPe(e)||WPe(e,t)||UPe(e,t)||BPe()}function BPe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
939In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function UPe(e,t){if(e){if(typeof e=="string")return e3(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return e3(e,t)}}function e3(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function WPe(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,s,i,o,l=[],c=!0,u=!1;try{if(i=(r=r.call(e)).next,t!==0)for(;!(c=(n=i.call(r)).done)&&(l.push(n.value),l.length!==t);c=!0);}catch(h){u=!0,s=h}finally{try{if(!c&&r.return!=null&&(o=r.return(),Object(o)!==o))return}finally{if(u)throw s}}return l}}function VPe(e){if(Array.isArray(e))return e}function t3(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function r3(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?t3(Object(r),!0).forEach(function(n){HPe(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):t3(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function HPe(e,t,r){return t=qPe(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function qPe(e){var t=GPe(e,"string");return ep(t)=="symbol"?t:t+""}function GPe(e,t){if(ep(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(ep(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var n3=function(t,r,n,s,i){var o=n-s,l;return l="M ".concat(t,",").concat(r),l+="L ".concat(t+n,",").concat(r),l+="L ".concat(t+n-o/2,",").concat(r+i),l+="L ".concat(t+n-o/2-s,",").concat(r+i),l+="L ".concat(t,",").concat(r," Z"),l},KPe={x:0,y:0,upperWidth:0,lowerWidth:0,height:0,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},YPe=function(t){var r=r3(r3({},KPe),t),n=y.useRef(),s=y.useState(-1),i=zPe(s,2),o=i[0],l=i[1];y.useEffect(function(){if(n.current&&n.current.getTotalLength)try{var w=n.current.getTotalLength();w&&l(w)}catch{}},[]);var c=r.x,u=r.y,h=r.upperWidth,d=r.lowerWidth,f=r.height,m=r.className,g=r.animationEasing,p=r.animationDuration,v=r.animationBegin,x=r.isUpdateAnimationActive;if(c!==+c||u!==+u||h!==+h||d!==+d||f!==+f||h===0&&d===0||f===0)return null;var b=nt("recharts-trapezoid",m);return x?J.createElement(Bi,{canBegin:o>0,from:{upperWidth:0,lowerWidth:0,height:f,x:c,y:u},to:{upperWidth:h,lowerWidth:d,height:f,x:c,y:u},duration:p,animationEasing:g,isActive:x},function(w){var j=w.upperWidth,_=w.lowerWidth,S=w.height,k=w.x,P=w.y;return J.createElement(Bi,{canBegin:o>0,from:"0px ".concat(o===-1?1:o,"px"),to:"".concat(o,"px 0px"),attributeName:"strokeDasharray",begin:v,duration:p,easing:g},J.createElement("path",Ix({},rt(r,!0),{className:b,d:n3(k,P,j,_,S),ref:n})))}):J.createElement("g",null,J.createElement("path",Ix({},rt(r,!0),{className:b,d:n3(c,u,h,d,f)})))},XPe=["option","shapeType","propTransformer","activeClassName","isActive"];function tp(e){"@babel/helpers - typeof";return tp=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},tp(e)}function QPe(e,t){if(e==null)return{};var r=JPe(e,t),n,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(s=0;s<i.length;s++)n=i[s],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function JPe(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function a3(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function Dx(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?a3(Object(r),!0).forEach(function(n){ZPe(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):a3(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function ZPe(e,t,r){return t=eOe(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function eOe(e){var t=tOe(e,"string");return tp(t)=="symbol"?t:t+""}function tOe(e,t){if(tp(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(tp(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function rOe(e,t){return Dx(Dx({},t),e)}function nOe(e,t){return e==="symbols"}function s3(e){var t=e.shapeType,r=e.elementProps;switch(t){case"rectangle":return J.createElement(vE,r);case"trapezoid":return J.createElement(YPe,r);case"sector":return J.createElement(_9,r);case"symbols":if(nOe(t))return J.createElement(DC,r);break;default:return null}}function aOe(e){return y.isValidElement(e)?e.props:e}function sOe(e){var t=e.option,r=e.shapeType,n=e.propTransformer,s=n===void 0?rOe:n,i=e.activeClassName,o=i===void 0?"recharts-active-shape":i,l=e.isActive,c=QPe(e,XPe),u;if(y.isValidElement(t))u=y.cloneElement(t,Dx(Dx({},c),aOe(t)));else if(Qe(t))u=t(c);else if(MPe(t)&&!FPe(t)){var h=s(t,c);u=J.createElement(s3,{shapeType:r,elementProps:h})}else{var d=c;u=J.createElement(s3,{shapeType:r,elementProps:d})}return l?J.createElement(rr,{className:o},u):u}function Zb(e,t){return t!=null&&"trapezoids"in e.props}function ew(e,t){return t!=null&&"sectors"in e.props}function rp(e,t){return t!=null&&"points"in e.props}function iOe(e,t){var r,n,s=e.x===(t==null||(r=t.labelViewBox)===null||r===void 0?void 0:r.x)||e.x===t.x,i=e.y===(t==null||(n=t.labelViewBox)===null||n===void 0?void 0:n.y)||e.y===t.y;return s&&i}function oOe(e,t){var r=e.endAngle===t.endAngle,n=e.startAngle===t.startAngle;return r&&n}function lOe(e,t){var r=e.x===t.x,n=e.y===t.y,s=e.z===t.z;return r&&n&&s}function cOe(e,t){var r;return Zb(e,t)?r=iOe:ew(e,t)?r=oOe:rp(e,t)&&(r=lOe),r}function uOe(e,t){var r;return Zb(e,t)?r="trapezoids":ew(e,t)?r="sectors":rp(e,t)&&(r="points"),r}function dOe(e,t){if(Zb(e,t)){var r;return(r=t.tooltipPayload)===null||r===void 0||(r=r[0])===null||r===void 0||(r=r.payload)===null||r===void 0?void 0:r.payload}if(ew(e,t)){var n;return(n=t.tooltipPayload)===null||n===void 0||(n=n[0])===null||n===void 0||(n=n.payload)===null||n===void 0?void 0:n.payload}return rp(e,t)?t.payload:{}}function hOe(e){var t=e.activeTooltipItem,r=e.graphicalItem,n=e.itemData,s=uOe(r,t),i=dOe(r,t),o=n.filter(function(c,u){var h=Xb(i,c),d=r.props[s].filter(function(g){var p=cOe(r,t);return p(g,t)}),f=r.props[s].indexOf(d[d.length-1]),m=u===f;return h&&m}),l=n.indexOf(o[o.length-1]);return l}var fOe=Math.ceil,mOe=Math.max;function pOe(e,t,r,n){for(var s=-1,i=mOe(fOe((t-e)/(r||1)),0),o=Array(i);i--;)o[n?i:++s]=e,e+=r;return o}var gOe=pOe,yOe=f7,i3=1/0,vOe=17976931348623157e292;function xOe(e){if(!e)return e===0?e:0;if(e=yOe(e),e===i3||e===-i3){var t=e<0?-1:1;return t*vOe}return e===e?e:0}var $9=xOe,bOe=gOe,wOe=Bb,U1=$9;function jOe(e){return function(t,r,n){return n&&typeof n!="number"&&wOe(t,r,n)&&(r=n=void 0),t=U1(t),r===void 0?(r=t,t=0):r=U1(r),n=n===void 0?t<r?1:-1:U1(n),bOe(t,r,n,e)}}var _Oe=jOe,SOe=_Oe,NOe=SOe(),kOe=NOe;const Lx=mt(kOe);function np(e){"@babel/helpers - typeof";return np=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},np(e)}function o3(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function l3(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?o3(Object(r),!0).forEach(function(n){I9(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):o3(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function I9(e,t,r){return t=COe(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function COe(e){var t=EOe(e,"string");return np(t)=="symbol"?t:t+""}function EOe(e,t){if(np(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(np(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var TOe=["Webkit","Moz","O","ms"],AOe=function(t,r){var n=t.replace(/(\w)/,function(i){return i.toUpperCase()}),s=TOe.reduce(function(i,o){return l3(l3({},i),{},I9({},o+n,r))},{});return s[t]=r,s};function Id(e){"@babel/helpers - typeof";return Id=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Id(e)}function Fx(){return Fx=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Fx.apply(this,arguments)}function c3(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function W1(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?c3(Object(r),!0).forEach(function(n){Ln(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):c3(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function POe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function u3(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,L9(n.key),n)}}function OOe(e,t,r){return t&&u3(e.prototype,t),r&&u3(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function MOe(e,t,r){return t=zx(t),ROe(e,D9()?Reflect.construct(t,r||[],zx(e).constructor):t.apply(e,r))}function ROe(e,t){if(t&&(Id(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return $Oe(e)}function $Oe(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function D9(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(D9=function(){return!!e})()}function zx(e){return zx=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},zx(e)}function IOe(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&iN(e,t)}function iN(e,t){return iN=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,s){return n.__proto__=s,n},iN(e,t)}function Ln(e,t,r){return t=L9(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function L9(e){var t=DOe(e,"string");return Id(t)=="symbol"?t:t+""}function DOe(e,t){if(Id(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(Id(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var LOe=function(t){var r=t.data,n=t.startIndex,s=t.endIndex,i=t.x,o=t.width,l=t.travellerWidth;if(!r||!r.length)return{};var c=r.length,u=If().domain(Lx(0,c)).range([i,i+o-l]),h=u.domain().map(function(d){return u(d)});return{isTextActive:!1,isSlideMoving:!1,isTravellerMoving:!1,isTravellerFocused:!1,startX:u(n),endX:u(s),scale:u,scaleValues:h}},d3=function(t){return t.changedTouches&&!!t.changedTouches.length},Dd=function(e){function t(r){var n;return POe(this,t),n=MOe(this,t,[r]),Ln(n,"handleDrag",function(s){n.leaveTimer&&(clearTimeout(n.leaveTimer),n.leaveTimer=null),n.state.isTravellerMoving?n.handleTravellerMove(s):n.state.isSlideMoving&&n.handleSlideDrag(s)}),Ln(n,"handleTouchMove",function(s){s.changedTouches!=null&&s.changedTouches.length>0&&n.handleDrag(s.changedTouches[0])}),Ln(n,"handleDragEnd",function(){n.setState({isTravellerMoving:!1,isSlideMoving:!1},function(){var s=n.props,i=s.endIndex,o=s.onDragEnd,l=s.startIndex;o==null||o({endIndex:i,startIndex:l})}),n.detachDragEndListener()}),Ln(n,"handleLeaveWrapper",function(){(n.state.isTravellerMoving||n.state.isSlideMoving)&&(n.leaveTimer=window.setTimeout(n.handleDragEnd,n.props.leaveTimeOut))}),Ln(n,"handleEnterSlideOrTraveller",function(){n.setState({isTextActive:!0})}),Ln(n,"handleLeaveSlideOrTraveller",function(){n.setState({isTextActive:!1})}),Ln(n,"handleSlideDragStart",function(s){var i=d3(s)?s.changedTouches[0]:s;n.setState({isTravellerMoving:!1,isSlideMoving:!0,slideMoveStartX:i.pageX}),n.attachDragEndListener()}),n.travellerDragStartHandlers={startX:n.handleTravellerDragStart.bind(n,"startX"),endX:n.handleTravellerDragStart.bind(n,"endX")},n.state={},n}return IOe(t,e),OOe(t,[{key:"componentWillUnmount",value:function(){this.leaveTimer&&(clearTimeout(this.leaveTimer),this.leaveTimer=null),this.detachDragEndListener()}},{key:"getIndex",value:function(n){var s=n.startX,i=n.endX,o=this.state.scaleValues,l=this.props,c=l.gap,u=l.data,h=u.length-1,d=Math.min(s,i),f=Math.max(s,i),m=t.getIndexInRange(o,d),g=t.getIndexInRange(o,f);return{startIndex:m-m%c,endIndex:g===h?h:g-g%c}}},{key:"getTextOfTick",value:function(n){var s=this.props,i=s.data,o=s.tickFormatter,l=s.dataKey,c=Qn(i[n],l,n);return Qe(o)?o(c,n):c}},{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 s=this.state,i=s.slideMoveStartX,o=s.startX,l=s.endX,c=this.props,u=c.x,h=c.width,d=c.travellerWidth,f=c.startIndex,m=c.endIndex,g=c.onChange,p=n.pageX-i;p>0?p=Math.min(p,u+h-d-l,u+h-d-o):p<0&&(p=Math.max(p,u-o,u-l));var v=this.getIndex({startX:o+p,endX:l+p});(v.startIndex!==f||v.endIndex!==m)&&g&&g(v),this.setState({startX:o+p,endX:l+p,slideMoveStartX:n.pageX})}},{key:"handleTravellerDragStart",value:function(n,s){var i=d3(s)?s.changedTouches[0]:s;this.setState({isSlideMoving:!1,isTravellerMoving:!0,movingTravellerId:n,brushMoveStartX:i.pageX}),this.attachDragEndListener()}},{key:"handleTravellerMove",value:function(n){var s=this.state,i=s.brushMoveStartX,o=s.movingTravellerId,l=s.endX,c=s.startX,u=this.state[o],h=this.props,d=h.x,f=h.width,m=h.travellerWidth,g=h.onChange,p=h.gap,v=h.data,x={startX:this.state.startX,endX:this.state.endX},b=n.pageX-i;b>0?b=Math.min(b,d+f-m-u):b<0&&(b=Math.max(b,d-u)),x[o]=u+b;var w=this.getIndex(x),j=w.startIndex,_=w.endIndex,S=function(){var P=v.length-1;return o==="startX"&&(l>c?j%p===0:_%p===0)||l<c&&_===P||o==="endX"&&(l>c?_%p===0:j%p===0)||l>c&&_===P};this.setState(Ln(Ln({},o,u+b),"brushMoveStartX",n.pageX),function(){g&&S()&&g(w)})}},{key:"handleTravellerMoveKeyboard",value:function(n,s){var i=this,o=this.state,l=o.scaleValues,c=o.startX,u=o.endX,h=this.state[s],d=l.indexOf(h);if(d!==-1){var f=d+n;if(!(f===-1||f>=l.length)){var m=l[f];s==="startX"&&m>=u||s==="endX"&&m<=c||this.setState(Ln({},s,m),function(){i.props.onChange(i.getIndex({startX:i.state.startX,endX:i.state.endX}))})}}}},{key:"renderBackground",value:function(){var n=this.props,s=n.x,i=n.y,o=n.width,l=n.height,c=n.fill,u=n.stroke;return J.createElement("rect",{stroke:u,fill:c,x:s,y:i,width:o,height:l})}},{key:"renderPanorama",value:function(){var n=this.props,s=n.x,i=n.y,o=n.width,l=n.height,c=n.data,u=n.children,h=n.padding,d=y.Children.only(u);return d?J.cloneElement(d,{x:s,y:i,width:o,height:l,margin:h,compact:!0,data:c}):null}},{key:"renderTravellerLayer",value:function(n,s){var i,o,l=this,c=this.props,u=c.y,h=c.travellerWidth,d=c.height,f=c.traveller,m=c.ariaLabel,g=c.data,p=c.startIndex,v=c.endIndex,x=Math.max(n,this.props.x),b=W1(W1({},rt(this.props,!1)),{},{x,y:u,width:h,height:d}),w=m||"Min value: ".concat((i=g[p])===null||i===void 0?void 0:i.name,", Max value: ").concat((o=g[v])===null||o===void 0?void 0:o.name);return J.createElement(rr,{tabIndex:0,role:"slider","aria-label":w,"aria-valuenow":n,className:"recharts-brush-traveller",onMouseEnter:this.handleEnterSlideOrTraveller,onMouseLeave:this.handleLeaveSlideOrTraveller,onMouseDown:this.travellerDragStartHandlers[s],onTouchStart:this.travellerDragStartHandlers[s],onKeyDown:function(_){["ArrowLeft","ArrowRight"].includes(_.key)&&(_.preventDefault(),_.stopPropagation(),l.handleTravellerMoveKeyboard(_.key==="ArrowRight"?1:-1,s))},onFocus:function(){l.setState({isTravellerFocused:!0})},onBlur:function(){l.setState({isTravellerFocused:!1})},style:{cursor:"col-resize"}},t.renderTraveller(f,b))}},{key:"renderSlide",value:function(n,s){var i=this.props,o=i.y,l=i.height,c=i.stroke,u=i.travellerWidth,h=Math.min(n,s)+u,d=Math.max(Math.abs(s-n)-u,0);return J.createElement("rect",{className:"recharts-brush-slide",onMouseEnter:this.handleEnterSlideOrTraveller,onMouseLeave:this.handleLeaveSlideOrTraveller,onMouseDown:this.handleSlideDragStart,onTouchStart:this.handleSlideDragStart,style:{cursor:"move"},stroke:"none",fill:c,fillOpacity:.2,x:h,y:o,width:d,height:l})}},{key:"renderText",value:function(){var n=this.props,s=n.startIndex,i=n.endIndex,o=n.y,l=n.height,c=n.travellerWidth,u=n.stroke,h=this.state,d=h.startX,f=h.endX,m=5,g={pointerEvents:"none",fill:u};return J.createElement(rr,{className:"recharts-brush-texts"},J.createElement(fx,Fx({textAnchor:"end",verticalAnchor:"middle",x:Math.min(d,f)-m,y:o+l/2},g),this.getTextOfTick(s)),J.createElement(fx,Fx({textAnchor:"start",verticalAnchor:"middle",x:Math.max(d,f)+c+m,y:o+l/2},g),this.getTextOfTick(i)))}},{key:"render",value:function(){var n=this.props,s=n.data,i=n.className,o=n.children,l=n.x,c=n.y,u=n.width,h=n.height,d=n.alwaysShowText,f=this.state,m=f.startX,g=f.endX,p=f.isTextActive,v=f.isSlideMoving,x=f.isTravellerMoving,b=f.isTravellerFocused;if(!s||!s.length||!Ne(l)||!Ne(c)||!Ne(u)||!Ne(h)||u<=0||h<=0)return null;var w=nt("recharts-brush",i),j=J.Children.count(o)===1,_=AOe("userSelect","none");return J.createElement(rr,{className:w,onMouseLeave:this.handleLeaveWrapper,onTouchMove:this.handleTouchMove,style:_},this.renderBackground(),j&&this.renderPanorama(),this.renderSlide(m,g),this.renderTravellerLayer(m,"startX"),this.renderTravellerLayer(g,"endX"),(p||v||x||b||d)&&this.renderText())}}],[{key:"renderDefaultTraveller",value:function(n){var s=n.x,i=n.y,o=n.width,l=n.height,c=n.stroke,u=Math.floor(i+l/2)-1;return J.createElement(J.Fragment,null,J.createElement("rect",{x:s,y:i,width:o,height:l,fill:c,stroke:"none"}),J.createElement("line",{x1:s+1,y1:u,x2:s+o-1,y2:u,fill:"none",stroke:"#fff"}),J.createElement("line",{x1:s+1,y1:u+2,x2:s+o-1,y2:u+2,fill:"none",stroke:"#fff"}))}},{key:"renderTraveller",value:function(n,s){var i;return J.isValidElement(n)?i=J.cloneElement(n,s):Qe(n)?i=n(s):i=t.renderDefaultTraveller(s),i}},{key:"getDerivedStateFromProps",value:function(n,s){var i=n.data,o=n.width,l=n.x,c=n.travellerWidth,u=n.updateId,h=n.startIndex,d=n.endIndex;if(i!==s.prevData||u!==s.prevUpdateId)return W1({prevData:i,prevTravellerWidth:c,prevUpdateId:u,prevX:l,prevWidth:o},i&&i.length?LOe({data:i,width:o,x:l,travellerWidth:c,startIndex:h,endIndex:d}):{scale:null,scaleValues:null});if(s.scale&&(o!==s.prevWidth||l!==s.prevX||c!==s.prevTravellerWidth)){s.scale.range([l,l+o-c]);var f=s.scale.domain().map(function(m){return s.scale(m)});return{prevData:i,prevTravellerWidth:c,prevUpdateId:u,prevX:l,prevWidth:o,startX:s.scale(n.startIndex),endX:s.scale(n.endIndex),scaleValues:f}}return null}},{key:"getIndexInRange",value:function(n,s){for(var i=n.length,o=0,l=i-1;l-o>1;){var c=Math.floor((o+l)/2);n[c]>s?l=c:o=c}return s>=n[l]?l:o}}])}(y.PureComponent);Ln(Dd,"displayName","Brush");Ln(Dd,"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 FOe=VC;function zOe(e,t){var r;return FOe(e,function(n,s,i){return r=t(n,s,i),!r}),!!r}var BOe=zOe,UOe=zU,WOe=dl,VOe=BOe,HOe=On,qOe=Bb;function GOe(e,t,r){var n=HOe(e)?UOe:VOe;return r&&qOe(e,t,r)&&(t=void 0),n(e,WOe(t))}var KOe=GOe;const YOe=mt(KOe);var Gs=function(t,r){var n=t.alwaysShow,s=t.ifOverflow;return n&&(s="extendDomain"),s===r},h3=l7;function XOe(e,t,r){t=="__proto__"&&h3?h3(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r}var QOe=XOe,JOe=QOe,ZOe=i7,e5e=dl;function t5e(e,t){var r={};return t=e5e(t),ZOe(e,function(n,s,i){JOe(r,s,t(n,s,i))}),r}var r5e=t5e;const n5e=mt(r5e);function a5e(e,t){for(var r=-1,n=e==null?0:e.length;++r<n;)if(!t(e[r],r,e))return!1;return!0}var s5e=a5e,i5e=VC;function o5e(e,t){var r=!0;return i5e(e,function(n,s,i){return r=!!t(n,s,i),r}),r}var l5e=o5e,c5e=s5e,u5e=l5e,d5e=dl,h5e=On,f5e=Bb;function m5e(e,t,r){var n=h5e(e)?c5e:u5e;return r&&f5e(e,t,r)&&(t=void 0),n(e,d5e(t))}var p5e=m5e;const F9=mt(p5e);var g5e=["x","y"];function ap(e){"@babel/helpers - typeof";return ap=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ap(e)}function oN(){return oN=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},oN.apply(this,arguments)}function f3(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function Jh(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?f3(Object(r),!0).forEach(function(n){y5e(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):f3(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function y5e(e,t,r){return t=v5e(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function v5e(e){var t=x5e(e,"string");return ap(t)=="symbol"?t:t+""}function x5e(e,t){if(ap(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(ap(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function b5e(e,t){if(e==null)return{};var r=w5e(e,t),n,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(s=0;s<i.length;s++)n=i[s],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function w5e(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function j5e(e,t){var r=e.x,n=e.y,s=b5e(e,g5e),i="".concat(r),o=parseInt(i,10),l="".concat(n),c=parseInt(l,10),u="".concat(t.height||s.height),h=parseInt(u,10),d="".concat(t.width||s.width),f=parseInt(d,10);return Jh(Jh(Jh(Jh(Jh({},t),s),o?{x:o}:{}),c?{y:c}:{}),{},{height:h,width:f,name:t.name,radius:t.radius})}function m3(e){return J.createElement(sOe,oN({shapeType:"rectangle",propTransformer:j5e,activeClassName:"recharts-active-bar"},e))}var _5e=function(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return function(n,s){if(typeof t=="number")return t;var i=Ne(n)||Ipe(n);return i?t(n,s):(i||yc(),r)}},S5e=["value","background"],z9;function Ld(e){"@babel/helpers - typeof";return Ld=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ld(e)}function N5e(e,t){if(e==null)return{};var r=k5e(e,t),n,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(s=0;s<i.length;s++)n=i[s],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function k5e(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function Bx(){return Bx=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Bx.apply(this,arguments)}function p3(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function ar(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?p3(Object(r),!0).forEach(function(n){Oo(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):p3(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function C5e(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function g3(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,U9(n.key),n)}}function E5e(e,t,r){return t&&g3(e.prototype,t),r&&g3(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function T5e(e,t,r){return t=Ux(t),A5e(e,B9()?Reflect.construct(t,r||[],Ux(e).constructor):t.apply(e,r))}function A5e(e,t){if(t&&(Ld(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return P5e(e)}function P5e(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function B9(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(B9=function(){return!!e})()}function Ux(e){return Ux=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Ux(e)}function O5e(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&lN(e,t)}function lN(e,t){return lN=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,s){return n.__proto__=s,n},lN(e,t)}function Oo(e,t,r){return t=U9(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function U9(e){var t=M5e(e,"string");return Ld(t)=="symbol"?t:t+""}function M5e(e,t){if(Ld(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(Ld(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var Ui=function(e){function t(){var r;C5e(this,t);for(var n=arguments.length,s=new Array(n),i=0;i<n;i++)s[i]=arguments[i];return r=T5e(this,t,[].concat(s)),Oo(r,"state",{isAnimationFinished:!1}),Oo(r,"id",Vp("recharts-bar-")),Oo(r,"handleAnimationEnd",function(){var o=r.props.onAnimationEnd;r.setState({isAnimationFinished:!0}),o&&o()}),Oo(r,"handleAnimationStart",function(){var o=r.props.onAnimationStart;r.setState({isAnimationFinished:!1}),o&&o()}),r}return O5e(t,e),E5e(t,[{key:"renderRectanglesStatically",value:function(n){var s=this,i=this.props,o=i.shape,l=i.dataKey,c=i.activeIndex,u=i.activeBar,h=rt(this.props,!1);return n&&n.map(function(d,f){var m=f===c,g=m?u:o,p=ar(ar(ar({},h),d),{},{isActive:m,option:g,index:f,dataKey:l,onAnimationStart:s.handleAnimationStart,onAnimationEnd:s.handleAnimationEnd});return J.createElement(rr,Bx({className:"recharts-bar-rectangle"},Zv(s.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)}),J.createElement(m3,p))})}},{key:"renderRectanglesWithAnimation",value:function(){var n=this,s=this.props,i=s.data,o=s.layout,l=s.isAnimationActive,c=s.animationBegin,u=s.animationDuration,h=s.animationEasing,d=s.animationId,f=this.state.prevData;return J.createElement(Bi,{begin:c,duration:u,isActive:l,easing:h,from:{t:0},to:{t:1},key:"bar-".concat(d),onAnimationEnd:this.handleAnimationEnd,onAnimationStart:this.handleAnimationStart},function(m){var g=m.t,p=i.map(function(v,x){var b=f&&f[x];if(b){var w=Ka(b.x,v.x),j=Ka(b.y,v.y),_=Ka(b.width,v.width),S=Ka(b.height,v.height);return ar(ar({},v),{},{x:w(g),y:j(g),width:_(g),height:S(g)})}if(o==="horizontal"){var k=Ka(0,v.height),P=k(g);return ar(ar({},v),{},{y:v.y+v.height-P,height:P})}var C=Ka(0,v.width),M=C(g);return ar(ar({},v),{},{width:M})});return J.createElement(rr,null,n.renderRectanglesStatically(p))})}},{key:"renderRectangles",value:function(){var n=this.props,s=n.data,i=n.isAnimationActive,o=this.state.prevData;return i&&s&&s.length&&(!o||!Xb(o,s))?this.renderRectanglesWithAnimation():this.renderRectanglesStatically(s)}},{key:"renderBackground",value:function(){var n=this,s=this.props,i=s.data,o=s.dataKey,l=s.activeIndex,c=rt(this.props.background,!1);return i.map(function(u,h){u.value;var d=u.background,f=N5e(u,S5e);if(!d)return null;var m=ar(ar(ar(ar(ar({},f),{},{fill:"#eee"},d),c),Zv(n.props,u,h)),{},{onAnimationStart:n.handleAnimationStart,onAnimationEnd:n.handleAnimationEnd,dataKey:o,index:h,className:"recharts-bar-background-rectangle"});return J.createElement(m3,Bx({key:"background-bar-".concat(h),option:n.props.background,isActive:h===l},m))})}},{key:"renderErrorBar",value:function(n,s){if(this.props.isAnimationActive&&!this.state.isAnimationFinished)return null;var i=this.props,o=i.data,l=i.xAxis,c=i.yAxis,u=i.layout,h=i.children,d=ya(h,Xp);if(!d)return null;var f=u==="vertical"?o[0].height/2:o[0].width/2,m=function(v,x){var b=Array.isArray(v.value)?v.value[1]:v.value;return{x:v.x,y:v.y,value:b,errorVal:Qn(v,x)}},g={clipPath:n?"url(#clipPath-".concat(s,")"):null};return J.createElement(rr,g,d.map(function(p){return J.cloneElement(p,{key:"error-bar-".concat(s,"-").concat(p.props.dataKey),data:o,xAxis:l,yAxis:c,layout:u,offset:f,dataPointFormatter:m})}))}},{key:"render",value:function(){var n=this.props,s=n.hide,i=n.data,o=n.className,l=n.xAxis,c=n.yAxis,u=n.left,h=n.top,d=n.width,f=n.height,m=n.isAnimationActive,g=n.background,p=n.id;if(s||!i||!i.length)return null;var v=this.state.isAnimationFinished,x=nt("recharts-bar",o),b=l&&l.allowDataOverflow,w=c&&c.allowDataOverflow,j=b||w,_=Ze(p)?this.id:p;return J.createElement(rr,{className:x},b||w?J.createElement("defs",null,J.createElement("clipPath",{id:"clipPath-".concat(_)},J.createElement("rect",{x:b?u:u-d/2,y:w?h:h-f/2,width:b?d:d*2,height:w?f:f*2}))):null,J.createElement(rr,{className:"recharts-bar-rectangles",clipPath:j?"url(#clipPath-".concat(_,")"):null},g?this.renderBackground():null,this.renderRectangles()),this.renderErrorBar(j,_),(!m||v)&&Ho.renderCallByParent(this.props,i))}}],[{key:"getDerivedStateFromProps",value:function(n,s){return n.animationId!==s.prevAnimationId?{prevAnimationId:n.animationId,curData:n.data,prevData:s.curData}:n.data!==s.curData?{curData:n.data}:null}}])}(y.PureComponent);z9=Ui;Oo(Ui,"displayName","Bar");Oo(Ui,"defaultProps",{xAxisId:0,yAxisId:0,legendType:"rect",minPointSize:0,hide:!1,data:[],layout:"vertical",activeBar:!1,isAnimationActive:!wh.isSsr,animationBegin:0,animationDuration:400,animationEasing:"ease"});Oo(Ui,"getComposedData",function(e){var t=e.props,r=e.item,n=e.barPosition,s=e.bandSize,i=e.xAxis,o=e.yAxis,l=e.xAxisTicks,c=e.yAxisTicks,u=e.stackedData,h=e.dataStartIndex,d=e.displayedData,f=e.offset,m=sEe(n,r);if(!m)return null;var g=t.layout,p=r.type.defaultProps,v=p!==void 0?ar(ar({},p),r.props):r.props,x=v.dataKey,b=v.children,w=v.minPointSize,j=g==="horizontal"?o:i,_=u?j.scale.domain():null,S=fEe({numericAxis:j}),k=ya(b,p7),P=d.map(function(C,M){var I,E,B,A,L,W;u?I=iEe(u[h+M],_):(I=Qn(C,x),Array.isArray(I)||(I=[S,I]));var D=_5e(w,z9.defaultProps.minPointSize)(I[1],M);if(g==="horizontal"){var U,R=[o.scale(I[0]),o.scale(I[1])],Q=R[0],K=R[1];E=vM({axis:i,ticks:l,bandSize:s,offset:m.offset,entry:C,index:M}),B=(U=K??Q)!==null&&U!==void 0?U:void 0,A=m.size;var z=Q-K;if(L=Number.isNaN(z)?0:z,W={x:E,y:o.y,width:A,height:o.height},Math.abs(D)>0&&Math.abs(L)<Math.abs(D)){var N=Ja(L||D)*(Math.abs(D)-Math.abs(L));B-=N,L+=N}}else{var T=[i.scale(I[0]),i.scale(I[1])],$=T[0],V=T[1];if(E=$,B=vM({axis:o,ticks:c,bandSize:s,offset:m.offset,entry:C,index:M}),A=V-$,L=m.size,W={x:i.x,y:B,width:i.width,height:L},Math.abs(D)>0&&Math.abs(A)<Math.abs(D)){var q=Ja(A||D)*(Math.abs(D)-Math.abs(A));A+=q}}return ar(ar(ar({},C),{},{x:E,y:B,width:A,height:L,value:u?I:I[1],payload:C,background:W},k&&k[M]&&k[M].props),{},{tooltipPayload:[b9(r,C)],tooltipPosition:{x:E+A/2,y:B+L/2}})});return ar({data:P,layout:g},f)});function sp(e){"@babel/helpers - typeof";return sp=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},sp(e)}function R5e(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function y3(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,W9(n.key),n)}}function $5e(e,t,r){return t&&y3(e.prototype,t),r&&y3(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function v3(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function Ha(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?v3(Object(r),!0).forEach(function(n){tw(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):v3(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function tw(e,t,r){return t=W9(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function W9(e){var t=I5e(e,"string");return sp(t)=="symbol"?t:t+""}function I5e(e,t){if(sp(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(sp(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var V9=function(t,r,n,s,i){var o=t.width,l=t.height,c=t.layout,u=t.children,h=Object.keys(r),d={left:n.left,leftMirror:n.left,right:o-n.right,rightMirror:o-n.right,top:n.top,topMirror:n.top,bottom:l-n.bottom,bottomMirror:l-n.bottom},f=!!zn(u,Ui);return h.reduce(function(m,g){var p=r[g],v=p.orientation,x=p.domain,b=p.padding,w=b===void 0?{}:b,j=p.mirror,_=p.reversed,S="".concat(v).concat(j?"Mirror":""),k,P,C,M,I;if(p.type==="number"&&(p.padding==="gap"||p.padding==="no-gap")){var E=x[1]-x[0],B=1/0,A=p.categoricalDomain.sort(Fpe);if(A.forEach(function(T,$){$>0&&(B=Math.min((T||0)-(A[$-1]||0),B))}),Number.isFinite(B)){var L=B/E,W=p.layout==="vertical"?n.height:n.width;if(p.padding==="gap"&&(k=L*W/2),p.padding==="no-gap"){var D=pc(t.barCategoryGap,L*W),U=L*W/2;k=U-D-(U-D)/W*D}}}s==="xAxis"?P=[n.left+(w.left||0)+(k||0),n.left+n.width-(w.right||0)-(k||0)]:s==="yAxis"?P=c==="horizontal"?[n.top+n.height-(w.bottom||0),n.top+(w.top||0)]:[n.top+(w.top||0)+(k||0),n.top+n.height-(w.bottom||0)-(k||0)]:P=p.range,_&&(P=[P[1],P[0]]);var R=nEe(p,i,f),Q=R.scale,K=R.realScaleType;Q.domain(x).range(P),aEe(Q);var z=hEe(Q,Ha(Ha({},p),{},{realScaleType:K}));s==="xAxis"?(I=v==="top"&&!j||v==="bottom"&&j,C=n.left,M=d[S]-I*p.height):s==="yAxis"&&(I=v==="left"&&!j||v==="right"&&j,C=d[S]-I*p.width,M=n.top);var N=Ha(Ha(Ha({},p),z),{},{realScaleType:K,x:C,y:M,scale:Q,width:s==="xAxis"?n.width:p.width,height:s==="yAxis"?n.height:p.height});return N.bandSize=Ex(N,z),!p.hide&&s==="xAxis"?d[S]+=(I?-1:1)*N.height:p.hide||(d[S]+=(I?-1:1)*N.width),Ha(Ha({},m),{},tw({},g,N))},{})},H9=function(t,r){var n=t.x,s=t.y,i=r.x,o=r.y;return{x:Math.min(n,i),y:Math.min(s,o),width:Math.abs(i-n),height:Math.abs(o-s)}},D5e=function(t){var r=t.x1,n=t.y1,s=t.x2,i=t.y2;return H9({x:r,y:n},{x:s,y:i})},q9=function(){function e(t){R5e(this,e),this.scale=t}return $5e(e,[{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]:{},s=n.bandAware,i=n.position;if(r!==void 0){if(i)switch(i){case"start":return this.scale(r);case"middle":{var o=this.bandwidth?this.bandwidth()/2:0;return this.scale(r)+o}case"end":{var l=this.bandwidth?this.bandwidth():0;return this.scale(r)+l}default:return this.scale(r)}if(s){var c=this.bandwidth?this.bandwidth()/2:0;return this.scale(r)+c}return this.scale(r)}}},{key:"isInRange",value:function(r){var n=this.range(),s=n[0],i=n[n.length-1];return s<=i?r>=s&&r<=i:r>=i&&r<=s}}],[{key:"create",value:function(r){return new e(r)}}])}();tw(q9,"EPS",1e-4);var bE=function(t){var r=Object.keys(t).reduce(function(n,s){return Ha(Ha({},n),{},tw({},s,q9.create(t[s])))},{});return Ha(Ha({},r),{},{apply:function(s){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},o=i.bandAware,l=i.position;return n5e(s,function(c,u){return r[u].apply(c,{bandAware:o,position:l})})},isInRange:function(s){return F9(s,function(i,o){return r[o].isInRange(i)})}})};function L5e(e){return(e%180+180)%180}var F5e=function(t){var r=t.width,n=t.height,s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,i=L5e(s),o=i*Math.PI/180,l=Math.atan(n/r),c=o>l&&o<Math.PI-l?n/Math.sin(o):r/Math.cos(o);return Math.abs(c)},z5e=dl,B5e=Hp,U5e=Fb;function W5e(e){return function(t,r,n){var s=Object(t);if(!B5e(t)){var i=z5e(r);t=U5e(t),r=function(l){return i(s[l],l,s)}}var o=e(t,r,n);return o>-1?s[i?t[o]:o]:void 0}}var V5e=W5e,H5e=$9;function q5e(e){var t=H5e(e),r=t%1;return t===t?r?t-r:t:0}var G5e=q5e,K5e=e7,Y5e=dl,X5e=G5e,Q5e=Math.max;function J5e(e,t,r){var n=e==null?0:e.length;if(!n)return-1;var s=r==null?0:X5e(r);return s<0&&(s=Q5e(n+s,0)),K5e(e,Y5e(t),s)}var Z5e=J5e,eMe=V5e,tMe=Z5e,rMe=eMe(tMe),nMe=rMe;const aMe=mt(nMe);var sMe=Ume(function(e){return{x:e.left,y:e.top,width:e.width,height:e.height}},function(e){return["l",e.left,"t",e.top,"w",e.width,"h",e.height].join("")}),wE=y.createContext(void 0),jE=y.createContext(void 0),G9=y.createContext(void 0),K9=y.createContext({}),Y9=y.createContext(void 0),X9=y.createContext(0),Q9=y.createContext(0),x3=function(t){var r=t.state,n=r.xAxisMap,s=r.yAxisMap,i=r.offset,o=t.clipPathId,l=t.children,c=t.width,u=t.height,h=sMe(i);return J.createElement(wE.Provider,{value:n},J.createElement(jE.Provider,{value:s},J.createElement(K9.Provider,{value:i},J.createElement(G9.Provider,{value:h},J.createElement(Y9.Provider,{value:o},J.createElement(X9.Provider,{value:u},J.createElement(Q9.Provider,{value:c},l)))))))},iMe=function(){return y.useContext(Y9)},J9=function(t){var r=y.useContext(wE);r==null&&yc();var n=r[t];return n==null&&yc(),n},oMe=function(){var t=y.useContext(wE);return bo(t)},lMe=function(){var t=y.useContext(jE),r=aMe(t,function(n){return F9(n.domain,Number.isFinite)});return r||bo(t)},Z9=function(t){var r=y.useContext(jE);r==null&&yc();var n=r[t];return n==null&&yc(),n},cMe=function(){var t=y.useContext(G9);return t},uMe=function(){return y.useContext(K9)},_E=function(){return y.useContext(Q9)},SE=function(){return y.useContext(X9)};function Fd(e){"@babel/helpers - typeof";return Fd=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Fd(e)}function dMe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function hMe(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,tW(n.key),n)}}function fMe(e,t,r){return t&&hMe(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function mMe(e,t,r){return t=Wx(t),pMe(e,eW()?Reflect.construct(t,r||[],Wx(e).constructor):t.apply(e,r))}function pMe(e,t){if(t&&(Fd(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return gMe(e)}function gMe(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function eW(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(eW=function(){return!!e})()}function Wx(e){return Wx=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Wx(e)}function yMe(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&cN(e,t)}function cN(e,t){return cN=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,s){return n.__proto__=s,n},cN(e,t)}function b3(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function w3(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?b3(Object(r),!0).forEach(function(n){NE(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):b3(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function NE(e,t,r){return t=tW(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function tW(e){var t=vMe(e,"string");return Fd(t)=="symbol"?t:t+""}function vMe(e,t){if(Fd(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(Fd(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function xMe(e,t){return _Me(e)||jMe(e,t)||wMe(e,t)||bMe()}function bMe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
940In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function wMe(e,t){if(e){if(typeof e=="string")return j3(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return j3(e,t)}}function j3(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function jMe(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,s,i,o,l=[],c=!0,u=!1;try{if(i=(r=r.call(e)).next,t!==0)for(;!(c=(n=i.call(r)).done)&&(l.push(n.value),l.length!==t);c=!0);}catch(h){u=!0,s=h}finally{try{if(!c&&r.return!=null&&(o=r.return(),Object(o)!==o))return}finally{if(u)throw s}}return l}}function _Me(e){if(Array.isArray(e))return e}function uN(){return uN=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},uN.apply(this,arguments)}var SMe=function(t,r){var n;return J.isValidElement(t)?n=J.cloneElement(t,r):Qe(t)?n=t(r):n=J.createElement("line",uN({},r,{className:"recharts-reference-line-line"})),n},NMe=function(t,r,n,s,i,o,l,c,u){var h=i.x,d=i.y,f=i.width,m=i.height;if(n){var g=u.y,p=t.y.apply(g,{position:o});if(Gs(u,"discard")&&!t.y.isInRange(p))return null;var v=[{x:h+f,y:p},{x:h,y:p}];return c==="left"?v.reverse():v}if(r){var x=u.x,b=t.x.apply(x,{position:o});if(Gs(u,"discard")&&!t.x.isInRange(b))return null;var w=[{x:b,y:d+m},{x:b,y:d}];return l==="top"?w.reverse():w}if(s){var j=u.segment,_=j.map(function(S){return t.apply(S,{position:o})});return Gs(u,"discard")&&YOe(_,function(S){return!t.isInRange(S)})?null:_}return null};function kMe(e){var t=e.x,r=e.y,n=e.segment,s=e.xAxisId,i=e.yAxisId,o=e.shape,l=e.className,c=e.alwaysShow,u=iMe(),h=J9(s),d=Z9(i),f=cMe();if(!u||!f)return null;Ni(c===void 0,'The alwaysShow prop is deprecated. Please use ifOverflow="extendDomain" instead.');var m=bE({x:h.scale,y:d.scale}),g=pr(t),p=pr(r),v=n&&n.length===2,x=NMe(m,g,p,v,f,e.position,h.orientation,d.orientation,e);if(!x)return null;var b=xMe(x,2),w=b[0],j=w.x,_=w.y,S=b[1],k=S.x,P=S.y,C=Gs(e,"hidden")?"url(#".concat(u,")"):void 0,M=w3(w3({clipPath:C},rt(e,!0)),{},{x1:j,y1:_,x2:k,y2:P});return J.createElement(rr,{className:nt("recharts-reference-line",l)},SMe(o,M),Yr.renderCallByParent(e,D5e({x1:j,y1:_,x2:k,y2:P})))}var kE=function(e){function t(){return dMe(this,t),mMe(this,t,arguments)}return yMe(t,e),fMe(t,[{key:"render",value:function(){return J.createElement(kMe,this.props)}}])}(J.Component);NE(kE,"displayName","ReferenceLine");NE(kE,"defaultProps",{isFront:!1,ifOverflow:"discard",xAxisId:0,yAxisId:0,fill:"none",stroke:"#ccc",fillOpacity:1,strokeWidth:1,position:"middle"});function dN(){return dN=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},dN.apply(this,arguments)}function zd(e){"@babel/helpers - typeof";return zd=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},zd(e)}function _3(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function S3(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?_3(Object(r),!0).forEach(function(n){rw(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):_3(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function CMe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function EMe(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,nW(n.key),n)}}function TMe(e,t,r){return t&&EMe(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function AMe(e,t,r){return t=Vx(t),PMe(e,rW()?Reflect.construct(t,r||[],Vx(e).constructor):t.apply(e,r))}function PMe(e,t){if(t&&(zd(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return OMe(e)}function OMe(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function rW(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(rW=function(){return!!e})()}function Vx(e){return Vx=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Vx(e)}function MMe(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&hN(e,t)}function hN(e,t){return hN=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,s){return n.__proto__=s,n},hN(e,t)}function rw(e,t,r){return t=nW(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function nW(e){var t=RMe(e,"string");return zd(t)=="symbol"?t:t+""}function RMe(e,t){if(zd(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(zd(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var $Me=function(t){var r=t.x,n=t.y,s=t.xAxis,i=t.yAxis,o=bE({x:s.scale,y:i.scale}),l=o.apply({x:r,y:n},{bandAware:!0});return Gs(t,"discard")&&!o.isInRange(l)?null:l},nw=function(e){function t(){return CMe(this,t),AMe(this,t,arguments)}return MMe(t,e),TMe(t,[{key:"render",value:function(){var n=this.props,s=n.x,i=n.y,o=n.r,l=n.alwaysShow,c=n.clipPathId,u=pr(s),h=pr(i);if(Ni(l===void 0,'The alwaysShow prop is deprecated. Please use ifOverflow="extendDomain" instead.'),!u||!h)return null;var d=$Me(this.props);if(!d)return null;var f=d.x,m=d.y,g=this.props,p=g.shape,v=g.className,x=Gs(this.props,"hidden")?"url(#".concat(c,")"):void 0,b=S3(S3({clipPath:x},rt(this.props,!0)),{},{cx:f,cy:m});return J.createElement(rr,{className:nt("recharts-reference-dot",v)},t.renderDot(p,b),Yr.renderCallByParent(this.props,{x:f-o,y:m-o,width:2*o,height:2*o}))}}])}(J.Component);rw(nw,"displayName","ReferenceDot");rw(nw,"defaultProps",{isFront:!1,ifOverflow:"discard",xAxisId:0,yAxisId:0,r:10,fill:"#fff",stroke:"#ccc",fillOpacity:1,strokeWidth:1});rw(nw,"renderDot",function(e,t){var r;return J.isValidElement(e)?r=J.cloneElement(e,t):Qe(e)?r=e(t):r=J.createElement(xE,dN({},t,{cx:t.cx,cy:t.cy,className:"recharts-reference-dot-dot"})),r});function fN(){return fN=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},fN.apply(this,arguments)}function Bd(e){"@babel/helpers - typeof";return Bd=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Bd(e)}function N3(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function k3(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?N3(Object(r),!0).forEach(function(n){aw(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):N3(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function IMe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function DMe(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,sW(n.key),n)}}function LMe(e,t,r){return t&&DMe(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function FMe(e,t,r){return t=Hx(t),zMe(e,aW()?Reflect.construct(t,r||[],Hx(e).constructor):t.apply(e,r))}function zMe(e,t){if(t&&(Bd(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return BMe(e)}function BMe(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function aW(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(aW=function(){return!!e})()}function Hx(e){return Hx=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Hx(e)}function UMe(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&mN(e,t)}function mN(e,t){return mN=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,s){return n.__proto__=s,n},mN(e,t)}function aw(e,t,r){return t=sW(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function sW(e){var t=WMe(e,"string");return Bd(t)=="symbol"?t:t+""}function WMe(e,t){if(Bd(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(Bd(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var VMe=function(t,r,n,s,i){var o=i.x1,l=i.x2,c=i.y1,u=i.y2,h=i.xAxis,d=i.yAxis;if(!h||!d)return null;var f=bE({x:h.scale,y:d.scale}),m={x:t?f.x.apply(o,{position:"start"}):f.x.rangeMin,y:n?f.y.apply(c,{position:"start"}):f.y.rangeMin},g={x:r?f.x.apply(l,{position:"end"}):f.x.rangeMax,y:s?f.y.apply(u,{position:"end"}):f.y.rangeMax};return Gs(i,"discard")&&(!f.isInRange(m)||!f.isInRange(g))?null:H9(m,g)},sw=function(e){function t(){return IMe(this,t),FMe(this,t,arguments)}return UMe(t,e),LMe(t,[{key:"render",value:function(){var n=this.props,s=n.x1,i=n.x2,o=n.y1,l=n.y2,c=n.className,u=n.alwaysShow,h=n.clipPathId;Ni(u===void 0,'The alwaysShow prop is deprecated. Please use ifOverflow="extendDomain" instead.');var d=pr(s),f=pr(i),m=pr(o),g=pr(l),p=this.props.shape;if(!d&&!f&&!m&&!g&&!p)return null;var v=VMe(d,f,m,g,this.props);if(!v&&!p)return null;var x=Gs(this.props,"hidden")?"url(#".concat(h,")"):void 0;return J.createElement(rr,{className:nt("recharts-reference-area",c)},t.renderRect(p,k3(k3({clipPath:x},rt(this.props,!0)),v)),Yr.renderCallByParent(this.props,v))}}])}(J.Component);aw(sw,"displayName","ReferenceArea");aw(sw,"defaultProps",{isFront:!1,ifOverflow:"discard",xAxisId:0,yAxisId:0,r:10,fill:"#ccc",fillOpacity:.5,stroke:"none",strokeWidth:1});aw(sw,"renderRect",function(e,t){var r;return J.isValidElement(e)?r=J.cloneElement(e,t):Qe(e)?r=e(t):r=J.createElement(vE,fN({},t,{className:"recharts-reference-area-rect"})),r});function iW(e,t,r){if(t<1)return[];if(t===1&&r===void 0)return e;for(var n=[],s=0;s<e.length;s+=t)n.push(e[s]);return n}function HMe(e,t,r){var n={width:e.width+t.width,height:e.height+t.height};return F5e(n,r)}function qMe(e,t,r){var n=r==="width",s=e.x,i=e.y,o=e.width,l=e.height;return t===1?{start:n?s:i,end:n?s+o:i+l}:{start:n?s+o:i+l,end:n?s:i}}function qx(e,t,r,n,s){if(e*t<e*n||e*t>e*s)return!1;var i=r();return e*(t-e*i/2-n)>=0&&e*(t+e*i/2-s)<=0}function GMe(e,t){return iW(e,t+1)}function KMe(e,t,r,n,s){for(var i=(n||[]).slice(),o=t.start,l=t.end,c=0,u=1,h=o,d=function(){var g=n==null?void 0:n[c];if(g===void 0)return{v:iW(n,u)};var p=c,v,x=function(){return v===void 0&&(v=r(g,p)),v},b=g.coordinate,w=c===0||qx(e,b,x,h,l);w||(c=0,h=o,u+=1),w&&(h=b+e*(x()/2+s),c+=u)},f;u<=i.length;)if(f=d(),f)return f.v;return[]}function ip(e){"@babel/helpers - typeof";return ip=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ip(e)}function C3(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function Gr(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?C3(Object(r),!0).forEach(function(n){YMe(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):C3(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function YMe(e,t,r){return t=XMe(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function XMe(e){var t=QMe(e,"string");return ip(t)=="symbol"?t:t+""}function QMe(e,t){if(ip(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(ip(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function JMe(e,t,r,n,s){for(var i=(n||[]).slice(),o=i.length,l=t.start,c=t.end,u=function(f){var m=i[f],g,p=function(){return g===void 0&&(g=r(m,f)),g};if(f===o-1){var v=e*(m.coordinate+e*p()/2-c);i[f]=m=Gr(Gr({},m),{},{tickCoord:v>0?m.coordinate-v*e:m.coordinate})}else i[f]=m=Gr(Gr({},m),{},{tickCoord:m.coordinate});var x=qx(e,m.tickCoord,p,l,c);x&&(c=m.tickCoord-e*(p()/2+s),i[f]=Gr(Gr({},m),{},{isShow:!0}))},h=o-1;h>=0;h--)u(h);return i}function ZMe(e,t,r,n,s,i){var o=(n||[]).slice(),l=o.length,c=t.start,u=t.end;if(i){var h=n[l-1],d=r(h,l-1),f=e*(h.coordinate+e*d/2-u);o[l-1]=h=Gr(Gr({},h),{},{tickCoord:f>0?h.coordinate-f*e:h.coordinate});var m=qx(e,h.tickCoord,function(){return d},c,u);m&&(u=h.tickCoord-e*(d/2+s),o[l-1]=Gr(Gr({},h),{},{isShow:!0}))}for(var g=i?l-1:l,p=function(b){var w=o[b],j,_=function(){return j===void 0&&(j=r(w,b)),j};if(b===0){var S=e*(w.coordinate-e*_()/2-c);o[b]=w=Gr(Gr({},w),{},{tickCoord:S<0?w.coordinate-S*e:w.coordinate})}else o[b]=w=Gr(Gr({},w),{},{tickCoord:w.coordinate});var k=qx(e,w.tickCoord,_,c,u);k&&(c=w.tickCoord+e*(_()/2+s),o[b]=Gr(Gr({},w),{},{isShow:!0}))},v=0;v<g;v++)p(v);return o}function CE(e,t,r){var n=e.tick,s=e.ticks,i=e.viewBox,o=e.minTickGap,l=e.orientation,c=e.interval,u=e.tickFormatter,h=e.unit,d=e.angle;if(!s||!s.length||!n)return[];if(Ne(c)||wh.isSsr)return GMe(s,typeof c=="number"&&Ne(c)?c:0);var f=[],m=l==="top"||l==="bottom"?"width":"height",g=h&&m==="width"?$f(h,{fontSize:t,letterSpacing:r}):{width:0,height:0},p=function(w,j){var _=Qe(u)?u(w.value,j):w.value;return m==="width"?HMe($f(_,{fontSize:t,letterSpacing:r}),g,d):$f(_,{fontSize:t,letterSpacing:r})[m]},v=s.length>=2?Ja(s[1].coordinate-s[0].coordinate):1,x=qMe(i,v,m);return c==="equidistantPreserveStart"?KMe(v,x,p,s,o):(c==="preserveStart"||c==="preserveStartEnd"?f=ZMe(v,x,p,s,o,c==="preserveStartEnd"):f=JMe(v,x,p,s,o),f.filter(function(b){return b.isShow}))}var e3e=["viewBox"],t3e=["viewBox"],r3e=["ticks"];function Ud(e){"@babel/helpers - typeof";return Ud=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ud(e)}function Nu(){return Nu=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Nu.apply(this,arguments)}function E3(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function cr(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?E3(Object(r),!0).forEach(function(n){EE(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):E3(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function V1(e,t){if(e==null)return{};var r=n3e(e,t),n,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(s=0;s<i.length;s++)n=i[s],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function n3e(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function a3e(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function T3(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,lW(n.key),n)}}function s3e(e,t,r){return t&&T3(e.prototype,t),r&&T3(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function i3e(e,t,r){return t=Gx(t),o3e(e,oW()?Reflect.construct(t,r||[],Gx(e).constructor):t.apply(e,r))}function o3e(e,t){if(t&&(Ud(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return l3e(e)}function l3e(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function oW(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(oW=function(){return!!e})()}function Gx(e){return Gx=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Gx(e)}function c3e(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&pN(e,t)}function pN(e,t){return pN=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,s){return n.__proto__=s,n},pN(e,t)}function EE(e,t,r){return t=lW(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function lW(e){var t=u3e(e,"string");return Ud(t)=="symbol"?t:t+""}function u3e(e,t){if(Ud(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(Ud(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var Nh=function(e){function t(r){var n;return a3e(this,t),n=i3e(this,t,[r]),n.state={fontSize:"",letterSpacing:""},n}return c3e(t,e),s3e(t,[{key:"shouldComponentUpdate",value:function(n,s){var i=n.viewBox,o=V1(n,e3e),l=this.props,c=l.viewBox,u=V1(l,t3e);return!Bu(i,c)||!Bu(o,u)||!Bu(s,this.state)}},{key:"componentDidMount",value:function(){var n=this.layerReference;if(n){var s=n.getElementsByClassName("recharts-cartesian-axis-tick-value")[0];s&&this.setState({fontSize:window.getComputedStyle(s).fontSize,letterSpacing:window.getComputedStyle(s).letterSpacing})}}},{key:"getTickLineCoord",value:function(n){var s=this.props,i=s.x,o=s.y,l=s.width,c=s.height,u=s.orientation,h=s.tickSize,d=s.mirror,f=s.tickMargin,m,g,p,v,x,b,w=d?-1:1,j=n.tickSize||h,_=Ne(n.tickCoord)?n.tickCoord:n.coordinate;switch(u){case"top":m=g=n.coordinate,v=o+ +!d*c,p=v-w*j,b=p-w*f,x=_;break;case"left":p=v=n.coordinate,g=i+ +!d*l,m=g-w*j,x=m-w*f,b=_;break;case"right":p=v=n.coordinate,g=i+ +d*l,m=g+w*j,x=m+w*f,b=_;break;default:m=g=n.coordinate,v=o+ +d*c,p=v+w*j,b=p+w*f,x=_;break}return{line:{x1:m,y1:p,x2:g,y2:v},tick:{x,y:b}}}},{key:"getTickTextAnchor",value:function(){var n=this.props,s=n.orientation,i=n.mirror,o;switch(s){case"left":o=i?"start":"end";break;case"right":o=i?"end":"start";break;default:o="middle";break}return o}},{key:"getTickVerticalAnchor",value:function(){var n=this.props,s=n.orientation,i=n.mirror,o="end";switch(s){case"left":case"right":o="middle";break;case"top":o=i?"start":"end";break;default:o=i?"end":"start";break}return o}},{key:"renderAxisLine",value:function(){var n=this.props,s=n.x,i=n.y,o=n.width,l=n.height,c=n.orientation,u=n.mirror,h=n.axisLine,d=cr(cr(cr({},rt(this.props,!1)),rt(h,!1)),{},{fill:"none"});if(c==="top"||c==="bottom"){var f=+(c==="top"&&!u||c==="bottom"&&u);d=cr(cr({},d),{},{x1:s,y1:i+f*l,x2:s+o,y2:i+f*l})}else{var m=+(c==="left"&&!u||c==="right"&&u);d=cr(cr({},d),{},{x1:s+m*o,y1:i,x2:s+m*o,y2:i+l})}return J.createElement("line",Nu({},d,{className:nt("recharts-cartesian-axis-line",ga(h,"className"))}))}},{key:"renderTicks",value:function(n,s,i){var o=this,l=this.props,c=l.tickLine,u=l.stroke,h=l.tick,d=l.tickFormatter,f=l.unit,m=CE(cr(cr({},this.props),{},{ticks:n}),s,i),g=this.getTickTextAnchor(),p=this.getTickVerticalAnchor(),v=rt(this.props,!1),x=rt(h,!1),b=cr(cr({},v),{},{fill:"none"},rt(c,!1)),w=m.map(function(j,_){var S=o.getTickLineCoord(j),k=S.line,P=S.tick,C=cr(cr(cr(cr({textAnchor:g,verticalAnchor:p},v),{},{stroke:"none",fill:u},x),P),{},{index:_,payload:j,visibleTicksCount:m.length,tickFormatter:d});return J.createElement(rr,Nu({className:"recharts-cartesian-axis-tick",key:"tick-".concat(j.value,"-").concat(j.coordinate,"-").concat(j.tickCoord)},Zv(o.props,j,_)),c&&J.createElement("line",Nu({},b,k,{className:nt("recharts-cartesian-axis-tick-line",ga(c,"className"))})),h&&t.renderTickItem(h,C,"".concat(Qe(d)?d(j.value,_):j.value).concat(f||"")))});return J.createElement("g",{className:"recharts-cartesian-axis-ticks"},w)}},{key:"render",value:function(){var n=this,s=this.props,i=s.axisLine,o=s.width,l=s.height,c=s.ticksGenerator,u=s.className,h=s.hide;if(h)return null;var d=this.props,f=d.ticks,m=V1(d,r3e),g=f;return Qe(c)&&(g=f&&f.length>0?c(this.props):c(m)),o<=0||l<=0||!g||!g.length?null:J.createElement(rr,{className:nt("recharts-cartesian-axis",u),ref:function(v){n.layerReference=v}},i&&this.renderAxisLine(),this.renderTicks(g,this.state.fontSize,this.state.letterSpacing),Yr.renderCallByParent(this.props))}}],[{key:"renderTickItem",value:function(n,s,i){var o,l=nt(s.className,"recharts-cartesian-axis-tick-value");return J.isValidElement(n)?o=J.cloneElement(n,cr(cr({},s),{},{className:l})):Qe(n)?o=n(cr(cr({},s),{},{className:l})):o=J.createElement(fx,Nu({},s,{className:"recharts-cartesian-axis-tick-value"}),i),o}}])}(y.Component);EE(Nh,"displayName","CartesianAxis");EE(Nh,"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"});var d3e=["x1","y1","x2","y2","key"],h3e=["offset"];function vc(e){"@babel/helpers - typeof";return vc=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},vc(e)}function A3(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function Xr(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?A3(Object(r),!0).forEach(function(n){f3e(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):A3(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function f3e(e,t,r){return t=m3e(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function m3e(e){var t=p3e(e,"string");return vc(t)=="symbol"?t:t+""}function p3e(e,t){if(vc(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(vc(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Wl(){return Wl=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Wl.apply(this,arguments)}function P3(e,t){if(e==null)return{};var r=g3e(e,t),n,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(s=0;s<i.length;s++)n=i[s],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function g3e(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}var y3e=function(t){var r=t.fill;if(!r||r==="none")return null;var n=t.fillOpacity,s=t.x,i=t.y,o=t.width,l=t.height,c=t.ry;return J.createElement("rect",{x:s,y:i,ry:c,width:o,height:l,stroke:"none",fill:r,fillOpacity:n,className:"recharts-cartesian-grid-bg"})};function cW(e,t){var r;if(J.isValidElement(e))r=J.cloneElement(e,t);else if(Qe(e))r=e(t);else{var n=t.x1,s=t.y1,i=t.x2,o=t.y2,l=t.key,c=P3(t,d3e),u=rt(c,!1);u.offset;var h=P3(u,h3e);r=J.createElement("line",Wl({},h,{x1:n,y1:s,x2:i,y2:o,fill:"none",key:l}))}return r}function v3e(e){var t=e.x,r=e.width,n=e.horizontal,s=n===void 0?!0:n,i=e.horizontalPoints;if(!s||!i||!i.length)return null;var o=i.map(function(l,c){var u=Xr(Xr({},e),{},{x1:t,y1:l,x2:t+r,y2:l,key:"line-".concat(c),index:c});return cW(s,u)});return J.createElement("g",{className:"recharts-cartesian-grid-horizontal"},o)}function x3e(e){var t=e.y,r=e.height,n=e.vertical,s=n===void 0?!0:n,i=e.verticalPoints;if(!s||!i||!i.length)return null;var o=i.map(function(l,c){var u=Xr(Xr({},e),{},{x1:l,y1:t,x2:l,y2:t+r,key:"line-".concat(c),index:c});return cW(s,u)});return J.createElement("g",{className:"recharts-cartesian-grid-vertical"},o)}function b3e(e){var t=e.horizontalFill,r=e.fillOpacity,n=e.x,s=e.y,i=e.width,o=e.height,l=e.horizontalPoints,c=e.horizontal,u=c===void 0?!0:c;if(!u||!t||!t.length)return null;var h=l.map(function(f){return Math.round(f+s-s)}).sort(function(f,m){return f-m});s!==h[0]&&h.unshift(0);var d=h.map(function(f,m){var g=!h[m+1],p=g?s+o-f:h[m+1]-f;if(p<=0)return null;var v=m%t.length;return J.createElement("rect",{key:"react-".concat(m),y:f,x:n,height:p,width:i,stroke:"none",fill:t[v],fillOpacity:r,className:"recharts-cartesian-grid-bg"})});return J.createElement("g",{className:"recharts-cartesian-gridstripes-horizontal"},d)}function w3e(e){var t=e.vertical,r=t===void 0?!0:t,n=e.verticalFill,s=e.fillOpacity,i=e.x,o=e.y,l=e.width,c=e.height,u=e.verticalPoints;if(!r||!n||!n.length)return null;var h=u.map(function(f){return Math.round(f+i-i)}).sort(function(f,m){return f-m});i!==h[0]&&h.unshift(0);var d=h.map(function(f,m){var g=!h[m+1],p=g?i+l-f:h[m+1]-f;if(p<=0)return null;var v=m%n.length;return J.createElement("rect",{key:"react-".concat(m),x:f,y:o,width:p,height:c,stroke:"none",fill:n[v],fillOpacity:s,className:"recharts-cartesian-grid-bg"})});return J.createElement("g",{className:"recharts-cartesian-gridstripes-vertical"},d)}var j3e=function(t,r){var n=t.xAxis,s=t.width,i=t.height,o=t.offset;return v9(CE(Xr(Xr(Xr({},Nh.defaultProps),n),{},{ticks:wi(n,!0),viewBox:{x:0,y:0,width:s,height:i}})),o.left,o.left+o.width,r)},_3e=function(t,r){var n=t.yAxis,s=t.width,i=t.height,o=t.offset;return v9(CE(Xr(Xr(Xr({},Nh.defaultProps),n),{},{ticks:wi(n,!0),viewBox:{x:0,y:0,width:s,height:i}})),o.top,o.top+o.height,r)},tu={horizontal:!0,vertical:!0,stroke:"#ccc",fill:"none",verticalFill:[],horizontalFill:[]};function Hu(e){var t,r,n,s,i,o,l=_E(),c=SE(),u=uMe(),h=Xr(Xr({},e),{},{stroke:(t=e.stroke)!==null&&t!==void 0?t:tu.stroke,fill:(r=e.fill)!==null&&r!==void 0?r:tu.fill,horizontal:(n=e.horizontal)!==null&&n!==void 0?n:tu.horizontal,horizontalFill:(s=e.horizontalFill)!==null&&s!==void 0?s:tu.horizontalFill,vertical:(i=e.vertical)!==null&&i!==void 0?i:tu.vertical,verticalFill:(o=e.verticalFill)!==null&&o!==void 0?o:tu.verticalFill,x:Ne(e.x)?e.x:u.left,y:Ne(e.y)?e.y:u.top,width:Ne(e.width)?e.width:u.width,height:Ne(e.height)?e.height:u.height}),d=h.x,f=h.y,m=h.width,g=h.height,p=h.syncWithTicks,v=h.horizontalValues,x=h.verticalValues,b=oMe(),w=lMe();if(!Ne(m)||m<=0||!Ne(g)||g<=0||!Ne(d)||d!==+d||!Ne(f)||f!==+f)return null;var j=h.verticalCoordinatesGenerator||j3e,_=h.horizontalCoordinatesGenerator||_3e,S=h.horizontalPoints,k=h.verticalPoints;if((!S||!S.length)&&Qe(_)){var P=v&&v.length,C=_({yAxis:w?Xr(Xr({},w),{},{ticks:P?v:w.ticks}):void 0,width:l,height:c,offset:u},P?!0:p);Ni(Array.isArray(C),"horizontalCoordinatesGenerator should return Array but instead it returned [".concat(vc(C),"]")),Array.isArray(C)&&(S=C)}if((!k||!k.length)&&Qe(j)){var M=x&&x.length,I=j({xAxis:b?Xr(Xr({},b),{},{ticks:M?x:b.ticks}):void 0,width:l,height:c,offset:u},M?!0:p);Ni(Array.isArray(I),"verticalCoordinatesGenerator should return Array but instead it returned [".concat(vc(I),"]")),Array.isArray(I)&&(k=I)}return J.createElement("g",{className:"recharts-cartesian-grid"},J.createElement(y3e,{fill:h.fill,fillOpacity:h.fillOpacity,x:h.x,y:h.y,width:h.width,height:h.height,ry:h.ry}),J.createElement(v3e,Wl({},h,{offset:u,horizontalPoints:S,xAxis:b,yAxis:w})),J.createElement(x3e,Wl({},h,{offset:u,verticalPoints:k,xAxis:b,yAxis:w})),J.createElement(b3e,Wl({},h,{horizontalPoints:S})),J.createElement(w3e,Wl({},h,{verticalPoints:k})))}Hu.displayName="CartesianGrid";var S3e=["type","layout","connectNulls","ref"],N3e=["key"];function Wd(e){"@babel/helpers - typeof";return Wd=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Wd(e)}function O3(e,t){if(e==null)return{};var r=k3e(e,t),n,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(s=0;s<i.length;s++)n=i[s],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function k3e(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function Ff(){return Ff=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Ff.apply(this,arguments)}function M3(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function Dn(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?M3(Object(r),!0).forEach(function(n){qa(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):M3(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function ru(e){return A3e(e)||T3e(e)||E3e(e)||C3e()}function C3e(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
941In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function E3e(e,t){if(e){if(typeof e=="string")return gN(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return gN(e,t)}}function T3e(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function A3e(e){if(Array.isArray(e))return gN(e)}function gN(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function P3e(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function R3(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,dW(n.key),n)}}function O3e(e,t,r){return t&&R3(e.prototype,t),r&&R3(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function M3e(e,t,r){return t=Kx(t),R3e(e,uW()?Reflect.construct(t,r||[],Kx(e).constructor):t.apply(e,r))}function R3e(e,t){if(t&&(Wd(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return $3e(e)}function $3e(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function uW(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(uW=function(){return!!e})()}function Kx(e){return Kx=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Kx(e)}function I3e(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&yN(e,t)}function yN(e,t){return yN=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,s){return n.__proto__=s,n},yN(e,t)}function qa(e,t,r){return t=dW(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function dW(e){var t=D3e(e,"string");return Wd(t)=="symbol"?t:t+""}function D3e(e,t){if(Wd(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(Wd(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var Ci=function(e){function t(){var r;P3e(this,t);for(var n=arguments.length,s=new Array(n),i=0;i<n;i++)s[i]=arguments[i];return r=M3e(this,t,[].concat(s)),qa(r,"state",{isAnimationFinished:!0,totalLength:0}),qa(r,"generateSimpleStrokeDasharray",function(o,l){return"".concat(l,"px ").concat(o-l,"px")}),qa(r,"getStrokeDasharray",function(o,l,c){var u=c.reduce(function(x,b){return x+b});if(!u)return r.generateSimpleStrokeDasharray(l,o);for(var h=Math.floor(o/u),d=o%u,f=l-o,m=[],g=0,p=0;g<c.length;p+=c[g],++g)if(p+c[g]>d){m=[].concat(ru(c.slice(0,g)),[d-p]);break}var v=m.length%2===0?[0,f]:[f];return[].concat(ru(t.repeat(c,h)),ru(m),v).map(function(x){return"".concat(x,"px")}).join(", ")}),qa(r,"id",Vp("recharts-line-")),qa(r,"pathRef",function(o){r.mainCurve=o}),qa(r,"handleAnimationEnd",function(){r.setState({isAnimationFinished:!0}),r.props.onAnimationEnd&&r.props.onAnimationEnd()}),qa(r,"handleAnimationStart",function(){r.setState({isAnimationFinished:!1}),r.props.onAnimationStart&&r.props.onAnimationStart()}),r}return I3e(t,e),O3e(t,[{key:"componentDidMount",value:function(){if(this.props.isAnimationActive){var n=this.getTotalLength();this.setState({totalLength:n})}}},{key:"componentDidUpdate",value:function(){if(this.props.isAnimationActive){var n=this.getTotalLength();n!==this.state.totalLength&&this.setState({totalLength:n})}}},{key:"getTotalLength",value:function(){var n=this.mainCurve;try{return n&&n.getTotalLength&&n.getTotalLength()||0}catch{return 0}}},{key:"renderErrorBar",value:function(n,s){if(this.props.isAnimationActive&&!this.state.isAnimationFinished)return null;var i=this.props,o=i.points,l=i.xAxis,c=i.yAxis,u=i.layout,h=i.children,d=ya(h,Xp);if(!d)return null;var f=function(p,v){return{x:p.x,y:p.y,value:p.value,errorVal:Qn(p.payload,v)}},m={clipPath:n?"url(#clipPath-".concat(s,")"):null};return J.createElement(rr,m,d.map(function(g){return J.cloneElement(g,{key:"bar-".concat(g.props.dataKey),data:o,xAxis:l,yAxis:c,layout:u,dataPointFormatter:f})}))}},{key:"renderDots",value:function(n,s,i){var o=this.props.isAnimationActive;if(o&&!this.state.isAnimationFinished)return null;var l=this.props,c=l.dot,u=l.points,h=l.dataKey,d=rt(this.props,!1),f=rt(c,!0),m=u.map(function(p,v){var x=Dn(Dn(Dn({key:"dot-".concat(v),r:3},d),f),{},{index:v,cx:p.x,cy:p.y,value:p.value,dataKey:h,payload:p.payload,points:u});return t.renderDotItem(c,x)}),g={clipPath:n?"url(#clipPath-".concat(s?"":"dots-").concat(i,")"):null};return J.createElement(rr,Ff({className:"recharts-line-dots",key:"dots"},g),m)}},{key:"renderCurveStatically",value:function(n,s,i,o){var l=this.props,c=l.type,u=l.layout,h=l.connectNulls;l.ref;var d=O3(l,S3e),f=Dn(Dn(Dn({},rt(d,!0)),{},{fill:"none",className:"recharts-line-curve",clipPath:s?"url(#clipPath-".concat(i,")"):null,points:n},o),{},{type:c,layout:u,connectNulls:h});return J.createElement(KS,Ff({},f,{pathRef:this.pathRef}))}},{key:"renderCurveWithAnimation",value:function(n,s){var i=this,o=this.props,l=o.points,c=o.strokeDasharray,u=o.isAnimationActive,h=o.animationBegin,d=o.animationDuration,f=o.animationEasing,m=o.animationId,g=o.animateNewValues,p=o.width,v=o.height,x=this.state,b=x.prevPoints,w=x.totalLength;return J.createElement(Bi,{begin:h,duration:d,isActive:u,easing:f,from:{t:0},to:{t:1},key:"line-".concat(m),onAnimationEnd:this.handleAnimationEnd,onAnimationStart:this.handleAnimationStart},function(j){var _=j.t;if(b){var S=b.length/l.length,k=l.map(function(E,B){var A=Math.floor(B*S);if(b[A]){var L=b[A],W=Ka(L.x,E.x),D=Ka(L.y,E.y);return Dn(Dn({},E),{},{x:W(_),y:D(_)})}if(g){var U=Ka(p*2,E.x),R=Ka(v/2,E.y);return Dn(Dn({},E),{},{x:U(_),y:R(_)})}return Dn(Dn({},E),{},{x:E.x,y:E.y})});return i.renderCurveStatically(k,n,s)}var P=Ka(0,w),C=P(_),M;if(c){var I="".concat(c).split(/[,\s]+/gim).map(function(E){return parseFloat(E)});M=i.getStrokeDasharray(C,w,I)}else M=i.generateSimpleStrokeDasharray(w,C);return i.renderCurveStatically(l,n,s,{strokeDasharray:M})})}},{key:"renderCurve",value:function(n,s){var i=this.props,o=i.points,l=i.isAnimationActive,c=this.state,u=c.prevPoints,h=c.totalLength;return l&&o&&o.length&&(!u&&h>0||!Xb(u,o))?this.renderCurveWithAnimation(n,s):this.renderCurveStatically(o,n,s)}},{key:"render",value:function(){var n,s=this.props,i=s.hide,o=s.dot,l=s.points,c=s.className,u=s.xAxis,h=s.yAxis,d=s.top,f=s.left,m=s.width,g=s.height,p=s.isAnimationActive,v=s.id;if(i||!l||!l.length)return null;var x=this.state.isAnimationFinished,b=l.length===1,w=nt("recharts-line",c),j=u&&u.allowDataOverflow,_=h&&h.allowDataOverflow,S=j||_,k=Ze(v)?this.id:v,P=(n=rt(o,!1))!==null&&n!==void 0?n:{r:3,strokeWidth:2},C=P.r,M=C===void 0?3:C,I=P.strokeWidth,E=I===void 0?2:I,B=Kpe(o)?o:{},A=B.clipDot,L=A===void 0?!0:A,W=M*2+E;return J.createElement(rr,{className:w},j||_?J.createElement("defs",null,J.createElement("clipPath",{id:"clipPath-".concat(k)},J.createElement("rect",{x:j?f:f-m/2,y:_?d:d-g/2,width:j?m:m*2,height:_?g:g*2})),!L&&J.createElement("clipPath",{id:"clipPath-dots-".concat(k)},J.createElement("rect",{x:f-W/2,y:d-W/2,width:m+W,height:g+W}))):null,!b&&this.renderCurve(S,k),this.renderErrorBar(S,k),(b||o)&&this.renderDots(S,L,k),(!p||x)&&Ho.renderCallByParent(this.props,l))}}],[{key:"getDerivedStateFromProps",value:function(n,s){return n.animationId!==s.prevAnimationId?{prevAnimationId:n.animationId,curPoints:n.points,prevPoints:s.curPoints}:n.points!==s.curPoints?{curPoints:n.points}:null}},{key:"repeat",value:function(n,s){for(var i=n.length%2!==0?[].concat(ru(n),[0]):n,o=[],l=0;l<s;++l)o=[].concat(ru(o),ru(i));return o}},{key:"renderDotItem",value:function(n,s){var i;if(J.isValidElement(n))i=J.cloneElement(n,s);else if(Qe(n))i=n(s);else{var o=s.key,l=O3(s,N3e),c=nt("recharts-line-dot",typeof n!="boolean"?n.className:"");i=J.createElement(xE,Ff({key:o},l,{className:c}))}return i}}])}(y.PureComponent);qa(Ci,"displayName","Line");qa(Ci,"defaultProps",{xAxisId:0,yAxisId:0,connectNulls:!1,activeDot:!0,dot:!0,legendType:"line",stroke:"#3182bd",strokeWidth:1,fill:"#fff",points:[],isAnimationActive:!wh.isSsr,animateNewValues:!0,animationBegin:0,animationDuration:1500,animationEasing:"ease",hide:!1,label:!1});qa(Ci,"getComposedData",function(e){var t=e.props,r=e.xAxis,n=e.yAxis,s=e.xAxisTicks,i=e.yAxisTicks,o=e.dataKey,l=e.bandSize,c=e.displayedData,u=e.offset,h=t.layout,d=c.map(function(f,m){var g=Qn(f,o);return h==="horizontal"?{x:yM({axis:r,ticks:s,bandSize:l,entry:f,index:m}),y:Ze(g)?null:n.scale(g),value:g,payload:f}:{x:Ze(g)?null:r.scale(g),y:yM({axis:n,ticks:i,bandSize:l,entry:f,index:m}),value:g,payload:f}});return Dn({points:d,layout:h},u)});function Vd(e){"@babel/helpers - typeof";return Vd=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Vd(e)}function L3e(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function F3e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,mW(n.key),n)}}function z3e(e,t,r){return t&&F3e(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function B3e(e,t,r){return t=Yx(t),U3e(e,hW()?Reflect.construct(t,r||[],Yx(e).constructor):t.apply(e,r))}function U3e(e,t){if(t&&(Vd(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return W3e(e)}function W3e(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function hW(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(hW=function(){return!!e})()}function Yx(e){return Yx=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Yx(e)}function V3e(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&vN(e,t)}function vN(e,t){return vN=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,s){return n.__proto__=s,n},vN(e,t)}function fW(e,t,r){return t=mW(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function mW(e){var t=H3e(e,"string");return Vd(t)=="symbol"?t:t+""}function H3e(e,t){if(Vd(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(Vd(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function xN(){return xN=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},xN.apply(this,arguments)}function q3e(e){var t=e.xAxisId,r=_E(),n=SE(),s=J9(t);return s==null?null:y.createElement(Nh,xN({},s,{className:nt("recharts-".concat(s.axisType," ").concat(s.axisType),s.className),viewBox:{x:0,y:0,width:r,height:n},ticksGenerator:function(o){return wi(o,!0)}}))}var Ei=function(e){function t(){return L3e(this,t),B3e(this,t,arguments)}return V3e(t,e),z3e(t,[{key:"render",value:function(){return y.createElement(q3e,this.props)}}])}(y.Component);fW(Ei,"displayName","XAxis");fW(Ei,"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 Hd(e){"@babel/helpers - typeof";return Hd=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Hd(e)}function G3e(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function K3e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,yW(n.key),n)}}function Y3e(e,t,r){return t&&K3e(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function X3e(e,t,r){return t=Xx(t),Q3e(e,pW()?Reflect.construct(t,r||[],Xx(e).constructor):t.apply(e,r))}function Q3e(e,t){if(t&&(Hd(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return J3e(e)}function J3e(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function pW(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(pW=function(){return!!e})()}function Xx(e){return Xx=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Xx(e)}function Z3e(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&bN(e,t)}function bN(e,t){return bN=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,s){return n.__proto__=s,n},bN(e,t)}function gW(e,t,r){return t=yW(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function yW(e){var t=e4e(e,"string");return Hd(t)=="symbol"?t:t+""}function e4e(e,t){if(Hd(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(Hd(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function wN(){return wN=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},wN.apply(this,arguments)}var t4e=function(t){var r=t.yAxisId,n=_E(),s=SE(),i=Z9(r);return i==null?null:y.createElement(Nh,wN({},i,{className:nt("recharts-".concat(i.axisType," ").concat(i.axisType),i.className),viewBox:{x:0,y:0,width:n,height:s},ticksGenerator:function(l){return wi(l,!0)}}))},Ti=function(e){function t(){return G3e(this,t),X3e(this,t,arguments)}return Z3e(t,e),Y3e(t,[{key:"render",value:function(){return y.createElement(t4e,this.props)}}])}(y.Component);gW(Ti,"displayName","YAxis");gW(Ti,"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 $3(e){return s4e(e)||a4e(e)||n4e(e)||r4e()}function r4e(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
942In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function n4e(e,t){if(e){if(typeof e=="string")return jN(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return jN(e,t)}}function a4e(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function s4e(e){if(Array.isArray(e))return jN(e)}function jN(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var _N=function(t,r,n,s,i){var o=ya(t,kE),l=ya(t,nw),c=[].concat($3(o),$3(l)),u=ya(t,sw),h="".concat(s,"Id"),d=s[0],f=r;if(c.length&&(f=c.reduce(function(p,v){if(v.props[h]===n&&Gs(v.props,"extendDomain")&&Ne(v.props[d])){var x=v.props[d];return[Math.min(p[0],x),Math.max(p[1],x)]}return p},f)),u.length){var m="".concat(d,"1"),g="".concat(d,"2");f=u.reduce(function(p,v){if(v.props[h]===n&&Gs(v.props,"extendDomain")&&Ne(v.props[m])&&Ne(v.props[g])){var x=v.props[m],b=v.props[g];return[Math.min(p[0],x,b),Math.max(p[1],x,b)]}return p},f)}return i&&i.length&&(f=i.reduce(function(p,v){return Ne(v)?[Math.min(p[0],v),Math.max(p[1],v)]:p},f)),f},vW={exports:{}};(function(e){var t=Object.prototype.hasOwnProperty,r="~";function n(){}Object.create&&(n.prototype=Object.create(null),new n().__proto__||(r=!1));function s(c,u,h){this.fn=c,this.context=u,this.once=h||!1}function i(c,u,h,d,f){if(typeof h!="function")throw new TypeError("The listener must be a function");var m=new s(h,d||c,f),g=r?r+u:u;return c._events[g]?c._events[g].fn?c._events[g]=[c._events[g],m]:c._events[g].push(m):(c._events[g]=m,c._eventsCount++),c}function o(c,u){--c._eventsCount===0?c._events=new n:delete c._events[u]}function l(){this._events=new n,this._eventsCount=0}l.prototype.eventNames=function(){var u=[],h,d;if(this._eventsCount===0)return u;for(d in h=this._events)t.call(h,d)&&u.push(r?d.slice(1):d);return Object.getOwnPropertySymbols?u.concat(Object.getOwnPropertySymbols(h)):u},l.prototype.listeners=function(u){var h=r?r+u:u,d=this._events[h];if(!d)return[];if(d.fn)return[d.fn];for(var f=0,m=d.length,g=new Array(m);f<m;f++)g[f]=d[f].fn;return g},l.prototype.listenerCount=function(u){var h=r?r+u:u,d=this._events[h];return d?d.fn?1:d.length:0},l.prototype.emit=function(u,h,d,f,m,g){var p=r?r+u:u;if(!this._events[p])return!1;var v=this._events[p],x=arguments.length,b,w;if(v.fn){switch(v.once&&this.removeListener(u,v.fn,void 0,!0),x){case 1:return v.fn.call(v.context),!0;case 2:return v.fn.call(v.context,h),!0;case 3:return v.fn.call(v.context,h,d),!0;case 4:return v.fn.call(v.context,h,d,f),!0;case 5:return v.fn.call(v.context,h,d,f,m),!0;case 6:return v.fn.call(v.context,h,d,f,m,g),!0}for(w=1,b=new Array(x-1);w<x;w++)b[w-1]=arguments[w];v.fn.apply(v.context,b)}else{var j=v.length,_;for(w=0;w<j;w++)switch(v[w].once&&this.removeListener(u,v[w].fn,void 0,!0),x){case 1:v[w].fn.call(v[w].context);break;case 2:v[w].fn.call(v[w].context,h);break;case 3:v[w].fn.call(v[w].context,h,d);break;case 4:v[w].fn.call(v[w].context,h,d,f);break;default:if(!b)for(_=1,b=new Array(x-1);_<x;_++)b[_-1]=arguments[_];v[w].fn.apply(v[w].context,b)}}return!0},l.prototype.on=function(u,h,d){return i(this,u,h,d,!1)},l.prototype.once=function(u,h,d){return i(this,u,h,d,!0)},l.prototype.removeListener=function(u,h,d,f){var m=r?r+u:u;if(!this._events[m])return this;if(!h)return o(this,m),this;var g=this._events[m];if(g.fn)g.fn===h&&(!f||g.once)&&(!d||g.context===d)&&o(this,m);else{for(var p=0,v=[],x=g.length;p<x;p++)(g[p].fn!==h||f&&!g[p].once||d&&g[p].context!==d)&&v.push(g[p]);v.length?this._events[m]=v.length===1?v[0]:v:o(this,m)}return this},l.prototype.removeAllListeners=function(u){var h;return u?(h=r?r+u:u,this._events[h]&&o(this,h)):(this._events=new n,this._eventsCount=0),this},l.prototype.off=l.prototype.removeListener,l.prototype.addListener=l.prototype.on,l.prefixed=r,l.EventEmitter=l,e.exports=l})(vW);var i4e=vW.exports;const o4e=mt(i4e);var H1=new o4e,q1="recharts.syncMouseEvents";function op(e){"@babel/helpers - typeof";return op=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},op(e)}function l4e(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function c4e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,xW(n.key),n)}}function u4e(e,t,r){return t&&c4e(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function G1(e,t,r){return t=xW(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function xW(e){var t=d4e(e,"string");return op(t)=="symbol"?t:t+""}function d4e(e,t){if(op(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(op(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var h4e=function(){function e(){l4e(this,e),G1(this,"activeIndex",0),G1(this,"coordinateList",[]),G1(this,"layout","horizontal")}return u4e(e,[{key:"setDetails",value:function(r){var n,s=r.coordinateList,i=s===void 0?null:s,o=r.container,l=o===void 0?null:o,c=r.layout,u=c===void 0?null:c,h=r.offset,d=h===void 0?null:h,f=r.mouseHandlerCallback,m=f===void 0?null:f;this.coordinateList=(n=i??this.coordinateList)!==null&&n!==void 0?n:[],this.container=l??this.container,this.layout=u??this.layout,this.offset=d??this.offset,this.mouseHandlerCallback=m??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 s=this.container.getBoundingClientRect(),i=s.x,o=s.y,l=s.height,c=this.coordinateList[this.activeIndex].coordinate,u=((r=window)===null||r===void 0?void 0:r.scrollX)||0,h=((n=window)===null||n===void 0?void 0:n.scrollY)||0,d=i+c+u,f=o+this.offset.top+l/2+h;this.mouseHandlerCallback({pageX:d,pageY:f})}}}])}();function f4e(e,t,r){if(r==="number"&&t===!0&&Array.isArray(e)){var n=e==null?void 0:e[0],s=e==null?void 0:e[1];if(n&&s&&Ne(n)&&Ne(s))return!0}return!1}function m4e(e,t,r,n){var s=n/2;return{stroke:"none",fill:"#ccc",x:e==="horizontal"?t.x-s:r.left+.5,y:e==="horizontal"?r.top+.5:t.y-s,width:e==="horizontal"?n:r.width-1,height:e==="horizontal"?r.height-1:n}}function bW(e){var t=e.cx,r=e.cy,n=e.radius,s=e.startAngle,i=e.endAngle,o=Dr(t,r,n,s),l=Dr(t,r,n,i);return{points:[o,l],cx:t,cy:r,radius:n,startAngle:s,endAngle:i}}function p4e(e,t,r){var n,s,i,o;if(e==="horizontal")n=t.x,i=n,s=r.top,o=r.top+r.height;else if(e==="vertical")s=t.y,o=s,n=r.left,i=r.left+r.width;else if(t.cx!=null&&t.cy!=null)if(e==="centric"){var l=t.cx,c=t.cy,u=t.innerRadius,h=t.outerRadius,d=t.angle,f=Dr(l,c,u,d),m=Dr(l,c,h,d);n=f.x,s=f.y,i=m.x,o=m.y}else return bW(t);return[{x:n,y:s},{x:i,y:o}]}function lp(e){"@babel/helpers - typeof";return lp=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},lp(e)}function I3(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function ry(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?I3(Object(r),!0).forEach(function(n){g4e(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):I3(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function g4e(e,t,r){return t=y4e(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function y4e(e){var t=v4e(e,"string");return lp(t)=="symbol"?t:t+""}function v4e(e,t){if(lp(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(lp(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function x4e(e){var t,r,n=e.element,s=e.tooltipEventType,i=e.isActive,o=e.activeCoordinate,l=e.activePayload,c=e.offset,u=e.activeTooltipIndex,h=e.tooltipAxisBandSize,d=e.layout,f=e.chartName,m=(t=n.props.cursor)!==null&&t!==void 0?t:(r=n.type.defaultProps)===null||r===void 0?void 0:r.cursor;if(!n||!m||!i||!o||f!=="ScatterChart"&&s!=="axis")return null;var g,p=KS;if(f==="ScatterChart")g=o,p=xPe;else if(f==="BarChart")g=m4e(d,o,c,h),p=vE;else if(d==="radial"){var v=bW(o),x=v.cx,b=v.cy,w=v.radius,j=v.startAngle,_=v.endAngle;g={cx:x,cy:b,startAngle:j,endAngle:_,innerRadius:w,outerRadius:w},p=_9}else g={points:p4e(d,o,c)},p=KS;var S=ry(ry(ry(ry({stroke:"#ccc",pointerEvents:"none"},c),g),rt(m,!1)),{},{payload:l,payloadIndex:u,className:nt("recharts-tooltip-cursor",m.className)});return y.isValidElement(m)?y.cloneElement(m,S):y.createElement(p,S)}var b4e=["item"],w4e=["children","className","width","height","style","compact","title","desc"];function qd(e){"@babel/helpers - typeof";return qd=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},qd(e)}function ku(){return ku=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},ku.apply(this,arguments)}function D3(e,t){return S4e(e)||_4e(e,t)||jW(e,t)||j4e()}function j4e(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
943In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function _4e(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,s,i,o,l=[],c=!0,u=!1;try{if(i=(r=r.call(e)).next,t!==0)for(;!(c=(n=i.call(r)).done)&&(l.push(n.value),l.length!==t);c=!0);}catch(h){u=!0,s=h}finally{try{if(!c&&r.return!=null&&(o=r.return(),Object(o)!==o))return}finally{if(u)throw s}}return l}}function S4e(e){if(Array.isArray(e))return e}function L3(e,t){if(e==null)return{};var r=N4e(e,t),n,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(s=0;s<i.length;s++)n=i[s],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function N4e(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function k4e(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function C4e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,_W(n.key),n)}}function E4e(e,t,r){return t&&C4e(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function T4e(e,t,r){return t=Qx(t),A4e(e,wW()?Reflect.construct(t,r||[],Qx(e).constructor):t.apply(e,r))}function A4e(e,t){if(t&&(qd(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return P4e(e)}function P4e(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function wW(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(wW=function(){return!!e})()}function Qx(e){return Qx=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Qx(e)}function O4e(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&SN(e,t)}function SN(e,t){return SN=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,s){return n.__proto__=s,n},SN(e,t)}function Gd(e){return $4e(e)||R4e(e)||jW(e)||M4e()}function M4e(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
944In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function jW(e,t){if(e){if(typeof e=="string")return NN(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return NN(e,t)}}function R4e(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function $4e(e){if(Array.isArray(e))return NN(e)}function NN(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function F3(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function de(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?F3(Object(r),!0).forEach(function(n){De(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):F3(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function De(e,t,r){return t=_W(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function _W(e){var t=I4e(e,"string");return qd(t)=="symbol"?t:t+""}function I4e(e,t){if(qd(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(qd(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var D4e={xAxis:["bottom","top"],yAxis:["left","right"]},L4e={width:"100%",height:"100%"},SW={x:0,y:0};function ny(e){return e}var F4e=function(t,r){return r==="horizontal"?t.x:r==="vertical"?t.y:r==="centric"?t.angle:t.radius},z4e=function(t,r,n,s){var i=r.find(function(h){return h&&h.index===n});if(i){if(t==="horizontal")return{x:i.coordinate,y:s.y};if(t==="vertical")return{x:s.x,y:i.coordinate};if(t==="centric"){var o=i.coordinate,l=s.radius;return de(de(de({},s),Dr(s.cx,s.cy,l,o)),{},{angle:o,radius:l})}var c=i.coordinate,u=s.angle;return de(de(de({},s),Dr(s.cx,s.cy,c,u)),{},{angle:u,radius:c})}return SW},iw=function(t,r){var n=r.graphicalItems,s=r.dataStartIndex,i=r.dataEndIndex,o=(n??[]).reduce(function(l,c){var u=c.props.data;return u&&u.length?[].concat(Gd(l),Gd(u)):l},[]);return o.length>0?o:t&&t.length&&Ne(s)&&Ne(i)?t.slice(s,i+1):[]};function NW(e){return e==="number"?[0,"auto"]:void 0}var kN=function(t,r,n,s){var i=t.graphicalItems,o=t.tooltipAxis,l=iw(r,t);return n<0||!i||!i.length||n>=l.length?null:i.reduce(function(c,u){var h,d=(h=u.props.data)!==null&&h!==void 0?h:r;d&&t.dataStartIndex+t.dataEndIndex!==0&&t.dataEndIndex-t.dataStartIndex>=n&&(d=d.slice(t.dataStartIndex,t.dataEndIndex+1));var f;if(o.dataKey&&!o.allowDuplicatedCategory){var m=d===void 0?l:d;f=Qv(m,o.dataKey,s)}else f=d&&d[n]||l[n];return f?[].concat(Gd(c),[b9(u,f)]):c},[])},z3=function(t,r,n,s){var i=s||{x:t.chartX,y:t.chartY},o=F4e(i,n),l=t.orderedTooltipTicks,c=t.tooltipAxis,u=t.tooltipTicks,h=QCe(o,l,u,c);if(h>=0&&u){var d=u[h]&&u[h].value,f=kN(t,r,h,d),m=z4e(n,l,h,i);return{activeTooltipIndex:h,activeLabel:d,activePayload:f,activeCoordinate:m}}return null},B4e=function(t,r){var n=r.axes,s=r.graphicalItems,i=r.axisType,o=r.axisIdKey,l=r.stackGroups,c=r.dataStartIndex,u=r.dataEndIndex,h=t.layout,d=t.children,f=t.stackOffset,m=y9(h,i);return n.reduce(function(g,p){var v,x=p.type.defaultProps!==void 0?de(de({},p.type.defaultProps),p.props):p.props,b=x.type,w=x.dataKey,j=x.allowDataOverflow,_=x.allowDuplicatedCategory,S=x.scale,k=x.ticks,P=x.includeHidden,C=x[o];if(g[C])return g;var M=iw(t.data,{graphicalItems:s.filter(function(z){var N,T=o in z.props?z.props[o]:(N=z.type.defaultProps)===null||N===void 0?void 0:N[o];return T===C}),dataStartIndex:c,dataEndIndex:u}),I=M.length,E,B,A;f4e(x.domain,j,b)&&(E=WS(x.domain,null,j),m&&(b==="number"||S!=="auto")&&(A=Df(M,w,"category")));var L=NW(b);if(!E||E.length===0){var W,D=(W=x.domain)!==null&&W!==void 0?W:L;if(w){if(E=Df(M,w,b),b==="category"&&m){var U=Lpe(E);_&&U?(B=E,E=Lx(0,I)):_||(E=wM(D,E,p).reduce(function(z,N){return z.indexOf(N)>=0?z:[].concat(Gd(z),[N])},[]))}else if(b==="category")_?E=E.filter(function(z){return z!==""&&!Ze(z)}):E=wM(D,E,p).reduce(function(z,N){return z.indexOf(N)>=0||N===""||Ze(N)?z:[].concat(Gd(z),[N])},[]);else if(b==="number"){var R=rEe(M,s.filter(function(z){var N,T,$=o in z.props?z.props[o]:(N=z.type.defaultProps)===null||N===void 0?void 0:N[o],V="hide"in z.props?z.props.hide:(T=z.type.defaultProps)===null||T===void 0?void 0:T.hide;return $===C&&(P||!V)}),w,i,h);R&&(E=R)}m&&(b==="number"||S!=="auto")&&(A=Df(M,w,"category"))}else m?E=Lx(0,I):l&&l[C]&&l[C].hasStack&&b==="number"?E=f==="expand"?[0,1]:x9(l[C].stackGroups,c,u):E=g9(M,s.filter(function(z){var N=o in z.props?z.props[o]:z.type.defaultProps[o],T="hide"in z.props?z.props.hide:z.type.defaultProps.hide;return N===C&&(P||!T)}),b,h,!0);if(b==="number")E=_N(d,E,C,i,k),D&&(E=WS(D,E,j));else if(b==="category"&&D){var Q=D,K=E.every(function(z){return Q.indexOf(z)>=0});K&&(E=Q)}}return de(de({},g),{},De({},C,de(de({},x),{},{axisType:i,domain:E,categoricalDomain:A,duplicateDomain:B,originalDomain:(v=x.domain)!==null&&v!==void 0?v:L,isCategorical:m,layout:h})))},{})},U4e=function(t,r){var n=r.graphicalItems,s=r.Axis,i=r.axisType,o=r.axisIdKey,l=r.stackGroups,c=r.dataStartIndex,u=r.dataEndIndex,h=t.layout,d=t.children,f=iw(t.data,{graphicalItems:n,dataStartIndex:c,dataEndIndex:u}),m=f.length,g=y9(h,i),p=-1;return n.reduce(function(v,x){var b=x.type.defaultProps!==void 0?de(de({},x.type.defaultProps),x.props):x.props,w=b[o],j=NW("number");if(!v[w]){p++;var _;return g?_=Lx(0,m):l&&l[w]&&l[w].hasStack?(_=x9(l[w].stackGroups,c,u),_=_N(d,_,w,i)):(_=WS(j,g9(f,n.filter(function(S){var k,P,C=o in S.props?S.props[o]:(k=S.type.defaultProps)===null||k===void 0?void 0:k[o],M="hide"in S.props?S.props.hide:(P=S.type.defaultProps)===null||P===void 0?void 0:P.hide;return C===w&&!M}),"number",h),s.defaultProps.allowDataOverflow),_=_N(d,_,w,i)),de(de({},v),{},De({},w,de(de({axisType:i},s.defaultProps),{},{hide:!0,orientation:ga(D4e,"".concat(i,".").concat(p%2),null),domain:_,originalDomain:j,isCategorical:g,layout:h})))}return v},{})},W4e=function(t,r){var n=r.axisType,s=n===void 0?"xAxis":n,i=r.AxisComp,o=r.graphicalItems,l=r.stackGroups,c=r.dataStartIndex,u=r.dataEndIndex,h=t.children,d="".concat(s,"Id"),f=ya(h,i),m={};return f&&f.length?m=B4e(t,{axes:f,graphicalItems:o,axisType:s,axisIdKey:d,stackGroups:l,dataStartIndex:c,dataEndIndex:u}):o&&o.length&&(m=U4e(t,{Axis:i,graphicalItems:o,axisType:s,axisIdKey:d,stackGroups:l,dataStartIndex:c,dataEndIndex:u})),m},V4e=function(t){var r=bo(t),n=wi(r,!1,!0);return{tooltipTicks:n,orderedTooltipTicks:HC(n,function(s){return s.coordinate}),tooltipAxis:r,tooltipAxisBandSize:Ex(r,n)}},B3=function(t){var r=t.children,n=t.defaultShowTooltip,s=zn(r,Dd),i=0,o=0;return t.data&&t.data.length!==0&&(o=t.data.length-1),s&&s.props&&(s.props.startIndex>=0&&(i=s.props.startIndex),s.props.endIndex>=0&&(o=s.props.endIndex)),{chartX:0,chartY:0,dataStartIndex:i,dataEndIndex:o,activeTooltipIndex:-1,isTooltipActive:!!n}},H4e=function(t){return!t||!t.length?!1:t.some(function(r){var n=Si(r&&r.type);return n&&n.indexOf("Bar")>=0})},U3=function(t){return t==="horizontal"?{numericAxisName:"yAxis",cateAxisName:"xAxis"}:t==="vertical"?{numericAxisName:"xAxis",cateAxisName:"yAxis"}:t==="centric"?{numericAxisName:"radiusAxis",cateAxisName:"angleAxis"}:{numericAxisName:"angleAxis",cateAxisName:"radiusAxis"}},q4e=function(t,r){var n=t.props,s=t.graphicalItems,i=t.xAxisMap,o=i===void 0?{}:i,l=t.yAxisMap,c=l===void 0?{}:l,u=n.width,h=n.height,d=n.children,f=n.margin||{},m=zn(d,Dd),g=zn(d,Wo),p=Object.keys(c).reduce(function(_,S){var k=c[S],P=k.orientation;return!k.mirror&&!k.hide?de(de({},_),{},De({},P,_[P]+k.width)):_},{left:f.left||0,right:f.right||0}),v=Object.keys(o).reduce(function(_,S){var k=o[S],P=k.orientation;return!k.mirror&&!k.hide?de(de({},_),{},De({},P,ga(_,"".concat(P))+k.height)):_},{top:f.top||0,bottom:f.bottom||0}),x=de(de({},v),p),b=x.bottom;m&&(x.bottom+=m.props.height||Dd.defaultProps.height),g&&r&&(x=eEe(x,s,n,r));var w=u-x.left-x.right,j=h-x.top-x.bottom;return de(de({brushBottom:b},x),{},{width:Math.max(w,0),height:Math.max(j,0)})},G4e=function(t,r){if(r==="xAxis")return t[r].width;if(r==="yAxis")return t[r].height},kW=function(t){var r=t.chartName,n=t.GraphicalChild,s=t.defaultTooltipEventType,i=s===void 0?"axis":s,o=t.validateTooltipEventTypes,l=o===void 0?["axis"]:o,c=t.axisComponents,u=t.legendContent,h=t.formatAxisMap,d=t.defaultProps,f=function(x,b){var w=b.graphicalItems,j=b.stackGroups,_=b.offset,S=b.updateId,k=b.dataStartIndex,P=b.dataEndIndex,C=x.barSize,M=x.layout,I=x.barGap,E=x.barCategoryGap,B=x.maxBarSize,A=U3(M),L=A.numericAxisName,W=A.cateAxisName,D=H4e(w),U=[];return w.forEach(function(R,Q){var K=iw(x.data,{graphicalItems:[R],dataStartIndex:k,dataEndIndex:P}),z=R.type.defaultProps!==void 0?de(de({},R.type.defaultProps),R.props):R.props,N=z.dataKey,T=z.maxBarSize,$=z["".concat(L,"Id")],V=z["".concat(W,"Id")],q={},te=c.reduce(function(ce,ae){var me=b["".concat(ae.axisType,"Map")],xe=z["".concat(ae.axisType,"Id")];me&&me[xe]||ae.axisType==="zAxis"||yc();var pe=me[xe];return de(de({},ce),{},De(De({},ae.axisType,pe),"".concat(ae.axisType,"Ticks"),wi(pe)))},q),X=te[W],ee=te["".concat(W,"Ticks")],ie=j&&j[$]&&j[$].hasStack&&mEe(R,j[$].stackGroups),oe=Si(R.type).indexOf("Bar")>=0,we=Ex(X,ee),O=[],F=D&&JCe({barSize:C,stackGroups:j,totalSize:G4e(te,W)});if(oe){var Z,H,G=Ze(T)?B:T,re=(Z=(H=Ex(X,ee,!0))!==null&&H!==void 0?H:G)!==null&&Z!==void 0?Z:0;O=ZCe({barGap:I,barCategoryGap:E,bandSize:re!==we?re:we,sizeList:F[V],maxBarSize:G}),re!==we&&(O=O.map(function(ce){return de(de({},ce),{},{position:de(de({},ce.position),{},{offset:ce.position.offset-re/2})})}))}var le=R&&R.type&&R.type.getComposedData;le&&U.push({props:de(de({},le(de(de({},te),{},{displayedData:K,props:x,dataKey:N,item:R,bandSize:we,barPosition:O,offset:_,stackedData:ie,layout:M,dataStartIndex:k,dataEndIndex:P}))),{},De(De(De({key:R.key||"item-".concat(Q)},L,te[L]),W,te[W]),"animationId",S)),childIndex:Qpe(R,x.children),item:R})}),U},m=function(x,b){var w=x.props,j=x.dataStartIndex,_=x.dataEndIndex,S=x.updateId;if(!mO({props:w}))return null;var k=w.children,P=w.layout,C=w.stackOffset,M=w.data,I=w.reverseStackOrder,E=U3(P),B=E.numericAxisName,A=E.cateAxisName,L=ya(k,n),W=dEe(M,L,"".concat(B,"Id"),"".concat(A,"Id"),C,I),D=c.reduce(function(z,N){var T="".concat(N.axisType,"Map");return de(de({},z),{},De({},T,W4e(w,de(de({},N),{},{graphicalItems:L,stackGroups:N.axisType===B&&W,dataStartIndex:j,dataEndIndex:_}))))},{}),U=q4e(de(de({},D),{},{props:w,graphicalItems:L}),b==null?void 0:b.legendBBox);Object.keys(D).forEach(function(z){D[z]=h(w,D[z],U,z.replace("Map",""),r)});var R=D["".concat(A,"Map")],Q=V4e(R),K=f(w,de(de({},D),{},{dataStartIndex:j,dataEndIndex:_,updateId:S,graphicalItems:L,stackGroups:W,offset:U}));return de(de({formattedGraphicalItems:K,graphicalItems:L,offset:U,stackGroups:W},Q),D)},g=function(v){function x(b){var w,j,_;return k4e(this,x),_=T4e(this,x,[b]),De(_,"eventEmitterSymbol",Symbol("rechartsEventEmitter")),De(_,"accessibilityManager",new h4e),De(_,"handleLegendBBoxUpdate",function(S){if(S){var k=_.state,P=k.dataStartIndex,C=k.dataEndIndex,M=k.updateId;_.setState(de({legendBBox:S},m({props:_.props,dataStartIndex:P,dataEndIndex:C,updateId:M},de(de({},_.state),{},{legendBBox:S}))))}}),De(_,"handleReceiveSyncEvent",function(S,k,P){if(_.props.syncId===S){if(P===_.eventEmitterSymbol&&typeof _.props.syncMethod!="function")return;_.applySyncEvent(k)}}),De(_,"handleBrushChange",function(S){var k=S.startIndex,P=S.endIndex;if(k!==_.state.dataStartIndex||P!==_.state.dataEndIndex){var C=_.state.updateId;_.setState(function(){return de({dataStartIndex:k,dataEndIndex:P},m({props:_.props,dataStartIndex:k,dataEndIndex:P,updateId:C},_.state))}),_.triggerSyncEvent({dataStartIndex:k,dataEndIndex:P})}}),De(_,"handleMouseEnter",function(S){var k=_.getMouseInfo(S);if(k){var P=de(de({},k),{},{isTooltipActive:!0});_.setState(P),_.triggerSyncEvent(P);var C=_.props.onMouseEnter;Qe(C)&&C(P,S)}}),De(_,"triggeredAfterMouseMove",function(S){var k=_.getMouseInfo(S),P=k?de(de({},k),{},{isTooltipActive:!0}):{isTooltipActive:!1};_.setState(P),_.triggerSyncEvent(P);var C=_.props.onMouseMove;Qe(C)&&C(P,S)}),De(_,"handleItemMouseEnter",function(S){_.setState(function(){return{isTooltipActive:!0,activeItem:S,activePayload:S.tooltipPayload,activeCoordinate:S.tooltipPosition||{x:S.cx,y:S.cy}}})}),De(_,"handleItemMouseLeave",function(){_.setState(function(){return{isTooltipActive:!1}})}),De(_,"handleMouseMove",function(S){S.persist(),_.throttleTriggeredAfterMouseMove(S)}),De(_,"handleMouseLeave",function(S){_.throttleTriggeredAfterMouseMove.cancel();var k={isTooltipActive:!1};_.setState(k),_.triggerSyncEvent(k);var P=_.props.onMouseLeave;Qe(P)&&P(k,S)}),De(_,"handleOuterEvent",function(S){var k=Xpe(S),P=ga(_.props,"".concat(k));if(k&&Qe(P)){var C,M;/.*touch.*/i.test(k)?M=_.getMouseInfo(S.changedTouches[0]):M=_.getMouseInfo(S),P((C=M)!==null&&C!==void 0?C:{},S)}}),De(_,"handleClick",function(S){var k=_.getMouseInfo(S);if(k){var P=de(de({},k),{},{isTooltipActive:!0});_.setState(P),_.triggerSyncEvent(P);var C=_.props.onClick;Qe(C)&&C(P,S)}}),De(_,"handleMouseDown",function(S){var k=_.props.onMouseDown;if(Qe(k)){var P=_.getMouseInfo(S);k(P,S)}}),De(_,"handleMouseUp",function(S){var k=_.props.onMouseUp;if(Qe(k)){var P=_.getMouseInfo(S);k(P,S)}}),De(_,"handleTouchMove",function(S){S.changedTouches!=null&&S.changedTouches.length>0&&_.throttleTriggeredAfterMouseMove(S.changedTouches[0])}),De(_,"handleTouchStart",function(S){S.changedTouches!=null&&S.changedTouches.length>0&&_.handleMouseDown(S.changedTouches[0])}),De(_,"handleTouchEnd",function(S){S.changedTouches!=null&&S.changedTouches.length>0&&_.handleMouseUp(S.changedTouches[0])}),De(_,"handleDoubleClick",function(S){var k=_.props.onDoubleClick;if(Qe(k)){var P=_.getMouseInfo(S);k(P,S)}}),De(_,"handleContextMenu",function(S){var k=_.props.onContextMenu;if(Qe(k)){var P=_.getMouseInfo(S);k(P,S)}}),De(_,"triggerSyncEvent",function(S){_.props.syncId!==void 0&&H1.emit(q1,_.props.syncId,S,_.eventEmitterSymbol)}),De(_,"applySyncEvent",function(S){var k=_.props,P=k.layout,C=k.syncMethod,M=_.state.updateId,I=S.dataStartIndex,E=S.dataEndIndex;if(S.dataStartIndex!==void 0||S.dataEndIndex!==void 0)_.setState(de({dataStartIndex:I,dataEndIndex:E},m({props:_.props,dataStartIndex:I,dataEndIndex:E,updateId:M},_.state)));else if(S.activeTooltipIndex!==void 0){var B=S.chartX,A=S.chartY,L=S.activeTooltipIndex,W=_.state,D=W.offset,U=W.tooltipTicks;if(!D)return;if(typeof C=="function")L=C(U,S);else if(C==="value"){L=-1;for(var R=0;R<U.length;R++)if(U[R].value===S.activeLabel){L=R;break}}var Q=de(de({},D),{},{x:D.left,y:D.top}),K=Math.min(B,Q.x+Q.width),z=Math.min(A,Q.y+Q.height),N=U[L]&&U[L].value,T=kN(_.state,_.props.data,L),$=U[L]?{x:P==="horizontal"?U[L].coordinate:K,y:P==="horizontal"?z:U[L].coordinate}:SW;_.setState(de(de({},S),{},{activeLabel:N,activeCoordinate:$,activePayload:T,activeTooltipIndex:L}))}else _.setState(S)}),De(_,"renderCursor",function(S){var k,P=_.state,C=P.isTooltipActive,M=P.activeCoordinate,I=P.activePayload,E=P.offset,B=P.activeTooltipIndex,A=P.tooltipAxisBandSize,L=_.getTooltipEventType(),W=(k=S.props.active)!==null&&k!==void 0?k:C,D=_.props.layout,U=S.key||"_recharts-cursor";return J.createElement(x4e,{key:U,activeCoordinate:M,activePayload:I,activeTooltipIndex:B,chartName:r,element:S,isActive:W,layout:D,offset:E,tooltipAxisBandSize:A,tooltipEventType:L})}),De(_,"renderPolarAxis",function(S,k,P){var C=ga(S,"type.axisType"),M=ga(_.state,"".concat(C,"Map")),I=S.type.defaultProps,E=I!==void 0?de(de({},I),S.props):S.props,B=M&&M[E["".concat(C,"Id")]];return y.cloneElement(S,de(de({},B),{},{className:nt(C,B.className),key:S.key||"".concat(k,"-").concat(P),ticks:wi(B,!0)}))}),De(_,"renderPolarGrid",function(S){var k=S.props,P=k.radialLines,C=k.polarAngles,M=k.polarRadius,I=_.state,E=I.radiusAxisMap,B=I.angleAxisMap,A=bo(E),L=bo(B),W=L.cx,D=L.cy,U=L.innerRadius,R=L.outerRadius;return y.cloneElement(S,{polarAngles:Array.isArray(C)?C:wi(L,!0).map(function(Q){return Q.coordinate}),polarRadius:Array.isArray(M)?M:wi(A,!0).map(function(Q){return Q.coordinate}),cx:W,cy:D,innerRadius:U,outerRadius:R,key:S.key||"polar-grid",radialLines:P})}),De(_,"renderLegend",function(){var S=_.state.formattedGraphicalItems,k=_.props,P=k.children,C=k.width,M=k.height,I=_.props.margin||{},E=C-(I.left||0)-(I.right||0),B=m9({children:P,formattedGraphicalItems:S,legendWidth:E,legendContent:u});if(!B)return null;var A=B.item,L=L3(B,b4e);return y.cloneElement(A,de(de({},L),{},{chartWidth:C,chartHeight:M,margin:I,onBBoxUpdate:_.handleLegendBBoxUpdate}))}),De(_,"renderTooltip",function(){var S,k=_.props,P=k.children,C=k.accessibilityLayer,M=zn(P,oa);if(!M)return null;var I=_.state,E=I.isTooltipActive,B=I.activeCoordinate,A=I.activePayload,L=I.activeLabel,W=I.offset,D=(S=M.props.active)!==null&&S!==void 0?S:E;return y.cloneElement(M,{viewBox:de(de({},W),{},{x:W.left,y:W.top}),active:D,label:L,payload:D?A:[],coordinate:B,accessibilityLayer:C})}),De(_,"renderBrush",function(S){var k=_.props,P=k.margin,C=k.data,M=_.state,I=M.offset,E=M.dataStartIndex,B=M.dataEndIndex,A=M.updateId;return y.cloneElement(S,{key:S.key||"_recharts-brush",onChange:Jg(_.handleBrushChange,S.props.onChange),data:C,x:Ne(S.props.x)?S.props.x:I.left,y:Ne(S.props.y)?S.props.y:I.top+I.height+I.brushBottom-(P.bottom||0),width:Ne(S.props.width)?S.props.width:I.width,startIndex:E,endIndex:B,updateId:"brush-".concat(A)})}),De(_,"renderReferenceElement",function(S,k,P){if(!S)return null;var C=_,M=C.clipPathId,I=_.state,E=I.xAxisMap,B=I.yAxisMap,A=I.offset,L=S.type.defaultProps||{},W=S.props,D=W.xAxisId,U=D===void 0?L.xAxisId:D,R=W.yAxisId,Q=R===void 0?L.yAxisId:R;return y.cloneElement(S,{key:S.key||"".concat(k,"-").concat(P),xAxis:E[U],yAxis:B[Q],viewBox:{x:A.left,y:A.top,width:A.width,height:A.height},clipPathId:M})}),De(_,"renderActivePoints",function(S){var k=S.item,P=S.activePoint,C=S.basePoint,M=S.childIndex,I=S.isRange,E=[],B=k.props.key,A=k.item.type.defaultProps!==void 0?de(de({},k.item.type.defaultProps),k.item.props):k.item.props,L=A.activeDot,W=A.dataKey,D=de(de({index:M,dataKey:W,cx:P.x,cy:P.y,r:4,fill:yE(k.item),strokeWidth:2,stroke:"#fff",payload:P.payload,value:P.value},rt(L,!1)),Jv(L));return E.push(x.renderActiveDot(L,D,"".concat(B,"-activePoint-").concat(M))),C?E.push(x.renderActiveDot(L,de(de({},D),{},{cx:C.x,cy:C.y}),"".concat(B,"-basePoint-").concat(M))):I&&E.push(null),E}),De(_,"renderGraphicChild",function(S,k,P){var C=_.filterFormatItem(S,k,P);if(!C)return null;var M=_.getTooltipEventType(),I=_.state,E=I.isTooltipActive,B=I.tooltipAxis,A=I.activeTooltipIndex,L=I.activeLabel,W=_.props.children,D=zn(W,oa),U=C.props,R=U.points,Q=U.isRange,K=U.baseLine,z=C.item.type.defaultProps!==void 0?de(de({},C.item.type.defaultProps),C.item.props):C.item.props,N=z.activeDot,T=z.hide,$=z.activeBar,V=z.activeShape,q=!!(!T&&E&&D&&(N||$||V)),te={};M!=="axis"&&D&&D.props.trigger==="click"?te={onClick:Jg(_.handleItemMouseEnter,S.props.onClick)}:M!=="axis"&&(te={onMouseLeave:Jg(_.handleItemMouseLeave,S.props.onMouseLeave),onMouseEnter:Jg(_.handleItemMouseEnter,S.props.onMouseEnter)});var X=y.cloneElement(S,de(de({},C.props),te));function ee(ae){return typeof B.dataKey=="function"?B.dataKey(ae.payload):null}if(q)if(A>=0){var ie,oe;if(B.dataKey&&!B.allowDuplicatedCategory){var we=typeof B.dataKey=="function"?ee:"payload.".concat(B.dataKey.toString());ie=Qv(R,we,L),oe=Q&&K&&Qv(K,we,L)}else ie=R==null?void 0:R[A],oe=Q&&K&&K[A];if(V||$){var O=S.props.activeIndex!==void 0?S.props.activeIndex:A;return[y.cloneElement(S,de(de(de({},C.props),te),{},{activeIndex:O})),null,null]}if(!Ze(ie))return[X].concat(Gd(_.renderActivePoints({item:C,activePoint:ie,basePoint:oe,childIndex:A,isRange:Q})))}else{var F,Z=(F=_.getItemByXY(_.state.activeCoordinate))!==null&&F!==void 0?F:{graphicalItem:X},H=Z.graphicalItem,G=H.item,re=G===void 0?S:G,le=H.childIndex,ce=de(de(de({},C.props),te),{},{activeIndex:le});return[y.cloneElement(re,ce),null,null]}return Q?[X,null,null]:[X,null]}),De(_,"renderCustomized",function(S,k,P){return y.cloneElement(S,de(de({key:"recharts-customized-".concat(P)},_.props),_.state))}),De(_,"renderMap",{CartesianGrid:{handler:ny,once:!0},ReferenceArea:{handler:_.renderReferenceElement},ReferenceLine:{handler:ny},ReferenceDot:{handler:_.renderReferenceElement},XAxis:{handler:ny},YAxis:{handler:ny},Brush:{handler:_.renderBrush,once:!0},Bar:{handler:_.renderGraphicChild},Line:{handler:_.renderGraphicChild},Area:{handler:_.renderGraphicChild},Radar:{handler:_.renderGraphicChild},RadialBar:{handler:_.renderGraphicChild},Scatter:{handler:_.renderGraphicChild},Pie:{handler:_.renderGraphicChild},Funnel:{handler:_.renderGraphicChild},Tooltip:{handler:_.renderCursor,once:!0},PolarGrid:{handler:_.renderPolarGrid,once:!0},PolarAngleAxis:{handler:_.renderPolarAxis},PolarRadiusAxis:{handler:_.renderPolarAxis},Customized:{handler:_.renderCustomized}}),_.clipPathId="".concat((w=b.id)!==null&&w!==void 0?w:Vp("recharts"),"-clip"),_.throttleTriggeredAfterMouseMove=m7(_.triggeredAfterMouseMove,(j=b.throttleDelay)!==null&&j!==void 0?j:1e3/60),_.state={},_}return O4e(x,v),E4e(x,[{key:"componentDidMount",value:function(){var w,j;this.addListener(),this.accessibilityManager.setDetails({container:this.container,offset:{left:(w=this.props.margin.left)!==null&&w!==void 0?w:0,top:(j=this.props.margin.top)!==null&&j!==void 0?j:0},coordinateList:this.state.tooltipTicks,mouseHandlerCallback:this.triggeredAfterMouseMove,layout:this.props.layout}),this.displayDefaultTooltip()}},{key:"displayDefaultTooltip",value:function(){var w=this.props,j=w.children,_=w.data,S=w.height,k=w.layout,P=zn(j,oa);if(P){var C=P.props.defaultIndex;if(!(typeof C!="number"||C<0||C>this.state.tooltipTicks.length-1)){var M=this.state.tooltipTicks[C]&&this.state.tooltipTicks[C].value,I=kN(this.state,_,C,M),E=this.state.tooltipTicks[C].coordinate,B=(this.state.offset.top+S)/2,A=k==="horizontal",L=A?{x:E,y:B}:{y:E,x:B},W=this.state.formattedGraphicalItems.find(function(U){var R=U.item;return R.type.name==="Scatter"});W&&(L=de(de({},L),W.props.points[C].tooltipPosition),I=W.props.points[C].tooltipPayload);var D={activeTooltipIndex:C,isTooltipActive:!0,activeLabel:M,activePayload:I,activeCoordinate:L};this.setState(D),this.renderCursor(P),this.accessibilityManager.setIndex(C)}}}},{key:"getSnapshotBeforeUpdate",value:function(w,j){if(!this.props.accessibilityLayer)return null;if(this.state.tooltipTicks!==j.tooltipTicks&&this.accessibilityManager.setDetails({coordinateList:this.state.tooltipTicks}),this.props.layout!==w.layout&&this.accessibilityManager.setDetails({layout:this.props.layout}),this.props.margin!==w.margin){var _,S;this.accessibilityManager.setDetails({offset:{left:(_=this.props.margin.left)!==null&&_!==void 0?_:0,top:(S=this.props.margin.top)!==null&&S!==void 0?S:0}})}return null}},{key:"componentDidUpdate",value:function(w){aS([zn(w.children,oa)],[zn(this.props.children,oa)])||this.displayDefaultTooltip()}},{key:"componentWillUnmount",value:function(){this.removeListener(),this.throttleTriggeredAfterMouseMove.cancel()}},{key:"getTooltipEventType",value:function(){var w=zn(this.props.children,oa);if(w&&typeof w.props.shared=="boolean"){var j=w.props.shared?"axis":"item";return l.indexOf(j)>=0?j:i}return i}},{key:"getMouseInfo",value:function(w){if(!this.container)return null;var j=this.container,_=j.getBoundingClientRect(),S=_Se(_),k={chartX:Math.round(w.pageX-S.left),chartY:Math.round(w.pageY-S.top)},P=_.width/j.offsetWidth||1,C=this.inRange(k.chartX,k.chartY,P);if(!C)return null;var M=this.state,I=M.xAxisMap,E=M.yAxisMap,B=this.getTooltipEventType(),A=z3(this.state,this.props.data,this.props.layout,C);if(B!=="axis"&&I&&E){var L=bo(I).scale,W=bo(E).scale,D=L&&L.invert?L.invert(k.chartX):null,U=W&&W.invert?W.invert(k.chartY):null;return de(de({},k),{},{xValue:D,yValue:U},A)}return A?de(de({},k),A):null}},{key:"inRange",value:function(w,j){var _=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,S=this.props.layout,k=w/_,P=j/_;if(S==="horizontal"||S==="vertical"){var C=this.state.offset,M=k>=C.left&&k<=C.left+C.width&&P>=C.top&&P<=C.top+C.height;return M?{x:k,y:P}:null}var I=this.state,E=I.angleAxisMap,B=I.radiusAxisMap;if(E&&B){var A=bo(E);return SM({x:k,y:P},A)}return null}},{key:"parseEventsOfWrapper",value:function(){var w=this.props.children,j=this.getTooltipEventType(),_=zn(w,oa),S={};_&&j==="axis"&&(_.props.trigger==="click"?S={onClick:this.handleClick}:S={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 k=Jv(this.props,this.handleOuterEvent);return de(de({},k),S)}},{key:"addListener",value:function(){H1.on(q1,this.handleReceiveSyncEvent)}},{key:"removeListener",value:function(){H1.removeListener(q1,this.handleReceiveSyncEvent)}},{key:"filterFormatItem",value:function(w,j,_){for(var S=this.state.formattedGraphicalItems,k=0,P=S.length;k<P;k++){var C=S[k];if(C.item===w||C.props.key===w.key||j===Si(C.item.type)&&_===C.childIndex)return C}return null}},{key:"renderClipPath",value:function(){var w=this.clipPathId,j=this.state.offset,_=j.left,S=j.top,k=j.height,P=j.width;return J.createElement("defs",null,J.createElement("clipPath",{id:w},J.createElement("rect",{x:_,y:S,height:k,width:P})))}},{key:"getXScales",value:function(){var w=this.state.xAxisMap;return w?Object.entries(w).reduce(function(j,_){var S=D3(_,2),k=S[0],P=S[1];return de(de({},j),{},De({},k,P.scale))},{}):null}},{key:"getYScales",value:function(){var w=this.state.yAxisMap;return w?Object.entries(w).reduce(function(j,_){var S=D3(_,2),k=S[0],P=S[1];return de(de({},j),{},De({},k,P.scale))},{}):null}},{key:"getXScaleByAxisId",value:function(w){var j;return(j=this.state.xAxisMap)===null||j===void 0||(j=j[w])===null||j===void 0?void 0:j.scale}},{key:"getYScaleByAxisId",value:function(w){var j;return(j=this.state.yAxisMap)===null||j===void 0||(j=j[w])===null||j===void 0?void 0:j.scale}},{key:"getItemByXY",value:function(w){var j=this.state,_=j.formattedGraphicalItems,S=j.activeItem;if(_&&_.length)for(var k=0,P=_.length;k<P;k++){var C=_[k],M=C.props,I=C.item,E=I.type.defaultProps!==void 0?de(de({},I.type.defaultProps),I.props):I.props,B=Si(I.type);if(B==="Bar"){var A=(M.data||[]).find(function(U){return cPe(w,U)});if(A)return{graphicalItem:C,payload:A}}else if(B==="RadialBar"){var L=(M.data||[]).find(function(U){return SM(w,U)});if(L)return{graphicalItem:C,payload:L}}else if(Zb(C,S)||ew(C,S)||rp(C,S)){var W=hOe({graphicalItem:C,activeTooltipItem:S,itemData:E.data}),D=E.activeIndex===void 0?W:E.activeIndex;return{graphicalItem:de(de({}
944,C),{},{childIndex:D}),payload:rp(C,S)?E.data[W]:C.props.data[W]}}}return null}},{key:"render",value:function(){var w=this;if(!mO(this))return null;var j=this.props,_=j.children,S=j.className,k=j.width,P=j.height,C=j.style,M=j.compact,I=j.title,E=j.desc,B=L3(j,w4e),A=rt(B,!1);if(M)return J.createElement(x3,{state:this.state,width:this.props.width,height:this.props.height,clipPathId:this.clipPathId},J.createElement(iS,ku({},A,{width:k,height:P,title:I,desc:E}),this.renderClipPath(),gO(_,this.renderMap)));if(this.props.accessibilityLayer){var L,W;A.tabIndex=(L=this.props.tabIndex)!==null&&L!==void 0?L:0,A.role=(W=this.props.role)!==null&&W!==void 0?W:"application",A.onKeyDown=function(U){w.accessibilityManager.keyboardEvent(U)},A.onFocus=function(){w.accessibilityManager.focus()}}var D=this.parseEventsOfWrapper();return J.createElement(x3,{state:this.state,width:this.props.width,height:this.props.height,clipPathId:this.clipPathId},J.createElement("div",ku({className:nt("recharts-wrapper",S),style:de({position:"relative",cursor:"default",width:k,height:P},C)},D,{ref:function(R){w.container=R}}),J.createElement(iS,ku({},A,{width:k,height:P,title:I,desc:E,style:L4e}),this.renderClipPath(),gO(_,this.renderMap)),this.renderLegend(),this.renderTooltip()))}}])}(y.Component);De(g,"displayName",r),De(g,"defaultProps",de({layout:"horizontal",stackOffset:"none",barCategoryGap:"10%",barGap:4,margin:{top:5,right:5,bottom:5,left:5},reverseStackOrder:!1,syncMethod:"index"},d)),De(g,"getDerivedStateFromProps",function(v,x){var b=v.dataKey,w=v.data,j=v.children,_=v.width,S=v.height,k=v.layout,P=v.stackOffset,C=v.margin,M=x.dataStartIndex,I=x.dataEndIndex;if(x.updateId===void 0){var E=B3(v);return de(de(de({},E),{},{updateId:0},m(de(de({props:v},E),{},{updateId:0}),x)),{},{prevDataKey:b,prevData:w,prevWidth:_,prevHeight:S,prevLayout:k,prevStackOffset:P,prevMargin:C,prevChildren:j})}if(b!==x.prevDataKey||w!==x.prevData||_!==x.prevWidth||S!==x.prevHeight||k!==x.prevLayout||P!==x.prevStackOffset||!Bu(C,x.prevMargin)){var B=B3(v),A={chartX:x.chartX,chartY:x.chartY,isTooltipActive:x.isTooltipActive},L=de(de({},z3(x,w,k)),{},{updateId:x.updateId+1}),W=de(de(de({},B),A),L);return de(de(de({},W),m(de({props:v},W),x)),{},{prevDataKey:b,prevData:w,prevWidth:_,prevHeight:S,prevLayout:k,prevStackOffset:P,prevMargin:C,prevChildren:j})}if(!aS(j,x.prevChildren)){var D,U,R,Q,K=zn(j,Dd),z=K&&(D=(U=K.props)===null||U===void 0?void 0:U.startIndex)!==null&&D!==void 0?D:M,N=K&&(R=(Q=K.props)===null||Q===void 0?void 0:Q.endIndex)!==null&&R!==void 0?R:I,T=z!==M||N!==I,$=!Ze(w),V=$&&!T?x.updateId:x.updateId+1;return de(de({updateId:V},m(de(de({props:v},x),{},{updateId:V,dataStartIndex:z,dataEndIndex:N}),x)),{},{prevChildren:j,dataStartIndex:z,dataEndIndex:N})}return null}),De(g,"renderActiveDot",function(v,x,b){var w;return y.isValidElement(v)?w=y.cloneElement(v,x):Qe(v)?w=v(x):w=J.createElement(xE,x),J.createElement(rr,{className:"recharts-active-dot",key:b},w)});var p=y.forwardRef(function(x,b){return J.createElement(g,ku({},x,{ref:b}))});return p.displayName=g.displayName,p},CW=kW({chartName:"LineChart",GraphicalChild:Ci,axisComponents:[{axisType:"xAxis",AxisComp:Ei},{axisType:"yAxis",AxisComp:Ti}],formatAxisMap:V9}),CN=kW({chartName:"BarChart",GraphicalChild:Ui,defaultTooltipEventType:"axis",validateTooltipEventTypes:["axis","item"],axisComponents:[{axisType:"xAxis",AxisComp:Ei},{axisType:"yAxis",AxisComp:Ti}],formatAxisMap:V9});function K4e(){const[e,t]=y.useState("7"),[r,n]=y.useState("all"),[s,i]=y.useState({totalSent:0,delivered:0,opened:0,clicked:0,bounced:0,openRate:0,clickRate:0,bounceRate:0}),[o,l]=y.useState([]),[c,u]=y.useState([]),[h,d]=y.useState(!0),[f,m]=y.useState([]);y.useEffect(()=>{g()},[e,r]);const g=async()=>{d(!0);try{const{data:{user:x}}=await ne.auth.getUser();if(!x)return;const b=new Date;b.setDate(b.getDate()-parseInt(e));let w=ne.from("email_analytics").select("*").eq("user_id",x.id).gte("created_at",b.toISOString());r!=="all"&&(w=w.eq("notification_type",r));const{data:j,error:_}=await w;if(_)throw _;m(j||[]);
944const S=(j==null?void 0:j.filter(B=>B.event_type==="sent").length)||0,k=(j==null?void 0:j.filter(B=>B.event_type==="delivered").length)||0,P=(j==null?void 0:j.filter(B=>B.event_type==="opened").length)||0,C=(j==null?void 0:j.filter(B=>B.event_type==="clicked").length)||0,M=(j==null?void 0:j.filter(B=>B.event_type==="bounced").length)||0;i({totalSent:S,delivered:k,opened:P,clicked:C,bounced:M,openRate:k>0?Math.round(P/k*100):0,clickRate:P>0?Math.round(C/P*100):0,bounceRate:S>0?Math.round(M/S*100):0});const I=p(j||[]);l(I);const E=v(j||[]);u(E)}catch(x){console.error("Error fetching analytics:",x)}finally{d(!1)}},p=x=>{const b=parseInt(e),w=[];for(let j=b-1;j>=0;j--){const _=new Date;_.setDate(_.getDate()-j);const S=_.toISOString().split("T")[0],k=x.filter(P=>P.created_at.startsWith(S));w.push({date:_.toLocaleDateString("en-US",{month:"short",day:"numeric"}),sent:k.filter(P=>P.event_type==="sent").length,opened:k.filter(P=>P.event_type==="opened").length,clicked:k.filter(P=>P.event_type==="clicked").length})}return w},v=x=>["challenge_completed","challenge_created","challenge_expiring","member_contribution","daily_digest"].map(w=>{const j=x.filter(k=>k.notification_type===w),_=j.filter(k=>k.event_type==="opened").length,S=j.filter(k=>k.event_type==="delivered").length;return{name:w.replace(/_/g," ").replace(/\b\w/g,k=>k.toUpperCase()),value:S,engagement:S>0?Math.round(_/S*100):0}}).filter(w=>w.value>0);return a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 justify-between",children:[a.jsxs("div",{children:[a.jsx("h2",{className:"text-2xl font-bold",children:"Email Analytics"}),a.jsx("p",{className:"text-muted-foreground",children:"Track your email performance and engagement"})]}),a.jsxs("div",{className:"flex gap-2",children:[a.jsxs(Nr,{value:e,onValueChange:t,children:[a.jsx(gr,{className:"w-[140px]",children:a.jsx(kr,{})}),a.jsxs(yr,{children:[a.jsx(Le,{value:"7",children:"Last 7 days"}),a.jsx(Le,{value:"30",children:"Last 30 days"}),a.jsx(Le,{value:"90",children:"Last 90 days"})]})]}),a.jsxs(Nr,{value:r,onValueChange:n,children:[a.jsx(gr,{className:"w-[180px]",children:a.jsx(kr,{})}),a.jsxs(yr,{children:[a.jsx(Le,{value:"all",children:"All Types"}),a.jsx(Le,{value:"challenge_completed",children:"Challenge Completed"}),a.jsx(Le,{value:"challenge_created",children:"New Challenge"}),a.jsx(Le,{value:"challenge_expiring",children:"Challenge Expiring"}),a.jsx(Le,{value:"member_contribution",children:"Contributions"}),a.jsx(Le,{value:"daily_digest",children:"Daily Digest"})]})]})]})]}),a.jsx(she,{rawData:f,dateRange:e,notificationType:r}),a.jsxs("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-4",children:[a.jsx(Wg,{title:"Total Sent",value:s.totalSent,icon:a.jsx(gd,{className:"h-4 w-4 text-muted-foreground"})}),a.jsx(Wg,{title:"Open Rate",value:`${s.openRate}%`,icon:a.jsx(fa,{className:"h-4 w-4 text-muted-foreground"}),trend:s.openRate>=20?"up":"down"}),a.jsx(Wg,{title:"Click Rate",value:`${s.clickRate}%`,icon:a.jsx($K,{className:"h-4 w-4 text-muted-foreground"}),trend:s.clickRate>=10?"up":"down"}),a.jsx(Wg,{title:"Bounce Rate",value:`${s.bounceRate}%`,icon:a.jsx(cn,{className:"h-4 w-4 text-muted-foreground"}),trend:s.bounceRate<=5?"up":"down"})]}),a.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[a.jsxs(se,{children:[a.jsx(_e,{children:a.jsx(Se,{children:"Email Performance Over Time"})}),a.jsx(ue,{children:a.jsx(Uu,{width:"100%",height:300,children:a.jsxs(CW,{data:o,children:[a.jsx(Hu,{strokeDasharray:"3 3"}),a.jsx(Ei,{dataKey:"date"}),a.jsx(Ti,{}),a.jsx(oa,{}),a.jsx(Wo,{}),a.jsx(Ci,{type:"monotone",dataKey:"sent",stroke:"#3b82f6",name:"Sent"}),a.jsx(Ci,{type:"monotone",dataKey:"opened",stroke:"#10b981",name:"Opened"}),a.jsx(Ci,{type:"monotone",dataKey:"clicked",stroke:"#f59e0b",name:"Clicked"})]})})})]}),a.jsxs(se,{children:[a.jsx(_e,{children:a.jsx(Se,{children:"Engagement by Notification Type"})}),a.jsx(ue,{children:a.jsx(Uu,{width:"100%",height:300,children:a.jsxs(CN,{data:c,children:[a.jsx(Hu,{strokeDasharray:"3 3"}),a.jsx(Ei,{dataKey:"name",angle:-45,textAnchor:"end",height:100}),a.jsx(Ti,{}),a.jsx(oa,{}),a.jsx(Wo,{}),a.jsx(Ui,{dataKey:"engagement",fill:"#3b82f6",name:"Open Rate %"})]})})})]})]})]})}const ms=y.forwardRef(({className:e,...t},r)=>a.jsx("textarea",{className:je("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm r
944ing-offset-background placeholder:text-muted-foreground/60 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-primary focus-visible:border-primary/50 disabled:cursor-not-allowed disabled:opacity-50 transition-colors resize-none",e),ref:r,...t}));ms.displayName="Textarea";function K1({variables:e,onInsert:t}){return a.jsxs(zv,{children:[a.jsx(Bv,{asChild:!0,children:a.jsxs(Y,{variant:"outline",size:"sm",children:[a.jsx(NK,{className:"w-4 h-4 mr-2"}),"Insert Variable"]})}),a.jsx(wm,{className:"w-64",children:a.jsxs("div",{className:"space-y-2",children:[a.jsx("p",{className:"text-sm font-medium",children:"Available Variables"}),a.jsx("div",{className:"grid gap-2",children:e.map(r=>a.jsx(Y,{variant:"ghost",size:"sm",className:"justify-start font-mono text-xs",onClick:()=>t(`{{${r}}}`),children:`{{${r}}}`},r))})]})})]})}const Y4e=[{value:"daily_digest",label:"Daily Digest"},{value:"friend_request",label:"Friend Request"},{value:"challenge_invite",label:"Challenge Invite"},{value:"team_invite",label:"Team Invite"},{value:"achievement_unlock",label:"Achievement Unlocked"},{value:"streak_milestone",label:"Streak Milestone"}],ay={daily_digest:["username","xp_earned","lessons_completed","streak_days","app_url"],friend_request:["recipient_name","sender_name","accept_url","app_url"],challenge_invite:["username","challenge_name","challenge_description","duration","join_url"],team_invite:["username","team_name","inviter_name","join_url","app_url"],achievement_unlock:["username","achievement_name","achievement_description","badge_url","app_url"],streak_milestone:["username","streak_days","reward_xp","app_url"]};function X4e(){const[e,t]=y.useState([]),[r,n]=y.useState(""),[s,i]=y.useState(""),[o,l]=y.useState("daily_digest"),[c,u]=y.useState(""),[h,d]=y.useState(""),[f,m]=y.useState(""),[g,p]=y.useState(!1),[v,x]=y.useState(!1),{toast:b}=ta();y.useEffect(()=>{w()},[]);const w=async()=>{const C=await $le();t(C)},j=C=>{const M=e.find(I=>I.id===C);M&&(n(M.id),i(M.template_name),l(M.template_type),u(M.subject),d(M.html_content),m(M.text_content||""),p(M.is_active))},_=async()=>{const C={template_name:s,template_type:o,subject:c,html_content:h,text_content:f,variables:ay[o],is_active:g};let M;r?(M=await Dle(r,C),g&&await Lle(r,o)):M=await Ile(C),M?(b({title:"Template saved successfully!"}),w()):b({title:"Failed to save template",variant:"destructive"})},S=()=>{n(""),i(""),u(""),d(""),m(""),p(!1)},k=(C,M)=>{M==="subject"?u(I=>I+C):M==="html"?d(I=>I+C):m(I=>I+C)},P=()=>Rf(h,{username:"John Doe",xp_earned:"250",lessons_completed:"5",streak_days:"7",sender_name:"Jane Smith",recipient_name:"John Doe",challenge_name:"Weekly Quiz Master",challenge_description:"Complete 10 quizzes this week",duration:"7 days",team_name:"Malayalam Masters",inviter_name:"Sarah Johnson",achievement_name:"First Steps",achievement_description:"Complete your first lesson",reward_xp:"100",app_url:"https://app.example.com",accept_url:"https://app.example.com/accept",join_url:"https://app.example.com/join",badge_url:"https://app.example.com/badge.png"});return a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"flex justify-between items-center",children:[a.jsxs("div",{children:[a.jsx("h2",{className:"text-2xl font-bold",children:"Email Template Editor"}),a.jsx("p",{className:"text-muted-foreground",children:"Customize notification email templates"})]}),a.jsxs("div",{className:"flex gap-2",children:[a.jsxs(Y,{onClick:S,variant:"outline",children:[a.jsx(Ep,{className:"w-4 h-4 mr-2"}),"New Template"]}),a.jsxs(Y,{onClick:_,children:[a.jsx(zK,{className:"w-4 h-4 mr-2"}),"Save Template"]})]})]}),a.jsxs(se,{children:[a.jsxs(_e,{children:[a.jsx(Se,{children:"Template Settings"}),a.jsx(hr,{children:"Configure template details and content"})]}),a.jsxs(ue,{className:"space-y-4",children:[a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(Re,{children:"Load Existing Template"}),a.jsxs(Nr,{value:r,onValueChange:j,children:[a.jsx(gr,{children:a.jsx(kr,{placeholder:"Select a template..."})}),a.jsx(yr,{children:e.map(C=>a.jsxs(Le,{value:C.id,children:[C.template_name," ",C.is_active&&a.jsx(ke,{className:"ml-2",children:"Active"})]},C.id))})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(Re,{children:"Template Type"}),a.jsxs(Nr,{value:o,onValueChange:l,children:[a.jsx(gr,{children:a.jsx(kr,{})}),a.jsx(yr,{children:Y4e.map(C=>a.jsx(Le,{value:C.value,children:C.label},C.value))})]})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(Re,{children:"Template Name"}),a.jsx(Je,{value:s,onChange:C=>i(C.target.value),placeholder:"My Custom Template"})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex justify-between items-center",children:[a.jsx(Re,{children:"Email Subject"}),a.jsx(K1,{variables:ay[o],onInsert:C=>k(C,"subject")})]}),a.jsx(Je,{value:c,onChange:C=>u(C.target.value),placeholder:"Your subject line..."})]}),a.jsxs(Pn,{defaultValue:"html",children:[a.jsx("div",{className:"flex justify-between items-center mb-2",children:a.jsxs(fn,{children:[a.jsx(Oe,{value:"html",children:"HTML Content"}),a.jsx(Oe,{value:"text",children:"Plain Text"}),a.jsx(Oe,{value:"preview",children:"Preview"})]})}),a.jsxs(ze,{value:"html",className:"space-y-2",children:[a.jsxs("div",{className:"flex justify-between",children:[a.jsx(Re,{children:"HTML Content"}),a.jsx(K1,{variables:ay[o],onInsert:C=>k(C,"html")})]}),a.jsx(ms,{value:h,onChange:C=>d(C.target.value),placeholder:"Enter HTML content...",className:"min-h-[400px] font-mono text-sm"})]}),a.jsxs(ze,{value:"text",className:"space-y-2",children:[a.jsxs("div",{className:"flex justify-between",children:[a.jsx(Re,{children:"Plain Text Content"}),a.jsx(K1,{variables:ay[o],onInsert:C=>k(C,"text")})]}),a.jsx(ms,{value:f,onChange:C=>m(C.target.value),placeholder:"Enter plain text content...",className:"min-h-[400px]"})]}),a.jsx(ze,{value:"preview",children:a.jsxs("div",{className:"border rounded-lg p-4 bg-white min-h-[400px]",children:[a.jsxs("div",{className:"mb-4 pb-4 border-b",children:[a.jsx("p",{className:"text-sm text-muted-foreground",children:"Subject:"}),a.jsx("p",{className:"font-medium",children:Rf(c,{username:"John Doe",challenge_name:"Sample Challenge"})})]}),a.jsx("div",{dangerouslySetInnerHTML:{__html:P()}})]})})]}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(_n,{checked:g,onCheckedChange:p}),a.jsx(Re,{children:"Set as active template for this notification type"})]})]})]})]})}var EW=["PageUp","PageDown"],TW=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],AW={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},kh="Slider",[EN,Q4e,J4e]=eh(kh),[PW]=Cr(kh,[J4e]),[Z4e,ow]=PW(kh),OW=y.forwardRef((e,t)=>
944{const{name:r,min:n=0,max:s=100,step:i=1,orientation:o="horizontal",disabled:l=!1,minStepsBetweenThumbs:c=0,defaultValue:u=[n],value:h,onValueChange:d=()=>{},onValueCommit:f=()=>{},inverted:m=!1,form:g,...p}=e,v=y.useRef(new Set),x=y.useRef(0),w=o==="horizontal"?eRe:tRe,[j=[],_]=ln({prop:h,defaultProp:u,onChange:I=>{var B;(B=[...v.current][x.current])==null||B.focus(),d(I)}}),S=y.useRef(j);function k(I){const E=iRe(j,I);M(I,E)}function P(I){M(I,x.current)}function C(){const I=S.current[x.current];j[x.current]!==I&&f(j)}function M(I,E,{commit:B}={commit:!1}){const A=uRe(i),L=dRe(Math.round((I-n)/i)*i+n,A),W=jm(L,[n,s]);_((D=[])=>{const U=aRe(D,W,E);if(cRe(U,c*i)){x.current=U.indexOf(W);const R=String(U)!==String(D);return R&&B&&f(U),R?U:D}else return D})}return a.jsx(Z4e,{scope:e.__scopeSlider,name:r,disabled:l,min:n,max:s,valueIndexToChangeRef:x,thumbs:v.current,values:j,orientation:o,form:g,children:a.jsx(EN.Provider,{scope:e.__scopeSlider,children:a.jsx(EN.Slot,{scope:e.__scopeSlider,children:a.jsx(w,{"aria-disabled":l,"data-disabled":l?"":void 0,...p,ref:t,onPointerDown:ye(p.onPointerDown,()=>{l||(S.current=j)}),min:n,max:s,inverted:m,onSlideStart:l?void 0:k,onSlideMove:l?void 0:P,onSlideEnd:l?void 0:C,onHomeKeyDown:()=>!l&&M(n,0,{commit:!0}),onEndKeyDown:()=>!l&&M(s,j.length-1,{commit:!0}),onStepKeyDown:({event:I,direction:E})=>{if(!l){const L=EW.includes(I.key)||I.shiftKey&&TW.includes(I.key)?10:1,W=x.current,D=j[W],U=i*L*E;M(D+U,W,{commit:!0})}}})})})})});OW.displayName=kh;var[MW,RW]=PW(kh,{startEdge:"left",endEdge:"right",size:"width",direction:1}),eRe=y.forwardRef((e,t)=>{const{min:r,max:n,dir:s,inverted:i,onSlideStart:o,onSlideMove:l,onSlideEnd:c,onStepKeyDown:u,...h}=e,[d,f]=y.useState(null),m=$e(t,w=>f(w)),g=y.useRef(void 0),p=Pc(s),v=p==="ltr",x=v&&!i||!v&&i;function b(w){const j=g.current||d.getBoundingClientRect(),_=[0,j.width],k=TE(_,x?[r,n]:[n,r]);return g.current=j,k(w-j.left)}return a.jsx(MW,{scope:e.__scopeSlider,startEdge:x?"left":"right",endEdge:x?"right":"left",direction:x?1:-1,size:"width",children:a.jsx($W,{dir:p,"data-orientation":"horizontal",...h,ref:m,style:{...h.style,"--radix-slider-thumb-transform":"translateX(-50%)"},onSlideStart:w=>{const j=b(w.clientX);o==null||o(j)},onSlideMove:w=>{const j=b(w.clientX);l==null||l(j)},onSlideEnd:()=>{g.current=void 0,c==null||c()},onStepKeyDown:w=>{const _=AW[x?"from-left":"from-right"].includes(w.key);u==null||u({event:w,direction:_?-1:1})}})})}),tRe=y.forwardRef((e,t)=>{const{min:r,max:n,inverted:s,onSlideStart:i,onSlideMove:o,onSlideEnd:l,onStepKeyDown:c,...u}=e,h=y.useRef(null),d=$e(t,h),f=y.useRef(void 0),m=!s;function g(p){const v=f.current||h.current.getBoundingClientRect(),x=[0,v.height],w=TE(x,m?[n,r]:[r,n]);return f.current=v,w(p-v.top)}return a.jsx(MW,{scope:e.__scopeSlider,startEdge:m?"bottom":"top",endEdge:m?"top":"bottom",size:"height",direction:m?1:-1,children:a.jsx($W,{"data-orientation":"vertical",...u,ref:d,style:{...u.style,"--radix-slider-thumb-transform":"translateY(50%)"},onSlideStart:p=>{const v=g(p.clientY);i==null||i(v)},onSlideMove:p=>{const v=g(p.clientY);o==null||o(v)},onSlideEnd:()=>{f.current=void 0,l==null||l()},onStepKeyDown:p=>{const x=AW[m?"from-bottom":"from-top"].includes(p.key);c==null||c({event:p,direction:x?-1:1})}})})}),$W=y.forwardRef((e,t)=>{const{__scopeSlider:r,onSlideStart:n,onSlideMove:s,onSlideEnd:i,onHomeKeyDown:o,onEndKeyDown:l,onStepKeyDown:c,...u}=e,h=ow(kh,r);return a.jsx(Ce.span,{...u,ref:t,onKeyDown:ye(e.onKeyDown,d=>{d.key==="Home"?(o(d),d.preventDefault()):d.key==="End"?(l(d),d.preventDefault()):EW.concat(TW).includes(d.key)&&(c(d),d.preventDefault())}),onPointerDown:ye(e.onPointerDown,d=>{const f=d.target;f.setPointerCapture(d.pointerId),d.preventDefault(),h.thumbs.has(f)?f.focus():n(d)}),onPointerMove:ye(e.onPointerMove,d=>{d.target.hasPointerCapture(d.pointerId)&&s(d)}),onPointerUp:ye(e.onPointerUp,d=>{const f=d.target;f.hasPointerCapture(d.pointerId)&&(f.releasePointerCapture(d.pointerId),i(d))})})}),IW="SliderTrack",DW=y.forwardRef((e,t)=>{const{__scopeSlider:r,...n}=e,s=ow(IW,r);return a.jsx(Ce.span,{"data-disabled":s.disabled?"":void 0,"data-orientation":s.orientation,...n,ref:t})});DW.displayName=IW;var TN="SliderRange",LW=y.forwardRef((e,t)=>
944{const{__scopeSlider:r,...n}=e,s=ow(TN,r),i=RW(TN,r),o=y.useRef(null),l=$e(t,o),c=s.values.length,u=s.values.map(f=>BW(f,s.min,s.max)),h=c>1?Math.min(...u):0,d=100-Math.max(...u);return a.jsx(Ce.span,{"data-orientation":s.orientation,"data-disabled":s.disabled?"":void 0,...n,ref:l,style:{...e.style,[i.startEdge]:h+"%",[i.endEdge]:d+"%"}})});LW.displayName=TN;var AN="SliderThumb",FW=y.forwardRef((e,t)=>{const r=Q4e(e.__scopeSlider),[n,s]=y.useState(null),i=$e(t,l=>s(l)),o=y.useMemo(()=>n?r().findIndex(l=>l.ref.current===n):-1,[r,n]);return a.jsx(rRe,{...e,ref:i,index:o})}),rRe=y.forwardRef((e,t)=>{const{__scopeSlider:r,index:n,name:s,...i}=e,o=ow(AN,r),l=RW(AN,r),[c,u]=y.useState(null),h=$e(t,b=>u(b)),d=c?o.form||!!c.closest("form"):!0,f=A0(c),m=o.values[n],g=m===void 0?0:BW(m,o.min,o.max),p=sRe(n,o.values.length),v=f==null?void 0:f[l.size],x=v?oRe(v,g,l.direction):0;return y.useEffect(()=>{if(c)return o.thumbs.add(c),()=>{o.thumbs.delete(c)}},[c,o.thumbs]),a.jsxs("span",{style:{transform:"var(--radix-slider-thumb-transform)",position:"absolute",[l.startEdge]:`calc(${g}% + ${x}px)`},children:[a.jsx(EN.ItemSlot,{scope:e.__scopeSlider,children:a.jsx(Ce.span,{role:"slider","aria-label":e["aria-label"]||p,"aria-valuemin":o.min,"aria-valuenow":m,"aria-valuemax":o.max,"aria-orientation":o.orientation,"data-orientation":o.orientation,"data-disabled":o.disabled?"":void 0,tabIndex:o.disabled?void 0:0,...i,ref:h,style:m===void 0?{display:"none"}:e.style,onFocus:ye(e.onFocus,()=>{o.valueIndexToChangeRef.current=n})})}),d&&a.jsx(zW,{name:s??(o.name?o.name+(o.values.length>1?"[]":""):void 0),form:o.form,value:m},n)]})});FW.displayName=AN;var nRe="RadioBubbleInput",zW=y.forwardRef(({__scopeSlider:e,value:t,...r},n)=>{const s=y.useRef(null),i=$e(s,n),o=db(t);return y.useEffect(()=>{const l=s.current;if(!l)return;const c=window.HTMLInputElement.prototype,h=Object.getOwnPropertyDescriptor(c,"value").set;if(o!==t&&h){const d=new Event("input",{bubbles:!0});h.call(l,t),l.dispatchEvent(d)}},[o,t]),a.jsx(Ce.input,{style:{display:"none"},...r,ref:i,defaultValue:t})});zW.displayName=nRe;function aRe(e=[],t,r){const n=[...e];return n[r]=t,n.sort((s,i)=>s-i)}function BW(e,t,r){const i=100/(r-t)*(e-t);return jm(i,[0,100])}function sRe(e,t){return t>2?`Value ${e+1} of ${t}`:t===2?["Minimum","Maximum"][e]:void 0}function iRe(e,t){if(e.length===1)return 0;const r=e.map(s=>Math.abs(s-t)),n=Math.min(...r);return r.indexOf(n)}function oRe(e,t,r){const n=e/2,i=TE([0,50],[0,n]);return(n-i(t)*r)*r}function lRe(e){return e.slice(0,-1).map((t,r)=>e[r+1]-t)}function cRe(e,t){if(t>0){const r=lRe(e);return Math.min(...r)>=t}return!0}function TE(e,t){return r=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const n=(t[1]-t[0])/(e[1]-e[0]);return t[0]+n*(r-e[0])}}function uRe(e){return(String(e).split(".")[1]||"").length}function dRe(e,t){const r=Math.pow(10,t);return Math.round(e*r)/r}var UW=OW,hRe=DW,fRe=LW,mRe=FW;const Za=y.forwardRef(({className:e,...t},r)=>a.jsxs(UW,{ref:r,className:je("relative flex w-full touch-none select-none items-center",e),...t,children:[a.jsx(hRe,{className:"relative h-1.5 w-full grow overflow-hidden rounded-full bg-secondary/50",children:a.jsx(fRe,{className:"absolute h-full bg-primary"})}),a.jsx(mRe,{className:"block h-4 w-4 rounded-full border border-primary/50 bg-background shadow-sm ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 hover:border-primary hover:scale-110"})]}));Za.displayName=UW.displayName;function pRe({onTestCreated:e}){const[t,r]=y.useState([]),[n,s]=y.useState(""),[i,o]=y.useState(""),[l,c]=y.useState(""),[u,h]=y.useState(""),[d,f]=y.useState(50),[m,g]=y.useState(100),{toast:p}=ta();y.useEffect(()=>{v()},[]);const v=async()=>{const{data:w}=await ne.from("email_templates").select("id, name, template_type").order("name");w&&r(w)},x=async()=>{if(!n||!l||!u){p({title:"Please fill all fields",variant:"destructive"});return}const{error:w}=await ne.from("email_template_tests").insert({name:n,template_type:i,variant_a_id:l,variant_b_id:u,traffic_split_a:d,traffic_split_b:100-d,min_sample_size:m,status:"active"});w?p({title:"Error creating test",variant:"destructive"}):(p({title:"A/B test created successfully!"}),s(""),c(""),h(""),f(50),e==null||e())},b=t.filter(w=>!i||w.template_type===i);return a.jsxs(se,{children:[a.jsx(_e,{children:a.jsx(Se,{children:"Create A/B Test"})}),a.jsxs(ue,{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx(Re,{children:"Test Name"}),a.jsx(Je,{value:n,onChange:w=>s(w.target.value)})]}),a.jsxs("div",{children:[a.jsx(Re,{children:"Template Type"}),a.jsxs(Nr,{value:i,onValueChange:o,children:[a.jsx(gr,{children:a.jsx(kr,{placeholder:"Select type"})}),a.jsxs(yr,{children:[a.jsx(Le,{value:"welcome",children:"Welcome"}),a.jsx(Le,{value:"challenge_invite",children:"Challenge Invite"}),a.jsx(Le,{value:"daily_digest",children:"Daily Digest"})]})]})]}),a.jsxs("div",{children:[a.jsx(Re,{children:"Variant A Template"}),a.jsxs(Nr,{value:l,onValueChange:c,children:[a.jsx(gr,{children:a.jsx(kr,{placeholder:"Select template"})}),a.jsx(yr,{children:b.map(w=>a.jsx(Le,{value:w.id,children:w.name},w.id))})]})]}),a.jsxs("div",{children:[a.jsx(Re,{children:"Variant B Template"}),a.jsxs(Nr,{value:u,onValueChange:h,children:[a.jsx(gr,{children:a.jsx(kr,{placeholder:"Select template"})}),a.jsx(yr,{children:b.map(w=>a.jsx(Le,{value:w.id,children:w.name},w.id))})]})]}),a.jsxs("div",{children:[a.jsxs(Re,{children:["Traffic Split: ",d,"% / ",100-d,"%"]}),a.jsx(Za,{value:[d],onValueChange:([w])=>f(w),max:100,step:5})]}),a.jsxs("div",{children:[a.jsx(Re,{children:"Minimum Sample Size"}),a.jsx(Je,{type:"number",value:m,onChange:w=>g(Number(w.target.value))})]}),a.jsx(Y,{onClick:x,className:"w-full",children:"Create Test"})]})]})}function gRe(){const[e,t]=y.useState([]),[r,n]=y.useState({}),{toast:s}=ta();y.useEffect(()=>{i();const c=setInterval(i,3e4);return()=>clearInterval(c)},[]);const i=async()=>{const{data:c}=await ne.from("email_template_tests").select("*").in("status",["active","completed"]).order("created_at",{ascending:!1});c&&(t(c),o(c))},o=async c=>{const u={};
944for(const h of c){const[d,f]=await Promise.all([Gv(h.id,"a"),Gv(h.id,"b")]);u[h.id]={a:d,b:f}}n(u)},l=async c=>{var h;const u=await Ble(c);u.success?(s({title:`Variant ${(h=u.winner)==null?void 0:h.toUpperCase()} promoted as winner!`}),i()):s({title:u.message,variant:"destructive"})};return a.jsxs("div",{className:"space-y-6",children:[a.jsx("div",{className:"flex justify-between items-center",children:a.jsx("h2",{className:"text-2xl font-bold",children:"A/B Test Dashboard"})}),e.map(c=>{const u=r[c.id];if(!u)return null;const{a:h,b:d}=u,f=h.sent+d.sent;return a.jsxs(se,{children:[a.jsx(_e,{children:a.jsxs("div",{className:"flex justify-between items-start",children:[a.jsxs("div",{children:[a.jsx(Se,{children:c.name}),a.jsxs("p",{className:"text-sm text-muted-foreground mt-1",children:[c.template_type," • ",c.traffic_split_a,"/",c.traffic_split_b," split"]})]}),a.jsx(ke,{variant:c.status==="active"?"default":"secondary",children:c.status})]})}),a.jsxs(ue,{children:[a.jsxs("div",{className:"grid md:grid-cols-2 gap-6",children:[a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("h3",{className:"font-semibold",children:"Variant A"}),c.winner_variant==="a"&&a.jsx(lr,{className:"w-5 h-5 text-yellow-500"})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(gd,{className:"w-4 h-4"}),a.jsxs("span",{className:"text-sm",children:["Sent: ",h.sent]})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between text-sm mb-1",children:[a.jsx("span",{children:"Open Rate"}),a.jsxs("span",{className:"font-semibold",children:[h.openRate.toFixed(1),"%"]})]}),a.jsx(_t,{value:h.openRate})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between text-sm mb-1",children:[a.jsx("span",{children:"Click Rate"}),a.jsxs("span",{className:"font-semibold",children:[h.clickRate.toFixed(1),"%"]})]}),a.jsx(_t,{value:h.clickRate})]})]})]}),a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("h3",{className:"font-semibold",children:"Variant B"}),c.winner_variant==="b"&&a.jsx(lr,{className:"w-5 h-5 text-yellow-500"})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(gd,{className:"w-4 h-4"}),a.jsxs("span",{className:"text-sm",children:["Sent: ",d.sent]})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between text-sm mb-1",children:[a.jsx("span",{children:"Open Rate"}),a.jsxs("span",{className:"font-semibold",children:[d.openRate.toFixed(1),"%"]})]}),a.jsx(_t,{value:d.openRate})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between text-sm mb-1",children:[a.jsx("span",{children:"Click Rate"}),a.jsxs("span",{className:"font-semibold",children:[d.clickRate.toFixed(1),"%"]})]}),a.jsx(_t,{value:d.clickRate})]})]})]})]}),c.status==="active"&&f>=50&&a.jsxs(Y,{onClick:()=>l(c.id),className:"w-full mt-4",variant:"outline",children:[a.jsx(ja,{className:"w-4 h-4 mr-2"}),"Determine Winner & Promote"]})]})]},c.id)}),e.length===0&&a.jsx(se,{children:a.jsx(ue,{className:"py-12 text-center text-muted-foreground",children:"No active A/B tests. Create one to start testing!"})})]})}function yRe(){var _;const{user:e,updateProfile:t}=Jt(),[r,n]=y.useState(((_=e==null?void 0:e.user_metadata)==null?void 0:_.full_name)||""),[s,i]=y.useState(!1),[o,l]=y.useState([]),[c,u]=y.useState(!1),[h,d]=y.useState(0),[f,m]=y.useState(0),[g,p]=y.useState(!0);y.useEffect(()=>{v()},[]);const v=async()=>{p(!0);try{const S=await dde();m(S)}catch(S){console.error("Failed to get cache size:",S)}p(!1)},x=S=>{l(k=>k.includes(S)?k.filter(P=>P!==S):[...k,S])},b=()=>{o.length===ff.length?l([]):l(ff.map(S=>S.id))},w=async()=>{if(o.length===0){Pe.error("Please select at least one category");return}u(!0),d(0);try{const S=[];for(let k=0;k<o.length;k++){const P=o[k],C=await cde(P);S.push(...C),d((k+1)/o.length*100)}await hde(S),await v(),Pe.success(`Successfully cached ${S.length} audio files`)}catch(S){console.error("Download failed:",S),Pe.error("Failed to download audio files")}u(!1),d(0)},j=async()=>{try{await fde(),await v(),Pe.success("Cache cleared successfully")}catch(S){console.error("Failed to clear cache:",S),Pe.error("Failed to clear cache")}};return a.jsxs("div",{className:"container mx-auto px-4 py-8 max-w-6xl",children:[a.jsx(yde,{}),a.jsx("h1",{className:"text-4xl font-bold mb-2",children:"Settings"}),a.jsx("p",{className:"text-muted-foreground mb-8",children:"Manage your preferences, notifications, and analytics"}),a.jsxs(Pn,{defaultValue:"notifications",className:"space-y-6",children:[a.jsxs(fn,{className:"grid w-full grid-cols-5",children:[a.jsx(Oe,{value:"notifications",children:"Notifications"}),a.jsx(Oe,{value:"offline",children:"Offline Content"}),a.jsxs(Oe,{value:"analytics",children:[a.jsx(e2,{className:"w-4 h-4 mr-2"}),"Email Analytics"]}),a.jsx(Oe,{value:"templates",children:"Email Templates"}),a.jsx(Oe,{value:"abtests",children:"A/B Testing"})]}),a.jsx(ze,{value:"notifications",className:"space-y-6",children:a.jsx(rhe,{})}),a.jsxs(ze,{value:"offline",className:"space-y-6",children:[a.jsx(gde,{}),a.jsx(the,{}),a.jsxs(se,{children:[a.jsxs(_e,{children:[a.jsxs(Se,{className:"flex items-center gap-2",children:[a.jsx(jD,{className:"w-5 h-5"}),"Storage Usage"]}),a.jsx(hr,{children:"Current offline audio cache size"})]}),a.jsx(ue,{children:g?a.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground",children:[a.jsx(Fe,{className:"w-4 h-4 animate-spin"}),"Calculating..."]}):a.jsx("div",{className:"text-3xl font-bold text-primary",children:ude(f)})})]}),a.jsxs(se,{children:[a.jsxs(_e,{children:[a.jsxs(Se,{className:"flex items-center gap-2",children:[a.jsx(as,{className:"w-5 h-5"}),"Download Audio for Offline Use"]}),a.jsx(hr,{children:"Select categories to cache locally for offline playback"})]}),a.jsxs(ue,{className:"space-y-4",children:[a.jsx("div",{className:"flex items-center justify-between pb-4 border-b",children:a.jsx(Y,{variant:"outline",onClick:b,children:o.length===ff.length?"Deselect All":"Select All"})}),a.jsx("div",{className:"space-y-3",children:ff.map(S=>a.jsxs("div",{className:"flex items-start space-x-3 p-3 rounded-lg hover:bg-accent",children:[a.jsx(pC,{id:S.id,checked:o.includes(S.id),onCheckedChange:()=>x(S.id)}),a.jsxs("div",{className:"flex-1",children:[a.jsx("label",{htmlFor:S.id,className:"font-medium cursor-pointer",children:S.name}),a.jsx("p",{className:"text-sm text-muted-foreground",children:S.description})]})]},S.id))}),c&&a.jsxs("div",{className:"space-y-2",children:[a.jsx(_t,{value:h}),a.jsxs("p",{className:"text-sm text-center text-muted-foreground",children:["Downloading... ",Math.round(h),"%"]})]}),a.jsxs("div",{className:"flex gap-3 pt-4",children:[a.jsx(Y,{onClick:w,disabled:c||o.length===0,className:"flex-1",children:c?a.jsxs(a.Fragment,{children:[a.jsx(Fe,{className:"w-4 h-4 mr-2 animate-spin"}),"Downloading..."]}):a.jsxs(a.Fragment,{children:[a.jsx(as,{className:"w-4 h-4 mr-2"}),"Download Selected"]})}
944),a.jsxs(Y,{variant:"destructive",onClick:j,disabled:c||f===0,children:[a.jsx(Ls,{className:"w-4 h-4 mr-2"}),"Clear Cache"]})]})]})]})]}),a.jsx(ze,{value:"analytics",children:a.jsx(K4e,{})}),a.jsx(ze,{value:"templates",children:a.jsx(X4e,{})}),a.jsxs(ze,{value:"abtests",className:"space-y-6",children:[a.jsx(pRe,{onTestCreated:()=>window.location.reload()}),a.jsx(gRe,{})]})]})]})}const vRe=({onToggleForm:e,onForgotPassword:t})=>{const{signIn:r,signInWithGoogle:n,signInWithGithub:s,resendVerificationEmail:i,startDemoMode:o,isOfflineMode:l,retryConnection:c}=Jt(),[u,h]=y.useState(""),[d,f]=y.useState(""),[m,g]=y.useState(""),[p,v]=y.useState(!1),[x,b]=y.useState(!1),[w,j]=y.useState(!1),[_,S]=y.useState(!1),[k,P]=y.useState(!1),[C,M]=y.useState(!1),[I,E]=y.useState(!1),B=async R=>{var Q,K,z;R.preventDefault(),g(""),b(!1),j(!1),P(!1),v(!0);try{const{error:N,isNetworkError:T}=await r(u,d);N&&(console.warn("Login error:",N),T?(P(!0),g(N.message)):(Q=N.message)!=null&&Q.includes("Email not confirmed")?(b(!0),g("Please verify your email address before signing in.")):(K=N.message)!=null&&K.includes("Invalid login credentials")||(z=N.message)!=null&&z.includes("Invalid email or password")?g("Invalid email or password. Please check your credentials and try again."):g(N.message||"Failed to sign in. Please check your credentials."))}catch(N){console.error("Unexpected error:",N),g((N==null?void 0:N.message)||"An unexpected error occurred. Please try again.")}finally{v(!1)}},A=async()=>{S(!0),j(!1),g("");try{const{error:R}=await i(u);R?g("Failed to resend verification email. Please try again."):j(!0)}catch{g("An unexpected error occurred. Please try again.")}finally{S(!1)}},L=async()=>{var R;g(""),P(!1),v(!0);try{await n()}catch(Q){console.error("Google sign-in error:",Q),(R=Q==null?void 0:Q.message)!=null&&R.includes("Unable to connect")?(P(!0),g(Q.message)):g("Failed to sign in with Google. Please try again."),v(!1)}},W=async()=>{var R;g(""),P(!1),v(!0);try{await s()}catch(Q){console.error("GitHub sign-in error:",Q),(R=Q==null?void 0:Q.message)!=null&&R.includes("Unable to connect")?(P(!0),g(Q.message)):g("Failed to sign in with GitHub. Please try again."),v(!1)}},D=async()=>{M(!0),g("");try{await o()}catch(R){console.error("Demo mode error:",R),g((R==null?void 0:R.message)||"Failed to start demo mode. Please try again.")}finally{M(!1)}},U=async()=>{E(!0);try{await c()?(P(!1),g("")):g("Still unable to connect. Please check your internet connection.")}catch{g("Connection retry failed.")}finally{E(!1)}};return a.jsxs(se,{className:"w-full max-w-md",children:[a.jsxs(_e,{children:[a.jsx(Se,{children:"Welcome Back"}),a.jsx(hr,{children:"Sign in to continue your Malayalam learning journey"})]}),a.jsx(ue,{children:a.jsxs("form",{onSubmit:B,className:"space-y-4",children:[k&&a.jsxs(nn,{className:"bg-orange-50 border-orange-200",children:[a.jsx(Xo,{className:"h-4 w-4 text-orange-600"}),a.jsxs(an,{className:"text-orange-800",children:[a.jsx("p",{className:"font-medium mb-2",children:"Connection Issue"}),a.jsx("p",{className:"text-sm mb-3",children:m}),a.jsxs("div",{className:"flex flex-col gap-2",children:[a.jsxs("div",{className:"flex gap-2",children:[a.jsxs(Y,{type:"button",variant:"outline",size:"sm",onClick:U,disabled:I,className:"flex-1 bg-white hover:bg-gray-50 border-orange-300",children:[I?a.jsx(Fe,{className:"mr-2 h-3 w-3 animate-spin"}):a.jsx(Xt,{className:"mr-2 h-3 w-3"}),"Retry"]}),a.jsxs(Y,{type:"button",variant:"outline",size:"sm",onClick:D,disabled:C,className:"flex-1 bg-orange-100 hover:bg-orange-200 border-orange-300",children:[C?a.jsx(Fe,{className:"mr-2 h-3 w-3 animate-spin"}):a.jsx(Bt,{className:"mr-2 h-3 w-3"}),"Demo Mode"]})]}),a.jsx("p",{className:"text-xs text-orange-600",children:"Demo mode lets you explore the app without signing in. Your progress will be saved locally."})]})]})]}),m&&!k&&a.jsxs(nn,{variant:"destructive",children:[a.jsx(cn,{className:"h-4 w-4"}),a.jsx(an,{children:m})]}),x&&a.jsxs(nn,{className:"bg-yellow-50 border-yellow-200",children:[a.jsx(cn,{className:"h-4 w-4 text-yellow-600"}),a.jsxs(an,{className:"text-yellow-800",children:[a.jsx("p",{className:"mb-2",children:"Your email address has not been verified yet."}),a.jsxs(Y,{type:"button",variant:"outline",size:"sm",onClick:A,disabled:_,className:"mt-2",children:[_&&a.jsx(Fe,{className:"mr-2 h-3 w-3 animate-spin"}
944),"Resend Verification Email"]})]})]}),w&&a.jsx(nn,{className:"bg-green-50 border-green-200",children:a.jsx(an,{className:"text-green-800",children:"Verification email sent! Please check your inbox."})}),l&&!k&&a.jsxs(nn,{className:"bg-blue-50 border-blue-200",children:[a.jsx(Xo,{className:"h-4 w-4 text-blue-600"}),a.jsx(an,{className:"text-blue-800 text-sm",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("span",{children:"Server connection unavailable."}),a.jsx(Y,{type:"button",variant:"ghost",size:"sm",onClick:U,disabled:I,className:"ml-2 h-6 px-2",children:I?a.jsx(Fe,{className:"h-3 w-3 animate-spin"}):a.jsx(Xt,{className:"h-3 w-3"})})]})})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(Re,{htmlFor:"email",children:"Email"}),a.jsx(Je,{id:"email",type:"email",value:u,onChange:R=>h(R.target.value),required:!0})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(Re,{htmlFor:"password",children:"Password"}),a.jsx(Je,{id:"password",type:"password",value:d,onChange:R=>f(R.target.value),required:!0})]}),a.jsxs(Y,{type:"submit",className:"w-full",disabled:p,children:[p&&a.jsx(Fe,{className:"mr-2 h-4 w-4 animate-spin"}),"Sign In"]}),a.jsxs("div",{className:"relative my-4",children:[a.jsx("div",{className:"absolute inset-0 flex items-center",children:a.jsx("span",{className:"w-full border-t"})}),a.jsx("div",{className:"relative flex justify-center text-xs uppercase",children:a.jsx("span",{className:"bg-background px-2 text-muted-foreground",children:"Or continue with"})})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsxs(Y,{type:"button",variant:"outline",onClick:L,disabled:p,children:[a.jsx(gd,{className:"mr-2 h-4 w-4"}),"Google"]}),a.jsxs(Y,{type:"button",variant:"outline",onClick:W,disabled:p,children:[a.jsx(r2,{className:"mr-2 h-4 w-4"}),"GitHub"]})]}),a.jsxs("div",{className:"relative my-4",children:[a.jsx("div",{className:"absolute inset-0 flex items-center",children:a.jsx("span",{className:"w-full border-t"})}),a.jsx("div",{className:"relative flex justify-center text-xs uppercase",children:a.jsx("span",{className:"bg-background px-2 text-muted-foreground",children:"Or explore first"})})]}),a.jsxs(Y,{type:"button",variant:"secondary",className:"w-full",onClick:D,disabled:C||p,children:[C?a.jsx(Fe,{className:"mr-2 h-4 w-4 animate-spin"}):a.jsx(Bt,{className:"mr-2 h-4 w-4"}),"Try Demo Mode"]}),a.jsx("p",{className:"text-xs text-center text-muted-foreground",children:"Explore the app without creating an account"}),a.jsxs("div",{className:"text-center text-sm space-y-2 pt-2",children:[a.jsx("button",{type:"button",onClick:t,className:"text-primary hover:underline",children:"Forgot password?"}),a.jsxs("div",{children:["Don't have an account?"," ",a.jsx("button",{type:"button",onClick:e,className:"text-primary hover:underline",children:"Sign up"})]})]})]})})]})},xRe=({onToggleForm:e})=>{const{signUp:t,signInWithGoogle:r,signInWithGithub:n,startDemoMode:s,isOfflineMode:i,retryConnection:o}=Jt(),[l,c]=y.useState(""),[u,h]=y.useState(""),[d,f]=y.useState(""),[m,g]=y.useState(""),[p,v]=y.useState(""),[x,b]=y.useState(!1),[w,j]=y.useState(!1),[_,S]=y.useState(!1),[k,P]=y.useState(!1),[C,M]=y.useState(!1),I=async W=>{if(W.preventDefault(),v(""),S(!1),d!==m){v("Passwords do not match");return}if(d.length<6){v("Password must be at least 6 characters");return}j(!0);try{const{error:D,isNetworkError:U}=await t(u,d,l);D?(console.warn("Sign up error:",D),U?(S(!0),v(D.message)):v(D.message||"Failed to create account. Please try again.")):b(!0)}catch(D){console.error("Unexpected error:",D),v((D==null?void 0:D.message)||"An unexpected error occurred. Please try again.")}finally{j(!1)}},E=async()=>{var W;v(""),S(!1),j(!0);try{await r()}catch(D){console.error("Google sign-in error:",D),(W=D==null?void 0:D.message)!=null&&W.includes("Unable to connect")?(S(!0),v(D.message)):v("Failed to sign in with Google. Please try again."),j(!1)}},B=async()=>{var W;v(""),S(!1),j(!0);try{await n()}catch(D){console.error("GitHub sign-in error:",D),(W=D==null?void 0:D.message)!=null&&W.includes("Unable to connect")?(S(!0),v(D.message)):v("Failed to sign in with GitHub. Please try again."),j(!1)}},A=async()=>{P(!0),v("");try{await s()}catch(W){console.error("Demo mode error:",W),v((W==null?void 0:W.message)||"Failed to start demo mode. Please try again.")}finally{P(!1)}},L=async()=>{M(!0);try{await o()?(S(!1),v("")):v("Still unable to connect. Please check your internet connection.")}catch{v("Connection retry failed.")}finally{M(!1)}};return x?a.jsxs(se,{className:"w-full max-w-md",children:[a.jsx(_e,{children:a.jsxs(Se,{className:"flex items-center gap-2",children:[a.jsx(ot,{className:"h-6 w-6 text-green-600"}),"Account Created!"]})}),a.jsxs(ue,{className:"space-y-4",children:[a.jsx("div",{className:"space-y-2",children:a.jsx("p",{className:"text-muted-foreground",children:"Your account has been created successfully! You can now sign in and start learning Malayalam."})}),a.jsx(Y,{onClick:e,className:"w-full",children:"Sign In Now"})]})]}):a.jsxs(se,{className:"w-full max-w-md",children:[a.jsxs(_e,{children:[a.jsx(Se,{children:"Create Account"}),a.jsx(hr,{children:"Start your Malayalam learning journey today"})]}),a.jsx(ue,{children:a.jsxs("form",{onSubmit:I,className:"space-y-4",children:[_&&a.jsxs(nn,{className:"bg-orange-50 border-orange-200",children:[a.jsx(Xo,{className:"h-4 w-4 text-orange-600"}),a.jsxs(an,{className:"text-orange-800",children:[a.jsx("p",{className:"font-medium mb-2",children:"Connection Issue"}),a.jsx("p",{className:"text-sm mb-3",children:p}),a.jsxs("div",{className:"flex flex-col gap-2",children:[a.jsxs("div",{className:"flex gap-2",children:[a.jsxs(Y,{type:"button",variant:"outline",size:"sm",onClick:L,disabled:C,className:"flex-1 bg-white hover:bg-gray-50 border-orange-300",children:[C?a.jsx(Fe,{className:"mr-2 h-3 w-3 animate-spin"}):a.jsx(Xt,{className:"mr-2 h-3 w-3"}),"Retry"]}),a.jsxs(Y,{type:"button",variant:"outline",size:"sm",onClick:A,disabled:k,className:"flex-1 bg-orange-100 hover:bg-orange-200 border-orange-300",children:[k?a.jsx(Fe,{className:"mr-2 h-3 w-3 animate-spin"}):a.jsx(Bt,{className:"mr-2 h-3 w-3"}),"Demo Mode"]})]}),a.jsx("p",{className:"text-xs text-orange-600",children:"Demo mode lets you explore the app without signing up. Your progress will be saved locally."})]})]})]}),p&&!_&&a.jsxs(nn,{variant:"destructive",children:[a.jsx(cn,{className:"h-4 w-4"}),a.jsx(an,{children:p})]}),i&&!_&&a.jsxs(nn,{className:"bg-blue-50 border-blue-200",children:[a.jsx(Xo,{className:"h-4 w-4 text-blue-600"}),a.jsx(an,{className:"text-blue-800 text-sm",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("span",{children:"Server connection unavailable."}),a.jsx(Y,{type:"button",variant:"ghost",size:"sm",onClick:L,disabled:C,className:"ml-2 h-6 px-2",children:C?a.jsx(Fe,{className:"h-3 w-3 animate-spin"}):a.jsx(Xt,{className:"h-3 w-3"})})]})})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(Re,{htmlFor:"fullName",children:"Full Name"}
944),a.jsx(Je,{id:"fullName",value:l,onChange:W=>c(W.target.value),required:!0})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(Re,{htmlFor:"email",children:"Email"}),a.jsx(Je,{id:"email",type:"email",value:u,onChange:W=>h(W.target.value),required:!0})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(Re,{htmlFor:"password",children:"Password"}),a.jsx(Je,{id:"password",type:"password",value:d,onChange:W=>f(W.target.value),required:!0})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(Re,{htmlFor:"confirmPassword",children:"Confirm Password"}),a.jsx(Je,{id:"confirmPassword",type:"password",value:m,onChange:W=>g(W.target.value),required:!0})]}),a.jsxs(Y,{type:"submit",className:"w-full",disabled:w,children:[w&&a.jsx(Fe,{className:"mr-2 h-4 w-4 animate-spin"}),"Sign Up"]}),a.jsxs("div",{className:"relative my-4",children:[a.jsx("div",{className:"absolute inset-0 flex items-center",children:a.jsx("span",{className:"w-full border-t"})}),a.jsx("div",{className:"relative flex justify-center text-xs uppercase",children:a.jsx("span",{className:"bg-background px-2 text-muted-foreground",children:"Or continue with"})})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsxs(Y,{type:"button",variant:"outline",onClick:E,disabled:w,children:[a.jsx(gd,{className:"mr-2 h-4 w-4"}),"Google"]}),a.jsxs(Y,{type:"button",variant:"outline",onClick:B,disabled:w,children:[a.jsx(r2,{className:"mr-2 h-4 w-4"}),"GitHub"]})]}),a.jsxs("div",{className:"relative my-4",children:[a.jsx("div",{className:"absolute inset-0 flex items-center",children:a.jsx("span",{className:"w-full border-t"})}),a.jsx("div",{className:"relative flex justify-center text-xs uppercase",children:a.jsx("span",{className:"bg-background px-2 text-muted-foreground",children:"Or explore first"})})]}),a.jsxs(Y,{type:"button",variant:"secondary",className:"w-full",onClick:A,disabled:k||w,children:[k?a.jsx(Fe,{className:"mr-2 h-4 w-4 animate-spin"}):a.jsx(Bt,{className:"mr-2 h-4 w-4"}),"Try Demo Mode"]}),a.jsx("p",{className:"text-xs text-center text-muted-foreground",children:"Explore the app without creating an account"}),a.jsxs("div",{className:"text-center text-sm pt-2",children:["Already have an account?"," ",a.jsx("button",{type:"button",onClick:e,className:"text-primary hover:underline",children:"Sign in"})]})]})})]})},bRe=()=>{const[e]=DL(),t=e.get("view")==="signup"?"signup":"login",[r,n]=y.useState(t),{user:s}=Jt(),i=ei();return y.useEffect(()=>{s&&i("/app")},[s,i]),a.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gradient-to-br from-blue-50 to-indigo-100 dark:from-gray-900 dark:to-gray-800 p-4",children:a.jsxs("div",{className:"w-full max-w-md 
944space-y-4",children:[a.jsx("div",{className:"flex justify-center mb-2",children:a.jsx("button",{onClick:()=>i("/"),className:"hover:opacity-90 transition-opacity",children:a.jsx("img",{src:Po,alt:"Neela Malayalam",className:"h-20 w-auto object-contain"})})}),a.jsxs(nn,{className:"bg-blue-50 border-blue-200",children:[a.jsx(nl,{className:"h-4 w-4 text-blue-600"}),a.jsx(an,{className:"text-sm text-blue-800",children:"Using local authentication (no database required). Your account is stored in your browser."})]}),r==="login"&&a.jsx(vRe,{onToggleForm:()=>n("signup"),onForgotPassword:()=>{}}),r==="signup"&&a.jsx(xRe,{onToggleForm:()=>n("login")})]})})};function wRe({user:e,profile:t,onAvatarChange:r}){var i;const n=o=>{var c;const l=(c=o.target.files)==null?void 0:c[0];l&&r(l)},s=t!=null&&t.full_name?t.full_name.split(" ").map(o=>o[0]).join("").toUpperCase():(i=e.email)==null?void 0:i[0].toUpperCase();return a.jsxs("div",{className:"flex items-center gap-6 p-6 bg-gradient-to-r from-blue-50 to-purple-50 rounded-lg",children:[a.jsxs("div",{className:"relative",children:[a.jsxs(_a,{className:"h-24 w-24",children:[a.jsx(ds,{src:t==null?void 0:t.avatar_url}),a.jsx(Sa,{className:"text-2xl",children:s})]}),a.jsxs("label",{htmlFor:"avatar-upload",className:"absolute bottom-0 right-0 cursor-pointer",children:[a.jsx("div",{className:"bg-blue-600 text-white p-2 rounded-full hover:bg-blue-700 transition",children:a.jsx(_K,{className:"h-4 w-4"})}),a.jsx("input",{id:"avatar-upload",type:"file",accept:"image/*",className:"hidden",onChange:n})]})]}),a.jsxs("div",{children:[a.jsx("h1",{className:"text-3xl font-bold text-gray-900",children:(t==null?void 0:t.full_name)||"User"}),a.jsx("p",{className:"text-gray-600",children:e.email})]})]})}function jRe({profile:e,onSave:t}){const[r,n]=y.useState((e==null?void 0:e.full_name)||""),[s,i]=y.useState((e==null?void 0:e.email)||""),[o,l]=y.useState(!1),c=async u=>{u.preventDefault(),l(!0);try{await t({full_name:r,email:s})}finally{l(!1)}};return a.jsxs(se,{children:[a.jsx(_e,{children:a.jsx(Se,{children:"Profile Information"})}),a.jsx(ue,{children:a.jsxs("form",{onSubmit:c,className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx(Re,{htmlFor:"fullName",children:"Full Name"}),a.jsx(Je,{id:"fullName",value:r,onChange:u=>n(u.target.value),placeholder:"Enter your full name"})]}),a.jsxs("div",{children:[a.jsx(Re,{htmlFor:"email",children:"Email"}),a.jsx(Je,{id:"email",type:"email",value:s,onChange:u=>i(u.target.value),placeholder:"Enter your email",disabled:!0}),a.jsx("p",{className:"text-sm text-gray-500 mt-1",children:"Email cannot be changed"})]}),a.jsxs(Y,{type:"submit",disabled:o,children:[o&&a.jsx(Fe,{className:"mr-2 h-4 w-4 animate-spin"}),"Save Changes"]})]})})]})}function _Re({preferences:e,onChange:t}){return a.jsxs(se,{children:[a.jsx(_e,{children:a.jsx(Se,{children:"Learning Preferences"})}),a.jsxs(ue,{className:"space-y-6",children:[a.jsxs("div",{children:[a.jsx(Re,{htmlFor:"learningGoal",children:"Learning Goal"}),a.jsxs(Nr,{value:(e==null?void 0:e.learning_goal)||"general",onValueChange:r=>t("learning_goal",r),children:[a.jsx(gr,{id:"learningGoal",children:a.jsx(kr,{})}),a.jsxs(yr,{children:[a.jsx(Le,{value:"general",children:"General Learning"}),a.jsx(Le,{value:"reading",children:"Focus on Reading"}),a.jsx(Le,{value:"writing",children:"Focus on Writing"}),a.jsx(Le,{value:"speaking",children:"Focus on Speaking"})]})]})]}),a.jsxs("div",{children:[a.jsxs(Re,{children:["Daily Goal: ",(e==null?void 0:e.daily_goal_minutes)||15," minutes"]}),a.jsx(Za,{value:[(e==null?void 0:e.daily_goal_minutes)||15],onValueChange:r=>t("daily_goal_minutes",r[0]),min:5,max:120,step:5,className:"mt-2"})]}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx(Re,{htmlFor:"autoplay",children:"Audio Autoplay"}),a.jsx(_n,{id:"autoplay",checked:(e==null?void 0:e.audio_autoplay)??!0,onCheckedChange:r=>t("audio_autoplay",r)})]}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx(Re,{htmlFor:"romanization",children:"Show Romanization"}),a.jsx(_n,{id:"romanization",checked:(e==null?void 0:e.show_romanization)??!0,onCheckedChange:r=>t("show_romanization",r)}
944)]}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx(Re,{htmlFor:"notifications",children:"Enable Notifications"}),a.jsx(_n,{id:"notifications",checked:(e==null?void 0:e.notification_enabled)??!0,onCheckedChange:r=>t("notification_enabled",r)})]})]})]})}function SRe({stats:e}){const t=[{name:"First Steps",description:"Completed first lesson",unlocked:e.lessonsCompleted>0},{name:"Dedicated Learner",description:"7-day streak",unlocked:e.currentStreak>=7},{name:"Quiz Master",description:"Completed 10 quizzes",unlocked:e.quizzesCompleted>=10},{name:"Accuracy Expert",description:"90% accuracy",unlocked:e.accuracy>=90}];return a.jsxs("div",{className:"space-y-6",children:[a.jsxs(se,{children:[a.jsx(_e,{children:a.jsx(Se,{children:"Learning Statistics"})}),a.jsx(ue,{children:a.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[a.jsxs("div",{className:"text-center p-4 bg-blue-50 rounded-lg",children:[a.jsx(wa,{className:"h-8 w-8 text-blue-600 mx-auto mb-2"}),a.jsx("div",{className:"text-2xl font-bold",children:e.lessonsCompleted}),a.jsx("div",{className:"text-sm text-gray-600",children:"Lessons"})]}),a.jsxs("div",{className:"text-center p-4 bg-green-50 rounded-lg",children:[a.jsx(ma,{className:"h-8 w-8 text-orange-600 mx-auto mb-2"}),a.jsx("div",{className:"text-2xl font-bold",children:e.currentStreak}),a.jsx("div",{className:"text-sm text-gray-600",children:"Day Streak"})]}),a.jsxs("div",{className:"text-center p-4 bg-purple-50 rounded-lg",children:[a.jsx(os,{className:"h-8 w-8 text-purple-600 mx-auto mb-2"}),a.jsxs("div",{className:"text-2xl font-bold",children:[e.accuracy,"%"]}),a.jsx("div",{className:"text-sm text-gray-600",children:"Accuracy"})]}),a.jsxs("div",{className:"text-center p-4 bg-yellow-50 rounded-lg",children:[a.jsx(lr,{className:"h-8 w-8 text-yellow-600 mx-auto mb-2"}),a.jsx("div",{className:"text-2xl font-bold",children:e.totalPracticeTime}),a.jsx("div",{className:"text-sm text-gray-600",children:"Minutes"})]})]})})]}),a.jsxs(se,{children:[a.jsx(_e,{children:a.jsx(Se,{children:"Achievements"})}),a.jsx(ue,{children:a.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:t.map(r=>a.jsx("div",{className:`p-4 rounded-lg border-2 ${r.unlocked?"border-yellow-400 bg-yellow-50":"border-gray-200 bg-gray-50 opacity-50"}`,children:a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx(lr,{className:`h-6 w-6 ${r.unlocked?"text-yellow-600":"text-gray-400"}`}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-semibold",children:r.name}),a.jsx("p",{className:"text-sm text-gray-600",children:r.description}),r.unlocked&&a.jsx(ke,{className:"mt-2",variant:"secondary",children:"Unlocked"})]})]})},r.name))})})]})]})}function NRe(){const{user:e}=Jt(),{toast:t}=ta(),[r,n]=y.useState(null),[s,i]=y.useState(!0),[o,l]=y.useState({totalPracticeTime:0,currentStreak:0,longestStreak:0,lessonsCompleted:0,quizzesCompleted:0,accuracy:0});y.useEffect(()=>{e&&(c(),u())},[e]);const c=async()=>{try{const{data:g,error:p}=await ne.from("profiles").select("*").eq("id",e==null?void 0:e.id).single();if(p)throw p;n(g)}catch(g){t({title:"Error",description:g.message,variant:"destructive"})}finally{i(!1)}},u=()=>{const g=JSON.parse(localStorage.getItem("malayalamProgress")||"{}"),p=Object.keys(g).filter(x=>x.includes("quiz")).length,v=Object.keys(g).filter(x=>x.includes("lesson")).length;l({totalPracticeTime:Math.floor(Math.random()*500)+100,currentStreak:Math.floor(Math.random()*15)+1,longestStreak:Math.floor(Math.random()*30)+5,lessonsCompleted:v,quizzesCompleted:p,accuracy:Math.floor(Math.random()*20)+75})},h=async g=>{try{const p=g.name.split(".").pop(),x=`avatars/${`${e==null?void 0:e.id}-${Math.random()}.${p}`}`,{error:b}=await ne.storage.from("audio-files").upload(x,g);if(b)throw b;const{data:{publicUrl:w}}=ne.storage.from("audio-files").getPublicUrl(x);await m({avatar_url:w})}catch(p){t({title:"Error",description:p.message,variant:"destructive"})}},d=async g=>{await m({full_name:g.full_name})},f=async(g,p)=>{await m({[g]:p})},m=async g=>{try{const{error:p}=await ne.from("profiles").update(g).eq("id",e==null?void 0:e.id);if(p)throw p;n({...r,...g}),t({title:"Success",description:"Profile updated successfully"})}catch(p){t({title:"Error",description:p.message,variant:"destructive"})}};return s?a.jsx("div",{className:"flex items-center justify-center min-h-screen",children:a.jsx(Fe,{className:"h-8 w-8 animate-spin text-blue-600"})}):e?a.jsxs("div",{className:"container mx-auto px-4 py-8 max-w-6xl",children:[a.jsx(wRe,{user:e,profile:r,onAvatarChange:h}),a.jsxs("div",{className:"grid md:grid-cols-2 gap-6 mt-8",children:[a.jsxs("div",{className:"space-y-6",children:[a.jsx(jRe,{profile:r,onSave:d}),a.jsx(_Re,{preferences:r,onChange:f})]}),a.jsx("div",{children:a.jsx(SRe,{stats:o})})]})]}):null}const kRe=()=>{const e=ei(),[t,r]=y.useState(""),[n,s]=y.useState(""),[i,o]=y.useState(!1),[l,c]=y.useState(!1),[u,h]=y.useState(!1),[d,f]=y.useState(""),[m,g]=y.useState(!1),v=(j=>{let _=0;return j.length>=8&&_++,j.length>=12&&_++,/[a-z]/.test(j)&&/[A-Z]/.test(j)&&_++,/\d/.test(j)&&_++,/[^a-zA-Z0-9]/.test(j)&&_++,_})(t),x=["Very Weak","Weak","Fair","Good","Strong"],b=["bg-red-500","bg-orange-500","bg-yellow-500","bg-blue-500","bg-green-500"],w=async j=>{if(j.preventDefault(),f(""),t.length<8){f("Password must be at least 8 characters long");return}if(t!==n){f("Passwords do not match");return}h(!0);const{error:_}=await ne.auth.updateUser({password:t});h(!1),_?f(_.message):(g(!0),setTimeout(()=>e("/login"),2e3))};return a.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gradient-to-br from-blue-50 to-indigo-100 p-4",children:a.jsxs(se,{className:"w-full max-w-md",children:[a.jsxs(_e,{children:[a.jsx(Se,{children:"Reset Your Password"}),a.jsx(hr,{children:"Enter your new password below"})]}),a.jsx(ue,{children:m?a.jsxs(nn,{className:"bg-green-50 border-green-200",children:[a.jsx(mr,{className:"h-4 w-4 text-green-600"}),a.jsx(an,{className:"text-green-800",children:"Password reset successful! Redirecting to login..."})]}):a.jsxs("form",{onSubmit:w,className:"space-y-4",children:[d&&a.jsxs(nn,{variant:"destructive",children:[a.jsx(jt,{className:"h-4 w-4"}),a.jsx(an,{children:d})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(Re,{htmlFor:"password",children:"New Password"}),a.jsxs("div",{className:"relative",children:[a.jsx(Je,{id:"password",type:i?"text":"password",value:t,onChange:j=>r(j.target.value),required:!0}),a.jsx("button",{type:"button",onClick:()=>o(!i),className:"absolute right-3 top-1/2 -translate-y-1/2",children:i?a.jsx(Ws,{className:"h-4 w-4"}):a.jsx(fa,{className:"h-4 w-4"})})]}),t&&a.jsxs("div",{className:"space-y-1",children:[a.jsx("div",{className:"flex gap-1",children:[...Array(5)].map((j,_)=>a.jsx("div",{className:`h-1 flex-1 rounded ${_<v?b[v-1]:"bg-gray-200"}`},_))}),a.jsxs("p",{className:"text-xs text-gray-600",children:["Strength: ",x[v-1]||"Too short"]})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(Re,{htmlFor:"confirmPassword",children:"Confirm Password"}),a.jsxs("div",{className:"relative",children:[a.jsx(Je,{id:"confirmPassword",type:l?"text":"password",value:n,onChange:j=>s(j.target.value),required:!0}),a.jsx("button",{type:"button",onClick:()=>c(!l),className:"absolute right-3 top-1/2 -translate-y-1/2",children:l?a.jsx(Ws,{className:"h-4 w-4"}):a.jsx(fa,{className:"h-4 w-4"})})]})]}),a.jsx(Y,{type:"submit",className:"w-full",disabled:u,children:u?"Resetting...":"Reset Password"})]})})]})})};function CRe({userId:e,open:t,onOpenChange:r}){var h;const[n,s]=y.useState(null),[i,o]=y.useState(null),[l,c]=y.useState([]);y.useEffect(()=>{e&&t&&u()},[e,t]);const u=async()=>
944{if(!e)return;const[d,f,m]=await Promise.all([ne.from("profiles").select("*").eq("id",e).single(),ne.from("user_gamification").select("*").eq("user_id",e).single(),ne.from("user_badges").select("badge_id").eq("user_id",e)]);d.data&&s(d.data),f.data&&o(f.data),m.data&&c(m.data.map(g=>g.badge_id))};return n?a.jsx(Ks,{open:t,onOpenChange:r,children:a.jsxs(fs,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[a.jsx(Ys,{children:a.jsx(Xs,{children:"User Profile"})}),a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"flex items-center gap-4",children:[a.jsxs(_a,{className:"h-20 w-20",children:[a.jsx(ds,{src:n.avatar_url}),a.jsx(Sa,{children:((h=n.full_name)==null?void 0:h[0])||"U"})]}),a.jsxs("div",{className:"flex-1",children:[a.jsx("h3",{className:"text-2xl font-bold",children:n.full_name||"Anonymous"}),a.jsxs("p",{className:"text-gray-600",children:["Level ",(i==null?void 0:i.level)||1]})]})]}),a.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[a.jsxs(se,{className:"p-4 text-center",children:[a.jsx(is,{className:"h-6 w-6 text-yellow-500 mx-auto mb-2"}),a.jsx("p",{className:"text-2xl font-bold",children:(i==null?void 0:i.total_xp)||0}),a.jsx("p",{className:"text-sm text-gray-600",children:"Total XP"})]}),a.jsxs(se,{className:"p-4 text-center",children:[a.jsx(ma,{className:"h-6 w-6 text-orange-500 mx-auto mb-2"}),a.jsx("p",{className:"text-2xl font-bold",children:n.streak_days||0}),a.jsx("p",{className:"text-sm text-gray-600",children:"Day Streak"})]}),a.jsxs(se,{className:"p-4 text-center",children:[a.jsx(os,{className:"h-6 w-6 text-blue-500 mx-auto mb-2"}),a.jsxs("p",{className:"text-2xl font-bold",children:[n.total_accuracy||0,"%"]}),a.jsx("p",{className:"text-sm text-gray-600",children:"Accuracy"})]}),a.jsxs(se,{className:"p-4 text-center",children:[a.jsx(lr,{className:"h-6 w-6 text-purple-500 mx-auto mb-2"}),a.jsx("p",{className:"text-2xl font-bold",children:l.length}),a.jsx("p",{className:"text-sm text-gray-600",children:"Badges"})]})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"text-lg font-semibold mb-4",children:"Badges"}),a.jsx("div",{className:"grid grid-cols-3 md:grid-cols-4 gap-4",children:nC.map(d=>{const f=l.includes(d.id);return a.jsxs("div",{className:`text-center p-3 rounded-lg border ${f?"bg-white":"bg-gray-50 opacity-50"}`,children:[a.jsx("div",{className:"text-3xl mb-2",children:d.icon}),a.jsx("p",{className:"text-xs font-medium",children:d.name})]},d.id)})})]})]})]})}):null}function W3(){const{user:e}=Jt(),[t,r]=y.useState([]),[n,s]=y.useState("xp"),[i,o]=y.useState("all-time"),[l,c]=y.useState("all"),[u,h]=y.useState(null),[d,f]=y.useState([]);y.useEffect(()=>{m()},[e]),y.useEffect(()=>{if(g(),!!Di())try{const x=ne.channel("leaderboard-updates").on("postgres_changes",{event:"*",schema:"public",table:"user_gamification"},g).on("postgres_changes",{event:"*",schema:"public",table:"profiles"},g).subscribe(b=>{(b==="CHANNEL_ERROR"||b==="TIMED_OUT")&&console.warn("[Leaderboard] Realtime subscription failed")});return()=>{try{ne.removeChannel(x)}catch{}}}catch(x){console.warn("[Leaderboard] Failed to set up realtime:",x)}},[n,i,l,d]);const m=async()=>{if(!e)return;const{data:x}=await ne.from("friendships").select("friend_id").eq("user_id",e.id).eq("status","accepted");x&&f(x.map(b=>b.friend_id))},g=async()=>{let x=ne.from("profiles").select(`
945        id, full_name, avatar_url, streak_days, total_accuracy, lessons_completed,
946        user_gamification(total_xp, level, weekly_xp)
947      `);l==="friends"&&d.length>0&&(x=x.in("id",d));const{data:b}=await x.limit(50);if(b){let w=b.map(_=>{var S,k,P,C,M,I;return{id:_.id,full_name:_.full_name,avatar_url:_.avatar_url,streak_days:_.streak_days||0,total_accuracy:_.total_accuracy||0,lessons_completed:_.lessons_completed||0,total_xp:((k=(S=_.user_gamification)==null?void 0:S[0])==null?void 0:k.total_xp)||0,level:((C=(P=_.user_gamification)==null?void 0:P[0])==null?void 0:C.level)||1,weekly_xp:((I=(M=_.user_gamification)==null?void 0:M[0])==null?void 0:I.weekly_xp)||0}});const j=i==="weekly"&&n==="xp"?"weekly_xp":n==="xp"?"total_xp":n==="level"?"level":n==="streak"?"streak_days":"total_accuracy";w.sort((_,S)=>S[j]-_[j]),r(w.slice(0,20))}},p=x=>x===0?"🥇":x===1?"🥈":x===2?"🥉":`${x+1}`,v=x=>n==="xp"?i==="weekly"?`${x.weekly_xp} XP`:`${x.total_xp} XP`:n==="level"?`Level ${x.level}`:n==="streak"?`${x.streak_days} days`:`${x.total_accuracy}%`;return a.jsxs(a.Fragment,{children:[a.jsxs(se,{className:"p-6",children:[a.jsx("div",{className:"flex items-center justify-between mb-6",children:a.jsxs("h2",{className:"text-2xl font-bold flex items-center gap-2",children:[a.jsx(lr,{className:"h-6 w-6 text-yellow-500"}),"Leaderboard"]})}),a.jsx(Pn,{value:i,onValueChange:x=>o(x),className:"mb-4",children:a.jsxs(fn,{className:"grid w-full grid-cols-2",children:[a.jsx(Oe,{value:"all-time",children:"All Time"}),a.jsx(Oe,{value:"weekly",children:"This Week"})]})}),a.jsxs("div",{className:"flex gap-2 mb-4 flex-wrap",children:[a.jsxs("button",{onClick:()=>s("xp"),className:`px-3 py-1 rounded text-sm ${n==="xp"?"bg-primary text-white":"bg-gray-100"}`,children:[a.jsx(is,{className:"h-3 w-3 inline mr-1"}),"XP"]}),a.jsxs("button",{onClick:()=>s("level"),className:`px-3 py-1 rounded text-sm ${n==="level"?"bg-primary text-white":"bg-gray-100"}`,children:[a.jsx(ja,{className:"h-3 w-3 inline mr-1"}),"Level"]}),a.jsxs("button",{onClick:()=>s("streak"),className:`px-3 py-1 rounded text-sm ${n==="streak"?"bg-primary text-white":"bg-gray-100"}`,children:[a.jsx(ma,{className:"h-3 w-3 inline mr-1"}),"Streak"]}),a.jsxs("button",{onClick:()=>s("accuracy"),className:`px-3 py-1 rounded text-sm ${n==="accuracy"?"bg-primary text-white":"bg-gray-100"}`,children:[a.jsx(os,{className:"h-3 w-3 inline mr-1"}),"Accuracy"]})]}),a.jsxs("div",{className:"flex gap-2 mb-4",children:[a.jsx("button",{onClick:()=>c("all"),className:`px-3 py-1 rounded text-sm ${l==="all"?"bg-primary text-white":"bg-gray-100"}`,children:"All Users"}),a.jsxs("button",{onClick:()=>c("friends"),className:`px-3 py-1 rounded text-sm ${l==="friends"?"bg-primary text-white":"bg-gray-100"}`,children:[a.jsx(Xn,{className:"h-3 w-3 inline mr-1"}),"Friends Only"]})]}),a.jsx("div",{className:"space-y-2",children:t.map((x,b)=>{var w;return a.jsxs("div",{onClick:()=>h(x.id),className:`flex items-center gap-4 p-3 rounded-lg hover:bg-gray-50 cursor-pointer transition ${x.id===(x==null?void 0:x.id)?"bg-blue-50 border border-blue-200":""}`,children:[a.jsx("div",{className:"text-xl font-bold w-10 text-center",children:p(b)}),a.jsxs(_a,{children:[a.jsx(ds,{src:x.avatar_url}),a.jsx(Sa,{children:((w=x.full_name)==null?void 0:w[0])||"U"})]}),a.jsxs("div",{className:"flex-1",children:[a.jsx("p",{className:"font-semibold",children:x.full_name||"Anonymous"}),a.jsxs("p",{className:"text-sm text-gray-500",children:[x.lessons_completed," lessons"]})]}),a.jsx(ke,{variant:"secondary",children:v(x)})]},x.id)})})]}),a.jsx(CRe,{userId:u,open:!!u,onOpenChange:x=>!x&&h(null)})]})}function ERe(){const[e,t]=y.useState([]),[r,n]=y.useState([]),{toast:s}=ta();y.useEffect(()=>{i()},[]);const i=async()=>{const{data:{user:l}}=await ne.auth.getUser();if(!l)return;const{data:c}=await ne.from("friendships").select(`
948        id, friend_id, status,
949        friend:profiles!friendships_friend_id_fkey(full_name, avatar_url, streak_days, lessons_completed)
950      `).eq("user_id",l.id).eq("status","accepted"),{data:u}=await ne.from("friendships").select(`
951        id, friend_id, status,
952        friend:profiles!friendships_user_id_fkey(full_name, avatar_url, streak_days, lessons_completed)
953      `).eq("friend_id",l.id).eq("status","pending");c&&t(c),u&&n(u)},o=async(l,c)=>{const{error:u}=await ne.from("friendships").update({status:c==="accept"?"accepted":"rejected"}).eq("id",l);u||(s({title:`Friend request ${c}ed`}),i())};return a.jsxs("div",{className:"space-y-6",children:[r.length>0&&a.jsxs(se,{className:"p-6",children:[a.jsxs("h3",{className:"text-lg font-bold mb-4 flex items-center gap-2",children:[a.jsx(y_,{className:"h-5 w-5"}),"Friend Requests"]}),a.jsx("div",{className:"space-y-3",children:r.map(l=>{var c;return a.jsxs("div",{className:"flex items-center gap-3 p-3 bg-gray-50 rounded-lg",children:[a.jsxs(_a,{children:[a.jsx(ds,{src:l.friend.avatar_url}),a.jsx(Sa,{children:(c=l.friend.full_name)==null?void 0:c[0]})]}),a.jsx("div",{className:"flex-1",children:a.jsx("p",{className:"font-semibold",children:l.friend.full_name})}),a.jsx(Y,{size:"sm",onClick:()=>o(l.id,"accept"),children:a.jsx(Ri,{className:"h-4 w-4"})}),a.jsx(Y,{size:"sm",variant:"outline",onClick:()=>o(l.id,"reject"),children:a.jsx(ls,{className:"h-4 w-4"})})]},l.id)})})]}),a.jsxs(se,{className:"p-6",children:[a.jsxs("h3",{className:"text-lg font-bold mb-4 flex items-center gap-2",children:[a.jsx(Xn,{className:"h-5 w-5"}),"My Friends (",e.length,")"]}),a.jsx("div",{className:"space-y-3",children:e.map(l=>{var c;return a.jsxs("div",{className:"flex items-center gap-3 p-3 hover:bg-gray-50 rounded-lg",children:[a.jsxs(_a,{children:[a.jsx(ds,{src:l.friend.avatar_url}),a.jsx(Sa,{children:(c=l.friend.full_name)==null?void 0:c[0]})]}),a.jsxs("div",{className:"flex-1",children:[a.jsx("p",{className:"font-semibold",children:l.friend.full_name}),a.jsxs("p",{className:"text-sm text-gray-500",children:[l.friend.lessons_completed," lessons"]})]}),a.jsxs(ke,{variant:"secondary",className:"flex items-center gap-1",children:[a.jsx(ma,{className:"h-3 w-3"}),l.friend.streak_days]})]},l.id)})})]})]})}function TRe(){const[e,t]=y.useState(""),[r,n]=y.useState([]),[s,i]=y.useState(!1),{toast:o}=ta(),l=async()=>{if(!e.trim())return;i(!0);const{data:u}=await ne.from("profiles").select("id, full_name, avatar_url, email").ilike("full_name",`%${e}%`).limit(5);u&&n(u),i(!1)},c=async u=>{const{data:{user:h}}=await ne.auth.getUser();if(!h)return;const{error:d}=await ne.from("friendships").insert({user_id:h.id,friend_id:u,status:"pending"});d?o({title:"Error",description:"Could not send friend request",variant:"destructive"}):(o({title:"Friend request sent!"}),n(r.filter(f=>f.id!==u)))};return a.jsxs(se,{className:"p-6",children:[a.jsxs("h3",{className:"text-lg font-bold mb-4 flex items-center gap-2",children:[a.jsx(y_,{className:"h-5 w-5"}),"Add Friends"]}),a.jsxs("div",{className:"flex gap-2 mb-4",children:[a.jsx(Je,{placeholder:"Search by name...",value:e,onChange:u=>t(u.target.value),onKeyPress:u=>u.key==="Enter"&&l()}),a.jsx(Y,{onClick:l,disabled:s,children:a.jsx(Tp,{className:"h-4 w-4"})})]}),a.jsx("div",{className:"space-y-3",children:r.map(u=>{var h;return a.jsxs("div",{className:"flex items-center gap-3 p-3 bg-gray-50 rounded-lg",children:[a.jsxs(_a,{children:[a.jsx(ds,{src:u.avatar_url}),a.jsx(Sa,{children:((h=u.full_name)==null?void 0:h[0])||"U"})]}),a.jsxs("div",{className:"flex-1",children:[a.jsx("p",{className:"font-semibold",children:u.full_name||"Anonymous"}),a.jsx("p",{className:"text-sm text-gray-500",children:u.email})]}),a.jsxs(Y,{size:"sm",onClick:()=>c(u.id),children:[a.jsx(y_,{className:"h-4 w-4 mr-1"}),"Add"]})]},u.id)})})]})}function ARe(){const[e,t]=y.useState([]),[r,n]=y.useState(""),[s,i]=y.useState(""),{toast:o}=ta();y.useEffect(()=>{l()},[]);const l=async()=>{const{data:{user:f}}=await ne.auth.getUser(),{data:m}=await ne.from("community_posts").select(`
954        *,
955        profile:profiles!community_posts_user_id_fkey(full_name, avatar_url)
956      `).order("created_at",{ascending:!1}).limit(20);if(m&&f){const{data:g}=await ne.from("post_likes").select("post_id").eq("user_id",f.id),p=new Set(g==null?void 0:g.map(v=>v.post_id));t(m.map(v=>({...v,user_liked:p.has(v.id)})))}},c=async()=>{if(!r.trim())return;const{data:{user:f}}=await ne.auth.getUser();if(!f)return;const{error:m}=await ne.from("community_posts").insert({user_id:f.id,content:r,milestone_type:s||null,milestone_value:s||null});m||(n(""),i(""),o({title:"Post shared!"}),l())},u=async(f,m)=>{const{data:{user:g}}=await ne.auth.getUser();
956g&&(m?(await ne.from("post_likes").delete().match({post_id:f,user_id:g.id}),await ne.rpc("decrement_likes",{post_id:f})):(await ne.from("post_likes").insert({post_id:f,user_id:g.id}),await ne.rpc("increment_likes",{post_id:f})),l())},h=f=>f?f.includes("streak")?a.jsx(ma,{className:"h-4 w-4 text-orange-500"}):f.includes("accuracy")?a.jsx(os,{className:"h-4 w-4 text-green-500"}):a.jsx(lr,{className:"h-4 w-4 text-yellow-500"}):null,d=f=>{const m=`${f.content} - Learning Malayalam!`,g=`https://twitter.com/intent/tweet?text=${encodeURIComponent(m)}`;window.open(g,"_blank")};return a.jsxs("div",{className:"space-y-6",children:[a.jsxs(se,{className:"p-6",children:[a.jsx("h3",{className:"text-lg font-bold mb-4",children:"Share Your Progress"}),a.jsx(ms,{placeholder:"What did you learn today?",value:r,onChange:f=>n(f.target.value),className:"mb-3"}),a.jsx("div",{className:"flex gap-2 mb-3",children:["🔥 Streak","🎯 Accuracy","🏆 Achievement"].map(f=>a.jsx(ke,{variant:s===f?"default":"outline",className:"cursor-pointer",onClick:()=>i(s===f?"":f),children:f},f))}),a.jsx(Y,{onClick:c,children:"Share Post"})]}),a.jsx("div",{className:"space-y-4",children:e.map(f=>{var m;return a.jsxs(se,{className:"p-6",children:[a.jsxs("div",{className:"flex items-start gap-3 mb-4",children:[a.jsxs(_a,{children:[a.jsx(ds,{src:f.profile.avatar_url}),a.jsx(Sa,{children:(m=f.profile.full_name)==null?void 0:m[0]})]}),a.jsxs("div",{className:"flex-1",children:[a.jsx("p",{className:"font-semibold",children:f.profile.full_name}),a.jsx("p",{className:"text-sm text-gray-500",children:W2(new Date(f.created_at),{addSuffix:!0})})]})]}),a.jsx("p",{className:"mb-3",children:f.content}),f.milestone_type&&a.jsxs(ke,{variant:"secondary",className:"mb-3",children:[h(f.milestone_type),a.jsx("span",{className:"ml-1",children:f.milestone_value})]}),a.jsxs("div",{className:"flex items-center gap-4 pt-3 border-t",children:[a.jsxs(Y,{variant:"ghost",size:"sm",onClick:()=>u(f.id,f.user_liked),className:f.user_liked?"text-red-500":"",children:[a.jsx(_D,{className:`h-4 w-4 mr-1 ${f.user_liked?"fill-current":""}`}),f.likes_count]}),a.jsxs(Y,{variant:"ghost",size:"sm",onClick:()=>d(f),children:[a.jsx(kD,{className:"h-4 w-4 mr-1"}),"Share"]})]})]},f.id)})})]})}function PRe({room:e}){const t=ei(),r={vowels:"bg-blue-100 text-blue-800",consonants:"bg-green-100 text-green-800",matras:"bg-purple-100 text-purple-800",conjuncts:"bg-orange-100 text-orange-800",general:"bg-gray-100 text-gray-800"};return a.jsxs(se,{className:"hover:shadow-lg transition-shadow",children:[a.jsxs(_e,{children:[a.jsxs("div",{className:"flex items-start justify-between",children:[a.jsxs("div",{children:[a.jsx(Se,{className:"text-lg",children:e.name}),a.jsx(hr,{className:"mt-1",children:e.description})]}),!e.is_public&&a.jsx(Ef,{className:"w-4 h-4 text-gray-400"})]}),a.jsx("div",{className:"flex gap-2 mt-2",children:a.jsx(ke,{className:r[e.topic]||r.general,children:e.topic})})]}),a.jsxs(ue,{children:[a.jsxs("div",{className:"flex items-center justify-between text-sm text-gray-600 mb-3",children:[a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx(Xn,{className:"w-4 h-4"}),a.jsxs("span",{children:[e.participant_count,"/",e.max_participants]})]}),a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx(nh,{className:"w-4 h-4"}),a.jsxs("span",{children:[Math.floor(e.timer_duration/60)," min"]})]})]}),a.jsx(Y,{onClick:()=>t(`/study-room/${e.id}`),className:"w-full",size:"sm",children:"Join Room"})]})]})}
956function ORe({open:e,onOpenChange:t}){const{user:r}=Jt(),n=ei(),[s,i]=y.useState(""),[o,l]=y.useState("vowels"),[c,u]=y.useState(""),[h,d]=y.useState(!0),[f,m]=y.useState("25"),g=async p=>{if(p.preventDefault(),!r)return;const v=`study-${Date.now()}`,{data:x}=await ne.functions.invoke("create-daily-room",{body:{roomName:v,properties:{exp:Math.floor(Date.now()/1e3)+86400}}}),{data:b}=await ne.from("study_rooms").insert({name:s,topic:o,description:c,is_public:h,created_by:r.id,timer_duration:parseInt(f)*60,daily_room_url:(x==null?void 0:x.url)||null}).select().single();b&&(await ne.from("room_participants").insert({room_id:b.id,user_id:r.id}),t(!1),n(`/study-room/${b.id}`))};return a.jsx(Ks,{open:e,onOpenChange:t,children:a.jsxs(fs,{className:"max-w-md",children:[a.jsx(Ys,{children:a.jsx(Xs,{children:"Create Study Room"})}),a.jsxs("form",{onSubmit:g,className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx(Re,{children:"Room Name"}),a.jsx(Je,{value:s,onChange:p=>i(p.target.value),required:!0})]}),a.jsxs("div",{children:[a.jsx(Re,{children:"Topic"}),a.jsxs(Nr,{value:o,onValueChange:l,children:[a.jsx(gr,{children:a.jsx(kr,{})}),a.jsxs(yr,{children:[a.jsx(Le,{value:"vowels",children:"Vowels"}),a.jsx(Le,{value:"consonants",children:"Consonants"}),a.jsx(Le,{value:"matras",children:"Matras"}),a.jsx(Le,{value:"conjuncts",children:"Conjuncts"}),a.jsx(Le,{value:"general",children:"General Practice"})]})]})]}),a.jsxs("div",{children:[a.jsx(Re,{children:"Description"}),a.jsx(ms,{value:c,onChange:p=>u(p.target.value)})]}),a.jsxs("div",{children:[a.jsx(Re,{children:"Timer Duration (minutes)"}),a.jsx(Je,{type:"number",value:f,onChange:p=>m(p.target.value),min:"5",max:"120"})]}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx(Re,{children:"Public Room"}),a.jsx(_n,{checked:h,onCheckedChange:d})]}),a.jsx(Y,{type:"submit",className:"w-full",children:"Create Room"})]})]})})}function MRe(){const[e,t]=y.useState([]),[r,n]=y.useState(!1);y.useEffect(()=>{if(s(),!!Di())try{const i=ne.channel("study-rooms-changes").on("postgres_changes",{event:"*",schema:"public",table:"study_rooms"},s).subscribe(o=>{(o==="CHANNEL_ERROR"||o==="TIMED_OUT")&&console.warn("[Community] Realtime subscription failed")});return()=>{try{ne.removeChannel(i)}catch{}}}catch(i){console.warn("[Community] Failed to set up realtime:",i)}},[]);const s=async()=>{const{data:i}=await ne.from("study_rooms").select("*").eq("is_active",!0).order("created_at",{ascending:!1});if(i){const o=await Promise.all(i.map(async l=>{const{count:c}=await ne.from("room_participants").select("*",{count:"exact",head:!0}).eq("room_id",l.id);return{...l,participant_count:c||0}}));t(o)}};return a.jsxs("div",{className:"container mx-auto px-4 py-8 max-w-7xl",children:[a.jsxs("div",{className:"mb-8",children:[a.jsx("h1",{className:"text-4xl font-bold mb-2",children:"Community"}),a.jsx("p",{className:"text-gray-600",children:"Connect with fellow Malayalam learners"})]}),a.jsxs(Pn,{defaultValue:"feed",className:"space-y-6",children:[a.jsxs(fn,{className:"grid w-full grid-cols-4 max-w-2xl",children:[a.jsxs(Oe,{value:"feed",className:"flex items-center gap-2",children:[a.jsx(SD,{className:"h-4 w-4"}),"Feed"]}),a.jsxs(Oe,{value:"rooms",className:"flex items-center gap-2",children:[a.jsx(fA,{className:"h-4 w-4"}),"Study Rooms"]}),a.jsxs(Oe,{value:"friends",className:"flex items-center gap-2",children:[a.jsx(Xn,{className:"h-4 w-4"}),"Friends"]}),a.jsxs(Oe,{value:"leaderboard",className:"flex items-center gap-2",children:[a.jsx(lr,{className:"h-4 w-4"}),"Leaderboard"]})]}),a.jsx(ze,{value:"feed",className:"space-y-6",children:a.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6",children:[a.jsx("div",{className:"lg:col-span-2",children:a.jsx(ARe,{})}),a.jsx("div",{className:"space-y-6",children:a.jsx(W3,{})})]})}),a.jsxs(ze,{value:"rooms",className:"space-y-6",children:[a.jsxs("div",{className:"flex justify-between items-center mb-6",children:[a.jsxs("div",{children:[a.jsx("h2",{className:"text-2xl font-bold",children:"Active Study Rooms"}),a.jsx("p",{className:"text-gray-600",children:"Join a study session or create your own"})]}),a.jsxs(Y,{onClick:()=>n(!0),children:[a.jsx(Ep,{className:"w-4 h-4 mr-2"}),"Create Room"]})]}),e.length===0?a.jsxs("div",{className:"text-center py-12 bg-white rounded-lg shadow-sm",children:[a.jsx(fA,{className:"w-12 h-12 text-gray-400 mx-auto mb-4"}),a.jsx("h3",{className:"text-lg font-semibold mb-2",children:"No active rooms"}),a.jsx("p",{className:"text-gray-600 mb-4",children:"Be the first to create a study room!"}),a.jsx(Y,{onClick:()=>n(!0),children:"Create Room"})]}):a.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:e.map(i=>a.jsx(PRe,{room:i},i.id))})]}),a.jsx(ze,{value:"friends",className:"space-y-6",children:a.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[a.jsx("div",{children:a.jsx(TRe,{})}),a.jsx("div",{children:a.jsx(ERe,{})})]})}),a.jsx(ze,{value:"leaderboard",children:a.jsx("div",{className:"max-w-2xl mx-auto",children:a.jsx(W3,{})})})]}),a.jsx(ORe,{open:r,onOpenChange:n})]})}function RRe({userId:e,selectedFriendId:t,onSelectFriend:r}){const[n,s]=y.useState([]),[i,o]=y.useState(!0);y.useEffect(()=>{l()},[e]);const l=async()=>{const{data:c}=await ne.from("friendships").select(`
957        user_id,
958        friend_id,
959        user:user_id(id, full_name, avatar_url),
960        friend:friend_id(id, full_name, avatar_url)
961      `).eq("status","accepted").or(`user_id.eq.${e},friend_id.eq.${e}`);if(!c)return;const u=await Promise.all(c.map(async h=>{const d=h.user_id===e?h.friend_id:h.user_id,f=h.user_id===e?h.friend:h.user,{data:m}=await ne.from("messages").select("content, created_at").or(`and(sender_id.eq.${e},receiver_id.eq.${d}),and(sender_id.eq.${d},receiver_id.eq.${e})`).order("created_at",{ascending:!1}).limit(1).single(),{count:g}=await ne.from("messages").select("*",{count:"exact",head:!0}).eq("sender_id",d).eq("receiver_id",e).eq("read",!1);return{friendId:d,friendName:(f==null?void 0:f.full_name)||"User",friendAvatar:f==null?void 0:f.avatar_url,lastMessage:(m==null?void 0:m.content)||"No messages yet",lastMessageTime:(m==null?void 0:m.created_at)||"",unreadCount:g||0}}));s(u.sort((h,d)=>new Date(d.lastMessageTime).getTime()-new Date(h.lastMessageTime).getTime())),o(!1)};return i?a.jsx("div",{className:"p-4",children:"Loading conversations..."}):a.jsx(Dp,{className:"h-full",children:a.jsx("div",{className:"space-y-2 p-2",children:n.map(c=>a.jsx("div",{onClick:()=>r(c.friendId),className:`p-3 rounded-lg cursor-pointer hover:bg-accent transition-colors ${t===c.friendId?"bg-accent":""}`,children:a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsxs(_a,{children:[a.jsx(ds,{src:c.friendAvatar||void 0}),a.jsx(Sa,{children:c.friendName[0]})]}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("p",{className:"font-semibold truncate",children:c.friendName}),c.unreadCount>0&&a.jsx(ke,{variant:"destructive",className:"ml-2",children:c.unreadCount})]}),a.jsx("p",{className:"text-sm text-muted-foreground truncate",children:c.lastMessage})]})]})},c.friendId))})})}function $Re({userId:e,friendId:t,friendName:r,friendAvatar:n,onTyping:s,isTyping:i}){const[o,l]=y.useState([]),c=y.useRef(null);y.useEffect(()=>{if(u(),h(),!Di()){const d=setInterval(u,5e3);return()=>clearInterval(d)}try{const d=ne.channel(`messages:${e}:${t}`).on("postgres_changes",{event:"INSERT",schema:"public",table:"messages",filter:`sender_id=eq.${t}`},f=>{f.new.receiver_id===e&&(l(m=>[...m,f.new]),h())}).subscribe(f=>{(f==="CHANNEL_ERROR"||f==="TIMED_OUT")&&console.warn("[ChatInterface] Realtime subscription failed, falling back to polling")});return()=>{try{ne.removeChannel(d)}catch{}}}catch(d){console.warn("[ChatInterface] Failed to set up realtime:",d);const f=setInterval(u,5e3);return()=>clearInterval(f)}},[e,t]),y.useEffect(()=>{var d;(d=c.current)==null||d.scrollIntoView({behavior:"smooth"})},[o]);const u=async()=>{try{const{data:d}=await ne.from("messages").select("*").or(`and(sender_id.eq.${e},receiver_id.eq.${t}),and(sender_id.eq.${t},receiver_id.eq.${e})`).order("created_at",{ascending:!0});d&&l(d)}catch(d){console.warn("[ChatInterface] Failed to load messages:",d)}},h=async()=>{try{await ne.from("messages").update({read:!0}).eq("sender_id",t).eq("receiver_id",e).eq("read",!1)}catch{}};return a.jsxs("div",{className:"flex flex-col h-full",children:[a.jsxs("div",{className:"border-b p-4 flex items-center gap-3",children:[a.jsxs(_a,{children:[a.jsx(ds,{src:n||void 0}),a.jsx(Sa,{children:r[0]})]}),a.jsxs("div",{children:[a.jsx("h3",{className:"font-semibold",children:r}),i&&a.jsx("p",{className:"text-xs text-muted-foreground",children:"typing..."})]})]}),a.jsx(Dp,{className:"flex-1 p-4",children:a.jsxs("div",{className:"space-y-4",children:[o.map(d=>a.jsx("div",{className:`flex ${d.sender_id===e?"justify-end":"justify-start"}`,children:a.jsxs("div",{className:`max-w-[70%] rounded-lg p-3 ${d.sender_id===e?"bg-primary text-primary-foreground":"bg-muted"}`,children:[a.jsx("p",{children:d.content}),a.jsx("p",{className:"text-xs opacity-70 mt-1",children:W2(new Date(d.created_at),{addSuffix:!0})})]})},d.id)),a.jsx("div",{ref:c})]})})]})}function IRe({userId:e,friendId:t,onTyping:r}){const[n,s]=y.useState(""),[i,o]=y.useState(!1),l=y.useRef(null),c=d=>{s(d),l.current&&clearTimeout(l.current),d.length>0?(r(!0),l.current=setTimeout(()=>{r(!1)},2e3)):r(!1)};y.useEffect(()=>()=>{l.current&&clearTimeout(l.current)},[]);const u=async()=>
961{if(!n.trim()||i)return;o(!0);const{error:d}=await ne.from("messages").insert({sender_id:e,receiver_id:t,content:n.trim()});d?Pe.error("Failed to send message"):(s(""),r(!1)),o(!1)},h=d=>{d.key==="Enter"&&!d.shiftKey&&(d.preventDefault(),u())};return a.jsx("div",{className:"border-t p-4",children:a.jsxs("div",{className:"flex gap-2",children:[a.jsx(ms,{value:n,onChange:d=>c(d.target.value),onKeyPress:h,placeholder:"Type a message...",className:"resize-none",rows:2}),a.jsx(Y,{onClick:u,disabled:!n.trim()||i,size:"icon",children:a.jsx(n2,{className:"h-4 w-4"})})]})})}function DRe(){const{user:e}=Jt(),[t,r]=y.useState(null),[n,s]=y.useState(null),[i,o]=y.useState(!1),[l,c]=y.useState(!1),u=y.useRef(null);y.useEffect(()=>(t&&(h(),d()),()=>{if(u.current){try{ne.removeChannel(u.current)}catch{}u.current=null}}),[t]);const h=async()=>{if(t)try{const{data:m}=await ne.from("profiles").select("full_name, avatar_url").eq("id",t).single();m&&s({name:m.full_name||"User",avatar:m.avatar_url})}catch(m){console.warn("[Messages] Failed to load friend info:",m)}},d=()=>{if(!Di()){console.log("[Messages] Realtime disabled, skipping typing subscription");return}try{const m=ne.channel(`typing:${e==null?void 0:e.id}:${t}`);m.on("broadcast",{event:"typing"},g=>{g.payload.userId===t&&c(g.payload.isTyping)}).subscribe(g=>{(g==="CHANNEL_ERROR"||g==="TIMED_OUT")&&console.warn("[Messages] Typing subscription failed")}),u.current=m}catch(m){console.warn("[Messages] Failed to set up typing subscription:",m)}},f=m=>{if(o(m),!(!Di()||!t))try{ne.channel(`typing:${t}:${e==null?void 0:e.id}`).send({type:"broadcast",event:"typing",payload:{userId:e==null?void 0:e.id,isTyping:m}})}catch{}};return e?a.jsxs("div",{className:"container mx-auto p-6 h-[calc(100vh-4rem)]",children:[a.jsx("h1",{className:"text-3xl font-bold mb-6",children:"Messages"}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4 h-[calc(100%-5rem)]",children:[a.jsx(se,{className:"md:col-span-1 h-full",children:a.jsx(RRe,{userId:e.id,selectedFriendId:t,onSelectFriend:r})}),a.jsx(se,{className:"md:col-span-2 h-full flex flex-col",children:t&&n?a.jsxs(a.Fragment,{children:[a.jsx($Re,{userId:e.id,friendId:t,friendName:n.name,friendAvatar:n.avatar,onTyping:f,isTyping:l}),a.jsx(IRe,{userId:e.id,friendId:t,onTyping:f})]}):a.jsx("div",{className:"flex-1 flex items-center justify-center text-muted-foreground",children:a.jsxs("div",{className:"text-center",children:[a.jsx(yd,{className:"h-16 w-16 mx-auto mb-4 opacity-50"}),a.jsx("p",{children:"Select a conversation to start messaging"})]})})})]})]}):null}function LRe({duration:e,startedAt:t,pausedAt:r,elapsed:n,isCreator:s,onStart:i,onPause:o,onReset:l}){const[c,u]=y.useState(e-n);y.useEffect(()=>{if(!t||r){u(e-n);return}const m=setInterval(()=>{const g=Date.now(),p=new Date(t).getTime(),v=Math.floor((g-p)/1e3)+n,x=Math.max(0,e-v);u(x),x===0&&clearInterval(m)},100);return()=>clearInterval(m)},[t,r,n,e]);const h=Math.floor(c/60),d=c%60,f=t&&!r;return a.jsxs("div",{className:"bg-white rounded-lg shadow-sm p-6 text-center",children:[a.jsxs("div",{className:"text-5xl font-bold text-blue-600 mb-4",children:[String(h).padStart(2,"0"),":",String(d).padStart(2,"0")]}),s&&a.jsxs("div",{className:"flex gap-2 justify-center",children:[f?a.jsxs(Y,{onClick:o,size:"sm",variant:"outline",children:[a.jsx(ss,{className:"w-4 h-4 mr-1"}),"Pause"]}):a.jsxs(Y,{onClick:i,size:"sm",children:[a.jsx(Bt,{className:"w-4 h-4 mr-1"}),"Start"]}),a.jsxs(Y,{onClick:l,size:"sm",variant:"outline",children:[a.jsx(Gn,{className:"w-4 h-4 mr-1"}),"Reset"]})]})]})}function FRe({roomId:e}){const[t,r]=y.useState([]);y.useEffect(()=>{n();const s=ne.channel(`room-participants-${e}`).on("postgres_changes",{event:"*",schema:"public",table:"room_participants",filter:`room_id=eq.${e}`},()=>{n()}).subscribe();return()=>{ne.removeChannel(s)}},[e]);const n=async()=>{const{data:s}=await ne.from("room_participants").select("*, profiles(username, avatar_url)").eq("room_id",e);s&&r(s)};return a.jsxs("div",{className:"bg-white rounded-lg shadow-sm p-4",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[a.jsx(Xn,{className:"w-5 h-5 text-blue-600"}),a.jsxs("h3",{className:"font-semibold",children:["Participants (",t.length,")"]})]}),a.jsx("div",{className:"space-y-2",children:t.map(s=>{var i,o,l,c;return a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs(_a,{className:"w-8 h-8",children:[a.jsx(ds,{src:((i=s.profiles)==null?void 0:i.avatar_url)||""}),a.jsx(Sa,{children:((l=(o=s.profiles)==null?void 0:o.username)==null?void 0:l[0])||"U"})]}),a.jsx("span",{className:"text-sm",children:((c=s.profiles)==null?void 0:c.username)||"User"}),s.is_typing&&a.jsx("span",{className:"text-xs text-gray-500 italic",children:"typing..."})]},s.id)})})]})}function zRe({roomId:e}){const{user:t}=Jt(),[r,n]=y.useState([]),[s,i]=y.useState(""),o=y.useRef(null);y.useEffect(()=>{l();const u=ne.channel(`room-chat-${e}`).on("postgres_changes",{event:"INSERT",schema:"public",table:"room_messages",filter:`room_id=eq.${e}`},()=>{l()}).subscribe();return()=>{ne.removeChannel(u)}},[e]),y.useEffect(()=>{var u;(u=o.current)==null||u.scrollIntoView({behavior:"smooth"})},[r]);const l=async()=>{const{data:u}=await ne.from("room_messages").select("*, profiles(username)").eq("room_id",e).order("created_at",{ascending:!0});u&&n(u)},c=async u=>{u.preventDefault(),!(!s.trim()||!t)&&(await ne.from("room_messages").insert({room_id:e,sender_id:t.id,content:s.trim()}),i(""))};return a.jsxs("div",{className:"bg-white rounded-lg shadow-sm flex flex-col h-[400px]",children:[a.jsx("div",{className:"p-4 border-b",children:a.jsx("h3",{className:"font-semibold",children:"Group Chat"})}),a.jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-2",children:[r.map(u=>{var h;return a.jsx("div",{className:`flex ${u.sender_id===(t==null?void 0:t.id)?"justify-end":"justify-start"}`,children:a.jsxs("div",{className:`max-w-[70%] rounded-lg p-2 ${u.sender_id===(t==null?void 0:t.id)?"bg-blue-600 text-white":"bg-gray-100"}`,children:[a.jsx("div",{className:"text-xs opacity-75 mb-1",children:(h=u.profiles)==null?void 0:h.username}),a.jsx("div",{className:"text-sm",children:u.content})]})},u.id)}),a.jsx("div",{ref:o})]}),a.jsxs("form",{onSubmit:c,className:"p-4 border-t flex gap-2",children:[a.jsx(Je,{value:s,onChange:u=>i(u.target.value),placeholder:"Type a message..."}),a.jsx(Y,{type:"submit",size:"sm",children:a.jsx(n2,{className:"w-4 h-4"})})]})]})}function Y1(e,t){if(e==null)return{};var r,n,s=function(o,l){if(o==null)return{};var c,u,h={},d=Object.keys(o);for(u=0;
961u<d.length;u++)c=d[u],l.indexOf(c)>=0||(h[c]=o[c]);return h}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(s[r]=e[r])}return s}function bs(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Et(e){return Et=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Et(e)}function WW(e){var t=function(r,n){if(Et(r)!=="object"||r===null)return r;var s=r[Symbol.toPrimitive];if(s!==void 0){var i=s.call(r,n);if(Et(i)!=="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(n==="string"?String:Number)(r)}(e,"string");return Et(t)==="symbol"?t:String(t)}function V3(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,WW(n.key),n)}}function ws(e,t,r){return t&&V3(e.prototype,t),r&&V3(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function oi(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function cp(e,t){return cp=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},cp(e,t)}function lw(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&cp(e,t)}function cw(e,t){if(t&&(Et(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return oi(e)}function ps(e){return ps=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},ps(e)}function fo(e,t,r){return(t=WW(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function H3(e,t,r,n,s,i,o){try{var l=e[i](o),c=l.value}catch(u){return void r(u)}l.done?t(c):Promise.resolve(c).then(n,s)}function Ue(e){return function(){var t=this,r=arguments;return new Promise(function(n,s){var i=e.apply(t,r);function o(c){H3(i,n,s,o,l,"next",c)}function l(c){H3(i,n,s,o,l,"throw",c)}o(void 0)})}}function q3(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function xc(e,t){return function(r){if(Array.isArray(r))return r}(e)||function(r,n){var s=r==null?null:typeof Symbol<"u"&&r[Symbol.iterator]||r["@@iterator"];if(s!=null){var i,o,l,c,u=[],h=!0,d=!1;try{if(l=(s=s.call(r)).next,n===0){if(Object(s)!==s)return;h=!1}else for(;!(h=(i=l.call(s)).done)&&(u.push(i.value),u.length!==n);h=!0);}catch(f){d=!0,o=f}finally{try{if(!h&&s.return!=null&&(c=s.return(),Object(c)!==c))return}finally{if(d)throw o}}return u}}(e,t)||function(r,n){if(r){if(typeof r=="string")return q3(r,n);var s=Object.prototype.toString.call(r).slice(8,-1);return s==="Object"&&r.constructor&&(s=r.constructor.name),s==="Map"||s==="Set"?Array.from(r):s==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(s)?q3(r,n):void 0}}(e,t)||function(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
962In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}()}var VW,ji={},BRe={get exports(){return ji},set exports(e){ji=e}},qu=typeof Reflect=="object"?Reflect:null,G3=qu&&typeof qu.apply=="function"?qu.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)};VW=qu&&typeof qu.ownKeys=="function"?qu.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var K3=Number.isNaN||function(e){return e!=e};function yt(){yt.init.call(this)}BRe.exports=yt,ji.once=function(e,t){return new Promise(function(r,n){function s(o){e.removeListener(t,i),n(o)}function i(){typeof e.removeListener=="function"&&e.removeListener("error",s),r([].slice.call(arguments))}e4(e,t,i,{once:!0}),t!=="error"&&function(o,l,c){typeof o.on=="function"&&e4(o,"error",l,c)}(e,s,{once:!0})})},yt.EventEmitter=yt,yt.prototype._events=void 0,yt.prototype._eventsCount=0,yt.prototype._maxListeners=void 0;var Y3=10;function Wy(e){if(typeof e!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function HW(e){return e._maxListeners===void 0?yt.defaultMaxListeners:e._maxListeners}function X3(e,t,r,n){var s,i,o,l;if(Wy(r),(i=e._events)===void 0?(i=e._events=Object.create(null),e._eventsCount=0):(i.newListener!==void 0&&(e.emit("newListener",t,r.listener?r.listener:r),i=e._events),o=i[t]),o===void 0)
vendor: 4,868 bytes, line 962
962o=i[t]=r,++e._eventsCount;else if(typeof o=="function"?o=i[t]=n?[r,o]:[o,r]:n?o.unshift(r):o.push(r),(s=HW(e))>0&&o.length>s&&!o.warned){o.warned=!0;var c=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");c.name="MaxListenersExceededWarning",c.emitter=e,c.type=t,c.count=o.length,l=c,console&&console.warn&&console.warn(l)}return e}function URe(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function Q3(e,t,r){var n={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},s=URe.bind(n);return s.listener=r,n.wrapFn=s,s}function J3(e,t,r){var n=e._events;if(n===void 0)return[];var s=n[t];return s===void 0?[]:typeof s=="function"?r?[s.listener||s]:[s]:r?function(i){for(var o=new Array(i.length),l=0;l<o.length;++l)o[l]=i[l].listener||i[l];return o}(s):qW(s,s.length)}function Z3(e){var t=this._events;if(t!==void 0){var r=t[e];if(typeof r=="function")return 1;if(r!==void 0)return r.length}return 0}function qW(e,t){for(var r=new Array(t),n=0;n<t;++n)r[n]=e[n];return r}function e4(e,t,r,n){if(typeof e.on=="function")n.once?e.once(t,r):e.on(t,r);else{if(typeof e.addEventListener!="function")throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e);e.addEventListener(t,function s(i){n.once&&e.removeEventListener(t,s),r(i)})}}Object.defineProperty(yt,"defaultMaxListeners",{enumerable:!0,get:function(){return Y3},set:function(e){if(typeof e!="number"||e<0||K3(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");Y3=e}}),yt.init=function(){this._events!==void 0&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},yt.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||K3(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},yt.prototype.getMaxListeners=function(){return HW(this)},yt.prototype.emit=function(e){for(var t=[],r=1;r<arguments.length;r++)t.push(arguments[r]);var n=e==="error",s=this._events;if(s!==void 0)n=n&&s.error===void 0;else if(!n)return!1;if(n){var i;if(t.length>0&&(i=t[0]),i instanceof Error)throw i;var o=new Error("Unhandled error."+(i?" ("+i.message+")":""));throw o.context=i,o}var l=s[e];if(l===void 0)return!1;if(typeof l=="function")G3(l,this,t);else{var c=l.length,u=qW(l,c);for(r=0;r<c;++r)G3(u[r],this,t)}return!0},yt.prototype.addListener=function(e,t){return X3(this,e,t,!1)},yt.prototype.on=yt.prototype.addListener,yt.prototype.prependListener=function(e,t){return X3(this,e,t,!0)},yt.prototype.once=function(e,t){return Wy(t),this.on(e,Q3(this,e,t)),this},yt.prototype.prependOnceListener=function(e,t){return Wy(t),this.prependListener(e,Q3(this,e,t)),this},yt.prototype.removeListener=function(e,t){var r,n,s,i,o;if(Wy(t),(n=this._events)===void 0)return this;if((r=n[e])===void 0)return this;if(r===t||r.listener===t)--this._eventsCount==0?this._events=Object.create(null):(delete n[e],n.removeListener&&this.emit("removeListener",e,r.listener||t));else if(typeof r!="function"){for(s=-1,i=r.length-1;i>=0;i--)if(r[i]===t||r[i].listener===t){o=r[i].listener,s=i;break}if(s<0)return this;s===0?r.shift():function(l,c){for(;c+1<l.length;c++)l[c]=l[c+1];l.pop()}(r,s),r.length===1&&(n[e]=r[0]),n.removeListener!==void 0&&this.emit("removeListener",e,o||t)}return this},yt.prototype.off=yt.prototype.removeListener,yt.prototype.removeAllListeners=function(e){var t,r,n;if((r=this._events)===void 0)return this;if(r.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):r[e]!==void 0&&(--this._eventsCount==0?this._events=Object.create(null):delete r[e]),this;if(arguments.length===0){var s,i=Object.keys(r);for(n=0;n<i.length;++n)(s=i[n])!=="removeListener"&&this.removeAllListeners(s);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(typeof(t=r[e])=="function")this.removeListener(e,t);else if(t!==void 0)for(n=t.length-1;n>=0;n--)this.removeListener(e,t[n]);return this},yt.prototype.listeners=function(e){return J3(this,e,!0)},yt.prototype.rawListeners=function(e){return J3(this,e,!1)},yt.listenerCount=function(e,t){return typeof e.listenerCount=="function"?e.listenerCount(t):Z3.call(e,t)},yt.prototype.listenerCount=Z3,yt.prototype.eventNames=function(){return this._eventsCount>0?VW(this._events):[]};var t4=Object.prototype.hasOwnProperty;function r4(e,t,r){for(r of e.keys())if(bn(r,t))return r}function bn(e,t){var r,n,s;if(e===t)return!0;
962if(e&&t&&(r=e.constructor)===t.constructor){if(r===Date)return e.getTime()===t.getTime();if(r===RegExp)return e.toString()===t.toString();if(r===Array){if((n=e.length)===t.length)for(;n--&&bn(e[n],t[n]););return n===-1}if(r===Set){if(e.size!==t.size)return!1;for(n of e)if((s=n)&&typeof s=="object"&&!(s=r4(t,s))||!t.has(s))return!1;return!0}if(r===Map){if(e.size!==t.size)return!1;for(n of e)if((s=n[0])&&typeof s=="object"&&!(s=r4(t,s))||!bn(n[1],t.get(s)))return!1;return!0}if(r===ArrayBuffer)e=new Uint8Array(e),t=new Uint8Array(t);else if(r===DataView){if((n=e.byteLength)===t.byteLength)for(;n--&&e.getInt8(n)===t.getInt8(n););return n===-1}if(ArrayBuffer.isView(e)){if((n=e.byteLength)===t.byteLength)for(;n--&&e[n]===t[n];);return n===-1}if(!r||typeof e=="object"){for(r in n=0,e)if(t4.call(e,r)&&++n&&!t4.call(t,r)||!(r in t)||!bn(e[r],t[r]))return!1;return Object.keys(t).length===n}}return e!=e&&t!=t}const WRe={"Amazon Silk":"amazon_silk","Android Browser":"android",Bada:"bada",BlackBerry:"blackberry",Chrome:"chrome",Chromium:"chromium",Electron:"electron",Epiphany:"epiphany",Firefox:"firefox",Focus:"focus",Generic:"generic","Google Search":"google_search",Googlebot:"googlebot","Internet Explorer":"ie","K-Meleon":"k_meleon",Maxthon:"maxthon","Microsoft Edge":"edge","MZ Browser":"mz","NAVER Whale Browser":"naver",Opera:"opera","Opera Coast":"opera_coast",PhantomJS:"phantomjs",Puffin:"puffin",QupZilla:"qupzilla",QQ:"qq",QQLite:"qqlite",Safari:"safari",Sailfish:"sailfish","Samsung Internet for Android":"samsung_internet",SeaMonkey:"seamonkey",Sleipnir:"sleipnir",Swing:"swing",Tizen:"tizen","UC Browser":"uc",Vivaldi:"vivaldi","WebOS Browser":"webos",WeChat:"wechat","Yandex Browser":"yandex",Roku:"roku"},GW={amazon_silk:"Amazon Silk",android:"Android Browser",bada:"Bada",blackberry:"BlackBerry",chrome:"Chrome",chromium:"Chromium",electron:"Electron",epiphany:"Epiphany",firefox:"Firefox",focus:"Focus",generic:"Generic",googlebot:"Googlebot",google_search:"Google Search",ie:"Internet Explorer",k_meleon:"K-Meleon",maxthon:"Maxthon",edge:"Microsoft Edge",mz:"MZ Browser",naver:"NAVER Whale Browser",opera:"Opera",opera_coast:"Opera Coast",phantomjs:"PhantomJS",puffin:"Puffin",qupzilla:"QupZilla",qq:"QQ Browser",qqlite:"QQ Browser Lite",safari:"Safari",sailfish:"Sailfish",samsung_internet:"Samsung Internet for Android",seamonkey:"SeaMonkey",sleipnir:"Sleipnir",swing:"Swing",tizen:"Tizen",uc:"UC Browser",vivaldi:"Vivaldi",webos:"WebOS Browser",wechat:"WeChat",yandex:"Yandex Browser"},Zt={tablet:"tablet",mobile:"mobile",desktop:"desktop",tv:"tv"},Zr={WindowsPhone:"Windows Phone",Windows:"Windows",MacOS:"macOS",iOS:"iOS",Android:"Android",WebOS:"WebOS",BlackBerry:"BlackBerry",Bada:"Bada",Tizen:"Tizen",Linux:"Linux",ChromeOS:"Chrome OS",PlayStation4:"PlayStation 4",Roku:"Roku"},lo={EdgeHTML:"EdgeHTML",Blink:"Blink",Trident:"Trident",Presto:"Presto",Gecko:"Gecko",WebKit:"WebKit"};class ge{static getFirstMatch(t,r){const n=r.match(t);return n&&n.length>0&&n[1]||""}static getSecondMatch(t,r){const n=r.match(t);return n&&n.length>1&&n[2]||""}static matchAndReturnConst(t,r,n){if(t.test(r))return n}
962static getWindowsVersionName(t){switch(t){case"NT":return"NT";case"XP":case"NT 5.1":return"XP";case"NT 5.0":return"2000";case"NT 5.2":return"2003";case"NT 6.0":return"Vista";case"NT 6.1":return"7";case"NT 6.2":return"8";case"NT 6.3":return"8.1";case"NT 10.0":return"10";default:return}}static getMacOSVersionName(t){const r=t.split(".").splice(0,2).map(n=>parseInt(n,10)||0);if(r.push(0),r[0]===10)switch(r[1]){case 5:return"Leopard";case 6:return"Snow Leopard";case 7:return"Lion";case 8:return"Mountain Lion";case 9:return"Mavericks";case 10:return"Yosemite";case 11:return"El Capitan";case 12:return"Sierra";case 13:return"High Sierra";case 14:return"Mojave";case 15:return"Catalina";default:return}}static getAndroidVersionName(t){const r=t.split(".").splice(0,2).map(n=>parseInt(n,10)||0);if(r.push(0),!(r[0]===1&&r[1]<5))return r[0]===1&&r[1]<6?"Cupcake":r[0]===1&&r[1]>=6?"Donut":r[0]===2&&r[1]<2?"Eclair":r[0]===2&&r[1]===2?"Froyo":r[0]===2&&r[1]>2?"Gingerbread":r[0]===3?"Honeycomb":r[0]===4&&r[1]<1?"Ice Cream Sandwich":r[0]===4&&r[1]<4?"Jelly Bean":r[0]===4&&r[1]>=4?"KitKat":r[0]===5?"Lollipop":r[0]===6?"Marshmallow":r[0]===7?"Nougat":r[0]===8?"Oreo":r[0]===9?"Pie":void 0}static getVersionPrecision(t){return t.split(".").length}static compareVersions(t,r,n=!1){const s=ge.getVersionPrecision(t),i=ge.getVersionPrecision(r);let o=Math.max(s,i),l=0;const c=ge.map([t,r],u=>{const h=o-ge.getVersionPrecision(u),d=u+new Array(h+1).join(".0");return ge.map(d.split("."),f=>new Array(20-f.length).join("0")+f).reverse()});for(n&&(l=o-Math.min(s,i)),o-=1;o>=l;){if(c[0][o]>c[1][o])return 1;if(c[0][o]===c[1][o]){if(o===l)return 0;o-=1}else if(c[0][o]<c[1][o])return-1}}static map(t,r){const n=[];let s;if(Array.prototype.map)return Array.prototype.map.call(t,r);for(s=0;s<t.length;s+=1)n.push(r(t[s]));return n}static find(t,r){let n,s;if(Array.prototype.find)return Array.prototype.find.call(t,r);for(n=0,s=t.length;n<s;n+=1){const i=t[n];if(r(i,n))return i}}static assign(t,...r){const n=t;let s,i;if(Object.assign)return Object.assign(t,...r);for(s=0,i=r.length;s<i;s+=1){const o=r[s];typeof o=="object"&&o!==null&&Object.keys(o).forEach(l=>{n[l]=o[l]})}return t}static getBrowserAlias(t){return WRe[t]}static getBrowserTypeByAlias(t){return GW[t]||""}}const xt=/version\/(\d+(\.?_?\d+)+)/i,VRe=[{test:[/googlebot/i],describe(e){const t={name:"Googlebot"},r=ge.getFirstMatch(/googlebot\/(\d+(\.\d+))/i,e)||ge.getFirstMatch(xt,e);return r&&(t.version=r),t}},{test:[/opera/i],describe(e){const t={name:"Opera"},r=ge.getFirstMatch(xt,e)||ge.getFirstMatch(/(?:opera)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/opr\/|opios/i],describe(e){const t={name:"Opera"},r=ge.getFirstMatch(/(?:opr|opios)[\s/](\S+)/i,e)||ge.getFirstMatch(xt,e);return r&&(t.version=r),t}},{test:[/SamsungBrowser/i],describe(e){const t={name:"Samsung Internet for Android"},r=ge.getFirstMatch(xt,e)||ge.getFirstMatch(/(?:SamsungBrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/Whale/i],describe(e){const t={name:"NAVER Whale Browser"},r=ge.getFirstMatch(xt,e)||ge.getFirstMatch(/(?:whale)[\s/](\d+(?:\.\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/MZBrowser/i],describe(e){const t={name:"MZ Browser"},r=ge.getFirstMatch(/(?:MZBrowser)[\s/](\d+(?:\.\d+)+)/i,e)||ge.getFirstMatch(xt,e);return r&&(t.version=r),t}},{test:[/focus/i],describe(e){const t={name:"Focus"},r=ge.getFirstMatch(/(?:focus)[\s/](\d+(?:\.\d+)+)/i,e)||ge.getFirstMatch(xt,e);return r&&(t.version=r),t}},{test:[/swing/i],describe(e){const t={name:"Swing"},r=ge.getFirstMatch(/(?:swing)[\s/](\d+(?:\.\d+)+)/i,e)||ge.getFirstMatch(xt,e);return r&&(t.version=r),t}},{test:[/coast/i],describe(e){const t={name:"Opera Coast"},r=ge.getFirstMatch(xt,e)||ge.getFirstMatch(/(?:coast)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/opt\/\d+(?:.?_?\d+)+/i],describe(e){const t={name:"Opera Touch"},r=ge.getFirstMatch(/(?:opt)[\s/](\d+(\.?_?\d+)+)/i,e)||ge.getFirstMatch(xt,e);return r&&(t.version=r),t}},{test:[/yabrowser/i],describe(e){const t={name:"Yandex Browser"},r=ge.getFirstMatch(/(?:yabrowser)[\s/](\d+(\.?_?\d+)+)/i,e)||ge.getFirstMatch(xt,e);return r&&(t.version=r),t}},{test:[/ucbrowser/i],describe(e){const t={name:"UC Browser"},r=ge.getFirstMatch(xt,e)||ge.getFirstMatch(/(?:ucbrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/Maxthon|mxios/i],describe(e){const t={name:"Maxthon"}
vendor: 6,850 bytes, line 962
962,r=ge.getFirstMatch(xt,e)||ge.getFirstMatch(/(?:Maxthon|mxios)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/epiphany/i],describe(e){const t={name:"Epiphany"},r=ge.getFirstMatch(xt,e)||ge.getFirstMatch(/(?:epiphany)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/puffin/i],describe(e){const t={name:"Puffin"},r=ge.getFirstMatch(xt,e)||ge.getFirstMatch(/(?:puffin)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/sleipnir/i],describe(e){const t={name:"Sleipnir"},r=ge.getFirstMatch(xt,e)||ge.getFirstMatch(/(?:sleipnir)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/k-meleon/i],describe(e){const t={name:"K-Meleon"},r=ge.getFirstMatch(xt,e)||ge.getFirstMatch(/(?:k-meleon)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/micromessenger/i],describe(e){const t={name:"WeChat"},r=ge.getFirstMatch(/(?:micromessenger)[\s/](\d+(\.?_?\d+)+)/i,e)||ge.getFirstMatch(xt,e);return r&&(t.version=r),t}},{test:[/qqbrowser/i],describe(e){const t={name:/qqbrowserlite/i.test(e)?"QQ Browser Lite":"QQ Browser"},r=ge.getFirstMatch(/(?:qqbrowserlite|qqbrowser)[/](\d+(\.?_?\d+)+)/i,e)||ge.getFirstMatch(xt,e);return r&&(t.version=r),t}},{test:[/msie|trident/i],describe(e){const t={name:"Internet Explorer"},r=ge.getFirstMatch(/(?:msie |rv:)(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/\sedg\//i],describe(e){const t={name:"Microsoft Edge"},r=ge.getFirstMatch(/\sedg\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/edg([ea]|ios)/i],describe(e){const t={name:"Microsoft Edge"},r=ge.getSecondMatch(/edg([ea]|ios)\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/vivaldi/i],describe(e){const t={name:"Vivaldi"},r=ge.getFirstMatch(/vivaldi\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/seamonkey/i],describe(e){const t={name:"SeaMonkey"},r=ge.getFirstMatch(/seamonkey\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/sailfish/i],describe(e){const t={name:"Sailfish"},r=ge.getFirstMatch(/sailfish\s?browser\/(\d+(\.\d+)?)/i,e);return r&&(t.version=r),t}},{test:[/silk/i],describe(e){const t={name:"Amazon Silk"},r=ge.getFirstMatch(/silk\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/phantom/i],describe(e){const t={name:"PhantomJS"},r=ge.getFirstMatch(/phantomjs\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/slimerjs/i],describe(e){const t={name:"SlimerJS"},r=ge.getFirstMatch(/slimerjs\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe(e){const t={name:"BlackBerry"},r=ge.getFirstMatch(xt,e)||ge.getFirstMatch(/blackberry[\d]+\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/(web|hpw)[o0]s/i],describe(e){const t={name:"WebOS Browser"},r=ge.getFirstMatch(xt,e)||ge.getFirstMatch(/w(?:eb)?[o0]sbrowser\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/bada/i],describe(e){const t={name:"Bada"},r=ge.getFirstMatch(/dolfin\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/tizen/i],describe(e){const t={name:"Tizen"},r=ge.getFirstMatch(/(?:tizen\s?)?browser\/(\d+(\.?_?\d+)+)/i,e)||ge.getFirstMatch(xt,e);return r&&(t.version=r),t}},{test:[/qupzilla/i],describe(e){const t={name:"QupZilla"},r=ge.getFirstMatch(/(?:qupzilla)[\s/](\d+(\.?_?\d+)+)/i,e)||ge.getFirstMatch(xt,e);return r&&(t.version=r),t}},{test:[/firefox|iceweasel|fxios/i],describe(e){const t={name:"Firefox"},r=ge.getFirstMatch(/(?:firefox|iceweasel|fxios)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/electron/i],describe(e){const t={name:"Electron"},r=ge.getFirstMatch(/(?:electron)\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/MiuiBrowser/i],describe(e){const t={name:"Miui"},r=ge.getFirstMatch(/(?:MiuiBrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/chromium/i],describe(e){const t={name:"Chromium"},r=ge.getFirstMatch(/(?:chromium)[\s/](\d+(\.?_?\d+)+)/i,e)||ge.getFirstMatch(xt,e);return r&&(t.version=r),t}},{test:[/chrome|crios|crmo/i],describe(e){const t={name:"Chrome"},r=ge.getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/GSA/i],describe(e){const t={name:"Google Search"},r=ge.getFirstMatch(/(?:GSA)\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test(e){const t=!e.test(/like android/i),r=e.test(/android/i);return t&&r},describe(e){const t={name:"Android Browser"},r=ge.getFirstMatch(xt,e);return r&&(t.version=r),t}},{test:[/playstation 4/i],describe(e){const t={name:"PlayStation 4"},r=ge.getFirstMatch(xt,e);return r&&(t.version=r),t}},{test:[/safari|applewebkit/i],describe(e){const t={name:"Safari"},r=ge.getFirstMatch(xt,e);return r&&(t.version=r),t}},{test:[/.*/i],describe(e){const t=e.search("\\(")!==-1?/^(.*)\/(.*)[ \t]\((.*)/:/^(.*)\/(.*) /;return{name:ge.getFirstMatch(t,e),version:ge.getSecondMatch(t,e)}}}];var HRe=[{test:[/Roku\/DVP/],describe(e){const t=ge.getFirstMatch(/Roku\/DVP-(\d+\.\d+)/i,e);return{name:Zr.Roku,version:t}}},{test:[/windows phone/i],describe(e){const t=ge.getFirstMatch(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i,e);return{name:Zr.WindowsPhone,version:t}}},{test:[/windows /i],describe(e){const t=ge.getFirstMatch(/Windows ((NT|XP)( \d\d?.\d)?)/i,e),r=ge.getWindowsVersionName(t);return{name:Zr.Windows,version:t,versionName:r}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe(e){const t={name:Zr.iOS},r=ge.getSecondMatch(/(Version\/)(\d[\d.]+)/,e);return r&&(t.version=r),t}},{test:[/macintosh/i],describe(e){const t=ge.getFirstMatch(/mac os x (\d+(\.?_?\d+)+)/i,e).replace(/[_\s]/g,"."),r=ge.getMacOSVersionName(t),n={name:Zr.MacOS,version:t};return r&&(n.versionName=r),n}},{test:[/(ipod|iphone|ipad)/i],describe(e){const t=ge.getFirstMatch(/os (\d+([_\s]\d+)*) like mac os x/i,e).replace(/[_\s]/g,".");return{name:Zr.iOS,version:t}}},{test(e){const t=!e.test(/like android/i),r=e.test(/android/i);return t&&r},describe(e){const t=ge.getFirstMatch(/android[\s/-](\d+(\.\d+)*)/i,e),r=ge.getAndroidVersionName(t),n={name:Zr.Android,version:t};return r&&(n.versionName=r),n}},{test:[/(web|hpw)[o0]s/i],describe(e){const t=ge.getFirstMatch(/(?:web|hpw)[o0]s\/(\d+(\.\d+)*)/i,e),r={name:Zr.WebOS};return t&&t.length&&(r.version=t),r}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe(e){const t=ge.getFirstMatch(/rim\stablet\sos\s(\d+(\.\d+)*)/i,e)||ge.getFirstMatch(/blackberry\d+\/(\d+([_\s]\d+)*)/i,e)||ge.getFirstMatch(/\bbb(\d+)/i,e);return{name:Zr.BlackBerry,version:t}}},{test:[/bada/i],describe(e){const t=ge.getFirstMatch(/bada\/(\d+(\.\d+)*)/i,e);return{name:Zr.Bada,version:t}}},{test:[/tizen/i],describe(e){const t=ge.getFirstMatch(/tizen[/\s](\d+(\.\d+)*)/i,e);return{name:Zr.Tizen,version:t}}},{test:[/linux/i],describe:()=>({name:Zr.Linux})},{test:[/CrOS/],describe:()=>({name:Zr.ChromeOS})},{test:[/PlayStation 4/],describe(e){const t=ge.getFirstMatch(/PlayStation 4[/\s](\d+(\.\d+)*)/i,e);
962return{name:Zr.PlayStation4,version:t}}}],qRe=[{test:[/googlebot/i],describe:()=>({type:"bot",vendor:"Google"})},{test:[/huawei/i],describe(e){const t=ge.getFirstMatch(/(can-l01)/i,e)&&"Nova",r={type:Zt.mobile,vendor:"Huawei"};return t&&(r.model=t),r}},{test:[/nexus\s*(?:7|8|9|10).*/i],describe:()=>({type:Zt.tablet,vendor:"Nexus"})},{test:[/ipad/i],describe:()=>({type:Zt.tablet,vendor:"Apple",model:"iPad"})},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:()=>({type:Zt.tablet,vendor:"Apple",model:"iPad"})},{test:[/kftt build/i],describe:()=>({type:Zt.tablet,vendor:"Amazon",model:"Kindle Fire HD 7"})},{test:[/silk/i],describe:()=>({type:Zt.tablet,vendor:"Amazon"})},{test:[/tablet(?! pc)/i],describe:()=>({type:Zt.tablet})},{test(e){const t=e.test(/ipod|iphone/i),r=e.test(/like (ipod|iphone)/i);return t&&!r},describe(e){const t=ge.getFirstMatch(/(ipod|iphone)/i,e);return{type:Zt.mobile,vendor:"Apple",model:t}}},{test:[/nexus\s*[0-6].*/i,/galaxy nexus/i],describe:()=>({type:Zt.mobile,vendor:"Nexus"})},{test:[/[^-]mobi/i],describe:()=>({type:Zt.mobile})},{test:e=>e.getBrowserName(!0)==="blackberry",describe:()=>({type:Zt.mobile,vendor:"BlackBerry"})},{test:e=>e.getBrowserName(!0)==="bada",describe:()=>({type:Zt.mobile})},{test:e=>e.getBrowserName()==="windows phone",describe:()=>({type:Zt.mobile,vendor:"Microsoft"})},{test(e){const t=Number(String(e.getOSVersion()).split(".")[0]);return e.getOSName(!0)==="android"&&t>=3},describe:()=>({type:Zt.tablet})},{test:e=>e.getOSName(!0)==="android",describe:()=>({type:Zt.mobile})},{test:e=>e.getOSName(!0)==="macos",describe:()=>({type:Zt.desktop,vendor:"Apple"})},{test:e=>e.getOSName(!0)==="windows",describe:()=>({type:Zt.desktop})},{test:e=>e.getOSName(!0)==="linux",describe:()=>({type:Zt.desktop})},{test:e=>e.getOSName(!0)==="playstation 4",describe:()=>({type:Zt.tv})},{test:e=>e.getOSName(!0)==="roku",describe:()=>({type:Zt.tv})}],GRe=[{test:e=>e.getBrowserName(!0)==="microsoft edge",describe(e){if(/\sedg\//i.test(e))return{name:lo.Blink};const t=ge.getFirstMatch(/edge\/(\d+(\.?_?\d+)+)/i,e);return{name:lo.EdgeHTML,version:t}}},{test:[/trident/i],describe(e){const t={name:lo.Trident},r=ge.getFirstMatch(/trident\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:e=>e.test(/presto/i),describe(e){const t={name:lo.Presto},r=ge.getFirstMatch(/presto\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test(e){const t=e.test(/gecko/i),r=e.test(/like gecko/i);return t&&!r},describe(e){const t={name:lo.Gecko},r=ge.getFirstMatch(/gecko\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/(apple)?webkit\/537\.36/i],describe:()=>({name:lo.Blink})},{test:[/(apple)?webkit/i],describe(e){const t={name:lo.WebKit},r=ge.getFirstMatch(/webkit\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}}];class n4{constructor(t,r=!1){if(t==null||t==="")throw new Error("UserAgent parameter can't be empty");this._ua=t,this.parsedResult={},r!==!0&&this.parse()}getUA(){return this._ua}test(t){return t.test(this._ua)}parseBrowser(){this.parsedResult.browser={};const t=ge.find(VRe,r=>{if(typeof r.test=="function")return r.test(this);if(r.test instanceof Array)return r.test.some(n=>this.test(n));throw new Error("Browser's test function is not valid")});return t&&(this.parsedResult.browser=t.describe(this.getUA())),this.parsedResult.browser}getBrowser(){return this.parsedResult.browser?this.parsedResult.browser:this.parseBrowser()}getBrowserName(t){return t?String(this.getBrowser().name).toLowerCase()||"":this.getBrowser().name||""}getBrowserVersion(){return this.getBrowser().version}getOS(){return this.parsedResult.os?this.parsedResult.os:this.parseOS()}parseOS(){this.parsedResult.os={};const t=ge.find(HRe,r=>{if(typeof r.test=="function")return r.test(this);if(r.test instanceof Array)return r.test.some(n=>this.test(n));throw new Error("Browser's test function is not valid")});return t&&(this.parsedResult.os=t.describe(this.getUA())),this.parsedResult.os}getOSName(t){const{name:r}=this.getOS();return t?String(r).toLowerCase()||"":r||""}getOSVersion(){return this.getOS().version}getPlatform(){return this.parsedResult.platform?this.parsedResult.platform:this.parsePlatform()}getPlatformType(t=!1){const{type:r}=this.getPlatform();return t?String(r).toLowerCase()||"":r||""}parsePlatform(){this.parsedResult.platform={};const t=ge.find(qRe,r=>{if(typeof r.test=="function")return r.test(this);if(r.test instanceof Array)return r.test.some(n=>this.test(n));
962throw new Error("Browser's test function is not valid")});return t&&(this.parsedResult.platform=t.describe(this.getUA())),this.parsedResult.platform}getEngine(){return this.parsedResult.engine?this.parsedResult.engine:this.parseEngine()}getEngineName(t){return t?String(this.getEngine().name).toLowerCase()||"":this.getEngine().name||""}parseEngine(){this.parsedResult.engine={};const t=ge.find(GRe,r=>{if(typeof r.test=="function")return r.test(this);if(r.test instanceof Array)return r.test.some(n=>this.test(n));throw new Error("Browser's test function is not valid")});return t&&(this.parsedResult.engine=t.describe(this.getUA())),this.parsedResult.engine}parse(){return this.parseBrowser(),this.parseOS(),this.parsePlatform(),this.parseEngine(),this}getResult(){return ge.assign({},this.parsedResult)}satisfies(t){const r={};let n=0;const s={};let i=0;if(Object.keys(t).forEach(o=>{const l=t[o];typeof l=="string"?(s[o]=l,i+=1):typeof l=="object"&&(r[o]=l,n+=1)}),n>0){const o=Object.keys(r),l=ge.find(o,u=>this.isOS(u));if(l){const u=this.satisfies(r[l]);if(u!==void 0)return u}const c=ge.find(o,u=>this.isPlatform(u));if(c){const u=this.satisfies(r[c]);if(u!==void 0)return u}}if(i>0){const o=Object.keys(s),l=ge.find(o,c=>this.isBrowser(c,!0));if(l!==void 0)return this.compareVersion(s[l])}}isBrowser(t,r=!1){const n=this.getBrowserName().toLowerCase();let s=t.toLowerCase();const i=ge.getBrowserTypeByAlias(s);return r&&i&&(s=i.toLowerCase()),s===n}compareVersion(t){let r=[0],n=t,s=!1;const i=this.getBrowserVersion();if(typeof i=="string")return t[0]===">"||t[0]==="<"?(n=t.substr(1),t[1]==="="?(s=!0,n=t.substr(2)):r=[],t[0]===">"?r.push(1):r.push(-1)):t[0]==="="?n=t.substr(1):t[0]==="~"&&(s=!0,n=t.substr(1)),r.indexOf(ge.compareVersions(i,n,s))>-1}isOS(t){return this.getOSName(!0)===String(t).toLowerCase()}isPlatform(t){return this.getPlatformType(!0)===String(t).toLowerCase()}isEngine(t){return this.getEngineName(!0)===String(t).toLowerCase()}is(t,r=!1){return this.isBrowser(t,r)||this.isOS(t)||this.isPlatform(t)}some(t=[]){return t.some(r=>this.is(r))}}/*!
963 * Bowser - a browser detector
964 * https://github.com/lancedikson/bowser
965 * MIT License | (c) Dustin Diaz 2012-2015
966 * MIT License | (c) Denis Demchenko 2015-2019
967 */class KRe{static getParser(t,r=!1){if(typeof t!="string")throw new Error("UserAgent should be a string");return new n4(t,r)}static parse(t){return new n4(t).getResult()}static get BROWSER_MAP(){return GW}static get ENGINE_MAP(){return lo}static get OS_MAP(){return Zr}static get PLATFORMS_MAP(){return Zt}}function uw(){return Date.now()+Math.random().toString()}function Zh(){throw new Error("Method must be implemented in subclass")}function KW(e){return window._dailyConfig&&window._dailyConfig.proxyUrl?window._dailyConfig.proxyUrl+(window._dailyConfig.proxyUrl.slice(-1)==="/"?"":"/")+e.substring(8):e}function Jx(){return window._dailyConfig&&window._dailyConfig.callObjectBundleUrlOverride?window._dailyConfig.callObjectBundleUrlOverride:KW("https://c.daily.co/call-machine/versioned/".concat("0.64.0","/static/call-machine-object-bundle.js"))}function up(e){try{new URL(e)}catch{return!1}return!0}const YW=Object.prototype.toString;function XW(e){switch(YW.call(e)){case"[object Error]":case"[object Exception]":case"[object DOMException]":return!0;default:return wc(e,Error)}}function Ch(e,t){return YW.call(e)===`[object ${t}]`}function AE(e){return Ch(e,"ErrorEvent")}function a4(e){return Ch(e,"DOMError")}function bc(e){return Ch(e,"String")}function QW(e){return e===null||typeof e!="object"&&typeof e!="function"}function Kd(e){return Ch(e,"Object")}function Zx(e){return typeof Event<"u"&&wc(e,Event)}function PE(e){return!!(e&&e.then&&typeof e.then=="function")}function wc(e,t){try{return e instanceof t}catch{return!1}}function Gu(e,t=0){return typeof e!="string"||t===0||e.length<=t?e:`${e.slice(0,t)}...`}function s4(e,t){if(!Array.isArray(e))return"";const r=[];for(let n=0;n<e.length;n++){const s=e[n];try{r.push(String(s))}catch{r.push("[value cannot be serialized]")}}return r.join(t)}function YRe(e,t,r=!1){return!!bc(e)&&(Ch(t,"RegExp")?t.test(e):!!bc(t)&&(r?e===t:e.includes(t)))}function sy(e,t=[],r=!1){return t.some(n=>YRe(e,n,r))}function XRe(e,t,r=250,n,s,i,o){if(!(i.exception&&i.exception.values&&o&&wc(o.originalException,Error)))return;const l=i.exception.values.length>0?i.exception.values[i.exception.values.length-1]:void 0;var c,u;l&&(i.exception.values=(c=PN(e,t,s,o.originalException,n,i.exception.values,l,0),u=r,c.map(h=>(h.value&&(h.value=Gu(h.value,u)),h))))}function PN(e,t,r,n,s,i,o,l){if(i.length>=r+1)return i;let c=[...i];if(wc(n[s],Error)){i4(o,l);const u=e(t,n[s]),h=c.length;o4(u,s,h,l),c=PN(e,t,r,n[s],s,[u,...c],u,h)}
967return Array.isArray(n.errors)&&n.errors.forEach((u,h)=>{if(wc(u,Error)){i4(o,l);const d=e(t,u),f=c.length;o4(d,`errors[${h}]`,f,l),c=PN(e,t,r,u,s,[d,...c],d,f)}}),c}function i4(e,t){e.mechanism=e.mechanism||{type:"generic",handled:!0},e.mechanism={...e.mechanism,is_exception_group:!0,exception_id:t}}function o4(e,t,r,n){e.mechanism=e.mechanism||{type:"generic",handled:!0},e.mechanism={...e.mechanism,type:"chained",source:t,exception_id:r,parent_id:n}}function iy(e){return e&&e.Math==Math?e:void 0}const va=typeof globalThis=="object"&&iy(globalThis)||typeof window=="object"&&iy(window)||typeof self=="object"&&iy(self)||typeof global=="object"&&iy(global)||function(){return this}()||{};function Qp(){return va}function OE(e,t,r){const n=r||va,s=n.__SENTRY__=n.__SENTRY__||{};return s[e]||(s[e]=t())}const QRe=Qp(),JRe=80;function ON(e,t={}){try{let r=e;const n=5,s=[];let i=0,o=0;const l=" > ",c=l.length;let u;const h=Array.isArray(t)?t:t.keyAttrs,d=!Array.isArray(t)&&t.maxStringLength||JRe;for(;r&&i++<n&&(u=ZRe(r,h),!(u==="html"||i>1&&o+s.length*c+u.length>=d));)s.push(u),o+=u.length,r=r.parentNode;return s.reverse().join(l)}catch{return"<unknown>"}}function ZRe(e,t){const r=e,n=[];let s,i,o,l,c;if(!r||!r.tagName)return"";n.push(r.tagName.toLowerCase());const u=t&&t.length?t.filter(d=>r.getAttribute(d)).map(d=>[d,r.getAttribute(d)]):null;if(u&&u.length)u.forEach(d=>{n.push(`[${d[0]}="${d[1]}"]`)});else if(r.id&&n.push(`#${r.id}`),s=r.className,s&&bc(s))for(i=s.split(/\s+/),c=0;c<i.length;c++)n.push(`.${i[c]}`);const h=["aria-label","type","name","title","alt"];for(c=0;c<h.length;c++)o=h[c],l=r.getAttribute(o),l&&n.push(`[${o}="${l}"]`);return n.join("")}const e0=["debug","info","warn","error","log","assert","trace"];function JW(e){if(!("console"in va))return e();const t=va.console,r={};e0.forEach(n=>{const s=t[n]&&t[n].__sentry_original__;n in t&&s&&(r[n]=t[n],t[n]=s)});try{return e()}finally{Object.keys(r).forEach(n=>{t[n]=r[n]})}}function l4(){let e=!1;const t={enable:()=>{e=!0},disable:()=>{e=!1}};return typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__?e0.forEach(r=>{t[r]=(...n)=>{e&&JW(()=>{va.console[r](`Sentry Logger [${r}]:`,...n)})}}
967):e0.forEach(r=>{t[r]=()=>{}}),t}let Ye;Ye=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__?OE("logger",l4):l4();const e$e=/^(?:(\w+):)\/\/(?:(\w+)(?::(\w+)?)?@)([\w.-]+)(?::(\d+))?\/(.+)/;function t0(e,t=!1){const{host:r,path:n,pass:s,port:i,projectId:o,protocol:l,publicKey:c}=e;return`${l}://${c}${t&&s?`:${s}`:""}@${r}${i?`:${i}`:""}/${n&&`${n}/`}${o}`}function c4(e){return{protocol:e.protocol,publicKey:e.publicKey||"",pass:e.pass||"",host:e.host,port:e.port||"",path:e.path||"",projectId:e.projectId}}function t$e(e){const t=typeof e=="string"?function(r){const n=e$e.exec(r);if(!n)return void console.error(`Invalid Sentry Dsn: ${r}`);const[s,i,o="",l,c="",u]=n.slice(1);let h="",d=u;const f=d.split("/");if(f.length>1&&(h=f.slice(0,-1).join("/"),d=f.pop()),d){const m=d.match(/^\d+/);m&&(d=m[0])}return c4({host:l,pass:o,path:h,projectId:d,port:c,protocol:s,publicKey:i})}(e):c4(e);if(t&&function(r){if(typeof __SENTRY_DEBUG__<"u"&&!__SENTRY_DEBUG__)return!0;const{port:n,projectId:s,protocol:i}=r;return!(["protocol","publicKey","host","projectId"].find(o=>!r[o]&&(Ye.error(`Invalid Sentry Dsn: ${o} missing`),!0))||(s.match(/^\d+$/)?function(o){return o==="http"||o==="https"}(i)?n&&isNaN(parseInt(n,10))&&(Ye.error(`Invalid Sentry Dsn: Invalid port ${n}`),1):(Ye.error(`Invalid Sentry Dsn: Invalid protocol ${i}`),1):(Ye.error(`Invalid Sentry Dsn: Invalid projectId ${s}`),1)))}(t))return t}class Fa extends Error{constructor(t,r="warn"){super(t),this.message=t,this.name=new.target.prototype.constructor.name,Object.setPrototypeOf(this,new.target.prototype),this.logLevel=r}}function Rr(e,t,r){if(!(t in e))return;const n=e[t],s=r(n);if(typeof s=="function")try{ZW(s,n)}catch{}e[t]=s}function ME(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,configurable:!0})}function ZW(e,t){const r=t.prototype||{};e.prototype=t.prototype=r,ME(e,"__sentry_original__",t)}function RE(e){return e.__sentry_original__}function eV(e){if(XW(e))return{message:e.message,name:e.name,stack:e.stack,...d4(e)};if(Zx(e)){const t={type:e.type,target:u4(e.target),currentTarget:u4(e.currentTarget),...d4(e)};return typeof CustomEvent<"u"&&wc(e,CustomEvent)&&(t.detail=e.detail),t}return e}function u4(e){try{return t=e,typeof Element<"u"&&wc(t,Element)?ON(e):Object.prototype.toString.call(e)}catch{return"<unknown>"}var t}function d4(e){if(typeof e=="object"&&e!==null){const t={};for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}return{}}function dw(e){return MN(e,new Map)}function MN(e,t){if(Kd(e)){const r=t.get(e);if(r!==void 0)return r;const n={};t.set(e,n);for(const s of Object.keys(e))e[s]!==void 0&&(n[s]=MN(e[s],t));return n}if(Array.isArray(e)){const r=t.get(e);if(r!==void 0)return r;const n=[];return t.set(e,n),e.forEach(s=>{n.push(MN(s,t))}),n}return e}const h4="<anonymous>";function Zo(e){try{return e&&typeof e=="function"&&e.name||h4}catch{return h4}}const X1=Qp();function RN(e){return e&&/^function fetch\(\)\s+\{\s+\[native code\]\s+\}$/.test(e.toString())}function r$e(){if(!function(){if(!("fetch"in X1))return!1;try{return new Headers,new Request("http://www.example.com"),new Response,!0}catch{return!1}}())return!1;if(RN(X1.fetch))return!0;let e=!1;const t=X1.document;if(t&&typeof t.createElement=="function")try{const r=t.createElement("iframe");r.hidden=!0,t.head.appendChild(r),r.contentWindow&&r.contentWindow.fetch&&(e=RN(r.contentWindow.fetch)),t.head.removeChild(r)}catch(r){(typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&Ye.warn("Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ",r)}return e}const oy=Qp(),Dt=Qp(),pf="__sentry_xhr_v2__",zf={},f4={};function n$e(e){if(!f4[e])switch(f4[e]=!0,e){case"console":(function(){"console"in Dt&&e0.forEach(function(t){t in Dt.console&&Rr(Dt.console,t,function(r){return function(...n){Ia("console",{args:n,level:t}),r&&r.apply(Dt.console,n)}})})})();break;case"dom":(function(){if(!("document"in Dt))return;const t=Ia.bind(null,"dom"),r=p4(t,!0);Dt.document.addEventListener("click",r,!1),Dt.document.addEventListener("keypress",r,!1),["EventTarget","Node"].forEach(n=>{const s=Dt[n]&&Dt[n].prototype;s&&s.hasOwnProperty&&s.hasOwnProperty("addEventListener")&&(Rr(s,"addEventListener",function(i){return function(o,l,c){if(o==="click"||o=="keypress")try{const u=this,h=u.__sentry_instrumentation_handlers__=u.__sentry_instrumentation_handlers__||{},d=h[o]=h[o]||{refCount:0};if(!d.handler){const f=p4(t);d.handler=f,i.call(this,o,f,c)}d.refCount++}catch{}return i.call(this,o,l,c)}}),Rr(s,"removeEventListener",function(i){return function(o,l,c){if(o==="click"||o=="keypress")try{const u=this,h=u.__sentry_instrumentation_handlers__||{},d=h[o];d&&(d.refCount--,d.refCount<=0&&(i.call(this,o,d.handler,c),d.handler=void 0,delete h[o]),Object.keys(h).length===0&&delete u.__sentry_instrumentation_handlers__)}catch{}return i.call(this,o,l,c)}}))})})();break;case"xhr":(function(){if(!("XMLHttpRequest"in Dt))return;const t=XMLHttpRequest.prototype;Rr(t,"open",function(r){return function(...n){const s=n[1],i=this[pf]={method:bc(n[0])?n[0].toUpperCase():n[0],url:n[1],request_headers:{}};
967bc(s)&&i.method==="POST"&&s.match(/sentry_key/)&&(this.__sentry_own_request__=!0);const o=()=>{const l=this[pf];if(l&&this.readyState===4){try{l.status_code=this.status}catch{}Ia("xhr",{args:n,endTimestamp:Date.now(),startTimestamp:Date.now(),xhr:this})}};return"onreadystatechange"in this&&typeof this.onreadystatechange=="function"?Rr(this,"onreadystatechange",function(l){return function(...c){return o(),l.apply(this,c)}}):this.addEventListener("readystatechange",o),Rr(this,"setRequestHeader",function(l){return function(...c){const[u,h]=c,d=this[pf];return d&&(d.request_headers[u.toLowerCase()]=h),l.apply(this,c)}}),r.apply(this,n)}}),Rr(t,"send",function(r){return function(...n){const s=this[pf];return s&&n[0]!==void 0&&(s.body=n[0]),Ia("xhr",{args:n,startTimestamp:Date.now(),xhr:this}),r.apply(this,n)}})})();break;case"fetch":(function(){r$e()&&Rr(Dt,"fetch",function(t){return function(...r){const{method:n,url:s}=function(o){if(o.length===0)return{method:"GET",url:""};if(o.length===2){const[c,u]=o;return{url:m4(c),method:$N(u,"method")?String(u.method).toUpperCase():"GET"}}const l=o[0];return{url:m4(l),method:$N(l,"method")?String(l.method).toUpperCase():"GET"}}(r),i={args:r,fetchData:{method:n,url:s},startTimestamp:Date.now()};return Ia("fetch",{...i}),t.apply(Dt,r).then(o=>(Ia("fetch",{...i,endTimestamp:Date.now(),response:o}),o),o=>{throw Ia("fetch",{...i,endTimestamp:Date.now(),error:o}),o})}})})();break;case"history":(function(){if(!function(){const n=oy.chrome,s=n&&n.app&&n.app.runtime,i="history"in oy&&!!oy.history.pushState&&!!oy.history.replaceState;return!s&&i}())return;const t=Dt.onpopstate;function r(n){return function(...s){const i=s.length>2?s[2]:void 0;if(i){const o=ly,l=String(i);ly=l,Ia("history",{from:o,to:l})}return n.apply(this,s)}}Dt.onpopstate=function(...n){const s=Dt.location.href,i=ly;if(ly=s,Ia("history",{from:i,to:s}),t)try{return t.apply(this,n)}catch{}},Rr(Dt.history,"pushState",r),Rr(Dt.history,"replaceState",r)})();break;case"error":uy=Dt.onerror,Dt.onerror=function(t,r,n,s,i){return Ia("error",{column:s,error:i,line:n,msg:t,url:r}),!(!uy||uy.__SENTRY_LOADER__)&&uy.apply(this,arguments)},Dt.onerror.__SENTRY_INSTRUMENTED__=!0;break;case"unhandledrejection":dy=Dt.onunhandledrejection,Dt.onunhandledrejection=function(t){return Ia("unhandledrejection",t),!(dy&&!dy.__SENTRY_LOADER__)||dy.apply(this,arguments)},Dt.onunhandledrejection.__SENTRY_INSTRUMENTED__=!0;break;default:return void((typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&Ye.warn("unknown instrumentation type:",e))}}function Ol(e,t){zf[e]=zf[e]||[],zf[e].push(t),n$e(e)}function Ia(e,t){if(e&&zf[e])for(const r of zf[e]||[])try{r(t)}catch(n){(typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&Ye.error(`Error while triggering instrumentation handler.
968Type: ${e}
969Name: ${Zo(r)}
970Error:`,n)}}function $N(e,t){return!!e&&typeof e=="object"&&!!e[t]}function m4(e){return typeof e=="string"?e:e?$N(e,"url")?e.url:e.toString?e.toString():"":""}let ly;const a$e=1e3;let cy,Q1;function p4(e,t=!1){return r=>{if(!r||Q1===r||function(s){if(s.type!=="keypress")return!1;try{const i=s.target;if(!i||!i.tagName)return!0;if(i.tagName==="INPUT"||i.tagName==="TEXTAREA"||i.isContentEditable)return!1}catch{}return!0}(r))return;const n=r.type==="keypress"?"input":r.type;(cy===void 0||function(s,i){if(!s||s.type!==i.type)return!0;try{if(s.target!==i.target)return!0}catch{}return!1}(Q1,r))&&(e({event:r,name:n,global:t}),Q1=r),clearTimeout(cy),cy=Dt.setTimeout(()=>{cy=void 0},a$e)}}let uy=null,dy=null;function qo(){const e=va,t=e.crypto||e.msCrypto;if(t&&t.randomUUID)return t.randomUUID().replace(/-/g,"");const r=t&&t.getRandomValues?()=>t.getRandomValues(new Uint8Array(1))[0]:()=>16*Math.random();return("10000000100040008000"+1e11).replace(/[018]/g,n=>(n^(15&r())>>n/4).toString(16))}function tV(e){return e.exception&&e.exception.values?e.exception.values[0]:void 0}function mo(e){const{message:t,event_id:r}=e;if(t)return t;const n=tV(e);return n?n.type&&n.value?`${n.type}: ${n.value}`:n.type||n.value||r||"<unknown>":r||"<unknown>"}function IN(e,t,r){const n=e.exception=e.exception||{},s=n.values=n.values||[],i=s[0]=s[0]||{};i.value||(i.value=t||""),i.type||(i.type="Error")}function dp(e,t){const r=tV(e);if(!r)return;const n=r.mechanism;if(r.mechanism={type:"generic",handled:!0,...n,...t},t&&"data"in t){const s={...n&&n.data,...t.data};r.mechanism.data=s}}function g4(e){if(e&&e.__sentry_captured__)return!0;try{ME(e,"__sentry_captured__",!0)}catch{}return!1}function po(e,t=100,r=1/0){try{return DN("",e,t,r)}catch(n){return{ERROR:`**non-serializable** (${n})`}}}function rV(e,t=3,r=102400){const n=po(e,t);return s=n,function(i){return~-encodeURI(i).split(/%..|./).length}(JSON.stringify(s))>r?rV(e,t-1,r):n;var s}function DN(e,t,r=1/0,n=1/0,s=function(){const i=typeof WeakSet=="function",o=i?new WeakSet:[];return[function(l){if(i)return!!o.has(l)||(o.add(l),!1);for(let c=0;c<o.length;c++)if(o[c]===l)return!0;return o.push(l),!1},function(l){if(i)o.delete(l);else for(let c=0;c<o.length;c++)if(o[c]===l){o.splice(c,1);break}}]}()){const[i,o]=s;if(t==null||["number","boolean","string"].includes(typeof t)&&(typeof(l=t)!="number"||l==l))return t;var l;const c=function(g,p){try{if(g==="domain"&&p&&typeof p=="object"&&p._events)return"[Domain]";if(g==="domainEmitter")return"[DomainEmitter]";if(typeof global<"u"&&p===global)return"[Global]";if(typeof window<"u"&&p===window)return"[Window]";if(typeof document<"u"&&p===document)return"[Document]";if(function(x){return Kd(x)&&"nativeEvent"in x&&"preventDefault"in x&&"stopPropagation"in x}(p))return"[SyntheticEvent]";if(typeof p=="number"&&p!=p)return"[NaN]";if(typeof p=="function")return`[Function: ${Zo(p)}]`;if(typeof p=="symbol")return`[${String(p)}]`;if(typeof p=="bigint")return`[BigInt: ${String(p)}]`;const v=function(x){const b=Object.getPrototypeOf(x);return b?b.constructor.name:"null prototype"}(p);return/^HTML(\w*)Element$/.test(v)?`[HTMLElement: ${v}]`:`[object ${v}]`}catch(v){return`**non-serializable** (${v})`}}(e,t);if(!c.startsWith("[object "))return c;if(t.__sentry_skip_normalization__)return t;const u=typeof t.__sentry_override_normalization_depth__=="number"?t.__sentry_override_normalization_depth__:r;if(u===0)return c.replace("object ","");if(i(t))return"[Circular ~]";const h=t;if(h&&typeof h.toJSON=="function")try{return DN("",h.toJSON(),u-1,n,s)}catch{}const d=Array.isArray(t)?[]:{};let f=0;const m=eV(t);for(const g in m){if(!Object.prototype.hasOwnProperty.call(m,g))continue;if(f>=n){d[g]="[MaxProperties ~]";break}const p=m[g];d[g]=DN(g,p,u-1,n,s),f++}return o(t),d}var di;function jc(e){return new vn(t=>{t(e)})}function r0(e){return new vn((t,r)=>{r(e)})}
970(function(e){e[e.PENDING=0]="PENDING",e[e.RESOLVED=1]="RESOLVED",e[e.REJECTED=2]="REJECTED"})(di||(di={}));class vn{__init(){this._state=di.PENDING}__init2(){this._handlers=[]}constructor(t){vn.prototype.__init.call(this),vn.prototype.__init2.call(this),vn.prototype.__init3.call(this),vn.prototype.__init4.call(this),vn.prototype.__init5.call(this),vn.prototype.__init6.call(this);try{t(this._resolve,this._reject)}catch(r){this._reject(r)}}then(t,r){return new vn((n,s)=>{this._handlers.push([!1,i=>{if(t)try{n(t(i))}catch(o){s(o)}else n(i)},i=>{if(r)try{n(r(i))}catch(o){s(o)}else s(i)}]),this._executeHandlers()})}catch(t){return this.then(r=>r,t)}finally(t){return new vn((r,n)=>{let s,i;return this.then(o=>{i=!1,s=o,t&&t()},o=>{i=!0,s=o,t&&t()}).then(()=>{i?n(s):r(s)})})}__init3(){this._resolve=t=>{this._setResult(di.RESOLVED,t)}}__init4(){this._reject=t=>{this._setResult(di.REJECTED,t)}}__init5(){this._setResult=(t,r)=>{this._state===di.PENDING&&(PE(r)?r.then(this._resolve,this._reject):(this._state=t,this._value=r,this._executeHandlers()))}}__init6(){this._executeHandlers=()=>{if(this._state===di.PENDING)return;const t=this._handlers.slice();this._handlers=[],t.forEach(r=>{r[0]||(this._state===di.RESOLVED&&r[1](this._value),this._state===di.REJECTED&&r[2](this._value),r[0]=!0)})}}}function s$e(e){const t=[];function r(n){return t.splice(t.indexOf(n),1)[0]}return{$:t,add:function(n){if(!(e===void 0||t.length<e))return r0(new Fa("Not adding Promise because buffer limit was reached."));const s=n();return t.indexOf(s)===-1&&t.push(s),s.then(()=>r(s)).then(null,()=>r(s).then(null,()=>{})),s},drain:function(n){return new vn((s,i)=>{let o=t.length;if(!o)return s(!0);const l=setTimeout(()=>{n&&n>0&&s(!1)},n);t.forEach(c=>{jc(c).then(()=>{--o||(clearTimeout(l),s(!0))},i)})})}}}function J1(e){if(!e)return{};const t=e.match(/^(([^:/?#]+):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/);if(!t)return{};const r=t[6]||"",n=t[8]||"";return{host:t[4],path:t[5],protocol:t[2],search:r,hash:n,relative:t[5]+r+n}}const i$e=["fatal","error","warning","log","info","debug"],nV=Qp(),LN={nowSeconds:()=>Date.now()/1e3},Z1=typeof __SENTRY_BROWSER_BUNDLE__<"u"&&__SENTRY_BROWSER_BUNDLE__||Object.prototype.toString.call(typeof process<"u"?process:0)!=="[object process]"?function(){const{performance:e}=nV;if(!(!e||!e.now))return{now:()=>e.now(),timeOrigin:Date.now()-e.now()}}():function(){try{return(e=module,t="perf_hooks",e.require(t)).performance}catch{return}var e,t}(),y4=Z1===void 0?LN:{nowSeconds:()=>(Z1.timeOrigin+Z1.now())/1e3},hw=LN.nowSeconds.bind(LN),aV=y4.nowSeconds.bind(y4);function hp(e,t=[]){return[e,t]}function o$e(e,t){const[r,n]=e;return[r,[...n,t]]}function v4(e,t){const r=e[1];for(const n of r)if(t(n,n[0].type))return!0;return!1}function FN(e,t){return(t||new TextEncoder).encode(e)}function l$e(e,t){const[r,n]=e;let s=JSON.stringify(r);function i(o){typeof s=="string"?s=typeof o=="string"?s+o:[FN(s,t),o]:s.push(typeof o=="string"?FN(o,t):o)}for(const o of n){const[l,c]=o;if(i(`
971${JSON.stringify(l)}
972`),typeof c=="string"||c instanceof Uint8Array)i(c);else{let u;try{u=JSON.stringify(c)}catch{u=JSON.stringify(po(c))}i(u)}}return typeof s=="string"?s:function(o){const l=o.reduce((h,d)=>h+d.length,0),c=new Uint8Array(l);let u=0;for(const h of o)c.set(h,u),u+=h.length;return c}(s)}function c$e(e,t){const r=typeof e.data=="string"?FN(e.data,t):e.data;return[dw({type:"attachment",length:r.length,filename:e.filename,content_type:e.contentType,attachment_type:e.attachmentType}),r]}(()=>{const{performance:e}=nV;if(!e||!e.now)return;const t=36e5,r=e.now(),n=Date.now(),s=e.timeOrigin?Math.abs(e.timeOrigin+r-n):t,i=s<t,o=e.timing&&e.timing.navigationStart,l=typeof o=="number"?Math.abs(o+r-n):t;(i||l<t)&&s<=l&&e.timeOrigin})();const u$e={session:"session",sessions:"session",attachment:"attachment",transaction:"transaction",event:"error",client_report:"internal",user_report:"default",profile:"profile",replay_event:"replay",replay_recording:"replay",check_in:"monitor"};function x4(e){return u$e[e]}function sV(e){if(!e||!e.sdk)return;const{name:t,version:r}=e.sdk;
972return{name:t,version:r}}const d$e=6e4;function h$e(e,{statusCode:t,headers:r},n=Date.now()){const s={...e},i=r&&r["x-sentry-rate-limits"],o=r&&r["retry-after"];if(i)for(const l of i.trim().split(",")){const[c,u]=l.split(":",2),h=parseInt(c,10),d=1e3*(isNaN(h)?60:h);if(u)for(const f of u.split(";"))s[f]=n+d;else s.all=n+d}else o?s.all=n+function(l,c=Date.now()){const u=parseInt(`${l}`,10);if(!isNaN(u))return 1e3*u;const h=Date.parse(`${l}`);return isNaN(h)?d$e:h-c}(o,n):t===429&&(s.all=n+6e4);return s}const $E="production";function f$e(e){const t=aV(),r={sid:qo(),init:!0,timestamp:t,started:t,duration:0,status:"ok",errors:0,ignoreDuration:!1,toJSON:()=>function(n){return dw({sid:`${n.sid}`,init:n.init,started:new Date(1e3*n.started).toISOString(),timestamp:new Date(1e3*n.timestamp).toISOString(),status:n.status,errors:n.errors,did:typeof n.did=="number"||typeof n.did=="string"?`${n.did}`:void 0,duration:n.duration,attrs:{release:n.release,environment:n.environment,ip_address:n.ipAddress,user_agent:n.userAgent}})}(r)};return e&&Yd(r,e),r}function Yd(e,t={}){if(t.user&&(!e.ipAddress&&t.user.ip_address&&(e.ipAddress=t.user.ip_address),e.did||t.did||(e.did=t.user.id||t.user.email||t.user.username)),e.timestamp=t.timestamp||aV(),t.ignoreDuration&&(e.ignoreDuration=t.ignoreDuration),t.sid&&(e.sid=t.sid.length===32?t.sid:qo()),t.init!==void 0&&(e.init=t.init),!e.did&&t.did&&(e.did=`${t.did}`),typeof t.started=="number"&&(e.started=t.started),e.ignoreDuration)e.duration=void 0;else if(typeof t.duration=="number")e.duration=t.duration;else{const r=e.timestamp-e.started;e.duration=r>=0?r:0}t.release&&(e.release=t.release),t.environment&&(e.environment=t.environment),!e.ipAddress&&t.ipAddress&&(e.ipAddress=t.ipAddress),!e.userAgent&&t.userAgent&&(e.userAgent=t.userAgent),typeof t.errors=="number"&&(e.errors=t.errors),t.status&&(e.status=t.status)}class nc{constructor(){this._notifyingListeners=!1,this._scopeListeners=[],this._eventProcessors=[],this._breadcrumbs=[],this._attachments=[],this._user={},this._tags={},this._extra={},this._contexts={},this._sdkProcessingMetadata={},this._propagationContext=b4()}static clone(t){const r=new nc;return t&&(r._breadcrumbs=[...t._breadcrumbs],r._tags={...t._tags},r._extra={...t._extra},r._contexts={...t._contexts},r._user=t._user,r._level=t._level,r._span=t._span,r._session=t._session,r._transactionName=t._transactionName,r._fingerprint=t._fingerprint,r._eventProcessors=[...t._eventProcessors],r._requestSession=t._requestSession,r._attachments=[...t._attachments],r._sdkProcessingMetadata={...t._sdkProcessingMetadata}
972,r._propagationContext={...t._propagationContext}),r}addScopeListener(t){this._scopeListeners.push(t)}addEventProcessor(t){return this._eventProcessors.push(t),this}setUser(t){return this._user=t||{},this._session&&Yd(this._session,{user:t}),this._notifyScopeListeners(),this}getUser(){return this._user}getRequestSession(){return this._requestSession}setRequestSession(t){return this._requestSession=t,this}setTags(t){return this._tags={...this._tags,...t},this._notifyScopeListeners(),this}setTag(t,r){return this._tags={...this._tags,[t]:r},this._notifyScopeListeners(),this}setExtras(t){return this._extra={...this._extra,...t},this._notifyScopeListeners(),this}setExtra(t,r){return this._extra={...this._extra,[t]:r},this._notifyScopeListeners(),this}setFingerprint(t){return this._fingerprint=t,this._notifyScopeListeners(),this}setLevel(t){return this._level=t,this._notifyScopeListeners(),this}setTransactionName(t){return this._transactionName=t,this._notifyScopeListeners(),this}setContext(t,r){return r===null?delete this._contexts[t]:this._contexts[t]=r,this._notifyScopeListeners(),this}setSpan(t){return this._span=t,this._notifyScopeListeners(),this}getSpan(){return this._span}getTransaction(){const t=this.getSpan();return t&&t.transaction}setSession(t){return t?this._session=t:delete this._session,this._notifyScopeListeners(),this}getSession(){return this._session}update(t){if(!t)return this;if(typeof t=="function"){const r=t(this);return r instanceof nc?r:this}return t instanceof nc?(this._tags={...this._tags,...t._tags},this._extra={...this._extra,...t._extra},this._contexts={...this._contexts,...t._contexts},t._user&&Object.keys(t._user).length&&(this._user=t._user),t._level&&(this._level=t._level),t._fingerprint&&(this._fingerprint=t._fingerprint),t._requestSession&&(this._requestSession=t._requestSession),t._propagationContext&&(this._propagationContext=t._propagationContext)):Kd(t)&&(this._tags={...this._tags,...t.tags},this._extra={...this._extra,...t.extra},this._contexts={...this._contexts,...t.contexts},t.user&&(this._user=t.user),t.level&&(this._level=t.level),t.fingerprint&&(this._fingerprint=t.fingerprint),t.requestSession&&(this._requestSession=t.requestSession),t.propagationContext&&(this._propagationContext=t.propagationContext)),this}clear(){return this._breadcrumbs=[],this._tags={},this._extra={},this._user={},this._contexts={},this._level=void 0,this._transactionName=void 0,this._fingerprint=void 0,this._requestSession=void 0,this._span=void 0,this._session=void 0,this._notifyScopeListeners(),this._attachments=[],this._propagationContext=b4(),this}addBreadcrumb(t,r){const n=typeof r=="number"?r:100;if(n<=0)return this;const s={timestamp:hw(),...t};return this._breadcrumbs=[...this._breadcrumbs,s].slice(-n),this._notifyScopeListeners(),this}getLastBreadcrumb(){return this._breadcrumbs[this._breadcrumbs.length-1]}clearBreadcrumbs(){return this._breadcrumbs=[],this._notifyScopeListeners(),this}addAttachment(t){return this._attachments.push(t),this}getAttachments(){return this._attachments}clearAttachments(){return this._attachments=[],this}applyToEvent(t,r={}){if(this._extra&&Object.keys(this._extra).length&&(t.extra={...this._extra,...t.extra}),this._tags&&Object.keys(this._tags).length&&(t.tags={...this._tags,...t.tags}),this._user&&Object.keys(this._user).length&&(t.user={...this._user,...t.user}),this._contexts&&Object.keys(this._contexts).length&&(t.contexts={...this._contexts,...t.contexts}),this._level&&(t.level=this._level),this._transactionName&&(t.transaction=this._transactionName),this._span){t.contexts={trace:this._span.getTraceContext(),...t.contexts};const n=this._span.transaction;if(n){t.sdkProcessingMetadata={dynamicSamplingContext:n.getDynamicSamplingContext(),...t.sdkProcessingMetadata};const s=n.name;s&&(t.tags={transaction:s,...t.tags})}}return this._applyFingerprint(t),t.breadcrumbs=[...t.breadcrumbs||[],...this._breadcrumbs],t.breadcrumbs=t.breadcrumbs.length>0?t.breadcrumbs:void 0,t.sdkProcessingMetadata={...t.sdkProcessingMetadata,...this._sdkProcessingMetadata,prop
972agationContext:this._propagationContext},this._notifyEventProcessors([...iV(),...this._eventProcessors],t,r)}setSDKProcessingMetadata(t){return this._sdkProcessingMetadata={...this._sdkProcessingMetadata,...t},this}setPropagationContext(t){return this._propagationContext=t,this}getPropagationContext(){return this._propagationContext}_notifyEventProcessors(t,r,n,s=0){return new vn((i,o)=>{const l=t[s];if(r===null||typeof l!="function")i(r);else{const c=l({...r},n);(typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&l.id&&c===null&&Ye.log(`Event processor "${l.id}" dropped event`),PE(c)?c.then(u=>this._notifyEventProcessors(t,u,n,s+1).then(i)).then(null,o):this._notifyEventProcessors(t,c,n,s+1).then(i).then(null,o)}})}_notifyScopeListeners(){this._notifyingListeners||(this._notifyingListeners=!0,this._scopeListeners.forEach(t=>{t(this)}),this._notifyingListeners=!1)}_applyFingerprint(t){var r;t.fingerprint=t.fingerprint?(r=t.fingerprint,Array.isArray(r)?r:[r]):[],this._fingerprint&&(t.fingerprint=t.fingerprint.concat(this._fingerprint)),t.fingerprint&&!t.fingerprint.length&&delete t.fingerprint}}function iV(){return OE("globalEventProcessors",()=>[])}function oV(e){iV().push(e)}function b4(){return{traceId:qo(),spanId:qo().substring(16),sampled:!1}}const lV=4,m$e=100;class IE{constructor(t,r=new nc,n=lV){this._version=n,this._stack=[{scope:r}],t&&this.bindClient(t)}isOlderThan(t){return this._version<t}bindClient(t){this.getStackTop().client=t,t&&t.setupIntegrations&&t.setupIntegrations()}pushScope(){const t=nc.clone(this.getScope());return this.getStack().push({client:this.getClient(),scope:t}),t}popScope(){return!(this.getStack().length<=1)&&!!this.getStack().pop()}withScope(t){const r=this.pushScope();try{t(r)}finally{this.popScope()}}getClient(){return this.getStackTop().client}getScope(){return this.getStackTop().scope}getStack(){return this._stack}getStackTop(){return this._stack[this._stack.length-1]}captureException(t,r){const n=this._lastEventId=r&&r.event_id?r.event_id:qo(),s=new Error("Sentry syntheticException");return this._withClient((i,o)=>{i.captureException(t,{originalException:t,syntheticException:s,...r,event_id:n},o)}),n}captureMessage(t,r,n){const s=this._lastEventId=n&&n.event_id?n.event_id:qo(),i=new Error(t);return this._withClient((o,l)=>{o.captureMessage(t,r,{originalException:t,syntheticException:i,...n,event_id:s},l)}),s}captureEvent(t,r){const n=r&&r.event_id?r.event_id:qo();return t.type||(this._lastEventId=n),this._withClient((s,i)=>{s.captureEvent(t,{...r,event_id:n},i)}),n}lastEventId(){return this._lastEventId}addBreadcrumb(t,r){const{scope:n,client:s}=this.getStackTop();if(!s)return;const{beforeBreadcrumb:i=null,maxBreadcrumbs:o=m$e}=s.getOptions&&s.getOptions()||{};if(o<=0)return;const l={timestamp:hw(),...t},c=i?JW(()=>i(l,r)):l;c!==null&&(s.emit&&s.emit("beforeAddBreadcrumb",c,r),n.addBreadcrumb(c,o))}setUser(t){this.getScope().setUser(t)}setTags(t){this.getScope().setTags(t)}setExtras(t){this.getScope().setExtras(t)}setTag(t,r){this.getScope().setTag(t,r)}setExtra(t,r){this.getScope().setExtra(t,r)}setContext(t,r){this.getScope().setContext(t,r)}configureScope(t){const{scope:r,client:n}=this.getStackTop();n&&t(r)}run(t){const r=w4(this);try{t(this)}finally{w4(r)}}getIntegration(t){const r=this.getClient();if(!r)return null;try{return r.getIntegration(t)}catch{return(typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&Ye.warn(`Cannot retrieve integration ${t.id} from the current Hub`),null}}startTransaction(t,r){const n=this._callExtensionMethod("startTransaction",t,r);return typeof __SENTRY_DEBUG__<"u"&&!__SENTRY_DEBUG__||n||console.warn(`Tracing extension 'startTransaction' has not been added. Call 'addTracingExtensions' before calling 'init':
973Sentry.addTracingExtensions();
974Sentry.init({...});
975`),n}traceHeaders(){return this._callExtensionMethod("traceHeaders")}captureSession(t=!1){if(t)return this.endSession();this._sendSessionUpdate()}endSession(){const t=this.getStackTop().scope,r=t.getSession();r&&function(n,s){let i={};n.status==="ok"&&(i={status:"exited"}),Yd(n,i)}(r),this._sendSessionUpdate(),t.setSession()}startSession(t){const{scope:r,client:n}=this.getStackTop(),{release:s,environment:i=$E}=n&&n.getOptions()||{},{userAgent:o}=va.navigator||{},l=f$e({release:s,environment:i,user:r.getUser(),...o&&{userAgent:o},...t}),c=r.getSession&&r.getSession();return c&&c.status==="ok"&&Yd(c,{status:"exited"}),this.endSession(),r.setSession(l),l}shouldSendDefaultPii(){const t=this.getClient(),r=t&&t.getOptions();return!!(r&&r.sendDefaultPii)}_sendSessionUpdate(){const{scope:t,client:r}=this.getStackTop(),n=t.getSession();n&&r&&r.captureSession&&r.captureSession(n)}_withClient(t){const{scope:r,client:n}=this.getStackTop();n&&t(n,r)}_callExtensionMethod(t,...r){const n=n0().__SENTRY__;if(n&&n.extensions&&typeof n.extensions[t]=="function")return n.extensions[t].apply(this,r);(typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&Ye.warn(`Extension method ${t} couldn't be found, doing nothing.`)}}function n0(){return va.__SENTRY__=va.__SENTRY__||{extensions:{},hub:void 0},va}function w4(e){const t=n0(),r=zN(t);return cV(t,e),r}function Jn(){const e=n0();if(e.__SENTRY__&&e.__SENTRY__.acs){const t=e.__SENTRY__.acs.getCurrentHub();if(t)return t}return function(t=n0()){r=t,r&&r.__SENTRY__&&r.__SENTRY__.hub&&!zN(t).isOlderThan(lV)||cV(t,new IE);var r;return zN(t)}(e)}function zN(e){return OE("hub",()=>new IE,e)}function cV(e,t){return e?((e.__SENTRY__=e.__SENTRY__||{}).hub=t,!0):!1}const p$e="7";function g$e(e,t){return r={sentry_key:e.publicKey,sentry_version:p$e,...t&&{sentry_client:`${t.name}/${t.version}`}},Object.keys(r).map(n=>`${encodeURIComponent(n)}=${encodeURIComponent(r[n])}`).join("&");var r}function y$e(e,t,r,n){const s=sV(r),i=e.type&&e.type!=="replay_event"?e.type:"event";(function(l,c){c&&(l.sdk=l.sdk||{},l.sdk.name=l.sdk.name||c.name,l.sdk.version=l.sdk.version||c.version,l.sdk.integrations=[...l.sdk.integrations||[],...c.integrations||[]],l.sdk.packages=[...l.sdk.packages||[],...c.packages||[]])})(e,r&&r.sdk);const o=function(l,c,u,h){const d=l.sdkProcessingMetadata&&l.sdkProcessingMetadata.dynamicSamplingContext;return{event_id:l.event_id,sent_at:new Date().toISOString(),...c&&{sdk:c},...!!u&&{dsn:t0(h)},...d&&{trace:dw({...d})}}}(e,s,n,t);return delete e.sdkProcessingMetadata,hp(o,[[{type:i},e]])}const j4=[];function _4(e,t){t[e.name]=e,j4.indexOf(e.name)===-1&&(e.setupOnce(oV,Jn),j4.push(e.name),(typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&Ye.log(`Integration installed: ${e.name}`))}function v$e(e,t,r,n){const{normalizeDepth:s=3,normalizeMaxBreadth:i=1e3}=e,o={...t,event_id:t.event_id||r.event_id||qo(),timestamp:t.timestamp||hw()},l=r.integrations||e.integrations.map(h=>h.name);(function(h,d){const{environment:f,release:m,dist:g,maxValueLength:p=250}=d;"environment"in h||(h.environment="environment"in d?f:$E),h.release===void 0&&m!==void 0&&(h.release=m),h.dist===void 0&&g!==void 0&&(h.dist=g),h.message&&(h.message=Gu(h.message,p));const v=h.exception&&h.exception.values&&h.exception.values[0];v&&v.value&&(v.value=Gu(v.value,p));const x=h.request;x&&x.url&&(x.url=Gu(x.url,p))})(o,e),function(h,d){d.length>0&&(h.sdk=h.sdk||{},h.sdk.integrations=[...h.sdk.integrations||[],...d])}(o,l),t.type===void 0&&function(h,d){const f=va._sentryDebugIds;if(!f)return;let m;const g=S4.get(d);g?m=g:(m=new Map,S4.set(d,m));const p=Object.keys(f).reduce((v,x)=>{let b;const w=m.get(x);w?b=w:(b=d(x),m.set(x,b));for(let j=b.length-1;j>=0;j--){const _=b[j];if(_.filename){v[_.filename]=f[x];break}}return v},{});
975try{h.exception.values.forEach(v=>{v.stacktrace.frames.forEach(x=>{x.filename&&(x.debug_id=p[x.filename])})})}catch{}}(o,e.stackParser);let c=n;r.captureContext&&(c=nc.clone(c).update(r.captureContext));let u=jc(o);if(c){if(c.getAttachments){const h=[...r.attachments||[],...c.getAttachments()];h.length&&(r.attachments=h)}u=c.applyToEvent(o,r)}return u.then(h=>(h&&function(d){const f={};try{d.exception.values.forEach(g=>{g.stacktrace.frames.forEach(p=>{p.debug_id&&(p.abs_path?f[p.abs_path]=p.debug_id:p.filename&&(f[p.filename]=p.debug_id),delete p.debug_id)})})}catch{}if(Object.keys(f).length===0)return;d.debug_meta=d.debug_meta||{},d.debug_meta.images=d.debug_meta.images||[];const m=d.debug_meta.images;Object.keys(f).forEach(g=>{m.push({type:"sourcemap",code_file:g,debug_id:f[g]})})}(h),typeof s=="number"&&s>0?function(d,f,m){if(!d)return null;const g={...d,...d.breadcrumbs&&{breadcrumbs:d.breadcrumbs.map(p=>({...p,...p.data&&{data:po(p.data,f,m)}}))},...d.user&&{user:po(d.user,f,m)},...d.contexts&&{contexts:po(d.contexts,f,m)},...d.extra&&{extra:po(d.extra,f,m)}};return d.contexts&&d.contexts.trace&&g.contexts&&(g.contexts.trace=d.contexts.trace,d.contexts.trace.data&&(g.contexts.trace.data=po(d.contexts.trace.data,f,m))),d.spans&&(g.spans=d.spans.map(p=>(p.data&&(p.data=po(p.data,f,m)),p))),g}(h,s,i):h))}const S4=new WeakMap,N4="Not capturing exception because it's already been captured.";class Ml{__init(){this._integrations={}}__init2(){this._integrationsInitialized=!1}__init3(){this._numProcessing=0}__init4(){this._outcomes={}}__init5(){this._hooks={}}constructor(t){if(Ml.prototype.__init.call(this),Ml.prototype.__init2.call(this),Ml.prototype.__init3.call(this),Ml.prototype.__init4.call(this),Ml.prototype.__init5.call(this),this._options=t,t.dsn?this._dsn=t$e(t.dsn):(typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&Ye.warn("No DSN provided, client will not do anything."),this._dsn){const r=function(n,s={}){const i=typeof s=="string"?s:s.tunnel,o=typeof s!="string"&&s._metadata?s._metadata.sdk:void 0;return i||`${function(l){return`${function(c){const u=c.protocol?`${c.protocol}:`:"",h=c.port?`:${c.port}`:"";return`${u}//${c.host}${h}${c.path?`/${c.path}`:""}/api/`}(l)}${l.projectId}/envelope/`}(n)}?${g$e(n,o)}`}(this._dsn,t);this._transport=t.transport({recordDroppedEvent:this.recordDroppedEvent.bind(this),...t.transportOptions,url:r})}}captureException(t,r,n){if(g4(t))return void((typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&Ye.log(N4));let s=r&&r.event_id;return this._process(this.eventFromException(t,r).then(i=>this._captureEvent(i,r,n)).then(i=>{s=i}
975)),s}captureMessage(t,r,n,s){let i=n&&n.event_id;const o=QW(t)?this.eventFromMessage(String(t),r,n):this.eventFromException(t,n);return this._process(o.then(l=>this._captureEvent(l,n,s)).then(l=>{i=l})),i}captureEvent(t,r,n){if(r&&r.originalException&&g4(r.originalException))return void((typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&Ye.log(N4));let s=r&&r.event_id;return this._process(this._captureEvent(t,r,n).then(i=>{s=i})),s}captureSession(t){this._isEnabled()?typeof t.release!="string"?(typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&Ye.warn("Discarded session because of missing or non-string release"):(this.sendSession(t),Yd(t,{init:!1})):(typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&Ye.warn("SDK not enabled, will not capture session.")}getDsn(){return this._dsn}getOptions(){return this._options}getSdkMetadata(){return this._options._metadata}getTransport(){return this._transport}flush(t){const r=this._transport;return r?this._isClientDoneProcessing(t).then(n=>r.flush(t).then(s=>n&&s)):jc(!0)}close(t){return this.flush(t).then(r=>(this.getOptions().enabled=!1,r))}setupIntegrations(){this._isEnabled()&&!this._integrationsInitialized&&(this._integrations=function(t){const r={};return t.forEach(n=>{n&&_4(n,r)}),r}(this._options.integrations),this._integrationsInitialized=!0)}getIntegrationById(t){return this._integrations[t]}getIntegration(t){try{return this._integrations[t.id]||null}catch{return(typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&Ye.warn(`Cannot retrieve integration ${t.id} from the current Client`),null}}addIntegration(t){_4(t,this._integrations)}sendEvent(t,r={}){if(this._dsn){let n=y$e(t,this._dsn,this._options._metadata,this._options.tunnel);for(const i of r.attachments||[])n=o$e(n,c$e(i,this._options.transportOptions&&this._options.transportOptions.textEncoder));const s=this._sendEnvelope(n);s&&s.then(i=>this.emit("afterSendEvent",t,i),null)}}sendSession(t){if(this._dsn){const r=function(n,s,i,o){const l=sV(i);return hp({sent_at:new Date().toISOString(),...l&&{sdk:l},...!!o&&{dsn:t0(s)}},["aggregates"in n?[{type:"sessions"},n]:[{type:"session"},n.toJSON()]])}(t,this._dsn,this._options._metadata,this._options.tunnel);this._sendEnvelope(r)}}recordDroppedEvent(t,r,n){if(this._options.sendClientReports){const s=`${t}:${r}`;(typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&Ye.log(`Adding outcome: "${s}"`),this._outcomes[s]=this._outcomes[s]+1||1}}on(t,r){this._hooks[t]||(this._hooks[t]=[]),this._hooks[t].push(r)}emit(t,...r){this._hooks[t]&&this._hooks[t].forEach(n=>n(...r))}_updateSessionFromEvent(t,r){let n=!1,s=!1;const i=r.exception&&r.exception.values;if(i){s=!0;for(const l of i){const c=l.mechanism;if(c&&c.handled===!1){n=!0;break}}}const o=t.status==="ok";(o&&t.errors===0||o&&n)&&(Yd(t,{...n&&{status:"crashed"},errors:t.errors||Number(s||n)}),this.captureSession(t))}_isClientDoneProcessing(t){return new vn(r=>{let n=0;const s=setInterval(()=>{this._numProcessing==0?(clearInterval(s),r(!0)):(n+=1,t&&n>=t&&(clearInterval(s),r(!1)))},1)})}_isEnabled(){return this.getOptions().enabled!==!1&&this._dsn!==void 0}_prepareEvent(t,r,n){const s=this.getOptions(),i=Object.keys(this._integrations);return!r.integrations&&i.length>0&&(r.integrations=i),v$e(s,t,r,n).then(o=>{if(o===null)return o;const{propagationContext:l}=o.sdkProcessingMetadata||{};if(!(o.contexts&&o.contexts.trace)&&l){const{traceId:c,spanId:u,parentSpanId:h,dsc:d}=l;o.contexts={trace:{trace_id:c,span_id:u,parent_span_id:h},...o.contexts};const f=d||function(m,g,p){const v=g.getOptions(),{publicKey:x}=g.getDsn()||{},{segment:b}=p&&p.getUser()||{},w=dw({environment:v.environment||$E,release:v.release,user_segment:b,public_key:x,trace_id:m});return g.emit&&g.emit("createDsc",w),w}(c,this,n);o.sdkProcessingMetadata={dynamicSamplingContext:f,...o.sdkProcessingMetadata}}return o})}_captureEvent(t,r={},n){return this._processEvent(t,r,n).then(s=>s.event_id,s=>{if(typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__){const i=s;i.logLevel==="log"?Ye.log(i.message):Ye.warn(i)}})}_processEvent(t,r,n){const s=this.getOptions(),{sampleRate:i}=s;if(!this._isEnabled())return r0(new Fa("SDK not enabled, will not capture event.","log"));const o=C4(t),l=k4(t),c=t.type||"error",u=`before send for type \`${c}\``;if(l&&typeof i=="number"&&Math.random()>i)return this.recordDroppedEvent("sample_rate","error",t),r0(new Fa(`Discarding event because it's not included in the random sample (sampling rate = ${i})`,"log"));const h=c==="replay_event"?"replay":c;return this._prepareEvent(t,r,n).then(d=>{if(d===null)throw this.recordDroppedEvent("event_processor",h,t),new Fa("An event processor returned `null`, will not send event.","log");if(r.data&&r.data.__sentry__===!0)return d;const f=function(m,g,p){const{beforeSend:v,beforeSendTransaction:x}=m;return k4(g)&&v?v(g,p):C4(g)&&x?x(g,p):g}(s,d,r);return function(m,g){const p=`${g} must return \`null\` or a valid event.`;if(PE(m))return m.then(v=>{if(!Kd(v)&&v!==null)throw new Fa(p);return v},v=>{throw new Fa(`${g} rejected with ${v}`)});if(!Kd(m)&&m!==null)throw new Fa(p);return m}(f,u)}).then(d=>{if(d===null)throw this.recordDroppedEvent("before_send",h,t),new Fa(`${u} returned \`null\`, will not send event.`,"log");const f=n&&n.getSession();!o&&f&&this._updateSessionFromEvent(f,d);const m=d.transaction_info;if(o&&m&&d.transaction!==t.transaction){const g="custom";d.transaction_info={...m,source:g}}return this.sendEvent(d,r),d}).then(null,d=>{throw d instanceof Fa?d:(this.captureException(d,{data:{__sentry__:!0},originalException:d}),new Fa(`Event processing pipeline threw an error, original event will not be sent. Details have been sent as a new event.
976Reason: ${d}`))})}_process(t){this._numProcessing++,t.then(r=>(this._numProcessing--,r),r=>(this._numProcessing--,r))}
976_sendEnvelope(t){if(this._transport&&this._dsn)return this.emit("beforeEnvelope",t),this._transport.send(t).then(null,r=>{(typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&Ye.error("Error while sending event:",r)});(typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&Ye.error("Transport disabled")}_clearOutcomes(){const t=this._outcomes;return this._outcomes={},Object.keys(t).map(r=>{const[n,s]=r.split(":");return{reason:n,category:s,quantity:t[r]}})}}function k4(e){return e.type===void 0}function C4(e){return e.type==="transaction"}const x$e=30;function b$e(e,t,r=s$e(e.bufferSize||x$e)){let n={};function s(i){const o=[];if(v4(i,(u,h)=>{const d=x4(h);if(function(f,m,g=Date.now()){return function(p,v){return p[v]||p.all||0}(f,m)>g}(n,d)){const f=E4(u,h);e.recordDroppedEvent("ratelimit_backoff",d,f)}else o.push(u)}),o.length===0)return jc();const l=hp(i[0],o),c=u=>{v4(l,(h,d)=>{const f=E4(h,d);e.recordDroppedEvent(u,x4(d),f)})};return r.add(()=>t({body:l$e(l,e.textEncoder)}).then(u=>(u.statusCode!==void 0&&(u.statusCode<200||u.statusCode>=300)&&(typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&Ye.warn(`Sentry responded with status code ${u.statusCode} to sent event.`),n=h$e(n,u),u),u=>{throw c("network_error"),u})).then(u=>u,u=>{if(u instanceof Fa)return(typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&Ye.error("Skipped sending event because buffer is full."),c("queue_overflow"),jc();throw u})}return s.__sentry__baseTransport__=!0,{send:s,flush:i=>r.drain(i)}}function E4(e,t){if(t==="event"||t==="transaction")return Array.isArray(e)?e[1]:void 0}const T4="7.60.1";let A4;class fp{constructor(){fp.prototype.__init.call(this)}static __initStatic(){this.id="FunctionToString"}__init(){this.name=fp.id}setupOnce(){A4=Function.prototype.toString;try{Function.prototype.toString=function(...t){const r=RE(this)||this;return A4.apply(r,t)}}catch{}}}fp.__initStatic();const w$e=[/^Script error\.?$/,/^Javascript error: Script error\.? on line 0$/],j$e=[/^.*healthcheck.*$/,/^.*healthy.*$/,/^.*live.*$/,/^.*ready.*$/,/^.*heartbeat.*$/,/^.*\/health$/,/^.*\/healthz$/];class Ku{static __initStatic(){this.id="InboundFilters"}__init(){this.name=Ku.id}constructor(t={}){this._options=t,Ku.prototype.__init.call(this)}setupOnce(t,r){const n=s=>{const i=r();if(i){const o=i.getIntegration(Ku);if(o){const l=i.getClient(),c=l?l.getOptions():{},u=function(h={},d={}){return{allowUrls:[...h.allowUrls||[],...d.allowUrls||[]],denyUrls:[...h.denyUrls||[],...d.denyUrls||[]],ignoreErrors:[...h.ignoreErrors||[],...d.ignoreErrors||[],...h.disableErrorDefaults?[]:w$e],ignoreTransactions:[...h.ignoreTransactions||[],...d.ignoreTransactions||[],...h.disableTransactionDefaults?[]:j$e],ignoreInternal:h.ignoreInternal===void 0||h.ignoreInternal}}(o._options,c);return function(h,d){return d.ignoreInternal&&function(f){try{return f.exception.values[0].type==="SentryError"}catch{}return!1}(h)?((typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&Ye.warn(`Event dropped due to being internal Sentry Error.
977Event: ${mo(h)}`),!0):function(f,m){return f.type||!m||!m.length?!1:function(g){if(g.message)return[g.message];if(g.exception){const{values:p}=g.exception;try{const{type:v="",value:x=""}=p&&p[p.length-1]||{};return[`${x}`,`${v}: ${x}`]}catch{return(typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&Ye.error(`Cannot extract message for event ${mo(g)}`),[]}}return[]}(f).some(g=>sy(g,m))}(h,d.ignoreErrors)?((typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&Ye.warn(`Event dropped due to being matched by \`ignoreErrors\` option.
978Event: ${mo(h)}`),!0):function(f,m){if(f.type!=="transaction"||!m||!m.length)return!1;const g=f.transaction;return!!g&&sy(g,m)}(h,d.ignoreTransactions)?((typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&Ye.warn(`Event dropped due to being matched by \`ignoreTransactions\` option.
979Event: ${mo(h)}`),!0):function(f,m){if(!m||!m.length)return!1;const g=hy(f);return!!g&&sy(g,m)}(h,d.denyUrls)?((typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&Ye.warn(`Event dropped due to being matched by \`denyUrls\` option.
980Event: ${mo(h)}.
981Url: ${hy(h)}`),!0):function(f,m){if(!m||!m.length)return!0;const g=hy(f);return!g||sy(g,m)}(h,d.allowUrls)?!1:((typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&Ye.warn(`Event dropped due to not being matched by \`allowUrls\` option.
982Event: ${mo(h)}.
983Url: ${hy(h)}`),!0)}(s,u)?null:s}}return s};n.id=this.name,t(n)}}function hy(e){try{let t;try{t=e.exception.values[0].stacktrace.frames}catch{}return t?function(r=[]){for(let n=r.length-1;n>=0;n--){const s=r[n];if(s&&s.filename!=="<anonymous>"&&s.filename!=="[native code]")return s.filename||null}return null}(t):null}catch{return(typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&Ye.error(`Cannot extract url for event ${mo(e)}`),null}}Ku.__initStatic();var _$e=Object.freeze({__proto__:null,FunctionToString:fp,InboundFilters:Ku});const Ct=va;let BN=0;function uV(){return BN>0}function Xd(e,t={},r){if(typeof e!="function")return e;try{const s=e.__sentry_wrapped__;if(s)return s;if(RE(e))return e}catch{return e}const n=function(){const s=Array.prototype.slice.call(arguments);try{r&&typeof r=="function"&&r.apply(this,arguments);const o=s.map(l=>Xd(l,t));return e.apply(this,o)}catch(o){throw BN++,setTimeout(()=>{BN--}),i=l=>{var c,u;l.addEventProcessor(h=>(t.mechanism&&(IN(h,void 0),dp(h,t.mechanism)),h.extra={...h.extra,arguments:s},h)),c=o,Jn().captureException(c,{captureContext:u})},Jn().withScope(i),o}var i};try{for(const s in e)Object.prototype.hasOwnProperty.call(e,s)&&(n[s]=e[s])}catch{}ZW(n,e),ME(e,"__sentry_wrapped__",n);try{Object.getOwnPropertyDescriptor(n,"name").configurable&&Object.defineProperty(n,"name",{get:()=>e.name})}catch{}return n}function dV(e,t){const r=DE(e,t),n={type:t&&t.name,value:N$e(t)};return r.length&&(n.stacktrace={frames:r}),n.type===void 0&&n.value===""&&(n.value="Unrecoverable error caught"),n}function ej(e,t){return{exception:{values:[dV(e,t)]}}}function DE(e,t){const r=t.stacktrace||t.stack||"",n=function(s){if(s){if(typeof s.framesToPop=="number")return s.framesToPop;if(S$e.test(s.message))return 1}return 0}(t);try{return e(r,n)}catch{}return[]}const S$e=/Minified React error #\d+;/i;function N$e(e){const t=e&&e.message;return t?t.error&&typeof t.error.message=="string"?t.error.message:t:"No error message"}function LE(e,t,r,n,s){let i;if(AE(t)&&t.error)return ej(e,t.error);if(a4(t)||Ch(t,"DOMException")){const o=t;if("stack"in t)i=ej(e,t);else{const l=o.name||(a4(o)?"DOMError":"DOMException"),c=o.message?`${l}: ${o.message}`:l;i=UN(e,c,r,n),IN(i,c)}return"code"in o&&(i.tags={...i.tags,"DOMException.code":`${o.code}`}),i}return XW(t)?ej(e,t):Kd(t)||Zx(t)?(i=function(o,l,c,u){const h=Jn().getClient(),d=h&&h.getOptions().normalizeDepth,f={exception:{values:[{type:Zx(l)?l.constructor.name:u?"UnhandledRejection":"Error",value:k$e(l,{isUnhandledRejection:u})}]},extra:{__serialized__:rV(l,d)}};if(c){const m=DE(o,c);m.length&&(f.exception.values[0].stacktrace={frames:m})}return f}(e,t,r,s),dp(i,{synthetic:!0}),i):(i=UN(e,t,r,n),IN(i,`${t}`),dp(i,{synthetic:!0}),i)}function UN(e,t,r,n){const s={message:t};if(n&&r){const i=DE(e,r);i.length&&(s.exception={values:[{value:t,stacktrace:{frames:i}}]})}return s}function k$e(e,{isUnhandledRejection:t}){const r=function(s,i=40){const o=Object.keys(eV(s));if(o.sort(),!o.length)return"[object has no keys]";if(o[0].length>=i)return Gu(o[0],i);for(let l=o.length;l>0;l--){const c=o.slice(0,l).join(", ");
983if(!(c.length>i))return l===o.length?c:Gu(c,i)}return""}(e),n=t?"promise rejection":"exception";return AE(e)?`Event \`ErrorEvent\` captured as ${n} with message \`${e.message}\``:Zx(e)?`Event \`${function(s){try{const i=Object.getPrototypeOf(s);return i?i.constructor.name:void 0}catch{}}(e)}\` (type=${e.type}) captured as ${n}`:`Object captured as ${n} with keys: ${r}`}const P4=1024,hV="Breadcrumbs";class mp{static __initStatic(){this.id=hV}__init(){this.name=mp.id}constructor(t){mp.prototype.__init.call(this),this.options={console:!0,dom:!0,fetch:!0,history:!0,sentry:!0,xhr:!0,...t}}setupOnce(){this.options.console&&Ol("console",C$e),this.options.dom&&Ol("dom",function(t){function r(n){let s,i=typeof t=="object"?t.serializeAttribute:void 0,o=typeof t=="object"&&typeof t.maxStringLength=="number"?t.maxStringLength:void 0;o&&o>P4&&((typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&Ye.warn(`\`dom.maxStringLength\` cannot exceed 1024, but a value of ${o} was configured. Sentry will use 1024 instead.`),o=P4),typeof i=="string"&&(i=[i]);try{const l=n.event;s=function(c){return!!c&&!!c.target}(l)?ON(l.target,{keyAttrs:i,maxStringLength:o}):ON(l,{keyAttrs:i,maxStringLength:o})}catch{s="<unknown>"}s.length!==0&&Jn().addBreadcrumb({category:`ui.${n.name}`,message:s},{event:n.event,name:n.name,global:n.global})}return r}(this.options.dom)),this.options.xhr&&Ol("xhr",E$e),this.options.fetch&&Ol("fetch",T$e),this.options.history&&Ol("history",A$e)}addSentryBreadcrumb(t){this.options.sentry&&Jn().addBreadcrumb({category:"sentry."+(t.type==="transaction"?"transaction":"event"),event_id:t.event_id,level:t.level,message:mo(t)},{event:t})}}function C$e(e){for(let n=0;n<e.args.length;n++)if(e.args[n]==="ref=Ref<"){e.args[n+1]="viewRef";break}const t={category:"console",data:{arguments:e.args,logger:"console"},level:(r=e.level,r==="warn"?"warning":i$e.includes(r)?r:"log"),message:s4(e.args," ")};var r;if(e.level==="assert"){if(e.args[0]!==!1)return;t.message=`Assertion failed: ${s4(e.args.slice(1)," ")||"console.assert"}`,t.data.arguments=e.args.slice(1)}Jn().addBreadcrumb(t,{input:e.args,level:e.level})}function E$e(e){const{startTimestamp:t,endTimestamp:r}=e,n=e.xhr[pf];if(!t||!r||!n)return;const{method:s,url:i,status_code:o,body:l}=n,c={method:s,url:i,status_code:o},u={xhr:e.xhr,input:l,startTimestamp:t,endTimestamp:r};Jn().addBreadcrumb({category:"xhr",data:c,type:"http"},u)}function T$e(e){const{startTimestamp:t,endTimestamp:r}=e;if(r&&(!e.fetchData.url.match(/sentry_key/)||e.fetchData.method!=="POST"))if(e.error){const n=e.fetchData,s={data:e.error,input:e.args,startTimestamp:t,endTimestamp:r};Jn().addBreadcrumb({category:"fetch",data:n,level:"error",type:"http"},s)}else{const n={...e.fetchData,status_code:e.response&&e.response.status},s={input:e.args,response:e.response,startTimestamp:t,endTimestamp:r};Jn().addBreadcrumb({category:"fetch",data:n,type:"http"},s)}}function A$e(e){let t=e.from,r=e.to;const n=J1(Ct.location.href);let s=J1(t);const i=J1(r);s.path||(s=n),n.protocol===i.protocol&&n.host===i.host&&(r=i.relative),n.protocol===s.protocol&&n.host===s.host&&(t=s.relative),Jn().addBreadcrumb({category:"navigation",data:{from:t,to:r}})}mp.__initStatic();class P$e extends Ml{constructor(t){const r=Ct.SENTRY_SDK_SOURCE||"npm";t._metadata=t._metadata||{},t._metadata.sdk=t._metadata.sdk||{name:"sentry.javascript.browser",packages:[{name:`${r}:@sentry/browser`,version:T4}],version:T4},super(t),t.sendClientReports&&Ct.document&&Ct.document.addEventListener("visibilitychange",()=>{Ct.document.visibilityState==="hidden"&&this._flushOutcomes()})}eventFromException(t,r){return function(n,s,i,o){const l=LE(n,s,i&&i.syntheticException||void 0,o);return dp(l),l.level="error",i&&i.event_id&&(l.event_id=i.event_id),jc(l)}(this._options.stackParser,t,r,this._options.attachStacktrace)}eventFromMessage(t,r="info",n){return function(s,i,o="info",l,c){const u=UN(s,i,l&&l.syntheticException||void 0,c);return u.level=o,l&&l.event_id&&(u.event_id=l.event_id),jc(u)}(this._options.stackParser,t,r,n,this._options.attachStacktrace)}sendEvent(t,r){const n=this.getIntegrationById(hV);n&&n.addSentryBreadcrumb&&n.addSentryBreadcrumb(t),super.sendEvent(t,r)}captureUserFeedback(t){if(!this._isEnabled())return void((typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&Ye.warn("SDK not enabled, will not capture user feedback."));const r=function(n,{metadata:s,tunnel:i,dsn:o}){const l={event_id:n.event_id,sent_at:new Date().toISOString(),...s&&s.sdk&&{sdk:{name:s.sdk.name,version:s.sdk.version}},...!!i&&!!o&&{dsn:t0(o)}};return hp(l,[function(u){return[{type:"user_report"},u]}(n)])}(t,{metadata:this.getSdkMetadata(),dsn:this.getDsn(),tunnel:this.getOptions().tunnel});this._sendEnvelope(r)}_prepareEvent(t,r,n){return t.platform=t.platform||"javascript",super._prepareEvent(t,r,n)}_flushOutcomes(){const t=this._clearOutcomes();if(t.length===0)return void((typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&Ye.log("No outcomes to send"));if(!this._dsn)return void((typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&Ye.log("No dsn provided, will not send outcomes"));(typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&Ye.log("Sending outcomes:",t);const r=(n=t,hp((s=this._options.tunnel&&t0(this._dsn))?{dsn:s}:{},[[{type:"client_report"},{timestamp:i||hw(),discarded_events:n}]]));var n,s,i;this._sendEnvelope(r)}}let ef;
983function O$e(e,t=function(){if(ef)return ef;if(RN(Ct.fetch))return ef=Ct.fetch.bind(Ct);const r=Ct.document;let n=Ct.fetch;if(r&&typeof r.createElement=="function")try{const s=r.createElement("iframe");s.hidden=!0,r.head.appendChild(s);const i=s.contentWindow;i&&i.fetch&&(n=i.fetch),r.head.removeChild(s)}catch(s){(typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&Ye.warn("Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ",s)}return ef=n.bind(Ct)}()){let r=0,n=0;return b$e(e,function(s){const i=s.body.length;r+=i,n++;const o={body:s.body,method:"POST",referrerPolicy:"origin",headers:e.headers,keepalive:r<=6e4&&n<15,...e.fetchOptions};try{return t(e.url,o).then(l=>(r-=i,n--,{statusCode:l.status,headers:{"x-sentry-rate-limits":l.headers.get("X-Sentry-Rate-Limits"),"retry-after":l.headers.get("Retry-After")}}))}catch(l){return ef=void 0,r-=i,n--,r0(l)}})}class Go{static __initStatic(){this.id="GlobalHandlers"}__init(){this.name=Go.id}__init2(){this._installFunc={onerror:M$e,onunhandledrejection:R$e}}constructor(t){Go.prototype.__init.call(this),Go.prototype.__init2.call(this),this._options={onerror:!0,onunhandledrejection:!0,...t}}setupOnce(){Error.stackTraceLimit=50;const t=this._options;for(const n in t){const s=this._installFunc[n];s&&t[n]&&(r=n,(typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&Ye.log(`Global Handler attached: ${r}`),s(),this._installFunc[n]=void 0)}var r}}function M$e(){Ol("error",e=>{const[t,r,n]=mV();if(!t.getIntegration(Go))return;const{msg:s,url:i,line:o,column:l,error:c}=e;if(uV()||c&&c.__sentry_own_request__)return;const u=c===void 0&&bc(s)?function(h,d,f,m){const g=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;let p=AE(h)?h.message:h,v="Error";const x=p.match(g);return x&&(v=x[1],p=x[2]),O4({exception:{values:[{type:v,value:p}]}},d,f,m)}(s,i,o,l):O4(LE(r,c||s,void 0,n,!1),i,o,l);u.level="error",fV(t,c,u,"onerror")})}function R$e(){Ol("unhandledrejection",e=>{const[t,r,n]=mV();if(!t.getIntegration(Go))return;let s=e;try{"reason"in e?s=e.reason:"detail"in e&&"reason"in e.detail&&(s=e.detail.reason)}catch{}if(uV()||s&&s.__sentry_own_request__)return!0;const i=QW(s)?{exception:{values:[{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${String(s)}`}]}}:LE(r,s,void 0,n,!0);i.level="error",fV(t,s,i,"onunhandledrejection")})}function O4(e,t,r,n){const s=e.exception=e.exception||{},i=s.values=s.values||[],o=i[0]=i[0]||{},l=o.stacktrace=o.stacktrace||{},c=l.frames=l.frames||[],u=isNaN(parseInt(n,10))?void 0:n,h=isNaN(parseInt(r,10))?void 0:r,d=bc(t)&&t.length>0?t:function(){try{return QRe.document.location.href}catch{return""}}();return c.length===0&&c.push({colno:u,filename:d,function:"?",in_app:!0,lineno:h}),e}function fV(e,t,r,n){dp(r,{handled:!1,type:n}),e.captureEvent(r,{originalException:t})}function mV(){const e=Jn(),t=e.getClient(),r=t&&t.getOptions()||{stackParser:()=>[],attachStacktrace:!1};return[e,r.stackParser,r.attachStacktrace]}Go.__initStatic();const $$e=["EventTarget","Window","Node","ApplicationCache","AudioTrackList","ChannelMergerNode","CryptoOperation","EventSource","FileReader","HTMLUnknownElement","IDBDatabase","IDBRequest","IDBTransaction","KeyOperation","MediaController","MessagePort","ModalWindow","Notification","SVGElementInstance","Screen","TextTrack","TextTrackCue","TextTrackList","WebSocket","WebSocketWorker","Worker","XMLHttpRequest","XMLHttpRequestEventTarget","XMLHttpRequestUpload"];class pp{static __initStatic(){this.id="TryCatch"}__init(){this.name=pp.id}constructor(t){pp.prototype.__init.call(this),this._options={XMLHttpRequest:!0,eventTarget:!0,requestAnimationFrame:!0,setInterval:!0,setTimeout:!0,...t}}setupOnce(){this._options.setTimeout&&Rr(Ct,"setTimeout",M4),this._options.setInterval&&Rr(Ct,"setInterval",M4),this._options.requestAnimationFrame&&Rr(Ct,"requestAnimationFrame",I$e),this._options.XMLHttpRequest&&"XMLHttpRequest"in Ct&&Rr(XMLHttpRequest.prototype,"send",D$e);const t=this._options.eventTarget;t&&(Array.isArray(t)?t:$$e).forEach(L$e)}}function M4(e){return function(...t){const r=t[0];return t[0]=Xd(r,{mechanism:{data:{function:Zo(e)},handled:!0,type:"instrument"}}),e.apply(this,t)}}function I$e(e){return function(t){return e.apply(this,[Xd(t,{mechanism:{data:{function:"requestAnimationFrame",handler:Zo(e)},handled:!0,type:"instrument"}})])}}function D$e(e){return function(...t){const r=this;return["onload","onerror","onprogress","onreadystatechange"].forEach(n=>
983{n in r&&typeof r[n]=="function"&&Rr(r,n,function(s){const i={mechanism:{data:{function:n,handler:Zo(s)},handled:!0,type:"instrument"}},o=RE(s);return o&&(i.mechanism.data.handler=Zo(o)),Xd(s,i)})}),e.apply(this,t)}}function L$e(e){const t=Ct,r=t[e]&&t[e].prototype;r&&r.hasOwnProperty&&r.hasOwnProperty("addEventListener")&&(Rr(r,"addEventListener",function(n){return function(s,i,o){try{typeof i.handleEvent=="function"&&(i.handleEvent=Xd(i.handleEvent,{mechanism:{data:{function:"handleEvent",handler:Zo(i),target:e},handled:!0,type:"instrument"}}))}catch{}return n.apply(this,[s,Xd(i,{mechanism:{data:{function:"addEventListener",handler:Zo(i),target:e},handled:!0,type:"instrument"}}),o])}}),Rr(r,"removeEventListener",function(n){return function(s,i,o){const l=i;try{const c=l&&l.__sentry_wrapped__;c&&n.call(this,s,c,o)}catch{}return n.call(this,s,l,o)}}))}pp.__initStatic();class Yu{static __initStatic(){this.id="LinkedErrors"}__init(){this.name=Yu.id}constructor(t={}){Yu.prototype.__init.call(this),this._key=t.key||"cause",this._limit=t.limit||5}setupOnce(t,r){t((n,s)=>{const i=r(),o=i.getClient(),l=i.getIntegration(Yu);if(!o||!l)return n;const c=o.getOptions();return XRe(dV,c.stackParser,c.maxValueLength,l._key,l._limit,n,s),n})}}Yu.__initStatic();class Xu{constructor(){Xu.prototype.__init.call(this)}static __initStatic(){this.id="HttpContext"}__init(){this.name=Xu.id}setupOnce(){oV(t=>{if(Jn().getIntegration(Xu)){if(!Ct.navigator&&!Ct.location&&!Ct.document)return t;const r=t.request&&t.request.url||Ct.location&&Ct.location.href,{referrer:n}=Ct.document||{},{userAgent:s}=Ct.navigator||{},i={...t.request&&t.request.headers,...n&&{Referer:n},...s&&{"User-Agent":s}},o={...t.request,...r&&{url:r},headers:i};return{...t,request:o}}return t})}}Xu.__initStatic();class Qu{constructor(){Qu.prototype.__init.call(this)}static __initStatic(){this.id="Dedupe"}__init(){this.name=Qu.id}setupOnce(t,r){const n=s=>{if(s.type)return s;const i=r().getIntegration(Qu);if(i){try{if(function(o,l){return l?!!(function(c,u){const h=c.message,d=u.message;return!(!h&&!d||h&&!d||!h&&d||h!==d||!$4(c,u)||!R4(c,u))}(o,l)||function(c,u){const h=I4(u),d=I4(c);return!(!h||!d||h.type!==d.type||h.value!==d.value||!$4(c,u)||!R4(c,u))}(o,l)):!1}(s,i._previousEvent))return(typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&Ye.warn("Event dropped due to being a duplicate of previously captured event."),null}catch{return i._previousEvent=s}return i._previousEvent=s}return s};n.id=this.name,t(n)}}function R4(e,t){let r=D4(e),n=D4(t);if(!r&&!n)return!0;if(r&&!n||!r&&n||n.length!==r.length)return!1;for(let s=0;s<n.length;s++){const i=n[s],o=r[s];if(i.filename!==o.filename||i.lineno!==o.lineno||i.colno!==o.colno||i.function!==o.function)return!1}return!0}function $4(e,t){let r=e.fingerprint,n=t.fingerprint;if(!r&&!n)return!0;if(r&&!n||!r&&n)return!1;try{return r.join("")===n.join("")}catch{return!1}}function I4(e){return e.exception&&e.exception.values&&e.exception.values[0]}function D4(e){const t=e.exception;if(t)try{return t.values[0].stacktrace.frames}catch{return}}Qu.__initStatic();var F$e=Object.freeze({__proto__:null,Breadcrumbs:mp,Dedupe:Qu,GlobalHandlers:Go,HttpContext:Xu,LinkedErrors:Yu,TryCatch:pp});let pV={};Ct.Sentry&&Ct.Sentry.Integrations&&(pV=Ct.Sentry.Integrations);const L4={...pV,..._$e,...F$e};var F4="new",z4="loading",B4="loaded",WN="joining-meeting",Cu="joined-meeting",ao="left-meeting",so="error",tj="unknown",z$e="full",B$e="base",U$e="*",W$e="iframe-ready-for-launch-config",V$e="iframe-launch-config",U4="theme-updated",W4="loading",V4="load-attempt-failed",rj="loaded",H$e="started-camera",q$e="camera-error",H4="joining-meeting",G$e="joined-meeting",K$e="left-meeting",q4="available-devices-updated",Y$e="participant-joined",X$e="participant-updated",Q$e="participant-left",J$e="participant-counts-updated",Z$e="access-state-updated",eIe="meeting-session-summary-updated",tIe="meeting-session-state-updated",rIe="waiting-participant-added",nIe="waiting-participant-updated",aIe="waiting-participant-removed",G4="track-started",K4="track-stopped",sIe="transcription-started",iIe="transcription-stopped",oIe="transcription-error",nj="recording-started",aj="recording-stopped",lIe="recording-stats",cIe="recording-error",uIe="recording-upload-completed",dIe="recording-data",hIe="app-message",fIe="transcription-message",mIe="remote-media-player-started",pIe="remote-media-player-updated",gIe="remote-media-player-stopped",yIe="local-screen-share-started",vIe="local-screen-share-stopped",xIe="local-screen-share-canceled",bIe="active-speaker-change",wIe="active-speaker-mode-change",jIe="network-quality-change",_Ie="network-connection",SIe="cpu-load-change",NIe="face-counts-updated",nu="fullscreen",au="exited-fullscreen",kIe="live-streaming-started",CIe="live-streaming-updated",EIe="live-streaming-stopped",TIe="live-streaming-error",AIe="lang-updated",PIe="receive-settings-updated",OIe="input-sett
983ings-updated",sj="nonfatal-error",ij="error",Y4=102400,oj="iframe-call-message",X4="local-screen-start",Q4="daily-method-update-live-streaming-endpoints",tf="transmit-log",gf="daily-custom-track",Vy={NONE:"none",BGBLUR:"background-blur",BGIMAGE:"background-image",FACE_DETECTION:"face-detection"},gV={NONE:"none",NOISE_CANCELLATION:"noise-cancellation"},VN={PLAY:"play",PAUSE:"pause"},J4=10,lj=["jpg","png","jpeg"],MIe="add-endpoints",RIe="remove-endpoints";function gs(){return!wt()&&typeof window<"u"&&window.navigator&&window.navigator.userAgent?window.navigator.userAgent:""}function wt(){return typeof navigator<"u"&&navigator.product&&navigator.product==="ReactNative"}function yV(){return navigator&&navigator.mediaDevices&&navigator.mediaDevices.getUserMedia}function $Ie(){return!!(navigator&&navigator.mediaDevices&&navigator.mediaDevices.getDisplayMedia)&&(function(e,t){if(!e||!t)return!0;switch(e){case"Chrome":return t.major>=75;case"Safari":return RTCRtpTransceiver.prototype.hasOwnProperty("currentDirection")&&!(t.major===13&&t.minor===0&&t.point===0);case"Firefox":return t.major>=67}return!0}(_c(),qN())||wt())}function Z4(){if(wt()||!document)return!1;var e=document.createElement("iframe");return!!e.requestFullscreen||!!e.webkitRequestFullscreen}var IIe=function(){try{var e=document.createElement("canvas"),t=e.getContext("webgl")!=null;return e.remove(),t}catch{return!1}}();function vV(){var e=arguments.length>0&&arguments[0]!==void 0&&arguments[0];return!wt()&&!!IIe&&(e?function(){return HN()?!1:["Chrome","Firefox"].includes(_c())}():function(){if(HN())return!1;var t=_c();if(t==="Safari"){var r=zE();if(r.major<15||r.major===15&&r.minor<4)return!1}return t==="Chrome"?FE().major>=77:t==="Firefox"?BE().major>=97:["Chrome","Firefox","Safari"].includes(t)}())}var DIe=["Chrome","Firefox"];function xV(){return!wt()&&!HN()&&typeof AudioWorkletNode<"u"&&DIe.includes(_c())}function eR(){return yV()&&!function(){var e,t=_c();if(!gs())return!0;switch(t){case"Chrome":return(e=FE()).major&&e.major>0&&e.major<75;case"Firefox":return(e=BE()).major<91;case"Safari":return(e=zE()).major<13||e.major===13&&e.minor<1;default:return!0}}()}function HN(){var e,t,r=gs(),n=r.match(/Mac/)&&(!wt()&&typeof window<"u"&&(e=window)!==null&&e!==void 0&&(t=e.n
983avigator)!==null&&t!==void 0&&t.maxTouchPoints?window.navigator.maxTouchPoints:0)>=5;return!!(r.match(/Mobi/)||r.match(/Android/)||n)||!!gs().match(/DailyAnd\//)||void 0}function _c(){if(typeof window<"u"){var e=gs();return bV()?"Safari":e.indexOf("Edge")>-1?"Edge":e.match(/Chrome\//)?"Chrome":e.indexOf("Safari")>-1?"Safari":e.indexOf("Firefox")>-1?"Firefox":e.indexOf("MSIE")>-1||e.indexOf(".NET")>-1?"IE":"Unknown Browser"}}function qN(){switch(_c()){case"Chrome":return FE();case"Safari":return zE();case"Firefox":return BE();case"Edge":return function(){var e=0,t=0;if(typeof window<"u"){var r=gs().match(/Edge\/(\d+).(\d+)/);if(r)try{e=parseInt(r[1]),t=parseInt(r[2])}catch{}}return{major:e,minor:t}}()}}function FE(){var e=0,t=0,r=0,n=0,s=!1;if(typeof window<"u"){var i=gs(),o=i.match(/Chrome\/(\d+).(\d+).(\d+).(\d+)/);if(o)try{e=parseInt(o[1]),t=parseInt(o[2]),r=parseInt(o[3]),n=parseInt(o[4]),s=i.indexOf("OPR/")>-1}catch{}}return{major:e,minor:t,build:r,patch:n,opera:s}}function bV(){return!!gs().match(/iPad|iPhone|iPod/i)&&yV()}function zE(){var e=0,t=0,r=0;if(typeof window<"u"){var n=gs().match(/Version\/(\d+).(\d+)(.(\d+))?/);if(n)try{e=parseInt(n[1]),t=parseInt(n[2]),r=parseInt(n[4])}catch{}else bV()&&(e=14,t=0,r=3)}return{major:e,minor:t,point:r}}function BE(){var e=0,t=0;if(typeof window<"u"){var r=gs().match(/Firefox\/(\d+).(\d+)/);if(r)try{e=parseInt(r[1]),t=parseInt(r[2])}catch{}}return{major:e,minor:t}}var wV=function(){function e(){bs(this,e)}return ws(e,[{key:"addListenerForMessagesFromCallMachine",value:function(t,r,n){Zh()}},{key:"addListenerForMessagesFromDailyJs",value:function(t,r,n){Zh()}},{key:"sendMessageToCallMachine",value:function(t,r,n,s){Zh()}},{key:"sendMessageToDailyJs",value:function(t,r){Zh()}},{key:"removeListener",value:function(t){Zh()}}]),e}();function tR(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function cj(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?tR(Object(r),!0).forEach(function(n){fo(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):tR(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function LIe(e){var t=function(){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}}();return function(){var r,n=ps(e);if(t){var s=ps(this).constructor;r=Reflect.construct(n,arguments,s)}else r=n.apply(this,arguments);return cw(this,r)}}var FIe=function(e){lw(r,wV);var t=LIe(r);function r(){var n;return bs(this,r),(n=t.call(this))._wrappedListeners={},n._messageCallbacks={},n}return ws(r,[{key:"addListenerForMessagesFromCallMachine",value:function(n,s,i){var o=this,l=function(c){if(c.data&&c.data.what==="iframe-call-message"&&(!c.data.callFrameId||c.data.callFrameId===s)&&(!c.data.from||c.data.from!=="module")){var u=cj({},c.data);if(delete u.from,u.callbackStamp&&o._messageCallbacks[u.callbackStamp]){var h=u.callbackStamp;o._messageCallbacks[h].call(i,u),delete o._messageCallbacks[h]}delete u.what,delete u.callbackStamp,n.call(i,u)}};this._wrappedListeners[n]=l,window.addEventListener("message",l)}},{key:"addListenerForMessagesFromDailyJs",value:function(n,s,i){var o=function(l){if(!(!l.data||l.data.what!==oj||!l.data.action||l.data.from&&l.data.from!=="module"||l.data.callFrameId&&s&&l.data.callFrameId!==s)){var c=l.data;n.call(i,c)}};this._wrappedListeners[n]=o,window.addEventListener("message",o)}},{key:"sendMessageToCallMachine",value:function(n,s,i,o){if(!o)throw new Error("undefined callFrameId. Are you trying to use a DailyCall instance previously destroyed?");var l=cj({},n);if(l.what=oj,l.from="module",l.callFrameId=o,s){var c=uw();this._messageCallbacks[c]=s,l.callbackStamp=c}var u=i?i.contentWindow:window,h=this._callMachineTargetOrigin(i);h&&u.postMessage(l,h)}},{key:"sendMessageToDailyJs",value:function(n,s){n.what=oj,n.callFrameId=s,n.from="embedded",window.postMessage(n,this._targetOriginFromWindowLocation())}},{key:"removeListener",value:function(n){var s=this._wrappedListeners[n];s&&(window.removeEventListener("message",s),delete this._wrappedListeners[n])}},{key:"forwardPackagedMessageToCallMachine",value:function(n,s,i){var o=cj({},n);o.callFrameId=i;var l=s?s.contentWindow:window,c=this._callMachineTargetOrigin(s);c&&l.postMessage(o,c)}},{key:"addListenerForPackagedMessagesFromCallMachine",value:function(n,s){var i=function(o){if
983(o.data&&o.data.what==="iframe-call-message"&&(!o.data.callFrameId||o.data.callFrameId===s)&&(!o.data.from||o.data.from!=="module")){var l=o.data;n(l)}};return this._wrappedListeners[n]=i,window.addEventListener("message",i),n}},{key:"removeListenerForPackagedMessagesFromCallMachine",value:function(n){var s=this._wrappedListeners[n];s&&(window.removeEventListener("message",s),delete this._wrappedListeners[n])}},{key:"_callMachineTargetOrigin",value:function(n){return n?n.src?new URL(n.src).origin:void 0:this._targetOriginFromWindowLocation()}},{key:"_targetOriginFromWindowLocation",value:function(){return window.location.protocol==="file:"?"*":window.location.origin}}]),r}();function zIe(e){var t=function(){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}}();return function(){var r,n=ps(e);if(t){var s=ps(this).constructor;r=Reflect.construct(n,arguments,s)}else r=n.apply(this,arguments);return cw(this,r)}}var BIe=function(e){lw(r,wV);var t=zIe(r);function r(){var n;return bs(this,r),n=t.call(this),global.callMachineToDailyJsEmitter=global.callMachineToDailyJsEmitter||new ji.EventEmitter,global.dailyJsToCallMachineEmitter=global.dailyJsToCallMachineEmitter||new ji.EventEmitter,n._wrappedListeners={},n._messageCallbacks={},n}return ws(r,[{key:"addListenerForMessagesFromCallMachine",value:function(n,s,i){this._addListener(n,global.callMachineToDailyJsEmitter,i,"received call machine message")}},{key:"addListenerForMessagesFromDailyJs",value:function(n,s,i){this._addListener(n,global.dailyJsToCallMachineEmitter,i,"received daily-js message")}},{key:"sendMessageToCallMachine",value:function(n,s){this._sendMessage(n,global.dailyJsToCallMachineEmitter,"sending message to call machine",s)}},{key:"sendMessageToDailyJs",value:function(n){this._sendMessage(n,global.callMachineToDailyJsEmitter,"sending message to daily-js")}},{key:"removeListener",value:function(n){var s=this._wrappedListeners[n];s&&(global.callMachineToDailyJsEmitter.removeListener("message",s),global.dailyJsToCallMachineEmitter.removeListener("message",s),delete this._wrappedListeners[n])}},{key:"_addListener",value:function(n,s,i,o){var l=this,c=function(u){if(u.callbackStamp&&l._messageCallbacks[u.callbackStamp]){var h=u.callbackStamp;l._messageCallbacks[h].call(i,u),delete l._messageCallbacks[h]}n.call(i,u)};this._wrappedListeners[n]=c,s.addListener("message",c)}},{key:"_sendMessage",value:function(n,s,i,o){if(o){var l=uw();this._messageCallbacks[l]=o,n.callbackStamp=l}s.emit("message",n)}}]),r}(),GN="replace",KN="shallow-merge",rR=[GN,KN],UIe=function(){function e(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r=t.data,n=t.mergeStrategy,s=n===void 0?GN:n;bs(this,e),e._validateMergeStrategy(s),e._validateData(r,s),this.mergeStrategy=s,this.data=r}return ws(e,[{key:"isNoOp",value:function(){return e.isNoOpUpdate(this.data,this.mergeStrategy)}}],[{key:"isNoOpUpdate",value:function(t,r){return Object.keys(t).length===0&&r===KN}},{key:"_validateMergeStrategy",value:function(t){if(!rR.includes(t))throw Error("Unrecognized mergeStrategy provided. Options are: [".concat(rR,"]"))}},{key:"_validateData",value:function(t,r){if(!function(l){if(l==null||Et(l)!=="object")return!1;var c=Object.getPrototypeOf(l);return c==null||c===Object.prototype}(t))throw Error("Meeting session data must be a plain (map-like) object");var n;try{if(n=JSON.stringify(t),r===GN){var s=JSON.parse(n);bn(s,t)||console.warn("The meeting session data provided will be modified when serialized.",s,t)}else if(r===KN){for(var i in t)if(Object.hasOwnProperty.call(t,i)&&t[i]!==void 0){var o=JSON.parse(JSON.stringify(t[i]));bn(t[i],o)||console.warn("At least one key in the meeting session data provided will be modified when serialized.",o,t[i])}}}catch(l){throw Error("Meeting session data must be serializable to JSON: ".concat(l))}if(n.length>Y4)throw Error("Meeting session data is too large (".concat(n.length," characters). Maximum size suppported is ").concat(Y4,"."))}}]),e}();function YN(e,t,r){return YN=function(){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}}()?Reflect.construct.bind():function(n,s,i){var o=[null];o.push.apply(o,s);var l=new(Function.bind.apply(n,o));return i&&cp(l,i.prototype),l},YN.apply(null,arguments)}function XN(e){var t=typeof Map=="function"?new Map:void 0;return XN=function(r){if(r===null||(n=r,Function.toString.call(n).indexOf("[native code]")===-1))return r;var n;if(typeof r!="function")throw new TypeError("Super expression must either be null or a function");if(t!==void 0){if(t.has(r))return t.get(r);t.set(r,s)}function s(){return YN(r,arguments,ps(this).constructor)}return s.prototype=Object.create(r.prototype,{constructor:{value:s,enumerable:!1,writable:!0,configurable:!0}}),cp(s,r)},XN(e)}function WIe(e){var t=function(){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}}();return function(){var r,n=ps(e);if(t){var s=ps(this).constructor;r=Reflect.construct(n,arguments,s)}else r=n.apply(this,arguments);return cw(this,r)}}function nR(e){var t,r=(t=window._daily)===null||t===void 0?void 0:t.pendings;if(r){var n=r.indexOf(e);n!==-1&&r.splice(n,1)}}var VIe=function(){function e(t){bs(this,e),this._currentLoad=null,this._callFrameId=t}return ws(e,[{key:"load",value:function(t,r,n){var s,i=this;if(this.loaded)return window._daily.instances[this._callFrameId].callMachine.reset(),void r(!0);s=this._callFrameId,window._daily?window._daily.pendings||(window._daily.pendings=[]):window._daily={pendings:[],instances:{}},window._daily.pendings.push(s),window._daily.instances[s]=window._daily.instances[s]||{},this._currentLoad&&this._currentLoad.cancel(),this._currentLoad=new HIe(t,function(){r(!1)},function(o,l){l||nR(i._callFrameId),n(o,l)}),this._currentLoad.start()}},{key:"cancel",value:function(){this._currentLoad&&this._currentLoad.cancel(),nR(this._callFrameId)}},{key:"loaded",get:function(){return this._currentLoad&&this._currentLoad.succeeded}}]),e}(),HIe=function(){function e(t,r,n){bs(this,e),this._attemptsRemaining=3,this._currentAttempt=null,this.avoidEval=t,this._successCallback=r,this._failureCallback=n}return ws(e,[{key:"start",value:function(){var t=this;this._currentAttempt||(this._currentAttempt=new aR(this.avoidEval,this._successCallback,function r(n){t._currentAttempt.cancelled||(t._attemptsRemaining--,t._failureCallback(n,t._attemptsRemaining>0),t._attemptsRemaining<=0||setTimeout(function(){t._currentAttempt.cancelled||(t._currentAttempt=new aR(t.avoidEval,t._successCallback,r),t._currentAttempt.start())},3e3))}),this._currentAttempt.start())}},{key:"cancel",value:function(){this._currentAttempt&&this._currentAttempt.cancel()}},{key:"cancelled",get:function(){return this._currentAttempt&&this._currentAttempt.cancelled}},{key:"succeeded",get:function(){return this._currentAttempt&&this._currentAttempt.succeeded}}]),e}(),uj=function(e){lw(r,XN(Error));var t=WIe(r);function r(){return bs(this,r),t.apply(this,arguments)}return ws(r)}(),a0=2e4,aR=function(){function e(r,n,s){bs(this,e),this._loadAttemptImpl=wt()||!r?new qIe(n,s):new GIe(n,s)}var t;return ws(e,[{key:"start",value:(t=Ue(function*(){return this._loadAttemptImpl.start()}),function(){return t.apply(this,arguments)})},{key:"cancel",value:function(){this._loadAttemptImpl.cancel()}},{key:"cancelled",get:function(){return this._loadAttemptImpl.cancelled}},{key:"succeeded",get:function(){return this._loadAttemptImpl.succeeded}}]),e}(),qIe=function(){function e(i,o){bs(this,e),this.cancelled=!1,this.succeeded=!1,this._networkTimedOut=!1,this._networkTimeout=null,this._iosCache=typeof iOSCallObjectBundleCache<"u"&&iOSCallObjectBundleCache,this._refetchHeaders=null,this._successCallback=i,this._failureCallback=o}var t,r,n,s;return ws(e,[{key:"start",value:(s=Ue(function*(){var i=Jx();!(yield this._tryLoadFromIOSCache(i))&&this._loadFromNetwork(i)}),function(){return s.apply(this,arguments)})},{key:"cancel",value:function(){clearTimeout(this._networkTimeout),this.cancelled=!0}}
983,{key:"_tryLoadFromIOSCache",value:(n=Ue(function*(i){if(!this._iosCache)return!1;try{var o=yield this._iosCache.get(i);return!!this.cancelled||!!o&&(o.code?(Function('"use strict";'+o.code)(),this.succeeded=!0,this._successCallback(),!0):(this._refetchHeaders=o.refetchHeaders,!1))}catch{return!1}}),function(i){return n.apply(this,arguments)})},{key:"_loadFromNetwork",value:(r=Ue(function*(i){var o=this;this._networkTimeout=setTimeout(function(){o._networkTimedOut=!0,o._failureCallback({msg:"Timed out (>".concat(a0," ms) when loading call object bundle ").concat(i),type:"timeout"})},a0);try{var l=this._refetchHeaders?{headers:this._refetchHeaders}:{},c=yield fetch(i,l);if(clearTimeout(this._networkTimeout),this.cancelled||this._networkTimedOut)throw new uj;var u=yield this._getBundleCodeFromResponse(i,c);if(this.cancelled)throw new uj;Function('"use strict";'+u)(),this._iosCache&&this._iosCache.set(i,u,c.headers),this.succeeded=!0,this._successCallback()}catch(h){if(clearTimeout(this._networkTimeout),h instanceof uj||this.cancelled||this._networkTimedOut)return;this._failureCallback({msg:"Failed to load call object bundle ".concat(i,": ").concat(h),type:h.message})}}),function(i){return r.apply(this,arguments)})},{key:"_getBundleCodeFromResponse",value:(t=Ue(function*(i,o){if(o.ok)return yield o.text();if(this._iosCache&&o.status===304)return(yield this._iosCache.renew(i,o.headers)).code;throw new Error("Received ".concat(o.status," response"))}),function(i,o){return t.apply(this,arguments)})}]),e}(),GIe=function(){function e(t,r){bs(this,e),this.cancelled=!1,this.succeeded=!1,this._successCallback=t,this._failureCallback=r,this._attemptId=uw(),this._networkTimeout=null,this._scriptElement=null}return ws(e,[{key:"start",value:function(){window._dailyCallMachineLoadWaitlist||(window._dailyCallMachineLoadWaitlist=new Set);var t=Jx();(typeof document>"u"?"undefined":Et(document))==="object"?this._startLoading(t):this._failureCallback({msg:"Call object bundle must be loaded in a DOM/web context",type:"missing context"})}},{key:"cancel",value:function(){this._stopLoading(),this.cancelled=!0}},{key:"_startLoading",value:function(t){var r=this;this._signUpForCallMachineLoadWaitlist(),this._networkTimeout=setTimeout(function(){r._stopLoading(),r._failureCallback({msg:"Timed out (>".concat(a0," ms) when loading call object bundle ").concat(t),type:"timeout"})},a0);var n=document.getElementsByTagName("head")[0],s=document.createElement("script");this._scriptElement=s,s.onload=function(){r._stopLoading(),r.succeeded=!0,r._successCallback()},s.onerror=function(i){r._stopLoading(),r._failureCallback({msg:"Failed to load call object bundle ".concat(i.target.src),type:i.message})},s.src=t,n.appendChild(s)}},{key:"_stopLoading",value:function(){this._withdrawFromCallMachineLoadWaitlist(),clearTimeout(this._networkTimeout),this._scriptElement&&(this._scriptElement.onload=null,this._scriptElement.onerror=null)}},{key:"_signUpForCallMachineLoadWaitlist",value:function(){window._dailyCallMachineLoadWaitlist.add(this._attemptId)}},{key:"_withdrawFromCallMachineLoadWaitlist",value:function(){window._dailyCallMachineLoadWaitlist.delete(this._attemptId)}}]),e}(),fy=function(e,t,r){return YIe(e.local,t,r)===!0},KIe=function(e,t,r){return e.local.streams&&e.local.streams[t]&&e.local.streams[t].stream&&e.local.streams[t].stream["get".concat(r==="video"?"Video":"Audio","Tracks")]()[0]},Eu=function(e,t,r,n){var s=XIe(e,t,r,n);return s&&s.pendingTrack},YIe=function(e,t,r){if(!e)return!1;var n=function(i){switch(i){case"avatar":return!0;case"staged":return i;default:return!!i}},s=e.public.subscribedTracks;return s&&s[t]?["cam-audio","cam-video","screen-video","screen-audio","rmpAudio","rmpVideo"].indexOf(r)===-1&&s[t].custom?[!0,"staged"].includes(s[t].custom)?n(s[t].custom):n(s[t].custom[r]):n(s[t][r]):!s||n(s.ALL)},XIe=function(e,t,r,n){var s=Object.values(e.streams||{}).filter(function(i){return i.participantId===t&&i.type===r&&i.pendingTrack&&i.pendingTrack.kind===n}).sort(function(i,o){return new Date(o.starttime)-new Date(i.starttime)});return s&&s[0]},QIe=function(e,t){var r=e.local.public.customTracks;
983if(r&&r[t])return r[t].track};function sR(e,t){for(var r=t.getState(),n=0,s=["cam","screen"];n<s.length;n++)for(var i=s[n],o=0,l=["video","audio"];o<l.length;o++){var c=l[o],u=i==="cam"?c:"screen".concat(c.charAt(0).toUpperCase()+c.slice(1)),h=e.tracks[u];if(h){var d=e.local?KIe(r,i,c):Eu(r,e.session_id,i,c);h.state==="playable"&&(h.track=d),h.persistentTrack=d}}}function iR(e,t){try{var r=t.getState();for(var n in e.tracks)if(!JIe(n)){var s=e.tracks[n].kind;if(s){var i=e.tracks[n];if(i){var o=e.local?QIe(r,n):Eu(r,e.session_id,n,s);i.state==="playable"&&(e.tracks[n].track=o),i.persistentTrack=o}}else console.error("unknown type for custom track")}}catch(l){console.error(l)}}function JIe(e){return["video","audio","screenVideo","screenAudio"].includes(e)}function oR(e,t,r){var n=r.getState();if(e.local){if(e.audio)try{e.audioTrack=n.local.streams.cam.stream.getAudioTracks()[0],e.audioTrack||(e.audio=!1)}catch{}if(e.video)try{e.videoTrack=n.local.streams.cam.stream.getVideoTracks()[0],e.videoTrack||(e.video=!1)}catch{}if(e.screen)try{e.screenVideoTrack=n.local.streams.screen.stream.getVideoTracks()[0],e.screenAudioTrack=n.local.streams.screen.stream.getAudioTracks()[0],e.screenVideoTrack||e.screenAudioTrack||(e.screen=!1)}catch{}}else{var s=!0;try{var i=n.participants[e.session_id];i&&i.public&&i.public.rtcType&&i.public.rtcType.impl==="peer-to-peer"&&i.private&&!["connected","completed"].includes(i.private.peeringState)&&(s=!1)}catch(h){console.error(h)}if(!s)return e.audio=!1,e.audioTrack=!1,e.video=!1,e.videoTrack=!1,e.screen=!1,void(e.screenTrack=!1);try{if(n.streams,e.audio&&fy(n,e.session_id,"cam-audio")){var o=Eu(n,e.session_id,"cam","audio");o&&(t&&t.audioTrack&&t.audioTrack.id===o.id?e.audioTrack=o:o.muted||(e.audioTrack=o)),e.audioTrack||(e.audio=!1)}if(e.video&&fy(n,e.session_id,"cam-video")){var l=Eu(n,e.session_id,"cam","video");l&&(t&&t.videoTrack&&t.videoTrack.id===l.id?e.videoTrack=l:l.muted||(e.videoTrack=l)),e.videoTrack||(e.video=!1)}if(e.screen&&fy(n,e.session_id,"screen-audio")){var c=Eu(n,e.session_id,"screen","audio");c&&(t&&t.screenAudioTrack&&t.screenAudioTrack.id===c.id?e.screenAudioTrack=c:c.muted||(e.screenAudioTrack=c))}if(e.screen&&fy(n,e.session_id,"screen-video")){var u=Eu(n,e.session_id,"screen","video");u&&(t&&t.screenVideoTrack&&t.screenVideoTrack.id===u.id?e.screenVideoTrack=u:u.muted||(e.screenVideoTrack=u))}e.screenVideoTrack||e.screenAudioTrack||(e.screen=!1)}catch(h){console.error("unexpected error matching up tracks",h)}}}function ZIe(e,t){var r=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=function(c,u){if(c){if(typeof c=="string")return lR(c,u);var h=Object.prototype.toString.call(c).slice(8,-1);if(h==="Object"&&c.constructor&&(h=c.constructor.name),h==="Map"||h==="Set")return Array.from(c);if(h==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(h))return lR(c,u)}}(e))||t){r&&(e=r);var n=0,s=function(){};return{s,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(c){throw c},f:s}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
984In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var i,o=!0,l=!1;return{s:function(){r=r.call(e)},n:function(){var c=r.next();return o=c.done,c},e:function(c){l=!0,i=c},f:function(){try{o||r.return==null||r.return()}finally{if(l)throw i}}}}function lR(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var Es=new Map,Ju=null;function eDe(e,t){var r=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=function(c,u){if(c){if(typeof c=="string")return cR(c,u);var h=Object.prototype.toString.call(c).slice(8,-1);if(h==="Object"&&c.constructor&&(h=c.constructor.name),h==="Map"||h==="Set")return Array.from(c);if(h==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(h))return cR(c,u)}}(e))||t){r&&(e=r);var n=0,s=function(){};return{s,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(c){throw c},f:s}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
985In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var i,o=!0,l=!1;return{s:function(){r=r.call(e)},n:function(){var c=r.next();return o=c.done,c},e:function(c){l=!0,i=c},f:function(){try{o||r.return==null||r.return()}finally{if(l)throw i}}}}function cR(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var Ts=new Map,Bf=null,tDe=3e3;function rDe(e){jV()?function(t){Es.has(t)||(Es.set(t,{}),navigator.mediaDevices.enumerateDevices().then(function(r){Es.has(t)&&(Es.get(t).lastDevicesString=JSON.stringify(r),Ju||(Ju=function(){var n=Ue(function*(){var s,i=yield navigator.mediaDevices.enumerateDevices(),o=ZIe(Es.keys());try{for(o.s();!(s=o.n()).done;){var l=s.value,c=JSON.stringify(i);c!==Es.get(l).lastDevicesString&&(Es.get(l).lastDevicesString=c,l(i))}}catch(u){o.e(u)}finally{o.f()}});return function(){return n.apply(this,arguments)}}(),navigator.mediaDevices.addEventListener("devicechange",Ju)))}))}(e):function(t){Ts.has(t)||(Ts.set(t,{}),navigator.mediaDevices.enumerateDevices().then(function(r){Ts.has(t)&&(Ts.get(t).lastDevicesString=JSON.stringify(r),Bf||(Bf=setInterval(Ue(function*(){var n,s=yield navigator.mediaDevices.enumerateDevices(),i=eDe(Ts.keys());try{for(i.s();!(n=i.n()).done;){var o=n.value,l=JSON.stringify(s);l!==Ts.get(o).lastDevicesString&&(Ts.get(o).lastDevicesString=l,o(s))}}catch(c){i.e(c)}finally{i.f()}}),tDe)))}))}(e)}function nDe(e){jV()?function(t){Es.has(t)&&(Es.delete(t),Es.size===0&&Ju&&(navigator.mediaDevices.removeEventListener("devicechange",Ju),Ju=null))}(e):function(t){Ts.has(t)&&(Ts.delete(t),Ts.size===0&&Bf&&(clearInterval(Bf),Bf=null))}(e)}function jV(){return wt()||navigator.mediaDevices.ondevicechange!==void 0}var aDe=new Set;function sDe(e,t){return e&&e.readyState==="live"&&!function(r,n){return r.muted&&!aDe.has(r.id)}(e)}var Ss,iDe=["videoTrack"],oDe=["result"],lDe=["preserveIframe"];function uR(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function Ge(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};
985t%2?uR(Object(r),!0).forEach(function(n){fo(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):uR(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function cDe(e){var t=function(){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}}();return function(){var r,n=ps(e);if(t){var s=ps(this).constructor;r=Reflect.construct(n,arguments,s)}else r=n.apply(this,arguments);return cw(this,r)}}function dR(e,t){var r=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=function(c,u){if(c){if(typeof c=="string")return hR(c,u);var h=Object.prototype.toString.call(c).slice(8,-1);if(h==="Object"&&c.constructor&&(h=c.constructor.name),h==="Map"||h==="Set")return Array.from(c);if(h==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(h))return hR(c,u)}}(e))||t){r&&(e=r);var n=0,s=function(){};return{s,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(c){throw c},f:s}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
986In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var i,o=!0,l=!1;return{s:function(){r=r.call(e)},n:function(){var c=r.next();return o=c.done,c},e:function(c){l=!0,i=c},f:function(){try{o||r.return==null||r.return()}finally{if(l)throw i}}}}function hR(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var fR="video",uDe="voice",mR=wt()?{data:{}}:{data:{},topology:"none"},pR={present:0,hidden:0},_V={maxBitrate:{min:1e5,max:25e5},maxFramerate:{min:1,max:30},scaleResolutionDownBy:{min:1,max:8}},dj=Object.keys(_V),gR=["state","volume","simulcastEncodings"],yR={androidInCallNotification:{title:"string",subtitle:"string",iconName:"string",disableForCustomOverride:"boolean"},disableAutoDeviceManagement:{audio:"boolean",video:"boolean"}},s0={id:{iconPath:"string",iconPathDarkMode:"string",label:"string",tooltip:"string"}},QN={id:{allow:"string",controlledBy:"'*' | 'owners' | string[]",csp:"string",iconURL:"string",label:"string",loading:"'eager' | 'lazy'",location:"'main' | 'sidebar'",name:"string",referrerPolicy:"string",sandbox:"string",src:"string",srcdoc:"string",shared:"string[] | 'owners' | boolean"}},bl={customIntegrations:{validate:PV,help:TV()},customTrayButtons:{validate:AV,help:"customTrayButtons should be a dictionary of the type ".concat(JSON.stringify(s0))},url:{validate:function(e){return typeof e=="string"},help:"url should be a string"},baseUrl:{validate:function(e){return typeof e=="string"},help:"baseUrl should be a string"},token:{validate:function(e){return typeof e=="string"},help:"token should be a string",queryString:"t"},dailyConfig:{validate:function(e,t){try{return t.validateDailyConfig(e),window._dailyConfig||(window._dailyConfig={}),window._dailyConfig.experimentalGetUserMediaConstraintsModify=e.experimentalGetUserMediaConstraintsModify,window._dailyConfig.userMediaVideoConstraints=e.userMediaVideoConstraints,window._dailyConfig.userMediaAudioConstraints=e.userMediaAudioConstraints,window._dailyConfig.callObjectBundleUrlOverride=e.callObjectBundleUrlOverride,window._dailyConfig.proxyUrl=e.proxyUrl,window._dailyConfig.iceConfig=e.iceConfig,!0}catch(r){console.error("Failed to validate dailyConfig",r)}return!1},help:"Unsupported dailyConfig. Check error logs for detailed info."},reactNativeConfig:{validate:function(e){return OV(e,yR)},help:"reactNativeConfig should look like ".concat(JSON.stringify(yR),", all fields optional")},lang:{validate:function(e){return["de","en-us","en","es","fi","fr","it","jp","ka","nl","no","pl","pt","pt-BR","ru","sv","tr","user"].includes(e)},help:"language not supported. Options are: de, en-us, en, es, fi, fr, it, jp, ka, nl, no, pl, pt, pt-BR, ru, sv, tr, user"},userName:!0,userData:{validate:function(e){try{return SV(e),!0}catch(t){return console.error(t),!1}},help:"invalid userData type provided"},startVideoOff:!0,startAudioOff:!0,activeSpeakerMode:!0,showLeaveButton:!0,showLocalVideo:!0,showParticipantsBar:!0,showFullscreenButton:!0,showUserNameChangeUI:!0,iframeStyle:!0,customLayout:!0,cssFile:!0,
986cssText:!0,bodyClass:!0,videoSource:{validate:function(e,t){return t._preloadCache.videoDeviceId=e,!0}},audioSource:{validate:function(e,t){return t._preloadCache.audioDeviceId=e,!0}},subscribeToTracksAutomatically:{validate:function(e,t){return t._preloadCache.subscribeToTracksAutomatically=e,!0}},theme:{validate:function(e){var t=["accent","accentText","background","backgroundAccent","baseText","border","mainAreaBg","mainAreaBgAccent","mainAreaText","supportiveText"],r=function(n){for(var s=0,i=Object.keys(n);s<i.length;s++){var o=i[s];if(!t.includes(o))return console.error('unsupported color "'.concat(o,'". Valid colors: ').concat(t.join(", "))),!1;if(!n[o].match(/^#[0-9a-f]{6}|#[0-9a-f]{3}$/i))return console.error("".concat(o,' theme color should be provided in valid hex color format. Received: "').concat(n[o],'"')),!1}return!0};return Et(e)==="object"&&("light"in e&&"dark"in e||"colors"in e)?"light"in e&&"dark"in e?"colors"in e.light?"colors"in e.dark?r(e.light.colors)&&r(e.dark.colors):(console.error('Dark theme is missing "colors" property.',e),!1):(console.error('Light theme is missing "colors" property.',e),!1):r(e.colors):(console.error('Theme must contain either both "light" and "dark" properties, or "colors".',e),!1)},help:"unsupported theme configuration. Check error logs for detailed info."},layoutConfig:{validate:function(e){if("grid"in e){var t=e.grid;if("maxTilesPerPage"in t){if(!Number.isInteger(t.maxTilesPerPage))return console.error("grid.maxTilesPerPage should be an integer. You passed ".concat(t.maxTilesPerPage,".")),!1;if(t.maxTilesPerPage>49)return console.error("grid.maxTilesPerPage can't be larger than 49 without sacrificing browser performance. Please contact us at https://www.daily.co/contact to talk about your use case."),!1}if("minTilesPerPage"in t){if(!Number.isInteger(t.minTilesPerPage))return console.error("grid.minTilesPerPage should be an integer. You passed ".concat(t.minTilesPerPage,".")),!1;if(t.minTilesPerPage<1)return console.error("grid.minTilesPerPage can't be lower than 1."),!1;if("maxTilesPerPage"in t&&t.minTilesPerPage>t.maxTilesPerPage)return console.error("grid.minTilesPerPage can't be higher than grid.maxTilesPerPage."),!1}}return!0},help:"unsupported layoutConfig. Check error logs for detailed info."},receiveSettings:{validate:function(e){return NV(e,{allowAllParticipantsKey:!1})},help:EV({allowAllParticipantsKey:!1})},sendSettings:{validate:function(e,t){return!!function(r,n){try{return n.validateUpdateSendSettings(r),!0}catch(s){return console.error("Failed to validate send settings",s),!1}}(e,t)&&(t._preloadCache.sendSettings=e,!0)},help:"Invalid sendSettings provided. Check error logs for detailed info."},inputSettings:{validate:function(e,t){return!!kV(e)&&(t._preloadCache.inputSettings||(t._preloadCache.inputSettings={}),CV(e),e.audio&&(t._preloadCache.inputSettings.audio=e.audio),e.video&&(t._preloadCache.inputSettings.video=e.video),!0)},help:JN()},layout:{validate:function(e){return e==="custom-v1"||e==="browser"||e==="none"},help:'layout may only be set to "custom-v1"',queryString:"layout"},emb:{queryString:"emb"},embHref:{queryString:"embHref"},dailyJsVersion:{queryString:"dailyJsVersion"},proxy:{queryString:"proxy"},strictMode:!0},my={styles:{validate:function(e){for(var t in e)if(t!=="cam"&&t!=="screen")return!1;if(e.cam){for(var r in e.cam)if(r!=="div"&&r!=="video")return!1}if(e.screen){for(var n in e.screen)if(n!=="div"&&n!=="video")return!1}return!0},help:"styles format should be a subset of: { cam: {div: {}, video: {}}, screen: {div: {}, video: {}} }"},setSubscribedTracks:{validate:function(e,t){if(t._preloadCache.subscribeToTracksAutomatically)return!1;var r=[!0,!1,"staged"];if(r.includes(e)||!wt()&&e==="avatar")return!0;var n=["audio","video","screenAudio","screenVideo","rmpAudio","rmpVideo"];return function s(i){var o=arguments.length>1&&arguments[1]!==void 0&&arguments[1];for(var l in i)if(l==="custom"){if(!r.includes(i[l])&&!s(i[l],!0))return!1}else{var c=!o&&!n.includes(l),u=!r.includes(i[l]);if(c||u)return!1}return!0}(e)},help:"setSubscribedTracks cannot be used when setSubscribeToTracksAutomatically is enabled, and should be of the form: "+"true".concat(wt()?"":" | 'avatar'"," | false | 'staged' | { [audio: true|false|'staged'], [video: true|false|'staged'], [screenAudio: true|false|'staged'], [screenVideo: true|false|'staged'] }")},setAudio:!0,setVideo:!0,setScreenShare:{validate:function(e){return e===!1},help:"setScreenShare must be false, as it's only meant for stopping remote participants' screen shares"},eject:!0,updatePermissions:{validate:function(e){for(var t=0,r=Object.entries(e);t<r.length;t++){var n=xc(r[t],2),s=n[0],i=n[1];switch(s){case"hasPresence":if(typeof i!="boolean")return!1;break;case"canSend":if(i instanceof Set||i instanceof Array){var o,l=["video","audio","screenVideo","screenAudio","customVideo","customAudio"],c=dR(i);try{for(c.s();!(o=c.n()).done;){var u=o.value;if(!l.includes(u))return!1}}catch(g){c.e(g)}finally{c.f()}}else if(typeof i!="boolean")return!1;i instanceof Array&&(e.canSend=new Set(i));break;case"canAdmin":if(i instanceof Set||i instanceof Array){var h,d=["participants","streaming","transcription"],f=dR(i);try{for(f.s();!(h=f.n()).done;){var m=h.value;if(!d.includes(m))return!1}}catch(g){f.e(g)}finally{f.f()}}else if(typeof i!="boolean")return!1;i instanceof Array&&(e.canAdmin=new Set(i));break;default:return!1}}return!0},help:"updatePermissions can take hasPresence, canSend, and canAdmin permissions. hasPresence must be a boolean. canSend can be a boolean or an Array or Set of media types (video, audio, screenVideo, screenAudio, customVideo, customAudio). canAdmin can be a boolean or an Array or Set of admin types (participants, streaming, transcription)."}};Promise.any||(Promise.any=function(){var e=Ue(function*(t){return new Promise(function(r,n){var s=[];t.forEach(function(i){return Promise.resolve(i).then(function(o){r(o)}).catch(function(o){s.push(o),s.length===t.length&&n(s)})})})});return function(t){return e.apply(this,arguments)}}());var dDe=function(e){lw(z,ji);var t,r,n,s,i,o,l,c,u,h,d,f,m,g,p,v,x,b,w,j,_,S,k,P,C,M,I,E,B,A,L,W,D,U,R,Q,K=cDe(z);function z(N){var T,$,V=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(bs(this,z),fo(oi(T=K.call(this)),"startListeningForDeviceChanges",function(){rDe(T.handleDeviceChange)}),fo(oi(T),"stopListeningForDeviceChanges",function(){nDe(T.handleDeviceChange)}),fo(oi(T),"handleDeviceChange",function(te){te=te.map(function(X){return JSON.parse(JSON.stringify(X))}),T.emit(q4,{action:q4,availableDevices:te})}),fo(oi(T),"handleNativeAppStateChange",function(){var te=Ue(function*(X){if(X==="destroyed")return console.warn("App has been destroyed before leaving the meeting. Cleaning up all the resources!"),void(yield T.destroy());var ee=X==="active";T.disableReactNativeAutoDeviceManagement("video")||(ee?T.camUnmutedBeforeLosingNativeActiveState&&T.setLocalVideo(!0):(T.camUnmutedBeforeLosingNativeActiveState=T.localVideo(),T.camUnmutedBeforeLosingNativeActiveState&&T.setLocalVideo(!1)))});return function(X){return te.apply(this,arguments)}}()),fo(oi(T),"handleNativeAudioFocusChange",function(te){T.disableReactNativeAutoDeviceManagement("audio")||(T._hasNativeAudioFocus=te,T.toggleParticipantAudioBasedOnNativeAudioFocus(),T._hasNativeAudioFocus?T.micUnmutedBeforeLosingNativeAudioFocus&&T.setLocalAudio(!0):(T.micUnmutedBeforeLosingNativeAudioFocus=T.localAudio(),T.setLocalAudio(!1)))}),fo(oi(T),"handleNativeSystemScreenCaptureStop",function(){T.stopScreenShare()}
986),T.strictMode=V.strictMode===void 0||V.strictMode,Ss){if(T._logDuplicateInstanceAttempt(),T.strictMode)throw new Error("Duplicate DailyIframe instances are not allowed")}else $=oi(T),Ss=$;if(V.dailyJsVersion=z.version(),T._iframe=N,T._callObjectMode=V.layout==="none"&&!T._iframe,T._preloadCache={subscribeToTracksAutomatically:!0,audioDeviceId:null,videoDeviceId:null,outputDeviceId:null,inputSettings:null,sendSettings:null,videoTrackForNetworkConnectivityTest:null,videoTrackForConnectionQualityTest:null},T._callObjectMode&&(window._dailyPreloadCache=T._preloadCache),V.showLocalVideo!==void 0?T._callObjectMode?console.error("showLocalVideo is not available in call object mode"):T._showLocalVideo=!!V.showLocalVideo:T._showLocalVideo=!0,V.showParticipantsBar!==void 0?T._callObjectMode?console.error("showParticipantsBar is not available in call object mode"):T._showParticipantsBar=!!V.showParticipantsBar:T._showParticipantsBar=!0,V.customIntegrations!==void 0?T._callObjectMode?console.error("customIntegrations is not available in call object mode"):T._customIntegrations=V.customIntegrations:T._customIntegrations={},V.customTrayButtons!==void 0?T._callObjectMode?console.error("customTrayButtons is not available in call object mode"):T._customTrayButtons=V.customTrayButtons:T._customTrayButtons={},V.activeSpeakerMode!==void 0?T._callObjectMode?console.error("activeSpeakerMode is not available in call object mode"):T._activeSpeakerMode=!!V.activeSpeakerMode:T._activeSpeakerMode=!1,V.receiveSettings?T._callObjectMode?T._receiveSettings=V.receiveSettings:console.error("receiveSettings is only available in call object mode"):T._receiveSettings={},T.validateProperties(V),T.properties=Ge({},V),T._preloadCache.inputSettings||(T._preloadCache.inputSettings={}),V.inputSettings&&V.inputSettings.audio&&(T._preloadCache.inputSettings.audio=V.inputSettings.audio),V.inputSettings&&V.inputSettings.video&&(T._preloadCache.inputSettings.video=V.inputSettings.video),T._callFrameId=uw(),T._callObjectLoader=T._callObjectMode?new VIe(T._callFrameId):null,T._callState=F4,T._isPreparingToJoin=!1,T._accessState={access:tj},T._meetingSessionSummary={},T._finalSummaryOfPrevSession={},T._meetingSessionState=fj(mR,T._callObjectMode),T._nativeInCallAudioMode=fR,T._participants={},T._participantCounts=pR,T._rmpPlayerState={},T._waitingParticipants={},T._network={threshold:"good",quality:100},T._activeSpeaker={},T._localAudioLevel=0,T._remoteParticipantsAudioLevel={},T._messageChannel=wt()?new BIe:new FIe,T._iframe&&(T._iframe.requestFullscreen?T._iframe.addEventListener("fullscreenchange",function(){document.fullscreenElement===T._iframe?(T.emit(nu,{action:nu}),T.sendMessageToCallMachine({action:nu})):(T.emit(au,{action:au}),T.sendMessageToCallMachine({action:au}))}):T._iframe.webkitRequestFullscreen&&T._iframe.addEventListener("webkitfullscreenchange",function(){document.webkitFullscreenElement===T._iframe?(T.emit(nu,{action:nu}),T.sendMessageToCallMachine({action:nu})):(T.emit(au,{action:au}),T.sendMessageToCallMachine({action:au}))})),wt()){var q=T.nativeUtils();q.addAudioFocusChangeListener&&q.removeAudioFocusChangeListener&&q.addAppStateChangeListener&&q.removeAppStateChangeListener&&q.addSystemScreenCaptureStopListener&&q.removeSystemScreenCaptureStopListener||console.warn("expected (add|remove)(AudioFocusChange|AppActiveStateChange|SystemScreenCaptureStop)Listener to be available in React Native"),T._hasNativeAudioFocus=!0,q.addAudioFocusChangeListener(T.handleNativeAudioFocusChange),q.addAppStateChangeListener(T.handleNativeAppStateChange),q.addSystemScreenCaptureStopListener(T.handleNativeSystemScreenCaptureStop)}return T._callObjectMode&&T.startListeningForDeviceChanges(),T._messageChannel.addListenerForMessagesFromCallMachine(T.handleMessageFromCallMachine,T._callFrameId,oi(T)),T}return ws(z,[{key:"destroy",value:(Q=Ue(function*(){var N,T;try{yield this.leave()}catch{}var $=this._iframe;if($){var V=$.parentElement;V&&V.removeChild($)}if(this._messageChannel.removeListener(this.handleMessageFromCallMachine),wt()){var q=this.nativeUtils();q.removeAudioFocusChangeListener(this.handleNativeAudioFocusChange),q.removeAppStateChangeListener(this.handleNativeAppStateChange),q.removeSystemScreenCaptureStopListener(this.handleNativeSystemScreenCaptureStop)}this._callObjectMode&&this.stopListeningForDeviceChanges(),this.resetMeetingDependentVars(),this._destroyed=!0;
vendor: 4,443 bytes, line 986
986try{this.emit("call-instance-destroyed",{action:"call-instance-destroyed"})}catch{console.log("could not emit call-instance-destroyed")}Ss=void 0,!((N=window)===null||N===void 0||(T=N._daily)===null||T===void 0)&&T.instances&&delete window._daily.instances[this._callFrameId],this.strictMode&&(this._callFrameId=void 0)}),function(){return Q.apply(this,arguments)})},{key:"isDestroyed",value:function(){return!!this._destroyed}},{key:"loadCss",value:function(N){var T=N.bodyClass,$=N.cssFile,V=N.cssText;return at(),this.sendMessageToCallMachine({action:"load-css",cssFile:this.absoluteUrl($),bodyClass:T,cssText:V}),this}},{key:"iframe",value:function(){return at(),this._iframe}},{key:"meetingState",value:function(){return this._callState}},{key:"accessState",value:function(){return Ns(this._callObjectMode,"accessState()"),this._accessState}},{key:"participants",value:function(){return this._participants}},{key:"participantCounts",value:function(){return this._participantCounts}},{key:"waitingParticipants",value:function(){return Ns(this._callObjectMode,"waitingParticipants()"),this._waitingParticipants}},{key:"validateParticipantProperties",value:function(N,T){for(var $ in T){if(!my[$])throw new Error("unrecognized updateParticipant property ".concat($));if(my[$].validate&&!my[$].validate(T[$],this,this._participants[N]))throw new Error(my[$].help)}}},{key:"updateParticipant",value:function(N,T){return this._participants.local&&this._participants.local.session_id===N&&(N="local"),N&&T&&(this.validateParticipantProperties(N,T),this.sendMessageToCallMachine({action:"update-participant",id:N,properties:T})),this}},{key:"updateParticipants",value:function(N){var T=this._participants.local&&this._participants.local.session_id;for(var $ in N)$===T&&($="local"),$&&N[$]&&this.validateParticipantProperties($,N[$]);return this.sendMessageToCallMachine({action:"update-participants",participants:N}),this}},{key:"updateWaitingParticipant",value:(R=Ue(function*(){var N=this,T=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",$=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(Ns(this._callObjectMode,"updateWaitingParticipant()"),Vt(this._callState,"updateWaitingParticipant()"),typeof T!="string"||Et($)!=="object")throw new Error("updateWaitingParticipant() must take an id string and a updates object");return new Promise(function(V,q){N.sendMessageToCallMachine({action:"daily-method-update-waiting-participant",id:T,updates:$},function(te){te.error&&q(te.error),te.id||q(new Error("unknown error in updateWaitingParticipant()")),V({id:te.id})})})}),function(){return R.apply(this,arguments)})},{key:"updateWaitingParticipants",value:(U=Ue(function*(){var N=this,T=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(Ns(this._callObjectMode,"updateWaitingParticipants()"),Vt(this._callState,"updateWaitingParticipants()"),Et(T)!=="object")throw new Error("updateWaitingParticipants() must take a mapping between ids and update objects");return new Promise(function($,V){N.sendMessageToCallMachine({action:"daily-method-update-waiting-participants",updatesById:T},function(q){q.error&&V(q.error),q.ids||V(new Error("unknown error in updateWaitingParticipants()")),$({ids:q.ids})})})}),function(){return U.apply(this,arguments)})},{key:"requestAccess",value:(D=Ue(function*(){var N=this,T=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},$=T.access,V=$===void 0?{level:z$e}:$,q=T.name,te=q===void 0?"":q;return Ns(this._callObjectMode,"requestAccess()"),Vt(this._callState,"requestAccess()"),new Promise(function(X,ee){N.sendMessageToCallMachine({action:"daily-method-request-access",access:V,name:te},function(ie){ie.error&&ee(ie.error),ie.access||ee(new Error("unknown error in requestAccess()")),X({access:ie.access,granted:ie.granted})})})}),function(){return D.apply(this,arguments)})},{key:"localAudio",value:function(){return this._participants.local?!["blocked","off"].includes(this._participants.local.tracks.audio.state):null}},{key:"localVideo",value:function(){return this._participants.local?!["blocked","off"].includes(this._participants.local.tracks.video.state):null}},{key:"setLocalAudio",value:function(N){var T=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return"forceDiscardTrack"in T&&(wt()?(console.warn("forceDiscardTrack option not supported in React Native; ignoring"),T={}):N&&(console.warn("forceDiscardTrack option only supported when calling set
986LocalAudio(false); ignoring"),T={})),this.sendMessageToCallMachine({action:"local-audio",state:N,options:T}),this}},{key:"localScreenAudio",value:function(){return this._participants.local?!["blocked","off"].includes(this._participants.local.tracks.screenAudio.state):null}},{key:"localScreenVideo",value:function(){return this._participants.local?!["blocked","off"].includes(this._participants.local.tracks.screenVideo.state):null}},{key:"updateScreenShare",value:function(N){var T,$,V,q,te,X,ee,ie;if((T=this._participants)!==null&&T!==void 0&&($=T.local)!==null&&$!==void 0&&(V=$.tracks)!==null&&V!==void 0&&(q=V.screenVideo)!==null&&q!==void 0&&q.persistentTrack||(te=this._participants)!==null&&te!==void 0&&(X=te.local)!==null&&X!==void 0&&(ee=X.tracks)!==null&&ee!==void 0&&(ie=ee.screenAudio)!==null&&ie!==void 0&&ie.persistentTrack)return this.sendMessageToCallMachine({action:"local-screen-update",options:N}),this;console.warn("There is no screen share in progress. Try calling startScreenShare first.")}},{key:"setLocalVideo",value:function(N){return this.sendMessageToCallMachine({action:"local-video",state:N}),this}},{key:"getReceiveSettings",value:(W=Ue(function*(N){var T=this,$=(arguments.length>1&&arguments[1]!==void 0?arguments[1]:{}).showInheritedValues,V=$!==void 0&&$;if(Ns(this._callObjectMode,"getReceiveSettings()"),!this._callMachineInitialized)return this._receiveSettings;switch(Et(N)){case"string":return new Promise(function(q){T.sendMessageToCallMachine({action:"get-single-participant-receive-settings",id:N,showInheritedValues:V},function(te){q(te.receiveSettings)})});case"undefined":return this._receiveSettings;default:throw new Error('first argument to getReceiveSettings() must be a participant id (or "base"), or there should be no arguments')}}),function(N){return W.apply(this,arguments)})},{key:"updateReceiveSettings",value:(L=Ue(function*(N){var T=this;if(Ns(this._callObjectMode,"updateReceiveSettings()"),!NV(N,{allowAllParticipantsKey:!0}))throw new Error(EV({allowAllParticipantsKey:!0}));return Vt(this._callState,"updateReceiveSettings()","To specify receive settings earlier, use the receiveSettings config property."),new Promise(function($){T.sendMessageToCallMachine({action:"update-receive-settings",receiveSettings:N},function(V){$({receiveSettings:V.receiveSettings})})})}),function(N){return L.apply(this,arguments)})},{key:"_prepInputSettingsToPresentToUser",value:function(N){var T,$,V,q,te,X,ee,ie;if(N){var oe={},we=((T=N.audio)===null||T===void 0||($=T.processor)===null||$===void 0?void 0:$.type)==="none"&&((V=N.audio)===null||V===void 0||(q=V.processor)===null||q===void 0?void 0:q._isDefaultWhenNone);if(N.audio&&!we){var O=Ge({},N.audio.processor);delete O._isDefaultWhenNone,oe.audio=Ge(Ge({},N.audio),{},{processor:O})}var F=((te=N.video)===null||te===void 0||(X=te.processor)===null||X===void 0?void 0:X.type)==="none"&&((ee=N.video)===null||ee===void 0||(ie=ee.processor)===null||ie===void 0?void 0:ie._isDefaultWhenNone);if(N.video&&!F){var Z=Ge({},N.video.processor);delete Z._isDefaultWhenNone,oe.video=Ge(Ge({},N.video),{},{processor:Z})}return oe}}},{key:"getInputSettings",value:function(){var N=this;return at(),new Promise(function(T){T(N._getInputSettings())})}},{key:"_getInputSettings",value:function(){var N,T,$,V,q,te,X,ee,ie={processor:{type:"none",_isDefaultWhenNone:!0}};this._inputSettings?(N=(($=this._inputSettings)===null||$===void 0?void 0:$.video)||ie,T=((V=this._inputSettings)===null||V===void 0?void 0:V.audio)||ie):(N=((q=this._preloadCache)===null||q===void 0||(te=q.inputSettings)===null||te===void 0?void 0:te.video)||ie,T=((X=this._preloadCache)===null||X===void 0||(ee=X.inputSettings)===null||ee===void 0?void 0:ee.audio)||ie);var oe={audio:T,video:N};return this._prepInputSettingsToPresentToUser(oe)}},{key:"updateInputSettings",value:(A=Ue(function*(N){var T=this;return at(),kV(N)?(N&&(this._preloadCache.inputSettings||(this._preloadCache.inputSettings={}),CV(N),N.audio&&(this._preloadCache.inputSettings.audio=N.audio),N.video&&(this._preloadCache.inputSettings.video=N.video)),N.video||N.audio?this._callObjectMode&&!this._callMachineInitialized?this._getInputSettings():new Promise(function($,V){T.sendMessageToCallMachine({action:"update-input-sett
986ings",inputSettings:N},function(q){q.error?V(q.error):$({inputSettings:T._prepInputSettingsToPresentToUser(q.inputSettings)})})}):this._getInputSettings()):(console.error(JN()),Promise.reject(JN()))}),function(N){return A.apply(this,arguments)})},{key:"setBandwidth",value:function(N){var T=N.kbs,$=N.trackConstraints;if(at(),this._callMachineInitialized)return this.sendMessageToCallMachine({action:"set-bandwidth",kbs:T,trackConstraints:$}),this}},{key:"getDailyLang",value:function(){var N=this;if(at(),this._callMachineInitialized)return new Promise(function(T){N.sendMessageToCallMachine({action:"get-daily-lang"},function($){delete $.action,delete $.callbackStamp,T($)})})}},{key:"setDailyLang",value:function(N){return at(),this.sendMessageToCallMachine({action:"set-daily-lang",lang:N}),this}},{key:"setProxyUrl",value:function(N){return this.sendMessageToCallMachine({action:"set-proxy-url",proxyUrl:N}),this}},{key:"setIceConfig",value:function(N){return this.sendMessageToCallMachine({action:"set-ice-config",iceConfig:N}),this}},{key:"meetingSessionSummary",value:function(){return[ao,so].includes(this._callState)?this._finalSummaryOfPrevSession:this._meetingSessionSummary}},{key:"getMeetingSession",value:(B=Ue(function*(){var N=this;return console.warn("getMeetingSession() is deprecated: use meetingSessionSummary(), which will return immediately"),Vt(this._callState,"getMeetingSession()"),new Promise(function(T){N.sendMessageToCallMachine({action:"get-meeting-session"},function($){delete $.action,delete $.callbackStamp,delete $.callFrameId,T($)})})}),function(){return B.apply(this,arguments)})},{key:"meetingSessionState",value:function(){return Vt(this._callState,"meetingSessionState"),this._meetingSessionState}},{key:"setMeetingSessionData",value:function(N){var T=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"replace";Ns(this._callObjectMode,"setMeetingSessionData()"),Vt(this._callState,"setMeetingSessionData");try{(function($,V){new UIe({data:$,mergeStrategy:V})})(N,T)}catch($){throw console.error($),$}try{this.sendMessageToCallMachine({action:"set-session-data",data:N,mergeStrategy:T})}catch($){throw new Error("Error setting meeting session data: ".concat($))}}},{key:"setUserName",value:function(N,T){var $=this;return this.properties.userName=N,new Promise(function(V){$.sendMessageToCallMachine({action:"set-user-name",name:N??"",thisMeetingOnly:wt()||!!T&&!!T.thisMeetingOnly},function(q){delete q.action,delete q.callbackStamp,V(q)})})}},{key:"setUserData",value:(E=Ue(function*(N){var T=this;try{SV(N)}catch($){throw console.error($),$}if(this.properties.userData=N,this._callMachineInitialized)return new Promise(function($){try{T.sendMessageToCallMachine({action:"set-user-data",userData:N},function(V){delete V.action,delete V.callbackStamp,delete V.callFrameId,$(V)})}catch(V){throw new Error("Error setting user data: ".concat(V))}})}),function(N){return E.apply(this,arguments)})},{key:"validateAudioLevelInterval",value:function(N){if(N&&(N<100||typeof N!="number"))throw new Error("The interval must be a number greater than or equal to 100 milliseconds.")}},{key:"startLocalAudioLevelObserver",value:function(N){var T=this;if(typeof AudioWorkletNode>"u"&&!wt())throw new Error("startLocalAudioLevelObserver() is not supported on this browser");if(this.validateAudioLevelInterval(N),this._callMachineInitialized)return new Promise(function($,V){T.sendMessageToCallMachine({action:"start-local-audio-level-observer",interval:N},function(q){q.error?V({error:q.error}):$()})});this._preloadCache.localAudioLevelObserver={enabled:!0,interval:N}}},{key:"stopLocalAudioLevelObserver",value:function(){this._preloadCache.localAudioLevelObserver=null,this._localAudioLevel=0,this.sendMessageToCallMachine({action:"stop-local-audio-level-observer"})}},{key:"startRemoteParticipantsAudioLevelObserver",value:function(N){var T=this;if(this.validateAudioLevelInterval(N),this._callMachineInitialized)return new Promise(function($,V){T.sendMessageToCallMachine({action:"start-remote-participants-audio-level-observer",interval:N},function(q){q.error?V({error:q.error}):$()})});this._preloadCache.remoteParticipantsAudioLevelObserver={enabled:!0,interval:N}}},{key:"stopRemoteParticipantsAudioLevelObserver",value:function(){this._preloadCache.remoteParticipantsAudioLevelObserver=null,this._remoteParticipantsAudioLevel={},this.sendMessageToCallMachine({action:"stop-remote-participants-audio-level-observer"})}},{key:"startCamera",value:(I=Ue(function*(){var N=this,T=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(Ns(this._callObjectMode,"startCamera()"),vR(this._callState,this._isPreparingToJoin,"startCamera()","Did you mean to use setLocalAudio() and/or set
986LocalVideo() instead?"),wl(this._testCallInProgress,"startCamera()"),this.needsLoad())try{yield this.load(T)}catch($){return Promise.reject($)}else{if(this._didPreAuth){if(T.url&&T.url!==this.properties.url)return console.error("url in startCamera() is different than the one used in preAuth()"),Promise.reject();if(T.token&&T.token!==this.properties.token)return console.error("token in startCamera() is different than the one used in preAuth()"),Promise.reject()}this.validateProperties(T),this.properties=Ge(Ge({},this.properties),T)}return new Promise(function($){N.sendMessageToCallMachine({action:"start-camera",properties:su(N.properties),preloadCache:su(N._preloadCache)},function(V){delete V.action,delete V.callbackStamp,$(V)})})}),function(){return I.apply(this,arguments)})},{key:"validateCustomTrack",value:function(N,T,$){if($&&$.length>50)throw new Error("Custom track `trackName` must not be more than 50 characters");if(T&&T!=="music"&&T!=="speech"&&!(T instanceof Object))throw new Error("Custom track `mode` must be either `music` | `speech` | `DailyMicAudioModeSettings` or `undefined`");if($&&["cam-audio","cam-video","screen-video","screen-audio","rmpAudio","rmpVideo","customVideoDefaults"].includes($))throw new Error("Custom track `trackName` must not match a track name already used by daily: cam-audio, cam-video, customVideoDefaults, screen-video, screen-audio, rmpAudio, rmpVideo");if(!(N instanceof MediaStreamTrack))throw new Error("Custom tracks provided must be instances of MediaStreamTrack")}},{key:"startCustomTrack",value:function(){var N=this,T=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{track,mode,trackName};return at(),Vt(this._callState,"startCustomTrack()"),this.validateCustomTrack(T.track,T.mode,T.trackName),new Promise(function($,V){window._dailyPreloadCache.customTrack=T.track,T.track=gf,N.sendMessageToCallMachine({action:"start-custom-track",properties:T},function(q){q.error?V({error:q.error}):$(q.mediaTag)})})}},{key:"stopCustomTrack",value:function(N){var T=this;return at(),Vt(this._callState,"stopCustomTrack()"),new Promise(function($){T.sendMessageToCallMachine({action:"stop-custom-track",mediaTag:N},function(V){$(V.mediaTag)})})}},{key:"setCamera",value:function(N){var T=this;return rf(),hj(this._callMachineInitialized,"setCamera()"),new Promise(function($){T.sendMessageToCallMachine({action:"set-camera",cameraDeviceId:N},function(V){$({device:V.device})})})}},{key:"setAudioDevice",value:(M=Ue(function*(N){return rf(),this.nativeUtils().setAudioDevice(N),{deviceId:yield this.nativeUtils().getAudioDevice()}}),function(N){return M.apply(this,arguments)})},{key:"cycleCamera",value:function(){var N=this;return new Promise(function(T){N.sendMessageToCallMachine({action:"cycle-camera"},function($){T({device:$.device})})})}},{key:"cycleMic",value:function(){var N=this;return at(),new Promise(function(T){N.sendMessageToCallMachine({action:"cycle-mic"},function($){T({device:$.device})})})}},{key:"getCameraFacingMode",value:function(){var N=this;return rf(),new Promise(function(T){N.sendMessageToCallMachine({action:"get-camera-facing-mode"},function($){T($.facingMode)})})}},{key:"setInputDevicesAsync",value:(C=Ue(function*(N){var T=this,$=N.audioDeviceId,V=N.videoDeviceId,q=N.audioSource,te=N.videoSource;return at(),q!==void 0&&($=q),te!==void 0&&(V=te),$&&(this._preloadCache.audioDeviceId=$),V&&(this._preloadCache.videoDeviceId=V),this._callObjectMode&&this.needsLoad()?{camera:{deviceId:this._preloadCache.videoDeviceId},mic:{deviceId:this._preloadCache.audioDeviceId},speaker:{deviceId:this._preloadCache.outputDeviceId}}:($ instanceof MediaStreamTrack&&($=gf),V instanceof MediaStreamTrack&&(V=gf),new Promise(function(X){T.sendMessageToCallMachine({action:"set-input-devices",audioDeviceId:$,videoDeviceId:V},function(ee){delete ee.action,delete ee.callbackStamp,ee.returnPreloadCache?X({camera:{deviceId:T._preloadCache.videoDeviceId},mic:{deviceId:T._preloadCache.audioDeviceId},speaker:{deviceId:T._preloadCache.outputDeviceId}}):X(ee)})}))}),function(N){return C.apply(this,arguments)})},{key:"setOutputDeviceAsync",value:(P=Ue(function*(N){var T=this,$=N.outputDeviceId;return at(),$&&(this._preloadCache.outputDeviceId=$),this._callObjectMode&&this.needsLoad()?{camera:{deviceId:this._preloadCache.videoDeviceId},mic:{deviceId:this._preloadCache.audioDeviceId},speaker:{deviceId:this._preloadCache.outputDeviceId}}:new Promise(function(V){T.sendMessageToCallMachine({action:"set-output-device",outputDeviceId:$},function(q){delete q.action,delete q.callbackStamp,q.returnPreloadCache?V({camera:{deviceId:T._preloadCache.videoDeviceId},mic:{deviceId:T._preloadCache.audioDeviceId},speaker:{deviceId:T._preloadCache.outputDeviceId}}):V(q)})})}),function(N){return P.apply(this,arguments)})},{key:"getInputDevices",value:(k=Ue(function*(){var N=this;return this._callObjectMode&&this.needsLoad()?{camera:{deviceId:this._preloadCache.videoDeviceId},mic:{deviceId:this._preloadCache.audioDeviceId},speaker:{deviceId:this._preloadCache.outputDeviceId}}:new Promise(function(T){N.sendMessageToCallMachine({action:"get-input-devices"},function($){delete $.action,delete $.callbackStamp,$.returnPreloadCache?T({camera:{deviceId:N._preloadCache.videoDeviceId},mic:{deviceId:N._preloadCache.audioDeviceId},speaker:{deviceId:N._preloadCache.outputDeviceId}}):T($)})})}),function(){return k.apply(this,arguments)})},{key:"nativeInCallAudioMode",value:function(){return rf(),this._nativeInCallAudioMode}},{key:"setNativeInCallAudioMode",value:function(N){if(rf(),[fR,uDe].includes(N)){if(N!==this._nativeInCallAudioMode)return this._nativeInCallAudioMode=N,!this.disableReactNativeAutoDeviceManagement("audio")&&Hy(this._callState,this._isPreparingToJoin)&&this.nativeUtils().setAudioMo
986de(this._nativeInCallAudioMode),this}else console.error("invalid in-call audio mode specified: ",N)}},{key:"preAuth",value:(S=Ue(function*(){var N=this,T=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(Ns(this._callObjectMode,"preAuth()"),vR(this._callState,this._isPreparingToJoin,"preAuth()"),wl(this._testCallInProgress,"preAuth()"),this.needsLoad()&&(yield this.load(T)),!T.url)throw new Error("preAuth() requires at least a url to be provided");return this.validateProperties(T),this.properties=Ge(Ge({},this.properties),T),new Promise(function($,V){N.sendMessageToCallMachine({action:"daily-method-preauth",properties:su(N.properties),preloadCache:su(N._preloadCache)},function(q){return q.error?V(q.error):q.access?(N._didPreAuth=!0,void $({access:q.access})):V(new Error("unknown error in preAuth()"))})})}),function(){return S.apply(this,arguments)})},{key:"load",value:(_=Ue(function*(N){var T=this;if(this.needsLoad()){if(this._destroyed&&(this._logUseAfterDestroy(),this.strictMode))throw new Error("Use after destroy");if(N&&(this.validateProperties(N),this.properties=Ge(Ge({},this.properties),N)),!this._callObjectMode&&!this.properties.url)throw new Error("can't load iframe meeting because url property isn't set");this._updateCallState(z4);try{this.emit(W4,{action:W4})}catch($){console.log("could not emit 'loading'",$)}return this._callObjectMode?new Promise(function($,V){var q;T._callObjectLoader.cancel();var te=Date.now();T._callObjectLoader.load(!((q=T.properties.dailyConfig)===null||q===void 0||!q.avoidEval),function(X){T._bundleLoadTime=X?"no-op":Date.now()-te,T._updateCallState(B4),X&&T.emit(rj,{action:rj}),$()},function(X,ee){if(T.emit(V4,{action:V4,error:X}),!ee){T._updateCallState(so),T.resetMeetingDependentVars();var ie={action:ij,errorMsg:X.msg,error:{type:"connection-error",msg:"Failed to load call object bundle.",details:{on:"load",sourceError:X,bundleUrl:Jx()}}};T._maybeSendToSentry(ie),T.emit(ij,ie),V(X.msg)}})}):(this._iframe.src=KW(this.assembleMeetingUrl()),new Promise(function($,V){T._loadedCallback=function(q){T._callState!==so?(T._updateCallState(B4),(T.properties.cssFile||T.properties.cssText)&&T.loadCss(T.properties),$()):V(q)}}))}}),function(N){return _.apply(this,arguments)})},{key:"join",value:(j=Ue(function*(){var N=this,T=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};wl(this._testCallInProgress,"join()");var $=!1;if(this.needsLoad()){this.updateIsPreparingToJoin(!0);try{yield this.load(T)}catch(V){return this.updateIsPreparingToJoin(!1),Promise.reject(V)}}else{if($=!(!this.properties.cssFile&&!this.properties.cssText),this._didPreAuth){if(T.url&&T.url!==this.properties.url)return console.error("url in join() is different than the one used in preAuth()"),this.updateIsPreparingToJoin(!1),Promise.reject();if(T.token&&T.token!==this.properties.token)return console.error("token in join() is different than the one used in preAuth()"),this.updateIsPreparingToJoin(!1),Promise.reject()}if(T.url&&!this._callObjectMode&&T.url&&T.url!==this.properties.url)return console.error("url in join() is different than the one used in load() (".concat(this.properties.url," -> ").concat(T.url,")")),this.updateIsPreparingToJoin(!1),Promise.reject();this.validateProperties(T),this.properties=Ge(Ge({},this.properties),T)}if(T.showLocalVideo!==void 0&&(this._callObjectMode?console.error("showLocalVideo is not available in callObject mode"):this._showLocalVideo=!!T.showLocalVideo),T.showParticipantsBar!==void 0&&(this._callObjectMode?console.error("showParticipantsBar is not available in callObject mode"):this._showParticipantsBar=!!T.showParticipantsBar),this._callState===Cu||this._callState===WN)return console.warn("already joined meeting, call leave() before joining again"),void this.updateIsPreparingToJoin(!1);this._updateCallState(WN,!1);try{this.emit(H4,{action:H4})}catch(V){console.log("could not emit 'joining-meeting'",V)}return this._preloadCache.inputSettings||(this._preloadCache.inputSettings={}),T.inputSettings&&T.inputSettings.audio&&(this._preloadCache.inputSettings.audio=T.inputSettings.audio),T.inputSettings&&T.inputSettings.video&&(this._preloadCache.inputSettings.video=T.inputSettings.video),this.sendMessageToCallMachine({action:"join-meeting",properties:su(this.properties),preloadCache:su(this._preloadCache)}),new Promise(function(V,q){N._joinedCallback=function(te,X){if(N._callState!==so){if(N._updateCallState(Cu),te)for(var ee in te){if(N._callObjectMode){var ie=N._callMachine().store;sR(te[ee],ie),iR(te[ee],ie),oR(te[ee],N._participants[ee],ie)}N._participants[ee]=Ge({},te[ee]),N.toggleParticipantAudioBasedOnNativeAudioFocus()}$&&N.loadCss(N.properties),V(te)}else q(X)}})}),function(){return j.apply(this,arguments)})},{key:"leave",value:(w=Ue(function*(){var N=this;return wl(this._testCallInProgress,"leave()"),new Promise(function(T){if(N._callState===ao||N._callState===so)T();else if(N._callObjectLoader&&!N._callObjectLoader.loaded){N._callObjectLoader.cancel(),N._updateCallState(ao),N.resetMeetingDependentVars();try{N.emit(ao,{action:ao})}catch($){console.log("could not emit 'left-meeting'",$)}T()}else N._resolveLeave=T,N.sendMessageToCallMachine({action:"leave-meeting"})})}),function(){return w.apply(this,arguments)})},{key:"startScreenShare",value:(b=Ue(function*(){var N=this,T=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(hj(this._callMachineInitialized,"startScreenShare()"),T.screenVideoSendSettings&&this._val
986idateVideoSendSettings("screenVideo",T.screenVideoSendSettings),T.mediaStream&&(this._preloadCache.screenMediaStream=T.mediaStream,T.mediaStream=gf),typeof DailyNativeUtils<"u"&&DailyNativeUtils.isIOS!==void 0&&DailyNativeUtils.isIOS){var $=this.nativeUtils();if(yield $.isScreenBeingCaptured())return void this.emit(sj,{action:sj,type:"screen-share-error",errorMsg:"Could not start the screen sharing. The screen is already been captured!"});$.setSystemScreenCaptureStartCallback(function(){$.setSystemScreenCaptureStartCallback(null),N.sendMessageToCallMachine({action:X4,captureOptions:T})}),$.presentSystemScreenCapturePrompt()}else this.sendMessageToCallMachine({action:X4,captureOptions:T})}),function(){return b.apply(this,arguments)})},{key:"stopScreenShare",value:function(){hj(this._callMachineInitialized,"stopScreenShare()"),this.sendMessageToCallMachine({action:"local-screen-stop"})}},{key:"startRecording",value:function(){var N=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.sendMessageToCallMachine(Ge({action:"local-recording-start"},N))}},{key:"updateRecording",value:function(N){var T=N.layout,$=T===void 0?{preset:"default"}:T,V=N.instanceId;this.sendMessageToCallMachine({action:"daily-method-update-recording",layout:$,instanceId:V})}},{key:"stopRecording",value:function(){var N=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.sendMessageToCallMachine(Ge({action:"local-recording-stop"},N))}},{key:"startLiveStreaming",value:function(){var N=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.sendMessageToCallMachine(Ge({action:"daily-method-start-live-streaming"},N))}},{key:"updateLiveStreaming",value:function(N){var T=N.layout,$=T===void 0?{preset:"default"}:T,V=N.instanceId;this.sendMessageToCallMachine({action:"daily-method-update-live-streaming",layout:$,instanceId:V})}},{key:"addLiveStreamingEndpoints",value:function(N){var T=N.endpoints,$=N.instanceId;this.sendMessageToCallMachine({action:Q4,endpointsOp:MIe,endpoints:T,instanceId:$})}},{key:"removeLiveStreamingEndpoints",value:function(N){var T=N.endpoints,$=N.instanceId;this.sendMessageToCallMachine({action:Q4,endpointsOp:RIe,endpoints:T,instanceId:$})}},{key:"stopLiveStreaming",value:function(){var N=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};
986this.sendMessageToCallMachine(Ge({action:"daily-method-stop-live-streaming"},N))}},{key:"validateDailyConfig",value:function(N){N.camSimulcastEncodings&&(console.warn("camSimulcastEncodings is deprecated. Use sendSettings, found in DailyCallOptions, to provide camera simulcast settings."),this.validateSimulcastEncodings(N.camSimulcastEncodings)),N.screenSimulcastEncodings&&console.warn("screenSimulcastEncodings is deprecated. Use sendSettings, found in DailyCallOptions, to provide screen simulcast settings."),gs().match(/Linux; Android/)&&N.noAutoDefaultDeviceChange&&console.warn("noAutoDefaultDeviceChange is not supported on Android, and will be ignored.")}},{key:"validateSimulcastEncodings",value:function(N){var T=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null,$=arguments.length>2&&arguments[2]!==void 0&&arguments[2];if(N){if(!(N instanceof Array))throw new Error("encodings must be an Array");if(!bR(N.length,1,3))throw new Error("encodings must be an Array with between 1 to ".concat(3," layers"));for(var V=0;V<N.length;V++){var q=N[V];for(var te in this._validateEncodingLayerHasValidProperties(q),q)if(dj.includes(te)){if(typeof q[te]!="number")throw new Error("".concat(te," must be a number"));if(T){var X=T[te],ee=X.min,ie=X.max;if(!bR(q[te],ee,ie))throw new Error("".concat(te," value not in range. valid range: ").concat(ee," to ").concat(ie))}}else if(!["active","scalabilityMode"].includes(te))throw new Error("Invalid key ".concat(te,", valid keys are:")+Object.values(dj));if($&&!q.hasOwnProperty("maxBitrate"))throw new Error("maxBitrate is not specified")}}}},{key:"startRemoteMediaPlayer",value:(x=Ue(function*(N){var T=this,$=N.url,V=N.settings,q=V===void 0?{state:VN.PLAY}:V;try{(function(te){if(typeof te!="string")throw new Error('url parameter must be "string" type')})($),xR(q),function(te){for(var X in te)if(!gR.includes(X))throw new Error("Invalid key ".concat(X,", valid keys are: ").concat(gR));te.simulcastEncodings&&this.validateSimulcastEncodings(te.simulcastEncodings,_V,!0)}(q)}catch(te){throw console.error("invalid argument Error: ".concat(te)),console.error(`startRemoteMediaPlayer arguments must be of the form:
987  { url: "playback url",
988  settings?:
989  {state: "play"|"pause", simulcastEncodings?: [{}] } }`),te}return new Promise(function(te,X){T.sendMessageToCallMachine({action:"daily-method-start-remote-media-player",url:$,settings:q},function(ee){ee.error?X({error:ee.error,errorMsg:ee.errorMsg}):te({session_id:ee.session_id,remoteMediaPlayerState:{state:ee.state,settings:ee.settings}})})})}),function(N){return x.apply(this,arguments)})},{key:"stopRemoteMediaPlayer",value:(v=Ue(function*(N){var T=this;if(typeof N!="string")throw new Error(" remotePlayerID must be of type string");return new Promise(function($,V){T.sendMessageToCallMachine({action:"daily-method-stop-remote-media-player",session_id:N},function(q){q.error?V({error:q.error,errorMsg:q.errorMsg}):$()})})}),function(N){return v.apply(this,arguments)})},{key:"updateRemoteMediaPlayer",value:(p=Ue(function*(N){var T=this,$=N.session_id,V=N.settings;try{xR(V)}catch(q){throw console.error("invalid argument Error: ".concat(q)),console.error(`updateRemoteMediaPlayer arguments must be of the form:
990  session_id: "participant session",
991  { settings?: {state: "play"|"pause"} }`),q}return new Promise(function(q,te){T.sendMessageToCallMachine({action:"daily-method-update-remote-media-player",session_id:$,settings:V},function(X){X.error?te({error:X.error,errorMsg:X.errorMsg}):q({session_id:X.session_id,remoteMediaPlayerState:{state:X.state,settings:X.settings}})})})}),function(N){return p.apply(this,arguments)})},{key:"startTranscription",value:function(N){this.sendMessageToCallMachine(Ge({action:"daily-method-start-transcription"},N))}},{key:"stopTranscription",value:function(){this.sendMessageToCallMachine({action:"daily-method-stop-transcription"})}},{key:"startDialOut",value:(g=Ue(function*(N){var T=this;Vt(this._callState,"startDialOut()");var $=function(V){if(V){if(!Array.isArray(V))throw new Error("Error starting dial out: audio codec must be an array");if(V.length<=0)throw new Error("Error starting dial out: audio codec array specified but empty");
991V.forEach(function(q){if(typeof q!="string")throw new Error("Error starting dial out: audio codec must be a string");if(q!=="OPUS"&&q!=="PCMU"&&q!=="PCMA"&&q!=="G722")throw new Error("Error starting dial out: audio codec must be one of OPUS, PCMU, PCMA, G722")})}};if(!N.sipUri&&!N.phoneNumber)throw new Error("Error starting dial out: either a sip uri or phone number must be provided");if(N.sipUri&&N.phoneNumber)throw new Error("Error starting dial out: only one of sip uri or phone number must be provided");if(N.sipUri){if(typeof N.sipUri!="string")throw new Error("Error starting dial out: sipUri must be a string");if(!N.sipUri.startsWith("sip:"))throw new Error("Error starting dial out: Invalid SIP URI, must start with 'sip:'");if(N.video&&typeof N.video!="boolean")throw new Error("Error starting dial out: video must be a boolean value");(function(V){if(V&&($(V.audio),V.video)){if(!Array.isArray(V.video))throw new Error("Error starting dial out: video codec must be an array");if(V.video.length<=0)throw new Error("Error starting dial out: video codec array specified but empty");V.video.forEach(function(q){if(typeof q!="string")throw new Error("Error starting dial out: video codec must be a string");if(q!=="H264"&&q!=="VP8")throw new Error("Error starting dial out: video codec must be H264 or VP8")})}})(N.codecs)}if(N.phoneNumber){if(typeof N.phoneNumber!="string")throw new Error("Error starting dial out: phoneNumber must be a string");if(!/^\+\d{1,}$/.test(N.phoneNumber))throw new Error("Error starting dial out: Invalid phone number, must be valid phone number as per E.164");N.codecs&&$(N.codecs.audio)}if(N.callerId){if(typeof N.callerId!="string")throw new Error("Error starting dial out: callerId must be a string");if(N.sipUri)throw new Error("Error starting dial out: callerId not allowed with sipUri")}if(N.displayName){if(typeof N.displayName!="string")throw new Error("Error starting dial out: displayName must be a string");if(N.displayName.length>=200)throw new Error("Error starting dial out: displayName length must be less than 200")}
991return new Promise(function(V,q){T.sendMessageToCallMachine(Ge({action:"dialout-start"},N),function(te){te.error?q(te.error):V(te)})})}),function(N){return g.apply(this,arguments)})},{key:"stopDialOut",value:function(N){var T=this;return Vt(this._callState,"stopDialOut()"),new Promise(function($,V){T.sendMessageToCallMachine(Ge({action:"dialout-stop"},N),function(q){q.error?V(q.error):$(q)})})}},{key:"sendDTMF",value:(m=Ue(function*(N){var T=this;return Vt(this._callState,"sendDTMF()"),function($){var V=$.sessionId,q=$.tones;if(!V||!q)throw new Error("sessionId and tones are mandatory parameter");if(typeof V!="string"||typeof q!="string")throw new Error("sessionId and tones should be of string type");if(q.length>20)throw new Error("tones string must be upto 20 characters");var te=/[^0-9A-D*#]/g,X=q.match(te);if(X&&X[0])throw new Error("".concat(X[0]," is not valid DTMF tone"))}(N),new Promise(function($,V){T.sendMessageToCallMachine(Ge({action:"send-dtmf"},N),function(q){q.error?V(q.error):$(q)})})}),function(N){return m.apply(this,arguments)})},{key:"getNetworkStats",value:function(){var N=this;return this._callState!==Cu?{stats:{latest:{}}}:new Promise(function(T){N.sendMessageToCallMachine({action:"get-calc-stats"},function($){T(Ge({stats:$.stats},N._network))})})}},{key:"testWebsocketConnectivity",value:(f=Ue(function*(){var N=this;if(wl(this._testCallInProgress,"testWebsocketConnectivity()"),this.needsLoad())try{yield this.load()}catch(T){return Promise.reject(T)}return new Promise(function(T,$){N.sendMessageToCallMachine({action:"test-websocket-connectivity"},function(V){V.error?$(V.error):T(V.results)})})}),function(){return f.apply(this,arguments)})},{key:"abortTestWebsocketConnectivity",value:function(){this.sendMessageToCallMachine({action:"abort-test-websocket-connectivity"})}},{key:"_validateVideoTrackForNetworkTests",value:function(N){return N?N instanceof MediaStreamTrack?!!sDe(N)||(console.error("Video track is not playable. This test needs a live video track."),!1):(console.error("Video track needs to be of type `MediaStreamTrack`."),!1):(console.error("Missing video track. You must provide a video track in order to run this test."),!1)}},{key:"testCallQuality",value:(d=Ue(function*(N){var T=this;if(function(ee){var ie=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"This daily-js method",oe=arguments.length>2?arguments[2]:void 0;if(ee){var we="".concat(ie," can not be called after preAuth(), startCamera(), or join() and call state has been initialized.");throw oe&&(we+=" ".concat(oe)),console.error(we),new Error(we)}}(this._callMachineInitialized,"testCallQuality()"),N.videoTrack&&!this._validateVideoTrackForNetworkTests(N.videoTrack))throw new Error("Video track error");var $=this._testCallAlreadyInProgress,V=function(ee){$||(T._testCallInProgress=ee)};V(!0);var q=N.videoTrack,te=Y1(N,iDe);if(this._preloadCache.videoTrackForConnectionQualityTest=q,this.needsLoad())try{var X=this._callState;yield this.load(),this._callState=X}catch(ee){return V(!1),Promise.reject(ee)}return new Promise(function(ee){T.sendMessageToCallMachine(Ge(Ge({action:"test-call-quality"},te),{},{dailyJsVersion:T.properties.dailyJsVersion}),function(ie){var oe=ie.results,we=oe.result,O=Y1(oe,oDe);if(we==="failed"){var F,Z=Ge({},O);(F=O.error)!==null&&F!==void 0&&F.details?(O.error.details=JSON.parse(O.error.details),Z.error=Ge(Ge({},Z.error),{},{details:Ge({},Z.error.details)}),Z.error.details.duringTest="testCallQuality"):(Z.error=Z.error?Ge({},Z.error):{},Z.error.details={duringTest:"testCallQuality"}),T._maybeSendToSentry(Z)}V(!1),ee(Ge({result:we},O))})})}),function(N){return d.apply(this,arguments)})},{key:"stopTestCallQuality",value:function(){this.sendMessageToCallMachine({action:"stop-test-call-quality"})}},{key:"testConnectionQuality",value:(h=Ue(function*(N){console.warn("testConnectionQuality() is deprecated: use testPeerToPeerCallQuality() instead");var T=yield this.testPeerToPeerCallQuality(N),$={result:T.result,secondsElapsed:T.secondsElapsed};return T.data&&($.data={maxRTT:T.data.maxRoundTripTime,packetLoss:T.data.avgRecvPacketLoss}),$}),function(N){return h.apply(this,arguments)})},{key:"testPeerToPeerCallQuality",value:(u=Ue(function*(N){var T=this;if(wl(this._testCallInProgress,"testConnectionQuality()"),this.needsLoad())try{yield this.load()}catch(q){return Promise.reject(q)}var $=N.videoTrack,V=N.duration;
991if(!this._validateVideoTrackForNetworkTests($))throw new Error("Video track error");return this._preloadCache.videoTrackForConnectionQualityTest=$,new Promise(function(q,te){T.sendMessageToCallMachine({action:"test-p2p-call-quality",duration:V},function(X){X.error?te(X.error):q(X.results)})})}),function(N){return u.apply(this,arguments)})},{key:"stopTestConnectionQuality",value:function(){console.warn("stopTestConnectionQuality() is deprecated: use stopTestPeerToPeerCallQuality() instead"),this.stopTestPeerToPeerCallQuality()}},{key:"stopTestPeerToPeerCallQuality",value:function(){this.sendMessageToCallMachine({action:"stop-test-p2p-call-quality"})}},{key:"testNetworkConnectivity",value:(c=Ue(function*(N){var T=this;if(wl(this._testCallInProgress,"testNetworkConnectivity()"),this.needsLoad())try{yield this.load()}catch($){return Promise.reject($)}if(!this._validateVideoTrackForNetworkTests(N))throw new Error("Video track error");return this._preloadCache.videoTrackForNetworkConnectivityTest=N,new Promise(function($,V){T.sendMessageToCallMachine({action:"test-network-connectivity"},function(q){q.error?V(q.error):$(q.results)})})}),function(N){return c.apply(this,arguments)})},{key:"abortTestNetworkConnectivity",value:function(){this.sendMessageToCallMachine({action:"abort-test-network-connectivity"})}},{key:"getCpuLoadStats",value:function(){var N=this;return new Promise(function(T,$){N._callState===Cu?N.sendMessageToCallMachine({action:"get-cpu-load-stats"},function(V){T(V.cpuStats)}):T({cpuLoadState:void 0,cpuLoadStateReason:void 0,stats:{}})})}},{key:"_validateEncodingLayerHasValidProperties",value:function(N){var T;if(!(((T=Object.keys(N))===null||T===void 0?void 0:T.length)>0))throw new Error("Empty encoding is not allowed. At least one of these valid keys should be specified:"+Object.values(dj))}},{key:"_validateVideoSendSettings",value:function(N,T){var $=N==="screenVideo"?["default-screen-video","detail-optimized","motion-optimized","motion-and-detail-balanced"]:["default-video","bandwidth-optimized","bandwidth-and-quality-balanced","quality-optimized","adaptive-2-layers","adaptive-3-layers"],V="Video send settings should be either an object or one of the supported presets: ".concat($.join());if(typeof T=="string"){if(!$.includes(T))throw new Error(V)}else{if(Et(T)!=="object")throw new Error(V);if(!T.maxQuality&&!T.encodings&&T.allowAdaptiveLayers===void 0)throw new Error("Video send settings must contain at least maxQuality, allowAdaptiveLayers or encodings attribute");if(T.maxQuality&&["low","medium","high"].indexOf(T.maxQuality)===-1)throw new Error("maxQuality must be either low, medium or high");if(T.encodings){var q=!1;switch(Object.keys(T.encodings).length){case 1:q=!T.encodings.low;break;case 2:q=!T.encodings.low||!T.encodings.medium;break;case 3:q=!T.encodings.low||!T.encodings.medium||!T.encodings.high;break;default:q=!0}if(q)throw new Error("Encodings must be defined as: low, low and medium, or low, medium and high.");T.encodings.low&&this._validateEncodingLayerHasValidProperties(T.encodings.low),T.encodings.medium&&this._validateEncodingLayerHasValidProperties(T.encodings.medium),T.encodings.high&&this._validateEncodingLayerHasValidProperties(T.encodings.high)}}}},{key:"validateUpdateSendSettings",value:function(N){var T=this;if(!N||Object.keys(N).length===0)throw new Error("Send settings must contain at least information for one track!");
991Object.entries(N).forEach(function($){var V=xc($,2),q=V[0],te=V[1];T._validateVideoSendSettings(q,te)})}},{key:"updateSendSettings",value:function(N){var T=this;return this.validateUpdateSendSettings(N),this.needsLoad()?(this._preloadCache.sendSettings=N,{sendSettings:this._preloadCache.sendSettings}):new Promise(function($,V){T.sendMessageToCallMachine({action:"update-send-settings",sendSettings:N},function(q){q.error?V(q.error):$(q.sendSettings)})})}},{key:"getSendSettings",value:function(){return this._sendSettings||this._preloadCache.sendSettings}},{key:"getLocalAudioLevel",value:function(){return this._localAudioLevel}},{key:"getRemoteParticipantsAudioLevel",value:function(){return this._remoteParticipantsAudioLevel}},{key:"getActiveSpeaker",value:function(){return at(),this._activeSpeaker}},{key:"setActiveSpeakerMode",value:function(N){return at(),this.sendMessageToCallMachine({action:"set-active-speaker-mode",enabled:N}),this}},{key:"activeSpeakerMode",value:function(){return at(),this._activeSpeakerMode}},{key:"subscribeToTracksAutomatically",value:function(){return this._preloadCache.subscribeToTracksAutomatically}},{key:"setSubscribeToTracksAutomatically",value:function(N){return Vt(this._callState,"setSubscribeToTracksAutomatically()","Use the subscribeToTracksAutomatically configuration property."),this._preloadCache.subscribeToTracksAutomatically=N,this.sendMessageToCallMachine({action:"daily-method-subscribe-to-tracks-automatically",enabled:N}),this}},{key:"enumerateDevices",value:(l=Ue(function*(){var N=this;if(this._callObjectMode){var T=yield navigator.mediaDevices.enumerateDevices();return _c()==="Firefox"&&qN().major>115&&qN().major<123&&(T=T.filter(function($){return $.kind!=="audiooutput"})),{devices:T.map(function($){return JSON.parse(JSON.stringify($))})}}return new Promise(function($){N.sendMessageToCallMachine({action:"enumerate-devices"},function(V){$({devices:V.devices})})})}),function(){return l.apply(this,arguments)})},{key:"sendAppMessage",value:function(N){var T=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"*";if(Vt(this._callState,"sendAppMessage()"),JSON.stringify(N).length>4096)throw new Error("Message data too large. Max size is 4096");return this.sendMessageToCallMachine({action:"app-msg",data:N,to:T}),this}},{key:"addFakeParticipant",value:function(N){return at(),Vt(this._callState,"addFakeParticipant()"),this.sendMessageToCallMachine(Ge({action:"add-fake-participant"},N)),this}},{key:"setShowNamesMode",value:function(N){return $n(this._callObjectMode,"setShowNamesMode()"),at(),N&&N!=="always"&&N!=="never"?(console.error('setShowNamesMode argument should be "always", "never", or false'),this):(this.sendMessageToCallMachine({action:"set-show-names",mode:N}),this)}},{key:"setShowLocalVideo",value:function(){var N=!(arguments.length>0&&arguments[0]!==void 0)||arguments[0];return $n(this._callObjectMode,"setShowLocalVideo()"),at(),Vt(this._callState,"setShowLocalVideo()"),typeof N!="boolean"?(console.error("setShowLocalVideo only accepts a boolean value"),this):(this.sendMessageToCallMachine({action:"set-show-local-video",show:N}),this._showLocalVideo=N,this)}},{key:"showLocalVideo",value:function(){return $n(this._callObjectMode,"showLocalVideo()"),at(),this._showLocalVideo}},{key:"setShowParticipantsBar",value:function(){var N=!(arguments.length>0&&arguments[0]!==void 0)||arguments[0];return $n(this._callObjectMode,"setShowParticipantsBar()"),at(),Vt(this._callState,"setShowParticipantsBar()"),typeof N!="boolean"?(console.error("setShowParticipantsBar only accepts a boolean value"),this):(this.sendMessageToCallMachine({action:"set-show-participants-bar",show:N}),this._showParticipantsBar=N,this)}},{key:"showParticipantsBar",value:function(){return $n(this._callObjectMode,"showParticipantsBar()"),at(),this._showParticipantsBar}},{key:"customIntegrations",value:function(){return at(),$n(this._callObjectMode,"customIntegrations()"),this._customIntegrations}},{key:"setCustomIntegrations",value:function(N){return at(),$n(this._callObjectMode,"setCustomIntegrations()"),Vt(this._callState,"setCustomIntegrations()"),PV(N)?(this.sendMessageToCallMachine({action:"set-custom-integrations",integrations:N}),this._customIntegrations=N,this):this}},{key:"startCustomIntegrations",value:function(N){var T=this;if(at(),$n(this._callObjectMode,"startCustomIntegrations()"),Vt(this._callState,"startCustomIntegrations()"),Array.isArray(N)&&N.some(function(q){return typeof q!="string"}
991)||!Array.isArray(N)&&typeof N!="string")return console.error("startCustomIntegrations() only accepts string | string[]"),this;var $=typeof N=="string"?[N]:N,V=$.filter(function(q){return!(q in T._customIntegrations)});return V.length?(console.error(`Can't find custom integration(s): "`.concat(V.join(", "),'"')),this):(this.sendMessageToCallMachine({action:"start-custom-integrations",ids:$}),this)}},{key:"stopCustomIntegrations",value:function(N){var T=this;if(at(),$n(this._callObjectMode,"stopCustomIntegrations()"),Vt(this._callState,"stopCustomIntegrations()"),Array.isArray(N)&&N.some(function(q){return typeof q!="string"})||!Array.isArray(N)&&typeof N!="string")return console.error("stopCustomIntegrations() only accepts string | string[]"),this;var $=typeof N=="string"?[N]:N,V=$.filter(function(q){return!(q in T._customIntegrations)});return V.length?(console.error(`Can't find custom integration(s): "`.concat(V.join(", "),'"')),this):(this.sendMessageToCallMachine({action:"stop-custom-integrations",ids:$}),this)}},{key:"customTrayButtons",value:function(){return $n(this._callObjectMode,"customTrayButtons()"),at(),this._customTrayButtons}},{key:"updateCustomTrayButtons",value:function(N){return $n(this._callObjectMode,"updateCustomTrayButtons()"),at(),Vt(this._callState,"updateCustomTrayButtons()"),AV(N)?(this.sendMessageToCallMachine({action:"update-custom-tray-buttons",btns:N}),this._customTrayButtons=N,this):(console.error("updateCustomTrayButtons only accepts a dictionary of the type ".concat(JSON.stringify(s0))),this)}},{key:"theme",value:function(){return $n(this._callObjectMode,"theme()"),this.properties.theme}},{key:"setTheme",value:function(N){var T=this;return $n(this._callObjectMode,"setTheme()"),new Promise(function($,V){try{T.validateProperties({theme:N}),T.properties.theme=Ge({},N),T.sendMessageToCallMachine({action:"set-theme",theme:T.properties.theme});try{T.emit(U4,{action:U4,theme:T.properties.theme})}catch(q){console.log("could not emit 'theme-updated'",q)}$(T.properties.theme)}catch(q){V(q)}})}},{key:"requestFullscreen",value:(o=Ue(function*(){if(at(),this._iframe&&!document.fullscreenElement&&Z4())try{(yield this._iframe.requestFullscreen)?this._iframe.requestFullscreen():this._iframe.webkitRequestFullscreen()}catch(N){console.log("could not make video call fullscreen",N)}}),function(){return o.apply(this,arguments)})},{key:"exitFullscreen",value:function(){at(),document.fullscreenElement?document.exitFullscreen():document.webkitFullscreenElement&&document.webkitExitFullscreen()}},{key:"getSidebarView",value:(i=Ue(function*(){var N=this;return this._callObjectMode?(console.error("getSidebarView is not available in callObject mode"),Promise.resolve(null)):new Promise(function(T){N.sendMessageToCallMachine({action:"get-sidebar-view"},function($){T($.view)})})}),function(){return i.apply(this,arguments)})},{key:"setSidebarView",value:function(N){return this._callObjectMode?(console.error("setSidebarView is not available in callObject mode"),this):(this.sendMessageToCallMachine({action:"set-sidebar-view",view:N}),this)}},{key:"room",value:(s=Ue(function*(){var N=this,T=(arguments.length>0&&arguments[0]!==void 0?arguments[0]:{}).includeRoomConfigDefaults,$=T===void 0||T;return this._accessState.access===tj||this.needsLoad()?this.properties.url?{roomUrlPendingJoin:this.properties.url}:null:new Promise(function(V){N.sendMessageToCallMachine({action:"lib-room-info",includeRoomConfigDefaults:$},function(q){delete q.action,delete q.callbackStamp,V(q)})})}),function(){return s.apply(this,arguments)})},{key:"geo",value:(n=Ue(function*(){try{var N=yield fetch("https://gs.daily.co/_ks_/x-swsl/:");return{current:(yield N.json()).geo}}catch(T){return console.error("geo lookup failed",T),{current:""}}}),function(){return n.apply(this,arguments)})},{key:"setNetworkTopology",value:(r=Ue(function*(N){var T=this;return at(),Vt(this._callState,"setNetworkTopology()"),new Promise(function($,V){T.sendMessageToCallMachine({action:"set-network-topology",opts:N},function(q){q.error?V({error:q.error}):$({workerId:q.workerId})})})}),function(N){return r.apply(this,arguments)})},{key:"getNetworkTopology",value:(t=Ue(function*(){var N=this;return new Promise(function(T,$){N.needsLoad()&&T({topology:"none"}),N.sendMessageToCallMachine({action:"get-network-topology"},function(V){V.error?$({error:V.error}):T({topology:V.topology})})})}),function(){return t.apply(this,arguments)})},{key:"setPlayNewParticipantSound",value:function(N){if(at(),typeof N!="number"&&N!==!0&&N!==!1)throw new Error("argument to setShouldPlayNewParticipantSound should be true, false, or a number, but is ".concat(N));this.sendMessageToCallMachine({action:"daily-method-set-play-ding",arg:N})}},{key:"on",value:function(N,T){return ji.prototype.on.call(this,N,T)}},{key:"once",value:function(N,T){return ji.prototype.once.call(this,N,T)}},{key:"off",value:function(N,T){return ji.prototype.off.call(this,N,T)}},{key:"validateProperties",value:function(N){for(var T in N){if(!bl[T])throw new Error("unrecognized property '".concat(T,"'"));if(bl[T].validate&&!bl[T].validate(N[T],this))throw new Error("property '".concat(T,"': ").concat(bl[T].help))}}},{key:"assembleMeetingUrl",value:function(){var N,T,$=Ge(Ge({},this.properties),{},{emb:this._callFrameId,embHref:encodeURIComponent(window.location.href),proxy:(N=window._dailyConfig)!==null&&N!==void 0&&N.proxyUrl?encodeURIComponent((T=window._dailyConfig)===null||T===void 0?void 0:T.proxyUrl):void 0}),V=$.url.match(/\?/)?"&":"?";return $.url+V+Object.keys(bl).filter(function(q){return bl[q].queryString&&$[q]!==void 0}
991).map(function(q){return"".concat(bl[q].queryString,"=").concat($[q])}).join("&")}},{key:"needsLoad",value:function(){return[F4,z4,ao,so].includes(this._callState)}},{key:"sendMessageToCallMachine",value:function(N,T){if(this._destroyed&&(this._logUseAfterDestroy(),this.strictMode))throw new Error("Use after destroy");this._messageChannel.sendMessageToCallMachine(N,T,this._iframe,this._callFrameId)}},{key:"forwardPackagedMessageToCallMachine",value:function(N){this._messageChannel.forwardPackagedMessageToCallMachine(N,this._iframe,this._callFrameId)}},{key:"addListenerForPackagedMessagesFromCallMachine",value:function(N){return this._messageChannel.addListenerForPackagedMessagesFromCallMachine(N,this._callFrameId)}},{key:"removeListenerForPackagedMessagesFromCallMachine",value:function(N){this._messageChannel.removeListenerForPackagedMessagesFromCallMachine(N)}},{key:"handleMessageFromCallMachine",value:function(N){switch(N.action){case W$e:this.sendMessageToCallMachine(Ge({action:V$e},this.properties));break;case"call-machine-initialized":this._callMachineInitialized=!0;var T={action:tf,level:"log",code:1011,stats:{event:"bundle load",time:this._bundleLoadTime==="no-op"?0:this._bundleLoadTime,preLoaded:this._bundleLoadTime==="no-op",url:Jx()}};this.sendMessageToCallMachine(T),this._delayDuplicateInstanceLog&&this._logDuplicateInstanceAttempt();break;case rj:this._loadedCallback&&(this._loadedCallback(),this._loadedCallback=null);try{this.emit(N.action,N)}catch(ae){console.log("could not emit",N,ae)}break;case G$e:this._joinedCallback&&(this._joinedCallback(N.participants),this._joinedCallback=null);try{this.emit(N.action,N)}catch(ae){console.log("could not emit",N,ae)}break;case Y$e:case X$e:if(this._callState===ao)return;if(N.participant&&N.participant.session_id){var $=N.participant.local?"local":N.participant.session_id;if(this._callObjectMode){var V=this._callMachine().store;sR(N.participant,V),iR(N.participant,V),oR(N.participant,this._participants[$],V)}try{this.maybeParticipantTracksStopped(this._participants[$],N.participant),this.maybeParticipantTracksStarted(this._participants[$],N.participant),this.maybeEventRecordingStopped(this._participants[$],N.participant),this.maybeEventRecordingStarted(this._participants[$],N.participant)}catch(ae){console.error("track events error",ae)}if(!this.compareEqualForParticipantUpdateEvent(N.participant,this._participants[$])){this._participants[$]=Ge({},N.participant),this.toggleParticipantAudioBasedOnNativeAudioFocus();try{this.emit(N.action,N)}catch(ae){console.log("could not emit",N,ae)}}}break;case Q$e:if(N.participant&&N.participant.session_id){var q=this._participants[N.participant.session_id];q&&this.maybeParticipantTracksStopped(q,null),delete this._participants[N.participant.session_id];try{this.emit(N.action,N)}catch(ae){console.log("could not emit",N,ae)}}break;case J$e:if(!bn(this._participantCounts,N.participantCounts)){this._participantCounts=N.participantCounts;try{this.emit(N.action,N)}catch(ae){console.log("could not emit",N,ae)}}break;case Z$e:var te={access:N.access};if(N.awaitingAccess&&(te.awaitingAccess=N.awaitingAccess),!bn(this._accessState,te)){this._accessState=te;try{this.emit(N.action,N)}catch(ae){console.log("could not emit",N,ae)}}break;case eIe:if(N.meetingSession){this._meetingSessionSummary=N.meetingSession;try{delete N.callFrameId,this.emit(N.action,N);var X=Ge(Ge({},N),{},{action:"meeting-session-updated"});this.emit(X.action,X)}catch(ae){console.log("could not emit",N,ae)}}break;case ij:var ee;this._iframe&&!N.preserveIframe&&(this._iframe.src=""),this._updateCallState(so),this.resetMeetingDependentVars(),this._loadedCallback&&(this._loadedCallback(N.errorMsg),this._loadedCallback=null),N.preserveIframe;var ie=Y1(N,lDe);ie!=null&&(ee=ie.error)!==null&&ee!==void 0&&ee.details&&(ie.error.details=JSON.parse(ie.error.details)),this._maybeSendToSentry(N),this._joinedCallback&&(this._joinedCallback(null,ie),this._joinedCallback=null);try{this.emit(N.action,ie)}catch(ae){console.log("could not emit",N,ae)}break;case K$e:this._callState!==so&&this._updateCallState(ao),this.resetMeetingDependentVars(),this._resolveLeave&&(this._resolveLeave(),this._resolveLeave=null);
991try{this.emit(N.action,N)}catch(ae){console.log("could not emit",N,ae)}break;case"selected-devices-updated":if(N.devices)try{this.emit(N.action,N)}catch(ae){console.log("could not emit",N,ae)}break;case jIe:var oe=N.threshold,we=N.quality;if(oe!==this._network.threshold||we!==this._network.quality){this._network.quality=we,this._network.threshold=oe;try{this.emit(N.action,N)}catch(ae){console.log("could not emit",N,ae)}}break;case SIe:if(N&&N.cpuLoadState)try{this.emit(N.action,N)}catch(ae){console.log("could not emit",N,ae)}break;case NIe:if(N&&N.faceCounts!==void 0)try{this.emit(N.action,N)}catch(ae){console.log("could not emit",N,ae)}break;case bIe:var O=N.activeSpeaker;if(this._activeSpeaker.peerId!==O.peerId){this._activeSpeaker.peerId=O.peerId;try{this.emit(N.action,{action:N.action,activeSpeaker:this._activeSpeaker})}catch(ae){console.log("could not emit",N,ae)}}break;case"show-local-video-changed":if(this._callObjectMode)return;var F=N.show;this._showLocalVideo=F;try{this.emit(N.action,{action:N.action,show:F})}catch(ae){console.log("could not emit",N,ae)}break;case wIe:var Z=N.enabled;if(this._activeSpeakerMode!==Z){this._activeSpeakerMode=Z;try{this.emit(N.action,{action:N.action,enabled:this._activeSpeakerMode})}catch(ae){console.log("could not emit",N,ae)}}break;case rIe:case nIe:case aIe:this._waitingParticipants=N.allWaitingParticipants;try{this.emit(N.action,{action:N.action,participant:N.participant})}catch(ae){console.log("could not emit",N,ae)}break;case PIe:if(!bn(this._receiveSettings,N.receiveSettings)){this._receiveSettings=N.receiveSettings;try{this.emit(N.action,{action:N.action,receiveSettings:N.receiveSettings})}catch(ae){console.log("could not emit",N,ae)}}break;case OIe:if(!bn(this._inputSettings,N.inputSettings)){var H=this._getInputSettings();if(this._inputSettings=N.inputSettings,this._preloadCache.inputSettings={},!bn(H,this._getInputSettings()))try{this.emit(N.action,{action:N.action,inputSettings:this._getInputSettings()})}catch(ae){console.log("could not emit",N,ae)}}break;case"send-settings-updated":if(!bn(this._sendSettings,N.sendSettings)){this._sendSettings=N.sendSettings,this._preloadCache.sendSettings=null;try{this.emit(N.action,{action:N.action,sendSettings:N.sendSettings})}catch(ae){console.log("could not emit",N,ae)}}break;case"local-audio-level":this._localAudioLevel=N.audioLevel,this._preloadCache.localAudioLevelObserver=null,this.emitDailyJSEvent(N);break;case"remote-participants-audio-level":this._remoteParticipantsAudioLevel=N.participantsAudioLevel,this._preloadCache.remoteParticipantsAudioLevelObserver=null,this.emitDailyJSEvent(N);break;case mIe:var G=N.session_id;this._rmpPlayerState[G]=N.playerState,this.emitDailyJSEvent(N);break;case gIe:delete this._rmpPlayerState[N.session_id],this.emitDailyJSEvent(N);break;case pIe:var re=N.session_id,le=this._rmpPlayerState[re];le&&this.compareEqualForRMPUpdateEvent(le,N.remoteMediaPlayerState)||(this._rmpPlayerState[re]=N.remoteMediaPlayerState,this.emitDailyJSEvent(N));break;case"custom-button-click":case"sidebar-view-changed":this.emitDailyJSEvent(N);break;case tIe:var ce=this._meetingSessionState.topology!==(N.meetingSessionState&&N.meetingSessionState.topology);this._meetingSessionState=fj(N.meetingSessionState,this._callObjectMode),(this._callObjectMode||ce)&&this.emitDailyJSEvent(N);break;case nj:case aj:case lIe:case cIe:case uIe:case sIe:case iIe:case oIe:case H$e:case q$e:case hIe:case fIe:case yIe:case vIe:case xIe:case _Ie:case dIe:case kIe:case CIe:case EIe:case TIe:case sj:case AIe:case"dialin-connected":case"dialin-error":case"dialin-stopped":case"dialin-warning":case"dialout-connected":case"dialout-error":case"dialout-stopped":case"dialout-warning":try{this.emit(N.action,N)}catch(ae){console.log("could not emit",N,ae)}break;case"request-fullscreen":this.requestFullscreen();break;case"request-exit-fullscreen":this.exitFullscreen()}}},{key:"maybeEventRecordingStopped",value:function(N,T){var $="record";if(N&&!T.local&&T[$]===!1&&N[$]!==T[$])try{this.emit(aj,{action:aj})}catch(V){console.log("could not emit",V)}}},{key:"maybeEventRecordingStarted",value:function(N,T){var $="record";
991if(N&&!T.local&&T[$]===!0&&N[$]!==T[$])try{this.emit(nj,{action:nj})}catch(V){console.log("could not emit",V)}}},{key:"maybeEventTrackStopped",value:function(N,T,$,V){if(N&&(N.readyState==="ended"||!T||N.id!==T.id))try{this.emit(K4,{action:K4,track:N,participant:$,type:V})}catch(q){console.log("maybeEventTrackStopped: could not emit",q)}}},{key:"maybeEventTrackStarted",value:function(N,T,$,V){if(T&&(!N||N.readyState==="ended"||T.id!==N.id))try{this.emit(G4,{action:G4,track:T,participant:$,type:V})}catch(q){console.log("maybeEventTrackStarted: could not emit",q)}}},{key:"maybeParticipantTracksStopped",value:function(N,T){if(N)for(var $ in N.tracks)this.maybeEventTrackStopped(N.tracks[$].track,T&&T.tracks[$]?T.tracks[$].track:null,T,$)}},{key:"maybeParticipantTracksStarted",value:function(N,T){if(T)for(var $ in T.tracks)this.maybeEventTrackStarted(N&&N.tracks[$]?N.tracks[$].track:null,T.tracks[$].track,T,$)}},{key:"compareEqualForRMPUpdateEvent",value:function(N,T){var $,V;return N.state===T.state&&(($=N.settings)===null||$===void 0?void 0:$.volume)===((V=T.settings)===null||V===void 0?void 0:V.volume)}},{key:"emitDailyJSEvent",value:function(N){try{this.emit(N.action,N)}catch(T){console.log("could not emit",N,T)}}},{key:"compareEqualForParticipantUpdateEvent",value:function(N,T){return!!bn(N,T)&&(!N.videoTrack||!T.videoTrack||N.videoTrack.id===T.videoTrack.id&&N.videoTrack.muted===T.videoTrack.muted&&N.videoTrack.enabled===T.videoTrack.enabled)&&(!N.audioTrack||!T.audioTrack||N.audioTrack.id===T.audioTrack.id&&N.audioTrack.muted===T.audioTrack.muted&&N.audioTrack.enabled===T.audioTrack.enabled)}},{key:"nativeUtils",value:function(){return wt()?typeof DailyNativeUtils>"u"?(console.warn("in React Native, DailyNativeUtils is expected to be available"),null):DailyNativeUtils:null}},{key:"updateIsPreparingToJoin",value:function(N){this._updateCallState(this._callState,N)}},{key:"_updateCallState",value:function(N){var T=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this._isPreparingToJoin;if(N!==this._callState||T!==this._isPreparingToJoin){var $=this._callState,V=this._isPreparingToJoin;this._callState=N,this._isPreparingToJoin=T;var q=Hy($,V),te=Hy(this._callState,this._isPreparingToJoin);q!==te&&(this.updateKeepDeviceAwake(te),this.updateDeviceAudioMode(te),this.updateShowAndroidOngoingMeetingNotification(te),this.updateNoOpRecordingEnsuringBackgroun
vendor: 1,387 bytes, line 991
991dContinuity(te))}}},{key:"resetMeetingDependentVars",value:function(){this._participants={},this._participantCounts=pR,this._waitingParticipants={},this._activeSpeaker={},this._activeSpeakerMode=!1,this._didPreAuth=!1,this._accessState={access:tj},this._finalSummaryOfPrevSession=this._meetingSessionSummary,this._meetingSessionSummary={},this._meetingSessionState=fj(mR,this._callObjectMode),this._receiveSettings={},this._inputSettings=void 0,this._sendSettings={},this._localAudioLevel=0,this._remoteParticipantsAudioLevel={},this._callMachineInitialized=!1,this._bundleLoadTime=void 0,this._preloadCache}},{key:"updateKeepDeviceAwake",value:function(N){wt()&&this.nativeUtils().setKeepDeviceAwake(N,this._callFrameId)}},{key:"updateDeviceAudioMode",value:function(N){if(wt()&&!this.disableReactNativeAutoDeviceManagement("audio")){var T=N?this._nativeInCallAudioMode:"idle";this.nativeUtils().setAudioMode(T)}}},{key:"updateShowAndroidOngoingMeetingNotification",value:function(N){if(wt()&&this.nativeUtils().setShowOngoingMeetingNotification){var T,$,V,q;if(this.properties.reactNativeConfig&&this.properties.reactNativeConfig.androidInCallNotification){var te=this.properties.reactNativeConfig.androidInCallNotification;T=te.title,$=te.subtitle,V=te.iconName,q=te.disableForCustomOverride}q&&(N=!1),this.nativeUtils().setShowOngoingMeetingNotification(N,T,$,V,this._callFrameId)}}}
991,{key:"updateNoOpRecordingEnsuringBackgroundContinuity",value:function(N){wt()&&this.nativeUtils().enableNoOpRecordingEnsuringBackgroundContinuity&&this.nativeUtils().enableNoOpRecordingEnsuringBackgroundContinuity(N)}},{key:"toggleParticipantAudioBasedOnNativeAudioFocus",value:function(){var N,T;if(wt()){var $=(N=this._callMachine())===null||N===void 0||(T=N.store)===null||T===void 0?void 0:T.getState();for(var V in $==null?void 0:$.streams){var q=$.streams[V];q&&q.pendingTrack&&q.pendingTrack.kind==="audio"&&(q.pendingTrack.enabled=this._hasNativeAudioFocus)}}}},{key:"disableReactNativeAutoDeviceManagement",value:function(N){return this.properties.reactNativeConfig&&this.properties.reactNativeConfig.disableAutoDeviceManagement&&this.properties.reactNativeConfig.disableAutoDeviceManagement[N]}},{key:"absoluteUrl",value:function(N){if(N!==void 0){var T=document.createElement("a");return T.href=N,T.href}}},{key:"sayHello",value:function(){var N="hello, world.";return console.log(N),N}},{key:"_logCallQualityTestResults",value:function(N){if(this._callMachineInitialized){var T={action:tf,level:"info",code:1012,results:N};this.sendMessageToCallMachine(T)}else console.warn("_logCallQualityTestResults() must be called after daily initialization")}},{key:"_logUseAfterDestroy",value:function(){if(this.needsLoad())if(Ss&&!Ss.needsLoad()){var N={action:tf,level:"error",code:this.strictMode?9995:9997};Ss.sendMessageToCallMachine(N)}else this.strictMode||console.error("You are are attempting to use a call instance that was previously destroyed, which is unsupported. Please remove `strictMode: false` from your constructor properties to enable strict mode to track down and fix this unsupported usage.");else{var T={action:tf,level:"error",code:this.strictMode?9995:9997};this._messageChannel.sendMessageToCallMachine(T,null,this._iframe,this._callFrameId)}}},{key:"_logDuplicateInstanceAttempt",value:function(){var N=Ss._callMachineInitialized?Ss:this._callMachineInitialized?this:void 0;N?(N.sendMessageToCallMachine({action:tf,level:"warn",code:this.strictMode?9990:9992}),this._delayDuplicateInstanceLog=!1):(this._delayDuplicateInstanceLog=!0,Ss._delayDuplicateInstanceLog=!0)}},{key:"_maybeSendToSentry",value:function(N){var T,$,V,q,te,X;if(!((T=N.error)!==null&&T!==void 0&&T.type&&!["connection-error","end-of-life","no-room"].includes(N.error.type))){var ee=($=this.properties)!==null&&$!==void 0&&$.url?new URL(this.properties.url):void 0,ie="production";ee&&ee.host.includes(".staging.daily")&&(ie="staging");var oe,we,O,F,Z,H=new P$e({dsn:"https://[email protected]/168844",transport:O$e,integrations:[new L4.GlobalHandlers({onunhandledrejection:!1}),new L4.HttpContext],environment:ie}),G=new IE(H,void 0,z.version());if(this.session_id&&G.setExtra("sessionId",this.session_id),this.properties){var re=Ge({},this.properties);re.userName=re.userName?"[Filtered]":void 0,re.userData=re.userData?"[Filtered]":void 0,re.token=re.token?"[Filtered]":void 0,G.setExtra("properties",re)}if(ee){var le=ee.searchParams.get("domain");if(!le){var ce=ee.host.match(/(.*?)\./);le=ce&&ce[1]||""}le&&G.setTag("domain",le)}N.error&&(G.setTag("fatalErrorType",N.error.type),G.setExtra("errorDetails",N.error.details),!((oe=N.error.details)===null||oe===void 0)&&oe.uri&&G.setTag("serverAddress",N.error.details.uri),!((we=N.error.details)===null||we===void 0)&&we.workerGroup&&G.setTag("workerGroup",N.error.details.workerGroup),!((O=N.error.details)===null||O===void 0)&&O.geoGroup&&G.setTag("geoGroup",N.error.details.geoGroup),!((F=N.error.details)===null||F===void 0)&&F.on&&G.setTag("connectionAttempt",N.error.details.on),(Z=N.error.details)!==null&&Z!==void 0&&Z.bundleUrl&&(G.setTag("bundleUrl",N.error.details.bundleUrl),G.setTag("bundleError",N.error.details.sourceError.type))),G.setTags({callMode:this._callObjectMode?wt()?"reactNative":(V=this.properties)!==null&&V!==void 0&&(q=V.dailyConfig)!==null&&q!==void 0&&(te=q.callMode)!==null&&te!==void 0&&te.includes("prebuilt")?this.properties.dailyConfig.callMode:"custom":"prebuilt-frame",version:z.version()});var ae=((X=N.error)===null||X===void 0?void 0:X.msg)||N.errorMsg;G.run(function(me){me.captureException(new Error(ae))})}}},{key:"_callMachine",value:function(){var N,T,$;return(N=window._daily)===null||N===void 0||(T=N.instances)===null||T===void 0||($=T[this._callFrameId])===null||$===void 0?void 0:$.callMachine}}],[{key:"supportedBrowser",value:function(){if(wt())return{supported:!0,mobile:!0,name:"React Native",version:null,supportsScreenShare:!0,supportsSfu:!0,supportsVideoProcessing:!1,supportsAudioProcessing:!1};var N=KRe.getParser(gs());return{supported:!!eR(),mobile:N.getPlatformType()==="mobile",name:N.getBrowserName(),version:N.getBrowserVersion(),supportsFullscreen:!!Z4(),supportsScreenShare:!!$Ie(),supportsSfu:!!eR(),supportsVideoProcessing:vV(),supportsAudioProcessing:xV()}}},{key:"version",value:function(){return"0.64.0"}},{key:"createCallObject",value:function(){var N=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return N.layout="none",new z(null,N)}},{key:"wrap",value:function(N){var T=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(at(),!N||!N.contentWindow||typeof N.src!="string")throw new Error("DailyIframe::Wrap needs an iframe-like first argument");return T.layout||(T.customLayout?T.layout="custom-v1":T.layout="browser"),new z(N,T)}},{key:"createFrame",value:function(N,T){var $,V;at(),N&&T?($=N,V=T):N&&N.append?($=N,V={}):($=document.body,V=N||{});var q=V.iframeStyle;q||(q=$===document.body?{position:"fixed",border:"1px solid black",backgroundColor:"white",width:"375px",height:"450px",right:"1em",bottom:"1em"}:{border:0,width:"100%",height:"100%"});var te=document.createElement("iframe");window.navigator&&window.navigator.userAgent.match(/Chrome\/61\./)?te.allow="microphone, camera":te.allow="microphone; camera; autoplay; display-capture; screen-wake-lock",te.style.visibility="hidden",$.appendChild(te),te.style.visibility=null,Object.keys(q).forEach(function(X){return te.style[X]=q[X]}),V.layout||(V.customLayout?V.layout="custom-v1":V.layout="browser");try{return new z(te,V)}catch(X){throw $.removeChild(te),X}}},{key:"createTransparentFrame",value:function(){var N=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};at();var T=document.createElement("iframe");return T.allow="microphone; camera; autoplay",T.style.cssText=`
992      position: fixed;
993      top: 0;
994      left: 0;
995      width: 100%;
996      height: 100%;
997      border: 0;
998      pointer-events: none;
999    `,document.body.appendChild(T),N.layout||(N.layout="custom-v1"),z.wrap(T,N)}},{key:"getCallInstance",value:function(){return Ss}
999}]),z}();function su(e){var t={};for(var r in e)e[r]instanceof MediaStreamTrack?t[r]=gf:(r==="dailyConfig"&&(e[r].modifyLocalSdpHook&&(window._dailyConfig&&(window._dailyConfig.modifyLocalSdpHook=e[r].modifyLocalSdpHook),delete e[r].modifyLocalSdpHook),e[r].modifyRemoteSdpHook&&(window._dailyConfig&&(window._dailyConfig.modifyRemoteSdpHook=e[r].modifyRemoteSdpHook),delete e[r].modifyRemoteSdpHook)),t[r]=e[r]);return t}function Vt(e){var t=arguments.length>2?arguments[2]:void 0;if(e!==Cu){var r="".concat(arguments.length>1&&arguments[1]!==void 0?arguments[1]:"This daily-js method"," only supported after join.");throw t&&(r+=" ".concat(t)),console.error(r),new Error(r)}}function Hy(e,t){return[WN,Cu].includes(e)||t}function vR(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"This daily-js method",n=arguments.length>3?arguments[3]:void 0;if(Hy(e,t)){var s="".concat(r," not supported after joining a meeting.");throw n&&(s+=" ".concat(n)),console.error(s),new Error(s)}}function hj(e){var t=arguments.length>2?arguments[2]:void 0;if(!e){var r="".concat(arguments.length>1&&arguments[1]!==void 0?arguments[1]:"This daily-js method"," requires preAuth(), startCamera(), or join() to initialize call state.");throw t&&(r+=" ".concat(t)),console.error(r),new Error(r)}}function wl(e){if(e){var t="A pre-call quality test is in progress. Please try ".concat(arguments.length>1&&arguments[1]!==void 0?arguments[1]:"This daily-js method"," again once testing has completed. Use stopTestCallQuality() to end it early.");throw console.error(t),new Error(t)}}function Ns(e){if(!e){var t="".concat(arguments.length>1&&arguments[1]!==void 0?arguments[1]:"This daily-js method"," is only supported on custom callObject instances");throw console.error(t),new Error(t)}}function $n(e){if(e){var t="".concat(arguments.length>1&&arguments[1]!==void 0?arguments[1]:"This daily-js method"," is only supported as part of Daily's Prebuilt");throw console.error(t),new Error(t)}}function at(){if(wt())throw new Error("This daily-js method is not currently supported in React Native")}function rf(){if(!wt())throw new Error("This daily-js method is only supported in React Native")}function SV(e){if(e===void 0)return!0;var t;if(typeof e=="string")t=e;else try{t=JSON.stringify(e),bn(JSON.parse(t),e)||console.warn("The userData provided will be modified when serialized.")}catch(r){throw Error("userData must be serializable to JSON: ".concat(r))}if(t.length>4096)throw Error("userData is too large (".concat(t.length," characters). Maximum size suppported is ").concat(4096,"."));return!0}function NV(e,t){for(var r=t.allowAllParticipantsKey,n=function(d){var f=["local"];return r||f.push("*"),d&&!f.includes(d)},s=function(d){return!!(d.layer===void 0||Number.isInteger(d.layer)&&d.layer>=0||d.layer==="inherit")},i=function(d){return!!d&&!(d.video&&!s(d.video))&&!(d.screenVideo&&!s(d.screenVideo))},o=0,l=Object.entries(e);o<l.length;o++){var c=xc(l[o],2),u=c[0],h=c[1];if(!n(u)||!i(h))return!1}return!0}function kV(e){return Et(e)==="object"&&!(e.video&&(Et(e.video)!=="object"||!function(s){var i=["type","config"];return!s||Et(s)!=="object"||!function(o){return typeof o!="string"?!1:Object.values(Vy).includes(o)?!0:(console.error("inputSettings video processor type invalid"),!1)}(s.type)||s.config&&(Et(s.config)!=="object"||!function(o,l){var c=Object.keys(l);if(c.length===0)return!0;var u="invalid object in inputSettings -> video -> processor -> config";switch(o){case Vy.BGBLUR:return c.length>1||c[0]!=="strength"?(console.error(u),!1):!(typeof l.strength!="number"||l.strength<=0||l.strength>1||isNaN(l.strength))||(console.error("".concat(u,"; expected: {0 < strength <= 1}, got: ").concat(l.strength)),!1);case Vy.BGIMAGE:return!(l.source!==void 0&&!function(h){if(h.source==="default")return h.type="default",!0;if(h.source instanceof ArrayBuffer)return!0;if(up(h.source))return h.type="url",!!function(m){var g=new URL(m),p=g.pathname;if(g.protocol==="data:")try{var v=p.substring(p.indexOf(":")+1,p.indexOf(";")).split("/")[1];return lj.includes(v)}catch(b){return console.error("failed to deduce blob content type",b),!1}var x=p.split(".").at(-1).toLowerCase().trim();return lj.includes(x)}(h.source)||(console.error("invalid image type; supported types: [".concat(lj.join(", "),"]")),!1);return d=h.source,f=Number(d),isNaN(f)||!Number.isInteger(f)||f<=0||f>J4?(console.error("invalid image selection; must be an int, > 0, <= ".concat(J4)),!1):(h.type="daily-preselect",!0);var d,f}(l));default:return!0}}(s.type,s.config))?!1:(Object.keys(s).filter(function(o){return!i.includes(o)}
999).forEach(function(o){console.warn("invalid key inputSettings -> video -> processor : ".concat(o)),delete s[o]}),!0)}(e.video.processor)))&&!(e.audio&&(Et(e.audio)!=="object"||(r=e.audio.processor,n=["type"],!r||Et(r)!=="object"||(Object.keys(r).filter(function(s){return!n.includes(s)}).forEach(function(s){console.warn("invalid key inputSettings -> audio -> processor : ".concat(s)),delete r[s]}),t=r.type,typeof t!="string"||!Object.values(gV).includes(t)&&(console.error("inputSettings audio processor type invalid"),1)))));var t,r,n}function CV(e){var t,r,n=[];e.video&&!vV((t=(r=window._dailyConfig)===null||r===void 0?void 0:r.useLegacyVideoProcessor)!==null&&t!==void 0&&t)&&(delete e.video,n.push("video")),e.audio&&!xV()&&(delete e.audio,n.push("audio")),n.length>0&&console.error("Ignoring settings for browser- or platform-unsupported input processor(s): ".concat(n.join(", ")))}function JN(){var e=Object.values(Vy).join(" | "),t=Object.values(gV).join(" | ");return"inputSettings must be of the form: { video?: { processor: { type: [ ".concat(e," ], config?: {} } }, audio?: { processor: {type: [ ").concat(t," ] } } }")}function EV(e){var t=e.allowAllParticipantsKey;return"receiveSettings must be of the form { [<remote participant id> | ".concat(B$e).concat(t?' | "'.concat(U$e,'"'):"","]: ")+'{ [video: [{ layer: [<non-negative integer> | "inherit"] } | "inherit"]], [screenVideo: [{ layer: [<non-negative integer> | "inherit"] } | "inherit"]] }}}'}function TV(){return"customIntegrations should be an object of type ".concat(JSON.stringify(QN),".")}function AV(e){if(e&&Et(e)!=="object"||Array.isArray(e))return console.error("customTrayButtons should be an Object of the type ".concat(JSON.stringify(s0),".")),!1;if(e)for(var t=0,r=Object.entries(e);t<r.length;t++)for(var n=xc(r[t],1)[0],s=0,i=Object.entries(e[n]);s<i.length;s++){var o=xc(i[s],2),l=o[0],c=o[1];if(l==="iconPath"&&!up(c)||l==="iconPathDarkMode"&&!up(c))return console.error("customTrayButton ".concat(l," should be a url.")),!1;var u=s0.id[l];if(!u)return console.error("customTrayButton does not support key ".concat(l)),!1;if(Et(c)!==u)return console.error("customTrayButton ".concat(l," should be a ").concat(u,".")),!1}return!0}function PV(e){if(!e||e&&Et(e)!=="object"||Array.isArray(e))return console.error(TV()),!1;for(var t=function(d){return"".concat(d," should be ").concat(QN.id[d])},r=function(d,f){return console.error("customIntegration ".concat(d,": ").concat(f))},n=0,s=Object.entries(e);n<s.length;n++){var i=xc(s[n],1)[0];if(!("label"in e[i]))return r(i,"label is required"),!1;if(!("location"in e[i]))return r(i,"location is required"),!1;if(!("src"in e[i])&&!("srcdoc"in e[i]))return r(i,"src or srcdoc is required"),!1;for(var o=0,l=Object.entries(e[i]);o<l.length;o++){var c=xc(l[o],2),u=c[0],h=c[1];switch(u){case"allow":case"csp":case"name":case"referrerPolicy":case"sandbox":if(typeof h!="string")return r(i,t(u)),!1;break;case"iconURL":if(!up(h))return r(i,"".concat(u," should be a url")),!1;break;case"src":if("srcdoc"in e[i])return r(i,"cannot have both src and srcdoc"),!1;if(!up(h))return r(i,'src "'.concat(h,'" is not a valid URL')),!1;break;case"srcdoc":if("src"in e[i])return r(i,"cannot have both src and srcdoc"),!1;if(typeof h!="string")return r(i,t(u)),!1;break;case"location":if(!["main","sidebar"].includes(h))return r(i,t(u)),!1;break;case"controlledBy":if(h!=="*"&&h!=="owners"&&(!Array.isArray(h)||h.some(function(d){return typeof d!="string"})))return r(i,t(u)),!1;break;case"shared":if((!Array.isArray(h)||h.some(function(d){return typeof d!="string"}))&&h!=="owners"&&typeof h!="boolean")return r(i,t(u)),!1;break;default:if(!QN.id[u])return console.error("customIntegration does not support key ".concat(u)),!1}}}return!0}function OV(e,t){if(t===void 0)return!1;switch(Et(t)){case"string":return Et(e)===t;case"object":if(Et(e)!=="object")return!1;for(var r in e)if(!OV(e[r],t[r]))return!1;return!0;default:return!1}}function xR(e){if(Et(e)!=="object")throw new Error('RemoteMediaPlayerSettings: must be "object" type');if(e.state&&!Object.values(VN).includes(e.state))throw new Error("Invalid value for RemoteMediaPlayerSettings.state, valid values are: "+JSON.stringify(VN));if(e.volume){if(typeof e.volume!="number")throw new Error('RemoteMediaPlayerSettings.volume: must be "number" type');if(e.volume<0||e.volume>2)throw new Error("RemoteMediaPlayerSettings.volume: must be between 0.0 - 2.0")}}function bR(e,t,r){return!(typeof e!="number"||e<t||e>r)}function fj(e,t){return e&&!t&&delete e.data,e}function hDe({roomUrl:e,userName:t}){const r=y.useRef(null),n=y.useRef(null),[s,i]=y.useState(!1),[o,l]=y.useState(!0),[c,u]=y.useState(!0),[h,d]=y.useState(!1),[f,m]=y.useState(!1);y.useEffect(()=>{if(!n.current||!e)return;const b=dDe.createFrame(n.current,{iframeStyle:{width:"100%",height:"100%",border:0,borderRadius:"12px"}
999,showLeaveButton:!1,showFullscreenButton:!0});return r.current=b,b.join({url:e,userName:t}),b.on("joined-meeting",()=>i(!0)),b.on("left-meeting",()=>i(!1)),b.on("recording-started",()=>m(!0)),b.on("recording-stopped",()=>m(!1)),()=>{b&&b.destroy()}},[e,t]);const g=()=>{r.current&&(r.current.setLocalVideo(!o),l(!o))},p=()=>{r.current&&(r.current.setLocalAudio(!c),u(!c))},v=async()=>{r.current&&(h?await r.current.stopScreenShare():await r.current.startScreenShare(),d(!h))},x=async()=>{r.current&&(f?await r.current.stopRecording():await r.current.startRecording())};return a.jsxs("div",{className:"bg-white rounded-lg shadow-lg p-4",children:[a.jsx("div",{ref:n,className:"w-full h-[500px] bg-gray-900 rounded-lg mb-4"}),s&&a.jsxs("div",{className:"flex justify-center gap-2",children:[a.jsx(Y,{variant:o?"default":"destructive",size:"sm",onClick:g,children:o?a.jsx(CD,{className:"w-4 h-4"}):a.jsx(KK,{className:"w-4 h-4"})}),a.jsx(Y,{variant:c?"default":"destructive",size:"sm",onClick:p,children:c?a.jsx(cc,{className:"w-4 h-4"}):a.jsx(ND,{className:"w-4 h-4"})}),a.jsx(Y,{variant:h?"secondary":"outline",size:"sm",onClick:v,children:h?a.jsx(MK,{className:"w-4 h-4"}):a.jsx(RK,{className:"w-4 h-4"})}),a.jsx(Y,{variant:f?"destructive":"outline",size:"sm",onClick:x,children:f?a.jsx(a2,{className:"w-4 h-4"}):a.jsx(bD,{className:"w-4 h-4"})})]})]})}function fDe({roomId:e}){const t=y.useRef(null),[r,n]=y.useState(!1),[s,i]=y.useState("pen"),[o,l]=y.useState("#000000"),[c,u]=y.useState([]),[h,d]=y.useState(1),[f,m]=y.useState({x:0,y:0}),g=y.useRef([]),p=y.useRef(null),v=y.useRef(!1);y.useEffect(()=>{x();const D=ne.channel(`whiteboard-${e}`).on("postgres_changes",{event:"INSERT",schema:"public",table:"whiteboard_strokes",filter:`room_id=eq.${e}`},U=>{const R=U.new;b(R.stroke_data)}).on("postgres_changes",{event:"DELETE",schema:"public",table:"whiteboard_strokes",filter:`room_id=eq.${e}`},()=>x()).subscribe();return()=>{ne.removeChannel(D)}},[e]);const x=async()=>{const{data:D}=await ne.from("whiteboard_strokes").select("*").eq("room_id",e).order("created_at");D&&(u(D.map(U=>({id:U.id,...U.stroke_data}))),w(D.map(U=>U.stroke_data)))},b=D=>{u(U=>[...U,D]),j(D)},w=D=>{const U=t.current,R=U==null?void 0:U.getContext("2d");!R||!U||(R.save(),R.setTransform(1,0,0,1,0,0),R.clearRect(0,0,U.width,U.height),R.restore(),R.save(),R.translate(f.x,f.y),R.scale(h,h),D.forEach(Q=>j(Q,!1)),R.restore())},j=(D,U=!0)=>{const R=t.current,Q=R==null?void 0:R.getContext("2d");if(!(!Q||D.points.length<2)){U&&(Q.save(),Q.translate(f.x,f.y),Q.scale(h,h)),Q.strokeStyle=D.tool==="eraser"?"#ffffff":D.color,Q.lineCap="round",Q.lineJoin="round",Q.beginPath(),Q.moveTo(D.points[0].x,D.points[0].y);for(let K=1;K<D.points.length;K++){const z=D.points[K],N=z.pressure||1;Q.lineWidth=D.width*N,Q.lineTo(z.x,z.y),Q.stroke(),Q.beginPath(),Q.moveTo(z.x,z.y)}U&&Q.restore()}},_=(D,U)=>{var Q;const R=(Q=t.current)==null?void 0:Q.getBoundingClientRect();return R?{x:(D-R.left-f.x)/h,y:(U-R.top-f.y)/h}:null},S=D=>{const U=_(D.clientX,D.clientY);U&&(n(!0),g.current=[U])},k=D=>{if(!r)return;const U=_(D.clientX,D.clientY);U&&(g.current.push(U),P())},P=()=>{var K;if(g.current.length<2)return;const D=(K=t.current)==null?void 0:K.getContext("2d");if(!D)return;D.save(),D.translate(f.x,f.y),D.scale(h,h),D.strokeStyle=s==="eraser"?"#ffffff":o,D.lineCap="round";const U=g.current[g.current.length-2],R=g.current[g.current.length-1],Q=R.pressure||1;D.lineWidth=(s==="eraser"?20:2)*Q,D.beginPath(),D.moveTo(U.x,U.y),D.lineTo(R.x,R.y),D.stroke(),D.restore()},C=async()=>{if(!r||g.current.length<2){n(!1);return}n(!1);const D={points:g.current,color:o,width:s==="eraser"?20:2,tool:s};await ne.from("whiteboard_strokes").insert({room_id:e,stroke_data:D}),g.current=[]},M=D=>{if(D.preventDefault(),D.touches.length===2){v.current=!0;const U=B(D.touches);p.current=U}else if(D.touches.length===1){const U=D.touches[0],R=U.force||1,Q=_(U.clientX,U.clientY);Q&&(n(!0),g.current=[{...Q,pressure:R}])}},I=D=>{if(D.preventDefault(),D.touches.length===2&&v.current){const U=B(D.touches);if(p.current){const R=U-p.current;d(Q=>
999Math.max(.5,Math.min(3,Q+R*.01)))}p.current=U}else if(D.touches.length===1&&r&&!v.current){const U=D.touches[0],R=U.force||1,Q=_(U.clientX,U.clientY);Q&&(g.current.push({...Q,pressure:R}),P())}},E=D=>{D.preventDefault(),D.touches.length<2&&(v.current=!1,p.current=null),D.touches.length===0&&C()},B=D=>{const U=D[0].clientX-D[1].clientX,R=D[0].clientY-D[1].clientY;return Math.sqrt(U*U+R*R)},A=async()=>{await ne.from("whiteboard_strokes").delete().eq("room_id",e)},L=()=>{const D=t.current;if(D){const U=D.toDataURL("image/png"),R=document.createElement("a");R.href=U,R.download="whiteboard.png",R.click()}},W=()=>{d(1),m({x:0,y:0})};return y.useEffect(()=>{w(c.map(D=>({points:D.points,color:D.color,width:D.width,tool:D.tool})))},[h,f]),a.jsxs("div",{className:"flex flex-col gap-4",children:[a.jsxs("div",{className:"flex gap-2 items-center flex-wrap",children:[a.jsx(Y,{size:"sm",variant:s==="pen"?"default":"outline",onClick:()=>i("pen"),children:a.jsx(DK,{className:"w-4 h-4"})}),a.jsx(Y,{size:"sm",variant:s==="eraser"?"default":"outline",onClick:()=>i("eraser"),children:a.jsx(ah,{className:"w-4 h-4"})}),a.jsx("input",{type:"color",value:o,onChange:D=>l(D.target.value),className:"w-10 h-10 rounded cursor-pointer"}),a.jsx(Y,{size:"sm",variant:"outline",onClick:()=>d(D=>Math.min(3,D+.2)),children:a.jsx(QK,{className:"w-4 h-4"})}),a.jsx(Y,{size:"sm",variant:"outline",onClick:()=>d(D=>Math.max(.5,D-.2)),children:a.jsx(JK,{className:"w-4 h-4"})}),a.jsx(Y,{size:"sm",variant:"outline",onClick:W,children:a.jsx(PK,{className:"w-4 h-4"})}),a.jsx(Y,{size:"sm",variant:"outline",onClick:L,children:a.jsx(as,{className:"w-4 h-4"})}),a.jsx(Y,{size:"sm",variant:"destructive",onClick:A,children:a.jsx(Ls,{className:"w-4 h-4"})}),a.jsxs("span",{className:"text-sm text-muted-foreground",children:["Zoom: ",Math.round(h*100),"%"]})]}),a.jsx("canvas",{ref:t,width:800,height:600,onMouseDown:S,onMouseMove:k,onMouseUp:C,onMouseLeave:C,onTouchStart:M,onTouchMove:I,onTouchEnd:E,className:"border rounded-lg bg-white cursor-crosshair touch-none",style:{touchAction:"none"}})]})}function mDe(){const{roomId:e}=JJ(),{user:t}=Jt(),r=ei(),[n,s]=y.useState(null),[i,o]=y.useState(!1);y.useEffect(()=>{if(!(!e||!t)){if(l(),c(),!Di()){const d=setInterval(l,5e3);return()=>{u(),clearInterval(d)}}try{const d=ne.channel(`room-${e}`).on("postgres_changes",{event:"UPDATE",schema:"public",table:"study_rooms",filter:`id=eq.${e}`},()=>{l()}).subscribe(f=>{(f==="CHANNEL_ERROR"||f==="TIMED_OUT")&&console.warn("[StudyRoom] Realtime subscription failed")});return()=>{u();try{ne.removeChannel(d)}catch{}}}catch(d){console.warn("[StudyRoom] Failed to set up realtime:",d);const f=setInterval(l,5e3);return()=>{u(),clearInterval(f)}}}},[e,t]);const l=async()=>{try{const{data:d}=await ne.from("study_rooms").select("*").eq("id",e).single();d&&s(d)}catch(d){console.warn("[StudyRoom] Failed to load room:",d)}},c=async()=>{try{const{error:d}=await ne.from("room_participants").insert({room_id:e,user_id:t==null?void 0:t.id});d||o(!0)}catch(d){console.warn("[StudyRoom] Failed to join room:",d)}},u=async()=>{try{await ne.from("room_participants").delete().match({room_id:e,user_id:t==null?void 0:t.id})}catch{}},h=async d=>{if(!n||n.created_by!==(t==null?void 0:t.id))return;const f={};if(d==="start")f.timer_started_at=new Date().toISOString(),f.timer_paused_at=null;else if(d==="pause"){const m=n.timer_started_at?Math.floor((Date.now()-new Date(n.timer_started_at).getTime())/1e3):0;f.timer_paused_at=new Date().toISOString(),f.timer_elapsed=n.timer_elapsed+m}else d==="reset"&&(f.timer_started_at=null,f.timer_paused_at=null,f.timer_elapsed=0);try{await ne.from("study_rooms").update(f).eq("id",e)}catch(m){console.warn("[StudyRoom] Failed to update timer:",m)}};return n?a.jsxs("div",{className:"min-h-screen bg-gray-50",children:[a.jsx("div",{className:"bg-white border-b px-6 py-4",children:a.jsxs("div",{className:"max-w-7xl mx-auto flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-4",children:[a.jsxs(Y,{variant:"ghost",size:"sm",onClick:()=>r("/community"),children:[a.jsx(Ll,{className:"w-4 h-4 mr-2"}),"Back"]}),a.jsxs("div",{children:[a.jsx("h1",{className:"text-2xl font-bold",children:n.name}),a.jsx("p",{className:"text-sm text-gray-600",children:n.description})]}),a.jsx(ke,{children:n.topic})]}),a.jsxs(Y,{variant:"outline",onClick:()=>{u(),r("/community")},children:[a.jsx(g_,{className:"w-4 h-4 mr-2"}),"Leave Room"]})]})}),a.jsxs("div",{className:"max-w-7xl mx-auto p-6 grid grid-cols-1 lg:grid-cols-3 gap-6",children:[a.jsxs("div",{className:"lg:col-span-2 space-y-6",children:[n.daily_room_url&&a.jsx(hDe,{roomUrl:n.daily_room_url,userName:(t==null?void 0:t.email)||"Guest"}),a.jsx(LRe,{duration:n.timer_duration,startedAt:n.timer_started_at,pausedAt:n.timer_paused_at,elapsed:n.timer_elapsed,isCreator:n.created_by===(t==null?void 0:t.id),onStart:()=>h("start"),onPause:()=>h("pause"),onReset:()=>h("reset")}),a.jsxs("div",{className:"bg-white rounded-lg shadow-sm p-6",children:[a.jsx("h2",{className:"text-xl font-semibold mb-4",children:"Collaborative Whiteboard"}),a.jsx("p",{className:"text-sm text-gray-600 mb-4",children:"Draw Malayalam characters together in real-time"}),a.jsx(fDe,{roomId:n.id})]}),a.jsx(zRe,{roomId:n.id})]}),a.jsx("div",{children:a.jsx(FRe,{roomId:n.id})})]})]}):a.jsx("div",{className:"p-8",children:"Loading..."})}
999const pDe={FIRST_TEAM:{id:"first_team",name:"Team Player",description:"Created your first team",icon:"🎯"},TEN_MEMBERS:{id:"ten_members",name:"Growing Squad",description:"Reached 10 members",icon:"👥"},LEVEL_10:{id:"level_10",name:"Elite Team",description:"Reached team level 10",icon:"⭐"},CHALLENGE_MASTER:{id:"challenge_master",name:"Challenge Master",description:"Completed 10 challenges",icon:"🏆"},TOP_TEAM:{id:"top_team",name:"Top of the Board",description:"Reached #1 on leaderboard",icon:"👑"}};async function MV(e,t,r=!0){const{data:{user:n}}=await ne.auth.getUser();if(!n)throw new Error("Not authenticated");const{data:s,error:i}=await ne.from("teams").insert({name:e,description:t,created_by:n.id,is_public:r}).select().single();if(i)throw i;return await ne.from("team_members").insert({team_id:s.id,user_id:n.id,role:"owner"}),await IV(s.id,"first_team"),s}async function RV(e){const{data:{user:t}}=await ne.auth.getUser();if(!t)throw new Error("Not authenticated");const{error:r}=await ne.from("team_members").insert({team_id:e,user_id:t.id,role:"member"});if(r)throw r;await $V(e)}async function gDe(e){const{data:{user:t}}=await ne.auth.getUser();if(!t)throw new Error("Not authenticated");const{error:r}=await ne.from("team_members").delete().match({team_id:e,user_id:t.id});if(r)throw r;await $V(e)}async function $V(e){const{count:t}=await ne.from("team_members").select("*",{count:"exact",head:!0}).eq("team_id",e);await ne.from("teams").update({member_count:t||0}).eq("id",e)}async function IV(e,t){await ne.from("team_badges").insert({team_id:e,badge_id:t})}async function yDe(e,t){const{data:{user:r}}=await ne.auth.getUser();if(!r)return;const{data:n}=await ne.from("teams").select("total_xp, weekly_xp").eq("id",e).single();if(n){const s=n.total_xp+t,i=n.weekly_xp+t,o=Math.floor(Math.pow(s/100,.5))+1;await ne.from("teams").update({total_xp:s,weekly_xp:i,level:o}).eq("id",e);const{data:l}=await ne.from("team_members").select("contribution_xp, weekly_contribution_xp").match({team_id:e,user_id:r.id}).single();l&&await ne.from("team_members").update({contribution_xp:l.contribution_xp+t,weekly_contribution_xp:l.weekly_contribution_xp+t}).match({team_id:e,user_id:r.id})}}const vDe=Object.freeze(Object.defineProperty({__proto__:null,TEAM_BADGES:pDe,awardTeamBadge:IV,contributeXP:yDe,createTeam:MV,joinTeam:RV,leaveTeam:gDe},Symbol.toStringTag,{value:"Module"}));function xDe({open:e,onClose:t,onTeamCreated:r}){const[n,s]=y.useState(""),[i,o]=y.useState(""),[l,c]=y.useState(!0),[u,h]=y.useState(!1),d=async f=>{if(f.preventDefault(),!n.trim()){Pe.error("Please enter a team name");return}h(!0);try{await MV(n,i,l),Pe.success("Team created successfully!"),s(""),o(""),c(!0),r(),t()}catch(m){Pe.error(m.message||"Failed to create team")}finally{h(!1)}};return a.jsx(Ks,{open:e,onOpenChange:t,children:a.jsxs(fs,{className:"sm:max-w-[500px]",children:[a.jsx(Ys,{children:a.jsx(Xs,{children:"Create New Team"})}),a.jsxs("form",{onSubmit:d,className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx(Re,{htmlFor:"name",children:"Team Name"}),a.jsx(Je,{id:"name",value:n,onChange:f=>s(f.target.value),placeholder:"Enter team name",maxLength:50})]}),a.jsxs("div",{children:[a.jsx(Re,{htmlFor:"description",children:"Description"}),a.jsx(ms,{id:"description",value:i,onChange:f=>o(f.target.value),placeholder:"Describe your team's goals and focus",rows:3})]}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx(Re,{htmlFor:"public",children:"Public Team"}),a.jsx(_n,{id:"public",checked:l,onCheckedChange:c})]}),a.jsx("p",{className:"text-sm text-muted-foreground",children:l?"Anyone can join this team":"Invite-only team"}),a.jsxs("div",{className:"flex gap-2 justify-end",children:[a.jsx(Y,{type:"button",variant:"outline",onClick:t,children:"Cancel"}),a.jsx(Y,{type:"submit",disabled:u,children:u?"Creating...":"Create Team"})]})]})]})})}function bDe({team:e,isMember:t,onJoin:r,onView:n}){return a.jsxs(se,{className:"hover:shadow-lg transition-shadow",children:[a.jsx(_e,{children:a.jsxs("div",{className:"flex items-start justify-between",children:[a.jsxs("div",{children:[a.jsx(Se,{className:"text-xl",children:e.name}),a.jsxs("p",{className:"text-sm text-muted-foreground mt-1",children:["Level ",e.level]})]}),a.jsx(ke,{variant:e.is_public?"default":"secondary",children:e.is_public?"Public":"Private"})]})}),a.jsxs(ue,{children:[a.jsx("p",{className:"text-sm mb-4 line-clamp-2",children:e.description}),a.jsxs("div",{className:"grid grid-cols-3 gap-2 mb-4",children:[a.jsxs("div",{className:"flex items-center gap-1 text-sm",children:[a.jsx(Xn,{className:"h-4 w-4 text-blue-500"}),a.jsx("span",{children:e.member_count})]}),a.jsxs("div",{className:"flex items-center gap-1 text-sm",children:[a.jsx(lr,{className:"h-4 w-4 text-yellow-500"}
999),a.jsx("span",{children:e.total_xp.toLocaleString()})]}),a.jsxs("div",{className:"flex items-center gap-1 text-sm",children:[a.jsx(ja,{className:"h-4 w-4 text-green-500"}),a.jsx("span",{children:e.weekly_xp})]})]}),t?a.jsx(Y,{onClick:()=>n(e.id),className:"w-full",children:"View Team"}):a.jsx(Y,{onClick:()=>r(e.id),className:"w-full",variant:"outline",children:"Join Team"})]})]})}function wDe(){const[e,t]=y.useState([]),[r,n]=y.useState("weekly");y.useEffect(()=>{s();const o=ne.channel("team-leaderboard").on("postgres_changes",{event:"*",schema:"public",table:"teams"},s).subscribe();return()=>{ne.removeChannel(o)}},[r]);const s=async()=>{const o=r==="weekly"?"weekly_xp":"total_xp",{data:l}=await ne.from("teams").select("*").order(o,{ascending:!1}).limit(10);l&&t(l)},i=o=>o===0?"🥇":o===1?"🥈":o===2?"🥉":`#${o+1}`;return a.jsxs(se,{children:[a.jsx(_e,{children:a.jsxs(Se,{className:"flex items-center gap-2",children:[a.jsx(lr,{className:"h-5 w-5"}),"Team Leaderboard"]})}),a.jsx(ue,{children:a.jsxs(Pn,{value:r,onValueChange:o=>n(o),children:[a.jsxs(fn,{className:"grid w-full grid-cols-2",children:[a.jsx(Oe,{value:"weekly",children:"Weekly"}),a.jsx(Oe,{value:"alltime",children:"All Time"})]}),a.jsx(ze,{value:r,className:"space-y-2 mt-4",children:e.map((o,l)=>a.jsxs("div",{className:"flex items-center justify-between p-3 bg-secondary/50 rounded-lg",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("span",{className:"text-lg font-bold w-8",children:i(l)}),a.jsxs("div",{children:[a.jsx("p",{className:"font-semibold",children:o.name}),a.jsxs("p",{className:"text-sm text-muted-foreground",children:["Level ",o.level]})]})]}),a.jsxs("div",{className:"text-right",children:[a.jsxs("p",{className:"font-bold",children:[(r==="weekly"?o.weekly_xp:o.total_xp).toLocaleString()," XP"]}),a.jsxs("p",{className:"text-sm text-muted-foreground",children:[o.member_count," members"]})]})]},o.id))})]})})]})}function jDe({teamId:e}){const{user:t}=Jt(),[r,n]=y.useState([]),[s,i]=y.useState(""),o=y.useRef(null);y.useEffect(()=>{l();const u=ne.channel(`team-chat-${e}`).on("postgres_changes",{event:"INSERT",schema:"public",table:"team_chat",filter:`team_id=eq.${e}`},h=>{n(d=>[...d,h.new])}).subscribe();return()=>{ne.removeChannel(u)}},[e]),y.useEffect(()=>{var u;(u=o.current)==null||u.scrollIntoView({behavior:"smooth"})},[r]);const l=async()=>{const{data:u}=await ne.from("team_chat").select("*, profiles(username)").eq("team_id",e).order("created_at",{ascending:!0}).limit(50);u&&n(u)},c=async u=>{u.preventDefault(),!(!s.trim()||!t)&&(await ne.from("team_chat").insert({team_id:e,user_id:t.id,message:s.trim()}),i(""))};return a.jsxs(se,{children:[a.jsx(_e,{children:a.jsx(Se,{children:"Team Chat"})}),a.jsxs(ue,{children:[a.jsx(Dp,{className:"h-[400px] mb-4 pr-4",children:a.jsxs("div",{className:"space-y-3",children:[r.map(u=>{var h;return a.jsx("div",{className:`flex ${u.user_id===(t==null?void 0:t.id)?"justify-end":"justify-start"}`,children:a.jsxs("div",{className:`max-w-[70%] rounded-lg p-3 ${u.user_id===(t==null?void 0:t.id)?"bg-primary text-primary-foreground":"bg-secondary"}`,children:[a.jsx("p",{className:"text-xs font-semibold mb-1",children:((h=u.profiles)==null?void 0:h.username)||"User"}),a.jsx("p",{className:"text-sm",children:u.message})]})},u.id)}),a.jsx("div",{ref:o})]})}),a.jsxs("form",{onSubmit:c,className:"flex gap-2",children:[a.jsx(Je,{value:s,onChange:u=>i(u.target.value),placeholder:"Type a message...",maxLength:500}),a.jsx(Y,{type:"submit",size:"icon",children:a.jsx(n2,{className:"h-4 w-4"})})]})]})]})}const _De={quiz_completion:os,streak_maintenance:ED,mastery_goal:Ec,xp_target:lr,practice_days:rh,accuracy_goal:os};function mj({challenge:e}){const t=_De[e.challenge_type],r=e.current_progress/e.target_value*100,n=e.status==="completed",s=e.status==="expired",i=Math.ceil((new Date(e.end_date).getTime()-Date.now())/(1e3*60*60*24));return a.jsxs(se,{className:n?"border-green-500 bg-green-50":s?"border-gray-300 opacity-60":"",children:[a.jsx(_e,{children:a.jsxs("div",{className:"flex items-start justify-between",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(t,{className:"h-5 w-5 text-primary"}),a.jsx(Se,{className:"text-lg",children:e.title})]}),a.jsx(ke,{variant:n?"default":s?"secondary":"outline",children:n?"Completed":s?"Expired":"Active"})]})}),a.jsxs(ue,{className:"space-y-3",children:[a.jsx("p",{className:"text-sm text-muted-foreground",children:e.description}),a.jsxs("div",{className:"space-y-1",children:[a.jsxs("div",{className:"flex justify-between text-sm",children:[a.jsxs("span",{children:["Progress: ",e.current_progress," / ",e.target_value]}),a.jsxs("span",{className:"font-semibold",children:[Math.round(r),"%"]})]}),a.jsx(_t,{value:r,className:"h-2"})]}),a.jsxs("div",{className:"flex items-center justify-between text-sm",children:[a.jsxs("div",{className:"flex items-center gap-1 text-muted-foreground",children:[a.jsx(rh,{className:"h-4 w-4"}),a.jsx("span",{children:i>0?`${i} days left`:"Ended"})]}),a.jsxs("div",{className:"flex items-center gap-1 text-primary font-semibold",children:[a.jsx(lr,{className:"h-4 w-4"}),a.jsxs("span",{children:[e.xp_reward," XP"]})]})]})]})]})}async function DV(e,t,r,n,s,i,o=100){const{data:l,error:c}=await ne.from("team_challenges").insert({team_id:e,title:t,description:r,challenge_type:n,target_value:s,end_date:i,xp_reward:o}).select().single();if(c)throw c;return await Gle(e,t,l.id),l}async function LV(e,t){let r=ne.from("team_challenges").select("*").eq("team_id",e).order("created_at",{ascending:!1});t&&(r=r.eq("status",t));const{data:n,error:s}=await r;if(s)throw s;return n}async function SDe(e,t,r,n=1){for(const s of t){const{data:i}=await ne.from("team_challenges").select("id, title, current_progress, target_value").eq("team_id",s).eq("challenge_type",r).eq("status","active");if(i)for(const o of i){const{data:l}=await ne.rpc("increment_challenge_contribution",{p_challenge_id:o.id,p_user_id:e,p_amount:n});l&&o.current_progress<o.target_value&&o.current_progress+n>=o.target_value&&await qle(o.id,s,o.title)}}}const NDe=Object.freeze(Object.defineProperty({__proto__:null,contributeToChallenges:SDe,createTeamChallenge:DV,getTeamChallenges:LV},Symbol.toStringTag,{value:"Module"})),kDe=[{value:"quiz_completion",label:"Quiz Completion",description:"Complete a number of quizzes"},{value:"streak_maintenance",label:"Streak Maintenance",description:"Maintain practice streak for days"},{value:"mastery_goal",label:"Mastery Goal",description:"Master a number of letters/concepts"},{value:"xp_target",label:"XP Target",description:"Earn a total amount of XP"},{value:"practice_days",label:"Practice Days",description:"Practice for a number of days"},{value:"accuracy_goal",label:"Accuracy Goal",description:"Achieve target accuracy percentage"}];function CDe({open:e,onClose:t,teamId:r,onChallengeCreated:n}){const[s,i]=y.useState(""),[o,l]=y.useState(""),[c,u]=y.useState("quiz_completion"),[h,d]=y.useState("100"),[f,m]=y.useState(""),[g,p]=y.useState("100"),[v,x]=y.useState(!1),{toast:b}=ta(),w=async _=>{_.preventDefault(),x(!0);try{await DV(r,s,o,c,parseInt(h),f,parseInt(g)),b({title:"Challenge created successfully!"}),n(),t(),j()}catch{b({title:"Failed to create challenge",variant:"destructive"})}finally{x(!1)}},j=()=>{i(""),l(""),u("quiz_completion"),d("100"),m(""),p("100")};return a.jsx(Ks,{open:e,onOpenChange:t,children:a.jsxs(fs,{className:"max-w-md",children:[a.jsx(Ys,{children:a.jsx(Xs,{children:"Create Team Challenge"})}),a.jsxs("form",{onSubmit:w,className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx(Re,{children:"Title"}),a.jsx(Je,{value:s,onChange:_=>i(_.target.value),required:!0})]}),a.jsxs("div",{children:[a.jsx(Re,{children:"Description"}),a.jsx(ms,{value:o,onChange:_=>l(_.target.value)})]}),a.jsxs("div",{children:[a.jsx(Re,{children:"Challenge Type"}),a.jsxs(Nr,{value:c,onValueChange:_=>u(_),children:[a.jsx(gr,{children:a.jsx(kr,{})}),a.jsx(yr,{children:kDe.map(_=>a.jsx(Le,{value:_.value,children:_.label},_.value))})]})]}),a.jsxs("div",{children:[a.jsx(Re,{children:"Target Value"}),a.jsx(Je,{type:"number",value:h,onChange:_=>d(_.target.value),required:!0})]}),a.jsxs("div",{children:[a.jsx(Re,{children:"End Date"}),a.jsx(Je,{type:"datetime-local",value:f,onChange:_=>m(_.target.value),required:!0})]}),a.jsxs("div",{children:[a.jsx(Re,{children:"XP Reward"}),a.jsx(Je,{type:"number",value:g,onChange:_=>p(_.target.value),required:!0})]}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx(Y,{type:"submit",disabled:v,className:"flex-1",children:v?"Creating...":"Create Challenge"}),a.jsx(Y,{type:"button",variant:"outline",onClick:t,children:"Cancel"})]})]})]})})}function EDe({teamId:e,isAdmin:t}){const[r,n]=y.useState([]),[s,i]=y.useState(!0),[o,l]=y.useState(!1),{toast:c}=ta(),u=async()=>{try{const m=await LV(e);n(m)}catch{c({title:"Failed to load challenges",variant:"destructive"})}finally{i(!1)}};y.useEffect(()=>{u();const m=ne.channel(`team_challenges_${e}`).on("postgres_changes",{event:"*",schema:"public",table:"team_challenges",filter:`team_id=eq.${e}`},()=>u()).subscribe();return()=>{ne.removeChannel(m)}},[e]);const h=r.filter(m=>m.status==="active"),d=r.filter(m=>m.status==="completed"),f=r.filter(m=>m.status==="expired");return s?a.jsx("div",{className:"text-center py-8",children:"Loading challenges..."}):a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("h2",{className:"text-2xl font-bold",children:"Team Challenges"}),t&&a.jsxs(Y,{onClick:()=>l(!0),children:[a.jsx(Ep,{className:"h-4 w-4 mr-2"}),"Create Challenge"]})]}),a.jsxs(Pn,{defaultValue:"active",children:[a.jsxs(fn,{className:"grid w-full grid-cols-3",children:[a.jsxs(Oe,{value:"active",children:["Active (",h.length,")"]}),a.jsxs(Oe,{value:"completed",children:["Completed (",d.length,")"]}),a.jsxs(Oe,{value:"expired",children:["Expired (",f.length,")"]})]}),a.jsx(ze,{value:"active",className:"space-y-4",children:h.length===0?a.jsx("p",{className:"text-center text-muted-foreground py-8",children:"No active challenges"}):h.map(m=>a.jsx(mj,{challenge:m},m.id))}),a.jsx(ze,{value:"completed",className:"space-y-4",children:d.length===0?a.jsx("p",{className:"text-center text-muted-foreground py-8",children:"No completed challenges yet"}):d.map(m=>a.jsx(mj,{challenge:m},m.id))}),a.jsx(ze,{value:"expired",className:"space-y-4",children:f.length===0?a.jsx("p",{className:"text-center text-muted-foreground py-8",children:"No expired challenges"}):f.map(m=>a.jsx(mj,{challenge:m},m.id))})]}),a.jsx(CDe,{open:o,onClose:()=>l(!1),teamId:e,onChallengeCreated:u})]})}function TDe(){const{user:e}=Jt(),[t,r]=y.useState([]),[n,s]=y.useState([]),[i,o]=y.useState(null),[l,c]=y.useState(!1),[u,h]=y.useState(""),[d,f]=y.useState("member");y.useEffect(()=>{i&&e&&m(i.id)},[i,e]);const m=async w=>{if(!e)return;const{data:j}=await ne.from("team_members").select("role").eq("team_id",w).eq("user_id",e.id).single();j&&f(j.role)};y.useEffect(()=>{g(),p()},[e]);const g=async()=>{const{data:w}=await ne.from("teams").select("*").eq("is_public",!0).order("total_xp",{ascending:!1});w&&r(w)},p=async()=>
999{if(!e)return;const{data:w}=await ne.from("team_members").select("teams(*)").eq("user_id",e.id);w&&s(w.map(j=>j.teams).filter(Boolean))},v=async w=>{try{await RV(w),Pe.success("Joined team successfully!"),g(),p()}catch(j){Pe.error(j.message||"Failed to join team")}},x=t.filter(w=>w.name.toLowerCase().includes(u.toLowerCase())),b=w=>n.some(j=>j.id===w);return a.jsxs("div",{className:"container mx-auto p-6 max-w-7xl",children:[a.jsxs("div",{className:"flex justify-between items-center mb-6",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"text-3xl font-bold",children:"Study Teams"}),a.jsx("p",{className:"text-muted-foreground",children:"Join teams, compete, and learn together"})]}),a.jsxs(Y,{onClick:()=>c(!0),children:[a.jsx(Ep,{className:"h-4 w-4 mr-2"}),"Create Team"]})]}),a.jsxs(Pn,{defaultValue:"browse",className:"space-y-6",children:[a.jsxs(fn,{children:[a.jsx(Oe,{value:"browse",children:"Browse Teams"}),a.jsxs(Oe,{value:"myteams",children:["My Teams (",n.length,")"]}),a.jsx(Oe,{value:"leaderboard",children:"Leaderboard"})]}),a.jsxs(ze,{value:"browse",className:"space-y-4",children:[a.jsxs("div",{className:"relative",children:[a.jsx(Tp,{className:"absolute left-3 top-3 h-4 w-4 text-muted-foreground"}),a.jsx(Je,{placeholder:"Search teams...",value:u,onChange:w=>h(w.target.value),className:"pl-10"})]}),a.jsx("div",{className:"grid md:grid-cols-2 lg:grid-cols-3 gap-4",children:x.map(w=>a.jsx(bDe,{team:w,isMember:b(w.id),onJoin:v,onView:j=>{o(w)}},w.id))})]}),a.jsxs(ze,{value:"myteams",className:"space-y-4",children:[n.length===0?a.jsx(se,{children:a.jsxs(ue,{className:"py-12 text-center",children:[a.jsx(Xn,{className:"h-12 w-12 mx-auto mb-4 text-muted-foreground"}),a.jsx("p",{className:"text-muted-foreground",children:"You haven't joined any teams yet"})]})}):a.jsx("div",{className:"grid md:grid-cols-2 gap-6",children:n.map(w=>a.jsxs(se,{className:"cursor-pointer hover:shadow-lg transition-shadow",onClick:()=>o(w),children:[a.jsx(_e,{children:a.jsx(Se,{children:w.name})}),a.jsxs(ue,{children:[a.jsx("p",{className:"text-sm mb-4",children:w.description}),a.jsxs("div",{className:"grid grid-cols-3 gap-2 text-sm",children:[a.jsxs("div",{children:[a.jsx("p",{className:"text-muted-foreground",children:"Level"}),a.jsx("p",{className:"font-bold",children:w.level})]}),a.jsxs("div",{children:[a.jsx("p",{className:"text-muted-foreground",children:"Members"}),a.jsx("p",{className:"font-bold",children:w.member_count})]}),a.jsxs("div",{children:[a.jsx("p",{className:"text-muted-foreground",children:"XP"}),a.jsx("p",{className:"font-bold",children:w.total_xp.toLocaleString()})]})]})]})]},w.id))}),i&&a.jsxs("div",{className:"mt-6 space-y-6",children:[a.jsx(EDe,{teamId:i.id,isAdmin:d==="admin"}),a.jsx(jDe,{teamId:i.id})]})]}),a.jsx(ze,{value:"leaderboard",children:a.jsx(wDe,{})})]}),a.jsx(xDe,{open:l,onClose:()=>c(!1),onTeamCreated:()=>{g(),p()}})]})}const UE=y.forwardRef(({className:e,...t},r)=>a.jsx("div",{className:"relative w-full overflow-auto",children:a.jsx("table",{ref:r,className:je("w-full caption-bottom text-sm",e),...t})}));UE.displayName="Table";const WE=y.forwardRef(({className:e,...t},r)=>a.jsx("thead",{ref:r,className:je("[&_tr]:border-b",e),...t}));WE.displayName="TableHeader";const VE=y.forwardRef(({className:e,...t},r)=>a.jsx("tbody",{ref:r,className:je("[&_tr:last-child]:border-0",e),...t}));VE.displayName="TableBody";const ADe=y.forwardRef(({className:e,...t},r)=>a.jsx("tfoot",{ref:r,className:je("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",e),...t}));ADe.displayName="TableFooter";const gp=y.forwardRef(({className:e,...t},r)=>a.jsx("tr",{ref:r,className:je("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",e),...t}));gp.displayName="TableRow";const Ya=y.forwardRef(({className:e,...t},r)=>a.jsx("th",{ref:r,className:je("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",e),...t}));Ya.displayName="TableHead";const Xa=y.forwardRef(({className:e,...t},r)=>a.jsx("td",{ref:r,className:je("p-4 align-middle [&:has([role=checkbox])]:pr-0",e),...t}));Xa.displayName="TableCell";const PDe=y.forwardRef(({className:e,...t},r)=>a.jsx("caption",{ref:r,className:je("mt-4 text-sm text-muted-foreground",e),...t}));PDe.displayName="TableCaption";function ODe(){const[e,t]=y.useState([]),[r,n]=y.useState(!0),[s,i]=y.useState({total:0,active:0,avgXp:0,avgStreak:0});y.useEffect(()=>{o()},[]);const o=async()=>{try{const{data:l,error:c}=await ne.from("user_progress").select("*").order("total_xp",{ascending:!1}).limit(50);if(c)throw c;const u=l||[];t(u);const h=u.length,d=u.filter(g=>new Date(g.last_active)>new Date(Date.now()-7*24*60*60*1e3)).length,f=h>0?u.reduce((g,p)=>g+p.total_xp,0)/h:0,m=h>0?u.reduce((g,p)=>g+p.streak_days,0)/h:0;i({total:h,active:d,avgXp:Math.round(f),avgStreak:Math.round(m)})}catch(l){Pe.error("Failed to load user progress: "+l.message)}finally{n(!1)}};return a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-4",children:[a.jsx(se,{children:a.jsx(ue,{className:"pt-6",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{children:[a.jsx("p",{className:"text-sm text-gray-600",children:"Total Users"}),a.jsx("p",{className:"text-3xl font-bold",children:s.total})]}),a.jsx(Xn,{className:"h-8 w-8 text-blue-500"})]})})}),a.jsx(se,{children:a.jsx(ue,{className:"pt-6",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{children:[a.jsx("p",{className:"text-sm text-gray-600",children:"Active (7d)"}),a.jsx("p",{className:"text-3xl font-bold",children:s.active})]}),a.jsx(ja,{className:"h-8 w-8 text-green-500"})]})})}),a.jsx(se,{children:a.jsx(ue,{className:"pt-6",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{children:[a.jsx("p",{className:"text-sm text-gray-600",children:"Avg XP"}),a.jsx("p",{className:"text-3xl font-bold",children:s.avgXp})]}),a.jsx(Ec,{className:"h-8 w-8 text-yellow-500"})]})})}),a.jsx(se,{children:a.jsx(ue,{className:"pt-6",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{children:[a.jsx("p",{className:"text-sm text-gray-600",children:"Avg Streak"}),a.jsx("p",{className:"text-3xl font-bold",children:s.avgStreak})]}),a.jsx(nh,{className:"h-8 w-8 text-purple-500"})]})})})]}),a.jsxs(se,{children:[a.jsx(_e,{children:a.jsx(Se,{children:"User Progress Details"})}),a.jsx(ue,{children:r?a.jsx("p",{children:"Loading..."}):a.jsxs(UE,{children:[a.jsx(WE,{children:a.jsxs(gp,{children:[a.jsx(Ya,{children:"Email"}),a.jsx(Ya,{children:"Level"}),a.jsx(Ya,{children:"Total XP"}
vendor: 4,776 bytes, lines 999-1005
999),a.jsx(Ya,{children:"Quizzes"}),a.jsx(Ya,{children:"Streak"}),a.jsx(Ya,{children:"Last Active"})]})}),a.jsx(VE,{children:e.map(l=>a.jsxs(gp,{children:[a.jsx(Xa,{children:l.email}),a.jsx(Xa,{children:l.level}),a.jsx(Xa,{children:l.total_xp}),a.jsx(Xa,{children:l.quizzes_completed}),a.jsxs(Xa,{children:[l.streak_days," days"]}),a.jsx(Xa,{children:new Date(l.last_active).toLocaleDateString()})]},l.id))})]})})]})]})}const MDe={light:"",dark:".dark"},FV=y.createContext(null);function zV(){const e=y.useContext(FV);if(!e)throw new Error("useChart must be used within a <ChartContainer />");return e}const RDe=y.forwardRef(({id:e,className:t,children:r,config:n,...s},i)=>{const o=y.useId(),l=`chart-${e||o.replace(/:/g,"")}`;return a.jsx(FV.Provider,{value:{config:n},children:a.jsxs("div",{"data-chart":l,ref:i,className:je("flex aspect-video justify-center text-xs [&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground [&_.recharts-cartesian-grid_line[stroke='#ccc']]:stroke-border/40 [&_.recharts-curve.recharts-tooltip-cursor]:stroke-border/60 [&_.recharts-dot[stroke='#fff']]:stroke-transparent [&_.recharts-layer]:outline-none [&_.recharts-polar-grid_[stroke='#ccc']]:stroke-border/40 [&_.recharts-radial-bar-background-sector]:fill-muted/50 [&_.recharts-rectangle.recharts-tooltip-cursor]:fill-muted/80 [&_.recharts-reference-line_[stroke='#ccc']]:stroke-border/40 [&_.recharts-sector[stroke='#fff']]:stroke-transparent [&_.recharts-sector]:outline-none [&_.recharts-surface]:outline-none",t),...s,children:[a.jsx($De,{id:l,config:n}),a.jsx(Uu,{children:r})]})})});RDe.displayName="Chart";const $De=({id:e,config:t})=>{const r=Object.entries(t).filter(([n,s])=>s.theme||s.color);return r.length?a.jsx("style",{dangerouslySetInnerHTML:{__html:Object.entries(MDe).map(([n,s])=>`
1000${s} [data-chart=${e}] {
1001${r.map(([i,o])=>{var c;const l=((c=o.theme)==null?void 0:c[n])||o.color;return l?`  --color-${i}: ${l};`:null}).join(`
1002`)}
1003}
1004`).join(`
1005`)}}):null},pj=oa,IDe=y.forwardRef(({active:e,payload:t,className:r,indicator:n="dot",hideLabel:s=!1,hideIndicator:i=!1,label:o,labelFormatter:l,labelClassName:c,formatter:u,color:h,nameKey:d,labelKey:f},m)=>{const{config:g}=zV(),p=y.useMemo(()=>{var _;if(s||!(t!=null&&t.length))return null;const[x]=t,b=`${f||x.dataKey||x.name||"value"}`,w=ZN(g,x,b),j=!f&&typeof o=="string"?((_=g[o])==null?void 0:_.label)||o:w==null?void 0:w.label;return l?a.jsx("div",{className:je("font-medium",c),children:l(j,t)}):j?a.jsx("div",{className:je("font-medium",c),children:j}):null},[o,l,t,s,c,g,f]);if(!e||!(t!=null&&t.length))return null;const v=t.length===1&&n!=="dot";return a.jsxs("div",{ref:m,className:je("grid min-w-[8rem] items-start gap-1.5 rounded-lg border border-border/50 bg-background/95 backdrop-blur-sm px-2.5 py-1.5 text-xs shadow-xl",r),children:[v?null:p,a.jsx("div",{className:"grid gap-1.5",children:t.map((x,b)=>{const w=`${d||x.name||x.dataKey||"value"}`,j=ZN(g,x,w),_=h||x.payload.fill||x.color;return a.jsx("div",{className:je("flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5 [&>svg]:text-muted-foreground",n==="dot"&&"items-center"),children:u&&(x==null?void 0:x.value)!==void 0&&x.name?u(x.value,x.name,x,b,x.payload):a.jsxs(a.Fragment,{children:[j!=null&&j.icon?a.jsx(j.icon,{}):!i&&a.jsx("div",{className:je("shrink-0 rounded-[2px] border-[--color-border] bg-[--color-bg]",{"h-2.5 w-2.5":n==="dot","w-1":n==="line","w-0 border-[1.5px] border-dashed bg-transparent":n==="dashed","my-0.5":v&&n==="dashed"}),style:{"--color-bg":_,"--color-border":_}}),a.jsxs("div",{className:je("flex flex-1 justify-between leading-none",v?"items-end":"items-center"),children:[a.jsxs("div",{className:"grid gap-1.5",children:[v?p:null,a.jsx("span",{className:"text-muted-foreground",children:(j==null?void 0:j.label)||x.name})]}),x.value&&a.jsx("span",{className:"font-mono font-medium tabular-nums text-foreground",children:x.value.toLocaleString()})]})]})},x.dataKey)})})]})});IDe.displayName="ChartTooltip";const DDe=y.forwardRef(({className:e,hideIcon:t=!1,payload:r,verticalAlign:n="bottom",nameKey:s},i)=>{const{config:o}=zV();return r!=null&&r.length?a.jsx("div",{ref:i,className:je("flex items-center justify-center gap-4",n==="top"?"pb-3":"pt-3",e),children:r.map(l=>{const c=`${s||l.dataKey||"value"}`,u=ZN(o,l,c);return a.jsxs("div",{className:je("flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3 [&>svg]:text-muted-foreground"),children:[u!=null&&u.icon&&!t?a.jsx(u.icon,{}):a.jsx("div",{className:"h-2 w-2 shrink-0 rounded-[2px]",style:{backgroundColor:l.color}}),u==null?void 0:u.label]},l.value)})}):null});DDe.displayName="ChartLegend";function ZN(e,t,r){if(typeof t!="object"||t===null)return;const n="payload"in t&&typeof t.payload=="object"&&t.payload!==null?t.payload:void 0;let s=r;
1005return r in t&&typeof t[r]=="string"?s=t[r]:n&&r in n&&typeof n[r]=="string"&&(s=n[r]),s in e?e[s]:e[r]}function LDe(){const[e,t]=y.useState([]),[r,n]=y.useState([]),[s,i]=y.useState(!0);y.useEffect(()=>{o()},[]);const o=async()=>{try{const{data:l,error:c}=await ne.from("quiz_attempts").select("*").order("created_at",{ascending:!1}).limit(100);if(c)throw c;const u={};l==null||l.forEach(m=>{const g=m.quiz_type||"Unknown";u[g]||(u[g]={type:g,attempts:0,totalScore:0,avgScore:0}),u[g].attempts++,u[g].totalScore+=m.score||0});const h=Object.values(u).map(m=>({...m,avgScore:Math.round(m.totalScore/m.attempts*100)/100}));t(h);const f=Array.from({length:7},(m,g)=>{const p=new Date;return p.setDate(p.getDate()-(6-g)),p.toISOString().split("T")[0]}).map(m=>{const g=(l==null?void 0:l.filter(v=>{var x;return(x=v.created_at)==null?void 0:x.startsWith(m)}))||[],p=g.length>0?g.reduce((v,x)=>v+(x.score||0),0)/g.length:0;return{date:new Date(m).toLocaleDateString("en-US",{month:"short",day:"numeric"}),attempts:g.length,avgScore:Math.round(p*100)/100}});n(f)}catch(l){Pe.error("Failed to load quiz analytics: "+l.message)}finally{i(!1)}};return s?a.jsx("p",{children:"Loading analytics..."}):a.jsxs("div",{className:"space-y-6",children:[a.jsxs(se,{children:[a.jsx(_e,{children:a.jsx(Se,{children:"Quiz Attempts by Type"})}),a.jsx(ue,{children:a.jsx(Uu,{width:"100%",height:300,children:a.jsxs(CN,{data:e,children:[a.jsx(Hu,{strokeDasharray:"3 3"}),a.jsx(Ei,{dataKey:"type"}),a.jsx(Ti,{}),a.jsx(pj,{}),a.jsx(Ui,{dataKey:"attempts",fill:"#3b82f6"})]})})})]}),a.jsxs(se,{children:[a.jsx(_e,{children:a.jsx(Se,{children:"Average Score by Quiz Type"})}),a.jsx(ue,{children:a.jsx(Uu,{width:"100%",height:300,children:a.jsxs(CN,{data:e,children:[a.jsx(Hu,{strokeDasharray:"3 3"}),a.jsx(Ei,{dataKey:"type"}),a.jsx(Ti,{}),a.jsx(pj,{}),a.jsx(Ui,{dataKey:"avgScore",fill:"#10b981"})]})})})]}),a.jsxs(se,{children:[a.jsx(_e,{children:a.jsx(Se,{children:"Performance Over Time (Last 7 Days)"})}),a.jsx(ue,{children:a.jsx(Uu,{width:"100%",height:300,children:a.jsxs(CW,{data:r,children:[a.jsx(Hu,{strokeDasharray:"3 3"}),a.jsx(Ei,{dataKey:"date"}),a.jsx(Ti,{}),a.jsx(pj,{}),a.jsx(Ci,{type:"monotone",dataKey:"attempts",stroke:"#8b5cf6",strokeWidth:2}),a.jsx(Ci,{type:"monotone",dataKey:"avgScore",stroke:"#f59e0b",strokeWidth:2})]})})})]})]})}function FDe(){const[e,t]=y.useState([]),[r,n]=y.useState(!0),[s,i]=y.useState(!1),[o,l]=y.useState(null),[c,u]=y.useState({title:"",description:"",content:"",category:"vowels",order:0});y.useEffect(()=>{h()},[]);const h=async()=>{try{const{data:p,error:v}=await ne.from("lessons").select("*").order("order",{ascending:!0});if(v)throw v;t(p||[])}catch(p){Pe.error("Failed to load lessons: "+p.message)}finally{n(!1)}},d=async p=>{p.preventDefault();try{if(o){const{error:v}=await ne.from("lessons").update(c).eq("id",o.id);if(v)throw v;Pe.success("Lesson updated successfully")}else{const{error:v}=await ne.from("lessons").insert([c]);if(v)throw v;Pe.success("Lesson created successfully")}i(!1),m(),h()}catch(v){Pe.error("Failed to save lesson: "+v.message)}},f=async p=>{if(confirm("Are you sure you want to delete this lesson?"))try{const{error:v}=await ne.from("lessons").delete().eq("id",p);if(v)throw v;Pe.success("Lesson deleted"),h()}catch(v){Pe.error("Failed to delete: "+v.message)}},m=()=>{u({title:"",description:"",content:"",category:"vowels",order:0}),l(null)},g=p=>{l(p),u({title:p.title,description:p.description,content:p.content,category:p.category,order:p.order}),i(!0)};return a.jsxs(se,{children:[a.jsx(_e,{children:a.jsxs("div",{className:"flex justify-between items-center",children:[a.jsx(Se,{children:"Lesson Management"}),a.jsxs(Ks,{open:s,onOpenChange:i,children:[a.jsx(tz,{asChild:!0,children:a.jsxs(Y,{onClick:m,children:[a.jsx(Ep,{className:"h-4 w-4 mr-2"}),"Add Lesson"]})}),a.jsxs(fs,{className:"max-w-2xl",children:[a.jsx(Ys,{children:a.jsxs(Xs,{children:[o?"Edit":"Create"," Lesson"]})}),a.jsxs("form",{onSubmit:d,className:"space-y-4",children:[a.jsx(Je,{placeholder:"Lesson Title",value:c.title,onChange:p=>u({...c,title:p.target.value}),required:!0}),a.jsx(Je,{placeholder:"Category (e.g., vowels, consonants)",value:c.category,onChange:p=>u({...c,category:p.target.value}),required:!0}),a.jsx(Je,{type:"number",placeholder:"Order",value:c.order,onChange:p=>u({...c,order:parseInt(p.target.value)}),required:!0}),a.jsx(ms,{placeholder:"Description",value:c.description,onChange:p=>u({...c,description:p.target.value}),rows:3}
1005),a.jsx(ms,{placeholder:"Lesson Content (Markdown supported)",value:c.content,onChange:p=>u({...c,content:p.target.value}),rows:8}),a.jsxs(Y,{type:"submit",className:"w-full",children:[o?"Update":"Create"," Lesson"]})]})]})]})]})}),a.jsx(ue,{children:r?a.jsx("p",{children:"Loading..."}):a.jsxs(UE,{children:[a.jsx(WE,{children:a.jsxs(gp,{children:[a.jsx(Ya,{children:"Order"}),a.jsx(Ya,{children:"Title"}),a.jsx(Ya,{children:"Category"}),a.jsx(Ya,{children:"Actions"})]})}),a.jsx(VE,{children:e.map(p=>a.jsxs(gp,{children:[a.jsx(Xa,{children:p.order}),a.jsx(Xa,{children:p.title}),a.jsx(Xa,{children:p.category}),a.jsx(Xa,{children:a.jsxs("div",{className:"flex gap-2",children:[a.jsx(Y,{size:"sm",variant:"outline",onClick:()=>g(p),children:a.jsx(VK,{className:"h-4 w-4"})}),a.jsx(Y,{size:"sm",variant:"destructive",onClick:()=>f(p.id),children:a.jsx(Ls,{className:"h-4 w-4"})})]})})]},p.id))})]})})]})}const zDe=["great","excellent","amazing","wonderful","fantastic","love","perfect","helpful","clear","easy","good","best","awesome","brilliant","useful","effective","enjoyable","impressive","outstanding","superb","thank"],BDe=["bad","terrible","awful","horrible","poor","hate","worst","difficult","confusing","unclear","hard","broken","bug","error","issue","problem","wrong","incorrect","missing","useless","frustrating","disappointed"];function UDe(e){if(!e)return"neutral";const r=e.toLowerCase().split(/\s+/);let n=0,s=0;return r.forEach(i=>{zDe.some(o=>i.includes(o))&&n++,BDe.some(o=>i.includes(o))&&s++}),n>s?"positive":s>n?"negative":"neutral"}function WDe(e){switch(e){case"positive":return"text-green-600 bg-green-50";case"negative":return"text-red-600 bg-red-50";default:return"text-gray-600 bg-gray-50"}}function VDe(e){switch(e){case"positive":return"Positive";case"negative":return"Negative";default:return"Neutral"}}function HDe(){const{user:e}=Jt(),[t,r]=y.useState([]),[n,s]=y.useState([]),[i,o]=y.useState(!0),[l,c]=y.useState("all"),[u,h]=y.useState("all"),[d,f]=y.useState("all"),[m,g]=y.useState(null),[p,v]=y.useState(""),[x,b]=y.useState([]);y.useEffect(()=>{w()},[]),y.useEffect(()=>{j()},[t,l,u,d]);const w=async()=>{try{const{data:C,error:M}=await ne.from("lesson_feedback").select(`
1006          *,
1007          profiles:user_id (full_name, email)
1008        `).order("created_at",{ascending:!1});if(M)throw M;r(C||[]);const I=[...new Set(C==null?void 0:C.map(E=>E.lesson_name).filter(Boolean))];b(I)}catch(C){console.error("Error fetching feedbacks:",C)}finally{o(!1)}},j=()=>{let C=[...t];l!=="all"&&(C=C.filter(M=>M.rating===parseInt(l))),u!=="all"&&(C=C.filter(M=>M.status===u)),d!=="all"&&(C=C.filter(M=>M.lesson_name===d)),s(C)},_=async C=>{if(!(!p.trim()||!e))try{const{error:M}=await ne.from("lesson_feedback").update({instructor_response:p,instructor_id:e.id,responded_at:new Date().toISOString(),status:"reviewed"}).eq("id",C);if(M)throw M;g(null),v(""),w()}catch(M){console.error("Error responding to feedback:",M)}},S=async(C,M)=>{try{const{error:I}=await ne.from("lesson_feedback").update({status:M}).eq("id",C);if(I)throw I;w()}catch(I){console.error("Error updating status:",I)}},k=C=>{switch(C){case"pending":return"bg-yellow-100 text-yellow-800";case"reviewed":return"bg-blue-100 text-blue-800";case"resolved":return"bg-green-100 text-green-800";case"dismissed":return"bg-gray-100 text-gray-800";default:return"bg-gray-100 text-gray-800"}};if(i)return a.jsx("div",{className:"text-center py-8",children:"Loading feedback..."});const P=t.length>0?(t.reduce((C,M)=>C+M.rating,0)/t.length).toFixed(1):"0";return a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-4",children:[a.jsxs(se,{className:"p-4",children:[a.jsx("div",{className:"text-sm text-gray-600",children:"Total Feedback"}),a.jsx("div",{className:"text-2xl font-bold",children:t.length})]}),a.jsxs(se,{className:"p-4",children:[a.jsx("div",{className:"text-sm text-gray-600",children:"Average Rating"}),a.jsxs("div",{className:"text-2xl font-bold flex items-center gap-1",children:[P," ",a.jsx(is,{className:"w-5 h-5 fill-yellow-400 text-yellow-400"})]})]}),a.jsxs(se,{className:"p-4",children:[a.jsx("div",{className:"text-sm text-gray-600",children:"Pending"}),a.jsx("div",{className:"text-2xl font-bold text-yellow-600",children:t.filter(C=>C.status==="pending").length})]}),a.jsxs(se,{className:"p-4",children:[a.jsx("div",{className:"text-sm text-gray-600",children:"Resolved"}),a.jsx("div",{className:"text-2xl font-bold text-green-600",children:t.filter(C=>C.status==="resolved").length})]})]}),a.jsxs(se,{className:"p-4",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[a.jsx(t2,{className:"w-5 h-5"}),a.jsx("span",{className:"font-semibold",children:"Filters"})]}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[a.jsxs(Nr,{value:l,onValueChange:c,children:[a.jsx(gr,{children:a.jsx(kr,{placeholder:"All Ratings"})}),a.jsxs(yr,{children:[a.jsx(Le,{value:"all",children:"All Ratings"}),[5,4,3,2,1].map(C=>a.jsxs(Le,{value:C.toString(),children:[C," Stars"]},C))]})]}),a.jsxs(Nr,{value:u,onValueChange:h,children:[a.jsx(gr,{children:a.jsx(kr,{placeholder:"All Status"})}),a.jsxs(yr,{children:[a.jsx(Le,{value:"all",children:"All Status"}),a.jsx(Le,{value:"pending",children:"Pending"}),a.jsx(Le,{value:"reviewed",children:"Reviewed"}),a.jsx(Le,{value:"resolved",children:"Resolved"}),a.jsx(Le,{value:"dismissed",children:"Dismissed"})]})]}),a.jsxs(Nr,{value:d,onValueChange:f,children:[a.jsx(gr,{children:a.jsx(kr,{placeholder:"All Lessons"})}),a.jsxs(yr,{children:[a.jsx(Le,{value:"all",children:"All Lessons"}),x.map(C=>a.jsx(Le,{value:C,children:C},C))]})]})]})]}),a.jsx("div",{className:"space-y-4",children:n.map(C=>{var I;const M=UDe(C.comment);return a.jsxs(se,{className:"p-6",children:[a.jsxs("div",{className:"flex justify-between items-start mb-4",children:[a.jsxs("div",{children:[a.jsx("div",{className:"font-semibold",children:C.lesson_name}),a.jsxs("div",{className:"text-sm text-gray-600",children:[((I=C.profiles)==null?void 0:I.full_name)||"Anonymous"," • ",new Date(C.created_at).toLocaleDateString()]})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(ke,{className:k(C.status),children:C.status}),C.comment&&a.jsx(ke,{className:WDe(M),children:VDe(M)})]})]}),a.jsx("div",{className:"flex gap-1 mb-3",children:[1,2,3,4,5].map(E=>a.jsx(is,{className:`w-5 h-5 ${E<=C.rating?"fill-yellow-400 text-yellow-400":"text-gray-300"}`},E))}),C.issue_type&&a.jsx(ke,{variant:"outline",className:"mb-3",children:C.issue_type.replace("_"," ")}),C.comment&&a.jsx("p",{className:"text-gray-700 mb-4",children:C.comment}),C.instructor_response&&a.jsxs("div",{className:"bg-blue-50 p-4 rounded mb-4",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(yd,{className:"w-4 h-4 text-blue-600"}),a.jsx("span",{className:"font-semibold text-blue-900",children:"Instructor Response"})]}),a.jsx("p",{className:"text-gray-700",children:C.instructor_response})]}),m===C.id?a.jsxs("div",{className:"space-y-3",children:[a.jsx(ms,{value:p,onChange:E=>v(E.target.value),placeholder:"Write your response...",rows:3}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx(Y,{onClick:()=>_(C.id),children:"Send Response"}),a.jsx(Y,{variant:"outline",onClick:()=>{g(null),v("")},children:"Cancel"})]})]}):a.jsxs("div",{className:"flex gap-2",children:[!C.instructor_response&&a.jsxs(Y,{variant:"outline",onClick:()=>g(C.id),children:[a.jsx(yd,{className:"w-4 h-4 mr-2"}),"Respond"]}),C.status!=="resolved"&&a.jsxs(Y,{variant:"outline",onClick:()=>S(C.id,"resolved"),children:[a.jsx(ot,{className:"w-4 h-4 mr-2"}),"Mark Resolved"]}
1008),C.status!=="dismissed"&&a.jsxs(Y,{variant:"outline",onClick:()=>S(C.id,"dismissed"),children:[a.jsx(jt,{className:"w-4 h-4 mr-2"}),"Dismiss"]})]})]},C.id)})}),n.length===0&&a.jsx("div",{className:"text-center py-12 text-gray-500",children:"No feedback found matching the selected filters."})]})}function qDe(){const[e,t]=y.useState([]),r=async()=>{const n=await iB();t(n)};return a.jsxs("div",{className:"container mx-auto py-8 px-4",children:[a.jsxs("div",{className:"mb-8",children:[a.jsx("h1",{className:"text-4xl font-bold mb-2",children:"Instructor Dashboard"}),a.jsx("p",{className:"text-gray-600",children:"Manage content, monitor student progress, and analyze performance"})]}),a.jsxs(Pn,{defaultValue:"overview",className:"space-y-6",children:[a.jsxs(fn,{className:"grid grid-cols-7 w-full",children:[a.jsxs(Oe,{value:"overview",className:"flex items-center gap-2",children:[a.jsx(p_,{className:"h-4 w-4"}),"Overview"]}),a.jsxs(Oe,{value:"users",className:"flex items-center gap-2",children:[a.jsx(Xn,{className:"h-4 w-4"}),"Users"]}),a.jsxs(Oe,{value:"analytics",className:"flex items-center gap-2",children:[a.jsx(e2,{className:"h-4 w-4"}),"Analytics"]}),a.jsxs(Oe,{value:"lessons",className:"flex items-center gap-2",children:[a.jsx(wa,{className:"h-4 w-4"}),"Lessons"]}),a.jsxs(Oe,{value:"feedback",className:"flex items-center gap-2",children:[a.jsx(yd,{className:"h-4 w-4"}),"Feedback"]}),a.jsxs(Oe,{value:"audio",className:"flex items-center gap-2",children:[a.jsx(vd,{className:"h-4 w-4"}),"Audio"]}),a.jsxs(Oe,{value:"settings",className:"flex items-center gap-2",children:[a.jsx(Sv,{className:"h-4 w-4"}),"Settings"]})]}),a.jsx(ze,{value:"overview",children:a.jsx("div",{className:"grid gap-6",children:a.jsxs(se,{children:[a.jsx(_e,{children:a.jsx(Se,{children:"Welcome to the Admin Dashboard"})}),a.jsxs(ue,{children:[a.jsx("p",{className:"text-gray-600 mb-4",children:"This dashboard provides comprehensive tools to manage your Malayalam learning platform."}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[a.jsxs("div",{className:"p-4 bg-blue-50 rounded-lg",children:[a.jsx("h3",{className:"font-semibold mb-2",children:"User Management"}),a.jsx("p",{className:"text-sm text-gray-600",children:"View and track all student progress, XP, and activity"})]}),a.jsxs("div",{className:"p-4 bg-green-50 rounded-lg",children:[a.jsx("h3",{className:"font-semibold mb-2",children:"Quiz Analytics"}),a.jsx("p",{className:"text-sm text-gray-600",children:"Monitor quiz performance with detailed charts and metrics"})]}),a.jsxs("div",{className:"p-4 bg-purple-50 rounded-lg",children:[a.jsx("h3",{className:"font-semibold mb-2",children:"Content Management"}),a.jsx("p",{className:"text-sm text-gray-600",children:"Create, edit, and organize lessons and audio files"})]})]})]})]})})}),a.jsx(ze,{value:"users",children:a.jsx(ODe,{})}),a.jsx(ze,{value:"analytics",children:a.jsx(LDe,{})}),a.jsx(ze,{value:"lessons",children:a.jsx(FDe,{})}),a.jsx(ze,{value:"feedback",children:a.jsx(HDe,{})}),a.jsx(ze,{value:"audio",children:a.jsxs("div",{className:"space-y-6",children:[a.jsxs(se,{children:[a.jsx(_e,{children:a.jsx(Se,{children:"Bulk Audio Upload"})}),a.jsx(ue,{children:a.jsx(Xz,{onUploadComplete:r})})]}),a.jsx(Yz,{coverageData:e}),a.jsx(sB,{})]})}),a.jsx(ze,{value:"settings",children:a.jsxs(se,{children:[a.jsx(_e,{children:a.jsx(Se,{children:"Admin Settings"})}),a.jsx(ue,{children:a.jsx("p",{className:"text-gray-600",children:"Additional admin settings coming soon..."})})]})})]})]})}const py=["അ","ആ","ഇ","ഈ","ഉ","ഊ","ഋ","എ","ഏ","ഐ","ഒ","ഓ","ഔ"],gj=["ക","ഖ","ഗ","ഘ","ങ","ച","ഛ","ജ","ഝ","ഞ","ട","ഠ","ഡ","ഢ","ണ","ത","ഥ","ദ","ധ","ന","പ","ഫ","ബ","ഭ","മ","യ","ര","ല","വ","ശ","ഷ","സ","ഹ","ള","ഴ","റ"];function GDe(){const[e,t]=y.useState("checking"),[r,n]=y.useState(null),[s,i]=y.useState([]),[o,l]=y.useState(!1),[c,u]=y.useState("ക"),[h,d]=y.useState("consonant-with-a"),[f,m]=y.useState(null),[g,p]=y.useState(null),[v,x]=y.useState(""),[b,w]=y.useState(null),[j,_]=y.useState({}),[S,k]=y.useState(!1),[P,C]=y.useState([]),[M,I]=y.useState(!1),[E,B]=y.useState(null),[A,L]=y.useState("test-audio-upload"),[W,D]=y.useState([]),[U,R]=y.useState(!1),[Q,K]=y.useState(null),z=y.useRef(null);y.useEffect(()=>{N()},[]);const N=async()=>{t("checking");try{const{data:F,error:Z}=await ne.storage.from(jn).list("",{limit:1});if(Z){console.error("Bucket access error:",Z);const H=`${tr}/storage/v1/object/public/${jn}/`;try{const G=await fetch(H,{method:"HEAD"});G.status===400||G.status===404?n({allBuckets:["Unable to list buckets (requires admin key)"],audioBucket:null,isPublic:!1,note:"Cannot verify bucket via listBuckets API. Try uploading a file to test.",listError:Z.message}):n({allBuckets:["audio-files (detected)"],audioBucket:{name:"audio-files"},isPublic:!0,note:"Bucket detected via URL check"})}catch{n({allBuckets:[],audioBucket:null,isPublic:!1,error:Z.message})}t("connected");return}n({allBuckets:["audio-files"],audioBucket:{name:"audio-files"},isPublic:!0,fileCount:(F==null?void 0:F.length)||0,note:"Bucket verified - files can be listed"}),t("connected"),await T()}catch(F){console.error("Connection error:",F),t("error"),n({error:F.message})}},T=async()=>
1008{l(!0);try{const F=await Sle();i(F)}catch(F){console.error("Error loading files:",F)}l(!1)},$=async F=>{g&&g.pause();const Z=new Audio(F);p(Z),m(F),Z.onended=()=>{m(null)},Z.onerror=H=>{console.error("Audio error:",H),m(null),alert("Failed to play audio. Check console for details.")};try{await Z.play()}catch(H){console.error("Play error:",H),m(null)}},V=async()=>{if(v){w(null);try{await p1(v)?(w("success"),$(v)):w("error")}catch{w("error")}}},q=async()=>{I(!0);const F=une(c,h),Z=F.map(H=>({url:H,accessible:null}));C(Z);for(let H=0;H<F.length;H++){const G=await p1(F[H]);Z[H].accessible=G,C([...Z])}I(!1)},te=async()=>{k(!0),$2();const F={};for(const Z of py){const H=await CP(Z,"vowel");F[`vowel:${Z}`]=H}for(const Z of gj){const H=await CP(Z,"consonant-with-a");F[`consonant:${Z}`]=H}_(F),k(!1)},X=F=>{navigator.clipboard.writeText(F),Pe.success("Copied to clipboard!")},ee=(F,Z)=>{const H=F?`${F}/${Z}`:Z;return`${tr}/storage/v1/object/public/${jn}/${H}`},ie=F=>{var H;const Z=(H=F.target.files)==null?void 0:H[0];if(Z){B(Z);const G=Z.name.replace(/\.[^/.]+$/,"");L(G)}},oe=async()=>{if(!E){Pe.error("Please select a file first");return}R(!0),K(null);const F=[{step:"1. Prepare Upload",status:"pending",message:"Preparing file for upload..."},{step:"2. Upload to Supabase",status:"pending",message:"Uploading file to storage bucket..."},{step:"3. Verify File Exists",status:"pending",message:"Checking if file was saved correctly..."},{step:"4. Test File Access",status:"pending",message:"Testing if file is publicly accessible..."},{step:"5. Playback Test",status:"pending",message:"Testing audio playback..."}];D([...F]);try{F[0].status="running",D([...F]);const Z=`${A}.mp3`,H="test-uploads",G=`${tr}/storage/v1/object/public/${jn}/${H}/${Z}`;F[0].status="success",F[0].message=`File prepared: ${E.name} (${(E.size/1024).toFixed(2)} KB)`,F[0].details=`Will upload as: ${H}/${Z}`,D([...F]),F[1].status="running",D([...F]);const re=await Nm(E,H,Z,me=>{F[1].message=`Uploading... ${me}%`,D([...F])});if(!re.success)throw new Error(re.error||"Upload failed");F[1].status="success",F[1].message="File uploaded successfully!",F[1].details=`URL: ${re.url}`,D([...F]),F[2].status="running",D([...F]);const{data:le,error:ce}=await ne.storage.from(jn).list(H);ce?(F[2].status="error",F[2].message="Could not list files in bucket",F[2].details=ce.message):(le==null?void 0:le.some(xe=>xe.name===Z))?(F[2].status="success",F[2].message="File found in storage bucket!",F[2].details=`Found ${(le==null?void 0:le.length)||0} files in ${H}/`):(F[2].status="error",F[2].message="File not found in bucket listing",F[2].details=`Files in bucket: ${(le==null?void 0:le.map(xe=>xe.name).join(", "))||"none"}`),D([...F]),F[3].status="running",D([...F]);const ae=await p1(G);if(ae?(F[3].status="success",F[3].message="File is publicly accessible!",F[3].details=G,K(G)):(F[3].status="error",F[3].message="File is not publicly accessible",F[3].details="Make sure the bucket is set to public in Supabase Dashboard"),D([...F]),F[4].status="running",D([...F]),ae)try{const me=new Audio(G);await new Promise((xe,pe)=>{me.oncanplaythrough=()=>{F[4].status="success",F[4].message="Audio can be played!",F[4].details=`Duration: ${me.duration?me.duration.toFixed(2)+"s":"unknown"}`,xe()},me.onerror=()=>{pe(new Error("Audio failed to load"))},setTimeout(()=>pe(new Error("Audio load timeout")),1e4)})}catch(me){F[4].status="error",F[4].message="Audio playback failed",F[4].details=me.message}else F[4].status="error",F[4].message="Skipped - file not accessible";D([...F]),await T(),Pe.success("Upload test completed!")}catch(Z){console.error("Upload test error:",Z);const H=F.findIndex(G=>G.status==="running");H>=0&&(F[H].status="error",F[H].message="Test failed",F[H].details=Z.message),D([...F]),Pe.error(`Upload test failed: ${Z.message}`)}R(!1)},we=async()=>{if(!Q)return;const F=`${A}.mp3`,Z="test-uploads";try{const{error:H}=await ne.storage.from(jn).remove([`${Z}/${F}`]);if(H)throw H;Pe.success("Test file deleted"),K(null),D([]),await T()}catch(H){Pe.error(`Failed to delete: ${H.message}`)}},O=s.reduce((F,Z)=>{const H=Z.path||"(root)";return F[H]||(F[H]=[]),F[H].push(Z.name),F},{});return a.jsx("div",{className:"min-h-screen bg-gray-50 p-4 md:p-8",children:a.jsxs("div",{className:"max-w-6xl mx-auto 
1008space-y-6",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"text-3xl font-bold text-gray-900",children:"Audio Debug Center"}),a.jsx("p",{className:"text-gray-600 mt-1",children:"Diagnose and fix audio playback issues"})]}),a.jsxs(Y,{onClick:N,variant:"outline",children:[a.jsx(Xt,{className:"h-4 w-4 mr-2"}),"Refresh"]})]}),a.jsxs(se,{children:[a.jsx(_e,{children:a.jsxs(Se,{className:"flex items-center gap-2",children:[a.jsx(Sv,{className:"h-5 w-5"}),"Supabase Connection Status"]})}),a.jsx(ue,{children:a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[e==="checking"&&a.jsx(Fe,{className:"h-5 w-5 animate-spin text-blue-500"}),e==="connected"&&a.jsx(ot,{className:"h-5 w-5 text-green-500"}),e==="error"&&a.jsx(jt,{className:"h-5 w-5 text-red-500"}),a.jsxs("span",{className:"font-medium",children:[e==="checking"&&"Checking connection...",e==="connected"&&"Connected to Supabase",e==="error"&&"Connection Error"]})]}),r&&a.jsxs("div",{className:"bg-gray-100 rounded-lg p-4 space-y-2",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"font-medium",children:"Supabase URL:"}),a.jsx("code",{className:"text-sm bg-white px-2 py-1 rounded",children:tr})]}),r.allBuckets&&a.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[a.jsx("span",{className:"font-medium",children:"Buckets:"}),r.allBuckets.map(F=>a.jsx(ke,{variant:F.includes("audio-files")?"default":"secondary",children:F},F))]}),r.audioBucket?a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(ot,{className:"h-5 w-5 text-green-500"}),a.jsx("span",{className:"font-medium text-green-700",children:"audio-files bucket found!"}),a.jsx(ke,{variant:r.isPublic?"default":"destructive",children:r.isPublic?"PUBLIC":"PRIVATE"})]}),r.note&&a.jsx("p",{className:"text-sm text-gray-600",children:r.note}),r.fileCount!==void 0&&a.jsxs("p",{className:"text-sm text-gray-600",children:["Files accessible: ",r.fileCount,"+"]})]}):a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex items-center gap-2 text-amber-600",children:[a.jsx(Qr,{className:"h-5 w-5"}),a.jsx("span",{className:"font-medium",children:'Cannot verify "audio-files" bucket'})]}),r.note&&a.jsx("p",{className:"text-sm text-gray-600",children:r.note}),r.listError&&a.jsxs("p",{className:"text-sm text-red-600",children:["Error: ",r.listError]}),a.jsxs("div",{className:"bg-amber-50 border border-amber-200 rounded p-3 text-sm",children:[a.jsx("p",{className:"font-medium text-amber-800 mb-1",children:"This might happen because:"}),a.jsxs("ul",{className:"list-disc ml-4 text-amber-700 space-y-1",children:[a.jsx("li",{children:"The bucket doesn't exist yet - create it in Supabase Dashboard → Storage"}),a.jsx("li",{children:"The bucket exists but has no RLS policies for listing - uploads may still work!"}),a.jsx("li",{children:"Try uploading a file using the Upload Test feature to test"})]})]})]}),r.error&&!r.listError&&a.jsxs("div",{className:"text-red-600",children:["Error: ",r.error]})]})]})})]}),a.jsxs(Pn,{defaultValue:"upload-test",children:[a.jsxs(fn,{className:"grid w-full grid-cols-5",children:[a.jsxs(Oe,{value:"upload-test",className:"flex items-center gap-1",children:[a.jsx(Hw,{className:"h-4 w-4"}),"Upload Test"]}),a.jsx(Oe,{value:"files",children:"Files in Storage"}),a.jsx(Oe,{value:"test",children:"Test Character"}),a.jsx(Oe,{value:"url",children:"Test URL"}),a.jsx(Oe,{value:"coverage",children:"Coverage Check"})]}),a.jsx(ze,{value:"upload-test",children:a.jsxs(se,{children:[a.jsxs(_e,{children:[a.jsxs(Se,{className:"flex items-center gap-2",children:[a.jsx(Hw,{className:"h-5 w-5 text-purple-500"}),"Audio Upload Test"]}),a.jsx(hr,{children:"Upload a sample audio file to verify the upload functionality is working correctly"})]}),a.jsxs(ue,{className:"space-y-6",children:[a.jsxs("div",{className:"bg-gradient-to-r from-purple-50 to-indigo-50 rounded-lg p-6 border border-purple-200",children:[a.jsx("h3",{className:"font-semibold text-purple-800 mb-4",children:"Step 1: Select an Audio File"}),a.jsx("input",{ref:z,type:"file",accept:"audio/*",onChange:ie,className:"hidden"}),a.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 items-start sm:items-center",children:[a.jsxs(Y,{onClick:()=>{var F;return(F=z.current)==null?void 0:F.click()},variant:"outline",className:"flex-shrink-0",children:[a.jsx(EK,{className:"h-4 w-4 mr-2"}),"Choose Audio File"]}),E&&a.jsxs("div",{className:"flex items-center gap-2 bg-white px-3 py-2 rounded-lg border",children:[a.jsx(wv,{className:"h-4 w-4 text-purple-500"}),a.jsx("span",{className:"text-sm font-medium",children:E.name}),a.jsxs(ke,{variant:"secondary",children:[(E.size/1024).toFixed(1)," KB"]}
1008)]})]}),E&&a.jsxs("div",{className:"mt-4",children:[a.jsx("label",{className:"block text-sm font-medium text-purple-700 mb-1",children:"Save as filename (without extension):"}),a.jsx(Je,{value:A,onChange:F=>L(F.target.value),placeholder:"test-audio-upload",className:"max-w-md"}),a.jsxs("p",{className:"text-xs text-purple-600 mt-1",children:["Will be saved as: test-uploads/",A,".mp3"]})]})]}),a.jsxs("div",{className:"flex gap-3",children:[a.jsx(Y,{onClick:oe,disabled:!E||U,className:"bg-purple-600 hover:bg-purple-700",size:"lg",children:U?a.jsxs(a.Fragment,{children:[a.jsx(Fe,{className:"h-4 w-4 mr-2 animate-spin"}),"Running Test..."]}):a.jsxs(a.Fragment,{children:[a.jsx(Hw,{className:"h-4 w-4 mr-2"}),"Run Upload Test"]})}),Q&&a.jsxs(Y,{onClick:we,variant:"outline",className:"text-red-600 border-red-300 hover:bg-red-50",children:[a.jsx(Ls,{className:"h-4 w-4 mr-2"}),"Delete Test File"]})]}),W.length>0&&a.jsxs("div",{className:"bg-gray-50 rounded-lg p-4 border",children:[a.jsx("h3",{className:"font-semibold mb-4",children:"Test Results"}),a.jsx("div",{className:"space-y-3",children:W.map((F,Z)=>a.jsx("div",{className:`p-3 rounded-lg border ${F.status==="success"?"bg-green-50 border-green-200":F.status==="error"?"bg-red-50 border-red-200":F.status==="running"?"bg-blue-50 border-blue-200":"bg-white border-gray-200"}`,children:a.jsxs("div",{className:"flex items-center gap-3",children:[F.status==="pending"&&a.jsx("div",{className:"h-5 w-5 rounded-full border-2 border-gray-300"}),F.status==="running"&&a.jsx(Fe,{className:"h-5 w-5 animate-spin text-blue-500"}),F.status==="success"&&a.jsx(ot,{className:"h-5 w-5 text-green-500"}),F.status==="error"&&a.jsx(jt,{className:"h-5 w-5 text-red-500"}),a.jsxs("div",{className:"flex-1",children:[a.jsx("div",{className:"font-medium text-sm",children:F.step}),a.jsx("div",{className:"text-sm text-gray-600",children:F.message}),F.details&&a.jsx("div",{className:"text-xs text-gray-500 mt-1 font-mono break-all",children:F.details})]})]})},Z))})]}),Q&&a.jsxs("div",{className:"bg-green-50 rounded-lg p-4 border border-green-200",children:[a.jsxs("h3",{className:"font-semibold text-green-800 mb-3 flex items-center gap-2",children:[a.jsx(ot,{className:"h-5 w-5"}),"Upload Successful!"]}),a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-sm font-medium",children:"File URL:"}),a.jsx("code",{className:"text-xs bg-white px-2 py-1 rounded flex-1 overflow-x-auto",children:Q}),a.jsx(Y,{size:"sm",variant:"ghost",onClick:()=>X(Q),children:a.jsx(Jl,{className:"h-4 w-4"})})]}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx(Y,{onClick:()=>$(Q),className:"bg-green-600 hover:bg-green-700",children:f===Q?a.jsxs(a.Fragment,{children:[a.jsx(ss,{className:"h-4 w-4 mr-2"}),"Stop"]}):a.jsxs(a.Fragment,{children:[a.jsx(Bt,{className:"h-4 w-4 mr-2"}),"Play Uploaded File"]})}),a.jsxs(Y,{variant:"outline",onClick:()=>window.open(Q,"_blank"),children:[a.jsx(md,{className:"h-4 w-4 mr-2"}),"Open in Browser"]})]})]})]}),a.jsxs("div",{className:"bg-amber-50 border border-amber-200 rounded-lg p-4",children:[a.jsx("h4",{className:"font-semibold text-amber-800 mb-2",children:"Troubleshooting Tips"}),a.jsxs("ul",{className:"text-sm text-amber-700 space-y-1 list-disc ml-4",children:[a.jsxs("li",{children:["If upload fails, make sure the ",a.jsx("strong",{children:"audio-files"})," bucket exists in Supabase"]}),a.jsxs("li",{children:["If file is not accessible, make sure the bucket is set to ",a.jsx("strong",{children:"Public"})]}),a.jsx("li",{children:"Check that storage policies allow uploads (INSERT) and reads (SELECT)"}),a.jsxs("li",{children:["The test uploads to a ",a.jsx("strong",{children:"test-uploads/"})," folder to avoid conflicts"]})]})]})]})]})}),a.jsx(ze,{value:"files",children:a.jsxs(se,{children:[a.jsxs(_e,{children:[a.jsxs(Se,{className:"flex items-center gap-2",children:[a.jsx(Zl,{className:"h-5 w-5"}),"Files in Supabase Storage"]}),a.jsx(hr,{children:"All files found in your audio-files bucket (including root level)"})]}),a.jsx(ue,{children:o?a.jsx("div",{className:"flex items-center justify-center py-8",children:a.jsx(Fe,{className:"h-8 w-8 animate-spin"})}):a.jsxs("div",{className:"space-y-6",children:[a.jsx("div",{className:"bg-blue-50 border border-blue-200 rounded-lg p-4",children:a.jsxs("p",{className:"text-sm text-blue-800",children:[a.jsx("strong",{children:"Total files found:"})," ",s.length]})}),Object.entries(O).map(([F,Z])=>a.jsxs("div",{className:"border rounded-lg p-4",children:[a.jsxs("div",{className:"flex items-center justify-between mb-3",children:[a.jsxs("h3",{className:"font-semibold flex items-center gap-2",children:[a.jsx(Zl,{className:"h-4 w-4"}),F==="(root)"?"Root Level (no folder)":`${F}/`]}),a.jsxs(ke,{children:[Z.length," files"]})]}),Z.length>0?a.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 lg:grid-cols-6 gap-2",children:Z.map(H=>{const G=ee(F==="(root)"?"":F,H);return a.jsxs("div",{className:"flex items-center gap-1 bg-gray-100 rounded px-2 py-1 text-xs",children:[a.jsx(wv,{className:"h-3 w-3 text-blue-500 flex-shrink-0"}),a.jsx("span",{className:"truncate flex-1",title:H,children:H}),a.jsx(Y,{size:"sm",variant:"ghost",className:"h-5 w-5 p-0 flex-shrink-0",onClick:()=>$(G),children:f===G?a.jsx(ss,{className:"h-3 w-3"}):a.jsx(Bt,{className:"h-3 w-3"})})]},H)})}):a.jsx("p",{className:"text-gray-500 text-sm",children:"No files found in this directory"})]},F)),a.jsxs(Y,{onClick:T,variant:"outline",className:"w-full",children:[a.jsx(Xt,{className:"h-4 w-4 mr-2"}),"Reload Files"]})]})})]})}),a.jsx(ze,{value:"test",children:a.jsxs(se,{children:[a.jsxs(_e,{children:[a.jsx(Se,{children:"Test Specific Character"}),a.jsx(hr,{children:"Enter a Malayalam character to see all possible URLs the system will try"})]}),a.jsxs(ue,{className:"space-y-4",children:[a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium mb-1",children:"Character"}),a.jsx(Je,{value:c,onChange:F=>u(F.target.value),className:"text-3xl text-center h-16",placeholder:"ക"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium mb-1",children:"Type"}),a.jsxs("select",{value:h,onChange:F=>d(F.target.value),className:"w-full border rounded-md p-2 h-16",children:[a.jsx("option",{value:"consonant-with-a",children:"Consonant (with inherent 'a')"}),a.jsx("option",{value:"vowel",children:"Vowel"})]})]}),a.jsxs("div",{className:"flex items-end gap-2",children:[a.jsx(Y,{onClick:q,variant:"outline",className:"flex-1 h-16",disabled:M,children:M?a.jsx(Fe,{className:"h-4 w-4 animate-spin"}):"Check URLs"}),a.jsxs(Y,{onClick:()=>Fr(c,{type:h}),className:"flex-1 h-16",children:[a.jsx(Xe,{className:"h-5 w-5 mr-2"}),"Play"]})]})]}),P.length>0&&a.jsxs("div",{className:"bg-blue-50 rounded-lg p-4 space-y-3",children:[a.jsx("h4",{className:"font-semibold",children:"URLs the system will try (in order):"}),a.jsx("div",{className:"space-y-2",children:P.map((F,Z)=>a.jsxs("div",{className:`flex items-center gap-2 p-2 rounded ${F.accessible===!0?"bg-green-100":F.accessible===!1?"bg-red-100":"bg-white"}`,children:[a.jsxs("span",{className:"text-sm font-medium w-6",children:[Z+1,"."]}
1008),F.accessible===null&&a.jsx(Fe,{className:"h-4 w-4 animate-spin"}),F.accessible===!0&&a.jsx(ot,{className:"h-4 w-4 text-green-500"}),F.accessible===!1&&a.jsx(jt,{className:"h-4 w-4 text-red-500"}),a.jsx("code",{className:"text-xs flex-1 overflow-x-auto",children:F.url}),a.jsx(Y,{size:"sm",variant:"ghost",onClick:()=>X(F.url),className:"h-6 w-6 p-0",children:a.jsx(Jl,{className:"h-3 w-3"})}),F.accessible&&a.jsx(Y,{size:"sm",variant:"ghost",onClick:()=>$(F.url),className:"h-6 w-6 p-0",children:a.jsx(Bt,{className:"h-3 w-3"})})]},Z))}),P.some(F=>F.accessible)&&a.jsx("p",{className:"text-green-600 text-sm font-medium",children:"Found a working URL! Audio should play."}),!M&&P.every(F=>F.accessible===!1)&&a.jsx("p",{className:"text-red-600 text-sm font-medium",children:"No working URL found. Please upload the audio file."})]}),a.jsxs("div",{className:"bg-amber-50 border border-amber-200 rounded-lg p-4",children:[a.jsx("h4",{className:"font-semibold text-amber-800 mb-2",children:"Quick Test Characters:"}),a.jsx("div",{className:"flex flex-wrap gap-2",children:["ക","അ","ആ","ച","ട","ത","പ","മ","യ","ര","ല","വ","ശ","ഷ","സ","ഹ"].map(F=>a.jsx(Y,{variant:"outline",size:"sm",onClick:()=>{u(F),d(py.includes(F)?"vowel":"consonant-with-a"),C([])},className:"text-xl",children:F},F))})]})]})]})}),a.jsx(ze,{value:"url",children:a.jsxs(se,{children:[a.jsxs(_e,{children:[a.jsx(Se,{children:"Test Direct URL"}),a.jsx(hr,{children:"Paste a Supabase storage URL to test if it's accessible"})]}),a.jsxs(ue,{className:"space-y-4",children:[a.jsxs("div",{className:"flex gap-2",children:[a.jsx(Je,{value:v,onChange:F=>x(F.target.value),placeholder:`${tr}/storage/v1/object/public/audio-files/...`,className:"flex-1"}),a.jsx(Y,{onClick:V,children:"Test & Play"})]}),b&&a.jsx("div",{className:`p-4 rounded-lg ${b==="success"?"bg-green-50 border-green-200":"bg-red-50 border-red-200"} border`,children:a.jsxs("div",{className:"flex items-center gap-2",children:[b==="success"?a.jsx(ot,{className:"h-5 w-5 text-green-500"}):a.jsx(jt,{className:"h-5 w-5 text-red-500"}),a.jsx("span",{children:b==="success"?"URL is accessible!":"URL is not accessible. Check if bucket is public."})]})}),a.jsxs("div",{className:"bg-gray-50 rounded-lg p-4",children:[a.jsx("h4",{className:"font-semibold mb-2",children:"Example URLs the system tries:"}),a.jsxs("div",{className:"space-y-2 text-sm",children:[a.jsxs("div",{children:[a.jsx("span",{className:"font-medium",children:"Vowel 'അ' (tries in order):"}),a.jsxs("ol",{className:"mt-1 text-xs space-y-1 ml-4 list-decimal",children:[a.jsxs("li",{children:[a.jsx("code",{className:"bg-white px-1 rounded",children:"a.mp3"})," (root)"]}),a.jsx("li",{children:a.jsx("code",{className:"bg-white px-1 rounded",children:"vowels/a.mp3"})}),a.jsx("li",{children:a.jsx("code",{className:"bg-white px-1 rounded",children:"vowel_a.mp3"})})]})]}),a.jsxs("div",{children:[a.jsx("span",{className:"font-medium",children:"Consonant 'ക' (tries in order):"}),a.jsxs("ol",{className:"mt-1 text-xs space-y-1 ml-4 list-decimal",children:[a.jsxs("li",{children:[a.jsx("code",{className:"bg-white px-1 rounded",children:"ka.mp3"})," (root)"]}),a.jsx("li",{children:a.jsx("code",{className:"bg-white px-1 rounded",children:"consonants/ka.mp3"})}),a.jsx("li",{children:a.jsx("code",{className:"bg-white px-1 rounded",children:"consonants/with-a/ka.mp3"})}),a.jsx("li",{children:a.jsx("code",{className:"bg-white px-1 rounded",children:"consonants/with-a/ka_with_a.mp3"})})]})]})]})]})]})]})}),a.jsx(ze,{value:"coverage",children:a.jsxs(se,{children:[a.jsxs(_e,{children:[a.jsx(Se,{children:"Audio Coverage Check"}),a.jsx(hr,{children:"Check which characters have audio files available (tries all URL patterns)"})]}),a.jsxs(ue,{className:"space-y-4",children:[a.jsx(Y,{onClick:te,disabled:S,className:"w-full",children:S?a.jsxs(a.Fragment,{children:[a.jsx(Fe,{className:"h-4 w-4 mr-2 animate-spin"}),"Checking all characters (this may take a minute)..."]}):a.jsxs(a.Fragment,{children:[a.jsx(Xt,{className:"h-4 w-4 mr-2"}),"Check All Audio Files"]})}),Object.keys(j).length>0&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"border rounded-lg p-4",children:[a.jsxs("h4",{className:"font-semibold mb-3",children:["Vowels (",py.length,")"]}),a.jsx("div",{className:"grid grid-cols-6 md:grid-cols-13 gap-2",children:py.map(F=>
1008a.jsxs("div",{className:`text-center p-2 rounded-lg cursor-pointer ${j[`vowel:${F}`]?"bg-green-100 border-green-300 hover:bg-green-200":"bg-red-100 border-red-300 hover:bg-red-200"} border`,onClick:()=>Fr(F,{type:"vowel"}),children:[a.jsx("div",{className:"text-2xl",children:F}),j[`vowel:${F}`]?a.jsx(ot,{className:"h-4 w-4 text-green-500 mx-auto"}):a.jsx(jt,{className:"h-4 w-4 text-red-500 mx-auto"})]},F))})]}),a.jsxs("div",{className:"border rounded-lg p-4",children:[a.jsxs("h4",{className:"font-semibold mb-3",children:["Consonants (",gj.length,")"]}),a.jsx("div",{className:"grid grid-cols-5 md:grid-cols-9 gap-2",children:gj.map(F=>a.jsxs("div",{className:`text-center p-2 rounded-lg cursor-pointer ${j[`consonant:${F}`]?"bg-green-100 border-green-300 hover:bg-green-200":"bg-red-100 border-red-300 hover:bg-red-200"} border`,onClick:()=>Fr(F,{type:"consonant-with-a"}),children:[a.jsx("div",{className:"text-2xl",children:F}),j[`consonant:${F}`]?a.jsx(ot,{className:"h-4 w-4 text-green-500 mx-auto"}):a.jsx(jt,{className:"h-4 w-4 text-red-500 mx-auto"})]},F))})]}),a.jsxs("div",{className:"bg-gray-50 rounded-lg p-4",children:[a.jsx("h4",{className:"font-semibold mb-2",children:"Summary:"}),a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsx("div",{children:a.jsxs("span",{className:"text-green-600 font-medium",children:["Available: ",Object.values(j).filter(F=>F).length]})}),a.jsx("div",{children:a.jsxs("span",{className:"text-red-600 font-medium",children:["Missing: ",Object.values(j).filter(F=>!F).length]})})]})]})]})]})]})})]}),a.jsxs(se,{className:"bg-gradient-to-r from-indigo-50 to-purple-50",children:[a.jsx(_e,{children:a.jsx(Se,{children:"How to Fix Audio Issues"})}),a.jsxs(ue,{className:"space-y-4",children:[a.jsxs("div",{className:"bg-green-50 border border-green-200 rounded-lg p-4",children:[a.jsx("h4",{className:"font-semibold text-green-800 mb-2",children:"Good News: Flexible URL Support"}),a.jsx("p",{className:"text-sm text-green-700",children:"The system now tries multiple URL patterns automatically. You can store files in ANY of these ways:"}),a.jsxs("ul",{className:"text-sm text-green-700 mt-2 space-y-1 ml-4 list-disc",children:[a.jsxs("li",{children:[a.jsx("strong",{children:"Root level:"})," Just upload ",a.jsx("code",{children:"ka.mp3"}),", ",a.jsx("code",{children:"a.mp3"})," directly to the bucket"]}),a.jsxs("li",{children:[a.jsx("strong",{children:"Simple folders:"})," ",a.jsx("code",{children:"consonants/ka.mp3"}),", ",a.jsx("code",{children:"vowels/a.mp3"})]}),a.jsxs("li",{children:[a.jsx("strong",{children:"Full structure:"})," ",a.jsx("code",{children:"consonants/with-a/ka_with_a.mp3"})]})]})]}),a.jsxs("div",{className:"grid md:grid-cols-2 gap-6",children:[a.jsxs("div",{children:[a.jsx("h4",{className:"font-semibold text-indigo-800 mb-2",children:"1. Make Bucket Public"}),a.jsxs("ol",{className:"text-sm space-y-1 list-decimal ml-4",children:[a.jsx("li",{children:"Go to Supabase Dashboard → Storage"}),a.jsx("li",{children:'Click on "audio-files" bucket'}),a.jsx("li",{children:"Click Settings (gear icon)"}),a.jsx("li",{children:'Toggle "Public bucket" ON'}),a.jsx("li",{children:"Save changes"})]})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-semibold text-indigo-800 mb-2",children:"2. Simplest File Structure"}),a.jsx("pre",{className:"text-xs bg-white p-3 rounded overflow-x-auto",children:`audio-files/
1009├── ka.mp3      (consonant ക)
1010├── kha.mp3     (consonant ഖ)
1011├── ga.mp3      (consonant ഗ)
1012├── a.mp3       (vowel അ)
1013├── aa.mp3      (vowel ആ)
1014├── i.mp3       (vowel ഇ)
1015└── ...`})]})]}),a.jsxs("div",{className:"bg-white rounded-lg p-4",children:[a.jsx("h4",{className:"font-semibold text-indigo-800 mb-2",children:"3. File Naming Convention"}),a.jsxs("div",{className:"grid md:grid-cols-3 gap-4 text-sm",children:[a.jsxs("div",{children:[a.jsx("strong",{children:"Vowels:"}),a.jsxs("ul",{className:"mt-1 text-xs",children:[a.jsx("li",{children:"അ → a.mp3"}),a.jsx("li",{children:"ആ → aa.mp3"}),a.jsx("li",{children:"ഇ → i.mp3"}),a.jsx("li",{children:"ഈ → ii.mp3"}),a.jsx("li",{children:"ഉ → u.mp3"}),a.jsx("li",{children:"ഊ → uu.mp3"})]})]}),a.jsxs("div",{children:[a.jsx("strong",{children:"Consonants:"}),a.jsxs("ul",{className:"mt-1 text-xs",children:[a.jsx("li",{children:"ക → ka.mp3"}),a.jsx("li",{children:"ഖ → kha.mp3"}),a.jsx("li",{children:"ഗ → ga.mp3"}),a.jsx("li",{children:"ച → cha.mp3"}),a.jsx("li",{children:"ട → tta.mp3"}),a.jsx("li",{children:"ത → tha.mp3"})]})]}),a.jsxs("div",{children:[a.jsx("strong",{children:"Special Names:"}),a.jsxs("ul",{className:"mt-1 text-xs",children:[a.jsx("li",{children:"ട (retroflex) → tta"}),a.jsx("li",{children:"ത (dental) → tha"}),a.jsx("li",{children:"ഷ → shha"}),a.jsx("li",{children:"ള → lla"}),a.jsx("li",{children:"ഴ → zha"}),a.jsx("li",{children:"റ → rra"})]})]})]})]})]})]})]})})}const jl="audio-files";function KDe(){const[e,t]=y.useState([]),[r,n]=y.useState(!0),[s,i]=y.useState(!1),[o,l]=y.useState(null),[c,u]=y.useState(null),h=y.useRef(null);y.useEffect(()=>{d()},[]);const d=async()=>{n(!0),i(!1),await f();const j=await m();t(j),n(!1),await p(j)},f=async()=>{try{const{data:j,error:_}=await ne.storage.listBuckets();if(_){l({exists:!1,isPublic:!1,error:_.message});return}const S=j==null?void 0:j.find(k=>k.name===jl);if(!S){l({exists:!1,isPublic:!1,error:`Bucket "${jl}" not found`});return}l({exists:!0,isPublic:S.public})}catch(j){l({exists:!1,isPublic:!1,error:j.message})}},m=async()=>{const j=[];try{const{data:_,error:S}=await ne.storage.from(jl).list("",{limit:1e3});if(S)return console.error("Error listing root:",S),[];if(_)for(const k of _)if(k.metadata!==null){const P=`${tr}/storage/v1/object/public/${jl}/${k.name}`;j.push({path:"",name:k.name,fullPath:k.name,url:P,status:"pending"})}else await g(k.name,j)}catch(_){console.error("Error loading files:",_)}return j},g=async(j,_)=>{try{const{data:S,error:k}=await ne.storage.from(jl).list(j,{limit:1e3});if(k||!S)return;for(const P of S){const C=`${j}/${P.name}`;if(P.metadata!==null){const M=`${tr}/storage/v1/object/public/${jl}/${C}`;_.push({path:j,name:P.name,fullPath:C,url:M,status:"pending"})}else await g(C,_)}}catch(S){console.error(`Error listing folder ${j}:`,S)}},p=async j=>{i(!0),t(j.map(_=>({..._,status:"checking"})));for(let _=0;_<j.length;_++){const S=j[_];try{const k=await fetch(S.url,{method:"HEAD",cache:"no-cache"});t(P=>P.map((C,M)=>M===_?{...C,status:k.ok?"success":"error",httpStatus:k.status,errorMessage:k.ok?void 0:`HTTP ${k.status}`}:C))}catch(k){t(P=>P.map((C,M)=>M===_?{...C,status:"error",errorMessage:k.message||"Network error"}:C))}}i(!1)},v=j=>{if(h.current&&h.current.pause(),c===j){u(null);return}const _=new Audio(j);
1015h.current=_,u(j),_.onended=()=>u(null),_.onerror=S=>{console.error("Audio playback error:",S),u(null),alert(`Failed to play audio.
1016URL: ${j}
1017
1018This usually means the storage policy is blocking access.`)},_.play().catch(S=>{console.error("Play error:",S),u(null)})},x=j=>{navigator.clipboard.writeText(j)},b=e.filter(j=>j.status==="success").length,w=e.filter(j=>j.status==="error").length;return a.jsx("div",{className:"min-h-screen bg-gradient-to-br from-slate-50 to-slate-100 p-4 md:p-8",children:a.jsxs("div",{className:"max-w-6xl mx-auto space-y-6",children:[a.jsxs("div",{className:"flex flex-col md:flex-row md:items-center justify-between gap-4",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"text-3xl font-bold text-slate-900",children:"Audio Storage Test"}),a.jsx("p",{className:"text-slate-600 mt-1",children:"Test all audio files in your Supabase storage bucket"})]}),a.jsxs(Y,{onClick:d,disabled:r||s,size:"lg",className:"bg-indigo-600 hover:bg-indigo-700",children:[r||s?a.jsx(Fe,{className:"h-5 w-5 mr-2 animate-spin"}):a.jsx(Xt,{className:"h-5 w-5 mr-2"}),"Refresh & Re-check All"]})]}),a.jsx(se,{className:`border-2 ${o!=null&&o.isPublic?"border-green-300 bg-green-50":o!=null&&o.exists?"border-yellow-300 bg-yellow-50":"border-red-300 bg-red-50"}`,children:a.jsx(ue,{className:"pt-6",children:a.jsxs("div",{className:"flex items-start gap-4",children:[o!=null&&o.isPublic?a.jsx(ot,{className:"h-8 w-8 text-green-600 flex-shrink-0"}):o!=null&&o.exists?a.jsx(Qr,{className:"h-8 w-8 text-yellow-600 flex-shrink-0"}):a.jsx(jt,{className:"h-8 w-8 text-red-600 flex-shrink-0"}),a.jsxs("div",{className:"flex-1",children:[a.jsx("h3",{className:"font-semibold text-lg",children:o!=null&&o.isPublic?"Bucket is Public":o!=null&&o.exists?"Bucket is NOT Public!":"Bucket Not Found"}),a.jsxs("div",{className:"mt-2 space-y-1 text-sm",children:[a.jsxs("p",{children:[a.jsx("strong",{children:"Supabase URL:"})," ",a.jsx("code",{className:"bg-white/50 px-2 py-0.5 rounded",children:tr})]}),a.jsxs("p",{children:[a.jsx("strong",{children:"Bucket Name:"})," ",a.jsx("code",{className:"bg-white/50 px-2 py-0.5 rounded",children:jl})]}),a.jsxs("p",{children:[a.jsx("strong",{children:"Status:"})," ",o!=null&&o.exists?o.isPublic?"Public":"Private":"Not Found"]})]}),!(o!=null&&o.isPublic)&&(o==null?void 0:o.exists)&&a.jsxs("div",{className:"mt-4 p-4 bg-white rounded-lg border border-yellow-400",children:[a.jsx("p",{className:"font-medium text-yellow-800 mb-2",children:"Your bucket exists but is NOT public. Audio won't play!"}),a.jsx("p",{className:"text-sm text-yellow-700 mb-3",children:"Run this SQL in your Supabase SQL Editor to fix:"}),a.jsx("pre",{className:"bg-slate-900 text-green-400 p-3 rounded text-xs overflow-x-auto",children:`-- Allow public read access to audio files
1019CREATE POLICY "Allow public read access on audio-files"
1020ON storage.objects FOR SELECT
1021USING (bucket_id = 'audio-files');`}),a.jsxs(Y,{variant:"outline",size:"sm",className:"mt-2",onClick:()=>x(`CREATE POLICY "Allow public read access on audio-files"
1022ON storage.objects FOR SELECT
1023USING (bucket_id = 'audio-files');`),children:[a.jsx(Jl,{className:"h-4 w-4 mr-2"}),"Copy SQL"]})]}),(o==null?void 0:o.error)&&a.jsxs("p",{className:"mt-2 text-red-600 text-sm",children:["Error: ",o.error]})]})]})})}),a.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[a.jsx(se,{children:a.jsxs(ue,{className:"pt-6 text-center",children:[a.jsx("div",{className:"text-4xl font-bold text-slate-700",children:e.length}),a.jsx("div",{className:"text-sm text-slate-500 mt-1",children:"Total Files"})]})}),a.jsx(se,{className:"bg-green-50 border-green-200",children:a.jsxs(ue,{className:"pt-6 text-center",children:[a.jsx("div",{className:"text-4xl font-bold text-green-600",children:b}),a.jsx("div",{className:"text-sm text-green-700 mt-1",children:"Accessible (200 OK)"})]})}),a.jsx(se,{className:"bg-red-50 border-red-200",children:a.jsxs(ue,{className:"pt-6 text-center",children:[a.jsx("div",{className:"text-4xl font-bold text-red-600",children:w}),a.jsx("div",{className:"text-sm text-red-700 mt-1",children:"Errors"})]})})]}),a.jsxs(se,{children:[a.jsx(_e,{children:a.jsxs(Se,{className:"flex items-center gap-2",children:[a.jsx(Zl,{className:"h-5 w-5"}),"All Files in Bucket",s&&a.jsx(Fe,{className:"h-4 w-4 animate-spin ml-2"})]})}),a.jsx(ue,{children:r?a.jsxs("div",{className:"flex items-center justify-center py-12",children:[a.jsx(Fe,{className:"h-8 w-8 animate-spin text-indigo-600"}),a.jsx("span",{className:"ml-3 text-slate-600",children:"Loading files from storage..."})]}):e.length===0?a.jsxs("div",{className:"text-center py-12 text-slate-500",children:[a.jsx(Zl,{className:"h-12 w-12 mx-auto mb-4 opacity-50"}),a.jsx("p",{children:"No files found in the bucket."}),a.jsx("p",{className:"text-sm mt-2",children:"Upload some audio files to your Supabase storage bucket."})]}):a.jsx("div",{className:"space-y-2",children:e.map((j,_)=>a.jsxs("div",{className:`flex items-center gap-3 p-3 rounded-lg border ${j.status==="success"?"bg-green-50 border-green-200":j.status==="error"?"bg-red-50 border-red-200":j.status==="checking"?"bg-blue-50 border-blue-200":"bg-slate-50 border-slate-200"}`,children:[a.jsxs("div",{className:"flex-shrink-0",children:[j.status==="checking"&&a.jsx(Fe,{className:"h-5 w-5 animate-spin text-blue-500"}),j.status==="success"&&a.jsx(ot,{className:"h-5 w-5 text-green-500"}),j.status==="error"&&a.jsx(jt,{className:"h-5 w-5 text-red-500"}),j.status==="pending"&&a.jsx("div",{className:"h-5 w-5 rounded-full border-2 border-slate-300"})]}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"font-medium text-slate-900",children:j.name}),j.path&&a.jsx(ke,{variant:"secondary",className:"text-xs",children:j.path})]}),a.jsx("div",{className:"text-xs text-slate-500 mt-1 font-mono truncate",children:j.url})]}),a.jsxs("div",{className:"flex-shrink-0",children:[j.status==="success"&&a.jsx(ke,{className:"bg-green-600",children:"200 OK"}),j.status==="error"&&a.jsx(ke,{variant:"destructive",children:j.httpStatus?`${j.httpStatus}`:"Error"}),j.status==="checking"&&a.jsx(ke,{variant:"secondary",children:"Checking..."})]}),a.jsxs("div",{className:"flex items-center gap-1 flex-shrink-0",children:[a.jsx(Y,{size:"sm",variant:"ghost",onClick:()=>v(j.url),disabled:j.status!=="success",className:"h-8 w-8 p-0",title:"Play audio",children:c===j.url?a.jsx(ss,{className:"h-4 w-4"}):a.jsx(Bt,{className:"h-4 w-4"})}),a.jsx(Y,{size:"sm",variant:"ghost",onClick:()=>x(j.url),className:"h-8 w-8 p-0",title:"Copy URL",children:a.jsx(Jl,{className:"h-4 w-4"})}),a.jsx(Y,{size:"sm",variant:"ghost",onClick:()=>window.open(j.url,"_blank"),className:"h-8 w-8 p-0",title:"Open in new tab",children:a.jsx(md,{className:"h-4 w-4"})})]})]},j.fullPath))})})]}),a.jsxs(se,{className:"bg-gradient-to-r from-indigo-50 to-purple-50 border-indigo-200",children:[a.jsx(_e,{children:a.jsx(Se,{className:"text-indigo-900",children:"Qu
1023ick Fix: Storage Policy"})}),a.jsxs(ue,{className:"space-y-4",children:[a.jsx("p",{className:"text-indigo-800",children:`If files show as "Error" or won't play, your storage policy is blocking public access.`}),a.jsxs("div",{className:"bg-white rounded-lg p-4 border border-indigo-200",children:[a.jsx("h4",{className:"font-semibold mb-2",children:"Option 1: SQL Editor (Recommended)"}),a.jsx("p",{className:"text-sm text-slate-600 mb-2",children:"Go to Supabase Dashboard → SQL Editor → Run this:"}),a.jsx("pre",{className:"bg-slate-900 text-green-400 p-3 rounded text-sm overflow-x-auto",children:`-- Allow anyone to read audio files
1024CREATE POLICY "Public read for audio-files"
1025ON storage.objects FOR SELECT
1026USING (bucket_id = 'audio-files');`}),a.jsxs(Y,{variant:"outline",size:"sm",className:"mt-2",onClick:()=>x(`CREATE POLICY "Public read for audio-files"
1027ON storage.objects FOR SELECT
1028USING (bucket_id = 'audio-files');`),children:[a.jsx(Jl,{className:"h-4 w-4 mr-2"}),"Copy SQL"]})]}),a.jsxs("div",{className:"bg-white rounded-lg p-4 border border-indigo-200",children:[a.jsx("h4",{className:"font-semibold mb-2",children:"Option 2: Dashboard UI"}),a.jsxs("ol",{className:"text-sm text-slate-600 space-y-1 list-decimal ml-4",children:[a.jsx("li",{children:"Go to Storage → Policies"}),a.jsxs("li",{children:["Find ",a.jsx("code",{children:"storage.objects"})," section"]}),a.jsx("li",{children:'Click "New Policy"'}),a.jsx("li",{children:'Select "For full customization"'}),a.jsxs("li",{children:["Name: ",a.jsx("code",{children:"Public read for audio-files"})]}),a.jsxs("li",{children:["Operation: ",a.jsx("code",{children:"SELECT"})]}),a.jsx("li",{children:"Target roles: Leave empty (allows all)"}),a.jsxs("li",{children:["USING expression: ",a.jsx("code",{children:"bucket_id = 'audio-files'"})]}),a.jsx("li",{children:"Save"})]})]}),a.jsxs("div",{className:"flex items-center gap-2 text-sm text-indigo-700",children:[a.jsx(Qr,{className:"h-4 w-4"}),'After adding the policy, click "Refresh & Re-check All" above to verify.']})]})]})]})})}function YDe(){const[e,t]=y.useState([]),[r,n]=y.useState(!0),[s,i]=y.useState(null),[o,l]=y.useState(!1),[c,u]=y.useState(null),[h,d]=y.useState(!1),[f,m]=y.useState(!1),[g,p]=y.useState("consonants"),[v,x]=y.useState(!1),b=y.useRef(null),w=y.useRef([]),j=y.useRef(null),_=y.useRef(null);y.useEffect(()=>{S()},[]);const S=async()=>{n(!0);const W=[];for(const D of Fu){const U=By({malayalamChar:D.ml,romanization:D.rom,type:"consonant-with-a"}),R=await Mf(U.directory,U.filename);W.push({ml:D.ml.replace("്",""),rom:D.rom,type:"consonant-with-a",hasAudio:R,directory:U.directory,filename:U.filename})}for(const D of km){const U=By({malayalamChar:D.ml,romanization:D.rom,type:"vowel"}),R=await Mf(U.directory,U.filename);W.push({ml:D.ml,rom:D.rom,type:"vowel",hasAudio:R,directory:U.directory,filename:U.filename})}for(const D of Cm){const U=By({malayalamChar:D.ml,romanization:D.rom,type:"matra"}),R=await Mf(U.directory,U.filename);W.push({ml:D.ml,rom:D.rom,type:"matra",hasAudio:R,directory:U.directory,filename:U.filename})}t(W),n(!1)},k=()=>{let W=e;return g==="consonants"?W=e.filter(D=>D.type==="consonant-with-a"):g==="vowels"?W=e.filter(D=>D.type==="vowel"):g==="matras"&&(W=e.filter(D=>D.type==="matra")),v&&(W=W.filter(D=>!D.hasAudio)),W},P=()=>{const W=e.length,D=e.filter(U=>U.hasAudio).length;return{total:W,done:D,percent:W>0?Math.round(D/W*100):0}},C=async()=>{try{const W=await navigator.mediaDevices.getUserMedia({audio:!0}),D=new MediaRecorder(W);b.current=D,w.current=[],D.ondataavailable=U=>{U.data.size>0&&w.current.push(U.data)},D.onstop=()=>{const U=new Blob(w.current,{type:"audio/mp3"});u(U),W.getTracks().forEach(R=>R.stop())},D.start(),l(!0),Pe.info("Recording started... Speak now!")}catch{Pe.error("Could not access microphone. Please allow microphone access.")}},M=()=>{b.current&&o&&(b.current.stop(),l(!1),Pe.success("Recording stopped!"))},I=()=>{if(c&&j.current){const W=URL.createObjectURL(c);j.current.src=W,j.current.play(),d(!0),j.current.onended=()=>d(!1)}},E=async()=>{if(!c||!s)return;m(!0),(await Nm(c,s.directory,s.filename,()=>{})).success?(Pe.success(`Audio saved for "${s.rom}"!`),t(D=>D.map(U=>U.filename===s.filename?{...U,hasAudio:!0}:U)),i(null),u(null)):Pe.error("Upload failed. Please try again."),m(!1)},B=async W=>{var R;const D=(R=W.target.files)==null?void 0:R[0];if(!D||!s)return;m(!0),(await Nm(D,s.directory,s.filename,()=>{})).success?(Pe.success(`Audio saved for "${s.rom}"!`),t(Q=>Q.map(K=>K.filename===s.filename?{...K,hasAudio:!0}:K)),i(null)):Pe.error("Upload failed. Please try again."),m(!1)},A=()=>{const W=`${window.location.origin}/audio-recorder`;navigator.clipboard.writeText(W),Pe.success("Link copied! Share with native speakers.")},L=P();return a.jsxs("div",{className:"space-y-6",children:[a.jsx("audio",{ref:j,className:"hidden"}),a.jsx("input",{ref:_,type:"file",accept:"audio/*",onChange:B,className:"hidden"}),a.jsx(se,{className:"bg-gradient-to-r from-orange-500 to-pink-500 text-white",children:a.jsxs(ue,{className:"p-6",children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsxs("div",{children:[a.jsx("h2",{className:"text-2xl font-bold",children:"Easy Audio Manager"}),a.jsx("p",{className:"text-white/80",children:"Click any character to record or upload audio"})]}),a.jsxs(Y,{variant:"secondary",size:"sm",onClick:S,disabled:r,children:[a.jsx(Xt,{className:`w-4 h-4 mr-2 ${r?"animate-spin":""}`}),"Refresh"]})]}),a.jsxs("div",{className:"bg-white/20 rounded-lg p-4",children:[a.jsxs("div",{className:"flex justify-between text-sm mb-2",children:[a.jsxs("span",{children:["Progress: ",L.done," of ",L.total," characters"]}),a.jsxs("span",{className:"font-bold",children:[L.percent,"%"]})]}),a.jsx(_t,{value:L.percent,className:"h-3 bg-white/30"})]})]})}),a.jsx(se,{className:"bg-blue-50 border-blue-200",children:a.jsx(ue,{className:"p-4",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(kD,{className:"w-5 h-5 text-blue-600"}),a.jsxs("div",{children:[a.jsx("p",{className:"font-medium text-blue-900",children:"Need a native speaker?"}),a.jsx("p",{className:"text-sm text-blue-700",children:"Share this link with someone who can record"})]})]}),a.jsxs(Y,{variant:"outline",size:"sm",onClick:A,children:[a.jsx(Jl,{className:"w-4 h-4 mr-2"}),"Copy Link"]})]})})}),a.jsxs("div",{className:"flex items-center gap-4",children:[a.jsx(Pn,{value:g,onValueChange:p,className:"flex-1",children:a.jsxs(fn,{children:[a.jsxs(Oe,{value:"consonants",children:["Consonants (",e.filter(W=>W.type==="consonant-with-a"&&W.hasAudio).length,"/",Fu.length,")"]}),a.jsxs(Oe,{value:"vowels",children:["Vowels (",e.filter(W=>W.type==="vowel"&&W.hasAudio).length,"/",km.length,")"]}),a.jsxs(Oe,{value:"matras",children:["Matras (",e.filter(W=>W.type==="matra"&&W.hasAudio).length,"/",Cm.length,")"]})]})}),a.jsxs("label",{className:"flex items-center gap-2 text-sm cursor-pointer",children:[a.jsx("input",{type:"checkbox",checked:v,onChange:W=>x(W.target.checked),className:"rounded"}),"Show only missing"]})]}),r?a.jsxs("div",{className:"flex items-center justify-center py-12",children:[a.jsx(Fe,{className:"w-8 h-8 animate-spin text-gray-400"}),a.jsx("span",{className:"ml-3 text-gray-500",children:"Loading characters..."})]}):a.jsx("div",{className:"grid grid-cols-6 sm:grid-cols-8 md:grid-cols-10 lg:grid-cols-12 gap-2",children:k().map((W,D)=>a.jsxs("button",{onClick:()=>{i(W),u(null)},className:`
1029                aspect-square rounded-lg border-2 flex flex-col items-center justify-center
1030                transition-all hover:scale-105 hover:shadow-lg
1031                ${W.hasAudio?"bg-green-50 border-green-300 hover:border-green-500":"bg-red-50 border-red-300 hover:border-red-500"}
1032              `,children:[a.jsx("span",{className:"text-2xl font-bold",children:W.ml}),a.jsx("span",{className:"text-xs text-gray-500",children:W.rom}),W.hasAudio?a.jsx(ot,{className:"w-4 h-4 text-green-600 mt-1"}):a.jsx(cn,{className:"w-4 h-4 text-red-500 mt-1"})]},`${W.filename}-${D}`))}),k().length===0&&!r&&a.jsx("div",{className:"text-center py-12 text-gray-500",children:v?"All audio files are complete!":"No characters found"}),a.jsx(Ks,{open:!!s,onOpenChange:()=>i(null),children:a.jsxs(fs,{className:"sm:max-w-md",children:[a.jsx(Ys,{children:a.jsx(Xs,{className:"text-center",children:s!=null&&s.hasAudio?"Update Audio":"Add Audio"})}),s&&a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"text-center py-6 bg-gradient-to-br from-orange-100 to-pink-100 rounded-xl",children:[a.jsx("div",{className:"text-7xl font-bold text-gray-800 mb
1032-2",children:s.ml}),a.jsxs("div",{className:"text-xl text-gray-600",children:['"',s.rom,'"']}),a.jsxs("div",{className:"text-sm text-gray-500 mt-2",children:[s.type==="consonant-with-a"&&'Consonant (with inherent "a")',s.type==="vowel"&&"Vowel",s.type==="matra"&&"Matra (vowel sign)"]})]}),a.jsx("div",{className:`flex items-center justify-center gap-2 p-3 rounded-lg ${s.hasAudio?"bg-green-100 text-green-800":"bg-yellow-100 text-yellow-800"}`,children:s.hasAudio?a.jsxs(a.Fragment,{children:[a.jsx(Ri,{className:"w-5 h-5"}),a.jsx("span",{children:"Audio exists - you can update it"})]}):a.jsxs(a.Fragment,{children:[a.jsx(cn,{className:"w-5 h-5"}),a.jsx("span",{children:"No audio yet - please record or upload"})]})}),a.jsxs("div",{className:"space-y-4",children:[a.jsx("p",{className:"text-sm text-gray-600 text-center font-medium",children:"Option 1: Record with your microphone"}),a.jsx("div",{className:"flex justify-center gap-3",children:o?a.jsxs(Y,{onClick:M,size:"lg",variant:"destructive",className:"animate-pulse",children:[a.jsx(a2,{className:"w-5 h-5 mr-2"}),"Stop Recording"]}):a.jsxs(Y,{onClick:C,size:"lg",className:"bg-red-500 hover:bg-red-600",children:[a.jsx(cc,{className:"w-5 h-5 mr-2"}),"Start Recording"]})}),c&&a.jsxs("div",{className:"flex justify-center gap-3",children:[a.jsxs(Y,{variant:"outline",onClick:I,children:[h?a.jsx(ss,{className:"w-4 h-4 mr-2"}):a.jsx(Bt,{className:"w-4 h-4 mr-2"}),"Preview"]}),a.jsxs(Y,{onClick:E,disabled:f,children:[f?a.jsx(Fe,{className:"w-4 h-4 mr-2 animate-spin"}):a.jsx(Ri,{className:"w-4 h-4 mr-2"}),"Save Recording"]})]})]}),a.jsxs("div",{className:"relative",children:[a.jsx("div",{className:"absolute inset-0 flex items-center",children:a.jsx("span",{className:"w-full border-t"})}),a.jsx("div",{className:"relative flex justify-center text-xs uppercase",children:a.jsx("span",{className:"bg-white px-2 text-gray-500",children:"Or"})})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsx("p",{className:"text-sm text-gray-600 text-center font-medium",children:"Option 2: Upload an audio file"}),a.jsx("div",{className:"flex justify-center",children:a.jsxs(Y,{variant:"outline",size:"lg",onClick:()=>{var W;return(W=_.current)==null?void 0:W.click()},disabled:f,children:[a.jsx(sm,{className:"w-5 h-5 mr-2"}),"Choose File"]})}),a.jsx("p",{className:"text-xs text-gray-500 text-center",children:"Accepts MP3, WAV, or any audio format"})]})]})]})})]})}function wR(){const[e,t]=y.useState(!1),[r,n]=y.useState("checking"),[s,i]=y.useState(""),[o,l]=y.useState(!1);y.useEffect(()=>{c()},[]);const c=async()=>{n("checking"),i("Checking Supabase storage setup...");try{const{data:u,error:h}=await ne.storage.from(jn).list("",{limit:1});if(h){if(h.message.includes("not found")||h.message.includes("does not exist")){n("needs-setup"),i("The audio-files bucket needs to be created in Supabase.");return}const d=`${tr}/storage/v1/object/public/${jn}/`;try{if((await fetch(d,{method:"HEAD"})).status===400){n("ready"),i("Storage is ready. You can start uploading audio files.");return}}catch{}n("needs-setup"),i(`Storage access issue: ${h.message}`);return}n("ready"),i(`Storage is ready! ${(u==null?void 0:u.length)||0} files found.`)}catch(u){n("error"),i(`Connection error: ${u.message}`)}};return a.jsxs("div",{className:"min-h-screen bg-gray-50",children:[a.jsx("header",{className:"bg-white border-b sticky top-0 z-10",children:a.jsxs("div",{className:"container mx-auto px-4 py-4 flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-4",children:[a.jsx(it,{to:"/app",children:a.jsxs(Y,{variant:"ghost",size:"sm",children:[a.jsx(Ll,{className:"w-4 h-4 mr-2"}),"Back to App"]})}),a.jsx("h1",{className:"text-xl font-bold text-gray-800",children:"Audio Upload Center"})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs(Y,{variant:"outline",size:"sm",onClick:c,children:[a.jsx(Xt,{className:"w-4 h-4 mr-2"}),"Refresh"]}),a.jsxs(Y,{variant:"outline",size:"sm",onClick:()=>t(!0),children:[a.jsx(SK,{className:"w-4 h-4 mr-2"}),"Help"]})]})]})}),a.jsxs("main",{className:"container mx-auto px-4 py-8",children:[a.jsxs("div",{className:"mb-6",children:[r==="checking"&&a.jsx(se,{className:"bg-blue-50 border-blue-200",children:a.jsxs(ue,{className:"p-4 flex items-center gap-3",children:[a.jsx(Fe,{className:"w-5 h-5 animate-spin text-blue-600"}),a.jsx("span",{className:"text-blue-800",children:s})]})}),r==="ready"&&a.jsx(se,{className:"bg-green-50 border-green-200",children:a.jsxs(ue,{className:"p-4 flex items-center gap-3",children:[a.jsx(ot,{className:"w-5 h-5 text-green-600"}),a.jsx("span",{className:"text-green-800",children:s})]})}),r==="needs-setup"&&a.jsx(se,{className:"bg-amber-50 border-amber-200",children:a.jsx(ue,{className:"p-4",children:a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx(Qr,{className:"w-5 h-5 text-amber-600 mt-0.5"}),a.jsxs("div",{className:"flex-1",children:[a.jsx("p",{className:"text-amber-800 font-medium",children:s}),a.jsx("p",{className:"text-amber-700 text-sm mt-1",children:"You need to set up Supabase Storage before uploading audio files."}),a.jsx(Y,{variant:"outline",size:"sm",className:"mt-3 bg-white",onClick:()=>l(!0),children:"View Setup Guide"})]})]})})}),r==="error"&&a.jsx(se,{className:"bg-red-50 border-red-200",children:a.jsx(ue,{className:"p-4",children:a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx(Qr,{className:"w-5 h-5 text-red-600 mt-0.5"}),a.jsxs("div",{className:"flex-1",children:[a.jsx("p",{className:"text-red-800 font-medium",children:"Connection 
1032Error"}),a.jsx("p",{className:"text-red-700 text-sm mt-1",children:s}),a.jsxs(Y,{variant:"outline",size:"sm",className:"mt-3 bg-white",onClick:c,children:[a.jsx(Xt,{className:"w-4 h-4 mr-2"}),"Retry"]})]})]})})})]}),r==="ready"&&a.jsx(YDe,{}),(r==="needs-setup"||r==="error")&&a.jsxs(se,{children:[a.jsx(_e,{children:a.jsx(Se,{children:"Setup Required"})}),a.jsx(ue,{children:a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"bg-blue-50 border border-blue-200 rounded-lg p-4",children:[a.jsx("h3",{className:"font-semibold text-blue-800 mb-2",children:"Quick Setup Steps:"}),a.jsxs("ol",{className:"list-decimal ml-5 space-y-2 text-blue-700",children:[a.jsxs("li",{children:["Go to your"," ",a.jsxs("a",{href:"https://supabase.com/dashboard",target:"_blank",rel:"noopener noreferrer",className:"underline font-medium",children:["Supabase Dashboard",a.jsx(md,{className:"w-3 h-3 inline ml-1"})]})]}),a.jsxs("li",{children:["Navigate to ",a.jsx("strong",{children:"Storage"})," in the left sidebar"]}),a.jsxs("li",{children:["Click ",a.jsx("strong",{children:'"New bucket"'})]}),a.jsxs("li",{children:["Name it exactly: ",a.jsx("code",{className:"bg-white px-2 py-0.5 rounded",children:"audio-files"})]}),a.jsxs("li",{children:["Check ",a.jsx("strong",{children:'"Public bucket"'})," option"]}),a.jsxs("li",{children:["Click ",a.jsx("strong",{children:'"Create bucket"'})]}),a.jsxs("li",{children:["Come back here and click ",a.jsx("strong",{children:"Refresh"})]})]})]}),a.jsx(Y,{onClick:()=>l(!0),className:"w-full",children:"View Detailed Setup Guide"})]})})]})]}),a.jsx(Ks,{open:e,onOpenChange:t,children:a.jsxs(fs,{className:"sm:max-w-lg",children:[a.jsx(Ys,{children:a.jsx(Xs,{children:"How to Add Audio"})}),a.jsxs("div",{className:"space-y-4 text-sm",children:[a.jsxs("div",{className:"p-4 bg-green-50 rounded-lg",children:[a.jsx("h3",{className:"font-bold text-green-800 mb-2",children:"Step 1: Click a Character"}),a.jsx("p",{className:"text-green-700",children:"Click any character in the grid. Red means it needs audio, green means it already has audio."})]}),a.jsxs("div",{className:"p-4 bg-blue-50 rounded-lg",children:[a.jsx("h3",{className:"font-bold text-blue-800 mb-2",children:"Step 2: Record or Upload"}),a.jsxs("p",{className:"text-blue-700",children:[a.jsx("strong",{children:"To Record:"}),' Click "Start Recording", say the sound clearly, then click "Stop Recording". Preview it, then click "Save Recording".']}),a.jsxs("p",{className:"text-blue-700 mt-2",children:[a.jsx("strong",{children:"To Upload:"}),' Click "Choose File" and select any audio file from your computer or phone.']})]}),a.jsxs("div",{className:"p-4 bg-purple-50 rounded-lg",children:[a.jsx("h3",{className:"font-bold text-purple-800 mb-2",children:"Step 3: Repeat"}),a.jsx("p",{className:"text-purple-700",children:"Continue until all characters have audio (all green). You can filter to show only missing ones!"})]}),a.jsxs("div",{className:"p-4 bg-orange-50 rounded-lg",children:[a.jsx("h3",{className:"font-bold text-orange-800 mb-2",children:"Tips for Good Audio"}),a.jsxs("ul",{className:"text-orange-700 list-disc list-inside space-y-1",children:[a.jsx("li",{children:"Record in a quiet place"}),a.jsx("li",{children:"Hold phone/mic close to mouth"}),a.jsx("li",{children:"Say the sound clearly and naturally"}),a.jsx("li",{children:"Keep recordings short (1-2 seconds)"})]})]})]})]})}),a.jsx(Ks,{open:o,onOpenChange:l,children:a.jsxs(fs,{className:"sm:max-w-2xl max-h-[90vh] overflow-y-auto",children:[a.jsx(Ys,{children:a.jsx(Xs,{children:"Supabase Storage Setup Guide"})}),a.jsxs("div",{className:"space-y-6 text-sm",children:[a.jsx("div",{className:"bg-amber-50 border border-amber-200 rounded-lg p-4",children:a.jsxs("p",{className:"text-amber-800",children:[a.jsx("strong",{children:"Important:"})," You need to create a storage bucket in Supabase to store audio files. This is a one-time setup."]})}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"border rounded-lg p-4",children:[a.jsxs("h3",{className:"font-bold text-gray-800 mb-2 flex items-center gap-2",children:[a.jsx("span",{className:"bg-blue-500 text-white w-6 h-6 rounded-full flex items-center justify-center text-xs",children:"1"}),"Open Supabase Dashboard"]}),a.jsxs("p",{className:"text-gray-600 mb-2",children:["Go to"," ",a.jsxs("a",{href:"https://supabase.com/dashboard",target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 underline",children:["supabase.com/dashboard",a.jsx(md,{className:"w-3 h-3 inline ml-1"})]})," ","and sign in."]}),a.jsx("p",{className:"text-gray-600",children:"Select your project (the one connected to this app)."})]}),a.jsxs("div",{className:"border rounded-lg p-4",children:[a.jsxs("h3",{className:"font-bold text-gray-800 mb
1032-2 flex items-center gap-2",children:[a.jsx("span",{className:"bg-blue-500 text-white w-6 h-6 rounded-full flex items-center justify-center text-xs",children:"2"}),"Navigate to Storage"]}),a.jsxs("p",{className:"text-gray-600",children:["In the left sidebar, click on ",a.jsx("strong",{children:'"Storage"'})," (it has a folder icon)."]})]}),a.jsxs("div",{className:"border rounded-lg p-4",children:[a.jsxs("h3",{className:"font-bold text-gray-800 mb-2 flex items-center gap-2",children:[a.jsx("span",{className:"bg-blue-500 text-white w-6 h-6 rounded-full flex items-center justify-center text-xs",children:"3"}),"Create New Bucket"]}),a.jsxs("p",{className:"text-gray-600 mb-2",children:["Click the ",a.jsx("strong",{children:'"New bucket"'})," button."]}),a.jsxs("div",{className:"bg-gray-100 rounded p-3 space-y-2",children:[a.jsxs("p",{children:[a.jsx("strong",{children:"Name:"})," ",a.jsx("code",{className:"bg-white px-2 py-0.5 rounded",children:"audio-files"})]}),a.jsxs("p",{children:[a.jsx("strong",{children:"Public bucket:"})," ✅ Check this box (IMPORTANT!)"]})]})]}),a.jsxs("div",{className:"border rounded-lg p-4",children:[a.jsxs("h3",{className:"font-bold text-gray-800 mb-2 flex items-center gap-2",children:[a.jsx("span",{className:"bg-blue-500 text-white w-6 h-6 rounded-full flex items-center justify-center text-xs",children:"4"}),"Set Up Policies (Optional but Recommended)"]}),a.jsxs("p",{className:"text-gray-600 mb-2",children:["Click on your new bucket, then go to ",a.jsx("strong",{children:'"Policies"'})," tab."]}),a.jsx("p",{className:"text-gray-600 mb-2",children:"Add these policies for full functionality:"}),a.jsxs("div",{className:"bg-gray-100 rounded p-3 space-y-2 text-xs",children:[a.jsxs("div",{children:[a.jsx("p",{className:"font-medium",children:"SELECT (Read) Policy:"}),a.jsx("code",{className:"block bg-white p-2 rounded mt-1",children:"bucket_id = 'audio-files'"})]}),a.jsxs("div",{children:[a.jsx("p",{className:"font-medium",children:"INSERT (Upload) Policy:"}),a.jsx("code",{className:"block bg-white p-2 rounded mt-1",children:"bucket_id = 'audio-files'"})]})]})]}),a.jsxs("div",{className:"border rounded-lg p-4 bg-green-50 border-green-200",children:[a.jsxs("h3",{className:"font-bold text-green-800 mb-2 flex items-center gap-2",children:[a.jsx("span",{className:"bg-green-500 text-white w-6 h-6 rounded-full flex items-center justify-center text-xs",children:"5"}),"Done! Come Back Here"]}),a.jsxs("p",{className:"text-green-700",children:["After creating the bucket, come back to this page and click ",a.jsx("strong",{children:'"Refresh"'}),". The status should change to green and you can start uploading audio!"]})]})]}),a.jsxs("div",{className:"bg-blue-50 border border-blue-200 rounded-lg p-4",children:[a.jsx("h3",{className:"font-bold text-blue-800 mb-2",children:"Your Supabase Project Info:"}),a.jsxs("p",{className:"text-blue-700 text-xs break-all",children:[a.jsx("strong",{children:"URL:"})," ",tr]}),a.jsxs("p",{className:"text-blue-700 text-xs mt-1",children:[a.jsx("strong",{children:"Bucket Name:"})," ",jn]})]}),a.jsx(Y,{onClick:()=>l(!1),className:"w-full",children:"Close Guide"})]})]})})]})}const _l="audio-files",XDe=["chh","tth","ddh","thh","shh","kh","gh","ng","ch","jh","ny","tt","dd","nn","th","dh","ph","bh","sh","ll","zh","rr","k","g","j","d","
1032n","p","b","m","y","r","l","v","s","h"],QDe=["a","aa","i","ii","u","uu","e","ee","ai","o","oo","au"],JDe=["a","aa","i","ii","u","uu","ri","e","ee","ai","o","oo","au"],ZDe=()=>XDe.map(e=>({consonant:e,combinations:QDe.map(t=>e+t)}));function eLe(){const[e,t]=y.useState(!0),[r,n]=y.useState([]),[s,i]=y.useState([]),[o,l]=y.useState(null),[c,u]=y.useState(""),[h,d]=y.useState("all"),[f,m]=y.useState(null),[g,p]=y.useState({}),[v,x]=y.useState(!1),[b,w]=y.useState([]),[j,_]=y.useState("checking"),[S,k]=y.useState(null),P=y.useRef(null);y.useEffect(()=>{C()},[]);const C=async()=>{t(!0),_("checking"),k(null);try{if(!await W0()){_("offline"),k("Unable to connect to the server. Please check your internet connection."),t(!1);return}_("connected"),await M()}catch(z){console.error("Connection check failed:",z),st(z)?(_("offline"),k("Network error: Unable to reach the server. Please check your internet connection.")):(_("error"),k(z.message||"An unexpected error occurred")),t(!1)}},M=async()=>{var T,$,V,q,te;t(!0),k(null);const z=[],N={root:[]};try{const X=new AbortController,ee=setTimeout(()=>X.abort(),15e3),{data:ie,error:oe}=await ne.storage.from(_l).list("",{limit:1e3});if(clearTimeout(ee),oe){if(console.error("Error listing root:",oe),(T=oe.message)!=null&&T.includes("not found")||($=oe.message)!=null&&$.includes("Bucket")){_("error"),k(`Storage bucket "${_l}" not found. Please ensure the bucket exists in your Supabase project.`),t(!1);return}if(st(oe)){_("offline"),k("Unable to access storage. This may be due to network issues or CORS configuration."),t(!1);return}if((V=oe.message)!=null&&V.includes("permission")||(q=oe.message)!=null&&q.includes("policy")){_("error"),k("Permission denied. Please check that the storage bucket has public read access enabled."),t(!1);return}_("error"),k(`Storage error: ${oe.message}`),t(!1);return}if(ie)for(const O of ie)if(O.metadata!==null){const F={name:O.name,path:"",folder:"root",fullPath:O.name,url:`${tr}/storage/v1/object/public/${_l}/${O.name}`,size:(te=O.metadata)==null?void 0:te.size};z.push(F),N.root.push(F)}else N[O.name]=[],await I(O.name,z,N);n(z);const we=Object.entries(N).map(([O,F])=>({name:O,files:F,count:F.length})).filter(O=>O.count>0).sort((O,F)=>F.count-O.count);i(we),E(z),_("connected"),Pe.success(`Loaded ${z.length} audio files from ${we.length} folders`)}catch(X){console.error("Error loading audio files:",X),st(X)?(_("offline"),k("Network error while loading files. Please check your connection and try again.")):(_("error"),k(X.message||"Failed to load audio files"))}t(!1)},I=async(z,N,T)=>{var $;try{const{data:V,error:q}=await ne.storage.from(_l).list(z,{limit:1e3});if(q){console.error(`Error listing folder ${z}:`,q);return}if(V)for(const te of V)if(te.metadata!==null){const X={name:te.name,path:z,folder:z,fullPath:`${z}/${te.name}`,url:`${tr}/storage/v1/object/public/${_l}/${z}/${te.name}`,size:($=te.metadata)==null?void 0:$.size};N.push(X),T[z]||(T[z]=[]),T[z].push(X)}else{const X=`${z}/${te.name}`;T[X]=[],await I(X,N,T)}}catch(V){console.error(`Error listing folder ${z}:`,V)}},E=z=>{const N=[],T=new Set(z.map(V=>V.name.toLowerCase().replace(/\.(mp3|wav|ogg)$/i,"")));for(const V of JDe)T.has(V)||N.push({folder:"vowels",file:`${V}.mp3`});const $=ZDe();for(const{consonant:V,combinations:q}of $){const te=`${V}-series`;for(const X of q)T.has(X)||N.push({folder:te,file:`${X}.mp3`})}w(N)},B=z=>{var N;o===z.fullPath?((N=P.current)==null||N.pause(),l(null)):P.current&&(P.current.src=z.url,P.current.play().then(()=>{l(z.fullPath),p(T=>({...T,[z.fullPath]:"working"}))}).catch(T=>{console.error("Playback failed:",T),p($=>({...$,[z.fullPath]:"failed"})),Pe.error(`Failed to play: ${z.name}`)}),P.current.onended=()=>l(null))},A=async()=>{const z=L();m({total:z.length,tested:0,working:0,failed:0});let N=0,T=0;for(let $=0;$<z.length;$++){const V=z[$];try{(await fetch(V.url,{method:"HEAD"})).ok?(p(te=>({...te,[V.fullPath]:"working"})),N++):(p(te=>({...te,[V.fullPath]:"failed"})),T++)}catch{p(q=>({...q,[V.fullPath]:"failed"})),T++}m({total:z.length,tested:$+1,working:N,failed:T})}Pe.success(`Testing complete: ${N} working, ${T} failed`)},L=()=>{let z=r;if(h!=="all"&&(z=z.filter(N=>N.folder===h)),c){const N=c.toLowerCase();z=z.filter(T=>T.name.toLowerCase().includes(N)||T.folder.toLowerCase().includes(N))}return z},W=z=>z?z<1024?`${z} B`:z<1024*1024?`${(z/1024).toFixed(1)} KB`:`${(z/(1024*1024)).toFixed(1)} MB`:"N/A",D=z=>{const N=g[z.fullPath];return N==="working"?a.jsx(ot,{className:"w-4 h-4 text-green-500"}):N==="failed"?a.jsx(jt,{className:"w-4 h-4 text-red-500"}):null},U=L(),R=b.reduce((z,N)=>(z[N.folder]||(z[N.folder]=[]),z[N.folder].push(N.file),z),{}),Q=()=>a.jsx(se,{className:"border-red-200 bg-red-50",children:a.jsx(ue,{className:"p-8 text-center",children:a.jsxs("div",{className:"flex flex-col items-center gap-4",children:[j==="offline"?a.jsx(Xo,{className:"w-16 h-16 text-red-400"}):a.jsx(CK,{className:"w-16 h-16 text-red-400"}),a.jsxs("div",{children:[a.jsx("h3",{className:"text-xl font-semibold text-red-800 mb
1032-2",children:j==="offline"?"Connection Failed":"Storage Error"}),a.jsx("p",{className:"text-red-600 mb-4 max-w-md",children:S})]}),a.jsxs("div",{className:"space-y-3",children:[a.jsxs(Y,{onClick:C,variant:"default",children:[a.jsx(Xt,{className:"w-4 h-4 mr-2"}),"Try Again"]}),a.jsxs("div",{className:"text-sm text-gray-600 mt-4",children:[a.jsx("p",{className:"font-medium mb-2",children:"Troubleshooting tips:"}),a.jsxs("ul",{className:"text-left list-disc list-inside space-y-1",children:[a.jsx("li",{children:"Check your internet connection"}),a.jsx("li",{children:"Ensure the Supabase project is active"}),a.jsxs("li",{children:['Verify the storage bucket "',_l,'" exists']}),a.jsx("li",{children:"Check that the bucket has public read access"}),a.jsx("li",{children:"Try refreshing the page"})]})]})]})]})})}),K=()=>a.jsx(se,{children:a.jsxs(ue,{className:"p-8 text-center",children:[a.jsx(Xt,{className:"w-12 h-12 animate-spin mx-auto text-orange-500 mb-4"}),a.jsx("h3",{className:"text-lg font-semibold text-gray-700",children:"Connecting to Storage..."}),a.jsx("p",{className:"text-gray-500 mt-2",children:"Please wait while we check the connection"})]})});return a.jsxs("div",{className:"min-h-screen bg-gradient-to-br from-orange-50 via-white to-green-50",children:[a.jsx(hs,{}),a.jsx("audio",{ref:P,className:"hidden"}),a.jsxs("div",{className:"container mx-auto px-4 py-8",children:[a.jsxs("div",{className:"mb-8",children:[a.jsx("h1",{className:"text-3xl font-bold text-gray-900 mb-2",children:"Audio File Testing"}),a.jsx("p",{className:"text-gray-600",children:"Test and verify all uploaded audio files. Check which files are available in each folder and identify missing files."}),a.jsxs("div",{className:"mt-4 flex items-center gap-2",children:[a.jsx("span",{className:"text-sm text-gray-500",children:"Status:"}),j==="checking"&&a.jsxs(ke,{variant:"outline",className:"bg-yellow-50 text-yellow-700 border-yellow-200",children:[a.jsx(Xt,{className:"w-3 h-3 mr-1 animate-spin"}),"Checking..."]}),j==="connected"&&a.jsxs(ke,{variant:"outline",className:"bg-green-50 text-green-700 border-green-200",children:[a.jsx(ot,{className:"w-3 h-3 mr-1"}),"Connected"]}),j==="offline"&&a.jsxs(ke,{variant:"outline",className:"bg-red-50 text-red-700 border-red-200",children:[a.jsx(Xo,{className:"w-3 h-3 mr-1"}),"Offline"]}),j==="error"&&a.jsxs(ke,{variant:"outline",className:"bg-red-50 text-red-700 border-red-200",children:[a.jsx(Qr,{className:"w-3 h-3 mr-1"}),"Error"]})]})]}),(j==="offline"||j==="error")&&!e&&Q(),j==="checking"&&e&&K(),j==="connected"&&a.jsxs(Pn,{defaultValue:"browser",className:"space-y-6",children:[a.jsxs(fn,{className:"grid w-full grid-cols-3 lg:w-[400px]",children:[a.jsx(Oe,{value:"browser",children:"File Browser"}),a.jsx(Oe,{value:"missing",children:"Missing Files"}),a.jsx(Oe,{value:"naming",children:"Naming Rules"})]}),a.jsxs(ze,{value:"browser",className:"space-y-6",children:[a.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[a.jsx(se,{children:a.jsx(ue,{className:"p-4",children:a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"p-2 bg-blue-100 rounded-lg",children:a.jsx(vd,{className:"w-5 h-5 text-blue-600"})}),a.jsxs("div",{children:[a.jsx("p",{className:"text-2xl font-bold",children:r.length}),a.jsx("p",{className:"text-sm text-gray-500",children:"Total Files"})]})]})})}),a.jsx(se,{children:a.jsx(ue,{className:"p-4",children:a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"p-2 bg-purple-100 rounded-lg",children:a.jsx(Zl,{className:"w-5 h-5 text-purple-600"})}),a.jsxs("div",{children:[a.jsx("p",{className:"text-2xl font-bold",children:s.length}),a.jsx("p",{className:"text-sm text-gray-500",children:"Folders"})]})]})})}),a.jsx(se,{children:a.jsx(ue,{className:"p-4",children:a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"p-2 bg-green-100 rounded-lg",children:a.jsx(ot,{className:"w-5 h-5 text-green-600"})}),a.jsxs("div",{children:[a.jsx("p",{className:"text-2xl font-bold",children:Object.values(g).filter(z=>z==="working").length}),a.jsx("p",{className:"text-sm text-gray-500",children:"Working"})]})]})})}),a.jsx(se,{children:a.jsx(ue,{className:"p-4",children:a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"p-2 bg-red-100 rounded-lg",children:a.jsx(Qr,{className:"w-5 h-5 text-red-600"})}),a.jsxs("div",{children:[a.jsx("p",{className:"text-2xl font-bold",children:b.length}),a.jsx("p",{className:"text-sm text-gray-500",children:"Missing"})]})]})})})]}),a.jsx(se,{children:a.jsxs(ue,{className:"p-4",children:[a.jsxs("div",{className:"flex flex-wrap gap-4 items-center",children:[a.jsx("div",{className:"flex-1 min-w-[200px]",children:a.jsxs("div",{className:"relative",children:[a.jsx(Tp,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}
1032),a.jsx(Je,{placeholder:"Search files...",value:c,onChange:z=>u(z.target.value),className:"pl-10"})]})}),a.jsxs("select",{value:h,onChange:z=>d(z.target.value),className:"px-3 py-2 border rounded-md bg-white",children:[a.jsx("option",{value:"all",children:"All Folders"}),s.map(z=>a.jsxs("option",{value:z.name,children:[z.name," (",z.count,")"]},z.name))]}),a.jsxs(Y,{onClick:M,variant:"outline",disabled:e,children:[a.jsx(Xt,{className:`w-4 h-4 mr-2 ${e?"animate-spin":""}`}),"Refresh"]}),a.jsxs(Y,{onClick:A,disabled:e||U.length===0,children:[a.jsx(Xe,{className:"w-4 h-4 mr-2"}),"Test All (",U.length,")"]})]}),f&&a.jsxs("div",{className:"mt-4",children:[a.jsxs("div",{className:"flex justify-between text-sm mb-1",children:[a.jsx("span",{children:"Testing progress"}),a.jsxs("span",{children:[f.tested," / ",f.total]})]}),a.jsx(_t,{value:f.tested/f.total*100}),a.jsxs("div",{className:"flex gap-4 mt-2 text-sm",children:[a.jsxs("span",{className:"text-green-600",children:["Working: ",f.working]}),a.jsxs("span",{className:"text-red-600",children:["Failed: ",f.failed]})]})]})]})}),a.jsxs(se,{children:[a.jsx(_e,{children:a.jsx(Se,{className:"text-lg",children:"Folders Overview"})}),a.jsx(ue,{children:a.jsx("div",{className:"flex flex-wrap gap-2",children:s.map(z=>a.jsxs(ke,{variant:h===z.name?"default":"outline",className:"cursor-pointer hover:bg-gray-100",onClick:()=>d(z.name===h?"all":z.name),children:[a.jsx(Zl,{className:"w-3 h-3 mr-1"}),z.name,": ",z.count]},z.name))})})]}),a.jsxs(se,{children:[a.jsx(_e,{children:a.jsx(Se,{className:"text-lg flex items-center justify-between",children:a.jsxs("span",{children:["Audio Files (",U.length,")"]})})}),a.jsx(ue,{children:e?a.jsxs("div",{className:"text-center py-8",children:[a.jsx(Xt,{className:"w-8 h-8 animate-spin mx-auto text-gray-400"}),a.jsx("p",{className:"mt-2 text-gray-500",children:"Loading audio files..."})]}):U.length===0?a.jsxs("div",{className:"text-center py-8 text-gray-500",children:[a.jsx(vd,{className:"w-12 h-12 mx-auto text-gray-300 mb-4"}),a.jsx("p",{children:"No audio files found"}),a.jsxs("p",{className:"text-sm mt-2",children:['Upload audio files to the "',_l,'" bucket to get started.']})]}):a.jsx("div",{className:"grid gap-2 max-h-[600px] overflow-y-auto",children:U.map(z=>a.jsxs("div",{className:`flex items-center gap-3 p-3 rounded-lg border transition-colors ${o===z.fullPath?"bg-orange-50 border-orange-300":"hover:bg-gray-50"}`,children:[a.jsx(Y,{size:"sm",variant:"ghost",onClick:()=>B(z),className:"flex-shrink-0",children:o===z.fullPath?a.jsx(ss,{className:"w-4 h-4"}):a.jsx(Bt,{className:"w-4 h-4"})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("p",{className:"font-medium truncate",children:z.name}),a.jsxs("p",{className:"text-xs text-gray-500",children:[z.folder||"root"," • ",W(z.size)]})]}),D(z),a.jsx(ke,{variant:"outline",className:"flex-shrink-0",children:z.folder||"root"})]},z.fullPath))})})]})]}),a.jsxs(ze,{value:"missing",className:"space-y-6",children:[a.jsx(se,{className:"bg-amber-50 border-amber-200",children:a.jsx(ue,{className:"p-4",children:a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx(Qr,{className:"w-5 h-5 text-amber-600 flex-shrink-0 mt-0.5"}),a.jsxs("div",{children:[a.jsx("h3",{className:"font-semibold text-amber-800",children:"Missing Audio Files"}),a.jsxs("p",{className:"text-sm text-amber-700",children:["The following files are expected for complete consonant-vowel combinations but were not found in storage. Total missing: ",a.jsx("strong",{children:b.length})," files"]})]})]})})}),Object.entries(R).length===0?a.jsx(se,{children:a.jsxs(ue,{className:"p-8 text-center",children:[a.jsx(ot,{className:"w-12 h-12 text-green-500 mx-auto mb-4"}),a.jsx("h3",{className:"text-lg font-semibold text-green-700",children:"All Files Present!"}),a.jsx("p",{className:"text-gray-500",children:"All expected audio files are available."})]})}):a.jsx("div",{className:"grid gap-4",children:Object.entries(R).map(([z,N])=>a.jsxs(se,{children:[a.jsx(_e,{className:"pb-2",children:a.jsxs(Se,{className:"text-base flex items-center gap-2",children:[a.jsx(Zl,{className:"w-4 h-4 text-orange-500"}),z,"/",a.jsxs(ke,{variant:"destructive",className:"ml-auto",children:[N.length," missing"]})]})}),a.jsx(ue,{children:a.jsxs("div",{className:"flex flex-wrap gap-2",children:[N.slice(0,20).map(T=>a.jsx(ke,{variant:"outline",className:"text-red-600 border-red-200",children:T},T)),N.length>20&&a.jsxs(ke,{variant:"outline",className:"text-gray-500",children:["+",N.length-20," more"]})]})})]},z))})]}),a.jsx(ze,{value:"naming",className:"space-y-6",children:a.jsxs(se,{children:[a.jsx(_e,{children:a.jsxs(Se,{className:"flex items-center gap-2",children:[a.jsx(nl,{className:"w-5 h-5 text-blue-500"}),"Audio File Naming Rules"]})}),a.jsxs(ue,{className:"space-y-6",children:[a.jsxs("div",{className:"bg-blue-50 p-4 rounded-lg",children:[a.jsx("h3",{className:"font-semibold text-blue-800 mb-2",children:"How Files Are Organized"}),a.jsx("p",{className:"text-sm text-blue-700",children:"Audio files are automatically sorted into folders based on their filename pattern. Use the correct naming convention to ensure files are uploaded to the right location."})]}),a.jsxs("div",{className:"border rounded-lg p-4",children:[a.jsxs("h4",{className:"font-semibold text-gray-800 mb
1032-2 flex items-center gap-2",children:[a.jsx(ke,{className:"bg-purple-500",children:"vowels/"}),"Pure Vowels"]}),a.jsx("p",{className:"text-sm text-gray-600 mb-2",children:"Simple vowel sounds without any consonant prefix."}),a.jsx("div",{className:"bg-gray-50 p-3 rounded font-mono text-sm",children:"a.mp3, aa.mp3, i.mp3, ii.mp3, u.mp3, uu.mp3, e.mp3, ee.mp3, ai.mp3, o.mp3, oo.mp3, au.mp3, ri.mp3"})]}),a.jsxs("div",{className:"border rounded-lg p-4",children:[a.jsxs("h4",{className:"font-semibold text-gray-800 mb-2 flex items-center gap-2",children:[a.jsx(ke,{className:"bg-orange-500",children:"k-series/"}),"K-Series (ക വർഗ്ഗം)"]}),a.jsx("p",{className:"text-sm text-gray-600 mb-2",children:"Consonant 'k' combined with all vowels."}),a.jsx("div",{className:"bg-gray-50 p-3 rounded font-mono text-sm",children:"ka.mp3, kaa.mp3, ki.mp3, kii.mp3, ku.mp3, kuu.mp3, ke.mp3, kee.mp3, kai.mp3, ko.mp3, koo.mp3, kau.mp3"})]}),a.jsxs("div",{className:"border rounded-lg p-4",children:[a.jsxs("h4",{className:"font-semibold text-gray-800 mb-2 flex items-center gap-2",children:[a.jsx(ke,{className:"bg-green-500",children:"ch-series/"}),"CH-Series (ച വർഗ്ഗം)"]}),a.jsx("p",{className:"text-sm text-gray-600 mb-2",children:"Consonant 'ch' combined with all vowels."}),a.jsx("div",{className:"bg-gray-50 p-3 rounded font-mono text-sm",children:"cha.mp3, chaa.mp3, chi.mp3, chii.mp3, chu.mp3, chuu.mp3, che.mp3, chee.mp3, chai.mp3, cho.mp3, choo.mp3, chau.mp3"})]}),a.jsxs("div",{className:"border rounded-lg p-4",children:[a.jsx("h4",{className:"font-semibold text-gray-800 mb-2",children:"Other Consonant Series"}),a.jsxs("p",{className:"text-sm text-gray-600 mb-3",children:["Each consonant has its own series folder. The pattern is: ",a.jsx("code",{className:"bg-gray-100 px-1 rounded",children:"[consonant]-series/"})]}),a.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-2 text-sm",children:["kh","g","gh","ng","chh","j","jh","ny","tt","tth","dd","ddh","nn","th","thh","d","dh","n","p","ph","b","bh","m","y","r","l","v","sh","shh","s","h","ll","zh","rr"].map(z=>a.jsxs(ke,{variant:"outline",className:"justify-center",children:[z,"-series/"]},z))})]}),a.jsxs("div",{className:"border rounded-lg p-4",children:[a.jsx("h4",{className:"font-semibold text-gray-800 mb-2 flex items-center gap-2",children:a.jsx(ke,{className:"bg-gray-500",children:"Special Files"})}),a.jsxs("div",{className:"space-y-3 text-sm",children:[a.jsxs("div",{children:[a.jsx("strong",{children:"Isolated Consonants:"}),a.jsx("code",{className:"bg-gray-100 px-2 py-1 rounded ml-2",children:"ka-isolated.mp3 → consonants/isolated/"})]}),a.jsxs("div",{children:[a.jsx("strong",{children:"Consonants with inherent 'a':"}),a.jsx("code",{className:"bg-gray-100 px-2 py-1 rounded ml-2",children:"ka-with-a.mp3 → consonants/with-a/"})]}),a.jsxs("div",{children:[a.jsx("strong",{children:"Matras (vowel signs):"}),a.jsx("code",{className:"bg-gray-100 px-2 py-1 rounded ml-2",children:"matra-aa.mp3 → matras/"})]}),a.jsxs("div",{children:[a.jsx("strong",{children:"Example words:"}),a.jsx("code",{className:"bg-gray-100 px-2 py-1 rounded ml-2",children:"word-naadu.mp3 → words/"})]})]})]}),a.jsxs("div",{className:"bg-green-50 p-4 rounded-lg",children:[a.jsx("h4",{className:"font-semibold text-green-800 mb-2",children:"Quick Reference"}),a.jsxs("table",{className:"w-full text-sm",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"text-left text-green-700",children:[a.jsx("th",{className:"pb-2",children:"Filename Pattern"}),a.jsx("th",{className:"pb-2",children:"Destination Folder"})]})}),a.jsxs("tbody",{className:"text-green-800",children:[a.jsxs("tr",{children:[a.jsx("td",{className:"py-1",children:"ka.mp3, kaa.mp3, ki.mp3..."}),a.jsx("td",{children:"k-series/"})]}),a.jsxs("tr",{children:[a.jsx("td",{className:"py-1",children:"cha.mp3, chaa.mp3, chi.mp3..."}),a.jsx("td",{children:"ch-series/"})]}),a.jsxs("tr",{children:[a.jsx("td",{className:"py-1",children:"a.mp3, aa.mp3, i.mp3... (single vowels)"}),a.jsx("td",{children:"vowels/"})]}),a.jsxs("tr",{children:[a.jsx("td",{className:"py-1",children:"*-isolated.mp3"}),a.jsx("td",{children:"consonants/isolated/"})]}),a.jsxs("tr",{children:[a.jsx("td",{className:"py-1",children:"*-with-a.mp3"}),a.jsx("td",{children:"consonants/with-a/"})]}),a.jsxs("tr",{children:[a.jsx("td",{className:"py-1",children:"matra-*.mp3"}),a.jsx("td",{children:"matras/"})]}),a.jsxs("tr",{children:[a.jsx("td",{className:"py-1",children:"word-*.mp3"}),a.jsx("td",{children:"words/"})]})]})]})]})]})]})})]})]})]})}const qy=[{id:"v-a",malayalam:"അ",romanization:"a",category:"vowel",filename:"a.mp3",storagePath:"vowels/a.mp3",matchFilenames:["a.mp3","vowel_a.mp3"],group:"Short"},{id:"v-aa",malayalam:"ആ",romanization:"aa",category:"vowel",filename:"aa.mp3",storagePath:"vowels/aa.mp3",matchFilenames:["aa.mp3","vowel_aa.mp3","ā.mp3"],group:"Long"},{id:"v-i",malayalam:"ഇ",romanization:"i",category:"vowel",filename:"i.mp3",storagePath:"vowels/i.mp3",matchFilenames:["i.mp3","vowel_i.mp3"],group:"Short"},{id:"v-ii",malayalam:"ഈ",romanization:"ii",category:"vowel",filename:"ii.mp3",storagePath:"vowels/ii.mp3",matchFilenames:["ii.mp3","vowel_ii.mp3","ī.mp3"],group:"Long"},{id:"v-u",malayalam:"ഉ",romanization:"u",category:"vowel",filename:"u.mp3",storagePath:"vowels/u.mp3",matchFilenames:["u.mp3","vowel_u.mp3"],group:"Short"},{id:"v-uu",malayalam:"ഊ",romanization:"uu",category:"vowel",filename:"uu.mp3",storagePath:"vowels/uu.mp3",matchFilenames:["uu.mp3","vowel_uu.mp3","ū.mp3"],group:"Long"},{id:"v-ri",malayalam:"ഋ",romanization:"ri",category:"vowel",filename:"ri.mp3",storagePath:"vowels/ri.mp3",matchFilenames:["ri.mp3","vowel_ri.mp3","r̥.mp3"],group:"Vocalic"},{id:"v-e",malayalam:"എ",romanization:"e",category:"vowel",filename:"e.mp3",storagePath:"vowels/e.mp3",matchFilenames:["e.mp3","vowel_e.mp3"],group:"Short"},{id:"v-ee",malayalam:"ഏ",romanization:"ee",category:"vowel",filename:"ee.mp3",storagePath:"vowels/ee.mp3",matchFilenames:["ee.mp3","vowel_ee.mp3","ē.mp3"],group:"Long"},{id:"v-ai",malayalam:"ഐ",romanization:"ai",category:"vowel",filename:"ai.mp3",storagePath:"vowels/ai.mp3",matchFilenames:["ai.mp3","vowel_ai.mp3"],group:"Diphthong"},{id:"v-o",malayalam:"ഒ",romanization:"o",category:"vowel",filename:"o.mp3",storagePath:"vowels/o.mp3",matchFilenames:["o.mp3","vowel_o.mp3"],group:"Short"},{id:"v-oo",malayalam:"ഓ",romanization:"oo",category:"vowel",filename:"oo.mp3",storagePath:"vowels/oo.mp3",matchFilenames:["oo.mp3","vowel_oo.mp3","ō.mp3"],group:"Long"},{id:"v-au",malayalam:"ഔ",romanization:"au",category:"vowel",filename:"au.mp3",storagePath:"vowels/au.mp3",matchFilenames:["au.mp3","vowel_au.mp3"],group:"Diphthong"},{id:"v-am",malayalam:"അം",romanization:"am",category:"vowel",filename:"am.mp3",storagePath:"vowels/am.mp3",matchFilenames:["am.mp3","vowel_am.mp3","anusvara.mp3"],group:"Anusvara"},{id:"v-ah",malayalam:"അഃ",romanization:"ah",category:"vowel",filename:"ah.mp3",storagePath:"vowels/ah.mp3",matchFilenames:["ah.mp3","vowel_ah.mp3","visarga.mp3"],group:"Visarga"}],Gy=[{id:"c-ka",malayalam:"ക",romanization:"ka",category:"consonant",f
1032ilename:"ka.mp3",storagePath:"consonants/with-a/ka.mp3",matchFilenames:["ka.mp3","k.mp3"],group:"Velar"},{id:"c-kha",malayalam:"ഖ",romanization:"kha",category:"consonant",filename:"kha.mp3",storagePath:"consonants/with-a/kha.mp3",matchFilenames:["kha.mp3","kh.mp3"],group:"Velar"},{id:"c-ga",malayalam:"ഗ",romanization:"ga",category:"consonant",filename:"ga.mp3",storagePath:"consonants/with-a/ga.mp3",matchFilenames:["ga.mp3","g.mp3"],group:"Velar"},{id:"c-gha",malayalam:"ഘ",romanization:"gha",category:"consonant",filename:"gha.mp3",storagePath:"consonants/with-a/gha.mp3",matchFilenames:["gha.mp3","gh.mp3"],group:"Velar"},{id:"c-nga",malayalam:"ങ",romanization:"nga",category:"consonant",filename:"nga.mp3",storagePath:"consonants/with-a/nga.mp3",matchFilenames:["nga.mp3","ng.mp3"],group:"Velar"},{id:"c-cha",malayalam:"ച",romanization:"cha",category:"consonant",filename:"cha.mp3",storagePath:"consonants/with-a/cha.mp3",matchFilenames:["cha.mp3","ch.mp3"],group:"Palatal"},{id:"c-chha",malayalam:"ഛ",romanization:"chha",category:"consonant",filename:"chha.mp3",storagePath:"consonants/with-a/chha.mp3",matchFilenames:["chha.mp3","chh.mp3"],group:"Palatal"},{id:"c-ja",malayalam:"ജ",romanization:"ja",category:"consonant",filename:"ja.mp3",storagePath:"consonants/with-a/ja.mp3",matchFilenames:["ja.mp3","j.mp3"],group:"Palatal"},{id:"c-jha",malayalam:"ഝ",romanization:"jha",category:"consonant",filename:"jha.mp3",storagePath:"consonants/with-a/jha.mp3",matchFilenames:["jha.mp3","jh.mp3"],group:"Palatal"},{id:"c-nya",malayalam:"ഞ",romanization:"nya",category:"consonant",filename:"nya.mp3",storagePath:"consonants/with-a/nya.mp3",matchFilenames:["nya.mp3","ny.mp3"],group:"Palatal"},{id:"c-tta",malayalam:"ട",romanization:"tta",category:"consonant",filename:"tta.mp3",storagePath:"consonants/with-a/tta.mp3",matchFilenames:["tta.mp3","tt.mp3","ṭa.mp3"],group:"Retroflex"},{id:"c-ttha",malayalam:"ഠ",romanization:"ttha",category:"consonant",filename:"ttha.mp3",storagePath:"consonants/with-a/ttha.mp3",matchFilenames:["ttha.mp3","tth.mp3","ṭha.mp3"],group:"Retroflex"},{id:"c-dda",malayalam:"ഡ",romanization:"dda",category:"consonant",filename:"dda.mp3",storagePath:"consonants/with-a/dda.mp3",matchFilenames:["dda.mp3","dd.mp3","ḍa.mp3"],group:"Retroflex"},{id:"c-ddha",malayalam:"ഢ",romanization:"ddha",category:"consonant",filename:"ddha.mp3",storagePath:"consonants/with-a/ddha.mp3",matchFilenames:["ddha.mp3","ddh.mp3","ḍha.mp3"],group:"Retroflex"},{id:"c-nna",malayalam:"ണ",romanization:"nna",category:"consonant",filename:"nna.mp3",storagePath:"consonants/with-a/nna.mp3",matchFilenames:["nna.mp3","nn.mp3","ṇa.mp3"],group:"Retroflex"},{id:"c-ta",malayalam:"ത",romanization:"tha",category:"consonant",filename:"tha.mp3",storagePath:"consonants/with-a/tha.mp3",matchFilenames:["tha.mp3","th.mp3","ta.mp3"],group:"Dental"},{id:"c-thha",malayalam:"ഥ",romanization:"thha",category:"consonant",filename:"thha.mp3",storagePath:"consonants/with-a/thha.mp3",matchFilenames:["thha.mp3","thh.mp3"],group:"Dental"},{id:"c-da",malayalam:"ദ",romanization:"da",category:"consonant",filename:"da.mp3",storagePath:"consonants/with-a/da.mp3",matchFilenames:["da.mp3","d.mp3"],group:"Dental"},{id:"c-dha",malayalam:"ധ",romanization:"dha",category:"consonant",filename:"dha.mp3",storagePath:"consonants/with-a/dha.mp3",matchFilenames:["dha.mp3","dh.mp3"],group:"Dental"},{id:"c-na",malayalam:"ന",romanization:"na",category:"consonant",filename:"na.mp3",storagePath:"consonants/with-a/na.mp3",matchFilenames:["na.mp3","n.mp3"],group:"Dental"},{id:"c-pa",malayalam:"പ",romanization:"pa",category:"consonant",filename:"pa.mp3",storagePath:"consonants/with-a/pa.mp3",matchFilenames:["pa.mp3","p.mp3"],group:"Labial"},{id:"c-pha",malayalam:"ഫ",romanization:"pha",category:"consonant",filename:"pha.mp3",storagePath:"consonants/with-a/pha.mp3",matchFilenames:["pha.mp3","ph.mp3"],group:"Labial"},{id:"c-ba",malayalam:"ബ",romanization:"ba",category:"consonant",filename:"ba.mp3",storagePath:"consonants/with-a/ba.mp3",matchFilenames:["ba.mp3","b.mp3"],group:"Labial"},{id:"c-bha",malayalam:"ഭ",romanization:"bha",category:"consonant",f
1032ilename:"bha.mp3",storagePath:"consonants/with-a/bha.mp3",matchFilenames:["bha.mp3","bh.mp3"],group:"Labial"},{id:"c-ma",malayalam:"മ",romanization:"ma",category:"consonant",filename:"ma.mp3",storagePath:"consonants/with-a/ma.mp3",matchFilenames:["ma.mp3","m.mp3"],group:"Labial"},{id:"c-ya",malayalam:"യ",romanization:"ya",category:"consonant",filename:"ya.mp3",storagePath:"consonants/with-a/ya.mp3",matchFilenames:["ya.mp3","y.mp3"],group:"Semi-vowel"},{id:"c-ra",malayalam:"ര",romanization:"ra",category:"consonant",filename:"ra.mp3",storagePath:"consonants/with-a/ra.mp3",matchFilenames:["ra.mp3","r.mp3"],group:"Trill"},{id:"c-la",malayalam:"ല",romanization:"la",category:"consonant",filename:"la.mp3",storagePath:"consonants/with-a/la.mp3",matchFilenames:["la.mp3","l.mp3"],group:"Lateral"},{id:"c-va",malayalam:"വ",romanization:"va",category:"consonant",filename:"va.mp3",storagePath:"consonants/with-a/va.mp3",matchFilenames:["va.mp3","v.mp3"],group:"Semi-vowel"},{id:"c-sha",malayalam:"ശ",romanization:"sha",category:"consonant",filename:"sha.mp3",storagePath:"consonants/with-a/sha.mp3",matchFilenames:["sha.mp3","sh.mp3"],group:"Fricative"},{id:"c-shha",malayalam:"ഷ",romanization:"shha",category:"consonant",filename:"shha.mp3",storagePath:"consonants/with-a/shha.mp3",matchFilenames:["shha.mp3","shh.mp3","ṣha.mp3"],group:"Fricative"},{id:"c-sa",malayalam:"സ",romanization:"sa",category:"consonant",filename:"sa.mp3",storagePath:"consonants/with-a/sa.mp3",matchFilenames:["sa.mp3","s.mp3"],group:"Fricative"},{id:"c-ha",malayalam:"ഹ",romanization:"ha",category:"consonant",filename:"ha.mp3",storagePath:"consonants/with-a/ha.mp3",matchFilenames:["ha.mp3","h.mp3"],group:"Fricative"},{id:"c-lla",malayalam:"ള",romanization:"lla",category:"consonant",filename:"lla.mp3",storagePath:"consonants/with-a/lla.mp3",matchFilenames:["lla.mp3","ll.mp3","ḷa.mp3"],group:"Lateral"},{id:"c-zha",malayalam:"ഴ",romanization:"zha",category:"consonant",filename:"zha.mp3",storagePath:"consonants/with-a/zha.mp3",matchFilenames:["zha.mp3","zh.mp3"],group:"Rolled"},{id:"c-rra",malayalam:"റ",romanization:"rra",category:"consonant",filename:"rra.mp3",storagePath:"consonants/with-a/rra.mp3",matchFilenames:["rra.mp3","rr.mp3","ṟa.mp3"],group:"Trill"}],Ky=[{id:"m-aa",malayalam:"ാ",romanization:"aa",category:"matra",filename:"matra_aa.mp3",storagePath:"matras/matra_aa.mp3",matchFilenames:["matra_aa.mp3","matra-aa.mp3","aa_matra.mp3"],group:"Long"},{id:"m-i",malayalam:"ി",romanization:"i",category:"matra",filename:"matra_i.mp3",storagePath:"matras/matra_i.mp3",matchFilenames:["matra_i.mp3","matra-i.mp3","i_matra.mp3"],group:"Short"},{id:"m-ii",malayalam:"ീ",romanization:"ii",category:"matra",filename:"matra_ii.mp3",storagePath:"matras/matra_ii.mp3",matchFilenames:["matra_ii.mp3","matra-ii.mp3","ii_matra.mp3"],group:"Long"},{id:"m-u",malayalam:"ു",romanization:"u",category:"matra",filename:"matra_u.mp3",storagePath:"matras/matra_u.mp3",matchFilenames:["matra_u.mp3","matra-u.mp3","u_matra.mp3"],group:"Short"},{id:"m-uu",malayalam:"ൂ",romanization:"uu",category:"matra",filename:"matra_uu.mp3",storagePath:"matras/matra_uu.mp3",matchFilenames:["matra_uu.mp3","matra-uu.mp3","uu_matra.mp3"],group:"Long"},{id:"m-ri",malayalam:"ൃ",romanization:"ri",category:"matra",filename:"matra_ri.mp3",storagePath:"matras/matra_ri.mp3",matchFilenames:["matra_ri.mp3","matra-ri.mp3","ri_matra.mp3"],group:"Vocalic"},{id:"m-e",malayalam:"െ",romanization:"e",category:"matra",filename:"matra_e.mp3",storagePath:"matras/matra_e.mp3",matchFilenames:["matra_e.mp3","matra-e.mp3","e_matra.mp3"],group:"Short"},{id:"m-ee",malayalam:"േ",romanization:"ee",category:"matra",filename:"matra_ee.mp3",storagePath:"matras/matra_ee.mp3",matchFilenames:["matra_ee.mp3","matra-ee.mp3","ee_matra.mp3"],group:"Long"},{id:"m-ai",malayalam:"ൈ",romanization:"ai",category:"matra",filename:"matra_ai.mp3",storagePath:"matras/matra_ai.mp3",matchFilenames:["matra_ai.mp3","matra-ai.mp3","ai_matra.mp3"],group:"Diphthong"},{id:"m-o",malayalam:"ൊ",romanization:"o",category:"matra",filename:"matra_o.mp3",storagePath:"matras/matra_o.mp3",matchFilenames:["matra_o.mp3","matra-o.mp3","o_matra.mp3"],group:"Short"},{id:"m-oo",malayalam:"ോ",romanization:"oo",category:"matra",filename:"matra_oo.mp3",storagePath:"matras/matra_oo.mp3",matchFilenames:["matra_oo.mp3","matra-oo.mp3","oo_matra.mp3"],group:"Long"},{id:"m-au",malayalam:"ൗ",romanization:"au",category:"matra",filename:"matra_au.mp3",storagePath:"matras/matra_au.mp3",matchFilenames:["matra_au.mp3","matra-au.mp3","au_matra.mp3"],group:"Diphthong"},{id:"m-am",malayalam:"ം",romanization:"am",category:"matra",filename:"matra_am.mp3",storagePath:"matras/matra_am.mp3",matchFilenames:["matra_am.mp3","matra-am.mp3","am_matra.mp3","anusvara_matra.mp3"],group:"Anusvara"},{id:"m-ah",malayalam:"ഃ",romanization:"ah",category:"matra",filename:"matra_ah.mp3",storagePath:"matras/matra_ah.mp3",matchFilenames:["matra_ah.mp3","matra-ah.mp3","ah_matra.mp3","visarga_matra.mp3"],group:"Visarga"}],As=[...qy,...Gy,...Ky];function tLe(){const e=new Map;for(const t of As){for(const n of t.matchFilenames){const s=n.replace(/\.mp3$/i,"").toLowerCase();e.has(s)||e.set(s,t.id)}const r=t.romanization.toLowerCase();e.has(r)||e.set(r,t.id)}return e}
1032function rLe(e){const t=tLe(),r=e.replace(/^.*[\\/]/,"").replace(/\.(mp3|wav|ogg|m4a|webm)$/i,"").toLowerCase().trim();if(t.has(r))return t.get(r);for(const n of["vowel_","vowel-","consonant_","consonant-","matra_","matra-"])if(r.startsWith(n)){const s=r.slice(n.length);if(t.has(s))return t.get(s)}for(const n of As)if(r===n.malayalam)return n.id;return null}function nLe(e){return As.find(t=>t.id===e)}function aLe({entries:e,existsMap:t,loadingMap:r,uploadingIds:n,uploadedIds:s,failedIds:i,filter:o,onPlayAudio:l}){const[c,u]=y.useState(null),h=e.filter(m=>o==="missing"?!t[m.id]:o==="uploaded"?t[m.id]:!0),d=h.reduce((m,g)=>(m[g.group]||(m[g.group]=[]),m[g.group].push(g),m),{}),f=m=>{t[m.id]&&l&&(u(m.id),l(m),setTimeout(()=>u(null),2e3))};return h.length===0?a.jsxs("div",{className:"text-center py-12 text-gray-400",children:[a.jsx(xd,{className:"w-12 h-12 mx-auto mb-3 opacity-50"}),a.jsx("p",{className:"text-lg font-medium",children:"No characters match this filter"}),a.jsx("p",{className:"text-sm mt-1",children:"Try changing the filter above"})]}):a.jsx("div",{className:"space-y-6",children:Object.entries(d).map(([m,g])=>a.jsxs("div",{children:[a.jsx("h4",{className:"text-xs font-semibold text-gray-400 uppercase tracking-wider mb-3 px-1",children:m}),a.jsx("div",{className:"grid grid-cols-5 sm:grid-cols-6 md:grid-cols-8 lg:grid-cols-10 gap-2",children:g.map(p=>{const v=t[p.id],x=r[p.id],b=n.has(p.id),w=s.has(p.id),j=i.has(p.id);let _="border-gray-200",S="bg-white",k=null;return x?(S="bg-gray-50",k=a.jsx(Fe,{className:"w-3 h-3 animate-spin text-gray-400"})):b?(_="border-blue-400",S="bg-blue-50",k=a.jsx(Fe,{className:"w-3 h-3 animate-spin text-blue-500"})):w?(_="border-emerald-400",S="bg-emerald-50",k=a.jsx(Ri,{className:"w-3 h-3 text-emerald-600"})):j?(_="border-red-400",S="bg-red-50",k=a.jsx(ls,{className:"w-3 h-3 text-red-500"})):v?(_="border-emerald-300",S="bg-emerald-50/50",k=a.jsx(Ri,{className:"w-3 h-3 text-emerald-500"})):(_="border-red-200",S="bg-red-50/30",k=a.jsx(ls,{className:"w-3 h-3 text-red-400"})),a.jsxs("button",{onClick:()=>f(p),disabled:!v||b,className:`
1033                    relative group rounded-xl border-2 ${_} ${S}
1034                    p-2 sm:p-3 transition-all duration-200
1035                    hover:shadow-md hover:scale-105 active:scale-95
1036                    disabled:cursor-default disabled:hover:scale-100 disabled:hover:shadow-none
1037                    focus:outline-none focus:ring-2 focus:ring-blue-300
1038                  `,title:`${p.malayalam} (${p.romanization}) — ${p.filename}`,children:[a.jsx("div",{className:"absolute top-1 right-1",children:k}),a.jsx("div",{className:"text-xl sm:text-2xl font-bold text-gray-800 leading-none mb-1",children:p.malayalam}),a.jsx("div",{className:"text-[10px] sm:text-xs text-gray-500 font-mono truncate",children:p.romanization}),v&&!b&&a.jsx("div",{className:"absolute inset-0 rounded-xl bg-emerald-500/10 opacity-0 group-hover:opacity-100 transition-opacity flex items-center justify-center",children:a.jsx(Xe,{className:`w-4 h-4 text-emerald-600 ${c===p.id?"animate-pulse":""}`})})]},p.id)})})]},m))})}const ct={MIN_DURATION:.3,MAX_DURATION:5,WARN_MAX_DURATION:3,MIN_FILE_SIZE_KB:1,MAX_FILE_SIZE_KB:2048,SILENCE_RMS_THRESHOLD:-45,QUIET_RMS_THRESHOLD:-35,MIN_PEAK_AMPLITUDE:.01,QUIET_PEAK_AMPLITUDE:.05,MIN_SAMPLE_RATE:8e3,WARN_SAMPLE_RATE:22050};async function sLe(e){const t=[],r=e.size/1024,n={duration:null,sampleRate:null,channels:null,peakAmplitude:null,rmsLevel:null,rmsLinear:null,fileSizeKB:r,bitrateKbps:null};r<ct.MIN_FILE_SIZE_KB&&t.push({code:"FILE_TOO_SMALL",severity:"error",message:"File is too small",detail:`File is only ${r.toFixed(2)} KB. Minimum is ${ct.MIN_FILE_SIZE_KB} KB. The file may be empty or corrupted.`}),r>ct.MAX_FILE_SIZE_KB&&t.push({code:"FILE_TOO_LARGE",severity:"warning",message:"File is very large",detail:`File is ${r.toFixed(0)} KB (${(r/1024).toFixed(1)} MB). Consider compressing for faster loading. Max recommended: ${ct.MAX_FILE_SIZE_KB} KB.`});const s=/\.(mp3|wav|ogg|m4a|webm|aac)$/i;if(!e.type.startsWith("audio/")&&!s.test(e.name))return t.push({code:"INVALID_TYPE",severity:"error",message:"Not a valid audio file",detail:`File type "${e.type||"unknown"}" is not a recognized audio format.`}),{file:e,isValid:!1,hasWarnings:!1,issues:t,metadata:n};try{const l=await e.arrayBuffer(),c=new(window.AudioContext||window.webkitAudioContext);let u;
1038try{u=await c.decodeAudioData(l)}catch{return t.push({code:"DECODE_FAILED",severity:"error",message:"File could not be decoded",detail:"The audio file appears to be corrupted or in an unsupported format. Try re-encoding the file."}),c.close(),{file:e,isValid:!1,hasWarnings:t.some(k=>k.severity==="warning"),issues:t,metadata:n}}n.duration=u.duration,n.sampleRate=u.sampleRate,n.channels=u.numberOfChannels,n.bitrateKbps=n.duration>0?Math.round(e.size*8/(n.duration*1e3)):null;const h=u.getChannelData(0);let d=0,f=0;for(let S=0;S<h.length;S++){const k=Math.abs(h[S]);d+=k*k,k>f&&(f=k)}const m=Math.sqrt(d/h.length),g=m>0?20*Math.log10(m):-1/0;n.peakAmplitude=f,n.rmsLinear=m,n.rmsLevel=isFinite(g)?g:-100,u.duration<ct.MIN_DURATION&&t.push({code:"TOO_SHORT",severity:"error",message:"Audio is too short",detail:`Duration is ${(u.duration*1e3).toFixed(0)}ms. Minimum is ${ct.MIN_DURATION*1e3}ms. The pronunciation may be cut off.`}),u.duration>ct.MAX_DURATION?t.push({code:"TOO_LONG",severity:"error",message:"Audio is too long",detail:`Duration is ${u.duration.toFixed(1)}s. Maximum is ${ct.MAX_DURATION}s. Character pronunciations should be brief.`}):u.duration>ct.WARN_MAX_DURATION&&t.push({code:"DURATION_WARNING",severity:"warning",message:"Audio may be too long",detail:`Duration is ${u.duration.toFixed(1)}s. Recommended maximum is ${ct.WARN_MAX_DURATION}s for character pronunciations.`}),f<ct.MIN_PEAK_AMPLITUDE?t.push({code:"SILENT",severity:"error",message:"Audio appears to be silent",detail:`Peak amplitude is ${(f*100).toFixed(2)}%. The file contains no audible audio content.`}):g<ct.SILENCE_RMS_THRESHOLD?t.push({code:"NEAR_SILENT",severity:"error",message:"Audio is nearly silent",detail:`RMS level is ${g.toFixed(1)} dB (threshold: ${ct.SILENCE_RMS_THRESHOLD} dB). The audio may not be audible to learners.`}):g<ct.QUIET_RMS_THRESHOLD?t.push({code:"TOO_QUIET",severity:"warning",message:"Audio may be too quiet",detail:`RMS level is ${g.toFixed(1)} dB. Consider normalizing the audio for better audibility.`}):f<ct.QUIET_PEAK_AMPLITUDE&&t.push({code:"LOW_PEAK",severity:"warning",message:"Audio has low peak volume",detail:`Peak amplitude is only ${(f*100).toFixed(1)}%. Consider increasing the volume.`}),u.sampleRate<ct.MIN_SAMPLE_RATE?t.push({code:"LOW_SAMPLE_RATE",severity:"error",message:"Sample rate too low",detail:`Sample rate is ${u.sampleRate} Hz. Minimum is ${ct.MIN_SAMPLE_RATE} Hz.`}):u.sampleRate<ct.WARN_SAMPLE_RATE&&t.push({code:"SAMPLE_RATE_WARNING",severity:"warning",message:"Low sample rate",detail:`Sample rate is ${u.sampleRate} Hz. Recommended minimum is ${ct.WARN_SAMPLE_RATE} Hz for good quality.`});let p=0;for(let S=0;S<h.length;S++)Math.abs(h[S])>=.99&&p++;const v=p/h.length*100;v>1&&t.push({code:"CLIPPING",severity:"warning",message:"Audio may be clipping",detail:`${v.toFixed(1)}% of samples are at maximum amplitude. This can cause distortion.`});const x=.01;let b=0;for(let S=0;S<h.length&&!(Math.abs(h[S])>x);S++)b++;const w=b/u.sampleRate*1e3;let j=0;for(let S=h.length-1;S>=0&&!(Math.abs(h[S])>x);S--)j++;const _=j/u.sampleRate*1e3;w>500&&t.push({code:"LEADING_SILENCE",severity:"warning",message:"Long leading silence",detail:`${Math.round(w)}ms of silence at the start. Consider trimming for faster playback.`}),_>1e3&&t.push({code:"TRAILING_SILENCE",severity:"warning",message:"Long trailing silence",detail:`${Math.round(_)}ms of silence at the end. Consider trimming to reduce file size.`}),t.length===0&&t.push({code:"QUALITY_OK",severity:"info",message:"Audio quality looks good",detail
1038:`Duration: ${u.duration.toFixed(2)}s, Peak: ${(f*100).toFixed(0)}%, RMS: ${g.toFixed(1)} dB`}),c.close()}catch(l){t.push({code:"ANALYSIS_ERROR",severity:"error",message:"Failed to analyze audio",detail:l.message||"An unexpected error occurred while analyzing the audio file."})}const i=t.some(l=>l.severity==="error"),o=t.some(l=>l.severity==="warning");return{file:e,isValid:!i,hasWarnings:o,issues:t,metadata:n}}function BV(e){const t=e.length,r=e.filter(i=>i.isValid&&!i.hasWarnings).length,n=e.filter(i=>i.isValid&&i.hasWarnings).length,s=e.filter(i=>!i.isValid).length;return{total:t,passed:r,warnings:n,failed:s}}function ek(e){return e===null?"N/A":e<1?`${Math.round(e*1e3)}ms`:`${e.toFixed(2)}s`}function iLe(e){return e===null||!isFinite(e)?"N/A":`${e.toFixed(1)} dB`}function UV({severity:e,className:t="w-4 h-4"}){switch(e){case"error":return a.jsx(jt,{className:`${t} text-red-500`});case"warning":return a.jsx(Qr,{className:`${t} text-amber-500`});case"info":return a.jsx(mr,{className:`${t} text-emerald-500`})}}function yj({severity:e,label:t}){const r={error:"bg-red-100 text-red-700 border-red-200",warning:"bg-amber-100 text-amber-700 border-amber-200",info:"bg-emerald-100 text-emerald-700 border-emerald-200"};return a.jsxs("span",{className:`inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium border ${r[e]}`,children:[a.jsx(UV,{severity:e,className:"w-3 h-3"}),t]})}function oLe({rmsLinear:e,peak:t}){const r=e??0,n=t??0,s=Math.min(r*100*3,100),i=Math.min(n*100,100),o=()=>n<ct.MIN_PEAK_AMPLITUDE?"bg-red-400":n<ct.QUIET_PEAK_AMPLITUDE?"bg-amber-400":i>95?"bg-orange-400":"bg-emerald-400";return a.jsxs("div",{className:"flex items-center gap-2 w-full",children:[a.jsx(Xe,{className:"w-3.5 h-3.5 text-gray-400 flex-shrink-0"}),a.jsxs("div",{className:"flex-1 h-3 bg-gray-100 rounded-full overflow-hidden relative",children:[a.jsx("div",{className:`absolute inset-y-0 left-0 ${o()} rounded-full transition-all duration-300 opacity-70`,style:{width:`${s}%`}}),i>0&&a.jsx("div",{className:"absolute top-0 bottom-0 w-0.5 bg-gray-600 transition-all duration-300",style:{left:`${i}%`}})]}),a.jsx("span",{className:"text-[10px] text-gray-500 font-mono w-10 text-right flex-shrink-0",children:n>0?`${Math.round(i)}%`:"0%"})]})}function lLe({duration:e}){if(e===null)return null;const t=ct.MAX_DURATION,r=Math.min(e/t*100,100),n=ct.MIN_DURATION/t*100,s=ct.WARN_MAX_DURATION/t*100,i=()=>e<ct.MIN_DURATION||e>ct.MAX_DURATION?"bg-red-400":e>ct.WARN_MAX_DURATION?"bg-amber-400":"bg-emerald-400";return a.jsxs("div",{className:"flex items-center gap-2 w-full",children:[a.jsx(nh,{className:"w-3.5 h-3.5 text-gray-400 flex-shrink-0"}),a.jsxs("div",{className:"flex-1 h-3 bg-gray-100 rounded-full overflow-hidden relative",children:[a.jsx("div",{className:"absolute top-0 bottom-0 w-px bg-red-300 z-10",style:{left:`${n}%`}}),a.jsx("div",{className:"absolute top-0 bottom-0 w-px bg-amber-300 z-10",style:{left:`${s}%`}}),a.jsx("div",{className:`absolute inset-y-0 left-0 ${i()} rounded-full transition-all duration-300`,style:{width:`${r}%`}})]}),a.jsx("span",{className:"text-[10px] text-gray-500 font-mono w-12 text-right flex-shrink-0",children:ek(e)})]})}function cLe({result:e,index:t,onDismiss:r,compact:n}){const[s,i]=y.useState(!1),o=e.isValid?e.hasWarnings?"warning":"pass":"error",c={error:{bg:"bg-red-50/60",border:"border-red-200",icon:a.jsx(Nv,{className:"w-5 h-5 text-red-500"}),label:"Failed",labelBg:"bg-red-100 text-red-700"},warning:{bg:"bg-amber-50/60",border:"border-amber-200",icon:a.jsx(gi,{className:"w-5 h-5 text-amber-500"}),label:"Warnings",labelBg:"bg-amber-100 text-amber-700"},pass:{bg:"bg-emerald-50/40",border:"border-emerald-200",icon:a.jsx(kv,{className:"w-5 h-5 text-emerald-500"}),label:"Passed",labelBg:"bg-emerald-100 text-emerald-700"}}[o];return a.jsxs("div",{className:`border rounded-xl overflow-hidden transition-all duration-200 ${c.border} ${c.bg}`,children:[a.jsxs("button",{onClick:()=>i(!s),className:"w-full px-4 py-3 flex items-center gap-3 text-left hover:bg-white/40 transition-colors",children:[a.jsx("div",{className:"flex-shrink-0 text-gray-400",children:s?a.jsx(Cp,{className:"w-4 h-4"}):a.jsx(ns,{className:"w-4 h-4"})}),a.jsx("div",{className:"flex-shrink-0",children:c.icon}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[a.jsx("span",{className:"font-medium text-sm text-gray-800 truncate max-w-[200px]",children:e.file.name}),a.jsx("span",{className:`text-[10px] font-semibold px-1.5 py-0.5 rounded-full ${c.labelBg}`,children:c.label})]}),!n&&a.jsxs("div",{className:"flex items-center gap-3 mt-0.5 text-xs text-gray-500",children:[a.jsxs("span",{children:[e.metadata.fileSizeKB.toFixed(1)," KB"]}
1038),e.metadata.duration!==null&&a.jsx("span",{children:ek(e.metadata.duration)}),e.metadata.rmsLevel!==null&&a.jsx("span",{children:iLe(e.metadata.rmsLevel)})]})]}),a.jsxs("div",{className:"flex items-center gap-1.5 flex-shrink-0",children:[e.issues.filter(u=>u.severity==="error").length>0&&a.jsx(yj,{severity:"error",label:`${e.issues.filter(u=>u.severity==="error").length}`}),e.issues.filter(u=>u.severity==="warning").length>0&&a.jsx(yj,{severity:"warning",label:`${e.issues.filter(u=>u.severity==="warning").length}`}),e.issues.every(u=>u.severity==="info")&&a.jsx(yj,{severity:"info",label:"OK"})]}),r&&a.jsx("button",{onClick:u=>{u.stopPropagation(),r(t)},className:"flex-shrink-0 p-1 rounded-lg hover:bg-gray-200/60 text-gray-400 hover:text-gray-600 transition-colors",title:"Remove file",children:a.jsx(jt,{className:"w-4 h-4"})})]}),s&&a.jsxs("div",{className:"px-4 pb-4 border-t border-gray-100/80 pt-3 space-y-3",children:[(e.metadata.duration!==null||e.metadata.rmsLinear!==null)&&a.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3 p-3 bg-white/60 rounded-lg border border-gray-100",children:[a.jsxs("div",{children:[a.jsx("label",{className:"text-[10px] font-semibold text-gray-400 uppercase tracking-wider mb-1 block",children:"Duration"}),a.jsx(lLe,{duration:e.metadata.duration})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-[10px] font-semibold text-gray-400 uppercase tracking-wider mb-1 block",children:"Audio Level"}),a.jsx(oLe,{rmsLinear:e.metadata.rmsLinear,peak:e.metadata.peakAmplitude})]})]}),a.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-2",children:[{label:"File Size",value:`${e.metadata.fileSizeKB.toFixed(1)} KB`,icon:wv},{label:"Duration",value:ek(e.metadata.duration),icon:nh},{label:"Sample Rate",value:e.metadata.sampleRate?`${e.metadata.sampleRate} Hz`:"N/A",icon:jK},{label:"Bitrate",value:e.metadata.bitrateKbps?`${e.metadata.bitrateKbps} kbps`:"N/A",icon:ED}].map(({label:u,value:h,icon:d})=>a.jsxs("div",{className:"bg-white/80 rounded-lg p-2 border border-gray-100",children:[a.jsxs("div",{className:"flex items-center gap-1 mb-0.5",children:[a.jsx(d,{className:"w-3 h-3 text-gray-400"}),a.jsx("span",{className:"text-[10px] text-gray-400 font-medium",children:u})]}),a.jsx("span",{className:"text-xs font-semibold text-gray-700",children:h})]},u))}),a.jsx("div",{className:"space-y-1.5",children:e.issues.map((u,h)=>a.jsx(uLe,{issue:u},`${u.code}-${h}`))})]})]})}function uLe({issue:e}){const t={error:"bg-red-50 border-red-100",warning:"bg-amber-50 border-amber-100",info:"bg-emerald-50 border-emerald-100"};return a.jsxs("div",{className:`flex items-start gap-2.5 px-3 py-2 rounded-lg border ${t[e.severity]}`,children:[a.jsx(UV,{severity:e.severity,className:"w-4 h-4 mt-0.5 flex-shrink-0"}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("p",{className:"text-sm font-medium text-gray-800",children:e.message}),e.detail&&a.jsx("p",{className:"text-xs text-gray-500 mt-0.5",children:e.detail})]}),a.jsx("span",{className:"text-[9px] font-mono text-gray-400 bg-white/60 px-1.5 py-0.5 rounded flex-shrink-0",children:e.code})]})}function dLe({results:e,onDismissFile:t,compact:r=!1}){const[n,s]=y.useState(!1);if(e.length===0)return null;const i=BV(e),o=[...e].sort((c,u)=>{const h=c.isValid?c.hasWarnings?1:2:0,d=u.isValid?u.hasWarnings?1:2:0;return h-d}),l=n?o:o.slice(0,10);return a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"flex flex-wrap items-center gap-3 px-4 py-3 bg-white rounded-xl border border-gray-200 shadow-sm",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(gi,{className:"w-5 h-5 text-indigo-500"}),a.jsx("span",{className:"font-semibold text-sm text-gray-800",children:"Quality Validation"})]}),a.jsxs("div",{className:"flex items-center gap-2 ml-auto",children:[i.passed>0&&a.jsxs("div",{className:"flex items-center gap-1 px-2.5 py-1 bg-emerald-50 rounded-lg border border-emerald-200",children:[a.jsx(mr,{className:"w-3.5 h-3.5 text-emerald-500"}),a.jsxs("span",{className:"text-xs font-semibold text-emerald-700",children:[i.passed," passed"]})]}),i.warnings>0&&a.jsxs("div",{className:"flex items-center gap-1 px-2.5 py-1 bg-amber-50 rounded-lg border border-amber-200",children:[a.jsx(Qr,{className:"w-3.5 h-3.5 text-amber-500"}),a.jsxs("span",{className:"text-xs font-semibold text-amber-700",children:[i.warnings," warnings"]})]}),i.failed>0&&a.jsxs("div",{className:"flex items-center gap-1 px-2.5 py-1 bg-red-50 rounded-lg border border-red-200",children:[a.jsx(jt,{className:"w-3.5 h-3.5 text-red-500"}),a.jsxs("span",{className:"text-xs font-semibold text-red-700",children:[i.failed," failed"]})]})]})]}),a.jsxs("div",{className:"flex items-start gap-2 px-3 py-2 bg-blue-50/60 rounded-lg border border-blue-100 text-xs text-blue-700",children:[a.jsx(nl,{className:"w-4 h-4 flex-shrink-0 mt-0.5 text-blue-500"}),a.jsxs("div",{children:[a.jsx("span",{className:"font-medium",children:"Validation thresholds:"})," ","Duration ",ct.MIN_DURATION,"s–",ct.MAX_DURATION,"s, Min size ",ct.MIN_FILE_SIZE_KB," KB, Silence threshold ",ct.SILENCE_RMS_THRESHOLD," dB, Min sample rate ",ct.MIN_SAMPLE_RATE," Hz"]})]}),a.jsx("div",{className:"space-y-2",children:l.map((c,u)=>a.jsx(cLe,{result:c,index:u,onDismiss:t,compact:r},`${c.file.name}-${u}`))}),o.length>10&&!n&&a.jsx("div",{className:"text-center",children:a.jsxs(Y,{variant:"ghost",size:"sm",onClick:()=>s(!0),className:"text-blue-600 hover:text-blue-700",children:["Show all ",o.length," results"]})})]})}function hLe({onFilesMatched:e,onUploadAll:t,matchedFiles:r,isUploading:n,uploadProgress:s}){const[i,o]=y.useState(!1),[l,c]=y.useState(!1),[u,h]=y.useState(0),[d,f]=y.useState(0),[m,g]=y.useState(!1),[p,v]=y.useState(null),[x,b]=y.useState(null),w=y.useRef(null),j=y.useCallback(async R=>{const K=Array.from(R).filter(T=>T.type.startsWith("audio/")||/\.(mp3|wav|ogg|m4a|webm)$/i.test(T.name));if(K.length===0)return;const z=K.map(T=>{const $=rLe(T.name),V=$&&nLe($)||null;return{file:T,entryId:$,entry:V,status:$?"matched":"unmatched"}}
1038);c(!0),h(0),f(K.length),g(!0);const N=[];for(let T=0;T<z.length;T++){const $=z[T];try{const V=await sLe($.file);N.push({...$,validation:V})}catch{N.push({...$,validation:{file:$.file,isValid:!1,hasWarnings:!1,issues:[{code:"VALIDATION_ERROR",severity:"error",message:"Validation failed",detail:"Could not validate this file."}],metadata:{duration:null,sampleRate:null,channels:null,peakAmplitude:null,rmsLevel:null,rmsLinear:null,fileSizeKB:$.file.size/1024,bitrateKbps:null}}})}h(T+1)}c(!1),e(N)},[e]),_=y.useCallback(R=>{R.preventDefault(),R.stopPropagation(),o(!0)},[]),S=y.useCallback(R=>{R.preventDefault(),R.stopPropagation(),o(!1)},[]),k=y.useCallback(R=>{R.preventDefault(),R.stopPropagation(),o(!1),R.dataTransfer.files.length>0&&j(R.dataTransfer.files)},[j]),P=y.useCallback(R=>{R.target.files&&R.target.files.length>0&&j(R.target.files),R.target.value=""},[j]),C=y.useCallback(R=>{if(p&&(p.pause(),p.currentTime=0),x===R.name){b(null),v(null);return}const Q=URL.createObjectURL(R),K=new Audio(Q);K.onended=()=>{b(null),URL.revokeObjectURL(Q)},K.play(),v(K),b(R.name)},[p,x]),M=r.filter(R=>R.status==="matched"||R.status==="success").length,I=r.filter(R=>R.status==="unmatched").length,E=r.filter(R=>R.status==="success").length,B=r.filter(R=>R.status==="error").length,L=r.filter(R=>R.status==="matched"&&R.entryId&&(!R.validation||R.validation.isValid)).length,W=r.filter(R=>R.status==="matched"&&R.validation&&!R.validation.isValid).length;r.filter(R=>R.status==="matched"&&R.validation&&R.validation.isValid&&R.validation.hasWarnings).length;const D=r.filter(R=>R.validation).map(R=>R.validation),U=D.length>0?BV(D):null;return a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{onDragOver:_,onDragLeave:S,onDrop:k,onClick:()=>{var R;return(R=w.current)==null?void 0:R.click()},className:`
1039          relative cursor-pointer rounded-2xl border-3 border-dashed p-8 sm:p-12
1040          transition-all duration-300 text-center
1041          ${i?"border-blue-500 bg-blue-50 scale-[1.02] shadow-lg shadow-blue-100":"border-gray-300 bg-gray-50/50 hover:border-blue-400 hover:bg-blue-50/30"}
1042        `,children:[a.jsx("input",{ref:w,type:"file",accept:"audio/*,.mp3,.wav,.ogg,.m4a,.webm",multiple:!0,onChange:P,className:"hidden"}),a.jsxs("div",{className:`transition-transform duration-300 ${i?"scale-110":""}`,children:[a.jsx("div",{className:`
1043            w-16 h-16 mx-auto mb-4 rounded-2xl flex items-center justify-center
1044            ${i?"bg-blue-500 text-white":"bg-gradient-to-br from-blue-100 to-indigo-100 text-blue-600"}
1045          `,children:a.jsx(sm,{className:"w-8 h-8"})}),a.jsx("h3",{className:"text-lg font-bold text-gray-800 mb-1",children:i?"Drop files here!":"Drag & Drop MP3 Files"}),a.jsx("p",{className:"text-sm text-gray-500 mb-2",children:"Drop multiple MP3 files at once — they auto-match to characters by filename"}),a.jsxs("p",{className:"text-xs text-indigo-500 font-medium flex items-center justify-center gap-1.5",children:[a.jsx(gi,{className:"w-3.5 h-3.5"}),"Audio quality validation runs automatically on each file"]}),a.jsxs("div",{className:"flex items-center justify-center gap-2 text-xs text-gray-400 mt-2",children:[a.jsx(wv,{className:"w-4 h-4"}),a.jsx("span",{children:"Supports MP3, WAV, OGG, M4A, WebM"})]})]}),a.jsx("div",{className:"mt-4",children:a.jsx(Y,{variant:"outline",size:"sm",className:"pointer-events-none",children:"Or click to browse files"})})]}),l&&a.jsxs("div",{className:"bg-indigo-50 rounded-xl border border-indigo-200 p-4",children:[a.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[a.jsx("div",{className:"w-8 h-8 rounded-lg bg-indigo-100 flex items-center justify-center",children:a.jsx(gi,{className:"w-4 h-4 text-indigo-600 animate-pulse"})}),a.jsxs("div",{className:"flex-1",children:[a.jsx("p",{className:"text-sm font-semibold text-indigo-800",children:"Validating audio quality..."}),a.jsxs("p",{className:"text-xs text-indigo-600",children:["Checking duration, volume, silence, and file integrity — ",u," of ",d]})]}),a.jsxs("span",{className:"text-lg font-bold text-indigo-700",children:[d>0?Math.round(u/d*100):0,"%"]})]}),a.jsx("div",{className:"h-2 bg-indigo-100 rounded-full overflow-hidden",children:a.jsx("div",{className:"h-full bg-gradient-to-r from-indigo-500 to-purple-500 rounded-full transition-all duration-300",style:{width:`${d>0?u/d*100:0}%`}})})]}),a.jsx("div",{className:"bg-amber-50 border border-amber-200 rounded-xl p-4",children:a.jsxs("div",{className:"flex gap-3",children:[a.jsx(cn,{className:"w-5 h-5 text-amber-600 flex-shrink-0 mt-0.5"}),a.jsxs("div",{className:"text-sm text-amber-800",children:[a.jsx("p",{className:"font-semibold mb-1",children:"Filename Convention"}),a.jsxs("p",{className:"text-amber-700",children:["Name your files using romanization: ",a.jsx("code",{className:"bg-white px-1.5 py-0.5 rounded text-xs font-mono",children:"ka.mp3"})," for ക,"," ",a.jsx("code",{className:"bg-white px-1.5 py-0.5 rounded text-xs font-mono",children:"aa.mp3"})," for ആ,"," ",a.jsx("code",{className:"bg-white px-1.5 py-0.5 rounded text-xs font-mono",children:"matra_i.mp3"})," for ി, etc."]})]})]})}),r.length>0&&a.jsxs("div",{className:"bg-white rounded-2xl border border-gray-200 overflow-hidden",children:[a.jsxs("div",{className:"px-5 py-4 bg-gradient-to-r from-gray-50 to-white border-b border-gray-100",children:[a.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[a.jsxs("div",{className:"flex items-center gap-4 text-sm flex-wrap",children:[a.jsxs("span",{className:"font-semibold text-gray-700",children:[r.length," file",r.length!==1?"s":""," selected"]}),M>0&&a.jsxs("span",{className:"flex items-center gap-1 text-emerald-600",children:[a.jsx(mr,{className:"w-4 h-4"}),M," matched"]}),I>0&&a.jsxs("span",{className:"flex items-center gap-1 text-amber-600",children:[a.jsx(cn,{className:"w-4 h-4"}),I," unmatched"]}),E>0&&a.jsxs("span",{className:"flex items-center gap-1 text-emerald-600 font-medium",children:[a.jsx(mr,{className:"w-4 h-4"}),E," uploaded"]}),B>0&&a.jsxs("span",{className:"flex items-center gap-1 text-red-600",children:[a.jsx(jt,{className:"w-4 h-4"}),B," failed"]})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[D.length>0&&a.jsxs(Y,{variant:"outline",size:"sm",onClick:R=>{R.stopPropagation(),g(!m)},className:`gap-1.5 text-xs ${m?"bg-indigo-50 border-indigo-200 text-indigo-700":""}`,children:[a.jsx(gi,{className:"w-3.5 h-3.5"}),"Validation",U&&U.failed>0&&a.jsx("span",{className:"bg-red-100 text-red-700 text-[10px] px-1.5 py-0.5 rounded-full font-bold",children:U.failed}),U&&U.warnings>0&&U.failed===0&&a.jsx("span",{className:"bg-amber-100 text-amber-700 text-[10px] px-1.5 py-0.5 rounded-full font-bold",children:U.warnings})]}),a.jsx(Y,{onClick:R=>{R.stopPropagation(),t()},disabled:n||l||L===0,size:"sm",className:"bg-gradient-to-r from-blue-600 to-indigo-600 hover:from-blue-700 hover:to-indigo-700 text-white shadow-md",children:n?a.jsxs(a.Fragment,{children:[a.jsx(Fe,{className:"w-4 h-4 mr-2 animate-spin"}),"Uploading... ",Math.round(s),"%"]}):a.jsxs(a.Fragment,{children:[a.jsx(sm,{className:"w-4 h-4 mr-2"}),"Upload ",L," File",L!==1?"s":""]})})]})]}),U&&a.jsxs("div",{className:"flex items-center gap-3 mt-3 pt-3 border-t border-gray-100",children:[a.jsx(gi,{className:"w-4 h-4 text-indigo-500"}),a.jsx("span",{className:"text-xs font-medium text-gray-500",children:"Quality Check:"}),U.passed>0&&a.jsxs("span",{className:"flex items-center gap-1 text-xs text-emerald-600",children:[a.jsx(kv,{className:"w-3.5 h-3.5"}),U.passed," passed"]}),U.warnings>0&&a.jsxs("span",{className:"flex items-center gap-1 text-xs text-amber-600",children:[a.jsx(Qr,{className:"w-3.5 h-3.5"}),U.warnings," warnings"]}),U.failed>0&&a.jsxs("span",{className:"flex items-center gap-1 text-xs text-red-600",children:[a.jsx(Nv,{className:"w-3.5 h-3.5"}),U.failed," blocked"]}),W>0&&a.jsxs("span",{className:"text-xs text-red-500 ml-auto",children:[W," file",W!==1?"s":""," blocked from upload"]})]})]}),n&&a.jsx("div",{className:"h-1.5 bg-gray-100",children:a.jsx("div",{className:"h-full bg-gradient-to-r from-blue-500 to-indigo-500 transition-all duration-500 ease-out",style:{width:`${s}%`}})}),a.jsx("div",{className:"max-h-80 overflow-y-auto divide-y divide-gray-50",children:r.map((R,Q)=>{var T,$;const K=R.validation&&!R.validation.isValid,z=R.validation&&R.validation.isValid&&R.validation.hasWarnings,N=R.validation&&R.validation.isValid&&!R.validation.hasWarnings;return a.jsxs("div",{className:`
1046                    px-5 py-3 flex items-center gap-3 text-sm transition-colors
1047                    ${R.status==="success"?"bg-emerald-50/50":""}
1048                    ${R.status==="error"?"bg-red-50/50":""}
1049                    ${R.status==="uploading"?"bg-blue-50/50":""}
1050                    ${K&&R.status==="matched"?"bg-red-50/30":""}
1051                  `,children:[a.jsx("div",{className:`
1052                    w-8 h-8 rounded-lg flex items-center justify-center flex-shrink-0
1053                    ${R.status==="matched"&&!K?"bg-emerald-100 text-emerald-600":""}
1054                    ${R.status==="matched"&&K?"bg-red-100 text-red-600":""}
1055                    ${R.status==="unmatched"?"bg-amber-100 text-amber-600":""}
1056                    ${R.status==="uploading"?"bg-blue-100 text-blue-600":""}
1057                    ${R.status==="success"?"bg-emerald-100 text-emerald-600":""}
1058                    ${R.status==="error"?"bg-red-100 text-red-600":""}
1059                  `,children:R.status==="uploading"?a.jsx(Fe,{className:"w-4 h-4 animate-spin"}):R.status==="success"?a.jsx(mr,{className:"w-4 h-4"}):R.status==="error"?a.jsx(jt,{className:"w-4 h-4"}):K?a.jsx(Nv,{className:"w-4 h-4"}):a.jsx(vd,{className:"w-4 h-4"})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("p",{className:"font-medium text-gray-800 truncate",children:R.file.name}),K&&a.jsxs("span",{className:"inline-flex items-center gap-0.5 px-1.5 py-0.5 rounded-full text-[10px] font-bold bg-red-100 text-red-700 border border-red-200",children:[a.jsx(jt,{className:"w-2.5 h-2.5"}),"BLOCKED"]}),z&&a.jsxs("span",{className:"inline-flex items-center gap-0.5 px-1.5 py-0.5 rounded-full text-[10px] font-bold bg-amber-100 text-amber-700 border border-amber-200",children:[a.jsx(Qr,{className:"w-2.5 h-2.5"}),"WARNING"]}),N&&a.jsxs("span",{className:"inline-flex items-center gap-0.5 px-1.5 py-0.5 rounded-full text-[10px] font-bold bg-emerald-100 text-emerald-700 border border-emerald-200",children:[a.jsx(kv,{className:"w-2.5 h-2.5"}),"OK"]})]}),a.jsxs("div",{className:"flex items-center gap-2 text-xs text-gray-500",children:[a.jsxs("span",{children:[(R.file.size/1024).toFixed(1)," KB"]}
1059),((T=R.validation)==null?void 0:T.metadata.duration)!=null&&a.jsx("span",{children:R.validation.metadata.duration<1?`${Math.round(R.validation.metadata.duration*1e3)}ms`:`${R.validation.metadata.duration.toFixed(2)}s`}),(($=R.validation)==null?void 0:$.metadata.rmsLevel)!=null&&a.jsxs("span",{children:[R.validation.metadata.rmsLevel.toFixed(1)," dB"]}),R.errorMessage&&a.jsx("span",{className:"text-red-500",children:R.errorMessage}),K&&R.validation&&a.jsx("span",{className:"text-red-500",children:R.validation.issues.filter(V=>V.severity==="error").map(V=>V.message).join(", ")})]})]}),a.jsx("button",{onClick:V=>{V.stopPropagation(),C(R.file)},className:"w-7 h-7 rounded-full bg-gray-100 hover:bg-gray-200 flex items-center justify-center text-gray-500 hover:text-gray-700 transition-colors flex-shrink-0",title:"Preview audio",children:x===R.file.name?a.jsx(ss,{className:"w-3.5 h-3.5"}):a.jsx(Bt,{className:"w-3.5 h-3.5 ml-0.5"})}),a.jsx("div",{className:"text-right flex-shrink-0",children:R.entry?a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-lg font-bold text-gray-800",children:R.entry.malayalam}),a.jsx("span",{className:"text-xs text-gray-500 font-mono",children:R.entry.romanization})]}):a.jsx("span",{className:"text-xs text-amber-600 font-medium",children:"No match found"})})]},`${R.file.name}-${Q}`)})})]}),m&&D.length>0&&a.jsx(dLe,{results:D,compact:!1})]})}const iu="audio-files";function fLe(){const[e,t]=y.useState({}),[r,n]=y.useState({}),[s,i]=y.useState(!1),[o,l]=y.useState(0),[c,u]=y.useState("all"),[h,d]=y.useState("all"),[f,m]=y.useState([]),[g,p]=y.useState(!1),[v,x]=y.useState(0),[b,w]=y.useState(new Set),[j,_]=y.useState(new Set),[S,k]=y.useState(new Set),[P,C]=y.useState(null),I=(()=>{switch(c){case"vowels":return qy;case"consonants":return Gy;case"matras":return Ky;default:return As}})(),E=I.length,B=I.filter($=>e[$.id]).length,A=E-B,L=E>0?Math.round(B/E*100):0,W=f.filter($=>$.validation),D=W.filter($=>$.validation.isValid&&!$.validation.hasWarnings).length,U=W.filter($=>$.validation.isValid&&$.validation.hasWarnings).length,R=W.filter($=>!$.validation.isValid).length,Q=y.useCallback(async()=>{i(!0),l(0);const $={},V={};for(const X of As)V[X.id]=!0;n({...V});const q=new Set;try{const{data:X}=await ne.storage.from(iu).list("",{limit:1e3});if(X)for(const ee of X)ee.metadata!==null&&q.add(ee.name.toLowerCase());for(const ee of["vowels","consonants","consonants/with-a","consonants/isolated","matras"])try{const{data:ie}=await ne.storage.from(iu).list(ee,{limit:1e3});if(ie)for(const oe of ie)oe.metadata!==null&&q.add(`${ee}/${oe.name}`.toLowerCase())}catch{}}catch(X){console.warn("Error listing bucket files:",X)}let te=0;for(const X of As){const ee=q.has(X.storagePath.toLowerCase()),ie=q.has(X.filename.toLowerCase());$[X.id]=ee||ie,V[X.id]=!1,te++,l(Math.round(te/As.length*100)),(te%10===0||te===As.length)&&(t({...$}),n({...V}))}if(q.size===0){for(const X of As.slice(0,5))try{const ee=`${tr}/storage/v1/object/public/${iu}/${X.storagePath}`;(await fetch(ee,{method:"HEAD",cache:"no-cache"})).ok&&($[X.id]=!0)}catch{}t({...$})}i(!1),C(new Date().toLocaleTimeString())},[]);y.useEffect(()=>{Q()},[Q]);const K=y.useCallback($=>{m(V=>{const q=new Map;for(const te of V){const X=te.entryId||te.file.name;q.set(X,te)}for(const te of $){const X=te.entryId||te.file.name;q.set(X,te)}return Array.from(q.values())})},[]),z=y.useCallback(async()=>{const $=f.filter(ie=>ie.status!=="matched"||!ie.entryId||!ie.entry?!1:ie.validation?!!ie.validation.isValid:!0);if($.length===0)return;p(!0),x(0);const V=new Set,q=new Set(j),te=new Set(S);for(const ie of $)ie.entryId&&V.add(ie.entryId);w(new Set(V));let X=0;const ee=[...f];for(const ie of $){if(!ie.entry||!ie.entryId)continue;const oe=ee.findIndex(we=>we.entryId===ie.entryId);oe>=0&&(ee[oe]={...ee[oe],status:"uploading"}),m([...ee]);try{const{error:we}=await ne.storage.from(iu).upload(ie.entry.storagePath,ie.file,{cacheControl:"3600",upsert:!0});if(we)throw we;oe>=0&&(ee[oe]={...ee[oe],status:"success"}),V.delete(ie.entryId),q.add(ie.entryId),t(O=>({...O,[ie.entryId]:!0}))}catch(we){oe>=0&&(ee[oe]={...ee[oe],status:"error",errorMessage:we.message||"Upload failed"}),V.delete(ie.entryId),te.add(ie.entryId)}X++,x(Math.round(X/$.length*100)),m([...ee]),w(new Set(V)),_(new Set(q)),k(new Set(te))}p(!1)},[f,j,S]),N=y.useCallback($=>{const V=`${tr}/storage/v1/object/public/${iu}/${$.storagePath}`;new Audio(V).play().catch(()=>{const te=`${tr}/storage/v1/object/public/${iu}/${$.filename}`;new Audio(te).play().catch(console.warn)})},[]),T=[{key:"all",label:"All",icon:a.jsx(vd,{className:"w-4 h-4"}),count:As.length},{key:"vowels",label:"Vowels",icon:a.jsx("span",{className:"text-sm font-bold",children:"അ"}),count:qy.length},{key:"consonants",label:"Consonants",icon:a.jsx("span",{className:"text-sm font-bold",children:"ക"}),count:Gy.length},{key:"matras",label:"Matras",icon:a.jsx("span",{className:"text-sm font-bold",children:"ാ"}),count:Ky.length}];return a.jsxs("div",{className:"min-h-screen bg-gradient-to-br from-slate-50 via-white to-blue-50/30",children:[a.jsx("header",{className:"sticky top-0 z-30 bg-white/80 backdrop-blur-xl border-b border-gray-200/60 shadow-sm",children:a.jsxs("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 py-3 flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(it,{to:"/app",children:a.jsxs(Y,{variant:"ghost",size:"sm",className:"gap-2",children:[a.jsx(Ll,{className:"w-4 h-4"}),a.jsx("span",{className:"hidden sm:inline",children:"Back"})]})}),a.jsx("div",{className:"h-6 w-px bg-gray-200"}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("div",{className:"w-8 h-8 rounded-lg bg-gradient-to-br from-blue-600 to-indigo-600 flex items-center justify-center",children:a.jsx(pd,{className:"w-4 h-4 text-white"})}),a.jsxs("div",{children:[a.jsx("h1",{className:"text-lg font-bold text-gray-900 leading-tight",children:"Audio Upload Manager"}),a.jsx("p",{className:"text-xs text-gray-500 hidden sm:block",children:"Drag & drop with quality validation"})]})]})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[P&&a.jsxs("span",{className:"text-xs text-gray-400 hidden md:inline",children:["Last scan: ",P]}),a.jsxs(Y,{variant:"outline",size:"sm",onClick:Q,disabled:s,className:"gap-2",children:[a.jsx(Xt,{className:`w-4 h-4 ${s?"animate-spin":""}`}),a.jsx("span",{className:"hidden sm:inline",children:s?"Scanning...":"Rescan"})]})]})]})}),a.jsxs("main",{className:"max-w-7xl mx-auto px-4 sm:px-6 py-6 space-y-6",children:[a.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-3",children:[a.jsxs("div",{className:"bg-white rounded-2xl border border-gray-200 p-4 shadow-sm",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx("div",{className:"w-8 h-8 rounded-lg bg-blue-100 flex items-center justify-center",children:a.jsx(e2,{className:"w-4 h-4 text-blue-600"})}),a.jsx("span",{className:"text-xs font-medium text-gray-500 uppercase tracking-wider",children:"Total"})]}),a.jsx("p",{className:"text-2xl font-bold text-gray-900",children:E}),a.jsx("p",{className:"text-xs text-gray-400",children:"characters"})]}),a.jsxs("div",{className:"bg-white rounded-2xl border border-emerald-200 p-4 shadow-sm",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx("div",{className:"w-8 h-8 rounded-lg bg-emerald-100 flex items-center justify-center",children:a.jsx(mr,{className:"w-4 h-4 text-emerald-600"})}),a.jsx("span",{className:"text-xs font-medium text-gray-500 uppercase tracking-wider",children:"Uploaded"})]}),a.jsx("p",{className:"text-2xl font-bold text-emerald-600",children:B}),a.jsx("p",{className:"text-xs text-gray-400",children:"files found"})]}),a.jsxs("div",{className:"bg-white rounded-2xl border border-red-200 p-4 shadow-sm",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx("div",{className:"w-8 h-8 rounded-lg bg-red-100 flex items-center justify-center",children:a.jsx(jt,{className:"w-4 h-4 text-red-500"})}),a.jsx("span",{className:"text-xs font-medium text-gray-500 uppercase tracking-wider",children:"Missing"})]}),a.jsx("p",{className:"text-2xl font-bold text-red-500",children:A}),a.jsx("p",{className:"text-xs text-gray-400",children:"need upload"})]}),a.jsxs("div",{className:"bg-white rounded-2xl border border-indigo-200 p-4 shadow-sm",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx("div",{className:"w-8 h-8 rounded-lg bg-indigo-100 flex items-center justify-center",children:a.jsx(Xe,{className:"w-4 h-4 text-indigo-600"})}),a.jsx("span",{className:"text-xs font-medium text-gray-500 uppercase tracking-wider",children:"Coverage"})]}),a.jsxs("p",{className:"text-2xl font-bold text-indigo-600",children:[L,"%"]}),a.jsx("div",{className:"mt-1 h-1.5 bg-gray-100 rounded-full overflow-hidden",children:a.jsx("div",{className:"h-full bg-gradient-to-r from-indigo-500 to-blue-500 rounded-full transition-all duration-700",style:{width:`${L}%`}})})]})]}),a.jsxs("div",{className:"bg-gradient-to-r from-indigo-50 to-purple-50 rounded-2xl border border-indigo-200/60 p-5",children:[a.jsxs("div",{className:"flex items-start gap-4",children:[a.jsx("div",{className:"w-10 h-10 rounded-xl bg-gradient-to-br from-indigo-500 to-purple-500 flex items-center justify-center flex-shrink-0",children:a.jsx(gi,{className:"w-5 h-5 text-white"})}),a.jsxs("div",{className:"flex-1",children:[a.jsx("h3",{className:"font-bold text-gray-800 mb
1059-1",children:"Audio Quality Validation"}),a.jsx("p",{className:"text-sm text-gray-600 mb-3",children:"Every file is automatically checked before upload. Files that fail validation are blocked to ensure learners get high-quality audio."}),a.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-2 text-xs",children:[a.jsxs("div",{className:"bg-white/70 rounded-lg px-3 py-2 border border-indigo-100",children:[a.jsxs("div",{className:"flex items-center gap-1.5 text-gray-500 mb-0.5",children:[a.jsxs("svg",{className:"w-3 h-3",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[a.jsx("circle",{cx:"12",cy:"12",r:"10"}),a.jsx("polyline",{points:"12,6 12,12 16,14"})]}),"Duration"]}),a.jsx("span",{className:"font-semibold text-gray-800",children:"0.3s – 5.0s"})]}),a.jsxs("div",{className:"bg-white/70 rounded-lg px-3 py-2 border border-indigo-100",children:[a.jsxs("div",{className:"flex items-center gap-1.5 text-gray-500 mb-0.5",children:[a.jsxs("svg",{className:"w-3 h-3",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[a.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),a.jsx("polyline",{points:"14,2 14,8 20,8"})]}),"Min Size"]}),a.jsx("span",{className:"font-semibold text-gray-800",children:"1 KB"})]}),a.jsxs("div",{className:"bg-white/70 rounded-lg px-3 py-2 border border-indigo-100",children:[a.jsxs("div",{className:"flex items-center gap-1.5 text-gray-500 mb-0.5",children:[a.jsxs("svg",{className:"w-3 h-3",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[a.jsx("polygon",{points:"11,5 6,9 2,9 2,15 6,15 11,19"}),a.jsx("path",{d:"M19.07 4.93a10 10 0 0 1 0 14.14"})]}),"Silence"]}),a.jsx("span",{className:"font-semibold text-gray-800",children:"> -45 dB RMS"})]}),a.jsxs("div",{className:"bg-white/70 rounded-lg px-3 py-2 border border-indigo-100",children:[a.jsxs("div",{className:"flex items-center gap-1.5 text-gray-500 mb-0.5",children:[a.jsx("svg",{className:"w-3 h-3",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:a.jsx("path",{d:"M22 12h-4l-3 9L9 3l-3 9H2"})}),"Sample Rate"]}),a.jsx("span",{className:"font-semibold text-gray-800",children:"≥ 8,000 Hz"})]})]})]})]}),W.length>0&&a.jsxs("div",{className:"mt-4 pt-4 border-t border-indigo-200/40 flex flex-wrap items-center gap-3",children:[a.jsx("span",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wider",children:"Current batch:"}),D>0&&a.jsxs("div",{className:"flex items-center gap-1.5 px-3 py-1.5 bg-emerald-100/80 rounded-lg border border-emerald-200",children:[a.jsx(kv,{className:"w-3.5 h-3.5 text-emerald-600"}),a.jsxs("span",{className:"text-xs font-semibold text-emerald-700",children:[D," passed"]})]}),U>0&&a.jsxs("div",{className:"flex items-center gap-1.5 px-3 py-1.5 bg-amber-100/80 rounded-lg border border-amber-200",children:[a.jsx(Qr,{className:"w-3.5 h-3.5 text-amber-600"}),a.jsxs("span",{className:"text-xs font-semibold text-amber-700",children:[U," with warnings"]})]}),R>0&&a.jsxs("div",{className:"flex items-center gap-1.5 px-3 py-1.5 bg-red-100/80 rounded-lg border border-red-200",children:[a.jsx(Nv,{className:"w-3.5 h-3.5 text-red-600"}),a.jsxs("span",{className:"text-xs font-semibold text-red-700",children:[R," blocked"]})]})]})]}),s&&a.jsxs("div",{className:"bg-blue-50 rounded-xl border border-blue-200 p-4",children:[a.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[a.jsx(Fe,{className:"w-5 h-5 animate-spin text-blue-600"}),a.jsxs("span",{className:"text-sm font-medium text-blue-800",children:["Scanning storage for existing audio files... ",o,"%"]})]}),a.jsx("div",{className:"h-2 bg-blue-100 rounded-full overflow-hidden",children:a.jsx("div",{className:"h-full bg-blue-500 rounded-full transition-all duration-300",style:{width:`${o}%`}})})]}),a.jsx(hLe,{onFilesMatched:K,onUploadAll:z,matchedFiles:f,isUploading:g,uploadProgress:v}),a.jsxs("div",{className:"bg-white rounded-2xl border border-gray-200 shadow-sm overflow-hidden",children:[a.jsxs("div",{className:"border-b border-gray-100 px-4 pt-4",children:[a.jsx("div",{className:"flex flex-wrap gap-1 mb-3",children:T.map($=>a.jsxs("button",{onClick:()=>u($.key),className:`
1060                    flex items-center gap-2 px-4 py-2 rounded-xl text-sm font-medium transition-all
1061                    ${c===$.key?"bg-blue-600 text-white shadow-md shadow-blue-200":"bg-gray-100 text-gray-600 hover:bg-gray-200"}
1062                  `,children:[$.icon,$.label,a.jsx("span",{className:`
1063                    text-xs px-1.5 py-0.5 rounded-full
1064                    ${c===$.key?"bg-blue-500 text-blue-100":"bg-gray-200 text-gray-500"}
1065                  `,children:$.count})]},$.key))}),a.jsxs("div",{className:"flex items-center gap-2 pb-3",children:[a.jsx(t2,{className:"w-4 h-4 text-gray-400"}),a.jsx("span",{className:"text-xs text-gray-500 mr-1",children:"Show:"}),["all","missing","uploaded"].map($=>a.jsx("button",{onClick:()=>d($),className:`
1066                    text-xs px-3 py-1.5 rounded-lg font-medium transition-all
1067                    ${h===$?$==="missing"?"bg-red-100 text-red-700 ring-1 ring-red-200":$==="uploaded"?"bg-emerald-100 text-emerald-700 ring-1 ring-emerald-200":"bg-blue-100 text-blue-700 ring-1 ring-blue-200":"bg-gray-50 text-gray-500 hover:bg-gray-100"}
1068                  `,children:$==="all"?"All":$==="missing"?"Missing":"Uploaded"},$))]})]}),a.jsx("div",{className:"p-4 sm:p-6",children:a.jsx(aLe,{entries:I,existsMap:e,loadingMap:r,uploadingIds:b,uploadedIds:j,failedIds:S,filter:h,onPlayAudio:N})})]}),a.jsxs("details",{className:"bg-white rounded-2xl border border-gray-200 shadow-sm overflow-hidden",children:[a.jsxs("summary",{className:"px-6 py-4 cursor-pointer hover:bg-gray-50 transition-colors",children:[a.jsx("span",{className:"font-semibold text-gray-800",children:"Filename Reference Guide"}),a.jsx("span",{className:"text-sm text-gray-500 ml-2",children:"(click to expand)"})]}),a.jsxs("div",{className:"px-6 pb-6 border-t border-gray-100 pt-4",children:[a.jsx("p",{className:"text-sm text-gray-600 mb-4",children:"Name your MP3 files using these romanized names for auto-matching:"}),a.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4",children:[a.jsxs("div",{children:[a.jsx("h4",{className:"text-xs font-bold text-gray-400 uppercase tracking-wider mb-2",children:"Vowels"}),a.jsx("div",{className:"space-y-1",children:qy.map($=>a.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[a.jsx("span",{className:"w-8 text-lg font-bold text-gray-800",children:$.malayalam}),a.jsx("code",{className:"text-xs bg-gray-100 px-2 py-0.5 rounded font-mono text-blue-700",children:$.filename}),e[$.id]&&a.jsx(mr,{className:"w-3 h-3 text-emerald-500"})]},$.id))})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"text-xs font-bold text-gray-400 uppercase tracking-wider mb-2",children:"Consonants"}),a.jsx("div",{className:"space-y-1",children:Gy.map($=>a.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[a.jsx("span",{className:"w-8 text-lg font-bold text-gray-800",children:$.malayalam}),a.jsx("code",{className:"text-xs bg-gray-100 px-2 py-0.5 rounded font-mono text-blue-700",children:$.filename}),e[$.id]&&a.jsx(mr,{className:"w-3 h-3 text-emerald-500"})]},$.id))})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"text-xs font-bold text-gray-400 uppercase tracking-wider mb-2",children:"Matras (Vowel Signs)"}),a.jsx("div",{className:"space-y-1",children:Ky.map($=>a.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[a.jsxs("span",{className:"w-8 text-lg font-bold text-gray-800",children:["ക",$.malayalam]}),a.jsx("code",{className:"text-xs bg-gray-100 px-2 py-0.5 rounded font-mono text-blue-700",children:$.filename}),e[$.id]&&a.jsx(mr,{className:"w-3 h-3 text-emerald-500"})]},$.id))})]})]})]})]})]})]})}const vj=[{character:"ഴ",romanization:"zha",ipa:"/ɻ/",name:"Retroflex Approximant",category:"Unique Malayalam",difficulty:"hard",mouthPosition:{tongueX:55,tongueY:45,tongueWidth:35,tongueCurve:"M 40 65 Q 55 30 75 55",lipOpen:.5,lipRound:.3,jawDrop:.4,airflow:"oral",voicing:!0,label:"Tongue curled back, tip near palate"},description:"One of the most unique sounds in Malayalam. The tongue curls back (retroflex) and the tip approaches the hard palate without touching it.",tips:["Curl your tongue tip backwards toward the roof of your mouth","Don't let the tongue actually touch the palate","The sound is voiced - your vocal cords vibrate",'Think of it as a "zh" sound made further back in the mouth'],similarEnglish:'No exact English equivalent. Closest: "r" in American English "bird"',uniqueFeature:"This sound exists only in Malayalam and Tamil among major languages!"},{character:"റ്റ",romanization:"rtta",ipa:"/ʈʈa/",name:"Geminated Retroflex Stop",category:"Unique Malayalam",difficulty:"hard",mouthPosition:{tongueX:60,tongueY:35,tongueWidth:30,tongueCurve:"M 45 65 Q 60 25 70 45",lipOpen:.4,lipRound:.2,jawDrop:.3,airflow:"oral",voicing:!1,label:"Tongue tip pressed firmly against palate"},description:"A doubled retroflex stop. The tongue tip curls back and presses firmly against the hard palate, then releases with a burst of air.",tips:["Curl tongue back and press tip firmly against the hard palate","Hold the closure briefly (it's a geminate/doubled sound)",'Release with a sharp burst - like a strong "t"','Practice: "atta" but with tongue curled back'],similarEnglish:'Like a very strong "tt" in "butter" (American English) but retroflex'},{character:"ണ",romanization:"ṇa",ipa:"/ɳ/",name:"Retroflex Nasal",category:"Retroflex",difficulty:"medium",mouthPosition:{tongueX:58,tongueY:38,tongueWidth:32,tongueCurve:"M 42 65 Q 58 28 72 50",lipOpen:.3,lipRound:.2,jawDrop:.3,airflow:"nasal",voicing:!0,label:"Tongue curled back, air through nose"},description:"A nasal sound made with the tongue curled back. Air flows through the nose while the tongue tip touches the hard palate.",tips:["Curl tongue back like for ഴ, but press it against the palate","Let air flow through your nose (like humming)","Feel the vibration in your nose bridge","Compare with dental ന - this is further back"],similarEnglish:'Like "n" but with tongue curled back (retroflex)'},{character:"ള",romanization:"ḷa",ipa:"/ɭ/",name:"Retroflex Lateral",category:"Retroflex",difficulty:"medium",mouthPosition:{tongueX:55,tongueY:40,tongueWidth:35,tongueCurve:"M 38 65 Q 55 32 73 52",lipOpen:.4,lipRound:.2,jawDrop:.35,airflow:"oral",voicing:!0,label:"Tongue curled back, air flows around sides"},description:"A lateral sound with the tongue curled back. Air flows around the sides of the tongue while the tip touches the palate.",tips:["Curl tongue back and touch the hard palate","Let air escape around the sides of your tongue",`It's like an "L" sound but further back`,"Keep your vocal cords vibrating throughout"],similarEnglish:'Like "l" in "ball" but with tongue curled back'},{character:"ശ",romanization:"sha",ipa:"/ɕ/",name:"Palatal Fricative",category:"Sibilant",difficulty:"easy",mouthPosition:{tongueX:50,tongueY:42,tongueWidth:40,tongueCurve:"M 30 65 Q 50 35 70 55",lipOpen:.3,lipRound:.1,jawDrop:.25,airflow:"oral",voicing:!1,label:"Tongue blade near hard palate, friction"},description:"A hissing sound made with the tongue blade raised toward the hard palate. Air creates friction as it passes through the narrow gap.",tips:["Raise the middle of your tongue toward the hard palate","Create a narrow channel for air to hiss through",'Similar to English "sh" but more forward',"No voicing - vocal cords don't vibrate"],similarEnglish:'Similar to "sh" in "ship" but tongue is more forward'},{character:"ഷ",romanization:"ṣha",ipa:"/ʂ/",name:"Retroflex Fricative",category:"Sibilant",difficulty:"medium",mouthPosition:{tongueX:58,tongueY:38,tongueWidth:35,tongueCurve:"M 38 65 Q 58 30 75 50",lipOpen:.3,lipRound:.15,jawDrop:.25,airflow:"oral",voicing:!1,label:"Tongue tip curled back, friction"},description:"A hissing sound with the tongue curled back. The tip approaches the hard palate creating friction.",tips:["Curl your tongue tip back toward the palate","Create friction by narrowing the air channel","Sounds deeper/heavier than ശ",'Think of a "sh" sound made further back'],similarEnglish:'Like a deeper version of "sh" - tongue curled back'},{character:"ഞ",romanization:"ña",ipa:"/ɲ/",name:"Palatal Nasal",category:"Nasal",difficulty:"medium",mouthPosition:{tongueX:48,tongueY:40,tongueWidth:38,tongueCurve:"M 28 65 Q 48 32 68 55",lipOpen:.3,lipRound:.2,jawDrop:.3,airflow:"nasal",voicing:!0,label:"Tongue body pressed against hard palate"},description:"A nasal sound made with the body of the tongue pressed against the hard palate. Air flows through the nose.",tips:["Press the middle of your tongue against the hard palate","Let air flow through your nose",'Similar to "ny" in "canyon"',"Feel the vibration in your nasal cavity"],similarEnglish:'Like "ny" in "canyon" or Spanish "ñ" in "señor"'},{character:"ങ",romanization:"nga",ipa:"/ŋ/",name:"Velar Nasal",category:"Nasal",difficulty:"easy",mouthPosition:{tongueX:65,tongueY:42,tongueWidth:35,tongueCurve:"M 45 65 Q 65 35 80 55",lipOpen:.3,lipRound:.2,jawDrop:.3,airflow:"nasal",voicing:!0,label:"Back of tongue against soft palate"},description:"A nasal sound made with the back of the tongue pressed against the soft palate (velum). Air flows through the nose.",tips:["Raise the back of your tongue to touch the soft palate","Let air flow through your nose",'Same as "ng" in English "sing"',`Don't add a "g" sound after it`],similarEnglish:'Exactly like "ng" in "sing" or "ring"'}],mLe=({position:e,isAnimating:t})=>{const r=15+e.lipOpen*30,n=e.lipRound,s=e.jawDrop*15;return a.jsxs("svg",{viewBox:"0 0 200 180",className:"w-full max-w-xs mx-auto",children:[a.jsx("ellipse",{cx:"100",cy:"85",rx:"85",ry:"80",fill:"#FDE8D0",stroke:"#D4A574",strokeWidth:"2"}),a.jsx("path",{d:"M 95 30 Q 90 45 95 55 L 105 55 Q 110 45 105 30",fill:"none",stroke:"#D4A574",strokeWidth:"1.5"}),a.jsx("rect",{x:"88",y:"20",width:"24",height:"35",rx:"8",fill:e.airflow!=="oral"?"#93C5FD":"#FDE8D0",opacity:e.airflow!=="oral"?.6:.3,stroke:"#D4A574",strokeWidth:"0.5"}),e.airflow!=="oral"&&a.jsxs("g",{className:t?"animate-pulse":"",children:[a.jsx("circle",{cx:"95",cy:"32",r:"2",fill:"#3B82F6",opacity:"0.7"}),a.jsx("circle",{cx:"105",cy:"38",r:"2",fill:"#3B82F6",opacity:"0.7"}),a.jsx("circle",{cx:"98",cy:"44",r:"1.5",fill:"#3B82F6",opacity:"0.7"})]}),a.jsx("path",{d:"M 55 60 Q 100 45 145 60",fill:"none",stroke:"#E8A87C",strokeWidth:"3",strokeLinecap:"round"}),a.jsx("text",{x:"100",y:"42",textAnchor:"middle",fontSize:"7",fill:"#9CA3AF",children:"Hard Palate"}),a.jsx("path",{d:"M 145 60 Q 155 65 158 80",fill:"none",stroke:"#D4A574",strokeWidth:"2.5",strokeLinecap:"round"}),a.jsx("text",{x:"162",y:"65",fontSize:"6",fill:"#9CA3AF",children:"Velum"}),a.jsx("ellipse",{cx:"100",cy:80+s,rx:50-n*10,ry:r,fill:"#FFB4B4",stroke:"#E8A87C",strokeWidth:"1.5",opacity:"0.4"}),a.jsx("path",{d:`M ${55+n*8} ${65-r*.2} Q 100 ${60-r*.3} ${145-n*8} ${65-r*.2}`,fill:"#E8A87C",stroke:"#D4A574",strokeWidth:"2",strokeLinecap:"round"}),a.jsx("path",{d:`M ${55+n*8} ${70+s+r*.5} Q 100 ${75+s+r*.6} ${145-n*8} ${70+s+r*.5}`,fill:"#E8A87C",stroke:"#D4A574",strokeWidth:"2",strokeLinecap:"round"}),a.jsx("path",{d:"M 60 63 L 65 68 L 72 63 L 79 68 L 86 63 L 93 68 L 100 63 L 107 68 L 114 63 L 121 68 L 128 63 L 135 68 L 140 63",fill:"none",stroke:"white",strokeWidth:"2",opacity:"0.8"}),a.jsx("path",{d:e.tongueCurve,fill:"#E87C7C",stroke:"#D45B5B",strokeWidth:"2",strokeLinecap:"round",className:t?"transition-all duration-700":""}),a.jsx("circle",{cx:e.tongueX+20,cy:e.tongueY+10,r:"4",fill:"#D45B5B",stroke:"#B83C3C",strokeWidth:"1",className:t?"animate-pulse":""}),e.airflow==="oral"&&a.jsxs("g",{className:t?"animate-pulse":"",opacity:"0.6",children:[a.jsx("path",{d:"M 45 75 L 30 75",stroke:"#3B82F6",strokeWidth:"1.5",markerEnd:"url(#arrowhead)"}),a.jsx("path",{d:"M 45 80 L 28 82",stroke:"#3B82F6",strokeWidth:"1.5",markerEnd:"url(#arrowhead)"})]}),e.voicing&&a.jsxs("g",{children:[a.jsx("ellipse",{cx:"100",cy:"155",rx:"15",ry:"8",fill:"none",stroke:"#8B5CF6",strokeWidth:"1.5",className:t?"animate-pulse":""}),a.jsx("text",{x:"100",y:"158",textAnchor:"middle",fontSize:"6",fill:"#8B5CF6",children:"Vocal Cords"}),t&&a.jsxs(a.Fragment
1068,{children:[a.jsx("line",{x1:"90",y1:"155",x2:"85",y2:"155",stroke:"#8B5CF6",strokeWidth:"1",className:"animate-ping"}),a.jsx("line",{x1:"110",y1:"155",x2:"115",y2:"155",stroke:"#8B5CF6",strokeWidth:"1",className:"animate-ping"})]})]}),a.jsx("defs",{children:a.jsx("marker",{id:"arrowhead",markerWidth:"6",markerHeight:"4",refX:"0",refY:"2",orient:"auto",children:a.jsx("polygon",{points:"0 0, 6 2, 0 4",fill:"#3B82F6"})})}),a.jsx("text",{x:"100",y:"175",textAnchor:"middle",fontSize:"7",fill:"#6B7280",fontStyle:"italic",children:e.label})]})},pLe=()=>{const[e,t]=y.useState(0),[r,n]=y.useState(!1),[s,i]=y.useState("all"),o=["all",...new Set(vj.map(d=>d.category))],l=s==="all"?vj:vj.filter(d=>d.category===s),c=l[e]||l[0],u=()=>{n(!0),setTimeout(()=>n(!1),2e3)},h={easy:"bg-green-100 text-green-700 border-green-300",medium:"bg-yellow-100 text-yellow-700 border-yellow-300",hard:"bg-red-100 text-red-700 border-red-300"};return a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"text-center",children:[a.jsx("h2",{className:"text-2xl font-bold text-gray-800",children:"Visual Phonetics Guide"}),a.jsx("p",{className:"text-gray-500 mt-1",children:"See exactly how each Malayalam sound is produced"})]}),a.jsx("div",{className:"flex flex-wrap gap-2 justify-center",children:o.map(d=>a.jsx(Y,{size:"sm",variant:s===d?"default":"outline",onClick:()=>{i(d),t(0)},className:"capitalize",children:d},d))}),a.jsx("div",{className:"flex flex-wrap gap-2 justify-center",children:l.map((d,f)=>a.jsxs("button",{onClick:()=>t(f),className:`px-4 py-3 rounded-xl text-lg font-bold transition-all ${f===e?"bg-purple-600 text-white shadow-lg scale-110":"bg-white border-2 border-gray-200 hover:border-purple-300 hover:bg-purple-50"}`,children:[a.jsx("span",{className:"text-xl",children:d.character}),a.jsx("span",{className:"block text-xs opacity-75",children:d.romanization})]},d.character+f))}),c&&a.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[a.jsxs(se,{className:"border-2 border-purple-100",children:[a.jsx(_e,{className:"pb-2",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx(Se,{className:"text-lg",children:"Mouth Position"}),a.jsxs(Y,{size:"sm",onClick:u,className:"gap-1.5",children:[a.jsx(Bt,{className:"h-3.5 w-3.5"}),"Animate"]})]})}),a.jsxs(ue,{children:[a.jsx(mLe,{position:c.mouthPosition,isAnimating:r}),a.jsxs("div",{className:"mt-4 grid grid-cols-2 gap-2 text-xs",children:[a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx("div",{className:"w-3 h-3 rounded-full bg-red-400"}),a.jsx("span",{children:"Tongue position"})]}),a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx("div",{className:"w-3 h-3 rounded-full bg-blue-400"}),a.jsx("span",{children:"Airflow direction"})]}),a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx("div",{className:"w-3 h-3 rounded-full bg-purple-400"}),a.jsx("span",{children:"Vocal cord vibration"})]}),a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx("div",{className:"w-3 h-3 rounded-full bg-orange-300"}),a.jsx("span",{children:"Palate / Lips"})]})]})]})]}),a.jsxs(se,{className:"border-2 border-indigo-100",children:[a.jsx(_e,{className:"pb-3",children:a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"text-5xl font-bold text-purple-700",children:c.character}),a.jsxs("div",{children:[a.jsx(Se,{className:"text-lg",children:c.name}),a.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[a.jsx(ke,{variant:"outline",className:"font-mono",children:c.ipa}),a.jsx(ke,{className:h[c.difficulty],children:c.difficulty}),a.jsx(ke,{variant:"secondary",children:c.category})]})]})]})}),a.jsxs(ue,{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("h4",{className:"font-semibold text-sm text-gray-700 mb-1",children:"Description"}),a.jsx("p",{className:"text-sm text-gray-600",children:c.description})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-semibold text-sm text-gray-700 mb-1",children:"English Comparison"}),a.jsx("p",{className:"text-sm text-blue-600 bg-blue-50 p-2 rounded-lg",children:c.similarEnglish})]}),c.uniqueFeature&&a.jsx("div",{className:"bg-amber-50 border border-amber-200 p-3 rounded-lg",children:a.jsx("p",{className:"text-sm text-amber-800 font-medium",children:c.uniqueFeature})}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-semibold text-sm text-gray-700 mb-2",children:"Pronunciation Tips"}),a.jsx("ul",{className:"space-y-1.5",children:c.tips.map((d,f)=>a.jsxs("li",{className:"flex items-start gap-2 text-sm text-gray-600",children:[a.jsx("span",{className:"flex-shrink-0 w-5 h-5 rounded-full bg-purple-100 text-purple-700 flex items-center justify-center text-xs font-bold mt-0.5",children:f+1}),d]},f))})]}),a.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[a.jsxs("div",{className:"text-center p-2 bg-gray-50 rounded-lg",children:[a.jsx("div",{className:"text-xs text-gray-500",children:"Airflow"}),a.jsx("div",{className:"text-sm font-semibold capitalize",children:c.mouthPosition.airflow}
1068)]}),a.jsxs("div",{className:"text-center p-2 bg-gray-50 rounded-lg",children:[a.jsx("div",{className:"text-xs text-gray-500",children:"Voicing"}),a.jsx("div",{className:"text-sm font-semibold",children:c.mouthPosition.voicing?"Voiced":"Voiceless"})]}),a.jsxs("div",{className:"text-center p-2 bg-gray-50 rounded-lg",children:[a.jsx("div",{className:"text-xs text-gray-500",children:"Lip Shape"}),a.jsx("div",{className:"text-sm font-semibold",children:c.mouthPosition.lipRound>.3?"Rounded":"Spread"})]})]})]})]})]}),a.jsxs("div",{className:"flex justify-center gap-3",children:[a.jsxs(Y,{variant:"outline",onClick:()=>t(Math.max(0,e-1)),disabled:e===0,children:[a.jsx(N0,{className:"h-4 w-4 mr-1"})," Previous"]}),a.jsxs("span",{className:"flex items-center text-sm text-gray-500",children:[e+1," / ",l.length]}),a.jsxs(Y,{variant:"outline",onClick:()=>t(Math.min(l.length-1,e+1)),disabled:e>=l.length-1,children:["Next ",a.jsx(ns,{className:"h-4 w-4 ml-1"})]})]})]})},jR=[{character:"അ",romanization:"a",ipa:"/a/",type:"vowel"},{character:"ആ",romanization:"aa",ipa:"/aː/",type:"vowel"},{character:"ഇ",romanization:"i",ipa:"/i/",type:"vowel"},{character:"ഈ",romanization:"ee",ipa:"/iː/",type:"vowel"},{character:"ഉ",romanization:"u",ipa:"/u/",type:"vowel"},{character:"ക",romanization:"ka",ipa:"/k/",type:"consonant"},{character:"ഗ",romanization:"ga",ipa:"/ɡ/",type:"consonant"},{character:"ച",romanization:"cha",ipa:"/t͡ʃ/",type:"consonant"},{character:"ട",romanization:"tta",ipa:"/ʈ/",type:"consonant"},{character:"ത",romanization:"tha",ipa:"/t̪/",type:"consonant"},{character:"ന",romanization:"na",ipa:"/n̪/",type:"consonant"},{character:"പ",romanization:"pa",ipa:"/p/",type:"consonant"},{character:"മ",romanization:"ma",ipa:"/m/",type:"consonant"},{character:"ഴ",romanization:"zha",ipa:"/ɻ/",type:"consonant"},{character:"റ",romanization:"ra",ipa:"/r/",type:"consonant"},{character:"ള",romanization:"la",ipa:"/ɭ/",type:"consonant"}],gLe=()=>{const[e,t]=y.useState(0),[r,n]=y.useState(!1),[s,i]=y.useState(!1),[o,l]=y.useState(null),[c,u]=y.useState(0),[h,d]=y.useState(0),[f,m]=y.useState({}),[g,p]=y.useState("all"),[v,x]=y.useState(null),b=y.useRef(null),w=y.useRef([]),j=y.useRef(null),_=y.useRef(0),S=y.useRef(null),k=y.useRef(null),P=g==="all"?jR:jR.filter(R=>R.type===g),C=P[e]||P[0],M=Object.values(f).reduce((R,Q)=>R+Q.count,0),I=M>0?Math.round(Object.values(f).reduce((R,Q)=>R+Q.score,0)/Object.keys(f).length):0,E=y.useCallback(async()=>{try{(await navigator.mediaDevices.getUserMedia({audio:!0})).getTracks().forEach(Q=>Q.stop()),x(!0)}catch{x(!1)}},[]);y.useEffect(()=>(E(),()=>{_.current&&cancelAnimationFrame(_.current),S.current&&clearInterval(S.current),k.current&&k.current.getTracks().forEach(R=>R.stop())}),[E]);const B=async()=>{try{const R=await navigator.mediaDevices.getUserMedia({audio:{echoCancellation:!0,noiseSuppression:!0,sampleRate:44100}});k.current=R;const Q=new AudioContext,K=Q.createMediaStreamSource(R),z=Q.createAnalyser();z.fftSize=256,K.connect(z),j.current=z;const N=new MediaRecorder(R,{mimeType:"audio/webm"});b.current=N,w.current=[],N.ondataavailable=V=>{V.data.size>0&&w.current.push(V.data)},N.start(100),n(!0),l(null),d(0);const T=new Uint8Array(z.frequencyBinCount),$=()=>{z.getByteFrequencyData(T);const V=T.reduce((q,te)=>q+te,0)/T.length;u(Math.min(100,V/128*100)),_.current=requestAnimationFrame($)};$(),S.current=setInterval(()=>{d(V=>V+100)},100),setTimeout(()=>{var V;((V=b.current)==null?void 0:V.state)==="recording"&&A()},5e3)}catch(R){console.error("Mic error:",R),x(!1)}},A=async()=>{if(_.current&&cancelAnimationFrame(_.current),S.current&&clearInterval(S.current),n(!1),u(0),b.current&&b.current.state==="recording"&&(b.current.stop(),await new Promise(R=>{b.current?b.current.onstop=()=>R():R()})),k.current&&k.current.getTracks().forEach(R=>R.stop()),w.current.length>0){const R=new Blob(w.current,{type:"audio/webm"});await L(R)}},L=async R=>{i(!0);try{const Q=new FileReader,K=await new Promise($=>{Q.onloadend=()=>$(Q.result),Q.readAsDataURL(R)}),{data:z,error:N}=await ne.functions.invoke("pronunciation-feedback",{body:{audioBase64:K,targetCharacter:C.character,targetRomanization:C.romanization,targetIPA:C.ipa}});if(N)throw N;const T=z;l(T),m($=>{var V,q;return{...$,[C.character]:{score:Math.max(((V=$[C.character])==null?void 0:V.score)||0,T.score),count:(((q=$[C.character])==null?void 0:q.count)||0)+1}}})}catch(Q){console.error("Analysis error:",Q),l({score:70,rating:"good",feedback:"Good attempt! Keep practicing this sound. Try to match the reference audio closely.",tips:["Speak clearly and close to the microphone","Listen to the reference audio first","Practice in a quiet environment"],mouthPosition:"Focus on correct tongue and lip placement",commonMistakes:["Backgroun
1068d noise may affect analysis"]})}finally{i(!1)}},W=R=>R>=85?"text-green-600":R>=70?"text-yellow-600":R>=50?"text-orange-600":"text-red-600",D=R=>R>=85?"from-green-500 to-emerald-500":R>=70?"from-yellow-500 to-amber-500":R>=50?"from-orange-500 to-red-400":"from-red-500 to-red-600",U=R=>({excellent:"Excellent!",good:"Good Job!",fair:"Keep Trying!",needs_practice:"Needs Practice"})[R]||R;return a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"text-center",children:[a.jsx("h2",{className:"text-2xl font-bold text-gray-800",children:"Listen & Repeat"}),a.jsx("p",{className:"text-gray-500 mt-1",children:"Practice pronunciation with AI-powered feedback"})]}),a.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[a.jsxs(se,{className:"text-center p-3",children:[a.jsx("div",{className:"text-2xl font-bold text-purple-600",children:M}),a.jsx("div",{className:"text-xs text-gray-500",children:"Total Attempts"})]}),a.jsxs(se,{className:"text-center p-3",children:[a.jsx("div",{className:"text-2xl font-bold text-blue-600",children:Object.keys(f).length}),a.jsx("div",{className:"text-xs text-gray-500",children:"Characters Tried"})]}),a.jsxs(se,{className:"text-center p-3",children:[a.jsxs("div",{className:`text-2xl font-bold ${W(I)}`,children:[I||"--","%"]}),a.jsx("div",{className:"text-xs text-gray-500",children:"Average Score"})]})]}),a.jsx("div",{className:"flex gap-2 justify-center",children:["all","vowel","consonant"].map(R=>a.jsx(Y,{size:"sm",variant:g===R?"default":"outline",onClick:()=>{p(R),t(0),l(null)},className:"capitalize",children:R==="all"?"All Sounds":`${R}s`},R))}),a.jsx("div",{className:"flex flex-wrap gap-2 justify-center",children:P.map((R,Q)=>{const K=f[R.character];return a.jsxs("button",{onClick:()=>{t(Q),l(null)},className:`relative px-3 py-2 rounded-lg text-lg font-bold transition-all ${Q===e?"bg-purple-600 text-white shadow-lg scale-110":"bg-white border-2 border-gray-200 hover:border-purple-300"}`,children:[R.character,K&&a.jsx("span",{className:`absolute -top-1 -right-1 w-4 h-4 rounded-full text-[8px] font-bold flex items-center justify-center text-white ${K.score>=85?"bg-green-500":K.score>=70?"bg-yellow-500":"bg-orange-500"}`,children:Math.round(K.score/10)})]},R.character+Q)})}),a.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[a.jsxs(se,{className:"border-2 border-purple-100",children:[a.jsx(_e,{className:"pb-3",children:a.jsxs(Se,{className:"text-lg flex items-center gap-2",children:[a.jsx(Xe,{className:"h-5 w-5 text-purple-600"}),"Practice: ",C.character,a.jsx(ke,{variant:"outline",className:"font-mono ml-auto",children:C.ipa})]})}),a.jsxs(ue,{className:"space-y-6",children:[a.jsxs("div",{className:"text-center py-6 bg-gradient-to-br from-purple-50 to-indigo-50 rounded-2xl",children:[a.jsx("div",{className:"text-8xl font-bold text-purple-700 mb-2",children:C.character}),a.jsx("div",{className:"text-lg text-gray-600 font-mono",children:C.romanization}),a.jsx("div",{className:"text-sm text-gray-400",children:C.ipa})]}),r&&a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex justify-between text-xs text-gray-500",children:[a.jsx("span",{children:"Audio Level"}),a.jsxs("span",{children:[(h/1e3).toFixed(1),"s / 5.0s"]})]}),a.jsx("div",{className:"h-4 bg-gray-100 rounded-full overflow-hidden",children:a.jsx("div",{className:"h-full bg-gradient-to-r from-green-400 via-yellow-400 to-red-400 transition-all duration-100 rounded-full",style:{width:`${c}%`}})}),a.jsx(_t,{value:h/5e3*100,className:"h-1"})]}),v===!1&&a.jsxs("div",{className:"flex items-center gap-2 p-3 bg-red-50 border border-red-200 rounded-lg text-sm text-red-700",children:[a.jsx(cn,{className:"h-4 w-4 flex-shrink-0"}),a.jsx("span",{children:"Microphone access denied. Please enable it in your browser settings."})]}),a.jsx("div",{className:"flex justify-center gap-3",children:r?a.jsxs(Y,{size:"lg",onClick:A,className:"gap-2 bg-gray-800 hover:bg-gray-900 text-white px-8 py-6 text-lg rounded-2xl shadow-lg animate-pulse",children:[a.jsx(ND,{className:"h-6 w-6"}),"Stop Recording"]}):a.jsxs(Y,{size:"lg",onClick:B,disabled:s||v===!1,className:"gap-2 bg-red-500 hover:bg-red-600 text-white px-8 py-6 text-lg rounded-2xl shadow-lg",children:[a.jsx(cc,{className:"h-6 w-6"}),s?"Analyzing...":"Hold to Record"]})}),s&&a.jsx("div",{className:"text-center py-4",children:a.jsxs("div",{className:"inline-flex items-center gap-2 text-purple-600",children:[a.jsx("div",{className:"w-5 h-5 border-2 border-purple-600 border-t-transparent roun
1068ded-full animate-spin"}),"Analyzing your pronunciation..."]})}),a.jsx("p",{className:"text-center text-xs text-gray-400",children:"Click to start recording, then speak the character. Recording auto-stops after 5 seconds."})]})]}),a.jsxs(se,{className:`border-2 ${o?"border-indigo-100":"border-gray-100"}`,children:[a.jsx(_e,{className:"pb-3",children:a.jsxs(Se,{className:"text-lg flex items-center gap-2",children:[a.jsx(Ec,{className:"h-5 w-5 text-indigo-600"}),"AI Feedback"]})}),a.jsx(ue,{children:o?a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"text-center py-4",children:[a.jsx("div",{className:`inline-flex items-center justify-center w-28 h-28 rounded-full bg-gradient-to-br ${D(o.score)} text-white shadow-lg`,children:a.jsxs("div",{children:[a.jsx("div",{className:"text-3xl font-bold",children:o.score}),a.jsx("div",{className:"text-xs opacity-80",children:"/ 100"})]})}),a.jsx("div",{className:`mt-2 text-lg font-bold ${W(o.score)}`,children:U(o.rating)})]}),a.jsx("div",{className:"bg-gray-50 p-3 rounded-lg",children:a.jsx("p",{className:"text-sm text-gray-700",children:o.feedback})}),a.jsxs("div",{className:"bg-purple-50 p-3 rounded-lg",children:[a.jsx("h4",{className:"text-xs font-semibold text-purple-700 mb-1",children:"Mouth Position"}),a.jsx("p",{className:"text-sm text-purple-600",children:o.mouthPosition})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"text-sm font-semibold text-gray-700 mb-2",children:"Improvement Tips"}),a.jsx("ul",{className:"space-y-1.5",children:o.tips.map((R,Q)=>a.jsxs("li",{className:"flex items-start gap-2 text-sm text-gray-600",children:[a.jsx("span",{className:"flex-shrink-0 w-5 h-5 rounded-full bg-indigo-100 text-indigo-700 flex items-center justify-center text-xs font-bold mt-0.5",children:Q+1}),R]},Q))})]}),o.commonMistakes.length>0&&a.jsxs("div",{children:[a.jsx("h4",{className:"text-sm font-semibold text-gray-700 mb-2",children:"Watch Out For"}),a.jsx("div",{className:"space-y-1",children:o.commonMistakes.map((R,Q)=>a.jsxs("div",{className:"flex items-center gap-2 text-sm text-orange-600 bg-orange-50 p-2 rounded",children:[a.jsx(cn,{className:"h-3.5 w-3.5 flex-shrink-0"}),R]},Q))})]}),a.jsxs("div",{className:"flex gap-2",children:[a.jsxs(Y,{variant:"outline",className:"flex-1 gap-1",onClick:()=>{l(null)},children:[a.jsx(Gn,{className:"h-4 w-4"})," Try Again"]}),a.jsxs(Y,{className:"flex-1 gap-1",onClick:()=>{t(Math.min(P.length-1,e+1)),l(null)},children:["Next ",a.jsx(ns,{className:"h-4 w-4"})]})]})]}):a.jsxs("div",{className:"text-center py-12 text-gray-400",children:[a.jsx(cc,{className:"h-12 w-12 mx-auto mb-3 opacity-30"}),a.jsx("p",{className:"text-sm",children:"Record your pronunciation to get AI feedback"}),a.jsx("p",{className:"text-xs mt-1",children:"Click the red button and speak the character"})]})})]})]})]})},gy=[{character:"അ",romanization:"a",name:"A (short)",strokeHints:["Start from top curve","Draw the loop clockwise","Finish with the tail down-right"],difficulty:2},{character:"ആ",romanization:"aa",name:"Aa (long)",strokeHints:["Draw അ first","Add the vertical extension on right","Connect smoothly"],difficulty:3},{character:"ഇ",romanization:"i",name:"I (short)",strokeHints:["Start with the top loop","Draw downward curve","Add the small hook"],difficulty:2},{character:"ക",romanization:"ka",name:"Ka",strokeHints:["Start from the top","Draw the main curve left","Add the bottom hook right"],difficulty:2},{character:"ഗ",romanization:"ga",name:"Ga",strokeHints:["Start from top left","Draw the main body","Finish with the tail"],difficulty:3},{character:"ച",romanization:"cha",name:"Cha",strokeHints:["Start with upper loop","Draw down and curve right","Complete the bottom"],difficulty:2},{character:"ട",romanization:"tta",name:"Tta",strokeHints:["Start from top","Draw the angular shape","Add the bottom curve"],difficulty:3},{character:"ത",romanization:"tha",name:"Tha",strokeHints:["Start with the loop","Draw the vertical line","Add the bottom hook"],difficulty:2},{character:"ന",romanization:"na",name:"Na",strokeHints:["Start from top left","Draw the curve","Complete with bottom stroke"],difficulty:2},{character:"പ",romanization:"pa",name:"Pa",strokeHints:["Start from the top","Draw the round body","Add the tail"],difficulty:1},{character:"മ",romanization:"ma",name:"Ma",strokeHints:["Start with upper curve","Draw the body","Finish with the hook"],difficulty:2},{character:"ഴ",romanization:"zha",name:"Zha",strokeHints:["Start from top","Draw the complex curve","This is a unique character - take your time"],difficulty:5},{character:"ല",romanization:"la",name:"La",strokeHints:["Start from top","Draw the main loop","Add the tail stroke"],difficulty:2},{character:"വ",romanization:"va",name:"Va",strokeHints:["Start from top left","Draw the curve down","Complete the shape"],difficulty:2},{character:"ശ",romanization:"sha",name:"Sha",strokeHints:["Start from top","Draw the body curves","Finish with bottom stroke"],difficulty:3},{character:"ഹ",romanization:"ha",name:"Ha",strokeHints:["Start from top","Draw the main shape","Add connecting strokes"],difficulty:3}],yLe=["#1e1e1e","#7C3AED","#2563EB","#DC2626","#059669","#D97706"],vLe=()=>{const[e,t]=y.useState(0),[r,n]=y.useState(!1),[s,i]=y.useState(!0),[o,l]=y.useState([.25]),[c,u]=y.useState([4]),[h,d]=y.useState("#1e1e1e"),[f,m]=y.useState(0),[g,p]=y.useState([]),v=y.useRef(null),x=y.useRef(null),b=y.useRef(null),w=gy[e],j=360,_=y.useCallback(()=>{const A=x.current;if(!A)return;const L=A.getContext("2d");L&&(L.clearRect(0,0,j,j),s&&(L.strokeStyle="#E5E7EB",L.lineWidth=.5,L.setLineDash([5,5]),L.beginPath(),L.moveTo(j/2,0),L.lineTo(j/2,j),L.moveTo(0,j/2),L.lineTo(j,j/2),L.stroke(),L.beginPath(),L.moveTo(0,0),L.lineTo(j,j),L.moveTo(j,0),L.lineTo(0,j),L.stroke(),L.setLineDash([]),L.globalAlpha=o[0],L.font=`bold ${j*.7}px serif`,L.textAlign="center",L.textBaseline="middle",L.fillStyle="#9CA3AF",L.fillText(w.character,j/2,j/2),L.globalAlpha=1,L.strokeStyle="#D1D5DB",L.lineWidth=2,L.strokeRect(1,1,j-2,j-2)))},[w.character,s,o,j]);y.useEffect(()=>{_()},[_]);const S=A=>{const L=v.current;if(!L)return{x:0,y:0};const W=L.getBoundingClientRect(),D=L.width/W.width,U=L.height/W.height;if("touches"in A){const R=A.touches[0];return{x:(R.clientX-W.left)*D,y:(R.clientY-W.top)*U}}return{x:(A.clientX-W.left)*D,y:(A.clientY-W.top)*U}},k=A=>{var D;A.preventDefault(),n(!0);const L=S(A);b.current=L;const W=(D=v.current)==null?void 0:D.getContext("2d");W&&(W.beginPath(),W.arc(L.x,L.y,c[0]/2,0,Math.PI*2),W.fillStyle=h,W.fill())},P=A=>{var D;if(A.preventDefault(),!r)return;const L=(D=v.current)==null?void 0:D.getContext("2d");if(!L||!b.current)return;const W=S(A);L.beginPath(),L.moveTo(b.current.x,b.current.y),L.lineTo(W.x,W.y),L.strokeStyle=h,L.lineWidth=c[0],L.lineCap="round",L.lineJoin="round",L.stroke(),b.current=W},C=()=>{var A;if(r){n(!1),b.current=null;const L=(A=v.current)==null?void 0:A.getContext("2d");if(L){const W=L.getImageData(0,0,j,j);p(D=>[...D,W])}}},M=()=>{var L;const A=(L=v.current)==null?void 0:L.getContext("2d");A&&(A.clearRect(0,0,j,j),p([]),m(0))},I=()=>{var W;if(g.length===0)return;const A=(W=v.current)==null?void 0:W.getContext("2d");if(!A)return;const L=g.slice(0,-1);p(L),A.clearRect(0,0,j,j),L.length>0&&A.putImageData(L[L.length-1],0,0)},E=()=>{const A=v.current;if(!A)return;const L=document.createElement("canvas");L.width=j,L.height=j;const W=L.getContext("2d");if(!W)return;
1068W.fillStyle="white",W.fillRect(0,0,j,j),x.current&&W.drawImage(x.current,0,0),W.drawImage(A,0,0);const D=document.createElement("a");D.download=`malayalam-${w.character}-practice.png`,D.href=L.toDataURL(),D.click()},B=A=>{t(A),m(0),M()};return a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"text-center",children:[a.jsx("h2",{className:"text-2xl font-bold text-gray-800",children:"Writing Practice"}),a.jsx("p",{className:"text-gray-500 mt-1",children:"Trace and practice writing Malayalam characters"})]}),a.jsx("div",{className:"flex flex-wrap gap-2 justify-center",children:gy.map((A,L)=>a.jsx("button",{onClick:()=>B(L),className:`px-3 py-2 rounded-lg text-lg font-bold transition-all ${L===e?"bg-purple-600 text-white shadow-lg scale-110":"bg-white border-2 border-gray-200 hover:border-purple-300"}`,children:A.character},A.character+L))}),a.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6",children:[a.jsx("div",{className:"lg:col-span-2",children:a.jsxs(se,{className:"border-2 border-purple-100",children:[a.jsx(_e,{className:"pb-2",children:a.jsxs("div",{className:"flex items-center justify-between flex-wrap gap-2",children:[a.jsxs(Se,{className:"text-lg flex items-center gap-2",children:[a.jsx(Vs,{className:"h-5 w-5 text-purple-600"}),w.character," - ",w.name,a.jsxs(ke,{variant:"outline",children:["★".repeat(w.difficulty),"☆".repeat(5-w.difficulty)]})]}),a.jsxs("div",{className:"flex gap-1.5",children:[a.jsxs(Y,{size:"sm",variant:"outline",onClick:()=>i(!s),className:"gap-1",children:[s?a.jsx(Ws,{className:"h-3.5 w-3.5"}):a.jsx(fa,{className:"h-3.5 w-3.5"}),"Guide"]}),a.jsxs(Y,{size:"sm",variant:"outline",onClick:I,disabled:g.length===0,className:"gap-1",children:[a.jsx(Gn,{className:"h-3.5 w-3.5"})," Undo"]}),a.jsxs(Y,{size:"sm",variant:"outline",onClick:M,className:"gap-1",children:[a.jsx(ah,{className:"h-3.5 w-3.5"})," Clear"]}),a.jsx(Y,{size:"sm",variant:"outline",onClick:E,className:"gap-1",children:a.jsx(as,{className:"h-3.5 w-3.5"})})]})]})}),a.jsxs(ue,{children:[a.jsxs("div",{className:"relative mx-auto bg-white rounded-xl overflow-hidden shadow-inner border",style:{width:j,height:j,maxWidth:"100%",touchAction:"none"},children:[a.jsx("canvas",{ref:x,width:j,height:j,className:"absolute inset-0 pointer-events-none",style:{width:"100%",height:"100%"}}),a.jsx("canvas",{ref:v,width:j,height:j,className:"absolute inset-0 cursor-crosshair",style:{width:"100%",height:"100%"},onMouseDown:k,onMouseMove:P,onMouseUp:C,onMouseLeave:C,onTouchStart:k,onTouchMove:P,onTouchEnd:C})]}),a.jsxs("div",{className:"mt-4 grid grid-cols-1 sm:grid-cols-2 gap-4",children:[a.jsxs("div",{children:[a.jsxs("label",{className:"text-xs font-medium text-gray-500 mb-1 block",children:["Brush Size: ",c[0],"px"]}),a.jsx(Za,{value:c,onValueChange:u,min:1,max:12,step:1})]}),a.jsxs("div",{children:[a.jsxs("label",{className:"text-xs font-medium text-gray-500 mb-1 block",children:["Guide Opacity: ",Math.round(o[0]*100),"%"]}),a.jsx(Za,{value:o,onValueChange:l,min:.05,max:.5,step:.05})]})]}),a.jsxs("div",{className:"mt-3 flex items-center gap-2",children:[a.jsx(_v,{className:"h-4 w-4 text-gray-400"}),a.jsx("div",{className:"flex gap-1.5",children:yLe.map(A=>a.jsx("button",{onClick:()=>d(A),className:`w-7 h-7 rounded-full border-2 transition-all ${h===A?"border-gray-800 scale-110 shadow":"border-gray-300"}`,style:{backgroundColor:A}},A))})]})]})]})}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs(se,{className:"border-2 border-indigo-100",children:[a.jsx(_e,{className:"pb-2",children:a.jsx(Se,{className:"text-lg",children:"Stroke Guide"})}),a.jsxs(ue,{className:"space-y-3",children:[a.jsxs("div",{className:"text-center py-4 bg-gradient-to-br from-indigo-50 to-purple-50 rounded-xl",children:[a.jsx("div",{className:"text-7xl font-bold text-purple-700",children:w.character}),a.jsx("div",{className:"text-sm text-gray-500 mt-1",children:w.romanization})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("h4",{className:"text-sm font-semibold text-gray-700",children:"Stroke Order"}),w.strokeHints.map((A,L)=>a.jsxs("div",{className:`flex items-start gap-2 p-2 rounded-lg transition-all cursor-pointer ${L===f?"bg-purple-100 border border-purple-200":L<f?"bg-green-50 border border-green-200":"bg-gray-50 border border-gray-100"}`,onClick:()=>m(L),children:[a.jsx("span",{className:`flex-shrink-0 w-6 h-6 rounded-full flex items-center justify-center text-xs font-bold ${L===f?"bg-purple-600 text-white":L<f?"bg-green-500 text-white":"bg-gray-200 text-gray-500"}`,children:L<f?a.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:3,d:"M5 13l4 4L19 7"})}):L+1}),a.jsx("span",{className:"text-sm text-gray-600",children:A})]},L))]}),a.jsxs(Y,{className:"w-full",variant:"outline",onClick:()=>m(Math.min(w.strokeHints.length-1,f+1)),disabled:f>=w.strokeHints.length-1,children:["Next Step ",a.jsx(ns,{className:"h-4 w-4 ml-1"})]})]})]}),a.jsx(se,{children:a.jsxs(ue,{className:"pt-4",children:[a.jsx("h4",{className:"text-sm font-semibold text-gray-700 mb-2",children:"Writing Tips"}),a.jsxs("ul",{className:"space-y-1.5 text-xs text-gray-500",children:[a.jsxs("li",{className:"flex items-start gap-1.5",children:[a.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-purple-400 mt-1.5 flex-shrink-0"}),"Malayalam is written left to right"]}),a.jsxs("li",{className:"flex items-start gap-1.5",children:[a.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-purple-400 mt-1.5 flex-shrink-0"}),"Most characters have a rounded, flowing shape"]}),a.jsxs("li",{className:"flex items-start gap-1.5",children:[a.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-purple-400 mt-1.5 flex-shrink-0"}),"Practice the basic strokes before complex characters"]}),a.jsxs("li",{className:"flex items-start gap-1.5",children:[a.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-purple-400 mt-1.5 flex-shrink-0"}),"Use the guide overlay to trace the shape"]}),a.jsxs("li",{className:"flex items-start gap-1.5",children:[a.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-purple-400 mt-1.5 flex-shrink-0"}),"Gradually reduce guide opacity as you improve"]})]})]})}),a.jsxs("div",{className:"flex gap-2",children:[a.jsxs(Y,{variant:"outline",className:"flex-1",onClick:()=>B(Math.max(0,e-1)),disabled:e===0,children:[a.jsx(N0,{className:"h-4 w-4 mr-1"})," Prev"]}),a.jsxs(Y,{variant:"outline",className:"flex-1",onClick:()=>B(Math.min(gy.length-1,e+1)),disabled:e>=gy.length-1,children:["Next ",a.jsx(ns,{className:"h-4 w-4 ml-1"})]})]})]})]})]})},Yy=[{character:"അ",romanization:"a",ipa:"/a/",type:"vowel",words:[{malayalam:"അമ്മ",romanization:"amma",english:"Mother",imageUrl:"https://d64gsuwffb70l.cloudfront.net/68e98d36a8cedcd8009fab27_1771867234012_b84bf1b9.png",category:"family"},{malayalam:"അച്ഛൻ",romanization:"achchan",english:"Father",imageUrl:"https://d64gsuwffb70l.cloudfront.net/68e98d36a8cedcd8009fab27_1771867145323_487429c0.jpg",category:"family"},{malayalam:"അരി",romanization:"ari",english:"Rice",imageUrl:"https://d64gsuwffb70l.cloudfront.net/68e98d36a8cedcd8009fab27_1771867133485_0928ebbd.jpg",category:"food"}]},{character:"ആ",romanization:"aa",ipa:"/aː/",type:"vowel",words:[{malayalam:"ആന",romanization:"aana",english:"Elephant",imageUrl:"https://d64gsuwffb70l.cloudfront.net/68e98d36a8cedcd8009fab27_1771867141964_10b09778.jpg",category:"animal"},{malayalam:"ആകാശം",romanization:"aakaasham",english:"Sky",imageUrl:"https://d64gsuwffb70l.cloudfront.net/68e98d36a8cedcd8009fab27_1771867136093_547782bf.jpg",category:"nature"},{malayalam:"ആപ്പിൾ",romanization:"aappil",english:"Apple",imageUrl:"https://d64gsuwffb70l.cloudfront.net/68e98d36a8cedcd8009fab27_1771867228926_3fbb434b.png",category:"food"}]},{character:"ക",romanization:"ka",ipa:"/k/",type:"consonant",words:[{malayalam:"കണ്ണ്",romanization:"kannu",english:"Eye",imageUrl:"https://d64gsuwffb70l.cloudfront.net/68e98d36a8cedcd8009fab27_1771867234012_b84bf1b9.png",category:"body"},{malayalam:"കാല്",romanization:"kaal",english:"Leg",imageUrl:"https://d64gsuwffb70l.cloudfront.net/68e98d36a8cedcd8009fab27_1771867145323_487429c0.jpg",category:"body"},{malayalam:"കടൽ",romanization:"kadal",english:"Sea",imageUrl:"https://d64gsuwffb70l.cloudfront.net/68e98d36a8cedcd8009fab27_1771867136093_547782bf.jpg",category:"nature"}]},{character:"മ",romanization:"ma",ipa:"/m/",type:"consonant",words:[{malayalam:"മഴ",romanization:"mazha",english:"Rain",imageUrl:"https://d64gsuwffb70l.cloudfront.net/68e98d36a8cedcd8009fab27_1771867136093_547782bf.jpg",category:"nature"},{malayalam:"മരം",romanization:"maram",english:"Tree",imageUrl:"https://d64gsuwffb70l.cloudfront.net/68e98d36a8cedcd8009fab27_1771867133485_0928ebbd.jpg",category:"nature"},{malayalam:"മീൻ",romanization:"meen",english:"Fish",imageUrl:"https://d64gsuwffb70l.cloudfront.net/68e98d36a8cedcd8009fab27_1771867141964_10b09778.jpg",category:"food"}]},{character:"ന",romanization:"na",ipa:"/n̪/",type:"consonant",words:[{malayalam:"നായ",romanization:"naaya",english:"Dog",imageUrl:"https://d64gsuwffb70l.cloudfront.net/68e98d36a8cedcd8009fab27_1771867141964_10b09778.jpg",category:"animal"},{malayalam:"നദി",romanization:"nadi",english:"River",imageUrl:"https://d64gsuwffb70l.cloudfront.net/68e98d36a8cedcd8009fab27_1771867136093_547782bf.jpg",category:"nature"},{malayalam:"നിലാവ്",romanization:"nilaav",english:"Moonlight",imageUrl:"https://d64gsuwffb70l.cloudfront.net/68e98d36a8cedcd8009fab27_1771867228926_3fbb434b.png",category:"nature"}]},{character:"പ",romanization:"pa",ipa:"/p/",type:"consonant",words:[{malayalam:"പൂവ്",romanization:"poov",english:"Flower",imageUrl:"https://d64gsuwffb70l.cloudfront.net/68e98d36a8cedcd8009fab27_1771867228926_3fbb434b.png",category:"nature"},{malayalam:"പക്ഷി",romanization:"pakshi",english:"Bird",imageUrl:"https://d64gsuwffb70l.cloudfront.net/68e98d36a8cedcd8009fab27_1771867141964_10b09778.jpg",category:"animal"},{malayalam:"പാൽ",romanization:"paal",english:"Milk",imageUrl:"https://d64gsuwffb70l.cloudfront.net/68e98d36a8cedcd8009fab27_1771867133485_0928ebbd.jpg",category:"food"}]},{character:"ത",romanization:"tha",ipa:"/t̪/",type:"consonant",words:[{malayalam:"തല",romanization:"thala",english:"Head",imageUrl:"https://d64gsuwffb70l.cloudfront.net/68e98d36a8cedcd8009fab27_1771867234012_b84bf1b9.png",category:"body"},{malayalam:"താമര",romanization:"thaamara",english:"Lotus",imageUrl:"https://d64gsuwffb70l.cloudfront.net/68e98d36a8cedcd8009fab27_1771867228926_3fbb434b.png",category:"nature"},{malayalam:"തേങ്ങ",romanization:"thenga",english:"Coconut",imageUrl:"https://d64gsuwffb70l.cloudfront.net/68e98d36a8cedcd8009fab27_1771867133485_0928ebbd.jpg",category:"food"}]},{character:"ഴ",romanization:"zha",ipa:"/ɻ/",type:"consonant",words:[{malayalam:"ഴല്ലി",romanization:"zhalli",english:"Drizzle",imageUrl:"https://d64gsuwffb70l.cloudfront.net/68e98d36a8cedcd8009fab27_1771867136093_547782bf.jpg",category:"nature"},{malayalam:"പുഴ",romanization:"puzha",english:"River",imageUrl:"https://d64gsuwffb70l.cloudfront.net/68e98d36a8cedcd8009fab27_1771867136093_547782bf.jpg",category:"nature"},{malayalam:"കുഴി",romanization:"kuzhi",english:"Pit/Hole",imageUrl:"https://d64gsuwffb70l.cloudfront.net/68e98d36a8cedcd8009fab27_1771867145323_487429c0.jpg",category:"place"}]},{character:"റ",romanization:"ra",ipa:"/r/",type:"consonant",words:[{malayalam:"റോഡ്",romanization:"road",english:"Road",imageUrl:"https://d64gsuwffb70l.cloudfront.net/68e98d36a8cedcd8009fab27_1771867145323_487429c0.jpg",category:"place"},{malayalam:"റബ്ബർ",romanization:"rabbar",english:"Rubber",imageUrl:"https://d64gsuwffb70l.cloudfront.net/68e98d36a8cedcd8009fab27_1771867133485_0928ebbd.jpg",category:"thing"},{malayalam:"പറവ",romanization:"parava",english:"Dove",imageUrl:"https://d64gsuwffb70l.cloudfront.net/68e98d36a8cedcd8009fab27_1771867141964_10b09778.jpg",category:"animal"}]},{character:"ല",romanization:"la",ipa:"/l/",type:"consonant",words:[{malayalam:"ലോകം",romanization:"lokam",english:"World",imageUrl:"https://d64gsuwffb70l.cloudfront.net/68e98d36a8cedcd8009fab27_1771867136093_547782bf.jpg",category:"nature"},{malayalam:"ലഡ്ഡു",romanization:"laddu",english:"Laddu (sweet)",imageUrl:"https://d64gsuwffb70l.cloudfront.net/68e98d36a8cedcd8009fab27_1771867133485_0928ebbd.jpg",category:"food"},{malayalam:"ലത",romanization:"latha",english:"Creeper",imageUrl:"https://d64gsuwffb70l.cloudfront.net/68e98d36a8cedcd8009fab27_1771867228926_3fbb434b.png",category:"nature"}]}],xLe=()=>{const e=new Set;
1068return Yy.forEach(t=>t.words.forEach(r=>e.add(r.category))),Array.from(e)},bLe=()=>{const[e,t]=y.useState(null),[r,n]=y.useState(""),[s,i]=y.useState("all"),[o,l]=y.useState(!0),[c,u]=y.useState(!1),[h,d]=y.useState(null),[f,m]=y.useState(null),[g,p]=y.useState({correct:0,total:0}),[v,x]=y.useState(new Set),b=y.useMemo(()=>xLe(),[]),w=y.useMemo(()=>{let C=Yy;if(r){const M=r.toLowerCase();C=C.filter(I=>I.character.includes(M)||I.romanization.includes(M)||I.words.some(E=>E.english.toLowerCase().includes(M)||E.malayalam.includes(M)||E.romanization.includes(M)))}return s!=="all"&&(C=C.filter(M=>M.words.some(I=>I.category===s))),C},[r,s]),j=()=>{const C=Yy.flatMap(I=>I.words.map(E=>({...E,parentChar:I.character}))),M=C[Math.floor(Math.random()*C.length)];m(M),d(null),u(!0)},_=C=>{d(C);const M=C===(f==null?void 0:f.english);p(I=>({correct:I.correct+(M?1:0),total:I.total+1}))},S=C=>{x(M=>{const I=new Set(M);return I.has(C)?I.delete(C):I.add(C),I})},k=C=>{const M=Yy.flatMap(E=>E.words.map(B=>B.english)),I=new Set([C.english]);for(;I.size<4&&I.size<M.length;)I.add(M[Math.floor(Math.random()*M.length)]);return Array.from(I).sort(()=>Math.random()-.5)},P={family:"bg-pink-100 text-pink-700",food:"bg-orange-100 text-orange-700",animal:"bg-green-100 text-green-700",nature:"bg-blue-100 text-blue-700",body:"bg-purple-100 text-purple-700",place:"bg-yellow-100 text-yellow-700",thing:"bg-gray-100 text-gray-700"};return a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"text-center",children:[a.jsx("h2",{className:"text-2xl font-bold text-gray-800",children:"Vocabulary Bridge"}),a.jsx("p",{className:"text-gray-500 mt-1",children:"Connect sounds to real Malayalam words"})]}),a.jsxs("div",{className:"flex flex-wrap gap-3 items-center justify-between",children:[a.jsx("div",{className:"flex items-center gap-2 flex-1 min-w-[200px]",children:a.jsxs("div",{className:"relative flex-1 max-w-xs",children:[a.jsx(Tp,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-gray-400"}),a.jsx(Je,{placeholder:"Search characters or words...",value:r,onChange:C=>n(C.target.value),className:"pl-9"})]})}),a.jsxs("div",{className:"flex gap-2 flex-wrap",children:[a.jsxs(Y,{size:"sm",variant:o?"default":"outline",onClick:()=>l(!o),className:"gap-1",children:[o?a.jsx(fa,{className:"h-3.5 w-3.5"}):a.jsx(Ws,{className:"h-3.5 w-3.5"}),"English"]}),a.jsxs(Y,{size:"sm",variant:"outline",onClick:j,className:"gap-1 bg-amber-50 border-amber-200 text-amber-700 hover:bg-amber-100",children:[a.jsx(yA,{className:"h-3.5 w-3.5"}),"Quiz Me"]})]})]}),a.jsxs("div",{className:"flex flex-wrap gap-2",children:[a.jsxs(Y,{size:"sm",variant:s==="all"?"default":"outline",onClick:()=>i("all"),children:[a.jsx(t2,{className:"h-3.5 w-3.5 mr-1"})," All"]}),b.map(C=>a.jsx(Y,{size:"sm",variant:s===C?"default":"outline",onClick:()=>i(C),className:"capitalize",children:C},C))]}),c&&f&&a.jsxs(se,{className:"border-2 border-amber-200 bg-gradient-to-br from-amber-50 to-orange-50",children:[a.jsx(_e,{className:"pb-2",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs(Se,{className:"text-lg flex items-center gap-2",children:[a.jsx(yA,{className:"h-5 w-5 text-amber-600"}),"Quick Quiz"]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs(ke,{variant:"outline",children:[g.correct,"/",g.total]}),a.jsx(Y,{size:"sm",variant:"ghost",onClick:()=>u(!1),children:"Close"})]})]})}),a.jsxs(ue,{children:[a.jsxs("div",{className:"text-center mb-4",children:[a.jsx("div",{className:"text-5xl font-bold text-amber-800 mb-1",children:f.malayalam}),a.jsx("div",{className:"text-sm text-amber-600 font-mono",children:f.romanization}),a.jsx("p",{className:"text-sm text-gray-500 mt-2",children:"What does this word mean?"})]}),a.jsx("div",{className:"grid grid-cols-2 gap-2",children:k(f).map(C=>a.jsx(Y,{variant:"outline",className:`h-auto py-3 ${h?C===f.english?"bg-green-100 border-green-400 text-green-700":C===h?"bg-red-100 border-red-400 text-red-700":"":"hover:bg-amber-50"}`,onClick:()=>!h&&_(C),disabled:!!h,children:C},C))}),h&&a.jsxs(Y,{className:"w-full mt-3",onClick:j,children:["Next Question ",a.jsx(rn,{className:"h-4 w-4 ml-1"})]})]})]}),a.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-4",children:w.map(C=>a.jsx(se,{className:`border-2 transition-all hover:shadow-lg cursor-pointer ${(e==null?void 0:e.character)===C.character?"border-purple-400 shadow-md":"border-gray-100 hover:border-purple-200"}`,onClick:()=>t((e==null?void 0:e.character)===C.character?null:C),children:a.jsxs(ue,{className:"pt-4",children:[a.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[a.jsx("div",{className:"w-14 h-14 roun
1068ded-xl bg-gradient-to-br from-purple-500 to-indigo-600 flex items-center justify-center text-white text-2xl font-bold shadow",children:C.character}),a.jsxs("div",{children:[a.jsx("div",{className:"font-bold text-gray-800",children:C.romanization}),a.jsx("div",{className:"text-xs text-gray-400 font-mono",children:C.ipa}),a.jsx(ke,{variant:"secondary",className:"text-[10px] mt-0.5",children:C.type})]}),a.jsx(rn,{className:"h-4 w-4 text-gray-300 ml-auto"})]}),a.jsx("div",{className:"space-y-2",children:C.words.filter(M=>s==="all"||M.category===s).map((M,I)=>{const E=`${C.character}-${I}`,B=v.has(E);return a.jsxs("div",{className:"flex items-center gap-3 p-2 rounded-lg bg-gray-50 hover:bg-purple-50 transition-all",onClick:A=>{A.stopPropagation(),S(E)},children:[a.jsx("img",{src:M.imageUrl,alt:M.english,className:"w-10 h-10 rounded-lg object-cover shadow-sm"}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("div",{className:"font-semibold text-gray-800 text-sm",children:M.malayalam}),a.jsx("div",{className:"text-xs text-gray-400 font-mono",children:M.romanization})]}),a.jsxs("div",{className:"text-right",children:[o||B?a.jsx("span",{className:"text-sm text-purple-600 font-medium",children:M.english}):a.jsx("span",{className:"text-xs text-gray-400 italic",children:"tap to reveal"}),a.jsx(ke,{className:`block text-[9px] mt-0.5 ${P[M.category]||"bg-gray-100 text-gray-600"}`,children:M.category})]})]},I)})})]})},C.character))}),w.length===0&&a.jsxs("div",{className:"text-center py-12 text-gray-400",children:[a.jsx(wa,{className:"h-12 w-12 mx-auto mb-3 opacity-30"}),a.jsx("p",{children:"No characters found matching your search"})]})]})},gn=[{id:"thiruvananthapuram",name:"Thiruvananthapuram",malayalamName:"തിരുവനന്തപുരം",description:"Capital city - Start your journey here!",x:35,y:88,requiredMastery:0,sticker:{name:"Temple Explorer",imageUrl:"https://d64gsuwffb70l.cloudfront.net/68e98d36a8cedcd8009fab27_1771867041823_8650d0f1.png",description:"You visited the Padmanabhaswamy Temple!"},characters:["അ","ആ","ഇ"],funFact:"Home to the famous Padmanabhaswamy Temple with its legendary treasure vault!"},{id:"kollam",name:"Kollam",malayalamName:"കൊല്ലം",description:"Gateway to the backwaters",x:38,y:78,requiredMastery:3,sticker:{name:"Backwater Sailor",imageUrl:"https://d64gsuwffb70l.cloudfront.net/68e98d36a8cedcd8009fab27_1771867039082_7d738d33.jpg",description:"You sailed through the Ashtamudi Lake!"},characters:["ഈ","ഉ","ഊ"],funFact:"Kollam is the southern gateway to Kerala's famous backwaters!"},{id:"alappuzha",name:"Alappuzha",malayalamName:"ആലപ്പുഴ",description:"Venice of the East",x:30,y:65,requiredMastery:6,sticker:{name:"Houseboat Captain",imageUrl:"https://d64gsuwffb70l.cloudfront.net/68e98d36a8cedcd8009fab27_1771867112138_d831871d.png",description:"You captained a houseboat through the canals!"},characters:["എ","ഏ","ക"],funFact:"Famous for the Nehru Trophy Boat Race - the largest team sport in the world!"},{id:"kochi",name:"Kochi",malayalamName:"കൊച്ചി",description:"Queen of the Arabian Sea",x:25,y:52,requiredMastery:9,sticker:{name:"Spice Trader",imageUrl:"https://d64gsuwffb70l.cloudfront.net/68e98d36a8cedcd8009fab27_1771867103922_67369190.png",description:"You traded spices at the ancient port!"},characters:["ഗ","ച","ജ"],funFact:"Kochi has been a spice trading hub for over 600 years!"},{id:"thrissur",name:"Thrissur",malayalamName:"തൃശ്ശൂർ",description:"Cultural capital of Kerala",x:32,y:40,requiredMastery:12,sticker:{name:"Festival Dancer",imageUrl:"https://d64gsuwffb70l.cloudfront.net/68e98d36a8cedcd8009fab27_1771867039469_d771543e.jpg",description:"You danced at the Thrissur Pooram!"},characters:["ട","ഡ","ണ"],funFact:"Thrissur Pooram is the largest temple festival in Kerala with 100+ elephants!"},{id:"wayanad",name:"Wayanad",malayalamName:"വയനാട്",description:"Land of paddy fields and forests",x:45,y:22,requiredMastery:15,sticker:{name:"Forest Guardian",imageUrl:"https://d64gsuwffb70l.cloudfront.net/68e98d36a8cedcd8009fab27_1771867106352_952ad55e.png",description:"You explored the ancient Edakkal Caves!"},characters:["ത","ദ","ന"],funFact:"Wayanad has cave paintings dating back to 6000 BCE!"},{id:"munnar",name:"Munnar",malayalamName:"മൂന്നാർ",description:"Tea garden paradise in the hills",x:55,y:48,requiredMastery:18,sticker:{name:"Tea Master",imageUrl:"https://d64gsuwffb70l.cloudfront.net/68e98d36a8cedcd8009fab27_1771867041823_8650d0f1.png",description:"You mastered the art of tea in the Western Ghats!"},characters:["പ","ബ","മ"],funFact:'Munnar means "three rivers" - where three mountain streams converge!'},{id:"thekkady",name:"Thekkady",malayalamName:"തേക്കടി",description:"Home of Periyar Wildlife Sanctuary",x:60,y:62,requiredMastery:21,sticker:{name:"Wildlife Ranger",imageUrl:"https://d64gsuwffb70l.cloudfront.net/68e98d36a8cedcd8009fab27_1771867039082_7d738d33.jpg",description:"You spotted wild elephants at Periyar!"},characters:["യ","ര","ല"],funFact:"Periyar is one of the finest wildlife reserves in India!"},{id:"kozhikode",name:"Kozhikode",malayalamName:"കോഴിക്കോട്",description:"City of spices - Where V
1068asco da Gama landed",x:22,y:30,requiredMastery:24,sticker:{name:"History Scholar",imageUrl:"https://d64gsuwffb70l.cloudfront.net/68e98d36a8cedcd8009fab27_1771867112138_d831871d.png",description:"You discovered the history of the Zamorin rulers!"},characters:["വ","ശ","ഷ"],funFact:'Kozhikode (Calicut) is where the word "calico" cloth comes from!'},{id:"kasaragod",name:"Kasaragod",malayalamName:"കാസർഗോഡ്",description:"Land of gods and forts - Final destination!",x:30,y:10,requiredMastery:27,sticker:{name:"Malayalam Master",imageUrl:"https://d64gsuwffb70l.cloudfront.net/68e98d36a8cedcd8009fab27_1771867103922_67369190.png",description:"You completed the Kerala journey! You are a Malayalam Master!"},characters:["സ","ഹ","ഴ"],funFact:"Kasaragod has the magnificent Bekal Fort, the largest fort in Kerala!"}],wLe=e=>{const t=gn[gn.length-1].requiredMastery;return Math.min(100,Math.round(e/t*100))},jLe=()=>{const[e,t]=y.useState(new Set(["അ","ആ","ഇ","ഈ","ഉ","ഊ","എ","ഏ","ക"])),[r,n]=y.useState(null),[s,i]=y.useState(new Set),[o,l]=y.useState(!1),c=e.size,u=wLe(c),h=y.useMemo(()=>gn.filter(v=>v.requiredMastery<=c),[c]),d=y.useMemo(()=>gn.find(v=>v.requiredMastery>c),[c]),f=v=>v.requiredMastery<=c,m=v=>{const x=gn.indexOf(v),b=gn.findIndex(w=>w.requiredMastery>c);return x===b-1||b===-1&&x===gn.length-1},g=v=>{i(x=>new Set([...x,v]))},p=v=>{t(x=>{const b=new Set(x);return b.has(v)?b.delete(v):b.add(v),b})};return a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"text-center",children:[a.jsx("h2",{className:"text-2xl font-bold text-gray-800",children:"Kerala Learning Journey"}),a.jsx("p",{className:"text-gray-500 mt-1",children:"Travel through Kerala as you master Malayalam"})]}),a.jsx(se,{className:"border-2 border-purple-100 bg-gradient-to-r from-purple-50 to-indigo-50",children:a.jsxs(ue,{className:"pt-4",children:[a.jsxs("div",{className:"flex items-center justify-between mb-3",children:[a.jsxs("div",{children:[a.jsx("div",{className:"text-sm font-medium text-gray-600",children:"Journey Progress"}),a.jsxs("div",{className:"text-2xl font-bold text-purple-700",children:[u,"%"]})]}),a.jsxs("div",{className:"text-right",children:[a.jsx("div",{className:"text-sm font-medium text-gray-600",children:"Characters Mastered"}),a.jsx("div",{className:"text-2xl font-bold text-indigo-700",children:c})]}),a.jsxs("div",{className:"text-right",children:[a.jsx("div",{className:"text-sm font-medium text-gray-600",children:"Locations Unlocked"}),a.jsxs("div",{className:"text-2xl font-bold text-green-700",children:[h.length,"/",gn.length]})]}),a.jsxs("div",{className:"text-right",children:[a.jsx("div",{className:"text-sm font-medium text-gray-600",children:"Stickers"}),a.jsx("div",{className:"text-2xl font-bold text-amber-600",children:s.size})]})]}),a.jsx(_t,{value:u,className:"h-3"}),d&&a.jsxs("p",{className:"text-xs text-gray-500 mt-2",children:["Next: ",a.jsx("strong",{children:d.name})," — Master ",d.requiredMastery-c," more characters to unlock"]})]})}),a.jsx("div",{className:"flex gap-2 justify-center",children:a.jsxs(Y,{variant:o?"default":"outline",onClick:()=>l(!o),className:"gap-1.5",children:[a.jsx(Ec,{className:"h-4 w-4"}),"Sticker Book (",s.size,"/",gn.length,")"]})}),o&&a.jsxs(se,{className:"border-2 border-amber-200 bg-gradient-to-br from-amber-50 to-yellow-50",children:[a.jsx(_e,{className:"pb-2",children:a.jsxs(Se,{className:"text-lg flex items-center gap-2",children:[a.jsx(lr,{className:"h-5 w-5 text-amber-600"}),"My Sticker Collection"]})}),a.jsx(ue,{children:a.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-5 gap-3",children:gn.map(v=>{const x=s.has(v.id),b=f(v);return a.jsxs("div",{className:`text-center p-3 rounded-xl border-2 transition-all ${x?"border-amber-300 bg-white shadow-md":b?"border-dashed border-amber-200 bg-amber-50/50 cursor-pointer hover:bg-amber-100/50":"border-dashed border-gray-200 bg-gray-50 opacity-50"}`,onClick:()=>b&&!x&&g(v.id),children:[x?a.jsx("img",{src:v.sticker.imageUrl,alt:v.sticker.name,className:"w-12 h-12 mx-auto rounded-lg object-cover"}):b?a.jsx("div",{className:"w-12 h-12 mx-auto rounded-lg bg-amber-100 flex items-center justify-center",children:a.jsx(An,{className:"h-6 w-6 text-amber-400"})}):a.jsx("div",{className:"w-12 h-12 mx-auto rounded-lg bg-gray-200 flex items-center justify-center",children:a.jsx(Ef,{className:"h-5 w-5 text-gray-400"})}
1068),a.jsx("div",{className:"text-xs font-medium mt-1.5 truncate",children:x?v.sticker.name:b?"Tap to collect!":"???"})]},v.id)})})})]}),a.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6",children:[a.jsx("div",{className:"lg:col-span-2",children:a.jsx(se,{className:"border-2 border-green-100 overflow-hidden",children:a.jsx(ue,{className:"p-0",children:a.jsxs("div",{className:"relative",children:[a.jsx("img",{src:"https://d64gsuwffb70l.cloudfront.net/68e98d36a8cedcd8009fab27_1771867020492_b2f64b1c.png",alt:"Kerala Map",className:"w-full h-auto"}),gn.map(v=>{const x=f(v),b=m(v);return a.jsx("button",{className:`absolute transform -translate-x-1/2 -translate-y-1/2 transition-all ${x?"cursor-pointer hover:scale-125":"cursor-not-allowed"} ${b?"animate-bounce":""}`,style:{left:`${v.x}%`,top:`${v.y}%`},onClick:()=>x&&n(v),children:a.jsxs("div",{className:"relative",children:[a.jsx(gA,{className:`h-7 w-7 drop-shadow-lg ${b?"text-amber-500 fill-amber-200":x?"text-green-600 fill-green-200":"text-gray-400 fill-gray-200"}`}),s.has(v.id)&&a.jsx(is,{className:"absolute -top-1 -right-1 h-3.5 w-3.5 text-amber-500 fill-amber-400"})]})},v.id)}),a.jsx("svg",{className:"absolute inset-0 w-full h-full pointer-events-none",viewBox:"0 0 100 100",preserveAspectRatio:"none",children:gn.slice(0,-1).map((v,x)=>{const b=gn[x+1],w=f(b);return a.jsx("line",{x1:v.x,y1:v.y,x2:b.x,y2:b.y,stroke:w?"#22C55E":"#D1D5DB",strokeWidth:"0.4",strokeDasharray:w?"0":"1 1",opacity:"0.6"},v.id)})})]})})})}),a.jsxs("div",{className:"space-y-4",children:[r?a.jsxs(se,{className:`border-2 ${f(r)?"border-green-200":"border-gray-200"}`,children:[a.jsx(_e,{className:"pb-2",children:a.jsxs("div",{className:"flex items-start justify-between",children:[a.jsxs("div",{children:[a.jsx(Se,{className:"text-lg",children:r.name}),a.jsx("div",{className:"text-sm text-gray-500",children:r.malayalamName})]}),f(r)?a.jsx(ke,{className:"bg-green-100 text-green-700",children:"Unlocked"}):a.jsxs(ke,{variant:"outline",className:"text-gray-500",children:[a.jsx(Ef,{className:"h-3 w-3 mr-1"})," Locked"]})]})}),a.jsxs(ue,{className:"space-y-3",children:[a.jsx("p",{className:"text-sm text-gray-600",children:r.description}),a.jsxs("div",{className:"flex items-center gap-3 p-3 bg-amber-50 rounded-lg",children:[a.jsx("img",{src:r.sticker.imageUrl,alt:"",className:"w-12 h-12 rounded-lg object-cover"}),a.jsxs("div",{children:[a.jsx("div",{className:"text-sm font-semibold text-amber-800",children:r.sticker.name}),a.jsx("div",{className:"text-xs text-amber-600",children:r.sticker.description})]})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"text-sm font-semibold text-gray-700 mb-2",children:"Characters to Master"}),a.jsx("div",{className:"flex gap-2",children:r.characters.map(v=>a.jsx("button",{onClick:()=>p(v),className:`w-12 h-12 rounded-xl text-xl font-bold transition-all ${e.has(v)?"bg-green-500 text-white shadow-md":"bg-gray-100 text-gray-600 hover:bg-purple-100"}`,children:v},v))}),a.jsx("p",{className:"text-xs text-gray-400 mt-1",children:"Click characters to toggle mastery (for demo)"})]}),a.jsxs("div",{className:"bg-blue-50 p-3 rounded-lg",children:[a.jsxs("div",{className:"flex items-center gap-1.5 mb-1",children:[a.jsx(nl,{className:"h-3.5 w-3.5 text-blue-600"}),a.jsx("span",{className:"text-xs font-semibold text-blue-700",children:"Fun Fact"})]}),a.jsx("p",{className:"text-sm text-blue-600",children:r.funFact})]}),!f(r)&&a.jsx("div",{className:"text-center py-2",children:a.jsxs("p",{className:"text-sm text-gray-500",children:["Master ",a.jsx("strong",{children:r.requiredMastery-c})," more characters to unlock"]})})]})]}):a.jsx(se,{className:"border-2 border-gray-100",children:a.jsxs(ue,{className:"py-12 text-center text-gray-400",children:[a.jsx(gA,{className:"h-12 w-12 mx-auto mb-3 opacity-30"}),a.jsx("p",{className:"text-sm",children:"Click a location on the map to see details"})]})}),a.jsxs(se,{children:[a.jsx(_e,{className:"pb-2",children:a.jsx(Se,{className:"text-sm",children:"All Locations"})}),a.jsx(ue,{className:"space-y-1.5 max-h-80 overflow-y-auto",children:gn.map((v,x)=>{const b=f(v);return a.jsxs("button",{className:`w-full flex items-center gap-2 p-2 rounded-lg text-left transition-all ${(r==null?void 0:r.id)===v.id?"bg-purple-100 border border-purple-200":b?"hover:bg-gray-50":"opacity-50"}`,onClick:()=>n(v),children:[a.jsx("span",{className:`flex-shrink-0 w-7 h-7 rounded-full flex items-center justify-center text-xs font-bold ${b?"bg-green-100 text-green-700":"bg-gray-100 text-gray-400"}`,children:b?x+1:a.jsx(Ef,{className:"h-3 w-3"})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("div",{className:"text-sm font-medium truncate",children:v.name}),a.jsx("div",{className:"text-[10px] text-gray-400",children:v.malayalamName})]}),s.has(v.id)&&a.jsx(is,{className:"h-4 w-4 text-amber-500 fill-amber-400 flex-shrink-0"}),a.jsx(ns,{className:"h-3.5 w-3.5 text-gray-300 flex-shrink-0"})]},v.id)})})]})]})]})]})},_R=[{id:"phonetics",label:"Visual Phonetics",shortLabel:"Phonetics",icon:a.jsx(fa,{className:"h-5 w-5"}),color:"text-purple-600",bgColor:"from-purple-500 to-indigo-600",description:"Mouth position diagrams & animations"},{id:"listen",label:"Listen & Repeat",shortLabel:"Listen",icon:a.jsx(cc,{className:"h-5 w-5"}),color:"text-red-600",bgColor:"from-red-500 to-pink-600",description:"AI-powered pronunciation feedback",badge:"AI"},{id:"writing",label:"Writing Canvas",shortLabel:"Write",icon:a.jsx(Vs,{className:"h-5 w-5"}),color:"text-blue-600",bgColor:"from-blue-500 to-cyan-600",description:"Interactive tracing & stroke order"},{id:"vocabulary",label:"Vocabulary Bridge",shortLabel:"Vocab",icon:a.jsx(wa,{className:"h-5 w-5"}),color:"text-green-600",bgColor:"from-green-500 to-emerald-600",description:"Connect sounds to real words"},{id:"journey",label:"Kerala Journey",shortLabel:"Journey",icon:a.jsx(AK,{className:"h-5 w-5"}
1068),color:"text-amber-600",bgColor:"from-amber-500 to-orange-600",description:"Gamified progress through Kerala",badge:"New"}],_Le=()=>{const[e,t]=y.useState(null),r=()=>{switch(e){case"phonetics":return a.jsx(pLe,{});case"listen":return a.jsx(gLe,{});case"writing":return a.jsx(vLe,{});case"vocabulary":return a.jsx(bLe,{});case"journey":return a.jsx(jLe,{});default:return null}};return a.jsxs("div",{className:"min-h-screen bg-gray-50",children:[a.jsx(hs,{}),a.jsxs("div",{className:"max-w-7xl mx-auto px-4 py-6",children:[a.jsxs("div",{className:"text-center mb-8",children:[a.jsxs("div",{className:"inline-flex items-center gap-2 px-4 py-1.5 bg-purple-100 text-purple-700 rounded-full text-sm font-medium mb-3",children:[a.jsx(An,{className:"h-4 w-4"}),"Interactive Learning Suite"]}),a.jsx("h1",{className:"text-3xl md:text-4xl font-bold text-gray-900 mb-2",children:"Master Malayalam"}),a.jsx("p",{className:"text-gray-500 max-w-2xl mx-auto",children:"Five powerful tools to help you learn Malayalam — from visual phonetics and pronunciation practice to writing, vocabulary, and a gamified journey through Kerala."})]}),a.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-5 gap-3 mb-8",children:_R.map(n=>a.jsxs("button",{onClick:()=>t(e===n.id?null:n.id),className:`relative group p-4 rounded-2xl border-2 transition-all text-left ${e===n.id?"border-transparent shadow-lg scale-[1.02]":"border-gray-200 bg-white hover:border-gray-300 hover:shadow-md"}`,children:[e===n.id&&a.jsx("div",{className:`absolute inset-0 bg-gradient-to-br ${n.bgColor} rounded-2xl opacity-10`}),a.jsxs("div",{className:"relative",children:[a.jsxs("div",{className:"flex items-center justify-between mb-2",children:[a.jsx("div",{className:`p-2 rounded-xl ${e===n.id?`bg-gradient-to-br ${n.bgColor} text-white`:"bg-gray-100 text-gray-500 group-hover:bg-gray-200"}`,children:n.icon}),n.badge&&a.jsx(ke,{className:`text-[10px] ${e===n.id?"bg-white/20 text-gray-700":"bg-purple-100 text-purple-700"}`,children:n.badge})]}),a.jsxs("h3",{className:`font-bold text-sm ${e===n.id?"text-gray-900":"text-gray-700"}`,children:[a.jsx("span",{className:"hidden sm:inline",children:n.label}),a.jsx("span",{className:"sm:hidden",children:n.shortLabel})]}),a.jsx("p",{className:"text-xs text-gray-400 mt-0.5 hidden sm:block",children:n.description})]})]},n.id))}),e?a.jsxs("div",{className:"animate-in fade-in duration-300",children:[a.jsxs(Y,{variant:"ghost",size:"sm",onClick:()=>t(null),className:"mb-4 text-gray-500",children:[a.jsx(rn,{className:"h-4 w-4 mr-1 rotate-180"}),"Back to overview"]}),r()]}):a.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:_R.map(n=>a.jsxs(se,{className:"group cursor-pointer border-2 border-gray-100 hover:border-purple-200 hover:shadow-xl transition-all overflow-hidden",onClick:()=>t(n.id),children:[a.jsx("div",{className:`h-2 bg-gradient-to-r ${n.bgColor}`}),a.jsxs("div",{className:"p-6",children:[a.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[a.jsx("div",{className:`p-3 rounded-xl bg-gradient-to-br ${n.bgColor} text-white shadow-lg group-hover:scale-110 transition-transform`,children:n.icon}),a.jsxs("div",{children:[a.jsx("h3",{className:"font-bold text-gray-800",children:n.label}),n.badge&&a.jsx(ke,{className:"bg-purple-100 text-purple-700 text-[10px]",children:n.badge})]})]}),a.jsx("p",{className:"text-sm text-gray-500 mb-4",children:n.description}),n.id==="phonetics"&&a.jsx("div",{className:"flex gap-2",children:["ഴ","റ്റ","ണ","ള"].map(s=>a.jsx("div",{className:"w-10 h-10 rounded-lg bg-purple-50 flex items-center justify-center text-lg font-bold text-purple-700",children:s},s))}),n.id==="listen"&&a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("div",{className:"flex gap-0.5",children:[3,5,8,12,8,5,3,6,10,7,4,2].map((s,i)=>a.jsx("div",{className:"w-1.5 bg-red-400 rounded-full",style:{height:`${s*3}px`}},i))}),a.jsx("span",{className:"text-xs text-gray-400 ml-2",children:"AI Analysis"})]}),n.id==="writing"&&a.jsx("div",{className:"flex gap-2",children:["അ","ക","മ","ഴ"].map(s=>a.jsx("div",{className:"w-10 h-10 rounded-lg border-2 border-dashed border-blue-200 flex items-center justify-center text-lg font-bold text-blue-300",children:s},s))}),n.id==="vocabulary"&&a.jsxs("div",{className:"text-xs text-gray-400",children:[a.jsx("span",{className:"font-semibold text-green-600",children:"30+"})," words across ",a.jsx("span",{className:"font-semibold text-green-600",children:"10"})," characters"]}),n.id==="journey"&&a.jsxs("div",{className:"flex items-center gap-1.5",children:[[1,2,3,4,5].map(s=>a.jsx("div",{className:`w-6 h-6 rounded-full flex items-center justify-center text-[10px] font-bold ${s<=3?"bg-green-100 text-green-700":"bg-gray-100 text-gray-400"}`,children:s<=3?"✓":s},s)),a.jsx("span",{className:"text-xs text-gray-400 ml-1",children:"10 locations"})]}),a.jsxs("div",{className:"mt-4 flex items-center text-sm font-medium text-purple-600 group-hover:text-purple-700",children:["Start Learning ",a.jsx(rn,{className:"h-4 w-4 ml-1 group-hover:translate-x-1 transition-transform"})]})]})]},n.id))})]})]})},Sl=[{id:"friendly-five",phase:1,title:"The Friendly Five",malayalamTitle:"എളുപ്പമുള്ള അഞ്ച്",subt
1068itle:"Easiest consonants to write and say",description:"We start with five consonants that are simple in shape and familiar in sound. These are your building blocks — master these and everything else becomes easier.",narrationIntro:"Welcome to Uncle B's Writing Lab! I'm so happy you're here. Today we're going to start with what I call 'The Friendly Five' — five Malayalam consonants that are the easiest to write and pronounce. These are the same letters I start with when I teach children in my classroom. Don't worry about being perfect. Just enjoy the shapes. Ready? Let's begin!",color:"text-blue-600",bgGradient:"from-blue-500 to-indigo-600",icon:"Smile",letters:[{character:"ല",romanized:"la",ipa:"/l/",mnemonic:"A gentle wave — like a small hill with a tail curving right",tonguePosition:'Tip of tongue touches the ridge behind your upper front teeth. Same as English "L" in "love".',teachingNote:"This is the easiest letter to write! Just a smooth curve. I always start my class with this one because every child smiles when they get it right on the first try.",strokeHints:["Start from the top-left","Draw a smooth curve downward","Finish with a gentle tail to the right"],difficulty:1,audioType:"consonant",exampleWord:"ലത",exampleMeaning:"creeper/vine",exampleRomanized:"latha"},{character:"വ",romanized:"va",ipa:"/ʋ/",mnemonic:"Two peaks — like a crown or the letter W turned into curves",tonguePosition:"Upper teeth lightly touch lower lip. Between English V and W — softer than V, firmer than W.",teachingNote:"Think of it as a softer V sound. In some dialects it sounds more like W. Both are acceptable! The shape is like two little mountains.",strokeHints:["Start from the left peak","Draw down to the valley","Rise up to the second peak","Finish with a small tail"],difficulty:1,audioType:"consonant",exampleWord:"വള",exampleMeaning:"bangle",exampleRomanized:"vala"},{character:"മ",romanized:"ma",ipa:"/m/",mnemonic:"Two bumps sitting together — like two friends side by side",tonguePosition:'Close both lips together gently. Exactly like English M in "mother".',teachingNote:"This is the M sound — same as in English! The shape has two bumps. I tell my students: think of two mangoes sitting next to each other.",strokeHints:["Start from the left","Draw the first bump","Continue to the second bump","End with a small curve down"],difficulty:1,audioType:"consonant",exampleWord:"മല",exampleMeaning:"mountain",exampleRomanized:"mala"},{character:"പ",romanized:"pa",ipa:"/p/",mnemonic:"A flag on a pole — a loop on top of a vertical stroke",tonguePosition:'Close both lips and release with a small puff. Like P in "spin" — NOT like P in "pin" (no big puff of air).',teachingNote:"Important! This P has NO puff of air. Put your hand in front of your mouth — you should feel almost nothing. It's like the P in 'spin', not 'pin'.",strokeHints:["Start with the loop at top","Draw the vertical line down","The loop sits like a flag on a flagpole"],difficulty:1,audioType:"consonant",exampleWord:"പല",exampleMeaning:"many/several",exampleRomanized:"pala"},{character:"ക",romanized:"ka",ipa:"/k/",mnemonic:"A seatbelt — a curve that crosses over itself",tonguePosition:'Back of tongue touches the soft palate (back of roof of mouth). Like K in "skip" — no puff of air.',teachingNote:"Another no-puff letter! The back of your tongue does the work here. The shape is like a seatbelt clicking into place. Remember: 'skip' not 'kite'.",strokeHints:["Start from the top","Draw the main curve leftward","Cross over and add the bottom hook to the right"],difficulty:2,audioType:"consonant",exampleWord:"കല",exampleMeaning:"art/stone",exampleRomanized:"kala"}]},{id:"schwa-secret",phase:2,title:"The Schwa Secret",malayalamTitle:"സ്വരം ഒളിഞ്ഞിരിക്കുന്നു",subtitle:"Every consonant has a hidden 'a' sound!",description:"Before we go further, you need to understand the most important concept in Malayalam: every consonant automatically includes an 'a' sound. This is called the 'inherent vowel' or schwa.",narrationIntro:"Now, before we learn more letters, I need to tell you a secret. It's the most important thing about Malayalam writing. Are you ready? Every single consonant in Malayalam comes with a built-in 'a' sound! When you see ക, you don't say just 'k' — you say 'ka'. When you see മ, you don't say 'm' — you say 'ma'. This hidden 'a' sound is called the schwa, and understanding it is the key to reading Malayalam. Let me show you what I mean.",color:"text-amber-600",bgGradient:"from-
1068amber-500 to-orange-600",icon:"Lightbulb",isConceptPhase:!0,concept:{type:"concept",id:"inherent-vowel",title:"The Inherent Vowel (Schwa)",malayalamTitle:"സ്വതസിദ്ധ സ്വരം",narration:"In English, the letter K is just the sound 'k'. But in Malayalam, the letter ക is 'ka' — it has a vowel built right in! This is true for EVERY consonant. ല is 'la', not 'l'. മ is 'ma', not 'm'. പ is 'pa', not 'p'. This built-in 'a' sound is like the 'a' in the word 'America' — short and quick. This is why you can write a whole word using just consonants! For example: മല means 'mountain' — that's ma plus la. No separate vowel letters needed for the 'a' sounds!",examples:[{before:"ക",after:"ka",beforePronunciation:"The letter by itself",afterPronunciation:"ka (not just k!)",explanation:'The consonant ക automatically sounds like "ka"'},{before:"മല",after:"mala",beforePronunciation:"Two consonants together",afterPronunciation:"ma-la (mountain)",explanation:'Each consonant brings its own "a" — so മ+ല = ma+la = mala'},{before:"പല",after:"pala",beforePronunciation:"Two consonants together",afterPronunciation:"pa-la (many)",explanation:'പ is "pa" and ല is "la" — together they make "pala"'}],keyTakeaway:'Every Malayalam consonant = consonant sound + "a" vowel. This is the foundation of reading Malayalam!'}},{id:"vowels",phase:3,title:"The Vowel Family",malayalamTitle:"സ്വരങ്ങൾ",subtitle:"The 5 basic vowels — short and long pairs",description:"Malayalam has beautiful vowel pairs — each vowel comes in a short and long version. The long version is simply held longer. Think of it like musical notes: short is a quarter note, long is a half note.",narrationIntro:"Wonderful! Now that you know about the hidden 'a' sound, let's meet the vowel family. Malayalam vowels come in pairs — a short version and a long version. The short 'a' and the long 'aa'. The short 'i' and the long 'ee'. It's like music — the long vowel is just held for a beat longer. The
1068se vowel letters are used at the BEGINNING of words. Inside words, we use vowel signs instead — but we'll learn those later. For now, let's meet the vowels!",color:"text-emerald-600",bgGradient:"from-emerald-500 to-teal-600",icon:"Music",letters:[{character:"അ",romanized:"a",ipa:"/a/",mnemonic:"A curving loop — like a small ear",tonguePosition:'Mouth open, tongue relaxed in the center. Like the "u" in English "but" or "a" in "America".',teachingNote:"This is the most common sound in Malayalam! It's the hidden vowel we just learned about. Short and quick — like saying 'uh'.",strokeHints:["Start from the top curve","Draw the loop clockwise","Finish with the tail down-right"],difficulty:2,audioType:"vowel"},{character:"ആ",romanized:"aa",ipa:"/aː/",mnemonic:"അ with an extra stroke — the long version gets a tail",tonguePosition:'Same mouth position as അ, but hold it longer. Like "a" in "father".',teachingNote:"Just hold the 'a' sound longer. In writing, you add a vertical line to the right of അ. Simple!",strokeHints:["Draw അ first","Add the vertical extension on the right","Connect smoothly"],difficulty:3,audioType:"vowel"},{character:"ഇ",romanized:"i",ipa:"/i/",mnemonic:"A small hook — like a fishhook",tonguePosition:'Tongue high and forward, lips slightly spread. Like "i" in "bit" or "pin".',teachingNote:"Short 'i' — quick and light. Not like 'ee' in 'see'. More like the 'i' in 'sit'.",strokeHints:["Start with the top loop","Draw downward curve","Add the small hook at bottom"],difficulty:2,audioType:"vowel"},{character:"ഈ",romanized:"ii",ipa:"/iː/",mnemonic:"ഇ with an extra flourish — longer sound, longer shape",tonguePosition:'Same as ഇ but held longer. Like "ee" in "see" or "feet".',teachingNote:"Now THIS is the 'ee' sound. Hold it longer. The letter gets an extra curve to show it's longer.",strokeHints:["Draw ഇ first","Extend with the additional curve","Finish with the tail"],difficulty:3,audioType:"vowel"},{character:"ഉ",romanized:"u",ipa:"/u/",mnemonic:"A compact loop — like a small knot",tonguePosition:'Tongue high and back, lips rounded. Like "u" in "put" or "oo" in "book".',teachingNote:"Round your lips! This is a short 'u' — like in 'put', not like 'cute'.",strokeHints:["Start from the top","Draw the compact loop","Finish with a small tail"],difficulty:2,audioType:"vowel"},{character:"ഊ",romanized:"uu",ipa:"/uː/",mnemonic:"ഉ extended — the long version stretches out",tonguePosition:'Same as ഉ but held longer. Like "oo" in "food" or "moon".',teachingNote:"Hold that rounded lip position longer. 'oo' as in 'moon'. The letter stretches out to show the longer sound.",strokeHints:["Draw ഉ first","Extend the shape","Add the lengthening stroke"],difficulty:3,audioType:"vowel"},{character:"എ",romanized:"e",ipa:"/e/",mnemonic:"A sideways curve — like a gentle wave",tonguePosition:'Tongue mid-height, front of mouth. Like "e" in "bed" or "set".',teachingNote:"Short 'e' — like in 'set'. Not 'ay' as in 'say'. Quick and clean.",strokeHints:["Start from the left","Draw the main curve","Finish with the tail"],difficulty:2,audioType:"vowel"},{character:"ഏ",romanized:"ee",ipa:"/eː/",mnemonic:"എ with extension — longer sound, longer letter",tonguePosition:'Same as എ but held longer. Like "ay" in "say" or "a" in "cake".',teachingNote:"NOW it's the 'ay' sound — held longer. Like saying 'ay' in 'say'. The letter gets an extension.",strokeHints:["Draw എ first","Add the extending stroke","Complete the shape"],difficulty:3,audioType:"vowel"},{character:"ഒ",romanized:"o",ipa:"/o/",mnemonic:"A rounded shape — like a small pot",tonguePosition:'Tongue mid-height, back of mouth, lips rounded. Like "o" in "go" but shorter.',teachingNote:"Short 'o' — round your lips slightly. Quick sound, like the beginning of 'oh' but cut short.",strokeHints:["Start from the top","Draw the rounded body","Finish with the tail"],difficulty:2,audioType:"vowel"},{character:"ഓ",romanized:"oo",ipa:"/oː/",mnemonic:"ഒ extended — the long O stretches",tonguePosition:'Same as ഒ but held longer. Like "o" in "go" or "oh".',teachingNote:"The full 'oh' sound — hold it out. Like when you say 'Oh, I see!' The letter gets bigger to match.",strokeHints:["Draw ഒ first","Add the lengthening extension","Complete the shape"],difficulty:3,audioType:"vowel"}]},{id:"chandrakkala",phase:4,title:"The Mute Button",malayalamTitle:"ചന്ദ്രക്കല",subtitle:"Chandrakkala — silencing the hidden 'a'",description:"Remember the built-in 'a' sound? Sometimes you need to REMOVE it. That's what the chandrakkala does — it's like a mute button for the inherent vowel.",n
1068arrationIntro:"Remember our secret about the hidden 'a' sound? Well, sometimes you need to turn it OFF. Imagine every consonant has a tiny speaker playing 'aaa' — the chandrakkala is the mute button! It's a small mark that sits on top of a consonant and says: 'Shh! No vowel here!' This is incredibly important for spelling words correctly. Without it, every consonant would always end with 'a'. Let me show you how it works.",color:"text-rose-600",bgGradient:"from-rose-500 to-pink-600",icon:"VolumeX",isConceptPhase:!0,concept:{type:"concept",id:"chandrakkala",title:"Chandrakkala (Virama)",malayalamTitle:"ചന്ദ്രക്കല",narration:"The chandrakkala looks like a tiny crescent moon sitting on top of a consonant. Its job is simple but crucial: it removes the built-in 'a' sound. So ക is 'ka', but ക് is just 'k'. No vowel! This is how you end words with a consonant sound. Take the word for 'forest' — കാട്. That final ട് has a chandrakkala, so it's 'kaad', not 'kaada'. Without the chandrakkala, you'd be adding an extra 'a' that doesn't belong! Think of it this way: the chandrakkala is like an eraser — it erases the 'a' that's automatically there.",examples:[{before:"ക",after:"ക്",beforePronunciation:"ka",afterPronunciation:"k (just the consonant)",explanation:'The chandrakkala ് removes the inherent "a" from ക'},{before:"മ",after:"മ്",beforePronunciation:"ma",afterPronunciation:"m (just the consonant)",explanation:'മ becomes just "m" — the "a" is silenced'},{before:"കാട",after:"കാട്",beforePronunciation:"kaada (wrong!)",afterPronunciation:"kaad (correct — forest)",explanation:'The chandrakkala on the final ട makes it end with "d" not "da"'},{before:"പൂവ",after:"പൂവ്",beforePronunciation:"poova (wrong!)",afterPronunciation:"poov (correct — flower)",explanation:'Without chandrakkala, you add an unwanted "a" at the end'}],keyTakeaway:'The chandrakkala ് is the "mute button" — it removes the automatic "a" sound from any consonant. Essential for correct pronunciation!'}},{id:"matras",phase:5,title:"Vowel Signs — The Shape Shifters",malayalamTitle:"മാത്രകൾ",subtitle:"How vowels attach to consonants",description:"Vowel letters are used at the start of words. But INSIDE words, vowels become signs (matras) that attach to consonants — above, below, before, or after them.",narrationIntro:"Now here's where it gets really interesting! You know the vowel letters we learned? Those are used at the START of words. But what about vowels in the MIDDLE of words? That's where vowel signs come in — we call them 'matras'. A matra is like a vowel costume that a consonant wears. It attaches to the consonant and changes its sound. Some matras go above the consonant, some go below, some go before it, and some go after. Let me show you using our friend ക as the example consonant.",color:"text-purple-600",bgGradient:"from-purple-500 to-violet-600",icon:"Wand2",letters:[{character:"കാ",romanized:"kaa",ipa:"/kaː/",mnemonic:'ക with a vertical line added to the right — the "aa" sign',tonguePosition:'Say "ka" but hold the "a" longer — "kaa"',teachingNote:"The 'aa' matra is a vertical line that goes AFTER the consonant. ക + ാ = കാ. Simple addition!",strokeHints:["Write ക first","Add the vertical line ാ to the right"],difficulty:2,audioType:"vowel-sign"},{character:"കി",romanized:"ki",ipa:"/ki/",mnemonic:'ക with a small hook on top — the "i" sign sits above',tonguePosition:'Start with "k" then quickly move to "i" as in "kit"',teachingNote:"The short 'i' matra goes ABOVE the consonant. It's like a little hat! ക + ി = കി.",strokeHints:["Write ക first","Add the ി sign above"],difficulty:2,audioType:"vowel-sign"},{character:"കീ",romanized:"kii",ipa:"/kiː/",mnemonic:'ക with a longer hook on top — the "ee" sign extends further',tonguePosition:'Say "k" then hold "ee" as in "keen"',teachingNote:"The long 'ee' matra also goes above, but it's a bit longer than the short 'i' sign. ക + ീ = കീ.",strokeHints:["Write ക first","Add the ീ sign above — slightly longer than ി"],difficulty:2,audioType:"vowel-sign"},{character:"കു",romanized:"ku",ipa:"/ku/",mnemonic:'ക with a small curl below — the "u" sign hangs underneath',tonguePosition:'Say "k" then round your lips for a short "u" as in "put"',teachingNote:"The short 'u' matra goes BELOW the consonant. It hangs underneath like a little tail. ക + ു = കു.",strokeHints:["Write ക first","Add the ു sign below"],difficulty:2,audioType:"vowel-sign"},{character:"കൂ",romanized:"kuu",ipa:"/kuː/",mnemonic:'ക with a longer curl below — the "oo" sign extends down',tonguePosition:'Say "k" then hold rounded lips for "oo" as in "cool"',teachingNote:"The long 'oo' matra also goes below, but extends further. ക + ൂ = കൂ. Like 'cool'!",strokeHints:["Write ക first","Add the ൂ sign below — longer than ു"],difficulty:2,audioType:"vowel-sign"},{character:"കെ",romanized:"ke",ipa:"/ke/",mnemonic:'A sign goe
1068s BEFORE ക — the "e" sign leads the way',tonguePosition:'Say "k" then short "e" as in "get"',teachingNote:"Here's the tricky part! The short 'e' matra goes BEFORE the consonant in writing, even though you say the consonant first. െ + ക = കെ. You write it left-to-right but the consonant sound comes first!",strokeHints:["Write the െ sign first (to the left)","Then write ക to its right"],difficulty:3,audioType:"vowel-sign"},{character:"കേ",romanized:"kee",ipa:"/keː/",mnemonic:'A taller sign goes BEFORE ക — the "ay" sign leads proudly',tonguePosition:'Say "k" then "ay" as in "cake"',teachingNote:"The long 'ay' matra also goes before the consonant, but it's taller. േ + ക = കേ. Same trick — write left, read right!",strokeHints:["Write the േ sign first (to the left)","Then write ക to its right"],difficulty:3,audioType:"vowel-sign"},{character:"കൊ",romanized:"ko",ipa:"/ko/",mnemonic:'Signs on BOTH sides — "e" before AND "aa" after!',tonguePosition:'Say "k" then short "o" as in "cot"',teachingNote:"Now this is clever! The 'o' sound is made by combining TWO signs — the 'e' sign before AND the 'aa' sign after. െ + ക + ാ = കൊ. It wraps around the consonant!",strokeHints:["Write െ to the left","Write ക in the middle","Write ാ to the right"],difficulty:3,audioType:"vowel-sign"},{character:"കോ",romanized:"koo",ipa:"/koː/",mnemonic:'The "ay" sign before AND "aa" sign after — surrounding the consonant',tonguePosition:'Say "k" then hold "oh" as in "go"',teachingNote:"The long 'oh' uses the long 'ay' sign before and the 'aa' sign after. േ + ക + ാ = കോ. The consonant is sandwiched!",strokeHints:["Write േ to the left","Write ക in the middle","Write ാ to the right"],difficulty:3,audioType:"vowel-sign"}]},{id:"more-consonants",phase:6,title:"More Consonant Friends",malayalamTitle:"കൂടുതൽ വ്യഞ്ജനങ്ങൾ",subtitle:"Expanding your consonant family",description:"Now that you understand vowels, matras, and the schwa, let's add more consonants to your collection. These are commonly used and will unlock many new words.",narrationIntro:"You're doing brilliantly! Now let's expand your consonant family. These next letters are ones you'll see everywhere in Malayalam text. Each one has its own personality and sound. I'll teach you the shape, the sound, and a little trick to remember each one. Let's go!",color:"text-cyan-600",bgGradient:"from-cyan-500 to-blue-600",icon:"Users",letters:[{character:"ന",romanized:"na",ipa:"/n̪/",mnemonic:"Two humps — like a double wave or a camel's back",tonguePosition:"Tongue tip touches the back of your upper front teeth. This is a DENTAL N — different from English N!",teachingNote:"This N is special — your tongue touches your TEETH, not the ridge behind them. It's softer than English N. The shape has two humps, like ല repeated twice.",strokeHints:["Start from the left","Draw the first hump","Continue to the second hump","Finish with a tail"],difficulty:2,audioType:"consonant",exampleWord:"നല",exampleMeaning:"good",exampleRomanized:"nala"},{character:"ത",romanized:"tha",ipa:"/t̪/",mnemonic:"A loop with a vertical line — like a lollipop",tonguePosition:"Tongue tip touches upper front teeth. This is a DENTAL T — softer than English T.",teachingNote:"Don't be confused by the romanization 'tha' — there's NO 'th' sound like in 'think'! It's a soft T with your tongue on your teeth. Very different from English T.",strokeHints:["Start with the loop at top","Draw the vertical line down","Add the bottom hook"],difficulty:2,audioType:"consonant",exampleWord:"തല",exampleMeaning:"head",exampleRomanized:"thala"},{character:"ര",romanized:"ra",ipa:"/r/",mnemonic:"A curved arm reaching out — the base shape of many letters",tonguePosition:'Tongue tip flaps quickly against the ridge behind upper teeth. Like a quick D sound, or the "tt" in American "butter".',teachingNote:"This R is a quick flap — your tongue taps the roof of your mouth once. It's NOT the English R! Think of how Americans say 'butter' or 'water' — that quick 'tt' sound is close.",strokeHints:["Start from the top","Draw the main curve","Finish with the tail"],difficulty:2,audioType:"consonant",exampleWord:"വര",exampleMeaning:"line/to come",exampleRomanized:"vara"},{character:"ച",romanized:"cha",ipa:"/t͡ʃ/",mnemonic:"An elegant curve with a loop — like a swan's neck",tonguePosition:'Middle of tongue touches hard palate. Like "ch" in "church" but softer, no puff of air.',teachingNote:"This is like the 'ch' in 'church' but gentler. No big puff of air. The shape is elegant — I always say it looks like a swan.",strokeHints:["Start with the upper loop","Draw down and curve right","Complete the bottom"],difficulty:2,audioType:"consonant",exampleWord:"ചല",exampleMeaning:"to move",exampleRomanized:"chala"},{character:"യ",romanized:"ya",ipa:"/j/",mnemonic:"A flowing curve — like a river bend",tonguePosition:'Tongue high and forward, like starting to say "ee" then gliding. Same as English Y in "yes".',teachingNote:"Good news — this sounds just like English Y in 'yes'! The shape flows like a river. Easy sound, beautiful letter.",strokeHints:["Start from the top","Draw the flowing curve","End with a gentle tail"],difficulty:2,audioType:"consonant",exampleWord:"മയ",exampleMeaning:"compassion",exampleRomanized:"maya"}]},{id:"varga-velar",phase:7,title:"Varga System — The Velars",malayalamTitle:"കവർഗ്ഗം",subtitle:"Ka-varga: Back of tongue meets soft palate",description:"The varga system organizes consonants by WHERE 
1068in your mouth they're produced. Each group (varga) has 5 letters following the same pattern: plain, aspirated, voiced, voiced-aspirated, and nasal. Let's start with the velars — sounds made at the back of your mouth.",narrationIntro:"Now we enter the heart of the Malayalam alphabet — the Varga system! This is how ancient Indian grammarians organized sounds, and it's brilliant. Each group has exactly 5 consonants, and they follow a pattern. For the velar group, all sounds are made with the BACK of your tongue touching your soft palate — that's the soft part at the very back of the roof of your mouth. The pattern goes: plain, aspirated, voiced, voiced-aspirated, and nasal. You already know ക — now let's meet its family!",color:"text-red-600",bgGradient:"from-red-500 to-rose-600",icon:"Grid3X3",letters:[{character:"ക",romanized:"ka",ipa:"/k/",mnemonic:"The seatbelt — you already know this one!",tonguePosition:'Back of tongue touches soft palate. NO puff of air. Like K in "skip".',teachingNote:"Our old friend! Plain, unaspirated K. The leader of the velar family. Remember: 'skip' not 'kite'.",strokeHints:["Start from the top","Draw the main curve left","Cross over with bottom hook right"],difficulty:2,audioType:"consonant"},{character:"ഖ",romanized:"kha",ipa:"/kʰ/",mnemonic:"ക's bigger sibling — more elaborate shape",tonguePosition:'Same position as ക, but WITH a puff of air. Like K in "kite".',teachingNote:"Same tongue position as ക, but now ADD a puff of air! Put your hand in front of your mouth — you should feel the air. THIS is like the K in 'kite'.",strokeHints:["More complex version of ക","Draw the main body","Add the additional strokes"],difficulty:3,audioType:"consonant"},{character:"ഗ",romanized:"ga",ipa:"/ɡ/",mnemonic:"A different curve — the voiced version",tonguePosition:'Same position as ക, but vocal cords vibrate. Like G in "go". No puff of air.',teachingNote:"Put your hand on your throat — you should feel vibration! That's what 'voiced' means. Same tongue position as ക, but your vocal cords are buzzing. Like G in 'go'.",strokeHints:["Start from the top left","Draw the main body","Finish with the tail"],difficulty:3,audioType:"consonant"},{character:"ഘ",romanized:"gha",ipa:"/ɡʰ/",mnemonic:"ഗ's aspirated version — voiced AND breathy",tonguePosition:'Same as ഗ but with a puff of air. Voiced AND aspirated. Like saying "g" with extra breath.',teachingNote:"This is the hardest one — voiced AND aspirated. Your vocal cords vibrate AND you push out air. It's like a breathy G. Don't worry if this is hard at first — even native speakers sometimes struggle with this distinction!",strokeHints:["Draw the complex shape","This letter has more strokes","Practice slowly"],difficulty:4,audioType:"consonant"},{character:"ങ",romanized:"nga",ipa:"/ŋ/",mnemonic:"The nasal of the family — a unique shape",tonguePosition:'Back of tongue touches soft palate, air flows through nose. Like "ng" in "sing".',teachingNote:"The nasal! Say 'sing' and hold the 'ng' at the end — that's this sound! It never starts a word in English, but it can in Malayalam. The shape is unique and beautiful.",strokeHints:["Start from the top","Draw the distinctive shape","This is a unique character"],difficulty:3,audioType:"consonant"}]},{id:"varga-palatal",phase:8,title:"Varga System — The Palatals",malayalamTitle:"ചവർഗ്ഗം",subtitle:"Cha-varga: Middle tongue meets hard palate",description:"The palatal group uses the middle of your tongue against the hard palate — the hard part of the roof of your mouth, just behind the ridge.",narrationIntro:"Excellent progress! Now let's move forward in the mouth to the palatal group. These sounds are made with the MIDDLE of your tongue rising up to touch the hard palate. The first one, ച, you already know! Same pattern: plain, aspirated, voiced, voiced-aspirated, and nasal.",color:"text-orange-600",bgGradient:"from-orange-500 to-amber-600",icon:"Grid3X3",letters:[{character:"ച",romanized:"cha",ipa:"/t͡ʃ/",mnemonic:"The swan — you know this one!",tonguePosition:'Middle tongue touches hard palate. Like "ch" in "church" without the puff.',teachingNote:"Our swan from Phase 6! Plain, unaspirated 'ch'. The leader of the palatal family.",strokeHints:["Start with upper loop","Draw down and curve right","Complete the bottom"],difficulty:2,audioType:"consonant"},{character:"ഛ",romanized:"chha",ipa:"/t͡ʃʰ/",mnemonic:"ച with extra breath — the aspirated ver
1068sion",tonguePosition:'Same as ച but WITH a puff of air. Like "ch" in "church" with emphasis.',teachingNote:"Add that puff of air to ച! This is the aspirated version. Feel the air on your hand.",strokeHints:["More elaborate than ച","Draw the main shape","Add aspiration indicator strokes"],difficulty:3,audioType:"consonant"},{character:"ജ",romanized:"ja",ipa:"/d͡ʒ/",mnemonic:"A distinctive curve — the voiced palatal",tonguePosition:'Same position as ച, vocal cords vibrate. Like J in "jump".',teachingNote:"The voiced version — like J in 'jump'. Feel your throat vibrate! No puff of air.",strokeHints:["Start from the top","Draw the main curve","Complete with the tail"],difficulty:2,audioType:"consonant"},{character:"ഝ",romanized:"jha",ipa:"/d͡ʒʰ/",mnemonic:"ജ with aspiration — voiced and breathy",tonguePosition:"Same as ജ but with a puff of air. Voiced AND aspirated J.",teachingNote:"Voiced and aspirated — the hardest combination. Vibrating throat plus air puff. Take your time with this one.",strokeHints:["Complex shape","Draw carefully","Practice the strokes slowly"],difficulty:4,audioType:"consonant"},{character:"ഞ",romanized:"nya",ipa:"/ɲ/",mnemonic:"A unique nasal shape — the palatal nasal",tonguePosition:'Middle tongue touches hard palate, air through nose. Like "ny" in "canyon" or Spanish "ñ".',teachingNote:"Think of the 'ny' sound in 'canyon' or the Spanish 'ñ' in 'señor'. Your tongue is in the same palatal position but the air goes through your nose!",strokeHints:["Start from the top","Draw the unique shape","This character is distinctive"],difficulty:3,audioType:"consonant"}]},{id:"varga-retroflex",phase:9,title:"Varga System — The Retroflexes",malayalamTitle:"ടവർഗ്ഗം",subtitle:"Ta-varga: Tongue curls back to the roof",description:"Retroflex sounds are the signature of Indian languages! Your tongue curls BACK and touches the roof of your mouth. These sounds don't exist in English, so they need special attention.",narrationIntro:"Now we come to the sounds that make Indian languages special — the retroflexes! These don't exist in English at all. The trick is to curl your tongue BACKWARD so the underside of your tongue tip touches the roof of your mouth. It feels strange at first, but with practice it becomes natural. These sounds give Malayalam its distinctive character. Let's learn them!",color:"text-yellow-600",bgGradient:"from-yellow-500 to-amber-600",icon:"Grid3X3",letters:[{character:"ട",romanized:"tta",ipa:"/ʈ/",mnemonic:"An umbrella with a handle — angular shape",tonguePosition:"Curl tongue tip BACKWARD to touch the roof of mouth. Then snap it forward. No puff of air.",teachingNote:"Curl your tongue back! The tip should touch the hard part of the roof of your mouth, further back than for ത. Then snap it forward. No air puff. This sound is unique to Indian languages!",strokeHints:["Start from the top","Draw the angular shape","Add the bottom curve"],difficulty:3,audioType:"consonant"},{character:"ഠ",romanized:"ttha",ipa:"/ʈʰ/",mnemonic:"ട with aspiration — the breathy retroflex",tonguePosition:"Same as ട but WITH a puff of air.",teachingNote:"Same curled tongue position as ട, but now add the puff of air. Curl back, snap forward, push air out.",strokeHints:["More elaborate than ട","Draw the main shape","Add the extra strokes"],difficulty:4,audioType:"consonant"},{character:"ഡ",romanized:"dda",ipa:"/ɖ/",mnemonic:"The voiced retroflex — feel the vibration",tonguePosition:"Same position as ട, vocal cords vibrate. Like a deeper, curled-tongue D.",teachingNote:"Same curled position, but now your vocal cords vibrate. It's like a D sound but with the tongue curled back. Feel your throat buzz!",strokeHints:["Start from the top","Draw the distinctive shape","Complete the character"],difficulty:3,audioType:"consonant"},{character:"ഢ",romanized:"ddha",ipa:"/ɖʰ/",mnemonic:"The full package — voiced, aspirated, retroflex",tonguePosition:"Same as ഡ but with a puff of air. The most complex combination.",teachingNote:"Voiced, aspirated, AND retroflex — the triple challenge! Don't worry if this takes time. Even in natural speech, these distinctions can be subtle.",strokeHints:["Complex character","Draw slowly and carefully","Practice the shape repeatedly"],difficulty:5,audioType:"consonant"},{character:"ണ",romanized:"nna",ipa:"/ɳ/",mnemonic:"Triple hump — the retroflex nasal",tonguePosition:"Tongue curls back to roof of mouth, air through nose. A deeper, richer N sound.",teachingNote:"The retroflex nasal! Curl your tongue back and let the air flow through your nose. It's a richer, deeper N than the dental ന. The shape has three humps — like ന got an extra bump!",strokeHints:["Start from the left","Draw three connected humps","Finish with the tail"],difficulty:3,audioType:"consonant"}]},{id:"special-sounds",phase:10,title:"The Special Ones",malayalamTitle:"പ്രത്യേക ശ
1068ബ്ദങ്ങൾ",subtitle:"Sounds that make Malayalam unique",description:"These are the sounds that give Malayalam its distinctive identity. The retroflex ഴ exists ONLY in Malayalam and Tamil. The hard റ is another treasure. Master these and you'll sound truly authentic!",narrationIntro:"We've saved the best for last! These are the sounds that make Malayalam UNIQUE among world languages. The letter ഴ — called 'zha' — exists only in Malayalam and Tamil. No other language in the world has this exact sound! It's the pride of Malayalam. And then there's റ — the hard R — and ള — the retroflex L. These sounds are what make Malayalam sound like Malayalam. Let me teach you each one with love and care.",color:"text-indigo-600",bgGradient:"from-indigo-500 to-purple-600",icon:"Crown",letters:[{character:"ഴ",romanized:"zha",ipa:"/ɻ/",mnemonic:"The crown jewel of Malayalam — a unique, flowing curve",tonguePosition:"Curl tongue far back, let it vibrate slightly as it moves forward. A retroflex approximant — completely unique!",teachingNote:"This is THE sound of Malayalam! It exists in NO other language except Tamil. Curl your tongue way back and let it glide forward while vibrating slightly. It's between an R and an L but neither. When you can say this sound, you've truly entered the world of Malayalam. Take your time — this is worth mastering!",strokeHints:["Start from the top","Draw the complex flowing curve","This is a unique character — take your time"],difficulty:5,audioType:"consonant",exampleWord:"മഴ",exampleMeaning:"rain",exampleRomanized:"mazha"},{character:"റ",romanized:"rra",ipa:"/r/",mnemonic:"The elephant trunk — curling above like ര but stronger",tonguePosition:"Tongue tip hits the alveolar ridge firmly — a hard, tapped R. Much stronger than ര.",teachingNote:"This is the HARD R — your tongue hits the roof of your mouth with force. It's like ര but much stronger and more definite. Think of it as the difference between a gentle tap and a firm knock.",strokeHints:["Similar to ര but with different curve","Draw the elephant trunk shape","Finish with the distinctive tail"],difficulty:4,audioType:"consonant",exampleWord:"പറ",exampleMeaning:"to say/tell",exampleRomanized:"para (with hard R)"},{character:"ള",romanized:"lla",ipa:"/ɭ/",mnemonic:"ല with a curl underneath — the retroflex L",tonguePosition:"Tongue curls back toward hard palate for an L sound. Deeper and richer than ല.",teachingNote:"This is the retroflex L — curl your tongue back like for the retroflex consonants, but make an L sound. It's deeper and richer than the dental ല. The shape is like ല but with an extra curl underneath.",strokeHints:["Similar to ല","Add the distinctive curl underneath","The curl shows it is retroflex"],difficulty:4,audioType:"consonant",exampleWord:"വള",exampleMeaning:"bangle",exampleRomanized:"vala (with retroflex L)"},{character:"ശ",romanized:"sha",ipa:"/ɕ/",mnemonic:"A curled shell — the palatal sibilant",tonguePosition:'Middle tongue near hard palate, air hisses through. Like "sh" in "shoe".',teachingNote:"The palatal 'sh' — like in 'shoe'. Your tongue is in the palatal position and air hisses through. This is the most common 'sh' sound in Malayalam.",strokeHints:["Start from the top","Draw the curled shell shape","Finish with the bottom stroke"],difficulty:3,audioType:"consonant"},{character:"സ",romanized:"sa",ipa:"/s/",mnemonic:"The snake curve — a flowing S shape",tonguePosition:'Tongue tip near upper teeth, air hisses through. Like S in "sun".',teachingNote:"Simple S sound — same as English! The shape flows like a snake. One of the easier sounds for English speakers.",strokeHints:["Start from the top","Draw the flowing S-like curve","Finish with the tail"],difficulty:2,audioType:"consonant"},{character:"ഹ",romanized:"ha",ipa:"/h/",mnemonic:"Two columns joined at top — like a gateway",tonguePosition:'Open throat, push air out. Same as English H in "hello".',teachingNote:"Just like English H! Open your throat and push air out. The shape looks like a gateway with two columns. Easy sound, elegant letter.",strokeHints:["Start from the left column","Draw across the top","Complete the right column"],difficulty:2,audioType:"consonant"}]}],yy=({text:e,label:t="Uncle B's Narration",voiceStyle:r="teaching",autoPlay:n=!1,compact:s=!1,className:i=""})=>{const[o,l]=y.useState(!1),[c,u]=y.useState(!1),[h,d]=y.useState(!1),[f,m]=y.useState(null),[g,p]=y.useState(0),[v,x]=y.useState(!1),b=y.useRef(null),w=y.useRef(null),j=y.useRef(null),_=y.useRef(null),S=y.useRef(!1),k=y.useRef(0);y.useEffect(()=>()=>{_.current&&clearInterval(_.current),b.current&&(b.current.pause(),b.current=null),w.current&&(URL.revokeObjectURL(w.current),w.current=null),"speechSynthesis"in window&&window.speechSynthesis.cancel()},[]),y.useEffect(()=>{if("speechSynthesis"in window){window.speechSynthesis.getVoices();const L=()=>window.speechSynthesis.getVoices();return window.speechSynthesis.addEventListener("voiceschanged",L),()=>window.speechSynthesis.removeEventListener("voiceschanged",L)}},[]);const P=y.useCallback(()=>{b.current&&(b.current.pause(),b.current.removeAttribute("src"),b.current=null),w.current&&(URL.revokeObjectURL(w.current),w.current=null),_.current&&clearInterval(_.current)},[]),C=y.useCallback(async()=>{try{console.log("[Uncle B] Calling ElevenLabs TTS edge function...");const{data:{session:L}}=await ne.auth.getSession(),W=await fetch(`${tr}/functions/v1/uncle-b-narration`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${(L==null?void 0:L.access_token)||C2}`},body:JSON.stringify({text:e,voiceStyle:r})});if(!W.ok){const K=await W.json().catch(()=>({error:"Unknown error"}));return console.error("[Uncle B] Edge function error:",K),!1}if((W.headers.get("content-type")||"").includes("application/json")){const K=await W.json();return console.error("[Uncle B] Got JSON instead of audio:",K),!1}const U=await W.blob();if(U.size<100)return console.error("[Uncle B] Audio blob too small:",U.size),!1;P();const R=URL.createObjectURL(U);w.current=R;const Q=new Audio(R);return b.current=Q,new Promise(K=>{Q.oncanplaythrough=()=>{console.log("[Uncle B] Audio ready to play")},Q.onplay=()=>{l(!1),u(!0),d(!1),x(!1);const z=Q.duration||0;if(z>0&&isFinite(z))_.current&&clearInterval(_.current),_.current=setInterval(()=>{Q.currentTime&&Q.duration&&p(Q.currentTime/Q.duration*100)},200);else{const T=e.split(/\s+/).length/150*60*1e3;k.current=Date.now(),_.current&&clearInterval(_.current),_.current=setInterval(()=>{const $=Date.now()-k.current;p(Math.min($/T*100,98))},200)}},Q.onended=()=>{u(!1),d(!1),p(100),_.current&&clearInterval(_.current),K(!0)},Q.onerror=z=>{console.error("[Uncle B] Audio playback error:",z),_.current&&clearInterval(_.current),K(!1)},Q.play().then(()=>{console.log("[Uncle B] ElevenLabs audio playing")}).catch(z=>{console.error("[Uncle B] Play failed:",z),K(!1)})})}catch(L){return console.error("[Uncle B] ElevenLabs fetch error:",L),!1}},[e,r,P]),M=y.useCallback(()=>
1068{if(!("speechSynthesis"in window)){m("Speech synthesis not supported in this browser"),l(!1);return}window.speechSynthesis.cancel(),x(!0);const L=new SpeechSynthesisUtterance(e),W=window.speechSynthesis.getVoices(),D=W.filter(K=>K.lang.startsWith("en")&&(K.name.includes("Google")||K.name.includes("Daniel")||K.name.includes("Samantha")||K.name.includes("Microsoft")||K.name.includes("Natural")));if(D.length>0)L.voice=D[0];else{const K=W.find(z=>z.lang.startsWith("en"));K&&(L.voice=K)}L.rate=r==="gentle"?.85:.92,L.pitch=r==="gentle"?.95:1,L.volume=1;const Q=e.split(/\s+/).length/(r==="gentle"?110:130)*60*1e3;L.onstart=()=>{l(!1),u(!0),d(!1),k.current=Date.now(),_.current&&clearInterval(_.current),_.current=setInterval(()=>{const K=Date.now()-k.current;p(Math.min(K/Q*100,98))},200)},L.onend=()=>{u(!1),d(!1),p(100),_.current&&clearInterval(_.current)},L.onerror=K=>{K.error==="canceled"||K.error==="interrupted"||(l(!1),u(!1),m(`Speech error: ${K.error}`),_.current&&clearInterval(_.current))},L.onboundary=K=>{const z=Math.min(K.charIndex/e.length*100,98);p(z)},j.current=L,window.speechSynthesis.speak(L)},[e,r]),I=y.useCallback(async()=>{if(o)return;l(!0),m(null),p(0),await C()||(console.log("[Uncle B] ElevenLabs failed, falling back to browser TTS"),M())},[o,C,M]);y.useEffect(()=>{if(n&&!S.current){S.current=!0;const L=setTimeout(()=>I(),500);return()=>clearTimeout(L)}},[n,I]);const E=()=>{v?h?(window.speechSynthesis.resume(),d(!1),u(!0)):(window.speechSynthesis.pause(),d(!0),u(!1),_.current&&clearInterval(_.current)):b.current&&(h?(b.current.play(),d(!1),u(!0)):(b.current.pause(),d(!0),u(!1),_.current&&clearInterval(_.current)))},B=()=>{A(),setTimeout(()=>I(),100)},A=()=>{v&&window.speechSynthesis.cancel(),P(),j.current=null,u(!1),d(!1),p(0)};return s?a.jsxs("div",{className:`inline-flex items-center gap-2 ${i}`,children:[o?a.jsxs(Y,{size:"sm",disabled:!0,className:"gap-1.5",children:[a.jsx(Fe,{className:"h-3.5 w-3.5 animate-spin"}),"Loading..."]}):c||h?a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx(Y,{size:"sm",variant:"outline",onClick:E,className:"gap-1",children:h?a.jsx(Bt,{className:"h-3.5 w-3.5"}):a.jsx(ss,{className:"h-3.5 w-3.5"})}),a.jsx(Y,{size:"sm",variant:"ghost",onClick:A,children:a.jsx(xd,{className:"h-3.5 w-3.5"})})]}):a.jsxs(Y,{size:"sm",onClick:I,className:"gap-1.5 bg-gradient-to-r from-amber-500 to-orange-500 hover:from-amber-600 hover:to-orange-600 text-white",children:[a.jsx(Xe,{className:"h-3.5 w-3.5"}),"Listen"]}),f&&a.jsx("span",{className:"text-xs text-red-500",children:f})]}):a.jsx("div",{className:`rounded-xl border-2 border-amber-200 bg-gradient-to-r from-amber-50 to-orange-50 p-4 ${i}`,children:a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"flex-shrink-0 w-12 h-12 rounded-full bg-gradient-to-br from-amber-400 to-orange-500 flex items-center justify-center shadow-lg",children:a.jsx("span",{className:"text-white text-lg font-bold",children:"B"})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[a.jsx("span",{className:"text-sm font-bold text-amber-900",children:t}),v&&(c||h)&&a.jsx("span",{className:"text-[10px] bg-amber-200 text-amber-800 px-1.5 py-0.5 rounded-full font-medium",children:"Browser Voice"}),!v&&(c||h)&&a.jsx("span",{className:"text-[10px] bg-green-200 text-green-800 px-1.5 py-0.5 rounded-full font-medium",children:"Uncle B Voice"}),(c||h)&&a.jsx("div",{className:"flex items-center gap-0.5",children:[1,2,3,4].map(L=>a.jsx("div",{className:`w-1 rounded-full bg-amber-500 transition-all ${c?"animate-pulse":""}`,style:{height:c?`${8+Math.random()*12}px`:"4px",animationDelay:`${L*100}ms`}},L))})]}),(c||h||g>0)&&a.jsx("div",{className:"w-full h-1.5 bg-amber-200 rounded-full overflow-hidden",children:a.jsx("div",{className:"h-full bg-gradient-to-r from-amber-500 to-orange-500 rounded-full transition-all duration-200",style:{width:`${g}%`}})}),f&&a.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[a.jsx("p",{className:"text-xs text-red-600",children:f}),a.jsx("button",{onClick:()=>{m(null),I()},className:"text-xs text-amber-700 underline hover:text-amber-900 font-medium",children:"Retry"})]})]}),a.jsx("div",{className:"flex items-center gap-1.5",children:o?a.jsxs(Y,{size:"sm",disabled:!0,className:"gap-1.5",children:[a.jsx(Fe,{className:"h-4 w-4 animate-spin"}),a.jsx("span",{className:"hidden sm:inline",children:"Generating..."})]}):c||h?a.jsxs(a.Fragment,{children:[a.jsx(Y,{size:"sm",variant:"outline",onClick:E,className:"border-amber-300",children:h?a.jsx(Bt,{className:"h-4 w-4"}):a.jsx(ss,{className:"h-4 w-4"})}),a.jsx(Y,{size:"sm",variant:"outline",onClick:B,className:"border-amber-300",children:a.jsx(Gn,{className:"h-4 w-4"})}),a.jsx(Y,{size:"sm",variant:"ghost",onClick:A,children:a.jsx(xd,{className:"h-4 w-4"})})]}):a.jsxs(Y,{size:"sm",onClick:I,className:"gap-1.5 bg-gradient-to-r from-amber-500 to-orange-500 hover:from-amber-600 hover:to-orange-600 text-white shadow-md",children:[a.jsx(Xe,{className:"h-4 w-4"}),a.jsx("span",{className:"hidden sm:inline",children:"Listen to Uncle B"}),a.jsx("span",{className:"sm:hidden",children:"Play"})]})})]})})},SR={Smile:a.jsx(WK,{className:"h-5 w-5"}),Lightbulb:a.jsx(ec,{className:"h-5 w-5"}),Music:a.jsx(vd,{className:"h-5 w-5"}),VolumeX:a.jsx(xd,{className:"h-5 w-5"}),Wand2:a.jsx(YK,{className:"h-5 w-5"}),Users:a.jsx(Xn,{className:"h-5 w-5"}),Grid3X3:a.jsx(TK,{className:"h-5 w-5"}),Crown:a.jsx(kK,{className:"h-5 w-5"})},SLe=["#1e1e1e","#7C3AED","#2563EB","#DC2626","#059669","#D97706"],NLe=({startPhaseIndex:e})=>{var te;const[t,r]=y.useState(0),[n,s]=y.useState(0),[i,o]=y.useState(new Set),[l,c]=y.useState("overview"),u=J.useRef(!1);y.useEffect(()=>{e!==void 0&&e>=0&&e<Sl.length&&!u.current&&(u.current=!0,r(e),s(0),c("phase"))},[e]);const[h,d]=y.useState(!0),[f,m]=y.useState([.25]),[g,p]=y.useState([4]),[v,x]=y.useState("#1e1e1e"),[b,w]=y.useState(!1),[j,_]=y.useState([]),[S,k]=y.useState(null),P=y.useRef(null),C=y.useRef(null),M=y.useRef(null),I=320,E=Sl[t],B=(te=E.letters)==null?void 0:te[n];y.useEffect(()=>{const X=localStorage.getItem("uncle-b-completed-phases");if(X)try{o(new Set(JSON.parse(X)))}catch{}},[]);const A=X=>{o(ee=>{const ie=new Set(ee);return ie.add(X),localStorage.setItem("uncle-b-completed-phases",JSON.stringify([...ie])),ie})},L=y.useCallback(()=>{const X=C.current;if(!X||!B)return;const ee=X.getContext("2d");ee&&(ee.clearRect(0,0,I,I),h&&(ee.strokeStyle="#E5E7EB",ee.lineWidth=.5,ee.setLineDash([5,5]),ee.beginPath(),ee.moveTo(I/2,0),ee.lineTo(I/2,I),ee.moveTo(0,I/2),ee.lineTo(I,I/2),ee.stroke(),ee.setLineDash([]),ee.globalAlpha=f[0],ee.font=`bold ${I*.65}px 'Noto Sans Malayalam', serif`,ee.textAlign="center",ee.textBaseline="middle",ee.fillStyle="#9CA3AF",ee.fillText(B.character,I/2,I/2),ee.globalAlpha=1,ee.strokeStyle="#D1D5DB",ee.lineWidth=2,ee.strokeRect(1,1,I-2,I-2)))},[B,h,f]);y.useEffect(()=>{L()},[L]);const W=X=>{const ee=P.current;if(!ee)return{x:0,y:0};const ie=ee.getBoundingClientRect(),oe=ee.width/ie.width,we=ee.height/ie.height;if("touches"in X){const O=X.touches[0];return{x:(O.clientX-ie.left)*oe,y:(O.clientY-ie.top)*we}}return{x:(X.clientX-ie.left)*oe,y:(X.clientY-ie.top)*we}},D=X=>{var oe;X.preventDefault(),w(!0);const ee=W(X);M.current=ee;const ie=(oe=P.current)==null?void 0:oe.getContext("2d");ie&&(ie.beginPath(),ie.arc(ee.x,ee.y,g[0]/2,0,Math.PI*2),ie.fillStyle=v,ie.fill())},U=X=>{var oe;if(X.preventDefault(),!b)return;const ee=(oe=P.current)==null?void 0:oe.getContext("2d");if(!ee||!M.current)return;const ie=W(X);ee.beginPath(),ee.moveTo(M.current.x,M.current.y),ee.lineTo(ie.x,ie.y),ee.strokeStyle=v,ee.lineWidth=g[0],ee.lineCap="round",ee.lineJoin="round",ee.stroke(),M.current=ie},R=()=>{var X;if(b){w(!1),M.current=null;const ee=(X=P.current)==null?void 0:X.getContext("2d");if(ee){const ie=ee.getImageData(0,0,I,I);_(oe=>[...oe,ie])}}},Q=()=>{var ee;const X=(ee=P.current)==null?void 0:ee.getContext("2d");X&&(X.clearRect(0,0,I,I),_([]))},K=()=>{var ie;if(j.length===0)return;const X=(ie=P.current)==null?void 0:ie.getContext("2d");if(!X)return;const ee=j.slice(0,-1);_(ee),X.clearRect(0,0,I,I),ee.length>0&&X.putImageData(ee[ee.length-1],0,0)},z=async X=>{k(X);try{await Fr(X,{volume:.9})}catch(ee){console.warn("Audio playback failed:",ee)}setTimeout(()=>k(null),1e3)},N=X=>
1068{s(X),Q()},T=X=>{r(X),s(0),c("phase"),Q()},$=()=>a.jsxs("div",{className:"space-y-8",children:[a.jsxs("div",{className:"text-center",children:[a.jsxs("div",{className:"inline-flex items-center gap-2 px-4 py-1.5 bg-amber-100 text-amber-800 rounded-full text-sm font-medium mb-3",children:[a.jsx(Vs,{className:"h-4 w-4"}),"Classroom Experience"]}),a.jsx("h1",{className:"text-3xl md:text-4xl font-bold text-gray-900 mb-2",children:"Uncle B's Writing Lab"}),a.jsx("p",{className:"text-lg text-gray-500 max-w-2xl mx-auto font-malayalam",children:"എഴുത്ത് ലാബ്"}),a.jsx("p",{className:"text-gray-500 max-w-3xl mx-auto mt-2",children:"Learn Malayalam writing the way Uncle B teaches in his classroom — starting with the easiest letters, building up to concepts like the inherent vowel, chandrakkala, and the varga system. Each phase includes AI-narrated teaching by Uncle B himself."})]}),a.jsxs("div",{className:"flex items-center justify-center gap-6 flex-wrap",children:[a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"text-3xl font-bold text-amber-600",children:i.size}),a.jsx("div",{className:"text-xs text-gray-500",children:"Phases Done"})]}),a.jsx("div",{className:"w-px h-10 bg-gray-200"}),a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"text-3xl font-bold text-blue-600",children:Sl.length}),a.jsx("div",{className:"text-xs text-gray-500",children:"Total Phases"})]}),a.jsx("div",{className:"w-px h-10 bg-gray-200"}),a.jsxs("div",{className:"text-center",children:[a.jsxs("div",{className:"text-3xl font-bold text-emerald-600",children:[Math.round(i.size/Sl.length*100),"%"]}),a.jsx("div",{className:"text-xs text-gray-500",children:"Complete"})]})]}),a.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:Sl.map((X,ee)=>{const ie=i.has(X.id);return a.jsxs(se,{className:`group cursor-pointer border-2 transition-all hover:shadow-xl ${ie?"border-green-200 bg-green-50/50":"border-gray-100 hover:border-amber-200"} `,onClick:()=>T(ee),children:[a.jsx("div",{className:`h-1.5 bg-gradient-to-r ${X.bgGradient}`}),a.jsx(ue,{className:"p-5",children:a.jsxs("div",{className:"flex items-start gap-4",children:[a.jsx("div",{className:`flex-shrink-0 w-12 h-12 rounded-xl bg-gradient-to-br ${X.bgGradient} text-white flex items-center justify-center shadow-lg group-hover:scale-110 transition-transform`,children:ie?a.jsx(ot,{className:"h-6 w-6"}):SR[X.icon]||a.jsx(wa,{className:"h-5 w-5"})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[a.jsxs(ke,{variant:"outline",className:"text-[10px]",children:["Phase ",X.phase]}),X.isConceptPhase&&a.jsx(ke,{className:"bg-amber-100 text-amber-800 text-[10px]",children:"Concept"}),ie&&a.jsx(ke,{className:"bg-green-100 text-green-800 text-[10px]",children:"Complete"})]}),a.jsx("h3",{className:"font-bold text-gray-800 text-lg",children:X.title}),a.jsx("p",{className:"text-xs text-gray-400 font-malayalam",children:X.malayalamTitle}),a.jsx("p",{className:"text-sm text-gray-500 mt-1",children:X.subtitle}),X.letters&&a.jsxs("div",{className:"flex gap-1.5 mt-3 flex-wrap",children:[X.letters.slice(0,8).map((oe,we)=>a.jsx("span",{className:"w-8 h-8 rounded-lg bg-white border border-gray-200 flex items-center justify-center text-sm font-bold text-gray-700 font-malayalam",children:oe.character},we)),X.letters.length>8&&a.jsxs("span",{className:"w-8 h-8 rounded-lg bg-gray-100 flex items-center justify-center text-xs text-gray-400",children:["+",X.letters.length-8]})]})]}),a.jsx(rn,{className:"h-5 w-5 text-gray-300 group-hover:text-amber-500 group-hover:translate-x-1 transition-all flex-shrink-0 mt-2"})]})})]},X.id)})})]}),V=()=>{const X=E.concept;return X?a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsxs(Y,{variant:"ghost",size:"sm",onClick:()=>c("overview"),children:[a.jsx(Ll,{className:"h-4 w-4 mr-1"})," All Phases"]}),a.jsxs(ke,{variant:"outline",children:["Phase ",E.phase]}),a.jsx(ke,{className:"bg-amber-100 text-amber-800",children:"Concept Lesson"})]}),a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:`inline-flex items-center justify-center w-16 h-16 rounded-2xl bg-gradient-to-br ${E.bgGradient} text-white shadow-lg mb-4`,children:SR[E.icon]||a.jsx(ec,{className:"h-7 w-7"})}),a.jsx("h2",{className:"text-2xl md:text-3xl font-bold text-gray-900",children:E.title}),a.jsx("p",{className:"text-gray-400 font-malayalam mt-1",children:E.malayalamTitle}),a.jsx("p",{className:"text-gray-500 mt-2 max-w-2xl mx-auto",children:E.description})]}),a.jsx(yy,{text:E.narrationIntro,label:"Uncle B explains this concept"}),a.jsxs(se,{className:"border-2 border-amber-200 bg-gradient-to-br from-amber-50 to-orange-50",children:[a.jsx(_e,{children:a.jsxs(Se,{className:"text-xl flex items-center gap-2",children:[a.jsx(nl,{className:"h-5 w-5 text-amber-600"}),X.title,a.jsx("span",{className:"text-sm font-normal text-gray-400 font-malayalam ml-2",children:X.malayalamTitle})]})}),a.jsxs(ue,{className:"space-y-4",children:[a.jsx(yy,{text:X.narration,label:"Detailed explanation",voiceStyle:"gentle",compact:!0}),a.jsx("div",{className:"grid gap-4 sm:grid-cols-2",children:X.examples.map((ee,ie)=>a.jsxs("div",{className:"bg-white rounded-xl p-4 border border-amber-200 shadow-sm",children:[a.jsxs("div",{className:"flex items-center justify-between mb-3",children:[a.jsxs("div",{className:"text-center flex-1",children:[a.jsx("div",{className:"text-3xl font-bold text-gray-800 font-malayalam",children:ee.before}),a.jsx("div",{className:"text-xs text-gray-500 mt-1",children:ee.beforePronunciation})]}),a.jsx(rn,{className:"h-5 w-5 text-amber-500 mx-2 flex-shrink-0"}),a.jsxs("div",{className:"text-center flex-1",children:[a.jsx("div",{className:"text-3xl font-bold text-amber-700 font-malayalam",children:ee.after}),a.jsx("div",{className:"text-xs text-amber-600 mt-1",children:ee.afterPronunciation})]})]}),a.jsx("p",{className:"text-sm text-gray-600 bg-amber-50 rounded-lg p-2 text-center",children:ee.explanation})]},ie))}),a.jsx("div",{className:"bg-gradient-to-r from-amber-500 to-orange-500 rounded-xl p-4 text-white",children:a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx(ec,{className:"h-6 w-6 flex-shrink-0 mt-0.5"}),a.jsxs("div",{children:[a.jsx("p",{className:"font-bold text-sm mb-1",children:"Key Takeaway"}),a.jsx("p",{className:"text-sm text-amber-100",children:X.keyTakeaway})]})]})})]})]}),a.jsxs("div",{className:"flex items-center justify-between gap-4",children:[a.jsxs(Y,{variant:"outline",onClick:()=>{t>0&&T(t-1)},disabled:t===0,children:[a.jsx(Ll,{className:"h-4 w-4 mr-1"})," Previous Phase"]}),a.jsxs(Y,{onClick:()=>{A(E.id),t<Sl.length-1?T(t+1):c("overview")},className:`bg-gradient-to-r ${E.bgGradient} text-white shadow-lg`,children:[i.has(E.id)?"Next Phase":"Mark Complete & Continue",a.jsx(rn,{className:"h-4 w-4 ml-1"})]})]})]}):null},q=()=>!B||!E.letters?null:a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[a.jsxs(Y,{variant:"ghost",size:"sm",onClick:()=>c("overview"),children:[a.jsx(Ll,{className:"h-4 w-4 mr-1"})," All Phases"]}),a.jsxs(ke,{variant:"outline",children:["Phase ",E.phase]}),a.jsxs("span",{className:"text-sm text-gray-500",children:["Letter ",n+1," of ",E.letters.length]})]}),a.jsxs("div",{className:"text-center",children:[a.jsx("h2",{className:"text-xl md:text-2xl font-bold text-gray-900",children:E.title}),a.jsx("p",{className:"text-gray-400 font-malayalam text-sm",children:E.malayalamTitle})]}),a.jsx(yy,{text:E.narrationIntro,label:`Phase ${E.phase} Introduction`}),a.jsx("div",{className:"flex flex-wrap gap-2 justify-center",children:E.letters.map((X,ee)=>a.jsx("button",{onClick:()=>N(ee),className:`w-11 h-11 rounded-xl text-lg font-bold transition-all font-malayalam ${ee===n?`bg-gradient-to-br ${E.bgGradient} text-white shadow-lg scale-110`:"bg-white border-2 border-gray-200 hover:border-amber-300 text-gray-700"}`,children:X.character},X.character+ee))}),a.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6",children:[a.jsxs("div",{className:"lg:col-span-2 space-y-4",children:[a.jsx(se,{className:"border-2 border-amber-100 bg-amber-50/50",children:a.jsx(ue,{className:"p-4",children:a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx("div",{className:"flex-shrink-0 w-10 h-10 rounded-full bg-gradient-to-br from-amber-400 to-orange-500 flex items-center justify-center shadow",children:a.jsx("span",{className:"text-white font-bold text-sm",children:"B"})}),a.jsxs("div",{className:"flex-1",children:[a.jsx("p",{className:"text-sm font-semibold text-amber-900 mb
1068-1",children:"Uncle B says:"}),a.jsx("p",{className:"text-sm text-gray-700 leading-relaxed",children:B.teachingNote}),a.jsx(yy,{text:B.teachingNote,compact:!0,className:"mt-2"})]})]})})}),a.jsxs(se,{className:"border-2 border-blue-100",children:[a.jsx(_e,{className:"pb-2",children:a.jsxs("div",{className:"flex items-center justify-between flex-wrap gap-2",children:[a.jsxs(Se,{className:"text-lg flex items-center gap-2",children:[a.jsx(Vs,{className:"h-5 w-5 text-blue-600"}),"Practice: ",B.character,a.jsxs("span",{className:"text-sm font-normal text-gray-400",children:["(",B.romanized,")"]})]}),a.jsxs("div",{className:"flex gap-1.5",children:[a.jsxs(Y,{size:"sm",variant:"outline",onClick:()=>d(!h),className:"gap-1",children:[h?a.jsx(Ws,{className:"h-3.5 w-3.5"}):a.jsx(fa,{className:"h-3.5 w-3.5"}),"Guide"]}),a.jsxs(Y,{size:"sm",variant:"outline",onClick:K,disabled:j.length===0,className:"gap-1",children:[a.jsx(Gn,{className:"h-3.5 w-3.5"})," Undo"]}),a.jsxs(Y,{size:"sm",variant:"outline",onClick:Q,className:"gap-1",children:[a.jsx(ah,{className:"h-3.5 w-3.5"})," Clear"]})]})]})}),a.jsxs(ue,{children:[a.jsxs("div",{className:"relative mx-auto bg-white rounded-xl overflow-hidden shadow-inner border",style:{width:I,height:I,maxWidth:"100%",touchAction:"none"},children:[a.jsx("canvas",{ref:C,width:I,height:I,className:"absolute inset-0 pointer-events-none",style:{width:"100%",height:"100%"}}),a.jsx("canvas",{ref:P,width:I,height:I,className:"absolute inset-0 cursor-crosshair",style:{width:"100%",height:"100%"},onMouseDown:D,onMouseMove:U,onMouseUp:R,onMouseLeave:R,onTouchStart:D,onTouchMove:U,onTouchEnd:R})]}),a.jsxs("div",{className:"mt-4 grid grid-cols-1 sm:grid-cols-2 gap-4",children:[a.jsxs("div",{children:[a.jsxs("label",{className:"text-xs font-medium text-gray-500 mb-1 block",children:["Brush: ",g[0],"px"]}),a.jsx(Za,{value:g,onValueChange:p,min:1,max:12,step:1})]}),a.jsxs("div",{children:[a.jsxs("label",{className:"text-xs font-medium text-gray-500 mb-1 block",children:["Guide: ",Math.round(f[0]*100),"%"]}),a.jsx(Za,{value:f,onValueChange:m,min:.05,max:.5,step:.05})]})]}),a.jsxs("div",{className:"mt-3 flex items-center gap-2",children:[a.jsx(_v,{className:"h-4 w-4 text-gray-400"}),a.jsx("div",{className:"flex gap-1.5",children:SLe.map(X=>a.jsx("button",{onClick:()=>x(X),className:`w-7 h-7 rounded-full border-2 transition-all ${v===X?"border-gray-800 scale-110 shadow":"border-gray-300"}`,style:{backgroundColor:X}},X))})]})]})]})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsx(se,{className:"border-2 border-indigo-100",children:a.jsxs(ue,{className:"pt-6 pb-4",children:[a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"text-8xl font-bold text-indigo-700 font-malayalam mb-2",children:B.character}),a.jsx("div",{className:"text-lg font-semibold text-gray-700",children:B.romanized}),a.jsxs("div",{className:"text-xs text-gray-400 mt-1",children:["IPA: ",B.ipa]}),a.jsxs(Y,{size:"sm",className:"mt-3 gap-1.5",variant:"outline",onClick:()=>z(B.character),children:[a.jsx(Xe,{className:`h-4 w-4 ${S===B.character?"animate-pulse text-blue-600":""}`}),"Hear Sound"]})]}),a.jsxs("div",{className:"flex items-center justify-center gap-1 mt-3",children:[a.jsx("span",{className:"text-xs text-gray-400 mr-1",children:"Difficulty:"}),[1,2,3,4,5].map(X=>a.jsx("div",{className:`w-3 h-3 rounded-full ${X<=B.difficulty?"bg-amber-400":"bg-gray-200"}`},X))]})]})}),a.jsx(se,{className:"bg-gradient-to-br from-purple-50 to-indigo-50 border-purple-200",children:a.jsxs(ue,{className:"pt-4 pb-4",children:[a.jsxs("h4",{className:"text-sm font-bold text-purple-800 mb-1 flex items-center gap-1.5",children:[a.jsx(ec,{className:"h-4 w-4"})," Shape Memory"]}),a.jsx("p",{className:"text-sm text-gray-700",children:B.mnemonic})]})}),a.jsx(se,{className:"bg-gradient-to-br from-rose-50 to-pink-50 border-rose-200",children:a.jsxs(ue,{className:"pt-4 pb-4",children:[a.jsxs("h4",{className:"text-sm font-bold text-rose-800 mb-1 flex items-center gap-1.5",children:[a.jsx(cc,{className:"h-4 w-4"})," Tongue Position"]}),a.jsx("p",{className:"text-sm text-gray-700",children:B.tonguePosition})]})}),a.jsx(se,{children:a.jsxs(ue,{className:"pt-4 pb-4",children:[a.jsx("h4",{className:"text-sm font-bold text-gray-700 mb-2",children:"Stroke Guide"}),a.jsx("div",{className:"space-y-1.5",children:B.strokeHints.map((X,ee)=>a.jsxs("div",{className:"flex items-start gap-2 text-sm",children:[a.jsx("span",{className:"flex-shrink-0 w-5 h-5 rounded-full bg-blue-100 text-blue-700 flex items-center justify-center text-xs font-bold",children:ee+1}),a.jsx("span",{className:"text-gray-600",children:X})]},ee))})]})}),B.exampleWord&&a.jsx(se,{className:"bg-gradient-to-br from-emerald-50 to-green-50 border-emerald-200",children:a.jsxs(ue,{className:"pt-4 pb-4",children:[a.jsx("h4",{className:"text-sm font-bold text-emerald-800 mb
1068-2",children:"Example Word"}),a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"text-3xl font-bold text-emerald-700 font-malayalam",children:B.exampleWord}),a.jsx("div",{className:"text-sm text-gray-600 mt-1",children:B.exampleRomanized}),a.jsxs("div",{className:"text-sm font-medium text-emerald-600",children:['"',B.exampleMeaning,'"']}),a.jsxs(Y,{size:"sm",variant:"outline",className:"mt-2 gap-1",onClick:()=>z(B.exampleWord),children:[a.jsx(Xe,{className:"h-3.5 w-3.5"})," Hear Word"]})]})]})}),a.jsxs("div",{className:"flex gap-2",children:[a.jsxs(Y,{variant:"outline",className:"flex-1",onClick:()=>N(Math.max(0,n-1)),disabled:n===0,children:[a.jsx(N0,{className:"h-4 w-4 mr-1"})," Prev"]}),a.jsxs(Y,{variant:"outline",className:"flex-1",onClick:()=>{n<E.letters.length-1&&N(n+1)},disabled:n>=E.letters.length-1,children:["Next ",a.jsx(ns,{className:"h-4 w-4 ml-1"})]})]})]})]}),a.jsxs("div",{className:"flex items-center justify-between gap-4 pt-4 border-t",children:[a.jsxs(Y,{variant:"outline",onClick:()=>{t>0&&T(t-1)},disabled:t===0,children:[a.jsx(Ll,{className:"h-4 w-4 mr-1"})," Previous Phase"]}),a.jsxs(Y,{onClick:()=>{A(E.id),t<Sl.length-1?T(t+1):c("overview")},className:`bg-gradient-to-r ${E.bgGradient} text-white shadow-lg`,children:[i.has(E.id)?"Next Phase":"Complete & Continue",a.jsx(rn,{className:"h-4 w-4 ml-1"})]})]})]});return l==="overview"?$():E.isConceptPhase?V():q()}
1068,kLe=()=>{const[e]=DL(),t=e.get("phase");return a.jsxs("div",{className:"min-h-screen bg-gray-50",children:[a.jsx(hs,{}),a.jsx("div",{className:"max-w-7xl mx-auto px-4 py-6",children:a.jsx(NLe,{startPhaseIndex:t?parseInt(t)-1:void 0})})]})},ht=400,CLe=["#7C3AED","#2563EB","#DC2626","#059669","#D97706","#1e1e1e"],vy=["#7C3AED","#2563EB","#DC2626","#059669","#D97706","#EC4899"],ELe=({character:e,onComplete:t})=>{const[r,n]=y.useState(!1),[s,i]=y.useState(0),[o,l]=y.useState(0),[c,u]=y.useState([1]),[h,d]=y.useState(!0),[f,m]=y.useState(!0),[g,p]=y.useState(!1),[v,x]=y.useState(!1),[b,w]=y.useState("#7C3AED"),[j,_]=y.useState([4]),[S,k]=y.useState(!0),[P,C]=y.useState([.2]),[M,I]=y.useState([]),[E,B]=y.useState("guide"),A=y.useRef(null),L=y.useRef(null),W=y.useRef(0),D=y.useRef(null),U=y.useRef(0),R=(O,F,Z,H,G,re)=>{O.save(),O.translate(F,Z),O.rotate(H),O.beginPath(),O.moveTo(0,0),O.lineTo(-G,-G/2),O.lineTo(-G*.7,0),O.lineTo(-G,G/2),O.closePath(),O.fillStyle=re,O.fill(),O.restore()},Q=(O,F)=>Math.atan2(F.y-O.y,F.x-O.x),K=(O,F)=>{if(O.length<2)return O[0];const Z=O.length-1,H=Math.min(Math.floor(F*Z),Z-1),G=F*Z-H,re=O[H],le=O[H+1];return{x:re.x+(le.x-re.x)*G,y:re.y+(le.y-re.y)*G}},z=y.useCallback(()=>{const O=A.current;if(!O)return;const F=O.getContext("2d");F&&(F.clearRect(0,0,ht,ht),F.strokeStyle="#F3F4F6",F.lineWidth=.5,F.setLineDash([4,4]),F.beginPath(),F.moveTo(ht/2,20),F.lineTo(ht/2,ht-20),F.moveTo(20,ht/2),F.lineTo(ht-20,ht/2),F.stroke(),F.setLineDash([]),S&&(F.globalAlpha=P[0],F.font=`bold ${ht*.65}px 'Noto Sans Malayalam', serif`,F.textAlign="center",F.textBaseline="middle",F.fillStyle="#D1D5DB",F.fillText(e.character,ht/2,ht/2+10),F.globalAlpha=1),e.strokes.forEach((Z,H)=>{const G=H===s,re=H<s,le=H>s,ce=vy[H%vy.length];if(!h&&!G&&!re)return;let ae=1,me=3;le?(ae=.25,me=2):re&&!g?(ae=.5,me=2.5):G&&(me=3.5),F.globalAlpha=ae;const xe=Z.path;if(xe.length<2)return;let pe=xe;if(G&&r&&o<1){const be=Math.max(2,Math.ceil(xe.length*o));if(pe=xe.slice(0,be),o>0&&o<1){const We=K(xe,o);pe=[...pe.slice(0,-1),We]}}F.beginPath(),F.moveTo(pe[0].x,pe[0].y);for(let be=1;be<pe.length;be++)if(be<pe.length-1){const We=(pe[be].x+pe[be+1].x)/2,Ve=(pe[be].y+pe[be+1].y)/2;F.quadraticCurveTo(pe[be].x,pe[be].y,We,Ve)}else F.lineTo(pe[be].x,pe[be].y);if(F.strokeStyle=ce,F.lineWidth=me,F.lineCap="round",F.lineJoin="round",F.stroke(),!r||re||G&&g){const be=Math.max(2,Math.floor(xe.length/2));for(let We=1;We<=be;We++){const Ve=We/(be+1),br=K(xe,Ve),ra=K(xe,Math.max(0,Ve-.05)),mn=Q(ra,br);R(F,br.x,br.y,mn,10,ce)}}if(F.beginPath(),F.arc(xe[0].x,xe[0].y,G?8:6,0,Math.PI*2),F.fillStyle=re?"#10B981":ce,F.fill(),F.strokeStyle="white",F.lineWidth=2,F.stroke(),xe.length>=2){const be=pe[pe.length-1],We=pe[pe.length-2],Ve=Q(We,be);R(F,be.x,be.y,Ve,G?14:10,ce)}if(f&&(F.fillStyle="white",F.font="bold 11px sans-serif",F.textAlign="center",F.textBaseline="middle",F.fillText(String(Z.id),xe[0].x,xe[0].y)),G&&r&&o>0&&o<1){const be=K(xe,o);F.beginPath(),F.arc(be.x,be.y,12,0,Math.PI*2),F.fillStyle=ce+"30",F.fill(),F.beginPath(),F.arc(be.x,be.y,6,0,Math.PI*2),F.fillStyle=ce,F.fill(),F.strokeStyle="white",F.lineWidth=2,F.stroke()}F.globalAlpha=1}),F.strokeStyle="#E5E7EB",F.lineWidth=2,F.strokeRect(1,1,ht-2,ht-2))},[e,s,o,r,h,f,S,P,g]);y.useEffect(()=>{if(!r)return;const O=F=>{U.current||(U.current=F);const Z=F-U.current;U.current=F;const H=c[0],G=Z/1e3*H*.5;l(re=>{const le=re+G;return le>=1?s<e.strokes.length-1?(i(ce=>ce+1),0):(n(!1),p(!0),1):le}),W.current=requestAnimationFrame(O)};return W.current=requestAnimationFrame(O),()=>{W.current&&cancelAnimationFrame(W.current)}},[r,c,s,e.strokes.length]),y.useEffect(()=>{z()},[z]),y.useEffect(()=>{i(0),l(0),n(!1),p(!1),ie(),U.current=0},[e]);const N=()=>{g?(i(0),l(0),p(!1),U.current=0,n(!0)):(U.current=0,n(!r))},T=()=>{n(!1),i(0),l(0),p(!1),U.current=0},$=()=>{n(!1),s<e.strokes.length-1?(i(O=>O+1),l(0)):(l(1),p(!0))},V=()=>{n(!1),p(!1),s>0&&i(O=>O-1),l(0)},q=O=>{const F=L.current;if(!F)return{x:0,y:0};const Z=F.getBoundingClientRect(),H=F.width/Z.width,G=F.height/Z.height;if("touches"in O){const re=O.touches[0];return{x:(re.clientX-Z.left)*H,y:(re.clientY-Z.top)*G}}return{x:(O.clientX-Z.left)*H,y:(O.clientY-Z.top)*G}},te=O=>{var H;if(E!=="practice")return;O.preventDefault(),x(!0);const F=q(O);D.current=F;const Z=(H=L.current)==null?void 0:H.getContext("2d");Z&&(Z.beginPath(),Z.arc(F.x,F.y,j[0]/2,0,Math.PI*2),Z.fillStyle=b,Z.fill())},X=O=>{var H;if(!v||E!=="practice")return;O.preventDefault();const F=(H=L.current)==null?void 0:H.getContext("2d");if(!F||!D.current)return;const Z=q(O);F.beginPath(),F.moveTo(D.current.x,D.current.y),F.lineTo(Z.x,Z.y),F.strokeStyle=b,F.lineWidth=j[0],F.lineCap="round",F.lineJoin="round",F.stroke(),D.current=Z},ee=()=>{var O;if(v){x(!1),D.current=null;const F=(O=L.current)==null?void 0:O.getContext("2d");if(F){const Z=F.getImageData(0,0,ht,ht);I(H=>[...H,Z])}}},ie=()=>{var F;const O=(F=L.current)==null?void 0:F.getContext("2d");O&&(O.clearRect(0,0,ht,ht),I([]))},oe=()=>{var Z;if(M.length===0)return;
1068const O=(Z=L.current)==null?void 0:Z.getContext("2d");if(!O)return;const F=M.slice(0,-1);I(F),O.clearRect(0,0,ht,ht),F.length>0&&O.putImageData(F[F.length-1],0,0)},we=()=>{const O=document.createElement("canvas");O.width=ht,O.height=ht;const F=O.getContext("2d");if(!F)return;F.fillStyle="white",F.fillRect(0,0,ht,ht),A.current&&F.drawImage(A.current,0,0),L.current&&F.drawImage(L.current,0,0);const Z=document.createElement("a");Z.download=`neela-mozhi-${e.character}.png`,Z.href=O.toDataURL(),Z.click()};return a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center gap-2 bg-gray-100 rounded-xl p-1 w-fit",children:[a.jsxs("button",{onClick:()=>B("guide"),className:`px-4 py-2 rounded-lg text-sm font-semibold transition-all ${E==="guide"?"bg-white text-purple-700 shadow-md":"text-gray-500 hover:text-gray-700"}`,children:[a.jsx(Bt,{className:"h-4 w-4 inline mr-1.5"}),"Stroke Guide"]}),a.jsxs("button",{onClick:()=>B("practice"),className:`px-4 py-2 rounded-lg text-sm font-semibold transition-all ${E==="practice"?"bg-white text-purple-700 shadow-md":"text-gray-500 hover:text-gray-700"}`,children:[a.jsx(_v,{className:"h-4 w-4 inline mr-1.5"}),"Practice"]})]}),a.jsxs("div",{className:"relative mx-auto bg-white rounded-2xl overflow-hidden shadow-inner border-2 border-gray-200",style:{width:ht,height:ht,maxWidth:"100%",touchAction:"none"},children:[a.jsx("canvas",{ref:A,width:ht,height:ht,className:"absolute inset-0",style:{width:"100%",height:"100%",pointerEvents:"none"}}),a.jsx("canvas",{ref:L,width:ht,height:ht,className:`absolute inset-0 ${E==="practice"?"cursor-crosshair":"pointer-events-none"}`,style:{width:"100%",height:"100%"},onMouseDown:te,onMouseMove:X,onMouseUp:ee,onMouseLeave:ee,onTouchStart:te,onTouchMove:X,onTouchEnd:ee})]}),E==="guide"?a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"flex items-center gap-2 justify-center",children:[a.jsx(Y,{size:"sm",variant:"outline",onClick:T,title:"Reset",children:a.jsx(Gn,{className:"h-4 w-4"})}),a.jsx(Y,{size:"sm",variant:"outline",onClick:V,title:"Previous stroke",children:a.jsx(LK,{className:"h-4 w-4"})}),a.jsx(Y,{size:"sm",onClick:N,className:`px-6 ${r?"bg-amber-500 hover:bg-amber-600":"bg-purple-600 hover:bg-purple-700"} text-white`,children:r?a.jsxs(a.Fragment,{children:[a.jsx(ss,{className:"h-4 w-4 mr-1.5"})," Pause"]}):g?a.jsxs(a.Fragment,{children:[a.jsx(Gn,{className:"h-4 w-4 mr-1.5"})," Replay"]}):a.jsxs(a.Fragment,{children:[a.jsx(Bt,{className:"h-4 w-4 mr-1.5"})," Animate"]})}),a.jsx(Y,{size:"sm",variant:"outline",onClick:$,title:"Next stroke",children:a.jsx(UK,{className:"h-4 w-4"})})]}),a.jsx("div",{className:"flex items-center gap-2 justify-center",children:e.strokes.map((O,F)=>a.jsxs("button",{onClick:()=>{n(!1),i(F),l(0),p(!1)},className:`flex items-center gap-1.5 px-3 py-1.5 rounded-full text-xs font-semibold transition-all border ${F===s?"bg-purple-100 border-purple-300 text-purple-700 shadow-sm scale-105":F<s?"bg-green-50 border-green-200 text-green-600":"bg-gray-50 border-gray-200 text-gray-400"}`,children:[a.jsx("span",{className:"w-4 h-4 rounded-full flex items-center justify-center text-[10px] text-white",style:{backgroundColor:vy[F%vy.length]},children:F<s?a.jsx("svg",{className:"w-2.5 h-2.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:3,d:"M5 13l4 4L19 7"})}):O.id}),a.jsx("span",{className:"hidden sm:inline",children:O.label})]},O.id))}),a.jsxs("div",{className:"flex items-center gap-3 max-w-xs mx-auto",children:[a.jsx("span",{className:"text-xs text-gray-400 w-12",children:"Speed"}),a.jsx(Za,{value:c,onValueChange:u,min:.2,max:3,step:.1,className:"flex-1"}),a.jsxs("span",{className:"text-xs font-mono text-gray-500 w-10",children:[c[0].toFixed(1),"x"]})]}),a.jsxs("div",{className:"flex items-center gap-3 justify-center flex-wrap",children:[a.jsxs(Y,{size:"sm",variant:"outline",onClick:()=>k(!S),className:"gap-1.5 text-xs",children:[S?a.jsx(Ws,{className:"h-3.5 w-3.5"}):a.jsx(fa,{className:"h-3.5 w-3.5"}),"Character Guide"]}),a.jsxs(Y,{size:"sm",variant:"outline",onClick:()=>d(!h),className:"gap-1.5 text-xs",children:[h?a.jsx(Ws,{className:"h-3.5 w-3.5"}):a.jsx(fa,{className:"h-3.5 w-3.5"}),"All Strokes"]}),a.jsxs(Y,{size:"sm",variant:"outline",onClick:()=>m(!f),className:"gap-1.5 text-xs",children:[f?"Hide":"Show"," Numbers"]})]}),a.jsxs("div",{className:"flex items-center gap-3 max-w-xs mx-auto",children:[a.jsx("span",{className:"text-xs text-gray-400 w-16",children:"Opacity"}
1068),a.jsx(Za,{value:P,onValueChange:C,min:.05,max:.5,step:.05,className:"flex-1"}),a.jsxs("span",{className:"text-xs font-mono text-gray-500 w-10",children:[Math.round(P[0]*100),"%"]})]})]}):a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"flex items-center gap-2 justify-center",children:[a.jsxs(Y,{size:"sm",variant:"outline",onClick:oe,disabled:M.length===0,children:[a.jsx(Gn,{className:"h-4 w-4 mr-1"})," Undo"]}),a.jsxs(Y,{size:"sm",variant:"outline",onClick:ie,children:[a.jsx(ah,{className:"h-4 w-4 mr-1"})," Clear"]}),a.jsxs(Y,{size:"sm",variant:"outline",onClick:we,children:[a.jsx(as,{className:"h-4 w-4 mr-1"})," Save"]}),a.jsxs(Y,{size:"sm",variant:"outline",onClick:()=>k(!S),children:[S?a.jsx(Ws,{className:"h-3.5 w-3.5 mr-1"}):a.jsx(fa,{className:"h-3.5 w-3.5 mr-1"}),"Guide"]})]}),a.jsxs("div",{className:"flex items-center gap-3 max-w-sm mx-auto",children:[a.jsx("span",{className:"text-xs text-gray-400 w-10",children:"Size"}),a.jsx(Za,{value:j,onValueChange:_,min:1,max:12,step:1,className:"flex-1"}),a.jsxs("span",{className:"text-xs font-mono text-gray-500 w-8",children:[j[0],"px"]})]}),a.jsxs("div",{className:"flex items-center gap-2 justify-center",children:[a.jsx(_v,{className:"h-4 w-4 text-gray-400"}),CLe.map(O=>a.jsx("button",{onClick:()=>w(O),className:`w-7 h-7 rounded-full border-2 transition-all ${b===O?"border-gray-800 scale-110 shadow-md":"border-gray-300 hover:scale-105"}`,style:{backgroundColor:O}},O))]}),a.jsxs("div",{className:"flex items-center gap-3 max-w-xs mx-auto",children:[a.jsx("span",{className:"text-xs text-gray-400 w-16",children:"Opacity"}),a.jsx(Za,{value:P,onValueChange:C,min:.05,max:.5,step:.05,className:"flex-1"}),a.jsxs("span",{className:"text-xs font-mono text-gray-500 w-10",children:[Math.round(P[0]*100),"%"]})]})]})]})},Rl=[{character:"അ",romanization:"a",name:"A (ചെറിയ)",nameEn:"A (short)",category:"vowel",difficulty:2,strokes:[{id:1,label:"Top curve (left to right)",path:[{x:120,y:140},{x:140,y:100},{x:180,y:80},{x:220,y:90},{x:240,y:120}]},{id:2,label:"Main loop (clockwise)",path:[{x:240,y:120},{x:260,y:160},{x:240,y:200},{x:200,y:220},{x:160,y:210},{x:140,y:180},{x:150,y:150}]},{id:3,label:"Tail stroke (down-right)",path:[{x:150,y:150},{x:170,y:200},{x:200,y:260},{x:240,y:300}]}],tips:["Start from the top-left curve","The main body is a clockwise loop","End with a flowing tail to the bottom-right"]},{character:"ആ",romanization:"aa",name:"ആ (നീണ്ട)",nameEn:"Aa (long)",category:"vowel",difficulty:3,strokes:[{id:1,label:"Top curve",path:[{x:100,y:140},{x:120,y:100},{x:160,y:80},{x:200,y:90},{x:220,y:120}]},{id:2,label:"Main loop",path:[{x:220,y:120},{x:240,y:160},{x:220,y:200},{x:180,y:220},{x:140,y:210},{x:120,y:180},{x:130,y:150}]},{id:3,label:"Tail stroke",path:[{x:130,y:150},{x:150,y:200},{x:180,y:260},{x:210,y:300}]},{id:4,label:"Vertical extension",path:[{x:270,y:80},{x:270,y:140},{x:270,y:200},{x:270,y:280}]}],tips:["Draw അ first","Add a vertical line on the right side","The vertical line extends from top to bottom"]},{character:"ഇ",romanization:"i",name:"ഇ (ചെറിയ)",nameEn:"I (short)",category:"vowel",difficulty:2,strokes:[{id:1,label:"Top loop",path:[{x:160,y:100},{x:200,y:80},{x:240,y:100},{x:240,y:140},{x:200,y:150}]},{id:2,label:"Downward curve",path:[{x:200,y:150},{x:180,y:180},{x:160,y:220},{x:170,y:260},{x:200,y:280}]}],tips:["Start with a small loop at the top","Flow downward with a gentle curve","End with a slight rightward hook"]}
1068,{character:"ഈ",romanization:"ii",name:"ഈ (നീണ്ട)",nameEn:"Ii (long)",category:"vowel",difficulty:3,strokes:[{id:1,label:"Top loop",path:[{x:140,y:100},{x:180,y:80},{x:220,y:100},{x:220,y:140},{x:180,y:150}]},{id:2,label:"Downward curve",path:[{x:180,y:150},{x:160,y:180},{x:140,y:220},{x:150,y:260},{x:180,y:280}]},{id:3,label:"Extension mark",path:[{x:180,y:280},{x:220,y:270},{x:260,y:280},{x:280,y:300}]}],tips:["Similar to ഇ but with an extension","The tail curves right and down"]},{character:"ഉ",romanization:"u",name:"ഉ (ചെറിയ)",nameEn:"U (short)",category:"vowel",difficulty:2,strokes:[{id:1,label:"Upper curve",path:[{x:140,y:120},{x:180,y:90},{x:220,y:100},{x:240,y:140}]},{id:2,label:"Lower loop",path:[{x:240,y:140},{x:230,y:190},{x:190,y:220},{x:160,y:200},{x:160,y:260},{x:190,y:290}]}],tips:["Start with a gentle curve from left","Create a loop in the middle","End with a downward extension"]},{character:"എ",romanization:"e",name:"എ (ചെറിയ)",nameEn:"E (short)",category:"vowel",difficulty:2,strokes:[{id:1,label:"Main curve",path:[{x:140,y:100},{x:180,y:80},{x:220,y:100},{x:240,y:140},{x:220,y:180}]},{id:2,label:"Lower part",path:[{x:220,y:180},{x:180,y:200},{x:160,y:240},{x:180,y:280},{x:220,y:290}]}],tips:["Starts with a rightward curve at the top","Loops back and flows downward"]},{character:"ഒ",romanization:"o",name:"ഒ (ചെറിയ)",nameEn:"O (short)",category:"vowel",difficulty:2,strokes:[{id:1,label:"Outer loop",path:[{x:200,y:90},{x:250,y:120},{x:260,y:180},{x:230,y:230},{x:180,y:240},{x:140,y:210},{x:130,y:160},{x:150,y:110},{x:200,y:90}]},{id:2,label:"Tail",path:[{x:200,y:240},{x:220,y:270},{x:240,y:300}]}],tips:["Draw a large oval shape","Add a short tail at the bottom"]},{character:"ക",romanization:"ka",name:"ക",nameEn:"Ka (velar)",category:"consonant",difficulty:2,strokes:[{id:1,label:"Top curve (left to right)",path:[{x:120,y:150},{x:150,y:100},{x:200,y:80},{x:250,y:100},{x:270,y:140}]},{id:2,label:"Body loop (clockwise)",path:[{x:270,y:140},{x:280,y:190},{x:250,y:230},{x:200,y:240},{x:160,y:220},{x:150,y:180}]},{id:3,label:"Bottom hook (right)",path:[{x:150,y:180},{x:170,y:250},{x:210,y:300},{x:260,y:320}]}],tips:["Start from the left, curve up and right","Form a rounded body","End with a hook curving to the right"]},{character:"ഗ",romanization:"ga",name:"ഗ",nameEn:"Ga (velar)",category:"consonant",difficulty:3,strokes:[{id:1,label:"Top curve",path:[{x:130,y:140},{x:160,y:95},{x:210,y:80},{x:250,y:100}]},{id:2,label:"Main body",path:[{x:250,y:100},{x:270,y:150},{x:250,y:200},{x:200,y:220},{x:160,y:200}]},{id:3,label:"Tail",path:[{x:160,y:200},{x:150,y:250},{x:170,y:290},{x:210,y:310}]}],tips:["Similar structure to ക but with different curves","The body is more angular","Tail extends downward then right"]},{character:"ച",romanization:"cha",name:"ച",nameEn:"Cha (palatal)",category:"consonant",difficulty:2,strokes:[{id:1,label:"Upper loop",path:[{x:130,y:130},{x:160,y:90},{x:210,y:80},{x:240,y:110},{x:230,y:150}]},{id:2,label:"Down curve and hook",path:[{x:230,y:150},{x:200,y:180},{x:180,y:220},{x:190,y:270},{x:230,y:300},{x:270,y:310}]}],tips:["Start with a loop curving right","Flow down and curve right at the bottom"]},{character:"ട",romanization:"tta",name:"ട",nameEn:"Tta (retroflex)",category:"consonant",difficulty:3,strokes:[{id:1,label:"Top angular stroke",path:[{x:120,y:120},{x:170,y:90},{x:220,y:80},{x:260,y:100},{x:270,y:140}]},{id:2,label:"Body and tail",path:[{x:270,y:140},{x:260,y:190},{x:220,y:220},{x:180,y:210},{x:170,y:250},{x:190,y:300}]}],tips:["Start with a wider top curve","The body has an angular quality","Tail drops then curves right"]},{character:"ത",romanization:"tha",name:"ത",nameEn:"Tha (dental)",category:"consonant",difficulty:2,strokes:[{id:1,label:"Top loop",path:[{x:150,y:130},{x:180,y:90},{x:230,y:80},{x:260,y:110},{x:250,y:150}]},{id:2,label:"Vertical line down",path:[{x:200,y:150},{x:195,y:200},{x:190,y:260},{x:190,y:310}]},{id:3,label:"Bottom hook",path:[{x:190,y:310},{x:210,y:320},{x:240,y:310},{x:260,y:290}]}],tips:["Start with a small loop at top","Draw a vertical line down","Add a small hook at the bottom-right"]},{character:"ന",romanization:"na",name:"ന",nameEn:"Na (dental)",category:"consonant",difficulty:2,strokes:[{id:1,label:"Top curve",path:[{x:130,y:140},{x:170,y:95},{x:220,y:85},{x:260,y:110}]},{id:2,label:"Main body curve",path:[{x:260,y:110},{x:270,y:160},{x:240,y:200},{x:190,y:210}]},{id:3,label:"Bottom stroke",path:[{x:190,y:210},{x:170,y:250},{x:180,y:290},{x:210,y:310}]}],tips:["Start from left, sweep right","Curve the body back left","End with a downward tail"]},{character:"പ",romanization:"pa",name:"പ",nameEn:"Pa (labial)",category:"consonant",difficulty:1,strokes:[{id:1,label:"Round body (clockwise)",path:[{x:200,y:90},{x:250,y:100},{x:280,y:150},{x:270,y:210},{x:230,y:240},{x:180,y:240},{x:140,y:210},{x:130,y:160},{x:150,y:110},{x:200,y:90}]},{id:2,label:"Tail (downward)",path:[{x:200,y:240},{x:210,y:280},{x:230,y:310},{x:260,y:320}]}],tips:["Draw a round shape (like an egg)","Add a short tail at the bottom-right","One of the simplest c
1068onsonants"]},{character:"മ",romanization:"ma",name:"മ",nameEn:"Ma (labial)",category:"consonant",difficulty:2,strokes:[{id:1,label:"Upper curve",path:[{x:130,y:150},{x:160,y:100},{x:210,y:85},{x:255,y:110}]},{id:2,label:"Body and loop",path:[{x:255,y:110},{x:275,y:160},{x:255,y:210},{x:210,y:230},{x:170,y:215}]},{id:3,label:"Hook and tail",path:[{x:170,y:215},{x:160,y:260},{x:180,y:300},{x:220,y:320}]}],tips:["Start with a wide upper curve","The body loops back","End with a flowing tail"]},{character:"യ",romanization:"ya",name:"യ",nameEn:"Ya",category:"consonant",difficulty:2,strokes:[{id:1,label:"Top curve",path:[{x:140,y:130},{x:180,y:90},{x:230,y:85},{x:260,y:110}]},{id:2,label:"Descending body",path:[{x:260,y:110},{x:250,y:170},{x:210,y:210},{x:170,y:220},{x:160,y:270},{x:190,y:310}]}],tips:["Start with a curve to the right","Flow down with a gentle S-shape"]},{character:"ര",romanization:"ra",name:"ര",nameEn:"Ra",category:"consonant",difficulty:2,strokes:[{id:1,label:"Main curve",path:[{x:150,y:110},{x:200,y:85},{x:250,y:100},{x:265,y:150}]},{id:2,label:"Loop and tail",path:[{x:265,y:150},{x:250,y:200},{x:200,y:220},{x:170,y:200},{x:170,y:260},{x:200,y:300}]}],tips:["Start from the left with a curve","Create a loop in the middle","End with a downward tail"]},{character:"ല",romanization:"la",name:"ല",nameEn:"La",category:"consonant",difficulty:2,strokes:[{id:1,label:"Top loop",path:[{x:150,y:120},{x:190,y:85},{x:240,y:90},{x:260,y:130}]},{id:2,label:"Body curve",path:[{x:260,y:130},{x:255,y:180},{x:220,y:210},{x:180,y:200}]},{id:3,label:"Tail",path:[{x:180,y:200},{x:165,y:250},{x:180,y:290},{x:220,y:310}]}],tips:["Start with a loop at the top","Curve the body back","Finish with a tail stroke"]},{character:"വ",romanization:"va",name:"വ",nameEn:"Va",category:"consonant",difficulty:2,strokes:[{id:1,label:"Top curve",path:[{x:140,y:130},{x:180,y:90},{x:230,y:85},{x:260,y:115}]},{id:2,label:"Down and loop",path:[{x:260,y:115},{x:265,y:170},{x:235,y:210},{x:190,y:215},{x:165,y:190}]},{id:3,label:"Tail stroke",path:[{x:165,y:190},{x:155,y:240},{x:170,y:290},{x:210,y:315}]}],tips:["Start from the left","Create a loop in the body","End with a downward tail"]},{character:"ശ",romanization:"sha",name:"ശ",nameEn:"Sha",category:"consonant",difficulty:3,strokes:[{id:1,label:"Top curve",path:[{x:130,y:140},{x:170,y:95},{x:220,y:80},{x:260,y:100}]},{id:2,label:"Body curves",path:[{x:260,y:100},{x:275,y:150},{x:250,y:195},{x:200,y:210},{x:160,y:195}]},{id:3,label:"Bottom stroke",path:[{x:160,y:195},{x:150,y:240},{x:165,y:280},{x:200,y:310},{x:250,y:320}]}],tips:["Start from the left with a wide curve","The body has two curves","End with a flowing bottom stroke"]},{character:"ഹ",romanization:"ha",name:"ഹ",nameEn:"Ha",category:"consonant",difficulty:3,strokes:[{id:1,label:"Top loop",path:[{x:150,y:120},{x:190,y:85},{x:240,y:90},{x:265,y:125}]},{id:2,label:"Main body",path:[{x:265,y:125},{x:270,y:175},{x:245,y:215},{x:200,y:225},{x:160,y:210}]},{id:3,label:"Connecting tail",path:[{x:160,y:210},{x:145,y:255},{x:160,y:295},{x:200,y:315}]}],tips:["Start with a loop at the top","Draw the main body with curves","Connect with a tail at the bottom"]},{character:"ഴ",romanization:"zha",name:"ഴ",nameEn:"Zha (unique)",category:"consonant",difficulty:5,strokes:[{id:1,label:"Top curve",path:[{x:120,y:140},{x:160,y:95},{x:210,y:80},{x:255,y:100}]},{id:2,label:"Complex body",path:[{x:255,y:100},{x:275,y:145},{x:260,y:190},{x:220,y:210},{x:180,y:200},{x:160,y:170}]},{id:3,label:"Inner loop",path:[{x:160,y:170},{x:175,y:200},{x:200,y:230},{x:220,y:260}]},{id:4,label:"Tail",path:[{x:220,y:260},{x:200,y:290},{x:210,y:320},{x:250,y:330}]}],tips:["This is one of the most unique Malayalam characters","Take your time with the complex curves","The ഴ sound is unique to Malayalam and Tamil"]},{character:"ള",romanization:"lla",name:"ള",nameEn:"Lla (retroflex)",category:"consonant",difficulty:3,strokes:[{id:1,label:"Top curve",path:[{x:140,y:130},{x:185,y:90},{x:235,y:85},{x:265,y:115}]},{id:2,label:"Body loop",path:[{x:265,y:115},{x:275,y:165},{x:250,y:210},{x:200,y:225},{x:160,y:205}]},{id:3,label:"Tail with hook",path:[{x:160,y:205},{x:145,y:250},{x:155,y:290},{x:190,y:310},{x:230,y:315}]}],tips:["Start with a wide top curve","The body loops back","End with a tail that hooks right"]},{character:"റ",romanization:"rra",name:"റ",nameEn:"Rra (alveolar)",category:"consonant",difficulty:2,strokes:[{id:1,label:"Main oval",path:[{x:200,y:100},{x:250,y:110},{x:275,y:160},{x:265,y:220},{x:225,y:250},{x:175,y:250},{x:140,y:220},{x:130,y:165},{x:150,y:115},{x:200,y:100}]},{id:2,label:"Inner dot/mark",path:[{x:190,y:160},{x:200,y:155},{x:210,y:160},{x:205,y:170},{x:195,y:170},{x:190,y:160}]}],tips:["Draw an oval shape","Add a small mark inside","This is a uniquely Malayalam character"]},{character:"ണ",romanization:"nna",name:"ണ",nameEn:"Nna (retroflex)",category:"consonant",difficulty:3,strokes:[{id:1,label:"Top curve",path:[{x:130,y:135},{x:175,y:90},{x:225,y:85},{x:260,y:110}]},{id:2,label:"Body",path:[{x:260,y:110},{x:275,y:160},{x:255,y:210},{x:210,y:230},{x:170,y:215}]},{id:3,label:"Tail",path:[{x:170,y:215},{x:155,y:260},{x:170,y:300},{x:210,y:320}]}],tips:["Similar to ന but with retroflex quality","The curves are slightly different","Practice distinguishing from ന"]},{character:"ക്ക",romanization:"kka",name:"ക്ക",nameEn:"Kka (double)",category:"conjunct",difficulty:4,strokes:[{id:1,label:"First ക top",path:[{x:100,y:130},{x:130,y:90},{x:170,y:80},{x:200,y:100}]},{id:2,label:"First ക body",path:[{x:200,y:100},{x:215,y:140},{x:200,y:180},{x:170,y:190}]},{id:3,label:"Connecting stroke",path:[{x:170,y:190},{x:190,y:210},{x:220,y:200},{x:250,y:190}]},{id:4,label:"Second ക body",path:[{x:250,y:190},{x:270,y:230},{x:250,y:270},{x:210,y:280},{x:190,y:310}]}],tips:["This is a conjunct of two ക characters","Draw the first ക smaller at the top","Connect to the second ക below"]}
1068,{character:"ന്ന",romanization:"nna",name:"ന്ന",nameEn:"Nna (conjunct)",category:"conjunct",difficulty:4,strokes:[{id:1,label:"First ന top",path:[{x:110,y:120},{x:150,y:85},{x:200,y:80},{x:230,y:105}]},{id:2,label:"First ന body",path:[{x:230,y:105},{x:240,y:145},{x:215,y:175},{x:180,y:180}]},{id:3,label:"Connecting and second ന",path:[{x:180,y:180},{x:165,y:210},{x:180,y:240},{x:210,y:250},{x:240,y:240}]},{id:4,label:"Tail",path:[{x:240,y:240},{x:250,y:270},{x:235,y:300},{x:200,y:320}]}],tips:["Conjunct of two ന characters","The first ന sits on top","They connect through a flowing stroke"]},{character:"മ്മ",romanization:"mma",name:"മ്മ",nameEn:"Mma (conjunct)",category:"conjunct",difficulty:4,strokes:[{id:1,label:"First മ curve",path:[{x:110,y:130},{x:150,y:90},{x:200,y:80},{x:235,y:105}]},{id:2,label:"First മ body",path:[{x:235,y:105},{x:250,y:145},{x:230,y:180},{x:190,y:190}]},{id:3,label:"Connection and second മ",path:[{x:190,y:190},{x:170,y:220},{x:185,y:255},{x:215,y:265},{x:245,y:250}]},{id:4,label:"Final tail",path:[{x:245,y:250},{x:255,y:280},{x:240,y:310},{x:210,y:325}]}],tips:["Double മ conjunct","First മ is slightly smaller","Connected through a smooth transition"]},{character:"ല്ല",romanization:"lla",name:"ല്ല",nameEn:"Lla (conjunct)",category:"conjunct",difficulty:4,strokes:[{id:1,label:"First ല top",path:[{x:120,y:120},{x:165,y:85},{x:215,y:80},{x:245,y:110}]},{id:2,label:"First ല body",path:[{x:245,y:110},{x:255,y:150},{x:235,y:185},{x:195,y:195}]},{id:3,label:"Second ല connection",path:[{x:195,y:195},{x:175,y:225},{x:190,y:260},{x:220,y:270},{x:250,y:255}]},{id:4,label:"Final tail",path:[{x:250,y:255},{x:260,y:285},{x:245,y:315},{x:215,y:330}]}],tips:["Double ല conjunct","The two characters merge together","Practice the connecting stroke"]}],Xy=e=>Rl.filter(t=>t.category===e),TLe=e=>{switch(e){case 1:return"Beginner";case 2:return"Easy";case 3:return"Medium";case 4:return"Hard";case 5:return"Expert";default:return"Unknown"}},ALe=e=>{switch(e){case 1:return"bg-green-100 text-green-700 border-green-200";case 2:return"bg-blue-100 text-blue-700 border-blue-200";case 3:return"bg-yellow-100 text-yellow-700 border-yellow-200";case 4:return"bg-orange-100 text-orange-700 border-orange-200";case 5:return"bg-red-100 text-red-700 border-red-200";default:return"bg-gray-100 text-gray-700 border-gray-200"}},PLe={all:{label:"All Characters",icon:wa,color:"from-purple-500 to-indigo-600",count:Rl.length},vowel:{label:"Vowels (സ്വരങ്ങൾ)",icon:is,color:"from-pink-500 to-rose-600",count:Xy("vowel").length},consonant:{label:"Consonants (വ്യഞ്ജനങ്ങൾ)",icon:Vs,color:"from-blue-500 to-cyan-600",count:Xy("consonant").length},conjunct:{label:"Conjuncts (കൂട്ടക്ഷരങ്ങൾ)",icon:An,color:"from-amber-500 to-orange-600",count:Xy("conjunct").length}},OLe=()=>{const[e,t]=y.useState("all"),[r,n]=y.useState(0),[s,i]=y.useState(""),[o,l]=y.useState(()=>{try{const g=localStorage.getItem("neela-mozhi-practiced");return g?new Set(JSON.parse(g)):new Set}catch{return new Set}}),c=y.useMemo(()=>{let g=e==="all"?Rl:Xy(e);if(s.trim()){const p=s.toLowerCase().trim();g=g.filter(v=>v.character.includes(p)||v.romanization.toLowerCase().includes(p)||v.nameEn.toLowerCase().includes(p)||v.name.includes(p))}return g},[e,s]),u=c[r]||c[0];y.useEffect(()=>{n(0)},[e,s]),y.useEffect(()=>{localStorage.setItem("neela-mozhi-practiced",JSON.stringify([...o]))},[o]);const h=()=>{u&&l(g=>new Set([...g,u.character]))},d=g=>{g==="prev"&&r>0?n(p=>p-1):g==="next"&&r<c.length-1&&n(p=>p+1)},f=()=>{l(new Set),localStorage.removeItem("neela-mozhi-practiced")},m=Rl.length>0?Math.round(o.size/Rl.length*100):0;return u?a.jsxs("div",{className:"min-h-screen bg-gradient-to-b from-gray-50 to-white",children:[a.jsx(hs,{}),a.jsxs("div",{className:"max-w-7xl mx-auto px-4 py-6",children:[a.jsxs("div",{className:"relative overflow-hidden rounded-2xl bg-gradient-to-r from-purple-600 via-indigo-600 to-blue-600 text-white p-6 md:p-8 mb-8",children:[a.jsx("div",{className:"absolute inset-0 opacity-10",children:a.jsx("div",{className:"absolute top-4 right-8 text-[120px] font-bold leading-none select-none",children:u.character})}),a.jsxs("div",{className:"relative z-10",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsxs(ke,{className:"bg-white/20 text-white border-white/30",children:[a.jsx(An,{className:"h-3 w-3 mr-1"}),"Advanced Writing Lab"]}),a.jsxs(ke,{className:"bg-white/20 text-white border-white/30",children:[a.jsx(lr,{className:"h-3 w-3 mr-1"}),o.size,"/",Rl.length," Practiced"]})]}),a.jsx("h1",{className:"text-2xl md:text-3xl font-bold mb-1",children:"Neela Mozhi Advanced"}),a.jsx("p",{className:"text-purple-100 text-sm md:text-base max-w-2xl",children:"Master Malayalam writing with animated stroke guides, directional arrows, and step-by-step practice. Each character shows the exact path and direction for every stroke."}),a.jsxs("div",{className:"mt-4 max-w-md",children:[a.jsxs("div",{className:"flex items-center justify-between text-xs mb-1",children:[a.jsx("span",{className:"text-purple-200",children:"Overall Progress"}),a.jsxs("span",{className:"font-bold",children:[m,"%"]})]}),a.jsx("div",{className:"h-2 bg-white/20 rounded-full overflow-hidden",children:a.jsx("div",{className:"h-full bg-gradient-to-r from-green-400 to-emerald-400 rounded-full transition-all duration-500",style:{width:`${m}%`}})})]})]})]}),a.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-3 mb-6",children:Object.entries(PLe).map(([g,p])=>{const v=p.icon,x=e===g;return a.jsxs("button",{onClick:()=>
1068t(g),className:`relative p-3 md:p-4 rounded-xl border-2 transition-all text-left ${x?"border-purple-300 bg-purple-50 shadow-md":"border-gray-200 bg-white hover:border-gray-300 hover:shadow-sm"}`,children:[a.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[a.jsx("div",{className:`p-1.5 rounded-lg ${x?`bg-gradient-to-br ${p.color} text-white`:"bg-gray-100 text-gray-500"}`,children:a.jsx(v,{className:"h-4 w-4"})}),a.jsx("span",{className:"text-xs font-bold text-gray-400",children:p.count})]}),a.jsx("h3",{className:`text-sm font-bold ${x?"text-purple-700":"text-gray-700"}`,children:p.label})]},g)})}),a.jsxs("div",{className:"relative mb-6 max-w-md",children:[a.jsx(Tp,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-gray-400"}),a.jsx(Je,{placeholder:"Search by character, romanization, or name...",value:s,onChange:g=>i(g.target.value),className:"pl-10"})]}),a.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-12 gap-6",children:[a.jsx("div",{className:"lg:col-span-3",children:a.jsxs(se,{className:"border-2 border-gray-100",children:[a.jsx(_e,{className:"pb-2",children:a.jsxs(Se,{className:"text-sm flex items-center justify-between",children:[a.jsxs("span",{children:["Characters (",c.length,")"]}),a.jsxs(Y,{size:"sm",variant:"ghost",onClick:f,className:"text-xs h-7 text-gray-400",children:[a.jsx(Gn,{className:"h-3 w-3 mr-1"})," Reset"]})]})}),a.jsx(ue,{children:a.jsx("div",{className:"grid grid-cols-4 sm:grid-cols-5 lg:grid-cols-3 gap-1.5 max-h-[400px] overflow-y-auto pr-1",children:c.map((g,p)=>{const v=o.has(g.character),x=p===r;return a.jsxs("button",{onClick:()=>n(p),className:`relative p-2 rounded-xl text-center transition-all ${x?"bg-purple-600 text-white shadow-lg scale-105 ring-2 ring-purple-300":v?"bg-green-50 border-2 border-green-200 hover:border-green-300":"bg-white border-2 border-gray-100 hover:border-purple-200 hover:shadow-sm"}`,children:[v&&!x&&a.jsx(ot,{className:"absolute -top-1 -right-1 h-4 w-4 text-green-500 bg-white rounded-full"}),a.jsx("div",{className:`text-xl font-bold ${x?"text-white":"text-gray-800"}`,children:g.character}),a.jsx("div",{className:`text-[10px] ${x?"text-purple-200":"text-gray-400"}`,children:g.romanization})]},g.character+p)})})})]})}),a.jsx("div",{className:"lg:col-span-6",children:a.jsxs(se,{className:"border-2 border-purple-100",children:[a.jsx(_e,{className:"pb-3",children:a.jsxs("div",{className:"flex items-center justify-between flex-wrap gap-2",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"text-4xl font-bold text-purple-700",children:u.character}),a.jsxs("div",{children:[a.jsx(Se,{className:"text-lg",children:u.nameEn}),a.jsxs("div",{className:"flex items-center gap-2 mt-0.5",children:[a.jsx("span",{className:"text-sm text-gray-500",children:u.romanization}),a.jsx(ke,{className:`text-[10px] ${ALe(u.difficulty)}`,children:TLe(u.difficulty)}),a.jsxs(ke,{variant:"outline",className:"text-[10px]",children:[u.strokes.length," strokes"]})]})]})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Y,{size:"sm",variant:"outline",onClick:()=>d("prev"),disabled:r===0,children:a.jsx(N0,{className:"h-4 w-4"})}),a.jsxs("span",{className:"text-xs text-gray-400 font-mono",children:[r+1,"/",c.length]}),a.jsx(Y,{size:"sm",variant:"outline",onClick:()=>d("next"),disabled:r>=c.length-1,children:a.jsx(ns,{className:"h-4 w-4"})})]})]})}),a.jsxs(ue,{children:[a.jsx(ELe,{character:u,onComplete:h}),a.jsxs("div",{className:"mt-4 flex items-center justify-center gap-3",children:[a.jsxs(Y,{onClick:h,className:`${o.has(u.character)?"bg-green-500 hover:bg-green-600":"bg-purple-600 hover:bg-purple-700"} text-white`,children:[a.jsx(ot,{className:"h-4 w-4 mr-1.5"}),o.has(u.character)?"Practiced!":"Mark as Practiced"]}),a.jsxs(Y,{variant:"outline",onClick:()=>d("next"),disabled:r>=c.length-1,children:["Next Character ",a.jsx(ns,{className:"h-4 w-4 ml-1"})]})]})]})]})}),a.jsxs("div",{className:"lg:col-span-3 space-y-4",children:[a.jsxs(se,{className:"border-2 border-indigo-100",children:[a.jsx(_e,{className:"pb-2",children:a.jsxs(Se,{className:"text-sm flex items-center gap-1.5",children:[a.jsx(nl,{className:"h-4 w-4 text-indigo-500"}
1068),"Stroke Details"]})}),a.jsx(ue,{className:"space-y-2",children:u.strokes.map((g,p)=>{const v=["bg-purple-500","bg-blue-500","bg-red-500","bg-green-500","bg-amber-500","bg-pink-500"];return a.jsxs("div",{className:"flex items-start gap-2 p-2 rounded-lg bg-gray-50 border border-gray-100",children:[a.jsx("span",{className:`flex-shrink-0 w-6 h-6 rounded-full flex items-center justify-center text-xs font-bold text-white ${v[p%v.length]}`,children:g.id}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-medium text-gray-700",children:g.label}),a.jsxs("p",{className:"text-xs text-gray-400",children:[g.path.length," points"]})]})]},g.id)})})]}),a.jsxs(se,{className:"border-2 border-amber-100",children:[a.jsx(_e,{className:"pb-2",children:a.jsxs(Se,{className:"text-sm flex items-center gap-1.5",children:[a.jsx(ec,{className:"h-4 w-4 text-amber-500"}),"Writing Tips"]})}),a.jsx(ue,{children:a.jsx("ul",{className:"space-y-2",children:u.tips.map((g,p)=>a.jsxs("li",{className:"flex items-start gap-2 text-sm text-gray-600",children:[a.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-amber-400 mt-2 flex-shrink-0"}),g]},p))})})]}),a.jsxs(se,{children:[a.jsx(_e,{className:"pb-2",children:a.jsx(Se,{className:"text-sm",children:"Legend"})}),a.jsxs(ue,{className:"space-y-2 text-xs text-gray-500",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("div",{className:"w-4 h-4 rounded-full bg-purple-500"}),a.jsx("span",{children:"Numbered circles = stroke start points"})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("svg",{width:"20",height:"12",viewBox:"0 0 20 12",children:a.jsx("polygon",{points:"20,6 10,0 13,6 10,12",fill:"#7C3AED"})}),a.jsx("span",{children:"Arrows = stroke direction"})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("div",{className:"w-4 h-4 rounded-full bg-purple-500 ring-4 ring-purple-200"}),a.jsx("span",{children:"Animated dot = current position"})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("div",{className:"w-4 h-4 rounded bg-gray-200 flex items-center justify-center",children:a.jsx("span",{className:"text-[8px] text-gray-400 font-bold",children:"Aa"})}),a.jsx("span",{children:"Faint character = tracing guide"})]})]})]}),a.jsx(se,{className:"bg-gradient-to-br from-purple-50 to-indigo-50 border-purple-100",children:a.jsx(ue,{className:"pt-4",children:a.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"text-2xl font-bold text-purple-700",children:o.size}),a.jsx("div",{className:"text-xs text-gray-500",children:"Practiced"})]}),a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"text-2xl font-bold text-indigo-700",children:Rl.length-o.size}),a.jsx("div",{className:"text-xs text-gray-500",children:"Remaining"})]}),a.jsxs("div",{className:"text-center",children:[a.jsxs("div",{className:"text-2xl font-bold text-green-600",children:[m,"%"]}),a.jsx("div",{className:"text-xs text-gray-500",children:"Complete"})]}),a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"text-2xl font-bold text-amber-600",children:u.strokes.length}),a.jsx("div",{className:"text-xs text-gray-500",children:"Strokes"})]})]})})})]})]})]})]}):a.jsxs("div",{className:"min-h-screen bg-gray-50",children:[a.jsx(hs,{}),a.jsxs("div",{className:"max-w-7xl mx-auto px-4 py-12 text-center",children:[a.jsx("p",{className:"text-gray-500",children:"No characters found. Try a different search or category."}),a.jsx(Y,{className:"mt-4",onClick:()=>{i(""),t("all")},children:"Reset Filters"})]})]})},MLe=()=>{const e=il();return y.useEffect(()=>{console.error("404 Error: User attempted to access non-existent route:",e.pathname)},[e.pathname]),a.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background",children:a.jsxs("div",{className:"text-center p-8 rounded-lg border border-border bg-card shadow-md animate-slide-in",children:[a.jsx("h1",{className:"text-5xl font-bold mb-6 text-primary",children:"404"}),a.jsx("p",{className:"text-xl text-card-foreground mb-6",children:"Page not found"}),a.jsx("a",{href:"/",className:"text-primary hover:text-primary/80 underline transition-colors",children:"Return to Home"})]})})},RLe=new xJ,$Le=Br()?jZ:wZ,ILe=()=>a.jsxs(fZ,{children:[a.jsx(bt,{path:"/",element:a.jsx(xne,{})}),a.jsx(bt,{path:"/login",element:a.jsx(bRe,{})}),a.jsx(bt,{path:"/reset-password",element:a.jsx(kRe,{})}),a.jsx(bt,{path:"/app",element:a.jsx(Hr,{children:a.jsx(pce,{})})}),a.jsx(bt,{path:"/progress",element:a.jsx(Hr,{children:a.jsx(Kce,{})})}),a.jsx(bt,{path:"/review",element:a.jsx(Hr,{children:a.jsx(Yce,{})})}),a.jsx(bt,{path:"/flashcards",element:a.jsx(Hr,{children:a.jsx(oue,{})})}),a.jsx(bt,{path:"/audio-admin",element:a.jsx(Hr,{children:a.jsx(ade,{})})}),a.jsx(bt,{path:"/phonetics",element:a.jsx(Hr,{children:a.jsx(lde,{})})}),a.jsx(bt,{path:"/settings",element:a.jsx(Hr,{children:a.jsx(yRe,{})})}),a.jsx(bt,{path:"/profile",element:a.jsx(Hr,{children:a.jsx(NRe,{})})}),a.jsx(bt,{path:"/community",element:a.jsx(Hr,{children:a.jsx(MRe,{})})}),a.jsx(bt,{path:"/messages",element:a.jsx(Hr,{children:a.jsx(DRe,{})})}),a.jsx(bt,{path:"/study-room/:roomId",element:a.jsx(Hr,{children:a.jsx(mDe,{})})}),a.jsx(bt,{path:"/teams",element:a.jsx(Hr,{children:a.jsx(TDe,{})})}),a.jsx(bt,{path:"/admin",element:a.jsx(Hr,{children:a.jsx(qDe,{})})}),a.jsx(bt,{path:"/interactive-learning",element:a.jsx(Hr,{children:a.jsx(_Le,{})})}),a.jsx(bt,{path:"/uncle-b-writing-lab",element:a.jsx(Hr,{children:a.jsx(kLe,{})})}),a.jsx(bt,{path:"/neela-mozhi",element:a.jsx(Hr,{children:a.jsx(OLe,{})})}),a.jsx(bt,{path:"/audio-debug",element:a.jsx(GDe,{})}),a.jsx(bt,{path:"/audio-test",element:a.jsx(KDe,{})}),a.jsx(bt,{path:"/audio-upload",element:a.jsx(wR,{})}),a.jsx(bt,{path:"/audio-recorder",element:a.jsx(wR,{})}),a.jsx(bt,{path:"/audio-testing",element:a.jsx(eLe,{})}),a.jsx(bt,{path:"/audio-manager",element:a.jsx(fLe,{})}),a.jsx(bt,{path:"*",element:a.jsx(MLe,{})})]}),DLe=()=>a.jsx(lX,{defaultTheme:"light",children:a.jsx(wJ,{client:RLe,children:a.jsx(kre,{children:a.jsx(Pre,{children:a.jsxs(p2,{children:[a.jsx(RY,{}),a.jsx(uX,{}),a.jsx($Le,{children:a.jsx(ILe,{})})]})})})})});window.addEventListener("unhandledrejection",e=>{var s;const t=e.reason,r=(t==null?void 0:t.message)||((s=t==null?void 0:t.toString)==null?void 0:s.call(t))||"";r.includes("Failed to fetch")||r.includes("NetworkError")||r.includes("Network request failed")||r.includes("WebSocket")||r.includes("realtime")||r.includes("wss://")||r.includes("connection")||(t==null?void 0:t.name)==="TypeError"&&r.includes("fetch")?(e.preventDefault(),console.warn("[Network] Connection issue detected - app will continue in offline mode")):(e.preventDefault(),console.warn("[Unhandled Promise Rejection]",r.substring(0,200))
1068)});window.addEventListener("error",e=>{const t=e.message||"";if(t.includes("Failed to fetch")||t.includes("NetworkError")||t.includes("WebSocket")||t.includes("realtime"))return e.preventDefault(),console.warn("[Network Error] Suppressed:",t.substring(0,100)),!1});!Br()&&"serviceWorker"in navigator?window.addEventListener("load",()=>{navigator.serviceWorker.register("/sw.js").then(e=>{console.log("Service Worker registered:",e)}).catch(e=>{console.log("Service Worker registration failed:",e)})}):Br()&&console.log("[Capacitor] Running as native app - service worker skipped");const LLe=()=>{Br()?(document.body.classList.add("capacitor-app"),i6()?document.body.classList.add("platform-ios"):E2()&&document.body.classList.add("platform-android")):document.body.classList.add("platform-web")},FLe=async()=>{LLe(),await Fre(),GI(document.getElementById("root")).render(a.jsx(DLe,{}))};FLe();export{yi as _};

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.