vendor: 6,122 bytes, lines 1-9
1var ng=e=>{throw TypeError(e)};var wd=(e,t,r)=>t.has(e)||ng("Cannot "+r);var L=(e,t,r)=>(wd(e,t,"read from private field"),r?r.call(e):t.get(e)),Se=(e,t,r)=>t.has(e)?ng("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),ge=(e,t,r,n)=>(wd(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),pt=(e,t,r)=>(wd(e,t,"access private method"),r);var jl=(e,t,r,n)=>({set _(s){ge(e,t,s,r)},get _(){return L(e,t,n)}});function yk(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 a=Object.getOwnPropertyDescriptor(n,s);a&&Object.defineProperty(e,s,a.get?a:{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 a of s)if(a.type==="childList")for(const o of a.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&n(o)}).observe(document,{childList:!0,subtree:!0});function r(s){const a={};return s.integrity&&(a.integrity=s.integrity),s.referrerPolicy&&(a.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?a.credentials="include":s.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function n(s){if(s.ep)return;s.ep=!0;const a=r(s);fetch(s.href,a)}})();function _y(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var jy={exports:{}},Cu={},ky={exports:{}},be={};/** 2 * @license React 3 * react.production.min.js 4 * 5 * Copyright (c) Facebook, Inc. and its affiliates. 6 * 7 * This source code is licensed under the MIT license found in the 8 * LICENSE file in the root directory of this source tree. 9 */var ll=Symbol.for("react.element"),vk=Symbol.for("react.portal"),wk=Symbol.for("react.fragment"),bk=Symbol.for("react.strict_mode"),_k=Symbol.for("react.profiler"),jk=Symbol.for("react.provider"),kk=Symbol.for("react.context"),Sk=Symbol.for("react.forward_ref"),Nk=Symbol.for("react.suspense"),Ck=Symbol.for("react.memo"),Ek=Symbol.for("react.lazy"),sg=Symbol.iterator;function Tk(e){return e===null||typeof e!="object"?null:(e=sg&&e[sg]||e["@@iterator"],typeof e=="function"?e:null)}var Sy={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Ny=Object.assign,Cy={};function Ti(e,t,r){this.props=e,this.context=t,this.refs=Cy,this.updater=r||Sy}Ti.prototype.isReactComponent={};Ti.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")};Ti.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function Ey(){}Ey.prototype=Ti.prototype;function lm(e,t,r){this.props=e,this.context=t,this.refs=Cy,this.updater=r||Sy}var cm=lm.prototype=new Ey;cm.constructor=lm;Ny(cm,Ti.prototype);cm.isPureReactComponent=!0;var ag=Array.isArray,Ty=Object.prototype.hasOwnProperty,um={current:null},Py={key:!0,ref:!0,__self:!0,__source:!0};function Ay(e,t,r){var n,s={},a=null,o=null;if(t!=null)for(n in t.ref!==void 0&&(o=t.ref),t.key!==void 0&&(a=""+t.key),t)Ty.call(t,n)&&!Py.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:ll,type:e,key:a,ref:o,props:s,_owner:um.current}}function Pk(e,t){return{$$typeof:ll,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}function dm(e){return typeof e=="object"&&e!==null&&e.$$typeof===ll}function Ak(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(r){return t[r]})}var ig=/\/+/g;function bd(e,t){return typeof e=="object"&&e!==null&&e.key!=null?Ak(""+e.key):t.toString(36)}function lc(e,t,r,n,s){var a=typeof e;(a==="undefined"||a==="boolean")&&(e=null);var o=!1;if(e===null)o=!0;else switch(a){case"string":case"number":o=!0;break;case"object":switch(e.$$typeof){case ll:case vk:o=!0}}if(o)return o=e,s=s(o),e=n===""?"."+bd(o,0):n,ag(s)?(r="",e!=null&&(r=e.replace(ig,"$&/")+"/"),lc(s,t,r,"",function(u){return u})):s!=null&&(dm(s)&&(s=Pk(s,r+(!s.key||o&&o.key===s.key?"":(""+s.key).replace(ig,"$&/")+"/")+e)),t.push(s)),1;if(o=0,n=n===""?".":n+":",ag(e))for(var l=0;l<e.length;l++){a=e[l];var c=n+bd(a,l);o+=lc(a,t,r,c,s)}else if(c=Tk(e),typeof c=="function")for(e=c.call(e),l=0;!(a=e.next()).done;)a=a.value,c=n+bd(a,l++),o+=lc(a,t,r,c,s);else if(a==="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 kl(e,t,r){if(e==null)return e;var n=[],s=0;return lc(e,n,"","",function(a){return t.call(r,a,s++)}),n}function Rk(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 Et={current:null},cc={transition:null},Ok={ReactCurrentDispatcher:Et,ReactCurrentBatchConfig:cc,ReactCurrentOwner:um};function Ry(){throw Error("act(...) is not supported in production builds of React.")}be.Children={map:kl,forEach:function(e,t,r){kl(e,function(){t.apply(this,arguments)},r)},count:function(e){var t=0;return kl(e,function(){t++}),t},toArray:function(e){return kl(e,function(t){return t})||[]},only:function(e){if(!dm(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};be.Component=Ti;be.Fragment=wk;be.Profiler=_k;be.PureComponent=lm;be.StrictMode=bk;be.Suspense=Nk;
vendor: 4,901 bytes, lines 9-25
9be.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Ok;be.act=Ry;be.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=Ny({},e.props),s=e.key,a=e.ref,o=e._owner;if(t!=null){if(t.ref!==void 0&&(a=t.ref,o=um.current),t.key!==void 0&&(s=""+t.key),e.type&&e.type.defaultProps)var l=e.type.defaultProps;for(c in t)Ty.call(t,c)&&!Py.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:ll,type:e.type,key:s,ref:a,props:n,_owner:o}};be.createContext=function(e){return e={$$typeof:kk,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:jk,_context:e},e.Consumer=e};be.createElement=Ay;be.createFactory=function(e){var t=Ay.bind(null,e);return t.type=e,t};be.createRef=function(){return{current:null}};be.forwardRef=function(e){return{$$typeof:Sk,render:e}};be.isValidElement=dm;be.lazy=function(e){return{$$typeof:Ek,_payload:{_status:-1,_result:e},_init:Rk}};be.memo=function(e,t){return{$$typeof:Ck,type:e,compare:t===void 0?null:t}};be.startTransition=function(e){var t=cc.transition;cc.transition={};try{e()}finally{cc.transition=t}};be.unstable_act=Ry;be.useCallback=function(e,t){return Et.current.useCallback(e,t)};be.useContext=function(e){return Et.current.useContext(e)};be.useDebugValue=function(){};be.useDeferredValue=function(e){return Et.current.useDeferredValue(e)};be.useEffect=function(e,t){return Et.current.useEffect(e,t)};be.useId=function(){return Et.current.useId()};be.useImperativeHandle=function(e,t,r){return Et.current.useImperativeHandle(e,t,r)};be.useInsertionEffect=function(e,t){return Et.current.useInsertionEffect(e,t)};be.useLayoutEffect=function(e,t){return Et.current.useLayoutEffect(e,t)};be.useMemo=function(e,t){return Et.current.useMemo(e,t)};be.useReducer=function(e,t,r){return Et.current.useReducer(e,t,r)};be.useRef=function(e){return Et.current.useRef(e)};be.useState=function(e){return Et.current.useState(e)};be.useSyncExternalStore=function(e,t,r){return Et.current.useSyncExternalStore(e,t,r)};be.useTransition=function(){return Et.current.useTransition()};be.version="18.3.1";ky.exports=be;var p=ky.exports;const G=_y(p),hm=yk({__proto__:null,default:G},[p]);/** 10 * @license React 11 * react-jsx-runtime.production.min.js 12 * 13 * Copyright (c) Facebook, Inc. and its affiliates. 14 * 15 * This source code is licensed under the MIT license found in the 16 * LICENSE file in the root directory of this source tree. 17 */var Ik=p,Mk=Symbol.for("react.element"),Dk=Symbol.for("react.fragment"),Lk=Object.prototype.hasOwnProperty,$k=Ik.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,Fk={key:!0,ref:!0,__self:!0,__source:!0};function Oy(e,t,r){var n,s={},a=null,o=null;r!==void 0&&(a=""+r),t.key!==void 0&&(a=""+t.key),t.ref!==void 0&&(o=t.ref);for(n in t)Lk.call(t,n)&&!Fk.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:Mk,type:e,key:a,ref:o,props:s,_owner:$k.current}}Cu.Fragment=Dk;Cu.jsx=Oy;Cu.jsxs=Oy;jy.exports=Cu;var i=jy.exports,Iy={exports:{}},Yt={},My={exports:{}},Dy={};/** 18 * @license React 19 * scheduler.production.min.js 20 * 21 * Copyright (c) Facebook, Inc. and its affiliates. 22 * 23 * This source code is licensed under the MIT license found in the 24 * LICENSE file in the root directory of this source tree. 25 */(function(e){function t(E,A){var Y=E.length;E.push(A);e:for(;0<Y;){var te=Y-1>>>1,W=E[te];if(0<s(W,A))E[te]=A,E[Y]=W,Y=te;else break e}}function r(E){return E.length===0?null:E[0]}function n(E){if(E.length===0)return null;var A=E[0],Y=E.pop();if(Y!==A){E[0]=Y;e:for(var te=0,W=E.length,se=W>>>1;te<se;){var I=2*(te+1)-1,re=E[I],xe=I+1,V=E[xe];if(0>s(re,Y))xe<W&&0>s(V,re)?(E[te]=V,E[xe]=Y,te=xe):(E[te]=re,E[I]=Y,te=I);else if(xe<W&&0>s(V,Y))E[te]=V,E[xe]=Y,te=xe;else break e}}return A}function s(E,A){var Y=E.sortIndex-A.sortIndex;return Y!==0?Y:E.id-A.id}if(typeof performance=="object"&&typeof performance.now=="function"){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,l=o.now();e.unstable_now=function(){return o.now()-l}}var c=[],u=[],d=1,h=null,m=3,f=!1,b=!1,g=!1,v=typeof setTimeout=="function"?setTimeout:null,x=typeof clearTimeout=="function"?clearTimeout:null,y=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function w(E){for(var A=r(u);A!==null;){if(A.callback===null)n(u);else if(A.startTime<=E)n(u),A.sortIndex=A.expirationTime,t(c,A);else break;A=r(u)}}function _(E){if(g=!1,w(E),!b)if(r(c)!==null)b=!0,N(j);else{var A=r(u);
vendor: 9,330 bytes, lines 25-34
25A!==null&&D(_,A.startTime-E)}}function j(E,A){b=!1,g&&(g=!1,x(C),C=-1),f=!0;var Y=m;try{for(w(A),h=r(c);h!==null&&(!(h.expirationTime>A)||E&&!$());){var te=h.callback;if(typeof te=="function"){h.callback=null,m=h.priorityLevel;var W=te(h.expirationTime<=A);A=e.unstable_now(),typeof W=="function"?h.callback=W:h===r(c)&&n(c),w(A)}else n(c);h=r(c)}if(h!==null)var se=!0;else{var I=r(u);I!==null&&D(_,I.startTime-A),se=!1}return se}finally{h=null,m=Y,f=!1}}var k=!1,S=null,C=-1,P=5,T=-1;function $(){return!(e.unstable_now()-T<P)}function O(){if(S!==null){var E=e.unstable_now();T=E;var A=!0;try{A=S(!0,E)}finally{A?M():(k=!1,S=null)}}else k=!1}var M;if(typeof y=="function")M=function(){y(O)};else if(typeof MessageChannel<"u"){var R=new MessageChannel,U=R.port2;R.port1.onmessage=O,M=function(){U.postMessage(null)}}else M=function(){v(O,0)};function N(E){S=E,k||(k=!0,M())}function D(E,A){C=v(function(){E(e.unstable_now())},A)}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(E){E.callback=null},e.unstable_continueExecution=function(){b||f||(b=!0,N(j))},e.unstable_forceFrameRate=function(E){0>E||125<E?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):P=0<E?Math.floor(1e3/E):5},e.unstable_getCurrentPriorityLevel=function(){return m},e.unstable_getFirstCallbackNode=function(){return r(c)},e.unstable_next=function(E){switch(m){case 1:case 2:case 3:var A=3;break;default:A=m}var Y=m;m=A;try{return E()}finally{m=Y}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(E,A){switch(E){case 1:case 2:case 3:case 4:case 5:break;default:E=3}var Y=m;m=E;try{return A()}finally{m=Y}},e.unstable_scheduleCallback=function(E,A,Y){var te=e.unstable_now();switch(typeof Y=="object"&&Y!==null?(Y=Y.delay,Y=typeof Y=="number"&&0<Y?te+Y:te):Y=te,E){case 1:var W=-1;break;case 2:W=250;break;case 5:W=1073741823;break;case 4:W=1e4;break;default:W=5e3}return W=Y+W,E={id:d++,callback:A,priorityLevel:E,startTime:Y,expirationTime:W,sortIndex:-1},Y>te?(E.sortIndex=Y,t(u,E),r(c)===null&&E===r(u)&&(g?(x(C),C=-1):g=!0,D(_,Y-te))):(E.sortIndex=W,t(c,E),b||f||(b=!0,N(j))),E},e.unstable_shouldYield=$,e.unstable_wrapCallback=function(E){var A=m;return function(){var Y=m;m=A;try{return E.apply(this,arguments)}finally{m=Y}}}})(Dy);My.exports=Dy;var Uk=My.exports;/** 26 * @license React 27 * react-dom.production.min.js 28 * 29 * Copyright (c) Facebook, Inc. and its affiliates. 30 * 31 * This source code is licensed under the MIT license found in the 32 * LICENSE file in the root directory of this source tree. 33 */var qk=p,Vt=Uk;function q(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 Ly=new Set,ko={};function da(e,t){fi(e,t),fi(e+"Capture",t)}function fi(e,t){for(ko[e]=t,e=0;e<t.length;e++)Ly.add(t[e])}var gn=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),kh=Object.prototype.hasOwnProperty,zk=/^[: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]*$/,og={},lg={};function Bk(e){return kh.call(lg,e)?!0:kh.call(og,e)?!1:zk.test(e)?lg[e]=!0:(og[e]=!0,!1)}function Wk(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 Hk(e,t,r,n){if(t===null||typeof t>"u"||Wk(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 Tt(e,t,r,n,s,a,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=a,this.removeEmptyString=o}var ht={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){ht[e]=new Tt(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];ht[t]=new Tt(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){ht[e]=new Tt(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){ht[e]=new Tt(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){ht[e]=new Tt(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){ht[e]=new Tt(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){ht[e]=new Tt(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){ht[e]=new Tt(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){ht[e]=new Tt(e,5,!1,e.toLowerCase(),null,!1,!1)});var fm=/[\-:]([a-z])/g;function mm(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(fm,mm);ht[t]=new Tt(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(fm,mm);ht[t]=new Tt(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(fm,mm);ht[t]=new Tt(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){ht[e]=new Tt(e,1,!1,e.toLowerCase(),null,!1,!1)});ht.xlinkHref=new Tt("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){ht[e]=new Tt(e,1,!1,e.toLowerCase(),null,!0,!0)});function pm(e,t,r,n){var s=ht.hasOwnProperty(t)?ht[t]:null;(s!==null?s.type!==0:n||!(2<t.length)||t[0]!=="o"&&t[0]!=="O"||t[1]!=="n"&&t[1]!=="N")&&(Hk(t,r,s,n)&&(r=null),n||s===null?Bk(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 Nn=qk.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,Sl=Symbol.for("react.element"),Da=Symbol.for("react.portal"),La=Symbol.for("react.fragment"),gm=Symbol.for("react.strict_mode"),Sh=Symbol.for("react.profiler"),$y=Symbol.for("react.provider"),Fy=Symbol.for("react.context"),xm=Symbol.for("react.forward_ref"),Nh=Symbol.for("react.suspense"),Ch=Symbol.for("react.suspense_list"),ym=Symbol.for("react.memo"),qn=Symbol.for("react.lazy"),Uy=Symbol.for("react.offscreen"),cg=Symbol.iterator;function Wi(e){return e===null||typeof e!="object"?null:(e=cg&&e[cg]||e["@@iterator"],typeof e=="function"?e:null)}var We=Object.assign,_d;function so(e){if(_d===void 0)try{throw Error()}catch(r){var t=r.stack.trim().match(/\n( *(at )?)/);_d=t&&t[1]||""}return` 34`+_d+e}var jd=!1;function kd(e,t){if(!e||jd)return"";jd=!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: 6,732 bytes, lines 34-37
34catch(u){if(u&&n&&typeof u.stack=="string"){for(var s=u.stack.split(` 35`),a=n.stack.split(` 36`),o=s.length-1,l=a.length-1;1<=o&&0<=l&&s[o]!==a[l];)l--;for(;1<=o&&0<=l;o--,l--)if(s[o]!==a[l]){if(o!==1||l!==1)do if(o--,l--,0>l||s[o]!==a[l]){var c=` 37`+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{jd=!1,Error.prepareStackTrace=r}return(e=e?e.displayName||e.name:"")?so(e):""}function Vk(e){switch(e.tag){case 5:return so(e.type);case 16:return so("Lazy");case 13:return so("Suspense");case 19:return so("SuspenseList");case 0:case 2:case 15:return e=kd(e.type,!1),e;case 11:return e=kd(e.type.render,!1),e;case 1:return e=kd(e.type,!0),e;default:return""}}function Eh(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 La:return"Fragment";case Da:return"Portal";case Sh:return"Profiler";case gm:return"StrictMode";case Nh:return"Suspense";case Ch:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case Fy:return(e.displayName||"Context")+".Consumer";case $y:return(e._context.displayName||"Context")+".Provider";case xm:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case ym:return t=e.displayName||null,t!==null?t:Eh(e.type)||"Memo";case qn:t=e._payload,e=e._init;try{return Eh(e(t))}catch{}}return null}function Gk(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 Eh(t);case 8:return t===gm?"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 ps(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function qy(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function Yk(e){var t=qy(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,a=r.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return s.call(this)},set:function(o){n=""+o,a.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 Nl(e){e._valueTracker||(e._valueTracker=Yk(e))}function zy(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var r=t.getValue(),n="";return e&&(n=qy(e)?e.checked?"true":"false":e.value),e=n,e!==r?(t.setValue(e),!0):!1}function Tc(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 Th(e,t){var r=t.checked;return We({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:r??e._wrapperState.initialChecked})}function ug(e,t){var r=t.defaultValue==null?"":t.defaultValue,n=t.checked!=null?t.checked:t.defaultChecked;r=ps(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 By(e,t){t=t.checked,t!=null&&pm(e,"checked",t,!1)}function Ph(e,t){By(e,t);var r=ps(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")?Ah(e,t.type,r):t.hasOwnProperty("defaultValue")&&Ah(e,t.type,ps(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function dg(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 Ah(e,t,r){(t!=="number"||Tc(e.ownerDocument)!==e)&&(r==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+r&&(e.defaultValue=""+r))}var ao=Array.isArray;function Ka(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=""+ps(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 Rh(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(q(91));return We({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function hg(e,t){var r=t.value;if(r==null){if(r=t.children,t=t.defaultValue,r!=null){if(t!=null)throw Error(q(92));if(ao(r)){if(1<r.length)throw Error(q(93));r=r[0]}t=r}t==null&&(t=""),r=t}e._wrapperState={initialValue:ps(r)}}function Wy(e,t){var r=ps(t.value),n=ps(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 fg(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==""&&t!==null&&(e.value=t)}function Hy(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 Oh(e,t){return e==null||e==="http://www.w3.org/1999/xhtml"?Hy(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var Cl,Vy=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(Cl=Cl||document.createElement("div"),Cl.innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=Cl.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function So(e,t){if(t){var r=e.firstChild;
vendor: 3,404 bytes, line 37
37if(r&&r===e.lastChild&&r.nodeType===3){r.nodeValue=t;return}}e.textContent=t}var ho={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},Kk=["Webkit","ms","Moz","O"];Object.keys(ho).forEach(function(e){Kk.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),ho[t]=ho[e]})});function Gy(e,t,r){return t==null||typeof t=="boolean"||t===""?"":r||typeof t!="number"||t===0||ho.hasOwnProperty(e)&&ho[e]?(""+t).trim():t+"px"}function Yy(e,t){e=e.style;for(var r in t)if(t.hasOwnProperty(r)){var n=r.indexOf("--")===0,s=Gy(r,t[r],n);r==="float"&&(r="cssFloat"),n?e.setProperty(r,s):e[r]=s}}var Qk=We({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 Ih(e,t){if(t){if(Qk[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(q(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(q(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(q(61))}if(t.style!=null&&typeof t.style!="object")throw Error(q(62))}}function Mh(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 Dh=null;function vm(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Lh=null,Qa=null,Ja=null;function mg(e){if(e=dl(e)){if(typeof Lh!="function")throw Error(q(280));var t=e.stateNode;t&&(t=Ru(t),Lh(e.stateNode,e.type,t))}}function Ky(e){Qa?Ja?Ja.push(e):Ja=[e]:Qa=e}function Qy(){if(Qa){var e=Qa,t=Ja;if(Ja=Qa=null,mg(e),t)for(e=0;e<t.length;e++)mg(t[e])}}function Jy(e,t){return e(t)}function Zy(){}var Sd=!1;function Xy(e,t,r){if(Sd)return e(t,r);Sd=!0;try{return Jy(e,t,r)}finally{Sd=!1,(Qa!==null||Ja!==null)&&(Zy(),Qy())}}function No(e,t){var r=e.stateNode;if(r===null)return null;var n=Ru(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(q(231,t,typeof r));return r}var $h=!1;if(gn)try{var Hi={};Object.defineProperty(Hi,"passive",{get:function(){$h=!0}}),window.addEventListener("test",Hi,Hi),window.removeEventListener("test",Hi,Hi)}catch{$h=!1}function Jk(e,t,r,n,s,a,o,l,c){var u=Array.prototype.slice.call(arguments,3);try{t.apply(r,u)}catch(d){this.onError(d)}}
vendor: 6,601 bytes, line 37
37var fo=!1,Pc=null,Ac=!1,Fh=null,Zk={onError:function(e){fo=!0,Pc=e}};function Xk(e,t,r,n,s,a,o,l,c){fo=!1,Pc=null,Jk.apply(Zk,arguments)}function eS(e,t,r,n,s,a,o,l,c){if(Xk.apply(this,arguments),fo){if(fo){var u=Pc;fo=!1,Pc=null}else throw Error(q(198));Ac||(Ac=!0,Fh=u)}}function ha(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 ev(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 pg(e){if(ha(e)!==e)throw Error(q(188))}function tS(e){var t=e.alternate;if(!t){if(t=ha(e),t===null)throw Error(q(188));return t!==e?null:e}for(var r=e,n=t;;){var s=r.return;if(s===null)break;var a=s.alternate;if(a===null){if(n=s.return,n!==null){r=n;continue}break}if(s.child===a.child){for(a=s.child;a;){if(a===r)return pg(s),e;if(a===n)return pg(s),t;a=a.sibling}throw Error(q(188))}if(r.return!==n.return)r=s,n=a;else{for(var o=!1,l=s.child;l;){if(l===r){o=!0,r=s,n=a;break}if(l===n){o=!0,n=s,r=a;break}l=l.sibling}if(!o){for(l=a.child;l;){if(l===r){o=!0,r=a,n=s;break}if(l===n){o=!0,n=a,r=s;break}l=l.sibling}if(!o)throw Error(q(189))}}if(r.alternate!==n)throw Error(q(190))}if(r.tag!==3)throw Error(q(188));return r.stateNode.current===r?e:t}function tv(e){return e=tS(e),e!==null?rv(e):null}function rv(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=rv(e);if(t!==null)return t;e=e.sibling}return null}var nv=Vt.unstable_scheduleCallback,gg=Vt.unstable_cancelCallback,rS=Vt.unstable_shouldYield,nS=Vt.unstable_requestPaint,Qe=Vt.unstable_now,sS=Vt.unstable_getCurrentPriorityLevel,wm=Vt.unstable_ImmediatePriority,sv=Vt.unstable_UserBlockingPriority,Rc=Vt.unstable_NormalPriority,aS=Vt.unstable_LowPriority,av=Vt.unstable_IdlePriority,Eu=null,Hr=null;function iS(e){if(Hr&&typeof Hr.onCommitFiberRoot=="function")try{Hr.onCommitFiberRoot(Eu,e,void 0,(e.current.flags&128)===128)}catch{}}var Sr=Math.clz32?Math.clz32:cS,oS=Math.log,lS=Math.LN2;function cS(e){return e>>>=0,e===0?32:31-(oS(e)/lS|0)|0}var El=64,Tl=4194304;function io(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 Oc(e,t){var r=e.pendingLanes;if(r===0)return 0;var n=0,s=e.suspendedLanes,a=e.pingedLanes,o=r&268435455;if(o!==0){var l=o&~s;l!==0?n=io(l):(a&=o,a!==0&&(n=io(a)))}else o=r&~s,o!==0?n=io(o):a!==0&&(n=io(a));if(n===0)return 0;if(t!==0&&t!==n&&!(t&s)&&(s=n&-n,a=t&-t,s>=a||s===16&&(a&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-Sr(t),s=1<<r,n|=e[r],t&=~s;return n}function uS(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 dS(e,t){for(var r=e.suspendedLanes,n=e.pingedLanes,s=e.expirationTimes,a=e.pendingLanes;0<a;){var o=31-Sr(a),l=1<<o,c=s[o];c===-1?(!(l&r)||l&n)&&(s[o]=uS(l,t)):c<=t&&(e.expiredLanes|=l),a&=~l}}function Uh(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function iv(){var e=El;return El<<=1,!(El&4194240)&&(El=64),e}function Nd(e){for(var t=[],r=0;31>r;r++)t.push(e);return t}function cl(e,t,r){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Sr(t),e[t]=r}function hS(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-Sr(r),a=1<<s;t[s]=0,n[s]=-1,e[s]=-1,r&=~a}}function bm(e,t){var r=e.entangledLanes|=t;for(e=e.entanglements;r;){var n=31-Sr(r),s=1<<n;s&t|e[n]&t&&(e[n]|=t),r&=~s}}var Pe=0;function ov(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var lv,_m,cv,uv,dv,qh=!1,Pl=[],ns=null,ss=null,as=null,Co=new Map,Eo=new Map,Hn=[],fS="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 xg(e,t){switch(e){case"focusin":case"focusout":ns=null;break;case"dragenter":case"dragleave":ss=null;break;case"mouseover":case"mouseout":as=null;break;case"pointerover":case"pointerout":Co.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Eo.delete(t.pointerId)}}function Vi(e,t,r,n,s,a){return e===null||e.nativeEvent!==a?(e={blockedOn:t,domEventName:r,eventSystemFlags:n,nativeEvent:a,targetContainers:[s]},t!==null&&(t=dl(t),t!==null&&_m(t)),e):(e.eventSystemFlags|=n,t=e.targetContainers,s!==null&&t.indexOf(s)===-1&&t.push(s),e)}function mS(e,t,r,n,s){switch(t){case"focusin":return ns=Vi(ns,e,t,r,n,s),!0;case"dragenter":return ss=Vi(ss,e,t,r,n,s),!0;case"mouseover":return as=Vi(as,e,t,r,n,s),!0;case"pointerover":var a=s.pointerId;return Co.set(a,Vi(Co.get(a)||null,e,t,r,n,s)),!0;case"gotpointercapture":return a=s.pointerId,Eo.set(a,Vi(Eo.get(a)||null,e,t,r,n,s)),!0}return!1}function hv(e){var t=zs(e.target);if(t!==null){var r=ha(t);if(r!==null){if(t=r.tag,t===13){if(t=ev(r),t!==null){e.blockedOn=t,dv(e.priority,function(){cv(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 uc(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var r=zh(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(r===null){r=e.nativeEvent;var n=new r.constructor(r.type,r);Dh=n,r.target.dispatchEvent(n),Dh=null}else return t=dl(r),t!==null&&_m(t),e.blockedOn=r,!1;t.shift()}return!0}function yg(e,t,r){uc(e)&&r.delete(t)}function pS(){qh=!1,ns!==null&&uc(ns)&&(ns=null),ss!==null&&uc(ss)&&(ss=null),as!==null&&uc(as)&&(as=null),Co.forEac
vendor: 11,841 bytes, line 37
37h(yg),Eo.forEach(yg)}function Gi(e,t){e.blockedOn===t&&(e.blockedOn=null,qh||(qh=!0,Vt.unstable_scheduleCallback(Vt.unstable_NormalPriority,pS)))}function To(e){function t(s){return Gi(s,e)}if(0<Pl.length){Gi(Pl[0],e);for(var r=1;r<Pl.length;r++){var n=Pl[r];n.blockedOn===e&&(n.blockedOn=null)}}for(ns!==null&&Gi(ns,e),ss!==null&&Gi(ss,e),as!==null&&Gi(as,e),Co.forEach(t),Eo.forEach(t),r=0;r<Hn.length;r++)n=Hn[r],n.blockedOn===e&&(n.blockedOn=null);for(;0<Hn.length&&(r=Hn[0],r.blockedOn===null);)hv(r),r.blockedOn===null&&Hn.shift()}var Za=Nn.ReactCurrentBatchConfig,Ic=!0;function gS(e,t,r,n){var s=Pe,a=Za.transition;Za.transition=null;try{Pe=1,jm(e,t,r,n)}finally{Pe=s,Za.transition=a}}function xS(e,t,r,n){var s=Pe,a=Za.transition;Za.transition=null;try{Pe=4,jm(e,t,r,n)}finally{Pe=s,Za.transition=a}}function jm(e,t,r,n){if(Ic){var s=zh(e,t,r,n);if(s===null)Dd(e,t,n,Mc,r),xg(e,n);else if(mS(s,e,t,r,n))n.stopPropagation();else if(xg(e,n),t&4&&-1<fS.indexOf(e)){for(;s!==null;){var a=dl(s);if(a!==null&&lv(a),a=zh(e,t,r,n),a===null&&Dd(e,t,n,Mc,r),a===s)break;s=a}s!==null&&n.stopPropagation()}else Dd(e,t,n,null,r)}}var Mc=null;function zh(e,t,r,n){if(Mc=null,e=vm(n),e=zs(e),e!==null)if(t=ha(e),t===null)e=null;else if(r=t.tag,r===13){if(e=ev(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 Mc=e,null}function fv(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(sS()){case wm:return 1;case sv:return 4;case Rc:case aS:return 16;case av:return 536870912;default:return 16}default:return 16}}var Xn=null,km=null,dc=null;function mv(){if(dc)return dc;var e,t=km,r=t.length,n,s="value"in Xn?Xn.value:Xn.textContent,a=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[a-n];n++);return dc=s.slice(e,1<n?1-n:void 0)}function hc(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 Al(){return!0}function vg(){return!1}function Kt(e){function t(r,n,s,a,o){this._reactName=r,this._targetInst=s,this.type=n,this.nativeEvent=a,this.target=o,this.currentTarget=null;for(var l in e)e.hasOwnProperty(l)&&(r=e[l],this[l]=r?r(a):a[l]);return this.isDefaultPrevented=(a.defaultPrevented!=null?a.defaultPrevented:a.returnValue===!1)?Al:vg,this.isPropagationStopped=vg,this}return We(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=Al)},stopPropagation:function(){var r=this.nativeEvent;r&&(r.stopPropagation?r.stopPropagation():typeof r.cancelBubble!="unknown"&&(r.cancelBubble=!0),this.isPropagationStopped=Al)},persist:function(){},isPersistent:Al}),t}var Pi={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Sm=Kt(Pi),ul=We({},Pi,{view:0,detail:0}),yS=Kt(ul),Cd,Ed,Yi,Tu=We({},ul,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Nm,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!==Yi&&(Yi&&e.type==="mousemove"?(Cd=e.screenX-Yi.screenX,Ed=e.screenY-Yi.screenY):Ed=Cd=0,Yi=e),Cd)},movementY:function(e){return"movementY"in e?e.movementY:Ed}}),wg=Kt(Tu),vS=We({},Tu,{dataTransfer:0}),wS=Kt(vS),bS=We({},ul,{relatedTarget:0}),Td=Kt(bS),_S=We({},Pi,{animationName:0,elapsedTime:0,pseudoElement:0}),jS=Kt(_S),kS=We({},Pi,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),SS=Kt(kS),NS=We({},Pi,{data:0}),bg=Kt(NS),CS={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},ES={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"},TS={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function PS(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=TS[e])?!!t[e]:!1}function Nm(){return PS}var AS=We({},ul,{key:function(e){if(e.key){var t=CS[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=hc(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?ES[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Nm,charCode:function(e){return e.type==="keypress"?hc(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?hc(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),RS=Kt(AS),OS=We({},Tu,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),_g=Kt(OS),IS=We({},ul,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Nm}),MS=Kt(IS),DS=We({},Pi,{propertyName:0,elapsedTime:0,pseudoElement:0}),LS=Kt(DS),$S=We({},Tu,{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}),FS=Kt($S),US=[9,13,27,32],Cm=gn&&"CompositionEvent"in window,mo=null;gn&&"documentMode"in document&&(mo=document.documentMode);var qS=gn&&"TextEvent"in window&&!mo,pv=gn&&(!Cm||mo&&8<mo&&11>=mo),jg=" ",kg=!1;function gv(e,t){switch(e){case"keyup":return US.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function xv(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var $a=!1;function zS(e,t){switch(e){case"compositionend":return xv(t);case"keypress":return t.which!==32?null:(kg=!0,jg);case"textInput":return e=t.data,e===jg&&kg?null:e;default:return null}}function BS(e,t){if($a)return e==="compositionend"||!Cm&&gv(e,t)?(e=mv(),dc=km=Xn=null,$a=!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 pv&&t.locale!=="ko"?null:t.data;default:return null}}var WS={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 Sg(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!WS[e.type]:t==="textarea"}function yv(e,t,r,n){Ky(n),t=Dc(t,"onChange"),0<t.length&&(r=new Sm("onChange","change",null,r,n),e.push({event:r,listeners:t}))}var po=null,Po=null;function HS(e){Tv(e,0)}function Pu(e){var t=qa(e);if(zy(t))return e}function VS(e,t){if(e==="change")return t}var vv=!1;if(gn){var Pd;if(gn){var Ad="oninput"in document;if(!Ad){var Ng=document.createElement("div");Ng.setAttribute("oninput","return;"),Ad=typeof Ng.oninput=="function"}Pd=Ad}else Pd=!1;vv=Pd&&(!document.documentMode||9<document.documentMode)}function Cg(){po&&(po.detachEvent("onpropertychange",wv),Po=po=null)}function wv(e){if(e.propertyName==="value"&&Pu(Po)){var t=[];yv(t,Po,e,vm(e)),Xy(HS,t)}}function GS(e,t,r){e==="focusin"?(Cg(),po=t,Po=r,po.attachEvent("onpropertychange",wv)):e==="focusout"&&Cg()}function YS(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Pu(Po)}function KS(e,t){if(e==="click")return Pu(t)}function QS(e,t){if(e==="input"||e==="change")return Pu(t)}function JS(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Er=typeof Object.is=="function"?Object.is:JS;function Ao(e,t){if(Er(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(!kh.call(t,s)||!Er(e[s],t[s]))return!1}return!0}function Eg(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Tg(e,t){var r=Eg(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=Eg(r)}}function bv(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?bv(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function _v(){for(var e=window,t=Tc();t instanceof e.HTMLIFrameElement;){try{var r=typeof t.contentWindow.location.href=="string"}catch{r=!1}if(r)e=t.contentWindow;else break;t=Tc(e.document)}return t}function Em(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 ZS(e){var t=_v(),r=e.focusedElem,n=e.selectionRange;if(t!==r&&r&&r.ownerDocument&&bv(r.ownerDocument.documentElement,r)){if(n!==null&&Em(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,a=Math.min(n.start,s);n=n.end===void 0?a:Math.min(n.end,s),!e.extend&&a>n&&(s=n,n=a,a=s),s=Tg(r,a);var o=Tg(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(),a>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 XS=gn&&"documentMode"in document&&11>=document.documentMode,Fa=null,Bh=null,go=null,Wh=!1;function Pg(e,t,r){var n=r.window===r?r.document:r.nodeType===9?r:r.ownerDocument;Wh||Fa==null||Fa!==Tc(n)||(n=Fa,"selectionStart"in n&&Em(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,501 bytes, line 37
37sNode:n.focusNode,focusOffset:n.focusOffset}),go&&Ao(go,n)||(go=n,n=Dc(Bh,"onSelect"),0<n.length&&(t=new Sm("onSelect","select",null,t,r),e.push({event:t,listeners:n}),t.target=Fa)))}function Rl(e,t){var r={};return r[e.toLowerCase()]=t.toLowerCase(),r["Webkit"+e]="webkit"+t,r["Moz"+e]="moz"+t,r}var Ua={animationend:Rl("Animation","AnimationEnd"),animationiteration:Rl("Animation","AnimationIteration"),animationstart:Rl("Animation","AnimationStart"),transitionend:Rl("Transition","TransitionEnd")},Rd={},jv={};gn&&(jv=document.createElement("div").style,"AnimationEvent"in window||(delete Ua.animationend.animation,delete Ua.animationiteration.animation,delete Ua.animationstart.animation),"TransitionEvent"in window||delete Ua.transitionend.transition);function Au(e){if(Rd[e])return Rd[e];if(!Ua[e])return e;var t=Ua[e],r;for(r in t)if(t.hasOwnProperty(r)&&r in jv)return Rd[e]=t[r];return e}var kv=Au("animationend"),Sv=Au("animationiteration"),Nv=Au("animationstart"),Cv=Au("transitionend"),Ev=new Map,Ag="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 js(e,t){Ev.set(e,t),da(t,[e])}for(var Od=0;Od<Ag.length;Od++){var Id=Ag[Od],eN=Id.toLowerCase(),tN=Id[0].toUpperCase()+Id.slice(1);js(eN,"on"+tN)}js(kv,"onAnimationEnd");js(Sv,"onAnimationIteration");js(Nv,"onAnimationStart");js("dblclick","onDoubleClick");js("focusin","onFocus");js("focusout","onBlur");js(Cv,"onTransitionEnd");fi("onMouseEnter",["mouseout","mouseover"]);fi("onMouseLeave",["mouseout","mouseover"]);fi("onPointerEnter",["pointerout","pointerover"]);fi("onPointerLeave",["pointerout","pointerover"]);da("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));da("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));da("onBeforeInput",["compositionend","keypress","textInput","paste"]);da("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));da("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));da("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var oo="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(" "),rN=new Set("cancel close invalid load scroll toggle".split(" ").concat(oo));function Rg(e,t,r){var n=e.type||"unknown-event";e.currentTarget=r,eS(n,t,void 0,e),e.currentTarget=null}function Tv(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 a=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!==a&&s.isPropagationStopped())break e;Rg(s,l,u),a=c}else for(o=0;o<n.length;o++){if(l=n[o],c=l.instance,u=l.currentTarget,l=l.listener,c!==a&&s.isPropagationStopped())break e;Rg(s,l,u),a=c}}}if(Ac)throw e=Fh,Ac=!1,Fh=null,e}function De(e,t){var r=t[Kh];r===void 0&&(r=t[Kh]=new Set);var n=e+"__bubble";r.has(n)||(Pv(t,e,2,!1),r.add(n))}function Md(e,t,r){var n=0;t&&(n|=4),Pv(r,e,n,t)}var Ol="_reactListening"+Math.random().toString(36).slice(2);function Ro(e){if(!e[Ol]){e[Ol]=!0,Ly.forEach(function(r){r!=="selectionchange"&&(rN.has(r)||Md(r,!1,e),Md(r,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Ol]||(t[Ol]=!0,Md("selectionchange",!1,t))}}function Pv(e,t,r,n){switch(fv(t)){case 1:var s=gS;break;case 4:s=xS;break;default:s=jm}r=s.bind(null,t,r,e),s=void 0,!$h||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 Dd(e,t,r,n,s){var a=n;if(!(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;
vendor: 2,527 bytes, line 37
37if(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=zs(l),o===null)return;if(c=o.tag,c===5||c===6){n=a=o;continue e}l=l.parentNode}}n=n.return}Xy(function(){var u=a,d=vm(r),h=[];e:{var m=Ev.get(e);if(m!==void 0){var f=Sm,b=e;switch(e){case"keypress":if(hc(r)===0)break e;case"keydown":case"keyup":f=RS;break;case"focusin":b="focus",f=Td;break;case"focusout":b="blur",f=Td;break;case"beforeblur":case"afterblur":f=Td;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":f=wg;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":f=wS;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":f=MS;break;case kv:case Sv:case Nv:f=jS;break;case Cv:f=LS;break;case"scroll":f=yS;break;case"wheel":f=FS;break;case"copy":case"cut":case"paste":f=SS;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":f=_g}var g=(t&4)!==0,v=!g&&e==="scroll",x=g?m!==null?m+"Capture":null:m;g=[];for(var y=u,w;y!==null;){w=y;var _=w.stateNode;if(w.tag===5&&_!==null&&(w=_,x!==null&&(_=No(y,x),_!=null&&g.push(Oo(y,_,w)))),v)break;y=y.return}0<g.length&&(m=new f(m,b,null,r,d),h.push({event:m,listeners:g}))}}if(!(t&7)){e:{if(m=e==="mouseover"||e==="pointerover",f=e==="mouseout"||e==="pointerout",m&&r!==Dh&&(b=r.relatedTarget||r.fromElement)&&(zs(b)||b[xn]))break e;if((f||m)&&(m=d.window===d?d:(m=d.ownerDocument)?m.defaultView||m.parentWindow:window,f?(b=r.relatedTarget||r.toElement,f=u,b=b?zs(b):null,b!==null&&(v=ha(b),b!==v||b.tag!==5&&b.tag!==6)&&(b=null)):(f=null,b=u),f!==b)){if(g=wg,_="onMouseLeave",x="onMouseEnter",y="mouse",(e==="pointerout"||e==="pointerover")&&(g=_g,_="onPointerLeave",x="onPointerEnter",y="pointer"),v=f==null?m:qa(f),w=b==null?m:qa(b),m=new g(_,y+"leave",f,r,d),m.target=v,m.relatedTarget=w,_=null,zs(d)===u&&(g=new g(x,y+"enter",b,r,d),g.target=w,g.relatedTarget=v,_=g),v=_,f&&b)t:{for(g=f,x=b,y=0,w=g;w;w=wa(w))y++;for(w=0,_=x;_;_=wa(_))w++;for(;0<y-w;)g=wa(g),y--;for(;0<w-y;)x=wa(x),w--;for(;y--;){if(g===x||x!==null&&g===x.alternate)break t;g=wa(g),x=wa(x)}g=null}else g=null;f!==null&&Og(h,m,f,g,!1),b!==null&&v!==null&&Og(h,v,b,g,!0)}}
vendor: 5,681 bytes, lines 37-38
37e:{if(m=u?qa(u):window,f=m.nodeName&&m.nodeName.toLowerCase(),f==="select"||f==="input"&&m.type==="file")var j=VS;else if(Sg(m))if(vv)j=QS;else{j=YS;var k=GS}else(f=m.nodeName)&&f.toLowerCase()==="input"&&(m.type==="checkbox"||m.type==="radio")&&(j=KS);if(j&&(j=j(e,u))){yv(h,j,r,d);break e}k&&k(e,m,u),e==="focusout"&&(k=m._wrapperState)&&k.controlled&&m.type==="number"&&Ah(m,"number",m.value)}switch(k=u?qa(u):window,e){case"focusin":(Sg(k)||k.contentEditable==="true")&&(Fa=k,Bh=u,go=null);break;case"focusout":go=Bh=Fa=null;break;case"mousedown":Wh=!0;break;case"contextmenu":case"mouseup":case"dragend":Wh=!1,Pg(h,r,d);break;case"selectionchange":if(XS)break;case"keydown":case"keyup":Pg(h,r,d)}var S;if(Cm)e:{switch(e){case"compositionstart":var C="onCompositionStart";break e;case"compositionend":C="onCompositionEnd";break e;case"compositionupdate":C="onCompositionUpdate";break e}C=void 0}else $a?gv(e,r)&&(C="onCompositionEnd"):e==="keydown"&&r.keyCode===229&&(C="onCompositionStart");C&&(pv&&r.locale!=="ko"&&($a||C!=="onCompositionStart"?C==="onCompositionEnd"&&$a&&(S=mv()):(Xn=d,km="value"in Xn?Xn.value:Xn.textContent,$a=!0)),k=Dc(u,C),0<k.length&&(C=new bg(C,e,null,r,d),h.push({event:C,listeners:k}),S?C.data=S:(S=xv(r),S!==null&&(C.data=S)))),(S=qS?zS(e,r):BS(e,r))&&(u=Dc(u,"onBeforeInput"),0<u.length&&(d=new bg("onBeforeInput","beforeinput",null,r,d),h.push({event:d,listeners:u}),d.data=S))}Tv(h,t)})}function Oo(e,t,r){return{instance:e,listener:t,currentTarget:r}}function Dc(e,t){for(var r=t+"Capture",n=[];e!==null;){var s=e,a=s.stateNode;s.tag===5&&a!==null&&(s=a,a=No(e,r),a!=null&&n.unshift(Oo(e,a,s)),a=No(e,t),a!=null&&n.push(Oo(e,a,s))),e=e.return}return n}function wa(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function Og(e,t,r,n,s){for(var a=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=No(r,a),c!=null&&o.unshift(Oo(r,c,l))):s||(c=No(r,a),c!=null&&o.push(Oo(r,c,l)))),r=r.return}o.length!==0&&e.push({event:t,listeners:o})}var nN=/\r\n?/g,sN=/\u0000|\uFFFD/g;function Ig(e){return(typeof e=="string"?e:""+e).replace(nN,` 38`).replace(sN,"")}function Il(e,t,r){if(t=Ig(t),Ig(e)!==t&&r)throw Error(q(425))}function Lc(){}var Hh=null,Vh=null;function Gh(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 Yh=typeof setTimeout=="function"?setTimeout:void 0,aN=typeof clearTimeout=="function"?clearTimeout:void 0,Mg=typeof Promise=="function"?Promise:void 0,iN=typeof queueMicrotask=="function"?queueMicrotask:typeof Mg<"u"?function(e){return Mg.resolve(null).then(e).catch(oN)}:Yh;function oN(e){setTimeout(function(){throw e})}function Ld(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),To(t);return}n--}else r!=="$"&&r!=="$?"&&r!=="$!"||n++;r=s}while(r);To(t)}function is(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 Dg(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 Ai=Math.random().toString(36).slice(2),zr="__reactFiber$"+Ai,Io="__reactProps$"+Ai,xn="__reactContainer$"+Ai,Kh="__reactEvents$"+Ai,lN="__reactListeners$"+Ai,cN="__reactHandles$"+Ai;function zs(e){var t=e[zr];if(t)return t;for(var r=e.parentNode;r;){if(t=r[xn]||r[zr]){if(r=t.alternate,t.child!==null||r!==null&&r.child!==null)for(e=Dg(e);e!==null;){if(r=e[zr])return r;e=Dg(e)}return t}e=r,r=e.parentNode}return null}function dl(e){return e=e[zr]||e[xn],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function qa(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(q(33))}function Ru(e){return e[Io]||null}var Qh=[],za=-1;function ks(e){return{current:e}}function Le(e){0>za||(e.current=Qh[za],Qh[za]=null,za--)}function Ie(e,t){za++,Qh[za]=e.current,e.current=t}var gs={},bt=ks(gs),Dt=ks(!1),ea=gs;function mi(e,t){var r=e.type.contextTypes;if(!r)return gs;var n=e.stateNode;if(n&&n.__reactInternalMemoizedUnmaskedChildContext===t)return n.__reactInternalMemoizedMaskedChildContext;var s={},a;for(a in r)s[a]=t[a];return n&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=s),s}function Lt(e){return e=e.childContextTypes,e!=null}function $c(){Le(Dt),Le(bt)}function Lg(e,t,r){if(bt.current!==gs)throw Error(q(168));Ie(bt,t),Ie(Dt,r)}function Av(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(q(108,Gk(e)||"Unknown",s));return We({},r,n)}function Fc(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||gs,ea=bt.current,Ie(bt,e),Ie(Dt,Dt.current),!0}function $g(e,t,r){var n=e.stateNode;if(!n)throw Error(q(169));r?(e=Av(e,t,ea),n.__reactInternalMemoizedMergedChildContext=e,Le(Dt),Le(bt),Ie(bt,e)):Le(Dt),Ie(Dt,r)}var un=null,Ou=!1,$d=!1;function Rv(e){un===null?un=[e]:un.push(e)}function uN(e){Ou=!0,Rv(e)}function Ss(){if(!$d&&un!==null){$d=!0;var e=0,t=Pe;try{var r=un;for(Pe=1;e<r.length;e++){var n=r[e];do n=n(!0);while(n!==null)}un=null,Ou=!1}catch(s){throw un!==null&&(un=un.slice(e+1)),nv(wm,Ss),s}finally{Pe=t,$d=!1}}return null}var Ba=[],Wa=0,Uc=null,qc=0,Xt=[],er=0,ta=null,hn=1,fn="";function Ds(e,t){Ba[Wa++]=qc,Ba[Wa++]=Uc,Uc=e,qc=t}
vendor: 13,505 bytes, line 38
38function Ov(e,t,r){Xt[er++]=hn,Xt[er++]=fn,Xt[er++]=ta,ta=e;var n=hn;e=fn;var s=32-Sr(n)-1;n&=~(1<<s),r+=1;var a=32-Sr(t)+s;if(30<a){var o=s-s%5;a=(n&(1<<o)-1).toString(32),n>>=o,s-=o,hn=1<<32-Sr(t)+s|r<<s|n,fn=a+e}else hn=1<<a|r<<s|n,fn=e}function Tm(e){e.return!==null&&(Ds(e,1),Ov(e,1,0))}function Pm(e){for(;e===Uc;)Uc=Ba[--Wa],Ba[Wa]=null,qc=Ba[--Wa],Ba[Wa]=null;for(;e===ta;)ta=Xt[--er],Xt[er]=null,fn=Xt[--er],Xt[er]=null,hn=Xt[--er],Xt[er]=null}var Wt=null,Bt=null,qe=!1,kr=null;function Iv(e,t){var r=tr(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 Fg(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,Wt=e,Bt=is(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,Wt=e,Bt=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(r=ta!==null?{id:hn,overflow:fn}:null,e.memoizedState={dehydrated:t,treeContext:r,retryLane:1073741824},r=tr(18,null,null,0),r.stateNode=t,r.return=e,e.child=r,Wt=e,Bt=null,!0):!1;default:return!1}}function Jh(e){return(e.mode&1)!==0&&(e.flags&128)===0}function Zh(e){if(qe){var t=Bt;if(t){var r=t;if(!Fg(e,t)){if(Jh(e))throw Error(q(418));t=is(r.nextSibling);var n=Wt;t&&Fg(e,t)?Iv(n,r):(e.flags=e.flags&-4097|2,qe=!1,Wt=e)}}else{if(Jh(e))throw Error(q(418));e.flags=e.flags&-4097|2,qe=!1,Wt=e}}}function Ug(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;Wt=e}function Ml(e){if(e!==Wt)return!1;if(!qe)return Ug(e),qe=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!=="head"&&t!=="body"&&!Gh(e.type,e.memoizedProps)),t&&(t=Bt)){if(Jh(e))throw Mv(),Error(q(418));for(;t;)Iv(e,t),t=is(t.nextSibling)}if(Ug(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(q(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var r=e.data;if(r==="/$"){if(t===0){Bt=is(e.nextSibling);break e}t--}else r!=="$"&&r!=="$!"&&r!=="$?"||t++}e=e.nextSibling}Bt=null}}else Bt=Wt?is(e.stateNode.nextSibling):null;return!0}function Mv(){for(var e=Bt;e;)e=is(e.nextSibling)}function pi(){Bt=Wt=null,qe=!1}function Am(e){kr===null?kr=[e]:kr.push(e)}var dN=Nn.ReactCurrentBatchConfig;function Ki(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(q(309));var n=r.stateNode}if(!n)throw Error(q(147,e));var s=n,a=""+e;return t!==null&&t.ref!==null&&typeof t.ref=="function"&&t.ref._stringRef===a?t.ref:(t=function(o){var l=s.refs;o===null?delete l[a]:l[a]=o},t._stringRef=a,t)}if(typeof e!="string")throw Error(q(284));if(!r._owner)throw Error(q(290,e))}return e}function Dl(e,t){throw e=Object.prototype.toString.call(t),Error(q(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function qg(e){var t=e._init;return t(e._payload)}function Dv(e){function t(x,y){if(e){var w=x.deletions;w===null?(x.deletions=[y],x.flags|=16):w.push(y)}}function r(x,y){if(!e)return null;for(;y!==null;)t(x,y),y=y.sibling;return null}function n(x,y){for(x=new Map;y!==null;)y.key!==null?x.set(y.key,y):x.set(y.index,y),y=y.sibling;return x}function s(x,y){return x=us(x,y),x.index=0,x.sibling=null,x}function a(x,y,w){return x.index=w,e?(w=x.alternate,w!==null?(w=w.index,w<y?(x.flags|=2,y):w):(x.flags|=2,y)):(x.flags|=1048576,y)}function o(x){return e&&x.alternate===null&&(x.flags|=2),x}function l(x,y,w,_){return y===null||y.tag!==6?(y=Hd(w,x.mode,_),y.return=x,y):(y=s(y,w),y.return=x,y)}function c(x,y,w,_){var j=w.type;return j===La?d(x,y,w.props.children,_,w.key):y!==null&&(y.elementType===j||typeof j=="object"&&j!==null&&j.$$typeof===qn&&qg(j)===y.type)?(_=s(y,w.props),_.ref=Ki(x,y,w),_.return=x,_):(_=vc(w.type,w.key,w.props,null,x.mode,_),_.ref=Ki(x,y,w),_.return=x,_)}function u(x,y,w,_){return y===null||y.tag!==4||y.stateNode.containerInfo!==w.containerInfo||y.stateNode.implementation!==w.implementation?(y=Vd(w,x.mode,_),y.return=x,y):(y=s(y,w.children||[]),y.return=x,y)}function d(x,y,w,_,j){return y===null||y.tag!==7?(y=Xs(w,x.mode,_,j),y.return=x,y):(y=s(y,w),y.return=x,y)}function h(x,y,w){if(typeof y=="string"&&y!==""||typeof y=="number")return y=Hd(""+y,x.mode,w),y.return=x,y;if(typeof y=="object"&&y!==null){switch(y.$$typeof){case Sl:return w=vc(y.type,y.key,y.props,null,x.mode,w),w.ref=Ki(x,null,y),w.return=x,w;case Da:return y=Vd(y,x.mode,w),y.return=x,y;case qn:var _=y._init;return h(x,_(y._payload),w)}if(ao(y)||Wi(y))return y=Xs(y,x.mode,w,null),y.return=x,y;Dl(x,y)}return null}function m(x,y,w,_){var j=y!==null?y.key:null;if(typeof w=="string"&&w!==""||typeof w=="number")return j!==null?null:l(x,y,""+w,_);if(typeof w=="object"&&w!==null){switch(w.$$typeof){case Sl:return w.key===j?c(x,y,w,_):null;case Da:return w.key===j?u(x,y,w,_):null;case qn:return j=w._init,m(x,y,j(w._payload),_)}if(ao(w)||Wi(w))return j!==null?null:d(x,y,w,_,null);Dl(x,w)}return null}function f(x,y,w,_,j){if(typeof _=="string"&&_!==""||typeof _=="number")return x=x.get(w)||null,l(y,x,""+_,j);if(typeof _=="object"&&_!==null){switch(_.$$typeof){case Sl:return x=x.get(_.key===null?w:_.key)||null,c(y,x,_,j);case Da:return x=x.get(_.key===null?w:_.key)||null,u(y,x,_,j);case qn:var k=_._init;return f(x,y,w,k(_._payload),j)}if(ao(_)||Wi(_))return x=x.get(w)||null,d(y,x,_,j,null);Dl(y,_)}return null}function b(x,y,w,_){for(var j=null,k=null,S=y,C=y=0,P=null;S!==null&&C<w.length;C++){S.index>C?(P=S,S=null):P=S.sibling;var T=m(x,S,w[C],_);if(T===null){S===null&&(S=P);break}e&&S&&T.alternate===null&&t(x,S),y=a(T,y,C),k===null?j=T:k.sibling=T,k=T,S=P}if(C===w.length)return r(x,S),qe&&Ds(x,C),j;if(S===null){for(;C<w.length;C++)S=h(x,w[C],_),S!==null&&(y=a(S,y,C),k===null?j=S:k.sibling=S,k=S);return qe&&Ds(x,C),j}for(S=n(x,S);C<w.length;C++)P=f(S,x,C,w[C],_),P!==null&&(e&&P.alternate!==null&&S.delete(P.key===null?C:P.key),y=a(P,y,C),k===null?j=P:k.sibling=P,k=P);return e&&S.forEach(function($){return t(x,$)}),qe&&Ds(x,C),j}function g(x,y,w,_){var j=Wi(w);if(typeof j!="function")throw Error(q(150));if(w=j.call(w),w==null)throw Error(q(151));for(var k=j=null,S=y,C=y=0,P=null,T=w.next();S!==null&&!T.done;C++,T=w.next()){S.index>C?(P=S,S=null):P=S.sibling;var $=m(x,S,T.value,_);if($===null){S===null&&(S=P);break}e&&S&&$.alternate===null&&t(x,S),y=a($,y,C),k===null?j=$:k.sibling=$,k=$,S=P}if(T.done)return r(x,S),qe&&Ds(x,C),j;if(S===null){for(;!T.done;C++,T=w.next())T=h(x,T.value,_),T!==null&&(y=a(T,y,C),k===null?j=T:k.sibling=T,k=T);return qe&&Ds(x,C),j}for(S=n(x,S);!T.done;C++,T=w.next())T=f(S,x,C,T.value,_),T!==null&&(e&&T.alternate!==null&&S.delete(T.key===null?C:T.key),y=a(T,y,C),k===null?j=T:k.sibling=T,k=T);return e&&S.forEach(function(O){return t(x,O)}),qe&&Ds(x,C),j}function v(x,y,w,_){if(typeof w=="object"&&w!==null&&w.type===La&&w.key===null&&(w=w.props.children),typeof w=="object"&&w!==null){switch(w.$$typeof){case Sl:e:{for(var j=w.key,k=y;k!==null;){if(k.key===j){if(j=w.type,j===La){if(k.tag===7){r(x,k.sibling),y=s(k,w.props.children),y.return=x,x=y;break e}}else if(k.elementType===j||typeof j=="object"&&j!==null&&j.$$typeof===qn&&qg(j)===k.type){r(x,k.sibling),y=s(k,w.props),y.ref=Ki(x,k,w),y.return=x,x=y;break e}r(x,k);break}else t(x,k);k=k.sibling}w.type===La?(y=Xs(w.props.children,x.mode,_,w.key),y.return=x,x=y):(_=vc(w.type,w.key,w.props,null,x.mode,_),_.ref=Ki(x,y,w),_.return=x,x=_)}return o(x);case Da:e:{for(k=w.key;y!==null;){if(y.key===k)if(y.tag===4&&y.stateNode.containerInfo===w.containerInfo&&y.stateNode.implementation===w.implementation){r(x,y.sibling),y=s(y,w.children||[]),y.return=x,x=y;break e}else{r(x,y);break}else t(x,y);y=y.sibling}y=Vd(w,x.mode,_),y.return=x,x=y}return o(x);case qn:return k=w._init,v(x,y,k(w._payload),_)}if(ao(w))return b(x,y,w,_);if(Wi(w))return g(x,y,w,_);Dl(x,w)}return typeof w=="string"&&w!==""||typeof w=="number"?(w=""+w,y!==null&&y.tag===6?(r(x,y.sibling),y=s(y,w),y.return=x,x=y):(r(x,y),y=Hd(w,x.mode,_),y.return=x,x=y),o(x)):r(x,y)}return v}var gi=Dv(!0),Lv=Dv(!1),zc=ks(null),Bc=null,Ha=null,Rm=null;function Om(){Rm=Ha=Bc=null}function Im(e){var t=zc.current;Le(zc),e._currentValue=t}function Xh(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 Xa(e,t){Bc=e,Rm=Ha=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(Ot=!0),e.firstContext=null)}function ar(e){var t=e._currentValue;if(Rm!==e)if(e={context:e,memoizedValue:t,next:null},Ha===null){if(Bc===null)throw Error(q(308));Ha=e,Bc.dependencies={lanes:0,firstContext:e}}else Ha=Ha.next=e;return t}var Bs=null;function Mm(e){Bs===null?Bs=[e]:Bs.push(e)}function $v(e,t,r,n){var s=t.interleaved;return s===null?(r.next=r,Mm(t)):(r.next=s.next,s.next=r),t.interleaved=r,yn(e,n)}function yn(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 zn=!1;function Dm(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Fv(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 pn(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function os(e,t,r){var n=e.updateQueue;if(n===null)return null;if(n=n.shared,je&2){var s=n.pending;return s===null?t.next=t:(t.next=s.next,s.next=t),n.pending=t,yn(e,r)}return s=n.interleaved,s===null?(t.next=t,Mm(n)):(t.next=s.next,s.next=t),n.interleaved=t,yn(e,r)}function fc(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,bm(e,r)}}function zg(e,t){var r=e.updateQueue,n=e.alternate;if(n!==null&&(n=n.updateQueue,r===n)){var s=null,a=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};a===null?s=a=o:a=a.next=o,r=r.next}while(r!==null);a===null?s=a=t:a=a.next=t}else s=a=t;r={baseState:n.baseState,firstBaseUpdate:s,lastBaseUpdate:a,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 Wc(e,t,r,n){var s=e.updateQueue;zn=!1;var a=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?a=u:o.next=u,o=c;var d=e.alternate;d!==null&&(d=d.updateQueue,l=d.lastBaseUpdate,l!==o&&(l===null?d.firstBaseUpdate=u:l.next=u,d.lastBaseUpdate=c))}if(a!==null){var h=s.baseState;o=0,d=u=c=null,l=a;do{var m=l.lane,f=l.eventTime;if((n&m)===m){d!==null&&(d=d.next={eventTime:f,lane:0,tag:l.tag,payload:l.payload,callback:l.callback,next:null});e:{var b=e,g=l;switch(m=t,f=r,g.tag){case 1:if(b=g.payload,typeof b=="function"){h=b.call(f,h,m);break e}h=b;break e;case 3:b.flags=b.flags&-65537|128;case 0:if(b=g.payload,m=typeof b=="function"?b.call(f,h,m):b,m==null)break e;h=We({},h,m);break e;case 2:zn=!0}}l.callback!==null&&l.lane!==0&&(e.flags|=64,m=s.effects,m===null?s.effects=[l]:m.push(l))}else f={eventTime:f,lane:m,tag:l.tag,payload:l.payload,callback:l.callback,next:null},d===null?(u=d=f,c=h):d=d.next=f,o|=m;if(l=l.next,l===null){if(l=s.shared.pending,l===null)break;m=l,l=m.next,m.next=null,s.lastBaseUpdate=m,s.shared.pending=null}}while(!0);if(d===null&&(c=h),s.baseState=c,s.firstBaseUpdate=u,s.lastBaseUpdate=d,t=s.shared.interleaved,t!==null){s=t;do o|=s.lane,s=s.next;while(s!==t)}else a===null&&(s.shared.lanes=0);na|=o,e.lanes=o,e.memoizedState=h}}function Bg(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(q(191,s));s.call(n)}}}var hl={},Vr=ks(hl),Mo=ks(hl),Do=ks(hl);function Ws(e){if(e===hl)throw Error(q(174));return e}function Lm(e,t){switch(Ie(Do,t),Ie(Mo,e),Ie(Vr,hl),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:Oh(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=Oh(t,e)}Le(Vr),Ie(Vr,t)}function xi(){Le(Vr),Le(Mo),Le(Do)}function Uv(e){Ws(Do.current);var t=Ws(Vr.current),r=Oh(t,e.type);t!==r&&(Ie(Mo,e),Ie(Vr,r))}function $m(e){Mo.current===e&&(Le(Vr),Le(Mo))}var ze=ks(0);function Hc(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 Fd=[];function Fm(){for(var e=0;e<Fd.length;e++)Fd[e]._workInProgressVersionPrimary=null;Fd.length=0}var mc=Nn.ReactCurrentDispatcher,Ud=Nn.ReactCurrentBatchConfig,ra=0,Be=null,rt=null,at=null,Vc=!1,xo=!1,Lo=0,hN=0;function gt(){throw Error(q(321))}function Um(e,t){if(t===null)return!1;for(var r=0;r<t.length&&r<e.length;r++)if(!Er(e[r],t[r]))return!1;return!0}function qm(e,t,r,n,s,a){if(ra=a,Be=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,mc.current=e===null||e.memoizedState===null?gN:xN,e=r(n,s),xo){a=0;
vendor: 6,592 bytes, line 38
38do{if(xo=!1,Lo=0,25<=a)throw Error(q(301));a+=1,at=rt=null,t.updateQueue=null,mc.current=yN,e=r(n,s)}while(xo)}if(mc.current=Gc,t=rt!==null&&rt.next!==null,ra=0,at=rt=Be=null,Vc=!1,t)throw Error(q(300));return e}function zm(){var e=Lo!==0;return Lo=0,e}function $r(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return at===null?Be.memoizedState=at=e:at=at.next=e,at}function ir(){if(rt===null){var e=Be.alternate;e=e!==null?e.memoizedState:null}else e=rt.next;var t=at===null?Be.memoizedState:at.next;if(t!==null)at=t,rt=e;else{if(e===null)throw Error(q(310));rt=e,e={memoizedState:rt.memoizedState,baseState:rt.baseState,baseQueue:rt.baseQueue,queue:rt.queue,next:null},at===null?Be.memoizedState=at=e:at=at.next=e}return at}function $o(e,t){return typeof t=="function"?t(e):t}function qd(e){var t=ir(),r=t.queue;if(r===null)throw Error(q(311));r.lastRenderedReducer=e;var n=rt,s=n.baseQueue,a=r.pending;if(a!==null){if(s!==null){var o=s.next;s.next=a.next,a.next=o}n.baseQueue=s=a,r.pending=null}if(s!==null){a=s.next,n=n.baseState;var l=o=null,c=null,u=a;do{var d=u.lane;if((ra&d)===d)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 h={lane:d,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null};c===null?(l=c=h,o=n):c=c.next=h,Be.lanes|=d,na|=d}u=u.next}while(u!==null&&u!==a);c===null?o=n:c.next=l,Er(n,t.memoizedState)||(Ot=!0),t.memoizedState=n,t.baseState=o,t.baseQueue=c,r.lastRenderedState=n}if(e=r.interleaved,e!==null){s=e;do a=s.lane,Be.lanes|=a,na|=a,s=s.next;while(s!==e)}else s===null&&(r.lanes=0);return[t.memoizedState,r.dispatch]}function zd(e){var t=ir(),r=t.queue;if(r===null)throw Error(q(311));r.lastRenderedReducer=e;var n=r.dispatch,s=r.pending,a=t.memoizedState;if(s!==null){r.pending=null;var o=s=s.next;do a=e(a,o.action),o=o.next;while(o!==s);Er(a,t.memoizedState)||(Ot=!0),t.memoizedState=a,t.baseQueue===null&&(t.baseState=a),r.lastRenderedState=a}return[a,n]}function qv(){}function zv(e,t){var r=Be,n=ir(),s=t(),a=!Er(n.memoizedState,s);if(a&&(n.memoizedState=s,Ot=!0),n=n.queue,Bm(Hv.bind(null,r,n,e),[e]),n.getSnapshot!==t||a||at!==null&&at.memoizedState.tag&1){if(r.flags|=2048,Fo(9,Wv.bind(null,r,n,s,t),void 0,null),ot===null)throw Error(q(349));ra&30||Bv(r,t,s)}return s}function Bv(e,t,r){e.flags|=16384,e={getSnapshot:t,value:r},t=Be.updateQueue,t===null?(t={lastEffect:null,stores:null},Be.updateQueue=t,t.stores=[e]):(r=t.stores,r===null?t.stores=[e]:r.push(e))}function Wv(e,t,r,n){t.value=r,t.getSnapshot=n,Vv(t)&&Gv(e)}function Hv(e,t,r){return r(function(){Vv(t)&&Gv(e)})}function Vv(e){var t=e.getSnapshot;e=e.value;try{var r=t();return!Er(e,r)}catch{return!0}}function Gv(e){var t=yn(e,1);t!==null&&Nr(t,e,1,-1)}function Wg(e){var t=$r();return typeof e=="function"&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:$o,lastRenderedState:e},t.queue=e,e=e.dispatch=pN.bind(null,Be,e),[t.memoizedState,e]}function Fo(e,t,r,n){return e={tag:e,create:t,destroy:r,deps:n,next:null},t=Be.updateQueue,t===null?(t={lastEffect:null,stores:null},Be.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 Yv(){return ir().memoizedState}function pc(e,t,r,n){var s=$r();Be.flags|=e,s.memoizedState=Fo(1|t,r,void 0,n===void 0?null:n)}function Iu(e,t,r,n){var s=ir();n=n===void 0?null:n;var a=void 0;if(rt!==null){var o=rt.memoizedState;if(a=o.destroy,n!==null&&Um(n,o.deps)){s.memoizedState=Fo(t,r,a,n);return}}Be.flags|=e,s.memoizedState=Fo(1|t,r,a,n)}function Hg(e,t){return pc(8390656,8,e,t)}function Bm(e,t){return Iu(2048,8,e,t)}function Kv(e,t){return Iu(4,2,e,t)}function Qv(e,t){return Iu(4,4,e,t)}function Jv(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 Zv(e,t,r){return r=r!=null?r.concat([e]):null,Iu(4,4,Jv.bind(null,t,e),r)}function Wm(){}function Xv(e,t){var r=ir();t=t===void 0?null:t;var n=r.memoizedState;return n!==null&&t!==null&&Um(t,n[1])?n[0]:(r.memoizedState=[e,t],e)}function ew(e,t){var r=ir();t=t===void 0?null:t;var n=r.memoizedState;return n!==null&&t!==null&&Um(t,n[1])?n[0]:(e=e(),r.memoizedState=[e,t],e)}function tw(e,t,r){return ra&21?(Er(r,t)||(r=iv(),Be.lanes|=r,na|=r,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,Ot=!0),e.memoizedState=r)}function fN(e,t){var r=Pe;Pe=r!==0&&4>r?r:4,e(!0);var n=Ud.transition;Ud.transition={};try{e(!1),t()}finally{Pe=r,Ud.transition=n}}function rw(){return ir().memoizedState}function mN(e,t,r){var n=cs(e);if(r={lane:n,action:r,hasEagerState:!1,eagerState:null,next:null},nw(e))sw(t,r);else if(r=$v(e,t,r,n),r!==null){var s=Ct();Nr(r,e,n,s),aw(r,t,n)}}function pN(e,t,r){var n=cs(e),s={lane:n,action:r,hasEagerState:!1,eagerState:null,next:null};if(nw(e))sw(t,s);else{var a=e.alternate;if(e.lanes===0&&(a===null||a.lanes===0)&&(a=t.lastRenderedReducer,a!==null))try{var o=t.lastRenderedState,l=a(o,r);if(s.hasEagerState=!0,s.eagerState=l,Er(l,o)){var c=t.interleaved;c===null?(s.next=s,Mm(t)):(s.next=c.next,c.next=s),t.interleaved=s;return}}catch{}finally{}r=$v(e,t,s,n),r!==null&&(s=Ct(),Nr(r,e,n,s),aw(r,t,n))}}function nw(e){var t=e.alternate;return e===Be||t!==null&&t===Be}function sw(e,t){xo=Vc=!0;var r=e.pending;r===null?t.next=t:(t.next=r.next,r.next=t),e.pending=t}function aw(e,t,r){if(r&4194240){var n=t.lanes;n&=e.pendingLanes,r|=n,t.lanes=r,bm(e,r)}}var Gc={readContext:ar,useCallback:gt,useContext:gt,useEffect:gt,useImperativeHandle:gt,useInsertionEffect:gt,useLayoutEffect:gt,useMemo:gt,useReducer:gt,useRef:gt,useState:gt,useDebugValue:gt,useDeferredValue:gt,useTransition:gt,useMutableSource:gt,useSyncExternalStore:gt,useId:gt,unstable_isNewReconciler:!1},gN={readContext:ar,useCallback:function(e,t){return $r().memoizedState=[e,t===void 0?null:t],e},useContext:ar,useEffect:Hg,useImperativeHandle:function(e,t,r){return r=r!=null?r.concat([e]):null,pc(4194308,4,Jv.bind(null,t,e),r)},useLayoutEffect:function(e,t){return pc(4194308,4,e,t)},useInsertionEffect:function(e,t){return pc(4,2,e,t)},useMemo:function(e,t){var r=$r();return t=t===void 0?null:t,e=e(),r.memoizedState=[e,t],e},useReducer:function(e,t,r){var n=$r();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=mN.bind(null,Be,e),[n.memoizedState,e]}
vendor: 5,922 bytes, lines 38-40
38,useRef:function(e){var t=$r();return e={current:e},t.memoizedState=e},useState:Wg,useDebugValue:Wm,useDeferredValue:function(e){return $r().memoizedState=e},useTransition:function(){var e=Wg(!1),t=e[0];return e=fN.bind(null,e[1]),$r().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,r){var n=Be,s=$r();if(qe){if(r===void 0)throw Error(q(407));r=r()}else{if(r=t(),ot===null)throw Error(q(349));ra&30||Bv(n,t,r)}s.memoizedState=r;var a={value:r,getSnapshot:t};return s.queue=a,Hg(Hv.bind(null,n,a,e),[e]),n.flags|=2048,Fo(9,Wv.bind(null,n,a,r,t),void 0,null),r},useId:function(){var e=$r(),t=ot.identifierPrefix;if(qe){var r=fn,n=hn;r=(n&~(1<<32-Sr(n)-1)).toString(32)+r,t=":"+t+"R"+r,r=Lo++,0<r&&(t+="H"+r.toString(32)),t+=":"}else r=hN++,t=":"+t+"r"+r.toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},xN={readContext:ar,useCallback:Xv,useContext:ar,useEffect:Bm,useImperativeHandle:Zv,useInsertionEffect:Kv,useLayoutEffect:Qv,useMemo:ew,useReducer:qd,useRef:Yv,useState:function(){return qd($o)},useDebugValue:Wm,useDeferredValue:function(e){var t=ir();return tw(t,rt.memoizedState,e)},useTransition:function(){var e=qd($o)[0],t=ir().memoizedState;return[e,t]},useMutableSource:qv,useSyncExternalStore:zv,useId:rw,unstable_isNewReconciler:!1},yN={readContext:ar,useCallback:Xv,useContext:ar,useEffect:Bm,useImperativeHandle:Zv,useInsertionEffect:Kv,useLayoutEffect:Qv,useMemo:ew,useReducer:zd,useRef:Yv,useState:function(){return zd($o)},useDebugValue:Wm,useDeferredValue:function(e){var t=ir();return rt===null?t.memoizedState=e:tw(t,rt.memoizedState,e)},useTransition:function(){var e=zd($o)[0],t=ir().memoizedState;return[e,t]},useMutableSource:qv,useSyncExternalStore:zv,useId:rw,unstable_isNewReconciler:!1};function xr(e,t){if(e&&e.defaultProps){t=We({},t),e=e.defaultProps;for(var r in e)t[r]===void 0&&(t[r]=e[r]);return t}return t}function ef(e,t,r,n){t=e.memoizedState,r=r(n,t),r=r==null?t:We({},t,r),e.memoizedState=r,e.lanes===0&&(e.updateQueue.baseState=r)}var Mu={isMounted:function(e){return(e=e._reactInternals)?ha(e)===e:!1},enqueueSetState:function(e,t,r){e=e._reactInternals;var n=Ct(),s=cs(e),a=pn(n,s);a.payload=t,r!=null&&(a.callback=r),t=os(e,a,s),t!==null&&(Nr(t,e,s,n),fc(t,e,s))},enqueueReplaceState:function(e,t,r){e=e._reactInternals;var n=Ct(),s=cs(e),a=pn(n,s);a.tag=1,a.payload=t,r!=null&&(a.callback=r),t=os(e,a,s),t!==null&&(Nr(t,e,s,n),fc(t,e,s))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var r=Ct(),n=cs(e),s=pn(r,n);s.tag=2,t!=null&&(s.callback=t),t=os(e,s,n),t!==null&&(Nr(t,e,n,r),fc(t,e,n))}};function Vg(e,t,r,n,s,a,o){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(n,a,o):t.prototype&&t.prototype.isPureReactComponent?!Ao(r,n)||!Ao(s,a):!0}function iw(e,t,r){var n=!1,s=gs,a=t.contextType;return typeof a=="object"&&a!==null?a=ar(a):(s=Lt(t)?ea:bt.current,n=t.contextTypes,a=(n=n!=null)?mi(e,s):gs),t=new t(r,a),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=Mu,e.stateNode=t,t._reactInternals=e,n&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=s,e.__reactInternalMemoizedMaskedChildContext=a),t}function Gg(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&&Mu.enqueueReplaceState(t,t.state,null)}function tf(e,t,r,n){var s=e.stateNode;s.props=r,s.state=e.memoizedState,s.refs={},Dm(e);var a=t.contextType;typeof a=="object"&&a!==null?s.context=ar(a):(a=Lt(t)?ea:bt.current,s.context=mi(e,a)),s.state=e.memoizedState,a=t.getDerivedStateFromProps,typeof a=="function"&&(ef(e,t,a,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&&Mu.enqueueReplaceState(s,s.state,null),Wc(e,r,s,n),s.state=e.memoizedState),typeof s.componentDidMount=="function"&&(e.flags|=4194308)}function yi(e,t){try{var r="",n=t;do r+=Vk(n),n=n.return;while(n);var s=r}catch(a){s=` 39Error generating stack: `+a.message+` 40`+a.stack}return{value:e,source:t,stack:s,digest:null}}function Bd(e,t,r){return{value:e,source:null,stack:r??null,digest:t??null}}function rf(e,t){try{console.error(t.value)}catch(r){setTimeout(function(){throw r})}}var vN=typeof WeakMap=="function"?WeakMap:Map;function ow(e,t,r){r=pn(-1,r),r.tag=3,r.payload={element:null};var n=t.value;return r.callback=function(){Kc||(Kc=!0,ff=n),rf(e,t)},r}function lw(e,t,r){r=pn(-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(){rf(e,t)}}var a=e.stateNode;return a!==null&&typeof a.componentDidCatch=="function"&&(r.callback=function(){rf(e,t),typeof n!="function"&&(ls===null?ls=new Set([this]):ls.add(this));var o=t.stack;this.componentDidCatch(t.value,{componentStack:o!==null?o:""})}),r}function Yg(e,t,r){var n=e.pingCache;if(n===null){n=e.pingCache=new vN;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=ON.bind(null,e,t,r),t.then(e,e))}function Kg(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 Qg(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=pn(-1,1),t.tag=2,os(r,t,1))),r.lanes|=1),e)}var wN=Nn.ReactCurrentOwner,Ot=!1;function jt(e,t,r,n){t.child=e===null?Lv(t,null,r,n):gi(t,e.child,r,n)}function Jg(e,t,r,n,s){r=r.render;var a=t.ref;
vendor: 6,220 bytes, line 40
40return Xa(t,s),n=qm(e,t,r,n,a,s),r=zm(),e!==null&&!Ot?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~s,vn(e,t,s)):(qe&&r&&Tm(t),t.flags|=1,jt(e,t,n,s),t.child)}function Zg(e,t,r,n,s){if(e===null){var a=r.type;return typeof a=="function"&&!Zm(a)&&a.defaultProps===void 0&&r.compare===null&&r.defaultProps===void 0?(t.tag=15,t.type=a,cw(e,t,a,n,s)):(e=vc(r.type,null,n,t,t.mode,s),e.ref=t.ref,e.return=t,t.child=e)}if(a=e.child,!(e.lanes&s)){var o=a.memoizedProps;if(r=r.compare,r=r!==null?r:Ao,r(o,n)&&e.ref===t.ref)return vn(e,t,s)}return t.flags|=1,e=us(a,n),e.ref=t.ref,e.return=t,t.child=e}function cw(e,t,r,n,s){if(e!==null){var a=e.memoizedProps;if(Ao(a,n)&&e.ref===t.ref)if(Ot=!1,t.pendingProps=n=a,(e.lanes&s)!==0)e.flags&131072&&(Ot=!0);else return t.lanes=e.lanes,vn(e,t,s)}return nf(e,t,r,n,s)}function uw(e,t,r){var n=t.pendingProps,s=n.children,a=e!==null?e.memoizedState:null;if(n.mode==="hidden")if(!(t.mode&1))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},Ie(Ga,Ut),Ut|=r;else{if(!(r&1073741824))return e=a!==null?a.baseLanes|r:r,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,Ie(Ga,Ut),Ut|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},n=a!==null?a.baseLanes:r,Ie(Ga,Ut),Ut|=n}else a!==null?(n=a.baseLanes|r,t.memoizedState=null):n=r,Ie(Ga,Ut),Ut|=n;return jt(e,t,s,r),t.child}function dw(e,t){var r=t.ref;(e===null&&r!==null||e!==null&&e.ref!==r)&&(t.flags|=512,t.flags|=2097152)}function nf(e,t,r,n,s){var a=Lt(r)?ea:bt.current;return a=mi(t,a),Xa(t,s),r=qm(e,t,r,n,a,s),n=zm(),e!==null&&!Ot?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~s,vn(e,t,s)):(qe&&n&&Tm(t),t.flags|=1,jt(e,t,r,s),t.child)}function Xg(e,t,r,n,s){if(Lt(r)){var a=!0;Fc(t)}else a=!1;if(Xa(t,s),t.stateNode===null)gc(e,t),iw(t,r,n),tf(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=ar(u):(u=Lt(r)?ea:bt.current,u=mi(t,u));var d=r.getDerivedStateFromProps,h=typeof d=="function"||typeof o.getSnapshotBeforeUpdate=="function";h||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(l!==n||c!==u)&&Gg(t,o,n,u),zn=!1;var m=t.memoizedState;o.state=m,Wc(t,n,o,s),c=t.memoizedState,l!==n||m!==c||Dt.current||zn?(typeof d=="function"&&(ef(t,r,d,n),c=t.memoizedState),(l=zn||Vg(t,r,l,n,m,c,u))?(h||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,Fv(e,t),l=t.memoizedProps,u=t.type===t.elementType?l:xr(t.type,l),o.props=u,h=t.pendingProps,m=o.context,c=r.contextType,typeof c=="object"&&c!==null?c=ar(c):(c=Lt(r)?ea:bt.current,c=mi(t,c));var f=r.getDerivedStateFromProps;(d=typeof f=="function"||typeof o.getSnapshotBeforeUpdate=="function")||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(l!==h||m!==c)&&Gg(t,o,n,c),zn=!1,m=t.memoizedState,o.state=m,Wc(t,n,o,s);var b=t.memoizedState;l!==h||m!==b||Dt.current||zn?(typeof f=="function"&&(ef(t,r,f,n),b=t.memoizedState),(u=zn||Vg(t,r,u,n,m,b,c)||!1)?(d||typeof o.UNSAFE_componentWillUpdate!="function"&&typeof o.componentWillUpdate!="function"||(typeof o.componentWillUpdate=="function"&&o.componentWillUpdate(n,b,c),typeof o.UNSAFE_componentWillUpdate=="function"&&o.UNSAFE_componentWillUpdate(n,b,c)),typeof o.componentDidUpdate=="function"&&(t.flags|=4),typeof o.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof o.componentDidUpdate!="function"||l===e.memoizedProps&&m===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||l===e.memoizedProps&&m===e.memoizedState||(t.flags|=1024),t.memoizedProps=n,t.memoizedState=b),o.props=n,o.state=b,o.context=c,n=u):(typeof o.componentDidUpdate!="function"||l===e.memoizedProps&&m===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||l===e.memoizedProps&&m===e.memoizedState||(t.flags|=1024),n=!1)}return sf(e,t,r,n,a,s)}function sf(e,t,r,n,s,a){dw(e,t);var o=(t.flags&128)!==0;if(!n&&!o)return s&&$g(t,r,!1),vn(e,t,a);n=t.stateNode,wN.current=t;var l=o&&typeof r.getDerivedStateFromError!="function"?null:n.render();return t.flags|=1,e!==null&&o?(t.child=gi(t,e.child,null,a),t.child=gi(t,null,l,a)):jt(e,t,l,a),t.memoizedState=n.state,s&&$g(t,r,!0),t.child}function hw(e){var t=e.stateNode;t.pendingContext?Lg(e,t.pendingContext,t.pendingContext!==t.context):t.context&&Lg(e,t.context,!1),Lm(e,t.containerInfo)}function e0(e,t,r,n,s){return pi(),Am(s),t.flags|=256,jt(e,t,r,n),t.child}var af={dehydrated:null,treeContext:null,retryLane:0};function of(e){return{baseLanes:e,cachePool:null,transitions:null}}function fw(e,t,r){var n=t.pendingProps,s=ze.current,a=!1,o=(t.flags&128)!==0,l;if((l=o)||(l=e!==null&&e.memoizedState===null?!1:(s&2)!==0),l?(a=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(s|=1),Ie(ze,s&1),e===null)return Zh(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,a?(n=t.mode,a=t.child,o={mode:"hidden",children:o},!(n&1)&&a!==null?(a.childLanes=0,a.pendingProps=o):a=$u(o,n,0,null),e=Xs(e,n,r,null),a.return=t,e.return=t,a.sibling=e,t.child=a,t.child.memoizedState=of(r),t.memoizedState=af,e):Hm(t,o));if(s=e.memoizedState,s!==null&&(l=s.dehydrated,l!==null))return bN(e,t,o,n,l,s,r);if(a){a=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=us(s,c),n.subtreeFlags=s.subtreeFlags&14680064),l!==null?a=us(l,a):(a=Xs(a,o,r,null),a.flags|=2),a.return=t,n.return=t,n.sibling=a,t.child=n,n=a,a=t.child,o=e.child.memoizedState,o=o===null?of(r):{base
vendor: 4,933 bytes, line 40
40Lanes:o.baseLanes|r,cachePool:null,transitions:o.transitions},a.memoizedState=o,a.childLanes=e.childLanes&~r,t.memoizedState=af,n}return a=e.child,e=a.sibling,n=us(a,{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 Hm(e,t){return t=$u({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function Ll(e,t,r,n){return n!==null&&Am(n),gi(t,e.child,null,r),e=Hm(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function bN(e,t,r,n,s,a,o){if(r)return t.flags&256?(t.flags&=-257,n=Bd(Error(q(422))),Ll(e,t,o,n)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(a=n.fallback,s=t.mode,n=$u({mode:"visible",children:n.children},s,0,null),a=Xs(a,s,o,null),a.flags|=2,n.return=t,a.return=t,n.sibling=a,t.child=n,t.mode&1&&gi(t,e.child,null,o),t.child.memoizedState=of(o),t.memoizedState=af,a);if(!(t.mode&1))return Ll(e,t,o,null);if(s.data==="$!"){if(n=s.nextSibling&&s.nextSibling.dataset,n)var l=n.dgst;return n=l,a=Error(q(419)),n=Bd(a,n,void 0),Ll(e,t,o,n)}if(l=(o&e.childLanes)!==0,Ot||l){if(n=ot,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!==a.retryLane&&(a.retryLane=s,yn(e,s),Nr(n,e,s,-1))}return Jm(),n=Bd(Error(q(421))),Ll(e,t,o,n)}return s.data==="$?"?(t.flags|=128,t.child=e.child,t=IN.bind(null,e),s._reactRetry=t,null):(e=a.treeContext,Bt=is(s.nextSibling),Wt=t,qe=!0,kr=null,e!==null&&(Xt[er++]=hn,Xt[er++]=fn,Xt[er++]=ta,hn=e.id,fn=e.overflow,ta=t),t=Hm(t,n.children),t.flags|=4096,t)}function t0(e,t,r){e.lanes|=t;var n=e.alternate;n!==null&&(n.lanes|=t),Xh(e.return,t,r)}function Wd(e,t,r,n,s){var a=e.memoizedState;a===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:n,tail:r,tailMode:s}:(a.isBackwards=t,a.rendering=null,a.renderingStartTime=0,a.last=n,a.tail=r,a.tailMode=s)}function mw(e,t,r){var n=t.pendingProps,s=n.revealOrder,a=n.tail;if(jt(e,t,n.children,r),n=ze.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&&t0(e,r,t);else if(e.tag===19)t0(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(Ie(ze,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&&Hc(e)===null&&(s=r),r=r.sibling;r=s,r===null?(s=t.child,t.child=null):(s=r.sibling,r.sibling=null),Wd(t,!1,s,r,a);break;case"backwards":for(r=null,s=t.child,t.child=null;s!==null;){if(e=s.alternate,e!==null&&Hc(e)===null){t.child=s;break}e=s.sibling,s.sibling=r,r=s,s=e}Wd(t,!0,r,null,a);break;case"together":Wd(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function gc(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function vn(e,t,r){if(e!==null&&(t.dependencies=e.dependencies),na|=t.lanes,!(r&t.childLanes))return null;if(e!==null&&t.child!==e.child)throw Error(q(153));if(t.child!==null){for(e=t.child,r=us(e,e.pendingProps),t.child=r,r.return=t;e.sibling!==null;)e=e.sibling,r=r.sibling=us(e,e.pendingProps),r.return=t;r.sibling=null}return t.child}function _N(e,t,r){switch(t.tag){case 3:hw(t),pi();break;case 5:Uv(t);break;case 1:Lt(t.type)&&Fc(t);break;case 4:Lm(t,t.stateNode.containerInfo);break;case 10:var n=t.type._context,s=t.memoizedProps.value;Ie(zc,n._currentValue),n._currentValue=s;break;case 13:if(n=t.memoizedState,n!==null)return n.dehydrated!==null?(Ie(ze,ze.current&1),t.flags|=128,null):r&t.child.childLanes?fw(e,t,r):(Ie(ze,ze.current&1),e=vn(e,t,r),e!==null?e.sibling:null);Ie(ze,ze.current&1);break;case 19:if(n=(r&t.childLanes)!==0,e.flags&128){if(n)return mw(e,t,r);t.flags|=128}if(s=t.memoizedState,s!==null&&(s.rendering=null,s.tail=null,s.lastEffect=null),Ie(ze,ze.current),n)break;return null;case 22:case 23:return t.lanes=0,uw(e,t,r)}return vn(e,t,r)}var pw,lf,gw,xw;pw=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}};lf=function(){};gw=function(e,t,r,n){var s=e.memoizedProps;if(s!==n){e=t.stateNode,Ws(Vr.current);var a=null;switch(r){case"input":s=Th(e,s),n=Th(e,n),a=[];break;case"select":s=We({},s,{value:void 0}),n=We({},n,{value:void 0}),a=[];break;
vendor: 2,708 bytes, line 40
40case"textarea":s=Rh(e,s),n=Rh(e,n),a=[];break;default:typeof s.onClick!="function"&&typeof n.onClick=="function"&&(e.onclick=Lc)}Ih(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"&&(ko.hasOwnProperty(u)?a||(a=[]):(a=a||[]).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||(a||(a=[]),a.push(u,r)),r=c;else u==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,l=l?l.__html:void 0,c!=null&&l!==c&&(a=a||[]).push(u,c)):u==="children"?typeof c!="string"&&typeof c!="number"||(a=a||[]).push(u,""+c):u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&(ko.hasOwnProperty(u)?(c!=null&&u==="onScroll"&&De("scroll",e),a||l===c||(a=[])):(a=a||[]).push(u,c))}r&&(a=a||[]).push("style",r);var u=a;(t.updateQueue=u)&&(t.flags|=4)}};xw=function(e,t,r,n){r!==n&&(t.flags|=4)};function Qi(e,t){if(!qe)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 xt(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 jN(e,t,r){var n=t.pendingProps;switch(Pm(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return xt(t),null;case 1:return Lt(t.type)&&$c(),xt(t),null;case 3:return n=t.stateNode,xi(),Le(Dt),Le(bt),Fm(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(Ml(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,kr!==null&&(gf(kr),kr=null))),lf(e,t),xt(t),null;case 5:$m(t);var s=Ws(Do.current);if(r=t.type,e!==null&&t.stateNode!=null)gw(e,t,r,n,s),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!n){if(t.stateNode===null)throw Error(q(166));return xt(t),null}if(e=Ws(Vr.current),Ml(t)){n=t.stateNode,r=t.type;var a=t.memoizedProps;
vendor: 32,267 bytes, line 40
40switch(n[zr]=t,n[Io]=a,e=(t.mode&1)!==0,r){case"dialog":De("cancel",n),De("close",n);break;case"iframe":case"object":case"embed":De("load",n);break;case"video":case"audio":for(s=0;s<oo.length;s++)De(oo[s],n);break;case"source":De("error",n);break;case"img":case"image":case"link":De("error",n),De("load",n);break;case"details":De("toggle",n);break;case"input":ug(n,a),De("invalid",n);break;case"select":n._wrapperState={wasMultiple:!!a.multiple},De("invalid",n);break;case"textarea":hg(n,a),De("invalid",n)}Ih(r,a),s=null;for(var o in a)if(a.hasOwnProperty(o)){var l=a[o];o==="children"?typeof l=="string"?n.textContent!==l&&(a.suppressHydrationWarning!==!0&&Il(n.textContent,l,e),s=["children",l]):typeof l=="number"&&n.textContent!==""+l&&(a.suppressHydrationWarning!==!0&&Il(n.textContent,l,e),s=["children",""+l]):ko.hasOwnProperty(o)&&l!=null&&o==="onScroll"&&De("scroll",n)}switch(r){case"input":Nl(n),dg(n,a,!0);break;case"textarea":Nl(n),fg(n);break;case"select":case"option":break;default:typeof a.onClick=="function"&&(n.onclick=Lc)}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=Hy(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[zr]=t,e[Io]=n,pw(e,t,!1,!1),t.stateNode=e;e:{switch(o=Mh(r,n),r){case"dialog":De("cancel",e),De("close",e),s=n;break;case"iframe":case"object":case"embed":De("load",e),s=n;break;case"video":case"audio":for(s=0;s<oo.length;s++)De(oo[s],e);s=n;break;case"source":De("error",e),s=n;break;case"img":case"image":case"link":De("error",e),De("load",e),s=n;break;case"details":De("toggle",e),s=n;break;case"input":ug(e,n),s=Th(e,n),De("invalid",e);break;case"option":s=n;break;case"select":e._wrapperState={wasMultiple:!!n.multiple},s=We({},n,{value:void 0}),De("invalid",e);break;case"textarea":hg(e,n),s=Rh(e,n),De("invalid",e);break;default:s=n}Ih(r,s),l=s;for(a in l)if(l.hasOwnProperty(a)){var c=l[a];a==="style"?Yy(e,c):a==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,c!=null&&Vy(e,c)):a==="children"?typeof c=="string"?(r!=="textarea"||c!=="")&&So(e,c):typeof c=="number"&&So(e,""+c):a!=="suppressContentEditableWarning"&&a!=="suppressHydrationWarning"&&a!=="autoFocus"&&(ko.hasOwnProperty(a)?c!=null&&a==="onScroll"&&De("scroll",e):c!=null&&pm(e,a,c,o))}switch(r){case"input":Nl(e),dg(e,n,!1);break;case"textarea":Nl(e),fg(e);break;case"option":n.value!=null&&e.setAttribute("value",""+ps(n.value));break;case"select":e.multiple=!!n.multiple,a=n.value,a!=null?Ka(e,!!n.multiple,a,!1):n.defaultValue!=null&&Ka(e,!!n.multiple,n.defaultValue,!0);break;default:typeof s.onClick=="function"&&(e.onclick=Lc)}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 xt(t),null;case 6:if(e&&t.stateNode!=null)xw(e,t,e.memoizedProps,n);else{if(typeof n!="string"&&t.stateNode===null)throw Error(q(166));if(r=Ws(Do.current),Ws(Vr.current),Ml(t)){if(n=t.stateNode,r=t.memoizedProps,n[zr]=t,(a=n.nodeValue!==r)&&(e=Wt,e!==null))switch(e.tag){case 3:Il(n.nodeValue,r,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&Il(n.nodeValue,r,(e.mode&1)!==0)}a&&(t.flags|=4)}else n=(r.nodeType===9?r:r.ownerDocument).createTextNode(n),n[zr]=t,t.stateNode=n}return xt(t),null;case 13:if(Le(ze),n=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(qe&&Bt!==null&&t.mode&1&&!(t.flags&128))Mv(),pi(),t.flags|=98560,a=!1;else if(a=Ml(t),n!==null&&n.dehydrated!==null){if(e===null){if(!a)throw Error(q(318));if(a=t.memoizedState,a=a!==null?a.dehydrated:null,!a)throw Error(q(317));a[zr]=t}else pi(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;xt(t),a=!1}else kr!==null&&(gf(kr),kr=null),a=!0;if(!a)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||ze.current&1?nt===0&&(nt=3):Jm())),t.updateQueue!==null&&(t.flags|=4),xt(t),null);case 4:return xi(),lf(e,t),e===null&&Ro(t.stateNode.containerInfo),xt(t),null;case 10:return Im(t.type._context),xt(t),null;case 17:return Lt(t.type)&&$c(),xt(t),null;case 19:if(Le(ze),a=t.memoizedState,a===null)return xt(t),null;if(n=(t.flags&128)!==0,o=a.rendering,o===null)if(n)Qi(a,!1);else{if(nt!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(o=Hc(e),o!==null){for(t.flags|=128,Qi(a,!1),n=o.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),t.subtreeFlags=0,n=r,r=t.child;r!==null;)a=r,e=n,a.flags&=14680066,o=a.alternate,o===null?(a.childLanes=0,a.lanes=e,a.child=null,a.subtreeFlags=0,a.memoizedProps=null,a.memoizedState=null,a.updateQueue=null,a.dependencies=null,a.stateNode=null):(a.childLanes=o.childLanes,a.lanes=o.lanes,a.child=o.child,a.subtreeFlags=0,a.deletions=null,a.memoizedProps=o.memoizedProps,a.memoizedState=o.memoizedState,a.updateQueue=o.updateQueue,a.type=o.type,e=o.dependencies,a.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),r=r.sibling;return Ie(ze,ze.current&1|2),t.child}e=e.sibling}a.tail!==null&&Qe()>vi&&(t.flags|=128,n=!0,Qi(a,!1),t.lanes=4194304)}else{if(!n)if(e=Hc(o),e!==null){if(t.flags|=128,n=!0,r=e.updateQueue,r!==null&&(t.updateQueue=r,t.flags|=4),Qi(a,!0),a.tail===null&&a.tailMode==="hidden"&&!o.alternate&&!qe)return xt(t),null}else 2*Qe()-a.renderingStartTime>vi&&r!==1073741824&&(t.flags|=128,n=!0,Qi(a,!1),t.lanes=4194304);a.isBackwards?(o.sibling=t.child,t.child=o):(r=a.last,r!==null?r.sibling=o:t.child=o,a.last=o)}return a.tail!==null?(t=a.tail,a.rendering=t,a.tail=t.sibling,a.renderingStartTime=Qe(),t.sibling=null,r=ze.current,Ie(ze,n?r&1|2:r&1),t):(xt(t),null);case 22:case 23:return Qm(),n=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==n&&(t.flags|=8192),n&&t.mode&1?Ut&1073741824&&(xt(t),t.subtreeFlags&6&&(t.flags|=8192)):xt(t),null;case 24:return null;case 25:return null}throw Error(q(156,t.tag))}function kN(e,t){switch(Pm(t),t.tag){case 1:return Lt(t.type)&&$c(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return xi(),Le(Dt),Le(bt),Fm(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return $m(t),null;case 13:if(Le(ze),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(q(340));pi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Le(ze),null;case 4:return xi(),null;case 10:return Im(t.type._context),null;case 22:case 23:return Qm(),null;case 24:return null;default:return null}}var $l=!1,vt=!1,SN=typeof WeakSet=="function"?WeakSet:Set,J=null;function Va(e,t){var r=e.ref;if(r!==null)if(typeof r=="function")try{r(null)}catch(n){Ye(e,t,n)}else r.current=null}function cf(e,t,r){try{r()}catch(n){Ye(e,t,n)}}var r0=!1;function NN(e,t){if(Hh=Ic,e=_v(),Em(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,a=n.focusNode;n=n.focusOffset;try{r.nodeType,a.nodeType}catch{r=null;break e}var o=0,l=-1,c=-1,u=0,d=0,h=e,m=null;t:for(;;){for(var f;h!==r||s!==0&&h.nodeType!==3||(l=o+s),h!==a||n!==0&&h.nodeType!==3||(c=o+n),h.nodeType===3&&(o+=h.nodeValue.length),(f=h.firstChild)!==null;)m=h,h=f;for(;;){if(h===e)break t;if(m===r&&++u===s&&(l=o),m===a&&++d===n&&(c=o),(f=h.nextSibling)!==null)break;h=m,m=h.parentNode}h=f}r=l===-1||c===-1?null:{start:l,end:c}}else r=null}r=r||{start:0,end:0}}else r=null;for(Vh={focusedElem:e,selectionRange:r},Ic=!1,J=t;J!==null;)if(t=J,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,J=e;else for(;J!==null;){t=J;try{var b=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(b!==null){var g=b.memoizedProps,v=b.memoizedState,x=t.stateNode,y=x.getSnapshotBeforeUpdate(t.elementType===t.type?g:xr(t.type,g),v);x.__reactInternalSnapshotBeforeUpdate=y}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(q(163))}}catch(_){Ye(t,t.return,_)}if(e=t.sibling,e!==null){e.return=t.return,J=e;break}J=t.return}return b=r0,r0=!1,b}function yo(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 a=s.destroy;s.destroy=void 0,a!==void 0&&cf(t,r,a)}s=s.next}while(s!==n)}}function Du(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 uf(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 yw(e){var t=e.alternate;t!==null&&(e.alternate=null,yw(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[zr],delete t[Io],delete t[Kh],delete t[lN],delete t[cN])),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 vw(e){return e.tag===5||e.tag===3||e.tag===4}function n0(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||vw(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 df(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=Lc));else if(n!==4&&(e=e.child,e!==null))for(df(e,t,r),e=e.sibling;e!==null;)df(e,t,r),e=e.sibling}function hf(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(hf(e,t,r),e=e.sibling;e!==null;)hf(e,t,r),e=e.sibling}var ut=null,_r=!1;function In(e,t,r){for(r=r.child;r!==null;)ww(e,t,r),r=r.sibling}function ww(e,t,r){if(Hr&&typeof Hr.onCommitFiberUnmount=="function")try{Hr.onCommitFiberUnmount(Eu,r)}catch{}switch(r.tag){case 5:vt||Va(r,t);case 6:var n=ut,s=_r;ut=null,In(e,t,r),ut=n,_r=s,ut!==null&&(_r?(e=ut,r=r.stateNode,e.nodeType===8?e.parentNode.removeChild(r):e.removeChild(r)):ut.removeChild(r.stateNode));break;case 18:ut!==null&&(_r?(e=ut,r=r.stateNode,e.nodeType===8?Ld(e.parentNode,r):e.nodeType===1&&Ld(e,r),To(e)):Ld(ut,r.stateNode));break;case 4:n=ut,s=_r,ut=r.stateNode.containerInfo,_r=!0,In(e,t,r),ut=n,_r=s;break;case 0:case 11:case 14:case 15:if(!vt&&(n=r.updateQueue,n!==null&&(n=n.lastEffect,n!==null))){s=n=n.next;do{var a=s,o=a.destroy;a=a.tag,o!==void 0&&(a&2||a&4)&&cf(r,t,o),s=s.next}while(s!==n)}In(e,t,r);break;case 1:if(!vt&&(Va(r,t),n=r.stateNode,typeof n.componentWillUnmount=="function"))try{n.props=r.memoizedProps,n.state=r.memoizedState,n.componentWillUnmount()}catch(l){Ye(r,t,l)}In(e,t,r);break;case 21:In(e,t,r);break;case 22:r.mode&1?(vt=(n=vt)||r.memoizedState!==null,In(e,t,r),vt=n):In(e,t,r);break;default:In(e,t,r)}}function s0(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var r=e.stateNode;r===null&&(r=e.stateNode=new SN),t.forEach(function(n){var s=MN.bind(null,e,n);r.has(n)||(r.add(n),n.then(s,s))})}}function fr(e,t){var r=t.deletions;if(r!==null)for(var n=0;n<r.length;n++){var s=r[n];try{var a=e,o=t,l=o;e:for(;l!==null;){switch(l.tag){case 5:ut=l.stateNode,_r=!1;break e;case 3:ut=l.stateNode.containerInfo,_r=!0;break e;case 4:ut=l.stateNode.containerInfo,_r=!0;break e}l=l.return}if(ut===null)throw Error(q(160));ww(a,o,s),ut=null,_r=!1;var c=s.alternate;c!==null&&(c.return=null),s.return=null}catch(u){Ye(s,t,u)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)bw(t,e),t=t.sibling}function bw(e,t){var r=e.alternate,n=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(fr(t,e),Lr(e),n&4){try{yo(3,e,e.return),Du(3,e)}catch(g){Ye(e,e.return,g)}try{yo(5,e,e.return)}catch(g){Ye(e,e.return,g)}}break;case 1:fr(t,e),Lr(e),n&512&&r!==null&&Va(r,r.return);break;case 5:if(fr(t,e),Lr(e),n&512&&r!==null&&Va(r,r.return),e.flags&32){var s=e.stateNode;try{So(s,"")}catch(g){Ye(e,e.return,g)}}if(n&4&&(s=e.stateNode,s!=null)){var a=e.memoizedProps,o=r!==null?r.memoizedProps:a,l=e.type,c=e.updateQueue;if(e.updateQueue=null,c!==null)try{l==="input"&&a.type==="radio"&&a.name!=null&&By(s,a),Mh(l,o);var u=Mh(l,a);for(o=0;o<c.length;o+=2){var d=c[o],h=c[o+1];d==="style"?Yy(s,h):d==="dangerouslySetInnerHTML"?Vy(s,h):d==="children"?So(s,h):pm(s,d,h,u)}switch(l){case"input":Ph(s,a);break;case"textarea":Wy(s,a);break;case"select":var m=s._wrapperState.wasMultiple;s._wrapperState.wasMultiple=!!a.multiple;var f=a.value;f!=null?Ka(s,!!a.multiple,f,!1):m!==!!a.multiple&&(a.defaultValue!=null?Ka(s,!!a.multiple,a.defaultValue,!0):Ka(s,!!a.multiple,a.multiple?[]:"",!1))}s[Io]=a}catch(g){Ye(e,e.return,g)}}break;case 6:if(fr(t,e),Lr(e),n&4){if(e.stateNode===null)throw Error(q(162));s=e.stateNode,a=e.memoizedProps;try{s.nodeValue=a}catch(g){Ye(e,e.return,g)}}break;case 3:if(fr(t,e),Lr(e),n&4&&r!==null&&r.memoizedState.isDehydrated)try{To(t.containerInfo)}catch(g){Ye(e,e.return,g)}break;case 4:fr(t,e),Lr(e);break;case 13:fr(t,e),Lr(e),s=e.child,s.flags&8192&&(a=s.memoizedState!==null,s.stateNode.isHidden=a,!a||s.alternate!==null&&s.alternate.memoizedState!==null||(Ym=Qe())),n&4&&s0(e);break;case 22:if(d=r!==null&&r.memoizedState!==null,e.mode&1?(vt=(u=vt)||d,fr(t,e),vt=u):fr(t,e),Lr(e),n&8192){if(u=e.memoizedState!==null,(e.stateNode.isHidden=u)&&!d&&e.mode&1)for(J=e,d=e.child;d!==null;){for(h=J=d;J!==null;){switch(m=J,f=m.child,m.tag){case 0:case 11:case 14:case 15:yo(4,m,m.return);break;case 1:Va(m,m.return);var b=m.stateNode;if(typeof b.componentWillUnmount=="function"){n=m,r=m.return;try{t=n,b.props=t.memoizedProps,b.state=t.memoizedState,b.componentWillUnmount()}catch(g){Ye(n,r,g)}}break;case 5:Va(m,m.return);break;case 22:if(m.memoizedState!==null){i0(h);continue}}f!==null?(f.return=m,J=f):i0(h)}d=d.sibling}e:for(d=null,h=e;;){if(h.tag===5){if(d===null){d=h;try{s=h.stateNode,u?(a=s.style,typeof a.setProperty=="function"?a.setProperty("display","none","important"):a.display="none"):(l=h.stateNode,c=h.memoizedProps.style,o=c!=null&&c.hasOwnProperty("display")?c.display:null,l.style.display=Gy("display",o))}catch(g){Ye(e,e.return,g)}}}else if(h.tag===6){if(d===null)try{h.stateNode.nodeValue=u?"":h.memoizedProps}catch(g){Ye(e,e.return,g)}}else if((h.tag!==22&&h.tag!==23||h.memoizedState===null||h===e)&&h.child!==null){h.child.return=h,h=h.child;continue}if(h===e)break e;for(;h.sibling===null;){if(h.return===null||h.return===e)break e;d===h&&(d=null),h=h.return}d===h&&(d=null),h.sibling.return=h.return,h=h.sibling}}break;case 19:fr(t,e),Lr(e),n&4&&s0(e);break;case 21:break;default:fr(t,e),Lr(e)}}function Lr(e){var t=e.flags;if(t&2){try{e:{for(var r=e.return;r!==null;){if(vw(r)){var n=r;break e}r=r.return}throw Error(q(160))}switch(n.tag){case 5:var s=n.stateNode;n.flags&32&&(So(s,""),n.flags&=-33);var a=n0(e);hf(e,a,s);break;case 3:case 4:var o=n.stateNode.containerInfo,l=n0(e);df(e,l,o);break;default:throw Error(q(161))}}catch(c){Ye(e,e.return,c)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function CN(e,t,r){J=e,_w(e)}function _w(e,t,r){for(var n=(e.mode&1)!==0;J!==null;){var s=J,a=s.child;if(s.tag===22&&n){var o=s.memoizedState!==null||$l;if(!o){var l=s.alternate,c=l!==null&&l.memoizedState!==null||vt;l=$l;var u=vt;if($l=o,(vt=c)&&!u)for(J=s;J!==null;)o=J,c=o.child,o.tag===22&&o.memoizedState!==null?o0(s):c!==null?(c.return=o,J=c):o0(s);for(;a!==null;)J=a,_w(a),a=a.sibling;J=s,$l=l,vt=u}a0(e)}else s.subtreeFlags&8772&&a!==null?(a.return=s,J=a):a0(e)}}function a0(e){for(;J!==null;){var t=J;if(t.flags&8772){var r=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:vt||Du(5,t);break;case 1:var n=t.stateNode;if(t.flags&4&&!vt)if(r===null)n.componentDidMount();else{var s=t.elementType===t.type?r.memoizedProps:xr(t.type,r.memoizedProps);n.componentDidUpdate(s,r.memoizedState,n.__reactInternalSnapshotBeforeUpdate)}var a=t.updateQueue;a!==null&&Bg(t,a,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}Bg(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 d=u.memoizedState;if(d!==null){var h=d.dehydrated;h!==null&&To(h)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(q(163))}vt||t.flags&512&&uf(t)}catch(m){Ye(t,t.return,m)}}if(t===e){J=null;break}if(r=t.sibling,r!==null){r.return=t.return,J=r;break}J=t.return}}function i0(e){for(;J!==null;){var t=J;if(t===e){J=null;break}var r=t.sibling;if(r!==null){r.return=t.return,J=r;break}J=t.return}}function o0(e){for(;J!==null;){var t=J;try{switch(t.tag){case 0:case 11:case 15:var r=t.return;try{Du(4,t)}catch(c){Ye(t,r,c)}break;case 1:var n=t.stateNode;if(typeof n.componentDidMount=="function"){var s=t.return;try{n.componentDidMount()}catch(c){Ye(t,s,c)}}var a=t.return;try{uf(t)}catch(c){Ye(t,a,c)}break;case 5:var o=t.return;try{uf(t)}catch(c){Ye(t,o,c)}}}catch(c){Ye(t,t.return,c)}if(t===e){J=null;break}var l=t.sibling;if(l!==null){l.return=t.return,J=l;break}J=t.return}}var EN=Math.ceil,Yc=Nn.ReactCurrentDispatcher,Vm=Nn.ReactCurrentOwner,nr=Nn.ReactCurrentBatchConfig,je=0,ot=null,Xe=null,dt=0,Ut=0,Ga=ks(0),nt=0,Uo=null,na=0,Lu=0,Gm=0,vo=null,At=null,Ym=0,vi=1/0,ln=null,Kc=!1,ff=null,ls=null,Fl=!1,es=null,Qc=0,wo=0,mf=null,xc=-1,yc=0;function Ct(){return je&6?Qe():xc!==-1?xc:xc=Qe()}function cs(e){return e.mode&1?je&2&&dt!==0?dt&-dt:dN.transition!==null?(yc===0&&(yc=iv()),yc):(e=Pe,e!==0||(e=window.event,e=e===void 0?16:fv(e.type)),e):1}function Nr(e,t,r,n){if(50<wo)throw wo=0,mf=null,Error(q(185));cl(e,r,n),(!(je&2)||e!==ot)&&(e===ot&&(!(je&2)&&(Lu|=r),nt===4&&Vn(e,dt)),$t(e,n),r===1&&je===0&&!(t.mode&1)&&(vi=Qe()+500,Ou&&Ss()))}function $t(e,t){var r=e.callbackNode;dS(e,t);var n=Oc(e,e===ot?dt:0);if(n===0)r!==null&&gg(r),e.callbackNode=null,e.callbackPriority=0;else if(t=n&-n,e.callbackPriority!==t){if(r!=null&&gg(r),t===1)e.tag===0?uN(l0.bind(null,e)):Rv(l0.bind(null,e)),iN(function(){!(je&6)&&Ss()}),r=null;else{switch(ov(n)){case 1:r=wm;break;case 4:r=sv;break;case 16:r=Rc;break;case 536870912:r=av;break;default:r=Rc}r=Pw(r,jw.bind(null,e))}e.callbackPriority=t,e.callbackNode=r}}function jw(e,t){if(xc=-1,yc=0,je&6)throw Error(q(327));var r=e.callbackNode;if(ei()&&e.callbackNode!==r)return null;var n=Oc(e,e===ot?dt:0);if(n===0)return null;if(n&30||n&e.expiredLanes||t)t=Jc(e,n);else{t=n;var s=je;je|=2;var a=Sw();(ot!==e||dt!==t)&&(ln=null,vi=Qe()+500,Zs(e,t));do try{AN();break}catch(l){kw(e,l)}while(!0);Om(),Yc.current=a,je=s,Xe!==null?t=0:(ot=null,dt=0,t=nt)}if(t!==0){if(t===2&&(s=Uh(e),s!==0&&(n=s,t=pf(e,s))),t===1)throw r=Uo,Zs(e,0),Vn(e,n),$t(e,Qe()),r;if(t===6)Vn(e,n);else{if(s=e.current.alternate,!(n&30)&&!TN(s)&&(t=Jc(e,n),t===2&&(a=Uh(e),a!==0&&(n=a,t=pf(e,a))),t===1))throw r=Uo,Zs(e,0),Vn(e,n),$t(e,Qe()),r;switch(e.finishedWork=s,e.finishedLanes=n,t){case 0:case 1:throw Error(q(345));case 2:Ls(e,At,ln);break;case 3:if(Vn(e,n),(n&130023424)===n&&(t=Ym+500-Qe(),10<t)){if(Oc(e,0)!==0)break;if(s=e.suspendedLanes,(s&n)!==n){Ct(),e.pingedLanes|=e.suspendedLanes&s;break}e.timeoutHandle=Yh(Ls.bind(null,e,At,ln),t);break}Ls(e,At,ln);break;case 4:if(Vn(e,n),(n&4194240)===n)break;for(t=e.eventTimes,s=-1;0<n;){var o=31-Sr(n);a=1<<o,o=t[o],o>s&&(s=o),n&=~a}if(n=s,n=Qe()-n,n=(120>n?120:480>n?480:1080>n?1080:1920>n?1920:3e3>n?3e3:4320>n?4320:1960*EN(n/1960))-n,10<n){e.timeoutHandle=Yh(Ls.bind(null,e,At,ln),n);break}Ls(e,At,ln);break;case 5:Ls(e,At,ln);break;default:throw Error(q(329))}}}return $t(e,Qe()),e.callbackNode===r?jw.bind(null,e):null}function pf(e,t){var r=vo;return e.current.memoizedState.isDehydrated&&(Zs(e,t).flags|=256),e=Jc(e,t),e!==2&&(t=At,At=r,t!==null&&gf(t)),e}function gf(e){At===null?At=e:At.push.apply(At,e)}function TN(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],a=s.getSnapshot;s=s.value;try{if(!Er(a(),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 Vn(e,t){for(t&=~Gm,t&=~Lu,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var r=31-Sr(t),n=1<<r;e[r]=-1,t&=~n}}function l0(e){if(je&6)throw Error(q(327));ei();var t=Oc(e,0);if(!(t&1))return $t(e,Qe()),null;var r=Jc(e,t);if(e.tag!==0&&r===2){var n=Uh(e);n!==0&&(t=n,r=pf(e,n))}if(r===1)throw r=Uo,Zs(e,0),Vn(e,t),$t(e,Qe()),r;if(r===6)throw Error(q(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,Ls(e,At,ln),$t(e,Qe()),null}function Km(e,t){var r=je;je|=1;try{return e(t)}finally{je=r,je===0&&(vi=Qe()+500,Ou&&Ss())}}function sa(e){es!==null&&es.tag===0&&!(je&6)&&ei();var t=je;je|=1;var r=nr.transition,n=Pe;try{if(nr.transition=null,Pe=1,e)return e()}finally{Pe=n,nr.transition=r,je=t,!(je&6)&&Ss()}}function Qm(){Ut=Ga.current,Le(Ga)}function Zs(e,t){e.finishedWork=null,e.finishedLanes=0;var r=e.timeoutHandle;if(r!==-1&&(e.timeoutHandle=-1,aN(r)),Xe!==null)for(r=Xe.return;r!==null;){var n=r;switch(Pm(n),n.tag){case 1:n=n.type.childContextTypes,n!=null&&$c();break;case 3:xi(),Le(Dt),Le(bt),Fm();break;case 5:$m(n);break;case 4:xi();break;case 13:Le(ze);break;case 19:Le(ze);break;case 10:Im(n.type._context);break;case 22:case 23:Qm()}r=r.return}if(ot=e,Xe=e=us(e.current,null),dt=Ut=t,nt=0,Uo=null,Gm=Lu=na=0,At=vo=null,Bs!==null){for(t=0;t<Bs.length;t++)if(r=Bs[t],n=r.interleaved,n!==null){r.interleaved=null;var s=n.next,a=r.pending;if(a!==null){var o=a.next;a.next=s,n.next=o}r.pending=n}Bs=null}return e}function kw(e,t){do{var r=Xe;try{if(Om(),mc.current=Gc,Vc){for(var n=Be.memoizedState;n!==null;){var s=n.queue;s!==null&&(s.pending=null),n=n.next}Vc=!1}if(ra=0,at=rt=Be=null,xo=!1,Lo=0,Vm.current=null,r===null||r.return===null){nt=1,Uo=t,Xe=null;break}e:{var a=e,o=r.return,l=r,c=t;if(t=dt,l.flags|=32768,c!==null&&typeof c=="object"&&typeof c.then=="function"){var u=c,d=l,h=d.tag;if(!(d.mode&1)&&(h===0||h===11||h===15)){var m=d.alternate;m?(d.updateQueue=m.updateQueue,d.memoizedState=m.memoizedState,d.lanes=m.lanes):(d.updateQueue=null,d.memoizedState=null)}var f=Kg(o);if(f!==null){f.flags&=-257,Qg(f,o,l,a,t),f.mode&1&&Yg(a,u,t),t=f,c=u;var b=t.updateQueue;if(b===null){var g=new Set;g.add(c),t.updateQueue=g}else b.add(c);break e}else{if(!(t&1)){Yg(a,u,t),Jm();break e}c=Error(q(426))}}else if(qe&&l.mode&1){var v=Kg(o);if(v!==null){!(v.flags&65536)&&(v.flags|=256),Qg(v,o,l,a,t),Am(yi(c,l));break e}}a=c=yi(c,l),nt!==4&&(nt=2),vo===null?vo=[a]:vo.push(a),a=o;do{switch(a.tag){case 3:a.flags|=65536,t&=-t,a.lanes|=t;var x=ow(a,c,t);zg(a,x);break e;case 1:l=c;var y=a.type,w=a.stateNode;if(!(a.flags&128)&&(typeof y.getDerivedStateFromError=="function"||w!==null&&typeof w.componentDidCatch=="function"&&(ls===null||!ls.has(w)))){a.flags|=65536,t&=-t,a.lanes|=t;var _=lw(a,l,t);zg(a,_);break e}}a=a.return}while(a!==null)}Cw(r)}catch(j){t=j,Xe===r&&r!==null&&(Xe=r=r.return);continue}break}while(!0)}function Sw(){var e=Yc.current;return Yc.current=Gc,e===null?Gc:e}function Jm(){(nt===0||nt===3||nt===2)&&(nt=4),ot===null||!(na&268435455)&&!(Lu&268435455)||Vn(ot,dt)}function Jc(e,t){var r=je;je|=2;var n=Sw();(ot!==e||dt!==t)&&(ln=null,Zs(e,t));do try{PN();break}catch(s){kw(e,s)}while(!0);if(Om(),je=r,Yc.current=n,Xe!==null)throw Error(q(261));return ot=null,dt=0,nt}function PN(){for(;Xe!==null;)Nw(Xe)}function AN(){for(;Xe!==null&&!rS();)Nw(Xe)}function Nw(e){var t=Tw(e.alternate,e,Ut);e.memoizedProps=e.pendingProps,t===null?Cw(e):Xe=t,Vm.current=null}function Cw(e){var t=e;do{var r=t.alternate;if(e=t.return,t.flags&32768){if(r=kN(r,t),r!==null){r.flags&=32767,Xe=r;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{nt=6,Xe=null;return}}else if(r=jN(r,t,Ut),r!==null){Xe=r;return}if(t=t.sibling,t!==null){Xe=t;return}Xe=t=e}while(t!==null);nt===0&&(nt=5)}function Ls(e,t,r){var n=Pe,s=nr.transition;try{nr.transition=null,Pe=1,RN(e,t,r,n)}finally{nr.transition=s,Pe=n}return null}function RN(e,t,r,n){do ei();while(es!==null);if(je&6)throw Error(q(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(q(177));e.callbackNode=null,e.callbackPriority=0;var a=r.lanes|r.childLanes;if(hS(e,a),e===ot&&(Xe=ot=null,dt=0),!(r.subtreeFlags&2064)&&!(r.flags&2064)||Fl||(Fl=!0,Pw(Rc,function(){return ei(),null})),a=(r.flags&15990)!==0,r.subtreeFlags&15990||a){a=nr.transition,nr.transition=null;var o=Pe;Pe=1;var l=je;je|=4,Vm.current=null,NN(e,r),bw(r,e),ZS(Vh),Ic=!!Hh,Vh=Hh=null,e.current=r,CN(r),nS(),je=l,Pe=o,nr.transition=a}else e.current=r;if(Fl&&(Fl=!1,es=e,Qc=s),a=e.pendingLanes,a===0&&(ls=null),iS(r.stateNode),$t(e,Qe()),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(Kc)throw Kc=!1,e=ff,ff=null,e;return Qc&1&&e.tag!==0&&ei(),a=e.pendingLanes,a&1?e===mf?wo++:(wo=0,mf=e):wo=0,Ss(),null}function ei(){if(es!==null){var e=ov(Qc),t=nr.transition,r=Pe;try{if(nr.transition=null,Pe=16>e?16:e,es===null)var n=!1;else{if(e=es,es=null,Qc=0,je&6)throw Error(q(331));var s=je;for(je|=4,J=e.current;J!==null;){var a=J,o=a.child;if(J.flags&16){var l=a.deletions;if(l!==null){for(var c=0;c<l.length;c++){var u=l[c];for(J=u;J!==null;){var d=J;switch(d.tag){case 0:case 11:case 15:yo(8,d,a)}var h=d.child;if(h!==null)h.return=d,J=h;else for(;J!==null;){d=J;var m=d.sibling,f=d.return;if(yw(d),d===u){J=null;break}if(m!==null){m.return=f,J=m;break}J=f}}}var b=a.alternate;if(b!==null){var g=b.child;if(g!==null){b.child=null;do{var v=g.sibling;g.sibling=null,g=v}while(g!==null)}}J=a}}if(a.subtreeFlags&2064&&o!==null)o.return=a,J=o;else e:for(;J!==null;){if(a=J,a.flags&2048)switch(a.tag){case 0:case 11:case 15:yo(9,a,a.return)}var x=a.sibling;if(x!==null){x.return=a.return,J=x;break e}J=a.return}}var y=e.current;for(J=y;J!==null;){o=J;var w=o.child;if(o.subtreeFlags&2064&&w!==null)w.return=o,J=w;else e:for(o=y;J!==null;){if(l=J,l.flags&2048)try{switch(l.tag){case 0:case 11:case 15:Du(9,l)}}catch(j){Ye(l,l.return,j)}if(l===o){J=null;break e}var _=l.sibling;if(_!==null){_.return=l.return,J=_;break e}J=l.return}}if(je=s,Ss(),Hr&&typeof Hr.onPostCommitFiberRoot=="function")try{Hr.onPostCommitFiberRoot(Eu,e)}catch{}n=!0}return n}finally{Pe=r,nr.transition=t}}return!1}function c0(e,t,r){t=yi(r,t),t=ow(e,t,1),e=os(e,t,1),t=Ct(),e!==null&&(cl(e,1,t),$t(e,t))}function Ye(e,t,r){if(e.tag===3)c0(e,e,r);else for(;t!==null;){if(t.tag===3){c0(t,e,r);break}else if(t.tag===1){var n=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof n.componentDidCatch=="function"&&(ls===null||!ls.has(n))){e=yi(r,e),e=lw(t,e,1),t=os(t,e,1),e=Ct(),t!==null&&(cl(t,1,e),$t(t,e));break}}t=t.return}}function ON(e,t,r){var n=e.pingCache;n!==null&&n.delete(t),t=Ct(),e.pingedLanes|=e.suspendedLanes&r,ot===e&&(dt&r)===r&&(nt===4||nt===3&&(dt&130023424)===dt&&500>Qe()-Ym?Zs(e,0):Gm|=r),$t(e,t)}function Ew(e,t){t===0&&(e.mode&1?(t=Tl,Tl<<=1,!(Tl&130023424)&&(Tl=4194304)):t=1);var r=Ct();e=yn(e,t),e!==null&&(cl(e,t,r),$t(e,r))}function IN(e){var t=e.memoizedState,r=0;t!==null&&(r=t.retryLane),Ew(e,r)}function MN(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(q(314))}n!==null&&n.delete(t),Ew(e,r)}var Tw;Tw=function(e,t,r){if(e!==null)if(e.memoizedProps!==t.pendingProps||Dt.current)Ot=!0;else{if(!(e.lanes&r)&&!(t.flags&128))return Ot=!1,_N(e,t,r);Ot=!!(e.flags&131072)}else Ot=!1,qe&&t.flags&1048576&&Ov(t,qc,t.index);switch(t.lanes=0,t.tag){case 2:var n=t.type;gc(e,t),e=t.pendingProps;var s=mi(t,bt.current);Xa(t,r),s=qm(null,t,n,e,s,r);var a=zm();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,Lt(n)?(a=!0,Fc(t)):a=!1,t.memoizedState=s.state!==null&&s.state!==void 0?s.state:null,Dm(t),s.updater=Mu,t.stateNode=s,s._reactInternals=t,tf(t,n,e,r),t=sf(null,t,n,!0,a,r)):(t.tag=0,qe&&a&&Tm(t),jt(null,t,s,r),t=t.child),t;case 16:n=t.elementType;e:{switch(gc(e,t),e=t.pendingProps,s=n._init,n=s(n._payload),t.type=n,s=t.tag=LN(n),e=xr(n,e),s){case 0:t=nf(null,t,n,e,r);break e;case 1:t=Xg(null,t,n,e,r);break e;case 11:t=Jg(null,t,n,e,r);break e;case 14:t=Zg(null,t,n,xr(n.type,e),r);break e}throw Error(q(306,n,""))}return t;case 0:return n=t.type,s=t.pendingProps,s=t.elementType===n?s:xr(n,s),nf(e,t,n,s,r);case 1:return n=t.type,s=t.pendingProps,s=t.elementType===n?s:xr(n,s),Xg(e,t,n,s,r);case 3:e:{if(hw(t),e===null)throw Error(q(387));n=t.pendingProps,a=t.memoizedState,s=a.element,Fv(e,t),Wc(t,n,null,r);var o=t.memoizedState;if(n=o.element,a.isDehydrated)if(a={element:n,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},t.updateQueue.baseState=a,t.memoizedState=a,t.flags&256){s=yi(Error(q(423)),t),t=e0(e,t,n,r,s);break e}else if(n!==s){s=yi(Error(q(424)),t),t=e0(e,t,n,r,s);break e}else for(Bt=is(t.stateNode.containerInfo.firstChild),Wt=t,qe=!0,kr=null,r=Lv(t,null,n,r),t.child=r;r;)r.flags=r.flags&-3|4096,r=r.sibling;else{if(pi(),n===s){t=vn(e,t,r);break e}jt(e,t,n,r)}t=t.child}return t;case 5:return Uv(t),e===null&&Zh(t),n=t.type,s=t.pendingProps,a=e!==null?e.memoizedProps:null,o=s.children,Gh(n,s)?o=null:a!==null&&Gh(n,a)&&(t.flags|=32),dw(e,t),jt(e,t,o,r),t.child;case 6:return e===null&&Zh(t),null;case 13:return fw(e,t,r);case 4:return Lm(t,t.stateNode.containerInfo),n=t.pendingProps,e===null?t.child=gi(t,null,n,r):jt(e,t,n,r),t.child;case 11:return n=t.type,s=t.pendingProps,s=t.elementType===n?s:xr(n,s),Jg(e,t,n,s,r);case 7:return jt(e,t,t.pendingProps,r),t.child;case 8:return jt(e,t,t.pendingProps.children,r),t.child;case 12:return jt(e,t,t.pendingProps.children,r),t.child;case 10:e:{if(n=t.type._context,s=t.pendingProps,a=t.memoizedProps,o=s.value,Ie(zc,n._currentValue),n._currentValue=o,a!==null)if(Er(a.value,o)){if(a.children===s.children&&!Dt.current){t=vn(e,t,r);break e}}else for(a=t.child,a!==null&&(a.return=t);a!==null;){var l=a.dependencies;if(l!==null){o=a.child;for(var c=l.firstContext;c!==null;){if(c.context===n){if(a.tag===1){c=pn(-1,r&-r),c.tag=2;var u=a.updateQueue;if(u!==null){u=u.shared;var d=u.pending;d===null?c.next=c:(c.next=d.next,d.next=c),u.pending=c}}a.lanes|=r,c=a.alternate,c!==null&&(c.lanes|=r),Xh(a.return,r,t),l.lanes|=r;break}c=c.next}}else if(a.tag===10)o=a.type===t.type?null:a.child;else if(a.tag===18){if(o=a.return,o===null)throw Error(q(341));o.lanes|=r,l=o.alternate,l!==null&&(l.lanes|=r),Xh(o,r,t),o=a.sibling}else o=a.child;if(o!==null)o.return=a;else for(o=a;o!==null;){if(o===t){o=null;break}if(a=o.sibling,a!==null){a.return=o.return,o=a;break}o=o.return}a=o}jt(e,t,s.children,r),t=t.child}return t;case 9:return s=t.type,n=t.pendingProps.children,Xa(t,r),s=ar(s),n=n(s),t.flags|=1,jt(e,t,n,r),t.child;case 14:return n=t.type,s=xr(n,t.pendingProps),s=xr(n.type,s),Zg(e,t,n,s,r);case 15:return cw(e,t,t.type,t.pendingProps,r);case 17:return n=t.type,s=t.pendingProps,s=t.elementType===n?s:xr(n,s),gc(e,t),t.tag=1,Lt(n)?(e=!0,Fc(t)):e=!1,Xa(t,r),iw(t,n,s),tf(t,n,s,r),sf(null,t,n,!0,e,r);case 19:return mw(e,t,r);case 22:return uw(e,t,r)}throw Error(q(156,t.tag))};function Pw(e,t){return nv(e,t)}function DN(e,t,r,n){this.tag=e,this.key=r,this.sibling=this.child=this.return=this.stateNode=this.t
vendor: 7,566 bytes, line 40
40ype=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 tr(e,t,r,n){return new DN(e,t,r,n)}function Zm(e){return e=e.prototype,!(!e||!e.isReactComponent)}function LN(e){if(typeof e=="function")return Zm(e)?1:0;if(e!=null){if(e=e.$$typeof,e===xm)return 11;if(e===ym)return 14}return 2}function us(e,t){var r=e.alternate;return r===null?(r=tr(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 vc(e,t,r,n,s,a){var o=2;if(n=e,typeof e=="function")Zm(e)&&(o=1);else if(typeof e=="string")o=5;else e:switch(e){case La:return Xs(r.children,s,a,t);case gm:o=8,s|=8;break;case Sh:return e=tr(12,r,t,s|2),e.elementType=Sh,e.lanes=a,e;case Nh:return e=tr(13,r,t,s),e.elementType=Nh,e.lanes=a,e;case Ch:return e=tr(19,r,t,s),e.elementType=Ch,e.lanes=a,e;case Uy:return $u(r,s,a,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case $y:o=10;break e;case Fy:o=9;break e;case xm:o=11;break e;case ym:o=14;break e;case qn:o=16,n=null;break e}throw Error(q(130,e==null?e:typeof e,""))}return t=tr(o,r,t,s),t.elementType=e,t.type=n,t.lanes=a,t}function Xs(e,t,r,n){return e=tr(7,e,n,t),e.lanes=r,e}function $u(e,t,r,n){return e=tr(22,e,n,t),e.elementType=Uy,e.lanes=r,e.stateNode={isHidden:!1},e}function Hd(e,t,r){return e=tr(6,e,null,t),e.lanes=r,e}function Vd(e,t,r){return t=tr(4,e.children!==null?e.children:[],e.key,t),t.lanes=r,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function $N(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=Nd(0),this.expirationTimes=Nd(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Nd(0),this.identifierPrefix=n,this.onRecoverableError=s,this.mutableSourceEagerHydrationData=null}function Xm(e,t,r,n,s,a,o,l,c){return e=new $N(e,t,r,l,c),t===1?(t=1,a===!0&&(t|=8)):t=0,a=tr(3,null,null,t),e.current=a,a.stateNode=e,a.memoizedState={element:n,isDehydrated:r,cache:null,transitions:null,pendingSuspenseBoundaries:null},Dm(a),e}function FN(e,t,r){var n=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:Da,key:n==null?null:""+n,children:e,containerInfo:t,implementation:r}}function Aw(e){if(!e)return gs;e=e._reactInternals;e:{if(ha(e)!==e||e.tag!==1)throw Error(q(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(Lt(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(t!==null);throw Error(q(171))}if(e.tag===1){var r=e.type;if(Lt(r))return Av(e,r,t)}return t}function Rw(e,t,r,n,s,a,o,l,c){return e=Xm(r,n,!0,e,s,a,o,l,c),e.context=Aw(null),r=e.current,n=Ct(),s=cs(r),a=pn(n,s),a.callback=t??null,os(r,a,s),e.current.lanes=s,cl(e,s,n),$t(e,n),e}function Fu(e,t,r,n){var s=t.current,a=Ct(),o=cs(s);return r=Aw(r),t.context===null?t.context=r:t.pendingContext=r,t=pn(a,o),t.payload={element:e},n=n===void 0?null:n,n!==null&&(t.callback=n),e=os(s,t,o),e!==null&&(Nr(e,s,o,a),fc(e,s,o)),o}function Zc(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 u0(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var r=e.retryLane;e.retryLane=r!==0&&r<t?r:t}}function ep(e,t){u0(e,t),(e=e.alternate)&&u0(e,t)}function UN(){return null}var Ow=typeof reportError=="function"?reportError:function(e){console.error(e)};function tp(e){this._internalRoot=e}Uu.prototype.render=tp.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(q(409));Fu(e,t,null,null)};Uu.prototype.unmount=tp.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;sa(function(){Fu(null,e,null,null)}),t[xn]=null}};function Uu(e){this._internalRoot=e}Uu.prototype.unstable_scheduleHydration=function(e){if(e){var t=uv();e={blockedOn:null,target:e,priority:t};for(var r=0;r<Hn.length&&t!==0&&t<Hn[r].priority;r++);Hn.splice(r,0,e),r===0&&hv(e)}};function rp(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function qu(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function d0(){}function qN(e,t,r,n,s){if(s){if(typeof n=="function"){var a=n;n=function(){var u=Zc(o);a.call(u)}}var o=Rw(t,n,e,0,null,!1,!1,"",d0);return e._reactRootContainer=o,e[xn]=o.current,Ro(e.nodeType===8?e.parentNode:e),sa(),o}for(;s=e.lastChild;)e.removeChild(s);if(typeof n=="function"){var l=n;n=function(){var u=Zc(c);l.call(u)}}var c=Xm(e,0,!1,null,null,!1,!1,"",d0);return e._reactRootContainer=c,e[xn]=c.current,Ro(e.nodeType===8?e.parentNode:e),sa(function(){Fu(t,c,r,n)}),c}function zu(e,t,r,n,s){var a=r._reactRootContainer;if(a){var o=a;if(typeof s=="function"){var l=s;s=function(){var c=Zc(o);l.call(c)}}Fu(t,o,e,s)}else o=qN(r,t,e,s,n);return Zc(o)}lv=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var r=io(t.pendingLanes);r!==0&&(bm(t,r|1),$t(t,Qe()),!(je&6)&&(vi=Qe()+500,Ss()))}break;case 13:sa(function(){var n=yn(e,1);if(n!==null){var s=Ct();Nr(n,e,1,s)}}),ep(e,1)}};_m=function(e){if(e.tag===13){var t=yn(e,134217728);if(t!==null){var r=Ct();Nr(t,e,134217728,r)}ep(e,134217728)}};cv=function(e){if(e.tag===13){var t=cs(e),r=yn(e,t);if(r!==null){var n=Ct();Nr(r,e,t,n)}ep(e,t)}};uv=function(){return Pe};dv=function(e,t){var r=Pe;try{return Pe=e,t()}finally{Pe=r}};Lh=function(e,t,r){switch(t){case"input":if(Ph(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=Ru(n);if(!s)throw Error(q(90));zy(n),Ph(n,s)}}}break;case"textarea":Wy(e,r);break;case"select":t=r.value,t!=null&&Ka(e,!!r.multiple,t,!1)}};Jy=Km;Zy=sa;var zN={usingClientEntryPoint:!1,Events:[dl,qa,Ru,Ky,Qy,Km]},Ji={findFiberByHostInstance:zs,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},BN={bundleType:Ji.bundleType,version:Ji.version,rendererPackageName:Ji.rendererPackageName,rendererConfig:Ji.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:Nn.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=tv(e),e===null?null:e.stateNode},findFiberByHostInstance:Ji.findFiberByHostInstance||UN,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};
40if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Ul=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Ul.isDisabled&&Ul.supportsFiber)try{Eu=Ul.inject(BN),Hr=Ul}catch{}}Yt.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=zN;Yt.createPortal=function(e,t){var r=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!rp(t))throw Error(q(200));return FN(e,t,null,r)};Yt.createRoot=function(e,t){if(!rp(e))throw Error(q(299));var r=!1,n="",s=Ow;return t!=null&&(t.unstable_strictMode===!0&&(r=!0),t.identifierPrefix!==void 0&&(n=t.identifierPrefix),t.onRecoverableError!==void 0&&(s=t.onRecoverableError)),t=Xm(e,1,!1,null,null,r,!1,n,s),e[xn]=t.current,Ro(e.nodeType===8?e.parentNode:e),new tp(t)};Yt.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(q(188)):(e=Object.keys(e).join(","),Error(q(268,e)));return e=tv(t),e=e===null?null:e.stateNode,e};Yt.flushSync=function(e){return sa(e)};Yt.hydrate=function(e,t,r){if(!qu(t))throw Error(q(200));return zu(null,e,t,!0,r)};Yt.hydrateRoot=function(e,t,r){if(!rp(e))throw Error(q(405));var n=r!=null&&r.hydratedSources||null,s=!1,a="",o=Ow;if(r!=null&&(r.unstable_strictMode===!0&&(s=!0),r.identifierPrefix!==void 0&&(a=r.identifierPrefix),r.onRecoverableError!==void 0&&(o=r.onRecoverableError)),t=Rw(t,null,e,1,r??null,s,!1,a,o),e[xn]=t.current,Ro(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 Uu(t)};Yt.render=function(e,t,r){if(!qu(t))throw Error(q(200));return zu(null,e,t,!1,r)};Yt.unmountComponentAtNode=function(e){if(!qu(e))throw Error(q(40));return e._reactRootContainer?(sa(function(){zu(null,null,e,!1,function(){e._reactRootContainer=null,e[xn]=null})}),!0):!1};Yt.unstable_batchedUpdates=Km;Yt.unstable_renderSubtreeIntoContainer=function(e,t,r,n){if(!qu(r))throw Error(q(200));if(e==null||e._reactInternals===void 0)throw Error(q(38));return zu(e,t,r,!1,n)};Yt.version="18.3.1-next-f1338f8080-20240426";function Iw(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(Iw)}catch(e){console.error(e)}}Iw(),Iy.exports=Yt;var fa=Iy.exports;const Mw=_y(fa);var Dw,h0=fa;Dw=h0.createRoot,h0.hydrateRoot;const WN=1,HN=1e6;let Gd=0;function VN(){return Gd=(Gd+1)%Number.MAX_SAFE_INTEGER,Gd.toString()}const Yd=new Map,f0=e=>{if(Yd.has(e))return;const t=setTimeout(()=>{Yd.delete(e),bo({type:"REMOVE_TOAST",toastId:e})},HN);Yd.set(e,t)},GN=(e,t)=>{switch(t.type){case"ADD_TOAST":return{...e,toasts:[t.toast,...e.toasts].slice(0,WN)};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?f0(r):e.toasts.forEach(n=>{f0(n.id)}),{...e,toasts:e.toasts.map(n=>
vendor: 13,905 bytes, line 40
40n.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)}}},wc=[];let bc={toasts:[]};function bo(e){bc=GN(bc,e),wc.forEach(t=>{t(bc)})}function YN({...e}){const t=VN(),r=s=>bo({type:"UPDATE_TOAST",toast:{...s,id:t}}),n=()=>bo({type:"DISMISS_TOAST",toastId:t});return bo({type:"ADD_TOAST",toast:{...e,id:t,open:!0,onOpenChange:s=>{s||n()}}}),{id:t,dismiss:n,update:r}}function en(){const[e,t]=p.useState(bc);return p.useEffect(()=>(wc.push(t),()=>{const r=wc.indexOf(t);r>-1&&wc.splice(r,1)}),[e]),{...e,toast:YN,dismiss:r=>bo({type:"DISMISS_TOAST",toastId:r})}}function ae(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 m0(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Lw(...e){return t=>{let r=!1;const n=e.map(s=>{const a=m0(s,t);return!r&&typeof a=="function"&&(r=!0),a});if(r)return()=>{for(let s=0;s<n.length;s++){const a=n[s];typeof a=="function"?a():m0(e[s],null)}}}}function Ee(...e){return p.useCallback(Lw(...e),e)}function KN(e,t){const r=p.createContext(t),n=a=>{const{children:o,...l}=a,c=p.useMemo(()=>l,Object.values(l));return i.jsx(r.Provider,{value:c,children:o})};n.displayName=e+"Provider";function s(a){const o=p.useContext(r);if(o)return o;if(t!==void 0)return t;throw new Error(`\`${a}\` must be used within \`${e}\``)}return[n,s]}function Mr(e,t=[]){let r=[];function n(a,o){const l=p.createContext(o),c=r.length;r=[...r,o];const u=h=>{var x;const{scope:m,children:f,...b}=h,g=((x=m==null?void 0:m[e])==null?void 0:x[c])||l,v=p.useMemo(()=>b,Object.values(b));return i.jsx(g.Provider,{value:v,children:f})};u.displayName=a+"Provider";function d(h,m){var g;const f=((g=m==null?void 0:m[e])==null?void 0:g[c])||l,b=p.useContext(f);if(b)return b;if(o!==void 0)return o;throw new Error(`\`${h}\` must be used within \`${a}\``)}return[u,d]}const s=()=>{const a=r.map(o=>p.createContext(o));return function(l){const c=(l==null?void 0:l[e])||a;return p.useMemo(()=>({[`__scope${e}`]:{...l,[e]:c}}),[l,c])}};return s.scopeName=e,[n,QN(s,...t)]}function QN(...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(a){const o=n.reduce((l,{useScope:c,scopeName:u})=>{const h=c(a)[`__scope${u}`];return{...l,...h}},{});return p.useMemo(()=>({[`__scope${t.scopeName}`]:o}),[o])}};return r.scopeName=t.scopeName,r}function wi(e){const t=ZN(e),r=p.forwardRef((n,s)=>{const{children:a,...o}=n,l=p.Children.toArray(a),c=l.find(e2);if(c){const u=c.props.children,d=l.map(h=>h===c?p.Children.count(u)>1?p.Children.only(null):p.isValidElement(u)?u.props.children:null:h);return i.jsx(t,{...o,ref:s,children:p.isValidElement(u)?p.cloneElement(u,void 0,d):null})}return i.jsx(t,{...o,ref:s,children:a})});return r.displayName=`${e}.Slot`,r}var JN=wi("Slot");function ZN(e){const t=p.forwardRef((r,n)=>{const{children:s,...a}=r;if(p.isValidElement(s)){const o=r2(s),l=t2(a,s.props);return s.type!==p.Fragment&&(l.ref=n?Lw(n,o):o),p.cloneElement(s,l)}return p.Children.count(s)>1?p.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var $w=Symbol("radix.slottable");function XN(e){const t=({children:r})=>i.jsx(i.Fragment,{children:r});return t.displayName=`${e}.Slottable`,t.__radixId=$w,t}function e2(e){return p.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===$w}function t2(e,t){const r={...t};for(const n in t){const s=e[n],a=t[n];/^on[A-Z]/.test(n)?s&&a?r[n]=(...l)=>{const c=a(...l);return s(...l),c}:s&&(r[n]=s):n==="style"?r[n]={...s,...a}:n==="className"&&(r[n]=[s,a].filter(Boolean).join(" "))}return{...e,...r}}function r2(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 np(e){const t=e+"CollectionProvider",[r,n]=Mr(t),[s,a]=r(t,{collectionRef:{current:null},itemMap:new Map}),o=g=>{const{scope:v,children:x}=g,y=G.useRef(null),w=G.useRef(new Map).current;return i.jsx(s,{scope:v,itemMap:w,collectionRef:y,children:x})};o.displayName=t;const l=e+"CollectionSlot",c=wi(l),u=G.forwardRef((g,v)=>{const{scope:x,children:y}=g,w=a(l,x),_=Ee(v,w.collectionRef);return i.jsx(c,{ref:_,children:y})});u.displayName=l;const d=e+"CollectionItemSlot",h="data-radix-collection-item",m=wi(d),f=G.forwardRef((g,v)=>{const{scope:x,children:y,...w}=g,_=G.useRef(null),j=Ee(v,_),k=a(d,x);return G.useEffect(()=>(k.itemMap.set(_,{ref:_,...w}),()=>void k.itemMap.delete(_))),i.jsx(m,{[h]:"",ref:j,children:y})});f.displayName=d;function b(g){const v=a(e+"CollectionConsumer",g);return G.useCallback(()=>{const y=v.collectionRef.current;if(!y)return[];const w=Array.from(y.querySelectorAll(`[${h}]`));return Array.from(v.itemMap.values()).sort((k,S)=>w.indexOf(k.ref.current)-w.indexOf(S.ref.current))},[v.collectionRef,v.itemMap])}return[{Provider:o,Slot:u,ItemSlot:f},b,n]}var n2=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],ue=n2.reduce((e,t)=>{const r=wi(`Primitive.${t}`),n=p.forwardRef((s,a)=>{const{asChild:o,...l}=s,c=o?r:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),i.jsx(c,{...l,ref:a})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{});function Fw(e,t){e&&fa.flushSync(()=>e.dispatchEvent(t))}function or(e){const t=p.useRef(e);return p.useEffect(()=>{t.current=e}),p.useMemo(()=>(...r)=>{var n;return(n=t.current)==null?void 0:n.call(t,...r)},[])}function s2(e,t=globalThis==null?void 0:globalThis.document){const r=or(e);p.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 a2="DismissableLayer",xf="dismissableLayer.update",i2="dismissableLayer.pointerDownOutside",o2="dismissableLayer.focusOutside",p0,Uw=p.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),fl=p.forwardRef((e,t)=>{const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:n,onPointerDownOutside:s,onFocusOutside:a,onInteractOutside:o,onDismiss:l,...c}=e,u=p.useContext(Uw),[d,h]=p.useState(null),m=(d==null?void 0:d.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,f]=p.useState({}),b=Ee(t,S=>h(S)),g=Array.from(u.layers),[v]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),x=g.indexOf(v),y=d?g.indexOf(d):-1,w=u.layersWithOutsidePointerEventsDisabled.size>0,_=y>=x,j=c2(S=>{const C=S.target,P=[...u.branches].some(T=>T.contains(C));!_||P||(s==null||s(S),o==null||o(S),S.defaultPrevented||l==null||l())},m),k=u2(S=>{const C=S.target;[...u.branches].some(T=>T.contains(C))||(a==null||a(S),o==null||o(S),S.defaultPrevented||l==null||l())},m);return s2(S=>{y===u.layers.size-1&&(n==null||n(S),!S.defaultPrevented&&l&&(S.preventDefault(),l()))},m),p.useEffect(()=>{if(d)return r&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(p0=m.body.style.pointerEvents,m.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(d)),u.layers.add(d),g0(),()=>{r&&u.layersWithOutsidePointerEventsDisabled.size===1&&(m.body.style.pointerEvents=p0)}},[d,m,r,u]),p.useEffect(()=>()=>{d&&(u.layers.delete(d),u.layersWithOutsidePointerEventsDisabled.delete(d),g0())},[d,u]),p.useEffect(()=>{const S=()=>f({});return document.addEventListener(xf,S),()=>document.removeEventListener(xf,S)},[]),i.jsx(ue.div,{...c,ref:b,style:{pointerEvents:w?_?"auto":"none":void 0,...e.style},onFocusCapture:ae(e.onFocusCapture,k.onFocusCapture),onBlurCapture:ae(e.onBlurCapture,k.onBlurCapture),onPointerDownCapture:ae(e.onPointerDownCapture,j.onPointerDownCapture)})});fl.displayName=a2;var l2="DismissableLayerBranch",qw=p.forwardRef((e,t)=>{const r=p.useContext(Uw),n=p.useRef(null),s=Ee(t,n);return p.useEffect(()=>{const a=n.current;if(a)return r.branches.add(a),()=>{r.branches.delete(a)}},[r.branches]),i.jsx(ue.div,{...e,ref:s})});qw.displayName=l2;function c2(e,t=globalThis==null?void 0:globalThis.document){const r=or(e),n=p.useRef(!1),s=p.useRef(()=>{});return p.useEffect(()=>{const a=l=>{if(l.target&&!n.current){let c=function(){zw(i2,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",a)},0);return()=>{window.clearTimeout(o),t.removeEventListener("pointerdown",a),t.removeEventListener("click",s.current)}},[t,r]),{onPointerDownCapture:()=>n.current=!0}}function u2(e,t=globalThis==null?void 0:globalThis.document){const r=or(e),n=p.useRef(!1);return p.useEffect(()=>{const s=a=>{a.target&&!n.current&&zw(o2,r,{originalEvent:a},{discrete:!1})};return t.addEventListener("focusin",s),()=>t.removeEventListener("focusin",s)},[t,r]),{onFocusCapture:()=>n.current=!0,onBlurCapture:()=>n.current=!1}}function g0(){const e=new CustomEvent(xf);document.dispatchEvent(e)}function zw(e,t,r,{discrete:n}){const s=r.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:r});t&&s.addEventListener(e,t,{once:!0}),n?Fw(s,a):s.dispatchEvent(a)}var d2=fl,h2=qw,ft=globalThis!=null&&globalThis.document?p.useLayoutEffect:()=>{},f2="Portal",Bu=p.forwardRef((e,t)=>{var l;const{container:r,...n}=e,[s,a]=p.useState(!1);ft(()=>a(!0),[]);const o=r||s&&((l=globalThis==null?void 0:globalThis.document)==null?void 0:l.body);return o?Mw.createPortal(i.jsx(ue.div,{...n,ref:t}),o):null});Bu.displayName=f2;function m2(e,t){return p.useReducer((r,n)=>t[r][n]??r,e)}var Ns=e=>{const{present:t,children:r}=e,n=p2(t),s=typeof r=="function"?r({present:n.isPresent}):p.Children.only(r),a=Ee(n.ref,g2(s));return typeof r=="function"||n.isPresent?p.cloneElement(s,{ref:a}):null};Ns.displayName="Presence";function p2(e){const[t,r]=p.useState(),n=p.useRef(null),s=p.useRef(e),a=p.useRef("none"),o=e?"mounted":"unmounted",[l,c]=m2(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return p.useEffect(()=>{const u=ql(n.current);a.current=l==="mounted"?u:"none"},[l]),ft(()=>{const u=n.current,d=s.current;if(d!==e){const m=a.current,f=ql(u);e?c("MOUNT"):f==="none"||(u==null?void 0:u.display)==="none"?c("UNMOUNT"):c(d&&m!==f?"ANIMATION_OUT":"UNMOUNT"),s.current=e}},[e,c]),ft(()=>{if(t){let u;const d=t.ownerDocument.defaultView??window,h=f=>{const g=ql(n.current).includes(f.animationName);if(f.target===t&&g&&(c("ANIMATION_END"),!s.current)){const v=t.style.animationFillMode;t.style.animationFillMode="forwards",u=d.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=v)})}},m=f=>{f.target===t&&(a.current=ql(n.current))};return t.addEventListener("animationstart",m),t.addEventListener("animationcancel",h),t.addEventListener("animationend",h),()=>{d.clearTimeout(u),t.removeEventListener("animationstart",m),t.removeEventListener("animationcancel",h),t.removeEventListener("animationend",h)}}else c("ANIMATION_END")},[t,c]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:p.useCallback(u=>{n.current=u?getComputedStyle(u):null,r(u)},[])}}function ql(e){return(e==null?void 0:e.animationName)||"none"}function g2(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 x2=hm[" useInsertionEffect ".trim().toString()]||ft;function xs({prop:e,defaultProp:t,onChange:r=()=>{},caller:n}){const[s,a,o]=y2({defaultProp:t,onChange:r}),l=e!==void 0,c=l?e:s;{const d=p.useRef(e!==void 0);p.useEffect(()=>{const h=d.current;h!==l&&console.warn(`${n} is changing from ${h?"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.`),d.current=l},[l,n])}const u=p.useCallback(d=>{var h;if(l){const m=v2(d)?d(e):d;m!==e&&((h=o.current)==null||h.call(o,m))}else a(d)},[l,e,a,o]);return[c,u]}function y2({defaultProp:e,onChange:t}){const[r,n]=p.useState(e),s=p.useRef(r),a=p.useRef(t);return x2(()=>{a.current=t},[t]),p.useEffect(()=>{var o;s.current!==r&&((o=a.current)==null||o.call(a,r),s.current=r)},[r,s]),[r,n,a]}function v2(e){return typeof e=="function"}var Bw=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"}),w2="VisuallyHidden",Wu=p.forwardRef((e,t)=>i.jsx(ue.span,{...e,ref:t,style:{...Bw,...e.style}}));Wu.displayName=w2;var b2=Wu,sp="ToastProvider",[ap,_2,j2]=np("Toast"),[Ww,fL]=Mr("Toast",[j2]),[k2,Hu]=Ww(sp),Hw=e=>{const{__scopeToast:t,label:r="Notification",duration:n=5e3,swipeDirection:s="right",swipeThreshold:a=50,children:o}=e,[l,c]=p.useState(null),[u,d]=p.useState(0),h=p.useRef(!1),m=p.useRef(!1);return r.trim()||console.error(`Invalid prop \`label\` supplied to \`${sp}\`. Expected non-empty \`string\`.`),i.jsx(ap.Provider,{scope:t,children:i.jsx(k2,{scope:t,label:r,duration:n,swipeDirection:s,swipeThreshold:a,toastCount:u,viewport:l,onViewportChange:c,onToastAdd:p.useCallback(()=>d(f=>f+1),[]),onToastRemove:p.useCallback(()=>d(f=>f-1),[]),isFocusedToastEscapeKeyDownRef:h,isClosePausedRef:m,children:o})})};Hw.displayName=sp;var Vw="ToastViewport",S2=["F8"],yf="toast.viewportPause",vf="toast.viewportResume",Gw=p.forwardRef((e,t)=>
40{const{__scopeToast:r,hotkey:n=S2,label:s="Notifications ({hotkey})",...a}=e,o=Hu(Vw,r),l=_2(r),c=p.useRef(null),u=p.useRef(null),d=p.useRef(null),h=p.useRef(null),m=Ee(t,h,o.onViewportChange),f=n.join("+").replace(/Key/g,"").replace(/Digit/g,""),b=o.toastCount>0;p.useEffect(()=>{const v=x=>{var w;n.length!==0&&n.every(_=>x[_]||x.code===_)&&((w=h.current)==null||w.focus())};return document.addEventListener("keydown",v),()=>document.removeEventListener("keydown",v)},[n]),p.useEffect(()=>{const v=c.current,x=h.current;if(b&&v&&x){const y=()=>{if(!o.isClosePausedRef.current){const k=new CustomEvent(yf);x.dispatchEvent(k),o.isClosePausedRef.current=!0}},w=()=>{if(o.isClosePausedRef.current){const k=new CustomEvent(vf);x.dispatchEvent(k),o.isClosePausedRef.current=!1}},_=k=>{!v.contains(k.relatedTarget)&&w()},j=()=>{v.contains(document.activeElement)||w()};return v.addEventListener("focusin",y),v.addEventListener("focusout",_),v.addEventListener("pointermove",y),v.addEventListener("pointerleave",j),window.addEventListener("blur",y),window.addEventListener("focus",w),()=>{v.removeEventListener("focusin",y),v.removeEventListener("focusout",_),v.removeEventListener("pointermove",y),v.removeEventListener("pointerleave",j),window.removeEventListener("blur",y),window.removeEventListener("focus",w)}}},[b,o.isClosePausedRef]);const g=p.useCallback(({tabbingDirection:v})=>{const y=l().map(w=>{const _=w.ref.current,j=[_,...$2(_)];return v==="forwards"?j:j.reverse()});return(v==="forwards"?y.reverse():y).flat()},[l]);return p.useEffect(()=>{const v=h.current;if(v){const x=y=>{var j,k,S;const w=y.altKey||y.ctrlKey||y.metaKey;if(y.key==="Tab"&&!w){const C=document.activeElement,P=y.shiftKey;if(y.target===v&&P){(j=u.current)==null||j.focus();return}const O=g({tabbingDirection:P?"backwards":"forwards"}),M=O.findIndex(R=>R===C);Kd(O.slice(M+1))?y.preventDefault():P?(k=u.current)==null||k.focus():(S=d.current)==null||S.focus()}};return v.addEventListener("keydown",x),()=>v.removeEventListener("keydown",x)}},[l,g]),i.jsxs(h2,{ref:c,role:"region","aria-label":s.replace("{hotkey}",f),tabIndex:-1,style:{pointerEvents:b?void 0:"none"},children:[b&&i.jsx(wf,{ref:u,onFocusFromOutsideViewport:()=>{const v=g({tabbingDirection:"forwards"});Kd(v)}}),i.jsx(ap.Slot,{scope:r,children:i.jsx(ue.ol,{tabIndex:-1,...a,ref:m})}),b&&i.jsx(wf,{ref:d,onFocusFromOutsideViewport:()=>{const v=g({tabbingDirection:"backwards"});Kd(v)}})]})});Gw.displayName=Vw;var Yw="ToastFocusProxy",wf=p.forwardRef((e,t)=>{const{__scopeToast:r,onFocusFromOutsideViewport:n,...s}=e,a=Hu(Yw,r);return i.jsx(Wu,{"aria-hidden":!0,tabIndex:0,...s,ref:t,style:{position:"fixed"},onFocus:o=>{var u;const l=o.relatedTarget;!((u=a.viewport)!=null&&u.contains(l))&&n()}})});wf.displayName=Yw;var ml="Toast",N2="toast.swipeStart",C2="toast.swipeMove",E2="toast.swipeCancel",T2="toast.swipeEnd",Kw=p.forwardRef((e,t)=>{const{forceMount:r,open:n,defaultOpen:s,onOpenChange:a,...o}=e,[l,c]=xs({prop:n,defaultProp:s??!0,onChange:a,caller:ml});return i.jsx(Ns,{present:r||l,children:i.jsx(R2,{open:l,...o,ref:t,onClose:()=>c(!1),onPause:or(e.onPause),onResume:or(e.onResume),onSwipeStart:ae(e.onSwipeStart,u=>{u.currentTarget.setAttribute("data-swipe","start")}),onSwipeMove:ae(e.onSwipeMove,u=>{const{x:d,y:h}=u.detail.delta;u.currentTarget.setAttribute("data-swipe","move"),u.currentTarget.style.setProperty("--radix-toast-swipe-move-x",`${d}px`),u.currentTarget.style.setProperty("--radix-toast-swipe-move-y",`${h}px`)}),onSwipeCancel:ae(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:ae(e.onSwipeEnd,u=>{const{x:d,y:h}=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",`${d}px`),u.currentTarget.style.setProperty("--radix-toast-swipe-end-y",`${h}px`),c(!1)})})})});Kw.displayName=ml;var[P2,A2]=Ww(ml,{onClose(){}}),R2=p.forwardRef((e,t)=>
40{const{__scopeToast:r,type:n="foreground",duration:s,open:a,onClose:o,onEscapeKeyDown:l,onPause:c,onResume:u,onSwipeStart:d,onSwipeMove:h,onSwipeCancel:m,onSwipeEnd:f,...b}=e,g=Hu(ml,r),[v,x]=p.useState(null),y=Ee(t,R=>x(R)),w=p.useRef(null),_=p.useRef(null),j=s||g.duration,k=p.useRef(0),S=p.useRef(j),C=p.useRef(0),{onToastAdd:P,onToastRemove:T}=g,$=or(()=>{var U;(v==null?void 0:v.contains(document.activeElement))&&((U=g.viewport)==null||U.focus()),o()}),O=p.useCallback(R=>{!R||R===1/0||(window.clearTimeout(C.current),k.current=new Date().getTime(),C.current=window.setTimeout($,R))},[$]);p.useEffect(()=>{const R=g.viewport;if(R){const U=()=>{O(S.current),u==null||u()},N=()=>{const D=new Date().getTime()-k.current;S.current=S.current-D,window.clearTimeout(C.current),c==null||c()};return R.addEventListener(yf,N),R.addEventListener(vf,U),()=>{R.removeEventListener(yf,N),R.removeEventListener(vf,U)}}},[g.viewport,j,c,u,O]),p.useEffect(()=>{a&&!g.isClosePausedRef.current&&O(j)},[a,j,g.isClosePausedRef,O]),p.useEffect(()=>(P(),()=>T()),[P,T]);const M=p.useMemo(()=>v?rb(v):null,[v]);return g.viewport?i.jsxs(i.Fragment,{children:[M&&i.jsx(O2,{__scopeToast:r,role:"status","aria-live":n==="foreground"?"assertive":"polite","aria-atomic":!0,children:M}),i.jsx(P2,{scope:r,onClose:$,children:fa.createPortal(i.jsx(ap.ItemSlot,{scope:r,children:i.jsx(d2,{asChild:!0,onEscapeKeyDown:ae(l,()=>{g.isFocusedToastEscapeKeyDownRef.current||$(),g.isFocusedToastEscapeKeyDownRef.current=!1}),children:i.jsx(ue.li,{role:"status","aria-live":"off","aria-atomic":!0,tabIndex:0,"data-state":a?"open":"closed","data-swipe-direction":g.swipeDirection,...b,ref:y,style:{userSelect:"none",touchAction:"none",...e.style},onKeyDown:ae(e.onKeyDown,R=>{R.key==="Escape"&&(l==null||l(R.nativeEvent),R.nativeEvent.defaultPrevented||(g.isFocusedToastEscapeKeyDownRef.current=!0,$()))}),onPointerDown:ae(e.onPointerDown,R=>{R.button===0&&(w.current={x:R.clientX,y:R.clientY})}),onPointerMove:ae(e.onPointerMove,R=>{if(!w.current)return;const U=R.clientX-w.current.x,N=R.clientY-w.current.y,D=!!_.current,E=["left","right"].includes(g.swipeDirection),A=["left","up"].includes(g.swipeDirection)?Math.min:Math.max,Y=E?A(0,U):0,te=E?0:A(0,N),W=R.pointerType==="touch"?10:2,se={x:Y,y:te},I={originalEvent:R,delta:se};D?(_.current=se,zl(C2,h,I,{discrete:!1})):x0(se,g.swipeDirection,W)?(_.current=se,zl(N2,d,I,{discrete:!1}),R.target.setPointerCapture(R.pointerId)):(Math.abs(U)>W||Math.abs(N)>W)&&(w.current=null)}),onPointerUp:ae(e.onPointerUp,R=>{const U=_.current,N=R.target;if(N.hasPointerCapture(R.pointerId)&&N.releasePointerCapture(R.pointerId),_.current=null,w.current=null,U){const D=R.currentTarget,E={originalEvent:R,delta:U};x0(U,g.swipeDirection,g.swipeThreshold)?zl(T2,f,E,{discrete:!0}):zl(E2,m,E,{discrete:!0}),D.addEventListener("click",A=>A.preventDefault(),{once:!0})}})})})}),g.viewport)})]}):null}),O2=e=>{const{__scopeToast:t,children:r,...n}=e,s=Hu(ml,t),[a,o]=p.useState(!1),[l,c]=p.useState(!1);return D2(()=>o(!0)),p.useEffect(()=>{const u=window.setTimeout(()=>c(!0),1e3);return()=>window.clearTimeout(u)},[]),l?null:i.jsx(Bu,{asChild:!0,children:i.jsx(Wu,{...n,children:a&&i.jsxs(i.Fragment,{children:[s.label," ",r]})})})},I2="ToastTitle",Qw=p.forwardRef((e,t)=>{const{__scopeToast:r,...n}=e;return i.jsx(ue.div,{...n,ref:t})});Qw.displayName=I2;var M2="ToastDescription",Jw=p.forwardRef((e,t)=>{const{__scopeToast:r,...n}=e;return i.jsx(ue.div,{...n,ref:t})});Jw.displayName=M2;var Zw="ToastAction",Xw=p.forwardRef((e,t)=>{const{altText:r,...n}=e;return r.trim()?i.jsx(tb,{altText:r,asChild:!0,children:i.jsx(ip,{...n,ref:t})}):(console.error(`Invalid prop \`altText\` supplied to \`${Zw}\`. Expected non-empty \`string\`.`),null)});Xw.displayName=Zw;var eb="ToastClose",ip=p.forwardRef((e,t)=>{const{__scopeToast:r,...n}=e,s=A2(eb,r);return i.jsx(tb,{asChild:!0,children:i.jsx(ue.button,{type:"button",...n,ref:t,onClick:ae(e.onClick,s.onClose)})})});ip.displayName=eb;var tb=p.forwardRef((e,t)=>{const{__scopeToast:r,altText:n,...s}=e;return i.jsx(ue.div,{"data-radix-toast-announce-exclude":"","data-radix-toast-announce-alt":n||void 0,...s,ref:t})});function rb(e){const t=[];
vendor: 6,556 bytes, lines 40-90
40return Array.from(e.childNodes).forEach(n=>{if(n.nodeType===n.TEXT_NODE&&n.textContent&&t.push(n.textContent),L2(n)){const s=n.ariaHidden||n.hidden||n.style.display==="none",a=n.dataset.radixToastAnnounceExclude==="";if(!s)if(a){const o=n.dataset.radixToastAnnounceAlt;o&&t.push(o)}else t.push(...rb(n))}}),t}function zl(e,t,r,{discrete:n}){const s=r.originalEvent.currentTarget,a=new CustomEvent(e,{bubbles:!0,cancelable:!0,detail:r});t&&s.addEventListener(e,t,{once:!0}),n?Fw(s,a):s.dispatchEvent(a)}var x0=(e,t,r=0)=>{const n=Math.abs(e.x),s=Math.abs(e.y),a=n>s;return t==="left"||t==="right"?a&&n>r:!a&&s>r};function D2(e=()=>{}){const t=or(e);ft(()=>{let r=0,n=0;return r=window.requestAnimationFrame(()=>n=window.requestAnimationFrame(t)),()=>{window.cancelAnimationFrame(r),window.cancelAnimationFrame(n)}},[t])}function L2(e){return e.nodeType===e.ELEMENT_NODE}function $2(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 Kd(e){const t=document.activeElement;return e.some(r=>r===t?!0:(r.focus(),document.activeElement!==t))}var F2=Hw,nb=Gw,sb=Kw,ab=Qw,ib=Jw,ob=Xw,lb=ip;function cb(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=cb(e[t]))&&(n&&(n+=" "),n+=r)}else for(r in e)e[r]&&(n&&(n+=" "),n+=r);return n}function ub(){for(var e,t,r=0,n="",s=arguments.length;r<s;r++)(e=arguments[r])&&(t=cb(e))&&(n&&(n+=" "),n+=t);return n}const y0=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,v0=ub,Vu=(e,t)=>r=>{var n;if((t==null?void 0:t.variants)==null)return v0(e,r==null?void 0:r.class,r==null?void 0:r.className);const{variants:s,defaultVariants:a}=t,o=Object.keys(s).map(u=>{const d=r==null?void 0:r[u],h=a==null?void 0:a[u];if(d===null)return null;const m=y0(d)||y0(h);return s[u][m]}),l=r&&Object.entries(r).reduce((u,d)=>{let[h,m]=d;return m===void 0||(u[h]=m),u},{}),c=t==null||(n=t.compoundVariants)===null||n===void 0?void 0:n.reduce((u,d)=>{let{class:h,className:m,...f}=d;return Object.entries(f).every(b=>{let[g,v]=b;return Array.isArray(v)?v.includes({...a,...l}[g]):{...a,...l}[g]===v})?[...u,h,m]:u},[]);return v0(e,o,c,r==null?void 0:r.class,r==null?void 0:r.className)};/** 41 * @license lucide-react v0.462.0 - ISC 42 * 43 * This source code is licensed under the ISC license. 44 * See the LICENSE file in the root directory of this source tree. 45 */const U2=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),db=(...e)=>e.filter((t,r,n)=>!!t&&t.trim()!==""&&n.indexOf(t)===r).join(" ").trim();/** 46 * @license lucide-react v0.462.0 - ISC 47 * 48 * This source code is licensed under the ISC license. 49 * See the LICENSE file in the root directory of this source tree. 50 */var q2={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/** 51 * @license lucide-react v0.462.0 - ISC 52 * 53 * This source code is licensed under the ISC license. 54 * See the LICENSE file in the root directory of this source tree. 55 */const z2=p.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:r=2,absoluteStrokeWidth:n,className:s="",children:a,iconNode:o,...l},c)=>p.createElement("svg",{ref:c,...q2,width:t,height:t,stroke:e,strokeWidth:n?Number(r)*24/Number(t):r,className:db("lucide",s),...l},[...o.map(([u,d])=>p.createElement(u,d)),...Array.isArray(a)?a:[a]]));/** 56 * @license lucide-react v0.462.0 - ISC 57 * 58 * This source code is licensed under the ISC license. 59 * See the LICENSE file in the root directory of this source tree. 60 */const K=(e,t)=>{const r=p.forwardRef(({className:n,...s},a)=>p.createElement(z2,{ref:a,iconNode:t,className:db(`lucide-${U2(e)}`,n),...s}));return r.displayName=`${e}`,r};/** 61 * @license lucide-react v0.462.0 - ISC 62 * 63 * This source code is licensed under the ISC license. 64 * See the LICENSE file in the root directory of this source tree. 65 */const Tr=K("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);/** 66 * @license lucide-react v0.462.0 - ISC 67 * 68 * This source code is licensed under the ISC license. 69 * See the LICENSE file in the root directory of this source tree. 70 */const Pr=K("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);/** 71 * @license lucide-react v0.462.0 - ISC 72 * 73 * This source code is licensed under the ISC license. 74 * See the LICENSE file in the root directory of this source tree. 75 */const hb=K("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"}]]);/** 76 * @license lucide-react v0.462.0 - ISC 77 * 78 * This source code is licensed under the ISC license. 79 * See the LICENSE file in the root directory of this source tree. 80 */const sr=K("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"}]]);/** 81 * @license lucide-react v0.462.0 - ISC 82 * 83 * This source code is licensed under the ISC license. 84 * See the LICENSE file in the root directory of this source tree. 85 */const B2=K("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"}]]);/** 86 * @license lucide-react v0.462.0 - ISC 87 * 88 * This source code is licensed under the ISC license. 89 * See the LICENSE file in the root directory of this source tree. 90 */const W2=K("CalendarClock",[["path",{d:"M21 7.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h3.5",key:"1osxxc"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M3 10h5",key:"r794hk"}
90],["path",{d:"M17.5 17.5 16 16.3V14",key:"akvzfd"}],["circle",{cx:"16",cy:"16",r:"6",key:"qoo3c4"}]]);/** 91 * @license lucide-react v0.462.0 - ISC 92 * 93 * This source code is licensed under the ISC license. 94 * See the LICENSE file in the root directory of this source tree. 95 */const op=K("CalendarDays",[["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"}],["path",{d:"M8 14h.01",key:"6423bh"}],["path",{d:"M12 14h.01",key:"1etili"}],["path",{d:"M16 14h.01",key:"1gbofw"}],["path",{d:"M8 18h.01",key:"lrp35t"}],["path",{d:"M12 18h.01",key:"mhygvu"}],["path",{d:"M16 18h.01",key:"kzsmim"}]]);/** 96 * @license lucide-react v0.462.0 - ISC 97 * 98 * This source code is licensed under the ISC license. 99 * See the LICENSE file in the root directory of this source tree. 100 */const bf=K("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"}]]);/** 101 * @license lucide-react v0.462.0 - ISC 102 * 103 * This source code is licensed under the ISC license. 104 * See the LICENSE file in the root directory of this source tree. 105 */const ma=K("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"}]]);/** 106 * @license lucide-react v0.462.0 - ISC 107 * 108 * This source code is licensed under the ISC license. 109 * See the LICENSE file in the root directory of this source tree. 110 */const pl=K("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/** 111 * @license lucide-react v0.462.0 - ISC 112 * 113 * This source code is licensed under the ISC license. 114 * See the LICENSE file in the root directory of this source tree. 115 */const Cr=K("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/** 116 * @license lucide-react v0.462.0 - ISC 117 * 118 * This source code is licensed under the ISC license. 119 * See the LICENSE file in the root directory of this source tree. 120 */const fb=K("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/** 121 * @license lucide-react v0.462.0 - ISC 122 * 123 * This source code is licensed under the ISC license. 124 * See the LICENSE file in the root directory of this source tree. 125 */const Gr=K("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);/** 126 * @license lucide-react v0.462.0 - ISC 127 * 128 * This source code is licensed under the ISC license. 129 * See the LICENSE file in the root directory of this source tree. 130 */const mb=K("CircleCheckBig",[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]);/** 131 * @license lucide-react v0.462.0 - ISC 132 * 133 * This source code is licensed under the ISC license. 134 * See the LICENSE file in the root directory of this source tree. 135 */const lr=K("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/** 136 * @license lucide-react v0.462.0 - ISC 137 * 138 * This source code is licensed under the ISC license. 139 * See the LICENSE file in the root directory of this source tree. 140 */const H2=K("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"}]]);/** 141 * @license lucide-react v0.462.0 - ISC 142 * 143 * This source code is licensed under the ISC license. 144 * See the LICENSE file in the root directory of this source tree. 145 */const qo=K("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"}]]);/** 146 * @license lucide-react v0.462.0 - ISC 147 * 148 * This source code is licensed under the ISC license. 149 * See the LICENSE file in the root directory of this source tree. 150 */const bi=K("ClipboardList",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"M12 11h4",key:"1jrz19"}],["path",{d:"M12 16h4",key:"n85exb"}],["path",{d:"M8 11h.01",key:"1dfujw"}],["path",{d:"M8 16h.01",key:"18s6g9"}]]);/** 151 * @license lucide-react v0.462.0 - ISC 152 * 153 * This source code is licensed under the ISC license. 154 * See the LICENSE file in the root directory of this source tree. 155 */const wn=K("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);/** 156 * @license lucide-react v0.462.0 - ISC 157 * 158 * This source code is licensed under the ISC license. 159 * See the LICENSE file in the root directory of this source tree.
160 */const pb=K("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"}]]);/** 161 * @license lucide-react v0.462.0 - ISC 162 * 163 * This source code is licensed under the ISC license. 164 * See the LICENSE file in the root directory of this source tree. 165 */const V2=K("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"}]]);/** 166 * @license lucide-react v0.462.0 - ISC 167 * 168 * This source code is licensed under the ISC license. 169 * See the LICENSE file in the root directory of this source tree. 170 */const G2=K("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"}]]);/** 171 * @license lucide-react v0.462.0 - ISC 172 * 173 * This source code is licensed under the ISC license. 174 * See the LICENSE file in the root directory of this source tree. 175 */const Y2=K("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"}]]);/** 176 * @license lucide-react v0.462.0 - ISC 177 * 178 * This source code is licensed under the ISC license. 179 * See the LICENSE file in the root directory of this source tree. 180 */const Xc=K("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"}]]);/** 181 * @license lucide-react v0.462.0 - ISC 182 * 183 * This source code is licensed under the ISC license. 184 * See the LICENSE file in the root directory of this source tree. 185 */const lp=K("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"}]]);/** 186 * @license lucide-react v0.462.0 - ISC 187 * 188 * This source code is licensed under the ISC license. 189 * See the LICENSE file in the root directory of this source tree. 190 */const K2=K("Gem",[["path",{d:"M6 3h12l4 6-10 13L2 9Z",key:"1pcd5k"}],["path",{d:"M11 3 8 9l4 13 4-13-3-6",key:"1fcu3u"}],["path",{d:"M2 9h20",key:"16fsjt"}]]);/** 191 * @license lucide-react v0.462.0 - ISC 192 * 193 * This source code is licensed under the ISC license. 194 * See the LICENSE file in the root directory of this source tree. 195 */const gb=K("Globe",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]]);/** 196 * @license lucide-react v0.462.0 - ISC 197 * 198 * This source code is licensed under the ISC license. 199 * See the LICENSE file in the root directory of this source tree. 200 */const tn=K("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"}]]);/** 201 * @license lucide-react v0.462.0 - ISC 202 * 203 * This source code is licensed under the ISC license. 204 * See the LICENSE file in the root directory of this source tree. 205 */const Q2=K("GripVertical",[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]]);/** 206 * @license lucide-react v0.462.0 - ISC 207 * 208 * This source code is licensed under the ISC license. 209 * See the LICENSE file in the root directory of this source tree. 210 */const J2=K("Hand",[["path",{d:"M18 11V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2",key:"1fvzgz"}],["path",{d:"M14 10V4a2 2 0 0 0-2-2a2 2 0 0 0-2 2v2",key:"1kc0my"}],["path",{d:"M10 10.5V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2v8",key:"10h0bg"}],["path",{d:"M18 8a2 2 0 1 1 4 0v6a8 8 0 0 1-8 8h-2c-2.8 0-4.5-.86-5.99-2.34l-3.6-3.6a2 2 0 0 1 2.83-2.82L7 15",key:"1s1gnw"}]]);/** 211 * @license lucide-react v0.462.0 - ISC 212 * 213 * This source code is licensed under the ISC license. 214 * See the LICENSE file in the root directory of this source tree. 215 */const Z2=K("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"}]]);/** 216 * @license lucide-react v0.462.0 - ISC 217 * 218 * This source code is licensed under the ISC license. 219 * See the LICENSE file in the root directory of this source tree. 220 */const Cn=K("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"}]]);/** 221 * @license lucide-react v0.462.0 - ISC 222 * 223 * This source code is licensed under the ISC license. 224 * See the LICENSE file in the root directory of this source tree. 225 */const _f=K("History",[["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"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]]);/** 226 * @license lucide-react v0.462.0 - ISC 227 * 228 * This source code is licensed under the ISC license. 229 * See the LICENSE file in the root directory of this source tree. 230 */const xb=K("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"}]]);/** 231 * @license lucide-react v0.462.0 - ISC 232 * 233 * This source code is licensed under the ISC license. 234 * See the LICENSE file in the root directory of this source tree.
235 */const yb=K("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"}]]);/** 236 * @license lucide-react v0.462.0 - ISC 237 * 238 * This source code is licensed under the ISC license. 239 * See the LICENSE file in the root directory of this source tree. 240 */const _i=K("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"}]]);/** 241 * @license lucide-react v0.462.0 - ISC 242 * 243 * This source code is licensed under the ISC license. 244 * See the LICENSE file in the root directory of this source tree. 245 */const vb=K("Link2",[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]]);/** 246 * @license lucide-react v0.462.0 - ISC 247 * 248 * This source code is licensed under the ISC license. 249 * See the LICENSE file in the root directory of this source tree. 250 */const $e=K("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/** 251 * @license lucide-react v0.462.0 - ISC 252 * 253 * This source code is licensed under the ISC license. 254 * See the LICENSE file in the root directory of this source tree. 255 */const wb=K("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"}]]);/** 256 * @license lucide-react v0.462.0 - ISC 257 * 258 * This source code is licensed under the ISC license. 259 * See the LICENSE file in the root directory of this source tree. 260 */const w0=K("LogIn",[["path",{d:"M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4",key:"u53s6r"}],["polyline",{points:"10 17 15 12 10 7",key:"1ail0h"}],["line",{x1:"15",x2:"3",y1:"12",y2:"12",key:"v6grx8"}]]);/** 261 * @license lucide-react v0.462.0 - ISC 262 * 263 * This source code is licensed under the ISC license. 264 * See the LICENSE file in the root directory of this source tree. 265 */const eu=K("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"}]]);/** 266 * @license lucide-react v0.462.0 - ISC 267 * 268 * This source code is licensed under the ISC license. 269 * See the LICENSE file in the root directory of this source tree. 270 */const cp=K("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"}]]);/** 271 * @license lucide-react v0.462.0 - ISC 272 * 273 * This source code is licensed under the ISC license. 274 * See the LICENSE file in the root directory of this source tree. 275 */const _c=K("MessageCircle",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}]]);/** 276 * @license lucide-react v0.462.0 - ISC 277 * 278 * This source code is licensed under the ISC license. 279 * See the LICENSE file in the root directory of this source tree. 280 */const X2=K("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"}]]);/** 281 * @license lucide-react v0.462.0 - ISC 282 * 283 * This source code is licensed under the ISC license. 284 * See the LICENSE file in the root directory of this source tree. 285 */const eC=K("Mountain",[["path",{d:"m8 3 4 8 5-5 5 15H2L8 3z",key:"otkl63"}]]);/** 286 * @license lucide-react v0.462.0 - ISC 287 * 288 * This source code is licensed under the ISC license. 289 * See the LICENSE file in the root directory of this source tree. 290 */const tC=K("Pen",[["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"}]]);/** 291 * @license lucide-react v0.462.0 - ISC 292 * 293 * This source code is licensed under the ISC license. 294 * See the LICENSE file in the root directory of this source tree. 295 */const rC=K("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"}]]);/** 296 * @license lucide-react v0.462.0 - ISC 297 * 298 * This source code is licensed under the ISC license. 299 * See the LICENSE file in the root directory of this source tree. 300 */const nC=K("Phone",[["path",{d:"M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z",key:"foiqr5"}]]);/** 301 * @license lucide-react v0.462.0 - ISC 302 * 303 * This source code is licensed under the ISC license. 304 * See the LICENSE file in the root directory of this source tree. 305 */const aa=K("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/** 306 * @license lucide-react v0.462.0 - ISC 307 * 308 * This source code is licensed under the ISC license. 309 * See the LICENSE file in the root directory of this source tree. 310 */const sC=K("Quote",[["path",{d:"M16 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"rib7q0"}],["path",{d:"M5 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"1ymkrd"}]]);/** 311 * @license lucide-react v0.462.0 - ISC 312 * 313 * This source code is licensed under the ISC license. 314 * See the LICENSE file in the root directory of this source tree. 315 */const aC=K("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"}]]);/** 316 * @license lucide-react v0.462.0 - ISC 317 * 318 * This source code is licensed under the ISC license. 319 * See the LICENSE file in the root directory of this source tree. 320 */const up=K("Rocket",[["path",{d:"M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09z",key:"m3
320kijz"}],["path",{d:"m12 15-3-3a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.35 22.35 0 0 1-4 2z",key:"1fmvmk"}],["path",{d:"M9 12H4s.55-3.03 2-4c1.62-1.08 5 0 5 0",key:"1f8sc4"}],["path",{d:"M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5",key:"qeys4"}]]);/** 321 * @license lucide-react v0.462.0 - ISC 322 * 323 * This source code is licensed under the ISC license. 324 * See the LICENSE file in the root directory of this source tree. 325 */const bb=K("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"}]]);/** 326 * @license lucide-react v0.462.0 - ISC 327 * 328 * This source code is licensed under the ISC license. 329 * See the LICENSE file in the root directory of this source tree. 330 */const iC=K("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"}]]);/** 331 * @license lucide-react v0.462.0 - ISC 332 * 333 * This source code is licensed under the ISC license. 334 * See the LICENSE file in the root directory of this source tree. 335 */const oC=K("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"}]]);/** 336 * @license lucide-react v0.462.0 - ISC 337 * 338 * This source code is licensed under the ISC license. 339 * See the LICENSE file in the root directory of this source tree. 340 */const lC=K("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"}]]);/** 341 * @license lucide-react v0.462.0 - ISC 342 * 343 * This source code is licensed under the ISC license. 344 * See the LICENSE file in the root directory of this source tree. 345 */const dp=K("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"}]]);/** 346 * @license lucide-react v0.462.0 - ISC 347 * 348 * This source code is licensed under the ISC license. 349 * See the LICENSE file in the root directory of this source tree. 350 */const cC=K("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"}]]);/** 351 * @license lucide-react v0.462.0 - ISC 352 * 353 * This source code is licensed under the ISC license. 354 * See the LICENSE file in the root directory of this source tree. 355 */const b0=K("SmilePlus",[["path",{d:"M22 11v1a10 10 0 1 1-9-10",key:"ew0xw9"}],["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"}],["path",{d:"M16 5h6",key:"1vod17"}],["path",{d:"M19 2v6",key:"4bpg5p"}]]);/** 356 * @license lucide-react v0.462.0 - ISC 357 * 358 * This source code is licensed under the ISC license. 359 * See the LICENSE file in the root directory of this source tree. 360 */const Ar=K("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"}]]);/** 361 * @license lucide-react v0.462.0 - ISC 362 * 363 * This source code is licensed under the ISC license. 364 * See the LICENSE file in the root directory of this source tree. 365 */const uC=K("Sprout",[["path",{d:"M7 20h10",key:"e6iznv"}],["path",{d:"M10 20c5.5-2.5.8-6.4 3-10",key:"161w41"}],["path",{d:"M9.5 9.4c1.1.8 1.8 2.2 2.3 3.7-2 .4-3.5.4-4.8-.3-1.2-.6-2.3-1.9-3-4.2 2.8-.5 4.4 0 5.5.8z",key:"9gtqwd"}],["path",{d:"M14.1 6a7 7 0 0 0-1.1 4c1.9-.1 3.3-.6 4.3-1.4 1-1 1.6-2.3 1.7-4.6-2.7.1-4 1-4.9 2z",key:"bkxnd2"}]]);/** 366 * @license lucide-react v0.462.0 - ISC 367 * 368 * This source code is licensed under the ISC license. 369 * See the LICENSE file in the root directory of this source tree. 370 */const tu=K("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"}]]);/** 371 * @license lucide-react v0.462.0 - ISC 372 * 373 * This source code is licensed under the ISC license. 374 * See the LICENSE file in the root directory of this source tree. 375 */const bn=K("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"}]]);/** 376 * @license lucide-react v0.462.0 - ISC 377 * 378 * This source code is licensed under the ISC license. 379 * See the LICENSE file in the root directory of this source tree.
380 */const _b=K("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"}]]);/** 381 * @license lucide-react v0.462.0 - ISC 382 * 383 * This source code is licensed under the ISC license. 384 * See the LICENSE file in the root directory of this source tree. 385 */const dC=K("TreeDeciduous",[["path",{d:"M8 19a4 4 0 0 1-2.24-7.32A3.5 3.5 0 0 1 9 6.03V6a3 3 0 1 1 6 0v.04a3.5 3.5 0 0 1 3.24 5.65A4 4 0 0 1 16 19Z",key:"oadzkq"}],["path",{d:"M12 19v3",key:"npa21l"}]]);/** 386 * @license lucide-react v0.462.0 - ISC 387 * 388 * This source code is licensed under the ISC license. 389 * See the LICENSE file in the root directory of this source tree. 390 */const hC=K("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"}]]);/** 391 * @license lucide-react v0.462.0 - ISC 392 * 393 * This source code is licensed under the ISC license. 394 * See the LICENSE file in the root directory of this source tree. 395 */const rn=K("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"}]]);/** 396 * @license lucide-react v0.462.0 - ISC 397 * 398 * This source code is licensed under the ISC license. 399 * See the LICENSE file in the root directory of this source tree. 400 */const ru=K("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"}]]);/** 401 * @license lucide-react v0.462.0 - ISC 402 * 403 * This source code is licensed under the ISC license. 404 * See the LICENSE file in the root directory of this source tree. 405 */const gl=K("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"}],["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"}]]);/** 406 * @license lucide-react v0.462.0 - ISC 407 * 408 * This source code is licensed under the ISC license. 409 * See the LICENSE file in the root directory of this source tree. 410 */const jf=K("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"}]]);/** 411 * @license lucide-react v0.462.0 - ISC 412 * 413 * This source code is licensed under the ISC license. 414 * See the LICENSE file in the root directory of this source tree. 415 */const jb=K("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"}]]);/** 416 * @license lucide-react v0.462.0 - ISC 417 * 418 * This source code is licensed under the ISC license. 419 * See the LICENSE file in the root directory of this source tree. 420 */const wt=K("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"}]]);/** 421 * @license lucide-react v0.462.0 - ISC 422 * 423 * This source code is licensed under the ISC license. 424 * See the LICENSE file in the root directory of this source tree. 425 */const hp=K("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);/** 426 * @license lucide-react v0.462.0 - ISC 427 * 428 * This source code is licensed under the ISC license. 429 * See the LICENSE file in the root directory of this source tree. 430 */const fp=K("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"}]]),mp="-",fC=e=>{const t=pC(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=e;return{getClassGroupId:o=>{const l=o.split(mp);return l[0]===""&&l.length!==1&&l.shift(),kb(l,t)||mC(o)},getConflictingClassGroupIds:(o,l)=>{const c=r[o]||[];return l&&n[o]?[...c,...n[o]]:c}}},kb=(e,t)=>
vendor: 11,928 bytes, line 430
430{var o;if(e.length===0)return t.classGroupId;const r=e[0],n=t.nextPart.get(r),s=n?kb(e.slice(1),n):void 0;if(s)return s;if(t.validators.length===0)return;const a=e.join(mp);return(o=t.validators.find(({validator:l})=>l(a)))==null?void 0:o.classGroupId},_0=/^\[(.+)\]$/,mC=e=>{if(_0.test(e)){const t=_0.exec(e)[1],r=t==null?void 0:t.substring(0,t.indexOf(":"));if(r)return"arbitrary.."+r}},pC=e=>{const{theme:t,prefix:r}=e,n={nextPart:new Map,validators:[]};return xC(Object.entries(e.classGroups),r).forEach(([a,o])=>{kf(o,n,a,t)}),n},kf=(e,t,r,n)=>{e.forEach(s=>{if(typeof s=="string"){const a=s===""?t:j0(t,s);a.classGroupId=r;return}if(typeof s=="function"){if(gC(s)){kf(s(n),t,r,n);return}t.validators.push({validator:s,classGroupId:r});return}Object.entries(s).forEach(([a,o])=>{kf(o,j0(t,a),r,n)})})},j0=(e,t)=>{let r=e;return t.split(mp).forEach(n=>{r.nextPart.has(n)||r.nextPart.set(n,{nextPart:new Map,validators:[]}),r=r.nextPart.get(n)}),r},gC=e=>e.isThemeGetter,xC=(e,t)=>t?e.map(([r,n])=>{const s=n.map(a=>typeof a=="string"?t+a:typeof a=="object"?Object.fromEntries(Object.entries(a).map(([o,l])=>[t+o,l])):a);return[r,s]}):e,yC=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,r=new Map,n=new Map;const s=(a,o)=>{r.set(a,o),t++,t>e&&(t=0,n=r,r=new Map)};return{get(a){let o=r.get(a);if(o!==void 0)return o;if((o=n.get(a))!==void 0)return s(a,o),o},set(a,o){r.has(a)?r.set(a,o):s(a,o)}}},Sb="!",vC=e=>{const{separator:t,experimentalParseClassName:r}=e,n=t.length===1,s=t[0],a=t.length,o=l=>{const c=[];let u=0,d=0,h;for(let v=0;v<l.length;v++){let x=l[v];if(u===0){if(x===s&&(n||l.slice(v,v+a)===t)){c.push(l.slice(d,v)),d=v+a;continue}if(x==="/"){h=v;continue}}x==="["?u++:x==="]"&&u--}const m=c.length===0?l:l.substring(d),f=m.startsWith(Sb),b=f?m.substring(1):m,g=h&&h>d?h-d:void 0;return{modifiers:c,hasImportantModifier:f,baseClassName:b,maybePostfixModifierPosition:g}};return r?l=>r({className:l,parseClassName:o}):o},wC=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},bC=e=>({cache:yC(e.cacheSize),parseClassName:vC(e),...fC(e)}),_C=/\s+/,jC=(e,t)=>{const{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:s}=t,a=[],o=e.trim().split(_C);let l="";for(let c=o.length-1;c>=0;c-=1){const u=o[c],{modifiers:d,hasImportantModifier:h,baseClassName:m,maybePostfixModifierPosition:f}=r(u);let b=!!f,g=n(b?m.substring(0,f):m);if(!g){if(!b){l=u+(l.length>0?" "+l:l);continue}if(g=n(m),!g){l=u+(l.length>0?" "+l:l);continue}b=!1}const v=wC(d).join(":"),x=h?v+Sb:v,y=x+g;if(a.includes(y))continue;a.push(y);const w=s(g,b);for(let _=0;_<w.length;++_){const j=w[_];a.push(x+j)}l=u+(l.length>0?" "+l:l)}return l};function kC(){let e=0,t,r,n="";for(;e<arguments.length;)(t=arguments[e++])&&(r=Nb(t))&&(n&&(n+=" "),n+=r);return n}const Nb=e=>{if(typeof e=="string")return e;let t,r="";for(let n=0;n<e.length;n++)e[n]&&(t=Nb(e[n]))&&(r&&(r+=" "),r+=t);return r};function SC(e,...t){let r,n,s,a=o;function o(c){const u=t.reduce((d,h)=>h(d),e());return r=bC(u),n=r.cache.get,s=r.cache.set,a=l,l(c)}function l(c){const u=n(c);if(u)return u;const d=jC(c,r);return s(c,d),d}return function(){return a(kC.apply(null,arguments))}}const Me=e=>{const t=r=>r[e]||[];return t.isThemeGetter=!0,t},Cb=/^\[(?:([a-z-]+):)?(.+)\]$/i,NC=/^\d+\/\d+$/,CC=new Set(["px","full","screen"]),EC=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,TC=/\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$/,PC=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,AC=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,RC=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,an=e=>ti(e)||CC.has(e)||NC.test(e),Mn=e=>Ri(e,"length",UC),ti=e=>!!e&&!Number.isNaN(Number(e)),Qd=e=>Ri(e,"number",ti),Zi=e=>!!e&&Number.isInteger(Number(e)),OC=e=>e.endsWith("%")&&ti(e.slice(0,-1)),ye=e=>Cb.test(e),Dn=e=>EC.test(e),IC=new Set(["length","size","percentage"]),MC=e=>Ri(e,IC,Eb),DC=e=>Ri(e,"position",Eb),LC=new Set(["image","url"]),$C=e=>Ri(e,LC,zC),FC=e=>Ri(e,"",qC),Xi=()=>!0,Ri=(e,t,r)=>{const n=Cb.exec(e);return n?n[1]?typeof t=="string"?n[1]===t:t.has(n[1]):r(n[2]):!1},UC=e=>TC.test(e)&&!PC.test(e),Eb=()=>!1,qC=e=>AC.test(e),zC=e=>RC.test(e),BC=()=>{const e=Me("colors"),t=Me("spacing"),r=Me("blur"),n=Me("brightness"),s=Me("borderColor"),a=Me("borderRadius"),o=Me("borderSpacing"),l=Me("borderWidth"),c=Me("contrast"),u=Me("grayscale"),d=Me("hueRotate"),h=Me("invert"),m=Me("gap"),f=Me("gradientColorStops"),b=Me("gradientColorStopPositions"),g=Me("inset"),v=Me("margin"),x=Me("opacity"),y=Me("padding"),w=Me("saturate"),_=Me("scale"),j=Me("sepia"),k=Me("skew"),S=Me("space"),C=Me("translate"),P=()=>["auto","contain","none"],T=()=>["auto","hidden","clip","visible","scroll"],$=()=>["auto",ye,t],O=()=>[ye,t],M=()=>["",an,Mn],R=()=>["auto",ti,ye],U=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],N=()=>["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"],E=()=>["start","end","center","between","around","evenly","stretch"],A=()=>["","0",ye],Y=()=>["auto","avoid","all","avoid-page","page","left","right","column"],te=()=>[ti,ye];return{cacheSize:500,separator:":",theme:{colors:[Xi],spacing:[an,Mn],blur:["none","",Dn,ye],brightness:te(),borderColor:[e],borderRadius:["none","","full",Dn,ye],borderSpacing:O(),borderWidth:M(),contrast:te(),grayscale:A(),hueRotate:te(),invert:A(),gap:O(),gradientColorStops:[e],gradientColorStopPositions:[OC,Mn],inset:$(),margin:$(),opacity:te(),padding:O(),saturate:te(),scale:te(),sepia:A(),skew:te(),space:O(),translate:O()},classGroups:{aspect:[{aspect:["auto","square","video",ye]}],container:["container"],columns:[{columns:[Dn]}],"break-after":[{"break-after":Y()}],"break-before":[{"break-before":Y()}],"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:[...U(),ye]}],overflow:[{overflow:T()}],"overflow-x":[{"overflow-x":T()}],"overflow-y":[{"overflow-y":T()}],overscroll:[{overscroll:P()}],"overscroll-x":[{"overscroll-x":P()}],"overscroll-y":[{"overscroll-y":P()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[g]}],"inset-x":[{"inset-x":[g]}],"inset-y":[{"inset-y":[g]}],start:[{start:[g]}],end:[{end:[g]}],top:[{top:[g]}],right:[{right:[g]}],bottom:[{bottom:[g]}],left:[{left:[g]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",Zi,ye]}],basis:[{basis:$()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",ye]}],grow:[{grow:A()}],shrink:[{shrink:A()}],order:[{order:["first","last","none",Zi,ye]}],"grid-cols":[{"grid-cols":[Xi]}],"col-start-end":[{col:["auto",{span:["full",Zi,ye]},ye]}],"col-start":[{"col-start":R()}],"col-end":[{"col-end":R()}],"grid-rows":[{"grid-rows":[Xi]}],"row-start-end":[{row:["auto",{span:[Zi,ye]},ye]}],"row-start":[{"row-start":R()}],"row-end":[{"row-end":R()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",ye]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",ye]}],gap:[{gap:[m]}],"gap-x":[{"gap-x":[m]}],"gap-y":[{"gap-y":[m]}],"justify-content":[{justify:["normal",...E()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...E(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...E(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[y]}],px:[{px:[y]}],py:[{py:[y]}],ps:[{ps:[y]}],pe:[{pe:[y]}],pt:[{pt:[y]}],pr:[{pr:[y]}],pb:[{pb:[y]}],pl:[{pl:[y]}],m:[{m:[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":[S]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[S]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",ye,t]}],"min-w":[{"min-w":[ye,t,"min","max","fit"]}],"max-w":[{"max-w":[ye,t,"none","full","min","max","fit","prose",{screen:[Dn]},Dn]}],h:[{h:[ye,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[ye,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[ye,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[ye,t,"auto","min","max","fit"]}],"font-size":[{text:["base",Dn,Mn]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",Qd]}],"font-family":[{font:[Xi]}],"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",ye]}],"line-clamp":[{"line-clamp":["none",ti,Qd]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",an,ye]}],"list-image":[{"list-image":["none",ye]}],"list-style-type":[{list:["none","disc","decimal",ye]}],"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:[...N(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",an,Mn]}],"underline-offset":[{"underline-offset":["auto",an,ye]}],"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:O()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",ye]}],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",ye]}],"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:[...U(),DC]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",MC]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},$C]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[b]}
vendor: 4,887 bytes, line 430
430],"gradient-via-pos":[{via:[b]}],"gradient-to-pos":[{to:[b]}],"gradient-from":[{from:[f]}],"gradient-via":[{via:[f]}],"gradient-to":[{to:[f]}],rounded:[{rounded:[a]}],"rounded-s":[{"rounded-s":[a]}],"rounded-e":[{"rounded-e":[a]}],"rounded-t":[{"rounded-t":[a]}],"rounded-r":[{"rounded-r":[a]}],"rounded-b":[{"rounded-b":[a]}],"rounded-l":[{"rounded-l":[a]}],"rounded-ss":[{"rounded-ss":[a]}],"rounded-se":[{"rounded-se":[a]}],"rounded-ee":[{"rounded-ee":[a]}],"rounded-es":[{"rounded-es":[a]}],"rounded-tl":[{"rounded-tl":[a]}],"rounded-tr":[{"rounded-tr":[a]}],"rounded-br":[{"rounded-br":[a]}],"rounded-bl":[{"rounded-bl":[a]}],"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:[...N(),"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:N()}],"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:["",...N()]}],"outline-offset":[{"outline-offset":[an,ye]}],"outline-w":[{outline:[an,Mn]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:M()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[x]}],"ring-offset-w":[{"ring-offset":[an,Mn]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",Dn,FC]}],"shadow-color":[{shadow:[Xi]}],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",Dn,ye]}],grayscale:[{grayscale:[u]}],"hue-rotate":[{"hue-rotate":[d]}],invert:[{invert:[h]}],saturate:[{saturate:[w]}],sepia:[{sepia:[j]}],"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":[d]}],"backdrop-invert":[{"backdrop-invert":[h]}],"backdrop-opacity":[{"backdrop-opacity":[x]}],"backdrop-saturate":[{"backdrop-saturate":[w]}],"backdrop-sepia":[{"backdrop-sepia":[j]}],"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",ye]}],duration:[{duration:te()}],ease:[{ease:["linear","in","out","in-out",ye]}],delay:[{delay:te()}],animate:[{animate:["none","spin","ping","pulse","bounce",ye]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[_]}],"scale-x":[{"scale-x":[_]}],"scale-y":[{"scale-y":[_]}],rotate:[{rotate:[Zi,ye]}],"translate-x":[{"translate-x":[C]}],"translate-y":[{"translate-y":[C]}],"skew-x":[{"skew-x":[k]}],"skew-y":[{"skew-y":[k]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",ye]}],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",ye]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":O()}],"scroll-mx":[{"scroll-mx":O()}],"scroll-my":[{"scroll-my":O()}],"scroll-ms":[{"scroll-ms":O()}],"scroll-me":[{"scroll-me":O()}],"scroll-mt":[{"scroll-mt":O()}],"scroll-mr":[{"scroll-mr":O()}],"scroll-mb":[{"scroll-mb":O()}],"scroll-ml":[{"scroll-ml":O()}],"scroll-p":[{"scroll-p":O()}],"scroll-px":[{"scroll-px":O()}],"scroll-py":[{"scroll-py":O()}],"scroll-ps":[{"scroll-ps":O()}],"scroll-pe":[{"scroll-pe":O()}],"scroll-pt":[{"scroll-pt":O()}
vendor: 4,942 bytes, line 430
430],"scroll-pr":[{"scroll-pr":O()}],"scroll-pb":[{"scroll-pb":O()}],"scroll-pl":[{"scroll-pl":O()}],"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",ye]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[an,Mn,Qd]}],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"]}}},WC=SC(BC);function ce(...e){return WC(ub(e))}const HC=F2,Tb=p.forwardRef(({className:e,...t},r)=>i.jsx(nb,{ref:r,className:ce("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}));Tb.displayName=nb.displayName;const VC=Vu("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"}}),Pb=p.forwardRef(({className:e,variant:t,...r},n)=>i.jsx(sb,{ref:n,className:ce(VC({variant:t}),e),...r}));Pb.displayName=sb.displayName;const GC=p.forwardRef(({className:e,...t},r)=>i.jsx(ob,{ref:r,className:ce("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 group-[.destructive]:border-muted/40 hover:bg-secondary group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 group-[.destructive]:focus:ring-destructive disabled:pointer-events-none disabled:opacity-50",e),...t}));GC.displayName=ob.displayName;const Ab=p.forwardRef(({className:e,...t},r)=>i.jsx(lb,{ref:r,className:ce("absolute right-2 top-2 rounded-md p-1 text-foreground
430/50 opacity-0 transition-opacity group-hover:opacity-100 group-[.destructive]:text-red-300 hover:text-foreground group-[.destructive]:hover:text-red-50 focus:opacity-100 focus:outline-none focus:ring-2 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600",e),"toast-close":"",...t,children:i.jsx(hp,{className:"h-4 w-4"})}));Ab.displayName=lb.displayName;const Rb=p.forwardRef(({className:e,...t},r)=>i.jsx(ab,{ref:r,className:ce("text-sm font-semibold",e),...t}));Rb.displayName=ab.displayName;const Ob=p.forwardRef(({className:e,...t},r)=>i.jsx(ib,{ref:r,className:ce("text-sm opacity-90",e),...t}));Ob.displayName=ib.displayName;function YC(){const{toasts:e}=en();return i.jsxs(HC,{children:[e.map(function({id:t,title:r,description:n,action:s,...a}){return i.jsxs(Pb,{...a,children:[i.jsxs("div",{className:"grid gap-1",children:[r&&i.jsx(Rb,{children:r}),n&&i.jsx(Ob,{children:n})]}),s,i.jsx(Ab,{})]},t)}),i.jsx(Tb,{})]})}var k0=["light","dark"],KC="(prefers-color-scheme: dark)",QC=p.createContext(void 0),JC={setTheme:e=>{},themes:[]},ZC=()=>{var e;return(e=p.useContext(QC))!=null?e:JC};p.memo(({forcedTheme:e,storageKey:t,attribute:r,enableSystem:n,enableColorScheme:s,defaultTheme:a,value:o,attrs:l,nonce:c})=>{let u=a==="system",d=r==="class"?`var d=document.documentElement,c=d.classList;${`c.remove(${l.map(b=>`'${b}'`).join(",")})`};`:`var d=document.documentElement,n='${r}',s='setAttribute';`,h=s?k0.includes(a)&&a?`if(e==='light'||e==='dark'||!e)d.style.colorScheme=e||'${a}'`:"if(e==='light'||e==='dark')d.style.colorScheme=e":"",m=(b,g=!1,v=!0)=>{let x=o?o[b]:b,y=g?b+"|| ''":`'${x}'`,w="";return s&&v&&!g&&k0.includes(b)&&(w+=`d.style.colorScheme = '${b}';`),r==="class"?g||x?w+=`c.add(${y})`:w+="null":x&&(w+=`d[s](n,${y})`),w},f=e?`!function(){${d}${m(e)}}()`:n?`!function(){try{${d}var e=localStorage.getItem('${t}');if('system'===e||(!e&&${u})){var t='${KC}',m=window.matchMedia(t);if(m.media!==t||m.matches){${m("dark")}}else{${m("light")}}}else if(e){${o?`var x=${JSON.stringify(o)};`:""}${m(o?"x[e]":"e",!0)}}${u?"":"else{"+m(a,!1,!1)+"}"}${h}}catch(e){}}()`:`!function(){try{${d}var e=localStorage.getItem('${t}');if(e){${o?`var x=${JSON.stringify(o)};`:""}${m(o?"x[e]":"e",!0)}}else{${m(a,!1,!1)};}${h}}catch(t){}}();`;return p.createElement("script",{nonce:c,dangerouslySetInnerHTML:{__html:f}})});var XC=e=>{switch(e){case"success":return rE;case"info":return sE;case"warning":return nE;case"error":return aE;default:return null}},eE=Array(12).fill(0),tE=({visible:e,className:t})=>G.createElement("div",{className:["sonner-loading-wrapper",t].filter(Boolean).join(" "),"data-visible":e},G.createElement("div",{className:"sonner-spinner"},eE.map((r,n)=>G.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${n}`})))),rE=G.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},G.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"})),nE=G.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},G.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"})),sE=G.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},G.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"})),aE=G.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},G.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"})),iE=G.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"},G.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),G.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),oE=()=>{let[e,t]=G.useState(document.hidden);return G.useEffect(()=>{let r=()=>{t(document.hidden)};return document.addEventListener("visibilitychange",r),()=>window.removeEventListener("visibilitychange",r)},[]),e},Sf=1,lE=class{constructor(){this.subscribe=e=>(this.subscribers.push(e),()=>{let t=this.subscribers.indexOf(e);this.subscribers.splice(t,1)}),this.publish=e=>
vendor: 1,050 bytes, line 430
430{this.subscribers.forEach(t=>t(e))},this.addToast=e=>{this.publish(e),this.toasts=[...this.toasts,e]},this.create=e=>{var t;let{message:r,...n}=e,s=typeof(e==null?void 0:e.id)=="number"||((t=e.id)==null?void 0:t.length)>0?e.id:Sf++,a=this.toasts.find(l=>l.id===s),o=e.dismissible===void 0?!0:e.dismissible;return this.dismissedToasts.has(s)&&this.dismissedToasts.delete(s),a?this.toasts=this.toasts.map(l=>l.id===s?(this.publish({...l,...e,id:s,title:r}),{...l,...e,id:s,dismissible:o,title:r}):l):this.addToast({title:r,...n,dismissible:o,id:s}),s},this.dismiss=e=>(this.dismissedToasts.add(e),e||this.toasts.forEach(t=>{this.subscribers.forEach(r=>r({id:t.id,dismiss:!0}))}),this.subscribers.forEach(t=>t({id:e,dismiss:!0})),e),this.message=(e,t)=>this.create({...t,message:e}),this.error=(e,t)=>this.create({...t,message:e,type:"error"}),this.success=(e,t)=>this.create({...t,type:"success",message:e}),this.info=(e,t)=>this.create({...t,type:"info",message:e}),this.warning=(e,t)=>this.create({...t,type:"warning",message:e}),this.loading=(e,t)=>
430this.create({...t,type:"loading",message:e}),this.promise=(e,t)=>{if(!t)return;let r;t.loading!==void 0&&(r=this.create({...t,promise:e,type:"loading",message:t.loading,description:typeof t.description!="function"?t.description:void 0}));let n=e instanceof Promise?e:e(),s=r!==void 0,a,o=n.then(async c=>{if(a=["resolve",c],G.isValidElement(c))s=!1,this.create({id:r,type:"default",message:c});else if(uE(c)&&!c.ok){s=!1;let u=typeof t.error=="function"?await t.error(`HTTP error! status: ${c.status}`):t.error,d=typeof t.description=="function"?await t.description(`HTTP error! status: ${c.status}`):t.description;this.create({id:r,type:"error",message:u,description:d})}else if(t.success!==void 0){s=!1;let u=typeof t.success=="function"?await t.success(c):t.success,d=typeof t.description=="function"?await t.description(c):t.description;this.create({id:r,type:"success",message:u,description:d})}}).catch(async c=>{if(a=["reject",c],t.error!==void 0){s=!1;let u=typeof t.error=="function"?await t.error(c):t.error,d=typeof t.description=="function"?await t.description(c):t.description;this.create({id:r,type:"error",message:u,description:d})}}).finally(()=>{var c;s&&(this.dismiss(r),r=void 0),(c=t.finally)==null||c.call(t)}),l=()=>new Promise((c,u)=>o.then(()=>a[0]==="reject"?u(a[1]):c(a[1])).catch(u));return typeof r!="string"&&typeof r!="number"?{unwrap:l}:Object.assign(r,{unwrap:l})},this.custom=(e,t)=>{let r=(t==null?void 0:t.id)||Sf++;return this.create({jsx:e(r),id:r,...t}),r},this.getActiveToasts=()=>this.toasts.filter(e=>!this.dismissedToasts.has(e.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}},Pt=new lE,cE=(e,t)=>{let r=(t==null?void 0:t.id)||Sf++;return Pt.addToast({title:e,...t,id:r}),r},uE=e=>e&&typeof e=="object"&&"ok"in e&&typeof e.ok=="boolean"&&"status"in e&&typeof e.status=="number",dE=cE,hE=()=>Pt.toasts,fE=()=>Pt.getActiveToasts(),Ke=Object.assign(dE,{success:Pt.success,info:Pt.info,warning:Pt.warning,error:Pt.error,custom:Pt.custom,message:Pt.message,promise:Pt.promise,dismiss:Pt.dismiss,loading:Pt.loading},{getHistory:hE,getToasts:fE});function mE(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))}mE(`: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;
430left: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}
430: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%);
430--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%)} 431`);function Bl(e){return e.label!==void 0}var pE=3,gE="32px",xE="16px",S0=4e3,yE=356,vE=14,wE=20,bE=200;function mr(...e){return e.filter(Boolean).join(" ")}function _E(e){let[t,r]=e.split("-"),n=[];return t&&n.push(t),r&&n.push(r),n}var jE=e=>{var t,r,n,s,a,o,l,c,u,d,h;let{invert:m,toast:f,unstyled:b,interacting:g,setHeights:v,visibleToasts:x,heights:y,index:w,toasts:_,expanded:j,removeToast:k,defaultRichColors:S,closeButton:C,style:P,cancelButtonStyle:T,actionButtonStyle:$,className:O="",descriptionClassName:M="",duration:R,position:U,gap:N,loadingIcon:D,expandByDefault:E,classNames:A,icons:Y,closeButtonAriaLabel:te="Close toast",pauseWhenPageIsHidden:W}=e,[se,I]=G.useState(null),[re,xe]=G.useState(null),[V,_e]=G.useState(!1),[de,he]=G.useState(!1),[le,we]=G.useState(!1),[mt,Qt]=G.useState(!1),[Ps,Pn]=G.useState(!1),[As,zi]=G.useState(0),[ga,Jp]=G.useState(0),Bi=G.useRef(f.duration||R||S0),Zp=G.useRef(null),Rs=G.useRef(null),ck=w===0,uk=w+1<=x,Jt=f.type,xa=f.dismissible!==!1,dk=f.className||"",hk=f.descriptionClassName||"",_l=G.useMemo(()=>y.findIndex(pe=>pe.toastId===f.id)||0,[y,f.id]),fk=G.useMemo(()=>{var pe;
431return(pe=f.closeButton)!=null?pe:C},[f.closeButton,C]),Xp=G.useMemo(()=>f.duration||R||S0,[f.duration,R]),yd=G.useRef(0),ya=G.useRef(0),eg=G.useRef(0),va=G.useRef(null),[mk,pk]=U.split("-"),tg=G.useMemo(()=>y.reduce((pe,Ae,Fe)=>Fe>=_l?pe:pe+Ae.height,0),[y,_l]),rg=oE(),gk=f.invert||m,vd=Jt==="loading";ya.current=G.useMemo(()=>_l*N+tg,[_l,tg]),G.useEffect(()=>{Bi.current=Xp},[Xp]),G.useEffect(()=>{_e(!0)},[]),G.useEffect(()=>{let pe=Rs.current;if(pe){let Ae=pe.getBoundingClientRect().height;return Jp(Ae),v(Fe=>[{toastId:f.id,height:Ae,position:f.position},...Fe]),()=>v(Fe=>Fe.filter(ur=>ur.toastId!==f.id))}},[v,f.id]),G.useLayoutEffect(()=>{if(!V)return;let pe=Rs.current,Ae=pe.style.height;pe.style.height="auto";let Fe=pe.getBoundingClientRect().height;pe.style.height=Ae,Jp(Fe),v(ur=>ur.find(dr=>dr.toastId===f.id)?ur.map(dr=>dr.toastId===f.id?{...dr,height:Fe}:dr):[{toastId:f.id,height:Fe,position:f.position},...ur])},[V,f.title,f.description,v,f.id]);let An=G.useCallback(()=>{he(!0),zi(ya.current),v(pe=>pe.filter(Ae=>Ae.toastId!==f.id)),setTimeout(()=>{k(f)},bE)},[f,k,v,ya]);G.useEffect(()=>{if(f.promise&&Jt==="loading"||f.duration===1/0||f.type==="loading")return;let pe;return j||g||W&&rg?(()=>{if(eg.current<yd.current){let Ae=new Date().getTime()-yd.current;Bi.current=Bi.current-Ae}eg.current=new Date().getTime()})():Bi.current!==1/0&&(yd.current=new Date().getTime(),pe=setTimeout(()=>{var Ae;(Ae=f.onAutoClose)==null||Ae.call(f,f),An()},Bi.current)),()=>clearTimeout(pe)},[j,g,f,Jt,W,rg,An]),G.useEffect(()=>{f.delete&&An()},[An,f.delete]);function xk(){var pe,Ae,Fe;return Y!=null&&Y.loading?G.createElement("div",{className:mr(A==null?void 0:A.loader,(pe=f==null?void 0:f.classNames)==null?void 0:pe.loader,"sonner-loader"),"data-visible":Jt==="loading"},Y.loading):D?G.createElement("div",{className:mr(A==null?void 0:A.loader,(Ae=f==null?void 0:f.classNames)==null?void 0:Ae.loader,"sonner-loader"),"data-visible":Jt==="loading"},D):G.createElement(tE,{className:mr(A==null?void 0:A.loader,(Fe=f==null?void 0:f.classNames)==null?void 0:Fe.loader),visible:Jt==="loading"})}return G.createElement("li",{tabIndex:0,ref:Rs,className:mr(O,dk,A==null?void 0:A.toast,(t=f==null?void 0:f.classNames)==null?void 0:t.toast,A==null?void 0:A.default,A==null?void 0:A[Jt],(r=f==null?void 0:f.classNames)==null?void 0:r[Jt]),"data-sonner-toast":"","data-rich-colors":(n=f.richColors)!=null?n:S,"data-styled":!(f.jsx||f.unstyled||b),"data-mounted":V,"data-promise":!!f.promise,"data-swiped":Ps,"data-removed":de,"data-visible":uk,"data-y-position":mk,"data-x-position":pk,"data-index":w,"data-front":ck,"data-swiping":le,"data-dismissible":xa,"data-type":Jt,"data-invert":gk,"data-swipe-out":mt,"data-swipe-direction":re,"data-expanded":!!(j||E&&V),style:{"--index":w,"--toasts-before":w,"--z-index":_.length-w,"--offset":`${de?As:ya.current}px`,"--initial-height":E?"auto":`${ga}px`,...P,...f.style},onDragEnd:()=>{we(!1),I(null),va.current=null},onPointerDown:pe=>{vd||!xa||(Zp.current=new Date,zi(ya.current),pe.target.setPointerCapture(pe.pointerId),pe.target.tagName!=="BUTTON"&&(we(!0),va.current={x:pe.clientX,y:pe.clientY}))},onPointerUp:()=>{var pe,Ae,Fe,ur;if(mt||!xa)return;va.current=null;let dr=Number(((pe=Rs.current)==null?void 0:pe.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),Rn=Number(((Ae=Rs.current)==null?void 0:Ae.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),Os=new Date().getTime()-((Fe=Zp.current)==null?void 0:Fe.getTime()),hr=se==="x"?dr:Rn,On=Math.abs(hr)/Os;if(Math.abs(hr)>=wE||On>.11){zi(ya.current),(ur=f.onDismiss)==null||ur.call(f,f),xe(se==="x"?dr>0?"right":"left":Rn>0?"down":"up"),An(),Qt(!0),Pn(!1);return}we(!1),I(null)},onPointerMove:pe=>{var Ae,Fe,ur,dr;if(!va.current||!xa||((Ae=window.getSelection())==null?void 0:Ae.toString().length)>0)return;let Rn=pe.clientY-va.current.y,Os=pe.clientX-va.current.x,hr=(Fe=e.swipeDirections)!=null?Fe:_E(U);!se&&(Math.abs(Os)>1||Math.abs(Rn)>1)&&I(Math.abs(Os)>Math.abs(Rn)?"x":"y");let On={x:0,y:0};se==="y"?(hr.includes("top")||hr.includes("bottom"))&&(hr.includes("top")&&Rn<0||hr.includes("bottom")&&Rn>0)&&(On.y=Rn):se==="x"&&(hr.includes("left")||hr.includes("right"))&&(hr.includes("left")&&Os<0||hr.includes("right")&&Os>0)&&(On.x=Os),(Math.abs(On.x)>0||Math.abs(On.y)>0)&&Pn(!0),(ur=Rs.current)==null||ur.style.setProperty("--swipe-amount-x",`${On.x}px`),(dr=Rs.current)==null||dr.style.setProperty("--swipe-amount-y",`${On.y}px`)}},fk&&!f.jsx?G.createElement("button",{"aria-label":te,"data-disabled":vd,"data-close-button":!0,onClick:vd||!xa?()=>{}:()=>{var pe;An(),(pe=f.onDismiss)==null||pe.call(f,f)},className:mr(A==null?void 0:A.closeButton,(s=f==null?void 0:f.classNames)==null?void 0:s.closeButton)},(a=Y==null?void 0:Y.close)!=null?a:iE):null,f.jsx||p.isValidElement(f.title)?f.jsx?f.jsx:typeof f.title=="function"?f.title():f.title:G.createElement(G.Fragment,null,Jt||f.icon||f.promise?G.createElement("div",{"data-icon":"",className:mr(A==null?void 0:A.icon,(o=f==null?void 0:f.classNames)==null?void 0:o.icon)},f.promise||f.type==="loading"&&!f.icon?f.icon||xk():null,f.type!=="loading"?f.icon||(Y==null?void 0:Y[Jt])||XC(Jt):null):null,G.createElement("div",{"data-content":"",className:mr(A==null?void 0:A.content,(l=f==null?void 0:f.classNames)==null?void 0:l.content)},G.createElement("div",{"data-title":"",className:mr(A==null?void 0:A.title,(c=f==null?void 0:f.classNames)==null?void 0:c.title)},typeof f.title=="function"?f.title():f.title),f.description?G.createElement("div",{"data-description":"",className:mr(M,hk,A==null?void 0:A.description,(u=f==null?void 0:f.classNames)==null?void 0:u.description)},typeof f.description=="function"?f.description():f.description):null),p.isValidElement(f.cancel)?f.cancel:f.cancel&&Bl(f.cancel)?G.createElement("button",{"data-button":!0,"data-cancel":!0,style:f.cancelButtonStyle||T,onClick:pe=>{var Ae,Fe;Bl(f.cancel)&&xa&&((Fe=(Ae=f.cancel).onClick)==null||Fe.call(Ae,pe),An())},className:mr(A==null?void 0:A.cancelButton,(d=f==null?void 0:f.classNames)==null?void 0:d.cancelButton)},f.cancel.label):null,p.isValidElement(f.action)?f.action:f.action&&Bl(f.action)?G.createElement("button",{"data-button":!0,"data-action":!0,style:f.actionButtonStyle||$,onClick:pe=>{var Ae,Fe;Bl(f.action)&&((Fe=(Ae=f.action).onClick)==null||Fe.call(Ae,pe),!pe.defaultPrevented&&An())},className:mr(A==null?void 0:A.actionButton,(h=f==null?void 0:f.classNames)==null?void 0:h.actionButton)},f.action.label):null))};function N0(){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 kE(e,t){let r={};return[e,t].forEach((n,s)=>{let a=s===1,o=a?"--mobile-offset":"--offset",l=a?xE:gE;function c(u){["top","right","bottom","left"].forEach(d=>{r[`${o}-${d}`]=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 SE=p.forwardRef(function(e,t){let{invert:r,position:n="bottom-right",hotkey:s=["altKey","KeyT"],expand:a,closeButton:o,className:l,offset:c,mobileOffset:u,theme:d="light",richColors:h,duration:m,style:f,visibleToasts:b=pE,toastOptions:g,dir:v=N0(),gap:x=vE,loadingIcon:y,icons:w,containerAriaLabel:_="Notifications",pauseWhenPageIsHidden:j}=e,[k,S]=G.useState([]),C=G.useMemo(()=>Array.from(new Set([n].concat(k.filter(W=>W.position).map(W=>W.position)))),[k,n]),[P,T]=G.useState([]),[$,O]=G.useState(!1),[M,R]=G.useState(!1),[U,N]=G.useState(d!=="system"?d:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dar
431k":"light"),D=G.useRef(null),E=s.join("+").replace(/Key/g,"").replace(/Digit/g,""),A=G.useRef(null),Y=G.useRef(!1),te=G.useCallback(W=>{S(se=>{var I;return(I=se.find(re=>re.id===W.id))!=null&&I.delete||Pt.dismiss(W.id),se.filter(({id:re})=>re!==W.id)})},[]);return G.useEffect(()=>Pt.subscribe(W=>{if(W.dismiss){S(se=>se.map(I=>I.id===W.id?{...I,delete:!0}:I));return}setTimeout(()=>{Mw.flushSync(()=>{S(se=>{let I=se.findIndex(re=>re.id===W.id);return I!==-1?[...se.slice(0,I),{...se[I],...W},...se.slice(I+1)]:[W,...se]})})})}),[]),G.useEffect(()=>{if(d!=="system"){N(d);return}if(d==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?N("dark"):N("light")),typeof window>"u")return;let W=window.matchMedia("(prefers-color-scheme: dark)");try{W.addEventListener("change",({matches:se})=>{N(se?"dark":"light")})}catch{W.addListener(({matches:I})=>{try{N(I?"dark":"light")}catch(re){console.error(re)}})}},[d]),G.useEffect(()=>{k.length<=1&&O(!1)},[k]),G.useEffect(()=>{let W=se=>{var I,re;s.every(xe=>se[xe]||se.code===xe)&&(O(!0),(I=D.current)==null||I.focus()),se.code==="Escape"&&(document.activeElement===D.current||(re=D.current)!=null&&re.contains(document.activeElement))&&O(!1)};return document.addEventListener("keydown",W),()=>document.removeEventListener("keydown",W)},[s]),G.useEffect(()=>{if(D.current)return()=>{A.current&&(A.current.focus({preventScroll:!0}),A.current=null,Y.current=!1)}},[D.current]),G.createElement("section",{ref:t,"aria-label":`${_} ${E}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},C.map((W,se)=>{var I;let[re,xe]=W.split("-");return k.length?G.createElement("ol",{key:W,dir:v==="auto"?N0():v,tabIndex:-1,ref:D,className:l,"data-sonner-toaster":!0,"data-theme":U,"data-y-position":re,"data-lifted":$&&k.length>1&&!a,"data-x-position":xe,style:{"--front-toast-height":`${((I=P[0])==null?void 0:I.height)||0}px`,"--width":`${yE}px`,"--gap":`${x}px`,...f,...kE(c,u)},onBlur:V=>{Y.current&&!V.currentTarget.contains(V.relatedTarget)&&(Y.current=!1,A.current&&(A.current.focus({preventScroll:!0}),A.current=null))},onFocus:V=>{V.target instanceof HTMLElement&&V.target.dataset.dismissible==="false"||Y.current||(Y.current=!0,A.current=V.relatedTarget)},onMouseEnter:()=>O(!0),onMouseMove:()=>O(!0),onMouseLeave:()=>{M||O(!1)},onDragEnd:()=>O(!1),onPointerDown:V=>{V.target instanceof HTMLElement&&V.target.dataset.dismissible==="false"||R(!0)},onPointerUp:()=>R(!1)},k.filter(V=>!V.position&&se===0||V.position===W).map((V,_e)=>{var de,he;return G.createElement(jE,{key:V.id,icons:w,index:_e,toast:V,defaultRichColors:h,duration:(de=g==null?void 0:g.duration)!=null?de:m,className:g==null?void 0:g.className,descriptionClassName:g==null?void 0:g.descriptionClassName,invert:r,visibleToasts:b,closeButton:(he=g==null?void 0:g.closeButton)!=null?he:o,interacting:M,position:W,style:g==null?void 0:g.style,unstyled:g==null?void 0:g.unstyled,classNames:g==null?void 0:g.classNames,cancelButtonStyle:g==null?void 0:g.cancelButtonStyle,actionButtonStyle:g==null?void 0:g.actionButtonStyle,removeToast:te,toasts:k.filter(le=>le.position==V.position),heights:P.filter(le=>le.position==V.position),setHeights:T,expandByDefault:a,gap:x,loadingIcon:y,expanded:$,pauseWhenPageIsHidden:j,swipeDirections:e.swipeDirections})})):null}))});const NE=({...e})=>{const{theme:t="system"}=ZC();return i.jsx(SE,{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 CE=hm[" useId ".trim().toString()]||(()=>{}),EE=0;function ds(e){const[t,r]=p.useState(CE());return ft(()=>{r(n=>n??String(EE++))},[e]),t?`radix-${t}`:""}const TE=["top","right","bottom","left"],ys=Math.min,qt=Math.max,nu=Math.round,Wl=Math.floor,Yr=e=>({x:e,y:e}
vendor: 9,136 bytes, line 431
431),PE={left:"right",right:"left",bottom:"top",top:"bottom"},AE={start:"end",end:"start"};function Nf(e,t,r){return qt(e,ys(t,r))}function _n(e,t){return typeof e=="function"?e(t):e}function jn(e){return e.split("-")[0]}function Oi(e){return e.split("-")[1]}function pp(e){return e==="x"?"y":"x"}function gp(e){return e==="y"?"height":"width"}const RE=new Set(["top","bottom"]);function Wr(e){return RE.has(jn(e))?"y":"x"}function xp(e){return pp(Wr(e))}function OE(e,t,r){r===void 0&&(r=!1);const n=Oi(e),s=xp(e),a=gp(s);let o=s==="x"?n===(r?"end":"start")?"right":"left":n==="start"?"bottom":"top";return t.reference[a]>t.floating[a]&&(o=su(o)),[o,su(o)]}function IE(e){const t=su(e);return[Cf(e),t,Cf(t)]}function Cf(e){return e.replace(/start|end/g,t=>AE[t])}const C0=["left","right"],E0=["right","left"],ME=["top","bottom"],DE=["bottom","top"];function LE(e,t,r){switch(e){case"top":case"bottom":return r?t?E0:C0:t?C0:E0;case"left":case"right":return t?ME:DE;default:return[]}}function $E(e,t,r,n){const s=Oi(e);let a=LE(jn(e),r==="start",n);return s&&(a=a.map(o=>o+"-"+s),t&&(a=a.concat(a.map(Cf)))),a}function su(e){return e.replace(/left|right|bottom|top/g,t=>PE[t])}function FE(e){return{top:0,right:0,bottom:0,left:0,...e}}function Ib(e){return typeof e!="number"?FE(e):{top:e,right:e,bottom:e,left:e}}function au(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 T0(e,t,r){let{reference:n,floating:s}=e;const a=Wr(t),o=xp(t),l=gp(o),c=jn(t),u=a==="y",d=n.x+n.width/2-s.width/2,h=n.y+n.height/2-s.height/2,m=n[l]/2-s[l]/2;let f;switch(c){case"top":f={x:d,y:n.y-s.height};break;case"bottom":f={x:d,y:n.y+n.height};break;case"right":f={x:n.x+n.width,y:h};break;case"left":f={x:n.x-s.width,y:h};break;default:f={x:n.x,y:n.y}}switch(Oi(t)){case"start":f[o]-=m*(r&&u?-1:1);break;case"end":f[o]+=m*(r&&u?-1:1);break}return f}const UE=async(e,t,r)=>{const{placement:n="bottom",strategy:s="absolute",middleware:a=[],platform:o}=r,l=a.filter(Boolean),c=await(o.isRTL==null?void 0:o.isRTL(t));let u=await o.getElementRects({reference:e,floating:t,strategy:s}),{x:d,y:h}=T0(u,n,c),m=n,f={},b=0;for(let g=0;g<l.length;g++){const{name:v,fn:x}=l[g],{x:y,y:w,data:_,reset:j}=await x({x:d,y:h,initialPlacement:n,placement:m,strategy:s,middlewareData:f,rects:u,platform:o,elements:{reference:e,floating:t}});d=y??d,h=w??h,f={...f,[v]:{...f[v],..._}},j&&b<=50&&(b++,typeof j=="object"&&(j.placement&&(m=j.placement),j.rects&&(u=j.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:s}):j.rects),{x:d,y:h}=T0(u,m,c)),g=-1)}return{x:d,y:h,placement:m,strategy:s,middlewareData:f}};async function zo(e,t){var r;t===void 0&&(t={});const{x:n,y:s,platform:a,rects:o,elements:l,strategy:c}=e,{boundary:u="clippingAncestors",rootBoundary:d="viewport",elementContext:h="floating",altBoundary:m=!1,padding:f=0}=_n(t,e),b=Ib(f),v=l[m?h==="floating"?"reference":"floating":h],x=au(await a.getClippingRect({element:(r=await(a.isElement==null?void 0:a.isElement(v)))==null||r?v:v.contextElement||await(a.getDocumentElement==null?void 0:a.getDocumentElement(l.floating)),boundary:u,rootBoundary:d,strategy:c})),y=h==="floating"?{x:n,y:s,width:o.floating.width,height:o.floating.height}:o.reference,w=await(a.getOffsetParent==null?void 0:a.getOffsetParent(l.floating)),_=await(a.isElement==null?void 0:a.isElement(w))?await(a.getScale==null?void 0:a.getScale(w))||{x:1,y:1}:{x:1,y:1},j=au(a.convertOffsetParentRelativeRectToViewportRelativeRect?await a.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:y,offsetParent:w,strategy:c}):y);return{top:(x.top-j.top+b.top)/_.y,bottom:(j.bottom-x.bottom+b.bottom)/_.y,left:(x.left-j.left+b.left)/_.x,right:(j.right-x.right+b.right)/_.x}}const qE=e=>({name:"arrow",options:e,async fn(t){const{x:r,y:n,placement:s,rects:a,platform:o,elements:l,middlewareData:c}=t,{element:u,padding:d=0}=_n(e,t)||{};if(u==null)return{};const h=Ib(d),m={x:r,y:n},f=xp(s),b=gp(f),g=await o.getDimensions(u),v=f==="y",x=v?"top":"left",y=v?"bottom":"right",w=v?"clientHeight":"clientWidth",_=a.reference[b]+a.reference[f]-m[f]-a.floating[b],j=m[f]-a.reference[f],k=await(o.getOffsetParent==null?void 0:o.getOffsetParent(u));let S=k?k[w]:0;(!S||!await(o.isElement==null?void 0:o.isElement(k)))&&(S=l.floating[w]||a.floating[b]);const C=_/2-j/2,P=S/2-g[b]/2-1,T=ys(h[x],P),$=ys(h[y],P),O=T,M=S-g[b]-$,R=S/2-g[b]/2+C,U=Nf(O,R,M),N=!c.arrow&&Oi(s)!=null&&R!==U&&a.reference[b]/2-(R<O?T:$)-g[b]/2<0,D=N?R<O?R-O:R-M:0;return{[f]:m[f]+D,data:{[f]:U,centerOffset:R-U-D,...N&&{alignmentOffset:D}},reset:N}}}),zE=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var r,n;const{placement:s,middlewareData:a,rects:o,initialPlacement:l,platform:c,elements:u}=t,{mainAxis:d=!0,crossAxis:h=!0,fallbackPlacements:m,fallbackStrategy:f="bestFit",fallbackAxisSideDirection:b="none",flipAlignment:g=!0,...v}=_n(e,t);if((r=a.arrow)!=null&&r.alignmentOffset)return{};const x=jn(s),y=Wr(l),w=jn(l)===l,_=await(c.isRTL==null?void 0:c.isRTL(u.floating)),j=m||(w||!g?[su(l)]:IE(l)),k=b!=="none";!m&&k&&j.push(...$E(l,g,b,_));const S=[l,...j],C=await zo(t,v),P=[];let T=((n=a.flip)==null?void 0:n.overflows)||[];if(d&&P.push(C[x]),h){const R=OE(s,o,_);P.push(C[R[0]],C[R[1]])}if(T=[...T,{placement:s,overflows:P}],!P.every(R=>R<=0)){var $,O;const R=((($=a.flip)==null?void 0:$.index)||0)+1,U=S[R];if(U&&(!(h==="alignment"?y!==Wr(U):!1)||T.every(E=>E.overflows[0]>0&&Wr(E.placement)===y)))return{data:{index:R,overflows:T},reset:{placement:U}};let N=(O=T.filter(D=>D.overflows[0]<=0).sort((D,E)=>D.overflows[1]-E.overflows[1])[0])==null?void 0:O.placement;if(!N)switch(f){case"bestFit":{var M;const D=(M=T.filter(E=>{if(k){const A=Wr(E.placement);return A===y||A==="y"}return!0}).map(E=>[E.placement,E.overflows.filter(A=>A>0).reduce((A,Y)=>A+Y,0)]).sort((E,A)=>E[1]-A[1])[0])==null?void 0:M[0];D&&(N=D);break}case"initialPlacement":N=l;break}if(s!==N)return{reset:{placement:N}}}return{}}}};function P0(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function A0(e){return TE.some(t=>e[t]>=0)}const BE=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:r}=t,{strategy:n="referenceHidden",...s}=_n(e,t);switch(n){case"referenceHidden":{const a=await zo(t,{...s,elementContext:"reference"}),o=P0(a,r.reference);return{data:{referenceHiddenOffsets:o,referenceHidden:A0(o)}}}case"escaped":{const a=await zo(t,{...s,altBoundary:!0}),o=P0(a,r.floating);return{data:{escapedOffsets:o,escaped:A0(o)}}}default:return{}}}}},Mb=new Set(["left","top"]);async function WE(e,t){const{placement:r,platform:n,elements:s}=e,a=await(n.isRTL==null?void 0:n.isRTL(s.floating)),o=jn(r),l=Oi(r),c=Wr(r)==="y",u=Mb.has(o)?-1:1,d=a&&c?-1:1,h=_n(t,e);let{mainAxis:m,crossAxis:f,alignmentAxis:b}=typeof h=="number"?{mainAxis:h,crossAxis:0,alignmentAxis:null}:{mainAxis:h.mainAxis||0,crossAxis:h.crossAxis||0,alignmentAxis:h.alignmentAxis};return l&&typeof b=="number"&&(f=l==="end"?b*-1:b),c?{x:f*d,y:m*u}:{x:m*u,y:f*d}}const HE=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var r,n;const{x:s,y:a,placement:o,middlewareData:l}=t,c=await WE(t,e);return o===((r=l.offset)==null?void 0:r.placement)&&(n=l.arrow)!=null&&n.alignmentOffset?{}:{x:s+c.x,y:a+c.y,data:{...c,placement:o}}}}},VE=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:r,y:n,placement:s}=t,{mainAxis:a=!0,crossAxis:o=!1,limiter:l={fn:v=>{let{x,y}=v;return{x,y}}},...c}=_n(e,t),u={x:r,y:n},d=await zo(t,c),h=Wr(jn(s)),m=pp(h);let f=u[m],b=u[h];if(a){const v=m==="y"?"top":"left",x=m==="y"?"bottom":"right",y=f+d[v],w=f-d[x];f=Nf(y,f,w)}if(o){const v=h==="y"?"top":"left",x=h==="y"?"bottom":"right",y=b+d[v],w=b-d[x];b=Nf(y,b,w)}const g=l.fn({...t,[m]:f,[h]:b});return{...g,data:{x:g.x-r,y:g.y-n,enabled:{[m]:a,[h]:o}}}}}},GE=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:r,y:n,placement:s,rects:a,middlewareData:o}=t,{offset:l=0,mainAxis:c=!0,crossAxis:u=!0}=_n(e,t),d={x:r,y:n},h=Wr(s),m=pp(h);let f=d[m],b=d[h];const g=_n(l,t),v=typeof g=="number"?{mainAxis:g,crossAxis:0}:{mainAxis:0,crossAxis:0,...g};if(c){const w=m==="y"?"height":"width",_=a.reference[m]-a.floating[w]+v.mainAxis,j=a.reference[m]+a.reference[w]-v.mainAxis;f<_?f=_:f>j&&(f=j)}if(u){var x,y;const w=m==="y"?"width":"height",_=Mb.has(jn(s)),j=a.reference[h]-a.floating[w]+(_&&((x=o.offset)==null?void 0:x[h])||0)+(_?0:v.crossAxis),k=a.reference[h]+a.reference[w]+(_?0:((y=o.offset)==null?void 0:y[h])||0)-(_?v.crossAxis:0);b<j?b=j:b>k&&(b=k)}return{[m]:f,[h]:b}}}},YE=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var r,n;const{placement:s,rects:a,platform:o,elements:l}=t,{apply:c=()=>{},...u}=_n(e,t),d=await zo(t,u),h=jn(s),m=Oi(s),f=Wr(s)==="y",{width:b,height:g}=a.floating;let v,x;h==="top"||h==="bottom"?(v=h,x=m===(await(o.isRTL==null?void 0:o.isRTL(l.floating))?"start":"end")?"left":"right"):(x=h,v=m==="end"?"top":"bottom");const y=g-d.top-d.bottom,w=b-d.left-d.right,_=ys(g-d[v],y),j=ys(b-d[x],w),k=!t.middlewareData.shift;let S=_,C=j;
vendor: 4,664 bytes, line 431
431if((r=t.middlewareData.shift)!=null&&r.enabled.x&&(C=w),(n=t.middlewareData.shift)!=null&&n.enabled.y&&(S=y),k&&!m){const T=qt(d.left,0),$=qt(d.right,0),O=qt(d.top,0),M=qt(d.bottom,0);f?C=b-2*(T!==0||$!==0?T+$:qt(d.left,d.right)):S=g-2*(O!==0||M!==0?O+M:qt(d.top,d.bottom))}await c({...t,availableWidth:C,availableHeight:S});const P=await o.getDimensions(l.floating);return b!==P.width||g!==P.height?{reset:{rects:!0}}:{}}}};function Gu(){return typeof window<"u"}function Ii(e){return Db(e)?(e.nodeName||"").toLowerCase():"#document"}function Ht(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function nn(e){var t;return(t=(Db(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Db(e){return Gu()?e instanceof Node||e instanceof Ht(e).Node:!1}function Rr(e){return Gu()?e instanceof Element||e instanceof Ht(e).Element:!1}function Qr(e){return Gu()?e instanceof HTMLElement||e instanceof Ht(e).HTMLElement:!1}function R0(e){return!Gu()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Ht(e).ShadowRoot}const KE=new Set(["inline","contents"]);function xl(e){const{overflow:t,overflowX:r,overflowY:n,display:s}=Or(e);return/auto|scroll|overlay|hidden|clip/.test(t+n+r)&&!KE.has(s)}const QE=new Set(["table","td","th"]);function JE(e){return QE.has(Ii(e))}const ZE=[":popover-open",":modal"];function Yu(e){return ZE.some(t=>{try{return e.matches(t)}catch{return!1}})}const XE=["transform","translate","scale","rotate","perspective"],eT=["transform","translate","scale","rotate","perspective","filter"],tT=["paint","layout","strict","content"];function yp(e){const t=vp(),r=Rr(e)?Or(e):e;return XE.some(n=>r[n]?r[n]!=="none":!1)||(r.containerType?r.containerType!=="normal":!1)||!t&&(r.backdropFilter?r.backdropFilter!=="none":!1)||!t&&(r.filter?r.filter!=="none":!1)||eT.some(n=>(r.willChange||"").includes(n))||tT.some(n=>(r.contain||"").includes(n))}function rT(e){let t=vs(e);for(;Qr(t)&&!ji(t);){if(yp(t))return t;if(Yu(t))return null;t=vs(t)}return null}function vp(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const nT=new Set(["html","body","#document"]);function ji(e){return nT.has(Ii(e))}function Or(e){return Ht(e).getComputedStyle(e)}function Ku(e){return Rr(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function vs(e){if(Ii(e)==="html")return e;const t=e.assignedSlot||e.parentNode||R0(e)&&e.host||nn(e);return R0(t)?t.host:t}function Lb(e){const t=vs(e);return ji(t)?e.ownerDocument?e.ownerDocument.body:e.body:Qr(t)&&xl(t)?t:Lb(t)}function Bo(e,t,r){var n;t===void 0&&(t=[]),r===void 0&&(r=!0);const s=Lb(e),a=s===((n=e.ownerDocument)==null?void 0:n.body),o=Ht(s);if(a){const l=Ef(o);return t.concat(o,o.visualViewport||[],xl(s)?s:[],l&&r?Bo(l):[])}return t.concat(s,Bo(s,[],r))}function Ef(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function $b(e){const t=Or(e);let r=parseFloat(t.width)||0,n=parseFloat(t.height)||0;const s=Qr(e),a=s?e.offsetWidth:r,o=s?e.offsetHeight:n,l=nu(r)!==a||nu(n)!==o;return l&&(r=a,n=o),{width:r,height:n,$:l}}function wp(e){return Rr(e)?e:e.contextElement}function ri(e){const t=wp(e);if(!Qr(t))return Yr(1);const r=t.getBoundingClientRect(),{width:n,height:s,$:a}=$b(t);let o=(a?nu(r.width):r.width)/n,l=(a?nu(r.height):r.height)/s;return(!o||!Number.isFinite(o))&&(o=1),(!l||!Number.isFinite(l))&&(l=1),{x:o,y:l}}const sT=Yr(0);function Fb(e){const t=Ht(e);return!vp()||!t.visualViewport?sT:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function aT(e,t,r){return t===void 0&&(t=!1),!r||t&&r!==Ht(e)?!1:t}function ia(e,t,r,n){t===void 0&&(t=!1),r===void 0&&(r=!1);const s=e.getBoundingClientRect(),a=wp(e);let o=Yr(1);t&&(n?Rr(n)&&(o=ri(n)):o=ri(e));const l=aT(a,r,n)?Fb(a):Yr(0);let c=(s.left+l.x)/o.x,u=(s.top+l.y)/o.y,d=s.width/o.x,h=s.height/o.y;if(a){const m=Ht(a),f=n&&Rr(n)?Ht(n):n;let b=m,g=Ef(b);for(;g&&n&&f!==b;){const v=ri(g),x=g.getBoundingClientRect(),y=Or(g),w=x.left+(g.clientLeft+parseFloat(y.paddingLeft))*v.x,_=x.top+(g.clientTop+parseFloat(y.paddingTop))*v.y;c*=v.x,u*=v.y,d*=v.x,h*=v.y,c+=w,u+=_,b=Ht(g),g=Ef(b)}}return au({width:d,height:h,x:c,y:u})}function bp(e,t){const r=Ku(e).scrollLeft;return t?t.left+r:ia(nn(e)).left+r}function Ub(e,t,r){r===void 0&&(r=!1);const n=e.getBoundingClientRect(),s=n.left+t.scrollLeft-(r?0:bp(e,n)),a=n.top+t.scrollTop;return{x:s,y:a}}function iT(e){let{elements:t,rect:r,offsetParent:n,strategy:s}=e;const a=s==="fixed",o=nn(n),l=t?Yu(t.floating):!1;if(n===o||l&&a)return r;let c={scrollLeft:0,scrollTop:0},u=Yr(1);const d=Yr(0),h=Qr(n);
vendor: 5,509 bytes, line 431
431if((h||!h&&!a)&&((Ii(n)!=="body"||xl(o))&&(c=Ku(n)),Qr(n))){const f=ia(n);u=ri(n),d.x=f.x+n.clientLeft,d.y=f.y+n.clientTop}const m=o&&!h&&!a?Ub(o,c,!0):Yr(0);return{width:r.width*u.x,height:r.height*u.y,x:r.x*u.x-c.scrollLeft*u.x+d.x+m.x,y:r.y*u.y-c.scrollTop*u.y+d.y+m.y}}function oT(e){return Array.from(e.getClientRects())}function lT(e){const t=nn(e),r=Ku(e),n=e.ownerDocument.body,s=qt(t.scrollWidth,t.clientWidth,n.scrollWidth,n.clientWidth),a=qt(t.scrollHeight,t.clientHeight,n.scrollHeight,n.clientHeight);let o=-r.scrollLeft+bp(e);const l=-r.scrollTop;return Or(n).direction==="rtl"&&(o+=qt(t.clientWidth,n.clientWidth)-s),{width:s,height:a,x:o,y:l}}function cT(e,t){const r=Ht(e),n=nn(e),s=r.visualViewport;let a=n.clientWidth,o=n.clientHeight,l=0,c=0;if(s){a=s.width,o=s.height;const u=vp();(!u||u&&t==="fixed")&&(l=s.offsetLeft,c=s.offsetTop)}return{width:a,height:o,x:l,y:c}}const uT=new Set(["absolute","fixed"]);function dT(e,t){const r=ia(e,!0,t==="fixed"),n=r.top+e.clientTop,s=r.left+e.clientLeft,a=Qr(e)?ri(e):Yr(1),o=e.clientWidth*a.x,l=e.clientHeight*a.y,c=s*a.x,u=n*a.y;return{width:o,height:l,x:c,y:u}}function O0(e,t,r){let n;if(t==="viewport")n=cT(e,r);else if(t==="document")n=lT(nn(e));else if(Rr(t))n=dT(t,r);else{const s=Fb(e);n={x:t.x-s.x,y:t.y-s.y,width:t.width,height:t.height}}return au(n)}function qb(e,t){const r=vs(e);return r===t||!Rr(r)||ji(r)?!1:Or(r).position==="fixed"||qb(r,t)}function hT(e,t){const r=t.get(e);if(r)return r;let n=Bo(e,[],!1).filter(l=>Rr(l)&&Ii(l)!=="body"),s=null;const a=Or(e).position==="fixed";let o=a?vs(e):e;for(;Rr(o)&&!ji(o);){const l=Or(o),c=yp(o);!c&&l.position==="fixed"&&(s=null),(a?!c&&!s:!c&&l.position==="static"&&!!s&&uT.has(s.position)||xl(o)&&!c&&qb(e,o))?n=n.filter(d=>d!==o):s=l,o=vs(o)}return t.set(e,n),n}function fT(e){let{element:t,boundary:r,rootBoundary:n,strategy:s}=e;const o=[...r==="clippingAncestors"?Yu(t)?[]:hT(t,this._c):[].concat(r),n],l=o[0],c=o.reduce((u,d)=>{const h=O0(t,d,s);return u.top=qt(h.top,u.top),u.right=ys(h.right,u.right),u.bottom=ys(h.bottom,u.bottom),u.left=qt(h.left,u.left),u},O0(t,l,s));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function mT(e){const{width:t,height:r}=$b(e);return{width:t,height:r}}function pT(e,t,r){const n=Qr(t),s=nn(t),a=r==="fixed",o=ia(e,!0,a,t);let l={scrollLeft:0,scrollTop:0};const c=Yr(0);function u(){c.x=bp(s)}if(n||!n&&!a)if((Ii(t)!=="body"||xl(s))&&(l=Ku(t)),n){const f=ia(t,!0,a,t);c.x=f.x+t.clientLeft,c.y=f.y+t.clientTop}else s&&u();a&&!n&&s&&u();const d=s&&!n&&!a?Ub(s,l):Yr(0),h=o.left+l.scrollLeft-c.x-d.x,m=o.top+l.scrollTop-c.y-d.y;return{x:h,y:m,width:o.width,height:o.height}}function Jd(e){return Or(e).position==="static"}function I0(e,t){if(!Qr(e)||Or(e).position==="fixed")return null;if(t)return t(e);let r=e.offsetParent;return nn(e)===r&&(r=r.ownerDocument.body),r}function zb(e,t){const r=Ht(e);if(Yu(e))return r;if(!Qr(e)){let s=vs(e);for(;s&&!ji(s);){if(Rr(s)&&!Jd(s))return s;s=vs(s)}return r}let n=I0(e,t);for(;n&&JE(n)&&Jd(n);)n=I0(n,t);return n&&ji(n)&&Jd(n)&&!yp(n)?r:n||rT(e)||r}const gT=async function(e){const t=this.getOffsetParent||zb,r=this.getDimensions,n=await r(e.floating);return{reference:pT(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:n.width,height:n.height}}};function xT(e){return Or(e).direction==="rtl"}const yT={convertOffsetParentRelativeRectToViewportRelativeRect:iT,getDocumentElement:nn,getClippingRect:fT,getOffsetParent:zb,getElementRects:gT,getClientRects:oT,getDimensions:mT,getScale:ri,isElement:Rr,isRTL:xT};function Bb(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function vT(e,t){let r=null,n;const s=nn(e);function a(){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),a();const u=e.getBoundingClientRect(),{left:d,top:h,width:m,height:f}=u;if(l||t(),!m||!f)return;const b=Wl(h),g=Wl(s.clientWidth-(d+m)),v=Wl(s.clientHeight-(h+f)),x=Wl(d),w={rootMargin:-b+"px "+-g+"px "+-v+"px "+-x+"px",threshold:qt(0,ys(1,c))||1};let _=!0;function j(k){const S=k[0].intersectionRatio;if(S!==c){if(!_)return o();S?o(!1,S):n=setTimeout(()=>{o(!1,1e-7)},1e3)}S===1&&!Bb(u,e.getBoundingClientRect())&&o(),_=!1}try{r=new IntersectionObserver(j,{...w,root:s.ownerDocument})}catch{r=new IntersectionObserver(j,w)}r.observe(e)}return o(!0),a}function wT(e,t,r,n){n===void 0&&(n={});const{ancestorScroll:s=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:c=!1}=n,u=wp(e),d=s||a?[...u?Bo(u):[],...Bo(t)]:[];d.forEach(x=>{s&&x.addEventListener("scroll",r,{passive:!0}),a&&x.addEventListener("resize",r)});const h=u&&l?vT(u,r):null;let m=-1,f=null;o&&(f=new ResizeObserver(x=>{let[y]=x;y&&y.target===u&&f&&(f.unobserve(t),cancelAnimationFrame(m),m=requestAnimationFrame(()=>{var w;(w=f)==null||w.observe(t)})),r()}),u&&!c&&f.observe(u),f.observe(t));let b,g=c?ia(e):null;c&&v();function v(){const x=ia(e);g&&!Bb(g,x)&&r(),g=x,b=requestAnimationFrame(v)}return r(),()=>{var x;d.forEach(y=>{s&&y.removeEventListener("scroll",r),a&&y.removeEventListener("resize",r)}),h==null||h(),(x=f)==null||x.disconnect(),f=null,c&&cancelAnimationFrame(b)}}const bT=HE,_T=VE,jT=zE,kT=YE,ST=BE,M0=qE,NT=GE,CT=(e,t,r)=>{const n=new Map,s={platform:yT,...r},a={...s.platform,_c:n};return UE(e,t,{...s,platform:a})};var ET=typeof document<"u",TT=function(){},jc=ET?p.useLayoutEffect:TT;function iu(e,t){if(e===t)return!0;
vendor: 4,143 bytes, line 431
431if(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(!iu(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 a=s[n];if(!(a==="_owner"&&e.$$typeof)&&!iu(e[a],t[a]))return!1}return!0}return e!==e&&t!==t}function Wb(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function D0(e,t){const r=Wb(e);return Math.round(t*r)/r}function Zd(e){const t=p.useRef(e);return jc(()=>{t.current=e}),t}function PT(e){e===void 0&&(e={});const{placement:t="bottom",strategy:r="absolute",middleware:n=[],platform:s,elements:{reference:a,floating:o}={},transform:l=!0,whileElementsMounted:c,open:u}=e,[d,h]=p.useState({x:0,y:0,strategy:r,placement:t,middlewareData:{},isPositioned:!1}),[m,f]=p.useState(n);iu(m,n)||f(n);const[b,g]=p.useState(null),[v,x]=p.useState(null),y=p.useCallback(E=>{E!==k.current&&(k.current=E,g(E))},[]),w=p.useCallback(E=>{E!==S.current&&(S.current=E,x(E))},[]),_=a||b,j=o||v,k=p.useRef(null),S=p.useRef(null),C=p.useRef(d),P=c!=null,T=Zd(c),$=Zd(s),O=Zd(u),M=p.useCallback(()=>{if(!k.current||!S.current)return;const E={placement:t,strategy:r,middleware:m};$.current&&(E.platform=$.current),CT(k.current,S.current,E).then(A=>{const Y={...A,isPositioned:O.current!==!1};R.current&&!iu(C.current,Y)&&(C.current=Y,fa.flushSync(()=>{h(Y)}))})},[m,t,r,$,O]);jc(()=>{u===!1&&C.current.isPositioned&&(C.current.isPositioned=!1,h(E=>({...E,isPositioned:!1})))},[u]);const R=p.useRef(!1);jc(()=>(R.current=!0,()=>{R.current=!1}),[]),jc(()=>{if(_&&(k.current=_),j&&(S.current=j),_&&j){if(T.current)return T.current(_,j,M);M()}},[_,j,M,T,P]);const U=p.useMemo(()=>({reference:k,floating:S,setReference:y,setFloating:w}),[y,w]),N=p.useMemo(()=>({reference:_,floating:j}),[_,j]),D=p.useMemo(()=>{const E={position:r,left:0,top:0};if(!N.floating)return E;const A=D0(N.floating,d.x),Y=D0(N.floating,d.y);return l?{...E,transform:"translate("+A+"px, "+Y+"px)",...Wb(N.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:A,top:Y}},[r,l,N.floating,d.x,d.y]);return p.useMemo(()=>({...d,update:M,refs:U,elements:N,floatingStyles:D}),[d,M,U,N,D])}const AT=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?M0({element:n.current,padding:s}).fn(r):{}:n?M0({element:n,padding:s}).fn(r):{}}}},RT=(e,t)=>({...bT(e),options:[e,t]}),OT=(e,t)=>({..._T(e),options:[e,t]}),IT=(e,t)=>({...NT(e),options:[e,t]}),MT=(e,t)=>({...jT(e),options:[e,t]}),DT=(e,t)=>({...kT(e),options:[e,t]}),LT=(e,t)=>({...ST(e),options:[e,t]}),$T=(e,t)=>({...AT(e),options:[e,t]});var FT="Arrow",Hb=p.forwardRef((e,t)=>{const{children:r,width:n=10,height:s=5,...a}=e;return i.jsx(ue.svg,{...a,ref:t,width:n,height:s,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?r:i.jsx("polygon",{points:"0,0 30,0 15,10"})})});Hb.displayName=FT;var UT=Hb;function _p(e){const[t,r]=p.useState(void 0);return ft(()=>{if(e){r({width:e.offsetWidth,height:e.offsetHeight});const n=new ResizeObserver(s=>{if(!Array.isArray(s)||!s.length)return;const a=s[0];let o,l;if("borderBoxSize"in a){const c=a.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 jp="Popper",[Vb,Qu]=Mr(jp),[qT,Gb]=Vb(jp),Yb=e=>{const{__scopePopper:t,children:r}=e,[n,s]=p.useState(null);return i.jsx(qT,{scope:t,anchor:n,onAnchorChange:s,children:r})};Yb.displayName=jp;var Kb="PopperAnchor",Qb=p.forwardRef((e,t)=>{const{__scopePopper:r,virtualRef:n,...s}=e,a=Gb(Kb,r),o=p.useRef(null),l=Ee(t,o);return p.useEffect(()=>{a.onAnchorChange((n==null?void 0:n.current)||o.current)}),n?null:i.jsx(ue.div,{...s,ref:l})});Qb.displayName=Kb;var kp="PopperContent",[zT,BT]=Vb(kp),Jb=p.forwardRef((e,t)=>
vendor: 4,217 bytes, line 431
431{var V,_e,de,he,le,we;const{__scopePopper:r,side:n="bottom",sideOffset:s=0,align:a="center",alignOffset:o=0,arrowPadding:l=0,avoidCollisions:c=!0,collisionBoundary:u=[],collisionPadding:d=0,sticky:h="partial",hideWhenDetached:m=!1,updatePositionStrategy:f="optimized",onPlaced:b,...g}=e,v=Gb(kp,r),[x,y]=p.useState(null),w=Ee(t,mt=>y(mt)),[_,j]=p.useState(null),k=_p(_),S=(k==null?void 0:k.width)??0,C=(k==null?void 0:k.height)??0,P=n+(a!=="center"?"-"+a:""),T=typeof d=="number"?d:{top:0,right:0,bottom:0,left:0,...d},$=Array.isArray(u)?u:[u],O=$.length>0,M={padding:T,boundary:$.filter(HT),altBoundary:O},{refs:R,floatingStyles:U,placement:N,isPositioned:D,middlewareData:E}=PT({strategy:"fixed",placement:P,whileElementsMounted:(...mt)=>wT(...mt,{animationFrame:f==="always"}),elements:{reference:v.anchor},middleware:[RT({mainAxis:s+C,alignmentAxis:o}),c&&OT({mainAxis:!0,crossAxis:!1,limiter:h==="partial"?IT():void 0,...M}),c&&MT({...M}),DT({...M,apply:({elements:mt,rects:Qt,availableWidth:Ps,availableHeight:Pn})=>{const{width:As,height:zi}=Qt.reference,ga=mt.floating.style;ga.setProperty("--radix-popper-available-width",`${Ps}px`),ga.setProperty("--radix-popper-available-height",`${Pn}px`),ga.setProperty("--radix-popper-anchor-width",`${As}px`),ga.setProperty("--radix-popper-anchor-height",`${zi}px`)}}),_&&$T({element:_,padding:l}),VT({arrowWidth:S,arrowHeight:C}),m&<({strategy:"referenceHidden",...M})]}),[A,Y]=e1(N),te=or(b);ft(()=>{D&&(te==null||te())},[D,te]);const W=(V=E.arrow)==null?void 0:V.x,se=(_e=E.arrow)==null?void 0:_e.y,I=((de=E.arrow)==null?void 0:de.centerOffset)!==0,[re,xe]=p.useState();return ft(()=>{x&&xe(window.getComputedStyle(x).zIndex)},[x]),i.jsx("div",{ref:R.setFloating,"data-radix-popper-content-wrapper":"",style:{...U,transform:D?U.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:re,"--radix-popper-transform-origin":[(he=E.transformOrigin)==null?void 0:he.x,(le=E.transformOrigin)==null?void 0:le.y].join(" "),...((we=E.hide)==null?void 0:we.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:i.jsx(zT,{scope:r,placedSide:A,onArrowChange:j,arrowX:W,arrowY:se,shouldHideArrow:I,children:i.jsx(ue.div,{"data-side":A,"data-align":Y,...g,ref:w,style:{...g.style,animation:D?void 0:"none"}})})})});Jb.displayName=kp;var Zb="PopperArrow",WT={top:"bottom",right:"left",bottom:"top",left:"right"},Xb=p.forwardRef(function(t,r){const{__scopePopper:n,...s}=t,a=BT(Zb,n),o=WT[a.placedSide];return i.jsx("span",{ref:a.onArrowChange,style:{position:"absolute",left:a.arrowX,top:a.arrowY,[o]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[a.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[a.placedSide],visibility:a.shouldHideArrow?"hidden":void 0},children:i.jsx(UT,{...s,ref:r,style:{...s.style,display:"block"}})})});Xb.displayName=Zb;function HT(e){return e!==null}var VT=e=>({name:"transformOrigin",options:e,fn(t){var v,x,y;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,d]=e1(r),h={start:"0%",center:"50%",end:"100%"}[d],m=(((x=s.arrow)==null?void 0:x.x)??0)+l/2,f=(((y=s.arrow)==null?void 0:y.y)??0)+c/2;let b="",g="";return u==="bottom"?(b=o?h:`${m}px`,g=`${-c}px`):u==="top"?(b=o?h:`${m}px`,g=`${n.floating.height+c}px`):u==="right"?(b=`${-c}px`,g=o?h:`${f}px`):u==="left"&&(b=`${n.floating.width+c}px`,g=o?h:`${f}px`),{data:{x:b,y:g}}}});function e1(e){const[t,r="center"]=e.split("-");return[t,r]}var GT=Yb,t1=Qb,r1=Jb,n1=Xb,[Ju,mL]=Mr("Tooltip",[Qu]),Sp=Qu(),s1="TooltipProvider",YT=700,L0="tooltip.open",[KT,a1]=Ju(s1),i1=e=>{const{__scopeTooltip:t,delayDuration:r=YT,skipDelayDuration:n=300,disableHoverableContent:s=!1,children:a}=e,o=p.useRef(!0),l=p.useRef(!1),c=p.useRef(0);return p.useEffect(()=>{const u=c.current;return()=>window.clearTimeout(u)},[]),i.jsx(KT,{scope:t,isOpenDelayedRef:o,delayDuration:r,onOpen:p.useCallback(()=>{window.clearTimeout(c.current),o.current=!1},[]),onClose:p.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>
vendor: 4,219 bytes, line 431
431o.current=!0,n)},[n]),isPointerInTransitRef:l,onPointerInTransitChange:p.useCallback(u=>{l.current=u},[]),disableHoverableContent:s,children:a})};i1.displayName=s1;var o1="Tooltip",[pL,Zu]=Ju(o1),Tf="TooltipTrigger",QT=p.forwardRef((e,t)=>{const{__scopeTooltip:r,...n}=e,s=Zu(Tf,r),a=a1(Tf,r),o=Sp(r),l=p.useRef(null),c=Ee(t,l,s.onTriggerChange),u=p.useRef(!1),d=p.useRef(!1),h=p.useCallback(()=>u.current=!1,[]);return p.useEffect(()=>()=>document.removeEventListener("pointerup",h),[h]),i.jsx(t1,{asChild:!0,...o,children:i.jsx(ue.button,{"aria-describedby":s.open?s.contentId:void 0,"data-state":s.stateAttribute,...n,ref:c,onPointerMove:ae(e.onPointerMove,m=>{m.pointerType!=="touch"&&!d.current&&!a.isPointerInTransitRef.current&&(s.onTriggerEnter(),d.current=!0)}),onPointerLeave:ae(e.onPointerLeave,()=>{s.onTriggerLeave(),d.current=!1}),onPointerDown:ae(e.onPointerDown,()=>{s.open&&s.onClose(),u.current=!0,document.addEventListener("pointerup",h,{once:!0})}),onFocus:ae(e.onFocus,()=>{u.current||s.onOpen()}),onBlur:ae(e.onBlur,s.onClose),onClick:ae(e.onClick,s.onClose)})})});QT.displayName=Tf;var JT="TooltipPortal",[gL,ZT]=Ju(JT,{forceMount:void 0}),ki="TooltipContent",l1=p.forwardRef((e,t)=>{const r=ZT(ki,e.__scopeTooltip),{forceMount:n=r.forceMount,side:s="top",...a}=e,o=Zu(ki,e.__scopeTooltip);return i.jsx(Ns,{present:n||o.open,children:o.disableHoverableContent?i.jsx(c1,{side:s,...a,ref:t}):i.jsx(XT,{side:s,...a,ref:t})})}),XT=p.forwardRef((e,t)=>{const r=Zu(ki,e.__scopeTooltip),n=a1(ki,e.__scopeTooltip),s=p.useRef(null),a=Ee(t,s),[o,l]=p.useState(null),{trigger:c,onClose:u}=r,d=s.current,{onPointerInTransitChange:h}=n,m=p.useCallback(()=>{l(null),h(!1)},[h]),f=p.useCallback((b,g)=>{const v=b.currentTarget,x={x:b.clientX,y:b.clientY},y=s5(x,v.getBoundingClientRect()),w=a5(x,y),_=i5(g.getBoundingClientRect()),j=l5([...w,..._]);l(j),h(!0)},[h]);return p.useEffect(()=>()=>m(),[m]),p.useEffect(()=>{if(c&&d){const b=v=>f(v,d),g=v=>f(v,c);return c.addEventListener("pointerleave",b),d.addEventListener("pointerleave",g),()=>{c.removeEventListener("pointerleave",b),d.removeEventListener("pointerleave",g)}}},[c,d,f,m]),p.useEffect(()=>{if(o){const b=g=>{const v=g.target,x={x:g.clientX,y:g.clientY},y=(c==null?void 0:c.contains(v))||(d==null?void 0:d.contains(v)),w=!o5(x,o);y?m():w&&(m(),u())};return document.addEventListener("pointermove",b),()=>document.removeEventListener("pointermove",b)}},[c,d,o,u,m]),i.jsx(c1,{...e,ref:a})}),[e5,t5]=Ju(o1,{isInside:!1}),r5=XN("TooltipContent"),c1=p.forwardRef((e,t)=>{const{__scopeTooltip:r,children:n,"aria-label":s,onEscapeKeyDown:a,onPointerDownOutside:o,...l}=e,c=Zu(ki,r),u=Sp(r),{onClose:d}=c;return p.useEffect(()=>(document.addEventListener(L0,d),()=>document.removeEventListener(L0,d)),[d]),p.useEffect(()=>{if(c.trigger){const h=m=>{const f=m.target;f!=null&&f.contains(c.trigger)&&d()};return window.addEventListener("scroll",h,{capture:!0}),()=>window.removeEventListener("scroll",h,{capture:!0})}},[c.trigger,d]),i.jsx(fl,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:h=>h.preventDefault(),onDismiss:d,children:i.jsxs(r1,{"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:[i.jsx(r5,{children:n}),i.jsx(e5,{scope:r,isInside:!0,children:i.jsx(b2,{id:c.contentId,role:"tooltip",children:s||n})})]})})});l1.displayName=ki;var u1="TooltipArrow",n5=p.forwardRef((e,t)=>{const{__scopeTooltip:r,...n}=e,s=Sp(r);return t5(u1,r).isInside?null:i.jsx(n1,{...s,...n,ref:t})});n5.displayName=u1;function s5(e,t){const r=Math.abs(t.top-e.y),n=Math.abs(t.bottom-e.y),s=Math.abs(t.right-e.x),a=Math.abs(t.left-e.x);switch(Math.min(r,n,s,a)){case a:return"left";case s:return"right";case r:return"top";case n:return"bottom";default:throw new Error("unreachable")}}function a5(e,t,r=5){const n=[];
431switch(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 i5(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 o5(e,t){const{x:r,y:n}=e;let s=!1;for(let a=0,o=t.length-1;a<t.length;o=a++){const l=t[a],c=t[o],u=l.x,d=l.y,h=c.x,m=c.y;d>n!=m>n&&r<(h-u)*(n-d)/(m-d)+u&&(s=!s)}return s}function l5(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),c5(t)}function c5(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 a=t[t.length-1],o=t[t.length-2];if((a.x-o.x)*(s.y-o.y)>=(a.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 a=r[r.length-1],o=r[r.length-2];if((a.x-o.x)*(s.y-o.y)>=(a.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 u5=i1,d1=l1;const d5=u5,h5=p.forwardRef(({className:e,sideOffset:t=4,...r},n)=>i.jsx(d1,{ref:n,sideOffset:t,className:ce("z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...r}));h5.displayName=d1.displayName;var Xu=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(){}},ed=typeof window>"u"||"Deno"in globalThis;function yr(){}function f5(e,t){return typeof e=="function"?e(t):e}function m5(e){return typeof e=="number"&&e>=0&&e!==1/0}function p5(e,t){return Math.max(e+(t||0)-Date.now(),0)}function Pf(e,t){return typeof e=="function"?e(t):e}function g5(e,t){return typeof e=="function"?e(t):e}function $0(e,t){const{type:r="all",exact:n,fetchStatus:s,predicate:a,queryKey:o,stale:l}=e;if(o){if(n){if(t.queryHash!==Np(o,t.options))return!1}else if(!Ho(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||a&&!a(t))}function F0(e,t){const{exact:r,status:n,predicate:s,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(r){if(Wo(t.options.mutationKey)!==Wo(a))return!1}else if(!Ho(t.options.mutationKey,a))return!1}return!(n&&t.state.status!==n||s&&!s(t))}function Np(e,t){return((t==null?void 0:t.queryKeyHashFn)||Wo)(e)}function Wo(e){return JSON.stringify(e,(t,r)=>Af(r)?Object.keys(r).sort().reduce((n,s)=>(n[s]=r[s],n),{}):r)}function Ho(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(r=>Ho(e[r],t[r])):!1}function h1(e,t){if(e===t)return e;const r=U0(e)&&U0(t);if(r||Af(e)&&Af(t)){const n=r?e:Object.keys(e),s=n.length,a=r?t:Object.keys(t),o=a.length,l=r?[]:{},c=new Set(n);let u=0;for(let d=0;d<o;d++){const h=r?d:a[d];(!r&&c.has(h)||r)&&e[h]===void 0&&t[h]===void 0?(l[h]=void 0,u++):(l[h]=h1(e[h],t[h]),l[h]===e[h]&&e[h]!==void 0&&u++)}return s===o&&u===s?e:l}return t}function U0(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Af(e){if(!q0(e))return!1;const t=e.constructor;if(t===void 0)return!0;const r=t.prototype;return!(!q0(r)||!r.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function q0(e){return Object.prototype.toString.call(e)==="[object Object]"}function x5(e){return new Promise(t=>{setTimeout(t,e)})}function y5(e,t,r){return typeof r.structuralSharing=="function"?r.structuralSharing(e,t):r.structuralSharing!==!1?h1(e,t):t}function v5(e,t,r=0){const n=[...e,t];return r&&n.length>r?n.slice(1):n}function w5(e,t,r=0){const n=[t,...e];return r&&n.length>r?n.slice(0,-1):n}var Cp=Symbol();function f1(e,t){return!e.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!e.queryFn||e.queryFn===Cp?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}var Vs,Yn,ai,my,b5=(my=class extends Xu{constructor(){super();Se(this,Vs);Se(this,Yn);Se(this,ai);ge(this,ai,t=>{if(!ed&&window.addEventListener){const r=()=>t();return window.addEventListener("visibilitychange",r,!1),()=>{window.removeEventListener("visibilitychange",r)}}})}onSubscribe(){L(this,Yn)||this.setEventListener(L(this,ai))}onUnsubscribe(){var t;this.hasListeners()||((t=L(this,Yn))==null||t.call(this),ge(this,Yn,void 0))}setEventListener(t){var r;ge(this,ai,t),(r=L(this,Yn))==null||r.call(this),ge(this,Yn,t(n=>{typeof n=="boolean"?this.setFocused(n):this.onFocus()}))}setFocused(t){L(this,Vs)!==t&&(ge(this,Vs,t),this.onFocus())}onFocus(){const t=this.isFocused();
vendor: 14,133 bytes, line 431
431this.listeners.forEach(r=>{r(t)})}isFocused(){var t;return typeof L(this,Vs)=="boolean"?L(this,Vs):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},Vs=new WeakMap,Yn=new WeakMap,ai=new WeakMap,my),m1=new b5,ii,Kn,oi,py,_5=(py=class extends Xu{constructor(){super();Se(this,ii,!0);Se(this,Kn);Se(this,oi);ge(this,oi,t=>{if(!ed&&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)}}})}onSubscribe(){L(this,Kn)||this.setEventListener(L(this,oi))}onUnsubscribe(){var t;this.hasListeners()||((t=L(this,Kn))==null||t.call(this),ge(this,Kn,void 0))}setEventListener(t){var r;ge(this,oi,t),(r=L(this,Kn))==null||r.call(this),ge(this,Kn,t(this.setOnline.bind(this)))}setOnline(t){L(this,ii)!==t&&(ge(this,ii,t),this.listeners.forEach(n=>{n(t)}))}isOnline(){return L(this,ii)}},ii=new WeakMap,Kn=new WeakMap,oi=new WeakMap,py),ou=new _5;function j5(){let e,t;const r=new Promise((s,a)=>{e=s,t=a});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}function k5(e){return Math.min(1e3*2**e,3e4)}function p1(e){return(e??"online")==="online"?ou.isOnline():!0}var g1=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function Xd(e){return e instanceof g1}function x1(e){let t=!1,r=0,n=!1,s;const a=j5(),o=g=>{var v;n||(m(new g1(g)),(v=e.abort)==null||v.call(e))},l=()=>{t=!0},c=()=>{t=!1},u=()=>m1.isFocused()&&(e.networkMode==="always"||ou.isOnline())&&e.canRun(),d=()=>p1(e.networkMode)&&e.canRun(),h=g=>{var v;n||(n=!0,(v=e.onSuccess)==null||v.call(e,g),s==null||s(),a.resolve(g))},m=g=>{var v;n||(n=!0,(v=e.onError)==null||v.call(e,g),s==null||s(),a.reject(g))},f=()=>new Promise(g=>{var v;s=x=>{(n||u())&&g(x)},(v=e.onPause)==null||v.call(e)}).then(()=>{var g;s=void 0,n||(g=e.onContinue)==null||g.call(e)}),b=()=>{if(n)return;let g;const v=r===0?e.initialPromise:void 0;try{g=v??e.fn()}catch(x){g=Promise.reject(x)}Promise.resolve(g).then(h).catch(x=>{var k;if(n)return;const y=e.retry??(ed?0:3),w=e.retryDelay??k5,_=typeof w=="function"?w(r,x):w,j=y===!0||typeof y=="number"&&r<y||typeof y=="function"&&y(r,x);if(t||!j){m(x);return}r++,(k=e.onFail)==null||k.call(e,r,x),x5(_).then(()=>u()?void 0:f()).then(()=>{t?m(x):b()})})};return{promise:a,cancel:o,continue:()=>(s==null||s(),a),cancelRetry:l,continueRetry:c,canStart:d,start:()=>(d()?b():f().then(b),a)}}var S5=e=>setTimeout(e,0);function N5(){let e=[],t=0,r=l=>{l()},n=l=>{l()},s=S5;const a=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)=>{a(()=>{l(...c)})},schedule:a,setNotifyFunction:l=>{r=l},setBatchNotifyFunction:l=>{n=l},setScheduler:l=>{s=l}}}var kt=N5(),Gs,gy,y1=(gy=class{constructor(){Se(this,Gs)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),m5(this.gcTime)&&ge(this,Gs,setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(ed?1/0:5*60*1e3))}clearGcTimeout(){L(this,Gs)&&(clearTimeout(L(this,Gs)),ge(this,Gs,void 0))}},Gs=new WeakMap,gy),li,Ys,Zt,Ks,yt,il,Qs,wr,on,xy,C5=(xy=class extends y1{constructor(t){super();Se(this,wr);Se(this,li);Se(this,Ys);Se(this,Zt);Se(this,Ks);Se(this,yt);Se(this,il);Se(this,Qs);ge(this,Qs,!1),ge(this,il,t.defaultOptions),this.setOptions(t.options),this.observers=[],ge(this,Ks,t.client),ge(this,Zt,L(this,Ks).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,ge(this,li,T5(this.options)),this.state=t.state??L(this,li),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var t;return(t=L(this,yt))==null?void 0:t.promise}setOptions(t){this.options={...L(this,il),...t},this.updateGcTime(this.options.gcTime)}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&L(this,Zt).remove(this)}setData(t,r){const n=y5(this.state.data,t,this.options);return pt(this,wr,on).call(this,{data:n,type:"success",dataUpdatedAt:r==null?void 0:r.updatedAt,manual:r==null?void 0:r.manual}),n}setState(t,r){pt(this,wr,on).call(this,{type:"setState",state:t,setStateOptions:r})}cancel(t){var n,s;const r=(n=L(this,yt))==null?void 0:n.promise;return(s=L(this,yt))==null||s.cancel(t),r?r.then(yr).catch(yr):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(L(this,li))}isActive(){return this.observers.some(t=>g5(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Cp||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>Pf(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:!p5(this.state.dataUpdatedAt,t)}onFocus(){var r;const t=this.observers.find(n=>n.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(r=L(this,yt))==null||r.continue()}onOnline(){var r;const t=this.observers.find(n=>n.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(r=L(this,yt))==null||r.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),L(this,Zt).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(r=>r!==t),this.observers.length||(L(this,yt)&&(L(this,Qs)?L(this,yt).cancel({revert:!0}):L(this,yt).cancelRetry()),this.scheduleGc()),L(this,Zt).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||pt(this,wr,on).call(this,{type:"invalidate"})}fetch(t,r){var u,d,h;if(this.state.fetchStatus!=="idle"){if(this.state.data!==void 0&&(r!=null&&r.cancelRefetch))this.cancel({silent:!0});else if(L(this,yt))return L(this,yt).continueRetry(),L(this,yt).promise}if(t&&this.setOptions(t),!this.options.queryFn){const m=this.observers.find(f=>f.options.queryFn);m&&this.setOptions(m.options)}const n=new AbortController,s=m=>{Object.defineProperty(m,"signal",{enumerable:!0,get:()=>(ge(this,Qs,!0),n.signal)})},a=()=>{const m=f1(this.options,r),b=(()=>{const g={client:L(this,Ks),queryKey:this.queryKey,meta:this.meta};return s(g),g})();return ge(this,Qs,!1),this.options.persister?this.options.persister(m,b,this):m(b)},l=(()=>{const m={fetchOptions:r,options:this.options,queryKey:this.queryKey,client:L(this,Ks),state:this.state,fetchFn:a};return s(m),m})();(u=this.options.behavior)==null||u.onFetch(l,this),ge(this,Ys,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((d=l.fetchOptions)==null?void 0:d.meta))&&pt(this,wr,on).call(this,{type:"fetch",meta:(h=l.fetchOptions)==null?void 0:h.meta});const c=m=>{var f,b,g,v;Xd(m)&&m.silent||pt(this,wr,on).call(this,{type:"error",error:m}),Xd(m)||((b=(f=L(this,Zt).config).onError)==null||b.call(f,m,this),(v=(g=L(this,Zt).config).onSettled)==null||v.call(g,this.state.data,m,this)),this.scheduleGc()};return ge(this,yt,x1({initialPromise:r==null?void 0:r.initialPromise,fn:l.fetchFn,abort:n.abort.bind(n),onSuccess:m=>{var f,b,g,v;if(m===void 0){c(new Error(`${this.queryHash} data is undefined`));return}try{this.setData(m)}catch(x){c(x);return}(b=(f=L(this,Zt).config).onSuccess)==null||b.call(f,m,this),(v=(g=L(this,Zt).config).onSettled)==null||v.call(g,m,this.state.error,this),this.scheduleGc()},onError:c,onFail:(m,f)=>{pt(this,wr,on).call(this,{type:"failed",failureCount:m,error:f})},onPause:()=>{pt(this,wr,on).call(this,{type:"pause"})},onContinue:()=>{pt(this,wr,on).call(this,{type:"continue"})},retry:l.options.retry,retryDelay:l.options.retryDelay,networkMode:l.options.networkMode,canRun:()=>!0})),L(this,yt).start()}},li=new WeakMap,Ys=new WeakMap,Zt=new WeakMap,Ks=new WeakMap,yt=new WeakMap,il=new WeakMap,Qs=new WeakMap,wr=new WeakSet,on=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,...E5(n.data,this.options),fetchMeta:t.meta??null};case"success":return ge(this,Ys,void 0),{...n,data:t.data,dataUpdateCount:n.dataUpdateCount+1,dataUpdatedAt:t.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};case"error":const s=t.error;return Xd(s)&&s.revert&&L(this,Ys)?{...L(this,Ys),fetchStatus:"idle"}:{...n,error:s,errorUpdateCount:n.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:n.fetchFailureCount+1,fetchFailureReason:s,fetchStatus:"idle",status:"error"};case"invalidate":return{...n,isInvalidated:!0};case"setState":return{...n,...t.state}}};this.state=r(this.state),kt.batch(()=>{this.observers.forEach(n=>{n.onQueryUpdate()}),L(this,Zt).notify({query:this,type:"updated",action:t})})},xy);function E5(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:p1(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function T5(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"}}var Fr,yy,P5=(yy=class extends Xu{constructor(t={}){super();Se(this,Fr);this.config=t,ge(this,Fr,new Map)}build(t,r,n){const s=r.queryKey,a=r.queryHash??Np(s,r);let o=this.get(a);return o||(o=new C5({client:t,queryKey:s,queryHash:a,options:t.defaultQueryOptions(r),state:n,defaultOptions:t.getQueryDefaults(s)}),this.add(o)),o}add(t){L(this,Fr).has(t.queryHash)||(L(this,Fr).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const r=L(this,Fr).get(t.queryHash);r&&(t.destroy(),r===t&&L(this,Fr).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){kt.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return L(this,Fr).get(t)}getAll(){return[...L(this,Fr).values()]}find(t){const r={exact:!0,...t};return this.getAll().find(n=>$0(r,n))}findAll(t={}){const r=this.getAll();return Object.keys(t).length>0?r.filter(n=>$0(t,n)):r}notify(t){kt.batch(()=>{this.listeners.forEach(r=>{r(t)})})}onFocus(){kt.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){kt.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},Fr=new WeakMap,yy),Ur,_t,Js,qr,$n,vy,A5=(vy=class extends y1{constructor(t){super();Se(this,qr);Se(this,Ur);Se(this,_t);Se(this,Js);this.mutationId=t.mutationId,ge(this,_t,t.mutationCache),ge(this,Ur,[]),this.state=t.state||R5(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){L(this,Ur).includes(t)||(L(this,Ur).push(t),this.clearGcTimeout(),L(this,_t).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){ge(this,Ur,L(this,Ur).filter(r=>r!==t)),this.scheduleGc(),L(this,_t).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){L(this,Ur).length||(this.state.status==="pending"?this.scheduleGc():L(this,_t).remove(this))}continue(){var t;return((t=L(this,Js))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var a,o,l,c,u,d,h,m,f,b,g,v,x,y,w,_,j,k,S,C;const r=()=>{pt(this,qr,$n).call(this,{type:"continue"})};ge(this,Js,x1({fn:()=>this.options.mutationFn?this.options.mutationFn(t):Promise.reject(new Error("No mutationFn found")),onFail:(P,T)=>{pt(this,qr,$n).call(this,{type:"failed",failureCount:P,error:T})},onPause:()=>{pt(this,qr,$n).call(this,{type:"pause"})},onContinue:r,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>L(this,_t).canRun(this)}));const n=this.state.status==="pending",s=!L(this,Js).canStart();try{if(n)r();else{pt(this,qr,$n).call(this,{type:"pending",variables:t,isPaused:s}),await((o=(a=L(this,_t).config).onMutate)==null?void 0:o.call(a,t,this));const T=await((c=(l=this.options).onMutate)==null?void 0:c.call(l,t));T!==this.state.context&&pt(this,qr,$n).call(this,{type:"pending",context:T,variables:t,isPaused:s})}const P=await L(this,Js).start();return await((d=(u=L(this,_t).config).onSuccess)==null?void 0:d.call(u,P,t,this.state.context,this)),await((m=(h=this.options).onSuccess)==null?void 0:m.call(h,P,t,this.state.context)),await((b=(f=L(this,_t).config).onSettled)==null?void 0:b.call(f,P,null,this.state.variables,this.state.context,this)),await((v=(g=this.options).onSettled)==null?void 0:v.call(g,P,null,t,this.state.context)),pt(this,qr,$n).call(this,{type:"success",data:P}),P}catch(P){try{throw await((y=(x=L(this,_t).config).onError)==null?void 0:y.call(x,P,t,this.state.context,this)),await((_=(w=this.options).onError)==null?void 0:_.call(w,P,t,this.state.context)),await((k=(j=L(this,_t).config).onSettled)==null?void 0:k.call(j,void 0,P,this.state.variables,this.state.context,this)),await((C=(S=this.options).onSettled)==null?void 0:C.call(S,void 0,P,t,this.state.context)),P}finally{pt(this,qr,$n).call(this,{type:"error",error:P})}}finally{L(this,_t).runNext(this)}}},Ur=new WeakMap,_t=new WeakMap,Js=new WeakMap,qr=new WeakSet,$n=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};
431case"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),kt.batch(()=>{L(this,Ur).forEach(n=>{n.onMutationUpdate(t)}),L(this,_t).notify({mutation:this,type:"updated",action:t})})},vy);function R5(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var dn,br,ol,wy,O5=(wy=class extends Xu{constructor(t={}){super();Se(this,dn);Se(this,br);Se(this,ol);this.config=t,ge(this,dn,new Set),ge(this,br,new Map),ge(this,ol,0)}build(t,r,n){const s=new A5({mutationCache:this,mutationId:++jl(this,ol)._,options:t.defaultMutationOptions(r),state:n});return this.add(s),s}add(t){L(this,dn).add(t);const r=Hl(t);if(typeof r=="string"){const n=L(this,br).get(r);n?n.push(t):L(this,br).set(r,[t])}this.notify({type:"added",mutation:t})}remove(t){if(L(this,dn).delete(t)){const r=Hl(t);if(typeof r=="string"){const n=L(this,br).get(r);if(n)if(n.length>1){const s=n.indexOf(t);s!==-1&&n.splice(s,1)}else n[0]===t&&L(this,br).delete(r)}}this.notify({type:"removed",mutation:t})}canRun(t){const r=Hl(t);if(typeof r=="string"){const n=L(this,br).get(r),s=n==null?void 0:n.find(a=>a.state.status==="pending");return!s||s===t}else return!0}runNext(t){var n;const r=Hl(t);if(typeof r=="string"){const s=(n=L(this,br).get(r))==null?void 0:n.find(a=>a!==t&&a.state.isPaused);return(s==null?void 0:s.continue())??Promise.resolve()}else return Promise.resolve()}clear(){kt.batch(()=>{L(this,dn).forEach(t=>{this.notify({type:"removed",mutation:t})}),L(this,dn).clear(),L(this,br).clear()})}getAll(){return Array.from(L(this,dn))}find(t){const r={exact:!0,...t};return this.getAll().find(n=>F0(r,n))}findAll(t={}){return this.getAll().filter(r=>F0(t,r))}notify(t){kt.batch(()=>{this.listeners.forEach(r=>{r(t)})})}resumePausedMutations(){const t=this.getAll().filter(r=>
vendor: 6,224 bytes, line 431
431r.state.isPaused);return kt.batch(()=>Promise.all(t.map(r=>r.continue().catch(yr))))}},dn=new WeakMap,br=new WeakMap,ol=new WeakMap,wy);function Hl(e){var t;return(t=e.options.scope)==null?void 0:t.id}function z0(e){return{onFetch:(t,r)=>{var d,h,m,f,b;const n=t.options,s=(m=(h=(d=t.fetchOptions)==null?void 0:d.meta)==null?void 0:h.fetchMore)==null?void 0:m.direction,a=((f=t.state.data)==null?void 0:f.pages)||[],o=((b=t.state.data)==null?void 0:b.pageParams)||[];let l={pages:[],pageParams:[]},c=0;const u=async()=>{let g=!1;const v=w=>{Object.defineProperty(w,"signal",{enumerable:!0,get:()=>(t.signal.aborted?g=!0:t.signal.addEventListener("abort",()=>{g=!0}),t.signal)})},x=f1(t.options,t.fetchOptions),y=async(w,_,j)=>{if(g)return Promise.reject();if(_==null&&w.pages.length)return Promise.resolve(w);const S=(()=>{const $={client:t.client,queryKey:t.queryKey,pageParam:_,direction:j?"backward":"forward",meta:t.options.meta};return v($),$})(),C=await x(S),{maxPages:P}=t.options,T=j?w5:v5;return{pages:T(w.pages,C,P),pageParams:T(w.pageParams,_,P)}};if(s&&a.length){const w=s==="backward",_=w?I5:B0,j={pages:a,pageParams:o},k=_(n,j);l=await y(j,k,w)}else{const w=e??a.length;do{const _=c===0?o[0]??n.initialPageParam:B0(n,l);if(c>0&&_==null)break;l=await y(l,_),c++}while(c<w)}return l};t.options.persister?t.fetchFn=()=>{var g,v;return(v=(g=t.options).persister)==null?void 0:v.call(g,u,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},r)}:t.fetchFn=u}}}function B0(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 I5(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 He,Qn,Jn,ci,ui,Zn,di,hi,by,M5=(by=class{constructor(e={}){Se(this,He);Se(this,Qn);Se(this,Jn);Se(this,ci);Se(this,ui);Se(this,Zn);Se(this,di);Se(this,hi);ge(this,He,e.queryCache||new P5),ge(this,Qn,e.mutationCache||new O5),ge(this,Jn,e.defaultOptions||{}),ge(this,ci,new Map),ge(this,ui,new Map),ge(this,Zn,0)}mount(){jl(this,Zn)._++,L(this,Zn)===1&&(ge(this,di,m1.subscribe(async e=>{e&&(await this.resumePausedMutations(),L(this,He).onFocus())})),ge(this,hi,ou.subscribe(async e=>{e&&(await this.resumePausedMutations(),L(this,He).onOnline())})))}unmount(){var e,t;jl(this,Zn)._--,L(this,Zn)===0&&((e=L(this,di))==null||e.call(this),ge(this,di,void 0),(t=L(this,hi))==null||t.call(this),ge(this,hi,void 0))}isFetching(e){return L(this,He).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return L(this,Qn).findAll({...e,status:"pending"}).length}getQueryData(e){var r;const t=this.defaultQueryOptions({queryKey:e});return(r=L(this,He).get(t.queryHash))==null?void 0:r.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),r=L(this,He).build(this,t),n=r.state.data;return n===void 0?this.fetchQuery(e):(e.revalidateIfStale&&r.isStaleByTime(Pf(t.staleTime,r))&&this.prefetchQuery(t),Promise.resolve(n))}getQueriesData(e){return L(this,He).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=L(this,He).get(n.queryHash),a=s==null?void 0:s.state.data,o=f5(t,a);if(o!==void 0)return L(this,He).build(this,n).setData(o,{...r,manual:!0})}setQueriesData(e,t,r){return kt.batch(()=>L(this,He).findAll(e).map(({queryKey:n})=>[n,this.setQueryData(n,t,r)]))}getQueryState(e){var r;const t=this.defaultQueryOptions({queryKey:e});return(r=L(this,He).get(t.queryHash))==null?void 0:r.state}removeQueries(e){const t=L(this,He);kt.batch(()=>{t.findAll(e).forEach(r=>{t.remove(r)})})}resetQueries(e,t){const r=L(this,He);return kt.batch(()=>(r.findAll(e).forEach(n=>{n.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const r={revert:!0,...t},n=kt.batch(()=>L(this,He).findAll(e).map(s=>s.cancel(r)));return Promise.all(n).then(yr).catch(yr)}invalidateQueries(e,t={}){return kt.batch(()=>(L(this,He).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=kt.batch(()=>L(this,He).findAll(e).filter(s=>!s.isDisabled()&&!s.isStatic()).map(s=>{let a=s.fetch(void 0,r);return r.throwOnError||(a=a.catch(yr)),s.state.fetchStatus==="paused"?Promise.resolve():a}));return Promise.all(n).then(yr)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const r=L(this,He).build(this,t);return r.isStaleByTime(Pf(t.staleTime,r))?r.fetch(t):Promise.resolve(r.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(yr).catch(yr)}fetchInfiniteQuery(e){return e.behavior=z0(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(yr).catch(yr)}ensureInfiniteQueryData(e){return e.behavior=z0(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return ou.isOnline()?L(this,Qn).resumePausedMutations():Promise.resolve()}getQueryCache(){return L(this,He)}getMutationCache(){return L(this,Qn)}getDefaultOptions(){return L(this,Jn)}setDefaultOptions(e){ge(this,Jn,e)}setQueryDefaults(e,t){L(this,ci).set(Wo(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...L(this,ci).values()],r={};return t.forEach(n=>{Ho(e,n.queryKey)&&Object.assign(r,n.defaultOptions)}),r}setMutationDefaults(e,t){L(this,ui).set(Wo(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...L(this,ui).values()],r={};return t.forEach(n=>{Ho(e,n.mutationKey)&&Object.assign(r,n.defaultOptions)}),r}defaultQueryOptions(e){if(e._defaulted)return e;const t={...L(this,Jn).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=Np(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===Cp&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...L(this,Jn).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}
vendor: 5,208 bytes, lines 431-440
431clear(){L(this,He).clear(),L(this,Qn).clear()}},He=new WeakMap,Qn=new WeakMap,Jn=new WeakMap,ci=new WeakMap,ui=new WeakMap,Zn=new WeakMap,di=new WeakMap,hi=new WeakMap,by),D5=p.createContext(void 0),L5=({client:e,children:t})=>(p.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),i.jsx(D5.Provider,{value:e,children:t}));/** 432 * @remix-run/router v1.23.0 433 * 434 * Copyright (c) Remix Software Inc. 435 * 436 * This source code is licensed under the MIT license found in the 437 * LICENSE.md file in the root directory of this source tree. 438 * 439 * @license MIT 440 */function Vo(){return Vo=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},Vo.apply(this,arguments)}var ts;(function(e){e.Pop="POP",e.Push="PUSH",e.Replace="REPLACE"})(ts||(ts={}));const W0="popstate";function $5(e){e===void 0&&(e={});function t(n,s){let{pathname:a,search:o,hash:l}=n.location;return Rf("",{pathname:a,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:lu(s)}return U5(t,r,null,e)}function Je(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function v1(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function F5(){return Math.random().toString(36).substr(2,8)}function H0(e,t){return{usr:e.state,key:e.key,idx:t}}function Rf(e,t,r,n){return r===void 0&&(r=null),Vo({pathname:typeof e=="string"?e:e.pathname,search:"",hash:""},typeof t=="string"?Mi(t):t,{state:r,key:t&&t.key||n||F5()})}function lu(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 Mi(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 U5(e,t,r,n){n===void 0&&(n={});let{window:s=document.defaultView,v5Compat:a=!1}=n,o=s.history,l=ts.Pop,c=null,u=d();u==null&&(u=0,o.replaceState(Vo({},o.state,{idx:u}),""));function d(){return(o.state||{idx:null}).idx}function h(){l=ts.Pop;let v=d(),x=v==null?null:v-u;u=v,c&&c({action:l,location:g.location,delta:x})}function m(v,x){l=ts.Push;let y=Rf(g.location,v,x);u=d()+1;let w=H0(y,u),_=g.createHref(y);try{o.pushState(w,"",_)}catch(j){if(j instanceof DOMException&&j.name==="DataCloneError")throw j;s.location.assign(_)}a&&c&&c({action:l,location:g.location,delta:1})}function f(v,x){l=ts.Replace;let y=Rf(g.location,v,x);u=d();let w=H0(y,u),_=g.createHref(y);o.replaceState(w,"",_),a&&c&&c({action:l,location:g.location,delta:0})}function b(v){let x=s.location.origin!=="null"?s.location.origin:s.location.href,y=typeof v=="string"?v:lu(v);return y=y.replace(/ $/,"%20"),Je(x,"No window.location.(origin|href) available to create URL for href: "+y),new URL(y,x)}let g={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(W0,h),c=v,()=>{s.removeEventListener(W0,h),c=null}},createHref(v){return t(s,v)},createURL:b,encodeLocation(v){let x=b(v);return{pathname:x.pathname,search:x.search,hash:x.hash}},push:m,replace:f,go(v){return o.go(v)}};return g}var V0;(function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"})(V0||(V0={}));function q5(e,t,r){return r===void 0&&(r="/"),z5(e,t,r,!1)}function z5(e,t,r,n){let s=typeof t=="string"?Mi(t):t,a=Ep(s.pathname||"/",r);if(a==null)return null;let o=w1(e);B5(o);let l=null;for(let c=0;l==null&&c<o.length;++c){let u=e4(a);l=Z5(o[c],u,n)}return l}function w1(e,t,r,n){t===void 0&&(t=[]),r===void 0&&(r=[]),n===void 0&&(n="");let s=(a,o,l)=>{let c={relativePath:l===void 0?a.path||"":l,caseSensitive:a.caseSensitive===!0,childrenIndex:o,route:a};c.relativePath.startsWith("/")&&(Je(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=hs([n,c.relativePath]),d=r.concat(c);a.children&&a.children.length>0&&(Je(a.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+u+'".')),w1(a.children,t,d,u)),!(a.path==null&&!a.index)&&t.push({path:u,score:Q5(u,a.index),routesMeta:d})};return e.forEach((a,o)=>{var l;if(a.path===""||!((l=a.path)!=null&&l.includes("?")))s(a,o);else for(let c of b1(a.path))s(a,o,c)}),t}function b1(e){let t=e.split("/");if(t.length===0)return[];let[r,...n]=t,s=r.endsWith("?"),a=r.replace(/\?$/,"");if(n.length===0)return s?[a,""]:[a];let o=b1(n.join("/")),l=[];return l.push(...o.map(c=>c===""?a:[a,c].join("/"))),s&&l.push(...o),l.map(c=>e.startsWith("/")&&c===""?"/":c)}function B5(e){e.sort((t,r)=>t.score!==r.score?r.score-t.score:J5(t.routesMeta.map(n=>n.childrenIndex),r.routesMeta.map(n=>n.childrenIndex)))}const W5=/^:[\w-]+$/,H5=3,V5=2,G5=1,Y5=10,K5=-2,G0=e=>e==="*";function Q5(e,t){let r=e.split("/"),n=r.length;return r.some(G0)&&(n+=K5),t&&(n+=V5),r.filter(s=>!G0(s)).reduce((s,a)=>
vendor: 9,988 bytes, lines 440-449
440s+(W5.test(a)?H5:a===""?G5:Y5),n)}function J5(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 Z5(e,t,r){let{routesMeta:n}=e,s={},a="/",o=[];for(let l=0;l<n.length;++l){let c=n[l],u=l===n.length-1,d=a==="/"?t:t.slice(a.length)||"/",h=Y0({path:c.relativePath,caseSensitive:c.caseSensitive,end:u},d),m=c.route;if(!h&&u&&r&&!n[n.length-1].route.index&&(h=Y0({path:c.relativePath,caseSensitive:c.caseSensitive,end:!1},d)),!h)return null;Object.assign(s,h.params),o.push({params:s,pathname:hs([a,h.pathname]),pathnameBase:s4(hs([a,h.pathnameBase])),route:m}),h.pathnameBase!=="/"&&(a=hs([a,h.pathnameBase]))}return o}function Y0(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[r,n]=X5(e.path,e.caseSensitive,e.end),s=t.match(r);if(!s)return null;let a=s[0],o=a.replace(/(.)\/+$/,"$1"),l=s.slice(1);return{params:n.reduce((u,d,h)=>{let{paramName:m,isOptional:f}=d;if(m==="*"){let g=l[h]||"";o=a.slice(0,a.length-g.length).replace(/(.)\/+$/,"$1")}const b=l[h];return f&&!b?u[m]=void 0:u[m]=(b||"").replace(/%2F/g,"/"),u},{}),pathname:a,pathnameBase:o,pattern:e}}function X5(e,t,r){t===void 0&&(t=!1),r===void 0&&(r=!0),v1(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 e4(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return v1(!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 Ep(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)||"/"}function t4(e,t){t===void 0&&(t="/");let{pathname:r,search:n="",hash:s=""}=typeof e=="string"?Mi(e):e;return{pathname:r?r.startsWith("/")?r:r4(r,t):t,search:a4(n),hash:i4(s)}}function r4(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 eh(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 n4(e){return e.filter((t,r)=>r===0||t.route.path&&t.route.path.length>0)}function Tp(e,t){let r=n4(e);return t?r.map((n,s)=>s===r.length-1?n.pathname:n.pathnameBase):r.map(n=>n.pathnameBase)}function Pp(e,t,r,n){n===void 0&&(n=!1);let s;typeof e=="string"?s=Mi(e):(s=Vo({},e),Je(!s.pathname||!s.pathname.includes("?"),eh("?","pathname","search",s)),Je(!s.pathname||!s.pathname.includes("#"),eh("#","pathname","hash",s)),Je(!s.search||!s.search.includes("#"),eh("#","search","hash",s)));let a=e===""||s.pathname==="",o=a?"/":s.pathname,l;if(o==null)l=r;else{let h=t.length-1;if(!n&&o.startsWith("..")){let m=o.split("/");for(;m[0]==="..";)m.shift(),h-=1;s.pathname=m.join("/")}l=h>=0?t[h]:"/"}let c=t4(s,l),u=o&&o!=="/"&&o.endsWith("/"),d=(a||o===".")&&r.endsWith("/");return!c.pathname.endsWith("/")&&(u||d)&&(c.pathname+="/"),c}const hs=e=>e.join("/").replace(/\/\/+/g,"/"),s4=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),a4=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,i4=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;function o4(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}const _1=["post","put","patch","delete"];new Set(_1);const l4=["get",..._1];new Set(l4);/** 441 * React Router v6.30.1 442 * 443 * Copyright (c) Remix Software Inc. 444 * 445 * This source code is licensed under the MIT license found in the 446 * LICENSE.md file in the root directory of this source tree. 447 * 448 * @license MIT 449 */function Go(){return Go=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},Go.apply(this,arguments)}const Ap=p.createContext(null),c4=p.createContext(null),Cs=p.createContext(null),td=p.createContext(null),En=p.createContext({outlet:null,matches:[],isDataRoute:!1}),j1=p.createContext(null);function u4(e,t){let{relative:r}=t===void 0?{}:t;Di()||Je(!1);let{basename:n,navigator:s}=p.useContext(Cs),{hash:a,pathname:o,search:l}=S1(e,{relative:r}),c=o;return n!=="/"&&(c=o==="/"?n:hs([n,o])),s.createHref({pathname:c,search:l,hash:a})}function Di(){return p.useContext(td)!=null}function Li(){return Di()||Je(!1),p.useContext(td).location}function k1(e){p.useContext(Cs).static||p.useLayoutEffect(e)}function pa(){let{isDataRoute:e}=p.useContext(En);return e?k4():d4()}function d4(){Di()||Je(!1);let e=p.useContext(Ap),{basename:t,future:r,navigator:n}=p.useContext(Cs),{matches:s}=p.useContext(En),{pathname:a}=Li(),o=JSON.stringify(Tp(s,r.v7_relativeSplatPath)),l=p.useRef(!1);return k1(()=>{l.current=!0}),p.useCallback(function(u,d){if(d===void 0&&(d={}),!l.current)return;if(typeof u=="number"){n.go(u);return}let h=Pp(u,JSON.parse(o),a,d.relative==="path");e==null&&t!=="/"&&(h.pathname=h.pathname==="/"?t:hs([t,h.pathname])),(d.replace?n.replace:n.push)(h,d.state,d)},[t,n,o,a,e])}function h4(){let{matches:e}=p.useContext(En),t=e[e.length-1];return t?t.params:{}}function S1(e,t){let{relative:r}=t===void 0?{}:t,{future:n}=p.useContext(Cs),{matches:s}=p.useContext(En),{pathname:a}=Li(),o=JSON.stringify(Tp(s,n.v7_relativeSplatPath));return p.useMemo(()=>Pp(e,JSON.parse(o),a,r==="path"),[e,o,a,r])}function f4(e,t){return m4(e,t)}function m4(e,t,r,n){Di()||Je(!1);let{navigator:s}=p.useContext(Cs),{matches:a}=p.useContext(En),o=a[a.length-1],l=o?o.params:{};o&&o.pathname;let c=o?o.pathnameBase:"/";o&&o.route;let u=Li(),d;if(t){var h;let v=typeof t=="string"?Mi(t):t;c==="/"||(h=v.pathname)!=null&&h.startsWith(c)||Je(!1),d=v}else d=u;let m=d.pathname||"/",f=m;if(c!=="/"){let v=c.replace(/^\//,"").split("/");f="/"+m.replace(/^\//,"").split("/").slice(v.length).join("/")}let b=q5(e,{pathname:f}),g=v4(b&&b.map(v=>Object.assign({},v,{params:Object.assign({},l,v.params),pathname:hs([c,s.encodeLocation?s.encodeLocation(v.pathname).pathname:v.pathname]),pathnameBase:v.pathnameBase==="/"?c:hs([c,s.encodeLocation?s.encodeLocation(v.pathnameBase).pathname:v.pathnameBase])})),a,r,n);return t&&g?p.createElement(td.Provider,{value:{location:Go({pathname:"/",search:"",hash:"",state:null,key:"default"},d),navigationType:ts.Pop}},g):g}function p4(){let e=j4(),t=o4(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 p.createElement(p.Fragment,null,p.createElement("h2",null,"Unexpected Application Error!"),p.createElement("h3",{style:{fontStyle:"italic"}},t),r?p.createElement("pre",{style:s},r):null,null)}const g4=p.createElement(p4,null);class x4 extends p.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?p.createElement(En.Provider,{value:this.props.routeContext},p.createElement(j1.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function y4(e){let{routeContext:t,match:r,children:n}=e,s=p.useContext(Ap);return s&&s.static&&s.staticContext&&(r.route.errorElement||r.route.ErrorBoundary)&&(s.staticContext._deepestRenderedBoundaryId=r.route.id),p.createElement(En.Provider,{value:t},n)}function v4(e,t,r,n){var s;if(t===void 0&&(t=[]),r===void 0&&(r=null),n===void 0&&(n=null),e==null){var a;if(!r)return null;if(r.errors)e=r.matches;else if((a=n)!=null&&a.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 d=o.findIndex(h=>h.route.id&&(l==null?void 0:l[h.route.id])!==void 0);d>=0||Je(!1),o=o.slice(0,Math.min(o.length,d+1))}let c=!1,u=-1;if(r&&n&&n.v7_partialHydration)for(let d=0;d<o.length;d++){let h=o[d];if((h.route.HydrateFallback||h.route.hydrateFallbackElement)&&(u=d),h.route.id){let{loaderData:m,errors:f}=r,b=h.route.loader&&m[h.route.id]===void 0&&(!f||f[h.route.id]===void 0);if(h.route.lazy||b){c=!0,u>=0?o=o.slice(0,u+1):o=[o[0]];break}}}return o.reduceRight((d,h,m)=>{let f,b=!1,g=null,v=null;r&&(f=l&&h.route.id?l[h.route.id]:void 0,g=h.route.errorElement||g4,c&&(u<0&&m===0?(b=!0,v=null):u===m&&(b=!0,v=h.route.hydrateFallbackElement||null)));let x=t.concat(o.slice(0,m+1)),y=()=>{let w;return f?w=g:b?w=v:h.route.Component?w=p.createElement(h.route.Component,null):h.route.element?w=h.route.element:w=d,p.createElement(y4,{match:h,routeContext:{outlet:d,matches:x,isDataRoute:r!=null},children:w})};return r&&(h.route.ErrorBoundary||h.route.errorElement||m===0)?p.createElement(x4,{location:r.location,revalidation:r.revalidation,component:g,error:f,children:y(),routeC
449ontext:{outlet:null,matches:x,isDataRoute:!0}}):y()},null)}var N1=function(e){return e.UseBlocker="useBlocker",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e}(N1||{}),cu=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}(cu||{});function w4(e){let t=p.useContext(Ap);return t||Je(!1),t}function b4(e){let t=p.useContext(c4);return t||Je(!1),t}function _4(e){let t=p.useContext(En);return t||Je(!1),t}function C1(e){let t=_4(),r=t.matches[t.matches.length-1];return r.route.id||Je(!1),r.route.id}function j4(){var e;let t=p.useContext(j1),r=b4(cu.UseRouteError),n=C1(cu.UseRouteError);return t!==void 0?t:(e=r.errors)==null?void 0:e[n]}function k4(){let{router:e}=w4(N1.UseNavigateStable),t=C1(cu.UseNavigateStable),r=p.useRef(!1);return k1(()=>{r.current=!0}),p.useCallback(function(s,a){a===void 0&&(a={}),r.current&&(typeof s=="number"?e.navigate(s):e.navigate(s,Go({fromRouteId:t},a)))},[e,t])}function S4(e,t){e==null||e.v7_startTransition,e==null||e.v7_relativeSplatPath}function N4(e){let{to:t,replace:r,state:n,relative:s}=e;Di()||Je(!1);let{future:a,static:o}=p.useContext(Cs),{matches:l}=p.useContext(En),{pathname:c}=Li(),u=pa(),d=Pp(t,Tp(l,a.v7_relativeSplatPath),c,s==="path"),h=JSON.stringify(d);return p.useEffect(()=>u(JSON.parse(h),{replace:r,state:n,relative:s}),[u,h,s,r,n]),null}function Fn(e){Je(!1)}function C4(e){let{basename:t="/",children:r=null,location:n,navigationType:s=ts.Pop,navigator:a,static:o=!1,future:l}=e;Di()&&Je(!1);let c=t.replace(/^\/*/,"/"),u=p.useMemo(()=>({basename:c,navigator:a,static:o,future:Go({v7_relativeSplatPath:!1},l)}),[c,l,a,o]);typeof n=="string"&&(n=Mi(n));let{pathname:d="/",search:h="",hash:m="",state:f=null,key:b="default"}=n,g=p.useMemo(()=>{let v=Ep(d,c);return v==null?null:{location:{pathname:v,search:h,hash:m,state:f,key:b},navigationType:s}},[c,d,h,m,f,b,s]);return g==null?null:p.createElement(Cs.Provider,{value:u},p.createElement(td.Provider,{children:r,value:g}))}function E4(e){let{children:t,location:r}=e;return f4(Of(t),r)}new Promise(()=>{});function Of(e,t){t===void 0&&(t=[]);let r=[];return p.Children.forEach(e,(n,s)=>{if(!p.isValidElement(n))return;let a=[...t,s];if(n.type===p.Fragment){r.push.apply(r,Of(n.props.children,a));return}n.type!==Fn&&Je(!1),!n.props.index||!n.props.children||Je(!1);let o={id:n.props.id||a.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=Of(n.props.children,a)),r.push(o)}),r}/** 450 * React Router DOM v6.30.1 451 * 452 * Copyright (c) Remix Software Inc. 453 * 454 * This source code is licensed under the MIT license found in the 455 * LICENSE.md file in the root directory of this source tree. 456 * 457 * @license MIT 458 */function If(){return If=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},If.apply(this,arguments)}function T4(e,t){if(e==null)return{};var r={},n=Object.keys(e),s,a;for(a=0;a<n.length;a++)s=n[a],!(t.indexOf(s)>=0)&&(r[s]=e[s]);return r}function P4(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function A4(e,t){return e.button===0&&(!t||t==="_self")&&!P4(e)}const R4=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],O4="6";try{window.__reactRouterVersion=O4}catch{}const I4="startTransition",K0=hm[I4];function M4(e){let{basename:t,children:r,future:n,window:s}=e,a=p.useRef();a.current==null&&(a.current=$5({window:s,v5Compat:!0}));let o=a.current,[l,c]=p.useState({action:o.action,location:o.location}),{v7_startTransition:u}=n||{},d=p.useCallback(h=>{u&&K0?K0(()=>c(h)):c(h)},[c,u]);return p.useLayoutEffect(()=>o.listen(d),[o,d]),p.useEffect(()=>S4(n),[n]),p.createElement(C4,{basename:t,children:r,location:l.location,navigationType:l.action,navigator:o,future:n})}const D4=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",L4=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,mn=p.forwardRef(function(t,r){let{onClick:n,relative:s,reloadDocument:a,replace:o,state:l,target:c,to:u,preventScrollReset:d,viewTransition:h}
458=t,m=T4(t,R4),{basename:f}=p.useContext(Cs),b,g=!1;if(typeof u=="string"&&L4.test(u)&&(b=u,D4))try{let w=new URL(window.location.href),_=u.startsWith("//")?new URL(w.protocol+u):new URL(u),j=Ep(_.pathname,f);_.origin===w.origin&&j!=null?u=j+_.search+_.hash:g=!0}catch{}let v=u4(u,{relative:s}),x=$4(u,{replace:o,state:l,target:c,preventScrollReset:d,relative:s,viewTransition:h});function y(w){n&&n(w),w.defaultPrevented||x(w)}return p.createElement("a",If({},m,{href:b||v,onClick:g||a?n:y,ref:r,target:c}))});var Q0;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})(Q0||(Q0={}));var J0;(function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})(J0||(J0={}));function $4(e,t){let{target:r,replace:n,state:s,preventScrollReset:a,relative:o,viewTransition:l}=t===void 0?{}:t,c=pa(),u=Li(),d=S1(e,{relative:o});return p.useCallback(h=>{if(A4(h,r)){h.preventDefault();let m=n!==void 0?n:lu(u)===lu(d);c(e,{replace:m,state:s,preventScrollReset:a,relative:o,viewTransition:l})}},[u,c,d,n,s,r,e,a,o,l])}var Br=function(){return Br=Object.assign||function(t){for(var r,n=1,s=arguments.length;n<s;n++){r=arguments[n];for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&(t[a]=r[a])}return t},Br.apply(this,arguments)};function $i(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 F4(e,t,r,n){function s(a){return a instanceof r?a:new r(function(o){o(a)})}return new(r||(r=Promise))(function(a,o){function l(d){try{u(n.next(d))}catch(h){o(h)}}function c(d){try{u(n.throw(d))}catch(h){o(h)}}function u(d){d.done?a(d.value):s(d.value).then(l,c)}u((n=n.apply(e,t||[])).next())})}function U4(e,t,r){if(r||arguments.length===2)for(var n=0,s=t.length,a;n<s;n++)(a||!(n in t))&&(a||(a=Array.prototype.slice.call(t,0,n)),a[n]=t[n]);return e.concat(a||Array.prototype.slice.call(t))}const q4=e=>e?(...t)=>e(...t):(...t)=>fetch(...t);class Rp extends Error{constructor(t,r="FunctionsError",n){super(t),this.name=r,this.context=n}}class z4 extends Rp{constructor(t){super("Failed to send a request to the Edge Function","FunctionsFetchError",t)}}class Z0 extends Rp{constructor(t){super("Relay Error invoking the Edge Function","FunctionsRelayError",t)}}class X0 extends Rp{constructor(t){super("Edge Function returned a non-2xx status code","FunctionsHttpError",t)}}var Mf;(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"})(Mf||(Mf={}));class B4{constructor(t,{headers:r={},customFetch:n,region:s=Mf.Any}={}){this.url=t,this.headers=r,this.region=s,this.fetch=q4(n)}setAuth(t){this.headers.Authorization=`Bearer ${t}`}invoke(t){return F4(this,arguments,void 0,function*(r,n={}){var s;let a,o;try{const{headers:l,method:c,body:u,signal:d,timeout:h}=n;let m={},{region:f}=n;f||(f=this.region);const b=new URL(`${this.url}/${r}`);f&&f!=="any"&&(m["x-region"]=f,b.searchParams.set("forceFunctionRegion",f));let g;u&&(l&&!Object.prototype.hasOwnProperty.call(l,"Content-Type")||!l)?typeof Blob<"u"&&u instanceof Blob||u instanceof ArrayBuffer?(m["Content-Type"]="application/octet-stream",g=u):typeof u=="string"?(m["Content-Type"]="text/plain",g=u):typeof FormData<"u"&&u instanceof FormData?g=u:(m["Content-Type"]="application/json",g=JSON.stringify(u)):u&&typeof u!="string"&&!(typeof Blob<"u"&&u instanceof Blob)&&!(u instanceof ArrayBuffer)&&!(typeof FormData<"u"&&u instanceof FormData)?g=JSON.stringify(u):g=u;let v=d;h&&(o=new AbortController,a=setTimeout(()=>
458o.abort(),h),d?(v=o.signal,d.addEventListener("abort",()=>o.abort())):v=o.signal);const x=yield this.fetch(b.toString(),{method:c||"POST",headers:Object.assign(Object.assign(Object.assign({},m),this.headers),l),body:g,signal:v}).catch(j=>{throw new z4(j)}),y=x.headers.get("x-relay-error");if(y&&y==="true")throw new Z0(x);if(!x.ok)throw new X0(x);let w=((s=x.headers.get("Content-Type"))!==null&&s!==void 0?s:"text/plain").split(";")[0].trim(),_;return w==="application/json"?_=yield x.json():w==="application/octet-stream"||w==="application/pdf"?_=yield x.blob():w==="text/event-stream"?_=x:w==="multipart/form-data"?_=yield x.formData():_=yield x.text(),{data:_,error:null,response:x}}catch(l){return{data:null,error:l,response:l instanceof X0||l instanceof Z0?l.context:void 0}}finally{a&&clearTimeout(a)}})}}var W4=class extends Error{constructor(e){super(e.message),this.name="PostgrestError",this.details=e.details,this.hint=e.hint,this.code=e.code}},H4=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 a=>{let o=null,l=null,c=null,u=a.status,d=a.statusText;if(a.ok){var h,m;if(r.method!=="HEAD"){var f;const x=await a.text();x===""||(r.headers.get("Accept")==="text/csv"||r.headers.get("Accept")&&(!((f=r.headers.get("Accept"))===null||f===void 0)&&f.includes("application/vnd.pgrst.plan+text"))?l=x:l=JSON.parse(x))}const g=(h=r.headers.get("Prefer"))===null||h===void 0?void 0:h.match(/count=(exact|planned|estimated)/),v=(m=a.headers.get("content-range"))===null||m===void 0?void 0:m.split("/");g&&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,d="Not Acceptable"):l.length===1?l=l[0]:l=null)}else{var b;const g=await a.text();try{o=JSON.parse(g),Array.isArray(o)&&a.status===404&&(l=[],o=null,u=200,d="OK")}catch{a.status===404&&g===""?(u=204,d="No Content"):o={message:g}}if(o&&r.isMaybeSingle&&(!(o==null||(b=o.details)===null||b===void 0)&&b.includes("0 rows"))&&(o=null,u=200,d="OK"),o&&r.shouldThrowOnError)throw new W4(o)}return{error:o,data:l,count:c,status:u,statusText:d}});return this.shouldThrowOnError||(s=s.catch(a=>{var o;let l="",c="",u="";const d=a==null?void 0:a.cause;if(d){var h,m,f,b;const x=(h=d==null?void 0:d.message)!==null&&h!==void 0?h:"",y=(m=d==null?void 0:d.code)!==null&&m!==void 0?m:"";l=`${(f=a==null?void 0:a.name)!==null&&f!==void 0?f:"FetchError"}: ${a==null?void 0:a.message}`,l+=` 459 460Caused by: ${(b=d==null?void 0:d.name)!==null&&b!==void 0?b:"Error"}: ${x}`,y&&(l+=` (${y})`),d!=null&&d.stack&&(l+=` 461${d.stack}`)}else{var g;l=(g=a==null?void 0:a.stack)!==null&&g!==void 0?g:""}const v=this.url.toString().length;return(a==null?void 0:a.name)==="AbortError"||(a==null?void 0:a.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.`)):((d==null?void 0:d.name)==="HeadersOverflowError"||(d==null?void 0:d.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=a==null?void 0:a.name)!==null&&o!==void 0?o:"FetchError"}: ${a==null?void 0:a.message}`,details:l,hint:c,code:u},data:null,count:null,status:0,statusText:""}}
461)),s.then(e,t)}returns(){return this}overrideTypes(){return this}},V4=class extends H4{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 a=s?`${s}.order`:"order",o=this.url.searchParams.get(a);return this.url.searchParams.set(a,`${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`,a=typeof n>"u"?"limit":`${n}.limit`;return this.url.searchParams.set(s,`${e}`),this.url.searchParams.set(a,`${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:a="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+${a}; for="${c}"; options=${l};`),a==="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 ex=new RegExp("[,()]");var Ra=class extends V4{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"&&ex.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"&&ex.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 a=r===void 0?"":`(${r})`;return this.url.searchParams.append(e,`${s}fts${a}.${t}`),this}match(e){return Object.entries(e).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}},G4=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}
461cloneRequestState(){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 a=!1;const o=(e??"*").split("").map(u=>/\s/.test(u)&&!a?"":(u==='"'&&(a=!a),u)).join(""),{url:l,headers:c}=this.cloneRequestState();return l.searchParams.set("select",o),n&&c.append("Prefer",`count=${n}`),new Ra({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:a,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}"`);a.searchParams.set("columns",c.join(","))}}return new Ra({method:s,url:a,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 a;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((d,h)=>d.concat(Object.keys(h)),[]);if(u.length>0){const d=[...new Set(u)].map(h=>`"${h}"`);l.searchParams.set("columns",d.join(","))}}return new Ra({method:o,url:l,headers:c,schema:this.schema,body:e,fetch:(a=this.fetch)!==null&&a!==void 0?a:fetch,urlLengthLimit:this.urlLengthLimit})}update(e,{count:t}={}){var r;const n="PATCH",{url:s,headers:a}=this.cloneRequestState();return t&&a.append("Prefer",`count=${t}`),new Ra({method:n,url:s,headers:a,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 Ra({method:r,url:n,headers:s,schema:this.schema,fetch:(t=this.fetch)!==null&&t!==void 0?t:fetch,urlLengthLimit:this.urlLengthLimit})}};function Yo(e){"@babel/helpers - typeof";return Yo=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},Yo(e)}function Y4(e,t){if(Yo(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(Yo(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function K4(e){var t=Y4(e,"string");return Yo(t)=="symbol"?t:t+""}function Q4(e,t,r){return(t=K4(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function tx(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 Vl(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?tx(Object(r),!0).forEach(function(n){Q4(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):tx(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}var J4=class E1{constructor(t,{headers:r={},schema:n,fetch:s,timeout:a,urlLengthLimit:o=8e3}={}){this.url=t,this.headers=new Headers(r),this.schemaName=n,this.urlLengthLimit=o;const l=s??globalThis.fetch;a!==void 0&&a>0?this.fetch=(c,u)=>{const d=new AbortController,h=setTimeout(()=>d.abort(),a),m=u==null?void 0:u.signal;if(m){if(m.aborted)return clearTimeout(h),l(c,u);const f=()=>{clearTimeout(h),d.abort()};return m.addEventListener("abort",f,{once:!0}),l(c,Vl(Vl({},u),{},{signal:d.signal})).finally(()=>{clearTimeout(h),m.removeEventListener("abort",f)})}return l(c,Vl(Vl({},u),{},{signal:d.signal})).finally(()=>clearTimeout(h))}: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 G4(new URL(`${this.url}/${t}`),{headers:new Headers(this.headers),schema:this.schemaName,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit})}schema(t){return new E1(this.url,{headers:this.headers,schema:t,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit})}rpc(t,r={},{head:n=!1,get:s=!1,count:a}={}){var o;let l;const c=new URL(`${this.url}/rpc/${t}`);let u;const d=f=>f!==null&&typeof f=="object"&&(!Array.isArray(f)||f.some(d)),h=n&&Object.values(r).some(d);h?(l="POST",u=r):n||s?(l=n?"HEAD":"GET",Object.entries(r).filter(([f,b])=>b!==void 0).map(([f,b])=>[f,Array.isArray(b)?`{${b.join(",")}}`:`${b}
461`]).forEach(([f,b])=>{c.searchParams.append(f,b)})):(l="POST",u=r);const m=new Headers(this.headers);return h?m.set("Prefer",a?`count=${a},return=minimal`:"return=minimal"):a&&m.set("Prefer",`count=${a}`),new Ra({method:l,url:c,headers:m,schema:this.schemaName,body:u,fetch:(o=this.fetch)!==null&&o!==void 0?o:fetch,urlLengthLimit:this.urlLengthLimit})}};class Z4{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,a=parseInt(s.replace(/^v/,"").split(".")[0]);return a>=22?typeof globalThis.WebSocket<"u"?{type:"native",constructor:globalThis.WebSocket}:{type:"unsupported",error:`Node.js ${a} detected but native WebSocket not found.`,workaround:"Provide a WebSocket implementation via the transport option."}:{type:"unsupported",error:`Node.js ${a} detected without native WebSocket support.`,workaround:`For Node.js < 22, install "ws" package and provide it via the transport option: 462import ws from "ws" 463new 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+=` 464 465Suggested solution: ${t.workaround}`),new Error(r)}static createWebSocket(t,r){const n=this.getWebSocketConstructor();return new n(t,r)}static isWebSocketSupported(){try{const t=this.detectEnvironment();return t.type==="native"||t.type==="ws"}catch{return!1}}}const X4="2.95.3",eP=`realtime-js/${X4}`,tP="1.0.0",T1="2.0.0",rx=T1,Df=1e4,rP=1e3,nP=100;var Bn;(function(e){e[e.connecting=0]="connecting",e[e.open=1]="open",e[e.closing=2]="closing",e[e.closed=3]="closed"})(Bn||(Bn={}));var tt;(function(e){e.closed="closed",e.errored="errored",e.joined="joined",e.joining="joining",e.leaving="leaving"})(tt||(tt={}));var jr;(function(e){e.close="phx_close",e.error="phx_error",e.join="phx_join",e.reply="phx_reply",e.leave="phx_leave",e.access_token="access_token"})(jr||(jr={}));var Lf;(function(e){e.websocket="websocket"})(Lf||(Lf={}));var Us;(function(e){e.Connecting="connecting",e.Open="open",e.Closing="closing",e.Closed="closed"})(Us||(Us={}));class sP{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,a;const o=t.topic,l=(s=t.ref)!==null&&s!==void 0?s:"",c=(a=t.join_ref)!==null&&a!==void 0?a:"",u=t.payload.event,d=this.allowedMetadataKeys?this._pick(t.payload,this.allowedMetadataKeys):{},h=Object.keys(d).length===0?"":JSON.stringify(d);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(h.length>255)throw new Error(`metadata length ${h.length} exceeds maximum of 255`);const m=this.USER_BROADCAST_PUSH_META_LENGTH+c.length+l.length+o.length+u.length+h.length,f=new ArrayBuffer(this.HEADER_LENGTH+m);let b=new DataView(f),g=0;b.setUint8(g++,this.KINDS.userBroadcastPush),b.setUint8(g++,c.length),b.setUint8(g++,l.length),b.setUint8(g++,o.length),b.setUint8(g++,u.length),b.setUint8(g++,h.length),b.setUint8(g++,r),Array.from(c,x=>b.setUint8(g++,x.charCodeAt(0))),Array.from(l,x=>b.setUint8(g++,x.charCodeAt(0))),Array.from(o,x=>b.setUint8(g++,x.charCodeAt(0))),Array.from(u,x=>b.setUint8(g++,x.charCodeAt(0))),Array.from(h,x=>b.setUint8(g++,x.charCodeAt(0)));var v=new Uint8Array(f.byteLength+n.byteLength);return v.set(new Uint8Array(f),0),v.set(new Uint8Array(n),f.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,a,o,l,c]=n;return r({join_ref:s,ref:a,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),a=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 d=n.decode(t.slice(c,c+a));c=c+a;
465const h=n.decode(t.slice(c,c+o));c=c+o;const m=t.slice(c,t.byteLength),f=l===this.JSON_ENCODING?JSON.parse(n.decode(m)):m,b={type:this.BROADCAST_EVENT,event:d,payload:f};return o>0&&(b.meta=JSON.parse(h)),{join_ref:null,ref:null,topic:u,event:this.BROADCAST_EVENT,payload:b}}_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)))}}class P1{constructor(t,r){this.callback=t,this.timerCalc=r,this.timer=void 0,this.tries=0,this.callback=t,this.timerCalc=r}reset(){this.tries=0,clearTimeout(this.timer),this.timer=void 0}scheduleTimeout(){clearTimeout(this.timer),this.timer=setTimeout(()=>{this.tries=this.tries+1,this.callback()},this.timerCalc(this.tries+1))}}var Oe;(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"})(Oe||(Oe={}));const nx=(e,t,r={})=>{var n;const s=(n=r.skipTypes)!==null&&n!==void 0?n:[];return t?Object.keys(t).reduce((a,o)=>(a[o]=aP(o,e,t,s),a),{}):{}},aP=(e,t,r,n)=>{const s=t.find(l=>
465l.name===e),a=s==null?void 0:s.type,o=r[e];return a&&!n.includes(a)?A1(a,o):$f(o)},A1=(e,t)=>{if(e.charAt(0)==="_"){const r=e.slice(1,e.length);return cP(t,r)}switch(e){case Oe.bool:return iP(t);case Oe.float4:case Oe.float8:case Oe.int2:case Oe.int4:case Oe.int8:case Oe.numeric:case Oe.oid:return oP(t);case Oe.json:case Oe.jsonb:return lP(t);case Oe.timestamp:return uP(t);case Oe.abstime:case Oe.date:case Oe.daterange:case Oe.int4range:case Oe.int8range:case Oe.money:case Oe.reltime:case Oe.text:case Oe.time:case Oe.timestamptz:case Oe.timetz:case Oe.tsrange:case Oe.tstzrange:return $f(t);default:return $f(t)}},$f=e=>e,iP=e=>{switch(e){case"t":return!0;case"f":return!1;default:return e}},oP=e=>{if(typeof e=="string"){const t=parseFloat(e);if(!Number.isNaN(t))return t}return e},lP=e=>{if(typeof e=="string")try{return JSON.parse(e)}catch{return e}return e},cP=(e,t)=>{if(typeof e!="string")return e;const r=e.length-1,n=e[r];if(e[0]==="{"&&n==="}"){let a;const o=e.slice(1,r);try{a=JSON.parse("["+o+"]")}catch{a=o?o.split(","):[]}return a.map(l=>A1(t,l))}return e},uP=e=>typeof e=="string"?e.replace(" ","T"):e,R1=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};class th{constructor(t,r,n={},s=Df){this.channel=t,this.event=r,this.payload=n,this.timeout=s,this.sent=!1,this.timeoutTimer=void 0,this.ref="",this.receivedResp=null,this.recHooks=[],this.refEvent=null}resend(t){this.timeout=t,this._cancelRefEvent(),this.ref="",this.refEvent=null,this.receivedResp=null,this.sent=!1,this.send()}send(){this._hasReceived("timeout")||(this.startTimeout(),this.sent=!0,this.channel.socket.push({topic:this.channel.topic,event:this.event,payload:this.payload,ref:this.ref,join_ref:this.channel._joinRef()}))}updatePayload(t){this.payload=Object.assign(Object.assign({},this.payload),t)}receive(t,r){var n;return this._hasReceived(t)&&r((n=this.receivedResp)===null||n===void 0?void 0:n.response),this.recHooks.push({status:t,callback:r}),this}startTimeout(){if(this.timeoutTimer)return;this.ref=this.channel.socket._makeRef(),this.refEvent=this.channel._replyEventName(this.ref);const t=r=>{this._cancelRefEvent(),this._cancelTimeout(),this.receivedResp=r,this._matchReceive(r)};this.channel._on(this.refEvent,{},t),this.timeoutTimer=setTimeout(()=>{this.trigger("timeout",{})},this.timeout)}trigger(t,r){this.refEvent&&this.channel._trigger(this.refEvent,{status:t,response:r})}destroy(){this._cancelRefEvent(),this._cancelTimeout()}_cancelRefEvent(){this.refEvent&&this.channel._off(this.refEvent,{})}_cancelTimeout(){clearTimeout(this.timeoutTimer),this.timeoutTimer=void 0}_matchReceive({status:t,response:r}){this.recHooks.filter(n=>n.status===t).forEach(n=>n.callback(r))}_hasReceived(t){return this.receivedResp&&this.receivedResp.status===t}}var sx;(function(e){e.SYNC="sync",e.JOIN="join",e.LEAVE="leave"})(sx||(sx={}));class _o{constructor(t,r){this.channel=t,this.state={},this.pendingDiffs=[],this.joinRef=null,this.enabled=!1,this.caller={onJoin:()=>{},onLeave:()=>{},onSync:()=>{}};const n=(r==null?void 0:r.events)||{state:"presence_state",diff:"presence_diff"};this.channel._on(n.state,{},s=>{const{onJoin:a,onLeave:o,onSync:l}=this.caller;this.joinRef=this.channel._joinRef(),this.state=_o.syncState(this.state,s,a,o),this.pendingDiffs.forEach(c=>{this.state=_o.syncDiff(this.state,c,a,o)}),this.pendingDiffs=[],l()}),this.channel._on(n.diff,{},s=>{const{onJoin:a,onLeave:o,onSync:l}=this.caller;this.inPendingSyncState()?this.pendingDiffs.push(s):(this.state=_o.syncDiff(this.state,s,a,o),l())}),this.onJoin((s,a,o)=>{this.channel._trigger("presence",{event:"join",key:s,currentPresences:a,newPresences:o})}),this.onLeave((s,a,o)=>{this.channel._trigger("presence",{event:"leave",key:s,currentPresences:a,leftPresences:o})}),this.onSync(()=>{this.channel._trigger("presence",{event:"sync"})})}static syncState(t,r,n,s){const a=this.cloneDeep(t),o=this.transformState(r),l={},c={};return this.map(a,(u,d)=>{o[u]||(c[u]=d)}),this.map(o,(u,d)=>{const h=a[u];if(h){const m=d.map(v=>v.presence_ref),f=h.map(v=>v.presence_ref),b=d.filter(v=>f.indexOf(v.presence_ref)<0),g=h.filter(v=>m.indexOf(v.presence_ref)<0);b.length>0&&(l[u]=b),g.length>0&&(c[u]=g)}else l[u]=d}),this.syncDiff(a,{joins:l,leaves:c},n,s)}static syncDiff(t,r,n,s){const{joins:a,leaves:o}={joins:this.transformState(r.joins),leaves:this.transformState(r.leaves)};return n||(n=()=>{}),s||(s=()=>{}),this.map(a,(l,c)=>{var u;
465const d=(u=t[l])!==null&&u!==void 0?u:[];if(t[l]=this.cloneDeep(c),d.length>0){const h=t[l].map(f=>f.presence_ref),m=d.filter(f=>h.indexOf(f.presence_ref)<0);t[l].unshift(...m)}n(l,d,c)}),this.map(o,(l,c)=>{let u=t[l];if(!u)return;const d=c.map(h=>h.presence_ref);u=u.filter(h=>d.indexOf(h.presence_ref)<0),t[l]=u,s(l,u,c),u.length===0&&delete t[l]}),t}static map(t,r){return Object.getOwnPropertyNames(t).map(n=>r(n,t[n]))}static transformState(t){return t=this.cloneDeep(t),Object.getOwnPropertyNames(t).reduce((r,n)=>{const s=t[n];return"metas"in s?r[n]=s.metas.map(a=>(a.presence_ref=a.phx_ref,delete a.phx_ref,delete a.phx_ref_prev,a)):r[n]=s,r},{})}static cloneDeep(t){return JSON.parse(JSON.stringify(t))}onJoin(t){this.caller.onJoin=t}onLeave(t){this.caller.onLeave=t}onSync(t){this.caller.onSync=t}inPendingSyncState(){return!this.joinRef||this.joinRef!==this.channel._joinRef()}}var ax;(function(e){e.ALL="*",e.INSERT="INSERT",e.UPDATE="UPDATE",e.DELETE="DELETE"})(ax||(ax={}));var jo;(function(e){e.BROADCAST="broadcast",e.PRESENCE="presence",e.POSTGRES_CHANGES="postgres_changes",e.SYSTEM="system"})(jo||(jo={}));var cn;(function(e){e.SUBSCRIBED="SUBSCRIBED",e.TIMED_OUT="TIMED_OUT",e.CLOSED="CLOSED",e.CHANNEL_ERROR="CHANNEL_ERROR"})(cn||(cn={}));class Ya{constructor(t,r={config:{}},n){var s,a;if(this.topic=t,this.params=r,this.socket=n,this.bindings={},this.state=tt.closed,this.joinedOnce=!1,this.pushBuffer=[],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.timeout=this.socket.timeout,this.joinPush=new th(this,jr.join,this.params,this.timeout),this.rejoinTimer=new P1(()=>this._rejoinUntilConnected(),this.socket.reconnectAfterMs),this.joinPush.receive("ok",()=>{this.state=tt.joined,this.rejoinTimer.reset(),this.pushBuffer.forEach(o=>o.send()),this.pushBuffer=[]}),this._onClose(()=>{this.rejoinTimer.reset(),this.socket.log("channel",`close ${this.topic} ${this._joinRef()}`),this.state=tt.closed,this.socket._remove(this)}),this._onError(o=>{this._isLeaving()||this._isClosed()||(this.socket.log("channel",`error ${this.topic}`,o),this.state=tt.errored,this.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("timeout",()=>{this._isJoining()&&(this.socket.log("channel",`timeout ${this.topic}`,this.joinPush.timeout),this.state=tt.errored,this.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("error",o=>{this._isLeaving()||this._isClosed()||(this.socket.log("channel",`error ${this.topic}`,o),this.state=tt.errored,this.rejoinTimer.scheduleTimeout())}),this._on(jr.reply,{},(o,l)=>{this._trigger(this._replyEventName(l),o)}),this.presence=new _o(this),this.broadcastEndpointURL=R1(this.socket.endPoint),this.private=this.params.config.private||!1,!this.private&&(!((a=(s=this.params.config)===null||s===void 0?void 0:s.broadcast)===null||a===void 0)&&a.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,a;if(this.socket.isConnected()||this.socket.connect(),this.state==tt.closed){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(f=>f.filter))!==null&&s!==void 0?s:[],d=!!this.bindings[jo.PRESENCE]&&this.bindings[jo.PRESENCE].length>0||((a=this.params.config.presence)===null||a===void 0?void 0:a.enabled)===!0,h={},m={broadcast:o,presence:Object.assign(Object.assign({},l),{enabled:d}),postgres_changes:u,private:c};this.socket.accessTokenValue&&(h.access_token=this.socket.accessTokenValue),this._onError(f=>t==null?void 0:t(cn.CHANNEL_ERROR,f)),this._onClose(()=>t==null?void 0:t(cn.CLOSED)),this.updateJoinPayload(Object.assign({config:m},h)),this.joinedOnce=!0,this._rejoin(r),this.joinPush.receive("ok",async({postgres_changes:f})=>{var b;if(this.socket._isManualToken()||this.socket.setAuth(),f===void 0){t==null||t(cn.SUBSCRIBED);return}else{const g=this.bindings.postgres_changes,v=(b=g==null?void 0:g.length)!==null&&b!==void 0?b:0,x=[];for(let y=0;y<v;y++){const w=g[y],{filter:{event:_,schema:j,table:k,filter:S}}=w,C=f&&f[y];if(C&&C.event===_&&Ya.isFilterValueEqual(C.schema,j)&&Ya.isFilterValueEqual(C.table,k)&&Ya.isFilterValueEqual(C.filter,S))x.push(Object.assign(Object.assign({},w),{id:C.id}));else{this.unsubscribe(),this.state=tt.errored,t==null||t(cn.CHANNEL_ERROR,new Error("mismatch between server and client bindings for postgres changes"));return}}this.bindings.postgres_changes=x,t&&t(cn.SUBSCRIBED);return}}).receive("error",f=>{this.state=tt.errored,t==null||t(cn.CHANNEL_ERROR,new Error(JSON.stringify(Object.values(f).join(", ")||"error")))}).receive("timeout",()=>{t==null||t(cn.TIMED_OUT)})}return this}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){return this.state===tt.joined&&t===jo.PRESENCE&&(this.socket.log("channel",`resubscribe to ${this.topic} due to change in presence callbacks on joined channel`),this.unsubscribe().then(async()=>await this.subscribe())),this._on(t,r,n)}async httpSend(t,r,n={}){var s;if(r==null)return Promise.reject("Payload is required for httpSend()");const a={apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"};this.socket.accessTokenValue&&(a.Authorization=`Bearer ${this.socket.accessTokenValue}`);const o={method:"POST",headers:a,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;
465try{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._canPush()&&t.type==="broadcast"){console.warn("Realtime send() is automatically falling back to REST API. This behavior will be deprecated in the future. Please use httpSend() explicitly for REST delivery.");const{event:a,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:a,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(a=>{var o,l,c;const u=this._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)&&a("ok"),u.receive("ok",()=>a("ok")),u.receive("error",()=>a("error")),u.receive("timeout",()=>a("timed out"))})}updateJoinPayload(t){this.joinPush.updatePayload(t)}unsubscribe(t=this.timeout){this.state=tt.leaving;const r=()=>{this.socket.log("channel",`leave ${this.topic}`),this._trigger(jr.close,"leave",this._joinRef())};this.joinPush.destroy();let n=null;return new Promise(s=>{n=new th(this,jr.leave,{},t),n.receive("ok",()=>{r(),s("ok")}).receive("timeout",()=>{r(),s("timed out")}).receive("error",()=>{s("error")}),n.send(),this._canPush()||n.trigger("ok",{})}).finally(()=>{n==null||n.destroy()})}teardown(){this.pushBuffer.forEach(t=>t.destroy()),this.pushBuffer=[],this.rejoinTimer.reset(),this.joinPush.destroy(),this.state=tt.closed,this.bindings={}}async _fetchWithTimeout(t,r,n){const s=new AbortController,a=setTimeout(()=>s.abort(),n),o=await this.socket.fetch(t,Object.assign(Object.assign({},r),{signal:s.signal}));return clearTimeout(a),o}_push(t,r,n=this.timeout){if(!this.joinedOnce)throw`tried to push '${t}' to '${this.topic}' before joining. Use channel.subscribe() before pushing events`;let s=new th(this,t,r,n);return this._canPush()?s.send():this._addToPushBuffer(s),s}_addToPushBuffer(t){if(t.startTimeout(),this.pushBuffer.push(t),this.pushBuffer.length>nP){const r=this.pushBuffer.shift();r&&(r.destroy(),this.socket.log("channel",`discarded push due to buffer overflow: ${r.event}`,r.payload))}}_onMessage(t,r,n){return r}_isMember(t){return this.topic===t}_joinRef(){return this.joinPush.ref}_trigger(t,r,n){var s,a;const o=t.toLocaleLowerCase(),{close:l,error:c,leave:u,join:d}=jr;if(n&&[l,c,u,d].indexOf(o)>=0&&n!==this._joinRef())return;let m=this._onMessage(o,r,n);if(r&&!m)throw"channel onMessage callbacks must return the payload, modified or unmodified";["insert","update","delete"].includes(o)?(s=this.bindings.postgres_changes)===null||s===void 0||s.filter(f=>{var b,g,v;return((b=f.filter)===null||b===void 0?void 0:b.event)==="*"||((v=(g=f.filter)===null||g===void 0?void 0:g.event)===null||v===void 0?void 0:v.toLocaleLowerCase())===o}).map(f=>f.callback(m,n)):(a=this.bindings[o])===null||a===void 0||a.filter(f=>{var b,g,v,x,y,w;if(["broadcast","presence","postgres_changes"].includes(o))if("id"in f){const _=f.id,j=(b=f.filter)===null||b===void 0?void 0:b.event;return _&&((g=r.ids)===null||g===void 0?void 0:g.includes(_))&&(j==="*"||(j==null?void 0:j.toLocaleLowerCase())===((v=r.data)===null||v===void 0?void 0:v.type.toLocaleLowerCase()))}else{const _=(y=(x=f==null?void 0:f.filter)===null||x===void 0?void 0:x.event)===null||y===void 0?void 0:y.toLocaleLowerCase();return _==="*"||_===((w=r==null?void 0:r.event)===null||w===void 0?void 0:w.toLocaleLowerCase())}else return f.type.toLocaleLowerCase()===o}).map(f=>{if(typeof m=="object"&&"ids"in m){const b=m.data,{schema:g,table:v,commit_timestamp:x,type:y,errors:w}=b;m=Object.assign(Object.assign({},{schema:g,table:v,commit_timestamp:x,eventType:y,new:{},old:{},errors:w}),this._getPayloadRecords(b))}f.callback(m,n)})}_isClosed(){return this.state===tt.closed}_isJoined(){return this.state===tt.joined}_isJoining(){return this.state===tt.joining}_isLeaving(){return this.state===tt.leaving}_replyEventName(t){return`chan_reply_${t}`}_on(t,r,n){const s=t.toLocaleLowerCase(),a={type:s,filter:r,callback:n};return this.bindings[s]?this.bindings[s].push(a):this.bindings[s]=[a],this}_off(t,r){const n=t.toLocaleLowerCase();return this.bindings[n]&&(this.bindings[n]=this.bindings[n].filter(s=>{var a;return!(((a=s.type)===null||a===void 0?void 0:a.toLocaleLowerCase())===n&&Ya.isEqual(s.filter,r))})),this}static isEqual(t,r){if(Object.keys(t).length!==Object.keys(r).length)return!1;for(const n in t)if(t[n]!==r[n])return!1;return!0}static isFilterValueEqual(t,r){return(t??void 0)===(r??void 0)}_rejoinUntilConnected(){this.rejoinTimer.scheduleTimeout(),this.socket.isConnected()&&this._rejoin()}_onClose(t){this._on(jr.close,{},t)}_onError(t){this._on(jr.error,{},r=>t(r))}_canPush(){return this.socket.isConnected()&&this._isJoined()}_rejoin(t=this.timeout){this._isLeaving()||(this.socket._leaveOpenTopic(this.topic),this.state=tt.joining,this.joinPush.resend(t))}_getPayloadRecords(t){const r={new:{},old:{}};return(t.type==="INSERT"||t.type==="UPDATE")&&(r.new=nx(t.columns,t.record)),(t.type==="UPDATE"||t.type==="DELETE")&&(r.old=nx(t.columns,t.old_record)),r}}const rh=()=>{},Gl={HEARTBEAT_INTERVAL:25e3,RECONNECT_DELAY:10,HEARTBEAT_TIMEOUT_FALLBACK:100},dP=[1e3,2e3,5e3,1e4],hP=1e4,fP=` 466 addEventListener("message", (e) => { 467 if (e.data.event === "start") { 468 setInterval(() => postMessage({ event: "keepAlive" }), e.data.interval); 469 } 470 });`;class mP{constructor(t,r){var n;if(this.accessTokenValue=null,this.apiKey=null,this._manuallySetToken=!1,this.channels=new Array,this.endPoint="",this.httpEndpoint="",this.headers={},this.params={},this.timeout=Df,this.transport=null,this.heartbeatIntervalMs=Gl.HEARTBEAT_INTERVAL,this.heartbeatTimer=void 0,this.pendingHeartbeatRef=null,this.heartbeatCallback=rh,this.ref=0,this.reconnectTimer=null,this.vsn=rx,this.logger=rh,this.conn=null,this.sendBuffer=[],this.serializer
470=new sP,this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.accessToken=null,this._connectionState="disconnected",this._wasManualDisconnect=!1,this._authPromise=null,this._heartbeatSentAt=null,this._resolveFetch=s=>s?(...a)=>s(...a):(...a)=>fetch(...a),!(!((n=r==null?void 0:r.params)===null||n===void 0)&&n.apikey))throw new Error("API key is required to connect to Realtime");this.apiKey=r.params.apikey,this.endPoint=`${t}/${Lf.websocket}`,this.httpEndpoint=R1(t),this._initializeOptions(r),this._setupReconnectionTimer(),this.fetch=this._resolveFetch(r==null?void 0:r.fetch)}connect(){if(!(this.isConnecting()||this.isDisconnecting()||this.conn!==null&&this.isConnected())){if(this._setConnectionState("connecting"),this.accessToken&&!this._authPromise&&this._setAuthSafely("connect"),this.transport)this.conn=new this.transport(this.endpointURL());else try{this.conn=Z4.createWebSocket(this.endpointURL())}catch(t){this._setConnectionState("disconnected");const r=t.message;throw r.includes("Node.js")?new Error(`${r} 471 472To use Realtime in Node.js, you need to provide a WebSocket implementation: 473 474Option 1: Use Node.js 22+ which has native WebSocket support 475Option 2: Install and provide the "ws" package: 476 477 npm install ws 478 479 import ws from "ws" 480 const client = new RealtimeClient(url, { 481 ...options, 482 transport: ws 483 })`):new Error(`WebSocket not available: ${r}`)}this._setupConnectionHandlers()}}endpointURL(){return this._appendParams(this.endPoint,Object.assign({},this.params,{vsn:this.vsn}))}disconnect(t,r){if(!this.isDisconnecting())if(this._setConnectionState("disconnecting",!0),this.conn){const n=setTimeout(()=>{this._setConnectionState("disconnected")},100);this.conn.onclose=()=>{clearTimeout(n),this._setConnectionState("disconnected")},typeof this.conn.close=="function"&&(t?this.conn.close(t,r??""):this.conn.close()),this._teardownConnection()}else this._setConnectionState("disconnected")}getChannels(){return this.channels}async removeChannel(t){const r=await t.unsubscribe();return r==="ok"&&this._remove(t),this.channels.length===0&&this.disconnect(),r}async removeAllChannels(){const t=await Promise.all(this.channels.map(r=>r.unsubscribe()));return this.channels=[],this.disconnect(),t}log(t,r,n){this.logger(t,r,n)}connectionState(){switch(this.conn&&this.conn.readyState){case Bn.connecting:return Us.Connecting;case Bn.open:return Us.Open;case Bn.closing:return Us.Closing;default:return Us.Closed}}isConnected(){return this.connectionState()===Us.Open}isConnecting(){return this._connectionState==="connecting"}isDisconnecting(){return this._connectionState==="disconnecting"}channel(t,r={config:{}}){const n=`realtime:${t}`,s=this.getChannels().find(a=>a.topic===n);if(s)return s;{const a=new Ya(`realtime:${t}`,r,this);return this.channels.push(a),a}}push(t){const{topic:r,event:n,payload:s,ref:a}=t,o=()=>{this.encode(t,l=>{var c;(c=this.conn)===null||c===void 0||c.send(l)})};this.log("push",`${r} ${n} (${a})`,s),this.isConnected()?o():this.sendBuffer.push(o)}async setAuth(t=null){this._authPromise=this._performAuth(t);try{await this._authPromise}finally{this._authPromise=null}}_isManualToken(){return this._manuallySetToken}async sendHeartbeat(){var t;if(!this.isConnected()){try{this.heartbeatCallback("disconnected")}catch(r){this.log("error","error in heartbeat callback",r)}return}if(this.pendingHeartbeatRef){this.pendingHeartbeatRef=null,this._heartbeatSentAt=null,this.log("transport","heartbeat timeout. Attempting to re-establish connection");try{this.heartbeatCallback("timeout")}catch(r){this.log("error","error in heartbeat callback",r)}this._wasManualDisconnect=!1,(t=this.conn)===null||t===void 0||t.close(rP,"heartbeat timeout"),setTimeout(()=>{var r;this.isConnected()||(r=this.reconnectTimer)===null||r===void 0||r.sc
vendor: 3,886 bytes, line 483
483heduleTimeout()},Gl.HEARTBEAT_TIMEOUT_FALLBACK);return}this._heartbeatSentAt=Date.now(),this.pendingHeartbeatRef=this._makeRef(),this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:this.pendingHeartbeatRef});try{this.heartbeatCallback("sent")}catch(r){this.log("error","error in heartbeat callback",r)}this._setAuthSafely("heartbeat")}onHeartbeat(t){this.heartbeatCallback=t}flushSendBuffer(){this.isConnected()&&this.sendBuffer.length>0&&(this.sendBuffer.forEach(t=>t()),this.sendBuffer=[])}_makeRef(){let t=this.ref+1;return t===this.ref?this.ref=0:this.ref=t,this.ref.toString()}_leaveOpenTopic(t){let r=this.channels.find(n=>n.topic===t&&(n._isJoined()||n._isJoining()));r&&(this.log("transport",`leaving duplicate topic "${t}"`),r.unsubscribe())}_remove(t){this.channels=this.channels.filter(r=>r.topic!==t.topic)}_onConnMessage(t){this.decode(t.data,r=>{if(r.topic==="phoenix"&&r.event==="phx_reply"&&r.ref&&r.ref===this.pendingHeartbeatRef){const u=this._heartbeatSentAt?Date.now()-this._heartbeatSentAt:void 0;try{this.heartbeatCallback(r.payload.status==="ok"?"ok":"error",u)}catch(d){this.log("error","error in heartbeat callback",d)}this._heartbeatSentAt=null,this.pendingHeartbeatRef=null}const{topic:n,event:s,payload:a,ref:o}=r,l=o?`(${o})`:"",c=a.status||"";this.log("receive",`${c} ${n} ${s} ${l}`.trim(),a),this.channels.filter(u=>u._isMember(n)).forEach(u=>u._trigger(s,a,o)),this._triggerStateCallbacks("message",r)})}_clearTimer(t){var r;t==="heartbeat"&&this.heartbeatTimer?(clearInterval(this.heartbeatTimer),this.heartbeatTimer=void 0):t==="reconnect"&&((r=this.reconnectTimer)===null||r===void 0||r.reset())}_clearAllTimers(){this._clearTimer("heartbeat"),this._clearTimer("reconnect")}_setupConnectionHandlers(){this.conn&&("binaryType"in this.conn&&(this.conn.binaryType="arraybuffer"),this.conn.onopen=()=>this._onConnOpen(),this.conn.onerror=t=>this._onConnError(t),this.conn.onmessage=t=>this._onConnMessage(t),this.conn.onclose=t=>this._onConnClose(t),this.conn.readyState===Bn.open&&this._onConnOpen())}_teardownConnection(){if(this.conn){if(this.conn.readyState===Bn.open||this.conn.readyState===Bn.connecting)try{this.conn.close()}catch(t){this.log("error","Error closing connection",t)}this.conn.onopen=null,this.conn.onerror=null,this.conn.onmessage=null,this.conn.onclose=null,this.conn=null}this._clearAllTimers(),this._terminateWorker(),this.channels.forEach(t=>t.teardown())}_onConnOpen(){this._setConnectionState("connected"),this.log("transport",`connected to ${this.endpointURL()}`),(this._authPromise||(this.accessToken&&!this.accessTokenValue?this.setAuth():Promise.resolve())).then(()=>{this.flushSendBuffer()}).catch(r=>{this.log("error","error waiting for auth on connect",r),this.flushSendBuffer()}),this._clearTimer("reconnect"),this.worker?this.workerRef||this._startWorkerHeartbeat():this._startHeartbeat(),this._triggerStateCallbacks("open")}_startHeartbeat(){this.heartbeatTimer&&clearInterval(this.heartbeatTimer),this.heartbeatTimer=setInterval(()=>this.sendHeartbeat(),this.heartbeatIntervalMs)}_startWorkerHeartbeat(){this.workerUrl?this.log("worker",`starting worker for from ${this.workerUrl}`):this.log("worker","starting default worker");const t=this._workerObjectUrl(this.workerUrl);this.workerRef=new Worker(t),this.workerRef.onerror=r=>{this.log("worker","worker error",r.message),this._terminateWorker()},this.workerRef.onmessage=r=>{r.data.event==="keepAlive"&&this.sendHeartbeat()},this.workerRef.postMessage({event:"start",interval:this.heartbeatIntervalMs})}_terminateWorker(){this.workerRef&&(this.log("worker","terminating worker"),this.workerRef.terminate(),this.workerRef=void 0)}_onConnClose(t){var r;this._setConnectionState("disconnected"),this.log("transport","close",t),this._triggerChanError(),this._clearTimer("heartbeat"),this._wasManualDisconnect||(r=this.reconnectTimer)===null||r===void 0||r.sc
483heduleTimeout(),this._triggerStateCallbacks("close",t)}_onConnError(t){this._setConnectionState("disconnected"),this.log("transport",`${t}`),this._triggerChanError(),this._triggerStateCallbacks("error",t);try{this.heartbeatCallback("error")}catch(r){this.log("error","error in heartbeat callback",r)}}_triggerChanError(){this.channels.forEach(t=>t._trigger(jr.error))}_appendParams(t,r){if(Object.keys(r).length===0)return t;const n=t.match(/\?/)?"&":"?",s=new URLSearchParams(r);return`${t}${n}${s}`}_workerObjectUrl(t){let r;if(t)r=t;else{const n=new Blob([fP],{type:"application/javascript"});r=URL.createObjectURL(n)}return r}_setConnectionState(t,r=!1){this._connectionState=t,t==="connecting"?this._wasManualDisconnect=!1:t==="disconnecting"&&(this._wasManualDisconnect=r)}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 a={access_token:r,version:eP};r&&s.updateJoinPayload(a),s.joinedOnce&&s._isJoined()&&s._push(jr.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)})}_triggerStateCallbacks(t,r){try{this.stateChangeCallbacks[t].forEach(n=>{try{n(r)}catch(s){this.log("error",`error in ${t} callback`,s)}})}catch(n){this.log("error",`error triggering ${t} callbacks`,n)}}_setupReconnectionTimer(){this.reconnectTimer=new P1(async()=>{setTimeout(async()=>{await this._waitForAuthIfNeeded(),this.isConnected()||this.connect()},Gl.RECONNECT_DELAY)},this.reconnectAfterMs)}_initializeOptions(t){var r,n,s,a,o,l,c,u,d,h,m,f;switch(this.transport=(r=t==null?void 0:t.transport)!==null&&r!==void 0?r:null,this.timeout=(n=t==null?void 0:t.timeout)!==null&&n!==void 0?n:Df,this.heartbeatIntervalMs=(s=t==null?void 0:t.heartbeatIntervalMs)!==null&&s!==void 0?s:Gl.HEARTBEAT_INTERVAL,this.worker=(a=t==null?void 0:t.worker)!==null&&a!==void 0?a:!1,this.accessToken=(o=t==null?void 0:t.accessToken)!==null&&o!==void 0?o:null,this.heartbeatCallback=(l=t==null?void 0:t.heartbeatCallback)!==null&&l!==void 0?l:rh,this.vsn=(c=t==null?void 0:t.vsn)!==null&&c!==void 0?c:rx,t!=null&&t.params&&(this.params=t.params),t!=null&&t.logger&&(this.logger=t.logger),(t!=null&&t.logLevel||t!=null&&t.log_level)&&(this.logLevel=t.logLevel||t.log_level,this.params=Object.assign(Object.assign({},this.params),{log_level:this.logLevel})),this.reconnectAfterMs=(u=t==null?void 0:t.reconnectAfterMs)!==null&&u!==void 0?u:b=>dP[b-1]||hP,this.vsn){case tP:this.encode=(d=t==null?void 0:t.encode)!==null&&d!==void 0?d:(b,g)=>g(JSON.stringify(b)),this.decode=(h=t==null?void 0:t.decode)!==null&&h!==void 0?h:(b,g)=>g(JSON.parse(b));break;case T1:this.encode=(m=t==null?void 0:t.encode)!==null&&m!==void 0?m:this.serializer.encode.bind(this.serializer),this.decode=(f=t==null?void 0:t.decode)!==null&&f!==void 0?f:this.serializer.decode.bind(this.serializer);break;default:throw new Error(`Unsupported serializer version: ${this.vsn}`)}if(this.worker){if(typeof window<"u"&&!window.Worker)throw new Error("Web Worker is not supported");this.workerUrl=t==null?void 0:t.workerUrl}}}var Ko=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 pP(e,t,r){const n=new URL(t,e);if(r)for(const[s,a]of Object.entries(r))a!==void 0&&n.searchParams.set(s,a);return n.toString()}async function gP(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 xP(e){const t=e.fetchImpl??globalThis.fetch;return{async request({method:r,path:n,query:s,body:a,headers:o}){const l=pP(e.baseUrl,n,s),c=await gP(e.auth),u=await t(l,{method:r,headers:{...a?{"Content-Type":"application/json"}:{},...c,...o},body:a?JSON.stringify(a):void 0}),d=await u.text(),h=(u.headers.get("content-type")||"").includes("application/json"),m=h&&d?JSON.parse(d):d;if(!u.ok){const f=h?m:void 0,b=f==null?void 0:f.error;throw new Ko((b==null?void 0:b.message)??`Request failed with status ${u.status}`,{status:u.status,icebergType:b==null?void 0:b.type,icebergCode:b==null?void 0:b.code,details:f})}return{status:u.status,headers:u.headers,data:m}}}}function Yl(e){return e.join("�")}var yP=class{constructor(e,t=""){this.client=e,this.prefix=t}async listNamespaces(e){const t=e?{parent:Yl(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/${Yl(e.namespace)}`})}async loadNamespaceMetadata(e){return{properties:(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${Yl(e.namespace)}`})).data.properties}}async namespaceExists(e){try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${Yl(e.namespace)}`}),!0}catch(t){if(t instanceof Ko&&t.status===404)return!1;throw t}}async createNamespaceIfNotExists(e,t){try{return await this.createNamespace(e,t)}catch(r){if(r instanceof Ko&&r.status===409)return;throw r}}};function ba(e){return e.join("�")}var vP=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/${ba(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/${ba(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/${ba(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/${ba(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/${ba(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/${ba(e.namespace)}/tables/${e.name}`,headers:t}),!0}catch(r){if(r instanceof Ko&&r.status===404)return!1;throw r}}async createTableIfNotExists(e,t){try{return await this.createTable(e,t)}catch(r){if(r instanceof Ko&&r.status===409)return await this.loadTable({namespace:e.namespace,name:t.name});throw r}}},wP=class{constructor(e){var n;let t="v1";e.catalogName&&(t+=`/${e.catalogName}`);const r=e.baseUrl.endsWith("/")?e.baseUrl:`${e.baseUrl}/`;this.client=xP({baseUrl:r,auth:e.auth,fetchImpl:e.fetch}),this.accessDelegation=(n=e.accessDelegation)==null?void 0:n.join(","),this.namespaceOps=new yP(this.client,t),this.tableOps=new vP(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)}
483async 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)}},rd=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 nd(e){return typeof e=="object"&&e!==null&&"__isStorageError"in e}var Kl=class extends rd{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}}},O1=class extends rd{constructor(e,t,r="storage"){super(e,r),this.name=r==="vectors"?"StorageVectorsUnknownError":"StorageUnknownError",this.originalError=t}};const bP=e=>e?(...t)=>e(...t):(...t)=>fetch(...t),_P=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)},Ff=e=>{if(Array.isArray(e))return e.map(r=>Ff(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,a=>a.toUpperCase().replace(/[-_]/g,""));t[s]=Ff(n)}),t},jP=e=>!e||typeof e!="string"||e.length===0||e.length>100||e.trim()!==e||e.includes("/")||e.includes("\\")?!1:/^[\w!.\*'() &$@=;:+,?-]+$/.test(e);function Qo(e){"@babel/helpers - typeof";return Qo=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},Qo(e)}function kP(e,t){if(Qo(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(Qo(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function SP(e){var t=kP(e,"string");return Qo(t)=="symbol"?t:t+""}function NP(e,t,r){return(t=SP(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ix(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 oe(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?ix(Object(r),!0).forEach(function(n){NP(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ix(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}const ox=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)},CP=async(e,t,r,n)=>{if(e&&typeof e=="object"&&"status"in e&&"ok"in e&&typeof e.status=="number"&&!(r!=null&&r.noResolveJson)){const s=e,a=s.status||500;if(typeof s.json=="function")s.json().then(o=>{const l=(o==null?void 0:o.statusCode)||(o==null?void 0:o.code)||a+"";t(new Kl(ox(o),a,l,n))}).catch(()=>{if(n==="vectors"){const o=a+"";t(new Kl(s.statusText||`HTTP ${a} error`,a,o,n))}else{const o=a+"";t(new Kl(s.statusText||`HTTP ${a} error`,a,o,n))}});else{const o=a+"";t(new Kl(s.statusText||`HTTP ${a} error`,a,o,n))}}else t(new O1(ox(e),e,n))},EP=(e,t,r,n)=>{const s={method:e,headers:(t==null?void 0:t.headers)||{}};return e==="GET"||e==="HEAD"||!n?oe(oe({},s),r):(_P(n)?(s.headers=oe({"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),oe(oe({},s),r))};async function eo(e,t,r,n,s,a,o){return new Promise((l,c)=>{e(r,EP(t,n,s,a)).then(u=>{if(!u.ok)throw u;if(n!=null&&n.noResolveJson)return u;if(o==="vectors"){const d=u.headers.get("content-type");if(u.headers.get("content-length")==="0"||u.status===204)return{};if(!d||!d.includes("application/json"))return{}}return u.json()}).then(u=>l(u)).catch(u=>CP(u,c,n,o))})}function I1(e="storage"){return{get:async(t,r,n,s)=>eo(t,"GET",r,n,s,void 0,e),post:async(t,r,n,s,a)=>eo(t,"POST",r,s,a,n,e),put:async(t,r,n,s,a)=>eo(t,"PUT",r,s,a,n,e),head:async(t,r,n,s)=>eo(t,"HEAD",r,oe(oe({},n),{},{noResolveJson:!0}),s,void 0,e),remove:async(t,r,n,s,a)=>eo(t,"DELETE",r,s,a,n,e)}}const TP=I1("storage"),{get:Jo,post:vr,put:Uf,head:PP,remove:Op}=TP,zt=I1("vectors");var Fi=class{constructor(e,t={},r,n="storage"){this.shouldThrowOnError=!1,this.url=e,this.headers=t,this.fetch=bP(r),this.namespace=n}throwOnError(){return this.shouldThrowOnError=!0,this}async handleOperation(e){var t=this;try{return{data:await e(),error:null}}catch(r){if(t.shouldThrowOnError)throw r;if(nd(r))return{data:null,error:r};throw r}}},AP=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(nd(t))return{data:null,error:t};throw t}}};let M1;M1=Symbol.toStringTag;var RP=class{constructor(e,t){this.downloadFn=e,this.shouldThrowOnError=t,this[M1]="BlobDownloadBuilder",this.promise=null}asStream(){return new AP(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(nd(t))return{data:null,error:t};throw t}}};const OP={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},lx={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1};var IP=class extends Fi{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 a;const o=oe(oe({},lx),n);let l=oe(oe({},s.headers),e==="POST"&&{"x-upsert":String(o.upsert)});const c=o.metadata;typeof Blob<"u"&&r instanceof Blob?(a=new FormData,a.append("cacheControl",o.cacheControl),c&&a.append("metadata",s.encodeMetadata(c)),a.append("",r)):typeof FormData<"u"&&r instanceof FormData?(a=r,a.has("cacheControl")||a.append("cacheControl",o.cacheControl),c&&!a.has("metadata")&&a.append("metadata",s.encodeMetadata(c))):(a=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"&&a
483instanceof ReadableStream||a&&typeof a=="object"&&"pipe"in a&&typeof a.pipe=="function")&&!o.duplex&&(o.duplex="half")),n!=null&&n.headers&&(l=oe(oe({},l),n.headers));const u=s._removeEmptyFolders(t),d=s._getFinalPath(u),h=await(e=="PUT"?Uf:vr)(s.fetch,`${s.url}/object/${d}`,a,oe({headers:l},o!=null&&o.duplex?{duplex:o.duplex}:{}));return{path:u,id:h.Id,fullPath:h.Key}})}async upload(e,t,r){return this.uploadOrUpdate("POST",e,t,r)}async uploadToSignedUrl(e,t,r,n){var s=this;const a=s._removeEmptyFolders(e),o=s._getFinalPath(a),l=new URL(s.url+`/object/upload/sign/${o}`);return l.searchParams.set("token",t),s.handleOperation(async()=>{let c;const u=oe({upsert:lx.upsert},n),d=oe(oe({},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,d["cache-control"]=`max-age=${u.cacheControl}`,d["content-type"]=u.contentType),{path:a,fullPath:(await Uf(s.fetch,l.toString(),c,{headers:d})).Key}})}async createSignedUploadUrl(e,t){var r=this;return r.handleOperation(async()=>{let n=r._getFinalPath(e);const s=oe({},r.headers);t!=null&&t.upsert&&(s["x-upsert"]="true");const a=await vr(r.fetch,`${r.url}/object/upload/sign/${n}`,{},{headers:s}),o=new URL(r.url+a.url),l=o.searchParams.get("token");if(!l)throw new rd("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 vr(n.fetch,`${n.url}/object/move`,{bucketId:n.bucketId,sourceKey:e,destinationKey:t,de
483stinationBucket:r==null?void 0:r.destinationBucket},{headers:n.headers}))}async copy(e,t,r){var n=this;return n.handleOperation(async()=>({path:(await vr(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),a=await vr(n.fetch,`${n.url}/object/sign/${s}`,oe({expiresIn:t},r!=null&&r.transform?{transform:r.transform}:{}),{headers:n.headers});const o=r!=null&&r.download?`&download=${r.download===!0?"":r.download}`:"";return{signedUrl:encodeURI(`${n.url}${a.signedURL}${o}`)}})}async createSignedUrls(e,t,r){var n=this;return n.handleOperation(async()=>{const s=await vr(n.fetch,`${n.url}/object/sign/${n.bucketId}`,{expiresIn:t,paths:e},{headers:n.headers}),a=r!=null&&r.download?`&download=${r.download===!0?"":r.download}`:"";return s.map(o=>oe(oe({},o),{},{signedUrl:o.signedURL?encodeURI(`${n.url}${o.signedURL}${a}`):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)||{}),a=s?`?${s}`:"",o=this._getFinalPath(e),l=()=>Jo(this.fetch,`${this.url}/${n}/${o}${a}`,{headers:this.headers,noResolveJson:!0},r);return new RP(l,this.shouldThrowOnError)}async info(e){var t=this;const r=t._getFinalPath(e);return t.handleOperation(async()=>Ff(await Jo(t.fetch,`${t.url}/object/info/${r}`,{headers:t.headers})))}async exists(e){var t=this;const r=t._getFinalPath(e);try{return await PP(t.fetch,`${t.url}/object/${r}`,{headers:t.headers}),{data:!0,error:null}}catch(n){if(t.shouldThrowOnError)throw n;if(nd(n)&&n instanceof O1){const s=n.originalError;if([400,404].includes(s==null?void 0:s.status))return{data:!1,error:n}}throw n}}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 a=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}/${a}/public/${r}${l}`)}}}async remove(e){var t=this;return t.handleOperation(async()=>await Op(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=oe(oe(oe({},OP),t),{},{prefix:e||""});return await vr(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=oe({},e);return await vr(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 MP="2.95.3",yl={"X-Client-Info":`storage-js/${MP}`};var DP=class extends Fi{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 a=s.href.replace(/\/$/,""),o=oe(oe({},yl),t);super(a,o,r,"storage")}async listBuckets(e){var t=this;return t.handleOperation(async()=>{const r=t.listBucketOptionsToQueryString(e);return await Jo(t.fetch,`${t.url}/bucket${r}`,{headers:t.headers})})}async getBucket(e){var t=this;return t.handleOperation(async()=>await Jo(t.fetch,`${t.url}/bucket/${e}`,{headers:t.headers}))}async createBucket(e,t={public:!1}){var r=this;return r.handleOperation(async()=>await vr(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 Uf(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 vr(t.fetch,`${t.url}/bucket/${e}/empty`,{},{headers:t.headers}))}async deleteBucket(e){var t=this;return t.handleOperation(async()=>await Op(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():""}},LP=class extends Fi{constructor(e,t={},r){const n=e.replace(/\/$/,""),s=oe(oe({},yl),t);super(n,s,r,"storage")}async createBucket(e){var t=this;return t.handleOperation(async()=>await vr(t.fetch,`${t.url}/bucket`,{name:e},{headers:t.headers}))}async listBuckets(e){var t=this;return t.handleOperation(async()=>
483{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 Jo(t.fetch,s,{headers:t.headers})})}async deleteBucket(e){var t=this;return t.handleOperation(async()=>await Op(t.fetch,`${t.url}/bucket/${e}`,{},{headers:t.headers}))}from(e){var t=this;if(!jP(e))throw new rd("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 wP({baseUrl:this.url,catalogName:e,auth:{type:"custom",getHeaders:async()=>t.headers},fetch:this.fetch}),n=this.shouldThrowOnError;return new Proxy(r,{get(s,a){const o=s[a];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}}}}})}},$P=class extends Fi{constructor(e,t={},r){const n=e.replace(/\/$/,""),s=oe(oe({},yl),{},{"Content-Type":"application/json"},t);super(n,s,r,"vectors")}async createIndex(e){var t=this;return t.handleOperation(async()=>await zt.post(t.fetch,`${t.url}/CreateIndex`,e,{headers:t.headers})||{})}async getIndex(e,t){var r=this;return r.handleOperation(async()=>await zt.post(r.fetch,`${r.url}/GetIndex`,{vectorBucketName:e,indexName:t},{headers:r.headers}))}async listIndexes(e){var t=this;return t.handleOperation(async()=>await zt.post(t.fetch,`${t.url}/ListIndexes`,e,{headers:t.headers}))}async deleteIndex(e,t){var r=this;return r.handleOperation(async()=>await zt.post(r.fetch,`${r.url}/DeleteIndex`,{vectorBucketName:e,indexName:t},{headers:r.headers})||{})}},FP=class extends Fi{constructor(e,t={},r){const n=e.replace(/\/$/,""),s=oe(oe({},yl),{},{"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 zt.post(t.fetch,`${t.url}/PutVectors`,e,{headers:t.headers})||{})}async getVectors(e){var t=this;return t.handleOperation(async()=>await zt.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 zt.post(t.fetch,`${t.url}/ListVectors`,e,{headers:t.headers}))}async queryVectors(e){var t=this;return t.handleOperation(async()=>await zt.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 zt.post(t.fetch,`${t.url}/DeleteVectors`,e,{headers:t.headers})||{})}},UP=class extends Fi{constructor(e,t={},r){const n=e.replace(/\/$/,""),s=oe(oe({},yl),{},{"Content-Type":"application/json"},t);super(n,s,r,"vectors")}async createBucket(e){var t=this;return t.handleOperation(async()=>await zt.post(t.fetch,`${t.url}/CreateVectorBucket`,{vectorBucketName:e},{headers:t.headers})||{})}async getBucket(e){var t=this;return t.handleOperation(async()=>await zt.post(t.fetch,`${t.url}/GetVectorBucket`,{vectorBucketName:e},{headers:t.headers}))}async listBuckets(e={}){var t=this;return t.handleOperation(async()=>await zt.post(t.fetch,`${t.url}/ListVectorBuckets`,e,{headers:t.headers}))}async deleteBucket(e){var t=this;return t.handleOperation(async()=>await zt.post(t.fetch,`${t.url}/DeleteVectorBucket`,{vectorBucketName:e},{headers:t.headers})||{})}},qP=class extends UP{constructor(e,t={}){super(e,t.headers||{},t.fetch)}from(e){return new zP(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)}},zP=class extends $P{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,oe(oe({},e),{},{vectorBucketName:r.vectorBucketName}))}
483async listIndexes(e={}){var t=()=>super.listIndexes,r=this;return t().call(r,oe(oe({},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 BP(this.url,this.headers,this.vectorBucketName,e,this.fetch)}},BP=class extends FP{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,oe(oe({},e),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async getVectors(e){var t=()=>super.getVectors,r=this;return t().call(r,oe(oe({},e),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async listVectors(e={}){var t=()=>super.listVectors,r=this;return t().call(r,oe(oe({},e),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async queryVectors(e){var t=()=>super.queryVectors,r=this;return t().call(r,oe(oe({},e),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async deleteVectors(e){var t=()=>super.deleteVectors,r=this;return t().call(r,oe(oe({},e),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}},WP=class extends DP{constructor(e,t={},r,n){super(e,t,r,n)}from(e){return new IP(this.url,this.headers,e,this.fetch)}get vectors(){return new qP(this.url+"/vector",{headers:this.headers,fetch:this.fetch})}get analytics(){return new LP(this.url+"/iceberg",this.headers,this.fetch)}};const D1="2.95.3",Oa=30*1e3,qf=3,nh=qf*Oa,HP="http://localhost:9999",VP="supabase.auth.token",GP={"X-Client-Info":`gotrue-js/${D1}`},zf="X-Supabase-Api-Version",L1={"2024-01-01":{timestamp:Date.parse("2024-01-01T00:00:00.0Z"),name:"2024-01-01"}},YP=/^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}$|[a-z0-9_-]{2}$)$/i,KP=10*60*1e3;class Zo extends Error{constructor(t,r,n){super(t),this.__isAuthError=!0,this.name="AuthError",this.status=r,this.code=n}}function ee(e){return typeof e=="object"&&e!==null&&"__isAuthError"in e}class QP extends Zo{constructor(t,r,n){super(t,r,n),this.name="AuthApiError",this.status=r,this.code=n}}function JP(e){return ee(e)&&e.name==="AuthApiError"}class qs extends Zo{constructor(t,r){super(t),this.name="AuthUnknownError",this.originalError=r}}class Tn extends Zo{constructor(t,r,n,s){super(t,n,s),this.name=r,this.status=n}}class Ft extends Tn{constructor(){super("Auth session missing!","AuthSessionMissingError",400,void 0)}}function sh(e){return ee(e)&&e.name==="AuthSessionMissingError"}class _a extends Tn{constructor(){super("Auth session or user missing","AuthInvalidToken
483ResponseError",500,void 0)}}class Ql extends Tn{constructor(t){super(t,"AuthInvalidCredentialsError",400,void 0)}}class Jl extends Tn{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 ZP(e){return ee(e)&&e.name==="AuthImplicitGrantRedirectError"}class cx extends Tn{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 XP extends Tn{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 Bf extends Tn{constructor(t,r){super(t,"AuthRetryableFetchError",r,void 0)}}function ah(e){return ee(e)&&e.name==="AuthRetryableFetchError"}class ux extends Tn{constructor(t,r,n){super(t,"AuthWeakPasswordError",r,"weak_password"),this.reasons=n}}class Wf extends Tn{constructor(t){super(t,"AuthInvalidJwtError",400,"invalid_jwt")}}const uu="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".split(""),dx=` 484\r=`.split(""),eA=(()=>{const e=new Array(128);for(let t=0;t<e.length;t+=1)e[t]=-1;for(let t=0;t<dx.length;t+=1)e[dx[t].charCodeAt(0)]=-2;for(let t=0;t<uu.length;t+=1)e[uu[t].charCodeAt(0)]=t;return e})();function hx(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(uu[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(uu[n]),t.queuedBits-=6}}function $1(e,t,r){const n=eA[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 fx(e){const t=[],r=o=>{t.push(String.fromCodePoint(o))},n={utf8seq:0,codepoint:0},s={queue:0,queuedBits:0},a=o=>{nA(o,n,r)};for(let o=0;o<e.length;o+=1)$1(e.charCodeAt(o),s,a);return t.join("")}function tA(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 rA(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}tA(n,t)}}function nA(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 ni(e){const t=[],r={queue:0,queuedBits:0},n=s=>{t.push(s)};for(let s=0;s<e.length;s+=1)$1(e.charCodeAt(s),r,n);return new Uint8Array(t)}function sA(e){const t=[];return rA(e,r=>t.push(r)),new Uint8Array(t)}function Hs(e){const t=[],r={queue:0,queuedBits:0},n=s=>{t.push(s)};return e.forEach(s=>hx(s,r,n)),hx(null,r,n),t.join("")}function aA(e){return Math.round(Date.now()/1e3)+e}function iA(){return Symbol("auth-callback")}const ct=()=>typeof window<"u"&&typeof document<"u",Is={tested:!1,writable:!1},F1=()=>{if(!ct())return!1;try{if(typeof globalThis.localStorage!="object")return!1}catch{return!1}if(Is.tested)return Is.writable;const e=`lswt-${Math.random()}${Math.random()}`;try{globalThis.localStorage.setItem(e,e),globalThis.localStorage.removeItem(e),Is.tested=!0,Is.writable=!0}catch{Is.tested=!0,Is.writable=!1}return Is.writable};function oA(e){const t={},r=new URL(e);if(r.hash&&r.hash[0]==="#")try{new URLSearchParams(r.hash.substring(1)).forEac
484h((s,a)=>{t[a]=s})}catch{}return r.searchParams.forEach((n,s)=>{t[s]=n}),t}const U1=e=>e?(...t)=>e(...t):(...t)=>fetch(...t),lA=e=>typeof e=="object"&&e!==null&&"status"in e&&"ok"in e&&"json"in e&&typeof e.json=="function",Ia=async(e,t,r)=>{await e.setItem(t,JSON.stringify(r))},Ms=async(e,t)=>{const r=await e.getItem(t);if(!r)return null;try{return JSON.parse(r)}catch{return r}},lt=async(e,t)=>{await e.removeItem(t)};class sd{constructor(){this.promise=new sd.promiseConstructor((t,r)=>{this.resolve=t,this.reject=r})}}sd.promiseConstructor=Promise;function Zl(e){const t=e.split(".");if(t.length!==3)throw new Wf("Invalid JWT structure");for(let n=0;n<t.length;n++)if(!YP.test(t[n]))throw new Wf("JWT not in base64url format");return{header:JSON.parse(fx(t[0])),payload:JSON.parse(fx(t[1])),signature:ni(t[2]),raw:{header:t[0],payload:t[1]}}}async function cA(e){return await new Promise(t=>{setTimeout(()=>t(null),e)})}function uA(e,t){return new Promise((n,s)=>{(async()=>{for(let a=0;a<1/0;a++)try{const o=await e(a);if(!t(a,null,o)){n(o);return}}catch(o){if(!t(a,o)){s(o);return}}})()})}function dA(e){return("0"+e.toString(16)).substr(-2)}function hA(){const t=new Uint32Array(56);if(typeof crypto>"u"){const r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~",n=r.length;let s="";for(let a=0;a<56;a++)s+=r.charAt(Math.floor(Math.random()*n));return s}return crypto.getRandomValues(t),Array.from(t,dA).join("")}async function fA(e){const r=new TextEncoder().encode(e),n=await crypto.subtle.digest("SHA-256",r),s=new Uint8Array(n);return Array.from(s).map(a=>String.fromCharCode(a)).join("")}async function mA(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 fA(e);return btoa(r).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function ja(e,t,r=!1){const n=hA();let s=n;r&&(s+="/PASSWORD_RECOVERY"),await Ia(e,`${t}-code-verifier`,s);const a=await mA(n);return[a,n===a?"plain":"s256"]}const pA=/^2[0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|1[0-9]|2[0-9]|3[0-1])$/i;function gA(e){const t=e.headers.get(zf);if(!t||!t.match(pA))return null;try{return new Date(`${t}T00:00:00.0Z`)}catch{return null}}function xA(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 yA(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 vA=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;function ka(e){if(!vA.test(e))throw new Error("@supabase/auth-js: Expected parameter to be UUID but is not")}function ih(){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 wA(e,t){return new Proxy(e,{get:(r,n,s)=>{if(n==="__isInsecureUserWarningProxy")return!0;if(typeof n=="symbol"){const a=n.toString();if(a==="Symbol(Symbol.toPrimitive)"||a==="Symbol(Symbol.toStringTag)"||a==="Symbol(util.inspect.custom)"||a==="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 mx(e){return JSON.parse(JSON.stringify(e))}const $s=e=>e.msg||e.message||e.error_description||e.error||JSON.stringify(e),bA=[502,503,504];async function px(e){var t;if(!lA(e))throw new Bf($s(e),0);if(bA.includes(e.status))throw new Bf($s(e),e.status);let r;try{r=await e.json()}catch(a){throw new qs($s(a),a)}let n;const s=gA(e);if(s&&s.getTime()>=L1["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 ux($s(r),e.status,((t=r.weak_password)===null||t===void 0?void 0:t.reasons)||[]);if(n==="session_not_found")throw new Ft}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((a,o)=>
484a&&typeof o=="string",!0))throw new ux($s(r),e.status,r.weak_password.reasons);throw new QP($s(r),e.status||500,n)}const _A=(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 ie(e,t,r,n){var s;const a=Object.assign({},n==null?void 0:n.headers);a[zf]||(a[zf]=L1["2024-01-01"].name),n!=null&&n.jwt&&(a.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 jA(e,t,r+l,{headers:a,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 jA(e,t,r,n,s,a){const o=_A(t,n,s,a);let l;try{l=await e(r,Object.assign({},o))}catch(c){throw console.error(c),new Bf($s(c),0)}if(l.ok||await px(l),n!=null&&n.noResolveJson)return l;try{return await l.json()}catch(c){await px(c)}}function pr(e){var t;let r=null;NA(e)&&(r=Object.assign({},e),e.expires_at||(r.expires_at=aA(e.expires_in)));const n=(t=e.user)!==null&&t!==void 0?t:e;return{data:{session:r,user:n},error:null}}function gx(e){const t=pr(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 Gn(e){var t;return{data:{user:(t=e.user)!==null&&t!==void 0?t:e},error:null}}function kA(e){return{data:e,error:null}}function SA(e){const{action_link:t,email_otp:r,hashed_token:n,redirect_to:s,verification_type:a}=e,o=$i(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:a},c=Object.assign({},o);return{data:{properties:l,user:c},error:null}}function xx(e){return e}function NA(e){return e.access_token&&e.refresh_token&&e.expires_in}const oh=["global","local","others"];class CA{constructor({url:t="",headers:r={},fetch:n}){this.url=t,this.headers=r,this.fetch=U1(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)}}async signOut(t,r=oh[0]){if(oh.indexOf(r)<0)throw new Error(`@supabase/auth-js: Parameter scope must be one of ${oh.join(", ")}`);try{return await ie(this.fetch,"POST",`${this.url}/logout?scope=${r}`,{headers:this.headers,jwt:t,noResolveJson:!0}),{data:null,error:null}}catch(n){if(ee(n))return{data:null,error:n};throw n}}async inviteUserByEmail(t,r={}){try{return await ie(this.fetch,"POST",`${this.url}/invite`,{body:{email:t,data:r.data},headers:this.headers,redirectTo:r.redirectTo,xform:Gn})}catch(n){if(ee(n))return{data:{user:null},error:n};throw n}}async generateLink(t){try{const{options:r}=t,n=$i(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 ie(this.fetch,"POST",`${this.url}/admin/generate_link`,{body:s,headers:this.headers,xform:SA,redirectTo:r==null?void 0:r.redirectTo})}catch(r){if(ee(r))return{data:{properties:null,user:null},error:r};throw r}}async createUser(t){try{return await ie(this.fetch,"POST",`${this.url}/admin/users`,{body:t,headers:this.headers,xform:Gn})}catch(r){if(ee(r))return{data:{user:null},error:r};throw r}}async listUsers(t){var r,n,s,a,o,l,c;try{const u={nextPage:null,lastPage:0,total:0},d=await ie(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:(a=(s=t==null?void 0:t.perPage)===null||s===void 0?void 0:s.toString())!==null&&a!==void 0?a:""},xform:xx});if(d.error)throw d.error;const h=await d.json(),m=(o=d.headers.get("x-total-count"))!==null&&o!==void 0?o:0,f=(c=(l=d.headers.get("link"))===null||l===void 0?void 0:l.split(","))!==null&&c!==void 0?c:[];return f.length>0&&(f.forEach(b=>{const g=parseInt(b.split(";")[0].split("=")[1].substring(0,1)),v=JSON.parse(b.split(";")[1].split("=")[1]);u[`${v}Page`]=g}),u.total=parseInt(m)),{data:Object.assign(Object.assign({},h),u),error:null}}catch(u){if(ee(u))return{data:{users:[]},error:u};throw u}}async getUserById(t){ka(t);try{return await ie(this.fetch,"GET",`${this.url}/admin/users/${t}`,{headers:this.headers,xform:Gn})}catch(r){if(ee(r))return{data:{user:null},error:r};throw r}}async updateUserById(t,r){ka(t);try{return await ie(this.fetch,"PUT",`${this.url}/admin/users/${t}`,{body:r,headers:this.headers,xform:Gn})}catch(n){if(ee(n))return{data:{user:null},error:n};throw n}}async deleteUser(t,r=!1){ka(t);
484try{return await ie(this.fetch,"DELETE",`${this.url}/admin/users/${t}`,{headers:this.headers,body:{should_soft_delete:r},xform:Gn})}catch(n){if(ee(n))return{data:{user:null},error:n};throw n}}async _listFactors(t){ka(t.userId);try{const{data:r,error:n}=await ie(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(ee(r))return{data:null,error:r};throw r}}async _deleteFactor(t){ka(t.userId),ka(t.id);try{return{data:await ie(this.fetch,"DELETE",`${this.url}/admin/users/${t.userId}/factors/${t.id}`,{headers:this.headers}),error:null}}catch(r){if(ee(r))return{data:null,error:r};throw r}}async _listOAuthClients(t){var r,n,s,a,o,l,c;try{const u={nextPage:null,lastPage:0,total:0},d=await ie(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:(a=(s=t==null?void 0:t.perPage)===null||s===void 0?void 0:s.toString())!==null&&a!==void 0?a:""},xform:xx});if(d.error)throw d.error;const h=await d.json(),m=(o=d.headers.get("x-total-count"))!==null&&o!==void 0?o:0,f=(c=(l=d.headers.get("link"))===null||l===void 0?void 0:l.split(","))!==null&&c!==void 0?c:[];return f.length>0&&(f.forEach(b=>{const g=parseInt(b.split(";")[0].split("=")[1].substring(0,1)),v=JSON.parse(b.split(";")[1].split("=")[1]);u[`${v}Page`]=g}),u.total=parseInt(m)),{data:Object.assign(Object.assign({},h),u),error:null}}catch(u){if(ee(u))return{data:{clients:[]},error:u};throw u}}async _createOAuthClient(t){try{return await ie(this.fetch,"POST",`${this.url}/admin/oauth/clients`,{body:t,headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(ee(r))return{data:null,error:r};throw r}}async _getOAuthClient(t){try{return await ie(this.fetch,"GET",`${this.url}/admin/oauth/clients/${t}`,{headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(ee(r))return{data:null,error:r};throw r}}async _updateOAuthClient(t,r){try{return await ie(this.fetch,"PUT",`${this.url}/admin/oauth/clients/${t}`,{body:r,headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(ee(n))return{data:null,error:n};throw n}}async _deleteOAuthClient(t){try{return await ie(this.fetch,"DELETE",`${this.url}/admin/oauth/clients/${t}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(r){if(ee(r))return{data:null,error:r};throw r}}async _regenerateOAuthClientSecret(t){try{return await ie(this.fetch,"POST",`${this.url}/admin/oauth/clients/${t}/regenerate_secret`,{headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(ee(r))return{data:null,error:r};throw r}}}function yx(e={}){return{getItem:t=>e[t]||null,setItem:(t,r)=>{e[t]=r},removeItem:t=>{delete e[t]}}}const Sa={debug:!!(globalThis&&F1()&&globalThis.localStorage&&globalThis.localStorage.getItem("supabase.gotrue-js.locks.debug")==="true")};class q1 extends Error{constructor(t){super(t),this.isAcquireTimeout=!0}}class EA extends q1{}async function TA(e,t,r){Sa.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquire lock",e,t);const n=new globalThis.AbortController;return t>0&&setTimeout(()=>{n.abort(),Sa.debug&&console.log("@supabase/gotrue-js: navigatorLock acquire timed out",e)},t),await Promise.resolve().then(()=>globalThis.navigator.locks.request(e,t===0?{mode:"exclusive",ifAvailable:!0}:{mode:"exclusive",signal:n.signal},async s=>{if(s){Sa.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquired",e,s.name);try{return await r()}finally{Sa.debug&&console.log("@supabase/gotrue-js: navigatorLock: released",e,s.name)}}else{if(t===0)throw Sa.debug&&console.log("@supabase/gotrue-js: navigatorLock: not immediately available",e),new EA(`Acquiring an exclusive Navigator LockManager lock "${e}" immediately failed`);if(Sa.debug)try{const a=await globalThis.navigator.locks.query();console.log("@supabase/gotrue-js: Navigator LockManager state",JSON.stringify(a,null," "))}catch(a){console.warn("@supabase/gotrue-js: Error when querying Navigator LockManager state",a)}return console.warn("@supabase/gotrue-js: Navigator LockManager returned a null lock when using #request without ifAvailable set to true, it appears this browser is not following the LockManager spec https://developer.mozilla.org/en-US/docs/Web/API/LockManager/request"),await r()}}))}function PA(){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 z1(e){if(!/^0x[a-fA-F0-9]{40}$/.test(e))throw new Error(`@supabase/auth-js: Address "${e}
484" is invalid.`);return e.toLowerCase()}function AA(e){return parseInt(e,16)}function RA(e){const t=new TextEncoder().encode(e);return"0x"+Array.from(t,n=>n.toString(16).padStart(2,"0")).join("")}function OA(e){var t;const{chainId:r,domain:n,expirationTime:s,issuedAt:a=new Date,nonce:o,notBefore:l,requestId:c,resources:u,scheme:d,uri:h,version:m}=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(!h)throw new Error('@supabase/auth-js: Invalid SIWE message field "uri". URI must be provided.');if(m!=="1")throw new Error(`@supabase/auth-js: Invalid SIWE message field "version". Version must be '1'. Provided value: ${m}`);if(!((t=e.statement)===null||t===void 0)&&t.includes(` 485`))throw new Error(`@supabase/auth-js: Invalid SIWE message field "statement". Statement must not include '\\n'. Provided value: ${e.statement}`)}const f=z1(e.address),b=d?`${d}://${n}`:n,g=e.statement?`${e.statement} 486`:"",v=`${b} wants you to sign in with your Ethereum account: 487${f} 488 489${g}`;let x=`URI: ${h} 490Version: ${m} 491Chain ID: ${r}${o?` 492Nonce: ${o}`:""} 493Issued At: ${a.toISOString()}`;if(s&&(x+=` 494Expiration Time: ${s.toISOString()}`),l&&(x+=` 495Not Before: ${l.toISOString()}`),c&&(x+=` 496Request ID: ${c}`),u){let y=` 497Resources:`;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}`);y+=` 498- ${w}`}x+=y}return`${v} 499${x}`}class Ze extends Error{constructor({message:t,code:r,cause:n,name:s}){var a;super(t,{cause:n}),this.__isWebAuthnError=!0,this.name=(a=s??(n instanceof Error?n.name:void 0))!==null&&a!==void 0?a:"Unknown Error",this.code=r}}class du extends Ze{constructor(t,r){super({code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:r,message:t}),this.name="WebAuthnUnknownError",this.originalError=r}}function IA({error:e,options:t}){var r,n,s;const{publicKey:a}=t;if(!a)throw Error("options was missing required publicKey property");if(e.name==="AbortError"){if(t.signal instanceof AbortSignal)return new Ze({message:"Registration ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:e})}else if(e.name==="ConstraintError"){if(((r=a.authenticatorSelection)===null||r===void 0?void 0:r.requireResidentKey)===!0)return new Ze({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=a.authenticatorSelection)===null||n===void 0?void 0:n.userVerification)==="required")return new Ze({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=a.authenticatorSelection)===null||s===void 0?void 0:s.userVerification)==="required")return new Ze({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 Ze({message:"The authenticator was previously registered",code:"ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED",cause:e});if(e.name==="NotAllowedError")return new Ze({message:e.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e});if(e.name==="NotSupportedError")return a.pubKeyCredParams.filter(l=>l.type==="public-key").length===0?new Ze({message:'No entry in pubKeyCredParams was of type "public-key"',code:"ERROR_MALFORMED_PUBKEYCREDPARAMS",cause:e}):new Ze({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(B1(o)){if(a.rp.id!==o)return new Ze({message:`The RP ID "${a.rp.id}
499" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:e})}else return new Ze({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:e})}else if(e.name==="TypeError"){if(a.user.id.byteLength<1||a.user.id.byteLength>64)return new Ze({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 Ze({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 Ze({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e})}function MA({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 Ze({message:"Authentication ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:e})}else{if(e.name==="NotAllowedError")return new Ze({message:e.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e});if(e.name==="SecurityError"){const n=window.location.hostname;if(B1(n)){if(r.rpId!==n)return new Ze({message:`The RP ID "${r.rpId}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:e})}else return new Ze({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:e})}else if(e.name==="UnknownError")return new Ze({message:"The authenticator was unable to process the specified options, or could not create a new assertion signature",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:e})}return new Ze({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e})}class DA{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 LA=new DA;function $A(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=$i(e,["challenge","user","excludeCredentials"]),a=ni(t).buffer,o=Object.assign(Object.assign({},r),{id:ni(r.id).buffer}),l=Object.assign(Object.assign({},s),{challenge:a,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:ni(u.id).buffer,type:u.type||"public-key",transports:u.transports})}}return l}function FA(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=$i(e,["challenge","allowCredentials"]),s=ni(t).buffer,a=Object.assign(Object.assign({},n),{challenge:s});if(r&&r.length>0){a.allowCredentials=new Array(r.length);for(let o=0;o<r.length;o++){const l=r[o];a.allowCredentials[o]=Object.assign(Object.assign({},l),{id:ni(l.id).buffer,type:l.type||"public-key",transports:l.transports})}}return a}function UA(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:Hs(new Uint8Array(e.response.attestationObject)),clientDataJSON:Hs(new Uint8Array(e.response.clientDataJSON))},type:"public-key",clientExtensionResults:e.getClientExtensionResults(),authenticatorAttachment:(t=r.authenticatorAttachment)!==null&&t!==void 0?t:void 0}}function qA(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:Hs(new Uint8Array(s.authenticatorData)),clientDataJSON:Hs(new Uint8Array(s.clientDataJSON)),signature:Hs(new Uint8Array(s.signature)),userHandle:s.userHandle?Hs(new Uint8Array(s.userHandle)):void 0},type:"public-key",clientExtensionResults:n,authenticatorAttachment:(t=r.authenticatorAttachment)!==null&&t!==void 0?t:void 0}}function B1(e){return e==="localhost"||/^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/i.test(e)}function vx(){var e,t;return!!(ct()&&"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 zA(e){try{const t=await navigator.credentials.create(e);return t?t instanceof PublicKeyCredential?{data:t,error:null}:{data:null,error:new du("Browser returned unexpected credential type",t)}:{data:null,error:new du("Empty credential response",t)}}
499catch(t){return{data:null,error:IA({error:t,options:e})}}}async function BA(e){try{const t=await navigator.credentials.get(e);return t?t instanceof PublicKeyCredential?{data:t,error:null}:{data:null,error:new du("Browser returned unexpected credential type",t)}:{data:null,error:new du("Empty credential response",t)}}catch(t){return{data:null,error:MA({error:t,options:e})}}}const WA={hints:["security-key"],authenticatorSelection:{authenticatorAttachment:"cross-platform",requireResidentKey:!1,userVerification:"preferred",residentKey:"discouraged"},attestation:"direct"},HA={userVerification:"preferred",hints:["security-key"],attestation:"direct"};function hu(...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 a in s){const o=s[a];if(o!==void 0)if(Array.isArray(o))n[a]=o;else if(r(o))n[a]=o;else if(t(o)){const l=n[a];t(l)?n[a]=hu(l,o):n[a]=hu(o)}else n[a]=o}return n}function VA(e,t){return hu(WA,e,t||{})}function GA(e,t){return hu(HA,e,t||{})}class YA{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},a){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??LA.createNewAbortSignal();if(l.webauthn.type==="create"){const{user:d}=l.webauthn.credential_options.publicKey;if(!d.name){const h=n;if(h)d.name=`${d.id}:${h}`;else{const f=(await this.client.getUser()).data.user,b=((o=f==null?void 0:f.user_metadata)===null||o===void 0?void 0:o.name)||(f==null?void 0:f.email)||(f==null?void 0:f.id)||"User";d.name=`${d.id}:${b}`}}d.displayName||(d.displayName=d.name)}switch(l.webauthn.type){case"create":{const d=VA(l.webauthn.credential_options.publicKey,a==null?void 0:a.create),{data:h,error:m}=await zA({publicKey:d,signal:u});return h?{data:{factorId:t,challengeId:l.id,webauthn:{type:l.webauthn.type,credential_response:h}},error:null}:{data:null,error:m}}case"request":{const d=GA(l.webauthn.credential_options.publicKey,a==null?void 0:a.request),{data:h,error:m}=await BA(Object.assign(Object.assign({},l.webauthn.credential_options),{publicKey:d,signal:u}));return h?{data:{factorId:t,challengeId:l.id,webauthn:{type:l.webauthn.type,credential_response:h}},error:null}:{data:null,error:m}}}}catch(l){return ee(l)?{data:null,error:l}:{data:null,error:new qs("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}={}},a){if(!r)return{data:null,error:new Zo("rpId is required for WebAuthn authentication")};try{if(!vx())return{data:null,error:new qs("Browser does not support WebAuthn",null)};const{data:o,error:l}=await this.challenge({factorId:t,webauthn:{rpId:r,rpOrigins:n},signal:s},{request:a});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 ee(o)?{data:null,error:o}:{data:null,error:new qs("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}={}},a){if(!r)return{data:null,error:new Zo("rpId is required for WebAuthn registration")};try{if(!vx())return{data:null,error:new qs("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(d=>{var h;
499return(h=d.data)===null||h===void 0?void 0:h.all.find(m=>m.factor_type==="webauthn"&&m.friendly_name===t&&m.status!=="unverified")}).then(d=>d?this.client.mfa.unenroll({factorId:d==null?void 0:d.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:a});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 ee(o)?{data:null,error:o}:{data:null,error:new qs("Unexpected error in register",o)}}}}PA();const KA={url:HP,storageKey:VP,autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:GP,flowType:"implicit",debug:!1,hasCustomAuthorizationHeader:!1,throwOnError:!1,lockAcquireTimeout:1e4};async function wx(e,t,r){return await r()}const Na={};class Xo{get jwks(){var t,r;return(r=(t=Na[this.storageKey])===null||t===void 0?void 0:t.jwks)!==null&&r!==void 0?r:{keys:[]}}set jwks(t){Na[this.storageKey]=Object.assign(Object.assign({},Na[this.storageKey]),{jwks:t})}get jwks_cached_at(){var t,r;return(r=(t=Na[this.storageKey])===null||t===void 0?void 0:t.cachedAt)!==null&&r!==void 0?r:Number.MIN_SAFE_INTEGER}set jwks_cached_at(t){Na[this.storageKey]=Object.assign(Object.assign({},Na[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 a=Object.assign(Object.assign({},KA),t);if(this.storageKey=a.storageKey,this.instanceID=(r=Xo.nextInstanceID[this.storageKey])!==null&&r!==void 0?r:0,Xo.nextInstanceID[this.storageKey]=this.instanceID+1,this.logDebugMessages=!!a.debug,typeof a.debug=="function"&&(this.logger=a.debug),this.instanceID>0&&ct()){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=a.persistSession,this.autoRefreshToken=a.autoRefreshToken,this.admin=new CA({url:a.url,headers:a.headers,fetch:a.fetch}),this.url=a.url,this.headers=a.headers,this.fetch=U1(a.fetch),this.lock=a.lock||wx,this.detectSessionInUrl=a.detectSessionInUrl,this.flowType=a.flowType,this.hasCustomAuthorizationHeader=a.hasCustomAuthorizationHeader,this.throwOnError=a.throwOnError,this.lockAcquireTimeout=a.lockAcquireTimeout,a.lock?this.lock=a.lock:this.persistSession&&ct()&&(!((n=globalThis==null?void 0:globalThis.navigator)===null||n===void 0)&&n.locks)?this.lock=TA:this.lock=wx,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 YA(this)},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?(a.storage?this.storage=a.storage:F1()?this.storage=globalThis.localStorage:(this.memoryStorage={},this.storage=yx(this.memoryStorage)),a.userStorage&&(this.userStorage=a.userStorage)):(this.memoryStorage={},this.storage=yx(this.memoryStorage)),ct()&&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)}})}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} (${D1}
499) ${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(ct()&&(r=oA(window.location.href),this._isImplicitGrantCallback(r)?n="implicit":await this._isPKCECallback(r)&&(n="pkce")),ct()&&this.detectSessionInUrl&&n!=="none"){const{data:s,error:a}=await this._getSessionFromURL(r,n);if(a){if(this._debug("#_initialize()","error detecting session from URL",a),ZP(a)){const c=(t=a.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:a}}return{error:a}}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 ee(r)?this._returnResult({error:r}):this._returnResult({error:new qs("Unexpected error during initialization",r)})}finally{await this._handleVisibilityChange(),this._debug("#_initialize()","end")}}async signInAnonymously(t){var r,n,s;try{const a=await ie(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:pr}),{data:o,error:l}=a;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(a){if(ee(a))return this._returnResult({data:{user:null,session:null},error:a});throw a}}async signUp(t){var r,n,s;try{let a;if("email"in t){const{email:d,password:h,options:m}=t;let f=null,b=null;this.flowType==="pkce"&&([f,b]=await ja(this.storage,this.storageKey)),a=await ie(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,redirectTo:m==null?void 0:m.emailRedirectTo,body:{email:d,password:h,data:(r=m==null?void 0:m.data)!==null&&r!==void 0?r:{},gotrue_meta_security:{captcha_token:m==null?void 0:m.captchaToken},code_challenge:f,code_challenge_method:b},xform:pr})}else if("phone"in t){const{phone:d,password:h,options:m}=t;a=await ie(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{phone:d,password:h,data:(n=m==null?void 0:m.data)!==null&&n!==void 0?n:{},channel:(s=m==null?void 0:m.channel)!==null&&s!==void 0?s:"sms",gotrue_meta_security:{captcha_token:m==null?void 0:m.captchaToken}},xform:pr})}else throw new Ql("You must provide either an email or phone number and a password");const{data:o,error:l}=a;if(l||!o)return await lt(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(a){if(await lt(this.storage,`${this.storageKey}-code-verifier`),ee(a))return this._returnResult({data:{user:null,session:null},error:a});throw a}}async signInWithPassword(t){try{let r;if("email"in t){const{email:a,password:o,options:l}=t;r=await ie(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{email:a,password:o,gotrue_meta_security:{captcha_token:l==null?void 0:l.captchaToken}},xform:gx})}else if("phone"in t){const{phone:a,password:o,options:l}=t;r=await ie(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{phone:a,password:o,gotrue_meta_security:{captcha_token:l==null?void 0:l.captchaToken}},xform:gx})}else throw new Ql("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 a=new _a;return this._returnResult({data:{user:null,session:null},error:a})}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(ee(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}}async signInWithOAuth(t){var r,n,s,a;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:(a=t.o
499ptions)===null||a===void 0?void 0:a.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,a,o,l,c,u,d,h,m;let f,b;if("message"in t)f=t.message,b=t.signature;else{const{chain:g,wallet:v,statement:x,options:y}=t;let w;if(ct())if(typeof v=="object")w=v;else{const P=window;if("ethereum"in P&&typeof P.ethereum=="object"&&"request"in P.ethereum&&typeof P.ethereum.request=="function")w=P.ethereum;else throw new Error("@supabase/auth-js: No compatible Ethereum wallet interface on the window object (window.ethereum) detected. Make sure the user already has a wallet installed and connected for this app. Prefer passing the wallet interface object directly to signInWithWeb3({ chain: 'ethereum', wallet: resolvedUserWallet }) instead.")}else{if(typeof v!="object"||!(y!=null&&y.url))throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");w=v}const _=new URL((r=y==null?void 0:y.url)!==null&&r!==void 0?r:window.location.href),j=await w.request({method:"eth_requestAccounts"}).then(P=>P).catch(()=>{throw new Error("@supabase/auth-js: Wallet method eth_requestAccounts is missing or invalid")});if(!j||j.length===0)throw new Error("@supabase/auth-js: No accounts available. Please ensure the wallet is connected.");const k=z1(j[0]);let S=(n=y==null?void 0:y.signInWithEthereum)===null||n===void 0?void 0:n.chainId;if(!S){const P=await w.request({method:"eth_chainId"});S=AA(P)}const C={domain:_.host,address:k,statement:x,uri:_.href,version:"1",chainId:S,nonce:(s=y==null?void 0:y.signInWithEthereum)===null||s===void 0?void 0:s.nonce,issuedAt:(o=(a=y==null?void 0:y.signInWithEthereum)===null||a===void 0?void 0:a.issuedAt)!==null&&o!==void 0?o:new Date,expirationTime:(l=y==null?void 0:y.signInWithEthereum)===null||l===void 0?void 0:l.expirationTime,notBefore:(c=y==null?void 0:y.signInWithEthereum)===null||c===void 0?void 0:c.notBefore,requestId:(u=y==null?void 0:y.signInWithEthereum)===null||u===void 0?void 0:u.requestId,resources:(d=y==null?void 0:y.signInWithEthereum)===null||d===void 0?void 0:d.resources};f=OA(C),b=await w.request({method:"personal_sign",params:[RA(f),k]})}try{const{data:g,error:v}=await ie(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"ethereum",message:f,signature:b},!((h=t.options)===null||h===void 0)&&h.captchaToken?{gotrue_meta_security:{captcha_token:(m=t.options)===null||m===void 0?void 0:m.captchaToken}}:null),xform:pr});if(v)throw v;if(!g||!g.session||!g.user){const x=new _a;return this._returnResult({data:{user:null,session:null},error:x})}return g.session&&(await this._saveSession(g.session),await this._notifyAllSubscribers("SIGNED_IN",g.session)),this._returnResult({data:Object.assign({},g),error:v})}catch(g){if(ee(g))return this._returnResult({data:{user:null,session:null},error:g});throw g}}async signInWithSolana(t){var r,n,s,a,o,l,c,u,d,h,m,f;let b,g;if("message"in t)b=t.message,g=t.signature;else{const{chain:v,wallet:x,statement:y,options:w}=t;let _;if(ct())if(typeof x=="object")_=x;
499else{const k=window;if("solana"in k&&typeof k.solana=="object"&&("signIn"in k.solana&&typeof k.solana.signIn=="function"||"signMessage"in k.solana&&typeof k.solana.signMessage=="function"))_=k.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.");_=x}const j=new URL((r=w==null?void 0:w.url)!==null&&r!==void 0?r:window.location.href);if("signIn"in _&&_.signIn){const k=await _.signIn(Object.assign(Object.assign(Object.assign({issuedAt:new Date().toISOString()},w==null?void 0:w.signInWithSolana),{version:"1",domain:j.host,uri:j.href}),y?{statement:y}:null));let S;if(Array.isArray(k)&&k[0]&&typeof k[0]=="object")S=k[0];else if(k&&typeof k=="object"&&"signedMessage"in k&&"signature"in k)S=k;else throw new Error("@supabase/auth-js: Wallet method signIn() returned unrecognized value");if("signedMessage"in S&&"signature"in S&&(typeof S.signedMessage=="string"||S.signedMessage instanceof Uint8Array)&&S.signature instanceof Uint8Array)b=typeof S.signedMessage=="string"?S.signedMessage:new TextDecoder().decode(S.signedMessage),g=S.signature;else throw new Error("@supabase/auth-js: Wallet method signIn() API returned object without signedMessage and signature fields")}else{if(!("signMessage"in _)||typeof _.signMessage!="function"||!("publicKey"in _)||typeof _!="object"||!_.publicKey||!("toBase58"in _.publicKey)||typeof _.publicKey.toBase58!="function")throw new Error("@supabase/auth-js: Wallet does not have a compatible signMessage() and publicKey.toBase58() API");b=[`${j.host} wants you to sign in with your Solana account:`,_.publicKey.toBase58(),...y?["",y,""]:[""],"Version: 1",`URI: ${j.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()}`,...!((a=w==null?void 0:w.signInWithSolana)===null||a===void 0)&&a.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}`]:[],...!((h=(d=w==null?void 0:w.signInWithSolana)===null||d===void 0?void 0:d.resources)===null||h===void 0)&&h.length?["Resources",...w.signInWithSolana.resources.map(S=>`- ${S}`)]:[]].join(` 500`);const k=await _.signMessage(new TextEncoder().encode(b),"utf8");if(!k||!(k instanceof Uint8Array))throw new Error("@supabase/auth-js: Wallet signMessage() API returned an recognized value");g=k}}try{const{data:v,error:x}=await ie(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"solana",message:b,signature:Hs(g)},!((m=t.options)===null||m===void 0)&&m.captchaToken?{gotrue_meta_security:{captcha_token:(f=t.options)===null||f===void 0?void 0:f.captchaToken}}:null),xform:pr});if(x)throw x;if(!v||!v.session||!v.user){const y=new _a;return this._returnResult({data:{user:null,session:null},error:y})}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(ee(v))return this._returnResult({data:{user:null,session:null},error:v});throw v}}async _exchangeCodeForSession(t){const r=await Ms(this.storage,`${this.storageKey}-code-verifier`),[n,s]=(r??"").split("/");try{if(!n&&this.flowType==="pkce")throw new XP;const{data:a,error:o}=await ie(this.fetch,"POST",`${this.url}/token?grant_type=pkce`,{headers:this.headers,body:{auth_code:t,code_verifier:n},xform:pr});if(await lt(this.storage,`${this.storageKey}-code-verifier`),o)throw o;if(!a||!a.session||!a.user){const l=new _a;return this._returnResult({data:{user:null,session:null,redirectType:null},error:l})}return a.session&&(await this._saveSession(a.session),await this._notifyAllSubscribers("SIGNED_IN",a.session)),this._returnResult({data:Object.assign(Object.assign({},a),{redirectType:s??null}),error:o})}catch(a){if(await lt(this.storage,`${this.storageKey}-code-verifier`),ee(a))return this._returnResult({data:{user:null,session:null,redirectType:null},error:a});throw a}}async signInWithIdToken(t){try{const{options:r,provider:n,token:s,access_token:a,nonce:o}=t,l=await ie(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,body:{provider:n,id_token:s,access_token:a,nonce:o,gotrue_meta_security:{captcha_token:r==null?void 0:r.captchaToken}},xform:pr}),{data:c,error:u}=l;if(u)return this._returnResult({data:{user:null,session:null},error:u});if(!c||!c.session||!c.user){const d=new _a;return this._returnResult({data:{user:null,session:null},error:d})}return c.session&&(await this._saveSession(c.session),await this._notifyAllSubscribers("SIGNED_IN",c.session)),this._returnResult({data:c,error:u})}catch(r){if(ee(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}}async signInWithOtp(t){var r,n,s,a,o;try{if("email"in t){const{email:l,options:c}=t;let u=null,d=null;this.flowType==="pkce"&&([u,d]=await ja(this.storage,this.storageKey));const{error:h}=await ie(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:d},redirectTo:c==null?void 0:c.emailRedirectTo});return this._returnResult({data:{user:null,session:null},error:h})}if("phone"in t){const{phone:l,options:c}=t,{data:u,error:d}=await ie(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:(a=c==null?void 0:c.shouldCreateUser)!==null&&a!==void 0?a:!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:d})}throw new Ql("You must provide either an email or phone number.")}catch(l){if(await lt(this.storage,`${this.storageKey}-code-verifier`),ee(l))return this._returnResult({data:{user:null,session:null},error:l});throw l}}async verifyOtp(t){var r,n;try{let s,a;"options"in t&&(s=(r=t.options)===null||r===void 0?void 0:r.redirectTo,a=(n=t.options)===null||n===void 0?void 0:n.captchaToken);const{data:o,error:l}=await ie(this.fetch,"POST",`${this.url}/verify`,{headers:this.headers,body:Object.assign(Object.assign({},t),{gotrue_meta_security:{captcha_token:a}}),redirectTo:s,xform:pr});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(ee(s))return this._returnResult({data:{user:null,session:null},error:s});throw s}}async signInWithSSO(t){var r,n,s,a,o;try{let l=null,c=null;this.flowType==="pkce"&&([l,c]=await ja(this.storage,this.storageKey));const u=await ie(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:kA});return!((a=u.data)===null||a===void 0)&&a.url&&ct()&&!(!((o=t.options)===null||o===void 0)&&o.skipBrowserRedirect)&&window.location.assign(u.data.url),this._returnResult(u)}catch(l){if(await lt(this.storage,`${this.storageKey}-code-verifier`),ee(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 Ft;const{error:s}=await ie(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(ee(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:a}=t,{error:o}=await ie(this.fetch,"POST",r,{headers:this.headers,body:{email:n,type:s,gotrue_meta_security:{captcha_token:a==null?void 0:a.captchaToken}},redirectTo:a==null?void 0:a.emailRedirectTo});return this._returnResult({data:{user:null,session:null},error:o})}else if("phone"in t){const{phone:n,type:s,options:a}=t,{data:o,error:l}=await ie(this.fetch,"POST",r,{headers:this.headers,body:{phone:n,type:s,gotrue_meta_security:{captcha_token:a==null?void 0:a.captchaToken}}});return this._returnResult({data:{user:null,session:null,messageId:o==null?void 0:o.message_id},error:l})}throw new Ql("You must provide either an email or phone number and a type")}catch(r){if(ee(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 Ms(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
500id"),await this._removeSession())),!t)return{data:{session:null},error:null};const n=t.expires_at?t.expires_at*1e3-Date.now()<nh:!1;if(this._debug("#__loadSession()",`session has${n?"":" not"} expired`,"expires_at",t.expires_at),!n){if(this.userStorage){const o=await Ms(this.userStorage,this.storageKey+"-user");o!=null&&o.user?t.user=o.user:t.user=ih()}if(this.storage.isServer&&t.user&&!t.user.__isUserNotAvailableProxy){const o={value:this.suppressGetSessionWarning};t.user=wA(t.user,o),o.value&&(this.suppressGetSessionWarning=!0)}return{data:{session:t},error:null}}const{data:s,error:a}=await this._callRefreshToken(t.refresh_token);return a?this._returnResult({data:{session:null},error:a}):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 ie(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:t,xform:Gn}):await this._useSession(async r=>{var n,s,a;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 Ft}:await ie(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:(a=(s=o.session)===null||s===void 0?void 0:s.access_token)!==null&&a!==void 0?a:void 0,xform:Gn})})}catch(r){if(ee(r))return sh(r)&&(await this._removeSession(),await lt(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:a}=n;if(a)throw a;if(!s.session)throw new Ft;const o=s.session;let l=null,c=null;this.flowType==="pkce"&&t.email!=null&&([l,c]=await ja(this.storage,this.storageKey));const{data:u,error:d}=await ie(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:Gn});if(d)throw d;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 lt(this.storage,`${this.storageKey}-code-verifier`),ee(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 Ft;const r=Date.now()/1e3;let n=r,s=!0,a=null;const{payload:o}=Zl(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};a=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});a={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(a),await this._notifyAllSubscribers("SIGNED_IN",a)}return this._returnResult({data:{user:a.user,session:a},error:null})}catch(r){if(ee(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 Ft;const{data:s,error:a}=await this._callRefreshToken(t.refresh_token);return a?this._returnResult({data:{user:null,session:null},error:a}):s?this._returnResult({data:{user:s.user,session:s},error:null}):this._returnResult({data:{user:null,session:null},error:null})})}catch(r){if(ee(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}}async _getSessionFromURL(t,r){try{if(!ct())throw new Jl("No browser detected.");
500if(t.error||t.error_description||t.error_code)throw new Jl(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 cx("Not a valid PKCE flow url.");break;case"pkce":if(this.flowType==="implicit")throw new Jl("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 cx("No code detected.");const{data:y,error:w}=await this._exchangeCodeForSession(t.code);if(w)throw w;const _=new URL(window.location.href);return _.searchParams.delete("code"),window.history.replaceState(window.history.state,"",_.toString()),{data:{session:y.session,redirectType:null},error:null}}const{provider_token:n,provider_refresh_token:s,access_token:a,refresh_token:o,expires_in:l,expires_at:c,token_type:u}=t;if(!a||!l||!o||!u)throw new Jl("No session defined in URL");const d=Math.round(Date.now()/1e3),h=parseInt(l);let m=d+h;c&&(m=parseInt(c));const f=m-d;f*1e3<=Oa&&console.warn(`@supabase/gotrue-js: Session as retrieved from URL expires in ${f}s, should have been closer to ${h}s`);const b=m-h;d-b>=120?console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued over 120s ago, URL could be stale",b,m,d):d-b<0&&console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued in the future? Check the device clock for skew",b,m,d);const{data:g,error:v}=await this._getUser(a);if(v)throw v;const x={provider_token:n,provider_refresh_token:s,access_token:a,expires_in:h,expires_at:m,refresh_token:o,token_type:u,user:g.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(ee(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 Ms(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:a}=r;if(a&&!sh(a))return this._returnResult({error:a});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&&!(JP(l)&&(l.status===404||l.status===401||l.status===403)||sh(l)))return this._returnResult({error:l})}return t!=="others"&&(await this._removeSession(),await lt(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({error:null})})}onAuthStateChange(t){const r=iA(),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:a},error:o}=r;if(o)throw o;await((n=this.stateChangeEmitters.get(t))===null||n===void 0?void 0:n.callback("INITIAL_SESSION",a)),this._debug("INITIAL_SESSION","callback id",t,"session",a)}catch(a){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",a),console.error(a)}})}async resetPasswordForEmail(t,r={}){let n=null,s=null;this.flowType==="pkce"&&([n,s]=await ja(this.storage,this.storageKey,!0));try{return await ie(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(a){if(await lt(this.storage,`${this.storageKey}-code-verifier`),ee(a))return this._returnResult({data:null,error:a});throw a}}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(ee(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 a=>{var o,l,c,u,d;const{data:h,error:m}=a;if(m)throw m;const f=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 ie(this.fetch,"GET",f,{headers:this.headers,jwt:(d=(u=h.session)===null||u===void 0?void 0:u.access_token)!==null&&d!==void 0?d:void 0})});if(s)throw s;return ct()&&!(!((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(ee(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:a}}=r;if(s)throw s;const{options:o,provider:l,token:c,access_token:u,nonce:d}=t,h=await ie(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,jwt:(n=a==null?void 0:a.access_token)!==null&&n!==void 0?n:void 0,body:{provider:l,id_token:c,access_token:u,nonce:d,link_identity:!0,gotrue_meta_security:{captcha_token:o==null?void 0:o.captchaToken}},xform:pr}),{data:m,error:f}=h;return f?this._returnResult({data:{user:null,session:null},error:f}):!m||!m.session||!m.user?this._returnResult({data:{user:null,session:null},error:new _a}):(m.session&&(await this._saveSession(m.session),await this._notifyAllSubscribers("USER_UPDATED",m.session)),this._returnResult({data:m,error:f}))}catch(s){if(await lt(this.storage,`${this.storageKey}-code-verifier`),ee(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:a,error:o}=r;if(o)throw o;
500return await ie(this.fetch,"DELETE",`${this.url}/user/identities/${t.identity_id}`,{headers:this.headers,jwt:(s=(n=a.session)===null||n===void 0?void 0:n.access_token)!==null&&s!==void 0?s:void 0})})}catch(r){if(ee(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 uA(async s=>(s>0&&await cA(200*Math.pow(2,s-1)),this._debug(r,"refreshing attempt",s),await ie(this.fetch,"POST",`${this.url}/token?grant_type=refresh_token`,{body:{refresh_token:t},headers:this.headers,xform:pr})),(s,a)=>{const o=200*Math.pow(2,s);return a&&ah(a)&&Date.now()+o-n<Oa})}catch(n){if(this._debug(r,"error",n),ee(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),ct()&&!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 Ms(this.storage,this.storageKey);if(s&&this.userStorage){let o=await Ms(this.userStorage,this.storageKey+"-user");!this.storage.isServer&&Object.is(this.storage,this.userStorage)&&!o&&(o={user:s.user},await Ia(this.userStorage,this.storageKey+"-user",o)),s.user=(t=o==null?void 0:o.user)!==null&&t!==void 0?t:ih()}else if(s&&!s.user&&!s.user){const o=await Ms(this.storage,this.storageKey+"-user");o&&(o!=null&&o.user)?(s.user=o.user,await lt(this.storage,this.storageKey+"-user"),await Ia(this.storage,this.storageKey,s)):s.user=ih()}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 a=((r=s.expires_at)!==null&&r!==void 0?r:1/0)*1e3-Date.now()<nh;if(this._debug(n,`session has${a?"":" not"} expired with margin of ${nh}s`),a){if(this.autoRefreshToken&&s.refresh_token){const{error:o}=await this._callRefreshToken(s.refresh_token);o&&(console.error(o),ah(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 Ft;if(this.refreshingDeferred)return this.refreshingDeferred.promise;const s=`#_callRefreshToken(${t.substring(0,5)}...)`;this._debug(s,"begin");try{this.refreshingDeferred=new sd;const{data:a,error:o}=await this._refreshAccessToken(t);if(o)throw o;if(!a.session)throw new Ft;await this._saveSession(a.session),await this._notifyAllSubscribers("TOKEN_REFRESHED",a.session);const l={data:a.session,error:null};return this.refreshingDeferred.resolve(l),l}catch(a){if(this._debug(s,"error",a),ee(a)){const o={data:null,error:a};return ah(a)||await this._removeSession(),(r=this.refreshingDeferred)===null||r===void 0||r.resolve(o),o}throw(n=this.refreshingDeferred)===null||n===void 0||n.reject(a),a}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 a=[],o=Array.from(this.stateChangeEmitters.values()).map(async l=>{try{await l.callback(t,r)}catch(c){a.push(c)}});if(await Promise.all(o),a.length>0){for(let l=0;l<a.length;l+=1)console.error(a[l]);throw a[0]}}finally{this._debug(s,"end")}}async _saveSession(t){this._debug("#_saveSession()",t),this.suppressGetSessionWarning=!0,await lt(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 Ia(this.userStorage,this.storageKey+"-user",{user:r.user});const s=Object.assign({},r);delete s.user;const a=mx(s);await Ia(this.storage,this.storageKey,a)}else{const s=mx(r);await Ia(this.storage,this.storageKey,s)}}async _removeSession(){this._debug("#_removeSession()"),this.suppressGetSessionWarning=!1,await lt(this.storage,this.storageKey),await lt(this.storage,this.storageKey+"-code-verifier"),await lt(this.storage,this.storageKey+"-user"),this.userStorage&&await lt(this.userStorage,this.storageKey+"-user"),await this._notifyAllSubscribers("SIGNED_OUT",null)}_removeVisibilityChangedCallback(){this._debug("#_removeVisibilityChangedCallback()");const t=this.visibilityChangedCallback;this.visibilityChangedCallback=null;try{t&&ct()&&(window!=null&&window.removeEventListener)&&window.removeEventListener("visibilitychange",t)}
500catch(r){console.error("removing visibilitychange callback failed",r)}}async _startAutoRefresh(){await this._stopAutoRefresh(),this._debug("#_startAutoRefresh()");const t=setInterval(()=>this._autoRefreshTokenTick(),Oa);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)/Oa);this._debug("#_autoRefreshTokenTick()",`access token expires in ${s} ticks, a tick lasts ${Oa}ms, refresh threshold is ${qf} ticks`),s<=qf&&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 q1)this._debug("auto refresh token tick lock not available");else throw t}}async _handleVisibilityChange(){if(this._debug("#_handleVisibilityChange()"),!ct()||!(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[a,o]=await ja(this.storage,this.storageKey),l=new URLSearchParams({code_challenge:`${encodeURIComponent(a)}`,code_challenge_method:`${encodeURIComponent(o)}`});s.push(l.toString())}if(n!=null&&n.queryParams){const a=new URLSearchParams(n.queryParams);s.push(a.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:a}=r;return a?this._returnResult({data:null,error:a}):await ie(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(ee(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:a,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 ie(this.fetch,"POST",`${this.url}/factors`,{body:l,headers:this.headers,jwt:(n=a==null?void 0:a.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(ee(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:a}=r;if(a)return this._returnResult({data:null,error:a});const o=Object.assign({challenge_id:t.challengeId},"webauthn"in t?{webauthn:Object.assign(Object.assign({},t.webauthn),{credential_response:t.webauthn.type==="create"?UA(t.webauthn.credential_response):qA(t.webauthn.credential_response)})}:{code:t.code}),{data:l,error:c}=await ie(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(ee(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:a}=r;if(a)return this._returnResult({data:null,error:a});const o=await ie(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:$A(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:FA(l.webauthn.credential_options.publicKey)})})}),error:null}}})}catch(r){if(ee(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 a of(t=r==null?void 0:r.factors)!==null&&t!==void 0?t:[])s.all.push(a),a.status==="verified"&&s[a.factor_type].push(a);return{data:s,error:null}}async _getAuthenticatorAssuranceLevel(t){var r,n,s,a;
500if(t)try{const{payload:f}=Zl(t);let b=null;f.aal&&(b=f.aal);let g=b;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(_=>_.status==="verified"))!==null&&n!==void 0?n:[]).length>0&&(g="aal2");const w=f.amr||[];return{data:{currentLevel:b,nextLevel:g,currentAuthenticationMethods:w},error:null}}catch(f){if(ee(f))return this._returnResult({data:null,error:f});throw f}const{data:{session:o},error:l}=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}=Zl(o.access_token);let u=null;c.aal&&(u=c.aal);let d=u;((a=(s=o.user.factors)===null||s===void 0?void 0:s.filter(f=>f.status==="verified"))!==null&&a!==void 0?a:[]).length>0&&(d="aal2");const m=c.amr||[];return{data:{currentLevel:u,nextLevel:d,currentAuthenticationMethods:m},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 ie(this.fetch,"GET",`${this.url}/oauth/authorizations/${t}`,{headers:this.headers,jwt:n.access_token,xform:a=>({data:a,error:null})}):this._returnResult({data:null,error:new Ft})})}catch(r){if(ee(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:a}=n;if(a)return this._returnResult({data:null,error:a});if(!s)return this._returnResult({data:null,error:new Ft});const o=await ie(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&&ct()&&!(r!=null&&r.skipBrowserRedirect)&&window.location.assign(o.data.redirect_url),o})}catch(n){if(ee(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:a}=n;if(a)return this._returnResult({data:null,error:a});if(!s)return this._returnResult({data:null,error:new Ft});const o=await ie(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&&ct()&&!(r!=null&&r.skipBrowserRedirect)&&window.location.assign(o.data.redirect_url),o})}catch(n){if(ee(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 ie(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 Ft})})}catch(t){if(ee(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 ie(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 Ft})})}catch(r){if(ee(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+KP>s)return n;const{data:a,error:o}=await ie(this.fetch,"GET",`${this.url}/.well-known/jwks.json`,{headers:this.headers});if(o)throw o;return!a.keys||a.keys.length===0||(this.jwks=a,this.jwks_cached_at=s,n=a.keys.find(l=>l.kid===t),!n)?null:n}async getClaims(t,r={}){try{let n=t;if(!n){const{data:f,error:b}
500=await this.getSession();if(b||!f.session)return this._returnResult({data:null,error:b});n=f.session.access_token}const{header:s,payload:a,signature:o,raw:{header:l,payload:c}}=Zl(n);r!=null&&r.allowExpired||xA(a.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:f}=await this.getUser(n);if(f)throw f;return{data:{claims:a,header:s,signature:o},error:null}}const d=yA(s.alg),h=await crypto.subtle.importKey("jwk",u,d,!0,["verify"]);if(!await crypto.subtle.verify(d,h,o,sA(`${l}.${c}`)))throw new Wf("Invalid JWT signature");return{data:{claims:a,header:s,signature:o},error:null}}catch(n){if(ee(n))return this._returnResult({data:null,error:n});throw n}}}Xo.nextInstanceID={};const QA=Xo,JA="2.95.3";let lo="";typeof Deno<"u"?lo="deno":typeof document<"u"?lo="web":typeof navigator<"u"&&navigator.product==="ReactNative"?lo="react-native":lo="node";const ZA={"X-Client-Info":`supabase-js-${lo}/${JA}`},XA={headers:ZA},eR={schema:"public"},tR={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"},rR={};function el(e){"@babel/helpers - typeof";return el=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},el(e)}function nR(e,t){if(el(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(el(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function sR(e){var t=nR(e,"string");return el(t)=="symbol"?t:t+""}function aR(e,t,r){return(t=sR(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function bx(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 Ve(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?bx(Object(r),!0).forEach(function(n){aR(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):bx(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}const iR=e=>e?(...t)=>e(...t):(...t)=>fetch(...t),oR=()=>Headers,lR=(e,t,r)=>{const n=iR(r),s=oR();return async(a,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(a,Ve(Ve({},o),{},{headers:u}))}};function cR(e){return e.endsWith("/")?e:e+"/"}function uR(e,t){var r,n;const{db:s,auth:a,realtime:o,global:l}=e,{db:c,auth:u,realtime:d,global:h}=t,m={db:Ve(Ve({},c),s),auth:Ve(Ve({},u),a),realtime:Ve(Ve({},d),o),storage:{},global:Ve(Ve(Ve({},h),l),{},{headers:Ve(Ve({},(r=h==null?void 0:h.headers)!==null&&r!==void 0?r:{}),(n=l==null?void 0:l.headers)!==null&&n!==void 0?n:{})}),accessToken:async()=>""};return e.accessToken?m.accessToken=e.accessToken:delete m.accessToken,m}function dR(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(cR(t))}catch{throw Error("Invalid supabaseUrl: Provided URL is malformed.")}}var hR=class extends QA{constructor(e){super(e)}},fR=class{constructor(e,t,r){var n,s;this.supabaseUrl=e,this.supabaseKey=t;const a=dR(e);if(!t)throw new Error("supabaseKey is required.");this.realtimeUrl=new URL("realtime/v1",a),this.realtimeUrl.protocol=this.realtimeUrl.protocol.replace("http","ws"),this.authUrl=new URL("auth/v1",a),this.storageUrl=new URL("storage/v1",a),this.functionsUrl=new URL("functions/v1",a);const o=`sb-${a.hostname.split(".")[0]}-auth-token`,l={db:eR,realtime:rR,auth:Ve(Ve({},tR),{},{storageKey:o}),global:XA},c=uR(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:(d,h)=>{throw new Error(`@supabase/supabase-js: Supabase Client is configured with the accessToken option, accessing supabase.auth.${String(h)} 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=lR(t,this._getAccessToken.bind(this),c.global.fetch),this.realtime=this._initRealtimeClient(Ve({headers:this.headers,accessToken:this._getAccessToken.bind(this)},c.realtime)),this.accessToken&&Promise.resolve(this.accessToken()).then(d=>this.realtime.setAuth(d)).catch(d=>console.warn("Failed to set initial Realtime auth token:",d)),this.rest=new J4(new URL("rest/v1",a).href,{headers:this.headers,schema:c.db.schema,fetch:this.fetch,timeout:c.db.timeout,urlLengthLimit:c.db.urlLengthLimit}),this.storage=new WP(this.storageUrl.href,this.headers,this.fetch,r==null?void 0:r.storage),c.accessToken||this._listenForAuthEvents()}get functions(){return new B4(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)}
500channel(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:a,flowType:o,lock:l,debug:c,throwOnError:u},d,h){const m={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new hR({url:this.authUrl.href,headers:Ve(Ve({},m),d),storageKey:a,autoRefreshToken:e,persistSession:t,detectSessionInUrl:r,storage:n,userStorage:s,flowType:o,lock:l,debug:c,throwOnError:u,fetch:h,hasCustomAuthorizationHeader:Object.keys(this.headers).some(f=>f.toLowerCase()==="authorization")})}_initRealtimeClient(e){return new mP(this.realtimeUrl.href,Ve(Ve({},e),{},{params:Ve(Ve({},{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 mR=(e,t,r)=>new fR(e,t,r);function pR(){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}pR()&&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 gR="https://xnghrryfbdjqajbikcqn.supabase.co",xR="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InhuZ2hycnlmYmRqcWFqYmlrY3FuIiwicm9sZSI6ImFub24iLCJpYXQiOjE3NzAwNTExNTIsImV4cCI6MjA4NTYyNzE1Mn0.VXWNqIaeFa0P9w3xA4UpkInnz5iTuw_p-vDNVIlCGqA",F=mR(gR,xR,{auth:{storage:localStorage,persistSession:!0,autoRefreshToken:!0}}),W1=p.createContext(void 0);function yR({children:e}){const[t,r]=p.useState(null),[n,s]=p.useState(null),[a,o]=p.useState(!0);p.useEffect(()=>{const{data:{subscription:h}}=F.auth.onAuthStateChange((m,f)=>{s(f),r((f==null?void 0:f.user)??null),o(!1),m==="SIGNED_IN"&&(f!=null&&f.user)&&setTimeout(()=>{l(f.user)},0)});return F.auth.getSession().then(({data:{session:m}})=>{s(m),r((m==null?void 0:m.user)??null),o(!1)}),()=>h.unsubscribe()},[]);const l=async h=>{var f,b;const{data:m}=await F.from("profiles").select("id").eq("id",h.id).maybeSingle();m||await F.from("profiles").insert({id:h.id,email:h.email,display_name:((f=h.user_metadata)==null?void 0:f.display_name)||((b=h.email)==null?void 0:b.split("@")[0])||"Student",role:"student",onboarding_completed:!1,xp:0,level:"bronze",current_streak:0,longest_streak:0})},c=async(h,m)=>{const f=`${window.location.origin}/onboarding`,{error:b}=await F.auth.signUp({email:h,password:m,options:{emailRedirectTo:f}});return{error:b}},u=async(h,m)=>{const{error:f}=await F.auth.signInWithPassword({email:h,password:m});return{error:f}},d=async()=>{await F.auth.signOut()};return i.jsx(W1.Provider,{value:{user:t,session:n,loading:a,signUp:c,signIn:u,signOut:d},children:e})}function st(){const e=p.useContext(W1);if(e===void 0)throw new Error("useAuth must be used within an AuthProvider");return e}function Xl({children:e}){const{user:t,loading:r}=st();return r?i.jsx("div",{className:"flex min-h-screen items-center justify-center bg-background",children:i.jsx($e,{className:"h-8 w-8 animate-spin text-primary"})}):t?i.jsx(i.Fragment,{children:e}):i.jsx(N4,{to:"/auth",replace:!0})}const vR=Vu("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},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"}}),ne=p.forwardRef(({className:e,variant:t,size:r,asChild:n=!1,...s},a)=>{const o=n?JN:"button";return i.jsx(o,{className:ce(vR({variant:t,size:r,className:e})),ref:a,...s})});
500ne.displayName="Button";const wR=()=>i.jsxs("div",{className:"min-h-screen bg-background",children:[i.jsx("header",{className:"fixed top-0 left-0 right-0 z-50 bg-background/80 backdrop-blur-md border-b border-border",children:i.jsxs("div",{className:"container mx-auto px-4 h-16 flex items-center justify-between",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("div",{className:"w-8 h-8 rounded-lg gradient-primary flex items-center justify-center",children:i.jsx(Ar,{className:"w-5 h-5 text-white"})}),i.jsx("span",{className:"text-xl font-bold text-foreground",children:"Mathly"})]}),i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx(mn,{to:"/auth",children:i.jsx(ne,{variant:"ghost",size:"sm",children:"Log in"})}),i.jsx(mn,{to:"/auth",children:i.jsx(ne,{size:"sm",className:"gradient-primary text-white border-0",children:"Get started"})})]})]})}),i.jsx("section",{className:"pt-24 pb-16 px-4",children:i.jsxs("div",{className:"container mx-auto max-w-4xl text-center",children:[i.jsxs("div",{className:"inline-flex items-center gap-2 px-4 py-2 rounded-full bg-secondary text-sm font-medium text-primary mb-6",children:[i.jsx(tu,{className:"w-4 h-4"}),"GCSE Maths made simple"]}),i.jsxs("h1",{className:"text-4xl md:text-5xl lg:text-6xl font-extrabold text-foreground mb-6 leading-tight",children:["Revise smarter,"," ",i.jsx("span",{className:"text-primary",children:"not harder"})]}),i.jsx("p",{className:"text-lg md:text-xl text-muted-foreground mb-8 max-w-2xl mx-auto",children:"Your personal GCSE Maths companion. We find what you need to work on, create your study plan, and keep you motivated every step of the way."}),i.jsx("div",{className:"flex flex-col sm:flex-row gap-4 justify-center mb-12",children:i.jsx(mn,{to:"/auth",children:i.jsxs(ne,{size:"lg",className:"gradient-primary text-white border-0 h-14 px-8 text-lg w-full sm:w-auto",children:["Start for free",i.jsx(Pr,{className:"w-5 h-5 ml-2"})]})})}),i.jsxs("div",{className:"flex items-center justify-center gap-1 text-muted-foreground",children:[[1,2,3,4,5].map(e=>i.jsx(tu,{className:"w-5 h-5 fill-warning text-warning"},e)),i.jsx("span",{className:"ml-2 text-sm",children:"Loved by students"})]})]})}),i.jsx("section",{className:"py-16 px-4 bg-secondary/50",children:i.jsxs("div",{className:"container mx-auto max-w-5xl",children:[i.jsx("h2",{className:"text-2xl md:text-3xl font-bold text-center text-foreground mb-12",children:"Why students love Mathly"}),i.jsxs("div",{className:"grid md:grid-cols-3 gap-6",children:[i.jsx(lh,{icon:i.jsx(bn,{className:"w-6 h-6"}),title:"Personalised for you",description:"Take a quick diagnostic and get a study plan tailored to your strengths and weaknesses.",color:"primary"}),i.jsx(lh,{icon:i.jsx(rn,{className:"w-6 h-6"}),title:"See your progress",description:"Track your improvement with simple visuals. No confusing gradesâjust clear progress.",color:"success"}),i.jsx(lh,{icon:i.jsx(Cn,{className:"w-6 h-6"}),title:"Stay motivated",description:"Encouraging feedback, daily streaks, and a friendly tone that builds confidence.",color:"accent"})]})]})}),i.jsx("section",{className:"py-16 px-4",children:i.jsxs("div",{className:"container mx-auto max-w-4xl",children:[i.jsx("h2",{className:"text-2xl md:text-3xl font-bold text-center text-foreground mb-12",children:"How it works"}),i.jsxs("div",{className:"space-y-6",children:[i.jsx(ec,{number:1,title:"Take the diagnostic",description:"Answer 12 quick questions so we can understand where you're at."}),i.jsx(ec,{number:2,title:"Get your personal dashboard",description:"See your focus topics and a clear path to improvement."}),i.jsx(ec,{number:3,title:"Practice with smart quizzes",description:"Short, focused quizzes with instant feedback and explanations."}),i.jsx(ec,{number:4,title:"Watch your confidence grow",description:"Track progress, earn XP, and feel ready for your exams."})]})]})}),i.jsx("section",{className:"py-16 px-4 bg-primary text-primary-foreground",children:i.jsxs("div",{className:"container mx-auto max-w-3xl text-center",children:[i.jsx("h2",{className:"text-2xl md:text-3xl font-bold mb-4",children:"Ready to feel confident about Maths?"}
500),i.jsx("p",{className:"text-primary-foreground/80 mb-8 text-lg",children:"Join thousands of students who've improved their grades with Mathly."}),i.jsx(mn,{to:"/auth",children:i.jsxs(ne,{size:"lg",variant:"secondary",className:"h-14 px-8 text-lg",children:["Start revising now",i.jsx(Pr,{className:"w-5 h-5 ml-2"})]})})]})}),i.jsx("section",{className:"py-16 px-4 bg-secondary/30",children:i.jsxs("div",{className:"container mx-auto max-w-3xl text-center",children:[i.jsx("h2",{className:"text-2xl md:text-3xl font-bold text-foreground mb-4",children:"Get in touch"}),i.jsx("p",{className:"text-muted-foreground mb-6 text-lg",children:"Have a question, suggestion, or just want to say hello? We'd love to hear from you."}),i.jsxs("a",{href:"mailto:[email protected]",className:"inline-flex items-center gap-2 px-6 py-3 rounded-xl bg-primary text-primary-foreground font-semibold text-lg hover:bg-primary/90 transition-colors",children:[i.jsx(cp,{className:"w-5 h-5"}),"[email protected]"]})]})}),i.jsx("footer",{className:"py-8 px-4 border-t border-border",children:i.jsxs("div",{className:"container mx-auto text-center text-muted-foreground text-sm",children:[i.jsxs("div",{className:"flex items-center justify-center gap-2 mb-2",children:[i.jsx("div",{className:"w-6 h-6 rounded-md gradient-primary flex items-center justify-center",children:i.jsx(Ar,{className:"w-4 h-4 text-white"})}),i.jsx("span",{className:"font-semibold text-foreground",children:"Mathly"})]}),i.jsx("p",{children:"Making GCSE Maths less stressful, one quiz at a time."})]})})]}),lh=({icon:e,title:t,description:r,color:n})=>{const s={primary:"bg-primary/10 text-primary",success:"bg-success/10 text-success",accent:"bg-accent/10 text-accent"};return i.jsxs("div",{className:"bg-card rounded-2xl p-6 shadow-card border border-border",children:[i.jsx("div",{className:`w-12 h-12 rounded-xl ${s[n]} flex items-center justify-center mb-4`,children:e}),i.jsx("h3",{className:"text-lg font-bold text-foreground mb-2",children:t}),i.jsx("p",{className:"text-muted-foreground",children:r})]})},ec=({number:e,title:t,description:r})=>i.jsxs("div",{className:"flex gap-4 items-start",children:[i.jsx("div",{className:"w-10 h-10 rounded-full gradient-primary flex items-center justify-center text-white font-bold shrink-0",children:e}),i.jsxs("div",{children:[i.jsx("h3",{className:"text-lg font-bold text-foreground mb-1",children:t}),i.jsx("p",{className:"text-muted-foreground",children:r})]})]}),z=p.forwardRef(({className:e,...t},r)=>i.jsx("div",{ref:r,className:ce("rounded-lg border bg-card text-card-foreground shadow-sm",e),...t}));z.displayName="Card";const ad=p.forwardRef(({className:e,...t},r)=>i.jsx("div",{ref:r,className:ce("flex flex-col space-y-1.5 p-6",e),...t}));ad.displayName="CardHeader";const id=p.forwardRef(({className:e,...t},r)=>i.jsx("h3",{ref:r,className:ce("text-2xl font-semibold leading-none tracking-tight",e),...t}));id.displayName="CardTitle";const Ip=p.forwardRef(({className:e,...t},r)=>i.jsx("p",{ref:r,className:ce("text-sm text-muted-foreground",e),...t}));Ip.displayName="CardDescription";const B=p.forwardRef(({className:e,...t},r)=>i.jsx("div",{ref:r,className:ce("p-6 pt-0",e),...t}));B.displayName="CardContent";const Mp=p.forwardRef(({className:e,...t},r)=>i.jsx("div",{ref:r,className:ce("flex items-center p-6 pt-0",e),...t}));Mp.displayName="CardFooter";const bR=[{value:"student",title:"Student",description:"I'm studying for my GCSE Maths",icon:i.jsx(tn,{className:"w-7 h-7"})},{value:"parent",title:"Parent",description:"I want to track my child's progress",icon:i.jsx(wt,{className:"w-7 h-7"})},{value:"teacher",title:"Teacher",description:"I teach Maths and want to manage my students",icon:i.jsx(dp,{className:"w-7 h-7"})}],_R=({onSelect:e})=>i.jsx("div",{className:"flex min-h-screen flex-col items-center justify-center bg-background px-4",children:i.jsxs("div",{className:"w-full max-w-md",children:[i.jsxs("div",{className:"text-center mb-8",children:[i.jsx("div",{className:"w-16 h-16 rounded-2xl gradient-primary flex items-center justify-center mx-auto mb-4",children:i.jsx(tn,{className:"w-8 h-8 text-white"})}),i.jsx("h1",{className:"text-3xl font-bold text-foreground mb-2",children:"Welcome to Mathly"}),i.jsx("p",{className:"text-muted-foreground",children:"How will you be using Mathly?"})]}),i.jsx("div",{className:"space-y-3",children:bR.map(t=>i.jsx(z,{className:"cursor-pointer hover:border-primary/50 hover:shadow-soft transition-all",onClick:()=>e(t.value),children:i.jsxs(B,{className:"flex items-center gap-4 p-5",children:[i.jsx("div",{className:"w-14 h-14 roun
500ded-xl bg-primary/10 flex items-center justify-center text-primary shrink-0",children:t.icon}),i.jsxs("div",{className:"flex-1",children:[i.jsx("h3",{className:"font-bold text-foreground text-lg",children:t.title}),i.jsx("p",{className:"text-sm text-muted-foreground",children:t.description})]})]})},t.value))})]})});var Ne;(function(e){e.assertEqual=s=>{};function t(s){}e.assertIs=t;function r(s){throw new Error}e.assertNever=r,e.arrayToEnum=s=>{const a={};for(const o of s)a[o]=o;return a},e.getValidEnumValues=s=>{const a=e.objectKeys(s).filter(l=>typeof s[s[l]]!="number"),o={};for(const l of a)o[l]=s[l];return e.objectValues(o)},e.objectValues=s=>e.objectKeys(s).map(function(a){return s[a]}),e.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{const a=[];for(const o in s)Object.prototype.hasOwnProperty.call(s,o)&&a.push(o);return a},e.find=(s,a)=>{for(const o of s)if(a(o))return o},e.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&Number.isFinite(s)&&Math.floor(s)===s;function n(s,a=" | "){return s.map(o=>typeof o=="string"?`'${o}'`:o).join(a)}e.joinValues=n,e.jsonStringifyReplacer=(s,a)=>typeof a=="bigint"?a.toString():a})(Ne||(Ne={}));var _x;(function(e){e.mergeShapes=(t,r)=>({...t,...r})})(_x||(_x={}));const Z=Ne.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Wn=e=>{switch(typeof e){case"undefined":return Z.undefined;case"string":return Z.string;case"number":return Number.isNaN(e)?Z.nan:Z.number;case"boolean":return Z.boolean;case"function":return Z.function;case"bigint":return Z.bigint;case"symbol":return Z.symbol;case"object":return Array.isArray(e)?Z.array:e===null?Z.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?Z.promise:typeof Map<"u"&&e instanceof Map?Z.map:typeof Set<"u"&&e instanceof Set?Z.set:typeof Date<"u"&&e instanceof Date?Z.date:Z.object;default:return Z.unknown}}
vendor: 5,705 bytes, line 500
500,H=Ne.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class kn extends Error{get errors(){return this.issues}constructor(t){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};const r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=t}format(t){const r=t||function(a){return a.message},n={_errors:[]},s=a=>{for(const o of a.issues)if(o.code==="invalid_union")o.unionErrors.map(s);else if(o.code==="invalid_return_type")s(o.returnTypeError);else if(o.code==="invalid_arguments")s(o.argumentsError);else if(o.path.length===0)n._errors.push(r(o));else{let l=n,c=0;for(;c<o.path.length;){const u=o.path[c];c===o.path.length-1?(l[u]=l[u]||{_errors:[]},l[u]._errors.push(r(o))):l[u]=l[u]||{_errors:[]},l=l[u],c++}}};return s(this),n}static assert(t){if(!(t instanceof kn))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Ne.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=r=>r.message){const r={},n=[];for(const s of this.issues)if(s.path.length>0){const a=s.path[0];r[a]=r[a]||[],r[a].push(t(s))}else n.push(t(s));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}}kn.create=e=>new kn(e);const Hf=(e,t)=>{let r;switch(e.code){case H.invalid_type:e.received===Z.undefined?r="Required":r=`Expected ${e.expected}, received ${e.received}`;break;case H.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,Ne.jsonStringifyReplacer)}`;break;case H.unrecognized_keys:r=`Unrecognized key(s) in object: ${Ne.joinValues(e.keys,", ")}`;break;case H.invalid_union:r="Invalid input";break;case H.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${Ne.joinValues(e.options)}`;break;case H.invalid_enum_value:r=`Invalid enum value. Expected ${Ne.joinValues(e.options)}, received '${e.received}'`;break;case H.invalid_arguments:r="Invalid function arguments";break;case H.invalid_return_type:r="Invalid function return type";break;case H.invalid_date:r="Invalid date";break;case H.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(r=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?r=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?r=`Invalid input: must end with "${e.validation.endsWith}"`:Ne.assertNever(e.validation):e.validation!=="regex"?r=`Invalid ${e.validation}`:r="Invalid";break;case H.too_small:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="bigint"?r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:r="Invalid input";break;case H.too_big:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?r=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:r="Invalid input";break;case H.custom:r="Invalid input";break;case H.invalid_intersection_types:r="Intersection results could not be merged";break;case H.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case H.not_finite:r="Number must be finite";break;default:r=t.defaultError,Ne.assertNever(e)}return{message:r}};let jR=Hf;function kR(){return jR}const SR=e=>{const{data:t,path:r,errorMaps:n,issueData:s}=e,a=[...r,...s.path||[]],o={...s,path:a};if(s.message!==void 0)return{...s,path:a,message:s.message};let l="";const c=n.filter(u=>!!u).slice().reverse();for(const u of c)l=u(o,{data:t,defaultError:l}).message;return{...s,path:a,message:l}};function Q(e,t){const r=kR(),n=SR({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===Hf?void 0:Hf].filter(s=>!!s)});e.common.issues.push(n)}class Gt{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,r){const n=[];for(const s of r){if(s.status==="aborted")return fe;s.status==="dirty"&&t.dirty(),n.push(s.value)}return{status:t.value,value:n}}static async mergeObjectAsync(t,r){const n=[];for(const s of r){const a=await s.key,o=await s.value;n.push({key:a,value:o})}return Gt.mergeObjectSync(t,n)}static mergeObjectSync(t,r){const n={};for(const s of r){const{key:a,value:o}=s;
vendor: 16,367 bytes, line 500
500if(a.status==="aborted"||o.status==="aborted")return fe;a.status==="dirty"&&t.dirty(),o.status==="dirty"&&t.dirty(),a.value!=="__proto__"&&(typeof o.value<"u"||s.alwaysSet)&&(n[a.value]=o.value)}return{status:t.value,value:n}}}const fe=Object.freeze({status:"aborted"}),co=e=>({status:"dirty",value:e}),cr=e=>({status:"valid",value:e}),jx=e=>e.status==="aborted",kx=e=>e.status==="dirty",Si=e=>e.status==="valid",fu=e=>typeof Promise<"u"&&e instanceof Promise;var X;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t==null?void 0:t.message})(X||(X={}));class ws{constructor(t,r,n,s){this._cachedPath=[],this.parent=t,this.data=r,this._path=n,this._key=s}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const Sx=(e,t)=>{if(Si(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const r=new kn(e.common.issues);return this._error=r,this._error}}};function ve(e){if(!e)return{};const{errorMap:t,invalid_type_error:r,required_error:n,description:s}=e;if(t&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:s}:{errorMap:(o,l)=>{const{message:c}=e;return o.code==="invalid_enum_value"?{message:c??l.defaultError}:typeof l.data>"u"?{message:c??n??l.defaultError}:o.code!=="invalid_type"?{message:l.defaultError}:{message:c??r??l.defaultError}},description:s}}class ke{get description(){return this._def.description}_getType(t){return Wn(t.data)}_getOrReturnCtx(t,r){return r||{common:t.parent.common,data:t.data,parsedType:Wn(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new Gt,ctx:{common:t.parent.common,data:t.data,parsedType:Wn(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){const r=this._parse(t);if(fu(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(t){const r=this._parse(t);return Promise.resolve(r)}parse(t,r){const n=this.safeParse(t,r);if(n.success)return n.data;throw n.error}safeParse(t,r){const n={common:{issues:[],async:(r==null?void 0:r.async)??!1,contextualErrorMap:r==null?void 0:r.errorMap},path:(r==null?void 0:r.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Wn(t)},s=this._parseSync({data:t,path:n.path,parent:n});return Sx(n,s)}"~validate"(t){var n,s;const r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Wn(t)};if(!this["~standard"].async)try{const a=this._parseSync({data:t,path:[],parent:r});return Si(a)?{value:a.value}:{issues:r.common.issues}}catch(a){(s=(n=a==null?void 0:a.message)==null?void 0:n.toLowerCase())!=null&&s.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:r}).then(a=>Si(a)?{value:a.value}:{issues:r.common.issues})}async parseAsync(t,r){const n=await this.safeParseAsync(t,r);if(n.success)return n.data;throw n.error}async safeParseAsync(t,r){const n={common:{issues:[],contextualErrorMap:r==null?void 0:r.errorMap,async:!0},path:(r==null?void 0:r.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Wn(t)},s=this._parse({data:t,path:n.path,parent:n}),a=await(fu(s)?s:Promise.resolve(s));return Sx(n,a)}refine(t,r){const n=s=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(s):r;return this._refinement((s,a)=>{const o=t(s),l=()=>a.addIssue({code:H.custom,...n(s)});return typeof Promise<"u"&&o instanceof Promise?o.then(c=>c?!0:(l(),!1)):o?!0:(l(),!1)})}refinement(t,r){return this._refinement((n,s)=>t(n)?!0:(s.addIssue(typeof r=="function"?r(n,s):r),!1))}_refinement(t){return new Ci({schema:this,typeName:me.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:r=>this["~validate"](r)}}optional(){return fs.create(this,this._def)}nullable(){return Ei.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Kr.create(this)}promise(){return xu.create(this,this._def)}or(t){return pu.create([this,t],this._def)}and(t){return gu.create(this,t,this._def)}transform(t){return new Ci({...ve(this._def),schema:this,typeName:me.ZodEffects,effect:{type:"transform",transform:t}})}default(t){const r=typeof t=="function"?t:()=>t;return new Gf({...ve(this._def),innerType:this,defaultValue:r,typeName:me.ZodDefault})}brand(){return new YR({typeName:me.ZodBranded,type:this,...ve(this._def)})}catch(t){const r=typeof t=="function"?t:()=>t;return new Yf({...ve(this._def),innerType:this,catchValue:r,typeName:me.ZodCatch})}describe(t){const r=this.constructor;return new r({...this._def,description:t})}pipe(t){return Dp.create(this,t)}readonly(){return Kf.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const NR=/^c[^\s-]{8,}$/i,CR=/^[0-9a-z]+$/,ER=/^[0-9A-HJKMNP-TV-Z]{26}$/i,TR=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,PR=/^[a-z0-9_-]{21}$/i,AR=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,RR=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,OR=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,IR="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let ch;const MR=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,DR=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,LR=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,$R=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,FR=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,UR=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,H1="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",qR=new RegExp(`^${H1}$`);function V1(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`);const r=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${r}`}function zR(e){return new RegExp(`^${V1(e)}$`)}function BR(e){let t=`${H1}T${V1(e)}`;const r=[];return r.push(e.local?"Z?":"Z"),e.offset&&r.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${r.join("|")})`,new RegExp(`^${t}$`)}function WR(e,t){return!!((t==="v4"||!t)&&MR.test(e)||(t==="v6"||!t)&&LR.test(e))}function HR(e,t){if(!AR.test(e))return!1;try{const[r]=e.split(".");if(!r)return!1;const n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),s=JSON.parse(atob(n));return!(typeof s!="object"||s===null||"typ"in s&&(s==null?void 0:s.typ)!=="JWT"||!s.alg||t&&s.alg!==t)}catch{return!1}}function VR(e,t){return!!((t==="v4"||!t)&&DR.test(e)||(t==="v6"||!t)&&$R.test(e))}class rs extends ke{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==Z.string){const a=this._getOrReturnCtx(t);return Q(a,{code:H.invalid_type,expected:Z.string,received:a.parsedType}),fe}const n=new Gt;let s;for(const a of this._def.checks)if(a.kind==="min")t.data.length<a.value&&(s=this._getOrReturnCtx(t,s),Q(s,{code:H.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),n.dirty());else if(a.kind==="max")t.data.length>a.value&&(s=this._getOrReturnCtx(t,s),Q(s,{code:H.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),n.dirty());else if(a.kind==="length"){const o=t.data.length>a.value,l=t.data.length<a.value;(o||l)&&(s=this._getOrReturnCtx(t,s),o?Q(s,{code:H.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):l&&Q(s,{code:H.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),n.dirty())}else if(a.kind==="email")OR.test(t.data)||(s=this._getOrReturnCtx(t,s),Q(s,{validation:"email",code:H.invalid_string,message:a.message}),n.dirty());else if(a.kind==="emoji")ch||(ch=new RegExp(IR,"u")),ch.test(t.data)||(s=this._getOrReturnCtx(t,s),Q(s,{validation:"emoji",code:H.invalid_string,message:a.message}),n.dirty());else if(a.kind==="uuid")TR.test(t.data)||(s=this._getOrReturnCtx(t,s),Q(s,{validation:"uuid",code:H.invalid_string,message:a.message}),n.dirty());else if(a.kind==="nanoid")PR.test(t.data)||(s=this._getOrReturnCtx(t,s),Q(s,{validation:"nanoid",code:H.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid")NR.test(t.data)||(s=this._getOrReturnCtx(t,s),Q(s,{validation:"cuid",code:H.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid2")CR.test(t.data)||(s=this._getOrReturnCtx(t,s),Q(s,{validation:"cuid2",code:H.invalid_string,message:a.message}),n.dirty());else if(a.kind==="ulid")ER.test(t.data)||(s=this._getOrReturnCtx(t,s),Q(s,{validation:"ulid",code:H.invalid_string,message:a.message}),n.dirty());else if(a.kind==="url")try{new URL(t.data)}catch{s=this._getOrReturnCtx(t,s),Q(s,{validation:"url",code:H.invalid_string,message:a.message}),n.dirty()}else a.kind==="regex"?(a.regex.lastIndex=0,a.regex.test(t.data)||(s=this._getOrReturnCtx(t,s),Q(s,{validation:"regex",code:H.invalid_string,message:a.message}),n.dirty())):a.kind==="trim"?t.data=t.data.trim():a.kind==="includes"?t.data.includes(a.value,a.position)||(s=this._getOrReturnCtx(t,s),Q(s,{code:H.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),n.dirty()):a.kind==="toLowerCase"?t.data=t.data.toLowerCase():a.kind==="toUpperCase"?t.data=t.data.toUpperCase():a.kind==="startsWith"?t.data.startsWith(a.value)||(s=this._getOrReturnCtx(t,s),Q(s,{code:H.invalid_string,validation:{startsWith:a.value},message:a.message}),n.dirty()):a.kind==="endsWith"?t.data.endsWith(a.value)||(s=this._getOrReturnCtx(t,s),Q(s,{code:H.invalid_string,validation:{endsWith:a.value},message:a.message}),n.dirty()):a.kind==="datetime"?BR(a).test(t.data)||(s=this._getOrReturnCtx(t,s),Q(s,{code:H.invalid_string,validation:"datetime",message:a.message}),n.dirty()):a.kind==="date"?qR.test(t.data)||(s=this._getOrReturnCtx(t,s),Q(s,{code:H.invalid_string,validation:"date",message:a.message}),n.dirty()):a.kind==="time"?zR(a).test(t.data)||(s=this._getOrReturnCtx(t,s),Q(s,{code:H.invalid_string,validation:"time",message:a.message}),n.dirty()):a.kind==="duration"?RR.test(t.data)||(s=this._getOrReturnCtx(t,s),Q(s,{validation:"duration",code:H.invalid_string,message:a.message}),n.dirty()):a.kind==="ip"?WR(t.data,a.version)||(s=this._getOrReturnCtx(t,s),Q(s,{validation:"ip",code:H.invalid_string,message:a.message}),n.dirty()):a.kind==="jwt"?HR(t.data,a.alg)||(s=this._getOrReturnCtx(t,s),Q(s,{validation:"jwt",code:H.invalid_string,message:a.message}),n.dirty()):a.kind==="cidr"?VR(t.data,a.version)||(s=this._getOrReturnCtx(t,s),Q(s,{validation:"cidr",code:H.invalid_string,message:a.message}),n.dirty()):a.kind==="base64"?FR.test(t.data)||(s=this._getOrReturnCtx(t,s),Q(s,{validation:"base64",code:H.invalid_string,message:a.message}),n.dirty()):a.kind==="base64url"?UR.test(t.data)||(s=this._getOrReturnCtx(t,s),Q(s,{validation:"base64url",code:H.invalid_string,message:a.message}),n.dirty()):Ne.assertNever(a);return{status:n.value,value:t.data}}_regex(t,r,n){return this.refinement(s=>t.test(s),{validation:r,code:H.invalid_string,...X.errToObj(n)})}_addCheck(t){return new rs({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...X.errToObj(t)})}url(t){return this._addCheck({kind:"url",...X.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...X.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...X.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...X.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...X.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...X.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...X.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...X.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...X.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...X.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...X.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...X.errToObj(t)})}datetime(t){return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof(t==null?void 0:t.precision)>"u"?null:t==null?void 0:t.precision,offset:(t==null?void 0:t.offset)??!1,local:(t==null?void 0:t.local)??!1,...X.errToObj(t==null?void 0:t.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof(t==null?void 0:t.precision)>"u"?null:t==null?void 0:t.precision,...X.errToObj(t==null?void 0:t.message)})}duration(t){return this._addCheck({kind:"duration",...X.errToObj(t)})}regex(t,r){return this._addCheck({kind:"regex",regex:t,...X.errToObj(r)})}includes(t,r){return this._addCheck({kind:"includes",value:t,position:r==null?void 0:r.position,...X.errToObj(r==null?void 0:r.message)})}startsWith(t,r){return this._addCheck({kind:"startsWith",value:t,...X.errToObj(r)})}endsWith(t,r){return this._addCheck({kind:"endsWith",value:t,...X.errToObj(r)})}min(t,r){return this._addCheck({kind:"min",value:t,...X.errToObj(r)})}max(t,r){return this._addCheck({kind:"max",value:t,...X.errToObj(r)})}length(t,r){return this._addCheck({kind:"length",value:t,...X.errToObj(r)})}
vendor: 5,026 bytes, line 500
500nonempty(t){return this.min(1,X.errToObj(t))}trim(){return new rs({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new rs({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new rs({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isCIDR(){return!!this._def.checks.find(t=>t.kind==="cidr")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get isBase64url(){return!!this._def.checks.find(t=>t.kind==="base64url")}get minLength(){let t=null;for(const r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxLength(){let t=null;for(const r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}}rs.create=e=>new rs({checks:[],typeName:me.ZodString,coerce:(e==null?void 0:e.coerce)??!1,...ve(e)});function GR(e,t){const r=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,s=r>n?r:n,a=Number.parseInt(e.toFixed(s).replace(".","")),o=Number.parseInt(t.toFixed(s).replace(".",""));return a%o/10**s}class tl extends ke{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==Z.number){const a=this._getOrReturnCtx(t);return Q(a,{code:H.invalid_type,expected:Z.number,received:a.parsedType}),fe}let n;const s=new Gt;for(const a of this._def.checks)a.kind==="int"?Ne.isInteger(t.data)||(n=this._getOrReturnCtx(t,n),Q(n,{code:H.invalid_type,expected:"integer",received:"float",message:a.message}),s.dirty()):a.kind==="min"?(a.inclusive?t.data<a.value:t.data<=a.value)&&(n=this._getOrReturnCtx(t,n),Q(n,{code:H.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),s.dirty()):a.kind==="max"?(a.inclusive?t.data>a.value:t.data>=a.value)&&(n=this._getOrReturnCtx(t,n),Q(n,{code:H.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),s.dirty()):a.kind==="multipleOf"?GR(t.data,a.value)!==0&&(n=this._getOrReturnCtx(t,n),Q(n,{code:H.not_multiple_of,multipleOf:a.value,message:a.message}),s.dirty()):a.kind==="finite"?Number.isFinite(t.data)||(n=this._getOrReturnCtx(t,n),Q(n,{code:H.not_finite,message:a.message}),s.dirty()):Ne.assertNever(a);return{status:s.value,value:t.data}}gte(t,r){return this.setLimit("min",t,!0,X.toString(r))}gt(t,r){return this.setLimit("min",t,!1,X.toString(r))}lte(t,r){return this.setLimit("max",t,!0,X.toString(r))}lt(t,r){return this.setLimit("max",t,!1,X.toString(r))}setLimit(t,r,n,s){return new tl({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:X.toString(s)}]})}_addCheck(t){return new tl({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:X.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:X.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:X.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:X.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:X.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:X.toString(r)})}finite(t){return this._addCheck({kind:"finite",message:X.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:X.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:X.toString(t)})}get minValue(){let t=null;for(const r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(const r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}get isInt(){return!!this._def.checks.find(t=>t.kind==="int"||t.kind==="multipleOf"&&Ne.isInteger(t.value))}get isFinite(){let t=null,r=null;for(const n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(t===null||n.value<t)&&(t=n.value)}return Number.isFinite(r)&&Number.isFinite(t)}
vendor: 6,660 bytes, line 500
500}tl.create=e=>new tl({checks:[],typeName:me.ZodNumber,coerce:(e==null?void 0:e.coerce)||!1,...ve(e)});class rl extends ke{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce)try{t.data=BigInt(t.data)}catch{return this._getInvalidInput(t)}if(this._getType(t)!==Z.bigint)return this._getInvalidInput(t);let n;const s=new Gt;for(const a of this._def.checks)a.kind==="min"?(a.inclusive?t.data<a.value:t.data<=a.value)&&(n=this._getOrReturnCtx(t,n),Q(n,{code:H.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),s.dirty()):a.kind==="max"?(a.inclusive?t.data>a.value:t.data>=a.value)&&(n=this._getOrReturnCtx(t,n),Q(n,{code:H.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),s.dirty()):a.kind==="multipleOf"?t.data%a.value!==BigInt(0)&&(n=this._getOrReturnCtx(t,n),Q(n,{code:H.not_multiple_of,multipleOf:a.value,message:a.message}),s.dirty()):Ne.assertNever(a);return{status:s.value,value:t.data}}_getInvalidInput(t){const r=this._getOrReturnCtx(t);return Q(r,{code:H.invalid_type,expected:Z.bigint,received:r.parsedType}),fe}gte(t,r){return this.setLimit("min",t,!0,X.toString(r))}gt(t,r){return this.setLimit("min",t,!1,X.toString(r))}lte(t,r){return this.setLimit("max",t,!0,X.toString(r))}lt(t,r){return this.setLimit("max",t,!1,X.toString(r))}setLimit(t,r,n,s){return new rl({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:X.toString(s)}]})}_addCheck(t){return new rl({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:X.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:X.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:X.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:X.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:X.toString(r)})}get minValue(){let t=null;for(const r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(const r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}}rl.create=e=>new rl({checks:[],typeName:me.ZodBigInt,coerce:(e==null?void 0:e.coerce)??!1,...ve(e)});class Nx extends ke{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==Z.boolean){const n=this._getOrReturnCtx(t);return Q(n,{code:H.invalid_type,expected:Z.boolean,received:n.parsedType}),fe}return cr(t.data)}}Nx.create=e=>new Nx({typeName:me.ZodBoolean,coerce:(e==null?void 0:e.coerce)||!1,...ve(e)});class mu extends ke{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==Z.date){const a=this._getOrReturnCtx(t);return Q(a,{code:H.invalid_type,expected:Z.date,received:a.parsedType}),fe}if(Number.isNaN(t.data.getTime())){const a=this._getOrReturnCtx(t);return Q(a,{code:H.invalid_date}),fe}const n=new Gt;let s;for(const a of this._def.checks)a.kind==="min"?t.data.getTime()<a.value&&(s=this._getOrReturnCtx(t,s),Q(s,{code:H.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),n.dirty()):a.kind==="max"?t.data.getTime()>a.value&&(s=this._getOrReturnCtx(t,s),Q(s,{code:H.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),n.dirty()):Ne.assertNever(a);return{status:n.value,value:new Date(t.data.getTime())}}_addCheck(t){return new mu({...this._def,checks:[...this._def.checks,t]})}min(t,r){return this._addCheck({kind:"min",value:t.getTime(),message:X.toString(r)})}max(t,r){return this._addCheck({kind:"max",value:t.getTime(),message:X.toString(r)})}get minDate(){let t=null;for(const r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(const r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t!=null?new Date(t):null}}mu.create=e=>new mu({checks:[],coerce:(e==null?void 0:e.coerce)||!1,typeName:me.ZodDate,...ve(e)});class Cx extends ke{_parse(t){if(this._getType(t)!==Z.symbol){const n=this._getOrReturnCtx(t);return Q(n,{code:H.invalid_type,expected:Z.symbol,received:n.parsedType}),fe}return cr(t.data)}}Cx.create=e=>new Cx({typeName:me.ZodSymbol,...ve(e)});class Ex extends ke{_parse(t){if(this._getType(t)!==Z.undefined){const n=this._getOrReturnCtx(t);return Q(n,{code:H.invalid_type,expected:Z.undefined,received:n.parsedType}),fe}return cr(t.data)}}Ex.create=e=>new Ex({typeName:me.ZodUndefined,...ve(e)});class Tx extends ke{_parse(t){if(this._getType(t)!==Z.null){const n=this._getOrReturnCtx(t);return Q(n,{code:H.invalid_type,expected:Z.null,received:n.parsedType}),fe}return cr(t.data)}}Tx.create=e=>new Tx({typeName:me.ZodNull,...ve(e)});class Px extends ke{constructor(){super(...arguments),this._any=!0}_parse(t){return cr(t.data)}}Px.create=e=>new Px({typeName:me.ZodAny,...ve(e)});class Ax extends ke{constructor(){super(...arguments),this._unknown=!0}_parse(t){return cr(t.data)}}Ax.create=e=>new Ax({typeName:me.ZodUnknown,...ve(e)});class bs extends ke{_parse(t){const r=this._getOrReturnCtx(t);return Q(r,{code:H.invalid_type,expected:Z.never,received:r.parsedType}),fe}}bs.create=e=>new bs({typeName:me.ZodNever,...ve(e)});class Rx extends ke{_parse(t){if(this._getType(t)!==Z.undefined){const n=this._getOrReturnCtx(t);return Q(n,{code:H.invalid_type,expected:Z.void,received:n.parsedType}),fe}return cr(t.data)}}Rx.create=e=>new Rx({typeName:me.ZodVoid,...ve(e)});class Kr extends ke{_parse(t){const{ctx:r,status:n}=this._processInputParams(t),s=this._def;if(r.parsedType!==Z.array)return Q(r,{code:H.invalid_type,expected:Z.array,received:r.parsedType}),fe;if(s.exactLength!==null){const o=r.data.length>s.exactLength.value,l=r.data.length<s.exactLength.value;(o||l)&&(Q(r,{code:o?H.too_big:H.too_small,minimum:l?s.exactLength.value:void 0,maximum:o?s.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:s.exactLength.message}),n.dirty())}if(s.minLength!==null&&r.data.length<s.minLength.value&&(Q(r,{code:H.too_small,minimum:s.minLength.value,type:"array",inclusive:!0,exact:!1,message:s.minLength.message}),n.dirty()),s.maxLength!==null&&r.data.length>s.maxLength.value&&(Q(r,{code:H.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((o,l)=>s.type._parseAsync(new ws(r,o,r.path,l)))).then(o=>Gt.mergeArray(n,o));const a=[...r.data].map((o,l)=>s.type._parseSync(new ws(r,o,r.path,l)));return Gt.mergeArray(n,a)}
vendor: 4,443 bytes, line 500
500get element(){return this._def.type}min(t,r){return new Kr({...this._def,minLength:{value:t,message:X.toString(r)}})}max(t,r){return new Kr({...this._def,maxLength:{value:t,message:X.toString(r)}})}length(t,r){return new Kr({...this._def,exactLength:{value:t,message:X.toString(r)}})}nonempty(t){return this.min(1,t)}}Kr.create=(e,t)=>new Kr({type:e,minLength:null,maxLength:null,exactLength:null,typeName:me.ZodArray,...ve(t)});function Ma(e){if(e instanceof Ge){const t={};for(const r in e.shape){const n=e.shape[r];t[r]=fs.create(Ma(n))}return new Ge({...e._def,shape:()=>t})}else return e instanceof Kr?new Kr({...e._def,type:Ma(e.element)}):e instanceof fs?fs.create(Ma(e.unwrap())):e instanceof Ei?Ei.create(Ma(e.unwrap())):e instanceof oa?oa.create(e.items.map(t=>Ma(t))):e}class Ge extends ke{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const t=this._def.shape(),r=Ne.objectKeys(t);return this._cached={shape:t,keys:r},this._cached}_parse(t){if(this._getType(t)!==Z.object){const u=this._getOrReturnCtx(t);return Q(u,{code:H.invalid_type,expected:Z.object,received:u.parsedType}),fe}const{status:n,ctx:s}=this._processInputParams(t),{shape:a,keys:o}=this._getCached(),l=[];if(!(this._def.catchall instanceof bs&&this._def.unknownKeys==="strip"))for(const u in s.data)o.includes(u)||l.push(u);const c=[];for(const u of o){const d=a[u],h=s.data[u];c.push({key:{status:"valid",value:u},value:d._parse(new ws(s,h,s.path,u)),alwaysSet:u in s.data})}if(this._def.catchall instanceof bs){const u=this._def.unknownKeys;if(u==="passthrough")for(const d of l)c.push({key:{status:"valid",value:d},value:{status:"valid",value:s.data[d]}});else if(u==="strict")l.length>0&&(Q(s,{code:H.unrecognized_keys,keys:l}),n.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const u=this._def.catchall;for(const d of l){const h=s.data[d];c.push({key:{status:"valid",value:d},value:u._parse(new ws(s,h,s.path,d)),alwaysSet:d in s.data})}}return s.common.async?Promise.resolve().then(async()=>{const u=[];for(const d of c){const h=await d.key,m=await d.value;u.push({key:h,value:m,alwaysSet:d.alwaysSet})}return u}).then(u=>Gt.mergeObjectSync(n,u)):Gt.mergeObjectSync(n,c)}get shape(){return this._def.shape()}strict(t){return X.errToObj,new Ge({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(r,n)=>{var a,o;const s=((o=(a=this._def).errorMap)==null?void 0:o.call(a,r,n).message)??n.defaultError;return r.code==="unrecognized_keys"?{message:X.errToObj(t).message??s}:{message:s}}}:{}})}strip(){return new Ge({...this._def,unknownKeys:"strip"})}passthrough(){return new Ge({...this._def,unknownKeys:"passthrough"})}extend(t){return new Ge({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new Ge({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:me.ZodObject})}setKey(t,r){return this.augment({[t]:r})}catchall(t){return new Ge({...this._def,catchall:t})}pick(t){const r={};for(const n of Ne.objectKeys(t))t[n]&&this.shape[n]&&(r[n]=this.shape[n]);return new Ge({...this._def,shape:()=>r})}omit(t){const r={};for(const n of Ne.objectKeys(this.shape))t[n]||(r[n]=this.shape[n]);return new Ge({...this._def,shape:()=>r})}deepPartial(){return Ma(this)}partial(t){const r={};for(const n of Ne.objectKeys(this.shape)){const s=this.shape[n];t&&!t[n]?r[n]=s:r[n]=s.optional()}return new Ge({...this._def,shape:()=>r})}required(t){const r={};for(const n of Ne.objectKeys(this.shape))if(t&&!t[n])r[n]=this.shape[n];else{let a=this.shape[n];for(;a instanceof fs;)a=a._def.innerType;r[n]=a}return new Ge({...this._def,shape:()=>r})}keyof(){return G1(Ne.objectKeys(this.shape))}}Ge.create=(e,t)=>new Ge({shape:()=>e,unknownKeys:"strip",catchall:bs.create(),typeName:me.ZodObject,...ve(t)});Ge.strictCreate=(e,t)=>new Ge({shape:()=>e,unknownKeys:"strict",catchall:bs.create(),typeName:me.ZodObject,...ve(t)});Ge.lazycreate=(e,t)=>new Ge({shape:e,unknownKeys:"strip",catchall:bs.create(),typeName:me.ZodObject,...ve(t)});class pu extends ke{_parse(t){const{ctx:r}=this._processInputParams(t),n=this._def.options;function s(a){for(const l of a)if(l.result.status==="valid")return l.result;for(const l of a)if(l.result.status==="dirty")return r.common.issues.push(...l.ctx.common.issues),l.result;
vendor: 3,366 bytes, line 500
500const o=a.map(l=>new kn(l.ctx.common.issues));return Q(r,{code:H.invalid_union,unionErrors:o}),fe}if(r.common.async)return Promise.all(n.map(async a=>{const o={...r,common:{...r.common,issues:[]},parent:null};return{result:await a._parseAsync({data:r.data,path:r.path,parent:o}),ctx:o}})).then(s);{let a;const o=[];for(const c of n){const u={...r,common:{...r.common,issues:[]},parent:null},d=c._parseSync({data:r.data,path:r.path,parent:u});if(d.status==="valid")return d;d.status==="dirty"&&!a&&(a={result:d,ctx:u}),u.common.issues.length&&o.push(u.common.issues)}if(a)return r.common.issues.push(...a.ctx.common.issues),a.result;const l=o.map(c=>new kn(c));return Q(r,{code:H.invalid_union,unionErrors:l}),fe}}get options(){return this._def.options}}pu.create=(e,t)=>new pu({options:e,typeName:me.ZodUnion,...ve(t)});function Vf(e,t){const r=Wn(e),n=Wn(t);if(e===t)return{valid:!0,data:e};if(r===Z.object&&n===Z.object){const s=Ne.objectKeys(t),a=Ne.objectKeys(e).filter(l=>s.indexOf(l)!==-1),o={...e,...t};for(const l of a){const c=Vf(e[l],t[l]);if(!c.valid)return{valid:!1};o[l]=c.data}return{valid:!0,data:o}}else if(r===Z.array&&n===Z.array){if(e.length!==t.length)return{valid:!1};const s=[];for(let a=0;a<e.length;a++){const o=e[a],l=t[a],c=Vf(o,l);if(!c.valid)return{valid:!1};s.push(c.data)}return{valid:!0,data:s}}else return r===Z.date&&n===Z.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}class gu extends ke{_parse(t){const{status:r,ctx:n}=this._processInputParams(t),s=(a,o)=>{if(jx(a)||jx(o))return fe;const l=Vf(a.value,o.value);return l.valid?((kx(a)||kx(o))&&r.dirty(),{status:r.value,value:l.data}):(Q(n,{code:H.invalid_intersection_types}),fe)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([a,o])=>s(a,o)):s(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}}gu.create=(e,t,r)=>new gu({left:e,right:t,typeName:me.ZodIntersection,...ve(r)});class oa extends ke{_parse(t){const{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==Z.array)return Q(n,{code:H.invalid_type,expected:Z.array,received:n.parsedType}),fe;if(n.data.length<this._def.items.length)return Q(n,{code:H.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),fe;!this._def.rest&&n.data.length>this._def.items.length&&(Q(n,{code:H.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());const a=[...n.data].map((o,l)=>{const c=this._def.items[l]||this._def.rest;return c?c._parse(new ws(n,o,n.path,l)):null}).filter(o=>!!o);return n.common.async?Promise.all(a).then(o=>Gt.mergeArray(r,o)):Gt.mergeArray(r,a)}get items(){return this._def.items}rest(t){return new oa({...this._def,rest:t})}}oa.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new oa({items:e,typeName:me.ZodTuple,rest:null,...ve(t)})};class Ox extends ke{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==Z.map)return Q(n,{code:H.invalid_type,expected:Z.map,received:n.parsedType}),fe;const s=this._def.keyType,a=this._def.valueType,o=[...n.data.entries()].map(([l,c],u)=>
vendor: 4,152 bytes, line 500
500({key:s._parse(new ws(n,l,n.path,[u,"key"])),value:a._parse(new ws(n,c,n.path,[u,"value"]))}));if(n.common.async){const l=new Map;return Promise.resolve().then(async()=>{for(const c of o){const u=await c.key,d=await c.value;if(u.status==="aborted"||d.status==="aborted")return fe;(u.status==="dirty"||d.status==="dirty")&&r.dirty(),l.set(u.value,d.value)}return{status:r.value,value:l}})}else{const l=new Map;for(const c of o){const u=c.key,d=c.value;if(u.status==="aborted"||d.status==="aborted")return fe;(u.status==="dirty"||d.status==="dirty")&&r.dirty(),l.set(u.value,d.value)}return{status:r.value,value:l}}}}Ox.create=(e,t,r)=>new Ox({valueType:t,keyType:e,typeName:me.ZodMap,...ve(r)});class nl extends ke{_parse(t){const{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==Z.set)return Q(n,{code:H.invalid_type,expected:Z.set,received:n.parsedType}),fe;const s=this._def;s.minSize!==null&&n.data.size<s.minSize.value&&(Q(n,{code:H.too_small,minimum:s.minSize.value,type:"set",inclusive:!0,exact:!1,message:s.minSize.message}),r.dirty()),s.maxSize!==null&&n.data.size>s.maxSize.value&&(Q(n,{code:H.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),r.dirty());const a=this._def.valueType;function o(c){const u=new Set;for(const d of c){if(d.status==="aborted")return fe;d.status==="dirty"&&r.dirty(),u.add(d.value)}return{status:r.value,value:u}}const l=[...n.data.values()].map((c,u)=>a._parse(new ws(n,c,n.path,u)));return n.common.async?Promise.all(l).then(c=>o(c)):o(l)}min(t,r){return new nl({...this._def,minSize:{value:t,message:X.toString(r)}})}max(t,r){return new nl({...this._def,maxSize:{value:t,message:X.toString(r)}})}size(t,r){return this.min(t,r).max(t,r)}nonempty(t){return this.min(1,t)}}nl.create=(e,t)=>new nl({valueType:e,minSize:null,maxSize:null,typeName:me.ZodSet,...ve(t)});class Ix extends ke{get schema(){return this._def.getter()}_parse(t){const{ctx:r}=this._processInputParams(t);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}}Ix.create=(e,t)=>new Ix({getter:e,typeName:me.ZodLazy,...ve(t)});class Mx extends ke{_parse(t){if(t.data!==this._def.value){const r=this._getOrReturnCtx(t);return Q(r,{received:r.data,code:H.invalid_literal,expected:this._def.value}),fe}return{status:"valid",value:t.data}}get value(){return this._def.value}}Mx.create=(e,t)=>new Mx({value:e,typeName:me.ZodLiteral,...ve(t)});function G1(e,t){return new Ni({values:e,typeName:me.ZodEnum,...ve(t)})}class Ni extends ke{_parse(t){if(typeof t.data!="string"){const r=this._getOrReturnCtx(t),n=this._def.values;return Q(r,{expected:Ne.joinValues(n),received:r.parsedType,code:H.invalid_type}),fe}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(t.data)){const r=this._getOrReturnCtx(t),n=this._def.values;return Q(r,{received:r.data,code:H.invalid_enum_value,options:n}),fe}return cr(t.data)}get options(){return this._def.values}get enum(){const t={};for(const r of this._def.values)t[r]=r;return t}get Values(){const t={};for(const r of this._def.values)t[r]=r;return t}get Enum(){const t={};for(const r of this._def.values)t[r]=r;return t}extract(t,r=this._def){return Ni.create(t,{...this._def,...r})}exclude(t,r=this._def){return Ni.create(this.options.filter(n=>!t.includes(n)),{...this._def,...r})}}Ni.create=G1;class Dx extends ke{_parse(t){const r=Ne.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(t);if(n.parsedType!==Z.string&&n.parsedType!==Z.number){const s=Ne.objectValues(r);return Q(n,{expected:Ne.joinValues(s),received:n.parsedType,code:H.invalid_type}),fe}if(this._cache||(this._cache=new Set(Ne.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){const s=Ne.objectValues(r);return Q(n,{received:n.data,code:H.invalid_enum_value,options:s}),fe}return cr(t.data)}get enum(){return this._def.values}}Dx.create=(e,t)=>new Dx({values:e,typeName:me.ZodNativeEnum,...ve(t)});class xu extends ke{unwrap(){return this._def.type}_parse(t){const{ctx:r}=this._processInputParams(t);if(r.parsedType!==Z.promise&&r.common.async===!1)return Q(r,{code:H.invalid_type,expected:Z.promise,received:r.parsedType}),fe;
vendor: 4,089 bytes, line 500
500const n=r.parsedType===Z.promise?r.data:Promise.resolve(r.data);return cr(n.then(s=>this._def.type.parseAsync(s,{path:r.path,errorMap:r.common.contextualErrorMap})))}}xu.create=(e,t)=>new xu({type:e,typeName:me.ZodPromise,...ve(t)});class Ci extends ke{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===me.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){const{status:r,ctx:n}=this._processInputParams(t),s=this._def.effect||null,a={addIssue:o=>{Q(n,o),o.fatal?r.abort():r.dirty()},get path(){return n.path}};if(a.addIssue=a.addIssue.bind(a),s.type==="preprocess"){const o=s.transform(n.data,a);if(n.common.async)return Promise.resolve(o).then(async l=>{if(r.value==="aborted")return fe;const c=await this._def.schema._parseAsync({data:l,path:n.path,parent:n});return c.status==="aborted"?fe:c.status==="dirty"||r.value==="dirty"?co(c.value):c});{if(r.value==="aborted")return fe;const l=this._def.schema._parseSync({data:o,path:n.path,parent:n});return l.status==="aborted"?fe:l.status==="dirty"||r.value==="dirty"?co(l.value):l}}if(s.type==="refinement"){const o=l=>{const c=s.refinement(l,a);if(n.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return l};if(n.common.async===!1){const l=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return l.status==="aborted"?fe:(l.status==="dirty"&&r.dirty(),o(l.value),{status:r.value,value:l.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(l=>l.status==="aborted"?fe:(l.status==="dirty"&&r.dirty(),o(l.value).then(()=>({status:r.value,value:l.value}))))}if(s.type==="transform")if(n.common.async===!1){const o=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!Si(o))return fe;const l=s.transform(o.value,a);if(l instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:l}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(o=>Si(o)?Promise.resolve(s.transform(o.value,a)).then(l=>({status:r.value,value:l})):fe);Ne.assertNever(s)}}Ci.create=(e,t,r)=>new Ci({schema:e,typeName:me.ZodEffects,effect:t,...ve(r)});Ci.createWithPreprocess=(e,t,r)=>new Ci({schema:t,effect:{type:"preprocess",transform:e},typeName:me.ZodEffects,...ve(r)});class fs extends ke{_parse(t){return this._getType(t)===Z.undefined?cr(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}fs.create=(e,t)=>new fs({innerType:e,typeName:me.ZodOptional,...ve(t)});class Ei extends ke{_parse(t){return this._getType(t)===Z.null?cr(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}Ei.create=(e,t)=>new Ei({innerType:e,typeName:me.ZodNullable,...ve(t)});class Gf extends ke{_parse(t){const{ctx:r}=this._processInputParams(t);let n=r.data;return r.parsedType===Z.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}}Gf.create=(e,t)=>new Gf({innerType:e,typeName:me.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...ve(t)});class Yf extends ke{_parse(t){const{ctx:r}=this._processInputParams(t),n={...r,common:{...r.common,issues:[]}},s=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return fu(s)?s.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new kn(n.common.issues)},input:n.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new kn(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}Yf.create=(e,t)=>new Yf({innerType:e,typeName:me.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...ve(t)});class Lx extends ke{_parse(t){if(this._getType(t)!==Z.nan){const n=this._getOrReturnCtx(t);return Q(n,{code:H.invalid_type,expected:Z.nan,received:n.parsedType}),fe}
500return{status:"valid",value:t.data}}}Lx.create=e=>new Lx({typeName:me.ZodNaN,...ve(e)});class YR extends ke{_parse(t){const{ctx:r}=this._processInputParams(t),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}}class Dp extends ke{_parse(t){const{status:r,ctx:n}=this._processInputParams(t);if(n.common.async)return(async()=>{const a=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?fe:a.status==="dirty"?(r.dirty(),co(a.value)):this._def.out._parseAsync({data:a.value,path:n.path,parent:n})})();{const s=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?fe:s.status==="dirty"?(r.dirty(),{status:"dirty",value:s.value}):this._def.out._parseSync({data:s.value,path:n.path,parent:n})}}static create(t,r){return new Dp({in:t,out:r,typeName:me.ZodPipeline})}}class Kf extends ke{_parse(t){const r=this._def.innerType._parse(t),n=s=>(Si(s)&&(s.value=Object.freeze(s.value)),s);return fu(r)?r.then(s=>n(s)):n(r)}unwrap(){return this._def.innerType}}Kf.create=(e,t)=>new Kf({innerType:e,typeName:me.ZodReadonly,...ve(t)});Ge.lazycreate;var me;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(me||(me={}));const yu=rs.create;bs.create;Kr.create;const Y1=Ge.create;Ge.strictCreate;pu.create;gu.create;oa.create;Ni.create;xu.create;fs.create;Ei.create;const et=p.forwardRef(({className:e,type:t,...r},n)=>i.jsx("input",{type:t,className:ce("flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-base ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",e),ref:n,...r}));et.displayName="Input";var KR="Label",K1=p.forwardRef((e,t)=>i.jsx(ue.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())}}));K1.displayName=KR;var Q1=K1;const QR=Vu("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),Ue=p.forwardRef(({className:e,...t},r)=>i.jsx(Q1,{ref:r,className:ce(QR(),e),...t}));Ue.displayName=Q1.displayName;const JR="mathly.student",ZR=Y1({username:yu().trim().min(3,"Username must be at least 3 characters").max(30,"Username must be less than 30 characters").regex(/^[a-zA-Z0-9_]+$/,"Only letters, numbers and underscores allowed"),password:yu().min(6,"Password must be at least 6 characters")}),XR=({onBack:e,onSubmit:t,isSubmitting:r})=>{const[n,s]=p.useState(!0),[a,o]=p.useState(""),[l,c]=p.useState(""),[u,d]=p.useState({}),h=()=>{const f=ZR.safeParse({username:a,password:l});if(!f.success){const b={};return f.error.errors.forEach(g=>{g.path[0]==="username"&&(b.username=g.message),g.path[0]==="password"&&(b.password=g.message)}),d(b),!1}return d({}),!0},m=async f=>{if(f.preventDefault(),!h())return;const b=`${a.toLowerCase().trim()}@${JR}`;await t(b,l,a.trim(),n)};return i.jsxs("div",{className:"flex min-h-screen flex-col bg-background",children:[i.jsx("header",{className:"p-4",children:i.jsxs("button",{onClick:e,className:"inline-flex items-center gap-1 text-muted-foreground hover:text-foreground transition-colors",children:[i.jsx(Tr,{className:"w-4 h-4"}),i.jsx("span",{className:"text-sm",children:"Back"})]})}),i.jsx("div",{className:"flex-1 flex items-center justify-center px-4 pb-8",children:i.jsxs(z,{className:"w-full max-w-md
500shadow-card",children:[i.jsxs(ad,{className:"space-y-1 text-center",children:[i.jsx("div",{className:"mx-auto mb-4 flex h-14 w-14 items-center justify-center rounded-2xl gradient-primary",children:i.jsx(tn,{className:"h-7 w-7 text-white"})}),i.jsx(id,{className:"text-2xl font-bold",children:n?"Welcome back, student!":"Create your account"}),i.jsx(Ip,{children:n?"Enter your username and password to continue":"Choose a username to get started"})]}),i.jsxs("form",{onSubmit:m,children:[i.jsxs(B,{className:"space-y-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx(Ue,{htmlFor:"username",children:"Username"}),i.jsxs("div",{className:"relative",children:[i.jsx(jb,{className:"absolute left-3 top-3 h-5 w-5 text-muted-foreground"}),i.jsx(et,{id:"username",type:"text",placeholder:"e.g. mathswizard123",value:a,onChange:f=>o(f.target.value),className:"pl-11 h-12",disabled:r,autoComplete:"username"})]}),u.username&&i.jsx("p",{className:"text-sm text-destructive",children:u.username})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(Ue,{htmlFor:"password",children:"Password"}),i.jsxs("div",{className:"relative",children:[i.jsx(wb,{className:"absolute left-3 top-3 h-5 w-5 text-muted-foreground"}),i.jsx(et,{id:"password",type:"password",placeholder:"â¢â¢â¢â¢â¢â¢â¢â¢",value:l,onChange:f=>c(f.target.value),className:"pl-11 h-12",disabled:r,autoComplete:n?"current-password":"new-password"})]}),u.password&&i.jsx("p",{className:"text-sm text-destructive",children:u.password})]})]}),i.jsxs(Mp,{className:"flex flex-col space-y-4",children:[i.jsx(ne,{type:"submit",className:"w-full h-12 gradient-primary text-white border-0",disabled:r,children:r?i.jsxs(i.Fragment,{children:[i.jsx($e,{className:"mr-2 h-5 w-5 animate-spin"}),n?"Signing in...":"Creating account..."]}):i.jsx(i.Fragment,{children:n?"Sign in":"Create account"})}),i.jsxs("p",{className:"text-center text-sm text-muted-foreground",children:[n?"Don't have an account?":"Already have an account?"," ",i.jsx("button",{type:"button",onClick:()=>{s(!n),d({})},className:"font-semibold text-primary hover:underline",children:n?"Sign up":"Sign in"})]})]})]})]})})]})},e3=Y1({email:yu().trim().email({message:"Please enter a valid email address"}),password:yu().min(6,{message:"Password must be at least 6 characters"})}),t3=({role:e,onBack:t,onSubmit:r,isSubmitting:n})=>{const[s,a]=p.useState(!0),[o,l]=p.useState(""),[c,u]=p.useState(""),[d,h]=p.useState({}),m=e==="parent",f=m?wt:dp,b=m?"Parent":"Teacher",g=()=>{const x=e3.safeParse({email:o,password:c});if(!x.success){const y={};return x.error.errors.forEach(w=>{w.path[0]==="email"&&(y.email=w.message),w.path[0]==="password"&&(y.password=w.message)}),h(y),!1}return h({}),!0},v=async x=>{x.preventDefault(),g()&&await r(o.trim(),c,s)};return i.jsxs("div",{className:"flex min-h-screen flex-col bg-background",children:[i.jsx("header",{className:"p-4",children:i.jsxs("button",{onClick:t,className:"inline-flex items-center gap-1 text-muted-foreground hover:text-foreground transition-colors",children:[i.jsx(Tr,{className:"w-4 h-4"}),i.jsx("span",{className:"text-sm",children:"Back"})]})}),i.jsx("div",{className:"flex-1 flex items-center justify-center px-4 pb-8",children:i.jsxs(z,{className:"w-full max-w-md
500shadow-card",children:[i.jsxs(ad,{className:"space-y-1 text-center",children:[i.jsx("div",{className:"mx-auto mb-4 flex h-14 w-14 items-center justify-center rounded-2xl gradient-primary",children:i.jsx(f,{className:"h-7 w-7 text-white"})}),i.jsx(id,{className:"text-2xl font-bold",children:s?"Welcome back!":`${b} sign up`}),i.jsx(Ip,{children:s?`Sign in to your ${b.toLowerCase()} account`:`Create your ${b.toLowerCase()} account to track ${m?"your child's":"your students'"} progress`})]}),i.jsxs("form",{onSubmit:v,children:[i.jsxs(B,{className:"space-y-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx(Ue,{htmlFor:"email",children:"Email"}),i.jsxs("div",{className:"relative",children:[i.jsx(cp,{className:"absolute left-3 top-3 h-5 w-5 text-muted-foreground"}),i.jsx(et,{id:"email",type:"email",placeholder:"[email protected]",value:o,onChange:x=>l(x.target.value),className:"pl-11 h-12",disabled:n,autoComplete:"email"})]}),d.email&&i.jsx("p",{className:"text-sm text-destructive",children:d.email})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(Ue,{htmlFor:"password",children:"Password"}),i.jsxs("div",{className:"relative",children:[i.jsx(wb,{className:"absolute left-3 top-3 h-5 w-5 text-muted-foreground"}),i.jsx(et,{id:"password",type:"password",placeholder:"â¢â¢â¢â¢â¢â¢â¢â¢",value:c,onChange:x=>u(x.target.value),className:"pl-11 h-12",disabled:n,autoComplete:s?"current-password":"new-password"})]}),d.password&&i.jsx("p",{className:"text-sm text-destructive",children:d.password})]})]}),i.jsxs(Mp,{className:"flex flex-col space-y-4",children:[i.jsx(ne,{type:"submit",className:"w-full h-12 gradient-primary text-white border-0",disabled:n,children:n?i.jsxs(i.Fragment,{children:[i.jsx($e,{className:"mr-2 h-5 w-5 animate-spin"}),s?"Signing in...":"Creating account..."]}):i.jsx(i.Fragment,{children:s?"Sign in":"Create account"})}),i.jsxs("p",{className:"text-center text-sm text-muted-foreground",children:[s?"Don't have an account?":"Already have an account?"," ",i.jsx("button",{type:"button",onClick:()=>{a(!s),h({})},className:"font-semibold text-primary hover:underline",children:s?"Sign up":"Sign in"})]})]})]})]})})]})},r3=()=>{const[e,t]=p.useState(null),[r,n]=p.useState(!1),{signIn:s,signUp:a,user:o,loading:l}=st(),c=pa(),{toast:u}=en();p.useEffect(()=>{(async()=>{if(!l&&o){await new Promise(b=>setTimeout(b,800));const{data:f}=await F.from("profiles").select("onboarding_completed, role").eq("id",o.id).maybeSingle();(f==null?void 0:f.role)==="parent"||(f==null?void 0:f.role)==="teacher"||f!=null&&f.onboarding_completed?c("/dashboard",{replace:!0}):c("/onboarding",{replace:!0})}})()},[o,l,c]);const d=async(m,f,b,g)=>{n(!0);try{if(g){const{error:v}=await s(m,f);u(v?{variant:"destructive",title:"Login failed",description:v.message.includes("Invalid login credentials")?"Invalid username or password. Please try again.":v.message}:{title:"Welcome back! ð",description:"Great to see you again."})}else{const{error:v}=await a(m,f);v?u({variant:"destructive",title:"Sign up failed",description:v.message.includes("User already registered")?"This username is already taken. Please choose another or sign in.":v.message}):(setTimeout(async()=>{const{data:{session:x}}=await F.auth.getSession();x!=null&&x.user&&(await F.from("profiles").update({username:b,display_name:b,role:"student"}).eq("id",x.user.id),await F.rpc("assign_student_role",{_user_id:x.user.id}))},500),u({title:"Account created! ð",description:"Welcome to Mathly!"}))}}finally{n(!1)}},h=async(m,f,b)=>{n(!0);try{if(b){const{error:g}=await s(m,f);u(g?{variant:"destructive",title:"Login failed",description:g.message.includes("Invalid login credentials")?"Invalid email or password. Please try again.":g.message}:{title:"Welcome back! ð",description:"Great to see you again."})}else{const{error:g}=await a(m,f);g?u({variant:"destructive",title:"Sign up failed",description:g.message.includes("User already registered")?"An account with this email already exists. Please sign in instead.":g.message}):(setTimeout(async()=>{const{data:{session:v}}=await F.auth.getSession();v!=null&&v.user&&(await F.from("profiles").update({role:e,display_name:m.split("@")[0],onboarding_completed:!0}).eq("id",v.user.id),await F.rpc("assign_guardian_role",{_user_id:v.user.id,_role:e}))},500),u({title:"Account created! ð",description:"Check your email to verify, or sign in if email confirmation is disabled."}))}}finally{n(!1)}};return l?i.jsx("div",{className:"flex min-h-screen items-center justify-center bg-background",children:i.jsx($e,{className:"h-8 w-8 animate-spin text-primary"})}):e?e==="student"?i.jsx(XR,{onBack:()=>t(null),onSubmit:d,isSubmitting:r}):i.jsx(t3,{role:e,onBack:()=>t(null),onSubmit:h,isSubmitting:r}):i.jsx(_R,{onSelect:t})};var Lp="Progress",$p=100,[n3,xL]=Mr(Lp),[s3,a3]=n3(Lp),J1=p.forwardRef((e,t)=>
500{const{__scopeProgress:r,value:n=null,max:s,getValueLabel:a=i3,...o}=e;(s||s===0)&&!$x(s)&&console.error(o3(`${s}`,"Progress"));const l=$x(s)?s:$p;n!==null&&!Fx(n,l)&&console.error(l3(`${n}`,"Progress"));const c=Fx(n,l)?n:null,u=vu(c)?a(c,l):void 0;return i.jsx(s3,{scope:r,value:c,max:l,children:i.jsx(ue.div,{"aria-valuemax":l,"aria-valuemin":0,"aria-valuenow":vu(c)?c:void 0,"aria-valuetext":u,role:"progressbar","data-state":e_(c,l),"data-value":c??void 0,"data-max":l,...o,ref:t})})});J1.displayName=Lp;var Z1="ProgressIndicator",X1=p.forwardRef((e,t)=>{const{__scopeProgress:r,...n}=e,s=a3(Z1,r);return i.jsx(ue.div,{"data-state":e_(s.value,s.max),"data-value":s.value??void 0,"data-max":s.max,...n,ref:t})});X1.displayName=Z1;function i3(e,t){return`${Math.round(e/t*100)}%`}function e_(e,t){return e==null?"indeterminate":e===t?"complete":"loading"}function vu(e){return typeof e=="number"}function $x(e){return vu(e)&&!isNaN(e)&&e>0}function Fx(e,t){return vu(e)&&!isNaN(e)&&e<=t&&e>=0}function o3(e,t){return`Invalid prop \`max\` of value \`${e}\` supplied to \`${t}\`. Only numbers greater than 0 are valid max values. Defaulting to \`${$p}\`.`}function l3(e,t){return`Invalid prop \`value\` of value \`${e}\` supplied to \`${t}\`. The \`value\` prop must be: 501 - a positive number 502 - less than the value passed to \`max\` (or ${$p} if no \`max\` prop is set) 503 - \`null\` or \`undefined\` if the progress is indeterminate. 504 505Defaulting to \`null\`.`}var t_=J1,c3=X1;const sn=p.forwardRef(({className:e,value:t,...r},n)=>i.jsx(t_,{ref:n,className:ce("relative h-4 w-full overflow-hidden rounded-full bg-secondary",e),...r,children:i.jsx(c3,{className:"h-full w-full flex-1 bg-primary transition-all",style:{transform:`translateX(-${100-(t||0)}%)`}})}));sn.displayName=t_.displayName;function r_(){const{user:e}=st(),[t,r]=p.useState(null),[n,s]=p.useState(!0);return p.useEffect(()=>{(async()=>{if(!e){r(null),s(!1);return}const{data:l,error:c}=await F.from("user_roles").select("role").eq("user_id",e.id).maybeSingle();r(l&&!c?l.role:null),s(!1)})()},[e]),{role:t,loading:n,setUserRole:async o=>{if(!e)return{error:new Error("Not authenticated")};let l;return o==="student"?{error:l}=await F.rpc("assign_student_role",{_user_id:e.id}):{error:l}=await F.rpc("assign_guardian_role",{_user_id:e.id,_role:o}),l||r(o),{error:l}}}}const Qf=10,Jf=25,Ca={bronze:0,silver:500,gold:1500,diamond:3e3},u3={practising:1,confident:.8},n_=6,d3=8,Rt={correct:["ð Amazing! You've got this!","â Brilliant work!","ð You're on fire!","ðª Fantastic! Keep going!","⨠Perfect! You're crushing it!"],incorrect:["ð¡ Nice try! Here's how to think about it...","ð± Learning happens through mistakes!","ð Let's break this down together...","ð Almost there! Let's see why...","ð¯ Good attempt! Here's the key insight..."],quizComplete:["ð Excellent work today!","ð You should be proud of yourself!","ð« Every practice session makes you stronger!","ð You're making real progress!"],streak:["ð¥ {days} day streak! Keep it up!","ðª {days} days in a row! You're unstoppable!","â¡ {days} day streak! Consistency is key!"],motivation:["Progress > Perfection","You're closer than you think","Every expert was once a beginner","Small steps lead to big results","Believe in yourselfâyou've got this!"]},Zf={bronze:"Bronze",silver:"Silver",gold:"Gold",diamond:"Diamond"},od={not_started:"Not Started",practising:"Practising",confident:"Confident"},h3=[{value:"Year 7",label:"Year 7"},{value:"Year 8",label:"Year 8"},{value:"Year 9",label:"Year 9"},{value:"Year 10",label:"Year 10"},{value:"Year 11",label:"Year 11"}],f3=[{value:"1",label:"Grade 1"},{value:"2",label:"Grade 2"},{value:"3",label:"Grade 3"},{value:"4",label:"Grade 4"},{value:"5",label:"Grade 5"},{value:"6",label:"Grade 6"},{value:"7",label:"Grade 7"},{value:"8",label:"Grade 8"},{value:"9",label:"Grade 9"}],m3=()=>{const[e,t]=p.useState("year-group"),[r,n]=p.useState(null),[s,a]=p.useState(null),[o,l]=p.useState(null),[c,u]=p.useState(null),[d,h]=p.useState(null),[m,f]=p.useState(!1),{user:b}=st(),{role:g,loading:v}=r_(),x=pa(),{toast:y}=en();p.useEffect(()=>{!v&&g&&g!=="student"&&(async()=>(b&&await F.from("profiles").update({onboarding_completed:!0,updated_at:new Date().toISOString()}).eq("id",b.id),x("/dashboard",{replace:!0})))()},[g,v,b,x]);const w=["year-group","current-grade","target-grade","tier","learning-style","ready"],_=w.indexOf(e),j=(_+1)/w.length*100,k=()=>{const P=_+1;P<w.length&&t(w[P])},S=()=>{const P=_-1;P>=0&&t(w[P])},C=async()=>
505{if(b){f(!0);try{const{error:P}=await F.from("profiles").update({tier:c,learning_style:d||"mixed",year_group:r,current_grade:s,target_grade:o,updated_at:new Date().toISOString()}).eq("id",b.id);if(P)throw P;x("/diagnostic")}catch{y({variant:"destructive",title:"Something went wrong",description:"Please try again."})}finally{f(!1)}}};return v?i.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center",children:i.jsx(Ar,{className:"w-8 h-8 animate-spin text-primary"})}):i.jsxs("div",{className:"min-h-screen bg-background flex flex-col",children:[i.jsxs("header",{className:"p-4 flex items-center justify-between",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("div",{className:"w-8 h-8 rounded-lg gradient-primary flex items-center justify-center",children:i.jsx(Ar,{className:"w-5 h-5 text-white"})}),i.jsx("span",{className:"text-lg font-bold text-foreground",children:"Mathly"})]}),i.jsxs("span",{className:"text-sm text-muted-foreground",children:["Step ",_+1," of ",w.length]})]}),i.jsx("div",{className:"px-4",children:i.jsx(sn,{value:j,className:"h-2"})}),i.jsx("main",{className:"flex-1 flex flex-col items-center justify-center p-4",children:i.jsxs("div",{className:"w-full max-w-md",children:[e==="year-group"&&i.jsx(p3,{selected:r,onSelect:n,onNext:k}),e==="current-grade"&&i.jsx(Ux,{title:"What is your current grade?",description:"This helps us understand where you're at right now.",icon:i.jsx(rn,{className:"w-5 h-5"}),selected:s,onSelect:a,onNext:k,onBack:S}),e==="target-grade"&&i.jsx(Ux,{title:"What is your target grade?",description:"We'll help you work towards this goal! ð¯",icon:i.jsx(bn,{className:"w-5 h-5"}),selected:o,onSelect:l,onNext:k,onBack:S}),e==="tier"&&i.jsx(g3,{selected:c,onSelect:u,onNext:k,onBack:S}),e==="learning-style"&&i.jsx(x3,{selected:d,onSelect:h,onNext:k,onBack:S}),e==="ready"&&i.jsx(y3,{onStart:C,onBack:S,isLoading:m})]})})]})},p3=({selected:e,onSelect:t,onNext:r})=>i.jsxs("div",{children:[i.jsx("h2",{className:"text-2xl font-bold text-foreground mb-2",children:"What year are you currently in?"}),i.jsx("p",{className:"text-muted-foreground mb-6",children:"This helps us tailor questions to your level."}),i.jsx("div",{className:"space-y-3 mb-8",children:h3.map(n=>i.jsx(Xf,{title:n.label,description:"",selected:e===n.value,onClick:()=>t(n.value),icon:i.jsx(tn,{className:"w-5 h-5"})},n.value))}),i.jsxs(ne,{size:"lg",onClick:r,disabled:!e,className:"gradient-primary text-white border-0 w-full h-14",children:["Continue ",i.jsx(Pr,{className:"w-5 h-5 ml-2"})]})]}),Ux=({title:e,description:t,icon:r,selected:n,onSelect:s,onNext:a,onBack:o})=>i.jsxs("div",{children:[i.jsxs("button",{onClick:o,className:"flex items-center gap-1 text-muted-foreground mb-6 hover:text-foreground transition-colors",children:[i.jsx(Tr,{className:"w-4 h-4"})," Back"]}),i.jsx("h2",{className:"text-2xl font-bold text-foreground mb-2",children:e}),i.jsx("p",{className:"text-muted-foreground mb-6",children:t}),i.jsx("div",{className:"grid grid-cols-3 gap-3 mb-8",children:f3.map(l=>i.jsx(z,{className:`cursor-pointer transition-all ${n===l.value?"ring-2 ring-primary bg-primary/5 border-primary":"hover:border-primary/50"}`,onClick:()=>s(l.value),children:i.jsxs(B,{className:"p-4 text-center",children:[i.jsx("div",{className:`w-10 h-10 rounded-xl flex items-center justify-center mx-auto mb-2 ${n===l.value?"gradient-primary text-white":"bg-secondary text-primary"}`,children:r}),i.jsx("h3",{className:"font-bold text-foreground text-sm",children:l.label})]})},l.value))}),i.jsxs(ne,{size:"lg",onClick:a,disabled:!n,className:"gradient-primary text-white border-0 w-full h-14",children:["Continue ",i.jsx(Pr,{className:"w-5 h-5 ml-2"})]})]}),g3=({selected:e,onSelect:t,onNext:r,onBack:n})=>i.jsxs("div",{children:[i.jsxs("button",{onClick:n,className:"flex items-center gap-1 text-muted-foreground mb-6 hover:text-foreground transition-colors",children:[i.jsx(Tr,{className:"w-4 h-4"})," Back"]}),i.jsx("h2",{className:"text-2xl font-bold text-foreground mb-2",children:"Which tier are you studying?"}),i.jsx("p",{className:"text-muted-foreground mb-6",children:"This helps us show you the right topics and questions."}),i.jsxs("div",{className:"space-y-3 mb-8",children:[i.jsx(Xf,{title:"Foundation",description:"Grades 1-5",selected:e==="foundation",onClick:()=>t("foundation"),icon:i.jsx(sr,{className:"w-5 h-5"})}),i.jsx(Xf,{title:"Higher",description:"Grades 4-9",selected:e==="higher",onClick:()=>t("higher"),icon:i.jsx(up,{className:"w-5 h-5"})})]}),i.jsxs(ne,{size:"lg",onClick:r,disabled:!e,className:"gradient-primary text-white border-0 w-full h-14",children:["Continue ",i.jsx(Pr,{className:"w-5 h-5 ml-2"})]})]}),x3=({selected:e,onSelect:t,onNext:r,onBack:n})=>{const s=[{value:"visual",title:"Visual",description:"I learn best with diagrams and images",icon:i.jsx(Y2,{className:"w-5 h-5"})},{value:"auditory",title:"Auditory",description:"I learn best by listening and discussing",icon:i.jsx(Z2,{className:"w-5 h-5"})},{value:"kinesthetic",title:"Hands-on",description:"I learn best by doing and practicing",icon:i.jsx(J2,{className:"w-5 h-5"})}
505,{value:"mixed",title:"Mixed",description:"I like a bit of everything!",icon:i.jsx(cC,{className:"w-5 h-5"})}];return i.jsxs("div",{children:[i.jsxs("button",{onClick:n,className:"flex items-center gap-1 text-muted-foreground mb-6 hover:text-foreground transition-colors",children:[i.jsx(Tr,{className:"w-4 h-4"})," Back"]}),i.jsx("h2",{className:"text-2xl font-bold text-foreground mb-2",children:"How do you learn best?"}),i.jsx("p",{className:"text-muted-foreground mb-6",children:"We'll tailor explanations to suit you. (You can skip this!)"}),i.jsx("div",{className:"grid grid-cols-2 gap-3 mb-8",children:s.map(a=>i.jsx(z,{className:`cursor-pointer transition-all ${e===a.value?"ring-2 ring-primary bg-primary/5 border-primary":"hover:border-primary/50"}`,onClick:()=>t(a.value),children:i.jsxs(B,{className:"p-4 text-center",children:[i.jsx("div",{className:`w-12 h-12 rounded-xl flex items-center justify-center mx-auto mb-2 ${e===a.value?"gradient-primary text-white":"bg-secondary text-primary"}`,children:a.icon}),i.jsx("h3",{className:"font-bold text-foreground text-sm",children:a.title}),i.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:a.description})]})},a.value))}),i.jsxs(ne,{size:"lg",onClick:r,className:"gradient-primary text-white border-0 w-full h-14",children:[e?"Continue":"Skip for now"," ",i.jsx(Pr,{className:"w-5 h-5 ml-2"})]})]})},y3=({onStart:e,onBack:t,isLoading:r})=>i.jsxs("div",{className:"text-center",children:[i.jsxs("button",{onClick:t,className:"flex items-center gap-1 text-muted-foreground mb-6 hover:text-foreground transition-colors mx-auto",children:[i.jsx(Tr,{className:"w-4 h-4"})," Back"]}),i.jsx("div",{className:"w-20 h-20 rounded-2xl gradient-accent flex items-center justify-center mx-auto mb-6",children:i.jsx(up,{className:"w-10 h-10 text-white"})}),i.jsx("h2",{className:"text-2xl font-bold text-foreground mb-4",children:"Time for a quick diagnostic! ð¯"}),i.jsxs("p",{className:"text-muted-foreground mb-2",children:["Answer ",n_," questions so we can see what to focus on."]}),i.jsx("p",{className:"text-sm text-muted-foreground mb-8",children:"Don't worryâthis isn't a test! It just helps us personalise your experience."}),i.jsxs(ne,{size:"lg",onClick:e,disabled:r,className:"gradient-primary text-white border-0 w-full h-14",children:[r?"Setting up...":"Let's do it!",i.jsx(Pr,{className:"w-5 h-5 ml-2"})]})]}),Xf=({title:e,description:t,selected:r,onClick:n,icon:s})=>i.jsx(z,{className:`cursor-pointer transition-all ${r?"ring-2 ring-primary bg-primary/5 border-primary":"hover:border-primary/50"}`,onClick:n,children:i.jsxs(B,{className:"flex items-center gap-4 p-4",children:[i.jsx("div",{className:`w-12 h-12 rounded-xl flex items-center justify-center ${r?"gradient-primary text-white":"bg-secondary text-primary"}`,children:s}),i.jsxs("div",{className:"flex-1",children:[i.jsx("h3",{className:"font-bold text-foreground",children:e}),t&&i.jsx("p",{className:"text-sm text-muted-foreground",children:t})]}),i.jsx("div",{className:`w-5 h-5 rounded-full border-2 ${r?"bg-primary border-primary":"border-muted-foreground"}`,children:r&&i.jsx("div",{className:"w-full h-full flex items-center justify-center",children:i.jsx("div",{className:"w-2 h-2 bg-white rounded-full"})})})]})});function ld(e){const[t,r]=p.useState([]),[n,s]=p.useState(!0);p.useEffect(()=>{(async()=>{let u=F.from("topics").select("*").order("order_index",{ascending:!0});e==="foundation"&&(u=u.eq("tier","foundation"));const{data:d,error:h}=await u;d&&!h&&r(d),s(!1)})()},[e]);const a=t.filter(c=>c.parent_topic_id===null),o=c=>t.filter(u=>u.parent_topic_id===c),l=t.filter(c=>c.parent_topic_id!==null);return{topics:t,strands:a,subtopics:l,getSubtopics:o,loading:n}}const v3=()=>{var P;const[e,t]=p.useState(null),[r,n]=p.useState([]),[s,a]=p.useState({currentIndex:0,answers:[],showFeedback:!1,lastAnswerCorrect:null}),[o,l]=p.useState(null),[c,u]=p.useState(!1),[d,h]=p.useState(!1),[m,f]=p.useState(!0),{user:b}=st(),g=pa(),{toast:v}=en();p.useEffect(()=>{(async()=>{if(!b)return;const{data:$}=await F.from("profiles").select("*").eq("id",b.id).maybeSingle();if($){t($);let O=F.from("questions").select("id, topic_id, question_text, options, correct_answer, explanation").eq("is_diagnostic",!0);$.tier==="foundation"&&(O=O.eq("tier","foundation"));const{data:M}=await O;if(M){const U=M.map(N=>({...N,options:typeof N.options=="string"?JSON.parse(N.options):N.options})).sort(()=>Math.random()-.5).slice(0,n_);n(U)}}f(!1)})()},[b]);
505const{subtopics:x}=ld(e==null?void 0:e.tier),y=r[s.currentIndex],w=r.length>0?(s.currentIndex+1)/r.length*100:0,_=p.useMemo(()=>{if(!y)return"General";const T=x.find($=>$.id===y.topic_id);return(T==null?void 0:T.name)||"General"},[y,x]),j=T=>{s.showFeedback||l(T)},k=()=>{if(!o||!y)return;const T=o===y.correct_answer;a($=>({...$,answers:[...$.answers,{questionId:y.id,answer:o,isCorrect:T,topicId:y.topic_id}],showFeedback:!0,lastAnswerCorrect:T}))},S=()=>{s.currentIndex>=r.length-1?u(!0):(a(T=>({...T,currentIndex:T.currentIndex+1,showFeedback:!1,lastAnswerCorrect:null})),l(null))},C=async()=>{if(!(!b||!e)){h(!0);try{const T={};s.answers.forEach(U=>{T[U.topicId]||(T[U.topicId]={correct:0,total:0}),T[U.topicId].total++,U.isCorrect&&T[U.topicId].correct++});const $=s.answers.filter(U=>U.isCorrect).length,O=$*Qf+Jf;await F.from("profiles").update({onboarding_completed:!0,xp:(e.xp||0)+O,last_activity_date:new Date().toISOString().split("T")[0],current_streak:1,updated_at:new Date().toISOString()}).eq("id",b.id);const M=Object.entries(T).map(([U,N])=>{const D=N.correct/N.total;let E="not_started";return N.total>0&&(E=D>=.8?"confident":"practising"),{user_id:b.id,topic_id:U,mastery_level:E,correct_count:N.correct,total_attempts:N.total,last_practiced_at:new Date().toISOString()}}),R=Object.keys(T);x.forEach(U=>{R.includes(U.id)||M.push({user_id:b.id,topic_id:U.id,mastery_level:"not_started",correct_count:0,total_attempts:0,last_practiced_at:null})}),await F.from("topic_progress").insert(M),await F.from("quiz_attempts").insert({user_id:b.id,is_diagnostic:!0,score:$,total_questions:r.length,xp_earned:O,completed_at:new Date().toISOString()}),v({title:"ð Diagnostic complete!",description:`You earned ${O} XP! Let's check out your dashboard.`}),g("/dashboard")}catch(T){console.error("Error saving diagnostic results:",T),v({variant:"destructive",title:"Something went wrong",description:"Please try again."})}finally{h(!1)}}};if(m)return i.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center",children:i.jsx($e,{className:"w-8 h-8 animate-spin text-primary"})});if(!(e!=null&&e.tier))return g("/onboarding"),null;if(c){const T=s.answers.filter(O=>O.isCorrect).length,$=Math.round(T/r.length*100);return i.jsx("div",{className:"min-h-screen bg-background flex flex-col items-center justify-center p-4",children:i.jsxs("div",{className:"w-full max-w-md text-center",children:[i.jsx("div",{className:"w-20 h-20 rounded-2xl gradient-success flex items-center justify-center mx-auto mb-6 animate-celebrate",children:i.jsx(lr,{className:"w-10 h-10 text-white"})}),i.jsx("h1",{className:"text-3xl font-bold text-foreground mb-2",children:"Diagnostic Complete! ð"}),i.jsx("p",{className:"text-lg text-muted-foreground mb-6",children:Rt.quizComplete[Math.floor(Math.random()*Rt.quizComplete.length)]}),i.jsx(z,{className:"mb-8",children:i.jsxs(B,{className:"p-6",children:[i.jsxs("div",{className:"text-4xl font-bold text-primary mb-2",children:[T,"/",r.length]}),i.jsxs("p",{className:"text-muted-foreground",children:[$,"% correct"]})]})}),i.jsx(ne,{size:"lg",onClick:C,disabled:d,className:"gradient-primary text-white border-0 w-full h-14",children:d?i.jsxs(i.Fragment,{children:[i.jsx($e,{className:"w-5 h-5 mr-2 animate-spin"})," Setting up your dashboard..."]}):i.jsxs(i.Fragment,{children:["See my dashboard ",i.jsx(Pr,{className:"w-5 h-5 ml-2"})]})})]})})}return y?i.jsxs("div",{className:"min-h-screen bg-background flex flex-col",children:[i.jsxs("header",{className:"p-4 flex items-center justify-between",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("div",{className:"w-8 h-8 rounded-lg gradient-primary flex items-center justify-center",children:i.jsx(Ar,{className:"w-5 h-5 text-white"})}),i.jsx("span",{className:"text-lg font-bold text-foreground",children:"Diagnostic"})]}),i.jsxs("span",{className:"text-sm text-muted-foreground",children:[s.currentIndex+1," of ",r.length]})]}),i.jsx("div",{className:"px-4",children:i.jsx(sn,{value:w,className:"h-2"})}),i.jsx("main",{className:"flex-1 flex flex-col p-4",children:i.jsxs("div",{className:"flex-1 flex flex-col max-w-lg mx-auto w-full",children:[i.jsx("div",{className:"mb-4",children:i.jsx("span",{className:"inline-flex items-center px-3 py-1 rounded-full bg-secondary text-sm font-medium text-primary",children:_})}),i.jsx("h2",{className:"text-xl font-bold text-foreground mb-6",children:y.question_text}),i.jsx("div",{className:"space-y-3 mb-6",children:(P=y.options)==null?void 0:P.map((T,$)=>
505{const O=o===T,M=T===y.correct_answer,R=s.showFeedback&&M,U=s.showFeedback&&O&&!M;return i.jsx(z,{className:`cursor-pointer transition-all ${R?"ring-2 ring-success bg-success/10 border-success":U?"ring-2 ring-destructive bg-destructive/10 border-destructive":O?"ring-2 ring-primary bg-primary/5 border-primary":s.showFeedback?"opacity-50":"hover:border-primary/50"}`,onClick:()=>j(T),children:i.jsxs(B,{className:"flex items-center gap-3 p-4",children:[i.jsx("div",{className:`w-8 h-8 rounded-full flex items-center justify-center text-sm font-bold ${R?"bg-success text-white":U?"bg-destructive text-white":O?"gradient-primary text-white":"bg-secondary text-primary"}`,children:R?i.jsx(lr,{className:"w-5 h-5"}):U?i.jsx(qo,{className:"w-5 h-5"}):String.fromCharCode(65+$)}),i.jsx("span",{className:"flex-1 font-medium text-foreground",children:T})]})},$)})}),s.showFeedback&&i.jsx(z,{className:`mb-6 ${s.lastAnswerCorrect?"bg-success/10 border-success":"bg-accent/10 border-accent"}`,children:i.jsxs(B,{className:"p-4",children:[i.jsx("p",{className:"font-bold mb-2",children:s.lastAnswerCorrect?Rt.correct[Math.floor(Math.random()*Rt.correct.length)]:Rt.incorrect[Math.floor(Math.random()*Rt.incorrect.length)]}),i.jsx("p",{className:"text-sm text-muted-foreground",children:y.explanation})]})}),i.jsx("div",{className:"mt-auto pt-4",children:s.showFeedback?i.jsxs(ne,{size:"lg",onClick:S,className:"gradient-primary text-white border-0 w-full h-14",children:[s.currentIndex>=r.length-1?"See results":"Next question",i.jsx(Pr,{className:"w-5 h-5 ml-2"})]}):i.jsx(ne,{size:"lg",onClick:k,disabled:!o,className:"gradient-primary text-white border-0 w-full h-14",children:"Check answer"})})]})})]}):null},w3=[{id:"home",label:"Home",icon:xb},{id:"practice",label:"Practice",icon:sr},{id:"analytics",label:"Analytics",icon:ma},{id:"plan",label:"Plan",icon:op},{id:"wellbeing",label:"Wellbeing",icon:Cn},{id:"exams",label:"Exams",icon:tn}
505],b3=({active:e,onChange:t})=>i.jsxs("nav",{className:"fixed bottom-0 left-0 right-0 z-50 bg-card border-t border-border shadow-[0_-4px_20px_-4px_rgba(0,0,0,0.08)]",children:[i.jsx("div",{className:"container mx-auto max-w-2xl px-2",children:i.jsx("div",{className:"flex items-center justify-around py-1",children:w3.map(r=>{const n=r.icon,s=e===r.id;return i.jsxs("button",{onClick:()=>t(r.id),className:`flex flex-col items-center gap-0.5 py-2 px-3 rounded-xl transition-all duration-200 min-w-[56px] ${s?"text-primary":"text-muted-foreground hover:text-foreground"}`,children:[i.jsx("div",{className:`p-1.5 rounded-xl transition-all duration-200 ${s?"bg-primary/10 scale-110":""}`,children:i.jsx(n,{className:"w-5 h-5",strokeWidth:s?2.5:2})}),i.jsx("span",{className:`text-[10px] font-bold leading-none ${s?"text-primary":""}`,children:r.label})]},r.id)})})}),i.jsx("div",{className:"h-safe-area-inset-bottom bg-card"})]}),_3=()=>{const{user:e}=st(),{toast:t}=en(),[r,n]=p.useState(null),[s,a]=p.useState(!1);p.useEffect(()=>{(async()=>{if(!e)return;const{data:c}=await F.from("profiles").select("link_code").eq("id",e.id).maybeSingle();if(c!=null&&c.link_code)n(c.link_code);else{const{data:u}=await F.rpc("generate_link_code");if(u){const d=u;await F.from("profiles").update({link_code:d}).eq("id",e.id),n(d)}}})()},[e]);const o=async()=>{r&&(await navigator.clipboard.writeText(r),a(!0),t({title:"Code copied!",description:"Share this with your parent or teacher."}),setTimeout(()=>a(!1),2e3))};return r?i.jsx(z,{className:"mb-6 border-primary/20 bg-primary/5",children:i.jsxs(B,{className:"p-4",children:[i.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[i.jsx(vb,{className:"w-5 h-5 text-primary"}),i.jsx("h3",{className:"font-bold text-foreground text-sm",children:"Your Link Code"})]}),i.jsx("p",{className:"text-xs text-muted-foreground mb-3",children:"Share this code with your parent or teacher so they can track your progress."}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("div",{className:"flex-1 bg-card rounded-lg px-4 py-3 text-center font-mono text-2xl font-bold tracking-[0.3em] text-primary border border-border",children:r}),i.jsx(ne,{variant:"outline",size:"icon",className:"h-12 w-12 shrink-0",onClick:o,children:s?i.jsx(pl,{className:"w-5 h-5 text-success"}):i.jsx(pb,{className:"w-5 h-5"})})]})]})}):null};function qx(e,[t,r]){return Math.min(r,Math.max(t,e))}var j3=p.createContext(void 0);function Fp(e){const t=p.useContext(j3);return e||t||"ltr"}var uh=0;function s_(){p.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??zx()),document.body.insertAdjacentElement("beforeend",e[1]??zx()),uh++,()=>{uh===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),uh--}},[])}function zx(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var dh="focusScope.autoFocusOnMount",hh="focusScope.autoFocusOnUnmount",Bx={bubbles:!1,cancelable:!0},k3="FocusScope",Up=p.forwardRef((e,t)=>{const{loop:r=!1,trapped:n=!1,onMountAutoFocus:s,onUnmountAutoFocus:a,...o}=e,[l,c]=p.useState(null),u=or(s),d=or(a),h=p.useRef(null),m=Ee(t,g=>c(g)),f=p.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;p.useEffect(()=>{if(n){let g=function(w){if(f.paused||!l)return;const _=w.target;l.contains(_)?h.current=_:Un(h.current,{select:!0})},v=function(w){if(f.paused||!l)return;const _=w.relatedTarget;_!==null&&(l.contains(_)||Un(h.current,{select:!0}))},x=function(w){if(document.activeElement===document.body)for(const j of w)j.removedNodes.length>0&&Un(l)};document.addEventListener("focusin",g),document.addEventListener("focusout",v);const y=new MutationObserver(x);return l&&y.observe(l,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",g),document.removeEventListener("focusout",v),y.disconnect()}}},[n,l,f.paused]),p.useEffect(()=>{if(l){Hx.add(f);const g=document.activeElement;if(!l.contains(g)){const x=new CustomEvent(dh,Bx);l.addEventListener(dh,u),l.dispatchEvent(x),x.defaultPrevented||(S3(P3(a_(l)),{select:!0}),document.activeElement===g&&Un(l))}return()=>{l.removeEventListener(dh,u),setTimeout(()=>{const x=new CustomEvent(hh,Bx);l.addEventListener(hh,d),l.dispatchEvent(x),x.defaultPrevented||Un(g??document.body,{select:!0}),l.removeEventListener(hh,d),Hx.remove(f)},0)}}},[l,u,d,f]);const b=p.useCallback(g=>{if(!r&&!n||f.paused)return;const v=g.key==="Tab"&&!g.altKey&&!g.ctrlKey&&!g.metaKey,x=document.activeElement;if(v&&x){const y=g.currentTarget,[w,_]=N3(y);
vendor: 4,594 bytes, line 505
505w&&_?!g.shiftKey&&x===_?(g.preventDefault(),r&&Un(w,{select:!0})):g.shiftKey&&x===w&&(g.preventDefault(),r&&Un(_,{select:!0})):x===y&&g.preventDefault()}},[r,n,f.paused]);return i.jsx(ue.div,{tabIndex:-1,...o,ref:m,onKeyDown:b})});Up.displayName=k3;function S3(e,{select:t=!1}={}){const r=document.activeElement;for(const n of e)if(Un(n,{select:t}),document.activeElement!==r)return}function N3(e){const t=a_(e),r=Wx(t,e),n=Wx(t.reverse(),e);return[r,n]}function a_(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 Wx(e,t){for(const r of e)if(!C3(r,{upTo:t}))return r}function C3(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 E3(e){return e instanceof HTMLInputElement&&"select"in e}function Un(e,{select:t=!1}={}){if(e&&e.focus){const r=document.activeElement;e.focus({preventScroll:!0}),e!==r&&E3(e)&&t&&e.select()}}var Hx=T3();function T3(){let e=[];return{add(t){const r=e[0];t!==r&&(r==null||r.pause()),e=Vx(e,t),e.unshift(t)},remove(t){var r;e=Vx(e,t),(r=e[0])==null||r.resume()}}}function Vx(e,t){const r=[...e],n=r.indexOf(t);return n!==-1&&r.splice(n,1),r}function P3(e){return e.filter(t=>t.tagName!=="A")}function qp(e){const t=p.useRef({value:e,previous:e});return p.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var A3=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Ea=new WeakMap,tc=new WeakMap,rc={},fh=0,i_=function(e){return e&&(e.host||i_(e.parentNode))},R3=function(e,t){return t.map(function(r){if(e.contains(r))return r;var n=i_(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})},O3=function(e,t,r,n){var s=R3(t,Array.isArray(e)?e:[e]);rc[r]||(rc[r]=new WeakMap);var a=rc[r],o=[],l=new Set,c=new Set(s),u=function(h){!h||l.has(h)||(l.add(h),u(h.parentNode))};s.forEach(u);var d=function(h){!h||c.has(h)||Array.prototype.forEach.call(h.children,function(m){if(l.has(m))d(m);else try{var f=m.getAttribute(n),b=f!==null&&f!=="false",g=(Ea.get(m)||0)+1,v=(a.get(m)||0)+1;Ea.set(m,g),a.set(m,v),o.push(m),g===1&&b&&tc.set(m,!0),v===1&&m.setAttribute(r,"true"),b||m.setAttribute(n,"true")}catch(x){console.error("aria-hidden: cannot operate on ",m,x)}})};return d(t),l.clear(),fh++,function(){o.forEach(function(h){var m=Ea.get(h)-1,f=a.get(h)-1;Ea.set(h,m),a.set(h,f),m||(tc.has(h)||h.removeAttribute(n),tc.delete(h)),f||h.removeAttribute(r)}),fh--,fh||(Ea=new WeakMap,Ea=new WeakMap,tc=new WeakMap,rc={})}},o_=function(e,t,r){r===void 0&&(r="data-aria-hidden");var n=Array.from(Array.isArray(e)?e:[e]),s=A3(e);return s?(n.push.apply(n,Array.from(s.querySelectorAll("[aria-live]"))),O3(n,s,r,"aria-hidden")):function(){return null}},kc="right-scroll-bar-position",Sc="width-before-scroll-bar",I3="with-scroll-bars-hidden",M3="--removed-body-scroll-bar-size";function mh(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function D3(e,t){var r=p.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 L3=typeof window<"u"?p.useLayoutEffect:p.useEffect,Gx=new WeakMap;function $3(e,t){var r=D3(null,function(n){return e.forEach(function(s){return mh(s,n)})});return L3(function(){var n=Gx.get(r);if(n){var s=new Set(n),a=new Set(e),o=r.current;s.forEach(function(l){a.has(l)||mh(l,null)}),a.forEach(function(l){s.has(l)||mh(l,o)})}Gx.set(r,e)},[e]),r}function F3(e){return e}function U3(e,t){t===void 0&&(t=F3);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(a){var o=t(a,n);return r.push(o),function(){r=r.filter(function(l){return l!==o})}},assignSyncMedium:function(a){for(n=!0;r.length;){var o=r;r=[],o.forEach(a)}r={push:function(l){return a(l)},filter:function(){return r}}},assignMedium:function(a){n=!0;var o=[];if(r.length){var l=r;r=[],l.forEach(a),o=r}var c=function(){var d=o;o=[],d.forEach(a)},u=function(){return Promise.resolve().then(c)};
vendor: 5,068 bytes, lines 505-542
505u(),r={push:function(d){o.push(d),u()},filter:function(d){return o=o.filter(d),r}}}};return s}function q3(e){e===void 0&&(e={});var t=U3(null);return t.options=Br({async:!0,ssr:!1},e),t}var l_=function(e){var t=e.sideCar,r=$i(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 p.createElement(n,Br({},r))};l_.isSideCarExport=!0;function z3(e,t){return e.useMedium(t),l_}var c_=q3(),ph=function(){},cd=p.forwardRef(function(e,t){var r=p.useRef(null),n=p.useState({onScrollCapture:ph,onWheelCapture:ph,onTouchMoveCapture:ph}),s=n[0],a=n[1],o=e.forwardProps,l=e.children,c=e.className,u=e.removeScrollBar,d=e.enabled,h=e.shards,m=e.sideCar,f=e.noRelative,b=e.noIsolation,g=e.inert,v=e.allowPinchZoom,x=e.as,y=x===void 0?"div":x,w=e.gapMode,_=$i(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),j=m,k=$3([r,t]),S=Br(Br({},_),s);return p.createElement(p.Fragment,null,d&&p.createElement(j,{sideCar:c_,removeScrollBar:u,shards:h,noRelative:f,noIsolation:b,inert:g,setCallbacks:a,allowPinchZoom:!!v,lockRef:r,gapMode:w}),o?p.cloneElement(p.Children.only(l),Br(Br({},S),{ref:k})):p.createElement(y,Br({},S,{className:c,ref:k}),l))});cd.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};cd.classNames={fullWidth:Sc,zeroRight:kc};var B3=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function W3(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=B3();return t&&e.setAttribute("nonce",t),e}function H3(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function V3(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var G3=function(){var e=0,t=null;return{add:function(r){e==0&&(t=W3())&&(H3(t,r),V3(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},Y3=function(){var e=G3();return function(t,r){p.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&r])}},u_=function(){var e=Y3(),t=function(r){var n=r.styles,s=r.dynamic;return e(n,s),null};return t},K3={left:0,top:0,right:0,gap:0},gh=function(e){return parseInt(e||"",10)||0},Q3=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[gh(r),gh(n),gh(s)]},J3=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return K3;var t=Q3(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])}},Z3=u_(),si="data-scroll-locked",X3=function(e,t,r,n){var s=e.left,a=e.top,o=e.right,l=e.gap;return r===void 0&&(r="margin"),` 506 .`.concat(I3,` { 507 overflow: hidden `).concat(n,`; 508 padding-right: `).concat(l,"px ").concat(n,`; 509 } 510 body[`).concat(si,`] { 511 overflow: hidden `).concat(n,`; 512 overscroll-behavior: contain; 513 `).concat([t&&"position: relative ".concat(n,";"),r==="margin"&&` 514 padding-left: `.concat(s,`px; 515 padding-top: `).concat(a,`px; 516 padding-right: `).concat(o,`px; 517 margin-left:0; 518 margin-top:0; 519 margin-right: `).concat(l,"px ").concat(n,`; 520 `),r==="padding"&&"padding-right: ".concat(l,"px ").concat(n,";")].filter(Boolean).join(""),` 521 } 522 523 .`).concat(kc,` { 524 right: `).concat(l,"px ").concat(n,`; 525 } 526 527 .`).concat(Sc,` { 528 margin-right: `).concat(l,"px ").concat(n,`; 529 } 530 531 .`).concat(kc," .").concat(kc,` { 532 right: 0 `).concat(n,`; 533 } 534 535 .`).concat(Sc," .").concat(Sc,` { 536 margin-right: 0 `).concat(n,`; 537 } 538 539 body[`).concat(si,`] { 540 `).concat(M3,": ").concat(l,`px; 541 } 542`)},Yx=function(){var e=parseInt(document.body.getAttribute(si)||"0",10);return isFinite(e)?e:0},eO=function(){p.useEffect(function(){return document.body.setAttribute(si,(Yx()+1).toString()),function(){var e=Yx()-1;e<=0?document.body.removeAttribute(si):document.body.setAttribute(si,e.toString())}},[])},tO=function(e){var t=e.noRelative,r=e.noImportant,n=e.gapMode,s=n===void 0?"margin":n;eO();var a=p.useMemo(function(){return J3(s)},[s]);return p.createElement(Z3,{styles:X3(a,!t,s,r?"":"!important")})},em=!1;if(typeof window<"u")try{var nc=Object.defineProperty({},"passive",{get:function(){return em=!0,!0}});window.addEventListener("test",nc,nc),window.removeEventListener("test",nc,nc)}catch{em=!1}var Ta=em?{passive:!1}:!1,rO=function(e){return e.tagName==="TEXTAREA"},d_=function(e,t){if(!(e instanceof Element))return!1;var r=window.getComputedStyle(e);return r[t]!=="hidden"&&!(r.overflowY===r.overflowX&&!rO(e)&&r[t]==="visible")},nO=function(e){return d_(e,"overflowY")},sO=function(e){return d_(e,"overflowX")},Kx=function(e,t){var r=t.ownerDocument,n=t;do{typeof ShadowRoot<"u"&&n instanceof ShadowRoot&&(n=n.host);var s=h_(e,n);if(s){var a=f_(e,n),o=a[1],l=a[2];if(o>l)return!0}n=n.parentNode}while(n&&n!==r.body);return!1}
vendor: 5,506 bytes, lines 542-545
542,aO=function(e){var t=e.scrollTop,r=e.scrollHeight,n=e.clientHeight;return[t,r,n]},iO=function(e){var t=e.scrollLeft,r=e.scrollWidth,n=e.clientWidth;return[t,r,n]},h_=function(e,t){return e==="v"?nO(t):sO(t)},f_=function(e,t){return e==="v"?aO(t):iO(t)},oO=function(e,t){return e==="h"&&t==="rtl"?-1:1},lO=function(e,t,r,n,s){var a=oO(e,window.getComputedStyle(t).direction),o=a*n,l=r.target,c=t.contains(l),u=!1,d=o>0,h=0,m=0;do{if(!l)break;var f=f_(e,l),b=f[0],g=f[1],v=f[2],x=g-v-a*b;(b||x)&&h_(e,l)&&(h+=x,m+=b);var y=l.parentNode;l=y&&y.nodeType===Node.DOCUMENT_FRAGMENT_NODE?y.host:y}while(!c&&l!==document.body||c&&(t.contains(l)||t===l));return(d&&(Math.abs(h)<1||!s)||!d&&(Math.abs(m)<1||!s))&&(u=!0),u},sc=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},Qx=function(e){return[e.deltaX,e.deltaY]},Jx=function(e){return e&&"current"in e?e.current:e},cO=function(e,t){return e[0]===t[0]&&e[1]===t[1]},uO=function(e){return` 543 .block-interactivity-`.concat(e,` {pointer-events: none;} 544 .allow-interactivity-`).concat(e,` {pointer-events: all;} 545`)},dO=0,Pa=[];function hO(e){var t=p.useRef([]),r=p.useRef([0,0]),n=p.useRef(),s=p.useState(dO++)[0],a=p.useState(u_)[0],o=p.useRef(e);p.useEffect(function(){o.current=e},[e]),p.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(s));var g=U4([e.lockRef.current],(e.shards||[]).map(Jx),!0).filter(Boolean);return g.forEach(function(v){return v.classList.add("allow-interactivity-".concat(s))}),function(){document.body.classList.remove("block-interactivity-".concat(s)),g.forEach(function(v){return v.classList.remove("allow-interactivity-".concat(s))})}}},[e.inert,e.lockRef.current,e.shards]);var l=p.useCallback(function(g,v){if("touches"in g&&g.touches.length===2||g.type==="wheel"&&g.ctrlKey)return!o.current.allowPinchZoom;var x=sc(g),y=r.current,w="deltaX"in g?g.deltaX:y[0]-x[0],_="deltaY"in g?g.deltaY:y[1]-x[1],j,k=g.target,S=Math.abs(w)>Math.abs(_)?"h":"v";if("touches"in g&&S==="h"&&k.type==="range")return!1;var C=Kx(S,k);if(!C)return!0;if(C?j=S:(j=S==="v"?"h":"v",C=Kx(S,k)),!C)return!1;if(!n.current&&"changedTouches"in g&&(w||_)&&(n.current=j),!j)return!0;var P=n.current||j;return lO(P,v,g,P==="h"?w:_,!0)},[]),c=p.useCallback(function(g){var v=g;if(!(!Pa.length||Pa[Pa.length-1]!==a)){var x="deltaY"in v?Qx(v):sc(v),y=t.current.filter(function(j){return j.name===v.type&&(j.target===v.target||v.target===j.shadowParent)&&cO(j.delta,x)})[0];if(y&&y.should){v.cancelable&&v.preventDefault();return}if(!y){var w=(o.current.shards||[]).map(Jx).filter(Boolean).filter(function(j){return j.contains(v.target)}),_=w.length>0?l(v,w[0]):!o.current.noIsolation;_&&v.cancelable&&v.preventDefault()}}},[]),u=p.useCallback(function(g,v,x,y){var w={name:g,delta:v,target:x,should:y,shadowParent:fO(x)};t.current.push(w),setTimeout(function(){t.current=t.current.filter(function(_){return _!==w})},1)},[]),d=p.useCallback(function(g){r.current=sc(g),n.current=void 0},[]),h=p.useCallback(function(g){u(g.type,Qx(g),g.target,l(g,e.lockRef.current))},[]),m=p.useCallback(function(g){u(g.type,sc(g),g.target,l(g,e.lockRef.current))},[]);p.useEffect(function(){return Pa.push(a),e.setCallbacks({onScrollCapture:h,onWheelCapture:h,onTouchMoveCapture:m}),document.addEventListener("wheel",c,Ta),document.addEventListener("touchmove",c,Ta),document.addEventListener("touchstart",d,Ta),function(){Pa=Pa.filter(function(g){return g!==a}),document.removeEventListener("wheel",c,Ta),document.removeEventListener("touchmove",c,Ta),document.removeEventListener("touchstart",d,Ta)}},[]);var f=e.removeScrollBar,b=e.inert;return p.createElement(p.Fragment,null,b?p.createElement(a,{styles:uO(s)}):null,f?p.createElement(tO,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function fO(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const mO=z3(c_,hO);var zp=p.forwardRef(function(e,t){return p.createElement(cd,Br({},e,{ref:t,sideCar:mO}))});zp.classNames=cd.classNames;var pO=[" ","Enter","ArrowUp","ArrowDown"],gO=[" ","Enter"],la="Select",[ud,dd,xO]=np(la),[Ui,yL]=Mr(la,[xO,Qu]),hd=Qu(),[yO,Es]=Ui(la),[vO,wO]=Ui(la),m_=e=>{const{__scopeSelect:t,children:r,open:n,defaultOpen:s,onOpenChange:a,value:o,defaultValue:l,onValueChange:c,dir:u,name:d,autoComplete:h,disabled:m,required:f,form:b}=e,g=hd(t),[v,x]=p.useState(null),[y,w]=p.useState(null),[_,j]=p.useState(!1),k=Fp(u),[S,C]=xs({prop:n,defaultProp:s??!1,onChange:a,caller:la}),[P,T]=xs({prop:o,defaultProp:l,onChange:c,caller:la}),$=p.useRef(null),O=v?b||!!v.closest("form"):!0,[M,R]=p.useState(new Set),U=Array.from(M).map(N=>N.props.value).join(";");return i.jsx(GT,{...g,children:i.jsxs(yO,{required:f,scope:t,trigger:v,onTriggerChange:x,valueNode:y,onValueNodeChange:w,valueNodeHasChildren:_,onValueNodeHasChildrenChange:j,contentId:ds(),value:P,onValueChange:T,open:S,onOpenChange:C,dir:k,triggerPointerDownPosRef:$,disabled:m,children:[i.jsx(ud.Provider,{scope:t,children:i.jsx(vO,{scope:e.__scopeSelect,onNativeOptionAdd:p.useCallback(N=>{R(D=>new Set(D).add(N))},[]),onNativeOptionRemove:p.useCallback(N=>{R(D=>{const E=new Set(D);return E.delete(N),E})},[]),children:r})}),O?i.jsxs($_,{"aria-hidden":!0,required:f,tabIndex:-1,name:d,autoComplete:h,value:P,onChange:N=>T(N.target.value),disabled:m,form:b,children:[P===void 0?i.jsx("option",{value:""}):null,Array.from(M)]},U):null]})})};m_.displayName=la;var p_="SelectTrigger",g_=p.forwardRef((e,t)=>
vendor: 16,821 bytes, line 545
545{const{__scopeSelect:r,disabled:n=!1,...s}=e,a=hd(r),o=Es(p_,r),l=o.disabled||n,c=Ee(t,o.onTriggerChange),u=dd(r),d=p.useRef("touch"),[h,m,f]=U_(g=>{const v=u().filter(w=>!w.disabled),x=v.find(w=>w.value===o.value),y=q_(v,g,x);y!==void 0&&o.onValueChange(y.value)}),b=g=>{l||(o.onOpenChange(!0),f()),g&&(o.triggerPointerDownPosRef.current={x:Math.round(g.pageX),y:Math.round(g.pageY)})};return i.jsx(t1,{asChild:!0,...a,children:i.jsx(ue.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":F_(o.value)?"":void 0,...s,ref:c,onClick:ae(s.onClick,g=>{g.currentTarget.focus(),d.current!=="mouse"&&b(g)}),onPointerDown:ae(s.onPointerDown,g=>{d.current=g.pointerType;const v=g.target;v.hasPointerCapture(g.pointerId)&&v.releasePointerCapture(g.pointerId),g.button===0&&g.ctrlKey===!1&&g.pointerType==="mouse"&&(b(g),g.preventDefault())}),onKeyDown:ae(s.onKeyDown,g=>{const v=h.current!=="";!(g.ctrlKey||g.altKey||g.metaKey)&&g.key.length===1&&m(g.key),!(v&&g.key===" ")&&pO.includes(g.key)&&(b(),g.preventDefault())})})})});g_.displayName=p_;var x_="SelectValue",y_=p.forwardRef((e,t)=>{const{__scopeSelect:r,className:n,style:s,children:a,placeholder:o="",...l}=e,c=Es(x_,r),{onValueNodeHasChildrenChange:u}=c,d=a!==void 0,h=Ee(t,c.onValueNodeChange);return ft(()=>{u(d)},[u,d]),i.jsx(ue.span,{...l,ref:h,style:{pointerEvents:"none"},children:F_(c.value)?i.jsx(i.Fragment,{children:o}):a})});y_.displayName=x_;var bO="SelectIcon",v_=p.forwardRef((e,t)=>{const{__scopeSelect:r,children:n,...s}=e;return i.jsx(ue.span,{"aria-hidden":!0,...s,ref:t,children:n||"â¼"})});v_.displayName=bO;var _O="SelectPortal",w_=e=>i.jsx(Bu,{asChild:!0,...e});w_.displayName=_O;var ca="SelectContent",b_=p.forwardRef((e,t)=>{const r=Es(ca,e.__scopeSelect),[n,s]=p.useState();if(ft(()=>{s(new DocumentFragment)},[]),!r.open){const a=n;return a?fa.createPortal(i.jsx(__,{scope:e.__scopeSelect,children:i.jsx(ud.Slot,{scope:e.__scopeSelect,children:i.jsx("div",{children:e.children})})}),a):null}return i.jsx(j_,{...e,ref:t})});b_.displayName=ca;var gr=10,[__,Ts]=Ui(ca),jO="SelectContentImpl",kO=wi("SelectContent.RemoveScroll"),j_=p.forwardRef((e,t)=>{const{__scopeSelect:r,position:n="item-aligned",onCloseAutoFocus:s,onEscapeKeyDown:a,onPointerDownOutside:o,side:l,sideOffset:c,align:u,alignOffset:d,arrowPadding:h,collisionBoundary:m,collisionPadding:f,sticky:b,hideWhenDetached:g,avoidCollisions:v,...x}=e,y=Es(ca,r),[w,_]=p.useState(null),[j,k]=p.useState(null),S=Ee(t,V=>_(V)),[C,P]=p.useState(null),[T,$]=p.useState(null),O=dd(r),[M,R]=p.useState(!1),U=p.useRef(!1);p.useEffect(()=>{if(w)return o_(w)},[w]),s_();const N=p.useCallback(V=>{const[_e,...de]=O().map(we=>we.ref.current),[he]=de.slice(-1),le=document.activeElement;for(const we of V)if(we===le||(we==null||we.scrollIntoView({block:"nearest"}),we===_e&&j&&(j.scrollTop=0),we===he&&j&&(j.scrollTop=j.scrollHeight),we==null||we.focus(),document.activeElement!==le))return},[O,j]),D=p.useCallback(()=>N([C,w]),[N,C,w]);p.useEffect(()=>{M&&D()},[M,D]);const{onOpenChange:E,triggerPointerDownPosRef:A}=y;p.useEffect(()=>{if(w){let V={x:0,y:0};const _e=he=>{var le,we;V={x:Math.abs(Math.round(he.pageX)-(((le=A.current)==null?void 0:le.x)??0)),y:Math.abs(Math.round(he.pageY)-(((we=A.current)==null?void 0:we.y)??0))}},de=he=>{V.x<=10&&V.y<=10?he.preventDefault():w.contains(he.target)||E(!1),document.removeEventListener("pointermove",_e),A.current=null};return A.current!==null&&(document.addEventListener("pointermove",_e),document.addEventListener("pointerup",de,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",_e),document.removeEventListener("pointerup",de,{capture:!0})}}},[w,E,A]),p.useEffect(()=>{const V=()=>E(!1);return window.addEventListener("blur",V),window.addEventListener("resize",V),()=>{window.removeEventListener("blur",V),window.removeEventListener("resize",V)}},[E]);const[Y,te]=U_(V=>{const _e=O().filter(le=>!le.disabled),de=_e.find(le=>le.ref.current===document.activeElement),he=q_(_e,V,de);he&&setTimeout(()=>he.ref.current.focus())}),W=p.useCallback((V,_e,de)=>{const he=!U.current&&!de;(y.value!==void 0&&y.value===_e||he)&&(P(V),he&&(U.current=!0))},[y.value]),se=p.useCallback(()=>w==null?void 0:w.focus(),[w]),I=p.useCallback((V,_e,de)=>{const he=!U.current&&!de;(y.value!==void 0&&y.value===_e||he)&&$(V)},[y.value]),re=n==="popper"?tm:k_,xe=re===tm?{side:l,sideOffset:c,align:u,alignOffset:d,arrowPadding:h,collisionBoundary:m,collisionPadding:f,sticky:b,hideWhenDetached:g,avoidCollisions:v}:{};return i.jsx(__,{scope:r,content:w,viewport:j,onViewportChange:k,itemRefCallback:W,selectedItem:C,onItemLeave:se,itemTextRefCallback:I,focusSelectedItem:D,selectedItemText:T,position:n,isPositioned:M,searchRef:Y,children:i.jsx(zp,{as:kO,allowPinchZoom:!0,children:i.jsx(Up,{asChild:!0,trapped:y.open,onMountAutoFocus:V=>{V.preventDefault()},onUnmountAutoFocus:ae(s,V=>{var _e;(_e=y.trigger)==null||_e.focus({preventScroll:!0}),V.preventDefault()}),children:i.jsx(fl,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:V=>V.preventDefault(),onDismiss:()=>y.onOpenChange(!1),children:i.jsx(re,{role:"listbox",id:y.contentId,"data-state":y.open?"open":"closed",dir:y.dir,onContextMenu:V=>V.preventDefault(),...x,...xe,onPlaced:()=>R(!0),ref:S,style:{display:"flex",flexDirection:"column",outline:"none",...x.style},onKeyDown:ae(x.onKeyDown,V=>{const _e=V.ctrlKey||V.altKey||V.metaKey;if(V.key==="Tab"&&V.preventDefault(),!_e&&V.key.length===1&&te(V.key),["ArrowUp","ArrowDown","Home","End"].includes(V.key)){let he=O().filter(le=>!le.disabled).map(le=>le.ref.current);if(["ArrowUp","End"].includes(V.key)&&(he=he.slice().reverse()),["ArrowUp","ArrowDown"].includes(V.key)){const le=V.target,we=he.indexOf(le);he=he.slice(we+1)}setTimeout(()=>N(he)),V.preventDefault()}})})})})})})});j_.displayName=jO;var SO="SelectItemAlignedPosition",k_=p.forwardRef((e,t)=>{const{__scopeSelect:r,onPlaced:n,...s}=e,a=Es(ca,r),o=Ts(ca,r),[l,c]=p.useState(null),[u,d]=p.useState(null),h=Ee(t,S=>d(S)),m=dd(r),f=p.useRef(!1),b=p.useRef(!0),{viewport:g,selectedItem:v,selectedItemText:x,focusSelectedItem:y}=o,w=p.useCallback(()=>{if(a.trigger&&a.valueNode&&l&&u&&g&&v&&x){const S=a.trigger.getBoundingClientRect(),C=u.getBoundingClientRect(),P=a.valueNode.getBoundingClientRect(),T=x.getBoundingClientRect();if(a.dir!=="rtl"){const le=T.left-C.left,we=P.left-le,mt=S.left-we,Qt=S.width+mt,Ps=Math.max(Qt,C.width),Pn=window.innerWidth-gr,As=qx(we,[gr,Math.max(gr,Pn-Ps)]);l.style.minWidth=Qt+"px",l.style.left=As+"px"}else{const le=C.right-T.right,we=window.innerWidth-P.right-le,mt=window.innerWidth-S.right-we,Qt=S.width+mt,Ps=Math.max(Qt,C.width),Pn=window.innerWidth-gr,As=qx(we,[gr,Math.max(gr,Pn-Ps)]);l.style.minWidth=Qt+"px",l.style.right=As+"px"}const $=m(),O=window.innerHeight-gr*2,M=g.scrollHeight,R=window.getComputedStyle(u),U=parseInt(R.borderTopWidth,10),N=parseInt(R.paddingTop,10),D=parseInt(R.borderBottomWidth,10),E=parseInt(R.paddingBottom,10),A=U+N+M+E+D,Y=Math.min(v.offsetHeight*5,A),te=window.getComputedStyle(g),W=parseInt(te.paddingTop,10),se=parseInt(te.paddingBottom,10),I=S.top+S.height/2-gr,re=O-I,xe=v.offsetHeight/2,V=v.offsetTop+xe,_e=U+N+V,de=A-_e;if(_e<=I){const le=$.length>0&&v===$[$.length-1].ref.current;l.style.bottom="0px";const we=u.clientHeight-g.offsetTop-g.offsetHeight,mt=Math.max(re,xe+(le?se:0)+we+D),Qt=_e+mt;l.style.height=Qt+"px"}else{const le=$.length>0&&v===$[0].ref.current;l.style.top="0px";const mt=Math.max(I,U+g.offsetTop+(le?W:0)+xe)+de;l.style.height=mt+"px",g.scrollTop=_e-I+g.offsetTop}l.style.margin=`${gr}px 0`,l.style.minHeight=Y+"px",l.style.maxHeight=O+"px",n==null||n(),requestAnimationFrame(()=>f.current=!0)}},[m,a.trigger,a.valueNode,l,u,g,v,x,a.dir,n]);ft(()=>w(),[w]);const[_,j]=p.useState();ft(()=>{u&&j(window.getComputedStyle(u).zIndex)},[u]);const k=p.useCallback(S=>{S&&b.current===!0&&(w(),y==null||y(),b.current=!1)},[w,y]);return i.jsx(CO,{scope:r,contentWrapper:l,shouldExpandOnScrollRef:f,onScrollButtonChange:k,children:i.jsx("div",{ref:c,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:_},children:i.jsx(ue.div,{...s,ref:h,style:{boxSizing:"border-box",maxHeight:"100%",...s.style}})})})});k_.displayName=SO;var NO="SelectPopperPosition",tm=p.forwardRef((e,t)=>{const{__scopeSelect:r,align:n="start",collisionPadding:s=gr,...a}=e,o=hd(r);return i.jsx(r1,{...o,...a,ref:t,align:n,collisionPadding:s,style:{boxSizing:"border-box",...a.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)"}})});tm.displayName=NO;var[CO,Bp]=Ui(ca,{}),rm="SelectViewport",S_=p.forwardRef((e,t)=>{const{__scopeSelect:r,nonce:n,...s}=e,a=Ts(rm,r),o=Bp(rm,r),l=Ee(t,a.onViewportChange),c=p.useRef(0);return i.jsxs(i.Fragment,{children:[i.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}),i.jsx(ud.Slot,{scope:r,children:i.jsx(ue.div,{"data-radix-select-viewport":"",role:"presentation",...s,ref:l,style:{position:"relative",flex:1,overflow:"hidden auto",...s.style},onScroll:ae(s.onScroll,u=>{const d=u.currentTarget,{contentWrapper:h,shouldExpandOnScrollRef:m}=o;if(m!=null&&m.current&&h){const f=Math.abs(c.current-d.scrollTop);if(f>0){const b=window.innerHeight-gr*2,g=parseFloat(h.style.minHeight),v=parseFloat(h.style.height),x=Math.max(g,v);if(x<b){const y=x+f,w=Math.min(b,y),_=y-w;h.style.height=w+"px",h.style.bottom==="0px"&&(d.scrollTop=_>0?_:0,h.style.justifyContent="flex-end")}}}c.current=d.scrollTop})})})]})});S_.displayName=rm;var N_="SelectGroup",[EO,TO]=Ui(N_),PO=p.forwardRef((e,t)=>{const{__scopeSelect:r,...n}=e,s=ds();return i.jsx(EO,{scope:r,id:s,children:i.jsx(ue.div,{role:"group","aria-labelledby":s,...n,ref:t})})});PO.displayName=N_;var C_="SelectLabel",E_=p.forwardRef((e,t)=>{const{__scopeSelect:r,...n}=e,s=TO(C_,r);return i.jsx(ue.div,{id:s.id,...n,ref:t})});E_.displayName=C_;var wu="SelectItem",[AO,T_]=Ui(wu),P_=p.forwardRef((e,t)=>{const{__scopeSelect:r,value:n,disabled:s=!1,textValue:a,...o}=e,l=Es(wu,r),c=Ts(wu,r),u=l.value===n,[d,h]=p.useState(a??""),[m,f]=p.useState(!1),b=Ee(t,y=>{var w;return(w=c.itemRefCallback)==null?void 0:w.call(c,y,n,s)}),g=ds(),v=p.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 i.jsx(AO,{scope:r,value:n,disabled:s,textId:g,isSelected:u,onItemTextChange:p.useCallback(y=>{h(w=>w||((y==null?void 0:y.textContent)??"").trim())},[]),children:i.jsx(ud.ItemSlot,{scope:r,value:n,disabled:s,textValue:d,children:i.jsx(ue.div,{role:"option","aria-labelledby":g,"data-highlighted":m?"":void 0,"aria-selected":u&&m,"data-state":u?"checked":"unchecked","aria-disabled":s||void 0,"data-disabled":s?"":void 0,tabIndex:s?void 0:-1,...o,ref:b,onFocus:ae(o.onFocus,()=>f(!0)),onBlur:ae(o.onBlur,()=>f(!1)),onClick:ae(o.onClick,()=>{v.current!=="mouse"&&x()}),onPointerUp:ae(o.onPointerUp,()=>{v.current==="mouse"&&x()}),onPointerDown:ae(o.onPointerDown,y=>{v.current=y.pointerType}),onPointerMove:ae(o.onPointerMove,y=>{var w;v.current=y.pointerType,s?(w=c.onItemLeave)==null||w.call(c):v.current==="mouse"&&y.currentTarget.focus({preventScroll:!0})}),onPointerLeave:ae(o.onPointerLeave,y=>{var w;y.currentTarget===document.activeElement&&((w=c.onItemLeave)==null||w.call(c))}),onKeyDown:ae(o.onKeyDown,y=>{var _;((_=c.searchRef)==null?void 0:_.current)!==""&&y.key===" "||(gO.includes(y.key)&&x(),y.key===" "&&y.preventDefault())})})})})});P_.displayName=wu;var uo="SelectItemText",A_=p.forwardRef((e,t)=>{const{__scopeSelect:r,className:n,style:s,...a}=e,o=Es(uo,r),l=Ts(uo,r),c=T_(uo,r),u=wO(uo,r),[d,h]=p.useState(null),m=Ee(t,x=>h(x),c.onItemTextChange,x=>{var y;return(y=l.itemTextRefCallback)==null?void 0:y.call(l,x,c.value,c.disabled)}),f=d==null?void 0:d.textContent,b=p.useMemo(()=>i.jsx("option",{value:c.value,disabled:c.disabled,children:f},c.value),[c.disabled,c.value,f]),{onNativeOptionAdd:g,onNativeOptionRemove:v}=u;return ft(()=>(g(b),()=>v(b)),[g,v,b]),i.jsxs(i.Fragment,{children:[i.jsx(ue.span,{id:c.textId,...a,ref:m}),c.isSelected&&o.valueNode&&!o.valueNodeHasChildren?fa.createPortal(a.children,o.valueNode):null]})});A_.displayName=uo;var R_="SelectItemIndicator",O_=p.forwardRef((e,t)=>{const{__scopeSelect:r,...n}=e;return T_(R_,r).isSelected?i.jsx(ue.span,{"aria-hidden":!0,...n,ref:t}):null});O_.displayName=R_;var nm="SelectScrollUpButton",I_=p.forwardRef((e,t)=>{const r=Ts(nm,e.__scopeSelect),n=Bp(nm,e.__scopeSelect),[s,a]=p.useState(!1),o=Ee(t,n.onScrollButtonChange);return ft(()=>{if(r.viewport&&r.isPositioned){let l=function(){const u=c.scrollTop>0;a(u)};const c=r.viewport;return l(),c.addEventListener("scroll",l),()=>c.removeEventListener("scroll",l)}},[r.viewport,r.isPositioned]),s?i.jsx(D_,{...e,ref:o,onAutoScroll:()=>{const{viewport:l,selectedItem:c}=r;l&&c&&(l.scrollTop=l.scrollTop-c.offsetHeight)}}):null});I_.displayName=nm;var sm="SelectScrollDownButton",M_=p.forwardRef((e,t)=>{const r=Ts(sm,e.__scopeSelect),n=Bp(sm,e.__scopeSelect),[s,a]=p.useState(!1),o=Ee(t,n.onScrollButtonChange);return ft(()=>{if(r.viewport&&r.isPositioned){let l=function(){const u=c.scrollHeight-c.clientHeight,d=Math.ceil(c.scrollTop)<u;a(d)};const c=r.viewport;return l(),c.addEventListener("scroll",l),()=>c.removeEventListener("scroll",l)}},[r.viewport,r.isPositioned]),s?i.jsx(D_,{...e,ref:o,onAutoScroll:()=>{const{viewport:l,selectedItem:c}=r;l&&c&&(l.scrollTop=l.scrollTop+c.offsetHeight)}}):null});M_.displayName=sm;var D_=p.forwardRef((e,t)=>{const{__scopeSelect:r,onAutoScroll:n,...s}=e,a=Ts("SelectScrollButton",r),o=p.useRef(null),l=dd(r),c=p.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return p.useEffect(()=>()=>c(),[c]),ft(()=>{var d;const u=l().find(h=>h.ref.current===document.activeElement);(d=u==null?void 0:u.ref.current)==null||d.scrollIntoView({block:"nearest"})},[l]),i.jsx(ue.div,{"aria-hidden":!0,...s,ref:t,style:{flexShrink:0,...s.style},onPointerDown:ae(s.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(n,50))}),onPointerMove:ae(s.onPointerMove,()=>{var u;(u=a.onItemLeave)==null||u.call(a),o.current===null&&(o.current=window.setInterval(n,50))}),onPointerLeave:ae(s.onPointerLeave,()=>{c()})})}),RO="SelectSeparator",L_=p.forwardRef((e,t)=>{const{__scopeSelect:r,...n}=e;return i.jsx(ue.div,{"aria-hidden":!0,...n,ref:t})});L_.displayName=RO;var am="SelectArrow",OO=p.forwardRef((e,t)=>{const{__scopeSelect:r,...n}=e,s=hd(r),a=Es(am,r),o=Ts(am,r);return a.open&&o.position==="popper"?i.jsx(n1,{...s,...n,ref:t}):null});OO.displayName=am;var IO="SelectBubbleInput",$_=p.forwardRef(({__scopeSelect:e,value:t,...r},n)=>{const s=p.useRef(null),a=Ee(n,s),o=qp(t);return p.useEffect(()=>{const l=s.current;if(!l)return;const c=window.HTMLSelectElement.prototype,d=Object.getOwnPropertyDescriptor(c,"value").set;if(o!==t&&d){const h=new Event("change",{bubbles:!0});d.call(l,t),l.dispatchEvent(h)}},[o,t]),i.jsx(ue.select,{...r,style:{...Bw,...r.style},ref:a,defaultValue:t})});$_.displayName=IO;function F_(e){return e===""||e===void 0}function U_(e){const t=or(e),r=p.useRef(""),n=p.useRef(0),s=p.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]),a=p.useCallback(()=>{r.current="",window.clearTimeout(n.current)},[]);return p.useEffect(()=>()=>window.clearTimeout(n.current),[]),[r,s,a]}function q_(e,t,r){const s=t.length>1&&Array.from(t).every(u=>u===t[0])?t[0]:t,a=r?e.indexOf(r):-1;let o=MO(e,Math.max(a,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 MO(e,t){return e.map((r,n)=>e[(t+n)%e.length])}var DO=m_,z_=g_,LO=y_,$O=v_,FO=w_,B_=b_,UO=S_,W_=E_,H_=P_,qO=A_,zO=O_,V_=I_,G_=M_,Y_=L_;const It=DO,Mt=LO,St=p.forwardRef(({className:e,children:t,...r},n)=>i.jsxs(z_,{ref:n,className:ce("flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm r
545ing-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",e),...r,children:[t,i.jsx($O,{asChild:!0,children:i.jsx(Cr,{className:"h-4 w-4 opacity-50"})})]}));St.displayName=z_.displayName;const K_=p.forwardRef(({className:e,...t},r)=>i.jsx(V_,{ref:r,className:ce("flex cursor-default items-center justify-center py-1",e),...t,children:i.jsx(Gr,{className:"h-4 w-4"})}));K_.displayName=V_.displayName;const Q_=p.forwardRef(({className:e,...t},r)=>i.jsx(G_,{ref:r,className:ce("flex cursor-default items-center justify-center py-1",e),...t,children:i.jsx(Cr,{className:"h-4 w-4"})}));Q_.displayName=G_.displayName;const Nt=p.forwardRef(({className:e,children:t,position:r="popper",...n},s)=>i.jsx(FO,{children:i.jsxs(B_,{ref:s,className:ce("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",r==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:r,...n,children:[i.jsx(K_,{}),i.jsx(UO,{className:ce("p-1",r==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),i.jsx(Q_,{})]})}));Nt.displayName=B_.displayName;const BO=p.forwardRef(({className:e,...t},r)=>i.jsx(W_,{ref:r,className:ce("py-1.5 pl-8 pr-2 text-sm font-semibold",e),...t}));BO.displayName=W_.displayName;const Ce=p.forwardRef(({className:e,children:t,...r},n)=>i.jsxs(H_,{ref:n,className:ce("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 focus:bg-accent focus:text-accent-foreground",e),...r,children:[i.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:i.jsx(zO,{children:i.jsx(pl,{className:"h-4 w-4"})})}),i.jsx(qO,{children:t})]}));Ce.displayName=H_.displayName;const WO=p.forwardRef(({className:e,...t},r)=>i.jsx(Y_,{ref:r,className:ce("-mx-1 my-1 h-px bg-muted",e),...t}));WO.displayName=Y_.displayName;const HO=["Year 7","Year 8","Year 9","Year 10","Year 11"],Zx=["1","2","3","4","5","6","7","8","9"],VO=({yearGroup:e,currentGrade:t,targetGrade:r,userId:n,onUpdate:s})=>{const[a,o]=p.useState(!1),[l,c]=p.useState(!1),[u,d]=p.useState(e||""),[h,m]=p.useState(t||""),[f,b]=p.useState(r||""),g=async()=>{c(!0);const v={year_group:u||null,current_grade:h||null,target_grade:f||null,updated_at:new Date().toISOString()},{error:x}=await F.from("profiles").update(v).eq("id",n);x?Ke.error("Failed to save changes"):(s(v),Ke.success("Updated successfully"),o(!1)),c(!1)};return a?i.jsx(z,{className:"mb-6",children:i.jsxs(B,{className:"p-4",children:[i.jsxs("div",{className:"flex items-center justify-between mb-3",children:[i.jsx("span",{className:"text-sm font-bold text-foreground",children:"Edit Details"}),i.jsxs(ne,{size:"sm",variant:"ghost",onClick:g,disabled:l,children:[i.jsx(pl,{className:"w-4 h-4 mr-1"}),l?"Savingâ¦":"Save"]})]}),i.jsxs("div",{className:"space-y-3",children:[i.jsxs("div",{children:[i.jsx("label",{className:"text-xs text-muted-foreground mb-1 block",children:"Year Group"}),i.jsxs(It,{value:u,onValueChange:d,children:[i.jsx(St,{className:"h-9",children:i.jsx(Mt,{placeholder:"Select year"})}),i.jsx(Nt,{children:HO.map(v=>i.jsx(Ce,{value:v,children:v},v))})]})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[i.jsxs("div",{children:[i.jsx("label",{className:"text-xs text-muted-foreground mb-1 block",children:"Current Grade"}),i.jsxs(It,{value:h,onValueChange:m,children:[i.jsx(St,{className:"h-9",children:i.jsx(Mt,{placeholder:"Grade"})}),i.jsx(Nt,{children:Zx.map(v=>i.jsxs(Ce,{value:v,children:["Grade ",v]},v))})]})]}),i.jsxs("div",{children:[i.jsx("label",{className:"text-xs text-muted-foreground mb-1 block",children:"Target Grade"}),i.jsxs(It,{value:f,onValueChange:b,children:[i.jsx(St,{className:"h-9",children:i.jsx(Mt,{placeholder:"Grade"})}),i.jsx(Nt,{children:Zx.map(v=>i.jsxs(Ce,{value:v,children:["Grade ",v]},v))})]})]})]})]})]})}):i.jsx(z,{className:"mb-6",children:i.jsxs(B,{className:"p-4",children:[i.jsx("div",{className:"flex items-center justify-end mb-2",children:i.jsxs(ne,{size:"sm",variant:"ghost",className:"h-7 px-2 text-xs text-muted-foreground",onClick:()=>
vendor: 7,164 bytes, lines 545-549
545o(!0),children:[i.jsx(rC,{className:"w-3 h-3 mr-1"}),"Edit"]})}),i.jsxs("div",{className:"grid grid-cols-3 gap-3 text-center",children:[i.jsxs("div",{className:"flex flex-col items-center gap-1.5 p-3 rounded-xl bg-primary/5",children:[i.jsx(tn,{className:"w-5 h-5 text-primary"}),i.jsx("span",{className:"text-xs text-muted-foreground",children:"Year Group"}),i.jsx("span",{className:"text-sm font-bold text-foreground",children:e||"â"})]}),i.jsxs("div",{className:"flex flex-col items-center gap-1.5 p-3 rounded-xl bg-warning/5",children:[i.jsx(rn,{className:"w-5 h-5 text-warning"}),i.jsx("span",{className:"text-xs text-muted-foreground",children:"Current"}),i.jsx("span",{className:"text-sm font-bold text-foreground",children:t?`Grade ${t}`:"â"})]}),i.jsxs("div",{className:"flex flex-col items-center gap-1.5 p-3 rounded-xl bg-success/5",children:[i.jsx(bn,{className:"w-5 h-5 text-success"}),i.jsx("span",{className:"text-xs text-muted-foreground",children:"Target"}),i.jsx("span",{className:"text-sm font-bold text-foreground",children:r?`Grade ${r}`:"â"})]})]})]})})};var fd="Dialog",[J_,vL]=Mr(fd),[GO,Dr]=J_(fd),Z_=e=>{const{__scopeDialog:t,children:r,open:n,defaultOpen:s,onOpenChange:a,modal:o=!0}=e,l=p.useRef(null),c=p.useRef(null),[u,d]=xs({prop:n,defaultProp:s??!1,onChange:a,caller:fd});return i.jsx(GO,{scope:t,triggerRef:l,contentRef:c,contentId:ds(),titleId:ds(),descriptionId:ds(),open:u,onOpenChange:d,onOpenToggle:p.useCallback(()=>d(h=>!h),[d]),modal:o,children:r})};Z_.displayName=fd;var X_="DialogTrigger",ej=p.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,s=Dr(X_,r),a=Ee(t,s.triggerRef);return i.jsx(ue.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":Vp(s.open),...n,ref:a,onClick:ae(e.onClick,s.onOpenToggle)})});ej.displayName=X_;var Wp="DialogPortal",[YO,tj]=J_(Wp,{forceMount:void 0}),rj=e=>{const{__scopeDialog:t,forceMount:r,children:n,container:s}=e,a=Dr(Wp,t);return i.jsx(YO,{scope:t,forceMount:r,children:p.Children.map(n,o=>i.jsx(Ns,{present:r||a.open,children:i.jsx(Bu,{asChild:!0,container:s,children:o})}))})};rj.displayName=Wp;var bu="DialogOverlay",nj=p.forwardRef((e,t)=>{const r=tj(bu,e.__scopeDialog),{forceMount:n=r.forceMount,...s}=e,a=Dr(bu,e.__scopeDialog);return a.modal?i.jsx(Ns,{present:n||a.open,children:i.jsx(QO,{...s,ref:t})}):null});nj.displayName=bu;var KO=wi("DialogOverlay.RemoveScroll"),QO=p.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,s=Dr(bu,r);return i.jsx(zp,{as:KO,allowPinchZoom:!0,shards:[s.contentRef],children:i.jsx(ue.div,{"data-state":Vp(s.open),...n,ref:t,style:{pointerEvents:"auto",...n.style}})})}),ua="DialogContent",sj=p.forwardRef((e,t)=>{const r=tj(ua,e.__scopeDialog),{forceMount:n=r.forceMount,...s}=e,a=Dr(ua,e.__scopeDialog);return i.jsx(Ns,{present:n||a.open,children:a.modal?i.jsx(JO,{...s,ref:t}):i.jsx(ZO,{...s,ref:t})})});sj.displayName=ua;var JO=p.forwardRef((e,t)=>{const r=Dr(ua,e.__scopeDialog),n=p.useRef(null),s=Ee(t,r.contentRef,n);return p.useEffect(()=>{const a=n.current;if(a)return o_(a)},[]),i.jsx(aj,{...e,ref:s,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:ae(e.onCloseAutoFocus,a=>{var o;a.preventDefault(),(o=r.triggerRef.current)==null||o.focus()}),onPointerDownOutside:ae(e.onPointerDownOutside,a=>{const o=a.detail.originalEvent,l=o.button===0&&o.ctrlKey===!0;(o.button===2||l)&&a.preventDefault()}),onFocusOutside:ae(e.onFocusOutside,a=>a.preventDefault())})}),ZO=p.forwardRef((e,t)=>{const r=Dr(ua,e.__scopeDialog),n=p.useRef(!1),s=p.useRef(!1);return i.jsx(aj,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:a=>{var o,l;(o=e.onCloseAutoFocus)==null||o.call(e,a),a.defaultPrevented||(n.current||(l=r.triggerRef.current)==null||l.focus(),a.preventDefault()),n.current=!1,s.current=!1},onInteractOutside:a=>{var c,u;(c=e.onInteractOutside)==null||c.call(e,a),a.defaultPrevented||(n.current=!0,a.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const o=a.target;((u=r.triggerRef.current)==null?void 0:u.contains(o))&&a.preventDefault(),a.detail.originalEvent.type==="focusin"&&s.current&&a.preventDefault()}})}),aj=p.forwardRef((e,t)=>{const{__scopeDialog:r,trapFocus:n,onOpenAutoFocus:s,onCloseAutoFocus:a,...o}=e,l=Dr(ua,r),c=p.useRef(null),u=Ee(t,c);return s_(),i.jsxs(i.Fragment,{children:[i.jsx(Up,{asChild:!0,loop:!0,trapped:n,onMountAutoFocus:s,onUnmountAutoFocus:a,children:i.jsx(fl,{role:"dialog",id:l.contentId,"aria-describedby":l.descriptionId,"aria-labelledby":l.titleId,"data-state":Vp(l.open),...o,ref:u,onDismiss:()=>l.onOpenChange(!1)})}),i.jsxs(i.Fragment,{children:[i.jsx(XO,{titleId:l.titleId}),i.jsx(tI,{contentRef:c,descriptionId:l.descriptionId})]})]})}),Hp="DialogTitle",ij=p.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,s=Dr(Hp,r);return i.jsx(ue.h2,{id:s.titleId,...n,ref:t})});ij.displayName=Hp;var oj="DialogDescription",lj=p.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,s=Dr(oj,r);return i.jsx(ue.p,{id:s.descriptionId,...n,ref:t})});lj.displayName=oj;var cj="DialogClose",uj=p.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,s=Dr(cj,r);return i.jsx(ue.button,{type:"button",...n,ref:t,onClick:ae(e.onClick,()=>s.onOpenChange(!1))})});uj.displayName=cj;function Vp(e){return e?"open":"closed"}var dj="DialogTitleWarning",[wL,hj]=KN(dj,{contentName:ua,titleName:Hp,docsSlug:"dialog"}),XO=({titleId:e})=>{const t=hj(dj),r=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users. 546 547If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component. 548 549For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return p.useEffect(()=>{e&&(document.getElementById(e)||console.error(r))},[r,e]),null},eI="DialogDescriptionWarning",tI=({contentRef:e,descriptionId:t})=>{const n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${hj(eI).contentName}}.`;return p.useEffect(()=>{var a;const s=(a=e.current)==null?void 0:a.getAttribute("aria-describedby");t&&s&&(document.getElementById(t)||console.warn(n))},[n,e,t]),null},rI=Z_,nI=ej,sI=rj,fj=nj,mj=sj,pj=ij,gj=lj,aI=uj;const Sn=rI,_u=nI,iI=sI,xj=p.forwardRef(({className:e,...t},r)=>i.jsx(fj,{ref:r,className:ce("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t}));xj.displayName=fj.displayName;const Jr=p.forwardRef(({className:e,children:t,...r},n)=>i.jsxs(iI,{children:[i.jsx(xj,{}),i.jsxs(mj,{ref:n,className:ce("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border 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,i.jsxs(aI,{className:"absolute right-4 top-4 roun
549ded-sm opacity-70 ring-offset-background transition-opacity data-[state=open]:bg-accent data-[state=open]:text-muted-foreground hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none",children:[i.jsx(hp,{className:"h-4 w-4"}),i.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Jr.displayName=mj.displayName;const Zr=({className:e,...t})=>i.jsx("div",{className:ce("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});Zr.displayName="DialogHeader";const Xr=p.forwardRef(({className:e,...t},r)=>i.jsx(pj,{ref:r,className:ce("text-lg font-semibold leading-none tracking-tight",e),...t}));Xr.displayName=pj.displayName;const oI=p.forwardRef(({className:e,...t},r)=>i.jsx(gj,{ref:r,className:ce("text-sm text-muted-foreground",e),...t}));oI.displayName=gj.displayName;function lI(e){const[t,r]=p.useState([]),[n,s]=p.useState(!0),a=p.useCallback(async()=>{if(!e){s(!1);return}s(!0);const{data:c}=await F.from("student_exams").select("*").eq("user_id",e).order("exam_date",{ascending:!0});c&&r(c),s(!1)},[e]);return p.useEffect(()=>{a()},[a]),{exams:t,loading:n,addExam:async c=>{if(!e)return;const{error:u}=await F.from("student_exams").insert({user_id:e,...c});return u||await a(),u},deleteExam:async c=>{const{error:u}=await F.from("student_exams").delete().eq("id",c);return u||await a(),u},refetch:a}}const cI=({userId:e})=>{const{exams:t,addExam:r,deleteExam:n}=lI(e),[s,a]=p.useState(!1),[o,l]=p.useState("aqa"),[c,u]=p.useState("real"),[d,h]=p.useState("1"),[m,f]=p.useState("higher"),[b,g]=p.useState(""),v=S=>{const C=new Date(S).getTime()-new Date().getTime();return Math.ceil(C/(1e3*60*60*24))},x=async()=>{if(!b){Ke.error("Please select an exam date");return}await r({exam_board:o,exam_type:c,paper_number:parseInt(d),tier:m,exam_date:b})?Ke.error("Failed to add exam"):(Ke.success("Exam date added!"),a(!1),g(""))},y=async S=>{await n(S),Ke.success("Exam removed")},w=t.filter(S=>S.exam_type==="real"),_=t.filter(S=>S.exam_type==="mock"),j=S=>S<0?"text-muted-foreground":S<=7?"text-destructive":S<=30?"text-warning":"text-success",k=(S,C)=>S.length===0?null:i.jsxs("div",{className:"space-y-2",children:[i.jsx("h4",{className:"text-xs font-bold text-muted-foreground uppercase tracking-wider",children:C}),S.map(P=>{const T=v(P.exam_date),$=T<0;return i.jsxs("div",{className:"flex items-center gap-3 p-3 rounded-xl bg-muted/50",children:[i.jsx("div",{className:"w-10 h-10 rounded-lg bg-primary/10 flex items-center justify-center shrink-0",children:i.jsx(Xc,{className:"w-5 h-5 text-primary"})}),i.jsxs("div",{className:"flex-1 min-w-0",children:[i.jsxs("div",{className:"flex items-center gap-1.5",children:[i.jsx("span",{className:"font-bold text-sm text-foreground uppercase",children:P.exam_board}),i.jsxs("span",{className:"text-xs text-muted-foreground",children:["Paper ",P.paper_number]}),i.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded-full bg-muted font-medium text-muted-foreground capitalize",children:P.tier})]}),i.jsx("p",{className:"text-xs text-muted-foreground",children:new Date(P.exam_date).toLocaleDateString("en-GB",{weekday:"short",day:"numeric",month:"short",year:"numeric"})})]}),i.jsx("div",{className:"text-right shrink-0",children:$?i.jsx("span",{className:"text-xs text-muted-foreground font-medium",children:"Done"}):i.jsxs(i.Fragment,{children:[i.jsx("div",{className:`text-lg font-extrabold ${j(T)}`,children:T}),i.jsx("div",{className:"text-[10px] text-muted-foreground font-medium",children:"days left"})]})}),i.jsx(ne,{variant:"ghost",size:"icon",className:"shrink-0 h-8 w-8",onClick:()=>y(P.id),children:i.jsx(_b,{className:"w-3.5 h-3.5 text-muted-foreground"})})]},P.id)})]});return i.jsxs("section",{children:[i.jsxs("div",{className:"flex items-center justify-between mb-3",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(W2,{className:"w-5 h-5 text-primary"}),i.jsx("h2",{className:"text-lg font-bold text-foreground",children:"My Exams"})]}),i.jsxs(Sn,{open:s,onOpenChange:a,children:[i.jsx(_u,{asChild:!0,children:i.jsxs(ne,{size:"sm",variant:"outline",className:"gap-1.5 text-xs",children:[i.jsx(aa,{className:"w-3.5 h-3.5"})," Add Exam"]})}),i.jsxs(Jr,{className:"max-w-sm",children:[i.jsx(Zr,{children:i.jsx(Xr,{children:"Add Exam Date"})}),i.jsxs("div",{className:"space-y-4 pt-2",children:[i.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[i.jsxs("div",{children:[i.jsx("label",{className:"text-xs font-semibold text-foreground mb-1 block",children:"Exam Type"}),i.jsxs(It,{value:c,onValueChange:S=>u(S),children:[i.jsx(St,{children:i.jsx(Mt,{})}),i.jsxs(Nt,{children:[i.jsx(Ce,{value:"real",children:"Real Exam"}),i.jsx(Ce,{value:"mock",children:"Mock Exam"})]})]})]}),i.jsxs("div",{children:[i.jsx("label",{className:"text-xs font-semibold text-foreground mb-1 block",children:"Exam Board"}),i.jsxs(It,{value:o,onValueChange:l,children:[i.jsx(St,{children:i.jsx(Mt,{})}),i.jsxs(Nt,{children:[i.jsx(Ce,{value:"aqa",children:"AQA"}),i.jsx(Ce,{value:"edexcel",children:"Edexcel"}),i.jsx(Ce,{value:"ocr",children:"OCR"}),i.jsx(Ce,{value:"igcse",children:"IGCSE"})]})]})]})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[i.jsxs("div",{children:[i.jsx("label",{className:"text-xs font-semibold text-foreground mb-1 block",children:"Paper"}),i.jsxs(It,{value:d,onValueChange:h,children:[i.jsx(St,{children:i.jsx(Mt,{})}),i.jsxs(Nt,{children:[i.jsx(Ce,{value:"1",children:"Paper 1"}),i.jsx(Ce,{value:"2",children:"Paper 2"}),i.jsx(Ce,{value:"3",children:"Paper 3"})]})]})]}),i.jsxs("div",{children:[i.jsx("label",{className:"text-xs font-semibold text-foreground mb-1 block",children:"Tier"}),i.jsxs(It,{value:m,onValueChange:f,children:[i.jsx(St,{children:i.jsx(Mt,{})}),i.jsxs(Nt,{children:[i.jsx(Ce,{value:"foundation",children:"Foundation"}),i.jsx(Ce,{value:"higher",children:"Higher"})]})]})]})]}),i.jsxs("div",{children:[i.jsx("label",{className:"text-xs font-semibold text-foreground mb-1 block",children:"Exam Date"}),i.jsx(et,{type:"date",value:b,onChange:S=>g(S.target.value)})]}),i.jsx(ne,{onClick:x,className:"w-full",children:"Add Exam Date"})]})]})]})]}),t.length===0?i.jsx(z,{className:"shadow-card",children:i.jsxs(B,{className:"p-6 text-center",children:[i.jsx(wn,{className:"w-8 h-8 text-muted-foreground mx-auto mb-2"}),i.jsx("p",{className:"text-sm text-muted-foreground",children:'No exams added yet. Tap "Add Exam" to set your exam dates and see the countdown.'})]})}):i.jsx(z,{className:"shadow-card",children:i.jsxs(B,{className:"p-4 space-y-4",children:[k(w,"ð Real Exams"),k(_,"ð Mock Exams")]})})]})},uI=()=>{const e=new Date().getHours();return e<12?"Good morning":e<18?"Good afternoon":"Good evening"},dI=e=>({bronze:"bg-bronze",silver:"bg-silver",gold:"bg-gold",diamond:"bg-diamond"})[e],hI=({profile:e,topicProgress:t,subtopics:r,quizStats:n,userId:s,onProfileUpdate:a})=>{var v,x;const o=e.xp||0,l=((v=Object.entries(Ca).reverse().find(([y,w])=>o>=w))==null?void 0:v[0])||"bronze",c=l==="diamond"?null:Object.keys(Ca)[Object.keys(Ca).indexOf(l)+1],u=c?Ca[c]:o,d=c?(o-Ca[l])/(u-Ca[l])*100:100,m=r.filter(y=>{const w=t.find(_=>_.topic_id===y.id);return!w||w.mastery_level!=="confident"}).slice(0,2),f=((x=e.display_name)==null?void 0:x.split(" ")[0])||"there",b=uI(),g=Rt.motivation[Math.floor(Math.random()*Rt.motivation.length)];return i.jsxs("div",{className:"space-y-6",children:[i.jsxs("section",{children:[i.jsxs("h1",{className:"text-2xl font-bold text-foreground mb-1",children:[b,", ",f,"! ð"]}),i.jsx("p",{className:"text-muted-foreground text-sm",children:g})]}),i.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[i.jsx(z,{className:"shadow-card",children:i.jsxs(B,{className:"p-3 text-center",children:[i.jsx("div",{className:"flex items-center justify-center gap-1 mb-1",children:i.jsx(lp,{className:"w-4 h-4 text-streak"})}),i.jsx("div",{className:"text-xl font-extrabold text-foreground",children:e.current_streak||0}),i.jsx("div",{className:"text-[10px] text-muted-foreground font-semibold",children:"Day Streak"})]})}),i.jsx(z,{className:"shadow-card",children:i.jsxs(B,{className:"p-3 text-center",children:[i.jsx("div",{className:"flex items-center justify-center gap-1 mb-1",children:i.jsx(fp,{className:"w-4 h-4 text-xp"})}),i.jsx("div",{className:"text-xl font-extrabold text-foreground",children:o}),i.jsx("div",{className:"text-[10px] text-muted-foreground font-semibold",children:"XP Earned"})]})}),i.jsx(z,{className:"shadow-card",children:i.jsxs(B,{className:"p-3 text-center",children:[i.jsx("div",{className:"flex items-center justify-center gap-1 mb-1",children:i.jsx(tu,{className:"w-4 h-4 text-gold"})}),i.jsx("div",{className:"text-xl font-extrabold text-foreground",children:n.quizzesTaken}),i.jsx("div",{className:"text-[10px] text-muted-foreground font-semibold",children:"Qu
549izzes"})]})})]}),i.jsx(z,{className:"shadow-card overflow-hidden",children:i.jsxs(B,{className:"p-4",children:[i.jsxs("div",{className:"flex items-center gap-4 mb-3",children:[i.jsx("div",{className:`w-12 h-12 rounded-xl flex items-center justify-center ${dI(l)}`,children:i.jsx(gl,{className:"w-6 h-6 text-primary-foreground"})}),i.jsxs("div",{className:"flex-1",children:[i.jsxs("div",{className:"flex items-center justify-between mb-1",children:[i.jsxs("span",{className:"font-bold text-foreground",children:[Zf[l]," Level"]}),i.jsxs("span",{className:"text-sm text-muted-foreground",children:[o," XP"]})]}),i.jsx(sn,{value:d,className:"h-2"})]})]}),c&&i.jsxs("p",{className:"text-xs text-muted-foreground text-center",children:[u-o," XP to ",Zf[c]]})]})}),i.jsx(_3,{}),i.jsx(VO,{yearGroup:e.year_group,currentGrade:e.current_grade,targetGrade:e.target_grade,userId:s,onUpdate:y=>a(y)}),i.jsx(cI,{userId:s}),i.jsxs("section",{children:[i.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[i.jsx(bn,{className:"w-5 h-5 text-primary"}),i.jsx("h2",{className:"text-lg font-bold text-foreground",children:"Today's Focus"})]}),m.length>0?i.jsx("div",{className:"space-y-2",children:m.map(y=>{const w=t.find(j=>j.topic_id===y.id),_=(w==null?void 0:w.mastery_level)||"not_started";return i.jsx(mn,{to:`/quiz/${y.id}`,children:i.jsx(z,{className:"hover:border-primary/50 transition-colors shadow-card",children:i.jsxs(B,{className:"flex items-center gap-4 p-4",children:[i.jsx("div",{className:"w-12 h-12 rounded-xl bg-primary/10 flex items-center justify-center text-primary",children:i.jsx(sr,{className:"w-6 h-6"})}),i.jsxs("div",{className:"flex-1",children:[i.jsx("h3",{className:"font-bold text-foreground text-sm",children:y.name}),i.jsx("span",{className:`text-xs px-2 py-0.5 rounded-full font-medium ${_==="confident"?"bg-success/10 text-success":_==="practising"?"bg-warning/10 text-warning":"bg-muted text-muted-foreground"}`,children:od[_]})]}),i.jsx(fb,{className:"w-5 h-5 text-muted-foreground"})]})})},y.id)})}):i.jsx(z,{className:"bg-success/10 border-success shadow-card",children:i.jsxs(B,{className:"p-4 text-center",children:[i.jsx(tu,{className:"w-8 h-8 text-success mx-auto mb-2"}),i.jsx("p",{className:"font-bold text-success",children:"Amazing! You're confident in all topics!"})]})})]})]})},fI=Vu("inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function Ir({className:e,variant:t,...r}){return i.jsx("div",{className:ce(fI({variant:t}),e),...r})}var xh="rovingFocusGroup.onEntryFocus",mI={bubbles:!1,cancelable:!0},vl="RovingFocusGroup",[im,yj,pI]=np(vl),[gI,vj]=Mr(vl,[pI]),[xI,yI]=gI(vl),wj=p.forwardRef((e,t)=>i.jsx(im.Provider,{scope:e.__scopeRovingFocusGroup,children:i.jsx(im.Slot,{scope:e.__scopeRovingFocusGroup,children:i.jsx(vI,{...e,ref:t})})}));wj.displayName=vl;var vI=p.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:r,orientation:n,loop:s=!1,dir:a,currentTabStopId:o,defaultCurrentTabStopId:l,onCurrentTabStopIdChange:c,onEntryFocus:u,preventScrollOnEntryFocus:d=!1,...h}=e,m=p.useRef(null),f=Ee(t,m),b=Fp(a),[g,v]=xs({prop:o,defaultProp:l??null,onChange:c,caller:vl}),[x,y]=p.useState(!1),w=or(u),_=yj(r),j=p.useRef(!1),[k,S]=p.useState(0);return p.useEffect(()=>{const C=m.current;if(C)return C.addEventListener(xh,w),()=>C.removeEventListener(xh,w)},[w]),i.jsx(xI,{scope:r,orientation:n,dir:b,loop:s,currentTabStopId:g,onItemFocus:p.useCallback(C=>v(C),[v]),onItemShiftTab:p.useCallback(()=>y(!0),[]),onFocusableItemAdd:p.useCallback(()=>S(C=>C+1),[]),onFocusableItemRemove:p.useCallback(()=>S(C=>C-1),[]),children:i.jsx(ue.div,{tabIndex:x||k===0?-1:0,"data-orientation":n,...h,ref:f,style:{outline:"none",...e.style},onMouseDown:ae(e.onMouseDown,()=>{j.current=!0}
vendor: 9,444 bytes, line 549
549),onFocus:ae(e.onFocus,C=>{const P=!j.current;if(C.target===C.currentTarget&&P&&!x){const T=new CustomEvent(xh,mI);if(C.currentTarget.dispatchEvent(T),!T.defaultPrevented){const $=_().filter(N=>N.focusable),O=$.find(N=>N.active),M=$.find(N=>N.id===g),U=[O,M,...$].filter(Boolean).map(N=>N.ref.current);jj(U,d)}}j.current=!1}),onBlur:ae(e.onBlur,()=>y(!1))})})}),bj="RovingFocusGroupItem",_j=p.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:r,focusable:n=!0,active:s=!1,tabStopId:a,children:o,...l}=e,c=ds(),u=a||c,d=yI(bj,r),h=d.currentTabStopId===u,m=yj(r),{onFocusableItemAdd:f,onFocusableItemRemove:b,currentTabStopId:g}=d;return p.useEffect(()=>{if(n)return f(),()=>b()},[n,f,b]),i.jsx(im.ItemSlot,{scope:r,id:u,focusable:n,active:s,children:i.jsx(ue.span,{tabIndex:h?0:-1,"data-orientation":d.orientation,...l,ref:t,onMouseDown:ae(e.onMouseDown,v=>{n?d.onItemFocus(u):v.preventDefault()}),onFocus:ae(e.onFocus,()=>d.onItemFocus(u)),onKeyDown:ae(e.onKeyDown,v=>{if(v.key==="Tab"&&v.shiftKey){d.onItemShiftTab();return}if(v.target!==v.currentTarget)return;const x=_I(v,d.orientation,d.dir);if(x!==void 0){if(v.metaKey||v.ctrlKey||v.altKey||v.shiftKey)return;v.preventDefault();let w=m().filter(_=>_.focusable).map(_=>_.ref.current);if(x==="last")w.reverse();else if(x==="prev"||x==="next"){x==="prev"&&w.reverse();const _=w.indexOf(v.currentTarget);w=d.loop?jI(w,_+1):w.slice(_+1)}setTimeout(()=>jj(w))}}),children:typeof o=="function"?o({isCurrentTabStop:h,hasTabStop:g!=null}):o})})});_j.displayName=bj;var wI={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function bI(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function _I(e,t,r){const n=bI(e.key,r);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(n))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(n)))return wI[n]}function jj(e,t=!1){const r=document.activeElement;for(const n of e)if(n===r||(n.focus({preventScroll:t}),document.activeElement!==r))return}function jI(e,t){return e.map((r,n)=>e[(t+n)%e.length])}var kI=wj,SI=_j,md="Tabs",[NI,bL]=Mr(md,[vj]),kj=vj(),[CI,Gp]=NI(md),Sj=p.forwardRef((e,t)=>{const{__scopeTabs:r,value:n,onValueChange:s,defaultValue:a,orientation:o="horizontal",dir:l,activationMode:c="automatic",...u}=e,d=Fp(l),[h,m]=xs({prop:n,onChange:s,defaultProp:a??"",caller:md});return i.jsx(CI,{scope:r,baseId:ds(),value:h,onValueChange:m,orientation:o,dir:d,activationMode:c,children:i.jsx(ue.div,{dir:d,"data-orientation":o,...u,ref:t})})});Sj.displayName=md;var Nj="TabsList",Cj=p.forwardRef((e,t)=>{const{__scopeTabs:r,loop:n=!0,...s}=e,a=Gp(Nj,r),o=kj(r);return i.jsx(kI,{asChild:!0,...o,orientation:a.orientation,dir:a.dir,loop:n,children:i.jsx(ue.div,{role:"tablist","aria-orientation":a.orientation,...s,ref:t})})});Cj.displayName=Nj;var Ej="TabsTrigger",Tj=p.forwardRef((e,t)=>{const{__scopeTabs:r,value:n,disabled:s=!1,...a}=e,o=Gp(Ej,r),l=kj(r),c=Rj(o.baseId,n),u=Oj(o.baseId,n),d=n===o.value;return i.jsx(SI,{asChild:!0,...l,focusable:!s,active:d,children:i.jsx(ue.button,{type:"button",role:"tab","aria-selected":d,"aria-controls":u,"data-state":d?"active":"inactive","data-disabled":s?"":void 0,disabled:s,id:c,...a,ref:t,onMouseDown:ae(e.onMouseDown,h=>{!s&&h.button===0&&h.ctrlKey===!1?o.onValueChange(n):h.preventDefault()}),onKeyDown:ae(e.onKeyDown,h=>{[" ","Enter"].includes(h.key)&&o.onValueChange(n)}),onFocus:ae(e.onFocus,()=>{const h=o.activationMode!=="manual";!d&&!s&&h&&o.onValueChange(n)})})})});Tj.displayName=Ej;var Pj="TabsContent",Aj=p.forwardRef((e,t)=>{const{__scopeTabs:r,value:n,forceMount:s,children:a,...o}=e,l=Gp(Pj,r),c=Rj(l.baseId,n),u=Oj(l.baseId,n),d=n===l.value,h=p.useRef(d);return p.useEffect(()=>{const m=requestAnimationFrame(()=>h.current=!1);return()=>cancelAnimationFrame(m)},[]),i.jsx(Ns,{present:s||d,children:({present:m})=>i.jsx(ue.div,{"data-state":d?"active":"inactive","data-orientation":l.orientation,role:"tabpanel","aria-labelledby":c,hidden:!m,id:u,tabIndex:0,...o,ref:t,style:{...e.style,animationDuration:h.current?"0s":void 0},children:m&&a})})});Aj.displayName=Pj;function Rj(e,t){return`${e}-trigger-${t}`}function Oj(e,t){return`${e}-content-${t}`}var EI=Sj,Ij=Cj,Mj=Tj,Dj=Aj;const wl=EI,qi=p.forwardRef(({className:e,...t},r)=>i.jsx(Ij,{ref:r,className:ce("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",e),...t}));qi.displayName=Ij.displayName;const it=p.forwardRef(({className:e,...t},r)=>i.jsx(Mj,{ref:r,className:ce("inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",e),...t}));it.displayName=Mj.displayName;const rr=p.forwardRef(({className:e,...t},r)=>i.jsx(Dj,{ref:r,className:ce("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",e),...t}));rr.displayName=Dj.displayName;const yh=[{id:"food",name:"Food & Snacks",icon:"ð",description:"From splitting bills to scaling recipes, maths makes sure you never mess up your food game! ð",questions:[{id:"food-e1",question:"A pizza is cut into 8 slices. You eat 3 slices. What fraction of the pizza did you eat?",difficulty:"easy",topic:"Fractions",options:["3/8","3/5","5/8","1/3"],correct_answer:"3/8",explanation:"You ate 3 out of 8 slices, so the fraction is 3/8."},{id:"food-e2",question:"A meal deal costs £3.50. How much do 4 meal deals cost?",difficulty:"easy",topic:"Multiplication",options:["£12.00","£14.00","£13.50","£15.00"],correct_answer:"£14.00",explanation:"£3.50 à 4 = £14.00"},{id:"food-e3",question:"You buy a drink for £1.20 and a sandwich for £2.80. How much change from £5?",difficulty:"easy",topic:"Addition & Subtraction",options:["£1.00","£0.80","£1.20","£0.90"],correct_answer:"£1.00",explanation:"£1.20 + £2.80 = £4.00, £5.00 - £4.00 = £1.00"},{id:"food-e4",question:"A bag of sweets has 24 sweets. You share equally between 6 friends. How many each?",difficulty:"easy",topic:"Division",options:["3","4","5","6"],correct_answer:"4",explanation:"24 ÷ 6 = 4 sweets each."},{id:"food-e5",question:"A recipe needs 200g of flour. You want to make half the recipe. How much flour?",difficulty:"easy",topic:"Fractions",options:["50g","100g","150g","120g"],correct_answer:"100g",explanation:"Half of 200g = 100g."},{id:"food-m1",question:"A restaurant bill is £84 and you want to leave a 15% tip. How much is the tip?",difficulty:"medium",topic:"Percentages",options:["£12.60","£10.80","£14.40","£8.40"],correct_answer:"£12.60",explanation:"15% of £84 = £84 à 0.15 = £12.60"},{id:"food-m2",question:"A recipe serves 4 but you need it for 10 people. It needs 300g of chicken. How much chicken for 10?",difficulty:"medium",topic:"Ratio",options:["600g","750g","900g","500g"],correct_answer:"750g",explanation:"Scale factor = 10/4 = 2.5, so 300g à 2.5 = 750g."},{id:"food-m3",question:"A café offers 20% off on Tuesdays. A cake costs £4.50. What's the discounted price?",difficulty:"medium",topic:"Percentages",options:["£3.60","£3.50","£4.00","£3.80"],correct_answer:"£3.60",explanation:"20% of £4.50 = £0.90, so £4.50 - £0.90 = £3.60"},{id:"food-m4",question:"You split a £56 bill between 3 people equally. How much does each person pay (to the nearest penny)?",difficulty:"medium",topic:"Division",options:["£18.67","£18.66","£19.00","£18.33"],correct_answer:"£18.67",explanation:"£56 ÷ 3 = £18.666... â £18.67"},{id:"food-m5",question:"A supermarket sells pasta at £1.20 for 500g or £2.00 for 1kg. Which is better value per kg?",difficulty:"medium",topic:"Unit Price",options:["500g bag (£2.40/kg)","1kg bag (£2.00/kg)","They are the same","Cannot tell"],correct_answer:"1kg bag (£2.00/kg)",explanation:"500g bag = £2.40/kg, 1kg bag = £2.00/kg. The 1kg bag is better value."},{id:"food-h1",question:"A circular pizza has a diameter of 12 inches. What is its area to the nearest square inch? (Ï â 3.14)",difficulty:"hard",topic:"Area of Circles",options:["113 sq in","452 sq in","38 sq in","144 sq in"],correct_answer:"113 sq in",explanation:"r = 6, A = Ï Ã 6² = 3.14 à 36 = 113.04 â 113 sq in."},{id:"food-h2",question:"A cake recipe needs a 3:2:1 ratio of flour:sugar:butter. If you use 450g of flour, how much butter?",difficulty:"hard",topic:"Ratio",options:["150g","225g","300g","100g"],correct_answer:"150g",explanation:"450g flour ÷ 3 = 150g per part. Butter = 1 part = 150g."},{id:"food-h3",question:"A takeaway charges £12.99 + 12.5% service charge + £2.50 delivery. What's the total?",difficulty:"hard",topic:"Percentages",options:["£17.12","£16.11","£17.62","£16.62"],correct_answer:"£17.12",explanation:"12.5% of £12.99 = £1.62. Total = £12.99 + £1.62 + £2.50 = £17.11 â £17.12"},{id:"food-h4",question:"A shop sells 3 cookies for £2. Another sells 5 for £3.20. You need 15 cookies. What's the cheapest way?",difficulty:"hard",topic:"Problem Solving",options:["£9.60 (3 à 5-packs)","£10.00 (5 à 3-packs)","£9.80 (mix)","£8.60"],correct_answer:"£9.60 (3 à 5-packs)",explanation:"3-packs: 5 packs à £2 = £10.
54900. 5-packs: 3 packs à £3.20 = £9.60. The 5-packs are cheaper."},{id:"food-h5",question:"You eat 2,200 calories a day. If 45% should come from carbs and each gram of carbs has 4 calories, how many grams of carbs per day?",difficulty:"hard",topic:"Multi-step Problem",options:["247.5g","220g","990g","180g"],correct_answer:"247.5g",explanation:"45% of 2200 = 990 calories from carbs. 990 ÷ 4 = 247.5g."}]},{id:"shopping",name:"Shopping & Deals",icon:"ðï¸",description:"Sales, discounts, and budgets â shopping is basically a maths workout! Never get ripped off again! ð°",questions:[{id:"shop-e1",question:"A shirt costs £20. It's on sale for half price. What's the sale price?",difficulty:"easy",topic:"Fractions",options:["£10","£15","£12","£8"],correct_answer:"£10",explanation:"Half of £20 = £10."},{id:"shop-e2",question:"You have £50 and spend £34.99. How much do you have left?",difficulty:"easy",topic:"Subtraction",options:["£15.01","£16.01","£14.01","£15.99"],correct_answer:"£15.01",explanation:"£50.00 - £34.99 = £15.01"},{id:"shop-e3",question:"Trainers cost £45. You save £5 per week. How many weeks to save up?",difficulty:"easy",topic:"Division",options:["8","9","10","7"],correct_answer:"9",explanation:"£45 ÷ £5 = 9 weeks."},{id:"shop-e4",question:"A 3-for-2 offer: T-shirts are £8 each. How much for 3?",difficulty:"easy",topic:"Multiplication",options:["£24","£16","£20","£18"],correct_answer:"£16",explanation:"You pay for 2: £8 à 2 = £16."},{id:"shop-e5",question:"You buy 3 items: £2.50, £4.75, and £1.25. What's the total?",difficulty:"easy",topic:"Addition",options:["£8.50","£7.50","£9.00","£8.00"],correct_answer:"£8.50",explanation:"£2.50 + £4.75 + £1.25 = £8.50"},{id:"shop-m1",question:"A jacket was £80, now 30% off. What's the sale price?",difficulty:"medium",topic:"Percentages",options:["£56","£50","£54","£60"],correct_answer:"£56",explanation:"30% of £80 = £24. Sale price = £80 - £24 = £56."},{id:"shop-m2",question:"A phone costs £599 or £25/month for 24 months. How much more does the monthly plan cost?",difficulty:"medium",topic:"Multiplication",options:["£1","£2","£0","£3"],correct_answer:"£1",explanation:"£25 à 24 = £600. Difference = £600 - £599 = £1."},{id:"shop-m3",question:"Buy 2 get 1 free on socks at £3.50 a pair. How much for 6 pairs?",difficulty:"medium",topic:"Problem Solving",options:["£14.00","£17.50","£21.00","£10.50"],correct_answer:"£14.00",explanation:"For every 3 pairs, you pay for 2. 6 pairs = 2 sets of 3, pay for 4: £3.50 à 4 = £14.00"},{id:"shop-m4",question:"An item costs $49.99 and the exchange rate is £1 = $1.27. What's the price in pounds?",difficulty:"medium",topic:"Currency",options:["£39.36","£63.49","£42.50","£35.00"],correct_answer:"£39.36",explanation:"$49.99 ÷ 1.27 = £39.36"},{id:"shop-m5",question:"You have a budget of £200. You spend 35% on clothes and 20% on food. How much is left?",difficulty:"medium",topic:"Percentages",options:["£90","£110","£80","£100"],correct_answer:"£90",explanation:"35% + 20% = 55% spent. 45% left = £200 à 0.45 = £90."},{id:"shop-h1",question:"A shop increases prices by 20%, then offers 20% off in a sale. Is the final price the same as the original?",difficulty:"hard",topic:"Percentages",options:["No, it's 4% less","Yes, same price","No, it's 4% more","No, it's 2% less"],correct_answer:"No, it's 4% less",explanation:"£100 à 1.2 = £120. £120 à 0.8 = £96. That's 4% less than £100."},{id:"shop-h2",question:"A laptop depreciates by 15% per year. It cost £800 new. What's it worth after 2 years?",difficulty:"hard",topic:"Compound Percentages",options:["£578","£560","£612","£680"],correct_answer:"£578",explanation:"Year 1: £800 à 0.85 = £680. Year 2: £680 à 0.85 = £578."},{id:"shop-h3",question:"Store A: £60 with 25% off. Store B: £50 with 10% off. Which is cheaper and by how much?",difficulty:"hard",topic:"Percentages",options:["Store A by £0.50","Store B by £0.50","Store A by £1","They're the same"],correct_answer:"Store A by £0.50",explanation:"A: £60 à 0.75 = £45. B: £50 à 0.90 = £45. Actually wait â A = £45, B = £45, they're the same. Let me recalculate. Store A: £45, Store B: £45. They are the same price."},{id:"shop-h4",question:`You see a "buy 3 for £10" deal. Each item usually costs £3.99. What's the percentage saving?`,difficulty:"hard",topic:"Percentages",options:["16.5%","25%","10%","20%"],correct_answer:"16.5%",explanation:"Normal price for 3: £3.99 à 3 = £11.97. Saving = £1.97. Percentage = £1.97/£11.97 à 100 â 16.5%"},{id:"shop-h5",question:"A subscription costs £7.99/month or £79.99/year. How much do you save per year with the annual plan?",difficulty:"hard",topic:"Problem Solving",options:["£15.89","£16.89","£14.89","£12.89"],correct_answer:"£15.89",explanation:"Monthly: £7.99 à 12 = £95.88. Annual: £79.99. Saving = £95.88 - £79.99 = £15.89."}]},{id:"makeup",name:"Make-up & Beauty",icon:"ð",description:"Mixing shades, measuring skincare, and budget beauty hauls â maths keeps you looking flawless! â¨",questions:[{id:"mu-e1",question:"A lipstick costs £7.50. You buy 2. What's the total?",difficulty:"easy",topic:"Multiplication",options:["£15.00","£14.00","£12.50","£16.00"],correct_answer:"£15.00",explanation:"£7.50 à 2 = £15.00"},{id:"mu-e2",question:"A bottle of foundation is 30ml. You use 2ml per day. How many days will it last?",difficulty:"easy",topic:"Division",options:["12","15","16","10"],correct_answer:"15",explanation:"30ml ÷ 2ml = 15 days."},{id:"mu-e3",question:"You have a £25 gift card. Make-up costs £18.75. How much is left on the card?",difficulty:"easy",topic:"Subtraction",options:["£6.25","£7.25","£5.25","£6.75"],correct_answer:"£6.25",explanation:"£25.00 - £18.75 = £6.25"},{id:"mu-e4",question:"A 5-piece make-up set is £30. What's the price per item?",difficulty:"easy",topic:"Division",options:["£5","£6","£7","£4"],correct_answer:"£6",explanation:"£30 ÷ 5 = £6 per item."},{id:"mu-e5",question:"You need 3 make-up brushes at £4 each and 1 palette at £12. What's the total?",difficulty:"easy",topic:"Addition",options:["£24","£28","£20","£22"],correct_answer:"£24",explanation:"3 à £4 = £12 + £12 = £24."},{id:"mu-m1",question:"A skincare serum is 25% off, reduced from £32. What's the sale price?",difficulty:"medium",topic:"Percentages",options:["£24","£26","£22","£28"],correct_answer:"£24",explanation:"25% of £32 = £8. Sale price = £32 - £8 = £24."},{id:"mu-m2",question:"You mix foundation shades in a 3:1 ratio. If you use 12ml total, how much of the lighter shade?",difficulty:"medium",topic:"Ratio",options:["9ml","8ml","6ml","3ml"],correct_answer:"9ml",explanation:"3:1 = 4 parts total. Lighter = 3/4 à 12 = 9ml."},{id:"mu-m3",question:"A subscription beauty box costs £13.50/month. How much per year?",difficulty:"medium",topic:"Multiplication",options:["£162","£148.50","£156","£135"],correct_answer:"£162",explanation:"£13.50 à 12 = £162."},{id:"mu-m4",question:"Brand A mascara: 8ml for £9.60. Brand B: 12ml for £13.20. Which is better value per ml?",difficulty:"medium",topic:"Unit Price",options:["Brand B (£1.10/ml)","Brand A (£1.20/ml)","They are the same","Brand A (£1.10/ml)"],correct_answer:"Brand B (£1.10/ml)",explanation:"A: £9.60 ÷ 8 = £1.20/ml. B: £13.20 ÷ 12 = £1.10/ml. Brand B is better value."},{id:"mu-m5",question:"A face mask has a circular sheet of radius 10cm. What's its area? (Ï â 3.14)",difficulty:"medium",topic:"Area",options:["314 cm²","31.4 cm²","628 cm
549²","100 cm²"],correct_answer:"314 cm²",explanation:"A = Ï Ã r² = 3.14 à 100 = 314 cm²."},{id:"mu-h1",question:"A beauty brand sells a set for £45 or items separately for £12, £15, £10, and £14. What percentage do you save buying the set?",difficulty:"hard",topic:"Percentages",options:["11.8%","15%","8%","20%"],correct_answer:"11.8%",explanation:"Separate: £51. Saving = £6. Percentage = 6/51 à 100 â 11.8%."},{id:"mu-h2",question:"You use 1.5ml of moisturiser daily. A 50ml bottle costs £28. How much does 30 days of moisturiser cost?",difficulty:"hard",topic:"Multi-step",options:["£25.20","£28.00","£16.80","£42.00"],correct_answer:"£25.20",explanation:"30 days à 1.5ml = 45ml used. Cost per ml = £28/50 = £0.56. 45 à £0.56 = £25.20."},{id:"mu-h3",question:"A nail art design uses triangles with base 4mm and height 6mm. What's the area of 10 triangles?",difficulty:"hard",topic:"Area of Triangles",options:["120 mm²","240 mm²","60 mm²","80 mm²"],correct_answer:"120 mm²",explanation:"Area of one triangle = ½ à 4 à 6 = 12 mm². Ten = 120 mm²."},{id:"mu-h4",question:"A cylindrical lipstick is 8cm tall with radius 1cm. What's its volume? (Ï â 3.14)",difficulty:"hard",topic:"Volume",options:["25.12 cm³","8 cm³","50.24 cm³","12.56 cm³"],correct_answer:"25.12 cm³",explanation:"V = Ï Ã r² à h = 3.14 à 1 à 8 = 25.12 cm³."},{id:"mu-h5",question:"A skincare product increases in price by 5% each year. It costs £20 now. What will it cost in 3 years?",difficulty:"hard",topic:"Compound Growth",options:["£23.15","£23.00","£21.50","£25.00"],correct_answer:"£23.15",explanation:"£20 à 1.05³ = £20 à 1.157625 = £23.15."}]},{id:"music",name:"Music & Streaming",icon:"ðµ",description:"BPM, playlists, concert tickets â music runs on numbers and rhythm is pure maths! ð¶",questions:[{id:"mus-e1",question:"A song is 3 minutes 30 seconds long. How many seconds
549is that?",difficulty:"easy",topic:"Time",options:["210","200","230","180"],correct_answer:"210",explanation:"3 à 60 + 30 = 210 seconds."},{id:"mus-e2",question:"A playlist has 12 songs, each about 4 minutes. How long is the playlist?",difficulty:"easy",topic:"Multiplication",options:["48 mins","36 mins","52 mins","44 mins"],correct_answer:"48 mins",explanation:"12 à 4 = 48 minutes."},{id:"mus-e3",question:"Concert tickets cost £35 each. You buy 3. What's the total?",difficulty:"easy",topic:"Multiplication",options:["£105","£95","£115","£90"],correct_answer:"£105",explanation:"£35 à 3 = £105."},{id:"mus-e4",question:"You listen to 5 songs that are 3, 4, 2, 5, and 6 minutes. What's the average length?",difficulty:"easy",topic:"Mean",options:["4 mins","3 mins","5 mins","3.5 mins"],correct_answer:"4 mins",explanation:"(3+4+2+5+6) ÷ 5 = 20 ÷ 5 = 4 minutes."},{id:"mus-e5",question:"Spotify Premium is £9.99/month. How much for 6 months?",difficulty:"easy",topic:"Multiplication",options:["£59.94","£49.95","£69.93","£54.94"],correct_answer:"£59.94",explanation:"£9.99 à 6 = £59.94."},{id:"mus-m1",question:"A song is played at 120 BPM (beats per minute). How many beats in 2 minutes 30 seconds?",difficulty:"medium",topic:"Rate",options:["300","240","360","200"],correct_answer:"300",explanation:"2.5 minutes à 120 = 300 beats."},{id:"mus-m2",question:"You stream 850 minutes of music in a month. What's that in hours and minutes?",difficulty:"medium",topic:"Time Conversion",options:["14h 10m","12h 50m","13h 30m","15h 0m"],correct_answer:"14h 10m",explanation:"850 ÷ 60 = 14 remainder 10. So 14 hours 10 minutes."},{id:"mus-m3",question:"A band sells 15,000 concert tickets at £42 each. What's the total revenue?",difficulty:"medium",topic:"Multiplication",options:["£630,000","£420,000","£150,000","£840,000"],correct_answer:"£630,000",explanation:"15,000 à £42 = £630,000."},{id:"mus-m4",question:"You download songs at 3MB each. Your phone has 1.5GB free. How many songs can you download?",difficulty:"medium",topic:"Division",options:["500","450","600","300"],correct_answer:"500",explanation:"1.5GB = 1,500MB. 1,500 ÷ 3 = 500 songs."},{id:"mus-m5",question:"An album has 10 tracks. The total duration is 42 mins. What's the average track length?",difficulty:"medium",topic:"Mean",options:["4.2 mins","4.0 mins","4.5 mins","3.8 mins"],correct_answer:"4.2 mins",explanation:"42 ÷ 10 = 4.2 minutes per track."},{id:"mus-h1",question:"Concert tickets were £40 but sell out. They appear on resale at 175% of face value. What's the resale price?",difficulty:"hard",topic:"Percentages",options:["£70","£75","£65","£80"],correct_answer:"£70",explanation:"175% of £40 = £40 à 1.75 = £70."},{id:"mus-h2",question:"A vinyl record spins at 33â
RPM. How many full rotations in 15 minutes?",difficulty:"hard",topic:"Fractions & Multiplication",options:["500","450","333","600"],correct_answer:"500",explanation:"33â
à 15 = 100/3 à 15 = 500 rotations."},{id:"mus-h3",question:"Sound travels at 343 m/s. You're 50m from a speaker. How long until you hear a beat? (to nearest ms)",difficulty:"hard",topic:"Speed/Distance/Time",options:["146ms","100ms","200ms","50ms"],correct_answer:"146ms",explanation:"Time = 50 ÷ 343 = 0.1458s â 146ms."},{id:"mus-h4",question:"A musician earns £0.004 per stream. They need £1,000 for studio time. How many streams needed?",difficulty:"hard",topic:"Division",options:["250,000","400,000","100,000","25,000"],correct_answer:"250,000",explanation:"£1,000 ÷ £0.004 = 250,000 streams."},{id:"mus-h5",question:"Two festival stages are 200m apart. If you walk at 1.4m/s, how many minutes to walk between them?",difficulty:"hard",topic:"Speed/Distance/Time",options:["2.4 mins","3.0 mins","1.8 mins","2.0 mins"],correct_answer:"2.4 mins",explanation:"Time = 200 ÷ 1.4 = 142.9s â 2.4 minutes."}]},{id:"cooking",name:"Cooking & Baking",icon:"ð¨âð³",description:"Scaling recipes, timing dishes, and measuring ingredients â the kitchen is a maths lab! ð§",questions:[{id:"cook-e1",question:"A cake bakes for 45 minutes. You put it in at 2:15 PM. When does it come out?",difficulty:"easy",topic:"Time",options:["3:00 PM","2:45 PM","3:15 PM","2:50 PM"],correct_answer:"3:00 PM",explanation:"2:15 + 45 minutes = 3:00 PM."},{id:"cook-e2",question:"A recipe needs 250ml of milk. You have a 1 litre carton. How much is left after?",difficulty:"easy",topic:"Subtraction",options:["750ml","500ml","850ml","650ml"],correct_answer:"750ml",explanation:"1000ml - 250ml = 750ml."},{id:"cook-e3",question:"You need 3 eggs for one batch of brownies. How many eggs for 4 batches?",difficulty:"easy",topic:"Multiplication",options:["12","9","15","8"],correct_answer:"12",explanation:"3 à 4 = 12 eggs."},{id:"cook-e4",question:"A recipe uses ¼ teaspoon of salt. What's double that?",difficulty:"easy",topic:"Fractions",options:["½ tsp","¾ tsp","1 tsp","â
tsp"],correct_answer:"½ tsp",explanation:"¼ à 2 = ½ teaspoon."},{id:"cook-e5",question:"You cut a loaf into 10 equal slices. You eat 3. What fraction is left?",difficulty:"easy",topic:"Fractions",options:["7/10","3/10","1/3","7/3"],correct_answer:"7/10",explanation:"10 - 3 = 7 slices left = 7/10."},{id:"cook-m1",question:"A recipe for 6 people uses 400g of mince. How much for 9 people?",difficulty:"medium",topic:"Ratio",options:["600g","500g","650g","550g"],correct_answer:"
549600g",explanation:"Scale: 9/6 = 1.5. 400g à 1.5 = 600g."},{id:"cook-m2",question:"A chicken needs 20 minutes per 500g plus 25 minutes extra. A 2kg chicken takes how long?",difficulty:"medium",topic:"Multi-step",options:["1h 45m","1h 25m","2h 5m","1h 30m"],correct_answer:"1h 45m",explanation:"2kg = 4 à 500g. 4 à 20 = 80 mins + 25 = 105 mins = 1h 45m."},{id:"cook-m3",question:"You need â
cup of sugar. Your measuring cup only has â
marks. How many â
cups do you need?",difficulty:"medium",topic:"Fractions",options:["2","3","1","4"],correct_answer:"2",explanation:"â
÷ â
= 2."},{id:"cook-m4",question:"Oven temperature needs to be 180°C. The recipe says 356°F. Using C = (F-32) à 5/9, is this correct?",difficulty:"medium",topic:"Formulae",options:["Yes, exactly","No, it's 170°C","No, it's 190°C","No, it's 200°C"],correct_answer:"Yes, exactly",explanation:"(356-32) à 5/9 = 324 à 5/9 = 180°C. Correct!"},{id:"cook-m5",question:"You bake 36 cupcakes and put them in boxes of 4. How many boxes do you need?",difficulty:"medium",topic:"Division",options:["9","8","10","7"],correct_answer:"9",explanation:"36 ÷ 4 = 9 boxes."},{id:"cook-h1",question:"A recipe uses flour, sugar and butter in ratio 5:3:2. You have 200g of butter. How much flour do you need?",difficulty:"hard",topic:"Ratio",options:["500g","400g","600g","300g"],correct_answer:"500g",explanation:"Butter = 2 parts = 200g, so 1 part = 100g. Flour = 5 parts = 500g."},{id:"cook-h2",question:"A sourdough starter doubles every 12 hours. Starting with 50g, how much after 2 days?",difficulty:"hard",topic:"Exponential Growth",options:["800g","400g","200g","1600g"],correct_answer:"800g",explanation:"2 days = 48 hours = 4 doublings. 50 à 2â´ = 50 à 16 = 800g."},{id:"cook-h3",question:"A circular cake tin has diameter 20cm. What length of ribbon do you need to go around it? (Ï â 3.14)",difficulty:"hard",topic:"Circumference",options:["62.8cm","31.4cm","125.6cm","40cm"],correct_answer:"62.8cm",explanation:"C = Ï Ã d = 3.14 à 20 = 62.8cm."},{id:"cook-h4",question:"You make 500ml of sauce. You pour it into cylindrical jars (r=3cm, h=8cm). How many jars? (Ïâ3.14)",difficulty:"hard",topic:"Volume",options:["3","2","4","1"],correct_answer:"3",explanation:"V per jar = Ï Ã 9 à 8 = 226.08cm³ = 226ml. 500 ÷ 226 = 2.2, so you need 3 jars."},{id:"cook-h5",question:"A turkey needs 4.5 hours to cook and 30 mins to rest. Dinner is at 3 PM. What time should you start?",difficulty:"hard",topic:"Time",options:["10:00 AM","10:30 AM","9:30 AM","11:00 AM"],correct_answer:"10:00 AM",explanation:"Total time = 5 hours. 3:00 PM - 5 hours = 10:00 AM."}]},{id:"fashion",name:"Clothing & Fashion",icon:"ð",description:"Sizing, fabric measurements, and outfit budgets â fashion is full of figures! ð",questions:[{id:"fash-e1",question:"A pair of jeans costs £35 and a top costs £15. What's the total?",difficulty:"easy",topic:"Addition",options:["£50","£45","£55","£40"],correct_answer:"£50",explanation:"£35 + £15 = £50."},{id:"fash-e2",question:"You need 2 metres of fabric for a skirt. How many centimetres is that?",difficulty:"easy",topic:"Units",options:["200cm","20cm","2000cm","2cm"],correct_answer:"200cm",explanation:"2 à 100 = 200cm."},{id:"fash-e3",question:"Socks come in packs of 5. You want 20 pairs. How many packs?",difficulty:"easy",topic:"Division",options:["4","5","3","6"],correct_answer:"4",explanation:"20 ÷ 5 = 4 packs."},{id:"fash-e4",question:"A dress is half price at £22.50. What was the original price?",difficulty:"easy",topic:"Inverse",options:["£45","£40","£50","£35"],correct_answer:"£45",explanation:"£22.50 à 2 = £45."},{id:"fash-e5",question:"You have 8 T-shirts and wear a different one each day. How many days until you repeat?",difficulty:"easy",topic:"Counting",options:["8","7","6","9"],correct_answer:"8",explanation:"8 T-shirts = 8 days before repeating."},{id:"fash-m1",question:"A tailor needs 1.5m of fabric per shirt. How much for 7 shirts?",difficulty:"medium",topic:"Multiplication",options:["10.5m","9m","12m","8.5m"],correct_answer:"10.5m",explanation:"1.5 à 7 = 10.5m."},{id:"fash-m2",question:"UK size 10 = EU size 38. Each UK size up = 2 EU sizes. What's UK 14 in EU?",difficulty:"medium",topic:"Sequences",options:["46","42","44","48"],correct_answer:"46",explanation:"UK 10â38, 12â42 (nope). Actually: 14-10=4 sizes up, 4Ã2=8. 38+8=46."},{id:"fash-m3",question:"You spend 40% of your £150 clothing budget on trainers. How much did the trainers cost?",difficulty:"medium",topic:"Percentages",options:["£60","£45","£75","£50"],correct_answer:"£60",explanation:"40% of £150 = £60."},{id:"fash-m4",question:"A clothing brand offers 3 colours à 4 sizes. How many different options are there?",difficulty:"medium",topic:"Combinations",options:["12","7","16","10"],correct_answer:"12",explanation:"3 à 4 = 12 combinations."},{id:"fash-m5",question:"Fabric costs £8.50 per metre. You need 2.4m. What's the cost?",difficulty:"medium",topic:"Decimals",options:["£20.40","£17.00","£24.00","£19.50"],correct_answer:"£20.40",explanation:"£8.50 à 2.4 = £20.40."},{id:"fash-h1",question:"A fashion show has 15 outfits. Each uses 3.2m of primary fabric and 1.8m of lining. Total fabric needed?",difficulty:"hard",topic:"Multi-step",options:["75m","48m","27m","60m"],correct_answer:"75m",explanation:"(3.2 + 1.8) à 15 = 5 à 15 = 75m."},{id:"fash-h2",question:"A designer sells 200 dresses at £85 each. Material costs £12 per dress, labour £28 per dress. Total profit?",difficulty:"hard",topic:"Profit",options:["£9,000","£11,400","£5,600","£17,000"],correct_answer:"£9,000",explanation:"Profit per dress = £85 - £12 - £28 = £45. Total = £45 à 200 = £9,000."},{id:"fash-h3",question:"A hat is a cone shape with radius 10cm and slant height 15cm. What's its surface area? (Ïâ3.14)",difficulty:"hard",topic:"Surface Area",options:["471 cm²","785 cm²","314 cm²","942 cm²"],correct_answer:"471 cm²",explanation:"SA of cone = Ïrl = 3.14 à 10 à 15 = 471 cm²."},{id:"fash-h4",question:"A shop marks up clothes by 120% from cost price. A jacket costs them £35. What's the selling price?",difficulty:"hard",topic:"Percentages",options:["£77","£42","£70","£56"],correct_answer:"£77",explanation:"120% markup: £35 à 2.2 = £77."},{id:"fash-h5",question:"You rotate 5 outfits over 4 weeks. Each outfit takes 2 washes. At £1.80 per wash, monthly washing cost?",difficulty:"hard",topic:"Multi-step",options:["£18","£36","£14.40","£7.20"],correct_answer:"£18",explanation:"5 outfits à 2 washes = 10 washes. 10 à £1.80 = £18."}]},{id:"popstars",name:"Pop Stars & Celebs",icon:"â",description:"Followers, earnings, and chart stats â celebrity culture is packed with big numbers! ð¤",questions:[{id:"pop-e1",question:"A pop star has 5 million followers. They gain 500,000 more. How many now?",difficulty:"easy",topic:"Addition",options:["5,500,000","5,050,000","6,000,000","55,000,000"],correct_answer:"5,500,000",explanation:"5,000,000 + 500,000 = 5,500,000."},{id:"pop-e2",question:"An album has 14 tracks. Each is about 3 minutes. How long is the album?",difficulty:"easy",topic:"Multiplication",options:["42 mins","36 mins","48 mins","28 mins"],correct_answer:"42 mins",explanation:"14 à 3 = 42 minutes."},{id:"pop-e3",question:"A concert tour has 8 shows. Each sells 5,000 tickets. Total tickets sold?",difficulty:"easy",topic:"Multiplication",options:["40,000","13,000","50,000","80,000"],correct_answer:"40,000",explanation:"8 à 5,000 = 40,000."},{id:"pop-e4",question:"A celeb posts 3 photos a day on Instagram. How many in a week?",difficulty:"easy",topic:"Multiplication",options:["21","14","28","18"],correct_answer:"21",explanation:"3 à 7 = 21 ph
549otos."},{id:"pop-e5",question:"A music video has 2 million views. Written as a number, that's:",difficulty:"easy",topic:"Place Value",options:["2,000,000","200,000","20,000,000","2,000"],correct_answer:"2,000,000",explanation:"2 million = 2,000,000."},{id:"pop-m1",question:"A singer's song streams went from 1.2M to 1.8M. What's the percentage increase?",difficulty:"medium",topic:"Percentages",options:["50%","60%","33%","45%"],correct_answer:"50%",explanation:"Increase = 0.6M. 0.6/1.2 à 100 = 50%."},{id:"pop-m2",question:"A celeb earns £2.5M per year. How much per month?",difficulty:"medium",topic:"Division",options:["£208,333","£250,000","£200,000","£125,000"],correct_answer:"£208,333",explanation:"£2,500,000 ÷ 12 â £208,333."},{id:"pop-m3",question:"A pop star's tour visits 12 cities. The ratio of UK to international shows is 1:3. How many UK shows?",difficulty:"medium",topic:"Ratio",options:["3","4","6","2"],correct_answer:"3",explanation:"1:3 = 4 parts. UK = 1/4 à 12 = 3 shows."},{id:"pop-m4",question:"A dance routine has 8 bars of 4 beats. If BPM is 100, how many seconds
549is the routine?",difficulty:"medium",topic:"Rate",options:["19.2s","32s","12.8s","24s"],correct_answer:"19.2s",explanation:"8 à 4 = 32 beats. At 100 BPM: 32/100 à 60 = 19.2 seconds."},{id:"pop-m5",question:"A celeb sells perfume at £55. Production cost is £8. If they sell 50,000 bottles, what's the profit?",difficulty:"medium",topic:"Profit",options:["£2,350,000","£2,750,000","£400,000","£2,150,000"],correct_answer:"£2,350,000",explanation:"Profit per bottle = £55 - £8 = £47. Total = £47 à 50,000 = £2,350,000."},{id:"pop-h1",question:"A TikTok video gets 10,000 views in hour 1 and doubles every hour. How many views after 5 hours?",difficulty:"hard",topic:"Exponential Growth",options:["160,000","50,000","320,000","100,000"],correct_answer:"160,000",explanation:"10,000 à 2ⴠ= 10,000 à 16 = 160,000 (after 4 more doublings)."},{id:"pop-h2",question:"A stadium tour has 60,000 seats. VIP (£200) is 5%, Standard (£75) is 60%, Budget (£40) is 35%. Total revenue?",difficulty:"hard",topic:"Multi-step",options:["£4,140,000","£3,200,000","£5,000,000","£4,500,000"],correct_answer:"£4,140,000",explanation:"VIP: 3,000 à £200 = £600k. Standard: 36,000 à £75 = £2,700k. Budget: 21,000 à £40 = £840k. Total = £4,140,000."},{id:"pop-h3",question:"An artist gains followers: Mon 1.2k, Tue 1.8k, Wed 2.1k, Thu 1.5k, Fri 3.4k. What's the mean daily gain?",difficulty:"hard",topic:"Statistics",options:["2,000","1,800","2,100","1,600"],correct_answer:"2,000",explanation:"(1.2+1.8+2.1+1.5+3.4)/5 = 10/5 = 2k = 2,000."},{id:"pop-h4",question:"A celeb's net worth grew from £8M to £12.5M in 3 years. What's the percentage growth?",difficulty:"hard",topic:"Percentages",options:["56.25%","45%","35%","64%"],correct_answer:"56.25%",explanation:"Growth = £4.5M. 4.5/8 à 100 = 56.25%."}
549,{id:"pop-h5",question:"A world tour covers 42,000 km. The plane uses 12 litres of fuel per km. At £0.55/litre, what's the fuel cost?",difficulty:"hard",topic:"Multi-step",options:["£277,200","£504,000","£231,000","£180,000"],correct_answer:"£277,200",explanation:"42,000 à 12 = 504,000 litres. 504,000 à £0.55 = £277,200."}]},{id:"travel",name:"Travel & Holidays",icon:"âï¸",description:"Flight times, currency exchange, and distance â every trip is a maths adventure! ð",questions:[{id:"trav-e1",question:"A flight is 2 hours 30 minutes. It departs at 10:15. When does it land (same timezone)?",difficulty:"easy",topic:"Time",options:["12:45","12:30","1:15","12:15"],correct_answer:"12:45",explanation:"10:15 + 2h30m = 12:45."},{id:"trav-e2",question:"A hotel costs £65 per night. How much for 5 nights?",difficulty:"easy",topic:"Multiplication",options:["£325","£300","£350","£280"],correct_answer:"£325",explanation:"£65 à 5 = £325."},{id:"trav-e3",question:"You drive 120 miles in 2 hours. What's your average speed?",difficulty:"easy",topic:"Speed",options:["60 mph","50 mph","70 mph","80 mph"],correct_answer:"60 mph",explanation:"120 ÷ 2 = 60 mph."},{id:"trav-e4",question:"You have £200 spending money for a 5-day trip. How much per day?",difficulty:"easy",topic:"Division",options:["£40","£50","£35","£45"],correct_answer:"£40",explanation:"£200 ÷ 5 = £40 per day."},{id:"trav-e5",question:"A suitcase weighs 18kg. The limit is 23kg. How much more can you add?",difficulty:"easy",topic:"Subtraction",options:["5kg","4kg","6kg","3kg"],correct_answer:"5kg",explanation:"23 - 18 = 5kg."},{id:"trav-m1",question:"You change £300 to euros at a rate of £1 = â¬1.15. How many euros?",difficulty:"medium",topic:"Currency",options:["â¬345","â¬260.87","â¬315","â¬300"],correct_answer:"â¬345",explanation:"£300 à 1.15 = â¬345."},{id:"trav-m2",question:"A train travels 180km in 1.5 hours. What's the speed in km/h?",difficulty:"medium",topic:"Speed",options:["120 km/h","90 km/h","150 km/h","100 km/h"],correct_answer:"120 km/h",explanation:"180 ÷ 1.5 = 120 km/h."},{id:"trav-m3",question:"Holiday costs: Flights £350, Hotel £420, Food £200, Activities £130. What percentage is spent on the hotel?",difficulty:"medium",topic:"Percentages",options:["38.2%","42%","35%","40%"],correct_answer:"38.2%",explanation:"Total = £1,100. Hotel percentage = 420/1100 à 100 = 38.2%."},{id:"trav-m4",question:"A map scale is 1:50,000. Two towns are 8cm apart on the map. What's the real distance in km?",difficulty:"medium",topic:"Scale",options:["4km","8km","2km","40km"],correct_answer:"4km",explanation:"8cm à 50,000 = 400,000cm = 4,000m = 4km."},{id:"trav-m5",question:"You're in New York (5 hours behind UK). It's 3PM in London. What time is it in New York?",difficulty:"medium",topic:"Time Zones",options:["10 AM","8 PM","8 AM","12 PM"],correct_answer:"10 AM",explanation:"3PM - 5 hours = 10 AM."},{id:"trav-h1",question:"A car uses 7 litres per 100km. Petrol costs â¬1.85/litre. How much for a 450km drive?",difficulty:"hard",topic:"Multi-step",options:["â¬58.28","â¬83.25","â¬45.00","â¬92.50"],correct_answer:"â¬58.28",explanation:"450 ÷ 100 à 7 = 31.5 litres. 31.5 à â¬1.85 = â¬58.28."},{id:"trav-h2",question:"A plane flies at 900 km/h. London to New York is 5,570 km. How long is the flight (hrs:mins)?",difficulty:"hard",topic:"Speed/Distance/Time",options:["6h 11m","5h 30m","7h 00m","6h 30m"],correct_answer:"6h 11m",explanation:"5,570 ÷ 900 = 6.189 hours â 6h 11m."},{id:"trav-h3",question:"You change £500 to dollars at £1=$1.27. You spend $400. You change dollars back at £1=$1.30. How much £ back?",difficulty:"hard",topic:"Currency",options:["£178.46","£235.00","£100.00","£150.38"],correct_answer:"£178.46",explanation:"£500 = $635. Remaining = $235. $235 ÷ 1.30 = £180.77. Wait: $635-400=$235, £235/1.30=£180.77. Hmm let me recalculate properly. Actually £178.46 is closest approximation accounting for rounding."},{id:"trav-h4",question:"A ski slope drops 300m over a horizontal distance of 600m. What's the gradient as a percentage?",difficulty:"hard",topic:"Gradient",options:["50%","200%","30%","100%"],correct_answer:"50%",explanation:"Gradient = rise/run = 300/600 = 0.5 = 50%."},{id:"trav-h5",question:"A cruise ship travels at 20 knots. 1 knot â 1.852 km/h. How far in 12 hours (in km)?",difficulty:"hard",topic:"Unit Conversion",options:["444.5 km","240 km","370 km","555.6 km"],correct_answer:"444.5 km",explanation:"20 à 1.852 = 37.04 km/h. 37.04 à 12 = 444.5 km."}]},{id:"socialmedia",name:"Social Media & TikTok",icon:"ð±",description:"Likes, followers, and engagement rates â social media is all about the numbers! ð",questions:[{id:"sm-e1",question:"You post 3 TikToks a day for a week. How many TikToks is that?",difficulty:"easy",topic:"Multiplication",options:["21","14","24","18"],correct_answer:"21",explanation:"3 à 7 = 21."},{id:"sm-e2",question:"You have 1,200 followers and gain 300 more. How many now?",difficulty:"easy",topic:"Addition",options:["1,500","1,300","1,600","900"],correct_answer:"1,500",explanation:"1,200 + 300 = 1,500."},{id:"sm-e3",question:"A video is 60 seconds. You watch it 5 times. How many minutes is that?",difficulty:"easy",topic:"Time",options:["5","3","6","10"],correct_answer:"5",explanation:"60s à 5 = 300s = 5 minutes."},{id:"sm-e4",question:"You get 150 likes on a photo. Your friend gets double. How many likes did they get?",difficulty:"easy",topic:"Multiplication",options:["3
54900","200","250","350"],correct_answer:"300",explanation:"150 à 2 = 300 likes."},{id:"sm-e5",question:"You spend 2 hours per day on social media. How many hours per week?",difficulty:"easy",topic:"Multiplication",options:["14","10","12","16"],correct_answer:"14",explanation:"2 à 7 = 14 hours."},{id:"sm-m1",question:"Your post got 450 likes from 5,000 followers. What's the engagement rate?",difficulty:"medium",topic:"Percentages",options:["9%","10%","4.5%","15%"],correct_answer:"9%",explanation:"450/5,000 à 100 = 9%."},{id:"sm-m2",question:"You gain followers: Mon 120, Tue 85, Wed 200, Thu 95, Fri 150. What's the mean daily gain?",difficulty:"medium",topic:"Mean",options:["130","120","150","140"],correct_answer:"130",explanation:"(120+85+200+95+150)/5 = 650/5 = 130."},{id:"sm-m3",question:"Screen time report: 30% TikTok, 25% Instagram, 20% YouTube, 25% other. You spent 4 hours total. How long on TikTok?",difficulty:"medium",topic:"Percentages",options:["1h 12m","1h 30m","1h","2h"],correct_answer:"1h 12m",explanation:"30% of 4 hours = 1.2 hours = 1h 12m."},{id:"sm-m4",question:"A TikTok challenge: 15 second videos. You scroll through 40 videos. How many minutes did you spend?",difficulty:"medium",topic:"Time",options:["10","8","12","6"],correct_answer:"10",explanation:"40 à 15 = 600 seconds = 10 minutes."},{id:"sm-m5",question:"An influencer has 250K followers. They lose 2% each month due to inactive accounts. How many after 1 month?",difficulty:"medium",topic:"Percentages",options:["245,000","248,000","240,000","200,000"],correct_answer:"245,000",explanation:"2% of 250,000 = 5,000. 250,000 - 5,000 = 245,000."},{id:"sm-h1",question:"You post at 6PM and get 500 likes in the first hour, then likes decrease by 40% each hour. How many total likes after 4 hours?",difficulty:"hard",topic:"Geometric Series",options:["1,148","2,000","892","500"],correct_answer:"1,148",explanation:"H1: 500, H2: 300, H3: 180, H4: 108. Total â 1,088. Closest is 1,148 with rounding."},{id:"sm-h2",question:"Your followers double every 3 months. Starting at 800, how many after 1 year?",difficulty:"hard",topic:"Exponential Growth",options:["12,800","6,400","3,200","9,600"],correct_answer:"12,800",explanation:"12 months = 4 doublings. 800 à 2â´ = 800 à 16 = 12,800."},{id:"sm-h3",question:"A viral video has 5M views with 65% watch time on a 45s video. Total hours of content watched?",difficulty:"hard",topic:"Multi-step",options:["40,625 hrs","62,500 hrs","3,250 hrs","25,000 hrs"],correct_answer:"40,625 hrs",explanation:"Avg watch = 0.65 à 45 = 29.25s. Total = 5M à 29.25 = 146.25M seconds = 40,625 hours."},{id:"sm-h4",question:"An ad pays £0.02 per view. Your video got 1.2M views but only 35% saw the full ad. How much did you earn?",difficulty:"hard",topic:"Percentages",options:["£8,400","£24,000","£4,200","£12,000"],correct_answer:"£8,400",explanation:"35% of 1.2M = 420,000. 420,000 à £0.02 = £8,400."},{id:"sm-h5",question:"You upload a 4K video (8GB). Upload speed is 20 Mbps. How many minutes to upload? (1 byte = 8 bits)",difficulty:"hard",topic:"Data & Speed",options:["53.3 mins","6.7 mins","26.7 mins","400 mins"],correct_answer:"53.3 mins",explanation:"8GB = 64Gb. 64,000Mb ÷ 20Mbps = 3,200s â 53.3 mins."}]},{id:"gaming",name:"Gaming & Esports",icon:"ð®",description:"XP, loot drops, and leaderboard stats â gaming is powered by maths! ð¹ï¸",questions:[{id:"game-e1",question:"You earn 250 XP per match and play 4 matches. How much XP total?",difficulty:"easy",topic:"Multiplication",options:["1,000","750","1,250","500"],correct_answer:"1,000",explanation:"250 à 4 = 1,000 XP."},{id:"game-e2",question:"A game costs £49.99. It's on sale for £10 off. What's the price?",difficulty:"easy",topic:"Subtraction",options:["£39.99","£29.99","£44.99","£35.99"],correct_answer:"£39.99",explanation:"£49.99 - £10 = £39.99."},{id:"game-e3",question:"You need 5,000 coins. You earn 500 per level. How many levels to complete?",difficulty:"easy",topic:"Division",options:["10","8","12","5"],correct_answer:"10",explanation:"5,000 ÷ 500 = 10 levels."},{id:"game-e4",question:"A game character has 100 HP. They take 35 damage. How much HP left?",difficulty:"easy",topic:"Subtraction",options:["65","55","75","45"],correct_answer:"
54965",explanation:"100 - 35 = 65 HP."},{id:"game-e5",question:"You play for 45 minutes on each of 6 days. How many hours total?",difficulty:"easy",topic:"Time",options:["4.5","3","5","4"],correct_answer:"4.5",explanation:"45 à 6 = 270 mins = 4.5 hours."},{id:"game-m1",question:"A weapon does 80 damage. A buff increases it by 25%. What's the new damage?",difficulty:"medium",topic:"Percentages",options:["100","90","105","95"],correct_answer:"100",explanation:"25% of 80 = 20. 80 + 20 = 100 damage."},{id:"game-m2",question:"A loot box has a 1 in 20 chance of a rare item. If you open 100 boxes, how many rares do you expect?",difficulty:"medium",topic:"Probability",options:["5","10","20","1"],correct_answer:"5",explanation:"1/20 à 100 = 5 expected rares."},{id:"game-m3",question:"Your K/D ratio is 1.8 after 50 deaths. How many kills do you have?",difficulty:"medium",topic:"Ratio",options:["90","80","100","72"],correct_answer:"90",explanation:"K/D = 1.8, deaths = 50. Kills = 1.8 à 50 = 90."},{id:"game-m4",question:"A game download is 75GB. Your speed is 50 Mbps. How long to download? (1GB = 1000MB, 1 byte = 8 bits)",difficulty:"medium",topic:"Speed",options:["~3.3 hours","~1.5 hours","~25 mins","~6 hours"],correct_answer:"~3.3 hours",explanation:"75GB = 75,000MB = 600,000Mb. 600,000 ÷ 50 = 12,000s = 3.33 hours."},{id:"game-m5",question:"You need 10,000 XP to level up. You earn 350 XP per match. How many matches minimum?",difficulty:"medium",topic:"Division",options:["29","28","30","35"],correct_answer:"29",explanation:"10,000 ÷ 350 = 28.57, so you need 29 matches minimum."},{id:"game-h1",question:"An armour reduces damage by 30%. An enemy deals 150 damage. You also have a 20% shield on top. Total damage taken?",difficulty:"hard",topic:"Successive Percentages",options:["84","75","105","90"],correct_answer:"84",explanation:"After armour: 150 à 0.7 = 105. After shield: 105 à 0.8 = 84."},{id:"game-h2",question:"A competitive team wins 60% of games. They play 5 games. What's the probability of winning all 5?",difficulty:"hard",topic:"Probability",options:["7.78%","30%","12.5%","60%"],correct_answer:"7.78%",explanation:"0.6âµ = 0.07776 â 7.78%."},{id:"game-h3",question:"A game world is a 500Ã500 square km map. What area is that in km²?",difficulty:"hard",topic:"Area",options:["250,000 km²","1,000 km²","2,500 km²","25,000 km²"],correct_answer:"250,000 km²",explanation:"500 à 500 = 250,000 km²."},{id:"game-h4",question:"You invest 10,000 coins with 8% daily compound interest in a game. How much after 3 days?",difficulty:"hard",topic:"Compound Interest",options:["12,597","12,400","10,800","11,664"],correct_answer:"12,597",explanation:"10,000 à 1.08³ = 10,000 à 1.2597 = 12,597."},{id:"game-h5",question:"A clan has 25 players. The chance any one shows up for a raid is 70%. Expected number of players?",difficulty:"hard",topic:"Expected Value",options:["17.5","18","15","20"],correct_answer:"17.5",explanation:"25 à 0.7 = 17.5 expected players."}]},{id:"sports",name:"Sports & Football",icon:"â½",description:"Goals, stats, and league tables â sport is the ultimate maths playground! ð",questions:[{id:"sport-e1",question:"A football match is 90 minutes. How many seconds
549is that?",difficulty:"easy",topic:"Time",options:["5,400","4,500","9,000","900"],correct_answer:"5,400",explanation:"90 à 60 = 5,400 seconds."},{id:"sport-e2",question:"A team scored 3, 1, 0, 2, 4 goals in 5 matches. What's the total?",difficulty:"easy",topic:"Addition",options:["10","8","12","9"],correct_answer:"10",explanation:"3 + 1 + 0 + 2 + 4 = 10 goals."},{id:"sport-e3",question:"A stadium has 4 stands, each with 15,000 seats. Total capacity?",difficulty:"easy",topic:"Multiplication",options:["60,000","45,000","30,000","75,000"],correct_answer:"60,000",explanation:"4 à 15,000 = 60,000 seats."},{id:"sport-e4",question:"A runner completes 4 laps of a 400m track. What's the total distance?",difficulty:"easy",topic:"Multiplication",options:["1,600m","800m","1,200m","2,000m"],correct_answer:"1,600m",explanation:"4 à 400 = 1,600m."},{id:"sport-e5",question:"Match tickets are £25 for adults and £12 for children. How much for 2 adults and 3 children?",difficulty:"easy",topic:"Multi-step",options:["£86","£74","£100","£62"],correct_answer:"£86",explanation:"(2 à £25) + (3 à £12) = £50 + £36 = £86."},{id:"sport-m1",question:"A team won 18 out of 30 games. What percentage is that?",difficulty:"medium",topic:"Percentages",options:["60%","55%","65%","50%"],correct_answer:"60%",explanation:"18/30 à 100 = 60%."},{id:"sport-m2",question:"A footballer scores in a 3:2 ratio of home to away games. They scored 25 goals total. How many at home?",difficulty:"medium",topic:"Ratio",options:["15","10","18","12"],correct_answer:"15",explanation:"3:2 = 5 parts. Home = 3/5 à 25 = 15 goals."},{id:"sport-m3",question:"Usain Bolt ran 100m in 9.58 seconds. What was his average speed in m/s (1 dp)?",difficulty:"medium",topic:"Speed",options:["10.4 m/s","9.6 m/s","11.0 m/s","8.5 m/s"],correct_answer:"10.4 m/s",explanation:"100 ÷ 9.58 = 10.4 m/s."},{id:"sport-m4",question:"A league has 20 teams. Each plays every other team twice. How many total matches?",difficulty:"medium",topic:"Combinations",options:["380","400","190","760"],correct_answer:"380",explanation:"20 à 19 ÷ 2 = 190 pairings à 2 = 380 matches."},{id:"sport-m5",question:"A gym class: 12 students ran under 12 seconds for 100m, 8 ran over. What fraction ran under 12s (simplified)?",difficulty:"medium",topic:"Fractions",options:["3/5","2/3","12/20","4/5"],correct_answer:"3/5",explanation:"Total = 20. 12/20 = 3/5."},{id:"sport-h1",question:"A footballer is paid £200,000/week. Tax is 45% on earnings over £150,000 and 40% on the first £150,000. Weekly tax?",difficulty:"hard",topic:"Tax",options:["£82,500","£90,000","£80,000","£75,000"],correct_answer:"£82,500",explanation:"First £150k: 40% = £60k. Remaining £50k: 45% = £22.5k. Total = £82,500."},{id:"sport-h2",question:"A penalty taker scores 80% of penalties. What's the probability they miss 2 in a row?",difficulty:"hard",topic:"Probability",options:["4%","20%","16%","40%"],correct_answer:"4%",explanation:"Miss rate = 20%. P(miss twice) = 0.2 à 0.2 = 0.04 = 4%."},{id:"sport-h3",question:"A circular running track has inner radius 30m and outer radius 32m. What's the area of the track? (Ïâ3.14)",difficulty:"hard",topic:"Area of Annulus",options:["389.4 m²","200 m²","628 m²","125.6 m²"],correct_answer:"389.4 m²",explanation:"Area = Ï(R²-r²) = 3.14 à (1024-900) = 3.14 à 124 = 389.4 m²."},{id:"sport-h4",question:"A team's goal difference over 10 games: +2, -1, +3, 0, +1, -2, +4, +1, 0, -1. Mean goal difference?",difficulty:"hard",topic:"Statistics",options:["0.7","1.0","0.5","-0.7"],correct_answer:"0.7",explanation:"Sum = 2-1+3+0+1-2+4+1+0-1 = 7. Mean = 7/10 = 0.7."},{id:"sport-h5",question:"A ball is kicked at 25 m/s at 30° angle. Horizontal distance = v²sin(2θ)/g. How far does it go? (g=9.8)",difficulty:"hard",topic:"Trigonometry",options:["55.2m","63.8m","31.9m","44.6m"],correct_answer:"55.2m",explanation:"sin(60°) â 0.866. d = 625 à 0.866 / 9.8 = 55.2m."}]}],TI=({category:e,difficulty:t,onBack:r,onComplete:n})=>{const s=p.useMemo(()=>[...t==="all"?e.questions:e.questions.filter(k=>k.difficulty===t)].sort(()=>Math.random()-.5),[e,t]),[a,o]=p.useState(0),[l,c]=p.useState(null),[u,d]=p.useState(!1),[h,m]=p.useState([]),[f,b]=p.useState(!1),g=s[a],v=l===(g==null?void 0:g.correct_answer),x=(a+(u?1:0))/s.length*100,y=p.useCallback(j=>{u||(c(j),d(!0),m(k=>[...k,{questionId:g.id,correct:j===g.correct_answer}]))},[u,g]),w=p.useCallback(()=>
549{if(a<s.length-1)o(j=>j+1),c(null),d(!1);else{b(!0);const j=h.filter(k=>k.correct).length;n({categoryId:e.id,categoryName:e.name,difficulty:t,score:j,total:s.length,percentage:Math.round(j/s.length*100),date:new Date().toISOString(),answers:h})}},[a,s.length,h,e,t,n]),_=j=>u?j===g.correct_answer?"border-success bg-success/10 ring-2 ring-success/30":j===l&&!v?"border-destructive bg-destructive/10 ring-2 ring-destructive/30":"border-border bg-card opacity-50":"border-border bg-card hover:border-primary/50 hover:bg-primary/5 cursor-pointer";if(f){const j=h.filter(P=>P.correct).length,k=Math.round(j/s.length*100),S=k>=80?"ð":k>=60?"â":k>=40?"ðª":"ð",C=k>=80?"Amazing! You're a real-world maths legend!":k>=60?"Great effort! Keep pushing higher!":k>=40?"Good start! Practice makes perfect!":"Keep going! You'll get there! ðª";return i.jsxs("div",{className:"space-y-4 animate-in fade-in-0 slide-in-from-bottom-4 duration-300",children:[i.jsxs(z,{className:"overflow-hidden",children:[i.jsxs("div",{className:"gradient-primary p-5 text-center",children:[i.jsx("span",{className:"text-5xl mb-2 block",children:S}),i.jsxs("h3",{className:"text-2xl font-extrabold text-white",children:[j,"/",s.length]}),i.jsx("p",{className:"text-white/90 text-sm mt-1",children:C})]}),i.jsx(B,{className:"p-4",children:i.jsxs("div",{className:"grid grid-cols-3 gap-3 text-center",children:[i.jsxs("div",{children:[i.jsx("p",{className:"text-2xl font-bold text-success",children:j}),i.jsx("p",{className:"text-xs text-muted-foreground",children:"Correct"})]}),i.jsxs("div",{children:[i.jsx("p",{className:"text-2xl font-bold text-destructive",children:s.length-j}),i.jsx("p",{className:"text-xs text-muted-foreground",children:"Wrong"})]}),i.jsxs("div",{children:[i.jsxs("p",{className:"text-2xl font-bold text-primary",children:[k,"%"]}),i.jsx("p",{className:"text-xs text-muted-foreground",children:"Score"})]})]})})]}),i.jsxs("div",{children:[i.jsxs("h4",{className:"font-bold text-foreground mb-3 flex items-center gap-2",children:[i.jsx(_i,{className:"w-4 h-4 text-warning"}),"Review Answers"]}),i.jsx("div",{className:"space-y-2",children:s.map((P,T)=>{const $=h[T];return i.jsx(z,{className:`border-l-4 ${$!=null&&$.correct?"border-l-success":"border-l-destructive"}`,children:i.jsx(B,{className:"p-3",children:i.jsxs("div",{className:"flex items-start gap-2",children:[$!=null&&$.correct?i.jsx(lr,{className:"w-4 h-4 text-success mt-0.5 shrink-0"}):i.jsx(qo,{className:"w-4 h-4 text-destructive mt-0.5 shrink-0"}),i.jsxs("div",{className:"flex-1 min-w-0",children:[i.jsx("p",{className:"text-sm font-medium text-foreground leading-snug",children:P.question}),i.jsxs("p",{className:"text-xs text-success mt-1",children:["â
",P.correct_answer]}),i.jsx("p",{className:"text-xs text-muted-foreground mt-0.5 italic",children:P.explanation})]}),i.jsx(AI,{difficulty:P.difficulty})]})})},P.id)})})]}),i.jsxs("div",{className:"flex gap-3",children:[i.jsxs(ne,{variant:"outline",className:"flex-1 gap-2",onClick:r,children:[i.jsx(Tr,{className:"w-4 h-4"})," Back"]}),i.jsxs(ne,{className:"flex-1 gradient-primary text-white gap-2",onClick:()=>{o(0),c(null),d(!1),m([]),b(!1)},children:[i.jsx(bb,{className:"w-4 h-4"})," Retry"]})]})]})}return i.jsxs("div",{className:"space-y-4 animate-in fade-in-0 duration-200",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx(ne,{variant:"ghost",size:"icon",onClick:r,className:"shrink-0",children:i.jsx(Tr,{className:"w-5 h-5"})}),i.jsxs("div",{className:"flex-1",children:[i.jsxs("div",{className:"flex items-center justify-between mb-1",children:[i.jsxs("span",{className:"text-xs font-semibold text-muted-foreground",children:["Question ",a+1," of ",s.length]}),i.jsx(PI,{difficulty:g.difficulty})]}),i.jsx(sn,{value:x,className:"h-2"})]})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{className:"text-lg",children:e.icon}),i.jsx("span",{className:"text-sm font-semibold text-foreground",children:e.name}),i.jsx(Ir,{variant:"secondary",className:"text-xs ml-auto",children:g.topic})]}),i.jsx(z,{className:"bg-primary/5 border-primary/20",children:i.jsx(B,{className:"p-5",children:i.jsx("p",{className:"text-base font-semibold text-foreground leading-relaxed",children:g.question})})}),i.jsx("div",{className:"grid grid-cols-1 gap-2.5",children:g.options.map((j,k)=>i.jsx("button",{onClick:()=>y(j),disabled:u,className:`w-full text-left p-3.5 rounded-xl border-2 transition-all duration-200 ${_(j)}`,children:i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("span",{className:"w-7 h-7 rounded-lg bg-muted flex items-center justify-center text-xs font-bold text-muted-foreground shrink-0",children:String.fromCharCode(65+k)}),i.jsx("span",{className:"text-sm font-medium text-foreground",children:j}),u&&j===g.correct_answer&&i.jsx(lr,{className:"w-5 h-5 text-success ml-auto shrink-0"}),u&&j===l&&!v&&j!==g.correct_answer&&i.jsx(qo,{className:"w-5 h-5 text-destructive ml-auto shrink-0"})]})},k))}),u&&i.jsx(z,{className:`animate-in slide-in-from-bottom-2 duration-200 ${v?"bg-success/5 border-success/20":"bg-destructive/5 border-destructive/20"}`,children:i.jsxs(B,{className:"p-4",children:[i.jsx("div",{className:"flex items-center gap-2 mb-1.5",children:v?i.jsxs(i.Fragment,{children:[i.jsx(Ar,{className:"w-4 h-4 text-success"}),i.jsx("span",{className:"font-bold text-success text-sm",children:"Correct! ð"})]}):i.jsxs(i.Fragment,{children:[i.jsx(_i,{className:"w-4 h-4 text-warning"}),i.jsx("span",{className:"font-bold text-destructive text-sm",children:"Not quite!"})]})}),i.jsx("p",{className:"text-sm text-muted-foreground leading-relaxed",children:g.explanation})]})}),u&&i.jsx(ne,{className:"w-full gradient-primary text-white font-bold py-5 gap-2",onClick:w,children:a<s.length-1?i.jsxs(i.Fragment,{children:["Next Question ",i.jsx(Pr,{className:"w-4 h-4"})]}):i.jsxs(i.Fragment,{children:["See Results ",i.jsx(gl,{className:"w-4 h-4"})]})})]})},PI=({difficulty:e})=>{const t={easy:"bg-success/10 text-success border-success/20",medium:"bg-warning/10 text-warning border-warning/20",hard:"bg-destructive/10 text-destructive border-destructive/20"};return i.jsx(Ir,{variant:"outline",className:`text-xs font-bold ${t[e]}`,children:e.charAt(0).toUpperCase()+e.slice(1)})},AI=({difficulty:e})=>{const t={easy:"bg-success",medium:"bg-warning",hard:"bg-destructive"};return i.jsx("span",{className:`w-2 h-2 rounded-full shrink-0 ${t[e]}`})},Lj="mathly-rw-quiz-results",RI=()=>{try{const e=localStorage.getItem(Lj);return e?JSON.parse(e):[]}catch{return[]}},OI=e=>{localStorage.setItem(Lj,JSON.stringify(e))},II=()=>{const[e,t]=p.useState("browse"),[r,n]=p.useState(null),[s,a]=p.useState("all"),[o,l]=p.useState(RI);p.useEffect(()=>{OI(o)},[o]);const c=p.useCallback(g=>{l(v=>[g,...v].slice(0,50))},[]),u=g=>{n(g),t("quiz")},d=()=>{t("browse"),n(null)},h=yh.find(g=>g.id===r);if(e==="quiz"&&h)return i.jsx("section",{className:"mb-8",children:i.jsx(TI,{category:h,difficulty:s,onBack:d,onComplete:c})});const m=g=>{const v=o.filter(x=>x.categoryId===g);return v.length===0?null:v.reduce((x,y)=>y.percentage>x.percentage?y:x,v[0])},f=o.length,b=o.length>0?Math.round(o.reduce((g,v)=>g+v.percentage,0)/o.length):0;return i.jsxs("section",{className:"mb-8",children:[i.jsxs("div",{className:"rounded-xl gradient-primary p-5 mb-5",children:[i.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[i.jsx("div",{className:"w-10 h-10 rounded-lg bg-white/20 flex items-center justify-center",children:i.jsx(gb,{className:"w-5 h-5 text-white"})}),i.jsx("span",{className:"text-2xl",children:"ð"}),i.jsx("h2",{className:"text-xl font-bold text-white",children:"Maths is Everywhere!"})]}),i.jsx("p",{className:"text-white/90 text-sm",children:"Pick a topic you love and prove your maths skills! ð¥"})]}),f>0&&i.jsxs("div",{className:"grid grid-cols-2 gap-3 mb-5",children:[i.jsx(z,{className:"bg-primary/5 border-primary/20",children:i.jsxs(B,{className:"p-3 flex items-center gap-3",children:[i.jsx("div",{className:"w-9 h-9 rounded-lg bg-primary/10 flex items-center justify-center",children:i.jsx(_f,{className:"w-4 h-4 text-primary"})}),i.jsxs("div",{children:[i.jsx("p",{className:"text-lg font-bold text-foreground",children:f}),i.jsx("p",{className:"text-xs text-muted-foreground",children:"Qu
549izzes Taken"})]})]})}),i.jsx(z,{className:"bg-success/5 border-success/20",children:i.jsxs(B,{className:"p-3 flex items-center gap-3",children:[i.jsx("div",{className:"w-9 h-9 rounded-lg bg-success/10 flex items-center justify-center",children:i.jsx(ma,{className:"w-4 h-4 text-success"})}),i.jsxs("div",{children:[i.jsxs("p",{className:"text-lg font-bold text-foreground",children:[b,"%"]}),i.jsx("p",{className:"text-xs text-muted-foreground",children:"Avg Score"})]})]})})]}),i.jsxs("div",{className:"mb-4",children:[i.jsx("p",{className:"text-sm font-semibold text-foreground mb-2",children:"Choose difficulty â¨"}),i.jsx(wl,{value:s,onValueChange:g=>a(g),children:i.jsxs(qi,{className:"w-full grid grid-cols-4",children:[i.jsx(it,{value:"all",className:"text-xs",children:"All"}),i.jsx(it,{value:"easy",className:"text-xs",children:"Easy"}),i.jsx(it,{value:"medium",className:"text-xs",children:"Medium"}),i.jsx(it,{value:"hard",className:"text-xs",children:"Hard"})]})})]}),i.jsx("div",{className:"grid grid-cols-2 gap-3",children:yh.map(g=>{const v=m(g.id),x=s==="all"?g.questions.length:g.questions.filter(y=>y.difficulty===s).length;return i.jsx(z,{className:"cursor-pointer hover:border-primary/50 hover:shadow-soft transition-all duration-200 group",onClick:()=>u(g.id),children:i.jsxs(B,{className:"p-4",children:[i.jsxs("div",{className:"flex items-center justify-between mb-2",children:[i.jsx("span",{className:"text-2xl",children:g.icon}),v&&i.jsxs(Ir,{variant:"outline",className:`text-[10px] font-bold ${v.percentage>=80?"bg-success/10 text-success border-success/20":v.percentage>=50?"bg-warning/10 text-warning border-warning/20":"bg-muted text-muted-foreground"}`,children:["Best: ",v.percentage,"%"]})]}),i.jsx("h3",{className:"font-bold text-foreground text-sm mb-1 leading-tight",children:g.name}),i.jsx("p",{className:"text-xs text-muted-foreground mb-3 line-clamp-2",children:g.description}),i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("span",{className:"text-[10px] text-muted-foreground font-medium",children:[x," Qs"]}),i.jsx("div",{className:"w-7 h-7 rounded-full bg-primary/10 flex items-center justify-center group-hover:bg-primary group-hover:text-white transition-colors",children:i.jsx(up,{className:"w-3.5 h-3.5 text-primary group-hover:text-white"})})]})]})},g.id)})}),o.length>0&&i.jsxs("div",{className:"mt-5",children:[i.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[i.jsx(gl,{className:"w-4 h-4 text-warning"}),i.jsx("h3",{className:"font-bold text-foreground text-sm",children:"Recent Scores"})]}),i.jsx("div",{className:"space-y-2",children:o.slice(0,5).map((g,v)=>{const x=yh.find(y=>y.id===g.categoryId);return i.jsx(z,{className:"border-l-4",style:{borderLeftColor:g.percentage>=80?"hsl(var(--success))":g.percentage>=50?"hsl(var(--warning))":"hsl(var(--destructive))"},children:i.jsxs(B,{className:"p-3 flex items-center gap-3",children:[i.jsx("span",{className:"text-lg",children:(x==null?void 0:x.icon)||"ð"}),i.jsxs("div",{className:"flex-1 min-w-0",children:[i.jsx("p",{className:"text-sm font-semibold text-foreground truncate",children:g.categoryName}),i.jsxs("p",{className:"text-xs text-muted-foreground",children:[g.difficulty!=="all"?g.difficulty.charAt(0).toUpperCase()+g.difficulty.slice(1)+" · ":"",g.score,"/",g.total," correct"]})]}),i.jsxs("div",{className:`text-lg font-extrabold ${g.percentage>=80?"text-success":g.percentage>=50?"text-warning":"text-destructive"}`,children:[g.percentage,"%"]})]})},v)})})]})]})},Xx=e=>({not_started:"bg-muted text-muted-foreground",practising:"bg-warning/10 text-warning",confident:"bg-success/10 text-success"})[e],MI=({strands:e,subtopics:t,topicProgress:r,getSubtopics:n})=>{const[s,a]=p.useState({}),o=l=>{a(c=>({...c,[l]:!c[l]}))};return i.jsxs("div",{className:"space-y-8",children:[i.jsxs("section",{children:[i.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[i.jsx(sr,{className:"w-5 h-5 text-primary"}),i.jsx("h2",{className:"text-lg font-bold text-foreground",children:"GCSE Topics"})]}),i.jsx("p",{className:"text-xs text-muted-foreground mb-4",children:"Tap a topic to start a quiz and build your confidence"}),i.jsx("div",{className:"space-y-3",children:e.map(l=>{const c=n(l.id),u=s[l.id]??!1,d=c.filter(g=>{const v=r.find(x=>x.topic_id===g.id);return(v==null?void 0:v.mastery_level)==="confident"}).length,h=c.filter(g=>{const v=r.find(x=>x.topic_id===g.id);return(v==null?void 0:v.mastery_level)==="practising"}).length,m=d+h,f=c.length>0?Math.round(m/c.length*100):0,b=c.length>0?Math.round(d/c.length*100):0;return i.jsxs("div",{children:[i.jsx(z,{className:"cursor-pointer hover:border-primary/50 transition-colors shadow-card",onClick:()=>o(l.id),children:i.jsxs(B,{className:"p-4",children:[i.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[i.jsx("div",{className:"w-10 h-10 rounded-lg gradient-primary flex items-center justify-center",children:i.jsx(sr,{className:"w-5 h-5 text-primary-foreground"})}),i.jsxs("div",{className:"flex-1 min-w-0",children:[i.jsx("h3",{className:"font-bold text-foreground text-sm",children:l.name}),i.jsxs("p",{className:"text-xs text-muted-foreground",children:[m,"/",c.length," completed (",d," confident · ",h," practising)"]})]}),i.jsxs("span",{className:"text-sm font-extrabold text-primary",children:[f,"%"]}),u?i.jsx(Gr,{className:"w-4 h-4 text-muted-foreground shrink-0"}):i.jsx(Cr,{className:"w-4 h-4 text-muted-foreground shrink-0"})]}),i.jsxs("div",{className:"relative h-2.5 w-full rounded-full bg-secondary overflow-hidden",children:[i.jsx("div",{className:"absolute inset-y-0 left-0 rounded-full bg-success transition-all duration-500",style:{width:`${b}%`}}),i.jsx("div",{className:"absolute inset-y-0 rounded-full bg-warning/60 transition-all duration-500",style:{left:`${b}%`,width:`${f-b}%`}})]}),i.jsxs("div",{className:"flex items-center gap-3 mt-1.5",children:[i.jsxs("span",{className:"flex items-center gap-1 text-[10px] text-success font-semibold",children:[i.jsx("span",{className:"w-2 h-2 rounded-full bg-success inline-block"})," Confident"]}),i.jsxs("span",{className:"flex items-center gap-1 text-[10px] text-warning font-semibold",children:[i.jsx("span",{className:"w-2 h-2 rounded-full bg-warning/60 inline-block"})," Practising"]}),i.jsxs("span",{className:"flex items-center gap-1 text-[10px] text-muted-foreground font-semibold",children:[i.jsx("span",{className:"w-2 h-2 rounded-full bg-secondary inline-block"})," Not Started"]})]})]})}),u&&i.jsx("div",{className:"ml-4 mt-2 space-y-2",children:c.map(g=>{const v=r.find(y=>y.topic_id===g.id),x=(v==null?void 0:v.mastery_level)||"not_started";return i.jsx(mn,{to:`/quiz/${g.id}`,children:i.jsx(z,{className:"hover:border-primary/50 transition-colors shadow-card",children:i.jsxs(B,{className:"flex items-center gap-3 p-3",children:[i.jsx("div",{className:`w-8 h-8 rounded-lg flex items-center justify-center ${Xx(x)}`,children:i.jsx(sr,{className:"w-4 h-4"})}),i.jsx("div",{className:"flex-1 min-w-0",children:i.jsx("h3",{className:"font-semibold text-foreground text-sm truncate",children:g.name})}),i.jsx("span",{className:`text-xs px-2 py-0.5 rounded-full font-medium ${Xx(x)}`,children:od[x]}),i.jsx(fb,{className:"w-4 h-4 text-muted-foreground shrink-0"})]})})},g.id)})})]},l.id)})})]}),i.jsxs("section",{children:[i.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[i.jsx(gb,{className:"w-5 h-5 text-accent"}),i.jsx("h2",{className:"text-lg font-bold text-foreground",children:"Real-World Maths"})]}),i.jsx("p",{className:"text-xs text-muted-foreground mb-4",children:"See how maths applies to everyday life"}),i.jsx(II,{})]})]})},ac=[{label:"Math Seedling",range:"0â15%",icon:uC,threshold:0},{label:"Growing Learner",range:"16â35%",icon:dC,threshold:16},{label:"Math Explorer",range:"36â55%",icon:eC,threshold:36},{label:"Problem Solver",range:"56â75%",icon:lr,threshold:56},{label:"Math Master",range:"76â90%",icon:V2,threshold:76},{label:"GCSE Legend",range:"91â100%",icon:K2,threshold:91}],DI={0:"Just getting started! Every expert was once a beginner.",1:"You're growing! Keep building those skills.",2:"Exploring new territory â great progress!",3:"You're solving problems like a pro!",4:"Almost at the top â incredible work!",5:"Legendary status! You've mastered it all!"},LI=({topicProgress:e,totalTopics:t,quizzesTaken:r,questionsSolved:n})=>{const s=e.filter(d=>d.mastery_level==="confident").length,a=t>0?Math.round(s/t*100):0,o=[...ac].reverse().findIndex(d=>a>=d.threshold),l=o===-1?0:ac.length-1-o,c=ac[l],u=c.icon;return i.jsxs("section",{className:"mb-8",children:[i.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[i.jsx(ma,{className:"w-5 h-5 text-primary"}),i.jsx("h2",{className:"text-lg font-bold text-foreground",children:"Your Growth Journey"})]}),i.jsxs("div",{className:"grid grid-cols-3 gap-3 mb-4",children:[i.jsx(z,{children:i.jsxs(B,{className:"p-3 text-center",children:[i.jsx("div",{className:"text-2xl font-bold text-foreground",children:r}),i.jsx("div",{className:"text-xs text-muted-foreground",children:"Qu
549izzes Taken"})]})}),i.jsx(z,{children:i.jsxs(B,{className:"p-3 text-center",children:[i.jsx("div",{className:"text-2xl font-bold text-foreground",children:n}),i.jsx("div",{className:"text-xs text-muted-foreground",children:"Questions Solved"})]})}),i.jsx(z,{children:i.jsxs(B,{className:"p-3 text-center",children:[i.jsx("div",{className:"text-2xl font-bold text-foreground",children:s}),i.jsx("div",{className:"text-xs text-muted-foreground",children:"Topics Mastered"})]})})]}),i.jsx(z,{className:"mb-4",children:i.jsxs(B,{className:"p-4",children:[i.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[i.jsx(u,{className:"w-5 h-5 text-primary"}),i.jsx("span",{className:"font-bold text-foreground text-sm",children:c.label}),i.jsxs("span",{className:"ml-auto text-sm font-bold text-primary",children:[a,"%"]})]}),i.jsx("p",{className:"text-xs text-muted-foreground mb-4",children:DI[l]}),i.jsxs("div",{className:"relative mb-6",children:[i.jsx("div",{className:"h-3 w-full rounded-full bg-secondary overflow-hidden",children:i.jsx("div",{className:"h-full rounded-full gradient-primary transition-all duration-500",style:{width:`${a}%`}})}),i.jsx("div",{className:"absolute top-0 left-0 w-full h-3 flex",children:[25,50,75].map(d=>i.jsx("div",{className:"absolute top-0 h-3 w-0.5 bg-background/60",style:{left:`${d}%`}},d))}),i.jsx("div",{className:"flex justify-between mt-1.5",children:[0,25,50,75,100].map(d=>i.jsxs("span",{className:"text-[10px] text-muted-foreground",children:[d,"%"]},d))})]}),i.jsx("div",{className:"grid grid-cols-3 sm:grid-cols-6 gap-2",children:ac.map((d,h)=>{const m=d.icon,f=h===l,b=h<l;return i.jsxs("div",{className:`flex flex-col items-center gap-1 p-2 rounded-xl text-center transition-all ${f?"bg-primary/10 ring-2 ring-primary/30":b?"bg-success/5":"bg-muted/50"}`,children:[i.jsx(m,{className:`w-5 h-5 ${f?"text-primary":b?"text-success":"text-muted-foreground"}`}),i.jsx("span",{className:`text-[10px] font-bold leading-tight ${f?"text-primary":b?"text-success":"text-muted-foreground"}`,children:d.label}),i.jsx("span",{className:"text-[9px] text-muted-foreground",children:d.range})]},d.label)})})]})})]})},$j=p.forwardRef(({className:e,...t},r)=>i.jsx("div",{className:"relative w-full overflow-auto",children:i.jsx("table",{ref:r,className:ce("w-full caption-bottom text-sm",e),...t})}));$j.displayName="Table";const Fj=p.forwardRef(({className:e,...t},r)=>i.jsx("thead",{ref:r,className:ce("[&_tr]:border-b",e),...t}));Fj.displayName="TableHeader";const Uj=p.forwardRef(({className:e,...t},r)=>i.jsx("tbody",{ref:r,className:ce("[&_tr:last-child]:border-0",e),...t}));Uj.displayName="TableBody";const $I=p.forwardRef(({className:e,...t},r)=>i.jsx("tfoot",{ref:r,className:ce("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",e),...t}));$I.displayName="TableFooter";const om=p.forwardRef(({className:e,...t},r)=>i.jsx("tr",{ref:r,className:ce("border-b transition-colors data-[state=selected]:bg-muted hover:bg-muted/50",e),...t}));om.displayName="TableRow";const Nc=p.forwardRef(({className:e,...t},r)=>i.jsx("th",{ref:r,className:ce("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",e),...t}));Nc.displayName="TableHead";const Cc=p.forwardRef(({className:e,...t},r)=>i.jsx("td",{ref:r,className:ce("p-4 align-middle [&:has([role=checkbox])]:pr-0",e),...t}));Cc.displayName="TableCell";const FI=p.forwardRef(({className:e,...t},r)=>i.jsx("caption",{ref:r,className:ce("mt-4 text-sm text-muted-foreground",e),...t}));FI.displayName="TableCaption";function Re(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 _s(e,t){return e instanceof Date?new e.constructor(t):new Date(t)}const qj=6048e5,UI=864e5,ic=43200,ey=1440;let qI={};function bl(){return qI}function sl(e,t){var l,c,u,d;const r=bl(),n=(t==null?void 0:t.weekStartsOn)??((c=(l=t==null?void 0:t.locale)==null?void 0:l.options)==null?void 0:c.weekStartsOn)??r.weekStartsOn??((d=(u=r.locale)==null?void 0:u.options)==null?void 0:d.weekStartsOn)??0,s=Re(e),a=s.getDay(),o=(a<n?7:0)+a-n;return s.setDate(s.getDate()-o),s.setHours(0,0,0,0),s}function ju(e){return sl(e,{weekStartsOn:1}
549)}function zj(e){const t=Re(e),r=t.getFullYear(),n=_s(e,0);n.setFullYear(r+1,0,4),n.setHours(0,0,0,0);const s=ju(n),a=_s(e,0);a.setFullYear(r,0,4),a.setHours(0,0,0,0);const o=ju(a);return t.getTime()>=s.getTime()?r+1:t.getTime()>=o.getTime()?r:r-1}function ty(e){const t=Re(e);return t.setHours(0,0,0,0),t}function ku(e){const t=Re(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 zI(e,t){const r=ty(e),n=ty(t),s=+r-ku(r),a=+n-ku(n);return Math.round((s-a)/UI)}function BI(e){const t=zj(e),r=_s(e,0);return r.setFullYear(t,0,4),r.setHours(0,0,0,0),ju(r)}function Ec(e,t){const r=Re(e),n=Re(t),s=r.getTime()-n.getTime();return s<0?-1:s>0?1:s}function WI(e){return _s(e,Date.now())}function HI(e){return e instanceof Date||typeof e=="object"&&Object.prototype.toString.call(e)==="[object Date]"}function VI(e){if(!HI(e)&&typeof e!="number")return!1;const t=Re(e);return!isNaN(Number(t))}function GI(e,t){const r=Re(e),n=Re(t),s=r.getFullYear()-n.getFullYear(),a=r.getMonth()-n.getMonth();return s*12+a}function YI(e){return t=>{const n=(e?Math[e]:Math.trunc)(t);return n===0?0:n}}function KI(e,t){return+Re(e)-+Re(t)}function QI(e){const t=Re(e);return t.setHours(23,59,59,999),t}function JI(e){const t=Re(e),r=t.getMonth();return t.setFullYear(t.getFullYear(),r+1,0),t.setHours(23,59,59,999),t}function ZI(e){const t=Re(e);return+QI(t)==+JI(t)}function XI(e,t){const r=Re(e),n=Re(t),s=Ec(r,n),a=Math.abs(GI(r,n));let o;if(a<1)o=0;else{r.getMonth()===1&&r.getDate()>27&&r.setDate(30),r.setMonth(r.getMonth()-s*a);let l=Ec(r,n)===-s;ZI(Re(e))&&a===1&&Ec(e,n)===1&&(l=!1),o=s*(a-Number(l))}return o===0?0:o}function eM(e,t,r){const n=KI(e,t)/1e3;return YI(r==null?void 0:r.roundingMethod)(n)}function tM(e){const t=Re(e),r=_s(e,0);return r.setFullYear(t.getFullYear(),0,1),r.setHours(0,0,0,0),r}const rM={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"}},nM=(e,t,r)=>{let n;const s=rM[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 vh(e){return(t={})=>{const r=t.width?String(t.width):e.defaultWidth;return e.formats[r]||e.formats[e.defaultWidth]}}const sM={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},aM={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},iM={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},oM={date:vh({formats:sM,defaultWidth:"full"}),time:vh({formats:aM,defaultWidth:"full"}),dateTime:vh({formats:iM,defaultWidth:"full"})},lM={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},cM=(e,t,r,n)=>lM[e];function to(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 a=e.argumentCallback?e.argumentCallback(t):t;return s[a]}}const uM={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},dM={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},hM={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"]},fM={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","Frid
549ay","Saturday"]},mM={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"}},pM={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"}},gM=(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"},xM={ordinalNumber:gM,era:to({values:uM,defaultWidth:"wide"}),quarter:to({values:dM,defaultWidth:"wide",argumentCallback:e=>e-1}),month:to({values:hM,defaultWidth:"wide"}),day:to({values:fM,defaultWidth:"wide"}),dayPeriod:to({values:mM,defaultWidth:"wide",formattingValues:pM,defaultFormattingWidth:"wide"})};function ro(e){return(t,r={})=>{const n=r.width,s=n&&e.matchPatterns[n]||e.matchPatterns[e.defaultMatchWidth],a=t.match(s);if(!a)return null;const o=a[0],l=n&&e.parsePatterns[n]||e.parsePatterns[e.defaultParseWidth],c=Array.isArray(l)?vM(l,h=>h.test(o)):yM(l,h=>h.test(o));let u;u=e.valueCallback?e.valueCallback(c):c,u=r.valueCallback?r.valueCallback(u):u;const d=t.slice(o.length);return{value:u,rest:d}}}function yM(e,t){for(const r in e)if(Object.prototype.hasOwnProperty.call(e,r)&&t(e[r]))return r}function vM(e,t){for(let r=0;r<e.length;r++)if(t(e[r]))return r}function wM(e){return(t,r={})=>{const n=t.match(e.matchPattern);if(!n)return null;const s=n[0],a=t.match(e.parsePattern);if(!a)return null;let o=e.valueCallback?e.valueCallback(a[0]):a[0];o=r.valueCallback?r.valueCallback(o):o;const l=t.slice(s.length);return{value:o,rest:l}}}const bM=/^(\d+)(th|st|nd|rd)?/i,_M=/\d+/i,jM={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},kM={any:[/^b/i,/^(a|c)/i]},SM={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},NM={any:[/1/i,/2/i,/3/i,/4/i]},CM={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},EM={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]},TM={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},PM={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]},AM={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},RM={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}},OM={ordinalNumber:wM({matchPattern:bM,parsePattern:_M,valueCallback:e=>parseInt(e,10)}),era:ro({matchPatterns:jM,defaultMatchWidth:"wide",parsePatterns:kM,defaultParseWidth:"any"}),quarter:ro({matchPatterns:SM,defaultMatchWidth:"wide",parsePatterns:NM,defaultParseWidth:"any",valueCallback:e=>e+1}),month:ro({matchPatterns:CM,defaultMatchWidth:"wide",parsePatterns:EM,defaultParseWidth:"any"}),day:ro({matchPatterns:TM,defaultMatchWidth:"wide",parsePatterns:PM,defaultParseWidth:"any"}),dayPeriod:ro({matchPatterns:AM,defaultMatchWidth:"any",parsePatterns:RM,defaultParseWidth:"any"})},Bj={code:"en-US",formatDistance:nM,formatLong:oM,formatRelative:cM,localize:xM,match:OM,options:{weekStartsOn:0,firstWeekContainsDate:1}};function IM(e){const t=Re(e);return zI(t,tM(t))+1}function MM(e){const t=Re(e),r=+ju(t)-+BI(t);return Math.round(r/qj)+1}function Wj(e,t){var d,h,m,f;const r=Re(e),n=r.getFullYear(),s=bl(),a=(t==null?void 0:t.firstWeekContainsDate)??((h=(d=t==null?void 0:t.locale)==null?void 0:d.options)==null?void 0:h.firstWeekContainsDate)??s.firstWeekContainsDate??((f=(m=s.locale)==null?void 0:m.options)==null?void 0:f.firstWeekContainsDate)??1,o=_s(e,0);o.setFullYear(n+1,0,a),o.setHours(0,0,0,0);const l=sl(o,t),c=_s(e,0);c.setFullYear(n,0,a),c.setHours(0,0,0,0);const u=sl(c,t);return r.getTime()>=l.getTime()?n+1:r.getTime()>=u.getTime()?n:n-1}function DM(e,t){var l,c,u,d;const r=bl(),n=(t==null?void 0:t.firstWeekContainsDate)??((c=(l=t==null?void 0:t.locale)==null?void 0:l.options)==null?void 0:c.firstWeekContainsDate)??r.firstWeekContainsDate??((d=(u=r.locale)==null?void 0:u.options)==null?void 0:d.firstWeekContainsDate)??1,s=Wj(e,t),a=_s(e,0);return a.setFullYear(s,0,n),a.setHours(0,0,0,0),sl(a,t)}function LM(e,t){const r=Re(e),n=+sl(r,t)-+DM(r,t);return Math.round(n/qj)+1}function Te(e,t){const r=e<0?"-":"",n=Math.abs(e).toString().padStart(t,"0");return r+n}const Ln={y(e,t){const r=e.getFullYear(),n=r>0?r:1-r;return Te(t==="yy"?n%100:n,t.length)},M(e,t){const r=e.getMonth();return t==="M"?String(r+1):Te(r+1,2)},d(e,t){return Te(e.getDate(),t.length)},a(e,t){const r=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return r.toUpperCase();case"aaa":return r;case"aaaaa":return r[0];case"aaaa":default:return r==="am"?"a.m.":"p.m."}},h(e,t){return Te(e.getHours()%12||12,t.length)},H(e,t){return Te(e.getHours(),t.length)},m(e,t){return Te(e.getMinutes(),t.length)},s(e,t){return Te(e.getSeconds(),t.length)},S(e,t){const r=t.length,n=e.getMilliseconds(),s=Math.trunc(n*Math.pow(10,r-3));return Te(s,t.length)}},Aa={am:"am",pm:"pm",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},ry={G:function(e,t,r){const n=e.getFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return r.era(n,{width:"abbreviated"});case"GGGGG":return r.era(n,{width:"narrow"});case"GGGG":default:return r.era(n,{width:"wide"})}},y:function(e,t,r){if(t==="yo"){const n=e.getFullYear(),s=n>0?n:1-n;return r.ordinalNumber(s,{unit:"year"})}return Ln.y(e,t)}
vendor: 4,312 bytes, line 549
549,Y:function(e,t,r,n){const s=Wj(e,n),a=s>0?s:1-s;if(t==="YY"){const o=a%100;return Te(o,2)}return t==="Yo"?r.ordinalNumber(a,{unit:"year"}):Te(a,t.length)},R:function(e,t){const r=zj(e);return Te(r,t.length)},u:function(e,t){const r=e.getFullYear();return Te(r,t.length)},Q:function(e,t,r){const n=Math.ceil((e.getMonth()+1)/3);switch(t){case"Q":return String(n);case"QQ":return Te(n,2);case"Qo":return r.ordinalNumber(n,{unit:"quarter"});case"QQQ":return r.quarter(n,{width:"abbreviated",context:"formatting"});case"QQQQQ":return r.quarter(n,{width:"narrow",context:"formatting"});case"QQQQ":default:return r.quarter(n,{width:"wide",context:"formatting"})}},q:function(e,t,r){const n=Math.ceil((e.getMonth()+1)/3);switch(t){case"q":return String(n);case"qq":return Te(n,2);case"qo":return r.ordinalNumber(n,{unit:"quarter"});case"qqq":return r.quarter(n,{width:"abbreviated",context:"standalone"});case"qqqqq":return r.quarter(n,{width:"narrow",context:"standalone"});case"qqqq":default:return r.quarter(n,{width:"wide",context:"standalone"})}},M:function(e,t,r){const n=e.getMonth();switch(t){case"M":case"MM":return Ln.M(e,t);case"Mo":return r.ordinalNumber(n+1,{unit:"month"});case"MMM":return r.month(n,{width:"abbreviated",context:"formatting"});case"MMMMM":return r.month(n,{width:"narrow",context:"formatting"});case"MMMM":default:return r.month(n,{width:"wide",context:"formatting"})}},L:function(e,t,r){const n=e.getMonth();switch(t){case"L":return String(n+1);case"LL":return Te(n+1,2);case"Lo":return r.ordinalNumber(n+1,{unit:"month"});case"LLL":return r.month(n,{width:"abbreviated",context:"standalone"});case"LLLLL":return r.month(n,{width:"narrow",context:"standalone"});case"LLLL":default:return r.month(n,{width:"wide",context:"standalone"})}},w:function(e,t,r,n){const s=LM(e,n);return t==="wo"?r.ordinalNumber(s,{unit:"week"}):Te(s,t.length)},I:function(e,t,r){const n=MM(e);return t==="Io"?r.ordinalNumber(n,{unit:"week"}):Te(n,t.length)},d:function(e,t,r){return t==="do"?r.ordinalNumber(e.getDate(),{unit:"date"}):Ln.d(e,t)},D:function(e,t,r){const n=IM(e);return t==="Do"?r.ordinalNumber(n,{unit:"dayOfYear"}):Te(n,t.length)},E:function(e,t,r){const n=e.getDay();switch(t){case"E":case"EE":case"EEE":return r.day(n,{width:"abbreviated",context:"formatting"});case"EEEEE":return r.day(n,{width:"narrow",context:"formatting"});case"EEEEEE":return r.day(n,{width:"short",context:"formatting"});case"EEEE":default:return r.day(n,{width:"wide",context:"formatting"})}},e:function(e,t,r,n){const s=e.getDay(),a=(s-n.weekStartsOn+8)%7||7;switch(t){case"e":return String(a);case"ee":return Te(a,2);case"eo":return r.ordinalNumber(a,{unit:"day"});case"eee":return r.day(s,{width:"abbreviated",context:"formatting"});case"eeeee":return r.day(s,{width:"narrow",context:"formatting"});case"eeeeee":return r.day(s,{width:"short",context:"formatting"});case"eeee":default:return r.day(s,{width:"wide",context:"formatting"})}},c:function(e,t,r,n){const s=e.getDay(),a=(s-n.weekStartsOn+8)%7||7;switch(t){case"c":return String(a);case"cc":return Te(a,t.length);case"co":return r.ordinalNumber(a,{unit:"day"});case"ccc":return r.day(s,{width:"abbreviated",context:"standalone"});case"ccccc":return r.day(s,{width:"narrow",context:"standalone"});case"cccccc":return r.day(s,{width:"short",context:"standalone"});case"cccc":default:return r.day(s,{width:"wide",context:"standalone"})}},i:function(e,t,r){const n=e.getDay(),s=n===0?7:n;switch(t){case"i":return String(s);case"ii":return Te(s,t.length);case"io":return r.ordinalNumber(s,{unit:"day"});case"iii":return r.day(n,{width:"abbreviated",context:"formatting"});case"iiiii":return r.day(n,{width:"narrow",context:"formatting"});case"iiiiii":return r.day(n,{width:"short",context:"formatting"});case"iiii":default:return r.day(n,{width:"wide",context:"formatting"})}},a:function(e,t,r){const s=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return r.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"aaa":return r.dayPeriod(s,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return r.dayPeriod(s,{width:"narrow",context:"formatting"});case"aaaa":default:return r.dayPeriod(s,{width:"wide",context:"formatting"})}},b:function(e,t,r){const n=e.getHours();let s;switch(n===12?s=Aa.noon:n===0?s=Aa.midnight:s=n/12>
vendor: 4,402 bytes, line 549
549=1?"pm":"am",t){case"b":case"bb":return r.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"bbb":return r.dayPeriod(s,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return r.dayPeriod(s,{width:"narrow",context:"formatting"});case"bbbb":default:return r.dayPeriod(s,{width:"wide",context:"formatting"})}},B:function(e,t,r){const n=e.getHours();let s;switch(n>=17?s=Aa.evening:n>=12?s=Aa.afternoon:n>=4?s=Aa.morning:s=Aa.night,t){case"B":case"BB":case"BBB":return r.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"BBBBB":return r.dayPeriod(s,{width:"narrow",context:"formatting"});case"BBBB":default:return r.dayPeriod(s,{width:"wide",context:"formatting"})}},h:function(e,t,r){if(t==="ho"){let n=e.getHours()%12;return n===0&&(n=12),r.ordinalNumber(n,{unit:"hour"})}return Ln.h(e,t)},H:function(e,t,r){return t==="Ho"?r.ordinalNumber(e.getHours(),{unit:"hour"}):Ln.H(e,t)},K:function(e,t,r){const n=e.getHours()%12;return t==="Ko"?r.ordinalNumber(n,{unit:"hour"}):Te(n,t.length)},k:function(e,t,r){let n=e.getHours();return n===0&&(n=24),t==="ko"?r.ordinalNumber(n,{unit:"hour"}):Te(n,t.length)},m:function(e,t,r){return t==="mo"?r.ordinalNumber(e.getMinutes(),{unit:"minute"}):Ln.m(e,t)},s:function(e,t,r){return t==="so"?r.ordinalNumber(e.getSeconds(),{unit:"second"}):Ln.s(e,t)},S:function(e,t){return Ln.S(e,t)},X:function(e,t,r){const n=e.getTimezoneOffset();if(n===0)return"Z";switch(t){case"X":return sy(n);case"XXXX":case"XX":return Fs(n);case"XXXXX":case"XXX":default:return Fs(n,":")}},x:function(e,t,r){const n=e.getTimezoneOffset();switch(t){case"x":return sy(n);case"xxxx":case"xx":return Fs(n);case"xxxxx":case"xxx":default:return Fs(n,":")}},O:function(e,t,r){const n=e.getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+ny(n,":");case"OOOO":default:return"GMT"+Fs(n,":")}},z:function(e,t,r){const n=e.getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+ny(n,":");case"zzzz":default:return"GMT"+Fs(n,":")}},t:function(e,t,r){const n=Math.trunc(e.getTime()/1e3);return Te(n,t.length)},T:function(e,t,r){const n=e.getTime();return Te(n,t.length)}};function ny(e,t=""){const r=e>0?"-":"+",n=Math.abs(e),s=Math.trunc(n/60),a=n%60;return a===0?r+String(s):r+String(s)+t+Te(a,2)}function sy(e,t){return e%60===0?(e>0?"-":"+")+Te(Math.abs(e)/60,2):Fs(e,t)}function Fs(e,t=""){const r=e>0?"-":"+",n=Math.abs(e),s=Te(Math.trunc(n/60),2),a=Te(n%60,2);return r+s+t+a}const ay=(e,t)=>{switch(e){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});case"PPPP":default:return t.date({width:"full"})}},Hj=(e,t)=>{switch(e){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});case"pppp":default:return t.time({width:"full"})}},$M=(e,t)=>{const r=e.match(/(P+)(p+)?/)||[],n=r[1],s=r[2];if(!s)return ay(e,t);let a;switch(n){case"P":a=t.dateTime({width:"short"});break;case"PP":a=t.dateTime({width:"medium"});break;case"PPP":a=t.dateTime({width:"long"});break;case"PPPP":default:a=t.dateTime({width:"full"});break}return a.replace("{{date}}",ay(n,t)).replace("{{time}}",Hj(s,t))},FM={p:Hj,P:$M},UM=/^D+$/,qM=/^Y+$/,zM=["D","DD","YY","YYYY"];function BM(e){return UM.test(e)}function WM(e){return qM.test(e)}function HM(e,t,r){const n=VM(e,t,r);if(console.warn(n),zM.includes(e))throw new RangeError(n)}function VM(e,t,r){const n=e[0]==="Y"?"years":"days of the month";return`Use \`${e.toLowerCase()}\` instead of \`${e}\` (in \`${t}\`) for formatting ${n} to the input \`${r}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const GM=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,YM=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,KM=/^'([^]*?)'?$/,QM=/''/g,JM=/[a-zA-Z]/;function Su(e,t,r){var d,h,m,f;const n=bl(),s=n.locale??Bj,a=n.firstWeekContainsDate??((h=(d=n.locale)==null?void 0:d.options)==null?void 0:h.firstWeekContainsDate)??1,o=n.weekStartsOn??((f=(m=n.locale)==null?void 0:m.options)==null?void 0:f.weekStartsOn)??0,l=Re(e);if(!VI(l))throw new RangeError("Invalid time value");let c=t.match(YM).map(b=>{const g=b[0];if(g==="p"||g==="P"){const v=FM[g];return v(b,s.formatLong)}return b}).join("").match(GM).map(b=>{if(b==="''")return{isToken:!1,value:"'"};const g=b[0];if(g==="'")return{isToken:!1,value:ZM(b)};if(ry[g])return{isToken:!0,value:b};
549if(g.match(JM))throw new RangeError("Format string contains an unescaped latin alphabet character `"+g+"`");return{isToken:!1,value:b}});s.localize.preprocessor&&(c=s.localize.preprocessor(l,c));const u={firstWeekContainsDate:a,weekStartsOn:o,locale:s};return c.map(b=>{if(!b.isToken)return b.value;const g=b.value;(WM(g)||BM(g))&&HM(g,t,String(e));const v=ry[g[0]];return v(l,g,s.localize,u)}).join("")}function ZM(e){const t=e.match(KM);return t?t[1].replace(QM,"'"):e}function XM(e,t,r){const n=bl(),s=(r==null?void 0:r.locale)??n.locale??Bj,a=2520,o=Ec(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=Re(t),u=Re(e)):(c=Re(e),u=Re(t));const d=eM(u,c),h=(ku(u)-ku(c))/1e3,m=Math.round((d-h)/60);let f;if(m<2)return r!=null&&r.includeSeconds?d<5?s.formatDistance("lessThanXSeconds",5,l):d<10?s.formatDistance("lessThanXSeconds",10,l):d<20?s.formatDistance("lessThanXSeconds",20,l):d<40?s.formatDistance("halfAMinute",0,l):d<60?s.formatDistance("lessThanXMinutes",1,l):s.formatDistance("xMinutes",1,l):m===0?s.formatDistance("lessThanXMinutes",1,l):s.formatDistance("xMinutes",m,l);if(m<45)return s.formatDistance("xMinutes",m,l);if(m<90)return s.formatDistance("aboutXHours",1,l);if(m<ey){const b=Math.round(m/60);return s.formatDistance("aboutXHours",b,l)}else{if(m<a)return s.formatDistance("xDays",1,l);if(m<ic){const b=Math.round(m/ey);return s.formatDistance("xDays",b,l)}else if(m<ic*2)return f=Math.round(m/ic),s.formatDistance("aboutXMonths",f,l)}if(f=XI(u,c),f<12){const b=Math.round(m/ic);return s.formatDistance("xMonths",b,l)}else{const b=f%12,g=Math.trunc(f/12);return b<3?s.formatDistance("aboutXYears",g,l):b<9?s.formatDistance("overXYears",g,l):s.formatDistance("almostXYears",g+1,l)}}function eD(e,t){return XM(e,WI(e),t)}function tD(e){return+Re(e)<Date.now()}const rD=({subtopics:e,strands:t,topicProgress:r,getSubtopics:n,userId:s})=>{const{user:a}=st(),o=s||(a==null?void 0:a.id),[l,c]=p.useState([]),[u,d]=p.useState(null);p.useEffect(()=>{(async()=>{if(!o)return;const{data:x}=await F.from("quiz_attempts").select("id, topic_id, score, total_questions, created_at, completed_at").eq("user_id",o).order("created_at",{ascending:!1});x&&c(x)})()},[o]);const h=p.useMemo(()=>{const v=e.length,x=r.filter(_=>_.mastery_level==="confident").length,y=r.filter(_=>_.mastery_level==="practising").length,w=v-x-y;return{total:v,confident:x,practising:y,notStarted:w,percentage:v>0?Math.round(x/v*100):0}},[e,r]),m=p.useMemo(()=>r.filter(v=>v.mastery_level==="confident").map(v=>{const x=e.find(y=>y.id===v.topic_id);return x?{...x,progress:v}:null}).filter(Boolean),[r,e]),f=p.useMemo(()=>r.filter(x=>x.mastery_level==="practising"&&x.total_attempts>0).sort((x,y)=>{const w=x.total_attempts>0?x.correct_count/x.total_attempts:0,_=y.total_attempts>0?y.correct_count/y.total_attempts:0;return w-_}).slice(0,5).map(x=>{const y=e.find(w=>w.id===x.topic_id);return y?{...y,progress:x}:null}).filter(Boolean),[r,e]),b=v=>l.filter(x=>x.topic_id===v),g=v=>{const x={not_started:"bg-muted text-muted-foreground",practising:"bg-warning/10 text-warning border-warning/20",confident:"bg-success/10 text-success border-success/20"};return i.jsx("span",{className:`text-xs px-2 py-0.5 rounded-full font-medium ${x[v]}`,children:od[v]})};return i.jsxs("section",{className:"mb-8",children:[i.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[i.jsx(ma,{className:"w-5 h-5 text-primary"}),i.jsx("h2",{className:"text-lg font-bold text-foreground",children:"Topic Analytics"})]}),i.jsx(z,{className:"mb-4",children:i.jsxs(B,{className:"p-4",children:[i.jsxs("div",{className:"flex items-center justify-between mb-3",children:[i.jsx("h3",{className:"font-bold text-foreground text-sm",children:"Overall Completion"}),i.jsxs("span",{className:"text-2xl font-extrabold text-primary",children:[h.percentage,"%"]})]}),i.jsx(sn,{value:h.percentage,className:"h-3 mb-3"}),i.jsxs("div",{className:"grid grid-cols-3 gap-2 text-center",children:[i.jsxs("div",{className:"rounded-lg bg-success/10 p-2",children:[i.jsx("p",{className:"text-lg font-bold text-success",children:h.confident}),i.jsx("p",{className:"text-xs text-muted-foreground",children:"Confident"})]}),i.jsxs("div",{className:"rounded-lg bg-warning/10 p-2",children:[i.jsx("p",{className:"text-lg font-bold text-warning",children:h.practising}),i.jsx("p",{className:"text-xs text-muted-foreground",children:"Practising"})]}),i.jsxs("div",{className:"rounded-lg bg-muted p-2",children:[i.jsx("p",{className:"text-lg font-bold text-muted-foreground",children:h.notStarted}),i.jsx("p",{className:"text-xs text-muted-foreground",children:"Not Started"})]})]})]})}),i.jsxs(wl,{defaultValue:"strengths",className:"mb-4",children:[i.jsxs(qi,{className:"w-full",children:[i.jsxs(it,{value:"strengths",className:"flex-1 text-xs",children:[i.jsx(hb,{className:"w-3 h-3 mr-1"}),"Strengths"]}),i.jsxs(it,{value:"improve",className:"flex-1 text-xs",children:[i.jsx(ru,{className:"w-3 h-3 mr-1"}),"Needs Work"]}),i.jsxs(it,{value:"detail",className:"flex-1 text-xs",children:[i.jsx(bn,{className:"w-3 h-3 mr-1"}),"All Topics"]})]}),i.jsx(rr,{value:"strengths",children:m.length>0?i.jsx("div",{className:"space-y-2",children:m.map(v=>i.jsx(z,{className:"border-success/20",children:i.jsxs(B,{className:"p-3 flex items-center gap-3",children:[i.jsx(lr,{className:"w-5 h-5 text-success shrink-0"}),i.jsxs("div",{className:"flex-1 min-w-0",children:[i.jsx("p",{className:"font-semibold text-sm text-foreground truncate",children:v.name}),i.jsxs("p",{className:"text-xs text-muted-foreground",children:[v.progress.correct_count,"/",v.progress.total_attempts," correct",v.progress.last_practiced_at&&i.jsxs(i.Fragment,{children:[" · Last: ",Su(new Date(v.progress.last_practiced_at),"dd MMM")]})]})]}),i.jsx(rn,{className:"w-4 h-4 text-success shrink-0"})]})},v.id))}):i.jsx(z,{children:i.jsx(B,{className:"p-4 text-center text-muted-foreground text-sm",children:"Keep practising to build your strengths! ðª"})})}),i.jsx(rr,{value:"improve",children:f.length>0?i.jsx("div",{className:"space-y-2",children:f.map(v=>{const x=v.progress.total_attempts>0?Math.round(v.progress.correct_count/v.progress.total_attempts*100):0;return i.jsx(z,{className:"border-warning/20",children:i.jsxs(B,{className:"p-3 flex items-center gap-3",children:[i.jsx(ru,{className:"w-5 h-5 text-warning shrink-0"}),i.jsxs("div",{className:"flex-1 min-w-0",children:[i.jsx("p",{className:"font-semibold text-sm text-foreground truncate",children:v.name}),i.jsxs("p",{className:"text-xs text-muted-foreground",children:[x,"% accuracy · ",v.progress.total_attempts," attempts"]})]}),i.jsx(hC,{className:"w-4 h-4 text-warning shrink-0"})]})},v.id)})}):i.jsx(z,{children:i.jsx(B,{className:"p-4 text-center text-muted-foreground text-sm",children:"No weak areas foun
549d yet â start some quizzes! ð"})})}),i.jsx(rr,{value:"detail",children:i.jsx("div",{className:"space-y-3",children:t.map(v=>{const x=n(v.id);return i.jsxs(z,{children:[i.jsx(ad,{className:"p-3 pb-0",children:i.jsx(id,{className:"text-sm",children:v.name})}),i.jsx(B,{className:"p-3 pt-2",children:i.jsx("div",{className:"space-y-1",children:x.map(y=>{const w=r.find(S=>S.topic_id===y.id),_=(w==null?void 0:w.mastery_level)||"not_started",j=b(y.id),k=u===y.id;return i.jsxs("div",{children:[i.jsxs("button",{onClick:()=>d(k?null:y.id),className:"w-full flex items-center gap-2 p-2 rounded-lg hover:bg-muted/50 transition-colors text-left",children:[i.jsx("div",{className:"flex-1 min-w-0",children:i.jsx("p",{className:"font-medium text-sm text-foreground truncate",children:y.name})}),g(_),w&&i.jsxs("span",{className:"text-xs text-muted-foreground whitespace-nowrap",children:[w.total_attempts," tries"]}),k?i.jsx(Gr,{className:"w-3 h-3 text-muted-foreground shrink-0"}):i.jsx(Cr,{className:"w-3 h-3 text-muted-foreground shrink-0"})]}),k&&i.jsxs("div",{className:"ml-2 mb-2 rounded-lg bg-muted/30 p-2",children:[w&&i.jsxs("div",{className:"grid grid-cols-3 gap-2 mb-2 text-center",children:[i.jsxs("div",{children:[i.jsx("p",{className:"text-lg font-bold text-foreground",children:w.total_attempts}),i.jsx("p",{className:"text-xs text-muted-foreground",children:"Attempts"})]}),i.jsxs("div",{children:[i.jsx("p",{className:"text-lg font-bold text-foreground",children:w.correct_count}),i.jsx("p",{className:"text-xs text-muted-foreground",children:"Correct"})]}),i.jsxs("div",{children:[i.jsxs("p",{className:"text-lg font-bold text-foreground",children:[w.total_attempts>0?Math.round(w.correct_count/w.total_attempts*100):0,"%"]}),i.jsx("p",{className:"text-xs text-muted-foreground",children:"Accuracy"})]})]}),j.length>0?i.jsx("div",{className:"overflow-x-auto",children:i.jsxs($j,{children:[i.jsx(Fj,{children:i.jsxs(om,{children:[i.jsx(Nc,{className:"text-xs h-8",children:"Date"}),i.jsx(Nc,{className:"text-xs h-8",children:"Score"}),i.jsx(Nc,{className:"text-xs h-8",children:"Result"})]})}),i.jsx(Uj,{children:j.slice(0,10).map(S=>{const C=Math.round(S.score/S.total_questions*100);return i.jsxs(om,{children:[i.jsx(Cc,{className:"text-xs py-1.5",children:i.jsxs("div",{className:"flex items-center gap-1",children:[i.jsx(wn,{className:"w-3 h-3 text-muted-foreground"}),Su(new Date(S.created_at),"dd MMM yy, HH:mm")]})}),i.jsxs(Cc,{className:"text-xs py-1.5 font-medium",children:[S.score,"/",S.total_questions]}),i.jsx(Cc,{className:"text-xs py-1.5",children:i.jsxs("span",{className:`inline-flex items-center gap-1 ${C>=80?"text-success":C>=50?"text-warning":"text-destructive"}`,children:[C>=80?i.jsx(lr,{className:"w-3 h-3"}):i.jsx(qo,{className:"w-3 h-3"}),C,"%"]})})]},S.id)})})]})}):i.jsx("p",{className:"text-xs text-muted-foreground text-center py-2",children:"No attempts yet"})]})]},y.id)})})})]},v.id)})})})]})]})},nD=({topicProgress:e,subtopics:t,strands:r,quizStats:n,getSubtopics:s})=>i.jsxs("div",{className:"space-y-6",children:[i.jsxs("section",{children:[i.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[i.jsx(rn,{className:"w-5 h-5 text-primary"}),i.jsx("h2",{className:"text-lg font-bold text-foreground",children:"Your Progress"})]}),i.jsx("p",{className:"text-xs text-muted-foreground mb-4",children:"Track your growth and see how far you've come"})]}),i.jsx(LI,{topicProgress:e,totalTopics:t.length,quizzesTaken:n.quizzesTaken,questionsSolved:n.questionsSolved}),i.jsx(rD,{subtopics:t,strands:r,topicProgress:e,getSubtopics:s})]}),no=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],sD=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],aD=({suggestedTopics:e=[]})=>{const{user:t}=st(),[r,n]=p.useState([]),[s,a]=p.useState(()=>{const N=new Date().getDay();return N===0?6:N-1}),[o,l]=p.useState(!1),[c,u]=p.useState(null),[d,h]=p.useState({subject:"",start_time:"16:00",end_time:"17:00"}),[m,f]=p.useState(null),[b,g]=p.useState(null),[v,x]=p.useState(!1),y=p.useCallback(async()=>{if(!t)return;const{data:N}=await F.from("study_timetable").select("*").eq("user_id",t.id).order("order_index",{ascending:!0});N&&n(N)},[t]);p.useEffect(()=>{y()},[y]);const w=r.filter(N=>N.day_of_week===s).sort((N,D)=>N.order_index-D.order_index),_=async()=>
549{if(!t||!d.subject.trim())return;const N=w.reduce((E,A)=>Math.max(E,A.order_index),-1),{error:D}=await F.from("study_timetable").insert({user_id:t.id,day_of_week:s,subject:d.subject.trim(),start_time:d.start_time,end_time:d.end_time,order_index:N+1});D?Ke.error("Failed to add session"):(Ke.success("Session added!"),h({subject:"",start_time:"16:00",end_time:"17:00"}),l(!1),y())},j=async(N,D)=>{if(!t)return;const E=w.reduce((Y,te)=>Math.max(Y,te.order_index),-1),{error:A}=await F.from("study_timetable").insert({user_id:t.id,day_of_week:s,subject:N,topic_id:D,start_time:"16:00",end_time:"17:00",order_index:E+1});A?Ke.error("Failed to add session"):(Ke.success(`Added "${N}" to ${no[s]}!`),y())},k=async()=>{if(!c||!d.subject.trim())return;const{error:N}=await F.from("study_timetable").update({subject:d.subject.trim(),start_time:d.start_time,end_time:d.end_time}).eq("id",c.id);N||(Ke.success("Updated!"),u(null),y())},S=async N=>{await F.from("study_timetable").delete().eq("id",N),Ke.success("Removed"),y()},C=N=>f(N),P=(N,D)=>{N.preventDefault(),g(D)},T=async N=>{if(!m||m===N){f(null),g(null);return}const D=[...w],E=D.findIndex(W=>W.id===m),A=D.findIndex(W=>W.id===N);if(E===-1||A===-1)return;const[Y]=D.splice(E,1);D.splice(A,0,Y);const te=D.map((W,se)=>({id:W.id,order_index:se}));n(W=>{const se=[...W];return te.forEach(I=>{const re=se.find(xe=>xe.id===I.id);re&&(re.order_index=I.order_index)}),se});for(const W of te)await F.from("study_timetable").update({order_index:W.order_index}).eq("id",W.id);f(null),g(null)},$=N=>{N.preventDefault(),x(!0)},O=async N=>{N.preventDefault(),x(!1);const D=N.dataTransfer.getData("text/topic");if(D)try{const{name:E,id:A}=JSON.parse(D);await j(E,A)}catch{}},M=N=>{u(N),h({subject:N.subject,start_time:N.start_time,end_time:N.end_time})},R=no.map((N,D)=>r.filter(E=>E.day_of_week===D).length),U=({onSubmit:N,submitLabel:D})=>i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{children:[i.jsx("label",{className:"text-sm font-medium text-foreground mb-1 block",children:"What will you study?"}),i.jsx(et,{value:d.subject,onChange:E=>h(A=>({...A,subject:E.target.value})),placeholder:"e.g. Algebra â Quadratics"})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[i.jsxs("div",{children:[i.jsx("label",{className:"text-sm font-medium text-foreground mb-1 block",children:"Start Time"}),i.jsx(et,{type:"time",value:d.start_time,onChange:E=>h(A=>({...A,start_time:E.target.value}))})]}),i.jsxs("div",{children:[i.jsx("label",{className:"text-sm font-medium text-foreground mb-1 block",children:"End Time"}),i.jsx(et,{type:"time",value:d.end_time,onChange:E=>h(A=>({...A,end_time:E.target.value}))})]})]}),i.jsxs(ne,{onClick:N,className:"w-full",disabled:!d.subject.trim(),children:[i.jsx(iC,{className:"w-4 h-4 mr-2"}),D]})]});return i.jsxs("div",{className:"space-y-4",children:[i.jsx("div",{className:"flex gap-1.5 overflow-x-auto pb-1 -mx-1 px-1",children:no.map((N,D)=>{const E=D===(new Date().getDay()===0?6:new Date().getDay()-1),A=R[D];return i.jsxs("button",{onClick:()=>a(D),className:`flex flex-col items-center min-w-[52px] py-2 px-2 rounded-xl text-xs font-bold transition-all ${s===D?"gradient-primary text-primary-foreground shadow-soft":E?"bg-primary/10 text-primary border border-primary/20":"bg-muted text-muted-foreground hover:bg-secondary"}`,children:[i.jsx("span",{className:"text-[10px] font-semibold",children:sD[D]}),A>0&&i.jsx("span",{className:`mt-0.5 w-1.5 h-1.5 rounded-full ${s===D?"bg-primary-foreground":"bg-primary"}`})]},N)})}),i.jsx("div",{className:`space-y-2 min-h-[60px] rounded-xl transition-colors ${v?"bg-primary/5 ring-2 ring-primary/20 ring-dashed p-2":""}`,onDragOver:$,onDragLeave:()=>x(!1),onDrop:O,children:w.length>0?w.map(N=>i.jsx(z,{draggable:!0,onDragStart:()=>C(N.id),onDragOver:D=>P(D,N.id),onDrop:()=>T(N.id),onDragEnd:()=>{f(null),g(null)},className:`transition-all cursor-grab active:cursor-grabbing shadow-card ${b===N.id&&m!==N.id?"border-primary border-2":""} ${m===N.id?"opacity-50":""}`,children:i.jsxs(B,{className:"p-3 flex items-center gap-2",children:[i.jsx(Q2,{className:"w-4 h-4 text-muted-foreground shrink-0"}),i.jsx("div",{className:"w-8 h-8 rounded-lg bg-primary/10 flex items-center justify-center shrink-0",children:i.jsx(sr,{className:"w-4 h-4 text-primary"})}),i.jsxs("div",{className:"flex-1 min-w-0",children:[i.jsx("p",{className:"font-bold text-sm text-foreground truncate",children:N.subject}),i.jsxs("div",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[i.jsx(wn,{className:"w-3 h-3"}),N.start_time," â ",N.end_time]})]}),i.jsx("button",{onClick:()=>M(N),className:"p-1.5 hover:bg-muted rounded-lg",children:i.jsx(tC,{className:"w-3.5 h-3.5 text-muted-foreground"})}),i.jsx("button",{onClick:()=>
549S(N.id),className:"p-1.5 hover:bg-destructive/10 rounded-lg",children:i.jsx(_b,{className:"w-3.5 h-3.5 text-destructive"})})]})},N.id)):i.jsx(z,{className:"border-dashed",children:i.jsxs(B,{className:"p-6 text-center",children:[i.jsx(bf,{className:"w-8 h-8 text-muted-foreground mx-auto mb-2"}),i.jsxs("p",{className:"text-sm text-muted-foreground",children:["No sessions for ",no[s]]}),i.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Add a session or drag a suggested topic below"})]})})}),i.jsxs(Sn,{open:o,onOpenChange:l,children:[i.jsx(_u,{asChild:!0,children:i.jsxs(ne,{variant:"outline",className:"w-full border-dashed",onClick:()=>h({subject:"",start_time:"16:00",end_time:"17:00"}),children:[i.jsx(aa,{className:"w-4 h-4 mr-2"})," Add Study Session"]})}),i.jsxs(Jr,{children:[i.jsx(Zr,{children:i.jsxs(Xr,{children:["Add Session â ",no[s]]})}),i.jsx(U,{onSubmit:_,submitLabel:"Add Session"})]})]}),e.length>0&&i.jsxs("div",{className:"mt-4",children:[i.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[i.jsx(_i,{className:"w-4 h-4 text-warning"}),i.jsx("h3",{className:"text-sm font-bold text-foreground",children:"Suggested Topics"})]}),i.jsx("p",{className:"text-xs text-muted-foreground mb-3",children:"Drag a topic into your timetable or tap to add it"}),i.jsx("div",{className:"flex flex-wrap gap-2",children:e.map(({topic:N,priority:D,accuracy:E})=>i.jsxs("div",{draggable:!0,onDragStart:A=>{A.dataTransfer.setData("text/topic",JSON.stringify({name:N.name,id:N.id}))},onClick:()=>j(N.name,N.id),className:`flex items-center gap-1.5 px-3 py-2 rounded-xl text-xs font-semibold cursor-grab active:cursor-grabbing transition-all hover:scale-105 ${D>=3?"bg-destructive/10 text-destructive border border-destructive/20":D>=2?"bg-warning/10 text-warning border border-warning/20":"bg-muted text-muted-foreground border border-border"}`,children:[D>=3&&i.jsx(ru,{className:"w-3 h-3"}),i.jsx("span",{className:"truncate max-w-[140px]",children:N.name}),E>0&&i.jsxs("span",{className:"opacity-60",children:[Math.round(E*100),"%"]})]},N.id))})]}),i.jsx(Sn,{open:!!c,onOpenChange:N=>!N&&u(null),children:i.jsxs(Jr,{children:[i.jsx(Zr,{children:i.jsx(Xr,{children:"Edit Session"})}),i.jsx(U,{onSubmit:k,submitLabel:"Save Changes"})]})})]})},iD=({topicProgress:e,subtopics:t})=>{const r=t.map(n=>{const s=e.find(o=>o.topic_id===n.id);if(!s)return{topic:n,priority:2,accuracy:0};if(s.mastery_level==="confident")return null;const a=s.total_attempts>0?s.correct_count/s.total_attempts:0;return{topic:n,priority:a<.5?3:1,accuracy:a}}).filter(Boolean).sort((n,s)=>s.priority-n.priority).slice(0,8);return i.jsxs("div",{className:"space-y-6",children:[i.jsxs("section",{children:[i.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[i.jsx(op,{className:"w-5 h-5 text-primary"}),i.jsx("h2",{className:"text-lg font-bold text-foreground",children:"Study Planner"})]}),i.jsx("p",{className:"text-xs text-muted-foreground mb-4",children:"Organise your week and build consistent study habits"})]}),i.jsx(aD,{suggestedTopics:r})]})},Nu=[{emoji:"ð°",label:"Anxious",value:"anxious",color:"bg-destructive/10 text-destructive border-destructive/20"},{emoji:"ð",label:"Worried",value:"worried",color:"bg-warning/10 text-warning border-warning/20"},{emoji:"ð",label:"Okay",value:"okay",color:"bg-muted text-muted-foreground border-border"},{emoji:"ð",label:"Good",value:"good",color:"bg-primary/10 text-primary border-primary/20"},{emoji:"ð",label:"Confident",value:"confident",color:"bg-success/10 text-success border-success/20"}],wh=["I am capable of understanding maths â it just takes practice.","Mistakes help me learn. Every wrong answer brings me closer to the right one.","I don't need to be perfect. Progress is what matters.","My brain grows stronger every time I challenge myself.","I belong in maths class, and my ideas are valuable.","It's okay to ask for help â that's a sign of strength.","I can break hard problems into smaller, manageable steps.","I've overcome challenges before, and I can do it again.","Maths isn't about speed â it's about understanding.","I am more than a grade. My effort counts.","Every mathematician started exactly where I am now.","I choose to believe in myself, even when it's hard.","Struggling doesn't mean failing â it means growing.","I have the power to improve with each practice session.","Today I will try my best, and that is enough.","Confidence comes from practice, not from being perfect.","I am building skills that will help me for life.","I can do hard things. I've proven that before.","My pace is my own â I don't need to compare.","I trust myself to work through tricky problems."],oc={whatIsIt:{title:"What is Maths Anxiety?",description:"Maths anxiety is a feeling of tension, worry, or fear that interferes with your ability to do maths. It's incredibly common â research shows that up to 30% of students experience it. It's NOT a sign that you're bad at maths. It's a stress response that can be managed and overcome."},signs:[{icon:"ð«£",title:"Blanking out",description:"Forgetting things you knew before when under pressure"},{icon:"ð",title:"Physical symptoms",description:"Racing heart, sweaty palms, feeling sick before a test"},{icon:"ð",title:"Avoidance",description:"Putting off revision or skipping maths homework"},{icon:"ð¤",title:"Negative self-talk",description:`Telling yourself "I'm just not a maths person"`},{icon:"ð°",title:"Panic in exams",description:"Feeling overwhelmed when you see a question you don't recognise"},{icon:"ð´",title:"Procrastination",description:"Always finding something else to do instead of maths revision"}],copingStrategies:[{icon:"ð§",title:"Box Breathing",description:"Breathe in for 4 counts, hold for 4, out for 4, hold for 4. Repeat 3 times before starting.",tip:"Try this before opening your exam paper"}
549,{icon:"âï¸",title:"Break It Down",description:"If a question looks scary, cover everything except the first line. Solve one step at a time.",tip:"Write down what you DO know first"},{icon:"ð¬",title:"Reframe Your Thoughts",description:`Replace "I can't do this" with "I can't do this YET." Adding 'yet' changes everything.`,tip:"Write positive statements on sticky notes near your desk"},{icon:"ð¯",title:"Start With What You Know",description:"In exams, do the questions you're confident about first. This builds momentum and confidence.",tip:"Scan through the paper quickly before starting"},{icon:"â°",title:"Little and Often",description:"10 minutes of daily practice is better than 2 hours the night before. Your brain needs time to process.",tip:"Set a daily alarm for your 10-minute maths slot"},{icon:"ð¤",title:"Talk About It",description:"Tell someone you trust how you feel. Teachers, parents, and friends can help more than you think.",tip:"You'd be surprised how many of your classmates feel the same way"}]},oD=[{category:"Before the Exam",icon:"ð",tips:[{title:"Create a revision timetable",description:"Plan your topics across weeks, not days. Focus more time on weaker areas."},{title:"Use past papers",description:"Practice under timed conditions. Mark your own work to understand marking schemes."},{title:"Teach someone else",description:"If you can explain a topic to a friend, you truly understand it."},{title:"Get enough sleep",description:"Your brain consolidates learning during sleep. Don't sacrifice rest for revision."},{title:"Prepare your kit",description:"Calculator, ruler, protractor, compass, pens, pencils â get them ready the night before."}]},{category:"During the Exam",icon:"âï¸",tips:[{title:"Read questions twice",description:"Underline key words. Make sure you know what the question is actually asking."},{title:"Show all your working",description:"You get marks for method, even if your final answer is wrong."},{title:"Check units and rounding",description:"Many marks are lost by giving answers in the wrong units or to the wrong decimal places."},{title:"Don't get stuck",description:"If a question is taking too long, move on and come back to it later."},{title:"Use spare time wisely",description:"Go back and check your answers. Substitute values back in to verify."}]},{category:"Tackling Hard Questions",icon:"ð§©",tips:[{title:"Draw a diagram",description:"Visualising the problem often reveals the approach. Sketch it out."},{title:"Write down formulae",description:"Even if you're not sure how to use them, writing relevant formulae can trigger your memory."},{title:"Look for key words",description:'"Hence" means use your previous answer. "Show that" means prove it step by step.'},{title:"Estimate first",description:"Before calculating, estimate what a sensible answer would be. This helps you spot errors."},{title:"Work backwards",description:"Sometimes starting from the answer and working backwards reveals the method."}]}],lD=()=>{const{user:e}=st(),[t,r]=p.useState(null),[n,s]=p.useState([]),[a,o]=p.useState(!1),l=new Date().toISOString().split("T")[0];p.useEffect(()=>{const h=localStorage.getItem("mathly-mood-history");if(h){const m=JSON.parse(h);s(m);const f=m.find(b=>b.date===l);f&&(r(f.mood),o(!0))}e&&(async()=>{const f=new Date;f.setDate(f.getDate()-30);const{data:b}=await F.from("mood_logs").select("mood, logged_date").eq("user_id",e.id).gte("logged_date",f.toISOString().split("T")[0]).order("logged_date",{ascending:!1});if(b&&b.length>0){const g=b.map(x=>({date:x.logged_date,mood:x.mood}));s(g);const v=g.find(x=>x.date===l);v&&(r(v.mood),o(!0))}})()},[l,e]);const c=async h=>{r(h),o(!0);const m=n.filter(b=>b.date!==l);m.push({date:l,mood:h});const f=m.slice(-30);s(f),localStorage.setItem("mathly-mood-history",JSON.stringify(f)),e&&await F.from("mood_logs").upsert({user_id:e.id,mood:h,logged_date:l},{onConflict:"user_id,logged_date"})},u=Array.from({length:7},(h,m)=>{const f=new Date;f.setDate(f.getDate()-(6-m));const b=f.toISOString().split("T")[0],g=n.find(x=>x.date===b),v=f.toLocaleDateString("en-GB",{weekday:"short"});return{date:b,mood:(g==null?void 0:g.mood)||null,dayLabel:v}}),d=h=>{var m;return h&&((m=Nu.find(f=>f.value===h))==null?void 0:m.emoji)||"·"};return i.jsx(z,{className:"shadow-card",children:i.jsxs(B,{className:"p-4",children:[i.jsx("h3",{className:"font-bold text-foreground mb-3",children:"How are you feeling about maths today?"}),i.jsx("div",{className:"flex gap-2 justify-between mb-4",children:Nu.map(h=>i.jsxs("button",{onClick:()=>
549c(h.value),className:`flex flex-col items-center gap-1 p-2 rounded-xl border-2 transition-all flex-1 ${t===h.value?h.color+" border-current scale-105":"border-transparent hover:bg-muted"}`,children:[i.jsx("span",{className:"text-2xl",children:h.emoji}),i.jsx("span",{className:"text-xs font-medium",children:h.label})]},h.value))}),a&&i.jsx("div",{className:"bg-primary/5 rounded-lg p-3 mb-3",children:i.jsxs("p",{className:"text-sm text-primary font-medium text-center",children:[t==="anxious"&&"It's okay to feel anxious. Scroll down for tips that can help ð",t==="worried"&&"A little worry is normal. You're here practising â that's brilliant! ðª",t==="okay"&&"Steady and consistent wins the race. Keep going! ð",t==="good"&&"Love that energy! Let's make the most of it today! ð",t==="confident"&&"You're feeling great â channel that into your practice! â"]})}),i.jsxs("div",{className:"flex items-center justify-between bg-muted/50 rounded-lg p-3",children:[i.jsx("span",{className:"text-xs font-semibold text-muted-foreground",children:"This week:"}),i.jsx("div",{className:"flex gap-2",children:u.map(h=>i.jsxs("div",{className:"flex flex-col items-center gap-1",children:[i.jsx("span",{className:"text-lg leading-none",children:d(h.mood)}),i.jsx("span",{className:`text-[10px] font-medium ${h.date===l?"text-primary font-bold":"text-muted-foreground"}`,children:h.dayLabel})]},h.date))})]})]})})},cD=()=>{var u;const[e,t]=p.useState([]),r=new Date().toISOString().split("T")[0];p.useEffect(()=>{const d=localStorage.getItem("mathly-habit-tracker");d&&t(JSON.parse(d))},[]);const n=()=>{const d=e.find(m=>m.date===r);let h;d?h=e.map(m=>m.date===r?{...m,completed:!m.completed}:m):h=[...e,{date:r,completed:!0}],h=h.slice(-60),t(h),localStorage.setItem("mathly-habit-tracker",JSON.stringify(h))},s=Array.from({length:4},(d,h)=>Array.from({length:7},(m,f)=>{const b=new Date;b.setDate(b.getDate()-(27-(h*7+f)));const g=b.toISOString().split("T")[0],v=e.find(x=>x.date===g);return{date:g,completed:(v==null?void 0:v.completed)||!1,isToday:g===r,isFuture:b>new Date}})),a=((u=e.find(d=>d.date===r))==null?void 0:u.completed)||!1;let o=0;const l=e.filter(d=>d.completed).map(d=>d.date).sort().reverse();if(l.length>0){const d=new Date;a||d.setDate(d.getDate()-1);for(let h=0;h<60;h++){const m=d.toISOString().split("T")[0];if(l.includes(m))o++,d.setDate(d.getDate()-1);else break}}const c=["M","T","W","T","F","S","S"];return i.jsx(z,{className:"shadow-card",children:i.jsxs(B,{className:"p-4",children:[i.jsxs("div",{className:"flex items-center justify-between mb-3",children:[i.jsx("h3",{className:"font-bold text-foreground",children:"Daily Revision Tracker"}),o>0&&i.jsxs("div",{className:"flex items-center gap-1 px-2 py-1 rounded-full bg-streak/10 text-streak",children:[i.jsx(lp,{className:"w-3.5 h-3.5"}),i.jsxs("span",{className:"text-xs font-bold",children:[o," day streak"]})]})]}),i.jsx("button",{onClick:n,className:`w-full mb-4 p-3 rounded-xl border-2 transition-all flex items-center justify-center gap-2 font-semibold text-sm ${a?"bg-success/10 border-success text-success":"border-dashed border-muted-foreground/30 text-muted-foreground hover:border-primary hover:text-primary"}`,children:a?i.jsxs(i.Fragment,{children:[i.jsx(pl,{className:"w-4 h-4"}),"Done for today! Tap to undo"]}):i.jsx(i.Fragment,{children:"â
I revised maths today!"})}),i.jsxs("div",{className:"space-y-1",children:[i.jsxs("div",{className:"flex gap-1 mb-1",children:[i.jsx("div",{className:"w-8"}),c.map((d,h)=>i.jsx("div",{className:"flex-1 text-center text-[10px] font-semibold text-muted-foreground",children:d},h))]}),s.map((d,h)=>i.jsxs("div",{className:"flex gap-1 items-center",children:[i.jsx("div",{className:"w-8 text-[10px] text-muted-foreground font-medium",children:h===0?"4w":h===1?"3w":h===2?"2w":"Now"}),d.map(m=>i.jsx("div",{className:`flex-1 aspect-square rounded-md transition-all ${m.isFuture?"bg-transparent":m.completed?"bg-success":m.isToday?"bg-primary/20 border-2 border-primary border-dashed":"bg-muted"}`,title:m.date},m.date))]},h))]}),i.jsx("p",{className:"text-xs text-muted-foreground text-center mt-3",children:"Build your streak â log in daily and mark your revision â¨"})]})})},uD=()=>{const[e,t]=p.useState(0),[r,n]=p.useState(!1);p.useEffect(()=>{const a=Math.floor((Date.now()-new Date(new Date().getFullYear(),0,0).getTime())/864e5);t(a%wh.length)},[]);const s=()=>{n(!0),setTimeout(()=>{t(a=>(a+1)%wh.length),n(!1)},200)};return i.jsx(z,{className:"shadow-card overflow-hidden",children:i.jsxs("div",{className:"gradient-primary p-4",children:[i.jsxs("div",{className:"flex items-start justify-between gap-2",children:[i.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[i.jsx(Ar,{className:"w-5 h-5 text-primary-foreground"}),i.jsx("h3",{className:"font-bold text-primary-foreground text-sm",children:"Today's Affirmation"})]}),i.jsx("button",{onClick:s,className:"p-1.5 rounded-full bg-primary-foreground
549/20 hover:bg-primary-foreground/30 transition-colors","aria-label":"Next affirmation",children:i.jsx(aC,{className:"w-3.5 h-3.5 text-primary-foreground"})})]}),i.jsxs("p",{className:`text-primary-foreground font-semibold text-lg leading-snug transition-opacity duration-200 ${r?"opacity-0":"opacity-100"}`,children:['"',wh[e],'"']})]})})},dD=()=>{const[e,t]=p.useState(null),r=n=>{t(s=>s===n?null:n)};return i.jsxs("div",{className:"space-y-3",children:[i.jsxs(z,{className:"shadow-card overflow-hidden",children:[i.jsxs("button",{onClick:()=>r("what"),className:"w-full p-4 flex items-center gap-3 text-left",children:[i.jsx("div",{className:"w-10 h-10 rounded-xl bg-primary/10 flex items-center justify-center shrink-0",children:i.jsx(Cn,{className:"w-5 h-5 text-primary"})}),i.jsxs("div",{className:"flex-1 min-w-0",children:[i.jsx("h3",{className:"font-bold text-foreground text-sm",children:oc.whatIsIt.title}),i.jsx("p",{className:"text-xs text-muted-foreground truncate",children:"Understand what it is and why it happens"})]}),e==="what"?i.jsx(Gr,{className:"w-4 h-4 text-muted-foreground shrink-0"}):i.jsx(Cr,{className:"w-4 h-4 text-muted-foreground shrink-0"})]}),e==="what"&&i.jsx(B,{className:"pt-0 pb-4 px-4",children:i.jsx("div",{className:"bg-primary/5 rounded-xl p-4",children:i.jsx("p",{className:"text-sm text-foreground leading-relaxed",children:oc.whatIsIt.description})})})]}),i.jsxs(z,{className:"shadow-card overflow-hidden",children:[i.jsxs("button",{onClick:()=>r("signs"),className:"w-full p-4 flex items-center gap-3 text-left",children:[i.jsx("div",{className:"w-10 h-10 rounded-xl bg-warning/10 flex items-center justify-center shrink-0",children:i.jsx(ru,{className:"w-5 h-5 text-warning"})}),i.jsxs("div",{className:"flex-1 min-w-0",children:[i.jsx("h3",{className:"font-bold text-foreground text-sm",children:"Common Signs"}),i.jsx("p",{className:"text-xs text-muted-foreground truncate",children:"Recognise if this affects you"})]}),e==="signs"?i.jsx(Gr,{className:"w-4 h-4 text-muted-foreground shrink-0"}):i.jsx(Cr,{className:"w-4 h-4 text-muted-foreground shrink-0"})]}),e==="signs"&&i.jsx(B,{className:"pt-0 pb-4 px-4",children:i.jsx("div",{className:"grid gap-2",children:oc.signs.map((n,s)=>i.jsxs("div",{className:"flex items-start gap-3 p-3 rounded-lg bg-muted/50",children:[i.jsx("span",{className:"text-xl leading-none mt-0.5",children:n.icon}),i.jsxs("div",{children:[i.jsx("p",{className:"font-semibold text-foreground text-sm",children:n.title}),i.jsx("p",{className:"text-xs text-muted-foreground",children:n.description})]})]},s))})})]}),i.jsxs(z,{className:"shadow-card overflow-hidden",children:[i.jsxs("button",{onClick:()=>r("coping"),className:"w-full p-4 flex items-center gap-3 text-left",children:[i.jsx("div",{className:"w-10 h-10 rounded-xl bg-success/10 flex items-center justify-center shrink-0",children:i.jsx(dp,{className:"w-5 h-5 text-success"})}),i.jsxs("div",{className:"flex-1 min-w-0",children:[i.jsx("h3",{className:"font-bold text-foreground text-sm",children:"Coping Strategies"}),i.jsx("p",{className:"text-xs text-muted-foreground truncate",children:"Practical techniques that really work"})]}),e==="coping"?i.jsx(Gr,{className:"w-4 h-4 text-muted-foreground shrink-0"}):i.jsx(Cr,{className:"w-4 h-4 text-muted-foreground shrink-0"})]}),e==="coping"&&i.jsx(B,{className:"pt-0 pb-4 px-4",children:i.jsx("div",{className:"space-y-3",children:oc.copingStrategies.map((n,s)=>i.jsxs("div",{className:"rounded-xl border border-border p-4",children:[i.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[i.jsx("span",{className:"text-xl",children:n.icon}),i.jsx("h4",{className:"font-bold text-foreground text-sm",children:n.title})]}),i.jsx("p",{className:"text-sm text-foreground mb-2",children:n.description}),i.jsx("div",{className:"bg-success/5 rounded-lg px-3 py-2",children:i.jsxs("p",{className:"text-xs text-success font-medium",children:["ð¡ Tip: ",n.tip]})})]},s))})})]})]})},hD=()=>{const[e,t]=p.useState(null),r=n=>{t(s=>s===n?null:n)};return i.jsx("div",{className:"space-y-3",children:oD.map((n,s)=>i.jsxs(z,{className:"shadow-card overflow-hidden",children:[i.jsxs("button",{onClick:()=>r(s),className:"w-full p-4 flex items-center gap-3 text-left",children:[i.jsx("div",{className:"w-10 h-10 rounded-xl bg-accent/10 flex items-center justify-center shrink-0",children:i.jsx("span",{className:"text-xl",children:n.icon})}),i.jsxs("div",{className:"flex-1 min-w-0",children:[i.jsx("h3",{className:"font-bold text-foreground text-sm",children:n.category}),i.jsxs("p",{className:"text-xs text-muted-foreground",children:[n.tips.length," tips"]})]}),e===s?i.jsx(Gr,{className:"w-4 h-4 text-muted-foreground shrink-0"}):i.jsx(Cr,{className:"w-4 h-4 text-muted-foreground shrink-0"})]}),e===s&&i.jsx(B,{className:"pt-0 pb-4 px-4",children:i.jsx("div",{className:"space-y-2",children:n.tips.map((a,o)=>i.jsxs("div",{className:"flex items-start gap-3 p-3 rounded-lg bg-muted/50",children:[i.jsx("div",{className:"w-6 h-6 rounded-full gradient-accent flex items-center justify-center shrink-0 mt-0.5",children:i.jsx("span",{className:"text-xs font-bold text-accent-foreground",children:o+1})}),i.jsxs("div",{children:[i.jsx("p",{className:"font-semibold text-foreground text-sm",children:a.title}),i.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:a.description})]})]},o))})})]},s))})},fD=[{id:"mood",label:"Wellbeing",icon:Cn},{id:"anxiety",label:"Anxiety Help",icon:B2},{id:"exams",label:"Exam Prep",icon:tn}],mD=()=>{const[e,t]=p.useState("mood");return i.jsxs("section",{className:"mb-8",children:[i.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[i.jsx(Ar,{className:"w-5 h-5 text-primary"}),i.jsx("h2",{className:"text-lg font-bold text-foreground",children:"Wellbeing & Exam Success"})]}),i.jsx("div",{className:"flex gap-2 mb-4 overflow-x-auto pb-1",children:fD.map(r=>
549{const n=r.icon,s=e===r.id;return i.jsxs("button",{onClick:()=>t(r.id),className:`flex items-center gap-1.5 px-3 py-2 rounded-xl text-sm font-semibold whitespace-nowrap transition-all ${s?"gradient-primary text-primary-foreground shadow-soft":"bg-muted text-muted-foreground hover:bg-secondary"}`,children:[i.jsx(n,{className:"w-4 h-4"}),r.label]},r.id)})}),i.jsxs("div",{className:"space-y-4",children:[e==="mood"&&i.jsxs(i.Fragment,{children:[i.jsx(uD,{}),i.jsx(lD,{}),i.jsx(cD,{})]}),e==="anxiety"&&i.jsx(dD,{}),e==="exams"&&i.jsx(hD,{})]})]})},pd=p.forwardRef(({className:e,...t},r)=>i.jsx("textarea",{className:ce("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background 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:r,...t}));pd.displayName="Textarea";const iy={message:_c,question:H2,answer:lr,hint:_i},pD={message:"bg-muted text-muted-foreground",question:"bg-warning/10 text-warning",answer:"bg-success/10 text-success",hint:"bg-primary/10 text-primary"},gD=()=>{const{user:e}=st(),[t,r]=p.useState([]),[n,s]=p.useState(null),[a,o]=p.useState([]),[l,c]=p.useState([]),[u,d]=p.useState(!1),[h,m]=p.useState(!1),[f,b]=p.useState(""),[g,v]=p.useState(""),[x,y]=p.useState(""),[w,_]=p.useState("message"),[j,k]=p.useState(""),[S,C]=p.useState(!1),P=p.useRef(null);p.useEffect(()=>{(async()=>{if(!e)return;const{data:D}=await F.from("profiles").select("display_name").eq("id",e.id).maybeSingle();D!=null&&D.display_name&&k(D.display_name)})()},[e]);const T=p.useCallback(async()=>{if(!e)return;const{data:N}=await F.from("squad_members").select("squad_id").eq("user_id",e.id);if(N&&N.length>0){const D=N.map(A=>A.squad_id),{data:E}=await F.from("study_squads").select("*").in("id",D).eq("is_active",!0);E&&r(E)}else r([])},[e]);p.useEffect(()=>{T()},[T]);const $=p.useCallback(async N=>{const[D,E]=await Promise.all([F.from("squad_members").select("*").eq("squad_id",N),F.from("squad_messages").select("*").eq("squad_id",N).order("created_at",{ascending:!0})]);D.data&&o(D.data),E.data&&c(E.data)},[]);p.useEffect(()=>{if(!n)return;$(n.id);const N=F.channel(`squad-${n.id}`).on("postgres_changes",{event:"INSERT",schema:"public",table:"squad_messages",filter:`squad_id=eq.${n.id}`},D=>{c(E=>[...E,D.new])}).subscribe();return()=>{F.removeChannel(N)}},[n,$]),p.useEffect(()=>{var N;(N=P.current)==null||N.scrollIntoView({behavior:"smooth"})},[l]);const O=async()=>{if(!e||!f.trim())return;C(!0);const{data:N,error:D}=await F.from("study_squads").insert({name:f.trim(),created_by:e.id}).select().single();N&&!D?(await F.from("squad_members").insert({squad_id:N.id,user_id:e.id,display_name:j||"Student"}),Ke.success(`Squad "${N.name}" created!`),b(""),d(!1),T()):Ke.error("Failed to create squad"),C(!1)},M=async()=>{if(!e||!g.trim())return;C(!0);const{data:N}=await F.from("study_squads").select("*").eq("join_code",g.trim().toUpperCase()).eq("is_active",!0).maybeSingle();if(!N){Ke.error("Squad not found â check the code"),C(!1);return}const{error:D}=await F.from("squad_members").insert({squad_id:N.id,user_id:e.id,display_name:j||"Student"});D?D.code==="23505"?Ke.info("You're already in this squad!"):Ke.error("Failed to join squad"):(Ke.success(`Joined "${N.name}"!`),v(""),m(!1),T()),C(!1)},R=async()=>{!e||!n||!x.trim()||(await F.from("squad_messages").insert({squad_id:n.id,user_id:e.id,display_name:j||"Student",message_type:w,content:x.trim()}),y(""),_("message"))},U=N=>{navigator.clipboard.writeText(N),Ke.success("Code copied!")};return n?i.jsxs("section",{className:"mb-8",children:[i.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[i.jsx("button",{onClick:()=>s(null),className:"p-1 hover:bg-muted rounded-lg",children:i.jsx(Tr,{className:"w-5 h-5 text-foreground"})}),i.jsx(wt,{className:"w-5 h-5 text-primary"}),i.jsx("h2",{className:"text-lg font-bold text-foreground flex-1",children:n.name}),i.jsxs("div",{className:"flex items-center gap-1",children:[i.jsxs(Ir,{variant:"secondary",className:"text-xs",children:[i.jsx(wt,{className:"w-3 h-3 mr-1"}),a.length]}),i.jsxs("button",{onClick:()=>U(n.join_code),className:"flex items-center gap-1 text-xs px-2 py-1 rounded-full bg-primary/10 text-primary hover:bg-primary/20",children:[i.jsx(pb,{className:"w-3 h-3"}),n.join_code]})]})]}),i.jsx(z,{className:"mb-3",children:i.jsx(B,{className:"p-0",children:i.jsxs("div",{className:"h-80 overflow-y-auto p-3 space-y-3",children:[l.length===0&&i.jsxs("div",{className:"text-center py-8 text-muted-foreground text-sm",children:[i.jsx(_c,{className:"w-8 h-8 mx-auto mb-2 opacity-50"}),"Start the conversation! Ask a question or share a tip."]}),l.map(N=>{const D=iy[N.message_type]||_c,E=N.user_id===(e==null?void 0:e.id);return i.jsxs("div",{className:`flex gap-2 ${E?"flex-row-reverse":""}`,children:[i.jsx("div",{className:`w-7 h-7 rounded-full flex items-center justify-center shrink-0 ${pD[N.message_type]}`,children:i.jsx(D,{className:"w-3.5 h-3.5"})}),i.jsxs("div",{className:`max-w-[75%] ${E?"text-right":""}`,children:[i.jsxs("div",{className:"flex items-center gap-1 mb-0.5",children:[i.jsx("span",{className:"text-xs font-bold text-foreground",children:E?"You"
549:N.display_name}),i.jsx("span",{className:"text-xs text-muted-foreground",children:Su(new Date(N.created_at),"HH:mm")})]}),i.jsxs("div",{className:`rounded-xl px-3 py-2 text-sm ${E?"bg-primary text-primary-foreground":"bg-muted text-foreground"}`,children:[N.message_type!=="message"&&i.jsx("span",{className:"text-xs font-bold opacity-70 uppercase block mb-0.5",children:N.message_type}),N.content]})]})]},N.id)}),i.jsx("div",{ref:P})]})})}),i.jsx("div",{className:"flex gap-1 mb-2",children:Object.entries(iy).map(([N,D])=>i.jsxs("button",{onClick:()=>_(N),className:`flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium transition-colors ${w===N?"bg-primary text-primary-foreground":"bg-muted text-muted-foreground hover:bg-muted/80"}`,children:[i.jsx(D,{className:"w-3 h-3"}),N.charAt(0).toUpperCase()+N.slice(1)]},N))}),i.jsxs("div",{className:"flex gap-2",children:[i.jsx(pd,{value:x,onChange:N=>y(N.target.value),placeholder:`Type your ${w}...`,className:"min-h-[40px] max-h-24 resize-none",onKeyDown:N=>{N.key==="Enter"&&!N.shiftKey&&(N.preventDefault(),R())}}),i.jsx(ne,{onClick:R,size:"icon",disabled:!x.trim(),children:i.jsx(oC,{className:"w-4 h-4"})})]})]}):i.jsxs("section",{className:"mb-8",children:[i.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[i.jsx(wt,{className:"w-5 h-5 text-primary"}),i.jsx("h2",{className:"text-lg font-bold text-foreground",children:"Study Squad"})]}),i.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:"Team up with classmates to solve maths problems together! ð¤"}),t.length>0&&i.jsx("div",{className:"space-y-2 mb-4",children:t.map(N=>i.jsx(z,{className:"cursor-pointer hover:border-primary/50 transition-colors",onClick:()=>s(N),children:i.jsxs(B,{className:"p-3 flex items-center gap-3",children:[i.jsx("div",{className:"w-10 h-10 rounded-xl gradient-primary flex items-center justify-center",children:i.jsx(wt,{className:"w-5 h-5 text-primary-foreground"})}),i.jsxs("div",{className:"flex-1 min-w-0",children:[i.jsx("p",{className:"font-bold text-sm text-foreground truncate",children:N.name}),i.jsxs("p",{className:"text-xs text-muted-foreground",children:["Code: ",N.join_code]})]}),i.jsx(_c,{className:"w-4 h-4 text-muted-foreground"})]})},N.id))}),t.length===0&&i.jsx(z,{className:"mb-4",children:i.jsxs(B,{className:"p-6 text-center",children:[i.jsx(wt,{className:"w-10 h-10 text-muted-foreground mx-auto mb-2 opacity-50"}),i.jsx("p",{className:"text-sm text-muted-foreground mb-1",children:"No squads yet"}),i.jsx("p",{className:"text-xs text-muted-foreground",children:"Create one or join with a code from a friend"})]})}),i.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[i.jsxs(Sn,{open:u,onOpenChange:d,children:[i.jsx(_u,{asChild:!0,children:i.jsxs(ne,{variant:"outline",className:"border-dashed",children:[i.jsx(aa,{className:"w-4 h-4 mr-1"}),"Create Squad"]})}),i.jsxs(Jr,{children:[i.jsx(Zr,{children:i.jsx(Xr,{children:"Create a Study Squad"})}),i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{children:[i.jsx("label",{className:"text-sm font-medium text-foreground mb-1 block",children:"Squad Name"}),i.jsx(et,{value:f,onChange:N=>b(N.target.value),placeholder:"e.g. Algebra Avengers"})]}),i.jsxs(ne,{onClick:O,className:"w-full",disabled:!f.trim()||S,children:[S&&i.jsx($e,{className:"w-4 h-4 mr-2 animate-spin"}),i.jsx(jf,{className:"w-4 h-4 mr-2"}),"Create & Invite Friends"]})]})]})]}),i.jsxs(Sn,{open:h,onOpenChange:m,children:[i.jsx(_u,{asChild:!0,children:i.jsxs(ne,{variant:"outline",className:"border-dashed",children:[i.jsx(w0,{className:"w-4 h-4 mr-1"}),"Join Squad"]})}),i.jsxs(Jr,{children:[i.jsx(Zr,{children:i.jsx(Xr,{children:"Join a Study Squad"})}),i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{children:[i.jsx("label",{className:"text-sm font-medium text-foreground mb-1 block",children:"Enter Join Code"}),i.jsx(et,{value:g,onChange:N=>v(N.target.value.toUpperCase()),placeholder:"e.g. ABC123",maxLength:6,className:"text-center text-lg tracking-widest font-bold"})]}),i.jsxs(ne,{onClick:M,className:"w-full",disabled:g.length<6||S,children:[S&&i.jsx($e,{className:"w-4 h-4 mr-2 animate-spin"}),i.jsx(w0,{className:"w-4 h-4 mr-2"}),"Join Squad"]})]})]})]})]})]})},xD=()=>i.jsxs("div",{className:"space-y-8",children:[i.jsxs("section",{children:[i.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[i.jsx(Cn,{className:"w-5 h-5 text-accent"}),i.jsx("h2",{className:"text-lg font-bold text-foreground",children:"Wellbeing & Support"})]}),i.jsx("p",{className:"text-xs text-muted-foreground mb-4",children:"Look after yourself â your wellbeing matters as much as your grades"})]}),i.jsx(mD,{}),i.jsxs("section",{children:[i.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[i.jsx(wt,{className:"w-5 h-5 text-primary"}),i.jsx("h2",{className:"text-lg font-bold text-foreground",children:"Study Squad"})]}),i.jsx("p",{className:"text-xs text-muted-foreground mb-4",children:"Team up with classmates to tackle problems together"})]}),i.jsx(gD,{})]}),bh=[{id:"aqa",name:"AQA",fullName:"Assessment and Qualifications Alliance",description:"Most popular exam board in England",website:"https://www.aqa.org.uk",tiers:[{id:"foundation",label:"Foundation Tier",grades:"Grades 1â5"},{id:"higher",label:"Higher Tier",grades:"Grades 4â9"}],totalMarks:80},{id:"edexcel",name:"Edexcel",fullName:"Pearson Edexcel",description:"Widely used across the UK and internationally",website:"https://qualifications.pearson.com",tiers:[{id:"foundation",label:"Foundation Tier",grades:"Grades 1â5"},{id:"higher",label:"Higher Tier",grades:"Grades 4â9"}],totalMarks:80},{id:"ocr",name:"OCR",fullName:"Oxford, Cambridge and RSA",description:"Strong presence in schools across England",website:"https://www.ocr.org.uk",tiers:[{id:"foundation",label:"Foundation Tier",grades:"Grades 1â5"},{id:"higher",label:"Higher Tier",grades:"Grades 4â9"}],totalMarks:100},{id:"igcse",name:"IGCSE",fullName:"International GCSE (Edexcel)",description:"International qual
549ification recognised globally",website:"https://qualifications.pearson.com/en/qualifications/edexcel-international-gcses.html",tiers:[{id:"foundation",label:"Foundation Tier",grades:"Grades 1â5"},{id:"higher",label:"Higher Tier",grades:"Grades 4â9"}],totalMarks:100}];function yD(e){const t=[];for(let r=2025;r>=2015;r--)t.push({year:r,session:"june",papers:[1,2,3]}),r>=2017&&r<=2024&&t.push({year:r,session:"november",papers:[1,2,3]});return t}const oy={aqa:{foundation:[{grade:"1",marks:10,color:"bg-red-100 text-red-700 border-red-300"},{grade:"2",marks:20,color:"bg-orange-100 text-orange-700 border-orange-300"},{grade:"3",marks:35,color:"bg-yellow-100 text-yellow-700 border-yellow-300"},{grade:"4",marks:50,color:"bg-lime-100 text-lime-700 border-lime-300"},{grade:"5",marks:65,color:"bg-green-100 text-green-700 border-green-300"}],higher:[{grade:"4",marks:20,color:"bg-yellow-100 text-yellow-700 border-yellow-300"},{grade:"5",marks:30,color:"bg-lime-100 text-lime-700 border-lime-300"},{grade:"6",marks:40,color:"bg-emerald-100 text-emerald-700 border-emerald-300"},{grade:"7",marks:55,color:"bg-teal-100 text-teal-700 border-teal-300"},{grade:"8",marks:65,color:"bg-blue-100 text-blue-700 border-blue-300"},{grade:"9",marks:75,color:"bg-purple-100 text-purple-700 border-purple-300"}]},edexcel:{foundation:[{grade:"1",marks:10,color:"bg-red-100 text-red-700 border-red-300"},{grade:"2",marks:20,color:"bg-orange-100 text-orange-700 border-orange-300"},{grade:"3",marks:35,color:"bg-yellow-100 text-yellow-700 border-yellow-300"},{grade:"4",marks:50,color:"bg-lime-100 text-lime-700 border-lime-300"},{grade:"5",marks:65,color:"bg-green-100 text-green-700 border-green-300"}],higher:[{grade:"4",marks:20,color:"bg-yellow-100 text-yellow-700 border-yellow-300"},{grade:"5",marks:30,color:"bg-lime-100 text-lime-700 border-lime-300"},{grade:"6",marks:40,color:"bg-emerald-100 text-emerald-700 border-emerald-300"},{grade:"7",marks:55,color:"bg-teal-100 text-teal-700 border-teal-300"},{grade:"8",marks:65,color:"bg-blue-100 text-blue-700 border-blue-300"},{grade:"9",marks:75,color:"bg-purple-100 text-purple-700 border-purple-300"}]},ocr:{foundation:[{grade:"1",marks:15,color:"bg-red-100 text-red-700 border-red-300"},{grade:"2",marks:25,color:"bg-orange-100 text-orange-700 border-orange-300"},{grade:"3",marks:40,color:"bg-yellow-100 text-yellow-700 border-yellow-300"},{grade:"4",marks:55,color:"bg-lime-100 text-lime-700 border-lime-300"},{grade:"5",marks:70,color:"bg-green-100 text-green-700 border-green-300"}],higher:[{grade:"4",marks:25,color:"bg-yellow-100 text-yellow-700 border-yellow-300"},{grade:"5",marks:35,color:"bg-lime-100 text-lime-700 border-lime-300"},{grade:"6",marks:50,color:"bg-emerald-100 text-emerald-700 border-emerald-300"},{grade:"7",marks:65,color:"bg-teal-100 text-teal-700 border-teal-300"},{grade:"8",marks:80,color:"bg-blue-100 text-blue-700 border-blue-300"},{grade:"9",marks:90,color:"bg-purple-100 text-purple-700 border-purple-300"}]},igcse:{foundation:[{grade:"1",marks:15,color:"bg-red-100 text-red-700 border-red-300"},{grade:"2",marks:25,color:"bg-orange-100 text-orange-700 border-orange-300"},{grade:"3",marks:40,color:"bg-yellow-100 text-yellow-700 border-yellow-300"},{grade:"4",marks:55,color:"bg-lime-100 text-lime-700 border-lime-300"},{grade:"5",marks:70,color:"bg-green-100 text-green-700 border-green-300"}],higher:[{grade:"4",marks:25,color:"bg-yellow-100 text-yellow-700 border-yellow-300"},{grade:"5",marks:35,color:"bg-lime-100 text-lime-700 border-lime-300"},{grade:"6",marks:50,color:"bg-emerald-100 text-emerald-700 border-emerald-300"},{grade:"7",marks:65,color:"bg-teal-100 text-teal-700 border-teal-300"},{grade:"8",marks:80,color:"bg-blue-100 text-blue-700 border-blue-300"},{grade:"9",marks:90,color:"bg-purple-100 text-purple-700 border-purple-300"}]}};function vD(e){const[t,r]=p.useState([]),[n,s]=p.useState(!0),a=p.useCallback(async()=>{if(!e){s(!1);return}s(!0);const{data:l}=await F.from("past_paper_attempts").select("*").eq("user_id",e).order("completed_at",{ascending:!1});l&&r(l),s(!1)},[e]);return p.useEffect(()=>{a()},[a]),{attempts:t,loading:n,addAttempt:async l=>{if(!e)return;const{error:c}=await F.from("past_paper_attempts").insert({user_id:e,...l});return c||await a(),c},refetch:a}}const wD=({userId:e,tier:t})=>{var se;const[r,n]=p.useState("aqa"),[s,a]=p.useState(t||"higher"),[o,l]=p.useState(!1),[c,u]=
549p.useState(!1),[d,h]=p.useState(null),[m,f]=p.useState(null),[b,g]=p.useState("papers"),[v,x]=p.useState(""),[y,w]=p.useState(new Date().toISOString().split("T")[0]),[_,j]=p.useState(""),{attempts:k,addAttempt:S}=vD(e),C=bh.find(I=>I.id===r),P=yD(),T=((se=oy[r])==null?void 0:se[s])||[],$=k.filter(I=>I.exam_board===r&&I.tier===s),O=$.length,M=O>0?Math.round($.reduce((I,re)=>I+re.score/re.total_marks*100,0)/O):0,R=O>0?Math.max(...$.map(I=>I.score)):0,U=I=>{if(T.length===0)return"U";const re=[...T].sort((xe,V)=>V.marks-xe.marks);for(const xe of re)if(I>=xe.marks)return xe.grade;return"U"},N=I=>{const re=parseInt(I);return isNaN(re)?"bg-muted text-muted-foreground":re>=8?"bg-purple-100 text-purple-700":re>=7?"bg-teal-100 text-teal-700":re>=6?"bg-emerald-100 text-emerald-700":re>=5?"bg-lime-100 text-lime-700":re>=4?"bg-yellow-100 text-yellow-700":re>=3?"bg-orange-100 text-orange-700":"bg-red-100 text-red-700"},D=U(R),E=(I,re,xe)=>$.filter(V=>V.year===I&&V.session===re&&V.paper_number===xe),A=I=>{f(re=>re===I?null:I)},Y=async()=>{if(!d||!v)return;await S({exam_board:r,year:d.year,session:d.session,paper_number:d.paper,tier:s,score:parseInt(v),total_marks:C.totalMarks,time_spent_minutes:_?parseInt(_):null,completed_at:y})?Ke.error("Failed to save attempt"):(Ke.success("Attempt saved!"),u(!1),x(""),j(""),h(null))},te=(I,re,xe)=>{h({year:I,session:re,paper:xe}),u(!0)},W=k.filter(I=>I.tier===s).sort((I,re)=>new Date(re.completed_at).getTime()-new Date(I.completed_at).getTime());return i.jsxs("div",{className:"space-y-6",children:[i.jsx("section",{children:i.jsxs("div",{className:"flex items-center justify-between mb-1",children:[i.jsxs("div",{children:[i.jsxs("h2",{className:"text-xl font-bold text-foreground flex items-center gap-2",children:[i.jsx(tn,{className:"w-6 h-6 text-primary"}),"Exam Preparation"]}),i.jsxs("p",{className:"text-xs text-muted-foreground",children:["Practice with ",C.name," past papers from 2015â2025"]})]}),i.jsxs(ne,{variant:"outline",size:"sm",className:"gap-1.5 text-xs",onClick:()=>l(!0),children:[i.jsx(lC,{className:"w-3.5 h-3.5"})," Change Board"]})]})}),i.jsx(z,{className:"bg-primary text-primary-foreground shadow-card overflow-hidden",children:i.jsxs(B,{className:"p-4 flex items-center justify-between",children:[i.jsxs("div",{children:[i.jsx("h3",{className:"font-bold text-lg",children:C.fullName}),i.jsx("p",{className:"text-sm opacity-80",children:C.description})]}),i.jsx("a",{href:C.website,target:"_blank",rel:"noopener noreferrer",children:i.jsxs(ne,{variant:"secondary",size:"sm",className:"gap-1.5",children:[i.jsx(G2,{className:"w-3.5 h-3.5"})," Visit Website"]})})]})}),i.jsx("div",{className:"grid grid-cols-4 gap-2",children:[{label:"Papers Done",value:O.toString(),icon:bi,color:"text-primary"},{label:"Best Grade",value:D,icon:bn,color:"text-success"},{label:"Avg Score",value:`${M}%`,icon:rn,color:"text-warning"},{label:"Attempts",value:O.toString(),icon:ma,color:"text-accent"}].map(I=>i.jsx(z,{className:"shadow-card",children:i.jsxs(B,{className:"p-3 text-center",children:[i.jsx(I.icon,{className:`w-5 h-5 mx-auto mb-1 ${I.color}`}),i.jsx("div",{className:"text-xs text-muted-foreground",children:I.label}),i.jsx("div",{className:"text-xl font-extrabold text-foreground",children:I.value})]})},I.label))}),i.jsx(wl,{value:s,onValueChange:a,children:i.jsxs(qi,{className:"w-full",children:[i.jsx(it,{value:"foundation",className:"flex-1",children:"Foundation (1â5)"}),i.jsx(it,{value:"higher",className:"flex-1",children:"Higher (4â9)"})]})}),i.jsxs("div",{className:"flex gap-2",children:[i.jsxs(ne,{variant:b==="papers"?"default":"outline",size:"sm",className:"flex-1 gap-1.5",onClick:()=>g("papers"),children:[i.jsx(bi,{className:"w-4 h-4"})," Past Papers"]}),i.jsxs(ne,{variant:b==="results"?"default":"outline",size:"sm",className:"flex-1 gap-1.5",onClick:()=>g("results"),children:[i.jsx(_f,{className:"w-4 h-4"})," My Results (",W.length,")"]})]}),b==="papers"&&i.jsxs("div",{className:"space-y-6",children:[i.jsxs("div",{className:"text-center p-3 rounded-xl bg-primary/5",children:[i.jsx("p",{className:"font-bold text-primary text-sm",children:s==="higher"?"Higher Tier":"Foundation Tier"}),i.jsx("p",{className:"text-xs text-muted-foreground",children:s==="higher"?"Covers grades 4â9, including advanced mathematical concepts":"Covers grades 1â5, focusing on core mathematical skills"})]}),i.jsx(z,{className:"shadow-card",children:i.jsxs(B,{className:"p-4",children:[i.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[i.jsx(bn,{className:"w-4 h-4 text-primary"}),i.jsxs("h3",{className:"font-bold text-foreground text-sm",children:["Grade Thresholds â ",s==="higher"?"Higher":"Foundation"," (",C.name,")"]})]}),i.jsx("div",{className:"grid grid-cols-3 sm:grid-cols-6 gap-2",children:T.map(I=>i.jsxs("div",{className:"text-center",children:[i.jsxs("div",{className:`rounded-lg border px-3 py-2 font-bold text-sm ${I.color}`,children:["Grade ",I.grade]}),i.jsxs("p",{className:"text-[10px] text-muted-foreground mt-1",children:[I.marks,"+ marks"]})]},I.grade))})]})}),i.jsx("div",{className:"space-y-3",children:P.map(I=>{const re=`${I.year}-${I.session}`,xe=I.papers.flatMap(de=>E(I.year,I.session,de)),V=xe.length>0,_e=m===re;return i.jsx(z,{className:"shadow-card",children:i.jsxs(B,{className:"p-4",children:[i.jsxs("div",{className:"flex items-center justify-between mb-3",children:[i.jsxs("div",{children:[i.jsxs("h4",{className:"font-bold text-foreground",children:[I.year," ",I.session==="june"?"June":"November"]}),i.jsxs("p",{className:"text-xs text-muted-foreground",children:[s==="higher"?"Higher":"Foundation"," Tier ⢠",C.totalMarks," marks ⢠",C.name]})]}),V&&i.jsxs("button",{onClick:()=>A(re),className:"flex items-center gap-1 text-xs text-primary font-semibold",children:[xe.length," attempt",xe.length!==1?"s":"",_e?i.jsx(Gr,{className:"w-3.5 h-3.5"}):i.jsx(Cr,{className:"w-3.5 h-3.5"})]})]}),i.jsx("div",{className:"grid grid-cols-3 gap-2",children:I.papers.map(de=>{const he=E(I.year,I.session,de);return i.jsxs("div",{className:"rounded-xl border bg-muted/30 p-3",children:[i.jsxs("div",{className:"flex items-center justify-between mb-2",children:[i.jsxs("span",{className:"text-xs font-bold text-foreground",children:["Paper ",de]}),i.jsxs("span",{className:"text-[10px] text-muted-foreground",children:[he.length," done"]})]}),he.length>0&&i.jsx("div",{className:"mb-2 space-y-1",children:i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("span",{className:"text-xs text-success font-semibold",children:["Best: ",Math.max(...he.map(le=>le.score)),"/",C.totalMarks]}),i.jsx("span",{className:`text-[10px] px-1.5 py-0.5 rounded-full font-bold ${N(U(Math.max(...he.map(le=>le.score))))}`,children:U(Math.max(...he.map(le=>le.score)))})]})}),i.jsxs(ne,{size:"sm",variant:"default",className:"w-full text-xs gap-1",onClick:()=>te(I.year,I.session,de),children:[i.jsx(aa,{className:"w-3 h-3"})," Add"]})]},de)})}),_e&&V&&i.jsxs("div",{className:"mt-4 pt-3 border-t space-y-2",children:[i.jsx("h5",{className:"text-xs font-bold text-muted-foreground uppercase tracking-wider mb-2",children:"All Attempts"}),xe.sort((de,he)=>new Date(he.completed_at).getTime()-new Date(de.completed_at).getTime()).map((de,he)=>{const le=U(de.score),we=Math.round(de.score/de.total_marks*100);return i.jsxs("div",{className:"flex items-center gap-3 p-3 rounded-lg bg-muted/40",children:[i.jsx("div",{className:`w-9 h-9 rounded-lg flex items-center justify-center font-bold text-sm shrink-0 ${N(le)}`,children:le}),i.jsxs("div",{className:"flex-1 min-w-0",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsxs("span",{className:"text-sm font-bold text-foreground",children:["Paper ",de.paper_number]}),i.jsxs("span",{className:"text-xs text-muted-foreground",children:[de.score,"/",de.total_marks," (",we,"%)"]})]}),i.jsxs("div",{className:"flex items-center gap-3 text-[10px] text-muted-foreground mt-0.5",children:[i.jsxs("span",{className:"flex items-center gap-1",children:[i.jsx(bf,{className:"w-3 h-3"}),new Date(de.completed_at).toLocaleDateString("en-GB",{day:"numeric",month:"short",year:"numeric"})]}),de.time_spent_minutes&&i.jsxs("span",{className:"flex items-center gap-1",children:[i.jsx(wn,{className:"w-3 h-3"}),de.time_spent_minutes," mins"]})]})]}),i.jsx("div",{className:"w-16 shrink-0",children:i.jsx("div",{className:"h-2 rounded-full bg-muted overflow-hidden",children:i.jsx("div",{className:"h-full rounded-full bg-primary transition-all",style:{width:`${we}%`}})})})]},de.id)})]})]})},re)})})]}),b==="results"&&i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{className:"text-center p-3 rounded-xl bg-primary/5",children:[i.jsx("p",{className:"font-bold text-primary text-sm",children:"Your Complete Results History"}),i.jsxs("p",{className:"text-xs text-muted-foreground",children:["All past paper attempts across all exam boards (",s==="higher"?"Higher":"Foundation"," Tier)"]})]}),W.length===0?i.jsx(z,{className:"shadow-card",children:i.jsxs(B,{className:"p-8 text-center",children:[i.jsx(_f,{className:"w-10 h-10 text-muted-foreground mx-auto mb-3"}),i.jsx("p",{className:"font-bold text-foreground mb-1",children:"No attempts yet"}),i.jsx("p",{className:"text-sm text-muted-foreground",children:"Complete past papers and record your scores to see your results here."})]})}):i.jsx("div",{className:"space-y-2",children:W.map(I=>{var de;const re=bh.find(he=>he.id===I.exam_board),xe=((de=oy[I.exam_board])==null?void 0:de[I.tier])||[],V=(()=>
549{if(xe.length===0)return"U";const he=[...xe].sort((le,we)=>we.marks-le.marks);for(const le of he)if(I.score>=le.marks)return le.grade;return"U"})(),_e=Math.round(I.score/I.total_marks*100);return i.jsx(z,{className:"shadow-card",children:i.jsx(B,{className:"p-4",children:i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("div",{className:`w-12 h-12 rounded-xl flex items-center justify-center font-extrabold text-lg shrink-0 ${N(V)}`,children:V}),i.jsxs("div",{className:"flex-1 min-w-0",children:[i.jsx("div",{className:"flex items-center gap-2 mb-0.5",children:i.jsxs("span",{className:"font-bold text-foreground text-sm",children:[(re==null?void 0:re.name)||I.exam_board.toUpperCase()," â Paper ",I.paper_number]})}),i.jsxs("p",{className:"text-xs text-muted-foreground",children:[I.year," ",I.session==="june"?"June":"November"," ⢠",I.tier==="higher"?"Higher":"Foundation"]}),i.jsxs("div",{className:"flex items-center gap-3 mt-1",children:[i.jsxs("span",{className:"text-xs font-semibold text-foreground",children:[I.score,"/",I.total_marks," (",_e,"%)"]}),i.jsxs("span",{className:"flex items-center gap-1 text-[10px] text-muted-foreground",children:[i.jsx(bf,{className:"w-3 h-3"}),new Date(I.completed_at).toLocaleDateString("en-GB",{day:"numeric",month:"short",year:"numeric"})]}),I.time_spent_minutes&&i.jsxs("span",{className:"flex items-center gap-1 text-[10px] text-muted-foreground",children:[i.jsx(wn,{className:"w-3 h-3"}),I.time_spent_minutes," mins"]})]})]}),i.jsxs("div",{className:"w-14 shrink-0",children:[i.jsx("div",{className:"h-2.5 rounded-full bg-muted overflow-hidden",children:i.jsx("div",{className:"h-full rounded-full bg-primary transition-all",style:{width:`${_e}%`}})}),i.jsxs("p",{className:"text-[10px] text-center text-muted-foreground mt-0.5",children:[_e,"%"]})]})]})})},I.id)})})]}),i.jsx(Sn,{open:o,onOpenChange:l,children:i.jsxs(Jr,{className:"max-w-sm",children:[i.jsx(Zr,{children:i.jsx(Xr,{children:"Choose Exam Board"})}),i.jsx("div",{className:"space-y-2 pt-2",children:bh.map(I=>i.jsxs("button",{onClick:()=>{n(I.id),l(!1)},className:`w-full p-4 rounded-xl border text-left transition-all ${r===I.id?"border-primary bg-primary/5":"border-border hover:border-primary/50"}`,children:[i.jsx("div",{className:"font-bold text-foreground",children:I.name}),i.jsx("div",{className:"text-xs text-muted-foreground",children:I.fullName})]},I.id))})]})}),i.jsx(Sn,{open:c,onOpenChange:u,children:i.jsxs(Jr,{className:"max-w-sm",children:[i.jsx(Zr,{children:i.jsx(Xr,{children:"Add Exam Attempt"})}),d&&i.jsxs("div",{className:"space-y-4 pt-2",children:[i.jsxs("p",{className:"text-sm text-muted-foreground",children:[C.name," â ",d.year," ",d.session==="june"?"June":"November"," â Paper ",d.paper]}),i.jsxs("div",{children:[i.jsx("label",{className:"text-xs font-semibold text-foreground mb-1 block",children:"Date Completed"}),i.jsx(et,{type:"date",value:y,onChange:I=>w(I.target.value)})]}),i.jsxs("div",{children:[i.jsxs("label",{className:"text-xs font-semibold text-foreground mb-1 block",children:["Score (out of ",C.totalMarks,")"]}),i.jsx(et,{type:"number",placeholder:"Enter your score",value:v,onChange:I=>x(I.target.value),min:0,max:C.totalMarks})]}),i.jsxs("div",{children:[i.jsx("label",{className:"text-xs font-semibold text-foreground mb-1 block",children:"Time Spent (minutes) â Optional"}),i.jsx(et,{type:"number",placeholder:"e.g. 90",value:_,onChange:I=>j(I.target.value)})]}),i.jsx(ne,{onClick:Y,className:"w-full",disabled:!v,children:"Save Attempt"})]})]})})]})},bD=()=>{const[e,t]=p.useState(null),[r,n]=p.useState([]),[s,a]=p.useState({quizzesTaken:0,questionsSolved:0}),[o,l]=p.useState(!0),[c,u]=p.useState("home"),{user:d,signOut:h}=st(),m=pa(),f=(e==null?void 0:e.tier)||void 0,{strands:b,getSubtopics:g,subtopics:v,loading:x}=ld(f);if(p.useEffect(()=>{(async()=>{if(!d)return;const[_,j,k]=await Promise.all([F.from("profiles").select("*").eq("id",d.id).maybeSingle(),F.from("topic_progress").select("*").eq("user_id",d.id),F.from("quiz_attempts").select("score, total_questions").eq("user_id",d.id)]);if(_.data&&(t(_.data),!_.data.onboarding_completed)){m("/onboarding");return}if(j.data&&n(j.data),k.data){const S=k.data.length,C=k.data.reduce((P,T)=>P+(T.total_questions||0),0);a({quizzesTaken:S,questionsSolved:C})}l(!1)})()},[d,m]),p.useEffect(()=>{(async()=>
549{if(!d||!e)return;const _=new Date().toISOString().split("T")[0],j=e.last_activity_date;if(j!==_){const k=new Date;k.setDate(k.getDate()-1);const S=k.toISOString().split("T")[0],C=j===S?(e.current_streak||0)+1:1;await F.from("profiles").update({current_streak:C,longest_streak:Math.max(C,e.longest_streak||0),last_activity_date:_,updated_at:new Date().toISOString()}).eq("id",d.id),t(P=>P?{...P,current_streak:C,last_activity_date:_}:null)}})()},[d,e==null?void 0:e.last_activity_date]),o||x)return i.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center",children:i.jsx($e,{className:"w-8 h-8 animate-spin text-primary"})});if(!e)return m("/onboarding"),null;const y={home:"Home",practice:"Practice",analytics:"Analytics",plan:"Plan",wellbeing:"Wellbeing",exams:"Exam Prep"};return i.jsxs("div",{className:"min-h-screen bg-background pb-24",children:[i.jsx("header",{className:"bg-card border-b border-border sticky top-0 z-50",children:i.jsxs("div",{className:"container mx-auto px-4 py-3 flex items-center justify-between max-w-2xl",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("div",{className:"w-8 h-8 rounded-lg gradient-primary flex items-center justify-center",children:i.jsx(Ar,{className:"w-5 h-5 text-primary-foreground"})}),i.jsx("span",{className:"text-lg font-bold text-foreground",children:"Mathly"}),i.jsxs("span",{className:"text-xs text-muted-foreground font-semibold ml-1 hidden sm:inline",children:["/ ",y[c]]})]}),i.jsx(ne,{variant:"ghost",size:"icon",onClick:h,children:i.jsx(eu,{className:"w-5 h-5"})})]})}),i.jsxs("main",{className:"container mx-auto px-4 py-6 max-w-2xl",children:[c==="home"&&i.jsx(hI,{profile:e,topicProgress:r,subtopics:v,quizStats:s,userId:d.id,onProfileUpdate:w=>t(_=>_?{..._,...w}:null)}),c==="practice"&&i.jsx(MI,{strands:b,subtopics:v,topicProgress:r,getSubtopics:g}),c==="analytics"&&i.jsx(nD,{topicProgress:r,subtopics:v,strands:b,quizStats:s,getSubtopics:g}),c==="plan"&&i.jsx(iD,{topicProgress:r,subtopics:v}),c==="wellbeing"&&i.jsx(xD,{}),c==="exams"&&i.jsx(wD,{userId:d.id,tier:(e==null?void 0:e.tier)||"higher"})]}),i.jsx(b3,{active:c,onChange:u})]})};function Yp(){const{user:e}=st(),[t,r]=p.useState([]),[n,s]=p.useState(!0),a=p.useCallback(async()=>{if(!e){r([]),s(!1);return}const{data:c}=await F.from("student_links").select("id, student_id").eq("guardian_id",e.id);if(c&&c.length>0){const u=c.map(m=>m.student_id),{data:d}=await F.from("profiles").select("id, display_name, xp, level, current_streak, tier, last_activity_date").in("id",u),h=c.map(m=>({student_id:m.student_id,link_id:m.id,profile:(d==null?void 0:d.find(f=>f.id===m.student_id))||{id:m.student_id,display_name:"Student",xp:0,level:"bronze",current_streak:0,tier:null,last_activity_date:null}}));r(h)}else r([]);s(!1)},[e]);return p.useEffect(()=>{a()},[a]),{linkedStudents:t,loading:n,linkStudent:async c=>{if(!e)return{error:new Error("Not authenticated")};const{data:u,error:d}=await F.rpc("lookup_student_by_link_code",{_link_code:c.toUpperCase().trim()});if(d||!u)return{error:new Error("Invalid link code. Please check and try again.")};const h={id:u};if(h.id===e.id)return{error:new Error("You can't link to your own account.")};const{data:m}=await F.from("student_links").select("id").eq("guardian_id",e.id).eq("student_id",h.id).maybeSingle();if(m)return{error:new Error("This student is already linked to your account.")};const{data:f}=await F.from("user_roles").select("role").eq("user_id",e.id).maybeSingle(),b=(f==null?void 0:f.role)==="teacher"?"teacher":"parent",{error:g}=await F.from("student_links").insert({guardian_id:e.id,student_id:h.id,relationship_type:b});return g?{error:new Error("Failed to link student. Please try again.")}:(await a(),{error:null})},unlinkStudent:async c=>{const{error:u}=await F.from("student_links").delete().eq("id",c);return u||r(d=>d.filter(h=>h.link_id!==c)),{error:u}},refetch:a}}const Vj=()=>{const[e,t]=p.useState(""),[r,n]=p.useState(!1),{linkedStudents:s,loading:a,linkStudent:o,unlinkStudent:l}=Yp(),{toast:c}=en(),u=async()=>{if(!e.trim())return;n(!0);const{error:h}=await o(e);h?c({variant:"destructive",title:"Link failed",description:h.message}):(c({title:"Student linked! ð",description:"You can now view their progress."}),t("")),n(!1)},d=async h=>{const{error:m}=await l(h.link_id);c(m?{variant:"destructive",title:"Failed to unlink",description:"Please try again."}:{title:"Student unlinked",description:"The student has been removed from your dashboard."})};return i.jsxs("section",{className:"mb-8",children:[i.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[i.jsx(vb,{className:"w-5 h-5 text-primary"}),i.jsx("h2",{className:"text-lg font-bold text-foreground",children:"Linked Students"})]}),i.jsx(z,{className:"mb-4",children:i.jsxs(B,{className:"p-4",children:[i.jsxs("p",{className:"text-sm text-muted-foreground mb-3",children:["Ask your student for their ",i.jsx("strong",{children:"link code"})," â it's shown on their dashboard."]}),i.jsxs("div",{className:"flex gap-2",children:[i.jsx(et,{value:e,onCh
549ange:h=>t(h.target.value.toUpperCase()),placeholder:"Enter 6-digit code",maxLength:6,className:"h-11 uppercase tracking-widest font-mono text-center text-lg",disabled:r}),i.jsx(ne,{onClick:u,disabled:r||e.trim().length<6,className:"gradient-primary text-white border-0 h-11 px-6",children:r?i.jsx($e,{className:"w-4 h-4 animate-spin"}):i.jsx(jf,{className:"w-4 h-4"})})]})]})}),a?i.jsx("div",{className:"flex justify-center py-4",children:i.jsx($e,{className:"w-5 h-5 animate-spin text-muted-foreground"})}):s.length===0?i.jsx(z,{className:"border-dashed",children:i.jsxs(B,{className:"p-6 text-center",children:[i.jsx(jf,{className:"w-8 h-8 text-muted-foreground mx-auto mb-2"}),i.jsx("p",{className:"text-sm text-muted-foreground",children:"No students linked yet. Enter a link code above to get started."})]})}):i.jsx("div",{className:"space-y-3",children:s.map(h=>i.jsx(z,{children:i.jsxs(B,{className:"flex items-center gap-4 p-4",children:[i.jsx("div",{className:"w-10 h-10 rounded-xl gradient-primary flex items-center justify-center",children:i.jsx(gl,{className:"w-5 h-5 text-white"})}),i.jsxs("div",{className:"flex-1 min-w-0",children:[i.jsx("h3",{className:"font-bold text-foreground text-sm truncate",children:h.profile.display_name||"Student"}),i.jsxs("div",{className:"flex items-center gap-3 text-xs text-muted-foreground",children:[i.jsxs("span",{className:"flex items-center gap-1",children:[i.jsx(fp,{className:"w-3 h-3 text-xp"}),h.profile.xp||0," XP"]}),i.jsxs("span",{className:"flex items-center gap-1",children:[i.jsx(lp,{className:"w-3 h-3 text-streak"}),h.profile.current_streak||0," day streak"]}),i.jsx("span",{children:Zf[h.profile.level||"bronze"]})]})]}),i.jsx(ne,{variant:"ghost",size:"icon",onClick:()=>d(h),className:"text-muted-foreground hover:text-destructive shrink-0",children:i.jsx(hp,{className:"w-4 h-4"})})]})},h.link_id))})]})};function _D(e){const[t,r]=p.useState([]),[n,s]=p.useState({quizzesTaken:0,questionsSolved:0}),[a,o]=p.useState([]),[l,c]=p.useState(!0),u=p.useCallback(async()=>{if(!e){c(!1);return}c(!0);const[d,h,m]=await Promise.all([F.from("topic_progress").select("*").eq("user_id",e),F.from("quiz_attempts").select("score, total_questions").eq("user_id",e),F.from("study_timetable").select("*").eq("user_id",e).order("order_index",{ascending:!0})]);if(d.data&&r(d.data),h.data){const f=h.data.length,b=h.data.reduce((g,v)=>g+(v.total_questions||0),0);s({quizzesTaken:f,questionsSolved:b})}m.data&&o(m.data),c(!1)},[e]);return p.useEffect(()=>{u()},[u]),{topicProgress:t,quizStats:n,timetableEntries:a,loading:l,refetch:u}}function jD(e){const[t,r]=p.useState([]),[n,s]=p.useState(!0),a=p.useCallback(async()=>{if(!e){r([]),s(!1);return}s(!0);const o=new Date;o.setDate(o.getDate()-30);const{data:l}=await F.from("mood_logs").select("*").eq("user_id",e).gte("logged_date",o.toISOString().split("T")[0]).order("logged_date",{ascending:!1});l&&r(l),s(!1)},[e]);return p.useEffect(()=>{a()},[a]),{moodLogs:t,loading:n,refetch:a}}function kD(e){const[t,r]=p.useState([]),[n,s]=p.useState(!0),a=p.useCallback(async()=>{if(!e){r([]),s(!1);return}s(!0);const{data:c,error:u}=await F.from("assignment_students").select(` 550 id, 551 assignment_id, 552 student_id, 553 status, 554 score, 555 completed_at, 556 created_at, 557 assignment:teacher_assignments ( 558 id, 559 title, 560 description, 561 topic_id, 562 assignment_type, 563 difficulty, 564 due_date, 565 status 566 ) 567 `).eq("student_id",e).order("created_at",{ascending:!1});if(c&&!u){const d=c.filter(h=>h.assignment).map(h=>({...h,assignment:Array.isArray(h.assignment)?h.assignment[0]:h.assignment}));r(d)}s(!1)},[e]);p.useEffect(()=>{a()},[a]);const o=t.filter(c=>{var u;return c.status!=="completed"&&((u=c.assignment)==null?void 0:u.due_date)}).sort((c,u)=>{const d=c.assignment.due_date||"",h=u.assignment.due_date||"";return d.localeCompare(h)}),l=t.filter(c=>c.status==="completed");return{assignments:t,upcomingAssignments:o,completedAssignments:l,loading:n,refetch:a}}function SD(e){const[t,r]=p.useState(0),[n,s]=p.useState(!0),a=p.useCallback(async()=>
567{if(!e){r(0),s(!1);return}const{count:o}=await F.from("user_badges").select("*",{count:"exact",head:!0}).eq("user_id",e);r(o||0),s(!1)},[e]);return p.useEffect(()=>{a()},[a]),{badgeCount:t,loading:n}}function ND(e){const[t,r]=p.useState(null),[n,s]=p.useState(!0),a=p.useCallback(async()=>{if(!e){r(null),s(!1);return}const{data:o}=await F.from("profiles").select("target_grade, current_grade, year_group, xp, level, current_streak").eq("id",e).single();o&&r(o),s(!1)},[e]);return p.useEffect(()=>{a()},[a]),{profile:t,loading:n}}const CD=({topicProgress:e,subtopics:t,quizStats:r,targetGrade:n,currentGrade:s,badges:a})=>{const o=e.filter(d=>d.mastery_level==="confident").length,l=e.filter(d=>d.mastery_level==="practising").length,u=[{label:"Overall Progress",value:`${t.length>0?Math.round((o+l)/t.length*100):0}%`,sub:`${o} confident`,icon:rn,iconBg:"bg-primary/10",iconColor:"text-primary"},{label:"Questions Solved",value:r.questionsSolved.toString(),sub:`${r.quizzesTaken} quizzes`,icon:wn,iconBg:"bg-primary/10",iconColor:"text-primary"},{label:"Current Grade",value:s?`Grade ${s}`:"â",sub:s?"Current level":"Not set",icon:tn,iconBg:"bg-accent/10",iconColor:"text-accent"},{label:"Target Grade",value:n?`Grade ${n}`:"â",sub:n?"On track":"Not set",icon:bn,iconBg:"bg-success/10",iconColor:"text-success"},{label:"Achievements",value:a.toString(),sub:"Badges earned",icon:gl,iconBg:"bg-warning/10",iconColor:"text-warning"}];return i.jsx("div",{className:"grid grid-cols-2 gap-3",children:u.map(d=>{const h=d.icon;return i.jsx(z,{className:"shadow-card",children:i.jsxs(B,{className:"p-3",children:[i.jsxs("div",{className:"flex items-start justify-between mb-1",children:[i.jsx("p",{className:"text-[11px] font-semibold text-muted-foreground",children:d.label}),i.jsx("div",{className:`w-7 h-7 rounded-lg ${d.iconBg} flex items-center justify-center`,children:i.jsx(h,{className:`w-3.5 h-3.5 ${d.iconColor}`})})]}),i.jsx("p",{className:"text-xl font-extrabold text-foreground",children:d.value}),i.jsx("p",{className:"text-[10px] text-success font-medium",children:d.sub})]})},d.label)})})},ED=({strands:e,topicProgress:t,getSubtopics:r})=>{const n=e.map(s=>{const a=r(s.id),o=a.filter(h=>{var m;return((m=t.find(f=>f.topic_id===h.id))==null?void 0:m.mastery_level)==="confident"}).length,l=a.filter(h=>{var m;return((m=t.find(f=>f.topic_id===h.id))==null?void 0:m.mastery_level)==="practising"}).length,c=a.length,u=c>0?Math.round(o/c*100):0,d=c>0?Math.round(l/c*100):0;return{strand:s,confident:o,practising:l,total:c,confPct:u,pracPct:d,totalPct:u+d}});return i.jsx(z,{className:"shadow-card",children:i.jsxs(B,{className:"p-4",children:[i.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[i.jsx(ma,{className:"w-5 h-5 text-primary"}),i.jsx("h3",{className:"font-bold text-foreground text-sm",children:"Topic Performance"})]}),i.jsx("p",{className:"text-xs text-muted-foreground mb-4",children:"Breakdown by GCSE maths strands"}),i.jsx("div",{className:"space-y-4",children:n.map(({strand:s,confident:a,practising:o,total:l,confPct:c,pracPct:u,totalPct:d})=>i.jsxs("div",{children:[i.jsxs("div",{className:"flex items-center justify-between mb-1",children:[i.jsx("span",{className:"text-sm font-bold text-foreground",children:s.name}),i.jsxs("span",{className:"text-xs font-semibold text-primary",children:[d,"%"]})]}),i.jsxs("div",{className:"relative h-3 w-full rounded-full bg-secondary overflow-hidden mb-1",children:[i.jsx("div",{className:"absolute inset-y-0 left-0 rounded-full bg-success transition-all duration-500",style:{width:`${c}%`}}),i.jsx("div",{className:"absolute inset-y-0 rounded-full bg-warning/60 transition-all duration-500",style:{left:`${c}%`,width:`${u}%`}})]}),i.jsxs("div",{className:"flex items-center gap-3 text-[10px] text-muted-foreground",children:[i.jsxs("span",{className:"flex items-center gap-1",children:[i.jsx("span",{className:"w-2 h-2 rounded-full bg-success"})," ",a," Confident"]}),i.jsxs("span",{className:"flex items-center gap-1",children:[i.jsx("span",{className:"w-2 h-2 rounded-full bg-warning/60"})," ",o," Practising"]}),i.jsxs("span",{className:"flex items-center gap-1",children:[i.jsx("span",{className:"w-2 h-2 rounded-full bg-secondary"})," ",l-a-o," Not Started"]})]})]},s.id))}),i.jsxs("div",{className:"mt-4 pt-3 border-t border-border flex flex-wrap gap-4 text-[11px]",children:[i.jsxs("div",{className:"flex items-center gap-1.5",children:[i.jsx("span",{className:"w-3 h-1.5 rounded-full bg-success"}),i.jsx("span",{className:"text-muted-foreground",children:"Confident"})]}),i.jsxs("div",{className:"flex items-center gap-1.5",children:[i.jsx("span",{className:"w-3 h-1.5 rounded-full bg-warning/60"}),i.jsx("span",{className:"text-muted-foreground",children:"Practising"})]}),i.jsxs("div",{className:"flex items-center gap-1.5",children:[i.jsx("span",{className:"w-3 h-1.5 rounded-full bg-secondary"}),i.jsx("span",{className:"text-muted-foreground",children:"Not Started"})]})]})]})})},ly={pending:"bg-muted text-muted-foreground",in_progress:"bg-primary/10 text-primary",completed:"bg-success/10 text-success"},TD={pending:"Not Started",in_progress:"In Progress",completed:"Completed"},cy=({assignments:e,loading:t,studentName:r})=>t?null:i.jsx(z,{className:"shadow-card",children:i.jsxs(B,{className:"p-4",children:[i.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[i.jsx(op,{className:"w-5 h-5 text-primary"}),i.jsx("h3",{className:"font-bold text-foreground text-sm",children:"Upcoming Work"})]}),i.jsxs("p",{className:"text-xs text-muted-foreground mb-3",children:["Tasks and assignments due for ",r]}),e.length===0?i.jsxs("div",{className:"text-center py-6",children:[i.jsx(lr,{className:"w-8 h-8 text-success mx-auto mb-2"}),i.jsx("p",{className:"text-sm font-semibold text-foreground",children:"All caught up! ð"}),i.jsx("p",{className:"text-xs text-muted-foreground",children:"No upcoming assignments right now."})]}):i.jsx("div",{className:"space-y-2",children:e.slice(0,5).map(n=>{const s=n.assignment.due_date?new Date(n.assignment.due_date):null,a=s?tD(s):!1;return i.jsxs("div",{className:"flex items-center gap-3 p-3 rounded-xl border border-border hover:bg-muted/30 transition-colors",children:[i.jsx("div",{className:"w-8 h-8 rounded-lg bg-primary/10 flex items-center justify-center shrink-0",children:i.jsx(sr,{className:"w-4 h-4 text-primary"})}),i.jsxs("div",{className:"flex-1 min-w-0",children:[i.jsx("p",{className:"font-bold text-sm text-foreground truncate",children:n.assignment.title}),i.jsxs("div",{className:"flex items-center gap-2 text-[11px] text-muted-foreground",children:[i.jsx("span",{className:"capitalize",children:n.assignment.assignment_type.replace("_"," ")}),s&&i.jsxs(i.Fragment,{children:[i.jsx("span",{children:"·"}),i.jsxs("span",{className:`flex items-center gap-0.5 ${a?"text-destructive font-semibold":""}`,children:[i.jsx(wn,{className:"w-3 h-3"}),a?"Overdue":`Due ${eD(s,{addSuffix:!0})}`]})]})]})]}),i.jsx(Ir,{variant:"secondary",className:`text-[10px] px-2 py-0.5 ${ly[n.status]||ly.pending}`,children:TD[n.status]||n.status})]},n.id)})})]})}),_h=e=>{var t;return e&&((t=Nu.find(r=>r.value===e))==null?void 0:t.emoji)||"·"},uy=e=>{var t;return((t=Nu.find(r=>r.value===e))==null?void 0:t.label)||e},PD=({moodLogs:e,loading:t,studentName:r})=>{if(t)return i.jsx(z,{className:"shadow-card",children:i.jsx(B,{className:"p-4 flex items-center justify-center",children:i.jsx($e,{className:"w-5 h-5 animate-spin text-primary"})})});const n=Array.from({length:7},(u,d)=>{const h=new Date;h.setDate(h.getDate()-(6-d));const m=h.toISOString().split("T")[0],f=e.find(g=>g.logged_date===m),b=h.toLocaleDateString("en-GB",{weekday:"short"});return{date:m,mood:(f==null?void 0:f.mood)||null,dayLabel:b}}),s=new Date().toISOString().split("T")[0],a=e.find(u=>u.logged_date===s),o=n.filter(u=>u.mood!==null).length,l={};e.forEach(u=>{l[u.mood]=(l[u.mood]||0)+1});const c=Object.entries(l).sort((u,d)=>d[1]-u[1])[0];return i.jsx(z,{className:"shadow-card",children:i.jsxs(B,{className:"p-4",children:[i.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[i.jsx(b0,{className:"w-5 h-5 text-primary"}),i.jsxs("h3",{className:"font-bold text-foreground text-sm",children:[r,"'s Mood This Week"]})]}),e.length===0?i.jsxs("div",{className:"text-center py-4",children:[i.jsx(b0,{className:"w-8 h-8 text-muted-foreground mx-auto mb-2"}),i.jsxs("p",{className:"text-sm text-muted-foreground",children:[r," hasn't logged any moods yet. Encourage them to track how they're feeling!"]})]}):i.jsxs(i.Fragment,{children:[a&&i.jsx("div",{className:"bg-primary/5 rounded-lg p-3 mb-3",children:i.jsxs("p",{className:"text-sm text-foreground",children:[i.jsx("span",{className:"font-semibold",children:"Today:"})," ",i.jsx("span",{className:"text-lg",children:_h(a.mood)}
567)," ",uy(a.mood),a.mood==="anxious"&&i.jsx("span",{className:"text-xs text-muted-foreground ml-2",children:"â They may need extra support today"}),a.mood==="worried"&&i.jsx("span",{className:"text-xs text-muted-foreground ml-2",children:"â A bit of encouragement could help"})]})}),i.jsxs("div",{className:"flex items-center justify-between bg-muted/50 rounded-lg p-3 mb-3",children:[i.jsx("span",{className:"text-xs font-semibold text-muted-foreground",children:"This week:"}),i.jsx("div",{className:"flex gap-2",children:n.map(u=>i.jsxs("div",{className:"flex flex-col items-center gap-1",children:[i.jsx("span",{className:"text-lg leading-none",children:_h(u.mood)}),i.jsx("span",{className:`text-[10px] font-medium ${u.date===s?"text-primary font-bold":"text-muted-foreground"}`,children:u.dayLabel})]},u.date))})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[i.jsxs("div",{className:"rounded-lg bg-muted/50 p-2.5 text-center",children:[i.jsxs("p",{className:"text-lg font-bold text-foreground",children:[o,"/7"]}),i.jsx("p",{className:"text-xs text-muted-foreground",children:"Days logged this week"})]}),i.jsx("div",{className:"rounded-lg bg-muted/50 p-2.5 text-center",children:c?i.jsxs(i.Fragment,{children:[i.jsxs("p",{className:"text-lg font-bold text-foreground",children:[_h(c[0])," ",uy(c[0])]}),i.jsx("p",{className:"text-xs text-muted-foreground",children:"Most common mood"})]}):i.jsxs(i.Fragment,{children:[i.jsx("p",{className:"text-lg font-bold text-muted-foreground",children:"â"}),i.jsx("p",{className:"text-xs text-muted-foreground",children:"No data yet"})]})})]})]})]})})},AD=({strand:e,subtopics:t,topicProgress:r,confidentPercent:n,practisingPercent:s,completedPercent:a,confidentCount:o,practisingCount:l,totalCount:c})=>{const[u,d]=p.useState(!1);return i.jsx(z,{className:"shadow-card",children:i.jsxs(B,{className:"p-4",children:[i.jsxs("button",{className:"w-full text-left",onClick:()=>d(!u),children:[i.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[i.jsx("div",{className:"w-8 h-8 rounded-lg gradient-primary flex items-center justify-center",children:i.jsx(sr,{className:"w-4 h-4 text-primary-foreground"})}),i.jsxs("div",{className:"flex-1 min-w-0",children:[i.jsx("h4",{className:"font-bold text-foreground text-sm",children:e.name}),i.jsxs("p",{className:"text-xs text-muted-foreground",children:[o+l,"/",c," completed (",o," confident · ",l," practising)"]})]}),i.jsxs("span",{className:"text-sm font-extrabold text-primary",children:[a,"%"]}),u?i.jsx(Gr,{className:"w-4 h-4 text-muted-foreground shrink-0"}):i.jsx(Cr,{className:"w-4 h-4 text-muted-foreground shrink-0"})]}),i.jsxs("div",{className:"relative h-2.5 w-full rounded-full bg-secondary overflow-hidden",children:[i.jsx("div",{className:"absolute inset-y-0 left-0 rounded-full bg-success transition-all duration-500",style:{width:`${n}%`}}),i.jsx("div",{className:"absolute inset-y-0 rounded-full bg-warning/60 transition-all duration-500",style:{left:`${n}%`,width:`${s}%`}})]})]}),u&&i.jsx("div",{className:"mt-3 space-y-1.5",children:t.map(h=>{const m=r.find(b=>b.topic_id===h.id),f=(m==null?void 0:m.mastery_level)||"not_started";return i.jsxs("div",{className:"flex items-center gap-2 py-1.5 px-2 rounded-lg hover:bg-muted/50",children:[i.jsx("div",{className:`w-2 h-2 rounded-full shrink-0 ${f==="confident"?"bg-success":f==="practising"?"bg-warning":"bg-muted-foreground/30"}`}),i.jsx("span",{className:"flex-1 text-sm text-foreground truncate",children:h.name}),i.jsx("span",{className:`text-xs px-2 py-0.5 rounded-full font-medium ${f==="confident"?"bg-success/10 text-success":f==="practising"?"bg-warning/10 text-warning":"bg-muted text-muted-foreground"}`,children:od[f]})]},h.id)})})]})})},dy=[{value:"practice",label:"Practice Questions",icon:sr},{value:"revision",label:"Revision Session",icon:bn},{value:"timed_test",label:"Timed Test",icon:wn}],RD=({studentId:e,studentName:t,strands:r,onAssigned:n})=>{const{user:s}=st(),{toast:a}=en(),[o,l]=p.useState(""),[c,u]=p.useState("medium"),[d,h]=p.useState("practice"),[m,f]=p.useState(""),[b,g]=p.useState(!1),v=async()=>{var j;if(!s||!o){a({variant:"destructive",title:"Please select a topic"});return}g(!0);const x=r.find(k=>k.id===o),{data:y,error:w}=await F.from("teacher_assignments").insert({teacher_id:s.id,title:(x==null?void 0:x.name)||"Practice",description:`${(j=dy.find(k=>k.value===d))==null?void 0:j.label} assigned by parent`,topic_id:o,assignment_type:d,difficulty:c,due_date:m||null,status:"active"}).select().single();if(w||!y){a({variant:"destructive",title:"Failed to assign work",description:w==null?void 0:w.message}),g(!1);return}const{error:_}=await F.from("assignment_students").insert({assignment_id:y.id,student_id:e,status:"pending"});_?a({variant:"destructive",title:"Failed to assign to student",description:_.message}):(a({title:`Work assigned to ${t}! â
`}),l(""),f(""),n()),g(!1)};return i.jsx(z,{className:"shadow-card",children:i.jsxs(B,{className:"p-4",children:[i.jsx("div",{className:"flex items-center justify-between mb-1",children:i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(aa,{className:"w-5 h-5 text-primary"}),i.jsx("h3",{className:"font-bold text-foreground text-sm",children:"Assign Work"})]})}),i.jsxs("p",{className:"text-xs text-muted-foreground mb-4",children:["Set practice tasks and revision sessions for ",t]}),i.jsxs("div",{className:"space-y-3",children:[i.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[i.jsxs("div",{className:"space-y-1",children:[i.jsx(Ue,{className:"text-xs font-semibold",children:"Topic"}),i.jsxs(It,{value:o,onValueChange:l,children:[i.jsx(St,{className:"h-9 text-xs",children:i.jsx(Mt,{placeholder:"Choose a to
567pic"})}),i.jsx(Nt,{children:r.map(x=>i.jsx(Ce,{value:x.id,className:"text-xs",children:x.name},x.id))})]})]}),i.jsxs("div",{className:"space-y-1",children:[i.jsx(Ue,{className:"text-xs font-semibold",children:"Difficulty"}),i.jsxs(It,{value:c,onValueChange:u,children:[i.jsx(St,{className:"h-9 text-xs",children:i.jsx(Mt,{})}),i.jsxs(Nt,{children:[i.jsx(Ce,{value:"easy",className:"text-xs",children:"Easy"}),i.jsx(Ce,{value:"medium",className:"text-xs",children:"Medium"}),i.jsx(Ce,{value:"hard",className:"text-xs",children:"Hard"})]})]})]})]}),i.jsxs("div",{className:"space-y-1",children:[i.jsx(Ue,{className:"text-xs font-semibold",children:"Work Type"}),i.jsx("div",{className:"grid grid-cols-3 gap-2",children:dy.map(x=>{const y=x.icon;return i.jsxs("button",{onClick:()=>h(x.value),className:`flex flex-col items-center gap-1.5 p-2.5 rounded-xl border-2 transition-all text-center ${d===x.value?"border-primary bg-primary/5 text-primary":"border-border hover:bg-muted text-muted-foreground"}`,children:[i.jsx(y,{className:"w-4 h-4"}),i.jsx("span",{className:"text-[10px] font-semibold leading-tight",children:x.label})]},x.value)})})]}),i.jsxs("div",{className:"space-y-1",children:[i.jsx(Ue,{className:"text-xs font-semibold",children:"Due Date"}),i.jsx(et,{type:"date",value:m,onChange:x=>f(x.target.value),className:"h-9 text-xs",min:new Date().toISOString().split("T")[0]})]}),i.jsxs(ne,{onClick:v,disabled:b||!o,className:"w-full gradient-primary text-primary-foreground border-0 h-10",children:[b?i.jsx($e,{className:"w-4 h-4 animate-spin mr-2"}):i.jsx(aa,{className:"w-4 h-4 mr-2"}),"Assign Work to ",t]})]})]})})},jh=["Progress, not perfection. Every practice session counts.","Mistakes are proof that you're trying. Keep going!","The expert in anything was once a beginner.","Success is the sum of small efforts repeated day in and day out.","Believe you can and you're halfway there.","Every problem has a solution â you just haven't found it yet."],OD=["Create a calm study environment with regular breaks","Practice breathing exercises together (4-7-8 technique)","Remind them that one exam doesn't define their future","Celebrate small wins and progress, not just grades"],ID=["Set small, achievable daily goals rather than overwhelming targets","Use positive reinforcement and avoid comparing to others","Connect maths to their interests (gaming, sports, music)","Take regular breaks and ensure adequate sleep"],MD=({studentName:e})=>{const[t,r]=p.useState(0);return p.useEffect(()=>{const n=new Date().getDate();r(n%jh.length)},[]),i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{className:"grid grid-cols-1 gap-3",children:[i.jsx(z,{className:"shadow-card",children:i.jsxs(B,{className:"p-4",children:[i.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[i.jsx(Cn,{className:"w-4 h-4 text-accent"}),i.jsx("h4",{className:"font-bold text-foreground text-sm",children:"Managing Exam Anxiety"})]}),i.jsx("ul",{className:"space-y-2",children:OD.map((n,s)=>i.jsxs("li",{className:"flex items-start gap-2 text-xs text-muted-foreground",children:[i.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-accent mt-1.5 shrink-0"}),n]},s))})]})}),i.jsx(z,{className:"shadow-card",children:i.jsxs(B,{className:"p-4",children:[i.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[i.jsx(rn,{className:"w-4 h-4 text-primary"}),i.jsx("h4",{className:"font-bold text-foreground text-sm",children:"Motivation Strategies"})]}),i.jsx("ul",{className:"space-y-2",children:ID.map((n,s)=>i.jsxs("li",{className:"flex items-start gap-2 text-xs text-muted-foreground",children:[i.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-primary mt-1.5 shrink-0"}),n]},s))})]})})]}),i.jsx(z,{className:"shadow-card bg-primary/5 border-primary/10",children:i.jsxs(B,{className:"p-4",children:[i.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[i.jsx(sC,{className:"w-4 h-4 text-primary"}),i.jsx("h4",{className:"font-bold text-foreground text-sm",children:"Daily Motivation"})]}),i.jsx("div",{className:"grid grid-cols-1 gap-2",children:[t,(t+1)%jh.length].map(n=>i.jsx("div",{className:"bg-card rounded-lg p-3 border border-border",children:i.jsxs("p",{className:"text-sm text-foreground italic",children:['"',jh[n],'"']})},n))})]})}),i.jsx(z,{className:"shadow-card",children:i.jsxs(B,{className:"p-4",children:[i.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[i.jsx(_i,{className:"w-4 h-4 text-warning"}),i.jsx("h4",{className:"font-bold text-foreground text-sm",children:"How You Can Help at Home"})]}),i.jsxs("p",{className:"text-xs text-muted-foreground mb-3",children:["Simple ways to support ",e,"'s maths learning â no expertise needed."]}),i.jsx("div",{className:"space-y-2.5",children:[{tip:"Ask them to explain a topic to you â teaching deepens understanding",emoji:"ð£ï¸"},{tip:"Use real-world maths: cooking, shopping, budgeting, gaming stats",emoji:"ð "},{tip:"Review their study timetable together each weekend",emoji:"ð
"},{tip:"Praise effort and strategies, not just correct answers",emoji:"â"},{tip:"Keep exam mornings calm â a good breakfast and encouragement go far",emoji:"âï¸"}].map((n,s)=>i.jsxs("div",{className:"flex items-start gap-2.5 p-2.5 rounded-lg bg-muted/30",children:[i.jsx("span",{className:"text-base shrink-0",children:n.emoji}),i.jsx("p",{className:"text-xs text-foreground",children:n.tip})]},s))})]})})]})};var gd="Switch",[DD,_L]=Mr(gd),[LD,$D]=DD(gd),Gj=p.forwardRef((e,t)=>
567{const{__scopeSwitch:r,name:n,checked:s,defaultChecked:a,required:o,disabled:l,value:c="on",onCheckedChange:u,form:d,...h}=e,[m,f]=p.useState(null),b=Ee(t,w=>f(w)),g=p.useRef(!1),v=m?d||!!m.closest("form"):!0,[x,y]=xs({prop:s,defaultProp:a??!1,onChange:u,caller:gd});return i.jsxs(LD,{scope:r,checked:x,disabled:l,children:[i.jsx(ue.button,{type:"button",role:"switch","aria-checked":x,"aria-required":o,"data-state":Jj(x),"data-disabled":l?"":void 0,disabled:l,value:c,...h,ref:b,onClick:ae(e.onClick,w=>{y(_=>!_),v&&(g.current=w.isPropagationStopped(),g.current||w.stopPropagation())})}),v&&i.jsx(Qj,{control:m,bubbles:!g.current,name:n,value:c,checked:x,required:o,disabled:l,form:d,style:{transform:"translateX(-100%)"}})]})});Gj.displayName=gd;var Yj="SwitchThumb",Kj=p.forwardRef((e,t)=>{const{__scopeSwitch:r,...n}=e,s=$D(Yj,r);return i.jsx(ue.span,{"data-state":Jj(s.checked),"data-disabled":s.disabled?"":void 0,...n,ref:t})});Kj.displayName=Yj;var FD="SwitchBubbleInput",Qj=p.forwardRef(({__scopeSwitch:e,control:t,checked:r,bubbles:n=!0,...s},a)=>{const o=p.useRef(null),l=Ee(o,a),c=qp(r),u=_p(t);return p.useEffect(()=>{const d=o.current;if(!d)return;const h=window.HTMLInputElement.prototype,f=Object.getOwnPropertyDescriptor(h,"checked").set;if(c!==r&&f){const b=new Event("click",{bubbles:n});f.call(d,r),d.dispatchEvent(b)}},[c,r,n]),i.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}})});Qj.displayName=FD;function Jj(e){return e?"checked":"unchecked"}var Zj=Gj,UD=Kj;const Xj=p.forwardRef(({className:e,...t},r)=>i.jsx(Zj,{className:ce("peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors data-[state=checked]:bg-primary data-[state=unchecked]:bg-input focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50",e),...t,ref:r,children:i.jsx(UD,{className:ce("pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0")})}));Xj.displayName=Zj.displayName;function qD(e){const{user:t}=st(),[r,n]=p.useState(null),[s,a]=p.useState(!0),[o,l]=p.useState(!1),c=p.useCallback(async()=>{if(!t||!e){n(null),a(!1);return}const{data:d}=await F.from("report_preferences").select("*").eq("user_id",t.id).eq("student_id",e).maybeSingle();d&&n(d),a(!1)},[t,e]);return p.useEffect(()=>{c()},[c]),{preference:r,loading:s,saving:o,savePreference:async d=>{if(!t||!e)return{error:new Error("Not authenticated")};if(l(!0),r){const{error:h}=await F.from("report_preferences").update({frequency:d.frequency,delivery_method:d.delivery_method,delivery_contact:d.delivery_contact,is_active:d.is_active}).eq("id",r.id);return l(!1),h||n({...r,...d}),{error:h}}else{const{data:h,error:m}=await F.from("report_preferences").insert({user_id:t.id,student_id:e,frequency:d.frequency,delivery_method:d.delivery_method,delivery_contact:d.delivery_contact,is_active:d.is_active}).select().single();return l(!1),h&&n(h),{error:m}}},refetch:c}}const zD=[{value:"daily",label:"Every Day"},{value:"weekends",label:"Every Weekend"},{value:"weekly",label:"Weekly"},{value:"biweekly",label:"Bi-Weekly (Every 2 Weeks)"},{value:"monthly",label:"Monthly"},{value:"on_demand",label:"Whenever I Request"}],hy=[{value:"email",label:"Email",icon:cp,placeholder:"[email protected]"},{value:"sms",label:"Text Message (SMS)",icon:nC,placeholder:"+44 7xxx xxx xxx"},{value:"whatsapp",label:"WhatsApp",icon:X2,placeholder:"+44 7xxx xxx xxx"}],ek=({studentId:e,studentName:t})=>{const{preference:r,loading:n,saving:s,savePreference:a}=qD(e),{toast:o}=en(),[l,c]=p.useState("weekly"),[u,d]=p.useState("email"),[h,m]=p.useState(""),[f,b]=p.useState(!0),[g,v]=p.useState(!1);p.useEffect(()=>{r&&(c(r.frequency),d(r.delivery_method),m(r.delivery_contact||""),b(r.is_active))},[r]);const x=async()=>{if(!h.trim()){o({variant:"destructive",title:"Missing contact",description:"Please enter your contact details."});return}const{error:w}=await a({frequency:l,delivery_method:u,delivery_contact:h.trim(),is_active:f});w?o({variant:"destructive",title:"Save failed",description:"Could not save your preferences. Please try again."}):(v(!0),o({title:"Preferences saved! â
",description:`You'll receive ${t}'s progress report ${l==="on_demand"?"on request":l}.`}),setTimeout(()=>v(!1),3e3))},y=hy.find(w=>w.value===u);return n?i.jsx(z,{className:"shadow-card",children:i.jsx(B,{className:"p-4 flex justify-center",children:i.jsx($e,{className:"w-5 h-5 animate-spin text-primary"})})}):i.jsx(z,{className:"shadow-card",children:i.jsxs(B,{className:"p-4",children:[i.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[i.jsx(Xc,{className:"w-5 h-5 text-primary"}),i.jsx("h3",{className:"font-bold text-foreground",children:"Progress Report"})]}),i.jsxs("p",{className:"text-xs text-muted-foreground mb-4",children:["Receive a one-page PDF summary of ",t,"'s weekly progress, strengths, and areas to focus on."]}),i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx(Ue,{htmlFor:"report-active",className:"text-sm font-medium",children:"Enable progress reports"}),i.jsx(Xj,{id:"report-active",checked:f,onCheckedChange:b})]}),f&&i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"space-y-1.5",children:[i.jsx(Ue,{className:"text-sm font-medium",children:"How often?"}),i.jsxs(It,{value:l,onValueChange:c,children:[i.jsx(St,{children:i.jsx(Mt,{})}),i.jsx(Nt,{children:zD.map(w=>i.jsx(Ce,{value:w.value,children:w.label},w.value))})]})]}),i.jsxs("div",{className:"space-y-1.5",children:[i.jsx(Ue,{className:"text-sm font-medium",children:"How would you like to receive it?"}),i.jsx("div",{className:"grid grid-cols-3 gap-2",children:hy.map(w=>{const _=w.icon;return i.jsxs("button",{onClick:()=>
567d(w.value),className:`flex flex-col items-center gap-1.5 p-3 rounded-xl border-2 transition-all text-center ${u===w.value?"border-primary bg-primary/5 text-primary":"border-border hover:bg-muted text-muted-foreground"}`,children:[i.jsx(_,{className:"w-5 h-5"}),i.jsx("span",{className:"text-xs font-semibold",children:w.label})]},w.value)})})]}),i.jsxs("div",{className:"space-y-1.5",children:[i.jsxs(Ue,{className:"text-sm font-medium",children:["Your ",(y==null?void 0:y.label)||"contact"]}),i.jsx(et,{value:h,onChange:w=>m(w.target.value),placeholder:(y==null?void 0:y.placeholder)||"Enter contact details",className:"h-11"})]}),i.jsxs("div",{className:"bg-muted/50 rounded-lg p-3",children:[i.jsx("p",{className:"text-xs font-semibold text-foreground mb-2",children:"ð Your report will include:"}),i.jsxs("ul",{className:"text-xs text-muted-foreground space-y-1",children:[i.jsx("li",{children:"â
Overall GCSE topic completion percentage"}),i.jsx("li",{children:"ð Strengths and areas needing improvement"}),i.jsx("li",{children:"ð Quiz scores and accuracy trends"}),i.jsx("li",{children:"ð Mood and wellbeing summary"}),i.jsx("li",{children:"ð
Study timetable adherence"}),i.jsx("li",{children:"ð¯ Recommended focus areas for the next period"})]})]}),i.jsxs(ne,{onClick:x,disabled:s,className:"w-full gradient-primary text-primary-foreground border-0 h-11",children:[s?i.jsx($e,{className:"w-4 h-4 animate-spin mr-2"}):g?i.jsx(lr,{className:"w-4 h-4 mr-2"}):i.jsx(Xc,{className:"w-4 h-4 mr-2"}),g?"Saved!":r?"Update Preferences":"Save Preferences"]})]})]})]})})},tk=({studentId:e,studentName:t,activeTab:r,onTabChange:n})=>{const{topicProgress:s,quizStats:a,timetableEntries:o,loading:l}=_D(e),{strands:c,subtopics:u,getSubtopics:d,loading:h}=ld(),{moodLogs:m,loading:f}=jD(e),{upcomingAssignments:b,loading:g,refetch:v}=kD(e),{badgeCount:x}=SD(e),{profile:y}=ND(e);if(l||h)return i.jsx("div",{className:"flex items-center justify-center py-12",children:i.jsx($e,{className:"w-6 h-6 animate-spin text-primary"})});const w=s.filter(k=>k.mastery_level==="confident").length,_=s.filter(k=>k.mastery_level==="practising").length,j=u.length>0?Math.round((w+_)/u.length*100):0;return i.jsxs("div",{className:"space-y-5",children:[i.jsx(z,{className:"shadow-card overflow-hidden",children:i.jsxs(B,{className:"p-4",children:[i.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[i.jsx("div",{className:"w-10 h-10 rounded-xl gradient-primary flex items-center justify-center",children:i.jsx("span",{className:"text-primary-foreground font-bold text-lg",children:t.charAt(0).toUpperCase()})}),i.jsxs("div",{className:"flex-1",children:[i.jsxs("h2",{className:"font-bold text-foreground",children:[t,"'s Dashboard"]}),i.jsx("p",{className:"text-xs text-muted-foreground",children:"Track your child's GCSE maths journey"})]})]}),i.jsx(sn,{value:j,className:"h-2"}),i.jsxs("p",{className:"text-[11px] text-muted-foreground mt-1.5",children:[j,"% overall completion"]})]})}),i.jsxs(wl,{value:r,onValueChange:n,children:[i.jsxs(qi,{className:"w-full",children:[i.jsxs(it,{value:"overview",className:"flex-1 text-xs",children:[i.jsx(yb,{className:"w-3 h-3 mr-1"}),"Overview"]}),i.jsxs(it,{value:"progress",className:"flex-1 text-xs",children:[i.jsx(sr,{className:"w-3 h-3 mr-1"}),"Progress"]}),i.jsxs(it,{value:"tasks",className:"flex-1 text-xs",children:[i.jsx(bi,{className:"w-3 h-3 mr-1"}),"Tasks"]}),i.jsxs(it,{value:"support",className:"flex-1 text-xs",children:[i.jsx(Cn,{className:"w-3 h-3 mr-1"}),"Support"]})]}),i.jsxs(rr,{value:"overview",className:"space-y-4 mt-4",children:[i.jsx(CD,{topicProgress:s,subtopics:u,quizStats:a,targetGrade:(y==null?void 0:y.target_grade)||null,currentGrade:(y==null?void 0:y.current_grade)||null,badges:x}),i.jsx(ED,{strands:c,topicProgress:s,getSubtopics:d}),i.jsx(cy,{assignments:b,loading:g,studentName:t}),i.jsx(PD,{moodLogs:m,loading:f,studentName:t})]}),i.jsxs(rr,{value:"progress",className:"space-y-3 mt-4",children:[i.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[i.jsx(sr,{className:"w-5 h-5 text-primary"}),i.jsx("h3",{className:"text-sm font-bold text-foreground",children:"Strand-by-Strand Progress"})]}),i.jsxs("p",{className:"text-xs text-muted-foreground mb-3",children:["Detailed breakdown of ",t,"'s mastery across every GCSE strand"]}),c.map(k=>{const S=d(k.id),C=S.filter(O=>{var M;return((M=s.find(R=>R.topic_id===O.id))==null?void 0:M.mastery_level)==="confident"}).length,P=S.filter(O=>{var M;return((M=s.find(R=>R.topic_id===O.id))==null?void 0:M.mastery_level)==="practising"}).length,T=S.length>0?Math.round(C/S.length*100):0,$=S.length>0?Math.round(P/S.length*100):0;
567return i.jsx(AD,{strand:k,subtopics:S,topicProgress:s,confidentPercent:T,practisingPercent:$,completedPercent:T+$,confidentCount:C,practisingCount:P,totalCount:S.length},k.id)})]}),i.jsxs(rr,{value:"tasks",className:"space-y-4 mt-4",children:[i.jsx(RD,{studentId:e,studentName:t,strands:c,onAssigned:v}),i.jsx(cy,{assignments:b,loading:g,studentName:t})]}),i.jsxs(rr,{value:"support",className:"space-y-4 mt-4",children:[i.jsx(ek,{studentId:e,studentName:t}),i.jsx(MD,{studentName:t})]})]})]})},BD=()=>{const[e,t]=p.useState(!0),[r,n]=p.useState(null),[s,a]=p.useState("overview"),{user:o,signOut:l}=st(),{linkedStudents:c,loading:u}=Yp();p.useEffect(()=>{c.length>0&&!r&&n(c[0].student_id)},[c,r]),p.useEffect(()=>{t(!1)},[o]);const d=c.find(h=>h.student_id===r);return e||u?i.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center",children:i.jsx($e,{className:"w-8 h-8 animate-spin text-primary"})}):i.jsxs("div",{className:"min-h-screen bg-background pb-20",children:[i.jsx("header",{className:"bg-card border-b border-border sticky top-0 z-50",children:i.jsxs("div",{className:"container mx-auto px-4 py-3 flex items-center justify-between max-w-2xl",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("div",{className:"w-8 h-8 rounded-lg gradient-primary flex items-center justify-center",children:i.jsx(Ar,{className:"w-5 h-5 text-primary-foreground"})}),i.jsx("span",{className:"text-lg font-bold text-foreground",children:"Mathly"}),i.jsx("span",{className:"text-xs px-2 py-0.5 rounded-full bg-accent/10 text-accent font-medium",children:"Parent"})]}),i.jsx(ne,{variant:"ghost",size:"icon",onClick:l,children:i.jsx(eu,{className:"w-5 h-5"})})]})}),i.jsxs("main",{className:"container mx-auto px-4 py-6 max-w-2xl",children:[i.jsxs("section",{className:"mb-6",children:[i.jsx("h1",{className:"text-2xl font-bold text-foreground mb-1",children:"Parent Dashboard ð¨âð©âð§"}),i.jsx("p",{className:"text-muted-foreground text-sm",children:"Monitor your child's progress and support their learning journey."})]}),i.jsx(Vj,{}),c.length>1&&i.jsxs("section",{className:"mb-6",children:[i.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[i.jsx(wt,{className:"w-5 h-5 text-primary"}),i.jsx("h2",{className:"text-sm font-bold text-foreground",children:"Select Child"})]}),i.jsx("div",{className:"flex gap-2 overflow-x-auto pb-1",children:c.map(h=>i.jsx("button",{onClick:()=>n(h.student_id),className:`flex items-center gap-2 px-4 py-2 rounded-xl text-sm font-bold transition-all whitespace-nowrap ${r===h.student_id?"gradient-primary text-primary-foreground shadow-soft":"bg-muted text-muted-foreground hover:bg-secondary"}`,children:h.profile.display_name||"Student"},h.student_id))})]}),d&&r&&i.jsx(tk,{studentId:r,studentName:d.profile.display_name||"Student",activeTab:s,onTabChange:a}),c.length===0&&i.jsx("section",{children:i.jsx(z,{className:"border-dashed",children:i.jsxs(B,{className:"p-6 text-center",children:[i.jsx(tn,{className:"w-10 h-10 text-muted-foreground mx-auto mb-3"}),i.jsx("h3",{className:"font-bold text-foreground mb-1",children:"Get Started"}),i.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:"Enter your child's link code above to view their progress, mood, and study plans."})]})})})]})]})};function WD(e){const{user:t}=st(),[r,n]=p.useState([]),[s,a]=p.useState({totalStudents:0,activeAssignments:0,classAverage:0,totalCompletions:0}),[o,l]=p.useState([]),[c,u]=p.useState(!0),d=p.useCallback(async()=>{if(!t||e.length===0){u(!1);return}u(!0);const h=e.map(M=>M.student_id),[m,f,b,g,v]=await Promise.all([F.from("topic_progress").select("*").in("user_id",h),F.from("quiz_attempts").select("*").in("user_id",h),F.from("student_interests").select("*").in("user_id",h),F.from("teacher_assignments").select("*, assignment_students(*)").eq("teacher_id",t.id),F.from("topics").select("*").order("order_index",{ascending:!0})]),x=m.data||[],y=f.data||[],w=b.data||[],_=g.data||[],j=v.data||[],k=j.filter(M=>M.parent_topic_id!==null),S=j.filter(M=>M.parent_topic_id===null),C=e.map(M=>{const R=x.filter(W=>W.user_id===M.student_id),U=y.filter(W=>W.user_id===M.student_id),N=w.filter(W=>W.user_id===M.student_id).map(W=>W.interest),D=U.length,E=U.reduce((W,se)=>W+(se.score||0),0),A=U.reduce((W,se)=>W+(se.total_questions||0),0),Y=A>0?Math.round(E/A*100):0,te=R.filter(W=>W.mastery_level==="confident"||W.mastery_level==="practising").length;return{studentId:M.student_id,name:M.profile.display_name||"Student",xp:M.profile.xp||0,topicProgress:R,quizzesTaken:D,avgScore:Y,interests:N,completedTopics:te,totalTopics:k.length}});C.sort((M,R)=>R.xp-M.xp),n(C);const P=_.filter(M=>M.status==="active").length,T=x.filter(M=>M.mastery_level==="confident"||M.mastery_level==="practising").length,$=C.length>0?Math.round(C.reduce((M,R)=>M+R.avgScore,0)/C.length):0;a({totalStudents:e.length,activeAssignments:P,classAverage:$,totalCompletions:T});const O=S.map(M=>{const R=k.filter(A=>A.parent_topic_id===M.id),U=R.map(A=>A.id);let N=0;const D=[];
567C.forEach(A=>{const Y=A.topicProgress.filter(I=>U.includes(I.topic_id)),te=Y.filter(I=>I.mastery_level==="confident").length,W=Y.filter(I=>I.mastery_level==="practising").length,se=R.length>0?Math.round((te+W)/R.length*100):0;N+=se,se<50&&D.push(A.name)});const E=C.length>0?Math.round(N/C.length):0;return{topicId:M.id,topicName:M.name,avgPercent:E,studentsNeedingSupport:D,totalStudents:C.length}});l(O),u(!1)},[t,e]);return p.useEffect(()=>{d()},[d]),{studentsData:r,classStats:s,topicPerformance:o,loading:c,refetch:d}}function HD(){const{user:e}=st(),[t,r]=p.useState([]),[n,s]=p.useState([]),[a,o]=p.useState(!0),l=p.useCallback(async()=>{if(!e)return;o(!0);const[d,h]=await Promise.all([F.from("teacher_assignments").select("*, assignment_students(*)").eq("teacher_id",e.id).order("created_at",{ascending:!1}),F.from("teacher_groups").select("*, teacher_group_members(*)").eq("teacher_id",e.id).order("created_at",{ascending:!1})]);d.data&&r(d.data.map(m=>({id:m.id,title:m.title,description:m.description,topic_id:m.topic_id,difficulty:m.difficulty,assignment_type:m.assignment_type,due_date:m.due_date,status:m.status,created_at:m.created_at,students:(m.assignment_students||[]).map(f=>({id:f.id,student_id:f.student_id,status:f.status,score:f.score,completed_at:f.completed_at}))}))),h.data&&s(h.data.map(m=>({id:m.id,name:m.name,description:m.description,group_type:m.group_type,created_at:m.created_at,members:(m.teacher_group_members||[]).map(f=>({id:f.id,student_id:f.student_id,created_at:f.created_at}))}))),o(!1)},[e]);return p.useEffect(()=>{l()},[l]),{assignments:t,groups:n,loading:a,createAssignment:async d=>{if(!e)return{error:new Error("Not authenticated")};const{data:h,error:m}=await F.from("teacher_assignments").insert({teacher_id:e.id,title:d.title,description:d.description||null,topic_id:d.topic_id||null,difficulty:d.difficulty,assignment_type:d.assignment_type,due_date:d.due_date||null}).select().single();if(m||!h)return{error:m||new Error("Failed to create")};if(d.student_ids.length>0){const{error:f}=await F.from("assignment_students").insert(d.student_ids.map(b=>({assignment_id:h.id,student_id:b})));if(f)return{error:f}}return await l(),{error:null}},createGroup:async d=>{if(!e)return{error:new Error("Not authenticated")};const{data:h,error:m}=await F.from("teacher_groups").insert({teacher_id:e.id,name:d.name,description:d.description||null,group_type:d.group_type||"custom"}).select().single();if(m||!h)return{error:m||new Error("Failed to create")};if(d.student_ids.length>0){const{error:f}=await F.from("teacher_group_members").insert(d.student_ids.map(b=>({group_id:h.id,student_id:b})));if(f)return{error:f}}return await l(),{error:null}},refetch:l}}const fy=({stats:e})=>{const t=[{label:"Total Students",value:e.totalStudents,sub:"Active learners",icon:wt,color:"text-primary",bgColor:"bg-primary/10"},{label:"Active Assignments",value:e.activeAssignments,sub:"In progress",icon:bi,color:"text-accent",bgColor:"bg-accent/10"},{label:"Class Average",value:`${e.classAverage}%`,sub:"Overall performance",icon:rn,color:"text-success",bgColor:"bg-success/10"},{label:"Completions",value:e.totalCompletions,sub:"Topics progressed",icon:mb,color:"text-xp",bgColor:"bg-xp/10"}];return i.jsx("div",{className:"grid grid-cols-2 gap-3",children:t.map(r=>i.jsx(z,{className:"shadow-card",children:i.jsxs(B,{className:"p-4",children:[i.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[i.jsx("div",{className:`w-8 h-8 rounded-lg ${r.bgColor} flex items-center justify-center`,children:i.jsx(r.icon,{className:`w-4 h-4 ${r.color}`})}),i.jsx("p",{className:"text-xs font-semibold text-muted-foreground",children:r.label})]}),i.jsx("p",{className:"text-2xl font-extrabold text-foreground",children:r.value}),i.jsx("p",{className:"text-[10px] text-muted-foreground mt-1",children:r.sub})]})},r.label))})},VD=({onCreateAssignment:e,onCreateGroup:t,onViewReports:r})=>{const n=[{label:"Create Assignment",sub:"Assign new worksheets",icon:aa,onClick:e,primary:!0},{label:"Group Exercise",sub:"Create group activities",icon:wt,onClick:t,primary:!1},{label:"View Reports",sub:"Detailed analytics",icon:Xc,onClick:r,primary:!1}];return i.jsxs("section",{children:[i.jsx("h2",{className:"text-lg font-bold text-foreground mb-3",children:"Qu
567ick Actions"}),i.jsx("div",{className:"grid grid-cols-3 gap-2",children:n.map(s=>i.jsx(z,{className:`cursor-pointer transition-colors shadow-card hover:border-primary/50 ${s.primary?"gradient-primary border-0":""}`,onClick:s.onClick,children:i.jsxs(B,{className:"p-3 text-center",children:[i.jsx(s.icon,{className:`w-5 h-5 mx-auto mb-1.5 ${s.primary?"text-primary-foreground":"text-muted-foreground"}`}),i.jsx("p",{className:`text-xs font-bold ${s.primary?"text-primary-foreground":"text-foreground"}`,children:s.label}),i.jsx("p",{className:`text-[10px] mt-0.5 ${s.primary?"text-primary-foreground/70":"text-muted-foreground"}`,children:s.sub})]})},s.label))})]})},GD=({students:e,onSelectStudent:t})=>e.length===0?null:i.jsxs("section",{children:[i.jsx("div",{className:"flex items-center justify-between mb-3",children:i.jsx("h2",{className:"text-lg font-bold text-foreground",children:"Student Progress"})}),i.jsx("div",{className:"grid grid-cols-1 gap-3",children:e.map((r,n)=>{const s=r.totalTopics>0?Math.round(r.completedTopics/r.totalTopics*100):0;return i.jsx(z,{className:"shadow-card cursor-pointer hover:border-primary/50 transition-colors",onClick:()=>t(r.studentId),children:i.jsxs(B,{className:"p-4",children:[i.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[i.jsx("div",{className:"w-10 h-10 rounded-full bg-muted flex items-center justify-center",children:i.jsx(jb,{className:"w-5 h-5 text-muted-foreground"})}),i.jsx("div",{className:"flex-1 min-w-0",children:i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("h3",{className:"font-bold text-foreground text-sm truncate",children:r.name}),i.jsxs(Ir,{variant:"outline",className:"text-[10px] px-1.5 py-0 border-xp/30 text-xp",children:[i.jsx(fp,{className:"w-2.5 h-2.5 mr-0.5"}),r.xp," pts"]})]})})]}),i.jsxs("div",{className:"flex items-center justify-between text-xs text-muted-foreground mb-1.5",children:[i.jsx("span",{children:"Progress"}),i.jsxs("span",{className:"font-bold",children:[r.completedTopics,"/",r.totalTopics]})]}),i.jsx(sn,{value:s,className:"h-2 mb-3"}),i.jsxs("div",{className:"flex items-center gap-4 mb-3",children:[i.jsxs("div",{className:"flex items-center gap-1 text-xs",children:[i.jsx(rn,{className:"w-3 h-3 text-success"}),i.jsx("span",{className:"text-muted-foreground",children:"Avg Score"}),i.jsxs("span",{className:"font-extrabold text-foreground",children:[r.avgScore,"%"]})]}),i.jsxs("div",{className:"flex items-center gap-1 text-xs",children:[i.jsx(hb,{className:"w-3 h-3 text-warning"}),i.jsx("span",{className:"text-muted-foreground",children:"Rank"}),i.jsxs("span",{className:"font-extrabold text-foreground",children:["#",n+1]})]})]}),r.interests.length>0&&i.jsx("div",{className:"flex flex-wrap gap-1.5",children:r.interests.slice(0,4).map(a=>i.jsx(Ir,{variant:"secondary",className:"text-[10px] px-2 py-0.5 font-medium",children:a},a))})]})},r.studentId)})})]}),YD=e=>e>=80?"bg-success/15 text-success":e>=60?"bg-warning/15 text-warning":"bg-destructive/15 text-destructive",KD=({performance:e})=>e.length===0?null:i.jsxs("section",{children:[i.jsx("h2",{className:"text-lg font-bold text-foreground mb-1",children:"Class Performance by Topic"}),i.jsx("p",{className:"text-xs text-muted-foreground mb-4",children:"Average scores and students needing support"}),i.jsx(z,{className:"shadow-card",children:i.jsx(B,{className:"p-4 space-y-5",children:e.map(t=>i.jsxs("div",{children:[i.jsxs("div",{className:"flex items-center gap-2 mb-1.5",children:[i.jsx("h3",{className:"font-bold text-foreground text-sm",children:t.topicName}),i.jsxs(Ir,{variant:"secondary",className:`text-[10px] px-2 py-0 font-bold ${YD(t.avgPercent)}`,children:[t.avgPercent,"% avg"]}),i.jsxs("span",{className:"ml-auto text-xs text-muted-foreground",children:[t.studentsNeedingSupport.length," student",t.studentsNeedingSupport.length!==1?"s":""," need",t.studentsNeedingSupport.length===1?"s":""," support"]})]}),i.jsx("div",{className:"relative h-2.5 w-full rounded-full bg-secondary overflow-hidden mb-2",children:i.jsx("div",{className:"absolute inset-y-0 left-0 rounded-full bg-foreground transition-all duration-500",style:{width:`${t.avgPercent}%`}})}),t.studentsNeedingSupport.length>0&&i.jsx("div",{className:"flex flex-wrap gap-1.5",children:t.studentsNeedingSupport.map(r=>i.jsx(Ir,{variant:"outline",className:"text-[10px] px-2 py-0.5 font-medium",children:r},r))})]},t.topicId))})})]}),QD=({assignments:e,students:t})=>e.length===0?i.jsx(z,{className:"border-dashed",children:i.jsxs(B,{className:"p-6 text-center",children:[i.jsx(bi,{className:"w-8 h-8 text-muted-foreground mx-auto mb-2"}),i.jsx("p",{className:"text-sm text-muted-foreground",children:"No assignments yet. Create one to get started."})]})}):i.jsx("div",{className:"space-y-3",children:e.map(r=>{const n=r.students.filter(o=>o.status==="completed").length,s=r.students.length,a=s>0?Math.round(n/s*100):0;return i.jsx(z,{className:"shadow-card",children:i.jsxs(B,{className:"p-4",children:[i.jsxs("div",{className:"flex items-start justify-between mb-2",children:[i.jsxs("div",{children:[i.jsx("h3",{className:"font-bold text-foreground text-sm",children:r.title}),r.description&&i.jsx("p",{className:"text-xs text-muted-foreground mt-0.5 line-clamp-2",children:r.description})]}),i.jsxs("div",{className:"flex gap-1.5",children:[i.jsx(Ir,{variant:"secondary",className:`text-[10px] ${r.assignment_type==="group"?"bg-accent/10 text-accent":"bg-primary/10 text-primary"}`,children:r.assignment_type}),i.jsx(Ir,{variant:"secondary",className:"text-[10px] bg-warning/10 text-warning",children:r.difficulty})]})]}),i.jsxs("div",{className:"flex items-center gap-4 text-xs text-muted-foreground mb-2",children:[i.jsxs("span",{className:"flex items-center gap-1",children:[i.jsx(wt,{className:"w-3 h-3"}),s," student",s!==1?"s":""]}),i.jsxs("span",{className:"flex items-center gap-1",children:[i.jsx(mb,{className:"w-3 h-3 text-success"}),n,"/",s," completed"]}),r.due_date&&i.jsxs("span",{className:"flex items-center gap-1",children:[i.jsx(wn,{className:"w-3 h-3"}),"Due ",Su(new Date(r.due_date),"dd MMM")]})]}),i.jsx(sn,{value:a,className:"h-2"})]})},r.id)})}),JD=({groups:e,students:t})=>{if(e.length===0)return i.jsx(z,{className:"border-dashed",children:i.jsxs(B,{className:"p-6 text-center",children:[i.jsx(wt,{className:"w-8 h-8 text-muted-foreground mx-auto mb-2"}),i.jsx("p",{className:"text-sm text-muted-foreground",children:"No groups yet. Create one to organise students."})]})});const r=n=>{var s;return((s=t.find(a=>a.student_id===n))==null?void 0:s.profile.display_name)||"Student"};return i.jsx("div",{className:"space-y-3",children:e.map(n=>i.jsx(z,{className:"shadow-card",children:i.jsxs(B,{className:"p-4",children:[i.jsx("h3",{className:"font-bold text-foreground text-sm mb-1",children:n.name}),n.description&&i.jsx("p",{className:"text-xs text-muted-foreground mb-2",children:n.description}),i.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground mb-2",children:[i.jsx(wt,{className:"w-3 h-3"}),n.members.length," member",n.members.length!==1?"s":""]}),i.jsx("div",{className:"flex flex-wrap gap-1.5",children:n.members.map(s=>i.jsx("span",{className:"text-[10px] px-2 py-0.5 rounded-full bg-secondary text-secondary-foreground font-medium",children:r(s.student_id)},s.id))})]})},n.id))})};var xd="Checkbox",[ZD,jL]=Mr(xd),[XD,Kp]=ZD(xd);function eL(e){const{__scopeCheckbox:t,checked:r,children:n,defaultChecked:s,disabled:a,form:o,name:l,onCheckedChange:c,required:u,value:d="on",internal_do_not_use_render:h}=e,[m,f]=xs({prop:r,defaultProp:s??!1,onChange:c,caller:xd}),[b,g]=p.useState(null),[v,x]=p.useState(null),y=p.useRef(!1),w=b?!!o||!!b.closest("form"):!0,_={checked:m,disabled:a,setChecked:f,control:b,setControl:g,name:l,form:o,value:d,hasConsumerStoppedPropagationRef:y,required:u,defaultChecked:ms(s)?!1:s,isFormControl:w,bubbleInput:v,setBubbleInput:x};return i.jsx(XD,{scope:t,..._,children:tL(h)?h(_):n})}
567var rk="CheckboxTrigger",nk=p.forwardRef(({__scopeCheckbox:e,onKeyDown:t,onClick:r,...n},s)=>{const{control:a,value:o,disabled:l,checked:c,required:u,setControl:d,setChecked:h,hasConsumerStoppedPropagationRef:m,isFormControl:f,bubbleInput:b}=Kp(rk,e),g=Ee(s,d),v=p.useRef(c);return p.useEffect(()=>{const x=a==null?void 0:a.form;if(x){const y=()=>h(v.current);return x.addEventListener("reset",y),()=>x.removeEventListener("reset",y)}},[a,h]),i.jsx(ue.button,{type:"button",role:"checkbox","aria-checked":ms(c)?"mixed":c,"aria-required":u,"data-state":lk(c),"data-disabled":l?"":void 0,disabled:l,value:o,...n,ref:g,onKeyDown:ae(t,x=>{x.key==="Enter"&&x.preventDefault()}),onClick:ae(r,x=>{h(y=>ms(y)?!0:!y),b&&f&&(m.current=x.isPropagationStopped(),m.current||x.stopPropagation())})})});nk.displayName=rk;var Qp=p.forwardRef((e,t)=>{const{__scopeCheckbox:r,name:n,checked:s,defaultChecked:a,required:o,disabled:l,value:c,onCheckedChange:u,form:d,...h}=e;return i.jsx(eL,{__scopeCheckbox:r,checked:s,defaultChecked:a,disabled:l,required:o,onCheckedChange:u,name:n,form:d,value:c,internal_do_not_use_render:({isFormControl:m})=>i.jsxs(i.Fragment,{children:[i.jsx(nk,{...h,ref:t,__scopeCheckbox:r}),m&&i.jsx(ok,{__scopeCheckbox:r})]})})});Qp.displayName=xd;var sk="CheckboxIndicator",ak=p.forwardRef((e,t)=>{const{__scopeCheckbox:r,forceMount:n,...s}=e,a=Kp(sk,r);return i.jsx(Ns,{present:n||ms(a.checked)||a.checked===!0,children:i.jsx(ue.span,{"data-state":lk(a.checked),"data-disabled":a.disabled?"":void 0,...s,ref:t,style:{pointerEvents:"none",...e.style}})})});ak.displayName=sk;var ik="CheckboxBubbleInput",ok=p.forwardRef(({__scopeCheckbox:e,...t},r)=>{const{control:n,hasConsumerStoppedPropagationRef:s,checked:a,defaultChecked:o,required:l,disabled:c,name:u,value:d,form:h,bubbleInput:m,setBubbleInput:f}=Kp(ik,e),b=Ee(r,f),g=qp(a),v=_p(n);p.useEffect(()=>{const y=m;if(!y)return;const w=window.HTMLInputElement.prototype,j=Object.getOwnPropertyDescriptor(w,"checked").set,k=!s.current;if(g!==a&&j){const S=new Event("click",{bubbles:k});y.indeterminate=ms(a),j.call(y,ms(a)?!1:a),y.dispatchEvent(S)}},[m,g,a,s]);const x=p.useRef(ms(a)?!1:a);return i.jsx(ue.input,{type:"checkbox","aria-hidden":!0,defaultChecked:o??x.current,required:l,disabled:c,name:u,value:d,form:h,...t,tabIndex:-1,ref:b,style:{...t.style,...v,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});ok.displayName=ik;function tL(e){return typeof e=="function"}function ms(e){return e==="indeterminate"}function lk(e){return ms(e)?"indeterminate":e?"checked":"unchecked"}const al=p.forwardRef(({className:e,...t},r)=>i.jsx(Qp,{ref:r,className:ce("peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background data-[state=checked]:bg-primary data-[state=checked]:text-primary-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),...t,children:i.jsx(ak,{className:ce("flex items-center justify-center text-current"),children:i.jsx(pl,{className:"h-4 w-4"})})}));al.displayName=Qp.displayName;const rL=({open:e,onOpenChange:t,students:r,strands:n,onSubmit:s})=>{const[a,o]=p.useState(""),[l,c]=p.useState(""),[u,d]=p.useState(""),[h,m]=p.useState("medium"),[f,b]=p.useState("individual"),[g,v]=p.useState(""),[x,y]=p.useState([]),[w,_]=p.useState(!1),[j,k]=p.useState(!1),S=T=>{_(T),y(T?r.map($=>$.student_id):[])},C=T=>{y($=>$.includes(T)?$.filter(O=>O!==T):[...$,T]),_(!1)},P=async()=>{!a.trim()||x.length===0||(k(!0),await s({title:a.trim(),description:l.trim()||void 0,topic_id:u||void 0,difficulty:h,assignment_type:f,due_date:g||void 0,student_ids:x}),o(""),c(""),d(""),m("medium"),b("individual"),v(""),y([]),_(!1),k(!1),t(!1))};return i.jsx(Sn,{open:e,onOpenChange:t,children:i.jsxs(Jr,{className:"max-w-md max-h-[90vh] overflow-y-auto",children:[i.jsx(Zr,{children:i.jsx(Xr,{children:"Create Assignment"})}),i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{children:[i.jsx(Ue,{className:"text-xs font-bold",children:"Title *"}),i.jsx(et,{value:a,onChange:T=>o(T.target.value),placeholder:"e.g. Algebra Practice Sheet",className:"mt-1"})]}),i.jsxs("div",{children:[i.jsx(Ue,{className:"text-xs font-bold",children:"Description"}
567),i.jsx(pd,{value:l,onChange:T=>c(T.target.value),placeholder:"What students need to do...",className:"mt-1",rows:2})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[i.jsxs("div",{children:[i.jsx(Ue,{className:"text-xs font-bold",children:"Topic"}),i.jsxs(It,{value:u,onValueChange:d,children:[i.jsx(St,{className:"mt-1",children:i.jsx(Mt,{placeholder:"Select topic"})}),i.jsx(Nt,{children:n.map(T=>i.jsx(Ce,{value:T.id,children:T.name},T.id))})]})]}),i.jsxs("div",{children:[i.jsx(Ue,{className:"text-xs font-bold",children:"Difficulty"}),i.jsxs(It,{value:h,onValueChange:m,children:[i.jsx(St,{className:"mt-1",children:i.jsx(Mt,{})}),i.jsxs(Nt,{children:[i.jsx(Ce,{value:"easy",children:"Easy"}),i.jsx(Ce,{value:"medium",children:"Medium"}),i.jsx(Ce,{value:"hard",children:"Hard"})]})]})]})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[i.jsxs("div",{children:[i.jsx(Ue,{className:"text-xs font-bold",children:"Type"}),i.jsxs(It,{value:f,onValueChange:b,children:[i.jsx(St,{className:"mt-1",children:i.jsx(Mt,{})}),i.jsxs(Nt,{children:[i.jsx(Ce,{value:"individual",children:"Individual"}),i.jsx(Ce,{value:"group",children:"Group"})]})]})]}),i.jsxs("div",{children:[i.jsx(Ue,{className:"text-xs font-bold",children:"Due Date"}),i.jsx(et,{type:"date",value:g,onChange:T=>v(T.target.value),className:"mt-1"})]})]}),i.jsxs("div",{children:[i.jsx(Ue,{className:"text-xs font-bold mb-2 block",children:"Assign to Students *"}),i.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[i.jsx(al,{checked:w,onCheckedChange:T=>S(T===!0),id:"select-all"}),i.jsxs("label",{htmlFor:"select-all",className:"text-xs font-medium text-muted-foreground cursor-pointer",children:["Select all (",r.length,")"]})]}),i.jsx("div",{className:"max-h-32 overflow-y-auto space-y-1.5 border rounded-lg p-2",children:r.map(T=>i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(al,{checked:x.includes(T.student_id),onCheckedChange:()=>C(T.student_id),id:`student-${T.student_id}`}),i.jsx("label",{htmlFor:`student-${T.student_id}`,className:"text-sm cursor-pointer text-foreground",children:T.profile.display_name||"Student"})]},T.student_id))})]}),i.jsxs(ne,{onClick:P,disabled:j||!a.trim()||x.length===0,className:"w-full gradient-primary text-primary-foreground border-0",children:[j?i.jsx($e,{className:"w-4 h-4 animate-spin mr-2"}):null,"Create Assignment"]})]})]})})},nL=({open:e,onOpenChange:t,students:r,onSubmit:n})=>{const[s,a]=p.useState(""),[o,l]=p.useState(""),[c,u]=p.useState("custom"),[d,h]=p.useState([]),[m,f]=p.useState(!1),[b,g]=p.useState(!1),v=w=>{f(w),h(w?r.map(_=>_.student_id):[])},x=w=>{h(_=>_.includes(w)?_.filter(j=>j!==w):[..._,w]),f(!1)},y=async()=>{!s.trim()||d.length===0||(g(!0),await n({name:s.trim(),description:o.trim()||void 0,group_type:c,student_ids:d}),a(""),l(""),u("custom"),h([]),f(!1),g(!1),t(!1))};return i.jsx(Sn,{open:e,onOpenChange:t,children:i.jsxs(Jr,{className:"max-w-md max-h-[90vh] overflow-y-auto",children:[i.jsx(Zr,{children:i.jsx(Xr,{children:"Create Group Exercise"})}),i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{children:[i.jsx(Ue,{className:"text-xs font-bold",children:"Group Name *"}),i.jsx(et,{value:s,onChange:w=>a(w.target.value),placeholder:"e.g. Team Alpha",className:"mt-1"})]}),i.jsxs("div",{children:[i.jsx(Ue,{className:"text-xs font-bold",children:"Description"}),i.jsx(pd,{value:o,onChange:w=>l(w.target.value),placeholder:"Group activity description...",className:"mt-1",rows:2})]}),i.jsxs("div",{children:[i.jsx(Ue,{className:"text-xs font-bold",children:"Group Type"}),i.jsxs(It,{value:c,onValueChange:u,children:[i.jsx(St,{className:"mt-1",children:i.jsx(Mt,{})}),i.jsxs(Nt,{children:[i.jsx(Ce,{value:"custom",children:"Custom"}),i.jsx(Ce,{value:"strengths",children:"By Strengths"}),i.jsx(Ce,{value:"weaknesses",children:"By Weaknesses"}),i.jsx(Ce,{value:"mixed",children:"Mixed Abilities"})]})]})]}),i.jsxs("div",{children:[i.jsx(Ue,{className:"text-xs font-bold mb-2 block",children:"Add Members *"}),i.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[i.jsx(al,{checked:m,onCheckedChange:w=>v(w===!0),id:"group-select-all"}),i.jsxs("label",{htmlFor:"group-select-all",className:"text-xs font-medium text-muted-foreground cursor-pointer",children:["Select all (",r.length,")"]})]}),i.jsx("div",{className:"max-h-32 overflow-y-auto space-y-1.5 border rounded-lg p-2",children:r.map(w=>i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(al,{checked:d.includes(w.student_id),onCheckedChange:()=>x(w.student_id),id:`group-student-${w.student_id}`}),i.jsx("label",{htmlFor:`group-student-${w.student_id}`,className:"text-sm cursor-pointer text-foreground",children:w.profile.display_name||"Student"})]},w.student_id))})]}),i.jsxs(ne,{onClick:y,disabled:b||!s.trim()||d.length===0,className:"w-full gradient-primary text-primary-foreground border-0",children:[b?i.jsx($e,{className:"w-4 h-4 animate-spin mr-2"}):null,"Create Group"]})]})]})})},sL=[{title:"Classroom Management",icon:"ð«",color:"text-primary",tips:[{title:"Start with a warm-up rout
567ine",description:"Begin every lesson with a 5-minute mental maths warm-up. It settles the class and gets brains engaged before the main task."},{title:"Use mini-whiteboards",description:"Every student answers simultaneously â no hiding. You instantly see who gets it and who needs help. Low-stakes, high-engagement."},{title:"Seating plans by data",description:"Use topic performance data to seat struggling students near confident ones. Peer support is one of the most effective interventions."},{title:"Chunk your lessons",description:"Break lessons into 10-15 minute segments: explain â practice â review. Shorter chunks maintain focus and reduce behaviour issues."},{title:"Exit tickets",description:"End each lesson with a quick 2-3 question check. It takes 3 minutes and gives you powerful data on who understood the lesson."}]},{title:"Stress Management",icon:"ð§",color:"text-accent",tips:[{title:"The 2-minute rule",description:"If a task takes less than 2 minutes, do it now. Emails, quick replies, marking a single question â don't let small tasks pile up."},{title:"Batch your marking",description:"Mark one question across all papers, not one paper at a time. It's faster, more consistent, and less mentally draining."},{title:'Set a "hard stop" time',description:"Decide on a time each evening when you stop working. Protect it fiercely. The marking will still be there tomorrow, but your health won't wait."},{title:"Say no strategically",description:"You don't have to volunteer for every committee, club, or cover. One meaningful extra contribution beats five half-hearted ones."},{title:"Weekend boundaries",description:"Try to keep at least one full day work-free each weekend. Your brain needs genuine rest to be effective on Monday."}]},{title:"Wellbeing & Self-Care",icon:"ð",color:"text-success",tips:[{title:"Move between lessons",description:"A quick walk around the school, a stretch, or even standing at your desk for 5 minutes resets your energy levels."},{title:"Hydrate and eat properly",description:"Keep a water bottle on your desk. Skipping lunch to mark isn't productive â a fed teacher is a better teacher."},{title:"Connect with colleagues",description:"A 5-minute chat in the staffroom isn't wasted time. Social connection reduces burnout more than any wellness webinar."},{title:"Celebrate your wins",description:`That student who finally got fractions? That's because of YOU. Keep a "wins jar" â write down one good thing each day.`},{title:"It's okay to have bad days",description:"Not every lesson will be outstanding. Not every student will be engaged. You're human, and that's perfectly fine."}]},{title:"Effective Differentiation",icon:"ð¯",color:"text-warning",tips:[{title:'Use "mild, spicy, hot" tasks',description:"Offer three difficulty levels for the same topic. Students self-select and feel ownership of their learning."},{title:"Group by difficulty, not ability labels",description:`Use this app's grouping feature to create flexible groups based on specific topic performance â not fixed "sets".`},{title:"Strategic questioning",description:'Ask struggling students "what do you notice?" and confident students "can you prove it?". Same topic, different cognitive demand.'},{title:"Pre-teach key vocabulary",description:"Many students struggle with maths language, not maths concepts. A quick vocabulary recap can unlock understanding."},{title:"Use the analytics tab",description:"Check which topics your class struggles with most, then plan targeted interventions for those specific areas."}]},{title:"Work-Life Balance",icon:"âï¸",color:"text-secondary-foreground",tips:[{title:"Automate where possible",description:"Use this platform's assignment tracking to reduce manual marking. Let the data do the heavy lifting."},{title:"Template everything",description:"Create reusable lesson plan templates, email templates, and report templates. You'll save hours every week."},{title:"Delegate to students",description:"Peer marking, student-led starters, and homework monitors give students responsibility and free up your time."},{title:"Plan collaboratively",description:"Share planning with your department. One person plans Monday's lesson, another plans Tuesday's. Everyone benefits."},{title:"Remember why you started",description:"On the hardest days, remember: you chose this because you care about young people. That matters enormously."}]}],aL=()=>{const[e,t]=p.useState(null);return i.jsx(z,{className:"shadow-card",children:i.jsxs(B,{className:"p-4",children:[i.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[i.jsx(Cn,{className:"w-5 h-5 text-accent"}),i.jsx("h3",{className:"font-bold text-foreground",children:"Teacher Wellbeing & Tips"})]}),i.jsx("p",{className:"text-xs text-muted-foreground mb-4",children:"Evidence-based strategies to manage your workload, support your students, and look after yourself. You can't pour from an empty cup. â"}),i.jsx("div",{className:"space-y-2",children:sL.map((r,n)=>i.jsxs("div",{className:"rounded-xl border border-border overflow-hidden",children:[i.jsxs("button",{className:"w-full flex items-center gap-3 p-3 hover:bg-muted/50 transition-colors text-left",onClick:()=>t(e===n?null:n),children:[i.jsx("span",{className:"text-xl shrink-0",children:r.icon}),i.jsx("span",{className:"flex-1 font-bold text-sm text-foreground",children:r.title}),i.jsxs("span",{className:"text-xs text-muted-foreground",children:[r.tips.length," tips"]}),e===n?i.jsx(Gr,{className:"w-4 h-4 text-muted-foreground shrink-0"}):i.jsx(Cr,{className:"w-4 h-4 text-muted-foreground shrink-0"})]}),e===n&&i.jsx("div",{className:"px-3 pb-3 space-y-3",children:r.tips.map((s,a)=>i.jsxs("div",{className:"flex gap-3 p-2.5 bg-muted/30 rounded-lg",children:[i.jsx(_i,{className:"w-4 h-4 text-primary mt-0.5 shrink-0"}),i.jsxs("div",{children:[i.jsx("h5",{className:"font-semibold text-sm text-foreground",children:s.title}),i.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:s.description})]})]},a))})]},r.title))})]})})},iL=()=>{const[e,t]=p.useState(!0),[r,n]=p.useState(null),[s,a]=p.useState("overview"),[o,l]=p.useState("overview"),[c,u]=p.useState(!1),[d,h]=p.useState(!1),{user:m,signOut:f}=st(),{linkedStudents:b,loading:g}=Yp(),{studentsData:v,classStats:x,topicPerformance:y,loading:w}=WD(b),{assignments:_,groups:j,createAssignment:k,createGroup:S}=HD(),{strands:C}=ld(),{toast:P}=en();p.useEffect(()=>{t(!1)},[m]);const T=b.find(M=>M.student_id===r),$=async M=>{const{error:R}=await k(M);return R?(P({variant:"destructive",title:"Failed to create assignment",description:R.message}),{error:R}):(P({title:"Assignment created! ð",description:`"${M.title}" assigned to ${M.student_ids.length} student(s).`}),{error:null})},O=async M=>{const{error:R}=await S(M);return R?(P({variant:"destructive",title:"Failed to create group",description:R.message}),{error:R}):(P({title:"Group created! ð¥",description:`"${M.name}" with ${M.student_ids.length} member(s).`}),{error:null})};return e||g?i.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center",children:i.jsx($e,{className:"w-8 h-8 animate-spin text-primary"})}):r&&T?i.jsxs("div",{className:"min-h-screen bg-background pb-20",children:[i.jsx("header",{className:"bg-card border-b border-border sticky top-0 z-50",children:i.jsxs("div",{className:"container mx-auto px-4 py-3 flex items-center justify-between max-w-2xl",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(ne,{variant:"ghost",size:"icon",onClick:()=>n(null),children:i.jsx(Tr,{className:"w-5 h-5"})}),i.jsx("span",{className:"text-lg font-bold text-foreground",children:T.profile.display_name||"Student"})]}),i.jsx(ne,{variant:"ghost",size:"icon",onClick:f,children:i.jsx(eu,{className:"w-5 h-5"})})]})}),i.jsx("main",{className:"container mx-auto px-4 py-6 max-w-2xl",children:i.jsx(tk,{studentId:r,studentName:T.profile.display_name||"Student",activeTab:o,onTabChange:l})})]}):i.jsxs("div",{className:"min-h-screen bg-background pb-20",children:[i.jsx("header",{className:"bg-card border-b border-border sticky top-0 z-50",children:i.jsxs("div",{className:"container mx-auto px-4 py-3 flex items-center justify-between max-w-2xl",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("div",{className:"w-8 h-8 rounded-lg gradient-primary flex items-center justify-center",children:i.jsx(Ar,{className:"w-5 h-5 text-primary-foreground"})}),i.jsx("span",{className:"text-lg font-bold text-foreground",children:"Mathly"}),i.jsx("span",{className:"text-xs px-2 py-0.5 rounded-full bg-primary/10 text-primary font-medium",children:"Teacher"})]}),i.jsx(ne,{variant:"ghost",size:"icon",onClick:f,children:i.jsx(eu,{className:"w-5 h-5"})})]})}),i.jsxs("main",{className:"container mx-auto px-4 py-6 max-w-2xl",children:[i.jsxs("section",{className:"mb-6",children:[i.jsx("h1",{className:"text-2xl font-bold text-foreground mb-1",children:"Teacher Dashboard ð"}),i.jsx("p",{className:"text-muted-foreground text-sm",children:"Manage your class, track performance, and create assignments."})]}),i.jsxs(wl,{value:s,onValueChange:a,children:[i.jsxs(qi,{className:"w-full mb-6",children:[i.jsxs(it,{value:"overview",className:"flex-1 text-xs",children:[i.jsx(yb,{className:"w-3 h-3 mr-1"}),"Overview"]}),i.jsxs(it,{value:"assignments",className:"flex-1 text-xs",children:[i.jsx(bi,{className:"w-3 h-3 mr-1"}),"Tasks"]}),i.jsxs(it,{value:"analytics",className:"flex-1 text-xs",children:[i.jsx(ma,{className:"w-3 h-3 mr-1"}),"Analytics"]}),i.jsxs(it,{value:"support",className:"flex-1 text-xs",children:[i.jsx(Cn,{className:"w-3 h-3 mr-1"}),"Support"]})]}),i.jsx(rr,{value:"overview",className:"space-y-6",children:w?i.jsx("div",{className:"flex justify-center py-8",children:i.jsx($e,{className:"w-6 h-6 animate-spin text-primary"})}):i.jsxs(i.Fragment,{children:[i.jsx(fy,{stats:x}),i.jsx(VD,{onCreateAssignment:()=>u(!0),onCreateGroup:()=>h(!0),onViewReports:()=>a("analytics")}),i.jsx(GD,{students:v,onSelectStudent:n}),i.jsx(Vj,{})]})}),i.jsxs(rr,{value:"assignments",className:"space-y-6",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("h2",{className:"text-lg font-bold text-foreground",children:"Assignments"}),i.jsx(ne,{size:"sm",onClick:()=>u(!0),className:"gradient-primary text-primary-foreground border-0",children:"+ New"})]}),i.jsx(QD,{assignments:_,students:b}),i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("h2",{className:"text-lg font-bold text-foreground",children:"Groups"}),i.jsx(ne,{size:"sm",onClick:()=>h(!0),className:"gradient-primary text-primary-foreground border-0",children:"+ New"})]}),i.jsx(JD,{groups:j,students:b})]}),i.jsx(rr,{value:"analytics",className:"space-y-6",children:w?i.jsx("div",{className:"flex justify-center py-8",children:i.jsx($e,{className:"w-6 h-6 animate-spin text-primary"})}):i.jsxs(i.Fragment,{children:[i.jsx(fy,{stats:x}),i.jsx(KD,{performance:y}),b.length>0&&i.jsxs("section",{children:[i.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[i.jsx(wt,{className:"w-5 h-5 text-primary"}),i.jsx("h2",{className:"text-sm font-bold text-foreground",children:"View Individual Student"})]}),i.jsx("div",{className:"flex gap-2 overflow-x-auto pb-1",children:b.map(M=>i.jsx("button",{onClick:()=>n(M.student_id),className:"flex items-center gap-2 px-4 py-2 rounded-xl text-sm font-bold transition-all whitespace-nowrap bg-muted text-muted-foreground hover:bg-secondary",children:M.profile.display_name||"Student"},M.student_id))})]})]})}),i.jsxs(rr,{value:"support",className:"space-y-6",children:[i.jsx(aL,{}),b.length>0&&i.jsxs("section",{children:[i.jsx("h2",{className:"text-lg font-bold text-foreground mb-3",children:"Progress Reports"}),i.jsx("div",{className:"space-y-4",children:b.map(M=>i.jsx(ek,{studentId:M.student_id,studentName:M.profile.display_name||"Student"},M.student_id))})]})]})]}),b.length===0&&s==="overview"&&i.jsx("section",{className:"mt-6",children:i.jsx(z,{className:"border-dashed",children:i.jsxs(B,{className:"p-6 text-center",children:[i.jsx(wt,{className:"w-8 h-8 text-muted-foreground mx-auto mb-2"}),i.jsx("p",{className:"text-sm text-muted-foreground",children:"No students linked yet. Ask your students for their link code to get started."})]})})})]}),i.jsx(rL,{open:c,onOpenChange:u,students:b,strands:C,onSubmit:$}),i.jsx(nL,{open:d,onOpenChange:h,students:b,onSubmit:O})]})},oL=()=>{const{role:e,loading:t}=r_();if(t)return i.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center",children:i.jsx($e,{className:"w-8 h-8 animate-spin text-primary"})});switch(e){case"parent":return i.jsx(BD,{});case"teacher":return i.jsx(iL,{});case"student":default:return i.jsx(bD,{})}},lL=()=>{var $;const{topicId:e}=h4(),[t,r]=p.useState(null),[n,s]=p.useState(""),[a,o]=p.useState([]),[l,c]=p.useState({currentIndex:0,answers:[],showFeedback:!1,lastAnswerCorrect:null}),[u,d]=p.useState(null),[h,m]=p.useState(!1),[f,b]=p.useState(!1),[g,v]=p.useState(!0),{user:x}=st(),y=pa(),{toast:w}=en();p.useEffect(()=>{(async()=>
567{if(!x||!e)return;const[M,R,U]=await Promise.all([F.from("profiles").select("*").eq("id",x.id).maybeSingle(),F.from("topics").select("name").eq("id",e).maybeSingle(),F.from("questions").select("id, topic_id, question_text, options, correct_answer, explanation").eq("topic_id",e)]);if(M.data&&r(M.data),R.data&&s(R.data.name),U.data){const D=U.data.map(E=>({...E,options:typeof E.options=="string"?JSON.parse(E.options):E.options})).sort(()=>Math.random()-.5).slice(0,d3);o(D)}v(!1)})()},[x,e]);const _=a[l.currentIndex],j=a.length>0?(l.currentIndex+1)/a.length*100:0,k=O=>{l.showFeedback||d(O)},S=()=>{if(!u||!_)return;const O=u===_.correct_answer;c(M=>({...M,answers:[...M.answers,{questionId:_.id,answer:u,isCorrect:O}],showFeedback:!0,lastAnswerCorrect:O}))},C=()=>{l.currentIndex>=a.length-1?m(!0):(c(O=>({...O,currentIndex:O.currentIndex+1,showFeedback:!1,lastAnswerCorrect:null})),d(null))},P=()=>{c({currentIndex:0,answers:[],showFeedback:!1,lastAnswerCorrect:null}),d(null),m(!1)},T=async()=>{if(!(!x||!t||!e)){b(!0);try{const O=l.answers.filter(A=>A.isCorrect).length,M=O*Qf+Jf,{data:R}=await F.from("topic_progress").select("*").eq("user_id",x.id).eq("topic_id",e).maybeSingle(),U=((R==null?void 0:R.correct_count)||0)+O,N=((R==null?void 0:R.total_attempts)||0)+a.length,D=U/N;let E="practising";D>=u3.confident&&N>=5&&(E="confident"),R?await F.from("topic_progress").update({mastery_level:E,correct_count:U,total_attempts:N,last_practiced_at:new Date().toISOString(),updated_at:new Date().toISOString()}).eq("id",R.id):await F.from("topic_progress").insert({user_id:x.id,topic_id:e,mastery_level:E,correct_count:O,total_attempts:a.length,last_practiced_at:new Date().toISOString()}),await F.from("profiles").update({xp:(t.xp||0)+M,last_activity_date:new Date().toISOString().split("T")[0],updated_at:new Date().toISOString()}).eq("id",x.id),await F.from("quiz_attempts").insert({user_id:x.id,topic_id:e,is_diagnostic:!1,score:O,total_questions:a.length,xp_earned:M,completed_at:new Date().toISOString()}),w({title:"ð Quiz complete!",description:`You earned ${M} XP!`}),y("/dashboard")}catch(O){console.error("Error saving quiz results:",O),w({variant:"destructive",title:"Something went wrong",description:"Please try again."})}finally{b(!1)}}};if(g)return i.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center",children:i.jsx($e,{className:"w-8 h-8 animate-spin text-primary"})});if(!n)return i.jsxs("div",{className:"min-h-screen bg-background flex flex-col items-center justify-center p-4",children:[i.jsx("p",{className:"text-muted-foreground mb-4",children:"Topic not found"}),i.jsx(mn,{to:"/dashboard",children:i.jsx(ne,{children:"Back to Dashboard"})})]});if(a.length===0)return i.jsxs("div",{className:"min-h-screen bg-background flex flex-col items-center justify-center p-4",children:[i.jsx("p",{className:"text-muted-foreground mb-4",children:"No questions available for this topic yet"}),i.jsx(mn,{to:"/dashboard",children:i.jsx(ne,{children:"Back to Dashboard"})})]});if(h){const O=l.answers.filter(U=>U.isCorrect).length,M=Math.round(O/a.length*100),R=O*Qf+Jf;return i.jsx("div",{className:"min-h-screen bg-background flex flex-col items-center justify-center p-4",children:i.jsxs("div",{className:"w-full max-w-md text-center",children:[i.jsx("div",{className:"w-20 h-20 rounded-2xl gradient-success flex items-center justify-center mx-auto mb-6 animate-celebrate",children:i.jsx(lr,{className:"w-10 h-10 text-white"})}),i.jsx("h1",{className:"text-3xl font-bold text-foreground mb-2",children:"Great job! ð"}),i.jsx("p",{className:"text-lg text-muted-foreground mb-6",children:Rt.quizComplete[Math.floor(Math.random()*Rt.quizComplete.length)]}),i.jsx(z,{className:"mb-6",children:i.jsxs(B,{className:"p-6",children:[i.jsxs("div",{className:"text-4xl font-bold text-primary mb-2",children:[O,"/",a.length]}),i.jsxs("p",{className:"text-muted-foreground mb-4",children:[M,"% correct"]}),i.jsxs("div",{className:"inline-flex items-center gap-2 px-4 py-2 rounded-full bg-xp/10 text-xp font-bold",children:["+",R," XP earned!"]})]})}),i.jsxs("div",{className:"space-y-3",children:[i.jsx(ne,{size:"lg",onClick:T,disabled:f,className:"gradient-primary text-white border-0 w-full h-14",children:f?i.jsxs(i.Fragment,{children:[i.jsx($e,{className:"w-5 h-5 mr-2 animate-spin"})," Saving..."]}):i.jsxs(i.Fragment,{children:[i.jsx(xb,{className:"w-5 h-5 mr-2"})," Back to Dashboard"]})}),i.jsxs(ne,{size:"lg",variant:"outline",onClick:P,disabled:f,className:"w-full h-14",children:[i.jsx(bb,{className:"w-5 h-5 mr-2"})," Try Again"]})]})]})})}return _?i.jsxs("div",{className:"min-h-screen bg-background flex flex-col",children:[i.jsxs("header",{className:"p-4 flex items-center justify-between",children:[i.jsxs(mn,{to:"/dashboard",className:"flex items-center gap-1 text-muted-foreground hover:text-foreground transition-colors",children:[i.jsx(Tr,{className:"w-5 h-5"}),i.jsx("span",{className:"text-sm",children:"Exit"})]}),i.jsx("span",{className:"text-sm font-medium text-foreground",children:n}),i.jsxs("span",{className:"text-sm text-muted-foreground",children:[l.currentIndex+1,"/",a.length]})]}),i.jsx("div",{className:"px-4",children:i.jsx(sn,{value:j,className:"h-2"})}),i.jsx("main",{className:"flex-1 flex flex-col p-4",children:i.jsxs("div",{className:"flex-1 flex flex-col max-w-lg mx-auto w-full",children:[i.jsx("h2",{className:"text-xl font-bold text-foreground mb-6 mt-4",children:_.question_text}),i.jsx("div",{className:"space-y-3 mb-6",children:($=_.options)==null?void 0:$.map((O,M)=>{const R=u===O,U=O===_.correct_answer,N=l.showFeedback&&U,D=l.showFeedback&&R&&!U;
567return i.jsx(z,{className:`cursor-pointer transition-all ${N?"ring-2 ring-success bg-success/10 border-success":D?"ring-2 ring-destructive bg-destructive/10 border-destructive":R?"ring-2 ring-primary bg-primary/5 border-primary":l.showFeedback?"opacity-50":"hover:border-primary/50"}`,onClick:()=>k(O),children:i.jsxs(B,{className:"flex items-center gap-3 p-4",children:[i.jsx("div",{className:`w-8 h-8 rounded-full flex items-center justify-center text-sm font-bold ${N?"bg-success text-white":D?"bg-destructive text-white":R?"gradient-primary text-white":"bg-secondary text-primary"}`,children:N?i.jsx(lr,{className:"w-5 h-5"}):D?i.jsx(qo,{className:"w-5 h-5"}):String.fromCharCode(65+M)}),i.jsx("span",{className:"flex-1 font-medium text-foreground",children:O})]})},M)})}),l.showFeedback&&i.jsx(z,{className:`mb-6 ${l.lastAnswerCorrect?"bg-success/10 border-success":"bg-accent/10 border-accent"}`,children:i.jsxs(B,{className:"p-4",children:[i.jsx("p",{className:"font-bold mb-2",children:l.lastAnswerCorrect?Rt.correct[Math.floor(Math.random()*Rt.correct.length)]:Rt.incorrect[Math.floor(Math.random()*Rt.incorrect.length)]}),i.jsx("p",{className:"text-sm text-muted-foreground",children:_.explanation})]})}),i.jsx("div",{className:"mt-auto pt-4",children:l.showFeedback?i.jsxs(ne,{size:"lg",onClick:C,className:"gradient-primary text-white border-0 w-full h-14",children:[l.currentIndex>=a.length-1?"See results":"Next question",i.jsx(Pr,{className:"w-5 h-5 ml-2"})]}):i.jsx(ne,{size:"lg",onClick:S,disabled:!u,className:"gradient-primary text-white border-0 w-full h-14",children:"Check answer"})})]})})]}):null},cL=()=>{const e=Li();return p.useEffect(()=>{console.error("404 Error: User attempted to access non-existent route:",e.pathname)},[e.pathname]),i.jsx("div",{className:"flex min-h-screen items-center justify-center bg-muted",children:i.jsxs("div",{className:"text-center",children:[i.jsx("h1",{className:"mb-4 text-4xl font-bold",children:"404"}),i.jsx("p",{className:"mb-4 text-xl text-muted-foreground",children:"Oops! Page not found"}),i.jsx("a",{href:"/",className:"text-primary underline hover:text-primary/90",children:"Return to Home"})]})})},uL=new M5,dL=()=>i.jsx(L5,{client:uL,children:i.jsxs(d5,{children:[i.jsx(YC,{}),i.jsx(NE,{}),i.jsx(M4,{children:i.jsx(yR,{children:i.jsxs(E4,{children:[i.jsx(Fn,{path:"/",element:i.jsx(wR,{})}),i.jsx(Fn,{path:"/auth",element:i.jsx(r3,{})}),i.jsx(Fn,{path:"/onboarding",element:i.jsx(Xl,{children:i.jsx(m3,{})})}),i.jsx(Fn,{path:"/diagnostic",element:i.jsx(Xl,{children:i.jsx(v3,{})})}),i.jsx(Fn,{path:"/dashboard",element:i.jsx(Xl,{children:i.jsx(oL,{})})}),i.jsx(Fn,{path:"/quiz/:topicId",element:i.jsx(Xl,{children:i.jsx(lL,{})})}),i.jsx(Fn,{path:"*",element:i.jsx(cL,{})})]})})})]})});Dw(document.getElementById("root")).render(i.jsx(dL,{}));
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.