PageSourceSearch

https://c24club.com/assets/index-CnwAbAWO.js

js c24club.com collected 2026-10-08 01:54:55 UTC 1,148,766 bytes, 550 lines download raw bytes

vendor: 4,354 bytes, lines 1-2
1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-D4r6PzL8.js","assets/index-COFIFzVj.js","assets/AdminLayout-Dhl4LA_h.js","assets/menu-CktZYK2v.js","assets/tag-DGBNApV5.js","assets/folder-open-Ck881Ijv.js","assets/flag-C4z9X33V.js","assets/ban-CGYVLPCn.js","assets/list-checks-C0J_iy0t.js","assets/dices-Df2FNwAS.js","assets/trending-up-Cw0DM8p9.js","assets/activity-DHB4k_0s.js","assets/scroll-area-2L8oVXGm.js","assets/index-C3kkPLT-.js","assets/index-BdQq_4o_.js","assets/popover-BOIddKxx.js","assets/formatDistanceToNow-J8kFldbk.js","assets/en-US-CbkNm809.js","assets/endOfMonth-r569jwgJ.js","assets/index-B4-9egLL.js","assets/circle-D9nPKlW0.js","assets/user-B2iKquOf.js","assets/DashboardPage-CUsmIc1n.js","assets/card-qc-RJIJs.js","assets/MembersPage-BFDfDJpC.js","assets/badge-CJ9w1VVM.js","assets/table-G41SUW-Y.js","assets/checkbox-C8h5LllN.js","assets/index-Y-pH7DNn.js","assets/DeleteDialog-T-LHQzkV.js","assets/dialog-DeVRAmFN.js","assets/select-wQylLCE1.js","assets/label-DWnPHeb2.js","assets/RewardsPage-CuttddRs.js","assets/DataTable-CPv50zlx.js","assets/AddRewardPage-DT54WfxU.js","assets/form-C8kwGQ30.js","assets/switch-980599cY.js","assets/plus-KcwTnFCu.js","assets/types-CDqVKZbI.js","assets/CategoriesPage-ssv35E9G.js","assets/arrow-up-DQIIgq7l.js","assets/AddCategoryPage-PCynJ2qv.js","assets/PromosPage-D2d6YXZ2.js","assets/PlaceholderPage-CFEVz5j5.js","assets/AdminLoginPage-DImZobnJ.js","assets/AdminResetPasswordPage-C3prARVX.js","assets/ManageMinutesPage-DCD9jP7t.js","assets/TopicsPage-CJxGdL7B.js","assets/MemberRewardsPage-U2rgLBr2.js","assets/tabs-DIqyk8sm.js","assets/EditMemberRewardPage-DVCn6Qg7.js","assets/save-CO7_FpTf.js","assets/AdminChallengesPage-CEno0wVF.js","assets/AdminSpinPrizesPage-DyhOJzHa.js","assets/AdminSpinWinnersPage-0SLHa116.js","assets/LegendaryCashoutPage-Cns5Oevy.js","assets/AdminEmailTemplatesPage-DUzjEcFP.js","assets/info-B_GdZIDd.js","assets/AdminEmailDashboardPage-CDhmJDWj.js","assets/format-BxjL2pbu.js","assets/subDays-CT0_jNdd.js","assets/calendar-CWh3gRbA.js","assets/AdminGiftCardsPage-D3EaCdXg.js","assets/AdminRoomsPage-CD-grknU.js","assets/SystemHealthPage-yW9wldb9.js","assets/refresh-cw-JTtzqSYe.js","assets/NotificationHealthPage-hkfzIZ7V.js","assets/RevenuePage-Da4w-E57.js","assets/AreaChart-DPrDlSqO.js","assets/AdminBannedUsersPage-6rPLcjAf.js","assets/shield-check-B9DZcRTy.js","assets/UserAnalyticsPage-D746HNFx.js","assets/AdminDiscoverReviewPage-CGiE4Yev.js","assets/circle-check-BZ5AnZ4A.js","assets/TapAnalyticsPage-Cmyga7wk.js","assets/AdminNativeAppUsersPage-D5rVaruQ.js","assets/AdminDmMonitorPage-cMahV6lC.js","assets/AdminAnnouncementsPage-D-ZiUiH5.js","assets/ReportedUsersPage-BxfC7aCv.js","assets/AdminUserRolesPage-CQVwilNR.js","assets/ModeratorPermissionsPage-9B9w200b.js","assets/AdminGiftHistoryPage-Brra9Ozb.js","assets/CameraUnlockSettingsPage-BKQGnNK0.js","assets/AdminJackpotPayoutsPage-O4l-HdmU.js","assets/AdminWagerSettingsPage-Csmgw69n.js","assets/AdminBlogPage-BWdnw2SN.js","assets/AdminBlogEditorPage-Cq6iQyzt.js","assets/WishlistSettingsPage-BVCdv-7i.js","assets/AdminRedditTasksPage-Desfa1RX.js","assets/AdminChecklistPage-qMRgpPir.js","assets/AdminIapPurchasesPage-BnZrCIRy.js","assets/VipPurchaseAnalyticsPage-C1PFPDxh.js","assets/SettingsPage-DH0PKahe.js","assets/key-CUVNdf1W.js","assets/ResetPasswordPage-I_4BdYyQ.js","assets/DiscoverPage-BBlNcLkm.js","assets/HowToGuidePage-zxsyxRGu.js","assets/SafetyCenterPage-CR4KAPMR.js","assets/BlogPage-VN7JQijN.js","assets/BlogPostPage-KyyfoqS-.js","assets/VideoChatWithStrangersPage-BZLUING1.js","assets/SeoLandingLayout-DhSCp1Qr.js","assets/RandomVideoChatPage-CoSMUUfS.js","assets/TalkToStrangersPage-DuNtdBN_.js","assets/FreeVideoChatNoSignUpPage-CM70Sa9f.js","assets/CamChatPage-CZz-PWHF.js","assets/OmeTvAlternativePage-DKRkrQZP.js","assets/MonkeyAppAlternativePage-BaElSx4k.js","assets/CSAEPolicyPage-D8VM6LD3.js","assets/ContactPage-BxDv7SaV.js","assets/DeleteAccountPage-DCOjb4Cj.js","assets/WorkerRedditTaskPage-CAffQicG.js"])))=>i.map(i=>d[i]);
2var mk=Object.defineProperty;var kx=e=>{throw TypeError(e)};var pk=(e,t,n)=>t in e?mk(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Sx=(e,t,n)=>pk(e,typeof t!="symbol"?t+"":t,n),Ph=(e,t,n)=>t.has(e)||kx("Cannot "+n);var L=(e,t,n)=>(Ph(e,t,"read from private field"),n?n.call(e):t.get(e)),Ae=(e,t,n
vendor: 6,539 bytes, lines 2-10
2)=>t.has(e)?kx("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),we=(e,t,n,r)=>(Ph(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n),qe=(e,t,n)=>(Ph(e,t,"access private method"),n);var Uc=(e,t,n,r)=>({set _(a){we(e,t,a,n)},get _(){return L(e,t,r)}});function xk(e,t){for(var n=0;n<t.length;n++){const r=t[n];if(typeof r!="string"&&!Array.isArray(r)){for(const a in r)if(a!=="default"&&!(a in e)){const i=Object.getOwnPropertyDescriptor(r,a);i&&Object.defineProperty(e,a,i.get?i:{enumerable:!0,get:()=>r[a]})}}}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 a of document.querySelectorAll('link[rel="modulepreload"]'))r(a);new MutationObserver(a=>{for(const i of a)if(i.type==="childList")for(const o of i.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(a){const i={};return a.integrity&&(i.integrity=a.integrity),a.referrerPolicy&&(i.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?i.credentials="include":a.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(a){if(a.ep)return;a.ep=!0;const i=n(a);fetch(a.href,i)}})();var G8=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};function nv(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function K8(e){if(e.__esModule)return e;var t=e.default;if(typeof t=="function"){var n=function r(){return this instanceof r?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(r){var a=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(n,r,a.get?a:{enumerable:!0,get:function(){return e[r]}})}),n}var rv={exports:{}},Rd={},sv={exports:{}},He={};/**
3 * @license React
4 * react.production.min.js
5 *
6 * Copyright (c) Facebook, Inc. and its affiliates.
7 *
8 * This source code is licensed under the MIT license found in the
9 * LICENSE file in the root directory of this source tree.
10 */var mc=Symbol.for("react.element"),gk=Symbol.for("react.portal"),bk=Symbol.for("react.fragment"),yk=Symbol.for("react.strict_mode"),vk=Symbol.for("react.profiler"),wk=Symbol.for("react.provider"),_k=Symbol.for("react.context"),jk=Symbol.for("react.forward_ref"),Nk=Symbol.for("react.suspense"),kk=Symbol.for("react.memo"),Sk=Symbol.for("react.lazy"),Cx=Symbol.iterator;function Ck(e){return e===null||typeof e!="object"?null:(e=Cx&&e[Cx]||e["@@iterator"],typeof e=="function"?e:null)}var av={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},iv=Object.assign,ov={};function yo(e,t,n){this.props=e,this.context=t,this.refs=ov,this.updater=n||av}yo.prototype.isReactComponent={};yo.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")};yo.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function lv(){}lv.prototype=yo.prototype;function Tp(e,t,n){this.props=e,this.context=t,this.refs=ov,this.updater=n||av}var Rp=Tp.prototype=new lv;Rp.constructor=Tp;iv(Rp,yo.prototype);Rp.isPureReactComponent=!0;var Ex=Array.isArray,cv=Object.prototype.hasOwnProperty,Ap={current:null},uv={key:!0,ref:!0,__self:!0,__source:!0};function dv(e,t,n){var r,a={},i=null,o=null;if(t!=null)for(r in t.ref!==void 0&&(o=t.ref),t.key!==void 0&&(i=""+t.key),t)cv.call(t,r)&&!uv.hasOwnProperty(r)&&(a[r]=t[r]);var l=arguments.length-2;if(l===1)a.children=n;else if(1<l){for(var c=Array(l),d=0;d<l;d++)c[d]=arguments[d+2];a.children=c}if(e&&e.defaultProps)for(r in l=e.defaultProps,l)a[r]===void 0&&(a[r]=l[r]);return{$$typeof:mc,type:e,key:i,ref:o,props:a,_owner:Ap.current}}function Ek(e,t){return{$$typeof:mc,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}function Ip(e){return typeof e=="object"&&e!==null&&e.$$typeof===mc}function Pk(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var Px=/\/+/g;function Th(e,t){return typeof e=="object"&&e!==null&&e.key!=null?Pk(""+e.key):t.toString(36)}function Nu(e,t,n,r,a){var i=typeof e;(i==="undefined"||i==="boolean")&&(e=null);var o=!1;if(e===null)o=!0;else switch(i){case"string":case"number":o=!0;break;case"object":switch(e.$$typeof){case mc:case gk:o=!0}}if(o)return o=e,a=a(o),e=r===""?"."+Th(o,0):r,Ex(a)?(n="",e!=null&&(n=e.replace(Px,"$&/")+"/"),Nu(a,t,n,"",function(d){return d})):a!=null&&(Ip(a)&&(a=Ek(a,n+(!a.key||o&&o.key===a.key?"":(""+a.key).replace(Px,"$&/")+"/")+e)),t.push(a)),1;if(o=0,r=r===""?".":r+":",Ex(e))for(var l=0;l<e.length;l++){i=e[l];var c=r+Th(i,l);o+=Nu(i,t,n,c,a)}else if(c=Ck(e),typeof c=="function")for(e=c.call(e),l=0;!(i=e.next()).done;)i=i.value,c=r+Th(i,l++),o+=Nu(i,t,n,c,a);else if(i==="object")throw t=String(e),Error("Objects are not valid as a React child (found: "+(t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.");return o}function Bc(e,t,n){if(e==null)return e;var r=[],a=0;return Nu(e,r,"","",function(i){return t.call(n,i,a++)}),r}function Tk(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(n){(e._status===0||e._status===-1)&&(e._status=1,e._result=n)},function(n){(e._status===0||e._status===-1)&&(e._status=2,e._result=n)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var wn={current:null},ku={transition:null},Rk={ReactCurrentDispatcher:wn,ReactCurrentBatchConfig:ku,ReactCurrentOwner:Ap};function hv(){throw Error("act(...) is not supported in production builds of React.")}He.Children={map:Bc,forEach:function(e,t,n){Bc(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return Bc(e,function(){t++}),t},toArray:function(e){return Bc(e,function(t){return t})||[]},only:function(e){if(!Ip(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};He.Component=yo;He.Fragment=bk;He.Profiler=vk;He.PureComponent=Tp;He.StrictMode=yk;He.Suspense=Nk;
vendor: 9,025 bytes, lines 10-34
10He.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Rk;He.act=hv;He.cloneElement=function(e,t,n){if(e==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+e+".");var r=iv({},e.props),a=e.key,i=e.ref,o=e._owner;if(t!=null){if(t.ref!==void 0&&(i=t.ref,o=Ap.current),t.key!==void 0&&(a=""+t.key),e.type&&e.type.defaultProps)var l=e.type.defaultProps;for(c in t)cv.call(t,c)&&!uv.hasOwnProperty(c)&&(r[c]=t[c]===void 0&&l!==void 0?l[c]:t[c])}var c=arguments.length-2;if(c===1)r.children=n;else if(1<c){l=Array(c);for(var d=0;d<c;d++)l[d]=arguments[d+2];r.children=l}return{$$typeof:mc,type:e.type,key:a,ref:i,props:r,_owner:o}};He.createContext=function(e){return e={$$typeof:_k,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:wk,_context:e},e.Consumer=e};He.createElement=dv;He.createFactory=function(e){var t=dv.bind(null,e);return t.type=e,t};He.createRef=function(){return{current:null}};He.forwardRef=function(e){return{$$typeof:jk,render:e}};He.isValidElement=Ip;He.lazy=function(e){return{$$typeof:Sk,_payload:{_status:-1,_result:e},_init:Tk}};He.memo=function(e,t){return{$$typeof:kk,type:e,compare:t===void 0?null:t}};He.startTransition=function(e){var t=ku.transition;ku.transition={};try{e()}finally{ku.transition=t}};He.unstable_act=hv;He.useCallback=function(e,t){return wn.current.useCallback(e,t)};He.useContext=function(e){return wn.current.useContext(e)};He.useDebugValue=function(){};He.useDeferredValue=function(e){return wn.current.useDeferredValue(e)};He.useEffect=function(e,t){return wn.current.useEffect(e,t)};He.useId=function(){return wn.current.useId()};He.useImperativeHandle=function(e,t,n){return wn.current.useImperativeHandle(e,t,n)};He.useInsertionEffect=function(e,t){return wn.current.useInsertionEffect(e,t)};He.useLayoutEffect=function(e,t){return wn.current.useLayoutEffect(e,t)};He.useMemo=function(e,t){return wn.current.useMemo(e,t)};He.useReducer=function(e,t,n){return wn.current.useReducer(e,t,n)};He.useRef=function(e){return wn.current.useRef(e)};He.useState=function(e){return wn.current.useState(e)};He.useSyncExternalStore=function(e,t,n){return wn.current.useSyncExternalStore(e,t,n)};He.useTransition=function(){return wn.current.useTransition()};He.version="18.3.1";sv.exports=He;var h=sv.exports;const oe=nv(h),Op=xk({__proto__:null,default:oe},[h]);/**
11 * @license React
12 * react-jsx-runtime.production.min.js
13 *
14 * Copyright (c) Facebook, Inc. and its affiliates.
15 *
16 * This source code is licensed under the MIT license found in the
17 * LICENSE file in the root directory of this source tree.
18 */var Ak=h,Ik=Symbol.for("react.element"),Ok=Symbol.for("react.fragment"),Dk=Object.prototype.hasOwnProperty,Lk=Ak.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,Mk={key:!0,ref:!0,__self:!0,__source:!0};function fv(e,t,n){var r,a={},i=null,o=null;n!==void 0&&(i=""+n),t.key!==void 0&&(i=""+t.key),t.ref!==void 0&&(o=t.ref);for(r in t)Dk.call(t,r)&&!Mk.hasOwnProperty(r)&&(a[r]=t[r]);if(e&&e.defaultProps)for(r in t=e.defaultProps,t)a[r]===void 0&&(a[r]=t[r]);return{$$typeof:Ik,type:e,key:i,ref:o,props:a,_owner:Lk.current}}Rd.Fragment=Ok;Rd.jsx=fv;Rd.jsxs=fv;rv.exports=Rd;var s=rv.exports,mv={exports:{}},qn={},pv={exports:{}},xv={};/**
19 * @license React
20 * scheduler.production.min.js
21 *
22 * Copyright (c) Facebook, Inc. and its affiliates.
23 *
24 * This source code is licensed under the MIT license found in the
25 * LICENSE file in the root directory of this source tree.
26 */(function(e){function t(D,$){var z=D.length;D.push($);e:for(;0<z;){var R=z-1>>>1,U=D[R];if(0<a(U,$))D[R]=$,D[z]=U,z=R;else break e}}function n(D){return D.length===0?null:D[0]}function r(D){if(D.length===0)return null;var $=D[0],z=D.pop();if(z!==$){D[0]=z;e:for(var R=0,U=D.length,ee=U>>>1;R<ee;){var ae=2*(R+1)-1,xe=D[ae],te=ae+1,ce=D[te];if(0>a(xe,z))te<U&&0>a(ce,xe)?(D[R]=ce,D[te]=z,R=te):(D[R]=xe,D[ae]=z,R=ae);else if(te<U&&0>a(ce,z))D[R]=ce,D[te]=z,R=te;else break e}}return $}function a(D,$){var z=D.sortIndex-$.sortIndex;return z!==0?z:D.id-$.id}if(typeof performance=="object"&&typeof performance.now=="function"){var i=performance;e.unstable_now=function(){return i.now()}}else{var o=Date,l=o.now();e.unstable_now=function(){return o.now()-l}}var c=[],d=[],u=1,f=null,m=3,p=!1,v=!1,g=!1,y=typeof setTimeout=="function"?setTimeout:null,b=typeof clearTimeout=="function"?clearTimeout:null,x=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(D){for(var $=n(d);$!==null;){if($.callback===null)r(d);else if($.startTime<=D)r(d),$.sortIndex=$.expirationTime,t(c,$);else break;$=n(d)}}function _(D){if(g=!1,w(D),!v)if(n(c)!==null)v=!0,V(j);else{var $=n(d);$!==null&&q(_,$.startTime-D)}}function j(D,$){v=!1,g&&(g=!1,b(C),C=-1),p=!0;var z=m;try{for(w($),f=n(c);f!==null&&(!(f.expirationTime>$)||D&&!O());){var R=f.callback;if(typeof R=="function"){f.callback=null,m=f.priorityLevel;var U=R(f.expirationTime<=$);$=e.unstable_now(),typeof U=="function"?f.callback=U:f===n(c)&&r(c),w($)}else r(c);f=n(c)}if(f!==null)var ee=!0;else{var ae=n(d);ae!==null&&q(_,ae.startTime-$),ee=!1}return ee}finally{f=null,m=z,p=!1}}var N=!1,k=null,C=-1,A=5,I=-1;function O(){return!(e.unstable_now()-I<A)}function P(){if(k!==null){var D=e.unstable_now();I=D;var $=!0;try{$=k(!0,D)}finally{$?T():(N=!1,k=null)}}else N=!1}var T;if(typeof x=="function")T=function(){x(P)};else if(typeof MessageChannel<"u"){var E=new MessageChannel,W=E.port2;E.port1.onmessage=P,T=function(){W.postMessage(null)}}else T=function(){y(P,0)};function V(D){k=D,N||(N=!0,T())}function q(D,$){C=y(function(){D(e.unstable_now())},$)}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(D){D.callback=null},e.unstable_continueExecution=function(){v||p||(v=!0,V(j))},e.unstable_forceFrameRate=function(D){0>D||125<D?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):A=0<D?Math.floor(1e3/D):5},e.unstable_getCurrentPriorityLevel=function(){return m},e.unstable_getFirstCallbackNode=function(){return n(c)},e.unstable_next=function(D){switch(m){case 1:case 2:case 3:var $=3;break;default:$=m}var z=m;m=$;try{return D()}finally{m=z}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(D,$){switch(D){case 1:case 2:case 3:case 4:case 5:break;default:D=3}var z=m;m=D;try{return $()}finally{m=z}},e.unstable_scheduleCallback=function(D,$,z){var R=e.unstable_now();switch(typeof z=="object"&&z!==null?(z=z.delay,z=typeof z=="number"&&0<z?R+z:R):z=R,D){case 1:var U=-1;break;case 2:U=250;break;case 5:U=1073741823;break;case 4:U=1e4;break;default:U=5e3}return U=z+U,D={id:u++,callback:$,priorityLevel:D,startTime:z,expirationTime:U,sortIndex:-1},z>R?(D.sortIndex=z,t(d,D),n(c)===null&&D===n(d)&&(g?(b(C),C=-1):g=!0,q(_,z-R))):(D.sortIndex=U,t(c,D),v||p||(v=!0,V(j))),D},e.unstable_shouldYield=O,e.unstable_wrapCallback=function(D){var $=m;return function(){var z=m;m=$;try{return D.apply(this,arguments)}finally{m=z}}}})(xv);pv.exports=xv;var $k=pv.exports;/**
27 * @license React
28 * react-dom.production.min.js
29 *
30 * Copyright (c) Facebook, Inc. and its affiliates.
31 *
32 * This source code is licensed under the MIT license found in the
33 * LICENSE file in the root directory of this source tree.
34 */var Fk=h,zn=$k;function re(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n<arguments.length;n++)t+="&args[]="+encodeURIComponent(arguments[n]);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 gv=new Set,El={};function ei(e,t){oo(e,t),oo(e+"Capture",t)}function oo(e,t){for(El[e]=t,e=0;e<t.length;e++)gv.add(t[e])}var ss=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Ff=Object.prototype.hasOwnProperty,Uk=/^[: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]*$/,Tx={},Rx={};function Bk(e){return Ff.call(Rx,e)?!0:Ff.call(Tx,e)?!1:Uk.test(e)?Rx[e]=!0:(Tx[e]=!0,!1)}function zk(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function qk(e,t,n,r){if(t===null||typeof t>"u"||zk(e,t,n,r))return!0;
vendor: 5,200 bytes, lines 34-35
34if(r)return!1;if(n!==null)switch(n.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 _n(e,t,n,r,a,i,o){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=a,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=i,this.removeEmptyString=o}var nn={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){nn[e]=new _n(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];nn[t]=new _n(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){nn[e]=new _n(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){nn[e]=new _n(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){nn[e]=new _n(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){nn[e]=new _n(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){nn[e]=new _n(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){nn[e]=new _n(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){nn[e]=new _n(e,5,!1,e.toLowerCase(),null,!1,!1)});var Dp=/[\-:]([a-z])/g;function Lp(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(Dp,Lp);nn[t]=new _n(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(Dp,Lp);nn[t]=new _n(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(Dp,Lp);nn[t]=new _n(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){nn[e]=new _n(e,1,!1,e.toLowerCase(),null,!1,!1)});nn.xlinkHref=new _n("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){nn[e]=new _n(e,1,!1,e.toLowerCase(),null,!0,!0)});function Mp(e,t,n,r){var a=nn.hasOwnProperty(t)?nn[t]:null;(a!==null?a.type!==0:r||!(2<t.length)||t[0]!=="o"&&t[0]!=="O"||t[1]!=="n"&&t[1]!=="N")&&(qk(t,n,a,r)&&(n=null),r||a===null?Bk(t)&&(n===null?e.removeAttribute(t):e.setAttribute(t,""+n)):a.mustUseProperty?e[a.propertyName]=n===null?a.type===3?!1:"":n:(t=a.attributeName,r=a.attributeNamespace,n===null?e.removeAttribute(t):(a=a.type,n=a===3||a===4&&n===!0?"":""+n,r?e.setAttributeNS(r,t,n):e.setAttribute(t,n))))}var ms=Fk.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,zc=Symbol.for("react.element"),Ni=Symbol.for("react.portal"),ki=Symbol.for("react.fragment"),$p=Symbol.for("react.strict_mode"),Uf=Symbol.for("react.profiler"),bv=Symbol.for("react.provider"),yv=Symbol.for("react.context"),Fp=Symbol.for("react.forward_ref"),Bf=Symbol.for("react.suspense"),zf=Symbol.for("react.suspense_list"),Up=Symbol.for("react.memo"),ks=Symbol.for("react.lazy"),vv=Symbol.for("react.offscreen"),Ax=Symbol.iterator;function Ho(e){return e===null||typeof e!="object"?null:(e=Ax&&e[Ax]||e["@@iterator"],typeof e=="function"?e:null)}var St=Object.assign,Rh;function sl(e){if(Rh===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);Rh=t&&t[1]||""}return`
35`+Rh+e}var Ah=!1;function Ih(e,t){if(!e||Ah)return"";Ah=!0;var n=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(d){var r=d}Reflect.construct(e,[],t)}else{try{t.call()}catch(d){r=d}e.call(t.prototype)}else{try{throw Error()}catch(d){r=d}e()}}
vendor: 5,289 bytes, lines 35-38
35catch(d){if(d&&r&&typeof d.stack=="string"){for(var a=d.stack.split(`
36`),i=r.stack.split(`
37`),o=a.length-1,l=i.length-1;1<=o&&0<=l&&a[o]!==i[l];)l--;for(;1<=o&&0<=l;o--,l--)if(a[o]!==i[l]){if(o!==1||l!==1)do if(o--,l--,0>l||a[o]!==i[l]){var c=`
38`+a[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{Ah=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?sl(e):""}function Vk(e){switch(e.tag){case 5:return sl(e.type);case 16:return sl("Lazy");case 13:return sl("Suspense");case 19:return sl("SuspenseList");case 0:case 2:case 15:return e=Ih(e.type,!1),e;case 11:return e=Ih(e.type.render,!1),e;case 1:return e=Ih(e.type,!0),e;default:return""}}function qf(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 ki:return"Fragment";case Ni:return"Portal";case Uf:return"Profiler";case $p:return"StrictMode";case Bf:return"Suspense";case zf:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case yv:return(e.displayName||"Context")+".Consumer";case bv:return(e._context.displayName||"Context")+".Provider";case Fp:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Up:return t=e.displayName||null,t!==null?t:qf(e.type)||"Memo";case ks:t=e._payload,e=e._init;try{return qf(e(t))}catch{}}return null}function Wk(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 qf(t);case 8:return t===$p?"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 ta(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function wv(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function Hk(e){var t=wv(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var a=n.get,i=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return a.call(this)},set:function(o){r=""+o,i.call(this,o)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(o){r=""+o},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function qc(e){e._valueTracker||(e._valueTracker=Hk(e))}function _v(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=wv(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function qu(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 Vf(e,t){var n=t.checked;return St({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function Ix(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=ta(t.value!=null?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function jv(e,t){t=t.checked,t!=null&&Mp(e,"checked",t,!1)}function Wf(e,t){jv(e,t);var n=ta(t.value),r=t.type;if(n!=null)r==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?Hf(e,t.type,n):t.hasOwnProperty("defaultValue")&&Hf(e,t.type,ta(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function Ox(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!(r!=="submit"&&r!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function Hf(e,t,n){(t!=="number"||qu(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var al=Array.isArray;function $i(e,t,n,r){if(e=e.options,t){t={};for(var a=0;a<n.length;a++)t["$"+n[a]]=!0;for(n=0;n<e.length;n++)a=t.hasOwnProperty("$"+e[n].value),e[n].selected!==a&&(e[n].selected=a),a&&r&&(e[n].defaultSelected=!0)}else{for(n=""+ta(n),t=null,a=0;a<e.length;a++){if(e[a].value===n){e[a].selected=!0,r&&(e[a].defaultSelected=!0);return}t!==null||e[a].disabled||(t=e[a])}t!==null&&(t.selected=!0)}}function Gf(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(re(91)
vendor: 11,310 bytes, line 38
38);return St({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function Dx(e,t){var n=t.value;if(n==null){if(n=t.children,t=t.defaultValue,n!=null){if(t!=null)throw Error(re(92));if(al(n)){if(1<n.length)throw Error(re(93));n=n[0]}t=n}t==null&&(t=""),n=t}e._wrapperState={initialValue:ta(n)}}function Nv(e,t){var n=ta(t.value),r=ta(t.defaultValue);n!=null&&(n=""+n,n!==e.value&&(e.value=n),t.defaultValue==null&&e.defaultValue!==n&&(e.defaultValue=n)),r!=null&&(e.defaultValue=""+r)}function Lx(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==""&&t!==null&&(e.value=t)}function kv(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 Kf(e,t){return e==null||e==="http://www.w3.org/1999/xhtml"?kv(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var Vc,Sv=function(e){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(t,n,r,a){MSApp.execUnsafeLocalFunction(function(){return e(t,n,r,a)})}:e}(function(e,t){if(e.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in e)e.innerHTML=t;else{for(Vc=Vc||document.createElement("div"),Vc.innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=Vc.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Pl(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var fl={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},Gk=["Webkit","ms","Moz","O"];Object.keys(fl).forEach(function(e){Gk.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),fl[t]=fl[e]})});function Cv(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||fl.hasOwnProperty(e)&&fl[e]?(""+t).trim():t+"px"}function Ev(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,a=Cv(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,a):e[n]=a}}var Kk=St({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 Yf(e,t){if(t){if(Kk[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(re(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(re(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(re(61))}if(t.style!=null&&typeof t.style!="object")throw Error(re(62))}}function Qf(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 Jf=null;function Bp(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Xf=null,Fi=null,Ui=null;function Mx(e){if(e=gc(e)){if(typeof Xf!="function")throw Error(re(280));var t=e.stateNode;t&&(t=Ld(t),Xf(e.stateNode,e.type,t))}}function Pv(e){Fi?Ui?Ui.push(e):Ui=[e]:Fi=e}function Tv(){if(Fi){var e=Fi,t=Ui;if(Ui=Fi=null,Mx(e),t)for(e=0;e<t.length;e++)Mx(t[e])}}function Rv(e,t){return e(t)}function Av(){}var Oh=!1;function Iv(e,t,n){if(Oh)return e(t,n);Oh=!0;try{return Rv(e,t,n)}finally{Oh=!1,(Fi!==null||Ui!==null)&&(Av(),Tv())}}function Tl(e,t){var n=e.stateNode;if(n===null)return null;var r=Ld(n);if(r===null)return null;n=r[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":(r=!r.disabled)||(e=e.type,r=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!r;break e;default:e=!1}if(e)return null;if(n&&typeof n!="function")throw Error(re(231,t,typeof n));return n}var Zf=!1;if(ss)try{var Go={};Object.defineProperty(Go,"passive",{get:function(){Zf=!0}}),window.addEventListener("test",Go,Go),window.removeEventListener("test",Go,Go)}catch{Zf=!1}function Yk(e,t,n,r,a,i,o,l,c){var d=Array.prototype.slice.call(arguments,3);try{t.apply(n,d)}catch(u){this.onError(u)}}var ml=!1,Vu=null,Wu=!1,em=null,Qk={onError:function(e){ml=!0,Vu=e}};function Jk(e,t,n,r,a,i,o,l,c){ml=!1,Vu=null,Yk.apply(Qk,arguments)}function Xk(e,t,n,r,a,i,o,l,c){if(Jk.apply(this,arguments),ml){if(ml){var d=Vu;ml=!1,Vu=null}else throw Error(re(198));Wu||(Wu=!0,em=d)}}function ti(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function Ov(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 $x(e){if(ti(e)!==e)throw Error(re(188))}function Zk(e){var t=e.alternate;if(!t){if(t=ti(e),t===null)throw Error(re(188));return t!==e?null:e}for(var n=e,r=t;;){var a=n.return;if(a===null)break;var i=a.alternate;if(i===null){if(r=a.return,r!==null){n=r;continue}break}if(a.child===i.child){for(i=a.child;i;){if(i===n)return $x(a),e;if(i===r)return $x(a),t;i=i.sibling}throw Error(re(188))}if(n.return!==r.return)n=a,r=i;else{for(var o=!1,l=a.child;l;){if(l===n){o=!0,n=a,r=i;break}if(l===r){o=!0,r=a,n=i;break}l=l.sibling}if(!o){for(l=i.child;l;){if(l===n){o=!0,n=i,r=a;break}if(l===r){o=!0,r=i,n=a;break}l=l.sibling}if(!o)throw Error(re(189))}}if(n.alternate!==r)throw Error(re(190))}if(n.tag!==3)throw Error(re(188));return n.stateNode.current===n?e:t}function Dv(e){return e=Zk(e),e!==null?Lv(e):null}function Lv(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=Lv(e);if(t!==null)return t;e=e.sibling}return null}var Mv=zn.unstable_scheduleCallback,Fx=zn.unstable_cancelCallback,eS=zn.unstable_shouldYield,tS=zn.unstable_requestPaint,It=zn.unstable_now,nS=zn.unstable_getCurrentPriorityLevel,zp=zn.unstable_ImmediatePriority,$v=zn.unstable_UserBlockingPriority,Hu=zn.unstable_NormalPriority,rS=zn.unstable_LowPriority,Fv=zn.unstable_IdlePriority,Ad=null,Dr=null;function sS(e){if(Dr&&typeof Dr.onCommitFiberRoot=="function")try{Dr.onCommitFiberRoot(Ad,e,void 0,(e.current.flags&128)===128)}catch{}}var pr=Math.clz32?Math.clz32:oS,aS=Math.log,iS=Math.LN2;function oS(e){return e>>>=0,e===0?32:31-(aS(e)/iS|0)|0}var Wc=64,Hc=4194304;function il(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 Gu(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,a=e.suspendedLanes,i=e.pingedLanes,o=n&268435455;if(o!==0){var l=o&~a;l!==0?r=il(l):(i&=o,i!==0&&(r=il(i)))}else o=n&~a,o!==0?r=il(o):i!==0&&(r=il(i));if(r===0)return 0;if(t!==0&&t!==r&&!(t&a)&&(a=r&-r,i=t&-t,a>=i||a===16&&(i&4194240)!==0))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0<t;)n=31-pr(t),a=1<<n,r|=e[n],t&=~a;return r}function lS(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 cS(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,a=e.expirationTimes,i=e.pendingLanes;0<i;){var o=31-pr(i),l=1<<o,c=a[o];c===-1?(!(l&n)||l&r)&&(a[o]=lS(l,t)):c<=t&&(e.expiredLanes|=l),i&=~l}}function tm(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function Uv(){var e=Wc;return Wc<<=1,!(Wc&4194240)&&(Wc=64),e}function Dh(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function pc(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-pr(t),e[t]=n}function uS(e,t){var n=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 r=e.eventTimes;for(e=e.expirationTimes;0<n;){var a=31-pr(n),i=1<<a;t[a]=0,r[a]=-1,e[a]=-1,n&=~i}}function qp(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-pr(n),a=1<<r;a&t|e[r]&t&&(e[r]|=t),n&=~a}}var ot=0;function Bv(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var zv,Vp,qv,Vv,Wv,nm=!1,Gc=[],Ws=null,Hs=null,Gs=null,Rl=new Map,Al=new Map,Ps=[],dS="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 Ux(e,t){switch(e){case"focusin":case"focusout":Ws=null;break;case"dragenter":case"dragleave":Hs=null;break;case"mouseover":case"mouseout":Gs=null;break;case"pointerover":case"pointerout":Rl.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Al.delete(t.pointerId)}}function Ko(e,t,n,r,a,i){return e===null||e.nativeEvent!==i?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:i,targetContainers:[a]},t!==null&&(t=gc(t),t!==null&&Vp(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,a!==null&&t.indexOf(a)===-1&&t.push(a),e)}function hS(e,t,n,r,a){switch(t){case"focusin":return Ws=Ko(Ws,e,t,n,r,a),!0;case"dragenter":return Hs=Ko(Hs,e,t,n,r,a),!0;case"mouseover":return Gs=Ko(Gs,e,t,n,r,a),!0;case"pointerover":var i=a.pointerId;return Rl.set(i,Ko(Rl.get(i)||null,e,t,n,r,a)),!0;case"gotpointercapture":return i=a.pointerId,Al.set(i,Ko(Al.get(i)||null,e,t,n,r,a)),!0}return!1}function Hv(e){var t=Ca(e.target);if(t!==null){var n=ti(t);if(n!==null){if(t=n.tag,t===13){if(t=Ov(n),t!==null){e.blockedOn=t,Wv(e.priority,function(){qv(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Su(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=rm(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);Jf=r,n.target.dispatchEvent(r),Jf=null}else return t=gc(n),t!==null&&Vp(t),e.blockedOn=n,!1;t.shift()}return!0}
vendor: 11,675 bytes, line 38
38function Bx(e,t,n){Su(e)&&n.delete(t)}function fS(){nm=!1,Ws!==null&&Su(Ws)&&(Ws=null),Hs!==null&&Su(Hs)&&(Hs=null),Gs!==null&&Su(Gs)&&(Gs=null),Rl.forEach(Bx),Al.forEach(Bx)}function Yo(e,t){e.blockedOn===t&&(e.blockedOn=null,nm||(nm=!0,zn.unstable_scheduleCallback(zn.unstable_NormalPriority,fS)))}function Il(e){function t(a){return Yo(a,e)}if(0<Gc.length){Yo(Gc[0],e);for(var n=1;n<Gc.length;n++){var r=Gc[n];r.blockedOn===e&&(r.blockedOn=null)}}for(Ws!==null&&Yo(Ws,e),Hs!==null&&Yo(Hs,e),Gs!==null&&Yo(Gs,e),Rl.forEach(t),Al.forEach(t),n=0;n<Ps.length;n++)r=Ps[n],r.blockedOn===e&&(r.blockedOn=null);for(;0<Ps.length&&(n=Ps[0],n.blockedOn===null);)Hv(n),n.blockedOn===null&&Ps.shift()}var Bi=ms.ReactCurrentBatchConfig,Ku=!0;function mS(e,t,n,r){var a=ot,i=Bi.transition;Bi.transition=null;try{ot=1,Wp(e,t,n,r)}finally{ot=a,Bi.transition=i}}function pS(e,t,n,r){var a=ot,i=Bi.transition;Bi.transition=null;try{ot=4,Wp(e,t,n,r)}finally{ot=a,Bi.transition=i}}function Wp(e,t,n,r){if(Ku){var a=rm(e,t,n,r);if(a===null)Wh(e,t,r,Yu,n),Ux(e,r);else if(hS(a,e,t,n,r))r.stopPropagation();else if(Ux(e,r),t&4&&-1<dS.indexOf(e)){for(;a!==null;){var i=gc(a);if(i!==null&&zv(i),i=rm(e,t,n,r),i===null&&Wh(e,t,r,Yu,n),i===a)break;a=i}a!==null&&r.stopPropagation()}else Wh(e,t,r,null,n)}}var Yu=null;function rm(e,t,n,r){if(Yu=null,e=Bp(r),e=Ca(e),e!==null)if(t=ti(e),t===null)e=null;else if(n=t.tag,n===13){if(e=Ov(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null);return Yu=e,null}function Gv(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(nS()){case zp:return 1;case $v:return 4;case Hu:case rS:return 16;case Fv:return 536870912;default:return 16}default:return 16}}var zs=null,Hp=null,Cu=null;function Kv(){if(Cu)return Cu;var e,t=Hp,n=t.length,r,a="value"in zs?zs.value:zs.textContent,i=a.length;for(e=0;e<n&&t[e]===a[e];e++);var o=n-e;for(r=1;r<=o&&t[n-r]===a[i-r];r++);return Cu=a.slice(e,1<r?1-r:void 0)}function Eu(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 Kc(){return!0}function zx(){return!1}function Vn(e){function t(n,r,a,i,o){this._reactName=n,this._targetInst=a,this.type=r,this.nativeEvent=i,this.target=o,this.currentTarget=null;for(var l in e)e.hasOwnProperty(l)&&(n=e[l],this[l]=n?n(i):i[l]);return this.isDefaultPrevented=(i.defaultPrevented!=null?i.defaultPrevented:i.returnValue===!1)?Kc:zx,this.isPropagationStopped=zx,this}return St(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var n=this.nativeEvent;n&&(n.preventDefault?n.preventDefault():typeof n.returnValue!="unknown"&&(n.returnValue=!1),this.isDefaultPrevented=Kc)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=Kc)},persist:function(){},isPersistent:Kc}),t}var vo={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Gp=Vn(vo),xc=St({},vo,{view:0,detail:0}),xS=Vn(xc),Lh,Mh,Qo,Id=St({},xc,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Kp,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!==Qo&&(Qo&&e.type==="mousemove"?(Lh=e.screenX-Qo.screenX,Mh=e.screenY-Qo.screenY):Mh=Lh=0,Qo=e),Lh)},movementY:function(e){return"movementY"in e?e.movementY:Mh}}),qx=Vn(Id),gS=St({},Id,{dataTransfer:0}),bS=Vn(gS),yS=St({},xc,{relatedTarget:0}),$h=Vn(yS),vS=St({},vo,{animationName:0,elapsedTime:0,pseudoElement:0}),wS=Vn(vS),_S=St({},vo,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),jS=Vn(_S),NS=St({},vo,{data:0}),Vx=Vn(NS),kS={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},SS={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"},CS={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function ES(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=CS[e])?!!t[e]:!1}function Kp(){return ES}var PS=St({},xc,{key:function(e){if(e.key){var t=kS[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=Eu(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?SS[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Kp,charCode:function(e){return e.type==="keypress"?Eu(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Eu(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),TS=Vn(PS),RS=St({},Id,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Wx=Vn(RS),AS=St({},xc,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Kp}),IS=Vn(AS),OS=St({},vo,{propertyName:0,elapsedTime:0,pseudoElement:0}),DS=Vn(OS),LS=St({},Id,{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}),MS=Vn(LS),$S=[9,13,27,32],Yp=ss&&"CompositionEvent"in window,pl=null;ss&&"documentMode"in document&&(pl=document.documentMode);var FS=ss&&"TextEvent"in window&&!pl,Yv=ss&&(!Yp||pl&&8<pl&&11>=pl),Hx=" ",Gx=!1;function Qv(e,t){switch(e){case"keyup":return $S.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Jv(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Si=!1;function US(e,t){switch(e){case"compositionend":return Jv(t);case"keypress":return t.which!==32?null:(Gx=!0,Hx);case"textInput":return e=t.data,e===Hx&&Gx?null:e;default:return null}}function BS(e,t){if(Si)return e==="compositionend"||!Yp&&Qv(e,t)?(e=Kv(),Cu=Hp=zs=null,Si=!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 Yv&&t.locale!=="ko"?null:t.data;default:return null}}var zS={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 Kx(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!zS[e.type]:t==="textarea"}function Xv(e,t,n,r){Pv(r),t=Qu(t,"onChange"),0<t.length&&(n=new Gp("onChange","change",null,n,r),e.push({event:n,listeners:t}))}var xl=null,Ol=null;function qS(e){cw(e,0)}function Od(e){var t=Pi(e);if(_v(t))return e}function VS(e,t){if(e==="change")return t}var Zv=!1;if(ss){var Fh;if(ss){var Uh="oninput"in document;if(!Uh){var Yx=document.createElement("div");Yx.setAttribute("oninput","return;"),Uh=typeof Yx.oninput=="function"}Fh=Uh}else Fh=!1;Zv=Fh&&(!document.documentMode||9<document.documentMode)}function Qx(){xl&&(xl.detachEvent("onpropertychange",ew),Ol=xl=null)}function ew(e){if(e.propertyName==="value"&&Od(Ol)){var t=[];Xv(t,Ol,e,Bp(e)),Iv(qS,t)}}function WS(e,t,n){e==="focusin"?(Qx(),xl=t,Ol=n,xl.attachEvent("onpropertychange",ew)):e==="focusout"&&Qx()}function HS(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Od(Ol)}function GS(e,t){if(e==="click")return Od(t)}function KS(e,t){if(e==="input"||e==="change")return Od(t)}function YS(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var br=typeof Object.is=="function"?Object.is:YS;function Dl(e,t){if(br(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var a=n[r];if(!Ff.call(t,a)||!br(e[a],t[a]))return!1}return!0}function Jx(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Xx(e,t){var n=Jx(e);e=0;for(var r;n;){if(n.nodeType===3){if(r=e+n.textContent.length,e<=t&&r>=t)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=Jx(n)}}function tw(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?tw(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function nw(){for(var e=window,t=qu();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=qu(e.document)}return t}function Qp(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 QS(e){var t=nw(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&tw(n.ownerDocument.documentElement,n)){if(r!==null&&Qp(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var a=n.textContent.length,i=Math.min(r.start,a);r=r.end===void 0?i:Math.min(r.end,a),!e.extend&&i>r&&(a=r,r=i,i=a),a=Xx(n,i);var o=Xx(n,r);a&&o&&(e.rangeCount!==1||e.anchorNode!==a.node||e.anchorOffset!==a.offset||e.focusNode!==o.node||e.focusOffset!==o.offset)&&(t=t.createRange(),t.setStart(a.node,a.offset),e.removeAllRanges(),i>r?(e.addRange(t),e.extend(o.node,o.offset)):(t.setEnd(o.node,o.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n<t.length;n++)e=t[n],e.element.scrollLeft=e.left,e.element.scrollTop=e.top}}var JS=ss&&"documentMode"in document&&11>=document.documentMode,Ci=null,sm=null,gl=null,am=!1;
vendor: 4,821 bytes, line 38
38function Zx(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;am||Ci==null||Ci!==qu(r)||(r=Ci,"selectionStart"in r&&Qp(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),gl&&Dl(gl,r)||(gl=r,r=Qu(sm,"onSelect"),0<r.length&&(t=new Gp("onSelect","select",null,t,n),e.push({event:t,listeners:r}),t.target=Ci)))}function Yc(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var Ei={animationend:Yc("Animation","AnimationEnd"),animationiteration:Yc("Animation","AnimationIteration"),animationstart:Yc("Animation","AnimationStart"),transitionend:Yc("Transition","TransitionEnd")},Bh={},rw={};ss&&(rw=document.createElement("div").style,"AnimationEvent"in window||(delete Ei.animationend.animation,delete Ei.animationiteration.animation,delete Ei.animationstart.animation),"TransitionEvent"in window||delete Ei.transitionend.transition);function Dd(e){if(Bh[e])return Bh[e];if(!Ei[e])return e;var t=Ei[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in rw)return Bh[e]=t[n];return e}var sw=Dd("animationend"),aw=Dd("animationiteration"),iw=Dd("animationstart"),ow=Dd("transitionend"),lw=new Map,eg="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 ia(e,t){lw.set(e,t),ei(t,[e])}for(var zh=0;zh<eg.length;zh++){var qh=eg[zh],XS=qh.toLowerCase(),ZS=qh[0].toUpperCase()+qh.slice(1);ia(XS,"on"+ZS)}ia(sw,"onAnimationEnd");ia(aw,"onAnimationIteration");ia(iw,"onAnimationStart");ia("dblclick","onDoubleClick");ia("focusin","onFocus");ia("focusout","onBlur");ia(ow,"onTransitionEnd");oo("onMouseEnter",["mouseout","mouseover"]);oo("onMouseLeave",["mouseout","mouseover"]);oo("onPointerEnter",["pointerout","pointerover"]);oo("onPointerLeave",["pointerout","pointerover"]);ei("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));ei("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));ei("onBeforeInput",["compositionend","keypress","textInput","paste"]);ei("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));ei("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));ei("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var ol="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(" "),e2=new Set("cancel close invalid load scroll toggle".split(" ").concat(ol));function tg(e,t,n){var r=e.type||"unknown-event";e.currentTarget=n,Xk(r,t,void 0,e),e.currentTarget=null}function cw(e,t){t=(t&4)!==0;for(var n=0;n<e.length;n++){var r=e[n],a=r.event;r=r.listeners;e:{var i=void 0;if(t)for(var o=r.length-1;0<=o;o--){var l=r[o],c=l.instance,d=l.currentTarget;if(l=l.listener,c!==i&&a.isPropagationStopped())break e;tg(a,l,d),i=c}else for(o=0;o<r.length;o++){if(l=r[o],c=l.instance,d=l.currentTarget,l=l.listener,c!==i&&a.isPropagationStopped())break e;tg(a,l,d),i=c}}}if(Wu)throw e=em,Wu=!1,em=null,e}function gt(e,t){var n=t[um];n===void 0&&(n=t[um]=new Set);var r=e+"__bubble";n.has(r)||(uw(t,e,2,!1),n.add(r))}function Vh(e,t,n){var r=0;t&&(r|=4),uw(n,e,r,t)}var Qc="_reactListening"+Math.random().toString(36).slice(2);function Ll(e){if(!e[Qc]){e[Qc]=!0,gv.forEach(function(n){n!=="selectionchange"&&(e2.has(n)||Vh(n,!1,e),Vh(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Qc]||(t[Qc]=!0,Vh("selectionchange",!1,t))}}function uw(e,t,n,r){switch(Gv(t)){case 1:var a=mS;break;case 4:a=pS;break;default:a=Wp}n=a.bind(null,t,n,e),a=void 0,!Zf||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(a=!0),r?a!==void 0?e.addEventListener(t,n,{capture:!0,passive:a}):e.addEventListener(t,n,!0):a!==void 0?e.addEventListener(t,n,{passive:a}):e.addEventListener(t,n,!1)}function Wh(e,t,n,r,a){var i=r;if(!(t&1)&&!(t&2)&&r!==null)e:for(;;){if(r===null)return;var o=r.tag;if(o===3||o===4){var l=r.stateNode.containerInfo;
vendor: 2,527 bytes, line 38
38if(l===a||l.nodeType===8&&l.parentNode===a)break;if(o===4)for(o=r.return;o!==null;){var c=o.tag;if((c===3||c===4)&&(c=o.stateNode.containerInfo,c===a||c.nodeType===8&&c.parentNode===a))return;o=o.return}for(;l!==null;){if(o=Ca(l),o===null)return;if(c=o.tag,c===5||c===6){r=i=o;continue e}l=l.parentNode}}r=r.return}Iv(function(){var d=i,u=Bp(n),f=[];e:{var m=lw.get(e);if(m!==void 0){var p=Gp,v=e;switch(e){case"keypress":if(Eu(n)===0)break e;case"keydown":case"keyup":p=TS;break;case"focusin":v="focus",p=$h;break;case"focusout":v="blur",p=$h;break;case"beforeblur":case"afterblur":p=$h;break;case"click":if(n.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":p=qx;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":p=bS;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":p=IS;break;case sw:case aw:case iw:p=wS;break;case ow:p=DS;break;case"scroll":p=xS;break;case"wheel":p=MS;break;case"copy":case"cut":case"paste":p=jS;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":p=Wx}var g=(t&4)!==0,y=!g&&e==="scroll",b=g?m!==null?m+"Capture":null:m;g=[];for(var x=d,w;x!==null;){w=x;var _=w.stateNode;if(w.tag===5&&_!==null&&(w=_,b!==null&&(_=Tl(x,b),_!=null&&g.push(Ml(x,_,w)))),y)break;x=x.return}0<g.length&&(m=new p(m,v,null,n,u),f.push({event:m,listeners:g}))}}if(!(t&7)){e:{if(m=e==="mouseover"||e==="pointerover",p=e==="mouseout"||e==="pointerout",m&&n!==Jf&&(v=n.relatedTarget||n.fromElement)&&(Ca(v)||v[as]))break e;if((p||m)&&(m=u.window===u?u:(m=u.ownerDocument)?m.defaultView||m.parentWindow:window,p?(v=n.relatedTarget||n.toElement,p=d,v=v?Ca(v):null,v!==null&&(y=ti(v),v!==y||v.tag!==5&&v.tag!==6)&&(v=null)):(p=null,v=d),p!==v)){if(g=qx,_="onMouseLeave",b="onMouseEnter",x="mouse",(e==="pointerout"||e==="pointerover")&&(g=Wx,_="onPointerLeave",b="onPointerEnter",x="pointer"),y=p==null?m:Pi(p),w=v==null?m:Pi(v),m=new g(_,x+"leave",p,n,u),m.target=y,m.relatedTarget=w,_=null,Ca(u)===d&&(g=new g(b,x+"enter",v,n,u),g.target=w,g.relatedTarget=y,_=g),y=_,p&&v)t:{for(g=p,b=v,x=0,w=g;w;w=di(w))x++;for(w=0,_=b;_;_=di(_))w++;for(;0<x-w;)g=di(g),x--;for(;0<w-x;)b=di(b),w--;for(;x--;){if(g===b||b!==null&&g===b.alternate)break t;g=di(g),b=di(b)}g=null}else g=null;p!==null&&ng(f,m,p,g,!1),v!==null&&y!==null&&ng(f,y,v,g,!0)}}
vendor: 4,115 bytes, lines 38-39
38e:{if(m=d?Pi(d):window,p=m.nodeName&&m.nodeName.toLowerCase(),p==="select"||p==="input"&&m.type==="file")var j=VS;else if(Kx(m))if(Zv)j=KS;else{j=HS;var N=WS}else(p=m.nodeName)&&p.toLowerCase()==="input"&&(m.type==="checkbox"||m.type==="radio")&&(j=GS);if(j&&(j=j(e,d))){Xv(f,j,n,u);break e}N&&N(e,m,d),e==="focusout"&&(N=m._wrapperState)&&N.controlled&&m.type==="number"&&Hf(m,"number",m.value)}switch(N=d?Pi(d):window,e){case"focusin":(Kx(N)||N.contentEditable==="true")&&(Ci=N,sm=d,gl=null);break;case"focusout":gl=sm=Ci=null;break;case"mousedown":am=!0;break;case"contextmenu":case"mouseup":case"dragend":am=!1,Zx(f,n,u);break;case"selectionchange":if(JS)break;case"keydown":case"keyup":Zx(f,n,u)}var k;if(Yp)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 Si?Qv(e,n)&&(C="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(C="onCompositionStart");C&&(Yv&&n.locale!=="ko"&&(Si||C!=="onCompositionStart"?C==="onCompositionEnd"&&Si&&(k=Kv()):(zs=u,Hp="value"in zs?zs.value:zs.textContent,Si=!0)),N=Qu(d,C),0<N.length&&(C=new Vx(C,e,null,n,u),f.push({event:C,listeners:N}),k?C.data=k:(k=Jv(n),k!==null&&(C.data=k)))),(k=FS?US(e,n):BS(e,n))&&(d=Qu(d,"onBeforeInput"),0<d.length&&(u=new Vx("onBeforeInput","beforeinput",null,n,u),f.push({event:u,listeners:d}),u.data=k))}cw(f,t)})}function Ml(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Qu(e,t){for(var n=t+"Capture",r=[];e!==null;){var a=e,i=a.stateNode;a.tag===5&&i!==null&&(a=i,i=Tl(e,n),i!=null&&r.unshift(Ml(e,i,a)),i=Tl(e,t),i!=null&&r.push(Ml(e,i,a))),e=e.return}return r}function di(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function ng(e,t,n,r,a){for(var i=t._reactName,o=[];n!==null&&n!==r;){var l=n,c=l.alternate,d=l.stateNode;if(c!==null&&c===r)break;l.tag===5&&d!==null&&(l=d,a?(c=Tl(n,i),c!=null&&o.unshift(Ml(n,c,l))):a||(c=Tl(n,i),c!=null&&o.push(Ml(n,c,l)))),n=n.return}o.length!==0&&e.push({event:t,listeners:o})}var t2=/\r\n?/g,n2=/\u0000|\uFFFD/g;function rg(e){return(typeof e=="string"?e:""+e).replace(t2,`
39`).replace(n2,"")}function Jc(e,t,n){if(t=rg(t),rg(e)!==t&&n)throw Error(re(425))}function Ju(){}var im=null,om=null;function lm(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 cm=typeof setTimeout=="function"?setTimeout:void 0,r2=typeof clearTimeout=="function"?clearTimeout:void 0,sg=typeof Promise=="function"?Promise:void 0,s2=typeof queueMicrotask=="function"?queueMicrotask:typeof sg<"u"?function(e){return sg.resolve(null).then(e).catch(a2)}:cm;function a2(e){setTimeout(function(){throw e})}function Hh(e,t){var n=t,r=0;do{var a=n.nextSibling;if(e.removeChild(n),a&&a.nodeType===8)if(n=a.data,n==="/$"){if(r===0){e.removeChild(a),Il(t);return}r--}else n!=="$"&&n!=="$?"&&n!=="$!"||r++;n=a}while(n);Il(t)}function Ks(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 ag(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="$"||n==="$!"||n==="$?"){if(t===0)return e;t--}else n==="/$"&&t++}e=e.previousSibling}return null}var wo=Math.random().toString(36).slice(2),Ar="__reactFiber$"+wo,$l="__reactProps$"+wo,as="__reactContainer$"+wo,um="__reactEvents$"+wo,i2="__reactListeners$"+wo,o2="__reactHandles$"+wo;function Ca(e){var t=e[Ar];if(t)return t;for(var n=e.parentNode;n;){if(t=n[as]||n[Ar]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=ag(e);e!==null;){if(n=e[Ar])return n;e=ag(e)}return t}e=n,n=e.parentNode}return null}function gc(e){return e=e[Ar]||e[as],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function Pi(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(re(33))}function Ld(e){return e[$l]||null}var dm=[],Ti=-1;function oa(e){return{current:e}}function yt(e){0>
vendor: 14,936 bytes, line 39
39Ti||(e.current=dm[Ti],dm[Ti]=null,Ti--)}function ht(e,t){Ti++,dm[Ti]=e.current,e.current=t}var na={},fn=oa(na),En=oa(!1),qa=na;function lo(e,t){var n=e.type.contextTypes;if(!n)return na;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var a={},i;for(i in n)a[i]=t[i];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=a),a}function Pn(e){return e=e.childContextTypes,e!=null}function Xu(){yt(En),yt(fn)}function ig(e,t,n){if(fn.current!==na)throw Error(re(168));ht(fn,t),ht(En,n)}function dw(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var a in r)if(!(a in t))throw Error(re(108,Wk(e)||"Unknown",a));return St({},n,r)}function Zu(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||na,qa=fn.current,ht(fn,e),ht(En,En.current),!0}function og(e,t,n){var r=e.stateNode;if(!r)throw Error(re(169));n?(e=dw(e,t,qa),r.__reactInternalMemoizedMergedChildContext=e,yt(En),yt(fn),ht(fn,e)):yt(En),ht(En,n)}var Jr=null,Md=!1,Gh=!1;function hw(e){Jr===null?Jr=[e]:Jr.push(e)}function l2(e){Md=!0,hw(e)}function la(){if(!Gh&&Jr!==null){Gh=!0;var e=0,t=ot;try{var n=Jr;for(ot=1;e<n.length;e++){var r=n[e];do r=r(!0);while(r!==null)}Jr=null,Md=!1}catch(a){throw Jr!==null&&(Jr=Jr.slice(e+1)),Mv(zp,la),a}finally{ot=t,Gh=!1}}return null}var Ri=[],Ai=0,ed=null,td=0,Kn=[],Yn=0,Va=null,es=1,ts="";function wa(e,t){Ri[Ai++]=td,Ri[Ai++]=ed,ed=e,td=t}function fw(e,t,n){Kn[Yn++]=es,Kn[Yn++]=ts,Kn[Yn++]=Va,Va=e;var r=es;e=ts;var a=32-pr(r)-1;r&=~(1<<a),n+=1;var i=32-pr(t)+a;if(30<i){var o=a-a%5;i=(r&(1<<o)-1).toString(32),r>>=o,a-=o,es=1<<32-pr(t)+a|n<<a|r,ts=i+e}else es=1<<i|n<<a|r,ts=e}function Jp(e){e.return!==null&&(wa(e,1),fw(e,1,0))}function Xp(e){for(;e===ed;)ed=Ri[--Ai],Ri[Ai]=null,td=Ri[--Ai],Ri[Ai]=null;for(;e===Va;)Va=Kn[--Yn],Kn[Yn]=null,ts=Kn[--Yn],Kn[Yn]=null,es=Kn[--Yn],Kn[Yn]=null}var Un=null,Fn=null,vt=!1,hr=null;function mw(e,t){var n=Qn(5,null,null,0);n.elementType="DELETED",n.stateNode=t,n.return=e,t=e.deletions,t===null?(e.deletions=[n],e.flags|=16):t.push(n)}function lg(e,t){switch(e.tag){case 5:var n=e.type;return t=t.nodeType!==1||n.toLowerCase()!==t.nodeName.toLowerCase()?null:t,t!==null?(e.stateNode=t,Un=e,Fn=Ks(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,Un=e,Fn=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(n=Va!==null?{id:es,overflow:ts}:null,e.memoizedState={dehydrated:t,treeContext:n,retryLane:1073741824},n=Qn(18,null,null,0),n.stateNode=t,n.return=e,e.child=n,Un=e,Fn=null,!0):!1;default:return!1}}function hm(e){return(e.mode&1)!==0&&(e.flags&128)===0}function fm(e){if(vt){var t=Fn;if(t){var n=t;if(!lg(e,t)){if(hm(e))throw Error(re(418));t=Ks(n.nextSibling);var r=Un;t&&lg(e,t)?mw(r,n):(e.flags=e.flags&-4097|2,vt=!1,Un=e)}}else{if(hm(e))throw Error(re(418));e.flags=e.flags&-4097|2,vt=!1,Un=e}}}function cg(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;Un=e}function Xc(e){if(e!==Un)return!1;if(!vt)return cg(e),vt=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!=="head"&&t!=="body"&&!lm(e.type,e.memoizedProps)),t&&(t=Fn)){if(hm(e))throw pw(),Error(re(418));for(;t;)mw(e,t),t=Ks(t.nextSibling)}if(cg(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(re(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"){if(t===0){Fn=Ks(e.nextSibling);break e}t--}else n!=="$"&&n!=="$!"&&n!=="$?"||t++}e=e.nextSibling}Fn=null}}else Fn=Un?Ks(e.stateNode.nextSibling):null;return!0}function pw(){for(var e=Fn;e;)e=Ks(e.nextSibling)}function co(){Fn=Un=null,vt=!1}function Zp(e){hr===null?hr=[e]:hr.push(e)}var c2=ms.ReactCurrentBatchConfig;function Jo(e,t,n){if(e=n.ref,e!==null&&typeof e!="function"&&typeof e!="object"){if(n._owner){if(n=n._owner,n){if(n.tag!==1)throw Error(re(309));var r=n.stateNode}if(!r)throw Error(re(147,e));var a=r,i=""+e;return t!==null&&t.ref!==null&&typeof t.ref=="function"&&t.ref._stringRef===i?t.ref:(t=function(o){var l=a.refs;o===null?delete l[i]:l[i]=o},t._stringRef=i,t)}if(typeof e!="string")throw Error(re(284));if(!n._owner)throw Error(re(290,e))}return e}function Zc(e,t){throw e=Object.prototype.toString.call(t),Error(re(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function ug(e){var t=e._init;return t(e._payload)}function xw(e){function t(b,x){if(e){var w=b.deletions;w===null?(b.deletions=[x],b.flags|=16):w.push(x)}}function n(b,x){if(!e)return null;for(;x!==null;)t(b,x),x=x.sibling;return null}function r(b,x){for(b=new Map;x!==null;)x.key!==null?b.set(x.key,x):b.set(x.index,x),x=x.sibling;return b}function a(b,x){return b=Xs(b,x),b.index=0,b.sibling=null,b}function i(b,x,w){return b.index=w,e?(w=b.alternate,w!==null?(w=w.index,w<x?(b.flags|=2,x):w):(b.flags|=2,x)):(b.flags|=1048576,x)}function o(b){return e&&b.alternate===null&&(b.flags|=2),b}function l(b,x,w,_){return x===null||x.tag!==6?(x=ef(w,b.mode,_),x.return=b,x):(x=a(x,w),x.return=b,x)}function c(b,x,w,_){var j=w.type;return j===ki?u(b,x,w.props.children,_,w.key):x!==null&&(x.elementType===j||typeof j=="object"&&j!==null&&j.$$typeof===ks&&ug(j)===x.type)?(_=a(x,w.props),_.ref=Jo(b,x,w),_.return=b,_):(_=Du(w.type,w.key,w.props,null,b.mode,_),_.ref=Jo(b,x,w),_.return=b,_)}function d(b,x,w,_){return x===null||x.tag!==4||x.stateNode.containerInfo!==w.containerInfo||x.stateNode.implementation!==w.implementation?(x=tf(w,b.mode,_),x.return=b,x):(x=a(x,w.children||[]),x.return=b,x)}function u(b,x,w,_,j){return x===null||x.tag!==7?(x=Ba(w,b.mode,_,j),x.return=b,x):(x=a(x,w),x.return=b,x)}function f(b,x,w){if(typeof x=="string"&&x!==""||typeof x=="number")return x=ef(""+x,b.mode,w),x.return=b,x;if(typeof x=="object"&&x!==null){switch(x.$$typeof){case zc:return w=Du(x.type,x.key,x.props,null,b.mode,w),w.ref=Jo(b,null,x),w.return=b,w;case Ni:return x=tf(x,b.mode,w),x.return=b,x;case ks:var _=x._init;return f(b,_(x._payload),w)}if(al(x)||Ho(x))return x=Ba(x,b.mode,w,null),x.return=b,x;Zc(b,x)}return null}function m(b,x,w,_){var j=x!==null?x.key:null;if(typeof w=="string"&&w!==""||typeof w=="number")return j!==null?null:l(b,x,""+w,_);if(typeof w=="object"&&w!==null){switch(w.$$typeof){case zc:return w.key===j?c(b,x,w,_):null;case Ni:return w.key===j?d(b,x,w,_):null;case ks:return j=w._init,m(b,x,j(w._payload),_)}if(al(w)||Ho(w))return j!==null?null:u(b,x,w,_,null);Zc(b,w)}return null}function p(b,x,w,_,j){if(typeof _=="string"&&_!==""||typeof _=="number")return b=b.get(w)||null,l(x,b,""+_,j);if(typeof _=="object"&&_!==null){switch(_.$$typeof){case zc:return b=b.get(_.key===null?w:_.key)||null,c(x,b,_,j);case Ni:return b=b.get(_.key===null?w:_.key)||null,d(x,b,_,j);case ks:var N=_._init;return p(b,x,w,N(_._payload),j)}if(al(_)||Ho(_))return b=b.get(w)||null,u(x,b,_,j,null);Zc(x,_)}return null}function v(b,x,w,_){for(var j=null,N=null,k=x,C=x=0,A=null;k!==null&&C<w.length;C++){k.index>C?(A=k,k=null):A=k.sibling;var I=m(b,k,w[C],_);if(I===null){k===null&&(k=A);break}e&&k&&I.alternate===null&&t(b,k),x=i(I,x,C),N===null?j=I:N.sibling=I,N=I,k=A}if(C===w.length)return n(b,k),vt&&wa(b,C),j;if(k===null){for(;C<w.length;C++)k=f(b,w[C],_),k!==null&&(x=i(k,x,C),N===null?j=k:N.sibling=k,N=k);return vt&&wa(b,C),j}for(k=r(b,k);C<w.length;C++)A=p(k,b,C,w[C],_),A!==null&&(e&&A.alternate!==null&&k.delete(A.key===null?C:A.key),x=i(A,x,C),N===null?j=A:N.sibling=A,N=A);return e&&k.forEach(function(O){return t(b,O)}),vt&&wa(b,C),j}function g(b,x,w,_){var j=Ho(w);if(typeof j!="function")throw Error(re(150));if(w=j.call(w),w==null)throw Error(re(151));for(var N=j=null,k=x,C=x=0,A=null,I=w.next();k!==null&&!I.done;C++,I=w.next()){k.index>C?(A=k,k=null):A=k.sibling;var O=m(b,k,I.value,_);if(O===null){k===null&&(k=A);break}e&&k&&O.alternate===null&&t(b,k),x=i(O,x,C),N===null?j=O:N.sibling=O,N=O,k=A}if(I.done)return n(b,k),vt&&wa(b,C),j;if(k===null){for(;!I.done;C++,I=w.next())I=f(b,I.value,_),I!==null&&(x=i(I,x,C),N===null?j=I:N.sibling=I,N=I);return vt&&wa(b,C),j}for(k=r(b,k);!I.done;C++,I=w.next())I=p(k,b,C,I.value,_),I!==null&&(e&&I.alternate!==null&&k.delete(I.key===null?C:I.key),x=i(I,x,C),N===null?j=I:N.sibling=I,N=I);return e&&k.forEach(function(P){return t(b,P)}),vt&&wa(b,C),j}function y(b,x,w,_){if(typeof w=="object"&&w!==null&&w.type===ki&&w.key===null&&(w=w.props.children),typeof w=="object"&&w!==null){switch(w.$$typeof){case zc:e:{for(var j=w.key,N=x;N!==null;){if(N.key===j){if(j=w.type,j===ki){if(N.tag===7){n(b,N.sibling),x=a(N,w.props.children),x.return=b,b=x;break e}}else if(N.elementType===j||typeof j=="object"&&j!==null&&j.$$typeof===ks&&ug(j)===N.type){n(b,N.sibling),x=a(N,w.props),x.ref=Jo(b,N,w),x.return=b,b=x;break e}n(b,N);break}else t(b,N);N=N.sibling}w.type===ki?(x=Ba(w.props.children,b.mode,_,w.key),x.return=b,b=x):(_=Du(w.type,w.key,w.props,null,b.mode,_),_.ref=Jo(b,x,w),_.return=b,b=_)}return o(b);case Ni:e:{for(N=w.key;x!==null;){if(x.key===N)if(x.tag===4&&x.stateNode.containerInfo===w.containerInfo&&x.stateNode.implementation===w.implementation){n(b,x.sibling),x=a(x,w.children||[]),x.return=b,b=x;break e}else{n(b,x);break}else t(b,x);x=x.sibling}x=tf(w,b.mode,_),x.return=b,b=x}return o(b);case ks:return N=w._init,y(b,x,N(w._payload),_)}if(al(w))return v(b,x,w,_);if(Ho(w))return g(b,x,w,_);Zc(b,w)}return typeof w=="string"&&w!==""||typeof w=="number"?(w=""+w,x!==null&&x.tag===6?(n(b,x.sibling),x=a(x,w),x.return=b,b=x):(n(b,x),x=ef(w,b.mode,_),x.return=b,b=x),o(b)):n(b,x)}return y}var uo=xw(!0),gw=xw(!1),nd=oa(null),rd=null,Ii=null,e0=null;function t0(){e0=Ii=rd=null}function n0(e){var t=nd.current;yt(nd),e._currentValue=t}function mm(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,r!==null&&(r.childLanes|=t)):r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===n)break;e=e.return}}function zi(e,t){rd=e,e0=Ii=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(Cn=!0),e.firstContext=null)}function Xn(e){var t=e._currentValue;if(e0!==e)if(e={context:e,memoizedValue:t,next:null},Ii===null){if(rd===null)throw Error(re(308));Ii=e,rd.dependencies={lanes:0,firstContext:e}}else Ii=Ii.next=e;return t}var Ea=null;function r0(e){Ea===null?Ea=[e]:Ea.push(e)}function bw(e,t,n,r){var a=t.interleaved;return a===null?(n.next=n,r0(t)):(n.next=a.next,a.next=n),t.interleaved=n,is(e,r)}function is(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var Ss=!1;function s0(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function yw(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 ns(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function Ys(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,Xe&2){var a=r.pending;return a===null?t.next=t:(t.next=a.next,a.next=t),r.pending=t,is(e,n)}return a=r.interleaved,a===null?(t.next=t,r0(r)):(t.next=a.next,a.next=t),r.interleaved=t,is(e,n)}function Pu(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194240)!==0)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,qp(e,n)}}function dg(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var a=null,i=null;if(n=n.firstBaseUpdate,n!==null){do{var o={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};i===null?a=i=o:i=i.next=o,n=n.next}while(n!==null);i===null?a=i=t:i=i.next=t}else a=i=t;n={baseState:r.baseState,firstBaseUpdate:a,lastBaseUpdate:i,shared:r.shared,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function sd(e,t,n,r){var a=e.updateQueue;Ss=!1;var i=a.firstBaseUpdate,o=a.lastBaseUpdate,l=a.shared.pending;if(l!==null){a.shared.pending=null;var c=l,d=c.next;c.next=null,o===null?i=d:o.next=d,o=c;var u=e.alternate;u!==null&&(u=u.updateQueue,l=u.lastBaseUpdate,l!==o&&(l===null?u.firstBaseUpdate=d:l.next=d,u.lastBaseUpdate=c))}if(i!==null){var f=a.baseState;o=0,u=d=c=null,l=i;do{var m=l.lane,p=l.eventTime;if((r&m)===m){u!==null&&(u=u.next={eventTime:p,lane:0,tag:l.tag,payload:l.payload,callback:l.callback,next:null});e:{var v=e,g=l;switch(m=t,p=n,g.tag){case 1:if(v=g.payload,typeof v=="function"){f=v.call(p,f,m);break e}f=v;break e;case 3:v.flags=v.flags&-65537|128;case 0:if(v=g.payload,m=typeof v=="function"?v.call(p,f,m):v,m==null)break e;f=St({},f,m);break e;case 2:Ss=!0}}l.callback!==null&&l.lane!==0&&(e.flags|=64,m=a.effects,m===null?a.effects=[l]:m.push(l))}else p={eventTime:p,lane:m,tag:l.tag,payload:l.payload,callback:l.callback,next:null},u===null?(d=u=p,c=f):u=u.next=p,o|=m;if(l=l.next,l===null){if(l=a.shared.pending,l===null)break;m=l,l=m.next,m.next=null,a.lastBaseUpdate=m,a.shared.pending=null}}while(!0);if(u===null&&(c=f),a.baseState=c,a.firstBaseUpdate=d,a.lastBaseUpdate=u,t=a.shared.interleaved,t!==null){a=t;do o|=a.lane,a=a.next;while(a!==t)}else i===null&&(a.shared.lanes=0);Ha|=o,e.lanes=o,e.memoizedState=f}}function hg(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;t<e.length;t++){var r=e[t],a=r.callback;if(a!==null){if(r.callback=null,r=n,typeof a!="function")throw Error(re(191,a));a.call(r)}}}var bc={},Lr=oa(bc),Fl=oa(bc),Ul=oa(bc);function Pa(e){if(e===bc)throw Error(re(174));return e}function a0(e,t){switch(ht(Ul,t),ht(Fl,e),ht(Lr,bc),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:Kf(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=Kf(t,e)}yt(Lr),ht(Lr,t)}function ho(){yt(Lr),yt(Fl),yt(Ul)}function vw(e){Pa(Ul.current);var t=Pa(Lr.current),n=Kf(t,e.type);t!==n&&(ht(Fl,e),ht(Lr,n))}function i0(e){Fl.current===e&&(yt(Lr),yt(Fl))}var jt=oa(0);function ad(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||n.data==="$?"||n.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 Kh=[];function o0(){for(var e=0;e<Kh.length;e++)Kh[e]._workInProgressVersionPrimary=null;Kh.length=0}var Tu=ms.ReactCurrentDispatcher,Yh=ms.ReactCurrentBatchConfig,Wa=0,kt=null,zt=null,Gt=null,id=!1,bl=!1,Bl=0,u2=0;function cn(){throw Error(re(321))}function l0(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!br(e[n],t[n]))return!1;return!0}
vendor: 7,775 bytes, line 39
39function c0(e,t,n,r,a,i){if(Wa=i,kt=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,Tu.current=e===null||e.memoizedState===null?m2:p2,e=n(r,a),bl){i=0;do{if(bl=!1,Bl=0,25<=i)throw Error(re(301));i+=1,Gt=zt=null,t.updateQueue=null,Tu.current=x2,e=n(r,a)}while(bl)}if(Tu.current=od,t=zt!==null&&zt.next!==null,Wa=0,Gt=zt=kt=null,id=!1,t)throw Error(re(300));return e}function u0(){var e=Bl!==0;return Bl=0,e}function Er(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Gt===null?kt.memoizedState=Gt=e:Gt=Gt.next=e,Gt}function Zn(){if(zt===null){var e=kt.alternate;e=e!==null?e.memoizedState:null}else e=zt.next;var t=Gt===null?kt.memoizedState:Gt.next;if(t!==null)Gt=t,zt=e;else{if(e===null)throw Error(re(310));zt=e,e={memoizedState:zt.memoizedState,baseState:zt.baseState,baseQueue:zt.baseQueue,queue:zt.queue,next:null},Gt===null?kt.memoizedState=Gt=e:Gt=Gt.next=e}return Gt}function zl(e,t){return typeof t=="function"?t(e):t}function Qh(e){var t=Zn(),n=t.queue;if(n===null)throw Error(re(311));n.lastRenderedReducer=e;var r=zt,a=r.baseQueue,i=n.pending;if(i!==null){if(a!==null){var o=a.next;a.next=i.next,i.next=o}r.baseQueue=a=i,n.pending=null}if(a!==null){i=a.next,r=r.baseState;var l=o=null,c=null,d=i;do{var u=d.lane;if((Wa&u)===u)c!==null&&(c=c.next={lane:0,action:d.action,hasEagerState:d.hasEagerState,eagerState:d.eagerState,next:null}),r=d.hasEagerState?d.eagerState:e(r,d.action);else{var f={lane:u,action:d.action,hasEagerState:d.hasEagerState,eagerState:d.eagerState,next:null};c===null?(l=c=f,o=r):c=c.next=f,kt.lanes|=u,Ha|=u}d=d.next}while(d!==null&&d!==i);c===null?o=r:c.next=l,br(r,t.memoizedState)||(Cn=!0),t.memoizedState=r,t.baseState=o,t.baseQueue=c,n.lastRenderedState=r}if(e=n.interleaved,e!==null){a=e;do i=a.lane,kt.lanes|=i,Ha|=i,a=a.next;while(a!==e)}else a===null&&(n.lanes=0);return[t.memoizedState,n.dispatch]}function Jh(e){var t=Zn(),n=t.queue;if(n===null)throw Error(re(311));n.lastRenderedReducer=e;var r=n.dispatch,a=n.pending,i=t.memoizedState;if(a!==null){n.pending=null;var o=a=a.next;do i=e(i,o.action),o=o.next;while(o!==a);br(i,t.memoizedState)||(Cn=!0),t.memoizedState=i,t.baseQueue===null&&(t.baseState=i),n.lastRenderedState=i}return[i,r]}function ww(){}function _w(e,t){var n=kt,r=Zn(),a=t(),i=!br(r.memoizedState,a);if(i&&(r.memoizedState=a,Cn=!0),r=r.queue,d0(kw.bind(null,n,r,e),[e]),r.getSnapshot!==t||i||Gt!==null&&Gt.memoizedState.tag&1){if(n.flags|=2048,ql(9,Nw.bind(null,n,r,a,t),void 0,null),Yt===null)throw Error(re(349));Wa&30||jw(n,t,a)}return a}function jw(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=kt.updateQueue,t===null?(t={lastEffect:null,stores:null},kt.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function Nw(e,t,n,r){t.value=n,t.getSnapshot=r,Sw(t)&&Cw(e)}function kw(e,t,n){return n(function(){Sw(t)&&Cw(e)})}function Sw(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!br(e,n)}catch{return!0}}function Cw(e){var t=is(e,1);t!==null&&xr(t,e,1,-1)}function fg(e){var t=Er();return typeof e=="function"&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:zl,lastRenderedState:e},t.queue=e,e=e.dispatch=f2.bind(null,kt,e),[t.memoizedState,e]}function ql(e,t,n,r){return e={tag:e,create:t,destroy:n,deps:r,next:null},t=kt.updateQueue,t===null?(t={lastEffect:null,stores:null},kt.updateQueue=t,t.lastEffect=e.next=e):(n=t.lastEffect,n===null?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e)),e}function Ew(){return Zn().memoizedState}function Ru(e,t,n,r){var a=Er();kt.flags|=e,a.memoizedState=ql(1|t,n,void 0,r===void 0?null:r)}function $d(e,t,n,r){var a=Zn();r=r===void 0?null:r;var i=void 0;if(zt!==null){var o=zt.memoizedState;if(i=o.destroy,r!==null&&l0(r,o.deps)){a.memoizedState=ql(t,n,i,r);return}}kt.flags|=e,a.memoizedState=ql(1|t,n,i,r)}function mg(e,t){return Ru(8390656,8,e,t)}function d0(e,t){return $d(2048,8,e,t)}function Pw(e,t){return $d(4,2,e,t)}function Tw(e,t){return $d(4,4,e,t)}function Rw(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 Aw(e,t,n){return n=n!=null?n.concat([e]):null,$d(4,4,Rw.bind(null,t,e),n)}function h0(){}function Iw(e,t){var n=Zn();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&l0(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function Ow(e,t){var n=Zn();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&l0(t,r[1])?r[0]:(e=e(),n.memoizedState=[e,t],e)}function Dw(e,t,n){return Wa&21?(br(n,t)||(n=Uv(),kt.lanes|=n,Ha|=n,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,Cn=!0),e.memoizedState=n)}function d2(e,t){var n=ot;ot=n!==0&&4>n?n:4,e(!0);var r=Yh.transition;Yh.transition={};try{e(!1),t()}finally{ot=n,Yh.transition=r}}function Lw(){return Zn().memoizedState}function h2(e,t,n){var r=Js(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},Mw(e))$w(t,n);else if(n=bw(e,t,n,r),n!==null){var a=vn();xr(n,e,r,a),Fw(n,t,r)}}function f2(e,t,n){var r=Js(e),a={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(Mw(e))$w(t,a);else{var i=e.alternate;if(e.lanes===0&&(i===null||i.lanes===0)&&(i=t.lastRenderedReducer,i!==null))try{var o=t.lastRenderedState,l=i(o,n);if(a.hasEagerState=!0,a.eagerState=l,br(l,o)){var c=t.interleaved;c===null?(a.next=a,r0(t)):(a.next=c.next,c.next=a),t.interleaved=a;return}}catch{}finally{}n=bw(e,t,a,r),n!==null&&(a=vn(),xr(n,e,r,a),Fw(n,t,r))}}function Mw(e){var t=e.alternate;return e===kt||t!==null&&t===kt}function $w(e,t){bl=id=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Fw(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,qp(e,n)}}var od={readContext:Xn,useCallback:cn,useContext:cn,useEffect:cn,useImperativeHandle:cn,useInsertionEffect:cn,useLayoutEffect:cn,useMemo:cn,useReducer:cn,useRef:cn,useState:cn,useDebugValue:cn,useDeferredValue:cn,useTransition:cn,useMutableSource:cn,useSyncExternalStore:cn,useId:cn,unstable_isNewReconciler:!1},m2={readContext:Xn,useCallback:function(e,t){return Er().memoizedState=[e,t===void 0?null:t],e},useContext:Xn,useEffect:mg,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,Ru(4194308,4,Rw.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Ru(4194308,4,e,t)},useInsertionEffect:function(e,t){return Ru(4,2,e,t)},useMemo:function(e,t){var n=Er();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=Er();return t=n!==void 0?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=h2.bind(null,kt,e),[r.memoizedState,e]},useRef:function(e){var t=Er();return e={current:e},t.memoizedState=e},useState:fg,useDebugValue:h0,useDeferredValue:function(e){return Er().memoizedState=e},useTransition:function(){var e=fg(!1),t=e[0];return e=d2.bind(null,e[1]),Er().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=kt,a=Er();if(vt){if(n===void 0)throw Error(re(407));n=n()}else{if(n=t(),Yt===null)throw Error(re(349));Wa&30||jw(r,t,n)}a.memoizedState=n;var i={value:n,getSnapshot:t};return a.queue=i,mg(kw.bind(null,r,i,e),[e]),r.flags|=2048,ql(9,Nw.bind(null,r,i,n,t),void 0,null),n},useId:function(){var e=Er(),t=Yt.identifierPrefix;if(vt){var n=ts,r=es;n=(r&~(1<<32-pr(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=Bl++,0<n&&(t+="H"+n.toString(32)),t+=":"}else n=u2++,t=":"+t+"r"+n.toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},p2={readContext:Xn,useCallback:Iw,useContext:Xn,useEffect:d0,useImperativeHandle:Aw,useInsertionEffect:Pw,useLayoutEffect:Tw,useMemo:Ow,useReducer:Qh,useRef
vendor: 6,411 bytes, lines 39-41
39:Ew,useState:function(){return Qh(zl)},useDebugValue:h0,useDeferredValue:function(e){var t=Zn();return Dw(t,zt.memoizedState,e)},useTransition:function(){var e=Qh(zl)[0],t=Zn().memoizedState;return[e,t]},useMutableSource:ww,useSyncExternalStore:_w,useId:Lw,unstable_isNewReconciler:!1},x2={readContext:Xn,useCallback:Iw,useContext:Xn,useEffect:d0,useImperativeHandle:Aw,useInsertionEffect:Pw,useLayoutEffect:Tw,useMemo:Ow,useReducer:Jh,useRef:Ew,useState:function(){return Jh(zl)},useDebugValue:h0,useDeferredValue:function(e){var t=Zn();return zt===null?t.memoizedState=e:Dw(t,zt.memoizedState,e)},useTransition:function(){var e=Jh(zl)[0],t=Zn().memoizedState;return[e,t]},useMutableSource:ww,useSyncExternalStore:_w,useId:Lw,unstable_isNewReconciler:!1};function ir(e,t){if(e&&e.defaultProps){t=St({},t),e=e.defaultProps;for(var n in e)t[n]===void 0&&(t[n]=e[n]);return t}return t}function pm(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:St({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var Fd={isMounted:function(e){return(e=e._reactInternals)?ti(e)===e:!1},enqueueSetState:function(e,t,n){e=e._reactInternals;var r=vn(),a=Js(e),i=ns(r,a);i.payload=t,n!=null&&(i.callback=n),t=Ys(e,i,a),t!==null&&(xr(t,e,a,r),Pu(t,e,a))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=vn(),a=Js(e),i=ns(r,a);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=Ys(e,i,a),t!==null&&(xr(t,e,a,r),Pu(t,e,a))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=vn(),r=Js(e),a=ns(n,r);a.tag=2,t!=null&&(a.callback=t),t=Ys(e,a,r),t!==null&&(xr(t,e,r,n),Pu(t,e,r))}};function pg(e,t,n,r,a,i,o){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(r,i,o):t.prototype&&t.prototype.isPureReactComponent?!Dl(n,r)||!Dl(a,i):!0}function Uw(e,t,n){var r=!1,a=na,i=t.contextType;return typeof i=="object"&&i!==null?i=Xn(i):(a=Pn(t)?qa:fn.current,r=t.contextTypes,i=(r=r!=null)?lo(e,a):na),t=new t(n,i),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=Fd,e.stateNode=t,t._reactInternals=e,r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=a,e.__reactInternalMemoizedMaskedChildContext=i),t}function xg(e,t,n,r){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(n,r),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&Fd.enqueueReplaceState(t,t.state,null)}function xm(e,t,n,r){var a=e.stateNode;a.props=n,a.state=e.memoizedState,a.refs={},s0(e);var i=t.contextType;typeof i=="object"&&i!==null?a.context=Xn(i):(i=Pn(t)?qa:fn.current,a.context=lo(e,i)),a.state=e.memoizedState,i=t.getDerivedStateFromProps,typeof i=="function"&&(pm(e,t,i,n),a.state=e.memoizedState),typeof t.getDerivedStateFromProps=="function"||typeof a.getSnapshotBeforeUpdate=="function"||typeof a.UNSAFE_componentWillMount!="function"&&typeof a.componentWillMount!="function"||(t=a.state,typeof a.componentWillMount=="function"&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount=="function"&&a.UNSAFE_componentWillMount(),t!==a.state&&Fd.enqueueReplaceState(a,a.state,null),sd(e,n,a,r),a.state=e.memoizedState),typeof a.componentDidMount=="function"&&(e.flags|=4194308)}function fo(e,t){try{var n="",r=t;do n+=Vk(r),r=r.return;while(r);var a=n}catch(i){a=`
40Error generating stack: `+i.message+`
41`+i.stack}return{value:e,source:t,stack:a,digest:null}}function Xh(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function gm(e,t){try{console.error(t.value)}catch(n){setTimeout(function(){throw n})}}var g2=typeof WeakMap=="function"?WeakMap:Map;function Bw(e,t,n){n=ns(-1,n),n.tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){cd||(cd=!0,Cm=r),gm(e,t)},n}function zw(e,t,n){n=ns(-1,n),n.tag=3;var r=e.type.getDerivedStateFromError;if(typeof r=="function"){var a=t.value;n.payload=function(){return r(a)},n.callback=function(){gm(e,t)}}var i=e.stateNode;return i!==null&&typeof i.componentDidCatch=="function"&&(n.callback=function(){gm(e,t),typeof r!="function"&&(Qs===null?Qs=new Set([this]):Qs.add(this));var o=t.stack;this.componentDidCatch(t.value,{componentStack:o!==null?o:""})}),n}function gg(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new g2;var a=new Set;r.set(t,a)}else a=r.get(t),a===void 0&&(a=new Set,r.set(t,a));a.has(n)||(a.add(n),e=R2.bind(null,e,t,n),t.then(e,e))}function bg(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 yg(e,t,n,r,a){return e.mode&1?(e.flags|=65536,e.lanes=a,e):(e===t?e.flags|=65536:(e.flags|=128,n.flags|=131072,n.flags&=-52805,n.tag===1&&(n.alternate===null?n.tag=17:(t=ns(-1,1),t.tag=2,Ys(n,t,1))),n.lanes|=1),e)}var b2=ms.ReactCurrentOwner,Cn=!1;function bn(e,t,n,r){t.child=e===null?gw(t,null,n,r):uo(t,e.child,n,r)}function vg(e,t,n,r,a){n=n.render;var i=t.ref;return zi(t,a),r=c0(e,t,n,r,i,a),n=u0(),e!==null&&!Cn?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~a,os(e,t,a)):(vt&&n&&Jp(t),t.flags|=1,bn(e,t,r,a),t.child)}function wg(e,t,n,r,a){if(e===null){var i=n.type;return typeof i=="function"&&!v0(i)&&i.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=i,qw(e,t,i,r,a)):(e=Du(n.type,null,r,t,t.mode,a),e.ref=t.ref,e.return=t,t.child=e)}if(i=e.child,!(e.lanes&a)){var o=i.memoizedProps;if(n=n.compare,n=n!==null?n:Dl,n(o,r)&&e.ref===t.ref)return os(e,t,a)}return t.flags|=1,e=Xs(i,r),e.ref=t.ref,e.return=t,t.child=e}function qw(e,t,n,r,a){if(e!==null){var i=e.memoizedProps;if(Dl(i,r)&&e.ref===t.ref)if(Cn=!1,t.pendingProps=r=i,(e.lanes&a)!==0)e.flags&131072&&(Cn=!0);else return t.lanes=e.lanes,os(e,t,a)}return bm(e,t,n,r,a)}function Vw(e,t,n){var r=t.pendingProps,a=r.children,i=e!==null?e.memoizedState:null;if(r.mode==="hidden")if(!(t.mode&1))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},ht(Di,Ln),Ln|=n;else{if(!(n&1073741824))return e=i!==null?i.baseLanes|n:n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,ht(Di,Ln),Ln|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=i!==null?i.baseLanes:n,ht(Di,Ln),Ln|=r}else i!==null?(r=i.baseLanes|n,t.memoizedState=null):r=n,ht(Di,Ln),Ln|=r;return bn(e,t,a,n),t.child}function Ww(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}
vendor: 10,400 bytes, line 41
41function bm(e,t,n,r,a){var i=Pn(n)?qa:fn.current;return i=lo(t,i),zi(t,a),n=c0(e,t,n,r,i,a),r=u0(),e!==null&&!Cn?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~a,os(e,t,a)):(vt&&r&&Jp(t),t.flags|=1,bn(e,t,n,a),t.child)}function _g(e,t,n,r,a){if(Pn(n)){var i=!0;Zu(t)}else i=!1;if(zi(t,a),t.stateNode===null)Au(e,t),Uw(t,n,r),xm(t,n,r,a),r=!0;else if(e===null){var o=t.stateNode,l=t.memoizedProps;o.props=l;var c=o.context,d=n.contextType;typeof d=="object"&&d!==null?d=Xn(d):(d=Pn(n)?qa:fn.current,d=lo(t,d));var u=n.getDerivedStateFromProps,f=typeof u=="function"||typeof o.getSnapshotBeforeUpdate=="function";f||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(l!==r||c!==d)&&xg(t,o,r,d),Ss=!1;var m=t.memoizedState;o.state=m,sd(t,r,o,a),c=t.memoizedState,l!==r||m!==c||En.current||Ss?(typeof u=="function"&&(pm(t,n,u,r),c=t.memoizedState),(l=Ss||pg(t,n,l,r,m,c,d))?(f||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=r,t.memoizedState=c),o.props=r,o.state=c,o.context=d,r=l):(typeof o.componentDidMount=="function"&&(t.flags|=4194308),r=!1)}else{o=t.stateNode,yw(e,t),l=t.memoizedProps,d=t.type===t.elementType?l:ir(t.type,l),o.props=d,f=t.pendingProps,m=o.context,c=n.contextType,typeof c=="object"&&c!==null?c=Xn(c):(c=Pn(n)?qa:fn.current,c=lo(t,c));var p=n.getDerivedStateFromProps;(u=typeof p=="function"||typeof o.getSnapshotBeforeUpdate=="function")||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(l!==f||m!==c)&&xg(t,o,r,c),Ss=!1,m=t.memoizedState,o.state=m,sd(t,r,o,a);var v=t.memoizedState;l!==f||m!==v||En.current||Ss?(typeof p=="function"&&(pm(t,n,p,r),v=t.memoizedState),(d=Ss||pg(t,n,d,r,m,v,c)||!1)?(u||typeof o.UNSAFE_componentWillUpdate!="function"&&typeof o.componentWillUpdate!="function"||(typeof o.componentWillUpdate=="function"&&o.componentWillUpdate(r,v,c),typeof o.UNSAFE_componentWillUpdate=="function"&&o.UNSAFE_componentWillUpdate(r,v,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=r,t.memoizedState=v),o.props=r,o.state=v,o.context=c,r=d):(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),r=!1)}return ym(e,t,n,r,i,a)}function ym(e,t,n,r,a,i){Ww(e,t);var o=(t.flags&128)!==0;if(!r&&!o)return a&&og(t,n,!1),os(e,t,i);r=t.stateNode,b2.current=t;var l=o&&typeof n.getDerivedStateFromError!="function"?null:r.render();return t.flags|=1,e!==null&&o?(t.child=uo(t,e.child,null,i),t.child=uo(t,null,l,i)):bn(e,t,l,i),t.memoizedState=r.state,a&&og(t,n,!0),t.child}function Hw(e){var t=e.stateNode;t.pendingContext?ig(e,t.pendingContext,t.pendingContext!==t.context):t.context&&ig(e,t.context,!1),a0(e,t.containerInfo)}function jg(e,t,n,r,a){return co(),Zp(a),t.flags|=256,bn(e,t,n,r),t.child}var vm={dehydrated:null,treeContext:null,retryLane:0};function wm(e){return{baseLanes:e,cachePool:null,transitions:null}}function Gw(e,t,n){var r=t.pendingProps,a=jt.current,i=!1,o=(t.flags&128)!==0,l;if((l=o)||(l=e!==null&&e.memoizedState===null?!1:(a&2)!==0),l?(i=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(a|=1),ht(jt,a&1),e===null)return fm(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=r.children,e=r.fallback,i?(r=t.mode,i=t.child,o={mode:"hidden",children:o},!(r&1)&&i!==null?(i.childLanes=0,i.pendingProps=o):i=zd(o,r,0,null),e=Ba(e,r,n,null),i.return=t,e.return=t,i.sibling=e,t.child=i,t.child.memoizedState=wm(n),t.memoizedState=vm,e):f0(t,o));if(a=e.memoizedState,a!==null&&(l=a.dehydrated,l!==null))return y2(e,t,o,r,l,a,n);if(i){i=r.fallback,o=t.mode,a=e.child,l=a.sibling;var c={mode:"hidden",children:r.children};return!(o&1)&&t.child!==a?(r=t.child,r.childLanes=0,r.pendingProps=c,t.deletions=null):(r=Xs(a,c),r.subtreeFlags=a.subtreeFlags&14680064),l!==null?i=Xs(l,i):(i=Ba(i,o,n,null),i.flags|=2),i.return=t,r.return=t,r.sibling=i,t.child=r,r=i,i=t.child,o=e.child.memoizedState,o=o===null?wm(n):{baseLanes:o.baseLanes|n,cachePool:null,transitions:o.transitions},i.memoizedState=o,i.childLanes=e.childLanes&~n,t.memoizedState=vm,r}return i=e.child,e=i.sibling,r=Xs(i,{mode:"visible",children:r.children}),!(t.mode&1)&&(r.lanes=n),r.return=t,r.sibling=null,e!==null&&(n=t.deletions,n===null?(t.deletions=[e],t.flags|=16):n.push(e)),t.child=r,t.memoizedState=null,r}function f0(e,t){return t=zd({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function eu(e,t,n,r){return r!==null&&Zp(r),uo(t,e.child,null,n),e=f0(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function y2(e,t,n,r,a,i,o){if(n)return t.flags&256?(t.flags&=-257,r=Xh(Error(re(422))),eu(e,t,o,r)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(i=r.fallback,a=t.mode,r=zd({mode:"visible",children:r.children},a,0,null),i=Ba(i,a,o,null),i.flags|=2,r.return=t,i.return=t,r.sibling=i,t.child=r,t.mode&1&&uo(t,e.child,null,o),t.child.memoizedState=wm(o),t.memoizedState=vm,i);if(!(t.mode&1))return eu(e,t,o,null);if(a.data==="$!"){if(r=a.nextSibling&&a.nextSibling.dataset,r)var l=r.dgst;return r=l,i=Error(re(419)),r=Xh(i,r,void 0),eu(e,t,o,r)}if(l=(o&e.childLanes)!==0,Cn||l){if(r=Yt,r!==null){switch(o&-o){case 4:a=2;break;case 16:a=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:a=32;break;case 536870912:a=268435456;break;default:a=0}a=a&(r.suspendedLanes|o)?0:a,a!==0&&a!==i.retryLane&&(i.retryLane=a,is(e,a),xr(r,e,a,-1))}return y0(),r=Xh(Error(re(421))),eu(e,t,o,r)}return a.data==="$?"?(t.flags|=128,t.child=e.child,t=A2.bind(null,e),a._reactRetry=t,null):(e=i.treeContext,Fn=Ks(a.nextSibling),Un=t,vt=!0,hr=null,e!==null&&(Kn[Yn++]=es,Kn[Yn++]=ts,Kn[Yn++]=Va,es=e.id,ts=e.overflow,Va=t),t=f0(t,r.children),t.flags|=4096,t)}function Ng(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),mm(e.return,t,n)}function Zh(e,t,n,r,a){var i=e.memoizedState;i===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:a}:(i.isBackwards=t,i.rendering=null,i.renderingStartTime=0,i.last=r,i.tail=n,i.tailMode=a)}function Kw(e,t,n){var r=t.pendingProps,a=r.revealOrder,i=r.tail;if(bn(e,t,r.children,n),r=jt.current,r&2)r=r&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&&Ng(e,n,t);else if(e.tag===19)Ng(e,n,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}r&=1}if(ht(jt,r),!(t.mode&1))t.memoizedState=null;else switch(a){case"forwards":for(n=t.child,a=null;n!==null;)e=n.alternate,e!==null&&ad(e)===null&&(a=n),n=n.sibling;n=a,n===null?(a=t.child,t.child=null):(a=n.sibling,n.sibling=null),Zh(t,!1,a,n,i);break;case"backwards":for(n=null,a=t.child,t.child=null;a!==null;){if(e=a.alternate,e!==null&&ad(e)===null){t.child=a;break}e=a.sibling,a.sibling=n,n=a,a=e}Zh(t,!0,n,null,i);break;case"together":Zh(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function Au(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function os(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),Ha|=t.lanes,!(n&t.childLanes))return null;if(e!==null&&t.child!==e.child)throw Error(re(153));if(t.child!==null){for(e=t.child,n=Xs(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=Xs(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function v2(e,t,n){switch(t.tag){case 3:Hw(t),co();break;case 5:vw(t);break;case 1:Pn(t.type)&&Zu(t);break;case 4:a0(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,a=t.memoizedProps.value;ht(nd,r._currentValue),r._currentValue=a;break;case 13:if(r=t.memoizedState,r!==null)return r.dehydrated!==null?(ht(jt,jt.current&1),t.flags|=128,null):n&t.child.childLanes?Gw(e,t,n):(ht(jt,jt.current&1),e=os(e,t,n),e!==null?e.sibling:null);ht(jt,jt.current&1);break;case 19:if(r=(n&t.childLanes)!==0,e.flags&128){if(r)return Kw(e,t,n);t.flags|=128}if(a=t.memoizedState,a!==null&&(a.rendering=null,a.tail=null,a.lastEffect=null),ht(jt,jt.current),r)break;return null;case 22:case 23:return t.lanes=0,Vw(e,t,n)}return os(e,t,n)}var Yw,_m,Qw,Jw;Yw=function(e,t){for(var n=t.child;n!==null;){if(n.tag===5||n.tag===6)e.appendChild(n.stateNode);else if(n.tag!==4&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return;n=n.return}n.sibling.return=n.return,n=n.sibling}};_m=function(){};Qw=function(e,t,n,r){var a=e.memoizedProps;if(a!==r){e=t.stateNode,Pa(Lr.current);var i=null;switch(n){case"input":a=Vf(e,a),r=Vf(e,r),i=[];break;case"select":a=St({},a,{value:void 0}),r=St({},r,{value:void 0}),i=[];break;case"textarea":a=Gf(e,a),r=Gf(e,r),i=[];break;default:typeof a.onClick!="function"&&typeof r.onClick=="function"&&(e.onclick=Ju)}Yf(n,r);var o;n=null;for(d in a)if(!r.hasOwnProperty(d)&&a.hasOwnProperty(d)&&a[d]!=null)if(d==="style"){var l=a[d];for(o in l)l.hasOwnProperty(o)&&(n||(n={}),n[o]="")}else d!=="dangerouslySetInnerHTML"&&d!=="children"&&d!=="suppressContentEditableWarning"&&d!=="suppressHydrationWarning"&&d!=="autoFocus"&&(El.hasOwnProperty(d)?i||(i=[]):(i=i||[]).push(d,null));for(d in r){var c=r[d];if(l=a!=null?a[d]:void 0,r.hasOwnProperty(d)&&c!==l&&(c!=null||l!=null))if(d==="style")if(l){for(o in l)!l.hasOwnProperty(o)||c&&c.hasOwnProperty(o)||(n||(n={}),n[o]="");for(o in c)c.hasOwnProperty(o)&&l[o]!==c[o]&&(n||(n={}),n[o]=c[o])}
vendor: 5,030 bytes, line 41
41else n||(i||(i=[]),i.push(d,n)),n=c;else d==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,l=l?l.__html:void 0,c!=null&&l!==c&&(i=i||[]).push(d,c)):d==="children"?typeof c!="string"&&typeof c!="number"||(i=i||[]).push(d,""+c):d!=="suppressContentEditableWarning"&&d!=="suppressHydrationWarning"&&(El.hasOwnProperty(d)?(c!=null&&d==="onScroll"&&gt("scroll",e),i||l===c||(i=[])):(i=i||[]).push(d,c))}n&&(i=i||[]).push("style",n);var d=i;(t.updateQueue=d)&&(t.flags|=4)}};Jw=function(e,t,n,r){n!==r&&(t.flags|=4)};function Xo(e,t){if(!vt)switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function un(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var a=e.child;a!==null;)n|=a.lanes|a.childLanes,r|=a.subtreeFlags&14680064,r|=a.flags&14680064,a.return=e,a=a.sibling;else for(a=e.child;a!==null;)n|=a.lanes|a.childLanes,r|=a.subtreeFlags,r|=a.flags,a.return=e,a=a.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function w2(e,t,n){var r=t.pendingProps;switch(Xp(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return un(t),null;case 1:return Pn(t.type)&&Xu(),un(t),null;case 3:return r=t.stateNode,ho(),yt(En),yt(fn),o0(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(e===null||e.child===null)&&(Xc(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,hr!==null&&(Tm(hr),hr=null))),_m(e,t),un(t),null;case 5:i0(t);var a=Pa(Ul.current);if(n=t.type,e!==null&&t.stateNode!=null)Qw(e,t,n,r,a),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!r){if(t.stateNode===null)throw Error(re(166));return un(t),null}if(e=Pa(Lr.current),Xc(t)){r=t.stateNode,n=t.type;var i=t.memoizedProps;switch(r[Ar]=t,r[$l]=i,e=(t.mode&1)!==0,n){case"dialog":gt("cancel",r),gt("close",r);break;case"iframe":case"object":case"embed":gt("load",r);break;case"video":case"audio":for(a=0;a<ol.length;a++)gt(ol[a],r);break;case"source":gt("error",r);break;case"img":case"image":case"link":gt("error",r),gt("load",r);break;case"details":gt("toggle",r);break;case"input":Ix(r,i),gt("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!i.multiple},gt("invalid",r);break;case"textarea":Dx(r,i),gt("invalid",r)}Yf(n,i),a=null;for(var o in i)if(i.hasOwnProperty(o)){var l=i[o];o==="children"?typeof l=="string"?r.textContent!==l&&(i.suppressHydrationWarning!==!0&&Jc(r.textContent,l,e),a=["children",l]):typeof l=="number"&&r.textContent!==""+l&&(i.suppressHydrationWarning!==!0&&Jc(r.textContent,l,e),a=["children",""+l]):El.hasOwnProperty(o)&&l!=null&&o==="onScroll"&&gt("scroll",r)}switch(n){case"input":qc(r),Ox(r,i,!0);break;case"textarea":qc(r),Lx(r);break;case"select":case"option":break;default:typeof i.onClick=="function"&&(r.onclick=Ju)}r=a,t.updateQueue=r,r!==null&&(t.flags|=4)}else{o=a.nodeType===9?a:a.ownerDocument,e==="http://www.w3.org/1999/xhtml"&&(e=kv(n)),e==="http://www.w3.org/1999/xhtml"?n==="script"?(e=o.createElement("div"),e.innerHTML="<script><\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=o.createElement(n,{is:r.is}):(e=o.createElement(n),n==="select"&&(o=e,r.multiple?o.multiple=!0:r.size&&(o.size=r.size))):e=o.createElementNS(e,n),e[Ar]=t,e[$l]=r,Yw(e,t,!1,!1),t.stateNode=e;e:{switch(o=Qf(n,r),n){case"dialog":gt("cancel",e),gt("close",e),a=r;break;case"iframe":case"object":case"embed":gt("load",e),a=r;break;case"video":case"audio":for(a=0;a<ol.length;a++)gt(ol[a],e);a=r;break;case"source":gt("error",e),a=r;break;case"img":case"image":case"link":gt("error",e),gt("load",e),a=r;break;case"details":gt("toggle",e),a=r;break;case"input":Ix(e,r),a=Vf(e,r),gt("invalid",e);break;case"option":a=r;break;case"select":e._wrapperState={wasMultiple:!!r.multiple},a=St({},r,{value:void 0}),gt("invalid",e);break;case"textarea":Dx(e,r),a=Gf(e,r),gt("invalid",e);break;default:a=r}Yf(n,a),l=a;for(i in l)if(l.hasOwnProperty(i)){var c=l[i];i==="style"?Ev(e,c):i==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,c!=null&&Sv(e,c)):i==="children"?typeof c=="string"?(n!=="textarea"||c!=="")&&Pl(e,c):typeof c=="number"&&Pl(e,""+c):i!=="suppressContentEditableWarning"&&i!=="suppressHydrationWarning"&&i!=="autoFocus"&&(El.hasOwnProperty(i)?c!=null&&i==="onScroll"&&gt("scroll",e):c!=null&&Mp(e,i,c,o))}switch(n){case"input":qc(e),Ox(e,r,!1);break;case"textarea":qc(e),Lx(e);break;case"option":r.value!=null&&e.setAttribute("value",""+ta(r.value));break;case"select":e.multiple=!!r.multiple,i=r.value,i!=null?$i(e,!!r.multiple,i,!1):r.defaultValue!=null&&$i(e,!!r.multiple,r.defaultValue,!0);break;default:typeof a.onClick=="function"&&(e.onclick=Ju)}switch(n){case"button":case"input":case"select":case"textarea":r=!!r.autoFocus;break e;case"img":r=!0;break e;default:r=!1}}r&&(t.flags|=4)}t.ref!==null&&(t.flags|=512,t.flags|=2097152)}
vendor: 27,963 bytes, line 41
41return un(t),null;case 6:if(e&&t.stateNode!=null)Jw(e,t,e.memoizedProps,r);else{if(typeof r!="string"&&t.stateNode===null)throw Error(re(166));if(n=Pa(Ul.current),Pa(Lr.current),Xc(t)){if(r=t.stateNode,n=t.memoizedProps,r[Ar]=t,(i=r.nodeValue!==n)&&(e=Un,e!==null))switch(e.tag){case 3:Jc(r.nodeValue,n,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&Jc(r.nodeValue,n,(e.mode&1)!==0)}i&&(t.flags|=4)}else r=(n.nodeType===9?n:n.ownerDocument).createTextNode(r),r[Ar]=t,t.stateNode=r}return un(t),null;case 13:if(yt(jt),r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(vt&&Fn!==null&&t.mode&1&&!(t.flags&128))pw(),co(),t.flags|=98560,i=!1;else if(i=Xc(t),r!==null&&r.dehydrated!==null){if(e===null){if(!i)throw Error(re(318));if(i=t.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(re(317));i[Ar]=t}else co(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;un(t),i=!1}else hr!==null&&(Tm(hr),hr=null),i=!0;if(!i)return t.flags&65536?t:null}return t.flags&128?(t.lanes=n,t):(r=r!==null,r!==(e!==null&&e.memoizedState!==null)&&r&&(t.child.flags|=8192,t.mode&1&&(e===null||jt.current&1?Vt===0&&(Vt=3):y0())),t.updateQueue!==null&&(t.flags|=4),un(t),null);case 4:return ho(),_m(e,t),e===null&&Ll(t.stateNode.containerInfo),un(t),null;case 10:return n0(t.type._context),un(t),null;case 17:return Pn(t.type)&&Xu(),un(t),null;case 19:if(yt(jt),i=t.memoizedState,i===null)return un(t),null;if(r=(t.flags&128)!==0,o=i.rendering,o===null)if(r)Xo(i,!1);else{if(Vt!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(o=ad(e),o!==null){for(t.flags|=128,Xo(i,!1),r=o.updateQueue,r!==null&&(t.updateQueue=r,t.flags|=4),t.subtreeFlags=0,r=n,n=t.child;n!==null;)i=n,e=r,i.flags&=14680066,o=i.alternate,o===null?(i.childLanes=0,i.lanes=e,i.child=null,i.subtreeFlags=0,i.memoizedProps=null,i.memoizedState=null,i.updateQueue=null,i.dependencies=null,i.stateNode=null):(i.childLanes=o.childLanes,i.lanes=o.lanes,i.child=o.child,i.subtreeFlags=0,i.deletions=null,i.memoizedProps=o.memoizedProps,i.memoizedState=o.memoizedState,i.updateQueue=o.updateQueue,i.type=o.type,e=o.dependencies,i.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),n=n.sibling;return ht(jt,jt.current&1|2),t.child}e=e.sibling}i.tail!==null&&It()>mo&&(t.flags|=128,r=!0,Xo(i,!1),t.lanes=4194304)}else{if(!r)if(e=ad(o),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),Xo(i,!0),i.tail===null&&i.tailMode==="hidden"&&!o.alternate&&!vt)return un(t),null}else 2*It()-i.renderingStartTime>mo&&n!==1073741824&&(t.flags|=128,r=!0,Xo(i,!1),t.lanes=4194304);i.isBackwards?(o.sibling=t.child,t.child=o):(n=i.last,n!==null?n.sibling=o:t.child=o,i.last=o)}return i.tail!==null?(t=i.tail,i.rendering=t,i.tail=t.sibling,i.renderingStartTime=It(),t.sibling=null,n=jt.current,ht(jt,r?n&1|2:n&1),t):(un(t),null);case 22:case 23:return b0(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?Ln&1073741824&&(un(t),t.subtreeFlags&6&&(t.flags|=8192)):un(t),null;case 24:return null;case 25:return null}throw Error(re(156,t.tag))}function _2(e,t){switch(Xp(t),t.tag){case 1:return Pn(t.type)&&Xu(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return ho(),yt(En),yt(fn),o0(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return i0(t),null;case 13:if(yt(jt),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(re(340));co()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return yt(jt),null;case 4:return ho(),null;case 10:return n0(t.type._context),null;case 22:case 23:return b0(),null;case 24:return null;default:return null}}var tu=!1,hn=!1,j2=typeof WeakSet=="function"?WeakSet:Set,je=null;function Oi(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){Tt(e,t,r)}else n.current=null}function jm(e,t,n){try{n()}catch(r){Tt(e,t,r)}}var kg=!1;function N2(e,t){if(im=Ku,e=nw(),Qp(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var a=r.anchorOffset,i=r.focusNode;r=r.focusOffset;try{n.nodeType,i.nodeType}catch{n=null;break e}var o=0,l=-1,c=-1,d=0,u=0,f=e,m=null;t:for(;;){for(var p;f!==n||a!==0&&f.nodeType!==3||(l=o+a),f!==i||r!==0&&f.nodeType!==3||(c=o+r),f.nodeType===3&&(o+=f.nodeValue.length),(p=f.firstChild)!==null;)m=f,f=p;for(;;){if(f===e)break t;if(m===n&&++d===a&&(l=o),m===i&&++u===r&&(c=o),(p=f.nextSibling)!==null)break;f=m,m=f.parentNode}f=p}n=l===-1||c===-1?null:{start:l,end:c}}else n=null}n=n||{start:0,end:0}}else n=null;for(om={focusedElem:e,selectionRange:n},Ku=!1,je=t;je!==null;)if(t=je,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,je=e;else for(;je!==null;){t=je;try{var v=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(v!==null){var g=v.memoizedProps,y=v.memoizedState,b=t.stateNode,x=b.getSnapshotBeforeUpdate(t.elementType===t.type?g:ir(t.type,g),y);b.__reactInternalSnapshotBeforeUpdate=x}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(re(163))}}catch(_){Tt(t,t.return,_)}if(e=t.sibling,e!==null){e.return=t.return,je=e;break}je=t.return}return v=kg,kg=!1,v}function yl(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var a=r=r.next;do{if((a.tag&e)===e){var i=a.destroy;a.destroy=void 0,i!==void 0&&jm(t,n,i)}a=a.next}while(a!==r)}}function Ud(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function Nm(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function Xw(e){var t=e.alternate;t!==null&&(e.alternate=null,Xw(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Ar],delete t[$l],delete t[um],delete t[i2],delete t[o2])),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 Zw(e){return e.tag===5||e.tag===3||e.tag===4}function Sg(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Zw(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 km(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=Ju));else if(r!==4&&(e=e.child,e!==null))for(km(e,t,n),e=e.sibling;e!==null;)km(e,t,n),e=e.sibling}function Sm(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(Sm(e,t,n),e=e.sibling;e!==null;)Sm(e,t,n),e=e.sibling}var en=null,ur=!1;function vs(e,t,n){for(n=n.child;n!==null;)e1(e,t,n),n=n.sibling}function e1(e,t,n){if(Dr&&typeof Dr.onCommitFiberUnmount=="function")try{Dr.onCommitFiberUnmount(Ad,n)}catch{}switch(n.tag){case 5:hn||Oi(n,t);case 6:var r=en,a=ur;en=null,vs(e,t,n),en=r,ur=a,en!==null&&(ur?(e=en,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):en.removeChild(n.stateNode));break;case 18:en!==null&&(ur?(e=en,n=n.stateNode,e.nodeType===8?Hh(e.parentNode,n):e.nodeType===1&&Hh(e,n),Il(e)):Hh(en,n.stateNode));break;case 4:r=en,a=ur,en=n.stateNode.containerInfo,ur=!0,vs(e,t,n),en=r,ur=a;break;case 0:case 11:case 14:case 15:if(!hn&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){a=r=r.next;do{var i=a,o=i.destroy;i=i.tag,o!==void 0&&(i&2||i&4)&&jm(n,t,o),a=a.next}while(a!==r)}vs(e,t,n);break;case 1:if(!hn&&(Oi(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(l){Tt(n,t,l)}vs(e,t,n);break;case 21:vs(e,t,n);break;case 22:n.mode&1?(hn=(r=hn)||n.memoizedState!==null,vs(e,t,n),hn=r):vs(e,t,n);break;default:vs(e,t,n)}}function Cg(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new j2),t.forEach(function(r){var a=I2.bind(null,e,r);n.has(r)||(n.add(r),r.then(a,a))})}}function rr(e,t){var n=t.deletions;if(n!==null)for(var r=0;r<n.length;r++){var a=n[r];try{var i=e,o=t,l=o;e:for(;l!==null;){switch(l.tag){case 5:en=l.stateNode,ur=!1;break e;case 3:en=l.stateNode.containerInfo,ur=!0;break e;case 4:en=l.stateNode.containerInfo,ur=!0;break e}l=l.return}if(en===null)throw Error(re(160));e1(i,o,a),en=null,ur=!1;var c=a.alternate;c!==null&&(c.return=null),a.return=null}catch(d){Tt(a,t,d)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)t1(t,e),t=t.sibling}function t1(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(rr(t,e),Cr(e),r&4){try{yl(3,e,e.return),Ud(3,e)}catch(g){Tt(e,e.return,g)}try{yl(5,e,e.return)}catch(g){Tt(e,e.return,g)}}break;case 1:rr(t,e),Cr(e),r&512&&n!==null&&Oi(n,n.return);break;case 5:if(rr(t,e),Cr(e),r&512&&n!==null&&Oi(n,n.return),e.flags&32){var a=e.stateNode;try{Pl(a,"")}catch(g){Tt(e,e.return,g)}}if(r&4&&(a=e.stateNode,a!=null)){var i=e.memoizedProps,o=n!==null?n.memoizedProps:i,l=e.type,c=e.updateQueue;if(e.updateQueue=null,c!==null)try{l==="input"&&i.type==="radio"&&i.name!=null&&jv(a,i),Qf(l,o);var d=Qf(l,i);for(o=0;o<c.length;o+=2){var u=c[o],f=c[o+1];u==="style"?Ev(a,f):u==="dangerouslySetInnerHTML"?Sv(a,f):u==="children"?Pl(a,f):Mp(a,u,f,d)}switch(l){case"input":Wf(a,i);break;case"textarea":Nv(a,i);break;case"select":var m=a._wrapperState.wasMultiple;a._wrapperState.wasMultiple=!!i.multiple;var p=i.value;p!=null?$i(a,!!i.multiple,p,!1):m!==!!i.multiple&&(i.defaultValue!=null?$i(a,!!i.multiple,i.defaultValue,!0):$i(a,!!i.multiple,i.multiple?[]:"",!1))}a[$l]=i}catch(g){Tt(e,e.return,g)}}break;case 6:if(rr(t,e),Cr(e),r&4){if(e.stateNode===null)throw Error(re(162));a=e.stateNode,i=e.memoizedProps;try{a.nodeValue=i}catch(g){Tt(e,e.return,g)}}break;case 3:if(rr(t,e),Cr(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{Il(t.containerInfo)}catch(g){Tt(e,e.return,g)}break;case 4:rr(t,e),Cr(e);break;case 13:rr(t,e),Cr(e),a=e.child,a.flags&8192&&(i=a.memoizedState!==null,a.stateNode.isHidden=i,!i||a.alternate!==null&&a.alternate.memoizedState!==null||(x0=It())),r&4&&Cg(e);break;case 22:if(u=n!==null&&n.memoizedState!==null,e.mode&1?(hn=(d=hn)||u,rr(t,e),hn=d):rr(t,e),Cr(e),r&8192){if(d=e.memoizedState!==null,(e.stateNode.isHidden=d)&&!u&&e.mode&1)for(je=e,u=e.child;u!==null;){for(f=je=u;je!==null;){switch(m=je,p=m.child,m.tag){case 0:case 11:case 14:case 15:yl(4,m,m.return);break;case 1:Oi(m,m.return);var v=m.stateNode;if(typeof v.componentWillUnmount=="function"){r=m,n=m.return;try{t=r,v.props=t.memoizedProps,v.state=t.memoizedState,v.componentWillUnmount()}catch(g){Tt(r,n,g)}}break;case 5:Oi(m,m.return);break;case 22:if(m.memoizedState!==null){Pg(f);continue}}p!==null?(p.return=m,je=p):Pg(f)}u=u.sibling}e:for(u=null,f=e;;){if(f.tag===5){if(u===null){u=f;try{a=f.stateNode,d?(i=a.style,typeof i.setProperty=="function"?i.setProperty("display","none","important"):i.display="none"):(l=f.stateNode,c=f.memoizedProps.style,o=c!=null&&c.hasOwnProperty("display")?c.display:null,l.style.display=Cv("display",o))}catch(g){Tt(e,e.return,g)}}}else if(f.tag===6){if(u===null)try{f.stateNode.nodeValue=d?"":f.memoizedProps}catch(g){Tt(e,e.return,g)}}else if((f.tag!==22&&f.tag!==23||f.memoizedState===null||f===e)&&f.child!==null){f.child.return=f,f=f.child;continue}if(f===e)break e;for(;f.sibling===null;){if(f.return===null||f.return===e)break e;u===f&&(u=null),f=f.return}u===f&&(u=null),f.sibling.return=f.return,f=f.sibling}}break;case 19:rr(t,e),Cr(e),r&4&&Cg(e);break;case 21:break;default:rr(t,e),Cr(e)}}function Cr(e){var t=e.flags;if(t&2){try{e:{for(var n=e.return;n!==null;){if(Zw(n)){var r=n;break e}n=n.return}throw Error(re(160))}switch(r.tag){case 5:var a=r.stateNode;r.flags&32&&(Pl(a,""),r.flags&=-33);var i=Sg(e);Sm(e,i,a);break;case 3:case 4:var o=r.stateNode.containerInfo,l=Sg(e);km(e,l,o);break;default:throw Error(re(161))}}catch(c){Tt(e,e.return,c)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function k2(e,t,n){je=e,n1(e)}function n1(e,t,n){for(var r=(e.mode&1)!==0;je!==null;){var a=je,i=a.child;if(a.tag===22&&r){var o=a.memoizedState!==null||tu;if(!o){var l=a.alternate,c=l!==null&&l.memoizedState!==null||hn;l=tu;var d=hn;if(tu=o,(hn=c)&&!d)for(je=a;je!==null;)o=je,c=o.child,o.tag===22&&o.memoizedState!==null?Tg(a):c!==null?(c.return=o,je=c):Tg(a);for(;i!==null;)je=i,n1(i),i=i.sibling;je=a,tu=l,hn=d}Eg(e)}else a.subtreeFlags&8772&&i!==null?(i.return=a,je=i):Eg(e)}}function Eg(e){for(;je!==null;){var t=je;if(t.flags&8772){var n=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:hn||Ud(5,t);break;case 1:var r=t.stateNode;if(t.flags&4&&!hn)if(n===null)r.componentDidMount();else{var a=t.elementType===t.type?n.memoizedProps:ir(t.type,n.memoizedProps);r.componentDidUpdate(a,n.memoizedState,r.__reactInternalSnapshotBeforeUpdate)}var i=t.updateQueue;i!==null&&hg(t,i,r);break;case 3:var o=t.updateQueue;if(o!==null){if(n=null,t.child!==null)switch(t.child.tag){case 5:n=t.child.stateNode;break;case 1:n=t.child.stateNode}hg(t,o,n)}break;case 5:var l=t.stateNode;if(n===null&&t.flags&4){n=l;var c=t.memoizedProps;switch(t.type){case"button":case"input":case"select":case"textarea":c.autoFocus&&n.focus();break;case"img":c.src&&(n.src=c.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(t.memoizedState===null){var d=t.alternate;if(d!==null){var u=d.memoizedState;if(u!==null){var f=u.dehydrated;f!==null&&Il(f)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(re(163))}hn||t.flags&512&&Nm(t)}catch(m){Tt(t,t.return,m)}}if(t===e){je=null;break}if(n=t.sibling,n!==null){n.return=t.return,je=n;break}je=t.return}}function Pg(e){for(;je!==null;){var t=je;if(t===e){je=null;break}var n=t.sibling;if(n!==null){n.return=t.return,je=n;break}je=t.return}}function Tg(e){for(;je!==null;){var t=je;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{Ud(4,t)}catch(c){Tt(t,n,c)}break;case 1:var r=t.stateNode;if(typeof r.componentDidMount=="function"){var a=t.return;try{r.componentDidMount()}catch(c){Tt(t,a,c)}}var i=t.return;try{Nm(t)}catch(c){Tt(t,i,c)}break;case 5:var o=t.return;try{Nm(t)}catch(c){Tt(t,o,c)}}}catch(c){Tt(t,t.return,c)}if(t===e){je=null;break}var l=t.sibling;if(l!==null){l.return=t.return,je=l;break}je=t.return}}var S2=Math.ceil,ld=ms.ReactCurrentDispatcher,m0=ms.ReactCurrentOwner,Jn=ms.ReactCurrentBatchConfig,Xe=0,Yt=null,Mt=null,tn=0,Ln=0,Di=oa(0),Vt=0,Vl=null,Ha=0,Bd=0,p0=0,vl=null,Sn=null,x0=0,mo=1/0,Yr=null,cd=!1,Cm=null,Qs=null,nu=!1,qs=null,ud=0,wl=0,Em=null,Iu=-1,Ou=0;function vn(){return Xe&6?It():Iu!==-1?Iu:Iu=It()}function Js(e){return e.mode&1?Xe&2&&tn!==0?tn&-tn:c2.transition!==null?(Ou===0&&(Ou=Uv()),Ou):(e=ot,e!==0||(e=window.event,e=e===void 0?16:Gv(e.type)),e):1}function xr(e,t,n,r){if(50<wl)throw wl=0,Em=null,Error(re(185));pc(e,n,r),(!(Xe&2)||e!==Yt)&&(e===Yt&&(!(Xe&2)&&(Bd|=n),Vt===4&&Ts(e,tn)),Tn(e,r),n===1&&Xe===0&&!(t.mode&1)&&(mo=It()+500,Md&&la()))}function Tn(e,t){var n=e.callbackNode;cS(e,t);var r=Gu(e,e===Yt?tn:0);if(r===0)n!==null&&Fx(n),e.callbackNode=null,e.callbackPriority=0;else if(t=r&-r,e.callbackPriority!==t){if(n!=null&&Fx(n),t===1)e.tag===0?l2(Rg.bind(null,e)):hw(Rg.bind(null,e)),s2(function(){!(Xe&6)&&la()}),n=null;else{switch(Bv(r)){case 1:n=zp;break;case 4:n=$v;break;case 16:n=Hu;break;case 536870912:n=Fv;break;default:n=Hu}n=u1(n,r1.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function r1(e,t){if(Iu=-1,Ou=0,Xe&6)throw Error(re(327));var n=e.callbackNode;if(qi()&&e.callbackNode!==n)return null;var r=Gu(e,e===Yt?tn:0);if(r===0)return null;if(r&30||r&e.expiredLanes||t)t=dd(e,r);else{t=r;var a=Xe;Xe|=2;var i=a1();(Yt!==e||tn!==t)&&(Yr=null,mo=It()+500,Ua(e,t));do try{P2();break}catch(l){s1(e,l)}while(!0);t0(),ld.current=i,Xe=a,Mt!==null?t=0:(Yt=null,tn=0,t=Vt)}if(t!==0){if(t===2&&(a=tm(e),a!==0&&(r=a,t=Pm(e,a))),t===1)throw n=Vl,Ua(e,0),Ts(e,r),Tn(e,It()),n;if(t===6)Ts(e,r);else{if(a=e.current.alternate,!(r&30)&&!C2(a)&&(t=dd(e,r),t===2&&(i=tm(e),i!==0&&(r=i,t=Pm(e,i))),t===1))throw n=Vl,Ua(e,0),Ts(e,r),Tn(e,It()),n;switch(e.finishedWork=a,e.finishedLanes=r,t){case 0:case 1:throw Error(re(345));case 2:_a(e,Sn,Yr);break;case 3:if(Ts(e,r),(r&130023424)===r&&(t=x0+500-It(),10<t)){if(Gu(e,0)!==0)break;if(a=e.suspendedLanes,(a&r)!==r){vn(),e.pingedLanes|=e.suspendedLanes&a;break}e.timeoutHandle=cm(_a.bind(null,e,Sn,Yr),t);break}_a(e,Sn,Yr);break;case 4:if(Ts(e,r),(r&4194240)===r)break;for(t=e.eventTimes,a=-1;0<r;){var o=31-pr(r);i=1<<o,o=t[o],o>a&&(a=o),r&=~i}if(r=a,r=It()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*S2(r/1960))-r,10<r){e.timeoutHandle=cm(_a.bind(null,e,Sn,Yr),r);break}_a(e,Sn,Yr);break;case 5:_a(e,Sn,Yr);break;default:throw Error(re(329))}}}return Tn(e,It()),e.callbackNode===n?r1.bind(null,e):null}function Pm(e,t){var n=vl;return e.current.memoizedState.isDehydrated&&(Ua(e,t).flags|=256),e=dd(e,t),e!==2&&(t=Sn,Sn=n,t!==null&&Tm(t)),e}function Tm(e){Sn===null?Sn=e:Sn.push.apply(Sn,e)}function C2(e){for(var t=e;;){if(t.flags&16384){var n=t.updateQueue;if(n!==null&&(n=n.stores,n!==null))for(var r=0;r<n.length;r++){var a=n[r],i=a.getSnapshot;a=a.value;try{if(!br(i(),a))return!1}catch{return!1}}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;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 Ts(e,t){for(t&=~p0,t&=~Bd,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-pr(t),r=1<<n;e[n]=-1,t&=~r}}function Rg(e){if(Xe&6)throw Error(re(327));qi();var t=Gu(e,0);if(!(t&1))return Tn(e,It()),null;var n=dd(e,t);if(e.tag!==0&&n===2){var r=tm(e);r!==0&&(t=r,n=Pm(e,r))}if(n===1)throw n=Vl,Ua(e,0),Ts(e,t),Tn(e,It()),n;if(n===6)throw Error(re(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,_a(e,Sn,Yr),Tn(e,It()),null}function g0(e,t){var n=Xe;Xe|=1;try{return e(t)}finally{Xe=n,Xe===0&&(mo=It()+500,Md&&la())}}function Ga(e){qs!==null&&qs.tag===0&&!(Xe&6)&&qi();var t=Xe;Xe|=1;var n=Jn.transition,r=ot;try{if(Jn.transition=null,ot=1,e)return e()}finally{ot=r,Jn.transition=n,Xe=t,!(Xe&6)&&la()}}function b0(){Ln=Di.current,yt(Di)}function Ua(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(n!==-1&&(e.timeoutHandle=-1,r2(n)),Mt!==null)for(n=Mt.return;n!==null;){var r=n;switch(Xp(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&Xu();break;case 3:ho(),yt(En),yt(fn),o0();break;case 5:i0(r);break;case 4:ho();break;case 13:yt(jt);break;case 19:yt(jt);break;case 10:n0(r.type._context);break;case 22:case 23:b0()}n=n.return}if(Yt=e,Mt=e=Xs(e.current,null),tn=Ln=t,Vt=0,Vl=null,p0=Bd=Ha=0,Sn=vl=null,Ea!==null){for(t=0;t<Ea.length;t++)if(n=Ea[t],r=n.interleaved,r!==null){n.interleaved=null;var a=r.next,i=n.pending;if(i!==null){var o=i.next;i.next=a,r.next=o}n.pending=r}Ea=null}return e}function s1(e,t){do{var n=Mt;try{if(t0(),Tu.current=od,id){for(var r=kt.memoizedState;r!==null;){var a=r.queue;a!==null&&(a.pending=null),r=r.next}id=!1}if(Wa=0,Gt=zt=kt=null,bl=!1,Bl=0,m0.current=null,n===null||n.return===null){Vt=1,Vl=t,Mt=null;break}e:{var i=e,o=n.return,l=n,c=t;if(t=tn,l.flags|=32768,c!==null&&typeof c=="object"&&typeof c.then=="function"){var d=c,u=l,f=u.tag;if(!(u.mode&1)&&(f===0||f===11||f===15)){var m=u.alternate;m?(u.updateQueue=m.updateQueue,u.memoizedState=m.memoizedState,u.lanes=m.lanes):(u.updateQueue=null,u.memoizedState=null)}var p=bg(o);if(p!==null){p.flags&=-257,yg(p,o,l,i,t),p.mode&1&&gg(i,d,t),t=p,c=d;var v=t.updateQueue;if(v===null){var g=new Set;g.add(c),t.updateQueue=g}else v.add(c);break e}else{if(!(t&1)){gg(i,d,t),y0();break e}c=Error(re(426))}}else if(vt&&l.mode&1){var y=bg(o);if(y!==null){!(y.flags&65536)&&(y.flags|=256),yg(y,o,l,i,t),Zp(fo(c,l));break e}}i=c=fo(c,l),Vt!==4&&(Vt=2),vl===null?vl=[i]:vl.push(i),i=o;do{switch(i.tag){case 3:i.flags|=65536,t&=-t,i.lanes|=t;var b=Bw(i,c,t);dg(i,b);break e;case 1:l=c;var x=i.type,w=i.stateNode;if(!(i.flags&128)&&(typeof x.getDerivedStateFromError=="function"||w!==null&&typeof w.componentDidCatch=="function"&&(Qs===null||!Qs.has(w)))){i.flags|=65536,t&=-t,i.lanes|=t;var _=zw(i,l,t);dg(i,_);break e}}i=i.return}while(i!==null)}o1(n)}catch(j){t=j,Mt===n&&n!==null&&(Mt=n=n.return);continue}break}while(!0)}function a1(){var e=ld.current;return ld.current=od,e===null?od:e}function y0(){(Vt===0||Vt===3||Vt===2)&&(Vt=4),Yt===null||!(Ha&268435455)&&!(Bd&268435455)||Ts(Yt,tn)}function dd(e,t){var n=Xe;Xe|=2;var r=a1();(Yt!==e||tn!==t)&&(Yr=null,Ua(e,t));do try{E2();break}catch(a){s1(e,a)}while(!0);if(t0(),Xe=n,ld.current=r,Mt!==null)throw Error(re(261));return Yt=null,tn=0,Vt}function E2(){for(;Mt!==null;)i1(Mt)}function P2(){for(;Mt!==null&&!eS();)i1(Mt)}function i1(e){var t=c1(e.alternate,e,Ln);e.memoizedProps=e.pendingProps,t===null?o1(e):Mt=t,m0.current=null}function o1(e){var t=e;do{var n=t.alternate;if(e=t.return,t.flags&32768){if(n=_2(n,t),n!==null){n.flags&=32767,Mt=n;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{Vt=6,Mt=null;return}}else if(n=w2(n,t,Ln),n!==null){Mt=n;return}if(t=t.sibling,t!==null){Mt=t;return}Mt=t=e}while(t!==null);Vt===0&&(Vt=5)}function _a(e,t,n){var r=ot,a=Jn.transition;try{Jn.transition=null,ot=1,T2(e,t,n,r)}finally{Jn.transition=a,ot=r}return null}function T2(e,t,n,r){do qi();while(qs!==null);if(Xe&6)throw Error(re(327));n=e.finishedWork;var a=e.finishedLanes;if(n===null)return null;if(e.finishedWork=null,e.finishedLanes=0,n===e.current)throw Error(re(177));e.callbackNode=null,e.callbackPriority=0;var i=n.lanes|n.childLanes;if(uS(e,i),e===Yt&&(Mt=Yt=null,tn=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||nu||(nu=!0,u1(Hu,function(){return qi(),null})),i=(n.flags&15990)!==0,n.subtreeFlags&15990||i){i=Jn.transition,Jn.transition=null;var o=ot;ot=1;var l=Xe;Xe|=4,m0.current=null,N2(e,n),t1(n,e),QS(om),Ku=!!im,om=im=null,e.current=n,k2(n),tS(),Xe=l,ot=o,Jn.transition=i}else e.current=n;if(nu&&(nu=!1,qs=e,ud=a),i=e.pendingLanes,i===0&&(Qs=null),sS(n.stateNode),Tn(e,It()),t!==null)for(r=e.onRecoverableError,n=0;n<t.length;n++)a=t[n],r(a.value,{componentStack:a.stack,digest:a.digest});if(cd)throw cd=!1,e=Cm,Cm=null,e;return ud&1&&e.tag!==0&&qi(),i=e.pendingLanes,i&1?e===Em?wl++:(wl=0,Em=e):wl=0,la(),null}function qi(){if(qs!==null){var e=Bv(ud),t=Jn.transition,n=ot;try{if(Jn.transition=null,ot=16>e?16:e,qs===null)var r=!1;else{if(e=qs,qs=null,ud=0,Xe&6)throw Error(re(331));var a=Xe;for(Xe|=4,je=e.current;je!==null;){var i=je,o=i.child;if(je.flags&16){var l=i.deletions;if(l!==null){for(var c=0;c<l.length;c++){var d=l[c];for(je=d;je!==null;){var u=je;switch(u.tag){case 0:case 11:case 15:yl(8,u,i)}var f=u.child;if(f!==null)f.return=u,je=f;else for(;je!==null;){u=je;var m=u.sibling,p=u.return;if(Xw(u),u===d){je=null;break}if(m!==null){m.return=p,je=m;break}je=p}}}var v=i.alternate;if(v!==null){var g=v.child;if(g!==null){v.child=null;do{var y=g.sibling;g.sibling=null,g=y}while(g!==null)}}je=i}}if(i.subtreeFlags&2064&&o!==null)o.return=i,je=o;else e:for(;je!==null;){if(i=je,i.flags&2048)switch(i.tag){case 0:case 11:case 15:yl(9,i,i.return)}var b=i.sibling;if(b!==null){b.return=i.return,je=b;break e}je=i.return}}var x=e.current;for(je=x;je!==null;){o=je;var w=o.child;if(o.subtreeFlags&2064&&w!==null)w.return=o,je=w;else e:for(o=x;je!==null;){if(l=je,l.flags&2048)try{switch(l.tag){case 0:case 11:case 15:Ud(9,l)}}catch(j){Tt(l,l.return,j)}if(l===o){je=null;break e}var _=l.sibling;if(_!==null){_.return=l.return,je=_;break e}je=l.return}}if(Xe=a,la(),Dr&&typeof Dr.onPostCommitFiberRoot=="function")try{Dr.onPostCommitFiberRoot(Ad,e)}catch{}r=!0}return r}finally{ot=n,Jn.transition=t}}return!1}function Ag(e,t,n){t=fo(n,t),t=Bw(e,t,1),e=Ys(e,t,1),t=vn(),e!==null&&(pc(e,1,t),Tn(e,t))}function Tt(e,t,n){if(e.tag===3)Ag(e,e,n);else for(;t!==null;){if(t.tag===3){Ag(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(Qs===null||!Qs.has(r))){e=fo(n,e),e=zw(t,e,1),t=Ys(t,e,1),e=vn(),t!==null&&(pc(t,1,e),Tn(t,e));break}}t=t.return}}function R2(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),t=vn(),e.pingedLanes|=e.suspendedLanes&n,Yt===e&&(tn&n)===n&&(Vt===4||Vt===3&&(tn&130023424)===tn&&500>It()-x0?Ua(e,0):p0|=n),Tn(e,t)}function l1(e,t){t===0&&(e.mode&1?(t=Hc,Hc<<=1,!(Hc&130023424)&&(Hc=4194304)):t=1);var n=vn();e=is(e,t),e!==null&&(pc(e,t,n),Tn(e,n))}function A2(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),l1(e,n)}function I2(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,a=e.memoizedState;a!==null&&(n=a.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(re(314))}r!==null&&r.delete(t),l1(e,n)}var c1;c1=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||En.current)Cn=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return Cn=!1,v2(e,t,n);Cn=!!(e.flags&131072)}else Cn=!1,vt&&t.flags&1048576&&fw(t,td,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;Au(e,t),e=t.pendingProps;var a=lo(t,fn.current);zi(t,n),a=c0(null,t,r,e,a,n);var i=u0();return t.flags|=1,typeof a=="object"&&a!==null&&typeof a.render=="function"&&a.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,Pn(r)?(i=!0,Zu(t)):i=!1,t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,s0(t),a.updater=Fd,t.stateNode=a,a._reactInternals=t,xm(t,r,e,n),t=ym(null,t,r,!0,i,n)):(t.tag=0,vt&&i&&Jp(t),bn(null,t,a,n),t=t.child),t;case 16:r=t.elementType;e:{switch(Au(e,t),e=t.pendingProps,a=r._init,r=a(r._payload),t.type=r,a=t.tag=D2(r),e=ir(r,e),a){case 0:t=bm(null,t,r,e,n);break e;case 1:t=_g(null,t,r,e,n);break e;case 11:t=vg(null,t,r,e,n);break e;case 14:t=wg(null,t,r,ir(r.type,e),n);break e}throw Error(re(306,r,""))}return t;case 0:return r=t.type,a=t.pendingProps,a=t.elementType===r?a:ir(r,a),bm(e,t,r,a,n);case 1:return r=t.type,a=t.pendingProps,a=t.elementType===r?a:ir(r,a),_g(e,t,r,a,n);case 3:e:{if(Hw(t),e===null)throw Error(re(387));r=t.pendingProps,i=t.memoizedState,a=i.element,yw(e,t),sd(t,r,null,n);var o=t.memoizedState;if(r=o.element,i.isDehydrated)if(i={element:r,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},t.updateQueue.baseState=i,t.memoizedState=i,t.flags&256){a=fo(Error(re(423)),t),t=jg(e,t,r,n,a);break e}else if(r!==a){a=fo(Error(re(424)),t),t=jg(e,t,r,n,a);break e}else for(Fn=Ks(t.stateNode.containerInfo.firstChild),Un=t,vt=!0,hr=null,n=gw(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(co(),r===a){t=os(e,t,n);break e}bn(e,t,r,n)}t=t.child}return t;case 5:return vw(t),e===null&&fm(t),r=t.type,a=t.pendingProps,i=e!==null?e.memoizedProps:null,o=a.children,lm(r,a)?o=null:i!==null&&lm(r,i)&&(t.flags|=32),Ww(e,t),bn(e,t,o,n),t.child;case 6:return e===null&&fm(t),null;case 13:return Gw(e,t,n);case 4:return a0(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=uo(t,null,r,n):bn(e,t,r,n),t.child;case 11:return r=t.type,a=t.pendingProps,a=t.elementType===r?a:ir(r,a),vg(e,t,r,a,n);case 7:return bn(e,t,t.pendingProps,n),t.child;case 8:return bn(e,t,t.pendingProps.children,n),t.child;case 12:return bn(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,a=t.pendingProps,i=t.memoizedProps,o=a.value,ht(nd,r._currentValue),r._currentValue=o,i!==null)if(br(i.value,o)){if(i.children===a.children&&!En.current){t=os(e,t,n);break e}}else for(i=t.child,i!==null&&(i.return=t);
vendor: 11,024 bytes, line 41
41i!==null;){var l=i.dependencies;if(l!==null){o=i.child;for(var c=l.firstContext;c!==null;){if(c.context===r){if(i.tag===1){c=ns(-1,n&-n),c.tag=2;var d=i.updateQueue;if(d!==null){d=d.shared;var u=d.pending;u===null?c.next=c:(c.next=u.next,u.next=c),d.pending=c}}i.lanes|=n,c=i.alternate,c!==null&&(c.lanes|=n),mm(i.return,n,t),l.lanes|=n;break}c=c.next}}else if(i.tag===10)o=i.type===t.type?null:i.child;else if(i.tag===18){if(o=i.return,o===null)throw Error(re(341));o.lanes|=n,l=o.alternate,l!==null&&(l.lanes|=n),mm(o,n,t),o=i.sibling}else o=i.child;if(o!==null)o.return=i;else for(o=i;o!==null;){if(o===t){o=null;break}if(i=o.sibling,i!==null){i.return=o.return,o=i;break}o=o.return}i=o}bn(e,t,a.children,n),t=t.child}return t;case 9:return a=t.type,r=t.pendingProps.children,zi(t,n),a=Xn(a),r=r(a),t.flags|=1,bn(e,t,r,n),t.child;case 14:return r=t.type,a=ir(r,t.pendingProps),a=ir(r.type,a),wg(e,t,r,a,n);case 15:return qw(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,a=t.pendingProps,a=t.elementType===r?a:ir(r,a),Au(e,t),t.tag=1,Pn(r)?(e=!0,Zu(t)):e=!1,zi(t,n),Uw(t,r,a),xm(t,r,a,n),ym(null,t,r,!0,e,n);case 19:return Kw(e,t,n);case 22:return Vw(e,t,n)}throw Error(re(156,t.tag))};function u1(e,t){return Mv(e,t)}function O2(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Qn(e,t,n,r){return new O2(e,t,n,r)}function v0(e){return e=e.prototype,!(!e||!e.isReactComponent)}function D2(e){if(typeof e=="function")return v0(e)?1:0;if(e!=null){if(e=e.$$typeof,e===Fp)return 11;if(e===Up)return 14}return 2}function Xs(e,t){var n=e.alternate;return n===null?(n=Qn(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function Du(e,t,n,r,a,i){var o=2;if(r=e,typeof e=="function")v0(e)&&(o=1);else if(typeof e=="string")o=5;else e:switch(e){case ki:return Ba(n.children,a,i,t);case $p:o=8,a|=8;break;case Uf:return e=Qn(12,n,t,a|2),e.elementType=Uf,e.lanes=i,e;case Bf:return e=Qn(13,n,t,a),e.elementType=Bf,e.lanes=i,e;case zf:return e=Qn(19,n,t,a),e.elementType=zf,e.lanes=i,e;case vv:return zd(n,a,i,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case bv:o=10;break e;case yv:o=9;break e;case Fp:o=11;break e;case Up:o=14;break e;case ks:o=16,r=null;break e}throw Error(re(130,e==null?e:typeof e,""))}return t=Qn(o,n,t,a),t.elementType=e,t.type=r,t.lanes=i,t}function Ba(e,t,n,r){return e=Qn(7,e,r,t),e.lanes=n,e}function zd(e,t,n,r){return e=Qn(22,e,r,t),e.elementType=vv,e.lanes=n,e.stateNode={isHidden:!1},e}function ef(e,t,n){return e=Qn(6,e,null,t),e.lanes=n,e}function tf(e,t,n){return t=Qn(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function L2(e,t,n,r,a){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=Dh(0),this.expirationTimes=Dh(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Dh(0),this.identifierPrefix=r,this.onRecoverableError=a,this.mutableSourceEagerHydrationData=null}function w0(e,t,n,r,a,i,o,l,c){return e=new L2(e,t,n,l,c),t===1?(t=1,i===!0&&(t|=8)):t=0,i=Qn(3,null,null,t),e.current=i,i.stateNode=e,i.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},s0(i),e}function M2(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:Ni,key:r==null?null:""+r,children:e,containerInfo:t,implementation:n}}function d1(e){if(!e)return na;e=e._reactInternals;e:{if(ti(e)!==e||e.tag!==1)throw Error(re(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(Pn(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(t!==null);throw Error(re(171))}if(e.tag===1){var n=e.type;if(Pn(n))return dw(e,n,t)}return t}function h1(e,t,n,r,a,i,o,l,c){return e=w0(n,r,!0,e,a,i,o,l,c),e.context=d1(null),n=e.current,r=vn(),a=Js(n),i=ns(r,a),i.callback=t??null,Ys(n,i,a),e.current.lanes=a,pc(e,a,r),Tn(e,r),e}function qd(e,t,n,r){var a=t.current,i=vn(),o=Js(a);return n=d1(n),t.context===null?t.context=n:t.pendingContext=n,t=ns(i,o),t.payload={element:e},r=r===void 0?null:r,r!==null&&(t.callback=r),e=Ys(a,t,o),e!==null&&(xr(e,a,o,i),Pu(e,a,o)),o}function hd(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 Ig(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function _0(e,t){Ig(e,t),(e=e.alternate)&&Ig(e,t)}function $2(){return null}var f1=typeof reportError=="function"?reportError:function(e){console.error(e)};function j0(e){this._internalRoot=e}Vd.prototype.render=j0.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(re(409));qd(e,t,null,null)};Vd.prototype.unmount=j0.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;Ga(function(){qd(null,e,null,null)}),t[as]=null}};function Vd(e){this._internalRoot=e}Vd.prototype.unstable_scheduleHydration=function(e){if(e){var t=Vv();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Ps.length&&t!==0&&t<Ps[n].priority;n++);Ps.splice(n,0,e),n===0&&Hv(e)}};function N0(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function Wd(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function Og(){}function F2(e,t,n,r,a){if(a){if(typeof r=="function"){var i=r;r=function(){var d=hd(o);i.call(d)}}var o=h1(t,r,e,0,null,!1,!1,"",Og);return e._reactRootContainer=o,e[as]=o.current,Ll(e.nodeType===8?e.parentNode:e),Ga(),o}for(;a=e.lastChild;)e.removeChild(a);if(typeof r=="function"){var l=r;r=function(){var d=hd(c);l.call(d)}}var c=w0(e,0,!1,null,null,!1,!1,"",Og);return e._reactRootContainer=c,e[as]=c.current,Ll(e.nodeType===8?e.parentNode:e),Ga(function(){qd(t,c,n,r)}),c}function Hd(e,t,n,r,a){var i=n._reactRootContainer;if(i){var o=i;if(typeof a=="function"){var l=a;a=function(){var c=hd(o);l.call(c)}}qd(t,o,e,a)}else o=F2(n,t,e,a,r);return hd(o)}zv=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=il(t.pendingLanes);n!==0&&(qp(t,n|1),Tn(t,It()),!(Xe&6)&&(mo=It()+500,la()))}break;case 13:Ga(function(){var r=is(e,1);if(r!==null){var a=vn();xr(r,e,1,a)}}),_0(e,1)}};Vp=function(e){if(e.tag===13){var t=is(e,134217728);if(t!==null){var n=vn();xr(t,e,134217728,n)}_0(e,134217728)}};qv=function(e){if(e.tag===13){var t=Js(e),n=is(e,t);if(n!==null){var r=vn();xr(n,e,t,r)}_0(e,t)}};Vv=function(){return ot};Wv=function(e,t){var n=ot;try{return ot=e,t()}finally{ot=n}};Xf=function(e,t,n){switch(t){case"input":if(Wf(e,n),t=n.name,n.type==="radio"&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll("input[name="+JSON.stringify(""+t)+'][type="radio"]'),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var a=Ld(r);if(!a)throw Error(re(90));_v(r),Wf(r,a)}}}break;case"textarea":Nv(e,n);break;case"select":t=n.value,t!=null&&$i(e,!!n.multiple,t,!1)}};Rv=g0;Av=Ga;var U2={usingClientEntryPoint:!1,Events:[gc,Pi,Ld,Pv,Tv,g0]},Zo={findFiberByHostInstance:Ca,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},B2={bundleType:Zo.bundleType,version:Zo.version,rendererPackageName:Zo.rendererPackageName,rendererConfig:Zo.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:ms.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=Dv(e),e===null?null:e.stateNode},findFiberByHostInstance:Zo.findFiberByHostInstance||$2,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var ru=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!ru.isDisabled&&ru.supportsFiber)try{Ad=ru.inject(B2),Dr=ru}catch{}}qn.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=U2;qn.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!N0(t))throw Error(re(200));return M2(e,t,null,n)};qn.createRoot=function(e,t){if(!N0(e))throw Error(re(299));var n=!1,r="",a=f1;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onRecoverableError!==void 0&&(a=t.onRecoverableError)),t=w0(e,1,!1,null,null,n,!1,r,a),e[as]=t.current,Ll(e.nodeType===8?e.parentNode:e),new j0(t)};qn.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(re(188)):(e=Object.keys(e).join(","),Error(re(268,e)));return e=Dv(t),e=e===null?null:e.stateNode,e};qn.flushSync=function(e){return Ga(e)};qn.hydrate=function(e,t,n){if(!Wd(t))throw Error(re(200));return Hd(null,e,t,!0,n)};qn.hydrateRoot=function(e,t,n){if(!N0(e))throw Error(re(405));var r=n!=null&&n.hydratedSources||null,a=!1,i="",o=f1;if(n!=null&&(n.unstable_strictMode===!0&&(a=!0),n.identifierPrefix!==void 0&&(i=n.identifierPrefix),n.onRecoverableError!==void 0&&(o=n.onRecoverableError)),t=h1(t,null,e,1,n??null,a,!1,i,o),e[as]=t.current,Ll(e),r)for(e=0;e<r.length;e++)n=r[e],a=n._getVersion,a=a(n._source),t.mutableSourceEagerHydrationData==null?t.mutableSourceEagerHydrationData=[n,a]:t.mutableSourceEagerHydrationData.push(n,a);return new Vd(t)};qn.render=function(e,t,n){if(!Wd(t))throw Error(re(200));return Hd(null,e,t,!1,n)};qn.unmountComponentAtNode=function(e){if(!Wd(e))throw Error(re(40));return e._reactRootContainer?(Ga(function(){Hd(null,null,e,!1,function(){e._reactRootContainer=null,e[as]=null})}),!0):!1};qn.unstable_batchedUpdates=g0;qn.unstable_renderSubtreeIntoContainer=function(e,t,n,r){if(!Wd(n))throw Error(re(200));if(e==null||e._reactInternals===void 0)throw Error(re(38));return Hd(e,t,n,!1,r)};qn.version="18.3.1-next-f1338f8080-20240426";
41function m1(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(m1)}catch(e){console.error(e)}}m1(),mv.exports=qn;var In=mv.exports;const p1=nv(In);var x1,Dg=In;x1=Dg.createRoot,Dg.hydrateRoot;const z2="modulepreload",q2=function(e){return"/"+e},Lg={},ne=function(t,n,r){let a=Promise.resolve();if(n&&n.length>0){document.getElementsByTagName("link");const o=document.querySelector("meta[property=csp-nonce]"),l=(o==null?void 0:o.nonce)||(o==null?void 0:o.getAttribute("nonce"));a=Promise.allSettled(n.map(c=>{if(c=q2(c),c in Lg)return;Lg[c]=!0;const d=c.endsWith(".css"),u=d?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${c}"]${u}`))return;const f=document.createElement("link");if(f.rel=d?"stylesheet":z2,d||(f.as="script"),f.crossOrigin="",f.href=c,l&&f.setAttribute("nonce",l),document.head.appendChild(f),d)return new Promise((m,p)=>{f.addEventListener("load",m),f.addEventListener("error",()=>p(new Error(`Unable to preload CSS for ${c}`)))})}))}function i(o){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=o,window.dispatchEvent(l),!l.defaultPrevented)throw o}return a.then(o=>{for(const l of o||[])l.status==="rejected"&&i(l.reason);return t().catch(i)})};function se(e){return h.lazy(async()=>{try{return await e()}catch(t){const n="c24-chunk-reload-at",r=Number(sessionStorage.getItem(n)||0);if(Date.now()-r>1e4)return sessionStorage.setItem(n,String(Date.now())),window.location.reload(),new Promise(()=>{});throw t}})}var _o=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(){}},Ka=typeof window>"u"||"Deno"in globalThis;function yn(){}function V2(e,t){return typeof e=="function"?e(t):e}function Rm(e){return typeof e=="number"&&e>=0&&e!==1/0}function g1(e,t){return Math.max(e+(t||0)-Date.now(),0)}function Zs(e,t){return typeof e=="function"?e(t):e}function Gn(e,t){return typeof e=="function"?e(t):e}function Mg(e,t){const{type:n="all",exact:r,fetchStatus:a,predicate:i,queryKey:o,stale:l}=e;if(o){if(r){if(t.queryHash!==k0(o,t.options))return!1}else if(!Wl(t.queryKey,o))return!1}if(n!=="all"){const c=t.isActive();if(n==="active"&&!c||n==="inactive"&&c)return!1}return!(typeof l=="boolean"&&t.isStale()!==l||a&&a!==t.state.fetchStatus||i&&!i(t))}function $g(e,t){const{exact:n,status:r,predicate:a,mutationKey:i}=e;if(i){if(!t.options.mutationKey)return!1;if(n){if(Ya(t.options.mutationKey)!==Ya(i))return!1}else if(!Wl(t.options.mutationKey,i))return!1}return!(r&&t.state.status!==r||a&&!a(t))}function k0(e,t){return((t==null?void 0:t.queryKeyHashFn)||Ya)(e)}function Ya(e){return JSON.stringify(e,(t,n)=>Am(n)?Object.keys(n).sort().reduce((r,a)=>(r[a]=n[a],r),{}):n)}function Wl(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(n=>Wl(e[n],t[n])):!1}function b1(e,t){if(e===t)return e;const n=Fg(e)&&Fg(t);if(n||Am(e)&&Am(t)){const r=n?e:Object.keys(e),a=r.length,i=n?t:Object.keys(t),o=i.length,l=n?[]:{},c=new Set(r);let d=0;for(let u=0;u<o;u++){const f=n?u:i[u];(!n&&c.has(f)||n)&&e[f]===void 0&&t[f]===void 0?(l[f]=void 0,d++):(l[f]=b1(e[f],t[f]),l[f]===e[f]&&e[f]!==void 0&&d++)}return a===o&&d===a?e:l}return t}function fd(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(e[n]!==t[n])return!1;return!0}function Fg(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Am(e){if(!Ug(e))return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(!Ug(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function Ug(e){return Object.prototype.toString.call(e)==="[object Object]"}function W2(e){return new Promise(t=>{setTimeout(t,e)})}function Im(e,t,n){return typeof n.structuralSharing=="function"?n.structuralSharing(e,t):n.structuralSharing!==!1?b1(e,t):t}function Y8(e){return e}function H2(e,t,n=0){const r=[...e,t];return n&&r.length>n?r.slice(1):r}function G2(e,t,n=0){const r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var S0=Symbol();function y1(e,t){return!e.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!e.queryFn||e.queryFn===S0?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function v1(e,t){return typeof e=="function"?e(...t):!!e}var Ra,As,Yi,Hy,K2=(Hy=class extends _o{constructor(){super();Ae(this,Ra);Ae(this,As);Ae(this,Yi);we(this,Yi,t=>{if(!Ka&&window.addEventListener){const n=()=>t();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){L(this,As)||this.setEventListener(L(this,Yi))}onUnsubscribe(){var t;this.hasListeners()||((t=L(this,As))==null||t.call(this),we(this,As,void 0))}setEventListener(t){var n;we(this,Yi,t),(n=L(this,As))==null||n.call(this),we(this,As,t(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(t){L(this,Ra)!==t&&(we(this,Ra,t),this.onFocus())}onFocus(){const t=this.isFocused();
vendor: 4,924 bytes, line 41
41this.listeners.forEach(n=>{n(t)})}isFocused(){var t;return typeof L(this,Ra)=="boolean"?L(this,Ra):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},Ra=new WeakMap,As=new WeakMap,Yi=new WeakMap,Hy),C0=new K2,Qi,Is,Ji,Gy,Y2=(Gy=class extends _o{constructor(){super();Ae(this,Qi,!0);Ae(this,Is);Ae(this,Ji);we(this,Ji,t=>{if(!Ka&&window.addEventListener){const n=()=>t(!0),r=()=>t(!1);return window.addEventListener("online",n,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",n),window.removeEventListener("offline",r)}}})}onSubscribe(){L(this,Is)||this.setEventListener(L(this,Ji))}onUnsubscribe(){var t;this.hasListeners()||((t=L(this,Is))==null||t.call(this),we(this,Is,void 0))}setEventListener(t){var n;we(this,Ji,t),(n=L(this,Is))==null||n.call(this),we(this,Is,t(this.setOnline.bind(this)))}setOnline(t){L(this,Qi)!==t&&(we(this,Qi,t),this.listeners.forEach(r=>{r(t)}))}isOnline(){return L(this,Qi)}},Qi=new WeakMap,Is=new WeakMap,Ji=new WeakMap,Gy),md=new Y2;function Om(){let e,t;const n=new Promise((a,i)=>{e=a,t=i});n.status="pending",n.catch(()=>{});function r(a){Object.assign(n,a),delete n.resolve,delete n.reject}return n.resolve=a=>{r({status:"fulfilled",value:a}),e(a)},n.reject=a=>{r({status:"rejected",reason:a}),t(a)},n}function Q2(e){return Math.min(1e3*2**e,3e4)}function w1(e){return(e??"online")==="online"?md.isOnline():!0}var _1=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function nf(e){return e instanceof _1}function j1(e){let t=!1,n=0,r=!1,a;const i=Om(),o=g=>{var y;r||(m(new _1(g)),(y=e.abort)==null||y.call(e))},l=()=>{t=!0},c=()=>{t=!1},d=()=>C0.isFocused()&&(e.networkMode==="always"||md.isOnline())&&e.canRun(),u=()=>w1(e.networkMode)&&e.canRun(),f=g=>{var y;r||(r=!0,(y=e.onSuccess)==null||y.call(e,g),a==null||a(),i.resolve(g))},m=g=>{var y;r||(r=!0,(y=e.onError)==null||y.call(e,g),a==null||a(),i.reject(g))},p=()=>new Promise(g=>{var y;a=b=>{(r||d())&&g(b)},(y=e.onPause)==null||y.call(e)}).then(()=>{var g;a=void 0,r||(g=e.onContinue)==null||g.call(e)}),v=()=>{if(r)return;let g;const y=n===0?e.initialPromise:void 0;try{g=y??e.fn()}catch(b){g=Promise.reject(b)}Promise.resolve(g).then(f).catch(b=>{var N;if(r)return;const x=e.retry??(Ka?0:3),w=e.retryDelay??Q2,_=typeof w=="function"?w(n,b):w,j=x===!0||typeof x=="number"&&n<x||typeof x=="function"&&x(n,b);if(t||!j){m(b);return}n++,(N=e.onFail)==null||N.call(e,n,b),W2(_).then(()=>d()?void 0:p()).then(()=>{t?m(b):v()})})};return{promise:i,cancel:o,continue:()=>(a==null||a(),i),cancelRetry:l,continueRetry:c,canStart:u,start:()=>(u()?v():p().then(v),i)}}var J2=e=>setTimeout(e,0);function X2(){let e=[],t=0,n=l=>{l()},r=l=>{l()},a=J2;const i=l=>{t?e.push(l):a(()=>{n(l)})},o=()=>{const l=e;e=[],l.length&&a(()=>{r(()=>{l.forEach(c=>{n(c)})})})};return{batch:l=>{let c;t++;try{c=l()}finally{t--,t||o()}return c},batchCalls:l=>(...c)=>{i(()=>{l(...c)})},schedule:i,setNotifyFunction:l=>{n=l},setBatchNotifyFunction:l=>{r=l},setScheduler:l=>{a=l}}}var qt=X2(),Aa,Ky,N1=(Ky=class{constructor(){Ae(this,Aa)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Rm(this.gcTime)&&we(this,Aa,setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Ka?1/0:5*60*1e3))}clearGcTimeout(){L(this,Aa)&&(clearTimeout(L(this,Aa)),we(this,Aa,void 0))}},Aa=new WeakMap,Ky),Xi,Ia,Hn,Oa,dn,uc,Da,lr,Kr,Yy,Z2=(Yy=class extends N1{constructor(t){super();Ae(this,lr);Ae(this,Xi);Ae(this,Ia);Ae(this,Hn);Ae(this,Oa);Ae(this,dn);Ae(this,uc);Ae(this,Da);we(this,Da,!1),we(this,uc,t.defaultOptions),this.setOptions(t.options),this.observers=[],we(this,Oa,t.client),we(this,Hn,L(this,Oa).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,we(this,Xi,eC(this.options)),this.state=t.state??L(this,Xi),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var t;return(t=L(this,dn))==null?void 0:t.promise}setOptions(t){this.options={...L(this,uc),...t},this.updateGcTime(this.options.gcTime)}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&L(this,Hn).remove(this)}setData(t,n){const r=Im(this.state.data,t,this.options);return qe(this,lr,Kr).call(this,{data:r,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),r}setState(t,n){qe(this,lr,Kr).call(this,{type:"setState",state:t,setStateOptions:n})}cancel(t){var r,a;const n=(r=L(this,dn))==null?void 0:r.promise;return(a=L(this,dn))==null||a.cancel(t),n?n.then(yn).catch(yn):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(L(this,Xi))}isActive(){return this.observers.some(t=>Gn(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===S0||this.state.dataUpdateCount+this.state.errorUpdate
vendor: 1,274 bytes, line 41
41Count===0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>Zs(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:!g1(this.state.dataUpdatedAt,t)}onFocus(){var n;const t=this.observers.find(r=>r.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(n=L(this,dn))==null||n.continue()}onOnline(){var n;const t=this.observers.find(r=>r.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(n=L(this,dn))==null||n.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),L(this,Hn).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(n=>n!==t),this.observers.length||(L(this,dn)&&(L(this,Da)?L(this,dn).cancel({revert:!0}):L(this,dn).cancelRetry()),this.scheduleGc()),L(this,Hn).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||qe(this,lr,Kr).call(this,{type:"invalidate"})}
vendor: 4,428 bytes, line 41
41fetch(t,n){var d,u,f;if(this.state.fetchStatus!=="idle"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(L(this,dn))return L(this,dn).continueRetry(),L(this,dn).promise}if(t&&this.setOptions(t),!this.options.queryFn){const m=this.observers.find(p=>p.options.queryFn);m&&this.setOptions(m.options)}const r=new AbortController,a=m=>{Object.defineProperty(m,"signal",{enumerable:!0,get:()=>(we(this,Da,!0),r.signal)})},i=()=>{const m=y1(this.options,n),v=(()=>{const g={client:L(this,Oa),queryKey:this.queryKey,meta:this.meta};return a(g),g})();return we(this,Da,!1),this.options.persister?this.options.persister(m,v,this):m(v)},l=(()=>{const m={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:L(this,Oa),state:this.state,fetchFn:i};return a(m),m})();(d=this.options.behavior)==null||d.onFetch(l,this),we(this,Ia,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((u=l.fetchOptions)==null?void 0:u.meta))&&qe(this,lr,Kr).call(this,{type:"fetch",meta:(f=l.fetchOptions)==null?void 0:f.meta});const c=m=>{var p,v,g,y;nf(m)&&m.silent||qe(this,lr,Kr).call(this,{type:"error",error:m}),nf(m)||((v=(p=L(this,Hn).config).onError)==null||v.call(p,m,this),(y=(g=L(this,Hn).config).onSettled)==null||y.call(g,this.state.data,m,this)),this.scheduleGc()};return we(this,dn,j1({initialPromise:n==null?void 0:n.initialPromise,fn:l.fetchFn,abort:r.abort.bind(r),onSuccess:m=>{var p,v,g,y;if(m===void 0){c(new Error(`${this.queryHash} data is undefined`));return}try{this.setData(m)}catch(b){c(b);return}(v=(p=L(this,Hn).config).onSuccess)==null||v.call(p,m,this),(y=(g=L(this,Hn).config).onSettled)==null||y.call(g,m,this.state.error,this),this.scheduleGc()},onError:c,onFail:(m,p)=>{qe(this,lr,Kr).call(this,{type:"failed",failureCount:m,error:p})},onPause:()=>{qe(this,lr,Kr).call(this,{type:"pause"})},onContinue:()=>{qe(this,lr,Kr).call(this,{type:"continue"})},retry:l.options.retry,retryDelay:l.options.retryDelay,networkMode:l.options.networkMode,canRun:()=>!0})),L(this,dn).start()}},Xi=new WeakMap,Ia=new WeakMap,Hn=new WeakMap,Oa=new WeakMap,dn=new WeakMap,uc=new WeakMap,Da=new WeakMap,lr=new WeakSet,Kr=function(t){const n=r=>{switch(t.type){case"failed":return{...r,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...r,fetchStatus:"paused"};case"continue":return{...r,fetchStatus:"fetching"};case"fetch":return{...r,...k1(r.data,this.options),fetchMeta:t.meta??null};case"success":return we(this,Ia,void 0),{...r,data:t.data,dataUpdateCount:r.dataUpdateCount+1,dataUpdatedAt:t.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};case"error":const a=t.error;return nf(a)&&a.revert&&L(this,Ia)?{...L(this,Ia),fetchStatus:"idle"}:{...r,error:a,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:a,fetchStatus:"idle",status:"error"};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...t.state}}};this.state=n(this.state),qt.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),L(this,Hn).notify({query:this,type:"updated",action:t})})},Yy);function k1(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:w1(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function eC(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}var Pr,Qy,tC=(Qy=class extends _o{constructor(t={}){super();Ae(this,Pr);this.config=t,we(this,Pr,new Map)}build(t,n,r){const a=n.queryKey,i=n.queryHash??k0(a,n);let o=this.get(i);return o||(o=new Z2({client:t,queryKey:a,queryHash:i,options:t.defaultQueryOptions(n),state:r,defaultOptions:t.getQueryDefaults(a)}),this.add(o)),o}add(t){L(this,Pr).has(t.queryHash)||(L(this,Pr).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const n=L(this,Pr).get(t.queryHash);n&&(t.destroy(),n===t&&L(this,Pr).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){qt.batch(()=>
41{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return L(this,Pr).get(t)}getAll(){return[...L(this,Pr).values()]}find(t){const n={exact:!0,...t};return this.getAll().find(r=>Mg(n,r))}findAll(t={}){const n=this.getAll();return Object.keys(t).length>0?n.filter(r=>Mg(t,r)):n}notify(t){qt.batch(()=>{this.listeners.forEach(n=>{n(t)})})}onFocus(){qt.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){qt.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},Pr=new WeakMap,Qy),Tr,xn,La,Rr,js,Jy,nC=(Jy=class extends N1{constructor(t){super();Ae(this,Rr);Ae(this,Tr);Ae(this,xn);Ae(this,La);this.mutationId=t.mutationId,we(this,xn,t.mutationCache),we(this,Tr,[]),this.state=t.state||S1(),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,Tr).includes(t)||(L(this,Tr).push(t),this.clearGcTimeout(),L(this,xn).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){we(this,Tr,L(this,Tr).filter(n=>n!==t)),this.scheduleGc(),L(this,xn).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){L(this,Tr).length||(this.state.status==="pending"?this.scheduleGc():L(this,xn).remove(this))}continue(){var t;return((t=L(this,La))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var i,o,l,c,d,u,f,m,p,v,g,y,b,x,w,_,j,N,k,C;const n=()=>{qe(this,Rr,js).call(this,{type:"continue"})};we(this,La,j1({fn:()=>this.options.mutationFn?this.options.mutationFn(t):Promise.reject(new Error("No mutationFn found")),onFail:(A,I)=>{qe(this,Rr,js).call(this,{type:"failed",failureCount:A,error:I})},onPause:()=>{qe(this,Rr,js).call(this,{type:"pause"})},onContinue:n,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>L(this,xn).canRun(this)}));const r=this.state.status==="pending",a=!L(this,La).canStart();try{if(r)n();else{qe(this,Rr,js).call(this,{type:"pending",variables:t,isPaused:a}),await((o=(i=L(this,xn).config).onMutate)==null?void 0:o.call(i,t,this));const I=await((c=(l=this.options).onMutate)==null?void 0:c.call(l,t));I!==this.state.context&&qe(this,Rr,js).call(this,{type:"pending",context:I,variables:t,isPaused:a})}const A=await L(this,La).start();return await((u=(d=L(this,xn).config).onSuccess)==null?void 0:u.call(d,A,t,this.state.context,this)),await((m=(f=this.options).onSuccess)==null?void 0:m.call(f,A,t,this.state.context)),await((v=(p=L(this,xn).config).onSettled)==null?void 0:v.call(p,A,null,this.state.variables,this.state.context,this)),await((y=(g=this.options).onSettled)==null?void 0:y.call(g,A,null,t,this.state.context)),qe(this,Rr,js).call(this,{type:"success",data:A}),A}catch(A){try{throw await((x=(b=L(this,xn).config).onError)==null?void 0:x.call(b,A,t,this.state.context,this)),await((_=(w=this.options).onError)==null?void 0:_.call(w,A,t,this.state.context)),await((N=(j=L(this,xn).config).onSettled)==null?void 0:N.call(j,void 0,A,this.state.variables,this.state.context,this)),await((C=(k=this.options).onSettled)==null?void 0:C.call(k,void 0,A,t,this.state.context)),A}finally{qe(this,Rr,js).call(this,{type:"error",error:A})}}finally{L(this,xn).runNext(this)}}},Tr=new WeakMap,xn=new WeakMap,La=new WeakMap,Rr=new WeakSet,js=function(t){const n=r=>{switch(t.type){case"failed":return{...r,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...r,isPaused:!0};case"continue":return{...r,isPaused:!1};case"pending":return{...r,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{...r,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...r,data:void 0,error:t.error,failureCount:r.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=n(this.state),qt.batch(()=>{L(this,Tr).forEach(r=>{r.onMutationUpdate(t)}),L(this,xn).notify({mutation:this,type:"updated",action:t})})},Jy);function S1(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Xr,cr,dc,Xy,rC=(Xy=class extends _o{constructor(t={}){super();Ae(this,Xr);Ae(this,cr);Ae(this,dc);this.config=t,we(this,Xr,new Set),we(this,cr,new Map),we(this,dc,0)}build(t,n,r){const a=new nC({mutationCache:this,mutationId:++Uc(this,dc)._,options:t.defaultMutationOptions(n),state:r});return this.add(a),a}add(t){L(this,Xr).add(t);const n=su(t);if(typeof n=="string"){const r=L(this,cr).get(n);r?r.push(t):L(this,cr).set(n,[t])}this.notify({type:"added",mutation:t})}remove(t){if(L(this,Xr).delete(t)){const n=su(t);if(typeof n=="string"){const r=L(this,cr).get(n);if(r)if(r.length>1){const a=r.indexOf(t);a!==-1&&r.splice(a,1)}else r[0]===t&&L(this,cr).delete(n)}}this.notify({type:"removed",mutation:t})}canRun(t){const n=su(t);if(typeof n=="string"){const r=L(this,cr).get(n),a=r==null?void 0:r.find(i=>i.state.status==="pending");return!a||a===t}else return!0}runNext(t){var r;const n=su(t);if(typeof n=="string"){const a=(r=L(this,cr).get(n))==null?void 0:r.find(i=>
41i!==t&&i.state.isPaused);return(a==null?void 0:a.continue())??Promise.resolve()}else return Promise.resolve()}clear(){qt.batch(()=>{L(this,Xr).forEach(t=>{this.notify({type:"removed",mutation:t})}),L(this,Xr).clear(),L(this,cr).clear()})}getAll(){return Array.from(L(this,Xr))}find(t){const n={exact:!0,...t};return this.getAll().find(r=>$g(n,r))}findAll(t={}){return this.getAll().filter(n=>$g(t,n))}notify(t){qt.batch(()=>{this.listeners.forEach(n=>{n(t)})})}resumePausedMutations(){const t=this.getAll().filter(n=>n.state.isPaused);return qt.batch(()=>Promise.all(t.map(n=>n.continue().catch(yn))))}},Xr=new WeakMap,cr=new WeakMap,dc=new WeakMap,Xy);function su(e){var t;return(t=e.options.scope)==null?void 0:t.id}function pd(e){return{onFetch:(t,n)=>{var u,f,m,p,v;const r=t.options,a=(m=(f=(u=t.fetchOptions)==null?void 0:u.meta)==null?void 0:f.fetchMore)==null?void 0:m.direction,i=((p=t.state.data)==null?void 0:p.pages)||[],o=((v=t.state.data)==null?void 0:v.pageParams)||[];let l={pages:[],pageParams:[]},c=0;const d=async()=>{let g=!1;const y=w=>{Object.defineProperty(w,"signal",{enumerable:!0,get:()=>(t.signal.aborted?g=!0:t.signal.addEventListener("abort",()=>{g=!0}),t.signal)})},b=y1(t.options,t.fetchOptions),x=async(w,_,j)=>{if(g)return Promise.reject();if(_==null&&w.pages.length)return Promise.resolve(w);const k=(()=>{const O={client:t.client,queryKey:t.queryKey,pageParam:_,direction:j?"backward":"forward",meta:t.options.meta};return y(O),O})(),C=await b(k),{maxPages:A}=t.options,I=j?G2:H2;return{pages:I(w.pages,C,A),pageParams:I(w.pageParams,_,A)}};if(a&&i.length){const w=a==="backward",_=w?C1:Dm,j={pages:i,pageParams:o},N=_(r,j);l=await x(j,N,w)}else{const w=e??i.length;do{const _=c===0?o[0]??r.initialPageParam:Dm(r,l);if(c>0&&_==null)break;l=await x(l,_),c++}while(c<w)}return l};t.options.persister?t.fetchFn=()=>{var g,y;return(y=(g=t.options).persister)==null?void 0:y.call(g,d,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n)}:t.fetchFn=d}}}function Dm(e,{pages:t,pageParams:n}){const r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function C1(e,{pages:t,pageParams:n}){var r;return t.length>0?(r=e.getPreviousPageParam)==null?void 0:r.call(e,t[0],t,n[0],n):void 0}function sC(e,t){return t?Dm(e,t)!=null:!1}function aC(e,t){return!t||!e.getPreviousPageParam?!1:C1(e,t)!=null}var Et,Os,Ds,Zi,eo,Ls,to,no,Zy,iC=(Zy=class{constructor(e={}){Ae(this,Et);Ae(this,Os);Ae(this,Ds);Ae(this,Zi);Ae(this,eo);Ae(this,Ls);Ae(this,to);Ae(this,no);we(this,Et,e.queryCache||new tC),we(this,Os,e.mutationCache||new rC),we(this,Ds,e.defaultOptions||{}),we(this,Zi,new Map),we(this,eo,new Map),we(this,Ls,0)}mount(){Uc(this,Ls)._++,L(this,Ls)===1&&(we(this,to,C0.subscribe(async e=>{e&&(await this.resumePausedMutations(),L(this,Et).onFocus())})),we(this,no,md.subscribe(async e=>{e&&(await this.resumePausedMutations(),L(this,Et).onOnline())})))}unmount(){var e,t;Uc(this,Ls)._--,L(this,Ls)===0&&((e=L(this,to))==null||e.call(this),we(this,to,void 0),(t=L(this,no))==null||t.call(this),we(this,no,void 0))}isFetching(e){return L(this,Et).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return L(this,Os).findAll({...e,status:"pending"}).length}getQueryData(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=L(this,Et).get(t.queryHash))==null?void 0:n.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),n=L(this,Et).build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(Zs(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return L(this,Et).findAll(e).map(({queryKey:t,state:n})=>{const r=n.data;return[t,r]})}setQueryData(e,t,n){const r=this.defaultQueryOptions({queryKey:e}),a=L(this,Et).get(r.queryHash),i=a==null?void 0:a.state.data,o=V2(t,i);if(o!==void 0)return L(this,Et).build(this,r).setData(o,{...n,manual:!0})}setQueriesData(e,t,n){return qt.batch(()=>L(this,Et).findAll(e).map(({queryKey:r})=>[r,this.setQueryData(r,t,n)]))}getQueryState(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=L(this,Et).get(t.queryHash))==null?void 0:n.state}removeQueries(e){const t=L(this,Et);qt.batch(()=>
41{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=L(this,Et);return qt.batch(()=>(n.findAll(e).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const n={revert:!0,...t},r=qt.batch(()=>L(this,Et).findAll(e).map(a=>a.cancel(n)));return Promise.all(r).then(yn).catch(yn)}invalidateQueries(e,t={}){return qt.batch(()=>(L(this,Et).findAll(e).forEach(n=>{n.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 n={...t,cancelRefetch:t.cancelRefetch??!0},r=qt.batch(()=>L(this,Et).findAll(e).filter(a=>!a.isDisabled()&&!a.isStatic()).map(a=>{let i=a.fetch(void 0,n);return n.throwOnError||(i=i.catch(yn)),a.state.fetchStatus==="paused"?Promise.resolve():i}));return Promise.all(r).then(yn)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=L(this,Et).build(this,t);return n.isStaleByTime(Zs(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(yn).catch(yn)}fetchInfiniteQuery(e){return e.behavior=pd(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(yn).catch(yn)}ensureInfiniteQueryData(e){return e.behavior=pd(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return md.isOnline()?L(this,Os).resumePausedMutations():Promise.resolve()}getQueryCache(){return L(this,Et)}getMutationCache(){return L(this,Os)}getDefaultOptions(){return L(this,Ds)}setDefaultOptions(e){we(this,Ds,e)}setQueryDefaults(e,t){L(this,Zi).set(Ya(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...L(this,Zi).values()],n={};return t.forEach(r=>{Wl(e,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(e,t){L(this,eo).set(Ya(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...L(this,eo).values()],n={};return t.forEach(r=>{Wl(e,r.mutationKey)&&Object.assign(n,r.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={...L(this,Ds).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=k0(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===S0&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...L(this,Ds).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){L(this,Et).clear(),L(this,Os).clear()}},Et=new WeakMap,Os=new WeakMap,Ds=new WeakMap,Zi=new WeakMap,eo=new WeakMap,Ls=new WeakMap,to=new WeakMap,no=new WeakMap,Zy),jn,Ye,hc,gn,Ma,ro,Ms,$s,fc,so,ao,$a,Fa,Fs,io,at,ll,Lm,Mm,$m,Fm,Um,Bm,zm,P1,ev,E1=(ev=class extends _o{constructor(t,n){super();Ae(this,at);Ae(this,jn);Ae(this,Ye);Ae(this,hc);Ae(this,gn);Ae(this,Ma);Ae(this,ro);Ae(this,Ms);Ae(this,$s);Ae(this,fc);Ae(this,so);Ae(this,ao);Ae(this,$a);Ae(this,Fa);Ae(this,Fs);Ae(this,io,new Set);this.options=n,we(this,jn,t),we(this,$s,null),we(this,Ms,Om()),this.options.experimental_prefetchInRender||L(this,Ms).reject(new Error("experimental_prefetchInRender feature flag is not enabled")),this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(L(this,Ye).addObserver(this),Bg(L(this,Ye),this.options)?qe(this,at,ll).call(this):this.updateResult(),qe(this,at,Fm).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return qm(L(this,Ye),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return qm(L(this,Ye),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,qe(this,at,Um).call(this),qe(this,at,Bm).call(this),L(this,Ye).removeObserver(this)}setOptions(t){const n=this.options,r=L(this,Ye);if(this.options=L(this,jn).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Gn(this.options.enabled,L(this,Ye))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");qe(this,at,zm).call(this),L(this,Ye).setOptions(this.options),n._defaulted&&!fd(this.options,n)&&L(this,jn).getQueryCache().notify({type:"observerOptionsUpdated",query:L(this,Ye),observer:this});const a=this.hasListeners();a&&zg(L(this,Ye),r,this.options,n)&&qe(this,at,ll).call(this),this.updateResult(),a&&(L(this,Ye)!==r||Gn(this.options.enabled,L(this,Ye))!==Gn(n.enabled,L(this,Ye))||Zs(this.options.staleTime,L(this,Ye))!==Zs(n.staleTime,L(this,Ye)))&&qe(this,at,Lm).call(this);const i=qe(this,at,Mm).call(this);a&&(L(this,Ye)!==r||Gn(this.options.enabled,L(this,Ye))!==Gn(n.enabled,L(this,Ye))||i!==L(this,Fs))&&qe(this,at,$m).call(this,i)}getOptimisticResult(t){const n=L(this,jn).getQueryCache().build(L(this,jn),t),r=this.createResult(n,t);return lC(this,r)&&(we(this,gn,r),we(this,ro,this.options),we(this,Ma,L(this,Ye).state)),r}getCurrentResult(){return L(this,gn)}trackResult(t,n){return new Proxy(t,{get:(r,a)=>(this.trackProp(a),n==null||n(a),Reflect.get(r,a))})}trackProp(t){L(this,io).add(t)}getCurrentQuery(){return L(this,Ye)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const n=L(this,jn).defaultQueryOptions(t),r=L(this,jn).getQueryCache().build(L(this,jn),n);return r.fetch().then(()=>this.createResult(r,n))}fetch(t){return qe(this,at,ll).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),L(this,gn)))}createResult(t,n){var A;const r=L(this,Ye),a=this.options,i=L(this,gn),o=L(this,Ma),l=L(this,ro),d=t!==r?t.state:L(this,hc),{state:u}=t;let f={...u},m=!1,p;if(n._optimisticResults){const I=this.hasListeners(),O=!I&&Bg(t,n),P=I&&zg(t,r,n,a);(O||P)&&(f={...f,...k1(u.data,t.options)}),n._optimisticResults==="isRestoring"&&(f.fetchStatus="idle")}let{error:v,errorUpdatedAt:g,status:y}=f;p=f.data;let b=!1;if(n.placeholderData!==void 0&&p===void 0&&y==="pending"){let I;i!=null&&i.isPlaceholderData&&n.placeholderData===(l==null?void 0:l.placeholderData)?(I=i.data,b=!0):I=typeof n.placeholderData=="function"?n.placeholderData((A=L(this,ao))==null?void 0:A.state.data,L(this,ao)):n.placeholderData,I!==void 0&&(y="success",p=Im(i==null?void 0:i.data,I,n),m=!0)}if(n.select&&p!==void 0&&!b)if(i&&p===(o==null?void 0:o.data)&&n.select===L(this,fc))p=L(this,so);else try{we(this,fc,n.select),p=n.select(p),p=Im(i==null?void 0:i.data,p,n),we(this,so,p),we(this,$s,null)}catch(I){we(this,$s,I)}L(this,$s)&&(v=L(this,$s),p=L(this,so),g=Date.now(),y="error");const x=f.fetchStatus==="fetching",w=y==="pending",_=y==="error",j=w&&x,N=p!==void 0,C={status:y,fetchStatus:f.fetchStatus,isPending:w,isSuccess:y==="success",isError:_,isInitialLoading:j,isLoading:j,data:p,dataUpdatedAt:f.dataUpdatedAt,error:v,errorUpdatedAt:g,failureCount:f.fetchFailureCount,failureReason:f.fetchFailureReason,errorUpdate
41Count:f.errorUpdateCount,isFetched:f.dataUpdateCount>0||f.errorUpdateCount>0,isFetchedAfterMount:f.dataUpdateCount>d.dataUpdateCount||f.errorUpdateCount>d.errorUpdateCount,isFetching:x,isRefetching:x&&!w,isLoadingError:_&&!N,isPaused:f.fetchStatus==="paused",isPlaceholderData:m,isRefetchError:_&&N,isStale:E0(t,n),refetch:this.refetch,promise:L(this,Ms),isEnabled:Gn(n.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const I=T=>{C.status==="error"?T.reject(C.error):C.data!==void 0&&T.resolve(C.data)},O=()=>{const T=we(this,Ms,C.promise=Om());I(T)},P=L(this,Ms);switch(P.status){case"pending":t.queryHash===r.queryHash&&I(P);break;case"fulfilled":(C.status==="error"||C.data!==P.value)&&O();break;case"rejected":(C.status!=="error"||C.error!==P.reason)&&O();break}}return C}updateResult(){const t=L(this,gn),n=this.createResult(L(this,Ye),this.options);if(we(this,Ma,L(this,Ye).state),we(this,ro,this.options),L(this,Ma).data!==void 0&&we(this,ao,L(this,Ye)),fd(n,t))return;we(this,gn,n);const r=()=>{if(!t)return!0;const{notifyOnChangeProps:a}=this.options,i=typeof a=="function"?a():a;if(i==="all"||!i&&!L(this,io).size)return!0;const o=new Set(i??L(this,io));return this.options.throwOnError&&o.add("error"),Object.keys(L(this,gn)).some(l=>{const c=l;return L(this,gn)[c]!==t[c]&&o.has(c)})};qe(this,at,P1).call(this,{listeners:r()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&qe(this,at,Fm).call(this)}},jn=new WeakMap,Ye=new WeakMap,hc=new WeakMap,gn=new WeakMap,Ma=new WeakMap,ro=new WeakMap,Ms=new WeakMap,$s=new WeakMap,fc=new WeakMap,so=new WeakMap,ao=new WeakMap,$a=new WeakMap,Fa=new WeakMap,Fs=new WeakMap,io=new WeakMap,at=new WeakSet,ll=function(t){qe(this,at,zm).call(this);let n=L(this,Ye).fetch(this.options,t);return t!=null&&t.throwOnError||(n=n.catch(yn)),n},Lm=function(){qe(this,at,Um).call(this);const t=Zs(this.options.staleTime,L(this,Ye));if(Ka||L(this,gn).isStale||!Rm(t))return;const r=g1(L(this,gn).dataUpdatedAt,t)+1;we(this,$a,setTimeout(()=>{L(this,gn).isStale||this.updateResult()},r))},Mm=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(L(this,Ye)):this.options.refetchInterval)??!1},$m=function(t){qe(this,at,Bm).call(this),we(this,Fs,t),!(Ka||Gn(this.options.enabled,L(this,Ye))===!1||!Rm(L(this,Fs))||L(this,Fs)===0)&&we(this,Fa,setInterval(()=>{(this.options.refetchIntervalInBackground||C0.isFocused())&&qe(this,at,ll).call(this)},L(this,Fs)))},Fm=function(){qe(this,at,Lm).call(this),qe(this,at,$m).call(this,qe(this,at,Mm).call(this))},Um=function(){L(this,$a)&&(clearTimeout(L(this,$a)),we(this,$a,void 0))},Bm=function(){L(this,Fa)&&(clearInterval(L(this,Fa)),we(this,Fa,void 0))},zm=function(){const t=L(this,jn).getQueryCache().build(L(this,jn),this.options);if(t===L(this,Ye))return;const n=L(this,Ye);we(this,Ye,t),we(this,hc,t.state),this.hasListeners()&&(n==null||n.removeObserver(this),t.addObserver(this))},P1=function(t){qt.batch(()=>{t.listeners&&this.listeners.forEach(n=>{n(L(this,gn))}),L(this,jn).getQueryCache().notify({query:L(this,Ye),type:"observerResultsUpdated"})})},ev);function oC(e,t){return Gn(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function Bg(e,t){return oC(e,t)||e.state.data!==void 0&&qm(e,t,t.refetchOnMount)}function qm(e,t,n){if(Gn(t.enabled,e)!==!1&&Zs(t.staleTime,e)!=="static"){const r=typeof n=="function"?n(e):n;return r==="always"||r!==!1&&E0(e,t)}return!1}function zg(e,t,n,r){return(e!==t||Gn(r.enabled,e)===!1)&&(!n.suspense||e.state.status!=="error")&&E0(e,n)}function E0(e,t){return Gn(t.enabled,e)!==!1&&e.isStaleByTime(Zs(t.staleTime,e))}function lC(e,t){return!fd(e.getCurrentResult(),t)}var cC=class extends E1{constructor(e,t){super(e,t)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){super.setOptions({...e,behavior:pd()})}getOptimisticResult(e){return e.behavior=pd(),super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"forward"}}})}
41fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"backward"}}})}createResult(e,t){var v,g;const{state:n}=e,r=super.createResult(e,t),{isFetching:a,isRefetching:i,isError:o,isRefetchError:l}=r,c=(g=(v=n.fetchMeta)==null?void 0:v.fetchMore)==null?void 0:g.direction,d=o&&c==="forward",u=a&&c==="forward",f=o&&c==="backward",m=a&&c==="backward";return{...r,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:sC(t,n.data),hasPreviousPage:aC(t,n.data),isFetchNextPageError:d,isFetchingNextPage:u,isFetchPreviousPageError:f,isFetchingPreviousPage:m,isRefetchError:l&&!d&&!f,isRefetching:i&&!u&&!m}}},Us,Bs,Nn,Zr,rs,Lu,Vm,tv,uC=(tv=class extends _o{constructor(n,r){super();Ae(this,rs);Ae(this,Us);Ae(this,Bs);Ae(this,Nn);Ae(this,Zr);we(this,Us,n),this.setOptions(r),this.bindMethods(),qe(this,rs,Lu).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(n){var a;const r=this.options;this.options=L(this,Us).defaultMutationOptions(n),fd(this.options,r)||L(this,Us).getMutationCache().notify({type:"observerOptionsUpdated",mutation:L(this,Nn),observer:this}),r!=null&&r.mutationKey&&this.options.mutationKey&&Ya(r.mutationKey)!==Ya(this.options.mutationKey)?this.reset():((a=L(this,Nn))==null?void 0:a.state.status)==="pending"&&L(this,Nn).setOptions(this.options)}onUnsubscribe(){var n;this.hasListeners()||(n=L(this,Nn))==null||n.removeObserver(this)}onMutationUpdate(n){qe(this,rs,Lu).call(this),qe(this,rs,Vm).call(this,n)}getCurrentResult(){return L(this,Bs)}reset(){var n;(n=L(this,Nn))==null||n.removeObserver(this),we(this,Nn,void 0),qe(this,rs,Lu).call(this),qe(this,rs,Vm).call(this)}mutate(n,r){var a;return we(this,Zr,r),(a=L(this,Nn))==null||a.removeObserver(this),we(this,Nn,L(this,Us).getMutationCache().build(L(this,Us),this.options)),L(this,Nn).addObserver(this),L(this,Nn).execute(n)}},Us=new WeakMap,Bs=new WeakMap,Nn=new WeakMap,Zr=new WeakMap,rs=new WeakSet,Lu=function(){var r;const n=((r=L(this,Nn))==null?void 0:r.state)??S1();we(this,Bs,{...n,isPending:n.status==="pending",isSuccess:n.status==="success",isError:n.status==="error",isIdle:n.status==="idle",mutate:this.mutate,reset:this.reset})},Vm=function(n){qt.batch(()=>{var r,a,i,o,l,c,d,u;if(L(this,Zr)&&this.hasListeners()){const f=L(this,Bs).variables,m=L(this,Bs).context;(n==null?void 0:n.type)==="success"?((a=(r=L(this,Zr)).onSuccess)==null||a.call(r,n.data,f,m),(o=(i=L(this,Zr)).onSettled)==null||o.call(i,n.data,null,f,m)):(n==null?void 0:n.type)==="error"&&((c=(l=L(this,Zr)).onError)==null||c.call(l,n.error,f,m),(u=(d=L(this,Zr)).onSettled)==null||u.call(d,void 0,n.error,f,m))}this.listeners.forEach(f=>{f(L(this,Bs))})})},tv),T1=h.createContext(void 0),wt=e=>{const t=h.useContext(T1);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},dC=({client:e,children:t})=>(h.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),s.jsx(T1.Provider,{value:e,children:t})),R1=h.createContext(!1),hC=()=>h.useContext(R1);R1.Provider;function fC(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var mC=h.createContext(fC()),pC=()=>h.useContext(mC),xC=(e,t)=>{(e.suspense||e.throwOnError||e.experimental_prefetchInRender)&&(t.isReset()||(e.retryOnMount=!1))},gC=e=>{h.useEffect(()=>{e.clearReset()},[e])},bC=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:a})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(a&&e.data===void 0||v1(n,[e.error,r])),yC=e=>{if(e.suspense){const t=r=>r==="static"?r:Math.max(r??1e3,1e3),n=e.staleTime;e.staleTime=typeof n=="function"?(...r)=>t(n(...r)):t(n),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},vC=(e,t)=>e.isLoading&&e.isFetching&&!t,wC=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,qg=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function A1(e,t,n){var f,m,p,v,g;const r=hC(),a=pC(),i=wt(),o=i.defaultQueryOptions(e);(m=(f=i.getDefaultOptions().queries)==null?void 0:f._experimental_beforeQuery)==null||m.call(f,o),o._optimisticResults=r?"isRestoring":"optimistic",yC(o),xC(o,a),gC(a);const l=!i.getQueryCache().get(o.queryHash),[c]=h.useState(()=>new t(i,o)),d=c.getOptimisticResult(o),u=!r&&e.subscribed!==!1;if(h.useSyncExternalStore(h.useCallback(y=>{const b=u?c.subscribe(qt.batchCalls(y)):yn;return c.updateResult(),b},[c,u]),()=>c.getCurrentResult(),()=>c.getCurrentResult()),h.useEffect(()=>{c.setOptions(o)},[o,c]),wC(o,d))throw qg(o,c,a);if(bC({result:d,errorResetBoundary:a,throwOnError:o.throwOnError,query:i.getQueryCache().get(o.queryHash),suspense:o.suspense}))throw d.error;if((v=(p=i.getDefaultOptions().queries)==null?void 0:p._experimental_afterQuery)==null||v.call(p,o,d),o.experimental_prefetchInRender&&!Ka&&vC(d,r)){const y=l?qg(o,c,a):(g=i.getQueryCache().get(o.queryHash))==null?void 0:g.promise;y==null||y.catch(yn).finally(()=>{c.updateResult()})}return o.notifyOnChangeProps?d:c.trackResult(d)}function he(e,t){return A1(e,E1)}function ps(e,t){const n=wt(),[r]=h.useState(()=>new uC(n,e));h.useEffect(()=>{r.setOptions(e)},[r,e]);const a=h.useSyncExternalStore(h.useCallback(o=>r.subscribe(qt.batchCalls(o)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),i=h.useCallback((o,l)=>{r.mutate(o,l).catch(yn)},[r]);if(a.error&&v1(r.options.throwOnError,[a.error]))throw a.error;return{...a,mutate:i,mutateAsync:a.mutate}}function _C(e,t){return A1(e,cC)}/**
42 * @remix-run/router v1.23.0
43 *
44 * Copyright (c) Remix Software Inc.
45 *
46 * This source code is licensed under the MIT license found in the
47 * LICENSE.md file in the root directory of this source tree.
48 *
49 * @license MIT
50 */function Hl(){return Hl=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Hl.apply(this,arguments)}var Vs;(function(e){e.Pop="POP",e.Push="PUSH",e.Replace="REPLACE"})(Vs||(Vs={}));const Vg="popstate";function jC(e){e===void 0&&(e={});function t(r,a){let{pathname:i,search:o,hash:l}=r.location;return Wm("",{pathname:i,search:o,hash:l},a.state&&a.state.usr||null,a.state&&a.state.key||"default")}
vendor: 4,427 bytes, line 50
50function n(r,a){return typeof a=="string"?a:xd(a)}return kC(t,n,null,e)}function Ot(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function I1(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function NC(){return Math.random().toString(36).substr(2,8)}function Wg(e,t){return{usr:e.state,key:e.key,idx:t}}function Wm(e,t,n,r){return n===void 0&&(n=null),Hl({pathname:typeof e=="string"?e:e.pathname,search:"",hash:""},typeof t=="string"?jo(t):t,{state:n,key:t&&t.key||r||NC()})}function xd(e){let{pathname:t="/",search:n="",hash:r=""}=e;return n&&n!=="?"&&(t+=n.charAt(0)==="?"?n:"?"+n),r&&r!=="#"&&(t+=r.charAt(0)==="#"?r:"#"+r),t}function jo(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substr(n),e=e.substr(0,n));let r=e.indexOf("?");r>=0&&(t.search=e.substr(r),e=e.substr(0,r)),e&&(t.pathname=e)}return t}function kC(e,t,n,r){r===void 0&&(r={});let{window:a=document.defaultView,v5Compat:i=!1}=r,o=a.history,l=Vs.Pop,c=null,d=u();d==null&&(d=0,o.replaceState(Hl({},o.state,{idx:d}),""));function u(){return(o.state||{idx:null}).idx}function f(){l=Vs.Pop;let y=u(),b=y==null?null:y-d;d=y,c&&c({action:l,location:g.location,delta:b})}function m(y,b){l=Vs.Push;let x=Wm(g.location,y,b);d=u()+1;let w=Wg(x,d),_=g.createHref(x);try{o.pushState(w,"",_)}catch(j){if(j instanceof DOMException&&j.name==="DataCloneError")throw j;a.location.assign(_)}i&&c&&c({action:l,location:g.location,delta:1})}function p(y,b){l=Vs.Replace;let x=Wm(g.location,y,b);d=u();let w=Wg(x,d),_=g.createHref(x);o.replaceState(w,"",_),i&&c&&c({action:l,location:g.location,delta:0})}function v(y){let b=a.location.origin!=="null"?a.location.origin:a.location.href,x=typeof y=="string"?y:xd(y);return x=x.replace(/ $/,"%20"),Ot(b,"No window.location.(origin|href) available to create URL for href: "+x),new URL(x,b)}let g={get action(){return l},get location(){return e(a,o)},listen(y){if(c)throw new Error("A history only accepts one active listener");return a.addEventListener(Vg,f),c=y,()=>{a.removeEventListener(Vg,f),c=null}},createHref(y){return t(a,y)},createURL:v,encodeLocation(y){let b=v(y);return{pathname:b.pathname,search:b.search,hash:b.hash}},push:m,replace:p,go(y){return o.go(y)}};return g}var Hg;(function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"})(Hg||(Hg={}));function SC(e,t,n){return n===void 0&&(n="/"),CC(e,t,n,!1)}function CC(e,t,n,r){let a=typeof t=="string"?jo(t):t,i=P0(a.pathname||"/",n);if(i==null)return null;let o=O1(e);EC(o);let l=null;for(let c=0;l==null&&c<o.length;++c){let d=FC(i);l=MC(o[c],d,r)}return l}function O1(e,t,n,r){t===void 0&&(t=[]),n===void 0&&(n=[]),r===void 0&&(r="");let a=(i,o,l)=>{let c={relativePath:l===void 0?i.path||"":l,caseSensitive:i.caseSensitive===!0,childrenIndex:o,route:i};c.relativePath.startsWith("/")&&(Ot(c.relativePath.startsWith(r),'Absolute route path "'+c.relativePath+'" nested under path '+('"'+r+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),c.relativePath=c.relativePath.slice(r.length));let d=ea([r,c.relativePath]),u=n.concat(c);i.children&&i.children.length>0&&(Ot(i.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+d+'".')),O1(i.children,t,u,d)),!(i.path==null&&!i.index)&&t.push({path:d,score:DC(d,i.index),routesMeta:u})};return e.forEach((i,o)=>{var l;if(i.path===""||!((l=i.path)!=null&&l.includes("?")))a(i,o);else for(let c of D1(i.path))a(i,o,c)}),t}function D1(e){let t=e.split("/");if(t.length===0)return[];let[n,...r]=t,a=n.endsWith("?"),i=n.replace(/\?$/,"");if(r.length===0)return a?[i,""]:[i];let o=D1(r.join("/")),l=[];return l.push(...o.map(c=>c===""?i:[i,c].join("/"))),a&&l.push(...o),l.map(c=>e.startsWith("/")&&c===""?"/":c)}function EC(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:LC(t.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}const PC=/^:[\w-]+$/,TC=3,RC=2,AC=1,IC=10,OC=-2,Gg=e=>e==="*";function DC(e,t){let n=e.split("/"),r=n.length;return n.some(Gg)&&(r+=OC),t&&(r+=RC),n.filter(a=>!Gg(a)).reduce((a,i)=>a+(PC.test(i)?TC:i===""?AC:IC),r)}function LC(e,t){return e.length===t.length&&e.slice(0,-1).every((r,a)=>r===t[a])?e[e.length-1]-t[t.length-1]:0}function MC(e,t,n){let{routesMeta:r}=e,a={},i="/",o=[];for(let l=0;l<r.length;++l){let c=r[l],d=l===r.length-1,u=i==="/"?t:t.slice(i.length)||"/",f
vendor: 9,822 bytes, lines 50-59
50=Kg({path:c.relativePath,caseSensitive:c.caseSensitive,end:d},u),m=c.route;if(!f&&d&&n&&!r[r.length-1].route.index&&(f=Kg({path:c.relativePath,caseSensitive:c.caseSensitive,end:!1},u)),!f)return null;Object.assign(a,f.params),o.push({params:a,pathname:ea([i,f.pathname]),pathnameBase:qC(ea([i,f.pathnameBase])),route:m}),f.pathnameBase!=="/"&&(i=ea([i,f.pathnameBase]))}return o}function Kg(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=$C(e.path,e.caseSensitive,e.end),a=t.match(n);if(!a)return null;let i=a[0],o=i.replace(/(.)\/+$/,"$1"),l=a.slice(1);return{params:r.reduce((d,u,f)=>{let{paramName:m,isOptional:p}=u;if(m==="*"){let g=l[f]||"";o=i.slice(0,i.length-g.length).replace(/(.)\/+$/,"$1")}const v=l[f];return p&&!v?d[m]=void 0:d[m]=(v||"").replace(/%2F/g,"/"),d},{}),pathname:i,pathnameBase:o,pattern:e}}function $C(e,t,n){t===void 0&&(t=!1),n===void 0&&(n=!0),I1(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 r=[],a="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(o,l,c)=>(r.push({paramName:l,isOptional:c!=null}),c?"/?([^\\/]+)?":"/([^\\/]+)"));return e.endsWith("*")?(r.push({paramName:"*"}),a+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?a+="\\/*$":e!==""&&e!=="/"&&(a+="(?:(?=\\/|$))"),[new RegExp(a,t?void 0:"i"),r]}function FC(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return I1(!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 P0(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,r=e.charAt(n);return r&&r!=="/"?null:e.slice(n)||"/"}function UC(e,t){t===void 0&&(t="/");let{pathname:n,search:r="",hash:a=""}=typeof e=="string"?jo(e):e;return{pathname:n?n.startsWith("/")?n:BC(n,t):t,search:VC(r),hash:WC(a)}}function BC(e,t){let n=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(a=>{a===".."?n.length>1&&n.pop():a!=="."&&n.push(a)}),n.length>1?n.join("/"):"/"}function rf(e,t,n,r){return"Cannot include a '"+e+"' character in a manually specified "+("`to."+t+"` field ["+JSON.stringify(r)+"].  Please separate it out to the ")+("`to."+n+"` field. Alternatively you may provide the full path as ")+'a string in <Link to="..."> and the router will parse it for you.'}function zC(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function T0(e,t){let n=zC(e);return t?n.map((r,a)=>a===n.length-1?r.pathname:r.pathnameBase):n.map(r=>r.pathnameBase)}function R0(e,t,n,r){r===void 0&&(r=!1);let a;typeof e=="string"?a=jo(e):(a=Hl({},e),Ot(!a.pathname||!a.pathname.includes("?"),rf("?","pathname","search",a)),Ot(!a.pathname||!a.pathname.includes("#"),rf("#","pathname","hash",a)),Ot(!a.search||!a.search.includes("#"),rf("#","search","hash",a)));let i=e===""||a.pathname==="",o=i?"/":a.pathname,l;if(o==null)l=n;else{let f=t.length-1;if(!r&&o.startsWith("..")){let m=o.split("/");for(;m[0]==="..";)m.shift(),f-=1;a.pathname=m.join("/")}l=f>=0?t[f]:"/"}let c=UC(a,l),d=o&&o!=="/"&&o.endsWith("/"),u=(i||o===".")&&n.endsWith("/");return!c.pathname.endsWith("/")&&(d||u)&&(c.pathname+="/"),c}const ea=e=>e.join("/").replace(/\/\/+/g,"/"),qC=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),VC=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,WC=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;function HC(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}const L1=["post","put","patch","delete"];new Set(L1);const GC=["get",...L1];new Set(GC);/**
51 * React Router v6.30.1
52 *
53 * Copyright (c) Remix Software Inc.
54 *
55 * This source code is licensed under the MIT license found in the
56 * LICENSE.md file in the root directory of this source tree.
57 *
58 * @license MIT
59 */function Gl(){return Gl=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Gl.apply(this,arguments)}const A0=h.createContext(null),KC=h.createContext(null),ca=h.createContext(null),Gd=h.createContext(null),zr=h.createContext({outlet:null,matches:[],isDataRoute:!1}),M1=h.createContext(null);function YC(e,t){let{relative:n}=t===void 0?{}:t;No()||Ot(!1);let{basename:r,navigator:a}=h.useContext(ca),{hash:i,pathname:o,search:l}=F1(e,{relative:n}),c=o;return r!=="/"&&(c=o==="/"?r:ea([r,o])),a.createHref({pathname:c,search:l,hash:i})}function No(){return h.useContext(Gd)!=null}function ni(){return No()||Ot(!1),h.useContext(Gd).location}function $1(e){h.useContext(ca).static||h.useLayoutEffect(e)}function sn(){let{isDataRoute:e}=h.useContext(zr);return e?uE():QC()}function QC(){No()||Ot(!1);let e=h.useContext(A0),{basename:t,future:n,navigator:r}=h.useContext(ca),{matches:a}=h.useContext(zr),{pathname:i}=ni(),o=JSON.stringify(T0(a,n.v7_relativeSplatPath)),l=h.useRef(!1);return $1(()=>{l.current=!0}),h.useCallback(function(d,u){if(u===void 0&&(u={}),!l.current)return;if(typeof d=="number"){r.go(d);return}let f=R0(d,JSON.parse(o),i,u.relative==="path");e==null&&t!=="/"&&(f.pathname=f.pathname==="/"?t:ea([t,f.pathname])),(u.replace?r.replace:r.push)(f,u.state,u)},[t,r,o,i,e])}const JC=h.createContext(null);function XC(e){let t=h.useContext(zr).outlet;return t&&h.createElement(JC.Provider,{value:e},t)}function J8(){let{matches:e}=h.useContext(zr),t=e[e.length-1];return t?t.params:{}}function F1(e,t){let{relative:n}=t===void 0?{}:t,{future:r}=h.useContext(ca),{matches:a}=h.useContext(zr),{pathname:i}=ni(),o=JSON.stringify(T0(a,r.v7_relativeSplatPath));return h.useMemo(()=>R0(e,JSON.parse(o),i,n==="path"),[e,o,i,n])}function ZC(e,t){return eE(e,t)}function eE(e,t,n,r){No()||Ot(!1);let{navigator:a}=h.useContext(ca),{matches:i}=h.useContext(zr),o=i[i.length-1],l=o?o.params:{};o&&o.pathname;let c=o?o.pathnameBase:"/";o&&o.route;let d=ni(),u;if(t){var f;let y=typeof t=="string"?jo(t):t;c==="/"||(f=y.pathname)!=null&&f.startsWith(c)||Ot(!1),u=y}else u=d;let m=u.pathname||"/",p=m;if(c!=="/"){let y=c.replace(/^\//,"").split("/");p="/"+m.replace(/^\//,"").split("/").slice(y.length).join("/")}let v=SC(e,{pathname:p}),g=aE(v&&v.map(y=>Object.assign({},y,{params:Object.assign({},l,y.params),pathname:ea([c,a.encodeLocation?a.encodeLocation(y.pathname).pathname:y.pathname]),pathnameBase:y.pathnameBase==="/"?c:ea([c,a.encodeLocation?a.encodeLocation(y.pathnameBase).pathname:y.pathnameBase])})),i,n,r);return t&&g?h.createElement(Gd.Provider,{value:{location:Gl({pathname:"/",search:"",hash:"",state:null,key:"default"},u),navigationType:Vs.Pop}},g):g}function tE(){let e=cE(),t=HC(e)?e.status+" "+e.statusText:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,a={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return h.createElement(h.Fragment,null,h.createElement("h2",null,"Unexpected Application Error!"),h.createElement("h3",{style:{fontStyle:"italic"}},t),n?h.createElement("pre",{style:a},n):null,null)}const nE=h.createElement(tE,null);class rE extends h.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,n){return n.location!==t.location||n.revalidation!=="idle"&&t.revalidation==="idle"?{error:t.error,location:t.location,revalidation:t.revalidation}:{error:t.error!==void 0?t.error:n.error,location:n.location,revalidation:t.revalidation||n.revalidation}}componentDidCatch(t,n){console.error("React Router caught the following error during render",t,n)}render(){return this.state.error!==void 0?h.createElement(zr.Provider,{value:this.props.routeContext},h.createElement(M1.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function sE(e){let{routeContext:t,match:n,children:r}=e,a=h.useContext(A0);return a&&a.static&&a.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(a.staticContext._deepestRenderedBoundaryId=n.route.id),h.createElement(zr.Provider,{value:t},r)}function aE(e,t,n,r){var a;if(t===void 0&&(t=[]),n===void 0&&(n=null),r===void 0&&(r=null),e==null){var i;if(!n)return null;if(n.errors)e=n.matches;else if((i=r)!=null&&i.v7_partialHydration&&t.length===0&&!n.initialized&&n.matches.length>0)e=n.matches;else return null}let o=e,l=(a=n)==null?void 0:a.errors;if(l!=null){let u=o.findIndex(f=>f.route.id&&(l==null?void 0:l[f.route.id])!==void 0);u>=0||Ot(!1),o=o.slice(0,Math.min(o.length,u+1))}let c=!1,d=-1;if(n&&r&&r.v7_partialHydration)for(let u=0;u<o.length;u++){let f=o[u];if((f.route.HydrateFallback||f.route.hydrateFallbackElement)&&(d=u),f.route.id){let{loaderData:m,errors:p}=n,v=f.route.loader&&m[f.route.id]===void 0&&(!p||p[f.route.id]===void 0);if(f.route.lazy||v){c=!0,d>=0?o=o.slice(0,d+1):o=[o[0]];break}}}return o.reduceRight((u,f,m)=>{let p,v=!1,g=null,y=null;n&&(p=l&&f.route.id?l[f.route.id]:void 0,g=f.route.errorElement||nE,c&&(d<0&&m===0?(v=!0,y=null):d===m&&(v=!0,y=f.route.hydrateFallbackElement||null)));let b=t.concat(o.slice(0,m+1)),x=()=>{let w;return p?w=g:v?w=y:f.route.Component?w=h.createElement(f.route.Component,null):f.route.element?w=f.route.element:w=u,h.createElement(sE,{match:f,routeContext:{outlet:u,matches:b,isDataRoute:n!=null},children:w})};return n&&(f.route.ErrorBoundary||f.route.errorElement||m===0)?h.createElement(rE,{location:n.location,revalidation:n.revalidation,component:g,error:p,children:x(),routeC
59ontext:{outlet:null,matches:b,isDataRoute:!0}}):x()},null)}var U1=function(e){return e.UseBlocker="useBlocker",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e}(U1||{}),gd=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}(gd||{});function iE(e){let t=h.useContext(A0);return t||Ot(!1),t}function oE(e){let t=h.useContext(KC);return t||Ot(!1),t}function lE(e){let t=h.useContext(zr);return t||Ot(!1),t}function B1(e){let t=lE(),n=t.matches[t.matches.length-1];return n.route.id||Ot(!1),n.route.id}function cE(){var e;let t=h.useContext(M1),n=oE(gd.UseRouteError),r=B1(gd.UseRouteError);return t!==void 0?t:(e=n.errors)==null?void 0:e[r]}function uE(){let{router:e}=iE(U1.UseNavigateStable),t=B1(gd.UseNavigateStable),n=h.useRef(!1);return $1(()=>{n.current=!0}),h.useCallback(function(a,i){i===void 0&&(i={}),n.current&&(typeof a=="number"?e.navigate(a):e.navigate(a,Gl({fromRouteId:t},i)))},[e,t])}function dE(e,t){e==null||e.v7_startTransition,e==null||e.v7_relativeSplatPath}function Hm(e){let{to:t,replace:n,state:r,relative:a}=e;No()||Ot(!1);let{future:i,static:o}=h.useContext(ca),{matches:l}=h.useContext(zr),{pathname:c}=ni(),d=sn(),u=R0(t,T0(l,i.v7_relativeSplatPath),c,a==="path"),f=JSON.stringify(u);return h.useEffect(()=>d(JSON.parse(f),{replace:n,state:r,relative:a}),[d,f,a,n,r]),null}function hE(e){return XC(e.context)}function X(e){Ot(!1)}function fE(e){let{basename:t="/",children:n=null,location:r,navigationType:a=Vs.Pop,navigator:i,static:o=!1,future:l}=e;No()&&Ot(!1);let c=t.replace(/^\/*/,"/"),d=h.useMemo(()=>({basename:c,navigator:i,static:o,future:Gl({v7_relativeSplatPath:!1},l)}),[c,l,i,o]);typeof r=="string"&&(r=jo(r));let{pathname:u="/",search:f="",hash:m="",state:p=null,key:v="default"}=r,g=h.useMemo(()=>{let y=P0(u,c);return y==null?null:{location:{pathname:y,search:f,hash:m,state:p,key:v},navigationType:a}},[c,u,f,m,p,v,a]);return g==null?null:h.createElement(ca.Provider,{value:d},h.createElement(Gd.Provider,{children:n,value:g}))}function mE(e){let{children:t,location:n}=e;return ZC(Gm(t),n)}new Promise(()=>{});function Gm(e,t){t===void 0&&(t=[]);let n=[];return h.Children.forEach(e,(r,a)=>{if(!h.isValidElement(r))return;let i=[...t,a];if(r.type===h.Fragment){n.push.apply(n,Gm(r.props.children,i));return}r.type!==X&&Ot(!1),!r.props.index||!r.props.children||Ot(!1);let o={id:r.props.id||i.join("-"),caseSensitive:r.props.caseSensitive,element:r.props.element,Component:r.props.Component,index:r.props.index,path:r.props.path,loader:r.props.loader,action:r.props.action,errorElement:r.props.errorElement,ErrorBoundary:r.props.ErrorBoundary,hasErrorBoundary:r.props.ErrorBoundary!=null||r.props.errorElement!=null,shouldRevalidate:r.props.shouldRevalidate,handle:r.props.handle,lazy:r.props.lazy};r.props.children&&(o.children=Gm(r.props.children,i)),n.push(o)}),n}/**
60 * React Router DOM v6.30.1
61 *
62 * Copyright (c) Remix Software Inc.
63 *
64 * This source code is licensed under the MIT license found in the
65 * LICENSE.md file in the root directory of this source tree.
66 *
67 * @license MIT
68 */function Km(){return Km=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Km.apply(this,arguments)}function pE(e,t){if(e==null)return{};var n={},r=Object.keys(e),a,i;for(i=0;i<r.length;i++)a=r[i],!(t.indexOf(a)>=0)&&(n[a]=e[a]);return n}function xE(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function gE(e,t){return e.button===0&&(!t||t==="_self")&&!xE(e)}function Ym(e){return e===void 0&&(e=""),new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,n)=>{let r=e[n];return t.concat(Array.isArray(r)?r.map(a=>[n,a]):[[n,r]])},[]))}function bE(e,t){let n=Ym(e);return t&&t.forEach((r,a)=>
68{n.has(a)||t.getAll(a).forEach(i=>{n.append(a,i)})}),n}const yE=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],vE="6";try{window.__reactRouterVersion=vE}catch{}const wE="startTransition",Yg=Op[wE];function _E(e){let{basename:t,children:n,future:r,window:a}=e,i=h.useRef();i.current==null&&(i.current=jC({window:a,v5Compat:!0}));let o=i.current,[l,c]=h.useState({action:o.action,location:o.location}),{v7_startTransition:d}=r||{},u=h.useCallback(f=>{d&&Yg?Yg(()=>c(f)):c(f)},[c,d]);return h.useLayoutEffect(()=>o.listen(u),[o,u]),h.useEffect(()=>dE(r),[r]),h.createElement(fE,{basename:t,children:n,location:l.location,navigationType:l.action,navigator:o,future:r})}const jE=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",NE=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,za=h.forwardRef(function(t,n){let{onClick:r,relative:a,reloadDocument:i,replace:o,state:l,target:c,to:d,preventScrollReset:u,viewTransition:f}=t,m=pE(t,yE),{basename:p}=h.useContext(ca),v,g=!1;if(typeof d=="string"&&NE.test(d)&&(v=d,jE))try{let w=new URL(window.location.href),_=d.startsWith("//")?new URL(w.protocol+d):new URL(d),j=P0(_.pathname,p);_.origin===w.origin&&j!=null?d=j+_.search+_.hash:g=!0}catch{}let y=YC(d,{relative:a}),b=kE(d,{replace:o,state:l,target:c,preventScrollReset:u,relative:a,viewTransition:f});function x(w){r&&r(w),w.defaultPrevented||b(w)}return h.createElement("a",Km({},m,{href:v||y,onClick:g||i?r:x,ref:n,target:c}))});var Qg;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})(Qg||(Qg={}));var Jg;(function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})(Jg||(Jg={}));function kE(e,t){let{target:n,replace:r,state:a,preventScrollReset:i,relative:o,viewTransition:l}=t===void 0?{}:t,c=sn(),d=ni(),u=F1(e,{relative:o});return h.useCallback(f=>{if(gE(f,n)){f.preventDefault();let m=r!==void 0?r:xd(d)===xd(u);c(e,{replace:m,state:a,preventScrollReset:i,relative:o,viewTransition:l})}},[d,c,u,r,a,n,e,i,o,l])}function I0(e){let t=h.useRef(Ym(e)),n=h.useRef(!1),r=ni(),a=h.useMemo(()=>bE(r.search,n.current?null:t.current),[r.search]),i=sn(),o=h.useCallback((l,c)=>{const d=Ym(typeof l=="function"?l(a):l);n.current=!0,i("?"+d,c)},[i,a]);return[a,o]}var Xg=["light","dark"],SE="(prefers-color-scheme: dark)",CE=h.createContext(void 0),EE={setTheme:e=>{},themes:[]},PE=()=>{var e;return(e=h.useContext(CE))!=null?e:EE};h.memo(({forcedTheme:e,storageKey:t,attribute:n,enableSystem:r,enableColorScheme:a,defaultTheme:i,value:o,attrs:l,nonce:c})=>{let d=i==="system",u=n==="class"?`var d=document.documentElement,c=d.classList;${`c.remove(${l.map(v=>`'${v}'`).join(",")})`};`:`var d=document.documentElement,n='${n}',s='setAttribute';`,f=a?Xg.includes(i)&&i?`if(e==='light'||e==='dark'||!e)d.style.colorScheme=e||'${i}'`:"if(e==='light'||e==='dark')d.style.colorScheme=e":"",m=(v,g=!1,y=!0)=>{let b=o?o[v]:v,x=g?v+"|| ''":`'${b}'`,w="";return a&&y&&!g&&Xg.includes(v)&&(w+=`d.style.colorScheme = '${v}';`),n==="class"?g||b?w+=`c.add(${x})`:w+="null":b&&(w+=`d[s](n,${x})`),w},p=e?`!function(){${u}${m(e)}}()`:r?`!function(){try{${u}var e=localStorage.getItem('${t}');if('system'===e||(!e&&${d})){var t='${SE}',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)}}${d?"":"else{"+m(i,!1,!1)+"}"}${f}}catch(e){}}()`:`!function(){try{${u}var e=localStorage.getItem('${t}');if(e){${o?`var x=${JSON.stringify(o)};`:""}${m(o?"x[e]":"e",!0)}}else{${m(i,!1,!1)};}${f}}catch(t){}}();`;return h.createElement("script",{nonce:c,dangerouslySetInnerHTML:{__html:p}})});var TE=e=>{switch(e){case"success":return IE;case"info":return DE;case"warning":return OE;case"error":return LE;default:return null}},RE=Array(12).fill(0),AE=({visible:e,className:t})=>oe.createElement("div",{className:["sonner-loading-wrapper",t].filter(
68Boolean).join(" "),"data-visible":e},oe.createElement("div",{className:"sonner-spinner"},RE.map((n,r)=>oe.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${r}`})))),IE=oe.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},oe.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"})),OE=oe.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},oe.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"})),DE=oe.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},oe.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"})),LE=oe.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},oe.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"})),ME=oe.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"},oe.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),oe.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),$E=()=>{let[e,t]=oe.useState(document.hidden);return oe.useEffect(()=>{let n=()=>{t(document.hidden)};return document.addEventListener("visibilitychange",n),()=>window.removeEventListener("visibilitychange",n)},[]),e},Qm=1,FE=class{constructor(){this.subscribe=e=>(this.subscribers.push(e),()=>{let t=this.subscribers.indexOf(e);this.subscribers.splice(t,1)}),this.publish=e=>{this.subscribers.forEach(t=>t(e))},this.addToast=e=>{this.publish(e),this.toasts=[...this.toasts,e]},this.create=e=>{var t;let{message:n,...r}=e,a=typeof(e==null?void 0:e.id)=="number"||((t=e.id)==null?void 0:t.length)>0?e.id:Qm++,i=this.toasts.find(l=>l.id===a),o=e.dismissible===void 0?!0:e.dismissible;return this.dismissedToasts.has(a)&&this.dismissedToasts.delete(a),i?this.toasts=this.toasts.map(l=>l.id===a?(this.publish({...l,...e,id:a,title:n}),{...l,...e,id:a,dismissible:o,title:n}):l):this.addToast({title:n,...r,dismissible:o,id:a}),a},this.dismiss=e=>(this.dismissedToasts.add(e),e||this.toasts.forEach(t=>{this.subscribers.forEach(n=>n({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)=>
68this.create({...t,type:"loading",message:e}),this.promise=(e,t)=>{if(!t)return;let n;t.loading!==void 0&&(n=this.create({...t,promise:e,type:"loading",message:t.loading,description:typeof t.description!="function"?t.description:void 0}));let r=e instanceof Promise?e:e(),a=n!==void 0,i,o=r.then(async c=>{if(i=["resolve",c],oe.isValidElement(c))a=!1,this.create({id:n,type:"default",message:c});else if(BE(c)&&!c.ok){a=!1;let d=typeof t.error=="function"?await t.error(`HTTP error! status: ${c.status}`):t.error,u=typeof t.description=="function"?await t.description(`HTTP error! status: ${c.status}`):t.description;this.create({id:n,type:"error",message:d,description:u})}else if(t.success!==void 0){a=!1;let d=typeof t.success=="function"?await t.success(c):t.success,u=typeof t.description=="function"?await t.description(c):t.description;this.create({id:n,type:"success",message:d,description:u})}}).catch(async c=>{if(i=["reject",c],t.error!==void 0){a=!1;let d=typeof t.error=="function"?await t.error(c):t.error,u=typeof t.description=="function"?await t.description(c):t.description;this.create({id:n,type:"error",message:d,description:u})}}).finally(()=>{var c;a&&(this.dismiss(n),n=void 0),(c=t.finally)==null||c.call(t)}),l=()=>new Promise((c,d)=>o.then(()=>i[0]==="reject"?d(i[1]):c(i[1])).catch(d));return typeof n!="string"&&typeof n!="number"?{unwrap:l}:Object.assign(n,{unwrap:l})},this.custom=(e,t)=>{let n=(t==null?void 0:t.id)||Qm++;return this.create({jsx:e(n),id:n,...t}),n},this.getActiveToasts=()=>this.toasts.filter(e=>!this.dismissedToasts.has(e.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}},kn=new FE,UE=(e,t)=>{let n=(t==null?void 0:t.id)||Qm++;return kn.addToast({title:e,...t,id:n}),n},BE=e=>e&&typeof e=="object"&&"ok"in e&&typeof e.ok=="boolean"&&"status"in e&&typeof e.status=="number",zE=UE,qE=()=>kn.toasts,VE=()=>kn.getActiveToasts(),B=Object.assign(zE,{success:kn.success,info:kn.info,warning:kn.warning,error:kn.error,custom:kn.custom,message:kn.message,promise:kn.promise,dismiss:kn.dismiss,loading:kn.loading},{getHistory:qE,getToasts:VE});function WE(e,{insertAt:t}={}){if(typeof document>"u")return;let n=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css",t==="top"&&n.firstChild?n.insertBefore(r,n.firstChild):n.appendChild(r),r.styleSheet?r.styleSheet.cssText=e:r.appendChild(document.createTextNode(e))}WE(`: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;
68left: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}
68: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%);
68--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%)}
69`);function au(e){return e.label!==void 0}var HE=3,GE="32px",KE="16px",Zg=4e3,YE=356,QE=14,JE=20,XE=200;function sr(...e){return e.filter(Boolean).join(" ")}function ZE(e){let[t,n]=e.split("-"),r=[];return t&&r.push(t),n&&r.push(n),r}var e5=e=>{var t,n,r,a,i,o,l,c,d,u,f;let{invert:m,toast:p,unstyled:v,interacting:g,setHeights:y,visibleToasts:b,heights:x,index:w,toasts:_,expanded:j,removeToast:N,defaultRichColors:k,closeButton:C,style:A,cancelButtonStyle:I,actionButtonStyle:O,className:P="",descriptionClassName:T="",duration:E,position:W,gap:V,loadingIcon:q,expandByDefault:D,classNames:$,icons:z,closeButtonAriaLabel:R="Close toast",pauseWhenPageIsHidden:U}=e,[ee,ae]=oe.useState(null),[xe,te]=oe.useState(null),[ce,Re]=oe.useState(!1),[ye,fe]=oe.useState(!1),[ge,J]=oe.useState(!1),[ue,Ee]=oe.useState(!1),[Y,Q]=oe.useState(!1),[le,de]=oe.useState(0),[me,
69Le]=oe.useState(0),Ke=oe.useRef(p.duration||E||Zg),Qe=oe.useRef(null),tt=oe.useRef(null),an=w===0,Wt=w+1<=b,De=p.type,pe=p.dismissible!==!1,Qt=p.className||"",nt=p.descriptionClassName||"",M=oe.useMemo(()=>x.findIndex(be=>be.toastId===p.id)||0,[x,p.id]),Ve=oe.useMemo(()=>{var be;return(be=p.closeButton)!=null?be:C},[p.closeButton,C]),Ue=oe.useMemo(()=>p.duration||E||Zg,[p.duration,E]),Ze=oe.useRef(0),ft=oe.useRef(0),Rt=oe.useRef(0),lt=oe.useRef(null),[on,F]=W.split("-"),Pe=oe.useMemo(()=>x.reduce((be,Ce,$e)=>$e>=M?be:be+Ce.height,0),[x,M]),Z=$E(),G=p.invert||m,et=De==="loading";ft.current=oe.useMemo(()=>M*V+Pe,[M,Pe]),oe.useEffect(()=>{Ke.current=Ue},[Ue]),oe.useEffect(()=>{Re(!0)},[]),oe.useEffect(()=>{let be=tt.current;if(be){let Ce=be.getBoundingClientRect().height;return Le(Ce),y($e=>[{toastId:p.id,height:Ce,position:p.position},...$e]),()=>y($e=>$e.filter(ct=>ct.toastId!==p.id))}},[y,p.id]),oe.useLayoutEffect(()=>{if(!ce)return;let be=tt.current,Ce=be.style.height;be.style.height="auto";let $e=be.getBoundingClientRect().height;be.style.height=Ce,Le($e),y(ct=>ct.find(_t=>_t.toastId===p.id)?ct.map(_t=>_t.toastId===p.id?{..._t,height:$e}:_t):[{toastId:p.id,height:$e,position:p.position},...ct])},[ce,p.title,p.description,y,p.id]);let ze=oe.useCallback(()=>{fe(!0),de(ft.current),y(be=>be.filter(Ce=>Ce.toastId!==p.id)),setTimeout(()=>{N(p)},XE)},[p,N,y,ft]);oe.useEffect(()=>{if(p.promise&&De==="loading"||p.duration===1/0||p.type==="loading")return;let be;return j||g||U&&Z?(()=>{if(Rt.current<Ze.current){let Ce=new Date().getTime()-Ze.current;Ke.current=Ke.current-Ce}Rt.current=new Date().getTime()})():Ke.current!==1/0&&(Ze.current=new Date().getTime(),be=setTimeout(()=>{var Ce;(Ce=p.onAutoClose)==null||Ce.call(p,p),ze()},Ke.current)),()=>clearTimeout(be)},[j,g,p,De,U,Z,ze]),oe.useEffect(()=>{p.delete&&ze()},[ze,p.delete]);function ie(){var be,Ce,$e;return z!=null&&z.loading?oe.createElement("div",{className:sr($==null?void 0:$.loader,(be=p==null?void 0:p.classNames)==null?void 0:be.loader,"sonner-loader"),"data-visible":De==="loading"},z.loading):q?oe.createElement("div",{className:sr($==null?void 0:$.loader,(Ce=p==null?void 0:p.classNames)==null?void 0:Ce.loader,"sonner-loader"),"data-visible":De==="loading"},q):oe.createElement(AE,{className:sr($==null?void 0:$.loader,($e=p==null?void 0:p.classNames)==null?void 0:$e.loader),visible:De==="loading"})}return oe.createElement("li",{tabIndex:0,ref:tt,className:sr(P,Qt,$==null?void 0:$.toast,(t=p==null?void 0:p.classNames)==null?void 0:t.toast,$==null?void 0:$.default,$==null?void 0:$[De],(n=p==null?void 0:p.classNames)==null?void 0:n[De]),"data-sonner-toast":"","data-rich-colors":(r=p.richColors)!=null?r:k,"data-styled":!(p.jsx||p.unstyled||v),"data-mounted":ce,"data-promise":!!p.promise,"data-swiped":Y,"data-removed":ye,"data-visible":Wt,"data-y-position":on,"data-x-position":F,"data-index":w,"data-front":an,"data-swiping":ge,"data-dismissible":pe,"data-type":De,"data-invert":G,"data-swipe-out":ue,"data-swipe-direction":xe,"data-expanded":!!(j||D&&ce),style:{"--index":w,"--toasts-before":w,"--z-index":_.length-w,"--offset":`${ye?le:ft.current}px`,"--initial-height":D?"auto":`${me}px`,...A,...p.style},onDragEnd:()=>{J(!1),ae(null),lt.current=null},onPointerDown:be=>{et||!pe||(Qe.current=new Date,de(ft.current),be.target.setPointerCapture(be.pointerId),be.target.tagName!=="BUTTON"&&(J(!0),lt.current={x:be.clientX,y:be.clientY}))},onPointerUp:()=>{var be,Ce,$e,ct;if(ue||!pe)return;lt.current=null;let _t=Number(((be=tt.current)==null?void 0:be.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),rt=Number(((Ce=tt.current)==null?void 0:Ce.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),mt=new Date().getTime()-(($e=Qe.current)==null?void 0:$e.getTime()),ut=ee==="x"?_t:rt,pt=Math.abs(ut)/mt;if(Math.abs(ut)>=JE||pt>.11){de(ft.current),(ct=p.onDismiss)==null||ct.call(p,p),te(ee==="x"?_t>0?"right":"left":rt>0?"down":"up"),ze(),Ee(!0),Q(!1);return}J(!1),ae(null)},onPointerMove:be=>{var Ce,$e,ct,_t;if(!lt.current||!pe||((Ce=window.getSelection())==null?void 0:Ce.toString().length)>0)return;let rt=be.clientY-lt.current.y,mt=be.clientX-lt.current.x,ut=($e=e.swipeDirections)!=null?$e:ZE(W);!ee&&(Math.abs(mt)>1||Math.abs(rt)>1)&&ae(Math.abs(mt)>Math.abs(rt)?"x":"y");let pt={x:0,y:0};ee==="y"?(ut.includes("top")||ut.includes("bottom"))&&(ut.includes("top")&&rt<0||ut.includes("bottom")&&rt>0)&&(pt.y=rt):ee==="x"&&(ut.includes("left")||ut.includes("right"))&&(ut.includes("left")&&mt<0||ut.includes("right")&&mt>0)&&(pt.x=mt),(Math.abs(pt.x)>0||Math.abs(pt.y)>0)&&Q(!0),(ct=tt.current)==null||ct.style.setProperty("--swipe-amount-x",`${pt.x}px`),(_t=tt.current)==null||_t.style.setProperty("--swipe-amount-y",`${pt.y}px`)}},Ve&&!p.jsx?oe.createElement("button",{"aria-label":R,"data-disabled":et,"data-close-button":!0,onClick:et||!pe?()=>{}:()=>{var be;ze(),(be=p.onDismiss)==null||be.call(p,p)},className:sr($==null?void 0:$.closeButton,(a=p==null?void 0:p.classNames)==null?void 0:a.closeButton)},(i=z==null?void 0:z.close)!=null?i:ME):null,p.jsx||h.isValidElement(p.title)?p.jsx?p.jsx:typeof p.title=="function"?p.title():p.title:oe.createElement(oe.Fragment,null,De||p.icon||p.promise?oe.createElement("div",{"data-icon":"",className:sr($==null?void 0:$.icon,(o=p==null?void 0:p.classNames)==null?void 0:o.icon)}
69,p.promise||p.type==="loading"&&!p.icon?p.icon||ie():null,p.type!=="loading"?p.icon||(z==null?void 0:z[De])||TE(De):null):null,oe.createElement("div",{"data-content":"",className:sr($==null?void 0:$.content,(l=p==null?void 0:p.classNames)==null?void 0:l.content)},oe.createElement("div",{"data-title":"",className:sr($==null?void 0:$.title,(c=p==null?void 0:p.classNames)==null?void 0:c.title)},typeof p.title=="function"?p.title():p.title),p.description?oe.createElement("div",{"data-description":"",className:sr(T,nt,$==null?void 0:$.description,(d=p==null?void 0:p.classNames)==null?void 0:d.description)},typeof p.description=="function"?p.description():p.description):null),h.isValidElement(p.cancel)?p.cancel:p.cancel&&au(p.cancel)?oe.createElement("button",{"data-button":!0,"data-cancel":!0,style:p.cancelButtonStyle||I,onClick:be=>{var Ce,$e;au(p.cancel)&&pe&&(($e=(Ce=p.cancel).onClick)==null||$e.call(Ce,be),ze())},className:sr($==null?void 0:$.cancelButton,(u=p==null?void 0:p.classNames)==null?void 0:u.cancelButton)},p.cancel.label):null,h.isValidElement(p.action)?p.action:p.action&&au(p.action)?oe.createElement("button",{"data-button":!0,"data-action":!0,style:p.actionButtonStyle||O,onClick:be=>{var Ce,$e;au(p.action)&&(($e=(Ce=p.action).onClick)==null||$e.call(Ce,be),!be.defaultPrevented&&ze())},className:sr($==null?void 0:$.actionButton,(f=p==null?void 0:p.classNames)==null?void 0:f.actionButton)},p.action.label):null))};function eb(){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 t5(e,t){let n={};return[e,t].forEach((r,a)=>{let i=a===1,o=i?"--mobile-offset":"--offset",l=i?KE:GE;function c(d){["top","right","bottom","left"].forEach(u=>{n[`${o}-${u}`]=typeof d=="number"?`${d}px`:d})}typeof r=="number"||typeof r=="string"?c(r):typeof r=="object"?["top","right","bottom","left"].forEach(d=>{r[d]===void 0?n[`${o}-${d}`]=l:n[`${o}-${d}`]=typeof r[d]=="number"?`${r[d]}px`:r[d]}):c(l)}),n}var n5=h.forwardRef(function(e,t){let{invert:n,position:r="bottom-right",hotkey:a=["altKey","KeyT"],expand:i,closeButton:o,className:l,offset:c,mobileOffset:d,theme:u="light",richColors:f,duration:m,style:p,visibleToasts:v=HE,toastOptions:g,dir:y=eb(),gap:b=QE,loadingIcon:x,icons:w,containerAriaLabel:_="Notifications",pauseWhenPageIsHidden:j}=e,[N,k]=oe.useState([]),C=oe.useMemo(()=>Array.from(new Set([r].concat(N.filter(U=>U.position).map(U=>U.position)))),[N,r]),[A,I]=oe.useState([]),[O,P]=oe.useState(!1),[T,E]=oe.useState(!1),[W,V]=oe.useState(u!=="system"?u:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),q=oe.useRef(null),D=a.join("+").replace(/Key/g,"").replace(/Digit/g,""),$=oe.useRef(null),z=oe.useRef(!1),R=oe.useCallback(U=>{k(ee=>{var ae;return(ae=ee.find(xe=>xe.id===U.id))!=null&&ae.delete||kn.dismiss(U.id),ee.filter(({id:xe})=>xe!==U.id)})},[]);return oe.useEffect(()=>kn.subscribe(U=>{if(U.dismiss){k(ee=>ee.map(ae=>ae.id===U.id?{...ae,delete:!0}:ae));return}setTimeout(()=>{p1.flushSync(()=>{k(ee=>{let ae=ee.findIndex(xe=>xe.id===U.id);return ae!==-1?[...ee.slice(0,ae),{...ee[ae],...U},...ee.slice(ae+1)]:[U,...ee]})})})}),[]),oe.useEffect(()=>{if(u!=="system"){V(u);return}if(u==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?V("dark"):V("light")),typeof window>"u")return;let U=window.matchMedia("(prefers-color-scheme: dark)");try{U.addEventListener("change",({matches:ee})=>{V(ee?"dark":"light")})}catch{U.addListener(({matches:ae})=>{try{V(ae?"dark":"light")}catch(xe){console.error(xe)}})}},[u]),oe.useEffect(()=>{N.length<=1&&P(!1)},[N]),oe.useEffect(()=>{let U=ee=>{var ae,xe;a.every(te=>ee[te]||ee.code===te)&&(P(!0),(ae=q.current)==null||ae.focus()),ee.code==="Escape"&&(document.activeElement===q.current||(xe=q.current)!=null&&xe.contains(document.activeElement))&&P(!1)};return document.addEventListener("keydown",U),()=>document.removeEventListener("keydown",U)},[a]),oe.useEffect(()=>{if(q.current)return()=>{$.current&&($.current.focus({preventScroll:!0}),$.current=null,z.current=!1)}},[q.current]),oe.createElement("section",{ref:t,"aria-label":`${_} ${D}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},C.map((U,ee)=>{var ae;let[xe,te]=U.split("-");return N.length?oe.createElement("ol",{key:U,dir:y==="auto"?eb():y,tabIndex:-1,ref:q,className:l,"data-sonner-toaster":!0,"data-theme":W,"data-y-position":xe,"data-lifted":O&&N.length>
691&&!i,"data-x-position":te,style:{"--front-toast-height":`${((ae=A[0])==null?void 0:ae.height)||0}px`,"--width":`${YE}px`,"--gap":`${b}px`,...p,...t5(c,d)},onBlur:ce=>{z.current&&!ce.currentTarget.contains(ce.relatedTarget)&&(z.current=!1,$.current&&($.current.focus({preventScroll:!0}),$.current=null))},onFocus:ce=>{ce.target instanceof HTMLElement&&ce.target.dataset.dismissible==="false"||z.current||(z.current=!0,$.current=ce.relatedTarget)},onMouseEnter:()=>P(!0),onMouseMove:()=>P(!0),onMouseLeave:()=>{T||P(!1)},onDragEnd:()=>P(!1),onPointerDown:ce=>{ce.target instanceof HTMLElement&&ce.target.dataset.dismissible==="false"||E(!0)},onPointerUp:()=>E(!1)},N.filter(ce=>!ce.position&&ee===0||ce.position===U).map((ce,Re)=>{var ye,fe;return oe.createElement(e5,{key:ce.id,icons:w,index:Re,toast:ce,defaultRichColors:f,duration:(ye=g==null?void 0:g.duration)!=null?ye:m,className:g==null?void 0:g.className,descriptionClassName:g==null?void 0:g.descriptionClassName,invert:n,visibleToasts:v,closeButton:(fe=g==null?void 0:g.closeButton)!=null?fe:o,interacting:T,position:U,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:R,toasts:N.filter(ge=>ge.position==ce.position),heights:A.filter(ge=>ge.position==ce.position),setHeights:I,expandByDefault:i,gap:b,loadingIcon:x,expanded:O,pauseWhenPageIsHidden:j,swipeDirections:e.swipeDirections})})):null}))});const r5=({...e})=>{const{theme:t="system"}=PE();return s.jsx(n5,{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})},s5=1,a5=1e6;let sf=0;function i5(){return sf=(sf+1)%Number.MAX_SAFE_INTEGER,sf.toString()}const af=new Map,tb=e=>{if(af.has(e))return;const t=setTimeout(()=>{af.delete(e),_l({type:"REMOVE_TOAST",toastId:e})},a5);af.set(e,t)},o5=(e,t)=>{switch(t.type){case"ADD_TOAST":return{...e,toasts:[t.toast,...e.toasts].slice(0,s5)};case"UPDATE_TOAST":return{...e,toasts:e.toasts.map(n=>n.id===t.toast.id?{...n,...t.toast}:n)};case"DISMISS_TOAST":{const{toastId:n}=t;return n?tb(n):e.toasts.forEach(r=>{tb(r.id)}),{...e,toasts:e.toasts.map(r=>r.id===n||n===void 0?{...r,open:!1}:r)}}case"REMOVE_TOAST":return t.toastId===void 0?{...e,toasts:[]}:{...e,toasts:e.toasts.filter(n=>n.id!==t.toastId)}}},Mu=[];let $u={toasts:[]};function _l(e){$u=o5($u,e),Mu.forEach(t=>{t($u)})}function Kt({...e}){const t=i5(),n=a=>_l({type:"UPDATE_TOAST",toast:{...a,id:t}}),r=()=>_l({type:"DISMISS_TOAST",toastId:t});return _l({type:"ADD_TOAST",toast:{...e,id:t,open:!0,onOpenChange:a=>{a||r()}}}),{id:t,dismiss:r,update:n}}function l5(){const[e,t]=h.useState($u);return h.useEffect(()=>(Mu.push(t),()=>{const n=Mu.indexOf(t);n>-1&&Mu.splice(n,1)}),[e]),{...e,toast:Kt,dismiss:n=>_l({type:"DISMISS_TOAST",toastId:n})}}function bt(e,t,{checkForDefaultPrevented:n=!0}={}){return function(a){if(e==null||e(a),n===!1||!a.defaultPrevented)return t==null?void 0:t(a)}}function nb(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function z1(...e){return t=>{let n=!1;const r=e.map(a=>{const i=nb(a,t);return!n&&typeof i=="function"&&(n=!0),i});if(n)return()=>{for(let a=0;a<r.length;a++){const i=r[a];typeof i=="function"?i():nb(e[a],null)}}}}function rn(...e){return h.useCallback(z1(...e),e)}function c5(e,t){const n=h.createContext(t),r=i=>{const{children:o,...l}=i,c=h.useMemo(()=>l,Object.values(l));return s.jsx(n.Provider,{value:c,children:o})};r.displayName=e+"Provider";function a(i){const o=h.useContext(n);if(o)return o;if(t!==void 0)return t;throw new Error(`\`${i}\` must be used within \`${e}\``)}return[r,a]}function ko(e,t=[]){let n=[];function r(i,o){const l=h.createContext(o),c=n.length;n=[...n,o];const d=f=>{var b;const{scope:m,children:p,...v}=f,g=((b=m==null?void 0:m[e])==null?void 0:b[c])||l,y=h.useMemo(()=>v,Object.values(v));return s.jsx(g.Provider,{value:y,children:p})};d.displayName=i+"Provider";function u(f,m){var g;const p=((g=m==null?void 0:m[e])==null?void 0:g[c])||l,v=h.useContext(p);if(v)return v;if(o!==void 0)return o;throw new Error(`\`${f}\` must be used within \`${i}\``)}return[d,u]}const a=()=>{const i=n.map(o=>h.createContext(o));return function(l){const c=(l==null?void 0:l[e])||i;return h.useMemo(()=>({[`__scope${e}`]:{...l,[e]:c}}),[l,c])}};return a.scopeName=e,[r,u5(a,...t)]}function u5(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(a=>({useScope:a(),scopeName:a.scopeName}));
vendor: 10,705 bytes, line 69
69return function(i){const o=r.reduce((l,{useScope:c,scopeName:d})=>{const f=c(i)[`__scope${d}`];return{...l,...f}},{});return h.useMemo(()=>({[`__scope${t.scopeName}`]:o}),[o])}};return n.scopeName=t.scopeName,n}function Kl(e){const t=h5(e),n=h.forwardRef((r,a)=>{const{children:i,...o}=r,l=h.Children.toArray(i),c=l.find(f5);if(c){const d=c.props.children,u=l.map(f=>f===c?h.Children.count(d)>1?h.Children.only(null):h.isValidElement(d)?d.props.children:null:f);return s.jsx(t,{...o,ref:a,children:h.isValidElement(d)?h.cloneElement(d,void 0,u):null})}return s.jsx(t,{...o,ref:a,children:i})});return n.displayName=`${e}.Slot`,n}var d5=Kl("Slot");function h5(e){const t=h.forwardRef((n,r)=>{const{children:a,...i}=n;if(h.isValidElement(a)){const o=p5(a),l=m5(i,a.props);return a.type!==h.Fragment&&(l.ref=r?z1(r,o):o),h.cloneElement(a,l)}return h.Children.count(a)>1?h.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var q1=Symbol("radix.slottable");function V1(e){const t=({children:n})=>s.jsx(s.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=q1,t}function f5(e){return h.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===q1}function m5(e,t){const n={...t};for(const r in t){const a=e[r],i=t[r];/^on[A-Z]/.test(r)?a&&i?n[r]=(...l)=>{const c=i(...l);return a(...l),c}:a&&(n[r]=a):r==="style"?n[r]={...a,...i}:r==="className"&&(n[r]=[a,i].filter(Boolean).join(" "))}return{...e,...n}}function p5(e){var r,a;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(a=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:a.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function x5(e){const t=e+"CollectionProvider",[n,r]=ko(t),[a,i]=n(t,{collectionRef:{current:null},itemMap:new Map}),o=g=>{const{scope:y,children:b}=g,x=oe.useRef(null),w=oe.useRef(new Map).current;return s.jsx(a,{scope:y,itemMap:w,collectionRef:x,children:b})};o.displayName=t;const l=e+"CollectionSlot",c=Kl(l),d=oe.forwardRef((g,y)=>{const{scope:b,children:x}=g,w=i(l,b),_=rn(y,w.collectionRef);return s.jsx(c,{ref:_,children:x})});d.displayName=l;const u=e+"CollectionItemSlot",f="data-radix-collection-item",m=Kl(u),p=oe.forwardRef((g,y)=>{const{scope:b,children:x,...w}=g,_=oe.useRef(null),j=rn(y,_),N=i(u,b);return oe.useEffect(()=>(N.itemMap.set(_,{ref:_,...w}),()=>void N.itemMap.delete(_))),s.jsx(m,{[f]:"",ref:j,children:x})});p.displayName=u;function v(g){const y=i(e+"CollectionConsumer",g);return oe.useCallback(()=>{const x=y.collectionRef.current;if(!x)return[];const w=Array.from(x.querySelectorAll(`[${f}]`));return Array.from(y.itemMap.values()).sort((N,k)=>w.indexOf(N.ref.current)-w.indexOf(k.ref.current))},[y.collectionRef,y.itemMap])}return[{Provider:o,Slot:d,ItemSlot:p},v,r]}var g5=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Ut=g5.reduce((e,t)=>{const n=Kl(`Primitive.${t}`),r=h.forwardRef((a,i)=>{const{asChild:o,...l}=a,c=o?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),s.jsx(c,{...l,ref:i})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function W1(e,t){e&&In.flushSync(()=>e.dispatchEvent(t))}function Fr(e){const t=h.useRef(e);return h.useEffect(()=>{t.current=e}),h.useMemo(()=>(...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[])}function b5(e,t=globalThis==null?void 0:globalThis.document){const n=Fr(e);h.useEffect(()=>{const r=a=>{a.key==="Escape"&&n(a)};return t.addEventListener("keydown",r,{capture:!0}),()=>t.removeEventListener("keydown",r,{capture:!0})},[n,t])}var y5="DismissableLayer",Jm="dismissableLayer.update",v5="dismissableLayer.pointerDownOutside",w5="dismissableLayer.focusOutside",rb,H1=h.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Kd=h.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:a,onFocusOutside:i,onInteractOutside:o,onDismiss:l,...c}=e,d=h.useContext(H1),[u,f]=h.useState(null),m=(u==null?void 0:u.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,p]=h.useState({}),v=rn(t,k=>f(k)),g=Array.from(d.layers),[y]=[...d.layersWithOutsidePointerEventsDisabled].slice(-1),b=g.indexOf(y),x=u?g.indexOf(u):-1,w=d.layersWithOutsidePointerEventsDisabled.size>0,_=x>=b,j=j5(k=>{const C=k.target,A=[...d.branches].some(I=>I.contains(C));!_||A||(a==null||a(k),o==null||o(k),k.defaultPrevented||l==null||l())},m),N=N5(k=>{const C=k.target;[...d.branches].some(I=>I.contains(C))||(i==null||i(k),o==null||o(k),k.defaultPrevented||l==null||l())},m);return b5(k=>{x===d.layers.size-1&&(r==null||r(k),!k.defaultPrevented&&l&&(k.preventDefault(),l()))},m),h.useEffect(()=>{if(u)return n&&(d.layersWithOutsidePointerEventsDisabled.size===0&&(rb=m.body.style.pointerEvents,m.body.style.pointerEvents="none"),d.layersWithOutsidePointerEventsDisabled.add(u)),d.layers.add(u),sb(),()=>{n&&d.layersWithOutsidePointerEventsDisabled.size===1&&(m.body.style.pointerEvents=rb)}},[u,m,n,d]),h.useEffect(()=>()=>{u&&(d.layers.delete(u),d.layersWithOutsidePointerEventsDisabled.delete(u),sb())},[u,d]),h.useEffect(()=>{const k=()=>p({});return document.addEventListener(Jm,k),()=>document.removeEventListener(Jm,k)},[]),s.jsx(Ut.div,{...c,ref:v,style:{pointerEvents:w?_?"auto":"none":void 0,...e.style},onFocusCapture:bt(e.onFocusCapture,N.onFocusCapture),onBlurCapture:bt(e.onBlurCapture,N.onBlurCapture),onPointerDownCapture:bt(e.onPointerDownCapture,j.onPointerDownCapture)})});Kd.displayName=y5;var _5="DismissableLayerBranch",G1=h.forwardRef((e,t)=>{const n=h.useContext(H1),r=h.useRef(null),a=rn(t,r);return h.useEffect(()=>{const i=r.current;if(i)return n.branches.add(i),()=>{n.branches.delete(i)}},[n.branches]),s.jsx(Ut.div,{...e,ref:a})});G1.displayName=_5;function j5(e,t=globalThis==null?void 0:globalThis.document){const n=Fr(e),r=h.useRef(!1),a=h.useRef(()=>{});return h.useEffect(()=>{const i=l=>{if(l.target&&!r.current){let c=function(){K1(v5,n,d,{discrete:!0})};const d={originalEvent:l};l.pointerType==="touch"?(t.removeEventListener("click",a.current),a.current=c,t.addEventListener("click",a.current,{once:!0})):c()}else t.removeEventListener("click",a.current);r.current=!1},o=window.setTimeout(()=>{t.addEventListener("pointerdown",i)},0);return()=>{window.clearTimeout(o),t.removeEventListener("pointerdown",i),t.removeEventListener("click",a.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function N5(e,t=globalThis==null?void 0:globalThis.document){const n=Fr(e),r=h.useRef(!1);return h.useEffect(()=>{const a=i=>{i.target&&!r.current&&K1(w5,n,{originalEvent:i},{discrete:!1})};return t.addEventListener("focusin",a),()=>t.removeEventListener("focusin",a)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function sb(){const e=new CustomEvent(Jm);document.dispatchEvent(e)}function K1(e,t,n,{discrete:r}){const a=n.originalEvent.target,i=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&a.addEventListener(e,t,{once:!0}),r?W1(a,i):a.dispatchEvent(i)}var k5=Kd,S5=G1,ls=globalThis!=null&&globalThis.document?h.useLayoutEffect:()=>{},C5="Portal",O0=h.forwardRef((e,t)=>{var l;const{container:n,...r}=e,[a,i]=h.useState(!1);ls(()=>i(!0),[]);const o=n||a&&((l=globalThis==null?void 0:globalThis.document)==null?void 0:l.body);return o?p1.createPortal(s.jsx(Ut.div,{...r,ref:t}),o):null});O0.displayName=C5;function E5(e,t){return h.useReducer((n,r)=>t[n][r]??n,e)}var So=e=>{const{present:t,children:n}=e,r=P5(t),a=typeof n=="function"?n({present:r.isPresent}):h.Children.only(n),i=rn(r.ref,T5(a));return typeof n=="function"||r.isPresent?h.cloneElement(a,{ref:i}):null};So.displayName="Presence";function P5(e){const[t,n]=h.useState(),r=h.useRef(null),a=h.useRef(e),i=h.useRef("none"),o=e?"mounted":"unmounted",[l,c]=E5(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return h.useEffect(()=>{const d=iu(r.current);i.current=l==="mounted"?d:"none"},[l]),ls(()=>{const d=r.current,u=a.current;if(u!==e){const m=i.current,p=iu(d);e?c("MOUNT"):p==="none"||(d==null?void 0:d.display)==="none"?c("UNMOUNT"):c(u&&m!==p?"ANIMATION_OUT":"UNMOUNT"),a.current=e}},[e,c]),ls(()=>{if(t){let d;const u=t.ownerDocument.defaultView??window,f=p=>{const g=iu(r.current).includes(p.animationName);if(p.target===t&&g&&(c("ANIMATION_END"),!a.current)){const y=t.style.animationFillMode;t.style.animationFillMode="forwards",d=u.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=y)})}},m=p=>{p.target===t&&(i.current=iu(r.current))};return t.addEventListener("animationstart",m),t.addEventListener("animationcancel",f),t.addEventListener("animationend",f),()=>{u.clearTimeout(d),t.removeEventListener("animationstart",m),t.removeEventListener("animationcancel",f),t.removeEventListener("animationend",f)}}else c("ANIMATION_END")},[t,c]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:h.useCallback(d=>{r.current=d?getComputedStyle(d):null,n(d)},[])}}function iu(e){return(e==null?void 0:e.animationName)||"none"}function T5(e){var r,a;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(a=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:a.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var R5=Op[" useInsertionEffect ".trim().toString()]||ls;function Y1({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[a,i,o]=A5({defaultProp:t,onChange:n}),l=e!==void 0,c=l?e:a;{const u=h.useRef(e!==void 0);h.useEffect(()=>{const f=u.current;f!==l&&console.warn(`${r} is changing from ${f?"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.`),u.current=l},[l,r])}const d=h.useCallback(u=>{var f;if(l){const m=I5(u)?u(e):u;m!==e&&((f=o.current)==null||f.call(o,m))}else i(u)},[l,e,i,o]);return[c,d]}function A5({defaultProp:e,onChange:t}){const[n,r]=h.useState(e),a=h.useRef(n),i=h.useRef(t);return R5(()=>{i.current=t},[t]),h.useEffect(()=>{var o;a.current!==n&&((o=i.current)==null||o.call(i,n),a.current=n)},[n,a]),[n,r,i]}function I5(e){return typeof e=="function"}var O5=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"}),D5="VisuallyHidden",Yd=h.forwardRef((e,t)=>
69s.jsx(Ut.span,{...e,ref:t,style:{...O5,...e.style}}));Yd.displayName=D5;var L5=Yd,D0="ToastProvider",[L0,M5,$5]=x5("Toast"),[Q1,X8]=ko("Toast",[$5]),[F5,Qd]=Q1(D0),J1=e=>{const{__scopeToast:t,label:n="Notification",duration:r=5e3,swipeDirection:a="right",swipeThreshold:i=50,children:o}=e,[l,c]=h.useState(null),[d,u]=h.useState(0),f=h.useRef(!1),m=h.useRef(!1);return n.trim()||console.error(`Invalid prop \`label\` supplied to \`${D0}\`. Expected non-empty \`string\`.`),s.jsx(L0.Provider,{scope:t,children:s.jsx(F5,{scope:t,label:n,duration:r,swipeDirection:a,swipeThreshold:i,toastCount:d,viewport:l,onViewportChange:c,onToastAdd:h.useCallback(()=>u(p=>p+1),[]),onToastRemove:h.useCallback(()=>u(p=>p-1),[]),isFocusedToastEscapeKeyDownRef:f,isClosePausedRef:m,children:o})})};J1.displayName=D0;var X1="ToastViewport",U5=["F8"],Xm="toast.viewportPause",Zm="toast.viewportResume",Z1=h.forwardRef((e,t)=>{const{__scopeToast:n,hotkey:r=U5,label:a="Notifications ({hotkey})",...i}=e,o=Qd(X1,n),l=M5(n),c=h.useRef(null),d=h.useRef(null),u=h.useRef(null),f=h.useRef(null),m=rn(t,f,o.onViewportChange),p=r.join("+").replace(/Key/g,"").replace(/Digit/g,""),v=o.toastCount>0;h.useEffect(()=>{const y=b=>{var w;r.length!==0&&r.every(_=>b[_]||b.code===_)&&((w=f.current)==null||w.focus())};return document.addEventListener("keydown",y),()=>document.removeEventListener("keydown",y)},[r]),h.useEffect(()=>{const y=c.current,b=f.current;if(v&&y&&b){const x=()=>{if(!o.isClosePausedRef.current){const N=new CustomEvent(Xm);b.dispatchEvent(N),o.isClosePausedRef.current=!0}},w=()=>{if(o.isClosePausedRef.current){const N=new CustomEvent(Zm);b.dispatchEvent(N),o.isClosePausedRef.current=!1}},_=N=>{!y.contains(N.relatedTarget)&&w()},j=()=>{y.contains(document.activeElement)||w()};return y.addEventListener("focusin",x),y.addEventListener("focusout",_),y.addEventListener("pointermove",x),y.addEventListener("pointerleave",j),window.addEventListener("blur",x),window.addEventListener("focus",w),()=>{y.removeEventListener("focusin",x),y.removeEventListener("focusout",_),y.removeEventListener("pointermove",x),y.removeEventListener("pointerleave",j),window.removeEventListener("blur",x),window.removeEventListener("focus",w)}}},[v,o.isClosePausedRef]);const g=h.useCallback(({tabbingDirection:y})=>{const x=l().map(w=>{const _=w.ref.current,j=[_,...Z5(_)];return y==="forwards"?j:j.reverse()});return(y==="forwards"?x.reverse():x).flat()},[l]);return h.useEffect(()=>{const y=f.current;if(y){const b=x=>{var j,N,k;const w=x.altKey||x.ctrlKey||x.metaKey;if(x.key==="Tab"&&!w){const C=document.activeElement,A=x.shiftKey;if(x.target===y&&A){(j=d.current)==null||j.focus();return}const P=g({tabbingDirection:A?"backwards":"forwards"}),T=P.findIndex(E=>E===C);of(P.slice(T+1))?x.preventDefault():A?(N=d.current)==null||N.focus():(k=u.current)==null||k.focus()}};return y.addEventListener("keydown",b),()=>y.removeEventListener("keydown",b)}},[l,g]),s.jsxs(S5,{ref:c,role:"region","aria-label":a.replace("{hotkey}",p),tabIndex:-1,style:{pointerEvents:v?void 0:"none"},children:[v&&s.jsx(ep,{ref:d,onFocusFromOutsideViewport:()=>{const y=g({tabbingDirection:"forwards"});of(y)}}),s.jsx(L0.Slot,{scope:n,children:s.jsx(Ut.ol,{tabIndex:-1,...i,ref:m})}),v&&s.jsx(ep,{ref:u,onFocusFromOutsideViewport:()=>{const y=g({tabbingDirection:"backwards"});of(y)}})]})});Z1.displayName=X1;var e_="ToastFocusProxy",ep=h.forwardRef((e,t)=>{const{__scopeToast:n,onFocusFromOutsideViewport:r,...a}=e,i=Qd(e_,n);return s.jsx(Yd,{"aria-hidden":!0,tabIndex:0,...a,ref:t,style:{position:"fixed"},onFocus:o=>{var d;const l=o.relatedTarget;!((d=i.viewport)!=null&&d.contains(l))&&r()}})});ep.displayName=e_;var yc="Toast",B5="toast.swipeStart",z5="toast.swipeMove",q5="toast.swipeCancel",V5="toast.swipeEnd",t_=h.forwardRef((e,t)=>{const{forceMount:n,open:r,defaultOpen:a,onOpenChange:i,...o}=e,[l,c]=Y1({prop:r,defaultProp:a??!0,onChange:i,caller:yc});return s.jsx(So,{present:n||l,children:s.jsx(G5,{open:l,...o,ref:t,onClose:()=>c(!1),onPause:Fr(e.onPause),onResume:Fr(e.onResume),onSwipeStart:bt(e.onSwipeStart,d=>{d.currentTarget.setAttribute("data-swipe","start")}),onSwipeMove:bt(e.onSwipeMove,d=>{const{x:u,y:f}=d.detail.delta;d.currentTarget.setAttribute("data-swipe","move"),d.currentTarget.style.setProperty("--radix-toast-swipe-move-x",`${u}px`),d.currentTarget.style.setProperty("--radix-toast-swipe-move-y",`${f}px`)}),onSwipeCancel:bt(e.onSwipeCancel,d=>{d.currentTarget.setAttribute("data-swipe","cancel"),d.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),d.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),d.currentTarget.style.removeProperty("--radix-toast-swipe-end-x"),d.currentTarget.style.removeProperty("--radix-toast-swipe-end-y")}),onSwipeEnd:bt(e.onSwipeEnd,d=>{const{x:u,y:f}=d.detail.delta;d.currentTarget.setAttribute("data-swipe","end"),d.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),d.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),d.currentTarget.style.setProperty("--radix-toast-swipe-end-x",`${u}px`),d.currentTarget.style.setProperty("--radix-toast-swipe-end-y",`${f}px`),c(!1)})})})});t_.displayName=yc;var[W5,H5]=Q1(yc,{onClose(){}}),G5=h.forwardRef((e,t)=>
69{const{__scopeToast:n,type:r="foreground",duration:a,open:i,onClose:o,onEscapeKeyDown:l,onPause:c,onResume:d,onSwipeStart:u,onSwipeMove:f,onSwipeCancel:m,onSwipeEnd:p,...v}=e,g=Qd(yc,n),[y,b]=h.useState(null),x=rn(t,E=>b(E)),w=h.useRef(null),_=h.useRef(null),j=a||g.duration,N=h.useRef(0),k=h.useRef(j),C=h.useRef(0),{onToastAdd:A,onToastRemove:I}=g,O=Fr(()=>{var W;(y==null?void 0:y.contains(document.activeElement))&&((W=g.viewport)==null||W.focus()),o()}),P=h.useCallback(E=>{!E||E===1/0||(window.clearTimeout(C.current),N.current=new Date().getTime(),C.current=window.setTimeout(O,E))},[O]);h.useEffect(()=>{const E=g.viewport;if(E){const W=()=>{P(k.current),d==null||d()},V=()=>{const q=new Date().getTime()-N.current;k.current=k.current-q,window.clearTimeout(C.current),c==null||c()};return E.addEventListener(Xm,V),E.addEventListener(Zm,W),()=>{E.removeEventListener(Xm,V),E.removeEventListener(Zm,W)}}},[g.viewport,j,c,d,P]),h.useEffect(()=>{i&&!g.isClosePausedRef.current&&P(j)},[i,j,g.isClosePausedRef,P]),h.useEffect(()=>(A(),()=>I()),[A,I]);const T=h.useMemo(()=>y?l_(y):null,[y]);return g.viewport?s.jsxs(s.Fragment,{children:[T&&s.jsx(K5,{__scopeToast:n,role:"status","aria-live":r==="foreground"?"assertive":"polite","aria-atomic":!0,children:T}),s.jsx(W5,{scope:n,onClose:O,children:In.createPortal(s.jsx(L0.ItemSlot,{scope:n,children:s.jsx(k5,{asChild:!0,onEscapeKeyDown:bt(l,()=>{g.isFocusedToastEscapeKeyDownRef.current||O(),g.isFocusedToastEscapeKeyDownRef.current=!1}),children:s.jsx(Ut.li,{role:"status","aria-live":"off","aria-atomic":!0,tabIndex:0,"data-state":i?"open":"closed","data-swipe-direction":g.swipeDirection,...v,ref:x,style:{userSelect:"none",touchAction:"none",...e.style},onKeyDown:bt(e.onKeyDown,E=>{E.key==="Escape"&&(l==null||l(E.nativeEvent),E.nativeEvent.defaultPrevented||(g.isFocusedToastEscapeKeyDownRef.current=!0,O()))}),onPointerDown:bt(e.onPointerDown,E=>{E.button===0&&(w.current={x:E.clientX,y:E.clientY})}),onPointerMove:bt(e.onPointerMove,E=>{if(!w.current)return;const W=E.clientX-w.current.x,V=E.clientY-w.current.y,q=!!_.current,D=["left","right"].includes(g.swipeDirection),$=["left","up"].includes(g.swipeDirection)?Math.min:Math.max,z=D?$(0,W):0,R=D?0:$(0,V),U=E.pointerType==="touch"?10:2,ee={x:z,y:R},ae={originalEvent:E,delta:ee};q?(_.current=ee,ou(z5,f,ae,{discrete:!1})):ab(ee,g.swipeDirection,U)?(_.current=ee,ou(B5,u,ae,{discrete:!1}),E.target.setPointerCapture(E.pointerId)):(Math.abs(W)>U||Math.abs(V)>U)&&(w.current=null)}),onPointerUp:bt(e.onPointerUp,E=>{const W=_.current,V=E.target;if(V.hasPointerCapture(E.pointerId)&&V.releasePointerCapture(E.pointerId),_.current=null,w.current=null,W){const q=E.currentTarget,D={originalEvent:E,delta:W};ab(W,g.swipeDirection,g.swipeThreshold)?ou(V5,p,D,{discrete:!0}):ou(q5,m,D,{discrete:!0}),q.addEventListener("click",$=>$.preventDefault(),{once:!0})}})})})}),g.viewport)})]}):null}),K5=e=>{const{__scopeToast:t,children:n,...r}=e,a=Qd(yc,t),[i,o]=h.useState(!1),[l,c]=h.useState(!1);return J5(()=>o(!0)),h.useEffect(()=>{const d=window.setTimeout(()=>c(!0),1e3);return()=>window.clearTimeout(d)},[]),l?null:s.jsx(O0,{asChild:!0,children:s.jsx(Yd,{...r,children:i&&s.jsxs(s.Fragment,{children:[a.label," ",n]})})})},Y5="ToastTitle",n_=h.forwardRef((e,t)=>{const{__scopeToast:n,...r}=e;return s.jsx(Ut.div,{...r,ref:t})});n_.displayName=Y5;var Q5="ToastDescription",r_=h.forwardRef((e,t)=>{const{__scopeToast:n,...r}=e;return s.jsx(Ut.div,{...r,ref:t})});r_.displayName=Q5;var s_="ToastAction",a_=h.forwardRef((e,t)=>{const{altText:n,...r}=e;return n.trim()?s.jsx(o_,{altText:n,asChild:!0,children:s.jsx(M0,{...r,ref:t})}):(console.error(`Invalid prop \`altText\` supplied to \`${s_}\`. Expected non-empty \`string\`.`),null)});a_.displayName=s_;var i_="ToastClose",M0=h.forwardRef((e,t)=>{const{__scopeToast:n,...r}=e,a=H5(i_,n);return s.jsx(o_,{asChild:!0,children:s.jsx(Ut.button,{type:"button",...r,ref:t,onClick:bt(e.onClick,a.onClose)})})});M0.displayName=i_;var o_=h.forwardRef((e,t)=>{const{__scopeToast:n,altText:r,...a}=e;return s.jsx(Ut.div,{"data-radix-toast-announce-exclude":"","data-radix-toast-announce-alt":r||void 0,...a,ref:t})});function l_(e){const t=[];
vendor: 6,667 bytes, lines 69-133
69return Array.from(e.childNodes).forEach(r=>{if(r.nodeType===r.TEXT_NODE&&r.textContent&&t.push(r.textContent),X5(r)){const a=r.ariaHidden||r.hidden||r.style.display==="none",i=r.dataset.radixToastAnnounceExclude==="";if(!a)if(i){const o=r.dataset.radixToastAnnounceAlt;o&&t.push(o)}else t.push(...l_(r))}}),t}function ou(e,t,n,{discrete:r}){const a=n.originalEvent.currentTarget,i=new CustomEvent(e,{bubbles:!0,cancelable:!0,detail:n});t&&a.addEventListener(e,t,{once:!0}),r?W1(a,i):a.dispatchEvent(i)}var ab=(e,t,n=0)=>{const r=Math.abs(e.x),a=Math.abs(e.y),i=r>a;return t==="left"||t==="right"?i&&r>n:!i&&a>n};function J5(e=()=>{}){const t=Fr(e);ls(()=>{let n=0,r=0;return n=window.requestAnimationFrame(()=>r=window.requestAnimationFrame(t)),()=>{window.cancelAnimationFrame(n),window.cancelAnimationFrame(r)}},[t])}function X5(e){return e.nodeType===e.ELEMENT_NODE}function Z5(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const a=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||a?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function of(e){const t=document.activeElement;return e.some(n=>n===t?!0:(n.focus(),document.activeElement!==t))}var e4=J1,c_=Z1,u_=t_,d_=n_,h_=r_,f_=a_,m_=M0;function p_(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var a=e.length;for(t=0;t<a;t++)e[t]&&(n=p_(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function x_(){for(var e,t,n=0,r="",a=arguments.length;n<a;n++)(e=arguments[n])&&(t=p_(e))&&(r&&(r+=" "),r+=t);return r}const ib=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,ob=x_,g_=(e,t)=>n=>{var r;if((t==null?void 0:t.variants)==null)return ob(e,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:a,defaultVariants:i}=t,o=Object.keys(a).map(d=>{const u=n==null?void 0:n[d],f=i==null?void 0:i[d];if(u===null)return null;const m=ib(u)||ib(f);return a[d][m]}),l=n&&Object.entries(n).reduce((d,u)=>{let[f,m]=u;return m===void 0||(d[f]=m),d},{}),c=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((d,u)=>{let{class:f,className:m,...p}=u;return Object.entries(p).every(v=>{let[g,y]=v;return Array.isArray(y)?y.includes({...i,...l}[g]):{...i,...l}[g]===y})?[...d,f,m]:d},[]);return ob(e,o,c,n==null?void 0:n.class,n==null?void 0:n.className)};/**
70 * @license lucide-react v0.462.0 - ISC
71 *
72 * This source code is licensed under the ISC license.
73 * See the LICENSE file in the root directory of this source tree.
74 */const t4=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),b_=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim();/**
75 * @license lucide-react v0.462.0 - ISC
76 *
77 * This source code is licensed under the ISC license.
78 * See the LICENSE file in the root directory of this source tree.
79 */var n4={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"};/**
80 * @license lucide-react v0.462.0 - ISC
81 *
82 * This source code is licensed under the ISC license.
83 * See the LICENSE file in the root directory of this source tree.
84 */const r4=h.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:a="",children:i,iconNode:o,...l},c)=>h.createElement("svg",{ref:c,...n4,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:b_("lucide",a),...l},[...o.map(([d,u])=>h.createElement(d,u)),...Array.isArray(i)?i:[i]]));/**
85 * @license lucide-react v0.462.0 - ISC
86 *
87 * This source code is licensed under the ISC license.
88 * See the LICENSE file in the root directory of this source tree.
89 */const _e=(e,t)=>{const n=h.forwardRef(({className:r,...a},i)=>h.createElement(r4,{ref:i,iconNode:t,className:b_(`lucide-${t4(e)}`,r),...a}));return n.displayName=`${e}`,n};/**
90 * @license lucide-react v0.462.0 - ISC
91 *
92 * This source code is licensed under the ISC license.
93 * See the LICENSE file in the root directory of this source tree.
94 */const jl=_e("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);/**
95 * @license lucide-react v0.462.0 - ISC
96 *
97 * This source code is licensed under the ISC license.
98 * See the LICENSE file in the root directory of this source tree.
99 */const s4=_e("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);/**
100 * @license lucide-react v0.462.0 - ISC
101 *
102 * This source code is licensed under the ISC license.
103 * See the LICENSE file in the root directory of this source tree.
104 */const a4=_e("BellRing",[["path",{d:"M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9",key:"1qo2s2"}],["path",{d:"M10.3 21a1.94 1.94 0 0 0 3.4 0",key:"qgo35s"}],["path",{d:"M4 2C2.8 3.7 2 5.7 2 8",key:"tap9e0"}],["path",{d:"M22 8c0-2.3-.8-4.3-2-6",key:"5bb3ad"}]]);/**
105 * @license lucide-react v0.462.0 - ISC
106 *
107 * This source code is licensed under the ISC license.
108 * See the LICENSE file in the root directory of this source tree.
109 */const i4=_e("Bell",[["path",{d:"M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9",key:"1qo2s2"}],["path",{d:"M10.3 21a1.94 1.94 0 0 0 3.4 0",key:"qgo35s"}]]);/**
110 * @license lucide-react v0.462.0 - ISC
111 *
112 * This source code is licensed under the ISC license.
113 * See the LICENSE file in the root directory of this source tree.
114 */const Qa=_e("Camera",[["path",{d:"M14.5 4h-5L7 7H4a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-3l-2.5-3z",key:"1tc9qg"}],["circle",{cx:"12",cy:"13",r:"3",key:"1vg3eu"}]]);/**
115 * @license lucide-react v0.462.0 - ISC
116 *
117 * This source code is licensed under the ISC license.
118 * See the LICENSE file in the root directory of this source tree.
119 */const o4=_e("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"}]]);/**
120 * @license lucide-react v0.462.0 - ISC
121 *
122 * This source code is licensed under the ISC license.
123 * See the LICENSE file in the root directory of this source tree.
124 */const Mr=_e("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/**
125 * @license lucide-react v0.462.0 - ISC
126 *
127 * This source code is licensed under the ISC license.
128 * See the LICENSE file in the root directory of this source tree.
129 */const lb=_e("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/**
130 * @license lucide-react v0.462.0 - ISC
131 *
132 * This source code is licensed under the ISC license.
133 * See the LICENSE file in the root directory of this source tree.
134 */const Rn=_e("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);/**
135 * @license lucide-react v0.462.0 - ISC
136 *
137 * This source code is licensed under the ISC license.
138 * See the LICENSE file in the root directory of this source tree.
139 */const Jd=_e("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/**
140 * @license lucide-react v0.462.0 - ISC
141 *
142 * This source code is licensed under the ISC license.
143 * See the LICENSE file in the root directory of this source tree.
144 */const tp=_e("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);/**
145 * @license lucide-react v0.462.0 - ISC
146 *
147 * This source code is licensed under the ISC license.
148 * See the LICENSE file in the root directory of this source tree.
149 */const l4=_e("CircleAlert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);/**
150 * @license lucide-react v0.462.0 - ISC
151 *
152 * This source code is licensed under the ISC license.
153 * See the LICENSE file in the root directory of this source tree.
154 */const ra=_e("CircleCheckBig",[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]);/**
155 * @license lucide-react v0.462.0 - ISC
156 *
157 * This source code is licensed under the ISC license.
158 * See the LICENSE file in the root directory of this source tree.
159 */const Xd=_e("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"}]]);/**
160 * @license lucide-react v0.462.0 - ISC
161 *
162 * This source code is licensed under the ISC license.
163 * See the LICENSE file in the root directory of this source tree.
164 */const er=_e("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);/**
165 * @license lucide-react v0.462.0 - ISC
166 *
167 * This source code is licensed under the ISC license.
168 * See the LICENSE file in the root directory of this source tree.
169 */const Zd=_e("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"}]]);/**
170 * @license lucide-react v0.462.0 - ISC
171 *
172 * This source code is licensed under the ISC license.
173 * See the LICENSE file in the root directory of this source tree.
174 */const np=_e("CreditCard",[["rect",{width:"20",height:"14",x:"2",y:"5",rx:"2",key:"ynyp8z"}],["line",{x1:"2",x2:"22",y1:"10",y2:"10",key:"1b3vmo"}]]);/**
175 * @license lucide-react v0.462.0 - ISC
176 *
177 * This source code is licensed under the ISC license.
178 * See the LICENSE file in the root directory of this source tree.
179 */const cs=_e("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"}]]);/**
180 * @license lucide-react v0.462.0 - ISC
181 *
182 * This source code is licensed under the ISC license.
183 * See the LICENSE file in the root directory of this source tree.
184 */const $t=_e("DollarSign",[["line",{x1:"12",x2:"12",y1:"2",y2:"22",key:"7eqyqh"}],["path",{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6",key:"1b0p4s"}]]);/**
185 * @license lucide-react v0.462.0 - ISC
186 *
187 * This source code is licensed under the ISC license.
188 * See the LICENSE file in the root directory of this source tree.
189 */const y_=_e("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"}]]);/**
190 * @license lucide-react v0.462.0 - ISC
191 *
192 * This source code is licensed under the ISC license.
193 * See the LICENSE file in the root directory of this source tree.
194 */const v_=_e("EyeOff",[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/**
195 * @license lucide-react v0.462.0 - ISC
196 *
197 * This source code is licensed under the ISC license.
198 * See the LICENSE file in the root directory of this source tree.
199 */const w_=_e("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"}]]);/**
200 * @license lucide-react v0.462.0 - ISC
201 *
202 * This source code is licensed under the ISC license.
203 * See the LICENSE file in the root directory of this source tree.
204 */const Ft=_e("Gift",[["rect",{x:"3",y:"8",width:"18",height:"4",rx:"1",key:"bkv52"}],["path",{d:"M12 8v13",key:"1c76mn"}],["path",{d:"M19 12v7a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2v-7",key:"6wjy6b"}],["path",{d:"M7.5 8a2.5 2.5 0 0 1 0-5A4.8 8 0 0 1 12 8a4.8 8 0 0 1 4.5-5 2.5 2.5 0 0 1 0 5",key:"1ihvrl"}]]);/**
205 * @license lucide-react v0.462.0 - ISC
206 *
207 * This source code is licensed under the ISC license.
208 * See the LICENSE file in the root directory of this source tree.
209 */const $0=_e("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"}]]);/**
210 * @license lucide-react v0.462.0 - ISC
211 *
212 * This source code is licensed under the ISC license.
213 * See the LICENSE file in the root directory of this source tree.
214 */const c4=_e("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"}]]);/**
215 * @license lucide-react v0.462.0 - ISC
216 *
217 * This source code is licensed under the ISC license.
218 * See the LICENSE file in the root directory of this source tree.
219 */const u4=_e("ImagePlus",[["path",{d:"M16 5h6",key:"1vod17"}],["path",{d:"M19 2v6",key:"4bpg5p"}],["path",{d:"M21 11.5V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h7.5",key:"1ue2ih"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}]]);/**
220 * @license lucide-react v0.462.0 - ISC
221 *
222 * This source code is licensed under the ISC license.
223 * See the LICENSE file in the root directory of this source tree.
224 */const cb=_e("Image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]);/**
225 * @license lucide-react v0.462.0 - ISC
226 *
227 * This source code is licensed under the ISC license.
228 * See the LICENSE file in the root directory of this source tree.
229 */const __=_e("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"}]]);/**
230 * @license lucide-react v0.462.0 - ISC
231 *
232 * This source code is licensed under the ISC license.
233 * See the LICENSE file in the root directory of this source tree.
234 */const Yl=_e("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"}]]);/**
235 * @license lucide-react v0.462.0 - ISC
236 *
237 * This source code is licensed under the ISC license.
238 * See the LICENSE file in the root directory of this source tree.
239 */const us=_e("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/**
240 * @license lucide-react v0.462.0 - ISC
241 *
242 * This source code is licensed under the ISC license.
243 * See the LICENSE file in the root directory of this source tree.
244 */const ja=_e("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"}]]);/**
245 * @license lucide-react v0.462.0 - ISC
246 *
247 * This source code is licensed under the ISC license.
248 * See the LICENSE file in the root directory of this source tree.
249 */const d4=_e("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"}]]);/**
250 * @license lucide-react v0.462.0 - ISC
251 *
252 * This source code is licensed under the ISC license.
253 * See the LICENSE file in the root directory of this source tree.
254 */const h4=_e("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"}]]);/**
255 * @license lucide-react v0.462.0 - ISC
256 *
257 * This source code is licensed under the ISC license.
258 * See the LICENSE file in the root directory of this source tree.
259 */const f4=_e("Menu",[["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}],["line",{x1:"4",x2:"20",y1:"6",y2:"6",key:"1owob3"}],["line",{x1:"4",x2:"20",y1:"18",y2:"18",key:"yk5zj1"}]]);/**
260 * @license lucide-react v0.462.0 - ISC
261 *
262 * This source code is licensed under the ISC license.
263 * See the LICENSE file in the root directory of this source tree.
264 */const An=_e("MessageCircle",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}]]);/**
265 * @license lucide-react v0.462.0 - ISC
266 *
267 * This source code is licensed under the ISC license.
268 * See the LICENSE file in the root directory of this source tree.
269 */const m4=_e("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"}]]);/**
270 * @license lucide-react v0.462.0 - ISC
271 *
272 * This source code is licensed under the ISC license.
273 * See the LICENSE file in the root directory of this source tree.
274 */const p4=_e("MicOff",[["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}],["path",{d:"M18.89 13.23A7.12 7.12 0 0 0 19 12v-2",key:"80xlxr"}],["path",{d:"M5 10v2a7 7 0 0 0 12 5",key:"p2k8kg"}],["path",{d:"M15 9.34V5a3 3 0 0 0-5.68-1.33",key:"1gzdoj"}],["path",{d:"M9 9v3a3 3 0 0 0 5.12 2.12",key:"r2i35w"}],["line",{x1:"12",x2:"12",y1:"19",y2:"22",key:"x3vr5v"}]]);/**
275 * @license lucide-react v0.462.0 - ISC
276 *
277 * This source code is licensed under the ISC license.
278 * See the LICENSE file in the root directory of this source tree.
279 */const x4=_e("Mic",[["path",{d:"M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3Z",key:"131961"}],["path",{d:"M19 10v2a7 7 0 0 1-14 0v-2",key:"1vc78b"}],["line",{x1:"12",x2:"12",y1:"19",y2:"22",key:"x3vr5v"}]]);/**
280 * @license lucide-react v0.462.0 - ISC
281 *
282 * This source code is licensed under the ISC license.
283 * See the LICENSE file in the root directory of this source tree.
284 */const g4=_e("Package",[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["path",{d:"m3.3 7 7.703 4.734a2 2 0 0 0 1.994 0L20.7 7",key:"yx3hmr"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]]);/**
285 * @license lucide-react v0.462.0 - ISC
286 *
287 * This source code is licensed under the ISC license.
288 * See the LICENSE file in the root directory of this source tree.
289 */const b4=_e("Pause",[["rect",{x:"14",y:"4",width:"4",height:"16",rx:"1",key:"zuxfzm"}],["rect",{x:"6",y:"4",width:"4",height:"16",rx:"1",key:"1okwgv"}]]);/**
290 * @license lucide-react v0.462.0 - ISC
291 *
292 * This source code is licensed under the ISC license.
293 * See the LICENSE file in the root directory of this source tree.
294 */const bd=_e("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"}]]);/**
295 * @license lucide-react v0.462.0 - ISC
296 *
297 * This source code is licensed under the ISC license.
298 * See the LICENSE file in the root directory of this source tree.
299 */const y4=_e("PhoneOff",[["path",{d:"M10.68 13.31a16 16 0 0 0 3.41 2.6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7 2 2 0 0 1 1.72 2v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.42 19.42 0 0 1-3.33-2.67m
299-2.67-3.34a19.79 19.79 0 0 1-3.07-8.63A2 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.91",key:"z86iuo"}],["line",{x1:"22",x2:"2",y1:"2",y2:"22",key:"11kh81"}]]);/**
300 * @license lucide-react v0.462.0 - ISC
301 *
302 * This source code is licensed under the ISC license.
303 * See the LICENSE file in the root directory of this source tree.
304 */const v4=_e("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"}]]);/**
305 * @license lucide-react v0.462.0 - ISC
306 *
307 * This source code is licensed under the ISC license.
308 * See the LICENSE file in the root directory of this source tree.
309 */const w4=_e("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]]);/**
310 * @license lucide-react v0.462.0 - ISC
311 *
312 * This source code is licensed under the ISC license.
313 * See the LICENSE file in the root directory of this source tree.
314 */const _4=_e("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"}]]);/**
315 * @license lucide-react v0.462.0 - ISC
316 *
317 * This source code is licensed under the ISC license.
318 * See the LICENSE file in the root directory of this source tree.
319 */const j4=_e("RotateCw",[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]]);/**
320 * @license lucide-react v0.462.0 - ISC
321 *
322 * This source code is licensed under the ISC license.
323 * See the LICENSE file in the root directory of this source tree.
324 */const j_=_e("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/**
325 * @license lucide-react v0.462.0 - ISC
326 *
327 * This source code is licensed under the ISC license.
328 * See the LICENSE file in the root directory of this source tree.
329 */const eh=_e("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"}]]);/**
330 * @license lucide-react v0.462.0 - ISC
331 *
332 * This source code is licensed under the ISC license.
333 * See the LICENSE file in the root directory of this source tree.
334 */const N4=_e("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"}]]);/**
335 * @license lucide-react v0.462.0 - ISC
336 *
337 * This source code is licensed under the ISC license.
338 * See the LICENSE file in the root directory of this source tree.
339 */const k4=_e("ShieldX",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m14.5 9.5-5 5",key:"17q4r4"}],["path",{d:"m9.5 9.5 5 5",key:"18nt4w"}]]);/**
340 * @license lucide-react v0.462.0 - ISC
341 *
342 * This source code is licensed under the ISC license.
343 * See the LICENSE file in the root directory of this source tree.
344 */const N_=_e("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"}]]);/**
345 * @license lucide-react v0.462.0 - ISC
346 *
347 * This source code is licensed under the ISC license.
348 * See the LICENSE file in the root directory of this source tree.
349 */const S4=_e("ShoppingCart",[["circle",{cx:"8",cy:"21",r:"1",key:"jimo8o"}
349],["circle",{cx:"19",cy:"21",r:"1",key:"13723u"}],["path",{d:"M2.05 2.05h2l2.66 12.42a2 2 0 0 0 2 1.58h9.78a2 2 0 0 0 1.95-1.57l1.65-7.43H5.12",key:"9zh506"}]]);/**
350 * @license lucide-react v0.462.0 - ISC
351 *
352 * This source code is licensed under the ISC license.
353 * See the LICENSE file in the root directory of this source tree.
354 */const C4=_e("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"}]]);/**
355 * @license lucide-react v0.462.0 - ISC
356 *
357 * This source code is licensed under the ISC license.
358 * See the LICENSE file in the root directory of this source tree.
359 */const E4=_e("Snowflake",[["line",{x1:"2",x2:"22",y1:"12",y2:"12",key:"1dnqot"}],["line",{x1:"12",x2:"12",y1:"2",y2:"22",key:"7eqyqh"}],["path",{d:"m20 16-4-4 4-4",key:"rquw4f"}],["path",{d:"m4 8 4 4-4 4",key:"12s3z9"}],["path",{d:"m16 4-4 4-4-4",key:"1tumq1"}],["path",{d:"m8 20 4-4 4 4",key:"9p200w"}]]);/**
360 * @license lucide-react v0.462.0 - ISC
361 *
362 * This source code is licensed under the ISC license.
363 * See the LICENSE file in the root directory of this source tree.
364 */const yr=_e("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"}]]);/**
365 * @license lucide-react v0.462.0 - ISC
366 *
367 * This source code is licensed under the ISC license.
368 * See the LICENSE file in the root directory of this source tree.
369 */const Ql=_e("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"}]]);/**
370 * @license lucide-react v0.462.0 - ISC
371 *
372 * This source code is licensed under the ISC license.
373 * See the LICENSE file in the root directory of this source tree.
374 */const P4=_e("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"}]]);/**
375 * @license lucide-react v0.462.0 - ISC
376 *
377 * This source code is licensed under the ISC license.
378 * See the LICENSE file in the root directory of this source tree.
379 */const th=_e("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"}]]);/**
380 * @license lucide-react v0.462.0 - ISC
381 *
382 * This source code is licensed under the ISC license.
383 * See the LICENSE file in the root directory of this source tree.
384 */const Co=_e("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"}]]);/**
385 * @license lucide-react v0.462.0 - ISC
386 *
387 * This source code is licensed under the ISC license.
388 * See the LICENSE file in the root directory of this source tree.
389 */const ds=_e("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"}]]);/**
390 * @license lucide-react v0.462.0 - ISC
391 *
392 * This source code is licensed under the ISC license.
393 * See the LICENSE file in the root directory of this source tree.
394 */const T4=_e("Upload",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]]);/**
395 * @license lucide-react v0.462.0 - ISC
396 *
397 * This source code is licensed under the ISC license.
398 * See the LICENSE file in the root directory of this source tree.
399 */const k_=_e("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"}]]);/**
400 * @license lucide-react v0.462.0 - ISC
401 *
402 * This source code is licensed under the ISC license.
403 * See the LICENSE file in the root directory of this source tree.
404 */const Ur=_e("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"}]]);/**
405 * @license lucide-react v0.462.0 - ISC
406 *
407 * This source code is licensed under the ISC license.
408 * See the LICENSE file in the root directory of this source tree.
409 */const R4=_e("VideoOff",[["path",{d:"M10.66 6H14a2 2 0 0 1 2 2v2.5l5.248-3.062A.5.5 0 0 1 22 7.87v8.196",key:"w8jjjt"}],["path",{d:"M16 16a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h2",key:"1xawa7"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/**
410 * @license lucide-react v0.462.0 - ISC
411 *
412 * This source code is licensed under the ISC license.
413 * See the LICENSE file in the root directory of this source tree.
414 */const mr=_e("Video",[["path",{d:"m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5",key:"ftymec"}],["rect",{x:"2",y:"6",width:"14",height:"12",rx:"2",key:"158x01"}]]);/**
415 * @license lucide-react v0.462.0 - ISC
416 *
417 * This source code is licensed under the ISC license.
418 * See the LICENSE file in the root directory of this source tree.
419 */const A4=_e("Wifi",[["path",{d:"M12 20h.01",key:"zekei9"}
vendor: 6,134 bytes, lines 419-429
419],["path",{d:"M2 8.82a15 15 0 0 1 20 0",key:"dnpr2z"}],["path",{d:"M5 12.859a10 10 0 0 1 14 0",key:"1x1e6c"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}]]);/**
420 * @license lucide-react v0.462.0 - ISC
421 *
422 * This source code is licensed under the ISC license.
423 * See the LICENSE file in the root directory of this source tree.
424 */const We=_e("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);/**
425 * @license lucide-react v0.462.0 - ISC
426 *
427 * This source code is licensed under the ISC license.
428 * See the LICENSE file in the root directory of this source tree.
429 */const nh=_e("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"}]]),F0="-",I4=e=>{const t=D4(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:o=>{const l=o.split(F0);return l[0]===""&&l.length!==1&&l.shift(),S_(l,t)||O4(o)},getConflictingClassGroupIds:(o,l)=>{const c=n[o]||[];return l&&r[o]?[...c,...r[o]]:c}}},S_=(e,t)=>{var o;if(e.length===0)return t.classGroupId;const n=e[0],r=t.nextPart.get(n),a=r?S_(e.slice(1),r):void 0;if(a)return a;if(t.validators.length===0)return;const i=e.join(F0);return(o=t.validators.find(({validator:l})=>l(i)))==null?void 0:o.classGroupId},ub=/^\[(.+)\]$/,O4=e=>{if(ub.test(e)){const t=ub.exec(e)[1],n=t==null?void 0:t.substring(0,t.indexOf(":"));if(n)return"arbitrary.."+n}},D4=e=>{const{theme:t,prefix:n}=e,r={nextPart:new Map,validators:[]};return M4(Object.entries(e.classGroups),n).forEach(([i,o])=>{rp(o,r,i,t)}),r},rp=(e,t,n,r)=>{e.forEach(a=>{if(typeof a=="string"){const i=a===""?t:db(t,a);i.classGroupId=n;return}if(typeof a=="function"){if(L4(a)){rp(a(r),t,n,r);return}t.validators.push({validator:a,classGroupId:n});return}Object.entries(a).forEach(([i,o])=>{rp(o,db(t,i),n,r)})})},db=(e,t)=>{let n=e;return t.split(F0).forEach(r=>{n.nextPart.has(r)||n.nextPart.set(r,{nextPart:new Map,validators:[]}),n=n.nextPart.get(r)}),n},L4=e=>e.isThemeGetter,M4=(e,t)=>t?e.map(([n,r])=>{const a=r.map(i=>typeof i=="string"?t+i:typeof i=="object"?Object.fromEntries(Object.entries(i).map(([o,l])=>[t+o,l])):i);return[n,a]}):e,$4=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=new Map,r=new Map;const a=(i,o)=>{n.set(i,o),t++,t>e&&(t=0,r=n,n=new Map)};return{get(i){let o=n.get(i);if(o!==void 0)return o;if((o=r.get(i))!==void 0)return a(i,o),o},set(i,o){n.has(i)?n.set(i,o):a(i,o)}}},C_="!",F4=e=>{const{separator:t,experimentalParseClassName:n}=e,r=t.length===1,a=t[0],i=t.length,o=l=>{const c=[];let d=0,u=0,f;for(let y=0;y<l.length;y++){let b=l[y];if(d===0){if(b===a&&(r||l.slice(y,y+i)===t)){c.push(l.slice(u,y)),u=y+i;continue}if(b==="/"){f=y;continue}}b==="["?d++:b==="]"&&d--}const m=c.length===0?l:l.substring(u),p=m.startsWith(C_),v=p?m.substring(1):m,g=f&&f>u?f-u:void 0;return{modifiers:c,hasImportantModifier:p,baseClassName:v,maybePostfixModifierPosition:g}};return n?l=>n({className:l,parseClassName:o}):o},U4=e=>{if(e.length<=1)return e;const t=[];let n=[];return e.forEach(r=>{r[0]==="["?(t.push(...n.sort(),r),n=[]):n.push(r)}),t.push(...n.sort()),t},B4=e=>({cache:$4(e.cacheSize),parseClassName:F4(e),...I4(e)}),z4=/\s+/,q4=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:a}=t,i=[],o=e.trim().split(z4);let l="";for(let c=o.length-1;c>=0;c-=1){const d=o[c],{modifiers:u,hasImportantModifier:f,baseClassName:m,maybePostfixModifierPosition:p}=n(d);let v=!!p,g=r(v?m.substring(0,p):m);if(!g){if(!v){l=d+(l.length>0?" "+l:l);continue}if(g=r(m),!g){l=d+(l.length>0?" "+l:l);continue}v=!1}const y=U4(u).join(":"),b=f?y+C_:y,x=b+g;if(i.includes(x))continue;i.push(x);const w=a(g,v);for(let _=0;_<w.length;++_){const j=w[_];i.push(b+j)}l=d+(l.length>0?" "+l:l)}return l};function V4(){let e=0,t,n,r="";for(;e<arguments.length;)(t=arguments[e++])&&(n=E_(t))&&(r&&(r+=" "),r+=n);return r}const E_=e=>{if(typeof e=="string")return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=E_(e[r]))&&(n&&(n+=" "),n+=t);return n};function W4(e,...t){let n,r,a,i=o;function o(c){const d=t.reduce((u,f)=>f(u),e());return n=B4(d),r=n.cache.get,a=n.cache.set,i=l,l(c)}function l(c){const d=r(c);if(d)return d;const u=q4(c,n);return a(c,u),u}return function(){return i(V4.apply(null,arguments))}}const xt=e=>{const t=n=>n[e]||[];return t.isThemeGetter=!0,t},P_=/^\[(?:([a-z-]+):)?(.+)\]$/i,H4=/^\d+\/\d+$/,G4=new Set(["px","full","screen"]),K4=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Y4=/\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$/,Q4=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,J4=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,X4=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Wr=e=>Vi(e)||G4.has(e)||H4.test(e),ws=e=>Eo(e,"length",iP),Vi=e=>!!e&&!Number.isNaN(Number(e)),lf=e=>Eo(e,"number",Vi),el=e=>!!e&&Number.isInteger(Number(e)),Z4=e=>e.endsWith("%")&&Vi(e.slice(0,-1)),Be=e=>P_.test(e),_s=e=>K4.test(e),eP=new Set(["length","size","percentage"]),tP=e=>Eo(e,eP,T_),nP=e=>Eo(e,"position",T_),rP=new Set(["image","url"]),sP=e=>Eo(e,rP,lP),aP=e=>Eo(e,"",oP),tl=()=>!0,Eo=(e,t,n)=>{const r=P_.exec(e);return r?r[1]?typeof t=="string"?r[1]===t:t.has(r[1]):n(r[2]):!1},iP=e=>Y4.test(e)&&!Q4.test(e),T_=()=>!1,oP=e=>J4.test(e),lP=e=>X4.test(e),cP=()=>{const e=xt("colors"),t=xt("spacing"),n=xt("blur"),r=xt("brightness"),a=xt("borderColor"),i=xt("borderRadius"),o=xt("borderSpacing"),l=xt("borderWidth"),c=xt("contrast"),d=xt("grayscale"),u=xt("hueRotate"),f=xt("invert"),m=xt("gap"),p=xt("gradientColorStops"),v=xt("gradientColorStopPositions"),g=xt("inset"),y=xt("margin"),b=xt("opacity"),x=xt("padding"),w=xt("saturate"),_=xt("scale"),j=xt("sepia"),N=xt("skew"),k=xt("space"),C=xt("translate"),A=()=>["auto","contain","none"],I=()=>["auto","hidden","clip","visible","scroll"],O=()=>["auto",Be,t],P=()=>[Be,t],T=()=>["",Wr,ws],E=()=>["auto",Vi,Be],W=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],
vendor: 12,071 bytes, line 429
429V=()=>["solid","dashed","dotted","double","none"],q=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],D=()=>["start","end","center","between","around","evenly","stretch"],$=()=>["","0",Be],z=()=>["auto","avoid","all","avoid-page","page","left","right","column"],R=()=>[Vi,Be];return{cacheSize:500,separator:":",theme:{colors:[tl],spacing:[Wr,ws],blur:["none","",_s,Be],brightness:R(),borderColor:[e],borderRadius:["none","","full",_s,Be],borderSpacing:P(),borderWidth:T(),contrast:R(),grayscale:$(),hueRotate:R(),invert:$(),gap:P(),gradientColorStops:[e],gradientColorStopPositions:[Z4,ws],inset:O(),margin:O(),opacity:R(),padding:P(),saturate:R(),scale:R(),sepia:$(),skew:R(),space:P(),translate:P()},classGroups:{aspect:[{aspect:["auto","square","video",Be]}],container:["container"],columns:[{columns:[_s]}],"break-after":[{"break-after":z()}],"break-before":[{"break-before":z()}],"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:[...W(),Be]}],overflow:[{overflow:I()}],"overflow-x":[{"overflow-x":I()}],"overflow-y":[{"overflow-y":I()}],overscroll:[{overscroll:A()}],"overscroll-x":[{"overscroll-x":A()}],"overscroll-y":[{"overscroll-y":A()}],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",el,Be]}],basis:[{basis:O()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",Be]}],grow:[{grow:$()}],shrink:[{shrink:$()}],order:[{order:["first","last","none",el,Be]}],"grid-cols":[{"grid-cols":[tl]}],"col-start-end":[{col:["auto",{span:["full",el,Be]},Be]}],"col-start":[{"col-start":E()}],"col-end":[{"col-end":E()}],"grid-rows":[{"grid-rows":[tl]}],"row-start-end":[{row:["auto",{span:[el,Be]},Be]}],"row-start":[{"row-start":E()}],"row-end":[{"row-end":E()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",Be]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",Be]}],gap:[{gap:[m]}],"gap-x":[{"gap-x":[m]}],"gap-y":[{"gap-y":[m]}],"justify-content":[{justify:["normal",...D()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...D(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...D(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[x]}],px:[{px:[x]}],py:[{py:[x]}],ps:[{ps:[x]}],pe:[{pe:[x]}],pt:[{pt:[x]}],pr:[{pr:[x]}],pb:[{pb:[x]}],pl:[{pl:[x]}],m:[{m:[y]}],mx:[{mx:[y]}],my:[{my:[y]}],ms:[{ms:[y]}],me:[{me:[y]}],mt:[{mt:[y]}],mr:[{mr:[y]}],mb:[{mb:[y]}],ml:[{ml:[y]}],"space-x":[{"space-x":[k]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[k]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",Be,t]}],"min-w":[{"min-w":[Be,t,"min","max","fit"]}],"max-w":[{"max-w":[Be,t,"none","full","min","max","fit","prose",{screen:[_s]},_s]}],h:[{h:[Be,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[Be,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[Be,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[Be,t,"auto","min","max","fit"]}],"font-size":[{text:["base",_s,ws]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",lf]}],"font-family":[{font:[tl]}],"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",Be]}],"line-clamp":[{"line-clamp":["none",Vi,lf]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",Wr,Be]}],"list-image":[{"list-image":["none",Be]}],"list-style-type":[{list:["none","disc","decimal",Be]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[b]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[b]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...V(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",Wr,ws]}],"underline-offset":[{"underline-offset":["auto",Wr,Be]}],"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:P()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Be]}],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",Be]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[b]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...W(),nP]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",tP]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},sP]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[v]}],"gradient-via-pos":[{via:[v]}],"gradient-to-pos":[{to:[v]}],"gradient-from":[{from:[p]}],"gradient-via":[{via:[p]}],"gradient-to":[{to:[p]}],rounded:[{rounded:[i]}],"rounded-s":[{"rounded-s":[i]}],"rounded-e":[{"rounded-e":[i]}],"rounded-t":[{"rounded-t":[i]}],"rounded-r":[{"rounded-r":[i]}],"rounded-b":[{"rounded-b":[i]}],"rounded-l":[{"rounded-l":[i]}],"rounded-ss":[{"rounded-ss":[i]}],"rounded-se":[{"rounded-se":[i]}],"rounded-ee":[{"rounded-ee":[i]}],"rounded-es":[{"rounded-es":[i]}],"rounded-tl":[{"rounded-tl":[i]}],"rounded-tr":[{"rounded-tr":[i]}],"rounded-br":[{"rounded-br":[i]}],"rounded-bl":[{"rounded-bl":[i]}],"border-w":[{border:[l]}],"border-w-x":[{"border-x":[l]}],"border-w-y":[{"border-y":[l]}],"border-w-s":[{"border-s":[l]}],"border-w-e":[{"border-e":[l]}],"border-w-t":[{"border-t":[l]}],"border-w-r":[{"border-r":[l]}],"border-w-b":[{"border-b":[l]}],"border-w-l":[{"border-l":[l]}],"border-opacity":[{"border-opacity":[b]}],"border-style":[{border:[...V(),"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":[b]}],"divide-style":[{divide:V()}],"border-color":[{border:[a]}],"border-color-x":[{"border-x":[a]}],"border-color-y":[{"border-y":[a]}],"border-color-s":[{"border-s":[a]}],"border-color-e":[{"border-e":[a]}],"border-color-t":[{"border-t":[a]}],"border-color-r":[{"border-r":[a]}],"border-color-b":[{"border-b":[a]}],"border-color-l":[{"border-l":[a]}],"divide-color":[{divide:[a]}],"outline-style":[{outline:["",...V()]}],"outline-offset":[{"outline-offset":[Wr,Be]}],"outline-w":[{outline:[Wr,ws]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:T()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[b]}],"ring-offset-w":[{"ring-offset":[Wr,ws]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",_s,aP]}],"shadow-color":[{shadow:[tl]}],opacity:[{opacity:[b]}],"mix-blend":[{"mix-blend":[...q(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":q()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[r]}],contrast:[{contrast:[c]}],"drop-shadow":[{"drop-shadow":["","none",_s,Be]}],grayscale:[{grayscale:[d]}],"hue-rotate":[{"hue-rotate":[u]}],invert:[{invert:[f]}],saturate:[{saturate:[w]}],sepia:[{sepia:[j]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"backdrop-contrast":[{"backdrop-contrast":[c]}],"backdrop-grayscale":[{"backdrop-grayscale":[d]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[u]}],"backdrop-invert":[{"backdrop-invert":[f]}],"backdrop-opacity":[{"backdrop-opacity":[b]}],"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",Be]}],duration:[{duration:R()}],ease:[{ease:["linear","in","out","in-out",Be]}],delay:[{delay:R()}],animate:[{animate:["none","spin","ping","pulse","bounce",Be]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[_]}],"scale-x":[{"scale-x":[_]}],"scale-y":[{"scale-y":[_]}],rotate:[{rotate:[el,Be]}],"translate-x":[{"translate-x":[C]}],"translate-y":[{"translate-y":[C]}],"skew-x":[{"skew-x":[N]}],"skew-y":[{"skew-y":[N]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",Be]}],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",Be]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":P()}],"scroll-mx":[{"scroll-mx":P()}],"scroll-my":[{"scroll-my":P()}],"scroll-ms":[{"scroll-ms":P()}],"scroll-me":[{"scroll-me":P()}],"scroll-mt":[{"scroll-mt":P()}],"scroll-mr":[{"scroll-mr":P()}],"scroll-mb":[{"scroll-mb":P()}],"scroll-ml":[{"scroll-ml":P()}],"scroll-p":[{"scroll-p":P()}],"scroll-px":[{"scroll-px":P()}],"scroll-py":[{"scroll-py":P()}],"scroll-ps":[{"scroll-ps":P()}],"scroll-pe":[{"scroll-pe":P()}],"scroll-pt":[{"scroll-pt":P()}],"scroll-pr":[{"scroll-pr":P()}],"scroll-pb":[{"scroll-pb":P()}],"scroll-pl":[{"scroll-pl":P()}],"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"]}
429],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",Be]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[Wr,ws,lf]}],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"]}}},uP=W4(cP);function Ct(...e){return uP(x_(e))}const dP=e4,R_=h.forwardRef(({className:e,...t},n)=>s.jsx(c_,{ref:n,className:Ct("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}));R_.displayName=c_.displayName;const hP=g_("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"}}),A_=h.forwardRef(({className:e,variant:t,...n},r)=>s.jsx(u_,{ref:r,className:Ct(hP({variant:t}),e),...n}));A_.displayName=u_.displayName;const fP=h.forwardRef(({className:e,...t},n)=>s.jsx(f_,{ref:n,className:Ct("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}));fP.displayName=f_.displayName;const I_=h.forwardRef(({className:e,...t},n)=>s.jsx(m_,{ref:n,className:Ct("absolute right-2 top-2 rounded-md p-1 text-foreground
429/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:s.jsx(We,{className:"h-4 w-4"})}));I_.displayName=m_.displayName;const O_=h.forwardRef(({className:e,...t},n)=>s.jsx(d_,{ref:n,className:Ct("text-sm font-semibold",e),...t}));O_.displayName=d_.displayName;const D_=h.forwardRef(({className:e,...t},n)=>s.jsx(h_,{ref:n,className:Ct("text-sm opacity-90",e),...t}));D_.displayName=h_.displayName;function mP(){const{toasts:e}=l5();return s.jsxs(dP,{children:[e.map(function({id:t,title:n,description:r,action:a,...i}){return s.jsxs(A_,{...i,children:[s.jsxs("div",{className:"grid gap-1",children:[n&&s.jsx(O_,{children:n}),r&&s.jsx(D_,{children:r})]}),a,s.jsx(I_,{})]},t)}),s.jsx(R_,{})]})}var pP=Op[" useId ".trim().toString()]||(()=>{}),xP=0;function cf(e){const[t,n]=h.useState(pP());return ls(()=>{n(r=>r??String(xP++))},[e]),t?`radix-${t}`:""}const gP=["top","right","bottom","left"],sa=Math.min,Mn=Math.max,yd=Math.round,lu=Math.floor,$r=e=>({x:e,y:e}),bP={left:"right",right:"left",bottom:"top",top:"bottom"},yP={start:"end",end:"start"};
vendor: 19,227 bytes, line 429
429function sp(e,t,n){return Mn(e,sa(t,n))}function hs(e,t){return typeof e=="function"?e(t):e}function fs(e){return e.split("-")[0]}function Po(e){return e.split("-")[1]}function U0(e){return e==="x"?"y":"x"}function B0(e){return e==="y"?"height":"width"}const vP=new Set(["top","bottom"]);function Or(e){return vP.has(fs(e))?"y":"x"}function z0(e){return U0(Or(e))}function wP(e,t,n){n===void 0&&(n=!1);const r=Po(e),a=z0(e),i=B0(a);let o=a==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(o=vd(o)),[o,vd(o)]}function _P(e){const t=vd(e);return[ap(e),t,ap(t)]}function ap(e){return e.replace(/start|end/g,t=>yP[t])}const hb=["left","right"],fb=["right","left"],jP=["top","bottom"],NP=["bottom","top"];function kP(e,t,n){switch(e){case"top":case"bottom":return n?t?fb:hb:t?hb:fb;case"left":case"right":return t?jP:NP;default:return[]}}function SP(e,t,n,r){const a=Po(e);let i=kP(fs(e),n==="start",r);return a&&(i=i.map(o=>o+"-"+a),t&&(i=i.concat(i.map(ap)))),i}function vd(e){return e.replace(/left|right|bottom|top/g,t=>bP[t])}function CP(e){return{top:0,right:0,bottom:0,left:0,...e}}function L_(e){return typeof e!="number"?CP(e):{top:e,right:e,bottom:e,left:e}}function wd(e){const{x:t,y:n,width:r,height:a}=e;return{width:r,height:a,top:n,left:t,right:t+r,bottom:n+a,x:t,y:n}}function mb(e,t,n){let{reference:r,floating:a}=e;const i=Or(t),o=z0(t),l=B0(o),c=fs(t),d=i==="y",u=r.x+r.width/2-a.width/2,f=r.y+r.height/2-a.height/2,m=r[l]/2-a[l]/2;let p;switch(c){case"top":p={x:u,y:r.y-a.height};break;case"bottom":p={x:u,y:r.y+r.height};break;case"right":p={x:r.x+r.width,y:f};break;case"left":p={x:r.x-a.width,y:f};break;default:p={x:r.x,y:r.y}}switch(Po(t)){case"start":p[o]-=m*(n&&d?-1:1);break;case"end":p[o]+=m*(n&&d?-1:1);break}return p}const EP=async(e,t,n)=>{const{placement:r="bottom",strategy:a="absolute",middleware:i=[],platform:o}=n,l=i.filter(Boolean),c=await(o.isRTL==null?void 0:o.isRTL(t));let d=await o.getElementRects({reference:e,floating:t,strategy:a}),{x:u,y:f}=mb(d,r,c),m=r,p={},v=0;for(let g=0;g<l.length;g++){const{name:y,fn:b}=l[g],{x,y:w,data:_,reset:j}=await b({x:u,y:f,initialPlacement:r,placement:m,strategy:a,middlewareData:p,rects:d,platform:o,elements:{reference:e,floating:t}});u=x??u,f=w??f,p={...p,[y]:{...p[y],..._}},j&&v<=50&&(v++,typeof j=="object"&&(j.placement&&(m=j.placement),j.rects&&(d=j.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:a}):j.rects),{x:u,y:f}=mb(d,m,c)),g=-1)}return{x:u,y:f,placement:m,strategy:a,middlewareData:p}};async function Jl(e,t){var n;t===void 0&&(t={});const{x:r,y:a,platform:i,rects:o,elements:l,strategy:c}=e,{boundary:d="clippingAncestors",rootBoundary:u="viewport",elementContext:f="floating",altBoundary:m=!1,padding:p=0}=hs(t,e),v=L_(p),y=l[m?f==="floating"?"reference":"floating":f],b=wd(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(y)))==null||n?y:y.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(l.floating)),boundary:d,rootBoundary:u,strategy:c})),x=f==="floating"?{x:r,y:a,width:o.floating.width,height:o.floating.height}:o.reference,w=await(i.getOffsetParent==null?void 0:i.getOffsetParent(l.floating)),_=await(i.isElement==null?void 0:i.isElement(w))?await(i.getScale==null?void 0:i.getScale(w))||{x:1,y:1}:{x:1,y:1},j=wd(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:x,offsetParent:w,strategy:c}):x);return{top:(b.top-j.top+v.top)/_.y,bottom:(j.bottom-b.bottom+v.bottom)/_.y,left:(b.left-j.left+v.left)/_.x,right:(j.right-b.right+v.right)/_.x}}const PP=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:a,rects:i,platform:o,elements:l,middlewareData:c}=t,{element:d,padding:u=0}=hs(e,t)||{};if(d==null)return{};const f=L_(u),m={x:n,y:r},p=z0(a),v=B0(p),g=await o.getDimensions(d),y=p==="y",b=y?"top":"left",x=y?"bottom":"right",w=y?"clientHeight":"clientWidth",_=i.reference[v]+i.reference[p]-m[p]-i.floating[v],j=m[p]-i.reference[p],N=await(o.getOffsetParent==null?void 0:o.getOffsetParent(d));let k=N?N[w]:0;(!k||!await(o.isElement==null?void 0:o.isElement(N)))&&(k=l.floating[w]||i.floating[v]);const C=_/2-j/2,A=k/2-g[v]/2-1,I=sa(f[b],A),O=sa(f[x],A),P=I,T=k-g[v]-O,E=k/2-g[v]/2+C,W=sp(P,E,T),V=!c.arrow&&Po(a)!=null&&E!==W&&i.reference[v]/2-(E<P?I:O)-g[v]/2<0,q=V?E<P?E-P:E-T:0;return{[p]:m[p]+q,data:{[p]:W,centerOffset:E-W-q,...V&&{alignmentOffset:q}},reset:V}}}),TP=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:a,middlewareData:i,rects:o,initialPlacement:l,platform:c,elements:d}=t,{mainAxis:u=!0,crossAxis:f=!0,fallbackPlacements:m,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:v="none",flipAlignment:g=!0,...y}=hs(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const b=fs(a),x=Or(l),w=fs(l)===l,_=await(c.isRTL==null?void 0:c.isRTL(d.floating)),j=m||(w||!g?[vd(l)]:_P(l)),N=v!=="none";!m&&N&&j.push(...SP(l,g,v,_));const k=[l,...j],C=await Jl(t,y),A=[];let I=((r=i.flip)==null?void 0:r.overflows)||[];if(u&&A.push(C[b]),f){const E=wP(a,o,_);A.push(C[E[0]],C[E[1]])}if(I=[...I,{placement:a,overflows:A}],!A.every(E=>E<=0)){var O,P;const E=(((O=i.flip)==null?void 0:O.index)||0)+1,W=k[E];if(W&&(!(f==="alignment"?x!==Or(W):!1)||I.every(D=>D.overflows[0]>0&&Or(D.placement)===x)))return{data:{index:E,overflows:I},reset:{placement:W}};let V=(P=I.filter(q=>q.overflows[0]<=0).sort((q,D)=>q.overflows[1]-D.overflows[1])[0])==null?void 0:P.placement;if(!V)switch(p){case"bestFit":{var T;const q=(T=I.filter(D=>{if(N){const $=Or(D.placement);return $===x||$==="y"}return!0}).map(D=>[D.placement,D.overflows.filter($=>$>0).reduce(($,z)=>$+z,0)]).sort((D,$)=>D[1]-$[1])[0])==null?void 0:T[0];q&&(V=q);break}case"initialPlacement":V=l;break}if(a!==V)return{reset:{placement:V}}}return{}}}};function pb(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function xb(e){return gP.some(t=>e[t]>=0)}const RP=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n}=t,{strategy:r="referenceHidden",...a}=hs(e,t);switch(r){case"referenceHidden":{const i=await Jl(t,{...a,elementContext:"reference"}),o=pb(i,n.reference);return{data:{referenceHiddenOffsets:o,referenceHidden:xb(o)}}}case"escaped":{const i=await Jl(t,{...a,altBoundary:!0}),o=pb(i,n.floating);return{data:{escapedOffsets:o,escaped:xb(o)}}}default:return{}}}}},M_=new Set(["left","top"]);async function AP(e,t){const{placement:n,platform:r,elements:a}=e,i=await(r.isRTL==null?void 0:r.isRTL(a.floating)),o=fs(n),l=Po(n),c=Or(n)==="y",d=M_.has(o)?-1:1,u=i&&c?-1:1,f=hs(t,e);let{mainAxis:m,crossAxis:p,alignmentAxis:v}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return l&&typeof v=="number"&&(p=l==="end"?v*-1:v),c?{x:p*u,y:m*d}:{x:m*d,y:p*u}}const IP=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:a,y:i,placement:o,middlewareData:l}=t,c=await AP(t,e);return o===((n=l.offset)==null?void 0:n.placement)&&(r=l.arrow)!=null&&r.alignmentOffset?{}:{x:a+c.x,y:i+c.y,data:{...c,placement:o}}}}},OP=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:a}=t,{mainAxis:i=!0,crossAxis:o=!1,limiter:l={fn:y=>{let{x:b,y:x}=y;return{x:b,y:x}}},...c}=hs(e,t),d={x:n,y:r},u=await Jl(t,c),f=Or(fs(a)),m=U0(f);let p=d[m],v=d[f];if(i){const y=m==="y"?"top":"left",b=m==="y"?"bottom":"right",x=p+u[y],w=p-u[b];p=sp(x,p,w)}if(o){const y=f==="y"?"top":"left",b=f==="y"?"bottom":"right",x=v+u[y],w=v-u[b];v=sp(x,v,w)}const g=l.fn({...t,[m]:p,[f]:v});return{...g,data:{x:g.x-n,y:g.y-r,enabled:{[m]:i,[f]:o}}}}}},DP=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:a,rects:i,middlewareData:o}=t,{offset:l=0,mainAxis:c=!0,crossAxis:d=!0}=hs(e,t),u={x:n,y:r},f=Or(a),m=U0(f);let p=u[m],v=u[f];const g=hs(l,t),y=typeof g=="number"?{mainAxis:g,crossAxis:0}:{mainAxis:0,crossAxis:0,...g};if(c){const w=m==="y"?"height":"width",_=i.reference[m]-i.floating[w]+y.mainAxis,j=i.reference[m]+i.reference[w]-y.mainAxis;p<_?p=_:p>j&&(p=j)}if(d){var b,x;const w=m==="y"?"width":"height",_=M_.has(fs(a)),j=i.reference[f]-i.floating[w]+(_&&((b=o.offset)==null?void 0:b[f])||0)+(_?0:y.crossAxis),N=i.reference[f]+i.reference[w]+(_?0:((x=o.offset)==null?void 0:x[f])||0)-(_?y.crossAxis:0);v<j?v=j:v>N&&(v=N)}return{[m]:p,[f]:v}}}},LP=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:a,rects:i,platform:o,elements:l}=t,{apply:c=()=>{},...d}=hs(e,t),u=await Jl(t,d),f=fs(a),m=Po(a),p=Or(a)==="y",{width:v,height:g}=i.floating;let y,b;f==="top"||f==="bottom"?(y=f,b=m===(await(o.isRTL==null?void 0:o.isRTL(l.floating))?"start":"end")?"left":"right"):(b=f,y=m==="end"?"top":"bottom");const x=g-u.top-u.bottom,w=v-u.left-u.right,_=sa(g-u[y],x),j=sa(v-u[b],w),N=!t.middlewareData.shift;let k=_,C=j;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(C=w),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(k=x),N&&!m){const I=Mn(u.left,0),O=Mn(u.right,0),P=Mn(u.top,0),T=Mn(u.bottom,0);p?C=v-2*(I!==0||O!==0?I+O:Mn(u.left,u.right)):k=g-2*(P!==0||T!==0?P+T:Mn(u.top,u.bottom))}await c({...t,availableWidth:C,availableHeight:k});const A=await o.getDimensions(l.floating);return v!==A.width||g!==A.height?{reset:{rects:!0}}:{}}}};function rh(){return typeof window<"u"}function To(e){return $_(e)?(e.nodeName||"").toLowerCase():"#document"}function Bn(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function qr(e){var t;return(t=($_(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function $_(e){return rh()?e instanceof Node||e instanceof Bn(e).Node:!1}function vr(e){return rh()?e instanceof Element||e instanceof Bn(e).Element:!1}function Br(e){return rh()?e instanceof HTMLElement||e instanceof Bn(e).HTMLElement:!1}function gb(e){return!rh()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Bn(e).ShadowRoot}const MP=new Set(["inline","contents"]);function vc(e){const{overflow:t,overflowX:n,overflowY:r,display:a}=wr(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!MP.has(a)}const $P=new Set(["table","td","th"]);function FP(e){return $P.has(To(e))}const UP=[":popover-open",":modal"];function sh(e){return UP.some(t=>{try{return e.matches(t)}catch{return!1}})}const BP=["transform","translate","scale","rotate","perspective"],zP=["transform","translate","scale","rotate","perspective","filter"],qP=["paint","layout","strict","content"];function q0(e){const t=V0(),n=vr(e)?wr(e):e;return BP.some(r=>n[r]?n[r]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||zP.some(r=>(n.willChange||"").includes(r))||qP.some(r=>(n.contain||"").includes(r))}function VP(e){let t=aa(e);for(;Br(t)&&!po(t);){if(q0(t))return t;if(sh(t))return null;t=aa(t)}return null}function V0(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const WP=new Set(["html","body","#document"]);function po(e){return WP.has(To(e))}function wr(e){return Bn(e).getComputedStyle(e)}function ah(e){return vr(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function aa(e){if(To(e)==="html")return e;const t=e.assignedSlot||e.parentNode||gb(e)&&e.host||qr(e);return gb(t)?t.host:t}function F_(e){const t=aa(e);return po(t)?e.ownerDocument?e.ownerDocument.body:e.body:Br(t)&&vc(t)?t:F_(t)}function Xl(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const a=F_(e),i=a===((r=e.ownerDocument)==null?void 0:r.body),o=Bn(a);if(i){const l=ip(o);return t.concat(o,o.visualViewport||[],vc(a)?a:[],l&&n?Xl(l):[])}return t.concat(a,Xl(a,[],n))}function ip(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function U_(e){const t=wr(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const a=Br(e),i=a?e.offsetWidth:n,o=a?e.offsetHeight:r,l=yd(n)!==i||yd(r)!==o;return l&&(n=i,r=o),{width:n,height:r,$:l}}function W0(e){return vr(e)?e:e.contextElement}function Wi(e){const t=W0(e);if(!Br(t))return $r(1);const n=t.getBoundingClientRect(),{width:r,height:a,$:i}=U_(t);let o=(i?yd(n.width):n.width)/r,l=(i?yd(n.height):n.height)/a;return(!o||!Number.isFinite(o))&&(o=1),(!l||!Number.isFinite(l))&&(l=1),{x:o,y:l}}const HP=$r(0);function B_(e){const t=Bn(e);return!V0()||!t.visualViewport?HP:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function GP(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Bn(e)?!1:t}function Ja(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const a=e.getBoundingClientRect(),i=W0(e);let o=$r(1);t&&(r?vr(r)&&(o=Wi(r)):o=Wi(e));const l=GP(i,n,r)?B_(i):$r(0);let c=(a.left+l.x)/o.x,d=(a.top+l.y)/o.y,u=a.width/o.x,f=a.height/o.y;if(i){const m=Bn(i),p=r&&vr(r)?Bn(r):r;let v=m,g=ip(v);for(;g&&r&&p!==v;){const y=Wi(g),b=g.getBoundingClientRect(),x=wr(g),w=b.left+(g.clientLeft+parseFloat(x.paddingLeft))*y.x,_=b.top+(g.clientTop+parseFloat(x.paddingTop))*y.y;c*=y.x,d*=y.y,u*=y.x,f*=y.y,c+=w,d+=_,v=Bn(g),g=ip(v)}}return wd({width:u,height:f,x:c,y:d})}function H0(e,t){const n=ah(e).scrollLeft;return t?t.left+n:Ja(qr(e)).left+n}function z_(e,t,n){n===void 0&&(n=!1);const r=e.getBoundingClientRect(),a=r.left+t.scrollLeft-(n?0:H0(e,r)),i=r.top+t.scrollTop;return{x:a,y:i}}function KP(e){let{elements:t,rect:n,offsetParent:r,strategy:a}=e;const i=a==="fixed",o=qr(r),l=t?sh(t.floating):!1;if(r===o||l&&i)return n;let c={scrollLeft:0,scrollTop:0},d=$r(1);const u=$r(0),f=Br(r);if((f||!f&&!i)&&((To(r)!=="body"||vc(o))&&(c=ah(r)),Br(r))){const p=Ja(r);d=Wi(r),u.x=p.x+r.clientLeft,u.y=p.y+r.clientTop}const m=o&&!f&&!i?z_(o,c,!0):$r(0);return{width:n.width*d.x,height:n.height*d.y,x:n.x*d.x-c.scrollLeft*d.x+u.x+m.x,y:n.y*d.y-c.scrollTop*d.y+u.y+m.y}}function YP(e){return Array.from(e.getClientRects())}function QP(e){const t=qr(e),n=ah(e),r=e.ownerDocument.body,a=Mn(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=Mn(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let o=-n.scrollLeft+H0(e);const l=-n.scrollTop;return wr(r).direction==="rtl"&&(o+=Mn(t.clientWidth,r.clientWidth)-a),{width:a,height:i,x:o,y:l}}function JP(e,t){const n=Bn(e),r=qr(e),a=n.visualViewport;let i=r.clientWidth,o=r.clientHeight,l=0,c=0;if(a){i=a.width,o=a.height;const d=V0();(!d||d&&t==="fixed")&&(l=a.offsetLeft,c=a.offsetTop)}return{width:i,height:o,x:l,y:c}}const XP=new Set(["absolute","fixed"]);function ZP(e,t){const n=Ja(e,!0,t==="fixed"),r=n.top+e.clientTop,a=n.left+e.clientLeft,i=Br(e)?Wi(e):$r(1),o=e.clientWidth*i.x,l=e.clientHeight*i.y,c=a*i.x,d=r*i.y;return{width:o,height:l,x:c,y:d}}function bb(e,t,n){let r;if(t==="viewport")r=JP(e,n);else if(t==="document")r=QP(qr(e));else if(vr(t))r=ZP(t,n);else{const a=B_(e);r={x:t.x-a.x,y:t.y-a.y,width:t.width,height:t.height}}return wd(r)}function q_(e,t){const n=aa(e);return n===t||!vr(n)||po(n)?!1:wr(n).position==="fixed"||q_(n,t)}function eT(e,t){const n=t.get(e);if(n)return n;let r=Xl(e,[],!1).filter(l=>vr(l)&&To(l)!=="body"),a=null;const i=wr(e).position==="fixed";let o=i?aa(e):e;for(;vr(o)&&!po(o);){const l=wr(o),c=q0(o);!c&&l.position==="fixed"&&(a=null),(i?!c&&!a:!c&&l.position==="static"&&!!a&&XP.has(a.position)||vc(o)&&!c&&q_(e,o))?r=r.filter(u=>u!==o):a=l,o=aa(o)}return t.set(e,r),r}function tT(e){let{element:t,boundary:n,rootBoundary:r,strategy:a}=e;const o=[...n==="clippingAncestors"?sh(t)?[]:eT(t,this._c):[].concat(n),r],l=o[0],c=o.reduce((d,u)=>{const f=bb(t,u,a);return d.top=Mn(f.top,d.top),d.right=sa(f.right,d.right),d.bottom=sa(f.bottom,d.bottom),d.left=Mn(f.left,d.left),d},bb(t,l,a));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function nT(e){const{width:t,height:n}=U_(e);return{width:t,height:n}}function rT(e,t,n){const r=Br(t),a=qr(t),i=n==="fixed",o=Ja(e,!0,i,t);let l={scrollLeft:0,scrollTop:0};const c=$r(0);function d(){c.x=H0(a)}if(r||!r&&!i)if((To(t)!=="body"||vc(a))&&(l=ah(t)),r){const p=Ja(t,!0,i,t);c.x=p.x+t.clientLeft,c.y=p.y+t.clientTop}else a&&d();i&&!r&&a&&d();const u=a&&!r&&!i?z_(a,l):$r(0),f=o.left+l.scrollLeft-c.x-u.x,m=o.top+l.scrollTop-c.y-u.y;return{x:f,y:m,width:o.width,height:o.height}}function uf(e){return wr(e).position==="static"}function yb(e,t){if(!Br(e)||wr(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return qr(e)===n&&(n=n.ownerDocument.body),n}function V_(e,t){const n=Bn(e);if(sh(e))return n;if(!Br(e)){let a=aa(e);for(;a&&!po(a);){if(vr(a)&&!uf(a))return a;a=aa(a)}return n}let r=yb(e,t);for(;r&&FP(r)&&uf(r);)r=yb(r,t);return r&&po(r)&&uf(r)&&!q0(r)?n:r||VP(e)||n}const sT=async function(e){const t=this.getOffsetParent||V_,n=this.getDimensions,r=await n(e.floating);return{reference:rT(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function aT(e){return wr(e).direction==="rtl"}const iT={convertOffsetParentRelativeRectToViewportRelativeRect:KP,getDocumentElement:qr,getClippingRect:tT,getOffsetParent:V_,getElementRects:sT,getClientRects:YP,getDimensions:nT,getScale:Wi,isElement:vr,isRTL:aT};function W_(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function oT(e,t){let n=null,r;const a=qr(e);function i(){var l;clearTimeout(r),(l=n)==null||l.disconnect(),n=null}function o(l,c){l===void 0&&(l=!1),c===void 0&&(c=1),i();const d=e.getBoundingClientRect(),{left:u,top:f,width:m,height:p}=d;if(l||t(),!m||!p)return;const v=lu(f),g=lu(a.clientWidth-(u+m)),y=lu(a.clientHeight-(f+p)),b=lu(u),w={rootMargin:-v+"px "+-g+"px "+-y+"px "+-b+"px",threshold:Mn(0,sa(1,c))||1};let _=!0;function j(N){const k=N[0].intersectionRatio;if(k!==c){if(!_)return o();k?o(!1,k):r=setTimeout(()=>{o(!1,1e-7)},1e3)}k===1&&!W_(d,e.getBoundingClientRect())&&o(),_=!1}try{n=new IntersectionObserver(j,{...w,root:a.ownerDocument})}catch{n=new IntersectionObserver(j,w)}n.observe(e)}return o(!0),i}function lT(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:a=!0,ancestorResize:i=!0,elementResize:o=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:c=!1}=r,d=W0(e),u=a||i?[...d?Xl(d):[],...Xl(t)]:[];u.forEach(b=>{a&&b.addEventListener("scroll",n,{passive:!0}),i&&b.addEventListener("resize",n)});const f=d&&l?oT(d,n):null;let m=-1,p=null;o&&(p=new ResizeObserver(b=>{let[x]=b;x&&x.target===d&&p&&(p.unobserve(t),cancelAnimationFrame(m),m=requestAnimationFrame(()=>{var w;(w=p)==null||w.observe(t)})),n()}),d&&!c&&p.observe(d),p.observe(t));let v,g=c?Ja(e):null;c&&y();function y(){const b=Ja(e);g&&!W_(g,b)&&n(),g=b,v=requestAnimationFrame(y)}return n(),()=>{var b;u.forEach(x=>{a&&x.removeEventListener("scroll",n),i&&x.removeEventListener("resize",n)}),f==null||f(),(b=p)==null||b.disconnect(),p=null,c&&cancelAnimationFrame(v)}}const cT=IP,uT=OP,dT=TP,hT=LP,fT=RP,vb=PP,mT=DP,pT=(e,t,n)=>{const r=new Map,a={platform:iT,...n},i={...a.platform,_c:r};return EP(e,t,{...a,platform:i})};var xT=typeof document<"u",gT=function(){},Fu=xT?h.useLayoutEffect:gT;function _d(e,t){if(e===t)return!0;
vendor: 4,143 bytes, line 429
429if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,a;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!_d(e[r],t[r]))return!1;return!0}if(a=Object.keys(e),n=a.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,a[r]))return!1;for(r=n;r--!==0;){const i=a[r];if(!(i==="_owner"&&e.$$typeof)&&!_d(e[i],t[i]))return!1}return!0}return e!==e&&t!==t}function H_(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function wb(e,t){const n=H_(e);return Math.round(t*n)/n}function df(e){const t=h.useRef(e);return Fu(()=>{t.current=e}),t}function bT(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:a,elements:{reference:i,floating:o}={},transform:l=!0,whileElementsMounted:c,open:d}=e,[u,f]=h.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[m,p]=h.useState(r);_d(m,r)||p(r);const[v,g]=h.useState(null),[y,b]=h.useState(null),x=h.useCallback(D=>{D!==N.current&&(N.current=D,g(D))},[]),w=h.useCallback(D=>{D!==k.current&&(k.current=D,b(D))},[]),_=i||v,j=o||y,N=h.useRef(null),k=h.useRef(null),C=h.useRef(u),A=c!=null,I=df(c),O=df(a),P=df(d),T=h.useCallback(()=>{if(!N.current||!k.current)return;const D={placement:t,strategy:n,middleware:m};O.current&&(D.platform=O.current),pT(N.current,k.current,D).then($=>{const z={...$,isPositioned:P.current!==!1};E.current&&!_d(C.current,z)&&(C.current=z,In.flushSync(()=>{f(z)}))})},[m,t,n,O,P]);Fu(()=>{d===!1&&C.current.isPositioned&&(C.current.isPositioned=!1,f(D=>({...D,isPositioned:!1})))},[d]);const E=h.useRef(!1);Fu(()=>(E.current=!0,()=>{E.current=!1}),[]),Fu(()=>{if(_&&(N.current=_),j&&(k.current=j),_&&j){if(I.current)return I.current(_,j,T);T()}},[_,j,T,I,A]);const W=h.useMemo(()=>({reference:N,floating:k,setReference:x,setFloating:w}),[x,w]),V=h.useMemo(()=>({reference:_,floating:j}),[_,j]),q=h.useMemo(()=>{const D={position:n,left:0,top:0};if(!V.floating)return D;const $=wb(V.floating,u.x),z=wb(V.floating,u.y);return l?{...D,transform:"translate("+$+"px, "+z+"px)",...H_(V.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:$,top:z}},[n,l,V.floating,u.x,u.y]);return h.useMemo(()=>({...u,update:T,refs:W,elements:V,floatingStyles:q}),[u,T,W,V,q])}const yT=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:a}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?vb({element:r.current,padding:a}).fn(n):{}:r?vb({element:r,padding:a}).fn(n):{}}}},vT=(e,t)=>({...cT(e),options:[e,t]}),wT=(e,t)=>({...uT(e),options:[e,t]}),_T=(e,t)=>({...mT(e),options:[e,t]}),jT=(e,t)=>({...dT(e),options:[e,t]}),NT=(e,t)=>({...hT(e),options:[e,t]}),kT=(e,t)=>({...fT(e),options:[e,t]}),ST=(e,t)=>({...yT(e),options:[e,t]});var CT="Arrow",G_=h.forwardRef((e,t)=>{const{children:n,width:r=10,height:a=5,...i}=e;return s.jsx(Ut.svg,{...i,ref:t,width:r,height:a,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:s.jsx("polygon",{points:"0,0 30,0 15,10"})})});G_.displayName=CT;var ET=G_;function PT(e){const[t,n]=h.useState(void 0);return ls(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(a=>{if(!Array.isArray(a)||!a.length)return;const i=a[0];let o,l;if("borderBoxSize"in i){const c=i.borderBoxSize,d=Array.isArray(c)?c[0]:c;o=d.inlineSize,l=d.blockSize}else o=e.offsetWidth,l=e.offsetHeight;n({width:o,height:l})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}var G0="Popper",[K_,Y_]=ko(G0),[TT,Q_]=K_(G0),J_=e=>{const{__scopePopper:t,children:n}=e,[r,a]=h.useState(null);return s.jsx(TT,{scope:t,anchor:r,onAnchorChange:a,children:n})};J_.displayName=G0;var X_="PopperAnchor",Z_=h.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...a}=e,i=Q_(X_,n),o=h.useRef(null),l=rn(t,o);return h.useEffect(()=>{i.onAnchorChange((r==null?void 0:r.current)||o.current)}),r?null:s.jsx(Ut.div,{...a,ref:l})});Z_.displayName=X_;var K0="PopperContent",[RT,AT]=K_(K0),ej=h.forwardRef((e,t)=>
vendor: 4,211 bytes, line 429
429{var ce,Re,ye,fe,ge,J;const{__scopePopper:n,side:r="bottom",sideOffset:a=0,align:i="center",alignOffset:o=0,arrowPadding:l=0,avoidCollisions:c=!0,collisionBoundary:d=[],collisionPadding:u=0,sticky:f="partial",hideWhenDetached:m=!1,updatePositionStrategy:p="optimized",onPlaced:v,...g}=e,y=Q_(K0,n),[b,x]=h.useState(null),w=rn(t,ue=>x(ue)),[_,j]=h.useState(null),N=PT(_),k=(N==null?void 0:N.width)??0,C=(N==null?void 0:N.height)??0,A=r+(i!=="center"?"-"+i:""),I=typeof u=="number"?u:{top:0,right:0,bottom:0,left:0,...u},O=Array.isArray(d)?d:[d],P=O.length>0,T={padding:I,boundary:O.filter(OT),altBoundary:P},{refs:E,floatingStyles:W,placement:V,isPositioned:q,middlewareData:D}=bT({strategy:"fixed",placement:A,whileElementsMounted:(...ue)=>lT(...ue,{animationFrame:p==="always"}),elements:{reference:y.anchor},middleware:[vT({mainAxis:a+C,alignmentAxis:o}),c&&wT({mainAxis:!0,crossAxis:!1,limiter:f==="partial"?_T():void 0,...T}),c&&jT({...T}),NT({...T,apply:({elements:ue,rects:Ee,availableWidth:Y,availableHeight:Q})=>{const{width:le,height:de}=Ee.reference,me=ue.floating.style;me.setProperty("--radix-popper-available-width",`${Y}px`),me.setProperty("--radix-popper-available-height",`${Q}px`),me.setProperty("--radix-popper-anchor-width",`${le}px`),me.setProperty("--radix-popper-anchor-height",`${de}px`)}}),_&&ST({element:_,padding:l}),DT({arrowWidth:k,arrowHeight:C}),m&&kT({strategy:"referenceHidden",...T})]}),[$,z]=rj(V),R=Fr(v);ls(()=>{q&&(R==null||R())},[q,R]);const U=(ce=D.arrow)==null?void 0:ce.x,ee=(Re=D.arrow)==null?void 0:Re.y,ae=((ye=D.arrow)==null?void 0:ye.centerOffset)!==0,[xe,te]=h.useState();return ls(()=>{b&&te(window.getComputedStyle(b).zIndex)},[b]),s.jsx("div",{ref:E.setFloating,"data-radix-popper-content-wrapper":"",style:{...W,transform:q?W.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:xe,"--radix-popper-transform-origin":[(fe=D.transformOrigin)==null?void 0:fe.x,(ge=D.transformOrigin)==null?void 0:ge.y].join(" "),...((J=D.hide)==null?void 0:J.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:s.jsx(RT,{scope:n,placedSide:$,onArrowChange:j,arrowX:U,arrowY:ee,shouldHideArrow:ae,children:s.jsx(Ut.div,{"data-side":$,"data-align":z,...g,ref:w,style:{...g.style,animation:q?void 0:"none"}})})})});ej.displayName=K0;var tj="PopperArrow",IT={top:"bottom",right:"left",bottom:"top",left:"right"},nj=h.forwardRef(function(t,n){const{__scopePopper:r,...a}=t,i=AT(tj,r),o=IT[i.placedSide];return s.jsx("span",{ref:i.onArrowChange,style:{position:"absolute",left:i.arrowX,top:i.arrowY,[o]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[i.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[i.placedSide],visibility:i.shouldHideArrow?"hidden":void 0},children:s.jsx(ET,{...a,ref:n,style:{...a.style,display:"block"}})})});nj.displayName=tj;function OT(e){return e!==null}var DT=e=>({name:"transformOrigin",options:e,fn(t){var y,b,x;const{placement:n,rects:r,middlewareData:a}=t,o=((y=a.arrow)==null?void 0:y.centerOffset)!==0,l=o?0:e.arrowWidth,c=o?0:e.arrowHeight,[d,u]=rj(n),f={start:"0%",center:"50%",end:"100%"}[u],m=(((b=a.arrow)==null?void 0:b.x)??0)+l/2,p=(((x=a.arrow)==null?void 0:x.y)??0)+c/2;let v="",g="";return d==="bottom"?(v=o?f:`${m}px`,g=`${-c}px`):d==="top"?(v=o?f:`${m}px`,g=`${r.floating.height+c}px`):d==="right"?(v=`${-c}px`,g=o?f:`${p}px`):d==="left"&&(v=`${r.floating.width+c}px`,g=o?f:`${p}px`),{data:{x:v,y:g}}}});function rj(e){const[t,n="center"]=e.split("-");return[t,n]}var Z8=J_,LT=Z_,MT=ej,$T=nj,[ih,eF]=ko("Tooltip",[Y_]),Y0=Y_(),sj="TooltipProvider",FT=700,_b="tooltip.open",[UT,aj]=ih(sj),ij=e=>{const{__scopeTooltip:t,delayDuration:n=FT,skipDelayDuration:r=300,disableHoverableContent:a=!1,children:i}=e,o=h.useRef(!0),l=h.useRef(!1),c=h.useRef(0);return h.useEffect(()=>{const d=c.current;return()=>window.clearTimeout(d)},[]),s.jsx(UT,{scope:t,isOpenDelayedRef:o,delayDuration:n,onOpen:h.useCallback(()=>{window.clearTimeout(c.current),o.current=!1},[]),onClose:h.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>
vendor: 4,665 bytes, line 429
429o.current=!0,r)},[r]),isPointerInTransitRef:l,onPointerInTransitChange:h.useCallback(d=>{l.current=d},[]),disableHoverableContent:a,children:i})};ij.displayName=sj;var oj="Tooltip",[tF,oh]=ih(oj),op="TooltipTrigger",BT=h.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,a=oh(op,n),i=aj(op,n),o=Y0(n),l=h.useRef(null),c=rn(t,l,a.onTriggerChange),d=h.useRef(!1),u=h.useRef(!1),f=h.useCallback(()=>d.current=!1,[]);return h.useEffect(()=>()=>document.removeEventListener("pointerup",f),[f]),s.jsx(LT,{asChild:!0,...o,children:s.jsx(Ut.button,{"aria-describedby":a.open?a.contentId:void 0,"data-state":a.stateAttribute,...r,ref:c,onPointerMove:bt(e.onPointerMove,m=>{m.pointerType!=="touch"&&!u.current&&!i.isPointerInTransitRef.current&&(a.onTriggerEnter(),u.current=!0)}),onPointerLeave:bt(e.onPointerLeave,()=>{a.onTriggerLeave(),u.current=!1}),onPointerDown:bt(e.onPointerDown,()=>{a.open&&a.onClose(),d.current=!0,document.addEventListener("pointerup",f,{once:!0})}),onFocus:bt(e.onFocus,()=>{d.current||a.onOpen()}),onBlur:bt(e.onBlur,a.onClose),onClick:bt(e.onClick,a.onClose)})})});BT.displayName=op;var zT="TooltipPortal",[nF,qT]=ih(zT,{forceMount:void 0}),xo="TooltipContent",lj=h.forwardRef((e,t)=>{const n=qT(xo,e.__scopeTooltip),{forceMount:r=n.forceMount,side:a="top",...i}=e,o=oh(xo,e.__scopeTooltip);return s.jsx(So,{present:r||o.open,children:o.disableHoverableContent?s.jsx(cj,{side:a,...i,ref:t}):s.jsx(VT,{side:a,...i,ref:t})})}),VT=h.forwardRef((e,t)=>{const n=oh(xo,e.__scopeTooltip),r=aj(xo,e.__scopeTooltip),a=h.useRef(null),i=rn(t,a),[o,l]=h.useState(null),{trigger:c,onClose:d}=n,u=a.current,{onPointerInTransitChange:f}=r,m=h.useCallback(()=>{l(null),f(!1)},[f]),p=h.useCallback((v,g)=>{const y=v.currentTarget,b={x:v.clientX,y:v.clientY},x=YT(b,y.getBoundingClientRect()),w=QT(b,x),_=JT(g.getBoundingClientRect()),j=ZT([...w,..._]);l(j),f(!0)},[f]);return h.useEffect(()=>()=>m(),[m]),h.useEffect(()=>{if(c&&u){const v=y=>p(y,u),g=y=>p(y,c);return c.addEventListener("pointerleave",v),u.addEventListener("pointerleave",g),()=>{c.removeEventListener("pointerleave",v),u.removeEventListener("pointerleave",g)}}},[c,u,p,m]),h.useEffect(()=>{if(o){const v=g=>{const y=g.target,b={x:g.clientX,y:g.clientY},x=(c==null?void 0:c.contains(y))||(u==null?void 0:u.contains(y)),w=!XT(b,o);x?m():w&&(m(),d())};return document.addEventListener("pointermove",v),()=>document.removeEventListener("pointermove",v)}},[c,u,o,d,m]),s.jsx(cj,{...e,ref:i})}),[WT,HT]=ih(oj,{isInside:!1}),GT=V1("TooltipContent"),cj=h.forwardRef((e,t)=>{const{__scopeTooltip:n,children:r,"aria-label":a,onEscapeKeyDown:i,onPointerDownOutside:o,...l}=e,c=oh(xo,n),d=Y0(n),{onClose:u}=c;return h.useEffect(()=>(document.addEventListener(_b,u),()=>document.removeEventListener(_b,u)),[u]),h.useEffect(()=>{if(c.trigger){const f=m=>{const p=m.target;p!=null&&p.contains(c.trigger)&&u()};return window.addEventListener("scroll",f,{capture:!0}),()=>window.removeEventListener("scroll",f,{capture:!0})}},[c.trigger,u]),s.jsx(Kd,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:i,onPointerDownOutside:o,onFocusOutside:f=>f.preventDefault(),onDismiss:u,children:s.jsxs(MT,{"data-state":c.stateAttribute,...d,...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:[s.jsx(GT,{children:r}),s.jsx(WT,{scope:n,isInside:!0,children:s.jsx(L5,{id:c.contentId,role:"tooltip",children:a||r})})]})})});lj.displayName=xo;var uj="TooltipArrow",KT=h.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,a=Y0(n);return HT(uj,n).isInside?null:s.jsx($T,{...a,...r,ref:t})});KT.displayName=uj;function YT(e,t){const n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),a=Math.abs(t.right-e.x),i=Math.abs(t.left-e.x);switch(Math.min(n,r,a,i)){case i:return"left";case a:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function QT(e,t,n=5){const r=[];switch(t){case"top":r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case"bottom":r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case"left":r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case"right":r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function JT(e){const{top:t,right:n,bottom:r,left:a}=e;return[{x:a,y:t},{x:n,y:t},{x:n,y:r},{x:a,y:r}]}function XT(e,t){const{x:n,y:r}=e;let a=!1;for(let i=0,o=t.length-1;i<t.length;
429o=i++){const l=t[i],c=t[o],d=l.x,u=l.y,f=c.x,m=c.y;u>r!=m>r&&n<(f-d)*(r-u)/(m-u)+d&&(a=!a)}return a}function ZT(e){const t=e.slice();return t.sort((n,r)=>n.x<r.x?-1:n.x>r.x?1:n.y<r.y?-1:n.y>r.y?1:0),e3(t)}function e3(e){if(e.length<=1)return e.slice();const t=[];for(let r=0;r<e.length;r++){const a=e[r];for(;t.length>=2;){const i=t[t.length-1],o=t[t.length-2];if((i.x-o.x)*(a.y-o.y)>=(i.y-o.y)*(a.x-o.x))t.pop();else break}t.push(a)}t.pop();const n=[];for(let r=e.length-1;r>=0;r--){const a=e[r];for(;n.length>=2;){const i=n[n.length-1],o=n[n.length-2];if((i.x-o.x)*(a.y-o.y)>=(i.y-o.y)*(a.x-o.x))n.pop();else break}n.push(a)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var t3=ij,dj=lj;const n3=t3,r3=h.forwardRef(({className:e,sideOffset:t=4,...n},r)=>s.jsx(dj,{ref:r,sideOffset:t,className:Ct("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),...n}));r3.displayName=dj.displayName;var Ir=function(){return Ir=Object.assign||function(t){for(var n,r=1,a=arguments.length;r<a;r++){n=arguments[r];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},Ir.apply(this,arguments)};function Ro(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var a=0,r=Object.getOwnPropertySymbols(e);a<r.length;a++)t.indexOf(r[a])<0&&Object.prototype.propertyIsEnumerable.call(e,r[a])&&(n[r[a]]=e[r[a]]);return n}function s3(e,t,n,r){function a(i){return i instanceof n?i:new n(function(o){o(i)})}return new(n||(n=Promise))(function(i,o){function l(u){try{d(r.next(u))}catch(f){o(f)}}function c(u){try{d(r.throw(u))}catch(f){o(f)}}function d(u){u.done?i(u.value):a(u.value).then(l,c)}d((r=r.apply(e,t||[])).next())})}function a3(e,t,n){if(n||arguments.length===2)for(var r=0,a=t.length,i;r<a;r++)(i||!(r in t))&&(i||(i=Array.prototype.slice.call(t,0,r)),i[r]=t[r]);return e.concat(i||Array.prototype.slice.call(t))}const i3=e=>e?(...t)=>e(...t):(...t)=>fetch(...t);
429class Q0 extends Error{constructor(t,n="FunctionsError",r){super(t),this.name=n,this.context=r}}class o3 extends Q0{constructor(t){super("Failed to send a request to the Edge Function","FunctionsFetchError",t)}}class jb extends Q0{constructor(t){super("Relay Error invoking the Edge Function","FunctionsRelayError",t)}}class Nb extends Q0{constructor(t){super("Edge Function returned a non-2xx status code","FunctionsHttpError",t)}}var lp;(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"})(lp||(lp={}));class l3{constructor(t,{headers:n={},customFetch:r,region:a=lp.Any}={}){this.url=t,this.headers=n,this.region=a,this.fetch=i3(r)}setAuth(t){this.headers.Authorization=`Bearer ${t}`}invoke(t){return s3(this,arguments,void 0,function*(n,r={}){var a;let i,o;try{const{headers:l,method:c,body:d,signal:u,timeout:f}=r;let m={},{region:p}=r;p||(p=this.region);const v=new URL(`${this.url}/${n}`);p&&p!=="any"&&(m["x-region"]=p,v.searchParams.set("forceFunctionRegion",p));let g;d&&(l&&!Object.prototype.hasOwnProperty.call(l,"Content-Type")||!l)?typeof Blob<"u"&&d instanceof Blob||d instanceof ArrayBuffer?(m["Content-Type"]="application/octet-stream",g=d):typeof d=="string"?(m["Content-Type"]="text/plain",g=d):typeof FormData<"u"&&d instanceof FormData?g=d:(m["Content-Type"]="application/json",g=JSON.stringify(d)):d&&typeof d!="string"&&!(typeof Blob<"u"&&d instanceof Blob)&&!(d instanceof ArrayBuffer)&&!(typeof FormData<"u"&&d instanceof FormData)?g=JSON.stringify(d):g=d;let y=u;f&&(o=new AbortController,i=setTimeout(()=>o.abort(),f),u?(y=o.signal,u.addEventListener("abort",()=>o.abort())):y=o.signal);const b=yield this.fetch(v.toString(),{method:c||"POST",headers:Object.assign(Object.assign(Object.assign({},m),this.headers),l),body:g,signal:y}).catch(j=>{throw new o3(j)}),x=b.headers.get("x-relay-error");if(x&&x==="true")throw new jb(b);if(!b.ok)throw new Nb(b);let w=((a=b.headers.get("Content-Type"))!==null&&a!==void 0?a:"text/plain").split(";")[0].trim(),_;return w==="application/json"?_=yield b.json():w==="application/octet-stream"||w==="application/pdf"?_=yield b.blob():w==="text/event-stream"?_=b:w==="multipart/form-data"?_=yield b.formData():_=yield b.text(),{data:_,error:null,response:b}}catch(l){return{data:null,error:l,response:l instanceof Nb||l instanceof jb?l.context:void 0}}finally{i&&clearTimeout(i)}})}}var c3=class extends Error{constructor(e){super(e.message),this.name="PostgrestError",this.details=e.details,this.hint=e.hint,this.co
429de=e.code}},u3=class{constructor(e){var t,n,r;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=(n=e.isMaybeSingle)!==null&&n!==void 0?n:!1,this.urlLengthLimit=(r=e.urlLengthLimit)!==null&&r!==void 0?r: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 n=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 r=this.fetch;let a=r(this.url.toString(),{method:this.method,headers:this.headers,body:JSON.stringify(this.body),signal:this.signal}).then(async i=>{let o=null,l=null,c=null,d=i.status,u=i.statusText;if(i.ok){var f,m;if(n.method!=="HEAD"){var p;const b=await i.text();b===""||(n.headers.get("Accept")==="text/csv"||n.headers.get("Accept")&&(!((p=n.headers.get("Accept"))===null||p===void 0)&&p.includes("application/vnd.pgrst.plan+text"))?l=b:l=JSON.parse(b))}const g=(f=n.headers.get("Prefer"))===null||f===void 0?void 0:f.match(/count=(exact|planned|estimated)/),y=(m=i.headers.get("content-range"))===null||m===void 0?void 0:m.split("/");g&&y&&y.length>1&&(c=parseInt(y[1])),n.isMaybeSingle&&n.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,d=406,u="Not Acceptable"):l.length===1?l=l[0]:l=null)}else{var v;const g=await i.text();try{o=JSON.parse(g),Array.isArray(o)&&i.status===404&&(l=[],o=null,d=200,u="OK")}catch{i.status===404&&g===""?(d=204,u="No Content"):o={message:g}}if(o&&n.isMaybeSingle&&(!(o==null||(v=o.details)===null||v===void 0)&&v.includes("0 rows"))&&(o=null,d=200,u="OK"),o&&n.shouldThrowOnError)throw new c3(o)}return{error:o,data:l,count:c,status:d,statusText:u}});return this.shouldThrowOnError||(a=a.catch(i=>{var o;let l="",c="",d="";const u=i==null?void 0:i.cause;if(u){var f,m,p,v;const b=(f=u==null?void 0:u.message)!==null&&f!==void 0?f:"",x=(m=u==null?void 0:u.code)!==null&&m!==void 0?m:"";l=`${(p=i==null?void 0:i.name)!==null&&p!==void 0?p:"FetchError"}: ${i==null?void 0:i.message}`,l+=`
430
431Caused by: ${(v=u==null?void 0:u.name)!==null&&v!==void 0?v:"Error"}: ${b}`,x&&(l+=` (${x})`),u!=null&&u.stack&&(l+=`
432${u.stack}`)}else{var g;l=(g=i==null?void 0:i.stack)!==null&&g!==void 0?g:""}const y=this.url.toString().length;return(i==null?void 0:i.name)==="AbortError"||(i==null?void 0:i.code)==="ABORT_ERR"?(d="",c="Request was aborted (timeout or manual cancellation)",y>this.urlLengthLimit&&(c+=`. Note: Your request URL is ${y} characters, which may exceed server limits. If selecting many fields, consider using views. If filtering with large arrays (e.g., .in('id', [many IDs])), consider using an RPC function to pass values server-side.`)):((u==null?void 0:u.name)==="HeadersOverflowError"||(u==null?void 0:u.code)==="UND_ERR_HEADERS_OVERFLOW")&&(d="",c="HTTP headers exceeded server limits (typically 16KB)",y>this.urlLengthLimit&&(c+=`. Your request URL is ${y} characters. If selecting many fields, consider using views. If filtering with large arrays (e.g., .in('id', [200+ IDs])), consider using an RPC function instead.`)),{error:{message:`${(o=i==null?void 0:i.name)!==null&&o!==void 0?o:"FetchError"}: ${i==null?void 0:i.message}`,details:l,hint:c,code:d},data:null,count:null,status:0,statusText:""}})),a.then(e,t)}returns(){return this}overrideTypes(){return this}},d3=class extends u3{select(e){let t=!1;const n=(e??"*").split("").map(r=>/\s/.test(r)&&!t?"":(r==='"'&&(t=!t),r)).join("");return this.url.searchParams.set("select",n),this.headers.append("Prefer","return=representation"),this}order(e,{ascending:t=!0,nullsFirst:n,foreignTable:r,referencedTable:a=r}={}){const i=a?`${a}.order`:"order",o=this.url.searchParams.get(i);return this.url.searchParams.set(i,`${o?`${o},`:""}${e}.${t?"asc":"desc"}${n===void 0?"":n?".nullsfirst":".nullslast"}`),this}limit(e,{foreignTable:t,referencedTable:n=t}={}){const r=typeof n>"u"?"limit":`${n}.limit`;return this.url.searchParams.set(r,`${e}`),this}range(e,t,{foreignTable:n,referencedTable:r=n}={}){const a=typeof r>"u"?"offset":`${r}.offset`,i=typeof r>"u"?"limit":`${r}.limit`;return this.url.searchParams.set(a,`${e}`),this.url.searchParams.set(i,`${t-e+1}`),this}abortSignal(e){return this.signal=e,this}single(){return this.headers.set("Accept","application/vnd.pgrst.object+json"),this}maybeSingle(){return this.method==="GET"?this.headers.set("Accept","application/json"):this.headers.set("Accept","application/vnd.pgrst.object+json"),this.isMaybeSingle=!0,this}csv(){return this.headers.set("Accept","text/csv"),this}geojson(){return this.headers.set("Accept","application/geo+json"),this}
432explain({analyze:e=!1,verbose:t=!1,settings:n=!1,buffers:r=!1,wal:a=!1,format:i="text"}={}){var o;const l=[e?"analyze":null,t?"verbose":null,n?"settings":null,r?"buffers":null,a?"wal":null].filter(Boolean).join("|"),c=(o=this.headers.get("Accept"))!==null&&o!==void 0?o:"application/json";return this.headers.set("Accept",`application/vnd.pgrst.plan+${i}; for="${c}"; options=${l};`),i==="json"?this:this}rollback(){return this.headers.append("Prefer","tx=rollback"),this}returns(){return this}maxAffected(e){return this.headers.append("Prefer","handling=strict"),this.headers.append("Prefer",`max-affected=${e}`),this}};const kb=new RegExp("[,()]");var wi=class extends d3{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 n=Array.from(new Set(t)).map(r=>typeof r=="string"&&kb.test(r)?`"${r}"`:`${r}`).join(",");return this.url.searchParams.append(e,`in.(${n})`),this}notIn(e,t){const n=Array.from(new Set(t)).map(r=>typeof r=="string"&&kb.test(r)?`"${r}"`:`${r}`).join(",");return this.url.searchParams.append(e,`not.in.(${n})`),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:n,type:r}={}){let a="";r==="plain"?a="pl":r==="phrase"?a="ph":r==="websearch"&&(a="w");const i=n===void 0?"":`(${n})`;return this.url.searchParams.append(e,`${a}fts${i}.${t}`),this}match(e){return Object.entries(e).forEach(([t,n])=>{this.url.searchParams.append(t,`eq.${n}`)}),this}not(e,t,n){return this.url.searchParams.append(e,`not.${t}.${n}`),this}or(e,{foreignTable:t,referencedTable:n=t}={}){const r=n?`${n}.or`:"or";return this.url.searchParams.append(r,`(${e})`),this}filter(e,t,n){return this.url.searchParams.append(e,`${t}.${n}`),this}},h3=class{constructor(e,{headers:t={},schema:n,fetch:r,urlLengthLimit:a=8e3}){this.url=e,this.headers=new Headers(t),this.schema=n,this.fetch=r,this.urlLengthLimit=a}cloneRequestState(){return{url:new URL(this.url.toString()),headers:new Headers(this.headers)}}select(e,t){const{head:n=!1,count:r}=t??{},a=n?"HEAD":"GET";let i=!1;const o=(e??"*").split("").map(d=>/\s/.test(d)&&!i?"":(d==='"'&&(i=!i),d)).join(""),{url:l,headers:c}=this.cloneRequestState();return l.searchParams.set("select",o),r&&c.append("Prefer",`count=${r}`),new wi({method:a,url:l,headers:c,schema:this.schema,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit})}insert(e,{count:t,defaultToNull:n=!0}={}){var r;const a="POST",{url:i,headers:o}=this.cloneRequestState();if(t&&o.append("Prefer",`count=${t}`),n||o.append("Prefer","missing=default"),Array.isArray(e)){const l=e.reduce((c,d)=>c.concat(Object.keys(d)),[]);if(l.length>0){const c=[...new Set(l)].map(d=>`"${d}"`);i.searchParams.set("columns",c.join(","))}}return new wi({method:a,url:i,headers:o,schema:this.schema,body:e,fetch:(r=this.fetch)!==null&&r!==void 0?r:fetch,urlLengthLimit:this.urlLengthLimit})}upsert(e,{onConflict:t,ignoreDuplicates:n=!1,count:r,defaultToNull:a=!0}={}){var i;const o="POST",{url:l,headers:c}=this.cloneRequestState();if(c.append("Prefer",`resolution=${n?"ignore":"merge"}-duplicates`),t!==void 0&&l.searchParams.set("on_conflict",t),r&&c.append("Prefer",`count=${r}`),a||c.append("Prefer","missing=default"),Array.isArray(e)){const d=e.reduce((u,f)=>u.concat(Object.keys(f)),[]);if(d.length>0){const u=[...new Set(d)].map(f=>`"${f}"`);l.searchParams.set("columns",u.join(","))}}return new wi({method:o,url:l,headers:c,schema:this.schema,body:e,fetch:(i=this.fetch)!==null&&i!==void 0?i:fetch,urlLengthLimit:this.urlLengthLimit})}update(e,{count:t}={}){var n;const r="PATCH",{url:a,headers:i}=this.cloneRequestState();return t&&i.append("Prefer",`count=${t}`),new wi({method:r,url:a,headers:i,schema:this.schema,body:e,fetch:(n=this.fetch)!==null&&n!==void 0?n:fetch,urlLengthLimit:this.urlLengthLimit})}delete({count:e}={}){var t;const n="DELETE",{url:r,headers:a}=this.cloneRequestState();return e&&a.append("Prefer",`count=${e}`),new wi({method:n,url:r,headers:a,schema:this.schema,fetch:(t=this.fetch)!==null&&t!==void 0?t:fetch,urlLengthLimit:this.urlLengthLimit})}};function Zl(e){"@babel/helpers - typeof";return Zl=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},Zl(e)}function f3(e,t){if(Zl(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(Zl(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function m3(e){var t=f3(e,"string");return Zl(t)=="symbol"?t:t+""}function p3(e,t,n){return(t=m3(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Sb(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function cu(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};
432t%2?Sb(Object(n),!0).forEach(function(r){p3(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Sb(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var x3=class hj{constructor(t,{headers:n={},schema:r,fetch:a,timeout:i,urlLengthLimit:o=8e3}={}){this.url=t,this.headers=new Headers(n),this.schemaName=r,this.urlLengthLimit=o;const l=a??globalThis.fetch;i!==void 0&&i>0?this.fetch=(c,d)=>{const u=new AbortController,f=setTimeout(()=>u.abort(),i),m=d==null?void 0:d.signal;if(m){if(m.aborted)return clearTimeout(f),l(c,d);const p=()=>{clearTimeout(f),u.abort()};return m.addEventListener("abort",p,{once:!0}),l(c,cu(cu({},d),{},{signal:u.signal})).finally(()=>{clearTimeout(f),m.removeEventListener("abort",p)})}return l(c,cu(cu({},d),{},{signal:u.signal})).finally(()=>clearTimeout(f))}: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 h3(new URL(`${this.url}/${t}`),{headers:new Headers(this.headers),schema:this.schemaName,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit})}schema(t){return new hj(this.url,{headers:this.headers,schema:t,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit})}rpc(t,n={},{head:r=!1,get:a=!1,count:i}={}){var o;let l;const c=new URL(`${this.url}/rpc/${t}`);let d;const u=p=>p!==null&&typeof p=="object"&&(!Array.isArray(p)||p.some(u)),f=r&&Object.values(n).some(u);f?(l="POST",d=n):r||a?(l=r?"HEAD":"GET",Object.entries(n).filter(([p,v])=>v!==void 0).map(([p,v])=>[p,Array.isArray(v)?`{${v.join(",")}}`:`${v}`]).forEach(([p,v])=>{c.searchParams.append(p,v)})):(l="POST",d=n);const m=new Headers(this.headers);return f?m.set("Prefer",i?`count=${i},return=minimal`:"return=minimal"):i&&m.set("Prefer",`count=${i}`),new wi({method:l,url:c,headers:m,schema:this.schemaName,body:d,fetch:(o=this.fetch)!==null&&o!==void 0?o:fetch,urlLengthLimit:this.urlLengthLimit})}};class g3{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 globalThis<"u"&&typeof globalThis.WebSocket<"u")return{type:"native",constructor:globalThis.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 n=globalThis.process;if(n){const r=n.versions;if(r&&r.node){const a=r.node,i=parseInt(a.replace(/^v/,"").split(".")[0]);return i>=22?typeof globalThis.WebSocket<"u"?{type:"native",constructor:globalThis.WebSocket}:{type:"unsupported",error:`Node.js ${i} detected but native WebSocket not found.`,workaround:"Provide a WebSocket implementation via the transport option."}:{type:"unsupported",error:`Node.js ${i} detected without native WebSocket support.`,workaround:`For Node.js < 22, install "ws" package and provide it via the transport option:
433import ws from "ws"
434new 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 n=t.error||"WebSocket not supported in this environment.";throw t.workaround&&(n+=`
435
436Suggested solution: ${t.workaround}`),new Error(n)}static createWebSocket(t,n){const r=this.getWebSocketConstructor();return new r(t,n)}static isWebSocketSupported(){try{const t=this.detectEnvironment();return t.type==="native"||t.type==="ws"}catch{return!1}}}const b3="2.99.1",y3=`realtime-js/${b3}`,v3="1.0.0",fj="2.0.0",Cb=fj,cp=1e4,w3=1e3,_3=100;var Cs;(function(e){e[e.connecting=0]="connecting",e[e.open=1]="open",e[e.closing=2]="closing",e[e.closed=3]="closed"})(Cs||(Cs={}));var Bt;(function(e){e.closed="closed",e.errored="errored",e.joined="joined",e.joining="joining",e.leaving="leaving"})(Bt||(Bt={}));var dr;(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"})(dr||(dr={}));var up;(function(e){e.websocket="websocket"})(up||(up={}));var ka;(function(e){e.Connecting="connecting",e.Open="open",e.Closing="closing",e.Closed="closed"})(ka||(ka={}));
436class j3{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,n){if(t.event===this.BROADCAST_EVENT&&!(t.payload instanceof ArrayBuffer)&&typeof t.payload.event=="string")return n(this._binaryEncodeUserBroadcastPush(t));let r=[t.join_ref,t.ref,t.topic,t.event,t.payload];return n(JSON.stringify(r))}_binaryEncodeUserBroadcastPush(t){var n;return this._isArrayBuffer((n=t.payload)===null||n===void 0?void 0:n.payload)?this._encodeBinaryUserBroadcastPush(t):this._encodeJsonUserBroadcastPush(t)}_encodeBinaryUserBroadcastPush(t){var n,r;const a=(r=(n=t.payload)===null||n===void 0?void 0:n.payload)!==null&&r!==void 0?r:new ArrayBuffer(0);return this._encodeUserBroadcastPush(t,this.BINARY_ENCODING,a)}_encodeJsonUserBroadcastPush(t){var n,r;const a=(r=(n=t.payload)===null||n===void 0?void 0:n.payload)!==null&&r!==void 0?r:{},o=new TextEncoder().encode(JSON.stringify(a)).buffer;return this._encodeUserBroadcastPush(t,this.JSON_ENCODING,o)}_encodeUserBroadcastPush(t,n,r){var a,i;const o=t.topic,l=(a=t.ref)!==null&&a!==void 0?a:"",c=(i=t.join_ref)!==null&&i!==void 0?i:"",d=t.payload.event,u=this.allowedMetadataKeys?this._pick(t.payload,this.allowedMetadataKeys):{},f=Object.keys(u).length===0?"":JSON.stringify(u);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(d.length>255)throw new Error(`userEvent length ${d.length} exceeds maximum of 255`);if(f.length>255)throw new Error(`metadata length ${f.length} exceeds maximum of 255`);const m=this.USER_BROADCAST_PUSH_META_LENGTH+c.length+l.length+o.length+d.length+f.length,p=new ArrayBuffer(this.HEADER_LENGTH+m);let v=new DataView(p),g=0;v.setUint8(g++,this.KINDS.userBroadcastPush),v.setUint8(g++,c.length),v.setUint8(g++,l.length),v.setUint8(g++,o.length),v.setUint8(g++,d.length),v.setUint8(g++,f.length),v.setUint8(g++,n),Array.from(c,b=>v.setUint8(g++,b.charCodeAt(0))),Array.from(l,b=>v.setUint8(g++,b.charCodeAt(0))),Array.from(o,b=>v.setUint8(g++,b.charCodeAt(0))),Array.from(d,b=>v.setUint8(g++,b.charCodeAt(0))),Array.from(f,b=>v.setUint8(g++,b.charCodeAt(0)));var y=new Uint8Array(p.byteLength+r.byteLength);return y.set(new Uint8Array(p),0),y.set(new Uint8Array(r),p.byteLength),y.buffer}decode(t,n){if(this._isArrayBuffer(t)){let r=this._binaryDecode(t);return n(r)}if(typeof t=="string"){const r=JSON.parse(t),[a,i,o,l,c]=r;return n({join_ref:a,ref:i,topic:o,event:l,payload:c})}return n({})}_binaryDecode(t){const n=new DataView(t),r=n.getUint8(0),a=new TextDecoder;switch(r){case this.KINDS.userBroadcast:return this._decodeUserBroadcast(t,n,a)}}_decodeUserBroadcast(t,n,r){const a=n.getUint8(1),i=n.getUint8(2),o=n.getUint8(3),l=n.getUint8(4);let c=this.HEADER_LENGTH+4;const d=r.decode(t.slice(c,c+a));c=c+a;const u=r.decode(t.slice(c,c+i));c=c+i;const f=r.decode(t.slice(c,c+o));c=c+o;const m=t.slice(c,t.byteLength),p=l===this.JSON_ENCODING?JSON.parse(r.decode(m)):m,v={type:this.BROADCAST_EVENT,event:u,payload:p};return o>0&&(v.meta=JSON.parse(f)),{join_ref:null,ref:null,topic:d,event:this.BROADCAST_EVENT,payload:v}}_isArrayBuffer(t){var n;return t instanceof ArrayBuffer||((n=t==null?void 0:t.constructor)===null||n===void 0?void 0:n.name)==="ArrayBuffer"}_pick(t,n){return!t||typeof t!="object"?{}:Object.fromEntries(Object.entries(t).filter(([r])=>n.includes(r)))}}class mj{constructor(t,n){this.callback=t,this.timerCalc=n,this.timer=void 0,this.tries=0,this.callback=t,this.timerCalc=n}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 dt;(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"})(dt||(dt={}));const Eb=(e,t,n={})=>{var r;const a=(r=n.skipTypes)!==null&&r!==void 0?r:[];return t?Object.keys(t).reduce((i,o)=>(i[o]=N3(o,e,t,a),i),{}):{}},N3=(e,t,n,r)=>{const a=t.find(l=>
436l.name===e),i=a==null?void 0:a.type,o=n[e];return i&&!r.includes(i)?pj(i,o):dp(o)},pj=(e,t)=>{if(e.charAt(0)==="_"){const n=e.slice(1,e.length);return E3(t,n)}switch(e){case dt.bool:return k3(t);case dt.float4:case dt.float8:case dt.int2:case dt.int4:case dt.int8:case dt.numeric:case dt.oid:return S3(t);case dt.json:case dt.jsonb:return C3(t);case dt.timestamp:return P3(t);case dt.abstime:case dt.date:case dt.daterange:case dt.int4range:case dt.int8range:case dt.money:case dt.reltime:case dt.text:case dt.time:case dt.timestamptz:case dt.timetz:case dt.tsrange:case dt.tstzrange:return dp(t);default:return dp(t)}},dp=e=>e,k3=e=>{switch(e){case"t":return!0;case"f":return!1;default:return e}},S3=e=>{if(typeof e=="string"){const t=parseFloat(e);if(!Number.isNaN(t))return t}return e},C3=e=>{if(typeof e=="string")try{return JSON.parse(e)}catch{return e}return e},E3=(e,t)=>{if(typeof e!="string")return e;const n=e.length-1,r=e[n];if(e[0]==="{"&&r==="}"){let i;const o=e.slice(1,n);try{i=JSON.parse("["+o+"]")}catch{i=o?o.split(","):[]}return i.map(l=>pj(t,l))}return e},P3=e=>typeof e=="string"?e.replace(" ","T"):e,xj=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 hf{constructor(t,n,r={},a=cp){this.channel=t,this.event=n,this.payload=r,this.timeout=a,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,n){var r;return this._hasReceived(t)&&n((r=this.receivedResp)===null||r===void 0?void 0:r.response),this.recHooks.push({status:t,callback:n}),this}startTimeout(){if(this.timeoutTimer)return;this.ref=this.channel.socket._makeRef(),this.refEvent=this.channel._replyEventName(this.ref);const t=n=>{this._cancelRefEvent(),this._cancelTimeout(),this.receivedResp=n,this._matchReceive(n)};this.channel._on(this.refEvent,{},t),this.timeoutTimer=setTimeout(()=>{this.trigger("timeout",{})},this.timeout)}trigger(t,n){this.refEvent&&this.channel._trigger(this.refEvent,{status:t,response:n})}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:n}){this.recHooks.filter(r=>r.status===t).forEach(r=>r.callback(n))}_hasReceived(t){return this.receivedResp&&this.receivedResp.status===t}}var Pb;(function(e){e.SYNC="sync",e.JOIN="join",e.LEAVE="leave"})(Pb||(Pb={}));class Nl{constructor(t,n){this.channel=t,this.state={},this.pendingDiffs=[],this.joinRef=null,this.enabled=!1,this.caller={onJoin:()=>{},onLeave:()=>{},onSync:()=>{}};const r=(n==null?void 0:n.events)||{state:"presence_state",diff:"presence_diff"};this.channel._on(r.state,{},a=>{const{onJoin:i,onLeave:o,onSync:l}=this.caller;this.joinRef=this.channel._joinRef(),this.state=Nl.syncState(this.state,a,i,o),this.pendingDiffs.forEach(c=>{this.state=Nl.syncDiff(this.state,c,i,o)}),this.pendingDiffs=[],l()}),this.channel._on(r.diff,{},a=>{const{onJoin:i,onLeave:o,onSync:l}=this.caller;this.inPendingSyncState()?this.pendingDiffs.push(a):(this.state=Nl.syncDiff(this.state,a,i,o),l())}),this.onJoin((a,i,o)=>{this.channel._trigger("presence",{event:"join",key:a,currentPresences:i,newPresences:o})}),this.onLeave((a,i,o)=>{this.channel._trigger("presence",{event:"leave",key:a,currentPresences:i,leftPresences:o})}),this.onSync(()=>{this.channel._trigger("presence",{event:"sync"})})}static syncState(t,n,r,a){const i=this.cloneDeep(t),o=this.transformState(n),l={},c={};return this.map(i,(d,u)=>{o[d]||(c[d]=u)}),this.map(o,(d,u)=>{const f=i[d];if(f){const m=u.map(y=>y.presence_ref),p=f.map(y=>y.presence_ref),v=u.filter(y=>p.indexOf(y.presence_ref)<0),g=f.filter(y=>m.indexOf(y.presence_ref)<0);v.length>0&&(l[d]=v),g.length>0&&(c[d]=g)}else l[d]=u}),this.syncDiff(i,{joins:l,leaves:c},r,a)}static syncDiff(t,n,r,a){const{joins:i,leaves:o}={joins:this.transformState(n.joins),leaves:this.transformState(n.leaves)};return r||(r=()=>{}),a||(a=()=>{}),this.map(i,(l,c)=>{var d;const u=(d=t[l])!==null&&d!==void 0?d:[];if(t[l]=this.cloneDeep(c),u.length>0){const f=t[l].map(p=>p.presence_ref),m=u.filter(p=>f.indexOf(p.presence_ref)<0);t[l].unshift(...m)}r(l,u,c)}),this.map(o,(l,c)=>{let d=t[l];if(!d)return;const u=c.map(f=>f.presence_ref);d=d.filter(f=>u.indexOf(f.presence_ref)<0),t[l]=d,a(l,d,c),d.length===0&&delete t[l]}),t}static map(t,n){return Object.getOwnPropertyNames(t).map(r=>n(r,t[r]))}static transformState(t){return t=this.cloneDeep(t),Object.getOwnPropertyNames(t).reduce((n,r)=>{const a=t[r];return"metas"in a?n[r]=a.metas.map(i=>(i.presence_ref=i.phx_ref,delete i.phx_ref,delete i.phx_ref_prev,i)):n[r]=a,n},{})}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 Tb;(function(e){e.ALL="*",e.INSERT="INSERT",e.UPDATE="UPDATE",e.DELETE="DELETE"})(Tb||(Tb={}));var kl;(function(e){e.BROADCAST="broadcast",e.PRESENCE="presence",e.POSTGRES_CHANGES="postgres_changes",e.SYSTEM="system"})(kl||(kl={}));var Qr;(function(e){e.SUBSCRIBED="SUBSCRIBED",e.TIMED_OUT="TIMED_OUT",e.CLOSED="CLOSED",e.CHANNEL_ERROR="CHANNEL_ERROR"})(Qr||(Qr={}));class Li{constructor(t,n={config:{}},r){var a,i;if(this.topic=t,this.params=n,this.socket=r,this.bindings={},this.state=Bt.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},n.config),this.timeout=this.socket.timeout,this.joinPush=new hf(this,dr.join,this.params,this.timeout),this.rejoinTimer=new mj(()=>this._rejoinUntilConnected(),this.socket.reconnectAfterMs),this.joinPush.receive("ok",()=>{this.state=Bt.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=Bt.closed,this.socket._remove(this)}),this._onError(o=>{this._isLeaving()||this._isClosed()||(this.socket.log("channel",`error ${this.topic}`,o),this.state=Bt.errored,this.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("timeout",()=>{this._isJoining()&&(this.socket.log("channel",`timeout ${this.topic}`,this.joinPush.timeout),this.state=Bt.errored,this.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("error",o=>{this._isLeaving()||this._isClosed()||(this.socket.log("channel",`error ${this.topic}`,o),this.state=Bt.errored,this.rejoinTimer.scheduleTimeout())}),this._on(dr.reply,{},(o,l)=>{this._trigger(this._replyEventName(l),o)}),this.presence=new Nl(this),this.broadcastEndpointURL=xj(this.socket.endPoint),this.private=this.params.config.private||!1,!this.private&&(!((i=(a=this.params.config)===null||a===void 0?void 0:a.broadcast)===null||i===void 0)&&i.replay))throw`tried to use replay on public channel '${this.topic}'. It must be a private channel.`}subscribe(t,n=this.timeout){var r,a,i;if(this.socket.isConnected()||this.socket.connect(),this.state==Bt.closed){const{config:{broadcast:o,presence:l,private:c}}=this.params,d=(a=(r=this.bindings.postgres_changes)===null||r===void 0?void 0:r.map(p=>p.filter))!==null&&a!==void 0?a:[],u=!!this.bindings[kl.PRESENCE]&&this.bindings[kl.PRESENCE].length>0||((i=this.params.config.presence)===null||i===void 0?void 0:i.enabled)===!0,f={},m={broadcast:o,presence:Object.assign(Object.assign({},l),{enabled:u}),postgres_changes:d,private:c};this.socket.accessTokenValue&&(f.access_token=this.socket.accessTokenValue),this._onError(p=>t==null?void 0:t(Qr.CHANNEL_ERROR,p)),this._onClose(()=>t==null?void 0:t(Qr.CLOSED)),this.updateJoinPayload(Object.assign({config:m},f)),this.joinedOnce=!0,this._rejoin(n),this.joinPush.receive("ok",async({postgres_changes:p})=>{var v;if(this.socket._isManualToken()||this.socket.setAuth(),p===void 0){t==null||t(Qr.SUBSCRIBED);return}else{const g=this.bindings.postgres_changes,y=(v=g==null?void 0:g.length)!==null&&v!==void 0?v:0,b=[];for(let x=0;x<y;x++){const w=g[x],{filter:{event:_,schema:j,table:N,filter:k}}=w,C=p&&p[x];if(C&&C.event===_&&Li.isFilterValueEqual(C.schema,j)&&Li.isFilterValueEqual(C.table,N)&&Li.isFilterValueEqual(C.filter,k))b.push(Object.assign(Object.assign({},w),{id:C.id}));else{this.unsubscribe(),this.state=Bt.errored,t==null||t(Qr.CHANNEL_ERROR,new Error("mismatch between server and client bindings for postgres changes"));return}}this.bindings.postgres_changes=b,t&&t(Qr.SUBSCRIBED);return}}).receive("error",p=>{this.state=Bt.errored,t==null||t(Qr.CHANNEL_ERROR,new Error(JSON.stringify(Object.values(p).join(", ")||"error")))}).receive("timeout",()=>{t==null||t(Qr.TIMED_OUT)})}return this}presenceState(){return this.presence.state}async track(t,n={}){return await this.send({type:"presence",event:"track",payload:t},n.timeout||this.timeout)}async untrack(t={}){return await this.send({type:"presence",event:"untrack"},t)}on(t,n,r){return this.state===Bt.joined&&t===kl.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,n,r)}async httpSend(t,n,r={}){var a;if(n==null)return Promise.reject("Payload is required for httpSend()");const i={apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"};this.socket.accessTokenValue&&(i.Authorization=`Bearer ${this.socket.accessTokenValue}`);const o={method:"POST",headers:i,body:JSON.stringify({messages:[{topic:this.subTopic,event:t,payload:n,private:this.private}]})},l=await this._fetchWithTimeout(this.broadcastEndpointURL,o,(a=r.timeout)!==null&&a!==void 0?a:this.timeout);if(l.status===202)return{success:!0};let c=l.statusText;
436try{const d=await l.json();c=d.error||d.message||c}catch{}return Promise.reject(new Error(c))}async send(t,n={}){var r,a;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:i,payload:o}=t,l={apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"};this.socket.accessTokenValue&&(l.Authorization=`Bearer ${this.socket.accessTokenValue}`);const c={method:"POST",headers:l,body:JSON.stringify({messages:[{topic:this.subTopic,event:i,payload:o,private:this.private}]})};try{const d=await this._fetchWithTimeout(this.broadcastEndpointURL,c,(r=n.timeout)!==null&&r!==void 0?r:this.timeout);return await((a=d.body)===null||a===void 0?void 0:a.cancel()),d.ok?"ok":"error"}catch(d){return d.name==="AbortError"?"timed out":"error"}}else return new Promise(i=>{var o,l,c;const d=this._push(t.type,t,n.timeout||this.timeout);t.type==="broadcast"&&!(!((c=(l=(o=this.params)===null||o===void 0?void 0:o.config)===null||l===void 0?void 0:l.broadcast)===null||c===void 0)&&c.ack)&&i("ok"),d.receive("ok",()=>i("ok")),d.receive("error",()=>i("error")),d.receive("timeout",()=>i("timed out"))})}updateJoinPayload(t){this.joinPush.updatePayload(t)}unsubscribe(t=this.timeout){this.state=Bt.leaving;const n=()=>{this.socket.log("channel",`leave ${this.topic}`),this._trigger(dr.close,"leave",this._joinRef())};this.joinPush.destroy();let r=null;return new Promise(a=>{r=new hf(this,dr.leave,{},t),r.receive("ok",()=>{n(),a("ok")}).receive("timeout",()=>{n(),a("timed out")}).receive("error",()=>{a("error")}),r.send(),this._canPush()||r.trigger("ok",{})}).finally(()=>{r==null||r.destroy()})}teardown(){this.pushBuffer.forEach(t=>t.destroy()),this.pushBuffer=[],this.rejoinTimer.reset(),this.joinPush.destroy(),this.state=Bt.closed,this.bindings={}}async _fetchWithTimeout(t,n,r){const a=new AbortController,i=setTimeout(()=>a.abort(),r),o=await this.socket.fetch(t,Object.assign(Object.assign({},n),{signal:a.signal}));return clearTimeout(i),o}_push(t,n,r=this.timeout){if(!this.joinedOnce)throw`tried to push '${t}' to '${this.topic}' before joining. Use channel.subscribe() before pushing events`;let a=new hf(this,t,n,r);return this._canPush()?a.send():this._addToPushBuffer(a),a}_addToPushBuffer(t){if(t.startTimeout(),this.pushBuffer.push(t),this.pushBuffer.length>_3){const n=this.pushBuffer.shift();n&&(n.destroy(),this.socket.log("channel",`discarded push due to buffer overflow: ${n.event}`,n.payload))}}_onMessage(t,n,r){return n}_isMember(t){return this.topic===t}_joinRef(){return this.joinPush.ref}_trigger(t,n,r){var a,i;const o=t.toLocaleLowerCase(),{close:l,error:c,leave:d,join:u}=dr;if(r&&[l,c,d,u].indexOf(o)>=0&&r!==this._joinRef())return;let m=this._onMessage(o,n,r);if(n&&!m)throw"channel onMessage callbacks must return the payload, modified or unmodified";["insert","update","delete"].includes(o)?(a=this.bindings.postgres_changes)===null||a===void 0||a.filter(p=>{var v,g,y;return((v=p.filter)===null||v===void 0?void 0:v.event)==="*"||((y=(g=p.filter)===null||g===void 0?void 0:g.event)===null||y===void 0?void 0:y.toLocaleLowerCase())===o}).map(p=>p.callback(m,r)):(i=this.bindings[o])===null||i===void 0||i.filter(p=>{var v,g,y,b,x,w;if(["broadcast","presence","postgres_changes"].includes(o))if("id"in p){const _=p.id,j=(v=p.filter)===null||v===void 0?void 0:v.event;return _&&((g=n.ids)===null||g===void 0?void 0:g.includes(_))&&(j==="*"||(j==null?void 0:j.toLocaleLowerCase())===((y=n.data)===null||y===void 0?void 0:y.type.toLocaleLowerCase()))}else{const _=(x=(b=p==null?void 0:p.filter)===null||b===void 0?void 0:b.event)===null||x===void 0?void 0:x.toLocaleLowerCase();return _==="*"||_===((w=n==null?void 0:n.event)===null||w===void 0?void 0:w.toLocaleLowerCase())}else return p.type.toLocaleLowerCase()===o}).map(p=>{if(typeof m=="object"&&"ids"in m){const v=m.data,{schema:g,table:y,commit_timestamp:b,type:x,errors:w}=v;m=Object.assign(Object.assign({},{schema:g,table:y,commit_timestamp:b,eventType:x,new:{},old:{},errors:w}),this._getPayloadRecords(v))}p.callback(m,r)})}_isClosed(){return this.state===Bt.closed}_isJoined(){return this.state===Bt.joined}_isJoining(){return this.state===Bt.joining}_isLeaving(){return this.state===Bt.leaving}_replyEventName(t){return`chan_reply_${t}`}_on(t,n,r){const a=t.toLocaleLowerCase(),i={type:a,filter:n,callback:r};return this.bindings[a]?this.bindings[a].push(i):this.bindings[a]=[i],this}_off(t,n){const r=t.toLocaleLowerCase();return this.bindings[r]&&(this.bindings[r]=this.bindings[r].filter(a=>{var i;return!(((i=a.type)===null||i===void 0?void 0:i.toLocaleLowerCase())===r&&Li.isEqual(a.filter,n))})),this}static isEqual(t,n){if(Object.keys(t).length!==Object.keys(n).length)return!1;for(const r in t)if(t[r]!==n[r])return!1;return!0}static isFilterValueEqual(t,n){return(t??void 0)===(n??void 0)}_rejoinUntilConnected(){this.rejoinTimer.scheduleTimeout(),this.socket.isConnected()&&this._rejoin()}_onClose(t){this._on(dr.close,{},t)}_onError(t){this._on(dr.error,{},n=>t(n))}_canPush(){return this.socket.isConnected()&&this._isJoined()}_rejoin(t=this.timeout){this._isLeaving()||(this.socket._leaveOpenTopic(this.topic),this.state=Bt.joining,this.joinPush.resend(t))}_getPayloadRecords(t){const n={new:{},old:{}};return(t.type==="INSERT"||t.type==="UPDATE")&&(n.new=Eb(t.columns,t.record)),(t.type==="UPDATE"||t.type==="DELETE")&&(n.old=Eb(t.columns,t.old_record)),n}}const ff=()=>{},uu={HEARTBEAT_INTERVAL:25e3,RECONNECT_DELAY:10,HEARTBEAT_TIMEOUT_FALLBACK:100},T3=[1e3,2e3,5e3,1e4],R3=1e4,A3=`
437  addEventListener("message", (e) => {
438    if (e.data.event === "start") {
439      setInterval(() => postMessage({ event: "keepAlive" }), e.data.interval);
440    }
441  });`;class I3{constructor(t,n){var r;if(this.accessTokenValue=null,this.apiKey=null,this._manuallySetToken=!1,this.channels=new Array,this.endPoint="",this.httpEndpoint="",this.headers={},this.params={},this.timeout=cp,this.transport=null,this.heartbeatIntervalMs=uu.HEARTBEAT_INTERVAL,this.heartbeatTimer=void 0,this.pendingHeartbeatRef=null,this.heartbeatCallback=ff,this.ref=0,this.reconnectTimer=null,this.vsn=Cb,this.logger=ff,this.conn=null,this.sendBuffer=[],this.serializer
441=new j3,this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.accessToken=null,this._connectionState="disconnected",this._wasManualDisconnect=!1,this._authPromise=null,this._heartbeatSentAt=null,this._resolveFetch=a=>a?(...i)=>a(...i):(...i)=>fetch(...i),!(!((r=n==null?void 0:n.params)===null||r===void 0)&&r.apikey))throw new Error("API key is required to connect to Realtime");this.apiKey=n.params.apikey,this.endPoint=`${t}/${up.websocket}`,this.httpEndpoint=xj(t),this._initializeOptions(n),this._setupReconnectionTimer(),this.fetch=this._resolveFetch(n==null?void 0:n.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=g3.createWebSocket(this.endpointURL())}catch(t){this._setConnectionState("disconnected");const n=t.message;throw n.includes("Node.js")?new Error(`${n}
442
443To use Realtime in Node.js, you need to provide a WebSocket implementation:
444
445Option 1: Use Node.js 22+ which has native WebSocket support
446Option 2: Install and provide the "ws" package:
447
448  npm install ws
449
450  import ws from "ws"
451  const client = new RealtimeClient(url, {
452    ...options,
453    transport: ws
454  })`):new Error(`WebSocket not available: ${n}`)}this._setupConnectionHandlers()}}endpointURL(){return this._appendParams(this.endPoint,Object.assign({},this.params,{vsn:this.vsn}))}disconnect(t,n){if(!this.isDisconnecting())if(this._setConnectionState("disconnecting",!0),this.conn){const r=setTimeout(()=>{this._setConnectionState("disconnected")},100);this.conn.onclose=()=>{clearTimeout(r),this._setConnectionState("disconnected")},typeof this.conn.close=="function"&&(t?this.conn.close(t,n??""):this.conn.close()),this._teardownConnection()}else this._setConnectionState("disconnected")}getChannels(){return this.channels}async removeChannel(t){const n=await t.unsubscribe();return this.channels.length===0&&this.disconnect(),n}async removeAllChannels(){const t=await Promise.all(this.channels.map(n=>n.unsubscribe()));return this.channels=[],this.disconnect(),t}log(t,n,r){this.logger(t,n,r)}connectionState(){switch(this.conn&&this.conn.readyState){case Cs.connecting:return ka.Connecting;case Cs.open:return ka.Open;case Cs.closing:return ka.Closing;default:return ka.Closed}}isConnected(){return this.connectionState()===ka.Open}isConnecting(){return this._connectionState==="connecting"}isDisconnecting(){return this._connectionState==="disconnecting"}channel(t,n={config:{}}){const r=`realtime:${t}`,a=this.getChannels().find(i=>i.topic===r);if(a)return a;{const i=new Li(`realtime:${t}`,n,this);return this.channels.push(i),i}}push(t){const{topic:n,event:r,payload:a,ref:i}=t,o=()=>{this.encode(t,l=>{var c;(c=this.conn)===null||c===void 0||c.send(l)})};this.log("push",`${n} ${r} (${i})`,a),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(n){this.log("error","error in heartbeat callback",n)}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(n){this.log("error","error in heartbeat callback",n)}this._wasManualDisconnect=!1,(t=this.conn)===null||t===void 0||t.close(w3,"heartbeat timeout"),setTimeout(()=>{var n;this.isConnected()||(n=this.reconnectTimer)===null||n===void 0||n.scheduleTimeout()},uu.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(n){this.log("error","error in heartbeat callback",n)}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 n=this.channels.find(r=>r.topic===t&&(r._isJoined()||r._isJoining()));n&&(this.log("transport",`leaving duplicate topic "${t}"`),n.unsubscribe())}_remove(t){this.channels=this.channels.filter(n=>n.topic!==t.topic)}_onConnMessage(t){this.decode(t.data,n=>
454{if(n.topic==="phoenix"&&n.event==="phx_reply"&&n.ref&&n.ref===this.pendingHeartbeatRef){const d=this._heartbeatSentAt?Date.now()-this._heartbeatSentAt:void 0;try{this.heartbeatCallback(n.payload.status==="ok"?"ok":"error",d)}catch(u){this.log("error","error in heartbeat callback",u)}this._heartbeatSentAt=null,this.pendingHeartbeatRef=null}const{topic:r,event:a,payload:i,ref:o}=n,l=o?`(${o})`:"",c=i.status||"";this.log("receive",`${c} ${r} ${a} ${l}`.trim(),i),this.channels.filter(d=>d._isMember(r)).forEach(d=>d._trigger(a,i,o)),this._triggerStateCallbacks("message",n)})}_clearTimer(t){var n;t==="heartbeat"&&this.heartbeatTimer?(clearInterval(this.heartbeatTimer),this.heartbeatTimer=void 0):t==="reconnect"&&((n=this.reconnectTimer)===null||n===void 0||n.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===Cs.open&&this._onConnOpen())}_teardownConnection(){if(this.conn){if(this.conn.readyState===Cs.open||this.conn.readyState===Cs.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.accessTokenValue&&(this.channels.forEach(n=>{n.updateJoinPayload({access_token:this.accessTokenValue})}),this.sendBuffer=[],this.channels.forEach(n=>{n._isJoining()&&(n.joinPush.sent=!1,n.joinPush.send())})),this.flushSendBuffer()}).catch(n=>{this.log("error","error waiting for auth on connect",n),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=n=>{this.log("worker","worker error",n.message),this._terminateWorker()},this.workerRef.onmessage=n=>{n.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 n;this._setConnectionState("disconnected"),this.log("transport","close",t),this._triggerChanError(),this._clearTimer("heartbeat"),this._wasManualDisconnect||(n=this.reconnectTimer)===null||n===void 0||n.scheduleTimeout(),this._triggerStateCallbacks("close",t)}_onConnError(t){this._setConnectionState("disconnected"),this.log("transport",`${t}`),this._triggerChanError(),this._triggerStateCallbacks("error",t);try{this.heartbeatCallback("error")}catch(n){this.log("error","error in heartbeat callback",n)}}_triggerChanError(){this.channels.forEach(t=>t._trigger(dr.error))}_appendParams(t,n){if(Object.keys(n).length===0)return t;const r=t.match(/\?/)?"&":"?",a=new URLSearchParams(n);return`${t}${r}${a}`}_workerObjectUrl(t){let n;if(t)n=t;else{const r=new Blob([A3],{type:"application/javascript"});n=URL.createObjectURL(r)}return n}_setConnectionState(t,n=!1){this._connectionState=t,t==="connecting"?this._wasManualDisconnect=!1:t==="disconnecting"&&(this._wasManualDisconnect=n)}async _performAuth(t=null){let n,r=!1;if(t)n=t,r=!0;else if(this.accessToken)try{n=await this.accessToken()}catch(a){this.log("error","Error fetching access token from callback",a),n=this.accessTokenValue}else n=this.accessTokenValue;r?this._manuallySetToken=!0:this.accessToken&&(this._manuallySetToken=!1),this.accessTokenValue!=n&&(this.accessTokenValue=n,this.channels.forEac
454h(a=>{const i={access_token:n,version:y3};n&&a.updateJoinPayload(i),a.joinedOnce&&a._isJoined()&&a._push(dr.access_token,{access_token:n})}))}async _waitForAuthIfNeeded(){this._authPromise&&await this._authPromise}_setAuthSafely(t="general"){this._isManualToken()||this.setAuth().catch(n=>{this.log("error",`Error setting auth in ${t}`,n)})}_triggerStateCallbacks(t,n){try{this.stateChangeCallbacks[t].forEach(r=>{try{r(n)}catch(a){this.log("error",`error in ${t} callback`,a)}})}catch(r){this.log("error",`error triggering ${t} callbacks`,r)}}_setupReconnectionTimer(){this.reconnectTimer=new mj(async()=>{setTimeout(async()=>{await this._waitForAuthIfNeeded(),this.isConnected()||this.connect()},uu.RECONNECT_DELAY)},this.reconnectAfterMs)}_initializeOptions(t){var n,r,a,i,o,l,c,d,u,f,m,p;switch(this.transport=(n=t==null?void 0:t.transport)!==null&&n!==void 0?n:null,this.timeout=(r=t==null?void 0:t.timeout)!==null&&r!==void 0?r:cp,this.heartbeatIntervalMs=(a=t==null?void 0:t.heartbeatIntervalMs)!==null&&a!==void 0?a:uu.HEARTBEAT_INTERVAL,this.worker=(i=t==null?void 0:t.worker)!==null&&i!==void 0?i:!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:ff,this.vsn=(c=t==null?void 0:t.vsn)!==null&&c!==void 0?c:Cb,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=(d=t==null?void 0:t.reconnectAfterMs)!==null&&d!==void 0?d:v=>T3[v-1]||R3,this.vsn){case v3:this.encode=(u=t==null?void 0:t.encode)!==null&&u!==void 0?u:(v,g)=>g(JSON.stringify(v)),this.decode=(f=t==null?void 0:t.decode)!==null&&f!==void 0?f:(v,g)=>g(JSON.parse(v));break;case fj:this.encode=(m=t==null?void 0:t.encode)!==null&&m!==void 0?m:this.serializer.encode.bind(this.serializer),this.decode=(p=t==null?void 0:t.decode)!==null&&p!==void 0?p: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 ec=class extends Error{constructor(e,t){var n;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)&&((n=t.icebergType)==null?void 0:n.includes("CommitState"))===!0}isNotFound(){return this.status===404}isConflict(){return this.status===409}isAuthenticationTimeout(){return this.status===419}};function O3(e,t,n){const r=new URL(t,e);if(n)for(const[a,i]of Object.entries(n))i!==void 0&&r.searchParams.set(a,i);return r.toString()}async function D3(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 L3(e){const t=e.fetchImpl??globalThis.fetch;return{async request({method:n,path:r,query:a,body:i,headers:o}){const l=O3(e.baseUrl,r,a),c=await D3(e.auth),d=await t(l,{method:n,headers:{...i?{"Content-Type":"application/json"}:{},...c,...o},body:i?JSON.stringify(i):void 0}),u=await d.text(),f=(d.headers.get("content-type")||"").includes("application/json"),m=f&&u?JSON.parse(u):u;if(!d.ok){const p=f?m:void 0,v=p==null?void 0:p.error;throw new ec((v==null?void 0:v.message)??`Request failed with status ${d.status}`,{status:d.status,icebergType:v==null?void 0:v.type,icebergCode:v==null?void 0:v.code,details:p})}return{status:d.status,headers:d.headers,data:m}}}}function du(e){return e.join("�")}var M3=class{constructor(e,t=""){this.client=e,this.prefix=t}async listNamespaces(e){const t=e?{parent:du(e.namespace)}:void 0;return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces`,query:t})).data.namespaces.map(r=>({namespace:r}))}async createNamespace(e,t){const n={namespace:e.namespace,properties:t==null?void 0:t.properties};return(await this.client.request({method:"POST",path:`${this.prefix}/namespaces`,body:n})).data}async dropNamespace(e){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${du(e.namespace)}`})}async loadNamespaceMetadata(e){return{properties:(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${du(e.namespace)}`})).data.properties}}async namespaceExists(e){try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${du(e.namespace)}`}),!0}catch(t){if(t instanceof ec&&t.status===404)return!1;throw t}}async createNamespaceIfNotExists(e,t){try{return await this.createNamespace(e,t)}catch(n){if(n instanceof ec&&n.status===409)return;throw n}}};function hi(e){return e.join("�")}var $3=class{constructor(e,t="",n){this.client=e,this.prefix=t,this.accessDelegation=n}async listTables(e){return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${hi(e.namespace)}/tables`})).data.identifiers}async createTable(e,t){const n={};return this.accessDelegation&&(n["X-Iceberg-Access-Delegation"]=this.accessDelegation),(await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${hi(e.namespace)}/tables`,body:t,headers:n})).data.metadata}async updateTable(e,t){const n=await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${hi(e.namespace)}/tables/${e.name}`,body:t});return{"metadata-location":n.data["metadata-location"],metadata:n.data.metadata}}async dropTable(e,t){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${hi(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/${hi(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/${hi(e.namespace)}/tables/${e.name}`,headers:t}),!0}catch(n){if(n instanceof ec&&n.status===404)return!1;throw n}}async createTableIfNotExists(e,t){try{return await this.createTable(e,t)}catch(n){if(n instanceof ec&&n.status===409)return await this.loadTable({namespace:e.namespace,name:t.name});throw n}}},F3=class{constructor(e){var r;let t="v1";e.catalogName&&(t+=`/${e.catalogName}`);const n=e.baseUrl.endsWith("/")?e.baseUrl:`${e.baseUrl}/`;this.client=L3({baseUrl:n,auth:e.auth,fetchImpl:e.fetch}),this.accessDelegation=(r=e.accessDelegation)==null?void 0:r.join(","),this.namespaceOps=new M3(this.client,t),this.tableOps=new $3(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)}
454async 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)}},lh=class extends Error{constructor(e,t="storage",n,r){super(e),this.__isStorageError=!0,this.namespace=t,this.name=t==="vectors"?"StorageVectorsError":"StorageError",this.status=n,this.statusCode=r}};function ch(e){return typeof e=="object"&&e!==null&&"__isStorageError"in e}var cl=class extends lh{constructor(e,t,n,r="storage"){super(e,r,t,n),this.name=r==="vectors"?"StorageVectorsApiError":"StorageApiError",this.status=t,this.statusCode=n}toJSON(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}}},gj=class extends lh{constructor(e,t,n="storage"){super(e,n),this.name=n==="vectors"?"StorageVectorsUnknownError":"StorageUnknownError",this.originalError=t}};const U3=e=>e?(...t)=>e(...t):(...t)=>fetch(...t),B3=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)},hp=e=>{if(Array.isArray(e))return e.map(n=>hp(n));if(typeof e=="function"||e!==Object(e))return e;const t={};return Object.entries(e).forEach(([n,r])=>{const a=n.replace(/([-_][a-z])/gi,i=>i.toUpperCase().replace(/[-_]/g,""));t[a]=hp(r)}),t},z3=e=>!e||typeof e!="string"||e.length===0||e.length>100||e.trim()!==e||e.includes("/")||e.includes("\\")?!1:/^[\w!.\*'() &$@=;:+,?-]+$/.test(e);function tc(e){"@babel/helpers - typeof";return tc=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},tc(e)}function q3(e,t){if(tc(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(tc(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function V3(e){var t=q3(e,"string");return tc(t)=="symbol"?t:t+""}function W3(e,t,n){return(t=V3(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Rb(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Oe(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Rb(Object(n),!0).forEach(function(r){W3(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Rb(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}const Ab=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)},H3=async(e,t,n,r)=>{if(e&&typeof e=="object"&&"status"in e&&"ok"in e&&typeof e.status=="number"){const a=e,i=a.status||500;if(typeof a.json=="function")a.json().then(o=>{const l=(o==null?void 0:o.statusCode)||(o==null?void 0:o.code)||i+"";t(new cl(Ab(o),i,l,r))}).catch(()=>{if(r==="vectors"){const o=i+"";t(new cl(a.statusText||`HTTP ${i} error`,i,o,r))}else{const o=i+"";t(new cl(a.statusText||`HTTP ${i} error`,i,o,r))}});else{const o=i+"";t(new cl(a.statusText||`HTTP ${i} error`,i,o,r))}}else t(new gj(Ab(e),e,r))},G3=(e,t,n,r)=>{const a={method:e,headers:(t==null?void 0:t.headers)||{}};return e==="GET"||e==="HEAD"||!r?Oe(Oe({},a),n):(B3(r)?(a.headers=Oe({"Content-Type":"application/json"},t==null?void 0:t.headers),a.body=JSON.stringify(r)):a.body=r,t!=null&&t.duplex&&(a.duplex=t.duplex),Oe(Oe({},a),n))};async function nl(e,t,n,r,a,i,o){return new Promise((l,c)=>{e(n,G3(t,r,a,i)).then(d=>{if(!d.ok)throw d;if(r!=null&&r.noResolveJson)return d;if(o==="vectors"){const u=d.headers.get("content-type");if(d.headers.get("content-length")==="0"||d.status===204)return{};if(!u||!u.includes("application/json"))return{}}return d.json()}).then(d=>l(d)).catch(d=>H3(d,c,r,o))})}function bj(e="storage"){return{get:async(t,n,r,a)=>nl(t,"GET",n,r,a,void 0,e),post:async(t,n,r,a,i)=>nl(t,"POST",n,a,i,r,e),put:async(t,n,r,a,i)=>nl(t,"PUT",n,a,i,r,e),head:async(t,n,r,a)=>nl(t,"HEAD",n,Oe(Oe({},r),{},{noResolveJson:!0}),a,void 0,e),remove:async(t,n,r,a,i)=>nl(t,"DELETE",n,a,i,r,e)}}const K3=bj("storage"),{get:nc,post:or,put:fp,head:Y3,remove:J0}=K3,$n=bj("vectors");var Ao=class{constructor(e,t={},n,r="storage"){this.shouldThrowOnError=!1,this.url=e,this.headers=t,this.fetch=U3(n),this.namespace=r}throwOnError(){return this.shouldThrowOnError=!0,this}setHeader(e,t){return this.headers=Oe(Oe({},this.headers),{},{[e]:t}),this}async handleOperation(e){var t=this;try{return{data:await e(),error:null}}catch(n){if(t.shouldThrowOnError)throw n;if(ch(n))return{data:null,error:n};throw n}}},Q3=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(ch(t))return{data:null,error:t};throw t}}};let yj;yj=Symbol.toStringTag;var J3=class{constructor(e,t){this.downloadFn=e,this.shouldThrowOnError=t,this[yj]="BlobDownloadBuilder",this.promise=null}asStream(){return new Q3(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(ch(t))return{data:null,error:t};throw t}}};const X3={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},Ib={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1};var Z3=class extends Ao{constructor(e,t={},n,r){super(e,t,r,"storage"),this.bucketId=n}async uploadOrUpdate(e,t,n,r){var a=this;return a.handleOperation(async()=>{let i;const o=Oe(Oe({},Ib),r);let l=Oe(Oe({},a.headers),e==="POST"&&{"x-upsert":String(o.upsert)});const c=o.metadata;typeof Blob<"u"&&n instanceof Blob?(i=new FormData,i.append("cacheControl",o.cacheControl),c&&i.append("metadata",a.encodeMetadata(c)),i.append("",n)):typeof FormData<"u"&&n instanceof FormData?(i=n,i.has("cacheControl")||i.append("cacheControl",o.cacheControl),c&&!i.has("metadata")&&i.append("metadata",a.encodeMetadata(c))):(i=n,l["cache-control"]=`max-age=${o.cacheControl}`,l["content-type"]=o.contentType,c&&(l["x-metadata"]=a.toBase64(a.encodeMetadata(c))),(typeof ReadableStream<"u"&&i instanceof ReadableStream||i&&typeof i=="object"&&"pipe"in i&&typeof i.pipe=="function")&&!o.duplex&&(o.duplex="half")),r!=null&&r.headers&&(l=Oe(Oe({},l),r.headers));const d=a._removeEmptyFolders(t),u=a._getFinalPath(d),f=await(e=="PUT"?fp:or)(a.fetch,`${a.url}/object/${u}`,i,Oe({headers:l},o!=null&&o.duplex?{duplex:o.duplex}:{}));return{path:d,id:f.Id,fullPath:f.Key}})}async upload(e,t,n){return this.uploadOrUpdate("POST",e,t,n)}async uploadToSignedUrl(e,t,n,r){var a=this;const i=a._removeEmptyFolders(e),o=a._getFinalPath(i),l=new URL(a.url+`/object/upload/sign/${o}`);return l.searchParams.set("token",t),a.handleOperation(async()=>{let c;const d=Oe({upsert:Ib.upsert},r),u=Oe(Oe({},a.headers),{"x-upsert":String(d.upsert)});return typeof Blob<"u"&&n instanceof Blob?(c=new FormData,c.append("cacheControl",d.cacheControl),c.append("",n)):typeof FormData<"u"&&n instanceof FormData?(c=n,c.append("cacheControl",d.cacheControl)):(c=n,u["cache-control"]=`max-age=${d.cacheControl}`,u["content-type"]=d.contentType),{path:i,fullPath:(await fp(a.fetch,l.toString(),c,{headers:u})).Key}})}async createSignedUploadUrl(e,t){var n=this;return n.handleOperation(async()=>{let r=n._getFinalPath(e);const a=Oe({},n.headers);t!=null&&t.upsert&&(a["x-upsert"]="true");const i=await or(n.fetch,`${n.url}/object/upload/sign/${r}`,{},{headers:a}),o=new URL(n.url+i.url),l=o.searchParams.get("token");if(!l)throw new lh("No token returned by API");return{signedUrl:o.toString(),path:e,token:l}})}async update(e,t,n){return this.uploadOrUpdate("PUT",e,t,n)}async move(e,t,n){var r=this;return r.handleOperation(async()=>await or(r.fetch,`${r.url}/object/move`,{bucketId:r.bucketId,sourceKey:e,destinationKey:t,de
454stinationBucket:n==null?void 0:n.destinationBucket},{headers:r.headers}))}async copy(e,t,n){var r=this;return r.handleOperation(async()=>({path:(await or(r.fetch,`${r.url}/object/copy`,{bucketId:r.bucketId,sourceKey:e,destinationKey:t,destinationBucket:n==null?void 0:n.destinationBucket},{headers:r.headers})).Key}))}async createSignedUrl(e,t,n){var r=this;return r.handleOperation(async()=>{let a=r._getFinalPath(e),i=await or(r.fetch,`${r.url}/object/sign/${a}`,Oe({expiresIn:t},n!=null&&n.transform?{transform:n.transform}:{}),{headers:r.headers});const o=n!=null&&n.download?`&download=${n.download===!0?"":n.download}`:"",l=n!=null&&n.transform&&i.signedURL.includes("/object/sign/")?i.signedURL.replace("/object/sign/","/render/image/sign/"):i.signedURL;return{signedUrl:encodeURI(`${r.url}${l}${o}`)}})}async createSignedUrls(e,t,n){var r=this;return r.handleOperation(async()=>{const a=await or(r.fetch,`${r.url}/object/sign/${r.bucketId}`,{expiresIn:t,paths:e},{headers:r.headers}),i=n!=null&&n.download?`&download=${n.download===!0?"":n.download}`:"";return a.map(o=>Oe(Oe({},o),{},{signedUrl:o.signedURL?encodeURI(`${r.url}${o.signedURL}${i}`):null}))})}download(e,t,n){const r=typeof(t==null?void 0:t.transform)<"u"?"render/image/authenticated":"object",a=this.transformOptsToQueryString((t==null?void 0:t.transform)||{}),i=a?`?${a}`:"",o=this._getFinalPath(e),l=()=>nc(this.fetch,`${this.url}/${r}/${o}${i}`,{headers:this.headers,noResolveJson:!0},n);return new J3(l,this.shouldThrowOnError)}async info(e){var t=this;const n=t._getFinalPath(e);return t.handleOperation(async()=>hp(await nc(t.fetch,`${t.url}/object/info/${n}`,{headers:t.headers})))}async exists(e){var t=this;const n=t._getFinalPath(e);try{return await Y3(t.fetch,`${t.url}/object/${n}`,{headers:t.headers}),{data:!0,error:null}}catch(a){if(t.shouldThrowOnError)throw a;if(ch(a)){var r;const i=a instanceof cl?a.status:a instanceof gj?(r=a.originalError)===null||r===void 0?void 0:r.status:void 0;if(i!==void 0&&[400,404].includes(i))return{data:!1,error:a}}throw a}}getPublicUrl(e,t){const n=this._getFinalPath(e),r=[],a=t!=null&&t.download?`download=${t.download===!0?"":t.download}`:"";a!==""&&r.push(a);const i=typeof(t==null?void 0:t.transform)<"u"?"render/image":"object",o=this.transformOptsToQueryString((t==null?void 0:t.transform)||{});o!==""&&r.push(o);let l=r.join("&");return l!==""&&(l=`?${l}`),{data:{publicUrl:encodeURI(`${this.url}/${i}/public/${n}${l}`)}}}async remove(e){var t=this;return t.handleOperation(async()=>await J0(t.fetch,`${t.url}/object/${t.bucketId}`,{prefixes:e},{headers:t.headers}))}async list(e,t,n){var r=this;return r.handleOperation(async()=>{const a=Oe(Oe(Oe({},X3),t),{},{prefix:e||""});return await or(r.fetch,`${r.url}/object/list/${r.bucketId}`,a,{headers:r.headers},n)})}async listV2(e,t){var n=this;return n.handleOperation(async()=>{const r=Oe({},e);return await or(n.fetch,`${n.url}/object/list-v2/${n.bucketId}`,r,{headers:n.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 eR="2.99.1",wc={"X-Client-Info":`storage-js/${eR}`};var tR=class extends Ao{constructor(e,t={},n,r){const a=new URL(e);r!=null&&r.useNewHostname&&/supabase\.(co|in|red)$/.test(a.hostname)&&!a.hostname.includes("storage.supabase.")&&(a.hostname=a.hostname.replace("supabase.","storage.supabase."));const i=a.href.replace(/\/$/,""),o=Oe(Oe({},wc),t);super(i,o,n,"storage")}async listBuckets(e){var t=this;return t.handleOperation(async()=>{const n=t.listBucketOptionsToQueryString(e);return await nc(t.fetch,`${t.url}/bucket${n}`,{headers:t.headers})})}async getBucket(e){var t=this;return t.handleOperation(async()=>await nc(t.fetch,`${t.url}/bucket/${e}`,{headers:t.headers}))}async createBucket(e,t={public:!1}){var n=this;return n.handleOperation(async()=>await or(n.fetch,`${n.url}/bucket`,{id:e,name:e,type:t.type,public:t.public,file_size_limit:t.fileSizeLimit,allowed_mime_types:t.allowedMimeTypes},{headers:n.headers}))}async updateBucket(e,t){var n=this;return n.handleOperation(async()=>await fp(n.fetch,`${n.url}/bucket/${e}`,{id:e,name:e,public:t.public,file_size_limit:t.fileSizeLimit,allowed_mime_types:t.allowedMimeTypes},{headers:n.headers}))}async emptyBucket(e){var t=this;return t.handleOperation(async()=>await or(t.fetch,`${t.url}/bucket/${e}/empty`,{},{headers:t.headers}))}async deleteBucket(e){var t=this;return t.handleOperation(async()=>await J0(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():""}},nR=class extends Ao{constructor(e,t={},n){const r=e.replace(/\/$/,""),a=Oe(Oe({},wc),t);super(r,a,n,"storage")}async createBucket(e){var t=this;return t.handleOperation(async()=>await or(t.fetch,`${t.url}/bucket`,{name:e},{headers:t.headers}))}async listBuckets(e){var t=this;return t.handleOperation(async()=>{const n=new URLSearchParams;(e==null?void 0:e.limit)!==void 0&&n.set("limit",e.limit.toString()),(e==null?void 0:e.offset)!==void 0&&n.set("offset",e.offset.toString()),e!=null&&e.sortColumn&&n.set("sortColumn",e.sortColumn),e!=null&&e.sortOrder&&n.set("sortOrder",e.sortOrder),e!=null&&e.search&&n.set("search",e.search);const r=n.toString(),a=r?`${t.url}/bucket?${r}`:`${t.url}/bucket`;return await nc(t.fetch,a,{headers:t.headers})})}async deleteBucket(e){var t=this;return t.handleOperation(async()=>await J0(t.fetch,`${t.url}/bucket/${e}`,{},{headers:t.headers}))}from(e){var t=this;if(!z3(e))throw new lh("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 n=new F3({baseUrl:this.url,catalogName:e,auth:{type:"custom",getHeaders:async()=>t.headers},fetch:this.fetch}
454),r=this.shouldThrowOnError;return new Proxy(n,{get(a,i){const o=a[i];return typeof o!="function"?o:async(...l)=>{try{return{data:await o.apply(a,l),error:null}}catch(c){if(r)throw c;return{data:null,error:c}}}}})}},rR=class extends Ao{constructor(e,t={},n){const r=e.replace(/\/$/,""),a=Oe(Oe({},wc),{},{"Content-Type":"application/json"},t);super(r,a,n,"vectors")}async createIndex(e){var t=this;return t.handleOperation(async()=>await $n.post(t.fetch,`${t.url}/CreateIndex`,e,{headers:t.headers})||{})}async getIndex(e,t){var n=this;return n.handleOperation(async()=>await $n.post(n.fetch,`${n.url}/GetIndex`,{vectorBucketName:e,indexName:t},{headers:n.headers}))}async listIndexes(e){var t=this;return t.handleOperation(async()=>await $n.post(t.fetch,`${t.url}/ListIndexes`,e,{headers:t.headers}))}async deleteIndex(e,t){var n=this;return n.handleOperation(async()=>await $n.post(n.fetch,`${n.url}/DeleteIndex`,{vectorBucketName:e,indexName:t},{headers:n.headers})||{})}},sR=class extends Ao{constructor(e,t={},n){const r=e.replace(/\/$/,""),a=Oe(Oe({},wc),{},{"Content-Type":"application/json"},t);super(r,a,n,"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 $n.post(t.fetch,`${t.url}/PutVectors`,e,{headers:t.headers})||{})}async getVectors(e){var t=this;return t.handleOperation(async()=>await $n.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 $n.post(t.fetch,`${t.url}/ListVectors`,e,{headers:t.headers}))}async queryVectors(e){var t=this;return t.handleOperation(async()=>await $n.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 $n.post(t.fetch,`${t.url}/DeleteVectors`,e,{headers:t.headers})||{})}},aR=class extends Ao{constructor(e,t={},n){const r=e.replace(/\/$/,""),a=Oe(Oe({},wc),{},{"Content-Type":"application/json"},t);super(r,a,n,"vectors")}async createBucket(e){var t=this;return t.handleOperation(async()=>await $n.post(t.fetch,`${t.url}/CreateVectorBucket`,{vectorBucketName:e},{headers:t.headers})||{})}async getBucket(e){var t=this;return t.handleOperation(async()=>await $n.post(t.fetch,`${t.url}/GetVectorBucket`,{vectorBucketName:e},{headers:t.headers}))}async listBuckets(e={}){var t=this;return t.handleOperation(async()=>await $n.post(t.fetch,`${t.url}/ListVectorBuckets`,e,{headers:t.headers}))}async deleteBucket(e){var t=this;return t.handleOperation(async()=>await $n.post(t.fetch,`${t.url}/DeleteVectorBucket`,{vectorBucketName:e},{headers:t.headers})||{})}},iR=class extends aR{constructor(e,t={}){super(e,t.headers||{},t.fetch)}from(e){return new oR(this.url,this.headers,e,this.fetch)}async createBucket(e){var t=()=>super.createBucket,n=this;return t().call(n,e)}async getBucket(e){var t=()=>super.getBucket,n=this;return t().call(n,e)}async listBuckets(e={}){var t=()=>super.listBuckets,n=this;return t().call(n,e)}async deleteBucket(e){var t=()=>super.deleteBucket,n=this;return t().call(n,e)}},oR=class extends rR{constructor(e,t,n,r){super(e,t,r),this.vectorBucketName=n}async createIndex(e){var t=()=>super.createIndex,n=this;return t().call(n,Oe(Oe({},e),{},{vectorBucketName:n.vectorBucketName}))}async listIndexes(e={}){var t=()=>super.listIndexes,n=this;return t().call(n,Oe(Oe({},e),{},{vectorBucketName:n.vectorBucketName}))}async getIndex(e){var t=()=>super.getIndex,n=this;return t().call(n,n.vectorBucketName,e)}async deleteIndex(e){var t=()=>super.deleteIndex,n=this;return t().call(n,n.vectorBucketName,e)}index(e){return new lR(this.url,this.headers,this.vectorBucketName,e,this.fetch)}},lR=class extends sR{constructor(e,t,n,r,a){super(e,t,a),this.vectorBucketName=n,this.indexName=r}async putVectors(e){var t=()=>super.putVectors,n=this;return t().call(n,Oe(Oe({},e),{},{vectorBucketName:n.vectorBucketName,indexName:n.indexName}))}async getVectors(e){var t=()=>super.getVectors,n=this;return t().call(n,Oe(Oe({},e),{},{vectorBucketName:n.vectorBucketName,indexName:n.indexName}))}async listVectors(e={}){var t=()=>super.listVectors,n=this;return t().call(n,Oe(Oe({},e),{},{vectorBucketName:n.vectorBucketName,indexName:n.indexName}))}async queryVectors(e){var t=()=>super.queryVectors,n=this;return t().call(n,Oe(Oe({},e),{},{vectorBucketName:n.vectorBucketName,indexName:n.indexName}))}async deleteVectors(e){var t=()=>super.deleteVectors,n=this;return t().call(n,Oe(Oe({},e),{},{vectorBucketName:n.vectorBucketName,indexName:n.indexName}))}},cR=class extends tR{constructor(e,t={},n,r){super(e,t,n,r)}from(e){return new Z3(this.url,this.headers,e,this.fetch)}get vectors(){return new iR(this.url+"/vector",{headers:this.headers,fetch:this.fetch})}get analytics(){return new nR(this.url+"/iceberg",this.headers,this.fetch)}};const vj="2.99.1",_i=30*1e3,mp=3,mf=mp*_i,uR="http://localhost:9999",dR="supabase.auth.token",hR={"X-Client-Info":`gotrue-js/${vj}`},pp="X-Supabase-Api-Version",wj={"2024-01-01":{timestamp:Date.parse("2024-01-01T00:00:00.0Z"),name:"2024-01-01"}},fR=/^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}$|[a-z0-9_-]{2}$)$/i,mR=10*60*1e3;
454class rc extends Error{constructor(t,n,r){super(t),this.__isAuthError=!0,this.name="AuthError",this.status=n,this.code=r}}function ke(e){return typeof e=="object"&&e!==null&&"__isAuthError"in e}class pR extends rc{constructor(t,n,r){super(t,n,r),this.name="AuthApiError",this.status=n,this.code=r}}function xR(e){return ke(e)&&e.name==="AuthApiError"}class Sa extends rc{constructor(t,n){super(t),this.name="AuthUnknownError",this.originalError=n}}class xs extends rc{constructor(t,n,r,a){super(t,r,a),this.name=n,this.status=r}}class Dn extends xs{constructor(){super("Auth session missing!","AuthSessionMissingError",400,void 0)}}function pf(e){return ke(e)&&e.name==="AuthSessionMissingError"}class fi extends xs{constructor(){super("Auth session or user missing","AuthInvalidTokenResponseError",500,void 0)}}class hu extends xs{constructor(t){super(t,"AuthInvalidCredentialsError",400,void 0)}}class fu extends xs{constructor(t,n=null){super(t,"AuthImplicitGrantRedirectError",500,void 0),this.details=null,this.details=n}toJSON(){return{name:this.name,message:this.message,status:this.status,details:this.details}}}function gR(e){return ke(e)&&e.name==="AuthImplicitGrantRedirectError"}class Ob extends xs{constructor(t,n=null){super(t,"AuthPKCEGrantCodeExchangeError",500,void 0),this.details=null,this.details=n}toJSON(){return{name:this.name,message:this.message,status:this.status,details:this.details}}}class bR extends xs{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 xp extends xs{constructor(t,n){super(t,"AuthRetryableFetchError",n,void 0)}}function xf(e){return ke(e)&&e.name==="AuthRetryableFetchError"}class Db extends xs{constructor(t,n,r){super(t,"AuthWeakPasswordError",n,"weak_password"),this.reasons=r}}class gp extends xs{constructor(t){super(t,"AuthInvalidJwtError",400,"invalid_jwt")}}const jd="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".split(""),Lb=` 	
455\r=`.split(""),yR=(()=>{const e=new Array(128);for(let t=0;t<e.length;t+=1)e[t]=-1;for(let t=0;t<Lb.length;t+=1)e[Lb[t].charCodeAt(0)]=-2;for(let t=0;t<jd.length;t+=1)e[jd[t].charCodeAt(0)]=t;return e})();function Mb(e,t,n){if(e!==null)for(t.queue=t.queue<<8|e,t.queuedBits+=8;t.queuedBits>=6;){const r=t.queue>>t.queuedBits-6&63;n(jd[r]),t.queuedBits-=6}else if(t.queuedBits>0)for(t.queue=t.queue<<6-t.queuedBits,t.queuedBits=6;t.queuedBits>=6;){const r=t.queue>>t.queuedBits-6&63;n(jd[r]),t.queuedBits-=6}}function _j(e,t,n){const r=yR[e];if(r>-1)for(t.queue=t.queue<<6|r,t.queuedBits+=6;t.queuedBits>=8;)n(t.queue>>t.queuedBits-8&255),t.queuedBits-=8;else{if(r===-2)return;throw new Error(`Invalid Base64-URL character "${String.fromCharCode(e)}"`)}}function $b(e){const t=[],n=o=>{t.push(String.fromCodePoint(o))},r={utf8seq:0,codepoint:0},a={queue:0,queuedBits:0},i=o=>{_R(o,r,n)};for(let o=0;o<e.length;o+=1)_j(e.charCodeAt(o),a,i);return t.join("")}function vR(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 wR(e,t){for(let n=0;n<e.length;n+=1){let r=e.charCodeAt(n);if(r>55295&&r<=56319){const a=(r-55296)*1024&65535;r=(e.charCodeAt(n+1)-56320&65535|a)+65536,n+=1}vR(r,t)}}function _R(e,t,n){if(t.utf8seq===0){if(e<=127){n(e);return}for(let r=1;r<6;r+=1)if(!(e>>7-r&1)){t.utf8seq=r;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&&n(t.codepoint)}}function Hi(e){const t=[],n={queue:0,queuedBits:0},r=a=>{t.push(a)};for(let a=0;a<e.length;a+=1)_j(e.charCodeAt(a),n,r);return new Uint8Array(t)}function jR(e){const t=[];return wR(e,n=>t.push(n)),new Uint8Array(t)}function Ta(e){const t=[],n={queue:0,queuedBits:0},r=a=>{t.push(a)};return e.forEach(a=>Mb(a,n,r)),Mb(null,n,r),t.join("")}function NR(e){return Math.round(Date.now()/1e3)+e}function kR(){return Symbol("auth-callback")}const Zt=()=>typeof window<"u"&&typeof document<"u",xa={tested:!1,writable:!1},jj=()=>
455{if(!Zt())return!1;try{if(typeof globalThis.localStorage!="object")return!1}catch{return!1}if(xa.tested)return xa.writable;const e=`lswt-${Math.random()}${Math.random()}`;try{globalThis.localStorage.setItem(e,e),globalThis.localStorage.removeItem(e),xa.tested=!0,xa.writable=!0}catch{xa.tested=!0,xa.writable=!1}return xa.writable};function SR(e){const t={},n=new URL(e);if(n.hash&&n.hash[0]==="#")try{new URLSearchParams(n.hash.substring(1)).forEach((a,i)=>{t[i]=a})}catch{}return n.searchParams.forEach((r,a)=>{t[a]=r}),t}const Nj=e=>e?(...t)=>e(...t):(...t)=>fetch(...t),CR=e=>typeof e=="object"&&e!==null&&"status"in e&&"ok"in e&&"json"in e&&typeof e.json=="function",ji=async(e,t,n)=>{await e.setItem(t,JSON.stringify(n))},ga=async(e,t)=>{const n=await e.getItem(t);if(!n)return null;try{return JSON.parse(n)}catch{return n}},Xt=async(e,t)=>{await e.removeItem(t)};class uh{constructor(){this.promise=new uh.promiseConstructor((t,n)=>{this.resolve=t,this.reject=n})}}uh.promiseConstructor=Promise;function mu(e){const t=e.split(".");if(t.length!==3)throw new gp("Invalid JWT structure");for(let r=0;r<t.length;r++)if(!fR.test(t[r]))throw new gp("JWT not in base64url format");return{header:JSON.parse($b(t[0])),payload:JSON.parse($b(t[1])),signature:Hi(t[2]),raw:{header:t[0],payload:t[1]}}}async function ER(e){return await new Promise(t=>{setTimeout(()=>t(null),e)})}function PR(e,t){return new Promise((r,a)=>{(async()=>{for(let i=0;i<1/0;i++)try{const o=await e(i);if(!t(i,null,o)){r(o);return}}catch(o){if(!t(i,o)){a(o);return}}})()})}function TR(e){return("0"+e.toString(16)).substr(-2)}function RR(){const t=new Uint32Array(56);if(typeof crypto>"u"){const n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~",r=n.length;let a="";for(let i=0;i<56;i++)a+=n.charAt(Math.floor(Math.random()*r));return a}return crypto.getRandomValues(t),Array.from(t,TR).join("")}async function AR(e){const n=new TextEncoder().encode(e),r=await crypto.subtle.digest("SHA-256",n),a=new Uint8Array(r);return Array.from(a).map(i=>String.fromCharCode(i)).join("")}async function IR(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 n=await AR(e);return btoa(n).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function mi(e,t,n=!1){const r=RR();let a=r;n&&(a+="/PASSWORD_RECOVERY"),await ji(e,`${t}-code-verifier`,a);const i=await IR(r);return[i,r===i?"plain":"s256"]}const OR=/^2[0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|1[0-9]|2[0-9]|3[0-1])$/i;function DR(e){const t=e.headers.get(pp);if(!t||!t.match(OR))return null;try{return new Date(`${t}T00:00:00.0Z`)}catch{return null}}function LR(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 MR(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 $R=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;function pi(e){if(!$R.test(e))throw new Error("@supabase/auth-js: Expected parameter to be UUID but is not")}function gf(){const e={};return new Proxy(e,{get:(t,n)=>{if(n==="__isUserNotAvailableProxy")return!0;if(typeof n=="symbol"){const r=n.toString();if(r==="Symbol(Symbol.toPrimitive)"||r==="Symbol(Symbol.toStringTag)"||r==="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 "${n}" property of the session object is not supported. Please use getUser() instead.`)},set:(t,n)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Setting the "${n}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)},deleteProperty:(t,n)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Deleting the "${n}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)}})}function FR(e,t){return new Proxy(e,{get:(n,r,a)=>{if(r==="__isInsecureUserWarningProxy")return!0;
455if(typeof r=="symbol"){const i=r.toString();if(i==="Symbol(Symbol.toPrimitive)"||i==="Symbol(Symbol.toStringTag)"||i==="Symbol(util.inspect.custom)"||i==="Symbol(nodejs.util.inspect.custom)")return Reflect.get(n,r,a)}return!t.value&&typeof r=="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(n,r,a)}})}function Fb(e){return JSON.parse(JSON.stringify(e))}const Na=e=>e.msg||e.message||e.error_description||e.error||JSON.stringify(e),UR=[502,503,504];async function Ub(e){var t;if(!CR(e))throw new xp(Na(e),0);if(UR.includes(e.status))throw new xp(Na(e),e.status);let n;try{n=await e.json()}catch(i){throw new Sa(Na(i),i)}let r;const a=DR(e);if(a&&a.getTime()>=wj["2024-01-01"].timestamp&&typeof n=="object"&&n&&typeof n.code=="string"?r=n.code:typeof n=="object"&&n&&typeof n.error_code=="string"&&(r=n.error_code),r){if(r==="weak_password")throw new Db(Na(n),e.status,((t=n.weak_password)===null||t===void 0?void 0:t.reasons)||[]);if(r==="session_not_found")throw new Dn}else if(typeof n=="object"&&n&&typeof n.weak_password=="object"&&n.weak_password&&Array.isArray(n.weak_password.reasons)&&n.weak_password.reasons.length&&n.weak_password.reasons.reduce((i,o)=>i&&typeof o=="string",!0))throw new Db(Na(n),e.status,n.weak_password.reasons);throw new pR(Na(n),e.status||500,r)}const BR=(e,t,n,r)=>{const a={method:e,headers:(t==null?void 0:t.headers)||{}};return e==="GET"?a:(a.headers=Object.assign({"Content-Type":"application/json;charset=UTF-8"},t==null?void 0:t.headers),a.body=JSON.stringify(r),Object.assign(Object.assign({},a),n))};async function Te(e,t,n,r){var a;const i=Object.assign({},r==null?void 0:r.headers);i[pp]||(i[pp]=wj["2024-01-01"].name),r!=null&&r.jwt&&(i.Authorization=`Bearer ${r.jwt}`);const o=(a=r==null?void 0:r.query)!==null&&a!==void 0?a:{};r!=null&&r.redirectTo&&(o.redirect_to=r.redirectTo);const l=Object.keys(o).length?"?"+new URLSearchParams(o).toString():"",c=await zR(e,t,n+l,{headers:i,noResolveJson:r==null?void 0:r.noResolveJson},{},r==null?void 0:r.body);return r!=null&&r.xform?r==null?void 0:r.xform(c):{data:Object.assign({},c),error:null}}async function zR(e,t,n,r,a,i){const o=BR(t,r,a,i);let l;try{l=await e(n,Object.assign({},o))}catch(c){throw console.error(c),new xp(Na(c),0)}if(l.ok||await Ub(l),r!=null&&r.noResolveJson)return l;try{return await l.json()}catch(c){await Ub(c)}}function ar(e){var t;let n=null;WR(e)&&(n=Object.assign({},e),e.expires_at||(n.expires_at=NR(e.expires_in)));const r=(t=e.user)!==null&&t!==void 0?t:e;return{data:{session:n,user:r},error:null}}function Bb(e){const t=ar(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((n,r)=>n&&typeof r=="string",!0)&&(t.data.weak_password=e.weak_password),t}function Rs(e){var t;return{data:{user:(t=e.user)!==null&&t!==void 0?t:e},error:null}}function qR(e){return{data:e,error:null}}function VR(e){const{action_link:t,email_otp:n,hashed_token:r,redirect_to:a,verification_type:i}=e,o=Ro(e,["action_link","email_otp","hashed_token","redirect_to","verification_type"]),l={action_link:t,email_otp:n,hashed_token:r,redirect_to:a,verification_type:i},c=Object.assign({},o);return{data:{properties:l,user:c},error:null}}function zb(e){return e}function WR(e){return e.access_token&&e.refresh_token&&e.expires_in}const bf=["global","local","others"];class HR{constructor({url:t="",headers:n={},fetch:r}){this.url=t,this.headers=n,this.fetch=Nj(r),this.mfa={listFactors:this._listFactors.bind(this),deleteFactor:this._deleteFactor.bind(this)},this.oauth={listClients:this._listOAuthClients.bind(this),createClient:this._createOAuthClient.bind(this),getClient:this._getOAuthClient.bind(this),updateClient:this._updateOAuthClient.bind(this),deleteClient:this._deleteOAuthClient.bind(this),regenerateClientSecret:this._regenerateOAuthClientSecret.bind(this)},this.customProviders={listProviders:this._listCustomProviders.bind(this),createProvider:this._createCustomProvider.bind(this),getProvider:this._getCustomProvider.bind(this),updateProvider:this._updateCustomProvider.bind(this),deleteProvider:this._deleteCustomProvider.bind(this)}}async signOut(t,n=bf[0]){if(bf.indexOf(n)<0)throw new Error(`@supabase/auth-js: Parameter scope must be one of ${bf.join(", ")}`);try{return await Te(this.fetch,"POST",`${this.url}/logout?scope=${n}`,{headers:this.headers,jwt:t,noResolveJson:!0}),{data:null,error:null}}catch(r){if(ke(r))return{data:null,error:r};throw r}}async inviteUserByEmail(t,n={}){try{return await Te(this.fetch,"POST",`${this.url}/invite`,{body:{email:t,data:n.data},headers:this.headers,redirectTo:n.redirectTo,xform:Rs})}catch(r){if(ke(r))return{data:{user:null},error:r};throw r}}async generateLink(t){try{const{options:n}=t,r=Ro(t,["options"]),a=Object.assign(Object.assign({},r),n);return"newEmail"in r&&(a.new_email=r==null?void 0:r.newEmail,delete a.newEmail),await Te(this.fetch,"POST",`${this.url}/admin/generate_link`,{body:a,headers:this.headers,xform:VR,redirectTo:n==null?void 0:n.redirectTo})}catch(n){if(ke(n))return{data:{properties:null,user:null},error:n};throw n}}async createUser(t){try{return await Te(this.fetch,"POST",`${this.url}/admin/users`,{body:t,headers:this.headers,xform:Rs})}catch(n){if(ke(n))return{data:{user:null},error:n};throw n}}async listUsers(t){var n,r,a,i,o,l,c;try{const d={nextPage:null,lastPage:0,total:0},u=await Te(this.fetch,"GET",`${this.url}/admin/users`,{headers:this.headers,noResolveJson:!0,query:{page:(r=(n=t==null?void 0:t.page)===null||n===void 0?void 0:n.toString())!==null&&r!==void 0?r:"",per_page:(i=(a=t==null?void 0:t.perPage)===null||a===void 0?void 0:a.toString())!==null&&i!==void 0?i:""},xform:zb});if(u.error)throw u.error;const f=await u.json(),m=(o=u.headers.get("x-total-count"))!==null&&o!==void 0?o:0,p=(c=(l=u.headers.get("link"))===null||l===void 0?void 0:l.split(","))!==null&&c!==void 0?c:[];return p.length>
4550&&(p.forEach(v=>{const g=parseInt(v.split(";")[0].split("=")[1].substring(0,1)),y=JSON.parse(v.split(";")[1].split("=")[1]);d[`${y}Page`]=g}),d.total=parseInt(m)),{data:Object.assign(Object.assign({},f),d),error:null}}catch(d){if(ke(d))return{data:{users:[]},error:d};throw d}}async getUserById(t){pi(t);try{return await Te(this.fetch,"GET",`${this.url}/admin/users/${t}`,{headers:this.headers,xform:Rs})}catch(n){if(ke(n))return{data:{user:null},error:n};throw n}}async updateUserById(t,n){pi(t);try{return await Te(this.fetch,"PUT",`${this.url}/admin/users/${t}`,{body:n,headers:this.headers,xform:Rs})}catch(r){if(ke(r))return{data:{user:null},error:r};throw r}}async deleteUser(t,n=!1){pi(t);try{return await Te(this.fetch,"DELETE",`${this.url}/admin/users/${t}`,{headers:this.headers,body:{should_soft_delete:n},xform:Rs})}catch(r){if(ke(r))return{data:{user:null},error:r};throw r}}async _listFactors(t){pi(t.userId);try{const{data:n,error:r}=await Te(this.fetch,"GET",`${this.url}/admin/users/${t.userId}/factors`,{headers:this.headers,xform:a=>({data:{factors:a},error:null})});return{data:n,error:r}}catch(n){if(ke(n))return{data:null,error:n};throw n}}async _deleteFactor(t){pi(t.userId),pi(t.id);try{return{data:await Te(this.fetch,"DELETE",`${this.url}/admin/users/${t.userId}/factors/${t.id}`,{headers:this.headers}),error:null}}catch(n){if(ke(n))return{data:null,error:n};throw n}}async _listOAuthClients(t){var n,r,a,i,o,l,c;try{const d={nextPage:null,lastPage:0,total:0},u=await Te(this.fetch,"GET",`${this.url}/admin/oauth/clients`,{headers:this.headers,noResolveJson:!0,query:{page:(r=(n=t==null?void 0:t.page)===null||n===void 0?void 0:n.toString())!==null&&r!==void 0?r:"",per_page:(i=(a=t==null?void 0:t.perPage)===null||a===void 0?void 0:a.toString())!==null&&i!==void 0?i:""},xform:zb});if(u.error)throw u.error;const f=await u.json(),m=(o=u.headers.get("x-total-count"))!==null&&o!==void 0?o:0,p=(c=(l=u.headers.get("link"))===null||l===void 0?void 0:l.split(","))!==null&&c!==void 0?c:[];return p.length>0&&(p.forEach(v=>{const g=parseInt(v.split(";")[0].split("=")[1].substring(0,1)),y=JSON.parse(v.split(";")[1].split("=")[1]);d[`${y}Page`]=g}),d.total=parseInt(m)),{data:Object.assign(Object.assign({},f),d),error:null}}catch(d){if(ke(d))return{data:{clients:[]},error:d};throw d}}async _createOAuthClient(t){try{return await Te(this.fetch,"POST",`${this.url}/admin/oauth/clients`,{body:t,headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(ke(n))return{data:null,error:n};throw n}}async _getOAuthClient(t){try{return await Te(this.fetch,"GET",`${this.url}/admin/oauth/clients/${t}`,{headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(ke(n))return{data:null,error:n};throw n}}async _updateOAuthClient(t,n){try{return await Te(this.fetch,"PUT",`${this.url}/admin/oauth/clients/${t}`,{body:n,headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(ke(r))return{data:null,error:r};throw r}}async _deleteOAuthClient(t){try{return await Te(this.fetch,"DELETE",`${this.url}/admin/oauth/clients/${t}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(n){if(ke(n))return{data:null,error:n};throw n}}async _regenerateOAuthClientSecret(t){try{return await Te(this.fetch,"POST",`${this.url}/admin/oauth/clients/${t}/regenerate_secret`,{headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(ke(n))return{data:null,error:n};throw n}}async _listCustomProviders(t){try{const n={};return t!=null&&t.type&&(n.type=t.type),await Te(this.fetch,"GET",`${this.url}/admin/custom-providers`,{headers:this.headers,query:n,xform:r=>{var a;return{data:{providers:(a=r==null?void 0:r.providers)!==null&&a!==void 0?a:[]},error:null}}})}catch(n){if(ke(n))return{data:{providers:[]},error:n};throw n}}async _createCustomProvider(t){try{return await Te(this.fetch,"POST",`${this.url}/admin/custom-providers`,{body:t,headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(ke(n))return{data:null,error:n};throw n}}async _getCustomProvider(t){try{return await Te(this.fetch,"GET",`${this.url}/admin/custom-providers/${t}`,{headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(ke(n))return{data:null,error:n};throw n}}async _updateCustomProvider(t,n){try{return await Te(this.fetch,"PUT",`${this.url}/admin/custom-providers/${t}`,{body:n,headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(ke(r))return{data:null,error:r};throw r}}async _deleteCustomProvider(t){try{return await Te(this.fetch,"DELET
455E",`${this.url}/admin/custom-providers/${t}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(n){if(ke(n))return{data:null,error:n};throw n}}}function qb(e={}){return{getItem:t=>e[t]||null,setItem:(t,n)=>{e[t]=n},removeItem:t=>{delete e[t]}}}const Hr={debug:!!(globalThis&&jj()&&globalThis.localStorage&&globalThis.localStorage.getItem("supabase.gotrue-js.locks.debug")==="true")};class kj extends Error{constructor(t){super(t),this.isAcquireTimeout=!0}}class GR extends kj{}async function KR(e,t,n){Hr.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquire lock",e,t);const r=new globalThis.AbortController;t>0&&setTimeout(()=>{r.abort(),Hr.debug&&console.log("@supabase/gotrue-js: navigatorLock acquire timed out",e)},t),await Promise.resolve();try{return await globalThis.navigator.locks.request(e,t===0?{mode:"exclusive",ifAvailable:!0}:{mode:"exclusive",signal:r.signal},async a=>{if(a){Hr.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquired",e,a.name);try{return await n()}finally{Hr.debug&&console.log("@supabase/gotrue-js: navigatorLock: released",e,a.name)}}else{if(t===0)throw Hr.debug&&console.log("@supabase/gotrue-js: navigatorLock: not immediately available",e),new GR(`Acquiring an exclusive Navigator LockManager lock "${e}" immediately failed`);if(Hr.debug)try{const i=await globalThis.navigator.locks.query();console.log("@supabase/gotrue-js: Navigator LockManager state",JSON.stringify(i,null,"  "))}catch(i){console.warn("@supabase/gotrue-js: Error when querying Navigator LockManager state",i)}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 n()}})}catch(a){if((a==null?void 0:a.name)==="AbortError"&&t>0)return Hr.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquire timeout, recovering by stealing lock",e),console.warn(`@supabase/gotrue-js: Lock "${e}" was not released within ${t}ms. This may indicate an orphaned lock from a component unmount (e.g., React Strict Mode). Forcefully acquiring the lock to recover.`),await Promise.resolve().then(()=>globalThis.navigator.locks.request(e,{mode:"exclusive",steal:!0},async i=>{if(i){Hr.debug&&console.log("@supabase/gotrue-js: navigatorLock: recovered (stolen)",e,i.name);try{return await n()}finally{Hr.debug&&console.log("@supabase/gotrue-js: navigatorLock: released (stolen)",e,i.name)}}else return console.warn("@supabase/gotrue-js: Navigator LockManager returned null lock even with steal: true"),await n()}));throw a}}function YR(){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 Sj(e){if(!/^0x[a-fA-F0-9]{40}$/.test(e))throw new Error(`@supabase/auth-js: Address "${e}" is invalid.`);return e.toLowerCase()}function QR(e){return parseInt(e,16)}function JR(e){const t=new TextEncoder().encode(e);return"0x"+Array.from(t,r=>r.toString(16).padStart(2,"0")).join("")}function XR(e){var t;const{chainId:n,domain:r,expirationTime:a,issuedAt:i=new Date,nonce:o,notBefore:l,requestId:c,resources:d,scheme:u,uri:f,version:m}=e;{if(!Number.isInteger(n))throw new Error(`@supabase/auth-js: Invalid SIWE message field "chainId". Chain ID must be a EIP-155 chain ID. Provided value: ${n}`);if(!r)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(!f)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(`
456`))throw new Error(`@supabase/auth-js: Invalid SIWE message field "statement". Statement must not include '\\n'. Provided value: ${e.statement}`)}const p=Sj(e.address),v=u?`${u}://${r}
456`:r,g=e.statement?`${e.statement}
457`:"",y=`${v} wants you to sign in with your Ethereum account:
458${p}
459
460${g}`;let b=`URI: ${f}
461Version: ${m}
462Chain ID: ${n}${o?`
463Nonce: ${o}`:""}
464Issued At: ${i.toISOString()}`;if(a&&(b+=`
465Expiration Time: ${a.toISOString()}`),l&&(b+=`
466Not Before: ${l.toISOString()}`),c&&(b+=`
467Request ID: ${c}`),d){let x=`
468Resources:`;for(const w of d){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}`);x+=`
469- ${w}`}b+=x}return`${y}
470${b}`}class Lt extends Error{constructor({message:t,code:n,cause:r,name:a}){var i;super(t,{cause:r}),this.__isWebAuthnError=!0,this.name=(i=a??(r instanceof Error?r.name:void 0))!==null&&i!==void 0?i:"Unknown Error",this.code=n}}class Nd extends Lt{constructor(t,n){super({code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:n,message:t}),this.name="WebAuthnUnknownError",this.originalError=n}}function ZR({error:e,options:t}){var n,r,a;const{publicKey:i}=t;if(!i)throw Error("options was missing required publicKey property");if(e.name==="AbortError"){if(t.signal instanceof AbortSignal)return new Lt({message:"Registration ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:e})}else if(e.name==="ConstraintError"){if(((n=i.authenticatorSelection)===null||n===void 0?void 0:n.requireResidentKey)===!0)return new Lt({message:"Discoverable credentials were required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_DISCOVERABLE_CREDENTIAL_SUPPORT",cause:e});if(t.mediation==="conditional"&&((r=i.authenticatorSelection)===null||r===void 0?void 0:r.userVerification)==="required")return new Lt({message:"User verification was required during automatic registration but it could not be performed",code:"ERROR_AUTO_REGISTER_USER_VERIFICATION_FAILURE",cause:e});if(((a=i.authenticatorSelection)===null||a===void 0?void 0:a.userVerification)==="required")return new Lt({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 Lt({message:"The authenticator was previously registered",code:"ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED",cause:e});if(e.name==="NotAllowedError")return new Lt({message:e.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e});if(e.name==="NotSupportedError")return i.pubKeyCredParams.filter(l=>l.type==="public-key").length===0?new Lt({message:'No entry in pubKeyCredParams was of type "public-key"',code:"ERROR_MALFORMED_PUBKEYCREDPARAMS",cause:e}):new Lt({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(Cj(o)){if(i.rp.id!==o)return new Lt({message:`The RP ID "${i.rp.id}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:e})}else return new Lt({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:e})}else if(e.name==="TypeError"){if(i.user.id.byteLength<1||i.user.id.byteLength>64)return new Lt({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 Lt({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 Lt({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e})}function eA({error:e,options:t}){const{publicKey:n}=t;if(!n)throw Error("options was missing required publicKey property");if(e.name==="AbortError"){if(t.signal instanceof AbortSignal)return new Lt({message:"Authentication ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:e})}else{if(e.name==="NotAllowedError")return new Lt({message:e.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e});if(e.name==="SecurityError"){const r=window.location.hostname;if(Cj(r)){if(n.rpId!==r)return new Lt({message:`The RP ID "${n.rpId}
470" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:e})}else return new Lt({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:e})}else if(e.name==="UnknownError")return new Lt({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 Lt({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e})}class tA{createNewAbortSignal(){if(this.controller){const n=new Error("Cancelling existing WebAuthn API call for new one");n.name="AbortError",this.controller.abort(n)}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 nA=new tA;function rA(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:n,excludeCredentials:r}=e,a=Ro(e,["challenge","user","excludeCredentials"]),i=Hi(t).buffer,o=Object.assign(Object.assign({},n),{id:Hi(n.id).buffer}),l=Object.assign(Object.assign({},a),{challenge:i,user:o});if(r&&r.length>0){l.excludeCredentials=new Array(r.length);for(let c=0;c<r.length;c++){const d=r[c];l.excludeCredentials[c]=Object.assign(Object.assign({},d),{id:Hi(d.id).buffer,type:d.type||"public-key",transports:d.transports})}}return l}function sA(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:n}=e,r=Ro(e,["challenge","allowCredentials"]),a=Hi(t).buffer,i=Object.assign(Object.assign({},r),{challenge:a});if(n&&n.length>0){i.allowCredentials=new Array(n.length);for(let o=0;o<n.length;o++){const l=n[o];i.allowCredentials[o]=Object.assign(Object.assign({},l),{id:Hi(l.id).buffer,type:l.type||"public-key",transports:l.transports})}}return i}function aA(e){var t;if("toJSON"in e&&typeof e.toJSON=="function")return e.toJSON();const n=e;return{id:e.id,rawId:e.id,response:{attestationObject:Ta(new Uint8Array(e.response.attestationObject)),clientDataJSON:Ta(new Uint8Array(e.response.clientDataJSON))},type:"public-key",clientExtensionResults:e.getClientExtensionResults(),authenticatorAttachment:(t=n.authenticatorAttachment)!==null&&t!==void 0?t:void 0}}function iA(e){var t;if("toJSON"in e&&typeof e.toJSON=="function")return e.toJSON();const n=e,r=e.getClientExtensionResults(),a=e.response;return{id:e.id,rawId:e.id,response:{authenticatorData:Ta(new Uint8Array(a.authenticatorData)),clientDataJSON:Ta(new Uint8Array(a.clientDataJSON)),signature:Ta(new Uint8Array(a.signature)),userHandle:a.userHandle?Ta(new Uint8Array(a.userHandle)):void 0},type:"public-key",clientExtensionResults:r,authenticatorAttachment:(t=n.authenticatorAttachment)!==null&&t!==void 0?t:void 0}}function Cj(e){return e==="localhost"||/^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/i.test(e)}function Vb(){var e,t;return!!(Zt()&&"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 oA(e){try{const t=await navigator.credentials.create(e);return t?t instanceof PublicKeyCredential?{data:t,error:null}:{data:null,error:new Nd("Browser returned unexpected credential type",t)}:{data:null,error:new Nd("Empty credential response",t)}}catch(t){return{data:null,error:ZR({error:t,options:e})}}}async function lA(e){try{const t=await navigator.credentials.get(e);return t?t instanceof PublicKeyCredential?{data:t,error:null}:{data:null,error:new Nd("Browser returned unexpected credential type",t)}:{data:null,error:new Nd("Empty credential response",t)}}
470catch(t){return{data:null,error:eA({error:t,options:e})}}}const cA={hints:["security-key"],authenticatorSelection:{authenticatorAttachment:"cross-platform",requireResidentKey:!1,userVerification:"preferred",residentKey:"discouraged"},attestation:"direct"},uA={userVerification:"preferred",hints:["security-key"],attestation:"direct"};function kd(...e){const t=a=>a!==null&&typeof a=="object"&&!Array.isArray(a),n=a=>a instanceof ArrayBuffer||ArrayBuffer.isView(a),r={};for(const a of e)if(a)for(const i in a){const o=a[i];if(o!==void 0)if(Array.isArray(o))r[i]=o;else if(n(o))r[i]=o;else if(t(o)){const l=r[i];t(l)?r[i]=kd(l,o):r[i]=kd(o)}else r[i]=o}return r}function dA(e,t){return kd(cA,e,t||{})}function hA(e,t){return kd(uA,e,t||{})}class fA{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:n,friendlyName:r,signal:a},i){var o;try{const{data:l,error:c}=await this.client.mfa.challenge({factorId:t,webauthn:n});if(!l)return{data:null,error:c};const d=a??nA.createNewAbortSignal();if(l.webauthn.type==="create"){const{user:u}=l.webauthn.credential_options.publicKey;if(!u.name){const f=r;if(f)u.name=`${u.id}:${f}`;else{const p=(await this.client.getUser()).data.user,v=((o=p==null?void 0:p.user_metadata)===null||o===void 0?void 0:o.name)||(p==null?void 0:p.email)||(p==null?void 0:p.id)||"User";u.name=`${u.id}:${v}`}}u.displayName||(u.displayName=u.name)}switch(l.webauthn.type){case"create":{const u=dA(l.webauthn.credential_options.publicKey,i==null?void 0:i.create),{data:f,error:m}=await oA({publicKey:u,signal:d});return f?{data:{factorId:t,challengeId:l.id,webauthn:{type:l.webauthn.type,credential_response:f}},error:null}:{data:null,error:m}}case"request":{const u=hA(l.webauthn.credential_options.publicKey,i==null?void 0:i.request),{data:f,error:m}=await lA(Object.assign(Object.assign({},l.webauthn.credential_options),{publicKey:u,signal:d}));return f?{data:{factorId:t,challengeId:l.id,webauthn:{type:l.webauthn.type,credential_response:f}},error:null}:{data:null,error:m}}}}catch(l){return ke(l)?{data:null,error:l}:{data:null,error:new Sa("Unexpected error in challenge",l)}}}async _verify({challengeId:t,factorId:n,webauthn:r}){return this.client.mfa.verify({factorId:n,challengeId:t,webauthn:r})}async _authenticate({factorId:t,webauthn:{rpId:n=typeof window<"u"?window.location.hostname:void 0,rpOrigins:r=typeof window<"u"?[window.location.origin]:void 0,signal:a}={}},i){if(!n)return{data:null,error:new rc("rpId is required for WebAuthn authentication")};try{if(!Vb())return{data:null,error:new Sa("Browser does not support WebAuthn",null)};const{data:o,error:l}=await this.challenge({factorId:t,webauthn:{rpId:n,rpOrigins:r},signal:a},{request:i});if(!o)return{data:null,error:l};const{webauthn:c}=o;return this._verify({factorId:t,challengeId:o.challengeId,webauthn:{type:c.type,rpId:n,rpOrigins:r,credential_response:c.credential_response}})}catch(o){return ke(o)?{data:null,error:o}:{data:null,error:new Sa("Unexpected error in authenticate",o)}}}async _register({friendlyName:t,webauthn:{rpId:n=typeof window<"u"?window.location.hostname:void 0,rpOrigins:r=typeof window<"u"?[window.location.origin]:void 0,signal:a}={}},i){if(!n)return{data:null,error:new rc("rpId is required for WebAuthn registration")};try{if(!Vb())return{data:null,error:new Sa("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(u=>{var f;return(f=u.data)===null||f===void 0?void 0:f.all.find(m=>m.factor_type==="webauthn"&&m.friendly_name===t&&m.status!=="unverified")}).then(u=>u?this.client.mfa.unenroll({factorId:u==null?void 0:u.id}):void 0),{data:null,error:l};const{data:c,error:d}=await this._challenge({factorId:o.id,friendlyName:o.friendly_name,webauthn:{rpId:n,rpOrigins:r},signal:a},{create:i});return c?this._verify({factorId:o.id,challengeId:c.challengeId,webauthn:{rpId:n,rpOrigins:r,type:c.webauthn.type,credential_response:c.webauthn.credential_response}}):{data:null,error:d}}catch(o){return ke(o)?{data:null,error:o}:{data:null,error:new Sa("Unexpected error in register",o)}}}}YR();const mA={url:uR,storageKey:dR,autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:hR,flowType:"implicit",debug:!1,hasCustomAuthorizationHeader:!1,throwOnError:!1,lockAcquireTimeout:5e3,skipAutoInitialize:!1};async function Wb(e,t,n){return await n()}const xi={};class sc{get jwks(){var t,n;return(n=(t=xi[this.storageKey])===null||t===void 0?void 0:t.jwks)!==null&&n!==void 0?n:{keys:[]}}set jwks(t){xi[this.storageKey]=Object.assign(Object.assign({},xi[this.storageKey]),{jwks:t})}get jwks_cached_at(){var t,n;return(n=(t=xi[this.storageKey])===null||t===void 0?void 0:t.cachedAt)!==null&&n!==void 0?n:Number.MIN_SAFE_INTEGER}set jwks_cached_at(t){xi[this.storageKey]=Object.assign(Object.assign({},xi[this.storageKey]),{cachedAt:t})}constructor(t){var n,r,a;this.userStorage=null,this.memoryStorage=null,this.stateChangeEmitters=new Map,this.autoRefreshTicker=null,this.autoRefreshTickTimeout=null,this.visibilityChangedCallback=null,this.refreshingDeferred=null,this.initializePromise=null,this.detectSessionInUrl=!0,this.hasCustomAuthorizationHeader=!1,this.suppressGetSessionWarning=!1,this.lockAcquired=!1,this.pendingInLock=[],this.broadcastChannel=null,this.logger=console.log;const i=Object.assign(Object.assign({},mA),t);if(this.storageKey=i.storageKey,this.instanceID=(n=sc.nextInstanceID[this.storageKey])!==null&&n!==void 0?n:0,sc.nextInstanceID[this.storageKey]=this.instanceID+1,this.logDebugMessages=!!i.debug,typeof i.debug=="function"&&(this.logger=i.debug),this.instanceID>0&&Zt()){const o=`${this._logPrefix()} Multiple GoTrueClient instances detected in the same browser context. It is not an error, but this should be avoided as it may produce undefined behavior when used concurrently under the same storage key.`;console.warn(o),this.logDebugMessages&&console.trace(o)}if(this.persistSession=i.persistSession,this.autoRefreshToken=i.autoRefreshToken,this.admin=new HR({url:i.url,headers:i.headers,fetch:i.fetch}),this.url=i.url,this.headers=i.headers,this.fetch=Nj(i.fetch),this.lock=i.lock||Wb,this.detectSessionInUrl=i.detectSessionInUrl,this.flowType=i.flowType,this.hasCustomAuthorizationHeader=i.hasCustomAuthorizationHeader,this.throwOnError=i.throwOnError,this.lockAcquireTimeout=i.lockAcquireTimeout,i.lock?this.lock=i.lock:this.persistSession&&Zt(
470)&&(!((r=globalThis==null?void 0:globalThis.navigator)===null||r===void 0)&&r.locks)?this.lock=KR:this.lock=Wb,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 fA(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?(i.storage?this.storage=i.storage:jj()?this.storage=globalThis.localStorage:(this.memoryStorage={},this.storage=qb(this.memoryStorage)),i.userStorage&&(this.userStorage=i.userStorage)):(this.memoryStorage={},this.storage=qb(this.memoryStorage)),Zt()&&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)}(a=this.broadcastChannel)===null||a===void 0||a.addEventListener("message",async o=>{this._debug("received broadcast notification from other tab or client",o);try{await this._notifyAllSubscribers(o.data.event,o.data.session,!1)}catch(l){this._debug("#broadcastChannel","error",l)}})}i.skipAutoInitialize||this.initialize().catch(o=>{this._debug("#initialize()","error",o)})}isThrowOnErrorEnabled(){return this.throwOnError}_returnResult(t){if(this.throwOnError&&t&&t.error)throw t.error;return t}_logPrefix(){return`GoTrueClient@${this.storageKey}:${this.instanceID} (${vj}) ${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 n={},r="none";if(Zt()&&(n=SR(window.location.href),this._isImplicitGrantCallback(n)?r="implicit":await this._isPKCECallback(n)&&(r="pkce")),Zt()&&this.detectSessionInUrl&&r!=="none"){const{data:a,error:i}=await this._getSessionFromURL(n,r);if(i){if(this._debug("#_initialize()","error detecting session from URL",i),gR(i)){const c=(t=i.details)===null||t===void 0?void 0:t.code;if(c==="identity_already_exists"||c==="identity_not_found"||c==="single_identity_not_deletable")return{error:i}}return{error:i}}const{session:o,redirectType:l}=a;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(n){return ke(n)?this._returnResult({error:n}):this._returnResult({error:new Sa("Unexpected error during initialization",n)})}finally{await this._handleVisibilityChange(),this._debug("#_initialize()","end")}}async signInAnonymously(t){var n,r,a;try{const i=await Te(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{data:(r=(n=t==null?void 0:t.options)===null||n===void 0?void 0:n.data)!==null&&r!==void 0?r:{},gotrue_meta_security:{captcha_token:(a=t==null?void 0:t.options)===null||a===void 0?void 0:a.captchaToken}},xform:ar}),{data:o,error:l}=i;if(l||!o)return this._returnResult({data:{user:null,session:null},error:l});const c=o.session,d=o.user;return o.session&&(await this._saveSession(o.session),await this._notifyAllSubscribers("SIGNED_IN",c)),this._returnResult({data:{user:d,session:c},error:null})}catch(i){if(ke(i))return this._returnResult({data:{user:null,session:null},error:i});throw i}}async signUp(t){var n,r,a;try{let i;if("email"in t){const{email:u,password:f,options:m}=t;let p=null,v=null;this.flowType==="pkce"&&([p,v]=await mi(this.storage,this.storageKey)),i=await Te(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,redirectTo:m==null?void 0:m.emailRedirectTo,body:{email:u,password:f,data:(n=m==null?void 0:m.data)!==null&&n!==void 0?n:{},gotrue_meta_security:{captcha_token:m==null?void 0:m.captchaToken},code_challenge:p,code_challenge_method:v},xform:ar})}else if("phone"in t){const{phone:u,password:f,options:m}=t;i=await Te(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{phone:u,password:f,data:(r=m==null?void 0:m.data)!==null&&r!==void 0?r:{},channel:(a=m==null?void 0:m.channel)!==null&&a!==void 0?a:"sms",gotrue_meta_security:{captcha_token:m==null?void 0:m.captchaToken}},xform:ar})}else throw new hu("You must provide either an email or phone number and a password");const{data:o,error:l}=i;if(l||!o)return await Xt(this.storage,`${this.storageKey}-code-verifier`),this._returnResult({data:{user:null,session:null},error:l});const c=o.session,d=o.user;return o.session&&(await this._saveSession(o.session),await this._notifyAllSubscribers("SIGNED_IN",c)),this._returnResult({data:{user:d,session:c},error:null})}catch(i){if(await Xt(this.storage,`${this.storageKey}-code-verifier`),ke(i))return this._returnResult({data:{user:null,session:null},error:i});throw i}}async signInWithPassword(t){try{let n;if("email"in t){const{email:i,password:o,options:l}=t;n=await Te(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{email:i,password:o,gotrue_meta_security:{captcha_token:l==null?void 0:l.captchaToken}},xform:Bb})}else if("phone"in t){const{phone:i,password:o,options:l}=t;n=await Te(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{phone:i,password:o,gotrue_meta_security:{captcha_token:l==null?void 0:l.captchaToken}},xform:Bb})}else throw new hu("You must provide either an email or phone number and a password");const{data:r,error:a}=n;
470if(a)return this._returnResult({data:{user:null,session:null},error:a});if(!r||!r.session||!r.user){const i=new fi;return this._returnResult({data:{user:null,session:null},error:i})}return r.session&&(await this._saveSession(r.session),await this._notifyAllSubscribers("SIGNED_IN",r.session)),this._returnResult({data:Object.assign({user:r.user,session:r.session},r.weak_password?{weakPassword:r.weak_password}:null),error:a})}catch(n){if(ke(n))return this._returnResult({data:{user:null,session:null},error:n});throw n}}async signInWithOAuth(t){var n,r,a,i;return await this._handleProviderSignIn(t.provider,{redirectTo:(n=t.options)===null||n===void 0?void 0:n.redirectTo,scopes:(r=t.options)===null||r===void 0?void 0:r.scopes,queryParams:(a=t.options)===null||a===void 0?void 0:a.queryParams,skipBrowserRedirect:(i=t.options)===null||i===void 0?void 0:i.skipBrowserRedirect})}async exchangeCodeForSession(t){return await this.initializePromise,this._acquireLock(this.lockAcquireTimeout,async()=>this._exchangeCodeForSession(t))}async signInWithWeb3(t){const{chain:n}=t;switch(n){case"ethereum":return await this.signInWithEthereum(t);case"solana":return await this.signInWithSolana(t);default:throw new Error(`@supabase/auth-js: Unsupported chain "${n}"`)}}async signInWithEthereum(t){var n,r,a,i,o,l,c,d,u,f,m;let p,v;if("message"in t)p=t.message,v=t.signature;else{const{chain:g,wallet:y,statement:b,options:x}=t;let w;if(Zt())if(typeof y=="object")w=y;else{const A=window;if("ethereum"in A&&typeof A.ethereum=="object"&&"request"in A.ethereum&&typeof A.ethereum.request=="function")w=A.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 y!="object"||!(x!=null&&x.url))throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");w=y}const _=new URL((n=x==null?void 0:x.url)!==null&&n!==void 0?n:window.location.href),j=await w.request({method:"eth_requestAccounts"}).then(A=>A).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 N=Sj(j[0]);let k=(r=x==null?void 0:x.signInWithEthereum)===null||r===void 0?void 0:r.chainId;if(!k){const A=await w.request({method:"eth_chainId"});k=QR(A)}const C={domain:_.host,address:N,statement:b,uri:_.href,version:"1",chainId:k,nonce:(a=x==null?void 0:x.signInWithEthereum)===null||a===void 0?void 0:a.nonce,issuedAt:(o=(i=x==null?void 0:x.signInWithEthereum)===null||i===void 0?void 0:i.issuedAt)!==null&&o!==void 0?o:new Date,expirationTime:(l=x==null?void 0:x.signInWithEthereum)===null||l===void 0?void 0:l.expirationTime,notBefore:(c=x==null?void 0:x.signInWithEthereum)===null||c===void 0?void 0:c.notBefore,requestId:(d=x==null?void 0:x.signInWithEthereum)===null||d===void 0?void 0:d.requestId,resources:(u=x==null?void 0:x.signInWithEthereum)===null||u===void 0?void 0:u.resources};p=XR(C),v=await w.request({method:"personal_sign",params:[JR(p),N]})}try{const{data:g,error:y}=await Te(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"ethereum",message:p,signature:v},!((f=t.options)===null||f===void 0)&&f.captchaToken?{gotrue_meta_security:{captcha_token:(m=t.options)===null||m===void 0?void 0:m.captchaToken}}:null),xform:ar});if(y)throw y;if(!g||!g.session||!g.user){const b=new fi;return this._returnResult({data:{user:null,session:null},error:b})}return g.session&&(await this._saveSession(g.session),await this._notifyAllSubscribers("SIGNED_IN",g.session)),this._returnResult({data:Object.assign({},g),error:y})}catch(g){if(ke(g))return this._returnResult({data:{user:null,session:null},error:g});throw g}}async signInWithSolana(t){var n,r,a,i,o,l,c,d,u,f,m,p;let v,g;if("message"in t)v=t.message,g=t.signature;else{const{chain:y,wallet:b,statement:x,options:w}=t;let _;if(Zt())if(typeof b=="object")_=b;else{const N=window;if("solana"in N&&typeof N.solana=="object"&&("signIn"in N.solana&&typeof N.solana.signIn=="function"||"signMessage"in N.solana&&typeof N.solana.signMessage=="function"))_=N.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 b!="object"||!(w!=null&&w.url))throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");_=b}const j=new URL((n=w==null?void 0:w.url)!==null&&n!==void 0?n:window.location.href);if("signIn"in _&&_.signIn){const N=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}),x?{statement:x}:null));let k;if(Array.isArray(N)&&N[0]&&typeof N[0]=="object")k=N[0];else if(N&&typeof N=="object"&&"signedMessage"in N&&"signature"in N)k=N;else throw new Error("@supabase/auth-js: Wallet method signIn() returned unrecognized value");if("signedMessage"in k&&"signature"in k&&(typeof k.signedMessage=="string"||k.signedMessage instanceof Uint8Array)&&k.signature instanceof Uint8Array)v=typeof k.signedMessage=="string"?k.signedMessage:new TextDecoder().decode(k.signedMessage),g=k.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");v=[`${j.host} wants you to sign in with your Solana account:`,_.publicKey.toBase58(),...x?["",x,""]:[""],"Version: 1",`URI: ${j.href}`,`Issued At: ${(a=(r=w==null?void 0:w.signInWithSolana)===null||r===void 0?void 0:r.issuedAt)!==null&&a!==void 0?a:new Date().toISOString()}`,...!((i=w==null?void 0:w.signInWithSolana)===null||i===void 0)&&i.notBefore?[`Not Before: ${w.signInWithSolana.notBefore}`]:[],...!((o=w==null?void 0:w.signInWithSolana)===null||o===void 0)&&o.expirationTime?[`Expiration Time: ${w.signInWithSolana.expirationTime}`]:[],...!((l=w==null?void 0:w.signInWithSolana)===null||l===void 0)&&l.chainId?[`Chain ID: ${w.signInWithSolana.chainId}`]:[],...!((c=w==null?void 0:w.signInWithSolana)===null||c===void 0)&&c.nonce?[`Nonce: ${w.signInWithSolana.nonce}`]:[],...!((d=w==null?void 0:w.signInWithSolana)===null||d===void 0)&&d.requestId?[`Request ID: ${w.signInWithSolana.requestId}`]:[],...!((f=(u=w==null?void 0:w.signInWithSolana)===null||u===void 0?void 0:u.resources)===null||f===void 0)&&f.length?["Resources",...w.sign
470InWithSolana.resources.map(k=>`- ${k}`)]:[]].join(`
471`);const N=await _.signMessage(new TextEncoder().encode(v),"utf8");if(!N||!(N instanceof Uint8Array))throw new Error("@supabase/auth-js: Wallet signMessage() API returned an recognized value");g=N}}try{const{data:y,error:b}=await Te(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"solana",message:v,signature:Ta(g)},!((m=t.options)===null||m===void 0)&&m.captchaToken?{gotrue_meta_security:{captcha_token:(p=t.options)===null||p===void 0?void 0:p.captchaToken}}:null),xform:ar});if(b)throw b;if(!y||!y.session||!y.user){const x=new fi;return this._returnResult({data:{user:null,session:null},error:x})}return y.session&&(await this._saveSession(y.session),await this._notifyAllSubscribers("SIGNED_IN",y.session)),this._returnResult({data:Object.assign({},y),error:b})}catch(y){if(ke(y))return this._returnResult({data:{user:null,session:null},error:y});throw y}}async _exchangeCodeForSession(t){const n=await ga(this.storage,`${this.storageKey}-code-verifier`),[r,a]=(n??"").split("/");try{if(!r&&this.flowType==="pkce")throw new bR;const{data:i,error:o}=await Te(this.fetch,"POST",`${this.url}/token?grant_type=pkce`,{headers:this.headers,body:{auth_code:t,code_verifier:r},xform:ar});if(await Xt(this.storage,`${this.storageKey}-code-verifier`),o)throw o;if(!i||!i.session||!i.user){const l=new fi;return this._returnResult({data:{user:null,session:null,redirectType:null},error:l})}return i.session&&(await this._saveSession(i.session),await this._notifyAllSubscribers("SIGNED_IN",i.session)),this._returnResult({data:Object.assign(Object.assign({},i),{redirectType:a??null}),error:o})}catch(i){if(await Xt(this.storage,`${this.storageKey}-code-verifier`),ke(i))return this._returnResult({data:{user:null,session:null,redirectType:null},error:i});throw i}}async signInWithIdToken(t){try{const{options:n,provider:r,token:a,access_token:i,nonce:o}=t,l=await Te(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,body:{provider:r,id_token:a,access_token:i,nonce:o,gotrue_meta_security:{captcha_token:n==null?void 0:n.captchaToken}},xform:ar}),{data:c,error:d}=l;if(d)return this._returnResult({data:{user:null,session:null},error:d});if(!c||!c.session||!c.user){const u=new fi;return this._returnResult({data:{user:null,session:null},error:u})}return c.session&&(await this._saveSession(c.session),await this._notifyAllSubscribers("SIGNED_IN",c.session)),this._returnResult({data:c,error:d})}catch(n){if(ke(n))return this._returnResult({data:{user:null,session:null},error:n});throw n}}async signInWithOtp(t){var n,r,a,i,o;try{if("email"in t){const{email:l,options:c}=t;let d=null,u=null;this.flowType==="pkce"&&([d,u]=await mi(this.storage,this.storageKey));const{error:f}=await Te(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{email:l,data:(n=c==null?void 0:c.data)!==null&&n!==void 0?n:{},create_user:(r=c==null?void 0:c.shouldCreateUser)!==null&&r!==void 0?r:!0,gotrue_meta_security:{captcha_token:c==null?void 0:c.captchaToken},code_challenge:d,code_challenge_method:u},redirectTo:c==null?void 0:c.emailRedirectTo});return this._returnResult({data:{user:null,session:null},error:f})}if("phone"in t){const{phone:l,options:c}=t,{data:d,error:u}=await Te(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{phone:l,data:(a=c==null?void 0:c.data)!==null&&a!==void 0?a:{},create_user:(i=c==null?void 0:c.shouldCreateUser)!==null&&i!==void 0?i:!0,gotrue_meta_security:{captcha_token:c==null?void 0:c.captchaToken},channel:(o=c==null?void 0:c.channel)!==null&&o!==void 0?o:"sms"}});return this._returnResult({data:{user:null,session:null,messageId:d==null?void 0:d.message_id},error:u})}throw new hu("You must provide either an email or phone number.")}catch(l){if(await Xt(this.storage,`${this.storageKey}-code-verifier`),ke(l))return this._returnResult({data:{user:null,session:null},error:l});throw l}}async verifyOtp(t){var n,r;try{let a,i;"options"in t&&(a=(n=t.options)===null||n===void 0?void 0:n.redirectTo,i=(r=t.options)===null||r===void 0?void 0:r.captchaToken);const{data:o,error:l}=await Te(this.fetch,"POST",`${this.url}/verify`,{headers:this.headers,body:Object.assign(Object.assign({},t),{gotrue_meta_security:{captcha_token:i}}),redirectTo:a,xform:ar});if(l)throw l;if(!o)throw new Error("An error occurred on token verification.");const c=o.session,d=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:d,session:c},error:null})}
471catch(a){if(ke(a))return this._returnResult({data:{user:null,session:null},error:a});throw a}}async signInWithSSO(t){var n,r,a,i,o;try{let l=null,c=null;this.flowType==="pkce"&&([l,c]=await mi(this.storage,this.storageKey));const d=await Te(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:(r=(n=t.options)===null||n===void 0?void 0:n.redirectTo)!==null&&r!==void 0?r:void 0}),!((a=t==null?void 0:t.options)===null||a===void 0)&&a.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:qR});return!((i=d.data)===null||i===void 0)&&i.url&&Zt()&&!(!((o=t.options)===null||o===void 0)&&o.skipBrowserRedirect)&&window.location.assign(d.data.url),this._returnResult(d)}catch(l){if(await Xt(this.storage,`${this.storageKey}-code-verifier`),ke(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:n},error:r}=t;if(r)throw r;if(!n)throw new Dn;const{error:a}=await Te(this.fetch,"GET",`${this.url}/reauthenticate`,{headers:this.headers,jwt:n.access_token});return this._returnResult({data:{user:null,session:null},error:a})})}catch(t){if(ke(t))return this._returnResult({data:{user:null,session:null},error:t});throw t}}async resend(t){try{const n=`${this.url}/resend`;if("email"in t){const{email:r,type:a,options:i}=t,{error:o}=await Te(this.fetch,"POST",n,{headers:this.headers,body:{email:r,type:a,gotrue_meta_security:{captcha_token:i==null?void 0:i.captchaToken}},redirectTo:i==null?void 0:i.emailRedirectTo});return this._returnResult({data:{user:null,session:null},error:o})}else if("phone"in t){const{phone:r,type:a,options:i}=t,{data:o,error:l}=await Te(this.fetch,"POST",n,{headers:this.headers,body:{phone:r,type:a,gotrue_meta_security:{captcha_token:i==null?void 0:i.captchaToken}}});return this._returnResult({data:{user:null,session:null,messageId:o==null?void 0:o.message_id},error:l})}throw new hu("You must provide either an email or phone number and a type")}catch(n){if(ke(n))return this._returnResult({data:{user:null,session:null},error:n});throw n}}async getSession(){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>this._useSession(async n=>n))}async _acquireLock(t,n){this._debug("#_acquireLock","begin",t);try{if(this.lockAcquired){const r=this.pendingInLock.length?this.pendingInLock[this.pendingInLock.length-1]:Promise.resolve(),a=(async()=>(await r,await n()))();return this.pendingInLock.push((async()=>{try{await a}catch{}})()),a}return await this.lock(`lock:${this.storageKey}`,t,async()=>{this._debug("#_acquireLock","lock acquired for storage key",this.storageKey);try{this.lockAcquired=!0;const r=n();for(this.pendingInLock.push((async()=>{try{await r}catch{}})()),await r;this.pendingInLock.length;){const a=[...this.pendingInLock];await Promise.all(a),this.pendingInLock.splice(0,a.length)}return await r}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 n=await this.__loadSession();return await t(n)}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 n=await ga(this.storage,this.storageKey);if(this._debug("#getSession()","session from storage",n),n!==null&&(this._isValidSession(n)?t=n:(this._debug("#getSession()","session from storage is not valid"),await this._removeSession())),!t)return{data:{session:null},error:null};const r=t.expires_at?t.expires_at*1e3-Date.now()<mf:!1;if(this._debug("#__loadSession()",`session has${r?"":" not"} expired`,"expires_at",t.expires_at),!r){if(this.userStorage){const o=await ga(this.userStorage,this.storageKey+"-user");o!=null&&o.user?t.user=o.user:t.user=gf()}if(this.storage.isServer&&t.user&&!t.user.__isUserNotAvailableProxy){const o={value:this.suppressGetSessionWarning};t.user=FR(t.user,o),o.value&&(this.suppressGetSessionWarning=!0)}return{data:{session:t},error:null}}const{data:a,error:i}=await this._callRefreshToken(t.refresh_token);return i?this._returnResult({data:{session:null},error:i}):this._returnResult({data:{session:a},error:null})}finally{this._debug("#__loadSession()","end")}}async getUser(t){if(t)return await this._getUser(t);await this.initializePromise;const n=await this._acquireLock(this.lockAcquireTimeout,async()=>await this._getUser());return n.data.user&&(this.suppressGetSessionWarning=!0),n}async _getUser(t){try{return t?await Te(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:t,xform:Rs}):await this._useSession(async n=>{var r,a,i;const{data:o,error:l}=n;if(l)throw l;return!(!((r=o.session)===null||r===void 0)&&r.access_token)&&!this.hasCustomAuthorizationHeader?{data:{user:null},error:new Dn}:await Te(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:(i=(a=o.session)===null||a===void 0?void 0:a.access_token)!==null&&i!==void 0?i:void 0,xform:Rs})})}catch(n){if(ke(n))return pf(n)&&(await this._removeSession(),await Xt(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({data:{user:null},error:n});throw n}}async updateUser(t,n={}){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._updateUser(t,n))}async _updateUser(t,n={}){try{return await this._useSession(async r=>{const{data:a,error:i}=r;if(i)throw i;if(!a.session)throw new Dn;const o=a.session;let l=null,c=null;this.flowType==="pkce"&&t.email!=null&&([l,c]=await mi(this.storage,this.storageKey));const{data:d,error:u}=await Te(this.fetch,"PUT",`${this.url}/user`,{headers:this.headers,redirectTo:n==null?void 0:n.emailRedirectTo,body:Object.assign(Object.assign({},t),{code_challenge:l,code_challenge_method:c}),jwt:o.access_token,xform:Rs});if(u)throw u;return o.user=d.user,await this._saveSession(o),await this._notifyAllSubscribers("USER_UPDATED",o),this._returnResult({data:{user:o.user},error:null})})}catch(r){if(await Xt(this.storage,`${this.storageKey}-code-verifier`),ke(r))return this._returnResult({data:{user:null},error:r});throw r}}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 Dn;const n=Date.now()/1e3;let r=n,a=!0,i=null;const{payload:o}=mu(t.access_token);if(o.exp&&(r=o.exp,a=r<=n),a){const{data:l,error:c}=await this._callRefreshToken(t.refresh_token);if(c)return this._returnResult({data:{user:null,session:null},error:c});if(!l)return{data:{user:null,session:null},error:null};i=l}else{const{data:l,error:c}=await this._getUser(t.access_token);if(c)return this._returnResult({data:{user:null,session:null},error:c});i={access_token:t.access_token,refresh_token:t.refresh_token,user:l.user,token_type:"bearer",expires_in:r-n,expires_at:r},await this._saveSession(i),await this._notifyAllSubscribers("SIGNED_IN",i)}return this._returnResult({data:{user:i.user,session:i},error:null})}catch(n){if(ke(n))return this._returnResult({data:{session:null,user:null},error:n});throw n}}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 n=>{var r;if(!t){const{data:o,error:l}=n;if(l)throw l;t=(r=o.session)!==null&&r!==void 0?r:void 0}if(!(t!=null&&t.refresh_token))throw new Dn;const{data:a,error:i}=await this._callRefreshToken(t.refresh_token);return i?this._returnResult({data:{user:null,session:null},error:i}):a?this._returnResult({data:{user:a.user,session:a},error:null}):this._returnResult({data:{user:null,session:null},error:null})})}catch(n){if(ke(n))return this._returnResult({data:{user:null,session:null},error:n});throw n}}
471async _getSessionFromURL(t,n){try{if(!Zt())throw new fu("No browser detected.");if(t.error||t.error_description||t.error_code)throw new fu(t.error_description||"Error in URL with unspecified error_description",{error:t.error||"unspecified_error",code:t.error_code||"unspecified_code"});switch(n){case"implicit":if(this.flowType==="pkce")throw new Ob("Not a valid PKCE flow url.");break;case"pkce":if(this.flowType==="implicit")throw new fu("Not a valid implicit grant flow url.");break;default:}if(n==="pkce"){if(this._debug("#_initialize()","begin","is PKCE flow",!0),!t.code)throw new Ob("No code detected.");const{data:x,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:x.session,redirectType:null},error:null}}const{provider_token:r,provider_refresh_token:a,access_token:i,refresh_token:o,expires_in:l,expires_at:c,token_type:d}=t;if(!i||!l||!o||!d)throw new fu("No session defined in URL");const u=Math.round(Date.now()/1e3),f=parseInt(l);let m=u+f;c&&(m=parseInt(c));const p=m-u;p*1e3<=_i&&console.warn(`@supabase/gotrue-js: Session as retrieved from URL expires in ${p}s, should have been closer to ${f}s`);const v=m-f;u-v>=120?console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued over 120s ago, URL could be stale",v,m,u):u-v<0&&console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued in the future? Check the device clock for skew",v,m,u);const{data:g,error:y}=await this._getUser(i);if(y)throw y;const b={provider_token:r,provider_refresh_token:a,access_token:i,expires_in:f,expires_at:m,refresh_token:o,token_type:d,user:g.user};return window.location.hash="",this._debug("#_getSessionFromURL()","clearing window.location.hash"),this._returnResult({data:{session:b,redirectType:t.type},error:null})}catch(r){if(ke(r))return this._returnResult({data:{session:null,redirectType:null},error:r});throw r}}_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 n=await ga(this.storage,`${this.storageKey}-code-verifier`);return!!(t.code&&n)}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 n=>{var r;const{data:a,error:i}=n;if(i&&!pf(i))return this._returnResult({error:i});const o=(r=a.session)===null||r===void 0?void 0:r.access_token;if(o){const{error:l}=await this.admin.signOut(o,t);if(l&&!(xR(l)&&(l.status===404||l.status===401||l.status===403)||pf(l)))return this._returnResult({error:l})}return t!=="others"&&(await this._removeSession(),await Xt(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({error:null})})}onAuthStateChange(t){const n=kR(),r={id:n,callback:t,unsubscribe:()=>{this._debug("#unsubscribe()","state change callback with id removed",n),this.stateChangeEmitters.delete(n)}};return this._debug("#onAuthStateChange()","registered callback with id",n),this.stateChangeEmitters.set(n,r),(async()=>(await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>{this._emitInitialSession(n)})))(),{data:{subscription:r}}}async _emitInitialSession(t){return await this._useSession(async n=>{var r,a;try{const{data:{session:i},error:o}=n;if(o)throw o;await((r=this.stateChangeEmitters.get(t))===null||r===void 0?void 0:r.callback("INITIAL_SESSION",i)),this._debug("INITIAL_SESSION","callback id",t,"session",i)}catch(i){await((a=this.stateChangeEmitters.get(t))===null||a===void 0?void 0:a.callback("INITIAL_SESSION",null)),this._debug("INITIAL_SESSION","callback id",t,"error",i),console.error(i)}})}async resetPasswordForEmail(t,n={}){let r=null,a=null;this.flowType==="pkce"&&([r,a]=await mi(this.storage,this.storageKey,!0));try{return await Te(this.fetch,"POST",`${this.url}/recover`,{body:{email:t,code_challenge:r,code_challenge_method:a,gotrue_meta_security:{captcha_token:n.captchaToken}},headers:this.headers,redirectTo:n.redirectTo})}catch(i){if(await Xt(this.storage,`${this.storageKey}-code-verifier`),ke(i))return this._returnResult({data:null,error:i});throw i}}async getUserIdentities(){var t;try{const{data:n,error:r}=await this.getUser();if(r)throw r;return this._returnResult({data:{identities:(t=n.user.identities)!==null&&t!==void 0?t:[]},error:null})}catch(n){if(ke(n))return this._returnResult({data:null,error:n});throw n}}async linkIdentity(t){return"token"in t?this.linkIdentityIdToken(t):this.linkIdentityOAuth(t)}async linkIdentityOAuth(t){var n;try{const{data:r,error:a}=await this._useSession(async i=>{var o,l,c,d,u;const{data:f,error:m}=i;if(m)throw m;const p=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 Te(this.fetch,"GET",p,{headers:this.headers,jwt:(u=(d=f.session)===null||d===void 0?void 0:d.access_token)!==null&&u!==void 0?u:void 0})});if(a)throw a;return Zt()&&!(!((n=t.options)===null||n===void 0)&&n.skipBrowserRedirect)&&window.location.assign(r==null?void 0:r.url),this._returnResult({data:{provider:t.provider,url:r==null?void 0:r.url},error:null})}catch(r){if(ke(r))return this._returnResult({data:{provider:t.provider,url:null},error:r});throw r}}async linkIdentityIdToken(t){return await this._useSession(async n=>{var r;try{const{error:a,data:{session:i}}=n;
471if(a)throw a;const{options:o,provider:l,token:c,access_token:d,nonce:u}=t,f=await Te(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,jwt:(r=i==null?void 0:i.access_token)!==null&&r!==void 0?r:void 0,body:{provider:l,id_token:c,access_token:d,nonce:u,link_identity:!0,gotrue_meta_security:{captcha_token:o==null?void 0:o.captchaToken}},xform:ar}),{data:m,error:p}=f;return p?this._returnResult({data:{user:null,session:null},error:p}):!m||!m.session||!m.user?this._returnResult({data:{user:null,session:null},error:new fi}):(m.session&&(await this._saveSession(m.session),await this._notifyAllSubscribers("USER_UPDATED",m.session)),this._returnResult({data:m,error:p}))}catch(a){if(await Xt(this.storage,`${this.storageKey}-code-verifier`),ke(a))return this._returnResult({data:{user:null,session:null},error:a});throw a}})}async unlinkIdentity(t){try{return await this._useSession(async n=>{var r,a;const{data:i,error:o}=n;if(o)throw o;return await Te(this.fetch,"DELETE",`${this.url}/user/identities/${t.identity_id}`,{headers:this.headers,jwt:(a=(r=i.session)===null||r===void 0?void 0:r.access_token)!==null&&a!==void 0?a:void 0})})}catch(n){if(ke(n))return this._returnResult({data:null,error:n});throw n}}async _refreshAccessToken(t){const n=`#_refreshAccessToken(${t.substring(0,5)}...)`;this._debug(n,"begin");try{const r=Date.now();return await PR(async a=>(a>0&&await ER(200*Math.pow(2,a-1)),this._debug(n,"refreshing attempt",a),await Te(this.fetch,"POST",`${this.url}/token?grant_type=refresh_token`,{body:{refresh_token:t},headers:this.headers,xform:ar})),(a,i)=>{const o=200*Math.pow(2,a);return i&&xf(i)&&Date.now()+o-r<_i})}catch(r){if(this._debug(n,"error",r),ke(r))return this._returnResult({data:{session:null,user:null},error:r});throw r}finally{this._debug(n,"end")}}_isValidSession(t){return typeof t=="object"&&t!==null&&"access_token"in t&&"refresh_token"in t&&"expires_at"in t}async _handleProviderSignIn(t,n){const r=await this._getUrlForProvider(`${this.url}/authorize`,t,{redirectTo:n.redirectTo,scopes:n.scopes,queryParams:n.queryParams});return this._debug("#_handleProviderSignIn()","provider",t,"options",n,"url",r),Zt()&&!n.skipBrowserRedirect&&window.location.assign(r),{data:{provider:t,url:r},error:null}}async _recoverAndRefresh(){var t,n;const r="#_recoverAndRefresh()";this._debug(r,"begin");try{const a=await ga(this.storage,this.storageKey);if(a&&this.userStorage){let o=await ga(this.userStorage,this.storageKey+"-user");!this.storage.isServer&&Object.is(this.storage,this.userStorage)&&!o&&(o={user:a.user},await ji(this.userStorage,this.storageKey+"-user",o)),a.user=(t=o==null?void 0:o.user)!==null&&t!==void 0?t:gf()}else if(a&&!a.user&&!a.user){const o=await ga(this.storage,this.storageKey+"-user");o&&(o!=null&&o.user)?(a.user=o.user,await Xt(this.storage,this.storageKey+"-user"),await ji(this.storage,this.storageKey,a)):a.user=gf()}if(this._debug(r,"session from storage",a),!this._isValidSession(a)){this._debug(r,"session is not valid"),a!==null&&await this._removeSession();return}const i=((n=a.expires_at)!==null&&n!==void 0?n:1/0)*1e3-Date.now()<mf;if(this._debug(r,`session has${i?"":" not"} expired with margin of ${mf}s`),i){if(this.autoRefreshToken&&a.refresh_token){const{error:o}=await this._callRefreshToken(a.refresh_token);o&&(console.error(o),xf(o)||(this._debug(r,"refresh failed with a non-retryable error, removing the session",o),await this._removeSession()))}}else if(a.user&&a.user.__isUserNotAvailableProxy===!0)try{const{data:o,error:l}=await this._getUser(a.access_token);!l&&(o!=null&&o.user)?(a.user=o.user,await this._saveSession(a),await this._notifyAllSubscribers("SIGNED_IN",a)):this._debug(r,"could not get user data, skipping SIGNED_IN notification")}catch(o){console.error("Error getting user data:",o),this._debug(r,"error getting user data, skipping SIGNED_IN notification",o)}else await this._notifyAllSubscribers("SIGNED_IN",a)}catch(a){this._debug(r,"error",a),console.error(a);return}finally{this._debug(r,"end")}}async _callRefreshToken(t){var n,r;if(!t)throw new Dn;if(this.refreshingDeferred)return this.refreshingDeferred.promise;const a=`#_callRefreshToken(${t.substring(0,5)}...)`;this._debug(a,"begin");try{this.refreshingDeferred=new uh;const{data:i,error:o}=await this._refreshAccessToken(t);if(o)throw o;if(!i.session)throw new Dn;await this._saveSession(i.session),await this._notifyAllSubscribers("TOKEN_REFRESHED",i.session);const l={data:i.session,error:null};return this.refreshingDeferred.resolve(l),l}catch(i){if(this._debug(a,"error",i),ke(i)){const o={data:null,error:i};return xf(i)||await this._removeSession(),(n=this.refreshingDeferred)===null||n===void 0||n.resolve(o),o}throw(r=this.refreshingDeferred)===null||r===void 0||r.reject(i),i}finally{this.refreshingDeferred=null,this._debug(a,"end")}}async _notifyAllSubscribers(t,n,r=!0){const a=`#_notifyAllSubscribers(${t})`;this._debug(a,"begin",n,`broadcast = ${r}`);try{this.broadcastChannel&&r&&this.broadcastChannel.postMessage({event:t,session:n});const i=[],o=Array.from(this.stateChangeEmitters.values()).map(async l=>{try{await l.callback(t,n)}catch(c){i.push(c)}});if(await Promise.all(o),i.length>0){for(let l=0;l<i.length;l+=1)console.error(i[l]);throw i[0]}}finally{this._debug(a,"end")}}async _saveSession(t){this._debug("#_saveSession()",t),this.suppressGetSessionWarning=!0,await Xt(this.storage,`${this.storageKey}-code-verifier`);const n=Object.assign({},t),r=n.user&&n.user.__isUserNotAvailableProxy===!0;if(this.userStorage){!r&&n.user&&await ji(this.userStorage,this.storageKey+"-user",{user:n.user});const a=Object.assign({},n);delete a.user;const i=Fb(a);await ji(this.storage,this.storageKey,i)}else{const a=Fb(n);await ji(this.storage,this.storageKey,a)}}async _removeSession(){this._debug("#_removeSession()"),this.suppressGetSessionWarning=!1,await Xt(this.storage,this.storageKey),await Xt(this.storage,this.storageKey+"-code-verifier"),await Xt(this.storage,this.storageKey+"-user"),this.userStorage&&await Xt(this.userStorage,this.storageKey+"-user"),await this._notifyAllSubscribers("SIGNED_OUT",null)}_removeVisibilityChangedCallback(){this._debug("#_removeVisibilityChangedCallback()");const t=this.visibilityChangedCallback;this.visibilityChangedCallback=null;try{t&&Zt()&&(window!=null&&window.removeEventListener)&&window.removeEventListener("visibilitychange",t)}
471catch(n){console.error("removing visibilitychange callback failed",n)}}async _startAutoRefresh(){await this._stopAutoRefresh(),this._debug("#_startAutoRefresh()");const t=setInterval(()=>this._autoRefreshTokenTick(),_i);this.autoRefreshTicker=t,t&&typeof t=="object"&&typeof t.unref=="function"?t.unref():typeof Deno<"u"&&typeof Deno.unrefTimer=="function"&&Deno.unrefTimer(t);const n=setTimeout(async()=>{await this.initializePromise,await this._autoRefreshTokenTick()},0);this.autoRefreshTickTimeout=n,n&&typeof n=="object"&&typeof n.unref=="function"?n.unref():typeof Deno<"u"&&typeof Deno.unrefTimer=="function"&&Deno.unrefTimer(n)}async _stopAutoRefresh(){this._debug("#_stopAutoRefresh()");const t=this.autoRefreshTicker;this.autoRefreshTicker=null,t&&clearInterval(t);const n=this.autoRefreshTickTimeout;this.autoRefreshTickTimeout=null,n&&clearTimeout(n)}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 n=>{const{data:{session:r}}=n;if(!r||!r.refresh_token||!r.expires_at){this._debug("#_autoRefreshTokenTick()","no session");return}const a=Math.floor((r.expires_at*1e3-t)/_i);this._debug("#_autoRefreshTokenTick()",`access token expires in ${a} ticks, a tick lasts ${_i}ms, refresh threshold is ${mp} ticks`),a<=mp&&await this._callRefreshToken(r.refresh_token)})}catch(n){console.error("Auto refresh tick failed with error. This is likely a transient error.",n)}}finally{this._debug("#_autoRefreshTokenTick()","end")}})}catch(t){if(t.isAcquireTimeout||t instanceof kj)this._debug("auto refresh token tick lock not available");else throw t}}async _handleVisibilityChange(){if(this._debug("#_handleVisibilityChange()"),!Zt()||!(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 n=`#_onVisibilityChanged(${t})`;this._debug(n,"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(n,"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,n,r){const a=[`provider=${encodeURIComponent(n)}`];if(r!=null&&r.redirectTo&&a.push(`redirect_to=${encodeURIComponent(r.redirectTo)}`),r!=null&&r.scopes&&a.push(`scopes=${encodeURIComponent(r.scopes)}`),this.flowType==="pkce"){const[i,o]=await mi(this.storage,this.storageKey),l=new URLSearchParams({code_challenge:`${encodeURIComponent(i)}`,code_challenge_method:`${encodeURIComponent(o)}`});a.push(l.toString())}if(r!=null&&r.queryParams){const i=new URLSearchParams(r.queryParams);a.push(i.toString())}return r!=null&&r.skipBrowserRedirect&&a.push(`skip_http_redirect=${r.skipBrowserRedirect}`),`${t}?${a.join("&")}`}async _unenroll(t){try{return await this._useSession(async n=>{var r;const{data:a,error:i}=n;return i?this._returnResult({data:null,error:i}):await Te(this.fetch,"DELETE",`${this.url}/factors/${t.factorId}`,{headers:this.headers,jwt:(r=a==null?void 0:a.session)===null||r===void 0?void 0:r.access_token})})}catch(n){if(ke(n))return this._returnResult({data:null,error:n});throw n}}async _enroll(t){try{return await this._useSession(async n=>{var r,a;const{data:i,error:o}=n;
471if(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:d}=await Te(this.fetch,"POST",`${this.url}/factors`,{body:l,headers:this.headers,jwt:(r=i==null?void 0:i.session)===null||r===void 0?void 0:r.access_token});return d?this._returnResult({data:null,error:d}):(t.factorType==="totp"&&c.type==="totp"&&(!((a=c==null?void 0:c.totp)===null||a===void 0)&&a.qr_code)&&(c.totp.qr_code=`data:image/svg+xml;utf-8,${c.totp.qr_code}`),this._returnResult({data:c,error:null}))})}catch(n){if(ke(n))return this._returnResult({data:null,error:n});throw n}}async _verify(t){return this._acquireLock(this.lockAcquireTimeout,async()=>{try{return await this._useSession(async n=>{var r;const{data:a,error:i}=n;if(i)return this._returnResult({data:null,error:i});const o=Object.assign({challenge_id:t.challengeId},"webauthn"in t?{webauthn:Object.assign(Object.assign({},t.webauthn),{credential_response:t.webauthn.type==="create"?aA(t.webauthn.credential_response):iA(t.webauthn.credential_response)})}:{code:t.code}),{data:l,error:c}=await Te(this.fetch,"POST",`${this.url}/factors/${t.factorId}/verify`,{body:o,headers:this.headers,jwt:(r=a==null?void 0:a.session)===null||r===void 0?void 0:r.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(n){if(ke(n))return this._returnResult({data:null,error:n});throw n}})}async _challenge(t){return this._acquireLock(this.lockAcquireTimeout,async()=>{try{return await this._useSession(async n=>{var r;const{data:a,error:i}=n;if(i)return this._returnResult({data:null,error:i});const o=await Te(this.fetch,"POST",`${this.url}/factors/${t.factorId}/challenge`,{body:t,headers:this.headers,jwt:(r=a==null?void 0:a.session)===null||r===void 0?void 0:r.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:rA(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:sA(l.webauthn.credential_options.publicKey)})})}),error:null}}})}catch(n){if(ke(n))return this._returnResult({data:null,error:n});throw n}})}async _challengeAndVerify(t){const{data:n,error:r}=await this._challenge({factorId:t.factorId});return r?this._returnResult({data:null,error:r}):await this._verify({factorId:t.factorId,challengeId:n.id,code:t.code})}async _listFactors(){var t;const{data:{user:n},error:r}=await this.getUser();if(r)return{data:null,error:r};const a={all:[],phone:[],totp:[],webauthn:[]};for(const i of(t=n==null?void 0:n.factors)!==null&&t!==void 0?t:[])a.all.push(i),i.status==="verified"&&a[i.factor_type].push(i);return{data:a,error:null}}async _getAuthenticatorAssuranceLevel(t){var n,r,a,i;if(t)try{const{payload:p}=mu(t);let v=null;p.aal&&(v=p.aal);let g=v;const{data:{user:y},error:b}=await this.getUser(t);if(b)return this._returnResult({data:null,error:b});((r=(n=y==null?void 0:y.factors)===null||n===void 0?void 0:n.filter(_=>_.status==="verified"))!==null&&r!==void 0?r:[]).length>0&&(g="aal2");const w=p.amr||[];return{data:{currentLevel:v,nextLevel:g,currentAuthenticationMethods:w},error:null}}catch(p){if(ke(p))return this._returnResult({data:null,error:p});throw p}const{data:{session:o},error:l}
471=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}=mu(o.access_token);let d=null;c.aal&&(d=c.aal);let u=d;((i=(a=o.user.factors)===null||a===void 0?void 0:a.filter(p=>p.status==="verified"))!==null&&i!==void 0?i:[]).length>0&&(u="aal2");const m=c.amr||[];return{data:{currentLevel:d,nextLevel:u,currentAuthenticationMethods:m},error:null}}async _getAuthorizationDetails(t){try{return await this._useSession(async n=>{const{data:{session:r},error:a}=n;return a?this._returnResult({data:null,error:a}):r?await Te(this.fetch,"GET",`${this.url}/oauth/authorizations/${t}`,{headers:this.headers,jwt:r.access_token,xform:i=>({data:i,error:null})}):this._returnResult({data:null,error:new Dn})})}catch(n){if(ke(n))return this._returnResult({data:null,error:n});throw n}}async _approveAuthorization(t,n){try{return await this._useSession(async r=>{const{data:{session:a},error:i}=r;if(i)return this._returnResult({data:null,error:i});if(!a)return this._returnResult({data:null,error:new Dn});const o=await Te(this.fetch,"POST",`${this.url}/oauth/authorizations/${t}/consent`,{headers:this.headers,jwt:a.access_token,body:{action:"approve"},xform:l=>({data:l,error:null})});return o.data&&o.data.redirect_url&&Zt()&&!(n!=null&&n.skipBrowserRedirect)&&window.location.assign(o.data.redirect_url),o})}catch(r){if(ke(r))return this._returnResult({data:null,error:r});throw r}}async _denyAuthorization(t,n){try{return await this._useSession(async r=>{const{data:{session:a},error:i}=r;if(i)return this._returnResult({data:null,error:i});if(!a)return this._returnResult({data:null,error:new Dn});const o=await Te(this.fetch,"POST",`${this.url}/oauth/authorizations/${t}/consent`,{headers:this.headers,jwt:a.access_token,body:{action:"deny"},xform:l=>({data:l,error:null})});return o.data&&o.data.redirect_url&&Zt()&&!(n!=null&&n.skipBrowserRedirect)&&window.location.assign(o.data.redirect_url),o})}catch(r){if(ke(r))return this._returnResult({data:null,error:r});throw r}}async _listOAuthGrants(){try{return await this._useSession(async t=>{const{data:{session:n},error:r}=t;return r?this._returnResult({data:null,error:r}):n?await Te(this.fetch,"GET",`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:n.access_token,xform:a=>({data:a,error:null})}):this._returnResult({data:null,error:new Dn})})}catch(t){if(ke(t))return this._returnResult({data:null,error:t});throw t}}async _revokeOAuthGrant(t){try{return await this._useSession(async n=>{const{data:{session:r},error:a}=n;return a?this._returnResult({data:null,error:a}):r?(await Te(this.fetch,"DELETE",`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:r.access_token,query:{client_id:t.clientId},noResolveJson:!0}),{data:{},error:null}):this._returnResult({data:null,error:new Dn})})}catch(n){if(ke(n))return this._returnResult({data:null,error:n});throw n}}async fetchJwk(t,n={keys:[]}){let r=n.keys.find(l=>l.kid===t);if(r)return r;const a=Date.now();if(r=this.jwks.keys.find(l=>l.kid===t),r&&this.jwks_cached_at+mR>a)return r;const{data:i,error:o}=await Te(this.fetch,"GET",`${this.url}/.well-known/jwks.json`,{headers:this.headers});if(o)throw o;return!i.keys||i.keys.length===0||(this.jwks=i,this.jwks_cached_at=a,r=i.keys.find(l=>l.kid===t),!r)?null:r}async getClaims(t,n={}){try{let r=t;if(!r){const{data:p,error:v}
471=await this.getSession();if(v||!p.session)return this._returnResult({data:null,error:v});r=p.session.access_token}const{header:a,payload:i,signature:o,raw:{header:l,payload:c}}=mu(r);n!=null&&n.allowExpired||LR(i.exp);const d=!a.alg||a.alg.startsWith("HS")||!a.kid||!("crypto"in globalThis&&"subtle"in globalThis.crypto)?null:await this.fetchJwk(a.kid,n!=null&&n.keys?{keys:n.keys}:n==null?void 0:n.jwks);if(!d){const{error:p}=await this.getUser(r);if(p)throw p;return{data:{claims:i,header:a,signature:o},error:null}}const u=MR(a.alg),f=await crypto.subtle.importKey("jwk",d,u,!0,["verify"]);if(!await crypto.subtle.verify(u,f,o,jR(`${l}.${c}`)))throw new gp("Invalid JWT signature");return{data:{claims:i,header:a,signature:o},error:null}}catch(r){if(ke(r))return this._returnResult({data:null,error:r});throw r}}}sc.nextInstanceID={};const pA=sc,xA="2.99.1";let ul="";typeof Deno<"u"?ul="deno":typeof document<"u"?ul="web":typeof navigator<"u"&&navigator.product==="ReactNative"?ul="react-native":ul="node";const gA={"X-Client-Info":`supabase-js-${ul}/${xA}`},bA={headers:gA},yA={schema:"public"},vA={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"},wA={};function ac(e){"@babel/helpers - typeof";return ac=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},ac(e)}function _A(e,t){if(ac(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(ac(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function jA(e){var t=_A(e,"string");return ac(t)=="symbol"?t:t+""}function NA(e,t,n){return(t=jA(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Hb(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Pt(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Hb(Object(n),!0).forEach(function(r){NA(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Hb(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}const kA=e=>e?(...t)=>e(...t):(...t)=>fetch(...t),SA=()=>Headers,CA=(e,t,n)=>{const r=kA(n),a=SA();return async(i,o)=>{var l;const c=(l=await t())!==null&&l!==void 0?l:e;let d=new a(o==null?void 0:o.headers);return d.has("apikey")||d.set("apikey",e),d.has("Authorization")||d.set("Authorization",`Bearer ${c}`),r(i,Pt(Pt({},o),{},{headers:d}))}};function EA(e){return e.endsWith("/")?e:e+"/"}function PA(e,t){var n,r;const{db:a,auth:i,realtime:o,global:l}=e,{db:c,auth:d,realtime:u,global:f}=t,m={db:Pt(Pt({},c),a),auth:Pt(Pt({},d),i),realtime:Pt(Pt({},u),o),storage:{},global:Pt(Pt(Pt({},f),l),{},{headers:Pt(Pt({},(n=f==null?void 0:f.headers)!==null&&n!==void 0?n:{}),(r=l==null?void 0:l.headers)!==null&&r!==void 0?r:{})}),accessToken:async()=>""};return e.accessToken?m.accessToken=e.accessToken:delete m.accessToken,m}function TA(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(EA(t))}catch{throw Error("Invalid supabaseUrl: Provided URL is malformed.")}}var RA=class extends pA{constructor(e){super(e)}},AA=class{constructor(e,t,n){var r,a;this.supabaseUrl=e,this.supabaseKey=t;const i=TA(e);if(!t)throw new Error("supabaseKey is required.");this.realtimeUrl=new URL("realtime/v1",i),this.realtimeUrl.protocol=this.realtimeUrl.protocol.replace("http","ws"),this.authUrl=new URL("auth/v1",i),this.storageUrl=new URL("storage/v1",i),this.functionsUrl=new URL("functions/v1",i);const o=`sb-${i.hostname.split(".")[0]}-auth-token`,l={db:yA,realtime:wA,auth:Pt(Pt({},vA),{},{storageKey:o}),global:bA},c=PA(n??{},l);if(this.storageKey=(r=c.auth.storageKey)!==null&&r!==void 0?r:"",this.headers=(a=c.global.headers)!==null&&a!==void 0?a:{},c.accessToken)this.accessToken=c.accessToken,this.auth=new Proxy({},{get:(u,f)=>{throw new Error(`@supabase/supabase-js: Supabase Client is configured with the accessToken option, accessing supabase.auth.${String(f)} is not possible`)}});else{var d;this.auth=this._initSupabaseAuthClient((d=c.auth)!==null&&d!==void 0?d:{},this.headers,c.global.fetch)}this.fetch=CA(t,this._getAccessToken.bind(this),c.global.fetch),this.realtime=this._initRealtimeClient(Pt({headers:this.headers,accessToken:this._getAccessToken.bind(this)},c.realtime)),this.accessToken&&Promise.resolve(this.accessToken()).then(u=>this.realtime.setAuth(u)).catch(u=>console.warn("Failed to set initial Realtime auth token:",u)),this.rest=new x3(new URL("rest/v1",i).href,{headers:this.headers,schema:c.db.schema,fetch:this.fetch,timeout:c.db.timeout,urlLengthLimit:c.db.urlLengthLimit}),this.storage=new cR(this.storageUrl.href,this.headers,this.fetch,n==null?void 0:n.storage),c.accessToken||this._listenForAuthEvents()}get functions(){return new l3(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={},n={head:!1,get:!1,count:void 0}){return this.rest.rpc(e,t,n)}
471channel(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,n;if(e.accessToken)return await e.accessToken();const{data:r}=await e.auth.getSession();return(t=(n=r.session)===null||n===void 0?void 0:n.access_token)!==null&&t!==void 0?t:e.supabaseKey}_initSupabaseAuthClient({autoRefreshToken:e,persistSession:t,detectSessionInUrl:n,storage:r,userStorage:a,storageKey:i,flowType:o,lock:l,debug:c,throwOnError:d},u,f){const m={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new RA({url:this.authUrl.href,headers:Pt(Pt({},m),u),storageKey:i,autoRefreshToken:e,persistSession:t,detectSessionInUrl:n,storage:r,userStorage:a,flowType:o,lock:l,debug:c,throwOnError:d,fetch:f,hasCustomAuthorizationHeader:Object.keys(this.headers).some(p=>p.toLowerCase()==="authorization")})}_initRealtimeClient(e){return new I3(this.realtimeUrl.href,Pt(Pt({},e),{},{params:Pt(Pt({},{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,n){(e==="TOKEN_REFRESHED"||e==="SIGNED_IN")&&this.changedAccessToken!==n?(this.changedAccessToken=n,this.realtime.setAuth(n)):e==="SIGNED_OUT"&&(this.realtime.setAuth(),t=="STORAGE"&&this.auth.signOut(),this.changedAccessToken=void 0)}};const IA=(e,t,n)=>new AA(e,t,n);function OA(){if(typeof window<"u")return!1;const e=globalThis.process;if(!e)return!1;const t=e.version;if(t==null)return!1;const n=t.match(/^v(\d+)\./);return n?parseInt(n[1],10)<=18:!1}OA()&&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");function DA(){var y,b;if(typeof window>"u")return;const e=location.hostname,n=["lovableproject.com","lovableproject-dev.com","lovable.app","gpt-eng.com","gptengineer.run"].some(x=>e===x||e.endsWith("."+x)),r="[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}",a=n?((y=e.match(new RegExp("^(?:id-preview(?:-[a-z0-9]+)?|project)--("+r+")(?:-dev)?(?=\\.|$)","i")))==null?void 0:y[1])??((b=e.match(new RegExp("^("+r+")(?=[.-])","i")))==null?void 0:b[1]):void 0,i=window.parent&&window.parent!==window;if(!a||!i)return localStorage;const o=e.endsWith(".lovableproject-dev.com")||e.endsWith(".gpt-eng.com"),l=o?/^https:\/\/([a-z0-9-]+\.)*(lovable\.dev|gptengineer\.app)$|^http:\/\/localhost:3000$/:/^https:\/\/([a-z0-9-]+\.)*(lovable\.dev|gptengineer\.app)$/,c=location.ancestorOrigins&&location.ancestorOrigins[0]||(document.referrer?new URL(document.referrer).origin:""),d=c&&l.test(c)?[c]:o?["https://lovable.dev","http://localhost:3000"]:["https://lovable.dev"],u="lovable-preview-auth:result",f=2e3,m=()=>Math.random().toString(36).slice(2)+Date.now().toString(36),p=(x,w,_)=>new Promise(j=>{const N=m();let k=!1,C;const A=P=>{k||(k=!0,clearTimeout(C),window.removeEventListener("message",I),j(P))},I=P=>{if(d.indexOf(P.origin)<0)return;const T=P.data;T&&T.type===u&&T.requestId===N&&A(T)};window.addEventListener("message",I);const O={type:x,requestId:N,projectId:a,key:w};_!==void 0&&(O.value=_);for(const P of d)window.parent.postMessage(O,P);C=setTimeout(()=>A(null),f)});let v=!0;const g=250;return{getItem:async x=>{let w=await p("lovable-preview-auth:get",x);return!w&&v&&(await new Promise(_=>setTimeout(_,g)),w=await p("lovable-preview-auth:get",x)),v=!1,w&&w.ok&&typeof w.value=="string"?w.value===""?(localStorage.removeItem(x),null):w.value:localStorage.getItem(x)},setItem:(x,w)=>(localStorage.setItem(x,w),p("lovable-preview-auth:set",x,w).then(_=>{_&&_.ok&&typeof _.value=="string"&&localStorage.getItem(x)===w&&(_.value===""?localStorage.removeItem(x):localStorage.setItem(x,_.value))})),removeItem:x=>(localStorage.removeItem(x),p("lovable-preview-auth:remove",x).then(()=>{}))}}const LA="https://ncpbiymnafxdfsvpxirb.supabase.co",MA="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6Im5jcGJpeW1uYWZ4ZGZzdnB4aXJiIiwicm9sZSI6ImFub24iLCJpYXQiOjE3NzMyNDY0MjgsImV4cCI6MjA4ODgyMjQyOH0.gMgtPIrRCFfHC7yaUSxajl-uTrXIh2GYvaVgs1SXFfA",S=IA(LA,MA,{auth:{storage:DA(),persistSession:!0,autoRefreshToken:!0}}),$A="t2_80vn1q03";let Gb=!1,Kb=null;function Yb(e){if(typeof window>"u"||!window.rdt)return;const t=JSON.stringify(e);if(t!==Kb){Kb=t;try{window.rdt("init",$A,{...e.email?{email:e.email}:{},...e.externalId?{externalId:e.externalId}:{},...e.phoneNumber?{phoneNumber:e.phoneNumber}:{}}),Gb||(window.rdt("track","PageVisit"),Gb=!0)}catch(n){console.warn("Reddit pixel identify failed",n)}}}function FA(){return typeof crypto<"u"&&"randomUUID"in crypto?crypto.randomUUID():Math.random().toString(36).slice(2)+Date.now().toString(36)}async function UA(e,t={}){const n=t.conversionId??FA();if(typeof window<"u"&&window.rdt)try{const r={conversionId:n};t.value!=null&&(r.value=t.value),t.currency&&(r.currency=t.currency),t.itemCount!=null&&(r.itemCount=t.itemCount),e==="Custom"&&t.customEventName,window.rdt("track",e,r)}catch(r){console.warn("Reddit pixel track failed",r)}try{let r;if(typeof window<"u")try{const o=new URL(window.location.href).searchParams.get("rdt_cid");o?(localStorage.setItem("rdt_cid",o),r=o):r=localStorage.getItem("rdt_cid")||void 0}catch{}const a=typeof window<"u"&&window.screen?{width:window.screen.width,height:window.screen.height}:void 0;await S.functions.invoke("reddit-capi",{body:{event:e,conversionId:n,value:t.value,currency:t.currency,itemCount:t.itemCount,customEventName:t.customEventName,email:t.email,externalId:t.externalId,clickId:r,screen:a,url:typeof window<"u"?window.location.href:void 0,referrer:typeof document<"u"?document.referrer:void 0,userAgent:typeof navigator<"u"?navigator.userAgent:void 0}})}catch(r){console.warn("Reddit CAPI mirror failed",r)}return n}const Ej=h.createContext(void 0),BA=({children:e})=>{const[t,n]=h.useState(null),[r,a]=h.useState(null),[i,o]=h.useState(!1),[l,c]=h.useState(!1),[d,u]=
471h.useState(new Set),[f,m]=h.useState(!0),[p,v]=h.useState(null),g=h.useRef(!1),y=h.useCallback(async N=>{var P,T,E;const k=((P=N.user_metadata)==null?void 0:P.full_name)||((T=N.user_metadata)==null?void 0:T.name)||((E=N.email)==null?void 0:E.split("@")[0])||"",C=/privaterelay\.appleid\.com$/i.test(N.email??""),A=/^[a-z0-9]{8,}$/.test(k)&&!/[aeiou][a-z]*[aeiou]/.test(k),I=C||A?`iphoneuser${1e3+Math.floor(Math.random()*9e3)}`:k||"Member",{error:O}=await S.from("members").upsert({id:N.id,email:N.email??null,name:I},{onConflict:"id",ignoreDuplicates:!0});O&&console.warn("Failed to ensure member row:",O.message),await S.from("members").update({last_active_at:new Date().toISOString()}).eq("id",N.id)},[]),b=h.useCallback(async N=>{const{data:k}=await S.from("user_roles").select("role").eq("user_id",N),C=new Set((k||[]).map(I=>I.role));o(C.has("admin"));const A=C.has("moderator");if(c(A),A&&!C.has("admin")){const{data:I}=await S.from("moderator_permissions").select("menu_key").eq("user_id",N);u(new Set((I||[]).map(O=>O.menu_key)))}else u(new Set)},[]),x=h.useCallback(async N=>{const{data:k}=await S.from("user_bans").select("reason, ban_type, created_at, expires_at").eq("user_id",N).eq("is_active",!0).order("created_at",{ascending:!1}).limit(1).maybeSingle();if(k&&k.expires_at&&new Date(k.expires_at)<=new Date){await S.from("user_bans").update({is_active:!1}).eq("user_id",N).eq("is_active",!0),v(null);return}v(k?{reason:k.reason,ban_type:k.ban_type,created_at:k.created_at}:null)},[]),w=h.useCallback(async()=>{t&&await x(t.id)},[t,x]);h.useEffect(()=>{const{data:{subscription:N}}=S.auth.onAuthStateChange((k,C)=>{if(a(C),n((C==null?void 0:C.user)??null),m(!1),C!=null&&C.user&&(y(C.user),Yb({email:C.user.email??void 0,externalId:C.user.id})),k==="SIGNED_IN"&&(C!=null&&C.user)){const A=C.user.id,I=`welcome_email_sent_${A}`;if(!sessionStorage.getItem(I)){const P=new Date(C.user.created_at).getTime();Date.now()-P<3e4&&(sessionStorage.setItem(I,"1"),S.functions.invoke("welcome-email",{body:{userId:A}}).catch(E=>console.warn("Welcome email failed:",E)),UA("SignUp",{conversionId:`signup_${A}`,email:C.user.email??void 0,externalId:A}))}}});return S.auth.getSession().then(({data:{session:k}})=>{a(k),n((k==null?void 0:k.user)??null),m(!1),k!=null&&k.user&&(y(k.user),Yb({email:k.user.email??void 0,externalId:k.user.id}))}),()=>N.unsubscribe()},[y]),h.useEffect(()=>{g.current||(g.current=!0,S.functions.invoke("session-init").then(({data:N})=>{var k;(k=N==null?void 0:N.ip_ban)!=null&&k.banned&&!p&&v({reason:N.ip_ban.reason||"Your IP address has been banned",ban_type:N.ip_ban.ban_type||"standard",created_at:N.ip_ban.created_at||new Date().toISOString()}),N!=null&&N.ip&&sessionStorage.setItem("client_ip",N.ip),N!=null&&N.subscription&&sessionStorage.setItem("vip_status_session_init",JSON.stringify({data:N.subscription,ts:Date.now()}))}).catch(N=>console.warn("Session init failed:",N)))},[]),h.useEffect(()=>{if(!t)return;const N=()=>{document.hidden||S.from("members").update({last_active_at:new Date().toISOString()}).eq("id",t.id).then(()=>{})},k=setInterval(N,5*60*1e3),C=()=>{document.hidden||N()};return document.addEventListener("visibilitychange",C),()=>{clearInterval(k),document.removeEventListener("visibilitychange",C)}},[t]),h.useEffect(()=>{if(!t){o(!1),c(!1),u(new Set),v(null);return}const N=setTimeout(()=>{b(t.id),x(t.id)},100),C=setInterval(()=>{document.hidden||x(t.id)},3e4),A=()=>{document.hidden||x(t.id)};return document.addEventListener("visibilitychange",A),()=>{clearTimeout(N),clearInterval(C),document.removeEventListener("visibilitychange",A)}},[t,b,x]);const _=async(N,k)=>{const{error:C}=await S.auth.signInWithPassword({email:N.trim(),password:k});return{error:C}},j=async()=>{await S.auth.signOut(),o(!1),c(!1),u(new Set),v(null)};return s.jsx(Ej.Provider,{value:{user:t,session:r,isAdmin:i,isModerator:l,modPermissions:d,loading:f,banInfo:p,signIn:_,signOut:j,recheckBan:w},children:e})},it=()=>{const e=h.useContext(Ej);if(!e)throw new Error("useAuth must be used within AuthProvider");return e};function zA(){const{user:e}=it(),[t,n]=h.useState(null),r=()=>{},a=()=>{t&&(S.from("direct_call_invites").update({status:"declined"}).eq("id",t.inviteId).then(),Qb(t.inviterId,e==null?void 0:e.id),Jb(t.inviterId,e==null?void 0:e.id)),n(null)},i=()=>n(null);return h.useEffect(()=>{if(!e)return;const o=new Set,l=async()=>{const{data:f}=await S.from("direct_call_invites").select("id, inviter_id, status, created_at").eq("invitee_id",e.id).eq("status","pen
471ding").order("created_at",{ascending:!1}).limit(1),m=f==null?void 0:f[0];if(!m||o.has(m.id))return;o.add(m.id);const{data:p}=await S.from("members").select("name").eq("id",m.inviter_id).maybeSingle(),v=(p==null?void 0:p.name)||"Someone";n({inviteId:m.id,inviterId:m.inviter_id,inviterName:v}),B(`📹 ${v} wants to video chat!`,{description:"Accept or decline the call.",duration:3e4}),setTimeout(async()=>{const{data:g}=await S.from("direct_call_invites").select("status").eq("id",m.id).maybeSingle();g&&g.status==="pending"&&(Qb(m.inviter_id,e.id),Jb(m.inviter_id,e.id))},6e4)},c=()=>{document.hidden||l()};c();const d=setInterval(c,1e4),u=()=>{document.hidden||l()};return document.addEventListener("visibilitychange",u),()=>{clearInterval(d),document.removeEventListener("visibilitychange",u)}},[e]),{incomingCall:t,acceptCall:r,declineCall:a,clearCall:i}}function Qb(e,t){!e||!t||S.functions.invoke("missed-call-email",{body:{inviterId:e,inviteeId:t}}).catch(n=>console.error("Failed to send missed call email:",n))}function Jb(e,t){!e||!t||S.functions.invoke("notify-direct-call",{body:{inviterId:e,inviteeId:t,action:"missed"}}).catch(n=>console.error("Failed to send missed call push:",n))}const qA={iceServers:[{urls:["stun:stun.l.google.com:19302","stun:stun1.l.google.com:19302"]}],iceTransportPolicy:"all",iceCandidatePoolSize:10};let pu=null,Xb=0;const VA=5*60*1e3;async function WA(){var t;const e=Date.now();if(pu&&e-Xb<VA)return pu;try{const{data:n,error:r}=await S.functions.invoke("get-ice-servers");if(r)throw r;if((t=n==null?void 0:n.iceServers)!=null&&t.length)return pu={iceServers:n.iceServers,iceTransportPolicy:"all",iceCandidatePoolSize:10},Xb=e,pu}catch(n){console.warn("[DirectCall] Failed to fetch TURN config, using fallback:",n)}return qA}const HA=e=>{if(!e)return;const t=e.play();t&&typeof t.catch=="function"&&t.catch(()=>{})},yf=(e,t)=>{!e||!t||(e.srcObject!==t&&(e.srcObject=t),HA(e))};async function ba(e,t,n,r){try{await S.from("room_signals").insert({room_id:e,sender_channel:t,signal_type:n,payload:r})}catch(a){console.warn("[DirectCall] DB signal send failed:",a)}}function GA({myUserId:e,partnerId:t,inviteId:n,isInitiator:r}){const[a,i]=h.useState("connecting"),[o,l]=h.useState(!1),[c,d]=h.useState(!1),[u,f]=h.useState(null),m=h.useRef(null),p=h.useRef(null),v=h.useRef(null),g=h.useRef(null),y=h.useRef(null),b=h.useRef(!1),x=`direct-${n}`,w=h.useCallback(()=>{b.current||(b.current=!0,y.current&&(clearInterval(y.current),y.current=null),v.current&&(v.current.ontrack=null,v.current.onicecandidate=null,v.current.onconnectionstatechange=null,v.current.close(),v.current=null),g.current&&(g.current.getTracks().forEach(C=>C.stop()),g.current=null),m.current&&(m.current.srcObject=null),p.current&&(p.current.srcObject=null),f(null),i("ended"),S.from("room_signals").delete().eq("room_id",x).then(()=>{}))},[x]),_=h.useCallback(()=>{ba(x,e,"call-ended",{from:e}),S.from("direct_call_invites").update({status:"ended"}).eq("id",n).then(),w()},[w,n,e,x]),j=h.useCallback(()=>{var A;const C=(A=g.current)==null?void 0:A.getAudioTracks()[0];C&&(C.enabled=!C.enabled,l(!C.enabled))},[]),N=h.useCallback(()=>{var A;const C=(A=g.current)==null?void 0:A.getVideoTracks()[0];C&&(C.enabled=!C.enabled,d(!C.enabled))},[]),k=h.useCallback(C=>{p.current=C,yf(C,u)},[u]);return h.useEffect(()=>{yf(p.current,u)},[u]),h.useEffect(()=>{let C=!1;async function A(){try{window.dispatchEvent(new CustomEvent("prepare-direct-call")),await new Promise(R=>setTimeout(R,250));const I=await navigator.mediaDevices.getUserMedia({video:!0,audio:!0});if(C){I.getTracks().forEach(R=>R.stop());return}g.current=I,yf(m.current,I);const O=await WA(),P=new RTCPeerConnection(O);v.current=P,I.getTracks().forEach(R=>P.addTrack(R,I)),P.ontrack=R=>{console.log("[DirectCall] Remote track received",R.streams.length),R.streams[0]&&f(R.streams[0])},P.onconnectionstatechange=()=>{console.log("[DirectCall] Connection state:",P.connectionState),P.connectionState==="connected"?(i("connected"),y.current&&(clearInterval(y.current),y.current=null)):(P.connectionState==="failed"||P.connectionState==="disconnected")&&w()};const T=[];let E=!1,W=!1;const V=new Set,q=async()=>{for(;T.length>0;){const R=T.shift();if(R)try{await P.addIceCandidate(new RTCIceCandidate(R))}catch(U){console.warn("[DirectCall] Failed to add queued ICE candidate",U)}}};P.onicecandidate=R=>{R.candidate&&ba(x,e,"ice-candidate",{candidate:R.candidate.toJSON(),from:e})};const D=async()=>
471{if(!r||W||C)return;W=!0,console.log("[DirectCall] Creating and sending offer");const R=await P.createOffer();await P.setLocalDescription(R),await ba(x,e,"offer",{sdp:R,from:e})},$=async R=>{if(R.sender_channel!==e&&!V.has(R.id))switch(V.add(R.id),R.signal_type){case"offer":{if(!R.payload.sdp)return;console.log("[DirectCall] Received offer"),await P.setRemoteDescription(new RTCSessionDescription(R.payload.sdp)),E=!0,await q();const U=await P.createAnswer();await P.setLocalDescription(U),await ba(x,e,"answer",{sdp:U,from:e});break}case"answer":{if(!R.payload.sdp)return;console.log("[DirectCall] Received answer"),await P.setRemoteDescription(new RTCSessionDescription(R.payload.sdp)),E=!0,await q();break}case"ice-candidate":{if(!R.payload.candidate)return;if(!E||!P.remoteDescription){T.push(R.payload.candidate);return}try{await P.addIceCandidate(new RTCIceCandidate(R.payload.candidate))}catch(U){console.warn("[DirectCall] Failed to add ICE candidate",U)}break}case"peer-ready":{console.log("[DirectCall] Peer ready received, isInitiator:",r),r?D():ba(x,e,"peer-ready",{from:e});break}case"call-ended":{w();break}}};r&&await S.from("room_signals").delete().eq("room_id",x);const z=async()=>{try{const{data:R}=await S.from("room_signals").select("id, signal_type, payload, sender_channel, created_at").eq("room_id",x).neq("sender_channel",e).order("created_at",{ascending:!0});if(R&&R.length>0)for(const U of R)await $(U)}catch(R){console.warn("[DirectCall] Poll error:",R)}};if(i("ringing"),await ba(x,e,"peer-ready",{from:e}),y.current=setInterval(z,500),setTimeout(()=>z(),300),r){const R=setInterval(()=>{if(W||C||b.current){clearInterval(R);return}console.log("[DirectCall] Retrying peer-ready"),ba(x,e,"peer-ready",{from:e})},1500);setTimeout(()=>clearInterval(R),3e4)}}catch(I){console.error("[DirectCall] Error:",I),w()}}return A(),()=>{C=!0,w()}},[]),{callState:a,localVideoRef:m,remoteVideoRef:k,isMuted:o,isCameraOff:c,toggleMute:j,toggleCamera:N,endCall:_}}function Zb(){return crypto.randomUUID?crypto.randomUUID():`${Date.now()}-${Math.random().toString(36).slice(2)}`}function Pj({userId:e,partnerId:t,isConnected:n,voiceMode:r=!1,sessionId:a}){const[i,o]=h.useState(0),[l,c]=h.useState(0),[d,u]=h.useState(0),[f,m]=h.useState(0),[p,v]=h.useState(0),[g,y]=h.useState(!1),[b,x]=h.useState(null),[w,_]=h.useState(!1),[j,N]=h.useState({isFrozen:!1,earnRate:10}),k=h.useRef(null),C=h.useRef(0),A=h.useRef(0),I=h.useRef(t),O=h.useRef(!1),P=h.useRef(a||Zb());h.useEffect(()=>{a&&(P.current=a)},[a]),h.useEffect(()=>{I.current=t},[t]);const T=h.useCallback(()=>{!e||e==="anonymous"||S.functions.invoke("earn-minutes",{body:{type:"get_balance",userId:e}}).then(({data:q})=>{q!=null&&q.success&&(o(q.totalMinutes),c(q.giftedMinutes??0),N({isFrozen:q.isFrozen??!1,earnRate:q.earnRate??10}))})},[e]);h.useEffect(()=>{T()},[T]),h.useEffect(()=>{C.current=0,A.current=0,v(0),y(!1),O.current=!1,_(!1),u(0),m(0),P.current=a||Zb()},[t,a]);const E=h.useCallback(async q=>{var R;const D=I.current,$=Math.min(q,5);if(!D||!e||e==="anonymous"||$<=0)return;const{data:z}=await S.functions.invoke("earn-minutes",{body:{type:"earn",userId:e,partnerId:D,minutesEarned:$,sessionId:P.current,voiceMode:r}});z!=null&&z.success&&(o(z.totalMinutes),z.giftedMinutes!==void 0&&c(z.giftedMinutes),typeof z.earned=="number"&&z.earned>0&&u(U=>U+z.earned),typeof z.creditedGiftedMinutes=="number"&&z.creditedGiftedMinutes>0&&m(U=>U+z.creditedGiftedMinutes),z.message==="cap_reached"&&!O.current&&(O.current=!0,y(!0),x({cap:z.cap,isVip:z.isVip}),z.showCapPopup&&_(!0)),z.showCapPopup&&!((R=z.message)!=null&&R.includes("cap_reached"))&&!O.current&&(x({cap:z.cap,isVip:z.isVip}),_(!0)))},[e,r]);h.useEffect(()=>(n&&!O.current&&(k.current=setInterval(()=>{C.current+=1,v(C.current);const q=Math.floor(C.current/60);if(q>A.current){const D=q-A.current;A.current=q,E(D)}},1e3)),()=>{k.current&&(clearInterval(k.current),k.current=null)}),[n,E]);const W=h.useCallback(async()=>{const q=Math.floor(C.current/60),D=q-A.current;D>0&&(A.current=q,await E(D))},[E]),V=h.useCallback(()=>{_(!1)},[]);return{totalMinutes:i,giftedMinutes:l,sessionEarnedMinutes:d,sessionGiftedMinutes:f,elapsedSeconds:p,capReached:g,capInfo:b,showCapPopup:w,dismissCapPopup:V,flushMinutes:W,freezeInfo:j,refreshBalance:T}}const Tj="/assets/gift-icon-C0wZEg1V.svg",KA=[{tier:"100",minutes:100,price:"$1.99",cashValue:"$1.00",label:"Gift $1.00 Cash",sublabel:"100 Minutes • You pay $1.99"},{tier:"400",minutes:400,price:"$4.99",cashValue:"$4.00",label:"Gift $4.00 Cash",sublabel:"400 Minutes • You pay $4.99",bonus:"Send $4.00 Cash & Get +100 Minutes Back!"},{tier:"600",minutes:600,price:"$7.99",cashValue:"$6.00",label:"Gift $6.00 Cash",sublabel:"600 Minutes • You pay $7.99",bonus:"Send $6.00 Cash & Get +150 Minutes Back!"},{tier:"1000",minutes:1e3,price:"$12.99",cashValue:"$10.00",label:"Gift $10.00 Cash",sublabel:"1000 Minutes • You pay $12.99",bonus:"Send $10.00 Cash & Get +250 Minutes Back!"}],X0=({onClose:e,recipientId:t,isDirectCall:n=!1})=>{const[r,a]=h.useState(null),i=async o=>{a(o);try{const{data:l,error:c}=await S.functions.invoke("gift-minutes",{body:{action:"create-checkout",tier:o,recipient_id:t,is_direct_call:n}});if(c)throw c;l!=null&&l.url&&window.open(l.url,"_blank","noopener,noreferrer")}catch(l){B.error(l.message||"Failed to start gift checkout")}finally{a(null)}};return s.jsx("div",{className:"fixed inset-0 z-[60] bg-black/80 flex items-center justify-center px-6",children:s.jsxs("div",{className:"bg-neutral-900 border border-neutral-700 rounded-2xl p-6 w-full max-w-xs relative",children:[s.jsx("button",{onClick:e,className:"absolute top-3 left-3",children:s.jsx(We,{className:"w-6 h-6 text-red-500"})}),s.jsx("div",{className:"absolute top-3 right-4 text-2xl",children:"🎈"}),s.jsxs("div",{className:"text-center mb-4",children:[s.jsx("h2",{className:"text-white text-xl font-black tracking-wider leading-tight",children:"SEND CASH"}),s.jsx("p",{className:"text-white text-lg font-black tracking-wider",children:"TO THIS USER!"})]}),s.jsxs("div",{className:"flex justify-center mb-3 relative",children:[s.jsx("span",{className:"absolute -left-2 top-0 text-2xl",children:"🎉"}),s.jsx("img",{src:Tj,alt:"Gift",className:"w-20 h-20 object-contain"})]}),s.jsxs("div",{className:"flex items-center justify-center gap-1.5 mb-4",children:[s.jsx($t,{className:"w-4 h-4 text-emerald-400"}),s.jsx("p",{className:"text-emerald-400 text-xs font-bold text-center",children:"They receive real cash via PayPal"})]}),s.jsx("div",{className:"space-y-3",children:KA.map(o=>s.jsxs("div",{children:[s.jsx("button",{onClick:()=>i(o.tier),disabled:r!==null,className:"w-full bg-emerald-500 hover:bg-emerald-400 text-black font-black text-sm tracking-wider py-3 rounded-full transition-colors disabled:opacity-50 shadow-lg",children:r===o.tier?"Loading...":o.label}),s.jsx("p",{className:"text-white/50 text-[10px] text-center mt-1",children:o.sublabel}),o.bonus&&s.jsx("p",{className:"text-yellow-400 text-[10px] font-bold text-center mt-0.5",children:o.bonus})]},o.tier))}),s.jsx("p",{className:"text-red-500 text-[10px] font-bold text-center mt-4 tracking-wider",children:"NO REFUND POLICY"})]})})}
471,Z0=({myUserId:e,partnerId:t,partnerName:n,inviteId:r,isInitiator:a,onClose:i})=>{const[o,l]=h.useState(!1),c=sn(),[d,u]=h.useState(!1),{callState:f,localVideoRef:m,remoteVideoRef:p,isMuted:v,isCameraOff:g,toggleMute:y,toggleCamera:b,endCall:x}=GA({myUserId:e,partnerId:t,inviteId:r,isInitiator:a});h.useEffect(()=>{let I=!1;return(async()=>{var E,W,V,q;const{data:O}=await S.from("members").select("id, gender").in("id",[e,t]);if(I||!O)return;const P=(W=(E=O.find(D=>D.id===e))==null?void 0:E.gender)==null?void 0:W.toLowerCase(),T=(q=(V=O.find(D=>D.id===t))==null?void 0:V.gender)==null?void 0:q.toLowerCase();u(P==="female"&&T!=="female")})(),()=>{I=!0}},[e,t]);const{sessionGiftedMinutes:w,elapsedSeconds:_,flushMinutes:j}=Pj({userId:d?e:"anonymous",partnerId:t,sessionId:r,isConnected:d&&f==="connected"}),N=w,k=(N*.01).toFixed(2),C=h.useRef(!1);h.useEffect(()=>{f==="connected"&&!C.current&&(C.current=!0,S.functions.invoke("anchor-earning",{body:{type:"track_direct_call",userId:e,partnerId:t}}).then(({data:I})=>{if(I!=null&&I.results)for(const O of I.results)O.status==="completed_and_rewarded"&&B.success(`🏆 Challenge complete: ${O.title}! +$${O.reward} bonus!`,{duration:6e3})}).catch(()=>{}))},[f,e,t]),h.useEffect(()=>{let I=new Date().toISOString();const O=setInterval(async()=>{const{data:P}=await S.from("gift_transactions").select("minutes_amount, status").eq("recipient_id",e).eq("status","completed").gt("updated_at",I).limit(1);if(I=new Date().toISOString(),P&&P.length>0){const E=P[0].minutes_amount||0,W=(E*.01).toFixed(2);B.success(`🎁 Someone gifted you ${E} minutes = $${W}!`,{description:"Cash out via PayPal now!",action:{label:"Cash Out",onClick:()=>c("/my-rewards")},duration:1e4})}},5e3);return()=>clearInterval(O)},[e,c]);const A=()=>{a&&f!=="connected"&&(S.functions.invoke("missed-call-email",{body:{inviteId:r,inviterId:e,inviteeId:t}}).catch(()=>{}),B(`We'll notify ${n} that you tried calling. They can text you back or call you!`,{duration:5e3})),d&&j(),x(),i()};return In.createPortal(s.jsxs("div",{className:"fixed inset-0 z-50 bg-black flex flex-col items-center justify-center",children:[s.jsxs("div",{className:"absolute top-4 left-0 right-0 text-center z-10",children:[s.jsxs("p",{className:"text-white/80 text-sm font-medium",children:[f==="connecting"&&"Connecting...",f==="ringing"&&`Calling ${n}...`,f==="connected"&&`Connected with ${n}`,f==="ended"&&"Call ended"]}),f==="connected"&&s.jsx("p",{className:"text-emerald-400 text-xs font-bold mt-1 animate-pulse",children:"💸 Tap the gift button to send cash!"})]}),d&&f==="connected"&&s.jsxs("div",{className:"absolute top-14 left-1/2 -translate-x-1/2 z-20 rounded-2xl border border-emerald-400/50 bg-emerald-500/15 backdrop-blur px-4 py-2 text-center shadow-lg",children:[s.jsx("div",{className:"text-[10px] uppercase tracking-wider font-bold text-emerald-200",children:"Earning right now"}),s.jsxs("div",{className:"text-2xl font-black text-emerald-300 leading-tight",children:["$",k]}),s.jsxs("div",{className:"text-[11px] text-emerald-100/90 font-semibold",children:["+",N," cash minutes · ",Math.floor(_/60),":",String(_%60).padStart(2,"0")," on call"]}),s.jsx("div",{className:"text-[10px] text-emerald-100/70",children:"$0.30 per call minute — stay on to keep earning"})]}),s.jsxs("div",{className:"flex-1 w-full flex items-center justify-center gap-4 p-4",children:[s.jsxs("div",{className:"relative w-full max-w-[560px] aspect-[3/4] rounded-2xl overflow-hidden bg-white/5",children:[s.jsx("video",{ref:p,autoPlay:!0,playsInline:!0,className:"w-full h-full object-cover"}),f!=="connected"&&s.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:s.jsxs("div",{className:"text-center",children:[s.jsx("div",{className:"w-20 h-20 rounded-full bg-white/10 flex items-center justify-center mx-auto mb-3 text-3xl font-bold text-white/40",children:n.charAt(0).toUpperCase()}),s.jsx("div",{className:"w-8 h-8 border-2 border-white/30 border-t-white rounded-full animate-spin mx-auto"})]})})]}),s.jsx("div",{className:"absolute bottom-24 right-4 w-28 md:w-36 aspect-[3/4] rounded-xl overflow-hidden border-2 border-white/20 shadow-xl z-20",children:s.jsx("video",{ref:m,autoPlay:!0,playsInl
471ine:!0,muted:!0,className:"w-full h-full object-cover mirror",style:{transform:"scaleX(-1)"}})})]}),s.jsxs("div",{className:"absolute bottom-6 left-0 right-0 flex items-center justify-center gap-4 z-10",children:[s.jsx("button",{onClick:y,className:`w-12 h-12 rounded-full flex items-center justify-center transition-all ${v?"bg-red-500 text-white":"bg-white/15 text-white hover:bg-white/25"}`,children:v?s.jsx(p4,{className:"w-5 h-5"}):s.jsx(x4,{className:"w-5 h-5"})}),f==="connected"&&s.jsx("button",{onClick:()=>l(!0),className:"w-12 h-12 rounded-full flex items-center justify-center bg-emerald-500 hover:bg-emerald-400 text-white transition-all",children:s.jsx(Ft,{className:"w-5 h-5"})}),s.jsx("button",{onClick:A,className:"w-14 h-14 rounded-full flex items-center justify-center bg-red-500 hover:bg-red-600 text-white transition-all",children:s.jsx(y4,{className:"w-6 h-6"})}),s.jsx("button",{onClick:b,className:`w-12 h-12 rounded-full flex items-center justify-center transition-all ${g?"bg-red-500 text-white":"bg-white/15 text-white hover:bg-white/25"}`,children:g?s.jsx(R4,{className:"w-5 h-5"}):s.jsx(mr,{className:"w-5 h-5"})})]}),o&&s.jsx(X0,{recipientId:t,isDirectCall:!0,onClose:()=>l(!1)})]}),document.body)};class YA extends h.Component{constructor(){super(...arguments);Sx(this,"state",{hasError:!1})}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(){}render(){return this.state.hasError?null:this.props.children}}function QA(){const{user:e}=it(),{incomingCall:t,clearCall:n,declineCall:r}=zA(),[a,i]=h.useState(!1);return!t||!e?null:a?s.jsx(Z0,{myUserId:e.id,partnerId:t.inviterId,partnerName:t.inviterName,inviteId:t.inviteId,isInitiator:!1,onClose:()=>{i(!1),n()}}):s.jsx("div",{className:"fixed inset-0 z-[60] bg-black/80 flex items-center justify-center",children:s.jsxs("div",{className:"bg-zinc-900 rounded-2xl p-6 text-center max-w-xs mx-4 border border-white/10",children:[s.jsx("div",{className:"w-16 h-16 rounded-full bg-emerald-500/20 flex items-center justify-center mx-auto mb-4 text-2xl font-bold text-emerald-400",children:t.inviterName.charAt(0).toUpperCase()}),s.jsx("p",{className:"text-white font-bold text-lg mb-1",children:t.inviterName}),s.jsx("p",{className:"text-white/60 text-sm mb-6",children:"wants to video chat with you"}),s.jsxs("div",{className:"flex gap-3 justify-center",children:[s.jsx("button",{onClick:r,className:"px-6 py-2.5 rounded-full bg-red-500 hover:bg-red-600 text-white font-medium transition-colors",children:"Decline"}),s.jsx(XA,{incomingCall:t,onAccepted:()=>i(!0)})]})]})})}function JA(){return s.jsx(YA,{children:s.jsx(QA,{})})}function XA({incomingCall:e,onAccepted:t}){const[n,r]=h.useState(!1),a=async()=>{if(n)return;r(!0),window.dispatchEvent(new CustomEvent("prepare-direct-call"));const{error:i}=await S.from("direct_call_invites").update({status:"accepted"}).eq("id",e.inviteId);if(i){B.error("Failed to accept call",{description:i.message}),r(!1);return}r(!1),t()};return s.jsx("button",{onClick:a,disabled:n,className:"px-6 py-2.5 rounded-full bg-emerald-500 hover:bg-emerald-600 disabled:opacity-70 disabled:cursor-not-allowed text-white font-medium transition-colors",children:n?"Accepting...":"Accept"})}const ZA=()=>{const{user:e}=it(),t=sn();h.useRef(new Map);const n=h.useRef(new Map);return h.useEffect(()=>{if(!e)return;const r=new Set;let a=!0;const i=async()=>{const{data:d}=await S.from("conversations").select("id, participant_1, participant_2").or(`participant_1.eq.${e.id},participant_2.eq.${e.id}`).order("last_message_at",{ascending:!1}).limit(20),u=(d||[]).map(g=>g.id);if(u.length===0)return;const{data:f}=await S.from("dm_messages").select("id, conversation_id, sender_id, content, created_at").in("conversation_id",u).neq("sender_id",e.id).order("created_at",{ascending:!1}).limit(10);if(a){f==null||f.forEach(g=>r.add(g.id)),a=!1;return}const m=f==null?void 0:f.find(g=>!r.has(g.id));if(!m)return;r.add(m.id);let p=n.current.get(m.sender_id);if(!p){const{data:g}=await S.from("members").select("name").eq("id",m.sender_id).single();p=(g==null?void 0:g.name)||"Someone",n.current.set(m.sender_id,p)}const v=m.content.length>60?m.content.slice(0,60)+"…":m.content;B(`💬 ${p}`,{description:v,duration:6e3,action:{label:"View",onClick:()=>
471{window.dispatchEvent(new CustomEvent("open-dm-overlay",{cancelable:!0}))&&t("/messages")}}})},o=()=>{document.hidden||i()};o();const l=setInterval(o,2e4),c=()=>{document.hidden||i()};return document.addEventListener("visibilitychange",c),()=>{clearInterval(l),document.removeEventListener("visibilitychange",c)}},[e,t]),null},vf="cookie_consent",eI=()=>{const[e,t]=h.useState(!1);h.useEffect(()=>{if(!localStorage.getItem(vf)){const i=setTimeout(()=>t(!0),1e3);return()=>clearTimeout(i)}},[]);const n=()=>{localStorage.setItem(vf,"accepted"),t(!1)},r=()=>{localStorage.setItem(vf,"declined"),t(!1)};return e?s.jsx("div",{className:"fixed bottom-0 left-0 right-0 z-[100] animate-in slide-in-from-bottom duration-500",children:s.jsx("div",{className:"mx-auto max-w-3xl px-4 pb-4",children:s.jsxs("div",{className:"relative rounded-2xl border border-neutral-700 bg-neutral-900/95 backdrop-blur-md p-4 shadow-2xl",children:[s.jsx("button",{onClick:r,className:"absolute top-3 right-3 text-neutral-500 hover:text-white transition-colors","aria-label":"Close",children:s.jsx(We,{className:"h-4 w-4"})}),s.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center gap-3 pr-6",children:[s.jsx("span",{className:"text-xl flex-shrink-0",children:"🍪"}),s.jsxs("p",{className:"text-xs text-neutral-300 leading-relaxed",children:["We use cookies and similar technologies to improve your experience, analyze traffic, and personalize content. By continuing, you agree to our"," ",s.jsx(za,{to:"/privacy",className:"text-yellow-400 hover:text-yellow-300 underline underline-offset-2",children:"Privacy Policy"}),"."]}),s.jsxs("div",{className:"flex gap-2 flex-shrink-0 w-full sm:w-auto",children:[s.jsx("button",{onClick:r,className:"flex-1 sm:flex-none px-4 py-2 text-xs font-bold text-neutral-400 hover:text-white border border-neutral-700 hover:border-neutral-500 rounded-lg transition-colors",children:"Decline"}),s.jsx("button",{onClick:n,className:"flex-1 sm:flex-none px-4 py-2 text-xs font-black text-neutral-900 bg-gradient-to-r from-yellow-500 to-orange-500 hover:from-yellow-600 hover:to-orange-600 rounded-lg transition-colors",children:"Accept"})]})]})]})})}):null};var tI="authorization_response",nI="/~oauth/initiate",rI=["https://oauth.lovable.app","https://lovable.dev"],sI="lovable://oauth-callback",aI="http://127.0.0.1/iframe-oauth/callback",iI=500,oI=12e4;function lI(e){let t;const n=new Promise(i=>{t=i}),r=i=>{if(!e.some(c=>i.origin===c))return;const l=i.data;!l||typeof l!="object"||l.type===tI&&t(l.response)},a=()=>{window.removeEventListener("message",r)};return window.addEventListener("message",r),{cleanup:a,messagePromise:n}}function cI(e){const t=window.screenX!==0||window.screenY!==0||!e,n=t?window.outerWidth*.5:window.screen.width*.5,r=t?window.outerHeight*.5:window.screen.height*.5,a=t?window.screenX+(window.outerWidth-n)/2:(window.screen.width-n)/2,i=t?window.screenY+(window.outerHeight-r)/2:(window.screen.height-r)/2;return{width:n,height:r,left:a,top:i}}function ey(e,t){return e.state!==t?{error:new Error("State is invalid")}:e.error?e.error==="legacy_flow"?{error:new Error("This flow is not supported in Preview mode. Please open the app in a new tab to sign in.")}:{error:new Error(e.error_description??"Sign in failed")}:!e.access_token||!e.refresh_token?{error:new Error("No tokens received")}:{tokens:{access_token:e.access_token,refresh_token:e.refresh_token},error:null}}function uI(){const e=navigator.userAgent;return!!(/iPhone|iPad|iPod|Android/i.test(e)||/Macintosh/i.test(e)&&navigator.maxTouchPoints>1)}function dI(){return typeof crypto<"u"&&crypto.getRandomValues?[...crypto.getRandomValues(new Uint8Array(16))].map(e=>e.toString(16).padStart(2,"0")).join(""):Math.random().toString(36).substring(2)+Date.now().toString(36)}function hI(e={}){const t=e.oauthBrokerUrl??nI,n=e.supportedOAuthOrigins??rI;async function r(a,i={}){let o=!1;try{o=window.self!==window.top}catch{o=!0}const l=navigator.userAgent,c=/LovableApp\//.test(l),d=!c&&/lovable/i.test(l),u=dI();let f=i.redirect_uri??window.location.origin;c&&o?f=sI:d&&o&&(f=aI);const m=new URLSearchParams({...i.extraParams,provider:a,redirect_uri:f,state:u});if(!o)return window.location.href=`${t}?${m.toString()}`,{error:null,redirected:!0};!c&&!d&&m.set("response_mode","web_message");const p=`${t}?${m.toString()}`,v=d?[...n,window.location.origin]:n,{messagePromise:g,cleanup:y}=lI(v);let b;if(uI())b=window.open(p,"_blank");else{const{width:_,height:j,left:N,top:k}=cI(o);b=window.open(p,"oauth",`width=${_},height=${j},left=${N},top=${k}`)}if(!b&&(c||d)){let _;const j=new Promise((N,k)=>{_=setTimeout(()=>{k(new Error("OAuth timed out waiting for response"))},oI)});try{const N=await Promise.race([g,j]);return ey(N,u)}catch(N){return{error:N instanceof Error?N:new Error(String(N))}}finally{_&&clearTimeout(_),y()}}if(!b)return y(),{error:new Error("Popup was blocked")};let x;const w=new Promise((_,j)=>{x=setInterval(()=>{b.closed&&(clearInterval(x),j(new Error("Sign in was cancelled")))},iI)});try{const _=await Promise.race([g,w]);return ey(_,u)}catch(_){return{error:_ instanceof Error?_:new Error(String(_))}}finally{clearInterval(x),y(),b==null||b.close()}}return{signInWithOAuth:r}}var fI={name:"@lovable.dev/cloud-auth-js",version:"1.1.1",description:"Lovable Cloud Auth JS",main:"./dist/index.cjs",module:"./dist/index.js",types:"./dist/index.d.ts",type:"module",files:["dist"],scripts:{build:"tsup src/index.ts --format cjs,esm --dts --outDir dist",dev:"tsup src/index.ts --format cjs,esm --dts --watch",test:"vitest run",typecheck:"tsgo --noEmit",prepublishOnly:"npm run clean && npm run build",clean:"rimraf dist"},keywords:["lovable","oauth","authentication"],license:"MIT",devDependencies:{"@types/node":"^22",jsdom:"^26",rimraf:"^5.0.0",tsup:"^7.2.0",typescript:"^5",vitest:"^4.1.0"}};typeof window<"u"&&(window.__lovable_cloud_auth_js_version=fI.version);function mI(e={}){return hI(e)}const pI=mI(),xI={auth:{signInWithOAuth:async(e,t)=>{const n=await pI.signInWithOAuth(e,{redirect_uri:t==null?void 0:t.redirect_uri,extraParams:{...t==null?void 0:t.extraParams}});if(n.redirected||n.error)return n;try{await S.auth.setSession(n.tokens)}catch(r){return{error:r instanceof Error?r:new Error(String(r))}}return n}}},bp="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAZkAAAEICAYAAACNn4koAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAOdEVYdFNvZnR3YXJlAEZpZ21hnrGWYwAADTlJREFUeAHt3VFyFFeWBuBzy0zM42hWMLWDKUGHI/xksYKWVoBYQYsVIK9AzAqQVwBeAeqnibANql4BtQQemx5GtzOrpG4aCklVlVl1M/P7IoQEyHb4Af8+92T+NwXQOflysld9OowY/Rg5TyLFXuQY/+MbUsyqH6uPNI24msZf48/ph+ksYMtSAJ2R306OY5SeVIFyEKtKcVH9Hc7T/vTngC0RMtAB+ffJYRUuZ9WX49jcLFI+FTZsg5CBgs2Pxa7Sy+pP6mE0LafzGF09q8LmQ0BLhAwUqgqYcRUEb6KZ6eVbZvExP7avoS2jAIqzpYCJ+d//39Nl9c97EtACkwwUZn5EltNltB8wX/yD00/p0bvTgAaZZKA0V6PT2HbA1FJ+nt/tv8n/W01R0BCTDBTk+pjsfeyWPQ2NMclAUUbPY/fqPc37/HZyErAhIQMlyfk4SpHSWX778C
471xgA47LoBDVUdnB9RNlpZlWx2dHjs9Yh0kGyvHfUaZJdXz2Jv86mQSsSMhAOcZRrnE8SJfV8dlpwAqEDJRjL0pXP+Zc7WmuW6DhTkIGWE3KJ/XLot6n4T6EDLCO8XxPU7dDwy2EDLCucYzSK3sabiNkgM3M9zT7rxyfsYyQATZX33dTH58JGr4gZICmLK4NUEfDZ4QM0KS96zqa04AQMkAbFtcGeMwZIQO0Rh0NQgZo1XUdjT3NUAkZoH2uDRgsIQNsR8on1Z7mvT3NsAgZYJsWdTS/TQ6CQRAywLaN47sqaDzmPAhCBtiNxbUBL10b0G9CBtidlI9dG9BvQgbYtUUdzeXkSdA7QgYowV410Zzb0/SPkAHK4dqA3hEyQFlcG9ArQgYoUb2nea+OpvuEDFAu1wZ0npAByubagE4TMkAXuDago4QM0BXX1wY4PusSIQN0y6KO5kwdTTcIGaB7Uj5RR9MNQgboqsW1Ab9PDoNiCRmgy8YxSq/sacolZIDuu6mjsacpjpAB+qGuo7GnKY6QAfrEtQGFETJA37g2oCBCBuinRR2NNucdEzJAnx24NmC3hAzQd64N2CEhAwzD4tqAs2CrhAwwHCmfVHua947PtkfIAEOzqKP5bXIQtE7IAEM0ju+qoPGYc+uEDDBci2sDXqqjaY+QAYYt5WN1NO0RMgA3dTSuDWickAFY2HNtQPOEDMDnbq4NcHzWCCED8KX62gB1NI0QMgDLLfY06mg2ImQAvm3vuo7mNFiLkAG4y+LaAI85r0HIANzPZL6n+XUyCe5NyADc3zge2NOsQsgArMq1AfcmZADW4dqAexEyAOtzbcAdhAzAZlwbcAshA9AE1wYsJWQAmuLagK8IGYBmLepoLidPAiED0IK9aqI5t6cRMgDtWdTRDLrNOUVDqtGwrlqoP/4j6hQHVpNTfSujypJ+msXH/Dj9MJ3FwKwdMlWojONqdByj/GPk+R8MwQJwm5yfpUfTFzEgK4dMfjupgiU9qYLlIABYTU4v0qN3z2Ig7h0y83BJ6XnUT04AsIlpdXx2NITjsztDZn4sFumlyQWgUbP4VAXN99Np9NitT5fltw9P6heLBAxA466vDej3Y87fnGSqf/EXkfKfAoB2VXuaGF39lPanH6JnloZMfrd/Xn3ytirA9vTyMeevjsuuRzcBA7Bdi2sDfp8cRo/8S8jMAybl5wHALoxjlF71aU/zj+Oy+VNkOb0PAHYvx+sY5add39P8c5LJ6U0AUIYUh324NmAeMvMXLb1kCVCazl8bsJhkUvKoMkCZOn1tQLKLAeiMi/hY7Wk69JhzPcn8MQDogoP5Y84d2tNUIZN69Uw2QM/Ve5r31S79JDqgnmTGAUC3pHRW7WnOonApv9vPAUBXFV1HMwoAumxRR/Pb5CAKJGQAum8c31VBU+Bjzo7LAPokp/MYXT0rpY7GJAPQJykfl1RHI2QA+mdRR1PAtQFCBqCf9kq4NsBOBqDv6msD/paf7eIxZ5MMQN/V1wbsqI5GyAAMw2JPs+U6GiEDMBx713U0p7EldjIAwzSNj/mo7T2NSQZgmCbzPc2vk0m0SMgADNc4HrS7pxEyAEPX4rUBdjIA3Gj82gCTDAA3Gr82QMgA8LlGrw1wXAbAcg1cG2CSAWC5Bq4NEDIA3GZRR3M5eRJrEDIA3GWvPjpbZ09jJwPAKi7iY35638ecTTIArOJglWsDhAwAq6r3NO/vU0cjZABYzz2uDbCTAWAz9fXOo2pPs+R9GpMMAJupr3fO6dWy3xIyADThYFmTs5ABoBkpn3z5MICQAaA5KT3Pl5O9m58KGQCatBdXo+c3PxEyADSrPja7nmaEDABt+FP9g5ABoHk5HdSfvIwJQDtS/k+TDABt+VHIANCWPSEDQFvGQgaA1ggZANoyEzIAtCMnIQNAS1L+i5ABoA3T+hIzIQNA81I+rz8JGQCa99f4pf4kZABoVs7n6YfprP5SyADQpFn8LX66+YmQAaA5KZ/eTDE1IQNAM3J+kfanP3/+S0IGgAbki/Ro+uzLXxUyAGwoX0SKo2W/8yAAYF31EdmSCeaGSQaAdXyIq3xyW8DUTDIArGoWn/JR+n46vesbhQwAK1jsX6qA+XCf7xYyANxPzqfV8dhPq/wlQgaAu9T7l6fpD9PXsSIhA8BtZvExP/78Lf5VeLoMgOVyPo+U99cNmJpJBoCvrbF/WUbIAPC5+qmxwypg/hwNcFwGwI1ptX/ZTw8vGwmYmpABYF4PU+1fHm+yf1nGcRnA0NX1MH+Y/k+0QMgADNe962HW5bgMYJDyxfz9lxYDpmaSARiaO+r5myRkAIbjw/X+5efYEiEDMAyt71+WETIAvbdaPX+ThAxAnzVUD7MuIQPQT2vX8zdJyAD0z0b1/E3yngxAnzRQz98kkwxAX7RYD7MuIQPQfbPq47gKmMbak5siZAC6ra7nPyrleOxLDyJVCZhjHAB0yxbrYdZVL/63+vYnABtb1MMUHjC1KmSykAHojroe5nFpC/5vGcWnKG5RBMAy26nnb1Kqf8jv9t9Unw4CgDJ1YP+yzOJlzP/PO+u1AeBW9f7luIsBU0s3X5hmAIpTTD3Muv5ZK/Mp1ym59RpoAJbI+XVJ9TDrSp//JL+dnERKZwHA7uy4nr9J6ctfqILmrAqakwBg2+rTpMP08LI3T/2mZb9Y7WfOq09PAoBtKboeZl1Lq/6rFD2ux7UAoH2Lev5OL/i/Jd32m9c7mufVl3sBQPMKrOdvUrrrG/LlZBw51Y83jwOApsyirufv0f5lmTtD5kY11RxfTzXjAGATvdy/LHPvkLmxCJv6oYB0EACspqP1MOtaOWRuzI/RIv4YOQ4FDsCd6nqY0z7vX5ZZO2S+lH+dTOLf4r9icZzmQQFYVU7V/7DFJOijup7/qEvtyU1pLGSAzVSnAy+roDkOeiZfVP+lPUr700HWdj0IANrRo3qYdQkZgObV+5en1f7ldQyckAFoVufr+Zs0CgCasaiH6Xw9f5NMMgBNsH9ZSsgAbGZRz/9o2ut6mHU5LgNYX10Ps9/3/rFNCBmAdeT8oq/1/E1yXAawqp7X8zdJyADc32DrYdbluAzgXvLF/P0XAbMSkwzAXQZWz98kIQPwbR+u9y8/B2sRMgDL2b80QMgAfOW6nv/7YdbzN0nIAHxOPUyjhAzAgnr+FggZAPX8rfGeDDBs6vlbZZIBhks9TOuEDDBEs+rjuAoY7cktEzLA0NT1/EeOx7ZDyADDoR5m6yz+gSFY1MMImK0zyQB9px5mh0wyQI+p5981kwzQT/YvRRAyQN+o5y+IkAH6RD1MYexkgH7I+bV6mPKYZIDuU89fLCEDdFl9qdhhFTDqYQrluAzoqroeZj89vBQwBRMyQPcs6vkt+DvAcRnQLer5O0XIAF0xC/X8nSNkgC5Qz99RQgYom3qYTrP4B0qlnr8HTDJAidTz94SQAQqTLyJFHTAfgs4TMkA51MP0jpABSqCev6eEDLBr6vl7zNNlwO4s6mHU8/eYSQbYDfuXQRAywLap5x8Qx2XANqnnHxghA2xHzi/U8w+P4zKgfer5B0vIAG1SDzNwjsuAluSL+fsvAmbQTDJA89Tzc03IAE1SD8O/EDJAU+xf+IqQARqgnp/lhAywGfUw3ELIAOuq9y9Pq/3L64BvEDLAOtTzcy/ekwFWo56fFZhkoBzlL83Vw7AiIQPlmEW5ZtXHcRUw2pNZiZCBUnyKv8R3UaK6nv/I8RjrsJOBUjyI+iXGso7M1POzoRRAMfLl5CxyOokS2L/QAJMMlOT/ooTOr7oeZl/A0AQhAwWZ937VR1Q7o56fZjkug8JUR2Z71ZHZZfXlOLZJPT8tMMlAYdL+9EO9bI/tPdJc18McCxjaYJKBQlUTzbiaaN5EuxONehhaZZKBQlUTzWw+0aR8Hm3I+bV6GNpmkoEOyG8nx5HS82hmqplF/fb+w0tv79M6IQMdsgibeFL90T2Ilc0vFntRTUi/BGyJkIEOmu9rruKgOvD+MfJ8uqk+0viz75hFvdDPMa2+56L6+pf5AwWwZX8HU5Y0j1jHN1kAAAAASUVORK5CYII=",gI="/assets/logo-BW-HQiQo.png",ty=[{label:"Home",href:"/"},{label:"Omegle Alternatives",href:"/top-omegle-alternatives"},{label:"How To Guide",href:"/how-to-guide"},{label:"Rules",href:"/rules"},{label:"Blog",href:"/blog"}],bI=()=>{const[e,t]=h.useState(!1);return s.jsxs("nav",{className:"fixed top-0 left-0 right-0 z-50 flex items-center justify-between px-5 py-3",children:[s.jsxs(za,{to:"/",className:"flex items-center gap-2.5 no-underline",children:[s.jsx("img",{src:gI,alt:"C24CLUB",className:"h-10 w-auto object-contain",width:"160",height:"160"}),s.jsx("span",{className:"font-extrabold text-xl text-white uppercase tracking-wide drop-shadow-lg",style:{fontFamily:"'Poppins', sans-serif"},children:"C24CLUB"})]}),s.jsx("ul",{className:"hidden md:flex items-center gap-1",children:ty.map(n=>s.jsx("li",{children:n.href.startsWith("#")?s.jsx("a",{href:n.href,className:"px-3 py-2 text-sm font-medium text-white/80 hover:text-white transition-colors rounded-md hover:bg-white/10",children:n.label}):s.jsx(za,{to:n.href,className:"px-3 py-2 text-sm font-medium text-white/80 hover:text-white transition-colors rounded-md hover:bg-white/10",children:n.label})},n.label))}),s.jsx("button",{onClick:()=>t(!e),className:"md:hidden text-white p-2",children:e?s.jsx(We,{className:"h-6 w-6"}):s.jsx(f4,{className:"h-6 w-6"})}),e&&s.jsx("div",{className:"absolute top-full left-0 right-0 bg-[#1a1a1a]/95 backdrop-blur-md border-t border-white/10 md:hidden",children:s.jsx("ul",{className:"flex flex-col p-4 gap-1",children:ty.map(n=>s.jsx("li",{children:n.href.startsWith("#")?s.jsx("a",{href:n.href,onClick:()=>t(!1),className:"block px-4 py-3 text-sm font-medium text-white/80 hover:text-white rounded-md hover:bg-white/10",children:n.label}):s.jsx(za,{to:n.href,onClick:()=>t(!1),className:"block px-4 py-3 text-sm font-medium text-white/80 hover:text-white rounded-md hover:bg-white/10",children:n.label})},n.label))})})]})},ny=[{label:"Terms & Conditions",href:"/terms"},{label:"Privacy Policy",href:"/privacy"},{label:"Site Rules",href:"/rules"},{label:"How To Guide",href:"/how-to-guide"},{label:"Safety Center",href:"/safety"},{label:"Top Omegle Alternatives",href:"/top-omegle-alternatives"},{label:"Ome TV Alternative",href:"/ome-tv-alternative"},{label:"Monkey App Alternative",href:"/monkey-app-alternative"},{label:"Contact",href:"/contact"}],yI=()=>s.jsx("footer",{className:"w-full bg-gradient-to-r from-orange-500 via-orange-400 to-yellow-500 py-3 px-4",children:s.jsx("div",{className:"flex flex-wrap items-center justify-center gap-x-2 gap-y-1",children:ny.map((e,t)=>s.jsxs("span",{className:"flex items-center gap-2",children:[s.jsx(za,{to:e.href,className:"text-sm font-bold text-white hover:text-white/80 transition-colors",style:{fontFamily:"'Poppins', sans-serif"},children:e.label}),t<ny.length-1&&s.jsx("span",{className:"text-white/60",children:"|"})]},e.label))})}),vI=1,wI="6fdda131-d99c-4cc7-8e99-d0de2620cd59",_I="04d99686-11a2-4218-b7d4-d88690e035a3",jI="/__l5e/assets-v1/6fdda131-d99c-4cc7-8e99-d0de2620cd59/playstore.png",NI="a/v1/04d99686-11a2-4218-b7d4-d88690e035a3/6fdda131-d99c-4cc7-8e99-d0de2620cd59/playstore.png",kI="playstore.png",SI=14346,CI="image/png",EI="2026-06-07T13:04:07Z",PI={version:vI,asset_id:wI,project_id:_I,url:jI,r2_key:NI,original_filename:kI,size:SI,content_type:CI,created_at:EI},TI=1,RI="66111227-8924-4dfd-a6bd-edbb8c13b857",AI="04d99686-11a2-4218-b7d4-d88690e035a3",II="/__l5e/assets-v1/66111227-8924-4dfd-a6bd-edbb8c13b857/app_store.jpg",OI="a/v1/04d99686-11a2-4218-b7d4-d88690e035a3/66111227-8924-4dfd-a6bd-edbb8c13b857/app_store.jpg",DI="app_store.jpg",LI=105174,MI="image/jpeg",$I="2026-06-07T13:13:14Z",FI={version:TI,asset_id:RI,project_id:AI,url:II,r2_key:OI,original_filename:DI,size:LI,content_type:MI,created_at:$I},Rj="/assets/reward3-De0JXlUK.webp",Aj="/assets/bag-BdT0TIqE.webp",Ij="/assets/phonecase-2-BSu9J2gl.webp",Oj="/assets/bag-3-CjPh3-db.webp",Dj="/assets/boots-2-BW4nGgRb.webp",UI="/assets/slippers-BdAFQiT_.webp",BI="/assets/shorts-2-B9q_6QLW.webp",Lj="/assets/hat-2-D-dEXGMW.webp",zI="/assets/redbag-2-CDZ02zDV.webp",qI="/assets/heartbag-2-bgdc0z6G.webp",ry=({className:e=""})=>s.jsxs("div",{className:`flex items-center justify-center gap-3 flex-wrap ${e}`,children:[s.jsx("a",{href:"https://apps.apple.com/app/c24-club/id6766305883",target:"_blank",rel:"noopener noreferrer","aria-label":"Download C24 Club on the App Store",className:"transition-transform hover:scale-105",children:s.jsx("img",{src:FI.url,alt:"Download on the App Store",className:"h-16 md:h-20 w-44 md:w-52 object-contain"})}),s.jsx("a",{href:"https://play.google.com/store/apps/details?id=com.c24club.app",target:"_blank",rel:"noopener noreferrer","aria-label":"Get C24 Club on Google Play",className:"transition-transform hover:scale-105",children:s.jsx("img",{src:PI.url,alt:"Get it on Google Play",className:"h-16 md:h-20 w-44 md:w-52 object-contain"})})]}),VI=[{label:"Bucket Hat",minutes:80,image:Lj},{label:"Bag",minutes:150,image:Oj},{label:"Boots",minutes:200,image:Dj},{label:"Shorts",minutes:100,image:BI},{label:"Heart Bag",minutes:95,image:qI},{label:"Phone Cases",minutes:90,image:Ij},{label:"Red Bag",minutes:120,image:zI},{label:"Slippers",minutes:75,image:UI},{label:"Designer Bag",minutes:130,image:Aj},{label:"Reward Item",minutes:110,image:Rj}],wf=({children:e,speed:t=.35})=>{const n=h.useRef(null);return h.useEffect(()=>{const r=n.current;if(!r)return;let a=0,i;const o=()=>{const d=r.scrollWidth/2;d>0&&(a+=t,a>=0&&(a-=d),r.style.transform=`translateX(${a}px)`),i=requestAnimationFrame(o)},c=setTimeout(()=>{const d=r.scrollWidth/2;d>0&&(a=-d,r.style.transform=`translateX(${a}px)`),i=requestAnimationFrame(o)},100);return()=>{clearTimeout(c),cancelAnimationFrame(i)}},[t]),s.jsx("div",{className:"w-full overflow-hidden",children:s.jsxs("div",{ref:n,className:"flex w-max will-change-transform",children:[e,e]})})},sy=({person:e,signedIn:t})=>{const n=`/discover?dm=${e.id}`,r=t?n:`/?returnTo=${encodeURIComponent(n)}`;return s.jsx("div",{className:"flex-shrink-0 mx-[2px] w-32 sm:w-40",children:s.jsxs("div",{className:"relative w-full aspect-[3/4] rounded-lg overflow-hidden border border-white/10 bg-white/5 group",children:[e.image?s.jsx("img",{src:e.image,alt:e.name||"Member",className:"w-full h-full object-cover",loading:"lazy"}):s.jsx("div",{className:"w-full h-full flex items-center justify-center text-white/30",children:s.jsx(Ur,{className:"h-10 w-10"})}),s.jsxs("div",{className:"absolute inset-x-0 bottom-0 bg-gradient-to-t from-black/90 via-black/45 to-transparent p-1.5 pt-8",children:[s.jsx("p",{className:"text-white font-bold text-xs truncate",children:e.name||"Member"}),s.jsxs(za,{to:r,className:"mt-1 flex items-center justify-center gap-1 w-full py-1 rounded-md bg-pink-500 group-hover:bg-pink-400 text-white text-[10px] font-black uppercase tracking-wide transition-colors",children:[s.jsx(An,{className:"h-3 w-3"}),"Chat Now"]})]})]})})},_f=({label:e,color:t})=>s.jsx("span",{className:`absolute top-1.5 left-2 z-20 rounded-full bg-black/70 border px-2 py-0.5 text-[9px] font-black uppercase tracking-wider backdrop-blur ${t}`,children:e}),WI=()=>{const{user:e}=it(),[t,n]=h.useState([]),[r,a]=h.useState([]),i=!!e;return h.useEffect(()=>{(async()=>{const{data:l}=await S.from("members").select("id, name, gender, image_url, image_thumb_url").eq("is_discoverable",!0).eq("image_status","approved").not("image_url","is",null).order("last_active_at",{ascending:!1}).limit(60);if(!l)return;const c=[],d=[];for(const u of l){const f={id:u.id,name:u.name,image:u.image_thumb_url||u.image_url};(u.gender||"").toLowerCase()==="female"?c.push(f):(u.gender||"").toLowerCase()==="male"&&d.push(f)}n(c.slice(0,15)),a(d.slice(0,15))})()},[]),s.jsxs("div",{className:"relative max-w-6xl mx-auto",children:[s.jsx("div",{className:"absolute -inset-2 sm:-inset-3 rounded-[2rem] bg-gradient-to-r from-pink-500/25 via-yellow-400/15 to-pink-500/25 blur-xl pointer-events-none"}),s.jsxs("div",{className:"relative rounded-2xl border border-white/15 bg-[#0d0b14]/90 p-1 shadow-2xl overflow-hidden",children:[s.jsxs("div",{className:"absolute top-2.5 right-2.5 z-30 flex items-center gap-1.5 rounded-full bg-black/75 border border-green-400/40 px-2.5 py-1 backdrop-blur",children:[s.jsxs("span",{className:"relative flex h-2 w-2",children:[s.jsx("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-green-400 opacity-60"}),s.jsx("span",{className:"relative inline-flex h-2 w-2 rounded-full bg-green-400"})]}),s.jsx("span",{className:"text-[9px] sm:text-[10px] font-black uppercase tracking-widest text-green-300",children:"Online Now"})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsxs("div",{className:"relative",children:[s.jsx(_f,{label:"🎁 Rewards",color:"border-yellow-400/40 text-yellow-300"}),s.jsx(wf,{speed:.3,children:VI.map((o,l)=>s.jsx("div",{className:"flex-shrink-0 mx-[2px]",children:s.jsxs("div",{className:"relative w-28 h-28 sm:w-36 sm:h-36 rounded-lg overflow-hidden border border-white/10",children:[s.jsx("img",{src:o.image,alt:o.label,className:"w-full h-full object-cover",loading:"lazy"}),s.jsxs("span",{className:"absolute bottom-1 right-1 rounded-full bg-black/75 border border-yellow-400/40 text-yellow-300 text-[9px] font-black px-1.5 py-0.5",children:[o.minutes," MIN"]})]})},`rw-${l}`))})]}),t.length>0&&s.jsxs("div",{className:"relative",children:[s.jsx(_f,{label:"💗 Girls",color:"border-pink-400/40 text-pink-300"}),s.jsx(wf,{speed:.25,children:t.map(o=>s.jsx(sy,{person:o,signedIn:i},o.id))})]}),r.length>0&&s.jsxs("div",{className:"relative",children:[s.jsx(_f,{label:"💬 Guys",color:"border-blue-400/40 text-blue-300"}),s.jsx(wf,{speed:.22,children:r.map(o=>s.jsx(sy,{person:o,signedIn:i},o.id))})]})]}),s.jsx("div",{className:"pointer-events-none absolute inset-y-0 left-0 w-10 sm:w-16 z-10 bg-gradient-to-r from-[#0d0b14]/95 to-transparent"}),s.jsx("div",{className:"pointer-events-none absolute inset-y-0 right-0 w-10 sm:w-16 z-10 bg-gradient-to-l from-[#0d0b14]/95 to-transparent"})]})]})},HI=({open:e,onClose:t,defaultSignUp:n=!1})=>{const[r,a]=h.useState(""),[i,o]=h.useState(""),[l,c]=h.useState(n),[d,u]=
471h.useState(!1),[f,m]=h.useState(null);if(h.useEffect(()=>{c(n),m(null)},[n,e]),!e)return null;const p=async()=>{const{error:g}=await xI.auth.signInWithOAuth("google",{redirect_uri:window.location.origin+window.location.search});g&&B.error("Sign in failed",{description:String(g)})},v=async()=>{if(!r.trim()||!i){B.error("Please enter email and password");return}if(u(!0),l){let g=!1;const y=S.auth.signUp({email:r.trim(),password:i}),b=await new Promise(_=>{const{data:j}=S.auth.onAuthStateChange((N,k)=>{N==="SIGNED_IN"&&k&&!g&&(g=!0,j.subscription.unsubscribe(),_({session:k,error:null}))});y.then(({data:N,error:k})=>{g||(g=!0,j.subscription.unsubscribe(),_({session:(N==null?void 0:N.session)??null,error:k??null}))}).catch(N=>{g||(g=!0,j.subscription.unsubscribe(),_({session:null,error:N}))}),setTimeout(()=>{g||(g=!0,j.subscription.unsubscribe(),_({session:null,error:null}))},8e3)}),{session:x,error:w}=b;if(w)B.error("Sign up failed",{description:w.message});else{if(!x){const{error:N}=await S.auth.signInWithPassword({email:r.trim(),password:i});if(N){B.error("Sign in failed",{description:N.message}),u(!1),t();return}}const _=new URLSearchParams(window.location.search).get("ref");_&&S.functions.invoke("referral",{body:{action:"track_signup",referral_code:_}}).catch(()=>{});const j=new URLSearchParams(window.location.search).get("bestie");j&&S.functions.invoke("bestie-call",{body:{action:"accept_invite",invite_code:j}}).catch(N=>console.error("Bestie accept failed:",N)),B.success("Account created!"),t()}}else{const{error:g}=await S.auth.signInWithPassword({email:r.trim(),password:i});g?B.error("Sign in failed",{description:g.message}):t()}u(!1)};return s.jsx("div",{className:"fixed inset-0 z-[100] flex items-center justify-center bg-black/70 backdrop-blur-sm",onClick:t,children:s.jsxs("div",{className:"relative bg-[#2a2a2a] rounded-2xl p-8 w-full max-w-sm mx-4 shadow-2xl border border-white/10",onClick:g=>g.stopPropagation(),children:[s.jsx("button",{onClick:t,className:"absolute top-3 right-3 text-white/60 hover:text-white",children:s.jsx(We,{className:"h-5 w-5"})}),s.jsx("h2",{className:"text-xl font-black text-white text-center mb-2 uppercase",children:l?"Sign Up for C24 Club":"Sign In to C24 Club"}),s.jsx("p",{className:"text-sm text-white/60 text-center mb-6",children:l?"Create your account to get started":"Choose how you'd like to sign in"}),s.jsxs("div",{className:"flex flex-col gap-3",children:[s.jsxs("button",{onClick:p,className:"flex items-center justify-center gap-3 w-full px-6 py-3.5 rounded-xl bg-white hover:bg-gray-100 text-gray-800 font-bold text-base shadow-lg transition-all hover:scale-[1.02]",children:[s.jsxs("svg",{className:"h-5 w-5",viewBox:"0 0 24 24",children:[s.jsx("path",{d:"M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92a5.06 5.06 0 0 1-2.2 3.32v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.1z",fill:"#4285F4"}),s.jsx("path",{d:"M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z",fill:"#34A853"}),s.jsx("path",{d:"M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z",fill:"#FBBC05"}),s.jsx("path",{d:"M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z",fill:"#EA4335"})]}),"Sign in with Google"]}),s.jsxs("div",{className:"flex items-center gap-3 my-1",children:[s.jsx("div",{className:"flex-1 h-px bg-white/20"}),s.jsx("span",{className:"text-xs text-white/40 uppercase font-bold",children:"or"}),s.jsx("div",{className:"flex-1 h-px bg-white/20"})]}),s.jsx("input",{type:"email",value:r,onChange:g=>a(g.target.value),placeholder:"Email",className:"w-full px-4 py-3 rounded-xl bg-white/10 border border-white/20 text-white placeholder-white/40 focus:outline-none focus:border-yellow-400 transition-colors text-sm"}),s.jsx("input",{type:"password",value:i,onChange:g=>o(g.target.value),placeholder:"Password",className:"w-full px-4 py-3 rounded-xl bg-white/10 border border-white/20 text-white placeholder-white/40 focus:outline-none focus:border-yellow-400 transition-colors text-sm"}),s.jsx("button",{onClick:v,disabled:d,className:"w-full px-6 py-3.5 rounded-xl bg-yellow-500 hover:bg-yellow-400 text-black font-bold text-base shadow-lg transition-all hover:scale-[1.02] disabled:opacity-50",children:d?"...":l?"Create Account":"Sign In with Email"}),s.jsx("button",{onClick:()=>c(!l),className:"text-xs text-white/50 hover:text-white/80 transition-colors text-center",children:l?"Already have an account? Sign In":"Don't have an account? Sign Up"})]})]})})},GI=({open:e,onComplete:t})=>{const[n,r]=h.useState(""),[a,i]=h.useState(""),[o,l]=h.useState(""),[c,d]=h.useState(!1),{user:u}=it();if(!e)return null;const f=async()=>
471{if(!n.trim()||!a){B.error("Please enter your name and select a gender");return}if(!u)return;d(!0);const{error:m}=await S.from("members").upsert({id:u.id,email:u.email??null,name:n.trim(),gender:a,found_us_via:o||null,updated_at:new Date().toISOString()},{onConflict:"id"});if(d(!1),m){B.error("Failed to save profile",{description:m.message});return}B.success("Welcome to C24 Club!"),t()};return s.jsx("div",{className:"fixed inset-0 z-[100] flex items-center justify-center bg-black/70 backdrop-blur-sm",children:s.jsxs("div",{className:"relative bg-[#2a2a2a] rounded-2xl p-8 w-full max-w-sm mx-4 shadow-2xl border border-white/10",children:[s.jsx("h2",{className:"text-xl font-black text-white text-center mb-2 uppercase",children:"Set Up Your Profile"}),s.jsx("p",{className:"text-sm text-white/60 text-center mb-6",children:"Tell us a bit about yourself"}),s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{children:[s.jsx("label",{className:"block text-sm font-bold text-white/80 mb-1",children:"Your Name"}),s.jsx("input",{type:"text",value:n,onChange:m=>r(m.target.value),placeholder:"Enter your name",className:"w-full px-4 py-3 rounded-xl bg-white/10 border border-white/20 text-white placeholder-white/40 focus:outline-none focus:border-yellow-400 transition-colors"})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-sm font-bold text-white/80 mb-2",children:"Gender"}),s.jsx("div",{className:"flex gap-3",children:["Male","Female","Other"].map(m=>s.jsx("button",{onClick:()=>i(m.toLowerCase()),className:`flex-1 py-3 rounded-xl font-bold text-sm transition-all border ${a===m.toLowerCase()?"bg-yellow-400 text-black border-yellow-400":"bg-white/10 text-white/70 border-white/20 hover:border-white/40"}`,children:m},m))})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-sm font-bold text-white/80 mb-2",children:"How did you find us?"}),s.jsx("div",{className:"flex flex-wrap gap-2",children:["Google","TikTok","Lemon8","Reddit","Other"].map(m=>s.jsx("button",{onClick:()=>l(m.toLowerCase()),className:`px-4 py-2.5 rounded-xl font-bold text-sm transition-all border ${o===m.toLowerCase()?"bg-yellow-400 text-black border-yellow-400":"bg-white/10 text-white/70 border-white/20 hover:border-white/40"}`,children:m},m))})]}),s.jsxs("div",{className:"border border-red-500/30 bg-red-950/30 rounded-xl px-4 py-3 text-center space-y-1",children:[s.jsx("p",{className:"text-red-400 font-black text-xs tracking-wide",children:"🔞 18+ ONLY"}),s.jsxs("p",{className:"text-white/50 text-[11px] leading-snug",children:["You must be ",s.jsx("span",{className:"text-white/80 font-bold",children:"18+"})," to use this platform. Inappropriate behavior & explicit content are ",s.jsx("span",{className:"text-red-400 font-bold",children:"strictly prohibited"}),"."," ",s.jsx("a",{href:"/rules",target:"_blank",className:"text-orange-400 font-bold hover:underline",children:"Read Rules"})]})]}),s.jsx("button",{onClick:f,disabled:c,className:"w-full mt-2 py-3.5 rounded-xl bg-gradient-to-r from-red-500 to-red-600 hover:from-red-600 hover:to-red-700 text-white font-black text-base uppercase tracking-wide shadow-lg transition-all hover:scale-[1.02] flex items-center justify-center gap-2",children:c?"Saving...":s.jsxs(s.Fragment,{children:["Enter C24 Club",s.jsx("img",{src:bp,alt:"",className:"h-4 w-4 object-cover",width:"16",height:"16"})]})})]})]})})},ay=({variant:e})=>{const{user:t,signOut:n}=it(),r=sn(),[a]=I0(),[i,o]=h.useState(!1),[l,c]=h.useState(!1),[d,u]=h.useState(!1),[f,m]=h.useState(null),[p,v]=h.useState(!1),g=h.useRef(!1);h.useEffect(()=>{a.get("returnTo")&&!t&&!g.current&&(c(!1),o(!0))},[a,t]),h.useEffect(()=>{if(!t){m(null),v(!1),g.current=!1;return}const x=a.get("returnTo");if(x&&!g.current){g.current=!0,(async()=>{const{data:j}=await S.from("members").select("name, gender").eq("id",t.id).maybeSingle();if(j&&!(j.name&&j.name!==t.email&&j.gender)){m(null),v(!0),u(!0);return}r(x,{replace:!0})})();return}const w=async(_=3)=>{const{data:j}=await S.from("members").select("name, gender").eq("id",t.id).maybeSingle();if(j){const N=j.name&&j.name!==t.email&&j.gender;m(N?j.name:null),v(!N),N||u(!0)}else _>0?setTimeout(()=>w(_-1),600):(m(null),v(!0),u(!0))};w()},[t,a,r]);const y=()=>{p?u(!0):r("/videocall")},b=()=>{u(!1),v(!1);const x=a.get("returnTo");r(x||"/videocall",{replace:!0})};return s.jsxs(s.Fragment,{children:[s.jsx(HI,{open:i,onClose:()=>o(!1),defaultSignUp:l}),s.jsx(GI,{open:d,onComplete:b}),s.jsx("div",{className:"flex flex-col items-center gap-3",children:t?s.jsxs(s.Fragment,{children:[f&&s.jsxs("p",{className:"text-lg font-bold text-white italic",children:["Welcome, ",f]}),s.jsx("button",{onClick:y,className:"group relative px-10 py-4 rounded-full bg-gradient-to-r from-red-500 to-red-600 hover:from-red-600 hover:to-red-700 text-white font-black text-lg uppercase tracking-wide shadow-xl hover:shadow-2xl transition-all transform hover:scale-105",children:s.jsxs("span",{className:"flex items-center gap-2",children:["Enter C24 Club",s.jsx("img",{src:bp,alt:"",className:"h-5 w-5 object-cover group-hover:translate-x-1 transition-transform",width:"20",height:"20"})]})}),s.jsx("button",{onClick:n,className:"px-8 py-3 rounded-full bg-green-500 hover:bg-green-600 text-white font-black text-sm uppercase tracking-wide shadow-lg transition-all transform hover:scale-105",children:"Sign Out"})]}):s.jsxs(s.Fragment,{children:[s.jsxs("button",{onClick:()=>{c(!0),o(!0)},className:"group relative px-10 py-4 rounded-full bg-gradient-to-r from-red-500 to-red-600 hover:from-red-600 hover:to-red-700 text-white font-black text-lg uppercase tracking-wide shadow-xl hover:shadow-2xl transition-all transform hover:scale-105",children:[s.jsxs("span",{className:"flex items-center gap-2",children:["Get Rewards Now",s.jsx("img",{src:bp,alt:"",className:"h-5 w-5 object-cover group-hover:translate-x-1 transition-transform",width:"20",height:"20"})]}),s.jsx("span",{className:"block text-sm font-bold text-yellow-300 mt-0.5",children:"Sign Up Today"})]}),s.jsx("button",{onClick:()=>{c(!1),o(!0)},className:"px-8 py-3 rounded-full bg-green-500 hover:bg-green-600 text-white font-black text-sm uppercase tracking-wide shadow-lg transition-all transform hover:scale-105",children:"Sign In"})]})})]})},KI=()=>s.jsxs("div",{className:"relative",children:[s.jsx("script",{type:"application/ld+json",dangerouslySetInnerHTML:{__html:JSON.stringify({"@context":"https://schema.org","@type":"WebApplication",name:"C24 Club",url:"https://c24club.com",description:"C24 Club is a free Omegle alternative where you video chat 1-on-1 with strangers and collect real rewards like gift cards and designer items.",applicationCategory:"SocialNetworkingApplication",operatingSystem:"Web",offers:{"@type":"Offer",price:"0",priceCurrency:"USD"},aggregateRating:{"@type":"AggregateRating",ratingValue:"4.7",ratingCount:"2400"},sameAs:["https://c24club.lovable.app"]})}}),s.jsx(bI,{}),s.jsxs("section",{className:"pt-24 pb-12 px-4",children:[s.jsxs("div",{className:"text-center mb-8",children:[s.jsxs("h1",{className:"text-4xl md:text-6xl lg:text-7xl font-black uppercase leading-tight tracking-tight",style:{fontFamily:"'Antigone', 'Poppins', sans-serif"},children:[s.jsx("span",{className:"text-white",children:"C24 CLUB"}),s.jsx("br",{}),s.jsx("span",{className:"text-white",children:"The Omegle Alternative"}),s.jsx("br",{}),s.jsx("span",{className:"text-yellow-300",children:"With "}),s.jsx("span",{className:"bg-gradient-to-r from-orange-400 to-yellow-400 bg-clip-text text-transparent",children:"Real Rewards!"})]}),s.jsxs("p",{className:"mt-4 text-lg md:text-xl font-bold text-white",children:["Video Chat Online With Strangers & ",s.jsx("span",{className:"text-green-400",children:"Unlock Rewards!"})]})]}),s.jsx(WI,{}),s.jsx("div",{className:"mt-8",children:s.jsx(ay,{})}),s.jsxs("div",{className:"mt-6",children:[s.jsx("p",{className:"text-center text-xs font-black uppercase tracking-[0.25em] text-white/60 mb-3",children:"Also available on"}),s.jsx(ry,{})]})]}),s.jsx("section",{className:"px-4 py-14 max-w-5xl mx-auto",children:s.jsxs("div",{className:"relative rounded-3xl overflow-hidden border border-white/10 bg-gradient-to-br from-[#1a1a2e] via-[#241818] to-[#1a1a2e] p-8 md:p-12",children:[s.jsx("div",{className:"absolute -top-16 -right-16 w-64 h-64 bg-orange-500/10 rounded-full blur-3xl"}),s.jsx("div",{className:"absolute -bottom-16 -left-16 w-64 h-64 bg-yellow-500/10 rounded-full blur-3xl"}),s.jsxs("div",{className:"relative text-center max-w-3xl mx-auto 
471space-y-4",children:[s.jsx("p",{className:"text-xs md:text-sm font-black uppercase tracking-[0.25em] text-orange-400",children:"Why C24 Club is different"}),s.jsxs("h2",{className:"text-2xl md:text-4xl font-black text-white leading-snug",style:{fontFamily:"'Antigone', 'Poppins', sans-serif"},children:["Old chat sites were ",s.jsx("span",{className:"text-red-400",children:"toxic"}),".",s.jsx("br",{}),"We built the ",s.jsx("span",{className:"bg-gradient-to-r from-yellow-400 to-orange-400 bg-clip-text text-transparent",children:"opposite"}),"."]}),s.jsxs("p",{className:"text-white/70 text-base md:text-lg leading-relaxed",children:["Random video chat used to be full of inappropriate content, quick skippers, and almost entirely men — because there was zero reason to behave. C24 Club flips that script with a ",s.jsx("span",{className:"text-yellow-300 font-bold",children:"Reward System"})," that pays you for being kind, ",s.jsx("span",{className:"text-yellow-300 font-bold",children:"verified profiles"})," so you know who's on the other side, and an actively ",s.jsx("span",{className:"text-yellow-300 font-bold",children:"balanced gender ratio"}),"."]})]}),s.jsxs("div",{className:"relative grid grid-cols-1 md:grid-cols-3 gap-4 mt-10",children:[s.jsxs("div",{className:"rounded-2xl bg-white/5 border border-white/10 p-5 text-center",children:[s.jsx("div",{className:"w-12 h-12 mx-auto mb-3 rounded-xl bg-yellow-500/15 flex items-center justify-center",children:s.jsx(Ft,{className:"w-6 h-6 text-yellow-400"})}),s.jsx("h3",{className:"text-white font-black uppercase text-sm tracking-wide mb-1",children:"Good Behavior Pays"}),s.jsx("p",{className:"text-white/60 text-sm",children:"Earn reward minutes for every real conversation. Trolls get nothing — and get banned."})]}),s.jsxs("div",{className:"rounded-2xl bg-white/5 border border-white/10 p-5 text-center",children:[s.jsx("div",{className:"w-12 h-12 mx-auto mb-3 rounded-xl bg-orange-500/15 flex items-center justify-center",children:s.jsx(Ql,{className:"w-6 h-6 text-orange-400"})}),s.jsx("h3",{className:"text-white font-black uppercase text-sm tracking-wide mb-1",children:"Verified Profiles"}),s.jsx("p",{className:"text-white/60 text-sm",children:"Every member uploads a selfie that's reviewed by our team. No bots, no fake photos."})]}),s.jsxs("div",{className:"rounded-2xl bg-white/5 border border-white/10 p-5 text-center",children:[s.jsx("div",{className:"w-12 h-12 mx-auto mb-3 rounded-xl bg-pink-500/15 flex items-center justify-center",children:s.jsx(Ur,{className:"w-6 h-6 text-pink-400"})}),s.jsx("h3",{className:"text-white font-black uppercase text-sm tracking-wide mb-1",children:"Real People, Real Vibes"}),s.jsx("p",{className:"text-white/60 text-sm",children:"Live moderation and instant reporting keep the community safe and fun for everyone."})]})]})]})}),s.jsxs("section",{className:"px-4 py-16 max-w-5xl mx-auto space-y-16",children:[s.jsxs("div",{className:"text-center space-y-3",children:[s.jsx("p",{className:"text-sm font-black uppercase tracking-[0.25em] text-orange-400",children:"More than just video chat"}),s.jsxs("h4",{className:"text-2xl md:text-3xl font-black text-white leading-snug",style:{fontFamily:"'Antigone', 'Poppins', sans-serif"},children:["On C24Club, every chat ",s.jsx("span",{className:"bg-gradient-to-r from-yellow-400 to-orange-400 bg-clip-text text-transparent",children:"unlocks rewards"}),s.jsx("br",{}),"including perks & ",s.jsx("span",{className:"text-yellow-300",children:"real prizes."})]}),s.jsxs("div",{className:"flex items-center justify-center gap-2 pt-1",children:[s.jsx("span",{className:"w-8 h-px bg-gradient-to-r from-transparent to-orange-500"}),s.jsx("span",{className:"text-orange-400 text-xs font-bold tracking-widest uppercase",children:"Here's how it works"}),s.jsx("span",{className:"w-8 h-px bg-gradient-to-l from-transparent to-orange-500"})]})]}),s.jsxs("div",{className:"relative group",children:[s.jsx("div",{className:"absolute -inset-1 bg-gradient-to-r from-yellow-500 via-orange-500 to-red-500 rounded-3xl blur-lg opacity-40 group-hover:opacity-70 transition-opacity duration-500"}),s.jsxs("div",{className:"relative bg-[#1a1a2e] rounded-3xl p-8 md:p-10 border border-white/10 overflow-hidden",children:[s.jsx("div",{className:"absolute top-0 right-0 w-40 h-40 bg-orange-500/10 rounded-full blur-3xl"}),s.jsx("div",{className:"absolute bottom-0 left-0 w-32 h-32 bg-yellow-500/10 rounded-full blur-3xl"}),s.jsxs("div",{className:"flex flex-col md:flex-row items-center gap-8",children:[s.jsxs("div",{className:"flex-1 space-y-4",children:[s.jsx("div",{className:"inline-flex items-center gap-2 px-4 py-1.5 rounded-full bg-orange-500/20 border border-orange-500/30",children:s.jsx("span",{className:"text-orange-400 font-black text-sm",children:"STEP 1"})}),s.jsxs("h3",{className:"text-2xl md:text-3xl font-black text-white leading-tight",style:{fontFamily:"'Antigone', 'Poppins', sans-serif"},children:["Video Chat With Anyone & ",s.jsx("span",{className:"text-yellow-400",children:"Collect Minutes!"})]}),s.jsx("p",{className:"text-white/60 text-base leading-relaxed",children:"Jump into random video chats with people worldwide. Every minute you talk, you collect reward minutes. Have fun, meet new people, stack minutes."}),s.jsxs("div",{className:"flex flex-wrap gap-3 pt-2",children:[s.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 rounded-xl bg-white/5 border border-white/10",children:[s.jsx(er,{className:"h-4 w-4 text-orange-400"}),s.jsx("span",{className:"text-white/80 text-sm font-medium",children:"1 min chatting = 1 min collected"})]}),s.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 rounded-xl bg-white/5 border border-white/10",children:[s.jsx(Ur,{className:"h-4 w-4 text-orange-400"}),s.jsx("span",{className:"text-white/80 text-sm font-medium",children:"Random matching"})]})]})]}),s.jsxs("div",{className:"relative w-56 h-56 md:w-64 md:h-64 flex-shrink-0",children:[s.jsx("div",{className:"absolute inset-0 rounded-2xl bg-gradient-to-br from-orange-500/20 to-yellow-600/20 border border-orange-500/20 flex items-center justify-center",children:s.jsxs("div",{className:"relative",children:[s.jsx("div",{className:"w-24 h-24 rounded-full bg-gradient-to-br from-orange-400 to-red-500 flex items-center justify-center shadow-lg shadow-orange-500/30 animate-pulse",children:s.jsx(mr,{className:"h-10 w-10 text-white"})}),s.jsx("div",{className:"absolute -top-3 -right-6 animate-bounce",style:{animationDelay:"0s"},children:s.jsx("div",{className:"w-10 h-10 rounded-full bg-yellow-500/90 flex items-center justify-center shadow-lg",children:s.jsx(nh,{className:"h-5 w-5 text-white"})})}),s.jsx("div",{className:"absolute -bottom-4 -left-5 animate-bounce",style:{animationDelay:"0.5s"},children:s.jsx("div",{className:"w-10 h-10 rounded-full bg-orange-500/90 flex items-center justify-center shadow-lg",children:s.jsx(er,{className:"h-5 w-5 text-white"})})}),s.jsx("div",{className:"absolute top-1/2 -right-10 animate-bounce",style:{animationDelay:"1s"},children:s.jsx("div",{className:"w-8 h-8 rounded-full bg-red-500/90 flex items-center justify-center shadow-lg",children:s.jsx(Ql,{className:"h-4 w-4 text-white"})})})]})}),s.jsx("div",{className:"absolute -bottom-3 left-1/2 -translate-x-1/2 px-5 py-2 rounded-full bg-gradient-to-r from-orange-500 to-yellow-500 shadow-lg shadow-orange-500/30",children:s.jsx("span",{className:"text-white font-black text-sm tracking-wide",children:"+1 MIN ⏱️"})})]})]})]})]}),s.jsxs("div",{className:"relative group",children:[s.jsx("div",{className:"absolute -inset-1 bg-gradient-to-r from-yellow-500 via-orange-500 to-pink-500 rounded-3xl blur-lg opacity-40 group-hover:opacity-70 transition-opacity duration-500"}),s.jsxs("div",{className:"relative bg-[#1a1a2e] rounded-3xl p-8 md:p-10 border border-white/10 overflow-hidden",children:[s.jsx("div",{className:"absolute top-0 left-0 w-40 h-40 bg-yellow-500/10 rounded-full blur-3xl"}),s.jsx("div",{className:"absolute bottom-0 right-0 w-32 h-32 bg-pink-500/10 rounded-full blur-3xl"}),s.jsxs("div",{className:"flex flex-col md:flex-row-reverse items-center gap-8",children:[s.jsxs("div",{className:"flex-1 space-y-4",children:[s.jsx("div",{className:"inline-flex items-center gap-2 px-4 py-1.5 rounded-full bg-yellow-500/20 border border-yellow-500/30",children:s.jsx("span",{className:"text-yellow-400 font-black text-sm",children:"STEP 2"})}),s.jsxs("h3",{className:"text-2xl md:text-3xl font-black text-white leading-tight",style:{fontFamily:"'Antigone', 'Poppins', sans-serif"},children:["Redeem Minutes For ",s.jsx("span",{className:"text-yellow-400",children:"Prizes & Rewards!"})]}),s.jsx("p",{className:"text-white/60 text-base leading-relaxed",children:"Head to the Reward Store and redeem your minutes for gift cards, designer bags, clothing, tech accessories, and way more."}),s.jsxs("div",{className:"flex flex-wrap gap-3 pt-2",children:[s.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 rounded-xl bg-white/5 border border-white/10",children:[s.jsx(Ft,{className:"h-4 w-4 text-yellow-400"}),s.jsx("span",{className:"text-white/80 text-sm font-medium",children:"Gift cards & more"})]}),s.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 rounded-xl bg-white/5 border border-white/10",children:[s.jsx(Ft,{className:"h-4 w-4 text-yellow-400"}),s.jsx("span",{className:"text-white/80 text-sm font-medium",children:"100+ rewards"})]})]})]}),s.jsxs("div",{className:"relative w-56 h-56 md:w-64 md:h-64 flex-shrink-0",children:[s.jsx("div",{className:"grid grid-cols-3 gap-2 h-full",children:[{label:"Luxury shoulder bag reward",image:Aj},{label:"Designer bag reward",image:Oj},{label:"Designer boots reward",image:Dj},{label:"Streetwear reward item",image:Rj},{label:"Bucket hat reward",image:Lj},{label:"Designer phone case reward",image:Ij}].map((e,t)=>s.jsx("div",{className:"rounded-xl overflow-hidden border border-white/10 shadow-lg hover:scale-110 transition-transform duration-300 hover:border-yellow-400/50",style:{animationDelay:`${t*.1}s`},children:s.jsx("img",{src:e.image,alt:e.label,className:"w-full h-full object-cover",width:"100",height:"100"})},t))}),s.jsx("div",{className:"absolute -bottom-3 left-1/2 -translate-x-1/2 px-5 py-2 rounded-full bg-gradient-to-r from-yellow-500 to-orange-500 shadow-lg shadow-yellow-500/30",children:s.jsx("span",{className:"text-white font-black text-sm tracking-wide",children:"REDEEM 🎁"})})]})]})]})]}),s.jsxs("div",{className:"relative group",children:[s.jsx("div",{className:"absolute -inset-1 bg-gradient-to-r from-red-500 via-orange-500 to-yellow-500 rounded-3xl blur-lg opacity-40 group-hover:opacity-70 transition-opacity duration-500"}),s.jsxs("div",{className:"relative bg-[#1a1a2e] rounded-3xl p-8 md:p-10 border border-white/10 overflow-hidden",children:[s.jsx("div",{className:"absolute top-0 right-0 w-40 h-40 bg-red-500/10 rounded-full blur-3xl"}),s.jsx("div",{className:"absolute bottom-0 left-0 w-32 h-32 bg-orange-500/10 rounded-full blur-3xl"}),s.jsxs("div",{className:"flex flex-col md:flex-row items-center gap-8",children:[s.jsxs("div",{className:"flex-1 space-y-4",children:[s.jsx("div",{className:"inline-flex items-center gap-2 px-4 py-1.5 rounded-full bg-red-500/20 border border-red-500/30",children:s.jsx("span",{className:"text-red-400 font-black text-sm",children:"STEP 3"})}),s.jsxs("h3",{className:"text-2xl md:text-3xl font-black text-white leading-tight",style:{fontFamily:"'Antigone', 'Poppins', sans-serif"},children:["Get Discovered ",s.jsx("span",{className:"text-orange-400",children:"Beyond Random Matching!"})]}),s.jsx("p",{className:"text-white/60 text-base leading-relaxed",children:"Add your selfie to Discover and let people find you directly. Fans can DM you, send call invites, and reconnect anytime through Linked profiles — you don't have to wait for random matching to meet someone."}),s.jsxs("div",{className:"flex flex-wrap gap-3 pt-2",children:[s.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 rounded-xl bg-white/5 border border-white/10",children:[s.jsx(yr,{className:"h-4 w-4 text-orange-400"}),s.jsx("span",{className:"text-white/80 text-sm font-medium",children:"Profile discovery"})]}),s.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 rounded-xl bg-white/5 border border-white/10",children:[s.jsx(An,{className:"h-4 w-4 text-orange-400"}),s.jsx("span",{className:"text-white/80 text-sm font-medium",children:"Direct DMs & call invites"})]})]})]}),s.jsxs("div",{className:"relative w-56 h-56 md:w-64 md:h-64 flex-shrink-0",children:[s.jsx("div",{className:"absolute inset-0 rounded-2xl bg-gradient-to-br from-red-500/20 to-orange-600/20 border border-red-500/20 flex items-center justify-center",children:s.jsxs("div",{className:"relative w-40",children:[s.jsxs("div",{className:"rounded-2xl overflow-hidden border border-orange-500/20 shadow-xl shadow-orange-500/10 bg-[#252535] transform -rotate-2 hover:rotate-0 transition-transform duration-500",children:[s.jsx("div",{className:"h-24 bg-gradient-to-br from-orange-400/30 via-red-400/30 to-pink-400/30 flex items-center justify-center",children:s.jsx(k_,{className:"h-9 w-9 text-orange-300"})}),s.jsxs("div",{className:"p-3 space-y-2",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("div",{className:"h-2.5 w-1/2 bg-white/25 rounded-full"}),s.jsxs("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded-full bg-green-500/20 border border-green-500/30",children:[s.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-green-400 animate-pulse"}),s.jsx("span",{className:"text-[8px] text-green-300 font-bold",children:"Online"})]})]}),s.jsx("div",{className:"h-2 w-2/3 bg-white/10 rounded-full"}),s.jsxs("div",{className:"flex gap-1.5 pt-1",children:[s.jsx("div",{className:"flex-1 h-6 rounded-md bg-pink-500/70 flex items-center justify-center",children:s.jsx("span",{className:"text-[10px] text-white font-bold",children:"DM 💬"})}),s.jsx("div",{className:"flex-1 h-6 rounded-md bg-orange-500/60 flex items-center justify-center",children:s.jsx("span",{className:"text-[10px] text-white font-bold",children:"Call 📞"})})]})]})]}),s.jsx("div",{className:"absolute -top-4 -right-4 animate-bounce",style:{animationDelay:"0.3s"},children:s.jsx("div",{className:"px-2 py-1 rounded-full bg-pink-500/90 shadow-lg",children:s.jsx("span",{className:"text-[10px] text-white font-bold",children:"💬 New DM"})})}),s.jsx("div",{className:"absolute -bottom-3 -left-3 animate-bounce",style:{animationDelay:"0.8s"},children:s.jsx("div",{className:"px-2 py-1 rounded-full bg-orange-500/90 shadow-lg",children:s.jsx("span",{className:"text-[10px] text-white font-bold",children:"🔗 Linked"})})})]})}),s.jsx("div",{className:"absolute -bottom-3 left-1/2 -translate-x-1/2 px-5 py-2 rounded-full bg-gradient-to-r from-red-500 to-orange-500 shadow-lg shadow-red-500/30",children:s.jsx("span",{className:"text-white font-black text-sm tracking-wide",children:"GET SEEN ✨"})})]})]})]})]}),s.jsx("div",{className:"pt-8",children:s.jsx(ay,{variant:"bottom"})}),s.jsx("div",{className:"pt-6",children:s.jsx(ry,{})})]}),s.jsx("section",{className:"px-4 py-12 max-w-4xl mx-auto",children:s.jsxs("div",{className:"relative rounded-2xl border border-orange-500/20 bg-gradient-to-br from-orange-500/5 to-yellow-500/5 p-8 text-center overflow-hidden",children:[s.jsx("div",{className:"absolute top-0 right-0 w-40 h-40 bg-orange-500/10 rounded-full blur-3xl"}),s.jsx("p",{className:"text-sm font-black uppercase tracking-[0.25em] text-orange-400 mb-2",children:"Looking for Omegle alternatives?"}),s.jsxs("h2",{className:"text-2xl md:text-3xl font-black text-white mb-3",style:{fontFamily:"'Antigone', 'Poppins', sans-serif"},children:["See How C24 Club Compares To ",s.jsx("span",{className:"text-yellow-400",children:"Other Platforms"})]}),s.jsx("p",{className:"text-white/50 text-sm mb-6 max-w-lg mx-auto",children:"We ranked the top 5 Omegle alternatives. Spoiler: C24 Club is #1 because we're the only one with a built-in rewards program."}),s.jsx(za,{to:"/top-omegle-alternatives",className:"inline-flex items-center gap-2 px-8 py-3 rounded-full bg-gradient-to-r from-orange-500 to-yellow-500 hover:from-orange-600 hover:to-yellow-600 text-white font-black text-sm uppercase tracking-wide shadow-lg transition-all hover:scale-105",children:"View Top 5 Omegl
471e Alternatives →"})]})}),s.jsx("div",{className:"max-w-3xl mx-auto px-4 mt-16 mb-8",children:s.jsxs("div",{className:"border border-red-500/30 bg-red-950/20 rounded-2xl px-6 py-5 text-center space-y-2",children:[s.jsx("p",{className:"text-red-400 font-black text-lg tracking-wide",children:"🔞 18+ ONLY"}),s.jsxs("p",{className:"text-neutral-300 text-sm leading-relaxed",children:["You must be ",s.jsx("span",{className:"text-white font-bold",children:"18 years or older"})," to use this platform. By signing up, you confirm you meet this age requirement. Inappropriate behavior, explicit content, and harassment are ",s.jsx("span",{className:"text-red-400 font-bold",children:"strictly prohibited"})," and will result in a permanent ban."]}),s.jsx("a",{href:"/rules",className:"inline-block text-orange-400 font-bold text-sm hover:underline mt-1",children:"Read our Community Rules →"})]})}),s.jsx(yI,{})]}),YI="https://c24club.com";function QI({title:e,description:t,path:n,ogImage:r}){h.useEffect(()=>{document.title=e;const a=(c,d)=>{let u=document.querySelector(`meta[name="${c}"]`);u||(u=document.createElement("meta"),u.setAttribute("name",c),document.head.appendChild(u)),u.setAttribute("content",d)},i=(c,d)=>{let u=document.querySelector(`meta[property="${c}"]`);u||(u=document.createElement("meta"),u.setAttribute("property",c),document.head.appendChild(u)),u.setAttribute("content",d)},o=`${YI}${n}`;a("description",t),i("og:title",e),i("og:description",t),i("og:url",o),a("twitter:title",e),a("twitter:description",t),r&&(i("og:image",r),a("twitter:image",r));let l=document.querySelector('link[rel="canonical"]');l||(l=document.createElement("link"),l.setAttribute("rel","canonical"),document.head.appendChild(l)),l.setAttribute("href",o)},[e,t,n,r])}function ex(){const e=new Date,t=e.getDay(),n=t===0?6:t-1,r=new Date(e);return r.setHours(0,0,0,0),r.setDate(r.getDate()-n),r.toISOString().slice(0,10)}function go(e){const t=`${e}__week`,n=ex(),r=localStorage.getItem(t);return r&&r===n?!1:(localStorage.removeItem(e),localStorage.setItem(t,n),!0)}function Sd(e){localStorage.setItem(`${e}__week`,ex())}const jf=768;function Mj(){const[e,t]=h.useState(void 0);return h.useEffect(()=>{const n=window.matchMedia(`(max-width: ${jf-1}px)`),r=()=>{t(window.innerWidth<jf)};return n.addEventListener("change",r),t(window.innerWidth<jf),()=>n.removeEventListener("change",r)},[]),!!e}const JI=e=>{if(!e)return;const t=()=>{const n=e.play();n&&typeof n.catch=="function"&&n.catch(()=>{})};e.addEventListener("loadedmetadata",t,{once:!0}),t()},rl=(e,t,n)=>{!e||!t||(typeof(n==null?void 0:n.muted)=="boolean"&&(e.muted=n.muted),e.srcObject!==t&&(e.srcObject=t),JI(e))},XI=(e,t=null)=>{if(e.streams[0])return e.streams[0];const n=t??new MediaStream;return n.getTracks().some(a=>a.id===e.track.id)||n.addTrack(e.track),n},ZI={iceServers:[{urls:"stun:stun.l.google.com:19302"},{urls:"stun:stun1.l.google.com:19302"}]};let xu=null,iy=0;const eO=5*60*1e3;async function tO(){var t;const e=Date.now();if(xu&&e-iy<eO)return xu;try{const{data:n,error:r}=await S.functions.invoke("get-ice-servers");if(r)throw r;if((t=n==null?void 0:n.iceServers)!=null&&t.length)return xu={iceServers:n.iceServers},iy=e,xu}catch(n){console.warn("[WebRTC] Failed to fetch TURN config, using STUN fallback:",n)}return ZI}function nO({memberId:e,genderPreference:t="Both",memberGender:n,voiceMode:r=!1}){const[a,i]=h.useState("idle"),[o,l]=h.useState(!1),[c,d]=h.useState(null),[u,f]=h.useState(null),[m,p]=h.useState(!1),[v,g]=h.useState(null),y=h.useRef(null),b=h.useRef(null),x=h.useRef(null),w=h.useRef(null),_=h.useRef(null),j=h.useRef(null),N=h.useRef(null),k=h.useRef(null),C=h.useRef(crypto.randomUUID()),A=h.useRef(null),I=h.useRef(e),O=h.useRef(t),P=h.useRef(n),T=h.useRef(r),E=h.useRef([]);h.useEffect(()=>{I.current=e},[e]),h.useEffect(()=>{O.current=t},[t]),h.useEffect(()=>{P.current=n},[n]),h.useEffect(()=>{T.current=r},[r]),h.useEffect(()=>{a==="idle"&&l(!1)},[a]),h.useEffect(()=>{rl(y.current,w.current,{muted:!0}),rl(b.current,_.current)});function W(){N.current&&(clearInterval(N.current),N.current=null)}function V(){k.current&&(clearInterval(k.current),k.current=null)}function q(){_.current=null,b.current&&(b.current.srcObject=null)}
471function D(){x.current&&(x.current.ontrack=null,x.current.onicecandidate=null,x.current.onconnectionstatechange=null,x.current.oniceconnectionstatechange=null,x.current.close(),x.current=null),E.current=[],q()}function $(){V(),j.current=null}async function z(Y,Q,le){await S.from("room_signals").insert({room_id:Y,sender_channel:C.current,signal_type:Q,payload:le})}function R(Y){V();const Q=new Set;k.current=setInterval(async()=>{const{data:le}=await S.from("room_signals").select("*").eq("room_id",Y).neq("sender_channel",C.current).order("created_at",{ascending:!0});if(le)for(const de of le){if(Q.has(de.id))continue;Q.add(de.id);const me=x.current;if(me)try{if(de.signal_type==="offer"){console.log("[WebRTC] DB: Received offer"),await me.setRemoteDescription(new RTCSessionDescription(de.payload));const Le=await me.createAnswer();await me.setLocalDescription(Le),await z(Y,"answer",Le);for(const Ke of E.current)await me.addIceCandidate(new RTCIceCandidate(Ke)).catch(Qe=>console.warn("[WebRTC] flush ICE failed:",Qe));E.current=[]}else if(de.signal_type==="answer"){if(console.log("[WebRTC] DB: Received answer"),me.signalingState==="have-local-offer"){await me.setRemoteDescription(new RTCSessionDescription(de.payload));for(const Le of E.current)await me.addIceCandidate(new RTCIceCandidate(Le)).catch(Ke=>console.warn("[WebRTC] flush ICE failed:",Ke));E.current=[]}}else de.signal_type==="ice-candidate"?!me.remoteDescription||!me.remoteDescription.type?E.current.push(de.payload):await me.addIceCandidate(new RTCIceCandidate(de.payload)).catch(Le=>console.warn("[WebRTC] addIceCandidate failed:",Le)):de.signal_type==="partner-disconnected"&&xe()}catch(Le){console.warn("[WebRTC] DB signal processing error:",Le)}}},1e3)}async function U(Y){try{await S.from("room_signals").delete().eq("room_id",Y)}catch{}}async function ee(){if(w.current)return T.current&&w.current.getVideoTracks().forEach(le=>{var de;le.stop(),(de=w.current)==null||de.removeTrack(le)}),w.current;const Y=await navigator.mediaDevices.getUserMedia({video:!T.current,audio:!0});return w.current=Y,rl(y.current,Y,{muted:!0}),Y}const ae=h.useRef(!1);async function xe(){if(ae.current)return;ae.current=!0;const Y=A.current;D(),$(),W(),Y&&U(Y),await S.functions.invoke("videocall-match",{body:{type:"disconnect",memberId:I.current}}).catch(()=>{}),A.current=null,f(null),p(!1),g(null),C.current=crypto.randomUUID(),i("waiting");try{const{data:Q,error:le}=await S.functions.invoke("videocall-match",{body:{type:"join",memberId:I.current,channelId:C.current,genderPreference:O.current,memberGender:P.current,voiceMode:T.current}});if(le)throw le;(Q==null?void 0:Q.message)==="partner_found"?(A.current=Q.roomId,f(Q.partnerId),p(Q.partnerVoiceMode??!1),g(Q.partnerGender??null),i("connecting"),await te(),await ce(Q.roomId)):(Q==null?void 0:Q.message)==="added_to_queue"&&await Re()}catch(Q){console.error("[WebRTC] Auto-reconnect failed:",Q),i("idle")}finally{ae.current=!1}}async function te(){D();const Y=await tO(),Q=new RTCPeerConnection(Y);return w.current&&w.current.getTracks().forEach(le=>{Q.addTrack(le,w.current)}),T.current&&Q.addTransceiver("video",{direction:"recvonly"}),Q.ontrack=le=>{const de=XI(le,_.current);_.current=de,rl(b.current,de)},Q.onicecandidate=le=>{if(!le.candidate)return;const de=le.candidate.toJSON(),me=A.current;me&&z(me,"ice-candidate",de).catch(()=>{})},Q.onconnectionstatechange=()=>{console.log("[WebRTC] connectionState:",Q.connectionState),Q.connectionState==="connected"&&(V(),rl(b.current,_.current),i("connected")),(Q.connectionState==="disconnected"||Q.connectionState==="failed"||Q.connectionState==="closed")&&xe()},Q.oniceconnectionstatechange=()=>{console.log("[WebRTC] iceConnectionState:",Q.iceConnectionState)},x.current=Q,Q}async function ce(Y){$(),R(Y)}async function Re(){W(),console.log("[WebRTC] Starting poll for match, memberId:",I.current),N.current=setInterval(async()=>{const Y=I.current,{data:Q,error:le}=await S.functions.invoke("videocall-match",{body:{type:"poll",memberId:Y}});if(console.log("[WebRTC] Poll result:",Q,le),le||!(Q!=null&&Q.room))return;const de=Q.room;console.log("[WebRTC] Room found via polling:",de.id),W(),A.current=de.id;
471const me=de.member1===Y?de.member2:de.member1,Le=de.member1===Y?de.member2_voice_mode:de.member1_voice_mode,Ke=de.member1===Y?de.member2_gender:de.member1_gender;f(me),p(Le??!1),g(Ke??null),i("connecting");const Qe=await te();await ce(de.id);const tt=await Qe.createOffer();await Qe.setLocalDescription(tt),console.log("[WebRTC] Sending offer from poller"),z(de.id,"offer",tt).catch(()=>{})},2e3)}async function ye(){const Y=A.current;Y&&z(Y,"partner-disconnected",{}).catch(()=>{}),D(),$(),W(),await S.functions.invoke("videocall-match",{body:{type:"disconnect",memberId:I.current}}),Y&&U(Y),A.current=null,f(null),p(!1),g(null),i("idle")}async function fe(){try{d(null),l(!0),i("waiting"),await ee(),console.log("[WebRTC] Calling videocall-match join",{memberId:I.current,channelId:C.current,genderPreference:O.current});const{data:Y,error:Q}=await S.functions.invoke("videocall-match",{body:{type:"join",memberId:I.current,channelId:C.current,genderPreference:O.current,memberGender:P.current,voiceMode:T.current}});if(console.log("[WebRTC] videocall-match response:",{data:Y,invokeError:Q}),Q)throw Q;if((Y==null?void 0:Y.message)==="partner_found"){console.log("[WebRTC] Partner found! Room:",Y.roomId),A.current=Y.roomId,f(Y.partnerId),p(Y.partnerVoiceMode??!1),g(Y.partnerGender??null),i("connecting"),await te(),await ce(Y.roomId),console.log("[WebRTC] Signaling ready, waiting for poller's offer");return}if((Y==null?void 0:Y.message)==="added_to_queue"){console.log("[WebRTC] Added to queue, starting to poll"),await Re();return}throw new Error("Unexpected matchmaking response")}catch(Y){console.error("[WebRTC] startCall error:",Y);const Q=Y instanceof Error?Y.message:"Failed to start call";d(Q==="Requested device not found"?"Camera or microphone not found.":Q),i("idle")}}async function ge(){const Y=A.current;Y&&z(Y,"partner-disconnected",{}).catch(()=>{}),D(),$(),W(),await S.functions.invoke("videocall-match",{body:{type:"disconnect",memberId:I.current}}),Y&&U(Y),A.current=null,f(null),p(!1),g(null),i("waiting"),C.current=crypto.randomUUID(),await fe()}async function J(){var Y;await ye(),(Y=w.current)==null||Y.getTracks().forEach(Q=>Q.stop()),w.current=null,y.current&&(y.current.srcObject=null),await S.functions.invoke("videocall-match",{body:{type:"leave_queue",memberId:I.current}})}h.useEffect(()=>()=>{var Q;W(),V(),$(),D(),(Q=w.current)==null||Q.getTracks().forEach(le=>le.stop()),w.current=null;const Y=I.current;S.functions.invoke("videocall-match",{body:{type:"leave_queue",memberId:Y}}),S.functions.invoke("videocall-match",{body:{type:"disconnect",memberId:Y}})},[]);async function ue(){try{const Y=x.current;if(!Y)return;const Q=await navigator.mediaDevices.getUserMedia({video:!0,audio:!1}),le=Q.getVideoTracks()[0];if(!le)return;w.current?w.current.addTrack(le):w.current=Q,y.current&&w.current&&(y.current.srcObject=w.current);const de=Y.getTransceivers().find(Le=>{var Ke;return((Ke=Le.receiver.track)==null?void 0:Ke.kind)==="video"&&Le.direction==="recvonly"});de?(de.direction="sendrecv",await de.sender.replaceTrack(le)):Y.addTrack(le,w.current);const me=await Y.createOffer();await Y.setLocalDescription(me),A.current&&z(A.current,"offer",me).catch(()=>{})}catch(Y){console.error("[WebRTC] enableCamera error:",Y)}}async function Ee(){try{await ee()}catch(Y){console.warn("[WebRTC] startPreview error:",Y)}}return{localVideoRef:y,remoteVideoRef:b,callState:a,error:c,currentPartnerId:u,partnerVoiceMode:m,partnerGender:v,hasStartedMatchmaking:o,startCall:fe,next:ge,stop:J,disconnect:ye,enableCamera:ue,startPreview:Ee,localStreamRef:w,remoteStreamRef:_}}const rO=({reason:e,banType:t,createdAt:n})=>{const[r,a]=h.useState(!1),[i,o]=h.useState(!1),[l,c]=h.useState(""),[d,u]=h.useState(!1),{user:f,signOut:m}=it(),p=t!=="underage",v=async()=>{if(!(!l.trim()||!f)){u(!0);try{const{error:y}=await S.from("user_reports").insert({reporter_id:f.id,reported_user_id:f.id,reason:"[BAN APPEAL] "+l.trim().slice(0,500),details:`Ban reason: ${e} | Ban type: ${t} | Banned on: ${n}`});if(y)throw y;B.success("Your appeal has been submitted. We'll review it shortly."),c(""),o(!1)}catch(y){B.error("Failed to submit. Please try again."),console.error("Ban appeal error:",y)}finally{u(!1)}}},g=async()=>{a(!0);try{const{data:y,error:b}=await S.functions.invoke("unban-payment",{body:{action:"create-checkout"}});if(b)throw b;y!=null&&y.url&&(window.location.href=y.url)}catch(y){console.error("Unban payment error:",y)}finally{a(!1)}};return s.jsx("div",{className:"min-h-screen bg-black flex items-center justify-center p-4",children:s.jsxs("div",{className:"max-w-md w-full text-center space-y-6",children:[s.jsx("div",{className:"mx-auto w-20 h-20 rounded-full bg-red-500/10 border-2 border-red-500/30 flex items-center justify-center",children:s.jsx(k4,{className:"w-10 h-10 text-red-500"})}),s.jsxs("div",{children:[s.jsx("h1",{className:"text-3xl font-black text-white mb-2",children:"Account Banned"}),s.jsxs("p",{className:"text-neutral-400 text-sm",children:["Banned on ",new Date(n).toLocaleDateString("en-US",{month:"long",day:"numeric",year:"numeric"})]})]}),s.jsxs("div",{className:"bg-red-500/5 border border-red-500/20 rounded-2xl p-5",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-2 justify-center",children:[s.jsx(Co,{className:"w-4 h-4 text-red-400"}),s.jsx("span",{className:"text-red-400 font-bold text-sm uppercase tracking-wide",children:"Reason"})]}),s.jsx("p",{className:"text-white font-medium text-lg",children:e})]}),p?s.jsxs("div",{className:"space-y-3",children:[s.jsxs("p",{className:"text-neutral-400 text-sm",children:["You can appeal this ban by paying a one-time fee of ",s.jsx("span",{className:"text-green-400 font-bold",children:"$10.00"})]}),s.jsx("button",{onClick:g,disabled:r,className:"w-full bg-green-600 hover:bg-green-700 disabled:bg-neutral-700 disabled:cursor-not-allowed text-white font-black text-lg py-4 rounded-xl transition-colors flex items-center justify-center gap-2",children:r?s.jsx(us,{className:"w-5 h-5 animate-spin"}):s.jsxs(s.Fragment,{children:[s.jsx(np,{className:"w-5 h-5"}),"Pay $10 to Appeal Ban"]})})]}):s.jsx("div",{className:"bg-neutral-900 border border-neutral-700 rounded-2xl p-5",children:s.jsx("p",{className:"text-red-400 font-bold text-sm",children:"This ban is permanent and cannot be appealed."})}),i?s.jsxs("div",{className:"bg-neutral-900 border border-neutral-700 rounded-2xl p-4 space-y-3",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("span",{className:"text-white font-bold text-sm",children:"Appeal your ban"}),s.jsx("button",{onClick:()=>o(!1),className:"text-neutral-500 hover:text-white",children:s.jsx(We,{className:"w-4 h-4"})})]}
471),s.jsx("textarea",{value:l,onChange:y=>c(y.target.value),placeholder:"Explain why you believe this ban was wrongful...",maxLength:500,rows:3,className:"w-full bg-neutral-800 border border-neutral-600 rounded-xl p-3 text-white text-sm placeholder:text-neutral-500 resize-none focus:outline-none focus:border-neutral-400"}),s.jsxs("button",{onClick:v,disabled:d||!l.trim(),className:"w-full bg-blue-600 hover:bg-blue-700 disabled:bg-neutral-700 disabled:cursor-not-allowed text-white font-bold text-sm py-3 rounded-xl transition-colors flex items-center justify-center gap-2",children:[d?s.jsx(us,{className:"w-4 h-4 animate-spin"}):s.jsx(eh,{className:"w-4 h-4"}),"Submit Appeal"]})]}):s.jsxs("button",{onClick:()=>o(!0),className:"w-full bg-neutral-800 hover:bg-neutral-700 text-white font-bold text-sm py-3 rounded-xl transition-colors flex items-center justify-center gap-2 border border-neutral-700",children:[s.jsx(An,{className:"w-4 h-4"}),"Contact Support"]}),s.jsx("button",{onClick:m,className:"text-neutral-500 hover:text-neutral-300 text-sm font-bold transition-colors",children:"Sign out"})]})})};function sO({userId:e,currentPartnerId:t,isConnected:n,challengeConfig:r}){const a=wt(),[i,o]=h.useState(0),[l,c]=h.useState(!1),[d,u]=h.useState(!1),f=h.useRef(new Set),m=h.useRef(null),p=h.useRef(null),[v,g]=h.useState(0),y=h.useRef(!1);h.useEffect(()=>{if(!r)return;const w=`speed_connect_${r.slug}`;if(go(w))return;const _=localStorage.getItem(w);if(_)try{const j=JSON.parse(_);(Date.now()-j.startTime)/1e3/60<r.timeLimitMinutes?(f.current=new Set(j.partners),m.current=j.startTime,o(j.partners.length),c(!0)):localStorage.removeItem(w)}catch{}},[r]),h.useEffect(()=>{if(!l||!m.current||!r)return;const w=()=>{const _=(Date.now()-m.current)/1e3,j=r.timeLimitMinutes*60,N=Math.max(0,j-_);g(Math.ceil(N)),N<=0&&(c(!1),f.current.clear(),m.current=null,o(0),localStorage.removeItem(`speed_connect_${r.slug}`),B.error("⏰ Time's up! Challenge reset."))};return w(),p.current=setInterval(w,1e3),()=>{p.current&&clearInterval(p.current)}},[l,r]),h.useEffect(()=>{if(!(!l||!t||!n||!r||d||y.current)&&!f.current.has(t)){f.current.add(t);const w=f.current.size;o(w),localStorage.setItem(`speed_connect_${r.slug}`,JSON.stringify({startTime:m.current,partners:Array.from(f.current)})),w>=r.targetPeople&&(u(!0),b(r))}},[t,n,l,r,d]);const b=h.useCallback(async w=>{if(!e||y.current)return;y.current=!0;const{error:_}=await S.from("challenge_submissions").insert({user_id:e,challenge_id:w.challengeId,proof_text:`Auto-completed: Connected to ${w.targetPeople} unique people within ${w.timeLimitMinutes} minutes.`,status:"pending"});_||(B.success("🎉 Speed Connect Challenge completed! Submitted for review."),localStorage.removeItem(`speed_connect_${w.slug}`),a.invalidateQueries({queryKey:["my_challenge_submissions"]}),a.invalidateQueries({queryKey:["challenge_submissions_carousel"]}))},[e,a]),x=h.useCallback(()=>{r&&(f.current.clear(),m.current=Date.now(),o(0),c(!0),u(!1),y.current=!1,localStorage.setItem(`speed_connect_${r.slug}`,JSON.stringify({startTime:Date.now(),partners:[]})),Sd(`speed_connect_${r.slug}`),B.success(`⚡ ${r.slug} activated!`,{description:`Connect to ${r.targetPeople} people in ${r.timeLimitMinutes} min!`}))},[r]);return{uniqueCount:i,isActive:l,completed:d,timeLeft:v,startChallenge:x}}function aO({userId:e,isConnected:t,elapsedSeconds:n,onAwarded:r}){const a=h.useRef(!1),i=h.useRef(!1);h.useEffect(()=>{t||(a.current=!1)},[t]),h.useEffect(()=>{t&&(!e||e==="anonymous"||a.current||i.current||n<30||(a.current=!0,(async()=>{try{const{data:o}=await S.functions.invoke("earn-minutes",{body:{type:"claim_welcome_bonus",userId:e}});o!=null&&o.success&&o.bonus>0?(B.success(`🎉 +${o.bonus} Welcome Bonus!`,{description:o.callNumber===1?"Your first call! Keep chatting to earn more 💖":o.callNumber===2?"Bonus #2 unlocked — one more left!":"Final welcome bonus claimed 🎁",duration:6e3}),r==null||r(o.bonus,o.callNumber)):(o==null?void 0:o.reason)==="exhausted"&&(i.current=!0)}catch{}})()))},[t,n,e,r])}function iO({userId:e,isOnCall:t,isStarted:n=!1,partnerGender:r}){return{status:"not_eligible",earningMode:"idle",settingsLoaded:!0,cashBalance:0,queuePosition:0,settings:null,cashEarned:0,verificationRequired:!1,verificationWord:"",payouts:[],systemDisabled:!0,startEarning:async()=>{},stopEarning:async()=>{},cashout:async()=>({success:!1}),submitVerification:async()=>!1}}function oO({remoteVideoRef:e,localStreamRef:t,isConnected:n,checkIntervalMs:r=5e3,brightnessThreshold:a=10,consecutiveChecks:i=2}){const[o,l]=h.useState(!1),c=h.useRef(0),d=h.useRef(null);return h.useEffect(()=>{if(!n){c.current=0,l(!1);return}d.current||(d.current=document.createElement("canvas"),d.current.width=64,d.current.height=48);const u=d.current,f=u.getContext("2d",{willReadFrequently:!0});if(!f)return;const m=setInterval(()=>{const p=e.current;
471if(!p||p.readyState<2)return;f.drawImage(p,0,0,u.width,u.height);const g=f.getImageData(0,0,u.width,u.height).data;let y=0;const b=g.length/4;for(let w=0;w<g.length;w+=4)y+=(g[w]+g[w+1]+g[w+2])/3;y/b<a?(c.current+=1,c.current>=i&&l(!0)):(c.current=0,l(!1))},r);return()=>clearInterval(m)},[n,r,a,i,e]),{partnerBlackScreen:o}}function lO({localVideoRef:e,isActive:t,checkIntervalMs:n=5e3,brightnessThreshold:r=10,consecutiveChecks:a=2}){const[i,o]=h.useState(!1),l=h.useRef(0),c=h.useRef(null);return h.useEffect(()=>{if(!t){l.current=0,o(!1);return}c.current||(c.current=document.createElement("canvas"),c.current.width=64,c.current.height=48);const d=c.current,u=d.getContext("2d",{willReadFrequently:!0});if(!u)return;const f=setInterval(()=>{const m=e.current;if(!m||m.readyState<2)return;u.drawImage(m,0,0,d.width,d.height);const v=u.getImageData(0,0,d.width,d.height).data;let g=0;const y=v.length/4;for(let x=0;x<v.length;x+=4)g+=(v[x]+v[x+1]+v[x+2])/3;g/y<r?(l.current+=1,l.current>=a&&o(!0)):(l.current=0,o(!1))},n);return()=>clearInterval(f)},[t,n,r,a,e]),{localBlackScreen:i}}function cO(e,t,n=3e3){const[r,a]=h.useState(!1),i=h.useRef(null),o=h.useRef(null);return h.useEffect(()=>{if(i.current&&(clearTimeout(i.current),i.current=null),!e||!t){a(!1),o.current=null;return}return t!==o.current&&(o.current=t,a(!0),i.current=setTimeout(()=>{a(!1),i.current=null},n)),()=>{i.current&&(clearTimeout(i.current),i.current=null)}},[e,t,n]),{isBlurred:r}}function uO({userId:e,isConnected:t,elapsedSeconds:n}){const[r,a]=h.useState(0),i=h.useRef(!1);h.useEffect(()=>{!e||e==="anonymous"||S.functions.invoke("earn-minutes",{body:{type:"get_balance",userId:e}}).then(({data:c})=>{c!=null&&c.success&&a(c.adPoints??0)})},[e]),h.useEffect(()=>{n===0&&(i.current=!1)},[n]);const o=h.useCallback(async c=>{if(i.current||!e||e==="anonymous"||c<30)return;i.current=!0;const{data:d}=await S.functions.invoke("earn-minutes",{body:{type:"earn_ad_points",userId:e,elapsedSeconds:c}});d!=null&&d.success&&d.totalAdPoints!==void 0&&a(d.totalAdPoints)},[e]),l=h.useCallback(async()=>{if(!e||e==="anonymous")return;const{data:c}=await S.functions.invoke("earn-minutes",{body:{type:"get_balance",userId:e}});c!=null&&c.success&&a(c.adPoints??0)},[e]);return{adPoints:r,awardAdPoints:o,refreshBalance:l}}const dO=({isVip:e,cap:t,onDismiss:n,voiceMode:r=!1})=>s.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/70 backdrop-blur-sm px-4",children:s.jsx("div",{className:"bg-neutral-900 border border-neutral-700 rounded-2xl p-6 max-w-sm w-full text-center shadow-2xl",children:r?s.jsxs("div",{className:"space-y-4",children:[s.jsx("div",{className:"text-4xl mb-2",children:"🎙️"}),s.jsxs("h3",{className:"text-xl font-black text-white mb-2",children:[t," Minute Voice Cap Reached!"]}),s.jsxs("p",{className:"text-neutral-300 text-sm leading-relaxed",children:["In ",s.jsx("span",{className:"text-purple-400 font-bold",children:"Voice Mode"}),", you earn up to"," ",s.jsxs("span",{className:"text-purple-400 font-black",children:[t," minutes"]})," per partner. Connect with someone new to keep earning! 🎧"]}),s.jsx("button",{onClick:n,className:"w-full py-3 rounded-xl bg-purple-600 hover:bg-purple-700 text-white font-black text-lg uppercase tracking-wide transition-colors border-2 border-purple-500 mt-3",children:"Got It!"})]}):e?s.jsxs("div",{className:"space-y-3 text-sm",children:[s.jsx("div",{className:"text-4xl mb-3",children:"⏱️"}),s.jsxs("h3",{className:"text-xl font-black text-white mb-2",children:[t," Minute Cap Reached!"]}),s.jsxs("p",{className:"text-neutral-300",children:[s.jsx("span",{className:"font-bold text-white",children:"VIP Users:"})," You've reached your ",t,"-minute cap with this user."]}),s.jsx("p",{className:"text-neutral-400",children:"Connect with someone new to keep earning minutes!"}),s.jsx("button",{onClick:n,className:"w-full py-2.5 rounded-lg bg-red-600 hover:bg-red-700 text-white font-bold transition-colors mt-5",children:"Got it!"})]}):s.jsxs("div",{className:"space-y-4",children:[s.jsxs("p",{className:"text-white font-black text-lg leading-snug uppercase tracking-wide",children:["When you reach"," ",s.jsxs("span",{className:"text-orange-400 font-black",children:[t," Minutes"]})," ","🎁 chatting with a user, you will stop earning minutes until you connect with someone new. You can still chat with that user but you won't earn extra minutes."," ",s.jsxs("span",{className:"text-white font-black",children:["VIP gets ",s.jsx("span",{className:"text-orange-400",children:"30 mins"})," cap per user they connect with!"]})," ","🎁"]}),s.jsxs("div",{className:"flex flex-col gap-3 mt-5",children:[s.jsx("button",{onClick:n,className:"w-full py-3 rounded-xl bg-green-600 hover:bg-green-700 text-white font-black text-lg uppercase tracking-wide transition-colors border-2 border-green-500",children:"I Understand"}),s.jsx("button",{className:"w-full py-3 rounded-xl bg-gradient-to-r from-yellow-500 to-yellow-400 hover:from-yellow-600 hover:to-yellow-500 text-neutral-900 font-black text-lg uppercase tracking-wide transition-colors border-2 border-yellow-400",children:"Join VIP Now!"})]})]})})}),hO=({minutesLost:e,onDismiss:t,onUpgrade:n})=>s.jsx("div",{className:"fixed inset-0 z-[60] flex items-center justify-center bg-black/80 backdrop-blur-sm px-4",children:s.jsxs("div",{className:"bg-neutral-900 border border-red-700/60 rounded-2xl p-6 max-w-sm w-full text-center shadow-2xl",children:[s.jsx("div",{className:"text-5xl mb-3",children:"⚠️"}),s.jsx("h2",{className:"text-white font-black text-xl uppercase tracking-wide mb-2",children:"Warning: Minutes Lost!"}),s.jsxs("p",{className:"text-neutral-200 text-sm leading-relaxed mb-5",children:["You just lost"," ",s.jsxs("span",{className:"text-red-400 font-black text-lg",children:["-",e," Minutes"]})," ","for skipping too fast."]}),s.jsxs("p",{className:"text-neutral-400 text-xs leading-relaxed mb-6",children:["Don't let your hard work vanish. Upgrade to VIP to get the"," ",s.jsx("span",{className:"text-yellow-400 font-bold",children:"Gender Filter"}
471)," and never waste minutes skipping again."]}),s.jsxs("div",{className:"flex flex-col gap-3",children:[s.jsx("button",{onClick:n,className:"w-full py-3.5 rounded-xl bg-gradient-to-r from-yellow-500 to-yellow-400 hover:from-yellow-600 hover:to-yellow-500 text-neutral-900 font-black text-sm uppercase tracking-wide transition-colors border-2 border-yellow-400",children:"Stop Losing Minutes + Gender Filter & More ($2.49/wk)"}),s.jsx("button",{onClick:t,className:"w-full py-2.5 rounded-xl bg-neutral-800 hover:bg-neutral-700 text-neutral-400 font-bold text-xs uppercase tracking-wide transition-colors border border-neutral-700",children:"I'll Keep Losing Progress"})]})]})}),fO=({minutesLost:e,onDone:t})=>{const[n,r]=h.useState(!0);return h.useEffect(()=>{const a=setTimeout(()=>r(!1),2200),i=setTimeout(t,2800);return()=>{clearTimeout(a),clearTimeout(i)}},[t]),s.jsx("div",{className:`fixed top-20 left-1/2 -translate-x-1/2 z-[70] pointer-events-none transition-all duration-500 ${n?"opacity-100 translate-y-0":"opacity-0 -translate-y-4"}`,children:s.jsxs("div",{className:"bg-red-900/90 border border-red-600 backdrop-blur-md rounded-xl px-5 py-3 shadow-2xl",children:[s.jsxs("span",{className:"text-white font-black text-lg tracking-wide",children:["🚫 -",e," Minutes"]}),s.jsx("span",{className:"block text-red-300 text-xs font-bold mt-0.5",children:"Don't Quick Skip"})]})})},$j="/assets/store-nYEPs-Ru.png",mO=({totalMinutes:e,onClose:t})=>{const n=sn();return s.jsxs("div",{className:"bg-neutral-900 border border-neutral-700 rounded-2xl p-5 w-full",children:[s.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[s.jsx("button",{onClick:t,className:"text-red-500 hover:text-red-400 transition-colors",children:s.jsx(We,{className:"w-8 h-8",strokeWidth:3})}),s.jsx("h2",{className:"text-2xl font-black text-white tracking-wide",children:"Redeem"})]}),s.jsxs("p",{className:"text-lg font-bold text-white mb-5",children:["You have"," ",s.jsx("span",{className:"text-green-400",children:e})," ","Minutes To Redeem"]}),s.jsxs("div",{className:"text-center",children:[s.jsxs("button",{onClick:()=>n("/store"),className:"flex items-center justify-center gap-2 mx-auto hover:opacity-80 transition-opacity",children:[s.jsx("img",{src:$j,alt:"Store",className:"w-10 h-10 object-contain"}),s.jsx("span",{className:"text-white font-bold text-lg",children:"View Reward Store"})]}),s.jsx("p",{className:"text-neutral-500 text-xs font-bold mt-2",children:"The more you chat the more rewards appear!"})]})]})},ya=({src:e,label:t,onClick:n,highlight:r,shake:a,badge:i})=>s.jsxs("button",{onClick:n,className:`relative flex flex-col items-center gap-1 hover:scale-110 transition-transform ${r?"scale-105":""} ${a?"animate-shake":""}`,children:[s.jsxs("div",{className:"relative",children:[s.jsx("img",{src:e,alt:t,className:"w-14 h-14 md:w-20 md:h-20 object-contain"}),i&&s.jsx("span",{className:"absolute -top-1 -right-1 bg-red-500 text-white text-[8px] md:text-[10px] font-bold px-1.5 py-0.5 rounded-full min-w-[18px] text-center animate-bounce shadow-lg shadow-red-500/40",children:i})]}),s.jsx("span",{className:`text-[11px] md:text-sm font-black tracking-wider ${r?"text-white md:text-base":"text-white"}`,children:t})]}),va=({children:e,onClose:t})=>s.jsxs("div",{className:"fixed inset-0 z-50 bg-black flex flex-col overflow-hidden",children:[s.jsx("button",{onClick:t,className:"absolute top-3 right-3 z-[60] bg-neutral-800 hover:bg-neutral-700 rounded-full p-2 transition-colors",children:s.jsx(We,{className:"w-6 h-6 text-white"})}),s.jsx("div",{className:"flex-1 overflow-y-auto",children:e})]});function rF(){return he({queryKey:["members_count"],queryFn:async()=>{const{count:e,error:t}=await S.from("members").select("id",{count:"exact",head:!0});if(t)throw t;return e??0},staleTime:6e4})}function sF(e){const{page:t,pageSize:n,search:r,sourceFilter:a}=e;return he({queryKey:["members_page",t,n,r,a],queryFn:async()=>{const i=t*n,o=i+n-1,l=r.trim().replace(/[%,()]/g,"");if(a==="all_vip"||a==="stripe"||a==="admin_granted"||a==="google_play_or_appstore"){let y=S.from("member_minutes").select("user_id, total_minutes",{count:"exact"});
471a==="all_vip"?y=y.eq("is_vip",!0):a==="stripe"?y=y.eq("is_vip",!0).not("stripe_customer_id","is",null).eq("admin_granted_vip",!1):a==="admin_granted"?y=y.eq("is_vip",!0).eq("admin_granted_vip",!0):a==="google_play_or_appstore"&&(y=y.eq("is_vip",!0).is("stripe_customer_id",null).eq("admin_granted_vip",!1));const{data:b,count:x,error:w}=await y.range(i,o);if(w)throw w;const _=(b??[]).map(I=>I.user_id);if(_.length===0)return{rows:[],total:x??0};let j=S.from("members").select("*").in("id",_);l&&(j=j.or(`name.ilike.%${l}%,email.ilike.%${l}%,country.ilike.%${l}%`));const{data:N,error:k}=await j;if(k)throw k;const C=new Map((b??[]).map(I=>[I.user_id,I.total_minutes]));return{rows:(N??[]).map(I=>({...I,minutes:C.get(I.id)??0})).sort((I,O)=>new Date(O.created_at).getTime()-new Date(I.created_at).getTime()),total:x??0}}let c=S.from("members").select("*",{count:"exact"}).order("created_at",{ascending:!1});l&&(c=c.or(`name.ilike.%${l}%,email.ilike.%${l}%,country.ilike.%${l}%`));const{data:d,count:u,error:f}=await c.range(i,o);if(f)throw f;const m=(d??[]).map(y=>y.id);let p=[];if(m.length>0){const{data:y}=await S.from("member_minutes").select("user_id, total_minutes, is_vip, admin_granted_vip, stripe_customer_id").in("user_id",m);p=y??[]}const v=new Map(p.map(y=>[y.user_id,y.total_minutes]));let g=(d??[]).map(y=>({...y,minutes:v.get(y.id)??0}));if(a==="free"){const y=new Set(p.filter(b=>b.is_vip).map(b=>b.user_id));g=g.filter(b=>!y.has(b.id))}return{rows:g,total:u??0}},placeholderData:i=>i,staleTime:3e4})}function aF(){return he({queryKey:["rewards"],queryFn:async()=>{const{data:e,error:t}=await S.from("rewards").select("*, reward_categories(name)").order("created_at",{ascending:!1});if(t)throw t;return e}})}function iF(){return he({queryKey:["promos"],queryFn:async()=>{const{data:e,error:t}=await S.from("promos").select("*").order("created_at",{ascending:!1});if(t)throw t;return e}})}function oF(){return he({queryKey:["reward_categories"],queryFn:async()=>{const{data:e,error:t}=await S.from("reward_categories").select("*").order("display_order",{ascending:!0}).order("created_at",{ascending:!1});if(t)throw t;return e}})}function pO(){return he({queryKey:["public_rewards"],queryFn:async()=>{const{data:e,error:t}=await S.from("rewards").select("*, reward_categories(name)").eq("visible",!0).order("minutes_cost",{ascending:!0});if(t)throw t;return e}})}function xO(){return he({queryKey:["public_categories"],queryFn:async()=>{const{data:e,error:t}=await S.from("reward_categories").select("*").eq("status","active").order("display_order",{ascending:!0}).order("name",{ascending:!0});if(t)throw t;return e}})}function lF(){const e=wt();return ps({mutationFn:async t=>{var a,i;const{data:n,error:r}=await S.functions.invoke("admin-delete-account",{body:{user_id:t}});if(r)throw r;if(!(n!=null&&n.success)){const o=((i=(a=n==null?void 0:n.results)==null?void 0:a[0])==null?void 0:i.error)||(n==null?void 0:n.error)||"Delete failed";throw new Error(o)}},onSuccess:()=>{e.invalidateQueries({queryKey:["members"]}),e.invalidateQueries({queryKey:["members_page"]}),e.invalidateQueries({queryKey:["members_count"]}),B.success("Member deleted")},onError:t=>B.error("Delete failed",{description:t.message})})}function cF(){const e=wt();return ps({mutationFn:async t=>{const{error:n}=await S.from("rewards").delete().eq("id",t);if(n)throw n},onSuccess:()=>{e.invalidateQueries({queryKey:["rewards"]}),B.success("Reward deleted")},onError:t=>B.error("Delete failed",{description:t.message})})}function uF(){const e=wt();return ps({mutationFn:async t=>{const{error:n}=await S.from("promos").delete().eq("id",t);if(n)throw n},onSuccess:()=>{e.invalidateQueries({queryKey:["promos"]}),B.success("Promo deleted")},onError:t=>B.error("Delete failed",{description:t.message})})}function dF(){const e=wt();return ps({mutationFn:async t=>{const{error:n}=await S.from("rewards").insert(t);if(n)throw n},onSuccess:()=>{e.invalidateQueries({queryKey:["rewards"]}),B.success("Reward created")},onError:t=>B.error("Create failed",{description:t.message})})}function hF(){const e=wt();return ps({mutationFn:async({id:t,...n})=>{const{error:r}=await S.from("rewards").update(n).eq("id",t);if(r)throw r},onSuccess:()=>
471{e.invalidateQueries({queryKey:["rewards"]}),B.success("Reward updated")},onError:t=>B.error("Update failed",{description:t.message})})}function fF(){const e=wt();return ps({mutationFn:async t=>{const{error:n}=await S.from("reward_categories").insert(t);if(n)throw n},onSuccess:()=>{e.invalidateQueries({queryKey:["reward_categories"]}),B.success("Category created")},onError:t=>B.error("Create failed",{description:t.message})})}function mF(){const e=wt();return ps({mutationFn:async({id:t,...n})=>{const{error:r}=await S.from("reward_categories").update(n).eq("id",t);if(r)throw r},onSuccess:()=>{e.invalidateQueries({queryKey:["reward_categories"]}),B.success("Category updated")},onError:t=>B.error("Update failed",{description:t.message})})}function pF(){const e=wt();return ps({mutationFn:async t=>{const{error:n}=await S.from("reward_categories").delete().eq("id",t);if(n)throw n},onSuccess:()=>{e.invalidateQueries({queryKey:["reward_categories"]}),B.success("Category deleted")},onError:t=>B.error("Delete failed",{description:t.message})})}const gO=({reward:e,onBack:t,onSuccess:n})=>{it();const[r,a]=h.useState(!1),[i,o]=h.useState({firstName:"",lastName:"",mobile:"",notes:"",country:"",address:"",state:"",zip:"",city:""}),l=(u,f)=>o(m=>({...m,[u]:f})),c=Number(e.shipping_fee)||0,d=async()=>{if(!i.firstName||!i.lastName||!i.country||!i.address){B.error("Please fill in required fields");return}a(!0);try{const u=e._isWishlist===!0,f=e._selectedColor||null,m=e._selectedSize||null,{data:p,error:v}=await S.functions.invoke("redeem-reward",{body:u?{action:"redeem-wishlist",wishlistItemId:e.id,shipping:i,selectedColor:f,selectedSize:m}:{action:"create-redemption",rewardId:e.id,shipping:i,selectedColor:f,selectedSize:m}});if(v)throw v;if(p!=null&&p.error)throw new Error(p.error);p.requiresPayment&&p.checkoutUrl?(B.success("Redirecting to payment..."),window.open(p.checkoutUrl,"_blank")):B.success("Reward redeemed successfully!"),n()}catch(u){B.error(u.message||"Failed to redeem")}a(!1)};return s.jsxs("div",{className:"min-h-screen bg-[#1a1a1a] text-white font-['Antigone',sans-serif] flex flex-col overflow-y-auto",children:[s.jsxs("div",{className:"flex items-center gap-3 px-4 py-4",children:[s.jsxs("button",{onClick:t,className:"flex items-center gap-1 font-black text-sm text-white/90 hover:text-white",children:[s.jsx(Rn,{className:"w-5 h-5"}),"Back"]}),s.jsx("h1",{className:"flex-1 text-2xl font-black text-center pr-10",children:"Shipping Details"})]}),s.jsxs("div",{className:"flex-1 px-4 pb-6 space-y-4",children:[s.jsx("input",{placeholder:"First name",value:i.firstName,onChange:u=>l("firstName",u.target.value),className:"w-full bg-white/10 border-2 border-white/30 rounded-xl px-4 py-3 font-bold text-white placeholder:text-white/50 focus:outline-none focus:border-white/60"}),s.jsx("input",{placeholder:"Last name",value:i.lastName,onChange:u=>l("lastName",u.target.value),className:"w-full bg-white/10 border-2 border-white/30 rounded-xl px-4 py-3 font-bold text-white placeholder:text-white/50 focus:outline-none focus:border-white/60"}),s.jsx("input",{placeholder:"Mobile",value:i.mobile,onChange:u=>l("mobile",u.target.value),className:"w-full bg-white/10 border-2 border-white/30 rounded-xl px-4 py-3 font-bold text-white placeholder:text-white/50 focus:outline-none focus:border-white/60"}),s.jsx("textarea",{placeholder:"Notes",value:i.notes,onChange:u=>l("notes",u.target.value),rows:3,className:"w-full bg-white/10 border-2 border-white/30 rounded-xl px-4 py-3 font-bold text-white placeholder:text-white/50 focus:outline-none focus:border-white/60 resize-none"}),s.jsx("h2",{className:"font-black text-lg text-center mt-4 text-white/90",children:"Address"}),s.jsx("input",{placeholder:"Country/Region",value:i.country,onChange:u=>l("country",u.target.value),className:"w-full bg-white/10 border-2 border-white/30 rounded-xl px-4 py-3 font-bold text-white placeholder:text-white/50 focus:outline-none focus:border-white/60"}),s.jsx("textarea",{placeholder:"Address",value:i.address,onChange:u=>l("address",u.target.value),rows:2,className:"w-full bg-white/10 border-2 border-white/30 rounded-xl px-4 py-3 font-bold text-white placeholder:text-white/50 focus:outline-none focus:border-white/60 resize-none"}),s.jsx("input",{placeholder:"City",value:i.city,onChange:u=>l("city",u.target.value),className:"w-full bg-white/10 border-2 border-white/30 rounded-xl px-4 py-3 font-bold text-white placeholder:text-white/50 focus:outline-none focus:border-white/60"}),s.jsx("input",{placeholder:"State",value:i.state,onChange:u=>l("state",u.target.value),className:"w-full bg-white/10 border-2 border-white/30 rounded-xl px-4 py-3 font-bold text-white placeholder:text-white/50 focus:outline-none focus:border-white/60"}),s.jsx("input",{placeholder:"Zip",value:i.zip,onChange:u=>l("zip",u.target.value),className:"w-full bg-white/10 border-2 border-white/30 rounded-xl px-4 py-3 font-bold text-white placeholder:text-white/50 focus:outline-none focus:border-white/60"}),s.jsx("div",{className:"pt-4 flex justify-center",children:s.jsx("button",{onClick:d,disabled:r,className:"bg-primary text-primary-foreground font-black text-xl px-10 py-3 rounded-full hover:opacity-90 transition-opacity disabled:opacity-50",children:r?"Processing...":c>0?`Confirm & Pay $${c.toFixed(2)} Shipping`:"Confirm"})}),c>0&&s.jsxs("p",{className:"text-center text-sm font-bold text-white/60 mt-4 px-4",children:["By clicking confirm you acknowledge and accept the responsibility to cover the shipping fees associated with this product, estimated to be approximately $",c.toFixed(2)," depending on your region."]})]})]})},Sl="recharge-minutes-updated";function bO(){try{localStorage.setItem(Sl,String(Date.now()))}catch{}window.dispatchEvent(new Event(Sl))}function yO(e){const t=wt(),n=he({queryKey:["recharge-minutes",e],enabled:!!e,staleTime:3e4,refetchOnWindowFocus:!0,queryFn:async()=>{const{data:r}=await S.from("member_minutes").select("recharge_minutes").eq("user_id",e).maybeSingle();return(r==null?void 0:r.recharge_minutes)??0}});return h.useEffect(()=>{if(!e)return;const r=()=>
471t.invalidateQueries({queryKey:["recharge-minutes",e]}),a=i=>{i.key===Sl&&r()};return window.addEventListener(Sl,r),window.addEventListener("storage",a),()=>{window.removeEventListener(Sl,r),window.removeEventListener("storage",a)}},[e,t]),n}async function vO(e){const{data:t,error:n}=await S.functions.invoke("recharge-minutes",{body:{action:"create-checkout",pack:e}});if(n)throw n;return t!=null&&t.url&&window.open(t.url,"_blank"),t==null?void 0:t.url}function _c(e){const[t,n]=h.useState({subscribed:!1,vipTier:null,subscriptionEnd:null,loading:!0}),r=h.useCallback(async(o=!1)=>{if(!e){n({subscribed:!1,vipTier:null,subscriptionEnd:null,loading:!1});return}o&&(sessionStorage.removeItem("vip_status_session_init"),sessionStorage.removeItem(`vip_status_${e}`));const l=o?null:sessionStorage.getItem("vip_status_session_init"),d=(o?null:sessionStorage.getItem(`vip_status_${e}`))||l;if(d)try{const{data:u,ts:f}=JSON.parse(d);if(Date.now()-f<5*60*1e3){n({subscribed:(u==null?void 0:u.subscribed)??!1,vipTier:(u==null?void 0:u.vip_tier)??null,subscriptionEnd:(u==null?void 0:u.subscription_end)??null,loading:!1});return}}catch{}try{const{data:u,error:f}=await S.functions.invoke("check-subscription");if(f)throw f;u!=null&&u.degraded||sessionStorage.setItem(`vip_status_${e}`,JSON.stringify({data:u,ts:Date.now()})),u!=null&&u.subscribed&&bO(),n({subscribed:(u==null?void 0:u.subscribed)??!1,vipTier:(u==null?void 0:u.vip_tier)??null,subscriptionEnd:(u==null?void 0:u.subscription_end)??null,loading:!1})}catch(u){console.error("Failed to check subscription:",u);const{data:f}=await S.from("member_minutes").select("is_vip, vip_tier, subscription_end").eq("user_id",e).maybeSingle();n({subscribed:(f==null?void 0:f.is_vip)??!1,vipTier:(f==null?void 0:f.vip_tier)??null,subscriptionEnd:(f==null?void 0:f.subscription_end)??null,loading:!1})}},[e]);h.useEffect(()=>{const o=e?sessionStorage.getItem(`vip_pending_${e}`):null;r(!!o)},[r,e]),h.useEffect(()=>{if(!e||!sessionStorage.getItem(`vip_pending_${e}`))return;if(t.subscribed){sessionStorage.removeItem(`vip_pending_${e}`);return}const o=Number(sessionStorage.getItem(`vip_pending_${e}`))||Date.now();if(Date.now()-o>3*6e4){sessionStorage.removeItem(`vip_pending_${e}`);return}const l=setInterval(()=>r(!0),5e3),c=()=>r(!0);return window.addEventListener("focus",c),document.addEventListener("visibilitychange",c),()=>{clearInterval(l),window.removeEventListener("focus",c),document.removeEventListener("visibilitychange",c)}},[e,t.subscribed,r]),h.useEffect(()=>{if(!e)return;const o=setInterval(r,5*6e4);return()=>clearInterval(o)},[e,r]);const a=h.useCallback(async(o,l="unknown")=>{const c=o==="price_1T9ygOA5n8uAZoY1tzoTfeMH"?"basic":"premium";e&&(sessionStorage.setItem(`vip_pending_${e}`,String(Date.now())),sessionStorage.removeItem(`vip_status_${e}`),sessionStorage.removeItem("vip_status_session_init"));const{data:d,error:u}=await S.functions.invoke("create-checkout",{body:{priceId:o,source:l,tier:c}});if(u)throw u;d!=null&&d.url&&(window.location.href=d.url)},[e]),i=h.useCallback(async()=>{const{data:o,error:l}=await S.functions.invoke("customer-portal");if(l)throw l;o!=null&&o.url&&(window.location.href=o.url)},[]);return{...t,checkSubscription:r,startCheckout:a,openPortal:i}}const wO="/assets/fire-red-CXQLuwa-.png",_O="/assets/fire-blue-BZoj9i4-.png",Mi={common:{bg:"bg-neutral-700",text:"text-white",labelColor:"text-green-500"},rare:{bg:"bg-blue-600",text:"text-white",labelColor:"text-red-500"},legendary:{bg:"bg-amber-500",text:"text-black",labelColor:"text-cyan-400"}};function jO({rarity:e,cashoutValue:t}){const n=Mi[e]||Mi.common,r=e.charAt(0).toUpperCase()+e.slice(1),a=e==="rare"?wO:e==="legendary"?_O:null,i=e==="legendary"&&t&&t>0;return s.jsxs("div",{className:"absolute top-2 left-2 z-10 flex flex-col items-start",children:[s.jsxs("div",{className:"flex items-center gap-0.5",children:[s.jsx("span",{className:`font-black text-base drop-shadow-lg ${n.labelColor}`,style:{textShadow:"0 2px 8px rgba(0,0,0,0.7)"},children:r}),a&&s.jsx("img",{src:a,alt:"",className:"w-5 h-5 -mt-0.5"})]}),i&&s.jsxs("span",{className:"font-black text-xs text-yellow-400 drop-shadow-lg",style:{textShadow:"0 2px 6px rgba(0,0,0,0.8)"},children:["Cash Out $",t.toFixed(0)]})]})}function oy({reward:e,onClick:t,isPremiumVip:n}){return s.jsxs("button",{onClick:t,className:"relative rounded-2xl overflow-hidden bg-neutral-900 aspect-square group text-left border border-neutral-700/50 hover:border-neutral-600 transition-all",children:[e.image_url?s.jsx("img",{src:e.image_url,alt:e.title,className:"w-full h-full object-cover group-hover:scale-105 transition-transform duration-300"}):s.jsx("div",{className:"w-full h-full flex items-center justify-center bg-neutral-800",children:s.jsx("span",{className:"text-4xl",children:"🎁"})}),s.jsx("div",{className:"absolute inset-0 bg-gradient-to-t from-black/90 via-black/30 to-black/20"}),s.jsx(jO,{rarity:e.rarity,cashoutValue:Number(e.cashout_value)||0}),s.jsx("div",{className:"absolute bottom-0 left-0 right-0 p-3 text-center",children:s.jsx("p",{className:"font-black text-sm leading-tight text-white drop-shadow-lg",children:e.title})})]})}function NO(e,t,n,r=28){const a=r-4,i=[];for(let o=0;o<r;o++)o===a?i.push(n?{...t,isTarget:!0}:{...e[o%e.length],isTarget:!1}):Math.random()<.2&&o<a-1?i.push({...t,isTarget:!0}):i.push({...e[o%e.length],isTarget:!1});return{items:i,winnerIndex:a}}const Fj=({onClose:e})=>{var Ze,ft,Rt,lt,on;const t=sn(),{user:n}
471=it(),{subscribed:r,vipTier:a}=_c((n==null?void 0:n.id)??null),{data:i,isLoading:o}=pO(),{data:l}=xO(),[c,d]=h.useState(null),[u,f]=h.useState(null),[m,p]=h.useState(!1),[v,g]=h.useState(null),[y,b]=h.useState("idle"),[x,w]=h.useState([]),[_,j]=h.useState(!1),[N,k]=h.useState(null),[C,A]=h.useState(null),[I,O]=h.useState(0),[P,T]=h.useState([]),[E,W]=h.useState(0),[V,q]=h.useState(!1),[D,$]=h.useState(!1),[z,R]=h.useState(!1),[U,ee]=h.useState(null),[ae,xe]=h.useState(null),[te,ce]=h.useState(!1),[Re,ye]=h.useState(null),[fe,ge]=h.useState(""),[J,ue]=h.useState(!1);h.useState(!1);const Ee=h.useRef(null),Y=wt(),Q=r&&a==="premium",le=c?i==null?void 0:i.filter(F=>F.category_id===c):i,de=l==null?void 0:l.map(F=>{const Pe=(i==null?void 0:i.filter(Z=>Z.category_id===F.id).length)??0;return{...F,count:Pe}}),{data:me}=he({queryKey:["user-minutes-balance"],queryFn:async()=>{const{data:{user:F}}=await S.auth.getUser();if(!F)return 0;const{data:Pe}=await S.functions.invoke("earn-minutes",{body:{type:"get_balance",userId:F.id}});return(Pe==null?void 0:Pe.totalMinutes)??0}}),{data:Le}=he({queryKey:["store-chance-enhancer",n==null?void 0:n.id],enabled:!!n,queryFn:async()=>{const{data:F}=await S.functions.invoke("spin-wheel",{body:{type:"get_chance_enhancer",userId:n.id}});return F||{chance_enhancer:10,is_vip:!1}}}),Ke=(Le==null?void 0:Le.chance_enhancer)??10,{data:Qe}=he({queryKey:["store-gift-cards"],queryFn:async()=>{const{data:F,error:Pe}=await S.functions.invoke("redeem-giftcard",{body:{action:"list"}});if(Pe)throw Pe;return(F==null?void 0:F.cards)||[]}}),{data:tt=[],refetch:an}=he({queryKey:["wishlist-items",n==null?void 0:n.id],enabled:!!n,queryFn:async()=>{const{data:F,error:Pe}=await S.from("wishlist_items").select("*").eq("user_id",n.id).in("status",["active","rejected"]).order("created_at",{ascending:!0});if(Pe)throw Pe;return F||[]}}),Wt=(i==null?void 0:i.filter(F=>F.rarity==="common"))||[],[De,pe]=h.useState(null),Qt=F=>{g(F),b("idle"),w([]),j(!1),pe(null)},nt=(F,Pe=!1)=>{b("spinning"),q(!0);const Z=[...Wt].sort(()=>Math.random()-.5),G=Z.slice(0,Math.min(3,Z.length));if(G.length===0)return;const et=F._isWishlist===!0,ze=Math.random()*100,ie=et?!0:ze<Ke,{items:be,winnerIndex:Ce}=NO(G,F,ie);T(be),W(Ce),w(be),requestAnimationFrame(()=>{Ee.current&&(Ee.current.style.transition="none",Ee.current.style.transform="translateX(0)",requestAnimationFrame(()=>{if(Ee.current){const _t=Ce*88-160+40;Ee.current.style.transition="transform 3.5s cubic-bezier(0.15, 0.85, 0.35, 1)",Ee.current.style.transform=`translateX(-${_t}px)`}}))}),setTimeout(()=>{q(!1);const $e=be[Ce];pe($e),ie?(b("won"),B.success(`🎉 You won ${F.title}!`)):(b("lost"),Q&&F.rarity==="legendary"&&!Pe&&j(!0))},4e3)},M=()=>{v&&(j(!1),nt(v,!0))};if(v){const F=v,Pe=Mi[F==null?void 0:F.rarity]||Mi.common,Z=(F==null?void 0:F.rarity)==="legendary"?"text-amber-400":"text-blue-400";return s.jsxs("div",{className:"min-h-screen bg-black text-white font-['Antigone',sans-serif] flex flex-col items-center px-4 pb-8 overflow-hidden",children:[s.jsx("div",{className:"w-full flex items-center pt-3 pb-2",children:s.jsxs("button",{onClick:()=>{g(null),T([])},className:"flex items-center gap-1 hover:opacity-80",children:[s.jsx(Rn,{className:"w-7 h-7"}),s.jsx("span",{className:"font-black text-sm",children:"BACK"})]})}),s.jsx("h1",{className:"text-3xl font-black mt-2 mb-1",children:"🎰 SPIN TO WIN"}),s.jsxs("p",{className:"text-neutral-400 text-xs mb-3 text-center",children:["Land on the ",s.jsx("span",{className:`${Z} font-bold`,children:F.rarity})," item to win!"]}),s.jsx("div",{className:"bg-orange-500/10 border border-orange-500/30 rounded-full px-4 py-1.5 mb-5 flex items-center gap-2",children:s.jsxs("span",{className:"text-orange-400 text-xs font-black",children:["🔥 Win Chance: ",Math.round(Ke),"%"]})}),s.jsxs("div",{className:"mb-5 text-center",children:[s.jsx("p",{className:"text-neutral-500 text-[10px] font-bold uppercase tracking-wider mb-2",children:"You're spinning for"}),s.jsx("div",{className:"w-20 h-20 rounded-2xl overflow-hidden bg-neutral-800 mx-auto mb-2 border-2 border-amber-500/50 shadow-lg shadow-amber-500/20",children:F.image_url?s.jsx("img",{src:F.image_url,alt:F.title,className:"w-full h-full object-cover"}):s.jsx("div",{className:"w-full h-full flex items-center justify-center text-3xl",children:"🎁"})}),s.jsx("p",{className:"font-black text-sm",children:F.title}),s.jsx("span",{className:`${Pe.bg} ${Pe.text} px-3 py-0.5 rounded-md font-bold text-[10px] inline-block mt-1`,children:F.rarity.charAt(0).toUpperCase()+F.rarity.slice(1)})]}),P.length>0&&s.jsxs("div",{className:"w-full max-w-sm mb-6 relative",children:[s.jsx("div",{className:"absolute top-0 left-1/2 -translate-x-1/2 -mt-2 z-20",children:s.jsx("div",{className:"w-0 h-0 border-l-[10px] border-r-[10px] border-t-[14px] border-l-transparent border-r-transparent border-t-yellow-400"})}),s.jsx("div",{className:"absolute bottom-0 left-1/2 -translate-x-1/2 -mb-2 z-20",children:s.jsx("div",{className:"w-0 h-0 border-l-[10px] border-r-[10px] border-b-[14px] border-l-transparent border-r-transparent border-b-yellow-400"})}),s.jsx("div",{className:"overflow-hidden rounded-2xl border-2 border-neutral-700 bg-neutral-900 py-3",style:{maskImage:"linear-gradient(to right, transparent 0%, black 15%, black 85%, transparent 100%)",WebkitMaskImage:"linear-gradient(to right, transparent 0%, black 15%, black 85%, transparent 100%)"},children:s.jsx("div",{ref:Ee,className:"flex gap-2 pl-[140px]",style:{willChange:"transform"},children:P.map((G,et)=>{const ze=!V&&et===E,ie=G.isTarget,be=ze?y==="won"?"border-green-500 shadow-green-500/40 shadow-lg":"border-red-500 shadow-red-500/30 shadow-lg":ie?F.rarity==="legendary"?"border-amber-500/40":"border-blue-500/40":"border-neutral-700";return s.jsx("div",{className:`w-20 h-20 rounded-xl overflow-hidden border-2 flex-shrink-0 transition-all duration-500 ${be} ${!V&&y!=="idle"&&et!==E?"opacity-40":""}`,children:G.image_url?s.jsx("img",{src:G.image_url,alt:G.title,className:"w-full h-full object-cover"}):s.jsx("div",{className:"w-full h-full bg-neutral-800 flex items-center justify-center text-2xl",children:"🎁"})},et)})})})]}),y==="won"&&s.jsxs("div",{className:"bg-green-500/10 border border-green-500/30 rounded-2xl p-4 mb-4 text-center animate-scale-in",children:[s.jsx("p",{className:"text-green-400 font-black text-xl",children:"🎉 YOU WON!"}),s.jsx("p",{className:"text-neutral-300 text-sm mt-1",children:"Click below to claim your prize"}),Q&&F.rarity==="legendary"&&Number(F.cashout_value)>0&&s.jsxs("p",{className:"text-green-300 text-xs mt-2",children:["💰 You can also cash out ",s.jsxs("span",{className:"font-black text-green-400",children:["$",Number(F.cashout_value).toFixed(2)]})," instead!"]})]}),y==="lost"&&!_&&De&&s.jsxs("div",{className:"bg-neutral-800 border border-neutral-700 rounded-2xl p-4 mb-4 text-center animate-scale-in",children:[s.jsx("p",{className:"text-neutral-300 font-black text-sm mb-2",children:"You landed on:"}),s.jsx("div",{className:"w-16 h-16 rounded-xl overflow-hidden bg-neutral-700 mx-auto mb-2 border-2 border-neutral-500",children:De.image_url?s.jsx("img",{src:De.image_url,alt:De.title,className:"w-full h-full object-cover"}):s.jsx("div",{className:"w-full h-full flex items-center justify-center text-2xl",children:"🎁"})}),s.jsx("p",{className:"text-white font-bold text-sm",children:De.title}),s.jsxs("p",{className:"text-neutral-500 text-xs mt-1",children:["🪙 ",De.minutes_cost," Minutes"]})]}),y==="lost"&&_&&s.jsxs("div",{className:"bg-purple-500/10 border border-purple-500/30 rounded-2xl p-4 mb-4 text-center animate-scale-in",children:[s.jsx("p",{className:"text-purple-400 font-black text-lg",children:"👑 Premium VIP Perk!"}),s.jsx("p",{className:"text-neutral-300 text-sm",children:"You get one more shot at this legendary item"})]}),s.jsxs("div",{className:"w-full max-w-xs space-y-3 mt-auto",children:[y==="idle"&&s.jsx("button",{onClick:()=>nt(F),className:"w-full py-4 rounded-full font-black text-xl bg-gradient-to-r from-yellow-500 to-orange-500 text-black hover:scale-105 active:scale-95 transition-all shadow-lg shadow-orange-500/30",children:"🎰 SPIN NOW!"}),y==="spinning"&&s.jsx("button",{disabled:!0,className:"w-full py-4 rounded-full font-black text-lg bg-neutral-700 text-neutral-400 cursor-wait animate-pulse",children:"SPINNING..."}),y==="won"&&s.jsxs(s.Fragment,{children:[s.jsx("button",{onClick:()=>{F.type==="Spins"||F.type==="Ad Points"?(Ve(F),g(null),T([])):F._isWishlist?(g(null),T([]),f({...F,shipping_fee:0}),p(!0)):(g(null),T([]),f(F),p(!0))},className:"w-full py-4 rounded-full font-black text-lg bg-green-600 hover:bg-green-700 text-white transition-all shadow-lg",children:F.type==="Spins"?"🎰 CLAIM SPIN TOKENS":F.type==="Ad Points"?"⚡ CLAIM AD POINTS":"🎁 REDEEM ITEM"}),Q&&F.rarity==="legendary"&&Number(F.cashout_value)>0&&s.jsxs("button",{onClick:()=>{ye(F),ge("")},className:"w-full py-4 rounded-full font-black text-lg bg-gradient-to-r from-green-500 to-emerald-500 text-white hover:scale-105 active:scale-95 transition-all shadow-lg",children:["💰 CASH OUT $",Number(F.cashout_value).toFixed(2)]})]}),_&&s.jsxs("button",{onClick:M,className:"w-full py-4 rounded-full font-black text-lg bg-gradient-to-r from-purple-500 to-pink-500 text-white hover:scale-105 active:scale-95 transition-all shadow-lg flex items-center justify-center gap-2",children:[s.jsx(j4,{className:"w-5 h-5"})," SPIN AGAIN (VIP)"]}),y==="lost"&&!_&&De&&s.jsxs(s.Fragment,{children:[s.jsxs("button",{onClick:()=>{g(null),T([]),f(De),p(!0)},disabled:(me??0)<De.minutes_cost,className:`w-full py-4 rounded-full font-black text-lg transition-all shadow-lg ${(me??0)>=De.minutes_cost?"bg-blue-600 hover:bg-blue-700 text-white":"bg-neutral-700 text-neutral-400 cursor-not-allowed"}`,children:["🎁 Redeem ",De.title]}),s.jsxs("button",{onClick:async()=>{try{const{error:G}=await S.functions.invoke("earn-minutes",{body:{type:"deduct",userId:n.id,amount:F.minutes_cost}}
471);if(G)throw G;B("😔 You lost 🪙 "+F.minutes_cost+" minutes"),Y.invalidateQueries({queryKey:["user-minutes-balance"]})}catch{B.error("Failed to process loss")}g(null),T([])},className:"w-full py-3 rounded-full font-black text-sm bg-red-900/40 border border-red-500/30 text-red-400 hover:bg-red-900/60 transition-all",children:["Take the Loss (−🪙 ",F.minutes_cost," Minutes)"]})]})]}),Re&&s.jsx("div",{className:"fixed inset-0 z-[200] bg-black/80 flex items-center justify-center px-4",children:s.jsxs("div",{className:"bg-neutral-900 border border-neutral-700 rounded-3xl p-6 w-full max-w-sm space-y-4",children:[s.jsx("h3",{className:"font-black text-lg text-center text-white",children:"💰 Enter Your PayPal"}),s.jsxs("p",{className:"text-neutral-400 text-sm text-center",children:["We'll send ",s.jsxs("span",{className:"text-green-400 font-black",children:["$",Number(Re.cashout_value).toFixed(2)]})," to your PayPal account."]}),s.jsx("input",{type:"email",placeholder:"[email protected]",value:fe,onChange:G=>ge(G.target.value),className:"w-full bg-white/10 border-2 border-white/20 rounded-xl px-4 py-3 font-bold text-white placeholder:text-white/40 focus:outline-none focus:border-green-500/50"}),s.jsx("button",{disabled:J||!fe.includes("@"),onClick:async()=>{ue(!0);try{const{error:G}=await S.functions.invoke("redeem-reward",{body:{action:"cashout-legendary",rewardId:Re.id,paypalEmail:fe.trim()}});if(G)throw G;B.success(`💰 Cashed out $${Number(Re.cashout_value).toFixed(2)}! Payment will be sent to ${fe.trim()}`),Y.invalidateQueries({queryKey:["user-minutes-balance"]}),Y.invalidateQueries({queryKey:["public-rewards"]}),g(null),T([]),ye(null)}catch(G){B.error(G.message||"Cashout failed")}ue(!1)},className:`w-full py-4 rounded-full font-black text-lg transition-all shadow-lg ${!fe.includes("@")||J?"bg-neutral-700 text-neutral-400 cursor-not-allowed":"bg-gradient-to-r from-green-500 to-emerald-500 text-white hover:scale-105 active:scale-95"}`,children:J?"Processing...":"💰 CONFIRM CASHOUT"}),s.jsx("button",{onClick:()=>ye(null),className:"w-full py-3 text-neutral-400 font-bold text-sm hover:text-white transition-colors",children:"Cancel"})]})})]})}const Ve=async F=>{$(!0);try{const{data:Pe,error:Z}=await S.functions.invoke("redeem-reward",{body:{action:"redeem-instant",rewardId:F.id}});if(Z)throw Z;if(Pe!=null&&Pe.error)throw new Error(Pe.error);const G=F.type==="Spins"?"spin tokens":"ad points";B.success(`🎉 +${Pe.grantAmount} ${G} added to your account!`),Y.invalidateQueries({queryKey:["user-minutes-balance"]}),f(null)}catch(Pe){B.error(Pe.message||"Redemption failed")}finally{$(!1)}},Ue=async(F,Pe)=>{ee(F);try{const{data:Z,error:G}=await S.functions.invoke("redeem-giftcard",{body:{action:"redeem",giftCardId:F}});if(G)throw G;if(Z!=null&&Z.error)throw new Error(Z.error);xe({code:Z.code,brand:Z.brand,value:Z.value_amount}),B.success("🎉 Gift card redeemed!"),Y.invalidateQueries({queryKey:["user-minutes-balance"]}),Y.invalidateQueries({queryKey:["store-gift-cards"]})}catch(Z){B.error(Z.message||"Redemption failed")}finally{ee(null)}};if(ae)return s.jsxs("div",{className:"min-h-screen bg-black text-white font-['Antigone',sans-serif] flex flex-col items-center justify-center px-6",children:[s.jsx("div",{className:"text-6xl mb-4",children:"🎉"}),s.jsx("h1",{className:"text-3xl font-black mb-2",children:"GIFT CARD REDEEMED!"}),s.jsxs("p",{className:"text-neutral-400 mb-6",children:[ae.brand," $",ae.value.toFixed(2)]}),s.jsxs("div",{className:"bg-neutral-900 border border-neutral-700 rounded-2xl p-6 w-full max-w-xs text-center",children:[s.jsx("p",{className:"text-neutral-500 text-xs font-bold mb-2",children:"YOUR CODE"}),s.jsx("p",{className:"text-2xl font-mono font-black text-green-400 tracking-wider mb-4 break-all",children:ae.code}),s.jsx("button",{onClick:()=>{navigator.clipboard.writeText(ae.code),ce(!0),setTimeout(()=>ce(!1),2e3)},className:"flex items-center justify-center gap-2 w-full py-3 rounded-full bg-neutral-800 hover:bg-neutral-700 font-bold text-sm transition-colors",children:te?s.jsxs(s.Fragment,{children:[s.jsx(Mr,{className:"w-4 h-4 text-green-400"})," Copied!"]}):s.jsxs(s.Fragment,{children:[s.jsx(Zd,{className:"w-4 h-4"})," Copy Code"]})})]}),s.jsx("p",{className:"text-neutral-400 text-[10px] font-bold mt-4",children:"You can revisit this code anytime in My Rewards → Giftcards"}),s.jsx("button",{onClick:()=>{xe(null),R(!0)},className:"mt-6 text-neutral-400 hover:text-white text-sm font-bold transition-colors",children:"← Back to Gift Cards"})]});if(z)return s.jsxs("div",{className:"min-h-screen bg-black text-white font-['Antigone',sans-serif] flex flex-col",children:[s.jsxs("div",{className:"flex items-center gap-3 px-4 py-4",children:[s.jsxs("button",{onClick:()=>R(!1),className:"flex items-center gap-1 hover:opacity-80",children:[s.jsx(jl,{className:"w-6 h-6"}),s.jsx("span",{className:"font-bold text-sm",children:"BACK"})]}),s.jsx("h1",{className:"flex-1 text-xl font-black tracking-widest text-right",children:"GIFT CARDS"})]}),s.jsx("div",{className:"px-4 mb-4",children:s.jsxs("div",{className:"bg-neutral-800 border border-neutral-700 rounded-xl px-4 py-3 text-center",children:[s.jsx("p",{className:"text-neutral-400 text-sm",children:"Your Balance"}),s.jsxs("p",{className:"text-green-400 font-black text-2xl",children:["🪙 ",me??0," Minutes"]})]})}),s.jsx("div",{className:"flex-1 px-4 pb-6",children:Qe!=null&&Qe.length?s.jsx("div",{className:"space-y-3",children:Qe.map((F,Pe)=>s.jsxs("div",{className:"bg-neutral-900 border border-neutral-700 rounded-2xl p-4 flex items-center gap-4",children:[F.image_url?s.jsx("img",{src:F.image_url,alt:F.brand,className:"w-16 h-16 rounded-xl object-cover"}):s.jsx("div",{className:"w-16 h-16 rounded-xl bg-neutral-800 flex items-center justify-center text-3xl",children:"🎁"}),s.jsxs("div",{className:"flex-1",children:[s.jsx("p",{className:"font-black text-lg",children:F.brand}),s.jsxs("p",{className:"text-green-400 font-bold text-sm",children:["$",Number(F.value_amount).toFixed(2)," Gift Card"]}),s.jsxs("p",{className:"text-neutral-500 text-xs",children:["🪙 ",F.minutes_cost," Minutes • ",F.count," left"]})]}),s.jsx("button",{onClick:()=>Ue(F.sample_id,F.brand),disabled:U!==null||(me??0)<F.minutes_cost,className:`px-4 py-2 rounded-full font-black text-sm transition-all ${(me??0)>=F.minutes_cost?"bg-green-600 hover:bg-green-700 text-white":"bg-neutral-700 text-neutral-400 cursor-not-allowed"}`,children:U===F.sample_id?"...":"REDEEM"})]},Pe))}):s.jsxs("div",{className:"text-center py-16",children:[s.jsx(np,{className:"w-16 h-16 mx-auto mb-3 text-neutral-600"}),s.jsx("p",{className:"text-neutral-500 font-bold",children:"No gift cards available right now"}),s.jsx("p",{className:"text-neutral-600 text-sm",children:"Check back later!"})]})})]});if(u&&m){const F=Array.isArray(u.color_options)?u.color_options:[],Pe=N!==null?((Ze=F[N])==null?void 0:Ze.name)??null:null,Z={...u,...Q?{shipping_fee:0}:{},_selectedColor:Pe,_selectedSize:C};return s.jsx(gO,{reward:Z,onBack:()=>p(!1),onSuccess:()=>
471{p(!1),f(null),Y.invalidateQueries({queryKey:["user-minutes-balance"]}),u._isWishlist&&(an(),Y.invalidateQueries({queryKey:["wishlist-items"]}),t("/my-rewards"))}})}if(u){const F=Mi[u.rarity]||Mi.common,Pe=((ft=u.sizes)==null?void 0:ft.split(",").map(rt=>rt.trim()).filter(Boolean))||[],G=(u.type==="Spins"||u.type==="Ad Points")&&u.rarity==="common",et=!G&&(u.rarity==="rare"||u.rarity==="legendary"),ze=!G&&(u.rarity==="rare"||u.rarity==="legendary"&&Q),ie=Q?0:Number(u.shipping_fee)||0,be=[];u.image_url&&be.push(u.image_url),(Rt=u.variation_images)!=null&&Rt.length&&be.push(...u.variation_images);const Ce=Array.isArray(u.color_options)?u.color_options:[],$e=N!==null&&((lt=Ce[N])!=null&&lt.image_url)?Ce[N].image_url:be[I]||null,ct=()=>O(rt=>Math.max(0,rt-1)),_t=()=>O(rt=>Math.min(be.length-1,rt+1));return s.jsxs("div",{className:"min-h-screen bg-black text-white font-['Antigone',sans-serif] flex flex-col",children:[s.jsxs("div",{className:"flex items-center gap-3 px-4 py-4",children:[s.jsxs("button",{onClick:()=>{f(null),k(null),A(null),O(0)},className:"flex items-center gap-1 text-white hover:text-neutral-300 transition-colors",children:[s.jsx(jl,{className:"w-6 h-6"}),s.jsx("span",{className:"font-bold text-sm",children:"BACK"})]}),s.jsx("h1",{className:"flex-1 text-2xl font-black leading-tight text-right",children:u.title})]}),s.jsxs("div",{className:"px-4 mb-4 md:max-w-md md:mx-auto lg:max-w-lg",children:[s.jsxs("div",{className:"relative rounded-2xl overflow-hidden bg-neutral-800 aspect-square",children:[$e?s.jsx("img",{src:$e,alt:u.title,className:"w-full h-full object-cover"}):s.jsx("div",{className:"w-full h-full flex items-center justify-center",children:s.jsx("span",{className:"text-6xl",children:"🎁"})}),s.jsx("span",{className:`absolute bottom-3 right-3 ${F.bg} ${F.text} px-4 py-1.5 rounded-lg font-black text-sm`,children:u.rarity.charAt(0).toUpperCase()+u.rarity.slice(1)}),be.length>1&&N===null&&s.jsxs(s.Fragment,{children:[s.jsx("button",{onClick:ct,className:"absolute left-2 top-1/2 -translate-y-1/2 bg-black/50 hover:bg-black/70 rounded-full p-1.5 transition-colors",children:s.jsx(Rn,{className:"w-5 h-5"})}),s.jsx("button",{onClick:_t,className:"absolute right-2 top-1/2 -translate-y-1/2 bg-black/50 hover:bg-black/70 rounded-full p-1.5 transition-colors",children:s.jsx(Jd,{className:"w-5 h-5"})})]})]}),be.length>1&&s.jsx("div",{className:"flex gap-2 mt-3 overflow-x-auto pb-1",children:be.map((rt,mt)=>s.jsx("button",{onClick:()=>{O(mt),k(null)},className:`w-14 h-14 rounded-lg overflow-hidden border-2 flex-shrink-0 transition-all ${I===mt&&N===null?"border-yellow-500":"border-neutral-700"}`,children:s.jsx("img",{src:rt,alt:`View ${mt+1}`,className:"w-full h-full object-cover"})},mt))})]}),Ce.length>0&&s.jsxs("div",{className:"px-4 mb-4",children:[s.jsx("h3",{className:"text-yellow-400 font-black text-lg mb-2",children:"Colors"}),s.jsx("div",{className:"flex gap-3 flex-wrap",children:Ce.map((rt,mt)=>s.jsxs("button",{onClick:()=>k(N===mt?null:mt),className:`flex items-center gap-2 px-3 py-2 rounded-xl border-2 transition-all ${N===mt?"border-yellow-500 bg-neutral-800":"border-neutral-700 hover:border-neutral-500"}`,children:[s.jsx("div",{className:"w-6 h-6 rounded-full border border-neutral-500",style:{backgroundColor:rt.hex}}),s.jsx("span",{className:"text-sm font-bold",children:rt.name})]},mt))})]}),Pe.length>0&&s.jsxs("div",{className:"px-4 mb-4",children:[s.jsx("h3",{className:"text-yellow-400 font-black text-lg mb-2",children:"Sizes"}),s.jsx("div",{className:"flex gap-2 flex-wrap",children:Pe.map(rt=>{const mt=C===rt;return s.jsx("button",{type:"button",onClick:()=>A(mt?null:rt),className:`font-black text-sm px-3 py-2 rounded-lg flex items-center justify-center whitespace-nowrap border-2 transition-all ${mt?"bg-yellow-500 text-black border-yellow-300":"bg-green-600 text-white border-transparent hover:border-yellow-400"}`,children:rt},rt)})}),C&&s.jsxs("p",{className:"text-xs text-neutral-400 mt-2",children:["Selected size: ",s.jsx("span",{className:"text-white font-bold",children:C})]})]}),u.delivery!=="digital"&&s.jsxs("div",{className:"px-4 mb-4",children:[s.jsx("h3",{className:"text-yellow-400 font-black text-lg mb-1",children:"Ships only to:"}),s.jsx("div",{className:"flex gap-2 text-2xl",children:"🇺🇸 🇬🇧"})]}),u.brief&&s.jsx("div",{className:"px-4 mb-4",children:s.jsx("p",{className:"text-neutral-400 text-sm",children:u.brief})}),s.jsxs("div",{className:"px-4 mb-4",children:[s.jsxs("p",{className:"text-neutral-400 text-sm",children:["Cost: ",s.jsxs("span",{className:"text-white font-bold",children:["🪙 ",u.minutes_cost," Minutes"]})]}),G&&s.jsxs("div",{className:"mt-3 bg-purple-500/10 border border-purple-500/30 rounded-xl px-4 py-3",children:[s.jsxs("p",{className:"text-purple-400 font-black text-sm",children:[u.type==="Spins"?"🎰":"⚡"," You'll receive: ",s.jsxs("span",{className:"text-white",children:[u.grant_amount||0," ",u.type==="Spins"?"Spin Tokens":"Ad Points"]})]}),s.jsx("p",{className:"text-neutral-400 text-[10px] mt-1",children:u.type==="Spins"?"Spin tokens can be used in Spin to Win (Events). They bypass the daily limit!":"Ad points let you promote your content to other users."})]}),!G&&Q&&ie===0&&Number(u.shipping_fee)>0&&s.jsx("p",{className:"text-purple-400 text-xs font-bold mt-1",children:"👑 FREE SHIPPING (Premium VIP)"}),u.rarity==="legendary"&&Number(u.cashout_value)>0&&s.jsxs("div",{className:"mt-3 bg-green-500/10 border border-green-500/30 rounded-xl px-4 py-3",children:[s.jsxs("p",{className:"text-green-400 font-black text-sm",children:["💰 Or Cash Out 
471🔺$",Number(u.cashout_value).toFixed(2),"!"]}),s.jsx("p",{className:"text-neutral-400 text-[10px] mt-1",children:"Legendary items have real monetary value that can be cashed out if you win! The value increases the more it sits unredeemed."})]})]}),s.jsx("div",{className:"mt-auto px-4 pb-2",children:s.jsxs("div",{className:"bg-neutral-800 border border-neutral-700 rounded-xl px-4 py-3 text-center",children:[s.jsx("p",{className:"text-neutral-400 text-sm",children:"Your Balance"}),s.jsxs("p",{className:"text-green-400 font-black text-2xl",children:["🪙 ",me??0," Minutes"]})]})}),s.jsxs("div",{className:"px-4 pb-6 pt-2 space-y-2",children:[et&&ze&&Wt.length>=3&&s.jsx("button",{onClick:()=>Qt(u),disabled:(me??0)<u.minutes_cost,className:`w-full font-black text-lg py-4 rounded-xl transition-colors shadow-lg flex items-center justify-center gap-2 ${(me??0)<u.minutes_cost?"bg-neutral-700 text-neutral-400 cursor-not-allowed":u.rarity==="legendary"?"bg-gradient-to-r from-amber-500 to-orange-500 text-black shadow-amber-900/30":"bg-gradient-to-r from-blue-500 to-indigo-500 text-white shadow-blue-900/30"}`,children:(me??0)<u.minutes_cost?`🪙 Need ${u.minutes_cost} Minutes to Spin`:s.jsxs(s.Fragment,{children:["🎰 Spin to Win",Q&&u.rarity==="legendary"&&s.jsx("span",{className:"text-xs bg-black/20 px-2 py-0.5 rounded-full",children:"+ Re-spin"})]})}),et&&!ze&&u.rarity==="legendary"&&s.jsxs("div",{className:"bg-amber-500/10 border border-amber-500/30 rounded-xl px-4 py-4 text-center space-y-2",children:[s.jsx("p",{className:"text-amber-400 font-black text-base",children:"👑 PREMIUM VIP ONLY"}),s.jsxs("p",{className:"text-neutral-300 text-sm leading-snug",children:["Legendary items can only be won through ",s.jsx("span",{className:"text-amber-400 font-bold",children:"Spin to Win"})," by ",s.jsx("span",{className:"text-amber-400 font-bold",children:"Premium VIP"})," members."]}),s.jsx("p",{className:"text-neutral-500 text-xs",children:"Upgrade to Premium VIP ($9.99/mo) to unlock legendary spins, cash-out rewards, re-spins & more."})]}),!et&&u.type!=="Spins"&&u.type!=="Ad Points"&&s.jsx("button",{onClick:()=>p(!0),disabled:(me??0)<u.minutes_cost,className:`w-full font-black text-xl py-4 rounded-xl transition-colors shadow-lg ${(me??0)>=u.minutes_cost?"bg-green-600 hover:bg-green-700 text-white shadow-green-900/30":"bg-neutral-700 text-neutral-400 cursor-not-allowed"}`,children:"Redeem This Product"}),G&&s.jsx("button",{onClick:()=>Ve(u),disabled:D||(me??0)<u.minutes_cost,className:`w-full font-black text-xl py-4 rounded-xl transition-colors shadow-lg ${(me??0)>=u.minutes_cost?u.type==="Spins"?"bg-gradient-to-r from-purple-500 to-pink-500 text-white shadow-purple-900/30 hover:scale-105 active:scale-95":"bg-gradient-to-r from-blue-500 to-cyan-500 text-white shadow-blue-900/30 hover:scale-105 active:scale-95":"bg-neutral-700 text-neutral-400 cursor-not-allowed"}`,children:D?"Redeeming...":u.type==="Spins"?`🎰 Redeem ${u.grant_amount||0} Spin${(u.grant_amount||0)!==1?"s":""}`:`⚡ Redeem ${u.grant_amount||0} Ad Points`})]})]})}return s.jsxs("div",{className:"min-h-screen bg-black text-white font-['Antigone',sans-serif] flex flex-col",children:[s.jsxs("div",{className:"flex items-center justify-between px-4 py-4",children:[s.jsx("button",{onClick:()=>e?e():t(-1),className:"text-red-500 hover:text-red-400 transition-colors",children:s.jsx(We,{className:"w-8 h-8",strokeWidth:3})}),s.jsx("h1",{className:"text-2xl font-black tracking-widest uppercase",style:{letterSpacing:"0.15em"},children:"REWARD STORE"}),s.jsxs("div",{className:"flex flex-col items-end",children:[s.jsx("span",{className:"text-[10px] text-neutral-400 font-bold uppercase tracking-wide",children:"Balance"}),s.jsxs("span",{className:"text-green-400 font-black text-lg",children:["🪙 ",me??0]})]})]}),Q&&s.jsx("div",{className:"px-4 mb-3",children:s.jsx("div",{className:"bg-purple-500/10 border border-purple-500/30 rounded-full px-4 py-1.5 text-center",children:s.jsx("span",{className:"text-purple-400 text-xs font-black",children:"👑 Premium VIP — Free Shipping on all orders"})})}),Qe&&Qe.length>0&&s.jsx("div",{className:"px-4 mb-3",children:s.jsxs("button",{onClick:()=>R(!0),className:"w-full bg-gradient-to-r from-yellow-500 to-orange-500 text-black font-black text-sm py-3 rounded-2xl flex items-center justify-center gap-2 hover:scale-[1.02] active:scale-95 transition-all shadow-lg",children:[s.jsx(np,{className:"w-5 h-5"}),"🎁 GIFT CARDS (",Qe.reduce((F,Pe)=>F+Pe.count,0)," Available)"]})}),tt.length>0&&s.jsxs("div",{className:"px-4 mb-4",children:[s.jsxs("h3",{className:"font-black text-sm text-pink-400 uppercase tracking-wider mb-2 flex items-center gap-1.5",children:[s.jsx(P4,{className:"w-4 h-4"})," My Goal Items"]}),s.jsx("div",{className:"space-y-2",children:tt.map((F,Pe)=>{const Z=F.status==="rejected",G=!Z&&Pe===tt.findIndex(ie=>ie.status==="active"),et=Z?0:Math.min(100,(me??0)/F.minutes_cost*100),ze=!Z&&G&&(me??0)>=F.minutes_cost;return s.jsxs("div",{className:`bg-neutral-900 border rounded-xl p-3 flex items-center gap-3 ${Z?"border-red-500/30 opacity-70":G?"border-pink-500/50":"border-neutral-700/50"}`,children:[F.image_url?s.jsx("img",{src:F.image_url,alt:F.title,className:"w-14 h-14 roun
471ded-lg object-cover flex-shrink-0"}):s.jsx("div",{className:"w-14 h-14 rounded-lg bg-neutral-800 flex items-center justify-center text-2xl flex-shrink-0",children:"🎁"}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("p",{className:"font-bold text-sm text-white truncate",children:F.title}),Z&&s.jsx("span",{className:"bg-red-500/20 text-red-400 text-[10px] font-bold px-2 py-0.5 rounded-full flex-shrink-0",children:"REJECTED"}),!Z&&G&&s.jsx("span",{className:"bg-pink-500/20 text-pink-400 text-[10px] font-bold px-2 py-0.5 rounded-full flex-shrink-0",children:"NEXT UP"}),!Z&&!G&&s.jsx("span",{className:"bg-neutral-700/50 text-neutral-500 text-[10px] font-bold px-2 py-0.5 rounded-full flex-shrink-0",children:"QUEUED"})]}),Z?s.jsx("p",{className:"text-red-400/80 text-xs mt-1",children:"This item was rejected — it doesn't meet our guidelines. Try picking a different item."}):s.jsxs(s.Fragment,{children:[s.jsxs("p",{className:"text-neutral-500 text-xs",children:["🪙 ",F.minutes_cost," Minutes needed"]}),s.jsx("div",{className:"mt-1.5 h-2 bg-neutral-800 rounded-full overflow-hidden",children:s.jsx("div",{className:`h-full rounded-full transition-all duration-500 ${ze?"bg-green-500":"bg-pink-500"}`,style:{width:`${et}%`}})}),s.jsx("p",{className:"text-[10px] text-neutral-500 mt-0.5",children:ze?"✅ Ready to spin! (Guaranteed win!)":G?`${Math.round(et)}% — ${F.minutes_cost-(me??0)} more to go`:`${Math.round(et)}% — complete previous items first`})]})]}),s.jsxs("div",{className:"flex flex-col gap-1.5 flex-shrink-0",children:[ze&&s.jsx("button",{onClick:()=>{const ie={id:F.id,title:F.title,image_url:F.image_url,rarity:"rare",minutes_cost:F.minutes_cost,cashout_value:0,type:"Product",_isWishlist:!0,_wishlistSourceUrl:F.source_url};Qt(ie)},className:"bg-green-600 hover:bg-green-700 text-white font-black text-[10px] px-3 py-1.5 rounded-lg transition-colors",children:"🎰 SPIN"}),s.jsx("button",{onClick:async()=>{await S.from("wishlist_items").update({status:"removed"}).eq("id",F.id),an(),B.success("Item removed from goals")},className:"text-neutral-600 hover:text-red-400 transition-colors p-1",children:s.jsx(th,{className:"w-3.5 h-3.5"})})]})]},F.id)})})]}),o?s.jsx("div",{className:"flex-1 flex items-center justify-center",children:s.jsx("div",{className:"w-10 h-10 border-4 border-white/30 border-t-white rounded-full animate-spin"})}):c?s.jsxs("div",{className:"flex-1 px-4 pb-6",children:[s.jsxs("button",{onClick:()=>d(null),className:"flex items-center gap-2 text-neutral-400 hover:text-white mb-4 transition-colors",children:[s.jsx(jl,{className:"w-5 h-5"}),s.jsx("span",{className:"font-bold",children:"Back to Categories"})]}),s.jsx("h2",{className:"text-2xl font-black mb-4",children:((on=l==null?void 0:l.find(F=>F.id===c))==null?void 0:on.name)||"Rewards"}),le!=null&&le.length?s.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 gap-3",children:le.map(F=>s.jsx(oy,{reward:F,onClick:()=>f(F),isPremiumVip:Q},F.id))}):s.jsx("p",{className:"text-neutral-500 text-center py-10",children:"No rewards in this category yet."})]}):s.jsx("div",{className:"flex-1 px-4 pb-6",children:!(de!=null&&de.length)&&!(i!=null&&i.length)?s.jsx("p",{className:"text-neutral-500 text-center py-10",children:"No rewards available yet. Start chatting to unlock!"}):s.jsxs(s.Fragment,{children:[de&&de.length>0&&s.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 gap-3 mb-6",children:de.map(F=>
471{const Pe=F.show_as==="As VIP Reward",Z=Pe&&!r;return s.jsxs("button",{onClick:()=>{if(Z){B("👑 VIP members only! Subscribe to unlock exclusive rewards.",{icon:"🔒",action:{label:"Become VIP",onClick:()=>t("/videocall",{state:{openVip:!0}})},duration:5e3});return}d(F.id)},className:`relative rounded-2xl overflow-hidden bg-neutral-800 aspect-square group text-left ${Z?"cursor-not-allowed":""}`,children:[F.image_url?s.jsx("img",{src:F.image_url,alt:F.name,className:`w-full h-full object-cover transition-transform duration-300 ${Z?"blur-[6px] scale-105":"group-hover:scale-105"}`}):s.jsx("div",{className:`w-full h-full bg-gradient-to-br from-neutral-700 to-neutral-900 flex items-center justify-center ${Z?"blur-[6px]":""}`,children:s.jsx("span",{className:"text-4xl",children:"📦"})}),s.jsx("div",{className:"absolute inset-0 bg-gradient-to-t from-black/80 via-black/20 to-transparent"}),Z&&s.jsxs("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-[2px] flex flex-col items-center justify-center z-10",children:[s.jsx("div",{className:"bg-gradient-to-br from-amber-500 to-yellow-600 rounded-full p-3 mb-2 shadow-lg shadow-amber-500/30",children:s.jsx(cs,{className:"w-6 h-6 text-black"})}),s.jsx("p",{className:"font-black text-xs text-amber-400 tracking-wider",children:"VIP ONLY"})]}),s.jsx("div",{className:"absolute top-3 left-3 z-20",children:s.jsxs("div",{className:"flex items-center gap-1.5",children:[Pe&&s.jsx(cs,{className:"w-4 h-4 text-amber-400"}),s.jsx("p",{className:"font-black text-base text-white drop-shadow-lg",children:F.name})]})}),s.jsx("div",{className:"absolute bottom-3 left-3 z-20",children:s.jsx("span",{className:"bg-black/60 backdrop-blur-sm text-white font-bold text-xs px-3 py-1.5 rounded-lg",children:Z?"🔒 Unlock with VIP":`${F.count} Items`})})]},F.id)})}),(!de||de.length===0)&&i&&i.length>0&&s.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 gap-3",children:i.map(F=>s.jsx(oy,{reward:F,onClick:()=>f(F),isPremiumVip:Q},F.id))})]})}),Re&&s.jsx("div",{className:"fixed inset-0 z-[200] bg-black/80 flex items-center justify-center px-4",children:s.jsxs("div",{className:"bg-neutral-900 border border-neutral-700 rounded-3xl p-6 w-full max-w-sm space-y-4",children:[s.jsx("h3",{className:"font-black text-lg text-center text-white",children:"💰 Enter Your PayPal"}),s.jsxs("p",{className:"text-neutral-400 text-sm text-center",children:["We'll send ",s.jsxs("span",{className:"text-green-400 font-black",children:["$",Number(Re.cashout_value).toFixed(2)]})," to your PayPal account."]}),s.jsx("input",{type:"email",placeholder:"[email protected]",value:fe,onChange:F=>ge(F.target.value),className:"w-full bg-white/10 border-2 border-white/20 rounded-xl px-4 py-3 font-bold text-white placeholder:text-white/40 focus:outline-none focus:border-green-500/50"}),s.jsx("button",{disabled:J||!fe.includes("@"),onClick:async()=>{ue(!0);try{const{error:F}=await S.functions.invoke("redeem-reward",{body:{action:"cashout-legendary",rewardId:Re.id,paypalEmail:fe.trim()}});if(F)throw F;B.success(`💰 Cashed out $${Number(Re.cashout_value).toFixed(2)}! Payment will be sent to ${fe.trim()}`),Y.invalidateQueries({queryKey:["user-minutes-balance"]}),Y.invalidateQueries({queryKey:["public-rewards"]}),g(null),T([]),ye(null)}catch(F){B.error(F.message||"Cashout failed")}ue(!1)},className:`w-full py-4 rounded-full font-black text-lg transition-all shadow-lg ${!fe.includes("@")||J?"bg-neutral-700 text-neutral-400 cursor-not-allowed":"bg-gradient-to-r from-green-500 to-emerald-500 text-white hover:scale-105 active:scale-95"}`,children:J?"Processing...":"💰 CONFIRM CASHOUT"}),s.jsx("button",{onClick:()=>ye(null),className:"w-full py-3 text-neutral-400 font-bold text-sm hover:text-white transition-colors",children:"Cancel"})]})})]})},kO=Object.freeze(Object.defineProperty({__proto__:null,default:Fj},Symbol.toStringTag,{value:"Module"})),ly=["#FF6B35","#004E89","#F5CB5C","#2EC4B6","#E71D36","#9B5DE5","#00F5D4","#FF006E"],gu={product_points:"🎁",ad_points:"⭐",bonus_minutes:"🪙",unfreeze:"❄️",vip_week:"👑",gift_card:"💳",chance_enhancer:"🔥"},SO=[{spins:1,price:"0.99"},{spins:2,price:"1.99"},{spins:3,price:"2.50"}],CO=({onClose:e})=>{const{user:t}=it(),n=wt(),r=h.useRef(null),[a,i]=h.useState(!1),[o,l]=h.useState(0),[c,d]=h.useState(null),[u,f]=h.useState(!1),[m,p]=h.useState(!1),[v,g]=h.useState("spin"),[y,b]=h.useState(null),x=h.useRef(0),[w]=I0();h.useEffect(()=>{const T=w.get("spin_purchased");T&&t&&S.functions.invoke("buy-spins",{body:{type:"verify_purchase",spins:Number(T)}}).then(()=>{B.success(`${T} spin(s) added to your account!`),n.invalidateQueries({queryKey:["spin-balance"]})})},[w,t]);const{data:_=[]}=he({queryKey:["spin-prizes"],queryFn:async()=>{const{data:T}
471=await S.functions.invoke("spin-wheel",{body:{type:"get_prizes"}});return(T==null?void 0:T.prizes)||[]}}),{data:j}=he({queryKey:["spin-balance",t==null?void 0:t.id],enabled:!!t,queryFn:async()=>{const{data:T}=await S.from("member_minutes").select("purchased_spins").eq("user_id",t.id).maybeSingle();return(T==null?void 0:T.purchased_spins)??0}}),{data:N}=he({queryKey:["chance-enhancer",t==null?void 0:t.id],enabled:!!t,queryFn:async()=>{const{data:T}=await S.functions.invoke("spin-wheel",{body:{type:"get_chance_enhancer",userId:t.id}});return T||{chance_enhancer:10,is_vip:!1}}});h.useEffect(()=>{t&&S.functions.invoke("spin-wheel",{body:{type:"update_login",userId:t.id}})},[t]);const{data:k}=he({queryKey:["spin-today",t==null?void 0:t.id],enabled:!!t,queryFn:async()=>{const T=new Date().toISOString().split("T")[0],{data:E}=await S.from("spin_results").select("id").eq("user_id",t.id).gte("created_at",T+"T00:00:00Z").lte("created_at",T+"T23:59:59Z").limit(1);return E&&E.length>0}}),{data:C=[]}=he({queryKey:["spin-history",t==null?void 0:t.id],enabled:!!t&&v==="history",queryFn:async()=>{const{data:T}=await S.from("spin_results").select("*").eq("user_id",t.id).order("created_at",{ascending:!1}).limit(50);return T||[]}});h.useEffect(()=>{if(!r.current||_.length===0)return;const T=r.current,E=T.getContext("2d"),W=T.width,V=W/2,q=V-8,D=2*Math.PI/_.length;E.clearRect(0,0,W,W),E.save(),E.translate(V,V),E.rotate(o*Math.PI/180),E.translate(-V,-V),_.forEach(($,z)=>{const R=z*D,U=R+D;E.beginPath(),E.moveTo(V,V),E.arc(V,V,q,R,U),E.closePath(),E.fillStyle=ly[z%ly.length],E.fill(),E.strokeStyle="#000",E.lineWidth=2,E.stroke(),E.save(),E.translate(V,V),E.rotate(R+D/2),E.textAlign="right",E.fillStyle="#fff",E.font="bold 11px sans-serif",E.shadowColor="#000",E.shadowBlur=3;const ee=gu[$.prize_type]||"🎯",ae=$.label.length>16?$.label.slice(0,15)+"…":$.label;E.fillText(`${ee} ${ae}`,q-12,4),E.restore()}),E.restore(),E.beginPath(),E.arc(V,V,20,0,2*Math.PI),E.fillStyle="#1a1a2e",E.fill(),E.strokeStyle="#FFD700",E.lineWidth=3,E.stroke(),E.fillStyle="#FFD700",E.font="bold 14px sans-serif",E.textAlign="center",E.textBaseline="middle",E.fillText("SPIN",V,V)},[_,o]);const A=async T=>{if(a||!t)return;i(!0),f(!1),d(null);const{data:E}=await S.functions.invoke("spin-wheel",{body:{type:"spin",userId:t.id,use_purchased:T}});if(!(E!=null&&E.success)){(E==null?void 0:E.message)==="already_spun_today"?B.error("You already used your free spin today!"):(E==null?void 0:E.message)==="no_purchased_spins"?B.error("No purchased spins left. Buy more!"):B.error("Could not spin. Try again."),i(!1);return}const W=E.prize,V=_.findIndex(te=>te.id===W.id),q=360/_.length,D=V*q+q/2,z=5*360+(360-D),R=o%360,U=z,ee=4e3,ae=Date.now(),xe=()=>{const te=Date.now()-ae,ce=Math.min(te/ee,1),Re=1-Math.pow(1-ce,3),ye=R+U*Re;l(ye),ce<1?x.current=requestAnimationFrame(xe):(l(ye),d(W),f(!0),i(!1),n.invalidateQueries({queryKey:["spin-today"]}),n.invalidateQueries({queryKey:["spin-balance"]}),n.invalidateQueries({queryKey:["profile-balance"]}),n.invalidateQueries({queryKey:["spin-history"]}),n.invalidateQueries({queryKey:["chance-enhancer"]}))};x.current=requestAnimationFrame(xe)},I=async T=>{if(t){b(T);try{const{data:E}=await S.functions.invoke("buy-spins",{body:{type:"create_checkout",spins:T}});E!=null&&E.url?window.location.href=E.url:B.error("Could not create checkout")}catch{B.error("Something went wrong")}b(null)}};h.useEffect(()=>()=>{x.current&&cancelAnimationFrame(x.current)},[]);const O=k===!0,P=(j??0)>0;return s.jsxs("div",{className:"min-h-screen bg-black text-white font-['Antigone',sans-serif] flex flex-col items-center px-4 pb-8",children:[s.jsx("div",{className:"w-full flex items-center pt-3 pb-2",children:s.jsxs("button",{onClick:e,className:"flex items-center gap-1 hover:opacity-80 transition-opacity",children:[s.jsx(Rn,{className:"w-7 h-7"}),s.jsx("span",{className:"font-black text-sm tracking-wider",children:"BACK"})]})}),s.jsxs("div",{className:"flex gap-2 w-full max-w-sm mb-4",children:[s.jsx("button",{onClick:()=>g("spin"),className:`flex-1 py-2 rounded-full font-black text-sm transition-all ${v==="spin"?"bg-yellow-500 text-black":"bg-neutral-800 text-neutral-400"}`,children:"🎰 SPIN"}),s.jsxs("button",{onClick:()=>g("history"),className:`flex-1 py-2 rounded-full font-black text-sm transition-all ${v==="history"?"bg-yellow-500 text-black":"bg-neutral-800 text-neutral-400"}`,children:[s.jsx(ds,{className:"w-4 h-4 inline mr-1"}),"PAST WINS"]})]}),v==="spin"?s.jsxs(s.Fragment,{children:[s.jsx("h1",{className:"text-2xl font-black tracking-wide mt-1 mb-1",children:"🎰 SPIN TO WIN"}),s.jsx("p",{className:"text-neutral-400 text-xs mb-2 text-center",children:"Every spin guarantees a reward!"}),N&&s.jsxs("div",{className:"bg-orange-500/10 border border-orange-500/30 rounded-full px-4 py-1.5 mb-3 flex items-center gap-2",children:[s.jsxs("span",{className:"text-orange-400 text-xs font-black",children:["🔥 Chance Enhancer: +",Math.round(N.chance_enhancer),"%"]}),N.is_vip&&s.jsx("span",{className:"text-[10px] bg-purple-500/20 text-purple-400 px-1.5 py-0.5 rounded font-bold",children:"VIP"})]}),P&&s.jsx("div",{className:"bg-yellow-500/10 border border-yellow-500/30 rounded-full px-4 py-1 mb-3",children:s.jsxs("span",{className:"text-yellow-400 text-xs font-black",children:["🎟️ ",j," purchased 
471spin",j!==1?"s":""," available"]})}),s.jsxs("div",{className:"relative mb-4",children:[s.jsx("div",{className:"absolute top-0 left-1/2 -translate-x-1/2 -translate-y-1 z-10",children:s.jsx("div",{className:"w-0 h-0 border-l-[12px] border-r-[12px] border-t-[20px] border-l-transparent border-r-transparent border-t-yellow-400 drop-shadow-lg"})}),s.jsx("canvas",{ref:r,width:300,height:300,className:"rounded-full shadow-2xl border-4 border-yellow-500/50"})]}),s.jsxs("div",{className:"w-full max-w-xs space-y-2 mb-4",children:[s.jsx("button",{onClick:()=>A(!1),disabled:a||O||_.length===0,className:`w-full py-3 rounded-full font-black text-lg tracking-wide shadow-lg transition-all ${a?"bg-neutral-700 text-neutral-400 cursor-wait":O?"bg-neutral-800 text-neutral-500 cursor-not-allowed":"bg-gradient-to-r from-yellow-500 to-orange-500 text-black hover:scale-105 active:scale-95"}`,children:a?"SPINNING...":O?"FREE SPIN USED":"🎰 FREE SPIN!"}),P&&s.jsxs("button",{onClick:()=>A(!0),disabled:a,className:`w-full py-3 rounded-full font-black text-base tracking-wide shadow-lg transition-all ${a?"bg-neutral-700 text-neutral-400 cursor-wait":"bg-gradient-to-r from-purple-500 to-pink-500 text-white hover:scale-105 active:scale-95"}`,children:["🎟️ USE PURCHASED SPIN (",j," left)"]}),s.jsxs("button",{onClick:()=>p(!m),className:"w-full py-2.5 rounded-full font-black text-sm tracking-wide border-2 border-red-500 text-red-400 hover:bg-red-500 hover:text-white transition-all flex items-center justify-center gap-2",children:[s.jsx(S4,{className:"w-4 h-4"}),"BUY SPINS"]})]}),m&&s.jsxs("div",{className:"w-full max-w-xs space-y-3 mb-6 animate-in slide-in-from-top-2 duration-200",children:[s.jsxs("h3",{className:"font-black text-center text-sm text-neutral-300",children:["Every spin wins a reward.",s.jsx("br",{}),"Rare prizes inside."]}),SO.map(T=>s.jsx("button",{onClick:()=>I(T.spins),disabled:y!==null,className:"w-full bg-red-600 hover:bg-red-500 text-white font-black text-lg py-3 rounded-full transition-all shadow-lg disabled:opacity-50 flex items-center justify-center gap-3",children:y===T.spins?"Processing...":s.jsxs(s.Fragment,{children:[s.jsxs("span",{children:[T.spins," Spin",T.spins>1?"s":""]}),s.jsx("span",{children:T.price})]})},T.spins))]}),s.jsxs("div",{className:"w-full max-w-sm",children:[s.jsx("h3",{className:"font-black text-sm mb-2 text-neutral-400",children:"POSSIBLE PRIZES"}),s.jsx("div",{className:"space-y-1.5",children:_.map(T=>s.jsxs("div",{className:"flex items-center justify-between bg-neutral-900 rounded-xl px-3 py-2 border border-neutral-800",children:[s.jsxs("span",{className:"text-sm font-bold",children:[gu[T.prize_type]||"🎯"," ",T.label]}),s.jsxs("span",{className:"text-xs text-neutral-500",children:[T.chance_percent,"%"]})]},T.id))})]})]}):s.jsxs("div",{className:"w-full max-w-sm",children:[s.jsx("h2",{className:"text-2xl font-black tracking-wide mb-4 text-center",children:"🏆 PAST WINS"}),C.length===0?s.jsx("p",{className:"text-neutral-500 text-sm text-center",children:"No spins yet. Try your luck!"}):s.jsx("div",{className:"space-y-2",children:C.map(T=>s.jsxs("div",{className:"flex items-center justify-between bg-neutral-900 rounded-xl px-4 py-3 border border-neutral-800",children:[s.jsxs("div",{children:[s.jsxs("span",{className:"font-bold text-sm",children:[gu[T.prize_type]||"🎯"," ",T.prize_label]}),s.jsxs("p",{className:"text-[10px] text-neutral-500",children:[new Date(T.created_at).toLocaleDateString()," at ",new Date(T.created_at).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})]})]}),s.jsx("span",{className:"text-green-400 text-xs font-black",children:"WON"})]},T.id))})]}),u&&c&&s.jsx("div",{className:"fixed inset-0 bg-black/80 z-50 flex items-center justify-center p-4",children:s.jsxs("div",{className:"bg-gradient-to-b from-neutral-900 to-neutral-950 border border-yellow-500/40 rounded-3xl p-8 max-w-sm w-full text-center animate-in zoom-in-90 duration-300",children:[s.jsx("div",{className:"text-6xl mb-4",children:"🎉"}),s.jsx("h2",{className:"text-2xl font-black mb-2",children:"YOU WON!"}),s.jsx("div",{className:"bg-yellow-500/10 border border-yellow-500/30 rounded-2xl p-4 mb-6",children:s.jsxs("p",{className:"text-xl font-black text-yellow-400",children:[gu[c.prize_type]||"🎯"," ",c.label]})}),s.jsx("button",{onClick:()=>f(!1),className:"w-full bg-yellow-500 text-black font-black py-3 rounded-full hover:bg-yellow-400 transition-colors",children:"AWESOME!"})]})})]})},EO=({onClose:e,onSuccess:t})=>{const{user:n}
471=it(),[r,a]=h.useState(""),[i,o]=h.useState(!1),{data:l,refetch:c}=he({queryKey:["referral_cashout_summary",n==null?void 0:n.id],enabled:!!n,queryFn:async()=>{const{data:x,error:w}=await S.functions.invoke("referral",{body:{action:"cashout_summary"}});if(w)throw w;return x}}),d=Number((l==null?void 0:l.totalEarned)??0),u=Number((l==null?void 0:l.totalCashedOut)??0),f=Number((l==null?void 0:l.available)??0),m=!!(l!=null&&l.hasPending),p=(l==null?void 0:l.history)??[],v=!m&&f>0,g=async()=>{if(!r.includes("@")){B.error("Enter a valid PayPal email");return}o(!0);try{const{data:x,error:w}=await S.functions.invoke("referral",{body:{action:"request_cashout",paypal_email:r}});if(w)throw w;if(x!=null&&x.error)throw new Error(x.error);B.success(`💰 Cashout request submitted for $${x.cash_amount}!`),t(),c()}catch(x){B.error(x.message||"Cashout failed")}finally{o(!1)}},y=x=>x==="pending"?s.jsx(er,{className:"w-3.5 h-3.5 text-amber-400"}):x==="approved"||x==="paid"?s.jsx(ra,{className:"w-3.5 h-3.5 text-emerald-400"}):s.jsx(Xd,{className:"w-3.5 h-3.5 text-red-400"}),b=x=>x==="pending"?"text-amber-400":x==="approved"||x==="paid"?"text-emerald-400":"text-red-400";return s.jsx("div",{className:"fixed inset-0 z-[70] bg-black/80 flex items-center justify-center px-4",onClick:e,children:s.jsxs("div",{className:"bg-neutral-900 border border-white/10 rounded-2xl p-6 w-full max-w-md relative max-h-[90vh] overflow-y-auto",onClick:x=>x.stopPropagation(),children:[s.jsx("button",{onClick:e,className:"absolute top-4 right-4 text-white/40 hover:text-white",children:s.jsx(We,{className:"w-5 h-5"})}),s.jsxs("div",{className:"text-center mb-5",children:[s.jsx("div",{className:"w-14 h-14 rounded-full bg-emerald-500/20 flex items-center justify-center mx-auto mb-3",children:s.jsx(Ur,{className:"w-7 h-7 text-emerald-400"})}),s.jsx("h2",{className:"text-white font-bold text-xl",children:"Referral Cashout"}),s.jsx("p",{className:"text-white/50 text-sm mt-1",children:"Cash earned from inviting friends who signed up and chatted"})]}),s.jsxs("div",{className:"bg-white/5 border border-white/10 rounded-xl p-4 mb-5 space-y-2.5",children:[s.jsxs("div",{className:"flex justify-between items-center",children:[s.jsx("span",{className:"text-white/60 text-sm",children:"🎁 Total Referral Earnings"}),s.jsxs("span",{className:"text-emerald-400 font-bold text-base",children:["$",d.toFixed(2)]})]}),s.jsxs("div",{className:"flex justify-between items-center",children:[s.jsx("span",{className:"text-white/60 text-sm",children:"💸 Already Cashed Out"}),s.jsxs("span",{className:"text-white/60 font-bold text-base",children:["$",u.toFixed(2)]})]}),s.jsxs("div",{className:"border-t border-white/10 pt-2 flex justify-between items-center",children:[s.jsx("span",{className:"text-white/60 text-sm",children:"💰 Available to Cash Out"}),s.jsxs("span",{className:"text-emerald-400 font-bold text-xl",children:["$",f.toFixed(2)]})]})]}),f<=0&&!m&&s.jsxs("div",{className:"bg-white/5 border border-white/10 rounded-xl p-5 mb-5 text-center",children:[s.jsx("p",{className:"text-white/40 text-base font-bold",children:"No referral cash available yet"}),s.jsx("p",{className:"text-white/25 text-sm mt-1",children:"Invite friends — you earn when they sign up and chat for 10+ minutes."})]}),f>0&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"mb-4",children:[s.jsx("label",{className:"text-white/60 text-sm block mb-1.5",children:"PayPal Email"}),s.jsx("input",{type:"email",placeholder:"[email protected]",value:r,onChange:x=>a(x.target.value),className:"w-full bg-white/5 border border-white/10 rounded-lg px-4 py-3 text-white text-base placeholder:text-white/30 focus:outline-none focus:border-emerald-500/50"})]}),m&&s.jsxs("div",{className:"bg-amber-500/10 border border-amber-500/20 rounded-xl p-4 mb-4",children:[s.jsx("p",{className:"text-amber-400 text-sm font-bold",children:"⏳ Pending cashout"}),s.jsx("p",{className:"text-white/50 text-sm mt-1",children:"You already have a pending referral cashout. Please wait for it to be processed."})]}),s.jsxs("button",{onClick:g,disabled:i||!v||!r.includes("@"),className:"w-full bg-emerald-500 hover:bg-emerald-400 text-black font-bold py-3.5 rounded-xl transition-colors disabled:opacity-50 text-base flex items-center justify-center gap-2",children:[s.jsx($t,{className:"w-5 h-5"}),i?"Submitting...":m?"Pending Request...":`Cash Out $${f.toFixed(2)}`]}),s.jsx("p",{className:"text-white/30 text-xs text-center mt-2.5",children:"Paid via PayPal • Admin approval required"})]}),p.length>0&&s.jsxs("div",{className:"mt-5 border-t border-white/10 pt-4",children:[s.jsx("h3",{className:"text-white/70 text-sm font-bold uppercase tracking-wider mb-3",children:"Cashout History"}),s.jsx("div",{className:"space-y-2.5 max-h-40 overflow-y-auto",children:p.map(x=>s.jsxs("div",{className:"bg-white/5 rounded-lg px-4 py-2.5 flex items-center justify-between",children:[s.jsxs("div",{children:[s.jsxs("p",{className:"text-white text-sm font-bold",children:["$",Number(x.cash_amount).toFixed(2)]}),s.jsx("p",{className:"text-white/30 text-xs",children:new Date(x.created_at).toLocaleDateString()})]}),s.jsxs("div",{className:"flex items-center gap-1.5",children:[y(x.status),s.jsx("span",{className:`text-xs font-bold uppercase ${b(x.status)}`,children:x.status})]})]},x.id))})]})]})})},Uj=({onClose:e})=>{var g;const t=sn(),{user:n}
471=it(),[r,a]=h.useState(!1),[i,o]=h.useState(!1),[l,c]=h.useState(!1),d=()=>{e?e():t(-1)},{data:u,refetch:f}=he({queryKey:["my_referrals",n==null?void 0:n.id],enabled:!!n,queryFn:async()=>{const{data:y,error:b}=await S.functions.invoke("referral",{body:{action:"my_referrals"}});return b?{code:null,referrals:[],totalEarned:0,pendingEarnings:0,totalReferrals:0,engagedCount:0}:y}}),m=async()=>{o(!0);try{const{error:y}=await S.functions.invoke("referral",{body:{action:"generate_code"}});if(y)throw y;f(),B.success("Referral code generated!")}catch{B.error("Failed to generate code")}o(!1)},p=u!=null&&u.code?`${window.location.origin}/?ref=${u.code}`:null,v=()=>{p&&(navigator.clipboard.writeText(p),a(!0),B.success("Link copied!"),setTimeout(()=>a(!1),2e3))};return s.jsxs("div",{className:"min-h-screen bg-black text-white font-['Antigone',sans-serif] flex flex-col items-center px-4 pb-8",children:[s.jsx("div",{className:"w-full flex items-center pt-3 pb-2",children:s.jsxs("button",{onClick:d,className:"flex items-center gap-1 hover:opacity-80 transition-opacity",children:[s.jsx(Rn,{className:"w-7 h-7"}),s.jsx("span",{className:"font-black text-sm tracking-wider",children:"BACK"})]})}),s.jsx("h1",{className:"text-3xl font-black tracking-wide mt-4 mb-2",children:"🎁 INVITE FRIENDS"}),s.jsx("p",{className:"text-neutral-400 text-sm mb-6 text-center max-w-sm",children:"Invite friends and get rewarded when they join and start chatting!"}),s.jsxs("div",{className:"grid grid-cols-3 gap-3 w-full max-w-sm mb-6",children:[s.jsxs("div",{className:"bg-neutral-900 rounded-xl p-3 text-center border border-neutral-800",children:[s.jsx(Ur,{className:"w-5 h-5 mx-auto mb-1 text-blue-400"}),s.jsx("p",{className:"text-xl font-black",children:(u==null?void 0:u.totalReferrals)??0}),s.jsx("p",{className:"text-[10px] text-neutral-500 font-bold",children:"INVITED"})]}),s.jsxs("div",{className:"bg-neutral-900 rounded-xl p-3 text-center border border-neutral-800",children:[s.jsx(Mr,{className:"w-5 h-5 mx-auto mb-1 text-green-400"}),s.jsx("p",{className:"text-xl font-black",children:(u==null?void 0:u.engagedCount)??0}),s.jsx("p",{className:"text-[10px] text-neutral-500 font-bold",children:"ENGAGED"})]}),s.jsxs("div",{className:"bg-neutral-900 rounded-xl p-3 text-center border border-neutral-800",children:[s.jsx($t,{className:"w-5 h-5 mx-auto mb-1 text-yellow-400"}),s.jsxs("p",{className:"text-xl font-black",children:["$",((u==null?void 0:u.totalEarned)??0).toFixed(2)]}),s.jsx("p",{className:"text-[10px] text-neutral-500 font-bold",children:"REWARDS"})]})]}),((u==null?void 0:u.pendingEarnings)??0)>0&&s.jsx("div",{className:"w-full max-w-sm bg-yellow-900/30 border border-yellow-600/30 rounded-xl p-3 mb-4 text-center",children:s.jsxs("p",{className:"text-yellow-300 font-bold text-sm",children:["🎁 $",u.pendingEarnings.toFixed(2)," pending reward"]})}),s.jsx("div",{className:"w-full max-w-sm",children:p?s.jsxs("div",{className:"bg-neutral-900 rounded-xl p-4 border border-neutral-800",children:[s.jsx("p",{className:"text-xs text-neutral-400 font-bold mb-2",children:"YOUR REFERRAL LINK"}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("input",{readOnly:!0,value:p,className:"flex-1 bg-neutral-800 border border-neutral-700 rounded-lg px-3 py-2 text-sm text-white truncate"}),s.jsxs("button",{onClick:v,className:"bg-green-600 hover:bg-green-700 text-white font-bold text-sm px-4 py-2 rounded-lg flex items-center gap-1 transition-colors",children:[r?s.jsx(Mr,{className:"w-4 h-4"}):s.jsx(Zd,{className:"w-4 h-4"}),r?"COPIED":"COPY"]})]}),s.jsx("p",{className:"text-[10px] text-neutral-500 mt-2",children:"Share this link — you get rewarded when friends sign up and chat for 10+ minutes!"})]}):s.jsxs("button",{onClick:m,disabled:i,className:"w-full bg-gradient-to-r from-green-500 to-emerald-600 text-white font-black text-lg py-4 rounded-2xl flex items-center justify-center gap-2 hover:opacity-90 transition-opacity",children:[s.jsx(k_,{className:"w-5 h-5"}),i?"GENERATING...":"GET MY REFERRAL LINK"]})}),s.jsxs("button",{onClick:()=>c(!0),className:"w-full max-w-sm mt-6 bg-gradient-to-r from-yellow-500 to-amber-600 text-black font-black text-sm py-3 rounded-xl flex items-center justify-center gap-2 hover:opacity-90 transition-opacity",children:[s.jsx($t,{className:"w-5 h-5"}),"REDEEM REWARDS"]}),((g=u==null?void 0:u.referrals)==null?void 0:g.length)>0&&s.jsxs("div",{className:"w-full max-w-sm mt-6",children:[s.jsx("h2",{className:"font-black text-sm tracking-wider mb-3",children:"RECENT REFERRALS"}),s.jsx("div",{className:"space-y-2",children:u.referrals.map((y,b)=>s.jsxs("div",{className:"bg-neutral-900 rounded-xl p-3 border border-neutral-800 flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[y.status==="engaged"?s.jsx(Mr,{className:"w-4 h-4 text-green-400"}):s.jsx(er,{className:"w-4 h-4 text-yellow-400"}),s.jsxs("div",{children:[s.jsx("p",{className:"text-xs font-bold",children:y.status==="engaged"?"Engaged ✓":"Signed up — waiting"}),s.jsx("p",{className:"text-[10px] text-neutral-500",children:new Date(y.created_at).toLocaleDateString()})]})]}),s.jsx("p",{className:`font-black text-sm ${y.status==="engaged"?"text-green-400":"text-neutral-500"}`,children:y.status==="engaged"?`+$${Number(y.reward_amount).toFixed(2)}`:"Pending"})]},b))})]}),l&&s.jsx(EO,{onClose:()=>c(!1),onSuccess:()=>c(!1)})]})},PO=Object.freeze(Object.defineProperty({__proto__:null,default:Uj},Symbol.toStringTag,{value:"Module"})),TO=[10,25,50,100],cy={jackpot:{emoji:"🎰",label:"JACKPOT!",color:"text-yellow-300",description:"You won the $200 JACKPOT!"},double:{emoji:"🔥",label:"DOUBLED!",color:"text-green-400",description:"Your minutes were doubled!"},cash_win:{emoji:"💵",label:"CASH WIN!",color:"text-emerald-400",description:"Your wager converted to cashable earnings!"},lose:{emoji:"💀",label:"BUSTED",color:"text-red-400",description:"You lost your wagered minutes."}},RO=({userId:e,onClose:t,onSuccess:n})=>{const[r,a]=h.useState(""),[i,o]=h.useState(!1),{data:l,isLoading:c}=he({queryKey:["my-jackpot-payouts",e],enabled:!!e,queryFn:async()=>{const{data:p}=await S.from("jackpot_payouts").select("*").eq("user_id",e).order("created_at",{ascending:!1});return p??[]}});l==null||l.filter(p=>p.status==="pending");const d=(l==null?void 0:l.filter(p=>p.status==="paid"))??[],u=(l==null?void 0:l.reduce((p,v)=>p+Number(v.jackpot_amount),0))??0,f=d.reduce((p,v)=>p+Number(v.jackpot_amount),0),m=async p=>{if(!r.trim()||!r.includes("@")){B.error("Enter a valid PayPal email");return}o(!0);try{const{error:v}=await S.from("jackpot_payouts").update({paypal_email:r.trim()}).eq("id",p);if(v)throw v;B.success("PayPal email submitted! Admin will process your payout."),n()}catch(v){B.error(v.message)}o(!1)};return s.jsx("div",{className:"fixed inset-0 z-[60] bg-black/95 flex items-center justify-center p-4",children:s.jsxs("div",{className:"w-full max-w-md bg-gradient-to-b from-neutral-900 via-black to-neutral-900 border border-yellow-500/30 rounded-2xl overflow-hidden",children:[s.jsxs("div",{className:"p-5 pb-3 flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(ds,{className:"w-5 h-5 text-yellow-400"}),s.jsx("h2",{className:"text-lg font-black text-yellow-300",children:"WAGER EARNINGS"})]}),s.jsx("button",{onClick:t,className:"p-1.5 bg-neutral-800 rounded-lg hover:bg-neutral-700",children:s.jsx(We,{className:"w-5 h-5 text-neutral-400"})})]}),s.jsxs("div",{className:"px-5 pb-5 space-y-4",children:[s.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[s.jsxs("div",{className:"bg-yellow-500/10 border border-yellow-500/20 rounded-xl p-3 text-center",children:[s.jsx("p",{className:"text-[10px] text-yellow-500/70 font-bold",children:"TOTAL WON"}),s.jsxs("p",{className:"text-xl font-black text-yellow-300",children:["$",u.toFixed(2)]})]}),s.jsxs("div",{className:"bg-green-500/10 border border-green-500/20 rounded-xl p-3 text-center",children:[s.jsx("p",{className:"text-[10px] text-green-500/70 font-bold",children:"PAID OUT"}),s.jsxs("p",{className:"text-xl font-black text-green-400",children:["$",f.toFixed(2)]})]})]}),c?s.jsx("p",{className:"text-center text-neutral-500 text-sm py-4",children:"Loading..."}):l!=null&&l.length?s.jsx("div",{className:"space-y-3 max-h-[300px] overflow-y-auto",children:l.map(p=>s.jsxs("div",{className:"bg-neutral-900/80 border border-neutral-800 rounded-xl p-3 space-y-2",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-lg",children:Number(p.jackpot_amount)>=100?"🎰":"💵"}),s.jsxs("div",{children:[s.jsxs("p",{className:"text-sm font-black text-yellow-300",children:["$",Number(p.jackpot_amount).toFixed(2)]}),s.jsx("p",{className:"text-[10px] text-neutral-600",children:new Date(p.created_at).toLocaleDateString()})]})]}),s.jsx("span",{className:`text-[10px] font-bold px-2 py-0.5 rounded-full ${p.status==="paid"?"bg-green-500/20 text-green-400":p.status==="rejected"?"bg-red-500/20 text-red-400":p.paypal_email?"bg-blue-500/20 text-blue-400":"bg-yellow-500/20 text-yellow-400"}`,children:p.status==="paid"?"✓ PAID":p.status==="rejected"?"REJECTED":p.paypal_email?"AWAITING REVIEW":"ENTER PAYPAL"})]}),p.status==="pending"&&!p.paypal_email&&s.jsxs("div",{className:"flex gap-2",children:[s.jsx("input",{type:"email",placeholder:"[email protected]",value:r,onChange:v=>a(v.target.value),className:"flex-1 bg-neutral-800 border border-neutral-700 rounded-lg px-3 py-2 text-sm text-white placeholder:text-neutral-600 focus:outline-none focus:border-yellow-500/50"}),s.jsxs("button",{onClick:()=>m(p.id),disabled:i,className:"bg-yellow-500 hover:bg-yellow-600 text-black font-bold text-xs px-3 py-2 rounded-lg flex items-center gap-1 transition-colors",children:[s.jsx(eh,{className:"w-3 h-3"})," Submit"]})]}),p.paypal_email&&p.status==="pending"&&s.jsxs("p",{className:"text-[10px] text-blue-400",children:["PayPal: ",p.paypal_email]}),p.status==="paid"&&s.jsxs("p",{className:"text-[10px] text-green-400 flex items-center gap-1",children:[s.jsx(ra,{className:"w-3 h-3"})," Paid to ",p.paypal_email]})]}
471,p.id))}):s.jsxs("div",{className:"text-center py-6",children:[s.jsx("p",{className:"text-neutral-500 text-sm",children:"No jackpot wins yet"}),s.jsx("p",{className:"text-neutral-600 text-xs mt-1",children:"Hit the jackpot to see your winnings here!"})]}),s.jsx("p",{className:"text-[10px] text-neutral-600 text-center",children:"Jackpot winnings are reviewed and paid out by admin via PayPal"})]})]})})},Bj=({onClose:e})=>{const{user:t}=it(),n=wt(),[r,a]=h.useState(25),[i,o]=h.useState(!1),[l,c]=h.useState(null),[d,u]=h.useState(!1),[f,m]=h.useState(!1),{data:p,refetch:v}=he({queryKey:["wager_status",t==null?void 0:t.id],enabled:!!t,queryFn:async()=>{const{data:j}=await S.functions.invoke("gamble-minutes",{body:{type:"get_status",userId:t.id}});return j}}),{data:g}=he({queryKey:["wager_history",t==null?void 0:t.id],enabled:!!t&&d,queryFn:async()=>{const{data:j}=await S.functions.invoke("gamble-minutes",{body:{type:"get_history",userId:t.id}});return(j==null?void 0:j.history)||[]}}),y=((p==null?void 0:p.total_minutes)??0)-((p==null?void 0:p.gifted_minutes)??0),b=((p==null?void 0:p.max_daily)??3)-((p==null?void 0:p.daily_count)??0),x=((p==null?void 0:p.max_weekly)??10)-((p==null?void 0:p.weekly_count)??0),w=async()=>{if(!(!t||i)){if(y<r){B.error("Not enough earned minutes",{description:`You have ${y} earned minutes available.`});return}o(!0),c(null);try{const{data:j,error:N}=await S.functions.invoke("gamble-minutes",{body:{type:"wager",userId:t.id,wagerAmount:r}});if(N||!(j!=null&&j.success)){const k=(j==null?void 0:j.message)||(N==null?void 0:N.message)||"Wager failed";k==="daily_cap"?B.error("Daily limit reached!",{description:"Come back tomorrow."}):k==="weekly_cap"?B.error("Weekly limit reached!",{description:"Come back next week."}):k==="insufficient_minutes"?B.error("Not enough earned minutes",{description:`You have ${(j==null?void 0:j.available)??0} earned minutes.`}):B.error(k),o(!1);return}await new Promise(k=>setTimeout(k,2e3)),c(j),v(),n.invalidateQueries({queryKey:["wager_history"]})}catch{B.error("Something went wrong")}finally{o(!1)}}},_=l?cy[l.outcome]:null;return s.jsxs("div",{className:"fixed inset-0 z-50 bg-black/90 flex items-start sm:items-center justify-center p-2 sm:p-4 overflow-y-auto",children:[s.jsxs("div",{className:"relative w-full max-w-md my-auto bg-gradient-to-b from-neutral-900 via-black to-neutral-900 border border-yellow-500/30 rounded-2xl shadow-[0_0_40px_rgba(234,179,8,0.2)] overflow-hidden",children:[s.jsx("div",{className:"absolute inset-0 bg-[linear-gradient(120deg,transparent_30%,rgba(234,179,8,0.05)_50%,transparent_70%)] bg-[length:200%_100%] animate-[shimmer-bg_3s_ease-in-out_infinite] pointer-events-none"}),s.jsx("button",{onClick:e,className:"sticky top-2 right-2 float-right z-10 p-2 bg-neutral-800 rounded-lg hover:bg-neutral-700 transition-colors mr-2 mt-2",children:s.jsx(We,{className:"w-6 h-6 text-white"})}),s.jsxs("div",{className:"relative px-5 pb-3 clear-both",children:[s.jsx("h2",{className:"text-2xl font-black tracking-wide text-transparent bg-clip-text bg-gradient-to-r from-yellow-300 to-amber-500",children:"CHALLENGE MINUTES"}),s.jsx("p",{className:"text-xs text-neutral-400 mt-1",children:"Wager your earned minutes for a chance to win big!"})]}),s.jsxs("div",{className:"relative mx-5 mb-4 bg-gradient-to-r from-yellow-600/20 via-amber-500/15 to-yellow-600/20 border border-yellow-500/40 rounded-xl p-4 text-center",children:[s.jsx("div",{className:"absolute inset-0 bg-[radial-gradient(circle_at_center,rgba(234,179,8,0.1),transparent_70%)] pointer-events-none"}),s.jsx("p",{className:"text-[10px] font-bold text-yellow-500/80 tracking-widest mb-1",children:"🎰 GRAND PRIZE 🎰"}),s.jsx("p",{className:"text-4xl font-black text-transparent bg-clip-text bg-gradient-to-r from-yellow-300 via-amber-400 to-yellow-300 drop-shadow-[0_0_20px_rgba(234,179,8,0.5)]",children:"$200"}),s.jsx("p",{className:"text-[10px] text-yellow-500/60 font-bold mt-1",children:"Cash added to your earnings"})]}),d?s.jsxs("div",{className:"relative px-5 pb-5 space-y-3",children:[s.jsxs("div",{className:"flex items-center justify-between mb-2",children:[s.jsx("p",{className:"text-xs text-neutral-500 font-bold tracking-wider",children:"WAGER HISTORY"}),s.jsx("button",{onClick:()=>u(!1),className:"text-xs text-yellow-500 font-bold hover:opacity-80",children:"← BACK"})]}),!g||g.length===0?s.jsx("p",{className:"text-center text-neutral-600 text-sm py-6",children:"No wagers yet"}):s.jsx("div",{className:"space-y-2 max-h-[300px] overflow-y-auto",children:g.map(j=>{const N=cy[j.outcome];return s.jsxs("div",{className:"flex items-center justify-between bg-neutral-900/60 border border-neutral-800 rounded-lg px-3 py-2.5",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-lg",children:(N==null?void 0:N.emoji)||"❓"}),s.jsxs("div",{children:[s.jsx("p",{className:`text-xs font-black ${(N==null?void 0:N.color)||"text-neutral-400"}`,children:(N==null?void 0:N.label)||j.outcome}),s.jsx("p",{className:"text-[10px] text-neutral-600",children:new Date(j.created_at).toLocaleDateString()})]})]}),s.jsxs("div",{className:"text-right",children:[s.jsxs("p",{className:"text-xs font-bold text-neutral-400",children:["Wagered: ",j.wager_amount,"m"]}),j.outcome!=="lose"&&s.jsx("p",{className:"text-[10px] font-bold text-green-400",children:j.prize_type==="cash"?`$${j.prize_amount}`:`+${j.prize_amount}m`})]})]},j.id)})})]}):s.jsxs("div",{className:"relative px-5 pb-5 space-y-4",children:[s.jsxs("div",{className:"flex items-center justify-between bg-neutral-900/80 border border-neutral-800 rounded-xl px-4 py-3",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(er,{className:"w-4 h-4 text-neutral-500"}),s.jsxs("div",{children:[s.jsx("p",{className:"text-xs text-neutral-500 font-bold",children:"EARNED MINUTES"}),s.jsx("p",{className:"text-lg font-black text-white",children:y})]})]}),s.jsxs("div",{className:"text-right",children:[s.jsxs("p",{className:"text-[10px] text-neutral-600 font-bold",children:["TODAY: ",b," left"]}),s.jsxs("p",{className:"text-[10px] text-neutral-600 font-bold",children:["WEEK: ",x," left"]})]})]}),l&&_&&s.jsxs("div",{className:`text-center py-4 rounded-xl border ${l.outcome==="lose"?"bg-red-900/20 border-red-500/30":"bg-green-900/20 border-green-500/30"}`,children:[s.jsx("p",{className:"text-4xl mb-2",children:_.emoji}),s.jsx("p",{className:`text-2xl font-black ${_.color}`,children:_.label}),s.jsx("p",{className:"text-sm text-neutral-300 mt-1",children:_.description}),l.outcome==="double"&&s.jsxs("p",{className:"text-lg font-black text-green-400 mt-1",children:["+",l.wager_amount," minutes"]}),l.outcome==="cash_win"&&s.jsxs("p",{className:"text-lg font-black text-emerald-400 mt-1",children:["$",l.prize_amount," added to cashable balance"]}),l.outcome==="jackpot"&&s.jsx("p",{className:"text-lg font-black text-yellow-300 mt-1",children:"$200 CASH! 🎉"}),l.outcome==="lose"&&s.jsxs("p",{className:"text-lg font-black text-red-400 mt-1",children:["-",l.wager_amount," minutes"]})]}),!i&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-xs text-neutral-500 font-bold mb-2 tracking-wider",children:"SELECT WAGER"}),s.jsx("div",{className:"grid grid-cols-4 gap-2",children:TO.map(j=>{const N=y<j;return s.jsxs("button",{onClick:()=>!N&&a(j),disabled:N,className:`py-3 rounded-xl border-2 font-black text-sm transition-all ${r===j?"bg-yellow-500/20 border-yellow-400/60 text-yellow-300 shadow-[0_0_12px_rgba(234,179,8,0.2)]":N?"bg-neutral-900/50 border-neutral-800 text-neutral-700 cursor-not-allowed":"bg-neutral-900/50 border-neutral-700 text-neutral-300 hover:border-neutral-500"}`,children:[j,"m"]},j)})})]}),s.jsxs("div",{className:"bg-neutral-900/60 border border-neutral-800 rounded-xl p-3 space-y-1.5",children:[s.jsx("p",{className:"text-[10px] text-neutral-500 font-bold tracking-wider mb-1",children:"POSSIBLE OUTCOMES"}),s.jsxs("div",{className:"flex items-center justify-between text-[11px]",children:[s.jsx("span",{className:"text-yellow-400 font-bold",children:"🎰 $200 Jackpot"}),s.jsx("span",{className:"text-neutral-600",children:"Rare"})]}),s.jsxs("div",{className:"flex items-center justify-between text-[11px]",children:[s.jsx("span",{className:"text-green-400 font-bold",children:"🔥 2x Minutes Back"}),s.jsx("span",{className:"text-neutral-600",children:"30%"})]}),s.jsxs("div",{className:"flex items-center justify-between text-[11px]",children:[s.jsx("span",{className:"text-emerald-400 font-bold",children:"💵 Cash Win"}),s.jsx("span",{className:"text-neutral-600",children:"~20%"})]}),s.jsxs("div",{className:"flex items-center justify-between text-[11px]",children:[s.jsx("span",{className:"text-red-400 font-bold",children:"💀 Lose Wager"}),s.jsx("span",{className:"text-neutral-600",children:"~50%"})]})]})]}),s.jsx("button",{onClick:l?()=>c(null):w,disabled:i||b<=0||x<=0||y<r,className:`w-full py-4 rounded-xl font-black text-lg tracking-wider transition-all active:scale-[0.97] flex items-center justify-center gap-3 ${i?"bg-neutral-800 text-neutral-500 cursor-wait":l?"bg-gradient-to-r from-yellow-500 to-amber-600 text-black hover:opacity-90":b<=0||x<=0?"bg-neutral-800 text-neutral-600 cursor-not-allowed":"bg-gradient-to-r from-yellow-500 to-amber-600 text-black hover:opacity-90 shadow-[0_0_20px_rgba(234,179,8,0.3)]"}`,children:i?s.jsxs(s.Fragment,{children:[s.jsx(us,{className:"w-5 h-5 animate-spin"}),"CHALLENGING..."]}):l?s.jsxs(s.Fragment,{children:[s.jsx(ds,{className:"w-5 h-5"}),"PLAY AGAIN"]}):b<=0?"DAILY LIMIT REACHED":x<=0?"WEEKLY LIMIT REACHED":s.jsxs(s.Fragment,{children:[s.jsx($t,{className:"w-5 h-5"}),"WAGER ",r," MINUTES"]})}),s.jsxs("div",{className:"flex items-start gap-2 text-[10px] text-neutral-600",children:[s.jsx(Co,{className:"w-3.5 h-3.5 shrink-0 mt-0.5"}),s.jsxs("span",{children:["Only earned minutes can be wagered. Gifted/cashable minutes are protected. Limits: ",(p==null?void 0:p.max_daily)??3,"/day, ",(p==null?void 0:p.max_weekly)??10,"/week."]})]}),s.jsxs("button",{onClick:()=>m(!0),className:"w-full bg-gradient-to-r from-emerald-500/20 to-green-600/20 border border-emerald-400/40 text-emerald-300 font-black text-sm py-3 rounded-xl flex items-center justify-center gap-2 hover:opacity-90 transition-opacity active:scale-[0.97] shadow-[0_0_12px_rgba(52,211,153,0.15)]",children:[s.jsx($t,{className:"w-4 h-4"}),"CASH OUT EARNINGS"]}),s.jsxs("button",{onClick:()=>u(!0),className:"w-full flex items-center justify-center gap-2 text-xs text-neutral-500 hover:text-neutral-300 font-bold transition-colors py-2",children:[s.jsx(c4,{className:"w-3.5 h-3.5"}),"VIEW HISTORY"]}
471)]})]}),f&&s.jsx(RO,{userId:t==null?void 0:t.id,onClose:()=>m(!1),onSuccess:()=>{m(!1),v()}})]})},tx="/assets/slot-machine-CImN3zHv.png",AO=({onClose:e,initialView:t})=>{const[n,r]=h.useState(t??"hub"),[a,i]=h.useState(!1);return n==="spin"?s.jsx(CO,{onClose:()=>r("hub")}):n==="referral"?s.jsx(Uj,{onClose:()=>r("hub")}):s.jsxs("div",{className:"min-h-screen bg-black text-white font-['Antigone',sans-serif] flex flex-col items-center px-4 pb-8",children:[s.jsx("div",{className:"w-full flex items-center pt-3 pb-2",children:s.jsxs("button",{onClick:e,className:"flex items-center gap-1 hover:opacity-80 transition-opacity",children:[s.jsx(Rn,{className:"w-7 h-7"}),s.jsx("span",{className:"font-black text-sm tracking-wider",children:"BACK"})]})}),s.jsx("h1",{className:"text-3xl font-black tracking-wide mt-4 mb-2",children:"🎯 EVENTS"}),s.jsx("p",{className:"text-neutral-400 text-sm mb-8 text-center",children:"Earn rewards, invite friends, and win big!"}),s.jsxs("div",{className:"flex flex-col gap-5 w-full max-w-sm",children:[s.jsxs("button",{onClick:()=>r("referral"),className:"bg-gradient-to-r from-emerald-600 to-teal-600 rounded-2xl p-5 flex items-center gap-4 hover:opacity-90 transition-opacity border border-emerald-500/30 shadow-lg",children:[s.jsx("span",{className:"text-4xl",children:"💸"}),s.jsxs("div",{className:"text-left",children:[s.jsx("span",{className:"font-black text-lg tracking-wide block",children:"REFER & EARN"}),s.jsx("span",{className:"text-xs font-bold text-emerald-200",children:"Invite friends, earn real cash!"})]})]}),s.jsxs("button",{onClick:()=>i(!0),className:"w-full relative overflow-hidden bg-gradient-to-br from-yellow-600/25 via-amber-700/20 to-orange-900/30 border border-yellow-500/40 rounded-2xl p-5 shadow-[0_0_24px_rgba(234,179,8,0.25)] active:scale-[0.97] transition-transform text-left flex items-center gap-4",children:[s.jsx("span",{className:"text-4xl",children:"🎰"}),s.jsxs("div",{children:[s.jsx("span",{className:"font-black text-lg tracking-wide block",children:"CHALLENGE MINUTES"}),s.jsx("span",{className:"text-xs text-neutral-400",children:"Wager earned minutes for a chance to win up to $200 cash!"}),s.jsxs("div",{className:"flex items-center gap-3 mt-2",children:[s.jsx("span",{className:"text-[10px] font-bold bg-yellow-500/20 text-yellow-400 px-2 py-0.5 rounded-full",children:"🔥 2x MINUTES"}),s.jsx("span",{className:"text-[10px] font-bold bg-green-500/20 text-green-400 px-2 py-0.5 rounded-full",children:"💵 CASH WIN"}),s.jsx("span",{className:"text-[10px] font-bold bg-purple-500/20 text-purple-400 px-2 py-0.5 rounded-full",children:"💎 $200 JACKPOT"})]})]})]}),s.jsxs("button",{onClick:()=>r("spin"),className:"bg-gradient-to-r from-yellow-600 to-orange-600 rounded-2xl p-5 flex items-center gap-4 hover:opacity-90 transition-opacity border border-yellow-500/30 shadow-lg",children:[s.jsx("img",{src:tx,alt:"Spin",className:"w-16 h-16 object-contain"}),s.jsxs("div",{className:"text-left",children:[s.jsx("span",{className:"font-black text-lg tracking-wide block",children:"SPIN TO WIN"}),s.jsx("span",{className:"text-xs font-bold text-yellow-200",children:"1 free spin every day!"})]})]})]}),a&&s.jsx(Bj,{onClose:()=>i(!1)})]})},yp="/assets/chance-enhancer-Clk_f79W.png",zj="/assets/get-gifted-BUZmGbyk.png",qj="/assets/pin-socials-ufJaSM_0.png",dh="/assets/cashapp-DDPbhM_V.png",hh="/assets/tiktok-B_HZvJvp.png",fh="/assets/instagram-Aw_hbISN.png",mh="/assets/snapchat-CatJxyRd.png",ph="/assets/venmo-CV8gOUYg.png",xh="/assets/paypal-CZYLg7VJ.png",IO=[{key:"cashapp",label:"$cashtag",icon:dh,prefix:"$",placeholder:"$cashtag"},{key:"tiktok",label:"TikTok",icon:hh,prefix:"@",placeholder:"@username"},{key:"instagram",label:"Instagram",icon:fh,prefix:"@",placeholder:"@username"},{key:"snapchat",label:"Snapchat",icon:mh,prefix:"/",placeholder:"/username"},{key:"venmo",label:"Venmo",icon:ph,prefix:"/",placeholder:"/username"},{key:"paypal",label:"PayPal",icon:xh,prefix:"@",placeholder:"@username"}],Vj=({onClose:e,userId:t,vipTier:n,genderFilter:r,onGenderFilterChange:a})=>
471{const[i,o]=h.useState(!0),[l,c]=h.useState(!1),[d,u]=h.useState([]),[f,m]=h.useState(null),[p,v]=h.useState(""),[g,y]=h.useState(!0),b=n==="premium",x=O=>{const P=d.find(T=>T.startsWith(O+":"));return P?P.split(":").slice(1).join(":"):""};h.useEffect(()=>{w()},[t]);const w=async()=>{const{data:O}=await S.from("vip_settings").select("*").eq("user_id",t).maybeSingle();O&&(o(O.show_promo_ads),c(O.get_gifted),u(O.pinned_socials||[])),y(!1)},_=async O=>{const{data:P}=await S.from("vip_settings").select("id").eq("user_id",t).maybeSingle();P?await S.from("vip_settings").update({...O,updated_at:new Date().toISOString()}).eq("user_id",t):await S.from("vip_settings").insert({user_id:t,...O})},j=async O=>{if(!b&&!O){B.error("Premium VIP required to disable promo ads");return}o(O),await _({show_promo_ads:O}),B.success(O?"Promo ads enabled":"Promo ads disabled")},N=async O=>{c(O),await _({get_gifted:O}),B.success(O?"Gifting enabled":"Gifting disabled")},k=async O=>{const P=p.trim();let T;if(P){const E=`${O}:${P}`;T=d.filter(W=>!W.startsWith(O+":")),T.push(E)}else T=d.filter(E=>!E.startsWith(O+":"));u(T),m(null),v(""),await _({pinned_socials:T}),B.success(P?"Social saved":"Social removed")},C=async O=>{const P=d.filter(T=>!T.startsWith(O+":"));u(P),await _({pinned_socials:P}),B.success("Social removed")},A=O=>{m(O),v(x(O))},I=({active:O,onToggle:P,yesLabel:T="Yes",noLabel:E="No"})=>s.jsxs("div",{className:"flex gap-2",children:[s.jsx("button",{onClick:()=>P(!0),className:`px-4 py-1.5 rounded-lg text-xs font-black tracking-wide transition-all ${O?"bg-green-600 text-white":"bg-neutral-800 text-neutral-500"}`,children:T}),s.jsx("button",{onClick:()=>P(!1),className:`px-4 py-1.5 rounded-lg text-xs font-black tracking-wide transition-all ${O?"bg-neutral-800 text-neutral-500":"bg-red-600 text-white"}`,children:E})]});return g?s.jsx("div",{className:"fixed inset-0 z-50 bg-black flex items-center justify-center",children:s.jsx("div",{className:"text-neutral-400 animate-pulse",children:"Loading settings..."})}):s.jsx("div",{className:"fixed inset-0 z-50 bg-black overflow-y-auto",children:s.jsxs("div",{className:"min-h-screen flex flex-col items-center px-4 py-5",children:[s.jsx("button",{onClick:e,className:"self-start mb-3",children:s.jsx(We,{className:"w-8 h-8 text-red-500"})}),s.jsx("h1",{className:"text-white text-2xl font-black tracking-wider mb-0",children:"VIP FEATURES"}),s.jsx("p",{className:"text-neutral-400 text-sm font-black tracking-wider mb-6",children:"SETTINGS"}),s.jsxs("div",{className:"w-full max-w-sm space-y-6",children:[s.jsxs("div",{className:"bg-neutral-900 border border-neutral-700/60 rounded-2xl p-4",children:[s.jsx("p",{className:"text-neutral-400 text-xs font-black tracking-wider text-center mb-3",children:"Show Promo Ads."}),s.jsx("div",{className:"flex justify-center",children:s.jsx(I,{active:i,onToggle:j})}),!b&&!i&&s.jsx("p",{className:"text-yellow-500 text-[10px] text-center mt-2 font-bold",children:"Premium VIP required to disable ads"})]}),s.jsxs("div",{className:"bg-neutral-900 border border-neutral-700/60 rounded-2xl p-4",children:[s.jsxs("div",{className:"flex items-center justify-center gap-2 mb-1",children:[s.jsx("p",{className:"text-neutral-400 text-xs font-black tracking-wider text-center",children:"Pin Social & Pay Apps On Screen."}),s.jsx("img",{src:qj,alt:"",className:"w-5 h-5 object-contain"})]}),s.jsxs("div",{className:"flex items-center justify-center gap-1.5 mb-4",children:[s.jsx("span",{className:"text-[10px] text-neutral-500",children:"📌"}),s.jsx(bd,{className:"w-3 h-3 text-yellow-500"})]}),s.jsx("div",{className:"space-y-2",children:IO.map(O=>{const P=x(O.key),T=f===O.key;return s.jsxs("div",{className:"flex items-center gap-2.5",children:[s.jsx("img",{src:O.icon,alt:O.label,className:"w-8 h-8 rounded-full object-cover flex-shrink-0"}),T?s.jsxs("div",{className:"flex-1 flex items-center gap-1.5",children:[s.jsx("input",{value:p,onChange:E=>v(E.target.value),placeholder:O.placeholder,autoFocus:!0,className:"flex-1 bg-neutral-800 border border-neutral-600 rounded-lg px-2.5 py-1.5 text-white text-sm placeholder-neutral-500 focus:outline-none focus:border-green-500",onKeyDown:E=>
471E.key==="Enter"&&k(O.key)}),s.jsx("button",{onClick:()=>k(O.key),className:"bg-green-600 p-1.5 rounded-lg hover:bg-green-500 transition-colors",children:s.jsx(Mr,{className:"w-3.5 h-3.5 text-white"})})]}):P?s.jsxs("div",{className:"flex-1 flex items-center justify-between",children:[s.jsx("span",{className:"text-green-400 text-sm font-bold",children:P}),s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx("button",{onClick:()=>A(O.key),className:"text-neutral-500 hover:text-white transition-colors",children:s.jsx(bd,{className:"w-3.5 h-3.5"})}),s.jsx("button",{onClick:()=>C(O.key),className:"text-red-400 hover:text-red-300 transition-colors",children:s.jsx(th,{className:"w-3.5 h-3.5"})})]})]}):s.jsx("button",{onClick:()=>A(O.key),className:"flex-1 text-left text-neutral-600 text-sm italic hover:text-neutral-400 transition-colors",children:O.placeholder})]},O.key)})})]}),b&&s.jsxs("div",{className:"bg-neutral-900 border border-neutral-700/60 rounded-2xl p-4 flex items-center gap-3",children:[s.jsx("img",{src:yp,alt:"",className:"w-10 h-10 object-contain"}),s.jsxs("div",{children:[s.jsx("p",{className:"text-white text-sm font-black",children:"Chance Enhancer"}),s.jsx("p",{className:"text-yellow-400 text-xs font-black",children:"35%+"}),s.jsx("p",{className:"text-neutral-500 text-[10px]",children:"You get 35%+ of winning rare and legendary items each month!"})]})]}),b&&s.jsxs("div",{className:"bg-neutral-900 border border-neutral-700/60 rounded-2xl p-4",children:[s.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[s.jsx("img",{src:zj,alt:"",className:"w-10 h-10 object-contain"}),s.jsxs("div",{children:[s.jsx("p",{className:"text-white text-sm font-black",children:"Get Gifted By Users."}),s.jsx("p",{className:"text-neutral-500 text-[10px]",children:"Reach 3 to Redeem. 1 → 1 Gift"})]})]}),s.jsx("div",{className:"flex justify-center",children:s.jsx(I,{active:l,onToggle:N,yesLabel:"Enable",noLabel:"Disable"})})]}),b&&s.jsx("div",{className:"bg-neutral-900 border border-neutral-700/60 rounded-2xl p-4 space-y-2",children:["200 Ad Points Per Month","Spin Legendary Items","30 Minute Cap Per User","2nd Try On Rare & Legendary Items","Free Shipping","Target Country On Promos","Target Gender On Promos","Post Clickable Links"].map(O=>s.jsx("p",{className:"text-blue-400 text-xs font-black underline",children:O},O))}),s.jsxs("button",{onClick:async()=>{try{B.loading("Opening subscription manager...");const{data:O,error:P}=await S.functions.invoke("customer-portal");if(B.dismiss(),P)throw P;O!=null&&O.url?window.open(O.url,"_blank"):B.error("Could not open subscription manager")}catch(O){B.dismiss(),B.error((O==null?void 0:O.message)||"Failed to open subscription manager")}},className:"w-full bg-neutral-800 border border-neutral-600 text-white font-bold py-3 rounded-xl flex items-center justify-center gap-2 hover:bg-neutral-700 transition-colors",children:[s.jsx(y_,{className:"w-4 h-4"}),"Manage / Cancel Subscription"]}),s.jsx("div",{className:"h-8"})]})]})})};function OO(e){const[t,n]=h.useState(null),[r,a]=h.useState(!1),i=h.useCallback(async()=>{if(!e)return;a(!0);const{data:l}=await S.rpc("get_bounty_summary");n(l??null),a(!1)},[e]);h.useEffect(()=>{i()},[i]);const o=h.useCallback(async(l,c)=>{const{data:d}=await S.rpc("record_bounty_interaction",{p_male_id:l,p_interaction_type:c});return d},[]);return{summary:t,loading:r,refresh:i,recordInteraction:o}}const gh=({onClose:e,currentMinutes:t,giftedMinutes:n,bountyMinutes:r=0,onSuccess:a})=>{const{user:i}=it(),[o,l]=h.useState(100),[c,d]=h.useState(""),[u,f]=h.useState(!1),[m,p]=h.useState(!1),[v,g]=h.useState([]),[y,b]=h.useState([]),[x,w]=h.useState(!1),[_,j]=h.useState(null);h.useEffect(()=>{S.functions.invoke("cashout-minutes",{body:{action:"get-settings"}}).then(({data:E})=>{E!=null&&E.settings&&j(E.settings)})},[]);const N=()=>{i&&(p(!0),S.from("cashout_requests").select("id, minutes_amount, cash_amount, paypal_email, status, created_at, notes").eq("user_id",i.id).order("created_at",{ascending:!1}).limit(20).then(({data:E})=>{E&&g(E),p(!1)}))};h.useEffect(()=>{N()},[i]),h.useEffect(()=>{(async()=>
471{if(i){w(!0);try{const[W,V]=await Promise.all([S.from("gift_transactions").select("id, sender_id, minutes_amount, created_at").eq("recipient_id",i.id).eq("status","completed").order("created_at",{ascending:!1}).limit(25),S.from("bounty_earnings").select("id, male_id, amount_minutes, source, created_at, clawed_back").eq("female_id",i.id).eq("clawed_back",!1).gt("amount_minutes",0).order("created_at",{ascending:!1}).limit(25)]),q=W.data||[],D=V.data||[],$=Array.from(new Set([...q.map(U=>U.sender_id),...D.map(U=>U.male_id)]));let z={};if($.length>0){const{data:U}=await S.from("members").select("id, name").in("id",$);z=Object.fromEntries((U||[]).map(ee=>[ee.id,ee.name||"Member"]))}const R=[...q.map(U=>({id:`g-${U.id}`,kind:"gift",minutes:U.minutes_amount,created_at:U.created_at,label:`Gift from ${z[U.sender_id]||"Member"}`})),...D.map(U=>{const ee=U.source==="premium"?"Premium VIP":U.source==="basic"?"Basic VIP":U.source==="renewal"?"VIP Renewal":"Streak Bonus";return{id:`b-${U.id}`,kind:"bounty",minutes:U.amount_minutes,created_at:U.created_at,label:`Bounty: ${z[U.male_id]||"Member"}`,sublabel:ee}})].sort((U,ee)=>new Date(ee.created_at).getTime()-new Date(U.created_at).getTime());b(R)}finally{w(!1)}}})()},[i]),h.useEffect(()=>{if(!i)return;const E=setInterval(()=>N(),5e3);return()=>clearInterval(E)},[i]);const k=n+r,C=_?(o*_.rate_per_minute).toFixed(2):"—",A=_?Math.min(k,_.max_cashout_minutes):k,I=v.some(E=>E.status==="pending"),O=async()=>{if(!c.includes("@")){B.error("Enter a valid PayPal email");return}f(!0);try{const{data:E,error:W}=await S.functions.invoke("cashout-minutes",{body:{action:"request-cashout",minutes_amount:o,paypal_email:c}});if(W)throw W;if(E!=null&&E.error)throw new Error(E.error);B.success(`💰 Cashout request submitted for $${E.cash_amount}!`),a(),e()}catch(E){B.error(E.message||"Cashout failed")}finally{f(!1)}},P=E=>E==="pending"?s.jsx(er,{className:"w-3.5 h-3.5 text-amber-400"}):E==="approved"||E==="paid"?s.jsx(ra,{className:"w-3.5 h-3.5 text-emerald-400"}):s.jsx(Xd,{className:"w-3.5 h-3.5 text-red-400"}),T=E=>E==="pending"?"text-amber-400":E==="approved"||E==="paid"?"text-emerald-400":"text-red-400";return _?s.jsx("div",{className:"fixed inset-0 z-[70] bg-black/80 flex items-center justify-center px-4",onClick:e,children:s.jsxs("div",{className:"bg-neutral-900 border border-white/10 rounded-2xl p-5 w-full max-w-xs relative max-h-[85vh] overflow-y-auto",onClick:E=>E.stopPropagation(),children:[s.jsx("button",{onClick:e,className:"absolute top-3 right-3 text-white/40 hover:text-white",children:s.jsx(We,{className:"w-5 h-5"})}),s.jsxs("div",{className:"text-center mb-4",children:[s.jsx("div",{className:"w-12 h-12 rounded-full bg-emerald-500/20 flex items-center justify-center mx-auto mb-2",children:s.jsx($t,{className:"w-6 h-6 text-emerald-400"})}),s.jsx("h2",{className:"text-white font-bold text-lg",children:"Cash Out Minutes"}),s.jsx("p",{className:"text-white/50 text-xs mt-0.5",children:"Convert your gifted minutes into real cash via PayPal"})]}),s.jsxs("div",{className:"bg-white/5 border border-white/10 rounded-xl p-3 mb-4 space-y-1.5",children:[s.jsxs("div",{className:"flex justify-between items-center",children:[s.jsx("span",{className:"text-white/50 text-xs",children:"🎁 Gifted Minutes"}),s.jsxs("span",{className:"text-emerald-400 font-bold text-sm",children:[n," min"]})]}),r>0&&s.jsxs("div",{className:"flex justify-between items-center",children:[s.jsx("span",{className:"text-white/50 text-xs",children:"👑 Bounty Earnings"}),s.jsxs("span",{className:"text-amber-400 font-bold text-sm",children:[r," min"]})]}),s.jsxs("div",{className:"flex justify-between items-center",children:[s.jsx("span",{className:"text-white/50 text-xs",children:"💵 Each Minute is Worth"}),s.jsxs("span",{className:"text-white font-bold text-sm",children:["$",_.rate_per_minute]})]}),s.jsxs("div",{className:"border-t border-white/10 pt-1.5 flex justify-between items-center",children:[s.jsx("span",{className:"text-white/50 text-xs",children:"💰 Total Cashable Value"}),s.jsxs("span",{className:"text-emerald-400 font-bold text-sm",children:["$",(k*_.rate_per_minute).toFixed(2)]})]})]}),s.jsxs("div",{className:"mb-4",children:[s.jsxs("p",{className:"text-white/60 text-[11px] text-center mb-2",children:["Choose how many minutes to cash out (min ",_.min_cashout_minutes," · max ",A," per request)"]}),s.jsx("input",{type:"range",min:_.min_cashout_minutes,max:A,step:10,value:o,onChange:E=>l(Number(E.target.value)),className:"w-full accent-emerald-500"}),s.jsxs("div",{className:"text-center mt-2",children:[s.jsx("span",{className:"text-3xl font-black text-white",children:o}),s.jsx("span",{className:"text-white/40 text-sm ml-1",children:"minutes"})]}),s.jsxs("p",{className:"text-emerald-400 text-center text-lg font-bold mt-1",children:["= $",C]})]}),s.jsxs("div",{className:"mb-4",children:[s.jsx("label",{className:"text-white/50 text-xs block mb-1",children:"PayPal Email"}),s.jsx("input",{type:"email",placeholder:"[email protected]",value:c,onChange:E=>d(E.target.value),className:"w-full bg-white/5 border border-white/10 rounded-lg px-3 py-2.5 text-white text-sm placeholder:text-white/30 focus:outline-none focus:border-emerald-500/50"})]}),k<_.min_cashout_minutes&&s.jsxs("div",{className:"bg-amber-500/10 border border-amber-500/20 rounded-xl p-3 mb-4",children:[s.jsx("p",{className:"text-amber-400 text-xs font-bold mb-1",children:"⚠️ Not enough cashable minutes"}),s.jsxs("p",{className:"text-white/50 text-[11px] leading-relaxed",children:["You need at least ",s.jsxs("span",{className:"text-white font-bold",children:[_.min_cashout_minutes," cashable minutes"]})," (gifted + bounties) to cash out. You currently have ",s.jsx("span",{className:"text-white font-bold",children:k}),"."]}),t>k&&s.jsxs("p",{className:"text-white/40 text-[10px] mt-1.5 leading-relaxed",children:["💡 Your other ",t-k," minutes (from spins, rewards, or chatting) can be used in the Reward Store but ",s.jsx("span",{className:"text-white/60 font-bold",children:"cannot be cashed out"})," — only gifted minutes and bounty earnings are cashable."]})]}),s.jsx("button",{onClick:O,disabled:u||I||o<_.min_cashout_minutes||k<_.min_cashout_minutes,className:"w-full bg-emerald-500 hover:bg-emerald-400 text-black font-bold py-3 rounded-xl transition-colors disabled:opacity-50",children:u?"Submitting...":I?"Pending Request...":`Cash Out $${C}`}),s.jsx("p",{className:"text-white/30 text-[10px] text-center mt-2",children:"Paid via PayPal • Admin approval required"}),s.jsx("p",{className:"text-white/20 text-[9px] text-center mt-1",children:"Gifted minutes & bounty earnings can be cashed out — spin wins, chat earnings & rewards are store-only"}),s.jsxs("div",{className:"mt-5 border-t border-white/10 pt-4",children:[s.jsx("h3",{className:"text-white/80 text-xs font-bold uppercase tracking-wider mb-1",children:"Where your gifted minutes came from"}),s.jsx("p",{className:"text-white/40 text-[10px] mb-3",children:"Recent gifts & bounties credited to your cashable balance"}),x&&y.length===0?s.jsx("p",{className:"text-white/40 text-[11px] text-center py-3",children:"Loading sources..."}):y.length===0?s.jsx("p",{className:"text-white/40 text-[11px] text-center py-3",children:"No gifted minutes received yet."}):s.jsx("div",{className:"space-y-2 max-h-44 overflow-y-auto mb-4",children:y.map(E=>s.jsxs("div",{className:"bg-white/5 rounded-lg px-3 py-2 flex items-center justify-between gap-2",children:[s.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[E.kind==="gift"?s.jsx(Ft,{className:"w-3.5 h-3.5 text-pink-400 shrink-0"}):s.jsx(cs,{className:"w-3.5 h-3.5 text-amber-400 shrink-0"}),s.jsxs("div",{className:"min-w-0",children:[s.jsx("p",{className:"text-white text-xs font-bold truncate",children:E.label}),s.jsxs("p",{className:"text-white/30 text-[10px]",children:[E.sublabel?`${E.sublabel} • `:"",new Date(E.created_at).toLocaleDateString()]})]})]}),s.jsxs("span",{className:"text-emerald-400 font-bold text-xs shrink-0",children:["+",E.minutes," min"]})]},E.id))}),s.jsx("h3",{className:"text-white/80 text-xs font-bold uppercase tracking-wider mb-3",children:"Cashout History"}),m&&v.length===0?s.jsx("p",{className:"text-white/40 text-[11px] text-center py-3",children:"Loading history..."}):v.length===0?s.jsx("p",{className:"text-white/40 text-[11px] text-center py-3",children:"No cashout requests yet."}):s.jsx("div",{className:"space-y-2 max-h-44 overflow-y-auto",children:v.map(E=>
471s.jsxs("div",{className:"bg-white/5 rounded-lg px-3 py-2",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{children:[s.jsxs("p",{className:"text-white text-xs font-bold",children:["$",Number(E.cash_amount).toFixed(2)]}),s.jsxs("p",{className:"text-white/30 text-[10px]",children:[E.minutes_amount," min • ",new Date(E.created_at).toLocaleDateString()]})]}),s.jsxs("div",{className:"flex items-center gap-1",children:[P(E.status),s.jsx("span",{className:`text-[10px] font-bold uppercase ${T(E.status)}`,children:E.status})]})]}),E.notes&&s.jsxs("p",{className:"text-white/40 text-[10px] mt-1.5 whitespace-pre-line leading-snug border-t border-white/5 pt-1.5",children:[s.jsx("span",{className:"text-white/60 font-bold",children:"Note:"})," ",E.notes]})]},E.id))})]})]})}):s.jsx("div",{className:"fixed inset-0 z-[70] bg-black/80 flex items-center justify-center",children:s.jsx("div",{className:"text-white",children:"Loading..."})})},uy=[{icon:cs,color:"text-amber-400",bg:"bg-amber-500/10",border:"border-amber-500/30",title:"1. Get guys to go VIP",short:"Biggest payout. Up to 500 minutes each.",payout:"125 – 500 minutes",how:["Have a real DM conversation with a guy — you both send at least one message.","Once that happens, he's linked to you for 30 days.","If he upgrades to VIP during those 30 days, the minutes land in your balance automatically."],tips:["125 minutes when he buys Basic VIP","500 minutes when he buys Premium VIP","A real conversation means you both sent a message — either of you can start it","Your 30-day link stays locked even if he goes offline, unmatches, or blocks","First-time subscriptions only (not renewals)","+500 bonus if 3 guys subscribe within 7 days"]},{icon:Ft,color:"text-pink-400",bg:"bg-pink-500/10",border:"border-pink-500/30",title:"2. Get gifted minutes",short:"Guys send you minutes directly during calls or DMs.",payout:"100 – 1000 minutes per gift",how:["Guys can gift you minutes while video calling or messaging you.","Gifts go straight into your balance — nothing for you to claim.","The nicer the vibe, the bigger the gifts."],tips:["Gift tiers: 100, 400, 600 or 1000 minutes","Thank him — repeat gifters are the best earners","Being verified in Discover gets you way more gifts"]},{icon:mr,color:"text-blue-400",bg:"bg-blue-500/10",border:"border-blue-500/30",title:"3. Guys recharge minutes",short:"He buys minutes, you earn them while you talk.",payout:"Earn minutes every minute on call",how:["Guys buy (recharge) minutes so they can keep video calling.","When you video call him, you collect minutes as the call goes on.","Longer calls = more minutes for you. No extra steps."],tips:["Stay on the call — quick skips cut your earnings","Regulars who recharge often are your best income","Answer calls from Discover to get more call time"]},{icon:$t,color:"text-emerald-400",bg:"bg-emerald-500/10",border:"border-emerald-500/30",title:"4. Cash out to PayPal",short:"Turn the minutes you earned into real money.",payout:"$0.02 per minute",how:["Go to My Profile → Redeem My Minutes.","Choose how many minutes to cash out.","Money is sent straight to your PayPal."],tips:["500 minutes = $10","You can also spend minutes in the Reward Store instead","Only gifted / earned minutes are cashable"]}];function nx({onClose:e}){const t=sn(),{user:n}=it(),[r,a]=h.useState(null),[i,o]=h.useState(!1),l=r!==null?uy[r]:null,{data:c,refetch:d}=he({queryKey:["bounty-guide-cashout-balance",n==null?void 0:n.id],enabled:!!n,queryFn:async()=>{const[{data:f},{data:m}]=await Promise.all([S.from("member_minutes").select("total_minutes, gifted_minutes").eq("user_id",n.id).maybeSingle(),S.from("bounty_earnings").select("amount_minutes").eq("female_id",n.id).eq("clawed_back",!1).eq("paid_out",!1).gt("amount_minutes",0)]),p=(f==null?void 0:f.gifted_minutes)??0,v=(m||[]).reduce((g,y)=>g+(y.amount_minutes||0),0);return{total:(f==null?void 0:f.total_minutes)??0,gifted:p,bounty:v}}}),u=((c==null?void 0:c.gifted)??0)+((c==null?void 0:c.bounty)??0);return s.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/70 backdrop-blur-sm px-4",children:[s.jsxs("div",{className:"w-full max-w-md max-h-[90vh] overflow-y-auto bg-neutral-900 border border-white/10 rounded-2xl shadow-2xl",children:[s.jsxs("div",{className:"relative bg-gradient-to-r from-pink-500/20 to-purple-500/20 px-6 pt-7 pb-5 border-b border-white/10",children:[s.jsx("button",{onClick:e,className:"absolute top-6 right-4 w-10 h-10 rounded-full bg-white/10 hover:bg-white/20 flex items-center justify-center transition-colors",children:s.jsx(We,{className:"w-5 h-5 text-white/70"})}),s.jsxs("div",{className:"text-center",children:[s.jsx("div",{className:"text-3xl mb-2",children:"💰"}),s.jsx("h2",{className:"text-lg font-bold text-white",children:"4 Ways To Earn Money"}),s.jsx("p",{className:"text-sm text-white/50 mt-1",children:"Tap any way below to see exactly how it works."})]})]}),l===null&&s.jsxs("div",{className:"px-5 py-5 space-y-3",children:[uy.map((f,m)=>{const p=f.icon;return s.jsxs("button",{onClick:()=>a(m),className:`w-full text-left rounded-xl border px-4 py-4 flex items-center gap-3 transition-all hover:brightness-125 ${f.bg} ${f.border}`,children:[s.jsx("div",{className:`p-2.5 rounded-lg bg-white/5 shrink-0 ${f.color}`,children:s.jsx(p,{className:"w-5 h-5"})}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("h3",{className:"font-bold text-white text-sm",children:f.title}),s.jsx("p",{className:"text-xs text-white/60 mt-0.5",children:f.short}),s.jsx("p",{className:`text-xs font-semibold mt-1.5 ${f.color}`,children:f.payout})]}),s.jsx(Jd,{className:"w-4 h-4 text-white/40 shrink-0"})]},m)}),s.jsxs("button",{onClick:()=>o(!0),className:"w-full mt-2 rounded-xl bg-gradient-to-r from-emerald-500 to-green-600 text-white font-black text-sm py-3 flex items-center justify-center gap-2 hover:opacity-90 transition-opacity",children:[s.jsx($t,{className:"w-4 h-4"}),"REDEEM MINUTES FOR CASH (",u," cashable)"]}),s.jsxs("button",{onClick:()=>{e(),t("/earnings-chat")},className:"w-full rounded-xl bg-pink-500/15 border border-pink-500/40 text-pink-300 font-bold text-sm py-3 flex items-center justify-center gap-2 hover:bg-pink-500/25 transition-colors",children:[s.jsx(An,{className:"w-4 h-4"}),"Girls Only Earnings Chat"]}),s.jsx("button",{onClick:()=>{e(),t("/discover")},className:"w-full rounded-xl bg-white/10 hover:bg-white/20 text-white font-bold text-sm py-3 transition-colors",children:"Start Chatting With Guys"}),s.jsx("p",{className:"text-[11px] text-white/40 text-center",children:"You can also earn extra minutes from Weekly Challenges, Spin to Win, and inviting friends."})]}),l&&s.jsxs("div",{className:"px-5 py-5",children:[s.jsxs("button",{onClick:()=>a(null),className:"flex items-center gap-1 text-xs text-white/50 hover:text-white/80 mb-3 transition-colors",children:[s.jsx(Rn,{className:"w-4 h-4"})," All ways to earn"]}),s.jsxs("div",{className:`rounded-xl border px-5 py-4 ${l.bg} ${l.border}`,children:[s.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[s.jsx("div",{className:`p-2 rounded-lg bg-white/5 ${l.color}`,children:(()=>{const f=l.icon;return s.jsx(f,{className:"w-5 h-5"})})()}),s.jsxs("div",{children:[s.jsx("h3",{className:"font-bold text-white text-base",children:l.title}),s.jsx("p",{className:`text-xs font-semibold ${l.color}`,children:l.payout})]})]}),s.jsx("p",{className:"text-[11px] font-bold uppercase tracking-wider text-white/40 mb-2",children:"How it works"}),s.jsx("ol",{className:"space-y-2",children:l.how.map((f,m)=>s.jsxs("li",{className:"flex items-start gap-2 text-sm text-white/80",children:[s.jsx("span",{className:"w-5 h-5 shrink-0 rounded-full bg-white/10 text-[11px] font-bold flex items-center justify-center text-white/70",children:m+1}),s.jsx("span",{className:"leading-snug",children:f})]},m))})]}),s.jsxs("div",{className:"bg-white/5 border border-white/10 rounded-xl px-4 py-3 mt-3",children:[s.jsx("p",{className:"text-xs font-bold text-amber-300/90 uppercase tracking-wider mb-2",children:"✨ Good to know"}),s.jsx("ul",{className:"space-y-2",children:l.tips.map((f,m)=>s.jsxs("li",{className:"flex items-start gap-2 text-xs text-white/60",children:[s.jsx(Mr,{className:"w-3.5 h-3.5 text-emerald-400 mt-0.5 shrink-0"}),s.jsx("span",{children:f})]},m))})]}),s.jsxs("div",{className:"mt-4 space-y-3",children:[s.jsxs("button",{onClick:()=>o(!0),className:"w-full rounded-xl bg-gradient-to-r from-emerald-500 to-green-600 text-white font-black text-sm py-3 flex items-center justify-center gap-2 hover:opacity-90 transition-opacity",children:[s.jsx($t,{className:"w-4 h-4"}),"REDEEM MINUTES FOR CASH (",u," cashable)"]}),s.jsx("button",{onClick:()=>{e(),t("/discover")},className:"w-full rounded-xl bg-white/10 hover:bg-white/20 text-white font-bold text-sm py-3 transition-colors",children:"Start Chatting With Guys"})]})]})]}),i&&s.jsx(gh,{onClose:()=>o(!1),currentMinutes:(c==null?void 0:c.total)??0,giftedMinutes:(c==null?void 0:c.gifted)??0,bountyMinutes:(c==null?void 0:c.bounty)??0,onSuccess:()=>d()})]})}const DO=e=>{try{const t=new Date(e);return`${t.getMonth()+1}/${t.getDate()}/${t.getFullYear()}`}catch{return""}},LO=e=>{switch(e){case"basic":return"basic";case"premium":return"premium";
471case"renewal":return"renewal";case"streak":return"streak bonus";default:return e}},MO=({userId:e})=>{const{summary:t,loading:n}=OO(e),[r,a]=h.useState(!1);if(n||!t)return null;const i=t.total_minutes_earned??0,o=(t.total_usd_earned??i*.01).toFixed(2),l=t.active_links_count??0,c=t.pending_logs??[],d=(t.recent_logs??[]).filter(u=>u.amount_minutes>0);return s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"bg-[#1a1f2e] border border-white/10 rounded-2xl p-5 space-y-5",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx($t,{className:"w-5 h-5 text-pink-500"}),s.jsx("h3",{className:"text-white font-bold text-base",children:"Lifetime Bounty History"})]}),s.jsxs("div",{className:"grid grid-cols-3 gap-2.5",children:[s.jsxs("div",{className:"bg-pink-500/10 border border-pink-500/30 rounded-xl p-3 text-center",children:[s.jsx("div",{className:"text-pink-400 text-2xl font-black leading-none",children:i}),s.jsx("div",{className:"text-white/60 text-[10px] mt-1.5",children:"Minutes earned"})]}),s.jsxs("div",{className:"bg-pink-500/10 border border-pink-500/30 rounded-xl p-3 text-center",children:[s.jsxs("div",{className:"text-pink-400 text-2xl font-black leading-none",children:["$",o]}),s.jsx("div",{className:"text-white/60 text-[10px] mt-1.5",children:"Cash value"})]}),s.jsxs("div",{className:"bg-pink-500/10 border border-pink-500/30 rounded-xl p-3 text-center",children:[s.jsx("div",{className:"text-pink-400 text-2xl font-black leading-none",children:l}),s.jsx("div",{className:"text-white/60 text-[10px] mt-1.5",children:"Active tracks"})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx("div",{className:"text-white font-bold text-sm",children:"Pending Tracker"}),s.jsx("p",{className:"text-white/40 text-xs",children:"You'll earn a bounty if these guys go VIP before their track expires."}),s.jsx("p",{className:"text-white/40 text-[11px] italic",children:"When you and a guy have a real DM conversation — you both send at least one message — you're linked for 30 days. Going offline, unmatching, or blocking won't take it away. Call-only tracks still go to the partner with the most recent interaction."}),c.length===0?s.jsx("p",{className:"text-white/30 text-xs italic pt-2",children:"No active tracks yet — chat with guys on video calls or DMs to start tracking bounties."}):s.jsx("div",{className:"space-y-2 pt-1",children:c.map(u=>s.jsxs("div",{className:"flex items-center justify-between border-b border-white/5 pb-2 last:border-0",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"w-9 h-9 rounded-full bg-blue-500/20 flex items-center justify-center",children:s.jsx(er,{className:"w-4 h-4 text-blue-400"})}),s.jsxs("div",{children:[s.jsx("div",{className:"text-blue-400 font-bold text-sm",children:u.partner_name||"Member"}),s.jsxs("div",{className:"text-white/50 text-[11px]",children:["Tracked via ",u.interaction_type==="dm"?"DM":"Video Call"]})]})]}),s.jsx("span",{className:"bg-blue-500/20 text-blue-400 text-[10px] font-black px-2.5 py-1 rounded tracking-wider",children:"TRACKING"})]},u.id))})]}),s.jsxs("div",{className:"space-y-2 pt-2",children:[s.jsx("div",{className:"text-white font-bold text-sm",children:"Awarded Bounties"}),d.length===0?s.jsx("p",{className:"text-white/30 text-xs italic",children:"No bounties awarded yet — convert your first guy to VIP to earn minutes!"}):s.jsx("div",{className:"space-y-2",children:d.map(u=>s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"w-9 h-9 rounded-full bg-pink-500/20 flex items-center justify-center",children:s.jsx(Ql,{className:"w-4 h-4 text-pink-400 fill-pink-400"})}),s.jsxs("div",{children:[s.jsxs("div",{className:"text-pink-400 font-bold text-sm",children:["+",u.amount_minutes," minutes"]}),s.jsxs("div",{className:"text-white/50 text-[11px]",children:["From: ",u.partner_name||"Member"," · ",LO(u.source)]})]})]}),s.jsx("span",{className:"text-white/40 text-[11px]",children:DO(u.created_at)})]},u.id))})]}),s.jsx("div",{className:"pt-2 text-center",children:s.jsx("button",{onClick:()=>a(!0),className:"text-pink-400 hover:text-pink-300 font-bold text-sm transition-colors",children:"Learn how to earn more →"})})]}),r&&s.jsx(nx,{onClose:()=>a(!1)})]})},$O="/assets/rewards-gift-CNfLL48P.png",FO="/assets/vip-rocket-DygmVaf2.png",UO="/assets/settings-gear-bGYaFV3j.png",BO="/assets/rulebook-book-BbaVBYeP.png",zO="/assets/logout-icon-BDbQEsr_.png",Wj=({onClose:e})=>{const t=sn(),{user:n,signOut:r}=it(),a=h.useRef(null),[i,o]=h.useState(!1),[l,c]=h.useState("hub"),[d,u]=h.useState(!1),[f,m]=h.useState(!1);h.useEffect(()=>{let N=null;return navigator.mediaDevices.getUserMedia({video:{facingMode:"user"},audio:!1}).then(k=>{N=k,a.current&&(a.current.srcObject=k)}).catch(()=>{}),()=>
471{N==null||N.getTracks().forEach(k=>k.stop())}},[]);const{data:p}=he({queryKey:["profile-balance",n==null?void 0:n.id],enabled:!!n,queryFn:async()=>{const{data:N}=await S.functions.invoke("earn-minutes",{body:{type:"get_balance",userId:n.id}});return{minutes:(N==null?void 0:N.totalMinutes)??0,adPoints:(N==null?void 0:N.adPoints)??0,productPoints:(N==null?void 0:N.productPoints)??0}}}),{data:v}=he({queryKey:["profile-chance-enhancer",n==null?void 0:n.id],enabled:!!n,queryFn:async()=>{const{data:N}=await S.functions.invoke("spin-wheel",{body:{type:"get_chance_enhancer",userId:n.id}});return N||{chance_enhancer:10,is_vip:!1}}}),{data:g}=he({queryKey:["profile-is-vip",n==null?void 0:n.id],enabled:!!n,queryFn:async()=>{const{data:N}=await S.rpc("is_user_vip",{_user_id:n.id});return N??!1}}),{data:y}=he({queryKey:["profile-member-gender",n==null?void 0:n.id],enabled:!!n,queryFn:async()=>{const{data:N}=await S.from("members").select("gender").eq("id",n.id).single();return N}}),b=(v==null?void 0:v.chance_enhancer)??10,x=((y==null?void 0:y.gender)??"").toLowerCase()==="female",{data:w,refetch:_}=he({queryKey:["profile-cashout-balance",n==null?void 0:n.id],enabled:!!n,queryFn:async()=>{const[{data:N},{data:k}]=await Promise.all([S.from("member_minutes").select("total_minutes, gifted_minutes").eq("user_id",n.id).single(),S.from("bounty_earnings").select("amount_minutes").eq("female_id",n.id).eq("clawed_back",!1).eq("paid_out",!1).gt("amount_minutes",0)]),C=(N==null?void 0:N.gifted_minutes)??0,A=(k||[]).reduce((I,O)=>I+(O.amount_minutes||0),0);return{total:(N==null?void 0:N.total_minutes)??0,gifted:C,bounty:A}}}),j=async()=>{await r(),t("/")};return d&&n?s.jsx(Vj,{onClose:()=>u(!1),userId:n.id,vipTier:g?(v==null?void 0:v.vip_tier)==="premium"?"premium":"basic":null,genderFilter:"everyone",onGenderFilterChange:()=>{}}):i?s.jsx(AO,{onClose:()=>o(!1),initialView:l}):s.jsxs("div",{className:"min-h-screen bg-black text-white font-['Antigone',sans-serif] flex flex-col items-center px-4 pb-8",children:[s.jsx("div",{className:"w-full flex items-center pt-3 pb-2",children:s.jsxs("button",{onClick:()=>e?e():t("/videocall"),className:"flex items-center gap-1 hover:opacity-80 transition-opacity",children:[s.jsx(Rn,{className:"w-7 h-7"}),s.jsx("span",{className:"font-black text-sm tracking-wider",children:"BACK"})]})}),s.jsx("div",{className:"mt-4 mb-6",children:s.jsx("div",{className:"w-20 h-20 rounded-full border-2 border-neutral-600 overflow-hidden bg-neutral-800",children:s.jsx("video",{ref:a,autoPlay:!0,playsInline:!0,muted:!0,className:"w-full h-full object-cover scale-x-[-1]"})})}),s.jsx("div",{className:"text-center mb-2",children:s.jsxs("div",{className:"bg-orange-500/10 border border-orange-500/30 rounded-full px-4 py-1.5 inline-flex items-center gap-2",children:[s.jsxs("span",{className:"text-orange-400 text-sm font-black",children:["🔥 ",Math.round(b),"% Chance Enhancer"]}),g&&s.jsx("span",{className:"text-[10px] bg-purple-500/20 text-purple-400 px-1.5 py-0.5 rounded font-bold",children:"VIP"})]})}),s.jsxs("p",{className:"text-sm font-bold text-neutral-300 mb-8",children:[(p==null?void 0:p.minutes)??0," Minutes | ",(p==null?void 0:p.adPoints)??0," Ad Points"]}),x&&s.jsx("div",{className:"w-full max-w-sm mb-8",children:s.jsx(MO,{userId:(n==null?void 0:n.id)??null})}),s.jsxs("div",{className:"w-full max-w-sm mb-8",children:[s.jsxs("button",{onClick:()=>m(!0),className:"w-full bg-gradient-to-r from-emerald-600 to-green-500 hover:from-emerald-500 hover:to-green-400 text-white font-black text-sm py-4 rounded-2xl flex items-center justify-center gap-2 transition-all shadow-lg shadow-emerald-500/30 border border-emerald-400/30",children:[s.jsx($t,{className:"w-5 h-5"}),"REDEEM MINUTES FOR CASH (",((w==null?void 0:w.gifted)??0)+((w==null?void 0:w.bounty)??0)," cashable)"]}),s.jsx("p",{className:"text-[11px] text-neutral-400 text-center mt-1.5 font-bold",children:"Cash out your earned minutes via PayPal"})]}),s.jsxs("div",{className:"flex justify-center gap-8 mb-8",children:[s.jsx(gi,{src:tx,label:"EVENTS",onClick:()=>{c("hub"),o(!0)}}),s.jsx(gi,{src:$O,label:"MY REWARDS",onClick:()=>t("/my-rewards")}),s.jsx(gi,{src:FO,label:"VIP SETTINGS",onClick:g?()=>u(!0):void 0,disabled:!g})]}),s.jsxs("button",{onClick:()=>t("/videocall",{state:{openVip:!0}}),className:"relative w-full max-w-sm mb-8 rounded-2xl p-5 flex items-center justify-center gap-3 hover:scale-[1.02] transition-all shadow-lg shadow-yellow-500/30 border border-white/10 overflow-hidden",style:{background:"linear-gradient(135deg, #f97316, #ec4899, #8b5cf6, #3b82f6, #06b6d4)"},children:[s.jsx("span",{className:"absolute text-lg animate-bounce",style:{to
471p:"8%",left:"8%",animationDelay:"0s",animationDuration:"2s"},children:"🎉"}),s.jsx("span",{className:"absolute text-lg animate-bounce",style:{top:"12%",right:"10%",animationDelay:"0.5s",animationDuration:"2.5s"},children:"⭐"}),s.jsx("span",{className:"absolute text-sm animate-bounce",style:{bottom:"10%",left:"15%",animationDelay:"1s",animationDuration:"1.8s"},children:"🔥"}),s.jsx("span",{className:"absolute text-sm animate-bounce",style:{bottom:"8%",right:"12%",animationDelay:"0.3s",animationDuration:"2.2s"},children:"💎"}),s.jsx("span",{className:"absolute text-xs animate-bounce",style:{top:"40%",left:"3%",animationDelay:"0.7s",animationDuration:"2.8s"},children:"🚀"}),s.jsx("span",{className:"absolute text-xs animate-bounce",style:{top:"35%",right:"4%",animationDelay:"1.2s",animationDuration:"2.1s"},children:"👑"}),s.jsxs("div",{className:"flex flex-col items-center z-10",children:[s.jsx("span",{className:"font-black text-xl tracking-wider",children:"BECOME VIP"}),s.jsx("span",{className:"text-xs font-bold text-white/80",children:"Unlock exclusive rewards & features ✨"})]})]}),s.jsx("button",{onClick:()=>t("/how-to-guide"),className:"font-black text-base underline underline-offset-4 decoration-2 mb-8 hover:opacity-80 transition-opacity tracking-wide",children:"How To Guide"}),s.jsxs("div",{className:"flex justify-center gap-8 mb-8",children:[s.jsx(gi,{src:UO,label:"SETTINGS",onClick:()=>t("/settings")}),s.jsx(gi,{src:BO,label:"RULEBOOK",onClick:()=>t("/rules")}),s.jsx(gi,{src:zO,label:"LOGOUT",onClick:j})]}),s.jsx("button",{className:"w-full max-w-xs bg-gradient-to-r from-red-600 to-orange-500 text-white font-black text-lg py-3 rounded-full hover:opacity-90 transition-opacity shadow-lg mb-6 tracking-wide",children:"Unlock Rewards Early"}),s.jsxs("div",{className:"flex items-center gap-2 text-xs text-neutral-400 font-bold",children:[s.jsx("a",{href:"/terms",className:"hover:text-white transition-colors",children:"Terms"}),s.jsx("span",{children:"|"}),s.jsx("a",{href:"/privacy",className:"hover:text-white transition-colors",children:"Privacy"}),s.jsx("span",{children:"|"}),s.jsx("a",{href:"/rules",className:"hover:text-white transition-colors",children:"Rules"}),s.jsx("span",{children:"|"}),s.jsx("a",{href:"/how-to-guide",className:"hover:text-white transition-colors",children:"How To Guide"})]}),f&&s.jsx(gh,{onClose:()=>m(!1),currentMinutes:(w==null?void 0:w.total)??0,giftedMinutes:(w==null?void 0:w.gifted)??0,bountyMinutes:(w==null?void 0:w.bounty)??0,onSuccess:()=>_()})]})},gi=({src:e,label:t,onClick:n,disabled:r})=>s.jsxs("button",{onClick:n,disabled:r,className:`flex flex-col items-center gap-1 transition-transform ${r?"opacity-40 cursor-not-allowed":"hover:scale-110"}`,children:[s.jsx("img",{src:e,alt:t,className:"w-14 h-14 object-contain"}),s.jsx("span",{className:"text-[10px] font-black tracking-wider text-center leading-tight",children:t})]}),qO=Object.freeze(Object.defineProperty({__proto__:null,default:Wj},Symbol.toStringTag,{value:"Module"})),VO={common:"text-white",rare:"text-red-500",legendary:"text-yellow-400"},WO={common:"",rare:"🔥",legendary:"👑"},HO=["Products","Giftcards","Perks"],GO={Products:"product",Giftcards:"giftcard",Perks:"perk"},KO=["Order shipped","Gift Card Sent on Email","completed","delivered"],YO={processing:{text:"🔄 Processing your order...",color:"text-blue-400"},pending_shipping:{text:"📦 Preparing to ship — please wait!",color:"text-yellow-400"},pending_payment:{text:"💳 Awaiting shipping payment",color:"text-orange-400"},"Order placed":{text:"✅ Order has been placed — please wait!",color:"text-cyan-400"},"Order shipped":{text:"🚚 Your order has been shipped!",color:"text-green-400"},"Item Out of stock":{text:"❌ Out of stock — minutes refunded to your balance!",color:"text-red-400"},"Gift Card Form Filled by user":{text:"📝 Gift card form received — processing!",color:"text-indigo-400"},"Gift Card Sent on Email":{text:"✉️ Gift card sent to your email!",color:"text-emerald-400"},"Redeemed Milestone Reward":{text:"🏆 Milestone reward redeemed!",color:"text-purple-400"},"Redeemed Product Point Reward":{text:"🎯 Point reward redeemed!",color:"text-violet-400"},"Redeemed VIP Gift Reward":{text:"⭐ VIP gift reward redeemed!",color:"text-amber-400"},"Redeemed as Anchor User Reward":{text:"⚓ Anchor reward redeemed!",color:"text-teal-400"}},Hj=({onClose:e})=>{const t=sn(),{user:n}
471=it(),[r,a]=h.useState(!1),[i,o]=h.useState("Products"),[l,c]=h.useState(!1),[d,u]=h.useState(!1),{subscribed:f}=_c((n==null?void 0:n.id)??null),{data:m}=he({queryKey:["cashout-balance",n==null?void 0:n.id],enabled:!!n,queryFn:async()=>{const{data:R}=await S.from("member_minutes").select("total_minutes, gifted_minutes").eq("user_id",n.id).single();return{total:(R==null?void 0:R.total_minutes)??0,gifted:(R==null?void 0:R.gifted_minutes)??0}}}),p=(m==null?void 0:m.total)??0,v=(m==null?void 0:m.gifted)??0,g=wt(),[y,b]=h.useState(null),[x,w]=h.useState({shipping_name:"",shipping_address:"",shipping_city:"",shipping_state:"",shipping_zip:"",shipping_country:""}),[_,j]=h.useState(!1),[N,k]=h.useState(null),{data:C=[],isLoading:A}=he({queryKey:["my-redemptions",n==null?void 0:n.id],enabled:!!n,queryFn:async()=>{const{data:R,error:U}=await S.from("member_redemptions").select("*").eq("user_id",n.id).order("created_at",{ascending:!1});if(U)throw U;return R}}),{data:I=[],isLoading:O}=he({queryKey:["gifts-received",n==null?void 0:n.id],enabled:!!n,queryFn:async()=>{const{data:R,error:U}=await S.from("gift_transactions").select("*").eq("recipient_id",n.id).eq("status","completed").order("created_at",{ascending:!1});if(U)throw U;return R}}),{data:P=[],isLoading:T}=he({queryKey:["my-gift-cards",n==null?void 0:n.id],enabled:!!n&&i==="Giftcards",queryFn:async()=>{const{data:R,error:U}=await S.functions.invoke("redeem-giftcard",{body:{action:"my-cards"}});if(U)throw U;return(R==null?void 0:R.cards)||[]}}),E=(R,U)=>{navigator.clipboard.writeText(R),k(U),B.success("Code copied!"),setTimeout(()=>k(null),2e3)},W=C.filter(R=>{const U=GO[i];return U==="product"?R.reward_type==="product"||R.reward_type==="wishlist"||R.reward_type==="promo_link_clicks":R.reward_type===U}),V=R=>{o(R),a(!1)},q=R=>!KO.includes(R),D=R=>{const U=YO[R.status];return U||{text:R.status,color:"text-neutral-300"}},$=R=>{w({shipping_name:R.shipping_name||"",shipping_address:R.shipping_address||"",shipping_city:R.shipping_city||"",shipping_state:R.shipping_state||"",shipping_zip:R.shipping_zip||"",shipping_country:R.shipping_country||""}),b(R)},z=async()=>{if(y){if(!x.shipping_name||!x.shipping_address||!x.shipping_country){B.error("Please fill in name, address, and country");return}j(!0);try{const{error:R}=await S.from("member_redemptions").update({shipping_name:x.shipping_name,shipping_address:x.shipping_address,shipping_city:x.shipping_city,shipping_state:x.shipping_state,shipping_zip:x.shipping_zip,shipping_country:x.shipping_country}).eq("id",y.id).eq("user_id",n.id);if(R)throw R;B.success("Shipping details updated!"),b(null),g.invalidateQueries({queryKey:["my-redemptions"]})}catch(R){B.error(R.message||"Failed to update")}j(!1)}};return s.jsxs("div",{className:"min-h-screen bg-black text-white font-['Antigone',sans-serif] flex flex-col",children:[s.jsx("div",{className:"w-full flex items-center pt-3 pb-2 px-4",children:s.jsxs("button",{onClick:()=>e?e():t(-1),className:"flex items-center gap-1 hover:opacity-80 transition-opacity",children:[s.jsx(Rn,{className:"w-7 h-7"}),s.jsx("span",{className:"font-black text-sm tracking-wider",children:"BACK"})]})}),s.jsx("h1",{className:"text-4xl font-black text-center italic mt-2 mb-4",children:"My Rewards"}),s.jsx("div",{className:"px-6 mb-4 max-w-lg mx-auto w-full",children:s.jsxs("button",{onClick:()=>u(!0),className:"w-full bg-emerald-600 hover:bg-emerald-500 text-white font-black text-sm py-3 rounded-full flex items-center justify-center gap-2 transition-colors shadow-lg",children:[s.jsx($t,{className:"w-4 h-4"}),"Cash Out Minutes (",p??0," available)"]})}),s.jsxs("div",{className:"px-6 mb-6 max-w-lg mx-auto w-full",children:[s.jsxs("button",{onClick:()=>a(!r),className:"w-full bg-black border-2 border-white rounded-full py-3 px-6 flex items-center justify-center gap-2 font-black text-lg tracking-wide",children:[i,r?s.jsx(tp,{className:"w-5 h-5"}):s.jsx(lb,{className:"w-5 h-5"})]}),r&&s.jsx("div",{className:"border-2 border-white rounded-2xl mt-2 overflow-hidden bg-black",children:HO.map(R=>s.jsx("button",{onClick:()=>V(R),className:`w-full py-3 text-center font-black text-lg tracking-wide hover:bg-neutral-800 transition-colors ${R===i?"text-white":"text-neutral-400"}`,children:R},R))})]}),s.jsx("div",{className:"flex-1 px-4 pb-6",children:i==="Giftcards"?T?s.jsx("div",{className:"flex items-center justify-center py-20",children:s.jsx("div",{className:"w-10 h-10 border-4 border-white/30 border-t-white rounded-full animate-spin"})}):P.length===0?s.jsx("p",{className:"text-neutral-500 text-center py-16 font-bold",children:"No redeemed giftcards yet."}):s.jsx("div",{className:"space-y-3 max-w-lg mx-auto",children:P.map(R=>s.jsxs("div",{className:"bg-neutral-900 border border-neutral-800 rounded-2xl p-4",children:[s.jsxs("div",{className:"flex items-center justify-between mb-2",children:[s.jsxs("div",{children:[s.jsx("p",{className:"font-black text-sm",children:R.brand}),s.jsxs("p",{className:"text-green-400 font-black text-xs",children:["$",R.value_amount," Gift Card"]})]}),s.jsx("p",{className:"text-[10px] text-neutral-500",children:new Date(R.claimed_at).toLocaleDateString()})]}),s.jsxs("div",{className:"flex items-center gap-2 bg-black/50 border border-neutral-700 rounded-xl px-4 py-3",children:[s.jsx("code",{className:"flex-1 text-sm font-mono text-white tracking-wider select-all",children:R.code}),s.jsx("button",{onClick:()=>E(R.code,R.id),className:"flex-shrink-0 p-2 rounded-lg bg-white/10 hover:bg-white/20 transition-colors",children:N===R.id?s.jsx(Mr,{className:"w-4 h-4 text-green-400"}):s.jsx(Zd,{className:"w-4 h-4 text-neutral-400"})})]})]},R.id))}):A?s.jsx("div",{className:"flex items-center justify-center py-20",children:s.jsx("div",{className:"w-10 h-10 border-4 border-white/30 border-t-white rounded-full animate-spin"})}):W.length===0?s.jsxs("p",{className:"text-neutral-500 text-center py-16 font-bold",children:["No redeemed ",i.toLowerCase()," yet."]}):s.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-4 max-w-5xl mx-auto",children:W.map(R=>{const U=VO[R.reward_rarity]||"text-white",ee=WO[R.reward_rarity]||"",ae=R.cashout_amount&&R.cashout_amount>0,xe=D(R);return s.jsxs("div",{className:"rounded-2xl overflow-hidden bg-neutral-900 border border-neutral-800",children:[s.jsxs("div",{className:"px-3 pt-2",children:[s.jsxs("span",{className:`font-black text-sm ${U}`,children:[R.reward_rarity.charAt(0).toUpperCase()+R.reward_rarity.slice(1),ee]}),ae&&s.jsxs("span",{className:"block text-green-400 font-black text-xs",children:["Cash Out $",R.cashout_amount]})]}),s.jsx("div",{className:"aspect-square bg-neutral-800 mx-2 mt-1 rounded-xl overflow-hidden",children:R.reward_image_url?s.jsx("img",{src:R.reward_image_url,alt:
471R.reward_title,className:"w-full h-full object-cover"}):s.jsx("div",{className:"w-full h-full flex items-center justify-center",children:s.jsx("span",{className:"text-4xl",children:"🎁"})})}),s.jsxs("div",{className:"p-3 text-center",children:[s.jsx("p",{className:"font-black text-sm leading-tight",children:R.reward_title}),ae?s.jsxs(s.Fragment,{children:[s.jsxs("p",{className:"text-green-400 font-black text-xs mt-1",children:["💰 You cashed out $",R.cashout_amount]}),R.cashout_paypal&&s.jsxs("p",{className:"text-[10px] text-neutral-400 mt-1",children:["PayPal: ",R.cashout_paypal]}),s.jsx("p",{className:`text-xs font-bold mt-1 ${xe.color}`,children:xe.text}),s.jsx("p",{className:"text-[10px] text-neutral-500 font-bold mt-1 uppercase",children:"CASHOUT REWARD"})]}):s.jsxs(s.Fragment,{children:[s.jsx("p",{className:`text-[10px] font-bold mt-1 ${xe.color}`,children:xe.text}),R.shipping_tracking_url&&s.jsx("a",{href:R.shipping_tracking_url,target:"_blank",rel:"noopener noreferrer",className:"text-blue-400 font-bold text-[10px] mt-1 hover:underline inline-block",children:"📍 Track Shipment"}),q(R.status)&&R.reward_type==="product"&&s.jsxs("button",{onClick:()=>$(R),className:"text-red-500 font-bold text-xs mt-2 hover:underline flex items-center justify-center gap-1 mx-auto",children:[s.jsx(bd,{className:"w-3 h-3"}),"Edit Shipping Details"]})]})]})]},R.id)})})}),y&&s.jsx("div",{className:"fixed inset-0 z-50 bg-black/80 flex items-end justify-center",children:s.jsxs("div",{className:"bg-neutral-900 w-full max-w-md rounded-t-3xl p-6 space-y-3 max-h-[85vh] overflow-y-auto pb-10",children:[s.jsxs("div",{className:"flex items-center justify-between mb-2",children:[s.jsx("h2",{className:"font-black text-lg",children:"Edit Shipping Details"}),s.jsx("button",{onClick:()=>b(null),className:"text-neutral-400 font-bold text-sm",children:"✕"})]}),s.jsx("input",{placeholder:"Full Name *",value:x.shipping_name,onChange:R=>w(U=>({...U,shipping_name:R.target.value})),className:"w-full bg-white/10 border-2 border-white/20 rounded-xl px-4 py-3 font-bold text-white placeholder:text-white/40 focus:outline-none focus:border-white/50"}),s.jsx("input",{placeholder:"Country/Region *",value:x.shipping_country,onChange:R=>w(U=>({...U,shipping_country:R.target.value})),className:"w-full bg-white/10 border-2 border-white/20 rounded-xl px-4 py-3 font-bold text-white placeholder:text-white/40 focus:outline-none focus:border-white/50"}),s.jsx("textarea",{placeholder:"Address *",value:x.shipping_address,onChange:R=>w(U=>({...U,shipping_address:R.target.value})),rows:2,className:"w-full bg-white/10 border-2 border-white/20 rounded-xl px-4 py-3 font-bold text-white placeholder:text-white/40 focus:outline-none focus:border-white/50 resize-none"}),s.jsx("input",{placeholder:"City",value:x.shipping_city,onChange:R=>w(U=>({...U,shipping_city:R.target.value})),className:"w-full bg-white/10 border-2 border-white/20 rounded-xl px-4 py-3 font-bold text-white placeholder:text-white/40 focus:outline-none focus:border-white/50"}),s.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:[s.jsx("input",{placeholder:"State",value:x.shipping_state,onChange:R=>w(U=>({...U,shipping_state:R.target.value})),className:"w-full bg-white/10 border-2 border-white/20 rounded-xl px-4 py-3 font-bold text-white placeholder:text-white/40 focus:outline-none focus:border-white/50"}),s.jsx("input",{placeholder:"Zip",value:x.shipping_zip,onChange:R=>w(U=>({...U,shipping_zip:R.target.value})),className:"w-full bg-white/10 border-2 border-white/20 rounded-xl px-4 py-3 font-bold text-white placeholder:text-white/40 focus:outline-none focus:border-white/50"})]}),s.jsx("button",{onClick:z,disabled:_,className:"w-full bg-white text-black font-black text-lg py-3 rounded-full hover:opacity-90 transition-opacity disabled:opacity-50 mt-4",children:_?"Saving...":"Save Changes"})]})}),f&&s.jsxs("div",{className:"px-4 pb-4",children:[s.jsxs("button",{onClick:()=>c(!l),className:"w-full flex items-center justify-center gap-2 py-3 bg-purple-600/20 border border-purple-500/30 rounded-2xl font-black text-sm tracking-wide text-purple-300 hover:bg-purple-600/30 transition-colors",children:[s.jsx(Ft,{className:"w-5 h-5"}),"GIFTS RECEIVED (",I.length,")",l?s.jsx(tp,{className:"w-4 h-4"}):s.jsx(lb,{className:"w-4 h-4"})]}),l&&s.jsx("div",{className:"mt-3 space-y-2",children:O?s.jsx("div",{className:"flex justify-center py-6",children:s.jsx("div",{className:"w-8 h-8 border-4 border-purple-400/30 border-t-purple-400 rounded-full animate-spin"})}):I.length===0?s.jsx("p",{className:"text-neutral-500 text-center py-6 font-bold text-sm",children:"No gifts received yet."}):I.map(R=>s.jsxs("div",{className:"flex items-center justify-between bg-neutral-900 border border-neutral-800 rounded-xl px-4 py-3",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"w-10 h-10 rounded-full bg-purple-600/20 flex items-center justify-center",children:s.jsx(Ft,{className:"w-5 h-5 text-purple-400"})}),s.jsxs("div",{children:[s.jsxs("p",{className:"font-black text-sm",children:["+",R.minutes_amount," Minutes"]}),s.jsxs("p",{className:"text-[10px] text-neutral-500",children:["From: ",R.sender_id.slice(0,8),"..."]})]})]}),s.jsx("p",{className:"text-[10px] text-neutral-500 font-bold",children:new Date(R.created_at).toLocaleDateString()})]},R.id))})]}),s.jsx("div",{className:"px-6 pb-8 pt-4 max-w-lg mx-auto w-full",children:s.jsx("button",{className:"w-full bg-gradient-to-r from-red-600 to-orange-500 text-white font-black text-lg py-3 rounded-full hover:opacity-90 transition-opacity shadow-lg tracking-wide",children:"Unlock Rewards Early"})}),d&&s.jsx(gh,{onClose:()=>u(!1),currentMinutes:p??0,giftedMinutes:v??0,onSuccess:()=>
471g.invalidateQueries({queryKey:["cashout-balance"]})})]})},QO=Object.freeze(Object.defineProperty({__proto__:null,default:Hj},Symbol.toStringTag,{value:"Module"})),Nf=100;function JO(){const{user:e}=it(),t=wt(),n=_C({queryKey:["conversations",e==null?void 0:e.id],enabled:!!e,staleTime:15e3,initialPageParam:0,getNextPageParam:(a,i)=>a.length<Nf?void 0:i.length*Nf,queryFn:async({pageParam:a})=>{if(!e)return[];const{data:i,error:o}=await S.from("conversations").select("*").or(`participant_1.eq.${e.id},participant_2.eq.${e.id}`).order("last_message_at",{ascending:!1}).range(a,a+Nf-1);if(o)throw o;if(!i||i.length===0)return[];const l=i.map(_=>_.participant_1===e.id?_.participant_2:_.participant_1),d=(await Promise.all(Array.from({length:Math.ceil(l.length/50)},(_,j)=>S.from("members").select("id, name, image_url, gender, last_active_at").in("id",l.slice(j*50,j*50+50))))).flatMap(_=>_.data||[]),u=new Map((d||[]).map(_=>[_.id,_])),f=i.map(_=>_.id),m=[];for(let _=0;_<f.length;_+=25)m.push(f.slice(_,_+25));const v=(await Promise.all(m.map(_=>S.from("dm_messages").select("conversation_id, content, created_at").in("conversation_id",_).order("created_at",{ascending:!1}).limit(1e3)))).flatMap(_=>_.data||[]),g=new Map;if(v)for(const _ of v)g.has(_.conversation_id)||g.set(_.conversation_id,_.content);const b=(await Promise.all(m.map(_=>S.from("dm_messages").select("conversation_id").in("conversation_id",_).or(`sender_id.is.null,sender_id.neq.${e.id}`).is("read_at",null)))).flatMap(_=>_.data||[]),x=new Map;if(b)for(const _ of b)x.set(_.conversation_id,(x.get(_.conversation_id)||0)+1);return i.map(_=>{const j=_.participant_1===e.id?_.participant_2:_.participant_1;return{..._,other_user:u.get(j)||{id:j,name:"Unknown",image_url:null,gender:null},last_message:g.get(_.id)||"",unread_count:x.get(_.id)||0}})}});return h.useEffect(()=>{if(!e)return;const i=setInterval(()=>{document.hidden||t.invalidateQueries({queryKey:["conversations",e.id]})},2e4),o=()=>{document.hidden||t.invalidateQueries({queryKey:["conversations",e.id]})};return document.addEventListener("visibilitychange",o),()=>{clearInterval(i),document.removeEventListener("visibilitychange",o)}},[e,t]),{data:h.useMemo(()=>{var i;const a=new Set;return(((i=n.data)==null?void 0:i.pages.flat())||[]).filter(o=>!a.has(o.id)&&a.add(o.id))},[n.data]),isLoading:n.isLoading,hasNextPage:!!n.hasNextPage,isFetchingNextPage:n.isFetchingNextPage,fetchNextPage:n.fetchNextPage}}function XO(e){const{user:t}=it(),n=wt(),r=he({queryKey:["dm_messages",e],enabled:!!e&&!!t,refetchInterval:!1,queryFn:async()=>{if(!e)return[];const{data:a,error:i}=await S.from("dm_messages").select("*").eq("conversation_id",e).order("created_at",{ascending:!0});if(i)throw i;return a||[]}});return h.useEffect(()=>{if(!e||!t||!r.data)return;const a=r.data.filter(i=>(i.sender_id===null||i.sender_id!==t.id)&&!i.read_at);a.length>0&&S.from("dm_messages").update({read_at:new Date().toISOString()}).in("id",a.map(i=>i.id)).then(()=>{n.invalidateQueries({queryKey:["conversations",t.id]}),n.invalidateQueries({queryKey:["unread_dm_count"]})})},[e,t,r.data,n]),h.useEffect(()=>{if(!e)return;const i=setInterval(()=>{document.hidden||n.invalidateQueries({queryKey:["dm_messages",e]})},8e3),o=()=>{document.hidden||n.invalidateQueries({queryKey:["dm_messages",e]})};return document.addEventListener("visibilitychange",o),()=>{clearInterval(i),document.removeEventListener("visibilitychange",o)}},[e,n]),r}function ZO(){const{user:e}=it(),t=wt();return ps({mutationFn:async({recipientId:n,content:r,conversationId:a})=>{if(!e)throw new Error("Not authenticated");let i=a;if(!i){const{data:l}=await S.from("conversations").select("id").or(`and(participant_1.eq.${e.id},participant_2.eq.${n}),and(participant_1.eq.${n},participant_2.eq.${e.id})`).maybeSingle();if(l)i=l.id;else{const[c,d]=[e.id,n].sort(),{data:u,error:f}=await S.from("conversations").insert({participant_1:c,participant_2:d}).select("id").single();if(f)throw f;i=u.id}}const{error:o}=await S.from("dm_messages").insert({conversation_id:i,sender_id:e.id,content:r.trim()});if(o)throw o;return await S.from("conversations").update({last_message_at:new Date().toISOString()}).eq("id",i),i},onSuccess:n=>{t.invalidateQueries({queryKey:["conversations"]}),t.invalidateQueries({queryKey:["dm_messages",n]})}})}function Gj(){const{user:e}=it();return he({queryKey:["unread_dm_count",e==null?void 0:e.id],enabled:!!e,refetchInterval:6e4,staleTime:3e4,queryFn:async()=>
471{if(!e)return 0;const{data:t}=await S.from("conversations").select("id").or(`participant_1.eq.${e.id},participant_2.eq.${e.id}`);if(!t||t.length===0)return 0;const{count:n}=await S.from("dm_messages").select("id",{count:"exact",head:!0}).in("conversation_id",t.map(r=>r.id)).or(`sender_id.is.null,sender_id.neq.${e.id}`).is("read_at",null);return n||0}})}const eD=5*60*1e3,bu=50,Es=e=>e?Date.now()-new Date(e).getTime()<eD:!1,Kj=(e,t)=>{if(!t||t.toLowerCase()!=="female")return!1;const n=Math.floor(Date.now()/(1e3*60*60));let r=0;const a=e+String(n);for(let i=0;i<a.length;i++)r=(r<<5)-r+a.charCodeAt(i)|0;return Math.abs(r)%100<35},tD=(e,t,n)=>Es(n)||Kj(e,t),nD=e=>Date.now()-new Date(e).getTime()<48*60*60*1e3,vp=e=>{if(!e)return"Recently";const t=Date.now()-new Date(e).getTime(),n=Math.floor(t/6e4);if(n<5)return"Just now";if(n<60)return`${n}m ago`;const r=Math.floor(n/60);return r<24?`${r}h ago`:`${Math.floor(r/24)}d ago`},rD=()=>{const{user:e}=it(),[t,n]=h.useState([]),[r,a]=h.useState(!0),[i,o]=h.useState(!1),[l,c]=h.useState(!0),[d,u]=h.useState(new Map),[f,m]=h.useState(new Set),[p,v]=h.useState([]),[g,y]=h.useState(!1),[b,x]=h.useState(null),[w,_]=h.useState(null),[j,N]=h.useState({gender:"all",country:"",onlineOnly:!1,linkedOnly:!1}),[k,C]=h.useState(new Map),[A,I]=h.useState(new Map),[O,P]=h.useState([]),[T,E]=h.useState(new Set),[W,V]=h.useState(new Set),[q,D]=h.useState(new Set),$=h.useRef(0),z=h.useRef(!1),R=h.useCallback(async(ye,fe)=>{const ge=ye*bu,J=ge+bu-1,{data:ue}=await S.from("members").select("id, name, image_url, gender, country, last_active_at, bio, created_at").eq("is_discoverable",!0).filter("image_status","eq","approved").order("last_active_at",{ascending:!1}).range(ge,J);return ue??[]},[]),U=ye=>{if(!ye)return 4;const ge=(Date.now()-new Date(ye).getTime())/6e4;return ge<5?0:ge<60?1:ge<60*24?2:ge<60*24*7?3:4},ee=h.useCallback((ye,fe,ge,J)=>[...ye].sort((ue,Ee)=>{const Y=fe.has(ue.id)?0:1,Q=fe.has(Ee.id)?0:1;if(Y!==Q)return Y-Q;const le=J!=null&&J.has(ue.id)?0:1,de=J!=null&&J.has(Ee.id)?0:1;if(le!==de)return le-de;const me=U(ue.last_active_at),Le=U(Ee.last_active_at);if(me!==Le)return me-Le;const Ke=ge.has(ue.id)?0:1,Qe=ge.has(Ee.id)?0:1;if(Ke!==Qe)return Ke-Qe;const tt=ue.last_active_at?new Date(ue.last_active_at).getTime():0;return(Ee.last_active_at?new Date(Ee.last_active_at).getTime():0)-tt}),[]),ae=h.useCallback(async()=>{if(!e||i||!l)return;o(!0);const ye=$.current+1,fe=await R(ye,e.id);if(fe.length<bu&&c(!1),fe.length>0){$.current=ye,n(ue=>{const Ee=new Set(ue.map(le=>le.id)),Y=fe.filter(le=>!Ee.has(le.id)),Q=[...ue,...Y];return ee(Q,T,W,q)});const ge=fe.map(ue=>ue.id),{data:J}=await S.from("vip_settings").select("user_id, pinned_socials").in("user_id",ge);J!=null&&J.length&&I(ue=>{const Ee=new Map(ue);return J.forEach(Y=>{var Q;(Q=Y.pinned_socials)!=null&&Q.length&&Ee.set(Y.user_id,Y.pinned_socials)}),Ee})}o(!1)},[e,i,l,T,W,q,R,ee]);h.useEffect(()=>{if(!e)return;(async()=>{var Pe;const{data:fe}=await S.from("members").select("is_discoverable, image_url, gender").eq("id",e.id).single();y(!!(fe!=null&&fe.is_discoverable)&&!!(fe!=null&&fe.image_url)),x(((Pe=fe==null?void 0:fe.gender)==null?void 0:Pe.toLowerCase())||null);const ge=await R(0,e.id);$.current=0,c(ge.length>=bu);const{data:J}=await S.rpc("get_admin_user_ids"),ue=new Set((J||[]).map(Z=>Z));E(ue);const{data:Ee}=await S.rpc("get_moderator_user_ids"),Y=new Set((Ee||[]).map(Z=>Z));D(Y);const{data:Q}=await S.rpc("get_vip_user_ids"),le=new Set((Q||[]).map(Z=>Z));V(le);const de=new Set(ge.map(Z=>Z.id)),me=[...ue].filter(Z=>!de.has(Z)),Le=[...le].filter(Z=>!de.has(Z)&&!ue.has(Z)),Ke=[...Y].filter(Z=>!de.has(Z)&&!ue.has(Z)&&!le.has(Z));let Qe=[];const tt=[...me,...Le,...Ke];if(tt.length>0){const{data:Z}=await S.from("members").select("id, name, image_url, gender, country, last_active_at, bio, created_at").in("id",tt);Qe=(Z||[]).filter(G=>G.image_url)}z.current=!0;const{data:an}=await S.rpc("get_active_connected_profiles"),Wt=new Map,De=[],pe=new Set([...ge,...Qe].map(Z=>Z.id));(an||[]).forEach(Z=>{Wt.set(Z.profile_id,Z.connection_expires_at),pe.has(Z.profile_id)||De.push({id:Z.profile_id,name:Z.name,image_url:Z.image_url,gender:Z.gender,country:null,last_active_at:Z.last_active_at,bio:null,created_at:new Date(0).toISOString()})}),C(Wt);const Qt=[...ge,...Qe,...De],nt=ee(Qt,ue,le,Y);n(nt);const M=[...new Set(nt.map(Z=>
471Z.country).filter(Boolean))];P(M.sort());const{data:Ve}=await S.from("member_interests").select("interested_in_user_id, icebreaker_message").eq("user_id",e.id),Ue=new Map;(Ve||[]).forEach(Z=>Ue.set(Z.interested_in_user_id,Z.icebreaker_message)),u(Ue);const Ze=30,ft=new Date(Date.now()-Ze*864e5).toISOString(),{data:Rt}=await S.from("member_interests").select("user_id, icebreaker_message, created_at").eq("interested_in_user_id",e.id).gte("created_at",ft).order("created_at",{ascending:!1}),lt=(Rt||[]).map(Z=>Z.user_id),on=new Set(lt);if(m(on),lt.length>0){const{data:Z}=await S.from("members").select("id, name, image_url, gender, country").in("id",lt),G=new Map;(Z||[]).forEach(ze=>G.set(ze.id,ze));const et=(Rt||[]).map(ze=>{const ie=G.get(ze.user_id);return{user_id:ze.user_id,icebreaker_message:ze.icebreaker_message,created_at:ze.created_at,name:(ie==null?void 0:ie.name)||"Someone",image_url:(ie==null?void 0:ie.image_url)||null,gender:(ie==null?void 0:ie.gender)||null,country:(ie==null?void 0:ie.country)||null}});v(et)}else v([]);const F=nt.map(Z=>Z.id);if(F.length>0){const{data:Z}=await S.from("vip_settings").select("user_id, pinned_socials").in("user_id",F),G=new Map;(Z||[]).forEach(et=>{var ze;(ze=et.pinned_socials)!=null&&ze.length&&G.set(et.user_id,et.pinned_socials)}),I(G)}a(!1)})()},[e,R,ee]);const xe=h.useCallback(ye=>d.has(ye)&&f.has(ye),[d,f]),te=h.useCallback(async(ye,fe)=>{if(e){_(ye);try{const ge={user_id:e.id,interested_in_user_id:ye};fe&&(ge.icebreaker_message=fe);const{error:J}=await S.from("member_interests").insert(ge);if(J)if(J.code==="23505")Kt({title:"Already sent!",description:"You've already expressed interest."});else throw J;else u(ue=>new Map([...ue,[ye,fe||null]])),f.has(ye)?Kt({title:"It's a match! 🎉",description:"You both expressed interest! Check their profile for socials."}):Kt({title:"Interest sent! 💌",description:fe||"We'll let them know you want to connect."}),S.functions.invoke("notify-interest",{body:{interested_user_id:e.id,target_user_id:ye}})}catch(ge){Kt({title:"Oops",description:ge.message,variant:"destructive"})}finally{_(null)}}},[e,f]),ce=h.useCallback(async()=>{if(!e)return;const{error:ye}=await S.from("members").update({is_discoverable:!1,image_url:null,image_thumb_url:null}).eq("id",e.id);if(ye){Kt({title:"Error",description:ye.message,variant:"destructive"});return}await S.storage.from("member-photos").remove([`${e.id}/selfie.jpg`]),y(!1),Kt({title:"Listing removed 👋",description:"Your selfie has been deleted and you're no longer discoverable."})},[e]),Re=t.filter(ye=>{var fe;return!(j.gender!=="all"&&((fe=ye.gender)==null?void 0:fe.toLowerCase())!==j.gender||j.country&&ye.country!==j.country||j.onlineOnly&&!tD(ye.id,ye.gender,ye.last_active_at)||j.linkedOnly&&!k.has(ye.id))});return{user:e,members:Re,allMembers:t,loading:r,loadingMore:i,hasMore:l,loadMore:ae,myInterests:d,interestedInMe:f,incomingInterestsList:p,isDiscoverable:g,setIsDiscoverable:y,myGender:b,sendingInterest:w,filters:j,setFilters:N,countries:O,mutualSocials:A,linkedProfiles:k,adminUserIds:T,vipUserIds:W,modUserIds:q,isMutualMatch:xe,handleInterest:te,handleRemoveListing:ce}},wp="/assets/discover-icon-DeLx0rxp.png",sD="/assets/spin-legendary-CVk73fBs.png",aD="/assets/2nd-spin-4FPl1Ypw.png",iD="/assets/30min-cap-Ba6FuBTP.png",oD="/assets/ad-points-C3HTPJCk.png",lD="/assets/disable-promos-BQLxcbBb.png",cD="/assets/free-shipping-Z4mn2UHa.png",_p="/assets/gender-select-C-dgM-Y4.png",jp="/assets/star-eyes-g-5yY6fn.png",uD="/assets/create-promos-DiU-dh1g.png",Yj="/assets/frozen-face-KXnv1SCN.png",Np="/assets/custom-topics-BjtApC9F.png",dD="/assets/diamond-DT_kY8FN.png",kf="/assets/stopwatch-DzGMEJ5g.png",fr={basic:{name:"Basic VIP",price:"$2.49",interval:"week",price_id:"price_1T9ygOA5n8uAZoY1tzoTfeMH",product_id:"prod_U8FATJpBAXNSXy",features:[{label:"Choose a Gender to Connect With",icon:_p},{label:"5 Free Discover Call Minutes Every Renewal",icon:kf},{label:"Add Custom Topics",icon:Np},{label:"50 Ad Points a Week",icon:jp},{label:"Auto-Unfreeze Minutes",icon:Yj},{label:"Top of Discover Feed",icon:wp}]},premium:{name:"Premium VIP",price:"$9.99",interval:"month",price_id:"price_1T9yhEA5n8uAZoY1zwb5wVdp",product_id:"prod_U8FBD9R49k8Kvd",features:[{label:"Video Call & DM Females from Discover",icon:void 0},{label:"5 Free Discover Call Minutes Every Renewal",icon:kf}
471,{label:"Choose a Gender to Connect With",icon:_p},{label:"Top of Discover Feed",icon:wp},{label:"Get Gifted by Anyone",icon:zj},{label:"400 Ad Points Every Month",icon:jp},{label:"Disable All Promos + Add Images",icon:lD},{label:"Pin Socials On Screen",icon:qj},{label:"Spin Legendary Items (CASH VALUE)",icon:dD},{label:"Increase Chances to Win Legendary Items",icon:yp},{label:"Get More Minutes Per User",icon:iD},{label:"Free Shipping 1 Month",icon:cD},{label:"2nd Spin Attempt on Legendary Items",icon:aD},{label:"More Promo Perks",icon:oD},{label:"Add Custom Topics",icon:Np},{label:"2x Ad Points",icon:sD},{label:"5 Free Spins Per Month",icon:tx},{label:"One Time 2x on Minutes Per Month!",icon:kf},{label:"Create Promos",icon:uD},{label:"No Minute Loss for Quick Skips",icon:yp}]}},Uu=Object.freeze(Object.defineProperty({__proto__:null,VIP_TIERS:fr},Symbol.toStringTag,{value:"Module"})),Qj=({onClose:e,onSubscribe:t,loading:n})=>{const[r,a]=h.useState("premium"),i=fr[r];return In.createPortal(s.jsx("div",{className:"fixed inset-0 z-[80] bg-black/80 flex items-center justify-center p-4",onClick:o=>{o.target===o.currentTarget&&e()},children:s.jsxs("div",{className:"bg-neutral-900 border border-white/10 rounded-2xl max-w-sm w-full p-6 relative",children:[s.jsx("button",{onClick:e,className:"absolute top-3 right-3 text-white/40 hover:text-white",children:s.jsx(We,{className:"w-5 h-5"})}),s.jsxs("div",{className:"flex flex-col items-center text-center gap-4",children:[s.jsx("div",{className:"w-16 h-16 rounded-full bg-gradient-to-br from-purple-500 to-pink-500 flex items-center justify-center",children:s.jsx(mr,{className:"w-8 h-8 text-white"})}),s.jsx("h2",{className:"text-white font-bold text-xl",children:"VIP Required"}),s.jsxs("p",{className:"text-white/60 text-sm leading-relaxed",children:["Video calling female members is a ",s.jsx("strong",{className:"text-purple-400",children:"VIP"})," feature. Subscribe to any VIP plan to unlock video calls with anyone!"]}),s.jsx("div",{className:"w-full grid grid-cols-2 gap-2",children:["basic","premium"].map(o=>{const l=fr[o],c=r===o;return s.jsxs("button",{onClick:()=>a(o),className:`rounded-xl border-2 p-3 text-left transition-all ${c?"border-purple-400 bg-purple-500/15":"border-white/10 bg-white/5 hover:border-white/25"}`,children:[s.jsx("p",{className:"text-white font-bold text-lg leading-none",children:l.price}),s.jsxs("p",{className:"text-white/50 text-[11px] mt-1",children:["per ",l.interval]}),s.jsx("p",{className:"text-white/80 text-xs font-semibold mt-1",children:l.name})]},o)})}),s.jsxs("div",{className:"w-full bg-white/5 rounded-xl p-4 text-left space-y-2",children:[s.jsxs("p",{className:"text-white/80 text-xs font-semibold uppercase tracking-wider mb-2",children:[i.name," includes:"]}),i.features.slice(0,5).map((o,l)=>s.jsxs("div",{className:"flex items-center gap-2 text-white/70 text-sm",children:[o.icon?s.jsx("img",{src:o.icon,alt:"",className:"w-4 h-4"}):s.jsx("span",{className:"text-sm leading-none",children:"👩"}),s.jsx("span",{children:o.label})]},l)),s.jsx("p",{className:"text-white/40 text-xs mt-1",children:"...and much more"})]}),s.jsx("button",{onClick:()=>t(i.price_id),disabled:n,className:"w-full bg-gradient-to-r from-purple-500 to-pink-500 hover:from-purple-400 hover:to-pink-400 text-white font-bold py-3 px-6 rounded-xl transition-all disabled:opacity-50",children:n?"Loading...":`Subscribe — ${i.price}/${i.interval}`}),s.jsx("button",{onClick:e,className:"text-white/40 hover:text-white/60 text-sm transition-colors",children:"Maybe later"})]})]})}),document.body)};function kp(e,t,n){const r=(e==null?void 0:e.toLowerCase())==="male",a=(t==null?void 0:t.toLowerCase())==="female";return r&&a&&!(n==="premium"||n==="basic")}const hD=({partnerName:e,onClose:t,onSubscribe:n,loading:r})=>s.jsx("div",{className:"fixed inset-0 z-[80] bg-black/80 flex items-center justify-center p-4",onClick:a=>{a.target===a.currentTarget&&t()},children:s.jsxs("div",{className:"bg-neutral-900 border border-white/10 rounded-2xl max-w-sm w-full p-6 relative",children:[s.jsx("button",{onClick:t,className:"absolute top-3 right-3 text-white/40 hover:text-white",children:s.jsx(We,{className:"w-5 h-5"})}),s.jsxs("div",{className:"flex flex-col items-center text-center gap-4",children:[s.jsx("div",{className:"w-16 h-16 rounded-full bg-gradient-to-br from-blue-500 to-cyan-500 flex items-center justify-center",children:s.jsx(An,{className:"w-8 h-8 text-white"})}),s.jsx("h2",{className:"text-white font-bold text-xl",children:"Upgrade to Keep Chatting"}),s.jsxs("p",{className:"text-white/60 text-sm leading-relaxed",children:["You've used all 3 free messages across all female members. Subscribe to ",s.jsx("strong",{className:"text-blue-400",children:"Basic VIP"})," for unlimited messaging with all female members!"]}),s.jsxs("div",{className:"w-full bg-white/5 rounded-xl p-4 text-left space-y-2",children:[s.jsx("p",{className:"text-white/80 text-xs font-semibold uppercase tracking-wider mb-2",children:"Basic VIP includes:"}),fr.basic.features.map((a,i)=>s.jsxs("div",{className:"flex items-center gap-2 text-white/70 text-sm",children:[a.icon?s.jsx("img",{src:a.icon,alt:"",className:"w-4 h-4"}):s.jsx(cs,{className:"w-4 h-4 text-amber-400"}),s.jsx("span",{children:a.label})]},i)),s.jsxs("div",{className:"flex items-center gap-2 text-white/70 text-sm",children:[s.jsx(An,{className:"w-4 h-4 text-blue-400"}),s.jsx("span",{children:"Unlimited DMs to Female Members"})]})]}),s.jsx("button",{onClick:n,disabled:r,className:"w-full bg-gradient-to-r from-blue-500 to-cyan-500 hover:from-blue-400 hover:to-cyan-400 text-white font-bold py-3 px-6 rounded-xl transition-all disabled:opacity-50",children:r?"Loading...":`Subscribe — ${fr.basic.price}/week`}),s.jsx("button",{onClick:t,className:"text-white/40 hover:text-white/60 text-sm transition-colors",children:"Maybe later"})]})]})}
471),rx="/assets/discord-91NeU0Cm.png",dy={cashapp:{icon:dh,urlPrefix:"https://cash.app/"},tiktok:{icon:hh,urlPrefix:"https://tiktok.com/@"},instagram:{icon:fh,urlPrefix:"https://instagram.com/"},snapchat:{icon:mh,urlPrefix:"https://snapchat.com/add/"},discord:{icon:rx,urlPrefix:null},venmo:{icon:ph,urlPrefix:"https://venmo.com/"},paypal:{icon:xh,urlPrefix:"https://paypal.me/"}},Cd=({pinnedSocials:e})=>{if(!e||e.length===0)return null;const t=e.map(n=>{const[r,...a]=n.split(":"),i=a.join(":");return!i||!dy[r]?null:{platform:r,username:i,...dy[r]}}).filter(Boolean);return t.length===0?null:s.jsx("div",{className:"flex flex-col items-start gap-2",children:t.map(n=>{if(!n.urlPrefix)return s.jsxs("div",{className:"flex items-center gap-1.5 bg-black/40 backdrop-blur-sm rounded-full pl-0.5 pr-2.5 py-0.5 border border-white/20",title:n.username,children:[s.jsx("img",{src:n.icon,alt:n.platform,className:"w-7 h-7 rounded-full object-cover"}),s.jsx("span",{className:"text-white text-[11px] font-semibold truncate max-w-[100px]",children:n.username})]},n.platform);const r=n.username.replace(/^[@$/]/,""),a=n.urlPrefix+r;return s.jsx("a",{href:a,target:"_blank",rel:"noopener noreferrer",className:"w-9 h-9 rounded-full overflow-hidden border-2 border-white/40 hover:border-white hover:scale-110 transition-all shadow-lg",title:n.username,children:s.jsx("img",{src:n.icon,alt:n.platform,className:"w-full h-full object-cover"})},n.platform)})})};var Sf="focusScope.autoFocusOnMount",Cf="focusScope.autoFocusOnUnmount",hy={bubbles:!1,cancelable:!0},fD="FocusScope",Jj=h.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:a,onUnmountAutoFocus:i,...o}=e,[l,c]=h.useState(null),d=Fr(a),u=Fr(i),f=h.useRef(null),m=rn(t,g=>c(g)),p=h.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;h.useEffect(()=>{if(r){let g=function(w){if(p.paused||!l)return;const _=w.target;l.contains(_)?f.current=_:Ns(f.current,{select:!0})},y=function(w){if(p.paused||!l)return;const _=w.relatedTarget;_!==null&&(l.contains(_)||Ns(f.current,{select:!0}))},b=function(w){if(document.activeElement===document.body)for(const j of w)j.removedNodes.length>0&&Ns(l)};document.addEventListener("focusin",g),document.addEventListener("focusout",y);const x=new MutationObserver(b);return l&&x.observe(l,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",g),document.removeEventListener("focusout",y),x.disconnect()}}},[r,l,p.paused]),h.useEffect(()=>{if(l){my.add(p);const g=document.activeElement;if(!l.contains(g)){const b=new CustomEvent(Sf,hy);l.addEventListener(Sf,d),l.dispatchEvent(b),b.defaultPrevented||(mD(yD(Xj(l)),{select:!0}),document.activeElement===g&&Ns(l))}return()=>{l.removeEventListener(Sf,d),setTimeout(()=>{const b=new CustomEvent(Cf,hy);l.addEventListener(Cf,u),l.dispatchEvent(b),b.defaultPrevented||Ns(g??document.body,{select:!0}),l.removeEventListener(Cf,u),my.remove(p)},0)}}},[l,d,u,p]);const v=h.useCallback(g=>{if(!n&&!r||p.paused)return;const y=g.key==="Tab"&&!g.altKey&&!g.ctrlKey&&!g.metaKey,b=document.activeElement;if(y&&b){const x=g.currentTarget,[w,_]=pD(x);
vendor: 6,922 bytes, lines 471-486
471w&&_?!g.shiftKey&&b===_?(g.preventDefault(),n&&Ns(w,{select:!0})):g.shiftKey&&b===w&&(g.preventDefault(),n&&Ns(_,{select:!0})):b===x&&g.preventDefault()}},[n,r,p.paused]);return s.jsx(Ut.div,{tabIndex:-1,...o,ref:m,onKeyDown:v})});Jj.displayName=fD;function mD(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(Ns(r,{select:t}),document.activeElement!==n)return}function pD(e){const t=Xj(e),n=fy(t,e),r=fy(t.reverse(),e);return[n,r]}function Xj(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const a=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||a?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function fy(e,t){for(const n of e)if(!xD(n,{upTo:t}))return n}function xD(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 gD(e){return e instanceof HTMLInputElement&&"select"in e}function Ns(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&gD(e)&&t&&e.select()}}var my=bD();function bD(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=py(e,t),e.unshift(t)},remove(t){var n;e=py(e,t),(n=e[0])==null||n.resume()}}}function py(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function yD(e){return e.filter(t=>t.tagName!=="A")}var Ef=0;function vD(){h.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??xy()),document.body.insertAdjacentElement("beforeend",e[1]??xy()),Ef++,()=>{Ef===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),Ef--}},[])}function xy(){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 Bu="right-scroll-bar-position",zu="width-before-scroll-bar",wD="with-scroll-bars-hidden",_D="--removed-body-scroll-bar-size";function Pf(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function jD(e,t){var n=h.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(r){var a=n.value;a!==r&&(n.value=r,n.callback(r,a))}}}})[0];return n.callback=t,n.facade}var ND=typeof window<"u"?h.useLayoutEffect:h.useEffect,gy=new WeakMap;function kD(e,t){var n=jD(null,function(r){return e.forEach(function(a){return Pf(a,r)})});return ND(function(){var r=gy.get(n);if(r){var a=new Set(r),i=new Set(e),o=n.current;a.forEach(function(l){i.has(l)||Pf(l,null)}),i.forEach(function(l){a.has(l)||Pf(l,o)})}gy.set(n,e)},[e]),n}function SD(e){return e}function CD(e,t){t===void 0&&(t=SD);var n=[],r=!1,a={read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(i){var o=t(i,r);return n.push(o),function(){n=n.filter(function(l){return l!==o})}},assignSyncMedium:function(i){for(r=!0;n.length;){var o=n;n=[],o.forEach(i)}n={push:function(l){return i(l)},filter:function(){return n}}},assignMedium:function(i){r=!0;var o=[];if(n.length){var l=n;n=[],l.forEach(i),o=n}var c=function(){var u=o;o=[],u.forEach(i)},d=function(){return Promise.resolve().then(c)};d(),n={push:function(u){o.push(u),d()},filter:function(u){return o=o.filter(u),n}}}};return a}function ED(e){e===void 0&&(e={});var t=CD(null);return t.options=Ir({async:!0,ssr:!1},e),t}var Zj=function(e){var t=e.sideCar,n=Ro(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw new Error("Sidecar medium not found");return h.createElement(r,Ir({},n))};Zj.isSideCarExport=!0;function PD(e,t){return e.useMedium(t),Zj}var eN=ED(),Tf=function(){},bh=h.forwardRef(function(e,t){var n=h.useRef(null),r=h.useState({onScrollCapture:Tf,onWheelCapture:Tf,onTouchMoveCapture:Tf}),a=r[0],i=r[1],o=e.forwardProps,l=e.children,c=e.className,d=e.removeScrollBar,u=e.enabled,f=e.shards,m=e.sideCar,p=e.noRelative,v=e.noIsolation,g=e.inert,y=e.allowPinchZoom,b=e.as,x=b===void 0?"div":b,w=e.gapMode,_=Ro(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),j=m,N=kD([n,t]),k=Ir(Ir({},_),a);return h.createElement(h.Fragment,null,u&&h.createElement(j,{sideCar:eN,removeScrollBar:d,shards:f,noRelative:p,noIsolation:v,inert:g,setCallbacks:i,allowPinchZoom:!!y,lockRef:n,gapMode:w}),o?h.cloneElement(h.Children.only(l),Ir(Ir({},k),{ref:N})):h.createElement(x,Ir({},k,{className:c,ref:N}),l))});bh.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};bh.classNames={fullWidth:zu,zeroRight:Bu};var TD=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function RD(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=TD();return t&&e.setAttribute("nonce",t),e}function AD(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function ID(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var OD=function(){var e=0,t=null;return{add:function(n){e==0&&(t=RD())&&(AD(t,n),ID(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},DD=function(){var e=OD();return function(t,n){h.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},tN=function(){var e=DD(),t=function(n){var r=n.styles,a=n.dynamic;return e(r,a),null};return t},LD={left:0,top:0,right:0,gap:0},Rf=function(e){return parseInt(e||"",10)||0},MD=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],r=t[e==="padding"?"paddingTop":"marginTop"],a=t[e==="padding"?"paddingRight":"marginRight"];return[Rf(n),Rf(r),Rf(a)]},$D=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return LD;var t=MD(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},FD=tN(),Gi="data-scroll-locked",UD=function(e,t,n,r){var a=e.left,i=e.top,o=e.right,l=e.gap;return n===void 0&&(n="margin"),`
472  .`.concat(wD,` {
473   overflow: hidden `).concat(r,`;
474   padding-right: `).concat(l,"px ").concat(r,`;
475  }
476  body[`).concat(Gi,`] {
477    overflow: hidden `).concat(r,`;
478    overscroll-behavior: contain;
479    `).concat([t&&"position: relative ".concat(r,";"),n==="margin"&&`
480    padding-left: `.concat(a,`px;
481    padding-top: `).concat(i,`px;
482    padding-right: `).concat(o,`px;
483    margin-left:0;
484    margin-top:0;
485    margin-right: `).concat(l,"px ").concat(r,`;
486    `),n==="padding"&&"padding-right: ".concat(l,"px ").concat(r,";
486")].filter(Boolean).join(""),`
487  }
488  
489  .`).concat(Bu,` {
490    right: `).concat(l,"px ").concat(r,`;
491  }
492  
493  .`).concat(zu,` {
494    margin-right: `).concat(l,"px ").concat(r,`;
495  }
496  
497  .`).concat(Bu," .").concat(Bu,` {
498    right: 0 `).concat(r,`;
499  }
500  
501  .`).concat(zu," .").concat(zu,` {
502    margin-right: 0 `).concat(r,`;
503  }
504  
505  body[`).concat(Gi,`] {
506    `).concat(_D,": ").concat(l,`px;
507  }
508`)},by=function(){var e=parseInt(document.body.getAttribute(Gi)||"0",10);return isFinite(e)?e:0},BD=function(){h.useEffect(function(){return document.body.setAttribute(Gi,(by()+1).toString()),function(){var e=by()-1;e<=0?document.body.removeAttribute(Gi):document.body.setAttribute(Gi,e.toString())}},[])},zD=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,a=r===void 0?"margin":r;BD();var i=h.useMemo(function(){return $D(a)},[a]);return h.createElement(FD,{styles:UD(i,!t,a,n?"":"!important")})},Sp=!1;if(typeof window<"u")try{var yu=Object.defineProperty({},"passive",{get:function(){return Sp=!0,!0}});window.addEventListener("test",yu,yu),window.removeEventListener("test",yu,yu)}catch{Sp=!1}var bi=Sp?{passive:!1}:!1,qD=function(e){return e.tagName==="TEXTAREA"},nN=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!qD(e)&&n[t]==="visible")},VD=function(e){return nN(e,"overflowY")},WD=function(e){return nN(e,"overflowX")},yy=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var a=rN(e,r);if(a){var i=sN(e,r),o=i[1],l=i[2];if(o>l)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},HD=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},GD=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},rN=function(e,t){return e==="v"?VD(t):WD(t)},sN=function(e,t){return e==="v"?HD(t):GD(t)},KD=function(e,t){return e==="h"&&t==="rtl"?-1:1},YD=function(e,t,n,r,a){var i=KD(e,window.getComputedStyle(t).direction),o=i*r,l=n.target,c=t.contains(l),d=!1,u=o>0,f=0,m=0;do{if(!l)break;var p=sN(e,l),v=p[0],g=p[1],y=p[2],b=g-y-i*v;(v||b)&&rN(e,l)&&(f+=b,m+=v);var x=l.parentNode;l=x&&x.nodeType===Node.DOCUMENT_FRAGMENT_NODE?x.host:x}while(!c&&l!==document.body||c&&(t.contains(l)||t===l));return(u&&(Math.abs(f)<1||!a)||!u&&(Math.abs(m)<1||!a))&&(d=!0),d},vu=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},vy=function(e){return[e.deltaX,e.deltaY]},wy=function(e){return e&&"current"in e?e.current:e},QD=function(e,t){return e[0]===t[0]&&e[1]===t[1]},JD=function(e){return`
509  .block-interactivity-`.concat(e,` {pointer-events: none;}
510  .allow-interactivity-`).concat(e,` {pointer-events: all;}
511`)},XD=0,yi=[];function ZD(e){var t=h.useRef([]),n=h.useRef([0,0]),r=h.useRef(),a=h.useState(XD++)[0],i=h.useState(tN)[0],o=h.useRef(e);h.useEffect(function(){o.current=e},[e]),h.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(a));var g=a3([e.lockRef.current],(e.shards||[]).map(wy),!0).filter(Boolean);return g.forEach(function(y){return y.classList.add("allow-interactivity-".concat(a))}),function(){document.body.classList.remove("block-interactivity-".concat(a)),g.forEach(function(y){return y.classList.remove("allow-interactivity-".concat(a))})}}},[e.inert,e.lockRef.current,e.shards]);var l=h.useCallback(function(g,y){if("touches"in g&&g.touches.length===2||g.type==="wheel"&&g.ctrlKey)return!o.current.allowPinchZoom;var b=vu(g),x=n.current,w="deltaX"in g?g.deltaX:x[0]-b[0],_="deltaY"in g?g.deltaY:x[1]-b[1],j,N=g.target,k=Math.abs(w)>Math.abs(_)?"h":"v";if("touches"in g&&k==="h"&&N.type==="range")return!1;var C=yy(k,N);if(!C)return!0;if(C?j=k:(j=k==="v"?"h":"v",C=yy(k,N)),!C)return!1;if(!r.current&&"changedTouches"in g&&(w||_)&&(r.current=j),!j)return!0;var A=r.current||j;return YD(A,y,g,A==="h"?w:_,!0)},[]),c=h.useCallback(function(g){var y=g;if(!(!yi.length||yi[yi.length-1]!==i)){var b="deltaY"in y?vy(y):vu(y),x=t.current.filter(function(j){return j.name===y.type&&(j.target===y.target||y.target===j.shadowParent)&&QD(j.delta,b)})[0];if(x&&x.should){y.cancelable&&y.preventDefault();return}
vendor: 1,467 bytes, line 511
511if(!x){var w=(o.current.shards||[]).map(wy).filter(Boolean).filter(function(j){return j.contains(y.target)}),_=w.length>0?l(y,w[0]):!o.current.noIsolation;_&&y.cancelable&&y.preventDefault()}}},[]),d=h.useCallback(function(g,y,b,x){var w={name:g,delta:y,target:b,should:x,shadowParent:eL(b)};t.current.push(w),setTimeout(function(){t.current=t.current.filter(function(_){return _!==w})},1)},[]),u=h.useCallback(function(g){n.current=vu(g),r.current=void 0},[]),f=h.useCallback(function(g){d(g.type,vy(g),g.target,l(g,e.lockRef.current))},[]),m=h.useCallback(function(g){d(g.type,vu(g),g.target,l(g,e.lockRef.current))},[]);h.useEffect(function(){return yi.push(i),e.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:m}),document.addEventListener("wheel",c,bi),document.addEventListener("touchmove",c,bi),document.addEventListener("touchstart",u,bi),function(){yi=yi.filter(function(g){return g!==i}),document.removeEventListener("wheel",c,bi),document.removeEventListener("touchmove",c,bi),document.removeEventListener("touchstart",u,bi)}},[]);var p=e.removeScrollBar,v=e.inert;return h.createElement(h.Fragment,null,v?h.createElement(i,{styles:JD(a)}):null,p?h.createElement(zD,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function eL(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const tL=PD(eN,ZD);var aN=h.forwardRef(function(e,t){return h.createElement(bh,Ir({},e,{ref:t,sideCar:tL}))});
vendor: 4,596 bytes, line 511
511aN.classNames=bh.classNames;var nL=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},vi=new WeakMap,wu=new WeakMap,_u={},Af=0,iN=function(e){return e&&(e.host||iN(e.parentNode))},rL=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=iN(n);return r&&e.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},sL=function(e,t,n,r){var a=rL(t,Array.isArray(e)?e:[e]);_u[n]||(_u[n]=new WeakMap);var i=_u[n],o=[],l=new Set,c=new Set(a),d=function(f){!f||l.has(f)||(l.add(f),d(f.parentNode))};a.forEach(d);var u=function(f){!f||c.has(f)||Array.prototype.forEach.call(f.children,function(m){if(l.has(m))u(m);else try{var p=m.getAttribute(r),v=p!==null&&p!=="false",g=(vi.get(m)||0)+1,y=(i.get(m)||0)+1;vi.set(m,g),i.set(m,y),o.push(m),g===1&&v&&wu.set(m,!0),y===1&&m.setAttribute(n,"true"),v||m.setAttribute(r,"true")}catch(b){console.error("aria-hidden: cannot operate on ",m,b)}})};return u(t),l.clear(),Af++,function(){o.forEach(function(f){var m=vi.get(f)-1,p=i.get(f)-1;vi.set(f,m),i.set(f,p),m||(wu.has(f)||f.removeAttribute(r),wu.delete(f)),p||f.removeAttribute(n)}),Af--,Af||(vi=new WeakMap,vi=new WeakMap,wu=new WeakMap,_u={})}},aL=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),a=nL(e);return a?(r.push.apply(r,Array.from(a.querySelectorAll("[aria-live]"))),sL(r,a,n,"aria-hidden")):function(){return null}},yh="Dialog",[oN,lN]=ko(yh),[iL,_r]=oN(yh),cN=e=>{const{__scopeDialog:t,children:n,open:r,defaultOpen:a,onOpenChange:i,modal:o=!0}=e,l=h.useRef(null),c=h.useRef(null),[d,u]=Y1({prop:r,defaultProp:a??!1,onChange:i,caller:yh});return s.jsx(iL,{scope:t,triggerRef:l,contentRef:c,contentId:cf(),titleId:cf(),descriptionId:cf(),open:d,onOpenChange:u,onOpenToggle:h.useCallback(()=>u(f=>!f),[u]),modal:o,children:n})};cN.displayName=yh;var uN="DialogTrigger",dN=h.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,a=_r(uN,n),i=rn(t,a.triggerRef);return s.jsx(Ut.button,{type:"button","aria-haspopup":"dialog","aria-expanded":a.open,"aria-controls":a.contentId,"data-state":ix(a.open),...r,ref:i,onClick:bt(e.onClick,a.onOpenToggle)})});dN.displayName=uN;var sx="DialogPortal",[oL,hN]=oN(sx,{forceMount:void 0}),fN=e=>{const{__scopeDialog:t,forceMount:n,children:r,container:a}=e,i=_r(sx,t);return s.jsx(oL,{scope:t,forceMount:n,children:h.Children.map(r,o=>s.jsx(So,{present:n||i.open,children:s.jsx(O0,{asChild:!0,container:a,children:o})}))})};fN.displayName=sx;var Ed="DialogOverlay",mN=h.forwardRef((e,t)=>{const n=hN(Ed,e.__scopeDialog),{forceMount:r=n.forceMount,...a}=e,i=_r(Ed,e.__scopeDialog);return i.modal?s.jsx(So,{present:r||i.open,children:s.jsx(cL,{...a,ref:t})}):null});mN.displayName=Ed;var lL=Kl("DialogOverlay.RemoveScroll"),cL=h.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,a=_r(Ed,n);return s.jsx(aN,{as:lL,allowPinchZoom:!0,shards:[a.contentRef],children:s.jsx(Ut.div,{"data-state":ix(a.open),...r,ref:t,style:{pointerEvents:"auto",...r.style}})})}),Xa="DialogContent",pN=h.forwardRef((e,t)=>{const n=hN(Xa,e.__scopeDialog),{forceMount:r=n.forceMount,...a}=e,i=_r(Xa,e.__scopeDialog);return s.jsx(So,{present:r||i.open,children:i.modal?s.jsx(uL,{...a,ref:t}):s.jsx(dL,{...a,ref:t})})});pN.displayName=Xa;var uL=h.forwardRef((e,t)=>{const n=_r(Xa,e.__scopeDialog),r=h.useRef(null),a=rn(t,n.contentRef,r);return h.useEffect(()=>{const i=r.current;if(i)return aL(i)},[]),s.jsx(xN,{...e,ref:a,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:bt(e.onCloseAutoFocus,i=>{var o;i.preventDefault(),(o=n.triggerRef.current)==null||o.focus()}),onPointerDownOutside:bt(e.onPointerDownOutside,i=>{const o=i.detail.originalEvent,l=o.button===0&&o.ctrlKey===!0;(o.button===2||l)&&i.preventDefault()}),onFocusOutside:bt(e.onFocusOutside,i=>i.preventDefault())})}),dL=h.forwardRef((e,t)=>{const n=_r(Xa,e.__scopeDialog),r=h.useRef(!1),a=h.useRef(!1);return s.jsx(xN,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{var o,l;(o=e.onCloseAutoFocus)==null||o.call(e,i),i.defaultPrevented||(r.current||(l=n.triggerRef.current)==null||l.focus(),i.preventDefault()),r.current=!1,a.current=!1},onInteractOutside:i=>{var c,d;(c=e.onInteractOutside)==null||c.call(e,i),i.defaultPrevented||(r.current=!0,i.detail.originalEvent.type==="pointerdown"&&(a.current=!0));const o=i.target;((d=n.triggerRef.current)==null?void 0:d.contains(o))&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&a.current&&i.preventDefault()}})}),xN=h.forwardRef((e,t)=>
511{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:a,onCloseAutoFocus:i,...o}=e,l=_r(Xa,n),c=h.useRef(null),d=rn(t,c);return vD(),s.jsxs(s.Fragment,{children:[s.jsx(Jj,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:a,onUnmountAutoFocus:i,children:s.jsx(Kd,{role:"dialog",id:l.contentId,"aria-describedby":l.descriptionId,"aria-labelledby":l.titleId,"data-state":ix(l.open),...o,ref:d,onDismiss:()=>l.onOpenChange(!1)})}),s.jsxs(s.Fragment,{children:[s.jsx(fL,{titleId:l.titleId}),s.jsx(pL,{contentRef:c,descriptionId:l.descriptionId})]})]})}),ax="DialogTitle",gN=h.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,a=_r(ax,n);return s.jsx(Ut.h2,{id:a.titleId,...r,ref:t})});gN.displayName=ax;var bN="DialogDescription",yN=h.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,a=_r(bN,n);return s.jsx(Ut.p,{id:a.descriptionId,...r,ref:t})});yN.displayName=bN;var vN="DialogClose",wN=h.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,a=_r(vN,n);return s.jsx(Ut.button,{type:"button",...r,ref:t,onClick:bt(e.onClick,()=>a.onOpenChange(!1))})});wN.displayName=vN;function ix(e){return e?"open":"closed"}var _N="DialogTitleWarning",[hL,jN]=c5(_N,{contentName:Xa,titleName:ax,docsSlug:"dialog"}),fL=({titleId:e})=>{const t=jN(_N),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
512
513If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
514
515For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return h.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},mL="DialogDescriptionWarning",pL=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${jN(mL).contentName}}.`;return h.useEffect(()=>{var i;const a=(i=e.current)==null?void 0:i.getAttribute("aria-describedby");t&&a&&(document.getElementById(t)||console.warn(r))},[r,e,t]),null},xL=cN,gL=dN,bL=fN,yL=mN,vL=pN,wL=gN,_L=yN,NN=wN,kN="AlertDialog",[jL,xF]=ko(kN,[lN]),gs=lN(),SN=e=>{const{__scopeAlertDialog:t,...n}=e,r=gs(t);return s.jsx(xL,{...r,...n,modal:!0})};SN.displayName=kN;var NL="AlertDialogTrigger",kL=h.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,a=gs(n);return s.jsx(gL,{...a,...r,ref:t})});kL.displayName=NL;var SL="AlertDialogPortal",CN=e=>{const{__scopeAlertDialog:t,...n}=e,r=gs(t);return s.jsx(bL,{...r,...n})};CN.displayName=SL;var CL="AlertDialogOverlay",EN=h.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,a=gs(n);return s.jsx(yL,{...a,...r,ref:t})});EN.displayName=CL;var Ki="AlertDialogContent",[EL,PL]=jL(Ki),TL=V1("AlertDialogContent"),PN=h.forwardRef((e,t)=>{const{__scopeAlertDialog:n,children:r,...a}=e,i=gs(n),o=h.useRef(null),l=rn(t,o),c=h.useRef(null);return s.jsx(hL,{contentName:Ki,titleName:TN,docsSlug:"alert-dialog",children:s.jsx(EL,{scope:n,cancelRef:c,children:s.jsxs(vL,{role:"alertdialog",...i,...a,ref:l,onOpenAutoFocus:bt(a.onOpenAutoFocus,d=>{var u;d.preventDefault(),(u=c.current)==null||u.focus({preventScroll:!0})}),onPointerDownOutside:d=>d.preventDefault(),onInteractOutside:d=>d.preventDefault(),children:[s.jsx(TL,{children:r}),s.jsx(AL,{contentRef:o})]})})})});PN.displayName=Ki;var TN="AlertDialogTitle",RN=h.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,a=gs(n);return s.jsx(wL,{...a,...r,ref:t})});RN.displayName=TN;var AN="AlertDialogDescription",IN=h.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,a=gs(n);return s.jsx(_L,{...a,...r,ref:t})});IN.displayName=AN;var RL="AlertDialogAction",ON=h.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,a=gs(n);return s.jsx(NN,{...a,...r,ref:t})});ON.displayName=RL;var DN="AlertDialogCancel",LN=h.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,{cancelRef:a}=PL(DN,n),i=gs(n),o=rn(t,a);return s.jsx(NN,{...i,...r,ref:o})});LN.displayName=DN;var AL=({contentRef:e})=>{const t=`\`${Ki}\` requires a description for the component to be accessible for screen reader users.
516
517You can add a description to the \`${Ki}\` by passing a \`${AN}\` component as a child, which also benefits sighted users by adding visible context to the dialog.
518
519Alternatively, you can use your own component as a description by assigning it an \`id\` and passing the same value to the \`aria-describedby\` prop in \`${Ki}\`. If the description is confusing or duplicative for sighted users, you can use the \`@radix-ui/react-visually-hidden\` primitive as a wrapper around your description component.
520
521For more information, see https://radix-ui.com/primitives/docs/components/
521alert-dialog`;return h.useEffect(()=>{var r;document.getElementById((r=e.current)==null?void 0:r.getAttribute("aria-describedby"))||console.warn(t)},[t,e]),null},IL=SN,OL=CN,MN=EN,$N=PN,FN=ON,UN=LN,BN=RN,zN=IN;const ox=g_("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"}}),ic=h.forwardRef(({className:e,variant:t,size:n,asChild:r=!1,...a},i)=>{const o=r?d5:"button";return s.jsx(o,{className:Ct(ox({variant:t,size:n,className:e})),ref:i,...a})});ic.displayName="Button";const DL=IL,LL=OL,qN=h.forwardRef(({className:e,...t},n)=>s.jsx(MN,{className:Ct("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,ref:n}));qN.displayName=MN.displayName;const VN=h.forwardRef(({className:e,...t},n)=>s.jsxs(LL,{children:[s.jsx(qN,{}),s.jsx($N,{ref:n,className:Ct("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),...t})]}));VN.displayName=$N.displayName;const WN=({className:e,...t})=>s.jsx("div",{className:Ct("flex flex-col space-y-2 text-center sm:text-left",e),...t});WN.displayName="AlertDialogHeader";const HN=({className:e,...t})=>s.jsx("div",{className:Ct("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});HN.displayName="AlertDialogFooter";const GN=h.forwardRef(({className:e,...t},n)=>s.jsx(BN,{ref:n,className:Ct("text-lg font-semibold",e),...t}));GN.displayName=BN.displayName;const KN=h.forwardRef(({className:e,...t},n)=>s.jsx(zN,{ref:n,className:Ct("text-sm text-muted-foreground",e),...t}));KN.displayName=zN.displayName;const YN=h.forwardRef(({className:e,...t},n)=>s.jsx(FN,{ref:n,className:Ct(ox(),e),...t}));YN.displayName=FN.displayName;const QN=h.forwardRef(({className:e,...t},n)=>s.jsx(UN,{ref:n,className:Ct(ox({variant:"outline"}),"mt-2 sm:mt-0",e),...t}));QN.displayName=UN.displayName;const If=/(https?:\/\/[^\s]+)/g,ML=e=>typeof e!="string"?e:e.split(If).map((n,r)=>If.test(n)?(If.lastIndex=0,s.jsx("a",{href:n,target:"_blank",rel:"noopener noreferrer",className:"underline text-blue-300 hover:text-blue-200 break-all",children:n},r)):n),Of=({role:e})=>e==="owner"?s.jsxs("span",{className:"inline-flex items-center gap-0.5 bg-gradient-to-r from-amber-500 to-yellow-500 text-black text-[9px] font-bold px-1.5 py-0.5 rounded-full leading-none",children:[s.jsx(cs,{className:"w-2.5 h-2.5"})," Owner"]}):e==="vip"?s.jsxs("span",{className:"inline-flex items-center gap-0.5 bg-gradient-to-r from-purple-500 to-pink-500 text-white text-[9px] font-bold px-1.5 py-0.5 rounded-full leading-none",children:[s.jsx(yr,{className:"w-2.5 h-2.5"})," VIP"]}):s.jsxs("span",{className:"inline-flex items-center gap-0.5 bg-gradient-to-r from-blue-500 to-cyan-500 text-white text-[9px] font-bold px-1.5 py-0.5 rounded-full leading-none",children:[s.jsx(N_,{className:"w-2.5 h-2.5"})," Mod"]}),lx=({onClose:e,initialPartnerId:t})=>{var kc,Sc,Io,Cc,Ec,da,Pc,Oo,ha,Nh,Nr,Tc,ai,Rc,ii,fa,Do,Ac,bs,Lo,Mo,oi,Ic,ys,Oc,$o,kr,Fo,kh,Uo,Dc,Bo,Lc,li,ma,zo,qo,ci;const{user:n,loading:r,isAdmin:a,isModerator:i}=it(),o=sn(),l=wt();h.useEffect(()=>{!r&&!n&&o("/?returnTo=/messages",{replace:!0})},[r,n,o]);const[c]=I0(),d=Mj(),[u,f]=h.useState(null),[m,p]=h.useState(""),v=20,[g,y]=h.useState(v),b=n?`dm-pinned-convos:${n.id}`:null,[x,w]=h.useState(new Set);h.useEffect(()=>{if(b)try{const K=localStorage.getItem(b);K&&w(new Set(JSON.parse(K)))}catch{}},[b]);const _=K=>{!K||!b||w(Ne=>{const Ie=new Set(Ne);Ie.has(K)?Ie.delete(K):Ie.add(K);try{localStorage.setItem(b,JSON.stringify([...Ie]))}catch{}return Ie})},[j,N]=h.useState(""),k=h.useRef(null),C=t||c.get("to"),[A,I]=h.useState(null),[O,P]=h.useState([]),[T,E]=h.useState(null),[W,V]=h.useState(!1),[q,D]=h.useState(!1),[$,z]=h.useState(!1),[R,U]=h.useState(!1),[ee,ae]=h.useState(!1),[xe,te]=h.useState(!1),[ce,Re]=h.useState(!1),[ye,fe]=h.useState(!1),{vipTier:ge,startCheckout:J}=_c((n==null?void 0:n.id)??null),{data:ue,refetch:Ee}=he({queryKey:["cashout-minutes-messages",n==null?void 0:n.id],enabled:!!n,queryFn:async()=>{const{data:K}=await S.from("member_minutes").select("total_minutes, gifted_minutes").eq("user_id",n.id).single();return K||{total_minutes:0,gifted_minutes:0}}}),Y=((kc=u==null?void 0:u.other_user)==null?void 0:kc.id)??null,{data:Q={iBlockedThem:!1,theyBlockedMe:!1}}=he({queryKey:["dm-block-state",n==null?void 0:n.id,Y],enabled:!!n&&!!Y,queryFn:async()=>
521{if(!n||!Y)return{iBlockedThem:!1,theyBlockedMe:!1};const[{data:K},{data:Ne}]=await Promise.all([S.from("blocked_users").select("id").eq("blocker_id",n.id).eq("blocked_id",Y).maybeSingle(),S.rpc("is_blocked_by",{partner_id:Y})]);return{iBlockedThem:!!K,theyBlockedMe:!!Ne}}}),{data:le}=he({queryKey:["my-gender-messages",n==null?void 0:n.id],enabled:!!n,queryFn:async()=>{var Ne;const{data:K}=await S.from("members").select("gender").eq("id",n.id).maybeSingle();return((Ne=K==null?void 0:K.gender)==null?void 0:Ne.toLowerCase())||null}}),{data:de=[],isLoading:me,hasNextPage:Le,isFetchingNextPage:Ke,fetchNextPage:Qe}=JO(),{data:tt=[],isLoading:an}=XO((u==null?void 0:u.id)||null),Wt=ZO(),De=h.useMemo(()=>de.map(K=>{var Ne;return(Ne=K.other_user)==null?void 0:Ne.id}).filter(Boolean),[de]),{data:pe={}}=he({queryKey:["dm-user-badges",De],enabled:De.length>0,queryFn:async()=>{const K={},{data:Ne}=await S.from("user_roles").select("user_id, role").in("user_id",De),Ie=new Map;(Ne||[]).forEach(Me=>{Ie.has(Me.user_id)||Ie.set(Me.user_id,new Set),Ie.get(Me.user_id).add(Me.role)});const{data:st}=await S.rpc("get_vip_user_ids"),Ge=new Set((st||[]).map(Me=>Me));for(const Me of De){const Fe=Ie.get(Me);Me==="6f8bb0e2-a36a-4bc0-920f-312c340f7921"||Fe!=null&&Fe.has("admin")?K[Me]="owner":Ge.has(Me)?K[Me]="vip":Fe!=null&&Fe.has("moderator")?K[Me]="mod":K[Me]=null}return K}}),Qt=((Sc=u==null?void 0:u.other_user)==null?void 0:Sc.id)||null,{data:nt=0}=he({queryKey:["gifted_from_user",n==null?void 0:n.id,Qt],enabled:!!n&&!!Qt,queryFn:async()=>{if(!n||!Qt)return 0;const{data:K}=await S.from("gift_transactions").select("minutes_amount").eq("sender_id",Qt).eq("recipient_id",n.id).eq("status","completed");return!K||K.length===0?0:K.reduce((Ne,Ie)=>Ne+(Ie.minutes_amount||0),0)}});h.useEffect(()=>{if(!(A!=null&&A.id)){P([]);return}S.from("vip_settings").select("pinned_socials").eq("user_id",A.id).maybeSingle().then(({data:K})=>{P((K==null?void 0:K.pinned_socials)||[])})},[A==null?void 0:A.id]),h.useEffect(()=>{var K;(K=k.current)==null||K.scrollIntoView({behavior:"smooth"})},[tt]),h.useEffect(()=>{if(!C||!n||me)return;const K=de.find(Ie=>{var st;return((st=Ie.other_user)==null?void 0:st.id)===C});if(K){f(K);return}(async()=>{const{data:Ie}=await S.from("members").select("id, name, image_url, gender, last_active_at").eq("id",C).single();Ie&&f({id:"",participant_1:n.id,participant_2:C,last_message_at:new Date().toISOString(),created_at:new Date().toISOString(),other_user:Ie,last_message:"",unread_count:0})})()},[C,n,de,me]);const M=async()=>{var Ie;if(!n||!((Ie=u==null?void 0:u.other_user)!=null&&Ie.id)||W)return;const K=u.other_user.id,Ne=u.other_user.gender??null;if(kp(le??null,Ne,ge)){ae(!0);return}V(!0);try{const{data:st,error:Ge}=await S.from("direct_call_invites").insert({inviter_id:n.id,invitee_id:K}).select("id").single();if(Ge)throw Ge;E({inviteId:st.id,partnerId:K,partnerName:u.other_user.name||"User",isInitiator:!0})}catch(st){B.error("Failed to start call",{description:st.message})}finally{V(!1)}},Ve=3,Ue=((Cc=(Io=u==null?void 0:u.other_user)==null?void 0:Io.gender)==null?void 0:Cc.toLowerCase())??null,Ze=le==="male"&&Ue==="female",ft=ge==="basic"||ge==="premium",{data:Rt=0}=he({queryKey:["global-male-dm-count",n==null?void 0:n.id,le],enabled:!!n&&le==="male"&&!ft,staleTime:1e4,queryFn:async()=>{if(!n)return 0;const{data:K}=await S.from("conversations").select("id, participant_1, participant_2").or(`participant_1.eq.${n.id},participant_2.eq.${n.id}`);if(!K||K.length===0)return 0;const Ne=K.map(Fe=>Fe.participant_1===n.id?Fe.participant_2:Fe.participant_1),{data:Ie}=await S.from("members").select("id").in("id",Ne).ilike("gender","female");if(!Ie||Ie.length===0)return 0;const st=new Set(Ie.map(Fe=>Fe.id)),Ge=K.filter(Fe=>{const Wn=Fe.participant_1===n.id?Fe.participant_2:Fe.participant_1;return st.has(Wn)}).map(Fe=>Fe.id);if(Ge.length===0)return 0;const{count:Me}=await S.from("dm_messages").select("id",{count:"exact",head:!0}).in("conversation_id",Ge).eq("sender_id",n.id);return Me||0}}),lt=Ze&&!ft&&Rt>=Ve,on=Math.max(0,Ve-Rt),F=Q.iBlockedThem,Pe=Q.theyBlockedMe,Z=F||Pe,G=le==="female"&&((da=(Ec=u==null?void 0:u.other_user)==null?void 0:Ec.gender)==null?void 0:da.toLowerCase())==="male",et=G?((Pc=u==null?void 0:u.other_user)==null?void 0:Pc.id)??null:null,{data:ze}=he({queryKey:["partner-free-msg-status",et],enabled:!!et,staleTime:15e3,queryFn:async()=>{const{data:K,error:Ne}=await S.rpc("get_user_free_msg_status",{target_user_id:et});return Ne?null:K}}),{data:ie}=he({queryKey:["bounty-from-partner",n==null?void 0:n.id,(Oo=u==null?void 0:u.other_user)==null?void 0:Oo.id],enabled:!!n&&!!((ha=u==null?void 0:u.other_user)!=null&&ha.id)&&G,queryFn:async()=>{const{data:K}=await S.from("bounty_earnings").select("amount_minutes, source, created_at").eq("female_id",n.id).eq("male_id",u.other_user.id).eq("clawed_back",!1).order("created_at",{ascending:!1}),Ne=K||[],Ie=Ne.reduce((Ge,Me)=>Ge+(Me.amount_minutes||0),0),st=new Set(Ne.map(Ge=>Ge.source));return{total:Ie,count:Ne.length,tiers:st,latest:Ne[0]}}}),be=async()=>{var K;if(!(!n||!((K=u==null?void 0:u.other_user)!=null&&K.id)||ye))try{fe(!0);const{error:Ne}=await S.from("blocked_users").insert({blocker_id:n.id,blocked_id:u.other_user.id});if(Ne)throw Ne;
521Re(!1),N(""),await l.invalidateQueries({queryKey:["dm-block-state"]}),B.success(`${u.other_user.name} has been blocked`)}catch(Ne){B.error("Couldn't block user",{description:Ne.message})}finally{fe(!1)}},Ce=async()=>{var K;if(!(!n||!((K=u==null?void 0:u.other_user)!=null&&K.id)))try{const{error:Ne}=await S.from("blocked_users").delete().eq("blocker_id",n.id).eq("blocked_id",u.other_user.id);if(Ne)throw Ne;await l.invalidateQueries({queryKey:["dm-block-state"]}),B.success(`${u.other_user.name} has been unblocked`)}catch(Ne){B.error("Couldn't unblock user",{description:Ne.message})}},$e=()=>{var Ne;if(!j.trim()||!u||Z)return;const K=(Ne=u.other_user)==null?void 0:Ne.id;if(K){if(lt){te(!0);return}Wt.mutate({recipientId:K,content:j.trim(),conversationId:u.id||void 0},{onSuccess:Ie=>{N(""),l.invalidateQueries({queryKey:["global-male-dm-count"]}),!u.id&&Ie&&f(st=>st&&{...st,id:Ie})},onError:Ie=>{if(String((Ie==null?void 0:Ie.message)||"").toLowerCase().includes("blocked")){l.invalidateQueries({queryKey:["dm-block-state"]}),B.error("Message not sent",{description:"This chat is blocked."});return}B.error("Message not sent",{description:(Ie==null?void 0:Ie.message)||"Please try again."})}})}},ct=()=>{u?f(null):e?e():o(-1)},_t=K=>{const Ne=new Date(K),st=new Date().getTime()-Ne.getTime(),Ge=Math.floor(st/6e4);if(Ge<1)return"now";if(Ge<60)return`${Ge}m`;const Me=Math.floor(Ge/60);if(Me<24)return`${Me}h`;const Fe=Math.floor(Me/24);return Fe<7?`${Fe}d`:Ne.toLocaleDateString()},rt="6f8bb0e2-a36a-4bc0-920f-312c340f7921",mt=le==="female"||a||i,{data:ut}=he({queryKey:["group-chat-preview",le,a,i],enabled:mt,staleTime:6e4,queryFn:async()=>{const{data:K}=await S.from("group_chat_messages").select("body, created_at").order("created_at",{ascending:!1}).limit(1).maybeSingle();return K}}),{data:pt}=he({queryKey:["female-earnings-snapshot",n==null?void 0:n.id],enabled:!!n&&le==="female",staleTime:3e4,refetchInterval:6e4,refetchOnWindowFocus:!0,queryFn:async()=>{const K=new Date;K.setUTCHours(0,0,0,0);const[Ne,Ie,st]=await Promise.all([S.from("female_earnings_snapshots").select("near_limit_count, near_limit_names, updated_at").eq("user_id",n.id).maybeSingle(),S.from("bounty_earnings").select("amount_minutes").eq("female_id",n.id).eq("clawed_back",!1).gte("created_at",K.toISOString()),S.from("bounty_earnings").select("amount_minutes").eq("female_id",n.id).eq("clawed_back",!1).eq("paid_out",!1)]),Ge=Ne.data,Me=(Ie.data??[]).reduce((On,Sr)=>On+Number(Sr.amount_minutes??0),0),Fe=!!(Ge!=null&&Ge.updated_at)&&Date.now()-new Date(Ge.updated_at).getTime()<36*36e5,Wn=(st.data??[]).reduce((On,Sr)=>On+Number(Sr.amount_minutes??0),0);return{earned_today_minutes:Me,bounty_minutes:Wn,near_limit_count:Fe?Number((Ge==null?void 0:Ge.near_limit_count)??0):0,near_limit_names:Fe?(Ge==null?void 0:Ge.near_limit_names)??[]:[],updated_at:new Date().toISOString()}}}),ua=((ue==null?void 0:ue.gifted_minutes)??0)+((pt==null?void 0:pt.bounty_minutes)??0),jr=h.useMemo(()=>{let K=de;if(m.trim()){const Me=m.toLowerCase();K=K.filter(Fe=>{var Wn,On;return(On=(Wn=Fe.other_user)==null?void 0:Wn.name)==null?void 0:On.toLowerCase().includes(Me)})}const Ne=K.find(Me=>{var Fe;return((Fe=Me.other_user)==null?void 0:Fe.id)===rt}),Ie=K.filter(Me=>{var Fe;return((Fe=Me.other_user)==null?void 0:Fe.id)!==rt}),st=Ie.filter(Me=>{var Fe;return((Fe=Me.other_user)==null?void 0:Fe.id)&&x.has(Me.other_user.id)}),Ge=Ie.filter(Me=>{var Fe;return!((Fe=Me.other_user)!=null&&Fe.id&&x.has(Me.other_user.id))});return[...Ne?[Ne]:[],...st,...Ge]},[de,m,x]),Nc=h.useMemo(()=>jr.slice(0,g),[jr,g]),ri=jr.length>g||Le,si=!u||!d,jh=!!u;return s.jsxs("div",{className:"flex flex-col h-screen max-h-screen bg-neutral-950 text-white overflow-hidden",children:[T&&n&&s.jsx(Z0,{myUserId:n.id,partnerId:T.partnerId,partnerName:T.partnerName,inviteId:T.inviteId,isInitiator:T.isInitiator,onClose:()=>E(null)}),s.jsxs("div",{className:"flex items-center gap-3 px-4 py-3 bg-neutral-900 border-b border-white/10 shrink-0",children:[s.jsx("button",{onClick:ct,className:"text-white/70 hover:text-white",children:s.jsx(jl,{className:"w-5 h-5"})}),u&&d&&s.jsxs("div",{className:"relative cursor-pointer",onClick:()=>u.other_user&&I(u.other_user),children:[s.jsx("div",{className:"w-8 h-8 rounded-full bg-white/10 overflow-hidden",children:(Nh=u.other_user)!=null&&Nh.image_url?s.jsx("img",{src:u.other_user.image_url,alt:"",className:"w-full h-full object-cover"}):s.jsx("div",{className:"w-full h-full flex items-center justify-center text-white/30 font-bold text-xs",children:(ai=(Tc=(Nr=u.other_user)==null?void 0:Nr.name)==null?void 0:Tc.charAt(0))==null?void 0:ai.toUpperCase()})}),((Rc=u.other_user)==null?void 0:Rc.last_active_at)&&Es(u.other_user.last_active_at)&&s.jsx("span",{className:"absolute bottom-0 right-0 w-2.5 h-2.5 bg-emerald-500 border-2 border-neutral-900 rounded-full"})]}),s.jsx("h1",{className:"font-bold text-lg flex-1 flex items-center gap-2",children:u&&d?s.jsxs(s.Fragment,{children:[((ii=u.other_user)==null?void 0:ii.name)||"Chat",((fa=u.other_user)==null?void 0:fa.id)&&pe[u.other_user.id]&&s.jsx(Of,{role:pe[u.other_user.id]})]}):"Messages"}),!u&&ua>0&&s.jsxs("button",{onClick:()=>z(!0),className:"flex items-center gap-1.5 bg-emerald-500/20 hover:bg-emerald-500/30 text-emerald-400 text-sm font-semibold px-3 py-2 rounded-lg transition-colors border border-emerald-500/30",children:[s.jsx($t,{className:"w-3.5 h-3.5"}),"Cash Out"]}),!u&&le==="female"&&s.jsxs("button",{onClick:()=>U(!0),className:"flex items-center gap-1.5 bg-pink-500/20 hover:bg-pink-500/30 text-pink-400 text-sm font-semibold px-3 py-2 rounded-lg transition-colors border border-pink-500/30",children:[s.jsx(__,{className:"w-3.5 h-3.5"}),"Earn Guide"]}),u&&d&&s.jsxs(s.Fragment,{children:[ua>0&&s.jsx("button",{onClick:()=>z(!0),className:"w-9 h-9 rounded-full bg-emerald-500/20 hover:bg-emerald-500/30 flex items-center justify-center transition-colors",title:"Cash Out",children:s.jsx($t,{className:"w-4 h-4 text-emerald-400"})}),s.jsx("button",{onClick:()=>D(!0),disabled:Z,className:"w-9 h-9 rounded-full bg-yellow-500/20 hover:bg-yellow-500/30 flex items-center justify-center transition-colors disabled:opacity-40",title:Z?"Unavailable in blocked chats":"Send gift",children:s.jsx(Ft,{className:"w-4 h-4 text-yellow-400"})}),s.jsx("button",{onClick:M,disabled:W||Z,className:"w-9 h-9 rounded-full bg-emerald-500/20 hover:bg-emerald-500/30 flex items-center justify-center transition-colors disabled:opacity-40",title:Z?"Unavailable in blocked chats":"Start video call",children:s.jsx(mr,{className:"w-4.5 h-4.5 text-emerald-400"})}),!Pe&&!F&&s.jsx("button",{onClick:()=>Re(!0),className:"w-9 h-9 rounded-full bg-red-500/20 hover:bg-red-500/30 flex items-center justify-center transition-colors",title:"Block user",children:s.jsx(ja,{className:"w-4 h-4 text-red-400"})})]})]}),s.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[si&&s.jsxs("div",{className:`${d?"w-full":"w-80 border-r border-white/10"} flex flex-col overflow-hidden`,children:[s.jsx("div",{className:"px-3 py-2 border-b border-white/10 shrink-0",children:s.jsxs("div",{className:"relative",children:[s.jsx(j_,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 w-4 h-4 text-white/30"}),s.jsx("input",{type:"text",placeholder:"Search conversations...",value:m,onChange:K=>{p(K.target.value),y(v)},className:"w-full bg-white/5 border border-white/10 rounded-lg pl-8 pr-3 py-2 text-sm text-white placeholder:text-white/30 focus:outline-none focus:border-white/20"})]})}),s.jsxs("div",{className:"flex-1 overflow-y-auto",children:[le==="female"&&pt&&s.jsxs("div",{className:"mx-3 mt-3 rounded-xl border border-emerald-500/30 bg-gradient-to-br from-emerald-500/15 to-emerald-500/5 p-3",children:[s.jsxs("div",{className:"flex items-center justify-between gap-2",children:[s.jsx("span",{className:"text-[11px] font-bold uppercase tracking-wide text-emerald-300",children:"Your earnings today"}),s.jsx("span",{className:"text-[10px] text-white/35",children:"Live"})]}),s.jsxs("div",{className:"mt-2 flex items-end gap-4",children:[s.jsxs("div",{children:[s.jsxs("p",{className:"text-2xl font-extrabold text-emerald-300 leading-none",children:["$",(pt.earned_today_minutes*.01).toFixed(2)]}),s.jsxs("p",{className:"text-[10px] text-white/45 mt-1",children:[pt.earned_today_minutes," min earned"]})]}),s.jsxs("div",{children:[s.jsxs("p",{className:"text-lg font-bold text-white leading-none",children:["$",(ua*.01).toFixed(2)]}),s.jsx("p",{className:"text-[10px] text-white/45 mt-1",children:"cashable balance"})]})]}),pt.near_limit_count>0&&s.jsxs("p",{className:"mt-2 text-[11px] text-amber-300 leading-snug",children:[pt.near_limit_count," guy",pt.near_limit_count>1?"s are":" is"," almost out of free messages",(Do=pt.near_limit_names)!=null&&Do.length?` (${pt.near_limit_names.slice(0,3).join(", ")})`:"",". Reply today — you get paid when they upgrade."]}),s.jsxs("div",{className:"mt-3 flex gap-2",children:[ua>0&&s.jsx("button",{onClick:()=>z(!0),className:"flex-1 text-xs font-semibold py-2 rounded-lg bg-emerald-500 text-black hover:brightness-110 transition",children:"Cash Out"}),s.jsx("button",{onClick:()=>U(!0),className:"flex-1 text-xs font-semibold py-2 rounded-lg bg-white/10 text-white hover:bg-white/15 transition",children:"How to earn more"})]})]}),mt&&s.jsxs("button",{onClick:()=>o("/earnings-chat"),className:"flex items-center gap-3 px-4 py-3 w-full text-left border-b border-white/10 bg-gradient-to-r from-emerald-500/15 to-pink-500/10 hover:brightness-125 transition",children:[s.jsx("div",{className:"relative shrink-0 w-12 h-12 rounded-full bg-gradient-to-br from-emerald-400 to-pink-500 flex items-center justify-center text-xl",children:"💸"}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"flex justify-between items-center gap-1",children:[s.jsxs("span",{className:"font-semibold text-sm truncate flex items-center gap-1.5",children:["Girls Only Earnings Chat",s.jsx("span",{className:"text-[9px] font-bold uppercase px-1.5 py-0.5 rounded bg-emerald-500/20 text-emerald-300",children:"Verified"})]}),(ut==null?void 0:ut.created_at)&&s.jsx("span",{className:"text-[10px] text-white/30 shrink-0 ml-2",children:_t(ut.created_at)})]}),s.jsx("p",{className:"text-xs text-white/50 truncate mt-0.5",children:(ut==null?void 0:ut.body)||"See what other girls are earning 💰"})]})]}),me?s.jsx("div",{className:"flex items-center justify-center py-20 text-white/40",children:"Loading..."}):jr.length===0?s.jsxs("div",{className:"flex flex-col items-center justify-center py-20 px-6 text-center",children:[s.jsx(An,{className:"w-12 h-12 text-white/20 mb-3"}),s.jsx("p",{className:"text-white/40 text-sm",children:m?"No matches found":"No messages yet"}),s.jsx("p",{className:"text-white/25 text-xs mt-1",children:m?"Try a different search":"Message someone from Discover to start chatting"})]}):s.jsxs(s.Fragment,{children:[Nc.map((K,Ne)=>{var Ie,st,Ge,Me,Fe,Wn,On,Sr;return s.jsxs("div",{children:[Ne===3&&le==="female"&&s.jsx("button",{onClick:async mn=>{mn.stopPropagation();const{VIP_TIERS:Sh}=await ne(async()=>{const{VIP_TIERS:Vo}=await Promise.resolve().then(()=>Uu);return{VIP_TIERS:Vo}},void 0);
521J(Sh.basic.price_id,"messages_female_banner")},className:"mx-3 my-2 p-2.5 rounded-xl bg-gradient-to-r from-amber-500 via-pink-500 to-purple-600 shadow-lg shadow-pink-500/20 text-left w-[calc(100%-1.5rem)] cursor-pointer hover:brightness-110 transition",children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-base",children:"👑"}),s.jsxs("p",{className:"text-white text-[11px] font-bold leading-snug",children:["Get noticed & gifted by thousands of guys — stay at the top of the Discover page with"," ",s.jsx("span",{className:"text-yellow-200 underline underline-offset-2",children:"VIP starting at $2.49/week!"})]}),s.jsx(yr,{className:"w-4 h-4 text-yellow-200 shrink-0"})]})}),s.jsxs("div",{className:"relative group",children:[s.jsxs("button",{onClick:()=>f(K),className:`flex items-center gap-3 px-4 py-3 hover:bg-white/5 transition-colors text-left w-full ${(u==null?void 0:u.id)===K.id?"bg-white/10":""}`,children:[s.jsxs("div",{className:"relative shrink-0 cursor-pointer",onClick:mn=>{mn.stopPropagation(),K.other_user&&I(K.other_user)},children:[s.jsx("div",{className:"w-12 h-12 rounded-full bg-white/10 overflow-hidden",children:(Ie=K.other_user)!=null&&Ie.image_url?s.jsx("img",{src:K.other_user.image_url,alt:"",className:"w-full h-full object-cover"}):s.jsx("div",{className:"w-full h-full flex items-center justify-center text-white/30 font-bold text-lg",children:((Me=(Ge=(st=K.other_user)==null?void 0:st.name)==null?void 0:Ge.charAt(0))==null?void 0:Me.toUpperCase())||"?"})}),((Fe=K.other_user)==null?void 0:Fe.last_active_at)&&Es(K.other_user.last_active_at)&&s.jsx("span",{className:"absolute bottom-0 right-0 w-3.5 h-3.5 bg-emerald-500 border-2 border-neutral-950 rounded-full"})]}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"flex justify-between items-center gap-1",children:[s.jsxs("span",{className:"font-semibold text-sm truncate flex items-center gap-1.5",children:[((Wn=K.other_user)==null?void 0:Wn.name)||"Unknown",((On=K.other_user)==null?void 0:On.id)&&pe[K.other_user.id]&&s.jsx(Of,{role:pe[K.other_user.id]})]}),s.jsx("span",{className:"text-[10px] text-white/30 shrink-0 ml-2",children:_t(K.last_message_at)})]}),s.jsxs("div",{className:"flex justify-between items-center mt-0.5",children:[s.jsx("p",{className:"text-xs text-white/40 truncate",children:K.last_message||"Start chatting..."}),(K.unread_count||0)>0&&s.jsx("span",{className:"bg-blue-500 text-white text-[10px] font-bold w-5 h-5 rounded-full flex items-center justify-center shrink-0 ml-2",children:K.unread_count>9?"9+":K.unread_count})]})]})]}),!d&&((Sr=K.other_user)==null?void 0:Sr.id)&&K.other_user.id!==rt&&s.jsx("button",{onClick:mn=>{mn.stopPropagation(),_(K.other_user.id)},title:x.has(K.other_user.id)?"Unpin chat":"Pin chat to top",className:`absolute top-1/2 -translate-y-1/2 right-2 p-1.5 rounded-md transition-all ${x.has(K.other_user.id)?"text-yellow-400 opacity-100":"text-white/40 opacity-0 group-hover:opacity-100 hover:text-yellow-300 hover:bg-white/10"}`,children:s.jsx(Ql,{className:`w-4 h-4 ${x.has(K.other_user.id)?"fill-yellow-400":""}`})})]})]},K.id)}),ri&&s.jsx("button",{disabled:Ke,onClick:()=>{y(K=>K+v),Le&&jr.length-g<=v*2&&Qe()},className:"w-full py-3 text-sm text-blue-400 hover:text-blue-300 hover:bg-white/5 transition-colors font-medium",children:Ke?"Loading…":Le?"Load More":`Load More (${jr.length-g} remaining)`})]})]})]}),jh&&s.jsxs("div",{className:`flex flex-col flex-1 ${d?"w-full":""}`,children:[!d&&u&&s.jsxs("div",{className:"flex items-center gap-3 px-4 py-2.5 bg-neutral-900/50 border-b border-white/10",children:[s.jsxs("div",{className:"relative cursor-pointer",onClick:()=>u.other_user&&I(u.other_user),children:[s.jsx("div",{className:"w-8 h-8 rounded-full bg-white/10 overflow-hidden",children:(Ac=u.other_user)!=null&&Ac.image_url?s.jsx("img",{src:u.other_user.image_url,alt:"",className:"w-full h-full object-cover"}):s.jsx("div",{className:"w-full h-full flex items-center justify-center text-white/30 font-bold text-sm",children:(Mo=(Lo=(bs=u.other_user)==null?void 0:bs.name)==null?void 0:Lo.charAt(0))==null?void 0:Mo.toUpperCase()})}),((oi=u.other_user)==null?void 0:oi.last_active_at)&&Es(u.other_user.last_active_at)&&s.jsx("span",{className:"absolute bottom-0 right-0 w-2.5 h-2.5 bg-emerald-500 border-2 border-neutral-900 rounded-full"})]}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("span",{className:"font-semibold text-sm flex items-center gap-1.5",children:[(Ic=u.other_user)==null?void 0:Ic.name,((ys=u.other_user)==null?void 0:ys.id
521)&&pe[u.other_user.id]&&s.jsx(Of,{role:pe[u.other_user.id]})]}),s.jsx("p",{className:"text-[10px] text-white/40",children:(Oc=u.other_user)!=null&&Oc.last_active_at&&Es(u.other_user.last_active_at)?"Online now":($o=u.other_user)!=null&&$o.last_active_at?vp(u.other_user.last_active_at):""})]}),s.jsx("button",{onClick:()=>D(!0),disabled:Z,className:"w-8 h-8 rounded-full bg-yellow-500/20 hover:bg-yellow-500/30 flex items-center justify-center transition-colors disabled:opacity-40",title:Z?"Unavailable in blocked chats":"Send gift",children:s.jsx(Ft,{className:"w-4 h-4 text-yellow-400"})}),s.jsx("button",{onClick:M,disabled:W||Z,className:"w-8 h-8 rounded-full bg-emerald-500/20 hover:bg-emerald-500/30 flex items-center justify-center transition-colors disabled:opacity-40",title:Z?"Unavailable in blocked chats":"Start video call",children:s.jsx(mr,{className:"w-4 h-4 text-emerald-400"})}),!Pe&&!F&&s.jsx("button",{onClick:()=>Re(!0),className:"w-8 h-8 rounded-full bg-red-500/20 hover:bg-red-500/30 flex items-center justify-center transition-colors",title:"Block user",children:s.jsx(ja,{className:"w-4 h-4 text-red-400"})})]}),nt>0?s.jsxs("div",{className:"mx-4 mt-3 mb-1 flex items-center justify-between bg-emerald-500/10 border border-emerald-500/20 rounded-xl px-4 py-2.5",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Ft,{className:"w-4 h-4 text-emerald-400"}),s.jsxs("span",{className:"text-sm text-emerald-300",children:[s.jsx("span",{className:"font-bold",children:nt})," mins earned from ",((kr=u==null?void 0:u.other_user)==null?void 0:kr.name)||"this user"]})]}),s.jsxs("button",{onClick:()=>o("/my-rewards"),className:"flex items-center gap-1 bg-emerald-500 hover:bg-emerald-400 text-white text-xs font-bold px-3 py-1.5 rounded-lg transition-colors",children:[s.jsx($t,{className:"w-3 h-3"}),"Cash Out"]})]}):le==="female"&&((kh=(Fo=u==null?void 0:u.other_user)==null?void 0:Fo.gender)==null?void 0:kh.toLowerCase())==="male"?s.jsxs("div",{className:"mx-4 mt-3 mb-1 flex items-center gap-2 bg-pink-500/10 border border-pink-500/20 rounded-xl px-4 py-2.5",children:[s.jsx(mr,{className:"w-4 h-4 text-pink-400 shrink-0"}),s.jsxs("span",{className:"text-xs text-pink-300/90 flex-1",children:["💡 Start a ",s.jsx("strong",{children:"private video call"})," — gifts received in private calls give you a ",s.jsx("strong",{className:"text-pink-300",children:"20% bonus"}),"!"]}),s.jsx("button",{onClick:M,disabled:W||Z,className:"shrink-0 bg-pink-500 hover:bg-pink-400 text-white text-xs font-bold px-3 py-1.5 rounded-lg transition-colors disabled:opacity-40",children:"Call Now"})]}):s.jsxs("div",{className:"mx-4 mt-3 mb-1 flex items-center gap-2 bg-yellow-500/10 border border-yellow-500/15 rounded-xl px-4 py-2.5",children:[s.jsx(Ft,{className:"w-4 h-4 text-yellow-400 shrink-0"}),s.jsx("span",{className:"text-xs text-yellow-300/80",children:"💡 Did you know? Users can send you cash gifts in DMs! Earned gifts can be cashed out via PayPal."})]}),s.jsx("div",{className:"mx-4 mt-2 mb-1 flex items-start gap-2 bg-white/5 border border-white/10 rounded-xl px-4 py-2.5",children:s.jsxs("span",{className:"text-[11px] text-white/40 leading-relaxed",children:["🔒 All video chats are encrypted and private — not even C24Club can see them. DM text messages are monitored. No solicitation for gifts."," ",s.jsx("button",{onClick:()=>o("/rules"),className:"text-white/60 underline hover:text-white/80",children:"Rules"})]})}),F&&s.jsxs("div",{className:"mx-4 mt-2 mb-1 flex items-center justify-between bg-red-500/10 border border-red-500/20 rounded-xl px-4 py-2.5",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(ja,{className:"w-4 h-4 text-red-400 shrink-0"}),s.jsxs("span",{className:"text-xs text-red-300/90",children:["You blocked ",(Uo=u==null?void 0:u.other_user)==null?void 0:Uo.name,"."]})]}),s.jsx("button",{onClick:Ce,className:"text-xs font-semibold text-white bg-white/10 hover:bg-white/20 px-3 py-1 rounded-lg transition-colors",children:"Unblock"})]}),Pe&&s.jsxs("div",{className:"mx-4 mt-2 mb-1 flex items-center gap-2 bg-red-500/10 border border-red-500/20 rounded-xl px-4 py-2.5",children:[s.jsx(ja,{className:"w-4 h-4 text-red-400 shrink-0"}),s.jsxs("span",{className:"text-xs text-red-300/90",children:["You’re blocked by ",(Dc=u==null?void 0:u.other_user)==null?void 0:Dc.name,". You can’t send any more messages in this chat."]})]}),G&&ie&&ie.total>0&&(()=>{var Ne;const K=ie.tiers.has("premium")?"Premium VIP":ie.tiers.has("basic")?"Basic V
521IP":ie.tiers.has("renewal")?"VIP Renewal":"VIP";return s.jsx("div",{className:"mx-4 mt-2 mb-1 rounded-xl bg-gradient-to-r from-emerald-500/15 to-green-500/10 border border-emerald-400/30 px-4 py-3",children:s.jsxs("div",{className:"flex items-start gap-3",children:[s.jsx("div",{className:"text-2xl leading-none",children:"🎉"}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("p",{className:"text-sm font-bold text-emerald-200",children:["Bounty Win! +",ie.total," gifted minutes"]}),s.jsxs("p",{className:"text-[11px] text-emerald-100/80 mt-0.5",children:[(Ne=u==null?void 0:u.other_user)==null?void 0:Ne.name," subscribed to ",K," — you converted them! Cash out your gifted minutes for PayPal."]}),s.jsxs("div",{className:"flex items-center gap-2 mt-2",children:[s.jsxs("button",{onClick:()=>z(!0),className:"inline-flex items-center gap-1 bg-emerald-500 hover:bg-emerald-400 text-black text-xs font-bold px-3 py-1.5 rounded-lg transition-colors",children:[s.jsx($t,{className:"w-3.5 h-3.5"})," Cash out minutes"]}),s.jsx("button",{onClick:()=>U(!0),className:"text-[11px] text-emerald-300/70 hover:text-emerald-200 underline transition-colors",children:"How does this work?"})]})]})]})})})(),s.jsxs("div",{className:"flex-1 overflow-y-auto px-4 py-3 space-y-2",children:[an?s.jsx("div",{className:"flex items-center justify-center py-20 text-white/40",children:"Loading..."}):tt.length===0?s.jsx("div",{className:"flex items-center justify-center py-20 text-white/30 text-sm",children:"Say hello! 👋"}):tt.map(K=>{if(K.message_kind==="system"||!K.sender_id)return s.jsx("div",{className:"flex justify-center",children:s.jsxs("div",{className:"max-w-[85%] rounded-full bg-white/5 border border-white/10 px-3 py-1.5 text-center text-xs text-white/60",children:["🎁 ",K.content]})},K.id);const Ne=K.sender_id===(n==null?void 0:n.id),st=K.sender_id===rt&&le==="female"&&typeof K.content=="string"&&/welcome to c24 club/i.test(K.content);return s.jsx("div",{className:`flex ${Ne?"justify-end":"justify-start"}`,children:s.jsxs("div",{className:`max-w-[75%] ${Ne?"items-end":"items-start"} flex flex-col gap-2`,children:[s.jsxs("div",{className:`px-3 py-2 rounded-2xl text-sm ${Ne?"bg-blue-600 text-white rounded-br-md":"bg-white/10 text-white/90 rounded-bl-md"}`,children:[s.jsx("p",{className:"break-words whitespace-pre-wrap",children:ML(K.content)}),s.jsx("p",{className:`text-[10px] mt-1 ${Ne?"text-blue-200/60":"text-white/25"}`,children:_t(K.created_at)})]}),st&&s.jsx("button",{onClick:()=>U(!0),className:"self-start inline-flex items-center gap-1.5 bg-gradient-to-r from-emerald-500 to-green-500 hover:from-emerald-400 hover:to-green-400 text-black text-xs font-extrabold px-3.5 py-2 rounded-xl shadow-lg shadow-emerald-500/30 transition-all",children:"💸 Earn money DMing guys →"})]})},K.id)}),s.jsx("div",{ref:k})]}),G&&(ze==null?void 0:ze.has_reached_limit)&&!Z&&s.jsxs("div",{className:"mx-3 mb-2 rounded-xl bg-amber-500/10 border border-amber-500/30 px-4 py-3",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[s.jsx("span",{className:"text-amber-400",children:"⚠️"}),s.jsx("p",{className:"text-sm font-bold text-amber-300",children:"Message Limit Reached"})]}),s.jsxs("p",{className:"text-xs text-amber-200/80 leading-relaxed mb-2.5",children:[(Bo=u==null?void 0:u.other_user)==null?void 0:Bo.name," cannot chat until he is VIP. Convince him to upgrade to earn commission!"]}),s.jsx("button",{onClick:()=>U(!0),className:"inline-flex items-center gap-1 bg-amber-500 hover:bg-amber-400 text-black text-xs font-bold px-3 py-1.5 rounded-lg transition-colors",children:"View Earning Guide →"})]}),lt?s.jsx("div",{className:"px-3 py-3 bg-neutral-900 border-t border-white/10 shrink-0",children:s.jsxs("div",{className:"flex items-center gap-3 bg-blue-500/10 border border-blue-500/20 rounded-xl px-4 py-3",children:[s.jsx(ja,{className:"w-5 h-5 text-blue-400 shrink-0"}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("p",{className:"text-sm text-white font-semibold",children:"Free messages used up"}),s.jsx("p",{className:"text-xs text-white/50",children:"Subscribe to Basic V
521IP to send unlimited messages"})]}),s.jsx("button",{onClick:()=>te(!0),className:"shrink-0 bg-gradient-to-r from-blue-500 to-cyan-500 text-white text-xs font-bold px-4 py-2 rounded-lg hover:from-blue-400 hover:to-cyan-400 transition-all",children:"Upgrade"})]})}):Z?s.jsx("div",{className:"px-3 py-3 bg-neutral-900 border-t border-white/10 shrink-0",children:s.jsxs("div",{className:"flex items-center gap-3 bg-red-500/10 border border-red-500/20 rounded-xl px-4 py-3",children:[s.jsx(ja,{className:"w-5 h-5 text-red-400 shrink-0"}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("p",{className:"text-sm text-white font-semibold",children:"Messaging unavailable"}),s.jsx("p",{className:"text-xs text-white/50",children:F?`You blocked ${(Lc=u==null?void 0:u.other_user)==null?void 0:Lc.name}, so this chat is closed.`:`${(li=u==null?void 0:u.other_user)==null?void 0:li.name} blocked you, so you can’t send messages.`})]})]})}):s.jsx("div",{className:"px-3 py-2 bg-neutral-900 border-t border-white/10 shrink-0",children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("input",{type:"text",value:j,onChange:K=>N(K.target.value.slice(0,500)),onKeyDown:K=>K.key==="Enter"&&!K.shiftKey&&$e(),placeholder:Ze&&!ft?`Type a message... (${on} free left)`:"Type a message...",className:"flex-1 bg-white/5 border border-white/10 rounded-full px-4 py-2.5 text-sm text-white placeholder:text-white/30 focus:outline-none focus:border-blue-500/50",maxLength:500}),s.jsx("button",{onClick:$e,disabled:!j.trim()||Wt.isPending,className:"w-10 h-10 rounded-full bg-blue-600 hover:bg-blue-500 disabled:opacity-30 disabled:hover:bg-blue-600 flex items-center justify-center transition-colors shrink-0",children:s.jsx(eh,{className:"w-4 h-4 text-white"})})]})})]}),!d&&!u&&s.jsx("div",{className:"flex-1 flex items-center justify-center text-white/20",children:s.jsxs("div",{className:"text-center",children:[s.jsx(An,{className:"w-16 h-16 mx-auto mb-3 opacity-30"}),s.jsx("p",{className:"text-sm",children:"Select a conversation"})]})})]}),A&&s.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/70 backdrop-blur-sm",onClick:()=>I(null),children:s.jsxs("div",{className:"relative w-80 max-w-[90vw] bg-neutral-900 border border-white/10 rounded-2xl overflow-hidden shadow-2xl",onClick:K=>K.stopPropagation(),children:[s.jsx("button",{onClick:()=>I(null),className:"absolute top-3 right-3 z-10 w-8 h-8 rounded-full bg-black/50 hover:bg-black/70 flex items-center justify-center text-white/70 hover:text-white transition-colors",children:s.jsx(We,{className:"w-4 h-4"})}),s.jsx("div",{className:"aspect-square bg-white/5 overflow-hidden",children:A.image_url?s.jsx("img",{src:A.image_url,alt:A.name,className:"w-full h-full object-cover"}):s.jsx("div",{className:"w-full h-full flex items-center justify-center text-white/20 text-6xl font-bold",children:(zo=(ma=A.name)==null?void 0:ma.charAt(0))==null?void 0:zo.toUpperCase()})}),s.jsxs("div",{className:"p-4 space-y-3",children:[s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("h3",{className:"font-bold text-lg text-white",children:A.name}),A.last_active_at&&Es(A.last_active_at)&&s.jsxs("span",{className:"flex items-center gap-1 bg-emerald-500/20 text-emerald-400 text-[10px] font-bold px-2 py-0.5 rounded-full",children:[s.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-emerald-400 animate-pulse"}),"Online"]})]}),s.jsxs("p",{className:"text-white/40 text-xs mt-0.5",children:[A.gender&&s.jsx("span",{className:"capitalize",children:A.gender}),A.last_active_at&&!Es(A.last_active_at)&&s.jsxs("span",{children:[" · Last seen ",vp(A.last_active_at)]})]})]}),O.length>0&&s.jsx(Cd,{pinnedSocials:O}),s.jsxs("div",{className:"flex gap-2",children:[s.jsxs("button",{onClick:()=>{I(null),o(`/messages?to=${A.id}`)},className:"flex-1 flex items-center justify-center gap-1.5 bg-blue-600 hover:bg-blue-500 text-white text-sm font-semibold py-2.5 rounded-xl transition-colors",children:[s.jsx(h4,{className:"w-4 h-4"}),"Message"]}),s.jsxs("button",{onClick:()=>{var K;I(null),((K=u==null?void 0:u.other_user)==null?void 0:K.id)===A.id&&M()},className:"flex-1 flex items-center justify-center gap-1.5 bg-emerald-600 hover:bg-emerald-500 text-white text-sm font-semibold py-2.5 rounded-xl transition-colors",children:[s.jsx(mr,{className:"w-4 h-4"}),"Video Call"]})]}),s.jsx("button",{onClick:()=>{I(null),o("/discover")},className:"w-full text-center text-white/40 hover:text-white/60 text-xs py-1 transition-colors",children:"View on Discover →"})]})]})}),q&&((qo=u==null?void 0:u.other_user)==null?void 0:qo.id)&&!Z&&s.jsx(X0,{recipientId:u.other_user.id,onClose:()=>D(!1)}),$&&s.jsx(gh,{onClose:()=>z(!1),currentMinutes:(ue==null?void 0:ue.total_minutes)??0,giftedMinutes:(ue==null?void 0:ue.gifted_minutes)??0,bountyMinutes:(pt==null?void 0:pt.bounty_minutes)??0,onSuccess:()=>Ee()}),R&&s.jsx(nx,{onClose:()=>U(!1)}),ee&&s.jsx(Qj,{onClose:()=>ae(!1),onSubscribe:async()=>{ae(!1);const{VIP_TIERS:K}=await ne(async()=>{const{VIP_TIERS:Ne}=await Promise.resolve().then(()=>Uu);return{VIP_TIERS:Ne}},void 0);
521J(K.premium.price_id,"messages_vip_call_gate")}}),s.jsx(DL,{open:ce,onOpenChange:Re,children:s.jsxs(VN,{children:[s.jsxs(WN,{children:[s.jsxs(GN,{children:["Block ",(ci=u==null?void 0:u.other_user)==null?void 0:ci.name,"?"]}),s.jsx(KN,{children:"Once blocked, they won’t be able to send you any more messages, and this DM thread will be locked."})]}),s.jsxs(HN,{children:[s.jsx(QN,{children:"Cancel"}),s.jsx(YN,{onClick:be,disabled:ye,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:ye?"Blocking...":"Block user"})]})]})}),xe&&(u==null?void 0:u.other_user)&&s.jsx(hD,{partnerName:u.other_user.name||"this user",onClose:()=>te(!1),onSubscribe:async()=>{te(!1);const{VIP_TIERS:K}=await ne(async()=>{const{VIP_TIERS:Ne}=await Promise.resolve().then(()=>Uu);return{VIP_TIERS:Ne}},void 0);J(K.basic.price_id,"messages_dm_paywall")}})]})},$L=Object.freeze(Object.defineProperty({__proto__:null,default:lx},Symbol.toStringTag,{value:"Module"})),FL="/assets/bestie-cutout-CeCR8zcF.png",UL="/assets/blue-eye-BAvDr0IJ.jpg";function BL(){const{user:e}=it(),t=wt(),[n,r]=h.useState(!1),[a,i]=h.useState(!1),{data:o,isLoading:l}=he({queryKey:["bestie_pair",e==null?void 0:e.id],enabled:!!e,queryFn:async()=>{const{data:b}=await S.from("bestie_pairs").select("*").or(`inviter_id.eq.${e.id},invitee_id.eq.${e.id}`).in("status",["pending","active","completed"]).order("created_at",{ascending:!1}).limit(1).maybeSingle();return b}}),{data:c=[]}=he({queryKey:["bestie_daily_logs",o==null?void 0:o.id],enabled:!!(o!=null&&o.id),queryFn:async()=>{const{data:b}=await S.from("bestie_daily_logs").select("*").eq("pair_id",o.id).order("day_number",{ascending:!0});return b||[]}}),d=async()=>{if(e){r(!0);try{const b=`bestie-${crypto.randomUUID().slice(0,8)}`,{error:x}=await S.from("bestie_pairs").insert({inviter_id:e.id,invite_code:b,status:"pending"});if(x)throw x;t.invalidateQueries({queryKey:["bestie_pair"]}),B.success("Bestie invite link created!")}catch(b){B.error("Failed to create invite",{description:b.message})}r(!1)}},u=o!=null&&o.invite_code?`${window.location.origin}/?bestie=${o.invite_code}`:null,f=()=>{u&&(navigator.clipboard.writeText(u),i(!0),B.success("Bestie link copied!"),setTimeout(()=>i(!1),2e3))},m=(o==null?void 0:o.inviter_id)===(e==null?void 0:e.id),p=!!o,v=(o==null?void 0:o.status)==="active",g=(o==null?void 0:o.status)==="completed",y=(o==null?void 0:o.status)==="pending"&&!(o!=null&&o.invitee_id);return{bestiePair:o,dailyLogs:c,isLoading:l,generating:n,copied:a,bestieLink:u,isInviter:m,hasPair:p,pairActive:v,pairCompleted:g,waitingForBestie:y,generateInviteCode:d,copyLink:f}}const zL=({onClose:e,onSuccess:t})=>{const{user:n}=it(),[r,a]=h.useState(""),[i,o]=h.useState(!1),{data:l=[]}=he({queryKey:["challenge_cash_earnings",n==null?void 0:n.id],enabled:!!n,queryFn:async()=>{const{data:x}=await S.from("challenge_submissions").select("id, status, created_at, weekly_challenges(title, reward_type, reward_amount)").eq("user_id",n.id).eq("status","approved").order("created_at",{ascending:!1});return x?x.filter(w=>{var _;return((_=w.weekly_challenges)==null?void 0:_.reward_type)==="cash"}).map(w=>{var _,j;return{id:w.id,challenge_title:((_=w.weekly_challenges)==null?void 0:_.title)||"Challenge",cash_amount:((j=w.weekly_challenges)==null?void 0:j.reward_amount)||0,status:w.status,created_at:w.created_at}}):[]}}),{data:c=[],refetch:d}=he({queryKey:["challenge_cashout_history",n==null?void 0:n.id],enabled:!!n,queryFn:async()=>{const{data:x}=await S.from("cashout_requests").select("id, cash_amount, status, created_at, paypal_email").eq("user_id",n.id).order("created_at",{ascending:!1}).limit(10);return x||[]}}),u=l.reduce((x,w)=>x+w.cash_amount,0),f=c.filter(x=>x.status==="approved"||x.status==="paid").reduce((x,w)=>x+Number(w.cash_amount),0),m=Number((u-f).toFixed(2)),p=c.some(x=>x.status==="pending"),v=!p&&m>0,g=async()=>{if(!r.includes("@")){B.error("Enter a valid PayPal email");return}o(!0);try{const{data:x,error:w}=await S.functions.invoke("cashout-minutes",{body:{action:"request-cashout",cash_amount:m,paypal_email:r}});if(w)throw w;if(x!=null&&x.error)throw new Error(x.error);B.success(`💰 Cashout request submitted for $${x.cash_amount}!`),t(),d()}catch(x){B.error(x.message||"Cashout failed")}finally{o(!1)}},y=x=>x==="pending"?s.jsx(er,{className:"w-3.5 h-3.5 text-amber-400"}):x==="approved"||x==="paid"?s.jsx(ra,{className:"w-3.5 h-3.5 text-emerald-400"}):s.jsx(Xd,{className:"w-3.5 h-3.5 text-red-400"}),b=x=>x==="pending"?"text-amber-400":x==="approved"||x==="paid"?"text-emerald-400":"text-red-400";return s.jsx("div",{className:"fixed inset-0 z-[70] bg-black/80 flex items-center justify-center px-4",onClick:e,children:s.jsxs("div",{className:"bg-neutral-900 border border-white/10 rounded-2xl p-6 w-full max-w-md relative max-h-[90vh] overflow-y-auto",onClick:x=>x.stopPropagation(),children:[s.jsx("button",{onClick:e,className:"absolute top-4 right-4 text-white/40 hover:text-white",children:s.jsx(We,{className:"w-5 h-5"})}),s.jsxs("div",{className:"text-center mb-5",children:[s.jsx("div",{className:"w-14 h-14 roun
521ded-full bg-emerald-500/20 flex items-center justify-center mx-auto mb-3",children:s.jsx(ds,{className:"w-7 h-7 text-emerald-400"})}),s.jsx("h2",{className:"text-white font-bold text-xl",children:"Challenge Earnings"}),s.jsx("p",{className:"text-white/50 text-sm mt-1",children:"Cash earned from completing weekly challenges"})]}),s.jsxs("div",{className:"bg-white/5 border border-white/10 rounded-xl p-4 mb-5 space-y-2.5",children:[s.jsxs("div",{className:"flex justify-between items-center",children:[s.jsx("span",{className:"text-white/60 text-sm",children:"🏆 Total Challenge Cash Earned"}),s.jsxs("span",{className:"text-emerald-400 font-bold text-base",children:["$",u.toFixed(2)]})]}),s.jsxs("div",{className:"flex justify-between items-center",children:[s.jsx("span",{className:"text-white/60 text-sm",children:"💸 Already Cashed Out"}),s.jsxs("span",{className:"text-white/60 font-bold text-base",children:["$",f.toFixed(2)]})]}),s.jsxs("div",{className:"border-t border-white/10 pt-2 flex justify-between items-center",children:[s.jsx("span",{className:"text-white/60 text-sm",children:"💰 Available to Cash Out"}),s.jsxs("span",{className:"text-emerald-400 font-bold text-xl",children:["$",m]}
521)]})]}),l.length>0&&s.jsxs("div",{className:"mb-5",children:[s.jsx("h3",{className:"text-white/60 text-xs font-bold uppercase tracking-wider mb-2.5",children:"Earned Rewards"}),s.jsx("div",{className:"space-y-2 max-h-36 overflow-y-auto",children:l.map(x=>s.jsxs("div",{className:"flex items-center justify-between bg-white/5 rounded-lg px-4 py-2.5",children:[s.jsxs("div",{className:"flex items-center gap-2.5",children:[s.jsx(ra,{className:"w-4 h-4 text-emerald-400"}),s.jsx("span",{className:"text-white text-sm font-bold truncate max-w-[180px]",children:x.challenge_title})]}),s.jsxs("span",{className:"text-emerald-400 text-sm font-black",children:["$",x.cash_amount]})]},x.id))})]}),l.length===0&&s.jsxs("div",{className:"bg-white/5 border border-white/10 rounded-xl p-5 mb-5 text-center",children:[s.jsx("p",{className:"text-white/40 text-base font-bold",children:"No cash rewards yet"}),s.jsx("p",{className:"text-white/25 text-sm mt-1",children:"Complete challenges with cash rewards to see your earnings here"})]}),m>0&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"mb-4",children:[s.jsx("label",{className:"text-white/60 text-sm block mb-1.5",children:"PayPal Email"}),s.jsx("input",{type:"email",placeholder:"[email protected]",value:r,onChange:x=>a(x.target.value),className:"w-full bg-white/5 border border-white/10 rounded-lg px-4 py-3 text-white text-base placeholder:text-white/30 focus:outline-none focus:border-emerald-500/50"})]}),!v&&m<=0&&!p&&s.jsxs("div",{className:"bg-amber-500/10 border border-amber-500/20 rounded-xl p-4 mb-4",children:[s.jsx("p",{className:"text-amber-400 text-sm font-bold",children:"⚠️ No cash available"}),s.jsx("p",{className:"text-white/50 text-sm mt-1",children:"Complete challenges with cash rewards to earn money you can cash out."})]}),p&&s.jsxs("div",{className:"bg-amber-500/10 border border-amber-500/20 rounded-xl p-4 mb-4",children:[s.jsx("p",{className:"text-amber-400 text-sm font-bold",children:"⏳ Pending cashout"}),s.jsx("p",{className:"text-white/50 text-sm mt-1",children:"You already have a pending cashout request. Please wait for it to be processed."})]}),s.jsx("button",{onClick:g,disabled:i||!v||!r.includes("@"),className:"w-full bg-emerald-500 hover:bg-emerald-400 text-black font-bold py-3.5 rounded-xl transition-colors disabled:opacity-50 text-base",children:i?"Submitting...":p?"Pending Request...":`💰 Cash Out $${m}`}),s.jsx("p",{className:"text-white/30 text-xs text-center mt-2.5",children:"Paid via PayPal • Admin approval required"})]}),c.length>0&&s.jsxs("div",{className:"mt-5 border-t border-white/10 pt-4",children:[s.jsx("h3",{className:"text-white/70 text-sm font-bold uppercase tracking-wider mb-3",children:"Cashout History"}),s.jsx("div",{className:"space-y-2.5 max-h-40 overflow-y-auto",children:c.map(x=>s.jsxs("div",{className:"bg-white/5 rounded-lg px-4 py-2.5 flex items-center justify-between",children:[s.jsxs("div",{children:[s.jsxs("p",{className:"text-white text-sm font-bold",children:["$",Number(x.cash_amount).toFixed(2)]}),s.jsx("p",{className:"text-white/30 text-xs",children:new Date(x.created_at).toLocaleDateString()})]}),s.jsxs("div",{className:"flex items-center gap-1.5",children:[y(x.status),s.jsx("span",{className:`text-xs font-bold uppercase ${b(x.status)}`,children:x.status})]})]},x.id))})]})]})})},qL=()=>{const{user:e}=it(),[t,n]=h.useState(""),[r,a]=h.useState(""),[i,o]=h.useState(!1),[l,c]=h.useState(!1),d=async()=>{if(!(!e||!t.trim())){o(!0);try{const{error:u}=await S.from("challenge_suggestions").insert({user_id:e.id,title:t.trim(),description:r.trim()||null});if(u)throw u;c(!0),n(""),a(""),B.success("Suggestion submitted! 🎉"),setTimeout(()=>c(!1),4e3)}catch{B.error("Failed to submit suggestion")}finally{o(!1)}}};return e?s.jsx("div",{className:"w-full max-w-md mx-auto mt-6",children:s.jsxs("div",{className:"bg-gradient-to-br from-violet-600/20 via-purple-700/15 to-indigo-900/30 border border-violet-400/30 rounded-2xl p-5",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[s.jsx(__,{className:"w-5 h-5 text-violet-300"}),s.jsx("h3",{className:"font-black text-sm tracking-wider text-violet-200",children:"SUGGEST A CHALLENGE"})]}),s.jsx("p",{className:"text-xs text-neutral-400 mb-4",children:"Have a cool challenge idea? Let us know and we might add it!"}),s.jsx("input",{type:"text",placeholder:"Challenge name...",value:t,onChange:u=>n(u.target.value),maxLength:100,className:"w-full bg-black/40 border border-neutral-700 rounded-xl px-4 py-2.5 text-sm text-white placeholder:text-neutral-500 focus:outline-none focus:border-violet-400/60 mb-3"}),s.jsx("textarea",{placeholder:"Describe how it works (optional)...",value:r,onChange:u=>a(u.target.value),maxLength:500,rows:3,className:"w-full bg-black/40 border border-neutral-700 rounded-xl px-4 py-2.5 text-sm text-white placeholder:text-neutral-500 focus:outline-none focus:border-violet-400/60 resize-none mb-3"}),s.jsx("button",{onClick:d,disabled:i||!t.trim()||l,className:"w-full py-2.5 rounded-xl font-black text-sm tracking-wider transition-all disabled:opacity-50 flex items-center justify-center gap-2 bg-gradient-to-r from-violet-600 to-purple-600 hover:from-violet-500 hover:to-purple-500",children:i?s.jsx(us,{className:"w-4 h-4 animate-spin"}):l?s.jsxs(s.Fragment,{children:[s.jsx(ra,{className:"w-4 h-4"}),"SUBMITTED!"]}):s.jsxs(s.Fragment,{children:[s.jsx(eh,{className:"w-4 h-4"}),"SUBMIT IDEA"]})})]})}):null},bo={fuchsia:{gradient:"from-fuchsia-600/30 via-purple-700/25 to-pink-900/40",border:"border-fuchsia-400/50",glow:"shadow-[0_0_24px_rgba(217,70,239,0.35)]",shimmer:"rgba(217,70,239,0.1)",accentText:"text-fuchsia-300",badgeColor:"bg-green-500/20 text-green-400",icon:Ur},cyan:{gradient:"from-cyan-600/30 via-blue-700/25 to-indigo-900/40",border:"border-cyan-400/50",glow:"shadow-[0_0_24px_rgba(34,211,238,0.35)]",shimmer:"rgba(34,211,238,0.1)",accentText:"text-cyan-300",badgeColor:"bg-
521amber-500/20 text-amber-400",icon:w_},emerald:{gradient:"from-emerald-600/30 via-green-700/25 to-teal-900/40",border:"border-emerald-400/50",glow:"shadow-[0_0_24px_rgba(52,211,153,0.35)]",shimmer:"rgba(52,211,153,0.1)",accentText:"text-emerald-300",badgeColor:"bg-amber-500/20 text-amber-400",icon:er},rose:{gradient:"from-rose-600/30 via-pink-700/25 to-red-900/40",border:"border-rose-400/50",glow:"shadow-[0_0_24px_rgba(251,113,133,0.35)]",shimmer:"rgba(251,113,133,0.1)",accentText:"text-rose-300",badgeColor:"bg-green-500/20 text-green-400",icon:$0},amber:{gradient:"from-amber-600/30 via-yellow-700/25 to-orange-900/40",border:"border-amber-400/50",glow:"shadow-[0_0_24px_rgba(245,158,11,0.35)]",shimmer:"rgba(245,158,11,0.1)",accentText:"text-amber-300",badgeColor:"bg-amber-500/20 text-amber-400",icon:ds},violet:{gradient:"from-violet-600/30 via-purple-700/25 to-indigo-900/40",border:"border-violet-400/50",glow:"shadow-[0_0_24px_rgba(139,92,246,0.35)]",shimmer:"rgba(139,92,246,0.1)",accentText:"text-violet-300",badgeColor:"bg-violet-500/20 text-violet-400",icon:ds}},VL={fuchsia:["💕","👯‍♀️","✨"],cyan:["👀","💎","📸"],emerald:["🔥","⏱️","🏃‍♀️"],rose:["💪","👩‍💻","💰"],amber:["🏆","⭐","🔥"],violet:["✨","💜","🎯"]},cx={pending:{icon:er,color:"text-yellow-400",label:"PENDING REVIEW"},approved:{icon:ra,color:"text-green-400",label:"APPROVED"},rejected:{icon:Xd,color:"text-red-400",label:"NOT APPROVED"}},WL=()=>{const{bestiePair:e,dailyLogs:t,generating:n,copied:r,bestieLink:a,hasPair:i,pairActive:o,pairCompleted:l,waitingForBestie:c,generateInviteCode:d,copyLink:u}=BL();return i?c?s.jsx("div",{className:"relative mt-3 space-y-3",children:s.jsxs("div",{className:"bg-black/30 border border-fuchsia-500/30 rounded-xl p-3",children:[s.jsx("p",{className:"text-[11px] text-fuchsia-300 font-bold mb-2",children:"📩 SHARE THIS LINK WITH YOUR BESTIE:"}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:"flex-1 bg-black/40 rounded-lg px-3 py-2 text-xs text-neutral-300 truncate font-mono border border-white/10",children:a}),s.jsx("button",{onClick:u,className:"shrink-0 bg-fuchsia-500/25 hover:bg-fuchsia-500/35 border border-fuchsia-400/40 p-2 rounded-lg transition-colors active:scale-[0.95]",children:r?s.jsx(Mr,{className:"w-4 h-4 text-green-400"}):s.jsx(Zd,{className:"w-4 h-4 text-fuchsia-300"})})]}),s.jsx("p",{className:"text-[10px] text-neutral-500 mt-2",children:"⏳ Waiting for your bestie to sign up with this link..."})]})}):o||l?s.jsxs("div",{className:"relative mt-3 space-y-2",children:[s.jsx("p",{className:"text-[11px] text-fuchsia-300 font-bold",children:l?"🎉 CHALLENGE COMPLETE!":"🔥 CHALLENGE ACTIVE — Call your bestie daily!"}),s.jsx("div",{className:"flex gap-2",children:[1,2,3].map(f=>{const m=t.find(y=>y.day_number===f),p=m==null?void 0:m.verified,v=m&&!m.verified,g=m?Math.floor((m.total_seconds||0)/60):0;return s.jsxs("div",{className:"flex-1 flex flex-col items-center gap-1",children:[s.jsxs("div",{className:`w-full h-2.5 rounded-full overflow-hidden ${p?"bg-fuchsia-500":"bg-neutral-800"}`,children:[v&&s.jsx("div",{className:"h-full bg-fuchsia-500/60 rounded-full transition-all",style:{width:`${Math.min(100,g/30*100)}%`}}),p&&s.jsx("div",{className:"h-full bg-fuchsia-500 rounded-full w-full"})]}),s.jsxs("span",{className:"text-[10px] text-neutral-500 font-bold",children:[p?"✅":v?`${g}m`:""," DAY ",f]})]},f)})})]}):null:s.jsx("div",{className:"relative mt-3 space-y-2",children:s.jsxs("button",{onClick:d,disabled:n,className:"w-full bg-fuchsia-500/20 hover:bg-fuchsia-500/30 border border-fuchsia-400/40 text-fuchsia-200 font-black text-sm py-2.5 rounded-full transition-colors active:scale-[0.97] flex items-center justify-center gap-2",children:[n?s.jsx(us,{className:"w-4 h-4 animate-spin"}):s.jsx(Yl,{className:"w-4 h-4"}),n?"CREATING...":"CREATE BESTIE INVITE LINK"]})})},HL=({submissions:e})=>{const n=e.filter(a=>a.status==="approved").length,r=n>=2;return s.jsxs("div",{className:"relative mt-3 space-y-2",children:[r&&s.jsx("p",{className:"text-green-400 text-xs font-black",children:"🎉 CHALLENGE COMPLETE! $25 earned!"}),s.jsxs("div",{className:"flex items-center gap-3",children:[[1,2].map(a=>{const i=e[a-1],o=(i==null?void 0:i.status)==="approved",l=(i==null?void 0:i.status)==="pending";return s.jsx("div",{className:"flex-1",children:i!=null&&i.proof_image_url?s.jsxs("div",{className:`relative rounded-lg overflow-hidden border-2 ${o?"border-green-500":l?"border-yellow-500":"border-red-500"}`,children:[s.jsx("img",{src:i.proof_image_url,alt:`Snap #${a}`,className:"w-full h-16 object-cover"}),s.jsx("div",{className:"absolute bottom-0 inset-x-0 bg-black/70 text-center py-0.5",children:s.jsx("span",{className:`text-[9px] font-black ${o?"text-green-400":l?"text-yellow-400":"text-red-400"}`,children:o?"✅ APPROVED":l?"⏳ PENDING":"❌ REJECTED"})})]}):s.jsxs("div",{className:"flex items-center justify-center gap-1.5 bg-neutral-800/60 rounded-lg px-3 py-3 border border-cyan-500/20",children:[s.jsx(Qa,{className:"w-3.5 h-3.5 text-cyan-400/50"}),s.jsxs("span",{className:"text-[11px] text-neutral-500 font-bold",children:["#",a]})]})},a)}),s.jsxs("span",{className:"text-[10px] text-cyan-400/60 font-bold",children:[n,"/2"]})]})]})},GL=({challenge:e,submission:t})=>{const n=e.theme||"cyan",r=bo[n]||bo.cyan,a=e.target_minutes||60,i=`${e.slug}_minutes`,o=`${e.slug}_started`;h.useEffect(()=>{go(i),go(o)},[i,o]);const[l,c]=h.useState(()=>
521parseInt(localStorage.getItem(i)||"0",10)),[d,u]=h.useState(()=>localStorage.getItem(o)==="true");if(h.useEffect(()=>{const m=setInterval(()=>{c(parseInt(localStorage.getItem(i)||"0",10)),u(localStorage.getItem(o)==="true")},3e3);return()=>clearInterval(m)},[i,o]),t){const m=cx[t.status];return s.jsxs("div",{className:"relative mt-3",children:[s.jsx("div",{className:"w-full h-3 bg-neutral-800 rounded-full overflow-hidden",children:s.jsx("div",{className:`h-full bg-gradient-to-r ${n==="emerald"?"from-emerald-500 to-green-400":n==="rose"?"from-rose-500 to-pink-400":"from-cyan-500 to-blue-400"} rounded-full`,style:{width:"100%"}})}),m&&s.jsxs("div",{className:`flex items-center gap-2 mt-3 ${m.color}`,children:[s.jsx(m.icon,{className:"w-4 h-4"}),s.jsx("span",{className:"text-xs font-black",children:m.label})]}),t.status==="approved"&&s.jsxs("p",{className:"text-green-400 text-xs font-bold mt-2",children:["✅ Reward earned: ",e.reward_type==="cash"?`$${e.reward_amount}`:`${e.reward_amount} min`]})]})}if(!d)return s.jsx("button",{onClick:()=>{localStorage.setItem(o,"true"),Sd(o),Sd(i),u(!0),B.success(`${e.title} activated!`,{description:"Your call timer will track automatically."})},className:`relative w-full mt-4 bg-white/10 hover:bg-white/15 border border-white/20 ${r.accentText} font-black text-sm py-2.5 rounded-full transition-colors active:scale-[0.97] flex items-center justify-center gap-2`,children:"⚡ START CHALLENGE"});const f=Math.min(100,l/a*100);return s.jsxs("div",{className:"relative mt-3",children:[s.jsxs("div",{className:"flex justify-between text-[10px] text-neutral-500 font-bold mb-1",children:[s.jsxs("span",{children:[l," min"]}),s.jsxs("span",{children:[a," min"]})]}),s.jsx("div",{className:"w-full h-3 bg-neutral-800 rounded-full overflow-hidden",children:s.jsx("div",{className:`h-full bg-gradient-to-r ${n==="emerald"?"from-emerald-500 to-green-400":n==="rose"?"from-rose-500 to-pink-400":"from-cyan-500 to-blue-400"} rounded-full transition-all`,style:{width:`${f}%`}})}),s.jsxs("div",{className:`mt-2 flex items-center gap-1.5 text-[11px] font-bold ${r.accentText} opacity-70`,children:[s.jsx("span",{className:"text-base",children:"⚡"})," Auto-tracking — stay on a call for ",a," min!"]})]})},KL=({challenge:e,submission:t})=>{var m;const n=e.theme||"amber",r=bo[n]||bo.amber;let a=20;try{const p=JSON.parse(e.auto_track_action||"null");a=(p==null?void 0:p.target)||20}catch{}const i=e.target_minutes||30;if(t){const p=cx[t.status];return s.jsxs("div",{className:"relative mt-3",children:[s.jsx("div",{className:"w-full h-3 bg-neutral-800 rounded-full overflow-hidden",children:s.jsx("div",{className:"h-full bg-gradient-to-r from-amber-500 to-yellow-400 rounded-full",style:{width:"100%"}})}),p&&s.jsxs("div",{className:`flex items-center gap-2 mt-3 ${p.color}`,children:[s.jsx(p.icon,{className:"w-4 h-4"}),s.jsx("span",{className:"text-xs font-black",children:p.label})]}),t.status==="approved"&&s.jsxs("p",{className:"text-green-400 text-xs font-bold mt-2",children:["✅ Reward earned: ",e.reward_type==="cash"?`$${e.reward_amount}`:`${e.reward_amount} min`]})]})}const o=`speed_connect_${e.slug}`,l=localStorage.getItem(o);let c=!1,d=0,u="";if(l)try{const p=JSON.parse(l),v=(Date.now()-p.startTime)/1e3/60;if(v<i){c=!0,d=((m=p.partners)==null?void 0:m.length)||0;const g=Math.ceil(i*60-v*60),y=Math.floor(g/60),b=g%60;u=`${y}:${String(b).padStart(2,"0")}`}}catch{}const f=Math.min(100,d/a*100);return s.jsxs("div",{className:"relative mt-3",children:[c?s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"flex justify-between text-[10px] text-neutral-500 font-bold mb-1",children:[s.jsxs("span",{children:[d,"/",a," people"]}),s.jsxs("span",{children:["⏱️ ",u]})]}),s.jsx("div",{className:"w-full h-3 bg-neutral-800 rounded-full overflow-hidden",children:s.jsx("div",{className:"h-full bg-gradient-to-r from-amber-500 to-yellow-400 rounded-full transition-all",style:{width:`${f}%`}})}),s.jsxs("div",{className:`mt-2 flex items-center gap-1.5 text-[11px] font-bold ${r.accentText} opacity-70`,children:[s.jsx("span",{className:"text-base",children:"⚡"})," Auto-tracking — keep connecting!"]})]}):s.jsxs("div",{className:`mt-2 flex items-center gap-1.5 text-[11px] font-bold ${r.accentText} opacity-70`,children:[s.jsx("span",{className:"text-base",children:"⚡"})," Go to video call and tap START to begin!"]}),s.jsxs("p",{className:"text-[10px] text-neutral-600 mt-1",children:["Connect to ",a," unique people within ",i," min"]})]})},YL=({onClose:e})=>{const{user:t}=it(),n=sn(),r=wt(),[a,i]=h.useState(null),[o,l]=h.useState(""),[c,d]=h.useState(!1),[u,f]=h.useState(!1),[m,p]=h.useState(null),[v,g]=h.useState(""),[y,b]=h.useState(!1),{data:x}=he({queryKey:["member_gender_challenges",t==null?void 0:t.id],enabled:!!t,queryFn:async()=>{const{data:P}=await S.from("members").select("gender").eq("id",t.id).maybeSingle();return(P==null?void 0:P.gender)??null}}),w=(x==null?void 0:x.toLowerCase())==="female",{data:_=[]}=he({queryKey:["weekly_challenges_page"],queryFn:async()=>{const{data:P}=await S.from("weekly_challenges").select("*").eq("is_active",!0).order("created_at",{ascending:!0});return P||[]}}),j=_.filter(P=>!P.female_only||w),N=ex(),{data:k=[]}=he({queryKey:["my_challenge_submissions",t==null?void 0:t.id,N],enabled:!!t,queryFn:async()=>{const{data:P}=await S.from("challenge_submissions").select("*").eq("user_id",t.id).gte("created_at",`${N}T00:00:00Z`).order("created_at",{ascending:!1});return P||[]}}),C=P=>k.find(T=>T.challenge_id===P),A=async P=>{if(!t||!o.trim()){B.error("Please provide proof text");return}const{error:T}=await S.from("challenge_submissions").insert({user_id:t.id,challenge_id:P.id,proof_text:o.trim(),status:"pending"});if(T){B.error("Failed to submit",{description:T.message});return}B.success("Challenge submitted for review!"),i(null),l(""),r.invalidateQueries({queryKey:["my_challenge_submissions"]})},I=async P=>{if(!t||!v.trim()){B.error("Please describe your issue");return}b(!0);const{error:T}=await S.from("challenge_issues").insert({user_id:t.id,challenge_id:P,message:v.trim()});if(b(!1),T){B.error("Failed to submit issue");return}B.success("Issue reported! We'll look into it."),p(null),g("")},O=P=>P.reward_type==="cash"?`$${P.reward_amount}`:P.reward_type==="minutes"?`${P.reward_amount} min`:`${P.reward_amount||7} days freeze-free`;return s.jsxs("div",{className:"min-h-screen bg-black text-white font-['Antigone',sans-serif] flex flex-col items-center px-4 pb-8",children:[s.jsx("div",{className:"w-full flex items-center pt-3 pb-2",children:s.jsxs("button",{onClick:e,className:"flex items-center gap-1 hover:opacity-80 transition-opacity active:scale-[0.97]",children:[s.jsx(Rn,{className:"w-7 h-7"}),s.jsx("span",{className:"font-black text-sm tracking-wider",children:"BACK"})]})}),s.jsx("h1",{className:"text-3xl font-black tracking-wide mt-2 mb-1",children:"WEEKLY CHALLENGES"}),s.jsx("p",{className:"text-neutral-400 text-sm mb-6 text-center max-w-sm",children:"Quality over quantity — complete challenges, earn real cash & rewards."}
521),s.jsx("div",{className:"w-full max-w-md space-y-5",children:j.map(P=>{const T=C(P.id),E=T?cx[T.status]:null,W=P.theme||"cyan",V=bo[W]||bo.cyan,q=VL[W]||["🎯","⭐","🔥"],D=V.icon,$=P.slug==="bestie-challenge",z=P.slug==="blue-eyes-hunt",R=P.slug==="marathon-talk",U=(()=>{try{const xe=JSON.parse(P.auto_track_action||"null");return(xe==null?void 0:xe.type)==="auto_speed_connect"}catch{return!1}})(),ee=P.challenge_type==="auto"&&P.target_minutes&&!U,ae=P.challenge_type==="manual"&&!z&&!$;return s.jsxs("div",{className:`relative overflow-visible bg-gradient-to-br ${V.gradient} ${V.border} border rounded-2xl p-5 ${V.glow}`,children:[$&&s.jsx("img",{src:FL,alt:"Besties taking a selfie",className:"absolute -right-4 -top-10 w-20 sm:w-32 h-auto z-10 drop-shadow-[0_4px_12px_rgba(217,70,239,0.5)] rotate-[4deg] pointer-events-none select-none"}),z&&s.jsx("img",{src:UL,alt:"Blue eye close-up",className:"absolute -right-3 -top-8 w-16 sm:w-24 h-auto z-10 rounded-xl border-2 border-cyan-400/50 drop-shadow-[0_4px_16px_rgba(34,211,238,0.5)] rotate-[5deg] pointer-events-none select-none animate-[scale-pulse_3s_ease-in-out_infinite] object-cover"}),R&&s.jsx("div",{className:"absolute -top-4 right-4 sm:right-8 pointer-events-none select-none z-10 w-20 h-16 overflow-visible",children:[{x:0,delay:0,size:"text-[10px]"},{x:14,delay:.5,size:"text-xs"},{x:-8,delay:1.1,size:"text-[9px]"},{x:22,delay:1.7,size:"text-[11px]"},{x:6,delay:.3,size:"text-[10px]"},{x:-4,delay:2,size:"text-xs"},{x:18,delay:.8,size:"text-[9px]"},{x:10,delay:1.4,size:"text-[10px]"}].map((xe,te)=>s.jsx("span",{className:`absolute font-black ${xe.size} text-emerald-400/80 italic tracking-tight animate-[yap-rise_2.5s_ease-out_infinite]`,style:{left:`${xe.x+10}px`,bottom:0,animationDelay:`${xe.delay}s`},children:"yap"},te))}),q.map((xe,te)=>s.jsx("span",{className:"absolute text-xl pointer-events-none select-none z-10 animate-[emoji-float_3s_ease-in-out_infinite]",style:{right:`${12+te*28}px`,bottom:`${10+te*14}px`,animationDelay:`${te*.7}s`},children:xe},te)),s.jsx("div",{className:"absolute inset-0 bg-[linear-gradient(120deg,transparent_30%,var(--shimmer)_50%,transparent_70%)] bg-[length:200%_100%] animate-[shimmer-bg_3s_ease-in-out_infinite]",style:{"--shimmer":V.shimmer}}),s.jsxs("div",{className:"relative flex items-start justify-between mb-2",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:"p-2 bg-white/5 rounded-xl border border-white/10",children:s.jsx(D,{className:`w-5 h-5 ${V.accentText} drop-shadow-[0_0_8px_currentColor]`})}),s.jsxs("div",{children:[s.jsx("h3",{className:"font-black text-lg leading-tight tracking-wide",children:P.title}),P.description&&s.jsx("p",{className:`text-xs font-bold ${V.accentText} opacity-80`,children:P.description.slice(0,40)})]})]}),P.female_only&&s.jsx("span",{className:"text-[10px] font-black px-2 py-0.5 rounded-full bg-pink-500/20 text-pink-400",children:"♀ ONLY"})]}),P.description&&s.jsx("p",{className:"relative text-neutral-300 text-sm leading-relaxed mb-3",children:P.description}),s.jsx("div",{className:"relative flex items-center gap-3 mb-1",children:s.jsxs("div",{className:"flex items-baseline gap-1",children:[s.jsx(ds,{className:`w-4 h-4 ${V.accentText}`}),s.jsx("span",{className:`text-2xl font-black ${V.accentText} drop-shadow-[0_0_12px_currentColor]`,children:O(P)})]})}),$&&s.jsx(WL,{}),z&&(()=>{go("blue_eyes_hunt_started");const xe=localStorage.getItem("blue_eyes_hunt_started")==="true",te=k.filter(ce=>ce.challenge_id===P.id);return xe||te.length>0?s.jsxs(s.Fragment,{children:[s.jsx(HL,{submissions:te}),s.jsxs("div",{className:"relative mt-2 flex items-center gap-1.5 text-[11px] font-bold text-cyan-400/70",children:[s.jsx("span",{className:"text-base",children:"📸"})," Snap button is active during calls!"]})]}):s.jsx("button",{onClick:()=>{localStorage.setItem("blue_eyes_hunt_started","true"),Sd("blue_eyes_hunt_started"),B.success("👁️ Blue Eyes Hunt activated!",{description:"The snap button will appear during your next call."}),i(ce=>ce==="__force"?"":"__force"),setTimeout(()=>i(""),50)},className:"relative w-full mt-4 bg-cyan-500/20 hover:bg-cyan-500/30 border border-cyan-400/40 text-cyan-200 font-black text-sm py-2.5 rounded-full transition-colors active:scale-[0.97] flex items-center justify-center gap-2 shadow-[0_0_15px_rgba(34,211,238,0.2)
521]",children:"👁️ START HUNT"})})(),U&&s.jsx(KL,{challenge:P,submission:T}),ee&&!$&&!z&&s.jsx(GL,{challenge:P,submission:T}),ae&&T&&E&&s.jsxs("div",{className:`relative flex items-center gap-2 mt-3 ${E.color}`,children:[s.jsx(E.icon,{className:"w-4 h-4"}),s.jsx("span",{className:"text-xs font-black",children:E.label})]}),ae&&(T==null?void 0:T.status)==="approved"&&s.jsxs("p",{className:"relative text-green-400 text-xs font-bold mt-2",children:["✅ Reward earned: ",O(P)]}),ae&&(T==null?void 0:T.status)==="rejected"&&s.jsx("p",{className:"relative text-red-400/80 text-xs font-bold mt-1",children:"You can try again next week."}),ae&&!T&&a!==P.slug&&s.jsxs("button",{onClick:()=>i(P.slug),className:"relative w-full mt-4 bg-white/10 hover:bg-white/15 border border-white/20 text-white font-black text-sm py-2.5 rounded-full transition-colors active:scale-[0.97] flex items-center justify-center gap-2",children:[s.jsx(T4,{className:"w-4 h-4"})," SUBMIT PROOF"]}),P.challenge_type==="auto"&&!P.target_minutes&&!$&&!z&&!T&&s.jsxs("div",{className:"relative mt-3 flex items-center gap-1.5 text-[11px] font-bold text-neutral-500",children:[s.jsx("span",{className:"text-base",children:"⚡"})," Auto-tracked — just start a call!"]}),a===P.slug&&s.jsxs("div",{className:"relative space-y-3 mt-4",children:[s.jsx("textarea",{value:o,onChange:xe=>l(xe.target.value),placeholder:"Describe your proof or paste a link...",className:"w-full bg-black/30 border border-white/15 rounded-lg px-3 py-2 text-sm text-white placeholder:text-neutral-600 resize-none focus:outline-none focus:border-white/30",rows:3}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx("button",{onClick:()=>A(P),className:"flex-1 bg-white/15 hover:bg-white/20 border border-white/20 text-white font-black text-sm py-2 rounded-full transition-colors active:scale-[0.97]",children:"SUBMIT"}),s.jsx("button",{onClick:()=>{i(null),l("")},className:"px-4 bg-neutral-800/60 text-neutral-400 font-bold text-sm py-2 rounded-full hover:opacity-90 active:scale-[0.97]",children:"CANCEL"})]})]}),s.jsx("div",{className:"relative mt-3 border-t border-white/10 pt-3",children:m===P.id?s.jsxs("div",{className:"space-y-2",children:[s.jsx("textarea",{value:v,onChange:xe=>g(xe.target.value),placeholder:"Describe the issue you're having...",className:"w-full bg-black/30 border border-white/15 rounded-lg px-3 py-2 text-sm text-white placeholder:text-neutral-600 resize-none focus:outline-none focus:border-white/30",rows:3}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx("button",{onClick:()=>I(P.id),disabled:y,className:"flex-1 bg-amber-500/20 hover:bg-amber-500/30 border border-amber-400/40 text-amber-200 font-bold text-xs py-2 rounded-full transition-colors active:scale-[0.97]",children:y?"SENDING...":"SEND REPORT"}),s.jsx("button",{onClick:()=>{p(null),g("")},className:"px-4 bg-neutral-800/60 text-neutral-400 font-bold text-xs py-2 rounded-full hover:opacity-90 active:scale-[0.97]",children:"CANCEL"})]})]}):s.jsxs("button",{onClick:()=>p(P.id),className:"flex items-center gap-1.5 text-[11px] text-neutral-500 hover:text-amber-400 font-bold transition-colors",children:[s.jsx(Co,{className:"w-3.5 h-3.5"})," Run into an issue?"]})})]},P.id)})}),s.jsx("div",{className:"w-full max-w-md mt-5",children:s.jsxs("button",{onClick:()=>f(!0),className:"w-full relative overflow-hidden bg-gradient-to-br from-yellow-600/25 via-amber-700/20 to-orange-900/30 border border-yellow-500/40 rounded-2xl p-5 shadow-[0_0_24px_rgba(234,179,8,0.25)] active:scale-[0.97] transition-transform text-left",children:[s.jsx("div",{className:"absolute inset-0 bg-[linear-gradient(120deg,transparent_30%,rgba(234,179,8,0.08)_50%,transparent_70%)] bg-[length:200%_100%] animate-[shimmer-bg_3s_ease-in-out_infinite] pointer-events-none"}),s.jsxs("div",{className:"relative flex items-center gap-4",children:[s.jsx("div",{className:"text-4xl",children:"🎰"}),s.jsxs("div",{className:"flex-1",children:[s.jsx("h3",{className:"font-black text-lg tracking-wide text-transparent bg-clip-text bg-gradient-to-r from-yellow-300 to-amber-500",children:"CHALLENGE MINUTES"}),s.jsx("p",{className:"text-xs text-neutral-400 mt-0.5",children:"Wager earned minutes for a chance to win up to $200 cash!"}),s.jsxs("div",{className:"flex items-center gap-3 mt-2",children:[s.jsx("span",{className:"text-[10px] font-bold bg-yellow-500/20 text-yellow-400 px-2 py-0.5 rounded-full",children:"🔥 2x MINUTES"}),s.jsx("span",{className:"text-[10px] font-bold bg-emerald-500/20 text-emerald-400 px-2 py-0.5 rounded-full",children:"💵 CASH"}),s.jsx("span",{className:"text-[10px] font-bold bg-red-500/20 text-red-400 px-2 py-0.5 rounded-full",children:"💀 RISK"})]})]}),s.jsxs("div",{className:"text-right shrink-0",children:[s.jsx("span",{className:"text-2xl font-black text-yellow-300 drop-shadow-[0_0_12px_rgba(234,179,8,0.5)]",children:"$200"}),s.jsx("span",{className:"block text-[9px] font-bold text-yellow-500/60 tracking-widest",children:"JACKPOT"})]})]})]})}),s.jsxs("div",{className:"w-full max-w-md mt-8 space-y-3",children:[s.jsx("p",{className:"text-center text-neutral-500 text-[10px] font-bold uppercase tracking-widest",children:"Redeem Your Earnings"}),s.jsxs("div",{className:"flex gap-3",children:[s.jsxs("button",{onClick:()=>d(!0),className:"flex-1 relative overflow-hidden bg-gradient-to-br from-emerald-500/25 via-green-600/20 to-teal-500/25 border border-emerald-400/40 rounded-2xl py-4 px-4 shadow-[0_0_20px_rgba(52,211,153,0.2)] active:scale-[0.97] transition-transform",children:[s.jsx("div",{className:"absolute inset-0 bg-[linear-gradient(120deg,transparent_30%,rgba(52,211,153,0.08)_50%,transparent_70%)] bg-[length:200%_100%] animate-[shimmer-bg_3s_ease-in-out_infinite]"}),s.jsxs("div",{className:"relative flex flex-col items-center gap-1.5",children:[s.jsx($t,{className:"w-6 h-6 text-emerald-300 drop-shadow-[0_0_8px_rgba(52,211,153,0.6)]"}),s.jsx("span",{className:"font-black text-emerald-200 tracking-wider text-xs drop-shadow-[0_0_8px_rgba(52,211,153,0.5)]",children:"CASH OUT"}),s.jsx("span",{className:"text-[10px] text-emerald-400/60 font-bold",children:"via PayPal"})]})]}),s.jsxs("button",{onClick:()=>n("/store"),className:"flex-1 relative overflow-hidden bg-gradient-to-br from-amber-500/25 via-yellow-600/20 to-orange-500/25 border border-amber-400/40 rounded-2xl py-4 px-4 shadow-[0_0_20px_rgba(245,158,11,0.2)] active:scale-[0.97] transition-transform",children:[s.jsx("div",{className:"absolute inset-0 bg-[linear-gradient(120deg,transparent_30%,rgba(245,158,11,0.08)_50%,transparent_70%)] bg-[length:200%_100%] animate-[shimmer-bg_3s_ease-in-out_infinite]"}),s.jsxs("div",{className:"relative flex flex-col items-center gap-1.5",children:[s.jsx(ds,{className:"w-6 h-6 text-amber-300 drop-shadow-[0_0_8px_rgba(245,158,11,0.6)]"}),s.jsx("span",{className:"font-black text-amber-200 tracking-wider text-xs drop-shadow-[0_0_8px_rgba(245,158,11,0.5)]",children:"REWARDS"}),s.jsx("span",{className:"text-[10px] text-amber-400/60 font-bold",children:"Browse Store"})]})]})]})]}),s.jsx(qL,{}),c&&s.jsx(zL,{onClose:()=>d(!1),onSuccess:()=>{r.invalidateQueries({queryKey:["my_challenge_submissions"]})}}),u&&s.jsx(Bj,{onClose:()=>f(!1)})]})},QL=({userId:e,onClose:t})=>{const[n,r]=h.useState([]),[a,i]=h.useState(new Set),[o,l]=h.useState(!0),[c,d]=h.useState(null);h.useEffect(()=>{(async()=>
521{l(!0);const{data:p}=await S.from("topic_categories").select("id, name").eq("status","active").order("name"),{data:v}=await S.from("topics").select("id, name, category_id").eq("status","active").order("name"),{data:g}=await S.from("pinned_topics").select("topic_id").eq("user_id",e),y=(p||[]).map(b=>({id:b.id,name:b.name,topics:(v||[]).filter(x=>x.category_id===b.id)}));r(y),i(new Set((g||[]).map(b=>b.topic_id))),l(!1)})()},[e]);const u=async m=>{if(a.has(m)){const{error:v}=await S.from("pinned_topics").delete().eq("user_id",e).eq("topic_id",m);if(v){B.error("Failed to unpin topic");return}i(g=>{const y=new Set(g);return y.delete(m),y})}else{const{error:v}=await S.from("pinned_topics").insert({user_id:e,topic_id:m});if(v){B.error("Failed to pin topic");return}i(g=>new Set(g).add(m))}},f=n.find(m=>m.id===c);return s.jsxs("div",{className:"fixed inset-0 z-50 bg-black flex flex-col overflow-hidden",children:[s.jsxs("div",{className:"relative px-4 pt-4 pb-3",children:[s.jsx("button",{onClick:t,className:"absolute top-3 left-3 z-10",children:s.jsx(We,{className:"w-7 h-7 text-red-500"})}),s.jsxs("div",{className:"text-center",children:[s.jsx("h1",{className:"text-2xl font-black text-white tracking-tight",children:"Pin Topics"}),s.jsxs("p",{className:"text-sm text-neutral-400 mt-1 leading-tight",children:["Encounter less skips &",s.jsx("br",{}),"less boring chats when topics are pinned!"]})]})]}),o?s.jsx("div",{className:"flex-1 flex items-center justify-center",children:s.jsx("div",{className:"w-8 h-8 border-4 border-white/30 border-t-white rounded-full animate-spin"})}):c?s.jsxs("div",{className:"flex-1 flex flex-col px-6 pt-2 overflow-y-auto",children:[s.jsx("button",{onClick:()=>d(null),className:"text-neutral-400 text-sm mb-4 flex items-center gap-1 hover:text-white transition-colors",children:"← Back to categories"}),s.jsx("h2",{className:"text-white font-black text-xl mb-4",children:f==null?void 0:f.name}),s.jsxs("div",{className:"space-y-2",children:[f==null?void 0:f.topics.map(m=>{const p=a.has(m.id);return s.jsxs("button",{onClick:()=>u(m.id),className:`w-full text-left rounded-xl px-5 py-4 transition-colors border ${p?"bg-red-900/30 border-red-700 text-white":"bg-neutral-900 border-neutral-700 text-neutral-300 hover:bg-neutral-800"}`,children:[s.jsx("span",{className:"font-bold",children:m.name}),p&&s.jsx("span",{className:"ml-2",children:"📌"})]},m.id)}),(f==null?void 0:f.topics.length)===0&&s.jsx("p",{className:"text-neutral-500 text-sm text-center py-8",children:"No topics in this category yet."})]})]}):s.jsx("div",{className:"flex-1 flex flex-col items-center px-6 pt-4",children:s.jsx("div",{className:"w-full space-y-2",children:n.map(m=>s.jsxs("button",{onClick:()=>d(m.id),className:"w-full text-left bg-neutral-900 border border-neutral-700 rounded-xl px-5 py-4 hover:bg-neutral-800 transition-colors",children:[s.jsx("span",{className:"text-white font-black text-lg",children:m.name}),m.topics.some(p=>a.has(p.id))&&s.jsx("span",{className:"ml-2 text-red-400 text-sm",children:"📌"})]},m.id))})}),s.jsx("div",{className:"py-4 text-center",children:s.jsx("span",{className:"text-white font-black text-lg tracking-wide",children:"Rules"})})]})},dl=h.forwardRef(({className:e,type:t,...n},r)=>s.jsx("input",{type:t,className:Ct("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:r,...n}));dl.displayName="Input";const JN=h.forwardRef(({className:e,...t},n)=>s.jsx("textarea",{className:Ct("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm r
521ing-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:n,...t}));JN.displayName="Textarea";const _y={common:{bg:"bg-neutral-700",border:"border-neutral-600"},rare:{bg:"bg-blue-600",border:"border-blue-500"},legendary:{bg:"bg-amber-500",border:"border-amber-400"}},JL=({userId:e,onBack:t,onClaimed:n})=>{const[r,a]=h.useState([]),[i,o]=h.useState(!0),[l,c]=h.useState(null),[d,u]=h.useState("browse"),[f,m]=h.useState(!1),[p,v]=h.useState(!1),[g,y]=h.useState({firstName:"",lastName:"",country:"",address:"",city:"",state:"",zip:"",notes:""}),b=(j,N)=>y(k=>({...k,[j]:N}));h.useEffect(()=>{(async()=>{const[{data:N},{data:k}]=await Promise.all([S.from("rewards").select("id, title, image_url, rarity, delivery, shipping_fee, minutes_cost, brief").eq("visible",!0).eq("rarity","common").order("minutes_cost"),S.from("member_minutes").select("is_vip, vip_tier").eq("user_id",e).maybeSingle()]);a(N??[]),v((k==null?void 0:k.is_vip)===!0&&(k==null?void 0:k.vip_tier)==="premium"),o(!1)})()},[e]);const x=j=>{c(j),j.delivery==="digital"?w(j,null):u("shipping")},w=async(j,N)=>{m(!0);try{const{data:k,error:C}=await S.functions.invoke("redeem-reward",{body:{action:"create-free-redemption",rewardId:j.id,shipping:N}});if(C)throw C;if(k!=null&&k.error)throw new Error(k.error);k!=null&&k.requiresPayment&&(k!=null&&k.checkoutUrl)?(B.success("Redirecting to shipping payment..."),window.open(k.checkoutUrl,"_blank")):B.success("🎉 Reward claimed successfully!"),n()}catch(k){B.error(k.message||"Failed to claim reward")}m(!1)},_=l?p?0:Number(l.shipping_fee)||0:0;return d==="shipping"&&l?s.jsxs("div",{className:"min-h-screen bg-[#f5a623] text-black font-['Antigone',sans-serif] flex flex-col overflow-y-auto",children:[s.jsxs("div",{className:"flex items-center gap-3 px-4 py-4",children:[s.jsxs("button",{onClick:()=>{u("browse"),c(null)},className:"flex items-center gap-1 font-black text-sm",children:[s.jsx(Rn,{className:"w-5 h-5"}),"Back"]}),s.jsx("h1",{className:"flex-1 text-2xl font-black text-center pr-10",children:"Shipping Details"})]}),s.jsxs("div",{className:"flex items-center gap-3 px-4 mb-4",children:[s.jsx("div",{className:"w-14 h-14 rounded-xl overflow-hidden bg-black/10 flex-shrink-0",children:l.image_url?s.jsx("img",{src:l.image_url,alt:l.title,className:"w-full h-full object-cover"}):s.jsx("div",{className:"w-full h-full flex items-center justify-center text-2xl",children:"🎁"})}),s.jsxs("div",{children:[s.jsx("p",{className:"font-black text-sm",children:l.title}),s.jsx("p",{className:"text-xs font-bold text-black/60",children:"FREE — Link Clicks Reward"})]})]}),s.jsxs("div",{className:"flex-1 px-4 pb-6 space-y-4",children:[s.jsx("input",{placeholder:"First name",value:g.firstName,onChange:j=>b("firstName",j.target.value),className:"w-full bg-transparent border-2 border-black rounded-xl px-4 py-3 font-bold placeholder:text-black/50 focus:outline-none"}),s.jsx("input",{placeholder:"Last name",value:g.lastName,onChange:j=>b("lastName",j.target.value),className:"w-full bg-transparent border-2 border-black rounded-xl px-4 py-3 font-bold placeholder:text-black/50 focus:outline-none"}),s.jsx("textarea",{placeholder:"Notes",value:g.notes,onChange:j=>b("notes",j.target.value),rows:2,className:"w-full bg-transparent border-2 border-black rounded-xl px-4 py-3 font-bold placeholder:text-black/50 focus:outline-none resize-none"}),s.jsx("h2",{className:"font-black text-lg text-center mt-4",children:"Address"}),s.jsx("input",{placeholder:"Country/Region",value:g.country,onChange:j=>b("country",j.target.value),className:"w-full bg-transparent border-2 border-black rounded-xl px-4 py-3 font-bold placeholder:text-black/50 focus:outline-none"}),s.jsx("textarea",{placeholder:"Address",value:g.address,onChange:j=>b("address",j.target.value),rows:2,className:"w-full bg-transparent border-2 border-black rounded-xl px-4 py-3 font-bold placeholder:text-black/50 focus:outline-none resize-none"}),s.jsx("input",{placeholder:"City",value:g.city,onChange:j=>b("city",j.target.value),className:"w-full bg-transparent border-2 border-black rounded-xl px-4 py-3 font-bold placeholder:text-black/50 focus:outline-none"}),s.jsx("input",{placeholder:"State",value:g.state,onChange:j=>b("state",j.target.value),className:"w-full bg-transparent border-2 border-black rounded-xl px-4 py-3 font-bold placeholder:text-black/50 focus:outline-none"}),s.jsx("input",{placeholder:"Zip",value:g.zip,onChange:j=>b("zip",j.target.value),className:"w-full bg-transparent border-2 border-black rounded-xl px-4 py-3 font-bold placeholder:text-black/50 focus:outline-none"}),s.jsx("div",{className:"pt-4 flex justify-center",children:s.jsx("button",{onClick:()=>
521{if(!g.firstName||!g.lastName||!g.country||!g.address){B.error("Please fill in required fields");return}w(l,g)},disabled:f,className:"bg-green-700 text-white font-black text-xl px-10 py-3 rounded-full hover:bg-green-800 transition-colors disabled:opacity-50",children:f?"Processing...":_>0?`Confirm & Pay $${_.toFixed(2)} Shipping`:"Confirm"})}),_>0&&s.jsxs("p",{className:"text-center text-sm font-bold text-black/70 mt-4 px-4",children:["By clicking confirm you accept responsibility for the shipping fee of approximately $",_.toFixed(2),"."]})]})]}):s.jsxs("div",{className:"min-h-screen bg-black text-white font-['Antigone',sans-serif] p-5 overflow-y-auto",children:[s.jsx("div",{className:"flex items-center justify-between mb-6",children:s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("button",{onClick:t,className:"text-neutral-400 hover:text-white font-bold text-sm",children:"← Back"}),s.jsx("h2",{className:"text-2xl font-black tracking-wide",children:"Pick Your Reward"})]})}),s.jsxs("div",{className:"bg-green-500/10 border border-green-500/30 rounded-2xl p-4 mb-6 text-center",children:[s.jsxs("p",{className:"text-green-400 font-black text-lg flex items-center justify-center gap-2",children:[s.jsx(Ft,{className:"w-5 h-5"})," FREE Reward Unlocked!"]}),s.jsx("p",{className:"text-neutral-400 text-xs mt-1",children:"Choose any reward below — no minutes will be deducted"})]}),i?s.jsx("p",{className:"text-center text-neutral-400 mt-8",children:"Loading rewards..."}):r.length===0?s.jsx("p",{className:"text-center text-neutral-500 mt-8",children:"No rewards available right now."}):s.jsx("div",{className:"grid grid-cols-2 gap-3 max-w-lg mx-auto",children:r.map(j=>{const N=_y[j.rarity]||_y.common;return s.jsxs("button",{onClick:()=>x(j),className:`bg-neutral-900 border ${N.border} rounded-2xl p-3 text-left hover:bg-neutral-800 transition-colors group`,children:[s.jsx("div",{className:"aspect-square rounded-xl overflow-hidden bg-neutral-800 mb-2",children:j.image_url?s.jsx("img",{src:j.image_url,alt:j.title,className:"w-full h-full object-cover group-hover:scale-105 transition-transform"}):s.jsx("div",{className:"w-full h-full flex items-center justify-center text-4xl",children:"🎁"})}),s.jsx("p",{className:"font-bold text-sm truncate",children:j.title}),s.jsxs("div",{className:"flex items-center justify-between mt-1",children:[s.jsx("span",{className:`${N.bg} text-white px-2 py-0.5 rounded text-[10px] font-bold`,children:j.rarity.charAt(0).toUpperCase()+j.rarity.slice(1)}),j.delivery==="digital"?s.jsxs("span",{className:"text-[10px] text-neutral-500 font-bold flex items-center gap-1",children:[s.jsx(Ql,{className:"w-3 h-3"}),"Digital"]}):s.jsxs("span",{className:"text-[10px] text-neutral-500 font-bold flex items-center gap-1",children:[s.jsx(g4,{className:"w-3 h-3"}),"Ships"]})]})]},j.id)})})]})},XL=({userId:e,adPoints:t,onClose:n,onAdPointsChange:r})=>{const[a,i]=h.useState("main"),[o,l]=h.useState(!1),[c,d]=h.useState(!1),[u,f]=h.useState([]),[m,p]=h.useState([]),[v,g]=h.useState(!1),[y,b]=h.useState(null),[x,w]=h.useState(null),[_,j]=h.useState(0),[N,k]=h.useState(0),[C,A]=h.useState(!1),[I,O]=h.useState(0),[P,T]=h.useState(""),[E,W]=h.useState(""),[V,q]=h.useState(""),[D,$]=h.useState("Join Now"),[z,R]=h.useState(0),[U,ee]=h.useState("All Countries"),[ae,xe]=h.useState("All Interests"),[te,ce]=h.useState("Both"),[Re,ye]=h.useState(!1),[fe,ge]=h.useState(null),[J,ue]=h.useState(null);h.useEffect(()=>{S.from("member_minutes").select("is_vip, vip_tier").eq("user_id",e).maybeSingle().then(({data:M})=>{l((M==null?void 0:M.is_vip)??!1),d((M==null?void 0:M.is_vip)===!0&&(M==null?void 0:M.vip_tier)==="premium")}),S.from("members").select("id",{count:"exact",head:!0}).then(({count:M})=>O(M??0))},[e]),h.useEffect(()=>{c&&de()},[c]);const Ee=async()=>{g(!0);const{data:M}=await S.from("promos").select("*").eq("member_id",e).order("created_at",{ascending:!1});f(M??[]),g(!1)},Y=async()=>{g(!0);const{data:M}=await S.from("promo_templates").select("*").eq("user_id",e).order("created_at",{ascending:!1});p(M??[]),g(!1)},Q=async M=>{const{data:Ve}=await S.from("promo_analytics").select("watch_time_seconds, paused, link_clicked").eq("promo_id",M);if(!Ve||Ve.length===0)w({totalViews:0,avgWatchTime:0,pauseRate:0,linkClicks:0});
521else{const Ue=Ve.length,Ze=Math.round(Ve.reduce((lt,on)=>lt+on.watch_time_seconds,0)/Ue),ft=Math.round(Ve.filter(lt=>lt.paused).length/Ue*100),Rt=Ve.filter(lt=>lt.link_clicked).length;w({totalViews:Ue,avgWatchTime:Ze,pauseRate:ft,linkClicks:Rt})}b(M),i("analytics")},le=200,de=h.useCallback(async()=>{const{data:M}=await S.from("promos").select("id").eq("member_id",e);if(!M||M.length===0){j(0);return}const Ve=M.map(ft=>ft.id),{data:Ue}=await S.from("promo_analytics").select("id").in("promo_id",Ve).eq("link_clicked",!0);j((Ue==null?void 0:Ue.length)??0);const{data:Ze}=await S.from("member_redemptions").select("id").eq("user_id",e).eq("reward_type","promo_link_clicks");k((Ze==null?void 0:Ze.length)??0)},[e]),me=Math.floor(_/le)-N,Le=()=>{if(me<=0){B.error("Not enough link clicks to claim a reward");return}i("pick-reward")},Ke=M=>{var Ue;const Ve=(Ue=M.target.files)==null?void 0:Ue[0];Ve&&(ge(Ve),ue(URL.createObjectURL(Ve)))},Qe=()=>{T(""),W(""),q(""),$("Join Now"),R(0),ee("All Countries"),xe("All Interests"),ce("Both"),ye(!1),ge(null),ue(null)},tt=async()=>{if(z>t){B.error("Not enough Ad Points");return}let M=null;if(fe&&o){const Ue=fe.name.split(".").pop(),Ze=`${e}/${crypto.randomUUID()}.${Ue}`,{error:ft}=await S.storage.from("promo-images").upload(Ze,fe);if(ft){B.error("Image upload failed");return}const{data:Rt}=S.storage.from("promo-images").getPublicUrl(Ze);M=Rt.publicUrl}const{error:Ve}=await S.from("promos").insert({title:P||"Untitled Promo",description:E||null,url:c&&V||null,url_text:c?D:null,image_thumb_url:M,member_id:e,gender:o?te:"Both",country:U,interest:ae,sameuser:Re,ad_points_balance:z,status:"Active",is_active:!0,promo_type:"user"});if(Ve){B.error("Failed to create promo");return}z>0&&(await S.functions.invoke("earn-minutes",{body:{type:"spend_ad_points",userId:e,points:z}}),r()),B.success("Promo created!"),Qe(),i("main")},an=async()=>{await S.from("promo_templates").insert({user_id:e,title:P||null,description:E||null,url:V||null,url_text:D,country:U,interest:ae,gender:te,sameuser:Re,ad_points_balance:z}),B.success("Template saved!")},Wt=M=>{T(M.title||""),W(M.description||""),q(M.url||""),$(M.url_text||"Join Now"),R(M.ad_points_balance||0),ee(M.country||"All Countries"),xe(M.interest||"All Interests"),ce(M.gender||"Both"),ye(M.sameuser||!1),i("create")},De=async M=>{await S.from("promos").update({is_active:!M.is_active}).eq("id",M.id),Ee()},pe=async M=>{await S.from("promos").delete().eq("id",M),B.success("Promo deleted"),Ee()},Qt=Math.max(0,z),nt=({title:M,backTo:Ve})=>s.jsxs("div",{className:"flex items-center justify-between mb-6",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[Ve&&s.jsx("button",{onClick:()=>{i(Ve),Ve==="my-promos"&&Ee()},className:"text-neutral-400 hover:text-white font-bold text-sm",children:"← Back"}),s.jsx("h2",{className:"text-2xl font-black tracking-wide",children:M})]}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsxs("div",{className:"text-right",children:[s.jsx("span",{className:"text-2xl font-black text-yellow-400",children:t}),s.jsx("p",{className:"text-[10px] font-bold text-neutral-400",children:"Ad Points"})]}),s.jsx("button",{onClick:n,className:"p-1.5 hover:bg-neutral-800 rounded-full transition-colors",children:s.jsx(We,{className:"w-6 h-6"})})]})]});if(a==="main")return s.jsxs("div",{className:"min-h-screen bg-black text-white font-['Antigone',sans-serif] p-5 overflow-y-auto",children:[s.jsx(nt,{title:"My Promo Ads"}),c&&s.jsxs("div",{className:"bg-neutral-900 border border-neutral-700 rounded-2xl p-5 mb-6 text-center",children:[s.jsx("p",{className:"text-sm font-black text-neutral-300 mb-1",children:"YOU HAVE TOTAL"}),s.jsxs("p",{className:"text-4xl font-black text-green-500",children:[_," ",s.jsx("span",{className:"text-lg text-neutral-300",children:"LINK CLICKS"})]}),s.jsxs("p",{className:"text-sm mt-2",children:[s.jsxs("span",{className:"text-red-500 font-black",children:[le," Link Clicks Required"]}),s.jsx("span",{className:"font-black text-white",children:" from your Promos for a reward of your choice!"})]}),s.jsxs("button",{onClick:()=>
521{de(),i("link-clicks")},className:"mt-3 bg-neutral-800 hover:bg-neutral-700 border border-neutral-600 text-white font-black px-6 py-2 rounded-full text-sm transition-colors inline-flex items-center gap-2",children:[s.jsx(Yl,{className:"w-4 h-4"}),"View Link Clicks Details"]})]}),s.jsxs("div",{className:"flex flex-col items-center gap-4",children:[s.jsx("button",{onClick:()=>{Qe(),i("create")},className:"bg-neutral-800 hover:bg-neutral-700 border border-neutral-600 text-white font-black text-lg px-8 py-3 rounded-lg w-72 transition-colors",children:"Create New Promo"}),s.jsx("button",{onClick:()=>{Y(),i("templates")},className:"bg-neutral-800 hover:bg-neutral-700 border border-neutral-600 text-white font-black text-lg px-8 py-3 rounded-lg w-72 transition-colors",children:"Use Saved Templates"}),s.jsx("h3",{className:"text-xl font-black mt-4 text-neutral-300",children:"Created Promos"}),s.jsx("button",{onClick:()=>{Ee(),i("my-promos")},className:"bg-neutral-800 hover:bg-neutral-700 border border-neutral-600 text-white font-black text-lg px-8 py-3 rounded-lg w-72 transition-colors",children:"Show My Promos"}),s.jsx("button",{className:"bg-yellow-400 hover:bg-yellow-300 text-black font-black text-lg px-8 py-3 rounded-lg w-72 mt-4 transition-colors",children:"Buy Ad Points"})]})]});if(a==="create")return s.jsxs("div",{className:"min-h-screen bg-black text-white font-['Antigone',sans-serif] p-5 overflow-y-auto",children:[s.jsx(nt,{title:"Create Promo",backTo:"main"}),s.jsx("div",{className:"flex justify-center mb-5",children:s.jsx("button",{onClick:()=>{Ee(),i("my-promos")},className:"bg-neutral-800 hover:bg-neutral-700 border border-neutral-600 text-white font-bold px-6 py-2 rounded-lg text-sm transition-colors",children:"Show My Promos"})}),o&&s.jsx("p",{className:"text-center text-sm font-bold text-yellow-400 mb-3",children:"⭐ VIP Member"}),o&&s.jsx("div",{className:"flex justify-center mb-5",children:s.jsxs("label",{className:"bg-neutral-800 border border-neutral-600 rounded-xl w-44 h-32 flex items-center justify-center cursor-pointer overflow-hidden hover:border-neutral-500 transition-colors",children:[J?s.jsx("img",{src:J,alt:"Preview",className:"w-full h-full object-cover"}):s.jsxs("div",{className:"text-neutral-400 text-center",children:[s.jsx(cb,{className:"w-8 h-8 mx-auto mb-1"}),s.jsx("span",{className:"text-sm font-bold",children:"Add Photo"})]}),s.jsx("input",{type:"file",accept:"image/*",className:"hidden",onChange:Ke})]})}),s.jsxs("div",{className:"space-y-4 max-w-md mx-auto",children:[s.jsx(dl,{placeholder:"Promo Title (optional)",value:P,onChange:M=>T(M.target.value),className:"bg-neutral-800 border-neutral-600 text-white placeholder:text-neutral-500 font-bold"}),s.jsx(JN,{placeholder:"Promo brief description (optional)",value:E,onChange:M=>W(M.target.value),className:"bg-neutral-800 border-neutral-600 text-white placeholder:text-neutral-500 font-bold min-h-[80px]"}),s.jsxs("div",{className:"flex gap-3",children:[s.jsxs("div",{className:"flex-1",children:[s.jsxs("p",{className:"text-xs font-bold text-neutral-400 mb-1",children:["Target URL Link ",!c&&"🔒 Premium VIP"]}),s.jsx(dl,{placeholder:"Enter url",value:V,disabled:!c,onChange:M=>q(M.target.value),className:`bg-neutral-800 border-neutral-600 text-white placeholder:text-neutral-500 font-bold ${c?"":"opacity-50 cursor-not-allowed"}`,onClick:()=>{c||B("👑 Premium VIP Feature",{description:"Upgrade to Premium VIP to add clickable links to your promos!"})}})]}),s.jsxs("div",{className:"w-32",children:[s.jsx("p",{className:"text-xs font-bold text-neutral-400 mb-1",children:"CTA Text"}),s.jsx(dl,{value:D,disabled:!c,onChange:M=>$(M.target.value),className:`bg-neutral-800 border-neutral-600 text-white placeholder:text-neutral-500 font-bold ${c?"":"opacity-50 cursor-not-allowed"}`})]})]}),s.jsxs("div",{className:"flex items-center justify-center gap-3 pt-2",children:[s.jsx("span",{className:"font-bold text-neutral-300",children:"Use"}),s.jsx(dl,{type:"number",min:0,max:t,value:z,onChange:M=>R(Math.min(t,Math.max(0,Number(M.target.value)))),className:"bg-neutral-800 border-neutral-600 text-white font-bold w-20 text-center"}),s.jsx("span",{className:"font-bold text-neutral-300",children:"Ad Points"})]}),s.jsxs("p",{className:"text-center text-sm font-bold text-yellow-400",children:["To reach ~",Qt," users"]}),s.jsxs("div",{className:"flex gap-6 justify-center",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-xs font-bold text-neutral-400 text-center mb-1",children:"Country"}),s.jsxs("select",{value:U,onChange:M=>ee(M.target.value),className:"bg-neutral-800 border border-neutral-600 text-white font-bold rounded-lg px-4 py-2 text-sm",children:[s.jsx("option",{children:"All Countries"}),s.jsx("option",{children:"US"}),s.jsx("option",{children:"UK"}),s.jsx("option",{children:"CA"}),s.jsx("option",{children:"AU"})]})]}),s.jsxs("div",{children:[s.jsx("p",{className:"text-xs font-bold text-neutral-400 text-center mb-1",children:"Interest"}),s.jsxs("select",{value:ae,onChange:M=>xe(M.target.value),className:"bg-neutral-800 border border-neutral-600 text-white font-bold rounded-lg px-4 py-2 text-sm",children:[s.jsx("option",{children:"All Interests"}),s.jsx("option",{children:"Gaming"}),s.jsx("option",{children:"Music"}),s.jsx("option",{children:"Sports"}),s.jsx("option",{children:"Tech"})]})]})]}),s.jsxs("div",{className:"text-center pt-2",children:[s.jsxs("p",{className:"text-xs font-bold text-neutral-400 mb-2",children:["Gender Targeting ",!o&&"🔒"]}),s.jsx("div",{className:"flex justify-center gap-2",children:["Male","Female","Both"].map(M=>s.jsx("button",{onClick:()=>
521{if(!o){B("🚀 VIP Feature",{description:"Upgrade to VIP to target promos by gender!"});return}ce(M)},className:`px-5 py-1.5 rounded-lg font-bold text-sm transition-colors ${te===M?"bg-white text-black":"bg-neutral-800 border border-neutral-600 text-neutral-300 hover:bg-neutral-700"} ${!o&&M!=="Both"?"opacity-50":""}`,children:M},M))})]}),s.jsx("div",{className:"text-center pt-1",children:s.jsxs("select",{value:Re?"multiple":"once",onChange:M=>ye(M.target.value==="multiple"),className:"bg-neutral-800 border border-neutral-600 text-white font-bold rounded-lg px-4 py-2.5 text-sm w-72",children:[s.jsx("option",{value:"multiple",children:"Show promo to same user (more than once)"}),s.jsx("option",{value:"once",children:"Show promo only once to a user"})]})}),s.jsxs("div",{className:"flex items-center justify-center gap-3 pt-4",children:[s.jsx("button",{onClick:tt,className:"bg-green-600 hover:bg-green-700 text-white font-black px-8 py-2.5 rounded-lg transition-colors",children:"Post"}),s.jsx("button",{onClick:an,className:"bg-neutral-700 hover:bg-neutral-600 border border-neutral-500 text-white font-black px-6 py-2.5 rounded-lg transition-colors",children:"Save as Template"})]}),s.jsx("div",{className:"flex justify-center pt-3 pb-8",children:s.jsx("button",{className:"bg-yellow-400 hover:bg-yellow-300 text-black font-black px-8 py-2.5 rounded-lg transition-colors",children:"Buy Ad Points"})})]})]});if(a==="my-promos")return s.jsxs("div",{className:"min-h-screen bg-black text-white font-['Antigone',sans-serif] p-5 overflow-y-auto",children:[s.jsx(nt,{title:"My Promos",backTo:"main"}),v?s.jsx("p",{className:"text-center text-neutral-400",children:"Loading..."}):u.length===0?s.jsx("p",{className:"text-center text-neutral-500 mt-8",children:"No promos yet. Create one!"}):s.jsx("div",{className:"space-y-3 max-w-md mx-auto",children:u.map(M=>s.jsxs("div",{className:"bg-neutral-900 border border-neutral-700 rounded-xl p-3 flex items-center gap-3",children:[M.image_thumb_url?s.jsx("img",{src:M.image_thumb_url,className:"w-12 h-12 rounded-lg object-cover"}):s.jsx("div",{className:"w-12 h-12 rounded-lg bg-neutral-800 flex items-center justify-center",children:s.jsx(cb,{className:"w-5 h-5 text-neutral-600"})}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("p",{className:"font-bold truncate",children:M.title}),s.jsxs("p",{className:"text-xs text-neutral-400",children:["⭐ ",M.ad_points_balance??0," pts • ",M.status]})]}),s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsx("button",{onClick:()=>De(M),className:"p-1.5 hover:bg-neutral-800 rounded-full transition-colors",children:M.is_active?s.jsx(w_,{className:"w-4 h-4 text-green-400"}):s.jsx(v_,{className:"w-4 h-4 text-neutral-600"})}),s.jsx("button",{onClick:()=>Q(M.id),className:"p-1.5 hover:bg-neutral-800 rounded-full transition-colors",children:s.jsx(o4,{className:"w-4 h-4 text-neutral-400"})}),s.jsx("button",{onClick:()=>pe(M.id),className:"p-1.5 hover:bg-neutral-800 rounded-full transition-colors",children:s.jsx(th,{className:"w-4 h-4 text-red-500"})})]})]},M.id))})]});if(a==="templates")return s.jsxs("div",{className:"min-h-screen bg-black text-white font-['Antigone',sans-serif] p-5 overflow-y-auto",children:[s.jsx(nt,{title:"Saved Templates",backTo:"main"}),v?s.jsx("p",{className:"text-center text-neutral-400",children:"Loading..."}):m.length===0?s.jsx("p",{className:"text-center text-neutral-500 mt-8",children:"No templates saved yet."}):s.jsx("div",{className:"space-y-3 max-w-md mx-auto",children:m.map(M=>s.jsxs("button",{onClick:()=>Wt(M),className:"w-full bg-neutral-900 border border-neutral-700 hover:border-neutral-500 rounded-xl p-4 text-left transition-colors",children:[s.jsx("p",{className:"font-bold",children:M.title||"Untitled"}),s.jsxs("p",{className:"text-xs text-neutral-400 mt-1",children:["⭐ ",M.ad_points_balance??0," pts • ",M.gender]})]},M.id))})]});if(a==="analytics"&&x)return s.jsxs("div",{className:"min-h-screen bg-black text-white font-['Antigone',sans-serif] p-5 overflow-y-auto",children:[s.jsx(nt,{title:"Promo Analytics",backTo:"my-promos"}),s.jsxs("div",{className:"space-y-4 max-w-md mx-auto",children:[s.jsxs("div",{className:"bg-neutral-900 border border-neutral-700 rounded-xl p-5 text-center",children:[s.jsx("p",{className:"text-4xl font-black",children:x.totalViews}),s.jsx("p",{className:"text-sm font-bold text-neutral-400 mt-1",children:"People Viewed Your Promo"})]}),s.jsxs("div",{className:"bg-neutral-900 border border-neutral-700 rounded-xl p-5 text-center",children:[s.jsxs("p",{className:"text-4xl font-black",children:[x.avgWatchTime,"s"]}),s.jsx("p",{className:"text-sm font-bold text-neutral-400 mt-1",children:"Average Watch Time"})]}),s.jsxs("div",{className:"bg-neutral-900 border border-neutral-700 rounded-xl p-5 text-center",children:[s.jsxs("p",{className:"text-4xl font-black",children:[x.pauseRate,"%"]}),s.jsx("p",{className:"text-sm font-bold text-neutral-400 mt-1",children:"Average Pause Rate"})]}),s.jsxs("div",{className:"bg-neutral-900 border border-neutral-700 rounded-xl p-5 text-center",children:[s.jsx("p",{className:"text-4xl font-black",children:x.linkClicks}),s.jsx("p",{className:"text-sm font-bold text-neutral-400 mt-1",children:"Link Clicks"})]})]})]});
521if(a==="link-clicks"){const M=_-N*le,Ve=Math.min(100,M/le*100);return s.jsxs("div",{className:"min-h-screen bg-black text-white font-['Antigone',sans-serif] p-5 overflow-y-auto",children:[s.jsx(nt,{title:"Link Clicks",backTo:"main"}),s.jsxs("div",{className:"max-w-md mx-auto space-y-6",children:[s.jsxs("div",{className:"text-center",children:[s.jsx("p",{className:"text-sm font-black text-neutral-400 mb-1",children:"YOUR TOTAL LINK CLICKS"}),s.jsx("p",{className:"text-6xl font-black text-green-500",children:_})]}),s.jsx("div",{className:"bg-neutral-900 border border-neutral-700 rounded-2xl p-5 text-center",children:s.jsxs("p",{className:"text-sm",children:[s.jsxs("span",{className:"text-red-500 font-black",children:[le," Link Clicks Required"]}),s.jsx("span",{className:"font-black text-white",children:" from your Promos for a reward of your choice!"})]})}),s.jsxs("div",{className:"bg-neutral-900 border border-neutral-700 rounded-2xl p-5",children:[s.jsxs("div",{className:"flex items-center justify-between mb-2",children:[s.jsx("span",{className:"text-sm font-bold text-neutral-400",children:"Progress to next reward"}),s.jsxs("span",{className:"text-sm font-black text-green-400",children:[M,"/",le]})]}),s.jsx("div",{className:"h-3 bg-neutral-800 rounded-full overflow-hidden",children:s.jsx("div",{className:"h-full bg-gradient-to-r from-green-600 to-green-400 rounded-full transition-all duration-500",style:{width:`${Ve}%`}})})]}),s.jsxs("div",{className:"bg-neutral-900 border border-neutral-700 rounded-2xl p-5 text-center",children:[s.jsx("p",{className:"text-sm font-bold text-neutral-400 mb-1",children:"REWARDS CLAIMED"}),s.jsx("p",{className:"text-3xl font-black text-yellow-400",children:N})]}),s.jsx("button",{onClick:()=>{Qe(),i("create")},className:"bg-neutral-800 hover:bg-neutral-700 border border-neutral-600 text-white font-black text-lg px-8 py-3 rounded-full w-full transition-colors flex items-center justify-center gap-2",children:"CREATE PROMO"}),s.jsxs("button",{onClick:Le,disabled:me<=0||C,className:`w-full font-black text-lg px-8 py-4 rounded-full transition-colors flex flex-col items-center gap-1 ${me>0?"bg-gradient-to-r from-green-600 to-green-500 hover:from-green-500 hover:to-green-400 text-white":"bg-neutral-800 border border-neutral-700 text-neutral-500 cursor-not-allowed"}`,children:[s.jsxs("span",{className:"flex items-center gap-2",children:[s.jsx(Ft,{className:"w-5 h-5"}),me>0?"CLAIM FREE REWARD":`REACH ${le} LINK CLICKS`]}),s.jsx("span",{className:"text-xs font-bold opacity-75",children:me>0?`You have ${me} reward${me>1?"s":""} to claim!`:"UNLOCK FREE PRODUCT"})]})]})]})}return a==="pick-reward"?s.jsx(JL,{userId:e,onBack:()=>i("link-clicks"),onClaimed:()=>{k(M=>M+1),de(),i("link-clicks")}}):null},ZL=({viewerId:e,onDismiss:t})=>{const[n,r]=h.useState(null),[a,i]=h.useState(5),[o,l]=h.useState(!1),[c,d]=h.useState(!1),u=h.useRef(Date.now()),f=h.useRef(!1),m=h.useRef(null);h.useEffect(()=>{(async()=>{const{data:x}=await S.from("members").select("gender, country, created_at").eq("id",e).maybeSingle();if(x!=null&&x.created_at){const O=Date.now()-new Date(x.created_at).getTime(),P=2*24*60*60*1e3;if(O<P){t();return}}const w=(x==null?void 0:x.gender)??null,_=(x==null?void 0:x.country)??null,{data:j}=await S.from("promos").select("id, title, description, url, url_text, image_thumb_url, sameuser, gender, country").eq("is_active",!0).eq("status","Active").neq("member_id",e).limit(50);if(!j||j.length===0){t();return}const{data:N}=await S.from("promo_analytics").select("promo_id").eq("viewer_id",e),k=new Set((N??[]).map(O=>O.promo_id)),C=O=>(O==null?void 0:O.trim().toLowerCase())??null,A=j.filter(O=>{const P=C(O.gender),T=C(O.country),E=C(w),W=C(_),V=!P||P==="both"||P==="all",q=!T||T==="all countries"||T==="all"||T==="worldwide";return!(!O.sameuser&&k.has(O.id)||!V&&E&&P!==E||!q&&W&&T!==W)});if(A.length===0){t();return}const I=A[Math.floor(Math.random()*A.length)];r(I),m.current=I.id})()},[e,t]),h.useEffect(()=>{if(!n)return;const b=setInterval(()=>{f.current||i(x=>x<=1?(clearInterval(b),0):x-1)},1e3);return()=>clearInterval(b)}
521,[n]),h.useEffect(()=>{a===0&&n&&p()},[a,n]);const p=h.useCallback(async()=>{if(!m.current){t();return}const b=Math.round((Date.now()-u.current)/1e3);S.from("promo_analytics").insert({promo_id:m.current,viewer_id:e,watch_time_seconds:b,paused:f.current,link_clicked:c}).then(()=>{}),t()},[e,c,t]),v=()=>{p()},g=()=>{l(b=>(f.current=!b,!b))},y=b=>{d(!0),window.open(b,"_blank","noopener,noreferrer")};return n?s.jsxs("div",{className:"absolute inset-0 z-30 bg-black/85 backdrop-blur-sm flex flex-col items-center justify-center p-4",children:[s.jsxs("div",{className:"absolute top-2 left-2 right-2 flex items-center justify-between z-40",children:[s.jsx("span",{className:"bg-white/10 rounded-full px-3 py-1 text-xs font-bold text-white",children:a>0?`${a}s`:"Done"}),s.jsx("button",{onClick:v,className:"bg-white/10 hover:bg-white/20 rounded-full px-3 py-1 text-xs font-bold text-white transition-colors",children:"Skip"})]}),s.jsxs("div",{className:"flex flex-col items-center text-center max-w-[90%]",children:[n.image_thumb_url&&s.jsx("img",{src:n.image_thumb_url,alt:n.title,className:"w-full max-h-[60vh] object-contain rounded-xl mb-3"}),n.title&&s.jsx("h3",{className:"text-lg md:text-xl font-black text-white mb-1",children:n.title}),n.description&&s.jsx("p",{className:"text-xs md:text-sm text-neutral-300 mb-3 line-clamp-2",children:n.description}),s.jsxs("div",{className:"flex items-center gap-3",children:[n.url&&s.jsxs("button",{onClick:()=>y(n.url),className:"flex items-center gap-1.5 bg-yellow-400 hover:bg-yellow-300 text-black font-black px-5 py-2 rounded-full text-sm transition-colors",children:[s.jsx(y_,{className:"w-3.5 h-3.5"}),n.url_text||"Join Now"]}),s.jsx("button",{onClick:g,className:"bg-white/10 hover:bg-white/20 rounded-full p-2 transition-colors",children:o?s.jsx(w4,{className:"w-4 h-4 text-white"}):s.jsx(b4,{className:"w-4 h-4 text-white"})})]})]}),s.jsxs("div",{className:"absolute bottom-6 left-4 right-4",children:[s.jsx("div",{className:"h-1 bg-white/10 rounded-full overflow-hidden",children:s.jsx("div",{className:"h-full bg-yellow-400 transition-all duration-1000 ease-linear",style:{width:`${(5-a)/5*100}%`}})}),s.jsx("p",{className:"text-center text-[9px] text-neutral-500 mt-1 font-bold",children:"SPONSORED"})]})]}):null},eM=({feature:e})=>s.jsxs("div",{className:"bg-neutral-900 rounded-2xl p-3 text-center border border-neutral-700/60 flex flex-col items-center gap-1.5 relative",children:[e.icon?s.jsx("img",{src:e.icon,alt:"",className:"w-14 h-14 object-contain"}):s.jsx("span",{className:"text-4xl leading-none",children:"👩"}),s.jsx("p",{className:"text-white text-[11px] font-black leading-tight tracking-wide uppercase",children:e.label})]}),tM=({onClose:e,currentTier:t,onPurchase:n,onManage:r})=>{const[a,i]=h.useState(t||"basic"),o=async c=>{try{await n(c)}catch(d){B.error("Failed to start checkout",{description:d.message})}},l=a==="premium"?fr.premium.features:fr.basic.features;return s.jsx("div",{className:"fixed inset-0 z-50 bg-black overflow-y-auto",children:s.jsxs("div",{className:"min-h-screen flex flex-col items-center px-4 py-5 font-['Antigone',sans-serif]",children:[s.jsx("button",{onClick:e,className:"self-start mb-3",children:s.jsx(We,{className:"w-8 h-8 text-red-500"})}),s.jsx("h1",{className:"text-white text-3xl font-black tracking-wider mb-0",style:{fontFamily:"'Antigone Compact Pro', sans-serif"},children:"VIP FEATURES"}),s.jsx("p",{className:"text-white text-sm font-black tracking-wider mb-4",children:"INCLUDED"}),s.jsxs("div",{className:"w-full max-w-sm mb-5 rounded-2xl border border-emerald-400/40 bg-emerald-500/10 px-4 py-3 text-center",children:[s.jsx("p",{className:"text-emerald-300 text-sm font-black tracking-wide uppercase",children:"⏱️ 5 Free Discover Call Minutes"}),s.jsx("p",{className:"text-neutral-300 text-[11px] font-bold mt-0.5",children:"Added to your balance every renewal — use them to video call on Discover"})]}),r&&t&&s.jsxs("button",{onClick:()=>r(),className:"flex items-center gap-2 text-neutral-400 text-sm font-black tracking-wide mb-5 hover:text-white transition-colors",children:[s.jsx(N4,{className:"w-5 h-5"}),"OPEN VIP SETTINGS"]}),s.jsxs("div",{className:"flex gap-3 mb-6 w-full max-w-sm",children:[s.jsxs("button",{onClick:()=>
521i("basic"),className:`flex-1 py-3 px-4 rounded-xl font-black text-sm transition-all border-2 ${a==="basic"?"bg-green-600 border-green-400 text-white":"bg-neutral-800 border-neutral-600 text-neutral-400"}`,children:[s.jsxs("div",{className:"flex items-baseline gap-1 justify-center",children:[s.jsx("span",{className:"text-xl",children:fr.basic.price}),!t&&s.jsx("span",{className:"text-[8px] opacity-70",children:"TAP TO BUY"})]}),s.jsx("div",{className:"text-[9px] opacity-70 tracking-wider",children:"A WEEK BASIC PLAN"}),t==="basic"&&s.jsx("div",{className:"text-[9px] mt-0.5 text-green-200",children:"✓ YOUR PLAN"})]}),s.jsxs("button",{onClick:()=>i("premium"),className:`flex-1 py-3 px-4 rounded-xl font-black text-sm transition-all border-2 ${a==="premium"?"bg-gradient-to-b from-yellow-500 to-orange-700 border-yellow-400 text-white":"bg-neutral-800 border-neutral-600 text-neutral-400"}`,children:[s.jsxs("div",{className:"flex items-baseline gap-1 justify-center",children:[s.jsx("span",{className:"text-xl",children:fr.premium.price}),!t&&s.jsx("span",{className:"text-[8px] opacity-70",children:"TAP TO BUY"})]}),s.jsx("div",{className:"text-[9px] opacity-70 tracking-wider",children:"A MONTH PREMIUM PLAN"}),t==="premium"&&s.jsx("div",{className:"text-[9px] mt-0.5 text-yellow-200",children:"✓ YOUR PLAN"})]})]}),s.jsx("div",{className:"w-full max-w-sm mb-8",children:s.jsx("div",{className:"grid grid-cols-2 gap-3",children:l.map((c,d)=>s.jsx(eM,{feature:c},`${a}-${d}`))})}),t?s.jsx("button",{onClick:()=>r==null?void 0:r(),className:"w-full max-w-sm bg-gradient-to-r from-yellow-500 to-orange-500 text-black font-black text-xl py-4 rounded-full hover:opacity-90 transition-opacity shadow-xl tracking-wider mb-8",children:"MANAGE SUBSCRIPTION"}):s.jsxs("button",{onClick:()=>o(a==="premium"?fr.premium.price_id:fr.basic.price_id),className:"w-full max-w-sm bg-gradient-to-r from-green-500 to-green-600 text-white font-black text-xl py-4 rounded-2xl hover:opacity-90 transition-opacity shadow-xl tracking-wider mb-8",children:[s.jsx("div",{className:"text-[10px] opacity-80",children:a==="premium"?"9.99 A Month":"2.49 A Week"}),s.jsx("div",{children:"PURCHASE"})]})]})})},nM=({onDismiss:e,onSnooze:t,onGoToChallenges:n,isVip:r,onPurchaseVip:a,isFemale:i})=>{const[o,l]=h.useState(!1),c=async()=>{l(!0);try{const{data:m,error:p}=await S.functions.invoke("unfreeze-purchase",{body:{action:"purchase"}});if(p)throw p;m!=null&&m.url&&(window.location.href=m.url)}catch(m){B.error("Failed",{description:m.message})}l(!1)},d=async()=>{if(a){l(!0);try{await a()}catch(m){B.error("Failed",{description:m.message})}l(!1)}},u=async()=>{l(!0);try{const{data:m,error:p}=await S.functions.invoke("unfreeze-purchase",{body:{action:"vip_unfreeze"}});if(p){let v=p.message;try{const g=p.context;if(g!=null&&g.json){const y=await g.json();y!=null&&y.error&&(v=y.error)}else if(g!=null&&g.text){const y=await g.text();try{const b=JSON.parse(y);b!=null&&b.error&&(v=b.error)}catch{}}}catch{}B.error(v),l(!1);return}m!=null&&m.success?(B.success("🎉 Minutes unfrozen!",{description:`${m.remaining} VIP unfreezes remaining this month`}),e()):m!=null&&m.error&&B.error(m.error)}catch(m){B.error("Failed",{description:m.message})}l(!1)},f=[{label:"Gender Filter",icon:_p},{label:"Pin Custom Topics",icon:Np},{label:"50 Ad Points A Week",icon:jp},{label:"Auto-Unfreeze",icon:Yj}];return s.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/80 backdrop-blur-sm px-4",children:s.jsxs("div",{className:"bg-neutral-900 rounded-2xl p-5 max-w-sm w-full text-center relative overflow-y-auto max-h-[90vh]",children:[s.jsx("button",{onClick:e,className:"absolute top-3 right-3 z-10",children:s.jsx(We,{className:"w-6 h-6 text-red-500 hover:text-red-400"})}),s.jsx("h2",{className:"text-2xl font-black text-white mb-1 tracking-wide",children:"❄️ Minutes Frozen!"}),s.jsxs("p",{className:"text-neutral-300 text-sm mb-1",children:["Your earning rate is reduced to"," ",s.jsx("span",{className:"text-red-400 font-black line-through",children:"2 minutes"})," ","per user instead of 10 or 30 minutes."]}),s.jsx("p",{className:"text-white font-black text-sm uppercase tracking-wide mb-3",children:"Save Your Rewards Now!"}),s.jsx("h3",{className:"text-white font-black text-lg mb-3",children:"How To Unfreeze?"}),!r&&s.jsxs("button",{onClick:d,disabled:o,className:"w-full bg-gradient-to-b from-red-600 to-red-700 border-2 border-red-400 rounded-2xl p-4 mb-3 text-center hover:opacity-90 transition-opacity",children:[s.jsx("p",{className:"text-white font-black text-base tracking-wide mb-0.5",children:"VIP Auto-Protect"}),s.jsx("p",{className:"text-red-200 text-xs mb-2.5",children:"Never freeze again + Get 3+ VIP Perks for just $0.50 more!"}),s.jsx("div",{className:"flex flex-col gap-1.5 mb-2.5",children:f.map((m,p)=>s.jsxs("div",{className:"flex items-center gap-2 justify-center",children:[m.icon?s.jsx("img",{src:m.icon,alt:"",className:"w-5 h-5 object-contain"}):s.jsx("span",{className:"text-base leading-none",children:"👩"}),s.jsx("span",{className:"text-white text-sm font-bold",children:m.label})]},p))}),s.jsx("p",{className:"text-white font-black text-lg",children:"$2.49 A Week"})]}),r&&s.jsxs("button",{onClick:u,disabled:o,className:"w-full bg-gradient-to-r from-yellow-500 to-orange-500 text-black font-black text-sm py-3 rounded-full hover:opacity-90 transition-opacity shadow-lg tracking-wide mb-3 flex items-center justify-center gap-2",children:[s.jsx(cs,{className:"w-4 h-4"})," VIP AUTO-UNFREEZE"]}),s.jsxs("button",{onClick:c,disabled:o,className:"w-full bg-green-800/60 border border-green-600/40 rounded-xl py-3 px-4 hover:bg-green-800/80 transition-colors mb-3",children:[s.jsx("p",{className:"text-green-300 text-xs font-bold",children:"One Time Save"}),s.jsx("p",{className:"text-green-400/70 text-[11px]",children:"Unfreeze for 7 Days Only"}),s.jsxs("div",{className:"flex items-center justify-center gap-1.5 mt-1",children:[s.jsx(E4,{className:"w-4 h-4 text-blue-300/60"}),s.jsx("span",{className:"text-green-300 font-bold text-sm",children:"$1.99"})]})]}),s.jsxs("div",{className:"flex items-center justify-center gap-4",children:[s.jsx("button",{onClick:e,className:"text-neutral-600 text-xs font-bold hover:text-neutral-400 transition-colors",children:"Dismiss"}),t&&s.jsx("button",{onClick:t,className:"text-neutral-600 text-xs font-bold hover:text-yellow-400 transition-colors",children:"Don't show for 24h"})]})]})})},Cp="/assets/report-icon-oUD3VgGW.png",rM=["Underage User","Inappropriate Behavior","Nudity / Sexual Content","Harassment / Bullying","Hate Speech / Discrimination","Spam / Scam","Violence / Threats","Other"],sM=e=>{const t=e==null?void 0:e.current;if(!t||t.readyState<2)return null;const n=document.createElement("canvas");n.width=t.videoWidth||640,n.height=t.videoHeight||480;const r=n.getContext("2d");if(!r)return null;r.drawImage(t,0,0,n.width,n.height);const a=n.toDataURL("image/jpeg",.8),i=atob(a.split(",")[1]),o=new ArrayBuffer(i.length),l=new Uint8Array(o);for(let c=0;c<i.length;c++)l[c]=i.charCodeAt(c);return new Blob([o],{type:"image/jpeg"})},aM=e=>new Promise((t,n)=>{const r=new FileReader;r.onloadend=()=>
521t(String(r.result).split(",")[1]||""),r.onerror=n,r.readAsDataURL(e)}),iM=({reporterId:e,reportedUserId:t,remoteVideoRef:n,onClose:r})=>{const[a,i]=h.useState(null),[o,l]=h.useState(""),[c,d]=h.useState(!1),u=async()=>{if(!a){B.error("Please select a reason");return}d(!0);let f=null;const m=sM(n);if(m){const g=`${e}/${Date.now()}.jpg`,{error:y}=await S.storage.from("report-screenshots").upload(g,m,{contentType:"image/jpeg"});y||(f=g)}const{error:p}=await S.from("user_reports").insert({reporter_id:e,reported_user_id:t,reason:a,details:o.trim()||null,screenshot_url:f}),v=m&&["Nudity / Sexual Content","Inappropriate Behavior"].includes(a);if(!p&&v)try{const g=await aM(m);g&&await S.functions.invoke("moderate-frame",{body:{frame:g,reported_user_id:t}})}catch(g){console.error("Failed to moderate reported frame:",g)}p?B.error("Failed to submit report"):(B.success("Report submitted. Thank you!"),r()),d(!1)};return s.jsx("div",{className:"fixed inset-0 z-50 bg-black/90 flex items-center justify-center px-4",children:s.jsxs("div",{className:"bg-neutral-900 border border-neutral-700 rounded-2xl w-full max-w-sm p-5 relative",children:[s.jsx("button",{onClick:r,className:"absolute top-3 right-3",children:s.jsx(We,{className:"w-6 h-6 text-neutral-400 hover:text-white transition-colors"})}),s.jsxs("div",{className:"flex flex-col items-center gap-2 mb-5",children:[s.jsx("img",{src:Cp,alt:"Report",className:"w-14 h-14"}),s.jsx("h2",{className:"text-white text-lg font-black tracking-wider",children:"REPORT USER"}),s.jsx("p",{className:"text-neutral-500 text-xs text-center",children:"Select a reason for your report"})]}),s.jsx("div",{className:"grid grid-cols-2 gap-2 mb-4",children:rM.map(f=>s.jsx("button",{onClick:()=>i(f),className:`px-3 py-2.5 rounded-xl text-xs font-bold tracking-wide transition-all border ${a===f?"bg-red-600 border-red-500 text-white":"bg-neutral-800 border-neutral-700 text-neutral-300 hover:border-neutral-500"}`,children:f},f))}),s.jsx("textarea",{value:o,onChange:f=>l(f.target.value),placeholder:"Additional details (optional)",maxLength:500,rows:3,className:"w-full bg-neutral-800 border border-neutral-700 rounded-xl px-3 py-2 text-sm text-white placeholder-neutral-500 focus:outline-none focus:border-red-500 resize-none mb-4"}),s.jsxs("button",{onClick:u,disabled:!a||c,className:"w-full bg-red-600 hover:bg-red-700 disabled:bg-neutral-700 disabled:text-neutral-500 text-white font-black tracking-wider py-3 rounded-xl transition-colors flex items-center justify-center gap-2",children:[s.jsx(Co,{className:"w-4 h-4"}),c?"SUBMITTING...":"SUBMIT REPORT"]})]})})},oM="/assets/boy-selfie-DI5hhYZR.jpg",lM="/assets/girl-selfie-Df-6SkZ8.jpg",jy="/assets/topic-bubble-BDWIuy2J.png",cM="/assets/logo-BW-HQiQo.png",uM="/assets/shopping-bags-C2-q_68w.png",dM="/assets/stopwatch-CLvf832o.png",hM="/assets/shopping-bags-C2-q_68w.png",fM="/assets/reward-hat-BQgq73CD.jpg",mM="/assets/reward-jeans-CfL-yYQ3.jpg",pM="/assets/reward-bag-r5k2-V0V.jpg",xM="/assets/reward-boots-BpzxcOiP.png",gM="/assets/reward-phonecase-BcrY6ESn.png",bM="/assets/reward-redbag-DlDUMoP5.jpg",yM="/assets/reward-heartbag-CglYhYDx.jpg",vM="/assets/reward-shorts-CzbkpOE0.jpg",wM="/assets/trophy-icon-B_stanhb.png",_M="/assets/no-frame1-CjDUXcqw.jpg",jM="/assets/no-frame2-ByJVTgtY.png",NM="/assets/fast-forward-BJraLI0_.png",kM=()=>s.jsxs("div",{className:"relative w-60 h-60 flex items-center justify-center",children:[s.jsxs("div",{className:"flex gap-2 items-end animate-fade-in",children:[s.jsxs("div",{className:"relative",children:[s.jsx("div",{className:"w-24 h-32 rounded-xl overflow-hidden border-2 border-emerald-400 shadow-lg shadow-emerald-400/30 animate-[pulse_3s_ease-in-out_infinite]",children:s.jsx("img",{src:oM,alt:"Boy",className:"w-full h-full object-cover"})}),s.jsxs("div",{className:"absolute -top-10 -left-3",style:{animation:"floatUp 3s ease-in-out 0s infinite"},children:[s.jsx("img",{src:jy,alt:"",className:"w-12 h-10 object-contain"}),s.jsx("img",{src:cM,alt:"",className:"absolute top-1.5 left-2.5 w-5 h-5"})]})]}),s.jsxs("div",{className:"relative",children:[s.jsx("div",{className:"w-24 h-32 rounded-xl overflow-hidden border-2 border-pink-400 shadow-lg shadow-pink-400/30 animate-[pulse_3s_ease-in-out_infinite_0.5s]",children:s.jsx("img",{src:lM,alt:"Girl",className:"w-full h-full object-cover"})}),s.jsxs("div",{className:"absolute -top-10 -right-3",style:{animation:"floatUp 3s ease-in-out 1s infinite"},children:[s.jsx("img",{src:jy,alt:"",className:"w-12 h-10 object-contain"}),s.jsx("img",{src:uM,alt:"",className:"absolute top-1.5 left-2.5 w-5 h-5"})]})]})]}),s.jsx("div",{className:"absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-6 h-6 rounded-full bg-emerald-400/20 animate-[ping_2s_ease-in-out_infinite]"})]}),SM=()=>s.jsxs("div",{className:"relative w-56 h-56 flex items-center justify-center",children:[s.jsx("img",{src:dM,alt:"Timer",className:"w-28 h-28 animate-[pulse_2s_ease-in-out_infinite] drop-shadow-[0_0_15px_rgba(59,130,246,0.5)]"}),[{cls:"top-4 right-6",delay:"0s"},{cls:"top-10 left-4",delay:"1s"},{cls:"bottom-10 right-4",delay:"2s"}].map((e,t)=>s.jsx("span",{className:`absolute ${e.cls} bg-blue-500 text-white text-[10px] font-black px-2 py-0.5 rounded-full shadow-lg`,style:{animation:`floatUp 2.5s ease-in-out ${e.delay} infinite`},children:"+5 min"},t))]}),Ny=[{src:fM,alt:"Hat"},{src:pM,alt:"Bag"},{src:xM,alt:"Boots"},{src:gM,alt:"Phone Case"},{src:bM,alt:"Red Bag"},{src:yM,alt:"Heart Bag"},{src:vM,alt:"Shorts"},{src:mM,alt:"Jeans"}],CM=()=>s.jsxs("div",{className:"relative w-60 h-56 flex items-center justify-center",children:[s.jsx("img",{src:hM,alt:"Shop",className:"w-16 h-16 z-20 drop-shadow-lg animate-[bounce_3s_ease-in-out_infinite]"}),Ny.map((e,t)=>{const n=360/Ny.length*t,r=90,a=Math.cos(n*Math.PI/180)*r,i=Math.sin(n*Math.PI/180)*r;return s.jsx("div",{className:"absolute w-12 h-12 rounded-lg overflow-hidden border border-neutral-600 shadow-md z-10",style:{left:`calc(50% + ${a}px - 24px)`,top:`calc(50% + ${i}px - 24px)`,animation:`pulse 3s ease-in-out ${t*.3}s infinite`},children:s.jsx("img",{src:e.src,alt:e.alt,className:"w-full h-full object-cover"})},t)}
521),["top-0 right-4","bottom-0 left-2","top-6 left-0"].map((e,t)=>s.jsx("span",{className:`absolute ${e} text-yellow-400 text-base z-30`,style:{animation:`sparkle 1.5s ease-in-out ${t*.4}s infinite`},children:"✦"},t))]}),EM=()=>{const e=[{label:"Bestie Challenge",reward:"🏆"},{label:"Boyfriend Challenge",reward:"🎁"},{label:"Marathon Talk",reward:"⭐"},{label:"Blue Eyes Hunt",reward:"💎"}];return s.jsxs("div",{className:"relative w-56 h-56 flex items-center justify-center",children:[s.jsx("img",{src:wM,alt:"Trophy",className:"w-20 h-20 z-20 drop-shadow-lg animate-[bounce_3s_ease-in-out_infinite]"}),e.map((t,n)=>{const r=360/e.length*n-90,a=85,i=Math.cos(r*Math.PI/180)*a,o=Math.sin(r*Math.PI/180)*a;return s.jsxs("div",{className:"absolute flex flex-col items-center gap-0.5 z-10",style:{left:`calc(50% + ${i}px - 32px)`,top:`calc(50% + ${o}px - 18px)`,animation:`pulse 3s ease-in-out ${n*.4}s infinite`},children:[s.jsx("span",{className:"bg-neutral-800 border border-neutral-600 text-white text-[8px] font-bold px-2 py-1 rounded-md whitespace-nowrap shadow-md",children:t.label}),s.jsx("span",{className:"text-yellow-400 text-sm",children:t.reward})]},n)}),["top-0 left-6","bottom-2 right-2","top-4 right-0"].map((t,n)=>s.jsx("span",{className:`absolute ${t} text-yellow-400 text-sm z-30`,style:{animation:`sparkle 1.5s ease-in-out ${n*.3}s infinite`},children:"✦"},n))]})},PM=()=>{const[e,t]=h.useState(0);return h.useEffect(()=>{const n=setInterval(()=>{t(r=>r===0?1:0)},600);return()=>clearInterval(n)},[]),s.jsxs("div",{className:"relative w-56 h-56 flex items-center justify-center",children:[s.jsx("div",{className:"w-40 h-40 rounded-xl overflow-hidden border-2 border-red-500/60 shadow-lg shadow-red-500/20",children:s.jsx("img",{src:e===0?_M:jM,alt:"No",className:"w-full h-full object-cover transition-opacity duration-150"})}),s.jsx("img",{src:NM,alt:"Skip",className:"absolute -top-1 -right-1 w-10 h-10 rounded-lg animate-[shake_0.8s_ease-in-out_infinite]"}),s.jsx("span",{className:"absolute bottom-4 left-4 text-red-500 text-2xl font-black animate-[pulse_1.5s_ease-in-out_infinite]",children:"✕"}),s.jsx("span",{className:"absolute top-4 left-6 text-red-500 text-lg font-black animate-[pulse_1.5s_ease-in-out_infinite_0.5s]",children:"✕"})]})},Df=[{tag:"Welcome To C24 Club",title:"HOW IT WORKS",visual:s.jsx(kM,{}),step:`1. VIDEO CHAT
522& COLLECT REWARDS`,description:null,footer:null},{tag:"Chat With Strangers",title:"COLLECT MINUTES",visual:s.jsx(SM,{}),step:`2. STOCK-UP
523ON MINUTES!`,description:"⏱ 5 Minutes",footer:null},{tag:"Use Your Minutes",title:"1k+ REWARDS!",visual:s.jsx(CM,{}),step:"3. REDEEM FOR PRIZES",description:`Clothing, Accessories,
524Gift Cards & More!`,footer:null},{tag:"Bonus Perks",title:"WEEKLY CHALLENGES",visual:s.jsx(EM,{}),step:`4. COMPLETE CHALLENGES
525& WIN PRIZES!`,description:`Exclusive rewards from
526challenges every week!`,footer:null},{tag:"Minute Loss",title:"BEWARE!",visual:s.jsx(PM,{}),step:`5. QUICK SKIPS =
527LESS REWARDS`,description:null,footer:null},{tag:null,title:"WHY REWARDS?",visual:null,step:null,description:`An Omegle That Rewards It's Users Brings More Quality + The Guy To Girl Ratio is balanced because of incentives!
528
529We want to minimize quick skip culture!`,footer:null}],TM=({onDismiss:e})=>{const[t,n]=h.useState(0),r=()=>{t<Df.length-1?n(t+1):e()},a=()=>{t>0&&n(t-1)},i=Df[t];return s.jsxs("div",{className:"fixed inset-0 z-50 bg-black/90 backdrop-blur-sm flex items-center justify-center p-4",children:[s.jsx("style",{children:`
530        @keyframes floatUp {
531          0%, 100% { opacity: 0; transform: translateY(8px) scale(0.8); }
532          30%, 70% { opacity: 1; transform: translateY(-12px) scale(1); }
533        }
534        @keyframes sparkle {
535          0%, 100% { opacity: 0.2; transform: scale(0.6) rotate(0deg); }
536          50% { opacity: 1; transform: scale(1.2) rotate(180deg); }
537        }
538        @keyframes shake {
539          0%, 100% { transform: translateX(0) rotate(0deg); }
540          25% { transform: translateX(-3px) rotate(-5deg); }
541          75% { transform: translateX(3px) rotate(5deg); }
542        }
543      `}),s.jsxs("div",{className:"relative w-full max-w-[320px] bg-neutral-900 border border-neutral-700 rounded-2xl p-5 flex flex-col items-center min-h-[420px]",children:[s.jsx("button",{onClick:e,className:"absolute top-3 right-3 text-neutral-400 hover:text-white transition-colors",children:s.jsx(We,{className:"w-5 h-5"})}),i.tag&&s.jsx("p",{className:"text-neutral-400 text-xs font-bold tracking-wide mb-1",children:i.tag}),s.jsx("h2",{className:"font-black text-2xl tracking-wide text-white text-center mb-4",children:i.title}),i.visual&&s.jsx("div",{className:"mb-4",children:i.visual}),i.step&&s.jsx("p",{className:"font-black text-base text-white text-center whitespace-pre-line leading-tight mb-2",children:i.step}),i.description&&s.jsx("p",{className:"text-neutral-300 text-sm text-center whitespace-pre-line leading-relaxed mb-2 px-2",children:i.description}),i.footer&&s.jsx("p",{className:"text-neutral-500 text-xs font-bold underline mt-2",children:i.footer}),s.jsx("div",{className:"flex-1"}),s.jsxs("div",{className:"flex items-center justify-between w-full mt-4",children:[s.jsx("button",{onClick:a,className:`p-2 rounded-full transition-colors ${t===0?"opacity-0 pointer-events-none":"bg-neutral-800 hover:bg-neutral-700 text-white"}`,children:s.jsx(Rn,{className:"w-5 h-5"})}),s.jsx("div",{className:"flex gap-1.5",children:Df.map((o,l)=>s.jsx("div",{className:`w-2 h-2 rounded-full transition-colors ${l===t?"bg-white":"bg-neutral-600"}`},l))}),s.jsx("button",{onClick:r,className:"p-2 rounded-full bg-neutral-800 hover:bg-neutral-700 text-white transition-colors",children:s.jsx(Jd,{className:"w-5 h-5"})})]})]})]})},ky=({videoRef:e,partnerId:t,className:n=""})=>{const[r,a]=h.useState(Array(12).fill(.1)),i=h.useRef(null),o=h.useRef(null),l=h.useRef(null),{data:c}=he({queryKey:["voice-mode-partner-image",t],enabled:!!t,queryFn:async()=>{const{data:d}=await S.from("members").select("image_url, image_thumb_url").eq("id",t).maybeSingle();
543return(d==null?void 0:d.image_thumb_url)||(d==null?void 0:d.image_url)||null}});return h.useEffect(()=>{const d=e.current;if(!d)return;const u=d.srcObject;if(!u||u.getAudioTracks().length===0)return;const m=new AudioContext;l.current=m;const p=m.createMediaStreamSource(u),v=m.createAnalyser();v.fftSize=64,p.connect(v),i.current=v;const g=new Uint8Array(v.frequencyBinCount),y=()=>{v.getByteFrequencyData(g);const b=12,x=Math.max(1,Math.floor(g.length/b)),w=[];for(let _=0;_<b;_++){const j=g[_*x]/255;w.push(Math.max(.08,j))}a(w),o.current=requestAnimationFrame(y)};return y(),()=>{o.current&&cancelAnimationFrame(o.current),m.close()}},[e]),s.jsxs("div",{className:`absolute inset-0 bg-gradient-to-br from-neutral-900 via-neutral-800 to-neutral-900 flex flex-col items-center justify-center ${n}`,children:[s.jsxs("div",{className:"relative mb-4",children:[s.jsx("div",{className:"w-24 h-24 md:w-32 md:h-32 rounded-full bg-gradient-to-br from-pink-500/30 to-purple-600/30 border-2 border-pink-500/40 flex items-center justify-center shadow-lg shadow-pink-500/20 overflow-hidden",children:c?s.jsx("img",{src:c,alt:"Partner",className:"w-full h-full object-cover"}):s.jsx("span",{className:"text-5xl md:text-6xl",children:"🎙️"})}),s.jsx("div",{className:"absolute inset-0 rounded-full border-2 border-pink-400/30 animate-ping"})]}),s.jsx("div",{className:"bg-pink-600/80 backdrop-blur-sm text-white text-xs md:text-sm font-black px-4 py-1.5 rounded-full mb-4 shadow-lg",children:"🎙️ VOICE MODE"}),s.jsx("div",{className:"flex items-end gap-1 h-12 md:h-16",children:r.map((d,u)=>s.jsx("div",{className:"w-2 md:w-2.5 rounded-full bg-gradient-to-t from-pink-500 to-purple-400 transition-all duration-75",style:{height:`${d*100}%`,minHeight:"4px"}},u))})]})},RM=[{key:"instagram",label:"Instagram",icon:fh,placeholder:"@username"},{key:"tiktok",label:"TikTok",icon:hh,placeholder:"@username"},{key:"snapchat",label:"Snapchat",icon:mh,placeholder:"/username"},{key:"discord",label:"Discord",icon:rx,placeholder:"username"},{key:"cashapp",label:"CashApp",icon:dh,placeholder:"$cashtag"},{key:"venmo",label:"Venmo",icon:ph,placeholder:"/username"},{key:"paypal",label:"PayPal",icon:xh,placeholder:"@username"}],ux=({open:e,onClose:t,onComplete:n})=>{const{user:r}=it(),a=h.useRef(null),i=h.useRef(null),o=h.useRef(null),[l,c]=h.useState("camera"),[d,u]=h.useState(null),[f,m]=h.useState(""),[p,v]=h.useState(!1),[g,y]=h.useState({}),[b,x]=h.useState(""),w=h.useCallback(async()=>{try{const T=await navigator.mediaDevices.getUserMedia({video:{facingMode:"user",width:640,height:640}});o.current=T,a.current&&(a.current.srcObject=T,a.current.play()),v(!0)}catch{Kt({title:"Camera access denied",description:"Please allow camera access to take a selfie.",variant:"destructive"})}},[]),_=h.useCallback(()=>{var T;(T=o.current)==null||T.getTracks().forEach(E=>E.stop()),o.current=null,v(!1)},[]),j=h.useCallback(T=>{const V=T.getContext("2d").getImageData(0,0,T.width,T.height).data;let q=0;const D=V.length/4,$=new Array(10).fill(0);for(let ee=0;ee<V.length;ee+=4){const ae=V[ee],xe=V[ee+1],te=V[ee+2],ce=ae*.299+xe*.587+te*.114;q+=ce,$[Math.min(9,Math.floor(ce/25.6))]++}const z=q/D,U=Math.max(...$)/D>.85;return{isTooDark:z<40,isTooUniform:U}},[]),N=h.useCallback(()=>{const T=a.current,E=i.current;if(!T||!E)return;const W=Math.min(T.videoWidth,T.videoHeight);E.width=480,E.height=480;const V=E.getContext("2d"),q=(T.videoWidth-W)/2,D=(T.videoHeight-W)/2;V.drawImage(T,q,D,W,W,0,0,480,480);const{isTooDark:$,isTooUniform:z}=j(E);if($){Kt({title:"Too dark! 🌑",description:"Move to a well-lit area and try again.",variant:"destructive"});return}if(z){Kt({title:"Can't see you! 🙈",description:"Make sure your face is visible and the camera isn't covered.",variant:"destructive"});return}E.toBlob(R=>{R&&(u(R),m(URL.createObjectURL(R)),c("preview"),_())},"image/jpeg",.85)},[_,j]),k=h.useCallback(()=>{u(null),m(""),c("camera"),setTimeout(w,100)},[w]),C=()=>c("socials"),A=h.useCallback(async()=>{if(!d||!r)return;c("uploading");const T=`${r.id}/selfie.jpg`,{error:E}=await S.storage.from("member-photos").upload(T,d,{upsert:!0,contentType:"image/jpeg"});if(E){Kt({title:"Upload failed",description:E.message,variant:"destructive"}),c("socials");return}const{data:W}=S.storage.from("member-photos").getPublicUrl(T),V=`${W.publicUrl}?t=${Date.now()}`;try{const{data:D}=await S.functions.invoke("moderate-selfie",{body:{image_url:V}});if(D!=null&&D.flagged){await S.storage.from("member-photos").remove([T]),Kt({title:"Selfie rejected 🚫",description:"Inappropriate content detected. Please upload a different photo that follows our community guidelines.",variant:"destructive"}),c("socials");return}}catch(D){console.error("Selfie moderation failed:",D)}await S.from("members").update({image_url:V,image_thumb_url:V,image_status:"pending",is_discoverable:!1,last_active_at:new Date().toISOString(),...b.trim()?{bio:b.trim()}:{}}).eq("id",r.id);const q=Object.entries(g).filter(([,D])=>D.trim()).map(([D,$])=>`${D}:${$.trim()}`);if(q.length>0){const{data:D}=await S.from("vip_settings").select("id, pinned_socials").eq("user_id",r.id).maybeSingle();if(D){const $=new Map;
543(D.pinned_socials||[]).forEach(R=>{const[U,...ee]=R.split(":");$.set(U,ee.join(":"))}),q.forEach(R=>{const[U,...ee]=R.split(":");$.set(U,ee.join(":"))});const z=[...$.entries()].map(([R,U])=>`${R}:${U}`);await S.from("vip_settings").update({pinned_socials:z,updated_at:new Date().toISOString()}).eq("user_id",r.id)}else await S.from("vip_settings").insert({user_id:r.id,pinned_socials:q})}n(V),Kt({title:"Selfie submitted! 📸",description:"Your photo is under review — we'll make you discoverable once approved."})},[d,r,n,g,b]),I=()=>{_(),t()},O=(T,E)=>{y(W=>({...W,[T]:E}))},P=Object.values(g).filter(T=>T.trim()).length;return e?s.jsx("div",{className:"fixed inset-0 z-50 bg-black/80 backdrop-blur-sm flex items-center justify-center p-4",children:s.jsxs("div",{className:"bg-[#1a1a1a] rounded-2xl w-full max-w-sm overflow-hidden border border-white/10 max-h-[90vh] overflow-y-auto",children:[s.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-white/10",children:[s.jsx("h2",{className:"text-white font-bold text-lg",children:l==="socials"?"Add Your Socials 🔗":"Take a Quick Selfie 📸"}),s.jsx("button",{onClick:I,className:"text-white/60 hover:text-white",children:s.jsx(We,{className:"w-5 h-5"})})]}),s.jsxs("div",{className:"p-4",children:[l==="camera"&&s.jsxs(s.Fragment,{children:[s.jsx("p",{className:"text-white/60 text-sm text-center mb-4",children:"Just one snap — we'll find people who want to connect with you!"}),s.jsxs("div",{className:"relative aspect-square rounded-xl overflow-hidden bg-black mb-4",children:[s.jsx("video",{ref:a,className:"w-full h-full object-cover",style:{transform:"scaleX(-1)"},playsInline:!0,muted:!0}),!p&&s.jsxs("button",{onClick:w,className:"absolute inset-0 flex flex-col items-center justify-center gap-3 bg-black/60",children:[s.jsx(Qa,{className:"w-12 h-12 text-white"}),s.jsx("span",{className:"text-white font-medium",children:"Tap to open camera"})]})]}),s.jsx("canvas",{ref:i,className:"hidden"}),p&&s.jsxs("button",{onClick:N,className:"w-full flex items-center justify-center gap-2 bg-pink-500 hover:bg-pink-600 text-white font-bold py-3 rounded-xl transition-colors",children:[s.jsx(Qa,{className:"w-5 h-5"}),"Snap!"]})]}),l==="preview"&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"relative aspect-square rounded-xl overflow-hidden bg-black mb-4",children:s.jsx("img",{src:f,alt:"Your selfie",className:"w-full h-full object-cover"})}),s.jsx("canvas",{ref:i,className:"hidden"}),s.jsxs("div",{className:"flex gap-3",children:[s.jsxs("button",{onClick:k,className:"flex-1 flex items-center justify-center gap-2 bg-white/10 hover:bg-white/20 text-white font-medium py-3 rounded-xl transition-colors",children:[s.jsx(_4,{className:"w-4 h-4"}),"Retake"]}),s.jsxs("button",{onClick:C,className:"flex-1 flex items-center justify-center gap-2 bg-emerald-500 hover:bg-emerald-600 text-white font-bold py-3 rounded-xl transition-colors",children:["Next",s.jsx(Jd,{className:"w-4 h-4"})]})]})]}),l==="socials"&&s.jsxs(s.Fragment,{children:[s.jsx("p",{className:"text-white/50 text-xs text-center mb-3",children:"Add your socials so matches can connect with you. This is optional — you can always add them later."}),s.jsxs("div",{className:"mb-4",children:[s.jsx("label",{className:"text-white/70 text-xs font-bold mb-1 block",children:"Short Bio"}),s.jsx("input",{value:b,onChange:T=>x(T.target.value.slice(0,120)),placeholder:"Tell people a little about yourself...",maxLength:120,className:"w-full bg-white/5 border border-white/10 rounded-lg px-3 py-2 text-sm text-white placeholder:text-white/30 focus:outline-none focus:border-pink-500/50"}),s.jsxs("span",{className:"text-white/30 text-[10px]",children:[b.length,"/120"]})]}),s.jsx("div",{className:"space-y-2 mb-4",children:RM.map(T=>s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("img",{src:T.icon,alt:T.label,className:"w-7 h-7 rounded-md object-contain"}),s.jsx("input",{value:g[T.key]||"",onChange:E=>O(T.key,E.target.value),placeholder:T.placeholder,className:"flex-1 bg-white/5 border border-white/10 rounded-lg px-3 py-1.5 text-sm text-white placeholder:text-white/30 focus:outline-none focus:border-pink-500/50"})]},T.key))}),s.jsxs("div",{className:"flex gap-3",children:[s.jsx("button",{onClick:()=>c("preview"),className:"flex-1 flex items-center justify-center gap-2 bg-white/10 hover:bg-white/20 text-white font-medium py-3 rounded-xl transition-colors",children:"Back"}),s.jsxs("button",{onClick:A,className:"flex-1 flex items-center justify-center gap-2 bg-emerald-500 hover:bg-emerald-600 text-white font-bold py-3 rounded-xl transition-colors",children:[s.jsx(Mr,{className:"w-5 h-5"}),P>0?"Submit":"Skip & Submit"]})]})]}),l==="uploading"&&s.jsxs("div",{className:"flex items-center justify-center gap-2 bg-white/10 text-white/60 font-medium py-3 rounded-xl",children:[s.jsx("div",{className:"w-4 h-4 border-2 border-white/40 border-t-white rounded-full animate-spin"}),"Setting you up..."]})]})]})}):null},AM=({filters:e,onFilterChange:t,countries:n,totalCount:r,filteredCount:a,linkedCount:i=0})=>s.jsxs("div",{className:"space-y-1.5",children:[s.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[s.jsx("div",{className:"flex items-center gap-1 bg-white/5 rounded-lg border border-white/10 overflow-hidden text-xs shrink-0",children:["all","male","female"].map(o=>s.jsx("button",{onClick:()=>t({...e,gender:o}),className:`px-3 py-1.5 font-medium transition-colors capitalize ${e.gender===o?"bg-pink-500 text-white":"text-white/60 hover:text-white"}`,children:o==="all"?"All":o},o))}),i>0&&s.jsxs("button",{onClick:()=>t({...e,linkedOnly:!e.linkedOnly}),className:`flex items-center gap-1.5 px-3 py-1.5 rounded-lg border text-xs font-medium transition-colors shrink-0 ${e.linkedOnly?"bg-violet-500/20 border-violet-500/40 text-violet-300":"bg-white/5 border-white/10 text-white/60 hover:text-white"}`,children:[s.jsx(Yl,{className:"w-3.5 h-3.5"}),"Linked (",i,")"]}),s.jsxs("button",{onClick:()=>t({...e,onlineOnly:!e.onlineOnly}),className:`flex items-center gap-1.5 px-3 py-1.5 rounded-lg border text-xs font-medium transition-colors shrink-0 ${e.onlineOnly?"bg-emerald-500/20 border-emerald-500/40 text-emerald-400":"bg-white/5 border-white/10 text-white/60 hover:text-white"}`,children:[s.jsx(A4,{className:"w-3.5 h-3.5"}),"Online Now"]})]}),a!==r&&s.jsxs("p",{className:"text-white/40 text-xs",children:["Showing ",a," of ",r," members"]})]}),IM=[{key:"10",minutes:10,price:"$6.99",perMinute:"$0.70/min"},{key:"30",minutes:30,price:"$17.99",perMinute:"$0.60/min",badge:"Most popular"},{key:"60",minutes:60,price:"$34.99",perMinute:"$0.58/min",badge:"Best value"}],OM=({onClose:e,balance:t})=>{const[n,r]=h.useState(null),a=async i=>{r(i);try{await vO(i),Kt({title:"Checkout opened",description:"Finish your purchase in the new tab — your minutes appear right after."})}catch(o){Kt({title:"Error",description:o.message,variant:"destructive"})}finally{r(null)}};return In.createPortal(s.jsx("div",{className:"fixed inset-0 z-[80] bg-black/80 flex items-center justify-center p-4",onClick:i=>{i.target===i.currentTarget&&e()},children:s.jsxs("div",{className:"bg-neutral-900 border border-white/10 rounded-2xl max-w-sm w-full p-6 relative",children:[s.jsx("button",{onClick:e,className:"absolute top-3 right-3 text-white/40 hover:text-white",children:s.jsx(We,{className:"w-5 h-5"})}),s.jsxs("div",{className:"flex flex-col items-center text-center gap-4",children:[s.jsx("div",{className:"w-16 h-16 rounded-full bg-gradient-to-br from-emerald-500 to-teal-500 flex items-center justify-center",children:s.jsx(v4,{className:"w-8 h-8 text-white"})}),s.jsx("h2",{className:"text-white font-bold text-xl",children:"You're out of call minutes"}),s.jsxs("p",{className:"text-white/60 text-sm leading-relaxed",children:["Video calls from Discover use call minutes. You have"," ",s.jsx("strong",{className:"text-emerald-400",children:t})," left — top up to keep calling."]}),s.jsx("div",{className:"w-full space-y-2",children:IM.map(i=>s.jsxs("button",{onClick:()=>a(i.key),disabled:n!==null,className:"w-full flex items-center justify-between gap-3 rounded-xl bg-white/5 hover:bg-white/10 border border-white/10 px-4 py-3 transition-colors disabled:opacity-50",children:[s.jsxs("span",{className:"text-left",children:[s.jsxs("span",{className:"block text-white font-bold text-sm",children:[i.minutes," call minutes"]}),s.jsx("span",{className:"block text-white/40 text-xs",children:i.perMinute})]}),s.jsxs("span",{className:"flex items-center gap-2",children:[i.badge&&s.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wide text-emerald-300 bg-emerald-500/15 border border-emerald-500/30 px-2 py-0.5 rounded-full",children:i.badge}),n===i.key?s.jsx(us,{className:"w-4 h-4 text-white animate-spin"}):s.jsx("span",{className:"text-white font-black text-sm",children:i.price})]})]},i.key))}),s.jsx("button",{onClick:e,className:"text-white/40 hover:text-white/60 text-sm transition-colors",children:"Maybe later"})]})]})}),document.body)};function Pd(e,t={}){if(!e)return"";if(!e.includes("/storage/v1/object/public/"))return e;const n=e.replace("/storage/v1/object/public/","/storage/v1/render/image/public/"),r=new URLSearchParams;t.width&&r.set("width",String(t.width)),t.height&&r.set("height",String(t.height)),r.set("qual
543ity",String(t.quality??70)),t.resize&&r.set("resize",t.resize);const a=n.includes("?")?"&":"?";return`${n}${a}${r.toString()}`}function DM(e,t,n=70){if(!e)return"";const r=Pd(e,{width:t,quality:n,resize:"cover"}),a=Pd(e,{width:t*2,quality:n,resize:"cover"});return`${r} 1x, ${a} 2x`}const LM=[{tier:"100",minutes:100,price:"$1.99",label:"🎁 Gift 100 Minutes — $1.99"},{tier:"400",minutes:400,price:"$4.99",label:"🎁 Gift 400 Minutes — $4.99",bonus:"You get +100 Minutes back!"},{tier:"600",minutes:600,price:"$7.99",label:"🎁 Gift 600 Minutes — $7.99",bonus:"You get +150 Minutes back!"},{tier:"1000",minutes:1e3,price:"$12.99",label:"🎁 Gift 1000 Minutes — $12.99",bonus:"You get +250 Minutes back!"}],MM=({recipientId:e,recipientName:t,onClose:n})=>{const[r,a]=h.useState(null),i=async o=>{a(o);try{const{data:l,error:c}=await S.functions.invoke("gift-minutes",{body:{action:"create-checkout",tier:o,recipient_id:e}});if(c)throw c;if(l!=null&&l.error)throw new Error(l.error);l!=null&&l.url&&(window.open(l.url,"_blank","noopener,noreferrer"),n())}catch(l){B.error(l.message||"Failed to start gift checkout")}finally{a(null)}};return In.createPortal(s.jsx("div",{className:"fixed inset-0 z-[70] bg-black/80 flex items-center justify-center px-4 overflow-y-auto py-6",onClick:n,children:s.jsxs("div",{className:"bg-neutral-900 border border-white/10 rounded-2xl p-5 w-full max-w-xs relative my-auto",onClick:o=>o.stopPropagation(),children:[s.jsx("button",{onClick:n,className:"absolute top-3 right-3 text-white/40 hover:text-white",children:s.jsx(We,{className:"w-5 h-5"})}),s.jsxs("div",{className:"text-center mb-5",children:[s.jsx("div",{className:"w-12 h-12 rounded-full bg-amber-500/20 flex items-center justify-center mx-auto mb-2",children:s.jsx(Ft,{className:"w-6 h-6 text-amber-400"})}),s.jsx("h2",{className:"text-white font-bold text-lg",children:"Gift Minutes"}),s.jsxs("p",{className:"text-white/50 text-xs mt-0.5",children:["Send minutes to ",s.jsx("span",{className:"text-white font-semibold",children:t})]})]}),s.jsx("div",{className:"space-y-3",children:LM.map(o=>s.jsxs("div",{children:[s.jsx("button",{onClick:()=>i(o.tier),disabled:r!==null,className:"w-full bg-amber-500 hover:bg-amber-400 text-black font-bold text-sm py-3 rounded-xl transition-colors disabled:opacity-50",children:r===o.tier?"Loading...":o.label}),o.bonus&&s.jsx("p",{className:"text-emerald-400 text-[10px] font-bold text-center mt-1",children:o.bonus})]},o.tier))}),s.jsx("p",{className:"text-white/30 text-[10px] text-center mt-4",children:"Paid via Stripe • Recipient can cash out earned minutes"}),s.jsx("p",{className:"text-red-500/70 text-[10px] font-bold text-center mt-1 tracking-wider",children:"NO REFUND POLICY"})]})}),document.body)},$M=({member:e,alreadyInterested:t,isMutualMatch:n,sendingInterest:r,mutualSocials:a,onInterest:i,myGender:o,isOwner:l,isVip:c,isModerator:d,isSelf:u,linkedExpiresAt:f})=>{var xe;const[m,p]=h.useState(!1),[v,g]=h.useState(null),[y,b]=h.useState(!1),[x,w]=h.useState(!1),[_,j]=h.useState(!1),[N,k]=h.useState(!1),{user:C}=it(),{vipTier:A,loading:I,startCheckout:O}=_c((C==null?void 0:C.id)??null),{data:P=0,refetch:T}=yO((C==null?void 0:C.id)??null),E=sn(),W=Es(e.last_active_at),V=nD(e.created_at),q=((xe=e.gender)==null?void 0:xe.toLowerCase())==="female",D=W||!u&&Kj(e.id,e.gender),$=!D&&!!e.last_active_at&&Date.now()-new Date(e.last_active_at).getTime()<24*60*60*1e3,z=!u&&(o==null?void 0:o.toLowerCase())==="male"&&q,R=h.useRef(!1),U=()=>{!C||u||!e.id||R.current||(R.current=!0,S.from("discover_profile_views").insert({viewer_id:C.id,viewed_member_id:e.id}).then(()=>{}))},ee=async()=>{if(C){if(U(),kp(o,e.gender,I?null:A)){const{data:te}=await S.from("member_minutes").select("is_vip, vip_tier, admin_granted_vip").eq("user_id",C.id).maybeSingle(),ce=te!=null&&te.is_vip||te!=null&&te.admin_granted_vip?(te==null?void 0:te.vip_tier)??"premium":null;if(kp(o,e.gender,ce)){j(!0);return}}if((o==null?void 0:o.toLowerCase())==="male"&&q){const{data:te}=await T();if((te??P)<=0){k(!0);return}}try{const{data:te,error:ce}=await S.from("direct_call_invites").insert({inviter_id:C.id,invitee_id:e.id}).select("id").single();if(ce)throw ce;g({inviteId:te.id}
543),Kt({title:"📹 Starting video chat",description:`Calling ${e.name}...`})}catch(te){Kt({title:"Error",description:te.message,variant:"destructive"})}}},ae=()=>{e.image_url&&(U(),w(!0))};return s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:`relative group rounded-xl overflow-hidden bg-white/5 border ${u?"border-cyan-500/50 ring-1 ring-cyan-500/30":l?"border-amber-500/50 ring-1 ring-amber-500/30":"border-white/10"} hover:border-white/20 transition-colors ${e.image_url?"cursor-pointer":""}`,onClick:ae,children:[s.jsxs("div",{className:"absolute top-1.5 left-1.5 sm:top-2 sm:left-2 z-10 flex flex-col gap-0.5 sm:gap-1",children:[D&&s.jsxs("span",{className:"flex items-center gap-0.5 bg-emerald-500/90 text-white text-[8px] sm:text-[10px] font-bold px-1.5 py-0.5 rounded-full backdrop-blur-sm",children:[s.jsx("span",{className:"w-1 h-1 sm:w-1.5 sm:h-1.5 rounded-full bg-white animate-pulse"}),"Online"]}),$&&s.jsxs("span",{className:"flex items-center gap-0.5 bg-orange-500/90 text-white text-[8px] sm:text-[10px] font-bold px-1.5 py-0.5 rounded-full backdrop-blur-sm shadow-lg",children:[s.jsx(nh,{className:"w-2 h-2 sm:w-2.5 sm:h-2.5 fill-current"}),"Very Active"]}),V&&s.jsxs("span",{className:"flex items-center gap-0.5 bg-amber-500/90 text-white text-[8px] sm:text-[10px] font-bold px-1.5 py-0.5 rounded-full backdrop-blur-sm",children:[s.jsx(yr,{className:"w-2 h-2 sm:w-2.5 sm:h-2.5"}),"New"]}),f&&s.jsxs("span",{className:"flex items-center gap-0.5 bg-violet-500/90 text-white text-[8px] sm:text-[10px] font-bold px-1.5 py-0.5 rounded-full backdrop-blur-sm shadow-lg",children:[s.jsx(Yl,{className:"w-2 h-2 sm:w-2.5 sm:h-2.5"}),"Linked · ",Math.max(0,Math.ceil((new Date(f).getTime()-Date.now())/864e5)),"d"]}),n&&s.jsx("span",{className:"flex items-center gap-0.5 bg-pink-500/90 text-white text-[8px] sm:text-[10px] font-bold px-1.5 py-0.5 rounded-full backdrop-blur-sm",children:"💕 Match!"}),l&&s.jsxs("span",{className:"flex items-center gap-0.5 bg-gradient-to-r from-amber-500 to-yellow-500 text-black text-[8px] sm:text-[10px] font-bold px-1.5 py-0.5 rounded-full shadow-lg",children:[s.jsx(cs,{className:"w-2 h-2 sm:w-2.5 sm:h-2.5"}),"Owner"]}),c&&!l&&s.jsxs("span",{className:"flex items-center gap-0.5 bg-gradient-to-r from-purple-500 to-pink-500 text-white text-[8px] sm:text-[10px] font-bold px-1.5 py-0.5 rounded-full shadow-lg",children:[s.jsx(yr,{className:"w-2 h-2 sm:w-2.5 sm:h-2.5"}),"VIP"]}),d&&!l&&s.jsxs("span",{className:"flex items-center gap-0.5 bg-gradient-to-r from-blue-500 to-cyan-500 text-white text-[8px] sm:text-[10px] font-bold px-1.5 py-0.5 rounded-full shadow-lg",children:[s.jsx(N_,{className:"w-2 h-2 sm:w-2.5 sm:h-2.5"}),"Mod"]}),u&&s.jsx("span",{className:"flex items-center gap-0.5 bg-gradient-to-r from-cyan-500 to-blue-500 text-white text-[8px] sm:text-[10px] font-bold px-1.5 py-0.5 rounded-full shadow-lg",children:"👤 You"})]}),s.jsx("div",{className:"aspect-[3/4] overflow-hidden",children:e.image_url?s.jsx("img",{src:Pd(e.image_url,{width:400,quality:70,resize:"cover"}),srcSet:DM(e.image_url,400),sizes:"(max-width: 640px) 50vw, (max-width: 1024px) 33vw, 300px",width:400,height:533,alt:e.name,className:"w-full h-full object-cover group-hover:scale-105 transition-transform duration-300",loading:"lazy",decoding:"async"}):s.jsx("div",{className:"w-full h-full flex items-center justify-center bg-white/5 text-white/20 text-4xl font-bold",children:e.name.charAt(0).toUpperCase()})}),s.jsxs("div",{className:"absolute bottom-0 left-0 right-0 bg-gradient-to-t from-black/90 via-black/60 to-transparent p-2 sm:p-3 pt-10 sm:pt-12",children:[e.bio&&s.jsxs("p",{className:"text-white/70 text-[10px] sm:text-[11px] mb-1 sm:mb-1.5 line-clamp-2 italic",children:['"',e.bio,'"']}),s.jsxs("div",{className:"min-w-0 mb-1.5 sm:mb-2",children:[s.jsxs("p",{className:"font-bold text-white text-xs sm:text-sm truncate",children:[e.name,l&&s.jsx(cs,{className:"inline w-3 h-3 sm:w-3.5 sm:h-3.5 ml-1 text-amber-400"})]}),s.jsxs("div",{className:"flex items-center gap-1 mt-0.5 flex-wrap",children:[e.country&&s.jsx("span",{className:"text-white/50 text-[10px] sm:text-xs",children:e.country}),s.jsx("span",{className:`text-[10px] sm:text-xs ${D?"text-emerald-400":"text-white/40"}`,children:D?"Online":vp(e.last_active_at)})]})]}),!u&&s.jsxs("div",{className:"flex items-center gap-1 sm:gap-1.5",children:[s.jsxs("div",{className:"relative",children:[s.jsx("button",{onClick:te=>{te.stopPropagation(),ee()},className:"w-7 h-7 sm:w-9 sm:h-9 rounded-full flex items-center justify-center bg-emerald-500/80 hover:bg-emerald-500 text-white transition-all",title:z?`Request Video Chat — ${P} call minutes left`:"Request Video Chat",children:s.jsx(mr,{className:"w-3 h-3 sm:w-4 sm:h-4"})}),z&&s.jsx("span",{className:`absolute -top-1.5 -right-1.5 min-w-[16px] px-1 h-4 rounded-full flex items-center justify-center text-[9px] font-black leading-none border border-black/40 ${P>0?"bg-emerald-400 text-black":"bg-red-500 text-white"}`,title:`${P} call minutes left`,children:P})]}),s.jsx("button",{onClick:te=>{te.stopPropagation(),U(),E(`/messages?to=${e.id}`)},className:"w-7 h-7 sm:w-9 sm:h-9 rounded-full flex items-center justify-center bg-blue-500/80 hover:bg-blue-500 text-white transition-all",title:"Send Message",children:s.jsx(An,{className:"w-3 h-3 sm:w-4 sm:h-4"})}),a&&a.length>0&&s.jsx("button",{onClick:te=>{te.stopPropagation(),p(!m)},className:"w-7 h-7 sm:w-9 sm:h-9 rounded-full flex items-center justify-center bg-purple-500/80 hover:bg-purple-500 text-white transition-all",title:"View socials",children:s.jsx(Yl,{className:"w-3 h-3 sm:w-4 sm:h-4"})}),s.jsx("button",{onClick:te=>{te.stopPropagation(),b(!0)},className:"w-7 h-7 sm:w-9 sm:h-9 rounded-full flex items-center justify-center bg-amber-500/80 hover:bg-amber-500 text-white transition-all",title:"Gift Minutes",children:s.jsx(Ft,{className:"w-3 h-3 sm:w-4 sm:h-4"})}),s.jsx("button",{onClick:te=>{te.stopPropagation(),t||i(e.id)},disabled:t||r,className:`w-7 h-7 sm:w-9 sm:h-9 rounded-full flex items-center justify-center transition-all ${t?"bg-pink-500 text-white":"bg-white/15 hover:bg-pink-500 text-white/70 hover:text-white"}`,children:r?s.jsx("div",{className:"w-3 h-3 sm:w-4 sm:h-4 border-2 border-white/40 border-t-white rounded-full animate-spin"}):s.jsx($0,{className:`w-3 h-3 sm:w-4 sm:h-4 ${t?"fill-current":""}`})})]}),m&&a&&s.jsx("div",{className:"mt-2",onClick:te=>{te.stopPropagation()},children:s.jsx(Cd,{pinnedSocials:a})})]})]}),v&&C&&s.jsx(Z0,{myUserId:C.id,partnerId:e.id,partnerName:e.name,inviteId:v.inviteId,isInitiator:!0,onClose:()=>g(null)}),y&&s.jsx(MM,{recipientId:e.id,recipientName:e.name,onClose:()=>b(!1)}),_&&s.jsx(Qj,{onClose:()=>j(!1),onSubscribe:te=>{j(!1),O(te,"discover_card_vip_call_gate")}}),N&&s.jsx(OM,{balance:P,onClose:()=>k(!1)}),x&&e.image_url&&typeof document<"u"&&In.createPortal(s.jsxs("div",{className:"fixed inset-0 z-[100] bg-black/95 flex items-center justify-center p-4",onClick:te=>{te.target===te.currentTarget&&w(!1)},children:[s.jsx("button",{onClick:()=>w(!1),className:"absolute top-4 right-4 z-[101] bg-white/10 hover:bg-white/20 rounded-full p-2 transition-colors",children:s.jsx(We,{className:"w-6 h-6 text-white"})}),s.jsxs("div",{className:"relative max-w-md w-full rounded-2xl overflow-hidden bg-black/80 border border-white/10",children:[s.jsx("img",{src:Pd(e.image_url,{width:800,quality:80}),alt:e.name,loading:"eager",decoding:"async",className:"w-full max-h-[70vh] object-contain"}),s.jsxs("div",{className:"p-4 text-center",children:[s.jsx("p",{className:"text-white font-bold text-lg",children:e.name}),e.country&&s.jsx("p",{className:"text-white/50 text-sm",children:e.country}),e.bio&&s.jsxs("p",{className:"text-white/70 text-sm mt-1.5 italic",children:['"',e.bio,'"']})]})]})]}),document.body)]})},FM=e=>{const t=(e==null?void 0:e.toLowerCase())||null;return he({queryKey:["discover-inline-rewards",t],staleTime:12e4,queryFn:async()=>{const{data:n}=await S.from("rewards").select("id, title, image_url, rarity, minutes_cost, type, sub_type, target_gender").eq("visible",!0).order("minutes_cost",{ascending:!0}).limit(40);if(!n)return[];const a=n.filter(i=>i.type==="giftcard"||i.sub_type==="giftcard"||!i.target_gender?!0:!!t&&i.target_gender.toLowerCase()===t).filter(i=>i.image_url);for(let i=a.length-1;i>0;i--){const o=Math.floor(Math.random()*(i+1));[a[i],a[o]]=[a[o],a[i]]}return a.slice(0,12)}})},UM=({reward:e})=>{const t=sn();return s.jsxs("button",{onClick:()=>t("/store"),className:"relative aspect-[3/4] w-full rounded-xl overflow-hidden group border border-amber-400/30 hover:border-amber-400/70 transition-colors text-left",children:[e.image_url?s.jsx("img",{src:e.image_url,alt:e.title,className:"w-full h-full object-cover group-hover:scale-105 transition-transform duration-300",loading:"lazy"}):s.jsx("div",{className:"w-full h-full bg-white/5 flex items-center justify-center",children:s.jsx(Ft,{className:"w-8 h-8 text-white/30"})}),s.jsxs("div",{className:"absolute top-1.5 left-1.5 flex items-center gap-1 bg-amber-500 text-black text-[9px] font-black px-1.5 py-0.5 rounded-full",children:[s.jsx(Ft,{className:"w-2.5 h-2.5"}),"REWARD"]}),e.rarity==="legendary"&&s.jsx("div",{className:"absolute top-1.5 right-1.5 bg-black/70 text-amber-400 text-[9px] font-black px-1.5 py-0.5 rounded-full",children:"★"}),s.jsxs("div",{className:"absolute bottom-0 inset-x-0 bg-gradient-to-t from-black/95 via-black/50 to-transparent p-2 pt-6",children:[s.jsx("p",{className:"text-white text-xs font-bold truncate",children:e.title}),s.jsxs("p",{className:"text-amber-400 text-[10px] font-semibold",children:[e.minutes_cost," min"]}),s.jsx("span",{className:"mt-1.5 block w-full py-1 rounded-md bg-amber-500 group-hover:bg-amber-400 text-black text-[10px] font-bold text-center transition-colors",children:"Redeem"})]})]})},BM=[{key:"instagram",label:"Instagram",icon:fh,placeholder:"@username"},{key:"tiktok",label:"TikTok",icon:hh,placeholder:"@username"},{key:"snapchat",label:"Snapchat",icon:mh,placeholder:"/username"},{key:"discord",label:"Discord",icon:rx,placeholder:"username"},{key:"cashapp",label:"CashApp",icon:dh,placeholder:"$cashtag"},{key:"venmo",label:"Venmo",icon:ph,placeholder:"/username"},{key:"paypal",label:"PayPal",icon:xh,placeholder:"@username"}],zM=({userId:e})=>{const[t,n]=h.useState(!1),[r,a]=h.useState(""),[i,o]=h.useState({}
543),[l,c]=h.useState(!1),[d,u]=h.useState(!1),[f,m]=h.useState(null),[p,v]=h.useState("pending"),[g,y]=h.useState(!1);h.useEffect(()=>{(async()=>{const[{data:j},{data:N}]=await Promise.all([S.from("members").select("bio, image_url, image_status").eq("id",e).single(),S.from("vip_settings").select("pinned_socials").eq("user_id",e).maybeSingle()]);if(a((j==null?void 0:j.bio)||""),m((j==null?void 0:j.image_url)||null),v((j==null?void 0:j.image_status)||"pending"),N!=null&&N.pinned_socials){const k={};N.pinned_socials.forEach(C=>{const[A,...I]=C.split(":");k[A]=I.join(":")}),o(k)}u(!0)})()},[e]);const b=async()=>{c(!0),await S.from("members").update({bio:r.trim()||null}).eq("id",e);const _=Object.entries(i).filter(([,N])=>N.trim()).map(([N,k])=>`${N}:${k.trim()}`),{data:j}=await S.from("vip_settings").select("id").eq("user_id",e).maybeSingle();j?await S.from("vip_settings").update({pinned_socials:_,updated_at:new Date().toISOString()}).eq("user_id",e):await S.from("vip_settings").insert({user_id:e,pinned_socials:_}),c(!1),Kt({title:"Profile updated! ✨"})};if(!d)return null;
543Object.values(i).filter(_=>_.trim()).length;const x=p==="approved"?{icon:ra,label:"Approved",color:"text-emerald-400",bg:"bg-emerald-500/10 border-emerald-500/30"}:p==="denied"?{icon:l4,label:"Denied — retake required",color:"text-red-400",bg:"bg-red-500/10 border-red-500/30"}:{icon:er,label:"Pending review",color:"text-yellow-400",bg:"bg-yellow-500/10 border-yellow-500/30"},w=x.icon;return s.jsxs("div",{className:"mx-3 mt-2 space-y-2 sm:mx-4",children:[f&&s.jsx("div",{className:"rounded-lg border border-white/10 bg-white/5 px-3 py-2",children:s.jsxs("div",{className:"flex items-center gap-2.5",children:[s.jsx("img",{src:f,alt:"Your selfie",className:"h-10 w-10 rounded-full border border-white/10 object-cover"}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("p",{className:"text-white text-xs font-semibold",children:"Your Discover selfie"}),s.jsxs("div",{className:`mt-0.5 inline-flex items-center gap-1 text-[11px] font-semibold ${x.color}`,children:[s.jsx(w,{className:`w-3 h-3 ${x.color}`}),s.jsx("span",{children:x.label})]})]}),s.jsxs("button",{onClick:()=>y(!0),className:"flex h-8 items-center gap-1 rounded-md border border-pink-500/30 bg-pink-500/15 px-2.5 text-xs font-semibold text-pink-300 transition-colors hover:bg-pink-500/25",children:[s.jsx(Qa,{className:"w-3.5 h-3.5"}),"Retake"]}),s.jsx("button",{onClick:()=>n(!t),className:"flex h-8 w-8 items-center justify-center rounded-md bg-white/5 text-white/60 transition-colors hover:bg-white/10 hover:text-white","aria-label":t?"Close profile editor":"Edit profile",title:t?"Close profile editor":"Edit profile",children:t?s.jsx(tp,{className:"h-4 w-4"}):s.jsx(bd,{className:"h-4 w-4"})})]})}),t&&s.jsxs("div",{className:"mt-2 p-3 rounded-lg bg-white/5 border border-white/10 space-y-3",children:[s.jsxs("div",{children:[s.jsx("label",{className:"text-white/60 text-xs font-bold mb-1 block",children:"Short Bio"}),s.jsx("input",{value:r,onChange:_=>a(_.target.value.slice(0,120)),placeholder:"Tell people about yourself...",maxLength:120,className:"w-full bg-white/5 border border-white/10 rounded-lg px-3 py-2 text-sm text-white placeholder:text-white/30 focus:outline-none focus:border-pink-500/50"}),s.jsxs("span",{className:"text-white/30 text-[10px]",children:[r.length,"/120"]})]}),s.jsxs("div",{children:[s.jsx("label",{className:"text-white/60 text-xs font-bold mb-1.5 block",children:"My Socials"}),s.jsx("div",{className:"space-y-1.5",children:BM.map(_=>s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("img",{src:_.icon,alt:_.label,className:"w-6 h-6 rounded object-contain"}),s.jsx("input",{value:i[_.key]||"",onChange:j=>o(N=>({...N,[_.key]:j.target.value})),placeholder:_.placeholder,className:"flex-1 bg-white/5 border border-white/10 rounded-lg px-3 py-1.5 text-xs text-white placeholder:text-white/30 focus:outline-none focus:border-pink-500/50"})]},_.key))})]}),s.jsxs("button",{onClick:b,disabled:l,className:"w-full flex items-center justify-center gap-2 bg-pink-500 hover:bg-pink-600 text-white text-sm font-bold py-2.5 rounded-xl transition-colors disabled:opacity-50",children:[l?s.jsx("div",{className:"w-4 h-4 border-2 border-white/40 border-t-white rounded-full animate-spin"}):s.jsx(Mr,{className:"w-4 h-4"}),l?"Saving...":"Save Profile"]})]}),s.jsx(ux,{open:g,onClose:()=>y(!1),onComplete:_=>{y(!1),m(_),v("pending")}})]})},qM=({onClose:e})=>{const{user:t,members:n,allMembers:r,loading:a,myInterests:i,incomingInterestsList:o,isDiscoverable:l,setIsDiscoverable:c,myGender:d,sendingInterest:u,filters:f,setFilters:m,countries:p,mutualSocials:v,isMutualMatch:g,handleInterest:y,handleRemoveListing:b}=rD(),{data:x=0}=Gj(),{data:w=[]}=FM(d),[_,j]=h.useState(!1),[N,k]=h.useState(null),[C,A]=h.useState(0),[I,O]=h.useState(!1),P=h.useMemo(()=>{if(C===0)return n;const W=[...n];let V=C;for(let q=W.length-1;q>0;q--){V=(V*16807+0)%2147483647;const D=V%(q+1);[W[q],W[D]]=[W[D],W[q]]}return W},[n,C]),T=h.useCallback(()=>{O(!0),setTimeout(()=>{A(Date.now()),O(!1)},400)},[]),E=()=>{j(!1),c(!0)};return N!==null?s.jsx(lx,{onClose:()=>k(null),initialPartnerId:N||void 0}):s.jsxs("div",{className:"min-h-full bg-[#111] text-white pb-20",children:[s.jsx("div",{className:"sticky top-0 z-10 bg-[#111]/95 backdrop-blur-md border-b border-white/10 px-3 sm:px-4 py-2 sm:py-3",children:s.jsxs("div",{className:"flex items-center gap-2 sm:gap-3",children:[s.jsx(Ur,{className:"w-4 h-4 sm:w-5 sm:h-5 text-pink-400 shrink-0"}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("h1",{className:"font-bold text-base sm:text-lg",children:"Discover"}),s.jsx("p",{className:"text-white/50 text-[10px] sm:text-xs hidden sm:block",children:"Browse while you wait for a match"})]}),s.jsxs("button",{onClick:()=>k(""),className:"relative flex items-center gap-1 sm:gap-1.5 bg-blue-500/20 hover:bg-blue-500/30 text-blue-400 text-xs sm:text-sm font-semibold px-2 sm:px-3 py-1.5 sm:py-2 rounded-lg transition-colors border border-blue-500/30",children:[s.jsx(m4,{className:"w-3.5 h-3.5 sm:w-4 sm:h-4"}),s.jsx("span",{className:"hidden sm:inline",children:"DMs"}),x>0&&s.jsx("span",{className:"absolute -top-1.5 -right-1.5 bg-red-500 text-white text-[9px] font-bold w-4 h-4 rounded-full flex items-center justify-center",children:x>9?"9+":x})]}),l?s.jsxs("button",{onClick:b,className:"flex items-center gap-1 sm:gap-1.5 bg-red-500/20 hover:bg-red-500/30 text-red-400 text-xs sm:text-sm font-semibold px-2 sm:px-3 py-1.5 sm:py-2 rounded-lg transition-colors border border-red-500/30",children:[s.jsx(th,{className:"w-3.5 h-3.5 sm:w-4 sm:h-4"}),s.jsx("span",{className:"hidden sm:inline",children:"Remove"})]}):s.jsxs("button",{onClick:()=>j(!0),className:"flex items-center gap-1 sm:gap-1.5 bg-pink-500 hover:bg-pink-600 text-white text-xs sm:text-sm font-semibold px-2 sm:px-3 py-1.5 sm:py-2 rounded-lg transition-colors",children:[s.jsx(Qa,{className:"w-3.5 h-3.5 sm:w-4 sm:h-4"}),s.jsx("span",{className:"hidden sm:inline",children:"Get Listed"}),s.jsx("span",{className:"sm:hidden",children:"List"})]})]})}),s.jsxs("div",{className:"mx-4 mt-3 p-3 rounded-xl bg-emerald-500/10 border border-emerald-500/30 flex items-center gap-3",children:[s.jsx("div",{className:"w-2.5 h-2.5 rounded-full bg-emerald-500 animate-pulse shrink-0"}),s.jsx("p",{className:"text-emerald-300 text-sm font-medium",children:"Still searching for a match — browse while you wait!"})]}),!l&&s.jsx("div",{className:"mx-4 mt-3 p-4 rounded-xl bg-gradient-to-r from-pink-500/20 to-purple-500/20 border border-pink-500/30",children:s.jsxs("div",{className:"flex items-start gap-3",children:[s.jsx(yr,{className:"w-6 h-6 text-pink-400 shrink-0 mt-0.5"}),s.jsxs("div",{children:[s.jsx("h3",{className:"font-bold text-white mb-1",children:"Get discovered!"}),s.jsxs("p",{className:"text-white/70 text-sm mb-3",children:["Take a quick selfie to let others find you. We'll email you when someone wants to connect",d==="female"?s.jsxs(s.Fragment,{children:[" — ",s.jsx("span",{className:"text-pink-300 font-semibold",children:"earn cash"})," by chatting!"]}):s.jsx(s.Fragment,{children:"!"})]}),s.jsx("button",{onClick:()=>j(!0),className:"bg-pink-500 hover:bg-pink-600 text-white text-sm font-bold px-4 py-2 rounded-lg transition-colors",children:"📸 Take Selfie & Get Listed"})]})]})}),!a&&r.length>0&&s.jsx(AM,{filters:f,onFilterChange:m,countries:p,totalCount:r.length,filteredCount:n.length}),l&&t&&s.jsx(zM,{userId:t.id}),s.jsx("div",{className:"p-4",children:a?s.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 xl:grid-cols-5 ga
543p-3",children:[...Array(6)].map((W,V)=>s.jsx("div",{className:"aspect-[3/4] rounded-xl bg-white/5 animate-pulse"},V))}):n.length===0?s.jsxs("div",{className:"text-center py-16",children:[s.jsx(Qa,{className:"w-12 h-12 text-white/20 mx-auto mb-3"}),s.jsx("h3",{className:"text-white/60 font-medium mb-1",children:"No one here yet"}),s.jsx("p",{className:"text-white/40 text-sm",children:"Be the first to get listed!"})]}):s.jsx("div",{className:`grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 xl:grid-cols-5 gap-3 transition-opacity duration-300 ${I?"opacity-0 scale-95":"opacity-100 scale-100"}`,children:P.map((W,V)=>{const q=Math.floor(V/6),D=V>0&&V%6===0&&w.length>0;return s.jsxs(h.Fragment,{children:[D&&s.jsx(UM,{reward:w[(q-1)%w.length]}),s.jsx($M,{member:W,alreadyInterested:i.has(W.id),isMutualMatch:g(W.id),sendingInterest:u===W.id,mutualSocials:v.get(W.id),onInterest:y,myGender:d,isSelf:W.id===(t==null?void 0:t.id)})]},W.id)})})}),n.length>1&&s.jsx("div",{className:"fixed bottom-6 left-1/2 -translate-x-1/2 z-20",children:s.jsxs("button",{onClick:T,disabled:I,className:"group relative flex items-center gap-2 px-6 py-3 rounded-full bg-gradient-to-r from-pink-500 via-purple-500 to-indigo-500 text-white font-bold text-sm shadow-lg shadow-purple-500/30 hover:shadow-purple-500/50 hover:scale-105 active:scale-95 transition-all duration-200 disabled:opacity-70",children:[s.jsx(C4,{className:`w-4 h-4 transition-transform duration-500 ${I?"animate-spin":"group-hover:rotate-180"}`}),"Shuffle",s.jsx("span",{className:"absolute inset-0 rounded-full bg-white/10 opacity-0 group-hover:opacity-100 transition-opacity"})]})}),s.jsx(ux,{open:_,onClose:()=>j(!1),onComplete:E})]})},VM={active:!0,breakpoints:{},delay:4e3,jump:!1,playOnInit:!0,stopOnFocusIn:!0,stopOnInteraction:!0,stopOnMouseEnter:!1,stopOnLastSnap:!1,rootNode:null};function WM(e,t){const n=e.scrollSnapList();return typeof t=="number"?n.map(()=>t):t(n,e)}function HM(e,t){const n=e.rootNode();return t&&t(n)||n}function vh(e={}){let t,n,r,a,i=null,o=0,l=!1,c=!1,d=!1,u=!1;function f(E,W){n=E;const{mergeOptions:V,optionsAtMedia:q}=W,D=V(VM,vh.globalOptions),$=V(D,e);if(t=q($),n.scrollSnapList().length<=1)return;u=t.jump,r=!1,a=WM(n,t.delay);const{eventStore:z,ownerDocument:R}=n.internalEngine(),U=!!n.internalEngine().options.watchDrag,ee=HM(n,t.rootNode);z.add(R,"visibilitychange",b),U&&n.on("pointerDown",w),U&&!t.stopOnInteraction&&n.on("pointerUp",_),t.stopOnMouseEnter&&z.add(ee,"mouseenter",j),t.stopOnMouseEnter&&!t.stopOnInteraction&&z.add(ee,"mouseleave",N),t.stopOnFocusIn&&n.on("slideFocusStart",y),t.stopOnFocusIn&&!t.stopOnInteraction&&z.add(n.containerNode(),"focusout",g),t.playOnInit&&g()}function m(){n.off("pointerDown",w).off("pointerUp",_).off("slideFocusStart",y),y(),r=!0,l=!1}function p(){const{ownerWindow:E}=n.internalEngine();E.clearTimeout(o),o=E.setTimeout(O,a[n.selectedScrollSnap()]),i=new Date().getTime(),n.emit("autoplay:timerset")}function v(){const{ownerWindow:E}=n.internalEngine();E.clearTimeout(o),o=0,i=null,n.emit("autoplay:timerstopped")}function g(){if(!r){if(x()){d=!0;return}l||n.emit("autoplay:play"),p(),l=!0}}function y(){r||(l&&n.emit("autoplay:stop"),v(),l=!1)}function b(){if(x())return d=l,y();d&&g()}function x(){const{ownerDocument:E}=n.internalEngine();return E.visibilityState==="hidden"}function w(){c||y()}function _(){c||g()}function j(){c=!0,y()}function N(){c=!1,g()}function k(E){typeof E<"u"&&(u=E),g()}function C(){l&&y()}function A(){l&&g()}function I(){return l}function O(){const{index:E}=n.internalEngine(),W=E.clone().add(1).get(),V=n.scrollSnapList().length-1,q=t.stopOnLastSnap&&W===V;if(n.canScrollNext()?n.scrollNext(u):n.scrollTo(0,u),n.emit("autoplay:select"),q)return y();g()}function P(){if(!i)return null;const E=a[n.selectedScrollSnap()],W=new Date().getTime()-i;return E-W}return{name:"autoplay",options:e,init:f,destroy:m,play:k,stop:C,reset:A,isPlaying:I,timeUntilNext:P}}vh.globalOptions=void 0;function GM(e){return Object.prototype.toString.call(e)==="[object Object]"}function Sy(e){return GM(e)||Array.isArray(e)}function KM(){return!!(typeof window<"u"&&window.document&&window.document.createElement)}function dx(e,t){const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;const a=JSON.stringify(Object.keys(e.breakpoints||{})),i=JSON.stringify(Object.keys(t.breakpoints||{}));return a!==i?!1:n.every(o=>{const l=e[o],c=t[o];return typeof l=="function"?`${l}`==`${c}`:!Sy(l)||!Sy(c)?l===c:dx(l,c)})}function Cy(e){return e.concat().sort((t,n)=>t.name>n.name?1:-1).map(t=>t.options)}function YM(e,t){if(e.length!==t.length)return!1;const n=Cy(e),r=Cy(t);return n.every((a,i)=>{const o=r[i];return dx(a,o)})}function hx(e){return typeof e=="number"}function Ep(e){return typeof e=="string"}function wh(e){return typeof e=="boolean"}function Ey(e){return Object.prototype.toString.call(e)==="[object Object]"}function Nt(e){return Math.abs(e)}function fx(e){return Math.sign(e)}function Cl(e,t){return Nt(e-t)}function QM(e,t){if(e===0||t===0||Nt(e)<=Nt(t))return 0;const n=Cl(Nt(e),Nt(t));return Nt(n/e)}function JM(e){return Math.round(e*100)/100}function oc(e){return lc(e).map(Number)}function gr(e){return e[jc(e)]}function jc(e){return Math.max(0,e.length-1)}function mx(e,t){return t===jc(e)}function Py(e,t=0){return Array.from(Array(e),(n,r)=>t+r)}function lc(e){return Object.keys(e)}function XN(e,t){return[e,t].reduce((n,r)=>(lc(r).forEach(a=>{const i=n[a],o=r[a],l=Ey(i)&&Ey(o);n[a]=l?XN(i,o):o}),n),{})}function Pp(e,t){return typeof t.MouseEvent<"u"&&e instanceof t.MouseEvent}function XM(e,t){const n={start:r,center:a,end:i};function r(){return 0}function a(c){return i(c)/2}function i(c){return t-c}function o(c,d){return Ep(e)?n[e](c):e(t,c,d)}return{measure:o}}function cc(){let e=[];function t(a,i,o,l={passive:!0}){let c;if("addEventListener"in a)a.addEventListener(i,o,l),c=()=>a.removeEventListener(i,o,l);else{const d=a;d.addListener(o),c=()=>d.removeListener(o)}return e.push(c),r}function n(){e=e.filter(a=>a())}const r={add:t,clear:n};return r}function ZM(e,t,n,r){const a=cc(),i=1e3/60;let o=null,l=0,c=0;function d(){a.add(e,"visibilitychange",()=>{e.hidden&&v()})}function u(){p(),a.clear()}function f(y){if(!c)return;o||(o=y,n(),n());const b=y-o;for(o=y,l+=b;l>=i;)n(),l-=i;const x=l/i;r(x),c&&(c=t.requestAnimationFrame(f))}function m(){c||(c=t.requestAnimationFrame(f))}function p(){t.cancelAnimationFrame(c),o=null,l=0,c=0}function v(){o=null,l=0}return{init:d,destroy:u,start:m,stop:p,update:n,render:r}}function e6(e,t){const n=t==="rtl",r=e==="y",a=r?"y":"x",i=r?"x":"y",o=!r&&n?-1:1,l=u(),c=f();function d(v){const{height:g,width:y}=v;return r?g:y}function u(){return r?"top":n?"right":"left"}function f(){return r?"bottom":n?"left":"right"}function m(v){return v*o}return{scroll:a,cross:i,startEdge:l,endEdge:c,measureSize:d,direction:m}}function Za(e=0,t=0){const n=Nt(e-t);function r(d){return d<e}function a(d){return d>t}function i(d){return r(d)||a(d)}function o(d){return i(d)?r(d)?e:t:d}function l(d){return n?d-n*Math.ceil((d-t)/n):d}return{length:n,max:t,min:e,constrain:o,reachedAny:i,reachedMax:a,reachedMin:r,removeOffset:l}}function ZN(e,t,n){const{constrain:r}=Za(0,e),a=e+1;let i=o(t);function o(m){return n?Nt((a+m)%a):r(m)}function l(){return i}function c(m){return i=o(m),f}function d(m){return u().set(l()+m)}function u(){return ZN(e,l(),n)}const f={get:l,set:c,add:d,clone:u};return f}function t6(e,t,n,r,a,i,o,l,c,d,u,f,m,p,v,g,y,b,x){const{cross:w,direction:_}=e,j=["INPUT","SELECT","TEXTAREA"],N={passive:!1},k=cc(),C=cc(),A=Za(50,225).constrain(p.measure(20)),I={mouse:300,touch:400},O={mouse:500,touch:600},P=v?43:25;let T=!1,E=0,W=0,V=!1,q=!1,D=!1,$=!1;function z(J){if(!x)return;function ue(Y){(wh(x)||x(J,Y))&&te(Y)}const Ee=t;k.add(Ee,"dragstart",Y=>Y.preventDefault(),N).add(Ee,"touchmove",()=>{},N).add(Ee,"touchend",()=>{}).add(Ee,"touchstart",ue).add(Ee,"mousedown",ue).add(Ee,"touchcancel",Re).add(Ee,"contextmenu",Re).add(Ee,"click",ye,!0)}
vendor: 13,381 bytes, line 543
543function R(){k.clear(),C.clear()}function U(){const J=$?n:t;C.add(J,"touchmove",ce,N).add(J,"touchend",Re).add(J,"mousemove",ce,N).add(J,"mouseup",Re)}function ee(J){const ue=J.nodeName||"";return j.includes(ue)}function ae(){return(v?O:I)[$?"mouse":"touch"]}function xe(J,ue){const Ee=f.add(fx(J)*-1),Y=u.byDistance(J,!v).distance;return v||Nt(J)<A?Y:y&&ue?Y*.5:u.byIndex(Ee.get(),0).distance}function te(J){const ue=Pp(J,r);$=ue,D=v&&ue&&!J.buttons&&T,T=Cl(a.get(),o.get())>=2,!(ue&&J.button!==0)&&(ee(J.target)||(V=!0,i.pointerDown(J),d.useFriction(0).useDuration(0),a.set(o),U(),E=i.readPoint(J),W=i.readPoint(J,w),m.emit("pointerDown")))}function ce(J){if(!Pp(J,r)&&J.touches.length>=2)return Re(J);const Ee=i.readPoint(J),Y=i.readPoint(J,w),Q=Cl(Ee,E),le=Cl(Y,W);if(!q&&!$&&(!J.cancelable||(q=Q>le,!q)))return Re(J);const de=i.pointerMove(J);Q>g&&(D=!0),d.useFriction(.3).useDuration(.75),l.start(),a.add(_(de)),J.preventDefault()}function Re(J){const Ee=u.byDistance(0,!1).index!==f.get(),Y=i.pointerUp(J)*ae(),Q=xe(_(Y),Ee),le=QM(Y,Q),de=P-10*le,me=b+le/50;q=!1,V=!1,C.clear(),d.useDuration(de).useFriction(me),c.distance(Q,!v),$=!1,m.emit("pointerUp")}function ye(J){D&&(J.stopPropagation(),J.preventDefault(),D=!1)}function fe(){return V}return{init:z,destroy:R,pointerDown:fe}}function n6(e,t){let r,a;function i(f){return f.timeStamp}function o(f,m){const v=`client${(m||e.scroll)==="x"?"X":"Y"}`;return(Pp(f,t)?f:f.touches[0])[v]}function l(f){return r=f,a=f,o(f)}function c(f){const m=o(f)-o(a),p=i(f)-i(r)>170;return a=f,p&&(r=f),m}function d(f){if(!r||!a)return 0;const m=o(a)-o(r),p=i(f)-i(r),v=i(f)-i(a)>170,g=m/p;return p&&!v&&Nt(g)>.1?g:0}return{pointerDown:l,pointerMove:c,pointerUp:d,readPoint:o}}function r6(){function e(n){const{offsetTop:r,offsetLeft:a,offsetWidth:i,offsetHeight:o}=n;return{top:r,right:a+i,bottom:r+o,left:a,width:i,height:o}}return{measure:e}}function s6(e){function t(r){return e*(r/100)}return{measure:t}}function a6(e,t,n,r,a,i,o){const l=[e].concat(r);let c,d,u=[],f=!1;function m(y){return a.measureSize(o.measure(y))}function p(y){if(!i)return;d=m(e),u=r.map(m);function b(x){for(const w of x){if(f)return;const _=w.target===e,j=r.indexOf(w.target),N=_?d:u[j],k=m(_?e:r[j]);if(Nt(k-N)>=.5){y.reInit(),t.emit("resize");break}}}c=new ResizeObserver(x=>{(wh(i)||i(y,x))&&b(x)}),n.requestAnimationFrame(()=>{l.forEach(x=>c.observe(x))})}function v(){f=!0,c&&c.disconnect()}return{init:p,destroy:v}}function i6(e,t,n,r,a,i){let o=0,l=0,c=a,d=i,u=e.get(),f=0;function m(){const N=r.get()-e.get(),k=!c;let C=0;return k?(o=0,n.set(r),e.set(r),C=N):(n.set(e),o+=N/c,o*=d,u+=o,e.add(o),C=u-f),l=fx(C),f=u,j}function p(){const N=r.get()-t.get();return Nt(N)<.001}function v(){return c}function g(){return l}function y(){return o}function b(){return w(a)}function x(){return _(i)}function w(N){return c=N,j}function _(N){return d=N,j}const j={direction:g,duration:v,velocity:y,seek:m,settled:p,useBaseFriction:x,useBaseDuration:b,useFriction:_,useDuration:w};return j}function o6(e,t,n,r,a){const i=a.measure(10),o=a.measure(50),l=Za(.1,.99);let c=!1;function d(){return!(c||!e.reachedAny(n.get())||!e.reachedAny(t.get()))}function u(p){if(!d())return;const v=e.reachedMin(t.get())?"min":"max",g=Nt(e[v]-t.get()),y=n.get()-t.get(),b=l.constrain(g/o);n.subtract(y*b),!p&&Nt(y)<i&&(n.set(e.constrain(n.get())),r.useDuration(25).useBaseFriction())}function f(p){c=!p}return{shouldConstrain:d,constrain:u,toggleActive:f}}function l6(e,t,n,r,a){const i=Za(-t+e,0),o=f(),l=u(),c=m();function d(v,g){return Cl(v,g)<=1}function u(){const v=o[0],g=gr(o),y=o.lastIndexOf(v),b=o.indexOf(g)+1;return Za(y,b)}function f(){return n.map((v,g)=>{const{min:y,max:b}=i,x=i.constrain(v),w=!g,_=mx(n,g);return w?b:_||d(y,x)?y:d(b,x)?b:x}).map(v=>parseFloat(v.toFixed(3)))}function m(){if(t<=e+a)return[i.max];if(r==="keepSnaps")return o;const{min:v,max:g}=l;return o.slice(v,g)}return{snapsContained:c,scrollContainLimit:l}}function c6(e,t,n){const r=t[0],a=n?r-e:gr(t);return{limit:Za(a,r)}}function u6(e,t,n,r){const i=t.min+.1,o=t.max+.1,{reachedMin:l,reachedMax:c}=Za(i,o);function d(m){return m===1?c(n.get()):m===-1?l(n.get()):!1}function u(m){if(!d(m))return;const p=e*(m*-1);r.forEach(v=>v.add(p))}return{loop:u}}function d6(e){const{max:t,length:n}=e;function r(i){const o=i-t;return n?o/-n:0}return{get:r}}function h6(e,t,n,r,a){const{startEdge:i,endEdge:o}=e,{groupSlides:l}=a,c=f().map(t.measure),d=m(),u=p();function f(){return l(r).map(g=>gr(g)[o]-g[0][i]).map(Nt)}function m(){return r.map(g=>n[i]-g[i]).map(g=>-Nt(g))}function p(){return l(d).map(g=>g[0]).map((g,y)=>g+c[y])}return{snaps:d,snapsAligned:u}}function f6(e,t,n,r,a,i){const{groupSlides:o}=a,{min:l,max:c}=r,d=u();function u(){const m=o(i),p=!e||t==="keepSnaps";return n.length===1?[i]:p?m:m.slice(l,c).map((v,g,y)=>{const b=!g,x=mx(y,g);if(b){const w=gr(y[0])+1;return Py(w)}if(x){const w=jc(i)-gr(y)[0]+1;return Py(w,gr(y)[0])}return v})}return{slideRegistry:d}}function m6(e,t,n,r,a){const{reachedAny:i,removeOffset:o,constrain:l}=r;function c(v){return v.concat().sort((g,y)=>Nt(g)-Nt(y))[0]}function d(v){const g=e?o(v):l(v),y=t.map((x,w)=>({diff:u(x-g,0),index:w})).sort((x,w)=>Nt(x.diff)-Nt(w.diff)),{index:b}=y[0];return{index:b,distance:g}}function u(v,g){const y=[v,v+n,v-n];if(!e)return v;if(!g)return c(y);const b=y.filter(x=>fx(x)===g);return b.length?c(b):gr(y)-n}function f(v,g){const y=t[v]-a.get(),b=u(y,g);return{index:v,distance:b}}function m(v,g){const y=a.get()+v,{index:b,distance:x}=d(y),w=!e&&i(y);if(!g||w)return{index:b,distance:v};const _=t[b]-x,j=v+u(_,0);return{index:b,distance:j}}return{byDistance:m,byIndex:f,shortcut:u}}function p6(e,t,n,r,a,i,o){function l(f){const m=f.distance,p=f.index!==t.get();i.add(m),m&&(r.duration()?e.start():(e.update(),e.render(1),e.update())),p&&(n.set(t.get()),t.set(f.index),o.emit("select"))}function c(f,m){const p=a.byDistance(f,m);l(p)}function d(f,m){const p=t.clone().set(f),v=a.byIndex(p.get(),m);l(v)}return{distance:c,index:d}}function x6(e,t,n,r,a,i,o,l){const c={passive:!0,capture:!0};let d=0;function u(p){if(!l)return;function v(g){if(new Date().getTime()-d>10)return;o.emit("slideFocusStart"),e.scrollLeft=0;const x=n.findIndex(w=>w.includes(g));hx(x)&&(a.useDuration(0),r.index(x,0),o.emit("slideFocus"))}i.add(document,"keydown",f,!1),t.forEach((g,y)=>{i.add(g,"focus",b=>{(wh(l)||l(p,b))&&v(y)},c)})}function f(p){p.code==="Tab"&&(d=new Date().getTime())}return{init:u}}function hl(e){let t=e;function n(){return t}function r(c){t=o(c)}function a(c){t+=o(c)}function i(c){t-=o(c)}function o(c){return hx(c)?c:c.get()}return{get:n,set:r,add:a,subtract:i}}function ek(e,t){const n=e.scroll==="x"?o:l,r=t.style;let a=null,i=!1;function o(m){return`translate3d(${m}px,0px,0px)`}function l(m){return`translate3d(0px,${m}px,0px)`}function c(m){if(i)return;const p=JM(e.direction(m));p!==a&&(r.transform=n(p),a=p)}function d(m){i=!m}function u(){i||(r.transform="",t.getAttribute("style")||t.removeAttribute("style"))}return{clear:u,to:c,toggleActive:d}}function g6(e,t,n,r,a,i,o,l,c){const u=oc(a),f=oc(a).reverse(),m=b().concat(x());function p(k,C){return k.reduce((A,I)=>A-a[I],C)}function v(k,C){return k.reduce((A,I)=>p(A,C)>0?A.concat([I]):A,[])}function g(k){return i.map((C,A)=>({start:C-r[A]+.5+k,end:C+t-.5+k}))}function y(k,C,A){const I=g(C);return k.map(O=>{const P=A?0:-n,T=A?n:0,E=A?"end":"start",W=I[O][E];return{index:O,loopPoint:W,slideLocation:hl(-1),translate:ek(e,c[O]),target:()=>l.get()>W?P:T}})}function b(){const k=o[0],C=v(f,k);return y(C,n,!1)}function x(){const k=t-o[0]-1,C=v(u,k);return y(C,-n,!0)}function w(){return m.every(({index:k})=>{const C=u.filter(A=>A!==k);return p(C,t)<=.1})}function _(){m.forEach(k=>{const{target:C,translate:A,slideLocation:I}=k,O=C();O!==I.get()&&(A.to(O),I.set(O))})}function j(){m.forEach(k=>k.translate.clear())}return{canLoop:w,clear:j,loop:_,loopPoints:m}}function b6(e,t,n){let r,a=!1;function i(c){if(!n)return;function d(u){for(const f of u)if(f.type==="childList"){c.reInit(),t.emit("slidesChanged");break}}r=new MutationObserver(u=>{a||(wh(n)||n(c,u))&&d(u)}),r.observe(e,{childList:!0})}function o(){r&&r.disconnect(),a=!0}return{init:i,destroy:o}}function y6(e,t,n,r){const a={};let i=null,o=null,l,c=!1;function d(){l=new IntersectionObserver(v=>{c||(v.forEach(g=>{const y=t.indexOf(g.target);a[y]=g}),i=null,o=null,n.emit("slidesInView"))},{root:e.parentElement,threshold:r}),t.forEach(v=>l.observe(v))}function u(){l&&l.disconnect(),c=!0}function f(v){return lc(a).reduce((g,y)=>{const b=parseInt(y),{isIntersecting:x}=a[b];return(v&&x||!v&&!x)&&g.push(b),g},[])}function m(v=!0){if(v&&i)return i;if(!v&&o)return o;const g=f(v);return v&&(i=g),v||(o=g),g}return{init:d,destroy:u,get:m}}function v6(e,t,n,r,a,i){const{measureSize:o,startEdge:l,endEdge:c}=e,d=n[0]&&a,u=v(),f=g(),m=n.map(o),p=y();function v(){if(!d)return 0;const x=n[0];return Nt(t[l]-x[l])}function g(){if(!d)return 0;const x=i.getComputedStyle(gr(r));return parseFloat(x.getPropertyValue(`margin-${c}`))}function y(){return n.map((x,w,_)=>{const j=!w,N=mx(_,w);return j?m[w]+u:N?m[w]+f:_[w+1][l]-x[l]}).map(Nt)}return{slideSizes:m,slideSizesWithGaps:p,startGap:u,endGap:f}}function w6(e,t,n,r,a,i,o,l,c){const{startEdge:d,endEdge:u,direction:f}=e,m=hx(n);function p(b,x){return oc(b).filter(w=>w%x===0).map(w=>b.slice(w,w+x))}function v(b){return b.length?oc(b).reduce((x,w,_)=>{const j=gr(x)||0,N=j===0,k=w===jc(b),C=a[d]-i[j][d],A=a[d]-i[w][u],I=!r&&N?f(o):0,O=!r&&k?f(l):0,P=Nt(A-O-(C+I));return _&&P>t+c&&x.push(w),k&&x.push(b.length),x},[]).map((x,w,_)=>{const j=Math.max(_[w-1]||0);return b.slice(j,x)}):[]}function g(b){return m?p(b,n):v(b)}return{groupSlides:g}}function _6(e,t,n,r,a,i,o){const{align:l,axis:c,direction:d,startIndex:u,loop:f,duration:m,dragFree:p,dragThreshold:v,inViewThreshold:g,slidesToScroll:y,skipSnaps:b,containScroll:x,watchResize:w,watchSlides:_,watchDrag:j,watchFocus:N}=i,k=2,C=r6(),A=C.measure(t),I=n.map(C.measure),O=e6(c,d),P=O.measureSize(A),T=s6(P),E=XM(l,P),W=!f&&!!x,V=f||!!x,{slideSizes:q,slideSizesWithGaps:D,startGap:$,endGap:z}=v6(O,A,I,n,V,a),R=w6(O,P,y,f,A,I,$,z,k),{snaps:U,snapsAligned:ee}=h6(O,E,A,I,R),ae=-gr(U)+gr(D),{snapsContained:xe,scrollContainLimit:te}=l6(P,ae,ee,x,k),ce=W?xe:ee,{limit:Re}=c6(ae,ce,f),ye=ZN(jc(ce),u,f),fe=ye.clone(),ge=oc(n),J=({dragHandler:M,scrollBody:Ve,scrollBounds:Ue,options:{loop:Ze}})=>{Ze||Ue.constrain(M.pointerDown()),Ve.seek()},ue=({scrollBody:M,translate:Ve,location:Ue,offsetLocation:Ze,previousLocation:ft,scrollLooper:Rt,slideLooper:lt,dragHandler:on,animation:F,eventHandler:Pe,scrollBounds:Z,options:{loop:G}},et)=>{const ze=M.settled(),ie=!Z.shouldConstrain(),be=G?ze:ze&&ie,Ce=be&&!on.pointerDown();Ce&&F.stop();const $e=Ue.get()*et+ft.get()*(1-et);Ze.set($e),G&&(Rt.loop(M.direction()),lt.loop()),Ve.to(Ze.get()),Ce&&Pe.emit("settle"),be||Pe.emit("scroll")},Ee=ZM(r,a,()=>J(nt),M=>ue(nt,M)),Y=.68,Q=ce[ye.get()],le=hl(Q),de=hl(Q),me=hl(Q),Le=hl(Q),Ke=i6(le,me,de,Le,m,Y),Qe=m6(f,ce,ae,Re,Le),tt=p6(Ee,ye,fe,Ke,Qe,Le,o),an=d6(Re),Wt=cc(),De=y6(t,n,o,g),{slideRegistry:pe}=f6(W,x,ce,te,R,ge),Qt=x6(e,n,pe,tt,Ke,Wt,o,N),nt={ownerDocument:r,ownerWindow:a,eventHandler:o,containerRect:A,slideRects:I,animation:Ee,axis:O,dragHandler:t6(O,e,r,a,Le,n6(O,a),le,Ee,tt,Ke,Qe,ye,o,T,p,v,b,Y,j),eventStore:Wt,percentOfView:T,index:ye,indexPrevious:fe,limit:Re,location:le,offsetLocation:me,previousLocation:de,options:i,resizeHandler:a6(t,o,a,n,O,w,C),scrollBody:Ke,scrollBounds:o6(Re,me,Le,Ke,T),scrollLooper:u6(ae,Re,me,[le,me,de,Le]),scrollProgress:an,scrollSnapList:ce.map(an.get),scrollSnaps:ce,scrollTarget:Qe,scrollTo:tt,slideLooper:g6(O,P,ae,q,D,U,ce,me,n),slideFocus:Qt,slidesHandler:b6(t,o,_),slidesInView:De,slideIndexes:ge,slideRegistry:pe,slidesToScroll:R,target:Le,translate:ek(O,t)};return nt}function j6(){let e={},t;function n(d){t=d}function r(d){return e[d]||[]}function a(d){return r(d).forEach(u=>u(t,d)),c}function i(d,u){return e[d]=r(d).concat([u]),c}function o(d,u){return e[d]=r(d).filter(f=>f!==u),c}function l(){e={}}const c={init:n,emit:a,off:o,on:i,clear:l};return c}const N6={align:"center",axis:"x",container:null,slides:null,containScroll:"trimSnaps",direction:"ltr",slidesToScroll:1,inViewThreshold:0,breakpoints:{},dragFree:!1,dragThreshold:10,loop:!1,skipSnaps:!1,duration:25,startIndex:0,active:!0,watchDrag:!0,watchResize:!0,watchSlides:!0,watchFocus:!0};function k6(e){function t(i,o){return XN(i,o||{})}function n(i){const o=i.breakpoints||{},l=lc(o).filter(c=>e.matchMedia(c).matches).map(c=>o[c]).reduce((c,d)=>t(c,d),{});return t(i,l)}function r(i){return i.map(o=>lc(o.breakpoints||{})).reduce((o,l)=>o.concat(l),[]).map(e.matchMedia)}return{mergeOptions:t,optionsAtMedia:n,optionsMediaQueries:r}}function S6(e){let t=[];function n(i,o){return t=o.filter(({options:l})=>e.optionsAtMedia(l).active!==!1),t.forEach(l=>l.init(i,e)),o.reduce((l,c)=>Object.assign(l,{[c.name]:c}),{})}function r(){t=t.filter(i=>i.destroy())}return{init:n,destroy:r}}function Td(e,t,n){const r=e.ownerDocument,a=r.defaultView,i=k6(a),o=S6(i),l=cc(),c=j6(),{mergeOptions:d,optionsAtMedia:u,optionsMediaQueries:f}=i,{on:m,off:p,emit:v}=c,g=O;let y=!1,b,x=d(N6,Td.globalOptions),w=d(x),_=[],j,N,k;function C(){const{container:ge,slides:J}=w;N=(Ep(ge)?e.querySelector(ge):ge)||e.children[0];const Ee=Ep(J)?N.querySelectorAll(J):J;k=[].slice.call(Ee||N.children)}
543function A(ge){const J=_6(e,N,k,r,a,ge,c);if(ge.loop&&!J.slideLooper.canLoop()){const ue=Object.assign({},ge,{loop:!1});return A(ue)}return J}function I(ge,J){y||(x=d(x,ge),w=u(x),_=J||_,C(),b=A(w),f([x,..._.map(({options:ue})=>ue)]).forEach(ue=>l.add(ue,"change",O)),w.active&&(b.translate.to(b.location.get()),b.animation.init(),b.slidesInView.init(),b.slideFocus.init(fe),b.eventHandler.init(fe),b.resizeHandler.init(fe),b.slidesHandler.init(fe),b.options.loop&&b.slideLooper.loop(),N.offsetParent&&k.length&&b.dragHandler.init(fe),j=o.init(fe,_)))}function O(ge,J){const ue=R();P(),I(d({startIndex:ue},ge),J),c.emit("reInit")}function P(){b.dragHandler.destroy(),b.eventStore.clear(),b.translate.clear(),b.slideLooper.clear(),b.resizeHandler.destroy(),b.slidesHandler.destroy(),b.slidesInView.destroy(),b.animation.destroy(),o.destroy(),l.clear()}function T(){y||(y=!0,l.clear(),P(),c.emit("destroy"),c.clear())}function E(ge,J,ue){!w.active||y||(b.scrollBody.useBaseFriction().useDuration(J===!0?0:w.duration),b.scrollTo.index(ge,ue||0))}function W(ge){const J=b.index.add(1).get();E(J,ge,-1)}function V(ge){const J=b.index.add(-1).get();E(J,ge,1)}function q(){return b.index.add(1).get()!==R()}function D(){return b.index.add(-1).get()!==R()}function $(){return b.scrollSnapList}function z(){return b.scrollProgress.get(b.offsetLocation.get())}function R(){return b.index.get()}function U(){return b.indexPrevious.get()}function ee(){return b.slidesInView.get()}function ae(){return b.slidesInView.get(!1)}function xe(){return j}function te(){return b}function ce(){return e}function Re(){return N}function ye(){return k}const fe={canScrollNext:q,canScrollPrev:D,containerNode:Re,internalEngine:te,destroy:T,off:p,on:m,emit:v,plugins:xe,previousScrollSnap:U,reInit:g,rootNode:ce,scrollNext:W,scrollPrev:V,scrollProgress:z,scrollSnapList:$,scrollTo:E,selectedScrollSnap:R,slideNodes:ye,slidesInView:ee,slidesNotInView:ae};return I(t,n),setTimeout(()=>c.emit("init"),0),fe}Td.globalOptions=void 0;function px(e={},t=[]){const n=h.useRef(e),r=h.useRef(t),[a,i]=h.useState(),[o,l]=h.useState(),c=h.useCallback(()=>{a&&a.reInit(n.current,r.current)},[a]);return h.useEffect(()=>{dx(n.current,e)||(n.current=e,c())},[e,c]),h.useEffect(()=>{YM(r.current,t)||(r.current=t,c())},[t,c]),h.useEffect(()=>{if(KM()&&o){Td.globalOptions=px.globalOptions;const d=Td(o,n.current,r.current);return i(d),()=>d.destroy()}else i(void 0)},[o,i]),[l,a]}px.globalOptions=void 0;const tk=h.createContext(null);function _h(){const e=h.useContext(tk);if(!e)throw new Error("useCarousel must be used within a <Carousel />");return e}const xx=h.forwardRef(({orientation:e="horizontal",opts:t,setApi:n,plugins:r,className:a,children:i,...o},l)=>{const[c,d]=px({...t,axis:e==="horizontal"?"x":"y"},r),[u,f]=h.useState(!1),[m,p]=h.useState(!1),v=h.useCallback(x=>{x&&(f(x.canScrollPrev()),p(x.canScrollNext()))},[]),g=h.useCallback(()=>{d==null||d.scrollPrev()},[d]),y=h.useCallback(()=>{d==null||d.scrollNext()},[d]),b=h.useCallback(x=>{x.key==="ArrowLeft"?(x.preventDefault(),g()):x.key==="ArrowRight"&&(x.preventDefault(),y())},[g,y]);return h.useEffect(()=>{!d||!n||n(d)},[d,n]),h.useEffect(()=>{if(d)return v(d),d.on("reInit",v),d.on("select",v),()=>{d==null||d.off("select",v)}},[d,v]),s.jsx(tk.Provider,{value:{carouselRef:c,api:d,opts:t,orientation:e||((t==null?void 0:t.axis)==="y"?"vertical":"horizontal"),scrollPrev:g,scrollNext:y,canScrollPrev:u,canScrollNext:m},children:s.jsx("div",{ref:l,onKeyDownCapture:b,className:Ct("relative",a),role:"region","aria-roledescription":"carousel",...o,children:i})})});xx.displayName="Carousel";const gx=h.forwardRef(({className:e,...t},n)=>{const{carouselRef:r,orientation:a}=_h();return s.jsx("div",{ref:r,className:"overflow-hidden",children:s.jsx("div",{ref:n,className:Ct("flex",a==="horizontal"?"-ml-4":"-mt-4 flex-col",e),...t})})});gx.displayName="CarouselContent";const bx=h.forwardRef(({className:e,...t},n)=>{const{orientation:r}=_h();return s.jsx("div",{ref:n,role:"group","aria-roledescription":"slide",className:Ct("min-w-0 shrink-0 grow-0 basis-full",r==="horizontal"?"pl-4":"pt-4",e),...t})});
543bx.displayName="CarouselItem";const C6=h.forwardRef(({className:e,variant:t="outline",size:n="icon",...r},a)=>{const{orientation:i,scrollPrev:o,canScrollPrev:l}=_h();return s.jsxs(ic,{ref:a,variant:t,size:n,className:Ct("absolute h-8 w-8 rounded-full",i==="horizontal"?"-left-12 top-1/2 -translate-y-1/2":"-top-12 left-1/2 -translate-x-1/2 rotate-90",e),disabled:!l,onClick:o,...r,children:[s.jsx(jl,{className:"h-4 w-4"}),s.jsx("span",{className:"sr-only",children:"Previous slide"})]})});C6.displayName="CarouselPrevious";const E6=h.forwardRef(({className:e,variant:t="outline",size:n="icon",...r},a)=>{const{orientation:i,scrollNext:o,canScrollNext:l}=_h();return s.jsxs(ic,{ref:a,variant:t,size:n,className:Ct("absolute h-8 w-8 rounded-full",i==="horizontal"?"-right-12 top-1/2 -translate-y-1/2":"-bottom-12 left-1/2 -translate-x-1/2 rotate-90",e),disabled:!l,onClick:o,...r,children:[s.jsx(s4,{className:"h-4 w-4"}),s.jsx("span",{className:"sr-only",children:"Next slide"})]})});E6.displayName="CarouselNext";const P6=({r:e,onOpenStore:t})=>s.jsxs("button",{onClick:t,className:"relative aspect-[3/4] w-full rounded-lg overflow-hidden group cursor-pointer border border-white/10 hover:border-amber-400/40 transition-colors",children:[e.image_url?s.jsx("img",{src:e.image_url,alt:e.title,className:"w-full h-full object-cover group-hover:scale-105 transition-transform duration-300",loading:"lazy"}):s.jsx("div",{className:"w-full h-full bg-white/5 flex items-center justify-center",children:s.jsx(Ft,{className:"w-6 h-6 text-white/30"})}),s.jsxs("div",{className:"absolute bottom-0 inset-x-0 bg-gradient-to-t from-black/90 to-transparent p-1.5 pt-4",children:[s.jsx("p",{className:"text-white text-[10px] font-bold truncate",children:e.title}),s.jsxs("p",{className:"text-amber-400 text-[8px] font-semibold",children:[e.minutes_cost," min"]})]}),e.rarity==="legendary"&&s.jsx("div",{className:"absolute top-1 right-1 bg-amber-500 text-black text-[7px] font-black px-1 rounded",children:"★"})]}),Ty=({myGender:e,onOpenStore:t})=>{const n=(e==null?void 0:e.toLowerCase())||null,{data:r=[]}=he({queryKey:["reward-teaser",n],staleTime:12e4,queryFn:async()=>{const{data:a}=await S.from("rewards").select("id, title, image_url, rarity, minutes_cost, type, sub_type, target_gender").eq("visible",!0).order("minutes_cost",{ascending:!0}).limit(20);if(!a)return[];const i=a.filter(o=>!!(o.type==="giftcard"||o.sub_type==="giftcard"||!o.target_gender||n&&o.target_gender===n));for(let o=i.length-1;o>0;o--){const l=Math.floor(Math.random()*(o+1));[i[o],i[l]]=[i[l],i[o]]}return i.slice(0,12)}});return r.length===0?null:s.jsxs("div",{className:"w-full max-w-[260px] mt-3",children:[s.jsxs("button",{onClick:t,className:"flex items-center gap-1.5 mx-auto mb-1.5 text-emerald-400 text-[10px] font-bold hover:text-emerald-300 transition-colors",children:[s.jsx(Ft,{className:"w-3 h-3"}),"Rewards you can redeem"]}),s.jsx(xx,{opts:{align:"start",loop:!0},plugins:[vh({delay:3e3,stopOnInteraction:!1})],className:"w-full",children:s.jsx(gx,{className:"-ml-1.5",children:r.map(a=>s.jsx(bx,{className:"basis-1/3 pl-1.5",children:s.jsx(P6,{r:a,onOpenStore:t})},a.id))})}),s.jsx("button",{onClick:t,className:"mt-2 w-full py-1.5 rounded-lg bg-white/10 hover:bg-white/15 text-white text-xs font-bold transition-colors",children:"Browse Store →"})]})},T6=({m:e,onOpenDiscover:t,onDm:n})=>s.jsxs("div",{className:"relative aspect-[3/4] w-full rounded-xl overflow-hidden group border border-white/10 hover:border-white/30 transition-colors",children:[s.jsx("button",{onClick:t,className:"w-full h-full cursor-pointer",children:s.jsx("img",{src:e.image_url,alt:e.name,className:"w-full h-full object-cover group-hover:scale-105 transition-transform duration-300",loading:"lazy"})}),s.jsxs("div",{className:"absolute bottom-0 inset-x-0 bg-gradient-to-t from-black/90 via-black/50 to-transparent p-2 pt-6",children:[s.jsx("p",{className:"text-white text-xs font-bold truncate",children:e.name}),e.country&&s.jsx("p",{className:"text-white/50 text-[9px] truncate",children:e.country}),s.jsxs("button",{onClick:n,className:"mt-1.5 flex items-center justify-center gap-1 w-full py-1 rounded-md bg-pink-600/90 hover:bg-pink-500 text-white text-[10px] font-bold transition-colors",children:[s.jsx(An,{className:"w-3 h-3"}),"DM"]})]})]}),Ry=({myGender:e,myUserId:t,onOpenDiscover:n,onOpenStore:r,onOpenMessages:a,onDmUser:i}
543)=>{const o=(e==null?void 0:e.toLowerCase())==="female"?"male":"female",[l,c]=h.useState(!1);h.useEffect(()=>{const m=setInterval(()=>{c(p=>!p)},5e3);return()=>clearInterval(m)},[]);const{data:d=[]}=he({queryKey:["discover-teaser",o,t],staleTime:6e4,queryFn:async()=>{let m=S.from("members").select("id, name, image_url, country").eq("is_discoverable",!0).eq("image_status","approved").neq("id",t).order("last_active_at",{ascending:!1}).limit(8);e&&(m=m.eq("gender",o));const{data:p}=await m;return(p??[]).filter(v=>v.image_url)}}),u=d.length>0,f=m=>p=>{p.stopPropagation(),i?i(m):a==null||a()};return l&&r?s.jsx("div",{className:"transition-opacity duration-500 animate-in fade-in",children:s.jsx(Ty,{myGender:e,onOpenStore:r})}):u?s.jsxs("div",{className:"w-full max-w-[360px] mt-3 transition-opacity duration-500 animate-in fade-in",children:[s.jsxs("button",{onClick:n,className:"flex items-center gap-1.5 mx-auto mb-2 text-amber-400 text-xs font-bold hover:text-amber-300 transition-colors",children:[s.jsx(yr,{className:"w-3.5 h-3.5"}),"People waiting to chat"]}),s.jsx(xx,{opts:{align:"start",loop:!0},plugins:[vh({delay:3e3,stopOnInteraction:!1})],className:"w-full",children:s.jsx(gx,{className:"-ml-2",children:d.slice(0,8).map(m=>s.jsx(bx,{className:"basis-1/3 pl-2",children:s.jsx(T6,{m,onOpenDiscover:n,onDm:f(m.id)})},m.id))})}),s.jsx("button",{onClick:n,className:"mt-2.5 w-full py-2 rounded-lg bg-white/10 hover:bg-white/15 text-white text-xs font-bold transition-colors",children:"Open Discover →"})]}):r?s.jsx(Ty,{myGender:e,onOpenStore:r}):null},Ay=({recipientId:e,roomId:t})=>{const[n,r]=h.useState(!1),{data:a}=he({queryKey:["camera_unlock_settings"],queryFn:async()=>{const{data:c}=await S.from("camera_unlock_settings").select("*").limit(1).single();return c}}),o=(((a==null?void 0:a.price_cents)??299)/100).toFixed(2),l=async()=>{r(!0);try{const{data:c,error:d}=await S.functions.invoke("camera-unlock",{body:{action:"create-checkout",recipient_id:e,room_id:t}});if(d)throw d;c!=null&&c.url&&window.open(c.url,"_blank")}catch(c){B.error(c.message||"Failed to start camera unlock")}finally{r(!1)}};return s.jsxs("button",{onClick:l,disabled:n,className:"flex items-center gap-1.5 bg-gradient-to-r from-amber-500 to-orange-500 hover:from-amber-400 hover:to-orange-400 disabled:opacity-50 text-white font-bold text-xs px-3 py-2 rounded-full shadow-lg transition-all animate-pulse hover:animate-none",children:[n?s.jsx(us,{className:"w-4 h-4 animate-spin"}):s.jsx(ja,{className:"w-4 h-4"}),s.jsxs("span",{children:["Unlock Her Camera $",o]})]})},R6=({requestId:e,recipientCutCents:t,onAccept:n,onDecline:r})=>{const[a,i]=h.useState(!1),o=(t/100).toFixed(2),l=async()=>{i(!0);try{const{data:d,error:u}=await S.functions.invoke("camera-unlock",{body:{action:"accept",request_id:e}});if(u)throw u;const f=(d==null?void 0:d.minutes_earned)??0;B.success(`📹 Camera enabled! You earned ${f} minutes ($${o})`,{duration:6e3}),n()}catch(d){B.error(d.message||"Failed to accept")}finally{i(!1)}},c=async()=>{i(!0);try{const{error:d}=await S.functions.invoke("camera-unlock",{body:{action:"decline",request_id:e}});if(d)throw d;B("Camera request declined — partner will be refunded",{duration:4e3}),r()}catch(d){B.error(d.message||"Failed to decline")}finally{i(!1)}};return s.jsx("div",{className:"fixed inset-0 z-[60] bg-black/80 flex items-center justify-center px-6",children:s.jsxs("div",{className:"bg-neutral-900 rounded-2xl p-6 max-w-sm w-full text-center border border-amber-500/30 shadow-2xl shadow-amber-500/10",children:[s.jsx("div",{className:"w-16 h-16 rounded-full bg-gradient-to-br from-amber-500 to-orange-500 flex items-center justify-center mx-auto mb-4",children:s.jsx(mr,{className:"w-8 h-8 text-white"})}),s.jsx("h2",{className:"text-white font-black text-xl mb-2",children:"Camera Request"}),s.jsx("p",{className:"text-neutral-300 text-sm mb-4",children:"Your partner wants to enable video. Would you like to turn on your camera?"}),s.jsx("div",{className:"bg-emerald-500/10 border border-emerald-500/30 rounded-xl p-3 mb-5",children:s.jsxs("div",{className:"flex items-center justify-center gap-1.5",children:[s.jsx($t,{className:"w-4 h-4 text-emerald-400"}),s.jsxs("span",{className:"text-emerald-400 font-bold text-sm",children:["You'll earn $",o," in minutes!"]})]})}),s.jsxs("div",{className:"flex gap-3",children:[s.jsx("button",{onClick:c,disabled:a,className:"flex-1 py-3 rounded-xl bg-neutral-800 hover:bg-neutral-700 text-neutral-300 font-bold transition-colors disabled:opacity-50",children:"Decline"}),s.jsx("button",{onClick:l,disabled:a,className:"flex-1 py-3 rounded-xl bg-gradient-to-r from-emerald-500 to-green-500 hover:from-emerald-400 hover:to-green-400 text-white font-bold transition-colors disabled:opacity-50",children:"Accept ✓"})]}),s.jsx("p",{className:"text-neutral-500 text-[11px] mt-3",children:"Declining will automatically refund your partner"})]})})};async function Iy(e,t,n,r,a){try{const i=document.createElement("canvas");i.width=e.videoWidth||320,i.height=e.videoHeight||240;const o=i.getContext("2d");if(!o)return null;o.drawImage(e,0,0,i.width,i.height);const l=await new Promise(f=>i.toBlob(f,"image/jpeg",.7));if(!l)return null;const c=Date.now(),d=`${t}/${n}_day${r}_${a}_${c}.jpg`,{error:u}=await S.storage.from("bestie-screenshots").upload(d,l,{contentType:"image/jpeg",upsert:!1});return u?(console.error("Bestie screenshot upload failed:",u.message),null):d}catch(i){return console.error("Bestie screenshot capture failed:",i),null}}function A6({remoteVideoRef:e,userId:t,challengeId:n,snapsCount:r,maxSnaps:a,onSnapTaken:i,onDisable:o}){const[l,c]=h.useState(!1);if(r>=a||!n)return null;const d=async()=>
543{if(!(!e.current||l)){c(!0);try{const f=e.current,m=document.createElement("canvas");m.width=f.videoWidth||320,m.height=f.videoHeight||240;const p=m.getContext("2d");if(!p)throw new Error("Canvas not supported");p.drawImage(f,0,0,m.width,m.height);const v=await new Promise(j=>m.toBlob(j,"image/jpeg",.85));if(!v)throw new Error("Failed to capture");const g=Date.now(),y=r+1,b=`${t}/blue-eyes-${y}-${g}.jpg`,{error:x}=await S.storage.from("report-screenshots").upload(b,v,{contentType:"image/jpeg",upsert:!1});if(x)throw x;const{data:w}=S.storage.from("report-screenshots").getPublicUrl(b),{error:_}=await S.from("challenge_submissions").insert({user_id:t,challenge_id:n,proof_text:`Blue eyes snap #${y}`,proof_image_url:w.publicUrl,status:"pending"});if(_)throw _;B.success(`📸 Blue eyes snap #${y} captured!`,{description:`${a-y} more to go`}),i()}catch(f){B.error("Snap failed",{description:f.message})}c(!1)}},u=()=>{localStorage.removeItem("blue_eyes_hunt_started"),B.success("👁️ Blue Eyes Hunt disabled",{description:"You can re-enable it from Challenges."}),o==null||o()};return s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsxs("button",{onClick:d,disabled:l,className:"flex items-center gap-1.5 bg-cyan-500/20 hover:bg-cyan-500/30 border border-cyan-400/50 backdrop-blur-sm text-cyan-200 font-black text-xs px-3 py-2 rounded-full transition-all active:scale-[0.95] shadow-[0_0_12px_rgba(34,211,238,0.3)]",children:[l?s.jsx(us,{className:"w-4 h-4 animate-spin"}):s.jsx(Qa,{className:"w-4 h-4"}),"👁️ SNAP BLUE EYES (",r,"/",a,")"]}),s.jsx("button",{onClick:u,className:"bg-red-500/20 hover:bg-red-500/40 border border-red-400/50 backdrop-blur-sm text-red-300 p-2 rounded-full transition-all active:scale-[0.95]",title:"Disable Blue Eyes Hunt",children:s.jsx(We,{className:"w-3.5 h-3.5"})})]})}function I6({remoteVideoRef:e,isConnected:t,userId:n,viewerUserId:r,checkIntervalMs:a=3e3,nudityThreshold:i=.75,maxStrikes:o=3,strikeCooldownMs:l=1e4,persistAcrossPartners:c=!0}){const[d,u]=h.useState(!1),[f,m]=h.useState(0),[p,v]=h.useState(!1),[g,y]=h.useState(null),b=h.useRef(null),x=h.useRef(null),w=h.useRef(!1),_=h.useRef(null),j=h.useRef(0),N=h.useRef(0),k=h.useRef(null),C=h.useRef(null),A=h.useRef(!1),I=h.useRef(!1),O=r&&r!=="anonymous"?r:g;h.useEffect(()=>{let q=!0;S.auth.getUser().then(({data:$})=>{var z;q&&y(((z=$.user)==null?void 0:z.id)??null)});const{data:{subscription:D}}=S.auth.onAuthStateChange(($,z)=>{var R;y(((R=z==null?void 0:z.user)==null?void 0:R.id)??null)});return()=>{q=!1,D.unsubscribe()}},[]);const P=h.useCallback(()=>!n||n==="anonymous"||O&&n===O?null:(k.current=n,n),[n,O]),T=h.useCallback(()=>C.current||P()||k.current,[P]);h.useEffect(()=>{const q=P();if(!q){_.current=null,k.current=null,C.current=null,v(!1),c||(j.current=0,N.current=0,m(0)),A.current=!1,I.current=!1,u(!1);return}_.current!==q&&!c&&(j.current=0,N.current=0,C.current=null,m(0),v(!1),u(!1)),_.current!==q&&(A.current=!1,I.current=!1,u(!1)),_.current=q;let D=!0;return S.rpc("get_partner_nsfw_strikes",{_user_id:q}).then(({data:$,error:z})=>{if(!D||_.current!==q||z)return;const R=Number($??0),U=Math.min(Math.max(0,Math.floor(R)),o);N.current=U,m(U),U>0&&(A.current=!0,I.current=!1,u(!0)),C.current===q&&U<o&&(C.current=null)}),()=>{D=!1}},[P,o,c]),h.useEffect(()=>{w.current||b.current||(w.current=!0,(async()=>{try{const q=await ne(()=>import("./index-COFIFzVj.js").then($=>$.a),[]);try{await q.setBackend("cpu"),await q.ready()}catch{await q.ready()}const D=await ne(()=>import("./index-D4r6PzL8.js"),__vite__mapDeps([0,1]));b.current=await D.load(),console.log("[NSFW] Model loaded")}catch(q){console.error("[NSFW] Failed to load model:",q),w.current=!1}})())},[]),h.useEffect(()=>{t||(!A.current||I.current)&&u(!1)},[t]),h.useEffect(()=>{if(!t)return;const q=P();if(!q){u(!1);return}x.current||(x.current=document.createElement("canvas"),x.current.width=224,x.current.height=224);const D=x.current,$=D.getContext("2d",{willReadFrequently:!0});if(!$)return;const z=setInterval(async()=>{var ee,ae,xe;const R=e.current,U=b.current;if(!(!R||!U||R.readyState<2))try{$.drawImage(R,0,0,D.width,D.height);const te=await U.classify(D),ce=((ee=te.find(ge=>ge.className==="Porn"))==null?void 0:ee.probability)??0,Re=((ae=te.find(ge=>ge.className==="Hentai"))==null?void 0:ae.probability)??0,ye=((xe=te.find(ge=>ge.className==="Sexy"))==null?void 0:xe.probability)??0,fe=Math.max(ce,Re);console.log(`[NSFW] scan P=${ce.toFixed(3)} H=${Re.toFixed(3)} S=${ye.toFixed(3)} nudity=${fe.toFixed(3)} thresh=${i}`),fe>=i?(A.current=!0,u(!0),k.current=q,console.log(`[NSFW] Local detection — nudity: ${(fe*100).toFixed(1)}% (blurred locally)`)):A.current&&!I.current?u(!0):u(!1)}catch(te){console.warn("[NSFW] Classification error:",te)}},a);return()=>clearInterval(z)},[t,a,i,e,P]);const E=h.useCallback(async()=>{var $;const q=T();if(!q){console.error("[NSFW] No valid target user ID for ban");return}const D=O||(($=(await S.auth.getUser()).data.user)==null?void 0:$.id)||null;if(D&&q===D){console.warn("[NSFW] Refusing to ban current user; clearing stale NSFW target:",q),C.current=null,k.current=null,N.current=0,m(0),v(!1),u(!1);return}console.log("[NSFW] Banning user:",q);try{const{data:z,error:R}=await S.functions.invoke("nsfw-ban",{body:{targetUserId:q,banSource:"videocall"}}
543);if(R)throw R;console.log("[NSFW] Ban request sent successfully",z),v(!1),N.current=0,m(0),u(!1),C.current=null,k.current=null}catch(z){console.error("[NSFW] Ban failed:",z)}},[T,O]),W=h.useCallback(async()=>{const q=T();j.current=0,N.current=0,m(0),v(!1),u(!1),C.current=null,q&&await S.from("member_minutes").update({nsfw_strikes:0}).eq("user_id",q)},[T]),V=h.useCallback(()=>{I.current=!0,u(!1)},[]);return{isNsfwBlurred:d,nsfwStrikes:f,showConfirmPrompt:p,confirmBan:E,dismissStrikes:W,manualUnblur:V}}const O6=({onConfirmBan:e,onDismiss:t})=>typeof document>"u"?null:In.createPortal(s.jsx("div",{className:"fixed inset-0 z-[9999] flex items-center justify-center bg-background/80 p-4 backdrop-blur-sm",children:s.jsxs("div",{className:"w-full max-w-sm space-y-5 rounded-2xl border border-border bg-card p-6 text-center shadow-2xl pointer-events-auto",children:[s.jsx("div",{className:"flex justify-center",children:s.jsx("div",{className:"flex h-16 w-16 items-center justify-center rounded-full bg-destructive/15 text-destructive",children:s.jsx(Co,{className:"h-8 w-8"})})}),s.jsx("h2",{className:"text-xl font-bold text-foreground",children:"Is this person doing something inappropriate?"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Our system detected potential inappropriate content. Please confirm — is the other person showing something they shouldn't be?"}),s.jsxs("div",{className:"flex flex-col gap-3 pt-2",children:[s.jsx(ic,{type:"button",onClick:e,variant:"destructive",className:"w-full py-3 text-base font-semibold",children:"Yes, ban them"}),s.jsx(ic,{type:"button",onClick:t,variant:"outline",className:"w-full py-3 text-base font-semibold",children:"No, they're fine"})]})]})}),document.body),Oy=({visible:e,variant:t})=>{if(!e)return null;const n=t==="no-face"?"We can't see your face":"Camera angle looks off",r=t==="no-face"?"Show yourself or your partner can skip you.":"Hold your phone upright at face level.";return s.jsxs("div",{className:"absolute inset-0 z-30 flex flex-col items-center justify-center gap-2 rounded-lg bg-destructive/85 p-4 text-center text-destructive-foreground backdrop-blur-md pointer-events-none",children:[s.jsx(Co,{className:"h-10 w-10"}),s.jsx("p",{className:"text-base font-bold leading-tight",children:n}),s.jsx("p",{className:"text-xs opacity-90",children:r})]})};function D6({localVideoRef:e,isActive:t,graceSeconds:n=5,checkIntervalMs:r=1500}){const[a,i]=h.useState(!1),[o,l]=h.useState(null),c=h.useRef(null),d=h.useRef(null),u=h.useRef(Date.now());return h.useEffect(()=>{if(!t){i(!1),u.current=Date.now();return}const f=globalThis.FaceDetector;let m=!1;if(f)try{c.current=new f({fastMode:!0,maxDetectedFaces:1}),m=!0,l(!0)}catch{m=!1}m||l(!0),d.current||(d.current=document.createElement("canvas"),d.current.width=160,d.current.height=120);const p=d.current,v=p.getContext("2d",{willReadFrequently:!0});if(!v)return;u.current=Date.now();const g=()=>{try{v.drawImage(y,0,0,p.width,p.height);const{data:x}=v.getImageData(0,0,p.width,p.height);let w=0;const _=x.length/4;for(let N=0;N<x.length;N+=4){const k=x[N],C=x[N+1],A=x[N+2],I=.299*k+.587*C+.114*A,O=128-.168736*k-.331264*C+.5*A,P=128+.5*k-.418688*C-.081312*A;I>40&&O>=77&&O<=135&&P>=133&&P<=180&&w++}return w/_>=.03}catch{return!0}};let y=null;const b=setInterval(async()=>{if(y=e.current,!y||y.readyState<2)return;let x=!1;try{if(m&&c.current){v.drawImage(y,0,0,p.width,p.height);const w=await c.current.detect(p);x=!!(w&&w.length>0),x||(x=g())}else x=g()}catch{return}x?(u.current=Date.now(),a&&i(!1)):(Date.now()-u.current)/1e3>=n&&!a&&i(!0)},r);return()=>clearInterval(b)},[t,e,n,r,a]),{noFaceWarning:a,faceDetectorSupported:o}}function L6({isActive:e,uprightMinBeta:t=10,downwardMinBeta:n=-60,sustainedSeconds:r=3}){const[a,i]=h.useState(!1);return h.useEffect(()=>{if(!e||typeof window>"u"){i(!1);return}if(!("DeviceOrientationEvent"in window))return;let o=null,l=0;const c=d=>{const u=typeof d.beta=="number"?d.beta:null;if(u===null)return;u<t&&u>n?(o===null&&(o=Date.now()),(Date.now()-o)/1e3>=r&&(a||(cancelAnimationFrame(l),l=requestAnimationFrame(()=>i(!0))))):(o=null,a&&(cancelAnimationFrame(l),l=requestAnimationFrame(()=>i(!1))))};return window.addEventListener("deviceorientation",c),()=>{window.removeEventListener("deviceorientation",c),cancelAnimationFrame(l)}},[e,t,n,r,a]),{tiltWarning:a}}let Lf=null;async function M6(){return Lf||(Lf=(async()=>{const e=await ne(()=>import("./index-COFIFzVj.js").then(n=>n.a),[]);try{await e.setBackend("cpu"),await e.ready()}catch{await e.ready()}return(await ne(()=>import("./index-D4r6PzL8.js"),__vite__mapDeps([0,1]))).load()})()),Lf}async function nk(e,t=.55){const n=await M6();let r;e instanceof HTMLImageElement?(r=document.createElement("canvas"),r.width=224,r.height=224,r.getContext("2d").drawImage(e,0,0,224,224)):r=e;const a=await n.classify(r),i=m=>{var p;return((p=a.find(v=>v.className===m))==null?void 0:p.probability)??0},o=i("Porn"),l=i("Hentai"),c=i("Sexy"),d=i("Neutral"),u=i("Drawing"),f=Math.max(o,l);return{isNsfw:f>=t,nudityScore:f,scores:{porn:o,hentai:l,sexy:c,neutral:d,drawing:u}}}async function gF(e,t=.55){return new Promise((n,r)=>{const a=new Image;a.crossOrigin="anonymous",a.onload=async()=>{try{const i=await nk(a,t);n(i)}catch(i){r(i)}},a.onerror=()=>r(new Error("Failed to load image for NSFW scan")),a.src=e})}const $6="/assets/shopper-hero-BL_D6eSM.jpg",F6="/assets/shein-logo-DUg8H1p7.png",U6="/assets/amazon-logo-CUquQXNn.png",B6="/assets/hm-logo-DvJrxXY3.png",z6="/assets/gap-logo-D8QvJV-5.png",Dy=["🛍️","💅","👛","💖","✨","🎀","👠","💎","🌸","💕","🛒","🎁"];function q6(){return s.jsx("div",{className:"pointer-events-none absolute inset-0 overflow-hidden z-0",children:Dy.map((e,t)=>{const n=5+t/Dy.length*90,r=t*.7,a=4+t%3*1.5,i=16+t%3*6;return s.jsx("span",{className:"absolute animate-bounce",style:{left:`${n}
543%`,bottom:`-${i}px`,fontSize:`${i}px`,animation:`floatUp ${a}s ${r}s ease-in-out infinite`,opacity:.7},children:e},t)})})}function V6(){const e=[{src:F6,alt:"Shein"},{src:U6,alt:"Amazon"},{src:B6,alt:"H&M"},{src:z6,alt:"Gap"}];return s.jsx("div",{className:"flex items-center justify-center gap-4 py-2",children:e.map((t,n)=>s.jsx("img",{src:t.src,alt:t.alt,className:"h-8 w-auto object-contain opacity-60 grayscale hover:grayscale-0 hover:opacity-100 transition-all"},n))})}function W6(){return s.jsx("div",{className:"flex justify-center mt-1 -mb-1 -mx-5",children:s.jsx("img",{src:$6,alt:"",className:"w-full h-44 object-cover rounded-2xl shadow-lg shadow-pink-500/20"})})}function H6({open:e,onClose:t,userId:n,currentItemCount:r,maxItems:a,onItemAdded:i}){const[o,l]=h.useState("image"),[c,d]=h.useState(null),[u,f]=h.useState(null),[m,p]=h.useState(""),[v,g]=h.useState(null),[y,b]=h.useState(null),[x,w]=h.useState(!1),[_,j]=h.useState(0),N=h.useRef(null);if(h.useEffect(()=>{if(!e)return;(async()=>{const{data:T}=await S.from("wishlist_settings").select("*").limit(1).maybeSingle(),E=(T==null?void 0:T.min_minutes)??400,W=(T==null?void 0:T.max_minutes)??800;j(Math.round(E+Math.random()*(W-E)))})()},[e]),!e)return null;const k=P=>{var W;const T=(W=P.target.files)==null?void 0:W[0];if(!T)return;if(T.size>5*1024*1024){B.error("Image too large",{description:"Max 5MB"});return}d(T);const E=new FileReader;E.onload=V=>{var q;return f((q=V.target)==null?void 0:q.result)},E.readAsDataURL(T),l("questions")},C=()=>{if(!v){B.error("Sorry!",{description:"Only items under $25 are eligible."});return}if(!y){B.error("Sorry!",{description:"This feature is only available for members in the USA."});return}if(!m.trim()){B.error("Please enter the item name");return}l("confirm")},A=async()=>{if(c){w(!0);try{const P=c.name.split(".").pop()||"jpg",T=`${n}/wishlist/${Date.now()}.${P}`,{error:E}=await S.storage.from("member-photos").upload(T,c,{upsert:!0});if(E)throw E;const{data:W}=S.storage.from("member-photos").getPublicUrl(T),V=W.publicUrl,{error:q}=await S.from("wishlist_items").insert({user_id:n,title:m.trim(),description:"",price_cents:2500,source_url:"",image_url:V,images:[V],sizes:[],colors:[],minutes_cost:_,status:"active"});if(q)throw q;B.success("🎯 Item added to your goals!",{description:`Earn ${_} minutes to spin for this item!`}),i(),I(),t()}catch(P){B.error("Failed to save",{description:P.message})}w(!1)}},I=()=>{l("image"),d(null),f(null),p(""),g(null),b(null)},O=a-r;return s.jsxs(s.Fragment,{children:[s.jsx("style",{children:`
544        @keyframes floatUp {
545          0% { transform: translateY(0) scale(1); opacity: 0; }
546          10% { opacity: 0.8; }
547          90% { opacity: 0.6; }
548          100% { transform: translateY(-420px) scale(0.6) rotate(20deg); opacity: 0; }
549        }
550      `}),s.jsx("div",{className:"fixed inset-0 z-50 bg-black/80 backdrop-blur-sm flex items-center justify-center p-4",children:s.jsxs("div",{className:"relative bg-gradient-to-b from-[#2d1033] via-[#1a1a2e] to-[#0f0f0f] rounded-3xl w-full max-w-sm overflow-hidden border border-pink-500/20 max-h-[90vh] overflow-y-auto shadow-[0_0_60px_-10px_rgba(236,72,153,0.3)]",children:[s.jsx(q6,{}),s.jsxs("div",{className:"relative z-10 flex items-center justify-between px-5 pt-5 pb-2",children:[s.jsxs("h2",{className:"text-white font-black text-xl flex items-center gap-2 tracking-tight",children:[s.jsx("span",{className:"text-2xl",children:"🛍️"}),"Pick Your Reward",s.jsx("span",{className:"text-2xl",children:"✨"})]}),s.jsx("button",{onClick:()=>{I(),t()},className:"text-white/40 hover:text-white bg-white/5 rounded-full p-1.5 transition-colors",children:s.jsx(We,{className:"w-4 h-4"})})]}),s.jsxs("div",{className:"relative z-10 px-5 pb-5 space-y-3",children:[s.jsxs("div",{className:"flex items-center justify-center gap-1.5",children:[Array.from({length:a}).map((P,T)=>s.jsx("div",{className:`w-3 h-3 rounded-full border-2 transition-colors ${T<r?"bg-pink-500 border-pink-400":"bg-transparent border-white/20"}`},T)),s.jsxs("span",{className:"text-white/40 text-[10px] ml-2 font-medium",children:[O," left"]})]}),o==="image"&&s.jsxs("div",{className:"space-y-3",children:[s.jsx(W6,{}),s.jsxs("div",{className:"text-center space-y-2",children:[s.jsxs("p",{className:"text-white font-black text-lg",children:["Pick from ",s.jsx("span",{className:"text-pink-400",children:"any website"})," 💕"]}),s.jsxs("p",{className:"text-white/70 text-sm font-medium leading-relaxed",children:["Choose any item under ",s.jsx("span",{className:"text-yellow-400 font-bold",children:"$25"})," — earn it for ",s.jsx("span",{className:"text-pink-400 font-bold",children:"FREE"})," just by chatting!"]})]}),s.jsx(V6,{}),s.jsx("input",{ref:N,type:"file",accept:"image/*",className:"hidden",onChange:k}),s.jsxs("button",{onClick:()=>{var P;return(P=N.current)==null?void 0:P.click()},className:"w-full bg-gradient-to-br from-pink-500/10 to-purple-500/10 border-2 border-dashed border-pink-500/30 hover:border-pink-400/60 rounded-2xl p-6 flex flex-col items-center gap-2 transition-all hover:scale-[1.02] active:scale-[0.98]",children:[s.jsx("div",{className:"bg-pink-500/20 p-3 rounded-full",children:s.jsx(u4,{className:"w-7 h-7 text-pink-400"})}),s.jsx("span",{className:"text-white font-bold text-sm",children:"Tap to upload item p
550hoto"}),s.jsx("span",{className:"text-white/30 text-[10px]",children:"PNG, JPG up to 5MB"})]}),s.jsx("p",{className:"text-center text-white/30 text-[10px]",children:"🇺🇸 USA only · Earn minutes chatting → spin to win!"})]}),o==="questions"&&s.jsxs("div",{className:"space-y-3",children:[u&&s.jsx("div",{className:"rounded-2xl overflow-hidden bg-black/40 border border-white/10 aspect-square max-h-44 mx-auto",children:s.jsx("img",{src:u,alt:"Item",className:"w-full h-full object-contain"})}),s.jsxs("div",{children:[s.jsx("label",{className:"text-white/60 text-xs font-bold block mb-1.5",children:"What's it called? 💅"}),s.jsx("input",{value:m,onChange:P=>p(P.target.value),placeholder:"e.g. Pink Heart Necklace",maxLength:100,className:"w-full bg-white/5 border border-white/10 rounded-xl px-3 py-2.5 text-sm text-white placeholder:text-white/25 focus:outline-none focus:border-pink-500/50 focus:ring-1 focus:ring-pink-500/20"})]}),s.jsxs("div",{children:[s.jsx("label",{className:"text-white/60 text-xs font-bold block mb-1.5",children:"Under $25? 💰"}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx("button",{onClick:()=>g(!0),className:`flex-1 py-2.5 rounded-xl font-bold text-sm transition-all ${v===!0?"bg-green-500 text-white shadow-lg shadow-green-500/20":"bg-white/5 text-white/60 hover:bg-white/10"}`,children:"✅ Yes"}),s.jsx("button",{onClick:()=>g(!1),className:`flex-1 py-2.5 rounded-xl font-bold text-sm transition-all ${v===!1?"bg-red-500 text-white shadow-lg shadow-red-500/20":"bg-white/5 text-white/60 hover:bg-white/10"}`,children:"❌ No"})]})]}),s.jsxs("div",{children:[s.jsx("label",{className:"text-white/60 text-xs font-bold block mb-1.5",children:"Are you in the USA? 🇺🇸"}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx("button",{onClick:()=>b(!0),className:`flex-1 py-2.5 rounded-xl font-bold text-sm transition-all ${y===!0?"bg-green-500 text-white shadow-lg shadow-green-500/20":"bg-white/5 text-white/60 hover:bg-white/10"}`,children:"🇺🇸 Yes"}),s.jsx("button",{onClick:()=>b(!1),className:`flex-1 py-2.5 rounded-xl font-bold text-sm transition-all ${y===!1?"bg-red-500 text-white shadow-lg shadow-red-500/20":"bg-white/5 text-white/60 hover:bg-white/10"}`,children:"❌ No"})]})]}),s.jsxs("div",{className:"flex gap-3 pt-1",children:[s.jsx("button",{onClick:I,className:"flex-1 bg-white/10 hover:bg-white/15 text-white font-medium py-3 rounded-xl transition-colors",children:"← Back"}),s.jsx("button",{onClick:C,disabled:v===null||y===null||!m.trim(),className:"flex-1 bg-gradient-to-r from-pink-500 to-pink-600 hover:from-pink-600 hover:to-pink-700 disabled:opacity-40 text-white font-bold py-3 rounded-xl transition-all shadow-lg shadow-pink-500/20",children:"Next →"})]})]}),o==="confirm"&&s.jsxs("div",{className:"space-y-3",children:[u&&s.jsx("div",{className:"rounded-2xl overflow-hidden bg-black/40 border border-pink-500/20 aspect-square max-h-44 mx-auto shadow-lg shadow-pink-500/10",children:s.jsx("img",{src:u,alt:m,className:"w-full h-full object-contain"})}),s.jsx("h3",{className:"text-white font-bold text-sm text-center",children:m}),s.jsxs("div",{className:"bg-gradient-to-r from-pink-500/15 via-purple-500/15 to-pink-500/15 border border-pink-500/20 rounded-2xl p-4 text-center",children:[s.jsxs("div",{className:"flex items-center justify-center gap-2 mb-1",children:[s.jsx(yr,{className:"w-4 h-4 text-yellow-400"}),s.jsx("span",{className:"text-white/50 text-xs font-medium",children:"Minutes to earn"}),s.jsx(yr,{className:"w-4 h-4 text-yellow-400"})]}),s.jsx("p",{className:"text-4xl font-black text-transparent bg-clip-text bg-gradient-to-r from-pink-400 to-yellow-300",children:_}),s.jsx("p",{className:"text-white/35 text-[10px] mt-1",children:"Chat → earn minutes → spin to win this item! 🎰"})]}),s.jsxs("div",{className:"flex gap-3",children:[s.jsx("button",{onClick:I,className:"flex-1 bg-white/10 hover:bg-white/15 text-white font-medium py-3 rounded-xl transition-colors",children:"← Back"}),s.jsx("button",{onClick:A,disabled:x,className:"flex-1 bg-gradient-to-r from-pink-500 to-purple-600 hover:from-pink-600 hover:to-purple-700 disabled:opacity-40 text-white font-bold py-3 rounded-xl transition-all shadow-lg shadow-pink-500/25 flex items-center justify-center gap-2",children:x?s.jsx(us,{className:"w-4 h-4 animate-spin"}):"🎯 Add to Goals"})]})]})]})]})})]})}const Gr=["💰","🎁","⭐","🍀","💎","🔥","🎯","✨"],Ly=({isWaiting:e,onOpenMyRew
550ards:t})=>{const[n,r]=h.useState(()=>localStorage.getItem("lucky-spin-hidden")==="true"),[a,i]=h.useState(!1),[o,l]=h.useState(null),[c,d]=h.useState([Gr[0],Gr[1],Gr[2]]),u=h.useRef(Date.now()),f=h.useRef(null),m=h.useRef(null),{data:p}=he({queryKey:["lucky-spin-settings"],queryFn:async()=>{const{data:y}=await S.from("lucky_spin_settings").select("*").limit(1).single();return y},staleTime:6e4}),v=h.useCallback(async()=>{if(a)return;i(!0),l(null);let y=0;m.current=setInterval(()=>{d([Gr[Math.floor(Math.random()*Gr.length)],Gr[Math.floor(Math.random()*Gr.length)],Gr[Math.floor(Math.random()*Gr.length)]]),y++,y>8&&m.current&&clearInterval(m.current)},150);const b=Math.floor((Date.now()-u.current)/1e3);try{const{data:x,error:w}=await S.functions.invoke("waiting-spin",{body:{waitSeconds:b}});if(m.current&&clearInterval(m.current),w){i(!1);return}x!=null&&x.won?(d(["💰","💰","💰"]),l({won:!0,amount_display:x.amount_display})):(d(["❌","🍀","❌"]),l({won:!1}))}catch{m.current&&clearInterval(m.current)}setTimeout(()=>{i(!1),l(null)},2500)},[a]);h.useEffect(()=>{if(!e||n||!(p!=null&&p.is_enabled)){f.current&&clearInterval(f.current);return}u.current=Date.now();const y=setTimeout(()=>{v(),f.current=setInterval(v,(p==null?void 0:p.spin_interval_ms)??5e3)},3e3);return()=>{clearTimeout(y),f.current&&clearInterval(f.current),m.current&&clearInterval(m.current)}},[e,n,p==null?void 0:p.is_enabled,v]);const g=()=>{const y=!n;r(y),localStorage.setItem("lucky-spin-hidden",String(y))};return p!=null&&p.is_enabled?n?s.jsxs("button",{onClick:g,className:"flex items-center gap-1.5 text-xs text-neutral-500 hover:text-white transition-colors mt-1",children:[s.jsx($t,{className:"w-3 h-3"}),"Show Lucky Spin"]}):s.jsx("div",{className:"w-full max-w-[280px] mt-2",children:s.jsxs("div",{className:"relative bg-gradient-to-br from-yellow-900/40 to-amber-900/30 border border-yellow-500/30 rounded-xl px-3 py-2.5 backdrop-blur-sm",children:[s.jsx("button",{onClick:g,className:"absolute top-1.5 right-1.5 text-neutral-500 hover:text-white transition-colors",title:"Hide Lucky Spin",children:s.jsx(v_,{className:"w-3.5 h-3.5"})}),s.jsxs("div",{className:"flex items-center gap-1.5 mb-2",children:[s.jsx("span",{className:"text-xs",children:"🎰"}),s.jsx("span",{className:"text-[10px] font-bold text-yellow-400 uppercase tracking-wider",children:"Lucky Spin"}),s.jsx("span",{className:"text-[9px] text-green-400 ml-auto mr-4 font-bold animate-pulse drop-shadow-[0_0_6px_rgba(74,222,128,0.8)]",children:"Earn cash waiting!"})]}),s.jsx("div",{className:"flex items-center justify-center gap-1.5 mb-2 flex-wrap",children:["$0.10","$0.50","$5","$10","$25","$50"].map(y=>s.jsx("span",{className:"text-[9px] bg-yellow-500/10 border border-yellow-500/20 text-yellow-300 px-1.5 py-0.5 rounded-full font-bold",children:y},y))}),s.jsx("div",{className:"flex items-center justify-center gap-2 mb-2",children:c.map((y,b)=>s.jsx("div",{className:`w-12 h-12 bg-black/50 rounded-lg border border-yellow-500/20 flex items-center justify-center text-2xl transition-transform ${a?"animate-pulse":""}`,children:y},b))}),s.jsxs("div",{className:"h-5 flex items-center justify-center",children:[(o==null?void 0:o.won)&&s.jsxs("p",{className:"text-yellow-400 font-black text-sm animate-bounce",children:["🎉 YOU WON ",o.amount_display,"!"]}),o&&!o.won&&s.jsx("p",{className:"text-neutral-500 text-[10px]",children:"Try again..."}),!o&&a&&s.jsx("p",{className:"text-yellow-500/70 text-[10px] animate-pulse",children:"Spinning..."}),!o&&!a&&s.jsx("p",{className:"text-neutral-600 text-[10px]",children:"Stay longer for better odds 🍀"})]}),s.jsxs("p",{className:"text-[9px] text-neutral-500 text-center mt-1",children:["Winnings go to your balance · Cash out anytime via"," ",s.jsx("button",{onClick:t,className:"text-yellow-500/80 underline hover:text-yellow-400 transition-colors",children:"My Rewards → Cash Out"})]})]})}):null},G6=({onDismiss:e,isFemale:t})=>{const[n,r]=h.useState(""),[a,i]=h.useState(!1),{data:o}=he({queryKey:["anchor_settings_power_hour"],queryFn:async()=>{const{data:c}=await S.from("anchor_settings").select("power_hour_start, power_hour_end").limit(1).single();return c},staleTime:6e4}),{data:l}=he({queryKey:["power_hour_opposite_count",t],queryFn:async()=>{const{count:c}=await S.from("members").select("*",{count:"exact",head:!0}).eq("gender",t?"male":"female"),d=Math.floor(Math.random()*6)+3;return Math.min((c||0)+d,t?30:25)},staleTime:3e5});return h.useEffect(()=>{if(!o)return;const c=()=>{const u=new Date,[f,m]=o.power_hour_start.split(":").map(Number),[p,v]=o.power_hour_end.split(":").map(Number),g=new Date(u);g.setUTCHours(f,m,0,0);const y=new Date(u);if(y.setUTCHours(p,v,0,0),y<=g&&y.setUTCDate(y.getUTCDate()+1),u>=g&&u<y){i(!0),r("");return}i(!1);let b=g;u>=y&&(b=new Date(g),b.setUTCDate(b.getUTCDate()+1));const x=Math.max(0,Math.floor((b.getTime()-u.getTime())/1e3)),w=Math.floor(x/3600),_=Math.floor(x%3600/60),j=x%60;r(w>0?`${w}h ${String(_).padStart(2,"0")}m ${String(j).padStart(2,"0")}s`:`${_}m ${String(j).padStart(2,"0")}s`)};c();const d=setInterval(c,1e3);return()=>clearInterval(d)},[o]),o?s.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/80 backdrop-blur-sm px-4 animate-in fade-in duration-300",children:s.jsxs("div",{className:"bg-neutral-900 rounded-2xl p-5 max-w-sm w-full text-center relative border border-amber-600/40 overflow-hidden",children:[s.jsx("div",{className:"absolute inset-0 bg-gradient-to-b from-amber-600/10 via-trans
550parent to-orange-600/10 pointer-events-none"}),s.jsx("button",{onClick:e,className:"absolute top-3 right-3 z-10",children:s.jsx(We,{className:"w-5 h-5 text-neutral-500 hover:text-white transition-colors"})}),a?s.jsx(s.Fragment,{children:s.jsxs("div",{className:"relative z-10",children:[s.jsx("div",{className:"w-16 h-16 mx-auto mb-3 rounded-full bg-green-500/20 border-2 border-green-500 flex items-center justify-center animate-pulse",children:s.jsx(nh,{className:"w-8 h-8 text-green-400"})}),s.jsx("h2",{className:"text-2xl font-black text-white mb-1",children:"⚡ Power Hour is LIVE!"}),s.jsx("p",{className:"text-green-400 font-bold text-sm mb-3",children:t?`${l||"Several"} guys are online right now — chat & earn!`:`${l||"Several"} girls showed up — start chatting!`}),s.jsx("div",{className:"bg-green-900/30 border border-green-600/30 rounded-xl p-3 mb-4",children:t?s.jsxs("div",{className:"space-y-2",children:[s.jsxs("div",{className:"flex items-center gap-2 justify-center",children:[s.jsx(ds,{className:"w-4 h-4 text-yellow-400"}),s.jsx("span",{className:"text-white text-sm font-bold",children:"Chat & get rewarded! 💰"})]}),s.jsxs("p",{className:"text-green-300/80 text-xs",children:[l||"Several"," male users are here for Power Hour. Meet new guys and earn rewards for every chat — or get gifted by them! 🎁"]})]}):s.jsxs("div",{className:"space-y-2",children:[s.jsxs("div",{className:"flex items-center gap-2 justify-center",children:[s.jsx($0,{className:"w-4 h-4 text-pink-400"}),s.jsxs("span",{className:"text-white text-sm font-bold",children:[l||"Several"," girls are online! 👀"]})]}),s.jsx("p",{className:"text-green-300/80 text-xs",children:"They showed up — hit Start to find your next match instantly!"})]})}),s.jsx("button",{onClick:e,className:"w-full bg-gradient-to-r from-green-500 to-emerald-600 text-white font-black text-sm py-3 rounded-full hover:opacity-90 transition-opacity shadow-lg tracking-wide",children:"🚀 START CHATTING NOW"})]})}):s.jsx(s.Fragment,{children:s.jsxs("div",{className:"relative z-10",children:[s.jsx("div",{className:"w-16 h-16 mx-auto mb-3 rounded-full bg-amber-500/20 border-2 border-amber-500 flex items-center justify-center",children:s.jsx(er,{className:"w-8 h-8 text-amber-400"})}),s.jsx("h2",{className:"text-2xl font-black text-white mb-1",children:"⏳ Power Hour Starting Soon!"}),s.jsx("p",{className:"text-amber-300 text-sm mb-3",children:t?`${l||"Several"} male users have opted to join this session — chat & earn rewards!`:`${l||"Several"} female users opted to join this session! Will they show up? Only time will tell 👀`}),s.jsxs("div",{className:"bg-neutral-800 rounded-xl px-6 py-4 mb-4 border border-amber-600/30",children:[s.jsx("p",{className:"text-neutral-400 text-xs uppercase tracking-wider mb-1",children:"Starts in"}),s.jsx("p",{className:"text-amber-400 font-mono text-3xl font-black tracking-wider",children:n||"..."})]}),s.jsxs("div",{className:"bg-neutral-800/60 rounded-xl p-3 mb-4 text-left space-y-2",children:[s.jsxs("p",{className:"text-white/80 text-xs font-bold flex items-center gap-1.5",children:[s.jsx(Ur,{className:"w-3.5 h-3.5 text-amber-400"}),"While you wait:"]}),t?s.jsxs(s.Fragment,{children:[s.jsxs("p",{className:"text-white/50 text-[11px] pl-5",children:["✅ ",l||"Several"," guys are waiting — more rewards for you!"]}),s.jsx("p",{className:"text-white/50 text-[11px] pl-5",children:"✅ Chat & earn minutes or get gifted by them 🎁"}),s.jsx("p",{className:"text-white/50 text-[11px] pl-5",children:"✅ You can start chatting now — Power Hour boosts activity!"})]}):s.jsxs(s.Fragment,{children:[s.jsxs("p",{className:"text-white/50 text-[11px] pl-5",children:["✅ ",l||"Several"," girls opted in — log in and wait!"]}),s.jsx("p",{className:"text-white/50 text-[11px] pl-5",children:"✅ You can start chatting now — don't have to wait!"}),s.jsx("p",{className:"text-white/50 text-[11px] pl-5",children:"✅ Check the Discover page to find people to call"})]})]}),s.jsx("button",{onClick:e,className:"w-full bg-gradient-to-r from-amber-500 to-orange-600 text-white font-black text-sm py-3 rounded-full hover:opacity-90 transition-opacity shadow-lg tracking-wide",children:"👍 GOT IT — START CHATTING"})]})})]})}):null};function K6(e,t){const n=new Date,[r,a]=e.split(":").map(Number),[i,o]=t.split(":").map(Number),l=new Date(n);l.setUTCHours(r,a,0,0);const c=new Date(n);c.setUTCHours(i,o,0,0),c<=l&&c.setUTCDate(c.getUTCDate()+1);const d=n>=l&&n<c;let u=l;return n>=c&&(u=new Date(l),u.setUTCDate(u.getUTCDate()+1)),{target:u,isLive:d,sessionDate:u.toISOString().slice(0,10)}}const Y6=({userId:e,isFemale:t,onClose:n})=>{const r=wt(),[a,i]=h.useState(""),[o,l]=h.useState(!1),{data:c}=he({queryKey:["anchor_settings_power_hour"],queryFn:async()=>{const{data:g}=await S.from("anchor_settings").select("power_hour_start, power_hour_end").limit(1).single();return g},staleTime:6e4}),d=h.useMemo(()=>c?K6(c.power_hour_start,c.power_hour_end):null,[c]),{data:u}=he({queryKey:["power_hour_optins",d==null?void 0:d.sessionDate],enabled:!!d,staleTime:3e4,queryFn:async()=>{const{data:g}=await S.from("power_hour_optins").select("user_id, gender").eq("session_date",d.sessionDate),y=g??[];return{opposite:y.filter(x=>(x.gender??"").toLowerCase()===(t?"male":"female")).length,total:y.length,joined:y.some(x=>x.user_id===e)}}});h.useEffect(()=>{if(!d)return;const g=()=>{const b=Math.max(0,Math.floor((d.target.getTime()-Date.now())/1e3)),x=Math.floor(b/3600),w=Math.floor(b%3600/60),_=b%60;i(x>0?`${x}h ${String(w).padStart(2,"0")}m ${String(_).padStart(2,"0")}s`:`${w}m ${String(_).padStart(2,"0")}s`)};g();const y=setInterval(g,1e3);return()=>clearInterval(y)},[d]);const f=d?d.target.toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"}):"",m=async()=>
550{if(!d)return;l(!0);const{error:g}=await S.from("power_hour_optins").upsert({user_id:e,session_date:d.sessionDate,gender:t?"female":"male"},{onConflict:"user_id,session_date"});if(l(!1),g){B.error("Couldn't save your spot — try again");return}B.success("You're in! We'll notify you when Power Hour starts ⚡"),r.invalidateQueries({queryKey:["power_hour_optins",d.sessionDate]})};if(!c||!d)return null;const p=t?"guys":"girls",v=(u==null?void 0:u.opposite)??0;return In.createPortal(s.jsx("div",{className:"fixed inset-0 z-[100] flex items-center justify-center bg-black/80 backdrop-blur-sm px-4 animate-in fade-in duration-200",children:s.jsxs("div",{className:"bg-neutral-900 rounded-2xl p-5 max-w-sm w-full text-center relative border border-amber-600/40",children:[s.jsx("button",{onClick:n,className:"absolute top-3 right-3 z-10",children:s.jsx(We,{className:"w-5 h-5 text-neutral-500 hover:text-white transition-colors"})}),s.jsx("div",{className:"w-14 h-14 mx-auto mb-3 rounded-full bg-amber-500/20 border-2 border-amber-500 flex items-center justify-center",children:s.jsx(nh,{className:"w-7 h-7 text-amber-400"})}),s.jsx("h2",{className:"text-xl font-black text-white mb-1",children:"⚡ Join the next Power Hour"}),s.jsx("p",{className:"text-amber-300 text-sm mb-3",children:"Everyone hops on at the same time so the room is packed — no more empty queue."}),s.jsxs("div",{className:"bg-neutral-800 rounded-xl px-4 py-3 mb-3 border border-amber-600/30",children:[s.jsx("p",{className:"text-neutral-400 text-[11px] uppercase tracking-wider mb-1",children:d.isLive?"Happening now":`Starts at ${f} your time`}),s.jsx("p",{className:"text-amber-400 font-mono text-2xl font-black tracking-wider",children:d.isLive?"LIVE NOW":a||"..."})]}),s.jsxs("div",{className:"flex items-center justify-center gap-2 bg-neutral-800/60 rounded-xl py-2.5 mb-4",children:[s.jsx(Ur,{className:"w-4 h-4 text-pink-400"}),s.jsx("p",{className:"text-white/80 text-xs font-semibold",children:v>0?`${v} ${p} already signed up for this session`:`Be one of the first — ${p} get notified too`})]}),u!=null&&u.joined?s.jsxs("div",{className:"w-full bg-green-600/20 border border-green-500/40 text-green-300 font-bold text-sm py-3 rounded-full flex items-center justify-center gap-2",children:[s.jsx(a4,{className:"w-4 h-4"}),"You're on the list — we'll ping you"]}):s.jsxs("button",{onClick:m,disabled:o,className:"w-full bg-gradient-to-r from-amber-500 to-orange-600 text-white font-black text-sm py-3 rounded-full hover:opacity-90 transition-opacity shadow-lg tracking-wide flex items-center justify-center gap-2 disabled:opacity-60",children:[s.jsx(i4,{className:"w-4 h-4"}),o?"SAVING...":"NOTIFY ME & SAVE MY SPOT"]}),s.jsx("button",{onClick:n,className:"mt-3 text-neutral-500 hover:text-white text-xs",children:"Keep chatting"})]})}),document.body)},My=({myUserId:e,myGender:t,onDmUser:n,onOpenDiscover:r,onDismiss:a})=>{const[i,o]=h.useState(!1),l=(t==null?void 0:t.toLowerCase())==="female"?"male":"female";h.useEffect(()=>{o(!1)},[e,t]);const{data:c=[]}=he({queryKey:["empty-queue-bridge",l,e],staleTime:6e4,queryFn:async()=>{const{data:u}=await S.from("members").select("id, name, image_url, last_active_at").eq("is_discoverable",!0).eq("image_status","approved").ilike("gender",l).neq("id",e).not("image_url","is",null).order("last_active_at",{ascending:!1,nullsFirst:!1}).limit(6);return u??[]}});if(i||c.length===0)return null;const d=l==="female"?"girls":"guys";return In.createPortal(s.jsx("div",{className:"fixed inset-0 z-[200] flex items-center justify-center bg-black/70 backdrop-blur-sm p-4 animate-in fade-in duration-200",children:s.jsxs("div",{className:"relative w-full max-w-md rounded-3xl border border-pink-500/40 bg-gradient-to-b from-pink-500/15 to-[#1a0f1a] p-5 shadow-2xl",children:[s.jsx("button",{onClick:()=>{o(!0),a==null||a()},"aria-label":"Dismiss",className:"absolute top-3 right-3 w-8 h-8 flex items-center justify-center rounded-full bg-white/10 hover:bg-white/20 text-white transition-colors",children:s.jsx(We,{className:"w-4 h-4"})}),s.jsxs("div",{className:"flex items-start gap-2 mb-4 pr-8",children:[s.jsx(j_,{className:"w-5 h-5 text-pink-400 shrink-0 mt-0.5"}),s.jsxs("div",{children:[s.jsx("h3",{className:"text-white text-base font-bold leading-snug",children:"It's quiet right now"}),s.jsxs("p",{className:"text-white/80 text-xs leading-snug mt-1",children:["Don't leave — these ",d," were online recently. Send a message and they get notified instantly."]})]})]}),s.jsx("div",{className:"grid grid-cols-3 gap-2",children:c.map(u=>s.jsxs("div",{className:"relative aspect-[3/4] rounded-xl overflow-hidden border border-white/10",children:[s.jsx("img",{src:u.image_url,alt:u.name,className:"w-full h-full object-cover",loading:"lazy"}),s.jsxs("div",{className:"absolute bottom-0 inset-x-0 bg-gradient-to-t from-black/90 to-transparent p-1.5 pt-5",children:[s.jsx("p",{className:"text-white text-[10px] font-bold truncate",children:u.name}),s.jsxs("button",{onClick:()=>n(u.id),className:"mt-1 flex items-center justify-center gap-1 w-full py-1 rounded-md bg-pink-600 hover:bg-pink-500 text-white text-[10px] font-bold transition-colors",children:[s.jsx(An,{className:"w-3 h-3"}),"Message"]})]})]},u.id))}),s.jsx("button",{onClick:r,className:"mt-4 w-full py-2.5 rounded-full bg-white/10 hover:bg-white/20 text-white text-sm font-bold transition-colors",children:"Browse everyone on Discover →"})]})}),document.body)},Q6=({partnerId:e,onMessage:t,onClose:n})=>{const{data:r}=he({queryKey:["skip-recapture-partner",e],queryFn:async()=>{const{data:o}=await S.from("members").select("name, image_url, gender").eq("id",e).maybeSingle();return o}}),i=((r==null?void 0:r.gender)??"").toLowerCase()==="female"?"her":"him";return In.createPortal(s.jsx("div",{className:"fixed inset-0 z-[100] flex items-center justify-center bg-black/80 backdrop-blur-sm px-4 animate-in fade-in duration-200",children:s.jsxs("div",{className:"bg-neutral-900 rounded-2xl p-5 max-w-xs w-full text-center relative border border-pink-500/40",children:[s.jsx("button",{onClick:n,className:"absolute top-3 right-3",children:s.jsx(We,{className:"w-5 h-5 text-neutral-500 hover:text-white transition-colors"})}),r!=null&&r.image_url?s.jsx("img",{src:r.image_url,alt:(r==null?void 0:r.name)??"partner",className:"w-20 h-20 rounded-full object-cover mx-auto mb-3 border-2 border-pink-500"}):s.jsx("div",{className:"w-20 h-20 rounded-full bg-pink-500/20 border-2 border-pink-500 mx-auto mb-3 flex items-center justify-center",children:s.jsx(An,{className:"w-8 h-8 text-pink-400"})}),s.jsx("h3",{className:"text-white font-black text-lg mb-1",children:"That was quick 👀"}),s.jsxs("p",{className:"text-white/60 text-xs mb-4",children:["Send ",(r==null?void 0:r.name)??i," a message — ",i," gets a notification even after leaving."]}),s.jsxs("button",{onClick:()=>t(e),className:"w-full bg-gradient-to-r from-pink-500 to-purple-600 text-white font-black text-sm py-3 rounded-full hover:opacity-90 transition-opacity flex items-center justify-center gap-2",children:[s.jsx(An,{className:"w-4 h-4"}),"MESSAGE ",r!=null&&r.name?r.name.toUpperCase():i.toUpperCase()]}),s.jsx("button",{onClick:n,className:"mt-3 text-neutral-500 hover:text-white text-xs",children:"Keep swiping"})]})}),document.body)},J6="/assets/app-preview-with-badges-CpdXtaeS.jpeg",X6="/assets/app-preview-female-v2-DogMRuh8.jpeg",Z6="/assets/app-store-badge-BvVTZTYM.png",e$="/assets/google-play-badge-CsEHl2b
550n.svg",t$="https://play.google.com/store/apps/details?id=com.c24club.app&hl=en_US",n$="https://apps.apple.com/us/app/c24-club/id6766305883",r$=({onClose:e,userId:t,gender:n,context:r="quiet_waiting_room",isMobile:a=!0,onBrowseDiscover:i})=>{const l=(n||"").toLowerCase()==="female"?X6:J6,c=h.useRef(null),d=h.useRef(null),[u,f]=h.useState(null);h.useEffect(()=>{if(!t||t==="anonymous")return;let g=!1;return S.from("app_download_clicks").insert({user_id:t,source:null,context:r,clicked:!1,dismissed:!1}).select("id").single().then(({data:y})=>{!g&&(y!=null&&y.id)&&(c.current=y.id,f(y.id))}),()=>{g=!0}},[t,r]);const m=g=>{d.current="clicked",!(!t||t==="anonymous")&&(c.current?S.from("app_download_clicks").update({source:g,clicked:!0}).eq("id",c.current).then(()=>{}):S.from("app_download_clicks").insert({user_id:t,source:g,context:r,clicked:!0}).then(()=>{}))},p=()=>{d.current!=="clicked"&&c.current&&t&&t!=="anonymous"&&S.from("app_download_clicks").update({dismissed:!0,dismissed_at:new Date().toISOString()}).eq("id",c.current).then(()=>{}),e()},v=()=>{m("popup-browse-discover"),i==null||i(),e()};return s.jsx("div",{className:"fixed inset-0 z-[70] bg-black/85 backdrop-blur-sm flex items-center justify-center px-4",children:s.jsxs("div",{className:"relative bg-neutral-900 border border-white/10 rounded-2xl p-5 max-w-sm w-full text-center shadow-[0_0_40px_rgba(234,179,8,0.25)] max-h-[90vh] overflow-y-auto animate-scale-in",children:[s.jsx("button",{onClick:p,className:"absolute top-3 right-3 bg-neutral-800 hover:bg-neutral-700 rounded-full p-1.5 transition-colors z-10",children:s.jsx(We,{className:"w-5 h-5 text-white"})}),s.jsx("span",{className:"absolute -top-3 -left-3 text-3xl animate-bounce",style:{animationDuration:"2s"},children:"🔔"}),s.jsx("span",{className:"absolute -top-3 -right-3 text-3xl animate-bounce",style:{animationDuration:"2.5s",animationDelay:"0.3s"},children:"📲"}),s.jsx("span",{className:"absolute -bottom-3 left-6 text-2xl animate-bounce",style:{animationDuration:"1.8s",animationDelay:"0.6s"},children:"🎉"}),s.jsx("span",{className:"absolute -bottom-3 right-6 text-2xl animate-bounce",style:{animationDuration:"2.2s",animationDelay:"0.9s"},children:"✨"}),s.jsxs("div",{className:"mb-4 mt-1",children:[s.jsxs("div",{className:"flex items-center justify-center gap-2 mb-2",children:[s.jsx(yr,{className:"w-5 h-5 text-yellow-400 animate-pulse"}),s.jsx("h2",{className:"text-white font-black text-xl uppercase tracking-wide",children:"🤫 It's Quiet Here!"}),s.jsx(yr,{className:"w-5 h-5 text-yellow-400 animate-pulse",style:{animationDelay:"0.5s"}})]}),s.jsx("p",{className:"text-orange-400 font-bold text-sm mb-1 animate-pulse",style:{animationDuration:"3s"},children:"🔥 Everyone is on our App! 🔥"}),s.jsx("p",{className:"text-neutral-300 text-sm leading-relaxed",children:"Get Notified Instantly When A Female/Male is searching!"}),s.jsx("p",{className:"text-yellow-400 font-bold text-sm mt-2 animate-pulse",style:{animationDuration:"2.5s"},children:"⚡ Get Our App To Get Notified Instantly for FREE! 🔔"})]}),a?s.jsxs("div",{className:"flex gap-3 mb-4",children:[s.jsx("a",{href:n$,target:"_blank",rel:"noopener noreferrer",onClick:()=>m("popup-ios"),className:"flex-1 rounded-xl overflow-hidden transition-all hover:scale-105 duration-300 shadow-[0_0_15px_rgba(161,161,170,0.3)] hover:shadow-[0_0_25px_rgba(161,161,170,0.5)]",children:s.jsx("img",{src:Z6,alt:"Download on the App Store",className:"w-full h-auto"})}),s.jsx("a",{href:t$,target:"_blank",rel:"noopener noreferrer",onClick:()=>m("popup-android"),className:"flex-1 rounded-xl overflow-hidden transition-all hover:scale-105 duration-300 shadow-[0_0_20px_rgba(34,197,94,0.4)] hover:shadow-[0_0_30px_rgba(34,197,94,0.6)]",children:s.jsx("img",{src:e$,alt:"Get it on Google Play",className:"w-full h-auto"})})]}):s.jsxs("div",{className:"mb-4",children:[s.jsxs("button",{onClick:v,className:"w-full flex items-center justify-center gap-2 py-3 px-4 rounded-xl bg-gradient-to-r from-yellow-500 to-orange-500 text-black font-bold uppercase tracking-wide hover:scale-[1.02] transition-transform shadow-[0_0_20px_rgba(234,179,8,0.4)]",children:[s.jsx(Ur,{className:"w-5 h-5"}),"Browse Discover While You Wait"]}),s.jsx("p",{className:"text-neutral-400 text-xs mt-2",children:"Send a gift or DM members from Discover — we'll keep you in the queue."})]}),s.jsx("div",{className:"block rounded-xl overflow-hidden border border-yellow-500/30 shadow-[0_0_20px_rgba(234,179,8,0.2)]",children:s.jsx("img",{src:l,alt:"C24Club App Preview",className:"w-full h-auto"})})]})})},s$="https://play.google.com/store/apps/details?id=com.c24club.app&hl=en_US",$y="c24_app_mini_banner_count",a$=5,i$=({userId:e,gender:t})=>{const[n,r]=h.useState(!1);return h.useEffect(()=>{const a=/android/i.test(navigator.userAgent),i=(t==null?void 0:t.toLowerCase())==="female",o=parseInt(localStorage.getItem($y)||"0",10);a&&!i&&o<a$&&(r(!0),localStorage.setItem($y,String(o+1)))},[t]),n?s.jsxs("div",{className:"fixed bottom-20 left-0 right-0 z-40 mx-3 bg-gradient-to-r from-neutral-900 to-neutral-800 border border-yellow-500/30 rounded-xl px-3 py-2.5 flex items-center gap-3 shadow-[0_0_15px_rgba(234,179,8,0.15)] animate-fade-in",children:[s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("p",{className:"text-white text-xs font-bold leading-tight",children:"🔥 Everyone is on our App!"}),s.jsx("p",{className:"text-neutral-300 text-[11px] leading-tight mt-0.5",children:"Get Notified when a female user is online and searching"})]}),s.jsx("a",{href:s$,target:"_blank",rel:"noopener noreferrer",className:"shrink-0 bg-green-500 hover:bg-green-600 text-white text-[10px] font-black uppercase px-3 py-1.5 rounded-lg transition-colors shadow-md",children:"Get App"}),s.jsx("button",{onClick:()=>r(!1),className:"shrink-0 p-1 hover:bg-white/10 rounded-full transition-colors",children:s.jsx(We,{className:"w-4 h-4 text-neutral-400"})})]}):null},o$="/assets/c24-logo-D_VvDZlL.png",Fy="/assets/next-btn-DdwZFWMA.png",l$="/assets/redeem-Cx6j-tt8.png",c$="/assets/topics-bubble-Debx9GjM.png",u$="/assets/promo-star-DvVS_EJB.png",d$="/assets/profile-avatar-BbfXZmR4.png",h$="/assets/vip-rocket-DygmVaf2.png",Mf="/assets/frozen-emoji-DnjL48O9.png",f$={girls:"Female",both:"Both",guys:"Male"},m$=()=>{QI({title:"Video Chat Now — Free 1-on-1 Random Chat | C24 Club",description:"Start a free 1-on-1 random video chat instantly. Get matched in seconds, chat safely with AI moderation, and earn reward minutes as you go.",path:"/videocall"});const e=wt(),t=sn(),{user:n,loading:r,banInfo:a,recheckBan:i,signOut:o}=it(),[l,c]=h.useState("both"),[d,u]=h.useState(!1),[f,m]=h.useState(!1),p=h.useRef(!1),[v,g]=h.useState(!1),[y,b]=h.useState(!1),[x,w]=h.useState(!1),[_,j]=h.useState(!1),[N,k]=h.useState(0),[C,A]=h.useState(!1),[I,O]=h.useState(!1),[P,T]=h.useState(()=>localStorage.getItem("user_gender")==="female"),[E,W]=h.useState(()=>!sessionStorage.getItem("c24_quickstart_seen")),[V,q]=h.useState(!1),[D,$]=h.useState(!1),[z,R]=h.useState(!1),[U,ee]=h.useState(!0),[ae,xe]=h.useState(!1),[te,ce]=h.useState(null),[Re,ye]=h.useState(!1),{data:fe=0}=Gj(),[ge,J]=h.useState(!1),[ue,Ee]=h.useState(!1),Y=h.useRef(0),Q=h.useRef(null),[le,de]=h.useState(!1),me=h.useRef(null),Le=h.useRef(null),[Ke,Qe]=h.useState("quiet_waiting_room"),tt=typeof navigator<"u"&&/android|iphone|ipad|ipod/i.test(navigator.userAgent),[an,Wt]=h.useState(!1),[De,pe]=h.useState(null),[Qt,nt]=h.useState(void 0),M=(n==null?void 0:n.id)??"anonymous",Ve=h.useRef(M),{data:Ue}=he({queryKey:["member_gender",M],enabled:M!=="anonymous",queryFn:async()=>{const{data:H}=await S.from("members").select("gender").eq("id",M).maybeSingle();return(H==null?void 0:H.gender)??null}}),{data:Ze,refetch:ft}=he({queryKey:["member_discoverable",M],enabled:M!=="anonymous",queryFn:async()=>{const{data:H}=await S.from("members").select("image_url, image_thumb_url").eq("id",M).maybeSingle();return{hasImage:!!(H!=null&&H.image_url),imageUrl:(H==null?void 0:H.image_thumb_url)||(H==null?void 0:H.image_url)||null}}}),Rt=(Ze==null?void 0:Ze.hasImage)??!1,lt=(Ze==null?void 0:Ze.imageUrl)??null,on=Rt===!1,F=(Ue==null?void 0:Ue.toLowerCase())==="female",{data:Pe=0,refetch:Z}=he({queryKey:["wishlist_count",M],enabled:M!=="anonymous"&&F,queryFn:async()=>{const{count:H}=await S.from("wishlist_items").select("*",{count:"exact",head:!0}).eq("user_id",M).eq("status","active");return H??0}});h.useEffect(()=>{if(!F||M==="anonymous"||!Rt||Pe>0)return;const H=`c24_goal_picker_shown_${M}`;if(localStorage.getItem(H))return;const ve=setTimeout(()=>{R(!0),localStorage.setItem(H,"1")},1500);return()=>clearTimeout(ve)},[F,M,Rt,Pe]);const{callState:G,hasStartedMatchmaking:et,error:ze,currentPartnerId:ie,partnerVoiceMode:be,partnerGender:Ce,localVideoRef:$e,remoteVideoRef:ct,localStreamRef:_t,startCall:rt,next:mt,stop:ut,enableCamera:pt,startPreview:ua}=nO({memberId:M,genderPreference:f$[l],memberGender:Ue??void 0,voiceMode:F?P:!1});h.useEffect(()=>{Ve.current!==M&&Ve.current!=="anonymous"&&(console.log("[VideoCall] User changed, stopping call to prevent cross-account issues"),ut()),Ve.current=M},[M,ut]),h.useEffect(()=>{if(!n)return;const H=sessionStorage.getItem("client_ip");H&&S.from("members").update({last_ip:H}).eq("id",n.id).then(()=>{})},[n]);const{partnerBlackScreen:jr}=oO({remoteVideoRef:ct,localStreamRef:_t,isConnected:G==="connected"&&!be}),{localBlackScreen:Nc}=lO({localVideoRef:$e,isActive:G!=="idle"&&!(F&&P)}),{isBlurred:ri}=cO(G==="connected",ie,2e3),{isNsfwBlurred:si,showConfirmPrompt:jh,confirmBan:kc,dismissStrikes:Sc,manualUnblur:Io}=I6({remoteVideoRef:ct,isConnected:G==="connected",userId:ie||"",viewerUserId:M,nudityThreshold:.75}),{noFaceWarning:Cc}=D6({localVideoRef:$e,isActive:G==="connected"&&!(F&&P)}),{tiltWarning:Ec}=L6({isActive:G==="connected"}),da=Cc?"no-face":Ec?"tilt":null,Pc=iO({userId:M,isOnCall:G==="connected",isStarted:et,partnerGender:Ce}),Oo=F&&y&&!Pc.verificationRequired,{totalMinutes:ha,giftedMinutes:Nh,elapsedSeconds:Nr,showCapPopup:Tc,capInfo:ai,dismissCapPopup:Rc,flushMinutes:ii,freezeInfo:fa,refreshBalance:Do}=Pj({userId:M,partnerId:ie||(Oo&&G!=="idle"?"queue":null),isConnected:G==="connected"||Oo&&G!=="idle",voiceMode:F?P:!1}),[Ac,bs]=h.useState(!1),Lo=h.useRef(!1);aO({userId:M,isConnected:G==="connected",elapsedSeconds:Nr,onAwarded:()=>{Do()}}),h.useEffect(()=>{if(fa.isFrozen&&!Lo.current){const H=localStorage.getItem("freeze_popup_snoozed_until");if(H&&Date.now()<Number(H))return;Lo.current=!0,bs(!0)}},[fa.isFrozen]);const{adPoints:Mo,awardAdPoints:oi,refreshBalance:Ic}=uO({userId:M,isConnected:G==="connected",elapsedSeconds:Nr}),{data:ys}=he({queryKey:["speed_connect_challenge"],queryFn:async()=>{const{data:H}=await S.from("weekly_challenges").select("*").eq("is_active",!0).order("created_at",{ascending:!0});return(H||[]).find(Se=>{try{const Je=JSON.parse(Se.auto_track_action||"null");
550return(Je==null?void 0:Je.type)==="auto_speed_connect"}catch{return!1}})||null}}),Oc=ys?(()=>{try{const H=JSON.parse(ys.auto_track_action||"null");return{challengeId:ys.id,slug:ys.slug||"speed-connect",targetPeople:(H==null?void 0:H.target)||20,timeLimitMinutes:ys.target_minutes||30}}catch{return null}})():null;sO({userId:n==null?void 0:n.id,currentPartnerId:ie,isConnected:G==="connected",challengeConfig:Oc});const{vipTier:$o,subscribed:kr,startCheckout:Fo,openPortal:kh,checkSubscription:Uo}=_c((n==null?void 0:n.id)??null);h.useEffect(()=>{if(M==="anonymous")return;const H=new Set,ve=new Set;let Se=!0,Je=!0;const At=async()=>{const{data:tr}=await S.from("gift_transactions").select("id, status, minutes_amount").eq("recipient_id",M).eq("status","completed").order("updated_at",{ascending:!1}).limit(3);if(tr==null||tr.forEach(pn=>{if(H.has(pn.id)||(H.add(pn.id),Se))return;const ln=pn.minutes_amount||0,nr=(ln*.01).toFixed(2);B.success(`🎁 Someone gifted you ${ln} minutes = $${nr}!`,{description:"Cash out via PayPal now!",action:{label:"Cash Out",onClick:()=>pe("my-rewards")},duration:1e4})}),Se=!1,!F){const{data:pn}=await S.from("camera_unlock_requests").select("id, status").eq("requester_id",M).in("status",["accepted","declined"]).order("updated_at",{ascending:!1}).limit(1),ln=pn==null?void 0:pn[0];if(ln){const nr=`${ln.id}:${ln.status}`;ve.has(nr)||(ve.add(nr),Je||(ln.status==="accepted"?(B.success("📹 Camera unlocked! Your partner accepted.",{duration:5e3}),ye(!0)):ln.status==="declined"&&B("Partner declined the camera request. You'll be refunded.",{duration:5e3})))}}if(F&&ie){const{data:pn}=await S.from("camera_unlock_requests").select("id, status, recipient_cut_cents, requester_id").eq("recipient_id",M).eq("status","paid").order("updated_at",{ascending:!1}).limit(1),ln=pn==null?void 0:pn[0];if(ln&&ln.requester_id===ie){const nr=`${ln.id}:${ln.status}`;ve.has(nr)||(ve.add(nr),Je||ce({id:ln.id,recipient_cut_cents:ln.recipient_cut_cents}))}}Je=!1};At();const Jt=setInterval(At,5e3);return()=>clearInterval(Jt)},[M,F,ie]),h.useEffect(()=>{new URLSearchParams(window.location.search).get("camera_unlock")==="success"&&(B.success("Payment verified! Waiting for partner to accept...",{duration:5e3}),window.history.replaceState({},"","/videocall"))},[]);const[Dc,Bo]=h.useState(!1),[Lc,li]=h.useState(!1),[ma,zo]=h.useState(!1),[qo,ci]=h.useState(!1),[K,Ne]=h.useState(null);h.useEffect(()=>{new URLSearchParams(window.location.search).get("from")==="power_hour"&&(Bo(!0),window.history.replaceState({},"","/videocall"))},[]),h.useEffect(()=>{if(G!=="waiting"||M==="anonymous"){li(!1);return}if(K||ma&&!qo)return;const H=`c24_ph_invite_${new Date().toISOString().slice(0,10)}`;if(localStorage.getItem(H))return;const ve=setTimeout(()=>{localStorage.setItem(H,"1"),li(!0)},3e4);return()=>clearTimeout(ve)},[G,M,ma,qo,K]),h.useEffect(()=>{if(G!=="waiting"){zo(!1);return}ci(!1);const H=setTimeout(()=>zo(!0),2e4);return()=>clearTimeout(H)},[G]);const{data:Ie}=he({queryKey:["lucky-spin-carousel-setting"],queryFn:async()=>{const{data:H}=await S.from("lucky_spin_settings").select("hide_carousel").limit(1).single();return(H==null?void 0:H.hide_carousel)??!1},staleTime:6e4});h.useEffect(()=>{F&&!P&&!sessionStorage.getItem("c24_voice_mode_toggled")&&T(!0)},[F]);const st=h.useRef(!1);h.useEffect(()=>{M!=="anonymous"&&!st.current&&!(F&&P)&&(st.current=!0,ua())},[M,F,P,ua]);const Ge=h.useCallback(async()=>{const H=_t.current,ve=$e.current;if(!H||!ve||ve.readyState<2)return!1;const Se=document.createElement("canvas");Se.width=224,Se.height=224;const Je=Se.getContext("2d",{willReadFrequently:!0});return Je?(Je.drawImage(ve,0,0,Se.width,Se.height),(await nk(Se,.55)).isNsfw):!1},[_t,$e]),[Me,Fe]=h.useState(!1),Wn=h.useRef(!1),[On,Sr]=h.useState(!1);h.useEffect(()=>{if(M==="anonymous"||Wn.current||G!=="idle"||F&&P)return;let H=!1;const ve=setTimeout(async()=>{Wn.current=!0;try{const Se=await Ge();if(H)return;Se&&(Fe(!0),B.error("Inappropriate content detected in your camera. Please adjust and reload the page to try again.",{duration:8e3}))}catch(Se){console.warn("[pre-call moderation] failed",Se)}},2500);return()=>{H=!0,clearTimeout(ve)}},[M,G,F,P,Ge]),h.useEffect(()=>{b(!1),j(!1),k(0)},[F,M]),h.useEffect(()=>{const H=ve=>{ve.preventDefault(),pe("messages")};return window.addEventListener("open-dm-overlay",H),()=>window.removeEventListener("open-dm-overlay",H)},[]),h.useEffect(()=>{const H=()=>{pe(null),ut()};return window.addEventListener("prepare-direct-call",H),()=>window.removeEventListener("prepare-direct-call",H)},[ut]),h.useEffect(()=>{!kr&&l!=="both"&&c("both")},[kr,l]),h.useEffect(()=>{G==="connected"?Q.current=Date.now():Q.current=null},[G]),h.useEffect(()=>{G==="connected"&&F&&(Ce==null?void 0:Ce.toLowerCase())==="female"&&B.info("You don't earn cashable minutes when connected to the same gender",{duration:5e3})},[G,F,Ce]),h.useEffect(()=>{G==="connected"&&De==="discover"&&(pe(null),B("Match found! 🎉",{description:"You've been connected to someone!"}))},[G,De]),h.useEffect(()=>{G==="connected"?Le.current=null:G!=="waiting"&&Le.current===null&&(Le.current=Date.now())},[G]),h.useEffect(()=>{if(G==="waiting"){const H=Le.current&&Date.now()-Le.current<15e3?"after_skip_no_match":"quiet_waiting_room";Qe(H),me.current=setTimeout(()=>{const ve=parseInt(localStorage.getItem("c24_app_popup_last_shown")||"0",10),Se=7*24*60*60*1e3;let Je=parseInt(localStorage.getItem("c24_app_popup_count")||"0",10);ve&&Date.now()-ve>Se&&(Je=0),Je<5&&(de(!0),localStorage.setItem("c24_app_popup_count",String(Je+1)),localStorage.setItem("c24_app_popup_last_shown",String(Date.now())))},7e3)}else me.current&&(clearTimeout(me.current),me.current=null),de(!1);return()=>{me.current&&clearTimeout(me.current)}},[G]);const{data:mn}=he({queryKey:["bestie_active_pair",M,ie],enabled:!!M&&!!ie&&G==="connected",queryFn:async()=>{const{data:H}=await S.from("bestie_pairs").select("*").eq("status","active").or(`and(inviter_id.eq.${M},invitee_id.eq.${ie}),and(inviter_id.eq.${ie},invitee_id.eq.${M})`).maybeSingle();return H}}
550),Sh=h.useRef(!1),Vo=h.useRef(!1);h.useEffect(()=>{if(!mn||G!=="connected"){Sh.current=!1,Vo.current=!1;return}const H=setInterval(()=>{S.functions.invoke("bestie-call",{body:{action:"log_time",pair_id:mn.id,seconds_to_add:30}}).catch(()=>{})},3e4),ve=(5+Math.random()*15)*60*1e3,Se=setTimeout(async()=>{if(Vo.current)return;Vo.current=!0;const Je=mn.inviter_id===M?"inviter":"invitee",At=(mn.days_completed||0)+1;if($e.current){const Jt=await Iy($e.current,M,mn.id,At,Je);Jt&&S.functions.invoke("bestie-call",{body:{action:"save_screenshot",pair_id:mn.id,day_number:At,screenshot_path:Jt,role:Je}}).catch(()=>{})}if(ct.current){const Jt=Je==="inviter"?"invitee":"inviter",tr=await Iy(ct.current,M,mn.id,At,`${Jt}_from_${Je}`);tr&&S.functions.invoke("bestie-call",{body:{action:"save_screenshot",pair_id:mn.id,day_number:At,screenshot_path:tr,role:Jt}}).catch(()=>{})}},ve);return()=>{clearInterval(H),clearTimeout(Se)}},[mn,G,M]);const[sk,ak]=h.useState(localStorage.getItem("blue_eyes_hunt_started")==="true"),{data:Vr}=he({queryKey:["blue_eyes_challenge"],queryFn:async()=>{const{data:H}=await S.from("weekly_challenges").select("*").eq("slug","blue-eyes-hunt").eq("is_active",!0).maybeSingle();return H}}),{data:yx=[],refetch:ik}=he({queryKey:["blue_eyes_snaps",M,Vr==null?void 0:Vr.id],enabled:!!M&&!!(Vr!=null&&Vr.id),queryFn:async()=>{const{data:H}=await S.from("challenge_submissions").select("*").eq("user_id",M).eq("challenge_id",Vr.id).order("created_at",{ascending:!0});return H||[]}}),{data:ui=[]}=he({queryKey:["auto_challenges"],queryFn:async()=>{const{data:H}=await S.from("weekly_challenges").select("*").eq("is_active",!0).eq("challenge_type","auto").not("target_minutes","is",null);return(H||[]).filter(ve=>{try{const Se=JSON.parse(ve.auto_track_action||"null");return!Se||Se.type!=="auto_speed_connect"}catch{return!0}})}}),{data:vx=[]}=he({queryKey:["auto_submissions",M,ui.map(H=>H.id).join(",")],enabled:!!M&&ui.length>0,queryFn:async()=>{const{data:H}=await S.from("challenge_submissions").select("*").eq("user_id",M).in("challenge_id",ui.map(ve=>ve.id));return H||[]}}),pa=h.useRef({}),Ch=h.useRef({}),Mc=h.useRef(new Set);h.useEffect(()=>{if(ui.length===0||!M)return;const H=ui.filter(ve=>{const Se=`${ve.slug}_started`,Je=`${ve.slug}_minutes`;go(Se),go(Je);const At=localStorage.getItem(Se)==="true",Jt=vx.some(tr=>tr.challenge_id===ve.id);return At&&!Jt&&!Mc.current.has(ve.id)});if(H.length!==0)if(G==="connected"&&ie){for(const Se of H)Ch.current[Se.id]!==ie&&(pa.current[Se.id]=Date.now(),Ch.current[Se.id]=ie,localStorage.setItem(`${Se.slug}_minutes`,"0")),pa.current[Se.id]||(pa.current[Se.id]=Date.now());const ve=setInterval(async()=>{for(const Se of H){if(!pa.current[Se.id]||Mc.current.has(Se.id))continue;const Je=Math.floor((Date.now()-pa.current[Se.id])/6e4);localStorage.setItem(`${Se.slug}_minutes`,String(Je));const At=Se.target_minutes||60;if(Je>=At&&!Mc.current.has(Se.id)){Mc.current.add(Se.id);const{error:Jt}=await S.from("challenge_submissions").insert({user_id:M,challenge_id:Se.id,proof_text:`${Se.title} completed: ${At}+ minutes continuous call`,status:"pending"});Jt||(B.success(`🎉 ${Se.title} COMPLETE!`,{description:`${At}-minute call achieved! Submitted for review.`,duration:8e3}),localStorage.removeItem(`${Se.slug}_minutes`))}}},15e3);return()=>clearInterval(ve)}else for(const ve of H)pa.current[ve.id]&&(delete pa.current[ve.id],delete Ch.current[ve.id],localStorage.setItem(`${ve.slug}_minutes`,"0"))},[G,ie,ui,vx,M]);
550const Ht=Mj();h.useEffect(()=>{Ht&&F&&!p.current&&(p.current=!0,m(!0))},[Ht,F]);const wx=async H=>{const{data:ve}=await S.from("pinned_topics").select("topic_id").eq("user_id",H);if(!ve||ve.length===0)return[];const Se=ve.map(At=>At.topic_id),{data:Je}=await S.from("topics").select("id, name").in("id",Se);return Je||[]},{data:$c=[]}=he({queryKey:["my_pinned_topics",M],enabled:M!=="anonymous",queryFn:()=>wx(M)}),{data:Fc=[]}=he({queryKey:["partner_pinned_topics",ie],enabled:!!ie&&G==="connected",queryFn:()=>wx(ie)}),{data:ok}=he({queryKey:["partner_is_vip",ie],enabled:!!ie&&G==="connected",refetchInterval:G==="connected"?1e4:!1,queryFn:async()=>{const{data:H}=await S.rpc("is_user_vip",{_user_id:ie});return H??!1}}),{data:_x}=he({queryKey:["partner_is_frozen",ie],enabled:!!ie&&G==="connected",queryFn:async()=>!1}),{data:Wo=[]}=he({queryKey:["partner_pinned_socials",ie],enabled:!!ie&&G==="connected",refetchInterval:G==="connected"?1e4:!1,queryFn:async()=>{const{data:H}=await S.rpc("is_user_vip",{_user_id:ie});if(!H)return[];const{data:ve}=await S.from("vip_settings").select("pinned_socials").eq("user_id",ie).maybeSingle();return(ve==null?void 0:ve.pinned_socials)??[]}});h.useEffect(()=>{const H=new URLSearchParams(window.location.search);if(["unban","checkout","unfreeze","unfreeze_partner","gift","camera_unlock","from"].some(ve=>H.get(ve))&&ee(!1),H.get("unban")==="success"&&a&&(i(),window.history.replaceState({},"","/videocall")),H.get("checkout")==="success"&&(Uo(),window.history.replaceState({},"","/videocall")),H.get("unfreeze")==="success"&&(S.functions.invoke("unfreeze-purchase",{body:{action:"apply"}}),window.history.replaceState({},"","/videocall")),H.get("unfreeze_partner")==="success"){const ve=H.get("partner_id");ve&&S.functions.invoke("unfreeze-purchase",{body:{action:"apply_for_partner",partner_id:ve}}).then(()=>{B.success("🥶 You unfroze their minutes! What a hero!"),e.invali
550dateQueries({queryKey:["partner_is_frozen"]})}),window.history.replaceState({},"","/videocall")}if(H.get("gift")==="success"){const ve=H.get("session_id");ve&&S.functions.invoke("gift-minutes",{body:{action:"verify",session_id:ve}}).then(({data:Se})=>{Se!=null&&Se.success&&B.success(`Gift sent! ${Se.minutes_gifted} minutes gifted.${Se.sender_bonus>0?` You got +${Se.sender_bonus} minutes bonus!`:""}`)}),window.history.replaceState({},"","/videocall")}},[a,i,Uo]);const jx=ni();h.useEffect(()=>{var H;(H=jx.state)!=null&&H.openVip&&(ee(!1),pe("vip"),window.history.replaceState({},"","/videocall"))},[jx.state]);const lk=h.useCallback(()=>{oi(Nr).catch(()=>{}),ii().catch(()=>{}),ut().catch(()=>{}),t("/")},[oi,Nr,ii,ut,t]);if(!r&&!n){const H=window.location.search,ve=H?`/videocall${H}`:"/videocall";return s.jsx(Hm,{to:`/?returnTo=${encodeURIComponent(ve)}`,replace:!0})}if(!r&&n&&Ue===null&&M!=="anonymous")return s.jsx(Hm,{to:"/?needsOnboarding=1",replace:!0});if(!r&&a)return s.jsx(rO,{reason:a.reason,banType:a.ban_type,createdAt:a.created_at});const Dt=G!=="idle",ck=Math.floor(Nr/60),uk=Nr%60,dk=`${String(ck).padStart(2,"0")}:${String(uk).padStart(2,"0")}`,hk=async()=>{if(Me){B.error("Your camera was flagged for inappropriate content. Please reload and try again.",{duration:6e3});return}if(!(M==="anonymous"||F&&P)){Sr(!0);try{if(await Ge()){Fe(!0),Sr(!1),B.error("Inappropriate content detected. Please adjust and reload to try again.",{duration:8e3});return}}catch(ve){console.warn("[pre-call moderation @click] failed — allowing start",ve)}finally{Sr(!1)}}rt()},Nx=async()=>{const H=ie,ve=Q.current?(Date.now()-Q.current)/1e3:0;H&&H!==M&&(S.functions.invoke("report-fast-skip",{body:{reportedUserId:H,skipSeconds:ve}}).catch(Se=>console.warn("[fast-skip] report failed",Se)),B.success("Reported — thanks for keeping C24 safe")),await Eh()},Eh=async()=>{const ve=(Q.current?Date.now()-Q.current:1/0)/1e3,Se=ve<5,Je=ie,At=(Ce??"").toLowerCase(),Jt=(Ue??"").toLowerCase(),tr=parseInt(sessionStorage.getItem("c24_recapture_count")||"0",10);if(Je&&ve<90&&ve>2&&At&&Jt&&At!==Jt&&tr<3&&(sessionStorage.setItem("c24_recapture_count",String(tr+1)),Ne(Je)),Se&&!kr){if(ha>0){const{data:nr}=await S.functions.invoke("earn-minutes",{body:{type:"deduct",userId:M,amount:2}});nr!=null&&nr.success&&Do()}Y.current+=1,Y.current<=3?J(!0):Ee(!0)}await oi(Nr),await ii();const{data:pn}=await S.from("vip_settings").select("show_promo_ads").eq("user_id",M).maybeSingle();((pn==null?void 0:pn.show_promo_ads)??!0)&&Wt(!0),mt()},fk=()=>{lk()};return s.jsxs("div",{className:"min-h-screen bg-black text-white font-['Antigone',sans-serif] flex flex-col",children:[!r&&n&&!on&&U&&s.jsxs("div",{className:"fixed inset-0 z-[60] bg-black flex flex-col items-center justify-center p-4 md:p-8",children:[s.jsx("div",{className:"absolute top-4 right-4",children:s.jsxs("button",{onClick:async()=>{await o(),t("/")},className:"flex items-center gap-2 px-3 py-1.5 rounded-full bg-white/5 hover:bg-white/10 text-white/70 hover:text-white text-xs font-medium transition-colors border border-white/10",children:[s.jsx(d4,{className:"w-3.5 h-3.5"}),"Log out"]})}),s.jsxs("div",{className:"text-center mb-8 md:mb-12",children:[s.jsx("h1",{className:"text-3xl md:text-5xl font-black text-white mb-3",children:"How do you want to connect?"}),s.jsx("p",{className:"text-neutral-400 text-sm md:text-base",children:"Pick what feels right right now."})]}),s.jsxs("div",{className:"w-full max-w-4xl grid grid-cols-1 md:grid-cols-2 gap-4 md:gap-6",children:[s.jsxs("button",{onClick:()=>ee(!1),className:"group relative flex flex-col items-center justify-center gap-4 roun
550ded-2xl border border-neutral-700 bg-neutral-900 p-8 md:p-12 transition-all hover:border-red-500/50 hover:bg-neutral-800",children:[s.jsx("div",{className:"flex h-16 w-16 md:h-20 md:w-20 items-center justify-center rounded-full bg-red-600/20 text-red-500",children:s.jsx(mr,{className:"h-8 w-8 md:h-10 md:w-10"})}),s.jsx("span",{className:"text-xl md:text-2xl font-black text-white",children:"Start random video call"}),s.jsx("span",{className:"text-sm text-neutral-400",children:"Get matched face-to-face instantly"})]}),s.jsxs("button",{onClick:()=>t("/discover"),className:"group relative flex flex-col items-center justify-center gap-4 rounded-2xl border border-green-500/30 bg-green-950/30 p-8 md:p-12 transition-all hover:border-green-500/60 hover:bg-green-950/50",children:[s.jsxs("div",{className:"absolute top-4 right-4 flex items-center gap-1.5 rounded-full bg-green-500/20 px-3 py-1 text-xs font-bold text-green-400",children:[s.jsxs("span",{className:"relative flex h-2 w-2",children:[s.jsx("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-green-400 opacity-75"}),s.jsx("span",{className:"relative inline-flex h-2 w-2 rounded-full bg-green-400"})]}),"More active"]}),s.jsx("div",{className:"flex h-16 w-16 md:h-20 md:w-20 items-center justify-center rounded-full bg-green-600/20 text-green-500",children:s.jsx(An,{className:"h-8 w-8 md:h-10 md:w-10"})}),s.jsx("span",{className:"text-xl md:text-2xl font-black text-white",children:"Start text chat with someone"}),s.jsx("span",{className:"text-sm text-neutral-400",children:"More people are texting right now"})]})]})]}),s.jsxs("div",{className:"flex items-center justify-between px-3 py-2 md:relative",children:[s.jsx("div",{className:"flex items-center gap-2 md:absolute md:left-3 md:top-1/2 md:-translate-y-1/2",children:s.jsx("button",{onClick:fk,className:"p-1 hover:bg-white/10 rounded-full transition-colors",children:s.jsx(Rn,{className:"w-8 h-8"})})}),s.jsxs("div",{className:"text-right md:text-center md:flex-1",children:[s.jsxs("div",{className:"flex items-center justify-end md:justify-center gap-1.5 text-2xl md:text-3xl font-black",children:[s.jsx("span",{children:"⏱️"}),fa.isFrozen?s.jsxs("span",{className:"text-blue-300",children:["🥶 ",ha," Frozen"]}):s.jsxs("span",{children:[ha," Minutes"]})]}),fa.isFrozen&&s.jsx("div",{className:"text-blue-400 text-xs font-bold animate-pulse cursor-pointer hover:text-blue-300 transition-colors",onClick:()=>bs(!0),children:"unfreeze me"}),G==="connected"&&s.jsxs("div",{className:"flex items-center justify-end md:justify-center gap-1 text-[10px] text-green-400 font-mono font-bold",children:[s.jsx("div",{className:"w-1.5 h-1.5 rounded-full bg-green-500 animate-pulse"}),s.jsx("span",{children:dk})]}),s.jsxs("div",{className:"flex items-center justify-end md:justify-center gap-1 text-sm md:text-lg text-yellow-400 font-bold",children:[s.jsx("span",{children:"⭐"}),s.jsxs("span",{children:[Mo," Ad Points"]})]})]})]}),ze&&s.jsx("div",{className:"mx-4 mb-2 px-4 py-2 bg-red-900/60 border border-red-700 rounded-lg text-sm text-center",children:ze}),s.jsxs("div",{className:"flex-1 flex flex-col md:flex-row gap-3 mx-3 mb-2 min-h-0 md:justify-center md:items-center md:max-w-4xl md:mx-auto md:w-full md:flex-none",children:[s.jsxs("div",{className:"flex-1 md:flex-none md:w-[420px] md:aspect-[3/4] rounded-xl border border-neutral-700 bg-neutral-900 relative overflow-hidden flex items-center justify-center",children:[!Dt&&s.jsxs("div",{className:"absolute inset-0 z-10 bg-black/70 flex flex-col items-center justify-center gap-3",children:[s.jsx("img",{src:o$,alt:"C24 Club",className:"w-48 md:w-56 drop-shadow-lg"}),F&&s.jsxs("button",{onClick:()=>{T(!P),sessionStorage.setItem("c24_voice_mode_toggled","true")},className:`flex items-center gap-2 px-4 py-2 rounded-full text-sm font-bold transition-all shadow-lg ${P?"bg-pink-600 text-white shadow-pink-500/30":"bg-neutral-700 text-neutral-300 shadow-neutral-800/30"}`,children:[s.jsx("span",{children:"🎙️"}),s.jsxs("span",{children:["Voice Mode ",P?"ON":"OFF"]})]}),on?s.jsx("button",{onClick:()=>q(!0),className:"bg-pink-500 hover:bg-pink-600 text-white font-black text-lg px-8 py-3 rounded-xl transition-colors shadow-lg flex items-center gap-2",children:"📸 Take a Selfie to Start"}
550):s.jsx("button",{onClick:hk,disabled:Me||On,className:`font-black text-xl px-10 py-2.5 rounded-lg transition-colors shadow-lg ${Me||On?"bg-neutral-700 text-neutral-400 cursor-not-allowed opacity-60":"bg-red-600 hover:bg-red-700 text-white"}`,children:Me?"BLOCKED":On?"CHECKING…":"START"}),on&&s.jsx("p",{className:"text-white/50 text-xs text-center max-w-[250px]",children:"Quick selfie so others can discover you — takes 3 seconds!"})]}),!Dt&&E&&s.jsx(TM,{onDismiss:()=>{W(!1),sessionStorage.setItem("c24_quickstart_seen","1")}}),!Ht&&F&&P&&Dt&&s.jsxs("div",{className:"absolute inset-0 z-10 bg-gradient-to-br from-neutral-900 via-neutral-800 to-neutral-900 flex flex-col items-center justify-center px-4",children:[s.jsx("div",{className:"w-20 h-20 md:w-28 md:h-28 rounded-full bg-gradient-to-br from-pink-500/30 to-purple-600/30 border-2 border-pink-500/40 flex items-center justify-center mb-3 overflow-hidden",children:lt?s.jsx("img",{src:lt,alt:"You",className:"w-full h-full object-cover"}):s.jsx("span",{className:"text-4xl md:text-5xl",children:"🎙️"})}),s.jsx("span",{className:"text-pink-400 text-xs font-bold mb-2",children:"Voice Mode Active"}),s.jsxs("div",{className:"bg-green-900/40 border border-green-500/30 rounded-lg px-3 py-2 max-w-[280px] text-center",children:[s.jsx("p",{className:"text-green-400 text-[11px] font-bold",children:"💰 Guys pay to see you!"}),s.jsx("p",{className:"text-neutral-400 text-[10px] mt-0.5",children:'Chat & have fun to get more camera unlock requests and earn a cut. Just tell him "if you want to see me click unlock camera"'})]})]}),Ht?s.jsxs(s.Fragment,{children:[be&&G==="connected"&&s.jsx(ky,{videoRef:ct,partnerId:ie,className:"z-20 absolute inset-0"}),s.jsx("video",{ref:ct,autoPlay:!0,playsInline:!0,className:`absolute inset-0 w-full h-full object-cover ${G==="connected"&&!be?"opacity-100":"opacity-0 pointer-events-none"} ${ri||si?"blur-[30px] transition-[filter] duration-500":"transition-[filter] duration-500"}`}),si&&!ri&&G==="connected"&&!be&&s.jsxs("div",{className:"absolute inset-0 z-30 flex flex-col items-center justify-center gap-3 pointer-events-none",children:[s.jsxs("div",{className:"bg-black/70 backdrop-blur-sm rounded-xl px-4 py-2 text-center pointer-events-none",children:[s.jsx("p",{className:"text-white font-bold text-sm",children:"⚠️ Inappropriate content detected"}),s.jsx("p",{className:"text-neutral-300 text-xs mt-0.5",children:"Video blurred for your safety"})]}),s.jsx("button",{onClick:Io,className:"bg-white text-black font-bold text-sm px-5 py-2 rounded-full shadow-lg pointer-events-auto active:scale-95 transition-transform",children:"Unblur"})]}),jr&&G==="connected"&&!be&&s.jsxs("div",{className:"absolute inset-0 z-30 bg-black flex flex-col items-center justify-center pointer-events-none",children:[s.jsx("span",{className:"text-4xl",children:"📵"}),s.jsx("p",{className:"text-white font-black text-sm mt-2",children:"PARTNER IS FACELESS"}),s.jsx("p",{className:"text-neutral-400 text-xs text-center px-4 mt-1",children:"Tap Next to skip"})]}),Fc.length>0&&G==="connected"&&s.jsx("div",{className:"absolute bottom-10 left-2 z-20 flex flex-wrap gap-1.5 max-w-[70%]",children:Fc.map(H=>s.jsxs("span",{className:"bg-blue-600/80 backdrop-blur-sm text-white text-[11px] font-bold px-2.5 py-1 rounded-full shadow-lg",children:["📌 ",H.name]},H.id))})]}):s.jsx("video",{ref:$e,autoPlay:!0,muted:!0,playsInline:!0,className:`absolute inset-0 w-full h-full object-cover ${F&&P&&Dt?"hidden":"block"}`}),da&&G==="connected"&&!(F&&P)&&s.jsx(Oy,{visible:!0,variant:da}),an&&s.jsx(ZL,{viewerId:M,onDismiss:()=>Wt(!1)}),Dt&&s.jsx("button",{onClick:ut,className:"absolute top-2 left-2 z-20 bg-black/60 hover:bg-red-600 backdrop-blur-sm rounded-full p-1.5 transition-colors",children:s.jsx(We,{className:"w-5 h-5"})}),!Ht&&Nc&&Dt&&G==="connected"&&s.jsxs("div",{className:"absolute inset-0 z-30 bg-black/80 flex flex-col items-center justify-center pointer-events-none",children:[s.jsx("span",{className:"text-5xl",children:"📵"}),s.jsx("p",{className:"text-white font-black text-base mt-2 text-center px-4",children:"YOUR CAMERA IS OFF"}),s.jsx("p",{className:"text-yellow-400 text-sm text-center px-6 mt-1 animate-pulse font-bold",children:"Turn on your camera to see your partner"})]}),G==="waiting"&&Ht&&s.jsx("div",{className:"absolute inset-0 bg-black/60 flex items-center justify-center z-10 overflow-y-auto",children:s.jsxs("div",{className:"flex flex-col items-center gap-3 py-4",children:[s.jsx("div",{className:"w-10 h-10 border-4 border-white/30 border-t-white rounded-full animate-spin"}),s.jsx("p",{className:"text-sm text-neutral-300",children:"Finding a partner..."}
550),s.jsx(Ly,{isWaiting:G==="waiting",onOpenMyRewards:()=>pe("my-rewards")}),Ie&&s.jsx("button",{onClick:()=>pe("discover"),className:"mt-2 px-4 py-2 bg-pink-600 hover:bg-pink-500 text-white text-xs font-bold rounded-full transition-colors",children:Ue==="Female"?"View Guys On Discover":"View Girls On Discover"}),!Ie&&s.jsx(Ry,{myGender:Ue??null,myUserId:M,onOpenDiscover:()=>pe("discover"),onOpenStore:()=>pe("store"),onOpenMessages:()=>pe("messages"),onDmUser:H=>{nt(H),pe("messages")}}),ma&&M!=="anonymous"&&s.jsx(My,{myUserId:M,myGender:Ue??null,onDmUser:H=>{nt(H),pe("messages")},onOpenDiscover:()=>pe("discover"),onDismiss:()=>ci(!0)})]})}),G==="connected"&&ie&&Ht&&s.jsx("button",{onClick:()=>A(!0),className:"absolute top-12 left-2 z-20 w-8 h-8 rounded-full overflow-hidden hover:scale-110 transition-transform shadow-lg",title:"Report User",children:s.jsx("img",{src:Cp,alt:"Report",className:"w-full h-full object-cover"})}),Ht&&Wo.length>0&&G==="connected"&&s.jsx("div",{className:"absolute top-[5.5rem] left-2 z-20",children:s.jsx(Cd,{pinnedSocials:Wo})}),Ht&&G==="connected"&&_x&&ie&&s.jsx("button",{onClick:()=>O(!0),className:"absolute left-2 z-20 w-10 h-10 hover:scale-110 transition-transform drop-shadow-lg",style:{top:Wo.length>0?"calc(5.5rem + 2.5rem)":"5.5rem"},title:"This user is frozen",children:s.jsx("img",{src:Mf,alt:"Frozen",className:"w-full h-full object-contain"})}),G==="connected"&&ok&&ie&&s.jsx("button",{onClick:()=>g(!0),className:"absolute bottom-10 left-3 z-20 animate-bounce",children:s.jsx("img",{src:Tj,alt:"Send Gift",className:"w-12 h-12 drop-shadow-lg"})}),G==="connected"&&be&&!F&&ie&&!Re&&Ht&&s.jsx("div",{className:"absolute bottom-14 left-3 z-20",children:s.jsx(Ay,{recipientId:ie})}),G==="connected"&&ie&&Vr&&yx.length<2&&sk&&s.jsx("div",{className:"absolute z-20 bottom-3 left-1/2 -translate-x-1/2",children:s.jsx(A6,{remoteVideoRef:ct,userId:M,challengeId:Vr.id,snapsCount:yx.length,maxSnaps:2,onSnapTaken:()=>ik(),onDisable:()=>ak(!1)})}),Dt&&s.jsxs("button",{onClick:Eh,className:"md:hidden absolute bottom-3 right-3 flex flex-col items-center bg-black/60 hover:bg-black/80 backdrop-blur-sm rounded-lg px-3 py-1.5 transition-colors z-40",children:[s.jsx("span",{className:"font-bold text-sm",children:"NEXT"}),s.jsx("img",{src:Fy,alt:"Next",className:"w-9 h-9"})]}),Dt&&G==="connected"&&F&&(Ce==null?void 0:Ce.toLowerCase())==="male"&&s.jsxs("button",{onClick:Nx,title:"Skip and flag as inappropriate",className:"md:hidden absolute bottom-3 right-[88px] flex flex-col items-center bg-destructive/80 hover:bg-destructive backdrop-blur-sm rounded-lg px-3 py-1.5 transition-colors z-40 text-destructive-foreground",children:[s.jsx("span",{className:"font-bold text-xs",children:"🚩 SKIP"}),s.jsx("span",{className:"text-[9px] leading-none mt-0.5",children:"inappropriate"})]}),Ht&&s.jsxs("div",{className:"absolute top-2 right-2 z-10 w-[30%] aspect-[3/4] rounded-lg border border-neutral-600 bg-neutral-800 overflow-hidden shadow-xl",children:[F&&P&&Dt?s.jsxs("div",{className:"w-full h-full bg-gradient-to-br from-neutral-900 via-neutral-800 to-neutral-900 flex flex-col items-center justify-center overflow-hidden",children:[s.jsx("span",{className:"text-2xl",children:"🎙️"}),s.jsx("span",{className:"text-pink-400 text-[7px] font-bold",children:"Voice Mode"})]}):s.jsx("video",{ref:$e,autoPlay:!0,muted:!0,playsInline:!0,className:"w-full h-full object-cover block",style:{transform:"scaleX(-1)"}}),da&&G==="connected"&&!(F&&P)&&s.jsx(Oy,{visible:!0,variant:da}),G!=="connected"&&G!=="idle"&&s.jsx("div",{className:"absolute inset-0 w-full h-full flex items-center justify-center bg-neutral-800/60",children:s.jsx("p",{className:"text-neutral-300 text-[10px] text-center px-1",children:G==="connecting"?"Connecting...":G==="waiting"?"Searching...":""})}),$c.length>0&&Dt&&s.jsx("div",{className:"absolute bottom-1 left-1 z-20 flex flex-wrap gap-1 max-w-[90%]",children:$c.map(H=>s.jsxs("span",{className:"bg-red-600/80 backdrop-blur-sm text-white text-[9px] font-bold px-1.5 py-0.5 rounded-full shadow-lg",children:["📌 ",H.name]}
550,H.id))})]}),!Ht&&$c.length>0&&Dt&&s.jsx("div",{className:"absolute bottom-10 left-2 z-20 flex flex-wrap gap-1.5 max-w-[70%]",children:$c.map(H=>s.jsxs("span",{className:"bg-red-600/80 backdrop-blur-sm text-white text-[11px] font-bold px-2.5 py-1 rounded-full shadow-lg",children:["📌 ",H.name]},H.id))}),s.jsx("span",{className:"absolute bottom-3 left-3 md:right-3 md:left-auto z-10 text-white/15 text-2xl md:text-3xl font-black tracking-widest pointer-events-none select-none",children:"C24CLUB"})]}),!Ht&&s.jsxs("div",{className:"flex-none w-[420px] aspect-[3/4] rounded-xl border border-neutral-700 bg-neutral-900 relative overflow-hidden flex items-center justify-center",children:[be&&G==="connected"&&s.jsx(ky,{videoRef:ct,partnerId:ie,className:"z-20"}),s.jsx("video",{ref:ct,autoPlay:!0,playsInline:!0,className:`absolute inset-0 w-full h-full object-cover ${G==="connected"&&!be?"block":"hidden"} ${ri||si?"blur-[30px] transition-[filter] duration-500":"transition-[filter] duration-500"}`}),si&&!ri&&G==="connected"&&!be&&s.jsxs("div",{className:"absolute inset-0 z-30 flex flex-col items-center justify-center gap-3 pointer-events-none",children:[s.jsxs("div",{className:"bg-black/70 backdrop-blur-sm rounded-xl px-4 py-2 text-center pointer-events-none",children:[s.jsx("p",{className:"text-white font-bold text-sm",children:"⚠️ Inappropriate content detected"}),s.jsx("p",{className:"text-neutral-300 text-xs mt-0.5",children:"Video blurred for your safety"})]}),s.jsx("button",{onClick:Io,className:"bg-white text-black font-bold text-sm px-5 py-2 rounded-full shadow-lg pointer-events-auto active:scale-95 transition-transform",children:"Unblur"})]}),jr&&G==="connected"&&!be&&s.jsxs("div",{className:"absolute inset-0 z-30 bg-black flex flex-col items-center justify-center pointer-events-none",children:[s.jsx("span",{className:"text-4xl",children:"📵"}),s.jsx("p",{className:"text-white font-black text-sm mt-2",children:"PARTNER IS FACELESS"}),s.jsx("p",{className:"text-neutral-400 text-xs text-center px-6 mt-1",children:"Their camera is off or covered. Press Next to skip."})]}),Nc&&G==="connected"&&!jr&&s.jsxs("div",{className:"absolute inset-0 z-30 bg-black flex flex-col items-center justify-center pointer-events-none",children:[s.jsx("span",{className:"text-4xl",children:"🙈"}),s.jsx("p",{className:"text-white font-black text-sm mt-2",children:"PARTNER HIDDEN"}),s.jsx("p",{className:"text-yellow-400 text-xs text-center px-6 mt-1",children:"Since you're faceless, we won't show you the opposing user's face."}),s.jsx("p",{className:"text-neutral-400 text-xs text-center px-6 mt-1",children:"Turn on your camera to see them."})]}),G!=="connected"&&s.jsx("div",{className:"absolute inset-0 bg-black/60 flex flex-col items-center justify-center z-10 overflow-y-auto",children:s.jsxs("div",{className:"flex flex-col items-center gap-3 py-4",children:[s.jsx("div",{className:"w-12 h-12 border-4 border-white/30 border-t-white rounded-full animate-spin"}),s.jsx("p",{className:"text-neutral-400 text-sm",children:G==="waiting"?"Finding a partner...":G==="connecting"?"Connecting...":"Waiting to start..."}),G==="waiting"&&s.jsxs(s.Fragment,{children:[s.jsx(Ly,{isWaiting:G==="waiting",onOpenMyRewards:()=>pe("my-rewards")}),Ie&&s.jsx("button",{onClick:()=>pe("discover"),className:"mt-2 px-4 py-2 bg-pink-600 hover:bg-pink-500 text-white text-xs font-bold rounded-full transition-colors",children:Ue==="Female"?"View Guys On Discover":"View Girls On Discover"}),!Ie&&s.jsx(Ry,{myGender:Ue??null,myUserId:M,onOpenDiscover:()=>pe("discover"),onOpenStore:()=>pe("store"),onOpenMessages:()=>pe("messages"),onDmUser:H=>{nt(H),pe("messages")}}),ma&&M!=="anonymous"&&s.jsx(My,{myUserId:M,myGender:Ue??null,onDmUser:H=>{nt(H),pe("messages")},onOpenDiscover:()=>pe("discover"),onDismiss:()=>ci(!0)})]})]})}),Fc.length>0&&G==="connected"&&s.jsx("div",{className:"absolute bottom-2 left-2 z-20 flex flex-wrap gap-1.5 max-w-[70%]",children:Fc.map(H=>s.jsxs("span",{className:"bg-blue-600/80 backdrop-blur-sm text-white text-[11px] font-bold px-2.5 py-1 rounded-full shadow-lg",children:["📌 ",H.name]}
550,H.id))}),Wo.length>0&&G==="connected"&&s.jsx("div",{className:"absolute top-2 right-2 z-20",children:s.jsx(Cd,{pinnedSocials:Wo})}),G==="connected"&&ie&&s.jsx("button",{onClick:()=>A(!0),className:"absolute top-2 left-2 z-20 w-9 h-9 rounded-full overflow-hidden hover:scale-110 transition-transform shadow-lg",title:"Report User",children:s.jsx("img",{src:Cp,alt:"Report",className:"w-full h-full object-cover"})}),G==="connected"&&_x&&ie&&s.jsx("button",{onClick:()=>O(!0),className:"absolute top-14 left-2 z-20 w-10 h-10 hover:scale-110 transition-transform drop-shadow-lg",title:"This user is frozen",children:s.jsx("img",{src:Mf,alt:"Frozen",className:"w-full h-full object-contain"})}),G==="connected"&&be&&!F&&ie&&!Re&&s.jsx("div",{className:"absolute bottom-14 left-2 z-20",children:s.jsx(Ay,{recipientId:ie})}),Dt&&s.jsxs("button",{onClick:Eh,className:"absolute bottom-3 right-3 z-40 flex items-center gap-2 bg-black/60 hover:bg-black/80 backdrop-blur-sm rounded-lg px-5 py-2 transition-colors",children:[s.jsx("span",{className:"font-bold text-sm",children:"NEXT"}),s.jsx("img",{src:Fy,alt:"Next",className:"w-8 h-8"})]}),Dt&&G==="connected"&&F&&(Ce==null?void 0:Ce.toLowerCase())==="male"&&s.jsxs("button",{onClick:Nx,title:"Skip and flag this user as inappropriate",className:"absolute bottom-3 right-[140px] z-40 flex items-center gap-2 bg-destructive/85 hover:bg-destructive backdrop-blur-sm rounded-lg px-4 py-2 transition-colors text-destructive-foreground",children:[s.jsx("span",{className:"font-bold text-sm",children:"🚩 SKIP"}),s.jsx("span",{className:"text-[10px] opacity-90",children:"inappropriate"})]})]})]}),Ht&&!d&&s.jsx("div",{className:"flex justify-center py-3 md:hidden cursor-grab active:cursor-grabbing",onTouchStart:H=>{const ve=H.touches[0].clientY,Se=H.currentTarget,Je=At=>{const Jt=At.touches[0].clientY-ve;Math.abs(Jt)>20&&(m(Jt<0),Se.removeEventListener("touchmove",Je))};Se.addEventListener("touchmove",Je,{passive:!0}),Se.addEventListener("touchend",()=>Se.removeEventListener("touchmove",Je),{once:!0})},onClick:()=>m(!f),children:f?s.jsx("span",{className:"text-[10px] text-neutral-400 font-medium tracking-wide animate-pulse",children:"↓ View more ↓"}):s.jsx("div",{className:"w-12 h-1.5 rounded-full bg-neutral-500"})}),Dt&&G==="connected"&&ie&&!F&&(Ce==null?void 0:Ce.toLowerCase())==="female"&&s.jsx("div",{className:"px-4 pt-2 pb-1",children:s.jsxs("button",{onClick:()=>{nt(ie),pe("messages")},className:"w-full max-w-md mx-auto flex items-center justify-center gap-2 bg-yellow-400 hover:bg-yellow-300 text-black font-black text-base py-3.5 rounded-full shadow-[0_0_24px_rgba(250,204,21,0.55)] active:scale-[0.98] transition-all",children:[s.jsx("span",{className:"text-lg",children:"💬"}),"MESSAGE ME"]})}),Dt&&G==="connected"&&ie&&F&&(Ce==null?void 0:Ce.toLowerCase())==="male"&&s.jsx("div",{className:"px-4 pt-2 pb-1",children:s.jsx("button",{type:"button",onClick:()=>w(!0),className:"w-full max-w-md mx-auto block bg-gradient-to-r from-pink-600/30 to-purple-600/30 border border-pink-400/40 rounded-2xl px-4 py-3 text-center hover:from-pink-600/40 hover:to-purple-600/40 transition-all",children:s.jsx("p",{className:"text-pink-200 text-sm font-bold leading-snug",children:'Tell him to "Message Me" to keep chatting and earn cash bounties! 💰💬'})})}),F&&Ht&&!d&&s.jsx("div",{className:"px-4 pt-1 pb-2",children:s.jsxs("button",{onClick:()=>w(!0),className:"w-full max-w-md mx-auto flex items-center justify-center gap-2 bg-gradient-to-r from-pink-500 via-fuchsia-500 to-purple-600 text-white font-black text-base py-3.5 rounded-full shadow-lg shadow-pink-500/30 active:scale-[0.98] transition-all",children:[s.jsx("span",{className:"text-lg",children:"👛"}),"Earn Money DMing Guys"]})}),!Dt&&s.jsx(i$,{userId:M,gender:Ue}),d?s.jsx("div",{className:"px-3 pb-4",children:s.jsx(mO,{totalMinutes:ha,onClose:()=>u(!1)})}):s.jsx(s.Fragment,{children:s.jsxs("div",{className:`transition-all duration-300 ${Ht&&f?"max-h-0 overflow-hidden opacity-0 pointer-events-none":"max-h-[300px] opacity-100 overflow-visible"} md:max-h-none md:opacity-100 md:overflow-visible`,children:[s.jsxs("div",{className:"flex justify-center gap-5 md:gap-10 px-4 pt-2 pb-3 flex-wrap",children:[s.jsxs("div",{className:"relative flex flex-col items-center",children:[ae&&s.jsx("div",{className:"absolute -top-10 left-1/2 -translate-x-1/2 z-[9999] whitespace-nowrap",children:s.jsxs("div",{className:"bg-pink-500 text-white text-[10px] font-bold px-3 py-1.5 rounded-lg shadow-lg animate-bounce",children:["Tap to view your goals!",s.jsx("div",{className:"absolute left-1/2 -translate-x-1/2 -bottom-1.5 w-3 h-3 bg-pink-500 rotate-45"})]})}),s.jsx(ya,{src:$j,label:"REDEEM",onClick:()=>{xe(!1),Dt?pe("store"):t("/store")},shake:ae})]}),s.jsx(ya,{src:l$,label:"MY REWARDS",onClick:()=>Dt?pe("my-rewards"):t("/my-rewards"),highlight:!0}),s.jsx(ya,{src:c$,label:"TOPICS",onClick:()=>pe("topics")}),s.jsx(ya,{src:u$,label:"PROMO",onClick:()=>pe("promo")}),s.jsx(ya,{src:d$,label:"PROFILE",onClick:()=>Dt?pe("profile"):t("/profile")}),s.jsx(ya,{src:h$,label:kr?"VIP ✓":"VIP",onClick:()=>pe("vip")}),s.jsx(ya,{src:wp,label:"DISCOVER",onClick:()=>Dt?pe("discover"):t("/discover"),badge:fe>0?`${fe>9?"9+":fe} DMs`:null})]}),s.jsxs("div",{className:"flex justify-center items-center gap-8 md:gap-14 pb-6 md:pt-4 text-sm md:text-lg font-bold tracking-wider",children:[s.jsxs("button",{onClick:()=>
550{if(!kr){pe("vip");return}c("girls")},className:`uppercase transition-colors ${l==="girls"?"text-yellow-400":"text-neutral-400 hover:text-white"}`,children:[s.jsx("span",{className:"text-[10px] block text-neutral-500 font-normal tracking-wide",children:"CONNECT TO"}),"GIRLS"]}),s.jsx("button",{onClick:()=>c("both"),className:`uppercase transition-colors text-lg ${l==="both"?"text-white font-extrabold":"text-neutral-400 hover:text-white"}`,children:"BOTH"}),s.jsxs("button",{onClick:()=>{if(!kr){pe("vip");return}c("guys")},className:`uppercase transition-colors ${l==="guys"?"text-yellow-400":"text-neutral-400 hover:text-white"}`,children:[s.jsx("span",{className:"text-[10px] block text-neutral-500 font-normal tracking-wide",children:"CONNECT TO"}),"GUYS"]})]})]})}),De==="store"&&s.jsx(va,{onClose:()=>pe(null),children:s.jsx(Fj,{onClose:()=>pe(null)})}),De==="my-rewards"&&s.jsx(va,{onClose:()=>pe(null),children:s.jsx(Hj,{onClose:()=>pe(null)})}),De==="profile"&&s.jsx(va,{onClose:()=>pe(null),children:s.jsx(Wj,{onClose:()=>pe(null)})}),De==="promo"&&s.jsx(va,{onClose:()=>pe(null),children:s.jsx(XL,{userId:M,adPoints:Mo,onClose:()=>pe(null),onAdPointsChange:Ic})}),De==="topics"&&s.jsx(QL,{userId:M,onClose:()=>
550{pe(null),e.invalidateQueries({queryKey:["my_pinned_topics"]})}}),De==="vip"&&s.jsx(tM,{onClose:()=>pe(null),currentTier:$o,onPurchase:H=>Fo(H,"videocall_vip_overlay"),onManage:()=>(pe("vip-settings"),Promise.resolve())}),De==="vip-settings"&&s.jsx(Vj,{onClose:()=>pe(null),userId:M,vipTier:$o,genderFilter:l,onGenderFilterChange:H=>c(H)}),De==="discover"&&s.jsx(va,{onClose:()=>pe(null),children:s.jsx(qM,{onClose:()=>pe(null)})}),De==="messages"&&s.jsx(va,{onClose:()=>{nt(void 0),pe(null)},children:s.jsx(lx,{onClose:()=>{nt(void 0),pe(null)},initialPartnerId:Qt})}),De==="challenges"&&s.jsx(va,{onClose:()=>pe(null),children:s.jsx(YL,{onClose:()=>pe(null)})}),le&&s.jsx(r$,{onClose:()=>de(!1),userId:M,gender:Ue,context:Ke,isMobile:tt,onBrowseDiscover:()=>pe("discover")}),ge&&s.jsx(hO,{minutesLost:2,onDismiss:()=>J(!1),onUpgrade:()=>{J(!1),pe("vip")}}),ue&&s.jsx(fO,{minutesLost:2,onDone:()=>Ee(!1)}),Tc&&ai&&s.jsx(dO,{isVip:ai.isVip,cap:ai.cap,onDismiss:Rc,voiceMode:F&&P}),Ac&&s.jsx(nM,{onDismiss:()=>bs(!1),onSnooze:()=>{localStorage.setItem("freeze_popup_snoozed_until",String(Date.now()+24*60*60*1e3)),bs(!1)},onGoToChallenges:()=>{bs(!1),pe("profile")},isVip:kr,onPurchaseVip:async()=>{const{VIP_TIERS:H}=await ne(async()=>{const{VIP_TIERS:ve}=await Promise.resolve().then(()=>Uu);return{VIP_TIERS:ve}},void 0);Fo(H.basic.price_id,"minutes_frozen_popup")},isFemale:F}),Dc&&s.jsx(G6,{onDismiss:()=>Bo(!1),isFemale:F}),Lc&&M!=="anonymous"&&G==="waiting"&&!K&&s.jsx(Y6,{userId:M,isFemale:F,onClose:()=>li(!1)}),K&&s.jsx(Q6,{partnerId:K,onMessage:H=>{Ne(null),nt(H),pe("messages")},onClose:()=>Ne(null)}),v&&ie&&s.jsx(X0,{recipientId:ie,onClose:()=>g(!1)}),x&&s.jsx(nx,{onClose:()=>w(!1)}),C&&ie&&s.jsx(iM,{reporterId:M,reportedUserId:ie,remoteVideoRef:ct,onClose:()=>A(!1)}),I&&ie&&s.jsx("div",{className:"fixed inset-0 z-50 bg-black/80 flex items-center justify-center px-6",children:s.jsxs("div",{className:"bg-neutral-900 rounded-2xl p-6 max-w-sm w-full text-center relative",children:[s.jsx("button",{onClick:()=>O(!1),className:"absolute top-3 left-3 text-white hover:text-neutral-300",children:s.jsx(Rn,{className:"w-7 h-7"})}),s.jsx("img",{src:Mf,alt:"Frozen",className:"w-20 h-20 mx-auto mb-4"}),s.jsxs("h2",{className:"text-white font-black text-2xl leading-tight mb-3",children:["The user is frozen",s.jsx("br",{}),"they need your help!"]}),s.jsxs("p",{className:"text-neutral-300 text-sm mb-6",children:["Their earning rate is reduced to"," ",s.jsx("span",{className:"text-blue-400 font-black",children:"2 minutes"})," per user instead of 10 or 30 minutes."]}),s.jsxs("button",{onClick:async()=>{try{const{data:H,error:ve}=await S.functions.invoke("unfreeze-purchase",{body:{action:"purchase_for_partner",partner_id:ie}});if(ve)throw ve;H!=null&&H.url&&(window.location.href=H.url),O(!1)}catch(H){B.error(H.message||"Failed to start checkout")}},className:"w-full py-4 rounded-xl border-2 border-blue-500 bg-blue-500/10 hover:bg-blue-500/20 transition-colors",children:[s.jsx("span",{className:"text-white font-black text-2xl block",children:"Unfreeze Them"}),s.jsx("span",{className:"text-blue-300 font-bold text-lg",children:"$1.99"})]})]})}),te&&s.jsx(R6,{requestId:te.id,recipientCutCents:te.recipient_cut_cents,onAccept:()=>{ce(null),ye(!0),T(!1),pt()},onDecline:()=>ce(null)}),s.jsx(ux,{open:V,onClose:()=>q(!1),onComplete:()=>{q(!1),ft()}}),s.jsx(H6,{open:D,onClose:()=>$(!1),userId:M,currentItemCount:Pe,maxItems:3,onItemAdded:()=>{Z(),localStorage.getItem("c24_redeem_tooltip_shown")||(localStorage.setItem("c24_redeem_tooltip_shown","1"),Ht&&m(!1),setTimeout(()=>{xe(!0),setTimeout(()=>xe(!1),8e3)},500))}}),jh&&s.jsx(O6,{onConfirmBan:kc,onDismiss:Sc})]})},p$=()=>s.jsx("div",{className:"min-h-screen bg-[#1a1a1a] text-white",children:s.jsx("main",{children:s.jsx(hE,{})})}),x$=se(()=>ne(()=>import("./AdminLayout-Dhl4LA_h.js"),__vite__mapDeps([2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21]))),g$=se(()=>ne(()=>import("./ProtectedAdminRoute-C8pEwGSG.js"),[])),b$=se(()=>ne(()=>import("./DashboardPage-CUsmIc1n.js"),__vite__mapDeps([22,23,4]))),y$=se(()=>ne(()=>import("./MembersPage-BFDfDJpC.js"),__vite__mapDeps([24,25,26,27,28,29,30,31,14,13,32,21]))),v$=se(()=>ne(()=>import("./RewardsPage-CuttddRs.js"),__vite__mapDeps([33,34,26,31,14,13,28,27,25,29]))),Uy=se(()=>ne(()=>import("./AddRewardPage-DT54WfxU.js"),__vite__mapDeps([35,36,32,31,14,13,28,37,23,38,39]))),w$=se(()=>ne(()=>import("./CategoriesPage-ssv35E9G.js"),__vite__mapDeps([40,34,26,31,14,13,28,27,25,29,5,41]))),By=se(()=>ne(()=>import("./AddCategoryPage-PCynJ2qv.js"),__vite__mapDeps([42,36,32,31,14,13,28,19,20,23,39]))),_$=se(()=>ne(()=>import("./PromosPage-D2d6YXZ2.js"),__vite__mapDeps([43,34,26,31,14,13,28,27,25,29,4]))),ju=se(()=>ne(()=>import("./PlaceholderPage-CFEVz5j5.js"),__vite__mapDeps([44,23]))
550),j$=se(()=>ne(()=>import("./AdminLoginPage-DImZobnJ.js"),__vite__mapDeps([45,32,23]))),N$=se(()=>ne(()=>import("./AdminResetPasswordPage-C3prARVX.js"),__vite__mapDeps([46,32,23]))),k$=se(()=>ne(()=>import("./ManageMinutesPage-DCD9jP7t.js"),__vite__mapDeps([47,32]))),S$=se(()=>ne(()=>import("./TopicsPage-CJxGdL7B.js"),__vite__mapDeps([48,31,14,13,28,29,38]))),C$=se(()=>ne(()=>import("./MemberRewardsPage-U2rgLBr2.js"),__vite__mapDeps([49,34,26,31,14,13,28,27,25,50,19,29]))),E$=se(()=>ne(()=>import("./EditMemberRewardPage-DVCn6Qg7.js"),__vite__mapDeps([51,32,31,14,13,28,52]))),P$=se(()=>ne(()=>import("./FreezeSettingsPage-Dyff-_Zn.js"),[])),zy=se(()=>ne(()=>import("./AdminChallengesPage-CEno0wVF.js"),__vite__mapDeps([53,38]))),T$=se(()=>ne(()=>import("./AdminMemberChallengesPage-Cqh72thF.js"),[])),R$=se(()=>ne(()=>import("./AdminChallengeIssuesPage-CbvcheOr.js"),[])),A$=se(()=>ne(()=>import("./AdminSpinPrizesPage-DyhOJzHa.js"),__vite__mapDeps([54,37,28,23]))),I$=se(()=>ne(()=>import("./AdminSpinWinnersPage-0SLHa116.js"),__vite__mapDeps([55,26]))),O$=se(()=>ne(()=>import("./LegendaryCashoutPage-Cns5Oevy.js"),__vite__mapDeps([56,23,25]))),D$=se(()=>ne(()=>import("./AdminEmailTemplatesPage-DUzjEcFP.js"),__vite__mapDeps([57,23,32,37,28,25,58,52]))),L$=se(()=>ne(()=>import("./AdminEmailDashboardPage-CDhmJDWj.js"),__vite__mapDeps([59,23,25,60,17,61,18,15,31,14,13,28,26,62,7]))),M$=se(()=>ne(()=>import("./AdminGiftCardsPage-D3EaCdXg.js"),__vite__mapDeps([63,32,25,30,38]))),$$=se(()=>ne(()=>import("./AdminRoomsPage-CD-grknU.js"),__vite__mapDeps([64,25,23,50,19,13,60,17]))),qy=se(()=>ne(()=>import("./AnchorSettingsPage-BqawLxGd.js"),[])),F$=se(()=>ne(()=>import("./SystemHealthPage-yW9wldb9.js"),__vite__mapDeps([65,23,25,11,66,10,7]))),U$=se(()=>ne(()=>import("./NotificationHealthPage-hkfzIZ7V.js"),__vite__mapDeps([67,23,25,66,16,17,18]))),B$=se(()=>ne(()=>import("./RevenuePage-Da4w-E57.js"),__vite__mapDeps([68,23,25,66,10,62,69]))),z$=se(()=>ne(()=>import("./AdminBannedUsersPage-6rPLcjAf.js"),__vite__mapDeps([70,34,26,31,14,13,28,27,25,30,71]))),q$=se(()=>ne(()=>import("./UserAnalyticsPage-D746HNFx.js"),__vite__mapDeps([72,23,31,14,13,28,17,60,11,10,41,69,61]))),V$=se(()=>ne(()=>import("./AdminDiscoverReviewPage-CGiE4Yev.js"),__vite__mapDeps([73,25,50,19,13,30,58,74]))),W$=se(()=>ne(()=>import("./TapAnalyticsPage-Cmyga7wk.js"),__vite__mapDeps([75,23,26,10,41]))),H$=se(()=>ne(()=>import("./AdminNativeAppUsersPage-D5rVaruQ.js"),__vite__mapDeps([76,23,25,26,20]))),G$=se(()=>ne(()=>import("./AdminDmMonitorPage-cMahV6lC.js"),__vite__mapDeps([77,12,13,14,25,21,60,17]))),K$=se(()=>ne(()=>import("./AdminAnnouncementsPage-D-ZiUiH5.js"),__vite__mapDeps([78,32,37,28,31,14,13]))),Y$=se(()=>ne(()=>import("./ReportedUsersPage-BxfC7aCv.js"),__vite__mapDeps([79,23,25]))),Q$=se(()=>ne(()=>import("./AdminUserRolesPage-CQVwilNR.js"),__vite__mapDeps([80,31,14,13,28,26,29,71,21]))),J$=se(()=>ne(()=>import("./ModeratorPermissionsPage-9B9w200b.js"),__vite__mapDeps([81,3,4,5,6,7,8,9,10,11,37,28]))),X$=se(()=>ne(()=>import("./AdminGiftHistoryPage-Brra9Ozb.js"),__vite__mapDeps([82,23]))),Z$=se(()=>ne(()=>import("./CameraUnlockSettingsPage-BKQGnNK0.js"),__vite__mapDeps([83,32,52]))),e8=se(()=>ne(()=>import("./CameraUnlockSuccessPage-BW75ArZ1.js"),[])),$f=se(()=>ne(()=>import("./AdminReferralsPage-NmhRPgeK.js"),[])),t8=se(()=>ne(()=>import("./AdminJackpotPayoutsPage-O4l-HdmU.js"),__vite__mapDeps([84,23,25]))),n8=se(()=>ne(()=>import("./AdminWagerSettingsPage-Csmgw69n.js"),__vite__mapDeps([85,23,32,9,52]))),r8=se(()=>ne(()=>import("./AdminBlogPage-BWdnw2SN.js"),__vite__mapDeps([86,38,60,17]))),Vy=se(()=>ne(()=>import("./AdminBlogEditorPage-Cq6iQyzt.js"),__vite__mapDeps([87,32,31,14,13,28,52]))),s8=se(()=>ne(()=>import("./WishlistSettingsPage-BVCdv-7i.js"),__vite__mapDeps([88,32]))),a8=se(()=>ne(()=>import("./AdminRedditTasksPage-Desfa1RX.js"),__vite__mapDeps([89,32,23,25,37,28,27,30,31,14,13,38]))),i8=se(()=>ne(()=>import("./AdminChecklistPage-qMRgpPir.js"),__vite__mapDeps([90,32,23,25,27,28,30,31,14,13,8,38]))),o8=se(()=>ne(()=>import("./AdminIapPurchasesPage-BnZrCIRy.js"),__vite__mapDeps([91,25,66]))),l8=se(()=>ne(()=>import("./VipPurchaseAnalyticsPage-C1PFPDxh.js"),__vite__mapDeps([92,23,25,74]))),c8=se(()=>ne(()=>Promise.resolve().then(()=>kO),void 0)),u8=se(()=>ne(()=>Promise.resolve().then(()=>qO),void 0)),d8=se(()=>ne(()=>Promise.resolve().then(()=>QO),void 0)),h8=se(()=>ne(()=>import("./SettingsPage-DH0PKahe.js"),__vite__mapDeps([93,62,94]))),f8=se(()=>ne(()=>import("./ResetPasswordPage-I_4BdYyQ.js"),__vite__mapDeps([95,94]))),m8=se(()=>ne(()=>import("./EarnHistoryPage-BdBIClG-.js"),[])),p8=se(()=>ne(()=>import("./RulesPage-yFXBqvs3.js"),[])),x8=se(()=>ne(()=>import("./DiscoverPage-BBlNcLkm.js"),__vite__mapDeps([96,30]))),g8=se(()=>ne(()=>Promise.resolve().then(()=>$L),void 0)),b8=se(()=>ne(()=>import("./EarningsChatPage-BDdGSRfz.js"),[])),y8=se(()=>ne(()=>import("./HowToGuidePage-zxsyxRGu.js"),__vite__mapDeps([97,13]))),v8=se(()=>ne(()=>import("./OpenAppPage-TMr8BquI.js"),[])),w8=se(()=>ne(()=>import("./EarnMoneyPage-DR79yc2k.js"),[])),_8=se(()=>ne(()=>import("./TermsPage-gipxh0X5.js"),[])),j8=se(()=>ne(()=>
550import("./PrivacyPolicyPage-DC-XuyCH.js"),[])),N8=se(()=>ne(()=>import("./SafetyCenterPage-CR4KAPMR.js"),__vite__mapDeps([98,7]))),k8=se(()=>ne(()=>Promise.resolve().then(()=>PO),void 0)),S8=se(()=>ne(()=>import("./GiftSuccessPage-DEfXXHa9.js"),[])),C8=se(()=>ne(()=>import("./RechargeSuccessPage-8R8sVf5i.js"),[])),E8=se(()=>ne(()=>import("./BlogPage-VN7JQijN.js"),__vite__mapDeps([99,62,60,17]))),P8=se(()=>ne(()=>import("./BlogPostPage-KyyfoqS-.js"),__vite__mapDeps([100,21,62,60,17]))),T8=se(()=>ne(()=>import("./TopOmegleAlternativesPage-OvE8sf-z.js"),[])),R8=se(()=>ne(()=>import("./VideoChatWithStrangersPage-BZLUING1.js"),__vite__mapDeps([101,102]))),A8=se(()=>ne(()=>import("./RandomVideoChatPage-CoSMUUfS.js"),__vite__mapDeps([103,102]))),I8=se(()=>ne(()=>import("./TalkToStrangersPage-DuNtdBN_.js"),__vite__mapDeps([104,102]))),O8=se(()=>ne(()=>import("./FreeVideoChatNoSignUpPage-CM70Sa9f.js"),__vite__mapDeps([105,102]))),D8=se(()=>ne(()=>import("./CamChatPage-CZz-PWHF.js"),__vite__mapDeps([106,102]))),L8=se(()=>ne(()=>import("./OmeTvAlternativePage-DKRkrQZP.js"),__vite__mapDeps([107,102]))),M8=se(()=>ne(()=>import("./MonkeyAppAlternativePage-BaElSx4k.js"),__vite__mapDeps([108,102]))),$8=se(()=>ne(()=>import("./CSAEPolicyPage-D8VM6LD3.js"),__vite__mapDeps([109,6]))),F8=se(()=>ne(()=>import("./CallMePage-D9BDnafD.js"),[])),U8=se(()=>ne(()=>import("./ContactPage-BxDv7SaV.js"),__vite__mapDeps([110,74,39]))),B8=se(()=>ne(()=>import("./DeleteAccountPage-DCOjb4Cj.js"),__vite__mapDeps([111,74,39]))),z8=se(()=>ne(()=>import("./WorkerRedditTaskPage-CAffQicG.js"),__vite__mapDeps([112,23,25,32,74]))),q8=se(()=>ne(()=>import("./NotFound-AI3u-cVd.js"),[])),V8=new iC({defaultOptions:{queries:{staleTime:6e4,gcTime:5*6e4,refetchOnWindowFocus:!1,refetchOnReconnect:!0,retry:1}}}),W8=()=>s.jsx(dC,{client:V8,children:s.jsx(BA,{children:s.jsxs(n3,{children:[s.jsx(mP,{}),s.jsx(r5,{}),s.jsxs(_E,{children:[s.jsx(JA,{}),s.jsx(ZA,{}),s.jsx(h.Suspense,{fallback:s.jsx("div",{className:"min-h-screen bg-[#1a1a1a] flex items-center justify-center",children:s.jsx("div",{className:"w-8 h-8 border-2 border-white/30 border-t-white rounded-full animate-spin"})}),children:s.jsxs(mE,{children:[s.jsxs(X,{path:"/",element:s.jsx(p$,{}),children:[s.jsx(X,{index:!0,element:s.jsx(KI,{})}),s.jsx(X,{path:"how-to-guide",element:s.jsx(y8,{})}),s.jsx(X,{path:"rules",element:s.jsx(p8,{})}),s.jsx(X,{path:"terms",element:s.jsx(_8,{})}),s.jsx(X,{path:"privacy",element:s.jsx(j8,{})}),s.jsx(X,{path:"safety",element:s.jsx(N8,{})}),s.jsx(X,{path:"blog",element:s.jsx(E8,{})}),s.jsx(X,{path:"blog/:slug",element:s.jsx(P8,{})}),s.jsx(X,{path:"omegle-alternative",element:s.jsx(Hm,{to:"/top-omegle-alternatives",replace:!0})}),s.jsx(X,{path:"top-omegle-alternatives",element:s.jsx(T8,{})}),s.jsx(X,{path:"video-chat-with-strangers",element:s.jsx(R8,{})}),s.jsx(X,{path:"random-video-chat",element:s.jsx(A8,{})}),s.jsx(X,{path:"talk-to-strangers",element:s.jsx(I8,{})}),s.jsx(X,{path:"free-video-chat-no-sign-up",element:s.jsx(O8,{})}),s.jsx(X,{path:"cam-chat",element:s.jsx(D8,{})}),s.jsx(X,{path:"ome-tv-alternative",element:s.jsx(L8,{})}),s.jsx(X,{path:"monkey-app-alternative",element:s.jsx(M8,{})}),s.jsx(X,{path:"csae-policy",element:s.jsx($8,{})}),s.jsx(X,{path:"contact",element:s.jsx(U8,{})}),s.jsx(X,{path:"delete-account",element:s.jsx(B8,{})})]}),s.jsx(X,{path:"/videocall",element:s.jsx(m$,{})}),s.jsx(X,{path:"/store",element:s.jsx(c8,{})}),s.jsx(X,{path:"/profile",element:s.jsx(u8,{})}),s.jsx(X,{path:"/my-rewards",element:s.jsx(d8,{})}),s.jsx(X,{path:"/settings",element:s.jsx(h8,{})}),s.jsx(X,{path:"/reset-password",element:s.jsx(f8,{})}),s.jsx(X,{path:"/earn-history",element:s.jsx(m8,{})}),s.jsx(X,{path:"/discover",element:s.jsx(x8,{})}),s.jsx(X,{path:"/earnings-chat",element:s.jsx(b8,{})}),s.jsx(X,{path:"/referral",element:s.jsx(k8,{})}),s.jsx(X,{path:"/messages",element:s.jsx(g8,{})}),s.jsx(X,{path:"/gift-success",element:s.jsx(S8,{})}),s.jsx(X,{path:"/recharge-success",element:s.jsx(C8,{})}),s.jsx(X,{path:"/camera-unlock-success",element:s.jsx(e8,{})}),s.jsx(X,{path:"/call/:slug",element:s.jsx(F8,{})}),s.jsx(X,{path:"/open",element:s.jsx(v8,{})}),s.jsx(X,{path:"/earn-money",element:s.jsx(w8,{})}),s.jsx(X,{path:"/work/c24",element:s.jsx(z8,{})}),s.jsx(X,{path:"/admin/login",element:s.jsx(j$,{})}),s.jsx(X,{path:"/admin/reset-password",element:s.jsx(N$,{})}),s.jsxs(X,{path:"/admin",element:s.jsx(h.Suspense,{fallback:s.jsx("div",{className:"min-h-screen bg-[#1a1a1a] flex items-center justify-center",children:s.jsx("div",{className:"w-8 h-8 border-2 border-white/30 border-t-white rounded-full animate-spin"})}),children:s.jsx(g$,{children:s.jsx(x$,{})})}),children:[s.jsx(X,{index:!0,element:s.jsx(b$,{})}),s.jsx(X,{path:"members",element:s.jsx(y$,{})}),s.jsx(X,{path:"members/new",element:s.jsx(ju,{title:"Add New Member"})}),s.jsx(X,{path:"rooms",element:s.jsx($$,{})}),s.jsx(X,{path:"rewards",element:s.jsx(v$,{})}),s.jsx(X,{path:"rewards/new",element:s.jsx(Uy,{})}),s.jsx(X,{path:"rewards/:id/edit",element:s.jsx(Uy,{})}),s.jsx(X,{path:"member-rewards",element:s.jsx(C$,{})}),s.jsx(X,{path:"member-rewards/:id/edit",element:s.jsx(E$,{})}),s.jsx(X,{path:"gift-history",element:s.jsx(X$,{})}),s.jsx(X,{path:"promos",element:s.jsx(_$,{})}),s.jsx(X,{path:"reported-users",element:s.jsx(Y$,{})}),s.jsx(X,{path:"discover-review",element:s.jsx(V$,{})}),s.jsx(X,{path:"categories",element:s.jsx(w$,{})}),s.jsx(X,{path:"categories/new",element:s.jsx(By,{})}),s.jsx(X,{path:"categories/:id/edit",element:s.jsx(By,{})}),s.jsx(X,{path:"topics",element:s.jsx(S$,{})}),s.jsx(X,{path:"reported-promos",element:s.jsx(ju,{title:"Reported Promos"})}),s.jsx(X,{path:"banned-users",element:s.jsx(z$,{})}),s.jsx(X,{path:"ban-by-ip",element:s.jsx(ju,{title:"Ban by IP"})}),s.jsx(X,{path:"challenges",element:s.jsx(zy,{})}),s.jsx(X,{path:"challenges/new",element:s.jsx(zy,{})}),s.jsx(X,{path:"member-challenges",element:s.jsx(T$,{})}),s.jsx(X,{path:"challenge-issues",element:s.jsx(R$,{})}),s.jsx(X,{path:"spin-to-win",element:s.jsx(A$,{})}),s.jsx(X,{path:"spin-to-win/winners",element:s.jsx(I$,{})}),s.jsx(X,{path:"legendary-cashout",element:s.jsx(O$,{})}),s.jsx(X,{path:"jackpot-payouts",element:s.jsx(t8,{})}
550),s.jsx(X,{path:"wager-settings",element:s.jsx(n8,{})}),s.jsx(X,{path:"gift-cards",element:s.jsx(M$,{})}),s.jsx(X,{path:"referrals",element:s.jsx($f,{})}),s.jsx(X,{path:"referrals/invitations",element:s.jsx($f,{})}),s.jsx(X,{path:"referrals/cashouts",element:s.jsx($f,{})}),s.jsx(X,{path:"anchor-rewards/cashouts",element:s.jsx(qy,{})}),s.jsx(X,{path:"anchor-rewards/queue",element:s.jsx(qy,{})}),s.jsx(X,{path:"emails",element:s.jsx(D$,{})}),s.jsx(X,{path:"email-analytics",element:s.jsx(L$,{})}),s.jsx(X,{path:"settings",element:s.jsx(ju,{title:"Manage Settings"})}),s.jsx(X,{path:"manage-minutes",element:s.jsx(k$,{})}),s.jsx(X,{path:"freeze-settings",element:s.jsx(P$,{})}),s.jsx(X,{path:"system-health",element:s.jsx(F$,{})}),s.jsx(X,{path:"notification-health",element:s.jsx(U$,{})}),s.jsx(X,{path:"revenue",element:s.jsx(B$,{})}),s.jsx(X,{path:"user-analytics",element:s.jsx(q$,{})}),s.jsx(X,{path:"tap-analytics",element:s.jsx(W$,{})}),s.jsx(X,{path:"native-app-users",element:s.jsx(H$,{})}),s.jsx(X,{path:"dm-monitor",element:s.jsx(G$,{})}),s.jsx(X,{path:"announcements",element:s.jsx(K$,{})}),s.jsx(X,{path:"user-roles",element:s.jsx(Q$,{})}),s.jsx(X,{path:"moderator-permissions",element:s.jsx(J$,{})}),s.jsx(X,{path:"camera-unlock",element:s.jsx(Z$,{})}),s.jsx(X,{path:"wishlist-settings",element:s.jsx(s8,{})}),s.jsx(X,{path:"blog",element:s.jsx(r8,{})}),s.jsx(X,{path:"blog/new",element:s.jsx(Vy,{})}),s.jsx(X,{path:"blog/:id/edit",element:s.jsx(Vy,{})}),s.jsx(X,{path:"reddit-tasks",element:s.jsx(a8,{})}),s.jsx(X,{path:"checklist",element:s.jsx(i8,{})}),s.jsx(X,{path:"iap-purchases",element:s.jsx(o8,{})}),s.jsx(X,{path:"vip-purchases",element:s.jsx(l8,{})})]}),s.jsx(X,{path:"*",element:s.jsx(q8,{})})]})}),s.jsx(eI,{})]})]})})}),Wy="c24-chunk-reload-at",rk=()=>{const e=Number(sessionStorage.getItem(Wy)||0);Date.now()-e<1e4||(sessionStorage.setItem(Wy,String(Date.now())),window.location.reload())};window.addEventListener("vite:preloadError",e=>{e.preventDefault(),rk()});window.addEventListener("unhandledrejection",e=>{var n;const t=String(((n=e.reason)==null?void 0:n.message)||e.reason||"");/Failed to fetch dynamically imported module|Importing a module script failed|error loading dynamically imported module/i.test(t)&&rk()});x1(document.getElementById("root")).render(s.jsx(W8,{}));export{dl as $,LT as A,ic as B,lb as C,Kd as D,Z8 as E,Jj as F,Ft as G,Y1 as H,cf as I,rF as J,aF as K,iF as L,f4 as M,Hm as N,hE as O,So as P,Ur as Q,aN as R,wt as S,Co as T,k_ as U,mr as V,lF as W,We as X,sF as Y,th as Z,j_ as _,ni as a,wL as a$,cs as a0,k4 as a1,bd as a2,JN as a3,B as a4,cF as a5,w_ as a6,v_ as a7,_e as a8,J8 as a9,g4 as aA,m4 as aB,ox as aC,Rn as aD,T4 as aE,np as aF,Y8 as aG,A4 as aH,N_ as aI,o4 as aJ,P4 as aK,Qa as aL,N4 as aM,d4 as aN,ls as aO,g_ as aP,DL as aQ,VN as aR,WN as aS,GN as aT,KN as aU,HN as aV,QN as aW,YN as aX,yL as aY,vL as aZ,NN as a_,dF as aa,hF as ab,oF as ac,us as ad,pF as ae,ps as af,PT as ag,fF as ah,mF as ai,oe as aj,d5 as ak,uF as al,cb as am,he as an,Ql as ao,$t as ap,Xd as aq,ra as ar,jl as as,er as at,An as au,eh as av,_4 as aw,nh as ax,h4 as ay,tp as az,sn as b,_L as b0,xL as b1,gL as b2,bL as b3,In as b4,O5 as b5,nv as b6,x_ as b7,Pd as b8,DM as b9,C4 as bA,ux as bB,gh as bC,OM as bD,ja as bE,za as bF,bO as bG,bI as bH,yI as bI,G8 as bJ,K8 as bK,ne as b
550L,gF as ba,Kt as bb,s4 as bc,Zd as bd,y_ as be,yr as bf,Yl as bg,QI as bh,_c as bi,$0 as bj,vp as bk,Z0 as bl,Qj as bm,kp as bn,a4 as bo,I0 as bp,rD as bq,Gj as br,yO as bs,FM as bt,lx as bu,v4 as bv,zM as bw,AM as bx,UM as by,$M as bz,Ct as c,Jd as d,i4 as e,Mr as f,ds as g,x5 as h,ko as i,s as j,Y_ as k,rn as l,aL as m,bt as n,vD as o,MT as p,Ut as q,h as r,S as s,Fr as t,it as u,$T as v,z1 as w,W1 as x,O0 as y,Kl as z};

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.